@gem-sdk/components 2.0.0-dev.355 → 2.0.0-dev.356
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/builder.js +1 -1
- package/dist/cjs/button/components/Button.js +5 -3
- package/dist/cjs/button/components/Button.liquid.js +7 -3
- package/dist/cjs/button/components/common/attributes.js +1 -2
- package/dist/cjs/button/components/common/helpers.js +2 -2
- package/dist/cjs/button/components/common/styles.js +29 -1
- package/dist/cjs/button/setting/configs/settings.js +24 -4
- package/dist/cjs/button/setting/configs/uiV2.js +46 -8
- package/dist/cjs/image/setting/configs/uiV2.js +5 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/post-purchase/callout-banner/setting/config/callout-text/setting.js +4 -3
- package/dist/cjs/post-purchase/product/components/product-offer/common/attrs.js +14 -0
- package/dist/cjs/post-purchase/product/components/product-offer/common/classes.js +29 -0
- package/dist/cjs/post-purchase/product/components/product-offer/common/styles.js +27 -0
- package/dist/cjs/post-purchase/product/components/product-offer/components/ProductOffer.js +53 -0
- package/dist/cjs/post-purchase/product/components/product-offer/components/ProductOfferItem.js +45 -0
- package/dist/cjs/post-purchase/product/components/product-offer/hooks/useProductOfferData.js +57 -0
- package/dist/cjs/post-purchase/product/index.js +2 -2
- package/dist/cjs/post-purchase/product/next.js +1 -1
- package/dist/cjs/post-purchase/product/settings/{ProductOffer.js → product-offer/index.js} +23 -143
- package/dist/cjs/post-purchase/product/settings/product-offer/ui/uiV1.js +140 -0
- package/dist/cjs/post-purchase/product/settings/product-offer/ui/uiV2.js +141 -0
- package/dist/cjs/post-purchase/utils/constants.js +6 -0
- package/dist/cjs/product/components/ProductViewMore/ProductViewMore.js +17 -18
- package/dist/cjs/product/components/ProductViewMore/ProductViewMore.liquid.js +14 -21
- package/dist/cjs/product/components/ProductViewMore/common/data.js +26 -0
- package/dist/cjs/product/components/ProductViewMore/common/styles.js +12 -0
- package/dist/cjs/product/setting/dynamic-checkout/configs/settings.js +9 -5
- package/dist/cjs/product/setting/dynamic-checkout/configs/uiV2.js +10 -10
- package/dist/cjs/product/setting/product-button/configs/settings.js +1 -0
- package/dist/cjs/product/setting/product-button/configs/uiV2.js +1 -1
- package/dist/cjs/product/setting/product-view-more/configs/settings.js +17 -16
- package/dist/cjs/product/setting/product-view-more/configs/uiV2.js +45 -45
- package/dist/esm/builder.js +1 -1
- package/dist/esm/button/components/Button.js +5 -3
- package/dist/esm/button/components/Button.liquid.js +7 -3
- package/dist/esm/button/components/common/attributes.js +1 -2
- package/dist/esm/button/components/common/helpers.js +2 -2
- package/dist/esm/button/components/common/styles.js +29 -3
- package/dist/esm/button/setting/configs/settings.js +24 -4
- package/dist/esm/button/setting/configs/uiV2.js +46 -8
- package/dist/esm/image/setting/configs/uiV2.js +5 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/post-purchase/callout-banner/setting/config/callout-text/setting.js +4 -3
- package/dist/esm/post-purchase/product/components/product-offer/common/attrs.js +12 -0
- package/dist/esm/post-purchase/product/components/product-offer/common/classes.js +25 -0
- package/dist/esm/post-purchase/product/components/product-offer/common/styles.js +24 -0
- package/dist/esm/post-purchase/product/components/product-offer/components/ProductOffer.js +49 -0
- package/dist/esm/post-purchase/product/components/product-offer/components/ProductOfferItem.js +43 -0
- package/dist/esm/post-purchase/product/components/product-offer/hooks/useProductOfferData.js +55 -0
- package/dist/esm/post-purchase/product/index.js +1 -1
- package/dist/esm/post-purchase/product/next.js +1 -1
- package/dist/esm/post-purchase/product/settings/{ProductOffer.js → product-offer/index.js} +23 -143
- package/dist/esm/post-purchase/product/settings/product-offer/ui/uiV1.js +138 -0
- package/dist/esm/post-purchase/product/settings/product-offer/ui/uiV2.js +139 -0
- package/dist/esm/post-purchase/utils/constants.js +6 -1
- package/dist/esm/product/components/ProductViewMore/ProductViewMore.js +17 -18
- package/dist/esm/product/components/ProductViewMore/ProductViewMore.liquid.js +14 -21
- package/dist/esm/product/components/ProductViewMore/common/data.js +23 -0
- package/dist/esm/product/components/ProductViewMore/common/styles.js +10 -0
- package/dist/esm/product/setting/dynamic-checkout/configs/settings.js +9 -5
- package/dist/esm/product/setting/dynamic-checkout/configs/uiV2.js +10 -10
- package/dist/esm/product/setting/product-button/configs/settings.js +1 -0
- package/dist/esm/product/setting/product-button/configs/uiV2.js +1 -1
- package/dist/esm/product/setting/product-view-more/configs/settings.js +17 -16
- package/dist/esm/product/setting/product-view-more/configs/uiV2.js +45 -45
- package/dist/types/index.d.ts +32 -8
- package/package.json +2 -2
- package/dist/cjs/post-purchase/product/components/ProductOffer.js +0 -138
- package/dist/esm/post-purchase/product/components/ProductOffer.js +0 -133
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const getProductOfferAttrs = (product, uid)=>{
|
|
2
|
+
return {
|
|
3
|
+
'data-uid': uid || '',
|
|
4
|
+
'data-component-type': 'component',
|
|
5
|
+
'data-component-tag': 'Product',
|
|
6
|
+
'data-component-label': 'Product',
|
|
7
|
+
'data-component-no-setting': true,
|
|
8
|
+
'data-product-id': product?.baseID?.replace('gid://shopify/Product/', '') || ''
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { getProductOfferAttrs };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { composeClasses } from '@gem-sdk/core';
|
|
2
|
+
import { DEVICES } from '../../../../utils/constants.js';
|
|
3
|
+
|
|
4
|
+
const getProductOfferContainerClasses = (uid)=>{
|
|
5
|
+
return {
|
|
6
|
+
...composeClasses(uid),
|
|
7
|
+
...composeClasses('gp-flex gp-w-auto')
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
const getProductOfferWrapperClasses = ()=>{
|
|
11
|
+
return composeClasses('gp-grid gp-grid-cols-2');
|
|
12
|
+
};
|
|
13
|
+
const getProductOfferItemClasses = (index, setting, totalProduct)=>{
|
|
14
|
+
const { productOfferLayout } = setting ?? {};
|
|
15
|
+
let className = '';
|
|
16
|
+
DEVICES.map((device)=>{
|
|
17
|
+
const key = device === 'desktop' ? '' : `${device}:`;
|
|
18
|
+
if (productOfferLayout?.[device] === '1col' && index % 3 === 0 || (totalProduct || 0) <= 1) {
|
|
19
|
+
className += ` ${key}gp-col-span-2`;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return composeClasses(className);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { getProductOfferContainerClasses, getProductOfferItemClasses, getProductOfferWrapperClasses };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { filterTruthyStyles, makeStyleResponsive, makeWidth, makeStyle } from '@gem-sdk/core';
|
|
2
|
+
import { postPurchaseViewSpacing } from '../../../../utils/helper.js';
|
|
3
|
+
|
|
4
|
+
const getWrapperStyles = (styles)=>{
|
|
5
|
+
const { productOfferColumnGap, productOfferVerticalGutter, productOfferWidth } = styles ?? {};
|
|
6
|
+
return filterTruthyStyles({
|
|
7
|
+
...makeStyleResponsive('cg', productOfferColumnGap),
|
|
8
|
+
...makeStyleResponsive('rg', {
|
|
9
|
+
desktop: postPurchaseViewSpacing[productOfferVerticalGutter || 'base']
|
|
10
|
+
}),
|
|
11
|
+
...makeStyleResponsive('w', makeWidth(productOfferWidth))
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
const getContainerStyles = (setting, style)=>{
|
|
15
|
+
const { inlineAlignment } = setting ?? {};
|
|
16
|
+
return filterTruthyStyles({
|
|
17
|
+
...makeStyle({
|
|
18
|
+
pc: inlineAlignment
|
|
19
|
+
}),
|
|
20
|
+
...style
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { getContainerStyles, getWrapperStyles };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { createElement } from 'react';
|
|
4
|
+
import Loading from '../../../../../common/components/Loading.js';
|
|
5
|
+
import '@gem-sdk/core';
|
|
6
|
+
import { getProductOfferContainerClasses, getProductOfferWrapperClasses } from '../common/classes.js';
|
|
7
|
+
import { createClass, createStyle } from '@gem-sdk/system';
|
|
8
|
+
import { getWrapperStyles, getContainerStyles } from '../common/styles.js';
|
|
9
|
+
import { useProductOfferData } from '../hooks/useProductOfferData.js';
|
|
10
|
+
import { ProductOfferItem } from './ProductOfferItem.js';
|
|
11
|
+
|
|
12
|
+
const PostPurchaseProductOffer = (props)=>{
|
|
13
|
+
const { styles, builderAttrs, builderProps, setting } = props;
|
|
14
|
+
const { isLoading, productSortedById, totalProduct } = useProductOfferData();
|
|
15
|
+
const productOfferContainerClasses = createClass({
|
|
16
|
+
...getProductOfferContainerClasses(builderProps?.uid)
|
|
17
|
+
});
|
|
18
|
+
const productOfferWrapperClasses = createClass({
|
|
19
|
+
...getProductOfferWrapperClasses()
|
|
20
|
+
});
|
|
21
|
+
const wrapperStyles = createStyle({
|
|
22
|
+
...getWrapperStyles(styles)
|
|
23
|
+
});
|
|
24
|
+
const containerStyles = createStyle({
|
|
25
|
+
...getContainerStyles(setting)
|
|
26
|
+
});
|
|
27
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
28
|
+
children: isLoading ? /*#__PURE__*/ jsx(Loading, {}) : !productSortedById?.length ? /*#__PURE__*/ jsx("div", {
|
|
29
|
+
children: "You haven't set up a product yet. Please go back to the sales funnel details to add a product."
|
|
30
|
+
}) : /*#__PURE__*/ jsx("div", {
|
|
31
|
+
...builderAttrs,
|
|
32
|
+
className: productOfferContainerClasses,
|
|
33
|
+
style: containerStyles,
|
|
34
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
35
|
+
className: productOfferWrapperClasses,
|
|
36
|
+
style: wrapperStyles,
|
|
37
|
+
children: productSortedById?.map((product, index)=>/*#__PURE__*/ createElement(ProductOfferItem, {
|
|
38
|
+
...props,
|
|
39
|
+
product: product,
|
|
40
|
+
index: index,
|
|
41
|
+
key: index,
|
|
42
|
+
totalProduct: totalProduct
|
|
43
|
+
}))
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { PostPurchaseProductOffer as default };
|
package/dist/esm/post-purchase/product/components/product-offer/components/ProductOfferItem.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useEditorMode, ProductProvider, isEmptyChildren } from '@gem-sdk/core';
|
|
4
|
+
import Row from '../../../../../grid/row/Row.js';
|
|
5
|
+
import 'react';
|
|
6
|
+
import ChildrenDroppable from '../../../../../grid/components/ChildrenDroppable.js';
|
|
7
|
+
import { createAttr, createClass } from '@gem-sdk/system';
|
|
8
|
+
import { getProductOfferAttrs } from '../common/attrs.js';
|
|
9
|
+
import { getProductOfferItemClasses } from '../common/classes.js';
|
|
10
|
+
|
|
11
|
+
const ProductOfferItem = (props)=>{
|
|
12
|
+
const { product, setting, builderProps, children, index, totalProduct, builderAttrs, styles } = props;
|
|
13
|
+
const mode = useEditorMode();
|
|
14
|
+
const { variantSelected, ...rowSetting } = setting ?? {};
|
|
15
|
+
const variantId = variantSelected?.[product?.baseID ?? '']?.variantId;
|
|
16
|
+
const attrs = createAttr({
|
|
17
|
+
...getProductOfferAttrs(product, builderProps?.uid)
|
|
18
|
+
});
|
|
19
|
+
const productOfferItemClasses = createClass({
|
|
20
|
+
...getProductOfferItemClasses(index, setting, totalProduct)
|
|
21
|
+
});
|
|
22
|
+
return /*#__PURE__*/ jsx("div", {
|
|
23
|
+
className: productOfferItemClasses,
|
|
24
|
+
children: /*#__PURE__*/ jsx(ProductProvider, {
|
|
25
|
+
product,
|
|
26
|
+
readOnly: true,
|
|
27
|
+
initialVariantId: variantId ?? 'Latest',
|
|
28
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
29
|
+
...mode === 'edit' ? {
|
|
30
|
+
...attrs
|
|
31
|
+
} : {},
|
|
32
|
+
children: /*#__PURE__*/ jsx(Row, {
|
|
33
|
+
builderAttrs: builderAttrs,
|
|
34
|
+
setting: rowSetting,
|
|
35
|
+
styles: styles,
|
|
36
|
+
children: isEmptyChildren(children) ? /*#__PURE__*/ jsx(ChildrenDroppable, {}) : children
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
}, `uid-${product?.id}`);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { ProductOfferItem };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { usePageStore, useProductsQuery, flattenConnection } from '@gem-sdk/core';
|
|
2
|
+
import { useDynamicProduct } from '../../../hooks/useDynamicProduct.js';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { hasPublicStoreFrontData, createStoreFrontFetcher } from '../../../helpers/index.js';
|
|
5
|
+
import { productOfferPlaceholder } from '../../../constants/ProductOfferPlaceholder.js';
|
|
6
|
+
|
|
7
|
+
const useProductOfferData = ()=>{
|
|
8
|
+
const productOffers = usePageStore((s)=>s.productOffers);
|
|
9
|
+
const publicStoreFrontData = usePageStore((s)=>s.publicStoreFrontData);
|
|
10
|
+
const { isDynamicProduct } = useDynamicProduct();
|
|
11
|
+
const dynamicDiscountOffer = usePageStore((s)=>s.dynamicDiscountOffer);
|
|
12
|
+
const totalProduct = useMemo(()=>isDynamicProduct ? dynamicDiscountOffer?.appliedProductCount : productOffers?.length, [
|
|
13
|
+
dynamicDiscountOffer?.appliedProductCount,
|
|
14
|
+
isDynamicProduct,
|
|
15
|
+
productOffers?.length
|
|
16
|
+
]);
|
|
17
|
+
const sortedProductBaseIDs = useMemo(()=>{
|
|
18
|
+
return productOffers?.sort((a, b)=>{
|
|
19
|
+
if (a?.node?.position && b?.node?.position) {
|
|
20
|
+
return a.node.position - b.node.position;
|
|
21
|
+
}
|
|
22
|
+
return 0;
|
|
23
|
+
}).map((item)=>item?.node?.objectBaseID).filter(Boolean);
|
|
24
|
+
}, [
|
|
25
|
+
productOffers
|
|
26
|
+
]);
|
|
27
|
+
const { isLoading, isValidating, data } = useProductsQuery(sortedProductBaseIDs || [], {
|
|
28
|
+
revalidateOnMount: true
|
|
29
|
+
}, {
|
|
30
|
+
allStatus: true,
|
|
31
|
+
fetcher: hasPublicStoreFrontData(publicStoreFrontData) ? createStoreFrontFetcher(publicStoreFrontData) : undefined
|
|
32
|
+
});
|
|
33
|
+
const loading = useMemo(()=>isLoading || isValidating, [
|
|
34
|
+
isLoading,
|
|
35
|
+
isValidating
|
|
36
|
+
]);
|
|
37
|
+
const products = useMemo(()=>flattenConnection(data?.products), [
|
|
38
|
+
data?.products
|
|
39
|
+
]);
|
|
40
|
+
const productSortedById = useMemo(()=>{
|
|
41
|
+
return isDynamicProduct && dynamicDiscountOffer?.appliedProductCount ? Array(dynamicDiscountOffer.appliedProductCount).fill(productOfferPlaceholder) : sortedProductBaseIDs?.map((id)=>products?.find((el)=>el?.baseID === id)).filter(Boolean);
|
|
42
|
+
}, [
|
|
43
|
+
isDynamicProduct,
|
|
44
|
+
dynamicDiscountOffer?.appliedProductCount,
|
|
45
|
+
sortedProductBaseIDs,
|
|
46
|
+
products
|
|
47
|
+
]);
|
|
48
|
+
return {
|
|
49
|
+
isLoading: loading,
|
|
50
|
+
productSortedById,
|
|
51
|
+
totalProduct
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export { useProductOfferData };
|
|
@@ -14,7 +14,7 @@ import config$2 from './settings/product-price/ProductPrice.js';
|
|
|
14
14
|
import config$3 from './settings/product-variants/ProductVariant.js';
|
|
15
15
|
import config$4 from './settings/accept-button/index.js';
|
|
16
16
|
import config$5 from './settings/product-quantity/index.js';
|
|
17
|
-
import config$7 from './settings/
|
|
17
|
+
import config$7 from './settings/product-offer/index.js';
|
|
18
18
|
import config$6 from './settings/product-price-breakdown/index.js';
|
|
19
19
|
import config$8 from './settings/product-discount-tag/ProductDiscountTag.js';
|
|
20
20
|
import config$9 from './settings/product-image/ProductImages.js';
|
|
@@ -26,7 +26,7 @@ const PostPurchaseProductQuantity = dynamic(()=>import('./components/ProductQuan
|
|
|
26
26
|
const PostPurchaseProductPriceBreakdown = dynamic(()=>import('./components/ProductPriceBreakdown.js'), {
|
|
27
27
|
loading: Loading
|
|
28
28
|
});
|
|
29
|
-
const PostPurchaseProductOffer = dynamic(()=>import('./components/ProductOffer.js'), {
|
|
29
|
+
const PostPurchaseProductOffer = dynamic(()=>import('./components/product-offer/components/ProductOffer.js'), {
|
|
30
30
|
loading: Loading
|
|
31
31
|
});
|
|
32
32
|
const PostPurchaseProductDiscountTag = dynamic(()=>import('./components/ProductDiscountTag.js'), {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { postPurchaseProductOfferDefault } from '
|
|
2
|
-
import { postPurchaseViewSpacing } from '
|
|
3
|
-
import { postPurchaseProduct1Col } from '
|
|
4
|
-
import { postPurchaseProduct2Col } from '
|
|
1
|
+
import { postPurchaseProductOfferDefault } from '../presets-config/product-presets/product-offer-default.js';
|
|
2
|
+
import { postPurchaseViewSpacing } from '../../../utils/constants.js';
|
|
3
|
+
import { postPurchaseProduct1Col } from '../presets-config/product-presets/product-offer-1-col.js';
|
|
4
|
+
import { postPurchaseProduct2Col } from '../presets-config/product-presets/product-offer-2-col.js';
|
|
5
|
+
import { ProductOfferSettingUIV1 } from './ui/uiV1.js';
|
|
6
|
+
import { ProductOfferSettingUIV2 } from './ui/uiV2.js';
|
|
5
7
|
|
|
6
8
|
const config = {
|
|
7
9
|
tag: 'PostPurchaseProductOffer',
|
|
@@ -345,14 +347,26 @@ const config = {
|
|
|
345
347
|
},
|
|
346
348
|
{
|
|
347
349
|
id: 'productOfferWidth',
|
|
348
|
-
type: 'input
|
|
350
|
+
type: 'dropdown:input',
|
|
349
351
|
label: 'Width',
|
|
350
|
-
placeholder: 'Global style',
|
|
351
|
-
min: 0,
|
|
352
352
|
units: [
|
|
353
353
|
'px',
|
|
354
354
|
'%'
|
|
355
355
|
],
|
|
356
|
+
hideUnit: false,
|
|
357
|
+
inputType: 'number',
|
|
358
|
+
displayOptions: [
|
|
359
|
+
{
|
|
360
|
+
label: 'Full',
|
|
361
|
+
value: '100%',
|
|
362
|
+
showValue: true
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
label: 'Default',
|
|
366
|
+
value: '1200px',
|
|
367
|
+
showValue: true
|
|
368
|
+
}
|
|
369
|
+
],
|
|
356
370
|
devices: {
|
|
357
371
|
desktop: {
|
|
358
372
|
default: '100%'
|
|
@@ -370,142 +384,8 @@ const config = {
|
|
|
370
384
|
]
|
|
371
385
|
}
|
|
372
386
|
],
|
|
373
|
-
ui:
|
|
374
|
-
|
|
375
|
-
type: 'control',
|
|
376
|
-
label: {
|
|
377
|
-
en: 'Product source'
|
|
378
|
-
},
|
|
379
|
-
setting: {
|
|
380
|
-
id: 'productSetting'
|
|
381
|
-
},
|
|
382
|
-
layout: 'vertical'
|
|
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
|
-
},
|
|
402
|
-
{
|
|
403
|
-
type: 'control',
|
|
404
|
-
label: {
|
|
405
|
-
en: ''
|
|
406
|
-
},
|
|
407
|
-
setting: {
|
|
408
|
-
id: 'discountAndShippingFee'
|
|
409
|
-
},
|
|
410
|
-
layout: 'vertical'
|
|
411
|
-
},
|
|
412
|
-
{
|
|
413
|
-
type: 'group',
|
|
414
|
-
label: {
|
|
415
|
-
en: 'Layout'
|
|
416
|
-
},
|
|
417
|
-
condition: `(productSetting?.productIds?.length || 0) > 1`,
|
|
418
|
-
controls: [
|
|
419
|
-
{
|
|
420
|
-
type: 'control',
|
|
421
|
-
label: {
|
|
422
|
-
en: 'Choose layout'
|
|
423
|
-
},
|
|
424
|
-
setting: {
|
|
425
|
-
id: 'productOfferLayout'
|
|
426
|
-
},
|
|
427
|
-
layout: 'vertical',
|
|
428
|
-
condition: `(productSetting?.productIds?.length || 0) > 1`
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
type: 'control',
|
|
432
|
-
label: {
|
|
433
|
-
en: 'Row gap'
|
|
434
|
-
},
|
|
435
|
-
setting: {
|
|
436
|
-
id: 'productOfferVerticalGutter'
|
|
437
|
-
}
|
|
438
|
-
},
|
|
439
|
-
{
|
|
440
|
-
type: 'control',
|
|
441
|
-
label: {
|
|
442
|
-
en: 'Column gap'
|
|
443
|
-
},
|
|
444
|
-
setting: {
|
|
445
|
-
id: 'productOfferColumnGap'
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
]
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
type: 'group',
|
|
452
|
-
label: {
|
|
453
|
-
en: 'Product Layout'
|
|
454
|
-
},
|
|
455
|
-
controls: [
|
|
456
|
-
{
|
|
457
|
-
type: 'control',
|
|
458
|
-
label: {
|
|
459
|
-
en: ''
|
|
460
|
-
},
|
|
461
|
-
setting: {
|
|
462
|
-
id: 'layout'
|
|
463
|
-
},
|
|
464
|
-
layout: 'vertical'
|
|
465
|
-
},
|
|
466
|
-
{
|
|
467
|
-
type: 'control',
|
|
468
|
-
label: {
|
|
469
|
-
en: 'Column gap'
|
|
470
|
-
},
|
|
471
|
-
setting: {
|
|
472
|
-
id: 'columnGap'
|
|
473
|
-
},
|
|
474
|
-
condition: `!!layout.cols && layout.cols.length > 1`
|
|
475
|
-
}
|
|
476
|
-
]
|
|
477
|
-
},
|
|
478
|
-
{
|
|
479
|
-
type: 'group',
|
|
480
|
-
label: {
|
|
481
|
-
en: 'Size'
|
|
482
|
-
},
|
|
483
|
-
controls: [
|
|
484
|
-
{
|
|
485
|
-
type: 'control',
|
|
486
|
-
label: {
|
|
487
|
-
en: 'Width'
|
|
488
|
-
},
|
|
489
|
-
setting: {
|
|
490
|
-
id: 'productOfferWidth'
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
]
|
|
494
|
-
},
|
|
495
|
-
{
|
|
496
|
-
type: 'control',
|
|
497
|
-
label: {
|
|
498
|
-
en: 'Align'
|
|
499
|
-
},
|
|
500
|
-
setting: {
|
|
501
|
-
id: 'inlineAlignment'
|
|
502
|
-
},
|
|
503
|
-
condition: `productOfferWidth !== '100%'`,
|
|
504
|
-
options: {
|
|
505
|
-
label: 'large'
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
],
|
|
387
|
+
ui: ProductOfferSettingUIV1,
|
|
388
|
+
uiV2: ProductOfferSettingUIV2,
|
|
509
389
|
presets: [
|
|
510
390
|
postPurchaseProductOfferDefault,
|
|
511
391
|
postPurchaseProduct2Col,
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
const ProductOfferSettingUIV1 = [
|
|
2
|
+
{
|
|
3
|
+
type: 'control',
|
|
4
|
+
label: {
|
|
5
|
+
en: 'Product source'
|
|
6
|
+
},
|
|
7
|
+
setting: {
|
|
8
|
+
id: 'productSetting'
|
|
9
|
+
},
|
|
10
|
+
layout: 'vertical'
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
type: 'group',
|
|
14
|
+
label: {
|
|
15
|
+
en: 'Product offers'
|
|
16
|
+
},
|
|
17
|
+
controls: [
|
|
18
|
+
{
|
|
19
|
+
type: 'control',
|
|
20
|
+
label: {
|
|
21
|
+
en: 'Quantity'
|
|
22
|
+
},
|
|
23
|
+
setting: {
|
|
24
|
+
id: 'dynamicOfferQuantity'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
condition: 'false'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'control',
|
|
32
|
+
label: {
|
|
33
|
+
en: ''
|
|
34
|
+
},
|
|
35
|
+
setting: {
|
|
36
|
+
id: 'discountAndShippingFee'
|
|
37
|
+
},
|
|
38
|
+
layout: 'vertical'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'group',
|
|
42
|
+
label: {
|
|
43
|
+
en: 'Layout'
|
|
44
|
+
},
|
|
45
|
+
condition: `(productSetting?.productIds?.length || 0) > 1`,
|
|
46
|
+
controls: [
|
|
47
|
+
{
|
|
48
|
+
type: 'control',
|
|
49
|
+
label: {
|
|
50
|
+
en: 'Choose layout'
|
|
51
|
+
},
|
|
52
|
+
setting: {
|
|
53
|
+
id: 'productOfferLayout'
|
|
54
|
+
},
|
|
55
|
+
layout: 'vertical',
|
|
56
|
+
condition: `(productSetting?.productIds?.length || 0) > 1`
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: 'control',
|
|
60
|
+
label: {
|
|
61
|
+
en: 'Row gap'
|
|
62
|
+
},
|
|
63
|
+
setting: {
|
|
64
|
+
id: 'productOfferVerticalGutter'
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: 'control',
|
|
69
|
+
label: {
|
|
70
|
+
en: 'Column gap'
|
|
71
|
+
},
|
|
72
|
+
setting: {
|
|
73
|
+
id: 'productOfferColumnGap'
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: 'group',
|
|
80
|
+
label: {
|
|
81
|
+
en: 'Product Layout'
|
|
82
|
+
},
|
|
83
|
+
controls: [
|
|
84
|
+
{
|
|
85
|
+
type: 'control',
|
|
86
|
+
label: {
|
|
87
|
+
en: ''
|
|
88
|
+
},
|
|
89
|
+
setting: {
|
|
90
|
+
id: 'layout'
|
|
91
|
+
},
|
|
92
|
+
layout: 'vertical'
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: 'control',
|
|
96
|
+
label: {
|
|
97
|
+
en: 'Column gap'
|
|
98
|
+
},
|
|
99
|
+
setting: {
|
|
100
|
+
id: 'columnGap'
|
|
101
|
+
},
|
|
102
|
+
condition: `!!layout.cols && layout.cols.length > 1`
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
type: 'group',
|
|
108
|
+
label: {
|
|
109
|
+
en: 'Size'
|
|
110
|
+
},
|
|
111
|
+
controls: [
|
|
112
|
+
{
|
|
113
|
+
type: 'control',
|
|
114
|
+
label: {
|
|
115
|
+
en: 'Width'
|
|
116
|
+
},
|
|
117
|
+
setting: {
|
|
118
|
+
id: 'productOfferWidth'
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
type: 'control',
|
|
125
|
+
label: {
|
|
126
|
+
en: 'Align'
|
|
127
|
+
},
|
|
128
|
+
setting: {
|
|
129
|
+
id: 'inlineAlignment'
|
|
130
|
+
},
|
|
131
|
+
condition: `productOfferWidth !== '100%'`,
|
|
132
|
+
options: {
|
|
133
|
+
label: 'large'
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
];
|
|
137
|
+
|
|
138
|
+
export { ProductOfferSettingUIV1 };
|