diff --git a/components/screenshot_fyi/actions/create-screenshot/create-screenshot.mjs b/components/screenshot_fyi/actions/create-screenshot/create-screenshot.mjs new file mode 100644 index 0000000000000..90b5a468a97d0 --- /dev/null +++ b/components/screenshot_fyi/actions/create-screenshot/create-screenshot.mjs @@ -0,0 +1,74 @@ +import screenshot_fyi from "../../screenshot_fyi.app.mjs"; + +export default { + key: "screenshot_fyi-create-screenshot", + name: "Create Screenshot", + description: "Takes a screenshot of a webpage using Screenshot.fyi. [See the documentation](https://www.screenshot.fyi/api-docs)", + version: "0.0.1", + type: "action", + props: { + screenshot_fyi, + url: { + type: "string", + label: "URL", + description: "The URL of the webpage to capture", + }, + width: { + type: "integer", + label: "Width", + description: "Width of the viewport in pixels. Default: `1440`", + optional: true, + }, + height: { + type: "integer", + label: "Height", + description: "Height of the viewport in pixels. Default: `900`", + optional: true, + }, + fullPage: { + type: "boolean", + label: "Full Page", + description: "Capture the full scrollable page. Default: `false`", + optional: true, + }, + format: { + type: "string", + label: "Format", + description: "The format of the screenshot. Default: `jpg`", + options: [ + "png", + "jpg", + "jpeg", + ], + optional: true, + }, + disableCookieBanners: { + type: "boolean", + label: "Disable Cookie Banners", + description: "Attempt to remove cookie consent banners. Default: `true`", + optional: true, + }, + darkMode: { + type: "boolean", + label: "Dark Mode", + description: "Enable dark mode when taking the screenshot. Default: `false`", + optional: true, + }, + }, + async run({ $ }) { + const response = await this.screenshot_fyi.takeScreenshot({ + $, + params: { + url: this.url, + width: this.width, + height: this.height, + fullPage: this.fullPage, + format: this.format, + disableCookieBanners: this.disableCookieBanners, + darkMode: this.darkMode, + }, + }); + $.export("$summary", `Screenshot taken for ${this.url}`); + return response; + }, +}; diff --git a/components/screenshot_fyi/package.json b/components/screenshot_fyi/package.json index a84371047bbc4..db634ce53f182 100644 --- a/components/screenshot_fyi/package.json +++ b/components/screenshot_fyi/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/screenshot_fyi", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream screenshot.fyi Components", "main": "screenshot_fyi.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" } -} \ No newline at end of file +} diff --git a/components/screenshot_fyi/screenshot_fyi.app.mjs b/components/screenshot_fyi/screenshot_fyi.app.mjs index 50d14cb24d837..f68730d766788 100644 --- a/components/screenshot_fyi/screenshot_fyi.app.mjs +++ b/components/screenshot_fyi/screenshot_fyi.app.mjs @@ -1,11 +1,33 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "screenshot_fyi", propDefinitions: {}, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://screenshot.fyi/api"; + }, + _makeRequest({ + $ = this, + path, + params, + ...otherOpts + }) { + return axios($, { + url: `${this._baseUrl()}${path}`, + params: { + ...params, + accessKey: this.$auth.access_key, + }, + ...otherOpts, + }); + }, + takeScreenshot(opts = {}) { + return this._makeRequest({ + path: "/take", + ...opts, + }); }, }, }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c607001294094..c11de0b5281ad 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -94,8 +94,8 @@ importers: specifier: ^12.3.4 version: 12.5.0(enquirer@2.4.1) pnpm: - specifier: 9.14.3 - version: 9.14.3 + specifier: 9.14.2 + version: 9.14.2 putout: specifier: '>=36' version: 36.13.1(eslint@8.57.1)(typescript@5.6.3) @@ -8987,7 +8987,11 @@ importers: specifier: ^1.5.1 version: 1.6.6 - components/screenshot_fyi: {} + components/screenshot_fyi: + dependencies: + '@pipedream/platform': + specifier: ^3.0.3 + version: 3.0.3 components/screenshotone: dependencies: @@ -23118,8 +23122,8 @@ packages: resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} engines: {node: '>=4'} - pnpm@9.14.3: - resolution: {integrity: sha512-wPU+6ZR37ZabgrKJrQEaXRa/FiPJV+fynqvo0MALV0wpuMf1T2xn7nEMc/KFyBVNB85EtG/iwO60dqkEQbrDcQ==} + pnpm@9.14.2: + resolution: {integrity: sha512-biuvd9Brk2IpQVLIUcTyeO3jerHro6Vf2jF6SheyCfTbuXP7JQp3q8Rjo0H8sfF/F8+iQJHE6zGc2g2bhCeDhw==} engines: {node: '>=18.12'} hasBin: true @@ -24579,22 +24583,22 @@ packages: superagent@3.8.1: resolution: {integrity: sha512-VMBFLYgFuRdfeNQSMLbxGSLfmXL/xc+OO+BZp41Za/NRDBet/BNbkRJrYzCUu0u4GU0i/ml2dtT8b9qgkw9z6Q==} engines: {node: '>= 4.0'} - deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at . superagent@4.1.0: resolution: {integrity: sha512-FT3QLMasz0YyCd4uIi5HNe+3t/onxMyEho7C3PSqmti3Twgy2rXT4fmkTz6wRL6bTF4uzPcfkUCa8u4JWHw8Ag==} engines: {node: '>= 6.0'} - deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at . superagent@5.3.1: resolution: {integrity: sha512-wjJ/MoTid2/RuGCOFtlacyGNxN9QLMgcpYLDQlWFIhhdJ93kNscFonGvrpAHSCVjRVj++DGCglocF7Aej1KHvQ==} engines: {node: '>= 7.0.0'} - deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net + deprecated: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at . superagent@7.1.6: resolution: {integrity: sha512-gZkVCQR1gy/oUXr+kxJMLDjla434KmSOKbx5iGD30Ql+AkJQ/YlPKECJy2nhqOsHLjGHzoDTXNSjhnvWhzKk7g==} engines: {node: '>=6.4.0 <13 || >=14'} - deprecated: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net + deprecated: Please downgrade to v7.1.5 if you need IE/ActiveXObject support OR upgrade to v8.0.0 as we no longer support IE and published an incorrect patch version (see https://github.com/visionmedia/superagent/issues/1731) supports-color@2.0.0: resolution: {integrity: sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==} @@ -40518,7 +40522,7 @@ snapshots: pluralize@8.0.0: {} - pnpm@9.14.3: {} + pnpm@9.14.2: {} points-on-curve@0.2.0: {}