cordova-plugin-insider 2.3.0 → 2.4.1
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/package.json +14 -3
- package/plugin.xml +2 -2
- package/src/android/Constants.java +9 -0
- package/src/android/InsiderPlugin.java +51 -16
- package/src/android/build-extras.gradle +6 -5
- package/src/ios/InsiderPlugin.m +5 -1
- package/www/CallbackType.js +9 -7
- package/www/Constants.js +112 -101
- 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 -679
- package/www/Product.js +429 -236
- package/www/User.js +410 -324
- package/www/Utils.js +18 -16
package/www/Product.js
CHANGED
|
@@ -1,274 +1,467 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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;
|
|
19
42
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
this.productOptMap[InsiderConstants.COLOR] = color;
|
|
29
|
-
} catch (error) {
|
|
30
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
31
|
-
}
|
|
32
|
-
|
|
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');
|
|
33
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;
|
|
34
59
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.productOptMap[InsiderConstants.VOUCHER_NAME] = voucherName;
|
|
44
|
-
} catch (error) {
|
|
45
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
46
|
-
}
|
|
47
|
-
|
|
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');
|
|
48
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;
|
|
49
76
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this.productOptMap[InsiderConstants.PROMOTION_NAME] = promotionName;
|
|
59
|
-
} catch (error) {
|
|
60
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
61
|
-
}
|
|
62
|
-
|
|
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');
|
|
63
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;
|
|
64
93
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.productOptMap[InsiderConstants.SIZE] = size;
|
|
74
|
-
} catch (error) {
|
|
75
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
76
|
-
}
|
|
77
|
-
|
|
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');
|
|
78
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;
|
|
79
110
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
this.productOptMap[InsiderConstants.GROUP_CODE] = groupCode;
|
|
89
|
-
} catch (error) {
|
|
90
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
91
|
-
}
|
|
92
|
-
|
|
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');
|
|
93
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;
|
|
94
127
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
this.productOptMap[InsiderConstants.SALE_PRICE] = salePrice;
|
|
104
|
-
} catch (error) {
|
|
105
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
106
|
-
}
|
|
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');
|
|
107
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;
|
|
108
144
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
this.productOptMap[InsiderConstants.SHIPPING_COST] = shippingCost;
|
|
118
|
-
} catch (error) {
|
|
119
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
120
|
-
}
|
|
121
|
-
|
|
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');
|
|
122
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;
|
|
123
161
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
this.productOptMap[InsiderConstants.VOUCHER_DISCOUNT] = voucherDiscount;
|
|
133
|
-
} catch (error) {
|
|
134
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
135
|
-
}
|
|
136
|
-
|
|
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');
|
|
137
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;
|
|
138
178
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
this.productOptMap[InsiderConstants.PROMOTION_DISCOUNT] = promotionDiscount;
|
|
148
|
-
} catch (error) {
|
|
149
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
150
|
-
}
|
|
151
|
-
|
|
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');
|
|
152
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;
|
|
153
195
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
this.productOptMap[InsiderConstants.STOCK] = stock;
|
|
163
|
-
} catch (error) {
|
|
164
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
165
|
-
}
|
|
166
|
-
|
|
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');
|
|
167
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;
|
|
168
212
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
this.productOptMap[InsiderConstants.QUANTITY] = quantity;
|
|
178
|
-
} catch (error) {
|
|
179
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
180
|
-
}
|
|
181
|
-
|
|
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');
|
|
182
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;
|
|
183
229
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
this.productOptMap[key] = value;
|
|
193
|
-
} catch (error) {
|
|
194
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
195
|
-
}
|
|
196
|
-
|
|
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');
|
|
197
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;
|
|
198
246
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
try {
|
|
207
|
-
this.productOptMap[key] = value;
|
|
208
|
-
} catch (error) {
|
|
209
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
210
|
-
}
|
|
247
|
+
}, {
|
|
248
|
+
key: "setDescription",
|
|
249
|
+
value: function setDescription(description) {
|
|
250
|
+
if (description == null) {
|
|
251
|
+
Utils.showParameterWarningLog(this.constructor.name + '-description');
|
|
211
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;
|
|
212
260
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
try {
|
|
221
|
-
this.productOptMap[key] = value;
|
|
222
|
-
} catch (error) {
|
|
223
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
224
|
-
}
|
|
261
|
+
}, {
|
|
262
|
+
key: "setSku",
|
|
263
|
+
value: function setSku(sku) {
|
|
264
|
+
if (sku == null) {
|
|
265
|
+
Utils.showParameterWarningLog(this.constructor.name + '-sku');
|
|
225
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;
|
|
226
274
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
try {
|
|
235
|
-
this.productOptMap[key] = value;
|
|
236
|
-
} catch (error) {
|
|
237
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
238
|
-
}
|
|
239
|
-
|
|
275
|
+
}, {
|
|
276
|
+
key: "setMultipack",
|
|
277
|
+
value: function setMultipack(multipack) {
|
|
278
|
+
if (multipack == null) {
|
|
279
|
+
Utils.showParameterWarningLog(this.constructor.name + '-multipack');
|
|
240
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;
|
|
241
288
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
try {
|
|
250
|
-
this.productOptMap[key] = value.toISOString();
|
|
251
|
-
} catch (error) {
|
|
252
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
253
|
-
}
|
|
254
|
-
|
|
289
|
+
}, {
|
|
290
|
+
key: "setProductType",
|
|
291
|
+
value: function setProductType(productType) {
|
|
292
|
+
if (productType == null) {
|
|
293
|
+
Utils.showParameterWarningLog(this.constructor.name + '-productType');
|
|
255
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;
|
|
256
302
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
try {
|
|
265
|
-
this.productOptMap[key] = value;
|
|
266
|
-
} catch (error) {
|
|
267
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
268
|
-
}
|
|
269
|
-
|
|
303
|
+
}, {
|
|
304
|
+
key: "setGtin",
|
|
305
|
+
value: function setGtin(gtin) {
|
|
306
|
+
if (gtin == null) {
|
|
307
|
+
Utils.showParameterWarningLog(this.constructor.name + '-gtin');
|
|
270
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;
|
|
271
316
|
}
|
|
272
|
-
}
|
|
273
|
-
|
|
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
|
+
}();
|
|
274
467
|
module.exports = Product;
|