@nuskin/ns-product-lib 2.6.1 → 2.6.2-cx24-3563.2
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +15 -0
- package/package.json +1 -1
- package/src/equinox-helpers/availableQuantity.js +2 -2
- package/src/product.js +6 -0
- package/src/productData.js +39 -20
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
## [2.6.2-cx24-3563.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.2-cx24-3563.1...v2.6.2-cx24-3563.2) (2023-03-20)
|
2
|
+
|
3
|
+
|
4
|
+
### Fix
|
5
|
+
|
6
|
+
* Discounted PV CV are not displayed in MySite admin and home pages ([9f18046](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9f1804639da01173d9da43c2713654243386ec56))
|
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))
|
15
|
+
|
1
16
|
## [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)
|
2
17
|
|
3
18
|
|
package/package.json
CHANGED
@@ -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.equinoxChildSkus && product.equinoxChildSkus.length > 0) {
|
12
|
+
const quantities = product.equinoxChildSkus
|
13
13
|
.filter(cs => cs.inventory !== undefined)
|
14
14
|
.map(cs => cs.inventory.atpQty);
|
15
15
|
|
package/src/product.js
CHANGED
@@ -76,6 +76,7 @@ const Product = function(productData) {
|
|
76
76
|
//@example "IN STOCK"
|
77
77
|
this.inventory = "";
|
78
78
|
this.equinoxProductId = "";
|
79
|
+
this.equinoxChildSkus = [];
|
79
80
|
|
80
81
|
this.setMarketAttributes = function(productStatus) {
|
81
82
|
if (productStatus.marketAttributes) {
|
@@ -504,6 +505,7 @@ const Product = function(productData) {
|
|
504
505
|
retData.pvMap = this.pvMap;
|
505
506
|
retData.orderTypes = this.orderTypes;
|
506
507
|
retData.childSkus = this.childSkus;
|
508
|
+
retData.equinoxChildSkus = this.equinoxChildSkus;
|
507
509
|
retData.custTypes = this.custTypes;
|
508
510
|
retData.division = this.division;
|
509
511
|
retData.backOrderDate = this.backOrderDate;
|
@@ -675,6 +677,10 @@ const Product = function(productData) {
|
|
675
677
|
}
|
676
678
|
|
677
679
|
this.equinoxProductId = data.equinoxProductId;
|
680
|
+
|
681
|
+
if(data.equinoxChildSkus) {
|
682
|
+
this.equinoxChildSkus = data.equinoxChildSkus;
|
683
|
+
}
|
678
684
|
}
|
679
685
|
};
|
680
686
|
|
package/src/productData.js
CHANGED
@@ -133,9 +133,11 @@ const ProductData = {
|
|
133
133
|
let thumbnailImage = imageURL ? imageURL + '?width=40' : ''
|
134
134
|
|
135
135
|
|
136
|
-
const { eventName, eventLabels, computedPrice, defaultProductPrice } = this.getEqProductPromotions(eqVariant);
|
136
|
+
const { eventName, eventLabels, computedPrice, defaultProductPrice, CVPrice, PVPrice } = this.getEqProductPromotions(eqVariant);
|
137
137
|
const productPrice = eventName ? defaultProductPrice : eqVariant.priceFacets["Regular Price"];
|
138
138
|
const discountedPrice = eventName ? computedPrice : eqVariant.priceFacets["Regular Price"];
|
139
|
+
const productCVPrice = eventName ? CVPrice : eqVariant.priceFacets.CV;
|
140
|
+
const productPVPrice = eventName ? PVPrice : eqVariant.priceFacets.PV;
|
139
141
|
|
140
142
|
return {
|
141
143
|
"sku": eqVariant.identifier,
|
@@ -242,8 +244,8 @@ const ProductData = {
|
|
242
244
|
"availableQuantity": eqVariant.inventoryProperties.atpQty,
|
243
245
|
"maxQuantity": 999,
|
244
246
|
"points": "",
|
245
|
-
"cv":
|
246
|
-
"pv":
|
247
|
+
"cv": productCVPrice,
|
248
|
+
"pv": productPVPrice,
|
247
249
|
"priceType": "WRTL",
|
248
250
|
"price": discountedPrice,
|
249
251
|
"priceMap": {
|
@@ -256,14 +258,14 @@ const ProductData = {
|
|
256
258
|
"WHL": eqVariant.priceFacets["Wholesale Price"]
|
257
259
|
},
|
258
260
|
"cvMap": {
|
259
|
-
"WWHL":
|
260
|
-
"WADW":
|
261
|
-
"WHL":
|
261
|
+
"WWHL": productCVPrice,
|
262
|
+
"WADW": productCVPrice,
|
263
|
+
"WHL": productCVPrice
|
262
264
|
},
|
263
265
|
"pvMap": {
|
264
|
-
"WWHL":
|
265
|
-
"WADW":
|
266
|
-
"WHL":
|
266
|
+
"WWHL": productPVPrice,
|
267
|
+
"WADW": productPVPrice,
|
268
|
+
"WHL": productPVPrice
|
267
269
|
},
|
268
270
|
"orderTypes": this._setOrderType(eqVariant.properties),
|
269
271
|
"custTypes": this.switchCustType(eqVariant.properties.customerTypes),
|
@@ -320,6 +322,16 @@ const ProductData = {
|
|
320
322
|
const computedPrice = product.totalValue && product.totalValue.priceAfterDiscount
|
321
323
|
? product.totalValue.priceAfterDiscount
|
322
324
|
: 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
|
+
|
323
335
|
let eventName = "";
|
324
336
|
const eventLabels = [];
|
325
337
|
|
@@ -333,7 +345,9 @@ const ProductData = {
|
|
333
345
|
eventLabels: eventLabels.join(','),
|
334
346
|
defaultProductPrice,
|
335
347
|
computedPrice,
|
336
|
-
eventName
|
348
|
+
eventName,
|
349
|
+
CVPrice,
|
350
|
+
PVPrice
|
337
351
|
}
|
338
352
|
},
|
339
353
|
|
@@ -361,12 +375,16 @@ const ProductData = {
|
|
361
375
|
eventName,
|
362
376
|
eventLabels,
|
363
377
|
computedPrice,
|
364
|
-
defaultProductPrice
|
378
|
+
defaultProductPrice,
|
379
|
+
CVPrice,
|
380
|
+
PVPrice
|
365
381
|
} = this.getEqProductPromotions(product);
|
366
382
|
const productPrice = eventName ? defaultProductPrice : product.priceFacets["Regular Price"];
|
367
383
|
const discountedPrice = eventName ? computedPrice : product.priceFacets["Regular Price"];
|
384
|
+
const productCVPrice = eventName ? CVPrice : product.priceFacets.CV;
|
385
|
+
const productPVPrice = eventName ? PVPrice : product.priceFacets.PV;
|
368
386
|
|
369
|
-
product.
|
387
|
+
product.equinoxChildSkus = await this.fetchChildSkus(product);
|
370
388
|
product.availableQuantity = mapAvailableQuantity(product);
|
371
389
|
product = {
|
372
390
|
...product,
|
@@ -403,8 +421,8 @@ const ProductData = {
|
|
403
421
|
"scanQualified": productData.properties.scanQualifiedCount,
|
404
422
|
"maxQuantity": 999,
|
405
423
|
"points": "",
|
406
|
-
"cv":
|
407
|
-
"pv":
|
424
|
+
"cv": productCVPrice,
|
425
|
+
"pv": productPVPrice,
|
408
426
|
"priceType": "WRTL",
|
409
427
|
"price": discountedPrice,
|
410
428
|
"priceMap": {
|
@@ -417,16 +435,17 @@ const ProductData = {
|
|
417
435
|
"WWHL": product.priceFacets["Wholesale Price"]
|
418
436
|
},
|
419
437
|
"cvMap": {
|
420
|
-
"WWHL":
|
421
|
-
"WADW":
|
422
|
-
"WHL":
|
438
|
+
"WWHL": productCVPrice,
|
439
|
+
"WADW": productCVPrice,
|
440
|
+
"WHL": productCVPrice
|
423
441
|
},
|
424
442
|
"pvMap": {
|
425
|
-
"WWHL":
|
426
|
-
"WADW":
|
427
|
-
"WHL":
|
443
|
+
"WWHL": productPVPrice,
|
444
|
+
"WADW": productPVPrice,
|
445
|
+
"WHL": productPVPrice
|
428
446
|
},
|
429
447
|
"orderTypes": this._setOrderType(product.properties),
|
448
|
+
"childSkus": [],
|
430
449
|
"custTypes": this.switchCustType(product.properties.customerTypes),
|
431
450
|
"division": productData.properties.division,
|
432
451
|
"backOrderDate": null,
|