@gem-sdk/components 2.2.0-staging.32 → 2.2.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.
- package/dist/cjs/article/components/ArticleImage.js +1 -2
- package/dist/cjs/banner/components/hero-banner/index.liquid.js +7 -4
- package/dist/cjs/builder.js +1 -1
- package/dist/cjs/button/components/Button.liquid.js +3 -3
- package/dist/cjs/carousel/components/Carousel.liquid.js +2 -3
- package/dist/cjs/carousel/components/plugins/AutoPlayPlugin.js +58 -17
- package/dist/cjs/common/const.js +1 -1
- package/dist/cjs/grid/setting/Section.js +7 -37
- package/dist/cjs/image/components/AdaptiveImage.liquid.js +5 -6
- package/dist/cjs/image/components/Image.js +1 -2
- package/dist/cjs/image/components/Image.liquid.js +4 -6
- package/dist/cjs/image/components/NextImage.liquid.js +3 -4
- package/dist/cjs/image-comparison/components/CompareImage.liquid.js +3 -7
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.liquid.js +2 -2
- package/dist/cjs/marquee/components/Marquee.liquid.js +13 -10
- package/dist/cjs/post-purchase/product/components/variants/Dropdown.js +1 -1
- package/dist/cjs/product/components/ProductButton.js +1 -1
- package/dist/cjs/product/components/ProductButton.liquid.js +3 -21
- package/dist/cjs/product/components/ProductImagesV2/liquid/ProductFeaturedImageCarousel.liquid.js +5 -6
- package/dist/cjs/product/components/ProductImagesV2/liquid/ProductGalleryCarousel.liquid.js +2 -2
- package/dist/cjs/product/components/ProductImagesV2/liquid/ProductGalleryGrid.liquid.js +4 -4
- package/dist/cjs/product/components/ProductImagesV2/liquid/ProductImages.liquid.js +4 -4
- package/dist/cjs/product/components/ProductVariants/variants/combine/index.js +1 -1
- package/dist/cjs/product/setting/ProductList.js +1 -1
- package/dist/cjs/tab/hooks/useTabInteraction.js +9 -13
- package/dist/cjs/third-party/components/Bogos/BogosSampleContent.js +10 -9
- package/dist/cjs/third-party/components/RechargeSubscriptions.liquid.js +1 -1
- package/dist/cjs/third-party/components/Releasit.liquid.js +2 -4
- package/dist/cjs/third-party/configs/BoldProductOptions.js +2 -2
- package/dist/cjs/third-party/configs/EcoboostifyShoppableReelUgc.js +1 -1
- package/dist/cjs/third-party/next.js +3 -3
- package/dist/cjs/third-party/setting/EcoboostifyShoppableReelUgc.js +2 -2
- package/dist/cjs/third-party/setting/Releasit.js +2 -59
- package/dist/cjs/third-party/setting/index.js +3 -3
- package/dist/cjs/video/components/HTML5Embed.js +2 -2
- package/dist/cjs/video/components/HTML5Embed.liquid.js +3 -6
- package/dist/cjs/video/components/LiteYouTubeEmbed.liquid.js +3 -5
- package/dist/esm/article/components/ArticleImage.js +1 -2
- package/dist/esm/banner/components/hero-banner/index.liquid.js +7 -4
- package/dist/esm/builder.js +1 -1
- package/dist/esm/button/components/Button.liquid.js +3 -3
- package/dist/esm/carousel/components/Carousel.liquid.js +2 -3
- package/dist/esm/carousel/components/plugins/AutoPlayPlugin.js +58 -17
- package/dist/esm/common/const.js +1 -1
- package/dist/esm/grid/setting/Section.js +7 -37
- package/dist/esm/image/components/AdaptiveImage.liquid.js +5 -6
- package/dist/esm/image/components/Image.js +2 -3
- package/dist/esm/image/components/Image.liquid.js +4 -6
- package/dist/esm/image/components/NextImage.liquid.js +3 -4
- package/dist/esm/image-comparison/components/CompareImage.liquid.js +3 -7
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.liquid.js +1 -1
- package/dist/esm/marquee/components/Marquee.liquid.js +13 -10
- package/dist/esm/post-purchase/product/components/variants/Dropdown.js +1 -1
- package/dist/esm/product/components/ProductButton.js +1 -1
- package/dist/esm/product/components/ProductButton.liquid.js +3 -21
- package/dist/esm/product/components/ProductImagesV2/liquid/ProductFeaturedImageCarousel.liquid.js +5 -6
- package/dist/esm/product/components/ProductImagesV2/liquid/ProductGalleryCarousel.liquid.js +2 -2
- package/dist/esm/product/components/ProductImagesV2/liquid/ProductGalleryGrid.liquid.js +4 -4
- package/dist/esm/product/components/ProductImagesV2/liquid/ProductImages.liquid.js +4 -4
- package/dist/esm/product/components/ProductVariants/variants/combine/index.js +1 -1
- package/dist/esm/product/setting/ProductList.js +1 -1
- package/dist/esm/tab/hooks/useTabInteraction.js +10 -14
- package/dist/esm/third-party/components/Bogos/BogosSampleContent.js +11 -10
- package/dist/esm/third-party/components/RechargeSubscriptions.liquid.js +1 -1
- package/dist/esm/third-party/components/Releasit.liquid.js +2 -4
- package/dist/esm/third-party/configs/BoldProductOptions.js +2 -2
- package/dist/esm/third-party/configs/EcoboostifyShoppableReelUgc.js +1 -1
- package/dist/esm/third-party/next.js +3 -3
- package/dist/esm/third-party/setting/EcoboostifyShoppableReelUgc.js +2 -2
- package/dist/esm/third-party/setting/Releasit.js +2 -59
- package/dist/esm/third-party/setting/index.js +4 -4
- package/dist/esm/video/components/HTML5Embed.js +2 -2
- package/dist/esm/video/components/HTML5Embed.liquid.js +3 -6
- package/dist/esm/video/components/LiteYouTubeEmbed.liquid.js +3 -5
- package/dist/types/index.d.ts +15 -29
- package/package.json +3 -3
|
@@ -2,15 +2,41 @@ const AutoPlayPlugin = (slider)=>{
|
|
|
2
2
|
let autoplay = slider.options.autoplay ?? {};
|
|
3
3
|
let timeout;
|
|
4
4
|
let mouseOver = false;
|
|
5
|
+
let inViewport = false;
|
|
6
|
+
let observer = null;
|
|
7
|
+
// Thêm sự kiện cho dot nếu có
|
|
8
|
+
const $dots = slider?.container?.closest('[data-component-type="component"]')?.querySelector('.carousel-dots');
|
|
9
|
+
// Callback của IntersectionObserver
|
|
10
|
+
function handleIntersection(entries) {
|
|
11
|
+
entries.forEach((entry)=>{
|
|
12
|
+
// Với threshold 0, chỉ cần một phần bất kỳ hiển thị sẽ đánh dấu isIntersecting
|
|
13
|
+
inViewport = entry.isIntersecting;
|
|
14
|
+
if (inViewport) {
|
|
15
|
+
nextTimeout();
|
|
16
|
+
} else {
|
|
17
|
+
clearNextTimeout();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function initIntersectionObserver() {
|
|
22
|
+
// Nếu đã có observer hoặc không có container thì không khởi tạo lại
|
|
23
|
+
if (observer || !slider.container) return;
|
|
24
|
+
observer = new IntersectionObserver(handleIntersection, {
|
|
25
|
+
root: null,
|
|
26
|
+
threshold: 0
|
|
27
|
+
});
|
|
28
|
+
observer.observe(slider.container);
|
|
29
|
+
}
|
|
5
30
|
function clearNextTimeout() {
|
|
6
31
|
clearTimeout(timeout);
|
|
7
32
|
}
|
|
8
33
|
function nextTimeout() {
|
|
9
|
-
|
|
34
|
+
clearNextTimeout();
|
|
10
35
|
timeout = setTimeout(()=>{
|
|
11
|
-
|
|
36
|
+
// Nếu đang hover, autoplay bị tắt hoặc slider không trong viewport thì không chuyển slide
|
|
37
|
+
if (mouseOver || !autoplay.enable || !inViewport) return;
|
|
12
38
|
slider.next();
|
|
13
|
-
}, autoplay
|
|
39
|
+
}, autoplay.delay ?? 2000);
|
|
14
40
|
}
|
|
15
41
|
function onMouseOver() {
|
|
16
42
|
mouseOver = true;
|
|
@@ -21,11 +47,15 @@ const AutoPlayPlugin = (slider)=>{
|
|
|
21
47
|
nextTimeout();
|
|
22
48
|
}
|
|
23
49
|
slider.on('created', ()=>{
|
|
24
|
-
|
|
50
|
+
$dots?.addEventListener('mouseover', onMouseOver);
|
|
51
|
+
$dots?.addEventListener('mouseout', onMouseOut);
|
|
52
|
+
// Nếu tùy chọn pauseOnHover bật thì thêm sự kiện hover cho container slider
|
|
53
|
+
if (autoplay.pauseOnHover && slider.container) {
|
|
25
54
|
slider.container.addEventListener('mouseover', onMouseOver);
|
|
26
55
|
slider.container.addEventListener('mouseout', onMouseOut);
|
|
27
56
|
}
|
|
28
|
-
if (
|
|
57
|
+
if (autoplay.enable) {
|
|
58
|
+
initIntersectionObserver();
|
|
29
59
|
nextTimeout();
|
|
30
60
|
}
|
|
31
61
|
});
|
|
@@ -33,29 +63,40 @@ const AutoPlayPlugin = (slider)=>{
|
|
|
33
63
|
slider.on('animationEnded', nextTimeout);
|
|
34
64
|
slider.on('updated', (newOptions)=>{
|
|
35
65
|
autoplay = newOptions.options?.autoplay ?? {};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
slider.container.removeEventListener('mouseout', onMouseOut);
|
|
66
|
+
if (autoplay.enable) {
|
|
67
|
+
initIntersectionObserver();
|
|
68
|
+
nextTimeout();
|
|
69
|
+
}
|
|
41
70
|
});
|
|
42
71
|
slider.on('optionsChanged', (newOptions)=>{
|
|
43
|
-
|
|
44
|
-
$dots?.addEventListener('mouseover', onMouseOver);
|
|
45
|
-
$dots?.addEventListener('mouseout', onMouseOut);
|
|
46
|
-
if (newOptions.options.autoplay?.pauseOnHover !== autoplay.pauseOnHover) {
|
|
72
|
+
if (newOptions.options.autoplay?.pauseOnHover !== autoplay.pauseOnHover && slider.container) {
|
|
47
73
|
if (newOptions.options.autoplay?.pauseOnHover) {
|
|
48
74
|
slider.container.addEventListener('mouseover', onMouseOver);
|
|
49
75
|
slider.container.addEventListener('mouseout', onMouseOut);
|
|
50
|
-
}
|
|
51
|
-
if (!newOptions.options.autoplay?.pauseOnHover) {
|
|
76
|
+
} else {
|
|
52
77
|
slider.container.removeEventListener('mouseover', onMouseOver);
|
|
53
78
|
slider.container.removeEventListener('mouseout', onMouseOut);
|
|
54
79
|
mouseOver = false;
|
|
55
80
|
}
|
|
56
81
|
}
|
|
57
|
-
nextTimeout();
|
|
58
82
|
autoplay = newOptions.options.autoplay ?? {};
|
|
83
|
+
if (autoplay.enable) {
|
|
84
|
+
initIntersectionObserver();
|
|
85
|
+
nextTimeout();
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
slider.on('destroyed', ()=>{
|
|
89
|
+
if (slider.container) {
|
|
90
|
+
slider.container.removeEventListener('mouseover', onMouseOver);
|
|
91
|
+
slider.container.removeEventListener('mouseout', onMouseOut);
|
|
92
|
+
}
|
|
93
|
+
$dots?.removeEventListener('mouseover', onMouseOver);
|
|
94
|
+
$dots?.removeEventListener('mouseout', onMouseOut);
|
|
95
|
+
clearNextTimeout();
|
|
96
|
+
if (observer) {
|
|
97
|
+
observer.disconnect();
|
|
98
|
+
observer = null;
|
|
99
|
+
}
|
|
59
100
|
});
|
|
60
101
|
};
|
|
61
102
|
|
package/dist/esm/common/const.js
CHANGED
|
@@ -256,21 +256,6 @@ const config = {
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
},
|
|
259
|
-
{
|
|
260
|
-
id: 'columnGap',
|
|
261
|
-
type: 'range',
|
|
262
|
-
min: 0,
|
|
263
|
-
max: 100,
|
|
264
|
-
step: 1,
|
|
265
|
-
units: [
|
|
266
|
-
'%'
|
|
267
|
-
],
|
|
268
|
-
devices: {
|
|
269
|
-
desktop: {
|
|
270
|
-
default: '0%'
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
259
|
{
|
|
275
260
|
id: 'background',
|
|
276
261
|
type: 'background',
|
|
@@ -307,29 +292,14 @@ const config = {
|
|
|
307
292
|
],
|
|
308
293
|
ui: [
|
|
309
294
|
{
|
|
310
|
-
type: '
|
|
295
|
+
type: 'control',
|
|
311
296
|
label: {
|
|
312
297
|
en: 'Layout'
|
|
313
298
|
},
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
id: 'layout'
|
|
319
|
-
},
|
|
320
|
-
layout: 'vertical'
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
type: 'control',
|
|
324
|
-
label: {
|
|
325
|
-
en: 'Column gap'
|
|
326
|
-
},
|
|
327
|
-
setting: {
|
|
328
|
-
id: 'columnGap'
|
|
329
|
-
},
|
|
330
|
-
condition: `!!layout.cols && layout.cols.length > 1 && pageType == "POST_PURCHASE"`
|
|
331
|
-
}
|
|
332
|
-
]
|
|
299
|
+
setting: {
|
|
300
|
+
id: 'layout'
|
|
301
|
+
},
|
|
302
|
+
layout: 'vertical'
|
|
333
303
|
},
|
|
334
304
|
{
|
|
335
305
|
type: 'group',
|
|
@@ -366,7 +336,7 @@ const config = {
|
|
|
366
336
|
setting: {
|
|
367
337
|
id: 'verticalGutter'
|
|
368
338
|
},
|
|
369
|
-
condition: `!!layout.cols && layout.cols.length > 1
|
|
339
|
+
condition: `!!layout.cols && layout.cols.length > 1`
|
|
370
340
|
}
|
|
371
341
|
]
|
|
372
342
|
},
|
|
@@ -375,7 +345,7 @@ const config = {
|
|
|
375
345
|
label: {
|
|
376
346
|
en: 'Align'
|
|
377
347
|
},
|
|
378
|
-
condition: `
|
|
348
|
+
condition: `layout.display !== 'fill' || (layout.display === 'fill' && !!layout.cols && layout.cols.length > 1)`,
|
|
379
349
|
controls: [
|
|
380
350
|
{
|
|
381
351
|
type: 'control',
|
|
@@ -2,7 +2,7 @@ import { template, cls, RenderIf, makeStyleResponsive } from '@gem-sdk/core';
|
|
|
2
2
|
import { getImageSrc } from '../helpers/getSrcSet.js';
|
|
3
3
|
import { createBlurDataURL } from './helpers.js';
|
|
4
4
|
|
|
5
|
-
const AdaptiveImage = ({ srcSet, priority, alt, aspectRatio, layout, className, pictureClass, style, imagePlaceholder,
|
|
5
|
+
const AdaptiveImage = ({ srcSet, priority, alt, aspectRatio, layout, className, pictureClass, style, imagePlaceholder, enableLazyloadImage = true, ...props })=>{
|
|
6
6
|
const fallBackImage = 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif';
|
|
7
7
|
const srcDesktop = getImageSrc(srcSet?.desktop, 'desktop') || fallBackImage;
|
|
8
8
|
const srcTablet = (getImageSrc(srcSet?.tablet, 'tablet') ?? getImageSrc(srcSet?.desktop, 'tablet')) || fallBackImage;
|
|
@@ -27,17 +27,16 @@ const AdaptiveImage = ({ srcSet, priority, alt, aspectRatio, layout, className,
|
|
|
27
27
|
}}"
|
|
28
28
|
/>
|
|
29
29
|
`, template`
|
|
30
|
-
${srcMobile ? `<source media="(max-width: 767px)" data-srcSet="${srcMobile}" srcset="${
|
|
31
|
-
${srcTablet ? `<source media="(max-width: 1024px)" data-srcSet="${srcTablet}" srcset="${
|
|
30
|
+
${srcMobile ? `<source media="(max-width: 767px)" data-srcSet="${srcMobile}" srcset="${enableLazyloadImage ? imagePlaceholder?.['mobile'] ?? createBlurDataURL(srcSet?.mobile?.width ?? srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.mobile?.height ?? srcSet?.tablet?.height ?? srcSet?.desktop?.height ?? 0) : srcMobile}" />` : ''}
|
|
31
|
+
${srcTablet ? `<source media="(max-width: 1024px)" data-srcSet="${srcTablet}" srcset="${enableLazyloadImage ? imagePlaceholder?.['tablet'] ?? createBlurDataURL(srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.tablet?.height ?? srcSet?.desktop?.height ?? 0) : srcTablet}" />` : ''}
|
|
32
32
|
<img
|
|
33
33
|
${{
|
|
34
34
|
...props
|
|
35
35
|
}}
|
|
36
36
|
class="${cls(className, {
|
|
37
|
-
gp_lazyload:
|
|
38
|
-
gp_force_load: pageContext?.isOptimizePlan
|
|
37
|
+
gp_lazyload: enableLazyloadImage
|
|
39
38
|
})}"
|
|
40
|
-
src="${
|
|
39
|
+
src="${enableLazyloadImage ? imagePlaceholder?.['desktop'] ?? createBlurDataURL(srcSet?.desktop?.width ?? 0, srcSet?.desktop?.height ?? 0) : srcDesktop}"
|
|
41
40
|
data-src="${srcDesktop}"
|
|
42
41
|
width="100%"
|
|
43
42
|
alt="${alt}"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { makeStyleResponsive, getWidthByShapeGlobalSize, makeWidth, getHeightByShapeGlobalSize, cls, getStyleShadowState, handleConvertClassColor, getBorderStyle, getBorderRadiusStyle, getStyleShadow, getAspectRatioGlobalSize, getGlobalColorStateClass, getGlobalColorStateStyle, makeStyleState, getCornerCSSFromGlobal } from '@gem-sdk/core';
|
|
3
3
|
import Link from '../../link/components/Link.js';
|
|
4
4
|
import AdaptiveImage from './AdaptiveImage.js';
|
|
5
5
|
import NextImage from './NextImage.js';
|
|
@@ -8,7 +8,6 @@ import { composeAspectRatio } from './helpers.js';
|
|
|
8
8
|
const Image = ({ styles, className, setting, builderAttrs, builderProps, style, children, onClick, onLoad })=>{
|
|
9
9
|
const { image, imageLink, srcSet, isNotLazyload } = setting ?? {};
|
|
10
10
|
const { customAspectRadio } = styles ?? {};
|
|
11
|
-
useCurrentDevice();
|
|
12
11
|
const { shape } = styles ?? {};
|
|
13
12
|
const WrapLink = imageLink?.link ? Link : 'div';
|
|
14
13
|
const opacity = {
|
|
@@ -83,7 +82,7 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
|
|
|
83
82
|
setting?.isAdaptive ? /*#__PURE__*/ jsx(AdaptiveImage, {
|
|
84
83
|
srcSet: setting.srcSet,
|
|
85
84
|
pictureClass: "gp-contents",
|
|
86
|
-
className: cls(className, 'gp-
|
|
85
|
+
className: cls(className, 'gp-w-full gp-max-w-full', handleConvertClassColor(styles?.borderImg)),
|
|
87
86
|
alt: setting.alt,
|
|
88
87
|
style: {
|
|
89
88
|
...imageWidth,
|
|
@@ -3,7 +3,7 @@ import AdaptiveImage from './AdaptiveImage.liquid.js';
|
|
|
3
3
|
import NextImage from './NextImage.liquid.js';
|
|
4
4
|
import { getInsertLinkData } from '../../helpers.js';
|
|
5
5
|
|
|
6
|
-
const Image = ({ styles, className, setting, builderAttrs, builderProps, style, advanced,
|
|
6
|
+
const Image = ({ styles, className, setting, builderAttrs, builderProps, style, advanced, enableLazyloadImage = true })=>{
|
|
7
7
|
const { imageLink, isNotLazyload } = setting ?? {};
|
|
8
8
|
const { shape } = styles ?? {};
|
|
9
9
|
const { Wrap: WrapLink, urlData } = getInsertLinkData('div', imageLink);
|
|
@@ -30,7 +30,7 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
|
|
|
30
30
|
}}
|
|
31
31
|
data-id="${builderProps?.uid}"
|
|
32
32
|
role="presentation"
|
|
33
|
-
class="${cls('gp-group/image', builderProps?.uid, advanced?.cssClass
|
|
33
|
+
class="${cls('gp-group/image', builderProps?.uid, advanced?.cssClass)}"
|
|
34
34
|
style="${{
|
|
35
35
|
...style,
|
|
36
36
|
...makeStyleResponsive('ta', styles?.align)
|
|
@@ -72,8 +72,7 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
|
|
|
72
72
|
aspectRatio: getAspectRatioGlobalSize(styles?.shape),
|
|
73
73
|
layout: styles?.objectFit,
|
|
74
74
|
priority: setting?.priority,
|
|
75
|
-
|
|
76
|
-
pageContext
|
|
75
|
+
enableLazyloadImage
|
|
77
76
|
}) : NextImage({
|
|
78
77
|
...setting?.image,
|
|
79
78
|
priority: setting?.priority,
|
|
@@ -102,8 +101,7 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
|
|
|
102
101
|
layout: styles?.objectFit
|
|
103
102
|
},
|
|
104
103
|
isNotLazyload,
|
|
105
|
-
|
|
106
|
-
pageContext
|
|
104
|
+
enableLazyloadImage
|
|
107
105
|
})}
|
|
108
106
|
</${WrapLink}>
|
|
109
107
|
</div>`;
|
|
@@ -3,7 +3,7 @@ import { getNewBackupFileKey, getImageSrc, getSrcSet } from '../helpers/getSrcSe
|
|
|
3
3
|
import { DEVICES } from '../../product/components/ProductVariants/index.js';
|
|
4
4
|
import { createBlurDataURL } from './helpers.js';
|
|
5
5
|
|
|
6
|
-
const NextImage = ({ setting, src = 'https://ucarecdn.com/465c7cbb-f087-4d1d-8f08-f6665179f02f/-/format/auto/-/quality/lighter/placeholder-1.png', srcIsLiquidCode, alt = 'Alt image', width = 2237, height = 1678, backupFileKey, backupFilePath, storage, style, priority, vw, className, base64, baseSrc, isDisableAspectStyle, isDisableObjectFit, customAttrs, customLazyload, isNotLazyload,
|
|
6
|
+
const NextImage = ({ setting, src = 'https://ucarecdn.com/465c7cbb-f087-4d1d-8f08-f6665179f02f/-/format/auto/-/quality/lighter/placeholder-1.png', srcIsLiquidCode, alt = 'Alt image', width = 2237, height = 1678, backupFileKey, backupFilePath, storage, style, priority, vw, className, base64, baseSrc, isDisableAspectStyle, isDisableObjectFit, customAttrs, customLazyload, isNotLazyload, enableLazyloadImage = true, srcset, sizes, ...props })=>{
|
|
7
7
|
const { aspectRatio, layout, qualityPercent, qualityType } = setting ?? {};
|
|
8
8
|
const newBackupFilekey = backupFileKey ? getNewBackupFileKey(backupFileKey ?? '', src) : '';
|
|
9
9
|
const srcImage = srcIsLiquidCode ? baseSrc : getImageSrc({
|
|
@@ -93,13 +93,12 @@ const NextImage = ({ setting, src = 'https://ucarecdn.com/465c7cbb-f087-4d1d-8f0
|
|
|
93
93
|
${customAttrs}
|
|
94
94
|
draggable="false"
|
|
95
95
|
class="${cls(className, {
|
|
96
|
-
gp_lazyload: !customLazyload &&
|
|
97
|
-
gp_force_load: pageContext?.isOptimizePlan
|
|
96
|
+
gp_lazyload: !customLazyload && enableLazyloadImage
|
|
98
97
|
})}"
|
|
99
98
|
${{
|
|
100
99
|
'data-src': srcImage,
|
|
101
100
|
'data-srcset': srcSetImg,
|
|
102
|
-
src:
|
|
101
|
+
src: enableLazyloadImage ? imagePlaceholder : srcImage,
|
|
103
102
|
width,
|
|
104
103
|
height,
|
|
105
104
|
alt,
|
|
@@ -7,7 +7,7 @@ import { getSettingPreloadData } from '../../helpers.js';
|
|
|
7
7
|
import { styleLazyPlaceholder } from './common/helpers.js';
|
|
8
8
|
|
|
9
9
|
const CompareImage = (props)=>{
|
|
10
|
-
const { handle = null, handleSize = 40, hover = false, leftImage, leftImageAlt = '', leftImageTitle = '', leftImageCss = {}, leftImageLabel = null, onSliderPositionChange, rightImage, rightImageAlt = '', rightImageTitle = '', rightImageCss = {}, rightImageLabel = null, sliderLineColor = '#ffffff', sliderLineWidth = 2, sliderPositionPercentage = 0.5, vertical = false, enableLabel = false, componentUid = '', styles, advanced, builderData, preload = false,
|
|
10
|
+
const { handle = null, handleSize = 40, hover = false, leftImage, leftImageAlt = '', leftImageTitle = '', leftImageCss = {}, leftImageLabel = null, onSliderPositionChange, rightImage, rightImageAlt = '', rightImageTitle = '', rightImageCss = {}, rightImageLabel = null, sliderLineColor = '#ffffff', sliderLineWidth = 2, sliderPositionPercentage = 0.5, vertical = false, enableLabel = false, componentUid = '', styles, advanced, builderData, preload = false, pageContext, translate } = props;
|
|
11
11
|
const horizontal = !vertical;
|
|
12
12
|
const leftRatio = (leftImage?.width ?? 0) / (leftImage?.height ?? 1);
|
|
13
13
|
const rightRatio = (rightImage?.width ?? 0) / (rightImage?.height ?? 1);
|
|
@@ -267,9 +267,7 @@ const CompareImage = (props)=>{
|
|
|
267
267
|
style: {
|
|
268
268
|
...initStyles.rightImage,
|
|
269
269
|
...makeStyleResponsive('objf', styles?.imageScale)
|
|
270
|
-
}
|
|
271
|
-
enableLazyLoadImage,
|
|
272
|
-
pageContext
|
|
270
|
+
}
|
|
273
271
|
})}
|
|
274
272
|
${NextImage({
|
|
275
273
|
customAttrs: {
|
|
@@ -285,9 +283,7 @@ const CompareImage = (props)=>{
|
|
|
285
283
|
style: {
|
|
286
284
|
...initStyles.rightImage,
|
|
287
285
|
...makeStyleResponsive('objf', styles?.imageScale)
|
|
288
|
-
}
|
|
289
|
-
enableLazyLoadImage,
|
|
290
|
-
pageContext
|
|
286
|
+
}
|
|
291
287
|
})}
|
|
292
288
|
<div id="image-comparison-slider-${componentUid}" style="${{
|
|
293
289
|
...initStyles.slider
|
package/dist/esm/index.js
CHANGED
|
@@ -218,8 +218,8 @@ export { default as BfSizeChartSizeGuide } from './third-party/components/BfSize
|
|
|
218
218
|
export { default as AlsoBoughtCbb } from './third-party/components/AlsoBoughtCbb.js';
|
|
219
219
|
export { default as HextomFreeShippingBar } from './third-party/components/HextomFreeShippingBar.js';
|
|
220
220
|
export { default as EcoboostifyShoppableReelUgc } from './third-party/components/EcoboostifyShoppableReelUgc.js';
|
|
221
|
-
export { default as EcomsendBackInStockAlert } from './third-party/components/EcomsendBackInStockAlert.js';
|
|
222
221
|
export { default as AppstleBundlesDiscounts } from './third-party/components/AppstleBundlesDiscounts.js';
|
|
222
|
+
export { default as EcomsendBackInStockAlert } from './third-party/components/EcomsendBackInStockAlert.js';
|
|
223
223
|
export { default as thirdPartyInstantSetting } from './third-party-instant/setting/index.js';
|
|
224
224
|
export { default as InstantJudgemeReviews } from './third-party-instant/components/InstantJudgemeReviews.js';
|
|
225
225
|
export { default as InstantLooxReviews } from './third-party-instant/components/InstantLooxReviews.js';
|
package/dist/esm/index.liquid.js
CHANGED
|
@@ -173,8 +173,8 @@ export { default as BfSizeChartSizeGuide } from './third-party/components/BfSize
|
|
|
173
173
|
export { default as AlsoBoughtCbb } from './third-party/components/AlsoBoughtCbb.liquid.js';
|
|
174
174
|
export { default as HextomFreeShippingBar } from './third-party/components/HextomFreeShippingBar.liquid.js';
|
|
175
175
|
export { default as EcoboostifyShoppableReelUgc } from './third-party/components/EcoboostifyShoppableReelUgc.liquid.js';
|
|
176
|
-
export { default as EcomsendBackInStockAlert } from './third-party/components/EcomsendBackInStockAlert.liquid.js';
|
|
177
176
|
export { default as AppstleBundlesDiscounts } from './third-party/components/AppstleBundlesDiscounts.liquid.js';
|
|
177
|
+
export { default as EcomsendBackInStockAlert } from './third-party/components/EcomsendBackInStockAlert.liquid.js';
|
|
178
178
|
export { default as ImageComparison } from './image-comparison/components/ImageComparison.liquid.js';
|
|
179
179
|
export { default as ThirdPartySlot } from './third-party-slot/components/ThirdPartySlot.liquid.js';
|
|
180
180
|
export { default as Sticky } from './sticky/components/Sticky.liquid.js';
|
|
@@ -69,7 +69,7 @@ const Marquee = ({ children, style, builderAttrs, rawChildren, advanced, ...prop
|
|
|
69
69
|
const itemMaxWidthValue = getResponsiveValueByScreen(styles?.itemMaxWidth, currentDevice);
|
|
70
70
|
return itemMaxWidthValue?.includes('%');
|
|
71
71
|
};
|
|
72
|
-
const
|
|
72
|
+
const getItemMaxWidthValueByScreen = (device)=>{
|
|
73
73
|
let value = getResponsiveValueByScreen(styles?.itemMaxWidth, device);
|
|
74
74
|
const itemWidthTypeValue = getResponsiveValueByScreen(itemWidthType, device);
|
|
75
75
|
if (itemWidthTypeValue === 'FIT_CONTENT') {
|
|
@@ -80,22 +80,25 @@ const Marquee = ({ children, style, builderAttrs, rawChildren, advanced, ...prop
|
|
|
80
80
|
}
|
|
81
81
|
return value;
|
|
82
82
|
};
|
|
83
|
+
const getMaxWidth = (device)=>{
|
|
84
|
+
return getItemMaxWidthValueByScreen(device) === 'auto' ? 'unset' : getItemMaxWidthValueByScreen(device);
|
|
85
|
+
};
|
|
83
86
|
const getWidthForWrapperItem = ()=>{
|
|
84
87
|
return {
|
|
85
88
|
...makeStyleResponsive('w', {
|
|
86
|
-
desktop:
|
|
87
|
-
tablet:
|
|
88
|
-
mobile:
|
|
89
|
+
desktop: getItemMaxWidthValueByScreen('desktop'),
|
|
90
|
+
tablet: getItemMaxWidthValueByScreen('tablet'),
|
|
91
|
+
mobile: getItemMaxWidthValueByScreen('mobile')
|
|
89
92
|
}),
|
|
90
93
|
...makeStyleResponsive('minw', {
|
|
91
|
-
desktop:
|
|
92
|
-
tablet:
|
|
93
|
-
mobile:
|
|
94
|
+
desktop: getItemMaxWidthValueByScreen('desktop'),
|
|
95
|
+
tablet: getItemMaxWidthValueByScreen('tablet'),
|
|
96
|
+
mobile: getItemMaxWidthValueByScreen('mobile')
|
|
94
97
|
}),
|
|
95
98
|
...makeStyleResponsive('maxw', {
|
|
96
|
-
desktop:
|
|
97
|
-
tablet:
|
|
98
|
-
mobile:
|
|
99
|
+
desktop: getMaxWidth('desktop'),
|
|
100
|
+
tablet: getMaxWidth('tablet'),
|
|
101
|
+
mobile: getMaxWidth('mobile')
|
|
99
102
|
})
|
|
100
103
|
};
|
|
101
104
|
};
|
|
@@ -65,7 +65,7 @@ const DropdownVariant = ({ option, optionPosition, optionNumber, variantGroup, v
|
|
|
65
65
|
children: /*#__PURE__*/ jsx("span", {
|
|
66
66
|
className: "gp-max-w-full",
|
|
67
67
|
children: /*#__PURE__*/ jsx("span", {
|
|
68
|
-
className: "gp-block gp-overflow-hidden
|
|
68
|
+
className: "gp-block gp-overflow-hidden",
|
|
69
69
|
children: label
|
|
70
70
|
})
|
|
71
71
|
})
|
|
@@ -214,7 +214,7 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
214
214
|
]);
|
|
215
215
|
const isInStock = useCurrentVariantInStock();
|
|
216
216
|
const isDisable = !isInStock || createCartLoading || addToCartLoading;
|
|
217
|
-
const label = !isInStock ?
|
|
217
|
+
const label = !isInStock ? setting?.outOfStockLabel : setting?.label;
|
|
218
218
|
if (!isInStock && isCustomOutOfStock) {
|
|
219
219
|
buttonStyles.backgroundColor = {
|
|
220
220
|
normal: oosBackground
|
|
@@ -184,22 +184,6 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
184
184
|
pageContext,
|
|
185
185
|
translate: setting?.translate
|
|
186
186
|
});
|
|
187
|
-
const labelUnavailableTranslate = getDynamicSourceLocales({
|
|
188
|
-
val: 'Unavailable',
|
|
189
|
-
uid: builderProps?.uid,
|
|
190
|
-
settingId: 'unavailableLabel',
|
|
191
|
-
isLiquid: true,
|
|
192
|
-
pageContext,
|
|
193
|
-
translate: setting?.translate ? 'unavailableLabel' : undefined
|
|
194
|
-
});
|
|
195
|
-
const labelOutOfStockTranslate = getDynamicSourceLocales({
|
|
196
|
-
val: setting?.outOfStockLabel,
|
|
197
|
-
uid: builderProps?.uid,
|
|
198
|
-
settingId: 'outOfStockLabel',
|
|
199
|
-
isLiquid: true,
|
|
200
|
-
pageContext,
|
|
201
|
-
translate: setting?.translate ? 'outOfStockLabel' : undefined
|
|
202
|
-
});
|
|
203
187
|
return template /* liquid */ `
|
|
204
188
|
{%- liquid
|
|
205
189
|
assign inventory_quantity = variant.inventory_quantity | default: 0
|
|
@@ -207,8 +191,6 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
207
191
|
<gp-product-button
|
|
208
192
|
class="gp-product-button"
|
|
209
193
|
gp-data-wrapper="true"
|
|
210
|
-
label-out-of-Stock="${pageContext?.isPreviewing ? labelOutOfStockTranslate : `{{${labelOutOfStockTranslate}}}`}"
|
|
211
|
-
label-unavailable="${pageContext?.isPreviewing ? labelUnavailableTranslate : `{{${labelUnavailableTranslate}}}`}"
|
|
212
194
|
gp-data='${JSON.stringify({
|
|
213
195
|
setting: {
|
|
214
196
|
actionEffect: setting?.actionEffect,
|
|
@@ -286,7 +268,8 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
286
268
|
'gp-data-hidden': `{% if variant.available %}true{% endif %}`
|
|
287
269
|
},
|
|
288
270
|
setting: {
|
|
289
|
-
label:
|
|
271
|
+
label: setting?.outOfStockLabel,
|
|
272
|
+
translate: setting?.translate ? 'outOfStockLabel' : undefined,
|
|
290
273
|
htmlType: 'button',
|
|
291
274
|
iconAlign: iconAlign,
|
|
292
275
|
iconSvg: iconSvg,
|
|
@@ -305,8 +288,7 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
305
288
|
}
|
|
306
289
|
},
|
|
307
290
|
pageContext,
|
|
308
|
-
nodePrice: composeNodePrice()
|
|
309
|
-
isForceValue: true
|
|
291
|
+
nodePrice: composeNodePrice()
|
|
310
292
|
})}
|
|
311
293
|
</gp-product-button>
|
|
312
294
|
${RenderIf(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-product-button.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-product-button.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
package/dist/esm/product/components/ProductImagesV2/liquid/ProductFeaturedImageCarousel.liquid.js
CHANGED
|
@@ -9,7 +9,7 @@ import NextImage from '../../../../image/components/NextImage.liquid.js';
|
|
|
9
9
|
import Video from '../../../../image/components/Video.liquid.js';
|
|
10
10
|
import { getStyleOfObject } from '../../../helpers/function.js';
|
|
11
11
|
|
|
12
|
-
const ProductFeaturedImageCarousel = ({ builderPropUID, children,
|
|
12
|
+
const ProductFeaturedImageCarousel = ({ builderPropUID, children, enableLazyloadImage, ...setting })=>{
|
|
13
13
|
const ftAspectRatio = getAspectRatio(setting.ftShape);
|
|
14
14
|
const getStyleFeaturedImageDisplay = ()=>{
|
|
15
15
|
return getDisplayStyle((device)=>![
|
|
@@ -149,7 +149,7 @@ const ProductFeaturedImageCarousel = ({ builderPropUID, children, enableLazyLoad
|
|
|
149
149
|
},
|
|
150
150
|
priority: setting?.preload,
|
|
151
151
|
className: `gp-w-full gp-h-full gp-absolute gp-top-0 gp-left-0 featured-image-only gp-cursor-pointer !gp-rounded-none ${className}`,
|
|
152
|
-
|
|
152
|
+
enableLazyloadImage
|
|
153
153
|
})}`;
|
|
154
154
|
};
|
|
155
155
|
const renderNoImage = ()=>{
|
|
@@ -167,7 +167,7 @@ const ProductFeaturedImageCarousel = ({ builderPropUID, children, enableLazyLoad
|
|
|
167
167
|
},
|
|
168
168
|
priority: setting?.preload,
|
|
169
169
|
className: `gp-w-full gp-h-full gp-absolute gp-top-0 gp-left-0 featured-image-only gp-cursor-pointer !gp-rounded-none`,
|
|
170
|
-
|
|
170
|
+
enableLazyloadImage
|
|
171
171
|
})}`;
|
|
172
172
|
};
|
|
173
173
|
const getValueFromValueContainUnit = (value)=>{
|
|
@@ -394,11 +394,10 @@ const ProductFeaturedImageCarousel = ({ builderPropUID, children, enableLazyLoad
|
|
|
394
394
|
},
|
|
395
395
|
className: `gp-w-full featured-image-only !gp-rounded-none`,
|
|
396
396
|
customLazyload: true,
|
|
397
|
-
|
|
397
|
+
enableLazyloadImage
|
|
398
398
|
})}
|
|
399
399
|
{%- endif -%}
|
|
400
|
-
|
|
401
|
-
ftShapeProductImage: setting?.ftShape
|
|
400
|
+
`
|
|
402
401
|
})}
|
|
403
402
|
`;
|
|
404
403
|
};
|
|
@@ -6,7 +6,7 @@ import { convertSpacing, getDisplayStyle, getAspectRatio, getSrcImage } from '..
|
|
|
6
6
|
import { getShapeByLayout, getSettingMinWidthForCarouselItem, getSettingWidthForCarouselItem, getMinHeightByPosition, getSliderPerShowConfig, getAllowDotConfig, getDotStyleConfig, getCarouselVerticalConfigByPosition, checkDisplayGalleryByWidth, getZoomDisplay } from '../common/productGallery.js';
|
|
7
7
|
import { getStyleOfObject } from '../../../helpers/function.js';
|
|
8
8
|
|
|
9
|
-
const ProductGalleryCarousel = ({ builderPropUID, children,
|
|
9
|
+
const ProductGalleryCarousel = ({ builderPropUID, children, enableLazyloadImage, ...setting })=>{
|
|
10
10
|
const getCarouselDisplay = ()=>{
|
|
11
11
|
const isDisplayCarousel = (type, position, device)=>{
|
|
12
12
|
const layout = getResponsiveValueByScreen(position, device);
|
|
@@ -86,7 +86,7 @@ const ProductGalleryCarousel = ({ builderPropUID, children, enableLazyLoadImage,
|
|
|
86
86
|
customLazyload: true,
|
|
87
87
|
style: style,
|
|
88
88
|
className: '!gp-rounded-none gp-w-full gp-h-full gp-absolute gp-top-0 gp-left-0 gp-cursor-pointer',
|
|
89
|
-
|
|
89
|
+
enableLazyloadImage
|
|
90
90
|
})}`;
|
|
91
91
|
};
|
|
92
92
|
const aspectRatioToPaddingBottom = ()=>{
|
|
@@ -8,7 +8,7 @@ import Model3d from '../../../../image/components/Modal3d.liquid.js';
|
|
|
8
8
|
import Video from '../../../../image/components/Video.liquid.js';
|
|
9
9
|
import HTML5Embed from '../../../../video/components/HTML5Embed.liquid.js';
|
|
10
10
|
|
|
11
|
-
const ProductGalleryGrid = ({ builderPropUID, wrapperStyle, children,
|
|
11
|
+
const ProductGalleryGrid = ({ builderPropUID, wrapperStyle, children, enableLazyloadImage, ...setting })=>{
|
|
12
12
|
const getGridDisplay = ()=>{
|
|
13
13
|
const isDisplayGrid = (type, position, device)=>{
|
|
14
14
|
const layout = getResponsiveValueByScreen(position, device);
|
|
@@ -97,7 +97,7 @@ const ProductGalleryGrid = ({ builderPropUID, wrapperStyle, children, enableLazy
|
|
|
97
97
|
style: style,
|
|
98
98
|
className: '!gp-rounded-none',
|
|
99
99
|
customLazyload: false,
|
|
100
|
-
|
|
100
|
+
enableLazyloadImage
|
|
101
101
|
})}
|
|
102
102
|
${setting?.galleryHoverEffect !== 'none' ? `<div class="${cls('zoom-element !gp-max-w-none', getZoomImageClass())}">
|
|
103
103
|
${NextImage({
|
|
@@ -111,7 +111,7 @@ const ProductGalleryGrid = ({ builderPropUID, wrapperStyle, children, enableLazy
|
|
|
111
111
|
style: style,
|
|
112
112
|
className: '!gp-rounded-none gp-w-full gp-h-full',
|
|
113
113
|
customLazyload: false,
|
|
114
|
-
|
|
114
|
+
enableLazyloadImage
|
|
115
115
|
})}
|
|
116
116
|
</div>` : ''}
|
|
117
117
|
${setting?.galleryHoverEffect == 'zoom' && setting?.galleryZoomType == 'glasses' ? `
|
|
@@ -294,7 +294,7 @@ const ProductGalleryGrid = ({ builderPropUID, wrapperStyle, children, enableLazy
|
|
|
294
294
|
},
|
|
295
295
|
className: '!gp-rounded-none',
|
|
296
296
|
customLazyload: false,
|
|
297
|
-
|
|
297
|
+
enableLazyloadImage
|
|
298
298
|
})}`;
|
|
299
299
|
};
|
|
300
300
|
return template`
|
|
@@ -7,7 +7,7 @@ import { getSettingPreloadData } from '../../../../helpers.js';
|
|
|
7
7
|
import { getShapeByLayout, sizeSettingDefaultForNewLayout } from '../common/productGallery.js';
|
|
8
8
|
|
|
9
9
|
const ProductImages = (productImageProps)=>{
|
|
10
|
-
const { setting, styles, builderProps, style, advanced, rawChildren, pageContext,
|
|
10
|
+
const { setting, styles, builderProps, style, advanced, rawChildren, pageContext, enableLazyloadImage } = productImageProps;
|
|
11
11
|
const settings = {
|
|
12
12
|
...setting,
|
|
13
13
|
...styles
|
|
@@ -112,7 +112,7 @@ const ProductImages = (productImageProps)=>{
|
|
|
112
112
|
builderPropUID: `gp-carousel-${builderProps?.uid}`,
|
|
113
113
|
...settings,
|
|
114
114
|
children: renderProductBadge(),
|
|
115
|
-
|
|
115
|
+
enableLazyloadImage
|
|
116
116
|
})}
|
|
117
117
|
${shouldSkipLiquidRenderForSingleImage(settings?.position, template`
|
|
118
118
|
<div
|
|
@@ -128,7 +128,7 @@ const ProductImages = (productImageProps)=>{
|
|
|
128
128
|
${ProductGalleryCarousel({
|
|
129
129
|
builderPropUID: `gp-gallery-${builderProps?.uid}`,
|
|
130
130
|
...settings,
|
|
131
|
-
|
|
131
|
+
enableLazyloadImage
|
|
132
132
|
})}
|
|
133
133
|
</div>
|
|
134
134
|
${ProductGalleryGrid({
|
|
@@ -138,7 +138,7 @@ const ProductImages = (productImageProps)=>{
|
|
|
138
138
|
},
|
|
139
139
|
children: renderProductBadge(),
|
|
140
140
|
...settings,
|
|
141
|
-
|
|
141
|
+
enableLazyloadImage
|
|
142
142
|
})}
|
|
143
143
|
`)}
|
|
144
144
|
</div>
|
|
@@ -38,7 +38,7 @@ const renderCombineVariants = (isSoldOutMark, hasPreSelected, enablePrice)=>{
|
|
|
38
38
|
`}`;
|
|
39
39
|
};
|
|
40
40
|
const renderBlankOption = (hasPreSelected, blankText)=>{
|
|
41
|
-
return !hasPreSelected ? `<option value="blank" selected>${blankText
|
|
41
|
+
return !hasPreSelected ? `<option value="blank" selected>${blankText ?? getStaticLocale('ProductVariants', 'please_select')}</option>` : '';
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
export { renderBlankOption, renderCombineVariants };
|
|
@@ -814,7 +814,7 @@ const config = {
|
|
|
814
814
|
options: {
|
|
815
815
|
tooltip: {
|
|
816
816
|
icon: 'info-line-16',
|
|
817
|
-
content: 'Note: this might not work properly on Safari for iOS versions below
|
|
817
|
+
content: 'Note: this might not work properly on Safari for iOS versions below 17',
|
|
818
818
|
iconClass: 'text-[#757575] hover:text-[#F9F9F9]'
|
|
819
819
|
}
|
|
820
820
|
},
|