@gem-sdk/components 2.0.0-dev.393 → 2.0.0-dev.395
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 +4 -4
- package/dist/cjs/index.js +30 -30
- package/dist/cjs/index.liquid.js +4 -4
- package/dist/cjs/product/components/ProductBundle/common/styles.js +22 -6
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.js +2 -1
- package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.liquid.js +1 -1
- package/dist/cjs/product/components/ProductBundle/setting/ProductBundleDiscount.js +47 -415
- package/dist/cjs/product/components/ProductBundle/setting/uiV1.js +404 -0
- package/dist/cjs/product/components/ProductBundle/setting/uiV2.js +728 -0
- package/dist/cjs/product/components/ProductDiscountTag/common/getClasses.js +38 -0
- package/dist/cjs/product/components/ProductDiscountTag/common/getStyle.js +42 -0
- package/dist/cjs/product/components/ProductDiscountTag/hooks/useGpDiscountTag.js +108 -0
- package/dist/cjs/product/components/ProductDiscountTag/index.js +110 -0
- package/dist/cjs/product/components/ProductDiscountTag/index.liquid.js +91 -0
- package/dist/cjs/product/index.js +4 -4
- package/dist/cjs/product/next.js +1 -1
- package/dist/cjs/product/setting/ProductTag.js +7 -299
- package/dist/cjs/product/setting/product-discount-tag/configs/settings.js +191 -0
- package/dist/cjs/product/setting/product-discount-tag/configs/uiV2.js +190 -0
- package/dist/esm/builder.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.liquid.js +1 -1
- package/dist/esm/product/components/ProductBundle/common/styles.js +23 -7
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.js +2 -1
- package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.liquid.js +1 -1
- package/dist/esm/product/components/ProductBundle/setting/ProductBundleDiscount.js +47 -415
- package/dist/esm/product/components/ProductBundle/setting/uiV1.js +400 -0
- package/dist/esm/product/components/ProductBundle/setting/uiV2.js +724 -0
- package/dist/esm/product/components/ProductDiscountTag/common/getClasses.js +33 -0
- package/dist/esm/product/components/ProductDiscountTag/common/getStyle.js +38 -0
- package/dist/esm/product/components/ProductDiscountTag/hooks/useGpDiscountTag.js +106 -0
- package/dist/esm/product/components/ProductDiscountTag/index.js +106 -0
- package/dist/esm/product/components/ProductDiscountTag/index.liquid.js +87 -0
- package/dist/esm/product/next.js +1 -1
- package/dist/esm/product/setting/ProductTag.js +7 -299
- package/dist/esm/product/setting/product-discount-tag/configs/settings.js +189 -0
- package/dist/esm/product/setting/product-discount-tag/configs/uiV2.js +188 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +1 -1
- package/dist/cjs/product/components/ProductTag/ProductTag.js +0 -200
- package/dist/cjs/product/components/ProductTag/ProductTag.liquid.js +0 -107
- package/dist/esm/product/components/ProductTag/ProductTag.js +0 -196
- package/dist/esm/product/components/ProductTag/ProductTag.liquid.js +0 -103
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
|
|
5
|
+
const getRootClass = ({ mode, salePrice, priceSave, bundleItem })=>{
|
|
6
|
+
return {
|
|
7
|
+
'gp-opacity-0 ': mode !== 'edit' && (salePrice <= 0 || Math.ceil(priceSave / (salePrice / 100)) <= 0),
|
|
8
|
+
'gp-opacity-20 ': mode === 'edit' && (salePrice <= 0 || Math.ceil(priceSave / (salePrice / 100)) <= 0) && !bundleItem
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
const getProductTagClass = (advanced)=>{
|
|
12
|
+
return {
|
|
13
|
+
'gp-block data-[disabled=true]:gp-hidden ${advanced?.cssClass}': true,
|
|
14
|
+
[advanced?.cssClass]: true
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
const getContainerClass = ()=>{
|
|
18
|
+
return {
|
|
19
|
+
'gp-inline-flex gp-flex-wrap gp-items-end gp-gap-3': true
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
const getWrapperTextClass = (styles)=>{
|
|
23
|
+
const { backgroundColor, borderTag, textColor } = styles ?? {};
|
|
24
|
+
const borderColorClass = core.getGlobalColorClass('border', borderTag?.color);
|
|
25
|
+
const textColorClass = core.getGlobalColorClass('text', textColor);
|
|
26
|
+
const backgroundColorClass = core.getGlobalColorClass('bg', backgroundColor);
|
|
27
|
+
return {
|
|
28
|
+
...core.composeClasses('gp-flex gp-items-center gp-w-full gp-h-full'),
|
|
29
|
+
[borderColorClass]: true,
|
|
30
|
+
[textColorClass]: true,
|
|
31
|
+
[backgroundColorClass]: true
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
exports.getContainerClass = getContainerClass;
|
|
36
|
+
exports.getProductTagClass = getProductTagClass;
|
|
37
|
+
exports.getRootClass = getRootClass;
|
|
38
|
+
exports.getWrapperTextClass = getWrapperTextClass;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
|
|
5
|
+
const getRootClass = (styles)=>{
|
|
6
|
+
const composeStyles = {
|
|
7
|
+
...core.makeStyleResponsive('ta', styles?.textAlign)
|
|
8
|
+
};
|
|
9
|
+
return core.filterTruthyStyles(composeStyles);
|
|
10
|
+
};
|
|
11
|
+
const getWrapperTextStyle = (styles)=>{
|
|
12
|
+
const { backgroundColor, roundedTag, borderTag, textColor } = styles ?? {};
|
|
13
|
+
const composeGlobalSize = core.makeGlobalSize(styles?.size);
|
|
14
|
+
const borderColorClass = core.getGlobalColorClass('border', borderTag?.color);
|
|
15
|
+
const textColorClass = core.getGlobalColorClass('text', textColor);
|
|
16
|
+
const backgroundColorClass = core.getGlobalColorClass('bg', backgroundColor);
|
|
17
|
+
const composeStyles = {
|
|
18
|
+
...core.makeStyleResponsive('jc', styles?.textContentAlign),
|
|
19
|
+
...composeGlobalSize.padding,
|
|
20
|
+
...core.makeStyle({
|
|
21
|
+
bs: borderTag?.border,
|
|
22
|
+
bw: borderTag?.width,
|
|
23
|
+
bc: borderColorClass === '' ? borderTag?.color : undefined,
|
|
24
|
+
c: textColorClass === '' ? textColor : undefined,
|
|
25
|
+
bg: backgroundColorClass === '' ? backgroundColor : undefined
|
|
26
|
+
}),
|
|
27
|
+
...roundedTag?.radiusType !== 'custom' ? core.getRadiusCSSFromGlobal('normal', roundedTag?.radiusType) : {},
|
|
28
|
+
...core.getCustomRadius('normal', roundedTag)
|
|
29
|
+
};
|
|
30
|
+
return core.filterTruthyStyles(composeStyles);
|
|
31
|
+
};
|
|
32
|
+
const getContainerStyle = (styles)=>{
|
|
33
|
+
const composeGlobalSize = core.makeGlobalSize(styles?.size);
|
|
34
|
+
return {
|
|
35
|
+
...composeGlobalSize.width,
|
|
36
|
+
...composeGlobalSize.height
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
exports.getContainerStyle = getContainerStyle;
|
|
41
|
+
exports.getRootClass = getRootClass;
|
|
42
|
+
exports.getWrapperTextStyle = getWrapperTextStyle;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var productBundle = require('../../../helpers/product-bundle.js');
|
|
6
|
+
var productBundle$1 = require('../../constants/product-bundle.js');
|
|
7
|
+
|
|
8
|
+
const useGpDiscountTag = (props)=>{
|
|
9
|
+
const { setting, styles, builderProps, ...passProps } = props;
|
|
10
|
+
const { customContent } = setting ?? {};
|
|
11
|
+
const bundleItem = passProps['bundle-item'];
|
|
12
|
+
const { moneyFormat } = core.useMoneyFormat();
|
|
13
|
+
const mode = core.useEditorMode();
|
|
14
|
+
const product = core.useProduct();
|
|
15
|
+
const currentVariant = core.useCurrentVariant();
|
|
16
|
+
const { quantity, hasUpdatePrice } = core.useQuantity();
|
|
17
|
+
const quantityProduct = React.useMemo(()=>{
|
|
18
|
+
return hasUpdatePrice && customContent?.unit !== 'percentage' ? quantity ?? 1 : 1;
|
|
19
|
+
}, [
|
|
20
|
+
hasUpdatePrice,
|
|
21
|
+
customContent?.unit,
|
|
22
|
+
quantity
|
|
23
|
+
]);
|
|
24
|
+
const price = currentVariant?.price ?? 0;
|
|
25
|
+
const salePrice = currentVariant?.salePrice ?? 0;
|
|
26
|
+
const priceSave = (salePrice - price) * quantityProduct;
|
|
27
|
+
const moneyFormatted = core.useFormatMoney(priceSave < 0 ? 0 : priceSave, setting?.moneyWithCurrentFormat || false);
|
|
28
|
+
const customDisplayWithUnit = React.useMemo(()=>{
|
|
29
|
+
if (!salePrice && salePrice !== 0 || !price && price !== 0) return `${customContent?.unit === 'percentage' ? '0%' : moneyFormatted}`;
|
|
30
|
+
if (customContent?.unit === 'percentage') {
|
|
31
|
+
const salePercent = Math.round(priceSave / (salePrice / 100));
|
|
32
|
+
return `${salePercent < 0 ? 0 : salePercent}%`;
|
|
33
|
+
}
|
|
34
|
+
return `${moneyFormatted}`;
|
|
35
|
+
}, [
|
|
36
|
+
customContent?.unit,
|
|
37
|
+
moneyFormatted,
|
|
38
|
+
price,
|
|
39
|
+
priceSave,
|
|
40
|
+
salePrice
|
|
41
|
+
]);
|
|
42
|
+
const { useProductCompareAtPrice } = core.useProductBundleDiscount();
|
|
43
|
+
const { discountPercentAmount } = productBundle.applyBundleDiscountAmount({
|
|
44
|
+
currentVariant,
|
|
45
|
+
bundleItem,
|
|
46
|
+
options: {
|
|
47
|
+
moneyFormat,
|
|
48
|
+
useProductCompareAtPrice
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const bundleDiscountDisplay = React.useMemo(()=>{
|
|
52
|
+
if (!bundleItem) return 0;
|
|
53
|
+
const { discountPercentAmount, discountAmount } = productBundle.applyBundleDiscountAmount({
|
|
54
|
+
currentVariant,
|
|
55
|
+
bundleItem,
|
|
56
|
+
options: {
|
|
57
|
+
moneyFormat,
|
|
58
|
+
useProductCompareAtPrice
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const { discountType } = bundleItem;
|
|
62
|
+
const { unit } = customContent || {};
|
|
63
|
+
if (discountType === productBundle$1.DiscountType.NoDiscount && !useProductCompareAtPrice) {
|
|
64
|
+
return unit === 'percentage' ? '0%' : core.formatMoney('0', moneyFormat);
|
|
65
|
+
}
|
|
66
|
+
if (unit === 'percentage') {
|
|
67
|
+
return `${discountPercentAmount}%`;
|
|
68
|
+
}
|
|
69
|
+
return discountAmount;
|
|
70
|
+
}, [
|
|
71
|
+
bundleItem,
|
|
72
|
+
currentVariant,
|
|
73
|
+
moneyFormat,
|
|
74
|
+
useProductCompareAtPrice,
|
|
75
|
+
customContent
|
|
76
|
+
]);
|
|
77
|
+
const unitCustomDisplay = React.useMemo(()=>{
|
|
78
|
+
if (!bundleItem) {
|
|
79
|
+
return customDisplayWithUnit;
|
|
80
|
+
}
|
|
81
|
+
return bundleDiscountDisplay;
|
|
82
|
+
}, [
|
|
83
|
+
bundleDiscountDisplay,
|
|
84
|
+
bundleItem,
|
|
85
|
+
customDisplayWithUnit
|
|
86
|
+
]);
|
|
87
|
+
const currentProductId = product?.baseID?.replace('gid://shopify/Product/', '');
|
|
88
|
+
const shouldPlaceholderNoDiscount = React.useMemo(()=>{
|
|
89
|
+
const noDiscount = !bundleItem ? priceSave <= 0 : discountPercentAmount <= 0;
|
|
90
|
+
return mode === 'edit' && noDiscount;
|
|
91
|
+
}, [
|
|
92
|
+
bundleItem,
|
|
93
|
+
discountPercentAmount,
|
|
94
|
+
mode,
|
|
95
|
+
priceSave
|
|
96
|
+
]);
|
|
97
|
+
return {
|
|
98
|
+
mode,
|
|
99
|
+
product,
|
|
100
|
+
salePrice,
|
|
101
|
+
priceSave,
|
|
102
|
+
currentProductId,
|
|
103
|
+
unitCustomDisplay,
|
|
104
|
+
shouldPlaceholderNoDiscount
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
exports.useGpDiscountTag = useGpDiscountTag;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var core = require('@gem-sdk/core');
|
|
8
|
+
var NoDataState = require('../../../common/components/NoDataState.js');
|
|
9
|
+
var TooltipHover = require('../../../common/components/TooltipHover.js');
|
|
10
|
+
var Text = require('../../../text/components/Text.js');
|
|
11
|
+
var system = require('@gem-sdk/system');
|
|
12
|
+
var getStyle = require('./common/getStyle.js');
|
|
13
|
+
var getClasses = require('./common/getClasses.js');
|
|
14
|
+
var useGpDiscountTag = require('./hooks/useGpDiscountTag.js');
|
|
15
|
+
|
|
16
|
+
const ProductTag = ({ setting, styles, builderProps, ...passProps })=>{
|
|
17
|
+
const { customContent } = setting ?? {};
|
|
18
|
+
const bundleItem = passProps['bundle-item'];
|
|
19
|
+
const { textAlign } = styles ?? {};
|
|
20
|
+
const { mode, product, salePrice, priceSave, currentProductId, unitCustomDisplay, shouldPlaceholderNoDiscount } = useGpDiscountTag.useGpDiscountTag({
|
|
21
|
+
setting,
|
|
22
|
+
styles,
|
|
23
|
+
builderProps,
|
|
24
|
+
...passProps
|
|
25
|
+
});
|
|
26
|
+
if (shouldPlaceholderNoDiscount) {
|
|
27
|
+
return /*#__PURE__*/ jsxRuntime.jsx(TooltipHover.default, {
|
|
28
|
+
enable: true,
|
|
29
|
+
text: 'Not be displayed when published',
|
|
30
|
+
position: 'bottom',
|
|
31
|
+
width: '205px',
|
|
32
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(NoDataState.default, {
|
|
33
|
+
builderAttrs: builderProps?.builderData,
|
|
34
|
+
elementType: "secondary",
|
|
35
|
+
description: "No discount",
|
|
36
|
+
rawMode: true
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const wrapperTextStyle = system.createStyle(getStyle.getWrapperTextStyle(styles));
|
|
41
|
+
const containerStyle = system.createStyle(getStyle.getContainerStyle(styles));
|
|
42
|
+
const wrapperTextClass = system.createClass(getClasses.getWrapperTextClass(styles));
|
|
43
|
+
const containerClass = system.createClass(getClasses.getContainerClass());
|
|
44
|
+
const rootClass = system.createClass(getClasses.getRootClass({
|
|
45
|
+
mode,
|
|
46
|
+
salePrice,
|
|
47
|
+
priceSave,
|
|
48
|
+
bundleItem
|
|
49
|
+
}));
|
|
50
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
51
|
+
className: rootClass,
|
|
52
|
+
style: {
|
|
53
|
+
...core.makeStyleResponsive('ta', textAlign)
|
|
54
|
+
},
|
|
55
|
+
id: `shopify-text-element-${builderProps?.uid}`,
|
|
56
|
+
"data-id": builderProps?.uid,
|
|
57
|
+
"data-product-id": currentProductId,
|
|
58
|
+
"gp-data-hidden": "false",
|
|
59
|
+
children: system.If(!product, ' ', /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
60
|
+
className: containerClass,
|
|
61
|
+
style: containerStyle,
|
|
62
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
63
|
+
className: wrapperTextClass,
|
|
64
|
+
style: wrapperTextStyle,
|
|
65
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
66
|
+
className: "gp-flex gp-break-all",
|
|
67
|
+
children: [
|
|
68
|
+
/*#__PURE__*/ jsxRuntime.jsx(Text.default, {
|
|
69
|
+
styles: styles,
|
|
70
|
+
setting: {
|
|
71
|
+
...setting,
|
|
72
|
+
text: customContent?.prefix?.replaceAll(' ', ' '),
|
|
73
|
+
options: {
|
|
74
|
+
useState: true,
|
|
75
|
+
uniqueId: `${builderProps?.uid}-prefix`
|
|
76
|
+
},
|
|
77
|
+
excludeFlex: true
|
|
78
|
+
}
|
|
79
|
+
}),
|
|
80
|
+
/*#__PURE__*/ jsxRuntime.jsx(Text.default, {
|
|
81
|
+
styles: styles,
|
|
82
|
+
setting: {
|
|
83
|
+
...setting,
|
|
84
|
+
text: unitCustomDisplay,
|
|
85
|
+
options: {
|
|
86
|
+
isCannotEditing: true
|
|
87
|
+
},
|
|
88
|
+
excludeFlex: true
|
|
89
|
+
}
|
|
90
|
+
}),
|
|
91
|
+
/*#__PURE__*/ jsxRuntime.jsx(Text.default, {
|
|
92
|
+
styles: styles,
|
|
93
|
+
setting: {
|
|
94
|
+
...setting,
|
|
95
|
+
text: customContent?.suffix?.replaceAll(' ', ' '),
|
|
96
|
+
excludeFlex: true,
|
|
97
|
+
options: {
|
|
98
|
+
useState: true,
|
|
99
|
+
uniqueId: `${builderProps?.uid}-suffix`
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
]
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
}))
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
exports.default = ProductTag;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var core = require('@gem-sdk/core');
|
|
6
|
+
var helpers = require('../../../helpers.js');
|
|
7
|
+
var Text_liquid = require('../../../text/components/Text.liquid.js');
|
|
8
|
+
var system = require('@gem-sdk/system');
|
|
9
|
+
var getClasses = require('./common/getClasses.js');
|
|
10
|
+
var getStyle = require('./common/getStyle.js');
|
|
11
|
+
|
|
12
|
+
const ProductTag = ({ setting, styles, builderProps, advanced, pageContext })=>{
|
|
13
|
+
const { customContent, translate } = setting ?? {};
|
|
14
|
+
const moneyFormat = setting?.moneyWithCurrentFormat ? `money_with_currency` : `money`;
|
|
15
|
+
const prefixVal = helpers.getDynamicSourceLocales({
|
|
16
|
+
val: customContent?.prefix,
|
|
17
|
+
uid: builderProps?.uid,
|
|
18
|
+
settingId: 'customContent_prefix',
|
|
19
|
+
isLiquid: true,
|
|
20
|
+
pageContext,
|
|
21
|
+
translate
|
|
22
|
+
});
|
|
23
|
+
const suffixVal = helpers.getDynamicSourceLocales({
|
|
24
|
+
val: customContent?.suffix,
|
|
25
|
+
uid: builderProps?.uid,
|
|
26
|
+
settingId: 'customContent_suffix',
|
|
27
|
+
isLiquid: true,
|
|
28
|
+
pageContext,
|
|
29
|
+
translate
|
|
30
|
+
});
|
|
31
|
+
const rootStyle = system.createStyle(getStyle.getRootClass(styles));
|
|
32
|
+
const wrapperTextStyle = system.createStyle(getStyle.getWrapperTextStyle(styles));
|
|
33
|
+
const containerStyle = system.createStyle(getStyle.getContainerStyle(styles));
|
|
34
|
+
const wrapperTextClass = system.createClass(getClasses.getWrapperTextClass(styles));
|
|
35
|
+
const containerClass = system.createClass(getClasses.getContainerClass());
|
|
36
|
+
const productTagClass = system.createClass(getClasses.getProductTagClass(advanced));
|
|
37
|
+
const renderScript = ()=>{
|
|
38
|
+
const jsURL = core.isLocalEnv ? `{{ 'gp-product-tag.js' | asset_url }}` : `${core.baseAssetURL}/assets-v2/gp-product-tag.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;
|
|
39
|
+
return `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${jsURL}" defer="defer"></script>`;
|
|
40
|
+
};
|
|
41
|
+
const stateData = system.createStateOrContext({
|
|
42
|
+
setting: JSON.stringify(setting).replaceAll("'", '''),
|
|
43
|
+
id: builderProps?.uid,
|
|
44
|
+
locale: '{{shop.locale}}',
|
|
45
|
+
currency: '{{shop.currency}}',
|
|
46
|
+
moneyFormat: `{{ ${setting?.moneyWithCurrentFormat ? 'shop.money_with_currency_format' : 'shop.money_format'} | replace: '"', '\\"' | escape }}`
|
|
47
|
+
});
|
|
48
|
+
return core.template`
|
|
49
|
+
{% liquid
|
|
50
|
+
assign price = variant.price | times: 1.0
|
|
51
|
+
assign salePrice = variant.compare_at_price | times: 1.0
|
|
52
|
+
assign priceSave = salePrice | minus: price
|
|
53
|
+
assign prefixVal = ${pageContext?.isPreviewing ? JSON.stringify(prefixVal) : prefixVal}
|
|
54
|
+
assign suffixVal = ${pageContext?.isPreviewing ? JSON.stringify(suffixVal) : suffixVal}
|
|
55
|
+
%}
|
|
56
|
+
${system.LiquidIf('salePrice == null or price == null', system.Liquid(`{% assign pricePercentage = prefixVal ${system.If(customContent?.unit === 'percentage', `| append: ' 0% '`, `| ${moneyFormat} | append: ' '`)} | append: suffixVal %}`), `${system.If(customContent?.unit === 'percentage', `{% assign salePercent = priceSave | divided_by: salePrice | times: 100 | round %}
|
|
57
|
+
{% assign pricePercentage = prefixVal | append: ' ' | append: salePercent | append: '% ' | append: suffixVal %}`, system.LiquidIf('priceSave > 0', `{% assign priceSaveMoney = priceSave | ${moneyFormat} %}
|
|
58
|
+
{% assign pricePercentage = prefixVal | append: ' ' | append: priceSaveMoney | append: ' ' | append: suffixVal %}`, `{% assign priceSaveMoney = 0 | ${moneyFormat} %}
|
|
59
|
+
{% assign pricePercentage = prefixVal | append: ' ' | append: priceSaveMoney | append: ' ' | append: suffixVal %}`))}`)}
|
|
60
|
+
|
|
61
|
+
<gp-product-tag
|
|
62
|
+
data-id="${builderProps?.uid}"
|
|
63
|
+
data-disabled="{%- if priceSave > 0 -%} false {%- else -%} true {%- endif -%}"
|
|
64
|
+
gp-data="${core.dataStringify(stateData)}"
|
|
65
|
+
price-save="{{priceSave}}"
|
|
66
|
+
data-prefix="${pageContext?.isPreviewing ? prefixVal : `{{${prefixVal}}}`}"
|
|
67
|
+
data-suffix="${pageContext?.isPreviewing ? suffixVal : `{{${suffixVal}}}`}"
|
|
68
|
+
class="${productTagClass}"
|
|
69
|
+
style="${rootStyle}"
|
|
70
|
+
>
|
|
71
|
+
<div class="${containerClass}" style="${containerStyle}">
|
|
72
|
+
<div class="${wrapperTextClass}" style="${wrapperTextStyle}">
|
|
73
|
+
${Text_liquid.default({
|
|
74
|
+
styles,
|
|
75
|
+
id: `p-tag-${builderProps?.uid}`,
|
|
76
|
+
setting: {
|
|
77
|
+
...setting,
|
|
78
|
+
translate: '',
|
|
79
|
+
text: '{{ pricePercentage }}',
|
|
80
|
+
excludeFlex: true
|
|
81
|
+
}
|
|
82
|
+
})}
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
</gp-product-tag>
|
|
87
|
+
${renderScript()}
|
|
88
|
+
`;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
exports.default = ProductTag;
|
|
@@ -33,7 +33,7 @@ var ProductImages$1 = require('./setting/ProductImages.js');
|
|
|
33
33
|
var ProductImages$2 = require('./setting/product-image-v2/ProductImages.js');
|
|
34
34
|
var ProductDescription = require('./setting/ProductDescription.js');
|
|
35
35
|
var ProductProperties$1 = require('./setting/ProductProperties.js');
|
|
36
|
-
var ProductTag
|
|
36
|
+
var ProductTag = require('./setting/ProductTag.js');
|
|
37
37
|
var ProductList$1 = require('./setting/ProductList.js');
|
|
38
38
|
var DynamicCheckout$1 = require('./setting/DynamicCheckout.js');
|
|
39
39
|
var Vendor$1 = require('./setting/Vendor.js');
|
|
@@ -42,7 +42,7 @@ var ProductBundleDiscount$1 = require('./components/ProductBundle/setting/Produc
|
|
|
42
42
|
var ProductBundleDiscountItem$1 = require('./components/ProductBundle/setting/ProductBundleDiscountItem.js');
|
|
43
43
|
var ProductViewMore$1 = require('./setting/ProductViewMore.js');
|
|
44
44
|
var ProductBadge = require('./setting/ProductBadge.js');
|
|
45
|
-
var index$
|
|
45
|
+
var index$9 = require('./components/FileUpload/components/setting/index.js');
|
|
46
46
|
|
|
47
47
|
const productSetting = {
|
|
48
48
|
Product: Product$1.default,
|
|
@@ -55,7 +55,7 @@ const productSetting = {
|
|
|
55
55
|
ProductImagesV2: ProductImages$2.default,
|
|
56
56
|
ProductDescription: ProductDescription.default,
|
|
57
57
|
ProductProperties: ProductProperties$1.default,
|
|
58
|
-
ProductTag: ProductTag
|
|
58
|
+
ProductTag: ProductTag.default,
|
|
59
59
|
ProductList: ProductList$1.default,
|
|
60
60
|
DynamicCheckout: DynamicCheckout$1.default,
|
|
61
61
|
ProductVendor: Vendor$1.default,
|
|
@@ -64,7 +64,7 @@ const productSetting = {
|
|
|
64
64
|
ProductBundleDiscountItem: ProductBundleDiscountItem$1.default,
|
|
65
65
|
ProductViewMore: ProductViewMore$1.default,
|
|
66
66
|
ProductBadge: ProductBadge.default,
|
|
67
|
-
FileUpload: index$
|
|
67
|
+
FileUpload: index$9.default
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
exports.Product = Product.default;
|
package/dist/cjs/product/next.js
CHANGED
|
@@ -41,7 +41,7 @@ const ProductProperties = dynamic(()=>Promise.resolve().then(function () { retur
|
|
|
41
41
|
const ProductQuickView = dynamic(()=>Promise.resolve().then(function () { return require('./components/ProductQuickView/index.js'); }), {
|
|
42
42
|
ssr: false
|
|
43
43
|
});
|
|
44
|
-
const ProductTag = dynamic(()=>Promise.resolve().then(function () { return require('./components/
|
|
44
|
+
const ProductTag = dynamic(()=>Promise.resolve().then(function () { return require('./components/ProductDiscountTag/index.js'); }), {
|
|
45
45
|
loading: Loading.default
|
|
46
46
|
});
|
|
47
47
|
const ProductList = dynamic(()=>Promise.resolve().then(function () { return require('./components/ProductList/ProductList.js'); }), {
|