@nuskin/ns-shop 7.7.0-pa-902.1 → 7.7.0-pa-902.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": "7.7.0-pa-902.1",
3
+ "version": "7.7.0-pa-902.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": {
@@ -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.2",
45
+ "@nuskin/ns-util": "4.7.3-pa-902.1",
46
46
  "axios-mock-adapter": "1.22.0",
47
47
  "axios": "1.9.0",
48
48
  "babel-cli": "6.26.0",
@@ -355,6 +355,9 @@ function itemIsAvailable(product) {
355
355
  */
356
356
  async function addProductToCart(options) {
357
357
  await awaitForConfig();
358
+ if (!await canUserAddToCart()) {
359
+ throw new Error();
360
+ }
358
361
  let cart = _getCart();
359
362
 
360
363
  if (!options.sapLineId && !itemIsAvailable(options.product)) {
@@ -423,6 +426,10 @@ async function addProductToCart(options) {
423
426
  * }
424
427
  */
425
428
  async function addSkuToCart(options) {
429
+ if (!await canUserAddToCart()) {
430
+ throw new Error();
431
+ }
432
+
426
433
  let retVal,
427
434
  response = await ProductService.getProductBySku(options),
428
435
  product = response.success && response.product;
@@ -1491,6 +1498,8 @@ const cartServiceConfigCallback = async (configs) => {
1491
1498
  }
1492
1499
  }, true);
1493
1500
  events.publish(events.salesevent.POLL_MARKET_CONFIG);
1501
+
1502
+ events.setValue(events.shop.USER_CANNOT_SHOP, !(await canUserAddToCart()))
1494
1503
  }
1495
1504
  }
1496
1505