@gem-sdk/pages 2.0.0-dev.1192 → 2.0.0-dev.1197
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");const getSharePageProps=(e,t)=>async s=>{try{let{sharedPage:o,customFonts:a,publicToken:r}=await e([s]);if(!o||!r)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,!0,!0),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 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core");const getFallbackV2=async(e,t,a=!0)=>{let r
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core");const getFallbackV2=async(e,t,a=!0,r=!1)=>{let l=!r&&!!a&&!process.env.NEXT_PUBLIC_STOREFRONT_TOKEN,c=t.map(e=>core.prefetchQueries(e.data,{isSample:l,isStorefront:a})).flat(),s=await Promise.allSettled(c.map(({query:t,variables:a,func:r})=>r?r(e,a):t?e([t,a]):{})),u=c.reduce((e,{key:t},a)=>{let r=s[a];return r?.status==="fulfilled"?{...e,[t]:r.value}:e},{});return u};exports.getFallbackV2=getFallbackV2;
|
|
@@ -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 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||!h)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,!0,!0),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 +1 @@
|
|
|
1
|
-
import{prefetchQueries as e}from"@gem-sdk/core";let getFallbackV2=async(t,a,l=!0)=>{let r
|
|
1
|
+
import{prefetchQueries as e}from"@gem-sdk/core";let getFallbackV2=async(t,a,l=!0,r=!1)=>{let s=!r&&!!l&&!process.env.NEXT_PUBLIC_STOREFRONT_TOKEN,c=a.map(t=>e(t.data,{isSample:s,isStorefront:l})).flat(),m=await Promise.allSettled(c.map(({query:e,variables:a,func:l})=>l?l(t,a):e?t([e,a]):{})),o=c.reduce((e,{key:t},a)=>{let l=m[a];return l?.status==="fulfilled"?{...e,[t]:l.value}:e},{});return o};export{getFallbackV2};
|
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:
|
|
159
|
+
declare const getSharePageProps: (fetcher: FetchFunc, storeFrontFetcher: FetchFunc) => (slug: string) => Promise<SharePageProps | null>;
|
|
160
160
|
|
|
161
161
|
declare const getPostPurchasePropsPreview: (fetcher: FetchFunc, librarySaleFunnelID?: string, storeFrontFetcher?: FetchFunc) => (data: {
|
|
162
162
|
id: string;
|
|
@@ -220,7 +220,7 @@ declare const parseBuilderTemplateV2: (data?: ParseBuilderTemplateV2Props) => {
|
|
|
220
220
|
|
|
221
221
|
declare const getFallbackV2: (fetcher: FetchFunc, data: {
|
|
222
222
|
data: any;
|
|
223
|
-
}[], isStorefront?: boolean) => Promise<{}>;
|
|
223
|
+
}[], isStorefront?: boolean, disableIsSample?: boolean) => Promise<{}>;
|
|
224
224
|
|
|
225
225
|
type RetryConfig = {
|
|
226
226
|
retries?: number;
|