zz-shopify-components 0.35.1-beta.8 → 0.36.0

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.
@@ -521,4 +521,7 @@ body.zz-dialog-open {
521
521
  height: 0;
522
522
  display: none;
523
523
  /* Chrome/Safari/Edge */
524
- }
524
+ }
525
+ .zz-hidden {
526
+ display: none !important;
527
+ }
@@ -680,3 +680,54 @@ if (!customElements.get('zz-normal-modal')) {
680
680
 
681
681
  customElements.define('zz-normal-modal', ZZNormalModal);
682
682
  }
683
+
684
+ function updateCountryVisibility(currentCountry, marketWordList) {
685
+ console.log('updateCountryVisibility', currentCountry);
686
+ if (!currentCountry) return;
687
+
688
+ // currentCountry 当前国家记录的是PHcountry
689
+ // 查找currentCountry对应的showCountry
690
+ const selectCountry = marketWordList.find(
691
+ (item) => item.PHcountry === currentCountry
692
+ );
693
+ if (!selectCountry) return;
694
+ currentCountry = selectCountry.showCountry;
695
+ const isEuropeCountry = selectCountry.formState === 'Europe';
696
+
697
+ // visibleCountries 使用的是marketWordList中country字段
698
+ currentCountry = currentCountry.toUpperCase();
699
+
700
+ document.querySelectorAll('[data-visibility-rule]').forEach((element) => {
701
+ if (!element.dataset.visibilityCountries) return;
702
+
703
+ const rule = element.dataset.visibilityRule;
704
+ const countries = (element.dataset.visibilityCountries || '')
705
+ .split(',')
706
+ .map((item) => item.trim().toUpperCase())
707
+ .filter(Boolean);
708
+ const isMatchedCountry =
709
+ countries.includes(currentCountry) ||
710
+ (countries.includes('EU') && isEuropeCountry);
711
+
712
+ let visible = true;
713
+
714
+ switch (rule) {
715
+ case 'country_only':
716
+ visible = isMatchedCountry;
717
+ break;
718
+
719
+ case 'country_exclude':
720
+ visible = !isMatchedCountry;
721
+ break;
722
+
723
+ default:
724
+ visible = true;
725
+ }
726
+
727
+ if (visible) {
728
+ element.classList.remove('zz-hidden');
729
+ } else {
730
+ element.classList.add('zz-hidden');
731
+ }
732
+ });
733
+ }
@@ -143,27 +143,27 @@ document.addEventListener('DOMContentLoaded', () => {
143
143
  ease: 'power1.out',
144
144
  });
145
145
  });
146
- });
147
146
 
148
- // 跟随滚动缓慢显示
149
- const slowReveal = document.querySelectorAll('.slow-reveal');
150
- slowReveal.forEach((element) => {
151
- // 过滤出不包含 no-fade-in 类名的子元素
152
- const children = Array.from(element.children).filter(
153
- (child) => !child.classList.contains('no-fade-in')
154
- );
155
- gsap.from(children, {
156
- scrollTrigger: {
157
- trigger: element,
158
- start: 'top 80%',
159
- end: 'top 60%',
160
- scrub: 1, // 平滑跟随滚动
161
- toggleActions: 'play none none reverse',
162
- },
163
- opacity: 1,
164
- y: 100,
165
- duration: 0.4,
166
- stagger: 0.1,
167
- ease: 'power1.out',
147
+ // 跟随滚动缓慢显示
148
+ const slowReveal = document.querySelectorAll('.slow-reveal');
149
+ slowReveal.forEach((element) => {
150
+ // 过滤出不包含 no-fade-in 类名的子元素
151
+ const children = Array.from(element.children).filter(
152
+ (child) => !child.classList.contains('no-fade-in')
153
+ );
154
+ gsap.from(children, {
155
+ scrollTrigger: {
156
+ trigger: element,
157
+ start: 'top 80%',
158
+ end: 'top 60%',
159
+ scrub: 1, // 平滑跟随滚动
160
+ toggleActions: 'play none none reverse',
161
+ },
162
+ opacity: 1,
163
+ y: 100,
164
+ duration: 0.4,
165
+ stagger: 0.1,
166
+ ease: 'power1.out',
167
+ });
168
168
  });
169
169
  });
@@ -19,8 +19,8 @@
19
19
  #shopify-block-{{ block.id }} .zz-bottom-popup__overlay {
20
20
  position: fixed;
21
21
  inset: 0;
22
- z-index: 39;
23
- background: rgba(0, 0, 0, 0.5);
22
+ z-index: 888;
23
+ background: rgba(0, 0, 0, 0.6);
24
24
  opacity: 0;
25
25
  pointer-events: none;
26
26
  transition: opacity 0.35s ease;
@@ -30,18 +30,23 @@
30
30
  opacity: 1;
31
31
  pointer-events: auto;
32
32
  }
33
+ @media screen and (max-width: 1023px) {
34
+ #shopify-block-{{ block.id }} .zz-bottom-popup__content {
35
+ height: {{ block.settings.mobile_height }}vh;
36
+ max-height: {{ block.settings.mobile_height }}vh;
37
+ padding: {{ block.settings.mobile_padding_top }}px {{ block.settings.mobile_padding_x }}px 0;
38
+
39
+ }
40
+ }
33
41
 
34
42
  #shopify-block-{{ block.id }} .zz-bottom-popup__content {
35
43
  position: fixed;
36
44
  left: 0;
37
45
  bottom: 0;
38
- z-index: 40;
46
+ z-index: 889;
39
47
  display: flex;
40
48
  flex-direction: column;
41
49
  width: 100vw;
42
- height: {{ block.settings.mobile_height }}vh;
43
- max-height: {{ block.settings.mobile_height }}vh;
44
- padding: {{ block.settings.mobile_padding_top }}px {{ block.settings.mobile_padding_x }}px 0;
45
50
  border-radius: 20px 20px 0 0;
46
51
  background: {{ block.settings.background_color }};
47
52
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
@@ -64,12 +69,18 @@
64
69
  right: 16px;
65
70
  z-index: 101;
66
71
  display: inline-flex;
72
+ align-items: center;
73
+ justify-content: center;
67
74
  width: 32px;
68
75
  height: 32px;
69
76
  padding: 0;
70
77
  border: 0;
71
- background: transparent;
78
+ border-radius: 999px;
79
+ background: rgba(255, 255, 255, 0.12);
80
+ backdrop-filter: blur(10px);
81
+ -webkit-backdrop-filter: blur(10px);
72
82
  cursor: pointer;
83
+ overflow: hidden;
73
84
  }
74
85
 
75
86
  #shopify-block-{{ block.id }} .zz-bottom-popup__body {
@@ -79,17 +90,8 @@
79
90
  flex: 1 1 auto;
80
91
  padding-bottom: 34px;
81
92
  overflow-y: auto;
82
- scrollbar-width: thin;
83
- scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
84
- }
85
-
86
- #shopify-block-{{ block.id }} .zz-bottom-popup__body::-webkit-scrollbar {
87
- width: 6px;
88
- }
89
-
90
- #shopify-block-{{ block.id }} .zz-bottom-popup__body::-webkit-scrollbar-thumb {
91
- border-radius: 999px;
92
- background: rgba(255, 255, 255, 0.18);
93
+ {% comment %} scrollbar-width: thin;
94
+ scrollbar-color: rgba(255, 255, 255, 0.18) transparent; {% endcomment %}
93
95
  }
94
96
 
95
97
  #shopify-block-{{ block.id }} .zz-bottom-popup__inner {
@@ -111,11 +113,10 @@
111
113
  #shopify-block-{{ block.id }} .zz-bottom-popup__close {
112
114
  top: auto;
113
115
  right: auto;
114
- left: 50%;
115
- bottom: 30px;
116
+ right: 30px;
117
+ top: 30px;
116
118
  width: 40px;
117
119
  height: 40px;
118
- transform: translateX(-50%);
119
120
  }
120
121
 
121
122
  #shopify-block-{{ block.id }} .zz-bottom-popup__body {
@@ -144,7 +145,7 @@
144
145
 
145
146
  <div class="zz-bottom-popup" {{ block.shopify_attributes }}>
146
147
  <zz-normal-modal id="{{ modal_id }}" class="zz-bottom-popup__modal" aria-hidden="true">
147
- <div class="zz-bottom-popup__overlay" data-modal-overlay></div>
148
+ <div class="zz-bottom-popup__overlay" data-modal-overlay>&nbsp;</div>
148
149
  <div
149
150
  class="zz-bottom-popup__content"
150
151
  data-modal-content
@@ -169,7 +170,7 @@
169
170
  </svg>
170
171
  </button>
171
172
 
172
- <div class="zz-bottom-popup__body">
173
+ <div class="zz-bottom-popup__body zz-overflow-scrollbar-hidden">
173
174
  <div class="zz-bottom-popup__inner" id="{{ modal_id }}-title">
174
175
  {% content_for 'blocks' %}
175
176
  </div>
@@ -179,7 +180,7 @@
179
180
  </div>
180
181
 
181
182
  <script>
182
- (function() {
183
+ document.addEventListener('DOMContentLoaded', function() {
183
184
  var blockRoot = document.getElementById('shopify-block-{{ block.id }}');
184
185
 
185
186
  if (!blockRoot || blockRoot.dataset.bottomPopupBound === 'true') {
@@ -193,7 +194,7 @@
193
194
  var overlay = blockRoot.querySelector('[data-modal-overlay]');
194
195
  var modalTarget = '#{{ modal_id }}';
195
196
  var triggers = document.querySelectorAll('[data-zz-modal-target="' + modalTarget + '"]');
196
-
197
+ console.log('triggers----------triggers',triggers);
197
198
  if (!modal) {
198
199
  return;
199
200
  }
@@ -228,7 +229,8 @@
228
229
  });
229
230
  }
230
231
  });
231
- })();
232
+
233
+ });
232
234
  </script>
233
235
 
234
236
  {% schema %}
@@ -195,6 +195,11 @@
195
195
  "id": "modal_id",
196
196
  "label": "按钮触发modal的id",
197
197
  },
198
+ {
199
+ "type": "text",
200
+ "id": "custom_class",
201
+ "label": "自定义类名",
202
+ },
198
203
  {
199
204
  "type": "text",
200
205
  "id": "click_event_class_name",
@@ -216,6 +221,10 @@
216
221
 
217
222
  {% assign btn_class = 'zz-button' | append: block.id %}
218
223
 
224
+ {% if block.settings.custom_class != blank %}
225
+ {% assign btn_class = btn_class | append: ' ' | append: block.settings.custom_class %}
226
+ {% endif %}
227
+
219
228
  <style>
220
229
 
221
230
  {% if block.settings.mobile_width == 'full' %}
@@ -299,9 +299,26 @@
299
299
  "default": false,
300
300
  "info": "勾选后会对Block模块进行曝光统计埋点, 必须填写唯一业务id"
301
301
  },
302
-
303
-
304
-
302
+ {
303
+ "type": "select",
304
+ "id": "visibility_rule",
305
+ "label": "国家显示规则",
306
+ "options": [
307
+ { "value": "all", "label": "All" },
308
+ { "value": "market_only", "label": "Market Only" },
309
+ { "value": "market_exclude", "label": "Market Exclude" },
310
+ { "value": "country_only", "label": "Country Only" },
311
+ { "value": "country_exclude", "label": "Country Exclude" }
312
+ ],
313
+ "default": "all",
314
+ "info": "Market Only仅显示在xx国家或市场/Market Exclude排除xx国家或市场显示"
315
+ },
316
+ {
317
+ "type": "text",
318
+ "id": "visibility_countries",
319
+ "label": "国家/Market 列表",
320
+ "info": "支持国家ISO码与国家选择器中国家配置"
321
+ }
305
322
  ],
306
323
  "blocks": [
307
324
  {
@@ -683,17 +700,50 @@
683
700
  }
684
701
  }
685
702
  </style>
703
+ {% liquid
704
+ assign current_iso_code = localization.country.iso_code
705
+ assign visible = true
706
+
707
+ if block.settings.visibility_rule == 'market_only'
708
+ unless block.settings.visibility_countries contains current_iso_code
709
+ assign visible = false
710
+ endunless
711
+ elsif block.settings.visibility_rule == 'market_exclude'
712
+ if block.settings.visibility_countries contains current_iso_code
713
+ assign visible = false
714
+ endif
715
+ endif
686
716
 
717
+ if block.settings.visibility_rule == 'country_exclude'
718
+ if block.settings.visibility_countries contains 'EU'
719
+ assign eu_countries = "FR,ES,IT,DE"
720
+ assign eu_countries_array = eu_countries | split: ","
721
+ if eu_countries_array contains current_iso_code
722
+ assign visible = false
723
+ endif
724
+ endif
725
+ endif
726
+ %}
727
+ {% if visible %}
687
728
  <div
688
729
  {% if block.settings.module_name != blank %}
689
730
  data-zz-module-name="{{ block.settings.module_name }}"
690
731
  {% endif %}
691
732
  {% if block.settings.module_id != blank %}
692
- data-track-zz-block="{{ block.settings.module_id }}"
693
- {% endif %}
694
- {% if block.settings.is_exposure != false %}
695
- data-track-zz-exposure="true"
696
- {% endif %}
733
+ id="{{ block.settings.module_id }}"
734
+ data-track-zz-block="{{ block.settings.module_id }}"
735
+ {% endif %}
736
+
737
+ {% if block.settings.is_exposure != false %}
738
+ data-track-zz-exposure="true"
739
+ {% endif %}
740
+ {% if block.settings.visibility_rule == 'country_only' or block.settings.visibility_rule == 'country_exclude' %}
741
+ data-visibility-rule="{{ block.settings.visibility_rule }}"
742
+ {% endif %}
743
+ {% if block.settings.visibility_countries != blank %}
744
+ data-visibility-countries="{{ block.settings.visibility_countries | escape }}"
745
+ {% endif %}
697
746
  class="flex-layout-block-container {{ block.settings.self_animation }} {{ block.settings.child_animation }} {{ block.settings.custom_class }} flex-layout-block-container-{{ block.id }}">
698
747
  {% content_for 'blocks' %}
699
748
  </div>
749
+ {% endif %}
@@ -0,0 +1,120 @@
1
+ <div class='media-box tw-relative tw-rounded-[10px] lg:tw-rounded-[16px] '>
2
+ {% if block.settings.video_pc != blank %}
3
+ {% if block.settings.video_url_pc != blank %}
4
+ {% assign pc_video = block.settings.video_url_pc %}
5
+ {% else %}
6
+ {% assign pc_video = block.settings.video_pc %}
7
+ {% endif %}
8
+ {% render 'zz-video',
9
+ pc_video: pc_video,
10
+ pc_poster: block.settings.poster_pc,
11
+ mb_video: block.settings.video_mb,
12
+ mb_poster: block.settings.poster_mb,
13
+ lazy: true,
14
+ class: 'image-video-box tw-w-full tw-h-auto tw-rounded-[10px] lg:tw-rounded-[16px]',
15
+ autoplay: true,
16
+ loop: true,
17
+ muted: true,
18
+ module_id: block.settings.block_module_id
19
+ %}
20
+ {% else %}
21
+ {%
22
+ render 'zz-img',
23
+ pc_image: block.settings.poster_pc,
24
+ mb_image: block.settings.poster_mb,
25
+ image_alt: block.settings.heading | escape,
26
+ class_name: 'image-video-box tw-rounded-[10px] lg:tw-rounded-[16px]',
27
+ %}
28
+ {% endif %}
29
+ </div>
30
+
31
+
32
+ <div class='active-box-content max-lg:tw-mt-[2rem] lg:tw-mt-[32px]'>
33
+ {% render 'zz-h5',
34
+ title: block.settings.heading,
35
+ title_color: block.settings.title_color,
36
+ class_name: 'box-title tw-text-center lg:tw-text-left tw-text-[16px] lg:tw-text-[24px]'
37
+ %}
38
+ <div class='active-box-desc tw-mt-[8px] lg:tw-mt-[20px]'>
39
+ {% render 'zz-content-text',
40
+ text: block.settings.row_content,
41
+ mb_text: block.settings.row_content,
42
+ pc_font_size: 16,
43
+ mobile_font_size: 12,
44
+ text_color: block.settings.content_color,
45
+ class_name: 'box-content-text max-lg:tw-text-center lg:tw-text-left tw-text-[12px] lg:tw-text-[16px]',
46
+ %}
47
+ </div>
48
+ </div>
49
+
50
+
51
+ {% schema %}
52
+ {
53
+ "name": "Img Video Text",
54
+ "class": "zz-img-video-text",
55
+ "settings": [
56
+ {
57
+ "type": "text",
58
+ "id": "video_url_pc",
59
+ "label": "Video url PC",
60
+ "info": "使用cdn视频时,填写视频url。防止大屏幕视频模糊"
61
+ },
62
+ {
63
+ "type": "video",
64
+ "id": "video_pc",
65
+ "label": "Video"
66
+ },
67
+ {
68
+ "type": "image_picker",
69
+ "id": "poster_pc",
70
+ "label": "Poster"
71
+ },
72
+ {
73
+ "type": "video",
74
+ "id": "video_mb",
75
+ "label": "Video(Mobile)"
76
+ },
77
+ {
78
+ "type": "image_picker",
79
+ "id": "poster_mb",
80
+ "label": "Poster(Mobile)"
81
+ },
82
+ {
83
+ "type": "text",
84
+ "id": "heading",
85
+ "label": "标题"
86
+ },
87
+ {
88
+ "type": "color",
89
+ "id": "title_color",
90
+ "default": "#2D2D2D",
91
+ "label": "标题颜色"
92
+ },
93
+ {
94
+ "type": "richtext",
95
+ "id": "row_content",
96
+ "label": "description"
97
+ },
98
+ {
99
+ "type": "color",
100
+ "id": "content_color",
101
+ "default": "#B2B2B2",
102
+ "label": "内容颜色"
103
+ },
104
+ {
105
+ "type": "text",
106
+ "id": "block_module_id",
107
+ "label": "唯一业务id",
108
+ "info": "需要唯一,埋点统计"
109
+ },
110
+
111
+ ],
112
+ "presets": [
113
+ {
114
+ "name": "Img Video Text",
115
+ }
116
+ ]
117
+ }
118
+ {% endschema %}
119
+
120
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zz-shopify-components",
3
- "version": "0.35.1-beta.8",
3
+ "version": "0.36.0",
4
4
  "description": "Reusable Shopify components for theme projects",
5
5
  "keywords": [
6
6
  "shopify",
@@ -197,6 +197,26 @@
197
197
  "label": "模块名称",
198
198
  "info": "用于定位到本模块,可多个section使用同一名称"
199
199
  },
200
+ {
201
+ "type": "select",
202
+ "id": "visibility_rule",
203
+ "label": "国家显示规则",
204
+ "options": [
205
+ { "value": "all", "label": "All" },
206
+ { "value": "market_only", "label": "Market Only" },
207
+ { "value": "market_exclude", "label": "Market Exclude" },
208
+ { "value": "country_only", "label": "Country Only" },
209
+ { "value": "country_exclude", "label": "Country Exclude" }
210
+ ],
211
+ "default": "all",
212
+ "info": "Market Only仅显示在xx国家或市场/Market Exclude排除xx国家或市场显示"
213
+ },
214
+ {
215
+ "type": "text",
216
+ "id": "visibility_countries",
217
+ "label": "国家/Market 列表",
218
+ "info": "支持国家ISO码与国家选择器中国家配置"
219
+ }
200
220
  ],
201
221
  "blocks": [
202
222
  {
@@ -274,12 +294,43 @@
274
294
  }
275
295
  }
276
296
  </style>
297
+ {% liquid
298
+ assign current_iso_code = localization.country.iso_code
299
+ assign visible = true
300
+
301
+ if section.settings.visibility_rule == 'market_only'
302
+ unless section.settings.visibility_countries contains current_iso_code
303
+ assign visible = false
304
+ endunless
305
+ elsif section.settings.visibility_rule == 'market_exclude'
306
+ if section.settings.visibility_countries contains current_iso_code
307
+ assign visible = false
308
+ endif
309
+ endif
310
+
277
311
 
312
+ if section.settings.visibility_rule == 'country_exclude'
313
+ if section.settings.visibility_countries contains 'EU'
314
+ assign eu_countries = "FR,ES,IT,DE"
315
+ assign eu_countries_array = eu_countries | split: ","
316
+ if eu_countries_array contains current_iso_code
317
+ assign visible = false
318
+ endif
319
+ endif
320
+ endif
321
+ %}
322
+ {% if visible %}
278
323
  <div
279
324
  {% if section.settings.module_id != blank %}
280
325
  id="{{ section.settings.module_id }}"
281
326
  data-track-zz-section="{{ section.settings.module_id }}"
282
327
  {% endif %}
328
+ {% if section.settings.visibility_rule == 'country_only' or section.settings.visibility_rule == 'country_exclude' %}
329
+ data-visibility-rule="{{ section.settings.visibility_rule }}"
330
+ {% endif %}
331
+ {% if section.settings.visibility_countries != blank %}
332
+ data-visibility-countries="{{ section.settings.visibility_countries | escape }}"
333
+ {% endif %}
283
334
  {% if section.settings.is_exposure != false%}
284
335
  data-track-zz-exposure="true"
285
336
  {% endif %}
@@ -287,3 +338,4 @@
287
338
  {% if section.settings.module_name != blank %}data-zz-module-name="{{ section.settings.module_name }}"{% endif %}>
288
339
  {% content_for 'blocks' %}
289
340
  </div>
341
+ {% endif %}
@@ -132,7 +132,7 @@
132
132
  height: calc(90vw / 16 * 9);
133
133
  }
134
134
  #shopify-section-{{ section.id }} .zz-banner-tab-swiper .swiper-pagination-bullets {
135
- bottom: 135px;
135
+ bottom: 110px;
136
136
  left: 50%;
137
137
  transform: translateX(-50%);
138
138
  width: auto;
@@ -207,7 +207,7 @@
207
207
  title: block.settings.pc_title,
208
208
  title_mb: block.settings.mb_title,
209
209
  title_color: block.settings.text_color,
210
- class_name: 'tab-content-title tw-text-center'
210
+ class_name: 'tab-content-title tw-text-center max-lg:tw-text-[2.1rem] max-lg:tw-text-left'
211
211
  %}
212
212
  <style>
213
213
  #shopify-section-{{section.id}} .tab-content-title {
@@ -228,7 +228,7 @@
228
228
  text: block.settings.pc_text,
229
229
  mb_text: block.settings.mb_text,
230
230
  text_color: block.settings.text_color,
231
- class_name: 'tab-content-text tw-text-center'
231
+ class_name: 'tab-content-text tw-text-center max-lg:tw-text-left'
232
232
  %}
233
233
  <style>
234
234
  #shopify-section-{{section.id}} .tab-content-text {