@gem-sdk/components 2.0.0-dev.702 → 2.0.0-dev.704
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/configs/ArticleReadMore/settings.js +86 -134
- package/dist/cjs/button/components/common/helpers.js +2 -9
- package/dist/cjs/button/components/common/styles.js +14 -81
- package/dist/cjs/button/setting/configs/settings.js +85 -133
- package/dist/cjs/coupon/common/classes.js +3 -12
- package/dist/cjs/coupon/common/styles.js +7 -17
- package/dist/cjs/coupon/setting/config/settings.js +60 -100
- package/dist/cjs/form/setting/submit-button/configs/settings.js +103 -250
- package/dist/cjs/helpers.js +4 -1
- package/dist/cjs/image/components/NextImage.liquid.js +2 -2
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/post-purchase/product/settings/product-image/setting-v2.js +2 -2
- package/dist/cjs/post-purchase/product/settings/product-image/uiV2.js +72 -2
- package/dist/cjs/product/components/DynamicCheckout/common/styles.js +12 -12
- package/dist/cjs/product/components/ProductBadge/index.liquid.js +12 -3
- package/dist/cjs/product/components/ProductBadge/utils/generateLiquidContent.js +2 -2
- package/dist/cjs/product/components/ProductButton/common/styles.js +4 -14
- package/dist/cjs/product/components/ProductDescription/index.liquid.js +21 -4
- package/dist/cjs/product/components/ProductImagesV2/common/common.js +1 -1
- package/dist/cjs/product/setting/constant/bundle-layout/horizontalThree.js +1 -0
- package/dist/cjs/product/setting/constant/bundle-layout/horizontalTwo.js +1 -0
- package/dist/cjs/product/setting/constant/bundle-layout/verticalThree.js +1 -0
- package/dist/cjs/product/setting/constant/bundle-layout/verticalTwo.js +1 -0
- package/dist/cjs/product/setting/dynamic-checkout/configs/settings.js +86 -134
- package/dist/cjs/product/setting/product-badge/configs/settings.js +5 -0
- package/dist/cjs/product/setting/product-button/configs/settings.js +142 -222
- package/dist/cjs/product/setting/product-description/configs/settings.js +5 -0
- package/dist/cjs/product/setting/product-view-more/configs/settings.js +100 -148
- package/dist/cjs/stock-counter/components/StockCounter.js +0 -2
- package/dist/cjs/stock-counter/components/StockCounter.liquid.js +44 -3
- package/dist/cjs/stock-counter/components/common/getContent.js +19 -10
- package/dist/cjs/stock-counter/helpers.js +20 -3
- package/dist/cjs/stock-counter/index.js +0 -1
- package/dist/cjs/stock-counter/setting/configs/settingsV2.js +5 -0
- package/dist/cjs/third-party/setting/Selleasy/index.js +5 -5
- package/dist/esm/article/setting/configs/ArticleReadMore/settings.js +86 -134
- package/dist/esm/button/components/common/helpers.js +2 -9
- package/dist/esm/button/components/common/styles.js +16 -81
- package/dist/esm/button/setting/configs/settings.js +85 -133
- package/dist/esm/coupon/common/classes.js +3 -12
- package/dist/esm/coupon/common/styles.js +7 -17
- package/dist/esm/coupon/setting/config/settings.js +60 -100
- package/dist/esm/form/setting/submit-button/configs/settings.js +103 -250
- package/dist/esm/helpers.js +4 -1
- package/dist/esm/image/components/NextImage.liquid.js +2 -2
- package/dist/esm/index.js +1 -0
- package/dist/esm/post-purchase/product/settings/product-image/setting-v2.js +2 -2
- package/dist/esm/post-purchase/product/settings/product-image/uiV2.js +72 -2
- package/dist/esm/product/components/DynamicCheckout/common/styles.js +12 -12
- package/dist/esm/product/components/ProductBadge/index.liquid.js +13 -4
- package/dist/esm/product/components/ProductBadge/utils/generateLiquidContent.js +2 -2
- package/dist/esm/product/components/ProductButton/common/styles.js +4 -14
- package/dist/esm/product/components/ProductDescription/index.liquid.js +22 -5
- package/dist/esm/product/components/ProductImagesV2/common/common.js +1 -1
- package/dist/esm/product/setting/constant/bundle-layout/horizontalThree.js +1 -0
- package/dist/esm/product/setting/constant/bundle-layout/horizontalTwo.js +1 -0
- package/dist/esm/product/setting/constant/bundle-layout/verticalThree.js +1 -0
- package/dist/esm/product/setting/constant/bundle-layout/verticalTwo.js +1 -0
- package/dist/esm/product/setting/dynamic-checkout/configs/settings.js +86 -134
- package/dist/esm/product/setting/product-badge/configs/settings.js +5 -0
- package/dist/esm/product/setting/product-button/configs/settings.js +142 -222
- package/dist/esm/product/setting/product-description/configs/settings.js +5 -0
- package/dist/esm/product/setting/product-view-more/configs/settings.js +100 -148
- package/dist/esm/stock-counter/components/StockCounter.js +0 -2
- package/dist/esm/stock-counter/components/StockCounter.liquid.js +46 -5
- package/dist/esm/stock-counter/components/common/getContent.js +19 -11
- package/dist/esm/stock-counter/helpers.js +20 -4
- package/dist/esm/stock-counter/index.js +0 -1
- package/dist/esm/stock-counter/setting/configs/settingsV2.js +5 -0
- package/dist/esm/third-party/setting/Selleasy/index.js +5 -5
- package/dist/types/index.d.ts +40 -28
- package/package.json +3 -3
|
@@ -91,44 +91,36 @@ const ProductViewMoreSettings = [
|
|
|
91
91
|
{
|
|
92
92
|
id: 'borderBtnV2',
|
|
93
93
|
type: 'border-v2',
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
color: '#121212',
|
|
111
|
-
isCustom: true
|
|
112
|
-
}
|
|
113
|
-
}
|
|
94
|
+
default: {
|
|
95
|
+
normal: {
|
|
96
|
+
borderType: 'none',
|
|
97
|
+
border: 'none',
|
|
98
|
+
borderWidth: '1px',
|
|
99
|
+
width: '1px 1px 1px 1px',
|
|
100
|
+
color: '#121212',
|
|
101
|
+
isCustom: true
|
|
102
|
+
},
|
|
103
|
+
hover: {
|
|
104
|
+
borderType: 'none',
|
|
105
|
+
border: 'none',
|
|
106
|
+
borderWidth: '1px',
|
|
107
|
+
width: '1px 1px 1px 1px',
|
|
108
|
+
color: '#121212',
|
|
109
|
+
isCustom: true
|
|
114
110
|
}
|
|
115
111
|
},
|
|
116
112
|
compoDefaultValue: {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
width: '1px',
|
|
129
|
-
borderWidth: '1px'
|
|
130
|
-
}
|
|
131
|
-
}
|
|
113
|
+
normal: {
|
|
114
|
+
border: 'solid',
|
|
115
|
+
color: '#121212',
|
|
116
|
+
width: '1px',
|
|
117
|
+
borderWidth: '1px'
|
|
118
|
+
},
|
|
119
|
+
hover: {
|
|
120
|
+
border: 'solid',
|
|
121
|
+
color: '#121212',
|
|
122
|
+
width: '1px',
|
|
123
|
+
borderWidth: '1px'
|
|
132
124
|
}
|
|
133
125
|
}
|
|
134
126
|
},
|
|
@@ -148,66 +140,50 @@ const ProductViewMoreSettings = [
|
|
|
148
140
|
{
|
|
149
141
|
id: 'backgroundColorV2',
|
|
150
142
|
type: 'color-picker-v2',
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
normal: 'brand',
|
|
155
|
-
hover: 'highlight'
|
|
156
|
-
}
|
|
157
|
-
}
|
|
143
|
+
default: {
|
|
144
|
+
normal: 'brand',
|
|
145
|
+
hover: 'highlight'
|
|
158
146
|
},
|
|
159
147
|
compoDefaultValue: {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
normal: 'brand',
|
|
163
|
-
hover: 'highlight'
|
|
164
|
-
}
|
|
165
|
-
}
|
|
148
|
+
normal: 'brand',
|
|
149
|
+
hover: 'highlight'
|
|
166
150
|
},
|
|
167
151
|
enableGradient: true
|
|
168
152
|
},
|
|
169
153
|
{
|
|
170
154
|
id: 'backgroundImage',
|
|
171
155
|
type: 'background-image',
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
normal: {},
|
|
176
|
-
hover: {}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
156
|
+
default: {
|
|
157
|
+
normal: {},
|
|
158
|
+
hover: {}
|
|
179
159
|
},
|
|
180
160
|
compoDefaultValue: {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
width: 1200,
|
|
208
|
-
height: 480
|
|
209
|
-
}
|
|
210
|
-
}
|
|
161
|
+
normal: {
|
|
162
|
+
size: 'cover',
|
|
163
|
+
position: {
|
|
164
|
+
x: 50,
|
|
165
|
+
y: 50
|
|
166
|
+
},
|
|
167
|
+
repeat: 'no-repeat',
|
|
168
|
+
attachment: 'scroll',
|
|
169
|
+
image: {
|
|
170
|
+
src: 'https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/',
|
|
171
|
+
width: 1200,
|
|
172
|
+
height: 480
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
hover: {
|
|
176
|
+
size: 'cover',
|
|
177
|
+
position: {
|
|
178
|
+
x: 50,
|
|
179
|
+
y: 50
|
|
180
|
+
},
|
|
181
|
+
repeat: 'no-repeat',
|
|
182
|
+
attachment: 'scroll',
|
|
183
|
+
image: {
|
|
184
|
+
src: 'https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/',
|
|
185
|
+
width: 1200,
|
|
186
|
+
height: 480
|
|
211
187
|
}
|
|
212
188
|
}
|
|
213
189
|
}
|
|
@@ -263,25 +239,17 @@ const ProductViewMoreSettings = [
|
|
|
263
239
|
{
|
|
264
240
|
id: 'boxShadowBtnV2',
|
|
265
241
|
type: 'shadow-v2',
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
default: {
|
|
269
|
-
normal: {}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
242
|
+
default: {
|
|
243
|
+
normal: {}
|
|
272
244
|
},
|
|
273
245
|
compoDefaultValue: {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
color: 'rgba(18, 18, 18, 0.2)',
|
|
282
|
-
angle: 45
|
|
283
|
-
}
|
|
284
|
-
}
|
|
246
|
+
normal: {
|
|
247
|
+
type: 'shadow-2',
|
|
248
|
+
distance: '12px',
|
|
249
|
+
blur: '12px',
|
|
250
|
+
spread: '0px',
|
|
251
|
+
color: 'rgba(18, 18, 18, 0.2)',
|
|
252
|
+
angle: 45
|
|
285
253
|
}
|
|
286
254
|
}
|
|
287
255
|
},
|
|
@@ -302,63 +270,47 @@ const ProductViewMoreSettings = [
|
|
|
302
270
|
{
|
|
303
271
|
id: 'roundedBtnV2',
|
|
304
272
|
type: 'corner-v2',
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
btlr: '0px',
|
|
320
|
-
radiusType: 'none'
|
|
321
|
-
}
|
|
322
|
-
}
|
|
273
|
+
default: {
|
|
274
|
+
normal: {
|
|
275
|
+
btrr: '0px',
|
|
276
|
+
bblr: '0px',
|
|
277
|
+
bbrr: '0px',
|
|
278
|
+
btlr: '0px',
|
|
279
|
+
radiusType: 'none'
|
|
280
|
+
},
|
|
281
|
+
hover: {
|
|
282
|
+
btrr: '0px',
|
|
283
|
+
bblr: '0px',
|
|
284
|
+
bbrr: '0px',
|
|
285
|
+
btlr: '0px',
|
|
286
|
+
radiusType: 'none'
|
|
323
287
|
}
|
|
324
288
|
},
|
|
325
289
|
compoDefaultValue: {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
btlr: '8px',
|
|
340
|
-
radiusType: 'rounded'
|
|
341
|
-
}
|
|
342
|
-
}
|
|
290
|
+
normal: {
|
|
291
|
+
btrr: '8px',
|
|
292
|
+
bblr: '8px',
|
|
293
|
+
bbrr: '8px',
|
|
294
|
+
btlr: '8px',
|
|
295
|
+
radiusType: 'rounded'
|
|
296
|
+
},
|
|
297
|
+
hover: {
|
|
298
|
+
btrr: '8px',
|
|
299
|
+
bblr: '8px',
|
|
300
|
+
bbrr: '8px',
|
|
301
|
+
btlr: '8px',
|
|
302
|
+
radiusType: 'rounded'
|
|
343
303
|
}
|
|
344
304
|
}
|
|
345
305
|
},
|
|
346
306
|
{
|
|
347
307
|
id: 'textColorHover',
|
|
348
308
|
type: 'color-picker-v2',
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
default: {
|
|
352
|
-
hover: 'text-3'
|
|
353
|
-
}
|
|
354
|
-
}
|
|
309
|
+
default: {
|
|
310
|
+
hover: 'text-3'
|
|
355
311
|
},
|
|
356
312
|
compoDefaultValue: {
|
|
357
|
-
|
|
358
|
-
default: {
|
|
359
|
-
hover: 'text-3'
|
|
360
|
-
}
|
|
361
|
-
}
|
|
313
|
+
hover: 'text-3'
|
|
362
314
|
}
|
|
363
315
|
},
|
|
364
316
|
{
|
|
@@ -5,8 +5,6 @@ import { useStockCounterInteraction } from '../hooks/useStockCounterInteraction.
|
|
|
5
5
|
import { getInlineCss } from './common/getInlineCss.js';
|
|
6
6
|
import { getProgressBarClasses, getContainerClasses, getWrapperIconClasses, getIconClasses, getTextClasses, getWrapperClasses } from './common/getClasses.js';
|
|
7
7
|
import { getProgressBarStyles, getContainerStyles, getWrapperStyles, getIconStyles, getTextStyles } from './common/getStyles.js';
|
|
8
|
-
import 'next/link';
|
|
9
|
-
import '@gem-sdk/core';
|
|
10
8
|
import { getWrapperAttrs, getIconAttrs } from './common/getAttrs.js';
|
|
11
9
|
import { createClass, createStyle, createAttr } from '@gem-sdk/system';
|
|
12
10
|
import { useStockCounter } from './hook/useStockCounter.js';
|
|
@@ -1,17 +1,46 @@
|
|
|
1
1
|
import { composeClasses, template, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
|
|
2
|
-
import { getSettingPreloadData } from '../../helpers.js';
|
|
2
|
+
import { getDynamicSourceLocales, getSettingPreloadData } from '../../helpers.js';
|
|
3
3
|
import { getInlineCss } from './common/getInlineCss.js';
|
|
4
4
|
import { getProgressBarClasses, getContainerClasses, getLiquidTagClasses, getWrapperIconClasses, getIconClasses, getTextClasses } from './common/getClasses.js';
|
|
5
5
|
import { getProgressBarStyles, getContainerStyles, getWrapperStyles, getIconStyles, getTextStyles } from './common/getStyles.js';
|
|
6
|
-
import { getLiquidTextContent,
|
|
6
|
+
import { getLiquidInitData, getLiquidTextContent, getTextDisplayData } from './common/getContent.js';
|
|
7
7
|
import { getLiquidTagAttrs, getLiquidProgressBarAttrs, getLiquidTextAttrs, getIconAttrs } from './common/getAttrs.js';
|
|
8
8
|
import { createAttr, createClass, createStyle, LiquidIf } from '@gem-sdk/system';
|
|
9
9
|
|
|
10
|
-
const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
|
|
10
|
+
const StockCounter = ({ setting, styles, style, advanced, builderProps, pageContext })=>{
|
|
11
11
|
const { borderRadius } = styles ?? {};
|
|
12
|
-
const { showIcon, icon, oosIcon, layout = 'full' } = setting ?? {};
|
|
12
|
+
const { showIcon, icon, oosIcon, layout = 'full', template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage } = setting ?? {};
|
|
13
13
|
const inlineCss = getInlineCss(builderProps?.uid, borderRadius);
|
|
14
14
|
const showText = layout !== 'progress-bar';
|
|
15
|
+
const templateStringDisplay = getDynamicSourceLocales({
|
|
16
|
+
val: templateString,
|
|
17
|
+
uid: builderProps?.uid,
|
|
18
|
+
settingId: 'template',
|
|
19
|
+
pageContext,
|
|
20
|
+
translate: setting?.translate,
|
|
21
|
+
isReplaceInventoryQuantity: true
|
|
22
|
+
});
|
|
23
|
+
const outOfStockMessageDisplay = getDynamicSourceLocales({
|
|
24
|
+
val: outOfStockMessage,
|
|
25
|
+
uid: builderProps?.uid,
|
|
26
|
+
settingId: 'outOfStockMessage',
|
|
27
|
+
pageContext,
|
|
28
|
+
translate: setting?.translate
|
|
29
|
+
});
|
|
30
|
+
const continueSellingDisplay = getDynamicSourceLocales({
|
|
31
|
+
val: continueSelling,
|
|
32
|
+
uid: builderProps?.uid,
|
|
33
|
+
settingId: 'continueSelling',
|
|
34
|
+
pageContext,
|
|
35
|
+
translate: setting?.translate
|
|
36
|
+
});
|
|
37
|
+
const unlimitedQuantityMessageDisplay = getDynamicSourceLocales({
|
|
38
|
+
val: unlimitedQuantityMessage,
|
|
39
|
+
uid: builderProps?.uid,
|
|
40
|
+
settingId: 'unlimitedQuantityMessage',
|
|
41
|
+
pageContext,
|
|
42
|
+
translate: setting?.translate
|
|
43
|
+
});
|
|
15
44
|
const liquidTagAttrs = createAttr({
|
|
16
45
|
...getLiquidTagAttrs(builderProps, setting, styles)
|
|
17
46
|
});
|
|
@@ -36,7 +65,12 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
|
|
|
36
65
|
...getWrapperStyles(styles)
|
|
37
66
|
});
|
|
38
67
|
const liquidInitData = getLiquidInitData(setting, styles);
|
|
39
|
-
const liquidTextContent = getLiquidTextContent(
|
|
68
|
+
const liquidTextContent = getLiquidTextContent({
|
|
69
|
+
templateStringDisplay,
|
|
70
|
+
outOfStockMessageDisplay,
|
|
71
|
+
continueSellingDisplay,
|
|
72
|
+
unlimitedQuantityMessageDisplay
|
|
73
|
+
});
|
|
40
74
|
const wrapperIconClasses = createClass({
|
|
41
75
|
...getWrapperIconClasses(setting)
|
|
42
76
|
});
|
|
@@ -69,6 +103,12 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
|
|
|
69
103
|
const textAttrs = createAttr({
|
|
70
104
|
...getLiquidTextAttrs()
|
|
71
105
|
});
|
|
106
|
+
const textDisplayData = getTextDisplayData({
|
|
107
|
+
templateStringDisplay,
|
|
108
|
+
outOfStockMessageDisplay,
|
|
109
|
+
continueSellingDisplay,
|
|
110
|
+
unlimitedQuantityMessageDisplay
|
|
111
|
+
}, styles);
|
|
72
112
|
return template /* liquid */ `
|
|
73
113
|
${liquidInitData}
|
|
74
114
|
<gp-product-stock-counter ${{
|
|
@@ -131,6 +171,7 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
|
|
|
131
171
|
${icon}
|
|
132
172
|
</div>`)}
|
|
133
173
|
`)}
|
|
174
|
+
${textDisplayData}
|
|
134
175
|
${RenderIf(showText, template`
|
|
135
176
|
${LiquidIf('is_out_of_stock', template`<p
|
|
136
177
|
${{
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import { getStaticLocale } from '../../../helpers.js';
|
|
2
1
|
import { CONTINUE_SELLING_WHEN_OUT_OF_STOCK } from '../../const.js';
|
|
3
|
-
import { transformHighlighTag, transformNumberTag } from '../../helpers.js';
|
|
4
2
|
|
|
5
|
-
const getLiquidTextContent = (
|
|
6
|
-
const {
|
|
7
|
-
const { textColor } = styles ?? {};
|
|
8
|
-
const mainColor = textColor || 'brand';
|
|
3
|
+
const getLiquidTextContent = (data)=>{
|
|
4
|
+
const { templateStringDisplay, outOfStockMessageDisplay, continueSellingDisplay, unlimitedQuantityMessageDisplay } = data ?? {};
|
|
9
5
|
return `{% if inventory_management == null and inventory_quantity <= 0 %}
|
|
10
|
-
${
|
|
6
|
+
${unlimitedQuantityMessageDisplay}
|
|
11
7
|
{% elsif available == false %}
|
|
12
|
-
${
|
|
8
|
+
${outOfStockMessageDisplay}
|
|
13
9
|
{% elsif available and inventory_policy == '${CONTINUE_SELLING_WHEN_OUT_OF_STOCK.toLowerCase()}' and inventory_quantity <= 0 %}
|
|
14
|
-
${
|
|
10
|
+
${continueSellingDisplay}
|
|
15
11
|
{% else %}
|
|
16
|
-
${
|
|
12
|
+
${templateStringDisplay}
|
|
17
13
|
{% endif %}`;
|
|
18
14
|
};
|
|
19
15
|
const getLiquidInitData = (setting, styles)=>{
|
|
@@ -66,5 +62,17 @@ const getLiquidInitData = (setting, styles)=>{
|
|
|
66
62
|
}
|
|
67
63
|
{% endcapture %}`;
|
|
68
64
|
};
|
|
65
|
+
const getTextDisplayData = (data, styles)=>{
|
|
66
|
+
const { templateStringDisplay, outOfStockMessageDisplay, continueSellingDisplay, unlimitedQuantityMessageDisplay } = data ?? {};
|
|
67
|
+
const { textColor } = styles ?? {};
|
|
68
|
+
const mainColor = textColor || 'brand';
|
|
69
|
+
return `
|
|
70
|
+
<div class="gp-hidden gp-text-white gp-py-1 gp-px-2 gp-mr-1 gp-inline-block gp-my-[1px] gp-text-g-${mainColor} gp-bg-g-${mainColor}" >
|
|
71
|
+
<div id="template">${templateStringDisplay}</div>
|
|
72
|
+
<div id="out-of-stock-message">${outOfStockMessageDisplay}</div>
|
|
73
|
+
<div id="continue-selling">${continueSellingDisplay}</div>
|
|
74
|
+
<div id="unlimited-quantity-message">${unlimitedQuantityMessageDisplay}</div>
|
|
75
|
+
</div>`;
|
|
76
|
+
};
|
|
69
77
|
|
|
70
|
-
export { getLiquidInitData, getLiquidTextContent };
|
|
78
|
+
export { getLiquidInitData, getLiquidTextContent, getTextDisplayData };
|
|
@@ -26,12 +26,28 @@ const transformNumberTag = (template, stringColor, quantityLeft)=>{
|
|
|
26
26
|
let quantityTag = '';
|
|
27
27
|
// Is hex color
|
|
28
28
|
if (stringColor.includes('#')) {
|
|
29
|
-
quantityTag = `<span style='--c: ${stringColor}'
|
|
29
|
+
quantityTag = `<span style='--c: ${stringColor}'><$quantity$></span>`;
|
|
30
30
|
} else {
|
|
31
31
|
// Is global style color
|
|
32
|
-
quantityTag = `<span class='gp-text-g-${stringColor}'
|
|
32
|
+
quantityTag = `<span class='gp-text-g-${stringColor}'><$quantity$></span>`;
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
if (quantityLeft) {
|
|
35
|
+
quantityTag = quantityTag.replace('<$quantity$>', quantityLeft.toString());
|
|
36
|
+
}
|
|
37
|
+
return template.replaceAll(DEFAULT_QUANTITY_TEMPLATE, quantityTag);
|
|
38
|
+
};
|
|
39
|
+
const convertSizeToWidth = (typographyVar)=>{
|
|
40
|
+
const widthObject = {};
|
|
41
|
+
if (typographyVar['--size']) {
|
|
42
|
+
widthObject['--w'] = typographyVar['--size'];
|
|
43
|
+
}
|
|
44
|
+
if (typographyVar['--size-tablet']) {
|
|
45
|
+
widthObject['--w-tablet'] = typographyVar['--size-tablet'];
|
|
46
|
+
}
|
|
47
|
+
if (typographyVar['--size-mobile']) {
|
|
48
|
+
widthObject['--w-mobile'] = typographyVar['--size-mobile'];
|
|
49
|
+
}
|
|
50
|
+
return widthObject;
|
|
35
51
|
};
|
|
36
52
|
|
|
37
|
-
export { transformHighlighTag, transformNumberTag };
|
|
53
|
+
export { convertSizeToWidth, transformHighlighTag, transformNumberTag };
|
|
@@ -140,6 +140,11 @@ const StockCounterSettingsV2 = [
|
|
|
140
140
|
type: 'textarea',
|
|
141
141
|
autoHeight: true,
|
|
142
142
|
default: 'Hurry! LET BUY NOW'
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
id: 'translate',
|
|
146
|
+
type: 'input',
|
|
147
|
+
default: 'template,outOfStockMessage,continueSelling,unlimitedQuantityMessage'
|
|
143
148
|
}
|
|
144
149
|
]
|
|
145
150
|
},
|
|
@@ -52,17 +52,17 @@ const config = {
|
|
|
52
52
|
type: 'select',
|
|
53
53
|
options: [
|
|
54
54
|
{
|
|
55
|
-
label: '
|
|
56
|
-
value: 'lb-upsell-
|
|
55
|
+
label: 'FBT List',
|
|
56
|
+
value: 'lb-upsell-widget-bl',
|
|
57
57
|
maxOption: 1
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
|
-
label: '
|
|
61
|
-
value: 'lb-upsell-
|
|
60
|
+
label: 'Add-ons List',
|
|
61
|
+
value: 'lb-upsell-widget-pal',
|
|
62
62
|
maxOption: 1
|
|
63
63
|
}
|
|
64
64
|
],
|
|
65
|
-
default: 'lb-upsell-
|
|
65
|
+
default: 'lb-upsell-widget-bl'
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
68
|
id: 'install',
|