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.
@@ -117,7 +117,7 @@ class RetenoPlugin: CDVPlugin {
117
117
  isAutomaticScreenReportingEnabled: screenReportingEnabled,
118
118
  isAutomaticAppLifecycleReportingEnabled: lifecycleAppEnabled,
119
119
  isApplicationForegroundLifecycleReportingEnabled: lifecycleForegroundEnabled,
120
- isAutomaticPushSubsriptionReportingEnabled: lifecyclePushEnabled,
120
+ isAutomaticPushSubscriptionReportingEnabled: lifecyclePushEnabled,
121
121
  sessionConfiguration: RetenoSessionConfiguration(
122
122
  sessionDuration: sessionDurationSeconds,
123
123
  isSessionStartReportingEnabled: lifecycleSessionStartEnabled,
@@ -125,14 +125,13 @@ class RetenoPlugin: CDVPlugin {
125
125
  ),
126
126
  isPausedInAppMessages: pauseInAppMessages,
127
127
  inAppMessagesPauseBehaviour: inAppMessagesPauseBehaviour,
128
- isDebugMode: isDebugMode,
129
- deviceTokenHandlingMode: deviceTokenMode
128
+ isDebugMode: isDebugMode
130
129
  )
131
130
 
132
131
  self.isManualTokenMode = (deviceTokenMode == .manual)
133
132
 
134
133
  DispatchQueue.main.async {
135
- Reteno.start(apiKey: apiKey, configuration: configuration)
134
+ Reteno.start(apiKey: apiKey, deviceTokenHandlingMode: deviceTokenMode, configuration: configuration)
136
135
 
137
136
  // When IOS_DEVICE_TOKEN_HANDLING_MODE is manual and FirebaseMessaging is available,
138
137
  // configure Firebase if the developer hasn't done it yet, then hook FCM
@@ -1364,6 +1363,13 @@ class RetenoPlugin: CDVPlugin {
1364
1363
  return trimmed.isEmpty ? nil : trimmed
1365
1364
  }
1366
1365
 
1366
+ // For marketId, empty string explicitly means "clear value" and must be preserved.
1367
+ private func marketIdValue(_ value: Any?) -> String? {
1368
+ guard let raw = value as? String else { return nil }
1369
+ let trimmed = raw.trimmingCharacters(in: .whitespacesAndNewlines)
1370
+ return trimmed.isEmpty ? "" : trimmed
1371
+ }
1372
+
1367
1373
  private func stringArrayValue(_ value: Any?) -> [String] {
1368
1374
  if let array = value as? [String] {
1369
1375
  return array.compactMap { stringValue($0) }
@@ -1453,6 +1459,7 @@ class RetenoPlugin: CDVPlugin {
1453
1459
  let timeZone = stringValue(payload["timeZone"])
1454
1460
  let address = buildAddress(from: payload["address"])
1455
1461
  let fields = buildCustomFields(from: payload["fields"])
1462
+ let marketId = marketIdValue(payload["marketId"])
1456
1463
 
1457
1464
  return UserAttributes(
1458
1465
  phone: phone,
@@ -1461,6 +1468,7 @@ class RetenoPlugin: CDVPlugin {
1461
1468
  lastName: lastName,
1462
1469
  languageCode: languageCode,
1463
1470
  timeZone: timeZone,
1471
+ marketId: marketId,
1464
1472
  address: address,
1465
1473
  fields: fields
1466
1474
  )
@@ -1473,12 +1481,14 @@ class RetenoPlugin: CDVPlugin {
1473
1481
  let timeZone = stringValue(payload["timeZone"])
1474
1482
  let address = buildAddress(from: payload["address"])
1475
1483
  let fields = buildCustomFields(from: payload["fields"])
1484
+ let marketId = marketIdValue(payload["marketId"])
1476
1485
 
1477
1486
  return AnonymousUserAttributes(
1478
1487
  firstName: firstName,
1479
1488
  lastName: lastName,
1480
1489
  languageCode: languageCode,
1481
1490
  timeZone: timeZone,
1491
+ marketId: marketId,
1482
1492
  address: address,
1483
1493
  fields: fields
1484
1494
  )
package/types/index.ts CHANGED
@@ -19,6 +19,13 @@ export type UserAttributesAnonymous = {
19
19
  timeZone?: string | null;
20
20
  address?: Address | null;
21
21
  fields?: Fields | null;
22
+ /**
23
+ * Market ID. Max 64 chars; latin letters, digits, '-' and '_' are allowed.
24
+ * Pass `""` (empty string) to clear the value on the server.
25
+ * Passing `null` or omitting the field has no effect (the existing value is kept).
26
+ * Available with the bundled Android 2.9.6+ and iOS 2.7.2+ SDKs.
27
+ */
28
+ marketId?: string;
22
29
  };
23
30
 
24
31
  export type UserAttributes = {
@@ -97,7 +104,7 @@ export type RetenoInitializeOptions = {
97
104
  inAppMessagesPauseBehaviour?: InAppPauseBehaviour;
98
105
  isAutomaticScreenReportingEnabled?: boolean;
99
106
  lifecycleTrackingOptions?: LifecycleTrackingOptions;
100
- /** Session reset duration in seconds (Android 2.9.4+, iOS 2.7.0+). */
107
+ /** Session reset duration in seconds (supported by the bundled Android 2.9.6+ and iOS 2.7.2+ SDKs). */
101
108
  sessionDurationSeconds?: number;
102
109
  /** Enables Reteno debug mode for near real-time event monitoring. Use only with test devices. */
103
110
  isDebugMode?: boolean;
@@ -105,7 +112,12 @@ export type RetenoInitializeOptions = {
105
112
 
106
113
  export type InAppPauseBehaviour = 'SKIP_IN_APPS' | 'POSTPONE_IN_APPS';
107
114
 
108
- export type InAppLifecycleEvent = 'beforeDisplay' | 'onDisplay' | 'beforeClose' | 'afterClose' | 'onError';
115
+ export type InAppLifecycleEvent =
116
+ | 'beforeDisplay'
117
+ | 'onDisplay'
118
+ | 'beforeClose'
119
+ | 'afterClose'
120
+ | 'onError';
109
121
 
110
122
  export type InAppData = {
111
123
  id?: string;
@@ -118,7 +130,7 @@ export type InAppActionData = {
118
130
  };
119
131
 
120
132
  export type InAppCloseData = {
121
- id?: string;//android only
133
+ id?: string; //android only
122
134
  closeAction: string;
123
135
  action?: InAppActionData;
124
136
  };
@@ -142,6 +154,14 @@ export type NotificationChannelConfig = {
142
154
  description: string;
143
155
  };
144
156
 
157
+ /**
158
+ * Android notification grouping rule. The rule is persisted natively so it
159
+ * remains available when a push is handled before the WebView starts.
160
+ */
161
+ export type NotificationGroupingRule =
162
+ | { payloadKey: string; groupId?: never; showSummary?: boolean }
163
+ | { groupId: string; payloadKey?: never; showSummary?: boolean };
164
+
145
165
  export type AppInboxStatus = 'OPENED' | 'UNOPENED';
146
166
 
147
167
  export type AppInboxMessage = {