cordova-plugin-reteno 2.0.3 → 2.1.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/README.md CHANGED
@@ -18,7 +18,7 @@ npm install cordova-plugin-reteno
18
18
  - [Cordova iOS SDK Setup](https://docs.reteno.com/reference/cordova-ios-sdk-setup)
19
19
  - [Cordova Android SDK Setup](https://docs.reteno.com/reference/cordova-android-sdk-setup)
20
20
  - [Ionic iOS SDK Setup](https://docs.reteno.com/reference/ionic-ios-sdk-setup)
21
- - [Ionic Android SDK Setup](https://docs.reteno.com/reference/ionic-android-sdk-setup)
21
+ - [Ionic Android SDK Setup](https://docs.reteno.com/reference/ionic-ios-sdk-android)
22
22
 
23
23
  ### Additional
24
24
 
package/docs/android.md CHANGED
@@ -35,8 +35,7 @@ Notes:
35
35
  You can request it via the plugin API:
36
36
 
37
37
  ```js
38
- RetenoPlugin
39
- .requestNotificationPermission()
38
+ RetenoPlugin.requestNotificationPermission()
40
39
  .then((grantedInt) => {
41
40
  // grantedInt: 1 (granted) or 0 (declined)
42
41
  })
@@ -50,8 +49,7 @@ RetenoPlugin
50
49
  Initialize Reteno once during app startup:
51
50
 
52
51
  ```js
53
- RetenoPlugin
54
- .init()
52
+ RetenoPlugin.init()
55
53
  .then(() => {
56
54
  // initialized
57
55
  })
@@ -60,6 +58,24 @@ RetenoPlugin
60
58
  });
61
59
  ```
62
60
 
61
+ For Android SDK `2.9.4+`, you can also configure session duration and split session lifecycle flags during init:
62
+
63
+ ```js
64
+ RetenoPlugin.init({
65
+ // Optional: session reset duration
66
+ sessionDurationSeconds: 30 * 60,
67
+ lifecycleTrackingOptions: {
68
+ appLifecycleEnabled: true,
69
+ // ApplicationForgrounded/ApplicationBackgrounded events (disabled by default in 2.9.4)
70
+ foregroundLifecycleEnabled: false,
71
+ pushSubscriptionEnabled: true,
72
+ // SessionStart/SessionEnd can now be managed separately
73
+ sessionStartEventsEnabled: true,
74
+ sessionEndEventsEnabled: false,
75
+ },
76
+ });
77
+ ```
78
+
63
79
  If you need advanced Reteno configuration (custom `RetenoConfig`, custom device id provider, etc), you can initialize Reteno in your custom `Application` as described here:
64
80
  [link](https://docs.reteno.com/reference/android-sdk-setup#step-4-initialize-the-reteno-sdk).
65
81
 
@@ -68,7 +84,7 @@ If you need advanced Reteno configuration (custom `RetenoConfig`, custom device
68
84
 
69
85
  ## Push notification listeners
70
86
 
71
- The plugin uses the listener-based API (`EventListener` / `Procedure`) for all push events.
87
+ The plugin uses the listener-based API (`EventListener` / `Procedure`, Android SDK `2.9.4`) for all push events.
72
88
 
73
89
  - `setOnRetenoPushDismissedListener(listener)` — called when a push notification is dismissed (swiped away).
74
90
  - `setOnRetenoCustomPushReceivedListener(listener)` — called when a custom push notification is received.
package/docs/api.md CHANGED
@@ -10,77 +10,77 @@ Notes:
10
10
 
11
11
  ### Initialization
12
12
 
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`, `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) |
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.4+, iOS 2.7.0+), `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 | Supported platform | Description |
22
- | --- | --- | --- |
23
- | [setUserAttributes](../www/cordova-plugin-reteno.js) | iOS, Android | [Types](../types/index.ts) |
24
- | [setAnonymousUserAttributes](../www/cordova-plugin-reteno.js) | iOS, Android | [Types](../types/index.ts) |
25
- | [setMultiAccountUserAttributes](../www/cordova-plugin-reteno.js) | iOS, Android | [Types](../types/index.ts) |
21
+ | Method | Supported platform | Description |
22
+ | ---------------------------------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------ |
23
+ | [setUserAttributes](../www/cordova-plugin-reteno.js) | iOS, Android | Supports `marketId` (Android 2.9.5+, iOS 2.7.1+). Pass `""` to clear. [Types](../types/index.ts) |
24
+ | [setAnonymousUserAttributes](../www/cordova-plugin-reteno.js) | iOS, Android | Supports `marketId` (Android 2.9.5+, iOS 2.7.1+). Pass `""` to clear. [Types](../types/index.ts) |
25
+ | [setMultiAccountUserAttributes](../www/cordova-plugin-reteno.js) | iOS, Android | Supports `marketId` (Android 2.9.5+, iOS 2.7.1+). Pass `""` to clear. [Types](../types/index.ts) |
26
26
 
27
27
  ### Event tracking
28
28
 
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. |
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 | 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) |
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
56
 
57
57
  ### In-app messages
58
58
 
59
- | Method | Supported platform | Description |
60
- | --- | --- | --- |
61
- | [pauseInAppMessages](../www/cordova-plugin-reteno.js) | iOS, Android | Pauses or resumes in-app messages at runtime. Pass `true` to pause, `false` to resume. |
62
- | [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) |
63
- | [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) |
64
- | [setOnInAppMessageCustomDataReceivedListener](../www/cordova-plugin-reteno.js) | Android | Sets listener for in-app message custom data events. |
65
- | [removeOnInAppMessageCustomDataReceivedListener](../www/cordova-plugin-reteno.js) | Android | Removes listener for in-app message custom data events. |
59
+ | Method | Supported platform | Description |
60
+ | --------------------------------------------------------------------------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
+ | [pauseInAppMessages](../www/cordova-plugin-reteno.js) | iOS, Android | Pauses or resumes in-app messages at runtime. Pass `true` to pause, `false` to resume. |
62
+ | [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) |
63
+ | [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) |
64
+ | [setOnInAppMessageCustomDataReceivedListener](../www/cordova-plugin-reteno.js) | Android | Sets listener for in-app message custom data events. |
65
+ | [removeOnInAppMessageCustomDataReceivedListener](../www/cordova-plugin-reteno.js) | Android | Removes listener for in-app message custom data events. |
66
66
 
67
67
  ### App Inbox
68
68
 
69
- | Method | Supported platform | Description |
70
- | --- | --- | --- |
71
- | [getAppInboxMessages](../www/cordova-plugin-reteno.js) | iOS, Android | Fetches App Inbox messages with pagination. Returns `{ messages, totalPages }`. [Types](../types/index.ts) |
72
- | [getAppInboxMessagesCount](../www/cordova-plugin-reteno.js) | iOS, Android | Fetches count of App Inbox messages. Returns a number. |
73
- | [subscribeOnMessagesCountChanged](../www/cordova-plugin-reteno.js) | iOS, Android | Subscribes to App Inbox messages count changes. |
74
- | [unsubscribeMessagesCountChanged](../www/cordova-plugin-reteno.js) | iOS, Android | Unsubscribes from App Inbox messages count changes. |
75
- | [markAsOpened](../www/cordova-plugin-reteno.js) | iOS, Android | Marks an App Inbox message as opened. |
76
- | [markAllMessagesAsOpened](../www/cordova-plugin-reteno.js) | iOS, Android | Marks all App Inbox messages as opened. |
69
+ | Method | Supported platform | Description |
70
+ | ------------------------------------------------------------------ | ------------------ | ---------------------------------------------------------------------------------------------------------- |
71
+ | [getAppInboxMessages](../www/cordova-plugin-reteno.js) | iOS, Android | Fetches App Inbox messages with pagination. Returns `{ messages, totalPages }`. [Types](../types/index.ts) |
72
+ | [getAppInboxMessagesCount](../www/cordova-plugin-reteno.js) | iOS, Android | Fetches count of App Inbox messages. Returns a number. |
73
+ | [subscribeOnMessagesCountChanged](../www/cordova-plugin-reteno.js) | iOS, Android | Subscribes to App Inbox messages count changes. |
74
+ | [unsubscribeMessagesCountChanged](../www/cordova-plugin-reteno.js) | iOS, Android | Unsubscribes from App Inbox messages count changes. |
75
+ | [markAsOpened](../www/cordova-plugin-reteno.js) | iOS, Android | Marks an App Inbox message as opened. |
76
+ | [markAllMessagesAsOpened](../www/cordova-plugin-reteno.js) | iOS, Android | Marks all App Inbox messages as opened. |
77
77
 
78
78
  ### Recommendations
79
79
 
80
- | Method | Supported platform | Description |
81
- | --- | --- | --- |
82
- | [getRecommendations](../www/cordova-plugin-reteno.js) | iOS, Android | Fetches product or category recommendations. Returns `{ recoms: [...] }`. [Types](../types/index.ts) |
83
- | [logRecommendations](../www/cordova-plugin-reteno.js) | iOS, Android | Sends recommendation impressions or clicks. [Types](../types/index.ts) |
80
+ | Method | Supported platform | Description |
81
+ | ----------------------------------------------------- | ------------------ | ---------------------------------------------------------------------------------------------------- |
82
+ | [getRecommendations](../www/cordova-plugin-reteno.js) | iOS, Android | Fetches product or category recommendations. Returns `{ recoms: [...] }`. [Types](../types/index.ts) |
83
+ | [logRecommendations](../www/cordova-plugin-reteno.js) | iOS, Android | Sends recommendation impressions or clicks. [Types](../types/index.ts) |
84
84
 
85
85
  ### init example
86
86
 
@@ -99,6 +99,7 @@ RetenoPlugin.init()
99
99
  // pausePushInAppMessages: pauses in-app messages triggered by push notifications.
100
100
  // inAppMessagesPauseBehaviour: (iOS) defines handling while paused: 'SKIP_IN_APPS' or 'POSTPONE_IN_APPS'.
101
101
  // lifecycleTrackingOptions: configures app lifecycle, push subscription, and session event tracking ('ALL', 'NONE', or an object).
102
+ // sessionDurationSeconds (Android 2.9.4+, iOS 2.7.0+): optional session reset duration.
102
103
  // isAutomaticScreenReportingEnabled: enables automatic native screen view tracking on iOS.
103
104
  // Keep this false in Cordova/Ionic WebView apps (including Android demos).
104
105
  // Defaults to false. Note: in Cordova/Ionic apps the UI runs inside a single WebView,
@@ -115,10 +116,13 @@ RetenoPlugin.init({
115
116
  inAppMessagesPauseBehaviour: 'SKIP_IN_APPS', // iOS
116
117
  isAutomaticScreenReportingEnabled: false, // keep false for hybrid/WebView apps
117
118
  isDebugMode: true, // enables debug mode
119
+ sessionDurationSeconds: 30 * 60, // Android 2.9.4+, iOS 2.7.0+: 30 minutes
118
120
  lifecycleTrackingOptions: {
119
121
  appLifecycleEnabled: true,
122
+ foregroundLifecycleEnabled: false,
120
123
  pushSubscriptionEnabled: true,
121
- sessionEventsEnabled: false,
124
+ sessionStartEventsEnabled: true,
125
+ sessionEndEventsEnabled: false, // Android 2.9.4 default
122
126
  },
123
127
  })
124
128
  .then(() => console.log('init: OK'))
@@ -129,6 +133,8 @@ RetenoPlugin.init({
129
133
  // Shorthand lifecycle tracking values:
130
134
  RetenoPlugin.init({ lifecycleTrackingOptions: 'ALL' });
131
135
  RetenoPlugin.init({ lifecycleTrackingOptions: 'NONE' });
136
+ // Legacy alias (deprecated): sessionEventsEnabled controls both start/end at once.
137
+ RetenoPlugin.init({ lifecycleTrackingOptions: { sessionEventsEnabled: false } });
132
138
  ```
133
139
 
134
140
  ### setUserAttributes payload example
@@ -136,31 +142,30 @@ RetenoPlugin.init({ lifecycleTrackingOptions: 'NONE' });
136
142
  ```js
137
143
  // `externalUserId` is required and must be a non-empty string.
138
144
  // `user` is optional (you can omit it or pass null).
139
- RetenoPlugin.setUserAttributes(
140
- {
141
- externalUserId: 'user-123',
142
- user: {
143
- userAttributes: {
144
- email: 'john.doe@example.com',
145
- phone: '+1234567890',
146
- firstName: 'John',
147
- lastName: 'Doe',
148
- languageCode: 'en',
149
- timeZone: 'Europe/Kyiv',
150
- address: {
151
- region: 'Kyivska',
152
- town: 'Kyiv',
153
- address: 'Khreshchatyk St, 1',
154
- postcode: '01001',
155
- },
156
- fields: [{ key: 'plan', value: 'premium' }],
145
+ RetenoPlugin.setUserAttributes({
146
+ externalUserId: 'user-123',
147
+ user: {
148
+ userAttributes: {
149
+ email: 'john.doe@example.com',
150
+ phone: '+1234567890',
151
+ firstName: 'John',
152
+ lastName: 'Doe',
153
+ languageCode: 'en',
154
+ timeZone: 'Europe/Kyiv',
155
+ address: {
156
+ region: 'Kyivska',
157
+ town: 'Kyiv',
158
+ address: 'Khreshchatyk St, 1',
159
+ postcode: '01001',
157
160
  },
158
- subscriptionKeys: ['news', 'promotions'],
159
- groupNamesInclude: ['beta-testers'],
160
- groupNamesExclude: ['unsubscribed'],
161
+ fields: [{ key: 'plan', value: 'premium' }],
162
+ marketId: 'market_1',
161
163
  },
162
- }
163
- )
164
+ subscriptionKeys: ['news', 'promotions'],
165
+ groupNamesInclude: ['beta-testers'],
166
+ groupNamesExclude: ['unsubscribed'],
167
+ },
168
+ })
164
169
  .then(() => console.log('setUserAttributes: OK'))
165
170
  .catch((err) => console.error('setUserAttributes: ERROR', err));
166
171
  ```
@@ -170,21 +175,20 @@ RetenoPlugin.setUserAttributes(
170
175
  ```js
171
176
  // Anonymous attributes are used before contact identification.
172
177
  // Note: Unlike setUserAttributes, this payload does NOT include phone/email.
173
- RetenoPlugin.setAnonymousUserAttributes(
174
- {
175
- firstName: 'John',
176
- lastName: 'Doe',
177
- languageCode: 'en',
178
- timeZone: 'Europe/Kyiv',
179
- address: {
180
- region: 'Kyivska',
181
- town: 'Kyiv',
182
- address: 'Khreshchatyk St, 1',
183
- postcode: '01001',
184
- },
185
- fields: [{ key: 'utm_source', value: 'google' }],
186
- }
187
- )
178
+ RetenoPlugin.setAnonymousUserAttributes({
179
+ firstName: 'John',
180
+ lastName: 'Doe',
181
+ languageCode: 'en',
182
+ timeZone: 'Europe/Kyiv',
183
+ address: {
184
+ region: 'Kyivska',
185
+ town: 'Kyiv',
186
+ address: 'Khreshchatyk St, 1',
187
+ postcode: '01001',
188
+ },
189
+ fields: [{ key: 'utm_source', value: 'google' }],
190
+ marketId: 'market_1',
191
+ })
188
192
  .then(() => console.log('setAnonymousUserAttributes: OK'))
189
193
  .catch((err) => console.error('setAnonymousUserAttributes: ERROR', err));
190
194
  ```
@@ -200,31 +204,30 @@ RetenoPlugin.setAnonymousUserAttributes(
200
204
  // 1 token per device behavior.
201
205
  // `externalUserId` is required and must be a non-empty string.
202
206
  // `user` is required and must be an object.
203
- RetenoPlugin.setMultiAccountUserAttributes(
204
- {
205
- externalUserId: 'user-123',
206
- user: {
207
- userAttributes: {
208
- email: 'john.doe@example.com',
209
- phone: '+1234567890',
210
- firstName: 'John',
211
- lastName: 'Doe',
212
- languageCode: 'en',
213
- timeZone: 'Europe/Kyiv',
214
- address: {
215
- region: 'Kyivska',
216
- town: 'Kyiv',
217
- address: 'Khreshchatyk St, 1',
218
- postcode: '01001',
219
- },
220
- fields: [{ key: 'plan', value: 'premium' }],
207
+ RetenoPlugin.setMultiAccountUserAttributes({
208
+ externalUserId: 'user-123',
209
+ user: {
210
+ userAttributes: {
211
+ email: 'john.doe@example.com',
212
+ phone: '+1234567890',
213
+ firstName: 'John',
214
+ lastName: 'Doe',
215
+ languageCode: 'en',
216
+ timeZone: 'Europe/Kyiv',
217
+ address: {
218
+ region: 'Kyivska',
219
+ town: 'Kyiv',
220
+ address: 'Khreshchatyk St, 1',
221
+ postcode: '01001',
221
222
  },
222
- subscriptionKeys: ['news', 'promotions'],
223
- groupNamesInclude: ['beta-testers'],
224
- groupNamesExclude: ['unsubscribed'],
223
+ fields: [{ key: 'plan', value: 'premium' }],
224
+ marketId: 'market_1',
225
225
  },
226
- }
227
- )
226
+ subscriptionKeys: ['news', 'promotions'],
227
+ groupNamesInclude: ['beta-testers'],
228
+ groupNamesExclude: ['unsubscribed'],
229
+ },
230
+ })
228
231
  .then(() => console.log('setMultiAccountUserAttributes: OK'))
229
232
  .catch((err) => console.error('setMultiAccountUserAttributes: ERROR', err));
230
233
  ```
@@ -236,11 +239,11 @@ RetenoPlugin.setMultiAccountUserAttributes(
236
239
  // Unspecified fields default to true.
237
240
  // Android: applies immediately.
238
241
  // iOS: this works only BEFORE SDK initialization (before calling init()).
239
- RetenoPlugin.setLifecycleTrackingOptions(
240
- {
241
- sessionEventsEnabled: true,
242
- }
243
- )
242
+ // Deprecated: sessionEventsEnabled (if used) toggles both sessionStart and sessionEnd.
243
+ RetenoPlugin.setLifecycleTrackingOptions({
244
+ sessionStartEventsEnabled: true,
245
+ sessionEndEventsEnabled: true,
246
+ })
244
247
  .then(() => console.log('setLifecycleTrackingOptions: OK'))
245
248
  .catch((err) => console.error('setLifecycleTrackingOptions: ERROR', err));
246
249
  ```
@@ -259,17 +262,15 @@ Invalid values (anything except `'ALL'`, `'NONE'`, or an object with known field
259
262
  Payload type: `LogEventPayload` in [types](../types/index.ts).
260
263
 
261
264
  ```js
262
- RetenoPlugin.logEvent(
263
- {
264
- eventName: 'purchase',
265
- // Optional ISO 8601 string. If omitted, current time is used.
266
- date: new Date().toISOString(),
267
- parameters: [
268
- { name: 'orderId', value: 'A-123' },
269
- { name: 'amount', value: '19.99' },
270
- ],
271
- }
272
- )
265
+ RetenoPlugin.logEvent({
266
+ eventName: 'purchase',
267
+ // Optional ISO 8601 string. If omitted, current time is used.
268
+ date: new Date().toISOString(),
269
+ parameters: [
270
+ { name: 'orderId', value: 'A-123' },
271
+ { name: 'amount', value: '19.99' },
272
+ ],
273
+ })
273
274
  .then(() => console.log('logEvent: OK'))
274
275
  .catch((err) => console.error('logEvent: ERROR', err));
275
276
  ```
@@ -357,9 +358,7 @@ RetenoPlugin.logEcommerceEvent({
357
358
  ### logScreenView example
358
359
 
359
360
  ```js
360
- RetenoPlugin.logScreenView(
361
- 'HomeScreen'
362
- )
361
+ RetenoPlugin.logScreenView('HomeScreen')
363
362
  .then(() => console.log('logScreenView: OK'))
364
363
  .catch((err) => console.error('logScreenView: ERROR', err));
365
364
  ```
@@ -367,8 +366,7 @@ RetenoPlugin.logScreenView(
367
366
  ### forcePushData example
368
367
 
369
368
  ```js
370
- RetenoPlugin
371
- .forcePushData()
369
+ RetenoPlugin.forcePushData()
372
370
  .then(() => console.log('forcePushData: OK'))
373
371
  .catch((err) => console.error('forcePushData: ERROR', err));
374
372
  ```
@@ -460,13 +458,13 @@ RetenoPlugin.setOnInAppMessageCustomDataReceivedListener(function (event) {
460
458
  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.
461
459
 
462
460
  Notes:
461
+
463
462
  - On Android, if Reteno receives FCM callbacks directly, you generally don't need to call `setDeviceToken`.
464
463
  - 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).
465
464
 
466
465
  ```js
467
466
  // 1) Initialize Reteno first.
468
- RetenoPlugin
469
- .init()
467
+ RetenoPlugin.init()
470
468
  .then(() => {
471
469
  // Forward token from your token source (replace this with your integration).
472
470
  getFcmTokenFromSomewhere(
@@ -485,7 +483,7 @@ Subscribe to push received events while the app is running.
485
483
 
486
484
  Notes:
487
485
 
488
- - On Android this is based on the SDK 2.9.2 `EventListener` / `Procedure` API (`RetenoNotifications.getReceived()`).
486
+ - On Android this is based on the SDK 2.9.4 `EventListener` / `Procedure` API (`RetenoNotifications.getReceived()`).
489
487
  - This listener is not a replacement for `getInitialNotification()` (cold start): if the app was launched by tapping a notification, use `getInitialNotification()`.
490
488
 
491
489
  ```js
@@ -559,12 +557,10 @@ Updates the default notification channel parameters for existing users on Androi
559
557
  Payload type: `NotificationChannelConfig` in [types](../types/index.ts).
560
558
 
561
559
  ```js
562
- RetenoPlugin.updateDefaultNotificationChannel(
563
- {
564
- name: 'New Channel Name',
565
- description: 'New Channel Description',
566
- }
567
- )
560
+ RetenoPlugin.updateDefaultNotificationChannel({
561
+ name: 'New Channel Name',
562
+ description: 'New Channel Description',
563
+ })
568
564
  .then(() => console.log('updateDefaultNotificationChannel: OK'))
569
565
  .catch((err) => console.error('updateDefaultNotificationChannel: ERROR', err));
570
566
  ```
@@ -576,17 +572,21 @@ Fetches paginated App Inbox messages. Payload type: `GetAppInboxMessagesPayload`
576
572
  Returns `AppInboxMessages`: `{ messages: AppInboxMessage[], totalPages: number }`.
577
573
 
578
574
  ```js
579
- RetenoPlugin.getAppInboxMessages(
580
- {
581
- page: 1,
582
- pageSize: 20,
583
- status: 'UNOPENED', // optional: 'OPENED' | 'UNOPENED'
584
- }
585
- )
575
+ RetenoPlugin.getAppInboxMessages({
576
+ page: 1,
577
+ pageSize: 20,
578
+ status: 'UNOPENED', // optional: 'OPENED' | 'UNOPENED'
579
+ })
586
580
  .then((result) => {
587
581
  // result.messages — array of AppInboxMessage objects
588
582
  // result.totalPages — total number of pages
589
- console.log('getAppInboxMessages: OK', result.messages.length, 'of', result.totalPages, 'pages');
583
+ console.log(
584
+ 'getAppInboxMessages: OK',
585
+ result.messages.length,
586
+ 'of',
587
+ result.totalPages,
588
+ 'pages'
589
+ );
590
590
  })
591
591
  .catch((err) => console.error('getAppInboxMessages: ERROR', err));
592
592
  ```
@@ -653,13 +653,11 @@ Returns `RecommendationsResponse`: `{ recoms: RecommendationItem[] }`. Each item
653
653
 
654
654
  ```js
655
655
  // Product-based recommendations.
656
- RetenoPlugin.getRecommendations(
657
- {
658
- recomVariantId: 'variant-id',
659
- productIds: ['product-1', 'product-2'],
660
- fields: ['name', 'price', 'image', 'link'],
661
- }
662
- )
656
+ RetenoPlugin.getRecommendations({
657
+ recomVariantId: 'variant-id',
658
+ productIds: ['product-1', 'product-2'],
659
+ fields: ['name', 'price', 'image', 'link'],
660
+ })
663
661
  .then((result) => {
664
662
  // result.recoms — array of recommendation items
665
663
  // each item has productId + requested fields (name, price, etc.)
@@ -670,27 +668,23 @@ RetenoPlugin.getRecommendations(
670
668
 
671
669
  ```js
672
670
  // Category-based recommendations.
673
- RetenoPlugin.getRecommendations(
674
- {
675
- recomVariantId: 'variant-id',
676
- categoryId: 'category-1',
677
- fields: ['name', 'price'],
678
- }
679
- )
671
+ RetenoPlugin.getRecommendations({
672
+ recomVariantId: 'variant-id',
673
+ categoryId: 'category-1',
674
+ fields: ['name', 'price'],
675
+ })
680
676
  .then((result) => console.log('getRecommendations: OK', result))
681
677
  .catch((err) => console.error('getRecommendations: ERROR', err));
682
678
  ```
683
679
 
684
680
  ```js
685
681
  // With filters.
686
- RetenoPlugin.getRecommendations(
687
- {
688
- recomVariantId: 'variant-id',
689
- productIds: ['product-1'],
690
- fields: ['name', 'price'],
691
- filters: [{ name: 'category', values: ['shoes', 'boots'] }],
692
- }
693
- )
682
+ RetenoPlugin.getRecommendations({
683
+ recomVariantId: 'variant-id',
684
+ productIds: ['product-1'],
685
+ fields: ['name', 'price'],
686
+ filters: [{ name: 'category', values: ['shoes', 'boots'] }],
687
+ })
694
688
  .then((result) => console.log('getRecommendations: OK', result))
695
689
  .catch((err) => console.error('getRecommendations: ERROR', err));
696
690
  ```
@@ -700,23 +694,21 @@ RetenoPlugin.getRecommendations(
700
694
  Sends recommendation events. Payload type: `LogRecommendationsPayload` in [types](../types/index.ts).
701
695
 
702
696
  ```js
703
- RetenoPlugin.logRecommendations(
704
- {
705
- recomVariantId: 'variant-id',
706
- recomEvents: [
707
- {
708
- recomEventType: 'IMPRESSIONS',
709
- occurred: new Date().toISOString(),
710
- productId: 'product-1',
711
- },
712
- {
713
- recomEventType: 'CLICKS',
714
- occurred: new Date().toISOString(),
715
- productId: 'product-2',
716
- },
717
- ],
718
- }
719
- )
697
+ RetenoPlugin.logRecommendations({
698
+ recomVariantId: 'variant-id',
699
+ recomEvents: [
700
+ {
701
+ recomEventType: 'IMPRESSIONS',
702
+ occurred: new Date().toISOString(),
703
+ productId: 'product-1',
704
+ },
705
+ {
706
+ recomEventType: 'CLICKS',
707
+ occurred: new Date().toISOString(),
708
+ productId: 'product-2',
709
+ },
710
+ ],
711
+ })
720
712
  .then(() => console.log('logRecommendations: OK'))
721
713
  .catch((err) => console.error('logRecommendations: ERROR', err));
722
714
  ```