From b123f0b454c36abfce636eb2e4b740cfe996bdd7 Mon Sep 17 00:00:00 2001 From: Leo Vu Date: Thu, 27 Mar 2025 09:27:01 +0700 Subject: [PATCH 1/6] [Enhancement] Update Create Contact action to refine phone number handling and improve descriptions --- .../actions/create-contact/create-contact.mjs | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/components/aircall/actions/create-contact/create-contact.mjs b/components/aircall/actions/create-contact/create-contact.mjs index ab87ccb18999d..d3a97b85af45d 100644 --- a/components/aircall/actions/create-contact/create-contact.mjs +++ b/components/aircall/actions/create-contact/create-contact.mjs @@ -3,36 +3,55 @@ import common from "../common/common-create-update.mjs"; export default { ...common, name: "Create Contact", - description: "Create a contact in Aircall. [See the documentation](https://developer.aircall.io/api-references/#create-a-contact)", + description: + "Create a contact in Aircall. [See the documentation](https://developer.aircall.io/api-references/#create-a-contact)", key: "aircall-create-contact", - version: "0.0.1", + version: "0.0.2", type: "action", props: { ...common.props, emails: { type: "string[]", label: "Emails", - description: "Array of email address objects (max 20). Each should contain `label` and `value`. If a string is provided, it will be used as both the label and value.", + description: + "Array of email address objects (max 20). Each should contain `label` and `value`. If a string is provided, it will be used as both the label and value.", optional: true, }, phoneNumbers: { type: "string[]", label: "Phone Numbers", - description: "Array of phone number objects (max 20). Each should contain `label` and `value`. If a string is provided, it will be used as both the label and value.", + description: + "Array of phone number objects (max 20). Each should contain `label` and `value`. If a string is provided, it will be used as both the label and value. For example, `{{ [{ label: 'Work', value: '+1234567890' }] }}`", }, }, + refinedPhoneNumbers() { + return this.phoneNumbers.map((item) => { + if (typeof item === "object" && item !== null) { + return item; + } + + return { + label: item, + value: item, + }; + }); + }, async run({ $ }) { const data = { ...this.getCommonData(), emails: this.emails, - phone_numbers: this.phoneNumbers, + phone_numbers: this.refinedPhoneNumbers(), }; + const response = await this.aircall.createContact({ $, data, }); - $.export("$summary", `Successfully created contact (ID: ${response?.contact?.id})`); + $.export( + "$summary", + `Successfully created contact (ID: ${response?.contact?.id})`, + ); return response; }, From 83ad50509027d1b6276d38b1710f933eac556609 Mon Sep 17 00:00:00 2001 From: Leo Vu Date: Thu, 27 Mar 2025 09:28:45 +0700 Subject: [PATCH 2/6] [Enhancement] Update phone number handling in Create Contact action --- .../aircall/actions/create-contact/create-contact.mjs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/components/aircall/actions/create-contact/create-contact.mjs b/components/aircall/actions/create-contact/create-contact.mjs index d3a97b85af45d..8b3e4db0c5ae9 100644 --- a/components/aircall/actions/create-contact/create-contact.mjs +++ b/components/aircall/actions/create-contact/create-contact.mjs @@ -21,11 +21,11 @@ export default { type: "string[]", label: "Phone Numbers", description: - "Array of phone number objects (max 20). Each should contain `label` and `value`. If a string is provided, it will be used as both the label and value. For example, `{{ [{ label: 'Work', value: '+1234567890' }] }}`", + "Array of phone number objects (max 20). Each should contain `label` and `value`. If a string is provided, it will be used as both the label and value. For example, `{{ [{\"label\": \"test1\", \"value\": \"+1 812-641-5139\"}] }}`, or `{{ [\"+1 812-641-5139\"] }}`", }, }, - refinedPhoneNumbers() { - return this.phoneNumbers.map((item) => { + async run({ $ }) { + const refinedPhoneNumbers = this.phoneNumbers.map((item) => { if (typeof item === "object" && item !== null) { return item; } @@ -35,12 +35,11 @@ export default { value: item, }; }); - }, - async run({ $ }) { + const data = { ...this.getCommonData(), emails: this.emails, - phone_numbers: this.refinedPhoneNumbers(), + phone_numbers: refinedPhoneNumbers, }; const response = await this.aircall.createContact({ From 5f7706e2bb90497111baf0b368a25fa3f561c145 Mon Sep 17 00:00:00 2001 From: Leo Vu Date: Thu, 27 Mar 2025 09:59:01 +0700 Subject: [PATCH 3/6] Add pnpm-lock.yaml --- pnpm-lock.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a5967e6847e2c..7d0301d2f4479 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -41922,7 +41922,7 @@ snapshots: jest-util: 29.7.0 natural-compare: 1.4.0 pretty-format: 29.7.0 - semver: 7.6.3 + semver: 7.7.1 transitivePeerDependencies: - supports-color From 0dcd7df41759587b0e8937277346e4ea9f18ef48 Mon Sep 17 00:00:00 2001 From: Leo Vu Date: Thu, 27 Mar 2025 10:11:17 +0700 Subject: [PATCH 4/6] [Enhancement] Refine email handling in Create Contact action --- .../actions/create-contact/create-contact.mjs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/components/aircall/actions/create-contact/create-contact.mjs b/components/aircall/actions/create-contact/create-contact.mjs index 8b3e4db0c5ae9..dce4f7c189f45 100644 --- a/components/aircall/actions/create-contact/create-contact.mjs +++ b/components/aircall/actions/create-contact/create-contact.mjs @@ -14,14 +14,14 @@ export default { type: "string[]", label: "Emails", description: - "Array of email address objects (max 20). Each should contain `label` and `value`. If a string is provided, it will be used as both the label and value.", + "Array of email address objects (max 20). Each should contain `label` and `value`. If a string is provided, it will be used as both the label and value. For example, `{{ [{\"label\": \"Work\", \"value\": \"john.doe@test.com\"}] }}`, or `{{ [\"john.doe@test.com\"] }}`", optional: true, }, phoneNumbers: { type: "string[]", label: "Phone Numbers", description: - "Array of phone number objects (max 20). Each should contain `label` and `value`. If a string is provided, it will be used as both the label and value. For example, `{{ [{\"label\": \"test1\", \"value\": \"+1 812-641-5139\"}] }}`, or `{{ [\"+1 812-641-5139\"] }}`", + "Array of phone number objects (max 20). Each should contain `label` and `value`. If a string is provided, it will be used as both the label and value. For example, `{{ [{\"label\": \"Work\", \"value\": \"+1 812-641-5139\"}] }}`, or `{{ [\"+1 812-641-5139\"] }}`", }, }, async run({ $ }) { @@ -35,10 +35,20 @@ export default { value: item, }; }); + const refinedEmails = this.emails.map((item) => { + if (typeof item === "object" && item !== null) { + return item; + } + + return { + label: item, + value: item, + }; + }); const data = { ...this.getCommonData(), - emails: this.emails, + emails: refinedEmails, phone_numbers: refinedPhoneNumbers, }; From 98c30bd483af3db7319ba029f16f79bf4f6d7f66 Mon Sep 17 00:00:00 2001 From: Danny Roosevelt Date: Wed, 26 Mar 2025 20:24:27 -0700 Subject: [PATCH 5/6] Update package.json --- components/aircall/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/aircall/package.json b/components/aircall/package.json index 68da5d2adfd54..57e401645ac14 100644 --- a/components/aircall/package.json +++ b/components/aircall/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/aircall", - "version": "0.1.0", + "version": "0.1.1", "description": "Pipedream Aircall Components", "main": "aircall.app.mjs", "keywords": [ From 227e26b321516bb45296fc3863e21433ebaf0886 Mon Sep 17 00:00:00 2001 From: Leo Vu Date: Thu, 27 Mar 2025 10:25:33 +0700 Subject: [PATCH 6/6] [Enhancement] Handle empty case for phoneNumbers and emails --- components/aircall/actions/create-contact/create-contact.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/aircall/actions/create-contact/create-contact.mjs b/components/aircall/actions/create-contact/create-contact.mjs index dce4f7c189f45..0014d67878917 100644 --- a/components/aircall/actions/create-contact/create-contact.mjs +++ b/components/aircall/actions/create-contact/create-contact.mjs @@ -25,7 +25,7 @@ export default { }, }, async run({ $ }) { - const refinedPhoneNumbers = this.phoneNumbers.map((item) => { + const refinedPhoneNumbers = (this.phoneNumbers || []).map((item) => { if (typeof item === "object" && item !== null) { return item; } @@ -35,7 +35,7 @@ export default { value: item, }; }); - const refinedEmails = this.emails.map((item) => { + const refinedEmails = (this.emails || []).map((item) => { if (typeof item === "object" && item !== null) { return item; }