@gem-sdk/pages 1.9.35 → 1.9.39

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.
@@ -54,18 +54,20 @@ const Toolbox = ()=>{
54
54
  return value;
55
55
  });
56
56
  const fontUrl = googleFonts.createFontUrl(font);
57
- if (!fontUrl) return;
58
57
  const globalStyle = document.getElementById(globalStyleId);
59
58
  const googleFont = document.getElementById(globalFontId);
60
- if (googleFont) {
61
- googleFont.getAttribute('href') !== fontUrl && googleFont.setAttribute('href', fontUrl);
62
- //
63
- } else {
64
- const link = document.createElement('link');
65
- link.id = globalFontId;
66
- link.href = fontUrl;
67
- link.rel = 'stylesheet';
68
- document.head.appendChild(link);
59
+ if (fontUrl) {
60
+ if (googleFont) {
61
+ if (googleFont.getAttribute('href') !== fontUrl) {
62
+ googleFont.setAttribute('href', fontUrl);
63
+ }
64
+ } else {
65
+ const link = document.createElement('link');
66
+ link.id = globalFontId;
67
+ link.href = fontUrl;
68
+ link.rel = 'stylesheet';
69
+ document.head.appendChild(link);
70
+ }
69
71
  }
70
72
  if (globalStyle) {
71
73
  globalStyle.innerHTML = themeStyle;
@@ -49,7 +49,6 @@ const getFontFromGlobalStyle = (data)=>{
49
49
  if (!data) return '';
50
50
  try {
51
51
  const globalStyle = JSON.parse(data);
52
- console.log(9999, globalStyle);
53
52
  const fonts = globalStyle?.font ?? {};
54
53
  const font = Object.entries(fonts).map(([, value])=>{
55
54
  return value;
@@ -2,9 +2,13 @@
2
2
 
3
3
  var core = require('@gem-sdk/core');
4
4
 
5
+ const isStorefront = true;
5
6
  const getFallbackV2 = async (fetcher, data)=>{
6
7
  const isSample = !process.env.NEXT_PUBLIC_STOREFRONT_TOKEN;
7
- const queries = data.map((v)=>core.prefetchQueries(v.data, isSample)).flat();
8
+ const queries = data.map((v)=>core.prefetchQueries(v.data, {
9
+ isSample,
10
+ isStorefront
11
+ })).flat();
8
12
  const datas = await Promise.allSettled(queries.map(({ query , variables , func })=>{
9
13
  if (func) {
10
14
  return func(fetcher, variables);
@@ -50,18 +50,20 @@ const Toolbox = ()=>{
50
50
  return value;
51
51
  });
52
52
  const fontUrl = createFontUrl(font);
53
- if (!fontUrl) return;
54
53
  const globalStyle = document.getElementById(globalStyleId);
55
54
  const googleFont = document.getElementById(globalFontId);
56
- if (googleFont) {
57
- googleFont.getAttribute('href') !== fontUrl && googleFont.setAttribute('href', fontUrl);
58
- //
59
- } else {
60
- const link = document.createElement('link');
61
- link.id = globalFontId;
62
- link.href = fontUrl;
63
- link.rel = 'stylesheet';
64
- document.head.appendChild(link);
55
+ if (fontUrl) {
56
+ if (googleFont) {
57
+ if (googleFont.getAttribute('href') !== fontUrl) {
58
+ googleFont.setAttribute('href', fontUrl);
59
+ }
60
+ } else {
61
+ const link = document.createElement('link');
62
+ link.id = globalFontId;
63
+ link.href = fontUrl;
64
+ link.rel = 'stylesheet';
65
+ document.head.appendChild(link);
66
+ }
65
67
  }
66
68
  if (globalStyle) {
67
69
  globalStyle.innerHTML = themeStyle;
@@ -47,7 +47,6 @@ const getFontFromGlobalStyle = (data)=>{
47
47
  if (!data) return '';
48
48
  try {
49
49
  const globalStyle = JSON.parse(data);
50
- console.log(9999, globalStyle);
51
50
  const fonts = globalStyle?.font ?? {};
52
51
  const font = Object.entries(fonts).map(([, value])=>{
53
52
  return value;
@@ -1,8 +1,12 @@
1
1
  import { prefetchQueries } from '@gem-sdk/core';
2
2
 
3
+ const isStorefront = true;
3
4
  const getFallbackV2 = async (fetcher, data)=>{
4
5
  const isSample = !process.env.NEXT_PUBLIC_STOREFRONT_TOKEN;
5
- const queries = data.map((v)=>prefetchQueries(v.data, isSample)).flat();
6
+ const queries = data.map((v)=>prefetchQueries(v.data, {
7
+ isSample,
8
+ isStorefront
9
+ })).flat();
6
10
  const datas = await Promise.allSettled(queries.map(({ query , variables , func })=>{
7
11
  if (func) {
8
12
  return func(fetcher, variables);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "1.9.35",
3
+ "version": "1.9.39",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",