@gem-sdk/pages 1.8.18 → 1.8.27
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.
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var react = require('react');
|
|
6
7
|
var core = require('@gem-sdk/core');
|
|
7
8
|
var dynamic = require('next/dynamic');
|
|
8
9
|
|
|
9
10
|
const CollectionProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.CollectionProvider));
|
|
10
11
|
const CollectionGlobalProvider = ({ children })=>{
|
|
11
|
-
const
|
|
12
|
+
const [variables, setVariables] = react.useState({
|
|
12
13
|
first: 1,
|
|
13
14
|
orderBy: {
|
|
14
15
|
direction: 'DESC',
|
|
@@ -18,7 +19,28 @@ const CollectionGlobalProvider = ({ children })=>{
|
|
|
18
19
|
isSample: false
|
|
19
20
|
}
|
|
20
21
|
});
|
|
22
|
+
const { data: collections , isValidating , error } = core.useCollectionsQuery(variables);
|
|
21
23
|
const collection = collections?.collections?.edges?.[0]?.node;
|
|
24
|
+
const onChangeCollectionInfo = react.useCallback((e)=>{
|
|
25
|
+
const detail = e.detail;
|
|
26
|
+
setVariables({
|
|
27
|
+
...variables,
|
|
28
|
+
where: {
|
|
29
|
+
...variables.where,
|
|
30
|
+
baseID: detail?.baseID
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}, [
|
|
34
|
+
variables
|
|
35
|
+
]);
|
|
36
|
+
react.useEffect(()=>{
|
|
37
|
+
window.addEventListener('update-collection-info', onChangeCollectionInfo);
|
|
38
|
+
return ()=>{
|
|
39
|
+
window.removeEventListener('update-collection-info', onChangeCollectionInfo);
|
|
40
|
+
};
|
|
41
|
+
}, [
|
|
42
|
+
onChangeCollectionInfo
|
|
43
|
+
]);
|
|
22
44
|
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
23
45
|
children: isValidating ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
24
46
|
children: "Loading..."
|
|
@@ -48,36 +48,65 @@ const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData ,
|
|
|
48
48
|
})
|
|
49
49
|
]
|
|
50
50
|
}),
|
|
51
|
-
/*#__PURE__*/ jsxRuntime.
|
|
51
|
+
/*#__PURE__*/ jsxRuntime.jsxs(core.BuilderComponentProvider, {
|
|
52
52
|
components: components,
|
|
53
|
-
children:
|
|
54
|
-
|
|
53
|
+
children: [
|
|
54
|
+
/*#__PURE__*/ jsxRuntime.jsx(WrapProvider, {
|
|
55
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core.SectionProvider, {
|
|
56
|
+
data: sectionData,
|
|
57
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(core.BuilderPreviewProvider, {
|
|
58
|
+
state: initState,
|
|
59
|
+
children: [
|
|
60
|
+
/*#__PURE__*/ jsxRuntime.jsx(Toolbox.default, {}),
|
|
61
|
+
/*#__PURE__*/ jsxRuntime.jsx(PopupManager.default, {}),
|
|
62
|
+
loadSuccess && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
63
|
+
className: "builder z-1 relative",
|
|
64
|
+
children: [
|
|
65
|
+
/*#__PURE__*/ jsxRuntime.jsx(Header.default, {}),
|
|
66
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
67
|
+
id: "storefront",
|
|
68
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
|
|
69
|
+
uid: "ROOT"
|
|
70
|
+
})
|
|
71
|
+
}),
|
|
72
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
73
|
+
id: "visual-content"
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ jsxRuntime.jsx(Footer.default, {})
|
|
76
|
+
]
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
}, "preview")
|
|
80
|
+
})
|
|
81
|
+
}),
|
|
82
|
+
/*#__PURE__*/ jsxRuntime.jsx(core.SectionProvider, {
|
|
55
83
|
data: sectionData,
|
|
56
84
|
children: /*#__PURE__*/ jsxRuntime.jsxs(core.BuilderPreviewProvider, {
|
|
57
85
|
state: initState,
|
|
58
86
|
children: [
|
|
59
87
|
/*#__PURE__*/ jsxRuntime.jsx(Toolbox.default, {}),
|
|
60
|
-
/*#__PURE__*/ jsxRuntime.jsx(PopupManager.default, {}),
|
|
61
88
|
loadSuccess && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
62
|
-
className: "builder
|
|
89
|
+
className: "builder",
|
|
63
90
|
children: [
|
|
64
|
-
/*#__PURE__*/ jsxRuntime.jsx(Header.default, {}),
|
|
65
91
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
66
92
|
id: "storefront",
|
|
67
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(
|
|
93
|
+
children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsxRuntime.jsx(CollectionGlobalProvider.default, {
|
|
94
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
|
|
95
|
+
uid: "ROOT"
|
|
96
|
+
})
|
|
97
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
|
|
68
98
|
uid: "ROOT"
|
|
69
99
|
})
|
|
70
100
|
}),
|
|
71
101
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
72
102
|
id: "visual-content"
|
|
73
|
-
})
|
|
74
|
-
/*#__PURE__*/ jsxRuntime.jsx(Footer.default, {})
|
|
103
|
+
})
|
|
75
104
|
]
|
|
76
105
|
})
|
|
77
106
|
]
|
|
78
107
|
}, "preview")
|
|
79
108
|
})
|
|
80
|
-
|
|
109
|
+
]
|
|
81
110
|
})
|
|
82
111
|
]
|
|
83
112
|
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useCallback, useEffect } from 'react';
|
|
2
3
|
import { useCollectionsQuery } from '@gem-sdk/core';
|
|
3
4
|
import dynamic from 'next/dynamic';
|
|
4
5
|
|
|
5
6
|
const CollectionProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.CollectionProvider));
|
|
6
7
|
const CollectionGlobalProvider = ({ children })=>{
|
|
7
|
-
const
|
|
8
|
+
const [variables, setVariables] = useState({
|
|
8
9
|
first: 1,
|
|
9
10
|
orderBy: {
|
|
10
11
|
direction: 'DESC',
|
|
@@ -14,7 +15,28 @@ const CollectionGlobalProvider = ({ children })=>{
|
|
|
14
15
|
isSample: false
|
|
15
16
|
}
|
|
16
17
|
});
|
|
18
|
+
const { data: collections , isValidating , error } = useCollectionsQuery(variables);
|
|
17
19
|
const collection = collections?.collections?.edges?.[0]?.node;
|
|
20
|
+
const onChangeCollectionInfo = useCallback((e)=>{
|
|
21
|
+
const detail = e.detail;
|
|
22
|
+
setVariables({
|
|
23
|
+
...variables,
|
|
24
|
+
where: {
|
|
25
|
+
...variables.where,
|
|
26
|
+
baseID: detail?.baseID
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}, [
|
|
30
|
+
variables
|
|
31
|
+
]);
|
|
32
|
+
useEffect(()=>{
|
|
33
|
+
window.addEventListener('update-collection-info', onChangeCollectionInfo);
|
|
34
|
+
return ()=>{
|
|
35
|
+
window.removeEventListener('update-collection-info', onChangeCollectionInfo);
|
|
36
|
+
};
|
|
37
|
+
}, [
|
|
38
|
+
onChangeCollectionInfo
|
|
39
|
+
]);
|
|
18
40
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
19
41
|
children: isValidating ? /*#__PURE__*/ jsx("div", {
|
|
20
42
|
children: "Loading..."
|
|
@@ -46,36 +46,65 @@ const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData ,
|
|
|
46
46
|
})
|
|
47
47
|
]
|
|
48
48
|
}),
|
|
49
|
-
/*#__PURE__*/
|
|
49
|
+
/*#__PURE__*/ jsxs(BuilderComponentProvider, {
|
|
50
50
|
components: components,
|
|
51
|
-
children:
|
|
52
|
-
|
|
51
|
+
children: [
|
|
52
|
+
/*#__PURE__*/ jsx(WrapProvider, {
|
|
53
|
+
children: /*#__PURE__*/ jsx(SectionProvider, {
|
|
54
|
+
data: sectionData,
|
|
55
|
+
children: /*#__PURE__*/ jsxs(BuilderPreviewProvider, {
|
|
56
|
+
state: initState,
|
|
57
|
+
children: [
|
|
58
|
+
/*#__PURE__*/ jsx(Toolbox, {}),
|
|
59
|
+
/*#__PURE__*/ jsx(PopupManager, {}),
|
|
60
|
+
loadSuccess && /*#__PURE__*/ jsxs("div", {
|
|
61
|
+
className: "builder z-1 relative",
|
|
62
|
+
children: [
|
|
63
|
+
/*#__PURE__*/ jsx(Header, {}),
|
|
64
|
+
/*#__PURE__*/ jsx("div", {
|
|
65
|
+
id: "storefront",
|
|
66
|
+
children: /*#__PURE__*/ jsx(RenderPreview, {
|
|
67
|
+
uid: "ROOT"
|
|
68
|
+
})
|
|
69
|
+
}),
|
|
70
|
+
/*#__PURE__*/ jsx("div", {
|
|
71
|
+
id: "visual-content"
|
|
72
|
+
}),
|
|
73
|
+
/*#__PURE__*/ jsx(Footer, {})
|
|
74
|
+
]
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
}, "preview")
|
|
78
|
+
})
|
|
79
|
+
}),
|
|
80
|
+
/*#__PURE__*/ jsx(SectionProvider, {
|
|
53
81
|
data: sectionData,
|
|
54
82
|
children: /*#__PURE__*/ jsxs(BuilderPreviewProvider, {
|
|
55
83
|
state: initState,
|
|
56
84
|
children: [
|
|
57
85
|
/*#__PURE__*/ jsx(Toolbox, {}),
|
|
58
|
-
/*#__PURE__*/ jsx(PopupManager, {}),
|
|
59
86
|
loadSuccess && /*#__PURE__*/ jsxs("div", {
|
|
60
|
-
className: "builder
|
|
87
|
+
className: "builder",
|
|
61
88
|
children: [
|
|
62
|
-
/*#__PURE__*/ jsx(Header, {}),
|
|
63
89
|
/*#__PURE__*/ jsx("div", {
|
|
64
90
|
id: "storefront",
|
|
65
|
-
children: /*#__PURE__*/ jsx(
|
|
91
|
+
children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsx(CollectionGlobalProvider, {
|
|
92
|
+
children: /*#__PURE__*/ jsx(RenderPreview, {
|
|
93
|
+
uid: "ROOT"
|
|
94
|
+
})
|
|
95
|
+
}) : /*#__PURE__*/ jsx(RenderPreview, {
|
|
66
96
|
uid: "ROOT"
|
|
67
97
|
})
|
|
68
98
|
}),
|
|
69
99
|
/*#__PURE__*/ jsx("div", {
|
|
70
100
|
id: "visual-content"
|
|
71
|
-
})
|
|
72
|
-
/*#__PURE__*/ jsx(Footer, {})
|
|
101
|
+
})
|
|
73
102
|
]
|
|
74
103
|
})
|
|
75
104
|
]
|
|
76
105
|
}, "preview")
|
|
77
106
|
})
|
|
78
|
-
|
|
107
|
+
]
|
|
79
108
|
})
|
|
80
109
|
]
|
|
81
110
|
});
|