@nuskin/ns-product-lib 2.8.2-mysitedomainfix.1 → 2.8.3-cx24-4377.1

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,10 +1,16 @@
1
- ## [2.8.2-mysitedomainfix.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.8.1...v2.8.2-mysitedomainfix.1) (2023-06-20)
1
+ ## [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)
2
2
 
3
3
 
4
4
  ### Fix
5
5
 
6
- * 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))
7
- * 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))
6
+ * 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)
7
+
8
+ ## [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)
9
+
10
+
11
+ ### Fix
12
+
13
+ * added shopping context checking ([8714953](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/8714953113f4f1970cacd4f4f6b59ecc61e767eb))
8
14
 
9
15
  ## [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)
10
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.8.2-mysitedomainfix.1",
3
+ "version": "2.8.3-cx24-4377.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": {
@@ -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,9 +57,11 @@ 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') {
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
 
64
66
  if (Array.isArray(skus)) {
65
67
  skus.forEach((sku) => {
@@ -145,6 +147,7 @@ const ProductData = {
145
147
  const productCVPrice = eventName ? CVPrice : eqVariant.priceFacets.CV;
146
148
  const productPVPrice = eventName ? PVPrice : eqVariant.priceFacets.PV;
147
149
  const wholeSalePrice = eventName ? defaultProductPrice : eqVariant.priceFacets["Wholesale Price"];
150
+ const wADRPrice = eventName ? computedPrice : eqVariant.priceFacets["Wholesale Price"];
148
151
 
149
152
  return {
150
153
  "sku": eqVariant.identifier,
@@ -258,7 +261,7 @@ const ProductData = {
258
261
  "priceMap": {
259
262
  "WRTL": productPrice,
260
263
  "WADW-WRTL": productPrice,
261
- "WADR": productPrice,
264
+ "WADR": wADRPrice, //wholesale ADR (subscription) price
262
265
  "RTL": productPrice,
263
266
  "WWHL": wholeSalePrice,
264
267
  "WADW": wholeSalePrice,
@@ -396,6 +399,7 @@ const ProductData = {
396
399
  const productCVPrice = eventName ? CVPrice : product.priceFacets.CV;
397
400
  const productPVPrice = eventName ? PVPrice : product.priceFacets.PV;
398
401
  const wholeSalePrice = eventName ? discountedPrice : product.priceFacets["Wholesale Price"];
402
+ const wADRPrice = eventName ? computedPrice : product.priceFacets["Wholesale Price"];
399
403
 
400
404
 
401
405
  product.childSkus = await this.fetchChildSkus(product);
@@ -442,7 +446,7 @@ const ProductData = {
442
446
  "priceMap": {
443
447
  "WRTL": productPrice, //regular | retail price
444
448
  "WADW-WRTL": productPrice,
445
- "WADR": productPrice,
449
+ "WADR": wADRPrice, //wholesale ADR (subscription price)
446
450
  "RTL": productPrice,
447
451
  "WADW": wholeSalePrice,
448
452
  "WHL": wholeSalePrice,