@nuskin/ns-shop 5.18.8 → 5.18.9

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.8",
3
+ "version": "5.18.9",
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": {
@@ -725,6 +725,12 @@ const persistLocalItems = async (cartItems, authInfo) => {
725
725
  return pCart;
726
726
  };
727
727
 
728
+ const updateMobile = () => {
729
+ if (window.ReactNativeWebView) {
730
+ window.ReactNativeWebView.postMessage(JSON.stringify({name: 'cart_quantity', payload: CartService.getItemCnt()}));
731
+ }
732
+ };
733
+
728
734
  /**
729
735
  * This checks to see if the local cart needs to have the persisted cart merged
730
736
  * into it.
@@ -759,6 +765,7 @@ const syncCart = async (type) => {
759
765
  CartService.clearCart();
760
766
  }
761
767
  }
768
+ updateMobile();
762
769
  events.setValue(events.shop.CART_SYNCED_ON_LOAD, [true]);
763
770
  };
764
771
 
@@ -902,11 +909,7 @@ const persistCartUpdates = async () => {
902
909
  if (!(removeCart || loadCartType) && actions.length > 0) {
903
910
  await doPersistentUpdates(actions, pcId, pcVersion, pcType);
904
911
  }
905
- if (removeCart || loadCartType || actions.length > 0) {
906
- if (window.ReactNativeWebView) {
907
- window.ReactNativeWebView.postMessage(JSON.stringify({name: 'cart_quantity', payload: CartService.getItemCnt()}));
908
- }
909
- }
912
+ updateMobile();
910
913
  if (pcActions.hasItems()) {
911
914
  clearTimeout(timerId);
912
915
  timerId = setTimeout(timerCallback, 200);
@@ -571,19 +571,21 @@ const syncProductItems = (order, sapProducts, adr, includeSapItems) => {
571
571
  newItem.backOrderDate = sapItem.BackorderAvailableDate;
572
572
 
573
573
  if (sapItem.LineItem.Custom) {
574
- let name = null, label = null;
574
+ let code = null, name = null, label = null;
575
575
 
576
576
  sapItem.LineItem.Custom.forEach(custom => {
577
- if (custom.Key === "NAME") {
577
+ if (custom.Key === 'ID') {
578
+ code = custom.Value;
579
+ } else if (custom.Key === "NAME") {
578
580
  name = custom.Value;
579
581
  } else if (custom.Key === "LABEL") {
580
582
  label = custom.Value;
581
583
  }
582
584
  });
583
- if (name !== null || label != null) {
585
+ if (code != null || name !== null || label != null) {
584
586
  newItem.agelocme = new Agelocme({
585
- code: aSku,
586
- isCoreSolution: aSku.length === 3,
587
+ code: code,
588
+ isCoreSolution: code.length === 3,
587
589
  name: name,
588
590
  label: label
589
591
  });