@gem-sdk/core 1.44.2-staging.94 → 1.45.0-dev.100

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 (46) hide show
  1. package/dist/cjs/components/ComponentToolbarPreview.js +47 -8
  2. package/dist/cjs/components/ComponentWrapperPreview.js +16 -2
  3. package/dist/cjs/components/InteractionSuffix.js +107 -0
  4. package/dist/cjs/components/Render.liquid.js +2 -3
  5. package/dist/cjs/components/RenderPreview.js +1 -0
  6. package/dist/cjs/components/constant.js +6 -2
  7. package/dist/cjs/components/theme-section/ThemeSectionStatus.js +14 -5
  8. package/dist/cjs/contexts/BuilderPreviewContext.js +5 -1
  9. package/dist/cjs/contexts/ModalContext.js +2 -2
  10. package/dist/cjs/contexts/PageContext.js +29 -1
  11. package/dist/cjs/contexts/SectionContext.js +1 -0
  12. package/dist/cjs/helpers/align.js +19 -0
  13. package/dist/cjs/helpers/colors.js +2 -2
  14. package/dist/cjs/helpers/shadow.js +1 -1
  15. package/dist/cjs/helpers/size.js +4 -0
  16. package/dist/cjs/hooks/animation/useAnimationPreview.js +1 -0
  17. package/dist/cjs/hooks/animation/useApplyAnimation.js +2 -0
  18. package/dist/cjs/hooks/articles/useArticlesQuery.js +1 -0
  19. package/dist/cjs/hooks/useFormatMoney.js +61 -60
  20. package/dist/cjs/hooks/useInteraction.js +19 -0
  21. package/dist/cjs/index.js +13 -0
  22. package/dist/cjs/types/custom.js +44 -0
  23. package/dist/esm/components/ComponentToolbarPreview.js +48 -9
  24. package/dist/esm/components/ComponentWrapperPreview.js +16 -2
  25. package/dist/esm/components/InteractionSuffix.js +105 -0
  26. package/dist/esm/components/Render.liquid.js +2 -3
  27. package/dist/esm/components/RenderPreview.js +1 -0
  28. package/dist/esm/components/constant.js +6 -2
  29. package/dist/esm/components/theme-section/ThemeSectionStatus.js +14 -5
  30. package/dist/esm/contexts/BuilderPreviewContext.js +5 -1
  31. package/dist/esm/contexts/ModalContext.js +2 -2
  32. package/dist/esm/contexts/PageContext.js +29 -1
  33. package/dist/esm/contexts/SectionContext.js +1 -0
  34. package/dist/esm/helpers/align.js +17 -0
  35. package/dist/esm/helpers/colors.js +2 -2
  36. package/dist/esm/helpers/shadow.js +1 -1
  37. package/dist/esm/helpers/size.js +4 -1
  38. package/dist/esm/hooks/animation/useAnimationPreview.js +1 -0
  39. package/dist/esm/hooks/animation/useApplyAnimation.js +2 -0
  40. package/dist/esm/hooks/articles/useArticlesQuery.js +1 -0
  41. package/dist/esm/hooks/useFormatMoney.js +61 -61
  42. package/dist/esm/hooks/useInteraction.js +17 -0
  43. package/dist/esm/index.js +4 -2
  44. package/dist/esm/types/custom.js +44 -0
  45. package/dist/types/index.d.ts +215 -3
  46. package/package.json +3 -3
@@ -21,6 +21,7 @@ var useToolbarPostPurchase = require('../hooks/useToolbarPostPurchase.js');
21
21
  var constant = require('./constant.js');
22
22
  var AIContentGenerator = require('./ai-generator/AIContentGenerator.js');
23
23
  var AIGenContentLoading = require('./ai-generator/AIGenContentLoading.js');
24
+ var InteractionSuffix = require('./InteractionSuffix.js');
24
25
  require('../helpers/convert.js');
25
26
 
26
27
  const SECTION_LIMIT = 25;
@@ -47,6 +48,7 @@ const ComponentToolbarPreview = (props)=>{
47
48
  const [deleteTooltipPosition, setDeleteTooltipPosition] = react.useState('top');
48
49
  const [isDisableDelete, setIsUnableDelete] = react.useState(false);
49
50
  const [parentProductUid, setParentProductUid] = react.useState('');
51
+ const [articleUid, setArticleUid] = react.useState('');
50
52
  const [tooltipText, setTooltipText] = react.useState({
51
53
  width: '',
52
54
  text: ''
@@ -61,6 +63,18 @@ const ComponentToolbarPreview = (props)=>{
61
63
  'Product Description',
62
64
  'Product Price'
63
65
  ];
66
+ const editArticleElementList = [
67
+ 'Article Title',
68
+ 'Article Content',
69
+ 'Article Image',
70
+ 'Article Author',
71
+ 'Article Category',
72
+ 'Article Date'
73
+ ];
74
+ const editAbleElementList = [
75
+ ...editProductElementList,
76
+ ...editArticleElementList
77
+ ];
64
78
  const isOverToolbarPosition = (el, parent)=>{
65
79
  const parentLength = parents.length;
66
80
  const rect = el.getBoundingClientRect();
@@ -106,15 +120,29 @@ const ComponentToolbarPreview = (props)=>{
106
120
  }, [
107
121
  storefrontUrl
108
122
  ]);
109
- const shopifyEditLink = react.useMemo(()=>{
110
- return productId ? `https://admin.shopify.com/store/${shopName}/products/${productId}` : '';
123
+ const linkShopDefault = react.useMemo(()=>{
124
+ return `https://admin.shopify.com/store/${shopName}`;
111
125
  }, [
112
- productId,
113
126
  shopName
114
127
  ]);
128
+ const linkEditProduct = react.useMemo(()=>{
129
+ return productId ? `${linkShopDefault}/products/${productId}` : '';
130
+ }, [
131
+ linkShopDefault,
132
+ productId
133
+ ]);
134
+ const linkEditArticle = react.useMemo(()=>{
135
+ return articleUid ? `${linkShopDefault}/articles/${articleUid}` : '';
136
+ }, [
137
+ articleUid,
138
+ linkShopDefault
139
+ ]);
115
140
  // Get parents
116
141
  const onActiveComponent = react.useCallback((e)=>{
117
142
  const detail = e.detail;
143
+ if (detail?.articleId) {
144
+ setArticleUid(detail.articleId);
145
+ }
118
146
  if (detail?.componentUid == props.uid) {
119
147
  getDeleteTooltipPosition();
120
148
  if (isSaleFunnelPage) {
@@ -206,7 +234,15 @@ const ComponentToolbarPreview = (props)=>{
206
234
  window.dispatchEvent(event);
207
235
  };
208
236
  const goToShopifyEditLink = ()=>{
209
- window.open(shopifyEditLink, '_blank');
237
+ if (editArticleElementList.includes(toolbarName() ?? '')) {
238
+ window.open(linkEditArticle, '_blank');
239
+ return;
240
+ }
241
+ if (editProductElementList.includes(toolbarName() ?? '')) {
242
+ window.open(linkEditProduct, '_blank');
243
+ return;
244
+ }
245
+ window.open(linkShopDefault, '_blank');
210
246
  };
211
247
  const onDelete = (e)=>{
212
248
  e.preventDefault();
@@ -294,7 +330,6 @@ const ComponentToolbarPreview = (props)=>{
294
330
  const isEnableCreateThemeSection = ()=>{
295
331
  return editingPageType !== 'STATIC' && editingPageType !== 'POST_PURCHASE';
296
332
  };
297
- // if (!isActive) return null;
298
333
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
299
334
  children: [
300
335
  !(props.tag == 'Section' && isThemeSectionEditor) && /*#__PURE__*/ jsxRuntime.jsxs("div", {
@@ -480,7 +515,7 @@ const ComponentToolbarPreview = (props)=>{
480
515
  })
481
516
  })
482
517
  }),
483
- editProductElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
518
+ editAbleElementList.includes(toolbarName() ?? '') && /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
484
519
  "data-toolbar-title": true,
485
520
  enable: true,
486
521
  "data-toolbar-disable": false,
@@ -559,10 +594,14 @@ const ComponentToolbarPreview = (props)=>{
559
594
  fill: "currentColor"
560
595
  })
561
596
  })
597
+ }),
598
+ /*#__PURE__*/ jsxRuntime.jsx(InteractionSuffix.InteractionSuffix, {
599
+ tag: props.tag,
600
+ uid: props.uid
562
601
  })
563
602
  ]
564
603
  }, props.uid),
565
- isEnableCreateThemeSection() && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(ThemeSectionStatus.ThemeSectionStatus, {
604
+ isEnableCreateThemeSection() && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(ThemeSectionStatus.ThemeSectionStatusWrapper, {
566
605
  ...props
567
606
  }),
568
607
  /*#__PURE__*/ jsxRuntime.jsx("div", {
@@ -625,6 +664,6 @@ const ComponentToolbarPreview = (props)=>{
625
664
  ]
626
665
  });
627
666
  };
628
- var ComponentToolbarPreview$1 = /*#__PURE__*/ react.memo(ComponentToolbarPreview);
667
+ var ComponentToolbarPreview$1 = /*#__PURE__*/ react.memo(ComponentToolbarPreview); /* gem-lint/disallow-import-from-package-path */
629
668
 
630
669
  exports.default = ComponentToolbarPreview$1;
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var react = require('react');
7
7
  var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
8
+ var useInteraction = require('../hooks/useInteraction.js');
8
9
  var constant = require('./constant.js');
9
10
  var RenderCustomCode = require('./RenderCustomCode.js');
10
11
  var ComponentToolbarPreview = require('./ComponentToolbarPreview.js');
@@ -32,6 +33,19 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
32
33
  }, [
33
34
  props.uid
34
35
  ]);
36
+ const currentProps = props;
37
+ const { getAnimationByUid } = useInteraction.useInteraction();
38
+ const animationByInteraction = getAnimationByUid(props.uid);
39
+ if (animationByInteraction) {
40
+ currentProps.advanced = {
41
+ ...currentProps.advanced,
42
+ animation: {
43
+ desktop: animationByInteraction,
44
+ tablet: animationByInteraction,
45
+ mobile: animationByInteraction
46
+ }
47
+ };
48
+ }
35
49
  const pageType = shop.usePageType();
36
50
  if (props.type === 'section') {
37
51
  return null;
@@ -136,7 +150,7 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
136
150
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
137
151
  children: [
138
152
  /*#__PURE__*/ jsxRuntime.jsx(ComponentAnimation.default, {
139
- ...props
153
+ ...currentProps
140
154
  }),
141
155
  /*#__PURE__*/ jsxRuntime.jsx(RenderCustomCode.default, {
142
156
  uid: props.uid,
@@ -165,7 +179,7 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
165
179
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
166
180
  children: [
167
181
  /*#__PURE__*/ jsxRuntime.jsx(ComponentAnimation.default, {
168
- ...props
182
+ ...currentProps
169
183
  }),
170
184
  /*#__PURE__*/ jsxRuntime.jsx(RenderCustomCode.default, {
171
185
  uid: props.uid,
@@ -0,0 +1,107 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('react');
5
+ require('zustand');
6
+ require('swr');
7
+ var PageContext = require('../contexts/PageContext.js');
8
+ require('@gem-sdk/adapter-shopify');
9
+ require('swr/mutation');
10
+ require('swr/infinite');
11
+ require('vanilla-lazyload');
12
+ require('../hooks/useCartUI.js');
13
+ require('react-transition-group');
14
+ require('@gem-sdk/core');
15
+ require('classnames');
16
+ require('dayjs');
17
+ require('../helpers/convert.js');
18
+
19
+ const InteractionSuffix = ({ tag, uid })=>{
20
+ const currentInteraction = PageContext.usePageStore((s)=>s.interactionData?.item);
21
+ const isCurrentInteractionTarget = react.useMemo(()=>{
22
+ return currentInteraction?.targets?.find((t)=>t.uid === uid);
23
+ }, [
24
+ currentInteraction,
25
+ uid
26
+ ]);
27
+ const isCurrentInteractionTrigger = react.useMemo(()=>{
28
+ return currentInteraction?.self?.uid === uid;
29
+ }, [
30
+ currentInteraction,
31
+ uid
32
+ ]);
33
+ const isDisplay = react.useMemo(()=>{
34
+ return isCurrentInteractionTarget || isCurrentInteractionTrigger;
35
+ }, [
36
+ isCurrentInteractionTarget,
37
+ isCurrentInteractionTrigger
38
+ ]);
39
+ const positionOffset = react.useMemo(()=>{
40
+ if (isCurrentInteractionTrigger && isCurrentInteractionTarget) {
41
+ return 80;
42
+ }
43
+ return 40;
44
+ }, [
45
+ isCurrentInteractionTrigger,
46
+ isCurrentInteractionTarget
47
+ ]);
48
+ if (!isDisplay) {
49
+ return undefined;
50
+ }
51
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
52
+ children: [
53
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
54
+ className: "hidden gp-left-[-40px] gp-left-[-80px] gp-right-[-40px] gp-right-[-80px]"
55
+ }),
56
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
57
+ className: `gp-hidden gp-absolute interaction-suffix gp-gap-[8px] ${tag == 'Section' ? `gp-left-[-${positionOffset}px]` : `gp-right-[-${positionOffset}px]`}`,
58
+ children: [
59
+ isCurrentInteractionTrigger && /*#__PURE__*/ jsxRuntime.jsx("div", {
60
+ className: `gp-h-8 gp-rounded-[8px] gp-w-8 gp-bg-[#212121] gp-flex gp-justify-center gp-items-center `,
61
+ children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
62
+ width: "16",
63
+ height: "16",
64
+ viewBox: "0 0 16 16",
65
+ fill: "none",
66
+ xmlns: "http://www.w3.org/2000/svg",
67
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
68
+ fillRule: "evenodd",
69
+ clipRule: "evenodd",
70
+ d: "M12.9196 5.80449C13.0989 5.80449 13.1876 6.02216 13.0595 6.14749L4.83569 14.1892C4.69517 14.3267 4.46149 14.2002 4.49967 14.0074L5.50422 8.93537C5.53483 8.7808 5.41656 8.6368 5.25898 8.6368H3.08019C2.92551 8.6368 2.82938 8.46874 2.90779 8.33541L6.72099 1.85154C6.75692 1.79045 6.8225 1.75293 6.89338 1.75293H12.5729C12.7386 1.75293 12.8324 1.94273 12.7319 2.07435L10.1891 5.40272C10.0634 5.56724 10.1807 5.80449 10.3877 5.80449H12.9196Z",
71
+ fill: "#F9F9F9"
72
+ })
73
+ })
74
+ }),
75
+ isCurrentInteractionTarget && /*#__PURE__*/ jsxRuntime.jsx("div", {
76
+ className: `gp-h-8 min-w-8 gp-rounded-[8px] gp-w-8 gp-bg-[#212121] gp-flex gp-justify-center gp-items-center`,
77
+ children: /*#__PURE__*/ jsxRuntime.jsxs("svg", {
78
+ width: "16",
79
+ height: "16",
80
+ viewBox: "0 0 16 16",
81
+ fill: "none",
82
+ xmlns: "http://www.w3.org/2000/svg",
83
+ children: [
84
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
85
+ d: "M8.58987 2.11238C8.62815 2.66333 8.21254 3.141 7.66158 3.17928C6.73192 3.24386 5.84034 3.57396 5.09276 4.13034C4.34519 4.68673 3.77304 5.44602 3.44429 6.31801C3.11554 7.19 3.04401 8.13803 3.23821 9.04947C3.4324 9.96092 3.88415 10.7975 4.53978 11.4597C5.19541 12.122 6.02737 12.5821 6.93682 12.7854C7.84626 12.9888 8.79496 12.9268 9.67021 12.6068C10.5455 12.2869 11.3105 11.7224 11.8743 10.9804C12.4382 10.2385 12.7772 9.35025 12.8512 8.42129C12.895 7.87074 13.3768 7.45996 13.9273 7.50377C14.4779 7.54758 14.8887 8.0294 14.8449 8.57994C14.7406 9.8906 14.2622 11.1438 13.4667 12.1906C12.6711 13.2374 11.5918 14.0338 10.3569 14.4852C9.12204 14.9367 7.78353 15.0241 6.50041 14.7373C5.2173 14.4504 4.0435 13.8012 3.11848 12.8668C2.19345 11.9324 1.55609 10.7522 1.28211 9.46624C1.00813 8.1803 1.10905 6.84274 1.57287 5.61247C2.03669 4.3822 2.84393 3.31093 3.89867 2.52593C4.95342 1.74093 6.21133 1.27521 7.52297 1.18409C8.07393 1.14581 8.5516 1.56142 8.58987 2.11238Z",
86
+ fill: "#F9F9F9"
87
+ }),
88
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
89
+ fillRule: "evenodd",
90
+ clipRule: "evenodd",
91
+ d: "M11.9757 1.25658C12.184 1.31428 12.3452 1.47958 12.3976 1.68929L12.7872 3.24774L14.3457 3.63736C14.5554 3.68978 14.7207 3.85096 14.7784 4.05928C14.8361 4.2676 14.7773 4.49085 14.6244 4.64371L12.7167 6.55141C12.5677 6.70044 12.3514 6.76035 12.1469 6.70924L10.5688 6.3147L8.42436 8.45912C8.19005 8.69344 7.81015 8.69344 7.57583 8.45912C7.34152 8.22481 7.34152 7.84491 7.57583 7.61059L9.72025 5.46617L9.32572 3.88804C9.2746 3.68357 9.33451 3.46728 9.48354 3.31825L11.3912 1.41054C11.5441 1.25769 11.7674 1.19888 11.9757 1.25658ZM10.8795 5.15545L12.1084 5.46267L13.0266 4.54451L12.1469 4.3246C11.9319 4.27086 11.7641 4.10301 11.7104 3.88804L11.4904 3.0084L10.5723 3.92656L10.8795 5.15545Z",
92
+ fill: "#F9F9F9"
93
+ }),
94
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
95
+ d: "M7.35783 6.45343C7.87208 6.25201 8.12568 5.67185 7.92426 5.15761C7.72284 4.64336 7.14268 4.38976 6.62844 4.59118C6.05705 4.81498 5.55049 5.17772 5.15453 5.64655C4.75858 6.11538 4.4857 6.67552 4.36055 7.27631C4.23539 7.87709 4.26189 8.49961 4.43764 9.08758C4.6134 9.67555 4.93289 10.2105 5.36727 10.6439C5.80165 11.0774 6.33722 11.3958 6.92556 11.5702C7.51391 11.7445 8.13643 11.7695 8.73683 11.6427C9.33723 11.5158 9.89652 11.2413 10.3641 10.8439C10.8318 10.4465 11.1929 9.93885 11.4151 9.36679C11.615 8.85196 11.3597 8.27254 10.8449 8.07262C10.3301 7.87269 9.75066 8.12797 9.55073 8.6428C9.44887 8.9051 9.28329 9.1378 9.06901 9.3199C8.85474 9.50199 8.59851 9.62774 8.32352 9.68582C8.04853 9.7439 7.76341 9.73249 7.49394 9.65262C7.22445 9.57274 6.97907 9.42691 6.78001 9.22825C6.58093 9.0296 6.43446 8.78439 6.35386 8.51478C6.27327 8.24517 6.26112 7.9597 6.31851 7.6842C6.37591 7.4087 6.50102 7.1519 6.68251 6.93702C6.86399 6.72214 7.0961 6.55595 7.35783 6.45343Z",
96
+ fill: "#F9F9F9"
97
+ })
98
+ ]
99
+ })
100
+ })
101
+ ]
102
+ })
103
+ ]
104
+ });
105
+ };
106
+
107
+ exports.InteractionSuffix = InteractionSuffix;
@@ -39,7 +39,6 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
39
39
  const item = builder[uid];
40
40
  const Component = components[item?.tag];
41
41
  if (!Component) {
42
- console.log('Miss component: ', item);
43
42
  return {
44
43
  liquid: '',
45
44
  extraFiles
@@ -221,7 +220,6 @@ const appendAnimation = (props, liquid)=>{
221
220
  const appearTablet = getAnimationType(getSettingsByDevice('tablet'), 'appear');
222
221
  const appearMobile = getAnimationType(getSettingsByDevice('mobile'), 'appear');
223
222
  const enableAnimation = animation?.desktop?.enabled && (appearDesktop !== 'none' || hoverDesktop !== 'none') || animation?.tablet?.enabled && appearTablet !== 'none' || animation?.mobile?.enabled && appearMobile !== 'none';
224
- if (!enableAnimation) return liquid;
225
223
  const getInitVisibility = (device)=>getSettingsByDevice(device)?.enabled && ![
226
224
  'shake',
227
225
  'none'
@@ -236,7 +234,8 @@ const appendAnimation = (props, liquid)=>{
236
234
  gp-data='${JSON.stringify({
237
235
  config: animation,
238
236
  tag,
239
- opacity
237
+ opacity,
238
+ isEnableInit: enableAnimation
240
239
  })}'
241
240
  style="${{
242
241
  display: 'contents'
@@ -45,6 +45,7 @@ const RenderPreview = ({ uid, ...passProps })=>{
45
45
  setting: item.settings,
46
46
  ...passProps,
47
47
  children: item.childrens.map((id)=>/*#__PURE__*/ jsxRuntime.jsx(RenderPreviewMemo, {
48
+ ...passProps,
48
49
  uid: id
49
50
  }, id))
50
51
  }) : /*#__PURE__*/ jsxRuntime.jsx(Component, {
@@ -37,7 +37,10 @@ const disableWrap = [
37
37
  'PostPurchaseProductImages',
38
38
  'Sticky',
39
39
  'Heading',
40
- 'EstimateDate'
40
+ 'EstimateDate',
41
+ 'ProductBadge',
42
+ 'Marquee',
43
+ 'MarqueeItem'
41
44
  ];
42
45
  const customRenderChildren = [
43
46
  'Accordion',
@@ -48,7 +51,8 @@ const customRenderChildren = [
48
51
  ];
49
52
  const excludeApplyStyle = [
50
53
  'IconListV2',
51
- 'IconList'
54
+ 'IconList',
55
+ 'ProductBadge'
52
56
  ];
53
57
  const postPurchaseRequiredElements = [
54
58
  'PostPurchaseProductOffer',
@@ -2,8 +2,17 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
 
5
- const ThemeSectionStatus = ({ ...props })=>{
6
- const isRenderThemeSectionStatus = props.tag === 'Section' && props?.isThemeSection && props?.needPublishing;
5
+ const getStatusMessage = (status)=>{
6
+ switch(status){
7
+ case 'DRAFT':
8
+ return 'This Theme Section is Draft. Publish page will also publish Theme Section.';
9
+ case 'NEED_PUBLISHING':
10
+ return 'Need to republish. Go to global edit and publish this section';
11
+ }
12
+ };
13
+ const ThemeSectionStatusWrapper = ({ tag, status, isThemeSection })=>{
14
+ const isRenderThemeSectionStatus = tag === 'Section' && isThemeSection && (status === 'DRAFT' || status === 'NEED_PUBLISHING');
15
+ const statusMessage = getStatusMessage(status);
7
16
  return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
8
17
  children: isRenderThemeSectionStatus && /*#__PURE__*/ jsxRuntime.jsxs("div", {
9
18
  "data-theme-section-status": true,
@@ -24,13 +33,13 @@ const ThemeSectionStatus = ({ ...props })=>{
24
33
  })
25
34
  })
26
35
  }),
27
- /*#__PURE__*/ jsxRuntime.jsx("span", {
36
+ statusMessage && /*#__PURE__*/ jsxRuntime.jsx("span", {
28
37
  "data-theme-section-status-text": true,
29
- children: "Need to republish. Go to global edit and publish this section"
38
+ children: statusMessage
30
39
  })
31
40
  ]
32
41
  })
33
42
  });
34
43
  };
35
44
 
36
- exports.ThemeSectionStatus = ThemeSectionStatus;
45
+ exports.ThemeSectionStatusWrapper = ThemeSectionStatusWrapper;
@@ -254,7 +254,11 @@ const createBuilderPreviewProvider = (args, pageName, isThemeSectionEditor)=>zus
254
254
  }
255
255
  },
256
256
  getItem: (id)=>{
257
- return get().state[id];
257
+ const item = get().state[id];
258
+ return {
259
+ ...item,
260
+ rawChildrens: item?.childrens?.map((v)=>get().state[v])
261
+ };
258
262
  },
259
263
  removeItem: (id)=>{
260
264
  if (id === 'ROOT') {
@@ -7,8 +7,8 @@ var zustand = require('zustand');
7
7
  const ModalContext = /*#__PURE__*/ react.createContext(null);
8
8
  const createModalProvider = (data)=>zustand.createStore((set)=>({
9
9
  activeId: data,
10
- setModalActive: (id)=>{
11
- window?.parent?.postMessage?.(JSON.stringify({
10
+ setModalActive: (id, notPostMessage)=>{
11
+ !!notPostMessage && window?.parent?.postMessage?.(JSON.stringify({
12
12
  type: 'active-element',
13
13
  uid: id
14
14
  }), '*');
@@ -31,6 +31,31 @@ const createPageStoreProvider = (data)=>zustand.createStore((set)=>({
31
31
  set({
32
32
  publicStoreFrontData: publicStoreFrontData
33
33
  });
34
+ },
35
+ setInteractionIsSelectOnPage: (value)=>{
36
+ set((state)=>({
37
+ interactionData: {
38
+ ...state.interactionData,
39
+ isSelectOnPage: value
40
+ }
41
+ }));
42
+ },
43
+ setInteractionItem: (item)=>{
44
+ set((state)=>({
45
+ interactionData: {
46
+ ...state.interactionData,
47
+ item,
48
+ isSelectOnPage: state.interactionData?.isSelectOnPage || false
49
+ }
50
+ }));
51
+ },
52
+ setInteractionSelectType: (selectType)=>{
53
+ set((state)=>({
54
+ interactionData: {
55
+ ...state.interactionData,
56
+ selectType
57
+ }
58
+ }));
34
59
  }
35
60
  }));
36
61
  const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffers, publicStoreFrontData, ...passProps })=>{
@@ -38,7 +63,10 @@ const PageProvider = ({ children, dynamicProduct, dynamicCollection, productOffe
38
63
  dynamicProduct,
39
64
  dynamicCollection,
40
65
  productOffers,
41
- publicStoreFrontData
66
+ publicStoreFrontData,
67
+ interactionData: {
68
+ selectType: 'element'
69
+ }
42
70
  }), [
43
71
  dynamicProduct,
44
72
  dynamicCollection,
@@ -10,6 +10,7 @@ const SectionContext = /*#__PURE__*/ react.createContext(null);
10
10
  const createSectionProvider = (data)=>zustand.createStore((set, get)=>({
11
11
  data: data ?? {},
12
12
  getSection: (id)=>{
13
+ console.log('get().data', get().data);
13
14
  const section = get().data[id];
14
15
  return section ?? undefined;
15
16
  },
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const convertTextAlignToJustify = (align)=>{
4
+ const devices = [
5
+ 'desktop',
6
+ 'tablet',
7
+ 'mobile'
8
+ ];
9
+ const result = {};
10
+ devices.forEach((device)=>{
11
+ const deviceType = device === 'desktop' ? '' : `${device}:`;
12
+ result[`${deviceType}gp-justify-start`] = align?.[device] === 'left';
13
+ result[`${deviceType}gp-justify-center`] = align?.[device] === 'center';
14
+ result[`${deviceType}gp-justify-end`] = align?.[device] === 'right';
15
+ });
16
+ return result;
17
+ };
18
+
19
+ exports.convertTextAlignToJustify = convertTextAlignToJustify;
@@ -119,7 +119,7 @@ const getGlobalColorStateStyle = (type, data)=>{
119
119
  return Object.fromEntries(Object.entries(data).map(([state, value])=>{
120
120
  if (state === 'active') return [];
121
121
  return [
122
- `-${constant.stateMapping?.[state]}-${type}`,
122
+ `-${constant.stateMapping?.[state] || ''}-${type}`,
123
123
  getSingleColorVariable(value)
124
124
  ];
125
125
  }).filter(isDefined.isDefined));
@@ -156,7 +156,7 @@ const getSingleColorVariable = (color)=>{
156
156
  };
157
157
  function isColor(color) {
158
158
  if (!color || typeof color !== 'string') return false;
159
- return color?.startsWith('#') || color?.startsWith('rgb') || color?.startsWith('hsl') || color?.startsWith('transparent');
159
+ return color?.startsWith('#') || color?.startsWith('rgb') || color?.startsWith('hsl') || color?.startsWith('transparent') || color?.startsWith('linear-gradient');
160
160
  }
161
161
  const getGlobalColorStyle = (data)=>{
162
162
  if (!data) return {};
@@ -27,7 +27,7 @@ const getStyleShadow = (shadowStyle, isActiveState = false)=>{
27
27
  if (typeof value.distance == 'undefined') return {};
28
28
  const { value: distance, unit: unitDistance } = parseValueWithUnit(`${value?.distance}`);
29
29
  return {
30
- [`-${!isActiveState ? constant.stateMapping?.[state] : ''}-${getShortname.getShortName(styleAppliedFor)}`]: isEnableShadow ? `${Math.cos(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${value?.blur} ${styleAppliedFor === 'box-shadow' ? value?.spread + ' ' : ''}${colors.getSingleColorVariable(value?.color)}` : 'none'
30
+ [`-${!isActiveState ? constant.stateMapping?.[state] || '' : ''}-${getShortname.getShortName(styleAppliedFor)}`]: isEnableShadow ? `${Math.cos(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${value?.blur} ${styleAppliedFor === 'box-shadow' ? value?.spread + ' ' : ''}${colors.getSingleColorVariable(value?.color)}` : 'none'
31
31
  };
32
32
  };
33
33
  const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow)=>{
@@ -181,6 +181,9 @@ function getCustomPaddingSizeCSSByDevice(globalSize, device) {
181
181
  const getPaddingGlobalSize = (globalSize)=>{
182
182
  return Object.assign({}, getCustomPaddingSizeCSSByDevice(globalSize, 'desktop'), getCustomPaddingSizeCSSByDevice(globalSize, 'tablet'), getCustomPaddingSizeCSSByDevice(globalSize, 'mobile'));
183
183
  };
184
+ const getValueByDevice = (value, device)=>{
185
+ return value?.[device] === undefined ? value?.desktop === undefined ? value?.tablet : value?.desktop : value?.[device];
186
+ };
184
187
 
185
188
  exports.composeSize = composeSize;
186
189
  exports.composeSizeCss = composeSizeCss;
@@ -189,6 +192,7 @@ exports.getAspectRatioGlobalSize = getAspectRatioGlobalSize;
189
192
  exports.getGlobalSizeGap = getGlobalSizeGap;
190
193
  exports.getHeightByShapeGlobalSize = getHeightByShapeGlobalSize;
191
194
  exports.getPaddingGlobalSize = getPaddingGlobalSize;
195
+ exports.getValueByDevice = getValueByDevice;
192
196
  exports.getWidthByShapeGlobalSize = getWidthByShapeGlobalSize;
193
197
  exports.getWidthHeightGlobalSize = getWidthHeightGlobalSize;
194
198
  exports.makeGlobalSize = makeGlobalSize;
@@ -5,6 +5,7 @@ var react = require('react');
5
5
  const useAnimationPreview = ({ props, playAnimation, cancelAnimation, setAnimationOnFinish, setToolbarActive })=>{
6
6
  const previewAnimation = react.useCallback((e)=>{
7
7
  const { uid, isCancel } = e.detail;
8
+ console.log('props.uid !== uid', props.uid !== uid, props.uid, uid);
8
9
  if (props.uid !== uid) return;
9
10
  cancelAnimation();
10
11
  if (isCancel) {
@@ -8,6 +8,7 @@ var useAnimationTarget = require('./useAnimationTarget.js');
8
8
  var useAnimationConfig = require('./useAnimationConfig.js');
9
9
  var useAnimationActions = require('./useAnimationActions.js');
10
10
  var useAnimationPreview = require('./useAnimationPreview.js');
11
+ require('../../types/custom.js');
11
12
  var animations = require('../../types/animations.js');
12
13
 
13
14
  const useApplyAnimation = ({ props })=>{
@@ -40,6 +41,7 @@ const useApplyAnimation = ({ props })=>{
40
41
  setting,
41
42
  target: item.target
42
43
  }));
44
+ console.log('listAnimations', listAnimations);
43
45
  cancelAnimation();
44
46
  setAnimation(listAnimations);
45
47
  }, [
@@ -18,6 +18,7 @@ const useArticlesQuery = (variables, options)=>{
18
18
  };
19
19
  const useBlogsQuery = (variables, options)=>{
20
20
  const fetcher = useFetchHandle.useFetchHandle();
21
+ //@ts-ignore
21
22
  const fetchBlogs = ()=>fetcher([
22
23
  blogs_generated.BlogsDocument,
23
24
  variables ?? {}