Skip to content

Commit 6f9160a

Browse files
committed
Fix CodeRabbit
1 parent f888650 commit 6f9160a

File tree

6 files changed

+13
-11
lines changed

6 files changed

+13
-11
lines changed

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

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

33
export default {
4-
key: "drift-delete-contact",
4+
key: "drift-get-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)",
77
version: "0.0.1",
@@ -29,7 +29,9 @@ export default {
2929

3030
const contact = response.data[0] || response.data;
3131

32-
console.log(contact);
32+
if (!contact) {
33+
throw new Error("Failed to get contact");
34+
};
3335

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

components/drift/drift.app.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default {
3030
method,
3131
url: `${this._baseUrl()}${path}`,
3232
headers: {
33-
"Authorization": `Bearer ${this.$auth?.oauth_access_token || "iHlC8LmFQiTH0DcWds7ETMRMmo3BvUyP"}`,
33+
"Authorization": `Bearer ${this.$auth?.oauth_access_token}`,
3434
"Content-Type": contentType || "application/json",
3535
},
3636
...opts,
@@ -42,7 +42,7 @@ export default {
4242
method: "GET",
4343
url,
4444
headers: {
45-
"Authorization": `Bearer ${this.$auth?.oauth_access_token || "iHlC8LmFQiTH0DcWds7ETMRMmo3BvUyP"}`,
45+
"Authorization": `Bearer ${this.$auth?.oauth_access_token}`,
4646
},
4747
});
4848
},

components/drift/sources/new-contact-update/new-contact-update.mjs

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

33
export default {
4-
key: "drift-new-contact-update-test",
4+
key: "drift-new-contact-update",
55
name: "New Contact Update",
66
description: "Emit new event when a contact is updated in Drift. [See the docs](https://devdocs.drift.com/docs/webhook-events-1).",
77
version: "0.0.1",
@@ -25,7 +25,7 @@ export default {
2525
contactId,
2626
});
2727

28-
const email = result.data.attributes.email;
28+
const email = result.data?.attributes?.email || "unknown";
2929

3030
body.data.attributes = result.data.attributes;
3131

components/drift/sources/new-conversation-instant/new-conversation-instant.mjs

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

33
export default {
4-
key: "drift-new-conversation-instant-test [See the docs](https://devdocs.drift.com/docs/retrieve-a-conversation)",
4+
key: "drift-new-conversation-instant",
55
name: "New Conversation",
6-
description: "Emit new when a new conversation is started in Drift.",
6+
description: "Emit new when a new conversation is started in Drift. [See the docs](https://devdocs.drift.com/docs/retrieve-a-conversation)",
77
version: "0.0.1",
88
type: "source",
99
dedupe: "unique",

components/drift/sources/new-lead-instance.mjs/new-lead-instance.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import drift from "../../drift.app.mjs";
22

33
export default {
4-
key: "drift-new-lead-instance-test",
4+
key: "drift-new-lead-instance",
55
name: "New Lead",
66
description: "Emit new event when a contact adds their email in chat. [See the docs](https://devdocs.drift.com/docs/webhook-events-1).",
77
version: "0.0.1",

components/drift/sources/new-message-instant/new-message-instant.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export default {
5050
contactId,
5151
});
5252

53-
const email = result.data.attributes.email || "unknown";
53+
const email = result.data?.attributes?.email || "unknown";
5454

5555
if (this.emailOrId &&
5656
!(email === this.emailOrId || Number(contactId) === Number(this.emailOrId))) {
@@ -61,7 +61,7 @@ export default {
6161
body.data.attributes = result.data.attributes;
6262

6363
this.$emit(body, {
64-
summary: `Contact "${email} " ID "${contactId || "unknown"}" updated`,
64+
summary: `New message from contact "${email} " ID "${contactId || "unknown"}" updated`,
6565
id: body.data.endUserId,
6666
ts: body.timeStamp,
6767
});

0 commit comments

Comments
 (0)