@gem-sdk/pages 1.9.60 → 1.10.16
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.
|
@@ -24,7 +24,6 @@ const Toolbox = ()=>{
|
|
|
24
24
|
const addSection = core.useSectionStore((s)=>s.addSection);
|
|
25
25
|
const changeSwatches = core.useShopStore((s)=>s.changeSwatches);
|
|
26
26
|
const changeLayoutSettings = core.useShopStore((s)=>s.changeLayoutSettings);
|
|
27
|
-
const [initEventSuccess, setInitEventSuccess] = react.useState(false);
|
|
28
27
|
const clearModal = core.useModalStore((s)=>s.clearModal);
|
|
29
28
|
// Revalidate all query with key match query/
|
|
30
29
|
const onRevalidateQuery = react.useCallback(()=>{
|
|
@@ -199,7 +198,6 @@ const Toolbox = ()=>{
|
|
|
199
198
|
window.addEventListener('set-global-style', onChangeGlobalStyle);
|
|
200
199
|
window.addEventListener('update-global-swatches-data', onChangeSwatchesData);
|
|
201
200
|
window.addEventListener('on-off-header-footer', onChangeLayoutSettingData);
|
|
202
|
-
setInitEventSuccess(true);
|
|
203
201
|
return ()=>{
|
|
204
202
|
window.removeEventListener('update-shop-info', onChangeShopInfo);
|
|
205
203
|
window.removeEventListener('revalidate-query', onRevalidateQuery);
|
|
@@ -210,7 +208,7 @@ const Toolbox = ()=>{
|
|
|
210
208
|
window.removeEventListener('update-entity-prop', onUpdateEntityProp);
|
|
211
209
|
window.removeEventListener('set-global-style', onChangeGlobalStyle);
|
|
212
210
|
window.removeEventListener('update-global-swatches-data', onChangeSwatchesData);
|
|
213
|
-
window.
|
|
211
|
+
window.removeEventListener('on-off-header-footer', onChangeLayoutSettingData);
|
|
214
212
|
};
|
|
215
213
|
}, [
|
|
216
214
|
onAddEntity,
|
|
@@ -225,9 +223,7 @@ const Toolbox = ()=>{
|
|
|
225
223
|
onChangeLayoutSettingData
|
|
226
224
|
]);
|
|
227
225
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
228
|
-
className:
|
|
229
|
-
toolbox: initEventSuccess
|
|
230
|
-
})
|
|
226
|
+
className: "toolbox"
|
|
231
227
|
});
|
|
232
228
|
};
|
|
233
229
|
var Toolbox$1 = /*#__PURE__*/ react.memo(Toolbox);
|
|
@@ -13,14 +13,14 @@ var PopupManager = require('../components/builder/PopupManager.js');
|
|
|
13
13
|
|
|
14
14
|
const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData , pageType })=>{
|
|
15
15
|
const [loadSuccess, setLoadSuccess] = react.useState(false);
|
|
16
|
-
const initState = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
const initState = react.useMemo(()=>({
|
|
17
|
+
ROOT: {
|
|
18
|
+
uid: 'ROOT',
|
|
19
|
+
tag: 'Root',
|
|
20
|
+
label: 'Root',
|
|
21
|
+
childrens: []
|
|
22
|
+
}
|
|
23
|
+
}), []);
|
|
24
24
|
react.useEffect(()=>{
|
|
25
25
|
setLoadSuccess(true);
|
|
26
26
|
}, []);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useMatchMutate, useShopStore, useBuilderPreviewStore, useSectionStore, useModalStore
|
|
3
|
-
import { memo,
|
|
2
|
+
import { useMatchMutate, useShopStore, useBuilderPreviewStore, useSectionStore, useModalStore } from '@gem-sdk/core';
|
|
3
|
+
import { memo, useCallback, useEffect } from 'react';
|
|
4
4
|
import { createFontUrl } from '../../libs/google-fonts.js';
|
|
5
5
|
import { genCSS } from '../../libs/helpers/gen-css.js';
|
|
6
6
|
import { getStorefrontApi } from '../../libs/get-storefront-api.js';
|
|
@@ -20,7 +20,6 @@ const Toolbox = ()=>{
|
|
|
20
20
|
const addSection = useSectionStore((s)=>s.addSection);
|
|
21
21
|
const changeSwatches = useShopStore((s)=>s.changeSwatches);
|
|
22
22
|
const changeLayoutSettings = useShopStore((s)=>s.changeLayoutSettings);
|
|
23
|
-
const [initEventSuccess, setInitEventSuccess] = useState(false);
|
|
24
23
|
const clearModal = useModalStore((s)=>s.clearModal);
|
|
25
24
|
// Revalidate all query with key match query/
|
|
26
25
|
const onRevalidateQuery = useCallback(()=>{
|
|
@@ -195,7 +194,6 @@ const Toolbox = ()=>{
|
|
|
195
194
|
window.addEventListener('set-global-style', onChangeGlobalStyle);
|
|
196
195
|
window.addEventListener('update-global-swatches-data', onChangeSwatchesData);
|
|
197
196
|
window.addEventListener('on-off-header-footer', onChangeLayoutSettingData);
|
|
198
|
-
setInitEventSuccess(true);
|
|
199
197
|
return ()=>{
|
|
200
198
|
window.removeEventListener('update-shop-info', onChangeShopInfo);
|
|
201
199
|
window.removeEventListener('revalidate-query', onRevalidateQuery);
|
|
@@ -206,7 +204,7 @@ const Toolbox = ()=>{
|
|
|
206
204
|
window.removeEventListener('update-entity-prop', onUpdateEntityProp);
|
|
207
205
|
window.removeEventListener('set-global-style', onChangeGlobalStyle);
|
|
208
206
|
window.removeEventListener('update-global-swatches-data', onChangeSwatchesData);
|
|
209
|
-
window.
|
|
207
|
+
window.removeEventListener('on-off-header-footer', onChangeLayoutSettingData);
|
|
210
208
|
};
|
|
211
209
|
}, [
|
|
212
210
|
onAddEntity,
|
|
@@ -221,9 +219,7 @@ const Toolbox = ()=>{
|
|
|
221
219
|
onChangeLayoutSettingData
|
|
222
220
|
]);
|
|
223
221
|
return /*#__PURE__*/ jsx("div", {
|
|
224
|
-
className:
|
|
225
|
-
toolbox: initEventSuccess
|
|
226
|
-
})
|
|
222
|
+
className: "toolbox"
|
|
227
223
|
});
|
|
228
224
|
};
|
|
229
225
|
var Toolbox$1 = /*#__PURE__*/ memo(Toolbox);
|
|
@@ -2,7 +2,7 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { BuilderComponentProvider, SectionProvider, BuilderPreviewProvider, RenderPreview } from '@gem-sdk/core';
|
|
3
3
|
import { NextSeo } from 'next-seo';
|
|
4
4
|
import Head from 'next/head';
|
|
5
|
-
import { useState, useEffect } from 'react';
|
|
5
|
+
import { useState, useMemo, useEffect } from 'react';
|
|
6
6
|
import Toolbox from '../components/builder/Toolbox.js';
|
|
7
7
|
import Header from '../components/Header.js';
|
|
8
8
|
import Footer from '../components/Footer.js';
|
|
@@ -11,14 +11,14 @@ import PopupManager from '../components/builder/PopupManager.js';
|
|
|
11
11
|
|
|
12
12
|
const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData , pageType })=>{
|
|
13
13
|
const [loadSuccess, setLoadSuccess] = useState(false);
|
|
14
|
-
const initState = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
const initState = useMemo(()=>({
|
|
15
|
+
ROOT: {
|
|
16
|
+
uid: 'ROOT',
|
|
17
|
+
tag: 'Root',
|
|
18
|
+
label: 'Root',
|
|
19
|
+
childrens: []
|
|
20
|
+
}
|
|
21
|
+
}), []);
|
|
22
22
|
useEffect(()=>{
|
|
23
23
|
setLoadSuccess(true);
|
|
24
24
|
}, []);
|