@gem-sdk/pages 17.0.0-dev.61 → 17.0.0-dev.67

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 +1,7 @@
1
- import{checkNotInOptionFont as t}from"./helpers/check-option-font.js";import{getFontsFromDataBuilder as e}from"./helpers/gen-fonts.js";import{sentryCaptureException as r}from"./helpers/sentry.js";import{THEME_FONT_CSS_KEYS as n}from"./constants/theme-font-keys.js";import{googleFontFamilies as i}from"../constants/googleFontV1.js";async function o(t,e){try{return fetch(t,{headers:{"User-Agent":e}}).then(n=>200===n.status?n.text():(r("getFontForUA",`Unexpected status ${n.status}`,{url:t,UA:e}),""))}catch(n){return r("getFontForUA","Error fetching font",{url:t,UA:e,error:n}),""}}let a=t=>{let e=t.filter((t,e,r)=>e===r.findIndex(e=>e.family===t.family));return e.map(e=>{let r=t.filter(t=>t.family===e.family).reduce((t,e)=>[...t,...e.variants],[]).filter((t,e,r)=>e===r.findIndex(e=>e===t));return{...e,variants:r}})},l={"Roboto Flex":"https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,wght@8..144,100..1000&display=swap"},s=t=>t?.trim().replace(/\s+/g,"+")??"",f=t=>t.includes("fonts.googleapis.com/css2")?"css2":t.includes("fonts.bunny.net")?"bunny":"css1",p=t=>{let e=s(t);return l[t]??l[e]},c={regular:"400",normal:"400",bold:"700",italic:"400italic"},y=new Set(i),u=[...n,...n.map(t=>`--g-${t}`)],g=(e,r,n)=>{if(("google"===r||"google"===e.type)&&!y.has(e.family))return!1;let i="google"===e.type||"bunny"===e.type,o="theme"===e.type&&n,a=t(e.family,r);return!(i&&a)&&(i||!e.type||o)},m=t=>{let e=String(t).toLowerCase().trim();return c[e]??t},h=t=>{let e=t=>{let e=String(t).toLowerCase().trim(),r=e.includes("italic"),n=e.replace("italic","").trim(),i=c[n]??n,o=parseInt(i,10)||400;return{weight:o,isItalic:r}};return[...t].sort((t,r)=>{let n=e(t),i=e(r);return n.weight!==i.weight?n.weight-i.weight:n.isItalic!==i.isItalic?n.isItalic?1:-1:0})},d=(t,e,r)=>{let n=a(t).map(t=>{let e=t.variants.map(t=>m(t)),r=h(e);return`${t.family.replace(/ /g,"+")}:${r.join(",")}`}).join("|");if("sans-serif"===n)return;let i=new URLSearchParams;return(i.append("family",n),i.append("display",r?.display||"swap"),"bunny"===e)?`https://fonts.bunny.net/css?${decodeURIComponent(i.toString())}`:(r?.subset&&i.append("subset",r.subset),r?.effect&&i.append("effect",r.effect),`https://fonts.googleapis.com/css?${decodeURIComponent(i.toString())}`)},b=(t,e,r,n)=>{let i=t.filter(t=>g(t,r||"google",n));if(!i.length)return;let o=i.filter((t,e,r)=>e===r.findIndex(e=>e.family===t.family)),a=[],l=[];for(let t of o){let e=p(t.family);e&&"bunny"!==r?a.push(e):l.push(t)}let s=l.length?d(l,r||"google",e):void 0;return a.length&&s?[...a,s]:s?[s,...a]:a};async function v(t,e,n=!0,i){let a=t.filter(t=>!u.includes(t.family)),l=b(a,e,i),s=Array.isArray(l)?l:l?[l]:[];if(!s.length)return"";if(n)return s.map(t=>`@import url('${t}');`).join("");let p="",c="";for(let t of s)try{let[e,r]=await Promise.all([o(t,"Mozilla/5.0 (Windows NT 10.0; Trident/7.0; rv:11.0) like Gecko"),o(t,"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")]),n=`${e}${r}`;p+=n,c+=`@import url('${t}');`}catch(n){let e=f(t);r("getFonts",`Error fetching font ${e}`,{url:t,fontType:i,fontApiVersion:e,error:String(n)}),c+="",p+=""}let y=new TextEncoder().encode(p).length;return y<51200?p:c}let w=(t,r)=>{let n=[];return t.forEach(t=>{n.push(...e(t.data,r))}),a(n)},F=(t,e)=>{let r="400";if(null!=t){let e=String(t).toLowerCase().trim();r=m(e)}let n=r,i=e&&"italic"===e.toLowerCase();return i&&!r.includes("italic")&&(n=r.includes("i")?r:`${r}italic`),n},S="heading-",j="subheading-",$="paragraph-",k=t=>{let e=t?.typography??{},r=t?.font??{},n=new Map;Object.entries(e).forEach(([t,e])=>{if(!e||"object"!=typeof e)return;let i=t.startsWith(S)||t.startsWith(j)?r.heading?"heading":void 0:t.startsWith($)&&r.body?"body":void 0,o=e.desktop,a=o?.fontFamily,l=a||i;["desktop","mobile","tablet"].forEach(t=>{let i=e[t];if(!i||"object"!=typeof i)return;let a=i.fontFamily||l;if(!a||"string"!=typeof a||!r[a])return;let s=i.fontWeight??o?.fontWeight,f=i.fontStyle??o?.fontStyle;if(null==s)return;let p=F(s,f);n.has(a)||n.set(a,new Set),n.get(a).add(p)})});let i={};return n.forEach((t,e)=>{let n=r[e];n&&(i[e]={variants:Array.from(t).sort(),family:n.family,type:n.type})}),i},O=t=>{let e=t?.typography??{},r=t?.font??{},n=t?.font??{},i={};return Object.entries(e).forEach(([t,e])=>{if(!e||"object"!=typeof e)return;let o=e.desktop,a=e.mobile,l=e.tablet,s=t.startsWith(S)||t.startsWith(j)?n.heading?"heading":void 0:t.startsWith($)&&n.body?"body":void 0,f=o?.fontFamily||a?.fontFamily||l?.fontFamily||s;if(!f||"string"!=typeof f)return;let p=r[f],c=n[f],y=p?.family||c?.family||f,u=p?.type||c?.type||"google";y&&(i[t]={family:y,type:u})}),i},x=async(t,e)=>{if(!t)return"";try{let r=JSON.parse(t),n=r?.font??{},i=Object.values(n),o=k(r);Object.keys(o).length>0&&(i=Object.entries(n).filter(([t])=>o[t]).map(([t,e])=>({...e,variants:o[t].variants})));let l=a(i);return v(l,void 0,void 0,e)}catch{return""}},E=(t,e)=>{if(!t)return"";try{let r=JSON.parse(t),n=r?.font??{},i=Object.entries(n).map(([,t])=>t);return v(i,void 0,void 0,e)}catch{return""}};async function I(t,e,r){let n,i=null;if(r)try{i=JSON.parse(r),n=O(i)}catch{}let o=w(t,n);if(!i){if(0===o.length)return[];let t=await v(o,void 0,void 0,e);return t?[t]:[]}let a=k(i),l=new Map,s=new Map,f=(t,e)=>`${t}::${e}`;for(let t of Object.values(a)){if(t.type){let e=f(t.family,t.type),r=l.get(e);if(!r){l.set(e,new Set(t.variants));continue}t.variants.forEach(t=>r.add(t));continue}let e=s.get(t.family);if(!e){s.set(t.family,new Set(t.variants));continue}t.variants.forEach(t=>e.add(t))}if(0===(o=o.map(t=>{let e=l.get(f(t.family,t.type))||s.get(t.family);if(!e)return t;let r=t.variants.filter(t=>!e.has(t));return 0===r.length?null:{...t,variants:r}}).filter(t=>null!==t)).length)return[];let p=await v(o,void 0,void 0,e);return p?[p]:[]}export{a as composeFonts,b as createFontUrls,k as extractTypographyVariants,E as getFontFromGlobalStyle,x as getFontLinkFromGlobalStyle,I as getFontStyleFromPageTemplate,v as getFonts,O as mapTypographyToFontFamily};
1
+ import{checkNotInOptionFont as t}from"./helpers/check-option-font.js";import{getFontsFromDataBuilder as e}from"./helpers/gen-fonts.js";import{sentryCaptureException as n}from"./helpers/sentry.js";import{THEME_FONT_CSS_KEYS as r}from"./constants/theme-font-keys.js";import{googleFontFamilies as i}from"../constants/googleFontV1.js";import a from"./data/fonts.js";let l="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";async function o(t,e){try{return fetch(t,{headers:{"User-Agent":e}}).then(r=>200===r.status?r.text():(n("getFontForUA",`Unexpected status ${r.status}`,{url:t,UA:e}),""))}catch(r){return n("getFontForUA","Error fetching font",{url:t,UA:e,error:r}),""}}let s=t=>{let e=t.filter((t,e,n)=>e===n.findIndex(e=>e.family===t.family));return e.map(e=>{let n=t.filter(t=>t.family===e.family).reduce((t,e)=>[...t,...e.variants],[]).filter((t,e,n)=>e===n.findIndex(e=>e===t));return{...e,variants:n}})},f={"Roboto Flex":"https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,wght@8..144,100..1000&display=swap"},c=t=>t?.trim().replace(/\s+/g,"+")??"",y=t=>t.includes("fonts.googleapis.com/css2")?"css2":t.includes("fonts.bunny.net")?"bunny":"css1",u=t=>{let e=c(t);return f[t]??f[e]},p={regular:"400",normal:"400",bold:"700",italic:"400italic"},g=new Set(i),m=[...r,...r.map(t=>`--g-${t}`)],h=(e,n,r)=>{if(("google"===n||"google"===e.type)&&!g.has(e.family))return!1;let i="google"===e.type||"bunny"===e.type,a="theme"===e.type&&r,l=t(e.family,n);return!(i&&l)&&(i||!e.type||a)},d=t=>{let e=String(t).toLowerCase().trim();return p[e]??t},b=t=>{let e=t=>{let e=String(t).toLowerCase().trim(),n=e.includes("italic"),r=e.replace("italic","").trim(),i=p[r]??r,a=parseInt(i,10)||400;return{weight:a,isItalic:n}};return[...t].sort((t,n)=>{let r=e(t),i=e(n);return r.weight!==i.weight?r.weight-i.weight:r.isItalic!==i.isItalic?r.isItalic?1:-1:0})},v=(t,e,n)=>{let r=s(t).map(t=>{let e=t.variants.map(t=>d(t)),n=b(e);return`${t.family.replace(/ /g,"+")}:${n.join(",")}`}).join("|");if("sans-serif"===r)return;let i=new URLSearchParams;return(i.append("family",r),i.append("display",n?.display||"swap"),"bunny"===e)?`https://fonts.bunny.net/css?${decodeURIComponent(i.toString())}`:(n?.subset&&i.append("subset",n.subset),n?.effect&&i.append("effect",n.effect),`https://fonts.googleapis.com/css?${decodeURIComponent(i.toString())}`)},S=(t,e,n,r)=>{let i=t.filter(t=>h(t,n||"google",r));if(!i.length)return;let a=i.filter((t,e,n)=>e===n.findIndex(e=>e.family===t.family)),l=[],o=[];for(let t of a){let e=u(t.family);e&&"bunny"!==n?l.push(e):o.push(t)}let s=o.length?v(o,n||"google",e):void 0;return l.length&&s?[...l,s]:s?[s,...l]:l};async function w(t,e,r=!0,i){let a=t.filter(t=>!m.includes(t.family)),s=S(a,e,i),f=Array.isArray(s)?s:s?[s]:[];if(!f.length)return"";if(r)return f.map(t=>`@import url('${t}');`).join("");let c="",u="";for(let t of f)try{let[e,n]=await Promise.all([o(t,"Mozilla/5.0 (Windows NT 10.0; Trident/7.0; rv:11.0) like Gecko"),o(t,l)]),r=`${e}${n}`;c+=r,u+=`@import url('${t}');`}catch(r){let e=y(t);n("getFonts",`Error fetching font ${e}`,{url:t,fontType:i,fontApiVersion:e,error:String(r)}),u+="",c+=""}let p=new TextEncoder().encode(c).length;return p<51200?c:u}let F=(t,n)=>{let r=[];return t.forEach(t=>{r.push(...e(t.data,n))}),s(r)},$=(t,e)=>{let n="400";if(null!=t){let e=String(t).toLowerCase().trim();n=d(e)}let r=n,i=e&&"italic"===e.toLowerCase();return i&&!n.includes("italic")&&(r=n.includes("i")?n:`${n}italic`),r},j="heading-",O="subheading-",W="paragraph-",k=t=>{let e=t?.typography??{},n=t?.font??{},r=new Map;Object.entries(e).forEach(([t,e])=>{if(!e||"object"!=typeof e)return;let i=t.startsWith(j)||t.startsWith(O)?n.heading?"heading":void 0:t.startsWith(W)&&n.body?"body":void 0,a=e.desktop,l=a?.fontFamily,o=l||i;["desktop","mobile","tablet"].forEach(t=>{let i=e[t];if(!i||"object"!=typeof i)return;let l=i.fontFamily||o;if(!l||"string"!=typeof l||!n[l])return;let s=i.fontWeight??a?.fontWeight,f=i.fontStyle??a?.fontStyle;if(null==s)return;let c=$(s,f);r.has(l)||r.set(l,new Set),r.get(l).add(c)})});let i={};return r.forEach((t,e)=>{let r=n[e];r&&(i[e]={variants:Array.from(t).sort(),family:r.family,type:r.type})}),i},E=t=>{let e=t?.typography??{},n=t?.font??{},r=t?.font??{},i={};return Object.entries(e).forEach(([t,e])=>{if(!e||"object"!=typeof e)return;let a=e.desktop,l=e.mobile,o=e.tablet,s=t.startsWith(j)||t.startsWith(O)?r.heading?"heading":void 0:t.startsWith(W)&&r.body?"body":void 0,f=a?.fontFamily||l?.fontFamily||o?.fontFamily||s;if(!f||"string"!=typeof f)return;let c=n[f],y=r[f],u=c?.family||y?.family||f,p=c?.type||y?.type||"google";u&&(i[t]={family:u,type:p})}),i},I=async(t,e)=>{if(!t)return"";try{let n=JSON.parse(t),r=n?.font??{},i=Object.values(r),a=k(n);Object.keys(a).length>0&&(i=Object.entries(r).filter(([t])=>a[t]).map(([t,e])=>({...e,variants:a[t].variants})));let l=s(i);return w(l,void 0,void 0,e)}catch{return""}},x=(t,e)=>{if(!t)return"";try{let n=JSON.parse(t),r=n?.font??{},i=Object.entries(r).map(([,t])=>t);return w(i,void 0,void 0,e)}catch{return""}};async function A(t,e,n){let r,i=null;if(n)try{i=JSON.parse(n),r=E(i)}catch{}let a=F(t,r);if(!i){if(0===a.length)return[];let t=await w(a,void 0,void 0,e);return t?[t]:[]}let l=k(i),o=new Map,s=new Map,f=(t,e)=>`${t}::${e}`;for(let t of Object.values(l)){if(t.type){let e=f(t.family,t.type),n=o.get(e);if(!n){o.set(e,new Set(t.variants));continue}t.variants.forEach(t=>n.add(t));continue}let e=s.get(t.family);if(!e){s.set(t.family,new Set(t.variants));continue}t.variants.forEach(t=>e.add(t))}if(0===(a=a.map(t=>{let e=o.get(f(t.family,t.type))||s.get(t.family);if(!e)return t;let n=t.variants.filter(t=>!e.has(t));return 0===n.length?null:{...t,variants:n}}).filter(t=>null!==t)).length)return[];let c=await w(a,void 0,void 0,e);return c?[c]:[]}let C=null;function M({fontFamily:t,fontStyle:e,fontWeight:n,src:r,fontDisplay:i}){let a=r.replace(/^"|"$/g,""),l=`@font-face {
2
+ `;return l+=` font-family: '${t}';
3
+ font-style: ${e};
4
+ font-weight: ${n};
5
+ `,i&&(l+=` font-display: ${i};
6
+ `),l+=` src: ${a};
7
+ }`}function T({variant:t}){let e=t.trim().toLowerCase();if("regular"===e||"400"===e)return{fontStyle:"normal",fontWeight:"400"};if("italic"===e)return{fontStyle:"italic",fontWeight:"400"};if("bold"===e||"700"===e)return{fontStyle:"normal",fontWeight:"700"};let n=e.endsWith("i")||e.endsWith("italic"),r=e.replace(/i(talic)?$/,"").trim()||"400";return{fontStyle:n?"italic":"normal",fontWeight:r}}async function L({fonts:t,sourceFont:e}){let r=t.filter(t=>!m.includes(t.family));if(!r.length)return"";let i="bunny"===e,s=i?null:function(){if(C)return C;for(let t of(C={},a.fonts)){let e=`${t.fontFamily}_${t.fontStyle}_${t.fontWeight}`.replace(/\s+/g,"");C[e]=t}return C}(),f=await Promise.all(r.map(async t=>{let r=[],i=[];for(let e of t.variants){if(s){let{fontStyle:n,fontWeight:i}=T({variant:e}),a=`${t.family}_${n}_${i}`.replace(/\s+/g,""),l=s[a];if(l){r.push(M(l));continue}}i.push(e)}if(i.length){let a=S([{...t,variants:i}],void 0,e),s=Array.isArray(a)?a:a?[a]:[],f=await Promise.all(s.map(t=>o(t,l)));for(let e=0;e<f.length;e++){let a=f[e];a?r.push(a):n("resolveFontFaces","API fallback returned empty CSS",{family:t.family,variants:i,url:s[e]})}}return r.length?r.join("\n"):""}));return f.filter(Boolean).join("\n")}async function U({data:t,sourceFont:e}){if(!t)return"";try{let n="string"==typeof t?JSON.parse(t):t,r=n?.font??{},i=Object.values(r),a=k(n);return Object.keys(a).length>0&&(i=Object.entries(r).filter(([t])=>a[t]).map(([t,e])=>Object.assign({},e,{variants:a[t].variants}))),L({fonts:s(i),sourceFont:e})}catch{return""}}async function P({pageTemplate:t,sourceFont:e,data:n}){let r,i=null;if(n)try{i="string"==typeof n?JSON.parse(n):n,r=E(i)}catch{}let a=F(t,r);if(!i){if(!a.length)return[];let t=await L({fonts:a,sourceFont:e});return t?[t]:[]}let l=k(i),o=new Map,s=new Map,f=(t,e)=>`${t}::${e}`;for(let t of Object.values(l))if(t.type){let e=f(t.family,t.type),n=o.get(e);n?t.variants.forEach(t=>n.add(t)):o.set(e,new Set(t.variants))}else{let e=s.get(t.family);e?t.variants.forEach(t=>e.add(t)):s.set(t.family,new Set(t.variants))}if(!(a=a.map(t=>{let e=o.get(f(t.family,t.type))||s.get(t.family);if(!e)return t;let n=t.variants.filter(t=>!e.has(t));return n.length?Object.assign({},t,{variants:n}):null}).filter(t=>null!==t)).length)return[];let c=await L({fonts:a,sourceFont:e});return c?[c]:[]}export{s as composeFonts,S as createFontUrls,k as extractTypographyVariants,x as getFontFromGlobalStyle,I as getFontLinkFromGlobalStyle,A as getFontStyleFromPageTemplate,w as getFonts,U as getStaticFontFacesFromGlobalStyle,P as getStaticFontFacesFromPageTemplate,E as mapTypographyToFontFamily,T as parseVariant,M as staticFontToCSS};
@@ -1 +1 @@
1
- let t=["sans-serif"],e=(t,e)=>{if(e&&t?.type&&!t?.custom?.fontFamily){let l=e[t.type];if(l){let e=JSON.parse(JSON.stringify(t));return e.custom||(e.custom={}),e.custom.fontFamily={value:l.family,type:l.type},e}}return t},l=(t,e)=>{let l=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let r=t[o],s=r.styles,n=r.settings;i(l,s,e),i(l,n,e)}return l},i=(t,l,i)=>{let o=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let s in l)if(Object.prototype.hasOwnProperty.call(l,s)){let n=l[s];if(!n)continue;let a=i?e(n,i):n;for(let l of(r(t,a),o)){if(!n[l])continue;let o=i?e(n[l],i):n[l];r(t,o)}}},o=t=>Array.from(new Set(t)),r=(e,l)=>{let i=l.custom?.fontFamily;"string"==typeof i&&(i={value:l.custom?.fontFamily||"",type:"google"});let r=i?.value;if(t.includes(r))return;let s=l.custom?.fontVariants;if(s?.length||(s=[l.custom?.fontWeight]),i&&s?.length){let t=s.map(t=>"regular"===t?"400":t),n=l.custom?.fontWeight&&t.includes(l.custom?.fontWeight)?l.custom?.fontWeight:t[0];if(n){let s=o([n,...l?.attrs?.isAlwaysLoadBold?["700"]:[],...l?.attrs?.loadFontStyles?.includes("bold")?["700"]:[]]);if(l?.attrs?.loadFontStyles?.includes("italic")){let t=s.map(t=>"string"==typeof t&&/^\d+$/.test(t)?`${t}i`:null).filter(t=>null!==t);s.push(...t)}let a=e.find(t=>t.family==r&&s.every(e=>t.variants.includes(e)));if(!a){let l=e.find(t=>t.family==r);l?s.forEach(t=>{l.variants.includes(t)||l.variants.push(t)}):("700"!==n&&t.includes("700")&&s.push("700"),e.push({family:r||"",variants:o(s),subsets:[],type:i.type}))}}}},s=t=>{let e=[...t.matchAll(/@import url\(['"]?([^'")\s]+)['"]?\)/g)];return e.map(t=>t[1]).filter(t=>!!t)};export{s as extractImportUrls,i as getFontFromGroupSetting,l as getFontsFromDataBuilder};
1
+ let t=["sans-serif"],e=(t,e)=>{if(e&&t?.type&&!t?.custom?.fontFamily){let l=e[t.type];if(l){let e=JSON.parse(JSON.stringify(t));return e.custom||(e.custom={}),e.custom.fontFamily={value:l.family,type:l.type},e}}return t},l=(t,e)=>{let l=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let s=t[o],n=s.styles,r=s.settings;i(l,n,e),i(l,r,e)}return l},i=(t,l,i)=>{let o=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let n in l)if(Object.prototype.hasOwnProperty.call(l,n)){let r=l[n];if(!r)continue;let a=i?e(r,i):r;for(let l of(s(t,a),o)){if(!r[l])continue;let o=i?e(r[l],i):r[l];s(t,o)}}},o=t=>Array.from(new Set(t)),s=(e,l)=>{let i=l.custom?.fontFamily;"string"==typeof i&&(i={value:l.custom?.fontFamily||"",type:"google"});let s=i?.value;if(t.includes(s))return;let n=l.custom?.fontVariants;if(n?.length||(n=[l.custom?.fontWeight]),i&&n?.length){let t=n.map(t=>"regular"===t?"400":t),r=l.custom?.fontWeight&&t.includes(l.custom?.fontWeight)?l.custom?.fontWeight:t[0];if(r){let n=o([r,...l?.attrs?.isAlwaysLoadBold?["700"]:[],...l?.attrs?.loadFontStyles?.includes("bold")?["700"]:[]]);if(l?.attrs?.loadFontStyles?.includes("italic")){let t=n.map(t=>"string"==typeof t&&/^\d+$/.test(t)?`${t}i`:null).filter(t=>null!==t);n.push(...t)}let a=e.find(t=>t.family==s&&n.every(e=>t.variants.includes(e)));if(!a){let l=e.find(t=>t.family==s);l?n.forEach(t=>{l.variants.includes(t)||l.variants.push(t)}):("700"!==r&&t.includes("700")&&n.push("700"),e.push({family:s||"",variants:o(n),subsets:[],type:i.type}))}}}};export{i as getFontFromGroupSetting,l as getFontsFromDataBuilder};
@@ -1,5 +1,5 @@
1
- import{jsx as e,jsxs as t,Fragment as s}from"react/jsx-runtime";import{useI18n as r,PageProvider as a,BuilderComponentProvider as n,I18nProvider as o,SectionProvider as i,BuilderProvider as l,Render as p}from"@gem-sdk/core";import{NextSeo as c}from"next-seo";import m from"next/head";import{useRouter as g}from"next/router";import{useTrackingView as d}from"../libs/hooks/use-tracking-view.js";import{parseHtml as u}from"../libs/parse-html.js";import f from"../components/builder/Header.js";import h from"../components/FooterForPostPurchase.js";import y from"next/script";import{useEffect as _}from"react";import{usePageViewedTracking as b}from"../libs/hooks/usePageViewedTracking.js";import{FontLink as k}from"../components/FontLink.js";let v=({components:v,builderData:S,sectionData:P,seo:x,themeStyle:N,fontStyle:j,elementFontStyle:T,customCodeHeader:F,shopToken:I,pageHandle:$,customFonts:w,isPostPurchase:E,shopName:H,productOffers:L,publicStoreFrontData:O,dynamicDiscountOffer:q,isPreview:A,interaction:M,pageBackground:z,sellingPlanSetting:C,buyerConsentPreCheck:D,id:U,shopID:B,domainTrackingIlp:R})=>{let V=g(),{t:G}=r(),J=process.env.NEXT_GP_BASE_ASSET_URL||"https://assets.gemcommerce.xyz";d(I,$,V.isFallback),b({id:U,shopID:B,domain:R});let X="custom-code-header";if(_(()=>{let e=document.querySelectorAll(`[class*="${X}-"]`),t=[];e.length>1&&e.forEach(e=>{let s=e.className;if(t.includes(s)){e.remove();return}t.push(s)})},[]),V.isFallback)return e("div",{className:"gp-flex gp-h-[100vh] gp-items-center gp-justify-center",children:t("div",{className:"gp-flex gp-gap-2",children:[e("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"}),e("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"}),e("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"})]})});let K=(M?.value||[]).length>0;return t(s,{children:[e(c,{...x}),t(m,{children:[e("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),e("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),u(X,F,!0),N&&e("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:N}},"global-style"),w&&e("style",{"data-id":"custom-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:w}},j),z?.isUsePageBackground&&z?.background&&e("style",{children:`
1
+ import{jsx as e,jsxs as t,Fragment as s}from"react/jsx-runtime";import{useI18n as a,PageProvider as r,BuilderComponentProvider as n,I18nProvider as l,SectionProvider as o,BuilderProvider as i,Render as p}from"@gem-sdk/core";import{NextSeo as c}from"next-seo";import m from"next/head";import{useRouter as d}from"next/router";import{useTrackingView as g}from"../libs/hooks/use-tracking-view.js";import{parseHtml as u}from"../libs/parse-html.js";import h from"../components/builder/Header.js";import f from"../components/FooterForPostPurchase.js";import y from"next/script";import{useEffect as _}from"react";import{usePageViewedTracking as b}from"../libs/hooks/usePageViewedTracking.js";let v=({components:v,builderData:k,sectionData:S,seo:x,themeStyle:P,fontStyle:N,elementFontStyle:T,customCodeHeader:j,shopToken:H,pageHandle:I,customFonts:L,isPostPurchase:M,shopName:$,productOffers:w,publicStoreFrontData:E,dynamicDiscountOffer:F,isPreview:q,interaction:A,pageBackground:O,sellingPlanSetting:z,buyerConsentPreCheck:C,id:D,shopID:U,domainTrackingIlp:B})=>{let R=d(),{t:V}=a(),G=process.env.NEXT_GP_BASE_ASSET_URL||"https://assets.gemcommerce.xyz";g(H,I,R.isFallback),b({id:D,shopID:U,domain:B});let J="custom-code-header";if(_(()=>{let e=document.querySelectorAll(`[class*="${J}-"]`),t=[];e.length>1&&e.forEach(e=>{let s=e.className;if(t.includes(s)){e.remove();return}t.push(s)})},[]),R.isFallback)return e("div",{className:"gp-flex gp-h-[100vh] gp-items-center gp-justify-center",children:t("div",{className:"gp-flex gp-gap-2",children:[e("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"}),e("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"}),e("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"})]})});let X=(A?.value||[]).length>0;return t(s,{children:[e(c,{...x}),t(m,{children:[u(J,j,!0),P&&e("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:P}},"global-style"),N&&e("style",{"data-id":"google-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:N}},"google-fonts"),T&&T.map(t=>e("style",{"data-id":"google-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:t}},t)),L&&e("style",{"data-id":"custom-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:L}},N),O?.isUsePageBackground&&O?.background&&e("style",{children:`
2
2
  body {
3
- background: ${z.background};
3
+ background: ${O.background};
4
4
  }
5
- `},`page_background_${z?.background}`)]}),j&&e(k,{fontStyle:j,dataId:"google-fonts"}),T&&T.map((t,s)=>e(k,{fontStyle:t,dataId:"google-element-fonts"},s)),e(a,{productOffers:L,publicStoreFrontData:O,dynamicDiscountOffer:q,sellingPlanMeta:C,buyerConsentChecked:D,children:e(n,{components:v,children:e(o,{t:G,children:t("div",{className:`${E?"gp-bg-white post-purchase-page":""} `,role:"main",children:[E&&e(f,{pageType:"POST_PURCHASE"}),K&&e("div",{dangerouslySetInnerHTML:{__html:`<div id="gp-interaction" style="display: none;">${JSON.stringify(M?.value||[])}</div>`}}),e(i,{data:P,children:S?.map(s=>t(l,{state:s.data,lazy:s.lazy,priority:s.priority,isPostPurchase:E,isPreview:A,children:[e(p,{uid:s.uid}),K&&e(y,{defer:!0,src:`${J}/assets-v2/gp-flow-action-lip-v7-5.js`})]},s.uid))}),E&&e(h,{shopName:H||""})]})})})})]})};export{v as StaticPageV2};
5
+ `},`page_background_${O?.background}`)]}),e(r,{productOffers:w,publicStoreFrontData:E,dynamicDiscountOffer:F,sellingPlanMeta:z,buyerConsentChecked:C,children:e(n,{components:v,children:e(l,{t:V,children:t("div",{className:`${M?"gp-bg-white post-purchase-page":""} `,role:"main",children:[M&&e(h,{pageType:"POST_PURCHASE"}),X&&e("div",{dangerouslySetInnerHTML:{__html:`<div id="gp-interaction" style="display: none;">${JSON.stringify(A?.value||[])}</div>`}}),e(o,{data:S,children:k?.map(s=>t(i,{state:s.data,lazy:s.lazy,priority:s.priority,isPostPurchase:M,isPreview:q,children:[e(p,{uid:s.uid}),X&&e(y,{defer:!0,src:`${G}/assets-v2/gp-flow-action-lip-v7-5.js`})]},s.uid))}),M&&e(f,{shopName:$||""})]})})})})]})};export{v as StaticPageV2};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "17.0.0-dev.61",
3
+ "version": "17.0.0-dev.67",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -27,7 +27,7 @@
27
27
  "next": "14.2.35"
28
28
  },
29
29
  "devDependencies": {
30
- "@gem-sdk/core": "17.0.0-dev.57",
30
+ "@gem-sdk/core": "17.0.0-dev.66",
31
31
  "@gem-sdk/plugin-cookie-bar": "17.0.0-dev.38",
32
32
  "@gem-sdk/plugin-quick-view": "17.0.0-dev.38",
33
33
  "@gem-sdk/plugin-sticky-add-to-cart": "17.0.0-dev.38"
@@ -1 +0,0 @@
1
- "use strict";var e=require("react/jsx-runtime"),r=require("next/head"),t=require("../libs/helpers/gen-fonts.js");exports.FontLink=({fontStyle:s,dataId:l})=>{let i=t.extractImportUrls(s),n=s.replace(/@import url\(['"]?[^'")\s]+['"]?\);?/g,"").trim();return e.jsxs(r,{children:[i.map(r=>e.jsx("link",{rel:"stylesheet",href:r},r)),n&&e.jsx("style",{"data-id":l,type:"text/css",dangerouslySetInnerHTML:{__html:n}})]})};
@@ -1 +0,0 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import r from"next/head";import{extractImportUrls as l}from"../libs/helpers/gen-fonts.js";let n=({fontStyle:n,dataId:s})=>{let i=l(n),m=n.replace(/@import url\(['"]?[^'")\s]+['"]?\);?/g,"").trim();return e(r,{children:[i.map(e=>t("link",{rel:"stylesheet",href:e},e)),m&&t("style",{"data-id":s,type:"text/css",dangerouslySetInnerHTML:{__html:m}})]})};export{n as FontLink};