@nuskin/ns-shop 7.7.0-pa-902.3 → 7.7.0-pa-902.5

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": "7.7.0-pa-902.3",
3
+ "version": "7.7.0-pa-902.5",
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": {
@@ -42,7 +42,7 @@
42
42
  "@nuskin/ns-account": "5.13.0",
43
43
  "@nuskin/ns-jsanalyzer": "1.0.1",
44
44
  "@nuskin/ns-product": "3.51.0",
45
- "@nuskin/ns-util": "4.7.3-pa-902.1",
45
+ "@nuskin/ns-util": "4.8.0",
46
46
  "axios-mock-adapter": "1.22.0",
47
47
  "axios": "1.9.0",
48
48
  "babel-cli": "6.26.0",
@@ -356,7 +356,8 @@ function itemIsAvailable(product) {
356
356
  async function addProductToCart(options) {
357
357
  await awaitForConfig();
358
358
  if (!await canUserAddToCart()) {
359
- throw new Error();
359
+ events.setValue(events.shop.HOME_MARKET_ONLY_RESTRICTED, !(await canUserAddToCart()));
360
+ return;
360
361
  }
361
362
  let cart = _getCart();
362
363
 
@@ -427,7 +428,8 @@ async function addProductToCart(options) {
427
428
  */
428
429
  async function addSkuToCart(options) {
429
430
  if (!await canUserAddToCart()) {
430
- throw new Error();
431
+ events.setValue(events.shop.HOME_MARKET_ONLY_RESTRICTED, !(await canUserAddToCart()));
432
+ return;
431
433
  }
432
434
 
433
435
  let retVal,
@@ -1498,8 +1500,6 @@ const cartServiceConfigCallback = async (configs) => {
1498
1500
  }
1499
1501
  }, true);
1500
1502
  events.publish(events.salesevent.POLL_MARKET_CONFIG);
1501
-
1502
- events.setValue(events.shop.USER_CANNOT_SHOP, !(await canUserAddToCart()))
1503
1503
  }
1504
1504
  }
1505
1505
 
@@ -439,11 +439,13 @@ const updateAnonymousPersistedCart = async (cartId, payload) => {
439
439
  */
440
440
  const removePersistedCart = async (cartId) => {
441
441
  const user = UserService.getUser();
442
+ const {country} = RunConfigService.getRunConfig();
443
+
442
444
  try {
443
445
  if (user && cartId) {
444
446
  await axios({
445
447
  method: 'DELETE',
446
- url: getUrl('deleteCart', cartId, {accountId: user.id}),
448
+ url: getUrl('deleteCart', cartId, {accountId: user.id, country}),
447
449
  headers: getHeaders(user.eid)
448
450
  });
449
451
  CartService.setCartProperties({id: '', version: -1});