@gem-sdk/pages 1.7.13 → 1.8.6
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/Footer.js +33 -8
- package/dist/cjs/components/Header.js +6 -5
- package/dist/cjs/pages/CollectionGlobalProvider.js +39 -0
- package/dist/cjs/pages/builder.js +28 -24
- package/dist/esm/components/Footer.js +35 -10
- package/dist/esm/components/Header.js +7 -6
- package/dist/esm/pages/CollectionGlobalProvider.js +35 -0
- package/dist/esm/pages/builder.js +28 -24
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -7,15 +7,40 @@ var core = require('@gem-sdk/core');
|
|
|
7
7
|
|
|
8
8
|
const Footer = ()=>{
|
|
9
9
|
const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
|
|
10
|
-
if (!layoutSetting?.showFooter) return null;
|
|
11
10
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
12
|
-
className:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
className: core.cls('flex h-40 items-center justify-center bg-[#D6D6D6]', {
|
|
12
|
+
hidden: !layoutSetting?.showFooter
|
|
13
|
+
}),
|
|
14
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
15
|
+
className: "gp-footer children:hover:block group flex h-6 cursor-pointer items-center justify-center rounded bg-[#E2E2E2] p-1",
|
|
16
|
+
children: [
|
|
17
|
+
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
18
|
+
className: "font-xs text-[#252525]",
|
|
19
|
+
children: "Shopify theme’s footer"
|
|
20
|
+
}),
|
|
21
|
+
/*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
22
|
+
className: "ml-[5px] w-0 group-hover:w-auto",
|
|
23
|
+
width: "16",
|
|
24
|
+
height: "16",
|
|
25
|
+
viewBox: "0 0 16 16",
|
|
26
|
+
fill: "none",
|
|
27
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
28
|
+
children: [
|
|
29
|
+
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
30
|
+
fillRule: "evenodd",
|
|
31
|
+
clipRule: "evenodd",
|
|
32
|
+
d: "M7.9996 5.08501C6.38958 5.08501 5.08441 6.39019 5.08441 8.00021C5.08441 9.61023 6.38958 10.9154 7.9996 10.9154C9.60962 10.9154 10.9148 9.61023 10.9148 8.00021C10.9148 6.39019 9.60962 5.08501 7.9996 5.08501ZM6.08441 8.00021C6.08441 6.94247 6.94187 6.08501 7.9996 6.08501C9.05734 6.08501 9.9148 6.94247 9.9148 8.00021C9.9148 9.05794 9.05734 9.9154 7.9996 9.9154C6.94187 9.9154 6.08441 9.05794 6.08441 8.00021Z",
|
|
33
|
+
fill: "#252525"
|
|
34
|
+
}),
|
|
35
|
+
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
36
|
+
fillRule: "evenodd",
|
|
37
|
+
clipRule: "evenodd",
|
|
38
|
+
d: "M6.52326 1.00391C6.28114 1.00391 6.07381 1.17739 6.0311 1.41572L5.74126 3.03321C5.40322 3.18248 5.08321 3.36419 4.78533 3.57432L3.18532 3.00147C2.9566 2.91958 2.70211 3.01395 2.58207 3.22517L1.12196 5.79451C1.00193 6.00572 1.05109 6.27266 1.2385 6.42725L2.50062 7.46836C2.48333 7.64355 2.4745 7.82106 2.4745 8.00047C2.4745 8.17981 2.48333 8.35726 2.5006 8.53238L1.2385 9.57347C1.05109 9.72806 1.00193 9.995 1.12196 10.2062L2.58207 12.7756C2.70211 12.9868 2.9566 13.0811 3.18532 12.9993L4.78513 12.4265C5.08308 12.6367 5.40317 12.8185 5.7413 12.9678L6.0311 14.585C6.07381 14.8233 6.28114 14.9968 6.52326 14.9968H9.47623C9.71835 14.9968 9.92568 14.8233 9.96839 14.585L10.2582 12.9676C10.5963 12.8183 10.9163 12.6365 11.2141 12.4264L12.8142 12.9993C13.0429 13.0811 13.2974 12.9868 13.4174 12.7756L14.8775 10.2062C14.9976 9.995 14.9484 9.72806 14.761 9.57347L13.4985 8.5321C13.5158 8.35706 13.5246 8.17971 13.5246 8.00047C13.5246 7.82116 13.5158 7.64375 13.4985 7.46864L14.761 6.42725C14.9484 6.27266 14.9976 6.00572 14.8775 5.79451L13.4174 3.22517C13.2974 3.01395 13.0429 2.91958 12.8142 3.00147L11.2139 3.57441C10.9161 3.36433 10.5962 3.18264 10.2583 3.0334L9.96839 1.41572C9.92568 1.17739 9.71835 1.00391 9.47623 1.00391H6.52326ZM6.67723 3.47943L6.94163 2.00391H9.05786L9.32229 3.47958C9.35324 3.6523 9.47246 3.79616 9.63643 3.85863C10.0674 4.02283 10.4665 4.25007 10.8219 4.5288C10.9571 4.63483 11.1373 4.66402 11.299 4.6061L12.7556 4.08459L13.8005 5.92323L12.6501 6.8722C12.5142 6.98427 12.4473 7.15956 12.474 7.33366C12.5073 7.55089 12.5246 7.77354 12.5246 8.00047C12.5246 8.22735 12.5073 8.44993 12.474 8.66711C12.4474 8.8412 12.5142 9.01648 12.6501 9.12855L13.8005 10.0775L12.7556 11.9161L11.2992 11.3947C11.1374 11.3368 10.9573 11.366 10.8221 11.472C10.4666 11.7508 10.0675 11.9781 9.6364 12.1423C9.47242 12.2048 9.3532 12.3487 9.32225 12.5214L9.05786 13.9968H6.94163L6.67727 12.5215C6.64632 12.3488 6.52708 12.2049 6.36308 12.1425C5.9319 11.9782 5.53267 11.7509 5.17713 11.4721C5.04194 11.3661 4.86178 11.3369 4.70003 11.3948L3.24387 11.9161L2.199 10.0775L3.34904 9.12883C3.48491 9.01675 3.55179 8.84146 3.52511 8.66736C3.4918 8.4501 3.4745 8.22743 3.4745 8.00047C3.4745 7.77345 3.49181 7.55072 3.52513 7.33341C3.55183 7.15931 3.48495 6.984 3.34907 6.87192L2.199 5.92323L3.24387 4.08459L4.70022 4.60601C4.86197 4.66392 5.04212 4.63474 5.17731 4.52872C5.53279 4.24994 5.93195 4.02269 6.36304 3.85849C6.52704 3.79603 6.64628 3.65216 6.67723 3.47943Z",
|
|
39
|
+
fill: "#252525"
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
})
|
|
43
|
+
]
|
|
19
44
|
})
|
|
20
45
|
});
|
|
21
46
|
};
|
|
@@ -7,18 +7,19 @@ var core = require('@gem-sdk/core');
|
|
|
7
7
|
|
|
8
8
|
const Header = ()=>{
|
|
9
9
|
const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
|
|
10
|
-
if (!layoutSetting?.showHeader) return null;
|
|
11
10
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
12
|
-
className:
|
|
11
|
+
className: core.cls('flex h-12 items-center justify-center bg-[#D6D6D6]', {
|
|
12
|
+
hidden: !layoutSetting?.showHeader
|
|
13
|
+
}),
|
|
13
14
|
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
14
|
-
className: "gp-header
|
|
15
|
+
className: "gp-header children:hover:block group flex h-6 cursor-pointer items-center justify-center rounded bg-[#E2E2E2] p-1",
|
|
15
16
|
children: [
|
|
16
17
|
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
17
|
-
className: "text-[#252525]
|
|
18
|
+
className: "font-xs text-[#252525] ",
|
|
18
19
|
children: "Shopify theme’s header"
|
|
19
20
|
}),
|
|
20
21
|
/*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
21
|
-
className: "w-0 group-hover:w-auto
|
|
22
|
+
className: "ml-[5px] w-0 group-hover:w-auto",
|
|
22
23
|
width: "16",
|
|
23
24
|
height: "16",
|
|
24
25
|
viewBox: "0 0 16 16",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var core = require('@gem-sdk/core');
|
|
7
|
+
var dynamic = require('next/dynamic');
|
|
8
|
+
|
|
9
|
+
const CollectionProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.CollectionProvider));
|
|
10
|
+
const CollectionGlobalProvider = ({ children })=>{
|
|
11
|
+
const { data: collections , isValidating , error } = core.useCollectionsQuery({
|
|
12
|
+
first: 1,
|
|
13
|
+
orderBy: {
|
|
14
|
+
direction: 'DESC',
|
|
15
|
+
field: 'UPDATED_AT'
|
|
16
|
+
},
|
|
17
|
+
where: {
|
|
18
|
+
isSample: false
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const collection = collections?.collections?.edges?.[0]?.node;
|
|
22
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
23
|
+
children: isValidating ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
24
|
+
children: "Loading..."
|
|
25
|
+
}) : error ? /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
26
|
+
children: [
|
|
27
|
+
"Error: ",
|
|
28
|
+
error?.message
|
|
29
|
+
]
|
|
30
|
+
}) : !collection ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
31
|
+
children: "Collection not found"
|
|
32
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(CollectionProvider, {
|
|
33
|
+
collection: collection,
|
|
34
|
+
children: children
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.default = CollectionGlobalProvider;
|
|
@@ -8,8 +8,9 @@ var react = require('react');
|
|
|
8
8
|
var Toolbox = require('../components/builder/Toolbox.js');
|
|
9
9
|
var Header = require('../components/Header.js');
|
|
10
10
|
var Footer = require('../components/Footer.js');
|
|
11
|
+
var CollectionGlobalProvider = require('./CollectionGlobalProvider.js');
|
|
11
12
|
|
|
12
|
-
const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData })=>{
|
|
13
|
+
const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData , pageType })=>{
|
|
13
14
|
const [loadSuccess, setLoadSuccess] = react.useState(false);
|
|
14
15
|
const initState = {
|
|
15
16
|
ROOT: {
|
|
@@ -22,6 +23,29 @@ const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData
|
|
|
22
23
|
react.useEffect(()=>{
|
|
23
24
|
setLoadSuccess(true);
|
|
24
25
|
}, []);
|
|
26
|
+
const sectionProvider = /*#__PURE__*/ jsxRuntime.jsx(core.SectionProvider, {
|
|
27
|
+
data: sectionData,
|
|
28
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(core.BuilderPreviewProvider, {
|
|
29
|
+
state: initState,
|
|
30
|
+
children: [
|
|
31
|
+
/*#__PURE__*/ jsxRuntime.jsx(Toolbox.default, {}),
|
|
32
|
+
loadSuccess && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
33
|
+
className: "builder",
|
|
34
|
+
children: [
|
|
35
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
36
|
+
id: "storefront",
|
|
37
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
|
|
38
|
+
uid: "ROOT"
|
|
39
|
+
})
|
|
40
|
+
}),
|
|
41
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
42
|
+
id: "visual-content"
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
})
|
|
46
|
+
]
|
|
47
|
+
}, "preview")
|
|
48
|
+
});
|
|
25
49
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
26
50
|
children: [
|
|
27
51
|
/*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
|
|
@@ -48,29 +72,9 @@ const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData
|
|
|
48
72
|
/*#__PURE__*/ jsxRuntime.jsx(Header.default, {}),
|
|
49
73
|
/*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
|
|
50
74
|
components: components,
|
|
51
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
state: initState,
|
|
55
|
-
children: [
|
|
56
|
-
/*#__PURE__*/ jsxRuntime.jsx(Toolbox.default, {}),
|
|
57
|
-
loadSuccess && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
58
|
-
className: "builder",
|
|
59
|
-
children: [
|
|
60
|
-
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
61
|
-
id: "storefront",
|
|
62
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
|
|
63
|
-
uid: "ROOT"
|
|
64
|
-
})
|
|
65
|
-
}),
|
|
66
|
-
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
67
|
-
id: "visual-content"
|
|
68
|
-
})
|
|
69
|
-
]
|
|
70
|
-
})
|
|
71
|
-
]
|
|
72
|
-
}, "preview")
|
|
73
|
-
})
|
|
75
|
+
children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsxRuntime.jsx(CollectionGlobalProvider.default, {
|
|
76
|
+
children: sectionProvider
|
|
77
|
+
}) : sectionProvider
|
|
74
78
|
}),
|
|
75
79
|
/*#__PURE__*/ jsxRuntime.jsx(Footer.default, {})
|
|
76
80
|
]
|
|
@@ -1,17 +1,42 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useShopStore } from '@gem-sdk/core';
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useShopStore, cls } from '@gem-sdk/core';
|
|
3
3
|
|
|
4
4
|
const Footer = ()=>{
|
|
5
5
|
const layoutSetting = useShopStore((s)=>s.layoutSettings);
|
|
6
|
-
if (!layoutSetting?.showFooter) return null;
|
|
7
6
|
return /*#__PURE__*/ jsx("div", {
|
|
8
|
-
className:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
className: cls('flex h-40 items-center justify-center bg-[#D6D6D6]', {
|
|
8
|
+
hidden: !layoutSetting?.showFooter
|
|
9
|
+
}),
|
|
10
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
11
|
+
className: "gp-footer children:hover:block group flex h-6 cursor-pointer items-center justify-center rounded bg-[#E2E2E2] p-1",
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ jsx("span", {
|
|
14
|
+
className: "font-xs text-[#252525]",
|
|
15
|
+
children: "Shopify theme’s footer"
|
|
16
|
+
}),
|
|
17
|
+
/*#__PURE__*/ jsxs("svg", {
|
|
18
|
+
className: "ml-[5px] w-0 group-hover:w-auto",
|
|
19
|
+
width: "16",
|
|
20
|
+
height: "16",
|
|
21
|
+
viewBox: "0 0 16 16",
|
|
22
|
+
fill: "none",
|
|
23
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24
|
+
children: [
|
|
25
|
+
/*#__PURE__*/ jsx("path", {
|
|
26
|
+
fillRule: "evenodd",
|
|
27
|
+
clipRule: "evenodd",
|
|
28
|
+
d: "M7.9996 5.08501C6.38958 5.08501 5.08441 6.39019 5.08441 8.00021C5.08441 9.61023 6.38958 10.9154 7.9996 10.9154C9.60962 10.9154 10.9148 9.61023 10.9148 8.00021C10.9148 6.39019 9.60962 5.08501 7.9996 5.08501ZM6.08441 8.00021C6.08441 6.94247 6.94187 6.08501 7.9996 6.08501C9.05734 6.08501 9.9148 6.94247 9.9148 8.00021C9.9148 9.05794 9.05734 9.9154 7.9996 9.9154C6.94187 9.9154 6.08441 9.05794 6.08441 8.00021Z",
|
|
29
|
+
fill: "#252525"
|
|
30
|
+
}),
|
|
31
|
+
/*#__PURE__*/ jsx("path", {
|
|
32
|
+
fillRule: "evenodd",
|
|
33
|
+
clipRule: "evenodd",
|
|
34
|
+
d: "M6.52326 1.00391C6.28114 1.00391 6.07381 1.17739 6.0311 1.41572L5.74126 3.03321C5.40322 3.18248 5.08321 3.36419 4.78533 3.57432L3.18532 3.00147C2.9566 2.91958 2.70211 3.01395 2.58207 3.22517L1.12196 5.79451C1.00193 6.00572 1.05109 6.27266 1.2385 6.42725L2.50062 7.46836C2.48333 7.64355 2.4745 7.82106 2.4745 8.00047C2.4745 8.17981 2.48333 8.35726 2.5006 8.53238L1.2385 9.57347C1.05109 9.72806 1.00193 9.995 1.12196 10.2062L2.58207 12.7756C2.70211 12.9868 2.9566 13.0811 3.18532 12.9993L4.78513 12.4265C5.08308 12.6367 5.40317 12.8185 5.7413 12.9678L6.0311 14.585C6.07381 14.8233 6.28114 14.9968 6.52326 14.9968H9.47623C9.71835 14.9968 9.92568 14.8233 9.96839 14.585L10.2582 12.9676C10.5963 12.8183 10.9163 12.6365 11.2141 12.4264L12.8142 12.9993C13.0429 13.0811 13.2974 12.9868 13.4174 12.7756L14.8775 10.2062C14.9976 9.995 14.9484 9.72806 14.761 9.57347L13.4985 8.5321C13.5158 8.35706 13.5246 8.17971 13.5246 8.00047C13.5246 7.82116 13.5158 7.64375 13.4985 7.46864L14.761 6.42725C14.9484 6.27266 14.9976 6.00572 14.8775 5.79451L13.4174 3.22517C13.2974 3.01395 13.0429 2.91958 12.8142 3.00147L11.2139 3.57441C10.9161 3.36433 10.5962 3.18264 10.2583 3.0334L9.96839 1.41572C9.92568 1.17739 9.71835 1.00391 9.47623 1.00391H6.52326ZM6.67723 3.47943L6.94163 2.00391H9.05786L9.32229 3.47958C9.35324 3.6523 9.47246 3.79616 9.63643 3.85863C10.0674 4.02283 10.4665 4.25007 10.8219 4.5288C10.9571 4.63483 11.1373 4.66402 11.299 4.6061L12.7556 4.08459L13.8005 5.92323L12.6501 6.8722C12.5142 6.98427 12.4473 7.15956 12.474 7.33366C12.5073 7.55089 12.5246 7.77354 12.5246 8.00047C12.5246 8.22735 12.5073 8.44993 12.474 8.66711C12.4474 8.8412 12.5142 9.01648 12.6501 9.12855L13.8005 10.0775L12.7556 11.9161L11.2992 11.3947C11.1374 11.3368 10.9573 11.366 10.8221 11.472C10.4666 11.7508 10.0675 11.9781 9.6364 12.1423C9.47242 12.2048 9.3532 12.3487 9.32225 12.5214L9.05786 13.9968H6.94163L6.67727 12.5215C6.64632 12.3488 6.52708 12.2049 6.36308 12.1425C5.9319 11.9782 5.53267 11.7509 5.17713 11.4721C5.04194 11.3661 4.86178 11.3369 4.70003 11.3948L3.24387 11.9161L2.199 10.0775L3.34904 9.12883C3.48491 9.01675 3.55179 8.84146 3.52511 8.66736C3.4918 8.4501 3.4745 8.22743 3.4745 8.00047C3.4745 7.77345 3.49181 7.55072 3.52513 7.33341C3.55183 7.15931 3.48495 6.984 3.34907 6.87192L2.199 5.92323L3.24387 4.08459L4.70022 4.60601C4.86197 4.66392 5.04212 4.63474 5.17731 4.52872C5.53279 4.24994 5.93195 4.02269 6.36304 3.85849C6.52704 3.79603 6.64628 3.65216 6.67723 3.47943Z",
|
|
35
|
+
fill: "#252525"
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
})
|
|
39
|
+
]
|
|
15
40
|
})
|
|
16
41
|
});
|
|
17
42
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { useShopStore } from '@gem-sdk/core';
|
|
2
|
+
import { useShopStore, cls } from '@gem-sdk/core';
|
|
3
3
|
|
|
4
4
|
const Header = ()=>{
|
|
5
5
|
const layoutSetting = useShopStore((s)=>s.layoutSettings);
|
|
6
|
-
if (!layoutSetting?.showHeader) return null;
|
|
7
6
|
return /*#__PURE__*/ jsx("div", {
|
|
8
|
-
className:
|
|
7
|
+
className: cls('flex h-12 items-center justify-center bg-[#D6D6D6]', {
|
|
8
|
+
hidden: !layoutSetting?.showHeader
|
|
9
|
+
}),
|
|
9
10
|
children: /*#__PURE__*/ jsxs("div", {
|
|
10
|
-
className: "gp-header
|
|
11
|
+
className: "gp-header children:hover:block group flex h-6 cursor-pointer items-center justify-center rounded bg-[#E2E2E2] p-1",
|
|
11
12
|
children: [
|
|
12
13
|
/*#__PURE__*/ jsx("span", {
|
|
13
|
-
className: "text-[#252525]
|
|
14
|
+
className: "font-xs text-[#252525] ",
|
|
14
15
|
children: "Shopify theme’s header"
|
|
15
16
|
}),
|
|
16
17
|
/*#__PURE__*/ jsxs("svg", {
|
|
17
|
-
className: "w-0 group-hover:w-auto
|
|
18
|
+
className: "ml-[5px] w-0 group-hover:w-auto",
|
|
18
19
|
width: "16",
|
|
19
20
|
height: "16",
|
|
20
21
|
viewBox: "0 0 16 16",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useCollectionsQuery } from '@gem-sdk/core';
|
|
3
|
+
import dynamic from 'next/dynamic';
|
|
4
|
+
|
|
5
|
+
const CollectionProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.CollectionProvider));
|
|
6
|
+
const CollectionGlobalProvider = ({ children })=>{
|
|
7
|
+
const { data: collections , isValidating , error } = useCollectionsQuery({
|
|
8
|
+
first: 1,
|
|
9
|
+
orderBy: {
|
|
10
|
+
direction: 'DESC',
|
|
11
|
+
field: 'UPDATED_AT'
|
|
12
|
+
},
|
|
13
|
+
where: {
|
|
14
|
+
isSample: false
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const collection = collections?.collections?.edges?.[0]?.node;
|
|
18
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
19
|
+
children: isValidating ? /*#__PURE__*/ jsx("div", {
|
|
20
|
+
children: "Loading..."
|
|
21
|
+
}) : error ? /*#__PURE__*/ jsxs("div", {
|
|
22
|
+
children: [
|
|
23
|
+
"Error: ",
|
|
24
|
+
error?.message
|
|
25
|
+
]
|
|
26
|
+
}) : !collection ? /*#__PURE__*/ jsx("div", {
|
|
27
|
+
children: "Collection not found"
|
|
28
|
+
}) : /*#__PURE__*/ jsx(CollectionProvider, {
|
|
29
|
+
collection: collection,
|
|
30
|
+
children: children
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { CollectionGlobalProvider as default };
|
|
@@ -6,8 +6,9 @@ import { useState, 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';
|
|
9
|
+
import CollectionGlobalProvider from './CollectionGlobalProvider.js';
|
|
9
10
|
|
|
10
|
-
const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData })=>{
|
|
11
|
+
const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData , pageType })=>{
|
|
11
12
|
const [loadSuccess, setLoadSuccess] = useState(false);
|
|
12
13
|
const initState = {
|
|
13
14
|
ROOT: {
|
|
@@ -20,6 +21,29 @@ const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData
|
|
|
20
21
|
useEffect(()=>{
|
|
21
22
|
setLoadSuccess(true);
|
|
22
23
|
}, []);
|
|
24
|
+
const sectionProvider = /*#__PURE__*/ jsx(SectionProvider, {
|
|
25
|
+
data: sectionData,
|
|
26
|
+
children: /*#__PURE__*/ jsxs(BuilderPreviewProvider, {
|
|
27
|
+
state: initState,
|
|
28
|
+
children: [
|
|
29
|
+
/*#__PURE__*/ jsx(Toolbox, {}),
|
|
30
|
+
loadSuccess && /*#__PURE__*/ jsxs("div", {
|
|
31
|
+
className: "builder",
|
|
32
|
+
children: [
|
|
33
|
+
/*#__PURE__*/ jsx("div", {
|
|
34
|
+
id: "storefront",
|
|
35
|
+
children: /*#__PURE__*/ jsx(RenderPreview, {
|
|
36
|
+
uid: "ROOT"
|
|
37
|
+
})
|
|
38
|
+
}),
|
|
39
|
+
/*#__PURE__*/ jsx("div", {
|
|
40
|
+
id: "visual-content"
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
}, "preview")
|
|
46
|
+
});
|
|
23
47
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
24
48
|
children: [
|
|
25
49
|
/*#__PURE__*/ jsx(NextSeo, {
|
|
@@ -46,29 +70,9 @@ const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData
|
|
|
46
70
|
/*#__PURE__*/ jsx(Header, {}),
|
|
47
71
|
/*#__PURE__*/ jsx(BuilderComponentProvider, {
|
|
48
72
|
components: components,
|
|
49
|
-
children: /*#__PURE__*/ jsx(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
state: initState,
|
|
53
|
-
children: [
|
|
54
|
-
/*#__PURE__*/ jsx(Toolbox, {}),
|
|
55
|
-
loadSuccess && /*#__PURE__*/ jsxs("div", {
|
|
56
|
-
className: "builder",
|
|
57
|
-
children: [
|
|
58
|
-
/*#__PURE__*/ jsx("div", {
|
|
59
|
-
id: "storefront",
|
|
60
|
-
children: /*#__PURE__*/ jsx(RenderPreview, {
|
|
61
|
-
uid: "ROOT"
|
|
62
|
-
})
|
|
63
|
-
}),
|
|
64
|
-
/*#__PURE__*/ jsx("div", {
|
|
65
|
-
id: "visual-content"
|
|
66
|
-
})
|
|
67
|
-
]
|
|
68
|
-
})
|
|
69
|
-
]
|
|
70
|
-
}, "preview")
|
|
71
|
-
})
|
|
73
|
+
children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsx(CollectionGlobalProvider, {
|
|
74
|
+
children: sectionProvider
|
|
75
|
+
}) : sectionProvider
|
|
72
76
|
}),
|
|
73
77
|
/*#__PURE__*/ jsx(Footer, {})
|
|
74
78
|
]
|
package/dist/types/index.d.ts
CHANGED