@nuskin/ns-shop 7.0.5-cx1-13272.18 → 7.0.5-cx1-13272.19

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": "7.0.5-cx1-13272.18",
3
+ "version": "7.0.5-cx1-13272.19",
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": {
@@ -1,7 +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
+ // import CheckoutModeService from './checkout/checkoutModeService';
5
5
 
6
6
  export default {
7
7
  init,
@@ -27,7 +27,7 @@ const ACTIVE_EVENT_TTL = ONE_MINUTE * 14;
27
27
  const INITIALIZING = 'initializing';
28
28
  const EXTERNAL_INITIALIZING = 'initializing-external';
29
29
 
30
- let isGuest = false;
30
+ // let isGuest = false;
31
31
 
32
32
  // Contains a map of all event tickets that are stored in localStorage.
33
33
  let eventTicketInfoMap;
@@ -73,7 +73,7 @@ events.subscribe(events.salesevent.INIT_EVENT_TICKET, async (eventName, refresh
73
73
 
74
74
  if (eventName && await _initData()) {
75
75
  if (mktEventConfigMap[eventName]) {
76
- myAlert(`events.salesevent.INIT_EVENT_TICKET, ${eventName}`);
76
+ // myAlert(`events.salesevent.INIT_EVENT_TICKET, ${eventName}`);
77
77
  _initEventTicketInfo(eventName, refresh)
78
78
  .catch((err) => {
79
79
  console.error(`Error initializing event ticket for ${eventName}.`, err)
@@ -230,7 +230,7 @@ async function _initEventTicketInfo(eventName, refreshTicket = false) {
230
230
  if (!eventTicketInfo.ticket || refreshTicket) {
231
231
  initInfo.refreshTime = Date.now();
232
232
  await _getRemoteTicket(eventTicketInfo);
233
- myAlert(`_initEventTicketInfo, ${JSON.stringify(eventTicketInfo)}`);
233
+ // myAlert(`_initEventTicketInfo, ${JSON.stringify(eventTicketInfo)}`);
234
234
  useServerWaitTime = true;
235
235
  }
236
236
  _marketStatusCheck(eventTicketInfo);
@@ -428,7 +428,7 @@ function _getLocalStorageTickets() {
428
428
 
429
429
  Object.keys(localStorage).forEach(lsKey => {
430
430
  if (lsKey.endsWith('-event-ticket')) {
431
- myAlert(`localStorage ticket, ${lsKey}`);
431
+ // myAlert(`localStorage ticket, ${lsKey}`);
432
432
  let ticket = getStorageItem(lsKey);
433
433
 
434
434
  if (ticket && ticket.eventName && ticket.ticketId && ticket.status && mktEventConfigMap[ticket.eventName]) {
@@ -786,20 +786,20 @@ function getStorageItem(key) {
786
786
  }
787
787
 
788
788
  async function _checkForMissingTicket(eventName) {
789
- myAlert(`_checkForMissingTicket1, ${eventName}`);
790
- myAlert(`_checkForMissingTicket2, ${JSON.stringify(mktEventConfigMap[eventName])}`);
791
- myAlert(`_checkForMissingTicket3, ${JSON.stringify(eventTicketInfoMap[eventName])}`);
789
+ // myAlert(`_checkForMissingTicket1, ${eventName}`);
790
+ // myAlert(`_checkForMissingTicket2, ${JSON.stringify(mktEventConfigMap[eventName])}`);
791
+ // myAlert(`_checkForMissingTicket3, ${JSON.stringify(eventTicketInfoMap[eventName])}`);
792
792
  if (mktEventConfigMap[eventName] && !eventTicketInfoMap[eventName]) {
793
- myAlert(`missing ticket for ${eventName}`)
793
+ // myAlert(`missing ticket for ${eventName}`)
794
794
  await _initEventTicketInfo(eventName);
795
795
  }
796
796
  }
797
797
 
798
- function myAlert(msg) {
799
- if (isGuest) {
800
- alert(msg);
801
- }
802
- }
798
+ // function myAlert(msg) {
799
+ // if (isGuest) {
800
+ // alert(msg);
801
+ // }
802
+ // }
803
803
 
804
804
  /**
805
805
  * This initializes an interval timer which checks to see if the browser (computer)
@@ -839,7 +839,7 @@ async function _initializePolling() {
839
839
  if (window.location.pathname === '/static/checkout/checkout.html') {
840
840
  // check for missing tickets. Only perform on checkout s
841
841
  const activeEvents = await _getActiveEvents();
842
- myAlert(`Active Event check, ${JSON.stringify(activeEvents.map(ae => ae.eventName))}`);
842
+ // myAlert(`Active Event check, ${JSON.stringify(activeEvents.map(ae => ae.eventName))}`);
843
843
 
844
844
  for (const eventInfo of activeEvents) {
845
845
  await _checkForMissingTicket(eventInfo.eventName);
@@ -983,14 +983,14 @@ async function _loadAwsActiveEvents(country) {
983
983
  * @param eventNames
984
984
  */
985
985
  let addEvents = (eventNames) => {
986
- myAlert(`addEvents1 ${JSON.stringify(eventNames)}`)
986
+ // myAlert(`addEvents1 ${JSON.stringify(eventNames)}`)
987
987
  eventNames.forEach(_eventName => {
988
988
  let eventName = _eventName.eventName || _eventName;
989
989
 
990
- myAlert(`addEvents2 ${JSON.stringify(mktEventConfigMap[eventName])}`)
990
+ // myAlert(`addEvents2 ${JSON.stringify(mktEventConfigMap[eventName])}`)
991
991
  if (mktEventConfigMap[eventName]) {
992
992
  eventInfos[eventName] = _createEventTicketInfo(eventName);
993
- myAlert(`addEvents3 ${JSON.stringify(eventInfos)}`)
993
+ // myAlert(`addEvents3 ${JSON.stringify(eventInfos)}`)
994
994
  }
995
995
  });
996
996
  };
@@ -1000,7 +1000,7 @@ async function _loadAwsActiveEvents(country) {
1000
1000
  storageObj = {events: []};
1001
1001
  storage.setItem(activeEventsName, storageObj, {ttl: 250}); // to prevent multiple calls.
1002
1002
  try {
1003
- myAlert(`_loadAwsActiveEvents - no storageObj`)
1003
+ // myAlert(`_loadAwsActiveEvents - no storageObj`)
1004
1004
  addEvents(await _getActiveEvents());
1005
1005
  } catch (e) {
1006
1006
  // an error occurred with the call, clear active events
@@ -1042,20 +1042,20 @@ async function initActiveEvents(country = undefined) {
1042
1042
  }
1043
1043
  })
1044
1044
 
1045
- myAlert(`initActiveEvents0, ${JSON.stringify(awsEvents)}`)
1046
- myAlert(`initActiveEvents1, ${JSON.stringify(eventTicketInfoMap)}`)
1045
+ // myAlert(`initActiveEvents0, ${JSON.stringify(awsEvents)}`)
1046
+ // myAlert(`initActiveEvents1, ${JSON.stringify(eventTicketInfoMap)}`)
1047
1047
  eventTicketInfoMap = Object.assign({}, awsEvents, eventTicketInfoMap);
1048
- myAlert(`initActiveEvents2, ${JSON.stringify(eventTicketInfoMap)}`)
1048
+ // myAlert(`initActiveEvents2, ${JSON.stringify(eventTicketInfoMap)}`)
1049
1049
  Object.keys(eventTicketInfoMap).forEach(eventName => {
1050
1050
  if (mktEventConfigMap[eventName] && eventTicketInfoMap[eventName].eventName) {
1051
- myAlert(`initActiveEvents, ${JSON.stringify(eventTicketInfoMap[eventName])}`)
1051
+ // myAlert(`initActiveEvents, ${JSON.stringify(eventTicketInfoMap[eventName])}`)
1052
1052
  promises.push(_initEventTicketInfo(eventName));
1053
1053
  }
1054
1054
  });
1055
1055
  }
1056
1056
 
1057
1057
  return Promise.all(promises).then(async () => {
1058
- myAlert(`Initial Events, ${[Object.keys(activeEventMap)]}`);
1058
+ // myAlert(`Initial Events, ${[Object.keys(activeEventMap)]}`);
1059
1059
 
1060
1060
  events.setValue(events.salesevent.INITIAL_ACTIVE_EVENTS, [Object.keys(activeEventMap)]);
1061
1061
 
@@ -1139,7 +1139,7 @@ const isSubset = (array1, array2) => {
1139
1139
  const csConfigCallback = async (configs) => {
1140
1140
  if (configs != null && isSubset(configs, neededConfigMaps)) {
1141
1141
  events.unsubscribe(events.global.CS_CONFIG_SET, csConfigCallback);
1142
- isGuest = CheckoutModeService.isGuestCheckout();
1142
+ // isGuest = CheckoutModeService.isGuestCheckout();
1143
1143
  _init(false).then(() => console.log('salesEventService initialized'));
1144
1144
  }
1145
1145
  }