@nuskin/ns-shop 5.18.1 → 5.18.2

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": "5.18.1",
3
+ "version": "5.18.2",
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": {
package/src/cart/cart.js CHANGED
@@ -1310,9 +1310,6 @@ export default function Cart(cartData) {
1310
1310
  if (doneSyncingPersistedCart) {
1311
1311
  publishCartQtyChange(json, referrer);
1312
1312
  }
1313
- if (window.ReactNativeWebView) {
1314
- window.ReactNativeWebView.postMessage(JSON.stringify({name: 'cart_quantity', payload: json.cartInfo.qty}));
1315
- }
1316
1313
  json.pcId = id;
1317
1314
  json.pcVersion = version;
1318
1315
  json.pcType = type;
@@ -865,9 +865,6 @@ const persistCartUpdates = async () => {
865
865
  let loadCartType = null;
866
866
 
867
867
  if (pcActions.hasItems()) {
868
- // removeCart = pcActions.hasRemoveCartItem();
869
- // loadCartType = pcActions.hasLoadCartItem();
870
-
871
868
  // even though there is no need to process the queue if there is a removeCart
872
869
  // or a loadCart action they still need to get marked as processed so they will
873
870
  // get removed.
@@ -904,6 +901,11 @@ const persistCartUpdates = async () => {
904
901
  if (!(removeCart || loadCartType) && actions.length > 0) {
905
902
  await doPersistentUpdates(actions, pcId, pcVersion, pcType);
906
903
  }
904
+ if (removeCart || loadCartType || actions.length > 0) {
905
+ if (window.ReactNativeWebView) {
906
+ window.ReactNativeWebView.postMessage(JSON.stringify({name: 'cart_quantity', payload: CartService.getItemCnt()}));
907
+ }
908
+ }
907
909
  if (pcActions.hasItems()) {
908
910
  clearTimeout(timerId);
909
911
  timerId = setTimeout(timerCallback, 200);
package/src/receiver.js CHANGED
@@ -324,6 +324,7 @@ const eventListener = async (message) => {
324
324
  }
325
325
  } else {
326
326
  if (AuthenticationService.isLoggedIn()) {
327
+ CartService.clearCart();
327
328
  AuthenticationService.logout();
328
329
  }
329
330
  }