-
Notifications
You must be signed in to change notification settings - Fork 5.5k
15625 bug update pipedrive components to latest sdk api version #15651
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
luancazarine
merged 10 commits into
master
from
15625-bug-update-pipedrive-components-to-latest-sdk-api-version
Feb 20, 2025
Merged
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
94132f2
[BUG] Update Pipedrive components to latest SDK / API version #15625
luancazarine aa10c7e
pnpm update
luancazarine c2ee377
update package.json version
luancazarine d49de1e
pnpm update
luancazarine 26e35e9
pnpm update
luancazarine 64e4090
some adjusts
luancazarine 5df6447
remove yarn.lock
luancazarine e06a9a5
some adjusts
luancazarine 5b359ee
Merge branch 'master' into 15625-bug-update-pipedrive-components-to-l…
luancazarine 51ebc92
pnpm update
luancazarine 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,13 @@ | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
| import constants from "../../common/constants.mjs"; | ||
| import utils from "../../common/utils.mjs"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import pipedriveApp from "../../pipedrive.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "pipedrive-add-activity", | ||
| name: "Add Activity", | ||
| description: "Adds a new activity. Includes `more_activities_scheduled_in_context` property in response's `additional_data` which indicates whether there are more undone activities scheduled with the same deal, person or organization (depending on the supplied data). See the Pipedrive API docs for Activities [here](https://developers.pipedrive.com/docs/api/v1/#!/Activities). For info on [adding an activity in Pipedrive](https://developers.pipedrive.com/docs/api/v1/Activities#addActivity)", | ||
| version: "0.1.6", | ||
| version: "0.1.7", | ||
| type: "action", | ||
| props: { | ||
| pipedriveApp, | ||
|
|
@@ -15,22 +16,6 @@ export default { | |
| label: "Subject", | ||
| description: "Subject of the activity", | ||
| }, | ||
| done: { | ||
| type: "string", | ||
| label: "Done", | ||
| description: "Whether the activity is done or not. 0 = Not done, 1 = Done", | ||
| optional: true, | ||
| options: [ | ||
| { | ||
| label: "Not done", | ||
| value: "0", | ||
| }, | ||
| { | ||
| label: "Done", | ||
| value: "1", | ||
| }, | ||
| ], | ||
| }, | ||
| type: { | ||
| type: "string", | ||
| label: "Type", | ||
|
|
@@ -45,25 +30,7 @@ export default { | |
| })); | ||
| }, | ||
| }, | ||
| dueDate: { | ||
| type: "string", | ||
| label: "Due Date", | ||
| description: "Due date of the activity. Format: `YYYY-MM-DD`", | ||
| optional: true, | ||
| }, | ||
| dueTime: { | ||
| type: "string", | ||
| label: "Due Time", | ||
| description: "Due time of the activity in UTC. Format: `HH:MM`", | ||
| optional: true, | ||
| }, | ||
| duration: { | ||
| type: "string", | ||
| label: "Duration", | ||
| description: "Duration of the activity. Format: `HH:MM`", | ||
| optional: true, | ||
| }, | ||
| userId: { | ||
| ownerId: { | ||
| propDefinition: [ | ||
| pipedriveApp, | ||
| "userId", | ||
|
|
@@ -76,148 +43,159 @@ export default { | |
| "dealId", | ||
| ], | ||
| }, | ||
| personId: { | ||
| leadId: { | ||
| propDefinition: [ | ||
| pipedriveApp, | ||
| "personId", | ||
| "leadId", | ||
| ], | ||
| description: "ID of the person this activity will be associated with", | ||
| }, | ||
| participants: { | ||
| type: "string[]", | ||
| label: "Participants", | ||
| description: "List of multiple persons (participants) this activity will be associated with. If omitted, single participant from `person_id` field is used. It requires a structure as follows: `[{\"person_id\":1,\"primary_flag\":true}]`", | ||
| optional: true, | ||
| orgId: { | ||
| propDefinition: [ | ||
| pipedriveApp, | ||
| "personId", | ||
| "organizationId", | ||
| ], | ||
| description: "ID of the organization this activity will be associated with", | ||
| }, | ||
| organizationId: { | ||
| projectId: { | ||
| propDefinition: [ | ||
| pipedriveApp, | ||
| "organizationId", | ||
| "projectId", | ||
| ], | ||
| description: "ID of the organization this activity will be associated with", | ||
| }, | ||
luancazarine marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| note: { | ||
| dueDate: { | ||
| type: "string", | ||
| label: "Note", | ||
| description: "Note of the activity (HTML format)", | ||
| label: "Due Date", | ||
| description: "Due date of the activity. Format: `YYYY-MM-DD`", | ||
| optional: true, | ||
| }, | ||
| location: { | ||
| dueTime: { | ||
| type: "string", | ||
| label: "Location", | ||
| description: "The address of the activity. Pipedrive will automatically check if the location matches a geo-location on Google maps.", | ||
| label: "Due Time", | ||
| description: "Due time of the activity in UTC. Format: `HH:MM`", | ||
| optional: true, | ||
| }, | ||
| publicDescription: { | ||
| duration: { | ||
| type: "string", | ||
| label: "Public Description", | ||
| description: "Additional details about the activity that will be synced to your external calendar. Unlike the note added to the activity, the description will be publicly visible to any guests added to the activity.", | ||
| label: "Duration", | ||
| description: "Duration of the activity. Format: `HH:MM`", | ||
| optional: true, | ||
| }, | ||
| busyFlag: { | ||
| busy: { | ||
| type: "boolean", | ||
| label: "Busy Flag", | ||
| label: "Busy", | ||
| description: "Set the activity as 'Busy' or 'Free'. If the flag is set to true, your customers will not be able to book that time slot through any Scheduler links", | ||
| optional: true, | ||
| }, | ||
| done: { | ||
| type: "boolean", | ||
| label: "Done", | ||
| description: "Whether the activity is done or not.", | ||
| optional: true, | ||
| }, | ||
| location: { | ||
| type: "object", | ||
| label: "Location", | ||
| description: "The address of the activity. Pipedrive will automatically check if the location matches a geo-location on Google maps.", | ||
| optional: true, | ||
| }, | ||
| participants: { | ||
| type: "string[]", | ||
| label: "Participants", | ||
| description: "List of multiple persons (participants) this activity will be associated with. If omitted, single participant from `person_id` field is used. It requires a structure as follows: `[{\"person_id\":1,\"primary_flag\":true}]`", | ||
luancazarine marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| optional: true, | ||
| propDefinition: [ | ||
| pipedriveApp, | ||
| "personId", | ||
| ], | ||
| }, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| attendees: { | ||
| type: "string[]", | ||
| label: "Attendees", | ||
| description: "Attendees of the activity. This can be either your existing Pipedrive contacts or an external email address. It requires a structure as follows: `[{\"email_address\":\"[email protected]\"}]` or `[{\"person_id\":1, \"email_address\":\"[email protected]\"}]`", | ||
| optional: true, | ||
| async options({ prevContext }) { | ||
| const { | ||
| moreItemsInCollection, | ||
| start, | ||
| } = prevContext; | ||
|
|
||
| if (moreItemsInCollection === false) { | ||
| if (prevContext?.cursor === false) { | ||
| return []; | ||
| } | ||
|
|
||
| const { | ||
| data: persons, | ||
| additional_data: additionalData, | ||
| } = await this.pipedriveApp.getPersons({ | ||
| start, | ||
| cursor: prevContext.cursor, | ||
| limit: constants.DEFAULT_PAGE_LIMIT, | ||
| }); | ||
|
|
||
| const options = | ||
| persons?.flatMap(({ | ||
| name, email, | ||
| }) => email?.map(({ value }) => ({ | ||
| return { | ||
| options: persons?.flatMap(({ | ||
| name, emails, | ||
| }) => emails?.map(({ value }) => ({ | ||
| label: name, | ||
| value, | ||
| })).filter((option) => option?.value)); | ||
|
|
||
| return { | ||
| options, | ||
| })).filter((option) => option?.value)), | ||
| context: { | ||
| moreItemsInCollection: additionalData.pagination.more_items_in_collection, | ||
| start: additionalData.pagination.next_start, | ||
| cursor: additionalData.next_cursor, | ||
| }, | ||
| }; | ||
| }, | ||
| }, | ||
| publicDescription: { | ||
| type: "string", | ||
| label: "Public Description", | ||
| description: "Additional details about the activity that will be synced to your external calendar. Unlike the note added to the activity, the description will be publicly visible to any guests added to the activity.", | ||
| optional: true, | ||
| }, | ||
| note: { | ||
| type: "string", | ||
| label: "Note", | ||
| description: "Note of the activity (HTML format)", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| subject, | ||
| type, | ||
| pipedriveApp, | ||
| dueDate, | ||
| dueTime, | ||
| duration, | ||
| userId, | ||
| ownerId, | ||
| dealId, | ||
| personId, | ||
| organizationId, | ||
| note, | ||
| leadId, | ||
| orgId, | ||
| projectId, | ||
| location, | ||
| participants, | ||
| attendees, | ||
| publicDescription, | ||
| busyFlag, | ||
| ...data | ||
| } = this; | ||
|
|
||
| const participants = utils.parseOrUndefined(this.participants); | ||
| const attendees = utils.parseOrUndefined(this.attendees); | ||
| const done = utils.parseOrUndefined(this.done); | ||
|
|
||
| try { | ||
| const resp = | ||
| await this.pipedriveApp.addActivity({ | ||
| subject, | ||
| done, | ||
| type, | ||
| await pipedriveApp.addActivity({ | ||
| due_date: dueDate, | ||
| due_time: dueTime, | ||
| duration, | ||
| user_id: userId, | ||
| owner_id: ownerId, | ||
| deal_id: dealId, | ||
| person_id: personId, | ||
| participants: participants?.map((value, idx) => ({ | ||
| lead_id: leadId, | ||
| participants: parseObject(participants)?.map((value, idx) => ({ | ||
| person_id: value, | ||
| primary_flag: !idx, | ||
| primary: !idx, | ||
| })), | ||
| org_id: organizationId, | ||
| note, | ||
| location, | ||
| org_id: orgId, | ||
| project_id: projectId, | ||
| location: parseObject(location), | ||
| public_description: publicDescription, | ||
| busy_flag: busyFlag, | ||
| attendees: attendees?.map((value) => ({ | ||
| email_address: value, | ||
| attendees: parseObject(attendees)?.map((value) => ({ | ||
| email: value, | ||
| })), | ||
| ...data, | ||
| }); | ||
|
|
||
| $.export("$summary", "Successfully added activity"); | ||
|
|
||
| return resp; | ||
| } catch (error) { | ||
| console.error(error.context?.body || error); | ||
| throw error.context?.body?.error || "Failed to add activity"; | ||
| } catch ({ error }) { | ||
| throw new ConfigurationError(error); | ||
| } | ||
| }, | ||
| }; | ||
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.