-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Adversus - new components #18998
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
Adversus - new components #18998
Changes from all commits
Commits
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
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
94 changes: 94 additions & 0 deletions
94
components/adversus/actions/add-note-activity/add-note-activity.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,94 @@ | ||
| import adversus from "../../adversus.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "adversus-add-note-activity", | ||
| name: "Add Note or Activity", | ||
| description: "Add a note or activity to a lead in Adversus. [See the API documentation](https://solutions.adversus.io/api).", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| adversus, | ||
| leadId: { | ||
| propDefinition: [ | ||
| adversus, | ||
| "leadId", | ||
| ], | ||
| }, | ||
| note: { | ||
| type: "string", | ||
| label: "Note", | ||
| description: "The note text to add to the lead", | ||
| optional: true, | ||
| }, | ||
| activityType: { | ||
| type: "string", | ||
| label: "Activity Type", | ||
| description: "The type of activity (e.g., 'call', 'email', 'meeting')", | ||
| optional: true, | ||
| }, | ||
| activityDescription: { | ||
| type: "string", | ||
| label: "Activity Description", | ||
| description: "The description of the activity", | ||
| optional: true, | ||
| }, | ||
| additionalFields: { | ||
| type: "object", | ||
| label: "Additional Fields", | ||
| description: "Additional fields to include in the note or activity", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| /** | ||
| * Execute the action to add a note or activity to a lead | ||
| * @param {Object} $ - Pipedream context | ||
| * @returns {Promise} The response from adding note/activity | ||
| */ | ||
| async run({ $ }) { | ||
| const promises = []; | ||
|
|
||
| if (this.note) { | ||
| promises.push( | ||
| this.adversus.addNoteToLead(this.leadId, { | ||
| data: { | ||
| note: this.note, | ||
| ...(this.additionalFields || {}), | ||
| }, | ||
| }), | ||
| ); | ||
| } | ||
|
|
||
| if (this.activityType || this.activityDescription) { | ||
| promises.push( | ||
| this.adversus.addActivityToLead(this.leadId, { | ||
| data: { | ||
| ...(this.activityType && { | ||
| type: this.activityType, | ||
| }), | ||
| ...(this.activityDescription && { | ||
| description: this.activityDescription, | ||
| }), | ||
| ...(this.additionalFields || {}), | ||
| }, | ||
| }), | ||
| ); | ||
| } | ||
|
|
||
| if (promises.length === 0) { | ||
| throw new Error("Either 'Note' or 'Activity Type'/'Activity Description' must be provided"); | ||
| } | ||
|
|
||
| const results = await Promise.all(promises); | ||
|
|
||
| $.export("$summary", `Successfully added ${promises.length} item(s) to lead ${this.leadId}`); | ||
|
|
||
| return results.length === 1 | ||
| ? results[0] | ||
| : results; | ||
| }, | ||
| }; | ||
51 changes: 51 additions & 0 deletions
51
components/adversus/actions/assign-to-campaign/assign-to-campaign.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,51 @@ | ||
| import adversus from "../../adversus.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "adversus-assign-to-campaign", | ||
| name: "Assign Lead to Campaign", | ||
| description: "Assign a lead to a campaign in Adversus. [See the API documentation](https://solutions.adversus.io/api).", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: true, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| adversus, | ||
| leadId: { | ||
| propDefinition: [ | ||
| adversus, | ||
| "leadId", | ||
| ], | ||
| }, | ||
| campaignId: { | ||
| propDefinition: [ | ||
| adversus, | ||
| "campaignId", | ||
| ], | ||
| }, | ||
| additionalFields: { | ||
| type: "object", | ||
| label: "Additional Fields", | ||
| description: "Additional fields to include when assigning to campaign", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| /** | ||
| * Execute the action to assign a lead to a campaign | ||
| * @param {Object} $ - Pipedream context | ||
| * @returns {Promise} The response from assigning the lead to campaign | ||
| */ | ||
| async run({ $ }) { | ||
| const response = await this.adversus.assignLeadToCampaign(this.leadId, this.campaignId, { | ||
| data: { | ||
| ...(this.additionalFields || {}), | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully assigned lead ${this.leadId} to campaign ${this.campaignId}`); | ||
|
|
||
| return response; | ||
| }, | ||
| }; |
51 changes: 51 additions & 0 deletions
51
components/adversus/actions/change-lead-status/change-lead-status.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,51 @@ | ||
| import adversus from "../../adversus.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "adversus-change-lead-status", | ||
| name: "Change Lead Status", | ||
| description: "Change the status of a lead in Adversus. [See the API documentation](https://solutions.adversus.io/api).", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: true, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| adversus, | ||
| leadId: { | ||
| propDefinition: [ | ||
| adversus, | ||
| "leadId", | ||
| ], | ||
| }, | ||
| statusId: { | ||
| propDefinition: [ | ||
| adversus, | ||
| "statusId", | ||
| ], | ||
| }, | ||
| additionalFields: { | ||
| type: "object", | ||
| label: "Additional Fields", | ||
| description: "Additional fields to include when changing the status", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| /** | ||
| * Execute the action to change a lead's status | ||
| * @param {Object} $ - Pipedream context | ||
| * @returns {Promise} The response from changing the lead status | ||
| */ | ||
| async run({ $ }) { | ||
| const response = await this.adversus.changeLeadStatus(this.leadId, this.statusId, { | ||
| data: { | ||
| ...(this.additionalFields || {}), | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully changed status of lead ${this.leadId} to status ${this.statusId}`); | ||
|
|
||
| return response; | ||
| }, | ||
| }; |
96 changes: 96 additions & 0 deletions
96
components/adversus/actions/create-or-update-lead/create-or-update-lead.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,96 @@ | ||
| import adversus from "../../adversus.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "adversus-create-or-update-lead", | ||
| name: "Create or Update Lead", | ||
| description: "Create a new lead or update an existing lead in Adversus. [See the API documentation](https://solutions.adversus.io/api).", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: true, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| adversus, | ||
| firstName: { | ||
| type: "string", | ||
| label: "First Name", | ||
| description: "The first name of the lead", | ||
| optional: true, | ||
| }, | ||
| lastName: { | ||
| type: "string", | ||
| label: "Last Name", | ||
| description: "The last name of the lead", | ||
| optional: true, | ||
| }, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "The email address of the lead", | ||
| optional: true, | ||
| }, | ||
| phone: { | ||
| type: "string", | ||
| label: "Phone", | ||
| description: "The phone number of the lead", | ||
| optional: true, | ||
| }, | ||
| leadId: { | ||
| propDefinition: [ | ||
| adversus, | ||
| "leadId", | ||
| ], | ||
| description: "The ID of the lead to update (leave empty to create a new lead)", | ||
| optional: true, | ||
| }, | ||
| additionalFields: { | ||
| type: "object", | ||
| label: "Additional Fields", | ||
| description: "Additional fields to include in the lead data", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| /** | ||
| * Execute the action to create or update a lead | ||
| * @param {Object} $ - Pipedream context | ||
| * @returns {Promise} The created or updated lead response | ||
| */ | ||
| async run({ $ }) { | ||
| const data = { | ||
| ...(this.firstName && { | ||
| firstName: this.firstName, | ||
| }), | ||
|
|
||
| ...(this.lastName && { | ||
| lastName: this.lastName, | ||
| }), | ||
| ...(this.email && { | ||
| email: this.email, | ||
| }), | ||
| ...(this.phone && { | ||
| phone: this.phone, | ||
| }), | ||
| ...(this.additionalFields || {}), | ||
| }; | ||
|
|
||
| if (!Object.keys(data).length) { | ||
| throw new Error("At least one field must be provided to create or update a lead. Please provide firstName, lastName, email, phone, or additionalFields."); | ||
| } | ||
|
|
||
| const response = this.leadId | ||
| ? await this.adversus.updateLead(this.leadId, { | ||
| data, | ||
| }) | ||
| : await this.adversus.createLead({ | ||
| data, | ||
| }); | ||
|
|
||
| $.export("$summary", this.leadId | ||
| ? `Successfully updated lead ${this.leadId}` | ||
| : "Successfully created new lead"); | ||
|
|
||
| return response; | ||
| }, | ||
| }; |
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.