zz-shopify-components 0.35.0 → 0.35.1-beta.1
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/sections/zz-live-chat.liquid +46 -5
package/package.json
CHANGED
|
@@ -94,6 +94,8 @@
|
|
|
94
94
|
let scrollTimeout;
|
|
95
95
|
let hasInsertedStyle = false;
|
|
96
96
|
let isLogin = false;
|
|
97
|
+
let loginCheckInterval = null;
|
|
98
|
+
let loginCheckCount = 0;
|
|
97
99
|
let promptTimer = null;
|
|
98
100
|
let autoTriggerTimer = null;
|
|
99
101
|
let promptVisible = false;
|
|
@@ -343,6 +345,7 @@
|
|
|
343
345
|
|
|
344
346
|
function checkLogin() {
|
|
345
347
|
if (isLogin) {
|
|
348
|
+
stopCheckLoginPolling();
|
|
346
349
|
return;
|
|
347
350
|
}
|
|
348
351
|
|
|
@@ -371,6 +374,42 @@
|
|
|
371
374
|
}
|
|
372
375
|
}
|
|
373
376
|
|
|
377
|
+
function stopCheckLoginPolling() {
|
|
378
|
+
if (!loginCheckInterval) {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
clearInterval(loginCheckInterval);
|
|
383
|
+
loginCheckInterval = null;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function startCheckLoginPolling() {
|
|
387
|
+
stopCheckLoginPolling();
|
|
388
|
+
loginCheckCount = 0;
|
|
389
|
+
|
|
390
|
+
checkLogin();
|
|
391
|
+
loginCheckCount += 1;
|
|
392
|
+
|
|
393
|
+
if (isLogin || loginCheckCount >= 5) {
|
|
394
|
+
stopCheckLoginPolling();
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
loginCheckInterval = window.setInterval(function() {
|
|
399
|
+
if (isLogin || loginCheckCount >= 5) {
|
|
400
|
+
stopCheckLoginPolling();
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
checkLogin();
|
|
405
|
+
loginCheckCount += 1;
|
|
406
|
+
|
|
407
|
+
if (isLogin || loginCheckCount >= 5) {
|
|
408
|
+
stopCheckLoginPolling();
|
|
409
|
+
}
|
|
410
|
+
}, 1500);
|
|
411
|
+
}
|
|
412
|
+
|
|
374
413
|
function handleLogin(params) {
|
|
375
414
|
const { email_verified } = params;
|
|
376
415
|
isLogin = true;
|
|
@@ -441,11 +480,13 @@
|
|
|
441
480
|
isDesktop.addEventListener('change', handleViewportChange);
|
|
442
481
|
}
|
|
443
482
|
|
|
444
|
-
|
|
483
|
+
if (closeButton) {
|
|
484
|
+
closeButton.addEventListener('click', function(event) {
|
|
445
485
|
event.preventDefault();
|
|
446
|
-
console.log('closeButton click');
|
|
447
486
|
closePrompt();
|
|
448
|
-
|
|
487
|
+
wrapper.classList.add('hidden');
|
|
488
|
+
});
|
|
489
|
+
}
|
|
449
490
|
|
|
450
491
|
if (chatNowButton) {
|
|
451
492
|
chatNowButton.addEventListener('click', function(event) {
|
|
@@ -465,7 +506,7 @@
|
|
|
465
506
|
}
|
|
466
507
|
|
|
467
508
|
bindMessengerEvents();
|
|
468
|
-
|
|
509
|
+
startCheckLoginPolling();
|
|
469
510
|
scheduleAutoPrompt();
|
|
470
511
|
});
|
|
471
512
|
</script>
|
|
@@ -473,7 +514,7 @@
|
|
|
473
514
|
{% if section.settings.button_image %}
|
|
474
515
|
<div class="live-chat-entry" data-live-chat-wrapper>
|
|
475
516
|
<div
|
|
476
|
-
class="live-chat-prompt
|
|
517
|
+
class="live-chat-prompt"
|
|
477
518
|
data-live-chat-panel
|
|
478
519
|
role="dialog"
|
|
479
520
|
aria-modal="false"
|