Skip to content

Commit 466aa07

Browse files
committed
Test actions
1 parent c14d5e4 commit 466aa07

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import drift from "../../drift.app.mjs";
22
import { removeNullEntries } from "../../common/utils.mjs";
33

44
export default {
5-
key: "drift-create-contact-test",
5+
key: "drift-create-contact",
66
name: "Create Contact",
77
description: "Creates a contact in Drift. [See the docs](https://devdocs.drift.com/docs/creating-a-contact).",
8-
version: "0.0.11",
8+
version: "0.0.1",
99
type: "action",
1010
props: {
1111
drift,
@@ -80,7 +80,7 @@ export default {
8080

8181
console.log(response.data.id);
8282

83-
$.export("$summary", `Contact ${email} created.` + "\n- " + warnings.join("\n- "));
83+
$.export("$summary", `Contact ${email} created.` + warnings.join("\n- "));
8484
return response;
8585
},
8686
};

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import drift from "../../drift.app.mjs";
22

33
export default {
4-
key: "drift-delete-contact-test",
4+
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.12",
7+
version: "0.0.17",
88
type: "action",
99
props: {
1010
drift,
@@ -29,14 +29,15 @@ export default {
2929
contact = contact.data[0] || contact.data;
3030

3131
const contactId = contact.id;
32-
const contactEmail = contact.email;
32+
const contactEmail = contact.attributes.email;
3333

3434
const response = await drift.deleteContactById({
3535
$,
3636
contactId,
3737
});
3838

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

4142
return response;
4243
},

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import drift from "../../drift.app.mjs";
22

33
export default {
4-
key: "drift-delete-contact-test",
4+
key: "drift-delete-contact",
55
name: "Get Contact",
66
description: "Retrieves a contact in Drift by ID or email. [See the docs](https://devdocs.drift.com/docs/retrieving-contact)",
7-
version: "0.0.14",
7+
version: "0.0.1",
88
type: "action",
99
props: {
1010
drift,
@@ -32,7 +32,7 @@ export default {
3232
console.log(contact);
3333

3434
$.export("$summary", `Contact ${contact.attributes.email} ID "${contact.id}"`
35-
+ " fetched successfully.");
35+
+ " fetched successfully." + warnings.join("\n- "));
3636

3737
return contact;
3838
},

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

Lines changed: 3 additions & 3 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.7",
8+
version: "0.0.9",
99
type: "action",
1010
props: {
1111
drift,
@@ -69,7 +69,7 @@ export default {
6969
const emailOrId = drift.trimIfString(this.emailOrId);
7070

7171
warnings.push(...drift.checkEmailOrId(emailOrId));
72-
warnings.push(...drift.checkIfEmailValid(emailOrId));
72+
warnings.push(...drift.checkIfEmailValid(email));
7373

7474
let contact = await drift.getContactByEmailOrId($, emailOrId);
7575

@@ -83,7 +83,7 @@ export default {
8383
},
8484
});
8585

86-
$.export("$summary", `Contact ID ${contactId} updated successfully.`);
86+
$.export("$summary", `Contact ID ${contactId} updated successfully.` + warnings.join("\n- "));
8787
return response;
8888
},
8989
};

0 commit comments

Comments
 (0)