@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
@@ -13,6 +13,11 @@ const ButtonSettings = [
13
13
  type: 'input',
14
14
  default: 'label'
15
15
  },
16
+ {
17
+ id: 'enableBtnLink',
18
+ type: 'toggle',
19
+ default: false
20
+ },
16
21
  {
17
22
  id: 'btnLink',
18
23
  type: 'pick-link',
@@ -383,11 +388,20 @@ const ButtonSettings = [
383
388
  }
384
389
  }
385
390
  },
391
+ {
392
+ id: 'enableTextStyle',
393
+ label: '',
394
+ type: 'toggle',
395
+ default: true
396
+ },
386
397
  {
387
398
  id: 'typo',
388
399
  type: 'typography-v2',
389
400
  default: {
390
- type: 'paragraph-1'
401
+ type: 'paragraph-1',
402
+ attrs: {
403
+ color: 'text-1'
404
+ }
391
405
  },
392
406
  ignoreReRender: true,
393
407
  hiddenSetting: {
@@ -399,12 +413,16 @@ const ButtonSettings = [
399
413
  type: 'color-picker-v2',
400
414
  devices: {
401
415
  desktop: {
402
- default: {}
416
+ default: {
417
+ hover: 'text-3'
418
+ }
403
419
  }
404
420
  },
405
421
  compoDefaultValue: {
406
422
  desktop: {
407
- default: {}
423
+ default: {
424
+ hover: 'text-3'
425
+ }
408
426
  }
409
427
  },
410
428
  enableGradient: true
@@ -542,10 +560,12 @@ const ButtonSettings = [
542
560
  },
543
561
  {
544
562
  id: 'iconSpacing',
545
- type: 'input:unit',
563
+ type: 'input:slider',
546
564
  units: [
547
565
  'px'
548
566
  ],
567
+ step: 1,
568
+ max: 40,
549
569
  devices: {
550
570
  desktop: {
551
571
  default: '8px'
@@ -108,6 +108,15 @@ const SettingUIV2 = [
108
108
  id: 'backgroundColorV2',
109
109
  state: 'normal'
110
110
  }
111
+ },
112
+ {
113
+ label: {
114
+ en: 'Image'
115
+ },
116
+ setting: {
117
+ id: 'backgroundImage',
118
+ state: 'normal'
119
+ }
111
120
  }
112
121
  ]
113
122
  },
@@ -186,7 +195,7 @@ const SettingUIV2 = [
186
195
  {
187
196
  type: 'control',
188
197
  label: {
189
- en: 'Text & icon gap'
198
+ en: 'Gap'
190
199
  },
191
200
  setting: {
192
201
  id: 'iconSpacing'
@@ -196,10 +205,19 @@ const SettingUIV2 = [
196
205
  ]
197
206
  },
198
207
  {
199
- label: {
200
- en: 'Text style'
201
- },
202
208
  controls: [
209
+ {
210
+ label: {
211
+ en: 'Text'
212
+ },
213
+ setting: {
214
+ id: 'enableTextStyle'
215
+ },
216
+ options: {
217
+ labelVariant: 'primary',
218
+ toggleStyle: 'switch'
219
+ }
220
+ },
203
221
  {
204
222
  id: 'typo',
205
223
  label: {
@@ -208,6 +226,7 @@ const SettingUIV2 = [
208
226
  setting: {
209
227
  id: 'typo'
210
228
  },
229
+ conditionDisplay: 'enableTextStyle == true',
211
230
  options: {
212
231
  hideLabel: true,
213
232
  fullWidth: true,
@@ -252,6 +271,15 @@ const SettingUIV2 = [
252
271
  state: 'hover'
253
272
  }
254
273
  },
274
+ {
275
+ label: {
276
+ en: 'Image'
277
+ },
278
+ setting: {
279
+ id: 'backgroundImage',
280
+ state: 'hover'
281
+ }
282
+ },
255
283
  {
256
284
  label: {
257
285
  en: 'Text color'
@@ -295,13 +323,23 @@ const SettingUIV2 = [
295
323
  ]
296
324
  },
297
325
  {
298
- label: {
299
- en: 'Link'
300
- },
301
326
  controls: [
327
+ {
328
+ label: {
329
+ en: 'Link'
330
+ },
331
+ setting: {
332
+ id: 'enableBtnLink'
333
+ },
334
+ options: {
335
+ labelVariant: 'primary',
336
+ toggleStyle: 'switch'
337
+ }
338
+ },
302
339
  {
303
340
  type: 'control',
304
341
  layout: 'vertical',
342
+ conditionDisplay: 'enableBtnLink == true',
305
343
  setting: {
306
344
  id: 'btnLink'
307
345
  }
@@ -321,7 +359,7 @@ const SettingUIV2 = [
321
359
  options: {
322
360
  labelVariant: 'primary',
323
361
  fullWidth: true,
324
- disableMessage: `Align is not supported when width is 100%`
362
+ disableMessage: `Horizontal alignment is disabled when the width is set to 100% or greater`
325
363
  }
326
364
  }
327
365
  ]
@@ -107,7 +107,7 @@ const SettingUIV2 = [
107
107
  },
108
108
  {
109
109
  label: {
110
- en: 'Image'
110
+ en: 'Source'
111
111
  },
112
112
  controls: [
113
113
  {
@@ -283,6 +283,10 @@ const SettingUIV2 = [
283
283
  label: {
284
284
  en: 'Optimize LCP'
285
285
  },
286
+ messageConfig: {
287
+ type: 'info',
288
+ message: 'You can optimize image size with our partnered app'
289
+ },
286
290
  controls: [
287
291
  {
288
292
  label: {
package/dist/esm/index.js CHANGED
@@ -161,7 +161,7 @@ export { default as PostPurchaseProductVariants } from './post-purchase/product/
161
161
  export { default as PostPurchaseAcceptButton } from './post-purchase/product/components/AcceptButton.js';
162
162
  export { default as PostPurchaseProductQuantity } from './post-purchase/product/components/ProductQuantity.js';
163
163
  export { default as PostPurchaseProductPriceBreakdown } from './post-purchase/product/components/ProductPriceBreakdown.js';
164
- export { default as PostPurchaseProductOffer } from './post-purchase/product/components/ProductOffer.js';
164
+ export { default as PostPurchaseProductOffer } from './post-purchase/product/components/product-offer/components/ProductOffer.js';
165
165
  export { default as PostPurchaseProductDiscountTag } from './post-purchase/product/components/ProductDiscountTag.js';
166
166
  export { default as PostPurchaseProductImages } from './post-purchase/product/components/product-image/index.js';
167
167
  export { postPurchaseProduct1Col } from './post-purchase/product/settings/presets-config/product-presets/product-1-col.js';
@@ -91,14 +91,15 @@ const CalloutTextSettings = [
91
91
  ],
92
92
  hideUnit: false,
93
93
  devices: {
94
+ // Default: 100%
94
95
  desktop: {
95
- default: 'default'
96
+ default: '100%'
96
97
  },
97
98
  tablet: {
98
- default: 'default'
99
+ default: '100%'
99
100
  },
100
101
  mobile: {
101
- default: 'default'
102
+ default: '100%'
102
103
  }
103
104
  },
104
105
  displayOptions: [
@@ -0,0 +1,12 @@
1
+ const getProductOfferAttrs = (product, uid)=>{
2
+ return {
3
+ 'data-uid': uid || '',
4
+ 'data-component-type': 'component',
5
+ 'data-component-tag': 'Product',
6
+ 'data-component-label': 'Product',
7
+ 'data-component-no-setting': true,
8
+ 'data-product-id': product?.baseID?.replace('gid://shopify/Product/', '') || ''
9
+ };
10
+ };
11
+
12
+ export { getProductOfferAttrs };
@@ -0,0 +1,25 @@
1
+ import { composeClasses } from '@gem-sdk/core';
2
+ import { DEVICES } from '../../../../utils/constants.js';
3
+
4
+ const getProductOfferContainerClasses = (uid)=>{
5
+ return {
6
+ ...composeClasses(uid),
7
+ ...composeClasses('gp-flex gp-w-auto')
8
+ };
9
+ };
10
+ const getProductOfferWrapperClasses = ()=>{
11
+ return composeClasses('gp-grid gp-grid-cols-2');
12
+ };
13
+ const getProductOfferItemClasses = (index, setting, totalProduct)=>{
14
+ const { productOfferLayout } = setting ?? {};
15
+ let className = '';
16
+ DEVICES.map((device)=>{
17
+ const key = device === 'desktop' ? '' : `${device}:`;
18
+ if (productOfferLayout?.[device] === '1col' && index % 3 === 0 || (totalProduct || 0) <= 1) {
19
+ className += ` ${key}gp-col-span-2`;
20
+ }
21
+ });
22
+ return composeClasses(className);
23
+ };
24
+
25
+ export { getProductOfferContainerClasses, getProductOfferItemClasses, getProductOfferWrapperClasses };
@@ -0,0 +1,24 @@
1
+ import { filterTruthyStyles, makeStyleResponsive, makeWidth, makeStyle } from '@gem-sdk/core';
2
+ import { postPurchaseViewSpacing } from '../../../../utils/helper.js';
3
+
4
+ const getWrapperStyles = (styles)=>{
5
+ const { productOfferColumnGap, productOfferVerticalGutter, productOfferWidth } = styles ?? {};
6
+ return filterTruthyStyles({
7
+ ...makeStyleResponsive('cg', productOfferColumnGap),
8
+ ...makeStyleResponsive('rg', {
9
+ desktop: postPurchaseViewSpacing[productOfferVerticalGutter || 'base']
10
+ }),
11
+ ...makeStyleResponsive('w', makeWidth(productOfferWidth))
12
+ });
13
+ };
14
+ const getContainerStyles = (setting, style)=>{
15
+ const { inlineAlignment } = setting ?? {};
16
+ return filterTruthyStyles({
17
+ ...makeStyle({
18
+ pc: inlineAlignment
19
+ }),
20
+ ...style
21
+ });
22
+ };
23
+
24
+ export { getContainerStyles, getWrapperStyles };
@@ -0,0 +1,49 @@
1
+ 'use client';
2
+ import { jsx, Fragment } from 'react/jsx-runtime';
3
+ import { createElement } from 'react';
4
+ import Loading from '../../../../../common/components/Loading.js';
5
+ import '@gem-sdk/core';
6
+ import { getProductOfferContainerClasses, getProductOfferWrapperClasses } from '../common/classes.js';
7
+ import { createClass, createStyle } from '@gem-sdk/system';
8
+ import { getWrapperStyles, getContainerStyles } from '../common/styles.js';
9
+ import { useProductOfferData } from '../hooks/useProductOfferData.js';
10
+ import { ProductOfferItem } from './ProductOfferItem.js';
11
+
12
+ const PostPurchaseProductOffer = (props)=>{
13
+ const { styles, builderAttrs, builderProps, setting } = props;
14
+ const { isLoading, productSortedById, totalProduct } = useProductOfferData();
15
+ const productOfferContainerClasses = createClass({
16
+ ...getProductOfferContainerClasses(builderProps?.uid)
17
+ });
18
+ const productOfferWrapperClasses = createClass({
19
+ ...getProductOfferWrapperClasses()
20
+ });
21
+ const wrapperStyles = createStyle({
22
+ ...getWrapperStyles(styles)
23
+ });
24
+ const containerStyles = createStyle({
25
+ ...getContainerStyles(setting)
26
+ });
27
+ return /*#__PURE__*/ jsx(Fragment, {
28
+ children: isLoading ? /*#__PURE__*/ jsx(Loading, {}) : !productSortedById?.length ? /*#__PURE__*/ jsx("div", {
29
+ children: "You haven't set up a product yet. Please go back to the sales funnel details to add a product."
30
+ }) : /*#__PURE__*/ jsx("div", {
31
+ ...builderAttrs,
32
+ className: productOfferContainerClasses,
33
+ style: containerStyles,
34
+ children: /*#__PURE__*/ jsx("div", {
35
+ className: productOfferWrapperClasses,
36
+ style: wrapperStyles,
37
+ children: productSortedById?.map((product, index)=>/*#__PURE__*/ createElement(ProductOfferItem, {
38
+ ...props,
39
+ product: product,
40
+ index: index,
41
+ key: index,
42
+ totalProduct: totalProduct
43
+ }))
44
+ })
45
+ })
46
+ });
47
+ };
48
+
49
+ export { PostPurchaseProductOffer as default };
@@ -0,0 +1,43 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { useEditorMode, ProductProvider, isEmptyChildren } from '@gem-sdk/core';
4
+ import Row from '../../../../../grid/row/Row.js';
5
+ import 'react';
6
+ import ChildrenDroppable from '../../../../../grid/components/ChildrenDroppable.js';
7
+ import { createAttr, createClass } from '@gem-sdk/system';
8
+ import { getProductOfferAttrs } from '../common/attrs.js';
9
+ import { getProductOfferItemClasses } from '../common/classes.js';
10
+
11
+ const ProductOfferItem = (props)=>{
12
+ const { product, setting, builderProps, children, index, totalProduct, builderAttrs, styles } = props;
13
+ const mode = useEditorMode();
14
+ const { variantSelected, ...rowSetting } = setting ?? {};
15
+ const variantId = variantSelected?.[product?.baseID ?? '']?.variantId;
16
+ const attrs = createAttr({
17
+ ...getProductOfferAttrs(product, builderProps?.uid)
18
+ });
19
+ const productOfferItemClasses = createClass({
20
+ ...getProductOfferItemClasses(index, setting, totalProduct)
21
+ });
22
+ return /*#__PURE__*/ jsx("div", {
23
+ className: productOfferItemClasses,
24
+ children: /*#__PURE__*/ jsx(ProductProvider, {
25
+ product,
26
+ readOnly: true,
27
+ initialVariantId: variantId ?? 'Latest',
28
+ children: /*#__PURE__*/ jsx("div", {
29
+ ...mode === 'edit' ? {
30
+ ...attrs
31
+ } : {},
32
+ children: /*#__PURE__*/ jsx(Row, {
33
+ builderAttrs: builderAttrs,
34
+ setting: rowSetting,
35
+ styles: styles,
36
+ children: isEmptyChildren(children) ? /*#__PURE__*/ jsx(ChildrenDroppable, {}) : children
37
+ })
38
+ })
39
+ })
40
+ }, `uid-${product?.id}`);
41
+ };
42
+
43
+ export { ProductOfferItem };
@@ -0,0 +1,55 @@
1
+ import { usePageStore, useProductsQuery, flattenConnection } from '@gem-sdk/core';
2
+ import { useDynamicProduct } from '../../../hooks/useDynamicProduct.js';
3
+ import { useMemo } from 'react';
4
+ import { hasPublicStoreFrontData, createStoreFrontFetcher } from '../../../helpers/index.js';
5
+ import { productOfferPlaceholder } from '../../../constants/ProductOfferPlaceholder.js';
6
+
7
+ const useProductOfferData = ()=>{
8
+ const productOffers = usePageStore((s)=>s.productOffers);
9
+ const publicStoreFrontData = usePageStore((s)=>s.publicStoreFrontData);
10
+ const { isDynamicProduct } = useDynamicProduct();
11
+ const dynamicDiscountOffer = usePageStore((s)=>s.dynamicDiscountOffer);
12
+ const totalProduct = useMemo(()=>isDynamicProduct ? dynamicDiscountOffer?.appliedProductCount : productOffers?.length, [
13
+ dynamicDiscountOffer?.appliedProductCount,
14
+ isDynamicProduct,
15
+ productOffers?.length
16
+ ]);
17
+ const sortedProductBaseIDs = useMemo(()=>{
18
+ return productOffers?.sort((a, b)=>{
19
+ if (a?.node?.position && b?.node?.position) {
20
+ return a.node.position - b.node.position;
21
+ }
22
+ return 0;
23
+ }).map((item)=>item?.node?.objectBaseID).filter(Boolean);
24
+ }, [
25
+ productOffers
26
+ ]);
27
+ const { isLoading, isValidating, data } = useProductsQuery(sortedProductBaseIDs || [], {
28
+ revalidateOnMount: true
29
+ }, {
30
+ allStatus: true,
31
+ fetcher: hasPublicStoreFrontData(publicStoreFrontData) ? createStoreFrontFetcher(publicStoreFrontData) : undefined
32
+ });
33
+ const loading = useMemo(()=>isLoading || isValidating, [
34
+ isLoading,
35
+ isValidating
36
+ ]);
37
+ const products = useMemo(()=>flattenConnection(data?.products), [
38
+ data?.products
39
+ ]);
40
+ const productSortedById = useMemo(()=>{
41
+ return isDynamicProduct && dynamicDiscountOffer?.appliedProductCount ? Array(dynamicDiscountOffer.appliedProductCount).fill(productOfferPlaceholder) : sortedProductBaseIDs?.map((id)=>products?.find((el)=>el?.baseID === id)).filter(Boolean);
42
+ }, [
43
+ isDynamicProduct,
44
+ dynamicDiscountOffer?.appliedProductCount,
45
+ sortedProductBaseIDs,
46
+ products
47
+ ]);
48
+ return {
49
+ isLoading: loading,
50
+ productSortedById,
51
+ totalProduct
52
+ };
53
+ };
54
+
55
+ export { useProductOfferData };
@@ -14,7 +14,7 @@ import config$2 from './settings/product-price/ProductPrice.js';
14
14
  import config$3 from './settings/product-variants/ProductVariant.js';
15
15
  import config$4 from './settings/accept-button/index.js';
16
16
  import config$5 from './settings/product-quantity/index.js';
17
- import config$7 from './settings/ProductOffer.js';
17
+ import config$7 from './settings/product-offer/index.js';
18
18
  import config$6 from './settings/product-price-breakdown/index.js';
19
19
  import config$8 from './settings/product-discount-tag/ProductDiscountTag.js';
20
20
  import config$9 from './settings/product-image/ProductImages.js';
@@ -26,7 +26,7 @@ const PostPurchaseProductQuantity = dynamic(()=>import('./components/ProductQuan
26
26
  const PostPurchaseProductPriceBreakdown = dynamic(()=>import('./components/ProductPriceBreakdown.js'), {
27
27
  loading: Loading
28
28
  });
29
- const PostPurchaseProductOffer = dynamic(()=>import('./components/ProductOffer.js'), {
29
+ const PostPurchaseProductOffer = dynamic(()=>import('./components/product-offer/components/ProductOffer.js'), {
30
30
  loading: Loading
31
31
  });
32
32
  const PostPurchaseProductDiscountTag = dynamic(()=>import('./components/ProductDiscountTag.js'), {
@@ -1,7 +1,9 @@
1
- import { postPurchaseProductOfferDefault } from './presets-config/product-presets/product-offer-default.js';
2
- import { postPurchaseViewSpacing } from '../../utils/constants.js';
3
- import { postPurchaseProduct1Col } from './presets-config/product-presets/product-offer-1-col.js';
4
- import { postPurchaseProduct2Col } from './presets-config/product-presets/product-offer-2-col.js';
1
+ import { postPurchaseProductOfferDefault } from '../presets-config/product-presets/product-offer-default.js';
2
+ import { postPurchaseViewSpacing } from '../../../utils/constants.js';
3
+ import { postPurchaseProduct1Col } from '../presets-config/product-presets/product-offer-1-col.js';
4
+ import { postPurchaseProduct2Col } from '../presets-config/product-presets/product-offer-2-col.js';
5
+ import { ProductOfferSettingUIV1 } from './ui/uiV1.js';
6
+ import { ProductOfferSettingUIV2 } from './ui/uiV2.js';
5
7
 
6
8
  const config = {
7
9
  tag: 'PostPurchaseProductOffer',
@@ -345,14 +347,26 @@ const config = {
345
347
  },
346
348
  {
347
349
  id: 'productOfferWidth',
348
- type: 'input:unit-width',
350
+ type: 'dropdown:input',
349
351
  label: 'Width',
350
- placeholder: 'Global style',
351
- min: 0,
352
352
  units: [
353
353
  'px',
354
354
  '%'
355
355
  ],
356
+ hideUnit: false,
357
+ inputType: 'number',
358
+ displayOptions: [
359
+ {
360
+ label: 'Full',
361
+ value: '100%',
362
+ showValue: true
363
+ },
364
+ {
365
+ label: 'Default',
366
+ value: '1200px',
367
+ showValue: true
368
+ }
369
+ ],
356
370
  devices: {
357
371
  desktop: {
358
372
  default: '100%'
@@ -370,142 +384,8 @@ const config = {
370
384
  ]
371
385
  }
372
386
  ],
373
- ui: [
374
- {
375
- type: 'control',
376
- label: {
377
- en: 'Product source'
378
- },
379
- setting: {
380
- id: 'productSetting'
381
- },
382
- layout: 'vertical'
383
- },
384
- {
385
- type: 'group',
386
- label: {
387
- en: 'Product offers'
388
- },
389
- controls: [
390
- {
391
- type: 'control',
392
- label: {
393
- en: 'Quantity'
394
- },
395
- setting: {
396
- id: 'dynamicOfferQuantity'
397
- }
398
- }
399
- ],
400
- condition: 'false'
401
- },
402
- {
403
- type: 'control',
404
- label: {
405
- en: ''
406
- },
407
- setting: {
408
- id: 'discountAndShippingFee'
409
- },
410
- layout: 'vertical'
411
- },
412
- {
413
- type: 'group',
414
- label: {
415
- en: 'Layout'
416
- },
417
- condition: `(productSetting?.productIds?.length || 0) > 1`,
418
- controls: [
419
- {
420
- type: 'control',
421
- label: {
422
- en: 'Choose layout'
423
- },
424
- setting: {
425
- id: 'productOfferLayout'
426
- },
427
- layout: 'vertical',
428
- condition: `(productSetting?.productIds?.length || 0) > 1`
429
- },
430
- {
431
- type: 'control',
432
- label: {
433
- en: 'Row gap'
434
- },
435
- setting: {
436
- id: 'productOfferVerticalGutter'
437
- }
438
- },
439
- {
440
- type: 'control',
441
- label: {
442
- en: 'Column gap'
443
- },
444
- setting: {
445
- id: 'productOfferColumnGap'
446
- }
447
- }
448
- ]
449
- },
450
- {
451
- type: 'group',
452
- label: {
453
- en: 'Product Layout'
454
- },
455
- controls: [
456
- {
457
- type: 'control',
458
- label: {
459
- en: ''
460
- },
461
- setting: {
462
- id: 'layout'
463
- },
464
- layout: 'vertical'
465
- },
466
- {
467
- type: 'control',
468
- label: {
469
- en: 'Column gap'
470
- },
471
- setting: {
472
- id: 'columnGap'
473
- },
474
- condition: `!!layout.cols && layout.cols.length > 1`
475
- }
476
- ]
477
- },
478
- {
479
- type: 'group',
480
- label: {
481
- en: 'Size'
482
- },
483
- controls: [
484
- {
485
- type: 'control',
486
- label: {
487
- en: 'Width'
488
- },
489
- setting: {
490
- id: 'productOfferWidth'
491
- }
492
- }
493
- ]
494
- },
495
- {
496
- type: 'control',
497
- label: {
498
- en: 'Align'
499
- },
500
- setting: {
501
- id: 'inlineAlignment'
502
- },
503
- condition: `productOfferWidth !== '100%'`,
504
- options: {
505
- label: 'large'
506
- }
507
- }
508
- ],
387
+ ui: ProductOfferSettingUIV1,
388
+ uiV2: ProductOfferSettingUIV2,
509
389
  presets: [
510
390
  postPurchaseProductOfferDefault,
511
391
  postPurchaseProduct2Col,