@gem-sdk/pages 1.58.0-dev.60 → 1.58.0-staging.100

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.
Files changed (38) hide show
  1. package/dist/cjs/components/builder/Header.js +3 -5
  2. package/dist/cjs/layouts/main.js +1 -1
  3. package/dist/cjs/libs/api/get-builder-props.js +7 -2
  4. package/dist/cjs/libs/api/get-post-purchase-props-preview.js +9 -2
  5. package/dist/cjs/libs/api/get-static-page-props-preview.js +7 -5
  6. package/dist/cjs/libs/api/get-static-page-props-v2.js +2 -1
  7. package/dist/cjs/libs/helpers/normalize.js +9 -0
  8. package/dist/cjs/libs/parse-html.js +15 -23
  9. package/dist/cjs/pages/404.js +0 -1
  10. package/dist/cjs/pages/500.js +0 -1
  11. package/dist/cjs/pages/CollectionGlobalProvider.js +0 -1
  12. package/dist/cjs/pages/builder.js +22 -14
  13. package/dist/cjs/pages/collection-detail.js +40 -31
  14. package/dist/cjs/pages/preview.js +0 -1
  15. package/dist/cjs/pages/product-detail.js +29 -18
  16. package/dist/cjs/pages/static-v2.js +76 -31
  17. package/dist/cjs/pages/static.js +44 -34
  18. package/dist/esm/components/builder/Header.js +3 -5
  19. package/dist/esm/layouts/main.js +1 -1
  20. package/dist/esm/libs/api/get-builder-props.js +8 -3
  21. package/dist/esm/libs/api/get-post-purchase-props-preview.js +9 -2
  22. package/dist/esm/libs/api/get-static-page-props-preview.js +8 -6
  23. package/dist/esm/libs/api/get-static-page-props-v2.js +3 -2
  24. package/dist/esm/libs/helpers/normalize.js +9 -1
  25. package/dist/esm/libs/parse-html.js +15 -23
  26. package/dist/esm/pages/404.js +0 -1
  27. package/dist/esm/pages/500.js +0 -1
  28. package/dist/esm/pages/CollectionGlobalProvider.js +0 -1
  29. package/dist/esm/pages/builder.js +22 -14
  30. package/dist/esm/pages/collection-detail.js +41 -32
  31. package/dist/esm/pages/preview.js +0 -1
  32. package/dist/esm/pages/product-detail.js +30 -19
  33. package/dist/esm/pages/static-v2.js +77 -32
  34. package/dist/esm/pages/static.js +45 -35
  35. package/dist/types/index.d.ts +10 -2
  36. package/package.json +5 -5
  37. package/dist/cjs/components/builder/InteractionSelectOnPageHeader.js +0 -197
  38. package/dist/esm/components/builder/InteractionSelectOnPageHeader.js +0 -193
@@ -6,7 +6,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var core = require('@gem-sdk/core');
8
8
  var SwitchView = require('./SwitchView.js');
9
- var InteractionSelectOnPageHeader = require('./InteractionSelectOnPageHeader.js');
10
9
 
11
10
  const defaultMargin = {
12
11
  desktop: '16px',
@@ -23,7 +22,7 @@ const sizeCheck = {
23
22
  const Header = (props)=>{
24
23
  const { pageType, isOriginTemplate, openPageSetting } = props;
25
24
  const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
26
- const sidebarMode = core.usePageStore((s)=>s.sidebarMode);
25
+ core.usePageStore((s)=>s.sidebarMode);
27
26
  const activeHeader = layoutSetting?.showHeader || isOriginTemplate;
28
27
  const headerColor = activeHeader ? HEADER_ON_COLOR : HEADER_OFF_COLOR;
29
28
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
@@ -123,7 +122,7 @@ const Header = (props)=>{
123
122
  })
124
123
  ]
125
124
  }),
126
- !isOriginTemplate && /*#__PURE__*/ jsxRuntime.jsx("button", {
125
+ !(isOriginTemplate || pageType === 'STATIC') && /*#__PURE__*/ jsxRuntime.jsx("button", {
127
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",
128
127
  onClick: openPageSetting,
129
128
  children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
@@ -181,8 +180,7 @@ const Header = (props)=>{
181
180
  })
182
181
  ]
183
182
  })
184
- }),
185
- sidebarMode === 'interaction' && /*#__PURE__*/ jsxRuntime.jsx(InteractionSelectOnPageHeader.default, {})
183
+ })
186
184
  ]
187
185
  });
188
186
  };
@@ -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
@@ -5,16 +5,20 @@ var adapterShopify = require('@gem-sdk/adapter-shopify');
5
5
  var parseJson = require('../helpers/parse-json.js');
6
6
 
7
7
  const getBuilderProps = async (fetcher, shopifyFetcher)=>{
8
- const [storeProperty, shopifyMeta] = await Promise.allSettled([
8
+ const [storeProperty, shopifyMeta, shopifyInfo] = await Promise.allSettled([
9
9
  fetcher([
10
10
  core.StorePropertyDocument
11
11
  ]),
12
12
  shopifyFetcher([
13
13
  adapterShopify.ShopMetaDocument
14
+ ]),
15
+ fetcher([
16
+ core.ShopShopifyDocument
14
17
  ])
15
18
  ]);
16
19
  const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
17
20
  const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
21
+ const shopInfo = shopifyInfo.status === 'fulfilled' ? shopifyInfo.value : undefined;
18
22
  const seo = shopMeta ? {
19
23
  titleTemplate: `%s | ${shopMeta.shop.name}`,
20
24
  defaultTitle: shopMeta?.shop.name,
@@ -34,7 +38,8 @@ const getBuilderProps = async (fetcher, shopifyFetcher)=>{
34
38
  swr: {
35
39
  revalidateOnMount: true
36
40
  },
37
- seo
41
+ seo,
42
+ timezone: shopInfo?.shopShopify?.timezone
38
43
  });
39
44
  };
40
45
 
@@ -8,6 +8,7 @@ var normalize = require('../helpers/normalize.js');
8
8
  var usePagePreview = require('../hooks/usePagePreview.js');
9
9
  var parseJson = require('../helpers/parse-json.js');
10
10
  var genCss = require('../helpers/gen-css.js');
11
+ var adapterShopify = require('@gem-sdk/adapter-shopify');
11
12
 
12
13
  const fetchSalePageDataByID = async (data, fetcher)=>{
13
14
  const variables = {
@@ -218,8 +219,14 @@ const getRelevantPageData = async (data)=>{
218
219
  themePageId: id
219
220
  }, fetcher);
220
221
  };
221
- const getPostPurchasePropsPreview = (fetcher, librarySaleFunnelID, storeFrontFetcher)=>async (data)=>{
222
+ const getPostPurchasePropsPreview = (fetcher, shopifyFetcher, options)=>async (data)=>{
223
+ const { librarySaleFunnelID, storeFrontFetcher } = options;
222
224
  try {
225
+ const [shopifyMeta] = await Promise.allSettled([
226
+ shopifyFetcher([
227
+ adapterShopify.ShopMetaDocument
228
+ ])
229
+ ]);
223
230
  const { id, currentOfferID, isLibraryTemplate, isShopLibraryPage } = data;
224
231
  const { dataBuilder, storeProperty, productOffers, pageStyle } = await getRelevantPageData({
225
232
  id,
@@ -239,7 +246,7 @@ const getPostPurchasePropsPreview = (fetcher, librarySaleFunnelID, storeFrontFet
239
246
  googleFonts.getFontFromGlobalStyle(pageStyle),
240
247
  getFallback.getFallbackV2(gemPagesStoreFrontFetcher, pageTemplate, false)
241
248
  ]);
242
- const { seo, pageConfig } = usePagePreview.usePagePreview(dataBuilder, storeProperty);
249
+ const { seo, pageConfig } = usePagePreview.usePagePreview(dataBuilder, storeProperty, shopifyMeta);
243
250
  return parseJson.serializableJson({
244
251
  themeStyle: genCss.genCSS(pageStyle),
245
252
  seo,
@@ -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 ?? false;
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 = !languageIsoCode || !countryIsoCode ? null : `${languageIsoCode}-${countryIsoCode}`;
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.moneyFormat ?? null,
130
- currency: shopMeta?.localization.country.currency.isoCode ?? null,
129
+ moneyFormat: shopMeta?.shop?.moneyFormat ?? null,
130
+ currency: shopMeta?.localization?.country?.currency?.isoCode ?? null,
131
131
  languageIsoCode,
132
132
  countryIsoCode,
133
133
  locale,
@@ -142,7 +142,9 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
142
142
  tiktokPixelId: dataBuilder.analytic?.tiktokPixelID ?? null,
143
143
  customCodeHeader: dataBuilder.customCode?.header ?? null,
144
144
  customCodeBody: dataBuilder.customCode?.body ?? null,
145
- customFonts: customFonts$1
145
+ customFonts: customFonts$1,
146
+ pageBackground: normalize.extractPageBackground(dataBuilder),
147
+ interaction: dataBuilder?.interaction
146
148
  });
147
149
  } catch (err) {
148
150
  nextjs.captureException(err);
@@ -152,7 +152,8 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
152
152
  customCodeBody: dataBuilder.themePageCustomCode?.body ?? null,
153
153
  pageHandle: dataBuilder.handle ?? null,
154
154
  customFonts: customFonts$1,
155
- interaction: dataBuilder?.interaction
155
+ interaction: dataBuilder?.interaction,
156
+ pageBackground: normalize.extractPageBackground(dataBuilder)
156
157
  });
157
158
  } catch (err) {
158
159
  nextjs.captureException(err);
@@ -83,6 +83,14 @@ const parseBuilderTemplate = (data)=>{
83
83
  ...data?.themePageCustomSections ?? []
84
84
  ], data?.sectionPosition);
85
85
  };
86
+ const extractPageBackground = (data)=>{
87
+ try {
88
+ const pageBackgroundStr = data?.metafields?.find((item)=>item?.key === 'page_background')?.value;
89
+ return JSON.parse(pageBackgroundStr ?? '{}');
90
+ } catch {
91
+ return {};
92
+ }
93
+ };
86
94
  const parseBuilderLibraryTemplate = (data)=>{
87
95
  return normalizePageSectionResponseV2([
88
96
  ...data?.sections ?? []
@@ -94,6 +102,7 @@ const parseShopLibraryPageTemplate = (data)=>{
94
102
  ], data?.sectionPosition);
95
103
  };
96
104
 
105
+ exports.extractPageBackground = extractPageBackground;
97
106
  exports.normalizeBuilderData = normalizeBuilderData;
98
107
  exports.normalizePageSectionResponseV2 = normalizePageSectionResponseV2;
99
108
  exports.parseBuilderLibraryTemplate = parseBuilderLibraryTemplate;
@@ -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 === 'script' && node instanceof parse.Element) {
13
- const child = node.children?.[0];
14
- if (child instanceof parse.Text) {
15
- if (isHead) return /*#__PURE__*/ jsxRuntime.jsx("script", {
16
- ...node.attribs,
17
- dangerouslySetInnerHTML: {
18
- __html: child.data
19
- }
20
- });
21
- else return /*#__PURE__*/ jsxRuntime.jsx(Script, {
22
- ...node.attribs,
23
- dangerouslySetInnerHTML: {
24
- __html: child.data
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
  });
@@ -1,4 +1,3 @@
1
- 'use client';
2
1
  'use strict';
3
2
 
4
3
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,4 +1,3 @@
1
- 'use client';
2
1
  'use strict';
3
2
 
4
3
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,4 +1,3 @@
1
- 'use client';
2
1
  'use strict';
3
2
 
4
3
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,8 +1,9 @@
1
- 'use client';
2
1
  'use strict';
3
2
 
4
3
  var jsxRuntime = require('react/jsx-runtime');
5
4
  var core = require('@gem-sdk/core');
5
+ var nextSeo = require('next-seo');
6
+ var Head = require('next/head');
6
7
  var react = require('react');
7
8
  var Toolbox = require('../components/builder/Toolbox.js');
8
9
  var Header = require('../components/builder/Header.js');
@@ -14,7 +15,7 @@ var Toolbar = require('../components/builder/Toolbar.js');
14
15
  var SwitchView = require('../components/builder/SwitchView.js');
15
16
  var Body = require('../components/builder/Body.js');
16
17
 
17
- const BuilderPage = ({ components, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, pageName, isOriginTemplate })=>{
18
+ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, pageName, isOriginTemplate })=>{
18
19
  const [loadSuccess, setLoadSuccess] = react.useState(false);
19
20
  const isDisableHeaderFooter = ()=>{
20
21
  return isThemeSectionEditor;
@@ -37,19 +38,26 @@ const BuilderPage = ({ components, themeStyle, fontStyle, sectionData, pageType,
37
38
  };
38
39
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
39
40
  children: [
40
- themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
41
- type: "text/css",
42
- id: "global-style",
43
- dangerouslySetInnerHTML: {
44
- __html: themeStyle
45
- }
41
+ /*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
42
+ ...seo
46
43
  }),
47
- fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
48
- "data-id": "google-fonts",
49
- type: "text/css",
50
- dangerouslySetInnerHTML: {
51
- __html: fontStyle
52
- }
44
+ /*#__PURE__*/ jsxRuntime.jsxs(Head, {
45
+ children: [
46
+ themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
47
+ type: "text/css",
48
+ id: "global-style",
49
+ dangerouslySetInnerHTML: {
50
+ __html: themeStyle
51
+ }
52
+ }),
53
+ fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
54
+ "data-id": "google-fonts",
55
+ type: "text/css",
56
+ dangerouslySetInnerHTML: {
57
+ __html: fontStyle
58
+ }
59
+ })
60
+ ]
53
61
  }),
54
62
  /*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
55
63
  children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
@@ -1,47 +1,56 @@
1
- 'use client';
2
1
  'use strict';
3
2
 
4
3
  Object.defineProperty(exports, '__esModule', { value: true });
5
4
 
6
5
  var jsxRuntime = require('react/jsx-runtime');
7
6
  var core = require('@gem-sdk/core');
7
+ var nextSeo = require('next-seo');
8
8
  var dynamic = require('next/dynamic');
9
- var react = require('react');
9
+ var Head = require('next/head');
10
+ var router = require('next/router');
10
11
 
11
12
  const CollectionProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.CollectionProvider));
12
- const CollectionDetailPage = ({ components, builderData, sectionData, themeStyle, collection, fontStyle })=>{
13
+ const CollectionDetailPage = ({ seo, components, builderData, sectionData, themeStyle, collection, fontStyle })=>{
14
+ const router$1 = router.useRouter();
15
+ if (router$1.isFallback) {
16
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
17
+ children: "Loading..."
18
+ });
19
+ }
13
20
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
14
21
  children: [
15
- themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
16
- "data-id": "global-style",
17
- type: "text/css",
18
- dangerouslySetInnerHTML: {
19
- __html: themeStyle
20
- }
22
+ /*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
23
+ ...seo
21
24
  }),
22
- fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
23
- "data-id": "google-fonts",
24
- type: "text/css",
25
- dangerouslySetInnerHTML: {
26
- __html: fontStyle
27
- }
25
+ /*#__PURE__*/ jsxRuntime.jsxs(Head, {
26
+ children: [
27
+ themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
28
+ "data-id": "global-style",
29
+ type: "text/css",
30
+ dangerouslySetInnerHTML: {
31
+ __html: themeStyle
32
+ }
33
+ }),
34
+ fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
35
+ "data-id": "google-fonts",
36
+ type: "text/css",
37
+ dangerouslySetInnerHTML: {
38
+ __html: fontStyle
39
+ }
40
+ })
41
+ ]
28
42
  }),
29
- /*#__PURE__*/ jsxRuntime.jsx(react.Suspense, {
30
- fallback: /*#__PURE__*/ jsxRuntime.jsx("div", {
31
- children: "Loading..."
32
- }),
33
- children: /*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
34
- children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
35
- components: components,
36
- children: /*#__PURE__*/ jsxRuntime.jsx(core.SectionProvider, {
37
- data: sectionData,
38
- children: /*#__PURE__*/ jsxRuntime.jsx(CollectionProvider, {
39
- collection: collection,
40
- children: builderData && /*#__PURE__*/ jsxRuntime.jsx(core.BuilderProvider, {
41
- state: builderData,
42
- children: /*#__PURE__*/ jsxRuntime.jsx(core.Render, {
43
- uid: "ROOT"
44
- })
43
+ /*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
44
+ children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
45
+ components: components,
46
+ children: /*#__PURE__*/ jsxRuntime.jsx(core.SectionProvider, {
47
+ data: sectionData,
48
+ children: /*#__PURE__*/ jsxRuntime.jsx(CollectionProvider, {
49
+ collection: collection,
50
+ children: builderData && /*#__PURE__*/ jsxRuntime.jsx(core.BuilderProvider, {
51
+ state: builderData,
52
+ children: /*#__PURE__*/ jsxRuntime.jsx(core.Render, {
53
+ uid: "ROOT"
45
54
  })
46
55
  })
47
56
  })
@@ -1,4 +1,3 @@
1
- 'use client';
2
1
  'use strict';
3
2
 
4
3
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,33 +1,44 @@
1
- 'use client';
2
1
  'use strict';
3
2
 
4
3
  Object.defineProperty(exports, '__esModule', { value: true });
5
4
 
6
5
  var jsxRuntime = require('react/jsx-runtime');
7
6
  var core = require('@gem-sdk/core');
7
+ var nextSeo = require('next-seo');
8
8
  var dynamic = require('next/dynamic');
9
- var react = require('react');
9
+ var Head = require('next/head');
10
+ var router = require('next/router');
10
11
 
11
12
  const ProductProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.ProductProvider));
12
- const ProductDetailPage = ({ themeStyle, fontStyle, product, components, builderData, sectionData })=>{
13
- return /*#__PURE__*/ jsxRuntime.jsxs(react.Suspense, {
14
- fallback: /*#__PURE__*/ jsxRuntime.jsx("div", {
13
+ const ProductDetailPage = ({ themeStyle, fontStyle, seo, product, components, builderData, sectionData })=>{
14
+ const router$1 = router.useRouter();
15
+ if (router$1.isFallback) {
16
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
15
17
  children: "Loading..."
16
- }),
18
+ });
19
+ }
20
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
17
21
  children: [
18
- themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
19
- "data-id": "global-style",
20
- type: "text/css",
21
- dangerouslySetInnerHTML: {
22
- __html: themeStyle
23
- }
22
+ /*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
23
+ ...seo
24
24
  }),
25
- fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
26
- "data-id": "google-fonts",
27
- type: "text/css",
28
- dangerouslySetInnerHTML: {
29
- __html: fontStyle
30
- }
25
+ /*#__PURE__*/ jsxRuntime.jsxs(Head, {
26
+ children: [
27
+ themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
28
+ "data-id": "global-style",
29
+ type: "text/css",
30
+ dangerouslySetInnerHTML: {
31
+ __html: themeStyle
32
+ }
33
+ }),
34
+ fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
35
+ "data-id": "google-fonts",
36
+ type: "text/css",
37
+ dangerouslySetInnerHTML: {
38
+ __html: fontStyle
39
+ }
40
+ })
41
+ ]
31
42
  }),
32
43
  /*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
33
44
  children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
@@ -1,48 +1,94 @@
1
- 'use client';
2
1
  'use strict';
3
2
 
4
3
  var jsxRuntime = require('react/jsx-runtime');
5
4
  var core = require('@gem-sdk/core');
5
+ var nextSeo = require('next-seo');
6
+ var Head = require('next/head');
7
+ var router = require('next/router');
6
8
  var useTrackingView = require('../libs/hooks/use-tracking-view.js');
7
9
  var parseHtml = require('../libs/parse-html.js');
8
10
  var Header = require('../components/builder/Header.js');
9
11
  var FooterForPostPurchase = require('../components/FooterForPostPurchase.js');
10
12
  var Script = require('next/script');
13
+ var react = require('react');
11
14
 
12
- const StaticPageV2 = ({ components, builderData, sectionData, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, isPreview, interaction })=>{
15
+ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, isPreview, interaction, pageBackground })=>{
16
+ const router$1 = router.useRouter();
13
17
  const baseAssetURL = process.env.NEXT_GP_BASE_ASSET_URL || 'https://d3kbi0je7pp4lw.cloudfront.net';
14
- useTrackingView.useTrackingView(shopToken, pageHandle);
18
+ useTrackingView.useTrackingView(shopToken, pageHandle, router$1.isFallback);
19
+ const customCodeHeaderID = 'custom-code-header';
20
+ react.useEffect(()=>{
21
+ const customCodeHeaderElement = document.querySelectorAll(`#${customCodeHeaderID}`);
22
+ if (customCodeHeaderElement.length > 1) {
23
+ customCodeHeaderElement.forEach((script, index)=>{
24
+ if (index !== 0) script.remove();
25
+ });
26
+ }
27
+ }, []);
28
+ if (router$1.isFallback) {
29
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
30
+ className: "gp-flex gp-h-[100vh] gp-items-center gp-justify-center",
31
+ children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
32
+ className: "gp-flex gp-gap-2",
33
+ children: [
34
+ /*#__PURE__*/ jsxRuntime.jsx("span", {
35
+ className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"
36
+ }),
37
+ /*#__PURE__*/ jsxRuntime.jsx("span", {
38
+ className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"
39
+ }),
40
+ /*#__PURE__*/ jsxRuntime.jsx("span", {
41
+ className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"
42
+ })
43
+ ]
44
+ })
45
+ });
46
+ }
15
47
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
16
48
  children: [
17
- parseHtml.parseHtml(customCodeHeader),
18
- themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
19
- "data-id": "global-style",
20
- type: "text/css",
21
- dangerouslySetInnerHTML: {
22
- __html: themeStyle
23
- }
49
+ /*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
50
+ ...seo
24
51
  }),
25
- fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
26
- "data-id": "google-fonts",
27
- type: "text/css",
28
- dangerouslySetInnerHTML: {
29
- __html: fontStyle
30
- }
52
+ /*#__PURE__*/ jsxRuntime.jsxs(Head, {
53
+ children: [
54
+ parseHtml.parseHtml(customCodeHeaderID, customCodeHeader, true),
55
+ themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
56
+ "data-id": "global-style",
57
+ type: "text/css",
58
+ dangerouslySetInnerHTML: {
59
+ __html: themeStyle
60
+ }
61
+ }, "global-style"),
62
+ fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
63
+ "data-id": "google-fonts",
64
+ type: "text/css",
65
+ dangerouslySetInnerHTML: {
66
+ __html: fontStyle
67
+ }
68
+ }, "google-fonts"),
69
+ elementFontStyle && elementFontStyle.map((fontStyle)=>/*#__PURE__*/ jsxRuntime.jsx("style", {
70
+ "data-id": "google-element-fonts",
71
+ type: "text/css",
72
+ dangerouslySetInnerHTML: {
73
+ __html: fontStyle
74
+ }
75
+ }, fontStyle)),
76
+ customFonts && /*#__PURE__*/ jsxRuntime.jsx("style", {
77
+ "data-id": "custom-element-fonts",
78
+ type: "text/css",
79
+ dangerouslySetInnerHTML: {
80
+ __html: customFonts
81
+ }
82
+ }, fontStyle),
83
+ pageBackground?.isUsePageBackground && pageBackground?.background && /*#__PURE__*/ jsxRuntime.jsx("style", {
84
+ children: `
85
+ body {
86
+ background: ${pageBackground.background};
87
+ }
88
+ `
89
+ }, `page_background_${pageBackground?.background}`)
90
+ ]
31
91
  }),
32
- elementFontStyle && elementFontStyle.map((fontStyle)=>/*#__PURE__*/ jsxRuntime.jsx("style", {
33
- "data-id": "google-element-fonts",
34
- type: "text/css",
35
- dangerouslySetInnerHTML: {
36
- __html: fontStyle
37
- }
38
- }, fontStyle)),
39
- customFonts && /*#__PURE__*/ jsxRuntime.jsx("style", {
40
- "data-id": "custom-element-fonts",
41
- type: "text/css",
42
- dangerouslySetInnerHTML: {
43
- __html: customFonts
44
- }
45
- }, fontStyle),
46
92
  /*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
47
93
  productOffers: productOffers,
48
94
  publicStoreFrontData: publicStoreFrontData,
@@ -73,7 +119,6 @@ const StaticPageV2 = ({ components, builderData, sectionData, themeStyle, fontSt
73
119
  }),
74
120
  /*#__PURE__*/ jsxRuntime.jsx(Script, {
75
121
  defer: true,
76
- strategy: "lazyOnload",
77
122
  src: `${baseAssetURL}/assets-v2/gp-flow-action-lip.js`
78
123
  })
79
124
  ]