@gem-sdk/pages 2.0.0-staging.152 → 2.0.0-staging.709
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/FooterForPostPurchase.js +1 -1
- package/dist/cjs/components/builder/Footer.js +2 -2
- package/dist/cjs/components/builder/Header.js +0 -1
- package/dist/cjs/components/builder/Toolbar.js +6 -0
- package/dist/cjs/components/builder/Toolbox.js +27 -14
- package/dist/cjs/components/composable/getListFontWeightTypos.js +14 -0
- package/dist/cjs/components/image-to-layout/AddSectionImageToLayout.js +5 -4
- package/dist/cjs/components/image-to-layout/DropElement.js +34 -9
- package/dist/cjs/constants/index.js +15 -0
- package/dist/cjs/libs/api/get-home-page-props-v2.js +20 -8
- package/dist/cjs/libs/api/get-home-page-props.js +15 -3
- package/dist/cjs/libs/api/get-post-purchase-props-preview.js +38 -5
- package/dist/cjs/libs/api/get-static-page-props-preview.js +5 -0
- package/dist/cjs/libs/api/get-static-page-props-v2.js +19 -10
- package/dist/cjs/libs/api/get-static-page-props.js +16 -3
- package/dist/cjs/libs/google-fonts.js +25 -5
- package/dist/cjs/libs/helpers/gen-fonts.js +9 -3
- package/dist/cjs/libs/helpers/get-metafield.js +7 -0
- package/dist/cjs/libs/helpers/normalize.js +2 -1
- package/dist/cjs/libs/helpers/parse-json.js +1 -1
- package/dist/cjs/libs/helpers/sentry.js +17 -0
- package/dist/cjs/pages/404.js +1 -0
- package/dist/cjs/pages/500.js +1 -0
- package/dist/cjs/pages/CollectionGlobalProvider.js +1 -0
- package/dist/cjs/pages/builder.js +46 -41
- package/dist/cjs/pages/collection-detail.js +1 -0
- package/dist/cjs/pages/preview.js +1 -0
- package/dist/cjs/pages/product-detail.js +1 -0
- package/dist/cjs/pages/static-v2.js +22 -17
- package/dist/cjs/pages/static.js +1 -0
- package/dist/esm/components/FooterForPostPurchase.js +1 -1
- package/dist/esm/components/builder/Footer.js +2 -2
- package/dist/esm/components/builder/Header.js +1 -2
- package/dist/esm/components/builder/Toolbar.js +6 -0
- package/dist/esm/components/builder/Toolbox.js +27 -14
- package/dist/esm/components/composable/getListFontWeightTypos.js +12 -0
- package/dist/esm/components/image-to-layout/AddSectionImageToLayout.js +6 -5
- package/dist/esm/components/image-to-layout/DropElement.js +34 -9
- package/dist/esm/constants/index.js +15 -0
- package/dist/esm/libs/api/get-home-page-props-v2.js +21 -9
- package/dist/esm/libs/api/get-home-page-props.js +16 -4
- package/dist/esm/libs/api/get-post-purchase-props-preview.js +39 -6
- package/dist/esm/libs/api/get-static-page-props-preview.js +5 -0
- package/dist/esm/libs/api/get-static-page-props-v2.js +19 -10
- package/dist/esm/libs/api/get-static-page-props.js +17 -4
- package/dist/esm/libs/google-fonts.js +25 -5
- package/dist/esm/libs/helpers/gen-fonts.js +9 -3
- package/dist/esm/libs/helpers/get-metafield.js +5 -0
- package/dist/esm/libs/helpers/normalize.js +2 -1
- package/dist/esm/libs/helpers/parse-json.js +1 -1
- package/dist/esm/libs/helpers/sentry.js +15 -0
- package/dist/esm/pages/404.js +1 -0
- package/dist/esm/pages/500.js +1 -0
- package/dist/esm/pages/CollectionGlobalProvider.js +1 -0
- package/dist/esm/pages/builder.js +47 -42
- package/dist/esm/pages/collection-detail.js +1 -0
- package/dist/esm/pages/preview.js +1 -0
- package/dist/esm/pages/product-detail.js +1 -0
- package/dist/esm/pages/static-v2.js +23 -18
- package/dist/esm/pages/static.js +1 -0
- package/dist/types/index.d.ts +61 -53
- package/package.json +6 -6
|
@@ -8,6 +8,8 @@ import { parseBuilderTemplateV2, extractPageBackground } from '../helpers/normal
|
|
|
8
8
|
import { parseJson, serializableJson } from '../helpers/parse-json.js';
|
|
9
9
|
import { captureException } from '@sentry/nextjs';
|
|
10
10
|
import { getCustomFonts } from '../custom-fonts.js';
|
|
11
|
+
import { getPublishedThemePageMetafieldByKey } from '../helpers/get-metafield.js';
|
|
12
|
+
import { PublishedThemePageMetafields } from '../../constants/index.js';
|
|
11
13
|
|
|
12
14
|
const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
13
15
|
try {
|
|
@@ -31,7 +33,9 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
31
33
|
PublishedShopMetasDocument,
|
|
32
34
|
{
|
|
33
35
|
keys: [
|
|
34
|
-
'source_font'
|
|
36
|
+
'source_font',
|
|
37
|
+
PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,
|
|
38
|
+
PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL
|
|
35
39
|
]
|
|
36
40
|
}
|
|
37
41
|
])
|
|
@@ -54,24 +58,29 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
54
58
|
getCustomFonts(themePageCustomFonts)
|
|
55
59
|
]);
|
|
56
60
|
const mobileOnly = dataBuilder.isMobile ?? false;
|
|
57
|
-
const description = dataBuilder?.
|
|
58
|
-
const
|
|
61
|
+
const description = getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value;
|
|
62
|
+
const title = getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.GLOBAL_META_TITLE, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === PublishedThemePageMetafields.GLOBAL_META_TITLE)?.value;
|
|
63
|
+
const thumbnail = parseJson(getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value);
|
|
64
|
+
const noindex = getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.NOINDEX_KEY, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === PublishedThemePageMetafields.NOINDEX_KEY)?.value;
|
|
65
|
+
const nofollow = getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.NOFOLLOW_KEY, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === PublishedThemePageMetafields.NOFOLLOW_KEY)?.value;
|
|
59
66
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
60
67
|
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
61
68
|
const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
|
|
62
69
|
const seo = {
|
|
63
70
|
defaultTitle: shopMeta?.shop.name,
|
|
64
|
-
title: dataBuilder?.name,
|
|
71
|
+
title: title || dataBuilder?.name,
|
|
65
72
|
description: description ?? shopMeta?.shop.description,
|
|
66
73
|
openGraph: {
|
|
67
74
|
site_name: shopMeta?.shop.name,
|
|
68
75
|
locale: shopMeta?.localization.country.isoCode,
|
|
69
|
-
title: dataBuilder?.name ?? shopMeta?.shop.name,
|
|
76
|
+
title: (title || dataBuilder?.name) ?? shopMeta?.shop.name,
|
|
70
77
|
description: description ?? shopMeta?.shop.description,
|
|
71
78
|
images: thumbnail ? [
|
|
72
79
|
thumbnail
|
|
73
80
|
] : []
|
|
74
81
|
},
|
|
82
|
+
noindex: noindex === 'true',
|
|
83
|
+
nofollow: nofollow === 'true',
|
|
75
84
|
canonical: `https://${shopData?.storeProperty?.primaryDomain}/${slug}`,
|
|
76
85
|
additionalMetaTags: [
|
|
77
86
|
{
|
|
@@ -143,11 +152,11 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
143
152
|
swatches: parseJson(shopData?.storeProperty?.swatchesConfig),
|
|
144
153
|
seo,
|
|
145
154
|
mobileOnly,
|
|
146
|
-
gaTrackingId: dataBuilder
|
|
147
|
-
facebookPixelId: dataBuilder
|
|
148
|
-
tiktokPixelId: dataBuilder
|
|
149
|
-
customCodeHeader: dataBuilder
|
|
150
|
-
customCodeBody: dataBuilder
|
|
155
|
+
gaTrackingId: getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.ANALYTICS_GA_TRACKING_ID, dataBuilder?.metafields) ?? null,
|
|
156
|
+
facebookPixelId: getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.ANALYTICS_FB_PIXEL_ID, dataBuilder?.metafields) ?? null,
|
|
157
|
+
tiktokPixelId: getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.ANALYTICS_TIKTOK_PIXEL_ID, dataBuilder?.metafields) ?? null,
|
|
158
|
+
customCodeHeader: getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.CUSTOM_CODE_HEADER, dataBuilder?.metafields) ?? null,
|
|
159
|
+
customCodeBody: getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.CUSTOM_CODE_BODY, dataBuilder?.metafields) ?? null,
|
|
151
160
|
pageHandle: dataBuilder.handle ?? null,
|
|
152
161
|
customFonts,
|
|
153
162
|
interaction: dataBuilder?.interaction,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { PublishedThemePagesDocument, StorePropertyDocument, prefetchQueries } from '@gem-sdk/core';
|
|
1
|
+
import { PublishedThemePagesDocument, StorePropertyDocument, PublishedShopMetasDocument, prefetchQueries } from '@gem-sdk/core';
|
|
2
2
|
import { ShopMetaDocument } from '@gem-sdk/adapter-shopify';
|
|
3
3
|
import { getFontFromGlobalStyle } from '../google-fonts.js';
|
|
4
4
|
import { genCSS } from '../helpers/gen-css.js';
|
|
5
5
|
import { generateManifest } from '../helpers/generate-manifres.js';
|
|
6
6
|
import { parseBuilderTemplate } from '../helpers/normalize.js';
|
|
7
7
|
import { parseJson, serializableJson } from '../helpers/parse-json.js';
|
|
8
|
+
import { PublishedThemePageMetafields } from '../../constants/index.js';
|
|
9
|
+
import { getPublishedThemePageMetafieldByKey } from '../helpers/get-metafield.js';
|
|
8
10
|
|
|
9
11
|
const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
10
12
|
const pageType = 'STATIC';
|
|
@@ -12,7 +14,7 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
12
14
|
slug,
|
|
13
15
|
slugType: pageType
|
|
14
16
|
};
|
|
15
|
-
const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
|
|
17
|
+
const [theme, storeProperty, shopifyMeta, publishedShopMetas] = await Promise.allSettled([
|
|
16
18
|
fetcher([
|
|
17
19
|
PublishedThemePagesDocument,
|
|
18
20
|
variables
|
|
@@ -22,6 +24,16 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
22
24
|
]),
|
|
23
25
|
shopifyFetcher([
|
|
24
26
|
ShopMetaDocument
|
|
27
|
+
]),
|
|
28
|
+
fetcher([
|
|
29
|
+
PublishedShopMetasDocument,
|
|
30
|
+
{
|
|
31
|
+
keys: [
|
|
32
|
+
'source_font',
|
|
33
|
+
PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,
|
|
34
|
+
PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL
|
|
35
|
+
]
|
|
36
|
+
}
|
|
25
37
|
])
|
|
26
38
|
]);
|
|
27
39
|
if (theme.status === 'rejected') {
|
|
@@ -29,6 +41,7 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
29
41
|
pageType
|
|
30
42
|
};
|
|
31
43
|
}
|
|
44
|
+
const publishedShopMetaValue = publishedShopMetas.status === 'fulfilled' ? publishedShopMetas.value : undefined;
|
|
32
45
|
const dataBuilder = theme.value.publishedThemePages?.[0];
|
|
33
46
|
const pageTemplate = parseBuilderTemplate(dataBuilder);
|
|
34
47
|
const fontStyle = await getFontFromGlobalStyle(dataBuilder?.pageStyle?.data);
|
|
@@ -53,8 +66,8 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
53
66
|
}
|
|
54
67
|
return acc;
|
|
55
68
|
}, {});
|
|
56
|
-
const description = dataBuilder?.
|
|
57
|
-
const thumbnail = parseJson(dataBuilder?.
|
|
69
|
+
const description = getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value;
|
|
70
|
+
const thumbnail = parseJson(getPublishedThemePageMetafieldByKey(PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value);
|
|
58
71
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
59
72
|
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
60
73
|
const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
|
|
@@ -34,7 +34,27 @@ const composeFonts = (fonts)=>{
|
|
|
34
34
|
};
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
|
-
const
|
|
37
|
+
const handleGenerateFontParams = (variants, fontType = 'google')=>{
|
|
38
|
+
const regularWeights = [];
|
|
39
|
+
if (!variants.length) {
|
|
40
|
+
return fontType === 'bunny' ? '400' : 'wght@400';
|
|
41
|
+
}
|
|
42
|
+
// Get regular weights and remove italic variants
|
|
43
|
+
variants.forEach((variant)=>{
|
|
44
|
+
if (typeof variant !== 'string' || variant?.includes('italic')) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const weight = variant === 'regular' ? '400' : variant;
|
|
48
|
+
regularWeights.push(weight);
|
|
49
|
+
});
|
|
50
|
+
// Sort weights numerically (ex: [900, 700, 400] -> [400, 700, 900])
|
|
51
|
+
const sortedRegularWeights = regularWeights.sort((a, b)=>Number(a) - Number(b));
|
|
52
|
+
// Build the variant string with only regular weights
|
|
53
|
+
const axisPrefix = 'wght@';
|
|
54
|
+
const listVariantsGoogleFonts = sortedRegularWeights.map((weight)=>weight);
|
|
55
|
+
return fontType === 'google' ? `${axisPrefix}${listVariantsGoogleFonts.join(';')}` : sortedRegularWeights.join(',');
|
|
56
|
+
};
|
|
57
|
+
const createFontUrl = (fonts, option, fontType = 'google')=>{
|
|
38
58
|
const mainFonts = fonts.filter((font)=>{
|
|
39
59
|
return !([
|
|
40
60
|
'bunny',
|
|
@@ -48,8 +68,8 @@ const createFontUrl = (fonts, option, fontType)=>{
|
|
|
48
68
|
return index === arr.findIndex((t)=>t.family === font.family);
|
|
49
69
|
});
|
|
50
70
|
const family = composeFonts(uniqFonts).map((font)=>{
|
|
51
|
-
return `${font.family.replace(/ /g, '+')}:${font.variants
|
|
52
|
-
}).join('|');
|
|
71
|
+
return `${font.family.replace(/ /g, '+')}:${handleGenerateFontParams(font.variants, fontType)}`;
|
|
72
|
+
}).join(fontType === 'google' ? '&family=' : '|');
|
|
53
73
|
params.append('family', family);
|
|
54
74
|
params.append('display', display);
|
|
55
75
|
if (option?.subset) {
|
|
@@ -59,7 +79,7 @@ const createFontUrl = (fonts, option, fontType)=>{
|
|
|
59
79
|
params.append('effect', option.effect);
|
|
60
80
|
}
|
|
61
81
|
const bunnyFontUrl = `https://fonts.bunny.net/css?family=${family}`;
|
|
62
|
-
const googleFontUrl = `https://fonts.googleapis.com/
|
|
82
|
+
const googleFontUrl = `https://fonts.googleapis.com/css2?${decodeURIComponent(params.toString())}`;
|
|
63
83
|
return fontType === 'bunny' ? bunnyFontUrl : googleFontUrl;
|
|
64
84
|
};
|
|
65
85
|
// eslint-disable-next-line max-params
|
|
@@ -85,7 +105,7 @@ async function getFonts(fonts, option, isImportFontByUrl = true, fontType) {
|
|
|
85
105
|
}
|
|
86
106
|
}
|
|
87
107
|
return value;
|
|
88
|
-
} catch (
|
|
108
|
+
} catch (_e) {
|
|
89
109
|
return '';
|
|
90
110
|
}
|
|
91
111
|
}
|
|
@@ -33,6 +33,9 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
+
const uniqueArray = (arr)=>{
|
|
37
|
+
return Array.from(new Set(arr));
|
|
38
|
+
};
|
|
36
39
|
const getFontValue = (fonts, value)=>{
|
|
37
40
|
let customFontFamily = value.custom?.fontFamily;
|
|
38
41
|
if (typeof customFontFamily === 'string') {
|
|
@@ -58,15 +61,18 @@ const getFontValue = (fonts, value)=>{
|
|
|
58
61
|
});
|
|
59
62
|
const customFontWeight = value.custom?.fontWeight && variants.includes(value.custom?.fontWeight) ? value.custom?.fontWeight : variants[0];
|
|
60
63
|
if (customFontWeight) {
|
|
64
|
+
const fontVariants = uniqueArray([
|
|
65
|
+
customFontWeight,
|
|
66
|
+
...value?.attrs?.isAlwaysLoadBold ? [
|
|
67
|
+
'700'
|
|
68
|
+
] : []
|
|
69
|
+
]);
|
|
61
70
|
const isExist = fonts.find((item)=>item.family == fontFamily && item.variants.includes(customFontWeight));
|
|
62
71
|
if (!isExist) {
|
|
63
72
|
const isFontFamily = fonts.find((item)=>item.family == fontFamily);
|
|
64
73
|
if (isFontFamily) {
|
|
65
74
|
isFontFamily.variants.push(customFontWeight);
|
|
66
75
|
} else {
|
|
67
|
-
const fontVariants = [
|
|
68
|
-
customFontWeight
|
|
69
|
-
];
|
|
70
76
|
if (customFontWeight !== '700') {
|
|
71
77
|
if (variants.includes('700')) {
|
|
72
78
|
fontVariants.push('700'); // Auto add 700 for bold in editor inline
|
|
@@ -72,7 +72,8 @@ function normalizePageSectionResponseV2(sections, orders) {
|
|
|
72
72
|
const parseBuilderTemplateV2 = (data)=>{
|
|
73
73
|
return normalizePageSectionResponseV2([
|
|
74
74
|
...data?.pageSections ?? [],
|
|
75
|
-
...data?.themePageCustomSections ?? []
|
|
75
|
+
...data?.themePageCustomSections ?? [],
|
|
76
|
+
...data?.themeSections ?? []
|
|
76
77
|
], data?.sectionPosition);
|
|
77
78
|
};
|
|
78
79
|
const parseBuilderTemplate = (data)=>{
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { withScope, captureMessage } from '@sentry/nextjs';
|
|
2
|
+
|
|
3
|
+
const sentryCaptureException = (funcName, message, data, options)=>{
|
|
4
|
+
withScope((scope)=>{
|
|
5
|
+
scope.setLevel(options?.level ?? 'log');
|
|
6
|
+
if (options?.tag) {
|
|
7
|
+
scope.setTag(options?.tag.key, options?.tag.value);
|
|
8
|
+
}
|
|
9
|
+
scope.setExtra('function', funcName);
|
|
10
|
+
scope.setExtra('data', JSON.stringify(data));
|
|
11
|
+
captureMessage(`${funcName}: ${message}`);
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { sentryCaptureException };
|
package/dist/esm/pages/404.js
CHANGED
package/dist/esm/pages/500.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { PageProvider, BuilderComponentProvider, SectionProvider, BuilderPreviewProvider } from '@gem-sdk/core';
|
|
3
|
+
import { useI18n, PageProvider, BuilderComponentProvider, SectionProvider, I18nProvider, BuilderPreviewProvider } from '@gem-sdk/core';
|
|
3
4
|
import { NextSeo } from 'next-seo';
|
|
4
5
|
import Head from 'next/head';
|
|
5
6
|
import { useState, useMemo, useEffect } from 'react';
|
|
@@ -15,6 +16,7 @@ import Body from '../components/builder/Body.js';
|
|
|
15
16
|
|
|
16
17
|
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, pageName, isOriginTemplate })=>{
|
|
17
18
|
const [loadSuccess, setLoadSuccess] = useState(false);
|
|
19
|
+
const { t } = useI18n();
|
|
18
20
|
const isDisableHeaderFooter = ()=>{
|
|
19
21
|
return isThemeSectionEditor;
|
|
20
22
|
};
|
|
@@ -62,47 +64,50 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
|
|
|
62
64
|
components: components,
|
|
63
65
|
children: /*#__PURE__*/ jsx(SectionProvider, {
|
|
64
66
|
data: sectionData,
|
|
65
|
-
children: /*#__PURE__*/
|
|
66
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
67
|
+
children: /*#__PURE__*/ jsx(I18nProvider, {
|
|
68
|
+
t: t,
|
|
69
|
+
children: /*#__PURE__*/ jsxs(BuilderPreviewProvider, {
|
|
70
|
+
pageName: pageName,
|
|
71
|
+
state: initState,
|
|
72
|
+
isThemeSectionEditor: isThemeSectionEditor,
|
|
73
|
+
children: [
|
|
74
|
+
/*#__PURE__*/ jsx(Toolbox, {}),
|
|
75
|
+
!hiddenToolbar && /*#__PURE__*/ jsx(Toolbar, {}),
|
|
76
|
+
/*#__PURE__*/ jsx(PopupManager, {}),
|
|
77
|
+
loadSuccess && /*#__PURE__*/ jsxs("div", {
|
|
78
|
+
className: "builder gp-z-1 gp-relative",
|
|
79
|
+
children: [
|
|
80
|
+
!hiddenToolbar && (isDisableHeaderFooter() ? /*#__PURE__*/ jsx("div", {
|
|
81
|
+
className: "gp-h-[40px] gp-bg-[#ffffff] gp-border-b-[1px] gp-border-[#eeeeee]",
|
|
82
|
+
children: /*#__PURE__*/ jsx(Devices, {})
|
|
83
|
+
}) : /*#__PURE__*/ jsx(Header, {
|
|
84
|
+
pageType: pageType,
|
|
85
|
+
isOriginTemplate: isOriginTemplate,
|
|
86
|
+
openPageSetting: openPageSetting
|
|
87
|
+
})),
|
|
88
|
+
/*#__PURE__*/ jsx(Body, {
|
|
89
|
+
pageType: pageType,
|
|
90
|
+
isThemeSectionEditor: isThemeSectionEditor
|
|
91
|
+
}),
|
|
92
|
+
/*#__PURE__*/ jsx(ImageToLayout, {
|
|
93
|
+
editorImageToLayout: editorImageToLayout || false
|
|
94
|
+
}),
|
|
95
|
+
/*#__PURE__*/ jsx(AddSectionImageToLayout, {
|
|
96
|
+
editorImageToLayout: editorImageToLayout || false
|
|
97
|
+
}),
|
|
98
|
+
/*#__PURE__*/ jsx("div", {
|
|
99
|
+
id: "visual-content"
|
|
100
|
+
}),
|
|
101
|
+
!isDisableHeaderFooter() && !hiddenToolbar && /*#__PURE__*/ jsx(Footer, {
|
|
102
|
+
pageType: pageType,
|
|
103
|
+
isOriginTemplate: isOriginTemplate,
|
|
104
|
+
openPageSetting: openPageSetting
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
}, "preview")
|
|
110
|
+
})
|
|
106
111
|
})
|
|
107
112
|
})
|
|
108
113
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { PageProvider, BuilderComponentProvider, SectionProvider, BuilderProvider, Render } from '@gem-sdk/core';
|
|
2
|
+
import { useI18n, PageProvider, BuilderComponentProvider, SectionProvider, I18nProvider, BuilderProvider, Render } from '@gem-sdk/core';
|
|
3
3
|
import { NextSeo } from 'next-seo';
|
|
4
4
|
import Head from 'next/head';
|
|
5
5
|
import { useRouter } from 'next/router';
|
|
@@ -10,8 +10,9 @@ import FooterForPostPurchase from '../components/FooterForPostPurchase.js';
|
|
|
10
10
|
import Script from 'next/script';
|
|
11
11
|
import { useEffect } from 'react';
|
|
12
12
|
|
|
13
|
-
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, isPreview, interaction, pageBackground })=>{
|
|
13
|
+
const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, dynamicDiscountOffer, isPreview, interaction, pageBackground })=>{
|
|
14
14
|
const router = useRouter();
|
|
15
|
+
const { t } = useI18n();
|
|
15
16
|
const baseAssetURL = process.env.NEXT_GP_BASE_ASSET_URL || 'https://d3kbi0je7pp4lw.cloudfront.net';
|
|
16
17
|
useTrackingView(shopToken, pageHandle, router.isFallback);
|
|
17
18
|
const customCodeHeaderID = 'custom-code-header';
|
|
@@ -91,6 +92,7 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
|
|
|
91
92
|
/*#__PURE__*/ jsx(PageProvider, {
|
|
92
93
|
productOffers: productOffers,
|
|
93
94
|
publicStoreFrontData: publicStoreFrontData,
|
|
95
|
+
dynamicDiscountOffer: dynamicDiscountOffer,
|
|
94
96
|
children: /*#__PURE__*/ jsx(BuilderComponentProvider, {
|
|
95
97
|
components: components,
|
|
96
98
|
children: /*#__PURE__*/ jsxs("div", {
|
|
@@ -106,22 +108,25 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
|
|
|
106
108
|
}),
|
|
107
109
|
/*#__PURE__*/ jsx(SectionProvider, {
|
|
108
110
|
data: sectionData,
|
|
109
|
-
children:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
111
|
+
children: /*#__PURE__*/ jsx(I18nProvider, {
|
|
112
|
+
t: t,
|
|
113
|
+
children: builderData?.map((builder)=>/*#__PURE__*/ jsxs(BuilderProvider, {
|
|
114
|
+
state: builder.data,
|
|
115
|
+
lazy: builder.lazy,
|
|
116
|
+
priority: builder.priority,
|
|
117
|
+
isPostPurchase: isPostPurchase,
|
|
118
|
+
isPreview: isPreview,
|
|
119
|
+
children: [
|
|
120
|
+
/*#__PURE__*/ jsx(Render, {
|
|
121
|
+
uid: builder.uid
|
|
122
|
+
}),
|
|
123
|
+
hasInteraction && /*#__PURE__*/ jsx(Script, {
|
|
124
|
+
defer: true,
|
|
125
|
+
src: `${baseAssetURL}/assets-v2/gp-flow-action-lip.js`
|
|
126
|
+
})
|
|
127
|
+
]
|
|
128
|
+
}, builder.uid))
|
|
129
|
+
})
|
|
125
130
|
}),
|
|
126
131
|
isPostPurchase && /*#__PURE__*/ jsx(FooterForPostPurchase, {
|
|
127
132
|
shopName: shopName || ''
|
package/dist/esm/pages/static.js
CHANGED