@customerio/cdp-analytics-browser 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/generated/version.js +1 -1
- package/dist/cjs/plugins/in-app-plugin/inbox_messages.js +13 -2
- package/dist/cjs/plugins/in-app-plugin/inbox_messages.js.map +1 -1
- package/dist/pkg/generated/version.js +1 -1
- package/dist/pkg/plugins/in-app-plugin/inbox_messages.js +13 -2
- package/dist/pkg/plugins/in-app-plugin/inbox_messages.js.map +1 -1
- package/dist/types/core/buffer/index.d.ts +1 -1
- package/dist/types/generated/version.d.ts +1 -1
- package/dist/types/plugins/in-app-plugin/inbox_messages.d.ts.map +1 -1
- package/dist/umd/573.js +1 -1
- package/dist/umd/573.js.gz +0 -0
- package/dist/umd/inAppPlugin.js +1 -1
- package/dist/umd/inAppPlugin.js.gz +0 -0
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.gz +0 -0
- package/dist/umd/standalone.js +1 -1
- package/dist/umd/standalone.js.gz +0 -0
- package/package.json +3 -3
- package/src/generated/version.ts +1 -1
- package/src/plugins/in-app-plugin/inbox_messages.ts +14 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Analytics } from '../../core/analytics'
|
|
2
2
|
import { JourneysEvents } from './events'
|
|
3
3
|
|
|
4
|
+
const CIO_TOPIC_PREFIX = '_cio'
|
|
5
|
+
|
|
4
6
|
export interface GistInboxMessage {
|
|
5
7
|
messageType: string
|
|
6
8
|
expiry: string
|
|
@@ -143,14 +145,25 @@ async function getFilteredMessages(
|
|
|
143
145
|
})
|
|
144
146
|
|
|
145
147
|
if (topics.length === 0) {
|
|
146
|
-
return allMessages
|
|
148
|
+
return allMessages.filter((message) => {
|
|
149
|
+
const messageTopics = message.topics
|
|
150
|
+
if (!messageTopics || messageTopics.length === 0) {
|
|
151
|
+
return true
|
|
152
|
+
}
|
|
153
|
+
return !messageTopics.some((topic) => topic.startsWith(CIO_TOPIC_PREFIX))
|
|
154
|
+
})
|
|
147
155
|
}
|
|
148
156
|
|
|
157
|
+
const hasCioTopic = topics.some((topic) => topic.startsWith(CIO_TOPIC_PREFIX))
|
|
158
|
+
|
|
149
159
|
return allMessages.filter((message) => {
|
|
150
160
|
const messageTopics = message.topics
|
|
151
161
|
if (!messageTopics || messageTopics.length === 0) {
|
|
152
162
|
return false
|
|
153
163
|
}
|
|
164
|
+
if (!hasCioTopic && messageTopics.some((topic) => topic.startsWith(CIO_TOPIC_PREFIX))) {
|
|
165
|
+
return false
|
|
166
|
+
}
|
|
154
167
|
return messageTopics.some((messageTopic) => topics.includes(messageTopic))
|
|
155
168
|
})
|
|
156
169
|
}
|