@gem-sdk/pages 2.0.0-dev.1220 → 2.0.0-dev.1230
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"),customFonts=require("../custom-fonts.js"),googleFonts=require("../google-fonts.js"),genCss=require("../helpers/gen-css.js"),
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core"),nextjs=require("@sentry/nextjs"),customFonts=require("../custom-fonts.js"),googleFonts=require("../google-fonts.js"),genCss=require("../helpers/gen-css.js"),normalize=require("../helpers/normalize.js"),parseJson=require("../helpers/parse-json.js"),fetcher=require("../fetcher.js"),getCollectionSharePageProps=require("./get-collection-share-page-props.js");const getSharePageContentProps=e=>async t=>{try{let{sharedPage:l,customFonts:r,publicToken:s}=await e([t]);if(!l||!s)return null;let{page:o,themeStyle:n,pageMeta:a,shopMeta:u,moneyFormat:i,moneyWithCurrencyFormat:c}=l,{sectionPosition:p}=o??{},g=normalize.parseBuilderTemplateV2({...l,sectionPosition:p}),f=null,h=null;if(o?.type==="GP_COLLECTION"){let e=(a??[]).find(e=>"selected_preview_collection"===e.key)?.value,t=e?JSON.parse(e??{}):null;h=t?.collectionId}let[P,d,m,C,F]=await Promise.allSettled([googleFonts.getFontStyleFromPageTemplate(g),googleFonts.getFontFromGlobalStyle(n?.data),customFonts.getCustomFonts(r),fetcher.createFetcher(s)([core.StorePropertyDocument]),o?.type==="GP_COLLECTION"?getCollectionSharePageProps.getCollectionSharePageProps(fetcher.createFetcher(s))(h??void 0):null]);f="fulfilled"===F.status?F.value?.collection:null;let S="fulfilled"===P.status?P.value:null,y="fulfilled"===d.status?d.value:null,j="fulfilled"===m.status?m.value:null,v="fulfilled"===C.status?C.value:void 0;return parseJson.serializableJson({builderData:g,page:o,themeStyle:genCss.genCSS(n?.data,!1),pageMeta:a,shopMeta:u,elementFontStyle:S,fontStyle:y,customFonts:j,publicStoreFrontData:s?{token:s,endpoint:process.env.NEXT_PUBLIC_API_URL??""}:null,pageType:o?.type,moneyFormat:i,moneyWithCurrencyFormat:c,swatches:parseJson.parseJson(v?.storeProperty?.swatchesConfig),collection:f})}catch(e){return nextjs.captureException(e),null}};exports.getSharePageContentProps=getSharePageContentProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{StorePropertyDocument as e}from"@gem-sdk/core";import{captureException as t}from"@sentry/nextjs";import{getCustomFonts as l}from"../custom-fonts.js";import{getFontStyleFromPageTemplate as o,getFontFromGlobalStyle as r}from"../google-fonts.js";import{genCSS as s}from"../helpers/gen-css.js";import{parseBuilderTemplateV2 as a}from"../helpers/normalize.js";import{serializableJson as n,parseJson as u}from"../helpers/parse-json.js";import{createFetcher as i}from"../fetcher.js";import{getCollectionSharePageProps as p}from"./get-collection-share-page-props.js";let getSharePageContentProps=f=>async m=>{try{let{sharedPage:t,customFonts:c,publicToken:d}=await f([m]);if(!t||!d)return null;let{page:g,themeStyle:h,pageMeta:v,shopMeta:y,moneyFormat:P,moneyWithCurrencyFormat:j}=t,{sectionPosition:C}=g??{},_=a({...t,sectionPosition:C}),L=null,S=null;if(g?.type==="GP_COLLECTION"){let e=(v??[]).find(e=>"selected_preview_collection"===e.key)?.value,t=e?JSON.parse(e??{}):null;S=t?.collectionId}let[w,I,O,N,T]=await Promise.allSettled([o(_),r(h?.data),l(c),i(d)([e]),g?.type==="GP_COLLECTION"?p(i(d))(S??void 0):null]);L="fulfilled"===T.status?T.value?.collection:null;let k="fulfilled"===w.status?w.value:null,E="fulfilled"===I.status?I.value:null,b="fulfilled"===O.status?O.value:null,x="fulfilled"===N.status?N.value:void 0;return n({builderData:_,page:g,themeStyle:s(h?.data,!1),pageMeta:v,shopMeta:y,elementFontStyle:k,fontStyle:E,customFonts:b,publicStoreFrontData:d?{token:d,endpoint:process.env.NEXT_PUBLIC_API_URL??""}:null,pageType:g?.type,moneyFormat:P,moneyWithCurrencyFormat:j,swatches:u(x?.storeProperty?.swatchesConfig),collection:L})}catch(e){return t(e),null}};export{getSharePageContentProps};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -181,7 +181,7 @@ declare const getPostPurchasePropsPreview: (fetcher: FetchFunc, librarySaleFunne
|
|
|
181
181
|
|
|
182
182
|
declare const getStaticPagePropsPreview: (fetcher: FetchFunc, shopifyFetcher: FetchFunc) => (slug: string) => Promise<PageBuilderPropsV2>;
|
|
183
183
|
|
|
184
|
-
declare const getSharePageContentProps: (fetcher: FetchFunc
|
|
184
|
+
declare const getSharePageContentProps: (fetcher: FetchFunc) => (slug: string) => Promise<SharePageProps | null>;
|
|
185
185
|
|
|
186
186
|
declare const createFetcher: (token?: string | null) => FetchFunc;
|
|
187
187
|
declare const createAppAPIFetcher: (token?: string | null, shopID?: string) => FetchFunc;
|