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

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/next.js +41 -31
  2. package/dist/cjs/builder.js +1 -1
  3. package/dist/cjs/button/components/Button.js +5 -3
  4. package/dist/cjs/button/components/Button.liquid.js +7 -3
  5. package/dist/cjs/button/components/common/attributes.js +1 -2
  6. package/dist/cjs/button/components/common/helpers.js +2 -2
  7. package/dist/cjs/button/components/common/styles.js +29 -1
  8. package/dist/cjs/button/setting/configs/settings.js +24 -4
  9. package/dist/cjs/button/setting/configs/uiV2.js +46 -8
  10. package/dist/cjs/image/setting/configs/uiV2.js +5 -1
  11. package/dist/cjs/index.js +1 -1
  12. package/dist/cjs/post-purchase/callout-banner/setting/config/callout-text/setting.js +4 -3
  13. package/dist/cjs/post-purchase/product/components/product-offer/common/attrs.js +14 -0
  14. package/dist/cjs/post-purchase/product/components/product-offer/common/classes.js +29 -0
  15. package/dist/cjs/post-purchase/product/components/product-offer/common/styles.js +27 -0
  16. package/dist/cjs/post-purchase/product/components/product-offer/components/ProductOffer.js +53 -0
  17. package/dist/cjs/post-purchase/product/components/product-offer/components/ProductOfferItem.js +45 -0
  18. package/dist/cjs/post-purchase/product/components/product-offer/hooks/useProductOfferData.js +57 -0
  19. package/dist/cjs/post-purchase/product/index.js +2 -2
  20. package/dist/cjs/post-purchase/product/next.js +1 -1
  21. package/dist/cjs/post-purchase/product/settings/{ProductOffer.js → product-offer/index.js} +23 -143
  22. package/dist/cjs/post-purchase/product/settings/product-offer/ui/uiV1.js +140 -0
  23. package/dist/cjs/post-purchase/product/settings/product-offer/ui/uiV2.js +141 -0
  24. package/dist/cjs/post-purchase/utils/constants.js +6 -0
  25. package/dist/cjs/product/components/ProductViewMore/ProductViewMore.js +17 -18
  26. package/dist/cjs/product/components/ProductViewMore/ProductViewMore.liquid.js +14 -21
  27. package/dist/cjs/product/components/ProductViewMore/common/data.js +26 -0
  28. package/dist/cjs/product/components/ProductViewMore/common/styles.js +12 -0
  29. package/dist/cjs/product/setting/dynamic-checkout/configs/settings.js +9 -5
  30. package/dist/cjs/product/setting/dynamic-checkout/configs/uiV2.js +10 -10
  31. package/dist/cjs/product/setting/product-button/configs/settings.js +1 -0
  32. package/dist/cjs/product/setting/product-button/configs/uiV2.js +1 -1
  33. package/dist/cjs/product/setting/product-view-more/configs/settings.js +17 -16
  34. package/dist/cjs/product/setting/product-view-more/configs/uiV2.js +45 -45
  35. package/dist/esm/article/next.js +41 -31
  36. package/dist/esm/builder.js +1 -1
  37. package/dist/esm/button/components/Button.js +5 -3
  38. package/dist/esm/button/components/Button.liquid.js +7 -3
  39. package/dist/esm/button/components/common/attributes.js +1 -2
  40. package/dist/esm/button/components/common/helpers.js +2 -2
  41. package/dist/esm/button/components/common/styles.js +29 -3
  42. package/dist/esm/button/setting/configs/settings.js +24 -4
  43. package/dist/esm/button/setting/configs/uiV2.js +46 -8
  44. package/dist/esm/image/setting/configs/uiV2.js +5 -1
  45. package/dist/esm/index.js +1 -1
  46. package/dist/esm/post-purchase/callout-banner/setting/config/callout-text/setting.js +4 -3
  47. package/dist/esm/post-purchase/product/components/product-offer/common/attrs.js +12 -0
  48. package/dist/esm/post-purchase/product/components/product-offer/common/classes.js +25 -0
  49. package/dist/esm/post-purchase/product/components/product-offer/common/styles.js +24 -0
  50. package/dist/esm/post-purchase/product/components/product-offer/components/ProductOffer.js +49 -0
  51. package/dist/esm/post-purchase/product/components/product-offer/components/ProductOfferItem.js +43 -0
  52. package/dist/esm/post-purchase/product/components/product-offer/hooks/useProductOfferData.js +55 -0
  53. package/dist/esm/post-purchase/product/index.js +1 -1
  54. package/dist/esm/post-purchase/product/next.js +1 -1
  55. package/dist/esm/post-purchase/product/settings/{ProductOffer.js → product-offer/index.js} +23 -143
  56. package/dist/esm/post-purchase/product/settings/product-offer/ui/uiV1.js +138 -0
  57. package/dist/esm/post-purchase/product/settings/product-offer/ui/uiV2.js +139 -0
  58. package/dist/esm/post-purchase/utils/constants.js +6 -1
  59. package/dist/esm/product/components/ProductViewMore/ProductViewMore.js +17 -18
  60. package/dist/esm/product/components/ProductViewMore/ProductViewMore.liquid.js +14 -21
  61. package/dist/esm/product/components/ProductViewMore/common/data.js +23 -0
  62. package/dist/esm/product/components/ProductViewMore/common/styles.js +10 -0
  63. package/dist/esm/product/setting/dynamic-checkout/configs/settings.js +9 -5
  64. package/dist/esm/product/setting/dynamic-checkout/configs/uiV2.js +10 -10
  65. package/dist/esm/product/setting/product-button/configs/settings.js +1 -0
  66. package/dist/esm/product/setting/product-button/configs/uiV2.js +1 -1
  67. package/dist/esm/product/setting/product-view-more/configs/settings.js +17 -16
  68. package/dist/esm/product/setting/product-view-more/configs/uiV2.js +45 -45
  69. package/dist/types/index.d.ts +42 -8
  70. package/package.json +2 -2
  71. package/dist/cjs/post-purchase/product/components/ProductOffer.js +0 -138
  72. package/dist/esm/post-purchase/product/components/ProductOffer.js +0 -133
@@ -0,0 +1,138 @@
1
+ const ProductOfferSettingUIV1 = [
2
+ {
3
+ type: 'control',
4
+ label: {
5
+ en: 'Product source'
6
+ },
7
+ setting: {
8
+ id: 'productSetting'
9
+ },
10
+ layout: 'vertical'
11
+ },
12
+ {
13
+ type: 'group',
14
+ label: {
15
+ en: 'Product offers'
16
+ },
17
+ controls: [
18
+ {
19
+ type: 'control',
20
+ label: {
21
+ en: 'Quantity'
22
+ },
23
+ setting: {
24
+ id: 'dynamicOfferQuantity'
25
+ }
26
+ }
27
+ ],
28
+ condition: 'false'
29
+ },
30
+ {
31
+ type: 'control',
32
+ label: {
33
+ en: ''
34
+ },
35
+ setting: {
36
+ id: 'discountAndShippingFee'
37
+ },
38
+ layout: 'vertical'
39
+ },
40
+ {
41
+ type: 'group',
42
+ label: {
43
+ en: 'Layout'
44
+ },
45
+ condition: `(productSetting?.productIds?.length || 0) > 1`,
46
+ controls: [
47
+ {
48
+ type: 'control',
49
+ label: {
50
+ en: 'Choose layout'
51
+ },
52
+ setting: {
53
+ id: 'productOfferLayout'
54
+ },
55
+ layout: 'vertical',
56
+ condition: `(productSetting?.productIds?.length || 0) > 1`
57
+ },
58
+ {
59
+ type: 'control',
60
+ label: {
61
+ en: 'Row gap'
62
+ },
63
+ setting: {
64
+ id: 'productOfferVerticalGutter'
65
+ }
66
+ },
67
+ {
68
+ type: 'control',
69
+ label: {
70
+ en: 'Column gap'
71
+ },
72
+ setting: {
73
+ id: 'productOfferColumnGap'
74
+ }
75
+ }
76
+ ]
77
+ },
78
+ {
79
+ type: 'group',
80
+ label: {
81
+ en: 'Product Layout'
82
+ },
83
+ controls: [
84
+ {
85
+ type: 'control',
86
+ label: {
87
+ en: ''
88
+ },
89
+ setting: {
90
+ id: 'layout'
91
+ },
92
+ layout: 'vertical'
93
+ },
94
+ {
95
+ type: 'control',
96
+ label: {
97
+ en: 'Column gap'
98
+ },
99
+ setting: {
100
+ id: 'columnGap'
101
+ },
102
+ condition: `!!layout.cols && layout.cols.length > 1`
103
+ }
104
+ ]
105
+ },
106
+ {
107
+ type: 'group',
108
+ label: {
109
+ en: 'Size'
110
+ },
111
+ controls: [
112
+ {
113
+ type: 'control',
114
+ label: {
115
+ en: 'Width'
116
+ },
117
+ setting: {
118
+ id: 'productOfferWidth'
119
+ }
120
+ }
121
+ ]
122
+ },
123
+ {
124
+ type: 'control',
125
+ label: {
126
+ en: 'Align'
127
+ },
128
+ setting: {
129
+ id: 'inlineAlignment'
130
+ },
131
+ condition: `productOfferWidth !== '100%'`,
132
+ options: {
133
+ label: 'large'
134
+ }
135
+ }
136
+ ];
137
+
138
+ export { ProductOfferSettingUIV1 };
@@ -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'