@gem-sdk/pages 1.9.13 → 1.9.33

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.
@@ -51,7 +51,7 @@ const PopupManager = ()=>{
51
51
  },
52
52
  children: /*#__PURE__*/ jsxRuntime.jsx("span", {
53
53
  className: "text-ellipsis whitespace-nowrap",
54
- children: item?.settings?.name ?? 'Popup Name'
54
+ children: item?.settings?.name || 'Popup Name'
55
55
  })
56
56
  }, item?.uid);
57
57
  })
@@ -52,6 +52,7 @@ const Toolbox = ()=>{
52
52
  return value;
53
53
  });
54
54
  const fontUrl = googleFonts.createFontUrl(font);
55
+ if (!fontUrl) return;
55
56
  const globalStyle = document.getElementById(globalStyleId);
56
57
  const googleFont = document.getElementById(globalFontId);
57
58
  if (googleFont) {
@@ -9,7 +9,9 @@ async function getFontForUA(url, UA) {
9
9
  }
10
10
  }).then((res)=>res.text());
11
11
  }
12
- const createFontUrl = (fonts, option)=>{
12
+ const createFontUrl = (fontList, option)=>{
13
+ const fonts = fontList.filter((font)=>font.type === 'google');
14
+ if (!fonts.length) return;
13
15
  const params = new URLSearchParams();
14
16
  const display = option?.display || 'swap';
15
17
  const family = fonts.filter((font, index, arr)=>{
@@ -32,6 +34,7 @@ async function getFonts(fonts, option) {
32
34
  * The order of IE -> Chrome is important, other wise chrome starts loading woff1.
33
35
  * CSS cascading 🤷‍♂️.
34
36
  */ const url = createFontUrl(fonts, option);
37
+ if (!url) return '';
35
38
  try {
36
39
  const [ie, chrome] = await Promise.all([
37
40
  getFontForUA(url, IE_UA),
@@ -46,10 +49,11 @@ const getFontFromGlobalStyle = (data)=>{
46
49
  if (!data) return '';
47
50
  try {
48
51
  const globalStyle = JSON.parse(data);
52
+ console.log(9999, globalStyle);
49
53
  const fonts = globalStyle?.font ?? {};
50
54
  const font = Object.entries(fonts).map(([, value])=>{
51
55
  return value;
52
- });
56
+ }).filter((font)=>font.type === 'google');
53
57
  return getFonts(font);
54
58
  } catch {
55
59
  return '';
@@ -47,7 +47,7 @@ const PopupManager = ()=>{
47
47
  },
48
48
  children: /*#__PURE__*/ jsx("span", {
49
49
  className: "text-ellipsis whitespace-nowrap",
50
- children: item?.settings?.name ?? 'Popup Name'
50
+ children: item?.settings?.name || 'Popup Name'
51
51
  })
52
52
  }, item?.uid);
53
53
  })
@@ -48,6 +48,7 @@ const Toolbox = ()=>{
48
48
  return value;
49
49
  });
50
50
  const fontUrl = createFontUrl(font);
51
+ if (!fontUrl) return;
51
52
  const globalStyle = document.getElementById(globalStyleId);
52
53
  const googleFont = document.getElementById(globalFontId);
53
54
  if (googleFont) {
@@ -7,7 +7,9 @@ async function getFontForUA(url, UA) {
7
7
  }
8
8
  }).then((res)=>res.text());
9
9
  }
10
- const createFontUrl = (fonts, option)=>{
10
+ const createFontUrl = (fontList, option)=>{
11
+ const fonts = fontList.filter((font)=>font.type === 'google');
12
+ if (!fonts.length) return;
11
13
  const params = new URLSearchParams();
12
14
  const display = option?.display || 'swap';
13
15
  const family = fonts.filter((font, index, arr)=>{
@@ -30,6 +32,7 @@ async function getFonts(fonts, option) {
30
32
  * The order of IE -> Chrome is important, other wise chrome starts loading woff1.
31
33
  * CSS cascading 🤷‍♂️.
32
34
  */ const url = createFontUrl(fonts, option);
35
+ if (!url) return '';
33
36
  try {
34
37
  const [ie, chrome] = await Promise.all([
35
38
  getFontForUA(url, IE_UA),
@@ -44,10 +47,11 @@ const getFontFromGlobalStyle = (data)=>{
44
47
  if (!data) return '';
45
48
  try {
46
49
  const globalStyle = JSON.parse(data);
50
+ console.log(9999, globalStyle);
47
51
  const fonts = globalStyle?.font ?? {};
48
52
  const font = Object.entries(fonts).map(([, value])=>{
49
53
  return value;
50
- });
54
+ }).filter((font)=>font.type === 'google');
51
55
  return getFonts(font);
52
56
  } catch {
53
57
  return '';
@@ -123,6 +123,7 @@ declare const StaticPageV2: React.FC<StaticPagePropsV2 & AdditionalPageBuilderPr
123
123
  declare const getStaticPaths: GetStaticPaths;
124
124
 
125
125
  type FontItem = {
126
+ type: 'google' | 'custom';
126
127
  family: string;
127
128
  variants: string[];
128
129
  subsets: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "1.9.13",
3
+ "version": "1.9.33",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -19,7 +19,7 @@
19
19
  "test": "jest -c ./../../helpers/jest.config.ts"
20
20
  },
21
21
  "dependencies": {
22
- "@sentry/nextjs": "7.21.1",
22
+ "@sentry/nextjs": "7.46.0",
23
23
  "deepmerge": "4.3.1",
24
24
  "html-react-parser": "3.0.15",
25
25
  "next-seo": "^5.15.0"