Skip to content

Commit 6d9a37e

Browse files
committed
minor fix
1 parent 097ff38 commit 6d9a37e

File tree

10 files changed

+36
-357
lines changed

10 files changed

+36
-357
lines changed

components/drift/actions/create-contact/create-contact.mjs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,10 @@ export default {
4242

4343
async run({ $ }) {
4444

45-
const warnings = [];
46-
4745
const {
4846
drift, email, name, phone, source,
4947
} = this;
5048

51-
warnings.push(...drift.checkIfEmailValid(email));
52-
5349
const customAttributes = drift.parseIfJSONString(this.customAttributes);
5450

5551
const attributes = removeNullEntries({
@@ -80,7 +76,7 @@ export default {
8076

8177
console.log(response.data.id);
8278

83-
$.export("$summary", `Contact ${email} created.` + warnings.join("\n- "));
79+
$.export("$summary", `Contact "${email}" has been created successfully.`);
8480
return response;
8581
},
8682
};

components/drift/actions/delete-contact/delete-contact.mjs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "drift-delete-contact",
55
name: "Delete Contact",
66
description: "Deletes a contact in Drift by ID or email. [See the docs](https://devdocs.drift.com/docs/removing-a-contact).",
7-
version: "0.0.17",
7+
version: "0.0.1",
88
type: "action",
99
props: {
1010
drift,
@@ -17,13 +17,9 @@ export default {
1717

1818
async run({ $ }) {
1919

20-
const warnings = [];
21-
22-
const { drift } = this;
23-
24-
const emailOrId = drift.trimIfString(this.emailOrId);
25-
26-
warnings.push(...drift.checkEmailOrId(emailOrId));
20+
const {
21+
drift, emailOrId,
22+
} = this;
2723

2824
let contact = await drift.getContactByEmailOrId($, emailOrId);
2925
contact = contact.data[0] || contact.data;
@@ -36,8 +32,8 @@ export default {
3632
contactId,
3733
});
3834

39-
$.export("$summary", `Contact ${contactEmail} ID "${contactId}" deleted successfully.` +
40-
warnings.join("\n- "));
35+
$.export("$summary", `Contact "${contactEmail}" ID "${contactId}"
36+
has been deleted successfully.`);
4137

4238
return response;
4339
},

components/drift/actions/get-contact/get-contact.mjs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,9 @@ export default {
1717

1818
async run({ $ }) {
1919

20-
const warnings = [];
21-
22-
const { drift } = this;
23-
24-
const emailOrId = drift.trimIfString(this.emailOrId);
25-
26-
warnings.push(...drift.checkEmailOrId(emailOrId));
20+
const {
21+
drift, emailOrId,
22+
} = this;
2723

2824
const response = await drift.getContactByEmailOrId($, emailOrId);
2925

@@ -34,7 +30,7 @@ export default {
3430
};
3531

3632
$.export("$summary", `Contact ${contact.attributes.email} ID "${contact.id}"`
37-
+ " fetched successfully." + warnings.join("\n- "));
33+
+ " has been fetched successfully.");
3834

3935
return contact;
4036
},

components/drift/actions/update-contact/update-contact.mjs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "drift-update-contact",
66
name: "Update Contact",
77
description: "Updates a contact in Drift using ID or email. Only changed attributes will be updated. [See Drift API docs](https://devdocs.drift.com/docs/updating-a-contact)",
8-
version: "0.0.9",
8+
version: "0.0.1",
99
type: "action",
1010
props: {
1111
drift,
@@ -47,9 +47,8 @@ export default {
4747
},
4848

4949
async run({ $ }) {
50-
const warnings = [];
5150
const {
52-
drift, name, email, phone, source,
51+
drift, name, email, phone, source, emailOrId,
5352
} = this;
5453

5554
const customAttributes = drift.parseIfJSONString(this.customAttributes);
@@ -66,11 +65,6 @@ export default {
6665
throw new Error("No attributes provided to update.");
6766
};
6867

69-
const emailOrId = drift.trimIfString(this.emailOrId);
70-
71-
warnings.push(...drift.checkEmailOrId(emailOrId));
72-
warnings.push(...drift.checkIfEmailValid(email));
73-
7468
let contact = await drift.getContactByEmailOrId($, emailOrId);
7569

7670
const contactId = contact.data[0]?.id || contact.data.id;
@@ -83,7 +77,8 @@ export default {
8377
},
8478
});
8579

86-
$.export("$summary", `Contact ID ${contactId} updated successfully.` + warnings.join("\n- "));
80+
$.export("$summary", `Contact ID "${contactId}" has been updated successfully.`);
81+
8782
return response;
8883
},
8984
};

0 commit comments

Comments
 (0)