@nuskin/ns-product-lib 2.6.2-cx24-3563.2 → 2.6.2-cx24-337703.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +2 -10
- package/package.json +2 -2
- package/src/equinox-helpers/availableQuantity.js +2 -2
- package/src/product.js +0 -6
- package/src/productData.js +21 -41
package/CHANGELOG.md
CHANGED
@@ -1,17 +1,9 @@
|
|
1
|
-
## [2.6.2-cx24-
|
1
|
+
## [2.6.2-cx24-337703.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.1...v2.6.2-cx24-337703.1) (2023-03-22)
|
2
2
|
|
3
3
|
|
4
4
|
### Fix
|
5
5
|
|
6
|
-
*
|
7
|
-
* Discounted PV CV are not displayed in MySite admin and home pages ([b1684da](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/b1684dada7851f910548e29ec1e2463cca55c738))
|
8
|
-
|
9
|
-
## [2.6.2-cx24-3563.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.1...v2.6.2-cx24-3563.1) (2023-03-18)
|
10
|
-
|
11
|
-
|
12
|
-
### Fix
|
13
|
-
|
14
|
-
* modified childSkus to equinoxChildSkus ([9f42ae5](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9f42ae5d02b3e1e810bdb289cf6afee1de086a8b))
|
6
|
+
* Show dropdown for variants ([85cdf69](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/85cdf69cc2bbf6700ec5c9bcacc7222cf2ddf674))
|
15
7
|
|
16
8
|
## [2.6.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.0...v2.6.1) (2023-03-16)
|
17
9
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nuskin/ns-product-lib",
|
3
|
-
"version": "2.6.2-cx24-
|
3
|
+
"version": "2.6.2-cx24-337703.1",
|
4
4
|
"description": "This project contains shared Product models and code between the backend and frontend.",
|
5
5
|
"main": "src/index.js",
|
6
6
|
"scripts": {
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"dependencies": {
|
34
34
|
"@nuskin/configuration-sdk": "2.2.3",
|
35
35
|
"@nuskin/ns-common-lib": "1.4.5",
|
36
|
-
"@nuskin/ns-util": "4.2.
|
36
|
+
"@nuskin/ns-util": "4.2.7",
|
37
37
|
"axios": "0.27.2",
|
38
38
|
"qs": "6.11.0"
|
39
39
|
},
|
@@ -8,8 +8,8 @@ function availableQuantity(product) {
|
|
8
8
|
return product.inventoryProperties.atpQty;
|
9
9
|
}
|
10
10
|
|
11
|
-
if (product.
|
12
|
-
const quantities = product.
|
11
|
+
if (product.childSkus && product.childSkus.length > 0) {
|
12
|
+
const quantities = product.childSkus
|
13
13
|
.filter(cs => cs.inventory !== undefined)
|
14
14
|
.map(cs => cs.inventory.atpQty);
|
15
15
|
|
package/src/product.js
CHANGED
@@ -76,7 +76,6 @@ const Product = function(productData) {
|
|
76
76
|
//@example "IN STOCK"
|
77
77
|
this.inventory = "";
|
78
78
|
this.equinoxProductId = "";
|
79
|
-
this.equinoxChildSkus = [];
|
80
79
|
|
81
80
|
this.setMarketAttributes = function(productStatus) {
|
82
81
|
if (productStatus.marketAttributes) {
|
@@ -505,7 +504,6 @@ const Product = function(productData) {
|
|
505
504
|
retData.pvMap = this.pvMap;
|
506
505
|
retData.orderTypes = this.orderTypes;
|
507
506
|
retData.childSkus = this.childSkus;
|
508
|
-
retData.equinoxChildSkus = this.equinoxChildSkus;
|
509
507
|
retData.custTypes = this.custTypes;
|
510
508
|
retData.division = this.division;
|
511
509
|
retData.backOrderDate = this.backOrderDate;
|
@@ -677,10 +675,6 @@ const Product = function(productData) {
|
|
677
675
|
}
|
678
676
|
|
679
677
|
this.equinoxProductId = data.equinoxProductId;
|
680
|
-
|
681
|
-
if(data.equinoxChildSkus) {
|
682
|
-
this.equinoxChildSkus = data.equinoxChildSkus;
|
683
|
-
}
|
684
678
|
}
|
685
679
|
};
|
686
680
|
|
package/src/productData.js
CHANGED
@@ -66,7 +66,6 @@ const ProductData = {
|
|
66
66
|
}
|
67
67
|
|
68
68
|
const filter = skuFilter.join(" OR ")
|
69
|
-
//axios.defaults.withCredentials = true;
|
70
69
|
|
71
70
|
const url = `${config.API_Base_URLs}/orchestrationservices/storefront/catalogs/search/`;
|
72
71
|
const href = `${url}?filter='\\\\''${encodeURI(filter)}'\\''`;
|
@@ -133,11 +132,9 @@ const ProductData = {
|
|
133
132
|
let thumbnailImage = imageURL ? imageURL + '?width=40' : ''
|
134
133
|
|
135
134
|
|
136
|
-
const { eventName, eventLabels, computedPrice, defaultProductPrice
|
135
|
+
const { eventName, eventLabels, computedPrice, defaultProductPrice } = this.getEqProductPromotions(eqVariant);
|
137
136
|
const productPrice = eventName ? defaultProductPrice : eqVariant.priceFacets["Regular Price"];
|
138
137
|
const discountedPrice = eventName ? computedPrice : eqVariant.priceFacets["Regular Price"];
|
139
|
-
const productCVPrice = eventName ? CVPrice : eqVariant.priceFacets.CV;
|
140
|
-
const productPVPrice = eventName ? PVPrice : eqVariant.priceFacets.PV;
|
141
138
|
|
142
139
|
return {
|
143
140
|
"sku": eqVariant.identifier,
|
@@ -244,8 +241,8 @@ const ProductData = {
|
|
244
241
|
"availableQuantity": eqVariant.inventoryProperties.atpQty,
|
245
242
|
"maxQuantity": 999,
|
246
243
|
"points": "",
|
247
|
-
"cv":
|
248
|
-
"pv":
|
244
|
+
"cv": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
|
245
|
+
"pv": eqVariant.priceFacets.PV,
|
249
246
|
"priceType": "WRTL",
|
250
247
|
"price": discountedPrice,
|
251
248
|
"priceMap": {
|
@@ -258,14 +255,14 @@ const ProductData = {
|
|
258
255
|
"WHL": eqVariant.priceFacets["Wholesale Price"]
|
259
256
|
},
|
260
257
|
"cvMap": {
|
261
|
-
"WWHL":
|
262
|
-
"WADW":
|
263
|
-
"WHL":
|
258
|
+
"WWHL": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
|
259
|
+
"WADW": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
|
260
|
+
"WHL": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : ''
|
264
261
|
},
|
265
262
|
"pvMap": {
|
266
|
-
"WWHL":
|
267
|
-
"WADW":
|
268
|
-
"WHL":
|
263
|
+
"WWHL": eqVariant.priceFacets.PV,
|
264
|
+
"WADW": eqVariant.priceFacets.PV,
|
265
|
+
"WHL": eqVariant.priceFacets.PV
|
269
266
|
},
|
270
267
|
"orderTypes": this._setOrderType(eqVariant.properties),
|
271
268
|
"custTypes": this.switchCustType(eqVariant.properties.customerTypes),
|
@@ -322,16 +319,6 @@ const ProductData = {
|
|
322
319
|
const computedPrice = product.totalValue && product.totalValue.priceAfterDiscount
|
323
320
|
? product.totalValue.priceAfterDiscount
|
324
321
|
: 0;
|
325
|
-
|
326
|
-
let CVPrice = 0,
|
327
|
-
PVPrice = 0;
|
328
|
-
|
329
|
-
if(product.totalValue && product.totalValue.priceFacets) {
|
330
|
-
const productPriceFacets = product.totalValue.priceFacets;
|
331
|
-
CVPrice = productPriceFacets.CV && productPriceFacets.CV.CVAfterDiscount ? productPriceFacets.CV.CVAfterDiscount : 0;
|
332
|
-
PVPrice = productPriceFacets.PV && productPriceFacets.PV.PVAfterDiscount ? productPriceFacets.PV.PVAfterDiscount : 0;
|
333
|
-
}
|
334
|
-
|
335
322
|
let eventName = "";
|
336
323
|
const eventLabels = [];
|
337
324
|
|
@@ -345,19 +332,17 @@ const ProductData = {
|
|
345
332
|
eventLabels: eventLabels.join(','),
|
346
333
|
defaultProductPrice,
|
347
334
|
computedPrice,
|
348
|
-
eventName
|
349
|
-
CVPrice,
|
350
|
-
PVPrice
|
335
|
+
eventName
|
351
336
|
}
|
352
337
|
},
|
353
338
|
|
354
339
|
eqProductMapper: async function (productDataResponse, skus) {
|
355
340
|
let count = 0;
|
356
|
-
let variants = {};
|
357
341
|
const products = [];
|
358
342
|
|
359
343
|
for (const productData of productDataResponse) {
|
360
344
|
try {
|
345
|
+
let variants = {};
|
361
346
|
let product = (productData.type && productData.type === "kit") ? productData : productData.sku[count];
|
362
347
|
let imageURL = product.properties.imageURL ? product.properties.imageURL : '';
|
363
348
|
let thumbnailImage = imageURL ? imageURL + '?width=40' : ''
|
@@ -375,16 +360,12 @@ const ProductData = {
|
|
375
360
|
eventName,
|
376
361
|
eventLabels,
|
377
362
|
computedPrice,
|
378
|
-
defaultProductPrice
|
379
|
-
CVPrice,
|
380
|
-
PVPrice
|
363
|
+
defaultProductPrice
|
381
364
|
} = this.getEqProductPromotions(product);
|
382
365
|
const productPrice = eventName ? defaultProductPrice : product.priceFacets["Regular Price"];
|
383
366
|
const discountedPrice = eventName ? computedPrice : product.priceFacets["Regular Price"];
|
384
|
-
const productCVPrice = eventName ? CVPrice : product.priceFacets.CV;
|
385
|
-
const productPVPrice = eventName ? PVPrice : product.priceFacets.PV;
|
386
367
|
|
387
|
-
product.
|
368
|
+
product.childSkus = await this.fetchChildSkus(product);
|
388
369
|
product.availableQuantity = mapAvailableQuantity(product);
|
389
370
|
product = {
|
390
371
|
...product,
|
@@ -421,8 +402,8 @@ const ProductData = {
|
|
421
402
|
"scanQualified": productData.properties.scanQualifiedCount,
|
422
403
|
"maxQuantity": 999,
|
423
404
|
"points": "",
|
424
|
-
"cv":
|
425
|
-
"pv":
|
405
|
+
"cv": (product.priceFacets.CV) ? product.priceFacets.CV : '',
|
406
|
+
"pv": product.priceFacets.PV,
|
426
407
|
"priceType": "WRTL",
|
427
408
|
"price": discountedPrice,
|
428
409
|
"priceMap": {
|
@@ -435,17 +416,16 @@ const ProductData = {
|
|
435
416
|
"WWHL": product.priceFacets["Wholesale Price"]
|
436
417
|
},
|
437
418
|
"cvMap": {
|
438
|
-
"WWHL":
|
439
|
-
"WADW":
|
440
|
-
"WHL":
|
419
|
+
"WWHL": (product.priceFacets.CV) ? product.priceFacets.CV : '',
|
420
|
+
"WADW": (product.priceFacets.CV) ? product.priceFacets.CV : '',
|
421
|
+
"WHL": (product.priceFacets.CV) ? product.priceFacets.CV : ''
|
441
422
|
},
|
442
423
|
"pvMap": {
|
443
|
-
"WWHL":
|
444
|
-
"WADW":
|
445
|
-
"WHL":
|
424
|
+
"WWHL": product.priceFacets.PV,
|
425
|
+
"WADW": product.priceFacets.PV,
|
426
|
+
"WHL": product.priceFacets.PV
|
446
427
|
},
|
447
428
|
"orderTypes": this._setOrderType(product.properties),
|
448
|
-
"childSkus": [],
|
449
429
|
"custTypes": this.switchCustType(product.properties.customerTypes),
|
450
430
|
"division": productData.properties.division,
|
451
431
|
"backOrderDate": null,
|