@gem-sdk/pages 1.11.0 → 1.12.0-next.3
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 +10 -1
- package/dist/cjs/components/Header.js +10 -1
- package/dist/cjs/components/ImageToLayout.js +21 -2
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/libs/helpers/common.js +27 -0
- package/dist/cjs/pages/builder.js +3 -1
- package/dist/esm/components/Footer.js +11 -2
- package/dist/esm/components/Header.js +11 -2
- package/dist/esm/components/ImageToLayout.js +22 -3
- package/dist/esm/index.js +1 -0
- package/dist/esm/libs/helpers/common.js +24 -0
- package/dist/esm/pages/builder.js +3 -1
- package/dist/types/index.d.ts +8 -1
- package/package.json +1 -1
|
@@ -6,6 +6,11 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var core = require('@gem-sdk/core');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
|
|
9
|
+
const paddingX = {
|
|
10
|
+
desktop: '220px',
|
|
11
|
+
tablet: '16px',
|
|
12
|
+
mobile: '16px'
|
|
13
|
+
};
|
|
9
14
|
const Footer = ()=>{
|
|
10
15
|
const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
|
|
11
16
|
const [shouldFixed, setShouldFixed] = react.useState(false);
|
|
@@ -28,10 +33,14 @@ const Footer = ()=>{
|
|
|
28
33
|
};
|
|
29
34
|
});
|
|
30
35
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
31
|
-
className: core.cls('gp-footer-container flex h-[48px] items-center justify-between border-y border-1 border-[#EEEEEE] group px-[68px] ', {
|
|
36
|
+
className: core.cls('gp-footer-container flex h-[48px] items-center justify-between border-y border-1 border-[#EEEEEE] group px-[68px] font-sans', {
|
|
32
37
|
hidden: !layoutSetting?.showFooter,
|
|
33
38
|
'fixed w-full bottom-0 z-50': shouldFixed
|
|
34
39
|
}),
|
|
40
|
+
style: {
|
|
41
|
+
...core.makeStyleResponsive('pl', paddingX),
|
|
42
|
+
...core.makeStyleResponsive('pr', paddingX)
|
|
43
|
+
},
|
|
35
44
|
children: [
|
|
36
45
|
/*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
37
46
|
width: "192",
|
|
@@ -5,12 +5,21 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var core = require('@gem-sdk/core');
|
|
7
7
|
|
|
8
|
+
const paddingX = {
|
|
9
|
+
desktop: '220px',
|
|
10
|
+
tablet: '16px',
|
|
11
|
+
mobile: '16px'
|
|
12
|
+
};
|
|
8
13
|
const Header = ()=>{
|
|
9
14
|
const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
|
|
10
15
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
11
|
-
className: core.cls('gp-header-container flex h-[40px] items-center justify-between border-b border-1 border-[#EEEEEE] group relative
|
|
16
|
+
className: core.cls('gp-header-container flex h-[40px] items-center justify-between border-b border-1 border-[#EEEEEE] group relative font-sans', {
|
|
12
17
|
hidden: !layoutSetting?.showHeader
|
|
13
18
|
}),
|
|
19
|
+
style: {
|
|
20
|
+
...core.makeStyleResponsive('pl', paddingX),
|
|
21
|
+
...core.makeStyleResponsive('pr', paddingX)
|
|
22
|
+
},
|
|
14
23
|
children: [
|
|
15
24
|
/*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
16
25
|
width: "84",
|
|
@@ -4,14 +4,33 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var react = require('react');
|
|
7
|
+
var core = require('@gem-sdk/core');
|
|
7
8
|
var PagesSuggestion = require('./PagesSuggestion.js');
|
|
8
9
|
|
|
9
|
-
const
|
|
10
|
+
const HEADER_HEIGHT = 40;
|
|
11
|
+
const FOOTER_HEIGHT = 48;
|
|
12
|
+
const ImageToLayout = ({ editorImageToLayout })=>{
|
|
10
13
|
const [link, setLink] = react.useState('');
|
|
11
14
|
const [openSuggestion, setOpenSuggestion] = react.useState(false);
|
|
15
|
+
const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
|
|
16
|
+
const offset = react.useMemo(()=>{
|
|
17
|
+
let result = 0;
|
|
18
|
+
if (layoutSetting?.showFooter) {
|
|
19
|
+
result += FOOTER_HEIGHT;
|
|
20
|
+
}
|
|
21
|
+
if (layoutSetting?.showHeader) {
|
|
22
|
+
result += HEADER_HEIGHT;
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
}, [
|
|
26
|
+
layoutSetting?.showHeader,
|
|
27
|
+
layoutSetting?.showFooter
|
|
28
|
+
]);
|
|
12
29
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
13
30
|
id: "gp-img-to-layout-wrapper",
|
|
14
|
-
className:
|
|
31
|
+
className: core.cls(`sf-add-section-placeholder flex h-[calc(100vh_-_${offset}px)] flex-1 flex-col items-center justify-center`, {
|
|
32
|
+
hidden: !editorImageToLayout
|
|
33
|
+
}),
|
|
15
34
|
children: [
|
|
16
35
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
17
36
|
className: "mb-[32px] flex items-center",
|
package/dist/cjs/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var useTrackingView = require('./libs/hooks/use-tracking-view.js');
|
|
|
16
16
|
var userAgent = require('./libs/helpers/user-agent.js');
|
|
17
17
|
var normalize = require('./libs/helpers/normalize.js');
|
|
18
18
|
var getFallback = require('./libs/helpers/get-fallback.js');
|
|
19
|
+
var common = require('./libs/helpers/common.js');
|
|
19
20
|
var collectionDetail = require('./pages/collection-detail.js');
|
|
20
21
|
var preview = require('./pages/preview.js');
|
|
21
22
|
var productDetail = require('./pages/product-detail.js');
|
|
@@ -53,6 +54,7 @@ exports.isBot = userAgent.isBot;
|
|
|
53
54
|
exports.normalizePageSectionResponseV2 = normalize.normalizePageSectionResponseV2;
|
|
54
55
|
exports.parseBuilderTemplateV2 = normalize.parseBuilderTemplateV2;
|
|
55
56
|
exports.getFallbackV2 = getFallback.getFallbackV2;
|
|
57
|
+
exports.retryWithDelay = common.retryWithDelay;
|
|
56
58
|
exports.CollectionDetailPage = collectionDetail.default;
|
|
57
59
|
exports.PreviewPage = preview.PreviewPage;
|
|
58
60
|
exports.ProductDetailPage = productDetail.default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
async function wait(ms) {
|
|
4
|
+
return new Promise((resolve)=>setTimeout(resolve, ms));
|
|
5
|
+
}
|
|
6
|
+
const retryWithDelay = async (fn, config)=>{
|
|
7
|
+
const retries = config?.retries ?? 3;
|
|
8
|
+
const delay = config?.delay ?? 1000;
|
|
9
|
+
try {
|
|
10
|
+
return await fn();
|
|
11
|
+
} catch (err) {
|
|
12
|
+
if (retries <= 0 || config?.retryIf && !config.retryIf(err)) {
|
|
13
|
+
return Promise.reject(err);
|
|
14
|
+
}
|
|
15
|
+
//delay the next call
|
|
16
|
+
await wait(delay);
|
|
17
|
+
//recursively call the same func
|
|
18
|
+
return retryWithDelay(fn, {
|
|
19
|
+
...config,
|
|
20
|
+
retries: retries - 1,
|
|
21
|
+
delay
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.retryWithDelay = retryWithDelay;
|
|
27
|
+
exports.wait = wait;
|
|
@@ -71,7 +71,9 @@ const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData ,
|
|
|
71
71
|
uid: "ROOT"
|
|
72
72
|
})
|
|
73
73
|
}),
|
|
74
|
-
|
|
74
|
+
/*#__PURE__*/ jsxRuntime.jsx(ImageToLayout.default, {
|
|
75
|
+
editorImageToLayout: editorImageToLayout || false
|
|
76
|
+
}),
|
|
75
77
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
76
78
|
id: "visual-content"
|
|
77
79
|
}),
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useShopStore, cls } from '@gem-sdk/core';
|
|
2
|
+
import { useShopStore, cls, makeStyleResponsive } from '@gem-sdk/core';
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
|
|
5
|
+
const paddingX = {
|
|
6
|
+
desktop: '220px',
|
|
7
|
+
tablet: '16px',
|
|
8
|
+
mobile: '16px'
|
|
9
|
+
};
|
|
5
10
|
const Footer = ()=>{
|
|
6
11
|
const layoutSetting = useShopStore((s)=>s.layoutSettings);
|
|
7
12
|
const [shouldFixed, setShouldFixed] = useState(false);
|
|
@@ -24,10 +29,14 @@ const Footer = ()=>{
|
|
|
24
29
|
};
|
|
25
30
|
});
|
|
26
31
|
return /*#__PURE__*/ jsxs("div", {
|
|
27
|
-
className: cls('gp-footer-container flex h-[48px] items-center justify-between border-y border-1 border-[#EEEEEE] group px-[68px] ', {
|
|
32
|
+
className: cls('gp-footer-container flex h-[48px] items-center justify-between border-y border-1 border-[#EEEEEE] group px-[68px] font-sans', {
|
|
28
33
|
hidden: !layoutSetting?.showFooter,
|
|
29
34
|
'fixed w-full bottom-0 z-50': shouldFixed
|
|
30
35
|
}),
|
|
36
|
+
style: {
|
|
37
|
+
...makeStyleResponsive('pl', paddingX),
|
|
38
|
+
...makeStyleResponsive('pr', paddingX)
|
|
39
|
+
},
|
|
31
40
|
children: [
|
|
32
41
|
/*#__PURE__*/ jsxs("svg", {
|
|
33
42
|
width: "192",
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useShopStore, cls } from '@gem-sdk/core';
|
|
2
|
+
import { useShopStore, cls, makeStyleResponsive } from '@gem-sdk/core';
|
|
3
3
|
|
|
4
|
+
const paddingX = {
|
|
5
|
+
desktop: '220px',
|
|
6
|
+
tablet: '16px',
|
|
7
|
+
mobile: '16px'
|
|
8
|
+
};
|
|
4
9
|
const Header = ()=>{
|
|
5
10
|
const layoutSetting = useShopStore((s)=>s.layoutSettings);
|
|
6
11
|
return /*#__PURE__*/ jsxs("div", {
|
|
7
|
-
className: cls('gp-header-container flex h-[40px] items-center justify-between border-b border-1 border-[#EEEEEE] group relative
|
|
12
|
+
className: cls('gp-header-container flex h-[40px] items-center justify-between border-b border-1 border-[#EEEEEE] group relative font-sans', {
|
|
8
13
|
hidden: !layoutSetting?.showHeader
|
|
9
14
|
}),
|
|
15
|
+
style: {
|
|
16
|
+
...makeStyleResponsive('pl', paddingX),
|
|
17
|
+
...makeStyleResponsive('pr', paddingX)
|
|
18
|
+
},
|
|
10
19
|
children: [
|
|
11
20
|
/*#__PURE__*/ jsxs("svg", {
|
|
12
21
|
width: "84",
|
|
@@ -1,13 +1,32 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useState, useMemo } from 'react';
|
|
3
|
+
import { useShopStore, cls } from '@gem-sdk/core';
|
|
3
4
|
import { PagesSuggestion } from './PagesSuggestion.js';
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
+
const HEADER_HEIGHT = 40;
|
|
7
|
+
const FOOTER_HEIGHT = 48;
|
|
8
|
+
const ImageToLayout = ({ editorImageToLayout })=>{
|
|
6
9
|
const [link, setLink] = useState('');
|
|
7
10
|
const [openSuggestion, setOpenSuggestion] = useState(false);
|
|
11
|
+
const layoutSetting = useShopStore((s)=>s.layoutSettings);
|
|
12
|
+
const offset = useMemo(()=>{
|
|
13
|
+
let result = 0;
|
|
14
|
+
if (layoutSetting?.showFooter) {
|
|
15
|
+
result += FOOTER_HEIGHT;
|
|
16
|
+
}
|
|
17
|
+
if (layoutSetting?.showHeader) {
|
|
18
|
+
result += HEADER_HEIGHT;
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
21
|
+
}, [
|
|
22
|
+
layoutSetting?.showHeader,
|
|
23
|
+
layoutSetting?.showFooter
|
|
24
|
+
]);
|
|
8
25
|
return /*#__PURE__*/ jsxs("div", {
|
|
9
26
|
id: "gp-img-to-layout-wrapper",
|
|
10
|
-
className:
|
|
27
|
+
className: cls(`sf-add-section-placeholder flex h-[calc(100vh_-_${offset}px)] flex-1 flex-col items-center justify-center`, {
|
|
28
|
+
hidden: !editorImageToLayout
|
|
29
|
+
}),
|
|
11
30
|
children: [
|
|
12
31
|
/*#__PURE__*/ jsx("div", {
|
|
13
32
|
className: "mb-[32px] flex items-center",
|
package/dist/esm/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export { useTrackingView } from './libs/hooks/use-tracking-view.js';
|
|
|
14
14
|
export { isBot } from './libs/helpers/user-agent.js';
|
|
15
15
|
export { normalizePageSectionResponseV2, parseBuilderTemplateV2 } from './libs/helpers/normalize.js';
|
|
16
16
|
export { getFallbackV2 } from './libs/helpers/get-fallback.js';
|
|
17
|
+
export { retryWithDelay } from './libs/helpers/common.js';
|
|
17
18
|
export { default as CollectionDetailPage } from './pages/collection-detail.js';
|
|
18
19
|
export { PreviewPage } from './pages/preview.js';
|
|
19
20
|
export { default as ProductDetailPage } from './pages/product-detail.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
async function wait(ms) {
|
|
2
|
+
return new Promise((resolve)=>setTimeout(resolve, ms));
|
|
3
|
+
}
|
|
4
|
+
const retryWithDelay = async (fn, config)=>{
|
|
5
|
+
const retries = config?.retries ?? 3;
|
|
6
|
+
const delay = config?.delay ?? 1000;
|
|
7
|
+
try {
|
|
8
|
+
return await fn();
|
|
9
|
+
} catch (err) {
|
|
10
|
+
if (retries <= 0 || config?.retryIf && !config.retryIf(err)) {
|
|
11
|
+
return Promise.reject(err);
|
|
12
|
+
}
|
|
13
|
+
//delay the next call
|
|
14
|
+
await wait(delay);
|
|
15
|
+
//recursively call the same func
|
|
16
|
+
return retryWithDelay(fn, {
|
|
17
|
+
...config,
|
|
18
|
+
retries: retries - 1,
|
|
19
|
+
delay
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { retryWithDelay, wait };
|
|
@@ -69,7 +69,9 @@ const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData ,
|
|
|
69
69
|
uid: "ROOT"
|
|
70
70
|
})
|
|
71
71
|
}),
|
|
72
|
-
|
|
72
|
+
/*#__PURE__*/ jsx(ImageToLayout, {
|
|
73
|
+
editorImageToLayout: editorImageToLayout || false
|
|
74
|
+
}),
|
|
73
75
|
/*#__PURE__*/ jsx("div", {
|
|
74
76
|
id: "visual-content"
|
|
75
77
|
}),
|
package/dist/types/index.d.ts
CHANGED
|
@@ -114,6 +114,13 @@ declare const getFallbackV2: (fetcher: FetchFunc, data: {
|
|
|
114
114
|
data: any;
|
|
115
115
|
}[]) => Promise<{}>;
|
|
116
116
|
|
|
117
|
+
type RetryConfig = {
|
|
118
|
+
retries?: number;
|
|
119
|
+
delay?: number;
|
|
120
|
+
retryIf?: (error: any) => boolean;
|
|
121
|
+
};
|
|
122
|
+
declare const retryWithDelay: <T = unknown>(fn: () => T, config?: RetryConfig) => Promise<T>;
|
|
123
|
+
|
|
117
124
|
type PreviewPageProps = {
|
|
118
125
|
components: Record<string, React.ComponentType<any>>;
|
|
119
126
|
pageType: ShopType.PublishedThemePageType;
|
|
@@ -206,4 +213,4 @@ type Props = {
|
|
|
206
213
|
};
|
|
207
214
|
declare const TikTokPixel: ({ pixelId }: Props) => JSX.Element | null;
|
|
208
215
|
|
|
209
|
-
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, getFonts, getHomePageProps, getHomePagePropsV2, getLayout, getPreviewProps, getProductProps, getStaticPageProps, getStaticPagePropsPreview, getStaticPagePropsV2, getStaticPaths, getStorefrontApi, isBot, normalizePageSectionResponseV2, parseBuilderTemplateV2, useTrackingView };
|
|
216
|
+
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, getFonts, getHomePageProps, getHomePagePropsV2, getLayout, getPreviewProps, getProductProps, getStaticPageProps, getStaticPagePropsPreview, getStaticPagePropsV2, getStaticPaths, getStorefrontApi, isBot, normalizePageSectionResponseV2, parseBuilderTemplateV2, retryWithDelay, useTrackingView };
|