@nuskin/ns-product-lib 2.6.2-cx24-3563.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 CHANGED
@@ -1,3 +1,11 @@
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
+
1
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)
2
10
 
3
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.6.2-cx24-3563.1",
3
+ "version": "2.6.2-cx24-3563.2",
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": {
@@ -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": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
246
- "pv": eqVariant.priceFacets.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": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
260
- "WADW": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : '',
261
- "WHL": (eqVariant.priceFacets.CV) ? eqVariant.priceFacets.CV : ''
261
+ "WWHL": productCVPrice,
262
+ "WADW": productCVPrice,
263
+ "WHL": productCVPrice
262
264
  },
263
265
  "pvMap": {
264
- "WWHL": eqVariant.priceFacets.PV,
265
- "WADW": eqVariant.priceFacets.PV,
266
- "WHL": eqVariant.priceFacets.PV
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,10 +375,14 @@ 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
387
  product.equinoxChildSkus = await this.fetchChildSkus(product);
370
388
  product.availableQuantity = mapAvailableQuantity(product);
@@ -403,8 +421,8 @@ const ProductData = {
403
421
  "scanQualified": productData.properties.scanQualifiedCount,
404
422
  "maxQuantity": 999,
405
423
  "points": "",
406
- "cv": (product.priceFacets.CV) ? product.priceFacets.CV : '',
407
- "pv": product.priceFacets.PV,
424
+ "cv": productCVPrice,
425
+ "pv": productPVPrice,
408
426
  "priceType": "WRTL",
409
427
  "price": discountedPrice,
410
428
  "priceMap": {
@@ -417,14 +435,14 @@ const ProductData = {
417
435
  "WWHL": product.priceFacets["Wholesale Price"]
418
436
  },
419
437
  "cvMap": {
420
- "WWHL": (product.priceFacets.CV) ? product.priceFacets.CV : '',
421
- "WADW": (product.priceFacets.CV) ? product.priceFacets.CV : '',
422
- "WHL": (product.priceFacets.CV) ? product.priceFacets.CV : ''
438
+ "WWHL": productCVPrice,
439
+ "WADW": productCVPrice,
440
+ "WHL": productCVPrice
423
441
  },
424
442
  "pvMap": {
425
- "WWHL": product.priceFacets.PV,
426
- "WADW": product.priceFacets.PV,
427
- "WHL": product.priceFacets.PV
443
+ "WWHL": productPVPrice,
444
+ "WADW": productPVPrice,
445
+ "WHL": productPVPrice
428
446
  },
429
447
  "orderTypes": this._setOrderType(product.properties),
430
448
  "childSkus": [],