@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.
Files changed (72) hide show
  1. package/dist/cjs/article/setting/configs/ArticleReadMore/settings.js +86 -134
  2. package/dist/cjs/button/components/common/helpers.js +2 -9
  3. package/dist/cjs/button/components/common/styles.js +14 -81
  4. package/dist/cjs/button/setting/configs/settings.js +85 -133
  5. package/dist/cjs/coupon/common/classes.js +3 -12
  6. package/dist/cjs/coupon/common/styles.js +7 -17
  7. package/dist/cjs/coupon/setting/config/settings.js +60 -100
  8. package/dist/cjs/form/setting/submit-button/configs/settings.js +103 -250
  9. package/dist/cjs/helpers.js +4 -1
  10. package/dist/cjs/image/components/NextImage.liquid.js +2 -2
  11. package/dist/cjs/index.js +4 -0
  12. package/dist/cjs/post-purchase/product/settings/product-image/setting-v2.js +2 -2
  13. package/dist/cjs/post-purchase/product/settings/product-image/uiV2.js +72 -2
  14. package/dist/cjs/product/components/DynamicCheckout/common/styles.js +12 -12
  15. package/dist/cjs/product/components/ProductBadge/index.liquid.js +12 -3
  16. package/dist/cjs/product/components/ProductBadge/utils/generateLiquidContent.js +2 -2
  17. package/dist/cjs/product/components/ProductButton/common/styles.js +4 -14
  18. package/dist/cjs/product/components/ProductDescription/index.liquid.js +21 -4
  19. package/dist/cjs/product/components/ProductImagesV2/common/common.js +1 -1
  20. package/dist/cjs/product/setting/constant/bundle-layout/horizontalThree.js +1 -0
  21. package/dist/cjs/product/setting/constant/bundle-layout/horizontalTwo.js +1 -0
  22. package/dist/cjs/product/setting/constant/bundle-layout/verticalThree.js +1 -0
  23. package/dist/cjs/product/setting/constant/bundle-layout/verticalTwo.js +1 -0
  24. package/dist/cjs/product/setting/dynamic-checkout/configs/settings.js +86 -134
  25. package/dist/cjs/product/setting/product-badge/configs/settings.js +5 -0
  26. package/dist/cjs/product/setting/product-button/configs/settings.js +142 -222
  27. package/dist/cjs/product/setting/product-description/configs/settings.js +5 -0
  28. package/dist/cjs/product/setting/product-view-more/configs/settings.js +100 -148
  29. package/dist/cjs/stock-counter/components/StockCounter.js +0 -2
  30. package/dist/cjs/stock-counter/components/StockCounter.liquid.js +44 -3
  31. package/dist/cjs/stock-counter/components/common/getContent.js +19 -10
  32. package/dist/cjs/stock-counter/helpers.js +20 -3
  33. package/dist/cjs/stock-counter/index.js +0 -1
  34. package/dist/cjs/stock-counter/setting/configs/settingsV2.js +5 -0
  35. package/dist/cjs/third-party/setting/Selleasy/index.js +5 -5
  36. package/dist/esm/article/setting/configs/ArticleReadMore/settings.js +86 -134
  37. package/dist/esm/button/components/common/helpers.js +2 -9
  38. package/dist/esm/button/components/common/styles.js +16 -81
  39. package/dist/esm/button/setting/configs/settings.js +85 -133
  40. package/dist/esm/coupon/common/classes.js +3 -12
  41. package/dist/esm/coupon/common/styles.js +7 -17
  42. package/dist/esm/coupon/setting/config/settings.js +60 -100
  43. package/dist/esm/form/setting/submit-button/configs/settings.js +103 -250
  44. package/dist/esm/helpers.js +4 -1
  45. package/dist/esm/image/components/NextImage.liquid.js +2 -2
  46. package/dist/esm/index.js +1 -0
  47. package/dist/esm/post-purchase/product/settings/product-image/setting-v2.js +2 -2
  48. package/dist/esm/post-purchase/product/settings/product-image/uiV2.js +72 -2
  49. package/dist/esm/product/components/DynamicCheckout/common/styles.js +12 -12
  50. package/dist/esm/product/components/ProductBadge/index.liquid.js +13 -4
  51. package/dist/esm/product/components/ProductBadge/utils/generateLiquidContent.js +2 -2
  52. package/dist/esm/product/components/ProductButton/common/styles.js +4 -14
  53. package/dist/esm/product/components/ProductDescription/index.liquid.js +22 -5
  54. package/dist/esm/product/components/ProductImagesV2/common/common.js +1 -1
  55. package/dist/esm/product/setting/constant/bundle-layout/horizontalThree.js +1 -0
  56. package/dist/esm/product/setting/constant/bundle-layout/horizontalTwo.js +1 -0
  57. package/dist/esm/product/setting/constant/bundle-layout/verticalThree.js +1 -0
  58. package/dist/esm/product/setting/constant/bundle-layout/verticalTwo.js +1 -0
  59. package/dist/esm/product/setting/dynamic-checkout/configs/settings.js +86 -134
  60. package/dist/esm/product/setting/product-badge/configs/settings.js +5 -0
  61. package/dist/esm/product/setting/product-button/configs/settings.js +142 -222
  62. package/dist/esm/product/setting/product-description/configs/settings.js +5 -0
  63. package/dist/esm/product/setting/product-view-more/configs/settings.js +100 -148
  64. package/dist/esm/stock-counter/components/StockCounter.js +0 -2
  65. package/dist/esm/stock-counter/components/StockCounter.liquid.js +46 -5
  66. package/dist/esm/stock-counter/components/common/getContent.js +19 -11
  67. package/dist/esm/stock-counter/helpers.js +20 -4
  68. package/dist/esm/stock-counter/index.js +0 -1
  69. package/dist/esm/stock-counter/setting/configs/settingsV2.js +5 -0
  70. package/dist/esm/third-party/setting/Selleasy/index.js +5 -5
  71. package/dist/types/index.d.ts +40 -28
  72. package/package.json +3 -3
@@ -14,7 +14,7 @@ var getAttrs = require('./common/getAttrs.js');
14
14
  var constants = require('./constants.js');
15
15
 
16
16
  const ProductBadge = (props)=>{
17
- const { styles, setting } = props;
17
+ const { styles, setting, builderProps, pageContext } = props;
18
18
  const isTextBadge = setting?.shape !== 'image';
19
19
  const isDiscountContent = common.checkDiscountContentProductBadge(setting?.displayContent);
20
20
  const containerStyle = system.createStyle({
@@ -78,7 +78,6 @@ const ProductBadge = (props)=>{
78
78
  })
79
79
  });
80
80
  const createDataState = system.createStateOrContext({
81
- displayContent: setting?.displayContent,
82
81
  minPrice: `{{ minPriceValue | replace: '"', '\\"' | escape }}`,
83
82
  variantIDs: '{{ product.variants | map: "id" | json | escape }}',
84
83
  variantInventoryQuantities: '{{ product.variants | map: "inventory_quantity" | json | escape }}',
@@ -91,9 +90,18 @@ const ProductBadge = (props)=>{
91
90
  productTags: '{{ product.tags | join: "," }}',
92
91
  isTextBadge
93
92
  });
93
+ const { displayContent, translate } = setting ?? {};
94
+ const displayContentVal = helpers.getDynamicSourceLocales({
95
+ val: displayContent?.trim(),
96
+ uid: builderProps?.uid,
97
+ settingId: 'displayContent',
98
+ isLiquid: true,
99
+ pageContext,
100
+ translate
101
+ });
94
102
  return core.template`
95
103
  {% if product %}
96
- ${generateLiquidContent.generateBadgeContent(setting?.displayContent)}
104
+ ${generateLiquidContent.generateBadgeContent(displayContentVal, pageContext?.isPreviewing)}
97
105
  ${renderBadgeLiquid.renderBadgeInFirstTime(setting?.displayTrigger, isDiscountContent, isTextBadge)}
98
106
  <gp-product-badge
99
107
  ${{
@@ -102,6 +110,7 @@ const ProductBadge = (props)=>{
102
110
  gp-data='${core.dataStringify(createDataState)}'
103
111
  class="containerClass"
104
112
  style="${containerStyle}"
113
+ data-display-content="${pageContext?.isPreviewing ? displayContentVal : `{{${displayContentVal}}}`}"
105
114
  >
106
115
  <div class="${wrapperClass}">
107
116
  <div
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const generateBadgeContent = (content)=>{
3
+ const generateBadgeContent = (content, isPreviewing)=>{
4
4
  return `
5
- {% assign content = "${content?.trim()}" %}
5
+ {% assign content = ${isPreviewing ? JSON.stringify(content) : content} %}
6
6
 
7
7
  {%if content.size > 0 %}
8
8
  {% if variant.compare_at_price and variant.compare_at_price > 0 %}
@@ -51,18 +51,8 @@ const getSoldOutButtonStyles = (styles)=>{
51
51
  const mapStylesByDevice = (target, key, value)=>{
52
52
  if (value) {
53
53
  target[key] = {
54
- desktop: {
55
- normal: value.desktop?.normal,
56
- hover: target[key]?.desktop?.hover
57
- },
58
- tablet: {
59
- normal: value.tablet?.normal,
60
- hover: target[key]?.tablet?.hover
61
- },
62
- mobile: {
63
- normal: value.mobile?.normal,
64
- hover: target[key]?.mobile?.hover
65
- }
54
+ normal: value?.normal,
55
+ hover: target[key]?.hover
66
56
  };
67
57
  }
68
58
  };
@@ -70,10 +60,10 @@ const getSoldOutButtonStyles = (styles)=>{
70
60
  mapStylesByDevice(buttonSoldOutStyles, 'boxShadowBtnV2', oosShadowV2);
71
61
  mapStylesByDevice(buttonSoldOutStyles, 'roundedBtnV2', oosRoundedV2);
72
62
  mapStylesByDevice(buttonSoldOutStyles, 'borderBtnV2', oosBorderV2);
73
- if (oosTextColorV2?.desktop?.normal) {
63
+ if (oosTextColorV2?.normal) {
74
64
  buttonSoldOutStyles.typo = buttonSoldOutStyles.typo ?? {};
75
65
  buttonSoldOutStyles.typo.attrs = buttonSoldOutStyles.typo.attrs ?? {};
76
- buttonSoldOutStyles.typo.attrs.color = oosTextColorV2.desktop.normal;
66
+ buttonSoldOutStyles.typo.attrs.color = oosTextColorV2.normal;
77
67
  }
78
68
  return {
79
69
  ...getButtonBaseStyles(),
@@ -10,8 +10,8 @@ var getStyle = require('./common/getStyle.js');
10
10
  var _const = require('./common/const.js');
11
11
 
12
12
  const ProductDescription = (props)=>{
13
- const { setting, advanced, builderProps } = props;
14
- const { htmlTag } = setting ?? {};
13
+ const { setting, advanced, builderProps, pageContext } = props;
14
+ const { htmlTag, translate, viewMoreText, viewLessText } = setting ?? {};
15
15
  const Tag = htmlTag === 'html' ? 'div' : 'p';
16
16
  const gpDescriptionClasses = system.createClass({
17
17
  'gp-product-description': true,
@@ -62,11 +62,28 @@ const ProductDescription = (props)=>{
62
62
  },
63
63
  textStyle
64
64
  });
65
+ const viewMoreTextDisplay = helpers.getDynamicSourceLocales({
66
+ val: viewMoreText,
67
+ uid: builderProps?.uid,
68
+ settingId: 'viewMoreText',
69
+ pageContext,
70
+ translate
71
+ });
72
+ const viewLessTextDisplay = helpers.getDynamicSourceLocales({
73
+ val: viewLessText,
74
+ uid: builderProps?.uid,
75
+ settingId: 'viewLessText',
76
+ pageContext,
77
+ translate
78
+ });
65
79
  return system.LiquidIf(noDescriptionHtml, '', system.Liquid(core.template`
66
80
  <gp-product-description-v2
67
81
  ${attr}
68
82
  class="${gpDescriptionClasses}"
69
- gp-data='${core.dataStringify(stateData).replaceAll("'", '&#039;')}'>
83
+ gp-data='${core.dataStringify(stateData).replaceAll("'", '&#039;')}'
84
+ data-view-more-text="${viewMoreTextDisplay}"
85
+ data-view-less-text="${viewLessTextDisplay}"
86
+ >
70
87
  <style>${textDescriptionCss}</style>
71
88
  <div class="${classPreBuilt}" ></div>
72
89
  ${system.LiquidUnless('product', `<p>Product not found</p>`, core.template`<${Tag} ${textAttr} class="${textClasses}" style="${textStyle}">
@@ -74,7 +91,7 @@ const ProductDescription = (props)=>{
74
91
  </${Tag}>
75
92
  ${system.LiquidUnless(noDescriptionHtml, core.template`<button type="button" class="${buttonClasses}" style="${buttonStyle}">
76
93
  <span class="${showMoreTextClasses}">
77
- ${system.If(false, setting?.viewLessText || '', setting?.viewMoreText)}
94
+ ${system.If(false, viewLessTextDisplay?.toString(), viewMoreTextDisplay?.toString())}
78
95
  </span>
79
96
  ${system.If(setting?.enableViewMoreIcon, core.template`<span class="${showMoreIconClasses}">${_const.ICON_SVG}</span>`, ' ')}
80
97
  </button>`)}`)}
@@ -335,7 +335,7 @@ const getPaddingBottomByShapeSetting = (shapeSetting)=>{
335
335
  };
336
336
  return;
337
337
  }
338
- const value = aspectRatio?.[device] !== 'auto' && !!aspectRatio?.[device] ? aspectRatio?.[device]?.split('/').reverse().join('') : '{%if media.height%} {{media.height}} / {{media.width}} {%else%} 100 / 100 {%endif%}';
338
+ const value = aspectRatio?.[device] !== 'auto' && !!aspectRatio?.[device] ? aspectRatio?.[device]?.split('/').reverse().join('/') : '{%if media.height%} {{media.height}} / {{media.width}} {%else%} 100 / 100 {%endif%}';
339
339
  result = {
340
340
  ...result,
341
341
  [device]: `calc((${value})*100%)`
@@ -60,6 +60,7 @@ const horizontalThree = [
60
60
  settings: {
61
61
  contentType: 'text',
62
62
  displayContent: 'SALE {percent_discount}',
63
+ translate: 'displayContent',
63
64
  displayTrigger: [
64
65
  {
65
66
  conditionType: 'exact_or_above',
@@ -59,6 +59,7 @@ const horizontalTwo = [
59
59
  settings: {
60
60
  contentType: 'text',
61
61
  displayContent: 'SALE {percent_discount}',
62
+ translate: 'displayContent',
62
63
  displayTrigger: [
63
64
  {
64
65
  conditionType: 'exact_or_above',
@@ -200,6 +200,7 @@ const verticalThree = [
200
200
  settings: {
201
201
  contentType: 'text',
202
202
  displayContent: 'SALE {percent_discount}',
203
+ translate: 'displayContent',
203
204
  displayTrigger: [
204
205
  {
205
206
  conditionType: 'exact_or_above',
@@ -200,6 +200,7 @@ const verticalTwo = [
200
200
  settings: {
201
201
  contentType: 'text',
202
202
  displayContent: 'SALE {percent_discount}',
203
+ translate: 'displayContent',
203
204
  displayTrigger: [
204
205
  {
205
206
  conditionType: 'exact_or_above',
@@ -59,52 +59,36 @@ const DynamicCheckoutSettings = [
59
59
  {
60
60
  id: 'backgroundColorV2',
61
61
  type: 'color-picker-v2',
62
- devices: {
63
- desktop: {
64
- default: {
65
- normal: 'brand',
66
- hover: 'highlight'
67
- }
68
- }
62
+ default: {
63
+ normal: 'brand',
64
+ hover: 'highlight'
69
65
  },
70
66
  compoDefaultValue: {
71
- desktop: {
72
- default: {
73
- normal: 'brand',
74
- hover: 'highlight'
75
- }
76
- }
67
+ normal: 'brand',
68
+ hover: 'highlight'
77
69
  },
78
70
  enableGradient: true
79
71
  },
80
72
  {
81
73
  id: 'backgroundImage',
82
74
  type: 'background-image',
83
- devices: {
84
- desktop: {
85
- default: {
86
- normal: {},
87
- hover: {}
88
- }
89
- }
75
+ default: {
76
+ normal: {},
77
+ hover: {}
90
78
  },
91
79
  compoDefaultValue: {
92
- desktop: {
93
- default: {
94
- normal: {
95
- image: {
96
- src: 'https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/',
97
- width: 1200,
98
- height: 480
99
- }
100
- },
101
- hover: {
102
- image: {
103
- src: 'https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/',
104
- width: 1200,
105
- height: 480
106
- }
107
- }
80
+ normal: {
81
+ image: {
82
+ src: 'https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/',
83
+ width: 1200,
84
+ height: 480
85
+ }
86
+ },
87
+ hover: {
88
+ image: {
89
+ src: 'https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/',
90
+ width: 1200,
91
+ height: 480
108
92
  }
109
93
  }
110
94
  }
@@ -141,44 +125,36 @@ const DynamicCheckoutSettings = [
141
125
  {
142
126
  id: 'borderBtnV2',
143
127
  type: 'border-v2',
144
- devices: {
145
- desktop: {
146
- default: {
147
- normal: {
148
- borderType: 'none',
149
- border: 'none',
150
- borderWidth: '1px',
151
- width: '1px 1px 1px 1px',
152
- color: '#121212',
153
- isCustom: true
154
- },
155
- hover: {
156
- borderType: 'none',
157
- border: 'none',
158
- borderWidth: '1px',
159
- width: '1px 1px 1px 1px',
160
- color: '#121212',
161
- isCustom: true
162
- }
163
- }
128
+ default: {
129
+ normal: {
130
+ borderType: 'none',
131
+ border: 'none',
132
+ borderWidth: '1px',
133
+ width: '1px 1px 1px 1px',
134
+ color: '#121212',
135
+ isCustom: true
136
+ },
137
+ hover: {
138
+ borderType: 'none',
139
+ border: 'none',
140
+ borderWidth: '1px',
141
+ width: '1px 1px 1px 1px',
142
+ color: '#121212',
143
+ isCustom: true
164
144
  }
165
145
  },
166
146
  compoDefaultValue: {
167
- desktop: {
168
- default: {
169
- normal: {
170
- border: 'solid',
171
- color: '#212121',
172
- width: '1px',
173
- borderWidth: '1px'
174
- },
175
- hover: {
176
- border: 'solid',
177
- color: '#212121',
178
- width: '1px',
179
- borderWidth: '1px'
180
- }
181
- }
147
+ normal: {
148
+ border: 'solid',
149
+ color: '#212121',
150
+ width: '1px',
151
+ borderWidth: '1px'
152
+ },
153
+ hover: {
154
+ border: 'solid',
155
+ color: '#212121',
156
+ width: '1px',
157
+ borderWidth: '1px'
182
158
  }
183
159
  }
184
160
  },
@@ -247,69 +223,53 @@ const DynamicCheckoutSettings = [
247
223
  {
248
224
  id: 'boxShadowBtnV2',
249
225
  type: 'shadow-v2',
250
- devices: {
251
- desktop: {
252
- default: {
253
- normal: {}
254
- }
255
- }
226
+ default: {
227
+ normal: {}
256
228
  },
257
229
  compoDefaultValue: {
258
- desktop: {
259
- default: {
260
- normal: {
261
- type: 'shadow-1',
262
- distance: '4px',
263
- blur: '4px',
264
- spread: '0px',
265
- color: '#121212',
266
- angle: 45
267
- }
268
- }
230
+ normal: {
231
+ type: 'shadow-1',
232
+ distance: '4px',
233
+ blur: '4px',
234
+ spread: '0px',
235
+ color: '#121212',
236
+ angle: 45
269
237
  }
270
238
  }
271
239
  },
272
240
  {
273
241
  id: 'roundedBtnV2',
274
242
  type: 'corner-v2',
275
- devices: {
276
- desktop: {
277
- default: {
278
- normal: {
279
- btrr: '0px',
280
- bblr: '0px',
281
- bbrr: '0px',
282
- btlr: '0px',
283
- radiusType: 'none'
284
- },
285
- hover: {
286
- btrr: '0px',
287
- bblr: '0px',
288
- bbrr: '0px',
289
- btlr: '0px',
290
- radiusType: 'none'
291
- }
292
- }
243
+ default: {
244
+ normal: {
245
+ btrr: '0px',
246
+ bblr: '0px',
247
+ bbrr: '0px',
248
+ btlr: '0px',
249
+ radiusType: 'none'
250
+ },
251
+ hover: {
252
+ btrr: '0px',
253
+ bblr: '0px',
254
+ bbrr: '0px',
255
+ btlr: '0px',
256
+ radiusType: 'none'
293
257
  }
294
258
  },
295
259
  compoDefaultValue: {
296
- desktop: {
297
- default: {
298
- normal: {
299
- btrr: '8px',
300
- bblr: '8px',
301
- bbrr: '8px',
302
- btlr: '8px',
303
- radiusType: 'rounded'
304
- },
305
- hover: {
306
- btrr: '8px',
307
- bblr: '8px',
308
- bbrr: '8px',
309
- btlr: '8px',
310
- radiusType: 'rounded'
311
- }
312
- }
260
+ normal: {
261
+ btrr: '8px',
262
+ bblr: '8px',
263
+ bbrr: '8px',
264
+ btlr: '8px',
265
+ radiusType: 'rounded'
266
+ },
267
+ hover: {
268
+ btrr: '8px',
269
+ bblr: '8px',
270
+ bbrr: '8px',
271
+ btlr: '8px',
272
+ radiusType: 'rounded'
313
273
  }
314
274
  }
315
275
  },
@@ -408,19 +368,11 @@ const DynamicCheckoutSettings = [
408
368
  {
409
369
  id: 'textColorHover',
410
370
  type: 'color-picker-v2',
411
- devices: {
412
- desktop: {
413
- default: {
414
- hover: 'text-3'
415
- }
416
- }
371
+ default: {
372
+ hover: 'text-3'
417
373
  },
418
374
  compoDefaultValue: {
419
- desktop: {
420
- default: {
421
- hover: 'text-3'
422
- }
423
- }
375
+ hover: 'text-3'
424
376
  }
425
377
  },
426
378
  {
@@ -134,6 +134,11 @@ const ProductBadgeSettings = [
134
134
  message: `{inventory_quantity} Only work with product enable “Track inventory”`,
135
135
  closable: true
136
136
  },
137
+ {
138
+ id: 'translate',
139
+ type: 'input',
140
+ default: 'displayContent'
141
+ },
137
142
  {
138
143
  id: 'contentType',
139
144
  label: 'Shape',