@nuskin/ns-shop 5.18.0 → 5.18.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": "5.18.0",
3
+ "version": "5.18.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": {
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;
@@ -1,4 +1,5 @@
1
1
  import CartService from './cartService';
2
+ import $ from "@nuskin/nuskinjquery";
2
3
  import {ConfigService, events, UrlService, RunConfigService, ShoppingContext, storage} from "@nuskin/ns-util";
3
4
  import {Agelocme} from '@nuskin/ns-product-lib';
4
5
  import {UserService} from "@nuskin/ns-account";
@@ -865,9 +866,6 @@ const persistCartUpdates = async () => {
865
866
  let loadCartType = null;
866
867
 
867
868
  if (pcActions.hasItems()) {
868
- // removeCart = pcActions.hasRemoveCartItem();
869
- // loadCartType = pcActions.hasLoadCartItem();
870
-
871
869
  // even though there is no need to process the queue if there is a removeCart
872
870
  // or a loadCart action they still need to get marked as processed so they will
873
871
  // get removed.
@@ -904,6 +902,11 @@ const persistCartUpdates = async () => {
904
902
  if (!(removeCart || loadCartType) && actions.length > 0) {
905
903
  await doPersistentUpdates(actions, pcId, pcVersion, pcType);
906
904
  }
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
+ }
907
910
  if (pcActions.hasItems()) {
908
911
  clearTimeout(timerId);
909
912
  timerId = setTimeout(timerCallback, 200);
@@ -1044,18 +1047,18 @@ let documentReady = false;
1044
1047
  if (window.nsPersistentCartInitialized !== true) {
1045
1048
  window.nsPersistentCartInitialized = true;
1046
1049
  // Wait for page to load and them initialize the service
1047
- // $(document).ready(async function() {
1048
- documentReady = true;
1049
- if (!window.ReactNativeWebView) {
1050
- initPersistentCartService().then(() => console.log('persisted cart loaded'));
1051
- } else {
1052
- events.getValue(events.mobile.NATIVE_INITIALIZING, (value) => {
1053
- if (value === false) {
1054
- initPersistentCartService().then(() => console.log('persisted cart loaded'));
1055
- }
1056
- }, true);
1057
- }
1058
- // });
1050
+ $(document).ready(async function() {
1051
+ documentReady = true;
1052
+ if (!window.ReactNativeWebView) {
1053
+ initPersistentCartService().then(() => console.log('persisted cart loaded'));
1054
+ } else {
1055
+ events.getValue(events.mobile.NATIVE_INITIALIZING, (value) => {
1056
+ if (value === false) {
1057
+ initPersistentCartService().then(() => console.log('persisted cart loaded'));
1058
+ }
1059
+ }, true);
1060
+ }
1061
+ });
1059
1062
  }
1060
1063
  storage.removeItem('pcActivity');
1061
1064
 
@@ -59,7 +59,8 @@ let PaymentType = {
59
59
  BCAI: 123, // BCA installments
60
60
  CENC: 125,
61
61
  IDMIR: 128, // MIR card for Russia
62
- AMIN: 129
62
+ AMIN: 129,
63
+ CBLU: 132 // Carte Bleu
63
64
  };
64
65
 
65
66
  PaymentType.credit = [
@@ -80,7 +81,8 @@ PaymentType.credit = [
80
81
  PaymentType.DINE,
81
82
  PaymentType.VISD,
82
83
  PaymentType.MCD,
83
- PaymentType.IDMIR
84
+ PaymentType.IDMIR,
85
+ PaymentType.CBLU
84
86
  ];
85
87
 
86
88
 
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
  }