cordova-plugin-reteno 2.0.1 → 2.0.3
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 +17 -4
- package/docs/api.md +1 -1
- package/docs/ios.md +4 -4
- package/package.json +6 -3
- package/plugin.xml +2 -2
- package/src/android/app/build.gradle +1 -1
- package/src/android/app/src/main/java/com/reteno/plugin/RetenoPlugin.java +1 -1
- package/src/android/reteno.gradle +1 -1
- package/types/index.ts +2 -0
- package/www/cordova-plugin-reteno.js +32 -32
package/README.md
CHANGED
|
@@ -4,12 +4,25 @@ Reteno SDK for Cordova and Capacitor apps.
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install cordova-plugin-reteno
|
|
9
|
+
```
|
|
9
10
|
|
|
10
|
-
##
|
|
11
|
+
## Documentation
|
|
11
12
|
|
|
12
|
-
- [
|
|
13
|
+
- [Cordova SDK Overview](https://docs.reteno.com/reference/cordova-sdk-setup)
|
|
14
|
+
- [Ionic SDK Overview](https://docs.reteno.com/reference/ionic-sdk)
|
|
15
|
+
|
|
16
|
+
### Setup Guides
|
|
17
|
+
|
|
18
|
+
- [Cordova iOS SDK Setup](https://docs.reteno.com/reference/cordova-ios-sdk-setup)
|
|
19
|
+
- [Cordova Android SDK Setup](https://docs.reteno.com/reference/cordova-android-sdk-setup)
|
|
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)
|
|
22
|
+
|
|
23
|
+
### Additional
|
|
24
|
+
|
|
25
|
+
- [Release Notes](https://github.com/reteno-com/cordova-plugin-reteno/releases)
|
|
13
26
|
|
|
14
27
|
## License
|
|
15
28
|
|
package/docs/api.md
CHANGED
|
@@ -485,7 +485,7 @@ Subscribe to push received events while the app is running.
|
|
|
485
485
|
|
|
486
486
|
Notes:
|
|
487
487
|
|
|
488
|
-
- On Android this is based on the SDK 2.9.
|
|
488
|
+
- On Android this is based on the SDK 2.9.2 `EventListener` / `Procedure` API (`RetenoNotifications.getReceived()`).
|
|
489
489
|
- This listener is not a replacement for `getInitialNotification()` (cold start): if the app was launched by tapping a notification, use `getInitialNotification()`.
|
|
490
490
|
|
|
491
491
|
```js
|
package/docs/ios.md
CHANGED
|
@@ -68,12 +68,12 @@ target 'App' do
|
|
|
68
68
|
|
|
69
69
|
target 'NotificationServiceExtension' do
|
|
70
70
|
inherit! :search_paths
|
|
71
|
-
pod 'Reteno', '2.6.
|
|
71
|
+
pod 'Reteno', '2.6.2'
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
target 'NotificationContentExtension' do
|
|
75
75
|
inherit! :search_paths
|
|
76
|
-
pod 'Reteno', '2.6.
|
|
76
|
+
pod 'Reteno', '2.6.2'
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
79
|
```
|
|
@@ -187,12 +187,12 @@ target 'App' do
|
|
|
187
187
|
|
|
188
188
|
target 'NotificationServiceExtension' do
|
|
189
189
|
inherit! :search_paths
|
|
190
|
-
pod 'Reteno', '2.6.
|
|
190
|
+
pod 'Reteno', '2.6.2'
|
|
191
191
|
end
|
|
192
192
|
|
|
193
193
|
target 'NotificationContentExtension' do
|
|
194
194
|
inherit! :search_paths
|
|
195
|
-
pod 'Reteno', '2.6.
|
|
195
|
+
pod 'Reteno', '2.6.2'
|
|
196
196
|
end
|
|
197
197
|
end
|
|
198
198
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cordova-plugin-reteno",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "The Reteno Cordova Plugin for Mobile Customer Engagement and Analytics solutions",
|
|
5
5
|
"types": "./types/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
"LICENSE*"
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
|
+
"test": "jest --coverage",
|
|
27
|
+
"test:watch": "jest --watch",
|
|
26
28
|
"lint": "eslint \"www/**/*.js\"",
|
|
27
29
|
"lint:fix": "eslint --fix \"www/**/*.js\"",
|
|
28
30
|
"format": "prettier --write \"{www,types,docs}/**/*.{js,ts,md,json,xml}\"",
|
|
@@ -39,7 +41,7 @@
|
|
|
39
41
|
},
|
|
40
42
|
"keywords": [
|
|
41
43
|
"ecosystem:cordova",
|
|
42
|
-
"cordova-android",
|
|
44
|
+
"cordova-android",
|
|
43
45
|
"cordova-ios"
|
|
44
46
|
],
|
|
45
47
|
"author": "mobile-sdk@reteno.com",
|
|
@@ -49,11 +51,12 @@
|
|
|
49
51
|
},
|
|
50
52
|
"homepage": "https://github.com/reteno-com/cordova-plugin-reteno#readme",
|
|
51
53
|
"license": "MIT",
|
|
52
|
-
"dependencies": {},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@cordova/eslint-config": "^5.0.0",
|
|
55
56
|
"eslint": "^8.57.1",
|
|
56
57
|
"eslint-config-prettier": "^9.1.0",
|
|
58
|
+
"jest": "^30.3.0",
|
|
59
|
+
"jest-environment-jsdom": "^30.3.0",
|
|
57
60
|
"prettier": "^3.4.2",
|
|
58
61
|
"typescript": "^5.7.3"
|
|
59
62
|
}
|
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<plugin id="cordova-plugin-reteno" version="2.0.
|
|
2
|
+
<plugin id="cordova-plugin-reteno" version="2.0.3" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
|
|
3
3
|
<name>cordova-plugin-reteno</name>
|
|
4
4
|
<engines>
|
|
5
5
|
<engine name="cordova-android" version=">=12.0.0" />
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
|
|
59
59
|
<podspec>
|
|
60
60
|
<pods>
|
|
61
|
-
<pod name="Reteno" spec="2.6.
|
|
61
|
+
<pod name="Reteno" spec="2.6.2" />
|
|
62
62
|
<pod name="FirebaseMessaging" />
|
|
63
63
|
</pods>
|
|
64
64
|
</podspec>
|
|
@@ -601,7 +601,7 @@ public class RetenoPlugin extends CordovaPlugin {
|
|
|
601
601
|
}
|
|
602
602
|
|
|
603
603
|
/**
|
|
604
|
-
* Register notification event listeners using the SDK 2.9.
|
|
604
|
+
* Register notification event listeners using the SDK 2.9.2 EventListener API.
|
|
605
605
|
* Each listener is a direct {@link Procedure} implementation — no reflection needed.
|
|
606
606
|
*/
|
|
607
607
|
private void registerNotificationListeners() {
|
package/types/index.ts
CHANGED
|
@@ -55,6 +55,8 @@ export type LogEventPayload = {
|
|
|
55
55
|
date?: string | null;
|
|
56
56
|
/** Optional list of parameters */
|
|
57
57
|
parameters?: CustomEventParameter[] | null;
|
|
58
|
+
/** When true the event is sent to Reteno immediately (iOS only) */
|
|
59
|
+
forcePush?: boolean;
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
export type RequestNotificationPermissionResult = 0 | 1;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
const exec = require('cordova/exec');
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const PLUGIN_NAME = 'RetenoPlugin';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
const __retenoState = {
|
|
6
6
|
initialized: false,
|
|
7
7
|
initPromise: null,
|
|
8
8
|
pendingInitOptions: {},
|
|
@@ -23,7 +23,7 @@ function __promiseExec(action, args) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
function __callWithExec(action, args, success, error) {
|
|
26
|
-
|
|
26
|
+
const p = __promiseExec(action, args);
|
|
27
27
|
if (__isFn(success) || __isFn(error)) {
|
|
28
28
|
p.then(function (res) {
|
|
29
29
|
if (__isFn(success)) success(res);
|
|
@@ -45,8 +45,8 @@ function __ensureInit(options) {
|
|
|
45
45
|
return __retenoState.initPromise;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
const pendingOptions = __retenoState.pendingInitOptions || {};
|
|
49
|
+
const opts = Object.assign({}, pendingOptions, options || {});
|
|
50
50
|
__retenoState.initPromise = __promiseExec('initialize', [opts])
|
|
51
51
|
.then(function (res) {
|
|
52
52
|
__retenoState.initialized = true;
|
|
@@ -64,7 +64,7 @@ function __ensureInit(options) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
function __callWithAutoInit(action, args, success, error) {
|
|
67
|
-
|
|
67
|
+
const p = __ensureInit().then(function () {
|
|
68
68
|
return __promiseExec(action, args);
|
|
69
69
|
});
|
|
70
70
|
if (__isFn(success) || __isFn(error)) {
|
|
@@ -134,7 +134,7 @@ var urlutil = require('cordova/urlutil');
|
|
|
134
134
|
})();
|
|
135
135
|
*/
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
const RetenoPluginFunctions = {
|
|
138
138
|
/*
|
|
139
139
|
options: {
|
|
140
140
|
accessKey?: string,
|
|
@@ -154,8 +154,8 @@ var RetenoPluginFunctions = {
|
|
|
154
154
|
arg0 = {};
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
const options = arg0 || {};
|
|
158
|
+
const p = __ensureInit(options);
|
|
159
159
|
if (__isFn(success) || __isFn(error)) {
|
|
160
160
|
p.then(function (res) {
|
|
161
161
|
if (__isFn(success)) success(res);
|
|
@@ -185,7 +185,7 @@ var RetenoPluginFunctions = {
|
|
|
185
185
|
*/
|
|
186
186
|
logEcommerceEvent: function (arg0, success, error) {
|
|
187
187
|
// Accept either `payload` or legacy `[payload]`.
|
|
188
|
-
|
|
188
|
+
const payload = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
189
189
|
if (!payload || typeof payload !== 'object') {
|
|
190
190
|
return Promise.reject(new Error('Missing argument: payload'));
|
|
191
191
|
}
|
|
@@ -200,7 +200,7 @@ var RetenoPluginFunctions = {
|
|
|
200
200
|
*/
|
|
201
201
|
setUserAttributes: function (arg0, success, error) {
|
|
202
202
|
// Accept either `payload` or legacy `[payload]`.
|
|
203
|
-
|
|
203
|
+
const payload = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
204
204
|
if (
|
|
205
205
|
!payload ||
|
|
206
206
|
!payload.externalUserId ||
|
|
@@ -216,7 +216,7 @@ var RetenoPluginFunctions = {
|
|
|
216
216
|
*/
|
|
217
217
|
setAnonymousUserAttributes: function (arg0, success, error) {
|
|
218
218
|
// Accept either `payload` or legacy `[payload]`.
|
|
219
|
-
|
|
219
|
+
const payload = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
220
220
|
if (!payload || typeof payload !== 'object') {
|
|
221
221
|
return Promise.reject(new Error('Missing argument: payload'));
|
|
222
222
|
}
|
|
@@ -247,7 +247,7 @@ var RetenoPluginFunctions = {
|
|
|
247
247
|
*/
|
|
248
248
|
setMultiAccountUserAttributes: function (arg0, success, error) {
|
|
249
249
|
// Accept either `payload` or legacy `[payload]`.
|
|
250
|
-
|
|
250
|
+
const payload = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
251
251
|
if (
|
|
252
252
|
!payload ||
|
|
253
253
|
!payload.externalUserId ||
|
|
@@ -270,7 +270,7 @@ var RetenoPluginFunctions = {
|
|
|
270
270
|
// Back-compat:
|
|
271
271
|
// - setOnRetenoPushReceivedListener(listener)
|
|
272
272
|
// - setOnRetenoPushReceivedListener(reteno, listener) (legacy)
|
|
273
|
-
|
|
273
|
+
const listener = typeof arg0 === 'function' ? arg0 : arg1;
|
|
274
274
|
if (typeof listener !== 'function') return;
|
|
275
275
|
document.addEventListener('reteno-push-received', listener);
|
|
276
276
|
},
|
|
@@ -279,7 +279,7 @@ var RetenoPluginFunctions = {
|
|
|
279
279
|
// Back-compat:
|
|
280
280
|
// - setOnRetenoNotificationClickedListener(listener)
|
|
281
281
|
// - setOnRetenoNotificationClickedListener(reteno, listener) (legacy)
|
|
282
|
-
|
|
282
|
+
const listener = typeof arg0 === 'function' ? arg0 : arg1;
|
|
283
283
|
if (typeof listener !== 'function') return;
|
|
284
284
|
document.addEventListener('reteno-notification-clicked', listener);
|
|
285
285
|
},
|
|
@@ -298,20 +298,20 @@ var RetenoPluginFunctions = {
|
|
|
298
298
|
// Back-compat:
|
|
299
299
|
// - setOnInAppMessageCustomDataReceivedListener(listener)
|
|
300
300
|
// - setOnInAppMessageCustomDataReceivedListener(reteno, listener) (legacy)
|
|
301
|
-
|
|
301
|
+
const listener = typeof arg0 === 'function' ? arg0 : arg1;
|
|
302
302
|
if (typeof listener !== 'function') return;
|
|
303
303
|
document.addEventListener('reteno-in-app-custom-data', listener);
|
|
304
304
|
},
|
|
305
305
|
|
|
306
306
|
removeOnInAppMessageCustomDataReceivedListener: function (arg0, arg1) {
|
|
307
|
-
|
|
307
|
+
const listener = typeof arg0 === 'function' ? arg0 : arg1;
|
|
308
308
|
if (typeof listener !== 'function') return;
|
|
309
309
|
document.removeEventListener('reteno-in-app-custom-data', listener);
|
|
310
310
|
},
|
|
311
311
|
|
|
312
312
|
// Push notification dismissed (swiped away)
|
|
313
313
|
setOnRetenoPushDismissedListener: function (arg0, arg1) {
|
|
314
|
-
|
|
314
|
+
const listener = typeof arg0 === 'function' ? arg0 : arg1;
|
|
315
315
|
if (typeof listener !== 'function') return;
|
|
316
316
|
document.addEventListener('reteno-push-dismissed', listener);
|
|
317
317
|
},
|
|
@@ -323,7 +323,7 @@ var RetenoPluginFunctions = {
|
|
|
323
323
|
|
|
324
324
|
// Custom push notification received
|
|
325
325
|
setOnRetenoCustomPushReceivedListener: function (arg0, arg1) {
|
|
326
|
-
|
|
326
|
+
const listener = typeof arg0 === 'function' ? arg0 : arg1;
|
|
327
327
|
if (typeof listener !== 'function') return;
|
|
328
328
|
document.addEventListener('reteno-custom-push-received', listener);
|
|
329
329
|
},
|
|
@@ -335,7 +335,7 @@ var RetenoPluginFunctions = {
|
|
|
335
335
|
|
|
336
336
|
// Push notification action button clicked (iOS & Android)
|
|
337
337
|
setOnRetenoPushButtonClickedListener: function (arg0, arg1) {
|
|
338
|
-
|
|
338
|
+
const listener = typeof arg0 === 'function' ? arg0 : arg1;
|
|
339
339
|
if (typeof listener !== 'function') return;
|
|
340
340
|
document.addEventListener('reteno-push-button-clicked', listener);
|
|
341
341
|
},
|
|
@@ -361,7 +361,7 @@ var RetenoPluginFunctions = {
|
|
|
361
361
|
},
|
|
362
362
|
|
|
363
363
|
setOnInAppLifecycleCallback: function (arg0, arg1) {
|
|
364
|
-
|
|
364
|
+
const listener = typeof arg0 === 'function' ? arg0 : arg1;
|
|
365
365
|
if (arg0 === null || listener === null) {
|
|
366
366
|
return __callWithAutoInit('setInAppLifecycleCallback', [null]);
|
|
367
367
|
}
|
|
@@ -384,13 +384,13 @@ var RetenoPluginFunctions = {
|
|
|
384
384
|
*/
|
|
385
385
|
setLifecycleTrackingOptions: function (arg0, success, error) {
|
|
386
386
|
// Accept either `options` or legacy `[options]`.
|
|
387
|
-
|
|
387
|
+
const options = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
388
388
|
if (!options) {
|
|
389
389
|
return Promise.reject(new Error('Missing argument: options'));
|
|
390
390
|
}
|
|
391
391
|
|
|
392
392
|
if (__isIosPlatform()) {
|
|
393
|
-
|
|
393
|
+
let p;
|
|
394
394
|
if (__retenoState.initialized || __retenoState.initPromise) {
|
|
395
395
|
p = Promise.reject(
|
|
396
396
|
new Error('iOS supports lifecycleTrackingOptions only during init(...) before SDK initialization.')
|
|
@@ -449,7 +449,7 @@ var RetenoPluginFunctions = {
|
|
|
449
449
|
isPaused: boolean
|
|
450
450
|
*/
|
|
451
451
|
pauseInAppMessages: function (arg0, success, error) {
|
|
452
|
-
|
|
452
|
+
const isPaused = !!arg0;
|
|
453
453
|
return __callWithAutoInit('pauseInAppMessages', [isPaused], success, error);
|
|
454
454
|
},
|
|
455
455
|
|
|
@@ -495,7 +495,7 @@ var RetenoPluginFunctions = {
|
|
|
495
495
|
*/
|
|
496
496
|
updateDefaultNotificationChannel: function (arg0, success, error) {
|
|
497
497
|
// Accept either `config` or legacy `[config]`.
|
|
498
|
-
|
|
498
|
+
const config = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
499
499
|
if (!config || typeof config !== 'object') {
|
|
500
500
|
return Promise.reject(new Error('Missing argument: config'));
|
|
501
501
|
}
|
|
@@ -518,7 +518,7 @@ var RetenoPluginFunctions = {
|
|
|
518
518
|
*/
|
|
519
519
|
getAppInboxMessages: function (arg0, success, error) {
|
|
520
520
|
// Accept either `payload` or legacy `[payload]`.
|
|
521
|
-
|
|
521
|
+
const payload = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
522
522
|
if (!payload || typeof payload !== 'object') {
|
|
523
523
|
return Promise.reject(new Error('Missing argument: payload'));
|
|
524
524
|
}
|
|
@@ -536,8 +536,8 @@ var RetenoPluginFunctions = {
|
|
|
536
536
|
},
|
|
537
537
|
|
|
538
538
|
subscribeOnMessagesCountChanged: function (arg0, arg1) {
|
|
539
|
-
|
|
540
|
-
|
|
539
|
+
const success = typeof arg0 === 'function' ? arg0 : arg1;
|
|
540
|
+
const error = typeof arg0 === 'function' ? arg1 : undefined;
|
|
541
541
|
return __ensureInit().then(function () {
|
|
542
542
|
exec(success, error, PLUGIN_NAME, 'subscribeOnMessagesCountChanged', []);
|
|
543
543
|
return 1;
|
|
@@ -553,7 +553,7 @@ var RetenoPluginFunctions = {
|
|
|
553
553
|
*/
|
|
554
554
|
markAsOpened: function (arg0, success, error) {
|
|
555
555
|
// Accept either `messageId` or legacy `[messageId]`.
|
|
556
|
-
|
|
556
|
+
const messageId = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
557
557
|
if (!messageId || typeof messageId !== 'string' || messageId.trim().length === 0) {
|
|
558
558
|
return Promise.reject(new Error('Missing argument: messageId'));
|
|
559
559
|
}
|
|
@@ -569,7 +569,7 @@ var RetenoPluginFunctions = {
|
|
|
569
569
|
*/
|
|
570
570
|
getRecommendations: function (arg0, success, error) {
|
|
571
571
|
// Accept either `payload` or legacy `[payload]`.
|
|
572
|
-
|
|
572
|
+
const payload = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
573
573
|
if (!payload || typeof payload !== 'object') {
|
|
574
574
|
return Promise.reject(new Error('Missing argument: payload'));
|
|
575
575
|
}
|
|
@@ -588,7 +588,7 @@ var RetenoPluginFunctions = {
|
|
|
588
588
|
*/
|
|
589
589
|
logRecommendations: function (arg0, success, error) {
|
|
590
590
|
// Accept either `payload` or legacy `[payload]`.
|
|
591
|
-
|
|
591
|
+
const payload = Array.isArray(arg0) ? arg0[0] : arg0;
|
|
592
592
|
if (!payload || typeof payload !== 'object') {
|
|
593
593
|
return Promise.reject(new Error('Missing argument: payload'));
|
|
594
594
|
}
|