@gem-sdk/pages 2.0.0-dev.1175 → 2.0.0-dev.1183
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/FacebookPixel.js +1 -1
- package/dist/cjs/libs/api/get-share-page-props.js +1 -1
- package/dist/cjs/pages/preview-template.js +3 -3
- package/dist/esm/components/FacebookPixel.js +1 -1
- package/dist/esm/libs/api/get-share-page-props.js +1 -1
- package/dist/esm/pages/preview-template.js +3 -3
- package/dist/types/index.d.ts +7 -1
- package/package.json +1 -1
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
t.src=v;s=b.getElementsByTagName(e)[0];
|
|
9
9
|
s.parentNode.insertBefore(t,s)}(window, document,'script',
|
|
10
10
|
'https://connect.facebook.net/en_US/fbevents.js');
|
|
11
|
-
fbq('init', ${e});
|
|
11
|
+
fbq('init', '${e}');
|
|
12
12
|
fbq('track', 'PageView');
|
|
13
13
|
`}}):null};exports.FacebookPixel=FacebookPixel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var nextjs=require("@sentry/nextjs"),normalize=require("../helpers/normalize.js"),parseJson=require("../helpers/parse-json.js"),genCss=require("../helpers/gen-css.js"),googleFonts=require("../google-fonts.js"),customFonts=require("../custom-fonts.js");const getSharePageProps=e=>async t=>{try{let{sharedPage:s,customFonts:o,products:r,collections:
|
|
1
|
+
"use strict";var nextjs=require("@sentry/nextjs"),normalize=require("../helpers/normalize.js"),parseJson=require("../helpers/parse-json.js"),genCss=require("../helpers/gen-css.js"),googleFonts=require("../google-fonts.js"),customFonts=require("../custom-fonts.js");const getSharePageProps=e=>async t=>{try{let{sharedPage:s,customFonts:o,products:r,collections:a,articles:n}=await e([t]);if(!s)return null;let{page:l,themeStyle:i,share:u,pageMeta:m,shopMeta:g}=s,{sectionPosition:p}=l,h=normalize.parseBuilderTemplateV2({...s,sectionPosition:p}),[c,F,y]=await Promise.all([googleFonts.getFontStyleFromPageTemplate(h),googleFonts.getFontFromGlobalStyle(i?.data),customFonts.getCustomFonts(o)]),j=u?.thumbnails?Array.isArray(u.thumbnails)?u.thumbnails.map(e=>({url:e})):"string"==typeof u.thumbnails?[{url:u.thumbnails}]:[]:[],b={defaultTitle:g?.shop?.name??"",title:u?.title,openGraph:{site_name:g?.shop?.name??"",locale:g?.localization?.country?.isoCode??"",title:u?.title??g?.shop?.name??"",images:j},nofollow:!0,noindex:!0};return parseJson.serializableJson({seo:b,builderData:h,page:l,themeStyle:genCss.genCSS(i?.data,!1),share:u,pageMeta:m,shopMeta:g,products:r,collections:a,articles:n,elementFontStyle:c,fontStyle:F,customFonts:y})}catch(e){return nextjs.captureException(e),null}};exports.getSharePageProps=getSharePageProps;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),
|
|
1
|
+
"use strict";var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),Head=require("next/head"),router=require("next/router"),parseHtml=require("../libs/parse-html.js"),react=require("react");const PreviewTemplate=({components:e,builderData:s,sectionData:t,themeStyle:r,fontStyle:n,elementFontStyle:a,customCodeHeader:i,customFonts:l,products:u,collections:c,articles:o,pageBackground:m,publicStoreFrontData:d})=>{let g=router.useRouter(),{t:x}=core.useI18n(),p="custom-code-header";return(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)})},[]),g.isFallback)?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"})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Head,{children:[parseHtml.parseHtml(p,i,!0),r&&jsxRuntime.jsx("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:r}},"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)),l&&jsxRuntime.jsx("style",{"data-id":"custom-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:l}},n),m?.isUsePageBackground&&m?.background&&jsxRuntime.jsx("style",{children:`
|
|
2
2
|
body {
|
|
3
|
-
background: ${
|
|
3
|
+
background: ${m.background};
|
|
4
4
|
}
|
|
5
|
-
`},`page_background_${
|
|
5
|
+
`},`page_background_${m?.background}`)]}),jsxRuntime.jsx(core.PageProvider,{products:u,collections:c,articles:o,publicStoreFrontData:d,children:jsxRuntime.jsx(core.BuilderComponentProvider,{components:e,children:jsxRuntime.jsx("div",{children:jsxRuntime.jsx(core.SectionProvider,{data:t,children:jsxRuntime.jsx(core.I18nProvider,{t:x,children:s?.map(e=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(core.BuilderProvider,{state:e.data,lazy:e.lazy,priority:e.priority,isPreview:!0,children:jsxRuntime.jsx(core.Render,{uid:e.uid})},e.uid)}))})})})})})]})};exports.PreviewTemplate=PreviewTemplate;
|
|
@@ -8,6 +8,6 @@ import{jsx as e}from"react/jsx-runtime";import{fpixel as t}from"@gem-sdk/core";i
|
|
|
8
8
|
t.src=v;s=b.getElementsByTagName(e)[0];
|
|
9
9
|
s.parentNode.insertBefore(t,s)}(window, document,'script',
|
|
10
10
|
'https://connect.facebook.net/en_US/fbevents.js');
|
|
11
|
-
fbq('init', ${i});
|
|
11
|
+
fbq('init', '${i}');
|
|
12
12
|
fbq('track', 'PageView');
|
|
13
13
|
`}}):null};export{FacebookPixel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{captureException as
|
|
1
|
+
import{captureException as t}from"@sentry/nextjs";import{parseBuilderTemplateV2 as e}from"../helpers/normalize.js";import{serializableJson as r}from"../helpers/parse-json.js";import{genCSS as o}from"../helpers/gen-css.js";import{getFontStyleFromPageTemplate as a,getFontFromGlobalStyle as s}from"../google-fonts.js";import{getCustomFonts as l}from"../custom-fonts.js";let getSharePageProps=i=>async n=>{try{let{sharedPage:t,customFonts:m,products:p,collections:u,articles:h}=await i([n]);if(!t)return null;let{page:f,themeStyle:c,share:g,pageMeta:y,shopMeta:j}=t,{sectionPosition:b}=f,d=e({...t,sectionPosition:b}),[P,w,x]=await Promise.all([a(d),s(c?.data),l(m)]),S=g?.thumbnails?Array.isArray(g.thumbnails)?g.thumbnails.map(t=>({url:t})):"string"==typeof g.thumbnails?[{url:g.thumbnails}]:[]:[],z={defaultTitle:j?.shop?.name??"",title:g?.title,openGraph:{site_name:j?.shop?.name??"",locale:j?.localization?.country?.isoCode??"",title:g?.title??j?.shop?.name??"",images:S},nofollow:!0,noindex:!0};return r({seo:z,builderData:d,page:f,themeStyle:o(c?.data,!1),share:g,pageMeta:y,shopMeta:j,products:p,collections:u,articles:h,elementFontStyle:P,fontStyle:w,customFonts:x})}catch(e){return t(e),null}};export{getSharePageProps};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{useI18n as l,PageProvider as r,BuilderComponentProvider as s,SectionProvider as n,I18nProvider as i,BuilderProvider as o,Render as d}from"@gem-sdk/core";import
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{useI18n as l,PageProvider as r,BuilderComponentProvider as s,SectionProvider as n,I18nProvider as i,BuilderProvider as o,Render as d}from"@gem-sdk/core";import c from"next/head";import{useRouter as p}from"next/router";import{parseHtml as g}from"../libs/parse-html.js";import{useEffect as m}from"react";let PreviewTemplate=({components:u,builderData:h,sectionData:f,themeStyle:y,fontStyle:_,elementFontStyle:b,customCodeHeader:x,customFonts:k,products:v,collections:N,articles:S,pageBackground:T,publicStoreFrontData:q})=>{let H=p(),{t:I}=l(),L="custom-code-header";return(m(()=>{let e=document.querySelectorAll(`[class*="${L}-"]`),t=[];e.length>1&&e.forEach(e=>{let a=e.className;if(t.includes(a)){e.remove();return}t.push(a)})},[]),H.isFallback)?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"})]})}):t(a,{children:[t(c,{children:[g(L,x,!0),y&&e("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:y}},"global-style"),_&&e("style",{"data-id":"google-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:_}},"google-fonts"),b&&b.map(t=>e("style",{"data-id":"google-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:t}},t)),k&&e("style",{"data-id":"custom-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:k}},_),T?.isUsePageBackground&&T?.background&&e("style",{children:`
|
|
2
2
|
body {
|
|
3
|
-
background: ${
|
|
3
|
+
background: ${T.background};
|
|
4
4
|
}
|
|
5
|
-
`},`page_background_${
|
|
5
|
+
`},`page_background_${T?.background}`)]}),e(r,{products:v,collections:N,articles:S,publicStoreFrontData:q,children:e(s,{components:u,children:e("div",{children:e(n,{data:f,children:e(i,{t:I,children:h?.map(t=>e(a,{children:e(o,{state:t.data,lazy:t.lazy,priority:t.priority,isPreview:!0,children:e(d,{uid:t.uid})},t.uid)}))})})})})})]})};export{PreviewTemplate};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -109,6 +109,12 @@ type SharePageAPIResponse = {
|
|
|
109
109
|
articles: any;
|
|
110
110
|
customFonts: ShopType.CustomFont[];
|
|
111
111
|
};
|
|
112
|
+
type SharePageType = {
|
|
113
|
+
designerName?: string | null;
|
|
114
|
+
id: string;
|
|
115
|
+
thumbnails?: string[] | null;
|
|
116
|
+
title: string;
|
|
117
|
+
};
|
|
112
118
|
type SharePageProps = PageBuilderPropsV2 & {
|
|
113
119
|
publicStoreFrontData?: PublicStoreFrontData | null;
|
|
114
120
|
seo?: NextSeoProps;
|
|
@@ -120,7 +126,7 @@ type SharePageProps = PageBuilderPropsV2 & {
|
|
|
120
126
|
}[];
|
|
121
127
|
page?: any;
|
|
122
128
|
themeStyle?: any;
|
|
123
|
-
share?:
|
|
129
|
+
share?: SharePageType;
|
|
124
130
|
pageSections?: {
|
|
125
131
|
id: BigInt;
|
|
126
132
|
themePageID: BigInt;
|