@nuskin/ns-product-lib 2.7.1-cx24-3879.2 → 2.7.1-cx24-3684.2

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,17 +1,16 @@
1
- ## [2.7.1-cx24-3879.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.1-cx24-3879.1...v2.7.1-cx24-3879.2) (2023-04-13)
1
+ ## [2.7.1-cx24-3684.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.1-cx24-3684.1...v2.7.1-cx24-3684.2) (2023-04-16)
2
2
 
3
3
 
4
4
  ### Fix
5
5
 
6
- * Payload for subscription products are missing when added to cart from MySite homepage ([20b0ed2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/20b0ed2661b4d213147cef9e77d268b167b49421))
6
+ * added event pricing (#CX24-3684) ([fca7e9b](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/fca7e9b9f01d99682ddff162db40b4a727d018c1)), closes [#CX24-3684](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3684)
7
7
 
8
- ## [2.7.1-cx24-3879.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.0...v2.7.1-cx24-3879.1) (2023-04-13)
8
+ ## [2.7.1-cx24-3684.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.0...v2.7.1-cx24-3684.1) (2023-04-13)
9
9
 
10
10
 
11
11
  ### Fix
12
12
 
13
- * Payload for subscription products are missing when added to cart from MySite homepage ([7b7ac3b](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/7b7ac3bd7c0b196aa9a7e97e885f7e296ef7e97d))
14
- * Payload for subscription products are missing when added to cart from MySite homepage ([d49957f](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/d49957f44d9ce6b6469b0bc94bc8f8050d00f35a))
13
+ * set original price as wholesale price (#CX24-3684) ([e1d5650](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/e1d5650da1bee59b19977c9af5da58b6ff08485d)), closes [#CX24-3684](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3684)
15
14
 
16
15
  # [2.7.0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.6.2...v2.7.0) (2023-04-05)
17
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.7.1-cx24-3879.2",
3
+ "version": "2.7.1-cx24-3684.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": {
package/src/product.js CHANGED
@@ -75,7 +75,7 @@ const Product = function (productData) {
75
75
  //equinox inventory / stock label
76
76
  //@example "IN STOCK"
77
77
  this.inventory = "";
78
-
78
+
79
79
  // equinox specific properties
80
80
  this.equinoxProductId = "";
81
81
  this.properties = {};
@@ -262,6 +262,7 @@ const Product = function (productData) {
262
262
 
263
263
  if (option.isEqPromotion) {
264
264
  //retain product.price as original price
265
+ this.setPrice(this.getPricing(priceType));
265
266
  this.setCv(this.getCvWithType(priceType));
266
267
  this.setPv(this.getPvWithType(priceType));
267
268
  this.priceType = priceType;
@@ -337,11 +338,7 @@ const Product = function (productData) {
337
338
  return this.addCvWithType(csvKey, productStatus.csv[csvKey]);
338
339
  }, this);
339
340
  }
340
- //only remap the orderTypes for legacy (which we'll know when equinoxProductId is blank)
341
- if(this.equinoxProductId == "") {
342
- this.orderTypes = ProductUtils.mergeOrderTypes(this.orderTypes, productStatus.orderType);
343
- }
344
-
341
+ this.orderTypes = ProductUtils.mergeOrderTypes(this.orderTypes, productStatus.orderType);
345
342
  if (productStatus.childSkus) {
346
343
  this.childSkus = productStatus.childSkus;
347
344
  }
@@ -48,11 +48,11 @@ const ProductData = {
48
48
  },
49
49
 
50
50
  /**
51
- *
52
- * @param {string[]} skus
53
- * @param {string} locale
54
- * @param {ConfigMap} config
55
- * @returns
51
+ *
52
+ * @param {string[]} skus
53
+ * @param {string} locale
54
+ * @param {ConfigMap} config
55
+ * @returns
56
56
  */
57
57
  searchEquinoxProduct: async function (skus, locale, config) {
58
58
  let skuFilter = [];
@@ -140,6 +140,7 @@ const ProductData = {
140
140
  const discountedPrice = eventName ? computedPrice : eqVariant.priceFacets["Regular Price"];
141
141
  const productCVPrice = eventName ? CVPrice : eqVariant.priceFacets.CV;
142
142
  const productPVPrice = eventName ? PVPrice : eqVariant.priceFacets.PV;
143
+ const wholeSalePrice = eventName ? defaultProductPrice : eqVariant.priceFacets["Wholesale Price"];
143
144
 
144
145
  return {
145
146
  "sku": eqVariant.identifier,
@@ -252,12 +253,12 @@ const ProductData = {
252
253
  "price": discountedPrice,
253
254
  "priceMap": {
254
255
  "WRTL": productPrice,
255
- "WADW-WRTL": eqVariant.priceFacets["Regular Price"],
256
- "WADR": eqVariant.priceFacets["Regular Price"],
257
- "RTL": eqVariant.priceFacets["Regular Price"],
258
- "WWHL": eqVariant.priceFacets["Wholesale Price"],
259
- "WADW": eqVariant.priceFacets["Wholesale Price"],
260
- "WHL": eqVariant.priceFacets["Wholesale Price"]
256
+ "WADW-WRTL": productPrice,
257
+ "WADR": productPrice,
258
+ "RTL": productPrice,
259
+ "WWHL": wholeSalePrice,
260
+ "WADW": wholeSalePrice,
261
+ "WHL": wholeSalePrice
261
262
  },
262
263
  "cvMap": {
263
264
  "WWHL": productCVPrice,
@@ -383,9 +384,11 @@ const ProductData = {
383
384
  PVPrice
384
385
  } = this.getEqProductPromotions(product);
385
386
  const productPrice = eventName ? defaultProductPrice : product.priceFacets["Regular Price"];
386
- const discountedPrice = eventName ? computedPrice : product.priceFacets["Regular Price"];
387
+ const discountedPrice = eventName ? computedPrice : product.priceFacets["Wholesale Price"];
387
388
  const productCVPrice = eventName ? CVPrice : product.priceFacets.CV;
388
389
  const productPVPrice = eventName ? PVPrice : product.priceFacets.PV;
390
+ const wholeSalePrice = eventName ? defaultProductPrice : product.priceFacets["Wholesale Price"];
391
+
389
392
 
390
393
  product.childSkus = await this.fetchChildSkus(product);
391
394
  product.availableQuantity = mapAvailableQuantity(product);
@@ -429,13 +432,13 @@ const ProductData = {
429
432
  "priceType": "WRTL",
430
433
  "price": discountedPrice,
431
434
  "priceMap": {
432
- "WRTL": productPrice,
433
- "WADW-WRTL": product.priceFacets["Regular Price"],
434
- "WADR": product.priceFacets["Regular Price"],
435
- "RTL": product.priceFacets["Regular Price"],
436
- "WADW": product.priceFacets["Wholesale Price"],
437
- "WHL": product.priceFacets["Wholesale Price"],
438
- "WWHL": product.priceFacets["Wholesale Price"]
435
+ "WRTL": productPrice, //regular | retail price
436
+ "WADW-WRTL": productPrice,
437
+ "WADR": productPrice,
438
+ "RTL": productPrice,
439
+ "WADW": wholeSalePrice,
440
+ "WHL": wholeSalePrice,
441
+ "WWHL": wholeSalePrice
439
442
  },
440
443
  "cvMap": {
441
444
  "WWHL": productCVPrice,