@gem-sdk/core 1.39.14 → 1.40.0-staging.0

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 (54) hide show
  1. package/dist/cjs/components/ComponentToolbarPreview.js +61 -15
  2. package/dist/cjs/components/ComponentWrapper.js +2 -2
  3. package/dist/cjs/components/ComponentWrapperPreview.js +22 -5
  4. package/dist/cjs/components/Render.js +12 -2
  5. package/dist/cjs/components/Render.liquid.js +1 -1
  6. package/dist/cjs/components/constant.js +20 -0
  7. package/dist/cjs/components/resize/Spacing.js +3 -1
  8. package/dist/cjs/components/toolbar/Tooltip.js +8 -2
  9. package/dist/cjs/contexts/BuilderContext.js +8 -4
  10. package/dist/cjs/contexts/PageContext.js +22 -3
  11. package/dist/cjs/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +25 -0
  12. package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +17 -0
  13. package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +38 -0
  14. package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +33 -0
  15. package/dist/cjs/helpers/compose-advance-style.js +46 -2
  16. package/dist/cjs/helpers/filter-toolbar-preview.js +1 -1
  17. package/dist/cjs/helpers/is-empty-children.js +1 -1
  18. package/dist/cjs/helpers/queries/get-products.js +8 -4
  19. package/dist/cjs/hooks/shop/use-product-query.js +2 -2
  20. package/dist/cjs/hooks/shop/use-products-query.js +4 -3
  21. package/dist/cjs/hooks/useFormatMoney.js +5 -1
  22. package/dist/cjs/hooks/useInitialSwatchesOptions.js +12 -1
  23. package/dist/cjs/hooks/useProduct.js +15 -0
  24. package/dist/cjs/hooks/useToolbarPostPurchase.js +89 -0
  25. package/dist/cjs/index.js +13 -0
  26. package/dist/cjs/types/appAPI.js +2 -0
  27. package/dist/esm/components/ComponentToolbarPreview.js +60 -16
  28. package/dist/esm/components/ComponentWrapper.js +2 -2
  29. package/dist/esm/components/ComponentWrapperPreview.js +22 -5
  30. package/dist/esm/components/Render.js +13 -3
  31. package/dist/esm/components/Render.liquid.js +1 -1
  32. package/dist/esm/components/constant.js +19 -1
  33. package/dist/esm/components/resize/Spacing.js +3 -1
  34. package/dist/esm/components/toolbar/Tooltip.js +8 -2
  35. package/dist/esm/contexts/BuilderContext.js +8 -4
  36. package/dist/esm/contexts/PageContext.js +22 -3
  37. package/dist/esm/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +23 -0
  38. package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +15 -0
  39. package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +36 -0
  40. package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +31 -0
  41. package/dist/esm/helpers/compose-advance-style.js +46 -3
  42. package/dist/esm/helpers/filter-toolbar-preview.js +1 -1
  43. package/dist/esm/helpers/is-empty-children.js +1 -1
  44. package/dist/esm/helpers/queries/get-products.js +8 -4
  45. package/dist/esm/hooks/shop/use-product-query.js +2 -2
  46. package/dist/esm/hooks/shop/use-products-query.js +4 -3
  47. package/dist/esm/hooks/useFormatMoney.js +5 -2
  48. package/dist/esm/hooks/useInitialSwatchesOptions.js +12 -1
  49. package/dist/esm/hooks/useProduct.js +15 -1
  50. package/dist/esm/hooks/useToolbarPostPurchase.js +87 -0
  51. package/dist/esm/index.js +9 -3
  52. package/dist/esm/types/appAPI.js +1 -0
  53. package/dist/types/index.d.ts +26087 -6442
  54. package/package.json +6 -3
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var jsxRuntime = require('react/jsx-runtime');
4
6
  var react = require('react');
5
7
  require('zustand');
@@ -14,6 +16,7 @@ var CreateThemeSection = require('./theme-section/CreateThemeSection.js');
14
16
  var Tooltip = require('./toolbar/Tooltip.js');
15
17
  var ThemeSectionStatus = require('./theme-section/ThemeSectionStatus.js');
16
18
  var Resize = require('./resize/Resize.js');
19
+ var useToolbarPostPurchase = require('../hooks/useToolbarPostPurchase.js');
17
20
  require('../helpers/convert.js');
18
21
 
19
22
  const SECTION_LIMIT = 25;
@@ -25,7 +28,7 @@ const isSection = (el)=>{
25
28
  const tag = el.getAttribute('data-component-tag');
26
29
  return tag === 'Section';
27
30
  };
28
- const ComponentToolbarPreview = ({ ...props })=>{
31
+ const ComponentToolbarPreview = (props)=>{
29
32
  const isThemeSection = props.isThemeSection;
30
33
  const editingPageType = ShopContext.useShopStore((s)=>s.pageType);
31
34
  const getParents = BuilderPreviewContext.useBuilderPreviewStore((s)=>s.getParents);
@@ -35,12 +38,23 @@ const ComponentToolbarPreview = ({ ...props })=>{
35
38
  const [isShowParent, setIsShowParent] = react.useState(false);
36
39
  const [isShowParentRevert, setIsShowParentRevert] = react.useState(false);
37
40
  const [parents, setParents] = react.useState([]);
41
+ const [deleteTooltipPosition, setDeleteTooltipPosition] = react.useState('top');
42
+ const [isDisableDelete, setIsUnableDelete] = react.useState(false);
43
+ const [tooltipText, setTooltipText] = react.useState({
44
+ width: '',
45
+ text: ''
46
+ });
47
+ const [isDisableDuplicate, setIsDisableDuplicate] = react.useState(false);
48
+ const isSaleFunnelPage = react.useMemo(()=>editingPageType === 'POST_PURCHASE', [
49
+ editingPageType
50
+ ]);
51
+ const { checkDisableDelete, getTooltipText, checkDisableDuplicate } = useToolbarPostPurchase.usePostPurchase(props.uid, props.tag || '');
38
52
  const isOverToolbarPosition = (el, parent)=>{
39
- const parentLenght = parents.length;
53
+ const parentLength = parents.length;
40
54
  const rect = el.getBoundingClientRect();
41
55
  const rectP = parent.getBoundingClientRect();
42
56
  // 36px = toolbar active height + 4 spaces
43
- return rect.top - rectP.top < parentLenght * 36;
57
+ return rect.top - rectP.top < parentLength * 36;
44
58
  };
45
59
  const findOverflowParent = (element, initEl)=>{
46
60
  const thisEl = element;
@@ -54,10 +68,27 @@ const ComponentToolbarPreview = ({ ...props })=>{
54
68
  return;
55
69
  }
56
70
  };
71
+ const getDeleteTooltipPosition = react.useCallback(()=>{
72
+ if (props.tag == 'Section') return 'bottom';
73
+ const $toolbar = document.querySelector('[data-toolbar-active="true"]');
74
+ if ($toolbar) {
75
+ const rect = $toolbar.getBoundingClientRect();
76
+ if (rect.top < 60) setDeleteTooltipPosition('bottom');
77
+ else setDeleteTooltipPosition('top');
78
+ }
79
+ }, [
80
+ props.tag
81
+ ]);
57
82
  // Get parents
58
83
  const onActiveComponent = react.useCallback((e)=>{
59
84
  const detail = e.detail;
60
85
  if (detail?.componentUid == props.uid) {
86
+ getDeleteTooltipPosition();
87
+ if (isSaleFunnelPage) {
88
+ setIsUnableDelete(checkDisableDelete());
89
+ setTooltipText(getTooltipText());
90
+ setIsDisableDuplicate(checkDisableDuplicate());
91
+ }
61
92
  const currentParents = getParents(props.uid).filter((parent)=>{
62
93
  if (parent.uid === 'ROOT') return false;
63
94
  if (parent.tag === 'Section' && isThemeSectionEditor) return false;
@@ -71,10 +102,14 @@ const ComponentToolbarPreview = ({ ...props })=>{
71
102
  setIsShowParent(false);
72
103
  }
73
104
  }, [
74
- setParents,
75
- getParents,
76
105
  props.uid,
77
- isThemeSectionEditor
106
+ isSaleFunnelPage,
107
+ getParents,
108
+ checkDisableDelete,
109
+ getTooltipText,
110
+ checkDisableDuplicate,
111
+ isThemeSectionEditor,
112
+ getDeleteTooltipPosition
78
113
  ]);
79
114
  react.useEffect(()=>{
80
115
  window.addEventListener('editor:active-component', onActiveComponent);
@@ -211,6 +246,10 @@ const ComponentToolbarPreview = ({ ...props })=>{
211
246
  }
212
247
  return checkRenamedSection ? `Section ${getIndexSection() + 1}` : props?.name;
213
248
  };
249
+ const isEnableCreateThemeSection = ()=>{
250
+ return editingPageType !== 'STATIC' && editingPageType !== 'POST_PURCHASE';
251
+ };
252
+ // if (!isActive) return null;
214
253
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
215
254
  children: [
216
255
  !(props.tag == 'Section' && isThemeSectionEditor) && /*#__PURE__*/ jsxRuntime.jsxs("div", {
@@ -341,7 +380,7 @@ const ComponentToolbarPreview = ({ ...props })=>{
341
380
  ]
342
381
  }, parent.uid);
343
382
  }),
344
- props.tag === 'Section' && !props.isThemeSection && editingPageType !== 'STATIC' && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(CreateThemeSection.CreateThemeSection, {
383
+ props.tag === 'Section' && !props.isThemeSection && isEnableCreateThemeSection() && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(CreateThemeSection.CreateThemeSection, {
345
384
  ...props
346
385
  }),
347
386
  props.tag == 'Sticky' && /*#__PURE__*/ jsxRuntime.jsx("div", {
@@ -367,9 +406,10 @@ const ComponentToolbarPreview = ({ ...props })=>{
367
406
  text: "Page has reached Shopify’s 25 section-limit",
368
407
  position: "bottom",
369
408
  "data-toolbar-duplicate": true,
370
- "data-toolbar-disable": props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
371
- onClick: (e)=>onDuplicate(e),
409
+ "data-toolbar-disable": props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT || isDisableDuplicate,
410
+ onClick: isDisableDuplicate ? undefined : (e)=>onDuplicate(e),
372
411
  "aria-hidden": "true",
412
+ className: isDisableDuplicate ? '!gp-cursor-not-allowed' : '',
373
413
  children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
374
414
  width: "16",
375
415
  height: "16",
@@ -383,9 +423,14 @@ const ComponentToolbarPreview = ({ ...props })=>{
383
423
  })
384
424
  })
385
425
  }),
386
- /*#__PURE__*/ jsxRuntime.jsx("div", {
426
+ /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
387
427
  "data-toolbar-delete": true,
388
- onClick: (e)=>onDelete(e),
428
+ onClick: (e)=>isDisableDelete ? null : onDelete(e),
429
+ enable: isDisableDelete,
430
+ "data-toolbar-disable": isDisableDelete,
431
+ width: tooltipText.width,
432
+ text: tooltipText.text,
433
+ position: deleteTooltipPosition,
389
434
  "aria-hidden": "true",
390
435
  children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
391
436
  width: "16",
@@ -401,8 +446,8 @@ const ComponentToolbarPreview = ({ ...props })=>{
401
446
  })
402
447
  })
403
448
  ]
404
- }),
405
- editingPageType !== 'STATIC' && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(ThemeSectionStatus.ThemeSectionStatus, {
449
+ }, props.uid),
450
+ isEnableCreateThemeSection() && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(ThemeSectionStatus.ThemeSectionStatus, {
406
451
  ...props
407
452
  }),
408
453
  /*#__PURE__*/ jsxRuntime.jsx("div", {
@@ -410,7 +455,7 @@ const ComponentToolbarPreview = ({ ...props })=>{
410
455
  "data-outline-section": props.tag == 'Section',
411
456
  "data-outline-theme-section": props.tag == 'Section' && !!isThemeSection || isThemeSectionEditor,
412
457
  "data-outline-limit": getIndexSection() >= SECTION_LIMIT
413
- }),
458
+ }, 'outline-' + props.uid),
414
459
  props.tag == 'Section' && !isThemeSectionEditor && /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
415
460
  children: [
416
461
  /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
@@ -461,5 +506,6 @@ const ComponentToolbarPreview = ({ ...props })=>{
461
506
  ]
462
507
  });
463
508
  };
509
+ var ComponentToolbarPreview$1 = /*#__PURE__*/ react.memo(ComponentToolbarPreview);
464
510
 
465
- exports.ComponentToolbarPreview = ComponentToolbarPreview;
511
+ exports.default = ComponentToolbarPreview$1;
@@ -8,9 +8,9 @@ var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
8
8
  var constant = require('./constant.js');
9
9
  var RenderCustomCode = require('./RenderCustomCode.js');
10
10
 
11
- const ComponentWrapper = ({ children, ...props })=>{
11
+ const ComponentWrapper = ({ children, pageType, ...props })=>{
12
12
  if (props.type === 'section') return null;
13
- const style = composeAdvanceStyle.composeAdvanceStyle(props.advanced, props.tag);
13
+ const style = composeAdvanceStyle.composeAdvanceStyle(props.advanced, props.tag, pageType);
14
14
  const advanced = props.advanced;
15
15
  if (constant.disableWrap.includes(props.tag) && /*#__PURE__*/ react.isValidElement(children)) {
16
16
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
@@ -9,6 +9,14 @@ var constant = require('./constant.js');
9
9
  var RenderCustomCode = require('./RenderCustomCode.js');
10
10
  var ComponentToolbarPreview = require('./ComponentToolbarPreview.js');
11
11
  var useApplyAnimation = require('../hooks/animation/useApplyAnimation.js');
12
+ require('zustand');
13
+ require('swr');
14
+ require('@gem-sdk/adapter-shopify');
15
+ require('swr/mutation');
16
+ var shop = require('../hooks/shop.js');
17
+ require('vanilla-lazyload');
18
+ require('../hooks/useCartUI.js');
19
+ require('../helpers/convert.js');
12
20
 
13
21
  const ComponentWrapperPreview = ({ children, ...props })=>{
14
22
  react.useEffect(()=>{
@@ -25,6 +33,7 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
25
33
  useApplyAnimation.default({
26
34
  props
27
35
  });
36
+ const pageType = shop.usePageType();
28
37
  if (props.type === 'section') {
29
38
  return null;
30
39
  }
@@ -70,14 +79,21 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
70
79
  if (!props?.editorConfigs?.toolbar?.hide) {
71
80
  customProps['data-toolbar-wrap'] = true;
72
81
  }
73
- const style = composeAdvanceStyle.composeAdvanceStyle(props.advanced, props.tag);
82
+ const isNotDroppable = (tag)=>{
83
+ return pageType === 'GP_FUNNEL_PAGE' ? [
84
+ 'ProductList',
85
+ 'Header'
86
+ ].includes(tag) : false;
87
+ };
88
+ const style = composeAdvanceStyle.composeAdvanceStyle(props.advanced, props.tag, pageType);
74
89
  const advanced = props.advanced;
75
90
  const builderAttrs = {
76
91
  ...customProps,
77
92
  'data-uid': props.uid,
78
93
  'data-component-type': 'component',
79
94
  'data-component-tag': props.tag,
80
- 'data-component-label': props.label
95
+ 'data-component-label': props.label,
96
+ 'data-not-droppable': isNotDroppable(props.tag)
81
97
  };
82
98
  if (constant.disableWrap.includes(props.tag) && /*#__PURE__*/ react.isValidElement(children)) {
83
99
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
@@ -94,7 +110,7 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
94
110
  advanced,
95
111
  children: [
96
112
  children.props['children'],
97
- /*#__PURE__*/ jsxRuntime.jsx(ComponentToolbarPreview.ComponentToolbarPreview, {
113
+ /*#__PURE__*/ jsxRuntime.jsx(ComponentToolbarPreview.default, {
98
114
  ...props
99
115
  })
100
116
  ]
@@ -124,7 +140,7 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
124
140
  style,
125
141
  advanced
126
142
  }),
127
- /*#__PURE__*/ jsxRuntime.jsx(ComponentToolbarPreview.ComponentToolbarPreview, {
143
+ /*#__PURE__*/ jsxRuntime.jsx(ComponentToolbarPreview.default, {
128
144
  ...props
129
145
  })
130
146
  ]
@@ -132,5 +148,6 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
132
148
  ]
133
149
  });
134
150
  };
151
+ var ComponentWrapperPreview$1 = /*#__PURE__*/ react.memo(ComponentWrapperPreview);
135
152
 
136
- exports.default = ComponentWrapperPreview;
153
+ exports.default = ComponentWrapperPreview$1;
@@ -13,6 +13,13 @@ var RenderSection = require('./RenderSection.js');
13
13
  const Render = ({ uid, ...passProps })=>{
14
14
  const item = BuilderContext.useBuilderStore((s)=>s.getItem(uid));
15
15
  const Component = BuilderComponent.useBuilderComponent(item?.tag);
16
+ const isPostPurchase = BuilderContext.useBuilderStore((s)=>s.getIsPostPurchase());
17
+ const isPreview = BuilderContext.useBuilderStore((s)=>s.getIsPreview());
18
+ const pageType = react.useMemo(()=>{
19
+ return isPostPurchase ? 'POST_PURCHASE' : undefined;
20
+ }, [
21
+ isPostPurchase
22
+ ]);
16
23
  if (!item) return null;
17
24
  if (item?.type === 'section') {
18
25
  return /*#__PURE__*/ jsxRuntime.jsx(RenderSection.default, {
@@ -35,10 +42,12 @@ const Render = ({ uid, ...passProps })=>{
35
42
  }),
36
43
  children: /*#__PURE__*/ jsxRuntime.jsx(ComponentWrapper.default, {
37
44
  ...item,
45
+ pageType: pageType,
38
46
  children: item?.childrens?.length ? /*#__PURE__*/ jsxRuntime.jsx(Component, {
39
47
  builderProps: {
40
48
  uid,
41
- builderData: item
49
+ builderData: item,
50
+ isPreview
42
51
  },
43
52
  styles: item.styles,
44
53
  setting: item.settings,
@@ -49,7 +58,8 @@ const Render = ({ uid, ...passProps })=>{
49
58
  }) : /*#__PURE__*/ jsxRuntime.jsx(Component, {
50
59
  builderProps: {
51
60
  uid,
52
- builderData: item
61
+ builderData: item,
62
+ isPreview
53
63
  },
54
64
  styles: item.styles,
55
65
  setting: item.settings,
@@ -13,10 +13,10 @@ require('vanilla-lazyload');
13
13
  require('../hooks/useCartUI.js');
14
14
  require('react-transition-group');
15
15
  require('@gem-sdk/core');
16
+ var constant = require('./constant.js');
16
17
  var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
17
18
  var convert = require('../helpers/convert.js');
18
19
  var render = require('../helpers/render.js');
19
- var constant = require('./constant.js');
20
20
 
21
21
  const componentsRenderWithParentId = [
22
22
  'CarouselItem'
@@ -34,6 +34,7 @@ const disableWrap = [
34
34
  'Product',
35
35
  'ProductImages',
36
36
  'ProductImagesV2',
37
+ 'PostPurchaseProductImages',
37
38
  'Sticky',
38
39
  'Heading'
39
40
  ];
@@ -48,7 +49,26 @@ const excludeApplyStyle = [
48
49
  'IconListV2',
49
50
  'IconList'
50
51
  ];
52
+ const postPurchaseRequiredElements = [
53
+ 'PostPurchaseProductOffer',
54
+ 'PostPurchaseProductTitle',
55
+ 'PostPurchaseProductPrice',
56
+ 'PostPurchaseAcceptButton',
57
+ 'PostPurchaseButton',
58
+ 'PostPurchaseCalloutBox',
59
+ 'PostPurchaseProductPriceBreakdown',
60
+ 'PostPurchaseProductImages',
61
+ 'PostPurchaseCalloutText'
62
+ ];
63
+ const postPurchaseWrapElements = [
64
+ 'Row',
65
+ 'Section',
66
+ 'PostPurchaseCalloutBox',
67
+ 'PostPurchaseProductOffer'
68
+ ];
51
69
 
52
70
  exports.customRenderChildren = customRenderChildren;
53
71
  exports.disableWrap = disableWrap;
54
72
  exports.excludeApplyStyle = excludeApplyStyle;
73
+ exports.postPurchaseRequiredElements = postPurchaseRequiredElements;
74
+ exports.postPurchaseWrapElements = postPurchaseWrapElements;
@@ -9,6 +9,7 @@ var BuilderPreviewContext = require('../../contexts/BuilderPreviewContext.js');
9
9
  require('swr');
10
10
  require('@gem-sdk/adapter-shopify');
11
11
  require('swr/mutation');
12
+ var shop = require('../../hooks/shop.js');
12
13
  require('vanilla-lazyload');
13
14
  require('../../hooks/useCartUI.js');
14
15
  require('react-transition-group');
@@ -17,6 +18,7 @@ require('../../helpers/convert.js');
17
18
 
18
19
  function Spacing(props) {
19
20
  const isThemeSectionEditor = BuilderPreviewContext.useBuilderPreviewStore((s)=>s.isThemeSectionEditor);
21
+ const pageType = shop.usePageType();
20
22
  const $bottomDrag = react.useRef(null);
21
23
  const $bottomBg = react.useRef(null);
22
24
  const delayMouseMove = react.useRef(null);
@@ -201,7 +203,7 @@ function Spacing(props) {
201
203
  updateSpacing
202
204
  ]);
203
205
  return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
204
- children: props.tag !== 'Section' && /*#__PURE__*/ jsxRuntime.jsx("div", {
206
+ children: props.tag !== 'Section' && pageType !== 'POST_PURCHASE' && /*#__PURE__*/ jsxRuntime.jsx("div", {
205
207
  "data-spacing": true,
206
208
  "data-spacing-theme-section": isThemeSectionEditor,
207
209
  className: "gp-absolute gp-w-full gp-bottom-0",
@@ -4,16 +4,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
 
7
- function Tooltip({ children, enable, text = 'Tooltip Text', position = 'right', ...props }) {
7
+ function Tooltip({ children, enable, text = 'Tooltip Text', position = 'right', width, ...props }) {
8
8
  return /*#__PURE__*/ jsxRuntime.jsxs("div", {
9
9
  ...props,
10
10
  "data-toolbar-tooltip-trigger": true,
11
11
  children: [
12
12
  children,
13
13
  enable && /*#__PURE__*/ jsxRuntime.jsx("div", {
14
+ style: {
15
+ width: width,
16
+ zIndex: 50
17
+ },
14
18
  "data-toolbar-tooltip": true,
15
19
  "data-toolbar-tooltip-position": position,
16
- children: text
20
+ dangerouslySetInnerHTML: {
21
+ __html: text
22
+ }
17
23
  })
18
24
  ]
19
25
  });
@@ -5,15 +5,19 @@ var react = require('react');
5
5
  var zustand = require('zustand');
6
6
 
7
7
  const BuilderContext = /*#__PURE__*/ react.createContext(null);
8
- const createBuilderProvider = (data)=>zustand.createStore((_, get)=>({
8
+ const createBuilderProvider = (data, isPostPurchase, isPreview)=>zustand.createStore((_, get)=>({
9
9
  state: data,
10
+ isPostPurchase: isPostPurchase,
11
+ isPreview: isPreview,
10
12
  getItem: (id)=>{
11
13
  return get().state[id];
12
- }
14
+ },
15
+ getIsPostPurchase: ()=>get().isPostPurchase,
16
+ getIsPreview: ()=>get().isPreview
13
17
  }));
14
- const BuilderProvider = ({ children, state, lazy, priority, ...passProps })=>{
18
+ const BuilderProvider = ({ children, state, isPostPurchase, isPreview, lazy, priority, ...passProps })=>{
15
19
  const Component = lazy ? react.Suspense : react.Fragment;
16
- const store = createBuilderProvider(state);
20
+ const store = createBuilderProvider(state, isPostPurchase, isPreview);
17
21
  return /*#__PURE__*/ jsxRuntime.jsx(Component, {
18
22
  children: /*#__PURE__*/ jsxRuntime.jsx(BuilderContext.Provider, {
19
23
  ...passProps,
@@ -16,15 +16,34 @@ const createPageStoreProvider = (data)=>zustand.createStore((set)=>({
16
16
  set({
17
17
  dynamicCollection: data
18
18
  });
19
+ },
20
+ setPostPurchaseProductOffers: (productOffers)=>{
21
+ set({
22
+ productOffers: productOffers
23
+ });
24
+ },
25
+ setSalePageProductId: (id)=>{
26
+ set({
27
+ salePageProductId: id
28
+ });
29
+ },
30
+ setPublicStoreFrontData: (publicStoreFrontData)=>{
31
+ set({
32
+ publicStoreFrontData: publicStoreFrontData
33
+ });
19
34
  }
20
35
  }));
21
- const PageProvider = ({ children, dynamicProduct, dynamicCollection, ...passProps })=>{
36
+ const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, publicStoreFrontData, ...passProps })=>{
22
37
  const store = react.useMemo(()=>createPageStoreProvider({
23
38
  dynamicProduct,
24
- dynamicCollection
39
+ dynamicCollection,
40
+ productOffers,
41
+ publicStoreFrontData
25
42
  }), [
26
43
  dynamicProduct,
27
- dynamicCollection
44
+ dynamicCollection,
45
+ productOffers,
46
+ publicStoreFrontData
28
47
  ]);
29
48
  return /*#__PURE__*/ jsxRuntime.jsx(PageContext.Provider, {
30
49
  ...passProps,
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ /* eslint-disable */ const LibrarySaleFunnelDocument = `
4
+ query LibrarySaleFunnel($librarySaleFunnelId: ID!) {
5
+ librarySaleFunnel(id: $librarySaleFunnelId) {
6
+ id
7
+ type
8
+ name
9
+ offers {
10
+ id
11
+ discounts {
12
+ id
13
+ objectBaseID
14
+ objectType
15
+ position
16
+ title
17
+ type
18
+ value
19
+ }
20
+ }
21
+ }
22
+ }
23
+ `;
24
+
25
+ exports.LibrarySaleFunnelDocument = LibrarySaleFunnelDocument;
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ /* eslint-disable */ const LibraryTemplateDocument = `
4
+ query LibraryTemplate($libraryTemplateId: ID!) {
5
+ libraryTemplate(id: $libraryTemplateId) {
6
+ id
7
+ name
8
+ sectionPosition
9
+ sections {
10
+ id
11
+ component
12
+ }
13
+ }
14
+ }
15
+ `;
16
+
17
+ exports.LibraryTemplateDocument = LibraryTemplateDocument;
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ /* eslint-disable */ const SaleFunnelDiscountsDocument = `
4
+ query SaleFunnelDiscounts($where: SaleFunnelDiscountWhereInput, $orderBy: SaleFunnelDiscountOrder, $last: Int, $before: Cursor, $first: Int, $after: Cursor) {
5
+ saleFunnelDiscounts(
6
+ where: $where
7
+ orderBy: $orderBy
8
+ last: $last
9
+ before: $before
10
+ first: $first
11
+ after: $after
12
+ ) {
13
+ edges {
14
+ node {
15
+ id
16
+ objectBaseID
17
+ objectType
18
+ position
19
+ title
20
+ type
21
+ value
22
+ valueType
23
+ isEnabled
24
+ }
25
+ cursor
26
+ }
27
+ pageInfo {
28
+ endCursor
29
+ hasNextPage
30
+ hasPreviousPage
31
+ startCursor
32
+ }
33
+ totalCount
34
+ }
35
+ }
36
+ `;
37
+
38
+ exports.SaleFunnelDiscountsDocument = SaleFunnelDiscountsDocument;
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ /* eslint-disable */ const ThemePageDocument = `
4
+ query ThemePage($themePageId: ID!, $first: Int, $where: ThemeStyleWhereInput) {
5
+ themePage(id: $themePageId) {
6
+ id
7
+ name
8
+ handle
9
+ isMobile
10
+ sectionPosition
11
+ pageSections {
12
+ cid
13
+ component
14
+ id
15
+ deletedAt
16
+ }
17
+ theme {
18
+ id
19
+ themeStyles(first: $first, where: $where) {
20
+ edges {
21
+ node {
22
+ data
23
+ id
24
+ name
25
+ }
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
31
+ `;
32
+
33
+ exports.ThemePageDocument = ThemePageDocument;
@@ -44,7 +44,34 @@ const getAttrValue = (attr, value, tag)=>{
44
44
  return value;
45
45
  }
46
46
  };
47
- function composeAdvanceStyle(data, tag) {
47
+ const postPurchasePaddingMapping = {
48
+ loose: '21px',
49
+ extraLoose: '38px',
50
+ tight: '9px',
51
+ extraTight: '5px',
52
+ base: '14px'
53
+ };
54
+ const composeAdvanceStyleForPostPurchase = (data, tag)=>{
55
+ if (!data) return {};
56
+ const styles = {};
57
+ Object.keys(data).forEach((attr)=>{
58
+ const value = data[attr];
59
+ if (attr === 'blockPadding') {
60
+ const valueMapped = postPurchasePaddingMapping[value];
61
+ styles[`--pb`] = getAttrValue(attr, valueMapped, tag);
62
+ styles[`--pt`] = getAttrValue(attr, valueMapped, tag);
63
+ styles[`--mb`] = '0px';
64
+ styles[`--mt`] = '0px';
65
+ }
66
+ if (attr === 'inlinePadding') {
67
+ const valueMapped = postPurchasePaddingMapping[value];
68
+ styles[`--pl`] = getAttrValue(attr, valueMapped, tag);
69
+ styles[`--pr`] = getAttrValue(attr, valueMapped, tag);
70
+ }
71
+ });
72
+ return styles;
73
+ };
74
+ function composeAdvanceStyle(data, tag, pageType) {
48
75
  if (!data) return {};
49
76
  const styles = {};
50
77
  const devices = [
@@ -188,8 +215,24 @@ function composeAdvanceStyle(data, tag) {
188
215
  }));
189
216
  }
190
217
  }
218
+ if (attr === 'blockPadding' && pageType === "POST_PURCHASE") {
219
+ const valueMapped = postPurchasePaddingMapping[value];
220
+ styles[`--pb`] = getAttrValue(attr, valueMapped, tag);
221
+ styles[`--pt`] = getAttrValue(attr, valueMapped, tag);
222
+ styles[`--mb`] = '0px';
223
+ styles[`--mt`] = '0px';
224
+ }
225
+ if (attr === 'inlinePadding' && pageType === "POST_PURCHASE") {
226
+ const valueMapped = postPurchasePaddingMapping[value];
227
+ styles[`--pl`] = getAttrValue(attr, valueMapped, tag);
228
+ styles[`--pr`] = getAttrValue(attr, valueMapped, tag);
229
+ }
191
230
  });
192
- return styles;
231
+ const advancedPostPurchaseStyles = pageType === "POST_PURCHASE" ? composeAdvanceStyleForPostPurchase(data, tag) : {};
232
+ return {
233
+ ...styles,
234
+ ...advancedPostPurchaseStyles
235
+ };
193
236
  }
194
237
  const splitStyle = (keys, style = {})=>{
195
238
  const fullKeys = keys.map((key)=>makeStyle.makeStyleKey(key)).flat();
@@ -261,6 +304,7 @@ const removePaddingYInStyle = (style)=>{
261
304
  };
262
305
 
263
306
  exports.composeAdvanceStyle = composeAdvanceStyle;
307
+ exports.composeAdvanceStyleForPostPurchase = composeAdvanceStyleForPostPurchase;
264
308
  exports.filterAttrInStyle = filterAttrInStyle;
265
309
  exports.filterCornerInStyle = filterCornerInStyle;
266
310
  exports.removeAttrInStyle = removeAttrInStyle;
@@ -7,7 +7,7 @@ var ComponentToolbarPreview = require('../components/ComponentToolbarPreview.js'
7
7
 
8
8
  const filterToolbarPreview = (children, keep = false)=>{
9
9
  const arrChild = react.Children.toArray(children);
10
- return arrChild.filter((child)=>!keep ? child?.type != ComponentToolbarPreview.ComponentToolbarPreview : child?.type == ComponentToolbarPreview.ComponentToolbarPreview);
10
+ return arrChild.filter((child)=>!keep ? child?.type != ComponentToolbarPreview.default : child?.type == ComponentToolbarPreview.default);
11
11
  };
12
12
 
13
13
  exports.default = filterToolbarPreview;
@@ -7,7 +7,7 @@ var ComponentToolbarPreview = require('../components/ComponentToolbarPreview.js'
7
7
 
8
8
  const isEmptyChildren = (children)=>{
9
9
  let arrChild = react.Children.toArray(children);
10
- arrChild = arrChild.filter((child)=>child?.type != ComponentToolbarPreview.ComponentToolbarPreview);
10
+ arrChild = arrChild.filter((child)=>child?.type != ComponentToolbarPreview.default);
11
11
  return react.Children.count(arrChild) < 1 || !children;
12
12
  };
13
13