@gem-sdk/components 2.1.43 → 2.2.0-staging.29
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 +2 -1
- package/dist/cjs/banner/components/hero-banner/index.liquid.js +4 -7
- package/dist/cjs/builder.js +4 -0
- package/dist/cjs/button/components/Button.liquid.js +3 -3
- package/dist/cjs/carousel/components/Carousel.liquid.js +3 -2
- package/dist/cjs/carousel/components/plugins/AutoPlayPlugin.js +17 -58
- package/dist/cjs/common/const.js +1 -1
- package/dist/cjs/helpers.js +6 -1
- package/dist/cjs/image/components/AdaptiveImage.js +13 -16
- package/dist/cjs/image/components/AdaptiveImage.liquid.js +6 -5
- package/dist/cjs/image/components/Image.js +2 -1
- package/dist/cjs/image/components/Image.liquid.js +6 -4
- package/dist/cjs/image/components/NextImage.liquid.js +4 -3
- package/dist/cjs/image-comparison/components/CompareImage.liquid.js +7 -3
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/index.liquid.js +4 -0
- package/dist/cjs/marquee/components/Marquee.liquid.js +10 -13
- 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 +21 -3
- package/dist/cjs/product/components/ProductImagesV2/liquid/ProductFeaturedImageCarousel.liquid.js +6 -5
- 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 +13 -9
- package/dist/cjs/text/components/Text.js +0 -1
- package/dist/cjs/third-party/components/AppstleBundlesDiscounts.js +32 -0
- package/dist/cjs/third-party/components/AppstleBundlesDiscounts.liquid.js +12 -0
- package/dist/cjs/third-party/components/Bogos/BogosSampleContent.js +9 -10
- package/dist/cjs/third-party/components/EcomsendBackInStockAlert.js +32 -0
- package/dist/cjs/third-party/components/EcomsendBackInStockAlert.liquid.js +21 -0
- package/dist/cjs/third-party/components/RechargeSubscriptions.liquid.js +1 -1
- package/dist/cjs/third-party/components/Releasit.liquid.js +4 -2
- package/dist/cjs/third-party/configs/AppstleBundlesDiscounts.js +12 -0
- 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/configs/EcomsendBackInStockAlert.js +12 -0
- package/dist/cjs/third-party/next.js +10 -0
- package/dist/cjs/third-party/setting/AppstleBundlesDiscounts.js +146 -0
- package/dist/cjs/third-party/setting/EcoboostifyShoppableReelUgc.js +2 -2
- package/dist/cjs/third-party/setting/EcomsendBackInStockAlert.js +128 -0
- package/dist/cjs/third-party/setting/Releasit.js +59 -2
- package/dist/cjs/third-party/setting/index.js +5 -1
- package/dist/cjs/video/components/HTML5Embed.js +2 -2
- package/dist/cjs/video/components/HTML5Embed.liquid.js +6 -3
- package/dist/cjs/video/components/LiteYouTubeEmbed.liquid.js +5 -3
- package/dist/esm/article/components/ArticleImage.js +2 -1
- package/dist/esm/banner/components/hero-banner/index.liquid.js +4 -7
- package/dist/esm/builder.js +4 -0
- package/dist/esm/button/components/Button.liquid.js +3 -3
- package/dist/esm/carousel/components/Carousel.liquid.js +3 -2
- package/dist/esm/carousel/components/plugins/AutoPlayPlugin.js +17 -58
- package/dist/esm/common/const.js +1 -1
- package/dist/esm/helpers.js +6 -1
- package/dist/esm/image/components/AdaptiveImage.js +13 -16
- package/dist/esm/image/components/AdaptiveImage.liquid.js +6 -5
- package/dist/esm/image/components/Image.js +3 -2
- package/dist/esm/image/components/Image.liquid.js +6 -4
- package/dist/esm/image/components/NextImage.liquid.js +4 -3
- package/dist/esm/image-comparison/components/CompareImage.liquid.js +7 -3
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.liquid.js +2 -0
- package/dist/esm/marquee/components/Marquee.liquid.js +10 -13
- 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 +21 -3
- package/dist/esm/product/components/ProductImagesV2/liquid/ProductFeaturedImageCarousel.liquid.js +6 -5
- 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 +14 -10
- package/dist/esm/text/components/Text.js +0 -1
- package/dist/esm/third-party/components/AppstleBundlesDiscounts.js +28 -0
- package/dist/esm/third-party/components/AppstleBundlesDiscounts.liquid.js +8 -0
- package/dist/esm/third-party/components/Bogos/BogosSampleContent.js +10 -11
- package/dist/esm/third-party/components/EcomsendBackInStockAlert.js +28 -0
- package/dist/esm/third-party/components/EcomsendBackInStockAlert.liquid.js +17 -0
- package/dist/esm/third-party/components/RechargeSubscriptions.liquid.js +1 -1
- package/dist/esm/third-party/components/Releasit.liquid.js +4 -2
- package/dist/esm/third-party/configs/AppstleBundlesDiscounts.js +8 -0
- 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/configs/EcomsendBackInStockAlert.js +8 -0
- package/dist/esm/third-party/next.js +10 -0
- package/dist/esm/third-party/setting/AppstleBundlesDiscounts.js +142 -0
- package/dist/esm/third-party/setting/EcoboostifyShoppableReelUgc.js +2 -2
- package/dist/esm/third-party/setting/EcomsendBackInStockAlert.js +124 -0
- package/dist/esm/third-party/setting/Releasit.js +59 -2
- package/dist/esm/third-party/setting/index.js +5 -1
- package/dist/esm/video/components/HTML5Embed.js +2 -2
- package/dist/esm/video/components/HTML5Embed.liquid.js +6 -3
- package/dist/esm/video/components/LiteYouTubeEmbed.liquid.js +5 -3
- package/dist/types/index.d.ts +54 -8
- package/package.json +3 -3
|
@@ -14,7 +14,7 @@ var NextImage_liquid = require('../../../image/components/NextImage.liquid.js');
|
|
|
14
14
|
var getSrcSet = require('../../../image/helpers/getSrcSet.js');
|
|
15
15
|
var helpers$1 = require('../../../image/components/helpers.js');
|
|
16
16
|
|
|
17
|
-
const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, children, rawChildren, advanced,
|
|
17
|
+
const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, children, rawChildren, advanced, enableLazyLoadImage = true })=>{
|
|
18
18
|
const { link, layout, verticalAlign, order, alignBanner, alt, title } = setting ?? {};
|
|
19
19
|
const { background, overlayEnable, overlayColor, overlayOpacity, verticalGutter, contentWidth, hoverEffect, hoverEffectDuration, hoverEffectScale, cornerBg, borderBg, hasActiveShadow, shadowBg, sizeSetting, contentPadding } = styles ?? {};
|
|
20
20
|
const enableParallax = setting?.enableParallax || false;
|
|
@@ -43,9 +43,6 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
43
43
|
} else if (data.videoType === 'html5') {
|
|
44
44
|
delete data.video;
|
|
45
45
|
}
|
|
46
|
-
if (data.type !== 'image') {
|
|
47
|
-
delete data.image;
|
|
48
|
-
}
|
|
49
46
|
}
|
|
50
47
|
return background;
|
|
51
48
|
};
|
|
@@ -134,7 +131,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
134
131
|
tablet: helpers$1.createBlurDataURL(srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0),
|
|
135
132
|
mobile: helpers$1.createBlurDataURL(srcSet?.mobile?.width ?? srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.mobile?.height ?? srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0)
|
|
136
133
|
};
|
|
137
|
-
const enableLazyLoad = !setting?.preload &&
|
|
134
|
+
const enableLazyLoad = !setting?.preload && enableLazyLoadImage;
|
|
138
135
|
const renderInnerHeroBanner = ()=>{
|
|
139
136
|
return core.template /* liquid */ `
|
|
140
137
|
<div
|
|
@@ -184,7 +181,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
184
181
|
alt,
|
|
185
182
|
title,
|
|
186
183
|
imagePlaceholder,
|
|
187
|
-
|
|
184
|
+
enableLazyLoadImage
|
|
188
185
|
})}
|
|
189
186
|
<div class="${core.cls('gp-absolute gp-w-full gp-h-full')}">
|
|
190
187
|
<div
|
|
@@ -227,7 +224,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
227
224
|
alt: `lazy image ${device}`,
|
|
228
225
|
className: `gp-absolute gp-top-0 gp-invisible gp-w-full gp_lazyload gp-h-full gp_lazyforbg ${device === 'tablet' ? 'gp_lazybg_tl' : ''} ${device === 'mobile' ? 'gp_lazybg_mb' : ''}`,
|
|
229
226
|
isDisableAspectStyle: true,
|
|
230
|
-
|
|
227
|
+
enableLazyLoadImage
|
|
231
228
|
}));
|
|
232
229
|
}).join('') : ''}
|
|
233
230
|
</div></div>
|
package/dist/cjs/builder.js
CHANGED
|
@@ -124,6 +124,8 @@ var BfSizeChartSizeGuide = require('./third-party/components/BfSizeChartSizeGuid
|
|
|
124
124
|
var AlsoBoughtCbb = require('./third-party/components/AlsoBoughtCbb.js');
|
|
125
125
|
var HextomFreeShippingBar = require('./third-party/components/HextomFreeShippingBar.js');
|
|
126
126
|
var EcoboostifyShoppableReelUgc = require('./third-party/components/EcoboostifyShoppableReelUgc.js');
|
|
127
|
+
var EcomsendBackInStockAlert = require('./third-party/components/EcomsendBackInStockAlert.js');
|
|
128
|
+
var AppstleBundlesDiscounts = require('./third-party/components/AppstleBundlesDiscounts.js');
|
|
127
129
|
var CartLineVariant = require('./cart/components/CartLineVariant.js');
|
|
128
130
|
var Cart = require('./cart/components/Cart.js');
|
|
129
131
|
var CartList = require('./cart/components/CartList.js');
|
|
@@ -258,6 +260,8 @@ var PostPurchaseCountdownTimer = require('./post-purchase/countdown-timer/compon
|
|
|
258
260
|
var Text$1 = require('./post-purchase/text/Text.js');
|
|
259
261
|
|
|
260
262
|
var builder = {
|
|
263
|
+
AppstleBundlesDiscounts: AppstleBundlesDiscounts.default,
|
|
264
|
+
EcomsendBackInStockAlert: EcomsendBackInStockAlert.default,
|
|
261
265
|
EstimatedDeliveryDatePlus: EstimatedDeliveryDatePlus.default,
|
|
262
266
|
OkendoReviewsLoyalty: OkendoReviewsLoyalty.default,
|
|
263
267
|
EssentialAnnouncementBar: EssentialAnnouncementBar.default,
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var core = require('@gem-sdk/core');
|
|
6
6
|
var helpers = require('../../helpers.js');
|
|
7
7
|
|
|
8
|
-
const Button = ({ className, builderProps, customAttrs, pageContext, setting = {}, styles = {}, style, wrapClassName = '', advanced, nodePrice, dataId })=>{
|
|
8
|
+
const Button = ({ className, builderProps, customAttrs, pageContext, setting = {}, styles = {}, style, wrapClassName = '', advanced, nodePrice, dataId, isForceValue = false })=>{
|
|
9
9
|
const { align, size, backgroundColor, textColor, roundedBtn, iconSpacing, globalSize } = styles;
|
|
10
10
|
const { label, iconSvg, btnLink, htmlType, disabled, loading, iconAlign, iconVisible, translate, disabledLoading = true } = setting;
|
|
11
11
|
const [wrapStyle, restStyle] = core.splitStyle([
|
|
@@ -70,7 +70,7 @@ const Button = ({ className, builderProps, customAttrs, pageContext, setting = {
|
|
|
70
70
|
color: ${core.getSingleColorVariable(styles?.textColor?.hover)};
|
|
71
71
|
}
|
|
72
72
|
`;
|
|
73
|
-
const labelValDisplay = helpers.getDynamicSourceLocales({
|
|
73
|
+
const labelValDisplay = isForceValue ? label : helpers.getDynamicSourceLocales({
|
|
74
74
|
val: label,
|
|
75
75
|
uid: builderProps?.uidTranslate ?? builderProps?.uid,
|
|
76
76
|
settingId: translate ?? 'label',
|
|
@@ -161,7 +161,7 @@ const Button = ({ className, builderProps, customAttrs, pageContext, setting = {
|
|
|
161
161
|
>${iconSvg}</span>`)}
|
|
162
162
|
<span
|
|
163
163
|
data-gp-text
|
|
164
|
-
class="${`gp-button-text-only gp-break-words group-data-[state=loading]:gp-invisible [&_p]:gp-whitespace-pre-line gp-z-1 gp-h-full gp-flex gp-items-center gp-overflow-hidden ${nodePrice ? appendTypoClass : ''}
|
|
164
|
+
class="${`gp-content-product-button gp-button-text-only gp-break-words group-data-[state=loading]:gp-invisible [&_p]:gp-whitespace-pre-line gp-z-1 gp-h-full gp-flex gp-items-center gp-overflow-hidden ${nodePrice ? appendTypoClass : ''}
|
|
165
165
|
${styles?.typo?.attrs?.italic ? '[&:not(:has(p))]:gp-pr-[0.2em] [&_p]:[&:has(p)]:gp-pr-[0.2em]' : ''}`}"
|
|
166
166
|
style="${{
|
|
167
167
|
...nodePrice && appendTypoStyle,
|
|
@@ -13,7 +13,7 @@ const DEVICES = [
|
|
|
13
13
|
'tablet',
|
|
14
14
|
'desktop'
|
|
15
15
|
];
|
|
16
|
-
const Carousel = ({ builderAttrs, builderProps, style, styles, moveToIdx, rootId, rootAttr, rootClass, wrapperClass, rootStyles, children, rawChildren, isHiddenArrowWhenDisabled = true, advanced, disableMarginAuto, conditionAppendJs, ...props })=>{
|
|
16
|
+
const Carousel = ({ builderAttrs, builderProps, style, styles, moveToIdx, rootId, rootAttr, rootClass, wrapperClass, rootStyles, children, rawChildren, isHiddenArrowWhenDisabled = true, advanced, disableMarginAuto, conditionAppendJs, ftShapeProductImage, ...props })=>{
|
|
17
17
|
const setting = arrow.mappingNavigationCarousel(props.setting);
|
|
18
18
|
const styleHeight = core.makeStyleResponsive('h', core.getHeightByShapeGlobalSize(styles?.sizeSetting));
|
|
19
19
|
const styleWidth = core.makeStyleWithDefault('w', core.getWidthByShapeGlobalSize(styles?.sizeSetting, true), {
|
|
@@ -112,7 +112,8 @@ const Carousel = ({ builderAttrs, builderProps, style, styles, moveToIdx, rootId
|
|
|
112
112
|
setting,
|
|
113
113
|
styles,
|
|
114
114
|
moveToIdx,
|
|
115
|
-
isHiddenArrowWhenDisabled
|
|
115
|
+
isHiddenArrowWhenDisabled,
|
|
116
|
+
ftShapeProductImage
|
|
116
117
|
}).replaceAll("'", ''')}' style="${{
|
|
117
118
|
...core.makeStyleResponsive('jc', styles?.align),
|
|
118
119
|
...rootStyles
|
|
@@ -4,41 +4,15 @@ const AutoPlayPlugin = (slider)=>{
|
|
|
4
4
|
let autoplay = slider.options.autoplay ?? {};
|
|
5
5
|
let timeout;
|
|
6
6
|
let mouseOver = false;
|
|
7
|
-
let inViewport = false;
|
|
8
|
-
let observer = null;
|
|
9
|
-
// Thêm sự kiện cho dot nếu có
|
|
10
|
-
const $dots = slider?.container?.closest('[data-component-type="component"]')?.querySelector('.carousel-dots');
|
|
11
|
-
// Callback của IntersectionObserver
|
|
12
|
-
function handleIntersection(entries) {
|
|
13
|
-
entries.forEach((entry)=>{
|
|
14
|
-
// Với threshold 0, chỉ cần một phần bất kỳ hiển thị sẽ đánh dấu isIntersecting
|
|
15
|
-
inViewport = entry.isIntersecting;
|
|
16
|
-
if (inViewport) {
|
|
17
|
-
nextTimeout();
|
|
18
|
-
} else {
|
|
19
|
-
clearNextTimeout();
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
function initIntersectionObserver() {
|
|
24
|
-
// Nếu đã có observer hoặc không có container thì không khởi tạo lại
|
|
25
|
-
if (observer || !slider.container) return;
|
|
26
|
-
observer = new IntersectionObserver(handleIntersection, {
|
|
27
|
-
root: null,
|
|
28
|
-
threshold: 0
|
|
29
|
-
});
|
|
30
|
-
observer.observe(slider.container);
|
|
31
|
-
}
|
|
32
7
|
function clearNextTimeout() {
|
|
33
8
|
clearTimeout(timeout);
|
|
34
9
|
}
|
|
35
10
|
function nextTimeout() {
|
|
36
|
-
|
|
11
|
+
clearTimeout(timeout);
|
|
37
12
|
timeout = setTimeout(()=>{
|
|
38
|
-
|
|
39
|
-
if (mouseOver || !autoplay.enable || !inViewport) return;
|
|
13
|
+
if (mouseOver || !autoplay.enable) return;
|
|
40
14
|
slider.next();
|
|
41
|
-
}, autoplay
|
|
15
|
+
}, autoplay?.delay ?? 2000);
|
|
42
16
|
}
|
|
43
17
|
function onMouseOver() {
|
|
44
18
|
mouseOver = true;
|
|
@@ -49,15 +23,11 @@ const AutoPlayPlugin = (slider)=>{
|
|
|
49
23
|
nextTimeout();
|
|
50
24
|
}
|
|
51
25
|
slider.on('created', ()=>{
|
|
52
|
-
|
|
53
|
-
$dots?.addEventListener('mouseout', onMouseOut);
|
|
54
|
-
// Nếu tùy chọn pauseOnHover bật thì thêm sự kiện hover cho container slider
|
|
55
|
-
if (autoplay.pauseOnHover && slider.container) {
|
|
26
|
+
if (autoplay.pauseOnHover) {
|
|
56
27
|
slider.container.addEventListener('mouseover', onMouseOver);
|
|
57
28
|
slider.container.addEventListener('mouseout', onMouseOut);
|
|
58
29
|
}
|
|
59
|
-
if (autoplay
|
|
60
|
-
initIntersectionObserver();
|
|
30
|
+
if (slider.options.autoplay?.enable) {
|
|
61
31
|
nextTimeout();
|
|
62
32
|
}
|
|
63
33
|
});
|
|
@@ -65,40 +35,29 @@ const AutoPlayPlugin = (slider)=>{
|
|
|
65
35
|
slider.on('animationEnded', nextTimeout);
|
|
66
36
|
slider.on('updated', (newOptions)=>{
|
|
67
37
|
autoplay = newOptions.options?.autoplay ?? {};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
38
|
+
nextTimeout();
|
|
39
|
+
});
|
|
40
|
+
slider.on('destroyed', ()=>{
|
|
41
|
+
slider.container.removeEventListener('mouseover', onMouseOver);
|
|
42
|
+
slider.container.removeEventListener('mouseout', onMouseOut);
|
|
72
43
|
});
|
|
73
44
|
slider.on('optionsChanged', (newOptions)=>{
|
|
74
|
-
|
|
45
|
+
const $dots = slider?.container?.closest('[data-component-type="component"]')?.querySelector('.carousel-dots');
|
|
46
|
+
$dots?.addEventListener('mouseover', onMouseOver);
|
|
47
|
+
$dots?.addEventListener('mouseout', onMouseOut);
|
|
48
|
+
if (newOptions.options.autoplay?.pauseOnHover !== autoplay.pauseOnHover) {
|
|
75
49
|
if (newOptions.options.autoplay?.pauseOnHover) {
|
|
76
50
|
slider.container.addEventListener('mouseover', onMouseOver);
|
|
77
51
|
slider.container.addEventListener('mouseout', onMouseOut);
|
|
78
|
-
}
|
|
52
|
+
}
|
|
53
|
+
if (!newOptions.options.autoplay?.pauseOnHover) {
|
|
79
54
|
slider.container.removeEventListener('mouseover', onMouseOver);
|
|
80
55
|
slider.container.removeEventListener('mouseout', onMouseOut);
|
|
81
56
|
mouseOver = false;
|
|
82
57
|
}
|
|
83
58
|
}
|
|
59
|
+
nextTimeout();
|
|
84
60
|
autoplay = newOptions.options.autoplay ?? {};
|
|
85
|
-
if (autoplay.enable) {
|
|
86
|
-
initIntersectionObserver();
|
|
87
|
-
nextTimeout();
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
slider.on('destroyed', ()=>{
|
|
91
|
-
if (slider.container) {
|
|
92
|
-
slider.container.removeEventListener('mouseover', onMouseOver);
|
|
93
|
-
slider.container.removeEventListener('mouseout', onMouseOut);
|
|
94
|
-
}
|
|
95
|
-
$dots?.removeEventListener('mouseover', onMouseOver);
|
|
96
|
-
$dots?.removeEventListener('mouseout', onMouseOut);
|
|
97
|
-
clearNextTimeout();
|
|
98
|
-
if (observer) {
|
|
99
|
-
observer.disconnect();
|
|
100
|
-
observer = null;
|
|
101
|
-
}
|
|
102
61
|
});
|
|
103
62
|
};
|
|
104
63
|
|
package/dist/cjs/common/const.js
CHANGED
package/dist/cjs/helpers.js
CHANGED
|
@@ -58,6 +58,10 @@ const getStaticLocale = (tag, key)=>{
|
|
|
58
58
|
const getSettingPreloadData = (disabledValue, enabledValue)=>{
|
|
59
59
|
return `{% if section.settings.section_preload == "false" %}${disabledValue} ${enabledValue ? `{% else %}${enabledValue}` : ''}{% endif %}`;
|
|
60
60
|
};
|
|
61
|
+
const getHttpUrl = (link)=>{
|
|
62
|
+
if (!link) return '';
|
|
63
|
+
return link.match(/^https?:\/\//i) ? link : `http://${link}`;
|
|
64
|
+
};
|
|
61
65
|
const getInsertLinkData = (defaultWrap, setting, htmlType)=>{
|
|
62
66
|
const URL_START_WITH = [
|
|
63
67
|
'#',
|
|
@@ -70,7 +74,7 @@ const getInsertLinkData = (defaultWrap, setting, htmlType)=>{
|
|
|
70
74
|
const isHyperlink = setting?.link !== undefined && setting.link !== '';
|
|
71
75
|
let urlHref = setting?.link ?? '';
|
|
72
76
|
const isHomePageHref = urlHref === '/';
|
|
73
|
-
const regexHttp = new RegExp(/^https
|
|
77
|
+
const regexHttp = new RegExp(/^(?:https?:\/\/)?[\w.-]+\.[a-z]{2,}/i);
|
|
74
78
|
const regexPageType = new RegExp(/^\/?(?:collections|pages|products|blogs|checkout|cart)\/?/i);
|
|
75
79
|
const isShopifyDomain = isHyperlink && !regexHttp.test(urlHref) && regexPageType.test(urlHref);
|
|
76
80
|
const isDomain = isHyperlink && regexHttp.test(urlHref);
|
|
@@ -81,6 +85,7 @@ const getInsertLinkData = (defaultWrap, setting, htmlType)=>{
|
|
|
81
85
|
urlHref = "{{ request.origin }}{{ routes.root_url | split: '/' | join: '/' }}" + urlHref;
|
|
82
86
|
}
|
|
83
87
|
}
|
|
88
|
+
if (isDomain) urlHref = getHttpUrl(urlHref);
|
|
84
89
|
const isLink = ()=>{
|
|
85
90
|
if (URL_START_WITH.find((el)=>urlHref.startsWith(el))) return true;
|
|
86
91
|
if (URL_INCLUDES.find((el)=>urlHref.includes(el))) return true;
|
|
@@ -5,29 +5,26 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var Head = require('next/head');
|
|
7
7
|
var Img = require('./Img.js');
|
|
8
|
+
var React = require('react');
|
|
9
|
+
var getSrcSet = require('../helpers/getSrcSet.js');
|
|
8
10
|
|
|
9
11
|
const AdaptiveImage = ({ srcSet, priority, pictureClass, imagePlaceholder, ...rest })=>{
|
|
10
12
|
const fallBackImage = 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif';
|
|
13
|
+
const imageLinkList = React.useMemo(()=>{
|
|
14
|
+
if (!priority) return [];
|
|
15
|
+
return Array.from(new Set(getSrcSet.DEVICES.map((device)=>srcSet?.[device]?.src).filter(Boolean)));
|
|
16
|
+
}, [
|
|
17
|
+
srcSet,
|
|
18
|
+
priority
|
|
19
|
+
]);
|
|
11
20
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
12
21
|
children: [
|
|
13
|
-
/*#__PURE__*/ jsxRuntime.
|
|
14
|
-
children:
|
|
15
|
-
!!srcSet?.desktop?.src && /*#__PURE__*/ jsxRuntime.jsx("link", {
|
|
22
|
+
imageLinkList.length > 0 && /*#__PURE__*/ jsxRuntime.jsx(Head, {
|
|
23
|
+
children: imageLinkList.map((link)=>/*#__PURE__*/ jsxRuntime.jsx("link", {
|
|
16
24
|
rel: "preload",
|
|
17
|
-
href:
|
|
25
|
+
href: link,
|
|
18
26
|
as: "image"
|
|
19
|
-
})
|
|
20
|
-
!!srcSet?.tablet?.src && /*#__PURE__*/ jsxRuntime.jsx("link", {
|
|
21
|
-
rel: "preload",
|
|
22
|
-
href: srcSet.tablet.src,
|
|
23
|
-
as: "image"
|
|
24
|
-
}),
|
|
25
|
-
!!srcSet?.mobile?.src && /*#__PURE__*/ jsxRuntime.jsx("link", {
|
|
26
|
-
rel: "preload",
|
|
27
|
-
href: srcSet.mobile.src,
|
|
28
|
-
as: "image"
|
|
29
|
-
})
|
|
30
|
-
]
|
|
27
|
+
}, link))
|
|
31
28
|
}),
|
|
32
29
|
/*#__PURE__*/ jsxRuntime.jsxs("picture", {
|
|
33
30
|
style: {
|
|
@@ -6,7 +6,7 @@ var core = require('@gem-sdk/core');
|
|
|
6
6
|
var getSrcSet = require('../helpers/getSrcSet.js');
|
|
7
7
|
var helpers = require('./helpers.js');
|
|
8
8
|
|
|
9
|
-
const AdaptiveImage = ({ srcSet, priority, alt, aspectRatio, layout, className, pictureClass, style, imagePlaceholder,
|
|
9
|
+
const AdaptiveImage = ({ srcSet, priority, alt, aspectRatio, layout, className, pictureClass, style, imagePlaceholder, enableLazyLoadImage = true, pageContext, ...props })=>{
|
|
10
10
|
const fallBackImage = 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif';
|
|
11
11
|
const srcDesktop = getSrcSet.getImageSrc(srcSet?.desktop, 'desktop') || fallBackImage;
|
|
12
12
|
const srcTablet = (getSrcSet.getImageSrc(srcSet?.tablet, 'tablet') ?? getSrcSet.getImageSrc(srcSet?.desktop, 'tablet')) || fallBackImage;
|
|
@@ -31,16 +31,17 @@ const AdaptiveImage = ({ srcSet, priority, alt, aspectRatio, layout, className,
|
|
|
31
31
|
}}"
|
|
32
32
|
/>
|
|
33
33
|
`, core.template`
|
|
34
|
-
${srcMobile ? `<source media="(max-width: 767px)" data-srcSet="${srcMobile}" srcset="${
|
|
35
|
-
${srcTablet ? `<source media="(max-width: 1024px)" data-srcSet="${srcTablet}" srcset="${
|
|
34
|
+
${srcMobile ? `<source media="(max-width: 767px)" data-srcSet="${srcMobile}" srcset="${enableLazyLoadImage ? imagePlaceholder?.['mobile'] ?? helpers.createBlurDataURL(srcSet?.mobile?.width ?? srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.mobile?.height ?? srcSet?.tablet?.height ?? srcSet?.desktop?.height ?? 0) : srcMobile}" />` : ''}
|
|
35
|
+
${srcTablet ? `<source media="(max-width: 1024px)" data-srcSet="${srcTablet}" srcset="${enableLazyLoadImage ? imagePlaceholder?.['tablet'] ?? helpers.createBlurDataURL(srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.tablet?.height ?? srcSet?.desktop?.height ?? 0) : srcTablet}" />` : ''}
|
|
36
36
|
<img
|
|
37
37
|
${{
|
|
38
38
|
...props
|
|
39
39
|
}}
|
|
40
40
|
class="${core.cls(className, {
|
|
41
|
-
gp_lazyload:
|
|
41
|
+
gp_lazyload: enableLazyLoadImage,
|
|
42
|
+
gp_force_load: pageContext?.isOptimizePlan
|
|
42
43
|
})}"
|
|
43
|
-
src="${
|
|
44
|
+
src="${enableLazyLoadImage ? imagePlaceholder?.['desktop'] ?? helpers.createBlurDataURL(srcSet?.desktop?.width ?? 0, srcSet?.desktop?.height ?? 0) : srcDesktop}"
|
|
44
45
|
data-src="${srcDesktop}"
|
|
45
46
|
width="100%"
|
|
46
47
|
alt="${alt}"
|
|
@@ -12,6 +12,7 @@ var helpers = require('./helpers.js');
|
|
|
12
12
|
const Image = ({ styles, className, setting, builderAttrs, builderProps, style, children, onClick, onLoad })=>{
|
|
13
13
|
const { image, imageLink, srcSet, isNotLazyload } = setting ?? {};
|
|
14
14
|
const { customAspectRadio } = styles ?? {};
|
|
15
|
+
core.useCurrentDevice();
|
|
15
16
|
const { shape } = styles ?? {};
|
|
16
17
|
const WrapLink = imageLink?.link ? Link.default : 'div';
|
|
17
18
|
const opacity = {
|
|
@@ -86,7 +87,7 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
|
|
|
86
87
|
setting?.isAdaptive ? /*#__PURE__*/ jsxRuntime.jsx(AdaptiveImage.default, {
|
|
87
88
|
srcSet: setting.srcSet,
|
|
88
89
|
pictureClass: "gp-contents",
|
|
89
|
-
className: core.cls(className, 'gp-w-full gp-max-w-full', core.handleConvertClassColor(styles?.borderImg)),
|
|
90
|
+
className: core.cls(className, 'gp-inline-block gp-w-full gp-max-w-full', core.handleConvertClassColor(styles?.borderImg)),
|
|
90
91
|
alt: setting.alt,
|
|
91
92
|
style: {
|
|
92
93
|
...imageWidth,
|
|
@@ -7,7 +7,7 @@ var AdaptiveImage_liquid = require('./AdaptiveImage.liquid.js');
|
|
|
7
7
|
var NextImage_liquid = require('./NextImage.liquid.js');
|
|
8
8
|
var helpers = require('../../helpers.js');
|
|
9
9
|
|
|
10
|
-
const Image = ({ styles, className, setting, builderAttrs, builderProps, style, advanced,
|
|
10
|
+
const Image = ({ styles, className, setting, builderAttrs, builderProps, style, advanced, enableLazyLoadImage = true, pageContext })=>{
|
|
11
11
|
const { imageLink, isNotLazyload } = setting ?? {};
|
|
12
12
|
const { shape } = styles ?? {};
|
|
13
13
|
const { Wrap: WrapLink, urlData } = helpers.getInsertLinkData('div', imageLink);
|
|
@@ -34,7 +34,7 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
|
|
|
34
34
|
}}
|
|
35
35
|
data-id="${builderProps?.uid}"
|
|
36
36
|
role="presentation"
|
|
37
|
-
class="${core.cls('gp-group/image', builderProps?.uid, advanced?.cssClass)}"
|
|
37
|
+
class="${core.cls('gp-group/image', builderProps?.uid, advanced?.cssClass, `force-publish-${new Date().getTime()}`)}"
|
|
38
38
|
style="${{
|
|
39
39
|
...style,
|
|
40
40
|
...core.makeStyleResponsive('ta', styles?.align)
|
|
@@ -76,7 +76,8 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
|
|
|
76
76
|
aspectRatio: core.getAspectRatioGlobalSize(styles?.shape),
|
|
77
77
|
layout: styles?.objectFit,
|
|
78
78
|
priority: setting?.priority,
|
|
79
|
-
|
|
79
|
+
enableLazyLoadImage,
|
|
80
|
+
pageContext
|
|
80
81
|
}) : NextImage_liquid.default({
|
|
81
82
|
...setting?.image,
|
|
82
83
|
priority: setting?.priority,
|
|
@@ -105,7 +106,8 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
|
|
|
105
106
|
layout: styles?.objectFit
|
|
106
107
|
},
|
|
107
108
|
isNotLazyload,
|
|
108
|
-
|
|
109
|
+
enableLazyLoadImage,
|
|
110
|
+
pageContext
|
|
109
111
|
})}
|
|
110
112
|
</${WrapLink}>
|
|
111
113
|
</div>`;
|
|
@@ -7,7 +7,7 @@ var getSrcSet = require('../helpers/getSrcSet.js');
|
|
|
7
7
|
var index = require('../../product/components/ProductVariants/index.js');
|
|
8
8
|
var helpers = require('./helpers.js');
|
|
9
9
|
|
|
10
|
-
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,
|
|
10
|
+
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, pageContext, srcset, sizes, ...props })=>{
|
|
11
11
|
const { aspectRatio, layout, qualityPercent, qualityType } = setting ?? {};
|
|
12
12
|
const newBackupFilekey = backupFileKey ? getSrcSet.getNewBackupFileKey(backupFileKey ?? '', src) : '';
|
|
13
13
|
const srcImage = srcIsLiquidCode ? baseSrc : getSrcSet.getImageSrc({
|
|
@@ -97,12 +97,13 @@ const NextImage = ({ setting, src = 'https://ucarecdn.com/465c7cbb-f087-4d1d-8f0
|
|
|
97
97
|
${customAttrs}
|
|
98
98
|
draggable="false"
|
|
99
99
|
class="${core.cls(className, {
|
|
100
|
-
gp_lazyload: !customLazyload &&
|
|
100
|
+
gp_lazyload: !customLazyload && enableLazyLoadImage,
|
|
101
|
+
gp_force_load: pageContext?.isOptimizePlan
|
|
101
102
|
})}"
|
|
102
103
|
${{
|
|
103
104
|
'data-src': srcImage,
|
|
104
105
|
'data-srcset': srcSetImg,
|
|
105
|
-
src:
|
|
106
|
+
src: enableLazyLoadImage ? imagePlaceholder : srcImage,
|
|
106
107
|
width,
|
|
107
108
|
height,
|
|
108
109
|
alt,
|
|
@@ -11,7 +11,7 @@ var helpers$1 = require('../../helpers.js');
|
|
|
11
11
|
var helpers = require('./common/helpers.js');
|
|
12
12
|
|
|
13
13
|
const CompareImage = (props)=>{
|
|
14
|
-
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;
|
|
14
|
+
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, enableLazyLoadImage, pageContext, translate } = props;
|
|
15
15
|
const horizontal = !vertical;
|
|
16
16
|
const leftRatio = (leftImage?.width ?? 0) / (leftImage?.height ?? 1);
|
|
17
17
|
const rightRatio = (rightImage?.width ?? 0) / (rightImage?.height ?? 1);
|
|
@@ -271,7 +271,9 @@ const CompareImage = (props)=>{
|
|
|
271
271
|
style: {
|
|
272
272
|
...initStyles.rightImage,
|
|
273
273
|
...core.makeStyleResponsive('objf', styles?.imageScale)
|
|
274
|
-
}
|
|
274
|
+
},
|
|
275
|
+
enableLazyLoadImage,
|
|
276
|
+
pageContext
|
|
275
277
|
})}
|
|
276
278
|
${NextImage_liquid.default({
|
|
277
279
|
customAttrs: {
|
|
@@ -287,7 +289,9 @@ const CompareImage = (props)=>{
|
|
|
287
289
|
style: {
|
|
288
290
|
...initStyles.rightImage,
|
|
289
291
|
...core.makeStyleResponsive('objf', styles?.imageScale)
|
|
290
|
-
}
|
|
292
|
+
},
|
|
293
|
+
enableLazyLoadImage,
|
|
294
|
+
pageContext
|
|
291
295
|
})}
|
|
292
296
|
<div id="image-comparison-slider-${componentUid}" style="${{
|
|
293
297
|
...initStyles.slider
|
package/dist/cjs/index.js
CHANGED
|
@@ -220,6 +220,8 @@ var BfSizeChartSizeGuide = require('./third-party/components/BfSizeChartSizeGuid
|
|
|
220
220
|
var AlsoBoughtCbb = require('./third-party/components/AlsoBoughtCbb.js');
|
|
221
221
|
var HextomFreeShippingBar = require('./third-party/components/HextomFreeShippingBar.js');
|
|
222
222
|
var EcoboostifyShoppableReelUgc = require('./third-party/components/EcoboostifyShoppableReelUgc.js');
|
|
223
|
+
var EcomsendBackInStockAlert = require('./third-party/components/EcomsendBackInStockAlert.js');
|
|
224
|
+
var AppstleBundlesDiscounts = require('./third-party/components/AppstleBundlesDiscounts.js');
|
|
223
225
|
var index$x = require('./third-party-instant/setting/index.js');
|
|
224
226
|
var InstantJudgemeReviews = require('./third-party-instant/components/InstantJudgemeReviews.js');
|
|
225
227
|
var InstantLooxReviews = require('./third-party-instant/components/InstantLooxReviews.js');
|
|
@@ -536,6 +538,8 @@ exports.BfSizeChartSizeGuide = BfSizeChartSizeGuide.default;
|
|
|
536
538
|
exports.AlsoBoughtCbb = AlsoBoughtCbb.default;
|
|
537
539
|
exports.HextomFreeShippingBar = HextomFreeShippingBar.default;
|
|
538
540
|
exports.EcoboostifyShoppableReelUgc = EcoboostifyShoppableReelUgc.default;
|
|
541
|
+
exports.EcomsendBackInStockAlert = EcomsendBackInStockAlert.default;
|
|
542
|
+
exports.AppstleBundlesDiscounts = AppstleBundlesDiscounts.default;
|
|
539
543
|
exports.thirdPartyInstantSetting = index$x.default;
|
|
540
544
|
exports.InstantJudgemeReviews = InstantJudgemeReviews.default;
|
|
541
545
|
exports.InstantLooxReviews = InstantLooxReviews.default;
|
package/dist/cjs/index.liquid.js
CHANGED
|
@@ -175,6 +175,8 @@ var BfSizeChartSizeGuide_liquid = require('./third-party/components/BfSizeChartS
|
|
|
175
175
|
var AlsoBoughtCbb_liquid = require('./third-party/components/AlsoBoughtCbb.liquid.js');
|
|
176
176
|
var HextomFreeShippingBar_liquid = require('./third-party/components/HextomFreeShippingBar.liquid.js');
|
|
177
177
|
var EcoboostifyShoppableReelUgc_liquid = require('./third-party/components/EcoboostifyShoppableReelUgc.liquid.js');
|
|
178
|
+
var EcomsendBackInStockAlert_liquid = require('./third-party/components/EcomsendBackInStockAlert.liquid.js');
|
|
179
|
+
var AppstleBundlesDiscounts_liquid = require('./third-party/components/AppstleBundlesDiscounts.liquid.js');
|
|
178
180
|
var ImageComparison_liquid = require('./image-comparison/components/ImageComparison.liquid.js');
|
|
179
181
|
var ThirdPartySlot_liquid = require('./third-party-slot/components/ThirdPartySlot.liquid.js');
|
|
180
182
|
var Sticky_liquid = require('./sticky/components/Sticky.liquid.js');
|
|
@@ -372,6 +374,8 @@ exports.BfSizeChartSizeGuide = BfSizeChartSizeGuide_liquid.default;
|
|
|
372
374
|
exports.AlsoBoughtCbb = AlsoBoughtCbb_liquid.default;
|
|
373
375
|
exports.HextomFreeShippingBar = HextomFreeShippingBar_liquid.default;
|
|
374
376
|
exports.EcoboostifyShoppableReelUgc = EcoboostifyShoppableReelUgc_liquid.default;
|
|
377
|
+
exports.EcomsendBackInStockAlert = EcomsendBackInStockAlert_liquid.default;
|
|
378
|
+
exports.AppstleBundlesDiscounts = AppstleBundlesDiscounts_liquid.default;
|
|
375
379
|
exports.ImageComparison = ImageComparison_liquid.default;
|
|
376
380
|
exports.ThirdPartySlot = ThirdPartySlot_liquid.default;
|
|
377
381
|
exports.Sticky = Sticky_liquid.default;
|
|
@@ -73,7 +73,7 @@ const Marquee = ({ children, style, builderAttrs, rawChildren, advanced, ...prop
|
|
|
73
73
|
const itemMaxWidthValue = core.getResponsiveValueByScreen(styles?.itemMaxWidth, currentDevice);
|
|
74
74
|
return itemMaxWidthValue?.includes('%');
|
|
75
75
|
};
|
|
76
|
-
const
|
|
76
|
+
const itemMaxWidthValueByScreen = (device)=>{
|
|
77
77
|
let value = core.getResponsiveValueByScreen(styles?.itemMaxWidth, device);
|
|
78
78
|
const itemWidthTypeValue = core.getResponsiveValueByScreen(itemWidthType, device);
|
|
79
79
|
if (itemWidthTypeValue === 'FIT_CONTENT') {
|
|
@@ -84,25 +84,22 @@ const Marquee = ({ children, style, builderAttrs, rawChildren, advanced, ...prop
|
|
|
84
84
|
}
|
|
85
85
|
return value;
|
|
86
86
|
};
|
|
87
|
-
const getMaxWidth = (device)=>{
|
|
88
|
-
return getItemMaxWidthValueByScreen(device) === 'auto' ? 'unset' : getItemMaxWidthValueByScreen(device);
|
|
89
|
-
};
|
|
90
87
|
const getWidthForWrapperItem = ()=>{
|
|
91
88
|
return {
|
|
92
89
|
...core.makeStyleResponsive('w', {
|
|
93
|
-
desktop:
|
|
94
|
-
tablet:
|
|
95
|
-
mobile:
|
|
90
|
+
desktop: itemMaxWidthValueByScreen('desktop'),
|
|
91
|
+
tablet: itemMaxWidthValueByScreen('tablet'),
|
|
92
|
+
mobile: itemMaxWidthValueByScreen('mobile')
|
|
96
93
|
}),
|
|
97
94
|
...core.makeStyleResponsive('minw', {
|
|
98
|
-
desktop:
|
|
99
|
-
tablet:
|
|
100
|
-
mobile:
|
|
95
|
+
desktop: itemMaxWidthValueByScreen('desktop'),
|
|
96
|
+
tablet: itemMaxWidthValueByScreen('tablet'),
|
|
97
|
+
mobile: itemMaxWidthValueByScreen('mobile')
|
|
101
98
|
}),
|
|
102
99
|
...core.makeStyleResponsive('maxw', {
|
|
103
|
-
desktop:
|
|
104
|
-
tablet:
|
|
105
|
-
mobile:
|
|
100
|
+
desktop: itemMaxWidthValueByScreen('desktop'),
|
|
101
|
+
tablet: itemMaxWidthValueByScreen('tablet'),
|
|
102
|
+
mobile: itemMaxWidthValueByScreen('mobile')
|
|
106
103
|
})
|
|
107
104
|
};
|
|
108
105
|
};
|
|
@@ -69,7 +69,7 @@ const DropdownVariant = ({ option, optionPosition, optionNumber, variantGroup, v
|
|
|
69
69
|
children: /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
70
70
|
className: "gp-max-w-full",
|
|
71
71
|
children: /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
72
|
-
className: "gp-block gp-overflow-hidden",
|
|
72
|
+
className: "gp-block gp-overflow-hidden gp-truncate",
|
|
73
73
|
children: label
|
|
74
74
|
})
|
|
75
75
|
})
|
|
@@ -218,7 +218,7 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
218
218
|
]);
|
|
219
219
|
const isInStock = core.useCurrentVariantInStock();
|
|
220
220
|
const isDisable = !isInStock || createCartLoading || addToCartLoading;
|
|
221
|
-
const label = !isInStock ? setting?.outOfStockLabel : setting?.label;
|
|
221
|
+
const label = !isInStock ? !currentVariant ? 'Unavailable' : setting?.outOfStockLabel : setting?.label;
|
|
222
222
|
if (!isInStock && isCustomOutOfStock) {
|
|
223
223
|
buttonStyles.backgroundColor = {
|
|
224
224
|
normal: oosBackground
|
|
@@ -188,6 +188,22 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
188
188
|
pageContext,
|
|
189
189
|
translate: setting?.translate
|
|
190
190
|
});
|
|
191
|
+
const labelUnavailableTranslate = helpers.getDynamicSourceLocales({
|
|
192
|
+
val: 'Unavailable',
|
|
193
|
+
uid: builderProps?.uid,
|
|
194
|
+
settingId: 'unavailableLabel',
|
|
195
|
+
isLiquid: true,
|
|
196
|
+
pageContext,
|
|
197
|
+
translate: setting?.translate ? 'unavailableLabel' : undefined
|
|
198
|
+
});
|
|
199
|
+
const labelOutOfStockTranslate = helpers.getDynamicSourceLocales({
|
|
200
|
+
val: setting?.outOfStockLabel,
|
|
201
|
+
uid: builderProps?.uid,
|
|
202
|
+
settingId: 'outOfStockLabel',
|
|
203
|
+
isLiquid: true,
|
|
204
|
+
pageContext,
|
|
205
|
+
translate: setting?.translate ? 'outOfStockLabel' : undefined
|
|
206
|
+
});
|
|
191
207
|
return core.template /* liquid */ `
|
|
192
208
|
{%- liquid
|
|
193
209
|
assign inventory_quantity = variant.inventory_quantity | default: 0
|
|
@@ -195,6 +211,8 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
195
211
|
<gp-product-button
|
|
196
212
|
class="gp-product-button"
|
|
197
213
|
gp-data-wrapper="true"
|
|
214
|
+
label-out-of-Stock="${pageContext?.isPreviewing ? labelOutOfStockTranslate : `{{${labelOutOfStockTranslate}}}`}"
|
|
215
|
+
label-unavailable="${pageContext?.isPreviewing ? labelUnavailableTranslate : `{{${labelUnavailableTranslate}}}`}"
|
|
198
216
|
gp-data='${JSON.stringify({
|
|
199
217
|
setting: {
|
|
200
218
|
actionEffect: setting?.actionEffect,
|
|
@@ -272,8 +290,7 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
272
290
|
'gp-data-hidden': `{% if variant.available %}true{% endif %}`
|
|
273
291
|
},
|
|
274
292
|
setting: {
|
|
275
|
-
label:
|
|
276
|
-
translate: setting?.translate ? 'outOfStockLabel' : undefined,
|
|
293
|
+
label: `${pageContext?.isPreviewing ? labelOutOfStockTranslate : `{{${labelOutOfStockTranslate}}}`}`,
|
|
277
294
|
htmlType: 'button',
|
|
278
295
|
iconAlign: iconAlign,
|
|
279
296
|
iconSvg: iconSvg,
|
|
@@ -292,7 +309,8 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
|
|
|
292
309
|
}
|
|
293
310
|
},
|
|
294
311
|
pageContext,
|
|
295
|
-
nodePrice: composeNodePrice()
|
|
312
|
+
nodePrice: composeNodePrice(),
|
|
313
|
+
isForceValue: true
|
|
296
314
|
})}
|
|
297
315
|
</gp-product-button>
|
|
298
316
|
${core.RenderIf(core.isLocalEnv, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-product-button.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-product-button.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|