@nuskin/ns-shop 7.0.5-cx1-13272.8 → 7.0.5-cx1-13272.9

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.8",
3
+ "version": "7.0.5-cx1-13272.9",
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": {
@@ -162,59 +162,9 @@ async function getEventStatus(eventsToCheck = []) {
162
162
  eventStatus[eventName] = activeStatus;
163
163
  });
164
164
 
165
- // responses.forEach((response) => {
166
- // let activeStatus = false;
167
- // if (response.status === 'fulfilled' && response.value) {
168
- // const status = _decodeStatus(response.value.status);
169
- // if ((status.eventStatus === PRE_EVENT && status.preWaitTime <= 30000) ||
170
- // status.eventStatus === IN_EVENT) {
171
- // activeStatus = true;
172
- // }
173
- // eventStatus[response.value.eventName] = activeStatus;
174
- // }
175
- // });
176
-
177
165
  return eventStatus;
178
166
  }
179
167
 
180
- /**
181
- * Either requests a new ticket or an updated event ticket from the AWS service
182
- *
183
- * @param eventTicketInfo - contains informatino about the ticket.
184
- *
185
- * @returns {Promise<*>} a new or updated ticket for the specified event
186
- * @private
187
- */
188
- // async function _getTempTicket(eventName, externalId) {
189
- // let ticket;
190
-
191
- // try {
192
- // let method = 'POST',
193
- // seParams = _getSeParams(eventName, false),
194
- // response = await axios({
195
- // method: method,
196
- // url: `${_getAwsUrl(eventName, null)}?orderEventCheck=${externalId}${seParams}`,
197
- // headers: _getHeaders(),
198
- // timeout: 7000
199
- // });
200
-
201
- // ticket = response.data.salesEventResponse;
202
- // } catch (err) {
203
- // if (err.response && err.response.data.status === 404) {
204
- // console.error(`getTempTicket - unable to get a temporary ticket for ${eventName}`);
205
- // throw err;
206
- // } else {
207
- // console.error(`getTempTicket error or timeout - waiting to try again for ${eventName}`);
208
- // // Timed out or some other error
209
- // // Wait and then call again.
210
- // await _wait(3000);
211
- // ticket = await _getTempTicket(eventName);
212
- // }
213
- // }
214
-
215
- // return ticket;
216
- // }
217
-
218
168
  function logAnalyticInfo(tag, eventName, data = {}) {
219
169
  const user = UserService.getUser();
220
170
  const eventTicketInfo = eventTicketInfoMap[eventName];
@@ -867,10 +817,12 @@ async function _initializePolling() {
867
817
  _checkStatus(eventTicketInfo, false);
868
818
  });
869
819
 
870
- // check for missing tickets
871
- const activeEvents = await _getActiveEvents();
872
- for (const eventInfo of activeEvents) {
873
- await _checkForMissingTicket(eventInfo.eventName);
820
+ if (window.location.pathname === '/static/checkout/checkout.html') {
821
+ // check for missing tickets. Only perform on checkout s
822
+ const activeEvents = await _getActiveEvents();
823
+ for (const eventInfo of activeEvents) {
824
+ await _checkForMissingTicket(eventInfo.eventName);
825
+ }
874
826
  }
875
827
 
876
828
  lastTime = now;
@@ -1069,9 +1021,10 @@ async function initActiveEvents(country = undefined) {
1069
1021
  events.setValue(events.salesevent.INITIAL_ACTIVE_EVENTS, [Object.keys(activeEventMap)]);
1070
1022
 
1071
1023
  // If there are event tickets then initialize polling
1072
- if (Object.keys(eventTicketInfoMap).length > 0 && !country) {
1073
- await _initializePolling();
1074
- }
1024
+ // if (Object.keys(eventTicketInfoMap).length > 0 && !country) {
1025
+ // Test
1026
+ await _initializePolling();
1027
+ // }
1075
1028
  _removeWaitCheck(INITIALIZING);
1076
1029
  });
1077
1030
  }
@@ -1127,13 +1080,13 @@ async function _init(force = true) {
1127
1080
  * If there are, make sure polling is happening, otherwise, stop polling.
1128
1081
  */
1129
1082
  events.subscribe(events.salesevent.ACTIVE_EVENTS, (/*activeEvents*/) => {
1130
- if (eventTicketInfoMap) {
1131
- if (Object.keys(eventTicketInfoMap).length > 0) {
1132
- _initializePolling().then(() => console.log('Polling initialized'));
1133
- } else {
1134
- _clearPollingInterval();
1135
- }
1136
- }
1083
+ // if (eventTicketInfoMap) {
1084
+ // if (Object.keys(eventTicketInfoMap).length > 0) {
1085
+ _initializePolling().then(() => console.log('Polling initialized'));
1086
+ // } else {
1087
+ // _clearPollingInterval();
1088
+ // }
1089
+ // }
1137
1090
  });
1138
1091
 
1139
1092
  // persistentCartService needs to wait until the following configMaps are loaded