zz-shopify-components 0.35.1-beta.1 → 0.35.1-beta.3

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": "zz-shopify-components",
3
- "version": "0.35.1-beta.1",
3
+ "version": "0.35.1-beta.3",
4
4
  "description": "Reusable Shopify components for theme projects",
5
5
  "keywords": [
6
6
  "shopify",
@@ -503,6 +503,7 @@ zz-card-strip section 是一个用于展示多张可展开卡片的横向交互
503
503
  #zz-card-strip-{{ section.id }} button.zz-mobile-only {
504
504
  width: 124px;
505
505
  height: 42px;
506
+ padding: 0px;
506
507
  }
507
508
  }
508
509
  </style>
@@ -678,6 +679,32 @@ zz-card-strip section 是一个用于展示多张可展开卡片的横向交互
678
679
  btn_id: mb_btn_id,
679
680
  modal_id: block.settings.modal_id
680
681
  %}
682
+ <script>
683
+ document.addEventListener('DOMContentLoaded', (event) => {
684
+ const btn = document.getElementsByClassName('{{ btn_class }}')
685
+ if(btn && btn[0]) {
686
+ {% for block in section.blocks %}
687
+ {% if block.type == 'cta_button' %}
688
+ {% if block.settings.click_event_class_name != blank %}
689
+ btn[0].addEventListener('click', (event) => {
690
+ window.zzAnalytics && window.zzAnalytics.trackEvent("{{ block.settings.click_event_class_name }}", {
691
+ timestamp: new Date().toISOString(),
692
+ });
693
+ });
694
+ {% endif %}
695
+ {% if block.settings.function_type == 'link_map' %}
696
+ if(window.bindSiteJump) {
697
+ bindSiteJump(btn[0], {{ block.settings.links | json }})
698
+ if (btn[1]) {
699
+ bindSiteJump(btn[1], {{ block.settings.links | json }})
700
+ }
701
+ }
702
+ {% endif %}
703
+ {% endif %}
704
+ {% endfor %}
705
+ }
706
+ })
707
+ </script>
681
708
  {% endif %}
682
709
  {% endfor %}
683
710
  </div>
@@ -1155,29 +1182,6 @@ zz-card-strip section 是一个用于展示多张可展开卡片的横向交互
1155
1182
  }
1156
1183
  })();
1157
1184
  </script>
1158
- <script>
1159
- document.addEventListener('DOMContentLoaded', (event) => {
1160
- const btn = document.getElementsByClassName('{{ btn_class }}')
1161
- if(btn && btn[0]) {
1162
- {% for block in section.blocks %}
1163
- {% if block.type == 'cta_button' %}
1164
- {% if block.settings.click_event_class_name != blank %}
1165
- btn[0].addEventListener('click', (event) => {
1166
- window.zzAnalytics && window.zzAnalytics.trackEvent("{{ block.settings.click_event_class_name }}", {
1167
- timestamp: new Date().toISOString(),
1168
- });
1169
- });
1170
- {% endif %}
1171
- {% if block.settings.function_type == 'link_map' %}
1172
- if(window.bindSiteJump) {
1173
- bindSiteJump(btn[0], {{ block.settings.links | json }})
1174
- }
1175
- {% endif %}
1176
- {% endif %}
1177
- {% endfor %}
1178
- }
1179
- })
1180
- </script>
1181
1185
 
1182
1186
  {% schema %}
1183
1187
  {
@@ -85,12 +85,15 @@
85
85
  const closeButton = section.querySelector('[data-live-chat-close]');
86
86
  const chatNowButton = section.querySelector('[data-live-chat-open]');
87
87
  const emailLink = section.querySelector('[data-live-chat-email]');
88
- const isDesktop = window.matchMedia('(min-width: 1024px)');
88
+ const isDesktop = window.matchMedia('(min-width: 1025px)');
89
89
 
90
90
  if (!wrapper || !floatingButton || !promptPanel) {
91
91
  return;
92
92
  }
93
93
 
94
+ const desktopAutoPromptDelay = 10000;
95
+ const mobileAutoPromptDelay = 30000;
96
+
94
97
  let scrollTimeout;
95
98
  let hasInsertedStyle = false;
96
99
  let isLogin = false;
@@ -295,7 +298,7 @@
295
298
 
296
299
  hasAutoPrompted = true;
297
300
  showPrompt('auto');
298
- }, 10000);
301
+ }, isDesktop.matches ? desktopAutoPromptDelay : mobileAutoPromptDelay);
299
302
  }
300
303
 
301
304
  function handleFloatingButtonClick(event) {
@@ -484,7 +487,6 @@
484
487
  closeButton.addEventListener('click', function(event) {
485
488
  event.preventDefault();
486
489
  closePrompt();
487
- wrapper.classList.add('hidden');
488
490
  });
489
491
  }
490
492
 
@@ -761,7 +763,7 @@
761
763
  pointer-events: none;
762
764
  }
763
765
 
764
- @media (min-width: 1024px) {
766
+ @media (min-width: 1025px) {
765
767
  #shopify-section-{{ section.id }} .live-chat-entry {
766
768
  bottom: {{ section.settings.pc_bottom }}px;
767
769
  }
@@ -772,7 +774,7 @@
772
774
 
773
775
  }
774
776
 
775
- @media (max-width: 1023px) {
777
+ @media (max-width: 1024px) {
776
778
  #shopify-section-{{ section.id }} .live-chat-entry {
777
779
  right: 16px;
778
780
  align-items: flex-end;