@nuskin/ns-shop 7.0.5-cx1-13272.9 → 7.0.5-cx1-13272.11
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 +16 -0
package/package.json
CHANGED
package/src/salesEventService.js
CHANGED
|
@@ -205,6 +205,8 @@ function logAnalyticInfo(tag, eventName, data = {}) {
|
|
|
205
205
|
*/
|
|
206
206
|
let initEventTicketCallMap = {};
|
|
207
207
|
async function _initEventTicketInfo(eventName, refreshTicket = false) {
|
|
208
|
+
myAlert(`_initEventTicketInfo, ${eventName}`);
|
|
209
|
+
|
|
208
210
|
let initInfo = initEventTicketCallMap[eventName];
|
|
209
211
|
if (!initInfo) {
|
|
210
212
|
initInfo = {initialized: false, refreshTime: 0};
|
|
@@ -782,12 +784,20 @@ async function _checkForMissingTicket(eventName) {
|
|
|
782
784
|
}
|
|
783
785
|
}
|
|
784
786
|
|
|
787
|
+
function myAlert(msg) {
|
|
788
|
+
if (window.ReactNativeWebView) {
|
|
789
|
+
alert(msg);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
785
793
|
/**
|
|
786
794
|
* This initializes an interval timer which checks to see if the browser (computer)
|
|
787
795
|
* went to sleep. It's intention is to update the wait timer if it has.
|
|
788
796
|
*/
|
|
789
797
|
async function _initializePolling() {
|
|
798
|
+
myAlert('_initializePolling');
|
|
790
799
|
if (!intervalId) {
|
|
800
|
+
myAlert('_initializePolling - no intervalId');
|
|
791
801
|
const TIMEOUT = 10000;
|
|
792
802
|
let lastTime = Date.now(),
|
|
793
803
|
intervalCnt = 1;
|
|
@@ -796,6 +806,8 @@ async function _initializePolling() {
|
|
|
796
806
|
const now = Date.now();
|
|
797
807
|
const slept = now > (lastTime + TIMEOUT + 3000)
|
|
798
808
|
|
|
809
|
+
myAlert('polling triggered');
|
|
810
|
+
|
|
799
811
|
// if polling market config, only reload it every 30 seconds
|
|
800
812
|
if (slept || pollMarketConfig && intervalCnt % 6 === 0) {
|
|
801
813
|
await _loadMarketEventConfig(true);
|
|
@@ -820,6 +832,8 @@ async function _initializePolling() {
|
|
|
820
832
|
if (window.location.pathname === '/static/checkout/checkout.html') {
|
|
821
833
|
// check for missing tickets. Only perform on checkout s
|
|
822
834
|
const activeEvents = await _getActiveEvents();
|
|
835
|
+
myAlert(`Active Event check, ${activeEventMap}`);
|
|
836
|
+
|
|
823
837
|
for (const eventInfo of activeEvents) {
|
|
824
838
|
await _checkForMissingTicket(eventInfo.eventName);
|
|
825
839
|
}
|
|
@@ -1018,6 +1032,8 @@ async function initActiveEvents(country = undefined) {
|
|
|
1018
1032
|
}
|
|
1019
1033
|
|
|
1020
1034
|
return Promise.all(promises).then(async () => {
|
|
1035
|
+
myAlert(`Initial Events, ${[Object.keys(activeEventMap)]}`);
|
|
1036
|
+
|
|
1021
1037
|
events.setValue(events.salesevent.INITIAL_ACTIVE_EVENTS, [Object.keys(activeEventMap)]);
|
|
1022
1038
|
|
|
1023
1039
|
// If there are event tickets then initialize polling
|