diff --git a/components/frontapp/package.json b/components/frontapp/package.json index 1ecb73184dc7f..5e5f6f175c4a4 100644 --- a/components/frontapp/package.json +++ b/components/frontapp/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/frontapp", - "version": "0.8.1", + "version": "0.8.2", "description": "Pipedream Frontapp Components", "main": "frontapp.app.mjs", "keywords": [ diff --git a/components/frontapp/sources/common/base.mjs b/components/frontapp/sources/common/base.mjs index 604e8fb8e7702..9aef80cdd1334 100644 --- a/components/frontapp/sources/common/base.mjs +++ b/components/frontapp/sources/common/base.mjs @@ -45,13 +45,17 @@ export default { if (filterFn) { responseArray.sort((a, b) => b.created_at - a.created_at); } - this._setLastTs(this._getEmit(responseArray[0]).ts); + this._setLastTs(this._getEmit(responseArray[0])?.ts ?? 0); } for (const item of responseArray.reverse()) { + const emit = this._getEmit(item); + if (!emit) { + continue; + } this.$emit( item, - this._getEmit(item), + emit, ); } }, diff --git a/components/frontapp/sources/new-conversation-created/new-conversation-created.mjs b/components/frontapp/sources/new-conversation-created/new-conversation-created.mjs index 2e9645c090f9c..bd76e82d09c31 100644 --- a/components/frontapp/sources/new-conversation-created/new-conversation-created.mjs +++ b/components/frontapp/sources/new-conversation-created/new-conversation-created.mjs @@ -6,7 +6,7 @@ export default { key: "frontapp-new-conversation-created", name: "New Conversation Created", description: "Emit new event when a conversation is created. [See the documentation](https://dev.frontapp.com/reference/list-conversations)", - version: "0.0.3", + version: "0.0.4", type: "source", dedupe: "unique", methods: { diff --git a/components/frontapp/sources/new-conversation-state-change/new-conversation-state-change.mjs b/components/frontapp/sources/new-conversation-state-change/new-conversation-state-change.mjs index 4186c569e14a4..80984a65f5ae7 100644 --- a/components/frontapp/sources/new-conversation-state-change/new-conversation-state-change.mjs +++ b/components/frontapp/sources/new-conversation-state-change/new-conversation-state-change.mjs @@ -7,7 +7,7 @@ export default { key: "frontapp-new-conversation-state-change", name: "New Conversation State Change", description: "Emit new event when a conversation reaches a specific state. [See the documentation](https://dev.frontapp.com/reference/list-events)", - version: "0.0.5", + version: "0.0.6", type: "source", dedupe: "unique", props: { diff --git a/components/frontapp/sources/new-conversation-tag/new-conversation-tag.mjs b/components/frontapp/sources/new-conversation-tag/new-conversation-tag.mjs index 7e1108eefe5df..e342da1d7d7d4 100644 --- a/components/frontapp/sources/new-conversation-tag/new-conversation-tag.mjs +++ b/components/frontapp/sources/new-conversation-tag/new-conversation-tag.mjs @@ -6,7 +6,7 @@ export default { key: "frontapp-new-conversation-tag", name: "New Conversation Tag", description: "Emit new event when a conversation is tagged with a specific tag or any tag. [See the documentation](https://dev.frontapp.com/reference/events)", - version: "0.0.5", + version: "0.0.6", type: "source", dedupe: "unique", props: { @@ -24,9 +24,8 @@ export default { _getFunction() { return this.frontapp.listEvents; }, - _getParams(lastTs) { + _getParams() { return { - "q[after]": lastTs, "q[types]": [ "tag", ], @@ -39,11 +38,19 @@ export default { if (item.type === "tag" && tagIdsArray.includes(item.target?.data?.id)) { return { id: item.id, - summary: `New conversation with id: "${item.id}" was tagged as '${item.target?.data?.name}'!`, - ts: Date.parse(item.created_at), + summary: `Conversation with ID: "${item.id}" was tagged as '${item.target?.data?.name}'!`, + ts: (Math.floor(item.emitted_at / 1000)) * 1000, }; } }, }, + hooks: { + async deploy() { + await this.startEvent(10, (item, lastTs) => item.emitted_at > lastTs); + }, + }, + async run() { + await this.startEvent(0, (item, lastTs) => item.emitted_at > lastTs); + }, sampleEmit, }; diff --git a/components/frontapp/sources/new-message-template-created/new-message-template-created.mjs b/components/frontapp/sources/new-message-template-created/new-message-template-created.mjs index d2913061ee6a7..c58441bd5008d 100644 --- a/components/frontapp/sources/new-message-template-created/new-message-template-created.mjs +++ b/components/frontapp/sources/new-message-template-created/new-message-template-created.mjs @@ -6,7 +6,7 @@ export default { key: "frontapp-new-message-template-created", name: "New Message Template Created", description: "Emit new event when a message template is created. [See the documentation](https://dev.frontapp.com/reference/list-message-templates)", - version: "0.0.3", + version: "0.0.4", type: "source", dedupe: "unique", methods: {