@gem-sdk/components 2.1.19 → 2.1.21
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/ArticleList.js +1 -1
- package/dist/cjs/banner/components/hero-banner/index.liquid.js +9 -7
- package/dist/cjs/banner/components/hero-banner/utils/index.js +5 -3
- package/dist/cjs/form/components/textarea/TextArea.liquid.js +2 -2
- package/dist/cjs/image/components/Image.js +0 -1
- package/dist/cjs/image/components/Image.liquid.js +0 -1
- package/dist/cjs/marquee/components/MarqueeBase.liquid.js +7 -26
- package/dist/cjs/post-purchase/product/components/ProductDiscountTag.js +5 -2
- package/dist/cjs/post-purchase/product/components/ProductOffer.js +16 -3
- package/dist/cjs/post-purchase/product/components/ProductPrice.js +3 -1
- package/dist/cjs/post-purchase/product/components/ProductPriceBreakdown.js +9 -21
- package/dist/cjs/post-purchase/product/constants/ProductOfferPlaceholder.js +127 -0
- package/dist/cjs/post-purchase/product/hooks/useDynamicProduct.js +28 -0
- package/dist/cjs/post-purchase/product/settings/ProductOffer.js +26 -0
- package/dist/cjs/product/components/ProductImagesV2/jsx/components/ProductFeaturedImageCarousel.js +12 -4
- package/dist/cjs/product/setting/ProductButton.js +1 -1
- package/dist/cjs/sticky/setting/preset-config.js +2 -2
- package/dist/cjs/third-party/components/NotifyBackInStockPreOrder.js +1 -1
- package/dist/cjs/third-party/components/ShopifySubscriptions.liquid.js +3 -2
- package/dist/cjs/third-party/setting/NotifyBackInStockPreOrder.js +2 -2
- package/dist/cjs/third-party/setting/ShopifySubscriptions.js +22 -0
- package/dist/esm/article/components/ArticleList.js +1 -1
- package/dist/esm/banner/components/hero-banner/index.liquid.js +9 -7
- package/dist/esm/banner/components/hero-banner/utils/index.js +5 -3
- package/dist/esm/form/components/textarea/TextArea.liquid.js +2 -2
- package/dist/esm/image/components/Image.js +0 -1
- package/dist/esm/image/components/Image.liquid.js +0 -1
- package/dist/esm/marquee/components/MarqueeBase.liquid.js +7 -26
- package/dist/esm/post-purchase/product/components/ProductDiscountTag.js +5 -2
- package/dist/esm/post-purchase/product/components/ProductOffer.js +16 -3
- package/dist/esm/post-purchase/product/components/ProductPrice.js +3 -1
- package/dist/esm/post-purchase/product/components/ProductPriceBreakdown.js +9 -21
- package/dist/esm/post-purchase/product/constants/ProductOfferPlaceholder.js +125 -0
- package/dist/esm/post-purchase/product/hooks/useDynamicProduct.js +26 -0
- package/dist/esm/post-purchase/product/settings/ProductOffer.js +26 -0
- package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductFeaturedImageCarousel.js +13 -5
- package/dist/esm/product/setting/ProductButton.js +1 -1
- package/dist/esm/sticky/setting/preset-config.js +2 -2
- package/dist/esm/third-party/components/NotifyBackInStockPreOrder.js +1 -1
- package/dist/esm/third-party/components/ShopifySubscriptions.liquid.js +3 -2
- package/dist/esm/third-party/setting/NotifyBackInStockPreOrder.js +2 -2
- package/dist/esm/third-party/setting/ShopifySubscriptions.js +22 -0
- package/dist/types/index.d.ts +4 -0
- package/package.json +2 -2
|
@@ -14,7 +14,7 @@ const ArticleList = ({ styles, setting, className, children, builderProps })=>{
|
|
|
14
14
|
const { articleSetting, numberOfArticle } = setting ?? {};
|
|
15
15
|
const { articleIds, articlePickType } = articleSetting ?? {};
|
|
16
16
|
const articlesQuery = {
|
|
17
|
-
first:
|
|
17
|
+
first: articleIds?.length ?? 50,
|
|
18
18
|
where: {
|
|
19
19
|
baseIDIn: [
|
|
20
20
|
...articleSetting?.articleIds ?? []
|
|
@@ -134,6 +134,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
134
134
|
tablet: helpers$1.createBlurDataURL(srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0),
|
|
135
135
|
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
136
|
};
|
|
137
|
+
const enableLazyLoad = !setting?.preload && enableLazyloadImage;
|
|
137
138
|
const renderInnerHeroBanner = ()=>{
|
|
138
139
|
return core.template /* liquid */ `
|
|
139
140
|
<div
|
|
@@ -197,9 +198,10 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
197
198
|
'clip-path': index.getClipPath(borderBg?.width, cornerBg)
|
|
198
199
|
}}"
|
|
199
200
|
>
|
|
200
|
-
<div class="${core.cls('hero-banner-bg-parallax gp-hero-banner-image-background
|
|
201
|
+
<div class="${core.cls('hero-banner-bg-parallax gp-hero-banner-image-background', {
|
|
201
202
|
'gp-duration-[var(--duration)] group-hover/hero:gp-scale-[var(--scale)]': hoverEffect,
|
|
202
|
-
'gp-transition-transform': hoverEffect
|
|
203
|
+
'gp-transition-transform': hoverEffect,
|
|
204
|
+
gp_lazybg: enableLazyLoad
|
|
203
205
|
})}"
|
|
204
206
|
style="${{
|
|
205
207
|
...core.getStyleBackgroundByDevice(background, {
|
|
@@ -208,9 +210,9 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
208
210
|
liquid: true
|
|
209
211
|
}),
|
|
210
212
|
...core.makeStyleResponsive('bgi', {
|
|
211
|
-
desktop: `url('${bgiEnableByDevice['desktop'] ?
|
|
212
|
-
tablet: `url('${bgiEnableByDevice['tablet'] ?
|
|
213
|
-
mobile: `url('${bgiEnableByDevice['mobile'] ?
|
|
213
|
+
desktop: `url('${bgiEnableByDevice['desktop'] ? !enableLazyLoad ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, 'desktop'), 'desktop') : imagePlaceholder['desktop'] : ''}')`,
|
|
214
|
+
tablet: `url('${bgiEnableByDevice['tablet'] ? !enableLazyLoad ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, 'tablet'), 'tablet') : imagePlaceholder['tablet'] : ''}')`,
|
|
215
|
+
mobile: `url('${bgiEnableByDevice['mobile'] ? !enableLazyLoad ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, 'mobile'), 'mobile') : imagePlaceholder['mobile'] : ''}')`
|
|
214
216
|
}),
|
|
215
217
|
'--duration': `${hoverEffectDuration ?? 0}s`,
|
|
216
218
|
'--scale': hoverEffectScale ?? 1,
|
|
@@ -218,6 +220,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
218
220
|
...index.getStyleHeroBannerBg(backgroundResponsive || {}, enableParallax)
|
|
219
221
|
}}"
|
|
220
222
|
>
|
|
223
|
+
${embed()}
|
|
221
224
|
${!setting?.preload ? getSrcSet.DEVICES.map((device)=>{
|
|
222
225
|
return core.RenderIf(getEnableBgImageByDevice(device), NextImage_liquid.default({
|
|
223
226
|
src: getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, device), device),
|
|
@@ -227,8 +230,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
227
230
|
enableLazyloadImage
|
|
228
231
|
}));
|
|
229
232
|
}).join('') : ''}
|
|
230
|
-
</div>
|
|
231
|
-
${embed()} </div>
|
|
233
|
+
</div></div>
|
|
232
234
|
</div>
|
|
233
235
|
${core.RenderIf(overlayEnable, core.template`<div
|
|
234
236
|
aria-label="Overlay"
|
|
@@ -27,13 +27,14 @@ const getHeightHeroBanner = (background, enableParallax)=>{
|
|
|
27
27
|
'tablet'
|
|
28
28
|
];
|
|
29
29
|
DEVICES.forEach((device)=>{
|
|
30
|
+
const enableParallaxDevice = background?.[device]?.type === 'image' ? enableParallax : false;
|
|
30
31
|
const isScale = isScaleImage({
|
|
31
|
-
enableParallax,
|
|
32
|
+
enableParallax: enableParallaxDevice,
|
|
32
33
|
attachment: background[device]?.attachment
|
|
33
34
|
});
|
|
34
35
|
result = {
|
|
35
36
|
...result,
|
|
36
|
-
[device]:
|
|
37
|
+
[device]: enableParallaxDevice ? '150%' : isScale ? '100vh' : '100%'
|
|
37
38
|
};
|
|
38
39
|
});
|
|
39
40
|
return core.makeStyleResponsive('h', result);
|
|
@@ -46,8 +47,9 @@ const getWidthHeroBanner = (background, enableParallax)=>{
|
|
|
46
47
|
'tablet'
|
|
47
48
|
];
|
|
48
49
|
DEVICES.forEach((device)=>{
|
|
50
|
+
const enableParallaxDevice = background?.[device]?.type === 'image' ? enableParallax : false;
|
|
49
51
|
const isScale = isScaleImage({
|
|
50
|
-
enableParallax,
|
|
52
|
+
enableParallax: enableParallaxDevice,
|
|
51
53
|
attachment: background[device]?.attachment
|
|
52
54
|
});
|
|
53
55
|
result = {
|
|
@@ -6,10 +6,10 @@ var core = require('@gem-sdk/core');
|
|
|
6
6
|
var helpers = require('../../../helpers.js');
|
|
7
7
|
|
|
8
8
|
const FormTextarea = ({ setting, builderProps, className, builderAttrs, advanced, pageContext })=>{
|
|
9
|
-
const { text, name, placeholder, required, width, fullWidth, typography } = setting ?? {};
|
|
9
|
+
const { text, name, placeholder, required, width, fullWidth, typography, translate } = setting ?? {};
|
|
10
10
|
const textAreaWidth = core.makeStyleResponsive('w', core.makeWidth(width, fullWidth));
|
|
11
11
|
const defaultName = name === '' || name === undefined ? 'contact[note]' : name;
|
|
12
|
-
const { border, rounded, hasBoxShadow, boxShadow, pos, d, op, right, top, left, bottom, z, margin, padding
|
|
12
|
+
const { border, rounded, hasBoxShadow, boxShadow, pos, d, op, right, top, left, bottom, z, margin, padding } = advanced ?? {};
|
|
13
13
|
const spacingSetting = advanced?.['spacing-setting'];
|
|
14
14
|
const inputStyle = core.composeAdvanceStyle({
|
|
15
15
|
border,
|
|
@@ -80,7 +80,6 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
|
|
|
80
80
|
style: {
|
|
81
81
|
...core.getStyleShadowState(styles?.boxShadowImg, 'box-shadow', styles?.hasBoxShadowImg),
|
|
82
82
|
borderRadius: 'inherit',
|
|
83
|
-
overflow: 'hidden',
|
|
84
83
|
...core.makeStyleResponsive('jc', styles?.align)
|
|
85
84
|
},
|
|
86
85
|
children: [
|
|
@@ -50,7 +50,6 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
|
|
|
50
50
|
style="${{
|
|
51
51
|
...core.getStyleShadowState(styles?.boxShadowImg, 'box-shadow', styles?.hasBoxShadowImg),
|
|
52
52
|
'border-radius': 'inherit',
|
|
53
|
-
overflow: 'hidden',
|
|
54
53
|
...core.makeStyleResponsive('jc', styles?.align)
|
|
55
54
|
}}"
|
|
56
55
|
>
|
|
@@ -46,7 +46,6 @@ const MarqueeBase = ({ style = {}, autoFill = false, play = true, pauseOnHover =
|
|
|
46
46
|
};
|
|
47
47
|
return core.template`
|
|
48
48
|
<div
|
|
49
|
-
|
|
50
49
|
style="${containerStyle()}"
|
|
51
50
|
class="rfm-marquee-container"
|
|
52
51
|
>
|
|
@@ -55,35 +54,17 @@ const MarqueeBase = ({ style = {}, autoFill = false, play = true, pauseOnHover =
|
|
|
55
54
|
style="${marqueeStyle()}"
|
|
56
55
|
>
|
|
57
56
|
<div class="rfm-initial-child-container">
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
`}
|
|
64
|
-
</div>
|
|
65
|
-
<div class="rfm-child-placeholder">
|
|
66
|
-
${core.template`
|
|
67
|
-
<div style="${childStyle()}" class="${`rfm-child`}">
|
|
68
|
-
${children}
|
|
69
|
-
</div>
|
|
70
|
-
`}
|
|
71
|
-
</div>
|
|
72
|
-
<div class="rfm-child-placeholder">
|
|
73
|
-
|
|
74
|
-
${core.template`
|
|
75
|
-
<div style="${childStyle()}" class="${`rfm-child`}">
|
|
76
|
-
${children}
|
|
77
|
-
</div>
|
|
78
|
-
`}
|
|
57
|
+
${core.template`
|
|
58
|
+
<div style="${childStyle()}" class="${`rfm-child`}">
|
|
59
|
+
${children}
|
|
60
|
+
</div>
|
|
61
|
+
`}
|
|
79
62
|
</div>
|
|
80
63
|
</div>
|
|
81
|
-
|
|
64
|
+
<div
|
|
82
65
|
class="rfm-marquee placeholder-marquee"
|
|
83
66
|
style="${marqueeStyle()}"
|
|
84
|
-
>
|
|
85
|
-
|
|
86
|
-
</div>
|
|
67
|
+
></div>
|
|
87
68
|
</div>
|
|
88
69
|
`;
|
|
89
70
|
};
|
|
@@ -5,26 +5,29 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var core = require('@gem-sdk/core');
|
|
7
7
|
var Text = require('../../text/Text.js');
|
|
8
|
+
var useDynamicProduct = require('../hooks/useDynamicProduct.js');
|
|
8
9
|
|
|
9
10
|
const PostPurchaseProductDiscountTag = ({ setting = {}, styles = {}, style, builderAttrs, builderProps, children })=>{
|
|
10
11
|
const currentProduct = core.useProduct();
|
|
11
12
|
const currentProductId = currentProduct?.baseID?.replace('gid://shopify/Product/', '');
|
|
12
13
|
const currentOfferDiscount = core.useProductOfferDiscount();
|
|
14
|
+
const { isDynamicProduct, isEnableDynamicDiscount } = useDynamicProduct.useDynamicProduct();
|
|
13
15
|
const { typo } = styles;
|
|
14
16
|
const { message } = setting;
|
|
17
|
+
const hasDiscount = !!currentOfferDiscount || isDynamicProduct && isEnableDynamicDiscount;
|
|
15
18
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
16
19
|
...builderAttrs,
|
|
17
20
|
className: core.cls(builderProps?.uid, 'gp-flex gp-w-full'),
|
|
18
21
|
style: {
|
|
19
22
|
...style,
|
|
20
|
-
opacity:
|
|
23
|
+
opacity: hasDiscount ? 1 : 0.2
|
|
21
24
|
},
|
|
22
25
|
id: `shopify-text-element-${builderProps?.uid}`,
|
|
23
26
|
"data-product-id": currentProductId,
|
|
24
27
|
children: [
|
|
25
28
|
/*#__PURE__*/ jsxRuntime.jsx(Text.default, {
|
|
26
29
|
setting: {
|
|
27
|
-
text:
|
|
30
|
+
text: hasDiscount ? message : message?.replace(new RegExp(/\{\{Discount\}\}/, 'gi'), '0%')
|
|
28
31
|
},
|
|
29
32
|
styles: {
|
|
30
33
|
typo
|
|
@@ -11,14 +11,20 @@ var Loading = require('../../../common/components/Loading.js');
|
|
|
11
11
|
var ProductVariant = require('./ProductVariant.js');
|
|
12
12
|
var helper = require('../../utils/helper.js');
|
|
13
13
|
var index = require('../helpers/index.js');
|
|
14
|
+
var ProductOfferPlaceholder = require('../constants/ProductOfferPlaceholder.js');
|
|
15
|
+
var useDynamicProduct = require('../hooks/useDynamicProduct.js');
|
|
14
16
|
|
|
15
17
|
const PostPurchaseProductOffer = ({ styles, builderAttrs, builderProps, children, setting })=>{
|
|
16
18
|
const mode = core.useEditorMode();
|
|
17
|
-
const { productSetting, productOfferLayout, inlineAlignment, ...rowSetting } = setting || {};
|
|
19
|
+
const { productSetting, productOfferLayout, inlineAlignment, discountAndShippingFee, ...rowSetting } = setting || {};
|
|
18
20
|
const { productOfferColumnGap, productOfferVerticalGutter, productOfferWidth, ...rowStyles } = styles || {};
|
|
19
21
|
const productOffers = core.usePageStore((s)=>s.productOffers);
|
|
20
22
|
const publicStoreFrontData = core.usePageStore((s)=>s.publicStoreFrontData);
|
|
21
|
-
const
|
|
23
|
+
const { isDynamicProduct } = useDynamicProduct.useDynamicProduct();
|
|
24
|
+
const dynamicDiscountOffer = core.usePageStore((s)=>s.dynamicDiscountOffer);
|
|
25
|
+
const totalProduct = React.useMemo(()=>isDynamicProduct ? dynamicDiscountOffer?.appliedProductCount : productOffers?.length, [
|
|
26
|
+
dynamicDiscountOffer?.appliedProductCount,
|
|
27
|
+
isDynamicProduct,
|
|
22
28
|
productOffers?.length
|
|
23
29
|
]);
|
|
24
30
|
const sortedProductBaseIDs = React.useMemo(()=>{
|
|
@@ -44,7 +50,14 @@ const PostPurchaseProductOffer = ({ styles, builderAttrs, builderProps, children
|
|
|
44
50
|
const products = React.useMemo(()=>core.flattenConnection(productData.data?.products), [
|
|
45
51
|
productData.data?.products
|
|
46
52
|
]);
|
|
47
|
-
const productSortedById =
|
|
53
|
+
const productSortedById = React.useMemo(()=>{
|
|
54
|
+
return isDynamicProduct && dynamicDiscountOffer?.appliedProductCount ? Array(dynamicDiscountOffer.appliedProductCount).fill(ProductOfferPlaceholder.productOfferPlaceholder) : sortedProductBaseIDs?.map((id)=>products?.find((el)=>el?.baseID === id)).filter(Boolean);
|
|
55
|
+
}, [
|
|
56
|
+
isDynamicProduct,
|
|
57
|
+
dynamicDiscountOffer?.appliedProductCount,
|
|
58
|
+
sortedProductBaseIDs,
|
|
59
|
+
products
|
|
60
|
+
]);
|
|
48
61
|
const getStyles = ()=>{
|
|
49
62
|
return {
|
|
50
63
|
...core.makeStyleResponsive('cg', productOfferColumnGap),
|
|
@@ -6,6 +6,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var core = require('@gem-sdk/core');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var Text = require('../../text/Text.js');
|
|
9
|
+
var useDynamicProduct = require('../hooks/useDynamicProduct.js');
|
|
9
10
|
|
|
10
11
|
const PostPurchaseProductPrice = ({ styles, style, builderAttrs, builderProps, children })=>{
|
|
11
12
|
const currentVariant = core.useCurrentVariant();
|
|
@@ -13,6 +14,7 @@ const PostPurchaseProductPrice = ({ styles, style, builderAttrs, builderProps, c
|
|
|
13
14
|
const price = currentVariant?.price ?? 0;
|
|
14
15
|
const salePrice = currentVariant?.salePrice ?? 0;
|
|
15
16
|
const discount = parseFloat(core.shopifyPriceRounding(core.useProductOfferDiscount(), 2));
|
|
17
|
+
const { isDynamicProduct } = useDynamicProduct.useDynamicProduct();
|
|
16
18
|
const priceShow = React.useMemo(()=>{
|
|
17
19
|
if (!discount) {
|
|
18
20
|
if (styles?.priceType === 'compare') {
|
|
@@ -53,7 +55,7 @@ const PostPurchaseProductPrice = ({ styles, style, builderAttrs, builderProps, c
|
|
|
53
55
|
/*#__PURE__*/ jsxRuntime.jsx(Text.default, {
|
|
54
56
|
styles: styles,
|
|
55
57
|
setting: {
|
|
56
|
-
text: moneyFormatted
|
|
58
|
+
text: isDynamicProduct ? '$???' : moneyFormatted
|
|
57
59
|
},
|
|
58
60
|
className: core.cls({
|
|
59
61
|
'gp-money': styles?.priceType === 'regular',
|
|
@@ -7,6 +7,7 @@ var core = require('@gem-sdk/core');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var helper = require('../../utils/helper.js');
|
|
9
9
|
var MoneyLine = require('./priceBreakdown/MoneyLine.js');
|
|
10
|
+
var useDynamicProduct = require('../hooks/useDynamicProduct.js');
|
|
10
11
|
|
|
11
12
|
const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, builderAttrs, builderProps, children })=>{
|
|
12
13
|
const currentVariant = core.useCurrentVariant();
|
|
@@ -21,6 +22,7 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
|
|
|
21
22
|
const discountShopifyFormat = core.shopifyPriceRounding(discountWithQuantity, 2);
|
|
22
23
|
const totalMoneyFormatted = core.useFormatMoney(subTotal - parseFloat(discountShopifyFormat), false);
|
|
23
24
|
const currentProductId = currentProduct?.baseID?.replace('gid://shopify/Product/', '');
|
|
25
|
+
const { isDynamicProduct, dynamicPrice, dynamicDiscount, isEnableDynamicDiscount } = useDynamicProduct.useDynamicProduct();
|
|
24
26
|
const { labelStyle, moneyStyle, spacing, width, align, isShowPrice } = styles;
|
|
25
27
|
const itemGap = React.useMemo(()=>{
|
|
26
28
|
return helper.postPurchaseSpacing[spacing || 'none'];
|
|
@@ -33,19 +35,19 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
|
|
|
33
35
|
}, [
|
|
34
36
|
isShowPrice
|
|
35
37
|
]);
|
|
36
|
-
const
|
|
38
|
+
const getMoneyLines = ()=>{
|
|
37
39
|
const data = [];
|
|
38
40
|
if (styles.isShowSubTotalLabel !== false) {
|
|
39
41
|
data.push({
|
|
40
42
|
title: setting.subTotalLabel,
|
|
41
|
-
money: subTotalMoneyFormatted,
|
|
43
|
+
money: isDynamicProduct ? dynamicPrice : subTotalMoneyFormatted,
|
|
42
44
|
uniqueId: 'subTotalLabel'
|
|
43
45
|
});
|
|
44
46
|
}
|
|
45
47
|
if (styles.isShowDiscountLabel !== false) {
|
|
46
48
|
data.push({
|
|
47
49
|
title: setting.discountLabel,
|
|
48
|
-
money: discount > 0 ? discountMoneyFormatted : 'No discount',
|
|
50
|
+
money: isDynamicProduct && dynamicDiscount && isEnableDynamicDiscount ? dynamicPrice : discount > 0 ? discountMoneyFormatted : 'No discount',
|
|
49
51
|
uniqueId: 'discountLabel'
|
|
50
52
|
});
|
|
51
53
|
}
|
|
@@ -71,25 +73,11 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
|
|
|
71
73
|
}
|
|
72
74
|
data.push({
|
|
73
75
|
title: setting.totalLabel,
|
|
74
|
-
money: totalMoneyFormatted,
|
|
76
|
+
money: isDynamicProduct ? dynamicPrice : totalMoneyFormatted,
|
|
75
77
|
uniqueId: 'totalLabel'
|
|
76
78
|
});
|
|
77
79
|
return data;
|
|
78
|
-
}
|
|
79
|
-
discount,
|
|
80
|
-
discountMoneyFormatted,
|
|
81
|
-
setting.discountLabel,
|
|
82
|
-
setting.shippingLabel,
|
|
83
|
-
setting.subTotalLabel,
|
|
84
|
-
setting.taxesLabel,
|
|
85
|
-
setting.totalLabel,
|
|
86
|
-
styles.isShowSubTotalLabel,
|
|
87
|
-
styles.isShowDiscountLabel,
|
|
88
|
-
styles.isShowShippingLabel,
|
|
89
|
-
styles.isShowTaxesLabel,
|
|
90
|
-
subTotalMoneyFormatted,
|
|
91
|
-
totalMoneyFormatted
|
|
92
|
-
]);
|
|
80
|
+
};
|
|
93
81
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
94
82
|
children: [
|
|
95
83
|
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
@@ -140,9 +128,9 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
|
|
|
140
128
|
...core.makeStyleResponsive('w', width),
|
|
141
129
|
gap: itemGap
|
|
142
130
|
},
|
|
143
|
-
children:
|
|
131
|
+
children: getMoneyLines().map((item)=>/*#__PURE__*/ jsxRuntime.jsxs(React.Fragment, {
|
|
144
132
|
children: [
|
|
145
|
-
item.uniqueId === 'totalLabel' &&
|
|
133
|
+
item.uniqueId === 'totalLabel' && getMoneyLines().length > 1 && /*#__PURE__*/ jsxRuntime.jsx("hr", {}),
|
|
146
134
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
147
135
|
children: /*#__PURE__*/ jsxRuntime.jsx(MoneyLine.default, {
|
|
148
136
|
uniqueId: item.uniqueId,
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const productOfferPlaceholder = {
|
|
4
|
+
id: '',
|
|
5
|
+
title: 'Dynamic product',
|
|
6
|
+
description: 'This is a dynamic product. The actual product will appear here based on your setup',
|
|
7
|
+
descriptionHtml: '<p class="QN2lPu">This is a dynamic product. The actual product will</p>\n<p class="QN2lPu">appear here based on your setup</p>',
|
|
8
|
+
createdAt: '2024-07-01T04:19:51.286753Z',
|
|
9
|
+
handle: 'dynamic-product',
|
|
10
|
+
averageRating: 0,
|
|
11
|
+
isStorefront: true,
|
|
12
|
+
isSample: false,
|
|
13
|
+
baseID: '',
|
|
14
|
+
sku: '',
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
id: '1',
|
|
18
|
+
name: 'Variant',
|
|
19
|
+
optionType: '',
|
|
20
|
+
values: [
|
|
21
|
+
{
|
|
22
|
+
id: '1',
|
|
23
|
+
label: 'Variant option',
|
|
24
|
+
isDefault: true,
|
|
25
|
+
baseID: '1'
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
vendor: '',
|
|
31
|
+
featuredImage: {
|
|
32
|
+
id: '542178560626918105',
|
|
33
|
+
contentType: 'IMAGE',
|
|
34
|
+
previewImage: '',
|
|
35
|
+
src: 'https://cdn.shopify.com/s/files/1/0858/3168/0279/files/gempages_502328832959710176-312cf60c-d923-4913-9873-66545effe9cc.png',
|
|
36
|
+
width: 449,
|
|
37
|
+
height: 449,
|
|
38
|
+
alt: ''
|
|
39
|
+
},
|
|
40
|
+
collections: {
|
|
41
|
+
edges: [
|
|
42
|
+
{
|
|
43
|
+
node: {
|
|
44
|
+
id: '502321959132988135',
|
|
45
|
+
title: 'Home page'
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
node: {
|
|
50
|
+
id: '539286505089204764',
|
|
51
|
+
title: 'b'
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
node: {
|
|
56
|
+
id: '539286505089401372',
|
|
57
|
+
title: 'e'
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
tags: [],
|
|
63
|
+
medias: {
|
|
64
|
+
edges: [
|
|
65
|
+
{
|
|
66
|
+
cursor: 'gqFpzweGNIc/AALZoXYB',
|
|
67
|
+
node: {
|
|
68
|
+
id: '542178560626918105',
|
|
69
|
+
contentType: 'IMAGE',
|
|
70
|
+
previewImage: '',
|
|
71
|
+
src: 'https://cdn.shopify.com/s/files/1/0858/3168/0279/files/gempages_502328832959710176-312cf60c-d923-4913-9873-66545effe9cc.png',
|
|
72
|
+
width: 449,
|
|
73
|
+
height: 449,
|
|
74
|
+
alt: ''
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
pageInfo: {
|
|
79
|
+
endCursor: 'gqFpzweGNIc/AALZoXYB',
|
|
80
|
+
hasNextPage: true
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
variants: {
|
|
84
|
+
edges: [
|
|
85
|
+
{
|
|
86
|
+
cursor: 'gqFpzwc5ZqRtDAMIoXYC',
|
|
87
|
+
node: {
|
|
88
|
+
id: '520560088328176392',
|
|
89
|
+
title: 'Default Title',
|
|
90
|
+
barcode: '',
|
|
91
|
+
baseID: 'gid://shopify/ProductVariant/49298248925463',
|
|
92
|
+
costPrice: 88,
|
|
93
|
+
height: 0,
|
|
94
|
+
inventoryPolicy: 'DENY',
|
|
95
|
+
inventoryQuantity: 211,
|
|
96
|
+
inventoryStatus: '',
|
|
97
|
+
isDigital: true,
|
|
98
|
+
length: 0,
|
|
99
|
+
lowInventoryAmount: 0,
|
|
100
|
+
manageInventory: false,
|
|
101
|
+
mediaId: '0',
|
|
102
|
+
platform: 'SHOPIFY',
|
|
103
|
+
price: 88,
|
|
104
|
+
salePrice: 88,
|
|
105
|
+
sku: '',
|
|
106
|
+
soldIndividually: false,
|
|
107
|
+
weight: 0,
|
|
108
|
+
width: 0,
|
|
109
|
+
selectedOptions: [
|
|
110
|
+
{
|
|
111
|
+
name: 'Variant',
|
|
112
|
+
value: 'Variant option',
|
|
113
|
+
optionType: ''
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
media: undefined
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
pageInfo: {
|
|
121
|
+
hasNextPage: false,
|
|
122
|
+
endCursor: 'gaFpzwc5ZqRtDAMI'
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
exports.productOfferPlaceholder = productOfferPlaceholder;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
const useDynamicProduct = ()=>{
|
|
7
|
+
const dynamicDiscountOffer = core.usePageStore((s)=>s.dynamicDiscountOffer);
|
|
8
|
+
const isDynamicProduct = React.useMemo(()=>{
|
|
9
|
+
return !!dynamicDiscountOffer;
|
|
10
|
+
}, [
|
|
11
|
+
dynamicDiscountOffer
|
|
12
|
+
]);
|
|
13
|
+
// false = No discount
|
|
14
|
+
const isEnableDynamicDiscount = React.useMemo(()=>{
|
|
15
|
+
return dynamicDiscountOffer?.isEnabled;
|
|
16
|
+
}, [
|
|
17
|
+
dynamicDiscountOffer
|
|
18
|
+
]);
|
|
19
|
+
const dynamicPrice = '$???';
|
|
20
|
+
return {
|
|
21
|
+
isDynamicProduct,
|
|
22
|
+
dynamicPrice,
|
|
23
|
+
dynamicDiscount: dynamicDiscountOffer,
|
|
24
|
+
isEnableDynamicDiscount
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.useDynamicProduct = useDynamicProduct;
|
|
@@ -184,6 +184,14 @@ const config = {
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
},
|
|
187
|
+
{
|
|
188
|
+
id: 'dynamicOfferQuantity',
|
|
189
|
+
type: 'dynamic-offer-quantity',
|
|
190
|
+
min: 1,
|
|
191
|
+
max: 4,
|
|
192
|
+
default: 2,
|
|
193
|
+
isOnlyAcceptInteger: true
|
|
194
|
+
},
|
|
187
195
|
{
|
|
188
196
|
id: 'discountAndShippingFee',
|
|
189
197
|
type: 'discount-and-shipping-fee-product-offer',
|
|
@@ -377,6 +385,24 @@ const config = {
|
|
|
377
385
|
},
|
|
378
386
|
layout: 'vertical'
|
|
379
387
|
},
|
|
388
|
+
{
|
|
389
|
+
type: 'group',
|
|
390
|
+
label: {
|
|
391
|
+
en: 'Product offers'
|
|
392
|
+
},
|
|
393
|
+
controls: [
|
|
394
|
+
{
|
|
395
|
+
type: 'control',
|
|
396
|
+
label: {
|
|
397
|
+
en: 'Quantity'
|
|
398
|
+
},
|
|
399
|
+
setting: {
|
|
400
|
+
id: 'dynamicOfferQuantity'
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
],
|
|
404
|
+
condition: 'false'
|
|
405
|
+
},
|
|
380
406
|
{
|
|
381
407
|
type: 'control',
|
|
382
408
|
label: {
|
package/dist/cjs/product/components/ProductImagesV2/jsx/components/ProductFeaturedImageCarousel.js
CHANGED
|
@@ -20,12 +20,20 @@ const ProductFeaturedImageCarousel = ({ productImages, imgRef, onHandleClick, on
|
|
|
20
20
|
const { onListener, ref } = core.useInteraction();
|
|
21
21
|
let delayTimeout;
|
|
22
22
|
const mode = core.useEditorMode();
|
|
23
|
-
const
|
|
23
|
+
const getImageActiveIndex = React.useCallback(()=>{
|
|
24
24
|
const index = productImages?.findIndex((item)=>item.id === featuredImageGlobal?.id);
|
|
25
|
-
return index;
|
|
25
|
+
return index ?? 0;
|
|
26
26
|
}, [
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
featuredImageGlobal?.id,
|
|
28
|
+
productImages
|
|
29
|
+
]);
|
|
30
|
+
const [imageActiveIndex, setImageActiveIndex] = React.useState(getImageActiveIndex());
|
|
31
|
+
React.useEffect(()=>{
|
|
32
|
+
setImageActiveIndex(getImageActiveIndex());
|
|
33
|
+
}, [
|
|
34
|
+
featuredImageGlobal,
|
|
35
|
+
getImageActiveIndex,
|
|
36
|
+
productImages
|
|
29
37
|
]);
|
|
30
38
|
const imageActive = React.useMemo(()=>{
|
|
31
39
|
if (productImages?.length) return featuredImageGlobal || productImages?.[0];
|
|
@@ -761,7 +761,7 @@ const StickyPreset = {
|
|
|
761
761
|
settings: {
|
|
762
762
|
label: 'Add to cart',
|
|
763
763
|
outOfStockLabel: 'Out of stock',
|
|
764
|
-
actionEffect: '
|
|
764
|
+
actionEffect: 'open-cart-drawer',
|
|
765
765
|
customURL: {
|
|
766
766
|
link: '/cart',
|
|
767
767
|
target: '_self'
|
|
@@ -1856,7 +1856,7 @@ const StickyPresetProduct = {
|
|
|
1856
1856
|
settings: {
|
|
1857
1857
|
label: 'Add to cart',
|
|
1858
1858
|
outOfStockLabel: 'Out of stock',
|
|
1859
|
-
actionEffect: '
|
|
1859
|
+
actionEffect: 'open-cart-drawer',
|
|
1860
1860
|
customURL: {
|
|
1861
1861
|
link: '/cart',
|
|
1862
1862
|
target: '_self'
|
|
@@ -9,7 +9,7 @@ var ThirdPartyPreview = require('./ThirdPartyPreview.js');
|
|
|
9
9
|
const AppConfig = {
|
|
10
10
|
id: 'notify-back-in-stockpreorder',
|
|
11
11
|
label: 'Notify! Back in Stock|PreOrder',
|
|
12
|
-
logoUrl: 'https://cdn.shopify.com/
|
|
12
|
+
logoUrl: 'https://cdn.shopify.com/s/files/1/0643/0497/1949/files/Notify_Me_Logo.png?v=1736234550',
|
|
13
13
|
tag: 'NotifyBackInStockPreOrder'
|
|
14
14
|
};
|
|
15
15
|
const NotifyBackInStockPreOrderContent = ()=>{
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var core = require('@gem-sdk/core');
|
|
6
|
+
var thirdParty = require('../helpers/thirdParty.js');
|
|
6
7
|
|
|
7
8
|
const ShopifySubscriptions = ({ setting, advanced })=>{
|
|
8
|
-
const { align } = setting ?? {};
|
|
9
|
-
return core.template`
|
|
9
|
+
const { align, widgetType, appBlockId } = setting ?? {};
|
|
10
|
+
return widgetType === 'app-block' ? thirdParty.getLiquidForAppBlock(appBlockId, align, `${advanced?.cssClass ?? ''} !gp-block`) : core.template`
|
|
10
11
|
<div
|
|
11
12
|
class="${advanced?.cssClass}"
|
|
12
13
|
style="${{
|
|
@@ -7,7 +7,7 @@ var NotifyBackInStockPreOrder = require('../components/NotifyBackInStockPreOrder
|
|
|
7
7
|
const config = {
|
|
8
8
|
tag: NotifyBackInStockPreOrder.AppConfig.tag,
|
|
9
9
|
label: NotifyBackInStockPreOrder.AppConfig.label,
|
|
10
|
-
icon:
|
|
10
|
+
icon: `<img class="gp-w-[24px] gp-border gp-border-[#494949] gp-rounded-[3px]" src="${NotifyBackInStockPreOrder.AppConfig.logoUrl}">`,
|
|
11
11
|
editorConfigs: {
|
|
12
12
|
placeholder: {
|
|
13
13
|
flowTag: [
|
|
@@ -27,7 +27,7 @@ const config = {
|
|
|
27
27
|
hideTextContent: true,
|
|
28
28
|
icon: {
|
|
29
29
|
desktop: `<div class="w-full flex flex-col items-center">
|
|
30
|
-
<img class="w-24 border border-dark-200 rounded-medium" src="
|
|
30
|
+
<img class="w-24 border border-dark-200 rounded-medium" src="${NotifyBackInStockPreOrder.AppConfig.logoUrl}">
|
|
31
31
|
<span class="preset-item-title">Notify! Back in Stock|PreOrder</span>
|
|
32
32
|
</div>`
|
|
33
33
|
},
|