@nuskin/ns-shop 6.4.2 → 6.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-shop",
3
- "version": "6.4.2",
3
+ "version": "6.4.3",
4
4
  "description": "The description that will amaze and astound your audience when they read it",
5
5
  "main": "src/shop.js",
6
6
  "scripts": {
@@ -26,7 +26,7 @@
26
26
  "@nuskin/ns-common-lib": "1.4.5",
27
27
  "@nuskin/ns-feature-flags": "1.4.2",
28
28
  "@nuskin/ns-loyalty-web": "1.5.6",
29
- "@nuskin/ns-product-lib": "2.6.1",
29
+ "@nuskin/ns-product-lib": "2.6.2",
30
30
  "@nuskin/nuskinjquery": "2.3.1",
31
31
  "axios": "0.21.1",
32
32
  "decimal.js": "10.2.1",
@@ -38,8 +38,8 @@
38
38
  "@nuskin/ns-account": "5.7.1",
39
39
  "@nuskin/configuration-sdk": "2.2.3",
40
40
  "@nuskin/ns-jsanalyzer": "1.0.1",
41
- "@nuskin/ns-product": "3.39.1",
42
- "@nuskin/ns-util": "4.2.5",
41
+ "@nuskin/ns-product": "3.40.0",
42
+ "@nuskin/ns-util": "4.2.7",
43
43
  "axios-mock-adapter": "1.18.2",
44
44
  "babel-cli": "6.26.0",
45
45
  "babel-core": "6.26.3",
@@ -1310,18 +1310,10 @@ function checkContext(params){
1310
1310
  }
1311
1311
 
1312
1312
  function getCartPage(params = {}) {
1313
- let page;
1314
1313
  const queryParams = typeof params.queryParams === 'object' ? UrlService.toQueryString(params.queryParams) : '';
1315
1314
  const hashParams = params.hashParams ? `#${params.hashParams}` : '';
1316
-
1317
1315
  const mySitePart = checkContext(params) ? '/mysite' : '';
1318
- page = `/static/cart/cart.html${queryParams ? '?' + queryParams : ''}#/${UrlService.getLocale()}${mySitePart}/cart${hashParams}`;
1319
-
1320
- if(equinoxLocalStorage.isEquinoxEnabled()) {
1321
- const [locale, market] = UrlService.getLocale().split("_")
1322
- const currentEnvironment = RunConfigService.getEnvironmentCode();
1323
- page = `https:/mysite.${currentEnvironment !== 'prod' ? currentEnvironment + '.' : '' }mynuskin.com/${market}/${locale}/viewCart`
1324
- }
1316
+ const page = `/static/cart/cart.html${queryParams ? '?' + queryParams : ''}#/${UrlService.getLocale()}${mySitePart}/cart${hashParams}`;
1325
1317
 
1326
1318
  return page;
1327
1319
  }
@@ -66,9 +66,9 @@ async function addProductToEquinoxCart(options) {
66
66
  }],
67
67
  "properties": options.product.properties ? options.product.properties : { "categoryId": "antiaging" }
68
68
  };
69
-
70
- if (options.product.childSkus
71
- && Array.isArray(options.product.childSkus)
69
+
70
+ if (options.product.childSkus
71
+ && Array.isArray(options.product.childSkus)
72
72
  && options.product.childSkus.length > 0) {
73
73
  requestData.skus = options.product.childSkus.map(child => {
74
74
  const childSku = {
@@ -266,16 +266,16 @@ async function _equinoxRequest(options) {
266
266
  function goToCartPage() {
267
267
  // Extract locale and market from the URL
268
268
  const [locale, market] = UrlService.getLocale().split("_");
269
-
269
+
270
270
  // Get the current environment code
271
271
  const currentEnvironment = RunConfigService.getEnvironmentCode();
272
-
272
+
273
273
  // Set the environment based on the current environment code
274
274
  const env = currentEnvironment !== 'prod' ? 'test.' : '';
275
-
275
+
276
276
  // Get the shopping context from the storage
277
277
  const shoppingContext = storage.getItem(storage.keys.SHOPPING_CONTEXT);
278
-
278
+
279
279
  // Set the URL based on the shopping context
280
280
  let url;
281
281
  if (shoppingContext && shoppingContext.context === "storefront") {
@@ -286,7 +286,7 @@ function goToCartPage() {
286
286
  console.error("Invalid shoppingContext", shoppingContext);
287
287
  return;
288
288
  }
289
-
289
+
290
290
  // Navigate to the URL
291
291
  window.location = url;
292
292
  }
@@ -107,15 +107,14 @@ async function addToFavorites(sku) {
107
107
 
108
108
  let body = {'sku': sku};
109
109
 
110
- if (equinoxLocalStorage.isEquinoxEnabled()) {
111
- if (await isMarketEquinoxEnabled()) {
112
- await EquinoxService.addItemToEquinoxList(sku)
113
- const equinoxFavoriteResponse = await EquinoxService.getEquinoxFavorite();
114
- const response = EquinoxService.equinoxFavoritesMapper(equinoxFavoriteResponse);
115
- return handleFavoritesListResponse(response);
116
- }
117
- }
118
110
 
111
+ if (await isMarketEquinoxEnabled()) {
112
+ await EquinoxService.addItemToEquinoxList(sku)
113
+ const equinoxFavoriteResponse = await EquinoxService.getEquinoxFavorite();
114
+ const response = EquinoxService.equinoxFavoritesMapper(equinoxFavoriteResponse);
115
+ return handleFavoritesListResponse(response);
116
+ }
117
+
119
118
  const response = await fetch(url, {
120
119
  method: 'POST',
121
120
  headers: headers,
@@ -326,6 +325,5 @@ function getHeaders() {
326
325
  async function isMarketEquinoxEnabled() {
327
326
 
328
327
  const equinoxMarket = (await getConfiguration(["Equinox_Markets"])).Equinox_Markets;
329
-
330
- return equinoxMarket.active;
328
+ return equinoxMarket.active && equinoxLocalStorage.isEquinoxEnabled();
331
329
  }