@gem-sdk/components 2.0.0-dev.611 → 2.0.0-dev.613
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/banner/components/HeroBannerItem.js +1 -1
- package/dist/cjs/banner/components/HeroBannerItem.liquid.js +2 -2
- package/dist/cjs/banner/components/common/getClasses.js +2 -1
- package/dist/cjs/countdown-timer/setting/configs/uiV2.js +13 -13
- package/dist/cjs/product/components/ProductButton/common/constants.js +6 -4
- package/dist/cjs/product/components/ProductButton/common/helpers.js +0 -4
- package/dist/cjs/product/components/ProductButton/components/ProductButtonPrice.js +31 -16
- package/dist/cjs/product/components/ProductButton/components/ProductButtonPrice.liquid.js +31 -16
- package/dist/cjs/product/setting/product-button/configs/settings.js +24 -0
- package/dist/cjs/product/setting/product-button/configs/uiV2.js +10 -0
- package/dist/esm/banner/components/HeroBannerItem.js +1 -1
- package/dist/esm/banner/components/HeroBannerItem.liquid.js +2 -2
- package/dist/esm/banner/components/common/getClasses.js +2 -1
- package/dist/esm/countdown-timer/setting/configs/uiV2.js +13 -13
- package/dist/esm/product/components/ProductButton/common/constants.js +6 -4
- package/dist/esm/product/components/ProductButton/common/helpers.js +2 -5
- package/dist/esm/product/components/ProductButton/components/ProductButtonPrice.js +32 -17
- package/dist/esm/product/components/ProductButton/components/ProductButtonPrice.liquid.js +32 -17
- package/dist/esm/product/setting/product-button/configs/settings.js +24 -0
- package/dist/esm/product/setting/product-button/configs/uiV2.js +10 -0
- package/package.json +1 -1
|
@@ -52,7 +52,7 @@ const HeroBannerItem = (props)=>{
|
|
|
52
52
|
...getClasses.getAdaptiveClasses()
|
|
53
53
|
});
|
|
54
54
|
const backgroundClasses = system.createClass({
|
|
55
|
-
...getClasses.getBackgroundClasses(hoverEffect)
|
|
55
|
+
...getClasses.getBackgroundClasses(hoverEffect, enableLazyImage)
|
|
56
56
|
});
|
|
57
57
|
const backgroundStyle = system.createStyle({
|
|
58
58
|
...getStyle.getBackgroundStyle(styles, enableParallax, transform),
|
|
@@ -53,11 +53,11 @@ const HeroBannerItem = (props)=>{
|
|
|
53
53
|
...getClasses.getAdaptiveClasses()
|
|
54
54
|
});
|
|
55
55
|
const backgroundClasses = system.createClass({
|
|
56
|
-
...getClasses.getBackgroundClasses(hoverEffect)
|
|
56
|
+
...getClasses.getBackgroundClasses(hoverEffect, enableLazyImage)
|
|
57
57
|
});
|
|
58
58
|
const backgroundStyle = system.createStyle({
|
|
59
59
|
...getStyle.getBackgroundStyle(styles, enableParallax, transform),
|
|
60
|
-
...common.getBackgroundImageHeroBanner(background,
|
|
60
|
+
...common.getBackgroundImageHeroBanner(background, enableLazyImage, isNotLiquid)
|
|
61
61
|
});
|
|
62
62
|
const containBackgroundClasses = system.createClass({
|
|
63
63
|
...getClasses.getContainBackgroundClasses()
|
|
@@ -60,8 +60,9 @@ const getAdaptivePictureClasses = ()=>{
|
|
|
60
60
|
const classList = `gp-w-full`;
|
|
61
61
|
return composeClasses(classList);
|
|
62
62
|
};
|
|
63
|
-
const getBackgroundClasses = (hoverEffect)=>{
|
|
63
|
+
const getBackgroundClasses = (hoverEffect, enableLazyImage)=>{
|
|
64
64
|
let classList = `hero-banner-bg gp-hero-banner-image-background`;
|
|
65
|
+
if (enableLazyImage) classList += ` gp_lazybg`;
|
|
65
66
|
if (hoverEffect) classList += ` gp-duration-[var(--duration)] group-hover/hero:gp-scale-[var(--scale)] gp-transition-transform`;
|
|
66
67
|
return composeClasses(classList);
|
|
67
68
|
};
|
|
@@ -45,15 +45,6 @@ const SettingUIV2 = [
|
|
|
45
45
|
id: 'timerEverygreen'
|
|
46
46
|
},
|
|
47
47
|
layout: 'vertical'
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
conditionDisplay: 'behaviour === "evergreen" && autoHideWhenTimeout === false',
|
|
51
|
-
label: {
|
|
52
|
-
en: 'Loop (refresh after finish)'
|
|
53
|
-
},
|
|
54
|
-
setting: {
|
|
55
|
-
id: 'loopAfterFinish'
|
|
56
|
-
}
|
|
57
48
|
}
|
|
58
49
|
]
|
|
59
50
|
},
|
|
@@ -244,7 +235,7 @@ const SettingUIV2 = [
|
|
|
244
235
|
en: 'Time'
|
|
245
236
|
},
|
|
246
237
|
setting: {
|
|
247
|
-
id: '
|
|
238
|
+
id: 'enableNumberTextStyle'
|
|
248
239
|
},
|
|
249
240
|
options: {
|
|
250
241
|
labelVariant: 'primary',
|
|
@@ -255,7 +246,7 @@ const SettingUIV2 = [
|
|
|
255
246
|
label: {
|
|
256
247
|
en: 'Item style'
|
|
257
248
|
},
|
|
258
|
-
conditionDisplay: '
|
|
249
|
+
conditionDisplay: 'enableNumberTextStyle == true',
|
|
259
250
|
type: 'combo',
|
|
260
251
|
popoverLabel: {
|
|
261
252
|
en: 'Time text style'
|
|
@@ -281,7 +272,7 @@ const SettingUIV2 = [
|
|
|
281
272
|
en: 'Caption'
|
|
282
273
|
},
|
|
283
274
|
setting: {
|
|
284
|
-
id: '
|
|
275
|
+
id: 'enableLabelTextStyle'
|
|
285
276
|
},
|
|
286
277
|
options: {
|
|
287
278
|
labelVariant: 'primary',
|
|
@@ -295,7 +286,7 @@ const SettingUIV2 = [
|
|
|
295
286
|
popoverLabel: {
|
|
296
287
|
en: 'Caption text style'
|
|
297
288
|
},
|
|
298
|
-
conditionDisplay: '
|
|
289
|
+
conditionDisplay: 'enableLabelTextStyle == true',
|
|
299
290
|
type: 'combo',
|
|
300
291
|
iconName: 'polaris-text-title',
|
|
301
292
|
isHideClear: true,
|
|
@@ -437,6 +428,15 @@ const SettingUIV2 = [
|
|
|
437
428
|
id: 'autoHideWhenTimeout'
|
|
438
429
|
}
|
|
439
430
|
},
|
|
431
|
+
{
|
|
432
|
+
conditionDisplay: 'behaviour === "evergreen" && autoHideWhenTimeout === false',
|
|
433
|
+
label: {
|
|
434
|
+
en: 'Loop'
|
|
435
|
+
},
|
|
436
|
+
setting: {
|
|
437
|
+
id: 'loopAfterFinish'
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
440
|
{
|
|
441
441
|
setting: {
|
|
442
442
|
id: 'redirectUrl'
|
|
@@ -27,9 +27,11 @@ const SEPARATOR = {
|
|
|
27
27
|
</svg>
|
|
28
28
|
`
|
|
29
29
|
};
|
|
30
|
-
const
|
|
31
|
-
'
|
|
32
|
-
|
|
30
|
+
const PRICE_LAYOUT = {
|
|
31
|
+
PRICE_ONLY: 'price-only',
|
|
32
|
+
PRICE_BEFORE: 'price-before',
|
|
33
|
+
PRICE_AFTER: 'price-after'
|
|
34
|
+
};
|
|
33
35
|
|
|
36
|
+
exports.PRICE_LAYOUT = PRICE_LAYOUT;
|
|
34
37
|
exports.SEPARATOR = SEPARATOR;
|
|
35
|
-
exports.SUPPORT_COMPARE_PRICE_LAYOUTS = SUPPORT_COMPARE_PRICE_LAYOUTS;
|
|
@@ -56,13 +56,9 @@ const removeColorFromTypo = (typo)=>{
|
|
|
56
56
|
}
|
|
57
57
|
return typo;
|
|
58
58
|
};
|
|
59
|
-
const isLayoutSupportComparePrice = (buttonLayout)=>{
|
|
60
|
-
return buttonLayout ? constants.SUPPORT_COMPARE_PRICE_LAYOUTS.includes(buttonLayout) : false;
|
|
61
|
-
};
|
|
62
59
|
|
|
63
60
|
exports.checkIconVisibility = checkIconVisibility;
|
|
64
61
|
exports.getGPProductButtonState = getGPProductButtonState;
|
|
65
62
|
exports.getRenderComparePriceSettings = getRenderComparePriceSettings;
|
|
66
63
|
exports.getRenderRegularPriceSettings = getRenderRegularPriceSettings;
|
|
67
|
-
exports.isLayoutSupportComparePrice = isLayoutSupportComparePrice;
|
|
68
64
|
exports.renderSeparator = renderSeparator;
|
|
@@ -9,26 +9,41 @@ require('react');
|
|
|
9
9
|
var helpers = require('../common/helpers.js');
|
|
10
10
|
var PriceLayout = require('./PriceLayout.js');
|
|
11
11
|
var PriceComponent = require('./PriceComponent.js');
|
|
12
|
+
var constants = require('../common/constants.js');
|
|
12
13
|
|
|
13
14
|
const ProductButtonPrice = ({ setting, styles })=>{
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
const regularPriceComponent = /*#__PURE__*/ jsxRuntime.jsx(PriceComponent.default, {
|
|
16
|
+
priceType: types.PriceType.Regular,
|
|
17
|
+
settings: helpers.getRenderRegularPriceSettings(setting)
|
|
18
|
+
}, "regular");
|
|
19
|
+
const comparePriceComponent = /*#__PURE__*/ jsxRuntime.jsx(PriceComponent.default, {
|
|
20
|
+
priceType: types.PriceType.Compare,
|
|
21
|
+
settings: helpers.getRenderComparePriceSettings(setting)
|
|
22
|
+
}, "compare");
|
|
23
|
+
const getComponentsByLayout = ()=>{
|
|
24
|
+
switch(setting?.priceLayout){
|
|
25
|
+
case constants.PRICE_LAYOUT.PRICE_ONLY:
|
|
26
|
+
return [
|
|
27
|
+
regularPriceComponent
|
|
28
|
+
];
|
|
29
|
+
case constants.PRICE_LAYOUT.PRICE_BEFORE:
|
|
30
|
+
return [
|
|
31
|
+
regularPriceComponent,
|
|
32
|
+
comparePriceComponent
|
|
33
|
+
];
|
|
34
|
+
case constants.PRICE_LAYOUT.PRICE_AFTER:
|
|
35
|
+
return [
|
|
36
|
+
comparePriceComponent,
|
|
37
|
+
regularPriceComponent
|
|
38
|
+
];
|
|
39
|
+
default:
|
|
40
|
+
return [
|
|
41
|
+
regularPriceComponent,
|
|
42
|
+
comparePriceComponent
|
|
43
|
+
];
|
|
26
44
|
}
|
|
27
|
-
return components;
|
|
28
45
|
};
|
|
29
|
-
const components =
|
|
30
|
-
includeCompare: helpers.isLayoutSupportComparePrice(setting?.buttonLayout)
|
|
31
|
-
});
|
|
46
|
+
const components = getComponentsByLayout();
|
|
32
47
|
return /*#__PURE__*/ jsxRuntime.jsx(PriceLayout.default, {
|
|
33
48
|
components: components,
|
|
34
49
|
separator: setting?.separator,
|
|
@@ -7,26 +7,41 @@ var types = require('../common/types.js');
|
|
|
7
7
|
var helpers = require('../common/helpers.js');
|
|
8
8
|
var PriceLayout_liquid = require('./PriceLayout.liquid.js');
|
|
9
9
|
var PriceComponent_liquid = require('./PriceComponent.liquid.js');
|
|
10
|
+
var constants = require('../common/constants.js');
|
|
10
11
|
|
|
11
12
|
const ProductButtonPrice = ({ setting, styles })=>{
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
()
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
const regularPriceComponent = ()=>PriceComponent_liquid.default({
|
|
14
|
+
priceType: types.PriceType.Regular,
|
|
15
|
+
settings: helpers.getRenderRegularPriceSettings(setting)
|
|
16
|
+
});
|
|
17
|
+
const comparePriceComponent = ()=>PriceComponent_liquid.default({
|
|
18
|
+
priceType: types.PriceType.Compare,
|
|
19
|
+
settings: helpers.getRenderComparePriceSettings(setting)
|
|
20
|
+
});
|
|
21
|
+
const getComponentsByLayout = ()=>{
|
|
22
|
+
switch(setting?.priceLayout){
|
|
23
|
+
case constants.PRICE_LAYOUT.PRICE_ONLY:
|
|
24
|
+
return [
|
|
25
|
+
regularPriceComponent
|
|
26
|
+
];
|
|
27
|
+
case constants.PRICE_LAYOUT.PRICE_BEFORE:
|
|
28
|
+
return [
|
|
29
|
+
regularPriceComponent,
|
|
30
|
+
comparePriceComponent
|
|
31
|
+
];
|
|
32
|
+
case constants.PRICE_LAYOUT.PRICE_AFTER:
|
|
33
|
+
return [
|
|
34
|
+
comparePriceComponent,
|
|
35
|
+
regularPriceComponent
|
|
36
|
+
];
|
|
37
|
+
default:
|
|
38
|
+
return [
|
|
39
|
+
regularPriceComponent,
|
|
40
|
+
comparePriceComponent
|
|
41
|
+
];
|
|
24
42
|
}
|
|
25
|
-
return components;
|
|
26
43
|
};
|
|
27
|
-
const components =
|
|
28
|
-
includeCompare: helpers.isLayoutSupportComparePrice(setting?.buttonLayout)
|
|
29
|
-
});
|
|
44
|
+
const components = getComponentsByLayout();
|
|
30
45
|
return PriceLayout_liquid.default({
|
|
31
46
|
components,
|
|
32
47
|
separator: setting?.separator,
|
|
@@ -100,6 +100,30 @@ const ProductButtonSettings = [
|
|
|
100
100
|
}
|
|
101
101
|
]
|
|
102
102
|
},
|
|
103
|
+
{
|
|
104
|
+
id: 'priceLayout',
|
|
105
|
+
type: 'option:illustration',
|
|
106
|
+
enableTooltip: false,
|
|
107
|
+
label: 'Layout',
|
|
108
|
+
options: [
|
|
109
|
+
{
|
|
110
|
+
value: 'price-only',
|
|
111
|
+
type: 'image',
|
|
112
|
+
svgName: 'gp-product-button-price-only-layout'
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
value: 'price-before',
|
|
116
|
+
type: 'image',
|
|
117
|
+
svgName: 'gp-product-button-price-before-layout'
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
value: 'price-after',
|
|
121
|
+
type: 'image',
|
|
122
|
+
svgName: 'gp-product-button-price-after-layout'
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
default: 'price-only'
|
|
126
|
+
},
|
|
103
127
|
{
|
|
104
128
|
id: 'button-text-group',
|
|
105
129
|
type: 'group',
|
|
@@ -580,6 +580,16 @@ const SettingUIV2 = [
|
|
|
580
580
|
toggleStyle: 'switch'
|
|
581
581
|
}
|
|
582
582
|
},
|
|
583
|
+
{
|
|
584
|
+
label: {
|
|
585
|
+
en: 'Layout'
|
|
586
|
+
},
|
|
587
|
+
conditionDisplay: 'enablePrice === true',
|
|
588
|
+
setting: {
|
|
589
|
+
id: 'priceLayout'
|
|
590
|
+
},
|
|
591
|
+
layout: 'vertical'
|
|
592
|
+
},
|
|
583
593
|
{
|
|
584
594
|
label: {
|
|
585
595
|
en: 'Product price'
|
|
@@ -48,7 +48,7 @@ const HeroBannerItem = (props)=>{
|
|
|
48
48
|
...getAdaptiveClasses()
|
|
49
49
|
});
|
|
50
50
|
const backgroundClasses = createClass({
|
|
51
|
-
...getBackgroundClasses(hoverEffect)
|
|
51
|
+
...getBackgroundClasses(hoverEffect, enableLazyImage)
|
|
52
52
|
});
|
|
53
53
|
const backgroundStyle = createStyle({
|
|
54
54
|
...getBackgroundStyle(styles, enableParallax, transform),
|
|
@@ -49,11 +49,11 @@ const HeroBannerItem = (props)=>{
|
|
|
49
49
|
...getAdaptiveClasses()
|
|
50
50
|
});
|
|
51
51
|
const backgroundClasses = createClass({
|
|
52
|
-
...getBackgroundClasses(hoverEffect)
|
|
52
|
+
...getBackgroundClasses(hoverEffect, enableLazyImage)
|
|
53
53
|
});
|
|
54
54
|
const backgroundStyle = createStyle({
|
|
55
55
|
...getBackgroundStyle(styles, enableParallax, transform),
|
|
56
|
-
...getBackgroundImageHeroBanner(background,
|
|
56
|
+
...getBackgroundImageHeroBanner(background, enableLazyImage, isNotLiquid)
|
|
57
57
|
});
|
|
58
58
|
const containBackgroundClasses = createClass({
|
|
59
59
|
...getContainBackgroundClasses()
|
|
@@ -58,8 +58,9 @@ const getAdaptivePictureClasses = ()=>{
|
|
|
58
58
|
const classList = `gp-w-full`;
|
|
59
59
|
return composeClasses(classList);
|
|
60
60
|
};
|
|
61
|
-
const getBackgroundClasses = (hoverEffect)=>{
|
|
61
|
+
const getBackgroundClasses = (hoverEffect, enableLazyImage)=>{
|
|
62
62
|
let classList = `hero-banner-bg gp-hero-banner-image-background`;
|
|
63
|
+
if (enableLazyImage) classList += ` gp_lazybg`;
|
|
63
64
|
if (hoverEffect) classList += ` gp-duration-[var(--duration)] group-hover/hero:gp-scale-[var(--scale)] gp-transition-transform`;
|
|
64
65
|
return composeClasses(classList);
|
|
65
66
|
};
|
|
@@ -43,15 +43,6 @@ const SettingUIV2 = [
|
|
|
43
43
|
id: 'timerEverygreen'
|
|
44
44
|
},
|
|
45
45
|
layout: 'vertical'
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
conditionDisplay: 'behaviour === "evergreen" && autoHideWhenTimeout === false',
|
|
49
|
-
label: {
|
|
50
|
-
en: 'Loop (refresh after finish)'
|
|
51
|
-
},
|
|
52
|
-
setting: {
|
|
53
|
-
id: 'loopAfterFinish'
|
|
54
|
-
}
|
|
55
46
|
}
|
|
56
47
|
]
|
|
57
48
|
},
|
|
@@ -242,7 +233,7 @@ const SettingUIV2 = [
|
|
|
242
233
|
en: 'Time'
|
|
243
234
|
},
|
|
244
235
|
setting: {
|
|
245
|
-
id: '
|
|
236
|
+
id: 'enableNumberTextStyle'
|
|
246
237
|
},
|
|
247
238
|
options: {
|
|
248
239
|
labelVariant: 'primary',
|
|
@@ -253,7 +244,7 @@ const SettingUIV2 = [
|
|
|
253
244
|
label: {
|
|
254
245
|
en: 'Item style'
|
|
255
246
|
},
|
|
256
|
-
conditionDisplay: '
|
|
247
|
+
conditionDisplay: 'enableNumberTextStyle == true',
|
|
257
248
|
type: 'combo',
|
|
258
249
|
popoverLabel: {
|
|
259
250
|
en: 'Time text style'
|
|
@@ -279,7 +270,7 @@ const SettingUIV2 = [
|
|
|
279
270
|
en: 'Caption'
|
|
280
271
|
},
|
|
281
272
|
setting: {
|
|
282
|
-
id: '
|
|
273
|
+
id: 'enableLabelTextStyle'
|
|
283
274
|
},
|
|
284
275
|
options: {
|
|
285
276
|
labelVariant: 'primary',
|
|
@@ -293,7 +284,7 @@ const SettingUIV2 = [
|
|
|
293
284
|
popoverLabel: {
|
|
294
285
|
en: 'Caption text style'
|
|
295
286
|
},
|
|
296
|
-
conditionDisplay: '
|
|
287
|
+
conditionDisplay: 'enableLabelTextStyle == true',
|
|
297
288
|
type: 'combo',
|
|
298
289
|
iconName: 'polaris-text-title',
|
|
299
290
|
isHideClear: true,
|
|
@@ -435,6 +426,15 @@ const SettingUIV2 = [
|
|
|
435
426
|
id: 'autoHideWhenTimeout'
|
|
436
427
|
}
|
|
437
428
|
},
|
|
429
|
+
{
|
|
430
|
+
conditionDisplay: 'behaviour === "evergreen" && autoHideWhenTimeout === false',
|
|
431
|
+
label: {
|
|
432
|
+
en: 'Loop'
|
|
433
|
+
},
|
|
434
|
+
setting: {
|
|
435
|
+
id: 'loopAfterFinish'
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
438
|
{
|
|
439
439
|
setting: {
|
|
440
440
|
id: 'redirectUrl'
|
|
@@ -25,8 +25,10 @@ const SEPARATOR = {
|
|
|
25
25
|
</svg>
|
|
26
26
|
`
|
|
27
27
|
};
|
|
28
|
-
const
|
|
29
|
-
'
|
|
30
|
-
|
|
28
|
+
const PRICE_LAYOUT = {
|
|
29
|
+
PRICE_ONLY: 'price-only',
|
|
30
|
+
PRICE_BEFORE: 'price-before',
|
|
31
|
+
PRICE_AFTER: 'price-after'
|
|
32
|
+
};
|
|
31
33
|
|
|
32
|
-
export {
|
|
34
|
+
export { PRICE_LAYOUT, SEPARATOR };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SEPARATOR } from './constants.js';
|
|
2
2
|
|
|
3
3
|
const checkIconVisibility = (styles)=>{
|
|
4
4
|
return styles?.enableIcon === true;
|
|
@@ -54,8 +54,5 @@ const removeColorFromTypo = (typo)=>{
|
|
|
54
54
|
}
|
|
55
55
|
return typo;
|
|
56
56
|
};
|
|
57
|
-
const isLayoutSupportComparePrice = (buttonLayout)=>{
|
|
58
|
-
return buttonLayout ? SUPPORT_COMPARE_PRICE_LAYOUTS.includes(buttonLayout) : false;
|
|
59
|
-
};
|
|
60
57
|
|
|
61
|
-
export { checkIconVisibility, getGPProductButtonState, getRenderComparePriceSettings, getRenderRegularPriceSettings,
|
|
58
|
+
export { checkIconVisibility, getGPProductButtonState, getRenderComparePriceSettings, getRenderRegularPriceSettings, renderSeparator };
|
|
@@ -2,29 +2,44 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { PriceType } from '../common/types.js';
|
|
4
4
|
import 'react';
|
|
5
|
-
import { getRenderRegularPriceSettings, getRenderComparePriceSettings
|
|
5
|
+
import { getRenderRegularPriceSettings, getRenderComparePriceSettings } from '../common/helpers.js';
|
|
6
6
|
import PriceLayout from './PriceLayout.js';
|
|
7
7
|
import PriceComponent from './PriceComponent.js';
|
|
8
|
+
import { PRICE_LAYOUT } from '../common/constants.js';
|
|
8
9
|
|
|
9
10
|
const ProductButtonPrice = ({ setting, styles })=>{
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
const regularPriceComponent = /*#__PURE__*/ jsx(PriceComponent, {
|
|
12
|
+
priceType: PriceType.Regular,
|
|
13
|
+
settings: getRenderRegularPriceSettings(setting)
|
|
14
|
+
}, "regular");
|
|
15
|
+
const comparePriceComponent = /*#__PURE__*/ jsx(PriceComponent, {
|
|
16
|
+
priceType: PriceType.Compare,
|
|
17
|
+
settings: getRenderComparePriceSettings(setting)
|
|
18
|
+
}, "compare");
|
|
19
|
+
const getComponentsByLayout = ()=>{
|
|
20
|
+
switch(setting?.priceLayout){
|
|
21
|
+
case PRICE_LAYOUT.PRICE_ONLY:
|
|
22
|
+
return [
|
|
23
|
+
regularPriceComponent
|
|
24
|
+
];
|
|
25
|
+
case PRICE_LAYOUT.PRICE_BEFORE:
|
|
26
|
+
return [
|
|
27
|
+
regularPriceComponent,
|
|
28
|
+
comparePriceComponent
|
|
29
|
+
];
|
|
30
|
+
case PRICE_LAYOUT.PRICE_AFTER:
|
|
31
|
+
return [
|
|
32
|
+
comparePriceComponent,
|
|
33
|
+
regularPriceComponent
|
|
34
|
+
];
|
|
35
|
+
default:
|
|
36
|
+
return [
|
|
37
|
+
regularPriceComponent,
|
|
38
|
+
comparePriceComponent
|
|
39
|
+
];
|
|
22
40
|
}
|
|
23
|
-
return components;
|
|
24
41
|
};
|
|
25
|
-
const components =
|
|
26
|
-
includeCompare: isLayoutSupportComparePrice(setting?.buttonLayout)
|
|
27
|
-
});
|
|
42
|
+
const components = getComponentsByLayout();
|
|
28
43
|
return /*#__PURE__*/ jsx(PriceLayout, {
|
|
29
44
|
components: components,
|
|
30
45
|
separator: setting?.separator,
|
|
@@ -1,28 +1,43 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { PriceType } from '../common/types.js';
|
|
3
|
-
import {
|
|
3
|
+
import { getRenderRegularPriceSettings, getRenderComparePriceSettings } from '../common/helpers.js';
|
|
4
4
|
import PriceLayout from './PriceLayout.liquid.js';
|
|
5
5
|
import PriceComponent from './PriceComponent.liquid.js';
|
|
6
|
+
import { PRICE_LAYOUT } from '../common/constants.js';
|
|
6
7
|
|
|
7
8
|
const ProductButtonPrice = ({ setting, styles })=>{
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
()
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
const regularPriceComponent = ()=>PriceComponent({
|
|
10
|
+
priceType: PriceType.Regular,
|
|
11
|
+
settings: getRenderRegularPriceSettings(setting)
|
|
12
|
+
});
|
|
13
|
+
const comparePriceComponent = ()=>PriceComponent({
|
|
14
|
+
priceType: PriceType.Compare,
|
|
15
|
+
settings: getRenderComparePriceSettings(setting)
|
|
16
|
+
});
|
|
17
|
+
const getComponentsByLayout = ()=>{
|
|
18
|
+
switch(setting?.priceLayout){
|
|
19
|
+
case PRICE_LAYOUT.PRICE_ONLY:
|
|
20
|
+
return [
|
|
21
|
+
regularPriceComponent
|
|
22
|
+
];
|
|
23
|
+
case PRICE_LAYOUT.PRICE_BEFORE:
|
|
24
|
+
return [
|
|
25
|
+
regularPriceComponent,
|
|
26
|
+
comparePriceComponent
|
|
27
|
+
];
|
|
28
|
+
case PRICE_LAYOUT.PRICE_AFTER:
|
|
29
|
+
return [
|
|
30
|
+
comparePriceComponent,
|
|
31
|
+
regularPriceComponent
|
|
32
|
+
];
|
|
33
|
+
default:
|
|
34
|
+
return [
|
|
35
|
+
regularPriceComponent,
|
|
36
|
+
comparePriceComponent
|
|
37
|
+
];
|
|
20
38
|
}
|
|
21
|
-
return components;
|
|
22
39
|
};
|
|
23
|
-
const components =
|
|
24
|
-
includeCompare: isLayoutSupportComparePrice(setting?.buttonLayout)
|
|
25
|
-
});
|
|
40
|
+
const components = getComponentsByLayout();
|
|
26
41
|
return PriceLayout({
|
|
27
42
|
components,
|
|
28
43
|
separator: setting?.separator,
|
|
@@ -98,6 +98,30 @@ const ProductButtonSettings = [
|
|
|
98
98
|
}
|
|
99
99
|
]
|
|
100
100
|
},
|
|
101
|
+
{
|
|
102
|
+
id: 'priceLayout',
|
|
103
|
+
type: 'option:illustration',
|
|
104
|
+
enableTooltip: false,
|
|
105
|
+
label: 'Layout',
|
|
106
|
+
options: [
|
|
107
|
+
{
|
|
108
|
+
value: 'price-only',
|
|
109
|
+
type: 'image',
|
|
110
|
+
svgName: 'gp-product-button-price-only-layout'
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
value: 'price-before',
|
|
114
|
+
type: 'image',
|
|
115
|
+
svgName: 'gp-product-button-price-before-layout'
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
value: 'price-after',
|
|
119
|
+
type: 'image',
|
|
120
|
+
svgName: 'gp-product-button-price-after-layout'
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
default: 'price-only'
|
|
124
|
+
},
|
|
101
125
|
{
|
|
102
126
|
id: 'button-text-group',
|
|
103
127
|
type: 'group',
|
|
@@ -578,6 +578,16 @@ const SettingUIV2 = [
|
|
|
578
578
|
toggleStyle: 'switch'
|
|
579
579
|
}
|
|
580
580
|
},
|
|
581
|
+
{
|
|
582
|
+
label: {
|
|
583
|
+
en: 'Layout'
|
|
584
|
+
},
|
|
585
|
+
conditionDisplay: 'enablePrice === true',
|
|
586
|
+
setting: {
|
|
587
|
+
id: 'priceLayout'
|
|
588
|
+
},
|
|
589
|
+
layout: 'vertical'
|
|
590
|
+
},
|
|
581
591
|
{
|
|
582
592
|
label: {
|
|
583
593
|
en: 'Product price'
|