react-native-insider 7.0.5-nh → 7.0.6-nh

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.
@@ -4,49 +4,18 @@ import { shouldNotProceed, generateJSONErrorString, checkParameters, showParamet
4
4
 
5
5
  const Insider = NativeModules.RNInsider;
6
6
 
7
- // Must
8
- const PRODUCT_ID = 'product_id';
9
- const PRODUCT_NAME = 'name';
10
- const TAXONOMY = 'taxonomy';
11
- const CURRENCY = 'currency';
12
- const UNIT_PRICE = 'unit_price';
13
- const IMAGE_URL = 'image_url';
14
-
15
- // Optional
16
- const SUB_CATEGORY = 'sub_category';
17
- const SALE_PRICE = 'sale_price';
18
- const STOCK = 'stock';
19
- const COLOR = 'color';
20
- const SIZE = 'size';
21
- const QUANTITY = 'quantity';
22
- const SHIPPING_COST = 'shipping_cost';
23
- const VOUCHER_NAME = 'voucher_name';
24
- const VOUCHER_DISCOUNT = 'voucher_discount';
25
- const PROMOTION_NAME = 'promotion_name';
26
- const PROMOTION_DISCOUNT = 'promotion_discount';
27
- const GROUP_CODE = 'groupcode';
28
- const BRAND = 'brnd';
29
- const SKU = 'sku';
30
- const PRODUCT_GENDER = 'ge';
31
- const MULTIPACK = 'mlt';
32
- const PRODUCT_TYPE = 'pt';
33
- const GTIN = 'gt';
34
- const DESCRIPTION = 'desc';
35
- const TAGS = 'tags';
36
- const IS_IN_STOCK = 'iis';
37
- const PRODUCT_URL = 'url';
38
-
39
-
40
7
  export default class RNInsiderProduct {
41
- productMustMap = {};
42
- productOptMap = {};
8
+ requiredFields = {};
9
+ optionalFields = {};
10
+ customParameters = [];
11
+
43
12
  constructor(productID, name, taxonomy, imageURL, price, currency) {
44
- this.productMustMap = {
13
+ this.requiredFields = {
45
14
  product_id: productID,
46
15
  name: name,
47
16
  taxonomy: taxonomy,
48
17
  image_url: imageURL,
49
- unit_price: price,
18
+ price: price,
50
19
  currency: currency,
51
20
  };
52
21
  }
@@ -58,7 +27,7 @@ export default class RNInsiderProduct {
58
27
  return this;
59
28
  }
60
29
  try {
61
- this.productOptMap[COLOR] = color;
30
+ this.optionalFields["color"] = color;
62
31
  } catch (error) {
63
32
  Insider.putErrorLog(generateJSONErrorString(error));
64
33
  }
@@ -72,7 +41,7 @@ export default class RNInsiderProduct {
72
41
  return this;
73
42
  }
74
43
  try {
75
- this.productOptMap[VOUCHER_NAME] = voucherName;
44
+ this.optionalFields["voucher_name"] = voucherName;
76
45
  } catch (error) {
77
46
  Insider.putErrorLog(generateJSONErrorString(error));
78
47
  }
@@ -86,7 +55,7 @@ export default class RNInsiderProduct {
86
55
  return this;
87
56
  }
88
57
  try {
89
- this.productOptMap[PROMOTION_NAME] = promotionName;
58
+ this.optionalFields["promotion_name"] = promotionName;
90
59
  } catch (error) {
91
60
  Insider.putErrorLog(generateJSONErrorString(error));
92
61
  }
@@ -100,7 +69,7 @@ export default class RNInsiderProduct {
100
69
  return this;
101
70
  }
102
71
  try {
103
- this.productOptMap[SIZE] = size;
72
+ this.optionalFields["size"] = size;
104
73
  } catch (error) {
105
74
  Insider.putErrorLog(generateJSONErrorString(error));
106
75
  }
@@ -114,7 +83,7 @@ export default class RNInsiderProduct {
114
83
  return this;
115
84
  }
116
85
  try {
117
- this.productOptMap[SALE_PRICE] = salePrice;
86
+ this.optionalFields["sale_price"] = salePrice;
118
87
  } catch (error) {
119
88
  Insider.putErrorLog(generateJSONErrorString(error));
120
89
  }
@@ -128,7 +97,7 @@ export default class RNInsiderProduct {
128
97
  return this;
129
98
  }
130
99
  try {
131
- this.productOptMap[SHIPPING_COST] = shippingCost;
100
+ this.optionalFields["shipping_cost"] = shippingCost;
132
101
  } catch (error) {
133
102
  Insider.putErrorLog(generateJSONErrorString(error));
134
103
  }
@@ -142,7 +111,7 @@ export default class RNInsiderProduct {
142
111
  return this;
143
112
  }
144
113
  try {
145
- this.productOptMap[VOUCHER_DISCOUNT] = voucherDiscount;
114
+ this.optionalFields["voucher_discount"] = voucherDiscount;
146
115
  } catch (error) {
147
116
  Insider.putErrorLog(generateJSONErrorString(error));
148
117
  }
@@ -156,7 +125,7 @@ export default class RNInsiderProduct {
156
125
  return this;
157
126
  }
158
127
  try {
159
- this.productOptMap[PROMOTION_DISCOUNT] = promotionDiscount;
128
+ this.optionalFields["promotion_discount"] = promotionDiscount;
160
129
  } catch (error) {
161
130
  Insider.putErrorLog(generateJSONErrorString(error));
162
131
  }
@@ -170,7 +139,7 @@ export default class RNInsiderProduct {
170
139
  return this;
171
140
  }
172
141
  try {
173
- this.productOptMap[STOCK] = stock;
142
+ this.optionalFields["stock"] = stock;
174
143
  } catch (error) {
175
144
  Insider.putErrorLog(generateJSONErrorString(error));
176
145
  }
@@ -184,7 +153,7 @@ export default class RNInsiderProduct {
184
153
  return this;
185
154
  }
186
155
  try {
187
- this.productOptMap[QUANTITY] = quantity;
156
+ this.optionalFields["quantity"] = quantity;
188
157
  } catch (error) {
189
158
  Insider.putErrorLog(generateJSONErrorString(error));
190
159
  }
@@ -198,7 +167,7 @@ export default class RNInsiderProduct {
198
167
  return this;
199
168
  }
200
169
  try {
201
- this.productOptMap[GROUP_CODE] = groupCode;
170
+ this.optionalFields["group_code"] = groupCode;
202
171
  } catch (error) {
203
172
  Insider.putErrorLog(generateJSONErrorString(error));
204
173
  }
@@ -212,7 +181,7 @@ export default class RNInsiderProduct {
212
181
  return this;
213
182
  }
214
183
  try {
215
- this.productOptMap[BRAND] = brand;
184
+ this.optionalFields["brand"] = brand;
216
185
  } catch (error) {
217
186
  Insider.putErrorLog(generateJSONErrorString(error));
218
187
  }
@@ -226,7 +195,7 @@ export default class RNInsiderProduct {
226
195
  return this;
227
196
  }
228
197
  try {
229
- this.productOptMap[SKU] = sku;
198
+ this.optionalFields["sku"] = sku;
230
199
  } catch (error) {
231
200
  Insider.putErrorLog(generateJSONErrorString(error));
232
201
  }
@@ -240,7 +209,7 @@ export default class RNInsiderProduct {
240
209
  return this;
241
210
  }
242
211
  try {
243
- this.productOptMap[PRODUCT_GENDER] = gender;
212
+ this.optionalFields["gender"] = gender;
244
213
  } catch (error) {
245
214
  Insider.putErrorLog(generateJSONErrorString(error));
246
215
  }
@@ -254,7 +223,7 @@ export default class RNInsiderProduct {
254
223
  return this;
255
224
  }
256
225
  try {
257
- this.productOptMap[MULTIPACK] = multipack;
226
+ this.optionalFields["multipack"] = multipack;
258
227
  } catch (error) {
259
228
  Insider.putErrorLog(generateJSONErrorString(error));
260
229
  }
@@ -268,7 +237,7 @@ export default class RNInsiderProduct {
268
237
  return this;
269
238
  }
270
239
  try {
271
- this.productOptMap[PRODUCT_TYPE] = productType;
240
+ this.optionalFields["product_type"] = productType;
272
241
  } catch (error) {
273
242
  Insider.putErrorLog(generateJSONErrorString(error));
274
243
  }
@@ -282,7 +251,7 @@ export default class RNInsiderProduct {
282
251
  return this;
283
252
  }
284
253
  try {
285
- this.productOptMap[GTIN] = gtin;
254
+ this.optionalFields["gtin"] = gtin;
286
255
  } catch (error) {
287
256
  Insider.putErrorLog(generateJSONErrorString(error));
288
257
  }
@@ -296,7 +265,7 @@ export default class RNInsiderProduct {
296
265
  return this;
297
266
  }
298
267
  try {
299
- this.productOptMap[DESCRIPTION] = description;
268
+ this.optionalFields["description"] = description;
300
269
  } catch (error) {
301
270
  Insider.putErrorLog(generateJSONErrorString(error));
302
271
  }
@@ -310,7 +279,7 @@ export default class RNInsiderProduct {
310
279
  return this;
311
280
  }
312
281
  try {
313
- this.productOptMap[TAGS] = tags;
282
+ this.optionalFields["tags"] = tags;
314
283
  } catch (error) {
315
284
  Insider.putErrorLog(generateJSONErrorString(error));
316
285
  }
@@ -324,7 +293,7 @@ export default class RNInsiderProduct {
324
293
  return this;
325
294
  }
326
295
  try {
327
- this.productOptMap[IS_IN_STOCK] = isInStock;
296
+ this.optionalFields["in_stock"] = isInStock;
328
297
  } catch (error) {
329
298
  Insider.putErrorLog(generateJSONErrorString(error));
330
299
  }
@@ -338,7 +307,7 @@ export default class RNInsiderProduct {
338
307
  return this;
339
308
  }
340
309
  try {
341
- this.productOptMap[PRODUCT_URL] = productURL;
310
+ this.optionalFields["product_url"] = productURL;
342
311
  } catch (error) {
343
312
  Insider.putErrorLog(generateJSONErrorString(error));
344
313
  }
@@ -352,7 +321,7 @@ export default class RNInsiderProduct {
352
321
  return this;
353
322
  }
354
323
  try {
355
- this.productOptMap[key] = value;
324
+ this.customParameters.push({ type: 'string', key, value });
356
325
  } catch (error) {
357
326
  Insider.putErrorLog(generateJSONErrorString(error));
358
327
  }
@@ -366,7 +335,7 @@ export default class RNInsiderProduct {
366
335
  return this;
367
336
  }
368
337
  try {
369
- this.productOptMap[key] = value;
338
+ this.customParameters.push({ type: 'integer', key, value });
370
339
  } catch (error) {
371
340
  Insider.putErrorLog(generateJSONErrorString(error));
372
341
  }
@@ -380,7 +349,7 @@ export default class RNInsiderProduct {
380
349
  return this;
381
350
  }
382
351
  try {
383
- this.productOptMap[key] = value;
352
+ this.customParameters.push({ type: 'boolean', key, value });
384
353
  } catch (error) {
385
354
  Insider.putErrorLog(generateJSONErrorString(error));
386
355
  }
@@ -394,7 +363,7 @@ export default class RNInsiderProduct {
394
363
  return this;
395
364
  }
396
365
  try {
397
- this.productOptMap[key] = value;
366
+ this.customParameters.push({ type: 'double', key, value });
398
367
  } catch (error) {
399
368
  Insider.putErrorLog(generateJSONErrorString(error));
400
369
  }
@@ -408,7 +377,7 @@ export default class RNInsiderProduct {
408
377
  return this;
409
378
  }
410
379
  try {
411
- this.productOptMap[key] = value.toISOString();
380
+ this.customParameters.push({ type: 'date', key, value: value.getTime().toString() });
412
381
  } catch (error) {
413
382
  Insider.putErrorLog(generateJSONErrorString(error));
414
383
  }
@@ -422,7 +391,7 @@ export default class RNInsiderProduct {
422
391
  return this;
423
392
  }
424
393
  try {
425
- this.productOptMap[key] = value;
394
+ this.customParameters.push({ type: 'strings', key, value });
426
395
  } catch (error) {
427
396
  Insider.putErrorLog(generateJSONErrorString(error));
428
397
  }
@@ -436,7 +405,7 @@ export default class RNInsiderProduct {
436
405
  return this;
437
406
  }
438
407
  try {
439
- this.productOptMap[key] = value;
408
+ this.customParameters.push({ type: 'strings', key, value });
440
409
  } catch (error) {
441
410
  Insider.putErrorLog(generateJSONErrorString(error));
442
411
  }
@@ -450,7 +419,7 @@ export default class RNInsiderProduct {
450
419
  return this;
451
420
  }
452
421
  try {
453
- this.productOptMap[key] = value;
422
+ this.customParameters.push({ type: 'numbers', key, value });
454
423
  } catch (error) {
455
424
  Insider.putErrorLog(generateJSONErrorString(error));
456
425
  }
@@ -26,7 +26,7 @@ export default class RNInsiderUser {
26
26
  return this;
27
27
  }
28
28
  try {
29
- Insider.setBirthday(value.toISOString());
29
+ Insider.setBirthday(value.getTime().toString());
30
30
  } catch (error) {
31
31
  Insider.putErrorLog(generateJSONErrorString(error));
32
32
  }
@@ -332,7 +332,7 @@ export default class RNInsiderUser {
332
332
  return this;
333
333
  }
334
334
  try {
335
- Insider.setCustomAttributeWithDate(key, value.toISOString());
335
+ Insider.setCustomAttributeWithDate(key, value.getTime().toString());
336
336
  } catch (error) {
337
337
  Insider.putErrorLog(generateJSONErrorString(error));
338
338
  }