cordova-plugin-insider 3.0.2 → 3.1.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/www/Product.js DELETED
@@ -1,507 +0,0 @@
1
- "use strict";
2
-
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 _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
5
- 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); } }
6
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
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 InsiderConstants = require("./Constants");
11
- var Utils = require("./Utils");
12
- var Product = /*#__PURE__*/function () {
13
- function Product(productID, name, taxonomy, imageURL, price, currency) {
14
- _classCallCheck(this, Product);
15
- _defineProperty(this, "productMustMap", {});
16
- _defineProperty(this, "productOptMap", {});
17
- this.productMustMap = {
18
- product_id: productID,
19
- name: name,
20
- taxonomy: taxonomy,
21
- image_url: imageURL,
22
- unit_price: price,
23
- currency: currency
24
- };
25
- }
26
- return _createClass(Product, [{
27
- key: "setColor",
28
- value: function setColor(color) {
29
- if (Utils.checkParameters([{
30
- type: 'string',
31
- value: color
32
- }])) {
33
- Utils.showParameterWarningLog(this.constructor.name + '-color');
34
- return this;
35
- }
36
- try {
37
- this.productOptMap[InsiderConstants.COLOR] = color;
38
- } catch (error) {
39
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
40
- }
41
- return this;
42
- }
43
- }, {
44
- key: "setVoucherName",
45
- value: function setVoucherName(voucherName) {
46
- if (Utils.checkParameters([{
47
- type: 'string',
48
- value: voucherName
49
- }])) {
50
- Utils.showParameterWarningLog(this.constructor.name + '-voucherName');
51
- return this;
52
- }
53
- try {
54
- this.productOptMap[InsiderConstants.VOUCHER_NAME] = voucherName;
55
- } catch (error) {
56
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
57
- }
58
- return this;
59
- }
60
- }, {
61
- key: "setPromotionName",
62
- value: function setPromotionName(promotionName) {
63
- if (Utils.checkParameters([{
64
- type: 'string',
65
- value: promotionName
66
- }])) {
67
- Utils.showParameterWarningLog(this.constructor.name + '-promotionName');
68
- return this;
69
- }
70
- try {
71
- this.productOptMap[InsiderConstants.PROMOTION_NAME] = promotionName;
72
- } catch (error) {
73
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
74
- }
75
- return this;
76
- }
77
- }, {
78
- key: "setSize",
79
- value: function setSize(size) {
80
- if (Utils.checkParameters([{
81
- type: 'string',
82
- value: size
83
- }])) {
84
- Utils.showParameterWarningLog(this.constructor.name + '-size');
85
- return this;
86
- }
87
- try {
88
- this.productOptMap[InsiderConstants.SIZE] = size;
89
- } catch (error) {
90
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
91
- }
92
- return this;
93
- }
94
- }, {
95
- key: "setGroupCode",
96
- value: function setGroupCode(groupCode) {
97
- if (Utils.checkParameters([{
98
- type: 'string',
99
- value: groupCode
100
- }])) {
101
- Utils.showParameterWarningLog(this.constructor.name + '-groupCode');
102
- return this;
103
- }
104
- try {
105
- this.productOptMap[InsiderConstants.GROUP_CODE] = groupCode;
106
- } catch (error) {
107
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
108
- }
109
- return this;
110
- }
111
- }, {
112
- key: "setSalePrice",
113
- value: function setSalePrice(salePrice) {
114
- if (Utils.checkParameters([{
115
- type: 'number',
116
- value: salePrice
117
- }])) {
118
- Utils.showParameterWarningLog(this.constructor.name + '-salePrice');
119
- return this;
120
- }
121
- try {
122
- this.productOptMap[InsiderConstants.SALE_PRICE] = salePrice;
123
- } catch (error) {
124
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
125
- }
126
- return this;
127
- }
128
- }, {
129
- key: "setShippingCost",
130
- value: function setShippingCost(shippingCost) {
131
- if (Utils.checkParameters([{
132
- type: 'number',
133
- value: shippingCost
134
- }])) {
135
- Utils.showParameterWarningLog(this.constructor.name + '-shippingCost');
136
- return this;
137
- }
138
- try {
139
- this.productOptMap[InsiderConstants.SHIPPING_COST] = shippingCost;
140
- } catch (error) {
141
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
142
- }
143
- return this;
144
- }
145
- }, {
146
- key: "setVoucherDiscount",
147
- value: function setVoucherDiscount(voucherDiscount) {
148
- if (Utils.checkParameters([{
149
- type: 'number',
150
- value: voucherDiscount
151
- }])) {
152
- Utils.showParameterWarningLog(this.constructor.name + '-voucherDiscount');
153
- return this;
154
- }
155
- try {
156
- this.productOptMap[InsiderConstants.VOUCHER_DISCOUNT] = voucherDiscount;
157
- } catch (error) {
158
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
159
- }
160
- return this;
161
- }
162
- }, {
163
- key: "setPromotionDiscount",
164
- value: function setPromotionDiscount(promotionDiscount) {
165
- if (Utils.checkParameters([{
166
- type: 'number',
167
- value: promotionDiscount
168
- }])) {
169
- Utils.showParameterWarningLog(this.constructor.name + '-promotionDiscount');
170
- return this;
171
- }
172
- try {
173
- this.productOptMap[InsiderConstants.PROMOTION_DISCOUNT] = promotionDiscount;
174
- } catch (error) {
175
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
176
- }
177
- return this;
178
- }
179
- }, {
180
- key: "setStock",
181
- value: function setStock(stock) {
182
- if (Utils.checkParameters([{
183
- type: 'number',
184
- value: stock
185
- }])) {
186
- Utils.showParameterWarningLog(this.constructor.name + '-stock');
187
- return this;
188
- }
189
- try {
190
- this.productOptMap[InsiderConstants.STOCK] = stock;
191
- } catch (error) {
192
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
193
- }
194
- return this;
195
- }
196
- }, {
197
- key: "setQuantity",
198
- value: function setQuantity(quantity) {
199
- if (Utils.checkParameters([{
200
- type: 'number',
201
- value: quantity
202
- }])) {
203
- Utils.showParameterWarningLog(this.constructor.name + '-quantity');
204
- return this;
205
- }
206
- try {
207
- this.productOptMap[InsiderConstants.QUANTITY] = quantity;
208
- } catch (error) {
209
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
210
- }
211
- return this;
212
- }
213
- }, {
214
- key: "setBrand",
215
- value: function setBrand(brand) {
216
- if (Utils.checkParameters([{
217
- type: 'string',
218
- value: brand
219
- }]) || !brand) {
220
- Utils.showParameterWarningLog(this.constructor.name + '-brand');
221
- return this;
222
- }
223
- try {
224
- this.productOptMap[InsiderConstants.BRAND] = brand;
225
- } catch (error) {
226
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
227
- }
228
- return this;
229
- }
230
- }, {
231
- key: "setGender",
232
- value: function setGender(gender) {
233
- if (Utils.checkParameters([{
234
- type: 'string',
235
- value: gender
236
- }]) || !gender) {
237
- Utils.showParameterWarningLog(this.constructor.name + '-gender');
238
- return this;
239
- }
240
- try {
241
- this.productOptMap[InsiderConstants.PRODUCT_GENDER] = gender;
242
- } catch (error) {
243
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
244
- }
245
- return this;
246
- }
247
- }, {
248
- key: "setDescription",
249
- value: function setDescription(description) {
250
- if (description == null) {
251
- Utils.showParameterWarningLog(this.constructor.name + '-description');
252
- return this;
253
- }
254
- try {
255
- this.productOptMap[InsiderConstants.DESCRIPTION] = description;
256
- } catch (error) {
257
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
258
- }
259
- return this;
260
- }
261
- }, {
262
- key: "setSku",
263
- value: function setSku(sku) {
264
- if (sku == null) {
265
- Utils.showParameterWarningLog(this.constructor.name + '-sku');
266
- return this;
267
- }
268
- try {
269
- this.productOptMap[InsiderConstants.SKU] = sku;
270
- } catch (error) {
271
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
272
- }
273
- return this;
274
- }
275
- }, {
276
- key: "setMultipack",
277
- value: function setMultipack(multipack) {
278
- if (multipack == null) {
279
- Utils.showParameterWarningLog(this.constructor.name + '-multipack');
280
- return this;
281
- }
282
- try {
283
- this.productOptMap[InsiderConstants.MULTIPACK] = multipack;
284
- } catch (error) {
285
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
286
- }
287
- return this;
288
- }
289
- }, {
290
- key: "setProductType",
291
- value: function setProductType(productType) {
292
- if (productType == null) {
293
- Utils.showParameterWarningLog(this.constructor.name + '-productType');
294
- return this;
295
- }
296
- try {
297
- this.productOptMap[InsiderConstants.PRODUCT_TYPE] = productType;
298
- } catch (error) {
299
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
300
- }
301
- return this;
302
- }
303
- }, {
304
- key: "setGtin",
305
- value: function setGtin(gtin) {
306
- if (gtin == null) {
307
- Utils.showParameterWarningLog(this.constructor.name + '-gtin');
308
- return this;
309
- }
310
- try {
311
- this.productOptMap[InsiderConstants.GTIN] = gtin;
312
- } catch (error) {
313
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
314
- }
315
- return this;
316
- }
317
- }, {
318
- key: "setTags",
319
- value: function setTags(tags) {
320
- if (tags == null || !Array.isArray(tags)) {
321
- Utils.showParameterWarningLog(this.constructor.name + '-tags');
322
- return this;
323
- }
324
- try {
325
- this.productOptMap[InsiderConstants.TAGS] = tags;
326
- } catch (error) {
327
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
328
- }
329
- return this;
330
- }
331
- }, {
332
- key: "setInStock",
333
- value: function setInStock(isInStock) {
334
- if (typeof isInStock !== 'boolean') {
335
- Utils.showParameterWarningLog(this.constructor.name + '-isInStock');
336
- return this;
337
- }
338
- try {
339
- this.productOptMap[InsiderConstants.IS_IN_STOCK] = isInStock;
340
- } catch (error) {
341
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
342
- }
343
- return this;
344
- }
345
- }, {
346
- key: "setCustomAttributeWithString",
347
- value: function setCustomAttributeWithString(key, value) {
348
- if (Utils.checkParameters([{
349
- type: 'string',
350
- value: key
351
- }, {
352
- type: 'string',
353
- value: value
354
- }])) {
355
- Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithString');
356
- return this;
357
- }
358
- try {
359
- this.productOptMap[key] = value;
360
- } catch (error) {
361
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
362
- }
363
- return this;
364
- }
365
- }, {
366
- key: "setCustomAttributeWithInt",
367
- value: function setCustomAttributeWithInt(key, value) {
368
- if (Utils.checkParameters([{
369
- type: 'string',
370
- value: key
371
- }, {
372
- type: 'number',
373
- value: value
374
- }])) {
375
- Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithInt');
376
- return this;
377
- }
378
- try {
379
- this.productOptMap[key] = value;
380
- } catch (error) {
381
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
382
- }
383
- return this;
384
- }
385
- }, {
386
- key: "setCustomAttributeWithBoolean",
387
- value: function setCustomAttributeWithBoolean(key, value) {
388
- if (Utils.checkParameters([{
389
- type: 'string',
390
- value: key
391
- }, {
392
- type: 'boolean',
393
- value: value
394
- }])) {
395
- Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithBoolean');
396
- return this;
397
- }
398
- try {
399
- this.productOptMap[key] = value;
400
- } catch (error) {
401
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
402
- }
403
- return this;
404
- }
405
- }, {
406
- key: "setCustomAttributeWithDouble",
407
- value: function setCustomAttributeWithDouble(key, value) {
408
- if (Utils.checkParameters([{
409
- type: 'string',
410
- value: key
411
- }, {
412
- type: 'number',
413
- value: value
414
- }])) {
415
- Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithDouble');
416
- return this;
417
- }
418
- try {
419
- this.productOptMap[key] = value;
420
- } catch (error) {
421
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
422
- }
423
- return this;
424
- }
425
- }, {
426
- key: "setCustomAttributeWithDate",
427
- value: function setCustomAttributeWithDate(key, value) {
428
- if (Utils.checkParameters([{
429
- type: 'string',
430
- value: key
431
- }, {
432
- type: 'object',
433
- value: value
434
- }])) {
435
- Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithDate');
436
- return this;
437
- }
438
- try {
439
- this.productOptMap[key] = value.toISOString();
440
- } catch (error) {
441
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
442
- }
443
- return this;
444
- }
445
- }, {
446
- key: "setCustomAttributeWithArray",
447
- value: function setCustomAttributeWithArray(key, value) {
448
- if (Utils.checkParameters([{
449
- type: 'string',
450
- value: key
451
- }, {
452
- type: 'object',
453
- value: value
454
- }])) {
455
- Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithArray');
456
- return this;
457
- }
458
- try {
459
- this.productOptMap[key] = value;
460
- } catch (error) {
461
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
462
- }
463
- return this;
464
- }
465
- }, {
466
- key: "setCustomAttributeWithStringArray",
467
- value: function setCustomAttributeWithStringArray(key, value) {
468
- if (Utils.checkParameters([{
469
- type: 'string',
470
- value: key
471
- }, {
472
- type: 'string_array',
473
- value: value
474
- }])) {
475
- Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithStringArray');
476
- return this;
477
- }
478
- try {
479
- this.productOptMap[key] = value;
480
- } catch (error) {
481
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
482
- }
483
- return this;
484
- }
485
- }, {
486
- key: "setCustomAttributeWithNumericArray",
487
- value: function setCustomAttributeWithNumericArray(key, value) {
488
- if (Utils.checkParameters([{
489
- type: 'string',
490
- value: key
491
- }, {
492
- type: 'numeric_array',
493
- value: value
494
- }])) {
495
- Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithNumericArray');
496
- return this;
497
- }
498
- try {
499
- this.productOptMap[key] = value;
500
- } catch (error) {
501
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
502
- }
503
- return this;
504
- }
505
- }]);
506
- }();
507
- module.exports = Product;