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

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 @@
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.65",
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.63",
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};