@gem-sdk/pages 2.0.0-dev.168 → 2.0.0-dev.184
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/builder/Header.js +1 -1
- package/dist/cjs/constants/index.js +12 -0
- package/dist/cjs/layouts/main.js +1 -1
- 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-static-page-props-preview.js +6 -5
- package/dist/cjs/libs/api/get-static-page-props-v2.js +12 -8
- package/dist/cjs/libs/api/get-static-page-props.js +16 -3
- package/dist/cjs/libs/helpers/get-metafield.js +7 -0
- package/dist/cjs/libs/parse-html.js +15 -23
- package/dist/cjs/pages/builder.js +22 -13
- package/dist/cjs/pages/collection-detail.js +40 -30
- package/dist/cjs/pages/product-detail.js +29 -17
- package/dist/cjs/pages/static-v2.js +79 -39
- package/dist/cjs/pages/static.js +44 -33
- package/dist/esm/components/builder/Header.js +1 -1
- package/dist/esm/constants/index.js +12 -0
- package/dist/esm/layouts/main.js +1 -1
- 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-static-page-props-preview.js +6 -5
- package/dist/esm/libs/api/get-static-page-props-v2.js +12 -8
- package/dist/esm/libs/api/get-static-page-props.js +17 -4
- package/dist/esm/libs/helpers/get-metafield.js +5 -0
- package/dist/esm/libs/parse-html.js +15 -23
- package/dist/esm/pages/builder.js +22 -13
- package/dist/esm/pages/collection-detail.js +41 -31
- package/dist/esm/pages/product-detail.js +30 -18
- package/dist/esm/pages/static-v2.js +80 -40
- package/dist/esm/pages/static.js +45 -34
- package/dist/types/index.d.ts +3 -3
- package/package.json +5 -5
|
@@ -122,7 +122,7 @@ const Header = (props)=>{
|
|
|
122
122
|
})
|
|
123
123
|
]
|
|
124
124
|
}),
|
|
125
|
-
!isOriginTemplate && /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
125
|
+
!(isOriginTemplate || pageType === 'STATIC') && /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
126
126
|
className: "gp-header gp-invisible gp-absolute gp-left-[8px] gp-flex gp-h-[24px] gp-cursor-pointer gp-items-center gp-justify-center gp-rounded gp-bg-[#EEEEEE] gp-p-[4px] hover:gp-bg-[#f4f4f4] group-hover:gp-visible",
|
|
127
127
|
onClick: openPageSetting,
|
|
128
128
|
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.PublishedThemePageMetafields = void 0;
|
|
4
|
+
(function(PublishedThemePageMetafields) {
|
|
5
|
+
PublishedThemePageMetafields["CUSTOM_CODE_HEADER"] = 'custom_code_header';
|
|
6
|
+
PublishedThemePageMetafields["CUSTOM_CODE_BODY"] = 'custom_code_body';
|
|
7
|
+
PublishedThemePageMetafields["ANALYTICS_GA_TRACKING_ID"] = 'analytics_ga_tracking_id';
|
|
8
|
+
PublishedThemePageMetafields["ANALYTICS_FB_PIXEL_ID"] = 'analytics_fb_pixel_id';
|
|
9
|
+
PublishedThemePageMetafields["ANALYTICS_TIKTOK_PIXEL_ID"] = 'analytics_tiktok_pixel_id';
|
|
10
|
+
PublishedThemePageMetafields["GLOBAL_META_DESCRIPTION"] = 'global-meta-description';
|
|
11
|
+
PublishedThemePageMetafields["GLOBAL_META_THUMBNAIL"] = 'global-meta-thumbnail';
|
|
12
|
+
})(exports.PublishedThemePageMetafields || (exports.PublishedThemePageMetafields = {}));
|
package/dist/cjs/layouts/main.js
CHANGED
|
@@ -11,7 +11,7 @@ const MainLayout = ({ children, ...props })=>{
|
|
|
11
11
|
const mobileOnly = core.useShopStore((s)=>s.mobileOnly);
|
|
12
12
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
13
13
|
children: [
|
|
14
|
-
parseHtml.parseHtml(props?.customCodeBody),
|
|
14
|
+
parseHtml.parseHtml('custom-code-body', props?.customCodeBody),
|
|
15
15
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
16
16
|
className: core.cls({
|
|
17
17
|
'gp-max-w-mobile gp-mx-auto gp-w-full': mobileOnly
|
|
@@ -9,13 +9,15 @@ var getFallback = require('../helpers/get-fallback.js');
|
|
|
9
9
|
var normalize = require('../helpers/normalize.js');
|
|
10
10
|
var parseJson = require('../helpers/parse-json.js');
|
|
11
11
|
var nextjs = require('@sentry/nextjs');
|
|
12
|
+
var index = require('../../constants/index.js');
|
|
13
|
+
var getMetafield = require('../helpers/get-metafield.js');
|
|
12
14
|
|
|
13
15
|
const getHomePagePropsV2 = (fetcher, shopifyFetcher)=>async ()=>{
|
|
14
16
|
try {
|
|
15
17
|
const variables = {
|
|
16
18
|
slugType: 'STATIC'
|
|
17
19
|
};
|
|
18
|
-
const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
|
|
20
|
+
const [theme, storeProperty, shopifyMeta, publishedShopMetas] = await Promise.allSettled([
|
|
19
21
|
fetcher([
|
|
20
22
|
core.PublishedThemePagesDocument,
|
|
21
23
|
variables
|
|
@@ -25,11 +27,21 @@ const getHomePagePropsV2 = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
25
27
|
]),
|
|
26
28
|
shopifyFetcher([
|
|
27
29
|
adapterShopify.ShopMetaDocument
|
|
30
|
+
]),
|
|
31
|
+
fetcher([
|
|
32
|
+
core.PublishedShopMetasDocument,
|
|
33
|
+
{
|
|
34
|
+
keys: [
|
|
35
|
+
index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,
|
|
36
|
+
index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL
|
|
37
|
+
]
|
|
38
|
+
}
|
|
28
39
|
])
|
|
29
40
|
]);
|
|
30
41
|
if (theme.status === 'rejected') {
|
|
31
42
|
throw new Error(theme.reason?.[0]);
|
|
32
43
|
}
|
|
44
|
+
const publishedShopMetaValue = publishedShopMetas.status === 'fulfilled' ? publishedShopMetas.value : undefined;
|
|
33
45
|
const dataBuilder = theme.value?.publishedThemePages?.[0];
|
|
34
46
|
if (!dataBuilder) {
|
|
35
47
|
throw new Error(`No data builder found for Home page`);
|
|
@@ -41,8 +53,8 @@ const getHomePagePropsV2 = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
41
53
|
getFallback.getFallbackV2(fetcher, homeTemplate)
|
|
42
54
|
]);
|
|
43
55
|
const mobileOnly = dataBuilder.isMobile ?? false;
|
|
44
|
-
const description = dataBuilder?.
|
|
45
|
-
const thumbnail = parseJson.parseJson(dataBuilder?.
|
|
56
|
+
const description = getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value;
|
|
57
|
+
const thumbnail = parseJson.parseJson(getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value);
|
|
46
58
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
47
59
|
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
48
60
|
const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
|
|
@@ -129,11 +141,11 @@ const getHomePagePropsV2 = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
129
141
|
swatches: parseJson.parseJson(shopData?.storeProperty?.swatchesConfig),
|
|
130
142
|
seo,
|
|
131
143
|
mobileOnly,
|
|
132
|
-
gaTrackingId: dataBuilder
|
|
133
|
-
facebookPixelId: dataBuilder
|
|
134
|
-
tiktokPixelId: dataBuilder
|
|
135
|
-
customCodeHeader: dataBuilder
|
|
136
|
-
customCodeBody: dataBuilder
|
|
144
|
+
gaTrackingId: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_GA_TRACKING_ID, dataBuilder?.metafields) ?? null,
|
|
145
|
+
facebookPixelId: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_FB_PIXEL_ID, dataBuilder?.metafields) ?? null,
|
|
146
|
+
tiktokPixelId: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_TIKTOK_PIXEL_ID, dataBuilder?.metafields) ?? null,
|
|
147
|
+
customCodeHeader: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_HEADER, dataBuilder?.metafields) ?? null,
|
|
148
|
+
customCodeBody: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_BODY, dataBuilder?.metafields) ?? null,
|
|
137
149
|
pageHandle: dataBuilder.handle ?? null
|
|
138
150
|
});
|
|
139
151
|
} catch (err) {
|
|
@@ -7,6 +7,8 @@ var genCss = require('../helpers/gen-css.js');
|
|
|
7
7
|
var generateManifres = require('../helpers/generate-manifres.js');
|
|
8
8
|
var normalize = require('../helpers/normalize.js');
|
|
9
9
|
var parseJson = require('../helpers/parse-json.js');
|
|
10
|
+
var index = require('../../constants/index.js');
|
|
11
|
+
var getMetafield = require('../helpers/get-metafield.js');
|
|
10
12
|
|
|
11
13
|
const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
12
14
|
const pageType = 'STATIC';
|
|
@@ -17,7 +19,7 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
17
19
|
// PublishedThemePagesDocument,
|
|
18
20
|
// variables,
|
|
19
21
|
// ]);
|
|
20
|
-
const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
|
|
22
|
+
const [theme, storeProperty, shopifyMeta, publishedShopMetas] = await Promise.allSettled([
|
|
21
23
|
fetcher([
|
|
22
24
|
core.PublishedThemePagesDocument,
|
|
23
25
|
variables
|
|
@@ -27,6 +29,15 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
27
29
|
]),
|
|
28
30
|
shopifyFetcher([
|
|
29
31
|
adapterShopify.ShopMetaDocument
|
|
32
|
+
]),
|
|
33
|
+
fetcher([
|
|
34
|
+
core.PublishedShopMetasDocument,
|
|
35
|
+
{
|
|
36
|
+
keys: [
|
|
37
|
+
index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,
|
|
38
|
+
index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL
|
|
39
|
+
]
|
|
40
|
+
}
|
|
30
41
|
])
|
|
31
42
|
]);
|
|
32
43
|
if (theme.status === 'rejected') {
|
|
@@ -34,6 +45,7 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
34
45
|
pageType
|
|
35
46
|
};
|
|
36
47
|
}
|
|
48
|
+
const publishedShopMetaValue = publishedShopMetas.status === 'fulfilled' ? publishedShopMetas.value : undefined;
|
|
37
49
|
const dataBuilder = theme.value.publishedThemePages?.[0];
|
|
38
50
|
const homeTemplate = normalize.parseBuilderTemplate(dataBuilder);
|
|
39
51
|
const fontStyle = await googleFonts.getFontFromGlobalStyle(dataBuilder?.pageStyle?.data);
|
|
@@ -58,8 +70,8 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
|
|
|
58
70
|
}
|
|
59
71
|
return acc;
|
|
60
72
|
}, {});
|
|
61
|
-
const description = dataBuilder?.
|
|
62
|
-
const thumbnail = parseJson.parseJson(dataBuilder?.
|
|
73
|
+
const description = getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value;
|
|
74
|
+
const thumbnail = parseJson.parseJson(getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value);
|
|
63
75
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
64
76
|
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
65
77
|
const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
|
|
@@ -45,7 +45,7 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
45
45
|
getFallback.getFallbackV2(fetcher, pageTemplate),
|
|
46
46
|
customFonts.getCustomFonts(themePageCustomFonts)
|
|
47
47
|
]);
|
|
48
|
-
const mobileOnly = dataBuilder.isMobile
|
|
48
|
+
const mobileOnly = !!dataBuilder.isMobile;
|
|
49
49
|
const description = dataBuilder?.dataSEO?.find((item)=>item?.key === 'global-meta-description')?.value;
|
|
50
50
|
const thumbnail = parseJson.parseJson(dataBuilder?.dataSEO?.find((item)=>item?.key === 'global-meta-thumbnail')?.value);
|
|
51
51
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
@@ -119,15 +119,15 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
119
119
|
};
|
|
120
120
|
const languageIsoCode = shopMeta?.localization.language.isoCode ?? null;
|
|
121
121
|
const countryIsoCode = shopMeta?.localization.country.isoCode ?? null;
|
|
122
|
-
const locale =
|
|
122
|
+
const locale = languageIsoCode && countryIsoCode ? `${languageIsoCode}-${countryIsoCode}` : null;
|
|
123
123
|
return parseJson.serializableJson({
|
|
124
124
|
themeStyle: genCss.genCSS(dataBuilder?.themeStyle?.data, mobileOnly),
|
|
125
125
|
fontStyle,
|
|
126
126
|
elementFontStyle,
|
|
127
127
|
builderData: pageTemplate,
|
|
128
128
|
pageType,
|
|
129
|
-
moneyFormat: shopMeta?.shop
|
|
130
|
-
currency: shopMeta?.localization
|
|
129
|
+
moneyFormat: shopMeta?.shop?.moneyFormat ?? null,
|
|
130
|
+
currency: shopMeta?.localization?.country?.currency?.isoCode ?? null,
|
|
131
131
|
languageIsoCode,
|
|
132
132
|
countryIsoCode,
|
|
133
133
|
locale,
|
|
@@ -143,7 +143,8 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
143
143
|
customCodeHeader: dataBuilder.customCode?.header ?? null,
|
|
144
144
|
customCodeBody: dataBuilder.customCode?.body ?? null,
|
|
145
145
|
customFonts: customFonts$1,
|
|
146
|
-
pageBackground: normalize.extractPageBackground(dataBuilder)
|
|
146
|
+
pageBackground: normalize.extractPageBackground(dataBuilder),
|
|
147
|
+
interaction: dataBuilder?.interaction
|
|
147
148
|
});
|
|
148
149
|
} catch (err) {
|
|
149
150
|
nextjs.captureException(err);
|
|
@@ -10,6 +10,8 @@ var normalize = require('../helpers/normalize.js');
|
|
|
10
10
|
var parseJson = require('../helpers/parse-json.js');
|
|
11
11
|
var nextjs = require('@sentry/nextjs');
|
|
12
12
|
var customFonts = require('../custom-fonts.js');
|
|
13
|
+
var getMetafield = require('../helpers/get-metafield.js');
|
|
14
|
+
var index = require('../../constants/index.js');
|
|
13
15
|
|
|
14
16
|
const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
15
17
|
try {
|
|
@@ -33,7 +35,9 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
33
35
|
core.PublishedShopMetasDocument,
|
|
34
36
|
{
|
|
35
37
|
keys: [
|
|
36
|
-
'source_font'
|
|
38
|
+
'source_font',
|
|
39
|
+
index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,
|
|
40
|
+
index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL
|
|
37
41
|
]
|
|
38
42
|
}
|
|
39
43
|
])
|
|
@@ -56,8 +60,8 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
56
60
|
customFonts.getCustomFonts(themePageCustomFonts)
|
|
57
61
|
]);
|
|
58
62
|
const mobileOnly = dataBuilder.isMobile ?? false;
|
|
59
|
-
const description = dataBuilder?.
|
|
60
|
-
const thumbnail = parseJson.parseJson(dataBuilder?.
|
|
63
|
+
const description = getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value;
|
|
64
|
+
const thumbnail = parseJson.parseJson(getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value);
|
|
61
65
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
62
66
|
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
63
67
|
const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
|
|
@@ -145,11 +149,11 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
145
149
|
swatches: parseJson.parseJson(shopData?.storeProperty?.swatchesConfig),
|
|
146
150
|
seo,
|
|
147
151
|
mobileOnly,
|
|
148
|
-
gaTrackingId: dataBuilder
|
|
149
|
-
facebookPixelId: dataBuilder
|
|
150
|
-
tiktokPixelId: dataBuilder
|
|
151
|
-
customCodeHeader: dataBuilder
|
|
152
|
-
customCodeBody: dataBuilder
|
|
152
|
+
gaTrackingId: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_GA_TRACKING_ID, dataBuilder?.metafields) ?? null,
|
|
153
|
+
facebookPixelId: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_FB_PIXEL_ID, dataBuilder?.metafields) ?? null,
|
|
154
|
+
tiktokPixelId: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_TIKTOK_PIXEL_ID, dataBuilder?.metafields) ?? null,
|
|
155
|
+
customCodeHeader: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_HEADER, dataBuilder?.metafields) ?? null,
|
|
156
|
+
customCodeBody: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_BODY, dataBuilder?.metafields) ?? null,
|
|
153
157
|
pageHandle: dataBuilder.handle ?? null,
|
|
154
158
|
customFonts: customFonts$1,
|
|
155
159
|
interaction: dataBuilder?.interaction,
|
|
@@ -7,6 +7,8 @@ var genCss = require('../helpers/gen-css.js');
|
|
|
7
7
|
var generateManifres = require('../helpers/generate-manifres.js');
|
|
8
8
|
var normalize = require('../helpers/normalize.js');
|
|
9
9
|
var parseJson = require('../helpers/parse-json.js');
|
|
10
|
+
var index = require('../../constants/index.js');
|
|
11
|
+
var getMetafield = require('../helpers/get-metafield.js');
|
|
10
12
|
|
|
11
13
|
const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
12
14
|
const pageType = 'STATIC';
|
|
@@ -14,7 +16,7 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
14
16
|
slug,
|
|
15
17
|
slugType: pageType
|
|
16
18
|
};
|
|
17
|
-
const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
|
|
19
|
+
const [theme, storeProperty, shopifyMeta, publishedShopMetas] = await Promise.allSettled([
|
|
18
20
|
fetcher([
|
|
19
21
|
core.PublishedThemePagesDocument,
|
|
20
22
|
variables
|
|
@@ -24,6 +26,16 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
24
26
|
]),
|
|
25
27
|
shopifyFetcher([
|
|
26
28
|
adapterShopify.ShopMetaDocument
|
|
29
|
+
]),
|
|
30
|
+
fetcher([
|
|
31
|
+
core.PublishedShopMetasDocument,
|
|
32
|
+
{
|
|
33
|
+
keys: [
|
|
34
|
+
'source_font',
|
|
35
|
+
index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,
|
|
36
|
+
index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL
|
|
37
|
+
]
|
|
38
|
+
}
|
|
27
39
|
])
|
|
28
40
|
]);
|
|
29
41
|
if (theme.status === 'rejected') {
|
|
@@ -31,6 +43,7 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
31
43
|
pageType
|
|
32
44
|
};
|
|
33
45
|
}
|
|
46
|
+
const publishedShopMetaValue = publishedShopMetas.status === 'fulfilled' ? publishedShopMetas.value : undefined;
|
|
34
47
|
const dataBuilder = theme.value.publishedThemePages?.[0];
|
|
35
48
|
const pageTemplate = normalize.parseBuilderTemplate(dataBuilder);
|
|
36
49
|
const fontStyle = await googleFonts.getFontFromGlobalStyle(dataBuilder?.pageStyle?.data);
|
|
@@ -55,8 +68,8 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
|
|
|
55
68
|
}
|
|
56
69
|
return acc;
|
|
57
70
|
}, {});
|
|
58
|
-
const description = dataBuilder?.
|
|
59
|
-
const thumbnail = parseJson.parseJson(dataBuilder?.
|
|
71
|
+
const description = getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value;
|
|
72
|
+
const thumbnail = parseJson.parseJson(getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value);
|
|
60
73
|
const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
|
|
61
74
|
const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
|
|
62
75
|
const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
|
|
@@ -2,35 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var parse = require('html-react-parser');
|
|
5
|
-
var Script = require('next/script');
|
|
6
5
|
|
|
7
|
-
const parseHtml = (html, isHead)=>{
|
|
6
|
+
const parseHtml = (key, html, isHead)=>{
|
|
8
7
|
if (!html) return undefined;
|
|
9
8
|
try {
|
|
10
9
|
return parse(html, {
|
|
11
10
|
replace: (node)=>{
|
|
12
|
-
if (node.type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
} else {
|
|
28
|
-
if (!isHead) {
|
|
29
|
-
return /*#__PURE__*/ jsxRuntime.jsx(Script, {
|
|
30
|
-
...node.attribs
|
|
31
|
-
});
|
|
11
|
+
if (node.type !== 'script' || !(node instanceof parse.Element)) return null;
|
|
12
|
+
const child = node.children?.[0];
|
|
13
|
+
if (!child) return null;
|
|
14
|
+
if (!(child instanceof parse.Text) && !isHead) return /*#__PURE__*/ jsxRuntime.jsx("script", {
|
|
15
|
+
id: key,
|
|
16
|
+
...node.attribs
|
|
17
|
+
}, key);
|
|
18
|
+
if (child instanceof parse.Text && isHead) {
|
|
19
|
+
return /*#__PURE__*/ jsxRuntime.jsx("script", {
|
|
20
|
+
id: key,
|
|
21
|
+
...node.attribs,
|
|
22
|
+
dangerouslySetInnerHTML: {
|
|
23
|
+
__html: child.data
|
|
32
24
|
}
|
|
33
|
-
}
|
|
25
|
+
}, key);
|
|
34
26
|
}
|
|
35
27
|
}
|
|
36
28
|
});
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var core = require('@gem-sdk/core');
|
|
6
|
+
var nextSeo = require('next-seo');
|
|
7
|
+
var Head = require('next/head');
|
|
6
8
|
var react = require('react');
|
|
7
9
|
var Toolbox = require('../components/builder/Toolbox.js');
|
|
8
10
|
var Header = require('../components/builder/Header.js');
|
|
@@ -14,7 +16,7 @@ var Toolbar = require('../components/builder/Toolbar.js');
|
|
|
14
16
|
var SwitchView = require('../components/builder/SwitchView.js');
|
|
15
17
|
var Body = require('../components/builder/Body.js');
|
|
16
18
|
|
|
17
|
-
const BuilderPage = ({ components, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, pageName, isOriginTemplate })=>{
|
|
19
|
+
const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, pageName, isOriginTemplate })=>{
|
|
18
20
|
const [loadSuccess, setLoadSuccess] = react.useState(false);
|
|
19
21
|
const isDisableHeaderFooter = ()=>{
|
|
20
22
|
return isThemeSectionEditor;
|
|
@@ -37,19 +39,26 @@ const BuilderPage = ({ components, themeStyle, fontStyle, sectionData, pageType,
|
|
|
37
39
|
};
|
|
38
40
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
39
41
|
children: [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
id: "global-style",
|
|
43
|
-
dangerouslySetInnerHTML: {
|
|
44
|
-
__html: themeStyle
|
|
45
|
-
}
|
|
42
|
+
/*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
|
|
43
|
+
...seo
|
|
46
44
|
}),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
/*#__PURE__*/ jsxRuntime.jsxs(Head, {
|
|
46
|
+
children: [
|
|
47
|
+
themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
48
|
+
type: "text/css",
|
|
49
|
+
id: "global-style",
|
|
50
|
+
dangerouslySetInnerHTML: {
|
|
51
|
+
__html: themeStyle
|
|
52
|
+
}
|
|
53
|
+
}),
|
|
54
|
+
fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
55
|
+
"data-id": "google-fonts",
|
|
56
|
+
type: "text/css",
|
|
57
|
+
dangerouslySetInnerHTML: {
|
|
58
|
+
__html: fontStyle
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
]
|
|
53
62
|
}),
|
|
54
63
|
/*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
|
|
55
64
|
children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
|
|
@@ -5,43 +5,53 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var core = require('@gem-sdk/core');
|
|
8
|
+
var nextSeo = require('next-seo');
|
|
8
9
|
var dynamic = require('next/dynamic');
|
|
9
|
-
var
|
|
10
|
+
var Head = require('next/head');
|
|
11
|
+
var router = require('next/router');
|
|
10
12
|
|
|
11
13
|
const CollectionProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.CollectionProvider));
|
|
12
|
-
const CollectionDetailPage = ({ components, builderData, sectionData, themeStyle, collection, fontStyle })=>{
|
|
14
|
+
const CollectionDetailPage = ({ seo, components, builderData, sectionData, themeStyle, collection, fontStyle })=>{
|
|
15
|
+
const router$1 = router.useRouter();
|
|
16
|
+
if (router$1.isFallback) {
|
|
17
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
18
|
+
children: "Loading..."
|
|
19
|
+
});
|
|
20
|
+
}
|
|
13
21
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
14
22
|
children: [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
type: "text/css",
|
|
18
|
-
dangerouslySetInnerHTML: {
|
|
19
|
-
__html: themeStyle
|
|
20
|
-
}
|
|
23
|
+
/*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
|
|
24
|
+
...seo
|
|
21
25
|
}),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
/*#__PURE__*/ jsxRuntime.jsxs(Head, {
|
|
27
|
+
children: [
|
|
28
|
+
themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
29
|
+
"data-id": "global-style",
|
|
30
|
+
type: "text/css",
|
|
31
|
+
dangerouslySetInnerHTML: {
|
|
32
|
+
__html: themeStyle
|
|
33
|
+
}
|
|
34
|
+
}),
|
|
35
|
+
fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
36
|
+
"data-id": "google-fonts",
|
|
37
|
+
type: "text/css",
|
|
38
|
+
dangerouslySetInnerHTML: {
|
|
39
|
+
__html: fontStyle
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
]
|
|
28
43
|
}),
|
|
29
|
-
/*#__PURE__*/ jsxRuntime.jsx(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
children: builderData && /*#__PURE__*/ jsxRuntime.jsx(core.BuilderProvider, {
|
|
41
|
-
state: builderData,
|
|
42
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(core.Render, {
|
|
43
|
-
uid: "ROOT"
|
|
44
|
-
})
|
|
44
|
+
/*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
|
|
45
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
|
|
46
|
+
components: components,
|
|
47
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core.SectionProvider, {
|
|
48
|
+
data: sectionData,
|
|
49
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(CollectionProvider, {
|
|
50
|
+
collection: collection,
|
|
51
|
+
children: builderData && /*#__PURE__*/ jsxRuntime.jsx(core.BuilderProvider, {
|
|
52
|
+
state: builderData,
|
|
53
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core.Render, {
|
|
54
|
+
uid: "ROOT"
|
|
45
55
|
})
|
|
46
56
|
})
|
|
47
57
|
})
|
|
@@ -5,29 +5,41 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var core = require('@gem-sdk/core');
|
|
8
|
+
var nextSeo = require('next-seo');
|
|
8
9
|
var dynamic = require('next/dynamic');
|
|
9
|
-
var
|
|
10
|
+
var Head = require('next/head');
|
|
11
|
+
var router = require('next/router');
|
|
10
12
|
|
|
11
13
|
const ProductProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.ProductProvider));
|
|
12
|
-
const ProductDetailPage = ({ themeStyle, fontStyle, product, components, builderData, sectionData })=>{
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
const ProductDetailPage = ({ themeStyle, fontStyle, seo, product, components, builderData, sectionData })=>{
|
|
15
|
+
const router$1 = router.useRouter();
|
|
16
|
+
if (router$1.isFallback) {
|
|
17
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
15
18
|
children: "Loading..."
|
|
16
|
-
})
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
17
22
|
children: [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
type: "text/css",
|
|
21
|
-
dangerouslySetInnerHTML: {
|
|
22
|
-
__html: themeStyle
|
|
23
|
-
}
|
|
23
|
+
/*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
|
|
24
|
+
...seo
|
|
24
25
|
}),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
/*#__PURE__*/ jsxRuntime.jsxs(Head, {
|
|
27
|
+
children: [
|
|
28
|
+
themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
29
|
+
"data-id": "global-style",
|
|
30
|
+
type: "text/css",
|
|
31
|
+
dangerouslySetInnerHTML: {
|
|
32
|
+
__html: themeStyle
|
|
33
|
+
}
|
|
34
|
+
}),
|
|
35
|
+
fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
36
|
+
"data-id": "google-fonts",
|
|
37
|
+
type: "text/css",
|
|
38
|
+
dangerouslySetInnerHTML: {
|
|
39
|
+
__html: fontStyle
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
]
|
|
31
43
|
}),
|
|
32
44
|
/*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
|
|
33
45
|
children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
|