@gem-sdk/pages 1.23.0-staging.358 → 1.23.0-staging.384
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 +101 -79
- package/dist/cjs/components/FooterForPostPurchase.js +34 -0
- package/dist/cjs/components/Header.js +142 -67
- package/dist/cjs/components/builder/Toolbar.js +31 -24
- package/dist/cjs/components/builder/Toolbox.js +23 -1
- package/dist/cjs/components/image-to-layout/AddSectionImageToLayout.js +17 -1
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/libs/api/get-post-purchase-props-preview.js +92 -0
- package/dist/cjs/libs/fetcher.js +33 -0
- package/dist/cjs/libs/hooks/usePagePreview.js +92 -0
- package/dist/cjs/pages/builder.js +12 -5
- package/dist/cjs/pages/static-v2.js +24 -13
- package/dist/esm/components/Footer.js +102 -80
- package/dist/esm/components/FooterForPostPurchase.js +30 -0
- package/dist/esm/components/Header.js +143 -68
- package/dist/esm/components/builder/Toolbar.js +31 -24
- package/dist/esm/components/builder/Toolbox.js +23 -1
- package/dist/esm/components/image-to-layout/AddSectionImageToLayout.js +17 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/libs/api/get-post-purchase-props-preview.js +88 -0
- package/dist/esm/libs/fetcher.js +33 -1
- package/dist/esm/libs/hooks/usePagePreview.js +90 -0
- package/dist/esm/pages/builder.js +12 -5
- package/dist/esm/pages/static-v2.js +24 -13
- package/dist/types/index.d.ts +24 -3
- package/package.json +5 -5
|
@@ -6,7 +6,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var core = require('@gem-sdk/core');
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const BASE_DATA = [
|
|
10
10
|
{
|
|
11
11
|
title: 'Choose templates',
|
|
12
12
|
content: 'inspired by CRO experts',
|
|
@@ -26,6 +26,14 @@ const ACTIONS_DATA = [
|
|
|
26
26
|
id: 'gps-add-section-bottom-from-image'
|
|
27
27
|
}
|
|
28
28
|
];
|
|
29
|
+
const POST_PURCHASE_PAGE_DATA = [
|
|
30
|
+
{
|
|
31
|
+
title: 'Blank section',
|
|
32
|
+
content: 'to start from scratch',
|
|
33
|
+
hasAILogo: false,
|
|
34
|
+
id: 'gps-add-section-blank'
|
|
35
|
+
}
|
|
36
|
+
];
|
|
29
37
|
const FOOTER_HEIGHT = 48;
|
|
30
38
|
const defaultPadding = {
|
|
31
39
|
desktop: 'var(--g-ct-p)',
|
|
@@ -37,6 +45,14 @@ const AddSectionImageToLayout = ({ editorImageToLayout })=>{
|
|
|
37
45
|
const totalSection = core.useBuilderPreviewStore((state)=>state.state.ROOT.childrens?.length);
|
|
38
46
|
const [link, setLink] = react.useState('');
|
|
39
47
|
const [isInput, setIsInput] = react.useState(false);
|
|
48
|
+
const editingPageType = core.useShopStore((s)=>s.pageType);
|
|
49
|
+
let ACTIONS_DATA = BASE_DATA;
|
|
50
|
+
if (editingPageType === 'POST_PURCHASE') {
|
|
51
|
+
ACTIONS_DATA = [
|
|
52
|
+
...POST_PURCHASE_PAGE_DATA,
|
|
53
|
+
...BASE_DATA
|
|
54
|
+
].filter((item)=>item.id !== 'gps-add-section-bottom-from-url' && item.id !== 'gps-add-section-bottom-from-image');
|
|
55
|
+
}
|
|
40
56
|
react.useEffect(()=>{
|
|
41
57
|
if (!isInput || totalSection === 0) {
|
|
42
58
|
setLink('');
|
package/dist/cjs/index.js
CHANGED
|
@@ -7,11 +7,13 @@ var getPreviewProps = require('./libs/api/get-preview-props.js');
|
|
|
7
7
|
var getBuilderProps = require('./libs/api/get-builder-props.js');
|
|
8
8
|
var getProductProps = require('./libs/api/get-product-props.js');
|
|
9
9
|
var getStaticPagePropsV2 = require('./libs/api/get-static-page-props-v2.js');
|
|
10
|
+
var getPostPurchasePropsPreview = require('./libs/api/get-post-purchase-props-preview.js');
|
|
10
11
|
var getStaticPagePropsPreview = require('./libs/api/get-static-page-props-preview.js');
|
|
11
12
|
var fetcher = require('./libs/fetcher.js');
|
|
12
13
|
var getLayout = require('./libs/get-layout.js');
|
|
13
14
|
var genCss = require('./libs/helpers/gen-css.js');
|
|
14
15
|
var useTrackingView = require('./libs/hooks/use-tracking-view.js');
|
|
16
|
+
var usePagePreview = require('./libs/hooks/usePagePreview.js');
|
|
15
17
|
var userAgent = require('./libs/helpers/user-agent.js');
|
|
16
18
|
var normalize = require('./libs/helpers/normalize.js');
|
|
17
19
|
var getFallback = require('./libs/helpers/get-fallback.js');
|
|
@@ -43,12 +45,15 @@ exports.getPreviewProps = getPreviewProps.getPreviewProps;
|
|
|
43
45
|
exports.getBuilderProps = getBuilderProps.getBuilderProps;
|
|
44
46
|
exports.getProductProps = getProductProps.getProductProps;
|
|
45
47
|
exports.getStaticPagePropsV2 = getStaticPagePropsV2.getStaticPagePropsV2;
|
|
48
|
+
exports.getPostPurchasePropsPreview = getPostPurchasePropsPreview.getPostPurchasePropsPreview;
|
|
46
49
|
exports.getStaticPagePropsPreview = getStaticPagePropsPreview.getStaticPagePropsPreview;
|
|
50
|
+
exports.createAppAPIFetcher = fetcher.createAppAPIFetcher;
|
|
47
51
|
exports.createFetcher = fetcher.createFetcher;
|
|
48
52
|
exports.createShopifyFetcher = fetcher.createShopifyFetcher;
|
|
49
53
|
exports.getLayout = getLayout.getLayout;
|
|
50
54
|
exports.genCSS = genCss.genCSS;
|
|
51
55
|
exports.useTrackingView = useTrackingView.useTrackingView;
|
|
56
|
+
exports.usePagePreview = usePagePreview.usePagePreview;
|
|
52
57
|
exports.isBot = userAgent.isBot;
|
|
53
58
|
exports.normalizePageSectionResponseV2 = normalize.normalizePageSectionResponseV2;
|
|
54
59
|
exports.parseBuilderTemplateV2 = normalize.parseBuilderTemplateV2;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
var adapterShopify = require('@gem-sdk/adapter-shopify');
|
|
5
|
+
var nextjs = require('@sentry/nextjs');
|
|
6
|
+
var googleFonts = require('../google-fonts.js');
|
|
7
|
+
var getFallback = require('../helpers/get-fallback.js');
|
|
8
|
+
var normalize = require('../helpers/normalize.js');
|
|
9
|
+
var usePagePreview = require('../hooks/usePagePreview.js');
|
|
10
|
+
var parseJson = require('../helpers/parse-json.js');
|
|
11
|
+
|
|
12
|
+
const fetchThemePageDataByID = async (themePageId, fetcher, shopifyFetcher)=>{
|
|
13
|
+
const variables = {
|
|
14
|
+
themePageId
|
|
15
|
+
};
|
|
16
|
+
const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
|
|
17
|
+
fetcher([
|
|
18
|
+
core.ThemePageDocument,
|
|
19
|
+
variables
|
|
20
|
+
]),
|
|
21
|
+
fetcher([
|
|
22
|
+
core.StorePropertyDocument
|
|
23
|
+
]),
|
|
24
|
+
shopifyFetcher([
|
|
25
|
+
adapterShopify.ShopMetaDocument
|
|
26
|
+
])
|
|
27
|
+
]);
|
|
28
|
+
if (theme.status === 'rejected') {
|
|
29
|
+
throw new Error(theme.reason?.[0]);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
dataBuilder: theme.value.themePage,
|
|
33
|
+
storeProperty,
|
|
34
|
+
shopifyMeta
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const fetchThemePageDataByTemplateID = async (libraryTemplateId, fetcher, shopifyFetcher)=>{
|
|
38
|
+
const variables = {
|
|
39
|
+
libraryTemplateId
|
|
40
|
+
};
|
|
41
|
+
const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
|
|
42
|
+
fetcher([
|
|
43
|
+
core.LibraryTemplateDocument,
|
|
44
|
+
variables
|
|
45
|
+
]),
|
|
46
|
+
fetcher([
|
|
47
|
+
core.StorePropertyDocument
|
|
48
|
+
]),
|
|
49
|
+
shopifyFetcher([
|
|
50
|
+
adapterShopify.ShopMetaDocument
|
|
51
|
+
])
|
|
52
|
+
]);
|
|
53
|
+
if (theme.status === 'rejected') {
|
|
54
|
+
throw new Error(theme.reason?.[0]);
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
dataBuilder: theme.value.libraryTemplate,
|
|
58
|
+
storeProperty,
|
|
59
|
+
shopifyMeta
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
const getPostPurchasePropsPreview = (fetcher, shopifyFetcher, isTemplate)=>async (id)=>{
|
|
63
|
+
try {
|
|
64
|
+
const { dataBuilder, storeProperty, shopifyMeta } = isTemplate ? await fetchThemePageDataByTemplateID(id, fetcher, shopifyFetcher) : await fetchThemePageDataByID(id, fetcher, shopifyFetcher);
|
|
65
|
+
if (!dataBuilder) {
|
|
66
|
+
throw new Error(`No data builder found for slug: /preview/${id}`);
|
|
67
|
+
}
|
|
68
|
+
const pageTemplate = normalize.parseBuilderTemplateV2(dataBuilder);
|
|
69
|
+
const [elementFontStyle, fallback] = await Promise.all([
|
|
70
|
+
googleFonts.getFontStyleFromPageTemplate(pageTemplate),
|
|
71
|
+
getFallback.getFallbackV2(fetcher, pageTemplate)
|
|
72
|
+
]);
|
|
73
|
+
const { seo, pageConfig } = usePagePreview.usePagePreview(dataBuilder, storeProperty, shopifyMeta);
|
|
74
|
+
return parseJson.serializableJson({
|
|
75
|
+
seo,
|
|
76
|
+
...pageConfig,
|
|
77
|
+
elementFontStyle,
|
|
78
|
+
builderData: pageTemplate,
|
|
79
|
+
pageType: 'POST_PURCHASE',
|
|
80
|
+
swr: {
|
|
81
|
+
fallback
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
} catch (err) {
|
|
85
|
+
nextjs.captureException(err);
|
|
86
|
+
throw err;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
exports.fetchThemePageDataByID = fetchThemePageDataByID;
|
|
91
|
+
exports.fetchThemePageDataByTemplateID = fetchThemePageDataByTemplateID;
|
|
92
|
+
exports.getPostPurchasePropsPreview = getPostPurchasePropsPreview;
|
package/dist/cjs/libs/fetcher.js
CHANGED
|
@@ -32,6 +32,38 @@ const createFetcher = (token)=>{
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
|
+
const createAppAPIFetcher = (token, shopID)=>{
|
|
36
|
+
const shopToken = token;
|
|
37
|
+
const endPoint = process.env.NEXT_APP_API_URL;
|
|
38
|
+
return async (args)=>{
|
|
39
|
+
const [query, variables, operationName] = args;
|
|
40
|
+
if (!shopToken) {
|
|
41
|
+
throw new Error('shopToken is not defined');
|
|
42
|
+
}
|
|
43
|
+
if (!endPoint) {
|
|
44
|
+
throw new Error('NEXT_APP_API_URL is not defined');
|
|
45
|
+
}
|
|
46
|
+
const headers = {
|
|
47
|
+
'Content-Type': 'application/json',
|
|
48
|
+
Authorization: `Token ${shopToken}`,
|
|
49
|
+
'X-GemX-Shop-ID': shopID || ''
|
|
50
|
+
};
|
|
51
|
+
return fetch(endPoint, {
|
|
52
|
+
method: 'POST',
|
|
53
|
+
headers,
|
|
54
|
+
body: JSON.stringify({
|
|
55
|
+
query,
|
|
56
|
+
variables,
|
|
57
|
+
operationName
|
|
58
|
+
})
|
|
59
|
+
}).then((res)=>res.json()).then((res)=>{
|
|
60
|
+
if (res.errors) {
|
|
61
|
+
return Promise.reject(res.errors);
|
|
62
|
+
}
|
|
63
|
+
return res.data;
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
};
|
|
35
67
|
const createShopifyFetcher = (storefrontToken, handle)=>{
|
|
36
68
|
const token = storefrontToken ?? process.env.NEXT_PUBLIC_STOREFRONT_TOKEN;
|
|
37
69
|
const storefrontHandle = handle ?? process.env.NEXT_PUBLIC_STOREFRONT_HANDLE;
|
|
@@ -63,5 +95,6 @@ const createShopifyFetcher = (storefrontToken, handle)=>{
|
|
|
63
95
|
};
|
|
64
96
|
};
|
|
65
97
|
|
|
98
|
+
exports.createAppAPIFetcher = createAppAPIFetcher;
|
|
66
99
|
exports.createFetcher = createFetcher;
|
|
67
100
|
exports.createShopifyFetcher = createShopifyFetcher;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var generateManifres = require('../helpers/generate-manifres.js');
|
|
4
|
+
var parseJson = require('../helpers/parse-json.js');
|
|
5
|
+
|
|
6
|
+
const usePagePreview = (dataBuilder, storeProperty, shopifyMeta)=>{
|
|
7
|
+
const mobileOnly = dataBuilder?.isMobile ?? false;
|
|
8
|
+
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
9
|
+
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
10
|
+
const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
|
|
11
|
+
const languageIsoCode = shopMeta?.localization.language.isoCode ?? null;
|
|
12
|
+
const countryIsoCode = shopMeta?.localization.country.isoCode ?? null;
|
|
13
|
+
const moneyFormat = shopMeta?.shop.moneyFormat ?? null;
|
|
14
|
+
const currency = shopMeta?.localization.country.currency.isoCode ?? null;
|
|
15
|
+
const swatches = parseJson.parseJson(shopData?.storeProperty?.swatchesConfig);
|
|
16
|
+
const locale = !languageIsoCode || !countryIsoCode ? null : `${languageIsoCode}-${countryIsoCode}`;
|
|
17
|
+
const seo = {
|
|
18
|
+
defaultTitle: shopMeta?.shop.name,
|
|
19
|
+
title: dataBuilder?.name,
|
|
20
|
+
openGraph: {
|
|
21
|
+
site_name: shopMeta?.shop.name,
|
|
22
|
+
locale: shopMeta?.localization.country.isoCode,
|
|
23
|
+
title: dataBuilder?.name ?? shopMeta?.shop.name
|
|
24
|
+
},
|
|
25
|
+
nofollow: true,
|
|
26
|
+
noindex: true,
|
|
27
|
+
canonical: `/preview/${dataBuilder?.id}`,
|
|
28
|
+
additionalMetaTags: [
|
|
29
|
+
{
|
|
30
|
+
name: 'theme-color',
|
|
31
|
+
content: '#000000'
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
additionalLinkTags: [
|
|
35
|
+
{
|
|
36
|
+
rel: 'icon',
|
|
37
|
+
sizes: '32x32',
|
|
38
|
+
href: `${favicon}-/crop/1:1/center/-/smart_resize/32x32/`
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
rel: 'icon',
|
|
42
|
+
sizes: '16x16',
|
|
43
|
+
href: `${favicon}-/crop/1:1/center/-/smart_resize/16x16/`
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
rel: 'apple-touch-icon',
|
|
47
|
+
sizes: '180x180',
|
|
48
|
+
href: `${favicon}-/crop/1:1/center/-/smart_resize/180x180/`
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
rel: 'manifest',
|
|
52
|
+
href: generateManifres.generateManifest({
|
|
53
|
+
theme_color: '#000000',
|
|
54
|
+
background_color: '#ffffff',
|
|
55
|
+
display: 'standalone',
|
|
56
|
+
scope: '/',
|
|
57
|
+
start_url: '/',
|
|
58
|
+
name: shopMeta?.shop.name,
|
|
59
|
+
short_name: shopMeta?.shop.name,
|
|
60
|
+
description: shopMeta?.shop.description,
|
|
61
|
+
icons: [
|
|
62
|
+
{
|
|
63
|
+
src: `${favicon}-/crop/1:1/center/-/smart_resize/192x192/`,
|
|
64
|
+
sizes: '192x192',
|
|
65
|
+
type: 'image/png',
|
|
66
|
+
purpose: 'any maskable'
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
src: `${favicon}-/crop/1:1/center/-/smart_resize/512x512/`,
|
|
70
|
+
sizes: '512x512',
|
|
71
|
+
type: 'image/png'
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
seo,
|
|
80
|
+
pageConfig: {
|
|
81
|
+
mobileOnly,
|
|
82
|
+
locale,
|
|
83
|
+
languageIsoCode,
|
|
84
|
+
countryIsoCode,
|
|
85
|
+
moneyFormat,
|
|
86
|
+
currency,
|
|
87
|
+
swatches
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
exports.usePagePreview = usePagePreview;
|
|
@@ -16,6 +16,9 @@ var Toolbar = require('../components/builder/Toolbar.js');
|
|
|
16
16
|
|
|
17
17
|
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar })=>{
|
|
18
18
|
const [loadSuccess, setLoadSuccess] = react.useState(false);
|
|
19
|
+
const isDisableHeaderFooter = ()=>{
|
|
20
|
+
return isThemeSectionEditor;
|
|
21
|
+
};
|
|
19
22
|
const initState = react.useMemo(()=>({
|
|
20
23
|
ROOT: {
|
|
21
24
|
uid: 'ROOT',
|
|
@@ -65,12 +68,14 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
|
|
|
65
68
|
loadSuccess && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
66
69
|
className: "builder gp-z-1 gp-relative",
|
|
67
70
|
children: [
|
|
68
|
-
!hiddenToolbar && (
|
|
69
|
-
className: "
|
|
70
|
-
}) : /*#__PURE__*/ jsxRuntime.jsx(Header.default, {
|
|
71
|
+
!hiddenToolbar && (isDisableHeaderFooter() ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
72
|
+
className: "h-[40px] bg-[#f4f4f4]"
|
|
73
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(Header.default, {
|
|
74
|
+
pageType: pageType
|
|
75
|
+
})),
|
|
71
76
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
72
77
|
id: "storefront",
|
|
73
|
-
className: isThemeSectionEditor ? 'theme-section-editor' : ''
|
|
78
|
+
className: `${isThemeSectionEditor ? 'theme-section-editor' : ''} ${pageType === 'POST_PURCHASE' ? 'post-purchase-page' : ''}`,
|
|
74
79
|
children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsxRuntime.jsx(CollectionGlobalProvider.default, {
|
|
75
80
|
children: /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
|
|
76
81
|
uid: "ROOT"
|
|
@@ -88,7 +93,9 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
|
|
|
88
93
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
89
94
|
id: "visual-content"
|
|
90
95
|
}),
|
|
91
|
-
!
|
|
96
|
+
!isDisableHeaderFooter() && !hiddenToolbar && /*#__PURE__*/ jsxRuntime.jsx(Footer.default, {
|
|
97
|
+
pageType: pageType
|
|
98
|
+
})
|
|
92
99
|
]
|
|
93
100
|
})
|
|
94
101
|
]
|
|
@@ -7,8 +7,10 @@ var Head = require('next/head');
|
|
|
7
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
|
+
var Header = require('../components/Header.js');
|
|
11
|
+
var FooterForPostPurchase = require('../components/FooterForPostPurchase.js');
|
|
10
12
|
|
|
11
|
-
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle })=>{
|
|
13
|
+
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, isPostPurchase, shopName })=>{
|
|
12
14
|
const router$1 = router.useRouter();
|
|
13
15
|
useTrackingView.useTrackingView(shopToken, pageHandle, router$1.isFallback);
|
|
14
16
|
if (router$1.isFallback) {
|
|
@@ -62,19 +64,28 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
|
|
|
62
64
|
]
|
|
63
65
|
}),
|
|
64
66
|
/*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
|
|
65
|
-
children: /*#__PURE__*/ jsxRuntime.
|
|
67
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(core.BuilderComponentProvider, {
|
|
66
68
|
components: components,
|
|
67
|
-
children:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
children: [
|
|
70
|
+
isPostPurchase && /*#__PURE__*/ jsxRuntime.jsx(Header.default, {
|
|
71
|
+
pageType: "POST_PURCHASE"
|
|
72
|
+
}),
|
|
73
|
+
/*#__PURE__*/ jsxRuntime.jsx(core.SectionProvider, {
|
|
74
|
+
data: sectionData,
|
|
75
|
+
children: builderData?.map((builder)=>/*#__PURE__*/ jsxRuntime.jsx(core.BuilderProvider, {
|
|
76
|
+
state: builder.data,
|
|
77
|
+
lazy: builder.lazy,
|
|
78
|
+
priority: builder.priority,
|
|
79
|
+
isPostPurchase: isPostPurchase,
|
|
80
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core.Render, {
|
|
81
|
+
uid: builder.uid
|
|
82
|
+
})
|
|
83
|
+
}, builder.uid))
|
|
84
|
+
}),
|
|
85
|
+
isPostPurchase && /*#__PURE__*/ jsxRuntime.jsx(FooterForPostPurchase.default, {
|
|
86
|
+
shopName: shopName || ''
|
|
87
|
+
})
|
|
88
|
+
]
|
|
78
89
|
})
|
|
79
90
|
})
|
|
80
91
|
]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useShopStore, cls, makeStyleResponsive } from '@gem-sdk/core';
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
|
|
@@ -8,7 +8,10 @@ const defaultMargin = {
|
|
|
8
8
|
mobile: '40px'
|
|
9
9
|
};
|
|
10
10
|
const FOOTER_OFF_COLOR = '#F4F4F4';
|
|
11
|
-
const Footer = ()=>{
|
|
11
|
+
const Footer = (props)=>{
|
|
12
|
+
const { pageType } = props;
|
|
13
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
14
|
+
const shopName = urlParams.get('storefrontHandle');
|
|
12
15
|
const layoutSetting = useShopStore((s)=>s.layoutSettings);
|
|
13
16
|
const [shouldFixed, setShouldFixed] = useState(false);
|
|
14
17
|
useEffect(()=>{
|
|
@@ -32,88 +35,107 @@ const Footer = ()=>{
|
|
|
32
35
|
}, [
|
|
33
36
|
layoutSetting
|
|
34
37
|
]);
|
|
35
|
-
return /*#__PURE__*/ jsx(
|
|
36
|
-
|
|
37
|
-
'gp-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
/*#__PURE__*/ jsxs("svg", {
|
|
48
|
-
width: "192",
|
|
49
|
-
height: "8",
|
|
50
|
-
viewBox: "0 0 192 8",
|
|
51
|
-
fill: "none",
|
|
52
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
38
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
39
|
+
children: pageType === 'POST_PURCHASE' ? /*#__PURE__*/ jsx("div", {
|
|
40
|
+
className: cls('gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE] gp-bg-white gp-font-sans'),
|
|
41
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
42
|
+
className: "gp-flex gp-flex-1 gp-items-center gp-justify-between gp-py-6",
|
|
43
|
+
style: {
|
|
44
|
+
maxWidth: `var(--g-ct-w)`,
|
|
45
|
+
...makeStyleResponsive('ml', defaultMargin),
|
|
46
|
+
...makeStyleResponsive('mr', defaultMargin)
|
|
47
|
+
},
|
|
48
|
+
children: /*#__PURE__*/ jsxs("p", {
|
|
49
|
+
className: "gp-text-lg",
|
|
53
50
|
children: [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
fill: layoutSetting?.showFooter ? '#D6D6D6' : FOOTER_OFF_COLOR
|
|
57
|
-
}),
|
|
58
|
-
/*#__PURE__*/ jsx("path", {
|
|
59
|
-
d: "M68 4C68 1.79086 69.7909 0 72 0H120C122.209 0 124 1.79086 124 4C124 6.20914 122.209 8 120 8H72C69.7909 8 68 6.20914 68 4Z",
|
|
60
|
-
fill: layoutSetting?.showFooter ? '#D6D6D6' : FOOTER_OFF_COLOR
|
|
61
|
-
}),
|
|
62
|
-
/*#__PURE__*/ jsx("path", {
|
|
63
|
-
d: "M136 4C136 1.79086 137.791 0 140 0H188C190.209 0 192 1.79086 192 4C192 6.20914 190.209 8 188 8H140C137.791 8 136 6.20914 136 4Z",
|
|
64
|
-
fill: layoutSetting?.showFooter ? '#D6D6D6' : FOOTER_OFF_COLOR
|
|
65
|
-
})
|
|
51
|
+
"All rights reserved ",
|
|
52
|
+
shopName
|
|
66
53
|
]
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
}) : /*#__PURE__*/ jsx("div", {
|
|
57
|
+
className: cls('gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE] gp-bg-white gp-font-sans', {
|
|
58
|
+
'gp-fixed gp-bottom-0 gp-w-full': shouldFixed
|
|
59
|
+
}),
|
|
60
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
61
|
+
className: "gp-flex gp-h-[40px] gp-flex-1 gp-items-center gp-justify-between",
|
|
62
|
+
style: {
|
|
63
|
+
maxWidth: `var(--g-ct-w)`,
|
|
64
|
+
...makeStyleResponsive('ml', defaultMargin),
|
|
65
|
+
...makeStyleResponsive('mr', defaultMargin)
|
|
66
|
+
},
|
|
67
|
+
children: [
|
|
68
|
+
/*#__PURE__*/ jsxs("svg", {
|
|
69
|
+
width: "192",
|
|
70
|
+
height: "8",
|
|
71
|
+
viewBox: "0 0 192 8",
|
|
72
|
+
fill: "none",
|
|
73
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
74
|
+
children: [
|
|
75
|
+
/*#__PURE__*/ jsx("path", {
|
|
76
|
+
d: "M0 4C0 1.79086 1.79086 0 4 0H52C54.2091 0 56 1.79086 56 4C56 6.20914 54.2091 8 52 8H4C1.79086 8 0 6.20914 0 4Z",
|
|
77
|
+
fill: layoutSetting?.showFooter ? '#D6D6D6' : FOOTER_OFF_COLOR
|
|
78
|
+
}),
|
|
79
|
+
/*#__PURE__*/ jsx("path", {
|
|
80
|
+
d: "M68 4C68 1.79086 69.7909 0 72 0H120C122.209 0 124 1.79086 124 4C124 6.20914 122.209 8 120 8H72C69.7909 8 68 6.20914 68 4Z",
|
|
81
|
+
fill: layoutSetting?.showFooter ? '#D6D6D6' : FOOTER_OFF_COLOR
|
|
82
|
+
}),
|
|
83
|
+
/*#__PURE__*/ jsx("path", {
|
|
84
|
+
d: "M136 4C136 1.79086 137.791 0 140 0H188C190.209 0 192 1.79086 192 4C192 6.20914 190.209 8 188 8H140C137.791 8 136 6.20914 136 4Z",
|
|
85
|
+
fill: layoutSetting?.showFooter ? '#D6D6D6' : FOOTER_OFF_COLOR
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
}),
|
|
89
|
+
/*#__PURE__*/ jsx("div", {
|
|
90
|
+
className: "gp-footer gp-invisible gp-absolute gp-left-[8px] gp-flex gp-h-[24px] gp-w-[24px] gp-cursor-pointer gp-items-center gp-justify-center gp-rounded gp-bg-[#EEEEEE] gp-p-[4px] hover:gp-bg-[#0000001a] group-hover:gp-visible",
|
|
91
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
92
|
+
className: "gp-flex gp-h-[24px] gp-w-[24px] gp-items-center gp-justify-center",
|
|
93
|
+
children: /*#__PURE__*/ jsxs("svg", {
|
|
94
|
+
width: "14",
|
|
95
|
+
height: "14",
|
|
96
|
+
viewBox: "0 0 14 14",
|
|
97
|
+
fill: "none",
|
|
98
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
99
|
+
children: [
|
|
100
|
+
/*#__PURE__*/ jsx("path", {
|
|
101
|
+
fillRule: "evenodd",
|
|
102
|
+
clipRule: "evenodd",
|
|
103
|
+
d: "M6.99985 4.08501C5.38983 4.08501 4.08465 5.39019 4.08465 7.00021C4.08465 8.61023 5.38983 9.9154 6.99985 9.9154C8.60987 9.9154 9.91504 8.61023 9.91504 7.00021C9.91504 5.39019 8.60987 4.08501 6.99985 4.08501ZM5.08465 7.00021C5.08465 5.94247 5.94211 5.08501 6.99985 5.08501C8.05758 5.08501 8.91504 5.94247 8.91504 7.00021C8.91504 8.05794 8.05758 8.9154 6.99985 8.9154C5.94211 8.9154 5.08465 8.05794 5.08465 7.00021Z",
|
|
104
|
+
fill: "#212121"
|
|
105
|
+
}),
|
|
106
|
+
/*#__PURE__*/ jsx("path", {
|
|
107
|
+
fillRule: "evenodd",
|
|
108
|
+
clipRule: "evenodd",
|
|
109
|
+
d: "M5.52351 0.00390625C5.28138 0.00390625 5.07405 0.177388 5.03135 0.415715L4.7415 2.03321C4.40346 2.18248 4.08346 2.36419 3.78558 2.57432L2.18557 2.00147C1.95684 1.91958 1.70235 2.01395 1.58232 2.22517L0.122204 4.79451C0.00217064 5.00572 0.0513362 5.27266 0.238747 5.42725L1.50086 6.46836C1.48358 6.64355 1.47474 6.82106 1.47474 7.00047C1.47474 7.17981 1.48357 7.35726 1.50084 7.53238L0.238747 8.57347C0.0513362 8.72806 0.00217064 8.995 0.122203 9.20622L1.58232 11.7756C1.70235 11.9868 1.95684 12.0811 2.18557 11.9993L3.78537 11.4265C4.08332 11.6367 4.40341 11.8185 4.74155 11.9678L5.03135 13.585C5.07405 13.8233 5.28138 13.9968 5.52351 13.9968H8.47647C8.7186 13.9968 8.92593 13.8233 8.96863 13.585L9.25846 11.9676C9.5965 11.8183 9.91649 11.6365 10.2144 11.4264L11.8144 11.9993C12.0431 12.0811 12.2976 11.9868 12.4177 11.7756L13.8778 9.20622C13.9978 8.995 13.9486 8.72806 13.7612 8.57347L12.4988 7.5321C12.516 7.35706 12.5249 7.17971 12.5249 7.00047C12.5249 6.82116 12.516 6.64375 12.4988 6.46864L13.7612 5.42725C13.9486 5.27266 13.9978 5.00572 13.8778 4.79451L12.4177 2.22517C12.2976 2.01395 12.0431 1.91958 11.8144 2.00147L10.2141 2.57441C9.91636 2.36433 9.59645 2.18264 9.25851 2.0334L8.96863 0.415715C8.92593 0.177389 8.7186 0.00390625 8.47647 0.00390625H5.52351ZM5.67747 2.47943L5.94187 1.00391H8.0581L8.32253 2.47958C8.35348 2.6523 8.47271 2.79616 8.63668 2.85863C9.06768 3.02283 9.46674 3.25007 9.82215 3.5288C9.95734 3.63483 10.1375 3.66402 10.2993 3.6061L11.7559 3.08459L12.8007 4.92323L11.6503 5.8722C11.5145 5.98427 11.4476 6.15956 11.4743 6.33366C11.5076 6.55089 11.5249 6.77354 11.5249 7.00047C11.5249 7.22735 11.5076 7.44993 11.4743 7.66711C11.4476 7.8412 11.5145 8.01648 11.6504 8.12855L12.8007 9.07749L11.7559 10.9161L10.2994 10.3947C10.1377 10.3368 9.95752 10.366 9.82233 10.472C9.46686 10.7508 9.06773 10.9781 8.63664 11.1423C8.47267 11.2048 8.35344 11.3487 8.32249 11.5214L8.0581 12.9968H5.94187L5.67752 11.5215C5.64656 11.3488 5.52732 11.2049 5.36333 11.1425C4.93215 10.9782 4.53292 10.7509 4.17738 10.4721C4.04219 10.3661 3.86203 10.3369 3.70027 10.3948L2.24412 10.9161L1.19924 9.07749L2.34929 8.12883C2.48516 8.01675 2.55204 7.84146 2.52535 7.66736C2.49205 7.4501 2.47474 7.22743 2.47474 7.00047C2.47474 6.77345 2.49206 6.55072 2.52538 6.33341C2.55207 6.15931 2.48519 5.984 2.34932 5.87192L1.19924 4.92323L2.24412 3.08459L3.70047 3.60601C3.86221 3.66392 4.04236 3.63474 4.17755 3.52872C4.53304 3.24994 4.93219 3.02269 5.36329 2.85849C5.52728 2.79603 5.64652 2.65216 5.67747 2.47943Z",
|
|
110
|
+
fill: "#212121"
|
|
111
|
+
})
|
|
112
|
+
]
|
|
113
|
+
})
|
|
92
114
|
})
|
|
115
|
+
}),
|
|
116
|
+
/*#__PURE__*/ jsxs("svg", {
|
|
117
|
+
width: "82",
|
|
118
|
+
height: "8",
|
|
119
|
+
viewBox: "0 0 82 8",
|
|
120
|
+
fill: "none",
|
|
121
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
122
|
+
children: [
|
|
123
|
+
/*#__PURE__*/ jsx("path", {
|
|
124
|
+
d: "M0 4C0 1.79086 1.79086 0 4 0H18C20.2091 0 22 1.79086 22 4C22 6.20914 20.2091 8 18 8H4C1.79086 8 0 6.20914 0 4Z",
|
|
125
|
+
fill: layoutSetting?.showFooter ? '#D6D6D6' : FOOTER_OFF_COLOR
|
|
126
|
+
}),
|
|
127
|
+
/*#__PURE__*/ jsx("path", {
|
|
128
|
+
d: "M30 4C30 1.79086 31.7909 0 34 0H48C50.2091 0 52 1.79086 52 4C52 6.20914 50.2091 8 48 8H34C31.7909 8 30 6.20914 30 4Z",
|
|
129
|
+
fill: layoutSetting?.showFooter ? '#D6D6D6' : FOOTER_OFF_COLOR
|
|
130
|
+
}),
|
|
131
|
+
/*#__PURE__*/ jsx("path", {
|
|
132
|
+
d: "M60 4C60 1.79086 61.7909 0 64 0H78C80.2091 0 82 1.79086 82 4C82 6.20914 80.2091 8 78 8H64C61.7909 8 60 6.20914 60 4Z",
|
|
133
|
+
fill: layoutSetting?.showFooter ? '#D6D6D6' : FOOTER_OFF_COLOR
|
|
134
|
+
})
|
|
135
|
+
]
|
|
93
136
|
})
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
width: "82",
|
|
97
|
-
height: "8",
|
|
98
|
-
viewBox: "0 0 82 8",
|
|
99
|
-
fill: "none",
|
|
100
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
101
|
-
children: [
|
|
102
|
-
/*#__PURE__*/ jsx("path", {
|
|
103
|
-
d: "M0 4C0 1.79086 1.79086 0 4 0H18C20.2091 0 22 1.79086 22 4C22 6.20914 20.2091 8 18 8H4C1.79086 8 0 6.20914 0 4Z",
|
|
104
|
-
fill: layoutSetting?.showFooter ? '#D6D6D6' : FOOTER_OFF_COLOR
|
|
105
|
-
}),
|
|
106
|
-
/*#__PURE__*/ jsx("path", {
|
|
107
|
-
d: "M30 4C30 1.79086 31.7909 0 34 0H48C50.2091 0 52 1.79086 52 4C52 6.20914 50.2091 8 48 8H34C31.7909 8 30 6.20914 30 4Z",
|
|
108
|
-
fill: layoutSetting?.showFooter ? '#D6D6D6' : FOOTER_OFF_COLOR
|
|
109
|
-
}),
|
|
110
|
-
/*#__PURE__*/ jsx("path", {
|
|
111
|
-
d: "M60 4C60 1.79086 61.7909 0 64 0H78C80.2091 0 82 1.79086 82 4C82 6.20914 80.2091 8 78 8H64C61.7909 8 60 6.20914 60 4Z",
|
|
112
|
-
fill: layoutSetting?.showFooter ? '#D6D6D6' : FOOTER_OFF_COLOR
|
|
113
|
-
})
|
|
114
|
-
]
|
|
115
|
-
})
|
|
116
|
-
]
|
|
137
|
+
]
|
|
138
|
+
})
|
|
117
139
|
})
|
|
118
140
|
});
|
|
119
141
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { cls, makeStyleResponsive } from '@gem-sdk/core';
|
|
3
|
+
|
|
4
|
+
const defaultMargin = {
|
|
5
|
+
desktop: '40px',
|
|
6
|
+
tablet: '40px',
|
|
7
|
+
mobile: '40px'
|
|
8
|
+
};
|
|
9
|
+
const FooterForPostPurchase = (props)=>{
|
|
10
|
+
return /*#__PURE__*/ jsx("div", {
|
|
11
|
+
className: cls('gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE] gp-bg-white gp-font-sans'),
|
|
12
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
13
|
+
className: "gp-flex gp-flex-1 gp-items-center gp-justify-between gp-py-6",
|
|
14
|
+
style: {
|
|
15
|
+
maxWidth: `var(--g-ct-w)`,
|
|
16
|
+
...makeStyleResponsive('ml', defaultMargin),
|
|
17
|
+
...makeStyleResponsive('mr', defaultMargin)
|
|
18
|
+
},
|
|
19
|
+
children: /*#__PURE__*/ jsxs("p", {
|
|
20
|
+
className: "gp-text-lg",
|
|
21
|
+
children: [
|
|
22
|
+
"All rights reserved ",
|
|
23
|
+
props.shopName
|
|
24
|
+
]
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { FooterForPostPurchase as default };
|