@gem-sdk/core 1.23.0-staging.43 → 1.23.0-staging.433
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 +110 -42
- package/dist/cjs/components/ComponentWrapper.js +4 -3
- package/dist/cjs/components/ComponentWrapperPreview.js +40 -7
- package/dist/cjs/components/Render.js +7 -0
- package/dist/cjs/components/Render.liquid.js +67 -7
- package/dist/cjs/components/constant.js +27 -2
- package/dist/cjs/components/resize/Spacing.js +123 -5
- package/dist/cjs/components/toolbar/Tooltip.js +8 -2
- package/dist/cjs/contexts/BuilderContext.js +6 -4
- package/dist/cjs/contexts/BuilderPreviewContext.js +35 -8
- package/dist/cjs/contexts/PageContext.js +54 -0
- package/dist/cjs/contexts/ProductContext.js +5 -0
- package/dist/cjs/graphql/fragments/custom-font.generated.js +14 -0
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +31 -0
- package/dist/cjs/graphql/queries/preview-page.generated.js +2 -2
- package/dist/cjs/graphql/queries/published-theme-pages.generated.js +3 -1
- package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +17 -0
- package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +25 -0
- package/dist/cjs/helpers/animations.js +213 -0
- package/dist/cjs/helpers/background.js +81 -19
- package/dist/cjs/helpers/carousel.js +58 -0
- package/dist/cjs/helpers/colors.js +2 -1
- package/dist/cjs/helpers/compose-advance-style.js +110 -8
- package/dist/cjs/helpers/covert-entities-html.js +19 -0
- package/dist/cjs/helpers/filter-toolbar-preview.js +1 -1
- package/dist/cjs/helpers/icon-list.js +61 -0
- package/dist/cjs/helpers/is-empty-children.js +1 -1
- package/dist/cjs/helpers/make-style.js +21 -5
- package/dist/cjs/helpers/product.js +4 -1
- package/dist/cjs/helpers/queries/get-collection.js +8 -2
- package/dist/cjs/helpers/queries/get-products.js +8 -4
- package/dist/cjs/helpers/size.js +111 -17
- package/dist/cjs/helpers/typography.js +29 -9
- package/dist/cjs/helpers/variant.js +5 -2
- package/dist/cjs/hooks/animation/useAnimationActions.js +39 -0
- package/dist/cjs/hooks/animation/useAnimationConfig.js +29 -0
- package/dist/cjs/hooks/animation/useAnimationPreview.js +31 -0
- package/dist/cjs/hooks/animation/useAnimationTarget.js +120 -0
- package/dist/cjs/hooks/animation/useApplyAnimation.js +87 -0
- package/dist/cjs/hooks/shop/use-products-query.js +3 -2
- package/dist/cjs/hooks/useAnimations.js +26 -0
- package/dist/cjs/hooks/useFormatMoney.js +5 -1
- package/dist/cjs/hooks/useProduct.js +38 -6
- package/dist/cjs/hooks/useToolbarPostPurchase.js +89 -0
- package/dist/cjs/index.js +64 -0
- package/dist/cjs/types/animations.js +47 -0
- package/dist/cjs/types/appAPI.js +2 -0
- package/dist/cjs/web-components/src/helpers/styles/constant.js +9 -0
- package/dist/esm/components/ComponentToolbarPreview.js +109 -43
- package/dist/esm/components/ComponentWrapper.js +4 -3
- package/dist/esm/components/ComponentWrapperPreview.js +41 -8
- package/dist/esm/components/Render.js +8 -1
- package/dist/esm/components/Render.liquid.js +67 -7
- package/dist/esm/components/constant.js +25 -3
- package/dist/esm/components/resize/Spacing.js +124 -6
- package/dist/esm/components/toolbar/Tooltip.js +8 -2
- package/dist/esm/contexts/BuilderContext.js +6 -4
- package/dist/esm/contexts/BuilderPreviewContext.js +35 -8
- package/dist/esm/contexts/PageContext.js +51 -0
- package/dist/esm/contexts/ProductContext.js +5 -0
- package/dist/esm/graphql/fragments/custom-font.generated.js +12 -0
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +31 -1
- package/dist/esm/graphql/queries/preview-page.generated.js +3 -3
- package/dist/esm/graphql/queries/published-theme-pages.generated.js +3 -1
- package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +15 -0
- package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +23 -0
- package/dist/esm/helpers/animations.js +211 -0
- package/dist/esm/helpers/background.js +78 -20
- package/dist/esm/helpers/carousel.js +54 -0
- package/dist/esm/helpers/colors.js +2 -1
- package/dist/esm/helpers/compose-advance-style.js +106 -9
- package/dist/esm/helpers/covert-entities-html.js +17 -0
- package/dist/esm/helpers/filter-toolbar-preview.js +1 -1
- package/dist/esm/helpers/icon-list.js +58 -0
- package/dist/esm/helpers/is-empty-children.js +1 -1
- package/dist/esm/helpers/make-style.js +20 -6
- package/dist/esm/helpers/product.js +4 -1
- package/dist/esm/helpers/queries/get-collection.js +8 -2
- package/dist/esm/helpers/queries/get-products.js +8 -4
- package/dist/esm/helpers/size.js +108 -18
- package/dist/esm/helpers/typography.js +29 -10
- package/dist/esm/helpers/variant.js +5 -2
- package/dist/esm/hooks/animation/useAnimationActions.js +37 -0
- package/dist/esm/hooks/animation/useAnimationConfig.js +27 -0
- package/dist/esm/hooks/animation/useAnimationPreview.js +29 -0
- package/dist/esm/hooks/animation/useAnimationTarget.js +118 -0
- package/dist/esm/hooks/animation/useApplyAnimation.js +83 -0
- package/dist/esm/hooks/shop/use-products-query.js +3 -2
- package/dist/esm/hooks/useAnimations.js +24 -0
- package/dist/esm/hooks/useFormatMoney.js +5 -2
- package/dist/esm/hooks/useProduct.js +38 -7
- package/dist/esm/hooks/useToolbarPostPurchase.js +87 -0
- package/dist/esm/index.js +17 -7
- package/dist/esm/types/animations.js +47 -0
- package/dist/esm/types/appAPI.js +1 -0
- package/dist/esm/web-components/src/helpers/styles/constant.js +7 -0
- package/dist/types/index.d.ts +30648 -6187
- package/package.json +6 -3
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
6
|
var react = require('react');
|
|
5
7
|
require('zustand');
|
|
@@ -14,6 +16,7 @@ var CreateThemeSection = require('./theme-section/CreateThemeSection.js');
|
|
|
14
16
|
var Tooltip = require('./toolbar/Tooltip.js');
|
|
15
17
|
var ThemeSectionStatus = require('./theme-section/ThemeSectionStatus.js');
|
|
16
18
|
var Resize = require('./resize/Resize.js');
|
|
19
|
+
var useToolbarPostPurchase = require('../hooks/useToolbarPostPurchase.js');
|
|
17
20
|
require('../helpers/convert.js');
|
|
18
21
|
|
|
19
22
|
const SECTION_LIMIT = 25;
|
|
@@ -25,25 +28,7 @@ const isSection = (el)=>{
|
|
|
25
28
|
const tag = el.getAttribute('data-component-tag');
|
|
26
29
|
return tag === 'Section';
|
|
27
30
|
};
|
|
28
|
-
const
|
|
29
|
-
const rect = el.getBoundingClientRect();
|
|
30
|
-
const rectP = parent.getBoundingClientRect();
|
|
31
|
-
// 32px = toolbar active height
|
|
32
|
-
return rect.top - rectP.top < 32 + 1;
|
|
33
|
-
};
|
|
34
|
-
const findOverflowParent = (element, initEl)=>{
|
|
35
|
-
const thisEl = element;
|
|
36
|
-
const origEl = initEl || thisEl;
|
|
37
|
-
if (!thisEl) return;
|
|
38
|
-
if (isSection(thisEl)) return;
|
|
39
|
-
if (notVisible(thisEl) && isOverToolbarPosition(initEl, thisEl)) return thisEl;
|
|
40
|
-
if (thisEl.parentElement) {
|
|
41
|
-
return findOverflowParent(thisEl.parentElement, origEl);
|
|
42
|
-
} else {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const ComponentToolbarPreview = ({ ...props })=>{
|
|
31
|
+
const ComponentToolbarPreview = (props)=>{
|
|
47
32
|
const isThemeSection = props.isThemeSection;
|
|
48
33
|
const editingPageType = ShopContext.useShopStore((s)=>s.pageType);
|
|
49
34
|
const getParents = BuilderPreviewContext.useBuilderPreviewStore((s)=>s.getParents);
|
|
@@ -53,13 +38,60 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
53
38
|
const [isShowParent, setIsShowParent] = react.useState(false);
|
|
54
39
|
const [isShowParentRevert, setIsShowParentRevert] = react.useState(false);
|
|
55
40
|
const [parents, setParents] = react.useState([]);
|
|
41
|
+
const [deleteTooltipPosition, setDeleteTooltipPosition] = react.useState('top');
|
|
42
|
+
const [isDisableDelete, setIsUnableDelete] = react.useState(false);
|
|
43
|
+
const [tooltipText, setTooltipText] = react.useState({
|
|
44
|
+
width: '',
|
|
45
|
+
text: ''
|
|
46
|
+
});
|
|
47
|
+
const [isDisableDuplicate, setIsDisableDuplicate] = react.useState(false);
|
|
48
|
+
const isSaleFunnelPage = react.useMemo(()=>editingPageType === 'POST_PURCHASE', [
|
|
49
|
+
editingPageType
|
|
50
|
+
]);
|
|
51
|
+
const { checkDisableDelete, getTooltipText, checkDisableDuplicate } = useToolbarPostPurchase.usePostPurchase(props.uid, props.tag || '');
|
|
52
|
+
const isOverToolbarPosition = (el, parent)=>{
|
|
53
|
+
const parentLength = parents.length;
|
|
54
|
+
const rect = el.getBoundingClientRect();
|
|
55
|
+
const rectP = parent.getBoundingClientRect();
|
|
56
|
+
// 36px = toolbar active height + 4 spaces
|
|
57
|
+
return rect.top - rectP.top < parentLength * 36;
|
|
58
|
+
};
|
|
59
|
+
const findOverflowParent = (element, initEl)=>{
|
|
60
|
+
const thisEl = element;
|
|
61
|
+
const origEl = initEl || thisEl;
|
|
62
|
+
if (!thisEl) return;
|
|
63
|
+
if (isSection(thisEl)) return;
|
|
64
|
+
if (notVisible(thisEl) && isOverToolbarPosition(initEl, thisEl)) return thisEl;
|
|
65
|
+
if (thisEl.parentElement) {
|
|
66
|
+
return findOverflowParent(thisEl.parentElement, origEl);
|
|
67
|
+
} else {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const getDeleteTooltipPosition = react.useCallback(()=>{
|
|
72
|
+
if (props.tag == 'Section') return 'bottom';
|
|
73
|
+
const $toolbar = document.querySelector('[data-toolbar-active="true"]');
|
|
74
|
+
if ($toolbar) {
|
|
75
|
+
const rect = $toolbar.getBoundingClientRect();
|
|
76
|
+
if (rect.top < 60) setDeleteTooltipPosition('bottom');
|
|
77
|
+
else setDeleteTooltipPosition('top');
|
|
78
|
+
}
|
|
79
|
+
}, [
|
|
80
|
+
props.tag
|
|
81
|
+
]);
|
|
56
82
|
// Get parents
|
|
57
83
|
const onActiveComponent = react.useCallback((e)=>{
|
|
58
84
|
const detail = e.detail;
|
|
59
85
|
if (detail?.componentUid == props.uid) {
|
|
86
|
+
getDeleteTooltipPosition();
|
|
87
|
+
if (isSaleFunnelPage) {
|
|
88
|
+
setIsUnableDelete(checkDisableDelete());
|
|
89
|
+
setTooltipText(getTooltipText());
|
|
90
|
+
setIsDisableDuplicate(checkDisableDuplicate());
|
|
91
|
+
}
|
|
60
92
|
const currentParents = getParents(props.uid).filter((parent)=>{
|
|
61
93
|
if (parent.uid === 'ROOT') return false;
|
|
62
|
-
if (parent.tag === 'Section') return false;
|
|
94
|
+
if (parent.tag === 'Section' && isThemeSectionEditor) return false;
|
|
63
95
|
if (parent.editorConfigs?.toolbar?.hide) return false;
|
|
64
96
|
if (parent.editorConfigs?.component?.noSetting) return false;
|
|
65
97
|
return true;
|
|
@@ -70,9 +102,14 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
70
102
|
setIsShowParent(false);
|
|
71
103
|
}
|
|
72
104
|
}, [
|
|
73
|
-
|
|
105
|
+
props.uid,
|
|
106
|
+
isSaleFunnelPage,
|
|
74
107
|
getParents,
|
|
75
|
-
|
|
108
|
+
checkDisableDelete,
|
|
109
|
+
getTooltipText,
|
|
110
|
+
checkDisableDuplicate,
|
|
111
|
+
isThemeSectionEditor,
|
|
112
|
+
getDeleteTooltipPosition
|
|
76
113
|
]);
|
|
77
114
|
react.useEffect(()=>{
|
|
78
115
|
window.addEventListener('editor:active-component', onActiveComponent);
|
|
@@ -115,7 +152,7 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
115
152
|
setIsShowParentRevert(true);
|
|
116
153
|
} else {
|
|
117
154
|
const rect = $toolbar.getBoundingClientRect();
|
|
118
|
-
if (rect.top < parents.length *
|
|
155
|
+
if (rect.top < parents.length * 36) {
|
|
119
156
|
setIsShowParentRevert(true);
|
|
120
157
|
} else {
|
|
121
158
|
setIsShowParentRevert(false);
|
|
@@ -160,6 +197,9 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
160
197
|
window.dispatchEvent(event);
|
|
161
198
|
return false;
|
|
162
199
|
};
|
|
200
|
+
const toolbarName = ()=>{
|
|
201
|
+
return props.customLabel || props.label;
|
|
202
|
+
};
|
|
163
203
|
const onZoomOut = (e)=>{
|
|
164
204
|
e.preventDefault();
|
|
165
205
|
e.stopPropagation();
|
|
@@ -199,6 +239,17 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
199
239
|
}
|
|
200
240
|
return false;
|
|
201
241
|
};
|
|
242
|
+
const getSectionName = ()=>{
|
|
243
|
+
const checkRenamedSection = props.name && props.name === `Section ${props.uid}`;
|
|
244
|
+
if (getSectionNumber() >= SECTION_LIMIT - 5) {
|
|
245
|
+
return `${checkRenamedSection ? 'Section' : props?.name} ${getIndexSection() + 1}/${SECTION_LIMIT}`;
|
|
246
|
+
}
|
|
247
|
+
return checkRenamedSection ? `Section ${getIndexSection() + 1}` : props?.name;
|
|
248
|
+
};
|
|
249
|
+
const isEnableCreateThemeSection = ()=>{
|
|
250
|
+
return editingPageType !== 'STATIC' && editingPageType !== 'POST_PURCHASE';
|
|
251
|
+
};
|
|
252
|
+
// if (!isActive) return null;
|
|
202
253
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
203
254
|
children: [
|
|
204
255
|
!(props.tag == 'Section' && isThemeSectionEditor) && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
@@ -249,10 +300,10 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
249
300
|
}),
|
|
250
301
|
props.tag == 'Section' ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
251
302
|
"data-toolbar-name": true,
|
|
252
|
-
children:
|
|
303
|
+
children: getSectionName()
|
|
253
304
|
}) : /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
254
305
|
"data-toolbar-name": true,
|
|
255
|
-
children:
|
|
306
|
+
children: toolbarName()
|
|
256
307
|
}),
|
|
257
308
|
props.tag !== 'Section' && parents.length > 0 && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
258
309
|
"data-toolbar-icon-parent": true,
|
|
@@ -270,12 +321,21 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
270
321
|
})
|
|
271
322
|
]
|
|
272
323
|
}),
|
|
273
|
-
isShowParent && parents.map((parent, index)
|
|
324
|
+
isShowParent && parents.map((parent, index)=>{
|
|
325
|
+
// Update count columns of Row
|
|
326
|
+
const parentLength = parent?.childrens?.length ?? 0;
|
|
327
|
+
let parent_label = parent.label;
|
|
328
|
+
if (parent.label === 'Row') {
|
|
329
|
+
parent_label = parentLength <= 1 ? parent.label + ' ' + parentLength + ' col' : parent.label + ' ' + parentLength + ' cols';
|
|
330
|
+
}
|
|
331
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
274
332
|
"data-toolbar-parent": true,
|
|
275
333
|
"data-parent-uid": parent.uid,
|
|
276
334
|
"data-toolbar-theme-section": isThemeSectionEditor,
|
|
335
|
+
"data-toolbar-parent-revert": isShowParentRevert,
|
|
277
336
|
style: {
|
|
278
|
-
top: !isShowParentRevert ? `${-
|
|
337
|
+
top: !isShowParentRevert ? `${-36 * (index + 1)}px` // 32 height + 4 spacing
|
|
338
|
+
: `${36 * (index + 1)}px`
|
|
279
339
|
},
|
|
280
340
|
children: [
|
|
281
341
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -315,11 +375,12 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
315
375
|
}),
|
|
316
376
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
317
377
|
"data-toolbar-name": true,
|
|
318
|
-
children:
|
|
378
|
+
children: parent_label
|
|
319
379
|
})
|
|
320
380
|
]
|
|
321
|
-
}, parent.uid)
|
|
322
|
-
|
|
381
|
+
}, parent.uid);
|
|
382
|
+
}),
|
|
383
|
+
props.tag === 'Section' && !props.isThemeSection && isEnableCreateThemeSection() && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(CreateThemeSection.CreateThemeSection, {
|
|
323
384
|
...props
|
|
324
385
|
}),
|
|
325
386
|
props.tag == 'Sticky' && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -345,9 +406,10 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
345
406
|
text: "Page has reached Shopify’s 25 section-limit",
|
|
346
407
|
position: "bottom",
|
|
347
408
|
"data-toolbar-duplicate": true,
|
|
348
|
-
"data-toolbar-disable": props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT,
|
|
349
|
-
onClick: (e)=>onDuplicate(e),
|
|
409
|
+
"data-toolbar-disable": props.tag == 'Section' && getSectionNumber() >= SECTION_LIMIT || isDisableDuplicate,
|
|
410
|
+
onClick: isDisableDuplicate ? undefined : (e)=>onDuplicate(e),
|
|
350
411
|
"aria-hidden": "true",
|
|
412
|
+
className: isDisableDuplicate ? '!gp-cursor-not-allowed' : '',
|
|
351
413
|
children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
352
414
|
width: "16",
|
|
353
415
|
height: "16",
|
|
@@ -361,9 +423,14 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
361
423
|
})
|
|
362
424
|
})
|
|
363
425
|
}),
|
|
364
|
-
/*#__PURE__*/ jsxRuntime.jsx(
|
|
426
|
+
/*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
|
|
365
427
|
"data-toolbar-delete": true,
|
|
366
|
-
onClick: (e)=>onDelete(e),
|
|
428
|
+
onClick: (e)=>isDisableDelete ? null : onDelete(e),
|
|
429
|
+
enable: isDisableDelete,
|
|
430
|
+
"data-toolbar-disable": isDisableDelete,
|
|
431
|
+
width: tooltipText.width,
|
|
432
|
+
text: tooltipText.text,
|
|
433
|
+
position: deleteTooltipPosition,
|
|
367
434
|
"aria-hidden": "true",
|
|
368
435
|
children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
369
436
|
width: "16",
|
|
@@ -379,8 +446,8 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
379
446
|
})
|
|
380
447
|
})
|
|
381
448
|
]
|
|
382
|
-
}),
|
|
383
|
-
|
|
449
|
+
}, props.uid),
|
|
450
|
+
isEnableCreateThemeSection() && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(ThemeSectionStatus.ThemeSectionStatus, {
|
|
384
451
|
...props
|
|
385
452
|
}),
|
|
386
453
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -388,7 +455,7 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
388
455
|
"data-outline-section": props.tag == 'Section',
|
|
389
456
|
"data-outline-theme-section": props.tag == 'Section' && !!isThemeSection || isThemeSectionEditor,
|
|
390
457
|
"data-outline-limit": getIndexSection() >= SECTION_LIMIT
|
|
391
|
-
}),
|
|
458
|
+
}, 'outline-' + props.uid),
|
|
392
459
|
props.tag == 'Section' && !isThemeSectionEditor && /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
393
460
|
children: [
|
|
394
461
|
/*#__PURE__*/ jsxRuntime.jsx(Tooltip.default, {
|
|
@@ -406,8 +473,8 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
406
473
|
viewBox: "0 0 16 16",
|
|
407
474
|
fill: "none",
|
|
408
475
|
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
409
|
-
d: "M8.
|
|
410
|
-
fill: "
|
|
476
|
+
d: "M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",
|
|
477
|
+
fill: "#212121"
|
|
411
478
|
})
|
|
412
479
|
})
|
|
413
480
|
}),
|
|
@@ -426,8 +493,8 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
426
493
|
viewBox: "0 0 16 16",
|
|
427
494
|
fill: "none",
|
|
428
495
|
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
429
|
-
d: "M8.
|
|
430
|
-
fill: "
|
|
496
|
+
d: "M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",
|
|
497
|
+
fill: "#212121"
|
|
431
498
|
})
|
|
432
499
|
})
|
|
433
500
|
})
|
|
@@ -439,5 +506,6 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
439
506
|
]
|
|
440
507
|
});
|
|
441
508
|
};
|
|
509
|
+
var ComponentToolbarPreview$1 = /*#__PURE__*/ react.memo(ComponentToolbarPreview);
|
|
442
510
|
|
|
443
|
-
exports.
|
|
511
|
+
exports.default = ComponentToolbarPreview$1;
|
|
@@ -8,9 +8,9 @@ var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
|
|
|
8
8
|
var constant = require('./constant.js');
|
|
9
9
|
var RenderCustomCode = require('./RenderCustomCode.js');
|
|
10
10
|
|
|
11
|
-
const ComponentWrapper = ({ children, ...props })=>{
|
|
11
|
+
const ComponentWrapper = ({ children, pageType, ...props })=>{
|
|
12
12
|
if (props.type === 'section') return null;
|
|
13
|
-
const style = composeAdvanceStyle.composeAdvanceStyle(props.advanced, props.tag);
|
|
13
|
+
const style = composeAdvanceStyle.composeAdvanceStyle(props.advanced, props.tag, pageType);
|
|
14
14
|
const advanced = props.advanced;
|
|
15
15
|
if (constant.disableWrap.includes(props.tag) && /*#__PURE__*/ react.isValidElement(children)) {
|
|
16
16
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
@@ -20,6 +20,7 @@ const ComponentWrapper = ({ children, ...props })=>{
|
|
|
20
20
|
advanced: advanced
|
|
21
21
|
}),
|
|
22
22
|
/*#__PURE__*/ jsxRuntime.jsx(children.type, {
|
|
23
|
+
className: advanced?.cssClass,
|
|
23
24
|
...children.props,
|
|
24
25
|
style,
|
|
25
26
|
advanced
|
|
@@ -35,7 +36,7 @@ const ComponentWrapper = ({ children, ...props })=>{
|
|
|
35
36
|
}),
|
|
36
37
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
37
38
|
style: style,
|
|
38
|
-
className: `${props.uid}`,
|
|
39
|
+
className: `${props.uid} ${advanced?.cssClass}`,
|
|
39
40
|
children: children
|
|
40
41
|
})
|
|
41
42
|
]
|
|
@@ -8,6 +8,15 @@ var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
|
|
|
8
8
|
var constant = require('./constant.js');
|
|
9
9
|
var RenderCustomCode = require('./RenderCustomCode.js');
|
|
10
10
|
var ComponentToolbarPreview = require('./ComponentToolbarPreview.js');
|
|
11
|
+
var useApplyAnimation = require('../hooks/animation/useApplyAnimation.js');
|
|
12
|
+
require('zustand');
|
|
13
|
+
require('swr');
|
|
14
|
+
require('@gem-sdk/adapter-shopify');
|
|
15
|
+
require('swr/mutation');
|
|
16
|
+
var shop = require('../hooks/shop.js');
|
|
17
|
+
require('vanilla-lazyload');
|
|
18
|
+
require('../hooks/useCartUI.js');
|
|
19
|
+
require('../helpers/convert.js');
|
|
11
20
|
|
|
12
21
|
const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
13
22
|
react.useEffect(()=>{
|
|
@@ -21,6 +30,10 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
21
30
|
}, [
|
|
22
31
|
props.uid
|
|
23
32
|
]);
|
|
33
|
+
useApplyAnimation.default({
|
|
34
|
+
props
|
|
35
|
+
});
|
|
36
|
+
const pageType = shop.usePageType();
|
|
24
37
|
if (props.type === 'section') {
|
|
25
38
|
return null;
|
|
26
39
|
}
|
|
@@ -34,6 +47,9 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
34
47
|
if (editorConfigs.placeholder?.notAppendBeforeAfter) {
|
|
35
48
|
customProps['data-placeholder-not-append-before-after'] = true;
|
|
36
49
|
}
|
|
50
|
+
if (editorConfigs.placeholder?.notAppendLeftRight) {
|
|
51
|
+
customProps['data-placeholder-not-append-left-right'] = true;
|
|
52
|
+
}
|
|
37
53
|
if (editorConfigs.toolbar?.parent) {
|
|
38
54
|
customProps['data-toolbar-parent'] = true;
|
|
39
55
|
}
|
|
@@ -66,14 +82,21 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
66
82
|
if (!props?.editorConfigs?.toolbar?.hide) {
|
|
67
83
|
customProps['data-toolbar-wrap'] = true;
|
|
68
84
|
}
|
|
69
|
-
const
|
|
85
|
+
const isNotDroppable = (tag)=>{
|
|
86
|
+
return pageType === 'GP_FUNNEL_PAGE' ? [
|
|
87
|
+
'ProductList',
|
|
88
|
+
'Header'
|
|
89
|
+
].includes(tag) : false;
|
|
90
|
+
};
|
|
91
|
+
const style = composeAdvanceStyle.composeAdvanceStyle(props.advanced, props.tag, pageType);
|
|
70
92
|
const advanced = props.advanced;
|
|
71
93
|
const builderAttrs = {
|
|
72
94
|
...customProps,
|
|
73
95
|
'data-uid': props.uid,
|
|
74
96
|
'data-component-type': 'component',
|
|
75
97
|
'data-component-tag': props.tag,
|
|
76
|
-
'data-component-label': props.label
|
|
98
|
+
'data-component-label': props.label,
|
|
99
|
+
'data-not-droppable': isNotDroppable(props.tag)
|
|
77
100
|
};
|
|
78
101
|
if (constant.disableWrap.includes(props.tag) && /*#__PURE__*/ react.isValidElement(children)) {
|
|
79
102
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
@@ -90,7 +113,7 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
90
113
|
advanced,
|
|
91
114
|
children: [
|
|
92
115
|
children.props['children'],
|
|
93
|
-
/*#__PURE__*/ jsxRuntime.jsx(ComponentToolbarPreview.
|
|
116
|
+
/*#__PURE__*/ jsxRuntime.jsx(ComponentToolbarPreview.default, {
|
|
94
117
|
...props
|
|
95
118
|
})
|
|
96
119
|
]
|
|
@@ -106,12 +129,21 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
106
129
|
advanced: advanced
|
|
107
130
|
}),
|
|
108
131
|
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
109
|
-
style: style
|
|
132
|
+
style: !constant.excludeApplyStyle.includes(props.tag) ? style : {
|
|
133
|
+
'--mb': style?.['--mb'],
|
|
134
|
+
'--mb-tablet': style?.['--mb-tablet'],
|
|
135
|
+
'--mb-mobile': style?.['--mb-mobile']
|
|
136
|
+
},
|
|
110
137
|
className: `${props.uid} ${props.advanced?.cssClass ? props.advanced?.cssClass : ''}`,
|
|
111
138
|
...builderAttrs,
|
|
112
139
|
children: [
|
|
113
|
-
children,
|
|
114
|
-
/*#__PURE__*/ jsxRuntime.jsx(
|
|
140
|
+
!constant.excludeApplyStyle.includes(props.tag) && children,
|
|
141
|
+
/*#__PURE__*/ react.isValidElement(children) && constant.excludeApplyStyle.includes(props.tag) && /*#__PURE__*/ jsxRuntime.jsx(children.type, {
|
|
142
|
+
...children.props,
|
|
143
|
+
style,
|
|
144
|
+
advanced
|
|
145
|
+
}),
|
|
146
|
+
/*#__PURE__*/ jsxRuntime.jsx(ComponentToolbarPreview.default, {
|
|
115
147
|
...props
|
|
116
148
|
})
|
|
117
149
|
]
|
|
@@ -119,5 +151,6 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
|
|
|
119
151
|
]
|
|
120
152
|
});
|
|
121
153
|
};
|
|
154
|
+
var ComponentWrapperPreview$1 = /*#__PURE__*/ react.memo(ComponentWrapperPreview);
|
|
122
155
|
|
|
123
|
-
exports.default = ComponentWrapperPreview;
|
|
156
|
+
exports.default = ComponentWrapperPreview$1;
|
|
@@ -13,6 +13,12 @@ var RenderSection = require('./RenderSection.js');
|
|
|
13
13
|
const Render = ({ uid, ...passProps })=>{
|
|
14
14
|
const item = BuilderContext.useBuilderStore((s)=>s.getItem(uid));
|
|
15
15
|
const Component = BuilderComponent.useBuilderComponent(item?.tag);
|
|
16
|
+
const isPostPurchase = BuilderContext.useBuilderStore((s)=>s.getIsPostPurchase());
|
|
17
|
+
const pageType = react.useMemo(()=>{
|
|
18
|
+
return isPostPurchase ? 'POST_PURCHASE' : undefined;
|
|
19
|
+
}, [
|
|
20
|
+
isPostPurchase
|
|
21
|
+
]);
|
|
16
22
|
if (!item) return null;
|
|
17
23
|
if (item?.type === 'section') {
|
|
18
24
|
return /*#__PURE__*/ jsxRuntime.jsx(RenderSection.default, {
|
|
@@ -35,6 +41,7 @@ const Render = ({ uid, ...passProps })=>{
|
|
|
35
41
|
}),
|
|
36
42
|
children: /*#__PURE__*/ jsxRuntime.jsx(ComponentWrapper.default, {
|
|
37
43
|
...item,
|
|
44
|
+
pageType: pageType,
|
|
38
45
|
children: item?.childrens?.length ? /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
39
46
|
builderProps: {
|
|
40
47
|
uid,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var makeStyle = require('../helpers/make-style.js');
|
|
5
6
|
require('react');
|
|
6
7
|
require('react/jsx-runtime');
|
|
7
8
|
require('zustand');
|
|
@@ -12,10 +13,10 @@ require('vanilla-lazyload');
|
|
|
12
13
|
require('../hooks/useCartUI.js');
|
|
13
14
|
require('react-transition-group');
|
|
14
15
|
require('@gem-sdk/core');
|
|
16
|
+
var constant = require('./constant.js');
|
|
15
17
|
var render = require('../helpers/render.js');
|
|
16
|
-
require('../helpers/convert.js');
|
|
18
|
+
var convert = require('../helpers/convert.js');
|
|
17
19
|
var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
|
|
18
|
-
var constant = require('./constant.js');
|
|
19
20
|
|
|
20
21
|
const componentsRenderWithParentId = [
|
|
21
22
|
'CarouselItem'
|
|
@@ -24,6 +25,13 @@ const componentTexts = [
|
|
|
24
25
|
'Text',
|
|
25
26
|
'Heading'
|
|
26
27
|
];
|
|
28
|
+
const componentIconList = [
|
|
29
|
+
'IconListV2',
|
|
30
|
+
'IconList'
|
|
31
|
+
];
|
|
32
|
+
const componentUsingAdvanced = [
|
|
33
|
+
'IconList'
|
|
34
|
+
];
|
|
27
35
|
const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageContext, ...passProps })=>{
|
|
28
36
|
const item = builder[uid];
|
|
29
37
|
const Component = components[item?.tag];
|
|
@@ -104,7 +112,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
104
112
|
});
|
|
105
113
|
});
|
|
106
114
|
} else {
|
|
107
|
-
liquid = render.template`<div style="${style}" class="${item.uid} ${!item?.childrens?.length && item.tag === 'IconListItemHoz' ? 'hidden' : ''}">
|
|
115
|
+
liquid = render.template`<div style="${!componentIconList.includes(item.tag) ? style : ''}" class="${item.uid} ${!item?.childrens?.length && item.tag === 'IconListItemHoz' ? 'hidden' : ''}">
|
|
108
116
|
${render.RenderIf(item?.childrens?.length, ()=>{
|
|
109
117
|
return Component({
|
|
110
118
|
builderProps: {
|
|
@@ -114,6 +122,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
114
122
|
styles: item.styles,
|
|
115
123
|
setting: item.settings,
|
|
116
124
|
advanced: {
|
|
125
|
+
...componentUsingAdvanced.includes(item.tag) ? item?.advanced : {},
|
|
117
126
|
cssClass: item?.advanced?.cssClass
|
|
118
127
|
},
|
|
119
128
|
pageContext,
|
|
@@ -153,6 +162,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
153
162
|
},
|
|
154
163
|
pageContext,
|
|
155
164
|
isText: componentTexts.includes(item.tag) ? true : null,
|
|
165
|
+
style: componentIconList.includes(item.tag) ? style : null,
|
|
156
166
|
...passProps
|
|
157
167
|
});
|
|
158
168
|
})}
|
|
@@ -161,6 +171,7 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
161
171
|
const { cssCode, jsCode } = RenderCustomCode(item);
|
|
162
172
|
if (cssCode) liquid += cssCode;
|
|
163
173
|
if (jsCode) liquid += jsCode;
|
|
174
|
+
liquid = appendAnimation(item, liquid);
|
|
164
175
|
return {
|
|
165
176
|
liquid,
|
|
166
177
|
extraFiles: customProps.extraFiles
|
|
@@ -190,13 +201,62 @@ const RenderCustomCode = (item)=>{
|
|
|
190
201
|
jsCode
|
|
191
202
|
};
|
|
192
203
|
};
|
|
204
|
+
const appendAnimation = (props, liquid)=>{
|
|
205
|
+
const { advanced, tag } = props;
|
|
206
|
+
const { animation, op: opacity } = advanced ?? {};
|
|
207
|
+
const getAnimationType = (settings, type)=>{
|
|
208
|
+
return settings?.triggerConfig?.[type]?.animation ?? 'none';
|
|
209
|
+
};
|
|
210
|
+
const getSettingsByDevice = (device)=>{
|
|
211
|
+
if (device === 'desktop') return animation?.desktop;
|
|
212
|
+
else if (device === 'tablet') return animation?.tablet ?? animation?.desktop;
|
|
213
|
+
else if (device === 'mobile') return animation?.mobile ?? animation?.tablet ?? animation?.desktop;
|
|
214
|
+
return animation?.desktop;
|
|
215
|
+
};
|
|
216
|
+
const appearDesktop = getAnimationType(getSettingsByDevice('desktop'), 'appear');
|
|
217
|
+
const hoverDesktop = getAnimationType(getSettingsByDevice('desktop'), 'hover');
|
|
218
|
+
const appearTablet = getAnimationType(getSettingsByDevice('tablet'), 'appear');
|
|
219
|
+
const appearMobile = getAnimationType(getSettingsByDevice('mobile'), 'appear');
|
|
220
|
+
const enableAnimation = animation?.desktop?.enabled && (appearDesktop !== 'none' || hoverDesktop !== 'none') || animation?.tablet?.enabled && appearTablet !== 'none' || animation?.mobile?.enabled && appearMobile !== 'none';
|
|
221
|
+
if (!enableAnimation) return liquid;
|
|
222
|
+
const getInitOpacity = (device)=>+!(getSettingsByDevice(device)?.enabled && ![
|
|
223
|
+
'shake',
|
|
224
|
+
'none'
|
|
225
|
+
].includes(getAnimationType(getSettingsByDevice(device), 'appear')));
|
|
226
|
+
const opacityObject = {
|
|
227
|
+
desktop: getInitOpacity('desktop'),
|
|
228
|
+
tablet: getInitOpacity('tablet'),
|
|
229
|
+
mobile: getInitOpacity('mobile')
|
|
230
|
+
};
|
|
231
|
+
const inheritParentStyle = {
|
|
232
|
+
all: tag === 'Section' ? '' : 'inherit',
|
|
233
|
+
position: 'static',
|
|
234
|
+
transform: 'unset'
|
|
235
|
+
};
|
|
236
|
+
return render.template`
|
|
237
|
+
<gp-animation
|
|
238
|
+
gp-data='${JSON.stringify({
|
|
239
|
+
config: animation,
|
|
240
|
+
tag,
|
|
241
|
+
opacity
|
|
242
|
+
})}'
|
|
243
|
+
style="${{
|
|
244
|
+
...inheritParentStyle
|
|
245
|
+
}}"
|
|
246
|
+
>
|
|
247
|
+
<div style="${{
|
|
248
|
+
...makeStyle.makeStyleResponsive('op', opacityObject)
|
|
249
|
+
}}">${liquid}</div>
|
|
250
|
+
</gp-animation>
|
|
251
|
+
${render.RenderIf(convert.isLocalEnv, `<script src="{{ 'gp-animation.js' | asset_url }}" defer="defer"></script>`, `<script src="${convert.baseAssetURL}/assets-v2/gp-animation.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
252
|
+
`;
|
|
253
|
+
};
|
|
193
254
|
const RenderChildren = (props)=>{
|
|
194
255
|
const data = Render(props);
|
|
195
256
|
// Append to prop parent
|
|
196
257
|
for(const key in data.extraFiles){
|
|
197
258
|
if (Object.prototype.hasOwnProperty.call(data.extraFiles, key)) {
|
|
198
|
-
|
|
199
|
-
props.customProps.extraFiles[key] = value;
|
|
259
|
+
props.customProps.extraFiles[key] = data.extraFiles[key];
|
|
200
260
|
}
|
|
201
261
|
}
|
|
202
262
|
// Fix limit 256kb
|
|
@@ -205,7 +265,7 @@ const RenderChildren = (props)=>{
|
|
|
205
265
|
if (Math.ceil(size / 1024) >= 180) {
|
|
206
266
|
const fileName = `gp-section-snippet-${props.uid}`;
|
|
207
267
|
props.customProps.extraFiles[fileName] = data.liquid;
|
|
208
|
-
return `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant %}`;
|
|
268
|
+
return `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant, form: form %}`;
|
|
209
269
|
}
|
|
210
270
|
return data.liquid;
|
|
211
271
|
};
|
|
@@ -222,7 +282,7 @@ const WrapRenderChildren = ({ uid, customProps }, codes)=>{
|
|
|
222
282
|
if (Math.ceil(size / 1024) >= 180) {
|
|
223
283
|
const fileName = `gp-section-snippet-${uid + i}`;
|
|
224
284
|
customProps.extraFiles[fileName] = code;
|
|
225
|
-
liquid += `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant %}`;
|
|
285
|
+
liquid += `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant, form: form %}`;
|
|
226
286
|
} else {
|
|
227
287
|
liquid += code;
|
|
228
288
|
}
|
|
@@ -20,7 +20,6 @@ const disableWrap = [
|
|
|
20
20
|
'Header',
|
|
21
21
|
'HeroBanner',
|
|
22
22
|
'Icon',
|
|
23
|
-
'IconList',
|
|
24
23
|
'HTMLCode',
|
|
25
24
|
'IconListHoz',
|
|
26
25
|
'IconListItem',
|
|
@@ -35,7 +34,9 @@ const disableWrap = [
|
|
|
35
34
|
'Product',
|
|
36
35
|
'ProductImages',
|
|
37
36
|
'ProductImagesV2',
|
|
38
|
-
'
|
|
37
|
+
'PostPurchaseProductImages',
|
|
38
|
+
'Sticky',
|
|
39
|
+
'Heading'
|
|
39
40
|
];
|
|
40
41
|
const customRenderChildren = [
|
|
41
42
|
'Accordion',
|
|
@@ -44,6 +45,30 @@ const customRenderChildren = [
|
|
|
44
45
|
'IconList',
|
|
45
46
|
'Tabs'
|
|
46
47
|
];
|
|
48
|
+
const excludeApplyStyle = [
|
|
49
|
+
'IconListV2',
|
|
50
|
+
'IconList'
|
|
51
|
+
];
|
|
52
|
+
const postPurchaseRequiredElements = [
|
|
53
|
+
'PostPurchaseProductOffer',
|
|
54
|
+
'PostPurchaseProductTitle',
|
|
55
|
+
'PostPurchaseProductPrice',
|
|
56
|
+
'PostPurchaseAcceptButton',
|
|
57
|
+
'PostPurchaseButton',
|
|
58
|
+
'PostPurchaseCalloutBox',
|
|
59
|
+
'PostPurchaseProductPriceBreakdown',
|
|
60
|
+
'PostPurchaseProductImages',
|
|
61
|
+
'PostPurchaseCalloutText'
|
|
62
|
+
];
|
|
63
|
+
const postPurchaseWrapElements = [
|
|
64
|
+
'Row',
|
|
65
|
+
'Section',
|
|
66
|
+
'PostPurchaseCalloutBox',
|
|
67
|
+
'PostPurchaseProductOffer'
|
|
68
|
+
];
|
|
47
69
|
|
|
48
70
|
exports.customRenderChildren = customRenderChildren;
|
|
49
71
|
exports.disableWrap = disableWrap;
|
|
72
|
+
exports.excludeApplyStyle = excludeApplyStyle;
|
|
73
|
+
exports.postPurchaseRequiredElements = postPurchaseRequiredElements;
|
|
74
|
+
exports.postPurchaseWrapElements = postPurchaseWrapElements;
|