@gem-sdk/components 2.0.0-dev.392 → 2.0.0-dev.394

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.
Files changed (43) hide show
  1. package/dist/cjs/builder.js +4 -4
  2. package/dist/cjs/index.js +30 -30
  3. package/dist/cjs/index.liquid.js +4 -4
  4. package/dist/cjs/product/components/ProductDiscountTag/common/getClasses.js +38 -0
  5. package/dist/cjs/product/components/ProductDiscountTag/common/getStyle.js +42 -0
  6. package/dist/cjs/product/components/ProductDiscountTag/hooks/useGpDiscountTag.js +108 -0
  7. package/dist/cjs/product/components/ProductDiscountTag/index.js +110 -0
  8. package/dist/cjs/product/components/ProductDiscountTag/index.liquid.js +91 -0
  9. package/dist/cjs/product/index.js +4 -4
  10. package/dist/cjs/product/next.js +1 -1
  11. package/dist/cjs/product/setting/ProductTag.js +7 -299
  12. package/dist/cjs/product/setting/product-badge/configs/settings.js +6 -0
  13. package/dist/cjs/product/setting/product-badge/configs/uiV2.js +14 -19
  14. package/dist/cjs/product/setting/product-discount-tag/configs/settings.js +191 -0
  15. package/dist/cjs/product/setting/product-discount-tag/configs/uiV2.js +190 -0
  16. package/dist/cjs/product/setting/product-vendor/configs/settings.js +12 -0
  17. package/dist/cjs/product/setting/product-vendor/configs/uiV2.js +1 -1
  18. package/dist/cjs/sticky/components/Sticky.js +4 -4
  19. package/dist/cjs/sticky/components/hooks/useSticky.js +19 -9
  20. package/dist/esm/builder.js +1 -1
  21. package/dist/esm/index.js +1 -1
  22. package/dist/esm/index.liquid.js +1 -1
  23. package/dist/esm/product/components/ProductDiscountTag/common/getClasses.js +33 -0
  24. package/dist/esm/product/components/ProductDiscountTag/common/getStyle.js +38 -0
  25. package/dist/esm/product/components/ProductDiscountTag/hooks/useGpDiscountTag.js +106 -0
  26. package/dist/esm/product/components/ProductDiscountTag/index.js +106 -0
  27. package/dist/esm/product/components/ProductDiscountTag/index.liquid.js +87 -0
  28. package/dist/esm/product/next.js +1 -1
  29. package/dist/esm/product/setting/ProductTag.js +7 -299
  30. package/dist/esm/product/setting/product-badge/configs/settings.js +6 -0
  31. package/dist/esm/product/setting/product-badge/configs/uiV2.js +14 -19
  32. package/dist/esm/product/setting/product-discount-tag/configs/settings.js +189 -0
  33. package/dist/esm/product/setting/product-discount-tag/configs/uiV2.js +188 -0
  34. package/dist/esm/product/setting/product-vendor/configs/settings.js +12 -0
  35. package/dist/esm/product/setting/product-vendor/configs/uiV2.js +1 -1
  36. package/dist/esm/sticky/components/Sticky.js +4 -4
  37. package/dist/esm/sticky/components/hooks/useSticky.js +20 -10
  38. package/dist/types/index.d.ts +1 -0
  39. package/package.json +2 -2
  40. package/dist/cjs/product/components/ProductTag/ProductTag.js +0 -200
  41. package/dist/cjs/product/components/ProductTag/ProductTag.liquid.js +0 -107
  42. package/dist/esm/product/components/ProductTag/ProductTag.js +0 -196
  43. package/dist/esm/product/components/ProductTag/ProductTag.liquid.js +0 -103
@@ -0,0 +1,190 @@
1
+ 'use strict';
2
+
3
+ const SettingUIV2 = [
4
+ {
5
+ controls: [
6
+ {
7
+ label: {
8
+ en: 'Tag'
9
+ },
10
+ setting: {
11
+ id: 'customContent'
12
+ },
13
+ layout: 'vertical',
14
+ options: {
15
+ labelVariant: 'primary'
16
+ }
17
+ }
18
+ ]
19
+ },
20
+ {
21
+ label: {
22
+ en: 'Size'
23
+ },
24
+ controls: [
25
+ {
26
+ label: {
27
+ en: 'Width'
28
+ },
29
+ controlConfig: {
30
+ id: 'width',
31
+ type: 'dropdown:input',
32
+ units: [
33
+ 'px',
34
+ '%'
35
+ ],
36
+ linkWithSetting: {
37
+ name: 'size',
38
+ field: 'width'
39
+ },
40
+ displayOptions: [
41
+ {
42
+ label: 'Fit content',
43
+ value: 'Auto',
44
+ showValue: true
45
+ },
46
+ {
47
+ label: 'Full',
48
+ value: '100%',
49
+ showValue: true
50
+ },
51
+ {
52
+ label: 'Default',
53
+ value: 'default',
54
+ showValue: true
55
+ }
56
+ ]
57
+ }
58
+ },
59
+ {
60
+ id: 'height',
61
+ label: {
62
+ en: 'Height'
63
+ },
64
+ controlConfig: {
65
+ id: 'height',
66
+ type: 'dropdown:input',
67
+ label: 'Height',
68
+ units: [
69
+ 'px',
70
+ '%'
71
+ ],
72
+ linkWithSetting: {
73
+ name: 'size',
74
+ field: 'height'
75
+ }
76
+ },
77
+ layout: 'horizontal'
78
+ },
79
+ {
80
+ label: {
81
+ en: 'Padding'
82
+ },
83
+ controlConfig: {
84
+ id: 'padding',
85
+ type: 'padding-v2',
86
+ linkWithSetting: {
87
+ name: 'size',
88
+ field: 'padding'
89
+ }
90
+ }
91
+ }
92
+ ]
93
+ },
94
+ {
95
+ label: {
96
+ en: 'Background'
97
+ },
98
+ controls: [
99
+ {
100
+ label: {
101
+ en: 'Color'
102
+ },
103
+ setting: {
104
+ id: 'backgroundColor'
105
+ }
106
+ }
107
+ ]
108
+ },
109
+ {
110
+ label: {
111
+ en: 'Shape'
112
+ },
113
+ controls: [
114
+ {
115
+ label: {
116
+ en: 'Border'
117
+ },
118
+ setting: {
119
+ id: 'borderTag'
120
+ }
121
+ },
122
+ {
123
+ label: {
124
+ en: 'Corner'
125
+ },
126
+ setting: {
127
+ id: 'roundedTag'
128
+ }
129
+ }
130
+ ]
131
+ },
132
+ {
133
+ label: {
134
+ en: 'Text style'
135
+ },
136
+ controls: [
137
+ {
138
+ setting: {
139
+ id: 'typo'
140
+ },
141
+ layout: 'vertical',
142
+ options: {
143
+ hideLabel: true,
144
+ fullWidth: true,
145
+ updateFields: [
146
+ {
147
+ field: 'attrs.textAlign',
148
+ settingId: 'textContentAlign'
149
+ }
150
+ ]
151
+ },
152
+ controlChangeTrigger: {
153
+ settings: [
154
+ {
155
+ action: {
156
+ controlId: 'textContentAlign',
157
+ valueFromField: 'attrs.textAlign',
158
+ groupType: 'style',
159
+ controlType: 'style'
160
+ }
161
+ }
162
+ ],
163
+ options: {
164
+ noRecordHistory: true
165
+ }
166
+ }
167
+ }
168
+ ]
169
+ },
170
+ {
171
+ controls: [
172
+ {
173
+ label: {
174
+ en: 'Align'
175
+ },
176
+ setting: {
177
+ id: 'textAlign'
178
+ },
179
+ conditionEnable: '!(parseInt(size.width) >= 100 && size.width?.includes("%"))',
180
+ options: {
181
+ labelVariant: 'primary',
182
+ fullWidth: true,
183
+ disableMessage: `Align is not supported when width is 100%`
184
+ }
185
+ }
186
+ ]
187
+ }
188
+ ];
189
+
190
+ exports.SettingUIV2 = SettingUIV2;
@@ -101,6 +101,18 @@ const ProductVendorSettings = [
101
101
  },
102
102
  ignoreReRender: true,
103
103
  hiddenSetting: {
104
+ },
105
+ compoDefaultValue: {
106
+ custom: {
107
+ textShadow: {
108
+ angle: 145,
109
+ distance: '2px',
110
+ blur: '20px',
111
+ color: 'rgba(18, 18, 18, 0.2)',
112
+ type: 'custom',
113
+ enable: true
114
+ }
115
+ }
104
116
  }
105
117
  },
106
118
  {
@@ -107,7 +107,7 @@ const SettingUIV2 = [
107
107
  toggleStyle: 'switch'
108
108
  },
109
109
  help: {
110
- content: `Click to open a collection page with all products from the same vendor.`
110
+ content: `Click to open a collection page with<br> all products from the same vendor.`
111
111
  }
112
112
  },
113
113
  {
@@ -20,9 +20,9 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
20
20
  ...style,
21
21
  ...w,
22
22
  ...core.getStyleBackgroundByDevice(background),
23
- ...displayStyle(),
24
- ...positionStyle(),
25
- ...getCSSAlign(),
23
+ ...displayStyle,
24
+ ...positionStyle,
25
+ ...getCSSAlign,
26
26
  zIndex: _const.ELEMENT_Z_INDEX.STICKY
27
27
  });
28
28
  const computedMinimizeClasses = system.createClass(core.composeClasses('sticky-minimize gp-fixed gp-flex gp-h-[32px] gp-w-[76px] gp-cursor-pointer gp-items-center gp-gap-[4px] gp-border gp-border-[#D8E1FF] gp-bg-white hover:gp-bg-[#D8E1FF]'));
@@ -33,7 +33,7 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
33
33
  "data-id": builderProps?.uid,
34
34
  ...builderAttrs,
35
35
  style: {
36
- ...displayStyle(),
36
+ ...displayStyle,
37
37
  zIndex: _const.ELEMENT_Z_INDEX.STICKY
38
38
  },
39
39
  children: [
@@ -70,13 +70,17 @@ const useSticky = (setting)=>{
70
70
  [`--t${device}`]: position == 'top' ? 'unset' : 'translateX(-50%)'
71
71
  };
72
72
  };
73
- const getCSSAlign = ()=>{
73
+ const getCSSAlign = React.useMemo(()=>{
74
74
  return {
75
75
  ...getCSSAlignByDevice(position?.desktop, ''),
76
76
  ...getCSSAlignByDevice(position?.tablet ?? position?.desktop, '-tablet'),
77
77
  ...getCSSAlignByDevice(position?.mobile ?? position?.desktop, '-mobile')
78
78
  };
79
- };
79
+ }, [
80
+ position?.desktop,
81
+ position?.mobile,
82
+ position?.tablet
83
+ ]);
80
84
  const gap = React.useMemo(()=>{
81
85
  if (sidebarMode && position?.[currentDevice] === 'top') {
82
86
  return '40px';
@@ -87,26 +91,32 @@ const useSticky = (setting)=>{
87
91
  sidebarMode,
88
92
  position
89
93
  ]);
90
- const displayStyle = React.useCallback(()=>{
94
+ const displayStyle = React.useMemo(()=>{
91
95
  return {
92
96
  [`--top`]: gap ?? 'auto',
93
97
  [`--top-tablet`]: gap ?? 'auto',
94
98
  [`--top-mobile`]: gap ?? 'auto',
95
- [`--${position?.desktop}`]: gap ?? 0,
96
- [`--${position?.tablet ?? position?.desktop}-tablet`]: gap ?? 0,
97
- [`--${position?.mobile ?? position?.desktop}-mobile`]: gap ?? 0
99
+ [`--${position?.desktop}`]: gap ?? '0px',
100
+ [`--${position?.tablet ?? position?.desktop}-tablet`]: gap ?? '0px',
101
+ [`--${position?.mobile ?? position?.desktop}-mobile`]: gap ?? '0px'
98
102
  };
99
103
  }, [
100
104
  gap,
101
- position
105
+ position?.desktop,
106
+ position?.mobile,
107
+ position?.tablet
102
108
  ]);
103
- const positionStyle = ()=>{
109
+ const positionStyle = React.useMemo(()=>{
104
110
  return {
105
111
  [`--pos`]: getCSSPosition(position?.desktop),
106
112
  [`--pos-tablet`]: getCSSPosition(position?.tablet ?? position?.desktop),
107
113
  [`--pos-mobile`]: getCSSPosition(position?.mobile ?? position?.desktop)
108
114
  };
109
- };
115
+ }, [
116
+ position?.desktop,
117
+ position?.mobile,
118
+ position?.tablet
119
+ ]);
110
120
  return {
111
121
  w,
112
122
  displayStyle,
@@ -229,7 +229,7 @@ import ProductImages from './product/components/ProductImages.js';
229
229
  import ProductImagesV2 from './product/components/ProductImagesV2/index.js';
230
230
  import ProductProperties from './product/components/ProductProperties/ProductProperties.js';
231
231
  import QuickView from './product/components/ProductQuickView/index.js';
232
- import ProductTag from './product/components/ProductTag/ProductTag.js';
232
+ import ProductTag from './product/components/ProductDiscountTag/index.js';
233
233
  import ProductList from './product/components/ProductList/ProductList.js';
234
234
  import DynamicCheckout from './product/components/DynamicCheckout/DynamicCheckout.js';
235
235
  import ProductBundleDiscount from './product/components/ProductBundle/components/ProductBundleDiscount.js';
package/dist/esm/index.js CHANGED
@@ -178,7 +178,7 @@ export { default as ProductImages } from './product/components/ProductImages.js'
178
178
  export { default as ProductImagesV2 } from './product/components/ProductImagesV2/index.js';
179
179
  export { default as ProductPropertyInput } from './product/components/ProductProperties/ProductProperties.js';
180
180
  export { default as ProductQuickView } from './product/components/ProductQuickView/index.js';
181
- export { default as ProductTag } from './product/components/ProductTag/ProductTag.js';
181
+ export { default as ProductTag } from './product/components/ProductDiscountTag/index.js';
182
182
  export { default as ProductList } from './product/components/ProductList/ProductList.js';
183
183
  export { default as ProductVendor } from './product/components/ProductVendor/Vendor.js';
184
184
  export { default as DynamicCheckout } from './product/components/DynamicCheckout/DynamicCheckout.js';
@@ -68,7 +68,7 @@ export { default as ProductDescription } from './product/components/ProductDescr
68
68
  export { default as ProductImages } from './product/components/ProductImages.liquid.js';
69
69
  export { default as ProductQuantity } from './product/components/ProductQuantity/index.liquid.js';
70
70
  export { default as ProductVariants } from './product/components/ProductVariants/index.liquid.js';
71
- export { default as ProductTag } from './product/components/ProductTag/ProductTag.liquid.js';
71
+ export { default as ProductTag } from './product/components/ProductDiscountTag/index.liquid.js';
72
72
  export { default as ProductImagesV2 } from './product/components/ProductImagesV2/index.liquid.js';
73
73
  export { default as ProductList } from './product/components/ProductList/ProductList.liquid.js';
74
74
  export { ProductPrice } from './product/components/ProductPrice/index.liquid.js';
@@ -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(' ', '&nbsp;'),
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(' ', '&nbsp;'),
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 };