@gem-sdk/pages 2.0.0-dev.1189 → 2.0.0-dev.1191
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"),getFallback=require("../helpers/get-fallback.js"),
|
|
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"),sentry=require("../helpers/sentry.js");const getSharePageProps=(e,t)=>async s=>{try{let{sharedPage:r,customFonts:a,publicToken:l}=await e([s]);if(!r||!l)return null;let{page:o,themeStyle:n,share:i,pageMeta:u,shopMeta:p}=r,{sectionPosition:g}=o??{},m=normalize.parseBuilderTemplateV2({...r,sectionPosition:g}),[c,h,F,y]=await Promise.all([googleFonts.getFontStyleFromPageTemplate(m),googleFonts.getFontFromGlobalStyle(n?.data),getFallback.getFallbackV2(t(l),m),customFonts.getCustomFonts(a)]);F&&0!==Object.keys(F).length||sentry.sentryCaptureException("Share page preview","Fallback is empty",{fallback:F,shareInfo:i,pageTemplate:m,publicToken:l});let b=i?.thumbnails?Array.isArray(i.thumbnails)?i.thumbnails.map(e=>({url:e})):"string"==typeof i.thumbnails?[{url:i.thumbnails}]:[]:[],j={defaultTitle:p?.shop?.name??"",title:i?.title,openGraph:{site_name:p?.shop?.name??"",locale:p?.localization?.country?.isoCode??"",title:i?.title??p?.shop?.name??"",images:b},nofollow:!0,noindex:!0};return parseJson.serializableJson({seo:j,builderData:m,page:o,themeStyle:genCss.genCSS(n?.data,!1),share:i,pageMeta:u,shopMeta:p,elementFontStyle:c,fontStyle:h,swr:{fallback:F},customFonts:y,publicStoreFrontData:l?{token:l,endpoint:process.env.NEXT_PUBLIC_API_URL??""}:null})}catch(e){return nextjs.captureException(e),null}};exports.getSharePageProps=getSharePageProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{captureException as
|
|
1
|
+
import{captureException as e}from"@sentry/nextjs";import{parseBuilderTemplateV2 as t}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 s,getFontFromGlobalStyle as a}from"../google-fonts.js";import{getCustomFonts as l}from"../custom-fonts.js";import{getFallbackV2 as n}from"../helpers/get-fallback.js";import{sentryCaptureException as i}from"../helpers/sentry.js";let getSharePageProps=(m,p)=>async h=>{try{let{sharedPage:e,customFonts:u,publicToken:f}=await m([h]);if(!e||!f)return null;let{page:c,themeStyle:g,share:y,pageMeta:b,shopMeta:j}=e,{sectionPosition:d}=c??{},P=t({...e,sectionPosition:d}),[w,S,k,_]=await Promise.all([s(P),a(g?.data),n(p(f),P),l(u)]);k&&0!==Object.keys(k).length||i("Share page preview","Fallback is empty",{fallback:k,shareInfo:y,pageTemplate:P,publicToken:f});let x=y?.thumbnails?Array.isArray(y.thumbnails)?y.thumbnails.map(e=>({url:e})):"string"==typeof y.thumbnails?[{url:y.thumbnails}]:[]:[],A={defaultTitle:j?.shop?.name??"",title:y?.title,openGraph:{site_name:j?.shop?.name??"",locale:j?.localization?.country?.isoCode??"",title:y?.title??j?.shop?.name??"",images:x},nofollow:!0,noindex:!0};return r({seo:A,builderData:P,page:c,themeStyle:o(g?.data,!1),share:y,pageMeta:b,shopMeta:j,elementFontStyle:w,fontStyle:S,swr:{fallback:k},customFonts:_,publicStoreFrontData:f?{token:f,endpoint:process.env.NEXT_PUBLIC_API_URL??""}:null})}catch(t){return e(t),null}};export{getSharePageProps};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -156,7 +156,7 @@ declare const getProductProps: (fetcher: FetchFunc) => (handle?: string) => Prom
|
|
|
156
156
|
|
|
157
157
|
declare const getStaticPagePropsV2: (fetcher: FetchFunc, shopifyFetcher: FetchFunc) => (slug: string) => Promise<PageBuilderPropsV2>;
|
|
158
158
|
|
|
159
|
-
declare const getSharePageProps: (fetcher: FetchFunc, storeFrontFetcher: FetchFunc) => (slug: string) => Promise<SharePageProps | null>;
|
|
159
|
+
declare const getSharePageProps: (fetcher: FetchFunc, storeFrontFetcher: (token: string) => FetchFunc) => (slug: string) => Promise<SharePageProps | null>;
|
|
160
160
|
|
|
161
161
|
declare const getPostPurchasePropsPreview: (fetcher: FetchFunc, librarySaleFunnelID?: string, storeFrontFetcher?: FetchFunc) => (data: {
|
|
162
162
|
id: string;
|
|
@@ -170,7 +170,7 @@ declare const getStaticPagePropsPreview: (fetcher: FetchFunc, shopifyFetcher: Fe
|
|
|
170
170
|
declare const createFetcher: (token?: string | null) => FetchFunc;
|
|
171
171
|
declare const createAppAPIFetcher: (token?: string | null, shopID?: string) => FetchFunc;
|
|
172
172
|
declare const createShopifyFetcher: (storefrontToken?: string, handle?: string) => FetchFunc;
|
|
173
|
-
declare const createTemplateFetcher: (
|
|
173
|
+
declare const createTemplateFetcher: (handle: string) => FetchFunc;
|
|
174
174
|
|
|
175
175
|
declare const getLayout: (page: React.ReactElement, pageProps?: any) => react_jsx_runtime.JSX.Element;
|
|
176
176
|
|