@nuskin/ns-product-lib 2.6.2-cx24-3563.2 → 2.6.2-cx24-3702.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 +1 -1
- package/src/equinox-helpers/availableQuantity.js +2 -2
- package/src/product.js +0 -6
- package/src/productData.js +24 -41
package/CHANGELOG.md
CHANGED
@@ -1,17 +1,9 @@
|
|
1
|
-
## [2.6.2-cx24-
|
1
|
+
## [2.6.2-cx24-3702.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.1...v2.6.2-cx24-3702.1) (2023-03-25)
|
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
|
+
* Add to cart for variants always using first variants ([528c9d5](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/528c9d54123c11aa7480ebf476a6de1e196f41c6))
|
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
@@ -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
@@ -133,11 +133,9 @@ const ProductData = {
|
|
133
133
|
let thumbnailImage = imageURL ? imageURL + '?width=40' : ''
|
134
134
|
|
135
135
|
|
136
|
-
const { eventName, eventLabels, computedPrice, defaultProductPrice
|
136
|
+
const { eventName, eventLabels, computedPrice, defaultProductPrice } = 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;
|
141
139
|
|
142
140
|
return {
|
143
141
|
"sku": eqVariant.identifier,
|
@@ -244,8 +242,8 @@ const ProductData = {
|
|
244
242
|
"availableQuantity": eqVariant.inventoryProperties.atpQty,
|
245
243
|
"maxQuantity": 999,
|
246
244
|
"points": "",
|
247
|
-
"cv":
|
248
|
-
"pv":
|
245
|
+
"cv": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
|
246
|
+
"pv": eqVariant.priceFacets.PV,
|
249
247
|
"priceType": "WRTL",
|
250
248
|
"price": discountedPrice,
|
251
249
|
"priceMap": {
|
@@ -258,14 +256,14 @@ const ProductData = {
|
|
258
256
|
"WHL": eqVariant.priceFacets["Wholesale Price"]
|
259
257
|
},
|
260
258
|
"cvMap": {
|
261
|
-
"WWHL":
|
262
|
-
"WADW":
|
263
|
-
"WHL":
|
259
|
+
"WWHL": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
|
260
|
+
"WADW": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
|
261
|
+
"WHL": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : ''
|
264
262
|
},
|
265
263
|
"pvMap": {
|
266
|
-
"WWHL":
|
267
|
-
"WADW":
|
268
|
-
"WHL":
|
264
|
+
"WWHL": eqVariant.priceFacets.PV,
|
265
|
+
"WADW": eqVariant.priceFacets.PV,
|
266
|
+
"WHL": eqVariant.priceFacets.PV
|
269
267
|
},
|
270
268
|
"orderTypes": this._setOrderType(eqVariant.properties),
|
271
269
|
"custTypes": this.switchCustType(eqVariant.properties.customerTypes),
|
@@ -298,7 +296,8 @@ const ProductData = {
|
|
298
296
|
},
|
299
297
|
"restrictedMarkets": [],
|
300
298
|
"addOns": [],
|
301
|
-
"equinoxProductId": eqVariant.identifier
|
299
|
+
"equinoxProductId": eqVariant.identifier,
|
300
|
+
"properties": eqVariant.properties
|
302
301
|
};
|
303
302
|
},
|
304
303
|
|
@@ -322,16 +321,6 @@ const ProductData = {
|
|
322
321
|
const computedPrice = product.totalValue && product.totalValue.priceAfterDiscount
|
323
322
|
? product.totalValue.priceAfterDiscount
|
324
323
|
: 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
324
|
let eventName = "";
|
336
325
|
const eventLabels = [];
|
337
326
|
|
@@ -345,9 +334,7 @@ const ProductData = {
|
|
345
334
|
eventLabels: eventLabels.join(','),
|
346
335
|
defaultProductPrice,
|
347
336
|
computedPrice,
|
348
|
-
eventName
|
349
|
-
CVPrice,
|
350
|
-
PVPrice
|
337
|
+
eventName
|
351
338
|
}
|
352
339
|
},
|
353
340
|
|
@@ -375,16 +362,12 @@ const ProductData = {
|
|
375
362
|
eventName,
|
376
363
|
eventLabels,
|
377
364
|
computedPrice,
|
378
|
-
defaultProductPrice
|
379
|
-
CVPrice,
|
380
|
-
PVPrice
|
365
|
+
defaultProductPrice
|
381
366
|
} = this.getEqProductPromotions(product);
|
382
367
|
const productPrice = eventName ? defaultProductPrice : product.priceFacets["Regular Price"];
|
383
368
|
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
369
|
|
387
|
-
product.
|
370
|
+
product.childSkus = await this.fetchChildSkus(product);
|
388
371
|
product.availableQuantity = mapAvailableQuantity(product);
|
389
372
|
product = {
|
390
373
|
...product,
|
@@ -421,8 +404,8 @@ const ProductData = {
|
|
421
404
|
"scanQualified": productData.properties.scanQualifiedCount,
|
422
405
|
"maxQuantity": 999,
|
423
406
|
"points": "",
|
424
|
-
"cv":
|
425
|
-
"pv":
|
407
|
+
"cv": (product.priceFacets.CV) ? product.priceFacets.CV : '',
|
408
|
+
"pv": product.priceFacets.PV,
|
426
409
|
"priceType": "WRTL",
|
427
410
|
"price": discountedPrice,
|
428
411
|
"priceMap": {
|
@@ -435,17 +418,16 @@ const ProductData = {
|
|
435
418
|
"WWHL": product.priceFacets["Wholesale Price"]
|
436
419
|
},
|
437
420
|
"cvMap": {
|
438
|
-
"WWHL":
|
439
|
-
"WADW":
|
440
|
-
"WHL":
|
421
|
+
"WWHL": (product.priceFacets.CV) ? product.priceFacets.CV : '',
|
422
|
+
"WADW": (product.priceFacets.CV) ? product.priceFacets.CV : '',
|
423
|
+
"WHL": (product.priceFacets.CV) ? product.priceFacets.CV : ''
|
441
424
|
},
|
442
425
|
"pvMap": {
|
443
|
-
"WWHL":
|
444
|
-
"WADW":
|
445
|
-
"WHL":
|
426
|
+
"WWHL": product.priceFacets.PV,
|
427
|
+
"WADW": product.priceFacets.PV,
|
428
|
+
"WHL": product.priceFacets.PV
|
446
429
|
},
|
447
430
|
"orderTypes": this._setOrderType(product.properties),
|
448
|
-
"childSkus": [],
|
449
431
|
"custTypes": this.switchCustType(product.properties.customerTypes),
|
450
432
|
"division": productData.properties.division,
|
451
433
|
"backOrderDate": null,
|
@@ -478,7 +460,8 @@ const ProductData = {
|
|
478
460
|
"restrictedMarkets": [],
|
479
461
|
"addOns": [],
|
480
462
|
"inventory": product.inventory || "", //inventory label
|
481
|
-
"equinoxProductId": productData.identifier
|
463
|
+
"equinoxProductId": productData.identifier,
|
464
|
+
"properties": product.properties
|
482
465
|
};
|
483
466
|
|
484
467
|
products.push(new Product(product));
|