@gem-sdk/components 2.0.0-dev.347 → 2.0.0-dev.349
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/article/setting/ArticleList.js +3 -3
- package/dist/cjs/article/setting/configs/ArticleAuthor/presets.js +2 -2
- package/dist/cjs/article/setting/configs/ArticleCategory/presets.js +10 -1
- package/dist/cjs/article/setting/configs/ArticleCategory/uiV2.js +9 -2
- package/dist/cjs/article/setting/configs/ArticleDate/presets.js +1 -1
- package/dist/cjs/article/setting/configs/ArticleExcerpt/settings.js +1 -4
- package/dist/cjs/article/setting/configs/ArticleExcerpt/uiV2.js +15 -0
- package/dist/cjs/article/setting/configs/ArticleImage/uiV2.js +11 -11
- package/dist/cjs/article/setting/configs/ArticleReadMore/presets.js +22 -1
- package/dist/cjs/article/setting/configs/ArticleReadMore/settings.js +42 -7
- package/dist/cjs/article/setting/configs/ArticleReadMore/uiV2.js +73 -103
- package/dist/cjs/article/setting/configs/ArticleTitle/uiV2.js +15 -8
- package/dist/cjs/countdown-timer/components/Countdown.js +103 -307
- package/dist/cjs/countdown-timer/components/Countdown.liquid.js +92 -56
- package/dist/cjs/countdown-timer/components/common/getAttr.js +15 -0
- package/dist/cjs/countdown-timer/components/common/getClasses.js +69 -0
- package/dist/cjs/countdown-timer/components/common/getStyle.js +66 -0
- package/dist/cjs/countdown-timer/components/hooks/useCountDownTimer.js +67 -0
- package/dist/cjs/countdown-timer/{hooks → components/hooks}/useTimeLeft.js +1 -1
- package/dist/cjs/countdown-timer/index.js +1 -1
- package/dist/cjs/countdown-timer/setting/Countdown.js +1 -1
- package/dist/cjs/countdown-timer/setting/configs/settings.js +1 -1
- package/dist/cjs/product/components/ProductProperties/ProductPropertyInput/ProductPropertyInput.liquid.js +1 -1
- package/dist/cjs/product/setting/product-properties/configs/settingsV2.js +43 -14
- package/dist/cjs/product/setting/product-properties/configs/uiV2.js +5 -2
- package/dist/cjs/third-party/components/AliReviews.liquid.js +1 -1
- package/dist/cjs/third-party/components/FeraReviews/FeraReviewsSampleContent.js +3 -3
- package/dist/cjs/third-party/components/FeraReviews/LiquidTemplateByWidget.js +2 -2
- package/dist/cjs/third-party/components/FeraReviews.js +0 -5
- package/dist/cjs/third-party/components/GoogleReviewsByReputon.liquid.js +2 -2
- package/dist/cjs/third-party/components/JudgemeReviews.liquid.js +5 -5
- package/dist/cjs/third-party/components/KachingBundles.liquid.js +1 -1
- package/dist/cjs/third-party/components/KingProductOptions.liquid.js +1 -1
- package/dist/cjs/third-party/components/LaiProductReviews/LiquidTemplateByWiget.js +3 -3
- package/dist/cjs/third-party/components/LooxReviews.liquid.js +1 -1
- package/dist/cjs/third-party/components/Ryviu.liquid.js +1 -1
- package/dist/cjs/third-party/components/Vitals.liquid.js +2 -2
- package/dist/cjs/third-party/setting/TrustshopProductReviews.js +3 -3
- package/dist/cjs/third-party/setting/WhatmoreShoppableVideosreel.js +36 -36
- package/dist/cjs/third-party/types/index.js +5 -0
- package/dist/esm/article/setting/ArticleList.js +3 -3
- package/dist/esm/article/setting/configs/ArticleAuthor/presets.js +2 -2
- package/dist/esm/article/setting/configs/ArticleCategory/presets.js +10 -1
- package/dist/esm/article/setting/configs/ArticleCategory/uiV2.js +9 -2
- package/dist/esm/article/setting/configs/ArticleDate/presets.js +1 -1
- package/dist/esm/article/setting/configs/ArticleExcerpt/settings.js +1 -4
- package/dist/esm/article/setting/configs/ArticleExcerpt/uiV2.js +15 -0
- package/dist/esm/article/setting/configs/ArticleImage/uiV2.js +11 -11
- package/dist/esm/article/setting/configs/ArticleReadMore/presets.js +22 -1
- package/dist/esm/article/setting/configs/ArticleReadMore/settings.js +42 -7
- package/dist/esm/article/setting/configs/ArticleReadMore/uiV2.js +73 -103
- package/dist/esm/article/setting/configs/ArticleTitle/uiV2.js +15 -8
- package/dist/esm/countdown-timer/components/Countdown.js +104 -308
- package/dist/esm/countdown-timer/components/Countdown.liquid.js +93 -57
- package/dist/esm/countdown-timer/components/common/getAttr.js +12 -0
- package/dist/esm/countdown-timer/components/common/getClasses.js +61 -0
- package/dist/esm/countdown-timer/components/common/getStyle.js +60 -0
- package/dist/esm/countdown-timer/components/hooks/useCountDownTimer.js +63 -0
- package/dist/esm/countdown-timer/{hooks → components/hooks}/useTimeLeft.js +1 -1
- package/dist/esm/countdown-timer/index.js +1 -1
- package/dist/esm/countdown-timer/setting/Countdown.js +1 -1
- package/dist/esm/countdown-timer/setting/configs/settings.js +1 -1
- package/dist/esm/product/components/ProductProperties/ProductPropertyInput/ProductPropertyInput.liquid.js +1 -1
- package/dist/esm/product/setting/product-properties/configs/settingsV2.js +43 -14
- package/dist/esm/product/setting/product-properties/configs/uiV2.js +5 -2
- package/dist/esm/third-party/components/AliReviews.liquid.js +1 -1
- package/dist/esm/third-party/components/FeraReviews/FeraReviewsSampleContent.js +1 -1
- package/dist/esm/third-party/components/FeraReviews/LiquidTemplateByWidget.js +1 -1
- package/dist/esm/third-party/components/FeraReviews.js +1 -5
- package/dist/esm/third-party/components/GoogleReviewsByReputon.liquid.js +2 -2
- package/dist/esm/third-party/components/JudgemeReviews.liquid.js +5 -5
- package/dist/esm/third-party/components/KachingBundles.liquid.js +1 -1
- package/dist/esm/third-party/components/KingProductOptions.liquid.js +1 -1
- package/dist/esm/third-party/components/LaiProductReviews/LiquidTemplateByWiget.js +3 -3
- package/dist/esm/third-party/components/LooxReviews.liquid.js +1 -1
- package/dist/esm/third-party/components/Ryviu.liquid.js +1 -1
- package/dist/esm/third-party/components/Vitals.liquid.js +2 -2
- package/dist/esm/third-party/setting/TrustshopProductReviews.js +3 -3
- package/dist/esm/third-party/setting/WhatmoreShoppableVideosreel.js +36 -36
- package/dist/esm/third-party/types/index.js +5 -1
- package/dist/types/index.d.ts +1541 -1531
- package/package.json +1 -1
|
@@ -1,43 +1,81 @@
|
|
|
1
|
-
import { template,
|
|
1
|
+
import { template, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
|
|
2
2
|
import Text from '../../text/components/Text.liquid.js';
|
|
3
3
|
import { getInsertLinkData, getSettingPreloadData } from '../../helpers.js';
|
|
4
|
+
import { createStateOrContext, createStyle, createClass, createAttr, If } from '@gem-sdk/system';
|
|
5
|
+
import { getAttr, getAttrHref } from './common/getAttr.js';
|
|
6
|
+
import { getDateStyle, getTextFrontStyle, getTextBackStyle, getWrapperStyle, getContainStyle } from './common/getStyle.js';
|
|
7
|
+
import { getTextFrontClasses, getWrapperClasses, getContentClasses, getLinkClasses, getDateClasses, getTextBackClasses } from './common/getClasses.js';
|
|
4
8
|
|
|
5
|
-
const Countdown = (
|
|
9
|
+
const Countdown = (props)=>{
|
|
10
|
+
const { setting, styles, builderProps, advanced, pageContext } = props;
|
|
11
|
+
const { labelTypo, numTypo, numTypography, labelTypography } = styles ?? {};
|
|
12
|
+
const { weekLabel, dayLabel, hourLabel, minuteLabel, secondLabel, enableWeek, enableDay, enableHour, enableMinute, enableSecond, redirectUrl, translate } = setting ?? {};
|
|
13
|
+
const hasLinkCover = !!redirectUrl?.link;
|
|
14
|
+
const { urlData } = getInsertLinkData('', redirectUrl);
|
|
15
|
+
const stateData = createStateOrContext({
|
|
16
|
+
...setting,
|
|
17
|
+
...builderProps
|
|
18
|
+
});
|
|
19
|
+
const dateStyle = createStyle({
|
|
20
|
+
...getDateStyle(styles)
|
|
21
|
+
});
|
|
22
|
+
const dateClasses = (dateLabel)=>createClass({
|
|
23
|
+
...getDateClasses(styles, dateLabel)
|
|
24
|
+
});
|
|
25
|
+
const textFrontClasses = createClass({
|
|
26
|
+
...getTextFrontClasses(styles)
|
|
27
|
+
});
|
|
28
|
+
const textFrontStyle = createStyle({
|
|
29
|
+
...getTextFrontStyle(styles)
|
|
30
|
+
});
|
|
31
|
+
const textBackStyle = createStyle({
|
|
32
|
+
...getTextBackStyle(styles)
|
|
33
|
+
});
|
|
34
|
+
const textBackClasses = (textLabel)=>createClass({
|
|
35
|
+
...getTextBackClasses(styles, textLabel)
|
|
36
|
+
});
|
|
37
|
+
const attrs = createAttr({
|
|
38
|
+
...getAttr({
|
|
39
|
+
uid: builderProps?.uid || ''
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
const attrsHref = createAttr({
|
|
43
|
+
...getAttrHref({
|
|
44
|
+
uid: urlData.href || ''
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
const wrapperStyle = createStyle({
|
|
48
|
+
...getWrapperStyle(styles)
|
|
49
|
+
});
|
|
50
|
+
const wrapperClasses = createClass({
|
|
51
|
+
...getWrapperClasses(advanced?.cssClass)
|
|
52
|
+
});
|
|
53
|
+
const containClasses = createClass({
|
|
54
|
+
...getContentClasses()
|
|
55
|
+
});
|
|
56
|
+
const containStyle = createStyle({
|
|
57
|
+
...getContainStyle(styles)
|
|
58
|
+
});
|
|
6
59
|
const timeTemplate = (id, textLabel, translateLabel)=>{
|
|
60
|
+
const textFrontLabel = '00';
|
|
7
61
|
return template`
|
|
8
|
-
<div
|
|
9
|
-
style="${{
|
|
10
|
-
...!styles?.itemPadding?.type ? composeSize(styles?.itemPadding?.custom) : {},
|
|
11
|
-
...handleConvertBorderStyle(styles?.borderState),
|
|
12
|
-
...handleConvertBorderWidth(styles?.borderState),
|
|
13
|
-
...handleConvertBorderColor(styles?.borderState),
|
|
14
|
-
...composeRadius(styles?.roundedState),
|
|
15
|
-
...makeStyle({
|
|
16
|
-
bg: getGlobalColorCSSProp(styles?.backgroundItemColor)
|
|
17
|
-
})
|
|
18
|
-
}}"
|
|
19
|
-
class="${cls(getGlobalColorClass('bg', styles?.backgroundItemColor), 'gp-flex-1 gp-text-center gp-min-w-max !gp-max-w-max', styles?.itemPadding?.type ? genSizeClass(styles?.itemPadding?.type) : '', !textLabel ? 'gp-content-center' : '')}">
|
|
62
|
+
<div style="${dateStyle}" class="${dateClasses(textLabel)}">
|
|
20
63
|
${Text({
|
|
21
64
|
styles: {
|
|
22
|
-
typography:
|
|
23
|
-
typo:
|
|
65
|
+
typography: numTypography,
|
|
66
|
+
typo: numTypo
|
|
24
67
|
},
|
|
25
|
-
builderAttrs: {
|
|
26
|
-
id
|
|
27
|
-
},
|
|
28
|
-
style: {
|
|
29
|
-
...makeStyle({
|
|
30
|
-
mb: styles?.verticalGap,
|
|
31
|
-
c: getGlobalColorCSSProp(styles?.colorNumber)
|
|
32
|
-
})
|
|
33
|
-
},
|
|
34
|
-
className: 'gp-countdown-number',
|
|
35
68
|
setting: {
|
|
36
69
|
...setting,
|
|
37
|
-
text:
|
|
70
|
+
text: textFrontLabel,
|
|
38
71
|
excludeFlex: true,
|
|
39
72
|
translate: ''
|
|
40
73
|
},
|
|
74
|
+
style: textFrontStyle,
|
|
75
|
+
className: textFrontClasses,
|
|
76
|
+
builderAttrs: {
|
|
77
|
+
id
|
|
78
|
+
},
|
|
41
79
|
builderProps: {
|
|
42
80
|
...builderProps,
|
|
43
81
|
uid: builderProps?.uid,
|
|
@@ -46,13 +84,8 @@ const Countdown = ({ builderProps, setting, styles, advanced, pageContext })=>{
|
|
|
46
84
|
})}
|
|
47
85
|
${Text({
|
|
48
86
|
styles: {
|
|
49
|
-
typography:
|
|
50
|
-
typo:
|
|
51
|
-
},
|
|
52
|
-
style: {
|
|
53
|
-
...makeStyle({
|
|
54
|
-
c: getGlobalColorCSSProp(styles?.colorLabel)
|
|
55
|
-
})
|
|
87
|
+
typography: labelTypography,
|
|
88
|
+
typo: labelTypo
|
|
56
89
|
},
|
|
57
90
|
setting: {
|
|
58
91
|
...setting,
|
|
@@ -60,6 +93,8 @@ const Countdown = ({ builderProps, setting, styles, advanced, pageContext })=>{
|
|
|
60
93
|
excludeFlex: true,
|
|
61
94
|
translate: translateLabel
|
|
62
95
|
},
|
|
96
|
+
style: textBackStyle,
|
|
97
|
+
className: textBackClasses(textLabel),
|
|
63
98
|
builderProps: {
|
|
64
99
|
...builderProps,
|
|
65
100
|
uid: builderProps?.uid,
|
|
@@ -70,38 +105,39 @@ const Countdown = ({ builderProps, setting, styles, advanced, pageContext })=>{
|
|
|
70
105
|
</div>
|
|
71
106
|
`;
|
|
72
107
|
};
|
|
73
|
-
const
|
|
108
|
+
const linkClasses = createClass({
|
|
109
|
+
...getLinkClasses()
|
|
110
|
+
});
|
|
111
|
+
const renderScript = ()=>{
|
|
112
|
+
return RenderIf(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-countdown.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-countdown.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);
|
|
113
|
+
};
|
|
74
114
|
return template /* liquid */ `
|
|
75
115
|
<gp-countdown-timer
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
...
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
style="${
|
|
84
|
-
|
|
85
|
-
}}"
|
|
116
|
+
${{
|
|
117
|
+
...attrs
|
|
118
|
+
}}
|
|
119
|
+
${{
|
|
120
|
+
...attrsHref
|
|
121
|
+
}}
|
|
122
|
+
class="${wrapperClasses}"
|
|
123
|
+
style="${wrapperStyle}"
|
|
124
|
+
gp-data='${JSON.stringify(stateData).replaceAll("'", ''')}'
|
|
86
125
|
>
|
|
87
|
-
<div id="section-countdown" class="
|
|
88
|
-
|
|
89
|
-
...makeStyleResponsive('jc', styles?.textAlign)
|
|
90
|
-
}}">
|
|
91
|
-
${RenderIf(!!setting?.redirectUrl?.link, `<a
|
|
126
|
+
<div id="section-countdown" class="${containClasses}" style="${containStyle}">
|
|
127
|
+
${If(hasLinkCover, `<a
|
|
92
128
|
href="${urlData.href}"
|
|
93
129
|
target="${urlData?.target}"
|
|
94
130
|
aria-label="Countdown link"
|
|
95
|
-
class="
|
|
131
|
+
class="${linkClasses}"
|
|
96
132
|
> </a>`)}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
133
|
+
${If(enableWeek, timeTemplate('week', weekLabel, translate ? 'weekLabel' : ''))}
|
|
134
|
+
${If(enableDay, timeTemplate('day', dayLabel, translate ? 'dayLabel' : ''))}
|
|
135
|
+
${If(enableHour, timeTemplate('hour', hourLabel, translate ? 'hourLabel' : ''))}
|
|
136
|
+
${If(enableMinute, timeTemplate('minute', minuteLabel, translate ? 'minuteLabel' : ''))}
|
|
137
|
+
${If(enableSecond, timeTemplate('second', secondLabel, translate ? 'secondLabel' : ''))}
|
|
102
138
|
</div>
|
|
103
139
|
</gp-countdown-timer>
|
|
104
|
-
${
|
|
140
|
+
${renderScript()}
|
|
105
141
|
`;
|
|
106
142
|
};
|
|
107
143
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { getGlobalColorClass, genSizeClass } from '@gem-sdk/core';
|
|
2
|
+
|
|
3
|
+
function composeClasses(classList) {
|
|
4
|
+
return classList.split(' ').reduce((acc, item)=>{
|
|
5
|
+
acc[item] = true;
|
|
6
|
+
return acc;
|
|
7
|
+
}, {});
|
|
8
|
+
}
|
|
9
|
+
const getContentClasses = ()=>{
|
|
10
|
+
const classList = 'gp-flex gp-flex-wrap gp-w-max gp-relative';
|
|
11
|
+
return {
|
|
12
|
+
...composeClasses(classList)
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
const getWrapperClasses = (advancedCssClass)=>{
|
|
16
|
+
let classList = 'gp-flex';
|
|
17
|
+
if (advancedCssClass) classList += ` ${advancedCssClass}`;
|
|
18
|
+
return {
|
|
19
|
+
...composeClasses(classList)
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
const getDateClasses = (styles, dateLabel)=>{
|
|
23
|
+
let classList = 'gp-flex-1 gp-text-center gp-min-w-max !gp-max-w-max';
|
|
24
|
+
const { itemPadding } = styles || {};
|
|
25
|
+
if (itemPadding?.type) classList += ` ${genSizeClass(itemPadding?.type)}`;
|
|
26
|
+
if (!dateLabel) classList += ` gp-content-center`;
|
|
27
|
+
return {
|
|
28
|
+
...composeClasses(classList)
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
const getTextFrontClasses = (styles)=>{
|
|
32
|
+
let classList = 'gp-countdown-number';
|
|
33
|
+
const { colorNumber } = styles || {};
|
|
34
|
+
if (getGlobalColorClass('text', colorNumber)) classList += ` ${getGlobalColorClass('text', colorNumber)}`;
|
|
35
|
+
return {
|
|
36
|
+
...composeClasses(classList)
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const getTextBackClasses = (styles, textLabel)=>{
|
|
40
|
+
let classList = '';
|
|
41
|
+
const { colorLabel } = styles || {};
|
|
42
|
+
if (getGlobalColorClass('text', colorLabel)) classList += ` ${getGlobalColorClass('text', colorLabel)}`;
|
|
43
|
+
if (!textLabel) classList += ` gp-hidden`;
|
|
44
|
+
return {
|
|
45
|
+
...composeClasses(classList)
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
const getLinkClasses = ()=>{
|
|
49
|
+
const classList = 'gp-absolute gp-inset-0 gp-z-1';
|
|
50
|
+
return {
|
|
51
|
+
...composeClasses(classList)
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
const getTextExpireClasses = ()=>{
|
|
55
|
+
const classList = 'gp-flex gp-h-12 gp-items-center gp-justify-center gp-bg-[#d6d6d6] gp-opacity-70';
|
|
56
|
+
return {
|
|
57
|
+
...composeClasses(classList)
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export { getContentClasses, getDateClasses, getLinkClasses, getTextBackClasses, getTextExpireClasses, getTextFrontClasses, getWrapperClasses };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { makeStyleResponsive, composeSize, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertBorderColor, composeRadius, makeStyle, getGlobalColorCSSProp } from '@gem-sdk/core';
|
|
2
|
+
|
|
3
|
+
function filterTruthyStyles(styles) {
|
|
4
|
+
return Object.fromEntries(Object.entries(styles || {}).filter(([, value])=>!!value));
|
|
5
|
+
}
|
|
6
|
+
const getWrapperStyle = (styles)=>{
|
|
7
|
+
const composeStyles = {
|
|
8
|
+
...makeStyleResponsive('jc', styles?.textAlign)
|
|
9
|
+
};
|
|
10
|
+
return filterTruthyStyles(composeStyles);
|
|
11
|
+
};
|
|
12
|
+
const getContainStyle = (styles)=>{
|
|
13
|
+
const { horizontalGap, textAlign } = styles || {};
|
|
14
|
+
const composeStyles = {
|
|
15
|
+
gap: horizontalGap,
|
|
16
|
+
...makeStyleResponsive('jc', textAlign)
|
|
17
|
+
};
|
|
18
|
+
return filterTruthyStyles(composeStyles);
|
|
19
|
+
};
|
|
20
|
+
const getDateStyle = (styles)=>{
|
|
21
|
+
const { borderState, itemPadding, backgroundItemColor, roundedState } = styles || {};
|
|
22
|
+
const composeStyles = {
|
|
23
|
+
...!itemPadding?.type ? composeSize(itemPadding?.custom) : {},
|
|
24
|
+
...handleConvertBorderStyle(borderState),
|
|
25
|
+
...handleConvertBorderWidth(borderState),
|
|
26
|
+
...handleConvertBorderColor(borderState),
|
|
27
|
+
...composeRadius(roundedState),
|
|
28
|
+
...makeStyle({
|
|
29
|
+
bg: getGlobalColorCSSProp(backgroundItemColor)
|
|
30
|
+
})
|
|
31
|
+
};
|
|
32
|
+
return filterTruthyStyles(composeStyles);
|
|
33
|
+
};
|
|
34
|
+
const getTextFrontStyle = (styles)=>{
|
|
35
|
+
const { colorNumber, verticalGap } = styles || {};
|
|
36
|
+
let composeStyles = {};
|
|
37
|
+
if (colorNumber) {
|
|
38
|
+
composeStyles = {
|
|
39
|
+
...makeStyle({
|
|
40
|
+
mb: verticalGap,
|
|
41
|
+
c: getGlobalColorCSSProp(colorNumber)
|
|
42
|
+
})
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return filterTruthyStyles(composeStyles);
|
|
46
|
+
};
|
|
47
|
+
const getTextBackStyle = (styles)=>{
|
|
48
|
+
const { colorLabel } = styles || {};
|
|
49
|
+
let composeStyles = {};
|
|
50
|
+
if (colorLabel) {
|
|
51
|
+
composeStyles = {
|
|
52
|
+
...makeStyle({
|
|
53
|
+
c: getGlobalColorCSSProp(colorLabel)
|
|
54
|
+
})
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return filterTruthyStyles(composeStyles);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export { getContainStyle, getDateStyle, getTextBackStyle, getTextFrontStyle, getWrapperStyle };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useInteraction } from '@gem-sdk/core';
|
|
2
|
+
import { useTransition } from '../../../product/components/ProductVariants/common/common.js';
|
|
3
|
+
import { convertTime } from '../../helpers.js';
|
|
4
|
+
import useTimeLeft from './useTimeLeft.js';
|
|
5
|
+
import { useRef } from 'react';
|
|
6
|
+
|
|
7
|
+
const useCountDownTimer = (setting, builderProps)=>{
|
|
8
|
+
const ref = useRef(null);
|
|
9
|
+
const { trigger } = useInteraction();
|
|
10
|
+
const { timerDaily, timerEverygreen, dateStandard, behaviour, loopAfterFinish, redirectUrl, timeZone, enableDay, enableHour, enableMinute, enableSecond, enableWeek } = setting ?? {};
|
|
11
|
+
const timeLeft = useTimeLeft({
|
|
12
|
+
timerDaily: timerDaily,
|
|
13
|
+
timerEverygreen: timerEverygreen,
|
|
14
|
+
dateStandard: dateStandard,
|
|
15
|
+
behaviour: behaviour,
|
|
16
|
+
loopAfterFinish: loopAfterFinish,
|
|
17
|
+
redirectUrl: redirectUrl,
|
|
18
|
+
timeZone: timeZone
|
|
19
|
+
});
|
|
20
|
+
const { week, day, hour, minute, second } = convertTime(timeLeft, {
|
|
21
|
+
enableWeek: enableWeek,
|
|
22
|
+
enableDay: enableDay,
|
|
23
|
+
enableHour: enableHour,
|
|
24
|
+
enableMinute: enableMinute,
|
|
25
|
+
enableSecond: enableSecond
|
|
26
|
+
});
|
|
27
|
+
useTransition((preTimeLeft)=>{
|
|
28
|
+
if (preTimeLeft !== timeLeft) {
|
|
29
|
+
dispatchInteractionCountdownTimer(timeLeft);
|
|
30
|
+
}
|
|
31
|
+
}, [
|
|
32
|
+
timeLeft
|
|
33
|
+
]);
|
|
34
|
+
const dispatchInteractionCountdownTimer = (timeLeft)=>{
|
|
35
|
+
const element = ref.current;
|
|
36
|
+
const gpInteractionCounter = new Map(Object.entries(JSON.parse(element?.getAttribute('gp-interaction-counter') ?? '{}')));
|
|
37
|
+
if (gpInteractionCounter.size <= 0) return;
|
|
38
|
+
gpInteractionCounter.forEach((_, key)=>{
|
|
39
|
+
if (timeLeft !== Number(key)) return;
|
|
40
|
+
trigger({
|
|
41
|
+
event: 'gp:countdown-timer',
|
|
42
|
+
selector: `[data-id="${builderProps?.uid}"]`,
|
|
43
|
+
element,
|
|
44
|
+
data: Number(key)
|
|
45
|
+
});
|
|
46
|
+
if (!setting?.loopAfterFinish) {
|
|
47
|
+
gpInteractionCounter.delete(key);
|
|
48
|
+
element.setAttribute('gp-interaction-counter', JSON.stringify(Object.fromEntries(gpInteractionCounter)));
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
week,
|
|
54
|
+
day,
|
|
55
|
+
hour,
|
|
56
|
+
minute,
|
|
57
|
+
second,
|
|
58
|
+
timeLeft,
|
|
59
|
+
ref
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export { useCountDownTimer as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo, useState, useRef, useCallback, useEffect } from 'react';
|
|
2
|
-
import { standard, evergreen, daily, refreshAfterFinish } from '
|
|
2
|
+
import { standard, evergreen, daily, refreshAfterFinish } from '../../helpers.js';
|
|
3
3
|
import { useEditorMode } from '@gem-sdk/core';
|
|
4
4
|
|
|
5
5
|
const useTimeLeft = (props)=>{
|
|
@@ -45,7 +45,7 @@ const ProductPropertyInput = ({ setting, styles, builderProps, pageContext, attr
|
|
|
45
45
|
value="${elementValue}"
|
|
46
46
|
class="${inputClasses}"
|
|
47
47
|
style="${inputStyles}"
|
|
48
|
-
${required ? `required="${required}"` : ''}
|
|
48
|
+
${required ? `required="${required}"` : ''}
|
|
49
49
|
minlength="${minChar}"
|
|
50
50
|
maxlength="${maxChar}"
|
|
51
51
|
></${element}>
|
|
@@ -28,7 +28,7 @@ const ProductPropertiesSettingsV2 = [
|
|
|
28
28
|
popoverLabel: 'Type',
|
|
29
29
|
options: [
|
|
30
30
|
{
|
|
31
|
-
label: 'Text',
|
|
31
|
+
label: 'Text field',
|
|
32
32
|
value: 'text',
|
|
33
33
|
type: 'p-image-layout',
|
|
34
34
|
iconName: 'gp-input-text'
|
|
@@ -40,7 +40,7 @@ const ProductPropertiesSettingsV2 = [
|
|
|
40
40
|
iconName: 'gp-input-text-area'
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
|
-
label: 'Email',
|
|
43
|
+
label: 'Email field',
|
|
44
44
|
value: 'email',
|
|
45
45
|
type: 'p-image-layout',
|
|
46
46
|
iconName: 'gp-input-email'
|
|
@@ -52,7 +52,7 @@ const ProductPropertiesSettingsV2 = [
|
|
|
52
52
|
iconName: 'gp-input-checkbox'
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
label: 'Radio',
|
|
55
|
+
label: 'Radio button',
|
|
56
56
|
value: 'radio',
|
|
57
57
|
type: 'p-image-layout',
|
|
58
58
|
iconName: 'gp-input-radio-button'
|
|
@@ -64,7 +64,7 @@ const ProductPropertiesSettingsV2 = [
|
|
|
64
64
|
iconName: 'gp-input-dropdown'
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
|
-
label: 'Hidden',
|
|
67
|
+
label: 'Hidden field',
|
|
68
68
|
value: 'hidden',
|
|
69
69
|
type: 'p-image-layout',
|
|
70
70
|
iconName: 'gp-input-hidden-field'
|
|
@@ -76,7 +76,7 @@ const ProductPropertiesSettingsV2 = [
|
|
|
76
76
|
id: 'label',
|
|
77
77
|
label: 'Label',
|
|
78
78
|
type: 'input',
|
|
79
|
-
default: '',
|
|
79
|
+
default: 'Label',
|
|
80
80
|
placeholder: 'E.g. Input your name below'
|
|
81
81
|
},
|
|
82
82
|
{
|
|
@@ -190,7 +190,7 @@ const ProductPropertiesSettingsV2 = [
|
|
|
190
190
|
id: 'isDisplayLabel',
|
|
191
191
|
label: 'Label',
|
|
192
192
|
type: 'toggle',
|
|
193
|
-
default:
|
|
193
|
+
default: false
|
|
194
194
|
},
|
|
195
195
|
{
|
|
196
196
|
id: 'labelTypo',
|
|
@@ -203,7 +203,8 @@ const ProductPropertiesSettingsV2 = [
|
|
|
203
203
|
}
|
|
204
204
|
},
|
|
205
205
|
hiddenSetting: {
|
|
206
|
-
textAlign: true
|
|
206
|
+
textAlign: true,
|
|
207
|
+
textShadow: true
|
|
207
208
|
},
|
|
208
209
|
ignoreReRender: true
|
|
209
210
|
},
|
|
@@ -247,11 +248,15 @@ const ProductPropertiesSettingsV2 = [
|
|
|
247
248
|
type: 'typography-v2',
|
|
248
249
|
label: 'Typography',
|
|
249
250
|
default: {
|
|
250
|
-
type: 'paragraph-1'
|
|
251
|
+
type: 'paragraph-1',
|
|
252
|
+
attrs: {
|
|
253
|
+
color: 'text-1'
|
|
254
|
+
}
|
|
251
255
|
},
|
|
252
256
|
hiddenSetting: {
|
|
253
257
|
color: false,
|
|
254
|
-
textAlign: true
|
|
258
|
+
textAlign: true,
|
|
259
|
+
textShadow: true
|
|
255
260
|
},
|
|
256
261
|
ignoreReRender: true
|
|
257
262
|
},
|
|
@@ -346,7 +351,9 @@ const ProductPropertiesSettingsV2 = [
|
|
|
346
351
|
type: 'color-picker-v2',
|
|
347
352
|
label: 'Text Color',
|
|
348
353
|
default: {
|
|
349
|
-
normal: 'text-1'
|
|
354
|
+
normal: 'text-1',
|
|
355
|
+
focus: 'transparent',
|
|
356
|
+
hover: 'transparent'
|
|
350
357
|
},
|
|
351
358
|
state: {
|
|
352
359
|
normal: true,
|
|
@@ -359,7 +366,9 @@ const ProductPropertiesSettingsV2 = [
|
|
|
359
366
|
type: 'color-picker-v2',
|
|
360
367
|
label: 'Text Color',
|
|
361
368
|
default: {
|
|
362
|
-
normal: 'text-1'
|
|
369
|
+
normal: 'text-1',
|
|
370
|
+
hover: 'transparent',
|
|
371
|
+
active: 'transparent'
|
|
363
372
|
},
|
|
364
373
|
state: {
|
|
365
374
|
normal: true,
|
|
@@ -375,6 +384,12 @@ const ProductPropertiesSettingsV2 = [
|
|
|
375
384
|
desktop: {
|
|
376
385
|
default: {
|
|
377
386
|
normal: {
|
|
387
|
+
border: 'solid',
|
|
388
|
+
borderWidth: '1px',
|
|
389
|
+
width: '1px',
|
|
390
|
+
color: '#121212'
|
|
391
|
+
},
|
|
392
|
+
hover: {
|
|
378
393
|
borderType: 'none',
|
|
379
394
|
border: 'none',
|
|
380
395
|
borderWidth: '1px',
|
|
@@ -382,7 +397,7 @@ const ProductPropertiesSettingsV2 = [
|
|
|
382
397
|
color: '#121212',
|
|
383
398
|
isCustom: true
|
|
384
399
|
},
|
|
385
|
-
|
|
400
|
+
focus: {
|
|
386
401
|
borderType: 'none',
|
|
387
402
|
border: 'none',
|
|
388
403
|
borderWidth: '1px',
|
|
@@ -407,6 +422,12 @@ const ProductPropertiesSettingsV2 = [
|
|
|
407
422
|
color: '#212121',
|
|
408
423
|
width: '1px',
|
|
409
424
|
borderWidth: '1px'
|
|
425
|
+
},
|
|
426
|
+
focus: {
|
|
427
|
+
border: 'solid',
|
|
428
|
+
color: '#212121',
|
|
429
|
+
width: '1px',
|
|
430
|
+
borderWidth: '1px'
|
|
410
431
|
}
|
|
411
432
|
}
|
|
412
433
|
}
|
|
@@ -418,12 +439,20 @@ const ProductPropertiesSettingsV2 = [
|
|
|
418
439
|
label: 'Background Color',
|
|
419
440
|
devices: {
|
|
420
441
|
desktop: {
|
|
421
|
-
default: {
|
|
442
|
+
default: {
|
|
443
|
+
normal: '#FFFFFF',
|
|
444
|
+
hover: '#DDDDDD',
|
|
445
|
+
focus: 'transparent'
|
|
446
|
+
}
|
|
422
447
|
}
|
|
423
448
|
},
|
|
424
449
|
compoDefaultValue: {
|
|
425
450
|
desktop: {
|
|
426
|
-
default: {
|
|
451
|
+
default: {
|
|
452
|
+
normal: '#FFFFFF',
|
|
453
|
+
hover: '#DDDDDD',
|
|
454
|
+
focus: 'transparent'
|
|
455
|
+
}
|
|
427
456
|
}
|
|
428
457
|
},
|
|
429
458
|
enableGradient: true
|
|
@@ -320,6 +320,7 @@ const SettingUIV2 = [
|
|
|
320
320
|
}
|
|
321
321
|
},
|
|
322
322
|
{
|
|
323
|
+
conditionDisplay: 'isDisplayLabel !== false',
|
|
323
324
|
type: 'combo',
|
|
324
325
|
iconName: 'polaris-text-block',
|
|
325
326
|
getValueFromSettingID: 'label',
|
|
@@ -339,6 +340,7 @@ const SettingUIV2 = [
|
|
|
339
340
|
]
|
|
340
341
|
},
|
|
341
342
|
{
|
|
343
|
+
conditionDisplay: 'isDisplayLabel !== false',
|
|
342
344
|
setting: {
|
|
343
345
|
id: 'labelTypo'
|
|
344
346
|
},
|
|
@@ -535,6 +537,7 @@ const SettingUIV2 = [
|
|
|
535
537
|
},
|
|
536
538
|
type: 'combo',
|
|
537
539
|
isHideClear: true,
|
|
540
|
+
getValueFromSettingID: 'name',
|
|
538
541
|
controls: [
|
|
539
542
|
{
|
|
540
543
|
setting: {
|
|
@@ -626,7 +629,7 @@ const SettingUIV2 = [
|
|
|
626
629
|
},
|
|
627
630
|
{
|
|
628
631
|
type: 'combo',
|
|
629
|
-
conditionDisplay: '["text", "textarea"].includes(type)',
|
|
632
|
+
conditionDisplay: '["text", "textarea"].includes(type) && numberOnly === true',
|
|
630
633
|
label: {
|
|
631
634
|
en: 'Invalid number'
|
|
632
635
|
},
|
|
@@ -666,7 +669,7 @@ const SettingUIV2 = [
|
|
|
666
669
|
},
|
|
667
670
|
{
|
|
668
671
|
type: 'combo',
|
|
669
|
-
conditionDisplay: 'type !== "hidden"',
|
|
672
|
+
conditionDisplay: 'type !== "hidden" && required === true',
|
|
670
673
|
label: {
|
|
671
674
|
en: 'Missing required'
|
|
672
675
|
},
|
|
@@ -14,7 +14,7 @@ const AliReviews = ({ setting, advanced })=>{
|
|
|
14
14
|
{% when 'starRating' %}
|
|
15
15
|
<div class='alireviews-review-star-rating' product-handle='{{product.handle}}' product-id='{{product.id}}'> </div >
|
|
16
16
|
{% when 'reviewBox' %}
|
|
17
|
-
<div class="alireviews-review-box"> </div
|
|
17
|
+
<div class="alireviews-review-box"> </div
|
|
18
18
|
{% endcase %}
|
|
19
19
|
</div>
|
|
20
20
|
`;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { FERA_VERSION } from '../FeraReviews.js';
|
|
4
3
|
import ThirdPartyPreview from '../ThirdPartyPreview.js';
|
|
5
4
|
import FeraReviewsConfig from '../../configs/FeraReviews.js';
|
|
6
5
|
import { useMemo } from 'react';
|
|
6
|
+
import { FERA_VERSION } from '../../types/index.js';
|
|
7
7
|
|
|
8
8
|
const mapWidgetLabelV2 = {
|
|
9
9
|
productReviews: 'Product Reviews',
|