cordova-plugin-insider 2.2.1 → 2.4.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/babel.config.json +9 -0
- package/hooks/after_plugin_install.js +1 -1
- package/package.json +14 -3
- package/plugin.xml +4 -4
- package/src/android/Constants.java +9 -0
- package/src/android/InsiderPlugin.java +61 -4
- package/src/android/build-extras.gradle +2 -2
- package/src/ios/InsiderPlugin.h +4 -0
- package/src/ios/InsiderPlugin.m +64 -1
- package/types/CallbackType.d.ts +2 -0
- package/types/InsiderPlugin.d.ts +4 -0
- package/www/CallbackType.js +9 -6
- package/www/Constants.js +112 -97
- package/www/ContentOptimizerDataType.js +4 -2
- package/www/Event.js +140 -103
- package/www/Gender.js +5 -3
- package/www/Identifier.js +84 -66
- package/www/InsiderPlugin.js +739 -618
- package/www/Product.js +429 -236
- package/www/User.js +410 -324
- package/www/Utils.js +18 -16
package/www/InsiderPlugin.js
CHANGED
|
@@ -1,621 +1,742 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
-
|
|
254
|
-
|
|
255
|
-
|
|
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
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
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
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
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
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
5
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
6
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
7
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
var InsiderProduct = require("./Product");
|
|
11
|
+
var InsiderEvent = require("./Event");
|
|
12
|
+
var InsiderUser = require("./User");
|
|
13
|
+
var InsiderIdentifier = require('./Identifier');
|
|
14
|
+
var InsiderCallbackType = require('./CallbackType');
|
|
15
|
+
var InsiderGender = require('./Gender');
|
|
16
|
+
var InsiderContentOptimizerDataType = require('./ContentOptimizerDataType');
|
|
17
|
+
var Utils = require("./Utils");
|
|
18
|
+
var InsiderConstants = require("./Constants");
|
|
19
|
+
var InsiderPlugin = /*#__PURE__*/_createClass(function InsiderPlugin() {
|
|
20
|
+
var _this = this;
|
|
21
|
+
_classCallCheck(this, InsiderPlugin);
|
|
22
|
+
_defineProperty(this, "insiderUser", {});
|
|
23
|
+
_defineProperty(this, "gender", InsiderGender);
|
|
24
|
+
_defineProperty(this, "callbackType", InsiderCallbackType);
|
|
25
|
+
_defineProperty(this, "contentOptimizerDataType", InsiderContentOptimizerDataType);
|
|
26
|
+
_defineProperty(this, "initCordovaBase", function (partnerName, appGroup, customEndpoint, handleNotificationCallback) {
|
|
27
|
+
try {
|
|
28
|
+
var sdkVersion = InsiderConstants.SDK_VERSION;
|
|
29
|
+
document.addEventListener('ins_notification_handle', handleNotificationCallback, false);
|
|
30
|
+
if (customEndpoint !== null) Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.INIT_WITH_CUSTOM_ENDPOINT, [partnerName, sdkVersion, appGroup, customEndpoint]);else if (cordova.platformId === "ios") Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.INIT_WITH_LAUNCH_OPTIONS, [partnerName, sdkVersion, appGroup]);else Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.INIT, [partnerName, sdkVersion]);
|
|
31
|
+
} catch (error) {
|
|
32
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
_defineProperty(this, "init", function (partnerName, appGroup, handleNotificationCallback) {
|
|
36
|
+
if (Utils.checkParameters([{
|
|
37
|
+
type: 'string',
|
|
38
|
+
value: partnerName
|
|
39
|
+
}, {
|
|
40
|
+
type: 'string',
|
|
41
|
+
value: appGroup
|
|
42
|
+
}, {
|
|
43
|
+
type: 'function',
|
|
44
|
+
value: handleNotificationCallback
|
|
45
|
+
}])) {
|
|
46
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-init');
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
_this.initCordovaBase(partnerName, appGroup, null, handleNotificationCallback);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
_defineProperty(this, "initWithCustomEndpoint", function (partnerName, appGroup, endpoint, handleNotificationCallback) {
|
|
56
|
+
if (Utils.checkParameters([{
|
|
57
|
+
type: 'string',
|
|
58
|
+
value: partnerName
|
|
59
|
+
}, {
|
|
60
|
+
type: 'string',
|
|
61
|
+
value: appGroup
|
|
62
|
+
}, {
|
|
63
|
+
type: 'string',
|
|
64
|
+
value: endpoint
|
|
65
|
+
}, {
|
|
66
|
+
type: 'function',
|
|
67
|
+
value: handleNotificationCallback
|
|
68
|
+
}])) {
|
|
69
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-init');
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
_this.initCordovaBase(partnerName, appGroup, endpoint, handleNotificationCallback);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
_defineProperty(this, "reinitWithPartnerName", function (partnerName) {
|
|
79
|
+
if (Utils.checkParameters([{
|
|
80
|
+
type: 'string',
|
|
81
|
+
value: partnerName
|
|
82
|
+
}])) {
|
|
83
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-reinit');
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.REINIT_WITH_PARTNER_NAME, [partnerName]);
|
|
88
|
+
} catch (error) {
|
|
89
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
_defineProperty(this, "getCurrentUser", function () {
|
|
93
|
+
try {
|
|
94
|
+
return _this.insiderUser;
|
|
95
|
+
} catch (error) {
|
|
96
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
_defineProperty(this, "tagEvent", function (eventName) {
|
|
100
|
+
if (Utils.checkParameters([{
|
|
101
|
+
type: 'string',
|
|
102
|
+
value: eventName
|
|
103
|
+
}])) {
|
|
104
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-tagEvent');
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
return new InsiderEvent(eventName);
|
|
109
|
+
} catch (error) {
|
|
110
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
_defineProperty(this, "createNewProduct", function (productID, name, taxonomy, imageURL, price, currency) {
|
|
114
|
+
if (Utils.checkParameters([{
|
|
115
|
+
type: 'string',
|
|
116
|
+
value: productID
|
|
117
|
+
}, {
|
|
118
|
+
type: 'string',
|
|
119
|
+
value: name
|
|
120
|
+
}, {
|
|
121
|
+
type: 'object',
|
|
122
|
+
value: taxonomy
|
|
123
|
+
}, {
|
|
124
|
+
type: 'string',
|
|
125
|
+
value: imageURL
|
|
126
|
+
}, {
|
|
127
|
+
type: 'number',
|
|
128
|
+
value: price
|
|
129
|
+
}, {
|
|
130
|
+
type: 'string',
|
|
131
|
+
value: currency
|
|
132
|
+
}])) {
|
|
133
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-createNewProduct');
|
|
134
|
+
return new InsiderProduct('', '', [], '', 0, '');
|
|
135
|
+
}
|
|
136
|
+
return new InsiderProduct(productID, name, taxonomy, imageURL, price, currency);
|
|
137
|
+
});
|
|
138
|
+
_defineProperty(this, "itemPurchased", function (uniqueSaleID, product) {
|
|
139
|
+
if (Utils.checkParameters([{
|
|
140
|
+
type: 'string',
|
|
141
|
+
value: uniqueSaleID
|
|
142
|
+
}, {
|
|
143
|
+
type: 'object',
|
|
144
|
+
value: product
|
|
145
|
+
}])) {
|
|
146
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-itemPurchased');
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ITEM_PURCHASED, [uniqueSaleID, product.productMustMap, product.productOptMap]);
|
|
151
|
+
} catch (error) {
|
|
152
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
_defineProperty(this, "itemAddedToCart", function (product) {
|
|
156
|
+
if (Utils.checkParameters([{
|
|
157
|
+
type: 'object',
|
|
158
|
+
value: product
|
|
159
|
+
}])) {
|
|
160
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-itemAddedToCart');
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
try {
|
|
164
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ITEM_ADDED_TO_CART, [product.productMustMap, product.productOptMap]);
|
|
165
|
+
} catch (error) {
|
|
166
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
_defineProperty(this, "itemRemovedFromCart", function (productID) {
|
|
170
|
+
if (Utils.checkParameters([{
|
|
171
|
+
type: 'string',
|
|
172
|
+
value: productID
|
|
173
|
+
}])) {
|
|
174
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-itemRemovedFromCart');
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
try {
|
|
178
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ITEM_REMOVED_FROM_CART, [productID]);
|
|
179
|
+
} catch (error) {
|
|
180
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
_defineProperty(this, "cartCleared", function () {
|
|
184
|
+
try {
|
|
185
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.CART_CLEARED, []);
|
|
186
|
+
} catch (error) {
|
|
187
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
_defineProperty(this, "getMessageCenterData", function (limit, startDate, endDate) {
|
|
191
|
+
if (Utils.checkParameters([{
|
|
192
|
+
type: 'number',
|
|
193
|
+
value: limit
|
|
194
|
+
}, {
|
|
195
|
+
type: 'object',
|
|
196
|
+
value: startDate
|
|
197
|
+
}, {
|
|
198
|
+
type: 'object',
|
|
199
|
+
value: endDate
|
|
200
|
+
}]) || startDate.getTime() === endDate.getTime() || startDate.getTime() > endDate.getTime()) {
|
|
201
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-getMessageCenterData');
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
try {
|
|
205
|
+
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_MESSAGE_CENTER_DATA, [limit, startDate.getTime(), endDate.getTime()]);
|
|
206
|
+
} catch (error) {
|
|
207
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
_defineProperty(this, "getSmartRecommendation", function (recommendationID, locale, currency) {
|
|
211
|
+
if (Utils.checkParameters([{
|
|
212
|
+
type: 'number',
|
|
213
|
+
value: recommendationID
|
|
214
|
+
}, {
|
|
215
|
+
type: 'string',
|
|
216
|
+
value: locale
|
|
217
|
+
}, {
|
|
218
|
+
type: 'string',
|
|
219
|
+
value: currency
|
|
220
|
+
}])) {
|
|
221
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-getSmartRecommendation');
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
try {
|
|
225
|
+
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_SMART_RECOMMENDATION, [recommendationID, locale, currency]);
|
|
226
|
+
} catch (error) {
|
|
227
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
_defineProperty(this, "getSmartRecommendationWithProduct", function (product, recommendationID, locale) {
|
|
231
|
+
if (Utils.checkParameters([{
|
|
232
|
+
type: 'number',
|
|
233
|
+
value: recommendationID
|
|
234
|
+
}, {
|
|
235
|
+
type: 'string',
|
|
236
|
+
value: locale
|
|
237
|
+
}, {
|
|
238
|
+
type: 'object',
|
|
239
|
+
value: product
|
|
240
|
+
}])) {
|
|
241
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-getSmartRecommendationWithProduct');
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
try {
|
|
245
|
+
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_SMART_RECOMMENDATION_WITH_PRODUCT, [product.productMustMap, product.productOptMap, recommendationID, locale]);
|
|
246
|
+
} catch (error) {
|
|
247
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
_defineProperty(this, "getSmartRecommendationWithProductIDs", function (productIDs, recommendationID, locale, currency) {
|
|
251
|
+
if (Utils.checkParameters([{
|
|
252
|
+
type: 'number',
|
|
253
|
+
value: recommendationID
|
|
254
|
+
}, {
|
|
255
|
+
type: 'string',
|
|
256
|
+
value: locale
|
|
257
|
+
}, {
|
|
258
|
+
type: 'string',
|
|
259
|
+
value: currency
|
|
260
|
+
}, {
|
|
261
|
+
type: 'object',
|
|
262
|
+
value: productIDs
|
|
263
|
+
}])) {
|
|
264
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-getSmartRecommendationWithProductIDs');
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
productIDs = productIDs.filter(function (value) {
|
|
268
|
+
return value != null && typeof value == "string" && value.trim();
|
|
269
|
+
});
|
|
270
|
+
try {
|
|
271
|
+
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_SMART_RECOMMENDATION_WITH_PRODUCT_IDS, [productIDs, recommendationID, locale, currency]);
|
|
272
|
+
} catch (error) {
|
|
273
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
_defineProperty(this, "clickSmartRecommendationProduct", function (product, recommendationID) {
|
|
277
|
+
if (Utils.checkParameters([{
|
|
278
|
+
type: 'number',
|
|
279
|
+
value: recommendationID
|
|
280
|
+
}, {
|
|
281
|
+
type: 'object',
|
|
282
|
+
value: product
|
|
283
|
+
}])) {
|
|
284
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-clickSmartRecommendationProduct');
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
try {
|
|
288
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.CLICK_SMART_RECOMMENDATION_PRODUCT, [product.productMustMap, product.productOptMap, recommendationID]);
|
|
289
|
+
} catch (error) {
|
|
290
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
_defineProperty(this, "getContentStringWithName", function (variableName, defaultValue, contentOptimizerDataType) {
|
|
294
|
+
if (Utils.checkParameters([{
|
|
295
|
+
type: 'string',
|
|
296
|
+
value: variableName
|
|
297
|
+
}, {
|
|
298
|
+
type: 'string',
|
|
299
|
+
value: defaultValue
|
|
300
|
+
}, {
|
|
301
|
+
type: 'number',
|
|
302
|
+
value: contentOptimizerDataType
|
|
303
|
+
}])) {
|
|
304
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-getContentStringWithName');
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
try {
|
|
308
|
+
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_CONTENT_STRING_WITH_NAME, [variableName, defaultValue, contentOptimizerDataType]);
|
|
309
|
+
} catch (error) {
|
|
310
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
_defineProperty(this, "getContentBoolWithName", function (variableName, defaultValue, contentOptimizerDataType) {
|
|
314
|
+
if (Utils.checkParameters([{
|
|
315
|
+
type: 'string',
|
|
316
|
+
value: variableName
|
|
317
|
+
}, {
|
|
318
|
+
type: 'boolean',
|
|
319
|
+
value: defaultValue
|
|
320
|
+
}, {
|
|
321
|
+
type: 'number',
|
|
322
|
+
value: contentOptimizerDataType
|
|
323
|
+
}])) {
|
|
324
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-getContentBoolWithName');
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
try {
|
|
328
|
+
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_CONTENT_BOOL_WITH_NAME, [variableName, defaultValue, contentOptimizerDataType]);
|
|
329
|
+
} catch (error) {
|
|
330
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
_defineProperty(this, "getContentIntWithName", function (variableName, defaultValue, contentOptimizerDataType) {
|
|
334
|
+
if (Utils.checkParameters([{
|
|
335
|
+
type: 'string',
|
|
336
|
+
value: variableName
|
|
337
|
+
}, {
|
|
338
|
+
type: 'number',
|
|
339
|
+
value: defaultValue
|
|
340
|
+
}, {
|
|
341
|
+
type: 'number',
|
|
342
|
+
value: contentOptimizerDataType
|
|
343
|
+
}])) {
|
|
344
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-getContentIntWithName');
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
try {
|
|
348
|
+
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_CONTENT_INT_WITH_NAME, [variableName, defaultValue, contentOptimizerDataType]);
|
|
349
|
+
} catch (error) {
|
|
350
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
_defineProperty(this, "getContentStringWithoutCache", function (variableName, defaultValue, contentOptimizerDataType) {
|
|
354
|
+
if (Utils.checkParameters([{
|
|
355
|
+
type: 'string',
|
|
356
|
+
value: variableName
|
|
357
|
+
}, {
|
|
358
|
+
type: 'string',
|
|
359
|
+
value: defaultValue
|
|
360
|
+
}, {
|
|
361
|
+
type: 'number',
|
|
362
|
+
value: contentOptimizerDataType
|
|
363
|
+
}])) {
|
|
364
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-getContentStringWithoutCache');
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
try {
|
|
368
|
+
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_CONTENT_STRING_WITHOUT_CACHE, [variableName, defaultValue, contentOptimizerDataType]);
|
|
369
|
+
} catch (error) {
|
|
370
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
_defineProperty(this, "getContentBoolWithoutCache", function (variableName, defaultValue, contentOptimizerDataType) {
|
|
374
|
+
if (Utils.checkParameters([{
|
|
375
|
+
type: 'string',
|
|
376
|
+
value: variableName
|
|
377
|
+
}, {
|
|
378
|
+
type: 'boolean',
|
|
379
|
+
value: defaultValue
|
|
380
|
+
}, {
|
|
381
|
+
type: 'number',
|
|
382
|
+
value: contentOptimizerDataType
|
|
383
|
+
}])) {
|
|
384
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-getContentBoolWithoutCache');
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
try {
|
|
388
|
+
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_CONTENT_BOOL_WITHOUT_CACHE, [variableName, defaultValue, contentOptimizerDataType]);
|
|
389
|
+
} catch (error) {
|
|
390
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
_defineProperty(this, "getContentIntWithoutCache", function (variableName, defaultValue, contentOptimizerDataType) {
|
|
394
|
+
if (Utils.checkParameters([{
|
|
395
|
+
type: 'string',
|
|
396
|
+
value: variableName
|
|
397
|
+
}, {
|
|
398
|
+
type: 'number',
|
|
399
|
+
value: defaultValue
|
|
400
|
+
}, {
|
|
401
|
+
type: 'number',
|
|
402
|
+
value: contentOptimizerDataType
|
|
403
|
+
}])) {
|
|
404
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-getContentIntWithoutCache');
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
try {
|
|
408
|
+
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_CONTENT_INT_WITHOUT_CACHE, [variableName, defaultValue, contentOptimizerDataType]);
|
|
409
|
+
} catch (error) {
|
|
410
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
_defineProperty(this, "visitHomePage", function () {
|
|
414
|
+
try {
|
|
415
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.VISIT_HOME_PAGE, []);
|
|
416
|
+
} catch (error) {
|
|
417
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
_defineProperty(this, "visitListingPage", function (taxonomy) {
|
|
421
|
+
if (Utils.checkParameters([{
|
|
422
|
+
type: 'object',
|
|
423
|
+
value: taxonomy
|
|
424
|
+
}])) {
|
|
425
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-visitListingPage');
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
try {
|
|
429
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.VISIT_LISTING_PAGE, [taxonomy]);
|
|
430
|
+
} catch (error) {
|
|
431
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
_defineProperty(this, "visitProductDetailPage", function (product) {
|
|
435
|
+
if (Utils.checkParameters([{
|
|
436
|
+
type: 'object',
|
|
437
|
+
value: product
|
|
438
|
+
}])) {
|
|
439
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-visitProductDetailPage');
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
try {
|
|
443
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.VISIT_PRODUCT_DETAIL_PAGE, [product.productMustMap, product.productOptMap]);
|
|
444
|
+
} catch (error) {
|
|
445
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
_defineProperty(this, "visitCartPage", function (products) {
|
|
449
|
+
if (Utils.checkParameters([{
|
|
450
|
+
type: 'object',
|
|
451
|
+
value: products
|
|
452
|
+
}])) {
|
|
453
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-visitCartPage');
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
try {
|
|
457
|
+
var productMap = {};
|
|
458
|
+
var mappedProducts = new Array(products.length);
|
|
459
|
+
products.forEach(function (product, i) {
|
|
460
|
+
productMap['productMustMap'] = product.productMustMap;
|
|
461
|
+
productMap['productOptMap'] = product.productOptMap;
|
|
462
|
+
mappedProducts[i] = productMap;
|
|
463
|
+
});
|
|
464
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.VISIT_CART_PAGE, [mappedProducts]);
|
|
465
|
+
} catch (error) {
|
|
466
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
_defineProperty(this, "startTrackingGeofence", function () {
|
|
470
|
+
try {
|
|
471
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.START_TRACKING_GEOFENCE, []);
|
|
472
|
+
} catch (error) {
|
|
473
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
_defineProperty(this, "setGDPRConsent", function (gdprConsent) {
|
|
477
|
+
if (Utils.checkParameters([{
|
|
478
|
+
type: 'boolean',
|
|
479
|
+
value: gdprConsent
|
|
480
|
+
}])) {
|
|
481
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-setGDPRConsent');
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
try {
|
|
485
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_GDPR_CONSENT, [gdprConsent.toString().toLowerCase()]);
|
|
486
|
+
} catch (error) {
|
|
487
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
_defineProperty(this, "setMobileAppAccess", function (mobileAppAccess) {
|
|
491
|
+
if (Utils.checkParameters([{
|
|
492
|
+
type: 'boolean',
|
|
493
|
+
value: mobileAppAccess
|
|
494
|
+
}])) {
|
|
495
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-setMobileAppAccess');
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
try {
|
|
499
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_MOBILE_APP_ACCESS, [mobileAppAccess.toString().toLowerCase()]);
|
|
500
|
+
} catch (error) {
|
|
501
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
_defineProperty(this, "enableIDFACollection", function (idfaCollection) {
|
|
505
|
+
if (Utils.checkParameters([{
|
|
506
|
+
type: 'boolean',
|
|
507
|
+
value: idfaCollection
|
|
508
|
+
}])) {
|
|
509
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-enableIDFACollection');
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
try {
|
|
513
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ENABLE_IDFA_COLLECTION, [idfaCollection.toString().toLowerCase()]);
|
|
514
|
+
} catch (error) {
|
|
515
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
_defineProperty(this, "removeInapp", function () {
|
|
519
|
+
try {
|
|
520
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.REMOVE_IN_APP, []);
|
|
521
|
+
} catch (error) {
|
|
522
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
_defineProperty(this, "registerWithQuietPermission", function (permission) {
|
|
526
|
+
if (Utils.checkParameters([{
|
|
527
|
+
type: 'boolean',
|
|
528
|
+
value: permission
|
|
529
|
+
}])) {
|
|
530
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-registerWithQuietPermission');
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
try {
|
|
534
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.REGISTER_WITH_QUIET_PERMISSION, [permission.toString().toLowerCase()]);
|
|
535
|
+
} catch (error) {
|
|
536
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
_defineProperty(this, "setPushToken", function (token) {
|
|
540
|
+
if (Utils.checkParameters([{
|
|
541
|
+
type: 'string',
|
|
542
|
+
value: token
|
|
543
|
+
}])) {
|
|
544
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-setPushToken');
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
try {
|
|
548
|
+
if (cordova.platformId !== InsiderConstants.ANDROID) return;
|
|
549
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_HYBRID_PUSH_TOKEN, [token]);
|
|
550
|
+
} catch (error) {
|
|
551
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
_defineProperty(this, "enableLocationCollection", function (locationCollection) {
|
|
555
|
+
if (Utils.checkParameters([{
|
|
556
|
+
type: 'boolean',
|
|
557
|
+
value: locationCollection
|
|
558
|
+
}])) {
|
|
559
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-enableLocationCollection');
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
try {
|
|
563
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ENABLE_LOCATION_COLLECTION, [locationCollection]);
|
|
564
|
+
} catch (error) {
|
|
565
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
_defineProperty(this, "enableIpCollection", function (ipCollection) {
|
|
569
|
+
if (Utils.checkParameters([{
|
|
570
|
+
type: 'boolean',
|
|
571
|
+
value: ipCollection
|
|
572
|
+
}])) {
|
|
573
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-enableIpCollection');
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
try {
|
|
577
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ENABLE_IP_COLLECTION, [ipCollection]);
|
|
578
|
+
} catch (error) {
|
|
579
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
_defineProperty(this, "enableCarrierCollection", function (carrierCollection) {
|
|
583
|
+
if (Utils.checkParameters([{
|
|
584
|
+
type: 'boolean',
|
|
585
|
+
value: carrierCollection
|
|
586
|
+
}])) {
|
|
587
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-enableCarrierCollection');
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
try {
|
|
591
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ENABLE_CARRIER_COLLECTION, [carrierCollection]);
|
|
592
|
+
} catch (error) {
|
|
593
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
_defineProperty(this, "signUpConfirmation", function () {
|
|
597
|
+
try {
|
|
598
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SIGN_UP_CONFIRMATION, []);
|
|
599
|
+
} catch (error) {
|
|
600
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
601
|
+
}
|
|
602
|
+
});
|
|
603
|
+
_defineProperty(this, "identifier", function () {
|
|
604
|
+
try {
|
|
605
|
+
return new InsiderIdentifier();
|
|
606
|
+
} catch (error) {
|
|
607
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
_defineProperty(this, "setActiveForegroundPushView", function () {
|
|
611
|
+
try {
|
|
612
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_ACTIVE_FOREGROUND_PUSH_VIEW, []);
|
|
613
|
+
} catch (error) {
|
|
614
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
_defineProperty(this, "setForegroundPushCallback", function (callback) {
|
|
618
|
+
if (Utils.checkParameters([{
|
|
619
|
+
type: 'function',
|
|
620
|
+
value: callback
|
|
621
|
+
}])) {
|
|
622
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-setForegroundPushCallback');
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
try {
|
|
626
|
+
if (cordova.platformId === "ios") {
|
|
627
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_FOREGROUND_PUSH_CALLBACK, []);
|
|
628
|
+
document.addEventListener('ins_foreground_push_callback', function (data) {
|
|
629
|
+
data && callback(data);
|
|
630
|
+
}, false);
|
|
631
|
+
}
|
|
632
|
+
} catch (error) {
|
|
633
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
_defineProperty(this, "handleNotification", function (userInfo) {
|
|
637
|
+
if (Utils.checkParameters([{
|
|
638
|
+
type: 'object',
|
|
639
|
+
value: userInfo
|
|
640
|
+
}])) {
|
|
641
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-setForegroundPushCallback');
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
try {
|
|
645
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.HANDLE_NOTIFICATION, [userInfo]);
|
|
646
|
+
} catch (error) {
|
|
647
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
_defineProperty(this, "getInsiderID", function () {
|
|
651
|
+
try {
|
|
652
|
+
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_INSIDER_ID, []);
|
|
653
|
+
} catch (error) {
|
|
654
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
655
|
+
return null;
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
_defineProperty(this, "registerInsiderIDListener", function (insiderIDCallback) {
|
|
659
|
+
try {
|
|
660
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.REGISTER_INSIDER_ID_LISTENER, []);
|
|
661
|
+
document.addEventListener('ins_insider_id_listener', function (event) {
|
|
662
|
+
if (event.insiderID) {
|
|
663
|
+
insiderIDCallback(event.insiderID);
|
|
664
|
+
}
|
|
665
|
+
}, false);
|
|
666
|
+
} catch (error) {
|
|
667
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
_defineProperty(this, "disableInAppMessages", function () {
|
|
671
|
+
try {
|
|
672
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.DISABLE_IN_APP_MESSAGES, []);
|
|
673
|
+
} catch (error) {
|
|
674
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
_defineProperty(this, "enableInAppMessages", function () {
|
|
678
|
+
try {
|
|
679
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ENABLE_IN_APP_MESSAGES, []);
|
|
680
|
+
} catch (error) {
|
|
681
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
_defineProperty(this, "itemAddedToWishlist", function (product) {
|
|
685
|
+
if (Utils.checkParameters([{
|
|
686
|
+
type: 'object',
|
|
687
|
+
value: product
|
|
688
|
+
}])) {
|
|
689
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-itemAddedToWishlist');
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
try {
|
|
693
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ITEM_ADDED_TO_WISHLIST, [product.productMustMap, product.productOptMap]);
|
|
694
|
+
} catch (error) {
|
|
695
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
_defineProperty(this, "itemRemovedFromWishlist", function (productID) {
|
|
699
|
+
if (Utils.checkParameters([{
|
|
700
|
+
type: 'string',
|
|
701
|
+
value: productID
|
|
702
|
+
}])) {
|
|
703
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-itemRemovedFromWishlist');
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
try {
|
|
707
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.ITEM_REMOVED_FROM_WISHLIST, [productID]);
|
|
708
|
+
} catch (error) {
|
|
709
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
710
|
+
}
|
|
711
|
+
});
|
|
712
|
+
_defineProperty(this, "wishlistCleared", function () {
|
|
713
|
+
try {
|
|
714
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.WISHLIST_CLEARED, []);
|
|
715
|
+
} catch (error) {
|
|
716
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
717
|
+
}
|
|
718
|
+
});
|
|
719
|
+
_defineProperty(this, "visitWishlistPage", function (products) {
|
|
720
|
+
if (Utils.checkParameters([{
|
|
721
|
+
type: 'object',
|
|
722
|
+
value: products
|
|
723
|
+
}])) {
|
|
724
|
+
Utils.showParameterWarningLog(_this.constructor.name + '-visitWishlistPage');
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
try {
|
|
728
|
+
var productMap = {};
|
|
729
|
+
var mappedProducts = new Array(products.length);
|
|
730
|
+
products.forEach(function (product, i) {
|
|
731
|
+
productMap['productMustMap'] = product.productMustMap;
|
|
732
|
+
productMap['productOptMap'] = product.productOptMap;
|
|
733
|
+
mappedProducts[i] = productMap;
|
|
734
|
+
});
|
|
735
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.VISIT_WISHLIST_PAGE, [mappedProducts]);
|
|
736
|
+
} catch (error) {
|
|
737
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
this.insiderUser = new InsiderUser();
|
|
741
|
+
});
|
|
621
742
|
module.exports = new InsiderPlugin();
|