@gem-sdk/pages 1.24.11 → 1.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/builder/Toolbar.js +736 -0
- package/dist/cjs/components/builder/Toolbox.js +45 -1
- package/dist/cjs/pages/builder.js +9 -3
- package/dist/esm/components/builder/Toolbar.js +732 -0
- package/dist/esm/components/builder/Toolbox.js +45 -1
- package/dist/esm/pages/builder.js +9 -3
- package/dist/types/index.d.ts +1 -0
- package/package.json +5 -5
|
@@ -23,12 +23,16 @@ const Toolbox = ()=>{
|
|
|
23
23
|
const initNormalizeState = core.useBuilderPreviewStore((s)=>s.forceChangeState);
|
|
24
24
|
const forceChangeItemProp = core.useBuilderPreviewStore((s)=>s.forceChangeItemProp);
|
|
25
25
|
const changeItemPropByKey = core.useBuilderPreviewStore((s)=>s.changeItemPropByKey);
|
|
26
|
+
const setDynamicProduct = core.useBuilderPreviewStore((s)=>s.setDynamicProduct);
|
|
27
|
+
const setDynamicCollection = core.useBuilderPreviewStore((s)=>s.setDynamicCollection);
|
|
26
28
|
const addItem = core.useBuilderPreviewStore((s)=>s.addItem);
|
|
27
29
|
const moveItem = core.useBuilderPreviewStore((s)=>s.moveItem);
|
|
28
30
|
const removeItem = core.useBuilderPreviewStore((s)=>s.removeItem);
|
|
29
31
|
const addSection = core.useSectionStore((s)=>s.addSection);
|
|
30
32
|
const changeSwatches = core.useShopStore((s)=>s.changeSwatches);
|
|
31
33
|
const changeLayoutSettings = core.useShopStore((s)=>s.changeLayoutSettings);
|
|
34
|
+
const changeCreateThemeSectionCount = core.useShopStore((s)=>s.changeCreateThemeSectionCount);
|
|
35
|
+
const changeShopPlan = core.useShopStore((s)=>s.changeShopPlan);
|
|
32
36
|
const clearModal = core.useModalStore((s)=>s.clearModal);
|
|
33
37
|
const fonts = react.useMemo(()=>genFonts.getFontsFromDataBuilder(state), [
|
|
34
38
|
state
|
|
@@ -221,6 +225,34 @@ const Toolbox = ()=>{
|
|
|
221
225
|
}, [
|
|
222
226
|
changeLayoutSettings
|
|
223
227
|
]);
|
|
228
|
+
const onUpdateCreateThemeSectionCount = react.useCallback((e)=>{
|
|
229
|
+
const count = e.detail;
|
|
230
|
+
if (!count) return;
|
|
231
|
+
changeCreateThemeSectionCount(count);
|
|
232
|
+
}, [
|
|
233
|
+
changeCreateThemeSectionCount
|
|
234
|
+
]);
|
|
235
|
+
const onUpdateShopPlan = react.useCallback((e)=>{
|
|
236
|
+
const shopPlan = e.detail;
|
|
237
|
+
if (!shopPlan) return;
|
|
238
|
+
changeShopPlan(shopPlan);
|
|
239
|
+
}, [
|
|
240
|
+
changeShopPlan
|
|
241
|
+
]);
|
|
242
|
+
const onUpdateDynamicProduct = react.useCallback((e)=>{
|
|
243
|
+
const product = e.detail;
|
|
244
|
+
if (!product) return;
|
|
245
|
+
setDynamicProduct(product);
|
|
246
|
+
}, [
|
|
247
|
+
setDynamicProduct
|
|
248
|
+
]);
|
|
249
|
+
const onUpdateDynamicCollection = react.useCallback((e)=>{
|
|
250
|
+
const collection = e.detail;
|
|
251
|
+
if (!collection) return;
|
|
252
|
+
setDynamicCollection(collection);
|
|
253
|
+
}, [
|
|
254
|
+
setDynamicCollection
|
|
255
|
+
]);
|
|
224
256
|
react.useEffect(()=>{
|
|
225
257
|
if (customFontUrl) {
|
|
226
258
|
const fontId = 'google-font';
|
|
@@ -253,6 +285,10 @@ const Toolbox = ()=>{
|
|
|
253
285
|
window.addEventListener('set-global-style', onChangeGlobalStyle);
|
|
254
286
|
window.addEventListener('update-global-swatches-data', onChangeSwatchesData);
|
|
255
287
|
window.addEventListener('on-off-header-footer', onChangeLayoutSettingData);
|
|
288
|
+
window.addEventListener('update-create-theme-section-count', onUpdateCreateThemeSectionCount);
|
|
289
|
+
window.addEventListener('update-shop-plan', onUpdateShopPlan);
|
|
290
|
+
window.addEventListener('set-dynamic-product', onUpdateDynamicProduct);
|
|
291
|
+
window.addEventListener('set-dynamic-collection', onUpdateDynamicCollection);
|
|
256
292
|
return ()=>{
|
|
257
293
|
window.removeEventListener('update-shop-info', onChangeShopInfo);
|
|
258
294
|
window.removeEventListener('revalidate-query', onRevalidateQuery);
|
|
@@ -264,9 +300,14 @@ const Toolbox = ()=>{
|
|
|
264
300
|
window.removeEventListener('set-global-style', onChangeGlobalStyle);
|
|
265
301
|
window.removeEventListener('update-global-swatches-data', onChangeSwatchesData);
|
|
266
302
|
window.removeEventListener('on-off-header-footer', onChangeLayoutSettingData);
|
|
303
|
+
window.removeEventListener('update-create-theme-section-count', onUpdateCreateThemeSectionCount);
|
|
304
|
+
window.removeEventListener('update-shop-plan', onUpdateShopPlan);
|
|
305
|
+
window.removeEventListener('set-dynamic-product', onUpdateDynamicProduct);
|
|
306
|
+
window.removeEventListener('set-dynamic-collection', onUpdateDynamicCollection);
|
|
267
307
|
};
|
|
268
308
|
}, [
|
|
269
309
|
onAddEntity,
|
|
310
|
+
onUpdateShopPlan,
|
|
270
311
|
onForceUpdateEntityProps,
|
|
271
312
|
onUpdateEntityProp,
|
|
272
313
|
onInitBuilder,
|
|
@@ -276,7 +317,10 @@ const Toolbox = ()=>{
|
|
|
276
317
|
onChangeSwatchesData,
|
|
277
318
|
onRevalidateQuery,
|
|
278
319
|
onChangeShopInfo,
|
|
279
|
-
onChangeLayoutSettingData
|
|
320
|
+
onChangeLayoutSettingData,
|
|
321
|
+
onUpdateCreateThemeSectionCount,
|
|
322
|
+
onUpdateDynamicProduct,
|
|
323
|
+
onUpdateDynamicCollection
|
|
280
324
|
]);
|
|
281
325
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
282
326
|
className: "toolbox"
|
|
@@ -12,8 +12,9 @@ var CollectionGlobalProvider = require('./CollectionGlobalProvider.js');
|
|
|
12
12
|
var PopupManager = require('../components/builder/PopupManager.js');
|
|
13
13
|
var ImageToLayout = require('../components/image-to-layout/ImageToLayout.js');
|
|
14
14
|
var AddSectionImageToLayout = require('../components/image-to-layout/AddSectionImageToLayout.js');
|
|
15
|
+
var Toolbar = require('../components/builder/Toolbar.js');
|
|
15
16
|
|
|
16
|
-
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout })=>{
|
|
17
|
+
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor })=>{
|
|
17
18
|
const [loadSuccess, setLoadSuccess] = react.useState(false);
|
|
18
19
|
const initState = react.useMemo(()=>({
|
|
19
20
|
ROOT: {
|
|
@@ -55,15 +56,20 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
|
|
|
55
56
|
data: sectionData,
|
|
56
57
|
children: /*#__PURE__*/ jsxRuntime.jsxs(core.BuilderPreviewProvider, {
|
|
57
58
|
state: initState,
|
|
59
|
+
isThemeSectionEditor: isThemeSectionEditor,
|
|
58
60
|
children: [
|
|
59
61
|
/*#__PURE__*/ jsxRuntime.jsx(Toolbox.default, {}),
|
|
62
|
+
/*#__PURE__*/ jsxRuntime.jsx(Toolbar.default, {}),
|
|
60
63
|
/*#__PURE__*/ jsxRuntime.jsx(PopupManager.default, {}),
|
|
61
64
|
loadSuccess && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
62
65
|
className: "builder z-1 relative",
|
|
63
66
|
children: [
|
|
64
|
-
/*#__PURE__*/ jsxRuntime.jsx(
|
|
67
|
+
isThemeSectionEditor ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
68
|
+
className: "h-[40px] bg-[#f4f4f4]"
|
|
69
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(Header.default, {}),
|
|
65
70
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
66
71
|
id: "storefront",
|
|
72
|
+
className: isThemeSectionEditor ? 'theme-section-editor' : '',
|
|
67
73
|
children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsxRuntime.jsx(CollectionGlobalProvider.default, {
|
|
68
74
|
children: /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
|
|
69
75
|
uid: "ROOT"
|
|
@@ -81,7 +87,7 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
|
|
|
81
87
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
82
88
|
id: "visual-content"
|
|
83
89
|
}),
|
|
84
|
-
/*#__PURE__*/ jsxRuntime.jsx(Footer.default, {})
|
|
90
|
+
!isThemeSectionEditor && /*#__PURE__*/ jsxRuntime.jsx(Footer.default, {})
|
|
85
91
|
]
|
|
86
92
|
})
|
|
87
93
|
]
|