@gem-sdk/pages 2.0.0-dev.173 → 2.0.0-dev.194

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.
@@ -5,42 +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 react = require('react');
8
+ var nextSeo = require('next-seo');
9
+ var Head = require('next/head');
10
+ var router = require('next/router');
9
11
 
10
- const StaticPage = ({ components, builderData, sectionData, themeStyle, fontStyle })=>{
11
- const fallbackContent = /*#__PURE__*/ jsxRuntime.jsx("div", {
12
- className: "gp-flex gp-h-[100vh] gp-items-center gp-justify-center",
13
- children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
14
- className: "gp-flex gp-gap-2",
15
- children: [
16
- /*#__PURE__*/ jsxRuntime.jsx("span", {
17
- className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"
18
- }),
19
- /*#__PURE__*/ jsxRuntime.jsx("span", {
20
- className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"
21
- }),
22
- /*#__PURE__*/ jsxRuntime.jsx("span", {
23
- className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"
24
- })
25
- ]
26
- })
27
- });
28
- return /*#__PURE__*/ jsxRuntime.jsxs(react.Suspense, {
29
- fallback: fallbackContent,
12
+ const StaticPage = ({ components, builderData, sectionData, seo, themeStyle, fontStyle })=>{
13
+ const router$1 = router.useRouter();
14
+ if (router$1.isFallback) {
15
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
16
+ className: "gp-flex gp-h-[100vh] gp-items-center gp-justify-center",
17
+ children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
18
+ className: "gp-flex gp-gap-2",
19
+ children: [
20
+ /*#__PURE__*/ jsxRuntime.jsx("span", {
21
+ className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"
22
+ }),
23
+ /*#__PURE__*/ jsxRuntime.jsx("span", {
24
+ className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"
25
+ }),
26
+ /*#__PURE__*/ jsxRuntime.jsx("span", {
27
+ className: "gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"
28
+ })
29
+ ]
30
+ })
31
+ });
32
+ }
33
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
30
34
  children: [
31
- themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
32
- "data-id": "global-style",
33
- type: "text/css",
34
- dangerouslySetInnerHTML: {
35
- __html: themeStyle
36
- }
35
+ /*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
36
+ ...seo
37
37
  }),
38
- fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
39
- "data-id": "google-fonts",
40
- type: "text/css",
41
- dangerouslySetInnerHTML: {
42
- __html: fontStyle
43
- }
38
+ /*#__PURE__*/ jsxRuntime.jsxs(Head, {
39
+ children: [
40
+ themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
41
+ "data-id": "global-style",
42
+ type: "text/css",
43
+ dangerouslySetInnerHTML: {
44
+ __html: themeStyle
45
+ }
46
+ }),
47
+ fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
48
+ "data-id": "google-fonts",
49
+ type: "text/css",
50
+ dangerouslySetInnerHTML: {
51
+ __html: fontStyle
52
+ }
53
+ })
54
+ ]
44
55
  }),
45
56
  /*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
46
57
  children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
@@ -118,7 +118,7 @@ const Header = (props)=>{
118
118
  })
119
119
  ]
120
120
  }),
121
- !isOriginTemplate && /*#__PURE__*/ jsx("button", {
121
+ !(isOriginTemplate || pageType === 'STATIC') && /*#__PURE__*/ jsx("button", {
122
122
  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",
123
123
  onClick: openPageSetting,
124
124
  children: /*#__PURE__*/ jsxs("div", {
@@ -7,7 +7,7 @@ const MainLayout = ({ children, ...props })=>{
7
7
  const mobileOnly = useShopStore((s)=>s.mobileOnly);
8
8
  return /*#__PURE__*/ jsxs(Fragment, {
9
9
  children: [
10
- parseHtml(props?.customCodeBody),
10
+ parseHtml('custom-code-body', props?.customCodeBody),
11
11
  /*#__PURE__*/ jsx("div", {
12
12
  className: cls({
13
13
  'gp-max-w-mobile gp-mx-auto gp-w-full': mobileOnly
@@ -1,4 +1,4 @@
1
- import { ThemePageDocument, StorePropertyDocument, SaleFunnelDiscountsDocument, LibraryTemplateDocument, LibrarySaleFunnelDocument, ShopLibraryPageDocument } from '@gem-sdk/core';
1
+ import { ThemePageDocument, StorePropertyDocument, SaleFunnelDiscountsDocument, SaleFunnelOfferDocument, LibraryTemplateDocument, LibrarySaleFunnelDocument, ShopLibraryPageDocument } from '@gem-sdk/core';
2
2
  import { captureException } from '@sentry/nextjs';
3
3
  import { getFontStyleFromPageTemplate, getFontFromGlobalStyle } from '../google-fonts.js';
4
4
  import { getFallbackV2 } from '../helpers/get-fallback.js';
@@ -31,6 +31,7 @@ const fetchSalePageDataByID = async (data, fetcher)=>{
31
31
  dataBuilder: theme.value.themePage,
32
32
  pageStyle: theme.value.themePage?.theme?.themeStyles?.edges?.[0]?.node?.data,
33
33
  storeProperty,
34
+ dynamicDiscountOffer: undefined,
34
35
  productOffers: []
35
36
  };
36
37
  };
@@ -42,7 +43,7 @@ const fetchPostPurchasePageDataByID = async (data, fetcher)=>{
42
43
  default: true
43
44
  }
44
45
  };
45
- const [theme, storeProperty, saleFunnelDiscounts] = await Promise.allSettled([
46
+ const [theme, storeProperty, saleFunnelDiscounts, saleFunnelOffer] = await Promise.allSettled([
46
47
  fetcher([
47
48
  ThemePageDocument,
48
49
  variables
@@ -57,6 +58,12 @@ const fetchPostPurchasePageDataByID = async (data, fetcher)=>{
57
58
  saleFunnelOfferID: data.currentOfferID
58
59
  }
59
60
  }
61
+ ]),
62
+ fetcher([
63
+ SaleFunnelOfferDocument,
64
+ {
65
+ saleFunnelOfferId: data.currentOfferID
66
+ }
60
67
  ])
61
68
  ]);
62
69
  if (theme.status === 'rejected') {
@@ -65,10 +72,14 @@ const fetchPostPurchasePageDataByID = async (data, fetcher)=>{
65
72
  if (saleFunnelDiscounts.status === 'rejected') {
66
73
  throw new Error(saleFunnelDiscounts.reason?.[0]);
67
74
  }
75
+ if (saleFunnelOffer.status === 'rejected') {
76
+ throw new Error(saleFunnelOffer.reason?.[0]);
77
+ }
68
78
  return {
69
79
  dataBuilder: theme.value.themePage,
70
80
  pageStyle: theme.value.themePage?.theme?.themeStyles?.edges?.[0]?.node?.data,
71
81
  storeProperty,
82
+ dynamicDiscountOffer: saleFunnelOffer.value.saleFunnelOffer?.dynamicDiscounts?.[0],
72
83
  productOffers: saleFunnelDiscounts.value.saleFunnelDiscounts?.edges?.filter((item)=>item?.node?.objectType === 'PRODUCT' && item?.node?.type === 'ORDER_VALUE') || []
73
84
  };
74
85
  };
@@ -114,6 +125,7 @@ const fetchThemePageDataByTemplateID = async (data, fetcher)=>{
114
125
  dataBuilder: theme.value.libraryTemplate,
115
126
  pageStyle: undefined,
116
127
  storeProperty,
128
+ dynamicDiscountOffer: undefined,
117
129
  productOffers: productOffers
118
130
  };
119
131
  };
@@ -121,7 +133,7 @@ const fetchShopLibraryPageDataByID = async (data, fetcher)=>{
121
133
  const variables = {
122
134
  shopLibraryPageId: data.shopLibraryPageId
123
135
  };
124
- const [theme, storeProperty, saleFunnelDiscounts] = await Promise.allSettled([
136
+ const [theme, storeProperty, saleFunnelDiscounts, saleFunnelOffer] = await Promise.allSettled([
125
137
  fetcher([
126
138
  ShopLibraryPageDocument,
127
139
  variables
@@ -136,6 +148,12 @@ const fetchShopLibraryPageDataByID = async (data, fetcher)=>{
136
148
  saleFunnelOfferID: data.currentOfferID
137
149
  }
138
150
  }
151
+ ]),
152
+ fetcher([
153
+ SaleFunnelOfferDocument,
154
+ {
155
+ saleFunnelOfferId: data.currentOfferID
156
+ }
139
157
  ])
140
158
  ]);
141
159
  if (theme.status === 'rejected') {
@@ -144,10 +162,14 @@ const fetchShopLibraryPageDataByID = async (data, fetcher)=>{
144
162
  if (saleFunnelDiscounts.status === 'rejected') {
145
163
  throw new Error(saleFunnelDiscounts.reason?.[0]);
146
164
  }
165
+ if (saleFunnelOffer.status === 'rejected') {
166
+ throw new Error(saleFunnelOffer.reason?.[0]);
167
+ }
147
168
  return {
148
169
  dataBuilder: theme.value.shopLibraryPage,
149
170
  pageStyle: undefined,
150
171
  storeProperty,
172
+ dynamicDiscountOffer: saleFunnelOffer.value.saleFunnelOffer?.dynamicDiscounts?.[0],
151
173
  productOffers: saleFunnelDiscounts.value.saleFunnelDiscounts?.edges?.filter((item)=>item?.node?.objectType === 'PRODUCT' && item?.node?.type === 'ORDER_VALUE') || []
152
174
  };
153
175
  };
@@ -155,7 +177,7 @@ const fetchLibraryTemplateDataByID = async (data, fetcher)=>{
155
177
  const variables = {
156
178
  libraryTemplateId: data.libraryTemplateId
157
179
  };
158
- const [theme, storeProperty, saleFunnelDiscounts] = await Promise.allSettled([
180
+ const [theme, storeProperty, saleFunnelDiscounts, saleFunnelOffer] = await Promise.allSettled([
159
181
  fetcher([
160
182
  LibraryTemplateDocument,
161
183
  variables
@@ -170,6 +192,12 @@ const fetchLibraryTemplateDataByID = async (data, fetcher)=>{
170
192
  saleFunnelOfferID: data.currentOfferID
171
193
  }
172
194
  }
195
+ ]),
196
+ fetcher([
197
+ SaleFunnelOfferDocument,
198
+ {
199
+ saleFunnelOfferId: data.currentOfferID
200
+ }
173
201
  ])
174
202
  ]);
175
203
  if (theme.status === 'rejected') {
@@ -178,10 +206,14 @@ const fetchLibraryTemplateDataByID = async (data, fetcher)=>{
178
206
  if (saleFunnelDiscounts.status === 'rejected') {
179
207
  throw new Error(saleFunnelDiscounts.reason?.[0]);
180
208
  }
209
+ if (saleFunnelOffer.status === 'rejected') {
210
+ throw new Error(saleFunnelOffer.reason?.[0]);
211
+ }
181
212
  return {
182
213
  dataBuilder: theme.value.libraryTemplate,
183
214
  pageStyle: undefined,
184
215
  storeProperty,
216
+ dynamicDiscountOffer: saleFunnelOffer.value.saleFunnelOffer?.dynamicDiscounts?.[0],
185
217
  productOffers: saleFunnelDiscounts.value.saleFunnelDiscounts?.edges?.filter((item)=>item?.node?.objectType === 'PRODUCT' && item?.node?.type === 'ORDER_VALUE') || []
186
218
  };
187
219
  };
@@ -219,7 +251,7 @@ const getRelevantPageData = async (data)=>{
219
251
  const getPostPurchasePropsPreview = (fetcher, librarySaleFunnelID, storeFrontFetcher)=>async (data)=>{
220
252
  try {
221
253
  const { id, currentOfferID, isLibraryTemplate, isShopLibraryPage } = data;
222
- const { dataBuilder, storeProperty, productOffers, pageStyle } = await getRelevantPageData({
254
+ const { dataBuilder, storeProperty, productOffers, pageStyle, dynamicDiscountOffer } = await getRelevantPageData({
223
255
  id,
224
256
  currentOfferID,
225
257
  fetcher,
@@ -248,7 +280,8 @@ const getPostPurchasePropsPreview = (fetcher, librarySaleFunnelID, storeFrontFet
248
280
  swr: {
249
281
  fallback
250
282
  },
251
- productOffers
283
+ productOffers,
284
+ dynamicDiscountOffer
252
285
  });
253
286
  } catch (err) {
254
287
  console.log('error', err);
@@ -43,7 +43,7 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
43
43
  getFallbackV2(fetcher, pageTemplate),
44
44
  getCustomFonts(themePageCustomFonts)
45
45
  ]);
46
- const mobileOnly = dataBuilder.isMobile ?? false;
46
+ const mobileOnly = !!dataBuilder.isMobile;
47
47
  const description = dataBuilder?.dataSEO?.find((item)=>item?.key === 'global-meta-description')?.value;
48
48
  const thumbnail = parseJson(dataBuilder?.dataSEO?.find((item)=>item?.key === 'global-meta-thumbnail')?.value);
49
49
  const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
@@ -117,15 +117,15 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
117
117
  };
118
118
  const languageIsoCode = shopMeta?.localization.language.isoCode ?? null;
119
119
  const countryIsoCode = shopMeta?.localization.country.isoCode ?? null;
120
- const locale = !languageIsoCode || !countryIsoCode ? null : `${languageIsoCode}-${countryIsoCode}`;
120
+ const locale = languageIsoCode && countryIsoCode ? `${languageIsoCode}-${countryIsoCode}` : null;
121
121
  return serializableJson({
122
122
  themeStyle: genCSS(dataBuilder?.themeStyle?.data, mobileOnly),
123
123
  fontStyle,
124
124
  elementFontStyle,
125
125
  builderData: pageTemplate,
126
126
  pageType,
127
- moneyFormat: shopMeta?.shop.moneyFormat ?? null,
128
- currency: shopMeta?.localization.country.currency.isoCode ?? null,
127
+ moneyFormat: shopMeta?.shop?.moneyFormat ?? null,
128
+ currency: shopMeta?.localization?.country?.currency?.isoCode ?? null,
129
129
  languageIsoCode,
130
130
  countryIsoCode,
131
131
  locale,
@@ -141,7 +141,8 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
141
141
  customCodeHeader: dataBuilder.customCode?.header ?? null,
142
142
  customCodeBody: dataBuilder.customCode?.body ?? null,
143
143
  customFonts,
144
- pageBackground: extractPageBackground(dataBuilder)
144
+ pageBackground: extractPageBackground(dataBuilder),
145
+ interaction: dataBuilder?.interaction
145
146
  });
146
147
  } catch (err) {
147
148
  captureException(err);
@@ -1,34 +1,26 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import parse, { Element, Text } from 'html-react-parser';
3
- import Script from 'next/script';
4
3
 
5
- const parseHtml = (html, isHead)=>{
4
+ const parseHtml = (key, html, isHead)=>{
6
5
  if (!html) return undefined;
7
6
  try {
8
7
  return parse(html, {
9
8
  replace: (node)=>{
10
- if (node.type === 'script' && node instanceof Element) {
11
- const child = node.children?.[0];
12
- if (child instanceof Text) {
13
- if (isHead) return /*#__PURE__*/ jsx("script", {
14
- ...node.attribs,
15
- dangerouslySetInnerHTML: {
16
- __html: child.data
17
- }
18
- });
19
- else return /*#__PURE__*/ jsx(Script, {
20
- ...node.attribs,
21
- dangerouslySetInnerHTML: {
22
- __html: child.data
23
- }
24
- });
25
- } else {
26
- if (!isHead) {
27
- return /*#__PURE__*/ jsx(Script, {
28
- ...node.attribs
29
- });
9
+ if (node.type !== 'script' || !(node instanceof Element)) return null;
10
+ const child = node.children?.[0];
11
+ if (!child) return null;
12
+ if (!(child instanceof Text) && !isHead) return /*#__PURE__*/ jsx("script", {
13
+ id: key,
14
+ ...node.attribs
15
+ }, key);
16
+ if (child instanceof Text && isHead) {
17
+ return /*#__PURE__*/ jsx("script", {
18
+ id: key,
19
+ ...node.attribs,
20
+ dangerouslySetInnerHTML: {
21
+ __html: child.data
30
22
  }
31
- }
23
+ }, key);
32
24
  }
33
25
  }
34
26
  });
@@ -1,6 +1,8 @@
1
1
  'use client';
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { PageProvider, BuilderComponentProvider, SectionProvider, BuilderPreviewProvider } from '@gem-sdk/core';
4
+ import { NextSeo } from 'next-seo';
5
+ import Head from 'next/head';
4
6
  import { useState, useMemo, useEffect } from 'react';
5
7
  import Toolbox from '../components/builder/Toolbox.js';
6
8
  import Header from '../components/builder/Header.js';
@@ -12,7 +14,7 @@ import Toolbar from '../components/builder/Toolbar.js';
12
14
  import Devices from '../components/builder/SwitchView.js';
13
15
  import Body from '../components/builder/Body.js';
14
16
 
15
- const BuilderPage = ({ components, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, pageName, isOriginTemplate })=>{
17
+ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, pageName, isOriginTemplate })=>{
16
18
  const [loadSuccess, setLoadSuccess] = useState(false);
17
19
  const isDisableHeaderFooter = ()=>{
18
20
  return isThemeSectionEditor;
@@ -35,19 +37,26 @@ const BuilderPage = ({ components, themeStyle, fontStyle, sectionData, pageType,
35
37
  };
36
38
  return /*#__PURE__*/ jsxs(Fragment, {
37
39
  children: [
38
- themeStyle && /*#__PURE__*/ jsx("style", {
39
- type: "text/css",
40
- id: "global-style",
41
- dangerouslySetInnerHTML: {
42
- __html: themeStyle
43
- }
40
+ /*#__PURE__*/ jsx(NextSeo, {
41
+ ...seo
44
42
  }),
45
- fontStyle && /*#__PURE__*/ jsx("style", {
46
- "data-id": "google-fonts",
47
- type: "text/css",
48
- dangerouslySetInnerHTML: {
49
- __html: fontStyle
50
- }
43
+ /*#__PURE__*/ jsxs(Head, {
44
+ children: [
45
+ themeStyle && /*#__PURE__*/ jsx("style", {
46
+ type: "text/css",
47
+ id: "global-style",
48
+ dangerouslySetInnerHTML: {
49
+ __html: themeStyle
50
+ }
51
+ }),
52
+ fontStyle && /*#__PURE__*/ jsx("style", {
53
+ "data-id": "google-fonts",
54
+ type: "text/css",
55
+ dangerouslySetInnerHTML: {
56
+ __html: fontStyle
57
+ }
58
+ })
59
+ ]
51
60
  }),
52
61
  /*#__PURE__*/ jsx(PageProvider, {
53
62
  children: /*#__PURE__*/ jsx(BuilderComponentProvider, {
@@ -1,43 +1,53 @@
1
1
  'use client';
2
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { PageProvider, BuilderComponentProvider, SectionProvider, BuilderProvider, Render } from '@gem-sdk/core';
4
+ import { NextSeo } from 'next-seo';
4
5
  import dynamic from 'next/dynamic';
5
- import { Suspense } from 'react';
6
+ import Head from 'next/head';
7
+ import { useRouter } from 'next/router';
6
8
 
7
9
  const CollectionProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.CollectionProvider));
8
- const CollectionDetailPage = ({ components, builderData, sectionData, themeStyle, collection, fontStyle })=>{
10
+ const CollectionDetailPage = ({ seo, components, builderData, sectionData, themeStyle, collection, fontStyle })=>{
11
+ const router = useRouter();
12
+ if (router.isFallback) {
13
+ return /*#__PURE__*/ jsx("div", {
14
+ children: "Loading..."
15
+ });
16
+ }
9
17
  return /*#__PURE__*/ jsxs(Fragment, {
10
18
  children: [
11
- themeStyle && /*#__PURE__*/ jsx("style", {
12
- "data-id": "global-style",
13
- type: "text/css",
14
- dangerouslySetInnerHTML: {
15
- __html: themeStyle
16
- }
19
+ /*#__PURE__*/ jsx(NextSeo, {
20
+ ...seo
17
21
  }),
18
- fontStyle && /*#__PURE__*/ jsx("style", {
19
- "data-id": "google-fonts",
20
- type: "text/css",
21
- dangerouslySetInnerHTML: {
22
- __html: fontStyle
23
- }
22
+ /*#__PURE__*/ jsxs(Head, {
23
+ children: [
24
+ themeStyle && /*#__PURE__*/ jsx("style", {
25
+ "data-id": "global-style",
26
+ type: "text/css",
27
+ dangerouslySetInnerHTML: {
28
+ __html: themeStyle
29
+ }
30
+ }),
31
+ fontStyle && /*#__PURE__*/ jsx("style", {
32
+ "data-id": "google-fonts",
33
+ type: "text/css",
34
+ dangerouslySetInnerHTML: {
35
+ __html: fontStyle
36
+ }
37
+ })
38
+ ]
24
39
  }),
25
- /*#__PURE__*/ jsx(Suspense, {
26
- fallback: /*#__PURE__*/ jsx("div", {
27
- children: "Loading..."
28
- }),
29
- children: /*#__PURE__*/ jsx(PageProvider, {
30
- children: /*#__PURE__*/ jsx(BuilderComponentProvider, {
31
- components: components,
32
- children: /*#__PURE__*/ jsx(SectionProvider, {
33
- data: sectionData,
34
- children: /*#__PURE__*/ jsx(CollectionProvider, {
35
- collection: collection,
36
- children: builderData && /*#__PURE__*/ jsx(BuilderProvider, {
37
- state: builderData,
38
- children: /*#__PURE__*/ jsx(Render, {
39
- uid: "ROOT"
40
- })
40
+ /*#__PURE__*/ jsx(PageProvider, {
41
+ children: /*#__PURE__*/ jsx(BuilderComponentProvider, {
42
+ components: components,
43
+ children: /*#__PURE__*/ jsx(SectionProvider, {
44
+ data: sectionData,
45
+ children: /*#__PURE__*/ jsx(CollectionProvider, {
46
+ collection: collection,
47
+ children: builderData && /*#__PURE__*/ jsx(BuilderProvider, {
48
+ state: builderData,
49
+ children: /*#__PURE__*/ jsx(Render, {
50
+ uid: "ROOT"
41
51
  })
42
52
  })
43
53
  })
@@ -1,29 +1,41 @@
1
1
  'use client';
2
- import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { PageProvider, BuilderComponentProvider, SectionProvider, BuilderProvider, Render, AddOn } from '@gem-sdk/core';
4
+ import { NextSeo } from 'next-seo';
4
5
  import dynamic from 'next/dynamic';
5
- import { Suspense } from 'react';
6
+ import Head from 'next/head';
7
+ import { useRouter } from 'next/router';
6
8
 
7
9
  const ProductProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.ProductProvider));
8
- const ProductDetailPage = ({ themeStyle, fontStyle, product, components, builderData, sectionData })=>{
9
- return /*#__PURE__*/ jsxs(Suspense, {
10
- fallback: /*#__PURE__*/ jsx("div", {
10
+ const ProductDetailPage = ({ themeStyle, fontStyle, seo, product, components, builderData, sectionData })=>{
11
+ const router = useRouter();
12
+ if (router.isFallback) {
13
+ return /*#__PURE__*/ jsx("div", {
11
14
  children: "Loading..."
12
- }),
15
+ });
16
+ }
17
+ return /*#__PURE__*/ jsxs(Fragment, {
13
18
  children: [
14
- themeStyle && /*#__PURE__*/ jsx("style", {
15
- "data-id": "global-style",
16
- type: "text/css",
17
- dangerouslySetInnerHTML: {
18
- __html: themeStyle
19
- }
19
+ /*#__PURE__*/ jsx(NextSeo, {
20
+ ...seo
20
21
  }),
21
- fontStyle && /*#__PURE__*/ jsx("style", {
22
- "data-id": "google-fonts",
23
- type: "text/css",
24
- dangerouslySetInnerHTML: {
25
- __html: fontStyle
26
- }
22
+ /*#__PURE__*/ jsxs(Head, {
23
+ children: [
24
+ themeStyle && /*#__PURE__*/ jsx("style", {
25
+ "data-id": "global-style",
26
+ type: "text/css",
27
+ dangerouslySetInnerHTML: {
28
+ __html: themeStyle
29
+ }
30
+ }),
31
+ fontStyle && /*#__PURE__*/ jsx("style", {
32
+ "data-id": "google-fonts",
33
+ type: "text/css",
34
+ dangerouslySetInnerHTML: {
35
+ __html: fontStyle
36
+ }
37
+ })
38
+ ]
27
39
  }),
28
40
  /*#__PURE__*/ jsx(PageProvider, {
29
41
  children: /*#__PURE__*/ jsx(BuilderComponentProvider, {