@gem-sdk/pages 1.8.18 → 1.8.30
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..."
|
|
@@ -64,7 +64,11 @@ const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData ,
|
|
|
64
64
|
/*#__PURE__*/ jsxRuntime.jsx(Header.default, {}),
|
|
65
65
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
66
66
|
id: "storefront",
|
|
67
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(
|
|
67
|
+
children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsxRuntime.jsx(CollectionGlobalProvider.default, {
|
|
68
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
|
|
69
|
+
uid: "ROOT"
|
|
70
|
+
})
|
|
71
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
|
|
68
72
|
uid: "ROOT"
|
|
69
73
|
})
|
|
70
74
|
}),
|
|
@@ -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..."
|
|
@@ -62,7 +62,11 @@ const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData ,
|
|
|
62
62
|
/*#__PURE__*/ jsx(Header, {}),
|
|
63
63
|
/*#__PURE__*/ jsx("div", {
|
|
64
64
|
id: "storefront",
|
|
65
|
-
children: /*#__PURE__*/ jsx(
|
|
65
|
+
children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsx(CollectionGlobalProvider, {
|
|
66
|
+
children: /*#__PURE__*/ jsx(RenderPreview, {
|
|
67
|
+
uid: "ROOT"
|
|
68
|
+
})
|
|
69
|
+
}) : /*#__PURE__*/ jsx(RenderPreview, {
|
|
66
70
|
uid: "ROOT"
|
|
67
71
|
})
|
|
68
72
|
}),
|