@gem-sdk/pages 1.13.38 → 1.13.42
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/ErrorBoundary.js +1 -1
- package/dist/cjs/components/ErrorFallback.js +1 -1
- package/dist/cjs/components/FacebookPixel.js +1 -1
- package/dist/cjs/components/GoogleAnalytic.js +1 -1
- package/dist/cjs/components/TikTokPixel.js +1 -1
- package/dist/cjs/components/builder/PopupManager.js +3 -7
- package/dist/cjs/components/image-to-layout/AddSectionImageToLayout.js +1 -1
- package/dist/cjs/components/image-to-layout/ImageToLayout.js +1 -1
- package/dist/cjs/components/image-to-layout/ImageToLayoutInput.js +1 -1
- package/dist/cjs/components/image-to-layout/PagesSuggestion.js +1 -1
- package/dist/cjs/layouts/main.js +1 -1
- package/dist/cjs/libs/api/get-collection-props.js +3 -3
- package/dist/cjs/libs/api/get-home-page-props.js +2 -2
- package/dist/cjs/libs/api/get-product-props.js +2 -2
- package/dist/cjs/libs/api/get-static-page-props.js +2 -2
- package/dist/cjs/libs/helpers/get-fallback.js +2 -2
- package/dist/cjs/libs/helpers/normalize.js +1 -1
- package/dist/cjs/pages/CollectionGlobalProvider.js +2 -2
- package/dist/cjs/pages/builder.js +1 -1
- package/dist/cjs/pages/collection-detail.js +1 -1
- package/dist/cjs/pages/preview.js +1 -1
- package/dist/cjs/pages/product-detail.js +1 -1
- package/dist/cjs/pages/static-v2.js +1 -1
- package/dist/cjs/pages/static.js +1 -1
- package/dist/esm/components/ErrorBoundary.js +1 -1
- package/dist/esm/components/ErrorFallback.js +1 -1
- package/dist/esm/components/FacebookPixel.js +1 -1
- package/dist/esm/components/GoogleAnalytic.js +1 -1
- package/dist/esm/components/TikTokPixel.js +1 -1
- package/dist/esm/components/builder/PopupManager.js +4 -8
- package/dist/esm/components/image-to-layout/AddSectionImageToLayout.js +1 -1
- package/dist/esm/components/image-to-layout/ImageToLayout.js +1 -1
- package/dist/esm/components/image-to-layout/ImageToLayoutInput.js +1 -1
- package/dist/esm/components/image-to-layout/PagesSuggestion.js +1 -1
- package/dist/esm/layouts/main.js +1 -1
- package/dist/esm/libs/api/get-collection-props.js +3 -3
- package/dist/esm/libs/api/get-home-page-props.js +2 -2
- package/dist/esm/libs/api/get-product-props.js +2 -2
- package/dist/esm/libs/api/get-static-page-props.js +2 -2
- package/dist/esm/libs/helpers/get-fallback.js +2 -2
- package/dist/esm/libs/helpers/normalize.js +1 -1
- package/dist/esm/pages/CollectionGlobalProvider.js +2 -2
- package/dist/esm/pages/builder.js +1 -1
- package/dist/esm/pages/collection-detail.js +1 -1
- package/dist/esm/pages/preview.js +1 -1
- package/dist/esm/pages/product-detail.js +1 -1
- package/dist/esm/pages/static-v2.js +1 -1
- package/dist/esm/pages/static.js +1 -1
- package/dist/types/index.d.ts +9 -8
- package/package.json +3 -3
|
@@ -23,7 +23,7 @@ class ErrorBoundary extends react.Component {
|
|
|
23
23
|
this.props.onError?.(error, errorInfo);
|
|
24
24
|
}
|
|
25
25
|
render() {
|
|
26
|
-
const { FallbackComponent
|
|
26
|
+
const { FallbackComponent } = this.props;
|
|
27
27
|
// Check if the error is thrown
|
|
28
28
|
if (this.state.hasError) {
|
|
29
29
|
// You can render any custom fallback UI
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
|
|
5
|
-
const ErrorFallback = ({ error
|
|
5
|
+
const ErrorFallback = ({ error, resetErrorBoundary })=>{
|
|
6
6
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
7
7
|
role: "alert",
|
|
8
8
|
className: "flex flex-col items-center gap-2",
|
|
@@ -6,7 +6,7 @@ var router = require('next/router');
|
|
|
6
6
|
var Script = require('next/script');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
|
|
9
|
-
const FacebookPixel = ({ pixelId
|
|
9
|
+
const FacebookPixel = ({ pixelId })=>{
|
|
10
10
|
const router$1 = router.useRouter();
|
|
11
11
|
react.useEffect(()=>{
|
|
12
12
|
const handleRouteChange = ()=>{
|
|
@@ -6,7 +6,7 @@ var router = require('next/router');
|
|
|
6
6
|
var Script = require('next/script');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
|
|
9
|
-
const GoogleAnalytic = ({ trackingId
|
|
9
|
+
const GoogleAnalytic = ({ trackingId })=>{
|
|
10
10
|
const router$1 = router.useRouter();
|
|
11
11
|
react.useEffect(()=>{
|
|
12
12
|
const handleRouteChange = (url)=>{
|
|
@@ -34,7 +34,7 @@ const PopupManager = ()=>{
|
|
|
34
34
|
]);
|
|
35
35
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
36
36
|
className: "pointer-events-none fixed inset-y-0 right-0 z-10 flex w-10 flex-col items-center justify-center gap-1 overflow-y-auto overflow-x-hidden text-sm",
|
|
37
|
-
children: popups?.map((item
|
|
37
|
+
children: popups?.map((item)=>{
|
|
38
38
|
const display = item?.advanced?.d;
|
|
39
39
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
40
40
|
className: core.cls('pointer-events-auto w-full shrink cursor-pointer select-none items-center justify-center whitespace-nowrap py-2 text-white [writing-mode:vertical-lr]', {
|
|
@@ -49,13 +49,9 @@ const PopupManager = ()=>{
|
|
|
49
49
|
'--d-tablet': display?.tablet ? 'inline-flex' : 'none',
|
|
50
50
|
'--d-mobile': display?.mobile ? 'inline-flex' : 'none'
|
|
51
51
|
},
|
|
52
|
-
children: /*#__PURE__*/ jsxRuntime.
|
|
52
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
53
53
|
className: "text-ellipsis whitespace-nowrap",
|
|
54
|
-
children:
|
|
55
|
-
item?.settings?.name || 'Popup Name',
|
|
56
|
-
" ",
|
|
57
|
-
index + 1
|
|
58
|
-
]
|
|
54
|
+
children: item?.settings?.name || 'Popup Name'
|
|
59
55
|
})
|
|
60
56
|
}, item?.uid);
|
|
61
57
|
})
|
|
@@ -32,7 +32,7 @@ const defaultPadding = {
|
|
|
32
32
|
tablet: 'var(--g-ct-p)',
|
|
33
33
|
mobile: 'var(--g-ct-p)'
|
|
34
34
|
};
|
|
35
|
-
const AddSectionImageToLayout = ({ editorImageToLayout
|
|
35
|
+
const AddSectionImageToLayout = ({ editorImageToLayout })=>{
|
|
36
36
|
const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
|
|
37
37
|
const totalSection = core.useBuilderPreviewStore((state)=>state.state.ROOT.childrens?.length);
|
|
38
38
|
const [link, setLink] = react.useState('');
|
|
@@ -10,7 +10,7 @@ var ImageToLayoutInput = require('./ImageToLayoutInput.js');
|
|
|
10
10
|
|
|
11
11
|
const HEADER_HEIGHT = 40;
|
|
12
12
|
const FOOTER_HEIGHT = 50;
|
|
13
|
-
const ImageToLayout = ({ editorImageToLayout
|
|
13
|
+
const ImageToLayout = ({ editorImageToLayout })=>{
|
|
14
14
|
const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
|
|
15
15
|
const totalSection = core.useBuilderPreviewStore((state)=>state.state.ROOT.childrens?.length);
|
|
16
16
|
const loaded = core.useBuilderPreviewStore((state)=>state.loaded);
|
|
@@ -4,7 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var PagesSuggestion = require('./PagesSuggestion.js');
|
|
6
6
|
|
|
7
|
-
const ImageToLayoutInput = ({ totalSection
|
|
7
|
+
const ImageToLayoutInput = ({ totalSection })=>{
|
|
8
8
|
const [link, setLink] = react.useState('');
|
|
9
9
|
const [isFocus, setIsFocus] = react.useState(false);
|
|
10
10
|
const [openSuggestion, setOpenSuggestion] = react.useState(false);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
|
|
5
|
-
const PagesSuggestion = ({ isOpen
|
|
5
|
+
const PagesSuggestion = ({ isOpen, setOpenSuggestion, setUrl })=>{
|
|
6
6
|
const pages = [
|
|
7
7
|
'https://seal-commerce-asia.myshopify.com/pages/image-to-layout-demo-page'
|
|
8
8
|
];
|
package/dist/cjs/layouts/main.js
CHANGED
|
@@ -6,7 +6,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var core = require('@gem-sdk/core');
|
|
7
7
|
var parseHtml = require('../libs/parse-html.js');
|
|
8
8
|
|
|
9
|
-
const MainLayout = ({ children
|
|
9
|
+
const MainLayout = ({ children, ...props })=>{
|
|
10
10
|
const mobileOnly = core.useShopStore((s)=>s.mobileOnly);
|
|
11
11
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
12
12
|
children: [
|
|
@@ -28,9 +28,9 @@ const getCollectionProps = (fetcher)=>async (handle)=>{
|
|
|
28
28
|
if (!collectionData || !collectionData?.collection || !dataBuilder) {
|
|
29
29
|
throw new Error('Collection not found');
|
|
30
30
|
}
|
|
31
|
-
const { collection
|
|
31
|
+
const { collection } = collectionData;
|
|
32
32
|
const queries = core.prefetchQueries(collectionTemplate);
|
|
33
|
-
const datas = await Promise.allSettled(queries.map(({ query
|
|
33
|
+
const datas = await Promise.allSettled(queries.map(({ query, variables, func })=>{
|
|
34
34
|
if (func) {
|
|
35
35
|
return func(fetcher, variables);
|
|
36
36
|
}
|
|
@@ -40,7 +40,7 @@ const getCollectionProps = (fetcher)=>async (handle)=>{
|
|
|
40
40
|
]);
|
|
41
41
|
return {};
|
|
42
42
|
}));
|
|
43
|
-
const fallback = queries.reduce((acc, { key
|
|
43
|
+
const fallback = queries.reduce((acc, { key }, index)=>{
|
|
44
44
|
const res = datas[index];
|
|
45
45
|
if (res?.status === 'fulfilled') {
|
|
46
46
|
return {
|
|
@@ -38,7 +38,7 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
38
38
|
const homeTemplate = normalize.parseBuilderTemplate(dataBuilder);
|
|
39
39
|
const fontStyle = await googleFonts.getFontFromGlobalStyle(dataBuilder?.pageStyle?.data);
|
|
40
40
|
const queries = core.prefetchQueries(homeTemplate);
|
|
41
|
-
const datas = await Promise.allSettled(queries.map(({ query
|
|
41
|
+
const datas = await Promise.allSettled(queries.map(({ query, variables, func })=>{
|
|
42
42
|
if (func) {
|
|
43
43
|
return func(fetcher, variables);
|
|
44
44
|
}
|
|
@@ -48,7 +48,7 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
48
48
|
]);
|
|
49
49
|
return {};
|
|
50
50
|
}));
|
|
51
|
-
const fallback = queries.reduce((acc, { key
|
|
51
|
+
const fallback = queries.reduce((acc, { key }, index)=>{
|
|
52
52
|
const res = datas[index];
|
|
53
53
|
if (res?.status === 'fulfilled') {
|
|
54
54
|
return {
|
|
@@ -24,7 +24,7 @@ const getProductProps = (fetcher)=>async (handle)=>{
|
|
|
24
24
|
}
|
|
25
25
|
const productTemplate = normalize.parseBuilderTemplate(dataBuilder);
|
|
26
26
|
const queries = core.prefetchQueries(productTemplate);
|
|
27
|
-
const datas = await Promise.allSettled(queries.map(({ query
|
|
27
|
+
const datas = await Promise.allSettled(queries.map(({ query, variables, func })=>{
|
|
28
28
|
if (func) {
|
|
29
29
|
return func(fetcher, variables);
|
|
30
30
|
}
|
|
@@ -34,7 +34,7 @@ const getProductProps = (fetcher)=>async (handle)=>{
|
|
|
34
34
|
]);
|
|
35
35
|
return {};
|
|
36
36
|
}));
|
|
37
|
-
const fallback = queries.reduce((acc, { key
|
|
37
|
+
const fallback = queries.reduce((acc, { key }, index)=>{
|
|
38
38
|
const res = datas[index];
|
|
39
39
|
if (res?.status === 'fulfilled') {
|
|
40
40
|
return {
|
|
@@ -35,7 +35,7 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
35
35
|
const pageTemplate = normalize.parseBuilderTemplate(dataBuilder);
|
|
36
36
|
const fontStyle = await googleFonts.getFontFromGlobalStyle(dataBuilder?.pageStyle?.data);
|
|
37
37
|
const queries = core.prefetchQueries(pageTemplate);
|
|
38
|
-
const datas = await Promise.allSettled(queries.map(({ query
|
|
38
|
+
const datas = await Promise.allSettled(queries.map(({ query, variables, func })=>{
|
|
39
39
|
if (func) {
|
|
40
40
|
return func(fetcher, variables);
|
|
41
41
|
}
|
|
@@ -45,7 +45,7 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
45
45
|
]);
|
|
46
46
|
return {};
|
|
47
47
|
}));
|
|
48
|
-
const fallback = queries.reduce((acc, { key
|
|
48
|
+
const fallback = queries.reduce((acc, { key }, index)=>{
|
|
49
49
|
const res = datas[index];
|
|
50
50
|
if (res?.status === 'fulfilled') {
|
|
51
51
|
return {
|
|
@@ -9,7 +9,7 @@ const getFallbackV2 = async (fetcher, data)=>{
|
|
|
9
9
|
isSample,
|
|
10
10
|
isStorefront
|
|
11
11
|
})).flat();
|
|
12
|
-
const datas = await Promise.allSettled(queries.map(({ query
|
|
12
|
+
const datas = await Promise.allSettled(queries.map(({ query, variables, func })=>{
|
|
13
13
|
if (func) {
|
|
14
14
|
return func(fetcher, variables);
|
|
15
15
|
}
|
|
@@ -19,7 +19,7 @@ const getFallbackV2 = async (fetcher, data)=>{
|
|
|
19
19
|
]);
|
|
20
20
|
return {};
|
|
21
21
|
}));
|
|
22
|
-
const fallback = queries.reduce((acc, { key
|
|
22
|
+
const fallback = queries.reduce((acc, { key }, index)=>{
|
|
23
23
|
const res = datas[index];
|
|
24
24
|
if (res?.status === 'fulfilled') {
|
|
25
25
|
return {
|
|
@@ -4,7 +4,7 @@ const normalizeBuilderData = (data)=>{
|
|
|
4
4
|
const result = {};
|
|
5
5
|
function compose(cData, currData = {}) {
|
|
6
6
|
if (cData) {
|
|
7
|
-
const { childrens
|
|
7
|
+
const { childrens, dateModified, editorConfigs, ...rest } = cData;
|
|
8
8
|
if (rest.type === 'section') {
|
|
9
9
|
currData[rest.uid] = rest;
|
|
10
10
|
} else {
|
|
@@ -8,7 +8,7 @@ var core = require('@gem-sdk/core');
|
|
|
8
8
|
var dynamic = require('next/dynamic');
|
|
9
9
|
|
|
10
10
|
const CollectionProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.CollectionProvider));
|
|
11
|
-
const CollectionGlobalProvider = ({ children
|
|
11
|
+
const CollectionGlobalProvider = ({ children })=>{
|
|
12
12
|
const [variables, setVariables] = react.useState({
|
|
13
13
|
first: 1,
|
|
14
14
|
orderBy: {
|
|
@@ -19,7 +19,7 @@ const CollectionGlobalProvider = ({ children })=>{
|
|
|
19
19
|
isSample: false
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
const { data: collections
|
|
22
|
+
const { data: collections, isLoading, error } = core.useCollectionsQuery(variables);
|
|
23
23
|
const collection = collections?.collections?.edges?.[0]?.node;
|
|
24
24
|
const onChangeCollectionInfo = react.useCallback((e)=>{
|
|
25
25
|
const detail = e.detail;
|
|
@@ -13,7 +13,7 @@ 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
15
|
|
|
16
|
-
const BuilderPage = ({ components
|
|
16
|
+
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout })=>{
|
|
17
17
|
const [loadSuccess, setLoadSuccess] = react.useState(false);
|
|
18
18
|
const initState = react.useMemo(()=>({
|
|
19
19
|
ROOT: {
|
|
@@ -10,7 +10,7 @@ var Head = require('next/head');
|
|
|
10
10
|
var router = require('next/router');
|
|
11
11
|
|
|
12
12
|
const CollectionProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.CollectionProvider));
|
|
13
|
-
const CollectionDetailPage = ({ seo
|
|
13
|
+
const CollectionDetailPage = ({ seo, components, builderData, sectionData, themeStyle, collection, fontStyle })=>{
|
|
14
14
|
const router$1 = router.useRouter();
|
|
15
15
|
if (router$1.isFallback) {
|
|
16
16
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -6,7 +6,7 @@ var dynamic = require('next/dynamic');
|
|
|
6
6
|
const StaticPage = dynamic(()=>Promise.resolve().then(function () { return require('./static.js'); }));
|
|
7
7
|
const ProductPage = dynamic(()=>Promise.resolve().then(function () { return require('./product-detail.js'); }));
|
|
8
8
|
const CollectionPage = dynamic(()=>Promise.resolve().then(function () { return require('./collection-detail.js'); }));
|
|
9
|
-
const PreviewPage = ({ pageType
|
|
9
|
+
const PreviewPage = ({ pageType, ...props })=>{
|
|
10
10
|
switch(pageType){
|
|
11
11
|
case 'PRODUCT':
|
|
12
12
|
return /*#__PURE__*/ jsxRuntime.jsx(ProductPage, {
|
|
@@ -10,7 +10,7 @@ var Head = require('next/head');
|
|
|
10
10
|
var router = require('next/router');
|
|
11
11
|
|
|
12
12
|
const ProductProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.ProductProvider));
|
|
13
|
-
const ProductDetailPage = ({ themeStyle
|
|
13
|
+
const ProductDetailPage = ({ themeStyle, fontStyle, seo, product, components, builderData, sectionData })=>{
|
|
14
14
|
const router$1 = router.useRouter();
|
|
15
15
|
if (router$1.isFallback) {
|
|
16
16
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -8,7 +8,7 @@ var router = require('next/router');
|
|
|
8
8
|
var useTrackingView = require('../libs/hooks/use-tracking-view.js');
|
|
9
9
|
var parseHtml = require('../libs/parse-html.js');
|
|
10
10
|
|
|
11
|
-
const StaticPageV2 = ({ components
|
|
11
|
+
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle })=>{
|
|
12
12
|
const router$1 = router.useRouter();
|
|
13
13
|
useTrackingView.useTrackingView(shopToken, pageHandle, router$1.isFallback);
|
|
14
14
|
if (router$1.isFallback) {
|
package/dist/cjs/pages/static.js
CHANGED
|
@@ -8,7 +8,7 @@ var nextSeo = require('next-seo');
|
|
|
8
8
|
var Head = require('next/head');
|
|
9
9
|
var router = require('next/router');
|
|
10
10
|
|
|
11
|
-
const StaticPage = ({ components
|
|
11
|
+
const StaticPage = ({ components, builderData, sectionData, seo, themeStyle, fontStyle })=>{
|
|
12
12
|
const router$1 = router.useRouter();
|
|
13
13
|
if (router$1.isFallback) {
|
|
14
14
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -21,7 +21,7 @@ class ErrorBoundary extends Component {
|
|
|
21
21
|
this.props.onError?.(error, errorInfo);
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
|
-
const { FallbackComponent
|
|
24
|
+
const { FallbackComponent } = this.props;
|
|
25
25
|
// Check if the error is thrown
|
|
26
26
|
if (this.state.hasError) {
|
|
27
27
|
// You can render any custom fallback UI
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
const ErrorFallback = ({ error
|
|
3
|
+
const ErrorFallback = ({ error, resetErrorBoundary })=>{
|
|
4
4
|
return /*#__PURE__*/ jsxs("div", {
|
|
5
5
|
role: "alert",
|
|
6
6
|
className: "flex flex-col items-center gap-2",
|
|
@@ -4,7 +4,7 @@ import { useRouter } from 'next/router';
|
|
|
4
4
|
import Script from 'next/script';
|
|
5
5
|
import { useEffect } from 'react';
|
|
6
6
|
|
|
7
|
-
const FacebookPixel = ({ pixelId
|
|
7
|
+
const FacebookPixel = ({ pixelId })=>{
|
|
8
8
|
const router = useRouter();
|
|
9
9
|
useEffect(()=>{
|
|
10
10
|
const handleRouteChange = ()=>{
|
|
@@ -4,7 +4,7 @@ import { useRouter } from 'next/router';
|
|
|
4
4
|
import Script from 'next/script';
|
|
5
5
|
import { useEffect } from 'react';
|
|
6
6
|
|
|
7
|
-
const GoogleAnalytic = ({ trackingId
|
|
7
|
+
const GoogleAnalytic = ({ trackingId })=>{
|
|
8
8
|
const router = useRouter();
|
|
9
9
|
useEffect(()=>{
|
|
10
10
|
const handleRouteChange = (url)=>{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useBuilderPreviewStore, useModalStore, cls } from '@gem-sdk/core';
|
|
3
3
|
import { memo, useMemo, useCallback, useEffect } from 'react';
|
|
4
4
|
|
|
@@ -30,7 +30,7 @@ const PopupManager = ()=>{
|
|
|
30
30
|
]);
|
|
31
31
|
return /*#__PURE__*/ jsx("div", {
|
|
32
32
|
className: "pointer-events-none fixed inset-y-0 right-0 z-10 flex w-10 flex-col items-center justify-center gap-1 overflow-y-auto overflow-x-hidden text-sm",
|
|
33
|
-
children: popups?.map((item
|
|
33
|
+
children: popups?.map((item)=>{
|
|
34
34
|
const display = item?.advanced?.d;
|
|
35
35
|
return /*#__PURE__*/ jsx("div", {
|
|
36
36
|
className: cls('pointer-events-auto w-full shrink cursor-pointer select-none items-center justify-center whitespace-nowrap py-2 text-white [writing-mode:vertical-lr]', {
|
|
@@ -45,13 +45,9 @@ const PopupManager = ()=>{
|
|
|
45
45
|
'--d-tablet': display?.tablet ? 'inline-flex' : 'none',
|
|
46
46
|
'--d-mobile': display?.mobile ? 'inline-flex' : 'none'
|
|
47
47
|
},
|
|
48
|
-
children: /*#__PURE__*/
|
|
48
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
49
49
|
className: "text-ellipsis whitespace-nowrap",
|
|
50
|
-
children:
|
|
51
|
-
item?.settings?.name || 'Popup Name',
|
|
52
|
-
" ",
|
|
53
|
-
index + 1
|
|
54
|
-
]
|
|
50
|
+
children: item?.settings?.name || 'Popup Name'
|
|
55
51
|
})
|
|
56
52
|
}, item?.uid);
|
|
57
53
|
})
|
|
@@ -28,7 +28,7 @@ const defaultPadding = {
|
|
|
28
28
|
tablet: 'var(--g-ct-p)',
|
|
29
29
|
mobile: 'var(--g-ct-p)'
|
|
30
30
|
};
|
|
31
|
-
const AddSectionImageToLayout = ({ editorImageToLayout
|
|
31
|
+
const AddSectionImageToLayout = ({ editorImageToLayout })=>{
|
|
32
32
|
const layoutSetting = useShopStore((s)=>s.layoutSettings);
|
|
33
33
|
const totalSection = useBuilderPreviewStore((state)=>state.state.ROOT.childrens?.length);
|
|
34
34
|
const [link, setLink] = useState('');
|
|
@@ -6,7 +6,7 @@ import { ImageToLayoutInput } from './ImageToLayoutInput.js';
|
|
|
6
6
|
|
|
7
7
|
const HEADER_HEIGHT = 40;
|
|
8
8
|
const FOOTER_HEIGHT = 50;
|
|
9
|
-
const ImageToLayout = ({ editorImageToLayout
|
|
9
|
+
const ImageToLayout = ({ editorImageToLayout })=>{
|
|
10
10
|
const layoutSetting = useShopStore((s)=>s.layoutSettings);
|
|
11
11
|
const totalSection = useBuilderPreviewStore((state)=>state.state.ROOT.childrens?.length);
|
|
12
12
|
const loaded = useBuilderPreviewStore((state)=>state.loaded);
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
3
|
import { PagesSuggestion } from './PagesSuggestion.js';
|
|
4
4
|
|
|
5
|
-
const ImageToLayoutInput = ({ totalSection
|
|
5
|
+
const ImageToLayoutInput = ({ totalSection })=>{
|
|
6
6
|
const [link, setLink] = useState('');
|
|
7
7
|
const [isFocus, setIsFocus] = useState(false);
|
|
8
8
|
const [openSuggestion, setOpenSuggestion] = useState(false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
-
const PagesSuggestion = ({ isOpen
|
|
3
|
+
const PagesSuggestion = ({ isOpen, setOpenSuggestion, setUrl })=>{
|
|
4
4
|
const pages = [
|
|
5
5
|
'https://seal-commerce-asia.myshopify.com/pages/image-to-layout-demo-page'
|
|
6
6
|
];
|
package/dist/esm/layouts/main.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useShopStore, cls, AddOn } from '@gem-sdk/core';
|
|
3
3
|
import { parseHtml } from '../libs/parse-html.js';
|
|
4
4
|
|
|
5
|
-
const MainLayout = ({ children
|
|
5
|
+
const MainLayout = ({ children, ...props })=>{
|
|
6
6
|
const mobileOnly = useShopStore((s)=>s.mobileOnly);
|
|
7
7
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
8
8
|
children: [
|
|
@@ -26,9 +26,9 @@ const getCollectionProps = (fetcher)=>async (handle)=>{
|
|
|
26
26
|
if (!collectionData || !collectionData?.collection || !dataBuilder) {
|
|
27
27
|
throw new Error('Collection not found');
|
|
28
28
|
}
|
|
29
|
-
const { collection
|
|
29
|
+
const { collection } = collectionData;
|
|
30
30
|
const queries = prefetchQueries(collectionTemplate);
|
|
31
|
-
const datas = await Promise.allSettled(queries.map(({ query
|
|
31
|
+
const datas = await Promise.allSettled(queries.map(({ query, variables, func })=>{
|
|
32
32
|
if (func) {
|
|
33
33
|
return func(fetcher, variables);
|
|
34
34
|
}
|
|
@@ -38,7 +38,7 @@ const getCollectionProps = (fetcher)=>async (handle)=>{
|
|
|
38
38
|
]);
|
|
39
39
|
return {};
|
|
40
40
|
}));
|
|
41
|
-
const fallback = queries.reduce((acc, { key
|
|
41
|
+
const fallback = queries.reduce((acc, { key }, index)=>{
|
|
42
42
|
const res = datas[index];
|
|
43
43
|
if (res?.status === 'fulfilled') {
|
|
44
44
|
return {
|
|
@@ -36,7 +36,7 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
36
36
|
const homeTemplate = parseBuilderTemplate(dataBuilder);
|
|
37
37
|
const fontStyle = await getFontFromGlobalStyle(dataBuilder?.pageStyle?.data);
|
|
38
38
|
const queries = prefetchQueries(homeTemplate);
|
|
39
|
-
const datas = await Promise.allSettled(queries.map(({ query
|
|
39
|
+
const datas = await Promise.allSettled(queries.map(({ query, variables, func })=>{
|
|
40
40
|
if (func) {
|
|
41
41
|
return func(fetcher, variables);
|
|
42
42
|
}
|
|
@@ -46,7 +46,7 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
46
46
|
]);
|
|
47
47
|
return {};
|
|
48
48
|
}));
|
|
49
|
-
const fallback = queries.reduce((acc, { key
|
|
49
|
+
const fallback = queries.reduce((acc, { key }, index)=>{
|
|
50
50
|
const res = datas[index];
|
|
51
51
|
if (res?.status === 'fulfilled') {
|
|
52
52
|
return {
|
|
@@ -22,7 +22,7 @@ const getProductProps = (fetcher)=>async (handle)=>{
|
|
|
22
22
|
}
|
|
23
23
|
const productTemplate = parseBuilderTemplate(dataBuilder);
|
|
24
24
|
const queries = prefetchQueries(productTemplate);
|
|
25
|
-
const datas = await Promise.allSettled(queries.map(({ query
|
|
25
|
+
const datas = await Promise.allSettled(queries.map(({ query, variables, func })=>{
|
|
26
26
|
if (func) {
|
|
27
27
|
return func(fetcher, variables);
|
|
28
28
|
}
|
|
@@ -32,7 +32,7 @@ const getProductProps = (fetcher)=>async (handle)=>{
|
|
|
32
32
|
]);
|
|
33
33
|
return {};
|
|
34
34
|
}));
|
|
35
|
-
const fallback = queries.reduce((acc, { key
|
|
35
|
+
const fallback = queries.reduce((acc, { key }, index)=>{
|
|
36
36
|
const res = datas[index];
|
|
37
37
|
if (res?.status === 'fulfilled') {
|
|
38
38
|
return {
|
|
@@ -33,7 +33,7 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
33
33
|
const pageTemplate = parseBuilderTemplate(dataBuilder);
|
|
34
34
|
const fontStyle = await getFontFromGlobalStyle(dataBuilder?.pageStyle?.data);
|
|
35
35
|
const queries = prefetchQueries(pageTemplate);
|
|
36
|
-
const datas = await Promise.allSettled(queries.map(({ query
|
|
36
|
+
const datas = await Promise.allSettled(queries.map(({ query, variables, func })=>{
|
|
37
37
|
if (func) {
|
|
38
38
|
return func(fetcher, variables);
|
|
39
39
|
}
|
|
@@ -43,7 +43,7 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
43
43
|
]);
|
|
44
44
|
return {};
|
|
45
45
|
}));
|
|
46
|
-
const fallback = queries.reduce((acc, { key
|
|
46
|
+
const fallback = queries.reduce((acc, { key }, index)=>{
|
|
47
47
|
const res = datas[index];
|
|
48
48
|
if (res?.status === 'fulfilled') {
|
|
49
49
|
return {
|
|
@@ -7,7 +7,7 @@ const getFallbackV2 = async (fetcher, data)=>{
|
|
|
7
7
|
isSample,
|
|
8
8
|
isStorefront
|
|
9
9
|
})).flat();
|
|
10
|
-
const datas = await Promise.allSettled(queries.map(({ query
|
|
10
|
+
const datas = await Promise.allSettled(queries.map(({ query, variables, func })=>{
|
|
11
11
|
if (func) {
|
|
12
12
|
return func(fetcher, variables);
|
|
13
13
|
}
|
|
@@ -17,7 +17,7 @@ const getFallbackV2 = async (fetcher, data)=>{
|
|
|
17
17
|
]);
|
|
18
18
|
return {};
|
|
19
19
|
}));
|
|
20
|
-
const fallback = queries.reduce((acc, { key
|
|
20
|
+
const fallback = queries.reduce((acc, { key }, index)=>{
|
|
21
21
|
const res = datas[index];
|
|
22
22
|
if (res?.status === 'fulfilled') {
|
|
23
23
|
return {
|
|
@@ -2,7 +2,7 @@ const normalizeBuilderData = (data)=>{
|
|
|
2
2
|
const result = {};
|
|
3
3
|
function compose(cData, currData = {}) {
|
|
4
4
|
if (cData) {
|
|
5
|
-
const { childrens
|
|
5
|
+
const { childrens, dateModified, editorConfigs, ...rest } = cData;
|
|
6
6
|
if (rest.type === 'section') {
|
|
7
7
|
currData[rest.uid] = rest;
|
|
8
8
|
} else {
|
|
@@ -4,7 +4,7 @@ import { useCollectionsQuery } from '@gem-sdk/core';
|
|
|
4
4
|
import dynamic from 'next/dynamic';
|
|
5
5
|
|
|
6
6
|
const CollectionProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.CollectionProvider));
|
|
7
|
-
const CollectionGlobalProvider = ({ children
|
|
7
|
+
const CollectionGlobalProvider = ({ children })=>{
|
|
8
8
|
const [variables, setVariables] = useState({
|
|
9
9
|
first: 1,
|
|
10
10
|
orderBy: {
|
|
@@ -15,7 +15,7 @@ const CollectionGlobalProvider = ({ children })=>{
|
|
|
15
15
|
isSample: false
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
const { data: collections
|
|
18
|
+
const { data: collections, isLoading, error } = useCollectionsQuery(variables);
|
|
19
19
|
const collection = collections?.collections?.edges?.[0]?.node;
|
|
20
20
|
const onChangeCollectionInfo = useCallback((e)=>{
|
|
21
21
|
const detail = e.detail;
|
|
@@ -11,7 +11,7 @@ import PopupManager from '../components/builder/PopupManager.js';
|
|
|
11
11
|
import ImageToLayout from '../components/image-to-layout/ImageToLayout.js';
|
|
12
12
|
import AddSectionImageToLayout from '../components/image-to-layout/AddSectionImageToLayout.js';
|
|
13
13
|
|
|
14
|
-
const BuilderPage = ({ components
|
|
14
|
+
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout })=>{
|
|
15
15
|
const [loadSuccess, setLoadSuccess] = useState(false);
|
|
16
16
|
const initState = useMemo(()=>({
|
|
17
17
|
ROOT: {
|
|
@@ -6,7 +6,7 @@ import Head from 'next/head';
|
|
|
6
6
|
import { useRouter } from 'next/router';
|
|
7
7
|
|
|
8
8
|
const CollectionProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.CollectionProvider));
|
|
9
|
-
const CollectionDetailPage = ({ seo
|
|
9
|
+
const CollectionDetailPage = ({ seo, components, builderData, sectionData, themeStyle, collection, fontStyle })=>{
|
|
10
10
|
const router = useRouter();
|
|
11
11
|
if (router.isFallback) {
|
|
12
12
|
return /*#__PURE__*/ jsx("div", {
|
|
@@ -4,7 +4,7 @@ import dynamic from 'next/dynamic';
|
|
|
4
4
|
const StaticPage = dynamic(()=>import('./static.js'));
|
|
5
5
|
const ProductPage = dynamic(()=>import('./product-detail.js'));
|
|
6
6
|
const CollectionPage = dynamic(()=>import('./collection-detail.js'));
|
|
7
|
-
const PreviewPage = ({ pageType
|
|
7
|
+
const PreviewPage = ({ pageType, ...props })=>{
|
|
8
8
|
switch(pageType){
|
|
9
9
|
case 'PRODUCT':
|
|
10
10
|
return /*#__PURE__*/ jsx(ProductPage, {
|
|
@@ -6,7 +6,7 @@ import Head from 'next/head';
|
|
|
6
6
|
import { useRouter } from 'next/router';
|
|
7
7
|
|
|
8
8
|
const ProductProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.ProductProvider));
|
|
9
|
-
const ProductDetailPage = ({ themeStyle
|
|
9
|
+
const ProductDetailPage = ({ themeStyle, fontStyle, seo, product, components, builderData, sectionData })=>{
|
|
10
10
|
const router = useRouter();
|
|
11
11
|
if (router.isFallback) {
|
|
12
12
|
return /*#__PURE__*/ jsx("div", {
|
|
@@ -6,7 +6,7 @@ import { useRouter } from 'next/router';
|
|
|
6
6
|
import { useTrackingView } from '../libs/hooks/use-tracking-view.js';
|
|
7
7
|
import { parseHtml } from '../libs/parse-html.js';
|
|
8
8
|
|
|
9
|
-
const StaticPageV2 = ({ components
|
|
9
|
+
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle })=>{
|
|
10
10
|
const router = useRouter();
|
|
11
11
|
useTrackingView(shopToken, pageHandle, router.isFallback);
|
|
12
12
|
if (router.isFallback) {
|
package/dist/esm/pages/static.js
CHANGED
|
@@ -4,7 +4,7 @@ import { NextSeo } from 'next-seo';
|
|
|
4
4
|
import Head from 'next/head';
|
|
5
5
|
import { useRouter } from 'next/router';
|
|
6
6
|
|
|
7
|
-
const StaticPage = ({ components
|
|
7
|
+
const StaticPage = ({ components, builderData, sectionData, seo, themeStyle, fontStyle })=>{
|
|
8
8
|
const router = useRouter();
|
|
9
9
|
if (router.isFallback) {
|
|
10
10
|
return /*#__PURE__*/ jsx("div", {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { NextPage, GetStaticPaths } from 'next';
|
|
|
3
3
|
import { NextSeoProps } from 'next-seo';
|
|
4
4
|
import { AppProps } from 'next/app';
|
|
5
5
|
import { SWRConfig } from 'swr';
|
|
6
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
7
|
import * as react from 'react';
|
|
7
8
|
import { Component } from 'react';
|
|
8
9
|
|
|
@@ -85,7 +86,7 @@ declare const getStaticPagePropsPreview: (fetcher: FetchFunc, shopifyFetcher: Fe
|
|
|
85
86
|
declare const createFetcher: (token?: string | null) => FetchFunc;
|
|
86
87
|
declare const createShopifyFetcher: (storefrontToken?: string, handle?: string) => FetchFunc;
|
|
87
88
|
|
|
88
|
-
declare const getLayout: (page: React.ReactElement, pageProps?: any) => JSX.Element;
|
|
89
|
+
declare const getLayout: (page: React.ReactElement, pageProps?: any) => react_jsx_runtime.JSX.Element;
|
|
89
90
|
|
|
90
91
|
declare const genCSS: (input?: string | Record<string, any>, mobileOnly?: boolean) => string;
|
|
91
92
|
|
|
@@ -189,32 +190,32 @@ declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryS
|
|
|
189
190
|
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
190
191
|
reset: () => void;
|
|
191
192
|
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
192
|
-
render(): string | number | boolean | react.
|
|
193
|
+
render(): string | number | boolean | Iterable<react.ReactNode> | react.PromiseLikeOfReactNode | react_jsx_runtime.JSX.Element | null | undefined;
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
type Props$3 = {
|
|
196
197
|
error?: Error;
|
|
197
198
|
resetErrorBoundary: () => void;
|
|
198
199
|
};
|
|
199
|
-
declare const ErrorFallback: ({ error, resetErrorBoundary }: Props$3) => JSX.Element;
|
|
200
|
+
declare const ErrorFallback: ({ error, resetErrorBoundary }: Props$3) => react_jsx_runtime.JSX.Element;
|
|
200
201
|
|
|
201
|
-
declare const Page404: () => JSX.Element;
|
|
202
|
+
declare const Page404: () => react_jsx_runtime.JSX.Element;
|
|
202
203
|
|
|
203
|
-
declare const Page500: () => JSX.Element;
|
|
204
|
+
declare const Page500: () => react_jsx_runtime.JSX.Element;
|
|
204
205
|
|
|
205
206
|
type Props$2 = {
|
|
206
207
|
trackingId?: string | null;
|
|
207
208
|
};
|
|
208
|
-
declare const GoogleAnalytic: ({ trackingId }: Props$2) => JSX.Element | null;
|
|
209
|
+
declare const GoogleAnalytic: ({ trackingId }: Props$2) => react_jsx_runtime.JSX.Element | null;
|
|
209
210
|
|
|
210
211
|
type Props$1 = {
|
|
211
212
|
pixelId?: string | null;
|
|
212
213
|
};
|
|
213
|
-
declare const FacebookPixel: ({ pixelId }: Props$1) => JSX.Element | null;
|
|
214
|
+
declare const FacebookPixel: ({ pixelId }: Props$1) => react_jsx_runtime.JSX.Element | null;
|
|
214
215
|
|
|
215
216
|
type Props = {
|
|
216
217
|
pixelId?: string | null;
|
|
217
218
|
};
|
|
218
|
-
declare const TikTokPixel: ({ pixelId }: Props) => JSX.Element | null;
|
|
219
|
+
declare const TikTokPixel: ({ pixelId }: Props) => react_jsx_runtime.JSX.Element | null;
|
|
219
220
|
|
|
220
221
|
export { AppPropsWithLayout, BuilderPage, CollectionDetailPage, CollectionPageProps, ErrorBoundary, ErrorFallback, FacebookPixel, GoogleAnalytic, NextPageWithLayout, Page404, Page500, PageBuilderProps, PreviewPage, ProductDetailPage, ProductPageProps, StaticPage, StaticPageProps, StaticPagePropsV2, StaticPageV2, TikTokPixel, createFetcher, createShopifyFetcher, genCSS, getBuilderProps, getCollectionProps, getFallbackV2, getFontFromGlobalStyle, getFontFromGroupSetting, getFonts, getFontsFromDataBuilder, getHomePageProps, getHomePagePropsV2, getLayout, getPreviewProps, getProductProps, getStaticPagePropsPreview, getStaticPagePropsV2, getStaticPaths, getStorefrontApi, isBot, normalizePageSectionResponseV2, parseBuilderTemplateV2, retryWithDelay, useTrackingView };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/pages",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.42",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"test": "jest -c ./../../helpers/jest.config.ts"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@sentry/nextjs": "7.
|
|
22
|
+
"@sentry/nextjs": "7.57.0",
|
|
23
23
|
"deepmerge": "4.3.1",
|
|
24
24
|
"html-react-parser": "3.0.15",
|
|
25
25
|
"next-seo": "^6.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@gem-sdk/core": "1.13.
|
|
28
|
+
"@gem-sdk/core": "1.13.42",
|
|
29
29
|
"@gem-sdk/plugin-cookie-bar": "*",
|
|
30
30
|
"@gem-sdk/plugin-quick-view": "*",
|
|
31
31
|
"@gem-sdk/plugin-sticky-add-to-cart": "*"
|