@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
@@ -11,38 +11,48 @@ require('@gem-sdk/core');
11
11
  const ArticleList = dynamic(()=>Promise.resolve().then(function () { return require('./components/ArticleList.js'); }), {
12
12
  loading: Loading.default
13
13
  });
14
- // const ArticleTitle = dynamic(() => import('./components/ArticleTitle'), {
15
- // loading: Loading,
16
- // });
17
- // const ArticleExcerpt = dynamic(() => import('./components/ArticleExcerpt'), {
18
- // loading: Loading,
19
- // });
20
- // const ArticleContent = dynamic(() => import('./components/ArticleContent'), {
21
- // loading: Loading,
22
- // });
23
- // const ArticleImage = dynamic(() => import('./components/ArticleImage'), {
24
- // loading: Loading,
25
- // });
26
- // const ArticlePagination = dynamic(() => import('./components/ArticlePagination'), {
27
- // loading: Loading,
28
- // });
29
- // const ArticleAuthor = dynamic(() => import('./components/ArticleAuthor'), {
30
- // loading: Loading,
31
- // });
32
- // const ArticleTag = dynamic(() => import('./components/ArticleTag'), {
33
- // loading: Loading,
34
- // });
35
- // const ArticleCategory = dynamic(() => import('./components/ArticleCategory'), {
36
- // loading: Loading,
37
- // });
38
- // const ArticleDate = dynamic(() => import('./components/ArticleDate'), {
39
- // loading: Loading,
40
- // });
41
- // const ArticleReadMore = dynamic(() => import('./components/ArticleReadMore'), {
42
- // loading: Loading,
43
- // });
14
+ const ArticleTitle = dynamic(()=>Promise.resolve().then(function () { return require('./components/ArticleTitle.js'); }), {
15
+ loading: Loading.default
16
+ });
17
+ const ArticleExcerpt = dynamic(()=>Promise.resolve().then(function () { return require('./components/ArticleExcerpt.js'); }), {
18
+ loading: Loading.default
19
+ });
20
+ const ArticleContent = dynamic(()=>Promise.resolve().then(function () { return require('./components/ArticleContent.js'); }), {
21
+ loading: Loading.default
22
+ });
23
+ const ArticleImage = dynamic(()=>Promise.resolve().then(function () { return require('./components/ArticleImage.js'); }), {
24
+ loading: Loading.default
25
+ });
26
+ const ArticlePagination = dynamic(()=>Promise.resolve().then(function () { return require('./components/ArticlePagination.js'); }), {
27
+ loading: Loading.default
28
+ });
29
+ const ArticleAuthor = dynamic(()=>Promise.resolve().then(function () { return require('./components/ArticleAuthor.js'); }), {
30
+ loading: Loading.default
31
+ });
32
+ const ArticleTag = dynamic(()=>Promise.resolve().then(function () { return require('./components/ArticleTag.js'); }), {
33
+ loading: Loading.default
34
+ });
35
+ const ArticleCategory = dynamic(()=>Promise.resolve().then(function () { return require('./components/ArticleCategory.js'); }), {
36
+ loading: Loading.default
37
+ });
38
+ const ArticleDate = dynamic(()=>Promise.resolve().then(function () { return require('./components/ArticleDate.js'); }), {
39
+ loading: Loading.default
40
+ });
41
+ const ArticleReadMore = dynamic(()=>Promise.resolve().then(function () { return require('./components/ArticleReadMore.js'); }), {
42
+ loading: Loading.default
43
+ });
44
44
  var article = {
45
- ArticleList
45
+ ArticleList,
46
+ ArticleTitle,
47
+ ArticleExcerpt,
48
+ ArticleContent,
49
+ ArticleImage,
50
+ ArticlePagination,
51
+ ArticleAuthor,
52
+ ArticleTag,
53
+ ArticleCategory,
54
+ ArticleDate,
55
+ ArticleReadMore
46
56
  };
47
57
 
48
58
  exports.default = article;
@@ -104,7 +104,7 @@ var ProductPrice = require('./post-purchase/product/components/ProductPrice.js')
104
104
  var ProductVariant = require('./post-purchase/product/components/product-variant/components/ProductVariant.js');
105
105
  var AcceptButton = require('./post-purchase/product/components/AcceptButton.js');
106
106
  var ProductQuantity = require('./post-purchase/product/components/ProductQuantity.js');
107
- var ProductOffer = require('./post-purchase/product/components/ProductOffer.js');
107
+ var ProductOffer = require('./post-purchase/product/components/product-offer/components/ProductOffer.js');
108
108
  var ProductPriceBreakdown = require('./post-purchase/product/components/ProductPriceBreakdown.js');
109
109
  var ProductDiscountTag = require('./post-purchase/product/components/ProductDiscountTag.js');
110
110
  var index$3 = require('./post-purchase/product/components/product-image/index.js');
@@ -17,10 +17,12 @@ var helpers = require('./common/helpers.js');
17
17
 
18
18
  const Button = (props)=>{
19
19
  const { children, advanced, className, nodePrice, customAttrs, styles: styles$1 = {}, setting = {}, builderProps, builderAttrs, wrapClassName = '', onClick } = props;
20
- const { iconSvg, btnLink, htmlType, loading, disabled, shouldClearSpace } = setting;
20
+ const { iconSvg, btnLink, htmlType, loading, disabled, shouldClearSpace, enableBtnLink } = setting;
21
+ const { enableTextStyle = true } = styles$1;
21
22
  const mode = core.useEditorMode();
22
23
  const { customCss, wrapStyle, restStyle, dataState, dataIdAttr, isShowIcon, isScrollToElement, getArialLabel, getLabelToDisplay, checkIsShowLabel, checkIsEditableLabel } = data.getData(props);
23
24
  const { HTMLTag, urlData, shouldRenderLink } = helpers.getInsertLinkData({
25
+ enableBtnLink,
24
26
  htmlType,
25
27
  setting: btnLink,
26
28
  defaultTag: 'button'
@@ -59,7 +61,6 @@ const Button = (props)=>{
59
61
  });
60
62
  const buttonWrapperAttrs = system.createAttr({
61
63
  ...attributes.getButtonAttributes({
62
- urlData,
63
64
  disabled,
64
65
  dataState,
65
66
  dataId: dataIdAttr,
@@ -93,6 +94,7 @@ const Button = (props)=>{
93
94
  /*#__PURE__*/ jsxRuntime.jsxs(ButtonWrapper, {
94
95
  ...buttonWrapperAttrs,
95
96
  ...customAttrs,
97
+ setting: urlData,
96
98
  style: buttonStyles,
97
99
  className: buttonClasses,
98
100
  onClick: handleClick,
@@ -106,7 +108,7 @@ const Button = (props)=>{
106
108
  styles: buttonIconStyles,
107
109
  classes: buttonIconClasses
108
110
  })),
109
- system.If(checkIsShowLabel(), /*#__PURE__*/ jsxRuntime.jsx(ButtonLabel.default, {
111
+ system.If(enableTextStyle && checkIsShowLabel(), /*#__PURE__*/ jsxRuntime.jsx(ButtonLabel.default, {
110
112
  label: getLabelToDisplay(),
111
113
  classes: buttonLabelClasses
112
114
  }))
@@ -16,9 +16,11 @@ var helpers = require('./common/helpers.js');
16
16
 
17
17
  const Button = (props)=>{
18
18
  const { advanced, className, nodePrice, customAttrs, styles: styles$1 = {}, setting = {}, builderProps, wrapClassName = '' } = props;
19
- const { iconSvg, loading, btnLink, htmlType, disabled, shouldClearSpace } = setting;
19
+ const { iconSvg, loading, btnLink, htmlType, disabled, shouldClearSpace, enableBtnLink } = setting;
20
+ const { enableTextStyle = true } = styles$1;
20
21
  const { customCss, wrapStyle, restStyle, dataState, dataIdAttr, isShowIcon, isScrollToElement, getArialLabel, getLabelToDisplay, checkIsShowLabel, checkIsEditableLabel } = data.getData(props);
21
22
  const { HTMLTag, urlData, shouldRenderLink } = helpers.getInsertLinkData({
23
+ enableBtnLink,
22
24
  htmlType,
23
25
  setting: btnLink,
24
26
  defaultTag: 'button',
@@ -60,7 +62,6 @@ const Button = (props)=>{
60
62
  });
61
63
  const buttonWrapperAttrs = system.createAttr({
62
64
  ...attributes.getButtonAttributes({
63
- urlData,
64
65
  disabled,
65
66
  dataState,
66
67
  dataId: dataIdAttr,
@@ -92,6 +93,9 @@ const Button = (props)=>{
92
93
  }}
93
94
  ${{
94
95
  ...customAttrs
96
+ }}
97
+ ${{
98
+ ...urlData
95
99
  }}
96
100
  style="${buttonStyles}"
97
101
  class="${buttonClasses}"
@@ -103,7 +107,7 @@ const Button = (props)=>{
103
107
  styles: buttonIconStyles,
104
108
  classes: buttonIconClasses
105
109
  }))}
106
- ${system.If(checkIsShowLabel({
110
+ ${system.If(enableTextStyle && checkIsShowLabel({
107
111
  isLiquid: true
108
112
  }), ButtonLabel_liquid.default({
109
113
  label: getLabelToDisplay({
@@ -1,8 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const getButtonAttributes = ({ dataId, disabled, urlData, dataState, arialLabel })=>{
3
+ const getButtonAttributes = ({ dataId, disabled, dataState, arialLabel })=>{
4
4
  return {
5
- ...urlData,
6
5
  ...!!disabled && {
7
6
  disabled
8
7
  },
@@ -70,7 +70,7 @@ const getDataId = (uidInteraction, dataId, uid)=>{
70
70
  const handleGetArialLabel = ({ label, isLiquid = false })=>{
71
71
  return isLiquid ? label?.toString().replaceAll("'", ''').replaceAll('"', "'") ?? '' : label?.toString() ?? '';
72
72
  };
73
- const getInsertLinkData = ({ setting, htmlType, defaultTag, isLiquid = false })=>{
73
+ const getInsertLinkData = ({ setting, htmlType, defaultTag, enableBtnLink, isLiquid = false })=>{
74
74
  const URL_INCLUDES = [
75
75
  'product.url'
76
76
  ];
@@ -91,7 +91,7 @@ const getInsertLinkData = ({ setting, htmlType, defaultTag, isLiquid = false })=
91
91
  if (URL_START_WITH.find((el)=>urlHref.startsWith(el))) return true;
92
92
  return false;
93
93
  };
94
- const shouldRenderLink = isDomain || isShopifyDomain || isLink() || isHomePageHref;
94
+ const shouldRenderLink = enableBtnLink ? isDomain || isShopifyDomain || isLink() || isHomePageHref : false;
95
95
  let transformedUrl = urlHref;
96
96
  if (isLiquid && (isShopifyDomain || isHomePageHref)) {
97
97
  transformedUrl = setting?.isTranslate ? '$locationOrigin' + urlHref : "{{ request.origin }}{{ routes.root_url | split: '/' | join: '/' }}" + urlHref;
@@ -54,7 +54,7 @@ const getSizeStyles = (styles)=>{
54
54
  };
55
55
  const getTypoStyles = (styles)=>{
56
56
  return {
57
- ...core.makeStyleResponsiveState('c', styles?.textColorHover),
57
+ ...core.makeStyleResponsiveState('c', processResponsiveHoverColors(styles?.textColorHover)),
58
58
  ...core.composeTypographyStyle(styles?.typo, styles?.typography),
59
59
  ...core.getStyleShadow({
60
60
  styleAppliedFor: 'text-shadow',
@@ -63,6 +63,32 @@ const getTypoStyles = (styles)=>{
63
63
  })
64
64
  };
65
65
  };
66
+ /**
67
+ * Process hover color for a single device
68
+ */ const processDeviceHoverColor = (deviceStyle)=>{
69
+ if (!deviceStyle?.hover) return deviceStyle;
70
+ return {
71
+ ...deviceStyle,
72
+ hover: core.getSingleColorVariable(deviceStyle.hover)
73
+ };
74
+ };
75
+ /**
76
+ * Process hover colors for all responsive devices
77
+ */ const processResponsiveHoverColors = (responsiveStyle)=>{
78
+ if (!responsiveStyle) return {};
79
+ const devices = [
80
+ 'desktop',
81
+ 'tablet',
82
+ 'mobile'
83
+ ];
84
+ return devices.reduce((acc, device)=>{
85
+ const processedStyle = processDeviceHoverColor(responsiveStyle[device]);
86
+ if (processedStyle) {
87
+ acc[device] = processedStyle;
88
+ }
89
+ return acc;
90
+ }, {});
91
+ };
66
92
  const getBackgroundStyles = (styles)=>{
67
93
  return {
68
94
  ...core.getStyleBackgroundImageByDevice(styles?.backgroundImage),
@@ -152,3 +178,5 @@ exports.getButtonWrapperStyles = getButtonWrapperStyles;
152
178
  exports.getCustomCssStyles = getCustomCssStyles;
153
179
  exports.getRadiusStyles = getRadiusStyles;
154
180
  exports.getShadowStyles = getShadowStyles;
181
+ exports.processDeviceHoverColor = processDeviceHoverColor;
182
+ exports.processResponsiveHoverColors = processResponsiveHoverColors;
@@ -15,6 +15,11 @@ const ButtonSettings = [
15
15
  type: 'input',
16
16
  default: 'label'
17
17
  },
18
+ {
19
+ id: 'enableBtnLink',
20
+ type: 'toggle',
21
+ default: false
22
+ },
18
23
  {
19
24
  id: 'btnLink',
20
25
  type: 'pick-link',
@@ -385,11 +390,20 @@ const ButtonSettings = [
385
390
  }
386
391
  }
387
392
  },
393
+ {
394
+ id: 'enableTextStyle',
395
+ label: '',
396
+ type: 'toggle',
397
+ default: true
398
+ },
388
399
  {
389
400
  id: 'typo',
390
401
  type: 'typography-v2',
391
402
  default: {
392
- type: 'paragraph-1'
403
+ type: 'paragraph-1',
404
+ attrs: {
405
+ color: 'text-1'
406
+ }
393
407
  },
394
408
  ignoreReRender: true,
395
409
  hiddenSetting: {
@@ -401,12 +415,16 @@ const ButtonSettings = [
401
415
  type: 'color-picker-v2',
402
416
  devices: {
403
417
  desktop: {
404
- default: {}
418
+ default: {
419
+ hover: 'text-3'
420
+ }
405
421
  }
406
422
  },
407
423
  compoDefaultValue: {
408
424
  desktop: {
409
- default: {}
425
+ default: {
426
+ hover: 'text-3'
427
+ }
410
428
  }
411
429
  },
412
430
  enableGradient: true
@@ -544,10 +562,12 @@ const ButtonSettings = [
544
562
  },
545
563
  {
546
564
  id: 'iconSpacing',
547
- type: 'input:unit',
565
+ type: 'input:slider',
548
566
  units: [
549
567
  'px'
550
568
  ],
569
+ step: 1,
570
+ max: 40,
551
571
  devices: {
552
572
  desktop: {
553
573
  default: '8px'
@@ -110,6 +110,15 @@ const SettingUIV2 = [
110
110
  id: 'backgroundColorV2',
111
111
  state: 'normal'
112
112
  }
113
+ },
114
+ {
115
+ label: {
116
+ en: 'Image'
117
+ },
118
+ setting: {
119
+ id: 'backgroundImage',
120
+ state: 'normal'
121
+ }
113
122
  }
114
123
  ]
115
124
  },
@@ -188,7 +197,7 @@ const SettingUIV2 = [
188
197
  {
189
198
  type: 'control',
190
199
  label: {
191
- en: 'Text & icon gap'
200
+ en: 'Gap'
192
201
  },
193
202
  setting: {
194
203
  id: 'iconSpacing'
@@ -198,10 +207,19 @@ const SettingUIV2 = [
198
207
  ]
199
208
  },
200
209
  {
201
- label: {
202
- en: 'Text style'
203
- },
204
210
  controls: [
211
+ {
212
+ label: {
213
+ en: 'Text'
214
+ },
215
+ setting: {
216
+ id: 'enableTextStyle'
217
+ },
218
+ options: {
219
+ labelVariant: 'primary',
220
+ toggleStyle: 'switch'
221
+ }
222
+ },
205
223
  {
206
224
  id: 'typo',
207
225
  label: {
@@ -210,6 +228,7 @@ const SettingUIV2 = [
210
228
  setting: {
211
229
  id: 'typo'
212
230
  },
231
+ conditionDisplay: 'enableTextStyle == true',
213
232
  options: {
214
233
  hideLabel: true,
215
234
  fullWidth: true,
@@ -254,6 +273,15 @@ const SettingUIV2 = [
254
273
  state: 'hover'
255
274
  }
256
275
  },
276
+ {
277
+ label: {
278
+ en: 'Image'
279
+ },
280
+ setting: {
281
+ id: 'backgroundImage',
282
+ state: 'hover'
283
+ }
284
+ },
257
285
  {
258
286
  label: {
259
287
  en: 'Text color'
@@ -297,13 +325,23 @@ const SettingUIV2 = [
297
325
  ]
298
326
  },
299
327
  {
300
- label: {
301
- en: 'Link'
302
- },
303
328
  controls: [
329
+ {
330
+ label: {
331
+ en: 'Link'
332
+ },
333
+ setting: {
334
+ id: 'enableBtnLink'
335
+ },
336
+ options: {
337
+ labelVariant: 'primary',
338
+ toggleStyle: 'switch'
339
+ }
340
+ },
304
341
  {
305
342
  type: 'control',
306
343
  layout: 'vertical',
344
+ conditionDisplay: 'enableBtnLink == true',
307
345
  setting: {
308
346
  id: 'btnLink'
309
347
  }
@@ -323,7 +361,7 @@ const SettingUIV2 = [
323
361
  options: {
324
362
  labelVariant: 'primary',
325
363
  fullWidth: true,
326
- disableMessage: `Align is not supported when width is 100%`
364
+ disableMessage: `Horizontal alignment is disabled when the width is set to 100% or greater`
327
365
  }
328
366
  }
329
367
  ]
@@ -109,7 +109,7 @@ const SettingUIV2 = [
109
109
  },
110
110
  {
111
111
  label: {
112
- en: 'Image'
112
+ en: 'Source'
113
113
  },
114
114
  controls: [
115
115
  {
@@ -285,6 +285,10 @@ const SettingUIV2 = [
285
285
  label: {
286
286
  en: 'Optimize LCP'
287
287
  },
288
+ messageConfig: {
289
+ type: 'info',
290
+ message: 'You can optimize image size with our partnered app'
291
+ },
288
292
  controls: [
289
293
  {
290
294
  label: {
package/dist/cjs/index.js CHANGED
@@ -162,7 +162,7 @@ var ProductVariant = require('./post-purchase/product/components/product-variant
162
162
  var AcceptButton = require('./post-purchase/product/components/AcceptButton.js');
163
163
  var ProductQuantity = require('./post-purchase/product/components/ProductQuantity.js');
164
164
  var ProductPriceBreakdown = require('./post-purchase/product/components/ProductPriceBreakdown.js');
165
- var ProductOffer = require('./post-purchase/product/components/ProductOffer.js');
165
+ var ProductOffer = require('./post-purchase/product/components/product-offer/components/ProductOffer.js');
166
166
  var ProductDiscountTag = require('./post-purchase/product/components/ProductDiscountTag.js');
167
167
  var index$F = require('./post-purchase/product/components/product-image/index.js');
168
168
  var product1Col = require('./post-purchase/product/settings/presets-config/product-presets/product-1-col.js');
@@ -93,14 +93,15 @@ const CalloutTextSettings = [
93
93
  ],
94
94
  hideUnit: false,
95
95
  devices: {
96
+ // Default: 100%
96
97
  desktop: {
97
- default: 'default'
98
+ default: '100%'
98
99
  },
99
100
  tablet: {
100
- default: 'default'
101
+ default: '100%'
101
102
  },
102
103
  mobile: {
103
- default: 'default'
104
+ default: '100%'
104
105
  }
105
106
  },
106
107
  displayOptions: [
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ const getProductOfferAttrs = (product, uid)=>{
4
+ return {
5
+ 'data-uid': uid || '',
6
+ 'data-component-type': 'component',
7
+ 'data-component-tag': 'Product',
8
+ 'data-component-label': 'Product',
9
+ 'data-component-no-setting': true,
10
+ 'data-product-id': product?.baseID?.replace('gid://shopify/Product/', '') || ''
11
+ };
12
+ };
13
+
14
+ exports.getProductOfferAttrs = getProductOfferAttrs;
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ var core = require('@gem-sdk/core');
4
+ var constants = require('../../../../utils/constants.js');
5
+
6
+ const getProductOfferContainerClasses = (uid)=>{
7
+ return {
8
+ ...core.composeClasses(uid),
9
+ ...core.composeClasses('gp-flex gp-w-auto')
10
+ };
11
+ };
12
+ const getProductOfferWrapperClasses = ()=>{
13
+ return core.composeClasses('gp-grid gp-grid-cols-2');
14
+ };
15
+ const getProductOfferItemClasses = (index, setting, totalProduct)=>{
16
+ const { productOfferLayout } = setting ?? {};
17
+ let className = '';
18
+ constants.DEVICES.map((device)=>{
19
+ const key = device === 'desktop' ? '' : `${device}:`;
20
+ if (productOfferLayout?.[device] === '1col' && index % 3 === 0 || (totalProduct || 0) <= 1) {
21
+ className += ` ${key}gp-col-span-2`;
22
+ }
23
+ });
24
+ return core.composeClasses(className);
25
+ };
26
+
27
+ exports.getProductOfferContainerClasses = getProductOfferContainerClasses;
28
+ exports.getProductOfferItemClasses = getProductOfferItemClasses;
29
+ exports.getProductOfferWrapperClasses = getProductOfferWrapperClasses;
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var core = require('@gem-sdk/core');
4
+ var helper = require('../../../../utils/helper.js');
5
+
6
+ const getWrapperStyles = (styles)=>{
7
+ const { productOfferColumnGap, productOfferVerticalGutter, productOfferWidth } = styles ?? {};
8
+ return core.filterTruthyStyles({
9
+ ...core.makeStyleResponsive('cg', productOfferColumnGap),
10
+ ...core.makeStyleResponsive('rg', {
11
+ desktop: helper.postPurchaseViewSpacing[productOfferVerticalGutter || 'base']
12
+ }),
13
+ ...core.makeStyleResponsive('w', core.makeWidth(productOfferWidth))
14
+ });
15
+ };
16
+ const getContainerStyles = (setting, style)=>{
17
+ const { inlineAlignment } = setting ?? {};
18
+ return core.filterTruthyStyles({
19
+ ...core.makeStyle({
20
+ pc: inlineAlignment
21
+ }),
22
+ ...style
23
+ });
24
+ };
25
+
26
+ exports.getContainerStyles = getContainerStyles;
27
+ exports.getWrapperStyles = getWrapperStyles;
@@ -0,0 +1,53 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var React = require('react');
8
+ var Loading = require('../../../../../common/components/Loading.js');
9
+ require('@gem-sdk/core');
10
+ var classes = require('../common/classes.js');
11
+ var system = require('@gem-sdk/system');
12
+ var styles = require('../common/styles.js');
13
+ var useProductOfferData = require('../hooks/useProductOfferData.js');
14
+ var ProductOfferItem = require('./ProductOfferItem.js');
15
+
16
+ const PostPurchaseProductOffer = (props)=>{
17
+ const { styles: styles$1, builderAttrs, builderProps, setting } = props;
18
+ const { isLoading, productSortedById, totalProduct } = useProductOfferData.useProductOfferData();
19
+ const productOfferContainerClasses = system.createClass({
20
+ ...classes.getProductOfferContainerClasses(builderProps?.uid)
21
+ });
22
+ const productOfferWrapperClasses = system.createClass({
23
+ ...classes.getProductOfferWrapperClasses()
24
+ });
25
+ const wrapperStyles = system.createStyle({
26
+ ...styles.getWrapperStyles(styles$1)
27
+ });
28
+ const containerStyles = system.createStyle({
29
+ ...styles.getContainerStyles(setting)
30
+ });
31
+ return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
32
+ children: isLoading ? /*#__PURE__*/ jsxRuntime.jsx(Loading.default, {}) : !productSortedById?.length ? /*#__PURE__*/ jsxRuntime.jsx("div", {
33
+ children: "You haven't set up a product yet. Please go back to the sales funnel details to add a product."
34
+ }) : /*#__PURE__*/ jsxRuntime.jsx("div", {
35
+ ...builderAttrs,
36
+ className: productOfferContainerClasses,
37
+ style: containerStyles,
38
+ children: /*#__PURE__*/ jsxRuntime.jsx("div", {
39
+ className: productOfferWrapperClasses,
40
+ style: wrapperStyles,
41
+ children: productSortedById?.map((product, index)=>/*#__PURE__*/ React.createElement(ProductOfferItem.ProductOfferItem, {
42
+ ...props,
43
+ product: product,
44
+ index: index,
45
+ key: index,
46
+ totalProduct: totalProduct
47
+ }))
48
+ })
49
+ })
50
+ });
51
+ };
52
+
53
+ exports.default = PostPurchaseProductOffer;
@@ -0,0 +1,45 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var core = require('@gem-sdk/core');
6
+ var Row = require('../../../../../grid/row/Row.js');
7
+ require('react');
8
+ var ChildrenDroppable = require('../../../../../grid/components/ChildrenDroppable.js');
9
+ var system = require('@gem-sdk/system');
10
+ var attrs = require('../common/attrs.js');
11
+ var classes = require('../common/classes.js');
12
+
13
+ const ProductOfferItem = (props)=>{
14
+ const { product, setting, builderProps, children, index, totalProduct, builderAttrs, styles } = props;
15
+ const mode = core.useEditorMode();
16
+ const { variantSelected, ...rowSetting } = setting ?? {};
17
+ const variantId = variantSelected?.[product?.baseID ?? '']?.variantId;
18
+ const attrs$1 = system.createAttr({
19
+ ...attrs.getProductOfferAttrs(product, builderProps?.uid)
20
+ });
21
+ const productOfferItemClasses = system.createClass({
22
+ ...classes.getProductOfferItemClasses(index, setting, totalProduct)
23
+ });
24
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
25
+ className: productOfferItemClasses,
26
+ children: /*#__PURE__*/ jsxRuntime.jsx(core.ProductProvider, {
27
+ product,
28
+ readOnly: true,
29
+ initialVariantId: variantId ?? 'Latest',
30
+ children: /*#__PURE__*/ jsxRuntime.jsx("div", {
31
+ ...mode === 'edit' ? {
32
+ ...attrs$1
33
+ } : {},
34
+ children: /*#__PURE__*/ jsxRuntime.jsx(Row.default, {
35
+ builderAttrs: builderAttrs,
36
+ setting: rowSetting,
37
+ styles: styles,
38
+ children: core.isEmptyChildren(children) ? /*#__PURE__*/ jsxRuntime.jsx(ChildrenDroppable.default, {}) : children
39
+ })
40
+ })
41
+ })
42
+ }, `uid-${product?.id}`);
43
+ };
44
+
45
+ exports.ProductOfferItem = ProductOfferItem;