@nuskin/ns-product-lib 2.7.1 → 2.7.2-cx24-3684.1

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## [2.7.2-cx24-3684.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.1...v2.7.2-cx24-3684.1) (2023-04-16)
2
+
3
+
4
+ ### Fix
5
+
6
+ * added event pricing (#CX24-3684) ([49d1467](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/49d1467eecb69437adb16e9c85d07c52dca21d26)), closes [#CX24-3684](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3684)
7
+ * 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)
8
+ * Rebased to master ([65b08a7](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/65b08a7d2ed14ae431ac2a9218ad138716c5ea1c))
9
+ * set original price as wholesale price (#CX24-3684) ([047c01c](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/047c01c04a7ba6b9b1a2a30d997574460fda36ea)), closes [#CX24-3684](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3684)
10
+ * 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)
11
+
12
+ ### Release
13
+
14
+ * Automated changes by GitLab pipeline [skip ci] ([edf7159](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/edf7159c70c164b5511f8d9a19d49663dad75296))
15
+ * Automated changes by GitLab pipeline [skip ci] ([0a2a6a0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/0a2a6a00edb579cf167928e0e9dd2d82089124a3))
16
+
1
17
  ## [2.7.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.0...v2.7.1) (2023-04-15)
2
18
 
3
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.7.1",
3
+ "version": "2.7.2-cx24-3684.1",
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;
@@ -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,
@@ -387,9 +388,11 @@ const ProductData = {
387
388
  PVPrice
388
389
  } = this.getEqProductPromotions(product);
389
390
  const productPrice = eventName ? defaultProductPrice : product.priceFacets["Regular Price"];
390
- const discountedPrice = eventName ? computedPrice : product.priceFacets["Regular Price"];
391
+ const discountedPrice = eventName ? computedPrice : product.priceFacets["Wholesale Price"];
391
392
  const productCVPrice = eventName ? CVPrice : product.priceFacets.CV;
392
393
  const productPVPrice = eventName ? PVPrice : product.priceFacets.PV;
394
+ const wholeSalePrice = eventName ? defaultProductPrice : product.priceFacets["Wholesale Price"];
395
+
393
396
 
394
397
  product.childSkus = await this.fetchChildSkus(product);
395
398
  product.availableQuantity = mapAvailableQuantity(product);
@@ -433,13 +436,13 @@ const ProductData = {
433
436
  "priceType": "WRTL",
434
437
  "price": discountedPrice,
435
438
  "priceMap": {
436
- "WRTL": productPrice,
437
- "WADW-WRTL": product.priceFacets["Regular Price"],
438
- "WADR": product.priceFacets["Regular Price"],
439
- "RTL": product.priceFacets["Regular Price"],
440
- "WADW": product.priceFacets["Wholesale Price"],
441
- "WHL": product.priceFacets["Wholesale Price"],
442
- "WWHL": product.priceFacets["Wholesale Price"]
439
+ "WRTL": productPrice, //regular | retail price
440
+ "WADW-WRTL": productPrice,
441
+ "WADR": productPrice,
442
+ "RTL": productPrice,
443
+ "WADW": wholeSalePrice,
444
+ "WHL": wholeSalePrice,
445
+ "WWHL": wholeSalePrice
443
446
  },
444
447
  "cvMap": {
445
448
  "WWHL": productCVPrice,