@gem-sdk/pages 2.0.0-dev.1216 → 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{captureException as t}from"@sentry/nextjs";import{getCustomFonts as
|
|
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
|
@@ -146,6 +146,9 @@ type SharePageProps = PageBuilderPropsV2 & {
|
|
|
146
146
|
value: string;
|
|
147
147
|
}[];
|
|
148
148
|
shopMeta?: any;
|
|
149
|
+
pageType?: ShopType.PublishedThemePageType;
|
|
150
|
+
moneyFormat?: string | null;
|
|
151
|
+
moneyWithCurrencyFormat?: string | null;
|
|
149
152
|
};
|
|
150
153
|
|
|
151
154
|
declare const getCollectionProps: (fetcher: FetchFunc) => (handle?: string) => Promise<CollectionDetailPageProps>;
|
|
@@ -178,7 +181,7 @@ declare const getPostPurchasePropsPreview: (fetcher: FetchFunc, librarySaleFunne
|
|
|
178
181
|
|
|
179
182
|
declare const getStaticPagePropsPreview: (fetcher: FetchFunc, shopifyFetcher: FetchFunc) => (slug: string) => Promise<PageBuilderPropsV2>;
|
|
180
183
|
|
|
181
|
-
declare const getSharePageContentProps: (fetcher: FetchFunc
|
|
184
|
+
declare const getSharePageContentProps: (fetcher: FetchFunc) => (slug: string) => Promise<SharePageProps | null>;
|
|
182
185
|
|
|
183
186
|
declare const createFetcher: (token?: string | null) => FetchFunc;
|
|
184
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.
|
|
3
|
+
"version": "2.0.0-dev.1230",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"next": "14.2.20"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@gem-sdk/core": "2.0.0-dev.
|
|
29
|
+
"@gem-sdk/core": "2.0.0-dev.1218",
|
|
30
30
|
"@gem-sdk/plugin-cookie-bar": "2.0.0-dev.1206",
|
|
31
31
|
"@gem-sdk/plugin-quick-view": "2.0.0-dev.1206",
|
|
32
32
|
"@gem-sdk/plugin-sticky-add-to-cart": "2.0.0-dev.1206"
|