@nuskin/ns-shop 6.11.3 → 6.11.4

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.11.3",
3
+ "version": "6.11.4",
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.7",
27
27
  "@nuskin/ns-feature-flags": "1.4.7",
28
28
  "@nuskin/ns-loyalty-web": "1.5.6",
29
- "@nuskin/ns-product-lib": "2.15.1",
29
+ "@nuskin/ns-product-lib": "2.15.2",
30
30
  "@nuskin/nuskinjquery": "2.3.1",
31
31
  "axios": "1.6.5",
32
32
  "decimal.js": "10.4.3",
@@ -36,11 +36,11 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@babel/preset-env": "^7.23.8",
39
- "@nuskin/configuration-sdk": "2.3.2",
39
+ "@nuskin/configuration-sdk": "2.3.3",
40
40
  "@nuskin/exclusive-offer-sdk": "1.2.4",
41
41
  "@nuskin/ns-account": "5.9.2",
42
42
  "@nuskin/ns-jsanalyzer": "1.0.1",
43
- "@nuskin/ns-product": "3.48.1",
43
+ "@nuskin/ns-product": "3.48.3",
44
44
  "@nuskin/ns-util": "4.5.4",
45
45
  "axios-mock-adapter": "1.22.0",
46
46
  "babel-cli": "6.26.0",
@@ -19,6 +19,8 @@ const shoppingContextCartTypes = {
19
19
 
20
20
  const DEFAULT_CART_TYPE = 'USER';
21
21
 
22
+ let requestSent = false;
23
+
22
24
  export default {
23
25
  addProductToEquinoxCart,
24
26
  getEquinoxCart,
@@ -198,8 +200,12 @@ async function getEquinoxCart() {
198
200
  method: 'GET',
199
201
  endpoint: `carts/${cartType}`
200
202
  }
201
-
202
- return await _equinoxRequest(equinoxRequestOptions);
203
+ if (!requestSent) {
204
+ requestSent = true;
205
+ return await _equinoxRequest(equinoxRequestOptions);
206
+ } else {
207
+ return null
208
+ }
203
209
 
204
210
  }
205
211
 
@@ -238,6 +244,7 @@ async function getEquinoxRequestConfiguration() {
238
244
  */
239
245
  async function _equinoxRequest(options) {
240
246
  const { equinoxMarket, mySiteKongURL, marketLocale } = await getEquinoxRequestConfiguration();
247
+
241
248
  const defaultEquinoxParams = {
242
249
  locale: marketLocale,
243
250
  storeId: equinoxMarket.store_id
@@ -381,6 +388,7 @@ const runConfigCallback = async (runConfig) => {
381
388
  const publishEquinoxCartCount = (options) => {
382
389
  getEquinoxCart().then((response) => {
383
390
  const cart = response.data;
391
+ requestSent = false;
384
392
  events.publish(events.shop.CART_UPDATED, { cartInfo: { qty: cart.value.count }, ...options });
385
393
  });
386
394
  }
@@ -391,9 +399,7 @@ const runConfigCallback = async (runConfig) => {
391
399
  publishEquinoxCartCount(options)
392
400
  });
393
401
 
394
- events.subscribe(events.shop.SET_SHOPPING_CONTEXT, () => {
395
- publishEquinoxCartCount()
396
- });
402
+ events.subscribe(events.shop.SET_SHOPPING_CONTEXT);
397
403
  }
398
404
  }
399
405
  }