@nuskin/ns-shop 5.21.1 → 5.21.4

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.21.1",
3
+ "version": "5.21.4",
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": {
@@ -860,8 +860,13 @@ let setSelectedShipMethod = function(order, matchMethod = {}) {
860
860
  }
861
861
  };
862
862
 
863
- // Parses pickup points from SAP response, in case shipping method is set to pickup points!
864
- function setPickupPoints(custom, order) {
863
+ /**
864
+ * Parses pickup points from SAP response, in case shipping method is set to pickup points!
865
+ * @param {Object[]} custom The Custom array on the salesorderrequest
866
+ * @param {Object} order
867
+ */
868
+ function setPickupPoints(custom = [], order) {
869
+ custom = custom || [];
865
870
  if (order.selectedShippingMethod && PickupUtil.supports(order.selectedShippingMethod.Code)) {
866
871
  order.pickupPoints = PickupUtil.parse(custom);
867
872
  if (order.selectedPickupPoint) {
package/src/receiver.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import $ from '@nuskin/nuskinjquery';
2
- import {UserService, AuthenticationService} from "@nuskin/ns-account";
2
+ import {UserService, AuthenticationService, VGDistInfoService} from "@nuskin/ns-account";
3
3
  import {ConfigService, RunConfigService, storage, util, ShoppingContext, Base64, events} from "@nuskin/ns-util";
4
4
  import {Agelocme} from '@nuskin/ns-product-lib';
5
5
  import CartService from './cart/cartService';
@@ -350,11 +350,16 @@ const setUserInfo = (mobileUser) => {
350
350
  UserService.setLoggedIn(true);
351
351
  events.publish(events.authentication.VALID, [userInfo]);
352
352
  AuthenticationService.generateMecCookies();
353
+ VGDistInfoService.checkVolumeData().then(() => console.log('Checked Volume Data'));
353
354
  };
354
355
 
355
356
  let receivingMobile = false;
356
357
  const eventListener = async (message) => {
357
- let data = JSON.parse(message.data);
358
+ let data = {};
359
+
360
+ if (typeof message.data === 'string') {
361
+ data = JSON.parse(message.data);
362
+ }
358
363
 
359
364
  if (data.cartMessage) {
360
365
  receivingMobile = true;
@@ -372,11 +377,7 @@ const eventListener = async (message) => {
372
377
  if (data.eid) {
373
378
  await authenticateWithEid(data.eid);
374
379
  } else if (data.user && data.user.eid) {
375
- if (RunConfigService.getRunConfig().country === 'JP') {
376
- await authenticateWithEid(data.user.eid);
377
- } else {
378
- setUserInfo(data.user);
379
- }
380
+ setUserInfo(data.user);
380
381
  } else {
381
382
  if (AuthenticationService.isLoggedIn()) {
382
383
  CartService.clearCart();