cordova-plugin-reteno 2.0.4 → 2.2.0
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/docs/android.md +22 -7
- package/docs/api.md +199 -195
- package/docs/ios.md +10 -10
- package/package.json +1 -1
- package/plugin.xml +12 -2
- package/src/android/app/build.gradle +1 -1
- package/src/android/app/src/main/AndroidManifest.xml +6 -1
- package/src/android/app/src/main/java/com/reteno/plugin/RetenoNotificationGroupingRuleProvider.java +117 -0
- package/src/android/app/src/main/java/com/reteno/plugin/RetenoNotificationSummaryManager.java +262 -0
- package/src/android/app/src/main/java/com/reteno/plugin/RetenoPlugin.java +76 -2
- package/src/android/reteno.gradle +1 -1
- package/src/ios/RetenoPlugin.swift +14 -4
- package/types/index.ts +23 -3
- package/www/cordova-plugin-reteno.js +432 -385
package/docs/api.md
CHANGED
|
@@ -10,77 +10,80 @@ Notes:
|
|
|
10
10
|
|
|
11
11
|
### Initialization
|
|
12
12
|
|
|
13
|
-
| Method
|
|
14
|
-
|
|
|
15
|
-
| [init](../www/cordova-plugin-reteno.js)
|
|
16
|
-
| [requestNotificationPermission](../www/cordova-plugin-reteno.js) | iOS, Android
|
|
17
|
-
| [setLifecycleTrackingOptions](../www/cordova-plugin-reteno.js)
|
|
13
|
+
| Method | Supported platform | Description |
|
|
14
|
+
| ---------------------------------------------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| [init](../www/cordova-plugin-reteno.js) | iOS, Android | Initializes Reteno SDK. Accepts optional `RetenoInitializeOptions` with `accessKey`, `pauseInAppMessages`, `pausePushInAppMessages`, `inAppMessagesPauseBehaviour` (iOS), `lifecycleTrackingOptions`, `sessionDurationSeconds` (Android 2.9.6+, iOS 2.7.2+), `isAutomaticScreenReportingEnabled` (iOS; see note below) and `isDebugMode`. [Types](../types/index.ts) |
|
|
16
|
+
| [requestNotificationPermission](../www/cordova-plugin-reteno.js) | iOS, Android | Requests push permission (iOS) or `POST_NOTIFICATIONS` (Android 13+). Returns `0` or `1` on Android (`RequestNotificationPermissionResult`) in [types](../types/index.ts). |
|
|
17
|
+
| [setLifecycleTrackingOptions](../www/cordova-plugin-reteno.js) | iOS, Android | Configures automatic tracking for app lifecycle, push subscription, and session events. Android: applies immediately. iOS: supported only before initialization (stored and applied during `init(...)`). [Types](../types/index.ts) |
|
|
18
18
|
|
|
19
19
|
### User data
|
|
20
20
|
|
|
21
|
-
| Method
|
|
22
|
-
|
|
|
23
|
-
| [setUserAttributes](../www/cordova-plugin-reteno.js)
|
|
24
|
-
| [setAnonymousUserAttributes](../www/cordova-plugin-reteno.js)
|
|
25
|
-
| [setMultiAccountUserAttributes](../www/cordova-plugin-reteno.js) | iOS, Android
|
|
21
|
+
| Method | Supported platform | Description |
|
|
22
|
+
| ---------------------------------------------------------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| [setUserAttributes](../www/cordova-plugin-reteno.js) | iOS, Android | Supports `marketId` with the bundled Android 2.9.6+ and iOS 2.7.2+ SDKs. Pass `""` to clear. [Types](../types/index.ts) |
|
|
24
|
+
| [setAnonymousUserAttributes](../www/cordova-plugin-reteno.js) | iOS, Android | Supports `marketId` with the bundled Android 2.9.6+ and iOS 2.7.2+ SDKs. Pass `""` to clear. [Types](../types/index.ts) |
|
|
25
|
+
| [setMultiAccountUserAttributes](../www/cordova-plugin-reteno.js) | iOS, Android | Supports `marketId` with the bundled Android 2.9.6+ and iOS 2.7.2+ SDKs. Pass `""` to clear. [Types](../types/index.ts) |
|
|
26
26
|
|
|
27
27
|
### Event tracking
|
|
28
28
|
|
|
29
|
-
| Method
|
|
30
|
-
|
|
|
31
|
-
| [logEvent](../www/cordova-plugin-reteno.js)
|
|
32
|
-
| [logEcommerceEvent](../www/cordova-plugin-reteno.js) | iOS, Android
|
|
33
|
-
| [logScreenView](../www/cordova-plugin-reteno.js)
|
|
34
|
-
| [forcePushData](../www/cordova-plugin-reteno.js)
|
|
29
|
+
| Method | Supported platform | Description |
|
|
30
|
+
| ---------------------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
31
|
+
| [logEvent](../www/cordova-plugin-reteno.js) | iOS, Android | [Types](../types/index.ts) |
|
|
32
|
+
| [logEcommerceEvent](../www/cordova-plugin-reteno.js) | iOS, Android | Tracks ecommerce activity (product views, cart updates, orders, search requests, etc.). [Types](../types/index.ts) |
|
|
33
|
+
| [logScreenView](../www/cordova-plugin-reteno.js) | iOS, Android | Logs a screen view for manual tracking. |
|
|
34
|
+
| [forcePushData](../www/cordova-plugin-reteno.js) | iOS, Android | Forces Reteno to sync queued data. On iOS the plugin performs a technical `logEvent(..., forcePush: true)` call under the hood. |
|
|
35
35
|
|
|
36
36
|
### Push notifications
|
|
37
37
|
|
|
38
|
-
| Method
|
|
39
|
-
|
|
|
40
|
-
| [setDeviceToken](../www/cordova-plugin-reteno.js)
|
|
41
|
-
| [getInitialNotification](../www/cordova-plugin-reteno.js)
|
|
42
|
-
| [setOnRetenoPushReceivedListener](../www/cordova-plugin-reteno.js)
|
|
43
|
-
| [removeOnRetenoPushReceivedListener](../www/cordova-plugin-reteno.js)
|
|
44
|
-
| [setOnRetenoNotificationClickedListener](../www/cordova-plugin-reteno.js)
|
|
45
|
-
| [removeOnRetenoNotificationClickedListener](../www/cordova-plugin-reteno.js) | iOS, Android
|
|
46
|
-
| [setOnRetenoPushDismissedListener](../www/cordova-plugin-reteno.js)
|
|
47
|
-
| [removeOnRetenoPushDismissedListener](../www/cordova-plugin-reteno.js)
|
|
48
|
-
| [setOnRetenoCustomPushReceivedListener](../www/cordova-plugin-reteno.js)
|
|
49
|
-
| [removeOnRetenoCustomPushReceivedListener](../www/cordova-plugin-reteno.js)
|
|
50
|
-
| [setOnRetenoPushButtonClickedListener](../www/cordova-plugin-reteno.js)
|
|
51
|
-
| [removeOnRetenoPushButtonClickedListener](../www/cordova-plugin-reteno.js)
|
|
52
|
-
| [setNotificationActionHandler](../www/cordova-plugin-reteno.js)
|
|
53
|
-
| [setWillPresentNotificationOptions](../www/cordova-plugin-reteno.js)
|
|
54
|
-
| [setDidReceiveNotificationResponseHandler](../www/cordova-plugin-reteno.js)
|
|
55
|
-
| [updateDefaultNotificationChannel](../www/cordova-plugin-reteno.js)
|
|
38
|
+
| Method | Supported platform | Description |
|
|
39
|
+
| ---------------------------------------------------------------------------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
40
|
+
| [setDeviceToken](../www/cordova-plugin-reteno.js) | iOS, Android | Forwards the device token to Reteno (use when another plugin owns push callbacks/token, e.g. Firebasex messaging enabled). |
|
|
41
|
+
| [getInitialNotification](../www/cordova-plugin-reteno.js) | iOS, Android | Returns push notification that triggered creating app instance. |
|
|
42
|
+
| [setOnRetenoPushReceivedListener](../www/cordova-plugin-reteno.js) | iOS, Android | Sets listener for newly received push notification. |
|
|
43
|
+
| [removeOnRetenoPushReceivedListener](../www/cordova-plugin-reteno.js) | iOS, Android | Removes listener for push notification received events. |
|
|
44
|
+
| [setOnRetenoNotificationClickedListener](../www/cordova-plugin-reteno.js) | iOS, Android | Sets listener for notification click events. |
|
|
45
|
+
| [removeOnRetenoNotificationClickedListener](../www/cordova-plugin-reteno.js) | iOS, Android | Removes listener for notification click events. |
|
|
46
|
+
| [setOnRetenoPushDismissedListener](../www/cordova-plugin-reteno.js) | Android | Sets listener for push dismissed (swipe) events. |
|
|
47
|
+
| [removeOnRetenoPushDismissedListener](../www/cordova-plugin-reteno.js) | Android | Removes listener for push dismissed (swipe) events. |
|
|
48
|
+
| [setOnRetenoCustomPushReceivedListener](../www/cordova-plugin-reteno.js) | Android | Sets listener for custom push received events. |
|
|
49
|
+
| [removeOnRetenoCustomPushReceivedListener](../www/cordova-plugin-reteno.js) | Android | Removes listener for custom push received events. |
|
|
50
|
+
| [setOnRetenoPushButtonClickedListener](../www/cordova-plugin-reteno.js) | iOS, Android | Sets listener for push notification action button click events. Emits `reteno-push-button-clicked`. [Types](../types/index.ts) |
|
|
51
|
+
| [removeOnRetenoPushButtonClickedListener](../www/cordova-plugin-reteno.js) | iOS, Android | Removes listener for push notification action button click events. |
|
|
52
|
+
| [setNotificationActionHandler](../www/cordova-plugin-reteno.js) | iOS, Android | On iOS, installs the native action button handler when both `enabled` (default: `true`) and `emitEvent` are true — e.g. `{ emitEvent: true }` or `{ enabled: true, emitEvent: true }`. Any other value (e.g. `false`, `null`, `true`, `{ enabled: true }`) clears the handler. On Android, this is a no-op (button clicks are detected automatically). [Types](../types/index.ts) |
|
|
53
|
+
| [setWillPresentNotificationOptions](../www/cordova-plugin-reteno.js) | iOS | Sets presentation options for foreground notifications. Optionally emits `reteno-push-received`. [Types](../types/index.ts) |
|
|
54
|
+
| [setDidReceiveNotificationResponseHandler](../www/cordova-plugin-reteno.js) | iOS | Enables a response handler for notification taps. Optionally emits `reteno-notification-clicked`. [Types](../types/index.ts) |
|
|
55
|
+
| [updateDefaultNotificationChannel](../www/cordova-plugin-reteno.js) | Android | Updates the default notification channel name and description for existing users. [Types](../types/index.ts) |
|
|
56
|
+
| [setNotificationGroupingRule](../www/cordova-plugin-reteno.js) | Android | Groups notifications by a push payload field or a constant group ID. The rule is persisted natively and restored before background push handling. Pass `null` to disable. [Types](../types/index.ts) |
|
|
56
57
|
|
|
57
58
|
### In-app messages
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
| [
|
|
64
|
-
| [
|
|
65
|
-
| [
|
|
60
|
+
Bundled native SDKs support the `DOES_NOT_EQUAL` in-app rule condition: Android SDK 2.9.6+ and iOS SDK 2.7.2+.
|
|
61
|
+
|
|
62
|
+
| Method | Supported platform | Description |
|
|
63
|
+
| --------------------------------------------------------------------------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
64
|
+
| [pauseInAppMessages](../www/cordova-plugin-reteno.js) | iOS, Android | Pauses or resumes in-app messages at runtime. Pass `true` to pause, `false` to resume. |
|
|
65
|
+
| [setInAppMessagesPauseBehaviour](../www/cordova-plugin-reteno.js) | iOS, Android | Sets how paused in-app messages are handled: `SKIP_IN_APPS` or `POSTPONE_IN_APPS`. [Types](../types/index.ts) |
|
|
66
|
+
| [setOnInAppLifecycleCallback](../www/cordova-plugin-reteno.js) | iOS, Android | Subscribes to in-app status/lifecycle events (beforeDisplay, onDisplay, beforeClose, afterClose, onError). Pass `null` to unsubscribe. [Types](../types/index.ts) |
|
|
67
|
+
| [setOnInAppMessageCustomDataReceivedListener](../www/cordova-plugin-reteno.js) | Android | Sets listener for in-app message custom data events. |
|
|
68
|
+
| [removeOnInAppMessageCustomDataReceivedListener](../www/cordova-plugin-reteno.js) | Android | Removes listener for in-app message custom data events. |
|
|
66
69
|
|
|
67
70
|
### App Inbox
|
|
68
71
|
|
|
69
|
-
| Method
|
|
70
|
-
|
|
|
71
|
-
| [getAppInboxMessages](../www/cordova-plugin-reteno.js)
|
|
72
|
-
| [getAppInboxMessagesCount](../www/cordova-plugin-reteno.js)
|
|
73
|
-
| [subscribeOnMessagesCountChanged](../www/cordova-plugin-reteno.js) | iOS, Android
|
|
74
|
-
| [unsubscribeMessagesCountChanged](../www/cordova-plugin-reteno.js) | iOS, Android
|
|
75
|
-
| [markAsOpened](../www/cordova-plugin-reteno.js)
|
|
76
|
-
| [markAllMessagesAsOpened](../www/cordova-plugin-reteno.js)
|
|
72
|
+
| Method | Supported platform | Description |
|
|
73
|
+
| ------------------------------------------------------------------ | ------------------ | ---------------------------------------------------------------------------------------------------------- |
|
|
74
|
+
| [getAppInboxMessages](../www/cordova-plugin-reteno.js) | iOS, Android | Fetches App Inbox messages with pagination. Returns `{ messages, totalPages }`. [Types](../types/index.ts) |
|
|
75
|
+
| [getAppInboxMessagesCount](../www/cordova-plugin-reteno.js) | iOS, Android | Fetches count of App Inbox messages. Returns a number. |
|
|
76
|
+
| [subscribeOnMessagesCountChanged](../www/cordova-plugin-reteno.js) | iOS, Android | Subscribes to App Inbox messages count changes. |
|
|
77
|
+
| [unsubscribeMessagesCountChanged](../www/cordova-plugin-reteno.js) | iOS, Android | Unsubscribes from App Inbox messages count changes. |
|
|
78
|
+
| [markAsOpened](../www/cordova-plugin-reteno.js) | iOS, Android | Marks an App Inbox message as opened. |
|
|
79
|
+
| [markAllMessagesAsOpened](../www/cordova-plugin-reteno.js) | iOS, Android | Marks all App Inbox messages as opened. |
|
|
77
80
|
|
|
78
81
|
### Recommendations
|
|
79
82
|
|
|
80
|
-
| Method
|
|
81
|
-
|
|
|
82
|
-
| [getRecommendations](../www/cordova-plugin-reteno.js) | iOS, Android
|
|
83
|
-
| [logRecommendations](../www/cordova-plugin-reteno.js) | iOS, Android
|
|
83
|
+
| Method | Supported platform | Description |
|
|
84
|
+
| ----------------------------------------------------- | ------------------ | ---------------------------------------------------------------------------------------------------- |
|
|
85
|
+
| [getRecommendations](../www/cordova-plugin-reteno.js) | iOS, Android | Fetches product or category recommendations. Returns `{ recoms: [...] }`. [Types](../types/index.ts) |
|
|
86
|
+
| [logRecommendations](../www/cordova-plugin-reteno.js) | iOS, Android | Sends recommendation impressions or clicks. [Types](../types/index.ts) |
|
|
84
87
|
|
|
85
88
|
### init example
|
|
86
89
|
|
|
@@ -99,7 +102,7 @@ RetenoPlugin.init()
|
|
|
99
102
|
// pausePushInAppMessages: pauses in-app messages triggered by push notifications.
|
|
100
103
|
// inAppMessagesPauseBehaviour: (iOS) defines handling while paused: 'SKIP_IN_APPS' or 'POSTPONE_IN_APPS'.
|
|
101
104
|
// lifecycleTrackingOptions: configures app lifecycle, push subscription, and session event tracking ('ALL', 'NONE', or an object).
|
|
102
|
-
// sessionDurationSeconds (Android 2.9.
|
|
105
|
+
// sessionDurationSeconds (Android 2.9.6+, iOS 2.7.2+): optional session reset duration.
|
|
103
106
|
// isAutomaticScreenReportingEnabled: enables automatic native screen view tracking on iOS.
|
|
104
107
|
// Keep this false in Cordova/Ionic WebView apps (including Android demos).
|
|
105
108
|
// Defaults to false. Note: in Cordova/Ionic apps the UI runs inside a single WebView,
|
|
@@ -116,13 +119,13 @@ RetenoPlugin.init({
|
|
|
116
119
|
inAppMessagesPauseBehaviour: 'SKIP_IN_APPS', // iOS
|
|
117
120
|
isAutomaticScreenReportingEnabled: false, // keep false for hybrid/WebView apps
|
|
118
121
|
isDebugMode: true, // enables debug mode
|
|
119
|
-
sessionDurationSeconds: 30 * 60, // Android 2.9.
|
|
122
|
+
sessionDurationSeconds: 30 * 60, // Android 2.9.6+, iOS 2.7.2+: 30 minutes
|
|
120
123
|
lifecycleTrackingOptions: {
|
|
121
124
|
appLifecycleEnabled: true,
|
|
122
125
|
foregroundLifecycleEnabled: false,
|
|
123
126
|
pushSubscriptionEnabled: true,
|
|
124
127
|
sessionStartEventsEnabled: true,
|
|
125
|
-
sessionEndEventsEnabled: false,
|
|
128
|
+
sessionEndEventsEnabled: false,
|
|
126
129
|
},
|
|
127
130
|
})
|
|
128
131
|
.then(() => console.log('init: OK'))
|
|
@@ -142,31 +145,30 @@ RetenoPlugin.init({ lifecycleTrackingOptions: { sessionEventsEnabled: false } })
|
|
|
142
145
|
```js
|
|
143
146
|
// `externalUserId` is required and must be a non-empty string.
|
|
144
147
|
// `user` is optional (you can omit it or pass null).
|
|
145
|
-
RetenoPlugin.setUserAttributes(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
postcode: '01001',
|
|
161
|
-
},
|
|
162
|
-
fields: [{ key: 'plan', value: 'premium' }],
|
|
148
|
+
RetenoPlugin.setUserAttributes({
|
|
149
|
+
externalUserId: 'user-123',
|
|
150
|
+
user: {
|
|
151
|
+
userAttributes: {
|
|
152
|
+
email: 'john.doe@example.com',
|
|
153
|
+
phone: '+1234567890',
|
|
154
|
+
firstName: 'John',
|
|
155
|
+
lastName: 'Doe',
|
|
156
|
+
languageCode: 'en',
|
|
157
|
+
timeZone: 'Europe/Kyiv',
|
|
158
|
+
address: {
|
|
159
|
+
region: 'Kyivska',
|
|
160
|
+
town: 'Kyiv',
|
|
161
|
+
address: 'Khreshchatyk St, 1',
|
|
162
|
+
postcode: '01001',
|
|
163
163
|
},
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
groupNamesExclude: ['unsubscribed'],
|
|
164
|
+
fields: [{ key: 'plan', value: 'premium' }],
|
|
165
|
+
marketId: 'market_1',
|
|
167
166
|
},
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
subscriptionKeys: ['news', 'promotions'],
|
|
168
|
+
groupNamesInclude: ['beta-testers'],
|
|
169
|
+
groupNamesExclude: ['unsubscribed'],
|
|
170
|
+
},
|
|
171
|
+
})
|
|
170
172
|
.then(() => console.log('setUserAttributes: OK'))
|
|
171
173
|
.catch((err) => console.error('setUserAttributes: ERROR', err));
|
|
172
174
|
```
|
|
@@ -176,21 +178,20 @@ RetenoPlugin.setUserAttributes(
|
|
|
176
178
|
```js
|
|
177
179
|
// Anonymous attributes are used before contact identification.
|
|
178
180
|
// Note: Unlike setUserAttributes, this payload does NOT include phone/email.
|
|
179
|
-
RetenoPlugin.setAnonymousUserAttributes(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
)
|
|
181
|
+
RetenoPlugin.setAnonymousUserAttributes({
|
|
182
|
+
firstName: 'John',
|
|
183
|
+
lastName: 'Doe',
|
|
184
|
+
languageCode: 'en',
|
|
185
|
+
timeZone: 'Europe/Kyiv',
|
|
186
|
+
address: {
|
|
187
|
+
region: 'Kyivska',
|
|
188
|
+
town: 'Kyiv',
|
|
189
|
+
address: 'Khreshchatyk St, 1',
|
|
190
|
+
postcode: '01001',
|
|
191
|
+
},
|
|
192
|
+
fields: [{ key: 'utm_source', value: 'google' }],
|
|
193
|
+
marketId: 'market_1',
|
|
194
|
+
})
|
|
194
195
|
.then(() => console.log('setAnonymousUserAttributes: OK'))
|
|
195
196
|
.catch((err) => console.error('setAnonymousUserAttributes: ERROR', err));
|
|
196
197
|
```
|
|
@@ -206,31 +207,30 @@ RetenoPlugin.setAnonymousUserAttributes(
|
|
|
206
207
|
// 1 token per device behavior.
|
|
207
208
|
// `externalUserId` is required and must be a non-empty string.
|
|
208
209
|
// `user` is required and must be an object.
|
|
209
|
-
RetenoPlugin.setMultiAccountUserAttributes(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
postcode: '01001',
|
|
225
|
-
},
|
|
226
|
-
fields: [{ key: 'plan', value: 'premium' }],
|
|
210
|
+
RetenoPlugin.setMultiAccountUserAttributes({
|
|
211
|
+
externalUserId: 'user-123',
|
|
212
|
+
user: {
|
|
213
|
+
userAttributes: {
|
|
214
|
+
email: 'john.doe@example.com',
|
|
215
|
+
phone: '+1234567890',
|
|
216
|
+
firstName: 'John',
|
|
217
|
+
lastName: 'Doe',
|
|
218
|
+
languageCode: 'en',
|
|
219
|
+
timeZone: 'Europe/Kyiv',
|
|
220
|
+
address: {
|
|
221
|
+
region: 'Kyivska',
|
|
222
|
+
town: 'Kyiv',
|
|
223
|
+
address: 'Khreshchatyk St, 1',
|
|
224
|
+
postcode: '01001',
|
|
227
225
|
},
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
groupNamesExclude: ['unsubscribed'],
|
|
226
|
+
fields: [{ key: 'plan', value: 'premium' }],
|
|
227
|
+
marketId: 'market_1',
|
|
231
228
|
},
|
|
232
|
-
|
|
233
|
-
|
|
229
|
+
subscriptionKeys: ['news', 'promotions'],
|
|
230
|
+
groupNamesInclude: ['beta-testers'],
|
|
231
|
+
groupNamesExclude: ['unsubscribed'],
|
|
232
|
+
},
|
|
233
|
+
})
|
|
234
234
|
.then(() => console.log('setMultiAccountUserAttributes: OK'))
|
|
235
235
|
.catch((err) => console.error('setMultiAccountUserAttributes: ERROR', err));
|
|
236
236
|
```
|
|
@@ -243,12 +243,10 @@ RetenoPlugin.setMultiAccountUserAttributes(
|
|
|
243
243
|
// Android: applies immediately.
|
|
244
244
|
// iOS: this works only BEFORE SDK initialization (before calling init()).
|
|
245
245
|
// Deprecated: sessionEventsEnabled (if used) toggles both sessionStart and sessionEnd.
|
|
246
|
-
RetenoPlugin.setLifecycleTrackingOptions(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
251
|
-
)
|
|
246
|
+
RetenoPlugin.setLifecycleTrackingOptions({
|
|
247
|
+
sessionStartEventsEnabled: true,
|
|
248
|
+
sessionEndEventsEnabled: true,
|
|
249
|
+
})
|
|
252
250
|
.then(() => console.log('setLifecycleTrackingOptions: OK'))
|
|
253
251
|
.catch((err) => console.error('setLifecycleTrackingOptions: ERROR', err));
|
|
254
252
|
```
|
|
@@ -267,17 +265,15 @@ Invalid values (anything except `'ALL'`, `'NONE'`, or an object with known field
|
|
|
267
265
|
Payload type: `LogEventPayload` in [types](../types/index.ts).
|
|
268
266
|
|
|
269
267
|
```js
|
|
270
|
-
RetenoPlugin.logEvent(
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
)
|
|
268
|
+
RetenoPlugin.logEvent({
|
|
269
|
+
eventName: 'purchase',
|
|
270
|
+
// Optional ISO 8601 string. If omitted, current time is used.
|
|
271
|
+
date: new Date().toISOString(),
|
|
272
|
+
parameters: [
|
|
273
|
+
{ name: 'orderId', value: 'A-123' },
|
|
274
|
+
{ name: 'amount', value: '19.99' },
|
|
275
|
+
],
|
|
276
|
+
})
|
|
281
277
|
.then(() => console.log('logEvent: OK'))
|
|
282
278
|
.catch((err) => console.error('logEvent: ERROR', err));
|
|
283
279
|
```
|
|
@@ -365,9 +361,7 @@ RetenoPlugin.logEcommerceEvent({
|
|
|
365
361
|
### logScreenView example
|
|
366
362
|
|
|
367
363
|
```js
|
|
368
|
-
RetenoPlugin.logScreenView(
|
|
369
|
-
'HomeScreen'
|
|
370
|
-
)
|
|
364
|
+
RetenoPlugin.logScreenView('HomeScreen')
|
|
371
365
|
.then(() => console.log('logScreenView: OK'))
|
|
372
366
|
.catch((err) => console.error('logScreenView: ERROR', err));
|
|
373
367
|
```
|
|
@@ -375,8 +369,7 @@ RetenoPlugin.logScreenView(
|
|
|
375
369
|
### forcePushData example
|
|
376
370
|
|
|
377
371
|
```js
|
|
378
|
-
RetenoPlugin
|
|
379
|
-
.forcePushData()
|
|
372
|
+
RetenoPlugin.forcePushData()
|
|
380
373
|
.then(() => console.log('forcePushData: OK'))
|
|
381
374
|
.catch((err) => console.error('forcePushData: ERROR', err));
|
|
382
375
|
```
|
|
@@ -468,13 +461,13 @@ RetenoPlugin.setOnInAppMessageCustomDataReceivedListener(function (event) {
|
|
|
468
461
|
If you obtain a token outside this plugin (for example via another plugin/SDK), you can forward it to Reteno so it can register the device for push.
|
|
469
462
|
|
|
470
463
|
Notes:
|
|
464
|
+
|
|
471
465
|
- On Android, if Reteno receives FCM callbacks directly, you generally don't need to call `setDeviceToken`.
|
|
472
466
|
- On iOS with Firebase, prefer the default `IOS_DEVICE_TOKEN_HANDLING_MODE=manual` flow with automatic forwarding in `init()`, described in [iOS docs](./ios.md#using-fcm-firebase-cloud-messaging-on-ios).
|
|
473
467
|
|
|
474
468
|
```js
|
|
475
469
|
// 1) Initialize Reteno first.
|
|
476
|
-
RetenoPlugin
|
|
477
|
-
.init()
|
|
470
|
+
RetenoPlugin.init()
|
|
478
471
|
.then(() => {
|
|
479
472
|
// Forward token from your token source (replace this with your integration).
|
|
480
473
|
getFcmTokenFromSomewhere(
|
|
@@ -493,7 +486,7 @@ Subscribe to push received events while the app is running.
|
|
|
493
486
|
|
|
494
487
|
Notes:
|
|
495
488
|
|
|
496
|
-
- On Android this is based on the SDK 2.9.
|
|
489
|
+
- On Android this is based on the SDK 2.9.6 `EventListener` / `Procedure` API (`RetenoNotifications.getReceived()`).
|
|
497
490
|
- This listener is not a replacement for `getInitialNotification()` (cold start): if the app was launched by tapping a notification, use `getInitialNotification()`.
|
|
498
491
|
|
|
499
492
|
```js
|
|
@@ -567,16 +560,31 @@ Updates the default notification channel parameters for existing users on Androi
|
|
|
567
560
|
Payload type: `NotificationChannelConfig` in [types](../types/index.ts).
|
|
568
561
|
|
|
569
562
|
```js
|
|
570
|
-
RetenoPlugin.updateDefaultNotificationChannel(
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
}
|
|
575
|
-
)
|
|
563
|
+
RetenoPlugin.updateDefaultNotificationChannel({
|
|
564
|
+
name: 'New Channel Name',
|
|
565
|
+
description: 'New Channel Description',
|
|
566
|
+
})
|
|
576
567
|
.then(() => console.log('updateDefaultNotificationChannel: OK'))
|
|
577
568
|
.catch((err) => console.error('updateDefaultNotificationChannel: ERROR', err));
|
|
578
569
|
```
|
|
579
570
|
|
|
571
|
+
### setNotificationGroupingRule example
|
|
572
|
+
|
|
573
|
+
Configures Android notification grouping without a JavaScript callback, so the rule also works when the WebView is not running. Payload type: `NotificationGroupingRule` in [types](../types/index.ts).
|
|
574
|
+
|
|
575
|
+
```js
|
|
576
|
+
// Use the value of `chatId` from each push payload as its Android group key.
|
|
577
|
+
await RetenoPlugin.setNotificationGroupingRule({ payloadKey: 'chatId' });
|
|
578
|
+
|
|
579
|
+
// Or put every Reteno notification into one constant group.
|
|
580
|
+
await RetenoPlugin.setNotificationGroupingRule({ groupId: 'messages' });
|
|
581
|
+
|
|
582
|
+
// Disable grouping.
|
|
583
|
+
await RetenoPlugin.setNotificationGroupingRule(null);
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
The SDK assigns `NotificationCompat.Builder.setGroup(...)`; displaying a group-summary notification remains the application's responsibility.
|
|
587
|
+
|
|
580
588
|
### getAppInboxMessages example
|
|
581
589
|
|
|
582
590
|
Fetches paginated App Inbox messages. Payload type: `GetAppInboxMessagesPayload` in [types](../types/index.ts).
|
|
@@ -584,17 +592,21 @@ Fetches paginated App Inbox messages. Payload type: `GetAppInboxMessagesPayload`
|
|
|
584
592
|
Returns `AppInboxMessages`: `{ messages: AppInboxMessage[], totalPages: number }`.
|
|
585
593
|
|
|
586
594
|
```js
|
|
587
|
-
RetenoPlugin.getAppInboxMessages(
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
593
|
-
)
|
|
595
|
+
RetenoPlugin.getAppInboxMessages({
|
|
596
|
+
page: 1,
|
|
597
|
+
pageSize: 20,
|
|
598
|
+
status: 'UNOPENED', // optional: 'OPENED' | 'UNOPENED'
|
|
599
|
+
})
|
|
594
600
|
.then((result) => {
|
|
595
601
|
// result.messages — array of AppInboxMessage objects
|
|
596
602
|
// result.totalPages — total number of pages
|
|
597
|
-
console.log(
|
|
603
|
+
console.log(
|
|
604
|
+
'getAppInboxMessages: OK',
|
|
605
|
+
result.messages.length,
|
|
606
|
+
'of',
|
|
607
|
+
result.totalPages,
|
|
608
|
+
'pages'
|
|
609
|
+
);
|
|
598
610
|
})
|
|
599
611
|
.catch((err) => console.error('getAppInboxMessages: ERROR', err));
|
|
600
612
|
```
|
|
@@ -661,13 +673,11 @@ Returns `RecommendationsResponse`: `{ recoms: RecommendationItem[] }`. Each item
|
|
|
661
673
|
|
|
662
674
|
```js
|
|
663
675
|
// Product-based recommendations.
|
|
664
|
-
RetenoPlugin.getRecommendations(
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
}
|
|
670
|
-
)
|
|
676
|
+
RetenoPlugin.getRecommendations({
|
|
677
|
+
recomVariantId: 'variant-id',
|
|
678
|
+
productIds: ['product-1', 'product-2'],
|
|
679
|
+
fields: ['name', 'price', 'image', 'link'],
|
|
680
|
+
})
|
|
671
681
|
.then((result) => {
|
|
672
682
|
// result.recoms — array of recommendation items
|
|
673
683
|
// each item has productId + requested fields (name, price, etc.)
|
|
@@ -678,27 +688,23 @@ RetenoPlugin.getRecommendations(
|
|
|
678
688
|
|
|
679
689
|
```js
|
|
680
690
|
// Category-based recommendations.
|
|
681
|
-
RetenoPlugin.getRecommendations(
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
}
|
|
687
|
-
)
|
|
691
|
+
RetenoPlugin.getRecommendations({
|
|
692
|
+
recomVariantId: 'variant-id',
|
|
693
|
+
categoryId: 'category-1',
|
|
694
|
+
fields: ['name', 'price'],
|
|
695
|
+
})
|
|
688
696
|
.then((result) => console.log('getRecommendations: OK', result))
|
|
689
697
|
.catch((err) => console.error('getRecommendations: ERROR', err));
|
|
690
698
|
```
|
|
691
699
|
|
|
692
700
|
```js
|
|
693
701
|
// With filters.
|
|
694
|
-
RetenoPlugin.getRecommendations(
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
}
|
|
701
|
-
)
|
|
702
|
+
RetenoPlugin.getRecommendations({
|
|
703
|
+
recomVariantId: 'variant-id',
|
|
704
|
+
productIds: ['product-1'],
|
|
705
|
+
fields: ['name', 'price'],
|
|
706
|
+
filters: [{ name: 'category', values: ['shoes', 'boots'] }],
|
|
707
|
+
})
|
|
702
708
|
.then((result) => console.log('getRecommendations: OK', result))
|
|
703
709
|
.catch((err) => console.error('getRecommendations: ERROR', err));
|
|
704
710
|
```
|
|
@@ -708,23 +714,21 @@ RetenoPlugin.getRecommendations(
|
|
|
708
714
|
Sends recommendation events. Payload type: `LogRecommendationsPayload` in [types](../types/index.ts).
|
|
709
715
|
|
|
710
716
|
```js
|
|
711
|
-
RetenoPlugin.logRecommendations(
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
}
|
|
727
|
-
)
|
|
717
|
+
RetenoPlugin.logRecommendations({
|
|
718
|
+
recomVariantId: 'variant-id',
|
|
719
|
+
recomEvents: [
|
|
720
|
+
{
|
|
721
|
+
recomEventType: 'IMPRESSIONS',
|
|
722
|
+
occurred: new Date().toISOString(),
|
|
723
|
+
productId: 'product-1',
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
recomEventType: 'CLICKS',
|
|
727
|
+
occurred: new Date().toISOString(),
|
|
728
|
+
productId: 'product-2',
|
|
729
|
+
},
|
|
730
|
+
],
|
|
731
|
+
})
|
|
728
732
|
.then(() => console.log('logRecommendations: OK'))
|
|
729
733
|
.catch((err) => console.error('logRecommendations: ERROR', err));
|
|
730
734
|
```
|