@gem-sdk/core 1.56.2 → 1.57.0-dev.47
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.
- package/dist/cjs/components/ComponentToolbarPreview.js +181 -107
- package/dist/cjs/components/ComponentWrapper.js +16 -1
- package/dist/cjs/components/ComponentWrapperPreview.js +16 -2
- package/dist/cjs/components/InteractionSuffix.js +42 -0
- package/dist/cjs/components/Render.liquid.js +22 -7
- package/dist/cjs/contexts/PageContext.js +42 -1
- package/dist/cjs/contexts/ProductContext.js +10 -0
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +4 -0
- package/dist/cjs/helpers/animations.js +17 -8
- package/dist/cjs/helpers/background.js +10 -5
- package/dist/cjs/helpers/compose-advance-style.js +30 -4
- package/dist/cjs/helpers/interaction/index.js +110 -0
- package/dist/cjs/helpers/radius.js +11 -1
- package/dist/cjs/helpers/shadow.js +5 -4
- package/dist/cjs/helpers/third-party/appConfig.js +56 -0
- package/dist/cjs/helpers/third-party/appSetting.js +122 -1
- package/dist/cjs/helpers/third-party/constant.js +9 -1
- package/dist/cjs/helpers/third-party/getAppBlockConfig.js +8 -1
- package/dist/cjs/hooks/animation/useAnimationConfig.js +2 -1
- package/dist/cjs/hooks/animation/useAnimationTarget.js +5 -2
- package/dist/cjs/hooks/animation/useApplyAnimation.js +6 -4
- package/dist/cjs/hooks/useInteraction.js +19 -0
- package/dist/cjs/hooks/useToolbarPostPurchase.js +2 -2
- package/dist/cjs/index.js +14 -1
- package/dist/cjs/types/animations.js +2 -0
- package/dist/cjs/types/custom.js +52 -0
- package/dist/esm/components/ComponentToolbarPreview.js +181 -107
- package/dist/esm/components/ComponentWrapper.js +16 -1
- package/dist/esm/components/ComponentWrapperPreview.js +16 -2
- package/dist/esm/components/InteractionSuffix.js +40 -0
- package/dist/esm/components/Render.liquid.js +22 -7
- package/dist/esm/contexts/PageContext.js +42 -1
- package/dist/esm/contexts/ProductContext.js +10 -0
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +4 -0
- package/dist/esm/helpers/animations.js +17 -8
- package/dist/esm/helpers/background.js +10 -5
- package/dist/esm/helpers/compose-advance-style.js +31 -5
- package/dist/esm/helpers/interaction/index.js +108 -0
- package/dist/esm/helpers/radius.js +11 -1
- package/dist/esm/helpers/shadow.js +5 -4
- package/dist/esm/helpers/third-party/appConfig.js +49 -1
- package/dist/esm/helpers/third-party/appSetting.js +122 -1
- package/dist/esm/helpers/third-party/constant.js +10 -2
- package/dist/esm/helpers/third-party/getAppBlockConfig.js +8 -1
- package/dist/esm/hooks/animation/useAnimationConfig.js +2 -1
- package/dist/esm/hooks/animation/useAnimationTarget.js +5 -2
- package/dist/esm/hooks/animation/useApplyAnimation.js +6 -4
- package/dist/esm/hooks/useInteraction.js +17 -0
- package/dist/esm/hooks/useToolbarPostPurchase.js +2 -2
- package/dist/esm/index.js +4 -1
- package/dist/esm/types/animations.js +2 -0
- package/dist/esm/types/custom.js +52 -0
- package/dist/types/index.d.ts +547 -184
- package/package.json +3 -3
|
@@ -3,6 +3,7 @@ import { memo, useState, useMemo, useCallback, useEffect } from 'react';
|
|
|
3
3
|
import 'zustand';
|
|
4
4
|
import { useBuilderPreviewStore } from '../contexts/BuilderPreviewContext.js';
|
|
5
5
|
import { useShopStore } from '../contexts/ShopContext.js';
|
|
6
|
+
import { usePageStore } from '../contexts/PageContext.js';
|
|
6
7
|
import '@gem-sdk/adapter-shopify';
|
|
7
8
|
import 'swr';
|
|
8
9
|
import 'swr/mutation';
|
|
@@ -17,6 +18,7 @@ import { usePostPurchase } from '../hooks/useToolbarPostPurchase.js';
|
|
|
17
18
|
import { ableGenerateContentElements } from './constant.js';
|
|
18
19
|
import { AIContentGenerator } from './ai-generator/AIContentGenerator.js';
|
|
19
20
|
import { AIGenContentLoading } from './ai-generator/AIGenContentLoading.js';
|
|
21
|
+
import { InteractionSuffix } from './InteractionSuffix.js';
|
|
20
22
|
import '../helpers/convert.js';
|
|
21
23
|
|
|
22
24
|
const SECTION_LIMIT = 25;
|
|
@@ -42,6 +44,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
42
44
|
const [parents, setParents] = useState([]);
|
|
43
45
|
const [deleteTooltipPosition, setDeleteTooltipPosition] = useState('top');
|
|
44
46
|
const [isDisableDelete, setIsUnableDelete] = useState(false);
|
|
47
|
+
const [isActiveToolbarComponent, setIsActiveToolbarComponent] = useState(false);
|
|
45
48
|
const [productId, setProductId] = useState('');
|
|
46
49
|
const [articleUid, setArticleUid] = useState('');
|
|
47
50
|
const [tooltipText, setTooltipText] = useState({
|
|
@@ -49,6 +52,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
49
52
|
text: ''
|
|
50
53
|
});
|
|
51
54
|
const [isDisableDuplicate, setIsDisableDuplicate] = useState(false);
|
|
55
|
+
const interactionData = usePageStore((s)=>s.interactionData);
|
|
52
56
|
const isSaleFunnelPage = useMemo(()=>editingPageType === 'POST_PURCHASE', [
|
|
53
57
|
editingPageType
|
|
54
58
|
]);
|
|
@@ -93,7 +97,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
93
97
|
};
|
|
94
98
|
const getDeleteTooltipPosition = useCallback(()=>{
|
|
95
99
|
if (props.tag == 'Section') return 'bottom';
|
|
96
|
-
const $toolbar = document.querySelector('[data-toolbar-active="true"]');
|
|
100
|
+
const $toolbar = document.body.querySelector('#storefront')?.querySelector('[data-toolbar-active="true"]');
|
|
97
101
|
if ($toolbar) {
|
|
98
102
|
const rect = $toolbar.getBoundingClientRect();
|
|
99
103
|
if (rect.top < 60) setDeleteTooltipPosition('bottom');
|
|
@@ -128,6 +132,33 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
128
132
|
articleUid,
|
|
129
133
|
linkShopDefault
|
|
130
134
|
]);
|
|
135
|
+
const isSelectOnPage = useMemo(()=>interactionData?.isSelectOnPage, [
|
|
136
|
+
interactionData?.isSelectOnPage
|
|
137
|
+
]);
|
|
138
|
+
const settingType = useMemo(()=>interactionData?.settingType, [
|
|
139
|
+
interactionData?.settingType
|
|
140
|
+
]);
|
|
141
|
+
const isShowIconInteractionTarget = useMemo(()=>{
|
|
142
|
+
return interactionData?.item?.targets?.find((t)=>t.uid === props.uid && t?.type !== 'PAGE') && settingType === 'TARGET';
|
|
143
|
+
}, [
|
|
144
|
+
interactionData?.item?.targets,
|
|
145
|
+
props.uid,
|
|
146
|
+
settingType
|
|
147
|
+
]);
|
|
148
|
+
const isShowIconInteractionTrigger = useMemo(()=>{
|
|
149
|
+
return interactionData?.item?.self?.uid === props.uid && interactionData?.item?.self.type !== 'PAGE' && settingType === 'TRIGGER';
|
|
150
|
+
}, [
|
|
151
|
+
interactionData?.item?.self?.type,
|
|
152
|
+
interactionData?.item?.self?.uid,
|
|
153
|
+
props.uid,
|
|
154
|
+
settingType
|
|
155
|
+
]);
|
|
156
|
+
const isDisplayIconDrag = useMemo(()=>{
|
|
157
|
+
return !isShowIconInteractionTarget && !isShowIconInteractionTrigger;
|
|
158
|
+
}, [
|
|
159
|
+
isShowIconInteractionTarget,
|
|
160
|
+
isShowIconInteractionTrigger
|
|
161
|
+
]);
|
|
131
162
|
// Get parents
|
|
132
163
|
const onActiveComponent = useCallback((e)=>{
|
|
133
164
|
const detail = e.detail;
|
|
@@ -138,6 +169,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
138
169
|
setProductId(detail.productId);
|
|
139
170
|
}
|
|
140
171
|
if (detail?.componentUid == props.uid) {
|
|
172
|
+
setIsActiveToolbarComponent(true);
|
|
141
173
|
getDeleteTooltipPosition();
|
|
142
174
|
if (isSaleFunnelPage) {
|
|
143
175
|
setIsUnableDelete(checkDisableDelete());
|
|
@@ -153,6 +185,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
153
185
|
}).slice(0, 3);
|
|
154
186
|
setParents(currentParents);
|
|
155
187
|
} else {
|
|
188
|
+
setIsActiveToolbarComponent(false);
|
|
156
189
|
setParents([]);
|
|
157
190
|
setIsShowParent(false);
|
|
158
191
|
}
|
|
@@ -340,7 +373,39 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
340
373
|
onClick: (e)=>onShowParent(e),
|
|
341
374
|
"aria-hidden": "true",
|
|
342
375
|
children: [
|
|
343
|
-
/*#__PURE__*/ jsx("div", {
|
|
376
|
+
isShowIconInteractionTrigger && /*#__PURE__*/ jsx("div", {
|
|
377
|
+
className: "gp-hidden gp-w-[12px] interaction-use-custom-element",
|
|
378
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
379
|
+
width: "12",
|
|
380
|
+
height: "13",
|
|
381
|
+
viewBox: "0 0 12 13",
|
|
382
|
+
fill: "none",
|
|
383
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
384
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
385
|
+
fillRule: "evenodd",
|
|
386
|
+
clipRule: "evenodd",
|
|
387
|
+
d: "M4.36799 0.430523C4.51596 0.205675 4.76709 0.0703125 5.03626 0.0703125H9.88576C10.2042 0.0703125 10.395 0.424378 10.2198 0.69034L8.36968 3.4992C8.28209 3.63218 8.37747 3.80922 8.53671 3.80922H10.749C11.1111 3.80922 11.2869 4.25204 11.0233 4.50036L3.03971 12.0217C2.7572 12.2878 2.29932 12.0361 2.37262 11.655L3.27994 6.93698C3.30366 6.81364 3.20915 6.69921 3.08354 6.69921H0.984651C0.66625 6.69921 0.475479 6.34529 0.650515 6.07932L4.36799 0.430523Z",
|
|
388
|
+
fill: "#F9F9F9"
|
|
389
|
+
})
|
|
390
|
+
})
|
|
391
|
+
}),
|
|
392
|
+
isShowIconInteractionTarget && /*#__PURE__*/ jsx("div", {
|
|
393
|
+
className: "gp-hidden gp-w-[14px] interaction-use-custom-element",
|
|
394
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
395
|
+
width: "16",
|
|
396
|
+
height: "16",
|
|
397
|
+
viewBox: "0 0 16 16",
|
|
398
|
+
fill: "none",
|
|
399
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
400
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
401
|
+
fillRule: "evenodd",
|
|
402
|
+
clipRule: "evenodd",
|
|
403
|
+
d: "M7.32785 3.66159C7.87459 3.58351 8.25451 3.077 8.17643 2.53026C8.09836 1.98353 7.59184 1.6036 7.0451 1.68168C3.92866 2.12673 1.5332 4.80488 1.5332 8.04424C1.5332 11.594 4.41085 14.4716 7.9606 14.4716C11.1706 14.4716 13.8294 12.1194 14.3105 9.04446C14.3959 8.49881 14.0227 7.98727 13.4771 7.9019C12.9314 7.81654 12.4199 8.18967 12.3345 8.73531C12.0034 10.852 10.1702 12.4716 7.9606 12.4716C5.51541 12.4716 3.5332 10.4894 3.5332 8.04424C3.5332 5.81431 5.18273 3.96793 7.32785 3.66159ZM10.3432 1.97548C10.6232 1.69551 11.102 1.83654 11.1855 2.22355L11.6106 4.19339C11.6313 4.28936 11.7063 4.36432 11.8023 4.38503L13.7721 4.81013C14.1591 4.89365 14.3001 5.37247 14.0202 5.65243L12.3432 7.32945C12.1244 7.54819 11.8168 7.65338 11.5099 7.61436L10.1528 7.44178C9.84592 7.40276 9.53827 7.50795 9.31953 7.72669L8.66719 8.37903C8.35477 8.69145 7.86633 8.70954 7.57623 8.41943C7.28613 8.12933 7.30421 7.64089 7.61663 7.32847L8.26898 6.67613C8.48771 6.45739 8.5929 6.14974 8.55388 5.84287L8.38131 4.48575C8.34228 4.17888 8.44748 3.87123 8.66621 3.6525L10.3432 1.97548ZM8.19853 5.1916C8.35319 5.72179 8.04877 6.27697 7.51858 6.43163C6.83078 6.63226 6.32988 7.2683 6.32988 8.01873C6.32988 8.9316 7.06991 9.67164 7.98279 9.67164C8.73014 9.67164 9.36406 9.17486 9.56743 8.49131C9.72492 7.96195 10.2817 7.6605 10.8111 7.81799C11.3404 7.97548 11.6419 8.53227 11.4844 9.06163C11.0356 10.57 9.63916 11.6716 7.98279 11.6716C5.96535 11.6716 4.32988 10.0362 4.32988 8.01873C4.32988 6.35558 5.44054 4.95445 6.95851 4.51165C7.4887 4.35699 8.04387 4.66141 8.19853 5.1916Z",
|
|
404
|
+
fill: "#F9F9F9"
|
|
405
|
+
})
|
|
406
|
+
})
|
|
407
|
+
}),
|
|
408
|
+
isActiveToolbarComponent && isDisplayIconDrag && /*#__PURE__*/ jsx("div", {
|
|
344
409
|
"data-toolbar-icon-drag": true,
|
|
345
410
|
children: /*#__PURE__*/ jsxs("svg", {
|
|
346
411
|
width: "16",
|
|
@@ -379,7 +444,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
379
444
|
"data-toolbar-name": true,
|
|
380
445
|
children: [
|
|
381
446
|
getSectionName(),
|
|
382
|
-
props.isShopifySection && !props.isShopifyVisibility && /*#__PURE__*/ jsxs("svg", {
|
|
447
|
+
isActiveToolbarComponent && props.isShopifySection && !props.isShopifyVisibility && /*#__PURE__*/ jsxs("svg", {
|
|
383
448
|
"data-toolbar-visibility": true,
|
|
384
449
|
width: "20",
|
|
385
450
|
height: "20",
|
|
@@ -412,7 +477,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
412
477
|
"data-toolbar-name": true,
|
|
413
478
|
children: toolbarName()
|
|
414
479
|
}),
|
|
415
|
-
props.tag !== 'Section' && parents.length > 0 && /*#__PURE__*/ jsx("div", {
|
|
480
|
+
isActiveToolbarComponent && props.tag !== 'Section' && parents.length > 0 && /*#__PURE__*/ jsx("div", {
|
|
416
481
|
"data-toolbar-icon-parent": true,
|
|
417
482
|
"data-toolbar-icon-parent-open": isShowParent,
|
|
418
483
|
children: /*#__PURE__*/ jsx("svg", {
|
|
@@ -428,7 +493,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
428
493
|
})
|
|
429
494
|
]
|
|
430
495
|
}),
|
|
431
|
-
isShowParent && parents.map((parent, index)=>{
|
|
496
|
+
isActiveToolbarComponent && isShowParent && parents.map((parent, index)=>{
|
|
432
497
|
// Update count columns of Row
|
|
433
498
|
const parentLength = parent?.childrens?.length ?? 0;
|
|
434
499
|
let parent_label = parent.label;
|
|
@@ -437,6 +502,7 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
437
502
|
}
|
|
438
503
|
return /*#__PURE__*/ jsxs("div", {
|
|
439
504
|
"data-toolbar-parent": true,
|
|
505
|
+
"data-component-tag": parent.tag,
|
|
440
506
|
"data-parent-uid": parent.uid,
|
|
441
507
|
"data-toolbar-theme-section": isThemeSectionEditor,
|
|
442
508
|
"data-toolbar-parent-revert": isShowParentRevert,
|
|
@@ -487,109 +553,117 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
487
553
|
]
|
|
488
554
|
}, parent.uid);
|
|
489
555
|
}),
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
556
|
+
isActiveToolbarComponent && !isSelectOnPage && /*#__PURE__*/ jsxs(Fragment, {
|
|
557
|
+
children: [
|
|
558
|
+
' ',
|
|
559
|
+
props.tag === 'Section' && !props.isThemeSection && isEnableCreateThemeSection() && !props.isShopifySection && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsx(CreateThemeSection, {
|
|
560
|
+
...props
|
|
561
|
+
}),
|
|
562
|
+
isEnableAIContent() && /*#__PURE__*/ jsx(AIContentGenerator, {
|
|
563
|
+
...props
|
|
564
|
+
}),
|
|
565
|
+
props.tag == 'Sticky' && /*#__PURE__*/ jsx("div", {
|
|
566
|
+
"data-toolbar-zoom-out": true,
|
|
567
|
+
onClick: (e)=>onZoomOut(e),
|
|
568
|
+
"aria-hidden": "true",
|
|
569
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
570
|
+
width: "16",
|
|
571
|
+
height: "16",
|
|
572
|
+
viewBox: "0 0 16 16",
|
|
573
|
+
fill: "none",
|
|
574
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
575
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
576
|
+
fillRule: "evenodd",
|
|
577
|
+
clipRule: "evenodd",
|
|
578
|
+
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",
|
|
579
|
+
fill: "currentColor"
|
|
580
|
+
})
|
|
581
|
+
})
|
|
582
|
+
}),
|
|
583
|
+
editAbleElementList.includes(props.tag) && /*#__PURE__*/ jsx(Tooltip, {
|
|
584
|
+
"data-toolbar-title": true,
|
|
585
|
+
enable: true,
|
|
586
|
+
"data-toolbar-disable": false,
|
|
587
|
+
text: "Edit content in Shopify",
|
|
588
|
+
position: "top",
|
|
589
|
+
onClick: goToShopifyEditLink,
|
|
590
|
+
"aria-hidden": "true",
|
|
591
|
+
children: /*#__PURE__*/ jsxs("svg", {
|
|
592
|
+
width: "16",
|
|
593
|
+
height: "16",
|
|
594
|
+
viewBox: "0 0 16 16",
|
|
595
|
+
fill: "none",
|
|
596
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
597
|
+
children: [
|
|
598
|
+
/*#__PURE__*/ jsx("path", {
|
|
599
|
+
fillRule: "evenodd",
|
|
600
|
+
clipRule: "evenodd",
|
|
601
|
+
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",
|
|
602
|
+
fill: "currentColor"
|
|
603
|
+
}),
|
|
604
|
+
/*#__PURE__*/ jsx("path", {
|
|
605
|
+
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",
|
|
606
|
+
fill: "currentColor"
|
|
607
|
+
}),
|
|
608
|
+
/*#__PURE__*/ jsx("path", {
|
|
609
|
+
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",
|
|
610
|
+
fill: "currentColor"
|
|
611
|
+
}),
|
|
612
|
+
/*#__PURE__*/ jsx("path", {
|
|
613
|
+
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",
|
|
614
|
+
fill: "currentColor"
|
|
615
|
+
})
|
|
616
|
+
]
|
|
617
|
+
})
|
|
618
|
+
}),
|
|
619
|
+
/*#__PURE__*/ jsx(Tooltip, {
|
|
620
|
+
enable: props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
|
|
621
|
+
text: "Page has reached Shopify’s 25 section-limit",
|
|
622
|
+
position: "bottom",
|
|
623
|
+
"data-toolbar-duplicate": true,
|
|
624
|
+
"data-toolbar-disable": props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT || isDisableDuplicate,
|
|
625
|
+
onClick: isDisableDuplicate ? undefined : (e)=>onDuplicate(e),
|
|
626
|
+
"aria-hidden": "true",
|
|
627
|
+
className: isDisableDuplicate ? '!gp-cursor-not-allowed' : '',
|
|
628
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
629
|
+
width: "16",
|
|
630
|
+
height: "16",
|
|
631
|
+
viewBox: "0 0 16 16",
|
|
632
|
+
fill: "none",
|
|
633
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
634
|
+
fillRule: "evenodd",
|
|
635
|
+
clipRule: "evenodd",
|
|
636
|
+
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",
|
|
637
|
+
fill: "currentColor"
|
|
638
|
+
})
|
|
639
|
+
})
|
|
640
|
+
}),
|
|
641
|
+
/*#__PURE__*/ jsx(Tooltip, {
|
|
642
|
+
"data-toolbar-delete": true,
|
|
643
|
+
onClick: (e)=>isDisableDelete ? null : onDelete(e),
|
|
644
|
+
enable: isDisableDelete,
|
|
645
|
+
"data-toolbar-disable": isDisableDelete,
|
|
646
|
+
width: tooltipText.width,
|
|
647
|
+
text: tooltipText.text,
|
|
648
|
+
position: deleteTooltipPosition,
|
|
649
|
+
"aria-hidden": "true",
|
|
650
|
+
children: /*#__PURE__*/ jsx("svg", {
|
|
651
|
+
width: "16",
|
|
652
|
+
height: "16",
|
|
653
|
+
viewBox: "0 0 16 16",
|
|
654
|
+
fill: "none",
|
|
655
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
656
|
+
fillRule: "evenodd",
|
|
657
|
+
clipRule: "evenodd",
|
|
658
|
+
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",
|
|
659
|
+
fill: "currentColor"
|
|
660
|
+
})
|
|
546
661
|
})
|
|
547
|
-
]
|
|
548
|
-
})
|
|
549
|
-
}),
|
|
550
|
-
/*#__PURE__*/ jsx(Tooltip, {
|
|
551
|
-
enable: props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
|
|
552
|
-
text: "Page has reached Shopify’s 25 section-limit",
|
|
553
|
-
position: "bottom",
|
|
554
|
-
"data-toolbar-duplicate": true,
|
|
555
|
-
"data-toolbar-disable": props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT || isDisableDuplicate,
|
|
556
|
-
onClick: isDisableDuplicate ? undefined : (e)=>onDuplicate(e),
|
|
557
|
-
"aria-hidden": "true",
|
|
558
|
-
className: isDisableDuplicate ? '!gp-cursor-not-allowed' : '',
|
|
559
|
-
children: /*#__PURE__*/ jsx("svg", {
|
|
560
|
-
width: "16",
|
|
561
|
-
height: "16",
|
|
562
|
-
viewBox: "0 0 16 16",
|
|
563
|
-
fill: "none",
|
|
564
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
565
|
-
fillRule: "evenodd",
|
|
566
|
-
clipRule: "evenodd",
|
|
567
|
-
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",
|
|
568
|
-
fill: "currentColor"
|
|
569
662
|
})
|
|
570
|
-
|
|
663
|
+
]
|
|
571
664
|
}),
|
|
572
|
-
/*#__PURE__*/ jsx(
|
|
573
|
-
|
|
574
|
-
onClick: (e)=>isDisableDelete ? null : onDelete(e),
|
|
575
|
-
enable: isDisableDelete,
|
|
576
|
-
"data-toolbar-disable": isDisableDelete,
|
|
577
|
-
width: tooltipText.width,
|
|
578
|
-
text: tooltipText.text,
|
|
579
|
-
position: deleteTooltipPosition,
|
|
580
|
-
"aria-hidden": "true",
|
|
581
|
-
children: /*#__PURE__*/ jsx("svg", {
|
|
582
|
-
width: "16",
|
|
583
|
-
height: "16",
|
|
584
|
-
viewBox: "0 0 16 16",
|
|
585
|
-
fill: "none",
|
|
586
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
587
|
-
fillRule: "evenodd",
|
|
588
|
-
clipRule: "evenodd",
|
|
589
|
-
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",
|
|
590
|
-
fill: "currentColor"
|
|
591
|
-
})
|
|
592
|
-
})
|
|
665
|
+
/*#__PURE__*/ jsx(InteractionSuffix, {
|
|
666
|
+
uid: props.uid
|
|
593
667
|
})
|
|
594
668
|
]
|
|
595
669
|
}, props.uid),
|
|
@@ -647,10 +721,10 @@ const ComponentToolbarPreview = (props)=>{
|
|
|
647
721
|
})
|
|
648
722
|
]
|
|
649
723
|
}),
|
|
650
|
-
ableGenerateContentElements.includes(props.tag) && /*#__PURE__*/ jsx(AIGenContentLoading, {
|
|
724
|
+
ableGenerateContentElements.includes(props.tag) && isActiveToolbarComponent && /*#__PURE__*/ jsx(AIGenContentLoading, {
|
|
651
725
|
...props
|
|
652
726
|
}),
|
|
653
|
-
/*#__PURE__*/ jsx(Resize, {
|
|
727
|
+
isActiveToolbarComponent && /*#__PURE__*/ jsx(Resize, {
|
|
654
728
|
...props
|
|
655
729
|
})
|
|
656
730
|
]
|
|
@@ -8,6 +8,16 @@ const ComponentWrapper = ({ children, pageType, ...props })=>{
|
|
|
8
8
|
if (props.type === 'section') return null;
|
|
9
9
|
const style = composeAdvanceStyle(props.advanced, props.tag, pageType);
|
|
10
10
|
const advanced = props.advanced;
|
|
11
|
+
const interactionAttributes = ()=>{
|
|
12
|
+
let result = {};
|
|
13
|
+
if (props.advanced?.displayInitInteraction !== undefined) {
|
|
14
|
+
result = {
|
|
15
|
+
'display-init': props.advanced?.displayInitInteraction === false ? 'hide' : 'show',
|
|
16
|
+
'gp-interaction-wrapper': ''
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
11
21
|
if (disableWrap.includes(props.tag) && /*#__PURE__*/ isValidElement(children)) {
|
|
12
22
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
13
23
|
children: [
|
|
@@ -19,7 +29,11 @@ const ComponentWrapper = ({ children, pageType, ...props })=>{
|
|
|
19
29
|
className: advanced?.cssClass,
|
|
20
30
|
...children.props,
|
|
21
31
|
style,
|
|
22
|
-
advanced
|
|
32
|
+
advanced,
|
|
33
|
+
builderAttrs: {
|
|
34
|
+
...children.props.builderAttrs,
|
|
35
|
+
...interactionAttributes()
|
|
36
|
+
}
|
|
23
37
|
})
|
|
24
38
|
]
|
|
25
39
|
});
|
|
@@ -32,6 +46,7 @@ const ComponentWrapper = ({ children, pageType, ...props })=>{
|
|
|
32
46
|
}),
|
|
33
47
|
/*#__PURE__*/ jsx("div", {
|
|
34
48
|
style: style,
|
|
49
|
+
...interactionAttributes(),
|
|
35
50
|
className: `${props.uid} ${advanced?.cssClass}`,
|
|
36
51
|
children: children
|
|
37
52
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { memo, useEffect, isValidElement } from 'react';
|
|
3
3
|
import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
|
|
4
|
+
import { useInteraction } from '../hooks/useInteraction.js';
|
|
4
5
|
import { disableWrap, excludeApplyStyle } from './constant.js';
|
|
5
6
|
import RenderCustomCode from './RenderCustomCode.js';
|
|
6
7
|
import ComponentToolbarPreview from './ComponentToolbarPreview.js';
|
|
@@ -28,6 +29,19 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
28
29
|
}, [
|
|
29
30
|
props.uid
|
|
30
31
|
]);
|
|
32
|
+
const currentProps = props;
|
|
33
|
+
const { getAnimationByUid } = useInteraction();
|
|
34
|
+
const animationByInteraction = getAnimationByUid(props.uid);
|
|
35
|
+
if (animationByInteraction) {
|
|
36
|
+
currentProps.advanced = {
|
|
37
|
+
...currentProps.advanced,
|
|
38
|
+
animation: {
|
|
39
|
+
desktop: animationByInteraction,
|
|
40
|
+
tablet: animationByInteraction,
|
|
41
|
+
mobile: animationByInteraction
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
31
45
|
const pageType = usePageType();
|
|
32
46
|
if (props.type === 'section') {
|
|
33
47
|
return null;
|
|
@@ -132,7 +146,7 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
132
146
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
133
147
|
children: [
|
|
134
148
|
/*#__PURE__*/ jsx(ComponentAnimation, {
|
|
135
|
-
...
|
|
149
|
+
...currentProps
|
|
136
150
|
}),
|
|
137
151
|
/*#__PURE__*/ jsx(RenderCustomCode, {
|
|
138
152
|
uid: props.uid,
|
|
@@ -161,7 +175,7 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
161
175
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
162
176
|
children: [
|
|
163
177
|
/*#__PURE__*/ jsx(ComponentAnimation, {
|
|
164
|
-
...
|
|
178
|
+
...currentProps
|
|
165
179
|
}),
|
|
166
180
|
/*#__PURE__*/ jsx(RenderCustomCode, {
|
|
167
181
|
uid: props.uid,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import 'zustand';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'swr';
|
|
5
|
+
import { usePageStore } from '../contexts/PageContext.js';
|
|
6
|
+
import '@gem-sdk/adapter-shopify';
|
|
7
|
+
import 'swr/mutation';
|
|
8
|
+
import 'swr/infinite';
|
|
9
|
+
import 'vanilla-lazyload';
|
|
10
|
+
import '../hooks/useCartUI.js';
|
|
11
|
+
import 'react-transition-group';
|
|
12
|
+
import '@gem-sdk/core';
|
|
13
|
+
import 'classnames';
|
|
14
|
+
import 'dayjs';
|
|
15
|
+
import { useInteraction } from '../helpers/interaction/index.js';
|
|
16
|
+
import '../helpers/convert.js';
|
|
17
|
+
|
|
18
|
+
const InteractionSuffix = ({ uid })=>{
|
|
19
|
+
const { closeSelectOnPage, selectInteractionElement } = useInteraction();
|
|
20
|
+
const settingType = usePageStore((s)=>s.interactionData?.settingType || '');
|
|
21
|
+
const isSelectOnPage = usePageStore((s)=>s.interactionData?.isSelectOnPage);
|
|
22
|
+
const onClick = (e)=>{
|
|
23
|
+
selectInteractionElement({
|
|
24
|
+
$target: e.target,
|
|
25
|
+
componentUid: uid,
|
|
26
|
+
settingType
|
|
27
|
+
});
|
|
28
|
+
closeSelectOnPage();
|
|
29
|
+
};
|
|
30
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
31
|
+
children: isSelectOnPage && /*#__PURE__*/ jsx("button", {
|
|
32
|
+
className: "gp-bg-[#F4F4F4] gp-px-2 gp-h-[24px] gp-py-0.5 gp-rounded-lg gp-text-[#212121] gp-text-xs gp-font-medium gp-hidden interaction-use-custom-element ",
|
|
33
|
+
onClick: onClick,
|
|
34
|
+
"data-setup-interaction": true,
|
|
35
|
+
children: settingType === 'TRIGGER' ? 'Set as trigger' : 'Set as target'
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { InteractionSuffix };
|
|
@@ -35,7 +35,6 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
35
35
|
const item = builder[uid];
|
|
36
36
|
const Component = components[item?.tag];
|
|
37
37
|
if (!Component) {
|
|
38
|
-
console.log('Miss component: ', item);
|
|
39
38
|
return {
|
|
40
39
|
liquid: '',
|
|
41
40
|
extraFiles
|
|
@@ -72,6 +71,9 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
72
71
|
parentId: componentsRenderWithParentId.includes(item.tag) ? parentId : null,
|
|
73
72
|
pageContext,
|
|
74
73
|
...passProps,
|
|
74
|
+
builderAttrs: {
|
|
75
|
+
...passProps.builderAttrs
|
|
76
|
+
},
|
|
75
77
|
rawChildren: item.childrens.map((id)=>{
|
|
76
78
|
return {
|
|
77
79
|
...builder[id],
|
|
@@ -107,11 +109,14 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
107
109
|
isText: componentTexts.includes(item.tag) ? true : null,
|
|
108
110
|
parentId: componentsRenderWithParentId.includes(item.tag) ? parentId : null,
|
|
109
111
|
pageContext,
|
|
110
|
-
...passProps
|
|
112
|
+
...passProps,
|
|
113
|
+
builderAttrs: {
|
|
114
|
+
...passProps.builderAttrs
|
|
115
|
+
}
|
|
111
116
|
});
|
|
112
117
|
});
|
|
113
118
|
} else {
|
|
114
|
-
liquid = template`<div style="${!componentIconList.includes(item.tag) ? style : ''}" class="${item.uid} ${!item?.childrens?.length && item.tag === 'IconListItemHoz' ? 'hidden' : ''}">
|
|
119
|
+
liquid = template`<div gp-el-wrapper style="${!componentIconList.includes(item.tag) ? style : ''}" class="${item.uid} ${!item?.childrens?.length && item.tag === 'IconListItemHoz' ? 'hidden' : ''}">
|
|
115
120
|
${RenderIf(item?.childrens?.length, ()=>{
|
|
116
121
|
return Component({
|
|
117
122
|
builderProps: {
|
|
@@ -126,6 +131,9 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
126
131
|
},
|
|
127
132
|
pageContext,
|
|
128
133
|
...passProps,
|
|
134
|
+
builderAttrs: {
|
|
135
|
+
...passProps.builderAttrs
|
|
136
|
+
},
|
|
129
137
|
rawChildren: item.childrens.map((id)=>{
|
|
130
138
|
return {
|
|
131
139
|
...builder[id],
|
|
@@ -162,7 +170,10 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
162
170
|
pageContext,
|
|
163
171
|
isText: componentTexts.includes(item.tag) ? true : null,
|
|
164
172
|
style: componentIconList.includes(item.tag) ? style : null,
|
|
165
|
-
...passProps
|
|
173
|
+
...passProps,
|
|
174
|
+
builderAttrs: {
|
|
175
|
+
...passProps.builderAttrs
|
|
176
|
+
}
|
|
166
177
|
});
|
|
167
178
|
})}
|
|
168
179
|
</div>`;
|
|
@@ -200,7 +211,7 @@ const RenderCustomCode = (item)=>{
|
|
|
200
211
|
};
|
|
201
212
|
const appendAnimation = (props, liquid)=>{
|
|
202
213
|
const { advanced, tag } = props;
|
|
203
|
-
const { animation, op: opacity } = advanced ?? {};
|
|
214
|
+
const { animation, op: opacity, hasAnimationInteraction, displayInitInteraction } = advanced ?? {};
|
|
204
215
|
const getAnimationType = (settings, type)=>{
|
|
205
216
|
return settings?.triggerConfig?.[type]?.animation ?? 'none';
|
|
206
217
|
};
|
|
@@ -214,7 +225,8 @@ const appendAnimation = (props, liquid)=>{
|
|
|
214
225
|
const hoverDesktop = getAnimationType(getSettingsByDevice('desktop'), 'hover');
|
|
215
226
|
const appearTablet = getAnimationType(getSettingsByDevice('tablet'), 'appear');
|
|
216
227
|
const appearMobile = getAnimationType(getSettingsByDevice('mobile'), 'appear');
|
|
217
|
-
const enableAnimation = animation?.desktop?.enabled && (appearDesktop !== 'none' || hoverDesktop !== 'none') || animation?.tablet?.enabled && appearTablet !== 'none' || animation?.mobile?.enabled && appearMobile !== 'none';
|
|
228
|
+
const enableAnimation = animation?.desktop?.enabled && (appearDesktop !== 'none' || hoverDesktop !== 'none') || animation?.tablet?.enabled && appearTablet !== 'none' || animation?.mobile?.enabled && appearMobile !== 'none' || !!hasAnimationInteraction;
|
|
229
|
+
const enableAnimationWhenInit = animation?.desktop?.enabled && (appearDesktop !== 'none' || hoverDesktop !== 'none') || animation?.tablet?.enabled && appearTablet !== 'none' || animation?.mobile?.enabled && appearMobile !== 'none';
|
|
218
230
|
if (!enableAnimation) return liquid;
|
|
219
231
|
const getInitVisibility = (device)=>getSettingsByDevice(device)?.enabled && ![
|
|
220
232
|
'shake',
|
|
@@ -227,10 +239,13 @@ const appendAnimation = (props, liquid)=>{
|
|
|
227
239
|
};
|
|
228
240
|
return template`
|
|
229
241
|
<gp-animation
|
|
242
|
+
gp-interaction-wrapper
|
|
243
|
+
display-init="${displayInitInteraction === false ? 'hide' : 'show'}"
|
|
230
244
|
gp-data='${JSON.stringify({
|
|
231
245
|
config: animation,
|
|
232
246
|
tag,
|
|
233
|
-
opacity
|
|
247
|
+
opacity,
|
|
248
|
+
notEnableAnimationWhenInit: !enableAnimationWhenInit
|
|
234
249
|
})}'
|
|
235
250
|
style="${{
|
|
236
251
|
display: 'contents'
|