@gem-sdk/pages 1.23.0-staging.27 → 1.23.0-staging.270

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.
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { useMatchMutate, useShopStore, useBuilderPreviewStore, useSectionStore, useModalStore } from '@gem-sdk/core';
2
+ import { useMatchMutate, useShopStore, usePageStore, useBuilderPreviewStore, useSectionStore, useModalStore } from '@gem-sdk/core';
3
3
  import { memo, useMemo, useCallback, useEffect } from 'react';
4
4
  import { getStorefrontApi } from '../../libs/get-storefront-api.js';
5
5
  import { createFontUrl } from '../../libs/google-fonts.js';
@@ -8,24 +8,23 @@ import { getFontsFromDataBuilder } from '../../libs/helpers/gen-fonts.js';
8
8
  import { shopifyCdnWithGoogleFonts } from '../../libs/shopify-cdn-with-google-fonts.js';
9
9
 
10
10
  const globalStyleId = 'global-style';
11
- const globalFontId = 'google-font-builder';
12
- const fontElementSettingClassName = 'google-font-element';
13
11
  const Toolbox = ()=>{
14
12
  const matchMutate = useMatchMutate();
15
13
  const provider = useShopStore((s)=>s.provider);
16
14
  const changeStorefrontInfo = useShopStore((s)=>s.changeStorefrontInfo);
15
+ const setDynamicProduct = usePageStore((s)=>s.setDynamicProduct);
16
+ const setDynamicCollection = usePageStore((s)=>s.setDynamicCollection);
17
17
  const initState = useBuilderPreviewStore((s)=>s.initState);
18
18
  const state = useBuilderPreviewStore((s)=>s.state);
19
19
  const initNormalizeState = useBuilderPreviewStore((s)=>s.forceChangeState);
20
20
  const forceChangeItemProp = useBuilderPreviewStore((s)=>s.forceChangeItemProp);
21
21
  const changeItemPropByKey = useBuilderPreviewStore((s)=>s.changeItemPropByKey);
22
- const setDynamicProduct = useBuilderPreviewStore((s)=>s.setDynamicProduct);
23
- const setDynamicCollection = useBuilderPreviewStore((s)=>s.setDynamicCollection);
24
22
  const addItem = useBuilderPreviewStore((s)=>s.addItem);
25
23
  const moveItem = useBuilderPreviewStore((s)=>s.moveItem);
26
24
  const removeItem = useBuilderPreviewStore((s)=>s.removeItem);
27
25
  const addSection = useSectionStore((s)=>s.addSection);
28
26
  const changeSwatches = useShopStore((s)=>s.changeSwatches);
27
+ const updateItemName = useBuilderPreviewStore((s)=>s.updateItemName);
29
28
  const changeLayoutSettings = useShopStore((s)=>s.changeLayoutSettings);
30
29
  const changeCreateThemeSectionCount = useShopStore((s)=>s.changeCreateThemeSectionCount);
31
30
  const changeShopPlan = useShopStore((s)=>s.changeShopPlan);
@@ -33,11 +32,62 @@ const Toolbox = ()=>{
33
32
  const fonts = useMemo(()=>getFontsFromDataBuilder(state), [
34
33
  state
35
34
  ]);
36
- const customFontUrl = useMemo(()=>{
37
- return createFontUrl(fonts);
38
- }, [
39
- fonts
40
- ]);
35
+ const setFontsToHead = (className, fonts)=>{
36
+ // clear fonts
37
+ if (!fonts?.length) {
38
+ const googleFonts = document.querySelectorAll(`.${className}`);
39
+ googleFonts.forEach((googleFont)=>{
40
+ googleFont.remove();
41
+ });
42
+ return;
43
+ }
44
+ // clear fonts not use
45
+ const googleFonts = document.querySelectorAll(`.${className}`);
46
+ googleFonts.forEach((googleFont)=>{
47
+ const fontName = googleFont.getAttribute('data-font');
48
+ const variantName = googleFont.getAttribute('data-font-variant');
49
+ if (!fontName || !variantName) {
50
+ googleFont.remove();
51
+ } else {
52
+ const isUse = fonts.find((font)=>font.family == fontName && font.variants.includes(variantName));
53
+ if (!isUse) {
54
+ googleFont.remove();
55
+ }
56
+ }
57
+ });
58
+ // append new fonts
59
+ for (const font of fonts){
60
+ if (font.type !== 'custom') {
61
+ if (font.variants?.length) {
62
+ for (const variant of font.variants){
63
+ const cloneFont = JSON.parse(JSON.stringify(font));
64
+ cloneFont.variants = [
65
+ variant
66
+ ]; // set single variant. Fix error reload font when change href other variant
67
+ const fontName = cloneFont.family;
68
+ const variantName = variant;
69
+ const url = createFontUrl([
70
+ cloneFont
71
+ ]);
72
+ if (url) {
73
+ const googleFont = document.querySelector(`.${className}[data-font="${fontName}"][data-font-variant="${variantName}"]`);
74
+ if (googleFont) {
75
+ continue;
76
+ } else {
77
+ const link = document.createElement('link');
78
+ link.className = className;
79
+ link.dataset.font = fontName;
80
+ link.dataset.fontVariant = variantName;
81
+ link.href = url;
82
+ link.rel = 'stylesheet';
83
+ document.head.appendChild(link);
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ };
41
91
  // Revalidate all query with key match query/
42
92
  const onRevalidateQuery = useCallback(()=>{
43
93
  matchMutate(/query\//, {
@@ -73,22 +123,8 @@ const Toolbox = ()=>{
73
123
  }
74
124
  return item;
75
125
  });
76
- const fontUrl = createFontUrl(font);
77
126
  const globalStyle = document.getElementById(globalStyleId);
78
- const googleFont = document.getElementById(globalFontId);
79
- if (fontUrl) {
80
- if (googleFont) {
81
- if (googleFont.getAttribute('href') !== fontUrl) {
82
- googleFont.setAttribute('href', fontUrl);
83
- }
84
- } else {
85
- const link = document.createElement('link');
86
- link.id = globalFontId;
87
- link.href = fontUrl;
88
- link.rel = 'stylesheet';
89
- document.head.appendChild(link);
90
- }
91
- }
127
+ setFontsToHead('google-font-builder', font);
92
128
  if (globalStyle) {
93
129
  globalStyle.innerHTML = themeStyle;
94
130
  } else {
@@ -222,52 +258,54 @@ const Toolbox = ()=>{
222
258
  changeLayoutSettings
223
259
  ]);
224
260
  const onUpdateCreateThemeSectionCount = useCallback((e)=>{
225
- const detail = e.detail;
226
- if (!detail) return;
227
- changeCreateThemeSectionCount(detail);
261
+ const count = e.detail;
262
+ if (!count) return;
263
+ changeCreateThemeSectionCount(count);
228
264
  }, [
229
265
  changeCreateThemeSectionCount
230
266
  ]);
231
267
  const onUpdateShopPlan = useCallback((e)=>{
232
- const detail = e.detail;
233
- if (!detail) return;
234
- changeShopPlan(detail);
268
+ const shopPlan = e.detail;
269
+ if (!shopPlan) return;
270
+ changeShopPlan(shopPlan);
235
271
  }, [
236
272
  changeShopPlan
237
273
  ]);
238
274
  const onUpdateDynamicProduct = useCallback((e)=>{
239
- const detail = e.detail;
240
- if (!detail) return;
241
- setDynamicProduct(detail);
275
+ const product = e.detail;
276
+ if (!product) return;
277
+ setDynamicProduct(product);
242
278
  }, [
243
279
  setDynamicProduct
244
280
  ]);
245
281
  const onUpdateDynamicCollection = useCallback((e)=>{
246
- const detail = e.detail;
247
- if (!detail) return;
248
- setDynamicCollection(detail);
282
+ const collection = e.detail;
283
+ if (!collection) return;
284
+ setDynamicCollection(collection);
249
285
  }, [
250
286
  setDynamicCollection
251
287
  ]);
252
288
  useEffect(()=>{
253
- if (customFontUrl) {
254
- const fontId = 'google-font';
255
- const googleFont = document.querySelector(`.${fontElementSettingClassName}[data-font="${fontId}"]`);
256
- if (googleFont) {
257
- if (googleFont.getAttribute('href') !== customFontUrl) {
258
- googleFont.setAttribute('href', customFontUrl);
259
- }
260
- } else {
261
- const link = document.createElement('link');
262
- link.className = fontElementSettingClassName;
263
- link.dataset.font = fontId;
264
- link.href = customFontUrl;
265
- link.rel = 'stylesheet';
266
- document.head.appendChild(link);
267
- }
289
+ if (fonts) {
290
+ setFontsToHead('google-font-element', fonts);
291
+ }
292
+ }, [
293
+ fonts
294
+ ]);
295
+ const onUpdateItemName = useCallback((e)=>{
296
+ const detail = e.detail;
297
+ if (detail.uid) {
298
+ updateItemName(detail.uid, detail.name || '');
268
299
  }
269
300
  }, [
270
- customFontUrl
301
+ updateItemName
302
+ ]);
303
+ useEffect(()=>{
304
+ if (fonts) {
305
+ setFontsToHead('google-font-element', fonts);
306
+ }
307
+ }, [
308
+ fonts
271
309
  ]);
272
310
  useEffect(()=>{
273
311
  window.addEventListener('update-shop-info', onChangeShopInfo);
@@ -285,6 +323,7 @@ const Toolbox = ()=>{
285
323
  window.addEventListener('update-shop-plan', onUpdateShopPlan);
286
324
  window.addEventListener('set-dynamic-product', onUpdateDynamicProduct);
287
325
  window.addEventListener('set-dynamic-collection', onUpdateDynamicCollection);
326
+ window.addEventListener('update-item-name', onUpdateItemName);
288
327
  return ()=>{
289
328
  window.removeEventListener('update-shop-info', onChangeShopInfo);
290
329
  window.removeEventListener('revalidate-query', onRevalidateQuery);
@@ -300,6 +339,7 @@ const Toolbox = ()=>{
300
339
  window.removeEventListener('update-shop-plan', onUpdateShopPlan);
301
340
  window.removeEventListener('set-dynamic-product', onUpdateDynamicProduct);
302
341
  window.removeEventListener('set-dynamic-collection', onUpdateDynamicCollection);
342
+ window.removeEventListener('update-item-name', onUpdateItemName);
303
343
  };
304
344
  }, [
305
345
  onAddEntity,
@@ -316,7 +356,8 @@ const Toolbox = ()=>{
316
356
  onChangeLayoutSettingData,
317
357
  onUpdateCreateThemeSectionCount,
318
358
  onUpdateDynamicProduct,
319
- onUpdateDynamicCollection
359
+ onUpdateDynamicCollection,
360
+ onUpdateItemName
320
361
  ]);
321
362
  return /*#__PURE__*/ jsx("div", {
322
363
  className: "toolbox"
@@ -0,0 +1,106 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { memo } from 'react';
3
+
4
+ const Onboarding = ({ enable, position, onCloseOnboarding })=>{
5
+ const closeOnboarding = ()=>{
6
+ onCloseOnboarding();
7
+ };
8
+ const videoSrc = 'https://ucarecdn.com/de5fd2eb-4525-45a7-ad13-53960dac225e/';
9
+ const Video = ()=>{
10
+ return /*#__PURE__*/ jsxs("video", {
11
+ width: "100%",
12
+ className: "w-full",
13
+ loop: true,
14
+ muted: true,
15
+ autoPlay: true,
16
+ playsInline: true,
17
+ children: [
18
+ /*#__PURE__*/ jsx("source", {
19
+ src: videoSrc,
20
+ type: "video/mp4"
21
+ }),
22
+ "Sorry, your browser doesn‘t support embedded videos."
23
+ ]
24
+ });
25
+ };
26
+ const MemoVideo = /*#__PURE__*/ memo(Video);
27
+ return /*#__PURE__*/ jsx("div", {
28
+ "data-toolbar-onboarding": true,
29
+ "data-toolbar-onboarding-position": position,
30
+ children: enable && /*#__PURE__*/ jsxs(Fragment, {
31
+ children: [
32
+ /*#__PURE__*/ jsx("span", {
33
+ "data-icon": true,
34
+ "data-position": position,
35
+ children: position === 'bottom' ? /*#__PURE__*/ jsx("svg", {
36
+ width: "8",
37
+ height: "4",
38
+ viewBox: "0 0 8 4",
39
+ fill: "none",
40
+ xmlns: "http://www.w3.org/2000/svg",
41
+ children: /*#__PURE__*/ jsx("path", {
42
+ d: "M-1.74846e-07 4L4 -1.74846e-07L8 4L-1.74846e-07 4Z",
43
+ fill: "white"
44
+ })
45
+ }) : /*#__PURE__*/ jsx("svg", {
46
+ width: "8",
47
+ height: "4",
48
+ viewBox: "0 0 8 4",
49
+ fill: "none",
50
+ xmlns: "http://www.w3.org/2000/svg",
51
+ children: /*#__PURE__*/ jsx("path", {
52
+ d: "M8 3.33818e-07L4 4L4.76995e-08 7.15256e-07L8 3.33818e-07Z",
53
+ fill: "white"
54
+ })
55
+ })
56
+ }),
57
+ /*#__PURE__*/ jsxs("div", {
58
+ "data-onboarding-wrapper": true,
59
+ children: [
60
+ /*#__PURE__*/ jsx("button", {
61
+ "data-close": true,
62
+ type: "button",
63
+ onClick: closeOnboarding,
64
+ children: /*#__PURE__*/ jsxs("svg", {
65
+ width: "32",
66
+ height: "32",
67
+ viewBox: "0 0 32 32",
68
+ fill: "none",
69
+ xmlns: "http://www.w3.org/2000/svg",
70
+ children: [
71
+ /*#__PURE__*/ jsx("path", {
72
+ fillRule: "evenodd",
73
+ clipRule: "evenodd",
74
+ d: "M10.6464 10.6464C10.8417 10.4512 11.1583 10.4512 11.3536 10.6464L21.3536 20.6464C21.5488 20.8417 21.5488 21.1583 21.3536 21.3536C21.1583 21.5488 20.8417 21.5488 20.6464 21.3536L10.6464 11.3536C10.4512 11.1583 10.4512 10.8417 10.6464 10.6464Z",
75
+ fill: "#212121"
76
+ }),
77
+ /*#__PURE__*/ jsx("path", {
78
+ fillRule: "evenodd",
79
+ clipRule: "evenodd",
80
+ d: "M21.3536 10.6464C21.5488 10.8417 21.5488 11.1583 21.3536 11.3536L11.3536 21.3536C11.1583 21.5488 10.8417 21.5488 10.6464 21.3536C10.4512 21.1583 10.4512 20.8417 10.6464 20.6464L20.6464 10.6464C20.8417 10.4512 21.1583 10.4512 21.3536 10.6464Z",
81
+ fill: "#212121"
82
+ })
83
+ ]
84
+ })
85
+ }),
86
+ /*#__PURE__*/ jsx(MemoVideo, {}),
87
+ /*#__PURE__*/ jsxs("div", {
88
+ "data-content": true,
89
+ children: [
90
+ /*#__PURE__*/ jsx("h3", {
91
+ children: "New way to select parent element"
92
+ }),
93
+ /*#__PURE__*/ jsx("p", {
94
+ children: "Select parent from here in case you can‘t find yours at times."
95
+ })
96
+ ]
97
+ })
98
+ ]
99
+ })
100
+ ]
101
+ })
102
+ });
103
+ };
104
+ var Onboarding$1 = /*#__PURE__*/ memo(Onboarding);
105
+
106
+ export { Onboarding$1 as default };
@@ -33,11 +33,6 @@ const AddSectionImageToLayout = ({ editorImageToLayout })=>{
33
33
  const totalSection = useBuilderPreviewStore((state)=>state.state.ROOT.childrens?.length);
34
34
  const [link, setLink] = useState('');
35
35
  const [isInput, setIsInput] = useState(false);
36
- const onClick = (index)=>{
37
- if (index === 1) {
38
- setIsInput(true);
39
- }
40
- };
41
36
  useEffect(()=>{
42
37
  if (!isInput || totalSection === 0) {
43
38
  setLink('');
@@ -78,11 +73,10 @@ const AddSectionImageToLayout = ({ editorImageToLayout })=>{
78
73
  className: "absolute top-[-12px] bg-white px-[8px] text-[14px] font-normal text-[#9E9E9E]",
79
74
  children: "Add section"
80
75
  }),
81
- ACTIONS_DATA.map((action, index)=>{
76
+ ACTIONS_DATA.map((action)=>{
82
77
  return /*#__PURE__*/ jsxs("div", {
83
78
  className: `relative mx-1 h-[60px] w-[172px] cursor-pointer flex-col items-center justify-center rounded-[3px] bg-[#F4F4F4] hover:bg-black/10 ${isInput ? 'hidden' : 'flex'}`,
84
79
  id: action.id,
85
- onClick: ()=>onClick(index),
86
80
  "aria-hidden": true,
87
81
  children: [
88
82
  /*#__PURE__*/ jsxs("div", {
@@ -1,6 +1,6 @@
1
1
  import { PublishedThemePagesDocument, StorePropertyDocument } from '@gem-sdk/core';
2
2
  import { ShopMetaDocument } from '@gem-sdk/adapter-shopify';
3
- import { getFontFromGlobalStyle } from '../google-fonts.js';
3
+ import { getFontStyleFromPageTemplate, getFontFromGlobalStyle } from '../google-fonts.js';
4
4
  import { genCSS } from '../helpers/gen-css.js';
5
5
  import { generateManifest } from '../helpers/generate-manifres.js';
6
6
  import { getFallbackV2 } from '../helpers/get-fallback.js';
@@ -33,7 +33,8 @@ const getHomePagePropsV2 = (fetcher, shopifyFetcher)=>async ()=>{
33
33
  throw new Error(`No data builder found for Home page`);
34
34
  }
35
35
  const homeTemplate = parseBuilderTemplateV2(dataBuilder);
36
- const [fontStyle, fallback] = await Promise.all([
36
+ const [elementFontStyle, fontStyle, fallback] = await Promise.all([
37
+ getFontStyleFromPageTemplate(homeTemplate),
37
38
  getFontFromGlobalStyle(dataBuilder?.pageStyle?.data),
38
39
  getFallbackV2(fetcher, homeTemplate)
39
40
  ]);
@@ -113,6 +114,7 @@ const getHomePagePropsV2 = (fetcher, shopifyFetcher)=>async ()=>{
113
114
  return serializableJson({
114
115
  themeStyle: genCSS(dataBuilder?.pageStyle?.data, mobileOnly),
115
116
  fontStyle,
117
+ elementFontStyle,
116
118
  builderData: homeTemplate,
117
119
  swr: {
118
120
  fallback
@@ -1,7 +1,7 @@
1
1
  import { PreviewPageDocument, StorePropertyDocument } from '@gem-sdk/core';
2
2
  import { ShopMetaDocument } from '@gem-sdk/adapter-shopify';
3
3
  import { captureException } from '@sentry/nextjs';
4
- import { getFontFromGlobalStyle } from '../google-fonts.js';
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';
@@ -36,7 +36,8 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
36
36
  throw new Error(`No data builder found for slug: /preview/${slug}`);
37
37
  }
38
38
  const pageTemplate = parseBuilderTemplateV2(dataBuilder);
39
- const [fontStyle, fallback] = await Promise.all([
39
+ const [elementFontStyle, fontStyle, fallback] = await Promise.all([
40
+ getFontStyleFromPageTemplate(pageTemplate),
40
41
  getFontFromGlobalStyle(dataBuilder?.pageStyle?.data),
41
42
  getFallbackV2(fetcher, pageTemplate)
42
43
  ]);
@@ -118,6 +119,7 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
118
119
  return serializableJson({
119
120
  themeStyle: genCSS(dataBuilder?.pageStyle?.data, mobileOnly),
120
121
  fontStyle,
122
+ elementFontStyle,
121
123
  builderData: pageTemplate,
122
124
  pageType,
123
125
  moneyFormat: shopMeta?.shop.moneyFormat ?? null,
@@ -7,7 +7,12 @@ async function getFontForUA(url, UA) {
7
7
  headers: {
8
8
  'User-Agent': UA
9
9
  }
10
- }).then((res)=>res.text());
10
+ }).then((res)=>{
11
+ if (res.status === 200) {
12
+ return res.text();
13
+ }
14
+ return '';
15
+ });
11
16
  }
12
17
  const composeFonts = (fonts)=>{
13
18
  const uniqFonts = fonts.filter((font, index, arr)=>{
@@ -17,7 +17,12 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
17
17
  const value = groupSetting[attr];
18
18
  if (value) {
19
19
  const customFontFamily = value.custom?.fontFamily;
20
- const customFontVariants = value.custom?.fontVariants;
20
+ let customFontVariants = value.custom?.fontVariants;
21
+ if (!customFontVariants?.length) {
22
+ customFontVariants = [
23
+ value.custom?.fontWeight
24
+ ];
25
+ }
21
26
  if (customFontFamily && customFontVariants?.length) {
22
27
  const variants = customFontVariants.map((item)=>{
23
28
  switch(item){
@@ -34,11 +39,17 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
34
39
  if (isFontFamily) {
35
40
  isFontFamily.variants.push(customFontWeight);
36
41
  } else {
42
+ const fontVariants = [
43
+ customFontWeight
44
+ ];
45
+ if (customFontWeight !== '700') {
46
+ if (variants.includes('700')) {
47
+ fontVariants.push('700'); // Auto add 700 for bold in editor inline
48
+ }
49
+ }
37
50
  fonts.push({
38
51
  family: customFontFamily,
39
- variants: [
40
- customFontWeight
41
- ],
52
+ variants: fontVariants,
42
53
  subsets: [],
43
54
  type: 'google'
44
55
  });
@@ -1,5 +1,5 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { BuilderComponentProvider, SectionProvider, BuilderPreviewProvider, RenderPreview } from '@gem-sdk/core';
2
+ import { PageProvider, BuilderComponentProvider, SectionProvider, BuilderPreviewProvider, RenderPreview } from '@gem-sdk/core';
3
3
  import { NextSeo } from 'next-seo';
4
4
  import Head from 'next/head';
5
5
  import { useState, useMemo, useEffect } from 'react';
@@ -12,7 +12,7 @@ import ImageToLayout from '../components/image-to-layout/ImageToLayout.js';
12
12
  import AddSectionImageToLayout from '../components/image-to-layout/AddSectionImageToLayout.js';
13
13
  import Toolbar from '../components/builder/Toolbar.js';
14
14
 
15
- const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor })=>{
15
+ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar })=>{
16
16
  const [loadSuccess, setLoadSuccess] = useState(false);
17
17
  const initState = useMemo(()=>({
18
18
  ROOT: {
@@ -48,48 +48,50 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
48
48
  })
49
49
  ]
50
50
  }),
51
- /*#__PURE__*/ jsx(BuilderComponentProvider, {
52
- components: components,
53
- children: /*#__PURE__*/ jsx(SectionProvider, {
54
- data: sectionData,
55
- children: /*#__PURE__*/ jsxs(BuilderPreviewProvider, {
56
- state: initState,
57
- isThemeSectionEditor: isThemeSectionEditor,
58
- children: [
59
- /*#__PURE__*/ jsx(Toolbox, {}),
60
- /*#__PURE__*/ jsx(Toolbar, {}),
61
- /*#__PURE__*/ jsx(PopupManager, {}),
62
- loadSuccess && /*#__PURE__*/ jsxs("div", {
63
- className: "builder z-1 relative",
64
- children: [
65
- isThemeSectionEditor ? /*#__PURE__*/ jsx("div", {
66
- className: "h-[40px] bg-[#f4f4f4]"
67
- }) : /*#__PURE__*/ jsx(Header, {}),
68
- /*#__PURE__*/ jsx("div", {
69
- id: "storefront",
70
- className: isThemeSectionEditor ? 'theme-section-editor' : '',
71
- children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsx(CollectionGlobalProvider, {
72
- children: /*#__PURE__*/ jsx(RenderPreview, {
51
+ /*#__PURE__*/ jsx(PageProvider, {
52
+ children: /*#__PURE__*/ jsx(BuilderComponentProvider, {
53
+ components: components,
54
+ children: /*#__PURE__*/ jsx(SectionProvider, {
55
+ data: sectionData,
56
+ children: /*#__PURE__*/ jsxs(BuilderPreviewProvider, {
57
+ state: initState,
58
+ isThemeSectionEditor: isThemeSectionEditor,
59
+ children: [
60
+ /*#__PURE__*/ jsx(Toolbox, {}),
61
+ !hiddenToolbar && /*#__PURE__*/ jsx(Toolbar, {}),
62
+ /*#__PURE__*/ jsx(PopupManager, {}),
63
+ loadSuccess && /*#__PURE__*/ jsxs("div", {
64
+ className: "builder z-1 relative",
65
+ children: [
66
+ !hiddenToolbar && (isThemeSectionEditor ? /*#__PURE__*/ jsx("div", {
67
+ className: "h-[40px] bg-[#f4f4f4]"
68
+ }) : /*#__PURE__*/ jsx(Header, {})),
69
+ /*#__PURE__*/ jsx("div", {
70
+ id: "storefront",
71
+ className: isThemeSectionEditor ? 'theme-section-editor' : '',
72
+ children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsx(CollectionGlobalProvider, {
73
+ children: /*#__PURE__*/ jsx(RenderPreview, {
74
+ uid: "ROOT"
75
+ })
76
+ }) : /*#__PURE__*/ jsx(RenderPreview, {
73
77
  uid: "ROOT"
74
78
  })
75
- }) : /*#__PURE__*/ jsx(RenderPreview, {
76
- uid: "ROOT"
77
- })
78
- }),
79
- /*#__PURE__*/ jsx(ImageToLayout, {
80
- editorImageToLayout: editorImageToLayout || false
81
- }),
82
- /*#__PURE__*/ jsx(AddSectionImageToLayout, {
83
- editorImageToLayout: editorImageToLayout || false
84
- }),
85
- /*#__PURE__*/ jsx("div", {
86
- id: "visual-content"
87
- }),
88
- !isThemeSectionEditor && /*#__PURE__*/ jsx(Footer, {})
89
- ]
90
- })
91
- ]
92
- }, "preview")
79
+ }),
80
+ /*#__PURE__*/ jsx(ImageToLayout, {
81
+ editorImageToLayout: editorImageToLayout || false
82
+ }),
83
+ /*#__PURE__*/ jsx(AddSectionImageToLayout, {
84
+ editorImageToLayout: editorImageToLayout || false
85
+ }),
86
+ /*#__PURE__*/ jsx("div", {
87
+ id: "visual-content"
88
+ }),
89
+ !isThemeSectionEditor && !hiddenToolbar && /*#__PURE__*/ jsx(Footer, {})
90
+ ]
91
+ })
92
+ ]
93
+ }, "preview")
94
+ })
93
95
  })
94
96
  })
95
97
  ]
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { BuilderComponentProvider, SectionProvider, BuilderProvider, Render } from '@gem-sdk/core';
2
+ import { PageProvider, BuilderComponentProvider, SectionProvider, BuilderProvider, Render } from '@gem-sdk/core';
3
3
  import { NextSeo } from 'next-seo';
4
4
  import dynamic from 'next/dynamic';
5
5
  import Head from 'next/head';
@@ -36,16 +36,18 @@ const CollectionDetailPage = ({ seo, components, builderData, sectionData, theme
36
36
  })
37
37
  ]
38
38
  }),
39
- /*#__PURE__*/ jsx(BuilderComponentProvider, {
40
- components: components,
41
- children: /*#__PURE__*/ jsx(SectionProvider, {
42
- data: sectionData,
43
- children: /*#__PURE__*/ jsx(CollectionProvider, {
44
- collection: collection,
45
- children: builderData && /*#__PURE__*/ jsx(BuilderProvider, {
46
- state: builderData,
47
- children: /*#__PURE__*/ jsx(Render, {
48
- uid: "ROOT"
39
+ /*#__PURE__*/ jsx(PageProvider, {
40
+ children: /*#__PURE__*/ jsx(BuilderComponentProvider, {
41
+ components: components,
42
+ children: /*#__PURE__*/ jsx(SectionProvider, {
43
+ data: sectionData,
44
+ children: /*#__PURE__*/ jsx(CollectionProvider, {
45
+ collection: collection,
46
+ children: builderData && /*#__PURE__*/ jsx(BuilderProvider, {
47
+ state: builderData,
48
+ children: /*#__PURE__*/ jsx(Render, {
49
+ uid: "ROOT"
50
+ })
49
51
  })
50
52
  })
51
53
  })