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