@gem-sdk/pages 17.0.0-staging.18 → 17.0.1
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/libs/helpers/gen-fonts.js +1 -1
- package/dist/cjs/pages/static-v2.js +2 -2
- package/dist/esm/libs/helpers/gen-fonts.js +1 -1
- package/dist/esm/pages/static-v2.js +3 -3
- package/package.json +5 -5
- package/dist/cjs/components/FontLink.js +0 -1
- package/dist/esm/components/FontLink.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const EXCLUDED_FONT_FAMILIES=["sans-serif"],getFallbackFontFamilyFromGlobalStyle=(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},getFontsFromDataBuilder=(t,e)=>{let l=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let
|
|
1
|
+
"use strict";const EXCLUDED_FONT_FAMILIES=["sans-serif"],getFallbackFontFamilyFromGlobalStyle=(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},getFontsFromDataBuilder=(t,e)=>{let l=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let i=t[o],n=i.styles,r=i.settings;getFontFromGroupSetting(l,n,e),getFontFromGroupSetting(l,r,e)}return l},getFontFromGroupSetting=(t,e,l)=>{let o=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let n=e[i];if(!n)continue;let r=l?getFallbackFontFamilyFromGlobalStyle(n,l):n;for(let e of(getFontValue(t,r),o)){if(!n[e])continue;let o=l?getFallbackFontFamilyFromGlobalStyle(n[e],l):n[e];getFontValue(t,o)}}},uniqueArray=t=>Array.from(new Set(t)),getFontValue=(t,e)=>{let l=e.custom?.fontFamily;"string"==typeof l&&(l={value:e.custom?.fontFamily||"",type:"google"});let o=l?.value;if(EXCLUDED_FONT_FAMILIES.includes(o))return;let i=e.custom?.fontVariants;if(i?.length||(i=[e.custom?.fontWeight]),l&&i?.length){let n=i.map(t=>"regular"===t?"400":t),r=e.custom?.fontWeight&&n.includes(e.custom?.fontWeight)?e.custom?.fontWeight:n[0];if(r){let i=uniqueArray([r,...e?.attrs?.isAlwaysLoadBold?["700"]:[],...e?.attrs?.loadFontStyles?.includes("bold")?["700"]:[]]);if(e?.attrs?.loadFontStyles?.includes("italic")){let t=i.map(t=>"string"==typeof t&&/^\d+$/.test(t)?`${t}i`:null).filter(t=>null!==t);i.push(...t)}let a=t.find(t=>t.family==o&&i.every(e=>t.variants.includes(e)));if(!a){let e=t.find(t=>t.family==o);e?i.forEach(t=>{e.variants.includes(t)||e.variants.push(t)}):("700"!==r&&n.includes("700")&&i.push("700"),t.push({family:o||"",variants:uniqueArray(i),subsets:[],type:l.type}))}}}};exports.getFontFromGroupSetting=getFontFromGroupSetting,exports.getFontsFromDataBuilder=getFontsFromDataBuilder;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),nextSeo=require("next-seo"),Head=require("next/head"),router=require("next/router"),useTrackingView=require("../libs/hooks/use-tracking-view.js"),parseHtml=require("../libs/parse-html.js"),Header=require("../components/builder/Header.js"),FooterForPostPurchase=require("../components/FooterForPostPurchase.js"),Script=require("next/script"),react=require("react"),usePageViewedTracking=require("../libs/hooks/usePageViewedTracking.js")
|
|
1
|
+
"use strict";var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),nextSeo=require("next-seo"),Head=require("next/head"),router=require("next/router"),useTrackingView=require("../libs/hooks/use-tracking-view.js"),parseHtml=require("../libs/parse-html.js"),Header=require("../components/builder/Header.js"),FooterForPostPurchase=require("../components/FooterForPostPurchase.js"),Script=require("next/script"),react=require("react"),usePageViewedTracking=require("../libs/hooks/usePageViewedTracking.js");const StaticPageV2=({components:e,builderData:s,sectionData:t,seo:r,themeStyle:i,fontStyle:a,elementFontStyle:n,customCodeHeader:u,shopToken:l,pageHandle:o,customFonts:c,isPostPurchase:d,shopName:g,productOffers:m,publicStoreFrontData:p,dynamicDiscountOffer:x,isPreview:j,interaction:h,pageBackground:f,sellingPlanSetting:y,buyerConsentPreCheck:R,id:_,shopID:P,domainTrackingIlp:S})=>{let v=router.useRouter(),{t:b}=core.useI18n(),k=process.env.NEXT_GP_BASE_ASSET_URL||"https://assets.gemcommerce.xyz";useTrackingView.useTrackingView(l,o,v.isFallback),usePageViewedTracking.usePageViewedTracking({id:_,shopID:P,domain:S});let q="custom-code-header";if(react.useEffect(()=>{let e=document.querySelectorAll(`[class*="${q}-"]`),s=[];e.length>1&&e.forEach(e=>{let t=e.className;if(s.includes(t)){e.remove();return}s.push(t)})},[]),v.isFallback)return jsxRuntime.jsx("div",{className:"gp-flex gp-h-[100vh] gp-items-center gp-justify-center",children:jsxRuntime.jsxs("div",{className:"gp-flex gp-gap-2",children:[jsxRuntime.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"}),jsxRuntime.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"}),jsxRuntime.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"})]})});let T=(h?.value||[]).length>0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(nextSeo.NextSeo,{...r}),jsxRuntime.jsxs(Head,{children:[parseHtml.parseHtml(q,u,!0),i&&jsxRuntime.jsx("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:i}},"global-style"),a&&jsxRuntime.jsx("style",{"data-id":"google-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:a}},"google-fonts"),n&&n.map(e=>jsxRuntime.jsx("style",{"data-id":"google-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:e}},e)),c&&jsxRuntime.jsx("style",{"data-id":"custom-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:c}},a),f?.isUsePageBackground&&f?.background&&jsxRuntime.jsx("style",{children:`
|
|
2
2
|
body {
|
|
3
3
|
background: ${f.background};
|
|
4
4
|
}
|
|
5
|
-
`},`page_background_${f?.background}`)]}),
|
|
5
|
+
`},`page_background_${f?.background}`)]}),jsxRuntime.jsx(core.PageProvider,{productOffers:m,publicStoreFrontData:p,dynamicDiscountOffer:x,sellingPlanMeta:y,buyerConsentChecked:R,children:jsxRuntime.jsx(core.BuilderComponentProvider,{components:e,children:jsxRuntime.jsx(core.I18nProvider,{t:b,children:jsxRuntime.jsxs("div",{className:`${d?"gp-bg-white post-purchase-page":""} `,role:"main",children:[d&&jsxRuntime.jsx(Header.default,{pageType:"POST_PURCHASE"}),T&&jsxRuntime.jsx("div",{dangerouslySetInnerHTML:{__html:`<div id="gp-interaction" style="display: none;">${JSON.stringify(h?.value||[])}</div>`}}),jsxRuntime.jsx(core.SectionProvider,{data:t,children:s?.map(e=>jsxRuntime.jsxs(core.BuilderProvider,{state:e.data,lazy:e.lazy,priority:e.priority,isPostPurchase:d,isPreview:j,children:[jsxRuntime.jsx(core.Render,{uid:e.uid}),T&&jsxRuntime.jsx(Script,{defer:!0,src:`${k}/assets-v2/gp-flow-action-lip-v7-5.js`})]},e.uid))}),d&&jsxRuntime.jsx(FooterForPostPurchase.default,{shopName:g||""})]})})})})]})};exports.StaticPageV2=StaticPageV2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let EXCLUDED_FONT_FAMILIES=["sans-serif"],getFallbackFontFamilyFromGlobalStyle=(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},getFontsFromDataBuilder=(t,e)=>{let l=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let
|
|
1
|
+
let EXCLUDED_FONT_FAMILIES=["sans-serif"],getFallbackFontFamilyFromGlobalStyle=(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},getFontsFromDataBuilder=(t,e)=>{let l=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let i=t[o],n=i.styles,a=i.settings;getFontFromGroupSetting(l,n,e),getFontFromGroupSetting(l,a,e)}return l},getFontFromGroupSetting=(t,e,l)=>{let o=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let n=e[i];if(!n)continue;let a=l?getFallbackFontFamilyFromGlobalStyle(n,l):n;for(let e of(getFontValue(t,a),o)){if(!n[e])continue;let o=l?getFallbackFontFamilyFromGlobalStyle(n[e],l):n[e];getFontValue(t,o)}}},uniqueArray=t=>Array.from(new Set(t)),getFontValue=(t,e)=>{let l=e.custom?.fontFamily;"string"==typeof l&&(l={value:e.custom?.fontFamily||"",type:"google"});let o=l?.value;if(EXCLUDED_FONT_FAMILIES.includes(o))return;let i=e.custom?.fontVariants;if(i?.length||(i=[e.custom?.fontWeight]),l&&i?.length){let n=i.map(t=>"regular"===t?"400":t),a=e.custom?.fontWeight&&n.includes(e.custom?.fontWeight)?e.custom?.fontWeight:n[0];if(a){let i=uniqueArray([a,...e?.attrs?.isAlwaysLoadBold?["700"]:[],...e?.attrs?.loadFontStyles?.includes("bold")?["700"]:[]]);if(e?.attrs?.loadFontStyles?.includes("italic")){let t=i.map(t=>"string"==typeof t&&/^\d+$/.test(t)?`${t}i`:null).filter(t=>null!==t);i.push(...t)}let r=t.find(t=>t.family==o&&i.every(e=>t.variants.includes(e)));if(!r){let e=t.find(t=>t.family==o);e?i.forEach(t=>{e.variants.includes(t)||e.variants.push(t)}):("700"!==a&&n.includes("700")&&i.push("700"),t.push({family:o||"",variants:uniqueArray(i),subsets:[],type:l.type}))}}}};export{getFontFromGroupSetting,getFontsFromDataBuilder};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment 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 l,SectionProvider as i,BuilderProvider as o,Render as p}from"@gem-sdk/core";import{NextSeo as c}from"next-seo";import g from"next/head";import{useRouter as m}from"next/router";import{useTrackingView as d}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 StaticPageV2=({components:v,builderData:S,sectionData:k,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:V})=>{let B=m(),{t:R}=a(),G=process.env.NEXT_GP_BASE_ASSET_URL||"https://assets.gemcommerce.xyz";d(H,I,B.isFallback),b({id:D,shopID:U,domain:V});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)})},[]),B.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(g,{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: ${
|
|
3
|
+
background: ${O.background};
|
|
4
4
|
}
|
|
5
|
-
`},`page_background_${
|
|
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:R,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(i,{data:k,children:S?.map(s=>t(o,{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{StaticPageV2};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/pages",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"next": "14.2.35"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@gem-sdk/core": "
|
|
31
|
-
"@gem-sdk/plugin-cookie-bar": "16.
|
|
32
|
-
"@gem-sdk/plugin-quick-view": "16.
|
|
33
|
-
"@gem-sdk/plugin-sticky-add-to-cart": "16.
|
|
30
|
+
"@gem-sdk/core": "16.3.4",
|
|
31
|
+
"@gem-sdk/plugin-cookie-bar": "16.0.0",
|
|
32
|
+
"@gem-sdk/plugin-quick-view": "16.0.0",
|
|
33
|
+
"@gem-sdk/plugin-sticky-add-to-cart": "16.0.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"next": "14.2.35"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var jsxRuntime=require("react/jsx-runtime"),Head=require("next/head"),genFonts=require("../libs/helpers/gen-fonts.js");const FontLink=({fontStyle:e,dataId:t})=>{let s=genFonts.extractImportUrls(e),n=e.replace(/@import url\(['"]?[^'")\s]+['"]?\);?/g,"").trim();return jsxRuntime.jsxs(Head,{children:[s.map(e=>jsxRuntime.jsx("link",{rel:"preload",as:"style",href:e,onLoad:"this.onload=null;this.rel='stylesheet'"},e)),n&&jsxRuntime.jsx("style",{"data-id":t,type:"text/css",dangerouslySetInnerHTML:{__html:n}})]})};exports.FontLink=FontLink;
|
|
@@ -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 FontLink=({fontStyle:n,dataId:o})=>{let s=l(n),i=n.replace(/@import url\(['"]?[^'")\s]+['"]?\);?/g,"").trim();return e(r,{children:[s.map(e=>t("link",{rel:"preload",as:"style",href:e,onLoad:"this.onload=null;this.rel='stylesheet'"},e)),i&&t("style",{"data-id":o,type:"text/css",dangerouslySetInnerHTML:{__html:i}})]})};export{FontLink};
|