@gem-sdk/core 1.56.0-staging.3 → 1.56.0-staging.39

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 (48) hide show
  1. package/dist/cjs/components/ComponentToolbarPreview.js +182 -107
  2. package/dist/cjs/components/ComponentWrapper.js +16 -1
  3. package/dist/cjs/components/ComponentWrapperPreview.js +16 -2
  4. package/dist/cjs/components/InteractionSuffix.js +54 -0
  5. package/dist/cjs/components/Render.liquid.js +22 -7
  6. package/dist/cjs/contexts/PageContext.js +37 -1
  7. package/dist/cjs/graphql/fragments/published-theme-page.generated.js +8 -0
  8. package/dist/cjs/helpers/animations.js +17 -8
  9. package/dist/cjs/helpers/background.js +7 -5
  10. package/dist/cjs/helpers/compose-advance-style.js +16 -4
  11. package/dist/cjs/helpers/interaction/index.js +85 -0
  12. package/dist/cjs/helpers/shadow.js +2 -2
  13. package/dist/cjs/helpers/third-party/appConfig.js +21 -0
  14. package/dist/cjs/helpers/third-party/appSetting.js +115 -60
  15. package/dist/cjs/helpers/third-party/constant.js +4 -1
  16. package/dist/cjs/hooks/animation/useAnimationConfig.js +2 -1
  17. package/dist/cjs/hooks/animation/useAnimationTarget.js +5 -2
  18. package/dist/cjs/hooks/animation/useApplyAnimation.js +6 -4
  19. package/dist/cjs/hooks/useInteraction.js +19 -0
  20. package/dist/cjs/hooks/useToolbarPostPurchase.js +2 -2
  21. package/dist/cjs/index.js +12 -1
  22. package/dist/cjs/types/animations.js +2 -0
  23. package/dist/cjs/types/custom.js +51 -0
  24. package/dist/esm/components/ComponentToolbarPreview.js +182 -107
  25. package/dist/esm/components/ComponentWrapper.js +16 -1
  26. package/dist/esm/components/ComponentWrapperPreview.js +16 -2
  27. package/dist/esm/components/InteractionSuffix.js +52 -0
  28. package/dist/esm/components/Render.liquid.js +22 -7
  29. package/dist/esm/contexts/PageContext.js +37 -1
  30. package/dist/esm/graphql/fragments/published-theme-page.generated.js +8 -0
  31. package/dist/esm/helpers/animations.js +17 -8
  32. package/dist/esm/helpers/background.js +7 -5
  33. package/dist/esm/helpers/compose-advance-style.js +17 -5
  34. package/dist/esm/helpers/interaction/index.js +83 -0
  35. package/dist/esm/helpers/shadow.js +2 -2
  36. package/dist/esm/helpers/third-party/appConfig.js +19 -1
  37. package/dist/esm/helpers/third-party/appSetting.js +115 -60
  38. package/dist/esm/helpers/third-party/constant.js +5 -2
  39. package/dist/esm/hooks/animation/useAnimationConfig.js +2 -1
  40. package/dist/esm/hooks/animation/useAnimationTarget.js +5 -2
  41. package/dist/esm/hooks/animation/useApplyAnimation.js +6 -4
  42. package/dist/esm/hooks/useInteraction.js +17 -0
  43. package/dist/esm/hooks/useToolbarPostPurchase.js +2 -2
  44. package/dist/esm/index.js +3 -1
  45. package/dist/esm/types/animations.js +2 -0
  46. package/dist/esm/types/custom.js +51 -0
  47. package/dist/types/index.d.ts +125 -9
  48. package/package.json +2 -2
@@ -7,6 +7,7 @@ var react = require('react');
7
7
  require('zustand');
8
8
  var BuilderPreviewContext = require('../contexts/BuilderPreviewContext.js');
9
9
  var ShopContext = require('../contexts/ShopContext.js');
10
+ var PageContext = require('../contexts/PageContext.js');
10
11
  require('@gem-sdk/adapter-shopify');
11
12
  require('swr');
12
13
  require('swr/mutation');
@@ -21,6 +22,7 @@ var useToolbarPostPurchase = require('../hooks/useToolbarPostPurchase.js');
21
22
  var constant = require('./constant.js');
22
23
  var AIContentGenerator = require('./ai-generator/AIContentGenerator.js');
23
24
  var AIGenContentLoading = require('./ai-generator/AIGenContentLoading.js');
25
+ var InteractionSuffix = require('./InteractionSuffix.js');
24
26
  require('../helpers/convert.js');
25
27
 
26
28
  const SECTION_LIMIT = 25;
@@ -46,6 +48,7 @@ const ComponentToolbarPreview = (props)=>{
46
48
  const [parents, setParents] = react.useState([]);
47
49
  const [deleteTooltipPosition, setDeleteTooltipPosition] = react.useState('top');
48
50
  const [isDisableDelete, setIsUnableDelete] = react.useState(false);
51
+ const [isActiveToolbarComponent, setIsActiveToolbarComponent] = react.useState(false);
49
52
  const [productId, setProductId] = react.useState('');
50
53
  const [articleUid, setArticleUid] = react.useState('');
51
54
  const [tooltipText, setTooltipText] = react.useState({
@@ -53,6 +56,7 @@ const ComponentToolbarPreview = (props)=>{
53
56
  text: ''
54
57
  });
55
58
  const [isDisableDuplicate, setIsDisableDuplicate] = react.useState(false);
59
+ const interactionData = PageContext.usePageStore((s)=>s.interactionData);
56
60
  const isSaleFunnelPage = react.useMemo(()=>editingPageType === 'POST_PURCHASE', [
57
61
  editingPageType
58
62
  ]);
@@ -97,7 +101,7 @@ const ComponentToolbarPreview = (props)=>{
97
101
  };
98
102
  const getDeleteTooltipPosition = react.useCallback(()=>{
99
103
  if (props.tag == 'Section') return 'bottom';
100
- const $toolbar = document.querySelector('[data-toolbar-active="true"]');
104
+ const $toolbar = document.body.querySelector('#storefront')?.querySelector('[data-toolbar-active="true"]');
101
105
  if ($toolbar) {
102
106
  const rect = $toolbar.getBoundingClientRect();
103
107
  if (rect.top < 60) setDeleteTooltipPosition('bottom');
@@ -132,6 +136,33 @@ const ComponentToolbarPreview = (props)=>{
132
136
  articleUid,
133
137
  linkShopDefault
134
138
  ]);
139
+ const isSelectOnPage = react.useMemo(()=>interactionData?.isSelectOnPage, [
140
+ interactionData?.isSelectOnPage
141
+ ]);
142
+ const settingType = react.useMemo(()=>interactionData?.settingType, [
143
+ interactionData?.settingType
144
+ ]);
145
+ const isShowIconInteractionTarget = react.useMemo(()=>{
146
+ return interactionData?.item?.targets?.find((t)=>t.uid === props.uid && t?.type !== 'PAGE') && settingType === 'TARGET';
147
+ }, [
148
+ interactionData?.item?.targets,
149
+ props.uid,
150
+ settingType
151
+ ]);
152
+ const isShowIconInteractionTrigger = react.useMemo(()=>{
153
+ return interactionData?.item?.self?.uid === props.uid && interactionData?.item?.self.type !== 'PAGE' && settingType === 'TRIGGER';
154
+ }, [
155
+ interactionData?.item?.self?.type,
156
+ interactionData?.item?.self?.uid,
157
+ props.uid,
158
+ settingType
159
+ ]);
160
+ const isDisplayIconDrag = react.useMemo(()=>{
161
+ return !isShowIconInteractionTarget && !isShowIconInteractionTrigger;
162
+ }, [
163
+ isShowIconInteractionTarget,
164
+ isShowIconInteractionTrigger
165
+ ]);
135
166
  // Get parents
136
167
  const onActiveComponent = react.useCallback((e)=>{
137
168
  const detail = e.detail;
@@ -142,6 +173,7 @@ const ComponentToolbarPreview = (props)=>{
142
173
  setProductId(detail.productId);
143
174
  }
144
175
  if (detail?.componentUid == props.uid) {
176
+ setIsActiveToolbarComponent(true);
145
177
  getDeleteTooltipPosition();
146
178
  if (isSaleFunnelPage) {
147
179
  setIsUnableDelete(checkDisableDelete());
@@ -157,6 +189,7 @@ const ComponentToolbarPreview = (props)=>{
157
189
  }).slice(0, 3);
158
190
  setParents(currentParents);
159
191
  } else {
192
+ setIsActiveToolbarComponent(false);
160
193
  setParents([]);
161
194
  setIsShowParent(false);
162
195
  }
@@ -344,7 +377,39 @@ const ComponentToolbarPreview = (props)=>{
344
377
  onClick: (e)=>onShowParent(e),
345
378
  "aria-hidden": "true",
346
379
  children: [
347
- /*#__PURE__*/ jsxRuntime.jsx("div", {
380
+ isShowIconInteractionTrigger && /*#__PURE__*/ jsxRuntime.jsx("div", {
381
+ className: "gp-hidden gp-w-[12px] interaction-use-custom-element",
382
+ children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
383
+ width: "12",
384
+ height: "13",
385
+ viewBox: "0 0 12 13",
386
+ fill: "none",
387
+ xmlns: "http://www.w3.org/2000/svg",
388
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
389
+ fillRule: "evenodd",
390
+ clipRule: "evenodd",
391
+ d: "M4.36823 0.430157C4.51621 0.205309 4.76733 0.0699463 5.0365 0.0699463H9.886C10.2045 0.0699463 10.3952 0.424012 10.2201 0.689974L8.36993 3.49883C8.28234 3.63182 8.37772 3.80885 8.53695 3.80885H10.7492C11.1114 3.80885 11.2871 4.25167 11.0235 4.5L3.03995 12.0213C2.75745 12.2874 2.29956 12.0357 2.37286 11.6546L3.28019 6.93662C3.30391 6.81327 3.20939 6.69885 3.08379 6.69885H0.984895C0.666494 6.69885 0.475723 6.34493 0.650759 6.07895L4.36823 0.430157ZM5.48883 1.20046C5.35424 1.20046 5.22868 1.26814 5.15469 1.38057L2.6027 5.25839C2.51518 5.39137 2.61056 5.56833 2.76976 5.56833H4.27861C4.52982 5.56833 4.71885 5.79718 4.67141 6.04387L4.12087 8.9066C4.08422 9.09717 4.31317 9.22301 4.45442 9.08994L8.49328 5.28494C8.62508 5.16077 8.53721 4.93936 8.35614 4.93936H6.75127C6.4328 4.93936 6.24204 4.5853 6.41722 4.31934L8.26734 1.51048C8.35494 1.37749 8.25956 1.20046 8.10032 1.20046H5.48883Z",
392
+ fill: "#F9F9F9"
393
+ })
394
+ })
395
+ }),
396
+ isShowIconInteractionTarget && /*#__PURE__*/ jsxRuntime.jsx("div", {
397
+ className: "gp-hidden gp-w-[14px] interaction-use-custom-element",
398
+ children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
399
+ width: "14",
400
+ height: "14",
401
+ viewBox: "0 0 14 14",
402
+ fill: "none",
403
+ xmlns: "http://www.w3.org/2000/svg",
404
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
405
+ fillRule: "evenodd",
406
+ clipRule: "evenodd",
407
+ d: "M6.2941 2.19513C6.70415 2.13657 6.9891 1.75669 6.93054 1.34663C6.87198 0.936581 6.49209 0.651638 6.08204 0.710196C2.98687 1.15221 0.607666 3.8125 0.607666 7.02978C0.607666 10.5556 3.46588 13.4138 6.99166 13.4138C10.1798 13.4138 12.8209 11.0775 13.2987 8.02354C13.3627 7.61431 13.0828 7.23065 12.6736 7.16663C12.2644 7.1026 11.8807 7.38245 11.8167 7.79169C11.4513 10.127 9.42946 11.9138 6.99166 11.9138C4.2943 11.9138 2.10767 9.72714 2.10767 7.02978C2.10767 4.56958 3.92742 2.53311 6.2941 2.19513ZM9.32325 0.978487C9.59794 0.703796 10.0673 0.833594 10.1618 1.21039L10.648 3.14898C10.6705 3.2384 10.7403 3.30822 10.8297 3.33065L12.7683 3.81691C13.1451 3.91143 13.2749 4.38075 13.0002 4.65544L11.3265 6.32911C11.099 6.55668 10.7758 6.66082 10.4581 6.60891L9.03886 6.37696C8.72123 6.32505 8.39804 6.42918 8.17046 6.65676L7.40064 7.42658C7.16633 7.66089 6.78643 7.66089 6.55211 7.42658C6.3178 7.19227 6.3178 6.81237 6.55211 6.57805L7.32193 5.80823C7.54951 5.58066 7.65364 5.25746 7.60173 4.93983L7.36978 3.52055C7.31787 3.20293 7.42201 2.87973 7.64958 2.65216L9.32325 0.978487ZM8.79074 4.77514C8.82538 4.98713 8.99156 5.15331 9.20355 5.18795L10.2975 5.36674C10.4564 5.3927 10.618 5.34063 10.7317 5.22684L10.9663 4.99227C11.1037 4.85492 11.0388 4.62026 10.8504 4.573L9.98586 4.35615C9.80703 4.3113 9.66739 4.17166 9.62254 3.99283L9.40569 3.12832C9.35843 2.93992 9.12377 2.87502 8.98642 3.01237L8.75185 3.24695C8.63806 3.36073 8.58599 3.52233 8.61195 3.68114L8.79074 4.77514ZM7.02213 4.44284C7.14103 4.83962 6.91577 5.25766 6.51899 5.37657C5.8172 5.58687 5.30708 6.2382 5.30708 7.00672C5.30708 7.94638 6.06883 8.70813 7.00849 8.70813C7.77819 8.70813 8.43033 8.19644 8.6396 7.49302C8.75772 7.096 9.17531 6.86991 9.57233 6.98802C9.96934 7.10614 10.1954 7.52373 10.0773 7.92075C9.68401 9.24279 8.45997 10.2081 7.00849 10.2081C5.2404 10.2081 3.80708 8.77481 3.80708 7.00672C3.80708 5.55746 4.76949 4.33493 6.0884 3.9397C6.48518 3.82079 6.90323 4.04606 7.02213 4.44284Z",
408
+ fill: "#F9F9F9"
409
+ })
410
+ })
411
+ }),
412
+ isActiveToolbarComponent && isDisplayIconDrag && /*#__PURE__*/ jsxRuntime.jsx("div", {
348
413
  "data-toolbar-icon-drag": true,
349
414
  children: /*#__PURE__*/ jsxRuntime.jsxs("svg", {
350
415
  width: "16",
@@ -383,7 +448,7 @@ const ComponentToolbarPreview = (props)=>{
383
448
  "data-toolbar-name": true,
384
449
  children: [
385
450
  getSectionName(),
386
- props.isShopifySection && !props.isShopifyVisibility && /*#__PURE__*/ jsxRuntime.jsxs("svg", {
451
+ isActiveToolbarComponent && props.isShopifySection && !props.isShopifyVisibility && /*#__PURE__*/ jsxRuntime.jsxs("svg", {
387
452
  "data-toolbar-visibility": true,
388
453
  width: "20",
389
454
  height: "20",
@@ -416,7 +481,7 @@ const ComponentToolbarPreview = (props)=>{
416
481
  "data-toolbar-name": true,
417
482
  children: toolbarName()
418
483
  }),
419
- props.tag !== 'Section' && parents.length > 0 && /*#__PURE__*/ jsxRuntime.jsx("div", {
484
+ isActiveToolbarComponent && props.tag !== 'Section' && parents.length > 0 && /*#__PURE__*/ jsxRuntime.jsx("div", {
420
485
  "data-toolbar-icon-parent": true,
421
486
  "data-toolbar-icon-parent-open": isShowParent,
422
487
  children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
@@ -432,7 +497,7 @@ const ComponentToolbarPreview = (props)=>{
432
497
  })
433
498
  ]
434
499
  }),
435
- isShowParent && parents.map((parent, index)=>{
500
+ isActiveToolbarComponent && isShowParent && parents.map((parent, index)=>{
436
501
  // Update count columns of Row
437
502
  const parentLength = parent?.childrens?.length ?? 0;
438
503
  let parent_label = parent.label;
@@ -441,6 +506,7 @@ const ComponentToolbarPreview = (props)=>{
441
506
  }
442
507
  return /*#__PURE__*/ jsxRuntime.jsxs("div", {
443
508
  "data-toolbar-parent": true,
509
+ "data-component-tag": parent.tag,
444
510
  "data-parent-uid": parent.uid,
445
511
  "data-toolbar-theme-section": isThemeSectionEditor,
446
512
  "data-toolbar-parent-revert": isShowParentRevert,
@@ -491,109 +557,118 @@ const ComponentToolbarPreview = (props)=>{
491
557
  ]
492
558
  }, parent.uid);
493
559
  }),
494
- props.tag === 'Section' && !props.isThemeSection && isEnableCreateThemeSection() && !props.isShopifySection && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(CreateThemeSection.CreateThemeSection, {
495
- ...props
496
- }),
497
- isEnableAIContent() && /*#__PURE__*/ jsxRuntime.jsx(AIContentGenerator.AIContentGenerator, {
498
- ...props
499
- }),
500
- props.tag == 'Sticky' && /*#__PURE__*/ jsxRuntime.jsx("div", {
501
- "data-toolbar-zoom-out": true,
502
- onClick: (e)=>onZoomOut(e),
503
- "aria-hidden": "true",
504
- children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
505
- width: "16",
506
- height: "16",
507
- viewBox: "0 0 16 16",
508
- fill: "none",
509
- xmlns: "http://www.w3.org/2000/svg",
510
- children: /*#__PURE__*/ jsxRuntime.jsx("path", {
511
- fillRule: "evenodd",
512
- clipRule: "evenodd",
513
- d: "M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",
514
- fill: "currentColor"
515
- })
516
- })
517
- }),
518
- editAbleElementList.includes(props.tag) && /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
519
- "data-toolbar-title": true,
520
- enable: true,
521
- "data-toolbar-disable": false,
522
- text: "Edit content in Shopify",
523
- position: "top",
524
- onClick: goToShopifyEditLink,
525
- "aria-hidden": "true",
526
- children: /*#__PURE__*/ jsxRuntime.jsxs("svg", {
527
- width: "16",
528
- height: "16",
529
- viewBox: "0 0 16 16",
530
- fill: "none",
531
- xmlns: "http://www.w3.org/2000/svg",
532
- children: [
533
- /*#__PURE__*/ jsxRuntime.jsx("path", {
534
- fillRule: "evenodd",
535
- clipRule: "evenodd",
536
- d: "M8.61129 2.47348C8.61129 2.47348 8.47099 2.51557 8.23248 2.59274C8.19039 2.46647 8.13427 2.30512 8.05009 2.15079C7.78352 1.6387 7.39068 1.37212 6.91366 1.36511C6.87858 1.36511 6.85052 1.36511 6.81545 1.37212C6.80843 1.36511 6.80142 1.35634 6.7944 1.34757C6.78739 1.3388 6.78037 1.33003 6.77336 1.32302C6.56992 1.09854 6.30335 0.993314 5.98768 1.00033C5.37737 1.02137 4.76706 1.46332 4.269 2.249C3.91825 2.80319 3.65869 3.49767 3.58153 4.03082C3.38823 4.09074 3.21092 4.14586 3.05516 4.19429C2.64595 4.32151 2.3851 4.40261 2.37494 4.40261C2.01718 4.51485 2.01016 4.52888 1.96106 4.85859C1.92598 5.11113 1 12.2945 1 12.2945L7.14764 13.3583C7.18955 13.118 7.30454 12.8953 7.47848 12.7214L8.70249 11.4974V2.45945C8.66741 2.45945 8.63234 2.46647 8.61129 2.47348ZM6.82948 3.02767L6.62554 3.09101C6.27515 3.19989 5.90094 3.31617 5.5317 3.42752C5.65797 2.94349 5.89648 2.46647 6.19111 2.15079C6.30335 2.03154 6.45067 1.90527 6.63306 1.8281C6.80142 2.18587 6.83649 2.68393 6.82948 3.02767ZM5.99469 1.4072C6.13499 1.4072 6.26126 1.43526 6.36649 1.50541C6.19813 1.58959 6.0438 1.71586 5.88947 1.87721C5.50364 2.29109 5.202 2.94349 5.08274 3.56783C4.74459 3.66991 4.41804 3.77199 4.10838 3.8688L4.01646 3.89753C4.22691 2.90841 5.05468 1.43526 5.99469 1.4072ZM4.80214 7.0122C4.81874 7.26957 5.09737 7.44833 5.43473 7.66478C5.95252 7.99699 6.60867 8.41798 6.66813 9.3482C6.7453 10.5548 6.02977 11.3826 4.99154 11.4457C3.7569 11.5229 3.06943 10.7933 3.06943 10.7933L3.32899 9.67791C3.32899 9.67791 4.01646 10.197 4.56363 10.1619C4.92139 10.1409 5.04767 9.84627 5.04065 9.64283C5.01607 9.26796 4.73308 9.06671 4.41569 8.84101C4.00848 8.55142 3.54465 8.22157 3.49735 7.4331C3.42018 6.24756 4.19885 5.05501 5.91051 4.94277C6.57694 4.90068 6.91366 5.06904 6.91366 5.06904L6.52082 6.53518C6.52082 6.53518 6.08589 6.33876 5.56678 6.36682C4.80915 6.41592 4.79512 6.89294 4.80214 7.0122ZM7.23635 2.9014C7.22934 2.59274 7.19426 2.15781 7.04695 1.78601C7.50994 1.87721 7.74143 2.39632 7.83964 2.71199C7.70008 2.75665 7.54275 2.80575 7.37118 2.8593L7.23635 2.9014Z",
537
- fill: "currentColor"
538
- }),
539
- /*#__PURE__*/ jsxRuntime.jsx("path", {
540
- d: "M10.7719 3.44156C10.7757 3.47543 11.1733 6.16931 11.541 8.65883L8.95503 11.2448V2.57871C9.16548 2.78214 9.71265 3.31528 9.71265 3.31528C9.71265 3.31528 10.6106 3.32931 10.6597 3.33633C10.7088 3.34334 10.7649 3.37842 10.7719 3.44156Z",
541
- fill: "currentColor"
542
- }),
543
- /*#__PURE__*/ jsxRuntime.jsx("path", {
544
- d: "M14.8056 8.644L14.0424 7.88088C13.7832 7.62163 13.3629 7.62163 13.1036 7.88088L12.1519 8.83258L13.8539 10.5345L14.8056 9.58282C15.0648 9.32357 15.0648 8.90325 14.8056 8.644Z",
545
- fill: "currentColor"
546
- }),
547
- /*#__PURE__*/ jsxRuntime.jsx("path", {
548
- d: "M7.85018 13.0942L11.6419 9.30246L13.3438 11.0044L9.55212 14.7961C9.43782 14.9104 9.28573 14.9791 9.1244 14.9892L7.93427 15.0641C7.73484 15.0767 7.56961 14.9114 7.58216 14.712L7.65706 13.5219C7.66721 13.3606 7.73588 13.2085 7.85018 13.0942Z",
549
- fill: "currentColor"
560
+ isActiveToolbarComponent && !isSelectOnPage && /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
561
+ children: [
562
+ ' ',
563
+ props.tag === 'Section' && !props.isThemeSection && isEnableCreateThemeSection() && !props.isShopifySection && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(CreateThemeSection.CreateThemeSection, {
564
+ ...props
565
+ }),
566
+ isEnableAIContent() && /*#__PURE__*/ jsxRuntime.jsx(AIContentGenerator.AIContentGenerator, {
567
+ ...props
568
+ }),
569
+ props.tag == 'Sticky' && /*#__PURE__*/ jsxRuntime.jsx("div", {
570
+ "data-toolbar-zoom-out": true,
571
+ onClick: (e)=>onZoomOut(e),
572
+ "aria-hidden": "true",
573
+ children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
574
+ width: "16",
575
+ height: "16",
576
+ viewBox: "0 0 16 16",
577
+ fill: "none",
578
+ xmlns: "http://www.w3.org/2000/svg",
579
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
580
+ fillRule: "evenodd",
581
+ clipRule: "evenodd",
582
+ d: "M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",
583
+ fill: "currentColor"
584
+ })
585
+ })
586
+ }),
587
+ editAbleElementList.includes(props.tag) && /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
588
+ "data-toolbar-title": true,
589
+ enable: true,
590
+ "data-toolbar-disable": false,
591
+ text: "Edit content in Shopify",
592
+ position: "top",
593
+ onClick: goToShopifyEditLink,
594
+ "aria-hidden": "true",
595
+ children: /*#__PURE__*/ jsxRuntime.jsxs("svg", {
596
+ width: "16",
597
+ height: "16",
598
+ viewBox: "0 0 16 16",
599
+ fill: "none",
600
+ xmlns: "http://www.w3.org/2000/svg",
601
+ children: [
602
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
603
+ fillRule: "evenodd",
604
+ clipRule: "evenodd",
605
+ d: "M8.61129 2.47348C8.61129 2.47348 8.47099 2.51557 8.23248 2.59274C8.19039 2.46647 8.13427 2.30512 8.05009 2.15079C7.78352 1.6387 7.39068 1.37212 6.91366 1.36511C6.87858 1.36511 6.85052 1.36511 6.81545 1.37212C6.80843 1.36511 6.80142 1.35634 6.7944 1.34757C6.78739 1.3388 6.78037 1.33003 6.77336 1.32302C6.56992 1.09854 6.30335 0.993314 5.98768 1.00033C5.37737 1.02137 4.76706 1.46332 4.269 2.249C3.91825 2.80319 3.65869 3.49767 3.58153 4.03082C3.38823 4.09074 3.21092 4.14586 3.05516 4.19429C2.64595 4.32151 2.3851 4.40261 2.37494 4.40261C2.01718 4.51485 2.01016 4.52888 1.96106 4.85859C1.92598 5.11113 1 12.2945 1 12.2945L7.14764 13.3583C7.18955 13.118 7.30454 12.8953 7.47848 12.7214L8.70249 11.4974V2.45945C8.66741 2.45945 8.63234 2.46647 8.61129 2.47348ZM6.82948 3.02767L6.62554 3.09101C6.27515 3.19989 5.90094 3.31617 5.5317 3.42752C5.65797 2.94349 5.89648 2.46647 6.19111 2.15079C6.30335 2.03154 6.45067 1.90527 6.63306 1.8281C6.80142 2.18587 6.83649 2.68393 6.82948 3.02767ZM5.99469 1.4072C6.13499 1.4072 6.26126 1.43526 6.36649 1.50541C6.19813 1.58959 6.0438 1.71586 5.88947 1.87721C5.50364 2.29109 5.202 2.94349 5.08274 3.56783C4.74459 3.66991 4.41804 3.77199 4.10838 3.8688L4.01646 3.89753C4.22691 2.90841 5.05468 1.43526 5.99469 1.4072ZM4.80214 7.0122C4.81874 7.26957 5.09737 7.44833 5.43473 7.66478C5.95252 7.99699 6.60867 8.41798 6.66813 9.3482C6.7453 10.5548 6.02977 11.3826 4.99154 11.4457C3.7569 11.5229 3.06943 10.7933 3.06943 10.7933L3.32899 9.67791C3.32899 9.67791 4.01646 10.197 4.56363 10.1619C4.92139 10.1409 5.04767 9.84627 5.04065 9.64283C5.01607 9.26796 4.73308 9.06671 4.41569 8.84101C4.00848 8.55142 3.54465 8.22157 3.49735 7.4331C3.42018 6.24756 4.19885 5.05501 5.91051 4.94277C6.57694 4.90068 6.91366 5.06904 6.91366 5.06904L6.52082 6.53518C6.52082 6.53518 6.08589 6.33876 5.56678 6.36682C4.80915 6.41592 4.79512 6.89294 4.80214 7.0122ZM7.23635 2.9014C7.22934 2.59274 7.19426 2.15781 7.04695 1.78601C7.50994 1.87721 7.74143 2.39632 7.83964 2.71199C7.70008 2.75665 7.54275 2.80575 7.37118 2.8593L7.23635 2.9014Z",
606
+ fill: "currentColor"
607
+ }),
608
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
609
+ d: "M10.7719 3.44156C10.7757 3.47543 11.1733 6.16931 11.541 8.65883L8.95503 11.2448V2.57871C9.16548 2.78214 9.71265 3.31528 9.71265 3.31528C9.71265 3.31528 10.6106 3.32931 10.6597 3.33633C10.7088 3.34334 10.7649 3.37842 10.7719 3.44156Z",
610
+ fill: "currentColor"
611
+ }),
612
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
613
+ d: "M14.8056 8.644L14.0424 7.88088C13.7832 7.62163 13.3629 7.62163 13.1036 7.88088L12.1519 8.83258L13.8539 10.5345L14.8056 9.58282C15.0648 9.32357 15.0648 8.90325 14.8056 8.644Z",
614
+ fill: "currentColor"
615
+ }),
616
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
617
+ d: "M7.85018 13.0942L11.6419 9.30246L13.3438 11.0044L9.55212 14.7961C9.43782 14.9104 9.28573 14.9791 9.1244 14.9892L7.93427 15.0641C7.73484 15.0767 7.56961 14.9114 7.58216 14.712L7.65706 13.5219C7.66721 13.3606 7.73588 13.2085 7.85018 13.0942Z",
618
+ fill: "currentColor"
619
+ })
620
+ ]
621
+ })
622
+ }),
623
+ /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
624
+ enable: props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
625
+ text: "Page has reached Shopify’s 25 section-limit",
626
+ position: "bottom",
627
+ "data-toolbar-duplicate": true,
628
+ "data-toolbar-disable": props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT || isDisableDuplicate,
629
+ onClick: isDisableDuplicate ? undefined : (e)=>onDuplicate(e),
630
+ "aria-hidden": "true",
631
+ className: isDisableDuplicate ? '!gp-cursor-not-allowed' : '',
632
+ children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
633
+ width: "16",
634
+ height: "16",
635
+ viewBox: "0 0 16 16",
636
+ fill: "none",
637
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
638
+ fillRule: "evenodd",
639
+ clipRule: "evenodd",
640
+ d: "M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",
641
+ fill: "currentColor"
642
+ })
643
+ })
644
+ }),
645
+ /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
646
+ "data-toolbar-delete": true,
647
+ onClick: (e)=>isDisableDelete ? null : onDelete(e),
648
+ enable: isDisableDelete,
649
+ "data-toolbar-disable": isDisableDelete,
650
+ width: tooltipText.width,
651
+ text: tooltipText.text,
652
+ position: deleteTooltipPosition,
653
+ "aria-hidden": "true",
654
+ children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
655
+ width: "16",
656
+ height: "16",
657
+ viewBox: "0 0 16 16",
658
+ fill: "none",
659
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
660
+ fillRule: "evenodd",
661
+ clipRule: "evenodd",
662
+ d: "M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",
663
+ fill: "currentColor"
664
+ })
550
665
  })
551
- ]
552
- })
553
- }),
554
- /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
555
- enable: props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
556
- text: "Page has reached Shopify’s 25 section-limit",
557
- position: "bottom",
558
- "data-toolbar-duplicate": true,
559
- "data-toolbar-disable": props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT || isDisableDuplicate,
560
- onClick: isDisableDuplicate ? undefined : (e)=>onDuplicate(e),
561
- "aria-hidden": "true",
562
- className: isDisableDuplicate ? '!gp-cursor-not-allowed' : '',
563
- children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
564
- width: "16",
565
- height: "16",
566
- viewBox: "0 0 16 16",
567
- fill: "none",
568
- children: /*#__PURE__*/ jsxRuntime.jsx("path", {
569
- fillRule: "evenodd",
570
- clipRule: "evenodd",
571
- d: "M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",
572
- fill: "currentColor"
573
666
  })
574
- })
667
+ ]
575
668
  }),
576
- /*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
577
- "data-toolbar-delete": true,
578
- onClick: (e)=>isDisableDelete ? null : onDelete(e),
579
- enable: isDisableDelete,
580
- "data-toolbar-disable": isDisableDelete,
581
- width: tooltipText.width,
582
- text: tooltipText.text,
583
- position: deleteTooltipPosition,
584
- "aria-hidden": "true",
585
- children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
586
- width: "16",
587
- height: "16",
588
- viewBox: "0 0 16 16",
589
- fill: "none",
590
- children: /*#__PURE__*/ jsxRuntime.jsx("path", {
591
- fillRule: "evenodd",
592
- clipRule: "evenodd",
593
- d: "M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",
594
- fill: "currentColor"
595
- })
596
- })
669
+ /*#__PURE__*/ jsxRuntime.jsx(InteractionSuffix.InteractionSuffix, {
670
+ tag: props.tag,
671
+ uid: props.uid
597
672
  })
598
673
  ]
599
674
  }, props.uid),
@@ -651,10 +726,10 @@ const ComponentToolbarPreview = (props)=>{
651
726
  })
652
727
  ]
653
728
  }),
654
- constant.ableGenerateContentElements.includes(props.tag) && /*#__PURE__*/ jsxRuntime.jsx(AIGenContentLoading.AIGenContentLoading, {
729
+ constant.ableGenerateContentElements.includes(props.tag) && isActiveToolbarComponent && /*#__PURE__*/ jsxRuntime.jsx(AIGenContentLoading.AIGenContentLoading, {
655
730
  ...props
656
731
  }),
657
- /*#__PURE__*/ jsxRuntime.jsx(Resize.default, {
732
+ isActiveToolbarComponent && /*#__PURE__*/ jsxRuntime.jsx(Resize.default, {
658
733
  ...props
659
734
  })
660
735
  ]
@@ -12,6 +12,16 @@ const ComponentWrapper = ({ children, pageType, ...props })=>{
12
12
  if (props.type === 'section') return null;
13
13
  const style = composeAdvanceStyle.composeAdvanceStyle(props.advanced, props.tag, pageType);
14
14
  const advanced = props.advanced;
15
+ const interactionAttributes = ()=>{
16
+ let result = {};
17
+ if (props.advanced?.displayInitInteraction !== undefined) {
18
+ result = {
19
+ 'display-init': props.advanced?.displayInitInteraction === false ? 'hide' : 'show',
20
+ 'gp-interaction-wrapper': ''
21
+ };
22
+ }
23
+ return result;
24
+ };
15
25
  if (constant.disableWrap.includes(props.tag) && /*#__PURE__*/ react.isValidElement(children)) {
16
26
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
17
27
  children: [
@@ -23,7 +33,11 @@ const ComponentWrapper = ({ children, pageType, ...props })=>{
23
33
  className: advanced?.cssClass,
24
34
  ...children.props,
25
35
  style,
26
- advanced
36
+ advanced,
37
+ builderAttrs: {
38
+ ...children.props.builderAttrs,
39
+ ...interactionAttributes()
40
+ }
27
41
  })
28
42
  ]
29
43
  });
@@ -36,6 +50,7 @@ const ComponentWrapper = ({ children, pageType, ...props })=>{
36
50
  }),
37
51
  /*#__PURE__*/ jsxRuntime.jsx("div", {
38
52
  style: style,
53
+ ...interactionAttributes(),
39
54
  className: `${props.uid} ${advanced?.cssClass}`,
40
55
  children: children
41
56
  })
@@ -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,54 @@
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
+ var index = require('../helpers/interaction/index.js');
18
+ require('../helpers/convert.js');
19
+
20
+ const InteractionSuffix = ({ uid })=>{
21
+ const { closeSelectOnPage } = index.useInteraction();
22
+ const currentInteraction = PageContext.usePageStore((s)=>s.interactionData?.item);
23
+ const isSelectOnPage = PageContext.usePageStore((s)=>s.interactionData?.isSelectOnPage);
24
+ const isCurrentInteractionTarget = react.useMemo(()=>{
25
+ return currentInteraction?.targets?.find((t)=>t.uid === uid && t.type !== 'PAGE');
26
+ }, [
27
+ currentInteraction,
28
+ uid
29
+ ]);
30
+ const isCurrentInteractionTrigger = react.useMemo(()=>{
31
+ return currentInteraction?.self?.uid === uid && currentInteraction?.self?.type !== 'PAGE';
32
+ }, [
33
+ currentInteraction,
34
+ uid
35
+ ]);
36
+ const isDisplay = react.useMemo(()=>{
37
+ return isCurrentInteractionTarget || isCurrentInteractionTrigger;
38
+ }, [
39
+ isCurrentInteractionTarget,
40
+ isCurrentInteractionTrigger
41
+ ]);
42
+ if (!isDisplay) {
43
+ return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {});
44
+ }
45
+ return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
46
+ children: isSelectOnPage && /*#__PURE__*/ jsxRuntime.jsx("button", {
47
+ className: "gp-bg-[#F4F4F4] gp-px-2 gp-py-0.5 gp-rounded-lg gp-text-[#212121] gp-text-sm gp-font-medium gp-hidden interaction-use-custom-element",
48
+ onClick: closeSelectOnPage,
49
+ children: "Use element"
50
+ })
51
+ });
52
+ };
53
+
54
+ exports.InteractionSuffix = InteractionSuffix;