@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"),getFallback=require("../helpers/get-fallback.js"),normalize=require("../helpers/normalize.js"),parseJson=require("../helpers/parse-json.js");const getSharePageContentProps=(e,t)=>async l=>{try{let{sharedPage:s,customFonts:a,publicToken:r}=await e([l]);if(!s||!r)return null;let{page:o,themeStyle:n,pageMeta:u,shopMeta:g,moneyFormat:i,moneyWithCurrencyFormat:p}=s,{sectionPosition:c}=o??{},F=normalize.parseBuilderTemplateV2({...s,sectionPosition:c}),[m,f,d,j]=await Promise.allSettled([googleFonts.getFontStyleFromPageTemplate(F),googleFonts.getFontFromGlobalStyle(n?.data),getFallback.getFallbackV2(()=>t([r]),F,!1,!0),customFonts.getCustomFonts(a)]),P="fulfilled"===m.status?m.value:null,S="fulfilled"===f.status?f.value:null,b="fulfilled"===d.status?d.value:null,h="fulfilled"===j.status?j.value:null;return parseJson.serializableJson({builderData:F,page:o,themeStyle:genCss.genCSS(n?.data,!1),pageMeta:u,shopMeta:g,elementFontStyle:P,fontStyle:S,swr:{fallback:b||void 0},customFonts:h,publicStoreFrontData:r?{token:r,endpoint:process.env.NEXT_PUBLIC_API_URL??""}:null,pageType:o?.type,moneyFormat:i,moneyWithCurrencyFormat:p})}catch(e){return nextjs.captureException(e),null}};exports.getSharePageContentProps=getSharePageContentProps;
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{captureException as e}from"@sentry/nextjs";import{getCustomFonts as t}from"../custom-fonts.js";import{getFontStyleFromPageTemplate as l,getFontFromGlobalStyle as r}from"../google-fonts.js";import{genCSS as s}from"../helpers/gen-css.js";import{getFallbackV2 as o}from"../helpers/get-fallback.js";import{parseBuilderTemplateV2 as a}from"../helpers/normalize.js";import{serializableJson as n}from"../helpers/parse-json.js";let getSharePageContentProps=(u,p)=>async f=>{try{let{sharedPage:e,customFonts:i,publicToken:m}=await u([f]);if(!e||!m)return null;let{page:c,themeStyle:d,pageMeta:g,shopMeta:h,moneyFormat:j,moneyWithCurrencyFormat:P}=e,{sectionPosition:v}=c??{},y=a({...e,sectionPosition:v}),[S,b,k,w]=await Promise.allSettled([l(y),r(d?.data),o(()=>p([m]),y,!1,!0),t(i)]),C="fulfilled"===S.status?S.value:null,_="fulfilled"===b.status?b.value:null,x="fulfilled"===k.status?k.value:null,D="fulfilled"===w.status?w.value:null;return n({builderData:y,page:c,themeStyle:s(d?.data,!1),pageMeta:g,shopMeta:h,elementFontStyle:C,fontStyle:_,swr:{fallback:x||void 0},customFonts:D,publicStoreFrontData:m?{token:m,endpoint:process.env.NEXT_PUBLIC_API_URL??""}:null,pageType:c?.type,moneyFormat:j,moneyWithCurrencyFormat:P})}catch(t){return e(t),null}};export{getSharePageContentProps};
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};
@@ -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, storeFrontFetcher: FetchFunc) => (slug: string) => Promise<SharePageProps | null>;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "2.0.0-dev.1220",
3
+ "version": "2.0.0-dev.1230",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",