zz-shopify-components 0.16.3-beta.1 → 0.16.3-beta.10

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.
@@ -1,3 +1,10 @@
1
+ html.zz-global-noscroll,
2
+ html.zz-global-noscroll body {
3
+ overflow: hidden !important;
4
+ position: relative;
5
+ height: 100% !important;
6
+ }
7
+
1
8
  /* tab radio组件 */
2
9
  .zz-radio-tabs {
3
10
  display: flex;
@@ -6,9 +13,11 @@
6
13
  border-radius: 32px;
7
14
  background: #F5F5F6;
8
15
  }
16
+
9
17
  body {
10
18
  overflow-x: hidden;
11
19
  }
20
+
12
21
  .zz-radio-tabs-black.zz-radio-tabs {
13
22
  background: #FFFFFF14;
14
23
  }
@@ -48,7 +57,7 @@ zz-radio-tabs-item {
48
57
  vertical-align: middle;
49
58
  height: 100%;
50
59
  white-space: nowrap;
51
-
60
+
52
61
  }
53
62
 
54
63
  .zz-radio-tabs-black.zz-radio-tabs .zz-radio-tabs-label {
@@ -64,12 +73,14 @@ zz-radio-tabs-item {
64
73
  background: #FFFFFF1F;
65
74
  color: #FFFFFF;
66
75
  }
76
+
67
77
  @media (min-width: 1024px) {
68
78
  .zz-radio-tabs {
69
- height: 48px;
79
+ height: 48px;
70
80
  }
81
+
71
82
  .zz-radio-tabs-label {
72
- font-size: 16px;
83
+ font-size: 16px;
73
84
  }
74
85
  }
75
86
 
@@ -102,29 +113,35 @@ zz-radio-tabs-item {
102
113
  background-size: 4px 4px, 4px 4px;
103
114
  background-repeat: no-repeat;
104
115
  }
116
+
105
117
  .zz-select:focus {
106
118
  border-color: #FC6C0F;
107
119
  outline: none;
108
120
  box-shadow: none;
109
121
  }
122
+
110
123
  @media (min-width: 1024px) {
111
124
  .zz-select {
112
- height: 40px;
113
- font-size: 14px;
125
+ height: 40px;
126
+ font-size: 14px;
114
127
  }
115
128
  }
129
+
116
130
  /* 内容描述 */
117
131
  .content-text strong {
118
132
  color: #000000;
119
133
  font-weight: inherit;
120
134
  }
135
+
121
136
  .content-text a {
122
137
  color: #378DDD;
123
138
  text-decoration: underline;
124
139
  }
140
+
125
141
  .content-text a:hover {
126
142
  opacity: 0.8;
127
143
  }
144
+
128
145
  .content-text ol {
129
146
  list-style: decimal;
130
147
  padding-left: 25px;
@@ -136,7 +153,7 @@ zz-radio-tabs-item {
136
153
  }
137
154
 
138
155
  /* 标题 */
139
- .zz-title-hx p{
156
+ .zz-title-hx p {
140
157
  margin: 0;
141
158
  }
142
159
 
@@ -153,11 +170,13 @@ zz-radio-tabs-item {
153
170
  border-radius: 4px;
154
171
  z-index: -1;
155
172
  }
173
+
156
174
  /* dialog 弹窗组件, PC中间弹出,移动端底部弹出 */
157
175
  body.zz-dialog-open {
158
176
  overflow: hidden;
159
177
  touch-action: none;
160
178
  }
179
+
161
180
  .zz-dialog-mask {
162
181
  position: fixed;
163
182
  inset: 0;
@@ -165,6 +184,7 @@ body.zz-dialog-open {
165
184
  display: none;
166
185
  z-index: 1000;
167
186
  }
187
+
168
188
  .zz-dialog {
169
189
  position: fixed;
170
190
  background: #fff;
@@ -174,38 +194,42 @@ body.zz-dialog-open {
174
194
  display: none;
175
195
  transition: all 0.3s ease;
176
196
  }
197
+
177
198
  @media (min-width: 1024px) {
178
199
  .zz-dialog {
179
- top: 50%;
180
- left: 50%;
181
- transform: translate(-50%, -50%) scale(0.7);
182
- opacity: 0;
200
+ top: 50%;
201
+ left: 50%;
202
+ transform: translate(-50%, -50%) scale(0.7);
203
+ opacity: 0;
183
204
 
184
205
  }
185
206
 
186
207
  .zz-dialog.show {
187
- transform: translate(-50%, -50%) scale(1);
188
- opacity: 1;
208
+ transform: translate(-50%, -50%) scale(1);
209
+ opacity: 1;
189
210
  }
190
211
  }
212
+
191
213
  @media (max-width: 1023px) {
192
214
  .zz-dialog {
193
- bottom: 0;
194
- left: 0;
195
- width: 100%;
196
- border-bottom-left-radius: 0;
197
- border-bottom-right-radius: 0;
198
- transform: translateY(100%);
215
+ bottom: 0;
216
+ left: 0;
217
+ width: 100%;
218
+ border-bottom-left-radius: 0;
219
+ border-bottom-right-radius: 0;
220
+ transform: translateY(100%);
199
221
  }
200
222
 
201
223
  .zz-dialog.show {
202
- transform: translateY(0);
224
+ transform: translateY(0);
203
225
  }
204
226
  }
227
+
205
228
  .zz-underline {
206
229
  text-decoration: none;
207
230
  border-bottom: 1px solid currentColor;
208
- padding-bottom: 2px; /* 调整位置 */
231
+ padding-bottom: 2px;
232
+ /* 调整位置 */
209
233
  }
210
234
 
211
235
  /* 按钮样式 zz-btn */
@@ -216,7 +240,7 @@ body.zz-dialog-open {
216
240
  height: 40px;
217
241
  padding: 0px 24px;
218
242
  border-radius: 4px;
219
- transition: opacity 0.2s cubic-bezier(.4,0,.2,1);
243
+ transition: opacity 0.2s cubic-bezier(.4, 0, .2, 1);
220
244
  outline: none;
221
245
  gap: 7px;
222
246
  font-weight: 500;
@@ -229,70 +253,84 @@ body.zz-dialog-open {
229
253
  background: #000000;
230
254
  color: #fff;
231
255
  }
256
+
232
257
  .zz-btn.zz-btn-primary.zz-btn-white {
233
258
  background: #fff;
234
259
  color: #000000;
235
260
  border: 1.5px solid #fff;
236
261
  }
262
+
237
263
  .zz-btn.zz-btn-primary.zz-btn-orange {
238
264
  background: #FC6C0F;
239
265
  color: #fff;
240
266
  }
267
+
241
268
  .zz-btn.zz-btn-primary.zz-btn-blue {
242
269
  background: #378DDD;
243
270
  color: #fff;
244
271
  }
272
+
245
273
  .zz-btn.zz-btn-primary.zz-btn-yellow {
246
274
  background: linear-gradient(139.02deg, #FFEB00 0.01%, #FFD400 100.55%);
247
275
  color: #000000;
248
276
  }
277
+
249
278
  .zz-btn.zz-btn-primary-round.zz-btn-black {
250
279
  background: #000000;
251
280
  color: #fff;
252
281
  border-radius: 30px;
253
282
  }
283
+
254
284
  .zz-btn.zz-btn-primary-round.zz-btn-white {
255
285
  background: #fff;
256
286
  color: #000000;
257
287
  border-radius: 30px;
258
288
  }
289
+
259
290
  .zz-btn.zz-btn-default.zz-btn-black {
260
291
  background: transparent;
261
292
  color: #000000;
262
293
  border: 1.5px solid #000000;
263
294
  }
295
+
264
296
  .zz-btn.zz-btn-default.zz-btn-white {
265
297
  background: transparent;
266
298
  color: #fff;
267
299
  border: 1.5px solid #fff;
268
300
  }
301
+
269
302
  .zz-btn.zz-btn-default.zz-btn-orange {
270
303
  background: transparent;
271
304
  color: #FC6C0F;
272
305
  border: 1.5px solid #FC6C0F;
273
306
  }
307
+
274
308
  .zz-btn.zz-btn-default.zz-btn-yellow {
275
309
  background: transparent;
276
310
  color: #000;
277
311
  border: 1.5px solid #FFEB00;
278
312
  }
313
+
279
314
  .zz-btn.zz-btn-default.zz-btn-blue {
280
315
  background: transparent;
281
316
  color: #378DDD;
282
317
  border: 1.5px solid #378DDD;
283
318
  }
319
+
284
320
  .zz-btn.zz-btn-round.zz-btn-black {
285
321
  background: transparent;
286
322
  color: #000000;
287
323
  border: 1.5px solid #000000;
288
324
  border-radius: 30px;
289
325
  }
326
+
290
327
  .zz-btn.zz-btn-round.zz-btn-white {
291
328
  background: transparent;
292
329
  color: #fff;
293
330
  border: 1.5px solid #fff;
294
331
  border-radius: 30px;
295
332
  }
333
+
296
334
  .zz-btn.zz-btn-round.zz-btn-orange {
297
335
  background: transparent;
298
336
  color: #ff9900;
@@ -303,12 +341,15 @@ body.zz-dialog-open {
303
341
  .zz-btn-link.zz-btn-blue {
304
342
  color: #378DDD;
305
343
  }
344
+
306
345
  .zz-btn-link.zz-btn-orange {
307
346
  color: #FC6C0F;
308
347
  }
348
+
309
349
  .zz-btn-link.zz-btn-white {
310
350
  color: #fff;
311
351
  }
352
+
312
353
  .zz-btn-link.zz-btn-black {
313
354
  color: #000000;
314
355
  }
@@ -325,56 +366,67 @@ body.zz-dialog-open {
325
366
  opacity: 0.5;
326
367
  cursor: not-allowed;
327
368
  }
369
+
328
370
  .zz-btn.zz-btn-large {
329
371
  height: 42px;
330
372
  padding: 0px 28px;
331
373
  }
374
+
332
375
  .zz-btn.zz-btn-small {
333
376
  height: 21px;
334
377
  padding: 0px 10px;
335
378
  font-size: 10px;
336
379
  }
380
+
337
381
  .zz-btn-link.zz-btn-link-small {
338
382
  font-size: 10px;
339
383
  }
384
+
340
385
  .zz-btn-link.zz-btn-link-large {
341
386
  font-size: 14px;
342
387
  }
343
388
 
344
389
  @media (min-width: 1024px) {
345
- .zz-btn.zz-btn-large {
346
- height: 48px;
347
- padding: 0px 32px;
348
- }
349
- .zz-btn.zz-btn-small {
350
- height: 26px;
351
- padding: 0px 10px;
352
- font-size: 14px;
353
- }
354
- .zz-btn-link.zz-btn-link-small {
355
- font-size: 12px;
356
- }
357
- .zz-btn-link.zz-btn-link-large {
358
- font-size: 16px;
359
- }
390
+ .zz-btn.zz-btn-large {
391
+ height: 48px;
392
+ padding: 0px 32px;
393
+ }
394
+
395
+ .zz-btn.zz-btn-small {
396
+ height: 26px;
397
+ padding: 0px 10px;
398
+ font-size: 14px;
399
+ }
400
+
401
+ .zz-btn-link.zz-btn-link-small {
402
+ font-size: 12px;
403
+ }
404
+
405
+ .zz-btn-link.zz-btn-link-large {
406
+ font-size: 16px;
407
+ }
360
408
  }
361
409
 
362
410
  .zz-btn-shape-round {
363
411
  border-radius: 90px;
364
412
  }
413
+
365
414
  .zz-video {
366
- border-radius: inherit;
415
+ border-radius: inherit;
367
416
  }
368
417
 
369
- .zz-toast-layer{
418
+ .zz-toast-layer {
370
419
  position: fixed;
371
420
  inset: 0;
372
421
  display: grid;
373
422
  place-items: center;
374
- pointer-events: none; /* 不阻挡点击 */
375
- z-index: 9999; /* 最高层 */
423
+ pointer-events: none;
424
+ /* 不阻挡点击 */
425
+ z-index: 9999;
426
+ /* 最高层 */
376
427
  }
377
- .zz-toast-box{
428
+
429
+ .zz-toast-box {
378
430
  pointer-events: auto;
379
431
  max-width: min(86vw, 520px);
380
432
  box-sizing: border-box;
@@ -393,17 +445,20 @@ body.zz-dialog-open {
393
445
  display: inline-flex;
394
446
 
395
447
  }
448
+
396
449
  .zz-toast-icon {
397
450
  margin-right: 4px;
398
451
  padding: 0px 2px;
399
452
  }
453
+
400
454
  @media screen and (min-width: 1024px) {
401
- .zz-toast-msg{
455
+ .zz-toast-msg {
402
456
  font-size: 16px;
403
457
  }
404
-
458
+
405
459
  }
406
- .zz-toast-box.show{
460
+
461
+ .zz-toast-box.show {
407
462
  opacity: 1;
408
463
  transform: translateZ(0) scale(1);
409
- }
464
+ }
@@ -374,3 +374,48 @@ if (!customElements.get('zz-video-popup')) {
374
374
  // 暴露到全局
375
375
  window.zzShowToast = zzShowToast;
376
376
  })();
377
+
378
+ (function () {
379
+ let scrollTop = 0;
380
+
381
+ function isSafari() {
382
+ const ua = navigator.userAgent;
383
+ // 包含 Safari / WebKit,且不包含 Chrome / CriOS / FxiOS / Android
384
+ return /Safari/.test(ua)
385
+ && /AppleWebKit/.test(ua)
386
+ && !/CriOS|FxiOS|Chrome|Edg|OPR/.test(ua);
387
+ }
388
+
389
+ function isSafari26() {
390
+ const ua = navigator.userAgent;
391
+ if (!isSafari()) return false;
392
+ // 检查 “Version/26.0” 或类似标识
393
+ return /Version\/26\./.test(ua);
394
+ }
395
+
396
+
397
+
398
+ function lockBodyScroll() {
399
+ if (isSafari26()) {
400
+ scrollTop = window.scrollY;
401
+ document.documentElement.classList.add('zz-global-noscroll');
402
+ } else {
403
+ document.body.style.overflow = 'hidden';
404
+ }
405
+ }
406
+
407
+ function unlockBodyScroll() {
408
+ if (isSafari26()) {
409
+ document.documentElement.classList.remove('zz-global-noscroll');
410
+ document.documentElement.style.scrollBehavior = 'auto';
411
+ window.scrollTo(0, scrollTop);
412
+ requestAnimationFrame(() => {
413
+ document.documentElement.style.scrollBehavior = '';
414
+ });
415
+ } else {
416
+ document.body.style.overflow = '';
417
+ }
418
+ }
419
+ window.zzLockBodyScroll = lockBodyScroll;
420
+ window.zzUnlockBodyScroll = unlockBodyScroll;
421
+ })();
@@ -16,6 +16,7 @@ class VersionDialog extends HTMLElement {
16
16
  if (!this.swiper) {
17
17
  this.initSwiper();
18
18
  }
19
+ window.zzLockBodyScroll && window.zzLockBodyScroll();
19
20
  } else {
20
21
  // 销毁swiper
21
22
  if (this.swiper) {
@@ -33,6 +34,7 @@ class VersionDialog extends HTMLElement {
33
34
  if (this.swiper) {
34
35
  this.destroySwiper();
35
36
  }
37
+ window.zzUnlockBodyScroll && window.zzUnlockBodyScroll();
36
38
  });
37
39
 
38
40
  // 添加点击backdrop关闭的事件监听
@@ -3,19 +3,26 @@ class WorldVideoCommentsDialog extends HTMLElement {
3
3
  swiper = null; // swiper实例
4
4
  mediaId = '';
5
5
  page = 1;
6
-
7
6
  pageSize = 15;
8
7
  hasMore = true;
9
8
 
10
9
  constructor() {
11
10
  super();
12
- this.init();
11
+
13
12
  }
14
13
  connectedCallback() {
14
+ this.shopSelect = this.dataset.shopSelect;
15
15
  this.baseUrl =
16
16
  this.dataset.requestType === 'prod'
17
17
  ? 'https://h130-app-server-us.hoverx1.cn'
18
18
  : 'https://h130-app-server-test-us.hoverx1.cn';
19
+ if (this.shopSelect === 'JP') {
20
+ this.baseUrl =
21
+ this.dataset.requestType === 'prod'
22
+ ? 'https://h130-app-server-jp.hoverx1.cn'
23
+ : 'https://h130-app-server-test-jp.hoverx1.cn';
24
+ }
25
+ this.init();
19
26
  }
20
27
 
21
28
  init() {
@@ -23,6 +23,8 @@ class WorldVideoDialog extends HTMLElement {
23
23
  initData() {
24
24
  this.x1Img = this.dataset.x1Img;
25
25
  this.x1ProImg = this.dataset.x1proImg;
26
+ this.x121Img = this.dataset.x121Img;
27
+ this.x121Links = this.dataset.x121Links;
26
28
  this.x1Links = this.dataset.x1Links;
27
29
  this.x1ProLinks = this.dataset.x1proLinks;
28
30
  }
@@ -88,6 +90,7 @@ class WorldVideoDialog extends HTMLElement {
88
90
  });
89
91
  }
90
92
  updateSlide(data, productType, isInit = false) {
93
+ console.log('updateSlide', data, productType, this.x121Links, this.x121Img);
91
94
  const template = $('#video-swiper-slide').html();
92
95
  if (isInit) {
93
96
  this.destroySwiper();
@@ -119,6 +122,11 @@ class WorldVideoDialog extends HTMLElement {
119
122
  .replace(new RegExp('{product-links}', 'g'), this.x1ProLinks)
120
123
  .replace(new RegExp('{product-icon}', 'g'), this.x1ProImg)
121
124
  .replace(new RegExp('{product-type}', 'g'), '141');
125
+ } else if (productType === 3) {
126
+ replacedTemplate = replacedTemplate
127
+ .replace(new RegExp('{product-links}', 'g'), this.x121Links)
128
+ .replace(new RegExp('{product-icon}', 'g'), this.x121Img)
129
+ .replace(new RegExp('{product-type}', 'g'), '121');
122
130
  }
123
131
  this.swiper.virtual.slides.push(replacedTemplate);
124
132
  });
@@ -152,6 +160,7 @@ class WorldVideoDialog extends HTMLElement {
152
160
  modal.classList.add('show');
153
161
  }, 10);
154
162
  body.classList.add('modal-open');
163
+ window.zzLockBodyScroll && window.zzLockBodyScroll();
155
164
  // 滑到固定位置
156
165
  if (this.isInitOpen) {
157
166
  // 是否是初始化后第一次打开
@@ -161,15 +170,15 @@ class WorldVideoDialog extends HTMLElement {
161
170
  }
162
171
  this.isInitOpen = false;
163
172
  this.playVideo();
164
- dataLayer.push({
165
- event: 'world_video_dialog_open',
166
- timestamp: new Date().toISOString(),
173
+ window.zzAnalytics && window.zzAnalytics.trackEvent('world_video_dialog_open', {
174
+ timestamp: new Date().toISOString(),
167
175
  });
168
176
  }
169
177
  closeModal() {
170
178
  const modal = this.querySelector('#world-video-modal');
171
179
  const mask = this.querySelector('#world-video-modalMask');
172
180
  const body = document.body;
181
+ window.zzUnlockBodyScroll && window.zzUnlockBodyScroll();
173
182
  modal.classList.remove('show');
174
183
  setTimeout(() => {
175
184
  modal.style.display = 'none';
@@ -8,14 +8,21 @@ class WorldVideoList extends HTMLElement {
8
8
  pageSize = 8;
9
9
  constructor() {
10
10
  super();
11
- this.init();
11
+
12
12
  }
13
13
  connectedCallback() {
14
+ this.shopSelect = this.dataset.shopSelect;
14
15
  this.baseUrl =
15
16
  this.dataset.requestType === 'prod'
16
17
  ? 'https://h130-app-server-us.hoverx1.cn'
17
18
  : 'https://h130-app-server-test-us.hoverx1.cn';
18
- this.shopSelect = this.dataset.shopSelect;
19
+ if (this.shopSelect === 'JP') {
20
+ this.baseUrl =
21
+ this.dataset.requestType === 'prod'
22
+ ? 'https://h130-app-server-jp.hoverx1.cn'
23
+ : 'https://h130-app-server-test-jp.hoverx1.cn';
24
+ }
25
+ this.init();
19
26
  }
20
27
 
21
28
  init() {
@@ -40,6 +47,8 @@ class WorldVideoList extends HTMLElement {
40
47
  try {
41
48
  this.x1Img = this.dataset.x1Img;
42
49
  this.x1ProImg = this.dataset.x1proImg;
50
+ this.x121Img = this.dataset.x121Img;
51
+ this.x121Links = this.dataset.x121Links;
43
52
  this.x1Links = this.dataset.x1Links;
44
53
  this.x1ProLinks = this.dataset.x1proLinks;
45
54
  } catch (error) {
@@ -56,10 +65,10 @@ class WorldVideoList extends HTMLElement {
56
65
  videoPageRightArrow.addEventListener('click', () => {
57
66
  videoPageList.scrollBy({ left: 400, behavior: 'smooth' });
58
67
  swiperIndex++;
59
- dataLayer.push({
60
- event: 'world_video_scroll',
68
+ window.zzAnalytics && window.zzAnalytics.trackEvent('world_video_scroll', {
61
69
  timestamp: new Date().toISOString(),
62
70
  });
71
+
63
72
  if (swiperIndex > 0) {
64
73
  videoPageLeftArrow.classList.remove('tw-hidden');
65
74
  }
@@ -98,7 +107,11 @@ class WorldVideoList extends HTMLElement {
98
107
  btnPro.classList.remove('tw-bg-black', 'tw-text-white');
99
108
  // 这里可以加你切换到 X1 的逻辑
100
109
  if (this.productType !== 1) {
101
- this.productType = 1;
110
+ if (this.shopSelect === 'JP') {
111
+ this.productType = 3;
112
+ } else {
113
+ this.productType = 1;
114
+ }
102
115
  this.page = 1;
103
116
  this.loadMoreData();
104
117
  }
@@ -112,8 +125,7 @@ class WorldVideoList extends HTMLElement {
112
125
  if (entry.isIntersecting) {
113
126
  // 进入视窗:开始计时
114
127
  startTime = Date.now();
115
- dataLayer.push({
116
- event: 'world_video_show',
128
+ window.zzAnalytics && window.zzAnalytics.trackEvent('world_video_show', {
117
129
  timestamp: new Date().toISOString(),
118
130
  });
119
131
  } else {
@@ -123,8 +135,7 @@ class WorldVideoList extends HTMLElement {
123
135
  startTime = 0;
124
136
  // 大于2秒 上报
125
137
  if (duration > 2000) {
126
- dataLayer.push({
127
- event: 'world_video_show_time',
138
+ window.zzAnalytics && window.zzAnalytics.trackEvent('world_video_show_time', {
128
139
  timestamp: new Date().toISOString(),
129
140
  duration: duration,
130
141
  });
@@ -145,8 +156,7 @@ class WorldVideoList extends HTMLElement {
145
156
  entries.forEach((entry) => {
146
157
  if (entry.isIntersecting) {
147
158
  this.loadNextPage();
148
- dataLayer.push({
149
- event: 'world_video_scroll',
159
+ window.zzAnalytics && window.zzAnalytics.trackEvent('world_video_scroll', {
150
160
  timestamp: new Date().toISOString(),
151
161
  });
152
162
  }
@@ -317,6 +327,10 @@ class WorldVideoList extends HTMLElement {
317
327
  replacedTemplate = replacedTemplate
318
328
  .replace(new RegExp('{product-links}', 'g'), this.x1ProLinks)
319
329
  .replace(new RegExp('{product-icon}', 'g'), this.x1ProImg);
330
+ } else if (this.productType === 3) {
331
+ replacedTemplate = replacedTemplate
332
+ .replace(new RegExp('{product-links}', 'g'), this.x121Links)
333
+ .replace(new RegExp('{product-icon}', 'g'), this.x121Img);
320
334
  }
321
335
  $('#video-swiper-wrapper').append(replacedTemplate);
322
336
  });
@@ -23,8 +23,7 @@ class WorldVideo extends HTMLElement {
23
23
  item.addEventListener('click', (event) => {
24
24
  const productType =
25
25
  event.currentTarget.getAttribute('data-product-type');
26
- dataLayer.push({
27
- event: 'world_video_learn_more',
26
+ window.zzAnalytics && window.zzAnalytics.trackEvent('world_video_learn_more', {
28
27
  timestamp: new Date().toISOString(),
29
28
  productType: productType,
30
29
  });
@@ -246,8 +245,7 @@ class WorldVideo extends HTMLElement {
246
245
  if (dialog) {
247
246
  dialog.showModal(id);
248
247
  }
249
- dataLayer.push({
250
- event: 'world-video-comments',
248
+ window.zzAnalytics && window.zzAnalytics.trackEvent('world-video-comments', {
251
249
  timestamp: new Date().toISOString(),
252
250
  });
253
251
  });
@@ -258,8 +256,7 @@ class WorldVideo extends HTMLElement {
258
256
  likeBtns.forEach((item) => {
259
257
  item.addEventListener('click', (event) => {
260
258
  event.stopPropagation();
261
- dataLayer.push({
262
- event: 'world-video-like',
259
+ window.zzAnalytics && window.zzAnalytics.trackEvent('world-video-like', {
263
260
  timestamp: new Date().toISOString(),
264
261
  });
265
262
  });
@@ -227,8 +227,7 @@
227
227
  const btn = document.getElementsByClassName('{{ btn_class }}')
228
228
  if(btn && btn[0]) {
229
229
  btn[0].addEventListener('click', (event) => {
230
- dataLayer.push({
231
- event: "{{ block.settings.click_event_class_name }}",
230
+ window.zzAnalytics && window.zzAnalytics.trackEvent("{{ block.settings.click_event_class_name }}", {
232
231
  timestamp: new Date().toISOString(),
233
232
  });
234
233
  });
@@ -209,8 +209,7 @@
209
209
  const btn = document.getElementsByClassName('{{ btn_class }}')
210
210
  if(btn && btn[0]) {
211
211
  btn[0].addEventListener('click', (event) => {
212
- dataLayer.push({
213
- event: "{{ block.settings.click_event_class_name }}",
212
+ window.zzAnalytics && window.zzAnalytics.trackEvent("{{ block.settings.click_event_class_name }}", {
214
213
  timestamp: new Date().toISOString(),
215
214
  });
216
215
  });
@@ -389,8 +389,8 @@
389
389
  } else {
390
390
  zzShowToast('Please fill in all required fields!');
391
391
  }
392
- dataLayer.push({
393
- event: "edu_page_form_submit",
392
+
393
+ window.zzAnalytics && window.zzAnalytics.trackEvent('edu_page_form_submit', {
394
394
  timestamp: new Date().toISOString(),
395
395
  });
396
396
  });
@@ -409,8 +409,7 @@
409
409
  input.addEventListener('input', function() {
410
410
  if(!hasInput) {
411
411
  hasInput = true
412
- dataLayer.push({
413
- event: "edu_page_form_input",
412
+ window.zzAnalytics && window.zzAnalytics.trackEvent('edu_page_form_input', {
414
413
  timestamp: new Date().toISOString(),
415
414
  });
416
415
  return;
@@ -17,68 +17,28 @@
17
17
  letter-spacing: 0;
18
18
  padding-bottom: 48px;
19
19
  }
20
- {% if block.settings.pc_full_width == false %}
21
-
22
- /* PC下固定宽度居中 */
23
- @media (min-width: 1024px) {
24
- #shopify-block-{{block.id}} .zz-normal-swiper {
25
- width: {{ block.settings.pc_lg_width }}vw;
26
- margin: 0 auto;
27
- transition: all 0.6s ease;
28
- position: relative;
29
- }
20
+ {% if block.settings.right_to_edge == true %}
21
+ @media (min-width: 1280px) {
22
+ #shopify-block-{{block.id}} .zz-normal-swiper {
23
+ padding: 0 calc((100% - {{ block.settings.pc_xl_width }}px) / 2);
30
24
  }
31
-
32
- @media (min-width: 1280px) {
33
- #shopify-block-{{block.id}} .zz-normal-swiper {
34
- width: {{ block.settings.pc_xl_width }}px;
35
- margin: 0 auto;
36
- transition: all 0.6s ease;
37
- position: relative;
38
- }
25
+ }
26
+
27
+ @media (min-width: 1024px) and (max-width: 1279px) {
28
+ #shopify-block-{{block.id}} .zz-normal-swiper {
29
+ padding: 0 calc((100% - {{ block.settings.pc_lg_width }}vw) / 2);
39
30
  }
40
-
41
- /* 👉 当启用 right_to_edge 时,将右侧拉到屏幕边缘 */
42
- {% if block.settings.right_to_edge == true %}
43
- @media (min-width: 1280px) {
44
- #shopify-block-{{block.id}} .zz-normal-swiper {
45
- margin-left: calc((100% - {{ block.settings.pc_xl_width }}px) / 2);
46
- margin-right: 0;
47
- width: calc({{ block.settings.pc_xl_width }}px + (100% - {{ block.settings.pc_xl_width }}px) / 2);
48
- }
49
- #shopify-block-{{block.id}} .zz-normal-swiper .swiper-pagination {
50
- left: 50%;
51
- transform: translateX(-50%);
52
- width: {{ block.settings.pc_xl_width }}px;
53
- }
54
- }
55
-
56
- @media (min-width: 1024px) and (max-width: 1279px) {
57
- #shopify-block-{{block.id}} .zz-normal-swiper {
58
- margin-left: calc((100% - ({{ block.settings.pc_lg_width }}vw)) / 2);
59
- margin-right: 0;
60
- width: calc({{ block.settings.pc_lg_width }}vw + (100% - ({{ block.settings.pc_lg_width }}vw)) / 2);
61
- }
62
- #shopify-block-{{block.id}} .zz-normal-swiper .swiper-pagination {
63
- left: 50%;
64
- transform: translateX(-50%);
65
- width: {{ block.settings.pc_lg_width }}vw;
66
- }
67
- }
68
- @media (max-width: 1024px) {
69
- #shopify-block-{{block.id}} .zz-swiper-wrapper {
70
- padding-left: 20px;
71
- }
72
- }
73
- {% endif %}
74
-
75
- {% else %}
76
- #shopify-block-{{block.id}} {
77
- width: 100%;
31
+ }
32
+ @media (max-width: 1024px) {
33
+ #shopify-block-{{block.id}} .zz-normal-swiper {
34
+ padding-left: 20px;
78
35
  }
79
- {% endif %}
80
-
36
+ }
81
37
 
38
+ {% endif %}
39
+ #shopify-block-{{block.id}} {
40
+ width: 100%;
41
+ }
82
42
 
83
43
  #shopify-block-{{block.id}} .swiper-button-next:after,
84
44
  #shopify-block-{{block.id}} .swiper-button-prev:after {
@@ -208,7 +168,7 @@
208
168
  <div
209
169
  class='zz-normal-swiper swiper zz-normal-swiper-{{ block.id }}'
210
170
  >
211
- <div class='zz-swiper-wrapper swiper-wrapper'>
171
+ <div class='zz-swiper-wrapper swiper-wrapper tw-invisible'>
212
172
  {% for block in block.blocks %}
213
173
  <div class='swiper-slide'>
214
174
  {% render block %}
@@ -232,7 +192,9 @@
232
192
  {% endif %}
233
193
 
234
194
  {% if block.settings.pagination_type != 'none' %}
235
- <div class='swiper-pagination {% if block.settings.pagination_type == "segments" %} zz-pagination-segments {% endif %}'></div>
195
+ <div
196
+ class='swiper-pagination {% if block.settings.pagination_type == "segments" %} zz-pagination-segments {% endif %}'
197
+ ></div>
236
198
  {% endif %}
237
199
  </div>
238
200
 
@@ -275,6 +237,7 @@
275
237
  pauseOnMouseEnter: true,
276
238
  },
277
239
  {% endif %}
240
+ initialSlide: {{ block.settings.pre_show_index | default: 0 }},
278
241
  breakpoints: {
279
242
  0: {
280
243
  slidesPerView: {{ block.settings.slides_per_view_mb | default: 1 }},
@@ -291,6 +254,7 @@
291
254
  if (initialized) return;
292
255
  initialized = true;
293
256
  instance = new Swiper(swiperSelector, options);
257
+ if (swiperWrapper) swiperWrapper.classList.remove('tw-invisible');
294
258
  }
295
259
 
296
260
  const root = block.querySelector(swiperSelector);
@@ -349,6 +313,13 @@
349
313
  "label": "居中显示",
350
314
  "default": false
351
315
  },
316
+ {
317
+ "type": "number",
318
+ "id": "pre_show_index",
319
+ "label": "预先展示的内容序号(0开始)",
320
+ "default": 0,
321
+ "info": "0表示预先展示第一张,1表示预先展示第二张,以此类推"
322
+ },
352
323
  {
353
324
  "type": "checkbox",
354
325
  "id": "auto_height",
@@ -357,33 +328,23 @@
357
328
  },
358
329
  {
359
330
  "type": "checkbox",
360
- "id": "pc_full_width",
361
- "label": "内容区域是否全屏展示",
331
+ "id": "right_to_edge",
332
+ "label": "内容区域是否靠右到边缘",
362
333
  "default": false
363
334
  },
364
335
  {
365
336
  "type": "number",
366
337
  "id": "pc_xl_width",
367
- "label": "XL屏幕内容区域宽度 (px)",
338
+ "label": "XL屏幕左对齐区域宽度 (px)",
368
339
  "default": 1200,
369
- "info": "非全屏展示时有效",
370
- "visible_if": "{{ block.settings.pc_full_width == false }}"
340
+ "visible_if": "{{ block.settings.right_to_edge == true }}"
371
341
  },
372
342
  {
373
343
  "type": "number",
374
344
  "id": "pc_lg_width",
375
- "label": "LG屏幕内容区域宽度 (vw)",
345
+ "label": "LG屏幕左对齐区域宽度 (vw)",
376
346
  "default": 90,
377
- "info": "非全屏展示时有效",
378
- "visible_if": "{{ block.settings.pc_full_width == false }}"
379
- },
380
-
381
- {
382
- "type": "checkbox",
383
- "id": "right_to_edge",
384
- "label": "内容区域是否靠右对齐到边缘",
385
- "visible_if": "{{ block.settings.pc_full_width == false }}",
386
- "default": true
347
+ "visible_if": "{{ block.settings.right_to_edge == true }}"
387
348
  },
388
349
 
389
350
  {
@@ -1,7 +1,7 @@
1
1
  {% schema %}
2
2
  {
3
3
  "name": "Ratio Image",
4
- "class": "ratio-image",
4
+ "class": "ratio-image-black",
5
5
  "settings": [
6
6
  {
7
7
  "type": "header",
@@ -86,9 +86,11 @@
86
86
  }
87
87
  {% endschema %}
88
88
 
89
- {% assign autoplay = true %}
89
+ {% assign autoplay = true %}
90
+ {% assign muted = true %}
90
91
  {% if block.settings.if_click_play %}
91
92
  {% assign autoplay = false %}
93
+ {% assign muted = false %}
92
94
  {% endif %}
93
95
 
94
96
 
@@ -101,7 +103,7 @@
101
103
  class: 'ratio-video tw-w-full tw-h-auto',
102
104
  autoplay: autoplay,
103
105
  loop: true,
104
- muted: true
106
+ muted: muted
105
107
  %}
106
108
  {% if block.settings.if_click_play %}
107
109
  <div class="video-play-btn tw-absolute tw-top-[50%] tw-left-[50%] tw-translate-x-[-50%] tw-translate-y-[-50%]">
@@ -3,7 +3,7 @@
3
3
  #shopify-block-{{block.id}} {
4
4
  width: calc(100% - 72px);
5
5
  box-sizing: border-box;
6
- transform: translateX(-24px);
6
+
7
7
  }
8
8
  #shopify-block-{{block.id}} .image-video-box {
9
9
  width: 100%;
@@ -80,6 +80,8 @@
80
80
  @media screen and (max-width: 1023px) {
81
81
  #shopify-block-{{block.id}} .zz-video-swiper-preview {
82
82
  padding-bottom: 68px;
83
+ padding-left: 20px;
84
+ padding-right: 20px;
83
85
  }
84
86
 
85
87
  #shopify-block-{{block.id}} .zz-video-swiper-preview .swiper-slide .banner-item::after {
@@ -217,12 +219,9 @@
217
219
  let progressTimer = null;
218
220
 
219
221
  const prevSwiper = new Swiper(swiperClassName, {
220
- {% if block.settings.if_loop == true %}
221
- loop: true,
222
- {% endif %}
223
222
  slidesPerView: 'auto',
224
223
  initialSlide: isDesktop ? 1 : 0,
225
- centeredSlides: true,
224
+ centeredSlides: isDesktop ? true : false,
226
225
  spaceBetween: isDesktop ? 24 : 12,
227
226
  navigation: {
228
227
  nextEl: '.swiper-button-next',
@@ -442,12 +441,6 @@
442
441
  "default": "#000000",
443
442
  "label": "移动端轮播导航圆圈颜色"
444
443
  },
445
- {
446
- "type": "checkbox",
447
- "id": "if_loop",
448
- "label": "是否循环播放",
449
- "default": false
450
- },
451
444
  {
452
445
  "type": "checkbox",
453
446
  "id": "if_autoplay",
@@ -46,20 +46,36 @@
46
46
  {
47
47
  "type": "image_picker",
48
48
  "id": "img_130_icon",
49
- "label": "130 产品icon"
49
+ "label": "130 产品icon",
50
+ "visible_if": "{{ block.settings.shop_select != 'JP' }}"
50
51
  },
51
- {
52
- "type": "textarea",
53
- "id": "links_130",
54
- "label": "Sites Link 130",
55
- "info": "国家对应链接的表,国家即是国家选择器上显示的字段,国家和路由之间用冒号隔开( 冒号后要加空格)。国家之间换行,“default”为其他未写的默认的链接 EG: Canada: https://hoverair.com/ default: https://hoverair.com/ "
52
+ {
53
+ "type": "image_picker",
54
+ "id": "img_121_icon",
55
+ "label": "121 产品icon",
56
+ "visible_if": "{{ block.settings.shop_select == 'JP' }}"
56
57
  },
58
+
57
59
  {
58
60
  "type": "textarea",
59
61
  "id": "links_141",
60
62
  "label": "Sites Link 141",
61
63
  "info": "国家对应链接的表,国家即是国家选择器上显示的字段,国家和路由之间用冒号隔开( 冒号后要加空格)。国家之间换行,“default”为其他未写的默认的链接 EG: Canada: https://hoverair.com/ default: https://hoverair.com/ "
62
- }
64
+ },
65
+ {
66
+ "type": "textarea",
67
+ "id": "links_130",
68
+ "label": "Sites Link 130",
69
+ "info": "国家对应链接的表,国家即是国家选择器上显示的字段,国家和路由之间用冒号隔开( 冒号后要加空格)。国家之间换行,“default”为其他未写的默认的链接 EG: Canada: https://hoverair.com/ default: https://hoverair.com/ ",
70
+ "visible_if": "{{ block.settings.shop_select != 'JP' }}"
71
+ },
72
+ {
73
+ "type": "textarea",
74
+ "id": "links_121",
75
+ "label": "Sites Link 121",
76
+ "info": "国家对应链接的表,国家即是国家选择器上显示的字段,国家和路由之间用冒号隔开( 冒号后要加空格)。国家之间换行,“default”为其他未写的默认的链接 EG: Canada: https://hoverair.com/ default: https://hoverair.com/ ",
77
+ "visible_if": "{{ block.settings.shop_select == 'JP' }}"
78
+ },
63
79
  ],
64
80
  "presets": [
65
81
  {
@@ -74,6 +90,8 @@
74
90
  data-x1-img='{{block.settings.img_130_icon | image_url}}'
75
91
  data-x1pro-links='{{block.settings.links_141 | url_encode }}'
76
92
  data-x1-links='{{block.settings.links_130 | url_encode }}'
93
+ data-x121-links='{{block.settings.links_121 | url_encode }}'
94
+ data-x121-img='{{block.settings.img_121_icon | image_url}}'
77
95
  data-request-type='{{ block.settings.request_type }}'
78
96
  data-shop-select='{{ block.settings.shop_select }}'
79
97
  >
@@ -91,7 +109,11 @@
91
109
  class='tw-flex-1 tw-border-none tw-h-full tw-rounded-[21px] tw-text-[13px] lg:tw-text-[16px] tw-bg-transparent tw-text-black tw-transition-colors'
92
110
  style='font-size: 16px;'
93
111
  >
94
- X1
112
+ {% if block.settings.shop_select == 'JP' %}
113
+ X1 Smart
114
+ {% else %}
115
+ X1
116
+ {% endif %}
95
117
  </button>
96
118
  </div>
97
119
  </div>
@@ -137,6 +159,8 @@
137
159
  data-x1-img='{{block.settings.img_130_icon | image_url}}'
138
160
  data-x1pro-links='{{block.settings.links_141 | url_encode }}'
139
161
  data-x1-links='{{block.settings.links_130 | url_encode }}'
162
+ data-x121-img='{{block.settings.img_121_icon | image_url}}'
163
+ data-x121-links='{{block.settings.links_121 | url_encode }}'
140
164
  data-request-type='{{ block.settings.request_type }}'
141
165
  >
142
166
  <!-- 蒙层 -->
@@ -461,7 +485,7 @@
461
485
  </svg>
462
486
  </div>
463
487
 
464
- <world-video-comments-dialog data-request-type='{{ block.settings.request_type }}'>
488
+ <world-video-comments-dialog data-request-type='{{ block.settings.request_type }}' data-shop-select='{{ block.settings.shop_select }}'>
465
489
  <div
466
490
  class='world-video-comments-mask lg:tw-hidden tw-z-[1007] tw-bg-black/60 tw-fixed tw-inset-0 tw-z-[1000]'
467
491
  ></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zz-shopify-components",
3
- "version": "0.16.3-beta.1",
3
+ "version": "0.16.3-beta.10",
4
4
  "description": "Reusable Shopify components for theme projects",
5
5
  "keywords": [
6
6
  "shopify",
@@ -208,8 +208,7 @@
208
208
  const offsetTop = target.offsetTop - headerHeight;
209
209
  scrollPaginationToCenter();
210
210
  window.scrollTo(0, offsetTop);
211
- dataLayer.push({
212
- event: "141_productpage_click_header_tab_item",
211
+ window.zzAnalytics && window.zzAnalytics.trackEvent('141_productpage_click_header_tab_item', {
213
212
  timestamp: new Date().toISOString(),
214
213
  header_module_name: id,
215
214
  });
@@ -314,8 +313,7 @@
314
313
  const btns = document.querySelectorAll('.{{ btn_class }}');
315
314
  btns.forEach(btn => {
316
315
  btn.addEventListener('click', (event) => {
317
- dataLayer.push({
318
- event: "{{ section.settings.buy_now_click_event_class_name }}",
316
+ window.zzAnalytics && window.zzAnalytics.trackEvent("{{ section.settings.buy_now_click_event_class_name }}", {
319
317
  timestamp: new Date().toISOString(),
320
318
  });
321
319
  });
@@ -212,16 +212,10 @@
212
212
  }
213
213
  scrollPaginationToCenter();
214
214
  window.scrollTo(0, offsetTop);
215
- dataLayer.push({
216
- event: "141_productpage_click_header_tab_item",
215
+ window.zzAnalytics && window.zzAnalytics.trackEvent("141_productpage_click_header_tab_item", {
217
216
  timestamp: new Date().toISOString(),
218
217
  header_module_name: id,
219
218
  });
220
- console.log('tag-data', {
221
- event: "141_productpage_click_header_tab_item",
222
- timestamp: new Date().toISOString(),
223
- header_module_name: id,
224
- })
225
219
 
226
220
  });
227
221
  });
@@ -326,8 +320,7 @@
326
320
  const btns = document.querySelectorAll('.{{ btn_class }}');
327
321
  btns.forEach(btn => {
328
322
  btn.addEventListener('click', (event) => {
329
- dataLayer.push({
330
- event: "{{ section.settings.buy_now_click_event_class_name }}",
323
+ window.zzAnalytics && window.zzAnalytics.trackEvent("{{ section.settings.buy_now_click_event_class_name }}", {
331
324
  timestamp: new Date().toISOString(),
332
325
  });
333
326
  });
@@ -720,17 +720,10 @@
720
720
  item.addEventListener('click', (event) => {
721
721
 
722
722
  event.stopPropagation();
723
- console.log('banner.settings.banner_name', {
724
- event: "banner_click",
725
- timestamp: new Date().toISOString(),
723
+ window.zzAnalytics && window.zzAnalytics.trackEvent("banner_click", {
726
724
  event_type_attribute: "{{ banner.settings.banner_name }}",
727
725
  section_name: "swiper_banner_v3",
728
- })
729
- dataLayer.push({
730
- event: "banner_click",
731
726
  timestamp: new Date().toISOString(),
732
- event_type_attribute: "{{ banner.settings.banner_name }}",
733
- section_name: "swiper_banner_v3",
734
727
  });
735
728
  });
736
729
  });
@@ -953,8 +946,7 @@
953
946
  if (entry.isIntersecting) {
954
947
  const bannerName = entry.target.dataset.bannerName;
955
948
  console.log('banner_show', bannerName);
956
- dataLayer.push({
957
- event: "banner_show",
949
+ window.zzAnalytics && window.zzAnalytics.trackEvent("banner_show", {
958
950
  timestamp: new Date().toISOString(),
959
951
  event_type_attribute: bannerName,
960
952
  section_name: "swiper_banner_v3",