@gem-sdk/pages 1.58.0-dev.13 → 1.58.0-dev.142

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 (66) hide show
  1. package/dist/cjs/components/ErrorBoundary.js +1 -0
  2. package/dist/cjs/components/ErrorFallback.js +1 -0
  3. package/dist/cjs/components/FacebookPixel.js +1 -0
  4. package/dist/cjs/components/FooterForPostPurchase.js +1 -0
  5. package/dist/cjs/components/GoogleAnalytic.js +1 -0
  6. package/dist/cjs/components/TikTokPixel.js +1 -0
  7. package/dist/cjs/components/builder/Body.js +1 -0
  8. package/dist/cjs/components/builder/Footer.js +1 -0
  9. package/dist/cjs/components/builder/Header.js +3 -4
  10. package/dist/cjs/components/builder/PopupManager.js +1 -0
  11. package/dist/cjs/components/builder/SwitchView.js +1 -0
  12. package/dist/cjs/components/builder/Toolbar.js +1 -0
  13. package/dist/cjs/components/builder/Toolbox.js +1 -0
  14. package/dist/cjs/components/image-to-layout/AddSectionImageToLayout.js +1 -0
  15. package/dist/cjs/components/image-to-layout/DropElement.js +1 -0
  16. package/dist/cjs/components/image-to-layout/ImageToLayout.js +1 -0
  17. package/dist/cjs/layouts/main.js +1 -0
  18. package/dist/cjs/libs/api/get-builder-props.js +7 -2
  19. package/dist/cjs/libs/api/get-static-page-props-preview.js +19 -15
  20. package/dist/cjs/libs/api/get-static-page-props-v2.js +2 -1
  21. package/dist/cjs/libs/helpers/normalize.js +9 -0
  22. package/dist/cjs/libs/hooks/use-tracking-view.js +1 -0
  23. package/dist/cjs/pages/404.js +1 -0
  24. package/dist/cjs/pages/500.js +1 -0
  25. package/dist/cjs/pages/CollectionGlobalProvider.js +1 -0
  26. package/dist/cjs/pages/builder.js +1 -0
  27. package/dist/cjs/pages/collection-detail.js +1 -0
  28. package/dist/cjs/pages/preview.js +1 -0
  29. package/dist/cjs/pages/product-detail.js +1 -0
  30. package/dist/cjs/pages/static-v2.js +11 -2
  31. package/dist/cjs/pages/static.js +1 -0
  32. package/dist/esm/components/ErrorBoundary.js +1 -0
  33. package/dist/esm/components/ErrorFallback.js +1 -0
  34. package/dist/esm/components/FacebookPixel.js +1 -0
  35. package/dist/esm/components/FooterForPostPurchase.js +1 -0
  36. package/dist/esm/components/GoogleAnalytic.js +1 -0
  37. package/dist/esm/components/TikTokPixel.js +1 -0
  38. package/dist/esm/components/builder/Body.js +1 -0
  39. package/dist/esm/components/builder/Footer.js +1 -0
  40. package/dist/esm/components/builder/Header.js +3 -4
  41. package/dist/esm/components/builder/PopupManager.js +1 -0
  42. package/dist/esm/components/builder/SwitchView.js +1 -0
  43. package/dist/esm/components/builder/Toolbar.js +1 -0
  44. package/dist/esm/components/builder/Toolbox.js +1 -0
  45. package/dist/esm/components/image-to-layout/AddSectionImageToLayout.js +1 -0
  46. package/dist/esm/components/image-to-layout/DropElement.js +1 -0
  47. package/dist/esm/components/image-to-layout/ImageToLayout.js +1 -0
  48. package/dist/esm/layouts/main.js +1 -0
  49. package/dist/esm/libs/api/get-builder-props.js +8 -3
  50. package/dist/esm/libs/api/get-static-page-props-preview.js +21 -17
  51. package/dist/esm/libs/api/get-static-page-props-v2.js +3 -2
  52. package/dist/esm/libs/helpers/normalize.js +9 -1
  53. package/dist/esm/libs/hooks/use-tracking-view.js +1 -0
  54. package/dist/esm/pages/404.js +1 -0
  55. package/dist/esm/pages/500.js +1 -0
  56. package/dist/esm/pages/CollectionGlobalProvider.js +1 -0
  57. package/dist/esm/pages/builder.js +1 -0
  58. package/dist/esm/pages/collection-detail.js +1 -0
  59. package/dist/esm/pages/preview.js +1 -0
  60. package/dist/esm/pages/product-detail.js +1 -0
  61. package/dist/esm/pages/static-v2.js +11 -2
  62. package/dist/esm/pages/static.js +1 -0
  63. package/dist/types/index.d.ts +7 -2
  64. package/package.json +5 -5
  65. package/dist/cjs/components/builder/InteractionSelectOnPageHeader.js +0 -191
  66. package/dist/esm/components/builder/InteractionSelectOnPageHeader.js +0 -187
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -5,7 +6,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
6
  var jsxRuntime = require('react/jsx-runtime');
6
7
  var core = require('@gem-sdk/core');
7
8
  var SwitchView = require('./SwitchView.js');
8
- var InteractionSelectOnPageHeader = require('./InteractionSelectOnPageHeader.js');
9
9
 
10
10
  const defaultMargin = {
11
11
  desktop: '16px',
@@ -22,7 +22,7 @@ const sizeCheck = {
22
22
  const Header = (props)=>{
23
23
  const { pageType, isOriginTemplate, openPageSetting } = props;
24
24
  const layoutSetting = core.useShopStore((s)=>s.layoutSettings);
25
- const sidebarMode = core.usePageStore((s)=>s.sidebarMode);
25
+ core.usePageStore((s)=>s.sidebarMode);
26
26
  const activeHeader = layoutSetting?.showHeader || isOriginTemplate;
27
27
  const headerColor = activeHeader ? HEADER_ON_COLOR : HEADER_OFF_COLOR;
28
28
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
@@ -180,8 +180,7 @@ const Header = (props)=>{
180
180
  })
181
181
  ]
182
182
  })
183
- }),
184
- sidebarMode === 'interaction' && /*#__PURE__*/ jsxRuntime.jsx(InteractionSelectOnPageHeader.default, {})
183
+ })
185
184
  ]
186
185
  });
187
186
  };
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -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
 
@@ -9,6 +9,7 @@ var generateManifres = require('../helpers/generate-manifres.js');
9
9
  var getFallback = require('../helpers/get-fallback.js');
10
10
  var normalize = require('../helpers/normalize.js');
11
11
  var parseJson = require('../helpers/parse-json.js');
12
+ var customFonts = require('../custom-fonts.js');
12
13
 
13
14
  const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
14
15
  try {
@@ -19,9 +20,8 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
19
20
  };
20
21
  const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
21
22
  fetcher([
22
- core.PreviewPageDocument,
23
- variables,
24
- 'previewPage'
23
+ core.PreviewThemePageDocument,
24
+ variables
25
25
  ]),
26
26
  fetcher([
27
27
  core.StorePropertyDocument
@@ -33,19 +33,21 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
33
33
  if (theme.status === 'rejected') {
34
34
  throw new Error(theme.reason?.[0]);
35
35
  }
36
- const dataBuilder = theme.value.previewPage;
36
+ const dataBuilder = theme.value.previewThemePage;
37
37
  if (!dataBuilder) {
38
38
  throw new Error(`No data builder found for slug: /preview/${slug}`);
39
39
  }
40
+ const themePageCustomFonts = dataBuilder.customFonts;
40
41
  const pageTemplate = normalize.parseBuilderTemplateV2(dataBuilder);
41
- const [elementFontStyle, fontStyle, fallback] = await Promise.all([
42
+ const [elementFontStyle, fontStyle, fallback, customFonts$1] = await Promise.all([
42
43
  googleFonts.getFontStyleFromPageTemplate(pageTemplate),
43
- googleFonts.getFontFromGlobalStyle(dataBuilder?.pageStyle?.data),
44
- getFallback.getFallbackV2(fetcher, pageTemplate)
44
+ googleFonts.getFontFromGlobalStyle(dataBuilder?.themeStyle?.data),
45
+ getFallback.getFallbackV2(fetcher, pageTemplate),
46
+ customFonts.getCustomFonts(themePageCustomFonts)
45
47
  ]);
46
48
  const mobileOnly = dataBuilder.isMobile ?? false;
47
- const description = dataBuilder?.themePageDataSEO?.find((item)=>item?.key === 'global-meta-description')?.value;
48
- const thumbnail = parseJson.parseJson(dataBuilder?.themePageDataSEO?.find((item)=>item?.key === 'global-meta-thumbnail')?.value);
49
+ const description = dataBuilder?.dataSEO?.find((item)=>item?.key === 'global-meta-description')?.value;
50
+ const thumbnail = parseJson.parseJson(dataBuilder?.dataSEO?.find((item)=>item?.key === 'global-meta-thumbnail')?.value);
49
51
  const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
50
52
  const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
51
53
  const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
@@ -119,7 +121,7 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
119
121
  const countryIsoCode = shopMeta?.localization.country.isoCode ?? null;
120
122
  const locale = !languageIsoCode || !countryIsoCode ? null : `${languageIsoCode}-${countryIsoCode}`;
121
123
  return parseJson.serializableJson({
122
- themeStyle: genCss.genCSS(dataBuilder?.pageStyle?.data, mobileOnly),
124
+ themeStyle: genCss.genCSS(dataBuilder?.themeStyle?.data, mobileOnly),
123
125
  fontStyle,
124
126
  elementFontStyle,
125
127
  builderData: pageTemplate,
@@ -135,11 +137,13 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
135
137
  swatches: parseJson.parseJson(shopData?.storeProperty?.swatchesConfig),
136
138
  seo,
137
139
  mobileOnly,
138
- gaTrackingId: dataBuilder.themePageAnalytic?.gaTrackingID ?? null,
139
- facebookPixelId: dataBuilder.themePageAnalytic?.fbPixelID ?? null,
140
- tiktokPixelId: dataBuilder.themePageAnalytic?.tiktokPixelID ?? null,
141
- customCodeHeader: dataBuilder.themePageCustomCode?.header ?? null,
142
- customCodeBody: dataBuilder.themePageCustomCode?.body ?? null
140
+ gaTrackingId: dataBuilder.analytic?.gaTrackingID ?? null,
141
+ facebookPixelId: dataBuilder.analytic?.fbPixelID ?? null,
142
+ tiktokPixelId: dataBuilder.analytic?.tiktokPixelID ?? null,
143
+ customCodeHeader: dataBuilder.customCode?.header ?? null,
144
+ customCodeBody: dataBuilder.customCode?.body ?? null,
145
+ customFonts: customFonts$1,
146
+ pageBackground: normalize.extractPageBackground(dataBuilder)
143
147
  });
144
148
  } catch (err) {
145
149
  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;
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var core = require('@gem-sdk/core');
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var jsxRuntime = require('react/jsx-runtime');
@@ -8,12 +9,12 @@ var Header = require('../components/builder/Header.js');
8
9
  var FooterForPostPurchase = require('../components/FooterForPostPurchase.js');
9
10
  var Script = require('next/script');
10
11
 
11
- const StaticPageV2 = ({ components, builderData, sectionData, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, isPreview, interaction })=>{
12
+ const StaticPageV2 = ({ components, builderData, sectionData, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, isPreview, interaction, pageBackground })=>{
12
13
  const baseAssetURL = process.env.NEXT_GP_BASE_ASSET_URL || 'https://d3kbi0je7pp4lw.cloudfront.net';
13
14
  useTrackingView.useTrackingView(shopToken, pageHandle);
14
15
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
15
16
  children: [
16
- parseHtml.parseHtml(customCodeHeader, true),
17
+ parseHtml.parseHtml(customCodeHeader),
17
18
  themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
18
19
  "data-id": "global-style",
19
20
  type: "text/css",
@@ -42,6 +43,13 @@ const StaticPageV2 = ({ components, builderData, sectionData, themeStyle, fontSt
42
43
  __html: customFonts
43
44
  }
44
45
  }, fontStyle),
46
+ pageBackground?.isUsePageBackground && pageBackground?.background && /*#__PURE__*/ jsxRuntime.jsx("style", {
47
+ children: `
48
+ body {
49
+ background: ${pageBackground.background};
50
+ }
51
+ `
52
+ }, `page_background_${pageBackground?.background}`),
45
53
  /*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
46
54
  productOffers: productOffers,
47
55
  publicStoreFrontData: publicStoreFrontData,
@@ -72,6 +80,7 @@ const StaticPageV2 = ({ components, builderData, sectionData, themeStyle, fontSt
72
80
  }),
73
81
  /*#__PURE__*/ jsxRuntime.jsx(Script, {
74
82
  defer: true,
83
+ strategy: "lazyOnload",
75
84
  src: `${baseAssetURL}/assets-v2/gp-flow-action-lip.js`
76
85
  })
77
86
  ]
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { Component } from 'react';
3
4
 
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsxs, jsx } from 'react/jsx-runtime';
2
3
 
3
4
  const ErrorFallback = ({ error, resetErrorBoundary })=>{
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { fpixel } from '@gem-sdk/core';
3
4
  import { usePathname, useSearchParams } from 'next/navigation';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsx, jsxs } from 'react/jsx-runtime';
2
3
  import { cls, makeStyleResponsive } from '@gem-sdk/core';
3
4
 
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
3
  import { gtag } from '@gem-sdk/core';
3
4
  import { useSearchParams, usePathname } from 'next/navigation';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import Script from 'next/script';
3
4
 
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsxs, jsx } from 'react/jsx-runtime';
2
3
  import { useMemo } from 'react';
3
4
  import { useInteraction, cls, RenderPreview } from '@gem-sdk/core';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
3
  import { useShopStore, cls, makeStyleResponsive } from '@gem-sdk/core';
3
4
  import { useState, useEffect } from 'react';
@@ -1,7 +1,7 @@
1
+ 'use client';
1
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
3
  import { useShopStore, usePageStore, cls, makeStyleResponsive } from '@gem-sdk/core';
3
4
  import Devices from './SwitchView.js';
4
- import InteractionSelectOnPageHeader from './InteractionSelectOnPageHeader.js';
5
5
 
6
6
  const defaultMargin = {
7
7
  desktop: '16px',
@@ -18,7 +18,7 @@ const sizeCheck = {
18
18
  const Header = (props)=>{
19
19
  const { pageType, isOriginTemplate, openPageSetting } = props;
20
20
  const layoutSetting = useShopStore((s)=>s.layoutSettings);
21
- const sidebarMode = usePageStore((s)=>s.sidebarMode);
21
+ usePageStore((s)=>s.sidebarMode);
22
22
  const activeHeader = layoutSetting?.showHeader || isOriginTemplate;
23
23
  const headerColor = activeHeader ? HEADER_ON_COLOR : HEADER_OFF_COLOR;
24
24
  return /*#__PURE__*/ jsxs(Fragment, {
@@ -176,8 +176,7 @@ const Header = (props)=>{
176
176
  })
177
177
  ]
178
178
  })
179
- }),
180
- sidebarMode === 'interaction' && /*#__PURE__*/ jsx(InteractionSelectOnPageHeader, {})
179
+ })
181
180
  ]
182
181
  });
183
182
  };
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { useBuilderPreviewStore, useModalStore, useInteraction, cls } from '@gem-sdk/core';
3
4
  import { memo, useMemo, useCallback, useEffect } from 'react';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
3
  import { useState, useCallback, useEffect, useRef } from 'react';
3
4
  import { devices } from './const.js';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsx, Fragment } from 'react/jsx-runtime';
2
3
  import { memo, useRef, useCallback, useEffect } from 'react';
3
4
  import { getDOMElementParents } from './toolbar/utils/getDOMElementParents.js';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { useMatchMutate, useShopStore, usePageStore, useBuilderPreviewStore, useSectionStore, useModalStore } from '@gem-sdk/core';
3
4
  import { memo, useMemo, useCallback, useEffect } from 'react';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsx, jsxs } from 'react/jsx-runtime';
2
3
  import { useMemo } from 'react';
3
4
  import { useShopStore, useBuilderPreviewStore, makeStyleResponsive } from '@gem-sdk/core';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsxs, jsx } from 'react/jsx-runtime';
2
3
 
3
4
  const DropElement = ()=>{
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
3
  import { useBuilderPreviewStore, cls } from '@gem-sdk/core';
3
4
  import { DropElement } from './DropElement.js';
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
3
  import { useShopStore, cls, AddOn } from '@gem-sdk/core';
3
4
  import { parseHtml } from '../libs/parse-html.js';
@@ -1,18 +1,22 @@
1
- import { StorePropertyDocument } from '@gem-sdk/core';
1
+ import { StorePropertyDocument, ShopShopifyDocument } from '@gem-sdk/core';
2
2
  import { ShopMetaDocument } from '@gem-sdk/adapter-shopify';
3
3
  import { serializableJson, parseJson } from '../helpers/parse-json.js';
4
4
 
5
5
  const getBuilderProps = async (fetcher, shopifyFetcher)=>{
6
- const [storeProperty, shopifyMeta] = await Promise.allSettled([
6
+ const [storeProperty, shopifyMeta, shopifyInfo] = await Promise.allSettled([
7
7
  fetcher([
8
8
  StorePropertyDocument
9
9
  ]),
10
10
  shopifyFetcher([
11
11
  ShopMetaDocument
12
+ ]),
13
+ fetcher([
14
+ ShopShopifyDocument
12
15
  ])
13
16
  ]);
14
17
  const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
15
18
  const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
19
+ const shopInfo = shopifyInfo.status === 'fulfilled' ? shopifyInfo.value : undefined;
16
20
  const seo = shopMeta ? {
17
21
  titleTemplate: `%s | ${shopMeta.shop.name}`,
18
22
  defaultTitle: shopMeta?.shop.name,
@@ -32,7 +36,8 @@ const getBuilderProps = async (fetcher, shopifyFetcher)=>{
32
36
  swr: {
33
37
  revalidateOnMount: true
34
38
  },
35
- seo
39
+ seo,
40
+ timezone: shopInfo?.shopShopify?.timezone
36
41
  });
37
42
  };
38
43
 
@@ -1,12 +1,13 @@
1
- import { PreviewPageDocument, StorePropertyDocument } from '@gem-sdk/core';
1
+ import { PreviewThemePageDocument, StorePropertyDocument } from '@gem-sdk/core';
2
2
  import { ShopMetaDocument } from '@gem-sdk/adapter-shopify';
3
3
  import { captureException } from '@sentry/nextjs';
4
4
  import { getFontStyleFromPageTemplate, getFontFromGlobalStyle } from '../google-fonts.js';
5
5
  import { genCSS } from '../helpers/gen-css.js';
6
6
  import { generateManifest } from '../helpers/generate-manifres.js';
7
7
  import { getFallbackV2 } from '../helpers/get-fallback.js';
8
- import { parseBuilderTemplateV2 } from '../helpers/normalize.js';
8
+ import { parseBuilderTemplateV2, extractPageBackground } from '../helpers/normalize.js';
9
9
  import { parseJson, serializableJson } from '../helpers/parse-json.js';
10
+ import { getCustomFonts } from '../custom-fonts.js';
10
11
 
11
12
  const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
12
13
  try {
@@ -17,9 +18,8 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
17
18
  };
18
19
  const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
19
20
  fetcher([
20
- PreviewPageDocument,
21
- variables,
22
- 'previewPage'
21
+ PreviewThemePageDocument,
22
+ variables
23
23
  ]),
24
24
  fetcher([
25
25
  StorePropertyDocument
@@ -31,19 +31,21 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
31
31
  if (theme.status === 'rejected') {
32
32
  throw new Error(theme.reason?.[0]);
33
33
  }
34
- const dataBuilder = theme.value.previewPage;
34
+ const dataBuilder = theme.value.previewThemePage;
35
35
  if (!dataBuilder) {
36
36
  throw new Error(`No data builder found for slug: /preview/${slug}`);
37
37
  }
38
+ const themePageCustomFonts = dataBuilder.customFonts;
38
39
  const pageTemplate = parseBuilderTemplateV2(dataBuilder);
39
- const [elementFontStyle, fontStyle, fallback] = await Promise.all([
40
+ const [elementFontStyle, fontStyle, fallback, customFonts] = await Promise.all([
40
41
  getFontStyleFromPageTemplate(pageTemplate),
41
- getFontFromGlobalStyle(dataBuilder?.pageStyle?.data),
42
- getFallbackV2(fetcher, pageTemplate)
42
+ getFontFromGlobalStyle(dataBuilder?.themeStyle?.data),
43
+ getFallbackV2(fetcher, pageTemplate),
44
+ getCustomFonts(themePageCustomFonts)
43
45
  ]);
44
46
  const mobileOnly = dataBuilder.isMobile ?? false;
45
- const description = dataBuilder?.themePageDataSEO?.find((item)=>item?.key === 'global-meta-description')?.value;
46
- const thumbnail = parseJson(dataBuilder?.themePageDataSEO?.find((item)=>item?.key === 'global-meta-thumbnail')?.value);
47
+ const description = dataBuilder?.dataSEO?.find((item)=>item?.key === 'global-meta-description')?.value;
48
+ const thumbnail = parseJson(dataBuilder?.dataSEO?.find((item)=>item?.key === 'global-meta-thumbnail')?.value);
47
49
  const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
48
50
  const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
49
51
  const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
@@ -117,7 +119,7 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
117
119
  const countryIsoCode = shopMeta?.localization.country.isoCode ?? null;
118
120
  const locale = !languageIsoCode || !countryIsoCode ? null : `${languageIsoCode}-${countryIsoCode}`;
119
121
  return serializableJson({
120
- themeStyle: genCSS(dataBuilder?.pageStyle?.data, mobileOnly),
122
+ themeStyle: genCSS(dataBuilder?.themeStyle?.data, mobileOnly),
121
123
  fontStyle,
122
124
  elementFontStyle,
123
125
  builderData: pageTemplate,
@@ -133,11 +135,13 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
133
135
  swatches: parseJson(shopData?.storeProperty?.swatchesConfig),
134
136
  seo,
135
137
  mobileOnly,
136
- gaTrackingId: dataBuilder.themePageAnalytic?.gaTrackingID ?? null,
137
- facebookPixelId: dataBuilder.themePageAnalytic?.fbPixelID ?? null,
138
- tiktokPixelId: dataBuilder.themePageAnalytic?.tiktokPixelID ?? null,
139
- customCodeHeader: dataBuilder.themePageCustomCode?.header ?? null,
140
- customCodeBody: dataBuilder.themePageCustomCode?.body ?? null
138
+ gaTrackingId: dataBuilder.analytic?.gaTrackingID ?? null,
139
+ facebookPixelId: dataBuilder.analytic?.fbPixelID ?? null,
140
+ tiktokPixelId: dataBuilder.analytic?.tiktokPixelID ?? null,
141
+ customCodeHeader: dataBuilder.customCode?.header ?? null,
142
+ customCodeBody: dataBuilder.customCode?.body ?? null,
143
+ customFonts,
144
+ pageBackground: extractPageBackground(dataBuilder)
141
145
  });
142
146
  } catch (err) {
143
147
  captureException(err);