Skip to content

Commit b931660

Browse files
committed
add newConversationsOnly prop
1 parent 307085b commit b931660

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

components/intercom/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/intercom",
3-
"version": "0.6.0",
3+
"version": "0.6.1",
44
"description": "Pipedream Intercom Components",
55
"main": "intercom.app.mjs",
66
"keywords": [

components/intercom/sources/new-conversation-rating-added/new-conversation-rating-added.mjs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,18 @@ export default {
55
key: "intercom-new-conversation-rating-added",
66
name: "New Conversation Rating Added",
77
description: "Emit new event each time a new rating is added to a conversation.",
8-
version: "0.0.3",
8+
version: "0.0.4",
99
type: "source",
1010
dedupe: "unique",
11+
props: {
12+
...common.props,
13+
newConversationsOnly: {
14+
type: "boolean",
15+
label: "New Conversations Only",
16+
description: "Set to `true` to only emit events for new conversations",
17+
optional: true,
18+
},
19+
},
1120
methods: {
1221
...common.methods,
1322
generateMeta(conversation) {
@@ -34,8 +43,10 @@ export default {
3443
const createdAt = conversation.conversation_rating.created_at;
3544
if (createdAt > lastRatingCreatedAt)
3645
lastRatingCreatedAt = createdAt;
37-
const meta = this.generateMeta(conversation);
38-
this.$emit(conversation, meta);
46+
if (!this.newConversationsOnly || conversation.created_at > lastRatingCreatedAt) {
47+
const meta = this.generateMeta(conversation);
48+
this.$emit(conversation, meta);
49+
}
3950
}
4051

4152
this._setLastUpdate(lastRatingCreatedAt);

0 commit comments

Comments
 (0)