@nuskin/ns-product-lib 2.6.2-cx24-337703.1 → 2.7.0-cx24-337703.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/productData.js +37 -19
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# [2.7.0-cx24-337703.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.2-cx24-337703.1...v2.7.0-cx24-337703.1) (2023-03-22)
|
2
|
+
|
3
|
+
|
4
|
+
### Update
|
5
|
+
|
6
|
+
* Merge CX24-3563 changes to CX24-337703 ([9e6ca40](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9e6ca40c35252c24394351275a234e9847f70bfc))
|
7
|
+
|
1
8
|
## [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
9
|
|
3
10
|
|
package/package.json
CHANGED
package/src/productData.js
CHANGED
@@ -132,9 +132,11 @@ const ProductData = {
|
|
132
132
|
let thumbnailImage = imageURL ? imageURL + '?width=40' : ''
|
133
133
|
|
134
134
|
|
135
|
-
const { eventName, eventLabels, computedPrice, defaultProductPrice } = this.getEqProductPromotions(eqVariant);
|
135
|
+
const { eventName, eventLabels, computedPrice, defaultProductPrice, CVPrice, PVPrice } = this.getEqProductPromotions(eqVariant);
|
136
136
|
const productPrice = eventName ? defaultProductPrice : eqVariant.priceFacets["Regular Price"];
|
137
137
|
const discountedPrice = eventName ? computedPrice : eqVariant.priceFacets["Regular Price"];
|
138
|
+
const productCVPrice = eventName ? CVPrice : eqVariant.priceFacets.CV;
|
139
|
+
const productPVPrice = eventName ? PVPrice : eqVariant.priceFacets.PV;
|
138
140
|
|
139
141
|
return {
|
140
142
|
"sku": eqVariant.identifier,
|
@@ -241,8 +243,8 @@ const ProductData = {
|
|
241
243
|
"availableQuantity": eqVariant.inventoryProperties.atpQty,
|
242
244
|
"maxQuantity": 999,
|
243
245
|
"points": "",
|
244
|
-
"cv":
|
245
|
-
"pv":
|
246
|
+
"cv": productCVPrice,
|
247
|
+
"pv": productPVPrice,
|
246
248
|
"priceType": "WRTL",
|
247
249
|
"price": discountedPrice,
|
248
250
|
"priceMap": {
|
@@ -255,14 +257,14 @@ const ProductData = {
|
|
255
257
|
"WHL": eqVariant.priceFacets["Wholesale Price"]
|
256
258
|
},
|
257
259
|
"cvMap": {
|
258
|
-
"WWHL":
|
259
|
-
"WADW":
|
260
|
-
"WHL":
|
260
|
+
"WWHL": productCVPrice,
|
261
|
+
"WADW": productCVPrice,
|
262
|
+
"WHL": productCVPrice
|
261
263
|
},
|
262
264
|
"pvMap": {
|
263
|
-
"WWHL":
|
264
|
-
"WADW":
|
265
|
-
"WHL":
|
265
|
+
"WWHL": productPVPrice,
|
266
|
+
"WADW": productPVPrice,
|
267
|
+
"WHL": productPVPrice
|
266
268
|
},
|
267
269
|
"orderTypes": this._setOrderType(eqVariant.properties),
|
268
270
|
"custTypes": this.switchCustType(eqVariant.properties.customerTypes),
|
@@ -319,6 +321,16 @@ const ProductData = {
|
|
319
321
|
const computedPrice = product.totalValue && product.totalValue.priceAfterDiscount
|
320
322
|
? product.totalValue.priceAfterDiscount
|
321
323
|
: 0;
|
324
|
+
|
325
|
+
let CVPrice = 0,
|
326
|
+
PVPrice = 0;
|
327
|
+
|
328
|
+
if(product.totalValue && product.totalValue.priceFacets) {
|
329
|
+
const productPriceFacets = product.totalValue.priceFacets;
|
330
|
+
CVPrice = productPriceFacets.CV && productPriceFacets.CV.CVAfterDiscount ? productPriceFacets.CV.CVAfterDiscount : 0;
|
331
|
+
PVPrice = productPriceFacets.PV && productPriceFacets.PV.PVAfterDiscount ? productPriceFacets.PV.PVAfterDiscount : 0;
|
332
|
+
}
|
333
|
+
|
322
334
|
let eventName = "";
|
323
335
|
const eventLabels = [];
|
324
336
|
|
@@ -332,7 +344,9 @@ const ProductData = {
|
|
332
344
|
eventLabels: eventLabels.join(','),
|
333
345
|
defaultProductPrice,
|
334
346
|
computedPrice,
|
335
|
-
eventName
|
347
|
+
eventName,
|
348
|
+
CVPrice,
|
349
|
+
PVPrice
|
336
350
|
}
|
337
351
|
},
|
338
352
|
|
@@ -360,10 +374,14 @@ const ProductData = {
|
|
360
374
|
eventName,
|
361
375
|
eventLabels,
|
362
376
|
computedPrice,
|
363
|
-
defaultProductPrice
|
377
|
+
defaultProductPrice,
|
378
|
+
CVPrice,
|
379
|
+
PVPrice
|
364
380
|
} = this.getEqProductPromotions(product);
|
365
381
|
const productPrice = eventName ? defaultProductPrice : product.priceFacets["Regular Price"];
|
366
382
|
const discountedPrice = eventName ? computedPrice : product.priceFacets["Regular Price"];
|
383
|
+
const productCVPrice = eventName ? CVPrice : product.priceFacets.CV;
|
384
|
+
const productPVPrice = eventName ? PVPrice : product.priceFacets.PV;
|
367
385
|
|
368
386
|
product.childSkus = await this.fetchChildSkus(product);
|
369
387
|
product.availableQuantity = mapAvailableQuantity(product);
|
@@ -402,8 +420,8 @@ const ProductData = {
|
|
402
420
|
"scanQualified": productData.properties.scanQualifiedCount,
|
403
421
|
"maxQuantity": 999,
|
404
422
|
"points": "",
|
405
|
-
"cv":
|
406
|
-
"pv":
|
423
|
+
"cv": productCVPrice,
|
424
|
+
"pv": productPVPrice,
|
407
425
|
"priceType": "WRTL",
|
408
426
|
"price": discountedPrice,
|
409
427
|
"priceMap": {
|
@@ -416,14 +434,14 @@ const ProductData = {
|
|
416
434
|
"WWHL": product.priceFacets["Wholesale Price"]
|
417
435
|
},
|
418
436
|
"cvMap": {
|
419
|
-
"WWHL":
|
420
|
-
"WADW":
|
421
|
-
"WHL":
|
437
|
+
"WWHL": productCVPrice,
|
438
|
+
"WADW": productCVPrice,
|
439
|
+
"WHL": productCVPrice
|
422
440
|
},
|
423
441
|
"pvMap": {
|
424
|
-
"WWHL":
|
425
|
-
"WADW":
|
426
|
-
"WHL":
|
442
|
+
"WWHL": productPVPrice,
|
443
|
+
"WADW": productPVPrice,
|
444
|
+
"WHL": productPVPrice
|
427
445
|
},
|
428
446
|
"orderTypes": this._setOrderType(product.properties),
|
429
447
|
"custTypes": this.switchCustType(product.properties.customerTypes),
|