@gem-sdk/pages 2.0.0-dev.1183 → 2.0.0-dev.1188
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 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
|
|
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"),getFallback=require("../helpers/get-fallback.js");const getSharePageProps=(e,t)=>async s=>{try{let{sharedPage:o,customFonts:a,publicToken:r}=await e([s]);if(!o)return null;let{page:l,themeStyle:n,share:i,pageMeta:u,shopMeta:g}=o,{sectionPosition:m}=l??{},p=normalize.parseBuilderTemplateV2({...o,sectionPosition:m}),[c,h,F,b]=await Promise.all([googleFonts.getFontStyleFromPageTemplate(p),googleFonts.getFontFromGlobalStyle(n?.data),getFallback.getFallbackV2(t,p),customFonts.getCustomFonts(a)]),j=i?.thumbnails?Array.isArray(i.thumbnails)?i.thumbnails.map(e=>({url:e})):"string"==typeof i.thumbnails?[{url:i.thumbnails}]:[]:[],y={defaultTitle:g?.shop?.name??"",title:i?.title,openGraph:{site_name:g?.shop?.name??"",locale:g?.localization?.country?.isoCode??"",title:i?.title??g?.shop?.name??"",images:j},nofollow:!0,noindex:!0};return parseJson.serializableJson({seo:y,builderData:p,page:l,themeStyle:genCss.genCSS(n?.data,!1),share:i,pageMeta:u,shopMeta:g,elementFontStyle:c,fontStyle:h,swr:{fallback:F},customFonts:b,publicStoreFrontData:r?{token:r,endpoint:process.env.NEXT_PUBLIC_API_URL}:null})}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"),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,
|
|
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,pageBackground:u,publicStoreFrontData:m})=>{let o=router.useRouter(),{t:c}=core.useI18n(),d="custom-code-header";return(react.useEffect(()=>{let e=document.querySelectorAll(`[class*="${d}-"]`),s=[];e.length>1&&e.forEach(e=>{let t=e.className;if(s.includes(t)){e.remove();return}s.push(t)})},[]),o.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(d,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),u?.isUsePageBackground&&u?.background&&jsxRuntime.jsx("style",{children:`
|
|
2
2
|
body {
|
|
3
|
-
background: ${
|
|
3
|
+
background: ${u.background};
|
|
4
4
|
}
|
|
5
|
-
`},`page_background_${
|
|
5
|
+
`},`page_background_${u?.background}`)]}),jsxRuntime.jsx(core.PageProvider,{publicStoreFrontData:m,children:jsxRuntime.jsx(core.BuilderComponentProvider,{components:e,children:jsxRuntime.jsx("div",{children:jsxRuntime.jsx(core.SectionProvider,{data:t,children:jsxRuntime.jsx(core.I18nProvider,{t:c,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;
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 l}from"../google-fonts.js";import{getCustomFonts as s}from"../custom-fonts.js";import{getFallbackV2 as n}from"../helpers/get-fallback.js";let getSharePageProps=(i,m)=>async p=>{try{let{sharedPage:t,customFonts:u,publicToken:h}=await i([p]);if(!t)return null;let{page:f,themeStyle:c,share:g,pageMeta:b,shopMeta:j}=t,{sectionPosition:y}=f??{},d=e({...t,sectionPosition:y}),[P,w,S,_]=await Promise.all([a(d),l(c?.data),n(m,d),s(u)]),x=g?.thumbnails?Array.isArray(g.thumbnails)?g.thumbnails.map(t=>({url:t})):"string"==typeof g.thumbnails?[{url:g.thumbnails}]:[]:[],A={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:x},nofollow:!0,noindex:!0};return r({seo:A,builderData:d,page:f,themeStyle:o(c?.data,!1),share:g,pageMeta:b,shopMeta:j,elementFontStyle:P,fontStyle:w,swr:{fallback:S},customFonts:_,publicStoreFrontData:h?{token:h,endpoint:process.env.NEXT_PUBLIC_API_URL}:null})}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 g from"next/head";import{useRouter as p}from"next/router";import{parseHtml as c}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,pageBackground:v,publicStoreFrontData:N})=>{let S=p(),{t:T}=l(),q="custom-code-header";return(m(()=>{let e=document.querySelectorAll(`[class*="${q}-"]`),t=[];e.length>1&&e.forEach(e=>{let a=e.className;if(t.includes(a)){e.remove();return}t.push(a)})},[]),S.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(g,{children:[c(q,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}},_),v?.isUsePageBackground&&v?.background&&e("style",{children:`
|
|
2
2
|
body {
|
|
3
|
-
background: ${
|
|
3
|
+
background: ${v.background};
|
|
4
4
|
}
|
|
5
|
-
`},`page_background_${
|
|
5
|
+
`},`page_background_${v?.background}`)]}),e(r,{publicStoreFrontData:N,children:e(s,{components:u,children:e("div",{children:e(n,{data:f,children:e(i,{t:T,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
|
@@ -104,10 +104,8 @@ type StaticPagePropsV2 = PageBuilderPropsV2 & {
|
|
|
104
104
|
};
|
|
105
105
|
type SharePageAPIResponse = {
|
|
106
106
|
sharedPage: SharePageProps;
|
|
107
|
-
products: any;
|
|
108
|
-
collections: any;
|
|
109
|
-
articles: any;
|
|
110
107
|
customFonts: ShopType.CustomFont[];
|
|
108
|
+
publicToken?: string;
|
|
111
109
|
};
|
|
112
110
|
type SharePageType = {
|
|
113
111
|
designerName?: string | null;
|
|
@@ -124,7 +122,11 @@ type SharePageProps = PageBuilderPropsV2 & {
|
|
|
124
122
|
priority?: boolean;
|
|
125
123
|
data: BuilderState;
|
|
126
124
|
}[];
|
|
127
|
-
page?:
|
|
125
|
+
page?: {
|
|
126
|
+
id: string;
|
|
127
|
+
name?: string;
|
|
128
|
+
sectionPosition?: string[];
|
|
129
|
+
};
|
|
128
130
|
themeStyle?: any;
|
|
129
131
|
share?: SharePageType;
|
|
130
132
|
pageSections?: {
|
|
@@ -137,9 +139,6 @@ type SharePageProps = PageBuilderPropsV2 & {
|
|
|
137
139
|
};
|
|
138
140
|
pageMeta?: any;
|
|
139
141
|
shopMeta?: any;
|
|
140
|
-
products?: any;
|
|
141
|
-
collections?: any;
|
|
142
|
-
articles?: any;
|
|
143
142
|
};
|
|
144
143
|
|
|
145
144
|
declare const getCollectionProps: (fetcher: FetchFunc) => (handle?: string) => Promise<CollectionDetailPageProps>;
|
|
@@ -157,7 +156,7 @@ declare const getProductProps: (fetcher: FetchFunc) => (handle?: string) => Prom
|
|
|
157
156
|
|
|
158
157
|
declare const getStaticPagePropsV2: (fetcher: FetchFunc, shopifyFetcher: FetchFunc) => (slug: string) => Promise<PageBuilderPropsV2>;
|
|
159
158
|
|
|
160
|
-
declare const getSharePageProps: (fetcher: FetchFunc) => (slug: string) => Promise<SharePageProps | null>;
|
|
159
|
+
declare const getSharePageProps: (fetcher: FetchFunc, storeFrontFetcher: FetchFunc) => (slug: string) => Promise<SharePageProps | null>;
|
|
161
160
|
|
|
162
161
|
declare const getPostPurchasePropsPreview: (fetcher: FetchFunc, librarySaleFunnelID?: string, storeFrontFetcher?: FetchFunc) => (data: {
|
|
163
162
|
id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/pages",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.1188",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"next": "14.2.20"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@gem-sdk/core": "2.0.0-dev.
|
|
30
|
-
"@gem-sdk/plugin-cookie-bar": "2.0.0-dev.
|
|
31
|
-
"@gem-sdk/plugin-quick-view": "2.0.0-dev.
|
|
32
|
-
"@gem-sdk/plugin-sticky-add-to-cart": "2.0.0-dev.
|
|
29
|
+
"@gem-sdk/core": "2.0.0-dev.1188",
|
|
30
|
+
"@gem-sdk/plugin-cookie-bar": "2.0.0-dev.1188",
|
|
31
|
+
"@gem-sdk/plugin-quick-view": "2.0.0-dev.1188",
|
|
32
|
+
"@gem-sdk/plugin-sticky-add-to-cart": "2.0.0-dev.1188"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"next": ">=14"
|