-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - veedea #17188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
New Components - veedea #17188
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
components/veedea/actions/list-campaigns/list-campaigns.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import veedea from "../../veedea.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "veedea-list-campaigns", | ||
| name: "List Campaigns", | ||
| description: "Get the list of campaigns created in the Veedea Dashboard. [See the documentation](https://veedea.com/api/doc)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| veedea, | ||
| maxResults: { | ||
| propDefinition: [ | ||
| veedea, | ||
| "maxResults", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const token = await this.veedea.getToken(); | ||
| const campaigns = await this.veedea.getPaginatedResources({ | ||
| fn: this.veedea.listCampaigns, | ||
| args: { | ||
| $, | ||
| token, | ||
| }, | ||
| max: this.maxResults, | ||
| }); | ||
| $.export("$summary", `Successfully retrieved ${campaigns.length} campaigns`); | ||
| return campaigns; | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import veedea from "../../veedea.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "veedea-list-leads", | ||
| name: "List Leads", | ||
| description: "Get a list of leads in a campaign. [See the documentation](https://veedea.com/api/doc)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| veedea, | ||
| campaignId: { | ||
| propDefinition: [ | ||
| veedea, | ||
| "campaignId", | ||
| ], | ||
| }, | ||
| maxResults: { | ||
| propDefinition: [ | ||
| veedea, | ||
| "maxResults", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const token = await this.veedea.getToken(); | ||
| const leads = await this.veedea.getPaginatedResources({ | ||
| fn: this.veedea.listLeads, | ||
| args: { | ||
| $, | ||
| token, | ||
| params: { | ||
| campaign_id: this.campaignId, | ||
| }, | ||
| }, | ||
| max: this.maxResults, | ||
| }); | ||
| $.export("$summary", `Successfully retrieved ${leads.length} leads`); | ||
| return leads; | ||
| }, | ||
| }; |
40 changes: 40 additions & 0 deletions
40
components/veedea/actions/list-product-purchases/list-product-purchases.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import veedea from "../../veedea.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "veedea-list-product-purchases", | ||
| name: "List Product Purchases", | ||
| description: "Retrieves a list of leads who purchased products through the specified campaign. [See the documentation](https://veedea.com/api/doc)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| veedea, | ||
| campaignId: { | ||
| propDefinition: [ | ||
| veedea, | ||
| "campaignId", | ||
| ], | ||
| }, | ||
| maxResults: { | ||
| propDefinition: [ | ||
| veedea, | ||
| "maxResults", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const token = await this.veedea.getToken(); | ||
| const productPurchases = await this.veedea.getPaginatedResources({ | ||
| fn: this.veedea.listProductPurchases, | ||
| args: { | ||
| $, | ||
| token, | ||
| params: { | ||
| campaign_id: this.campaignId, | ||
| }, | ||
| }, | ||
| max: this.maxResults, | ||
| }); | ||
| $.export("$summary", `Successfully retrieved ${productPurchases.length} product purchases`); | ||
| return productPurchases; | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@pipedream/veedea", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Veedea Components", | ||
| "main": "veedea.app.mjs", | ||
| "keywords": [ | ||
|
|
@@ -11,5 +11,8 @@ | |
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.1.0" | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| import { | ||
| DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, ConfigurationError, | ||
| } from "@pipedream/platform"; | ||
| import veedea from "../../veedea.app.mjs"; | ||
|
|
||
| export default { | ||
| props: { | ||
| veedea, | ||
| db: "$.service.db", | ||
| timer: { | ||
| type: "$.interface.timer", | ||
| default: { | ||
| intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, | ||
| }, | ||
| }, | ||
| }, | ||
| methods: { | ||
| _getLastTs() { | ||
| return this.db.get("lastTs"); | ||
| }, | ||
| _setLastTs(ts) { | ||
| this.db.set("lastTs", ts); | ||
| }, | ||
| getTsField() { | ||
| return null; | ||
| }, | ||
| getArgs() { | ||
| return {}; | ||
| }, | ||
| async processEvent(max) { | ||
| const lastTs = this._getLastTs(); | ||
| const tsField = this.getTsField(); | ||
| const fn = this.getResourceFn(); | ||
| const args = this.getArgs(); | ||
| const token = await this.veedea.getToken(); | ||
|
|
||
| const results = this.veedea.paginate({ | ||
| fn, | ||
| args: { | ||
| ...args, | ||
| token, | ||
| }, | ||
| max, | ||
| }); | ||
|
|
||
| const items = []; | ||
| for await (const item of results) { | ||
| const ts = tsField | ||
| ? Date.parse(item[tsField]) | ||
| : null; | ||
| if (!ts) { | ||
| items.push(item); | ||
| } else { | ||
| if (ts > lastTs) { | ||
| items.push(item); | ||
| } else { | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (!items.length) { | ||
| return; | ||
| } | ||
|
|
||
| this._setLastTs(Date.parse(items[0][tsField])); | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| items.reverse().forEach((item) => { | ||
| const meta = this.generateMeta(item); | ||
| this.$emit(item, meta); | ||
| }); | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| getResourceFn() { | ||
| throw new ConfigurationError("getResourceFn is not implemented"); | ||
| }, | ||
| generateMeta() { | ||
| throw new ConfigurationError("generateMeta is not implemented"); | ||
| }, | ||
| }, | ||
| hooks: { | ||
| async deploy() { | ||
| await this.processEvent(25); | ||
| }, | ||
| }, | ||
| async run() { | ||
| await this.processEvent(); | ||
| }, | ||
| }; | ||
26 changes: 26 additions & 0 deletions
26
components/veedea/sources/new-campaign-created/new-campaign-created.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import common from "../common/base.mjs"; | ||
| import sampleEmit from "./test-event.mjs"; | ||
|
|
||
| export default { | ||
| ...common, | ||
| key: "veedea-new-campaign-created", | ||
| name: "New Campaign Created", | ||
| description: "Emit new event when a new campaign is created.", | ||
| version: "0.0.1", | ||
| type: "source", | ||
| dedupe: "unique", | ||
| methods: { | ||
| ...common.methods, | ||
| getResourceFn() { | ||
| return this.veedea.listCampaigns; | ||
| }, | ||
| generateMeta(item) { | ||
| return { | ||
| id: item.id, | ||
| summary: `New Campaign Created: ${item.camp_name}`, | ||
| ts: Date.now(), | ||
| }; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| sampleEmit, | ||
| }; | ||
4 changes: 4 additions & 0 deletions
4
components/veedea/sources/new-campaign-created/test-event.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| export default { | ||
| "id": 11320, | ||
| "camp_name": "My Campaign" | ||
| } |
45 changes: 45 additions & 0 deletions
45
components/veedea/sources/new-lead-created/new-lead-created.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import common from "../common/base.mjs"; | ||
| import sampleEmit from "./test-event.mjs"; | ||
|
|
||
| export default { | ||
| ...common, | ||
| key: "veedea-new-lead-created", | ||
| name: "New Lead Created", | ||
| description: "Emit new event when a new lead is created.", | ||
| version: "0.0.1", | ||
| type: "source", | ||
| dedupe: "unique", | ||
| props: { | ||
| ...common.props, | ||
| campaignId: { | ||
| propDefinition: [ | ||
| common.props.veedea, | ||
| "campaignId", | ||
| ], | ||
| }, | ||
| }, | ||
| methods: { | ||
| ...common.methods, | ||
| getResourceFn() { | ||
| return this.veedea.listLeads; | ||
| }, | ||
| getTsField() { | ||
| return "registerDate"; | ||
| }, | ||
| getArgs() { | ||
| return { | ||
| params: { | ||
| campaignId: this.campaignId, | ||
| }, | ||
| }; | ||
| }, | ||
| generateMeta(item) { | ||
| return { | ||
| id: item.id, | ||
| summary: `New Lead Created: ${item.user_name}`, | ||
| ts: Date.parse(item[this.getTsField()]), | ||
| }; | ||
| }, | ||
| }, | ||
| sampleEmit, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| export default { | ||
| campid: "330", | ||
| user_name: "John Doe", | ||
| user_email: "[email protected]", | ||
| source: "", | ||
| device: "", | ||
| region: "", | ||
| id: 26, | ||
| registerDate: "2025-06-19T12:00:00Z", | ||
| } |
45 changes: 45 additions & 0 deletions
45
components/veedea/sources/new-product-purchase-created/new-product-purchase-created.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import common from "../common/base.mjs"; | ||
| import sampleEmit from "./test-event.mjs"; | ||
|
|
||
| export default { | ||
| ...common, | ||
| key: "veedea-new-product-purchase-created", | ||
| name: "New Product Purchase Created", | ||
| description: "Emit new event when a new product purchase is created.", | ||
| version: "0.0.1", | ||
| type: "source", | ||
| dedupe: "unique", | ||
| props: { | ||
| ...common.props, | ||
| campaignId: { | ||
| propDefinition: [ | ||
| common.props.veedea, | ||
| "campaignId", | ||
| ], | ||
| }, | ||
| }, | ||
| methods: { | ||
| ...common.methods, | ||
| getResourceFn() { | ||
| return this.veedea.listProductPurchases; | ||
| }, | ||
| getTsField() { | ||
| return "purchase_datetime"; | ||
| }, | ||
| getArgs() { | ||
| return { | ||
| params: { | ||
| campaignId: this.campaignId, | ||
| }, | ||
| }; | ||
| }, | ||
| generateMeta(item) { | ||
| return { | ||
| id: item.id, | ||
| summary: `New Product Purchase Created: ${item.prod_name}`, | ||
| ts: Date.parse(item[this.getTsField()]), | ||
| }; | ||
| }, | ||
| }, | ||
| sampleEmit, | ||
| }; |
11 changes: 11 additions & 0 deletions
11
components/veedea/sources/new-product-purchase-created/test-event.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| export default { | ||
| id: 37, | ||
| camp_name: "My Campaign", | ||
| prod_name: "Product Name", | ||
| prod_price: "5.00", | ||
| prod_method: "paypal", | ||
| prod_txs_id: "1234567890", | ||
| cus_name: "John Doe", | ||
| cus_email: "[email protected]", | ||
| purchase_datetime: "2025-06-19T12:00:00Z", | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.