@gem-sdk/components 2.0.0-dev.355 → 2.0.0-dev.356

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 (70) hide show
  1. package/dist/cjs/builder.js +1 -1
  2. package/dist/cjs/button/components/Button.js +5 -3
  3. package/dist/cjs/button/components/Button.liquid.js +7 -3
  4. package/dist/cjs/button/components/common/attributes.js +1 -2
  5. package/dist/cjs/button/components/common/helpers.js +2 -2
  6. package/dist/cjs/button/components/common/styles.js +29 -1
  7. package/dist/cjs/button/setting/configs/settings.js +24 -4
  8. package/dist/cjs/button/setting/configs/uiV2.js +46 -8
  9. package/dist/cjs/image/setting/configs/uiV2.js +5 -1
  10. package/dist/cjs/index.js +1 -1
  11. package/dist/cjs/post-purchase/callout-banner/setting/config/callout-text/setting.js +4 -3
  12. package/dist/cjs/post-purchase/product/components/product-offer/common/attrs.js +14 -0
  13. package/dist/cjs/post-purchase/product/components/product-offer/common/classes.js +29 -0
  14. package/dist/cjs/post-purchase/product/components/product-offer/common/styles.js +27 -0
  15. package/dist/cjs/post-purchase/product/components/product-offer/components/ProductOffer.js +53 -0
  16. package/dist/cjs/post-purchase/product/components/product-offer/components/ProductOfferItem.js +45 -0
  17. package/dist/cjs/post-purchase/product/components/product-offer/hooks/useProductOfferData.js +57 -0
  18. package/dist/cjs/post-purchase/product/index.js +2 -2
  19. package/dist/cjs/post-purchase/product/next.js +1 -1
  20. package/dist/cjs/post-purchase/product/settings/{ProductOffer.js → product-offer/index.js} +23 -143
  21. package/dist/cjs/post-purchase/product/settings/product-offer/ui/uiV1.js +140 -0
  22. package/dist/cjs/post-purchase/product/settings/product-offer/ui/uiV2.js +141 -0
  23. package/dist/cjs/post-purchase/utils/constants.js +6 -0
  24. package/dist/cjs/product/components/ProductViewMore/ProductViewMore.js +17 -18
  25. package/dist/cjs/product/components/ProductViewMore/ProductViewMore.liquid.js +14 -21
  26. package/dist/cjs/product/components/ProductViewMore/common/data.js +26 -0
  27. package/dist/cjs/product/components/ProductViewMore/common/styles.js +12 -0
  28. package/dist/cjs/product/setting/dynamic-checkout/configs/settings.js +9 -5
  29. package/dist/cjs/product/setting/dynamic-checkout/configs/uiV2.js +10 -10
  30. package/dist/cjs/product/setting/product-button/configs/settings.js +1 -0
  31. package/dist/cjs/product/setting/product-button/configs/uiV2.js +1 -1
  32. package/dist/cjs/product/setting/product-view-more/configs/settings.js +17 -16
  33. package/dist/cjs/product/setting/product-view-more/configs/uiV2.js +45 -45
  34. package/dist/esm/builder.js +1 -1
  35. package/dist/esm/button/components/Button.js +5 -3
  36. package/dist/esm/button/components/Button.liquid.js +7 -3
  37. package/dist/esm/button/components/common/attributes.js +1 -2
  38. package/dist/esm/button/components/common/helpers.js +2 -2
  39. package/dist/esm/button/components/common/styles.js +29 -3
  40. package/dist/esm/button/setting/configs/settings.js +24 -4
  41. package/dist/esm/button/setting/configs/uiV2.js +46 -8
  42. package/dist/esm/image/setting/configs/uiV2.js +5 -1
  43. package/dist/esm/index.js +1 -1
  44. package/dist/esm/post-purchase/callout-banner/setting/config/callout-text/setting.js +4 -3
  45. package/dist/esm/post-purchase/product/components/product-offer/common/attrs.js +12 -0
  46. package/dist/esm/post-purchase/product/components/product-offer/common/classes.js +25 -0
  47. package/dist/esm/post-purchase/product/components/product-offer/common/styles.js +24 -0
  48. package/dist/esm/post-purchase/product/components/product-offer/components/ProductOffer.js +49 -0
  49. package/dist/esm/post-purchase/product/components/product-offer/components/ProductOfferItem.js +43 -0
  50. package/dist/esm/post-purchase/product/components/product-offer/hooks/useProductOfferData.js +55 -0
  51. package/dist/esm/post-purchase/product/index.js +1 -1
  52. package/dist/esm/post-purchase/product/next.js +1 -1
  53. package/dist/esm/post-purchase/product/settings/{ProductOffer.js → product-offer/index.js} +23 -143
  54. package/dist/esm/post-purchase/product/settings/product-offer/ui/uiV1.js +138 -0
  55. package/dist/esm/post-purchase/product/settings/product-offer/ui/uiV2.js +139 -0
  56. package/dist/esm/post-purchase/utils/constants.js +6 -1
  57. package/dist/esm/product/components/ProductViewMore/ProductViewMore.js +17 -18
  58. package/dist/esm/product/components/ProductViewMore/ProductViewMore.liquid.js +14 -21
  59. package/dist/esm/product/components/ProductViewMore/common/data.js +23 -0
  60. package/dist/esm/product/components/ProductViewMore/common/styles.js +10 -0
  61. package/dist/esm/product/setting/dynamic-checkout/configs/settings.js +9 -5
  62. package/dist/esm/product/setting/dynamic-checkout/configs/uiV2.js +10 -10
  63. package/dist/esm/product/setting/product-button/configs/settings.js +1 -0
  64. package/dist/esm/product/setting/product-button/configs/uiV2.js +1 -1
  65. package/dist/esm/product/setting/product-view-more/configs/settings.js +17 -16
  66. package/dist/esm/product/setting/product-view-more/configs/uiV2.js +45 -45
  67. package/dist/types/index.d.ts +32 -8
  68. package/package.json +2 -2
  69. package/dist/cjs/post-purchase/product/components/ProductOffer.js +0 -138
  70. package/dist/esm/post-purchase/product/components/ProductOffer.js +0 -133
@@ -0,0 +1,139 @@
1
+ const ProductOfferSettingUIV2 = [
2
+ {
3
+ label: {
4
+ en: 'Layout'
5
+ },
6
+ controls: [
7
+ {
8
+ type: 'control',
9
+ label: {
10
+ en: ''
11
+ },
12
+ setting: {
13
+ id: 'layout'
14
+ },
15
+ layout: 'vertical'
16
+ }
17
+ ]
18
+ },
19
+ {
20
+ label: {
21
+ en: 'Product source'
22
+ },
23
+ controls: [
24
+ {
25
+ setting: {
26
+ id: 'productSetting'
27
+ },
28
+ layout: 'vertical'
29
+ }
30
+ ]
31
+ },
32
+ {
33
+ label: {
34
+ en: 'Column spacing'
35
+ },
36
+ controls: [
37
+ {
38
+ type: 'control',
39
+ label: {
40
+ en: 'Gap'
41
+ },
42
+ setting: {
43
+ id: 'columnGap'
44
+ },
45
+ conditionDisplay: '(productSetting?.productIds?.length || 0) === 1'
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ label: {
51
+ en: 'Display'
52
+ },
53
+ controls: [
54
+ {
55
+ type: 'control',
56
+ label: {
57
+ en: 'Layout'
58
+ },
59
+ setting: {
60
+ id: 'productOfferLayout'
61
+ },
62
+ conditionDisplay: `(productSetting?.productIds?.length || 0) > 1`
63
+ },
64
+ {
65
+ type: 'control',
66
+ label: {
67
+ en: 'Quantity'
68
+ },
69
+ setting: {
70
+ id: 'dynamicOfferQuantity'
71
+ },
72
+ conditionDisplay: `(productSetting?.productIds?.length || 0) == 0`
73
+ },
74
+ {
75
+ type: 'control',
76
+ label: {
77
+ en: 'Row gap'
78
+ },
79
+ setting: {
80
+ id: 'productOfferVerticalGutter'
81
+ }
82
+ },
83
+ {
84
+ type: 'control',
85
+ label: {
86
+ en: 'Column gap'
87
+ },
88
+ setting: {
89
+ id: 'productOfferColumnGap'
90
+ }
91
+ }
92
+ ]
93
+ },
94
+ {
95
+ controls: [
96
+ {
97
+ type: 'control',
98
+ label: {
99
+ en: ''
100
+ },
101
+ setting: {
102
+ id: 'discountAndShippingFee'
103
+ },
104
+ layout: 'vertical'
105
+ }
106
+ ]
107
+ },
108
+ {
109
+ label: {
110
+ en: 'Size'
111
+ },
112
+ controls: [
113
+ {
114
+ type: 'control',
115
+ label: {
116
+ en: 'Width'
117
+ },
118
+ setting: {
119
+ id: 'productOfferWidth'
120
+ }
121
+ }
122
+ ]
123
+ },
124
+ {
125
+ controls: [
126
+ {
127
+ label: {
128
+ en: 'Align'
129
+ },
130
+ setting: {
131
+ id: 'inlineAlignment'
132
+ },
133
+ conditionDisplay: `productOfferWidth !== '100%'`
134
+ }
135
+ ]
136
+ }
137
+ ];
138
+
139
+ export { ProductOfferSettingUIV2 };
@@ -52,5 +52,10 @@ const postPurchaseViewSpacing = [
52
52
  value: 'extraLoose'
53
53
  }
54
54
  ];
55
+ const DEVICES = [
56
+ 'desktop',
57
+ 'tablet',
58
+ 'mobile'
59
+ ];
55
60
 
56
- export { postPurchaseSpacing, postPurchaseViewSpacing };
61
+ export { DEVICES, postPurchaseSpacing, postPurchaseViewSpacing };
@@ -1,25 +1,24 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
+ import { getButtonStyle } from './common/styles.js';
4
+ import { getButtonSettings } from './common/data.js';
3
5
  import Button from '../../../button/components/Button.js';
4
6
 
5
- const ProductViewMore = ({ setting, builderProps, builderAttrs, style, styles, advanced, children })=>{
6
- const { ...buttonStyles } = styles ?? {};
7
- const { label, iconSvg, iconAlign, iconVisible, shouldClearSpace } = setting ?? {};
8
- return /*#__PURE__*/ jsx(Button, {
9
- builderProps: builderProps,
10
- builderAttrs: builderAttrs,
11
- advanced: advanced,
12
- setting: {
13
- label,
14
- htmlType: 'submit',
15
- iconAlign: iconAlign,
16
- iconSvg: iconSvg,
17
- iconVisible: iconVisible,
18
- shouldClearSpace
19
- },
20
- style: style,
21
- styles: buttonStyles,
22
- children: children
7
+ const ProductViewMore = ({ style, styles, setting, advanced, builderProps, builderAttrs, children })=>{
8
+ return /*#__PURE__*/ jsx("div", {
9
+ children: /*#__PURE__*/ jsx(Button, {
10
+ styles: styles,
11
+ advanced: advanced,
12
+ builderProps: builderProps,
13
+ builderAttrs: builderAttrs,
14
+ setting: {
15
+ ...getButtonSettings(setting)
16
+ },
17
+ style: {
18
+ ...getButtonStyle(style, styles)
19
+ },
20
+ children: children
21
+ })
23
22
  });
24
23
  };
25
24
 
@@ -1,36 +1,29 @@
1
- import { template, makeStyleResponsive, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
2
- import Button from '../../../button/components/Button.liquid.js';
1
+ import { If } from '@gem-sdk/system';
2
+ import { getButtonStyle } from './common/styles.js';
3
3
  import { getSettingPreloadData } from '../../../helpers.js';
4
+ import Button from '../../../button/components/Button.liquid.js';
5
+ import { template, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
6
+ import { getButtonSettings, getButtonLiquidSettings } from './common/data.js';
4
7
 
5
- const ProductViewMore = ({ setting, builderProps, builderAttrs, style, styles, advanced, pageContext })=>{
6
- const { ...buttonStyles } = styles ?? {};
7
- const { label, iconSvg, iconAlign, iconVisible, translate } = setting ?? {};
8
+ const ProductViewMore = ({ style, styles, setting, advanced, builderProps, builderAttrs, pageContext })=>{
8
9
  return template`
9
10
  <gp-product-view-more>
10
11
  ${Button({
11
- className: 'btn-view-more',
12
+ styles: styles,
13
+ advanced: advanced,
12
14
  builderProps: builderProps,
13
15
  builderAttrs: builderAttrs,
14
16
  setting: {
15
- label: label,
16
- iconAlign: iconAlign,
17
- btnLink: {
18
- link: '{{ product.url }}',
19
- target: setting?.target === 'new-tab' ? '_blank' : '_self'
20
- },
21
- iconSvg: iconSvg,
22
- iconVisible: iconVisible,
23
- translate
17
+ ...getButtonSettings(setting),
18
+ ...getButtonLiquidSettings(setting)
24
19
  },
25
20
  style: {
26
- ...style,
27
- ...makeStyleResponsive('ta', styles?.align)
21
+ ...getButtonStyle(style, styles)
28
22
  },
29
- styles: buttonStyles,
30
- advanced,
31
- pageContext
23
+ pageContext,
24
+ className: 'btn-view-more'
32
25
  })}
33
- ${RenderIf(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-product-view-more.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-product-view-more.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
26
+ ${If(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-product-view-more.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-product-view-more.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
34
27
  </gp-product-view-more>
35
28
  `;
36
29
  };
@@ -0,0 +1,23 @@
1
+ const getButtonSettings = (setting)=>{
2
+ const { label, iconSvg, iconAlign, iconVisible, shouldClearSpace } = setting ?? {};
3
+ return {
4
+ label,
5
+ iconSvg,
6
+ iconAlign,
7
+ iconVisible,
8
+ shouldClearSpace,
9
+ htmlType: 'submit'
10
+ };
11
+ };
12
+ const getButtonLiquidSettings = (setting)=>{
13
+ const { translate, redirectNewTab } = setting ?? {};
14
+ return {
15
+ translate,
16
+ btnLink: {
17
+ link: '{{ product.url }}',
18
+ target: redirectNewTab ? '_blank' : '_self'
19
+ }
20
+ };
21
+ };
22
+
23
+ export { getButtonLiquidSettings, getButtonSettings };
@@ -0,0 +1,10 @@
1
+ import { makeStyleResponsive } from '@gem-sdk/core';
2
+
3
+ const getButtonStyle = (style, styles)=>{
4
+ return {
5
+ ...style,
6
+ ...makeStyleResponsive('ta', styles?.align)
7
+ };
8
+ };
9
+
10
+ export { getButtonStyle };
@@ -22,7 +22,7 @@ const DynamicCheckoutSettings = [
22
22
  default: {
23
23
  type: 'paragraph-1',
24
24
  attrs: {
25
- color: 'text-3'
25
+ color: 'text-1'
26
26
  }
27
27
  },
28
28
  hiddenSetting: {
@@ -356,7 +356,7 @@ const DynamicCheckoutSettings = [
356
356
  ],
357
357
  devices: {
358
358
  desktop: {
359
- default: 'center'
359
+ default: 'left'
360
360
  }
361
361
  }
362
362
  },
@@ -408,12 +408,16 @@ const DynamicCheckoutSettings = [
408
408
  type: 'color-picker-v2',
409
409
  devices: {
410
410
  desktop: {
411
- default: {}
411
+ default: {
412
+ hover: 'text-3'
413
+ }
412
414
  }
413
415
  },
414
416
  compoDefaultValue: {
415
417
  desktop: {
416
- default: {}
418
+ default: {
419
+ hover: 'text-3'
420
+ }
417
421
  }
418
422
  },
419
423
  enableGradient: true
@@ -424,7 +428,7 @@ const DynamicCheckoutSettings = [
424
428
  devices: {
425
429
  desktop: {
426
430
  default: {
427
- width: 'Auto',
431
+ width: '100%',
428
432
  height: 'Auto',
429
433
  padding: {
430
434
  type: 'medium',
@@ -286,15 +286,15 @@ const SettingUIV2 = [
286
286
  state: 'hover'
287
287
  }
288
288
  },
289
- // {
290
- // label: {
291
- // en: 'BG image',
292
- // },
293
- // setting: {
294
- // id: 'backgroundImage',
295
- // state: 'hover',
296
- // },
297
- // },
289
+ {
290
+ label: {
291
+ en: 'Image'
292
+ },
293
+ setting: {
294
+ id: 'backgroundImage',
295
+ state: 'hover'
296
+ }
297
+ },
298
298
  {
299
299
  label: {
300
300
  en: 'Text color'
@@ -364,7 +364,7 @@ const SettingUIV2 = [
364
364
  options: {
365
365
  labelVariant: 'primary',
366
366
  fullWidth: true,
367
- disableMessage: `Align is not supported when width is 100%`
367
+ disableMessage: `Horizontal alignment is disabled when the width is set to 100% or greater`
368
368
  }
369
369
  }
370
370
  ]
@@ -158,6 +158,7 @@ const ProductButtonSettings = [
158
158
  link: '/cart',
159
159
  target: '_self'
160
160
  },
161
+ isHiddenOpenLinkSelect: true,
161
162
  hide: true
162
163
  },
163
164
  {
@@ -548,7 +548,7 @@ const SettingUIV2 = [
548
548
  options: {
549
549
  labelVariant: 'primary',
550
550
  fullWidth: true,
551
- disableMessage: `Align is not supported when width is 100%`
551
+ disableMessage: `Horizontal alignment is disabled when the width is set to 100% or greater`
552
552
  }
553
553
  }
554
554
  ]
@@ -53,19 +53,9 @@ const ProductViewMoreSettings = [
53
53
  default: false
54
54
  },
55
55
  {
56
- id: 'target',
57
- type: 'option:value',
58
- options: [
59
- {
60
- label: 'Current',
61
- value: 'current'
62
- },
63
- {
64
- label: 'New Tab',
65
- value: 'new-tab'
66
- }
67
- ],
68
- default: 'current'
56
+ id: 'redirectNewTab',
57
+ type: 'toggle',
58
+ default: false
69
59
  }
70
60
  ]
71
61
  },
@@ -383,16 +373,25 @@ const ProductViewMoreSettings = [
383
373
  ],
384
374
  devices: {
385
375
  desktop: {
386
- default: 'center'
376
+ default: 'left'
387
377
  }
388
378
  }
389
379
  },
380
+ {
381
+ id: 'enableTextStyle',
382
+ label: '',
383
+ type: 'toggle',
384
+ default: true
385
+ },
390
386
  {
391
387
  id: 'typo',
392
388
  type: 'typography-v2',
393
389
  label: 'Typography',
394
390
  default: {
395
- type: 'paragraph-1'
391
+ type: 'paragraph-1',
392
+ attrs: {
393
+ color: 'text-1'
394
+ }
396
395
  },
397
396
  hiddenSetting: {
398
397
  textAlign: true
@@ -510,10 +509,12 @@ const ProductViewMoreSettings = [
510
509
  },
511
510
  {
512
511
  id: 'iconSpacing',
513
- type: 'input:unit',
512
+ type: 'input:slider',
514
513
  units: [
515
514
  'px'
516
515
  ],
516
+ step: 1,
517
+ max: 40,
517
518
  devices: {
518
519
  desktop: {
519
520
  default: '8px'
@@ -188,28 +188,27 @@ const SettingUIV2 = [
188
188
  ]
189
189
  },
190
190
  {
191
- label: {
192
- en: 'Icon'
193
- },
194
191
  controls: [
195
192
  {
193
+ label: {
194
+ en: 'Icon'
195
+ },
196
196
  setting: {
197
197
  id: 'iconVisible'
198
+ },
199
+ options: {
200
+ labelVariant: 'primary',
201
+ toggleStyle: 'switch'
198
202
  }
199
- }
200
- ]
201
- },
202
- {
203
- conditionDisplay: 'iconVisible == true',
204
- controls: [
203
+ },
205
204
  {
206
- type: 'control',
207
205
  label: {
208
- en: 'Choose icon'
206
+ en: 'Icon'
209
207
  },
210
208
  setting: {
211
209
  id: 'iconSvg'
212
- }
210
+ },
211
+ conditionDisplay: 'iconVisible == true'
213
212
  },
214
213
  {
215
214
  type: 'control',
@@ -218,24 +217,35 @@ const SettingUIV2 = [
218
217
  },
219
218
  setting: {
220
219
  id: 'iconAlign'
221
- }
220
+ },
221
+ conditionDisplay: 'iconVisible == true'
222
222
  },
223
223
  {
224
224
  type: 'control',
225
225
  label: {
226
- en: 'Spacing'
226
+ en: 'Text & icon gap'
227
227
  },
228
228
  setting: {
229
229
  id: 'iconSpacing'
230
- }
230
+ },
231
+ conditionDisplay: 'iconVisible == true'
231
232
  }
232
233
  ]
233
234
  },
234
235
  {
235
- label: {
236
- en: 'Text style'
237
- },
238
236
  controls: [
237
+ {
238
+ label: {
239
+ en: 'Text'
240
+ },
241
+ setting: {
242
+ id: 'enableTextStyle'
243
+ },
244
+ options: {
245
+ labelVariant: 'primary',
246
+ toggleStyle: 'switch'
247
+ }
248
+ },
239
249
  {
240
250
  id: 'typo',
241
251
  label: {
@@ -244,6 +254,7 @@ const SettingUIV2 = [
244
254
  setting: {
245
255
  id: 'typo'
246
256
  },
257
+ conditionDisplay: 'enableTextStyle == true',
247
258
  options: {
248
259
  hideLabel: true,
249
260
  fullWidth: true,
@@ -281,22 +292,22 @@ const SettingUIV2 = [
281
292
  controls: [
282
293
  {
283
294
  label: {
284
- en: 'Background'
295
+ en: 'Color'
285
296
  },
286
297
  setting: {
287
298
  id: 'backgroundColorV2',
288
299
  state: 'hover'
289
300
  }
290
301
  },
291
- // {
292
- // label: {
293
- // en: 'BG image',
294
- // },
295
- // setting: {
296
- // id: 'backgroundImage',
297
- // state: 'hover',
298
- // },
299
- // },
302
+ {
303
+ label: {
304
+ en: 'Image'
305
+ },
306
+ setting: {
307
+ id: 'backgroundImage',
308
+ state: 'hover'
309
+ }
310
+ },
300
311
  {
301
312
  label: {
302
313
  en: 'Text color'
@@ -339,28 +350,17 @@ const SettingUIV2 = [
339
350
  }
340
351
  ]
341
352
  },
342
- // {
343
- // label: {
344
- // en: 'Link',
345
- // },
346
- // controls: [
347
- // {
348
- // type: 'control',
349
- // layout: 'vertical',
350
- // setting: {
351
- // id: 'btnLink',
352
- // },
353
- // },
354
- // ],
355
- // },
356
353
  {
357
354
  label: {
358
- en: 'Open in'
355
+ en: 'Redirect to'
359
356
  },
360
357
  controls: [
361
358
  {
359
+ label: {
360
+ en: 'New tab'
361
+ },
362
362
  setting: {
363
- id: 'target'
363
+ id: 'redirectNewTab'
364
364
  }
365
365
  }
366
366
  ]
@@ -378,7 +378,7 @@ const SettingUIV2 = [
378
378
  options: {
379
379
  labelVariant: 'primary',
380
380
  fullWidth: true,
381
- disableMessage: `Align is not supported when width is 100%`
381
+ disableMessage: `Horizontal alignment is disabled when the width is set to 100% or greater`
382
382
  }
383
383
  }
384
384
  ]