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