@gem-sdk/pages 17.0.0-dev.38 → 17.0.0-dev.55

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 @@
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 n=t.extractImportUrls(s),i=s.replace(/@import url\(['"]?[^'")\s]+['"]?\);?/g,"").trim();return e.jsxs(r,{children:[n.map(r=>e.jsx("link",{rel:"preload",as:"style",href:r,onLoad:"this.onload=null;this.rel='stylesheet'"},r)),i&&e.jsx("style",{"data-id":l,type:"text/css",dangerouslySetInnerHTML:{__html:i}})]})};
@@ -1 +1 @@
1
- "use strict";var t=require("./helpers/check-option-font.js"),e=require("./helpers/gen-fonts.js"),r=require("./helpers/sentry.js"),n=require("./constants/theme-font-keys.js"),i=require("../constants/googleFontV1.js");async function o(t,e){try{return fetch(t,{headers:{"User-Agent":e}}).then(n=>200===n.status?n.text():(r.sentryCaptureException("getFontForUA",`Unexpected status ${n.status}`,{url:t,UA:e}),""))}catch(n){return r.sentryCaptureException("getFontForUA","Error fetching font",{url:t,UA:e,error:n}),""}}const 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"},u=new Set(i.googleFontFamilies),y=[...n.THEME_FONT_CSS_KEYS,...n.THEME_FONT_CSS_KEYS.map(t=>`--g-${t}`)],g=(e,r,n)=>{if(("google"===r||"google"===e.type)&&!u.has(e.family))return!1;let i="google"===e.type||"bunny"===e.type,o="theme"===e.type&&n,a=t.checkNotInOptionFont(e.family,r);return!(i&&a)&&(i||!e.type||o)},h=t=>{let e=String(t).toLowerCase().trim();return c[e]??t},m=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=>h(t)),r=m(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 F(t,e,n=!0,i){let a=t.filter(t=>!y.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.sentryCaptureException("getFonts",`Error fetching font ${e}`,{url:t,fontType:i,fontApiVersion:e,error:String(n)}),c+="",p+=""}let u=new TextEncoder().encode(p).length;return u<51200?p:c}const v=(t,r)=>{let n=[];return t.forEach(t=>{n.push(...e.getFontsFromDataBuilder(t.data,r))}),a(n)},S=(t,e)=>{let r="400";if(null!=t){let e=String(t).toLowerCase().trim();r=h(e)}let n=r,i=e&&"italic"===e.toLowerCase();return i&&!r.includes("italic")&&(n=r.includes("i")?r:`${r}italic`),n},w="heading-",x="subheading-",j="paragraph-",E=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(w)||t.startsWith(x)?r.heading?"heading":void 0:t.startsWith(j)&&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=S(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})}),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(w)||t.startsWith(x)?n.heading?"heading":void 0:t.startsWith(j)&&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],u=p?.family||c?.family||f,y=p?.type||c?.type||"google";u&&(i[t]={family:u,type:y})}),i},k=async(t,e)=>{if(!t)return"";try{let r=JSON.parse(t),n=r?.font??{},i=Object.values(n),o=E(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 F(l,void 0,void 0,e)}catch{return""}};async function C(t,e,r){let n,i=null;if(r)try{i=JSON.parse(r),n=O(i)}catch{}let o=v(t,n);if(!i){if(0===o.length)return[];let t=await F(o,void 0,void 0,e);return t?[t]:[]}let a=E(i),l=new Map;for(let t of Object.values(a)){let e=l.get(t.family);if(!e){l.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(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 s=await F(o,void 0,void 0,e);return s?[s]:[]}exports.composeFonts=a,exports.createFontUrls=b,exports.extractTypographyVariants=E,exports.getFontFromGlobalStyle=(t,e)=>{if(!t)return"";try{let r=JSON.parse(t),n=r?.font??{},i=Object.entries(n).map(([,t])=>t);return F(i,void 0,void 0,e)}catch{return""}},exports.getFontLinkFromGlobalStyle=k,exports.getFontStyleFromPageTemplate=C,exports.getFonts=F,exports.mapTypographyToFontFamily=O;
1
+ "use strict";var t=require("./helpers/check-option-font.js"),e=require("./helpers/gen-fonts.js"),r=require("./helpers/sentry.js"),n=require("./constants/theme-font-keys.js"),i=require("../constants/googleFontV1.js");async function o(t,e){try{return fetch(t,{headers:{"User-Agent":e}}).then(n=>200===n.status?n.text():(r.sentryCaptureException("getFontForUA",`Unexpected status ${n.status}`,{url:t,UA:e}),""))}catch(n){return r.sentryCaptureException("getFontForUA","Error fetching font",{url:t,UA:e,error:n}),""}}const 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.googleFontFamilies),u=[...n.THEME_FONT_CSS_KEYS,...n.THEME_FONT_CSS_KEYS.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.checkNotInOptionFont(e.family,r);return!(i&&a)&&(i||!e.type||o)},h=t=>{let e=String(t).toLowerCase().trim();return c[e]??t},m=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=>h(t)),r=m(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 F(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.sentryCaptureException("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}const v=(t,r)=>{let n=[];return t.forEach(t=>{n.push(...e.getFontsFromDataBuilder(t.data,r))}),a(n)},S=(t,e)=>{let r="400";if(null!=t){let e=String(t).toLowerCase().trim();r=h(e)}let n=r,i=e&&"italic"===e.toLowerCase();return i&&!r.includes("italic")&&(n=r.includes("i")?r:`${r}italic`),n},w="heading-",x="subheading-",E="paragraph-",j=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(w)||t.startsWith(x)?r.heading?"heading":void 0:t.startsWith(E)&&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=S(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(w)||t.startsWith(x)?n.heading?"heading":void 0:t.startsWith(E)&&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},$=async(t,e)=>{if(!t)return"";try{let r=JSON.parse(t),n=r?.font??{},i=Object.values(n),o=j(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 F(l,void 0,void 0,e)}catch{return""}};async function k(t,e,r){let n,i=null;if(r)try{i=JSON.parse(r),n=O(i)}catch{}let o=v(t,n);if(!i){if(0===o.length)return[];let t=await F(o,void 0,void 0,e);return t?[t]:[]}let a=j(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 F(o,void 0,void 0,e);return p?[p]:[]}exports.composeFonts=a,exports.createFontUrls=b,exports.extractTypographyVariants=j,exports.getFontFromGlobalStyle=(t,e)=>{if(!t)return"";try{let r=JSON.parse(t),n=r?.font??{},i=Object.entries(n).map(([,t])=>t);return F(i,void 0,void 0,e)}catch{return""}},exports.getFontLinkFromGlobalStyle=$,exports.getFontStyleFromPageTemplate=k,exports.getFonts=F,exports.mapTypographyToFontFamily=O;
@@ -1 +1 @@
1
- "use strict";const 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,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)}}},i=t=>Array.from(new Set(t)),s=(e,l)=>{let s=l.custom?.fontFamily;"string"==typeof s&&(s={value:l.custom?.fontFamily||"",type:"google"});let o=s?.value;if(t.includes(o))return;let n=l.custom?.fontVariants;if(n?.length||(n=[l.custom?.fontWeight]),s&&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=i([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==o&&n.every(e=>t.variants.includes(e)));if(!a){let l=e.find(t=>t.family==o);l?n.forEach(t=>{l.variants.includes(t)||l.variants.push(t)}):("700"!==r&&t.includes("700")&&n.push("700"),e.push({family:o||"",variants:i(n),subsets:[],type:s.type}))}}}};exports.getFontFromGroupSetting=l,exports.getFontsFromDataBuilder=(t,e)=>{let i=[];for(let s in t)if(Object.prototype.hasOwnProperty.call(t,s)){let o=t[s],n=o.styles,r=o.settings;l(i,n,e),l(i,r,e)}return i};
1
+ "use strict";const 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,l,s)=>{let o=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let r in l)if(Object.prototype.hasOwnProperty.call(l,r)){let n=l[r];if(!n)continue;let a=s?e(n,s):n;for(let l of(i(t,a),o)){if(!n[l])continue;let o=s?e(n[l],s):n[l];i(t,o)}}},s=t=>Array.from(new Set(t)),i=(e,l)=>{let i=l.custom?.fontFamily;"string"==typeof i&&(i={value:l.custom?.fontFamily||"",type:"google"});let o=i?.value;if(t.includes(o))return;let r=l.custom?.fontVariants;if(r?.length||(r=[l.custom?.fontWeight]),i&&r?.length){let t=r.map(t=>"regular"===t?"400":t),n=l.custom?.fontWeight&&t.includes(l.custom?.fontWeight)?l.custom?.fontWeight:t[0];if(n){let r=s([n,...l?.attrs?.isAlwaysLoadBold?["700"]:[],...l?.attrs?.loadFontStyles?.includes("bold")?["700"]:[]]);if(l?.attrs?.loadFontStyles?.includes("italic")){let t=r.map(t=>"string"==typeof t&&/^\d+$/.test(t)?`${t}i`:null).filter(t=>null!==t);r.push(...t)}let a=e.find(t=>t.family==o&&r.every(e=>t.variants.includes(e)));if(!a){let l=e.find(t=>t.family==o);l?r.forEach(t=>{l.variants.includes(t)||l.variants.push(t)}):("700"!==n&&t.includes("700")&&r.push("700"),e.push({family:o||"",variants:s(r),subsets:[],type:i.type}))}}}};exports.extractImportUrls=t=>{let e=[...t.matchAll(/@import url\(['"]?([^'")\s]+)['"]?\)/g)];return e.map(t=>t[1]).filter(t=>!!t)},exports.getFontFromGroupSetting=l,exports.getFontsFromDataBuilder=(t,e)=>{let s=[];for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i)){let o=t[i],r=o.styles,n=o.settings;l(s,r,e),l(s,n,e)}return s};
@@ -1,5 +1,5 @@
1
- "use strict";var e=require("react/jsx-runtime"),s=require("@gem-sdk/core"),t=require("next-seo"),r=require("next/head"),a=require("next/router"),i=require("../libs/hooks/use-tracking-view.js"),n=require("../libs/parse-html.js"),l=require("../components/builder/Header.js"),o=require("../components/FooterForPostPurchase.js"),d=require("next/script"),c=require("react"),g=require("../libs/hooks/usePageViewedTracking.js");exports.StaticPageV2=({components:u,builderData:p,sectionData:m,seo:h,themeStyle:x,fontStyle:j,elementFontStyle:f,customCodeHeader:y,shopToken:_,pageHandle:v,customFonts:b,isPostPurchase:P,shopName:k,productOffers:q,publicStoreFrontData:S,dynamicDiscountOffer:T,isPreview:N,interaction:H,pageBackground:I,sellingPlanSetting:w,buyerConsentPreCheck:E,id:F,shopID:L,domainTrackingIlp:M})=>{let $=a.useRouter(),{t:A}=s.useI18n(),B=process.env.NEXT_GP_BASE_ASSET_URL||"https://assets.gemcommerce.xyz";i.useTrackingView(_,v,$.isFallback),g.usePageViewedTracking({id:F,shopID:L,domain:M});let C="custom-code-header";if(c.useEffect(()=>{let e=document.querySelectorAll(`[class*="${C}-"]`),s=[];e.length>1&&e.forEach(e=>{let t=e.className;if(s.includes(t)){e.remove();return}s.push(t)})},[]),$.isFallback)return e.jsx("div",{className:"gp-flex gp-h-[100vh] gp-items-center gp-justify-center",children:e.jsxs("div",{className:"gp-flex gp-gap-2",children:[e.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"}),e.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"}),e.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"})]})});let O=(H?.value||[]).length>0;return e.jsxs(e.Fragment,{children:[e.jsx(t.NextSeo,{...h}),e.jsxs(r,{children:[n.parseHtml(C,y,!0),x&&e.jsx("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:x}},"global-style"),j&&e.jsx("style",{"data-id":"google-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:j}},"google-fonts"),f&&f.map(s=>e.jsx("style",{"data-id":"google-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:s}},s)),b&&e.jsx("style",{"data-id":"custom-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:b}},j),I?.isUsePageBackground&&I?.background&&e.jsx("style",{children:`
1
+ "use strict";var e=require("react/jsx-runtime"),s=require("@gem-sdk/core"),r=require("next-seo"),t=require("next/head"),a=require("next/router"),n=require("../libs/hooks/use-tracking-view.js"),i=require("../libs/parse-html.js"),l=require("../components/builder/Header.js"),o=require("../components/FooterForPostPurchase.js"),d=require("next/script"),c=require("react"),u=require("../libs/hooks/usePageViewedTracking.js"),g=require("../components/FontLink.js");exports.StaticPageV2=({components:p,builderData:m,sectionData:h,seo:x,themeStyle:j,fontStyle:f,elementFontStyle:y,customCodeHeader:_,shopToken:v,pageHandle:b,customFonts:k,isPostPurchase:P,shopName:q,productOffers:S,publicStoreFrontData:N,dynamicDiscountOffer:T,isPreview:F,interaction:I,pageBackground:w,sellingPlanSetting:L,buyerConsentPreCheck:E,id:H,shopID:$,domainTrackingIlp:A})=>{let B=a.useRouter(),{t:C}=s.useI18n(),M=process.env.NEXT_GP_BASE_ASSET_URL||"https://assets.gemcommerce.xyz";n.useTrackingView(v,b,B.isFallback),u.usePageViewedTracking({id:H,shopID:$,domain:A});let O="custom-code-header";if(c.useEffect(()=>{let e=document.querySelectorAll(`[class*="${O}-"]`),s=[];e.length>1&&e.forEach(e=>{let r=e.className;if(s.includes(r)){e.remove();return}s.push(r)})},[]),B.isFallback)return e.jsx("div",{className:"gp-flex gp-h-[100vh] gp-items-center gp-justify-center",children:e.jsxs("div",{className:"gp-flex gp-gap-2",children:[e.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"}),e.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"}),e.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"})]})});let R=(I?.value||[]).length>0;return e.jsxs(e.Fragment,{children:[e.jsx(r.NextSeo,{...x}),e.jsxs(t,{children:[i.parseHtml(O,_,!0),j&&e.jsx("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:j}},"global-style"),k&&e.jsx("style",{"data-id":"custom-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:k}},f),w?.isUsePageBackground&&w?.background&&e.jsx("style",{children:`
2
2
  body {
3
- background: ${I.background};
3
+ background: ${w.background};
4
4
  }
5
- `},`page_background_${I?.background}`)]}),e.jsx(s.PageProvider,{productOffers:q,publicStoreFrontData:S,dynamicDiscountOffer:T,sellingPlanMeta:w,buyerConsentChecked:E,children:e.jsx(s.BuilderComponentProvider,{components:u,children:e.jsx(s.I18nProvider,{t:A,children:e.jsxs("div",{className:`${P?"gp-bg-white post-purchase-page":""} `,role:"main",children:[P&&e.jsx(l.default,{pageType:"POST_PURCHASE"}),O&&e.jsx("div",{dangerouslySetInnerHTML:{__html:`<div id="gp-interaction" style="display: none;">${JSON.stringify(H?.value||[])}</div>`}}),e.jsx(s.SectionProvider,{data:m,children:p?.map(t=>e.jsxs(s.BuilderProvider,{state:t.data,lazy:t.lazy,priority:t.priority,isPostPurchase:P,isPreview:N,children:[e.jsx(s.Render,{uid:t.uid}),O&&e.jsx(d,{defer:!0,src:`${B}/assets-v2/gp-flow-action-lip-v7-5.js`})]},t.uid))}),P&&e.jsx(o.default,{shopName:k||""})]})})})})]})};
5
+ `},`page_background_${w?.background}`)]}),f&&e.jsx(g.FontLink,{fontStyle:f,dataId:"google-fonts"}),y&&y.map((s,r)=>e.jsx(g.FontLink,{fontStyle:s,dataId:"google-element-fonts"},r)),e.jsx(s.PageProvider,{productOffers:S,publicStoreFrontData:N,dynamicDiscountOffer:T,sellingPlanMeta:L,buyerConsentChecked:E,children:e.jsx(s.BuilderComponentProvider,{components:p,children:e.jsx(s.I18nProvider,{t:C,children:e.jsxs("div",{className:`${P?"gp-bg-white post-purchase-page":""} `,role:"main",children:[P&&e.jsx(l.default,{pageType:"POST_PURCHASE"}),R&&e.jsx("div",{dangerouslySetInnerHTML:{__html:`<div id="gp-interaction" style="display: none;">${JSON.stringify(I?.value||[])}</div>`}}),e.jsx(s.SectionProvider,{data:h,children:m?.map(r=>e.jsxs(s.BuilderProvider,{state:r.data,lazy:r.lazy,priority:r.priority,isPostPurchase:P,isPreview:F,children:[e.jsx(s.Render,{uid:r.uid}),R&&e.jsx(d,{defer:!0,src:`${M}/assets-v2/gp-flow-action-lip-v7-5.js`})]},r.uid))}),P&&e.jsx(o.default,{shopName:q||""})]})})})})]})};
@@ -0,0 +1 @@
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 o=({fontStyle:o,dataId:s})=>{let n=l(o),i=o.replace(/@import url\(['"]?[^'")\s]+['"]?\);?/g,"").trim();return e(r,{children:[n.map(e=>t("link",{rel:"preload",as:"style",href:e,onLoad:"this.onload=null;this.rel='stylesheet'"},e)),i&&t("style",{"data-id":s,type:"text/css",dangerouslySetInnerHTML:{__html:i}})]})};export{o as FontLink};
@@ -1 +1 @@
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 l=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}})},a={"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",c=t=>{let e=s(t);return a[t]??a[e]},p={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,l=t(e.family,r);return!(i&&l)&&(i||!e.type||o)},m=t=>{let e=String(t).toLowerCase().trim();return p[e]??t},h=t=>{let e=t=>{let e=String(t).toLowerCase().trim(),r=e.includes("italic"),n=e.replace("italic","").trim(),i=p[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=l(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)),l=[],a=[];for(let t of o){let e=c(t.family);e&&"bunny"!==r?l.push(e):a.push(t)}let s=a.length?d(a,r||"google",e):void 0;return l.length&&s?[...l,s]:s?[s,...l]:l};async function v(t,e,n=!0,i){let l=t.filter(t=>!u.includes(t.family)),a=b(l,e,i),s=Array.isArray(a)?a:a?[a]:[];if(!s.length)return"";if(n)return s.map(t=>`@import url('${t}');`).join("");let c="",p="";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}`;c+=n,p+=`@import url('${t}');`}catch(n){let e=f(t);r("getFonts",`Error fetching font ${e}`,{url:t,fontType:i,fontApiVersion:e,error:String(n)}),p+="",c+=""}let y=new TextEncoder().encode(c).length;return y<51200?c:p}let F=(t,r)=>{let n=[];return t.forEach(t=>{n.push(...e(t.data,r))}),l(n)},w=(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,l=o?.fontFamily,a=l||i;["desktop","mobile","tablet"].forEach(t=>{let i=e[t];if(!i||"object"!=typeof i)return;let l=i.fontFamily||a;if(!l||"string"!=typeof l||!r[l])return;let s=i.fontWeight??o?.fontWeight,f=i.fontStyle??o?.fontStyle;if(null==s)return;let c=w(s,f);n.has(l)||n.set(l,new Set),n.get(l).add(c)})});let i={};return n.forEach((t,e)=>{let n=r[e];n&&(i[e]={variants:Array.from(t).sort(),family:n.family})}),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,l=e.mobile,a=e.tablet,s=t.startsWith(S)||t.startsWith(j)?n.heading?"heading":void 0:t.startsWith($)&&n.body?"body":void 0,f=o?.fontFamily||l?.fontFamily||a?.fontFamily||s;if(!f||"string"!=typeof f)return;let c=r[f],p=n[f],y=c?.family||p?.family||f,u=c?.type||p?.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 a=l(i);return v(a,void 0,void 0,e)}catch{return""}},I=(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 W(t,e,r){let n,i=null;if(r)try{i=JSON.parse(r),n=O(i)}catch{}let o=F(t,n);if(!i){if(0===o.length)return[];let t=await v(o,void 0,void 0,e);return t?[t]:[]}let l=k(i),a=new Map;for(let t of Object.values(l)){let e=a.get(t.family);if(!e){a.set(t.family,new Set(t.variants));continue}t.variants.forEach(t=>e.add(t))}if(0===(o=o.map(t=>{let e=a.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 s=await v(o,void 0,void 0,e);return s?[s]:[]}export{l as composeFonts,b as createFontUrls,k as extractTypographyVariants,I as getFontFromGlobalStyle,x as getFontLinkFromGlobalStyle,W 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 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 +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 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
+ 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,5 +1,5 @@
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:`
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 o,SectionProvider as i,BuilderProvider as l,Render as p}from"@gem-sdk/core";import{NextSeo as m}from"next-seo";import c 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 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:q,dynamicDiscountOffer:A,isPreview:M,interaction:O,pageBackground:z,sellingPlanSetting:C,buyerConsentPreCheck:D,id:U,shopID:B,domainTrackingIlp:R})=>{let V=d(),{t:G}=a(),J=process.env.NEXT_GP_BASE_ASSET_URL||"https://assets.gemcommerce.xyz";g(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=(O?.value||[]).length>0;return t(s,{children:[e(m,{...x}),t(c,{children:[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:`
2
2
  body {
3
- background: ${O.background};
3
+ background: ${z.background};
4
4
  }
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};
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(r,{productOffers:L,publicStoreFrontData:q,dynamicDiscountOffer:A,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(O?.value||[])}</div>`}}),e(i,{data:P,children:S?.map(s=>t(l,{state:s.data,lazy:s.lazy,priority:s.priority,isPostPurchase:E,isPreview:M,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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "17.0.0-dev.38",
3
+ "version": "17.0.0-dev.55",
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.38",
30
+ "@gem-sdk/core": "17.0.0-dev.50",
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"