@nuskin/ns-product-lib 2.8.0-cx24-3705.1 → 2.8.0-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,41 @@
1
+ # [2.8.0-cx24-3684.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.2-cx24-3684.1...v2.8.0-cx24-3684.1) (2023-04-16)
2
+
3
+
4
+ ### Update
5
+
6
+ * set discounted price as WWHL for promotion (#CX24-3684) ([4b42a29](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/4b42a298b16dfd361bdd146b3023efd871d7be19)), closes [#CX24-3684](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3684)
7
+ * set discounted price as WWHL for promotion (#CX24-3684) ([1638ca5](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/1638ca52656b6e2d51d31b595b6a880956435533)), closes [#CX24-3684](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-3684)
8
+
9
+ ## [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)
10
+
11
+
12
+ ### Fix
13
+
14
+ * 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)
15
+ * 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)
16
+ * Rebased to master ([65b08a7](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/65b08a7d2ed14ae431ac2a9218ad138716c5ea1c))
17
+ * 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)
18
+ * 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)
19
+
20
+ ### Release
21
+
22
+ * Automated changes by GitLab pipeline [skip ci] ([edf7159](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/edf7159c70c164b5511f8d9a19d49663dad75296))
23
+ * Automated changes by GitLab pipeline [skip ci] ([0a2a6a0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/0a2a6a00edb579cf167928e0e9dd2d82089124a3))
24
+
25
+ ## [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)
26
+
27
+
28
+ ### Fix
29
+
30
+ * updating text in unit testing ([65393d6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/65393d6492b0696a24daa56f79b768cc38e1c7ae))
31
+
32
+ # [2.8.0-cx24-3705.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.8.0-cx24-3705.1...v2.8.0-cx24-3705.2) (2023-04-14)
33
+
34
+
35
+ ### Update
36
+
37
+ * setting correct title if multiple variants ([583e74d](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/583e74d41acc7213cd86a48df9076a453da8bb93))
38
+
1
39
  # [2.8.0-cx24-3705.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.0...v2.8.0-cx24-3705.1) (2023-04-14)
2
40
 
3
41
 
@@ -5,6 +43,21 @@
5
43
 
6
44
  * setting correct title if multiple variants ([9574804](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/9574804094f65261ff45c9658ba4e4d4baf0bdf2))
7
45
 
46
+ ## [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)
47
+
48
+
49
+ ### Fix
50
+
51
+ * 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))
52
+
53
+ ## [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)
54
+
55
+
56
+ ### Fix
57
+
58
+ * 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))
59
+ * 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))
60
+
8
61
  # [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)
9
62
 
10
63
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.8.0-cx24-3705.1",
3
+ "version": "2.8.0-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": {
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@nuskin/configuration-sdk": "2.2.3",
35
35
  "@nuskin/ns-common-lib": "1.4.5",
36
- "@nuskin/ns-util": "4.2.7",
36
+ "@nuskin/ns-util": "4.3.2",
37
37
  "axios": "0.27.2",
38
38
  "qs": "6.11.0"
39
39
  },
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,7 +338,11 @@ const Product = function (productData) {
337
338
  return this.addCvWithType(csvKey, productStatus.csv[csvKey]);
338
339
  }, this);
339
340
  }
340
- this.orderTypes = ProductUtils.mergeOrderTypes(this.orderTypes, productStatus.orderType);
341
+ //only remap the orderTypes for legacy (which we'll know when equinoxProductId is blank)
342
+ if(this.equinoxProductId == "") {
343
+ this.orderTypes = ProductUtils.mergeOrderTypes(this.orderTypes, productStatus.orderType);
344
+ }
345
+
341
346
  if (productStatus.childSkus) {
342
347
  this.childSkus = productStatus.childSkus;
343
348
  }
@@ -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 ? discountedPrice : 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,
@@ -373,7 +374,9 @@ const ProductData = {
373
374
  return variant;
374
375
  });
375
376
  const productArr = productData.sku.filter(p => p.default === true)
376
- productTitle = productArr[0].properties.name
377
+ productTitle = productArr[0].properties.name;
378
+ product = productArr[0]
379
+
377
380
  }
378
381
 
379
382
  const {
@@ -385,9 +388,11 @@ const ProductData = {
385
388
  PVPrice
386
389
  } = this.getEqProductPromotions(product);
387
390
  const productPrice = eventName ? defaultProductPrice : product.priceFacets["Regular Price"];
388
- const discountedPrice = eventName ? computedPrice : product.priceFacets["Regular Price"];
391
+ const discountedPrice = eventName ? computedPrice : product.priceFacets["Wholesale Price"];
389
392
  const productCVPrice = eventName ? CVPrice : product.priceFacets.CV;
390
393
  const productPVPrice = eventName ? PVPrice : product.priceFacets.PV;
394
+ const wholeSalePrice = eventName ? discountedPrice : product.priceFacets["Wholesale Price"];
395
+
391
396
 
392
397
  product.childSkus = await this.fetchChildSkus(product);
393
398
  product.availableQuantity = mapAvailableQuantity(product);
@@ -431,13 +436,13 @@ const ProductData = {
431
436
  "priceType": "WRTL",
432
437
  "price": discountedPrice,
433
438
  "priceMap": {
434
- "WRTL": productPrice,
435
- "WADW-WRTL": product.priceFacets["Regular Price"],
436
- "WADR": product.priceFacets["Regular Price"],
437
- "RTL": product.priceFacets["Regular Price"],
438
- "WADW": product.priceFacets["Wholesale Price"],
439
- "WHL": product.priceFacets["Wholesale Price"],
440
- "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
441
446
  },
442
447
  "cvMap": {
443
448
  "WWHL": productCVPrice,