cordova-plugin-insider 1.4.0 → 1.5.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/package.json +1 -1
- package/plugin.xml +5 -5
- package/src/android/InsiderPlugin.java +0 -3
- package/src/android/build-extras.gradle +4 -5
- package/src/ios/InsiderPlugin.h +1 -0
- package/src/ios/InsiderPlugin.m +16 -10
- package/www/CallbackType.js +1 -0
- package/www/Constants.js +1 -1
- package/www/Event.js +24 -7
- package/www/Identifier.js +16 -4
- package/www/InsiderPlugin.js +155 -21
- package/www/Product.js +69 -18
- package/www/User.js +99 -27
- package/www/Utils.js +7 -5
- package/.github/CODEOWNERS +0 -8
- package/.github/workflows/git-leak.yml +0 -25
- package/.github/workflows/insider-cordova-SDK_release.yml +0 -35
- package/.github/workflows/release_task_merger.yml +0 -22
- package/.github/workflows/release_version_setter.yml +0 -43
- package/release_version.sh +0 -37
- package/slack_notifier.sh +0 -20
package/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<plugin id="cordova-plugin-insider" version="1.
|
|
2
|
+
<plugin id="cordova-plugin-insider" version="1.5.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
3
|
<name>Insider</name>
|
|
4
4
|
<description>Insider Cordova Plugin</description>
|
|
5
5
|
<keywords>insider,cordova,cordova-ios,cordova-android</keywords>
|
|
@@ -28,9 +28,8 @@
|
|
|
28
28
|
<platform name="android">
|
|
29
29
|
<framework src="src/android/build-extras.gradle" custom="true" type="gradleReference" />
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
<hook type="before_plugin_uninstall" src="hooks/before_plugin_uninstall.js"/>
|
|
32
|
+
<hook type="after_plugin_install" src="hooks/after_plugin_install.js"/>
|
|
34
33
|
|
|
35
34
|
<config-file target="config.xml" parent="/*">
|
|
36
35
|
<preference name="GradlePluginGoogleServicesEnabled" value="true" />
|
|
@@ -71,7 +70,8 @@
|
|
|
71
70
|
<source url="https://cdn.cocoapods.org/" />
|
|
72
71
|
</config>
|
|
73
72
|
<pods use-frameworks="true">
|
|
74
|
-
<pod name="InsiderMobile" spec="12.
|
|
73
|
+
<pod name="InsiderMobile" spec="12.8.6" />
|
|
74
|
+
<pod name="InsiderGeofence" spec="1.0.3" />
|
|
75
75
|
<pod name="InsiderHybrid" spec="1.4.0" />
|
|
76
76
|
</pods>
|
|
77
77
|
</podspec>
|
|
@@ -87,7 +87,6 @@ public class InsiderPlugin extends CordovaPlugin {
|
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
Insider.Instance.handleHybridIntent();
|
|
91
90
|
Insider.Instance.storePartnerName(partnerName);
|
|
92
91
|
}
|
|
93
92
|
});
|
|
@@ -115,8 +114,6 @@ public class InsiderPlugin extends CordovaPlugin {
|
|
|
115
114
|
init(args.getString(0), args.getString(1));
|
|
116
115
|
} else if (action.equals("setGDPRConsent")) {
|
|
117
116
|
Insider.Instance.setGDPRConsent(Boolean.parseBoolean(args.getString(0)));
|
|
118
|
-
} else if (action.equals("enableIDFACollection")) {
|
|
119
|
-
Insider.Instance.enableIDFACollection(Boolean.parseBoolean(args.getString(0)));
|
|
120
117
|
} else if (action.equals("startTrackingGeofence")) {
|
|
121
118
|
cordova.getThreadPool().execute(new Runnable() {
|
|
122
119
|
@Override
|
|
@@ -11,15 +11,12 @@ android {
|
|
|
11
11
|
defaultConfig {
|
|
12
12
|
minSdkVersion 21
|
|
13
13
|
targetSdkVersion 31
|
|
14
|
-
versionCode 1
|
|
15
|
-
versionName "1.0"
|
|
16
|
-
manifestPlaceholders = [ partner: "partner_name" ]
|
|
17
14
|
multiDexEnabled true
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
17
|
|
|
21
18
|
dependencies {
|
|
22
|
-
implementation 'com.useinsider:insider:13.
|
|
19
|
+
implementation 'com.useinsider:insider:13.8.5'
|
|
23
20
|
implementation 'com.useinsider:insiderhybrid:1.1.6'
|
|
24
21
|
|
|
25
22
|
implementation 'com.fasterxml.jackson.core:jackson-core:2.12.4'
|
|
@@ -30,9 +27,11 @@ dependencies {
|
|
|
30
27
|
|
|
31
28
|
implementation 'com.google.android.gms:play-services-location:20.0.0'
|
|
32
29
|
implementation 'com.google.firebase:firebase-messaging:23.0.5'
|
|
33
|
-
implementation 'com.google.android.
|
|
30
|
+
implementation 'com.google.android.play:core-ktx:1.8.1'
|
|
34
31
|
|
|
35
32
|
implementation 'com.huawei.hms:push:6.5.0.300'
|
|
36
33
|
implementation 'com.huawei.hms:ads-identifier:3.4.39.302'
|
|
37
34
|
implementation 'com.huawei.hms:location:6.4.0.300'
|
|
35
|
+
|
|
36
|
+
implementation 'androidx.security:security-crypto:1.0.0'
|
|
38
37
|
}
|
package/src/ios/InsiderPlugin.h
CHANGED
package/src/ios/InsiderPlugin.m
CHANGED
|
@@ -62,41 +62,47 @@
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
-(void)registerCallback:(NSDictionary *)
|
|
65
|
+
-(void)registerCallback:(NSDictionary *)callbackDictionary {
|
|
66
66
|
@try {
|
|
67
|
-
if (!
|
|
67
|
+
if (!callbackDictionary || [callbackDictionary count] == 0)
|
|
68
68
|
return;
|
|
69
|
-
InsiderCallbackType type = (InsiderCallbackType)[[
|
|
70
|
-
NSString*
|
|
69
|
+
InsiderCallbackType type = (InsiderCallbackType)[[callbackDictionary objectForKey:@"type"] intValue];
|
|
70
|
+
NSString* callbackData = [InsiderHybrid dictToJson:callbackDictionary];
|
|
71
71
|
|
|
72
72
|
NSString *js;
|
|
73
73
|
switch (type) {
|
|
74
74
|
case InsiderCallbackTypeNotificationOpen:{
|
|
75
|
-
NSString * data = [NSString stringWithFormat:@"{""action"":'NOTIFICATION_OPEN',""result"":""%@""}",
|
|
75
|
+
NSString * data = [NSString stringWithFormat:@"{""action"":'NOTIFICATION_OPEN',""result"":""%@""}", callbackData];
|
|
76
76
|
js = [NSString stringWithFormat:@"cordova.fireDocumentEvent('ins_notification_handle',%@);", data];
|
|
77
77
|
[self.commandDelegate evalJs:js];
|
|
78
78
|
break;
|
|
79
79
|
}
|
|
80
80
|
case InsiderCallbackTypeInappButtonClick:{
|
|
81
|
-
NSString * data = [NSString stringWithFormat:@"{""action"":'INAPP_BUTTON_CLICK',""result"":""%@""}",
|
|
81
|
+
NSString * data = [NSString stringWithFormat:@"{""action"":'INAPP_BUTTON_CLICK',""result"":""%@""}", callbackData];
|
|
82
82
|
js = [NSString stringWithFormat:@"cordova.fireDocumentEvent('ins_notification_handle',%@);", data];
|
|
83
83
|
[self.commandDelegate evalJs:js];
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
86
|
case InsiderCallbackTypeTempStorePurchase:{
|
|
87
|
-
NSString * data = [NSString stringWithFormat:@"{""action"":'TEMP_STORE_PURCHASE',""result"":""%@""}",
|
|
87
|
+
NSString * data = [NSString stringWithFormat:@"{""action"":'TEMP_STORE_PURCHASE',""result"":""%@""}", callbackData];
|
|
88
88
|
js = [NSString stringWithFormat:@"cordova.fireDocumentEvent('ins_notification_handle',%@);", data];
|
|
89
89
|
[self.commandDelegate evalJs:js];
|
|
90
90
|
break;
|
|
91
91
|
}
|
|
92
92
|
case InsiderCallbackTypeTempStoreAddedToCart:{
|
|
93
|
-
NSString * data = [NSString stringWithFormat:@"{""action"":'TEMP_STORE_ADDED_TO_CART',""result"":""%@""}",
|
|
93
|
+
NSString * data = [NSString stringWithFormat:@"{""action"":'TEMP_STORE_ADDED_TO_CART',""result"":""%@""}", callbackData];
|
|
94
94
|
js = [NSString stringWithFormat:@"cordova.fireDocumentEvent('ins_notification_handle',%@);", data];
|
|
95
95
|
[self.commandDelegate evalJs:js];
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
case InsiderCallbackTypeTempStoreCustomAction:{
|
|
99
|
-
NSString * data = [NSString stringWithFormat:@"{""action"":'TEMP_STORE_CUSTOM_ACTION',""result"":""%@""}",
|
|
99
|
+
NSString * data = [NSString stringWithFormat:@"{""action"":'TEMP_STORE_CUSTOM_ACTION',""result"":""%@""}", callbackData];
|
|
100
|
+
js = [NSString stringWithFormat:@"cordova.fireDocumentEvent('ins_notification_handle',%@);", data];
|
|
101
|
+
[self.commandDelegate evalJs:js];
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
case InsiderCallbackTypeInAppSeen:{
|
|
105
|
+
NSString * data = [NSString stringWithFormat:@"{""action"":'INAPP_SEEN',""result"":""%@""}", callbackData];
|
|
100
106
|
js = [NSString stringWithFormat:@"cordova.fireDocumentEvent('ins_notification_handle',%@);", data];
|
|
101
107
|
[self.commandDelegate evalJs:js];
|
|
102
108
|
break;
|
|
@@ -138,7 +144,7 @@
|
|
|
138
144
|
- (void) startTrackingGeofence:(CDVInvokedUrlCommand *)command {
|
|
139
145
|
@try {
|
|
140
146
|
[self.commandDelegate runInBackground:^{
|
|
141
|
-
[
|
|
147
|
+
[InsiderGeofence startTracking];
|
|
142
148
|
[self sendSuccessResultWithString:@"SUCCESS" andCommand:command];
|
|
143
149
|
}];
|
|
144
150
|
} @catch (NSException *exception) {
|
package/www/CallbackType.js
CHANGED
package/www/Constants.js
CHANGED
package/www/Event.js
CHANGED
|
@@ -12,7 +12,10 @@ class Event {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
addParameterWithString(key, value) {
|
|
15
|
-
if (
|
|
15
|
+
if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'string', value: value }])) {
|
|
16
|
+
Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithString');
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
16
19
|
|
|
17
20
|
try {
|
|
18
21
|
this.parameters[key] = value;
|
|
@@ -24,7 +27,10 @@ class Event {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
addParameterWithInt(key, value) {
|
|
27
|
-
if (
|
|
30
|
+
if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'number', value: value }])) {
|
|
31
|
+
Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithInt');
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
28
34
|
|
|
29
35
|
try {
|
|
30
36
|
this.parameters[key] = value;
|
|
@@ -36,7 +42,10 @@ class Event {
|
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
addParameterWithDouble(key, value) {
|
|
39
|
-
if (
|
|
45
|
+
if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'number', value: value }])) {
|
|
46
|
+
Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithDouble');
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
40
49
|
|
|
41
50
|
try {
|
|
42
51
|
this.parameters[key] = value;
|
|
@@ -48,7 +57,10 @@ class Event {
|
|
|
48
57
|
}
|
|
49
58
|
|
|
50
59
|
addParameterWithBoolean(key, value) {
|
|
51
|
-
if (
|
|
60
|
+
if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'boolean', value: value }])) {
|
|
61
|
+
Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithBoolean');
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
52
64
|
|
|
53
65
|
try {
|
|
54
66
|
this.parameters[key] = value;
|
|
@@ -60,10 +72,12 @@ class Event {
|
|
|
60
72
|
}
|
|
61
73
|
|
|
62
74
|
addParameterWithDate(key, value) {
|
|
63
|
-
if (
|
|
75
|
+
if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'object', value: value }])) {
|
|
76
|
+
Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithDate');
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
64
79
|
|
|
65
80
|
try {
|
|
66
|
-
|
|
67
81
|
this.parameters[key] = value.toISOString();
|
|
68
82
|
|
|
69
83
|
return this;
|
|
@@ -73,7 +87,10 @@ class Event {
|
|
|
73
87
|
}
|
|
74
88
|
|
|
75
89
|
addParameterWithArray(key, value) {
|
|
76
|
-
if (
|
|
90
|
+
if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'object', value: value }])) {
|
|
91
|
+
Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithArray');
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
77
94
|
|
|
78
95
|
try {
|
|
79
96
|
this.parameters[key] = value;
|
package/www/Identifier.js
CHANGED
|
@@ -11,7 +11,10 @@ class Identifier {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
addEmail(email) {
|
|
14
|
-
if (
|
|
14
|
+
if (Utils.checkParameters([{ type: 'string', value: email }])) {
|
|
15
|
+
Utils.showParameterWarningLog(this.constructor.name + '-addEmail');
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
15
18
|
|
|
16
19
|
try {
|
|
17
20
|
this.identifiers[InsiderConstants.ADD_EMAIL] = email;
|
|
@@ -23,7 +26,10 @@ class Identifier {
|
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
addPhoneNumber(phoneNumber) {
|
|
26
|
-
if (
|
|
29
|
+
if (Utils.checkParameters([{ type: 'string', value: phoneNumber }])) {
|
|
30
|
+
Utils.showParameterWarningLog(this.constructor.name + '-addPhoneNumber');
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
27
33
|
|
|
28
34
|
try {
|
|
29
35
|
this.identifiers[InsiderConstants.ADD_PHONE_NUMBER] = phoneNumber;
|
|
@@ -35,7 +41,10 @@ class Identifier {
|
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
addUserID(userID) {
|
|
38
|
-
if (
|
|
44
|
+
if (Utils.checkParameters([{ type: 'string', value: userID }])) {
|
|
45
|
+
Utils.showParameterWarningLog(this.constructor.name + '-addUserID');
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
39
48
|
|
|
40
49
|
try {
|
|
41
50
|
this.identifiers[InsiderConstants.ADD_USER_ID] = userID;
|
|
@@ -47,7 +56,10 @@ class Identifier {
|
|
|
47
56
|
}
|
|
48
57
|
|
|
49
58
|
addCustomIdentifier(key, value) {
|
|
50
|
-
if (
|
|
59
|
+
if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'string', value: value }])) {
|
|
60
|
+
Utils.showParameterWarningLog(this.constructor.name + '-addCustomIdentifier');
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
51
63
|
|
|
52
64
|
try {
|
|
53
65
|
this.identifiers[key] = value;
|
package/www/InsiderPlugin.js
CHANGED
|
@@ -39,7 +39,13 @@ class InsiderPlugin {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
init = (partnerName, appGroup, handleNotificationCallback) => {
|
|
42
|
-
if (
|
|
42
|
+
if (Utils.checkParameters([
|
|
43
|
+
{ type: 'string', value: partnerName },
|
|
44
|
+
{ type: 'string', value: appGroup },
|
|
45
|
+
{ type: 'function', value: handleNotificationCallback }])) {
|
|
46
|
+
Utils.showParameterWarningLog(this.constructor.name + '-init');
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
43
49
|
|
|
44
50
|
try {
|
|
45
51
|
this.initCordovaBase(partnerName, appGroup, null, handleNotificationCallback);
|
|
@@ -49,7 +55,14 @@ class InsiderPlugin {
|
|
|
49
55
|
};
|
|
50
56
|
|
|
51
57
|
initWithCustomEndpoint = (partnerName, appGroup, endpoint, handleNotificationCallback) => {
|
|
52
|
-
if (
|
|
58
|
+
if (Utils.checkParameters([
|
|
59
|
+
{ type: 'string', value: partnerName },
|
|
60
|
+
{ type: 'string', value: appGroup },
|
|
61
|
+
{ type: 'string', value: endpoint },
|
|
62
|
+
{ type: 'function', value: handleNotificationCallback }])) {
|
|
63
|
+
Utils.showParameterWarningLog(this.constructor.name + '-init');
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
53
66
|
|
|
54
67
|
try {
|
|
55
68
|
this.initCordovaBase(partnerName, appGroup, endpoint, handleNotificationCallback);
|
|
@@ -67,7 +80,11 @@ class InsiderPlugin {
|
|
|
67
80
|
}
|
|
68
81
|
|
|
69
82
|
tagEvent = (eventName) => {
|
|
70
|
-
if (
|
|
83
|
+
if (Utils.checkParameters([{ type: 'string', value: eventName }])) {
|
|
84
|
+
Utils.showParameterWarningLog(this.constructor.name + '-tagEvent');
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
71
88
|
try {
|
|
72
89
|
return new InsiderEvent(eventName);
|
|
73
90
|
} catch (error) {
|
|
@@ -76,14 +93,26 @@ class InsiderPlugin {
|
|
|
76
93
|
}
|
|
77
94
|
|
|
78
95
|
createNewProduct = (productID, name, taxonomy, imageURL, price, currency) => {
|
|
79
|
-
if (
|
|
96
|
+
if (Utils.checkParameters([
|
|
97
|
+
{ type: 'string', value: productID },
|
|
98
|
+
{ type: 'string', value: name },
|
|
99
|
+
{ type: 'object', value: taxonomy },
|
|
100
|
+
{ type: 'string', value: imageURL },
|
|
101
|
+
{ type: 'number', value: price },
|
|
102
|
+
{ type: 'string', value: currency } ])) {
|
|
103
|
+
Utils.showParameterWarningLog(this.constructor.name + '-createNewProduct');
|
|
104
|
+
|
|
80
105
|
return new InsiderProduct('', '', [], '', 0, '');
|
|
106
|
+
}
|
|
81
107
|
|
|
82
108
|
return new InsiderProduct(productID, name, taxonomy, imageURL, price, currency);
|
|
83
109
|
}
|
|
84
110
|
|
|
85
111
|
itemPurchased = (uniqueSaleID, product) => {
|
|
86
|
-
if (uniqueSaleID
|
|
112
|
+
if (Utils.checkParameters([{ type: 'string', value: uniqueSaleID }, { type: 'object', value: product }])) {
|
|
113
|
+
Utils.showParameterWarningLog(this.constructor.name + '-itemPurchased');
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
87
116
|
|
|
88
117
|
try {
|
|
89
118
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ITEM_PURCHASED, [uniqueSaleID, product.productMustMap, product.productOptMap]);
|
|
@@ -93,7 +122,10 @@ class InsiderPlugin {
|
|
|
93
122
|
}
|
|
94
123
|
|
|
95
124
|
itemAddedToCart = (product) => {
|
|
96
|
-
if (product
|
|
125
|
+
if (Utils.checkParameters([{ type: 'object', value: product }])) {
|
|
126
|
+
Utils.showParameterWarningLog(this.constructor.name + '-itemAddedToCart');
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
97
129
|
|
|
98
130
|
try {
|
|
99
131
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ITEM_ADDED_TO_CART, [product.productMustMap, product.productOptMap]);
|
|
@@ -103,7 +135,10 @@ class InsiderPlugin {
|
|
|
103
135
|
}
|
|
104
136
|
|
|
105
137
|
itemRemovedFromCart = (productID) => {
|
|
106
|
-
if (productID
|
|
138
|
+
if (Utils.checkParameters([{ type: 'string', value: productID }])) {
|
|
139
|
+
Utils.showParameterWarningLog(this.constructor.name + '-itemRemovedFromCart');
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
107
142
|
|
|
108
143
|
try {
|
|
109
144
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ITEM_REMOVED_FROM_CART, [productID]);
|
|
@@ -121,7 +156,13 @@ class InsiderPlugin {
|
|
|
121
156
|
}
|
|
122
157
|
|
|
123
158
|
getMessageCenterData = (limit, startDate, endDate) => {
|
|
124
|
-
if (
|
|
159
|
+
if (Utils.checkParameters([
|
|
160
|
+
{ type: 'number', value: limit },
|
|
161
|
+
{ type: 'object', value: startDate },
|
|
162
|
+
{ type: 'object', value: endDate }]) || startDate.getTime() === endDate.getTime() || startDate.getTime() > endDate.getTime()) {
|
|
163
|
+
Utils.showParameterWarningLog(this.constructor.name + '-getMessageCenterData');
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
125
166
|
|
|
126
167
|
try {
|
|
127
168
|
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_MESSAGE_CENTER_DATA, [limit, startDate, endDate]);
|
|
@@ -131,7 +172,13 @@ class InsiderPlugin {
|
|
|
131
172
|
}
|
|
132
173
|
|
|
133
174
|
getSmartRecommendation = (recommendationID, locale, currency) => {
|
|
134
|
-
if (
|
|
175
|
+
if (Utils.checkParameters([
|
|
176
|
+
{ type: 'number', value: recommendationID },
|
|
177
|
+
{ type: 'string', value: locale },
|
|
178
|
+
{ type: 'string', value: currency }])) {
|
|
179
|
+
Utils.showParameterWarningLog(this.constructor.name + '-getSmartRecommendation');
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
135
182
|
|
|
136
183
|
try {
|
|
137
184
|
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_SMART_RECOMMENDATION, [recommendationID, locale, currency]);
|
|
@@ -141,7 +188,13 @@ class InsiderPlugin {
|
|
|
141
188
|
}
|
|
142
189
|
|
|
143
190
|
getSmartRecommendationWithProduct = (product, recommendationID, locale) => {
|
|
144
|
-
if (
|
|
191
|
+
if (Utils.checkParameters([
|
|
192
|
+
{ type: 'number', value: recommendationID },
|
|
193
|
+
{ type: 'string', value: locale },
|
|
194
|
+
{ type: 'object', value: product }])) {
|
|
195
|
+
Utils.showParameterWarningLog(this.constructor.name + '-getSmartRecommendationWithProduct');
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
145
198
|
|
|
146
199
|
try {
|
|
147
200
|
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_SMART_RECOMMENDATION_WITH_PRODUCT, [product.productMustMap, product.productOptMap, recommendationID, locale]);
|
|
@@ -151,7 +204,14 @@ class InsiderPlugin {
|
|
|
151
204
|
}
|
|
152
205
|
|
|
153
206
|
getSmartRecommendationWithProductIDs = (productIDs, recommendationID, locale, currency) => {
|
|
154
|
-
if (
|
|
207
|
+
if (Utils.checkParameters([
|
|
208
|
+
{ type: 'number', value: recommendationID },
|
|
209
|
+
{ type: 'string', value: locale },
|
|
210
|
+
{ type: 'string', value: currency },
|
|
211
|
+
{ type: 'object', value: productIDs }])) {
|
|
212
|
+
Utils.showParameterWarningLog(this.constructor.name + '-getSmartRecommendationWithProductIDs');
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
155
215
|
|
|
156
216
|
productIDs = productIDs.filter(value => value != null && typeof value == "string" && value.trim());
|
|
157
217
|
|
|
@@ -163,7 +223,12 @@ class InsiderPlugin {
|
|
|
163
223
|
}
|
|
164
224
|
|
|
165
225
|
clickSmartRecommendationProduct = (product, recommendationID) => {
|
|
166
|
-
if (
|
|
226
|
+
if (Utils.checkParameters([
|
|
227
|
+
{ type: 'number', value: recommendationID },
|
|
228
|
+
{ type: 'object', value: product }])) {
|
|
229
|
+
Utils.showParameterWarningLog(this.constructor.name + '-clickSmartRecommendationProduct');
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
167
232
|
|
|
168
233
|
try {
|
|
169
234
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.CLICK_SMART_RECOMMENDATION_PRODUCT, [product.productMustMap, product.productOptMap, recommendationID]);
|
|
@@ -173,7 +238,13 @@ class InsiderPlugin {
|
|
|
173
238
|
}
|
|
174
239
|
|
|
175
240
|
getContentStringWithName = (variableName, defaultValue, contentOptimizerDataType) => {
|
|
176
|
-
if (
|
|
241
|
+
if (Utils.checkParameters([
|
|
242
|
+
{ type: 'string', value: variableName },
|
|
243
|
+
{ type: 'string', value: defaultValue },
|
|
244
|
+
{ type: 'number', value: contentOptimizerDataType }])) {
|
|
245
|
+
Utils.showParameterWarningLog(this.constructor.name + '-getContentStringWithName');
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
177
248
|
|
|
178
249
|
try {
|
|
179
250
|
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_CONTENT_STRING_WITH_NAME, [variableName, defaultValue, contentOptimizerDataType]);
|
|
@@ -183,7 +254,13 @@ class InsiderPlugin {
|
|
|
183
254
|
}
|
|
184
255
|
|
|
185
256
|
getContentBoolWithName = (variableName, defaultValue, contentOptimizerDataType) => {
|
|
186
|
-
if (
|
|
257
|
+
if (Utils.checkParameters([
|
|
258
|
+
{ type: 'string', value: variableName },
|
|
259
|
+
{ type: 'boolean', value: defaultValue },
|
|
260
|
+
{ type: 'number', value: contentOptimizerDataType }])) {
|
|
261
|
+
Utils.showParameterWarningLog(this.constructor.name + '-getContentBoolWithName');
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
187
264
|
|
|
188
265
|
try {
|
|
189
266
|
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_CONTENT_BOOL_WITH_NAME, [variableName, defaultValue, contentOptimizerDataType]);
|
|
@@ -193,7 +270,13 @@ class InsiderPlugin {
|
|
|
193
270
|
}
|
|
194
271
|
|
|
195
272
|
getContentIntWithName = (variableName, defaultValue, contentOptimizerDataType) => {
|
|
196
|
-
if (
|
|
273
|
+
if (Utils.checkParameters([
|
|
274
|
+
{ type: 'string', value: variableName },
|
|
275
|
+
{ type: 'number', value: defaultValue },
|
|
276
|
+
{ type: 'number', value: contentOptimizerDataType }])) {
|
|
277
|
+
Utils.showParameterWarningLog(this.constructor.name + '-getContentIntWithName');
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
197
280
|
|
|
198
281
|
try {
|
|
199
282
|
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_CONTENT_INT_WITH_NAME, [variableName, defaultValue, contentOptimizerDataType]);
|
|
@@ -211,7 +294,10 @@ class InsiderPlugin {
|
|
|
211
294
|
}
|
|
212
295
|
|
|
213
296
|
visitListingPage = (taxonomy) => {
|
|
214
|
-
if (taxonomy
|
|
297
|
+
if (Utils.checkParameters([{ type: 'object', value: taxonomy }])) {
|
|
298
|
+
Utils.showParameterWarningLog(this.constructor.name + '-visitListingPage');
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
215
301
|
|
|
216
302
|
try {
|
|
217
303
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.VISIT_LISTING_PAGE, [taxonomy]);
|
|
@@ -221,7 +307,10 @@ class InsiderPlugin {
|
|
|
221
307
|
}
|
|
222
308
|
|
|
223
309
|
visitProductDetailPage = (product) => {
|
|
224
|
-
if (product
|
|
310
|
+
if (Utils.checkParameters([{ type: 'object', value: product }])) {
|
|
311
|
+
Utils.showParameterWarningLog(this.constructor.name + '-visitProductDetailPage');
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
225
314
|
|
|
226
315
|
try {
|
|
227
316
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.VISIT_PRODUCT_DETAIL_PAGE, [product.productMustMap, product.productOptMap]);
|
|
@@ -231,7 +320,11 @@ class InsiderPlugin {
|
|
|
231
320
|
}
|
|
232
321
|
|
|
233
322
|
visitCartPage = (products) => {
|
|
234
|
-
if (products
|
|
323
|
+
if (Utils.checkParameters([{ type: 'object', value: products }])) {
|
|
324
|
+
Utils.showParameterWarningLog(this.constructor.name + '-visitCartPage');
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
|
|
235
328
|
try {
|
|
236
329
|
let productMap = {};
|
|
237
330
|
let mappedProducts = new Array(products.length);
|
|
@@ -257,6 +350,11 @@ class InsiderPlugin {
|
|
|
257
350
|
}
|
|
258
351
|
|
|
259
352
|
setGDPRConsent = (gdprConsent) => {
|
|
353
|
+
if (Utils.checkParameters([{ type: 'boolean', value: gdprConsent }])) {
|
|
354
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setGDPRConsent');
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
|
|
260
358
|
try {
|
|
261
359
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_GDPR_CONSENT, [gdprConsent.toString().toLowerCase()]);
|
|
262
360
|
} catch (error) {
|
|
@@ -265,6 +363,11 @@ class InsiderPlugin {
|
|
|
265
363
|
};
|
|
266
364
|
|
|
267
365
|
enableIDFACollection = (idfaCollection) => {
|
|
366
|
+
if (Utils.checkParameters([{ type: 'boolean', value: idfaCollection }])) {
|
|
367
|
+
Utils.showParameterWarningLog(this.constructor.name + '-enableIDFACollection');
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
|
|
268
371
|
try {
|
|
269
372
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ENABLE_IDFA_COLLECTION, [idfaCollection.toString().toLowerCase()]);
|
|
270
373
|
} catch (error) {
|
|
@@ -281,7 +384,10 @@ class InsiderPlugin {
|
|
|
281
384
|
};
|
|
282
385
|
|
|
283
386
|
registerWithQuietPermission = (permission) => {
|
|
284
|
-
if (
|
|
387
|
+
if (Utils.checkParameters([{ type: 'boolean', value: permission }])) {
|
|
388
|
+
Utils.showParameterWarningLog(this.constructor.name + '-registerWithQuietPermission');
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
285
391
|
|
|
286
392
|
try {
|
|
287
393
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.REGISTER_WITH_QUIET_PERMISSION, [permission.toString().toLowerCase()]);
|
|
@@ -291,7 +397,10 @@ class InsiderPlugin {
|
|
|
291
397
|
};
|
|
292
398
|
|
|
293
399
|
setHybridPushToken = (token) => {
|
|
294
|
-
if (
|
|
400
|
+
if (Utils.checkParameters([{ type: 'string', value: token }])) {
|
|
401
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setHybridPushToken');
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
295
404
|
|
|
296
405
|
try {
|
|
297
406
|
if (Platform.OS !== InsiderConstants.ANDROID) return;
|
|
@@ -303,6 +412,11 @@ class InsiderPlugin {
|
|
|
303
412
|
}
|
|
304
413
|
|
|
305
414
|
enableLocationCollection = (locationCollection) => {
|
|
415
|
+
if (Utils.checkParameters([{ type: 'boolean', value: locationCollection }])) {
|
|
416
|
+
Utils.showParameterWarningLog(this.constructor.name + '-enableLocationCollection');
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
|
|
306
420
|
try {
|
|
307
421
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ENABLE_LOCATION_COLLECTION, [locationCollection]);
|
|
308
422
|
} catch (error) {
|
|
@@ -311,6 +425,11 @@ class InsiderPlugin {
|
|
|
311
425
|
}
|
|
312
426
|
|
|
313
427
|
enableIpCollection = (ipCollection) => {
|
|
428
|
+
if (Utils.checkParameters([{ type: 'boolean', value: ipCollection }])) {
|
|
429
|
+
Utils.showParameterWarningLog(this.constructor.name + '-enableIpCollection');
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
|
|
314
433
|
try {
|
|
315
434
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ENABLE_IP_COLLECTION, [ipCollection]);
|
|
316
435
|
} catch (error) {
|
|
@@ -319,6 +438,11 @@ class InsiderPlugin {
|
|
|
319
438
|
}
|
|
320
439
|
|
|
321
440
|
enableCarrierCollection = (carrierCollection) => {
|
|
441
|
+
if (Utils.checkParameters([{ type: 'boolean', value: carrierCollection }])) {
|
|
442
|
+
Utils.showParameterWarningLog(this.constructor.name + '-enableCarrierCollection');
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
322
446
|
try {
|
|
323
447
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ENABLE_CARRIER_COLLECTION, [carrierCollection]);
|
|
324
448
|
} catch (error) {
|
|
@@ -351,6 +475,11 @@ class InsiderPlugin {
|
|
|
351
475
|
}
|
|
352
476
|
|
|
353
477
|
setForegroundPushCallback = (callback) => {
|
|
478
|
+
if (Utils.checkParameters([{ type: 'function', value: callback }])) {
|
|
479
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setForegroundPushCallback');
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
|
|
354
483
|
try {
|
|
355
484
|
if (cordova.platformId === "ios") {
|
|
356
485
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_FOREGROUND_PUSH_CALLBACK, []);
|
|
@@ -365,6 +494,11 @@ class InsiderPlugin {
|
|
|
365
494
|
}
|
|
366
495
|
|
|
367
496
|
handleNotification = (userInfo) => {
|
|
497
|
+
if (Utils.checkParameters([{ type: 'object', value: userInfo }])) {
|
|
498
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setForegroundPushCallback');
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
|
|
368
502
|
try {
|
|
369
503
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.HANDLE_NOTIFICATION, [userInfo]);
|
|
370
504
|
} catch (error) {
|
|
@@ -373,4 +507,4 @@ class InsiderPlugin {
|
|
|
373
507
|
}
|
|
374
508
|
}
|
|
375
509
|
|
|
376
|
-
module.exports = new InsiderPlugin();
|
|
510
|
+
module.exports = new InsiderPlugin();
|