@nuskin/ns-shop 7.0.5-cx1-13272.10 → 7.0.5-cx1-13272.12
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/salesEventService.js +8 -2
package/package.json
CHANGED
package/src/salesEventService.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {RunConfigService, UrlService, events, storage} from '@nuskin/ns-util';
|
|
2
2
|
import axios from 'axios';
|
|
3
3
|
import { UserService } from '@nuskin/ns-account';
|
|
4
|
+
import CheckoutModeService from './checkout/checkoutModeService';
|
|
4
5
|
|
|
5
6
|
export default {
|
|
6
7
|
init,
|
|
@@ -26,6 +27,8 @@ const ACTIVE_EVENT_TTL = ONE_MINUTE * 14;
|
|
|
26
27
|
const INITIALIZING = 'initializing';
|
|
27
28
|
const EXTERNAL_INITIALIZING = 'initializing-external';
|
|
28
29
|
|
|
30
|
+
let isGuest = false;
|
|
31
|
+
|
|
29
32
|
// Contains a map of all event tickets that are stored in localStorage.
|
|
30
33
|
let eventTicketInfoMap;
|
|
31
34
|
|
|
@@ -785,7 +788,7 @@ async function _checkForMissingTicket(eventName) {
|
|
|
785
788
|
}
|
|
786
789
|
|
|
787
790
|
function myAlert(msg) {
|
|
788
|
-
if (
|
|
791
|
+
if (isGuest) {
|
|
789
792
|
alert(msg);
|
|
790
793
|
}
|
|
791
794
|
}
|
|
@@ -832,6 +835,8 @@ async function _initializePolling() {
|
|
|
832
835
|
if (window.location.pathname === '/static/checkout/checkout.html') {
|
|
833
836
|
// check for missing tickets. Only perform on checkout s
|
|
834
837
|
const activeEvents = await _getActiveEvents();
|
|
838
|
+
myAlert(`Active Event check, ${activeEventMap}`);
|
|
839
|
+
|
|
835
840
|
for (const eventInfo of activeEvents) {
|
|
836
841
|
await _checkForMissingTicket(eventInfo.eventName);
|
|
837
842
|
}
|
|
@@ -1036,7 +1041,6 @@ async function initActiveEvents(country = undefined) {
|
|
|
1036
1041
|
|
|
1037
1042
|
// If there are event tickets then initialize polling
|
|
1038
1043
|
// if (Object.keys(eventTicketInfoMap).length > 0 && !country) {
|
|
1039
|
-
// Test
|
|
1040
1044
|
await _initializePolling();
|
|
1041
1045
|
// }
|
|
1042
1046
|
_removeWaitCheck(INITIALIZING);
|
|
@@ -1115,6 +1119,8 @@ const isSubset = (array1, array2) => {
|
|
|
1115
1119
|
const csConfigCallback = async (configs) => {
|
|
1116
1120
|
if (configs != null && isSubset(configs, neededConfigMaps)) {
|
|
1117
1121
|
events.unsubscribe(events.global.CS_CONFIG_SET, csConfigCallback);
|
|
1122
|
+
isGuest = CheckoutModeService.isGuestCheckout();
|
|
1123
|
+
if (isGuest) alert(`isGuest ${isGuest}`)
|
|
1118
1124
|
_init(false).then(() => console.log('salesEventService initialized'));
|
|
1119
1125
|
}
|
|
1120
1126
|
}
|