cordova-plugin-insider 1.3.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 +6 -6
- package/src/android/Constants.java +1 -0
- package/src/android/InsiderPlugin.java +29 -3
- package/src/android/build-extras.gradle +5 -6
- package/src/ios/InsiderPlugin.h +2 -0
- package/src/ios/InsiderPlugin.m +30 -10
- package/types/InsiderPlugin.d.ts +1 -0
- package/types/Product.d.ts +1 -0
- package/www/CallbackType.js +1 -0
- package/www/Constants.js +3 -1
- package/www/Event.js +24 -7
- package/www/Identifier.js +16 -4
- package/www/InsiderPlugin.js +166 -20
- package/www/Product.js +80 -17
- 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 -61
- package/.github/workflows/release_task_merger.yml +0 -22
- package/.github/workflows/release_version_setter.yml +0 -43
- package/release_version.sh +0 -27
- package/slack_notifier.sh +0 -20
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]);
|
|
@@ -150,8 +203,32 @@ class InsiderPlugin {
|
|
|
150
203
|
}
|
|
151
204
|
}
|
|
152
205
|
|
|
206
|
+
getSmartRecommendationWithProductIDs = (productIDs, recommendationID, locale, currency) => {
|
|
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
|
+
}
|
|
215
|
+
|
|
216
|
+
productIDs = productIDs.filter(value => value != null && typeof value == "string" && value.trim());
|
|
217
|
+
|
|
218
|
+
try {
|
|
219
|
+
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_SMART_RECOMMENDATION_WITH_PRODUCT_IDS, [productIDs, recommendationID, locale, currency]);
|
|
220
|
+
} catch (error) {
|
|
221
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
153
225
|
clickSmartRecommendationProduct = (product, recommendationID) => {
|
|
154
|
-
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
|
+
}
|
|
155
232
|
|
|
156
233
|
try {
|
|
157
234
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.CLICK_SMART_RECOMMENDATION_PRODUCT, [product.productMustMap, product.productOptMap, recommendationID]);
|
|
@@ -161,7 +238,13 @@ class InsiderPlugin {
|
|
|
161
238
|
}
|
|
162
239
|
|
|
163
240
|
getContentStringWithName = (variableName, defaultValue, contentOptimizerDataType) => {
|
|
164
|
-
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
|
+
}
|
|
165
248
|
|
|
166
249
|
try {
|
|
167
250
|
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_CONTENT_STRING_WITH_NAME, [variableName, defaultValue, contentOptimizerDataType]);
|
|
@@ -171,7 +254,13 @@ class InsiderPlugin {
|
|
|
171
254
|
}
|
|
172
255
|
|
|
173
256
|
getContentBoolWithName = (variableName, defaultValue, contentOptimizerDataType) => {
|
|
174
|
-
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
|
+
}
|
|
175
264
|
|
|
176
265
|
try {
|
|
177
266
|
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_CONTENT_BOOL_WITH_NAME, [variableName, defaultValue, contentOptimizerDataType]);
|
|
@@ -181,7 +270,13 @@ class InsiderPlugin {
|
|
|
181
270
|
}
|
|
182
271
|
|
|
183
272
|
getContentIntWithName = (variableName, defaultValue, contentOptimizerDataType) => {
|
|
184
|
-
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
|
+
}
|
|
185
280
|
|
|
186
281
|
try {
|
|
187
282
|
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_CONTENT_INT_WITH_NAME, [variableName, defaultValue, contentOptimizerDataType]);
|
|
@@ -199,7 +294,10 @@ class InsiderPlugin {
|
|
|
199
294
|
}
|
|
200
295
|
|
|
201
296
|
visitListingPage = (taxonomy) => {
|
|
202
|
-
if (taxonomy
|
|
297
|
+
if (Utils.checkParameters([{ type: 'object', value: taxonomy }])) {
|
|
298
|
+
Utils.showParameterWarningLog(this.constructor.name + '-visitListingPage');
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
203
301
|
|
|
204
302
|
try {
|
|
205
303
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.VISIT_LISTING_PAGE, [taxonomy]);
|
|
@@ -209,7 +307,10 @@ class InsiderPlugin {
|
|
|
209
307
|
}
|
|
210
308
|
|
|
211
309
|
visitProductDetailPage = (product) => {
|
|
212
|
-
if (product
|
|
310
|
+
if (Utils.checkParameters([{ type: 'object', value: product }])) {
|
|
311
|
+
Utils.showParameterWarningLog(this.constructor.name + '-visitProductDetailPage');
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
213
314
|
|
|
214
315
|
try {
|
|
215
316
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.VISIT_PRODUCT_DETAIL_PAGE, [product.productMustMap, product.productOptMap]);
|
|
@@ -219,7 +320,11 @@ class InsiderPlugin {
|
|
|
219
320
|
}
|
|
220
321
|
|
|
221
322
|
visitCartPage = (products) => {
|
|
222
|
-
if (products
|
|
323
|
+
if (Utils.checkParameters([{ type: 'object', value: products }])) {
|
|
324
|
+
Utils.showParameterWarningLog(this.constructor.name + '-visitCartPage');
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
|
|
223
328
|
try {
|
|
224
329
|
let productMap = {};
|
|
225
330
|
let mappedProducts = new Array(products.length);
|
|
@@ -245,6 +350,11 @@ class InsiderPlugin {
|
|
|
245
350
|
}
|
|
246
351
|
|
|
247
352
|
setGDPRConsent = (gdprConsent) => {
|
|
353
|
+
if (Utils.checkParameters([{ type: 'boolean', value: gdprConsent }])) {
|
|
354
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setGDPRConsent');
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
|
|
248
358
|
try {
|
|
249
359
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_GDPR_CONSENT, [gdprConsent.toString().toLowerCase()]);
|
|
250
360
|
} catch (error) {
|
|
@@ -253,6 +363,11 @@ class InsiderPlugin {
|
|
|
253
363
|
};
|
|
254
364
|
|
|
255
365
|
enableIDFACollection = (idfaCollection) => {
|
|
366
|
+
if (Utils.checkParameters([{ type: 'boolean', value: idfaCollection }])) {
|
|
367
|
+
Utils.showParameterWarningLog(this.constructor.name + '-enableIDFACollection');
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
|
|
256
371
|
try {
|
|
257
372
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ENABLE_IDFA_COLLECTION, [idfaCollection.toString().toLowerCase()]);
|
|
258
373
|
} catch (error) {
|
|
@@ -269,7 +384,10 @@ class InsiderPlugin {
|
|
|
269
384
|
};
|
|
270
385
|
|
|
271
386
|
registerWithQuietPermission = (permission) => {
|
|
272
|
-
if (
|
|
387
|
+
if (Utils.checkParameters([{ type: 'boolean', value: permission }])) {
|
|
388
|
+
Utils.showParameterWarningLog(this.constructor.name + '-registerWithQuietPermission');
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
273
391
|
|
|
274
392
|
try {
|
|
275
393
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.REGISTER_WITH_QUIET_PERMISSION, [permission.toString().toLowerCase()]);
|
|
@@ -279,7 +397,10 @@ class InsiderPlugin {
|
|
|
279
397
|
};
|
|
280
398
|
|
|
281
399
|
setHybridPushToken = (token) => {
|
|
282
|
-
if (
|
|
400
|
+
if (Utils.checkParameters([{ type: 'string', value: token }])) {
|
|
401
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setHybridPushToken');
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
283
404
|
|
|
284
405
|
try {
|
|
285
406
|
if (Platform.OS !== InsiderConstants.ANDROID) return;
|
|
@@ -291,6 +412,11 @@ class InsiderPlugin {
|
|
|
291
412
|
}
|
|
292
413
|
|
|
293
414
|
enableLocationCollection = (locationCollection) => {
|
|
415
|
+
if (Utils.checkParameters([{ type: 'boolean', value: locationCollection }])) {
|
|
416
|
+
Utils.showParameterWarningLog(this.constructor.name + '-enableLocationCollection');
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
|
|
294
420
|
try {
|
|
295
421
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ENABLE_LOCATION_COLLECTION, [locationCollection]);
|
|
296
422
|
} catch (error) {
|
|
@@ -299,6 +425,11 @@ class InsiderPlugin {
|
|
|
299
425
|
}
|
|
300
426
|
|
|
301
427
|
enableIpCollection = (ipCollection) => {
|
|
428
|
+
if (Utils.checkParameters([{ type: 'boolean', value: ipCollection }])) {
|
|
429
|
+
Utils.showParameterWarningLog(this.constructor.name + '-enableIpCollection');
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
|
|
302
433
|
try {
|
|
303
434
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ENABLE_IP_COLLECTION, [ipCollection]);
|
|
304
435
|
} catch (error) {
|
|
@@ -307,6 +438,11 @@ class InsiderPlugin {
|
|
|
307
438
|
}
|
|
308
439
|
|
|
309
440
|
enableCarrierCollection = (carrierCollection) => {
|
|
441
|
+
if (Utils.checkParameters([{ type: 'boolean', value: carrierCollection }])) {
|
|
442
|
+
Utils.showParameterWarningLog(this.constructor.name + '-enableCarrierCollection');
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
310
446
|
try {
|
|
311
447
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ENABLE_CARRIER_COLLECTION, [carrierCollection]);
|
|
312
448
|
} catch (error) {
|
|
@@ -339,6 +475,11 @@ class InsiderPlugin {
|
|
|
339
475
|
}
|
|
340
476
|
|
|
341
477
|
setForegroundPushCallback = (callback) => {
|
|
478
|
+
if (Utils.checkParameters([{ type: 'function', value: callback }])) {
|
|
479
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setForegroundPushCallback');
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
|
|
342
483
|
try {
|
|
343
484
|
if (cordova.platformId === "ios") {
|
|
344
485
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_FOREGROUND_PUSH_CALLBACK, []);
|
|
@@ -353,6 +494,11 @@ class InsiderPlugin {
|
|
|
353
494
|
}
|
|
354
495
|
|
|
355
496
|
handleNotification = (userInfo) => {
|
|
497
|
+
if (Utils.checkParameters([{ type: 'object', value: userInfo }])) {
|
|
498
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setForegroundPushCallback');
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
|
|
356
502
|
try {
|
|
357
503
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.HANDLE_NOTIFICATION, [userInfo]);
|
|
358
504
|
} catch (error) {
|
|
@@ -361,4 +507,4 @@ class InsiderPlugin {
|
|
|
361
507
|
}
|
|
362
508
|
}
|
|
363
509
|
|
|
364
|
-
module.exports = new InsiderPlugin();
|
|
510
|
+
module.exports = new InsiderPlugin();
|
package/www/Product.js
CHANGED
|
@@ -19,7 +19,10 @@ class Product {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
setColor(color) {
|
|
22
|
-
if (
|
|
22
|
+
if (Utils.checkParameters([{ type: 'string', value: color }])) {
|
|
23
|
+
Utils.showParameterWarningLog(this.constructor.name + '-color');
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
23
26
|
|
|
24
27
|
try {
|
|
25
28
|
this.productOptMap[InsiderConstants.COLOR] = color;
|
|
@@ -31,7 +34,10 @@ class Product {
|
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
setVoucherName(voucherName) {
|
|
34
|
-
if (
|
|
37
|
+
if (Utils.checkParameters([{ type: 'string', value: voucherName }])) {
|
|
38
|
+
Utils.showParameterWarningLog(this.constructor.name + '-voucherName');
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
35
41
|
|
|
36
42
|
try {
|
|
37
43
|
this.productOptMap[InsiderConstants.VOUCHER_NAME] = voucherName;
|
|
@@ -43,19 +49,25 @@ class Product {
|
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
setPromotionName(promotionName) {
|
|
46
|
-
if (
|
|
52
|
+
if (Utils.checkParameters([{ type: 'string', value: promotionName }])) {
|
|
53
|
+
Utils.showParameterWarningLog(this.constructor.name + '-promotionName');
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
47
56
|
|
|
48
57
|
try {
|
|
49
58
|
this.productOptMap[InsiderConstants.PROMOTION_NAME] = promotionName;
|
|
50
59
|
} catch (error) {
|
|
51
60
|
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
52
61
|
}
|
|
53
|
-
|
|
62
|
+
|
|
54
63
|
return this;
|
|
55
64
|
}
|
|
56
65
|
|
|
57
66
|
setSize(size) {
|
|
58
|
-
if (
|
|
67
|
+
if (Utils.checkParameters([{ type: 'string', value: size }])) {
|
|
68
|
+
Utils.showParameterWarningLog(this.constructor.name + '-size');
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
59
71
|
|
|
60
72
|
try {
|
|
61
73
|
this.productOptMap[InsiderConstants.SIZE] = size;
|
|
@@ -66,8 +78,26 @@ class Product {
|
|
|
66
78
|
return this;
|
|
67
79
|
}
|
|
68
80
|
|
|
81
|
+
setGroupCode(groupCode) {
|
|
82
|
+
if (Utils.checkParameters([{ type: 'string', value: groupCode }])) {
|
|
83
|
+
Utils.showParameterWarningLog(this.constructor.name + '-groupCode');
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
this.productOptMap[InsiderConstants.GROUP_CODE] = groupCode;
|
|
89
|
+
} catch (error) {
|
|
90
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
|
|
69
96
|
setSalePrice(salePrice) {
|
|
70
|
-
if (
|
|
97
|
+
if (Utils.checkParameters([{ type: 'number', value: salePrice }])) {
|
|
98
|
+
Utils.showParameterWarningLog(this.constructor.name + '-salePrice');
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
71
101
|
|
|
72
102
|
try {
|
|
73
103
|
this.productOptMap[InsiderConstants.SALE_PRICE] = salePrice;
|
|
@@ -78,7 +108,10 @@ class Product {
|
|
|
78
108
|
}
|
|
79
109
|
|
|
80
110
|
setShippingCost(shippingCost) {
|
|
81
|
-
if (
|
|
111
|
+
if (Utils.checkParameters([{ type: 'number', value: shippingCost }])) {
|
|
112
|
+
Utils.showParameterWarningLog(this.constructor.name + '-shippingCost');
|
|
113
|
+
return this;
|
|
114
|
+
}
|
|
82
115
|
|
|
83
116
|
try {
|
|
84
117
|
this.productOptMap[InsiderConstants.SHIPPING_COST] = shippingCost;
|
|
@@ -90,7 +123,10 @@ class Product {
|
|
|
90
123
|
}
|
|
91
124
|
|
|
92
125
|
setVoucherDiscount(voucherDiscount) {
|
|
93
|
-
if (
|
|
126
|
+
if (Utils.checkParameters([{ type: 'number', value: voucherDiscount }])) {
|
|
127
|
+
Utils.showParameterWarningLog(this.constructor.name + '-voucherDiscount');
|
|
128
|
+
return this;
|
|
129
|
+
}
|
|
94
130
|
|
|
95
131
|
try {
|
|
96
132
|
this.productOptMap[InsiderConstants.VOUCHER_DISCOUNT] = voucherDiscount;
|
|
@@ -102,7 +138,10 @@ class Product {
|
|
|
102
138
|
}
|
|
103
139
|
|
|
104
140
|
setPromotionDiscount(promotionDiscount) {
|
|
105
|
-
if (
|
|
141
|
+
if (Utils.checkParameters([{ type: 'number', value: promotionDiscount }])) {
|
|
142
|
+
Utils.showParameterWarningLog(this.constructor.name + '-promotionDiscount');
|
|
143
|
+
return this;
|
|
144
|
+
}
|
|
106
145
|
|
|
107
146
|
try {
|
|
108
147
|
this.productOptMap[InsiderConstants.PROMOTION_DISCOUNT] = promotionDiscount;
|
|
@@ -114,7 +153,10 @@ class Product {
|
|
|
114
153
|
}
|
|
115
154
|
|
|
116
155
|
setStock(stock) {
|
|
117
|
-
if (
|
|
156
|
+
if (Utils.checkParameters([{ type: 'number', value: stock }])) {
|
|
157
|
+
Utils.showParameterWarningLog(this.constructor.name + '-stock');
|
|
158
|
+
return this;
|
|
159
|
+
}
|
|
118
160
|
|
|
119
161
|
try {
|
|
120
162
|
this.productOptMap[InsiderConstants.STOCK] = stock;
|
|
@@ -126,7 +168,10 @@ class Product {
|
|
|
126
168
|
}
|
|
127
169
|
|
|
128
170
|
setQuantity(quantity) {
|
|
129
|
-
if (
|
|
171
|
+
if (Utils.checkParameters([{ type: 'number', value: quantity }])) {
|
|
172
|
+
Utils.showParameterWarningLog(this.constructor.name + '-quantity');
|
|
173
|
+
return this;
|
|
174
|
+
}
|
|
130
175
|
|
|
131
176
|
try {
|
|
132
177
|
this.productOptMap[InsiderConstants.QUANTITY] = quantity;
|
|
@@ -138,7 +183,10 @@ class Product {
|
|
|
138
183
|
}
|
|
139
184
|
|
|
140
185
|
setCustomAttributeWithString(key, value) {
|
|
141
|
-
if (
|
|
186
|
+
if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'string', value: value }])) {
|
|
187
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithString');
|
|
188
|
+
return this;
|
|
189
|
+
}
|
|
142
190
|
|
|
143
191
|
try {
|
|
144
192
|
this.productOptMap[key] = value;
|
|
@@ -150,7 +198,10 @@ class Product {
|
|
|
150
198
|
}
|
|
151
199
|
|
|
152
200
|
setCustomAttributeWithInt(key, value) {
|
|
153
|
-
if (
|
|
201
|
+
if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'number', value: value }])) {
|
|
202
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithInt');
|
|
203
|
+
return this;
|
|
204
|
+
}
|
|
154
205
|
|
|
155
206
|
try {
|
|
156
207
|
this.productOptMap[key] = value;
|
|
@@ -161,7 +212,10 @@ class Product {
|
|
|
161
212
|
}
|
|
162
213
|
|
|
163
214
|
setCustomAttributeWithBoolean(key, value) {
|
|
164
|
-
if (
|
|
215
|
+
if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'boolean', value: value }])) {
|
|
216
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithBoolean');
|
|
217
|
+
return this;
|
|
218
|
+
}
|
|
165
219
|
|
|
166
220
|
try {
|
|
167
221
|
this.productOptMap[key] = value;
|
|
@@ -172,7 +226,10 @@ class Product {
|
|
|
172
226
|
}
|
|
173
227
|
|
|
174
228
|
setCustomAttributeWithDouble(key, value) {
|
|
175
|
-
if (
|
|
229
|
+
if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'number', value: value }])) {
|
|
230
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithDouble');
|
|
231
|
+
return this;
|
|
232
|
+
}
|
|
176
233
|
|
|
177
234
|
try {
|
|
178
235
|
this.productOptMap[key] = value;
|
|
@@ -184,7 +241,10 @@ class Product {
|
|
|
184
241
|
}
|
|
185
242
|
|
|
186
243
|
setCustomAttributeWithDate(key, value) {
|
|
187
|
-
if (
|
|
244
|
+
if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'object', value: value }])) {
|
|
245
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithDate');
|
|
246
|
+
return this;
|
|
247
|
+
}
|
|
188
248
|
|
|
189
249
|
try {
|
|
190
250
|
this.productOptMap[key] = value.toISOString();
|
|
@@ -196,7 +256,10 @@ class Product {
|
|
|
196
256
|
}
|
|
197
257
|
|
|
198
258
|
setCustomAttributeWithArray(key, value) {
|
|
199
|
-
if (
|
|
259
|
+
if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'object', value: value }])) {
|
|
260
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithArray');
|
|
261
|
+
return this;
|
|
262
|
+
}
|
|
200
263
|
|
|
201
264
|
try {
|
|
202
265
|
this.productOptMap[key] = value;
|