@gem-sdk/components 2.1.20 → 2.1.22
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/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/components/Sku.js +2 -14
- package/dist/cjs/third-party/components/NotifyBackInStockPreOrder.js +1 -1
- package/dist/cjs/third-party/components/QikifyUpsell.js +22 -10
- package/dist/cjs/third-party/components/QikifyUpsell.liquid.js +3 -46
- package/dist/cjs/third-party/setting/NotifyBackInStockPreOrder.js +2 -2
- package/dist/cjs/third-party/setting/QikifyUpsell.js +11 -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/components/Sku.js +3 -15
- package/dist/esm/third-party/components/NotifyBackInStockPreOrder.js +1 -1
- package/dist/esm/third-party/components/QikifyUpsell.js +22 -10
- package/dist/esm/third-party/components/QikifyUpsell.liquid.js +3 -46
- package/dist/esm/third-party/setting/NotifyBackInStockPreOrder.js +2 -2
- package/dist/esm/third-party/setting/QikifyUpsell.js +11 -1
- package/dist/types/index.d.ts +3 -0
- package/package.json +2 -2
|
@@ -42,7 +42,6 @@ const MarqueeBase = ({ style = {}, autoFill = false, play = true, pauseOnHover =
|
|
|
42
42
|
};
|
|
43
43
|
return template`
|
|
44
44
|
<div
|
|
45
|
-
|
|
46
45
|
style="${containerStyle()}"
|
|
47
46
|
class="rfm-marquee-container"
|
|
48
47
|
>
|
|
@@ -51,35 +50,17 @@ const MarqueeBase = ({ style = {}, autoFill = false, play = true, pauseOnHover =
|
|
|
51
50
|
style="${marqueeStyle()}"
|
|
52
51
|
>
|
|
53
52
|
<div class="rfm-initial-child-container">
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
`}
|
|
60
|
-
</div>
|
|
61
|
-
<div class="rfm-child-placeholder">
|
|
62
|
-
${template`
|
|
63
|
-
<div style="${childStyle()}" class="${`rfm-child`}">
|
|
64
|
-
${children}
|
|
65
|
-
</div>
|
|
66
|
-
`}
|
|
67
|
-
</div>
|
|
68
|
-
<div class="rfm-child-placeholder">
|
|
69
|
-
|
|
70
|
-
${template`
|
|
71
|
-
<div style="${childStyle()}" class="${`rfm-child`}">
|
|
72
|
-
${children}
|
|
73
|
-
</div>
|
|
74
|
-
`}
|
|
53
|
+
${template`
|
|
54
|
+
<div style="${childStyle()}" class="${`rfm-child`}">
|
|
55
|
+
${children}
|
|
56
|
+
</div>
|
|
57
|
+
`}
|
|
75
58
|
</div>
|
|
76
59
|
</div>
|
|
77
|
-
|
|
60
|
+
<div
|
|
78
61
|
class="rfm-marquee placeholder-marquee"
|
|
79
62
|
style="${marqueeStyle()}"
|
|
80
|
-
>
|
|
81
|
-
|
|
82
|
-
</div>
|
|
63
|
+
></div>
|
|
83
64
|
</div>
|
|
84
65
|
`;
|
|
85
66
|
};
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useProduct, useProductOfferDiscount, cls } from '@gem-sdk/core';
|
|
3
3
|
import Text from '../../text/Text.js';
|
|
4
|
+
import { useDynamicProduct } from '../hooks/useDynamicProduct.js';
|
|
4
5
|
|
|
5
6
|
const PostPurchaseProductDiscountTag = ({ setting = {}, styles = {}, style, builderAttrs, builderProps, children })=>{
|
|
6
7
|
const currentProduct = useProduct();
|
|
7
8
|
const currentProductId = currentProduct?.baseID?.replace('gid://shopify/Product/', '');
|
|
8
9
|
const currentOfferDiscount = useProductOfferDiscount();
|
|
10
|
+
const { isDynamicProduct, isEnableDynamicDiscount } = useDynamicProduct();
|
|
9
11
|
const { typo } = styles;
|
|
10
12
|
const { message } = setting;
|
|
13
|
+
const hasDiscount = !!currentOfferDiscount || isDynamicProduct && isEnableDynamicDiscount;
|
|
11
14
|
return /*#__PURE__*/ jsxs("div", {
|
|
12
15
|
...builderAttrs,
|
|
13
16
|
className: cls(builderProps?.uid, 'gp-flex gp-w-full'),
|
|
14
17
|
style: {
|
|
15
18
|
...style,
|
|
16
|
-
opacity:
|
|
19
|
+
opacity: hasDiscount ? 1 : 0.2
|
|
17
20
|
},
|
|
18
21
|
id: `shopify-text-element-${builderProps?.uid}`,
|
|
19
22
|
"data-product-id": currentProductId,
|
|
20
23
|
children: [
|
|
21
24
|
/*#__PURE__*/ jsx(Text, {
|
|
22
25
|
setting: {
|
|
23
|
-
text:
|
|
26
|
+
text: hasDiscount ? message : message?.replace(new RegExp(/\{\{Discount\}\}/, 'gi'), '0%')
|
|
24
27
|
},
|
|
25
28
|
styles: {
|
|
26
29
|
typo
|
|
@@ -7,14 +7,20 @@ import Loading from '../../../common/components/Loading.js';
|
|
|
7
7
|
import { DEVICES } from './ProductVariant.js';
|
|
8
8
|
import { postPurchaseViewSpacing } from '../../utils/helper.js';
|
|
9
9
|
import { hasPublicStoreFrontData, createStoreFrontFetcher } from '../helpers/index.js';
|
|
10
|
+
import { productOfferPlaceholder } from '../constants/ProductOfferPlaceholder.js';
|
|
11
|
+
import { useDynamicProduct } from '../hooks/useDynamicProduct.js';
|
|
10
12
|
|
|
11
13
|
const PostPurchaseProductOffer = ({ styles, builderAttrs, builderProps, children, setting })=>{
|
|
12
14
|
const mode = useEditorMode();
|
|
13
|
-
const { productSetting, productOfferLayout, inlineAlignment, ...rowSetting } = setting || {};
|
|
15
|
+
const { productSetting, productOfferLayout, inlineAlignment, discountAndShippingFee, ...rowSetting } = setting || {};
|
|
14
16
|
const { productOfferColumnGap, productOfferVerticalGutter, productOfferWidth, ...rowStyles } = styles || {};
|
|
15
17
|
const productOffers = usePageStore((s)=>s.productOffers);
|
|
16
18
|
const publicStoreFrontData = usePageStore((s)=>s.publicStoreFrontData);
|
|
17
|
-
const
|
|
19
|
+
const { isDynamicProduct } = useDynamicProduct();
|
|
20
|
+
const dynamicDiscountOffer = usePageStore((s)=>s.dynamicDiscountOffer);
|
|
21
|
+
const totalProduct = useMemo(()=>isDynamicProduct ? dynamicDiscountOffer?.appliedProductCount : productOffers?.length, [
|
|
22
|
+
dynamicDiscountOffer?.appliedProductCount,
|
|
23
|
+
isDynamicProduct,
|
|
18
24
|
productOffers?.length
|
|
19
25
|
]);
|
|
20
26
|
const sortedProductBaseIDs = useMemo(()=>{
|
|
@@ -40,7 +46,14 @@ const PostPurchaseProductOffer = ({ styles, builderAttrs, builderProps, children
|
|
|
40
46
|
const products = useMemo(()=>flattenConnection(productData.data?.products), [
|
|
41
47
|
productData.data?.products
|
|
42
48
|
]);
|
|
43
|
-
const productSortedById =
|
|
49
|
+
const productSortedById = useMemo(()=>{
|
|
50
|
+
return isDynamicProduct && dynamicDiscountOffer?.appliedProductCount ? Array(dynamicDiscountOffer.appliedProductCount).fill(productOfferPlaceholder) : sortedProductBaseIDs?.map((id)=>products?.find((el)=>el?.baseID === id)).filter(Boolean);
|
|
51
|
+
}, [
|
|
52
|
+
isDynamicProduct,
|
|
53
|
+
dynamicDiscountOffer?.appliedProductCount,
|
|
54
|
+
sortedProductBaseIDs,
|
|
55
|
+
products
|
|
56
|
+
]);
|
|
44
57
|
const getStyles = ()=>{
|
|
45
58
|
return {
|
|
46
59
|
...makeStyleResponsive('cg', productOfferColumnGap),
|
|
@@ -2,6 +2,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useCurrentVariant, useProduct, shopifyPriceRounding, useProductOfferDiscount, useFormatMoney, cls } from '@gem-sdk/core';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import Text from '../../text/Text.js';
|
|
5
|
+
import { useDynamicProduct } from '../hooks/useDynamicProduct.js';
|
|
5
6
|
|
|
6
7
|
const PostPurchaseProductPrice = ({ styles, style, builderAttrs, builderProps, children })=>{
|
|
7
8
|
const currentVariant = useCurrentVariant();
|
|
@@ -9,6 +10,7 @@ const PostPurchaseProductPrice = ({ styles, style, builderAttrs, builderProps, c
|
|
|
9
10
|
const price = currentVariant?.price ?? 0;
|
|
10
11
|
const salePrice = currentVariant?.salePrice ?? 0;
|
|
11
12
|
const discount = parseFloat(shopifyPriceRounding(useProductOfferDiscount(), 2));
|
|
13
|
+
const { isDynamicProduct } = useDynamicProduct();
|
|
12
14
|
const priceShow = useMemo(()=>{
|
|
13
15
|
if (!discount) {
|
|
14
16
|
if (styles?.priceType === 'compare') {
|
|
@@ -49,7 +51,7 @@ const PostPurchaseProductPrice = ({ styles, style, builderAttrs, builderProps, c
|
|
|
49
51
|
/*#__PURE__*/ jsx(Text, {
|
|
50
52
|
styles: styles,
|
|
51
53
|
setting: {
|
|
52
|
-
text: moneyFormatted
|
|
54
|
+
text: isDynamicProduct ? '$???' : moneyFormatted
|
|
53
55
|
},
|
|
54
56
|
className: cls({
|
|
55
57
|
'gp-money': styles?.priceType === 'regular',
|
|
@@ -3,6 +3,7 @@ import { useCurrentVariant, useProduct, useQuantity, useProductOfferDiscount, us
|
|
|
3
3
|
import { useMemo, useState, useEffect, Fragment as Fragment$1 } from 'react';
|
|
4
4
|
import { postPurchaseSpacing } from '../../utils/helper.js';
|
|
5
5
|
import MoneyLine from './priceBreakdown/MoneyLine.js';
|
|
6
|
+
import { useDynamicProduct } from '../hooks/useDynamicProduct.js';
|
|
6
7
|
|
|
7
8
|
const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, builderAttrs, builderProps, children })=>{
|
|
8
9
|
const currentVariant = useCurrentVariant();
|
|
@@ -17,6 +18,7 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
|
|
|
17
18
|
const discountShopifyFormat = shopifyPriceRounding(discountWithQuantity, 2);
|
|
18
19
|
const totalMoneyFormatted = useFormatMoney(subTotal - parseFloat(discountShopifyFormat), false);
|
|
19
20
|
const currentProductId = currentProduct?.baseID?.replace('gid://shopify/Product/', '');
|
|
21
|
+
const { isDynamicProduct, dynamicPrice, dynamicDiscount, isEnableDynamicDiscount } = useDynamicProduct();
|
|
20
22
|
const { labelStyle, moneyStyle, spacing, width, align, isShowPrice } = styles;
|
|
21
23
|
const itemGap = useMemo(()=>{
|
|
22
24
|
return postPurchaseSpacing[spacing || 'none'];
|
|
@@ -29,19 +31,19 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
|
|
|
29
31
|
}, [
|
|
30
32
|
isShowPrice
|
|
31
33
|
]);
|
|
32
|
-
const
|
|
34
|
+
const getMoneyLines = ()=>{
|
|
33
35
|
const data = [];
|
|
34
36
|
if (styles.isShowSubTotalLabel !== false) {
|
|
35
37
|
data.push({
|
|
36
38
|
title: setting.subTotalLabel,
|
|
37
|
-
money: subTotalMoneyFormatted,
|
|
39
|
+
money: isDynamicProduct ? dynamicPrice : subTotalMoneyFormatted,
|
|
38
40
|
uniqueId: 'subTotalLabel'
|
|
39
41
|
});
|
|
40
42
|
}
|
|
41
43
|
if (styles.isShowDiscountLabel !== false) {
|
|
42
44
|
data.push({
|
|
43
45
|
title: setting.discountLabel,
|
|
44
|
-
money: discount > 0 ? discountMoneyFormatted : 'No discount',
|
|
46
|
+
money: isDynamicProduct && dynamicDiscount && isEnableDynamicDiscount ? dynamicPrice : discount > 0 ? discountMoneyFormatted : 'No discount',
|
|
45
47
|
uniqueId: 'discountLabel'
|
|
46
48
|
});
|
|
47
49
|
}
|
|
@@ -67,25 +69,11 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
|
|
|
67
69
|
}
|
|
68
70
|
data.push({
|
|
69
71
|
title: setting.totalLabel,
|
|
70
|
-
money: totalMoneyFormatted,
|
|
72
|
+
money: isDynamicProduct ? dynamicPrice : totalMoneyFormatted,
|
|
71
73
|
uniqueId: 'totalLabel'
|
|
72
74
|
});
|
|
73
75
|
return data;
|
|
74
|
-
}
|
|
75
|
-
discount,
|
|
76
|
-
discountMoneyFormatted,
|
|
77
|
-
setting.discountLabel,
|
|
78
|
-
setting.shippingLabel,
|
|
79
|
-
setting.subTotalLabel,
|
|
80
|
-
setting.taxesLabel,
|
|
81
|
-
setting.totalLabel,
|
|
82
|
-
styles.isShowSubTotalLabel,
|
|
83
|
-
styles.isShowDiscountLabel,
|
|
84
|
-
styles.isShowShippingLabel,
|
|
85
|
-
styles.isShowTaxesLabel,
|
|
86
|
-
subTotalMoneyFormatted,
|
|
87
|
-
totalMoneyFormatted
|
|
88
|
-
]);
|
|
76
|
+
};
|
|
89
77
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
90
78
|
children: [
|
|
91
79
|
/*#__PURE__*/ jsxs("div", {
|
|
@@ -136,9 +124,9 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
|
|
|
136
124
|
...makeStyleResponsive('w', width),
|
|
137
125
|
gap: itemGap
|
|
138
126
|
},
|
|
139
|
-
children:
|
|
127
|
+
children: getMoneyLines().map((item)=>/*#__PURE__*/ jsxs(Fragment$1, {
|
|
140
128
|
children: [
|
|
141
|
-
item.uniqueId === 'totalLabel' &&
|
|
129
|
+
item.uniqueId === 'totalLabel' && getMoneyLines().length > 1 && /*#__PURE__*/ jsx("hr", {}),
|
|
142
130
|
/*#__PURE__*/ jsx("div", {
|
|
143
131
|
children: /*#__PURE__*/ jsx(MoneyLine, {
|
|
144
132
|
uniqueId: item.uniqueId,
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
const productOfferPlaceholder = {
|
|
2
|
+
id: '',
|
|
3
|
+
title: 'Dynamic product',
|
|
4
|
+
description: 'This is a dynamic product. The actual product will appear here based on your setup',
|
|
5
|
+
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>',
|
|
6
|
+
createdAt: '2024-07-01T04:19:51.286753Z',
|
|
7
|
+
handle: 'dynamic-product',
|
|
8
|
+
averageRating: 0,
|
|
9
|
+
isStorefront: true,
|
|
10
|
+
isSample: false,
|
|
11
|
+
baseID: '',
|
|
12
|
+
sku: '',
|
|
13
|
+
options: [
|
|
14
|
+
{
|
|
15
|
+
id: '1',
|
|
16
|
+
name: 'Variant',
|
|
17
|
+
optionType: '',
|
|
18
|
+
values: [
|
|
19
|
+
{
|
|
20
|
+
id: '1',
|
|
21
|
+
label: 'Variant option',
|
|
22
|
+
isDefault: true,
|
|
23
|
+
baseID: '1'
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
vendor: '',
|
|
29
|
+
featuredImage: {
|
|
30
|
+
id: '542178560626918105',
|
|
31
|
+
contentType: 'IMAGE',
|
|
32
|
+
previewImage: '',
|
|
33
|
+
src: 'https://cdn.shopify.com/s/files/1/0858/3168/0279/files/gempages_502328832959710176-312cf60c-d923-4913-9873-66545effe9cc.png',
|
|
34
|
+
width: 449,
|
|
35
|
+
height: 449,
|
|
36
|
+
alt: ''
|
|
37
|
+
},
|
|
38
|
+
collections: {
|
|
39
|
+
edges: [
|
|
40
|
+
{
|
|
41
|
+
node: {
|
|
42
|
+
id: '502321959132988135',
|
|
43
|
+
title: 'Home page'
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
node: {
|
|
48
|
+
id: '539286505089204764',
|
|
49
|
+
title: 'b'
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
node: {
|
|
54
|
+
id: '539286505089401372',
|
|
55
|
+
title: 'e'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
tags: [],
|
|
61
|
+
medias: {
|
|
62
|
+
edges: [
|
|
63
|
+
{
|
|
64
|
+
cursor: 'gqFpzweGNIc/AALZoXYB',
|
|
65
|
+
node: {
|
|
66
|
+
id: '542178560626918105',
|
|
67
|
+
contentType: 'IMAGE',
|
|
68
|
+
previewImage: '',
|
|
69
|
+
src: 'https://cdn.shopify.com/s/files/1/0858/3168/0279/files/gempages_502328832959710176-312cf60c-d923-4913-9873-66545effe9cc.png',
|
|
70
|
+
width: 449,
|
|
71
|
+
height: 449,
|
|
72
|
+
alt: ''
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
pageInfo: {
|
|
77
|
+
endCursor: 'gqFpzweGNIc/AALZoXYB',
|
|
78
|
+
hasNextPage: true
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
variants: {
|
|
82
|
+
edges: [
|
|
83
|
+
{
|
|
84
|
+
cursor: 'gqFpzwc5ZqRtDAMIoXYC',
|
|
85
|
+
node: {
|
|
86
|
+
id: '520560088328176392',
|
|
87
|
+
title: 'Default Title',
|
|
88
|
+
barcode: '',
|
|
89
|
+
baseID: 'gid://shopify/ProductVariant/49298248925463',
|
|
90
|
+
costPrice: 88,
|
|
91
|
+
height: 0,
|
|
92
|
+
inventoryPolicy: 'DENY',
|
|
93
|
+
inventoryQuantity: 211,
|
|
94
|
+
inventoryStatus: '',
|
|
95
|
+
isDigital: true,
|
|
96
|
+
length: 0,
|
|
97
|
+
lowInventoryAmount: 0,
|
|
98
|
+
manageInventory: false,
|
|
99
|
+
mediaId: '0',
|
|
100
|
+
platform: 'SHOPIFY',
|
|
101
|
+
price: 88,
|
|
102
|
+
salePrice: 88,
|
|
103
|
+
sku: '',
|
|
104
|
+
soldIndividually: false,
|
|
105
|
+
weight: 0,
|
|
106
|
+
width: 0,
|
|
107
|
+
selectedOptions: [
|
|
108
|
+
{
|
|
109
|
+
name: 'Variant',
|
|
110
|
+
value: 'Variant option',
|
|
111
|
+
optionType: ''
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
media: undefined
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
pageInfo: {
|
|
119
|
+
hasNextPage: false,
|
|
120
|
+
endCursor: 'gaFpzwc5ZqRtDAMI'
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export { productOfferPlaceholder };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { usePageStore } from '@gem-sdk/core';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
const useDynamicProduct = ()=>{
|
|
5
|
+
const dynamicDiscountOffer = usePageStore((s)=>s.dynamicDiscountOffer);
|
|
6
|
+
const isDynamicProduct = useMemo(()=>{
|
|
7
|
+
return !!dynamicDiscountOffer;
|
|
8
|
+
}, [
|
|
9
|
+
dynamicDiscountOffer
|
|
10
|
+
]);
|
|
11
|
+
// false = No discount
|
|
12
|
+
const isEnableDynamicDiscount = useMemo(()=>{
|
|
13
|
+
return dynamicDiscountOffer?.isEnabled;
|
|
14
|
+
}, [
|
|
15
|
+
dynamicDiscountOffer
|
|
16
|
+
]);
|
|
17
|
+
const dynamicPrice = '$???';
|
|
18
|
+
return {
|
|
19
|
+
isDynamicProduct,
|
|
20
|
+
dynamicPrice,
|
|
21
|
+
dynamicDiscount: dynamicDiscountOffer,
|
|
22
|
+
isEnableDynamicDiscount
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { useDynamicProduct };
|
|
@@ -180,6 +180,14 @@ const config = {
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
},
|
|
183
|
+
{
|
|
184
|
+
id: 'dynamicOfferQuantity',
|
|
185
|
+
type: 'dynamic-offer-quantity',
|
|
186
|
+
min: 1,
|
|
187
|
+
max: 4,
|
|
188
|
+
default: 2,
|
|
189
|
+
isOnlyAcceptInteger: true
|
|
190
|
+
},
|
|
183
191
|
{
|
|
184
192
|
id: 'discountAndShippingFee',
|
|
185
193
|
type: 'discount-and-shipping-fee-product-offer',
|
|
@@ -373,6 +381,24 @@ const config = {
|
|
|
373
381
|
},
|
|
374
382
|
layout: 'vertical'
|
|
375
383
|
},
|
|
384
|
+
{
|
|
385
|
+
type: 'group',
|
|
386
|
+
label: {
|
|
387
|
+
en: 'Product offers'
|
|
388
|
+
},
|
|
389
|
+
controls: [
|
|
390
|
+
{
|
|
391
|
+
type: 'control',
|
|
392
|
+
label: {
|
|
393
|
+
en: 'Quantity'
|
|
394
|
+
},
|
|
395
|
+
setting: {
|
|
396
|
+
id: 'dynamicOfferQuantity'
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
],
|
|
400
|
+
condition: 'false'
|
|
401
|
+
},
|
|
376
402
|
{
|
|
377
403
|
type: 'control',
|
|
378
404
|
label: {
|
package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductFeaturedImageCarousel.js
CHANGED
|
@@ -6,7 +6,7 @@ import { getAspectRatio } from '../../common/common.js';
|
|
|
6
6
|
import { checkRenderFeaturedCarousel, getDotSettingByLayout } from '../../common/productFeaturedImage.js';
|
|
7
7
|
import { handleMouseMove, handleMouseOut } from '../../common/hoverAction.js';
|
|
8
8
|
import ProductFeaturedImageOnly from './ProductFeaturedImageOnly.js';
|
|
9
|
-
import { memo,
|
|
9
|
+
import { memo, useCallback, useState, useEffect, useMemo, createRef } from 'react';
|
|
10
10
|
import { handleSetSrcForFeatureProductImage } from '../../../../../image/helpers/getSrcSet.js';
|
|
11
11
|
|
|
12
12
|
const ProductFeaturedImageCarousel = ({ productImages, imgRef, onHandleClick, onClickArrow, onHandleLoaded, onHandleUpdateActiveIndex, builderPropUID, builderPropsClass, children, parentUid, ...setting })=>{
|
|
@@ -16,12 +16,20 @@ const ProductFeaturedImageCarousel = ({ productImages, imgRef, onHandleClick, on
|
|
|
16
16
|
const { onListener, ref } = useInteraction();
|
|
17
17
|
let delayTimeout;
|
|
18
18
|
const mode = useEditorMode();
|
|
19
|
-
const
|
|
19
|
+
const getImageActiveIndex = useCallback(()=>{
|
|
20
20
|
const index = productImages?.findIndex((item)=>item.id === featuredImageGlobal?.id);
|
|
21
|
-
return index;
|
|
21
|
+
return index ?? 0;
|
|
22
22
|
}, [
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
featuredImageGlobal?.id,
|
|
24
|
+
productImages
|
|
25
|
+
]);
|
|
26
|
+
const [imageActiveIndex, setImageActiveIndex] = useState(getImageActiveIndex());
|
|
27
|
+
useEffect(()=>{
|
|
28
|
+
setImageActiveIndex(getImageActiveIndex());
|
|
29
|
+
}, [
|
|
30
|
+
featuredImageGlobal,
|
|
31
|
+
getImageActiveIndex,
|
|
32
|
+
productImages
|
|
25
33
|
]);
|
|
26
34
|
const imageActive = useMemo(()=>{
|
|
27
35
|
if (productImages?.length) return featuredImageGlobal || productImages?.[0];
|
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useCurrentVariant
|
|
2
|
+
import { useCurrentVariant } from '@gem-sdk/core';
|
|
3
3
|
import Text from '../../text/components/Text.js';
|
|
4
|
-
import { checkDefaultVariant } from '../helpers/product.js';
|
|
5
4
|
|
|
6
5
|
const ProductSku = ({ setting, builderProps, styles })=>{
|
|
7
6
|
const currentVariant = useCurrentVariant();
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const textContent = setting?.label && setting.label.trim().length ? `${setting.label}: ${currentVariant?.sku || ''}` : `${currentVariant?.sku || ''}`;
|
|
11
|
-
if (isDefaultVariant) {
|
|
12
|
-
return /*#__PURE__*/ jsx("div", {
|
|
13
|
-
"data-id": builderProps?.uid,
|
|
14
|
-
children: /*#__PURE__*/ jsx("p", {
|
|
15
|
-
className: "gp-p-2 gp-text-center gp-text-sm gp-font-semibold gp-text-gray-500",
|
|
16
|
-
children: "This product does not have a SKU"
|
|
17
|
-
})
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
if (!isDefaultVariant && !currentVariant?.sku) {
|
|
7
|
+
const textContent = setting?.label?.trim()?.length ? `${setting.label}: ${currentVariant?.sku ?? ''}` : `${currentVariant?.sku ?? ''}`;
|
|
8
|
+
if (!currentVariant?.sku) {
|
|
21
9
|
return /*#__PURE__*/ jsx("div", {
|
|
22
10
|
"data-id": builderProps?.uid,
|
|
23
11
|
children: /*#__PURE__*/ jsx("p", {
|
|
@@ -5,7 +5,7 @@ import ThirdPartyPreview from './ThirdPartyPreview.js';
|
|
|
5
5
|
const AppConfig = {
|
|
6
6
|
id: 'notify-back-in-stockpreorder',
|
|
7
7
|
label: 'Notify! Back in Stock|PreOrder',
|
|
8
|
-
logoUrl: 'https://cdn.shopify.com/
|
|
8
|
+
logoUrl: 'https://cdn.shopify.com/s/files/1/0643/0497/1949/files/Notify_Me_Logo.png?v=1736234550',
|
|
9
9
|
tag: 'NotifyBackInStockPreOrder'
|
|
10
10
|
};
|
|
11
11
|
const NotifyBackInStockPreOrderContent = ()=>{
|
|
@@ -4,21 +4,33 @@ import ThirdPartyPreview from './ThirdPartyPreview.js';
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
|
|
6
6
|
const WidgetOptions = [
|
|
7
|
-
// {
|
|
8
|
-
// value: 'bogo',
|
|
9
|
-
// label: 'Upsell, Cross-sell',
|
|
10
|
-
// },
|
|
11
7
|
{
|
|
12
|
-
value: '
|
|
13
|
-
label: '
|
|
8
|
+
value: 'bogo_offer',
|
|
9
|
+
label: 'qikify Buy X get Y'
|
|
14
10
|
},
|
|
15
11
|
{
|
|
16
|
-
value: '
|
|
17
|
-
label: '
|
|
12
|
+
value: 'free_gift',
|
|
13
|
+
label: 'qikify Free Gift'
|
|
18
14
|
},
|
|
19
15
|
{
|
|
20
|
-
value: '
|
|
21
|
-
label: '
|
|
16
|
+
value: 'bundle_offer',
|
|
17
|
+
label: 'qikify Product Bundle'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
value: 'promotion_badge',
|
|
21
|
+
label: 'qikify Promotion Badge'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
value: 'order-goal',
|
|
25
|
+
label: 'qikify Reward Bar'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
value: 'upsurge_offer',
|
|
29
|
+
label: 'qikify Upsurge Discount'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
value: 'volume_offer',
|
|
33
|
+
label: 'qikify Volume Discount'
|
|
22
34
|
}
|
|
23
35
|
];
|
|
24
36
|
const AppConfig = {
|
|
@@ -1,51 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getLiquidForAppBlock } from '../helpers/thirdParty.js';
|
|
2
2
|
|
|
3
3
|
const QikifyUpsell = ({ setting, advanced })=>{
|
|
4
|
-
const { align,
|
|
5
|
-
|
|
6
|
-
switch(widgetType){
|
|
7
|
-
// case 'bogo':
|
|
8
|
-
// return 'qbk-bogo-offer';
|
|
9
|
-
case 'bundle':
|
|
10
|
-
return 'qbk-bundle-offer';
|
|
11
|
-
case 'volume':
|
|
12
|
-
return 'qbk-volume-offer';
|
|
13
|
-
case 'upsurge':
|
|
14
|
-
return 'qbk-upsurge-offer';
|
|
15
|
-
// case 'free-gift':
|
|
16
|
-
// return 'qbk-free-gift-offer';
|
|
17
|
-
default:
|
|
18
|
-
return '';
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
return template`
|
|
22
|
-
<div
|
|
23
|
-
class="${advanced?.cssClass}"
|
|
24
|
-
style="${{
|
|
25
|
-
...makeStyleResponsive('ta', align)
|
|
26
|
-
}}"
|
|
27
|
-
>
|
|
28
|
-
{% assign productData = product %}
|
|
29
|
-
{% if productData %}
|
|
30
|
-
{% liquid
|
|
31
|
-
assign triggerId = productData.selected_or_first_available_variant.id
|
|
32
|
-
assign handle = productData.handle
|
|
33
|
-
assign productId = productData.id
|
|
34
|
-
assign blockId = block.id
|
|
35
|
-
%}
|
|
36
|
-
<div id="${prefix()}-{{ productId }}"></div>
|
|
37
|
-
<qbk-inject-offer
|
|
38
|
-
mount-id="${prefix()}-{{ productId }}"
|
|
39
|
-
handle="{{ handle }}"
|
|
40
|
-
section-id="{{ section.id }}"
|
|
41
|
-
trigger-id="{{ triggerId }}"
|
|
42
|
-
product-id="{{ productId }}"
|
|
43
|
-
type="${widgetType}"
|
|
44
|
-
>
|
|
45
|
-
</qbk-inject-offer>
|
|
46
|
-
{% endif %}
|
|
47
|
-
</div>
|
|
48
|
-
`;
|
|
4
|
+
const { align, appBlockId } = setting ?? {};
|
|
5
|
+
return getLiquidForAppBlock(appBlockId, align, `${advanced?.cssClass ?? ''} !gp-block`);
|
|
49
6
|
};
|
|
50
7
|
|
|
51
8
|
export { QikifyUpsell as default };
|
|
@@ -3,7 +3,7 @@ import { AppConfig } from '../components/NotifyBackInStockPreOrder.js';
|
|
|
3
3
|
const config = {
|
|
4
4
|
tag: AppConfig.tag,
|
|
5
5
|
label: AppConfig.label,
|
|
6
|
-
icon:
|
|
6
|
+
icon: `<img class="gp-w-[24px] gp-border gp-border-[#494949] gp-rounded-[3px]" src="${AppConfig.logoUrl}">`,
|
|
7
7
|
editorConfigs: {
|
|
8
8
|
placeholder: {
|
|
9
9
|
flowTag: [
|
|
@@ -23,7 +23,7 @@ const config = {
|
|
|
23
23
|
hideTextContent: true,
|
|
24
24
|
icon: {
|
|
25
25
|
desktop: `<div class="w-full flex flex-col items-center">
|
|
26
|
-
<img class="w-24 border border-dark-200 rounded-medium" src="
|
|
26
|
+
<img class="w-24 border border-dark-200 rounded-medium" src="${AppConfig.logoUrl}">
|
|
27
27
|
<span class="preset-item-title">Notify! Back in Stock|PreOrder</span>
|
|
28
28
|
</div>`
|
|
29
29
|
},
|
|
@@ -40,6 +40,11 @@ const config = {
|
|
|
40
40
|
{
|
|
41
41
|
id: 'setting',
|
|
42
42
|
controls: [
|
|
43
|
+
{
|
|
44
|
+
id: 'appBlockId',
|
|
45
|
+
type: 'input',
|
|
46
|
+
default: ''
|
|
47
|
+
},
|
|
43
48
|
{
|
|
44
49
|
id: 'install',
|
|
45
50
|
type: 'open-link',
|
|
@@ -60,9 +65,14 @@ const config = {
|
|
|
60
65
|
id: 'widgetType',
|
|
61
66
|
label: 'Choose widget',
|
|
62
67
|
type: 'select',
|
|
63
|
-
default: '
|
|
68
|
+
default: 'bogo_offer',
|
|
64
69
|
options: WidgetOptions
|
|
65
70
|
},
|
|
71
|
+
{
|
|
72
|
+
id: 'productHandle',
|
|
73
|
+
type: 'product-handle',
|
|
74
|
+
hide: true
|
|
75
|
+
},
|
|
66
76
|
{
|
|
67
77
|
id: 'align',
|
|
68
78
|
label: 'Alignment',
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2850,6 +2850,8 @@ type QikifyUpsellProps = BaseProps<{
|
|
|
2850
2850
|
align?: ObjectDevices<AlignProp>;
|
|
2851
2851
|
openApp?: any;
|
|
2852
2852
|
install?: any;
|
|
2853
|
+
appBlockId?: string;
|
|
2854
|
+
productHandle?: string;
|
|
2853
2855
|
}>;
|
|
2854
2856
|
declare const QikifyUpsell$1: React.FC<QikifyUpsellProps>;
|
|
2855
2857
|
|
|
@@ -4589,6 +4591,7 @@ type ProductOfferSettings = Omit<ProductSetting, 'productSetting'> & {
|
|
|
4589
4591
|
productIds?: string[];
|
|
4590
4592
|
};
|
|
4591
4593
|
productOfferLayout: ObjectDevices<'1col' | '2col'>;
|
|
4594
|
+
dynamicOfferQuantity?: number;
|
|
4592
4595
|
discountAndShippingFee?: boolean;
|
|
4593
4596
|
};
|
|
4594
4597
|
type ProductOfferStyles = RowProps$1['styles'] & {
|