@gem-sdk/pages 3.0.0 → 3.0.14

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
- "use strict";var jsxRuntime=require("react/jsx-runtime"),parse=require("html-react-parser");const parseHtml=(e,r,t)=>{if(r)try{return parse(r,{replace:r=>{if("script"!==r.type||!(r instanceof parse.Element))return null;let s=r.children?.[0];return s?s instanceof parse.Text||t?s instanceof parse.Text&&t?jsxRuntime.jsx("script",{id:e,...r.attribs,dangerouslySetInnerHTML:{__html:s.data}},e):void 0:jsxRuntime.jsx("script",{id:e,...r.attribs},e):null}})}catch{return}};exports.parseHtml=parseHtml;
1
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),parse=require("html-react-parser");const parseHtml=(e,r,t)=>{if(!r)return;let s=0;try{return parse(r,{replace:r=>{if("script"!==r.type||!(r instanceof parse.Element))return null;let a=r.children?.[0];if(!a)return null;let n=`${e}-${s++}`;return a instanceof parse.Text||t?a instanceof parse.Text&&t?jsxRuntime.jsx("script",{className:n,...r.attribs,dangerouslySetInnerHTML:{__html:a.data}},n):void 0:jsxRuntime.jsx("script",{className:n,...r.attribs},n)}})}catch{return}};exports.parseHtml=parseHtml;
@@ -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");const StaticPageV2=({components:e,builderData:s,sectionData:t,seo:r,themeStyle:i,fontStyle:n,elementFontStyle:a,customCodeHeader:o,shopToken:u,pageHandle:l,customFonts:c,isPostPurchase:d,shopName:m,productOffers:g,publicStoreFrontData:x,dynamicDiscountOffer:p,isPreview:j,interaction:h,pageBackground:R})=>{let f=router.useRouter(),{t:y}=core.useI18n(),_=process.env.NEXT_GP_BASE_ASSET_URL||"https://assets.gemcommerce.xyz";useTrackingView.useTrackingView(u,l,f.isFallback);let P="custom-code-header";if(react.useEffect(()=>{let e=document.querySelectorAll(`#${P}`);e.length>1&&e.forEach((e,s)=>{0!==s&&e.remove()})},[]),f.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 S=(h?.value||[]).length>0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(nextSeo.NextSeo,{...r}),jsxRuntime.jsxs(Head,{children:[parseHtml.parseHtml(P,o,!0),i&&jsxRuntime.jsx("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:i}},"global-style"),n&&jsxRuntime.jsx("style",{"data-id":"google-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:n}},"google-fonts"),a&&a.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}},n),R?.isUsePageBackground&&R?.background&&jsxRuntime.jsx("style",{children:`
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");const StaticPageV2=({components:e,builderData:s,sectionData:t,seo:r,themeStyle:i,fontStyle:n,elementFontStyle:a,customCodeHeader:l,shopToken:u,pageHandle:o,customFonts:c,isPostPurchase:d,shopName:m,productOffers:g,publicStoreFrontData:x,dynamicDiscountOffer:p,isPreview:j,interaction:h,pageBackground:f})=>{let R=router.useRouter(),{t:y}=core.useI18n(),_=process.env.NEXT_GP_BASE_ASSET_URL||"https://assets.gemcommerce.xyz";useTrackingView.useTrackingView(u,o,R.isFallback);let P="custom-code-header";if(react.useEffect(()=>{let e=document.querySelectorAll(`[class*="${P}-"]`),s=[];e.length>1&&e.forEach(e=>{let t=e.className;if(s.includes(t)){e.remove();return}s.push(t)})},[]),R.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 S=(h?.value||[]).length>0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(nextSeo.NextSeo,{...r}),jsxRuntime.jsxs(Head,{children:[parseHtml.parseHtml(P,l,!0),i&&jsxRuntime.jsx("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:i}},"global-style"),n&&jsxRuntime.jsx("style",{"data-id":"google-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:n}},"google-fonts"),a&&a.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}},n),f?.isUsePageBackground&&f?.background&&jsxRuntime.jsx("style",{children:`
2
2
  body {
3
- background: ${R.background};
3
+ background: ${f.background};
4
4
  }
5
- `},`page_background_${R?.background}`)]}),jsxRuntime.jsx(core.PageProvider,{productOffers:g,publicStoreFrontData:x,dynamicDiscountOffer:p,children:jsxRuntime.jsx(core.BuilderComponentProvider,{components:e,children:jsxRuntime.jsxs("div",{className:`${d?"gp-bg-white post-purchase-page":""} `,children:[d&&jsxRuntime.jsx(Header.default,{pageType:"POST_PURCHASE"}),S&&jsxRuntime.jsx("div",{dangerouslySetInnerHTML:{__html:`<div id="gp-interaction" style="display: none;">${JSON.stringify(h?.value||[])}</div>`}}),jsxRuntime.jsx(core.SectionProvider,{data:t,children:jsxRuntime.jsx(core.I18nProvider,{t:y,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}),S&&jsxRuntime.jsx(Script,{defer:!0,src:`${_}/assets-v2/gp-flow-action-lip-v7-5.js`})]},e.uid))})}),d&&jsxRuntime.jsx(FooterForPostPurchase.default,{shopName:m||""})]})})})]})};exports.StaticPageV2=StaticPageV2;
5
+ `},`page_background_${f?.background}`)]}),jsxRuntime.jsx(core.PageProvider,{productOffers:g,publicStoreFrontData:x,dynamicDiscountOffer:p,children:jsxRuntime.jsx(core.BuilderComponentProvider,{components:e,children:jsxRuntime.jsxs("div",{className:`${d?"gp-bg-white post-purchase-page":""} `,children:[d&&jsxRuntime.jsx(Header.default,{pageType:"POST_PURCHASE"}),S&&jsxRuntime.jsx("div",{dangerouslySetInnerHTML:{__html:`<div id="gp-interaction" style="display: none;">${JSON.stringify(h?.value||[])}</div>`}}),jsxRuntime.jsx(core.SectionProvider,{data:t,children:jsxRuntime.jsx(core.I18nProvider,{t:y,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}),S&&jsxRuntime.jsx(Script,{defer:!0,src:`${_}/assets-v2/gp-flow-action-lip-v7-5.js`})]},e.uid))})}),d&&jsxRuntime.jsx(FooterForPostPurchase.default,{shopName:m||""})]})})})]})};exports.StaticPageV2=StaticPageV2;
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import r,{Element as e,Text as i}from"html-react-parser";let parseHtml=(n,a,l)=>{if(a)try{return r(a,{replace:r=>{if("script"!==r.type||!(r instanceof e))return null;let a=r.children?.[0];return a?a instanceof i||l?a instanceof i&&l?t("script",{id:n,...r.attribs,dangerouslySetInnerHTML:{__html:a.data}},n):void 0:t("script",{id:n,...r.attribs},n):null}})}catch{return}};export{parseHtml};
1
+ import{jsx as t}from"react/jsx-runtime";import r,{Element as e,Text as a}from"html-react-parser";let parseHtml=(n,l,s)=>{if(!l)return;let i=0;try{return r(l,{replace:r=>{if("script"!==r.type||!(r instanceof e))return null;let l=r.children?.[0];if(!l)return null;let c=`${n}-${i++}`;return l instanceof a||s?l instanceof a&&s?t("script",{className:c,...r.attribs,dangerouslySetInnerHTML:{__html:l.data}},c):void 0:t("script",{className:c,...r.attribs},c)}})}catch{return}};export{parseHtml};
@@ -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,SectionProvider as l,I18nProvider as o,BuilderProvider as i,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";let StaticPageV2=({components:b,builderData:v,sectionData:S,seo:x,themeStyle:k,fontStyle:P,elementFontStyle:N,customCodeHeader:T,shopToken:j,pageHandle:H,customFonts:L,isPostPurchase:$,shopName:E,productOffers:F,publicStoreFrontData:I,dynamicDiscountOffer:M,isPreview:q,interaction:w,pageBackground:A})=>{let O=m(),{t:z}=a(),U=process.env.NEXT_GP_BASE_ASSET_URL||"https://assets.gemcommerce.xyz";d(j,H,O.isFallback);let B="custom-code-header";if(_(()=>{let e=document.querySelectorAll(`#${B}`);e.length>1&&e.forEach((e,t)=>{0!==t&&e.remove()})},[]),O.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 D=(w?.value||[]).length>0;return t(s,{children:[e(c,{...x}),t(g,{children:[u(B,T,!0),k&&e("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:k}},"global-style"),P&&e("style",{"data-id":"google-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:P}},"google-fonts"),N&&N.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}},P),A?.isUsePageBackground&&A?.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 l,SectionProvider as n,I18nProvider 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";let StaticPageV2=({components:b,builderData:v,sectionData:S,seo:x,themeStyle:k,fontStyle:P,elementFontStyle:N,customCodeHeader:T,shopToken:j,pageHandle:H,customFonts:L,isPostPurchase:$,shopName:E,productOffers:F,publicStoreFrontData:I,dynamicDiscountOffer:M,isPreview:q,interaction:w,pageBackground:A})=>{let O=m(),{t:z}=a(),U=process.env.NEXT_GP_BASE_ASSET_URL||"https://assets.gemcommerce.xyz";d(j,H,O.isFallback);let B="custom-code-header";if(_(()=>{let e=document.querySelectorAll(`[class*="${B}-"]`),t=[];e.length>1&&e.forEach(e=>{let s=e.className;if(t.includes(s)){e.remove();return}t.push(s)})},[]),O.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 D=(w?.value||[]).length>0;return t(s,{children:[e(c,{...x}),t(g,{children:[u(B,T,!0),k&&e("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:k}},"global-style"),P&&e("style",{"data-id":"google-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:P}},"google-fonts"),N&&N.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}},P),A?.isUsePageBackground&&A?.background&&e("style",{children:`
2
2
  body {
3
3
  background: ${A.background};
4
4
  }
5
- `},`page_background_${A?.background}`)]}),e(r,{productOffers:F,publicStoreFrontData:I,dynamicDiscountOffer:M,children:e(n,{components:b,children:t("div",{className:`${$?"gp-bg-white post-purchase-page":""} `,children:[$&&e(h,{pageType:"POST_PURCHASE"}),D&&e("div",{dangerouslySetInnerHTML:{__html:`<div id="gp-interaction" style="display: none;">${JSON.stringify(w?.value||[])}</div>`}}),e(l,{data:S,children:e(o,{t:z,children:v?.map(s=>t(i,{state:s.data,lazy:s.lazy,priority:s.priority,isPostPurchase:$,isPreview:q,children:[e(p,{uid:s.uid}),D&&e(y,{defer:!0,src:`${U}/assets-v2/gp-flow-action-lip-v7-5.js`})]},s.uid))})}),$&&e(f,{shopName:E||""})]})})})]})};export{StaticPageV2};
5
+ `},`page_background_${A?.background}`)]}),e(r,{productOffers:F,publicStoreFrontData:I,dynamicDiscountOffer:M,children:e(l,{components:b,children:t("div",{className:`${$?"gp-bg-white post-purchase-page":""} `,children:[$&&e(h,{pageType:"POST_PURCHASE"}),D&&e("div",{dangerouslySetInnerHTML:{__html:`<div id="gp-interaction" style="display: none;">${JSON.stringify(w?.value||[])}</div>`}}),e(n,{data:S,children:e(i,{t:z,children:v?.map(s=>t(o,{state:s.data,lazy:s.lazy,priority:s.priority,isPostPurchase:$,isPreview:q,children:[e(p,{uid:s.uid}),D&&e(y,{defer:!0,src:`${U}/assets-v2/gp-flow-action-lip-v7-5.js`})]},s.uid))})}),$&&e(f,{shopName:E||""})]})})})]})};export{StaticPageV2};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "3.0.0",
3
+ "version": "3.0.14",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -26,7 +26,7 @@
26
26
  "next": "14.2.20"
27
27
  },
28
28
  "devDependencies": {
29
- "@gem-sdk/core": "3.0.0",
29
+ "@gem-sdk/core": "3.0.6",
30
30
  "@gem-sdk/plugin-cookie-bar": "3.0.0",
31
31
  "@gem-sdk/plugin-quick-view": "3.0.0",
32
32
  "@gem-sdk/plugin-sticky-add-to-cart": "3.0.0"