@gem-sdk/pages 1.53.0-dev.0 → 1.53.0-dev.107

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.
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var react = require('react');
7
+ var core = require('@gem-sdk/core');
8
+ var CollectionGlobalProvider = require('../../pages/CollectionGlobalProvider.js');
9
+
10
+ const Body = ({ pageType, isThemeSectionEditor })=>{
11
+ const interactionData = core.usePageStore((s)=>s.interactionData);
12
+ const isInteractionSelectModeClass = react.useMemo(()=>interactionData?.isSelectOnPage ? 'interaction-select-mode' : '', [
13
+ interactionData?.isSelectOnPage
14
+ ]);
15
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
16
+ id: "storefront",
17
+ className: `${isThemeSectionEditor ? 'theme-section-editor' : ''} ${pageType === 'POST_PURCHASE' ? 'post-purchase-page' : ''} ${isInteractionSelectModeClass}`,
18
+ children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsxRuntime.jsx(CollectionGlobalProvider.default, {
19
+ children: /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
20
+ uid: "ROOT"
21
+ })
22
+ }) : /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
23
+ uid: "ROOT"
24
+ })
25
+ });
26
+ };
27
+
28
+ exports.default = Body;
@@ -25,7 +25,6 @@ const Header = (props)=>{
25
25
  const isSelectOnPage = core.usePageStore((s)=>s.interactionData?.isSelectOnPage);
26
26
  const activeHeader = layoutSetting?.showHeader || isOriginTemplate;
27
27
  const headerColor = activeHeader ? HEADER_ON_COLOR : HEADER_OFF_COLOR;
28
- console.log('isSelectOnPage', isSelectOnPage);
29
28
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
30
29
  children: [
31
30
  /*#__PURE__*/ jsxRuntime.jsx(SwitchView.default, {}),
@@ -4,39 +4,37 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var core = require('@gem-sdk/core');
7
+ var useSelectModeInteraction = require('../../libs/hooks/useSelectModeInteraction.js');
7
8
 
8
9
  const InteractionSelectOnPageHeader = ()=>{
9
10
  const selectType = core.usePageStore((s)=>s.interactionData?.selectType);
10
11
  const setInteractionSelectType = core.usePageStore((s)=>s.setInteractionSelectType);
11
12
  const { closeSelectOnPage } = core.useInteraction();
13
+ const { changeSelectMode } = useSelectModeInteraction.useSelectModeInteraction();
14
+ const handleSetInteraction = (type)=>{
15
+ setInteractionSelectType(type);
16
+ changeSelectMode(type);
17
+ };
12
18
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
13
19
  children: [
14
20
  /*#__PURE__*/ jsxRuntime.jsxs("header", {
15
- className: "gp-flex gp-justify-between gp-items-center gp-h-10 gp-fixed gp-top-0 gp-left-0 gp-w-full gp-z-100 gp-bg-black gp-text-white",
21
+ className: "gp-flex gp-justify-between gp-items-center gp-h-10 gp-fixed gp-top-0 gp-left-0 gp-w-full gp-z-100 gp-bg-[#151515] gp-text-white interaction-select-mode-header",
16
22
  children: [
17
23
  /*#__PURE__*/ jsxRuntime.jsx("div", {
18
24
  className: "gp-ml-4 gp-text-xs gp-mt-1",
19
25
  children: "Select mode enabled"
20
26
  }),
21
27
  /*#__PURE__*/ jsxRuntime.jsxs("section", {
22
- className: "gp-flex gp-bg-[#3C67FF]/[0.15] gp-items-center gp-h-full gp-rounded-b-lg gp-pt-1 gp-gap-1",
28
+ className: "gp-flex gp-bg-[#151515]/[0.15] gp-items-center gp-h-full gp-rounded-b-lg gp-pt-1 gp-gap-1",
23
29
  children: [
24
30
  /*#__PURE__*/ jsxRuntime.jsx("button", {
25
- "data-interaction-mode": "element",
26
- onClick: ()=>setInteractionSelectType('element'),
27
- className: `gp-h-full gp-w-[444px] gp-items-center gp-justify-center gp-bg-[#333333] gp-text-[12px] gp-leading-5 gp-font-medium gp-flex gp-rounded-t-[8px] ${selectType === 'element' ? 'gp-bg-[#3C67FF] gp-text-[#F9F9F9]' : 'gp-text-[#AAAAAA]'}`,
28
- style: {
29
- cursor: "url('https://cdn.shopify.com/s/files/1/0858/3168/0279/files/gempages_502328832959710176-45eb24ff-a9ee-48ac-af8b-eac35e11918d.png?v=1724038301'), auto"
30
- },
31
+ onClick: ()=>handleSetInteraction('ELEMENT'),
32
+ className: `gp-h-full gp-w-[444px] gp-items-center gp-justify-center gp-bg-[#333333] gp-text-[12px] gp-leading-5 gp-font-medium gp-flex gp-rounded-t-[8px] ${selectType === 'ELEMENT' ? 'gp-bg-[#3C67FF] gp-text-[#F9F9F9]' : 'gp-text-[#AAAAAA]'}`,
31
33
  children: "Choose an element on page"
32
34
  }),
33
35
  /*#__PURE__*/ jsxRuntime.jsx("button", {
34
- "data-interaction-mode": "page",
35
- onClick: ()=>setInteractionSelectType('page'),
36
- className: `gp-h-full gp-w-[444px] gp-items-center gp-justify-center gp-bg-[#333333] gp-text-[12px] gp-leading-5 gp-font-medium gp-flex gp-rounded-t-[8px] ${selectType === 'page' ? 'gp-bg-[#3C67FF] gp-text-[#F9F9F9]' : 'gp-text-[#AAAAAA]'}`,
37
- style: {
38
- cursor: "url('https://cdn.shopify.com/s/files/1/0858/3168/0279/files/gempages_502328832959710176-45eb24ff-a9ee-48ac-af8b-eac35e11918d.png?v=1724038301'), auto"
39
- },
36
+ onClick: ()=>handleSetInteraction('PAGE'),
37
+ className: `gp-h-full gp-w-[444px] gp-items-center gp-justify-center gp-bg-[#333333] gp-text-[12px] gp-leading-5 gp-font-medium gp-flex gp-rounded-t-[8px] ${selectType === 'PAGE' ? 'gp-bg-[#3C67FF] gp-text-[#F9F9F9]' : 'gp-text-[#AAAAAA]'}`,
40
38
  children: "Use entire page"
41
39
  })
42
40
  ]
@@ -59,7 +57,7 @@ const InteractionSelectOnPageHeader = ()=>{
59
57
  ]
60
58
  }),
61
59
  /*#__PURE__*/ jsxRuntime.jsx("div", {
62
- className: `gp-w-full gp-fixed gp-top-0 gp-left-0 gp-border-[#3C67FF] gp-border-[4px] gp-mt-[40px] ${selectType === 'page' ? 'gp-z-90 gp-bg-[#3c67ff]/[0.25]' : ''}`,
60
+ className: `gp-w-full gp-fixed gp-top-0 gp-left-0 gp-border-[#3C67FF] gp-mt-[40px] gp-z-[999] ${selectType === 'PAGE' ? 'gp-z-[999] gp-border-[4px] gp-bg-[#3c67ff]/[0.25]' : 'gp-border-[2px] gp-pointer-events-none'}`,
63
61
  style: {
64
62
  height: 'calc(100% - 40px)'
65
63
  }
@@ -33,7 +33,7 @@ const PopupManager = ()=>{
33
33
  onSetActiveModal
34
34
  ]);
35
35
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
36
- className: "gp-pointer-events-none gp-fixed gp-inset-y-0 gp-right-0 gp-z-10 gp-flex gp-w-10 gp-flex-col gp-items-center gp-justify-center gp-gap-1 gp-overflow-y-auto gp-overflow-x-hidden gp-text-sm",
36
+ className: "gp-popup-trigger-button gp-pointer-events-none gp-fixed gp-inset-y-0 gp-right-0 gp-z-10 gp-flex gp-w-10 gp-flex-col gp-items-center gp-justify-center gp-gap-1 gp-overflow-y-auto gp-overflow-x-hidden gp-text-sm",
37
37
  children: popups?.map((item)=>{
38
38
  const display = item?.advanced?.d;
39
39
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
@@ -10,6 +10,8 @@ var googleFonts = require('../../libs/google-fonts.js');
10
10
  var genCss = require('../../libs/helpers/gen-css.js');
11
11
  var genFonts = require('../../libs/helpers/gen-fonts.js');
12
12
  var shopifyCdnWithGoogleFonts = require('../../libs/shopify-cdn-with-google-fonts.js');
13
+ var libsStore = require('../../store/libs-store.js');
14
+ var checkOptionFont = require('../../libs/helpers/check-option-font.js');
13
15
 
14
16
  const globalStyleId = 'global-style';
15
17
  const Toolbox = ()=>{
@@ -35,10 +37,13 @@ const Toolbox = ()=>{
35
37
  const changeLayoutSettings = core.useShopStore((s)=>s.changeLayoutSettings);
36
38
  const changeCreateThemeSectionCount = core.useShopStore((s)=>s.changeCreateThemeSectionCount);
37
39
  const changeShopPlan = core.useShopStore((s)=>s.changeShopPlan);
40
+ const changeFontType = libsStore.libsStore((s)=>s.changeFontType);
41
+ const fontType = libsStore.libsStore((s)=>s.fontType);
38
42
  const clearModal = core.useModalStore((s)=>s.clearModal);
39
43
  const setInteractionIsSelectOnPage = core.usePageStore((s)=>s.setInteractionIsSelectOnPage);
40
44
  const setInteractionItem = core.usePageStore((s)=>s.setInteractionItem);
41
45
  const setInteractionSelectType = core.usePageStore((s)=>s.setInteractionSelectType);
46
+ const setInteractionSettingType = core.usePageStore((s)=>s.setInteractionSettingType);
42
47
  const fonts = react.useMemo(()=>genFonts.getFontsFromDataBuilder(state), [
43
48
  state
44
49
  ]);
@@ -67,6 +72,12 @@ const Toolbox = ()=>{
67
72
  });
68
73
  // append new fonts
69
74
  for (const font of fonts){
75
+ if ([
76
+ 'bunny',
77
+ 'google'
78
+ ].includes(font.type) && checkOptionFont.checkNotInOptionFont(font.family, fontType)) {
79
+ return;
80
+ }
70
81
  if (font.type !== 'custom') {
71
82
  if (font.variants?.length) {
72
83
  for (const variant of font.variants){
@@ -78,7 +89,7 @@ const Toolbox = ()=>{
78
89
  const variantName = variant;
79
90
  const url = googleFonts.createFontUrl([
80
91
  cloneFont
81
- ]);
92
+ ], undefined, fontType);
82
93
  if (url) {
83
94
  const googleFont = document.querySelector(`.${className}[data-font="${fontName}"][data-font-variant="${variantName}"]`);
84
95
  if (googleFont) {
@@ -281,6 +292,13 @@ const Toolbox = ()=>{
281
292
  }, [
282
293
  changeShopPlan
283
294
  ]);
295
+ const onUpdateFontType = react.useCallback((e)=>{
296
+ const fontType = e.detail;
297
+ if (!fontType) return;
298
+ changeFontType(fontType);
299
+ }, [
300
+ changeFontType
301
+ ]);
284
302
  const onUpdateDynamicProduct = react.useCallback((e)=>{
285
303
  const product = e.detail;
286
304
  if (!product) return;
@@ -335,11 +353,20 @@ const Toolbox = ()=>{
335
353
  const onUpdateInteractionIsSelectOnPage = react.useCallback((e)=>{
336
354
  const isSelectOnPage = e.detail.value;
337
355
  const mode = e.detail.mode;
356
+ const settingType = e.detail.settingType;
338
357
  setInteractionIsSelectOnPage(isSelectOnPage);
339
358
  setInteractionSelectType(mode);
359
+ setInteractionSettingType(settingType);
340
360
  }, [
341
361
  setInteractionIsSelectOnPage,
342
- setInteractionSelectType
362
+ setInteractionSelectType,
363
+ setInteractionSettingType
364
+ ]);
365
+ const onUpdateInteractionSettingType = react.useCallback((e)=>{
366
+ const settingType = e.detail.settingType;
367
+ setInteractionSettingType(settingType);
368
+ }, [
369
+ setInteractionSettingType
343
370
  ]);
344
371
  const onUpdateInteractionItem = react.useCallback((e)=>{
345
372
  const interactionItem = e.detail;
@@ -376,6 +403,8 @@ const Toolbox = ()=>{
376
403
  window.addEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
377
404
  window.addEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
378
405
  window.addEventListener('update-interaction-item', onUpdateInteractionItem);
406
+ window.addEventListener('update-interaction-setting-type', onUpdateInteractionSettingType);
407
+ window.addEventListener('update-font-type', onUpdateFontType);
379
408
  return ()=>{
380
409
  window.removeEventListener('update-shop-info', onChangeShopInfo);
381
410
  window.removeEventListener('revalidate-query', onRevalidateQuery);
@@ -397,6 +426,8 @@ const Toolbox = ()=>{
397
426
  window.removeEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
398
427
  window.removeEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
399
428
  window.removeEventListener('update-interaction-item', onUpdateInteractionItem);
429
+ window.removeEventListener('update-interaction-setting-type', onUpdateInteractionSettingType);
430
+ window.removeEventListener('update-font-type', onUpdateFontType);
400
431
  };
401
432
  }, [
402
433
  onAddEntity,
@@ -419,7 +450,9 @@ const Toolbox = ()=>{
419
450
  onUpdateProductOffers,
420
451
  onUpdateSalePageProductId,
421
452
  onUpdateInteractionItem,
422
- onUpdateInteractionIsSelectOnPage
453
+ onUpdateInteractionIsSelectOnPage,
454
+ onUpdateInteractionSettingType,
455
+ onUpdateFontType
423
456
  ]);
424
457
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
425
458
  className: "toolbox"
@@ -18,7 +18,7 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
18
18
  slug,
19
19
  slugType: pageType
20
20
  };
21
- const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
21
+ const [theme, storeProperty, shopifyMeta, publishedShopMetas] = await Promise.allSettled([
22
22
  fetcher([
23
23
  core.PublishedThemePagesDocument,
24
24
  variables
@@ -28,11 +28,21 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
28
28
  ]),
29
29
  shopifyFetcher([
30
30
  adapterShopify.ShopMetaDocument
31
+ ]),
32
+ fetcher([
33
+ core.PublishedShopMetasDocument,
34
+ {
35
+ keys: [
36
+ 'source_font'
37
+ ]
38
+ }
31
39
  ])
32
40
  ]);
33
41
  if (theme.status === 'rejected') {
34
42
  throw new Error(theme.reason?.[0]);
35
43
  }
44
+ const publishedShopMetaValue = publishedShopMetas.status === 'fulfilled' ? publishedShopMetas.value : undefined;
45
+ const sourceFont = publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === 'source_font');
36
46
  const dataBuilder = theme.value.publishedThemePages?.[0];
37
47
  const themePageCustomFonts = theme.value?.publishedThemePages?.[0]?.themePageCustomFonts;
38
48
  if (!dataBuilder) {
@@ -40,8 +50,8 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
40
50
  }
41
51
  const pageTemplate = normalize.parseBuilderTemplateV2(dataBuilder);
42
52
  const [elementFontStyle, fontStyle, fallback, customFonts$1] = await Promise.all([
43
- googleFonts.getFontStyleFromPageTemplate(pageTemplate),
44
- googleFonts.getFontFromGlobalStyle(dataBuilder?.pageStyle?.data),
53
+ googleFonts.getFontStyleFromPageTemplate(pageTemplate, sourceFont?.value),
54
+ googleFonts.getFontFromGlobalStyle(dataBuilder?.pageStyle?.data, sourceFont?.value),
45
55
  getFallback.getFallbackV2(fetcher, pageTemplate),
46
56
  customFonts.getCustomFonts(themePageCustomFonts)
47
57
  ]);
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var checkOptionFont = require('./helpers/check-option-font.js');
3
4
  var genFonts = require('./helpers/gen-fonts.js');
4
5
 
5
6
  const CHROME_UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36';
@@ -35,12 +36,17 @@ const composeFonts = (fonts)=>{
35
36
  };
36
37
  });
37
38
  };
38
- const createFontUrl = (fonts, option)=>{
39
- const googleFonts = fonts.filter((font)=>font.type === 'google' || !font.type);
40
- if (!googleFonts.length) return;
39
+ const createFontUrl = (fonts, option, fontType)=>{
40
+ const mainFonts = fonts.filter((font)=>{
41
+ return !([
42
+ 'bunny',
43
+ 'google'
44
+ ].includes(font.type) && checkOptionFont.checkNotInOptionFont(font.family, fontType || 'google')) && (font.type === 'google' || font.type === 'bunny' || !font.type);
45
+ });
46
+ if (!mainFonts.length) return;
41
47
  const params = new URLSearchParams();
42
48
  const display = option?.display || 'swap';
43
- const uniqFonts = googleFonts.filter((font, index, arr)=>{
49
+ const uniqFonts = mainFonts.filter((font, index, arr)=>{
44
50
  return index === arr.findIndex((t)=>t.family === font.family);
45
51
  });
46
52
  const family = composeFonts(uniqFonts).map((font)=>{
@@ -54,13 +60,16 @@ const createFontUrl = (fonts, option)=>{
54
60
  if (option?.effect) {
55
61
  params.append('effect', option.effect);
56
62
  }
57
- return `https://fonts.googleapis.com/css?${decodeURIComponent(params.toString())}`;
63
+ const bunnyFontUrl = `https://fonts.bunny.net/css?family=${family}`;
64
+ const googleFontUrl = `https://fonts.googleapis.com/css?${decodeURIComponent(params.toString())}`;
65
+ return fontType === 'bunny' ? bunnyFontUrl : googleFontUrl;
58
66
  };
59
- async function getFonts(fonts, option, isImportFontByUrl = true) {
67
+ // eslint-disable-next-line max-params
68
+ async function getFonts(fonts, option, isImportFontByUrl = true, fontType) {
60
69
  /**
61
70
  * The order of IE -> Chrome is important, other wise chrome starts loading woff1.
62
71
  * CSS cascading 🤷‍♂️.
63
- */ const url = createFontUrl(fonts, option);
72
+ */ const url = createFontUrl(fonts, option, fontType);
64
73
  if (!url) return '';
65
74
  try {
66
75
  if (isImportFontByUrl) return `@import url('${url}');`;
@@ -82,7 +91,7 @@ async function getFonts(fonts, option, isImportFontByUrl = true) {
82
91
  return '';
83
92
  }
84
93
  }
85
- const getFontFromGlobalStyle = (data)=>{
94
+ const getFontFromGlobalStyle = (data, sourceFont)=>{
86
95
  if (!data) return '';
87
96
  try {
88
97
  const globalStyle = JSON.parse(data);
@@ -90,14 +99,14 @@ const getFontFromGlobalStyle = (data)=>{
90
99
  const fonts = Object.entries(fontData).map(([, value])=>{
91
100
  return value;
92
101
  });
93
- return getFonts(fonts);
102
+ return getFonts(fonts, undefined, undefined, sourceFont);
94
103
  } catch {
95
104
  return '';
96
105
  }
97
106
  };
98
- async function getFontStyleFromPageTemplate(pageTemplate) {
107
+ async function getFontStyleFromPageTemplate(pageTemplate, sourceFont) {
99
108
  const fontStyle = pageTemplate.map((sectionData)=>{
100
- return getFonts(genFonts.getFontsFromDataBuilder(sectionData.data));
109
+ return getFonts(genFonts.getFontsFromDataBuilder(sectionData.data), undefined, undefined, sourceFont);
101
110
  });
102
111
  return await Promise.all(fontStyle);
103
112
  }
@@ -0,0 +1,65 @@
1
+ 'use strict';
2
+
3
+ const listFontsNotInBunny = [
4
+ 'Anton SC',
5
+ 'Arsenal SC',
6
+ 'Baskervville SC',
7
+ 'Beiruti',
8
+ 'Bodoni Moda SC',
9
+ 'Bona Nova SC',
10
+ 'Bungee Tint',
11
+ 'Edu AU VIC WA NT Hand',
12
+ 'Fustat',
13
+ 'Ga Maamli',
14
+ 'Kalnia Glaze',
15
+ 'Maname',
16
+ 'Matemasie',
17
+ 'Material Icons',
18
+ 'Material Icons Outlined',
19
+ 'Material Icons Round',
20
+ 'Material Icons Sharp',
21
+ 'Material Icons Two Tone',
22
+ 'Material Symbols Outlined',
23
+ 'Material Symbols Rounded',
24
+ 'Material Symbols Sharp',
25
+ 'Moderustic',
26
+ 'New Amsterdam',
27
+ 'Playwrite AR',
28
+ 'Playwrite AT',
29
+ 'Playwrite BE VLG',
30
+ 'Playwrite BE WAL',
31
+ 'Playwrite CL',
32
+ 'Playwrite CU',
33
+ 'Playwrite CZ',
34
+ 'Playwrite DK Loopet',
35
+ 'Playwrite DK Uloopet',
36
+ 'Playwrite HR',
37
+ 'Playwrite HR Lijeva',
38
+ 'Playwrite HU',
39
+ 'Playwrite PE',
40
+ 'SUSE',
41
+ 'Sankofa Display',
42
+ 'Wittgenstein',
43
+ 'Zain'
44
+ ];
45
+ const listFontsNotInGoogle = [
46
+ 'Arima Madurai',
47
+ 'Coda Caption',
48
+ 'Fredoka One',
49
+ 'Gentium Book Basic',
50
+ 'Kantumruy',
51
+ 'Merienda One',
52
+ 'Source Sans Pro',
53
+ 'Source Serif Pro',
54
+ 'Briem Hand',
55
+ 'Pushster'
56
+ ];
57
+ const objectFont = {
58
+ bunny: listFontsNotInBunny,
59
+ google: listFontsNotInGoogle
60
+ };
61
+ const checkNotInOptionFont = (currentfont, type)=>{
62
+ return objectFont?.[type]?.includes(currentfont);
63
+ };
64
+
65
+ exports.checkNotInOptionFont = checkNotInOptionFont;
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ const useSelectModeInteraction = ()=>{
4
+ const changeSelectMode = (mode)=>{
5
+ const event = new CustomEvent('editor:interaction:change-select-mode', {
6
+ bubbles: true,
7
+ detail: mode
8
+ });
9
+ window.dispatchEvent(event);
10
+ };
11
+ return {
12
+ changeSelectMode
13
+ };
14
+ };
15
+
16
+ exports.useSelectModeInteraction = useSelectModeInteraction;
@@ -8,12 +8,12 @@ var react = require('react');
8
8
  var Toolbox = require('../components/builder/Toolbox.js');
9
9
  var Header = require('../components/builder/Header.js');
10
10
  var Footer = require('../components/builder/Footer.js');
11
- var CollectionGlobalProvider = require('./CollectionGlobalProvider.js');
12
11
  var PopupManager = require('../components/builder/PopupManager.js');
13
12
  var ImageToLayout = require('../components/image-to-layout/ImageToLayout.js');
14
13
  var AddSectionImageToLayout = require('../components/image-to-layout/AddSectionImageToLayout.js');
15
14
  var Toolbar = require('../components/builder/Toolbar.js');
16
15
  var SwitchView = require('../components/builder/SwitchView.js');
16
+ var Body = require('../components/builder/Body.js');
17
17
 
18
18
  const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, pageName, isOriginTemplate })=>{
19
19
  const [loadSuccess, setLoadSuccess] = react.useState(false);
@@ -77,16 +77,9 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
77
77
  pageType: pageType,
78
78
  isOriginTemplate: isOriginTemplate
79
79
  })),
80
- /*#__PURE__*/ jsxRuntime.jsx("div", {
81
- id: "storefront",
82
- className: `${isThemeSectionEditor ? 'theme-section-editor' : ''} ${pageType === 'POST_PURCHASE' ? 'post-purchase-page' : ''}`,
83
- children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsxRuntime.jsx(CollectionGlobalProvider.default, {
84
- children: /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
85
- uid: "ROOT"
86
- })
87
- }) : /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
88
- uid: "ROOT"
89
- })
80
+ /*#__PURE__*/ jsxRuntime.jsx(Body.default, {
81
+ pageType: pageType,
82
+ isThemeSectionEditor: isThemeSectionEditor
90
83
  }),
91
84
  /*#__PURE__*/ jsxRuntime.jsx(ImageToLayout.default, {
92
85
  editorImageToLayout: editorImageToLayout || false
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ var zustand = require('zustand');
4
+
5
+ const libsStore = zustand.create((set)=>({
6
+ fontType: 'google',
7
+ changeFontType: (fontType)=>{
8
+ set({
9
+ fontType
10
+ });
11
+ }
12
+ }));
13
+
14
+ exports.libsStore = libsStore;
@@ -0,0 +1,24 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useMemo } from 'react';
3
+ import { usePageStore, RenderPreview } from '@gem-sdk/core';
4
+ import CollectionGlobalProvider from '../../pages/CollectionGlobalProvider.js';
5
+
6
+ const Body = ({ pageType, isThemeSectionEditor })=>{
7
+ const interactionData = usePageStore((s)=>s.interactionData);
8
+ const isInteractionSelectModeClass = useMemo(()=>interactionData?.isSelectOnPage ? 'interaction-select-mode' : '', [
9
+ interactionData?.isSelectOnPage
10
+ ]);
11
+ return /*#__PURE__*/ jsx("div", {
12
+ id: "storefront",
13
+ className: `${isThemeSectionEditor ? 'theme-section-editor' : ''} ${pageType === 'POST_PURCHASE' ? 'post-purchase-page' : ''} ${isInteractionSelectModeClass}`,
14
+ children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsx(CollectionGlobalProvider, {
15
+ children: /*#__PURE__*/ jsx(RenderPreview, {
16
+ uid: "ROOT"
17
+ })
18
+ }) : /*#__PURE__*/ jsx(RenderPreview, {
19
+ uid: "ROOT"
20
+ })
21
+ });
22
+ };
23
+
24
+ export { Body as default };
@@ -21,7 +21,6 @@ const Header = (props)=>{
21
21
  const isSelectOnPage = usePageStore((s)=>s.interactionData?.isSelectOnPage);
22
22
  const activeHeader = layoutSetting?.showHeader || isOriginTemplate;
23
23
  const headerColor = activeHeader ? HEADER_ON_COLOR : HEADER_OFF_COLOR;
24
- console.log('isSelectOnPage', isSelectOnPage);
25
24
  return /*#__PURE__*/ jsxs(Fragment, {
26
25
  children: [
27
26
  /*#__PURE__*/ jsx(Devices, {}),
@@ -1,38 +1,36 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import { usePageStore, useInteraction } from '@gem-sdk/core';
3
+ import { useSelectModeInteraction } from '../../libs/hooks/useSelectModeInteraction.js';
3
4
 
4
5
  const InteractionSelectOnPageHeader = ()=>{
5
6
  const selectType = usePageStore((s)=>s.interactionData?.selectType);
6
7
  const setInteractionSelectType = usePageStore((s)=>s.setInteractionSelectType);
7
8
  const { closeSelectOnPage } = useInteraction();
9
+ const { changeSelectMode } = useSelectModeInteraction();
10
+ const handleSetInteraction = (type)=>{
11
+ setInteractionSelectType(type);
12
+ changeSelectMode(type);
13
+ };
8
14
  return /*#__PURE__*/ jsxs(Fragment, {
9
15
  children: [
10
16
  /*#__PURE__*/ jsxs("header", {
11
- className: "gp-flex gp-justify-between gp-items-center gp-h-10 gp-fixed gp-top-0 gp-left-0 gp-w-full gp-z-100 gp-bg-black gp-text-white",
17
+ className: "gp-flex gp-justify-between gp-items-center gp-h-10 gp-fixed gp-top-0 gp-left-0 gp-w-full gp-z-100 gp-bg-[#151515] gp-text-white interaction-select-mode-header",
12
18
  children: [
13
19
  /*#__PURE__*/ jsx("div", {
14
20
  className: "gp-ml-4 gp-text-xs gp-mt-1",
15
21
  children: "Select mode enabled"
16
22
  }),
17
23
  /*#__PURE__*/ jsxs("section", {
18
- className: "gp-flex gp-bg-[#3C67FF]/[0.15] gp-items-center gp-h-full gp-rounded-b-lg gp-pt-1 gp-gap-1",
24
+ className: "gp-flex gp-bg-[#151515]/[0.15] gp-items-center gp-h-full gp-rounded-b-lg gp-pt-1 gp-gap-1",
19
25
  children: [
20
26
  /*#__PURE__*/ jsx("button", {
21
- "data-interaction-mode": "element",
22
- onClick: ()=>setInteractionSelectType('element'),
23
- className: `gp-h-full gp-w-[444px] gp-items-center gp-justify-center gp-bg-[#333333] gp-text-[12px] gp-leading-5 gp-font-medium gp-flex gp-rounded-t-[8px] ${selectType === 'element' ? 'gp-bg-[#3C67FF] gp-text-[#F9F9F9]' : 'gp-text-[#AAAAAA]'}`,
24
- style: {
25
- cursor: "url('https://cdn.shopify.com/s/files/1/0858/3168/0279/files/gempages_502328832959710176-45eb24ff-a9ee-48ac-af8b-eac35e11918d.png?v=1724038301'), auto"
26
- },
27
+ onClick: ()=>handleSetInteraction('ELEMENT'),
28
+ className: `gp-h-full gp-w-[444px] gp-items-center gp-justify-center gp-bg-[#333333] gp-text-[12px] gp-leading-5 gp-font-medium gp-flex gp-rounded-t-[8px] ${selectType === 'ELEMENT' ? 'gp-bg-[#3C67FF] gp-text-[#F9F9F9]' : 'gp-text-[#AAAAAA]'}`,
27
29
  children: "Choose an element on page"
28
30
  }),
29
31
  /*#__PURE__*/ jsx("button", {
30
- "data-interaction-mode": "page",
31
- onClick: ()=>setInteractionSelectType('page'),
32
- className: `gp-h-full gp-w-[444px] gp-items-center gp-justify-center gp-bg-[#333333] gp-text-[12px] gp-leading-5 gp-font-medium gp-flex gp-rounded-t-[8px] ${selectType === 'page' ? 'gp-bg-[#3C67FF] gp-text-[#F9F9F9]' : 'gp-text-[#AAAAAA]'}`,
33
- style: {
34
- cursor: "url('https://cdn.shopify.com/s/files/1/0858/3168/0279/files/gempages_502328832959710176-45eb24ff-a9ee-48ac-af8b-eac35e11918d.png?v=1724038301'), auto"
35
- },
32
+ onClick: ()=>handleSetInteraction('PAGE'),
33
+ className: `gp-h-full gp-w-[444px] gp-items-center gp-justify-center gp-bg-[#333333] gp-text-[12px] gp-leading-5 gp-font-medium gp-flex gp-rounded-t-[8px] ${selectType === 'PAGE' ? 'gp-bg-[#3C67FF] gp-text-[#F9F9F9]' : 'gp-text-[#AAAAAA]'}`,
36
34
  children: "Use entire page"
37
35
  })
38
36
  ]
@@ -55,7 +53,7 @@ const InteractionSelectOnPageHeader = ()=>{
55
53
  ]
56
54
  }),
57
55
  /*#__PURE__*/ jsx("div", {
58
- className: `gp-w-full gp-fixed gp-top-0 gp-left-0 gp-border-[#3C67FF] gp-border-[4px] gp-mt-[40px] ${selectType === 'page' ? 'gp-z-90 gp-bg-[#3c67ff]/[0.25]' : ''}`,
56
+ className: `gp-w-full gp-fixed gp-top-0 gp-left-0 gp-border-[#3C67FF] gp-mt-[40px] gp-z-[999] ${selectType === 'PAGE' ? 'gp-z-[999] gp-border-[4px] gp-bg-[#3c67ff]/[0.25]' : 'gp-border-[2px] gp-pointer-events-none'}`,
59
57
  style: {
60
58
  height: 'calc(100% - 40px)'
61
59
  }
@@ -29,7 +29,7 @@ const PopupManager = ()=>{
29
29
  onSetActiveModal
30
30
  ]);
31
31
  return /*#__PURE__*/ jsx("div", {
32
- className: "gp-pointer-events-none gp-fixed gp-inset-y-0 gp-right-0 gp-z-10 gp-flex gp-w-10 gp-flex-col gp-items-center gp-justify-center gp-gap-1 gp-overflow-y-auto gp-overflow-x-hidden gp-text-sm",
32
+ className: "gp-popup-trigger-button gp-pointer-events-none gp-fixed gp-inset-y-0 gp-right-0 gp-z-10 gp-flex gp-w-10 gp-flex-col gp-items-center gp-justify-center gp-gap-1 gp-overflow-y-auto gp-overflow-x-hidden gp-text-sm",
33
33
  children: popups?.map((item)=>{
34
34
  const display = item?.advanced?.d;
35
35
  return /*#__PURE__*/ jsx("div", {
@@ -6,6 +6,8 @@ import { createFontUrl } from '../../libs/google-fonts.js';
6
6
  import { genCSS } from '../../libs/helpers/gen-css.js';
7
7
  import { getFontsFromDataBuilder } from '../../libs/helpers/gen-fonts.js';
8
8
  import { shopifyCdnWithGoogleFonts } from '../../libs/shopify-cdn-with-google-fonts.js';
9
+ import { libsStore } from '../../store/libs-store.js';
10
+ import { checkNotInOptionFont } from '../../libs/helpers/check-option-font.js';
9
11
 
10
12
  const globalStyleId = 'global-style';
11
13
  const Toolbox = ()=>{
@@ -31,10 +33,13 @@ const Toolbox = ()=>{
31
33
  const changeLayoutSettings = useShopStore((s)=>s.changeLayoutSettings);
32
34
  const changeCreateThemeSectionCount = useShopStore((s)=>s.changeCreateThemeSectionCount);
33
35
  const changeShopPlan = useShopStore((s)=>s.changeShopPlan);
36
+ const changeFontType = libsStore((s)=>s.changeFontType);
37
+ const fontType = libsStore((s)=>s.fontType);
34
38
  const clearModal = useModalStore((s)=>s.clearModal);
35
39
  const setInteractionIsSelectOnPage = usePageStore((s)=>s.setInteractionIsSelectOnPage);
36
40
  const setInteractionItem = usePageStore((s)=>s.setInteractionItem);
37
41
  const setInteractionSelectType = usePageStore((s)=>s.setInteractionSelectType);
42
+ const setInteractionSettingType = usePageStore((s)=>s.setInteractionSettingType);
38
43
  const fonts = useMemo(()=>getFontsFromDataBuilder(state), [
39
44
  state
40
45
  ]);
@@ -63,6 +68,12 @@ const Toolbox = ()=>{
63
68
  });
64
69
  // append new fonts
65
70
  for (const font of fonts){
71
+ if ([
72
+ 'bunny',
73
+ 'google'
74
+ ].includes(font.type) && checkNotInOptionFont(font.family, fontType)) {
75
+ return;
76
+ }
66
77
  if (font.type !== 'custom') {
67
78
  if (font.variants?.length) {
68
79
  for (const variant of font.variants){
@@ -74,7 +85,7 @@ const Toolbox = ()=>{
74
85
  const variantName = variant;
75
86
  const url = createFontUrl([
76
87
  cloneFont
77
- ]);
88
+ ], undefined, fontType);
78
89
  if (url) {
79
90
  const googleFont = document.querySelector(`.${className}[data-font="${fontName}"][data-font-variant="${variantName}"]`);
80
91
  if (googleFont) {
@@ -277,6 +288,13 @@ const Toolbox = ()=>{
277
288
  }, [
278
289
  changeShopPlan
279
290
  ]);
291
+ const onUpdateFontType = useCallback((e)=>{
292
+ const fontType = e.detail;
293
+ if (!fontType) return;
294
+ changeFontType(fontType);
295
+ }, [
296
+ changeFontType
297
+ ]);
280
298
  const onUpdateDynamicProduct = useCallback((e)=>{
281
299
  const product = e.detail;
282
300
  if (!product) return;
@@ -331,11 +349,20 @@ const Toolbox = ()=>{
331
349
  const onUpdateInteractionIsSelectOnPage = useCallback((e)=>{
332
350
  const isSelectOnPage = e.detail.value;
333
351
  const mode = e.detail.mode;
352
+ const settingType = e.detail.settingType;
334
353
  setInteractionIsSelectOnPage(isSelectOnPage);
335
354
  setInteractionSelectType(mode);
355
+ setInteractionSettingType(settingType);
336
356
  }, [
337
357
  setInteractionIsSelectOnPage,
338
- setInteractionSelectType
358
+ setInteractionSelectType,
359
+ setInteractionSettingType
360
+ ]);
361
+ const onUpdateInteractionSettingType = useCallback((e)=>{
362
+ const settingType = e.detail.settingType;
363
+ setInteractionSettingType(settingType);
364
+ }, [
365
+ setInteractionSettingType
339
366
  ]);
340
367
  const onUpdateInteractionItem = useCallback((e)=>{
341
368
  const interactionItem = e.detail;
@@ -372,6 +399,8 @@ const Toolbox = ()=>{
372
399
  window.addEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
373
400
  window.addEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
374
401
  window.addEventListener('update-interaction-item', onUpdateInteractionItem);
402
+ window.addEventListener('update-interaction-setting-type', onUpdateInteractionSettingType);
403
+ window.addEventListener('update-font-type', onUpdateFontType);
375
404
  return ()=>{
376
405
  window.removeEventListener('update-shop-info', onChangeShopInfo);
377
406
  window.removeEventListener('revalidate-query', onRevalidateQuery);
@@ -393,6 +422,8 @@ const Toolbox = ()=>{
393
422
  window.removeEventListener('update-sale-page-product-id', onUpdateSalePageProductId);
394
423
  window.removeEventListener('update-interaction-is-select-on-page', onUpdateInteractionIsSelectOnPage);
395
424
  window.removeEventListener('update-interaction-item', onUpdateInteractionItem);
425
+ window.removeEventListener('update-interaction-setting-type', onUpdateInteractionSettingType);
426
+ window.removeEventListener('update-font-type', onUpdateFontType);
396
427
  };
397
428
  }, [
398
429
  onAddEntity,
@@ -415,7 +446,9 @@ const Toolbox = ()=>{
415
446
  onUpdateProductOffers,
416
447
  onUpdateSalePageProductId,
417
448
  onUpdateInteractionItem,
418
- onUpdateInteractionIsSelectOnPage
449
+ onUpdateInteractionIsSelectOnPage,
450
+ onUpdateInteractionSettingType,
451
+ onUpdateFontType
419
452
  ]);
420
453
  return /*#__PURE__*/ jsx("div", {
421
454
  className: "toolbox"
@@ -1,4 +1,4 @@
1
- import { PublishedThemePagesDocument, StorePropertyDocument } from '@gem-sdk/core';
1
+ import { PublishedThemePagesDocument, StorePropertyDocument, PublishedShopMetasDocument } from '@gem-sdk/core';
2
2
  import { ShopMetaDocument } from '@gem-sdk/adapter-shopify';
3
3
  import { getFontStyleFromPageTemplate, getFontFromGlobalStyle } from '../google-fonts.js';
4
4
  import { genCSS } from '../helpers/gen-css.js';
@@ -16,7 +16,7 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
16
16
  slug,
17
17
  slugType: pageType
18
18
  };
19
- const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
19
+ const [theme, storeProperty, shopifyMeta, publishedShopMetas] = await Promise.allSettled([
20
20
  fetcher([
21
21
  PublishedThemePagesDocument,
22
22
  variables
@@ -26,11 +26,21 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
26
26
  ]),
27
27
  shopifyFetcher([
28
28
  ShopMetaDocument
29
+ ]),
30
+ fetcher([
31
+ PublishedShopMetasDocument,
32
+ {
33
+ keys: [
34
+ 'source_font'
35
+ ]
36
+ }
29
37
  ])
30
38
  ]);
31
39
  if (theme.status === 'rejected') {
32
40
  throw new Error(theme.reason?.[0]);
33
41
  }
42
+ const publishedShopMetaValue = publishedShopMetas.status === 'fulfilled' ? publishedShopMetas.value : undefined;
43
+ const sourceFont = publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === 'source_font');
34
44
  const dataBuilder = theme.value.publishedThemePages?.[0];
35
45
  const themePageCustomFonts = theme.value?.publishedThemePages?.[0]?.themePageCustomFonts;
36
46
  if (!dataBuilder) {
@@ -38,8 +48,8 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
38
48
  }
39
49
  const pageTemplate = parseBuilderTemplateV2(dataBuilder);
40
50
  const [elementFontStyle, fontStyle, fallback, customFonts] = await Promise.all([
41
- getFontStyleFromPageTemplate(pageTemplate),
42
- getFontFromGlobalStyle(dataBuilder?.pageStyle?.data),
51
+ getFontStyleFromPageTemplate(pageTemplate, sourceFont?.value),
52
+ getFontFromGlobalStyle(dataBuilder?.pageStyle?.data, sourceFont?.value),
43
53
  getFallbackV2(fetcher, pageTemplate),
44
54
  getCustomFonts(themePageCustomFonts)
45
55
  ]);
@@ -1,3 +1,4 @@
1
+ import { checkNotInOptionFont } from './helpers/check-option-font.js';
1
2
  import { getFontsFromDataBuilder } from './helpers/gen-fonts.js';
2
3
 
3
4
  const CHROME_UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36';
@@ -33,12 +34,17 @@ const composeFonts = (fonts)=>{
33
34
  };
34
35
  });
35
36
  };
36
- const createFontUrl = (fonts, option)=>{
37
- const googleFonts = fonts.filter((font)=>font.type === 'google' || !font.type);
38
- if (!googleFonts.length) return;
37
+ const createFontUrl = (fonts, option, fontType)=>{
38
+ const mainFonts = fonts.filter((font)=>{
39
+ return !([
40
+ 'bunny',
41
+ 'google'
42
+ ].includes(font.type) && checkNotInOptionFont(font.family, fontType || 'google')) && (font.type === 'google' || font.type === 'bunny' || !font.type);
43
+ });
44
+ if (!mainFonts.length) return;
39
45
  const params = new URLSearchParams();
40
46
  const display = option?.display || 'swap';
41
- const uniqFonts = googleFonts.filter((font, index, arr)=>{
47
+ const uniqFonts = mainFonts.filter((font, index, arr)=>{
42
48
  return index === arr.findIndex((t)=>t.family === font.family);
43
49
  });
44
50
  const family = composeFonts(uniqFonts).map((font)=>{
@@ -52,13 +58,16 @@ const createFontUrl = (fonts, option)=>{
52
58
  if (option?.effect) {
53
59
  params.append('effect', option.effect);
54
60
  }
55
- return `https://fonts.googleapis.com/css?${decodeURIComponent(params.toString())}`;
61
+ const bunnyFontUrl = `https://fonts.bunny.net/css?family=${family}`;
62
+ const googleFontUrl = `https://fonts.googleapis.com/css?${decodeURIComponent(params.toString())}`;
63
+ return fontType === 'bunny' ? bunnyFontUrl : googleFontUrl;
56
64
  };
57
- async function getFonts(fonts, option, isImportFontByUrl = true) {
65
+ // eslint-disable-next-line max-params
66
+ async function getFonts(fonts, option, isImportFontByUrl = true, fontType) {
58
67
  /**
59
68
  * The order of IE -> Chrome is important, other wise chrome starts loading woff1.
60
69
  * CSS cascading 🤷‍♂️.
61
- */ const url = createFontUrl(fonts, option);
70
+ */ const url = createFontUrl(fonts, option, fontType);
62
71
  if (!url) return '';
63
72
  try {
64
73
  if (isImportFontByUrl) return `@import url('${url}');`;
@@ -80,7 +89,7 @@ async function getFonts(fonts, option, isImportFontByUrl = true) {
80
89
  return '';
81
90
  }
82
91
  }
83
- const getFontFromGlobalStyle = (data)=>{
92
+ const getFontFromGlobalStyle = (data, sourceFont)=>{
84
93
  if (!data) return '';
85
94
  try {
86
95
  const globalStyle = JSON.parse(data);
@@ -88,14 +97,14 @@ const getFontFromGlobalStyle = (data)=>{
88
97
  const fonts = Object.entries(fontData).map(([, value])=>{
89
98
  return value;
90
99
  });
91
- return getFonts(fonts);
100
+ return getFonts(fonts, undefined, undefined, sourceFont);
92
101
  } catch {
93
102
  return '';
94
103
  }
95
104
  };
96
- async function getFontStyleFromPageTemplate(pageTemplate) {
105
+ async function getFontStyleFromPageTemplate(pageTemplate, sourceFont) {
97
106
  const fontStyle = pageTemplate.map((sectionData)=>{
98
- return getFonts(getFontsFromDataBuilder(sectionData.data));
107
+ return getFonts(getFontsFromDataBuilder(sectionData.data), undefined, undefined, sourceFont);
99
108
  });
100
109
  return await Promise.all(fontStyle);
101
110
  }
@@ -0,0 +1,63 @@
1
+ const listFontsNotInBunny = [
2
+ 'Anton SC',
3
+ 'Arsenal SC',
4
+ 'Baskervville SC',
5
+ 'Beiruti',
6
+ 'Bodoni Moda SC',
7
+ 'Bona Nova SC',
8
+ 'Bungee Tint',
9
+ 'Edu AU VIC WA NT Hand',
10
+ 'Fustat',
11
+ 'Ga Maamli',
12
+ 'Kalnia Glaze',
13
+ 'Maname',
14
+ 'Matemasie',
15
+ 'Material Icons',
16
+ 'Material Icons Outlined',
17
+ 'Material Icons Round',
18
+ 'Material Icons Sharp',
19
+ 'Material Icons Two Tone',
20
+ 'Material Symbols Outlined',
21
+ 'Material Symbols Rounded',
22
+ 'Material Symbols Sharp',
23
+ 'Moderustic',
24
+ 'New Amsterdam',
25
+ 'Playwrite AR',
26
+ 'Playwrite AT',
27
+ 'Playwrite BE VLG',
28
+ 'Playwrite BE WAL',
29
+ 'Playwrite CL',
30
+ 'Playwrite CU',
31
+ 'Playwrite CZ',
32
+ 'Playwrite DK Loopet',
33
+ 'Playwrite DK Uloopet',
34
+ 'Playwrite HR',
35
+ 'Playwrite HR Lijeva',
36
+ 'Playwrite HU',
37
+ 'Playwrite PE',
38
+ 'SUSE',
39
+ 'Sankofa Display',
40
+ 'Wittgenstein',
41
+ 'Zain'
42
+ ];
43
+ const listFontsNotInGoogle = [
44
+ 'Arima Madurai',
45
+ 'Coda Caption',
46
+ 'Fredoka One',
47
+ 'Gentium Book Basic',
48
+ 'Kantumruy',
49
+ 'Merienda One',
50
+ 'Source Sans Pro',
51
+ 'Source Serif Pro',
52
+ 'Briem Hand',
53
+ 'Pushster'
54
+ ];
55
+ const objectFont = {
56
+ bunny: listFontsNotInBunny,
57
+ google: listFontsNotInGoogle
58
+ };
59
+ const checkNotInOptionFont = (currentfont, type)=>{
60
+ return objectFont?.[type]?.includes(currentfont);
61
+ };
62
+
63
+ export { checkNotInOptionFont };
@@ -0,0 +1,14 @@
1
+ const useSelectModeInteraction = ()=>{
2
+ const changeSelectMode = (mode)=>{
3
+ const event = new CustomEvent('editor:interaction:change-select-mode', {
4
+ bubbles: true,
5
+ detail: mode
6
+ });
7
+ window.dispatchEvent(event);
8
+ };
9
+ return {
10
+ changeSelectMode
11
+ };
12
+ };
13
+
14
+ export { useSelectModeInteraction };
@@ -1,17 +1,17 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { PageProvider, BuilderComponentProvider, SectionProvider, BuilderPreviewProvider, RenderPreview } from '@gem-sdk/core';
2
+ import { PageProvider, BuilderComponentProvider, SectionProvider, BuilderPreviewProvider } 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';
6
6
  import Toolbox from '../components/builder/Toolbox.js';
7
7
  import Header from '../components/builder/Header.js';
8
8
  import Footer from '../components/builder/Footer.js';
9
- import CollectionGlobalProvider from './CollectionGlobalProvider.js';
10
9
  import PopupManager from '../components/builder/PopupManager.js';
11
10
  import ImageToLayout from '../components/image-to-layout/ImageToLayout.js';
12
11
  import AddSectionImageToLayout from '../components/image-to-layout/AddSectionImageToLayout.js';
13
12
  import Toolbar from '../components/builder/Toolbar.js';
14
13
  import Devices from '../components/builder/SwitchView.js';
14
+ import Body from '../components/builder/Body.js';
15
15
 
16
16
  const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, pageName, isOriginTemplate })=>{
17
17
  const [loadSuccess, setLoadSuccess] = useState(false);
@@ -75,16 +75,9 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
75
75
  pageType: pageType,
76
76
  isOriginTemplate: isOriginTemplate
77
77
  })),
78
- /*#__PURE__*/ jsx("div", {
79
- id: "storefront",
80
- className: `${isThemeSectionEditor ? 'theme-section-editor' : ''} ${pageType === 'POST_PURCHASE' ? 'post-purchase-page' : ''}`,
81
- children: pageType === 'GP_COLLECTION' ? /*#__PURE__*/ jsx(CollectionGlobalProvider, {
82
- children: /*#__PURE__*/ jsx(RenderPreview, {
83
- uid: "ROOT"
84
- })
85
- }) : /*#__PURE__*/ jsx(RenderPreview, {
86
- uid: "ROOT"
87
- })
78
+ /*#__PURE__*/ jsx(Body, {
79
+ pageType: pageType,
80
+ isThemeSectionEditor: isThemeSectionEditor
88
81
  }),
89
82
  /*#__PURE__*/ jsx(ImageToLayout, {
90
83
  editorImageToLayout: editorImageToLayout || false
@@ -0,0 +1,12 @@
1
+ import { create } from 'zustand';
2
+
3
+ const libsStore = create((set)=>({
4
+ fontType: 'google',
5
+ changeFontType: (fontType)=>{
6
+ set({
7
+ fontType
8
+ });
9
+ }
10
+ }));
11
+
12
+ export { libsStore };
@@ -189,7 +189,9 @@ declare const BuilderPage: React.FC<BuilderPageProps>;
189
189
 
190
190
  declare const getStaticPaths: GetStaticPaths;
191
191
 
192
- type TypographyV2FontFamilyType = 'google' | 'custom' | 'theme';
192
+ type TypographyV2FontFamilyType = 'google' | 'custom' | 'theme' | 'bunny';
193
+
194
+ type FontType = 'bunny' | 'google';
193
195
 
194
196
  type FontItem = {
195
197
  type: TypographyV2FontFamilyType;
@@ -202,8 +204,8 @@ type FontOption = {
202
204
  subset?: string;
203
205
  effect?: string;
204
206
  };
205
- declare function getFonts(fonts: FontItem[], option?: FontOption, isImportFontByUrl?: boolean): Promise<string>;
206
- declare const getFontFromGlobalStyle: (data?: string) => "" | Promise<string>;
207
+ declare function getFonts(fonts: FontItem[], option?: FontOption, isImportFontByUrl?: boolean, fontType?: FontType): Promise<string>;
208
+ declare const getFontFromGlobalStyle: (data?: string, sourceFont?: FontType) => "" | Promise<string>;
207
209
 
208
210
  declare const getFontsFromDataBuilder: (dataBuilder: Record<string, any>) => FontItem[];
209
211
  declare const getFontFromGroupSetting: (fonts: FontItem[], groupSetting: Record<string, any>) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "1.53.0-dev.0",
3
+ "version": "1.53.0-dev.107",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -26,10 +26,10 @@
26
26
  "next": "latest"
27
27
  },
28
28
  "devDependencies": {
29
- "@gem-sdk/core": "1.53.0-dev.0",
30
- "@gem-sdk/plugin-cookie-bar": "1.53.0-dev.0",
31
- "@gem-sdk/plugin-quick-view": "1.53.0-dev.0",
32
- "@gem-sdk/plugin-sticky-add-to-cart": "1.53.0-dev.0"
29
+ "@gem-sdk/core": "1.53.0-dev.107",
30
+ "@gem-sdk/plugin-cookie-bar": "1.53.0-dev.105",
31
+ "@gem-sdk/plugin-quick-view": "1.53.0-dev.105",
32
+ "@gem-sdk/plugin-sticky-add-to-cart": "1.53.0-dev.105"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "next": ">=13"