@nuskin/ns-product-lib 2.9.0-mysitedomainfix.3 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,42 +1,37 @@
1
- # [2.9.0-mysitedomainfix.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.9.0-mysitedomainfix.2...v2.9.0-mysitedomainfix.3) (2023-06-21)
1
+ # [2.9.0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.8.2...v2.9.0) (2023-07-05)
2
2
 
3
3
 
4
4
  ### Update
5
5
 
6
- * added hostname as condition on switching domains ([af0d628](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/af0d6289cb9c722c887f9b027b66db1cacb1dd5a))
6
+ * added showWholeSalePricing flag in search api header (#CX24-4377) ([3fdd834](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/3fdd83481637428d9ccf287d3c5d1c0e85fd1f32)), closes [#CX24-4377](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-4377)
7
7
 
8
- # [2.9.0-mysitedomainfix.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.9.0-mysitedomainfix.1...v2.9.0-mysitedomainfix.2) (2023-06-21)
8
+ # [2.9.0-cx24-4377.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.8.3-cx24-4377.1...v2.9.0-cx24-4377.1) (2023-07-03)
9
9
 
10
10
 
11
- ### Fix
12
-
13
- * for PO use nuskin.com domain ([3596e90](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/3596e902ef15e3f2d9d15242edfcc423571e6ca3))
14
-
15
11
  ### Update
16
12
 
17
- * adjust unit testing for searchEquinoxProduct ([30c2732](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/30c2732d9e7dfc793493eb30594abff068ba0207))
13
+ * added showWholesalePrice in the header for product search (#CX24-4377) ([dc18916](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/dc189169241eb869caf69407767c7a6ab3c18438)), closes [#CX24-4377](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-4377)
18
14
 
19
- # [2.9.0-mysitedomainfix.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.9.0-cx24-4460.1...v2.9.0-mysitedomainfix.1) (2023-06-20)
15
+ ## [2.8.3-cx24-4377.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.8.2...v2.8.3-cx24-4377.1) (2023-06-27)
20
16
 
21
17
 
22
18
  ### Fix
23
19
 
24
- * added the logic to change the domain using the shopping context. ([91449cb](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/91449cb1463eaacb0bc80ba4308c4c8fb6ace777))
25
- * changing the equinox api domain so that it stays on the same domain as the mysite domain ([b3e672a](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/b3e672a4dae57012cf61d9a1f4454eaab674c3e7))
26
- * Multiple variants add to cart not adding correct sku ([968ed05](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/968ed055b5f5024579ac256f26c0d58ba409fcb9))
20
+ * adr promotion pricing (#CX24-4377) ([c1ea833](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/c1ea833d5b80da366e3dd0bd45cefcb18d096a34)), closes [#CX24-4377](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/issues/CX24-4377)
27
21
 
28
- ### Release
22
+ ## [2.8.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.8.1...v2.8.2) (2023-06-21)
29
23
 
30
- * Automated changes by GitLab pipeline [skip ci] ([679e474](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/679e474ad639ca2cf57652acc8fe71db85fac6fc))
31
- * Automated changes by GitLab pipeline [skip ci] ([5500a55](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/5500a550253e487b79045a9b5f5403bc93c3ee5a))
32
24
 
33
- # [2.9.0-cx24-4460.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.8.0...v2.9.0-cx24-4460.1) (2023-06-20)
25
+ ### Fix
34
26
 
27
+ * added shopping context checking ([8714953](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/8714953113f4f1970cacd4f4f6b59ecc61e767eb))
28
+
29
+ ## [2.8.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.8.0...v2.8.1) (2023-05-23)
35
30
 
36
- ### New
37
31
 
38
- * Change API Base URLs for My Site ([fb2e309](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/fb2e30953e6e9089da20ac367bad9bf63300a89c))
39
- * Change API Base URLs for My Site ([1f9ba11](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/1f9ba11f63ef85e9a444e39080e9277a41fa004d))
32
+ ### Fix
33
+
34
+ * Multiple variants add to cart not adding correct sku ([968ed05](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/968ed055b5f5024579ac256f26c0d58ba409fcb9))
40
35
 
41
36
  # [2.8.0](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.7.1...v2.8.0) (2023-05-02)
42
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.9.0-mysitedomainfix.3",
3
+ "version": "2.9.0",
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": {
@@ -19,14 +19,13 @@
19
19
  "license": "ISC",
20
20
  "homepage": "https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/blob/master/README.md",
21
21
  "devDependencies": {
22
- "@babel/preset-env": "^7.22.5",
23
22
  "axios-mock-adapter": "1.21.2",
24
23
  "eslint": "5.16.0",
25
24
  "eslint-config-google": "0.14.0",
26
25
  "eslint-config-prettier": "4.1.0",
27
26
  "eslint-plugin-json": "2.1.1",
28
27
  "eslint-plugin-prettier": "3.1.2",
29
- "jest": "29.5.0",
28
+ "jest": "29.2.2",
30
29
  "jest-environment-jsdom": "29.2.2",
31
30
  "jest-sonar-reporter": "2.0.0",
32
31
  "prettier": "1.19.1"
@@ -34,6 +33,7 @@
34
33
  "dependencies": {
35
34
  "@nuskin/configuration-sdk": "2.2.3",
36
35
  "@nuskin/ns-common-lib": "1.4.5",
36
+ "@nuskin/ns-util": "4.3.2",
37
37
  "axios": "0.27.2",
38
38
  "qs": "6.11.0"
39
39
  },
@@ -57,7 +57,9 @@ const ProductData = {
57
57
  searchEquinoxProduct: async function (skus, locale, config) {
58
58
  let skuFilter = [];
59
59
 
60
- if ((window && window.aem && window.aem.ShoppingContext && window.aem.ShoppingContext.getShoppingContext().context === 'storefront') || window.location.hostname.includes(".mynuskin.com")) {
60
+ const shoppingContext = window && window.aem && window.aem.ShoppingContext && window.aem.ShoppingContext.getShoppingContext();
61
+
62
+ if ((shoppingContext && shoppingContext.context === 'storefront') || window.location.hostname.includes(".mynuskin.com")) {
61
63
  config.API_Base_URLs = config.MySite_API_Base_URLs
62
64
  }
63
65
 
@@ -82,7 +84,7 @@ const ProductData = {
82
84
  locale,
83
85
  storeId: config.store_id
84
86
  },
85
- headers: this.getEquinoxRequestHeaders(),
87
+ headers: this.getEquinoxRequestHeaders({shoppingContext}),
86
88
  responseType: 'json',
87
89
  withCredentials: true
88
90
  });
@@ -91,10 +93,16 @@ const ProductData = {
91
93
  return response;
92
94
  },
93
95
 
94
- getEquinoxRequestHeaders() {
95
- return {
96
+ getEquinoxRequestHeaders(option) {
97
+ const header = {
96
98
  'Content-Type': 'application/json'
97
- };
99
+ }
100
+
101
+ if (option.shoppingContext && option.shoppingContext.overrides) {
102
+ header.showwholesalepricing = option.shoppingContext.overrides.showWholeSalePricing;
103
+ }
104
+
105
+ return header;
98
106
  },
99
107
 
100
108
  getProductFromLegacy: async function (skus, locale) {
@@ -258,10 +266,10 @@ const ProductData = {
258
266
  "priceMap": {
259
267
  "WRTL": productPrice,
260
268
  "WADW-WRTL": productPrice,
261
- "WADR": productPrice,
269
+ "WADR": productPrice, //retail ADR (subscription) price
262
270
  "RTL": productPrice,
263
271
  "WWHL": wholeSalePrice,
264
- "WADW": wholeSalePrice,
272
+ "WADW": discountedPrice,//wholesale ADR (subscription price)
265
273
  "WHL": wholeSalePrice
266
274
  },
267
275
  "cvMap": {
@@ -442,9 +450,9 @@ const ProductData = {
442
450
  "priceMap": {
443
451
  "WRTL": productPrice, //regular | retail price
444
452
  "WADW-WRTL": productPrice,
445
- "WADR": productPrice,
453
+ "WADR": productPrice, //retail ADR (subscription price)
446
454
  "RTL": productPrice,
447
- "WADW": wholeSalePrice,
455
+ "WADW": discountedPrice,//wholesale ADR (subscription price)
448
456
  "WHL": wholeSalePrice,
449
457
  "WWHL": wholeSalePrice
450
458
  },