@gem-sdk/pages 17.0.0-dev.51 → 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.
- package/dist/cjs/components/FontLink.js +1 -0
- package/dist/cjs/libs/helpers/gen-fonts.js +1 -1
- package/dist/cjs/pages/static-v2.js +3 -3
- package/dist/esm/components/FontLink.js +1 -0
- package/dist/esm/libs/helpers/gen-fonts.js +1 -1
- package/dist/esm/pages/static-v2.js +3 -3
- package/package.json +1 -1
|
@@ -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";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,
|
|
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"),
|
|
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: ${
|
|
3
|
+
background: ${w.background};
|
|
4
4
|
}
|
|
5
|
-
`},`page_background_${
|
|
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
|
-
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
|
|
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
|
|
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: ${
|
|
3
|
+
background: ${z.background};
|
|
4
4
|
}
|
|
5
|
-
`},`page_background_${
|
|
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};
|