@nuskin/ns-product-lib 1.5.0-cx24-1810.2 → 1.5.0-cx24-1810.5
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/CHANGELOG.md +22 -0
- package/package.json +1 -1
- package/src/eqProduct.js +812 -0
- package/src/index.js +4 -2
- package/src/product.js +1 -1
- package/src/productData.js +138 -22
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
# [1.5.0-cx24-1810.5](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.5.0-cx24-1810.4...v1.5.0-cx24-1810.5) (2022-07-24)
|
2
|
+
|
3
|
+
|
4
|
+
### New
|
5
|
+
|
6
|
+
* Get Product Data from Equinox (#CX24-1810) ([8e4b094](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/8e4b09404aa98e0b47c2411490268e9e0125772e)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
7
|
+
|
8
|
+
# [1.5.0-cx24-1810.4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.5.0-cx24-1810.3...v1.5.0-cx24-1810.4) (2022-07-21)
|
9
|
+
|
10
|
+
|
11
|
+
### New
|
12
|
+
|
13
|
+
* Get Product Data from Equinox (#CX24-1810) ([859bbc2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/859bbc2760e79ff6ba7e6aa13c8ef4bd88b20ada)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
14
|
+
|
15
|
+
# [1.5.0-cx24-1810.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.5.0-cx24-1810.2...v1.5.0-cx24-1810.3) (2022-07-21)
|
16
|
+
|
17
|
+
|
18
|
+
### New
|
19
|
+
|
20
|
+
* Get Product Data from Equinox (#CX24-1810) ([a5bdbd3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/a5bdbd31df1fc38e1cdaef87e4a5304e86edb088)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
21
|
+
* Get Product Data from Equinox (#CX24-1810) ([64a68ca](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/64a68ca0b099bb74574400d71e3f022e50823e6e)), closes [#CX24-1810](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-1810)
|
22
|
+
|
1
23
|
# [1.5.0-cx24-1810.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v1.5.0-cx24-1810.1...v1.5.0-cx24-1810.2) (2022-07-16)
|
2
24
|
|
3
25
|
|
package/package.json
CHANGED
package/src/eqProduct.js
ADDED
@@ -0,0 +1,812 @@
|
|
1
|
+
/* eslint-disable no-invalid-this */
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
const { isTrue } = require("@nuskin/ns-common-lib");
|
5
|
+
|
6
|
+
const ProductUtils = require("./productUtils.js");
|
7
|
+
|
8
|
+
const Agelocme = require("./agelocme.js");
|
9
|
+
const PriceType = require("./priceType.js");
|
10
|
+
const ProductStatus = require("./productStatus.js");
|
11
|
+
|
12
|
+
const eqProduct = function(productData) {
|
13
|
+
this.priceMap = {};
|
14
|
+
this.pvMap = {};
|
15
|
+
this.cvMap = {};
|
16
|
+
this.orderTypes = {};
|
17
|
+
this.childSkus = [];
|
18
|
+
this.custTypes = [];
|
19
|
+
this.addOns = [];
|
20
|
+
this.restrictedMarkets = [];
|
21
|
+
this.productCarouselImages = [];
|
22
|
+
this.locallyProduced = false;
|
23
|
+
|
24
|
+
//class variables to be used instead of getters/setters
|
25
|
+
this.globalProductID = "";
|
26
|
+
this.sku = "";
|
27
|
+
this.title = "";
|
28
|
+
this.country = "";
|
29
|
+
this.lang = "";
|
30
|
+
this.shortDescr = "";
|
31
|
+
this.longDescr = "";
|
32
|
+
this.sizeWeight = "";
|
33
|
+
this.nettoWeight = "";
|
34
|
+
this.productLabels = {};
|
35
|
+
this.count = "";
|
36
|
+
this.flavor = "";
|
37
|
+
this.shade = "";
|
38
|
+
this.size = "";
|
39
|
+
this.variantType = "";
|
40
|
+
this.variantDropdownLabel = "";
|
41
|
+
this.variantDropdownPlaceholder = "";
|
42
|
+
this.variantsLabel = "";
|
43
|
+
this.ingredients = "";
|
44
|
+
this.benefits = "";
|
45
|
+
this.usage = "";
|
46
|
+
this.resources = "";
|
47
|
+
this.contentSection = "";
|
48
|
+
this.videos = "";
|
49
|
+
this.personalOffer = false;
|
50
|
+
this.groupOffer = false;
|
51
|
+
this.scanQualified;
|
52
|
+
this.status = ProductStatus.ReleasedForSale;
|
53
|
+
this.availableQuantity = 0; // total available quantity
|
54
|
+
this.maxQuantity = 999; // max quantity allowed for purchase
|
55
|
+
this.priceType = null;
|
56
|
+
this.division = "";
|
57
|
+
this.backOrderDate = null;
|
58
|
+
this.baseSku = "";
|
59
|
+
this.variants = {};
|
60
|
+
this.eventName = null; // set if pricing is based off of an event
|
61
|
+
// Used to remember an event that was used for pricing in case ADR checkbox was clicked where
|
62
|
+
// event pricing is not available. If the event was active when the product was added then
|
63
|
+
// then the event can be used for the duration of the cart.
|
64
|
+
this.savedEventName = null;
|
65
|
+
this.salesLabel = "";
|
66
|
+
this.searchScore = 0;
|
67
|
+
this.isExclusive = false;
|
68
|
+
this.movie = "";
|
69
|
+
this.youtube = "";
|
70
|
+
this.marketAttributes = {};
|
71
|
+
this.salesEventText = "";
|
72
|
+
|
73
|
+
// agelocme stuff
|
74
|
+
this.agelocme = null; // object containing agelocme information (like code, label, name)
|
75
|
+
|
76
|
+
this.setMarketAttributes = function(productStatus) {
|
77
|
+
if (productStatus.marketAttributes) {
|
78
|
+
this.marketAttributes = productStatus.marketAttributes;
|
79
|
+
}
|
80
|
+
};
|
81
|
+
|
82
|
+
this.getAgelocmeKeyPart = function() {
|
83
|
+
let keyPart = null;
|
84
|
+
if (this.agelocme) {
|
85
|
+
keyPart =
|
86
|
+
this.agelocme.code +
|
87
|
+
"-" +
|
88
|
+
this.agelocme.label +
|
89
|
+
"-" +
|
90
|
+
this.agelocme.name;
|
91
|
+
}
|
92
|
+
|
93
|
+
return keyPart;
|
94
|
+
};
|
95
|
+
|
96
|
+
this.getHighlightedSku = function() {
|
97
|
+
let rv = this.sku;
|
98
|
+
if (this.highlightedSku) rv = this.highlightedSku;
|
99
|
+
return rv;
|
100
|
+
};
|
101
|
+
|
102
|
+
this.getProductSearchTitle = function() {
|
103
|
+
if (this.agelocme && this.agelocme.label) {
|
104
|
+
return this.agelocme.label;
|
105
|
+
}
|
106
|
+
return this.title;
|
107
|
+
};
|
108
|
+
|
109
|
+
this.getProductSearchSku = function() {
|
110
|
+
if (this.agelocme && this.agelocme.code) {
|
111
|
+
return this.agelocme.code;
|
112
|
+
}
|
113
|
+
return this.getHighlightedSku();
|
114
|
+
};
|
115
|
+
|
116
|
+
this.getDescription = function() {
|
117
|
+
let description = this.longDescr;
|
118
|
+
if (!description || description.length === 0) {
|
119
|
+
return this.shortDescr;
|
120
|
+
}
|
121
|
+
return description;
|
122
|
+
};
|
123
|
+
|
124
|
+
this.setFullImage = function(fullImage) {
|
125
|
+
if (fullImage) {
|
126
|
+
this.fullImage = fullImage.replace("http:", "https:");
|
127
|
+
} else {
|
128
|
+
this.fullImage = "";
|
129
|
+
}
|
130
|
+
};
|
131
|
+
|
132
|
+
this.getFullImage = function() {
|
133
|
+
return this.fullImage ? this.fullImage.replace("http:", "https:") : "";
|
134
|
+
};
|
135
|
+
|
136
|
+
this.setProductCarouselImages = function(productCarouselImages) {
|
137
|
+
this.productCarouselImages = productCarouselImages;
|
138
|
+
};
|
139
|
+
|
140
|
+
this.getProductCarouselImages = function() {
|
141
|
+
return this.productCarouselImages;
|
142
|
+
};
|
143
|
+
|
144
|
+
this.setImageAltText = function(altText) {
|
145
|
+
if (altText) {
|
146
|
+
this.imageAltText = altText;
|
147
|
+
} else {
|
148
|
+
this.imageAltText = this.title;
|
149
|
+
}
|
150
|
+
};
|
151
|
+
|
152
|
+
this.getImageAltText = function() {
|
153
|
+
return this.imageAltText || this.title;
|
154
|
+
};
|
155
|
+
|
156
|
+
this.setThumbnail = function(thumbnail) {
|
157
|
+
if (thumbnail) {
|
158
|
+
this.thumbnail = thumbnail.replace("http:", "https:");
|
159
|
+
} else {
|
160
|
+
this.thumbnail = "";
|
161
|
+
}
|
162
|
+
};
|
163
|
+
|
164
|
+
this.setThumbnailFromSku = function(sku) {
|
165
|
+
// WARNING: Base URL will need to be handled in the client (call setBaseUrl)
|
166
|
+
// eslint-disable-next-line max-len
|
167
|
+
// this.thumbnail = `${RunConfigService.getBaseUrl()}/content/products/${ProductUtils.getTokenizedSku(sku)}/jcr:content/fullImage.img.100.100.png`;
|
168
|
+
|
169
|
+
this.thumbnail = `/content/products/${ProductUtils.getTokenizedSku(
|
170
|
+
sku
|
171
|
+
)}/jcr:content/fullImage.img.100.100.png`;
|
172
|
+
};
|
173
|
+
|
174
|
+
this.getThumbnail = function() {
|
175
|
+
return this.thumbnail ? this.thumbnail.replace("http:", "https:") : "";
|
176
|
+
};
|
177
|
+
|
178
|
+
this.hasAvailableQuantity = function(qty = 1) {
|
179
|
+
return Math.min(this.maxQuantity, this.availableQuantity) >= qty;
|
180
|
+
};
|
181
|
+
|
182
|
+
this.setPoints = function(points) {
|
183
|
+
this.points = ensureFloatVal(points) || "";
|
184
|
+
};
|
185
|
+
|
186
|
+
this.getPointsFixed = function() {
|
187
|
+
return parseFloat(this.points).toFixed(2);
|
188
|
+
};
|
189
|
+
|
190
|
+
this.setCv = function(cv) {
|
191
|
+
this.cv = ensureFloatVal(cv) || "";
|
192
|
+
};
|
193
|
+
|
194
|
+
this.getCvFixed = function() {
|
195
|
+
return parseFloat(this.cv).toFixed(2);
|
196
|
+
};
|
197
|
+
|
198
|
+
this.setPv = function(pv) {
|
199
|
+
this.pv = ensureFloatVal(pv) || "";
|
200
|
+
};
|
201
|
+
|
202
|
+
this.getPvFixed = function() {
|
203
|
+
return parseFloat(this.pv || 0).toFixed(2);
|
204
|
+
};
|
205
|
+
|
206
|
+
this.setPrice = function(price) {
|
207
|
+
this.price = ensureFloatVal(price, true);
|
208
|
+
};
|
209
|
+
|
210
|
+
this.setFormattedPrice = function(formattedPrice) {
|
211
|
+
this.formattedPrice = formattedPrice;
|
212
|
+
};
|
213
|
+
|
214
|
+
/**
|
215
|
+
* Use to save the eventName if one exists. Added originally for when a product is
|
216
|
+
* added to the cart the event pricing needs to be remembered if toggling between
|
217
|
+
* pricetypes with event pricing and pricetype without event pricing
|
218
|
+
*/
|
219
|
+
this.lockEventName = function() {
|
220
|
+
if (!this.savedEventName && this.eventName) {
|
221
|
+
this.savedEventName = this.eventName;
|
222
|
+
}
|
223
|
+
};
|
224
|
+
|
225
|
+
this.setPriceAndPvFromType = function(_priceType, _activeEvents = null) {
|
226
|
+
// WARNING: priceType needs to be handled client-side
|
227
|
+
// const priceType = ConfigService.getMarketConfig().showWholeSalePricing && !AccountManager.isLoggedIn()
|
228
|
+
// ? PriceType.WWHL
|
229
|
+
// : (_priceType ? _priceType : this.priceType),
|
230
|
+
const priceType = _priceType ? _priceType : this.priceType;
|
231
|
+
const eventPricing = getEventPricing(this, priceType, _activeEvents);
|
232
|
+
|
233
|
+
let changed = false;
|
234
|
+
if (
|
235
|
+
!this.price ||
|
236
|
+
priceType !== this.priceType ||
|
237
|
+
this.eventName !== eventPricing.eventName
|
238
|
+
) {
|
239
|
+
this.setPrice(eventPricing.price || this.getPricing(priceType));
|
240
|
+
this.setCv(eventPricing.cv || this.getCvWithType(priceType));
|
241
|
+
this.setPv(eventPricing.pv || this.getPvWithType(priceType));
|
242
|
+
this.priceType = priceType;
|
243
|
+
this.eventName = eventPricing.eventName;
|
244
|
+
changed = true;
|
245
|
+
}
|
246
|
+
|
247
|
+
this.variantSkus().forEach((variantSku) => {
|
248
|
+
if (
|
249
|
+
this.variants[variantSku].setPriceAndPvFromType(
|
250
|
+
priceType,
|
251
|
+
_activeEvents
|
252
|
+
)
|
253
|
+
) {
|
254
|
+
changed = true;
|
255
|
+
}
|
256
|
+
}, this);
|
257
|
+
|
258
|
+
return changed;
|
259
|
+
};
|
260
|
+
|
261
|
+
this.getPrice = function() {
|
262
|
+
return this.price ? this.price : 0;
|
263
|
+
};
|
264
|
+
|
265
|
+
this.getPriceFixed = function() {
|
266
|
+
if (typeof this.price === "number") {
|
267
|
+
return parseFloat(this.price.toFixed(2));
|
268
|
+
} else {
|
269
|
+
return this.getPrice();
|
270
|
+
}
|
271
|
+
};
|
272
|
+
|
273
|
+
this.getOriginalPrice = function() {
|
274
|
+
return this.priceType ? this.priceMap[this.priceType] : null;
|
275
|
+
};
|
276
|
+
|
277
|
+
this.addPricing = function(type, price) {
|
278
|
+
this.priceMap[type] = price;
|
279
|
+
};
|
280
|
+
|
281
|
+
this.addPricingFromStatus = function(productStatus, priceType) {
|
282
|
+
let modified = false;
|
283
|
+
|
284
|
+
if (!priceType) {
|
285
|
+
priceType = this.priceType;
|
286
|
+
}
|
287
|
+
|
288
|
+
// previous code stored sku as all caps
|
289
|
+
const productStatusSku = productStatus.SKU || productStatus.sku;
|
290
|
+
if (productStatusSku === this.sku) {
|
291
|
+
this.globalProductID = productStatus.globalProductID;
|
292
|
+
this.status = productStatus.status;
|
293
|
+
this.availableQuantity = productStatus.availableQuantity;
|
294
|
+
this.maxQuantity = productStatus.maxQuantity || 999;
|
295
|
+
this.locallyProduced = productStatus.locallyProduced || false;
|
296
|
+
if (productStatus.backordered) {
|
297
|
+
this.backOrderDate = productStatus.backorderedAvailableDate;
|
298
|
+
}
|
299
|
+
if (productStatus.price) {
|
300
|
+
this.setPoints(productStatus.price.PTS);
|
301
|
+
Object.keys(productStatus.price).forEach((priceKey) => {
|
302
|
+
this.addPricing(priceKey, productStatus.price[priceKey]);
|
303
|
+
}, this);
|
304
|
+
}
|
305
|
+
if (productStatus.psv) {
|
306
|
+
Object.keys(productStatus.psv).forEach((psvKey) => {
|
307
|
+
this.addPvWithType(psvKey, productStatus.psv[psvKey]);
|
308
|
+
}, this);
|
309
|
+
}
|
310
|
+
if (productStatus.csv) {
|
311
|
+
Object.keys(productStatus.csv).map((csvKey) => {
|
312
|
+
return this.addCvWithType(csvKey, productStatus.csv[csvKey]);
|
313
|
+
}, this);
|
314
|
+
}
|
315
|
+
this.orderTypes = ProductUtils.mergeOrderTypes(this.orderTypes, productStatus.orderType);
|
316
|
+
if(productStatus.childSkus) {
|
317
|
+
this.childSkus = productStatus.childSkus;
|
318
|
+
}
|
319
|
+
this.setPriceAndPvFromType(priceType);
|
320
|
+
modified = true;
|
321
|
+
} else {
|
322
|
+
let variant = this.getVariant(productStatusSku);
|
323
|
+
|
324
|
+
if (variant) {
|
325
|
+
if (variant.addPricingFromStatus(productStatus, priceType)) {
|
326
|
+
variant.setMarketAttributes(productStatus);
|
327
|
+
updateBaseRanges(this, variant);
|
328
|
+
modified = true;
|
329
|
+
}
|
330
|
+
}
|
331
|
+
}
|
332
|
+
|
333
|
+
return modified;
|
334
|
+
};
|
335
|
+
|
336
|
+
this.addPvWithType = function(type, pv) {
|
337
|
+
this.pvMap[type] = pv;
|
338
|
+
};
|
339
|
+
|
340
|
+
this.addCvWithType = function(type, cv) {
|
341
|
+
this.cvMap[type] = cv;
|
342
|
+
};
|
343
|
+
|
344
|
+
this.getPricing = function(type) {
|
345
|
+
let retVal = null;
|
346
|
+
|
347
|
+
if (type) {
|
348
|
+
retVal = this.priceMap[type];
|
349
|
+
|
350
|
+
if (!retVal && isAdrType(type)) {
|
351
|
+
retVal = this.priceMap[getOppisiteAdrType(type)];
|
352
|
+
}
|
353
|
+
}
|
354
|
+
return retVal;
|
355
|
+
};
|
356
|
+
|
357
|
+
this.getEventPriceTypes = () => {
|
358
|
+
const eventPriceTypes = [];
|
359
|
+
|
360
|
+
Object.keys(this.priceMap).forEach(priceTypeKey => {
|
361
|
+
const eventPriceType = priceTypeKey.substring(0, priceTypeKey.indexOf(`-${this.priceType}`));
|
362
|
+
|
363
|
+
if (eventPriceType) {
|
364
|
+
eventPriceTypes.push(eventPriceType);
|
365
|
+
}
|
366
|
+
});
|
367
|
+
|
368
|
+
return eventPriceTypes;
|
369
|
+
};
|
370
|
+
|
371
|
+
this.getPvWithType = function(type) {
|
372
|
+
let rv = this.pvMap[type];
|
373
|
+
if (rv == null) {
|
374
|
+
// Assumption: we always have WWHL from the service
|
375
|
+
// default to wholesale if a PV of a particular type is not there
|
376
|
+
rv = this.pvMap[PriceType.WWHL];
|
377
|
+
}
|
378
|
+
return rv;
|
379
|
+
};
|
380
|
+
|
381
|
+
this.getCvWithType = function(type) {
|
382
|
+
let rv = this.cvMap[type];
|
383
|
+
if (rv == null) {
|
384
|
+
rv = this.cvMap[PriceType.WWHL];
|
385
|
+
}
|
386
|
+
return rv;
|
387
|
+
};
|
388
|
+
|
389
|
+
this.hasAdrOption = function() {
|
390
|
+
return this.orderTypes["adr"];
|
391
|
+
};
|
392
|
+
|
393
|
+
this.isAdrOnly = function() {
|
394
|
+
return this.hasAdrOption() && !this.hasOrderOption();
|
395
|
+
};
|
396
|
+
|
397
|
+
this.hasMultipleOrderTypes = function() {
|
398
|
+
return this.hasOrderOption() && this.hasAdrOption();
|
399
|
+
};
|
400
|
+
|
401
|
+
this.hasOrderOption = function() {
|
402
|
+
return this.orderTypes["order"];
|
403
|
+
};
|
404
|
+
|
405
|
+
this.isDistributor = function() {
|
406
|
+
return this.custTypes.includes("10");
|
407
|
+
};
|
408
|
+
|
409
|
+
this.isCustomer = function() {
|
410
|
+
return this.custTypes.includes("20");
|
411
|
+
};
|
412
|
+
|
413
|
+
this.isPreferredCustomer = function() {
|
414
|
+
return this.custTypes.includes("30");
|
415
|
+
};
|
416
|
+
|
417
|
+
this.isBase = function() {
|
418
|
+
return this.sku.substring(2, 4) === "55";
|
419
|
+
};
|
420
|
+
|
421
|
+
this.isVariant = function() {
|
422
|
+
return this.baseSku.length > 0 && this.variantSkus().length === 0;
|
423
|
+
};
|
424
|
+
|
425
|
+
this.setVariant = function(variantProduct) {
|
426
|
+
if (variantProduct && variantProduct.sku) {
|
427
|
+
this.variants[variantProduct.sku] = variantProduct;
|
428
|
+
}
|
429
|
+
};
|
430
|
+
|
431
|
+
this.getVariant = function(sku) {
|
432
|
+
return this.variants[sku];
|
433
|
+
};
|
434
|
+
|
435
|
+
this.variantSkus = function() {
|
436
|
+
return Object.keys(this.variants);
|
437
|
+
};
|
438
|
+
|
439
|
+
this.getVariantsList = function() {
|
440
|
+
return Object.values(this.variants);
|
441
|
+
};
|
442
|
+
|
443
|
+
this.getMinPrice = function() {
|
444
|
+
return this.priceMap[`min-${this.priceType}`];
|
445
|
+
};
|
446
|
+
|
447
|
+
this.getMaxPrice = function() {
|
448
|
+
return this.priceMap[`max-${this.priceType}`];
|
449
|
+
};
|
450
|
+
|
451
|
+
this.getMinPv = function() {
|
452
|
+
return this.pvMap[`min-${this.priceType}`];
|
453
|
+
};
|
454
|
+
|
455
|
+
this.getMaxPv = function() {
|
456
|
+
return this.pvMap[`max-${this.priceType}`];
|
457
|
+
};
|
458
|
+
|
459
|
+
this.toJSON = function() {
|
460
|
+
let retData = {};
|
461
|
+
retData.sku = this.sku;
|
462
|
+
retData.globalProductID = this.globalProductID;
|
463
|
+
retData.title = this.title;
|
464
|
+
retData.country = this.country;
|
465
|
+
retData.language = this.lang;
|
466
|
+
retData.shortDescr = this.shortDescr;
|
467
|
+
retData.longDescr = this.longDescr;
|
468
|
+
retData.fullImage = this.fullImage;
|
469
|
+
retData.imageAltText = this.imageAltText;
|
470
|
+
retData.productCarouselImages = this.productCarouselImages;
|
471
|
+
retData.thumbnail = this.thumbnail;
|
472
|
+
retData.ingredients = this.ingredients;
|
473
|
+
retData.benefits = this.benefits;
|
474
|
+
retData.usage = this.usage;
|
475
|
+
retData.resources = this.resources;
|
476
|
+
retData.videos = this.videos;
|
477
|
+
retData.movie = this.movie;
|
478
|
+
retData.youtube = this.youtube;
|
479
|
+
retData.salesEventText = this.salesEventText;
|
480
|
+
retData.contentSection = this.contentSection;
|
481
|
+
retData.scanQualified = this.scanQualified;
|
482
|
+
retData.availableQuantity = this.availableQuantity;
|
483
|
+
retData.maxQuantity = this.maxQuantity;
|
484
|
+
retData.points = this.points;
|
485
|
+
retData.cv = this.cv;
|
486
|
+
retData.pv = this.pv;
|
487
|
+
retData.priceType = this.priceType;
|
488
|
+
retData.price = this.price;
|
489
|
+
retData.priceMap = this.priceMap;
|
490
|
+
retData.cvMap = this.cvMap;
|
491
|
+
retData.pvMap = this.pvMap;
|
492
|
+
retData.orderTypes = this.orderTypes;
|
493
|
+
retData.childSkus = this.childSkus;
|
494
|
+
retData.custTypes = this.custTypes;
|
495
|
+
retData.division = this.division;
|
496
|
+
retData.backOrderDate = this.backOrderDate;
|
497
|
+
retData.locallyProduced = this.locallyProduced;
|
498
|
+
retData.agelocme = this.agelocme ? this.agelocme.toJSON() : null;
|
499
|
+
retData.count = this.count;
|
500
|
+
retData.flavor = this.flavor;
|
501
|
+
retData.size = this.size;
|
502
|
+
retData.shade = this.shade;
|
503
|
+
retData.status = this.status;
|
504
|
+
retData.variantType = this.variantType;
|
505
|
+
retData.variantDropdownLabel = this.variantDropdownLabel;
|
506
|
+
retData.variantDropdownPlaceholder = this.variantDropdownPlaceholder;
|
507
|
+
retData.variantsLabel = this.variantsLabel;
|
508
|
+
retData.groupOffer = this.groupOffer;
|
509
|
+
retData.personalOffer = this.personalOffer;
|
510
|
+
retData.savedEventName = this.savedEventName;
|
511
|
+
retData.salesLabel = this.salesLabel;
|
512
|
+
retData.eventName = this.eventName;
|
513
|
+
retData.sizeWeight = this.sizeWeight;
|
514
|
+
retData.nettoWeight = this.nettoWeight;
|
515
|
+
retData.productLabels = this.productLabels;
|
516
|
+
retData.variants = toVariantJSON(this.variants);
|
517
|
+
retData.searchScore = this.searchScore;
|
518
|
+
retData.isExclusive = this.isExclusive;
|
519
|
+
retData.marketAttributes = this.marketAttributes;
|
520
|
+
retData.restrictedMarkets = this.restrictedMarkets;
|
521
|
+
retData.addOns = this.addOns;
|
522
|
+
|
523
|
+
return retData;
|
524
|
+
};
|
525
|
+
|
526
|
+
this.setMeCommerceProductData = function(/*productData*/) {
|
527
|
+
console.error("setMeCommerceProductData is deprecated!");
|
528
|
+
};
|
529
|
+
|
530
|
+
this.setBaseUrl = function(baseUrl) {
|
531
|
+
this.thumbnail = ProductUtils.applyBaseUrl(this.thumbnail, baseUrl);
|
532
|
+
this.fullImage = ProductUtils.applyBaseUrl(this.fullImage, baseUrl);
|
533
|
+
|
534
|
+
if (this.isBase()) {
|
535
|
+
for (const variantSku in this.variants) {
|
536
|
+
const variant = this.variants[variantSku];
|
537
|
+
variant.setBaseUrl(baseUrl);
|
538
|
+
}
|
539
|
+
}
|
540
|
+
};
|
541
|
+
|
542
|
+
this.setProductData = function(productData) {
|
543
|
+
let data;
|
544
|
+
|
545
|
+
if (productData) {
|
546
|
+
if (productData instanceof eqProduct) {
|
547
|
+
data = productData.toJSON();
|
548
|
+
} else {
|
549
|
+
data = productData;
|
550
|
+
}
|
551
|
+
if (data.sku) {
|
552
|
+
this.sku = data.sku;
|
553
|
+
}
|
554
|
+
this.globalProductID = data.globalProductID || '';
|
555
|
+
this.title = data.title;
|
556
|
+
this.country = data.country;
|
557
|
+
this.lang = data.language;
|
558
|
+
this.shortDescr = data.shortDescr;
|
559
|
+
this.longDescr = data.longDescr;
|
560
|
+
this.isExclusive = isTrue(data.isExclusive);
|
561
|
+
|
562
|
+
// WARNING: Browser Detection will need to be handled in the client
|
563
|
+
// if (!BrowserDetection.isEdge() && !BrowserDetection.isFirefox()) {
|
564
|
+
// this.fullImage = data.fullImage ? `${data.fullImage.split('?')[0]}?format=pjpg` : undefined;
|
565
|
+
// this.thumbnail = data.thumbnail ? `${data.thumbnail.split('?')[0]}?format=pjpg` : undefined;
|
566
|
+
// }
|
567
|
+
this.fullImage = data.fullImage;
|
568
|
+
this.thumbnail = data.thumbnail;
|
569
|
+
this.imageAltText = data.imageAltText;
|
570
|
+
this.productCarouselImages = data.productCarouselImages;
|
571
|
+
|
572
|
+
this.ingredients = data.ingredients;
|
573
|
+
this.benefits = data.benefits;
|
574
|
+
this.usage = data.usage;
|
575
|
+
this.resources = data.resources;
|
576
|
+
this.videos = data.videos;
|
577
|
+
this.movie = data.movie;
|
578
|
+
this.youtube = data.youtube;
|
579
|
+
this.salesEventText = data.salesEventText;
|
580
|
+
this.contentSection = data.contentSection;
|
581
|
+
this.scanQualified = data.scanQualified;
|
582
|
+
this.status = data.status ? data.status : this.status;
|
583
|
+
if (data.availableQuantity) {
|
584
|
+
this.availableQuantity = data.availableQuantity;
|
585
|
+
}
|
586
|
+
if (data.maxQuantity >= 0) {
|
587
|
+
this.maxQuantity = data.maxQuantity;
|
588
|
+
}
|
589
|
+
if (data.points) {
|
590
|
+
this.setPoints(data.points);
|
591
|
+
}
|
592
|
+
if (data.cv) {
|
593
|
+
this.setCv(data.cv);
|
594
|
+
}
|
595
|
+
if (data.pv) {
|
596
|
+
this.setPv(data.pv);
|
597
|
+
}
|
598
|
+
if (data.price) {
|
599
|
+
this.setPrice(data.price);
|
600
|
+
}
|
601
|
+
if (data.formattedPrice) {
|
602
|
+
this.setFormattedPrice(data.formattedPrice);
|
603
|
+
}
|
604
|
+
if (data.priceType) {
|
605
|
+
this.priceType = data.priceType;
|
606
|
+
}
|
607
|
+
this.locallyProduced = data.locallyProduced;
|
608
|
+
this.count = productData.count;
|
609
|
+
this.flavor = productData.flavor;
|
610
|
+
this.size = productData.size;
|
611
|
+
this.shade = productData.shade;
|
612
|
+
this.variantType = productData.variantType;
|
613
|
+
this.variantDropdownLabel = productData.variantDropdownLabel;
|
614
|
+
this.variantDropdownPlaceholder = productData.variantDropdownPlaceholder;
|
615
|
+
this.variantsLabel = productData.variantsLabel;
|
616
|
+
this.groupOffer = productData.groupOffer;
|
617
|
+
this.personalOffer = productData.personalOffer;
|
618
|
+
this.baseSku = productData.baseSku ? productData.baseSku : "";
|
619
|
+
this.savedEventName = productData.savedEventName;
|
620
|
+
this.sizeWeight = productData.sizeWeight;
|
621
|
+
this.nettoWeight = productData.nettoWeight;
|
622
|
+
this.productLabels = productData.productLabels;
|
623
|
+
this.salesLabel = productData.salesLabel;
|
624
|
+
this.eventName = productData.eventName;
|
625
|
+
this.variants = fromVariantJSON(this, productData.variants);
|
626
|
+
this.searchScore = productData.searchScore ? productData.searchScore : 0;
|
627
|
+
this.marketAttributes = productData.marketAttributes;
|
628
|
+
this.addOns = productData.addOns || [];
|
629
|
+
this.restrictedMarkets = productData.restrictedMarkets || [];
|
630
|
+
|
631
|
+
if (data.priceType) {
|
632
|
+
this.addPricing(data.priceType, data.price);
|
633
|
+
this.addPvWithType(data.priceType, data.pv);
|
634
|
+
this.addCvWithType(data.priceType, data.cv);
|
635
|
+
}
|
636
|
+
this.priceMap =
|
637
|
+
data.priceMap && Object.keys(data.priceMap).length > 0
|
638
|
+
? data.priceMap
|
639
|
+
: this.priceMap;
|
640
|
+
this.cvMap =
|
641
|
+
data.cvMap && Object.keys(data.cvMap).length > 0
|
642
|
+
? data.cvMap
|
643
|
+
: this.cvMap;
|
644
|
+
this.pvMap =
|
645
|
+
data.pvMap && Object.keys(data.pvMap).length > 0
|
646
|
+
? data.pvMap
|
647
|
+
: this.pvMap;
|
648
|
+
this.orderTypes = ProductUtils.mergeOrderTypes(this.orderTypes, data.orderTypes);
|
649
|
+
if(data.childSkus) {
|
650
|
+
this.childSkus = data.childSkus;
|
651
|
+
}
|
652
|
+
this.custTypes = data.custTypes || [];
|
653
|
+
|
654
|
+
this.division = data.division;
|
655
|
+
this.backOrderDate = data.backOrderDate;
|
656
|
+
|
657
|
+
if (data.agelocme) {
|
658
|
+
this.agelocme = new Agelocme(data.agelocme);
|
659
|
+
}
|
660
|
+
}
|
661
|
+
};
|
662
|
+
|
663
|
+
this.isEmpty = function() {
|
664
|
+
return (
|
665
|
+
isFieldEmpty(this.sku) &&
|
666
|
+
isFieldEmpty(this.title) &&
|
667
|
+
isFieldEmpty(this.country) &&
|
668
|
+
isFieldEmpty(this.lang) &&
|
669
|
+
isFieldEmpty(this.shortDescr) &&
|
670
|
+
isFieldEmpty(this.longDescr) &&
|
671
|
+
isFieldEmpty(this.fullImage) &&
|
672
|
+
isFieldEmpty(this.thumbnail) &&
|
673
|
+
isFieldEmpty(this.points) &&
|
674
|
+
isFieldEmpty(this.cv) &&
|
675
|
+
isFieldEmpty(this.pv) &&
|
676
|
+
Object.keys(this.priceMap).length === 0
|
677
|
+
);
|
678
|
+
};
|
679
|
+
|
680
|
+
function isAdrType(priceType) {
|
681
|
+
return (
|
682
|
+
priceType === PriceType.WADW ||
|
683
|
+
priceType === PriceType.ADW ||
|
684
|
+
priceType === PriceType.WADR ||
|
685
|
+
priceType === PriceType.ADR
|
686
|
+
);
|
687
|
+
}
|
688
|
+
|
689
|
+
function getOppisiteAdrType(priceType) {
|
690
|
+
let retVal = priceType;
|
691
|
+
|
692
|
+
switch (priceType) {
|
693
|
+
case PriceType.WADW:
|
694
|
+
retVal = PriceType.ADW;
|
695
|
+
break;
|
696
|
+
case PriceType.ADW:
|
697
|
+
retVal = PriceType.WADW;
|
698
|
+
break;
|
699
|
+
case PriceType.WADR:
|
700
|
+
retVal = PriceType.ADR;
|
701
|
+
break;
|
702
|
+
case PriceType.ADR:
|
703
|
+
retVal = PriceType.WADR;
|
704
|
+
break;
|
705
|
+
}
|
706
|
+
return retVal;
|
707
|
+
}
|
708
|
+
|
709
|
+
function toVariantJSON(variants) {
|
710
|
+
let json = {};
|
711
|
+
|
712
|
+
Object.keys(variants).forEach((sku) => {
|
713
|
+
json[sku] = variants[sku].toJSON();
|
714
|
+
});
|
715
|
+
|
716
|
+
return json;
|
717
|
+
}
|
718
|
+
|
719
|
+
function fromVariantJSON(baseProduct, variantsJson) {
|
720
|
+
let variants = {};
|
721
|
+
|
722
|
+
if (variantsJson) {
|
723
|
+
for (const variantSku of Object.keys(variantsJson)) {
|
724
|
+
const variantJson = variantsJson[variantSku];
|
725
|
+
const variant = new eqProduct(variantJson);
|
726
|
+
|
727
|
+
variant.baseSku = baseProduct.sku;
|
728
|
+
|
729
|
+
variants[variantSku] = variant;
|
730
|
+
}
|
731
|
+
}
|
732
|
+
|
733
|
+
return variants;
|
734
|
+
}
|
735
|
+
|
736
|
+
function updateBaseRanges(scope, variant) {
|
737
|
+
Object.keys(variant.priceMap).forEach((priceType) => {
|
738
|
+
let minPriceType = `min-${priceType}`,
|
739
|
+
maxPriceType = `max-${priceType}`;
|
740
|
+
|
741
|
+
scope.priceMap[minPriceType] = Math.min(
|
742
|
+
scope.priceMap[minPriceType] || variant.priceMap[priceType],
|
743
|
+
variant.priceMap[priceType]
|
744
|
+
);
|
745
|
+
scope.priceMap[maxPriceType] = Math.max(
|
746
|
+
scope.priceMap[maxPriceType] || 0.0,
|
747
|
+
variant.priceMap[priceType]
|
748
|
+
);
|
749
|
+
|
750
|
+
scope.pvMap[minPriceType] = Math.min(
|
751
|
+
scope.pvMap[minPriceType] || variant.pvMap[priceType],
|
752
|
+
variant.pvMap[priceType]
|
753
|
+
);
|
754
|
+
scope.pvMap[maxPriceType] = Math.max(
|
755
|
+
scope.pvMap[maxPriceType] || 0.0,
|
756
|
+
variant.pvMap[priceType]
|
757
|
+
);
|
758
|
+
});
|
759
|
+
}
|
760
|
+
|
761
|
+
function ensureFloatVal(val, acceptString) {
|
762
|
+
let intVal;
|
763
|
+
if (typeof val === "number") {
|
764
|
+
intVal = val;
|
765
|
+
} else if (typeof val === "string") {
|
766
|
+
intVal = Number(val.replace(/[^0-9.]+/g, ""));
|
767
|
+
if (isNaN(intVal) && acceptString) {
|
768
|
+
intVal = val;
|
769
|
+
}
|
770
|
+
}
|
771
|
+
return intVal;
|
772
|
+
}
|
773
|
+
|
774
|
+
function isFieldEmpty(fieldValue) {
|
775
|
+
return (
|
776
|
+
fieldValue === null || fieldValue === undefined || fieldValue.length === 0
|
777
|
+
);
|
778
|
+
}
|
779
|
+
|
780
|
+
let activeEvents = [];
|
781
|
+
function getEventPricing(scope, priceType, _activeEvents = null) {
|
782
|
+
let eventNames = scope.savedEventName
|
783
|
+
? [scope.savedEventName]
|
784
|
+
: _activeEvents || activeEvents;
|
785
|
+
let retVal = { eventName: null };
|
786
|
+
|
787
|
+
eventNames.forEach((event) => {
|
788
|
+
let _eventPriceType = `${event}-${priceType}`;
|
789
|
+
|
790
|
+
if (scope.getPricing(_eventPriceType)) {
|
791
|
+
retVal.price = scope.getPricing(_eventPriceType);
|
792
|
+
retVal.cv = scope.getCvWithType(_eventPriceType);
|
793
|
+
retVal.pv = scope.getPvWithType(_eventPriceType);
|
794
|
+
retVal.priceType = _eventPriceType;
|
795
|
+
retVal.eventName = scope.effectiveEventName = event;
|
796
|
+
}
|
797
|
+
});
|
798
|
+
|
799
|
+
return retVal;
|
800
|
+
}
|
801
|
+
|
802
|
+
// WARNING: Product events will need to be handled in the client
|
803
|
+
// $.getValue(events.salesevent.ACTIVE_EVENTS, _activeEvents => {
|
804
|
+
// if (_activeEvents) {
|
805
|
+
// activeEvents = _activeEvents;
|
806
|
+
// }
|
807
|
+
// }, true);
|
808
|
+
|
809
|
+
this.setProductData(productData);
|
810
|
+
};
|
811
|
+
|
812
|
+
module.exports = eqProduct;
|
package/src/index.js
CHANGED
@@ -12,7 +12,8 @@ const ProductContentMapper = require("./productContentMapper.js");
|
|
12
12
|
const ProductStatus = require("./productStatus.js");
|
13
13
|
const ProductStatusMapper = require("./productStatusMapper.js");
|
14
14
|
const ProductUtils = require("./productUtils.js");
|
15
|
-
const ProductData = require(
|
15
|
+
const ProductData = require("./productData.js");
|
16
|
+
const EqProduct = require("./eqProduct.js");
|
16
17
|
|
17
18
|
module.exports = {
|
18
19
|
Agelocme,
|
@@ -22,5 +23,6 @@ module.exports = {
|
|
22
23
|
ProductStatus,
|
23
24
|
ProductStatusMapper,
|
24
25
|
ProductUtils,
|
25
|
-
ProductData
|
26
|
+
ProductData,
|
27
|
+
EqProduct
|
26
28
|
};
|
package/src/product.js
CHANGED
@@ -308,7 +308,7 @@ const Product = function(productData) {
|
|
308
308
|
}
|
309
309
|
if (productStatus.csv) {
|
310
310
|
Object.keys(productStatus.csv).map((csvKey) => {
|
311
|
-
this.addCvWithType(csvKey, productStatus.csv[csvKey]);
|
311
|
+
return this.addCvWithType(csvKey, productStatus.csv[csvKey]);
|
312
312
|
}, this);
|
313
313
|
}
|
314
314
|
this.orderTypes = ProductUtils.mergeOrderTypes(this.orderTypes, productStatus.orderType);
|
package/src/productData.js
CHANGED
@@ -6,25 +6,23 @@ const ProductData = {
|
|
6
6
|
let productResponse = {};
|
7
7
|
let locale = `${runConfig.language}_${runConfig.country}`;
|
8
8
|
if (isEqEnabled) {
|
9
|
-
let lambdaUrl = "https://storefront.api.wde.nuskin.io/orchestrationservices/storefront/catalogs/search";
|
10
|
-
const payload = {
|
11
|
-
storeId: "422",
|
12
|
-
filter:
|
13
|
-
'{"filters":[{"field":"index_key_skuId","operation":"IN","value":"' +
|
14
|
-
skus.toString() +
|
15
|
-
'"}]}'
|
16
|
-
|
17
|
-
};
|
18
9
|
let productDataResponse = await axios.request({
|
19
|
-
method:
|
20
|
-
url:
|
21
|
-
|
22
|
-
|
23
|
-
|
10
|
+
method: 'get',
|
11
|
+
url: 'https://storefront.api.wde.nuskin.io/orchestrationservices/storefront/catalogs/search/',
|
12
|
+
headers: {
|
13
|
+
'Cookie': 'x-sk-session-id=5da6d8b24af753cfcefa88f905dfd439'
|
14
|
+
},
|
15
|
+
params: {
|
16
|
+
storeId: '422',
|
17
|
+
filter: '{"filters":[{"field":"index_key_skuId","operation":"IN","value":"' +
|
18
|
+
skus.toString() +
|
19
|
+
'"}]}'
|
20
|
+
}
|
24
21
|
});
|
22
|
+
console.log(productDataResponse.data.product)
|
23
|
+
productResponse = this.eqProductMapper(productDataResponse.data.product)
|
25
24
|
|
26
|
-
|
27
|
-
|
25
|
+
|
28
26
|
} else {
|
29
27
|
let lambdaUrl = `${marketConfig.awsUrl}/productData/v1`;
|
30
28
|
const payload = {
|
@@ -43,14 +41,132 @@ const ProductData = {
|
|
43
41
|
return productResponse;
|
44
42
|
},
|
45
43
|
|
46
|
-
|
47
|
-
return
|
48
|
-
|
49
|
-
);
|
50
|
-
},
|
44
|
+
/* eqProductMapper: function(productDataResponse) {
|
45
|
+
return productDataResponse;
|
46
|
+
}, */
|
51
47
|
|
52
48
|
eqProductMapper: function (productDataResponse) {
|
53
|
-
|
49
|
+
let prodArr = []
|
50
|
+
productDataResponse.forEach((data, index) => {
|
51
|
+
prodArr[index] = {
|
52
|
+
"sku": data.sku[0].identifier,
|
53
|
+
"globalProductID": data.identifier,
|
54
|
+
"title": data.properties.name,
|
55
|
+
"country": data.sku[0].properties.market,
|
56
|
+
"language": "en",
|
57
|
+
"shortDescr": data.properties.description,
|
58
|
+
"longDescr": data.properties.productDetailsDescription,
|
59
|
+
"fullImage": data.properties.imageURL,
|
60
|
+
"imageAltText": data.properties.name,
|
61
|
+
"productCarouselImages": [
|
62
|
+
{
|
63
|
+
"contentType": "img",
|
64
|
+
"src": "/content/products/24/00/35/24003529/jcr:content/fullImage.imgw.1280.1280.png",
|
65
|
+
"alt": ""
|
66
|
+
}
|
67
|
+
],
|
68
|
+
"thumbnail": "/content/products/24/00/35/24003529/jcr:content/fullImage.img.160.160.png/1598425309548-cache.png",
|
69
|
+
"ingredients": "",
|
70
|
+
"benefits": "",
|
71
|
+
"usage": "",
|
72
|
+
"resources": "",
|
73
|
+
"videos": "",
|
74
|
+
"movie": "",
|
75
|
+
"youtube": "",
|
76
|
+
"salesEventText": "",
|
77
|
+
"contentSection": [
|
78
|
+
{
|
79
|
+
"sectionContent": "<div class=\"contentSections\"><div class=\"contentSection section\"><div>\n<h3>BENEFITS</h3>\n<div>\n<div class=\"sectionContent parsys\"><div class=\"text parbase section\">\n<p>Green tea has been used in China for thousands of years for its health-preserving and revitalizing power. Modern science has identified powerful antioxidants in green tea called polyphenols. One group of polyphenols called catechins is particularly potent and is highly effective at neutralizing free radicals at the cellular level. Catechins support healthy cell function while providing antioxidant protection to critical cell structures such as DNA. Clinical studies show catechins interfere with the production of certain enzymes involved in cell damage. Additionally, catechins have been demonstrated to cause a thermogenic effect that enhances the body s metabolic rate. Tegreen 97<sup>®</sup> from Pharmanex is a proprietary, highly concentrated extract of the catechins found in green tea. Tegreen 97<sup>®</sup> is one of the most potent antioxidant supplements on the market with a 97 percent polyphenol content, 65% catechins. Each Tegreen 97<sup>®</sup> capsule contains the catechin equivalent of approximately seven cups of green tea and is 99.5 percent caffeine free.</p>\r\n\n</div>\n\n</div>\n\n</div>\n</div>\n</div>\n<div class=\"contentSection section\"><div>\n<h3>USAGE</h3>\n<div>\n<div class=\"sectionContent parsys\"><div class=\"text parbase section\">\n<p>As a dietary supplement, take one (1) to four (4) capsules daily; preferably one (1) to two (2) each morning and evening with food. Store in a cool, dry place.</p>\r\n\n</div>\n\n</div>\n\n</div>\n</div>\n</div>\n<div class=\"contentSection section\"><div>\n<h3>INGREDIENTS</h3>\n<div>\n<div class=\"sectionContent parsys\"><div class=\"text parbase section\">\n<table border=\"1\" cellspacing=\"1\" cellpadding=\"0\" width=\"360\"><tbody>\r\n<tr>\r\n<td><b>Nutritional Facts</b></td>\r\n<td><b>Amount</b></td>\r\n<td><b>% Daily Value</b></td>\r\n</tr>\r\n<tr>\r\n<td colspan=\"3\"><b>Serving Size: 1 Capsule<br>\r\nServings Per Container: 120</b></td>\r\n</tr>\r\n<tr>\r\n<td width=\"55%\">Green tea leaf (20:1) Extract (<i>Camellia sinensis</i></td>\r\n<td width=\"20%\">250 mg</td>\r\n<td width=\"25%\"> </td>\r\n</tr>\r\n<tr>\r\n<td width=\"55%\" colspan=\"3\">* Daily Value not established</td>\r\n</tr>\r\n<tr>\r\n<td width=\"55%\" colspan=\"3\"><b>Other Ingredients: Gelatin, Silicon Dioxide, Microcrystalline Cellulose, Magnesium Stearate.</b></td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n<p> </p>\r\n\n</div>\n\n</div>\n\n</div>\n</div>\n</div>\n</div>\n"
|
80
|
+
}
|
81
|
+
],
|
82
|
+
"scanQualified": data.properties.scanQualifiedCount,
|
83
|
+
"availableQuantity": 999,
|
84
|
+
"maxQuantity": 999,
|
85
|
+
"points": "",
|
86
|
+
"cv": 99,
|
87
|
+
"pv": 99,
|
88
|
+
"priceType": "WRTL",
|
89
|
+
"price": 9999,
|
90
|
+
"priceMap": {
|
91
|
+
"WRTL": 9999,
|
92
|
+
"WADW-WRTL": 9999,
|
93
|
+
"WADR": 9999,
|
94
|
+
"RTL": 9999,
|
95
|
+
"WWHL": 9998,
|
96
|
+
"WADW": 9998,
|
97
|
+
"WHL": 9998
|
98
|
+
},
|
99
|
+
"cvMap": {
|
100
|
+
"WWHL": 8888,
|
101
|
+
"WADW": 8888,
|
102
|
+
"WHL": 8888
|
103
|
+
},
|
104
|
+
"pvMap": {
|
105
|
+
"WWHL": 99,
|
106
|
+
"WADW": 98,
|
107
|
+
"WHL": 90
|
108
|
+
},
|
109
|
+
"orderTypes": {
|
110
|
+
"adr": true,
|
111
|
+
"order": true,
|
112
|
+
"zpfc": false,
|
113
|
+
"zadp": true,
|
114
|
+
"ars": true,
|
115
|
+
"kiosk": true,
|
116
|
+
"mobile": true,
|
117
|
+
"preferred customer": true,
|
118
|
+
"retail": true,
|
119
|
+
"web": true,
|
120
|
+
"web display": true
|
121
|
+
},
|
122
|
+
"childSkus": [],
|
123
|
+
"custTypes": [
|
124
|
+
"10"
|
125
|
+
],
|
126
|
+
"division": "",
|
127
|
+
"backOrderDate": null,
|
128
|
+
"locallyProduced": false,
|
129
|
+
"agelocme": null,
|
130
|
+
"count": "",
|
131
|
+
"flavor": "",
|
132
|
+
"size": "",
|
133
|
+
"shade": "",
|
134
|
+
"status": "RELEASED_FOR_SALE",
|
135
|
+
"variantType": "",
|
136
|
+
"variantDropdownLabel": "",
|
137
|
+
"variantDropdownPlaceholder": "",
|
138
|
+
"variantsLabel": "",
|
139
|
+
"groupOffer": false,
|
140
|
+
"personalOffer": false,
|
141
|
+
"savedEventName": null,
|
142
|
+
"salesLabel": "",
|
143
|
+
"eventName": null,
|
144
|
+
"sizeWeight": "120 capsules",
|
145
|
+
"nettoWeight": "",
|
146
|
+
"variants": {},
|
147
|
+
"searchScore": 0,
|
148
|
+
"isExclusive": false,
|
149
|
+
"marketAttributes": {
|
150
|
+
"discount": true,
|
151
|
+
"redeem": true,
|
152
|
+
"earn": true
|
153
|
+
},
|
154
|
+
"restrictedMarkets": [],
|
155
|
+
"addOns": []
|
156
|
+
};
|
157
|
+
});
|
158
|
+
let products = [];
|
159
|
+
|
160
|
+
products.push(prodArr);
|
161
|
+
let data = {
|
162
|
+
products: products
|
163
|
+
};
|
164
|
+
return {
|
165
|
+
"status": 200,
|
166
|
+
"messages": [],
|
167
|
+
"data": data
|
168
|
+
}
|
169
|
+
|
54
170
|
},
|
55
171
|
|
56
172
|
getProductDataRequestHeaders: function (marketConfig) {
|