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
|
@@ -135,7 +135,7 @@ var urlutil = require('cordova/urlutil');
|
|
|
135
135
|
*/
|
|
136
136
|
|
|
137
137
|
const RetenoPluginFunctions = {
|
|
138
|
-
|
|
138
|
+
/*
|
|
139
139
|
options: {
|
|
140
140
|
accessKey?: string,
|
|
141
141
|
pauseInAppMessages?: boolean,
|
|
@@ -143,7 +143,7 @@ const RetenoPluginFunctions = {
|
|
|
143
143
|
inAppMessagesPauseBehaviour?: 'SKIP_IN_APPS' | 'POSTPONE_IN_APPS',
|
|
144
144
|
isAutomaticScreenReportingEnabled?: boolean,
|
|
145
145
|
isDebugMode?: boolean,
|
|
146
|
-
sessionDurationSeconds?: number, // Android 2.9.
|
|
146
|
+
sessionDurationSeconds?: number, // Android 2.9.6+, iOS 2.7.2+
|
|
147
147
|
lifecycleTrackingOptions?: {
|
|
148
148
|
appLifecycleEnabled?: boolean,
|
|
149
149
|
foregroundLifecycleEnabled?: boolean,
|
|
@@ -154,206 +154,207 @@ const RetenoPluginFunctions = {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
*/
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
157
|
+
init: function (arg0, success, error) {
|
|
158
|
+
// Back-compat: init(success, error)
|
|
159
|
+
if (typeof arg0 === 'function') {
|
|
160
|
+
error = success;
|
|
161
|
+
success = arg0;
|
|
162
|
+
arg0 = {};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const options = arg0 || {};
|
|
166
|
+
const p = __ensureInit(options);
|
|
167
|
+
if (__isFn(success) || __isFn(error)) {
|
|
168
|
+
p.then(function (res) {
|
|
169
|
+
if (__isFn(success)) success(res);
|
|
170
|
+
return res;
|
|
171
|
+
}).catch(function (err) {
|
|
172
|
+
if (__isFn(error)) error(err);
|
|
173
|
+
throw err;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return p;
|
|
177
|
+
},
|
|
178
178
|
|
|
179
|
-
|
|
179
|
+
/* arg0:
|
|
180
180
|
eventName: string,
|
|
181
181
|
date: string,
|
|
182
182
|
// date parameter should be in ISO8601 format
|
|
183
183
|
parameters: CustomEventParameter[],
|
|
184
184
|
forcePush?: boolean
|
|
185
185
|
*/
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
logEvent: function (arg0, success, error) {
|
|
187
|
+
return __callWithAutoInit('logEvent', [arg0], success, error);
|
|
188
|
+
},
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
/*
|
|
191
191
|
payload: LogEcommerceEventPayload
|
|
192
192
|
See https://docs.reteno.com/reference/android-ecommerce-activity-tracking
|
|
193
193
|
*/
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
194
|
+
logEcommerceEvent: function (arg0, success, error) {
|
|
195
|
+
// Accept either `payload` or legacy `[payload]`.
|
|
196
|
+
const payload = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
197
|
+
if (!payload || typeof payload !== 'object') {
|
|
198
|
+
return Promise.reject(new Error('Missing argument: payload'));
|
|
199
|
+
}
|
|
200
|
+
if (
|
|
201
|
+
!payload.eventType ||
|
|
202
|
+
typeof payload.eventType !== 'string' ||
|
|
203
|
+
payload.eventType.trim().length === 0
|
|
204
|
+
) {
|
|
205
|
+
return Promise.reject(new Error('Missing argument: eventType'));
|
|
206
|
+
}
|
|
207
|
+
return __callWithAutoInit('logEcommerceEvent', [payload], success, error);
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
/*
|
|
207
211
|
payload: SetUserAttributesPayload
|
|
208
212
|
*/
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
213
|
+
setUserAttributes: function (arg0, success, error) {
|
|
214
|
+
// Accept either `payload` or legacy `[payload]`.
|
|
215
|
+
const payload = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
216
|
+
if (
|
|
217
|
+
!payload ||
|
|
218
|
+
!payload.externalUserId ||
|
|
219
|
+
(payload.externalUserId && payload.externalUserId.length === 0)
|
|
220
|
+
) {
|
|
221
|
+
return Promise.reject(new Error('Missing argument: "externalUserId"'));
|
|
222
|
+
}
|
|
223
|
+
return __callWithAutoInit('setUserAttributes', [payload], success, error);
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
/*
|
|
223
227
|
payload: UserAttributesAnonymous
|
|
224
228
|
*/
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
},
|
|
252
|
-
|
|
253
|
-
/*
|
|
229
|
+
setAnonymousUserAttributes: function (arg0, success, error) {
|
|
230
|
+
// Accept either `payload` or legacy `[payload]`.
|
|
231
|
+
const payload = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
232
|
+
if (!payload || typeof payload !== 'object') {
|
|
233
|
+
return Promise.reject(new Error('Missing argument: payload'));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Reteno docs: anonymous user attributes cannot include phone/email.
|
|
237
|
+
if (payload.phone || payload.email) {
|
|
238
|
+
return Promise.reject(
|
|
239
|
+
new Error(
|
|
240
|
+
'Anonymous user attributes cannot include phone/email. Use setUserAttributes(externalUserId, user) instead.'
|
|
241
|
+
)
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
if (payload.userAttributes && (payload.userAttributes.phone || payload.userAttributes.email)) {
|
|
245
|
+
return Promise.reject(
|
|
246
|
+
new Error(
|
|
247
|
+
'Anonymous user attributes cannot include phone/email. Use setUserAttributes(externalUserId, user) instead.'
|
|
248
|
+
)
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
return __callWithAutoInit('setAnonymousUserAttributes', [payload], success, error);
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
/*
|
|
254
255
|
payload: SetMultiAccountUserAttributesPayload
|
|
255
256
|
*/
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
257
|
+
setMultiAccountUserAttributes: function (arg0, success, error) {
|
|
258
|
+
// Accept either `payload` or legacy `[payload]`.
|
|
259
|
+
const payload = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
260
|
+
if (
|
|
261
|
+
!payload ||
|
|
262
|
+
!payload.externalUserId ||
|
|
263
|
+
(payload.externalUserId && payload.externalUserId.length === 0)
|
|
264
|
+
) {
|
|
265
|
+
return Promise.reject(new Error('Missing argument: "externalUserId"'));
|
|
266
|
+
}
|
|
267
|
+
if (!payload.user || typeof payload.user !== 'object') {
|
|
268
|
+
return Promise.reject(new Error('Missing argument: "user"'));
|
|
269
|
+
}
|
|
270
|
+
return __callWithAutoInit('setMultiAccountUserAttributes', [payload], success, error);
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
getInitialNotification: function (arg0, success, error) {
|
|
274
|
+
// Allowed before init (used on cold start).
|
|
275
|
+
return __callWithExec('getInitialNotification', [arg0], success, error);
|
|
276
|
+
},
|
|
277
|
+
|
|
278
|
+
setOnRetenoPushReceivedListener: function (arg0, arg1) {
|
|
279
|
+
// Back-compat:
|
|
280
|
+
// - setOnRetenoPushReceivedListener(listener)
|
|
281
|
+
// - setOnRetenoPushReceivedListener(reteno, listener) (legacy)
|
|
282
|
+
const listener = typeof arg0 === 'function' ? arg0 : arg1;
|
|
283
|
+
if (typeof listener !== 'function') return;
|
|
284
|
+
document.addEventListener('reteno-push-received', listener);
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
setOnRetenoNotificationClickedListener: function (arg0, arg1) {
|
|
288
|
+
// Back-compat:
|
|
289
|
+
// - setOnRetenoNotificationClickedListener(listener)
|
|
290
|
+
// - setOnRetenoNotificationClickedListener(reteno, listener) (legacy)
|
|
291
|
+
const listener = typeof arg0 === 'function' ? arg0 : arg1;
|
|
292
|
+
if (typeof listener !== 'function') return;
|
|
293
|
+
document.addEventListener('reteno-notification-clicked', listener);
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
removeOnRetenoPushReceivedListener: function (listener) {
|
|
297
|
+
if (typeof listener !== 'function') return;
|
|
298
|
+
document.removeEventListener('reteno-push-received', listener);
|
|
299
|
+
},
|
|
300
|
+
|
|
301
|
+
removeOnRetenoNotificationClickedListener: function (listener) {
|
|
302
|
+
if (typeof listener !== 'function') return;
|
|
303
|
+
document.removeEventListener('reteno-notification-clicked', listener);
|
|
304
|
+
},
|
|
305
|
+
|
|
306
|
+
setOnInAppMessageCustomDataReceivedListener: function (arg0, arg1) {
|
|
307
|
+
// Back-compat:
|
|
308
|
+
// - setOnInAppMessageCustomDataReceivedListener(listener)
|
|
309
|
+
// - setOnInAppMessageCustomDataReceivedListener(reteno, listener) (legacy)
|
|
310
|
+
const listener = typeof arg0 === 'function' ? arg0 : arg1;
|
|
311
|
+
if (typeof listener !== 'function') return;
|
|
312
|
+
document.addEventListener('reteno-in-app-custom-data', listener);
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
removeOnInAppMessageCustomDataReceivedListener: function (arg0, arg1) {
|
|
316
|
+
const listener = typeof arg0 === 'function' ? arg0 : arg1;
|
|
317
|
+
if (typeof listener !== 'function') return;
|
|
318
|
+
document.removeEventListener('reteno-in-app-custom-data', listener);
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
// Push notification dismissed (swiped away)
|
|
322
|
+
setOnRetenoPushDismissedListener: function (arg0, arg1) {
|
|
323
|
+
const listener = typeof arg0 === 'function' ? arg0 : arg1;
|
|
324
|
+
if (typeof listener !== 'function') return;
|
|
325
|
+
document.addEventListener('reteno-push-dismissed', listener);
|
|
326
|
+
},
|
|
327
|
+
|
|
328
|
+
removeOnRetenoPushDismissedListener: function (listener) {
|
|
329
|
+
if (typeof listener !== 'function') return;
|
|
330
|
+
document.removeEventListener('reteno-push-dismissed', listener);
|
|
331
|
+
},
|
|
332
|
+
|
|
333
|
+
// Custom push notification received
|
|
334
|
+
setOnRetenoCustomPushReceivedListener: function (arg0, arg1) {
|
|
335
|
+
const listener = typeof arg0 === 'function' ? arg0 : arg1;
|
|
336
|
+
if (typeof listener !== 'function') return;
|
|
337
|
+
document.addEventListener('reteno-custom-push-received', listener);
|
|
338
|
+
},
|
|
339
|
+
|
|
340
|
+
removeOnRetenoCustomPushReceivedListener: function (listener) {
|
|
341
|
+
if (typeof listener !== 'function') return;
|
|
342
|
+
document.removeEventListener('reteno-custom-push-received', listener);
|
|
343
|
+
},
|
|
344
|
+
|
|
345
|
+
// Push notification action button clicked (iOS & Android)
|
|
346
|
+
setOnRetenoPushButtonClickedListener: function (arg0, arg1) {
|
|
347
|
+
const listener = typeof arg0 === 'function' ? arg0 : arg1;
|
|
348
|
+
if (typeof listener !== 'function') return;
|
|
349
|
+
document.addEventListener('reteno-push-button-clicked', listener);
|
|
350
|
+
},
|
|
351
|
+
|
|
352
|
+
removeOnRetenoPushButtonClickedListener: function (listener) {
|
|
353
|
+
if (typeof listener !== 'function') return;
|
|
354
|
+
document.removeEventListener('reteno-push-button-clicked', listener);
|
|
355
|
+
},
|
|
356
|
+
|
|
357
|
+
/*
|
|
357
358
|
payload: boolean | { enabled?: boolean, emitEvent?: boolean }
|
|
358
359
|
iOS: the native handler is installed when both `enabled` (default: true)
|
|
359
360
|
and `emitEvent` are true. So both { enabled: true, emitEvent: true }
|
|
@@ -364,159 +365,205 @@ const RetenoPluginFunctions = {
|
|
|
364
365
|
Android: no-op — action button clicks are automatically detected
|
|
365
366
|
from the notification-clicked bundle.
|
|
366
367
|
*/
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
368
|
+
setNotificationActionHandler: function (arg0, success, error) {
|
|
369
|
+
return __callWithExec('setNotificationActionHandler', [arg0], success, error);
|
|
370
|
+
},
|
|
371
|
+
|
|
372
|
+
setOnInAppLifecycleCallback: function (arg0, arg1) {
|
|
373
|
+
const listener = typeof arg0 === 'function' ? arg0 : arg1;
|
|
374
|
+
if (arg0 === null || listener === null) {
|
|
375
|
+
return __callWithAutoInit('setInAppLifecycleCallback', [null]);
|
|
376
|
+
}
|
|
377
|
+
if (typeof listener !== 'function') {
|
|
378
|
+
return Promise.reject(new Error('setOnInAppLifecycleCallback: expected a function or null'));
|
|
379
|
+
}
|
|
380
|
+
document.addEventListener('reteno-in-app-lifecycle', listener);
|
|
381
|
+
return __callWithAutoInit('setInAppLifecycleCallback', []);
|
|
382
|
+
},
|
|
383
|
+
|
|
384
|
+
/*
|
|
384
385
|
deviceToken: string
|
|
385
386
|
*/
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
387
|
+
setDeviceToken: function (arg0, success, error) {
|
|
388
|
+
return __callWithAutoInit('setDeviceToken', [arg0], success, error);
|
|
389
|
+
},
|
|
389
390
|
|
|
390
|
-
|
|
391
|
+
/*
|
|
391
392
|
options: LifecycleTrackingOptions
|
|
392
393
|
*/
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
394
|
+
setLifecycleTrackingOptions: function (arg0, success, error) {
|
|
395
|
+
// Accept either `options` or legacy `[options]`.
|
|
396
|
+
const options = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
397
|
+
if (!options) {
|
|
398
|
+
return Promise.reject(new Error('Missing argument: options'));
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (__isIosPlatform()) {
|
|
402
|
+
let p;
|
|
403
|
+
if (__retenoState.initialized || __retenoState.initPromise) {
|
|
404
|
+
p = Promise.reject(
|
|
405
|
+
new Error(
|
|
406
|
+
'iOS supports lifecycleTrackingOptions only during init(...) before SDK initialization.'
|
|
407
|
+
)
|
|
408
|
+
);
|
|
409
|
+
} else {
|
|
410
|
+
__retenoState.pendingInitOptions = Object.assign({}, __retenoState.pendingInitOptions, {
|
|
411
|
+
lifecycleTrackingOptions: options,
|
|
412
|
+
});
|
|
413
|
+
p = Promise.resolve(1);
|
|
398
414
|
}
|
|
399
415
|
|
|
400
|
-
if (
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
);
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
lifecycleTrackingOptions: options,
|
|
409
|
-
});
|
|
410
|
-
p = Promise.resolve(1);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
if (__isFn(success) || __isFn(error)) {
|
|
414
|
-
p.then(function (res) {
|
|
415
|
-
if (__isFn(success)) success(res);
|
|
416
|
-
return res;
|
|
417
|
-
}).catch(function (err) {
|
|
418
|
-
if (__isFn(error)) error(err);
|
|
419
|
-
throw err;
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
return p;
|
|
416
|
+
if (__isFn(success) || __isFn(error)) {
|
|
417
|
+
p.then(function (res) {
|
|
418
|
+
if (__isFn(success)) success(res);
|
|
419
|
+
return res;
|
|
420
|
+
}).catch(function (err) {
|
|
421
|
+
if (__isFn(error)) error(err);
|
|
422
|
+
throw err;
|
|
423
|
+
});
|
|
423
424
|
}
|
|
425
|
+
return p;
|
|
426
|
+
}
|
|
424
427
|
|
|
425
|
-
|
|
426
|
-
|
|
428
|
+
return __callWithAutoInit('setLifecycleTrackingOptions', [options], success, error);
|
|
429
|
+
},
|
|
427
430
|
|
|
428
|
-
|
|
431
|
+
/*
|
|
429
432
|
screenName: string
|
|
430
433
|
*/
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
434
|
+
logScreenView: function (arg0, success, error) {
|
|
435
|
+
if (!arg0) {
|
|
436
|
+
return Promise.reject(new Error('Missing argument: screenName'));
|
|
437
|
+
}
|
|
438
|
+
return __callWithAutoInit('logScreenView', [arg0], success, error);
|
|
439
|
+
},
|
|
440
|
+
|
|
441
|
+
forcePushData: function (success, error) {
|
|
442
|
+
if (__isIosPlatform()) {
|
|
443
|
+
return __callWithAutoInit(
|
|
444
|
+
'logEvent',
|
|
445
|
+
[
|
|
446
|
+
{
|
|
447
|
+
eventName: '__cordova_force_push_data__',
|
|
448
|
+
parameters: [],
|
|
449
|
+
forcePush: true,
|
|
450
|
+
},
|
|
451
|
+
],
|
|
452
|
+
success,
|
|
453
|
+
error
|
|
454
|
+
);
|
|
455
|
+
}
|
|
456
|
+
return __callWithAutoInit('forcePushData', [], success, error);
|
|
457
|
+
},
|
|
458
|
+
|
|
459
|
+
/*
|
|
457
460
|
isPaused: boolean
|
|
458
461
|
*/
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
462
|
+
pauseInAppMessages: function (arg0, success, error) {
|
|
463
|
+
const isPaused = !!arg0;
|
|
464
|
+
return __callWithAutoInit('pauseInAppMessages', [isPaused], success, error);
|
|
465
|
+
},
|
|
463
466
|
|
|
464
|
-
|
|
467
|
+
/*
|
|
465
468
|
behaviour: 'SKIP_IN_APPS' | 'POSTPONE_IN_APPS'
|
|
466
469
|
*/
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
470
|
+
setInAppMessagesPauseBehaviour: function (arg0, success, error) {
|
|
471
|
+
if (!arg0 || typeof arg0 !== 'string') {
|
|
472
|
+
return Promise.reject(
|
|
473
|
+
new Error("Missing argument: behaviour ('SKIP_IN_APPS' or 'POSTPONE_IN_APPS')")
|
|
474
|
+
);
|
|
475
|
+
}
|
|
476
|
+
return __callWithAutoInit('setInAppMessagesPauseBehaviour', [arg0], success, error);
|
|
477
|
+
},
|
|
478
|
+
|
|
479
|
+
requestNotificationPermission: function (success, error) {
|
|
480
|
+
return __callWithAutoInit('requestNotificationPermission', [], success, error);
|
|
481
|
+
},
|
|
482
|
+
|
|
483
|
+
/*
|
|
479
484
|
options: string[] | { options?: string[], presentationOptions?: string[], emitEvent?: boolean }
|
|
480
485
|
Passing null removes the handler.
|
|
481
486
|
Supported options: "badge", "sound", "alert", "banner", "list"
|
|
482
487
|
If emitEvent is true, the plugin will emit "reteno-push-received".
|
|
483
488
|
*/
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
489
|
+
setWillPresentNotificationOptions: function (arg0, success, error) {
|
|
490
|
+
return __callWithExec('setWillPresentNotificationOptions', [arg0], success, error);
|
|
491
|
+
},
|
|
487
492
|
|
|
488
|
-
|
|
493
|
+
/*
|
|
489
494
|
payload: boolean | { enabled?: boolean, emitEvent?: boolean }
|
|
490
495
|
If emitEvent is true, the plugin will emit "reteno-notification-clicked".
|
|
491
496
|
Passing false or null removes the handler.
|
|
492
497
|
*/
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
498
|
+
setDidReceiveNotificationResponseHandler: function (arg0, success, error) {
|
|
499
|
+
return __callWithExec('setDidReceiveNotificationResponseHandler', [arg0], success, error);
|
|
500
|
+
},
|
|
496
501
|
|
|
497
|
-
|
|
502
|
+
/*
|
|
498
503
|
config: NotificationChannelConfig
|
|
499
504
|
{
|
|
500
505
|
name: string,
|
|
501
506
|
description: string
|
|
502
507
|
}
|
|
503
508
|
*/
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
509
|
+
updateDefaultNotificationChannel: function (arg0, success, error) {
|
|
510
|
+
// Accept either `config` or legacy `[config]`.
|
|
511
|
+
const config = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
512
|
+
if (!config || typeof config !== 'object') {
|
|
513
|
+
return Promise.reject(new Error('Missing argument: config'));
|
|
514
|
+
}
|
|
515
|
+
if (!config.name || typeof config.name !== 'string' || config.name.trim().length === 0) {
|
|
516
|
+
return Promise.reject(new Error('Missing argument: name'));
|
|
517
|
+
}
|
|
518
|
+
if (
|
|
519
|
+
!config.description ||
|
|
520
|
+
typeof config.description !== 'string' ||
|
|
521
|
+
config.description.trim().length === 0
|
|
522
|
+
) {
|
|
523
|
+
return Promise.reject(new Error('Missing argument: description'));
|
|
524
|
+
}
|
|
525
|
+
return __callWithAutoInit('updateDefaultNotificationChannel', [config], success, error);
|
|
526
|
+
},
|
|
527
|
+
|
|
528
|
+
/*
|
|
529
|
+
config: NotificationGroupingRule | null
|
|
530
|
+
{ payloadKey: string } groups by a value from the push payload.
|
|
531
|
+
{ groupId: string } assigns every Reteno notification to a constant group.
|
|
532
|
+
Set showSummary: true to let the plugin maintain a group-summary notification.
|
|
533
|
+
Passing null disables grouping.
|
|
534
|
+
Android only.
|
|
535
|
+
*/
|
|
536
|
+
setNotificationGroupingRule: function (arg0, success, error) {
|
|
537
|
+
// Accept either `config` or legacy `[config]`.
|
|
538
|
+
const config = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
539
|
+
if (config === null) {
|
|
540
|
+
return __callWithExec('setNotificationGroupingRule', [null], success, error);
|
|
541
|
+
}
|
|
542
|
+
if (!config || typeof config !== 'object') {
|
|
543
|
+
return Promise.reject(
|
|
544
|
+
new Error('Invalid argument: expected null or an object with payloadKey or groupId')
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
const payloadKey = typeof config.payloadKey === 'string' ? config.payloadKey.trim() : '';
|
|
549
|
+
const groupId = typeof config.groupId === 'string' ? config.groupId.trim() : '';
|
|
550
|
+
if (config.showSummary !== undefined && typeof config.showSummary !== 'boolean') {
|
|
551
|
+
return Promise.reject(new Error('Invalid argument: showSummary must be a boolean'));
|
|
552
|
+
}
|
|
553
|
+
if (!!payloadKey === !!groupId) {
|
|
554
|
+
return Promise.reject(
|
|
555
|
+
new Error('Invalid argument: provide exactly one of payloadKey or groupId')
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
const normalizedConfig = payloadKey ? { payloadKey } : { groupId };
|
|
560
|
+
if (config.showSummary === true) {
|
|
561
|
+
normalizedConfig.showSummary = true;
|
|
562
|
+
}
|
|
563
|
+
return __callWithExec('setNotificationGroupingRule', [normalizedConfig], success, error);
|
|
564
|
+
},
|
|
565
|
+
|
|
566
|
+
/*
|
|
520
567
|
payload: GetAppInboxMessagesPayload
|
|
521
568
|
{
|
|
522
569
|
page: number,
|
|
@@ -524,94 +571,94 @@ const RetenoPluginFunctions = {
|
|
|
524
571
|
status?: 'OPENED' | 'UNOPENED'
|
|
525
572
|
}
|
|
526
573
|
*/
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
574
|
+
getAppInboxMessages: function (arg0, success, error) {
|
|
575
|
+
// Accept either `payload` or legacy `[payload]`.
|
|
576
|
+
const payload = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
577
|
+
if (!payload || typeof payload !== 'object') {
|
|
578
|
+
return Promise.reject(new Error('Missing argument: payload'));
|
|
579
|
+
}
|
|
580
|
+
if (payload.page == null) {
|
|
581
|
+
return Promise.reject(new Error('Missing argument: page'));
|
|
582
|
+
}
|
|
583
|
+
if (payload.pageSize == null) {
|
|
584
|
+
return Promise.reject(new Error('Missing argument: pageSize'));
|
|
585
|
+
}
|
|
586
|
+
return __callWithAutoInit('getAppInboxMessages', [payload], success, error);
|
|
587
|
+
},
|
|
588
|
+
|
|
589
|
+
getAppInboxMessagesCount: function (success, error) {
|
|
590
|
+
return __callWithAutoInit('getAppInboxMessagesCount', [], success, error);
|
|
591
|
+
},
|
|
592
|
+
|
|
593
|
+
subscribeOnMessagesCountChanged: function (arg0, arg1) {
|
|
594
|
+
const success = typeof arg0 === 'function' ? arg0 : arg1;
|
|
595
|
+
const error = typeof arg0 === 'function' ? arg1 : undefined;
|
|
596
|
+
return __ensureInit().then(function () {
|
|
597
|
+
exec(success, error, PLUGIN_NAME, 'subscribeOnMessagesCountChanged', []);
|
|
598
|
+
return 1;
|
|
599
|
+
});
|
|
600
|
+
},
|
|
554
601
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
602
|
+
unsubscribeMessagesCountChanged: function (success, error) {
|
|
603
|
+
return __callWithAutoInit('unsubscribeMessagesCountChanged', [], success, error);
|
|
604
|
+
},
|
|
558
605
|
|
|
559
|
-
|
|
606
|
+
/*
|
|
560
607
|
messageId: string
|
|
561
608
|
*/
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
609
|
+
markAsOpened: function (arg0, success, error) {
|
|
610
|
+
// Accept either `messageId` or legacy `[messageId]`.
|
|
611
|
+
const messageId = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
612
|
+
if (!messageId || typeof messageId !== 'string' || messageId.trim().length === 0) {
|
|
613
|
+
return Promise.reject(new Error('Missing argument: messageId'));
|
|
614
|
+
}
|
|
615
|
+
return __callWithAutoInit('markAsOpened', [messageId], success, error);
|
|
616
|
+
},
|
|
617
|
+
|
|
618
|
+
markAllMessagesAsOpened: function (success, error) {
|
|
619
|
+
return __callWithAutoInit('markAllMessagesAsOpened', [], success, error);
|
|
620
|
+
},
|
|
621
|
+
|
|
622
|
+
/*
|
|
576
623
|
payload: GetRecommendationsPayload
|
|
577
624
|
*/
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
625
|
+
getRecommendations: function (arg0, success, error) {
|
|
626
|
+
// Accept either `payload` or legacy `[payload]`.
|
|
627
|
+
const payload = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
628
|
+
if (!payload || typeof payload !== 'object') {
|
|
629
|
+
return Promise.reject(new Error('Missing argument: payload'));
|
|
630
|
+
}
|
|
631
|
+
if (
|
|
632
|
+
!payload.recomVariantId ||
|
|
633
|
+
typeof payload.recomVariantId !== 'string' ||
|
|
634
|
+
payload.recomVariantId.trim().length === 0
|
|
635
|
+
) {
|
|
636
|
+
return Promise.reject(new Error('Missing argument: recomVariantId'));
|
|
637
|
+
}
|
|
638
|
+
return __callWithAutoInit('getRecommendations', [payload], success, error);
|
|
639
|
+
},
|
|
640
|
+
|
|
641
|
+
/*
|
|
595
642
|
payload: LogRecommendationsPayload
|
|
596
643
|
*/
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
644
|
+
logRecommendations: function (arg0, success, error) {
|
|
645
|
+
// Accept either `payload` or legacy `[payload]`.
|
|
646
|
+
const payload = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
647
|
+
if (!payload || typeof payload !== 'object') {
|
|
648
|
+
return Promise.reject(new Error('Missing argument: payload'));
|
|
649
|
+
}
|
|
650
|
+
if (
|
|
651
|
+
!payload.recomVariantId ||
|
|
652
|
+
typeof payload.recomVariantId !== 'string' ||
|
|
653
|
+
payload.recomVariantId.trim().length === 0
|
|
654
|
+
) {
|
|
655
|
+
return Promise.reject(new Error('Missing argument: recomVariantId'));
|
|
656
|
+
}
|
|
657
|
+
if (!Array.isArray(payload.recomEvents) || payload.recomEvents.length === 0) {
|
|
658
|
+
return Promise.reject(new Error('Missing argument: recomEvents'));
|
|
659
|
+
}
|
|
660
|
+
return __callWithAutoInit('logRecommendations', [payload], success, error);
|
|
661
|
+
},
|
|
662
|
+
};
|
|
616
663
|
|
|
617
664
|
module.exports = RetenoPluginFunctions;
|