@nuskin/ns-shop 5.21.1 → 5.21.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 +1 -1
- package/src/receiver.js +8 -7
package/package.json
CHANGED
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 =
|
|
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
|
-
|
|
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();
|