@gem-sdk/pages 12.0.0-dev.113 → 12.0.0-dev.118

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 core=require("@gem-sdk/core"),adapterShopify=require("@gem-sdk/adapter-shopify"),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"),nextjs=require("@sentry/nextjs"),customFonts=require("../custom-fonts.js"),getMetafield=require("../helpers/get-metafield.js"),index=require("../../constants/index.js"),generateSeoLinks=require("../helpers/generate-seo-links.js");const getStaticPagePropsV2=(e,a)=>async t=>{try{let i="STATIC",l={slug:t,slugType:i},[s,d,o,n]=await Promise.allSettled([e([core.PublishedThemePagesDocument,l]),e([core.StorePropertyDocument]),a([adapterShopify.ShopMetaDocument]),e([core.PublishedShopMetasDocument,{keys:["source_font",index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL,index.PublishedThemePageMetafields.SHOW_PRICE_CURRENCY,index.PublishedThemePageMetafields.MONEY_WITH_CURRENCY_FORMAT]}])]);if("rejected"===s.status)throw Error(s.reason?.[0]);let r="fulfilled"===n.status?n.value:void 0,u=r?.publishedShopMetas?.find(e=>e?.key==="source_font"),h=r?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.SHOW_PRICE_CURRENCY),g=r?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.MONEY_WITH_CURRENCY_FORMAT),P=s.value.publishedThemePages?.[0],f=s.value?.publishedThemePages?.[0]?.themePageCustomFonts;if(!P)throw Error(`No data builder found for slug: /${t}`);let m=normalize.parseBuilderTemplateV2(P),[T,p,M,c]=await Promise.all([googleFonts.getFontStyleFromPageTemplate(m,u?.value,P?.pageStyle?.data),googleFonts.getFontLinkFromGlobalStyle(P?.pageStyle?.data,u?.value),getFallback.getFallbackV2(e,m),customFonts.getCustomFonts(f)]),y=P.isMobile??!1,b=getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,P?.metafields)||r?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value,_=getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_TITLE,P?.metafields)||r?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.GLOBAL_META_TITLE)?.value,S=parseJson.parseJson(getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL,P?.metafields)||r?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value),E=getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.NOINDEX_KEY,P?.metafields)||r?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.NOINDEX_KEY)?.value,L=getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.NOFOLLOW_KEY,P?.metafields)||r?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.NOFOLLOW_KEY)?.value,C="fulfilled"===o.status?o.value:void 0,x="fulfilled"===d.status?d.value:void 0,A=x?.storeProperty?.favicon??"/favicon/favicon-32x32.png",I={defaultTitle:C?.shop.name,title:_||P?.name,description:b??C?.shop.description,openGraph:{locale:C?.localization.country.isoCode,title:(_||P?.name)??C?.shop.name,description:b??C?.shop.description,images:S?[S]:[]},noindex:"true"===E,nofollow:"true"===L,canonical:`https://${x?.storeProperty?.primaryDomain}/${t}`,additionalMetaTags:[{name:"theme-color",content:"#000000"}],additionalLinkTags:generateSeoLinks.generateSeoLinks({favicon:A,shopMeta:C})},O=C?.localization.language.isoCode??null,k=C?.localization.country.isoCode??null,B=O&&k?`${O}-${k}`:null;return parseJson.serializableJson({themeStyle:genCss.genCSS(P?.pageStyle?.data,y),fontStyle:p,elementFontStyle:T,builderData:m,pageType:i,moneyFormat:h?.value==="true"?g?.value:C?.shop.moneyFormat??null,currency:C?.localization.country.currency.isoCode??null,languageIsoCode:O,countryIsoCode:k,locale:B,swr:{fallback:M},swatches:parseJson.parseJson(x?.storeProperty?.swatchesConfig),seo:I,mobileOnly:y,gaTrackingId:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_GA_TRACKING_ID,P?.metafields)??null,facebookPixelId:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_FB_PIXEL_ID,P?.metafields)??null,tiktokPixelId:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_TIKTOK_PIXEL_ID,P?.metafields)??null,customCodeHeader:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_HEADER,P?.metafields)??null,customCodeBody:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_BODY,P?.metafields)??null,pageHandle:P.handle??null,customFonts:c,interaction:P?.interaction,pageBackground:normalize.extractPageBackground(P)})}catch(e){throw nextjs.captureException(e),e}};exports.getStaticPagePropsV2=getStaticPagePropsV2;
1
+ "use strict";var core=require("@gem-sdk/core"),adapterShopify=require("@gem-sdk/adapter-shopify"),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"),nextjs=require("@sentry/nextjs"),customFonts=require("../custom-fonts.js"),getMetafield=require("../helpers/get-metafield.js"),index=require("../../constants/index.js"),generateSeoLinks=require("../helpers/generate-seo-links.js");const getStaticPagePropsV2=(e,a)=>async t=>{try{let i="STATIC",l={slug:t,slugType:i},[s,d,o,n]=await Promise.allSettled([e([core.PublishedThemePagesDocument,l]),e([core.StorePropertyDocument]),a([adapterShopify.ShopMetaDocument]),e([core.PublishedShopMetasDocument,{keys:["source_font",index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL,index.PublishedThemePageMetafields.SHOW_PRICE_CURRENCY,index.PublishedThemePageMetafields.MONEY_WITH_CURRENCY_FORMAT]}])]);if("rejected"===s.status)throw Error(s.reason?.[0]);let u="fulfilled"===n.status?n.value:void 0,r=u?.publishedShopMetas?.find(e=>e?.key==="source_font"),h=u?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.SHOW_PRICE_CURRENCY),g=u?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.MONEY_WITH_CURRENCY_FORMAT),P=s.value.publishedThemePages?.[0],f=s.value?.publishedThemePages?.[0]?.themePageCustomFonts;if(!P)throw Error(`No data builder found for slug: /${t}`);let m=normalize.parseBuilderTemplateV2(P),[p,T,M,c]=await Promise.all([googleFonts.getFontStyleFromPageTemplate(m,r?.value,P?.pageStyle?.data),googleFonts.getFontLinkFromGlobalStyle(P?.pageStyle?.data,r?.value),getFallback.getFallbackV2(e,m),customFonts.getCustomFonts(f)]),b=P.isMobile??!1,y=getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,P?.metafields)||u?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value,_=getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_TITLE,P?.metafields)||u?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.GLOBAL_META_TITLE)?.value,S=parseJson.parseJson(getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL,P?.metafields)||u?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value),E=getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.NOINDEX_KEY,P?.metafields)||u?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.NOINDEX_KEY)?.value,L=getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.NOFOLLOW_KEY,P?.metafields)||u?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.NOFOLLOW_KEY)?.value,C="fulfilled"===o.status?o.value:void 0,x="fulfilled"===d.status?d.value:void 0,I=x?.storeProperty?.favicon??"/favicon/favicon-32x32.png",A={defaultTitle:C?.shop.name,title:_||P?.name,description:y??C?.shop.description,openGraph:{locale:C?.localization.country.isoCode,title:(_||P?.name)??C?.shop.name,description:y??C?.shop.description,images:S?[S]:[]},noindex:"true"===E,nofollow:"true"===L,canonical:`https://${x?.storeProperty?.primaryDomain}/${t}`,additionalMetaTags:[{name:"theme-color",content:"#000000"}],additionalLinkTags:generateSeoLinks.generateSeoLinks({favicon:I,shopMeta:C})},O=C?.localization.language.isoCode??null,k=C?.localization.country.isoCode??null,B=O&&k?`${O}-${k}`:null;return parseJson.serializableJson({id:s.value?.publishedThemePages?.[0]?.id??null,shopID:s.value?.publishedThemePages?.[0]?.shopID??null,themeStyle:genCss.genCSS(P?.pageStyle?.data,b),fontStyle:T,elementFontStyle:p,builderData:m,pageType:i,moneyFormat:h?.value==="true"?g?.value:C?.shop.moneyFormat??null,currency:C?.localization.country.currency.isoCode??null,languageIsoCode:O,countryIsoCode:k,locale:B,swr:{fallback:M},swatches:parseJson.parseJson(x?.storeProperty?.swatchesConfig),seo:A,mobileOnly:b,gaTrackingId:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_GA_TRACKING_ID,P?.metafields)??null,facebookPixelId:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_FB_PIXEL_ID,P?.metafields)??null,tiktokPixelId:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_TIKTOK_PIXEL_ID,P?.metafields)??null,customCodeHeader:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_HEADER,P?.metafields)??null,customCodeBody:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_BODY,P?.metafields)??null,pageHandle:P.handle??null,customFonts:c,interaction:P?.interaction,pageBackground:normalize.extractPageBackground(P)})}catch(e){throw nextjs.captureException(e),e}};exports.getStaticPagePropsV2=getStaticPagePropsV2;
@@ -1 +1 @@
1
- import{PublishedThemePagesDocument as e,StorePropertyDocument as o,PublishedShopMetasDocument as t}from"@gem-sdk/core";import{ShopMetaDocument as a}from"@gem-sdk/adapter-shopify";import{getFontStyleFromPageTemplate as l,getFontLinkFromGlobalStyle as s}from"../google-fonts.js";import{genCSS as i}from"../helpers/gen-css.js";import{getFallbackV2 as r}from"../helpers/get-fallback.js";import{parseBuilderTemplateV2 as n,extractPageBackground as d}from"../helpers/normalize.js";import{parseJson as p,serializableJson as u}from"../helpers/parse-json.js";import{captureException as m}from"@sentry/nextjs";import{getCustomFonts as f}from"../custom-fonts.js";import{getPublishedThemePageMetafieldByKey as c}from"../helpers/get-metafield.js";import{PublishedThemePageMetafields as _}from"../../constants/index.js";import{generateSeoLinks as h}from"../helpers/generate-seo-links.js";let getStaticPagePropsV2=(T,E)=>async g=>{try{let m="STATIC",A={slug:g,slugType:m},[I,L,O,y]=await Promise.allSettled([T([e,A]),T([o]),E([a]),T([t,{keys:["source_font",_.GLOBAL_META_DESCRIPTION,_.GLOBAL_META_THUMBNAIL,_.SHOW_PRICE_CURRENCY,_.MONEY_WITH_CURRENCY_FORMAT]}])]);if("rejected"===I.status)throw Error(I.reason?.[0]);let C="fulfilled"===y.status?y.value:void 0,M=C?.publishedShopMetas?.find(e=>e?.key==="source_font"),S=C?.publishedShopMetas?.find(e=>e?.key===_.SHOW_PRICE_CURRENCY),N=C?.publishedShopMetas?.find(e=>e?.key===_.MONEY_WITH_CURRENCY_FORMAT),P=I.value.publishedThemePages?.[0],v=I.value?.publishedThemePages?.[0]?.themePageCustomFonts;if(!P)throw Error(`No data builder found for slug: /${g}`);let k=n(P),[R,b,B,D]=await Promise.all([l(k,M?.value,P?.pageStyle?.data),s(P?.pageStyle?.data,M?.value),r(T,k),f(v)]),Y=P.isMobile??!1,j=c(_.GLOBAL_META_DESCRIPTION,P?.metafields)||C?.publishedShopMetas?.find(e=>e?.key===_.GLOBAL_META_DESCRIPTION)?.value,G=c(_.GLOBAL_META_TITLE,P?.metafields)||C?.publishedShopMetas?.find(e=>e?.key===_.GLOBAL_META_TITLE)?.value,H=p(c(_.GLOBAL_META_THUMBNAIL,P?.metafields)||C?.publishedShopMetas?.find(e=>e?.key===_.GLOBAL_META_THUMBNAIL)?.value),w=c(_.NOINDEX_KEY,P?.metafields)||C?.publishedShopMetas?.find(e=>e?.key===_.NOINDEX_KEY)?.value,U=c(_.NOFOLLOW_KEY,P?.metafields)||C?.publishedShopMetas?.find(e=>e?.key===_.NOFOLLOW_KEY)?.value,F="fulfilled"===O.status?O.value:void 0,x="fulfilled"===L.status?L.value:void 0,K=x?.storeProperty?.favicon??"/favicon/favicon-32x32.png",W={defaultTitle:F?.shop.name,title:G||P?.name,description:j??F?.shop.description,openGraph:{locale:F?.localization.country.isoCode,title:(G||P?.name)??F?.shop.name,description:j??F?.shop.description,images:H?[H]:[]},noindex:"true"===w,nofollow:"true"===U,canonical:`https://${x?.storeProperty?.primaryDomain}/${g}`,additionalMetaTags:[{name:"theme-color",content:"#000000"}],additionalLinkTags:h({favicon:K,shopMeta:F})},z=F?.localization.language.isoCode??null,$=F?.localization.country.isoCode??null,X=z&&$?`${z}-${$}`:null;return u({themeStyle:i(P?.pageStyle?.data,Y),fontStyle:b,elementFontStyle:R,builderData:k,pageType:m,moneyFormat:S?.value==="true"?N?.value:F?.shop.moneyFormat??null,currency:F?.localization.country.currency.isoCode??null,languageIsoCode:z,countryIsoCode:$,locale:X,swr:{fallback:B},swatches:p(x?.storeProperty?.swatchesConfig),seo:W,mobileOnly:Y,gaTrackingId:c(_.ANALYTICS_GA_TRACKING_ID,P?.metafields)??null,facebookPixelId:c(_.ANALYTICS_FB_PIXEL_ID,P?.metafields)??null,tiktokPixelId:c(_.ANALYTICS_TIKTOK_PIXEL_ID,P?.metafields)??null,customCodeHeader:c(_.CUSTOM_CODE_HEADER,P?.metafields)??null,customCodeBody:c(_.CUSTOM_CODE_BODY,P?.metafields)??null,pageHandle:P.handle??null,customFonts:D,interaction:P?.interaction,pageBackground:d(P)})}catch(e){throw m(e),e}};export{getStaticPagePropsV2};
1
+ import{PublishedThemePagesDocument as e,StorePropertyDocument as o,PublishedShopMetasDocument as t}from"@gem-sdk/core";import{ShopMetaDocument as l}from"@gem-sdk/adapter-shopify";import{getFontStyleFromPageTemplate as a,getFontLinkFromGlobalStyle as s}from"../google-fonts.js";import{genCSS as i}from"../helpers/gen-css.js";import{getFallbackV2 as r}from"../helpers/get-fallback.js";import{parseBuilderTemplateV2 as n,extractPageBackground as d}from"../helpers/normalize.js";import{parseJson as u,serializableJson as p}from"../helpers/parse-json.js";import{captureException as m}from"@sentry/nextjs";import{getCustomFonts as f}from"../custom-fonts.js";import{getPublishedThemePageMetafieldByKey as h}from"../helpers/get-metafield.js";import{PublishedThemePageMetafields as c}from"../../constants/index.js";import{generateSeoLinks as _}from"../helpers/generate-seo-links.js";let getStaticPagePropsV2=(T,E)=>async g=>{try{let m="STATIC",I={slug:g,slugType:m},[A,L,O,y]=await Promise.allSettled([T([e,I]),T([o]),E([l]),T([t,{keys:["source_font",c.GLOBAL_META_DESCRIPTION,c.GLOBAL_META_THUMBNAIL,c.SHOW_PRICE_CURRENCY,c.MONEY_WITH_CURRENCY_FORMAT]}])]);if("rejected"===A.status)throw Error(A.reason?.[0]);let C="fulfilled"===y.status?y.value:void 0,M=C?.publishedShopMetas?.find(e=>e?.key==="source_font"),S=C?.publishedShopMetas?.find(e=>e?.key===c.SHOW_PRICE_CURRENCY),N=C?.publishedShopMetas?.find(e=>e?.key===c.MONEY_WITH_CURRENCY_FORMAT),P=A.value.publishedThemePages?.[0],v=A.value?.publishedThemePages?.[0]?.themePageCustomFonts;if(!P)throw Error(`No data builder found for slug: /${g}`);let k=n(P),[b,R,D,B]=await Promise.all([a(k,M?.value,P?.pageStyle?.data),s(P?.pageStyle?.data,M?.value),r(T,k),f(v)]),Y=P.isMobile??!1,j=h(c.GLOBAL_META_DESCRIPTION,P?.metafields)||C?.publishedShopMetas?.find(e=>e?.key===c.GLOBAL_META_DESCRIPTION)?.value,G=h(c.GLOBAL_META_TITLE,P?.metafields)||C?.publishedShopMetas?.find(e=>e?.key===c.GLOBAL_META_TITLE)?.value,H=u(h(c.GLOBAL_META_THUMBNAIL,P?.metafields)||C?.publishedShopMetas?.find(e=>e?.key===c.GLOBAL_META_THUMBNAIL)?.value),w=h(c.NOINDEX_KEY,P?.metafields)||C?.publishedShopMetas?.find(e=>e?.key===c.NOINDEX_KEY)?.value,U=h(c.NOFOLLOW_KEY,P?.metafields)||C?.publishedShopMetas?.find(e=>e?.key===c.NOFOLLOW_KEY)?.value,F="fulfilled"===O.status?O.value:void 0,x="fulfilled"===L.status?L.value:void 0,K=x?.storeProperty?.favicon??"/favicon/favicon-32x32.png",W={defaultTitle:F?.shop.name,title:G||P?.name,description:j??F?.shop.description,openGraph:{locale:F?.localization.country.isoCode,title:(G||P?.name)??F?.shop.name,description:j??F?.shop.description,images:H?[H]:[]},noindex:"true"===w,nofollow:"true"===U,canonical:`https://${x?.storeProperty?.primaryDomain}/${g}`,additionalMetaTags:[{name:"theme-color",content:"#000000"}],additionalLinkTags:_({favicon:K,shopMeta:F})},z=F?.localization.language.isoCode??null,$=F?.localization.country.isoCode??null,X=z&&$?`${z}-${$}`:null;return p({id:A.value?.publishedThemePages?.[0]?.id??null,shopID:A.value?.publishedThemePages?.[0]?.shopID??null,themeStyle:i(P?.pageStyle?.data,Y),fontStyle:R,elementFontStyle:b,builderData:k,pageType:m,moneyFormat:S?.value==="true"?N?.value:F?.shop.moneyFormat??null,currency:F?.localization.country.currency.isoCode??null,languageIsoCode:z,countryIsoCode:$,locale:X,swr:{fallback:D},swatches:u(x?.storeProperty?.swatchesConfig),seo:W,mobileOnly:Y,gaTrackingId:h(c.ANALYTICS_GA_TRACKING_ID,P?.metafields)??null,facebookPixelId:h(c.ANALYTICS_FB_PIXEL_ID,P?.metafields)??null,tiktokPixelId:h(c.ANALYTICS_TIKTOK_PIXEL_ID,P?.metafields)??null,customCodeHeader:h(c.CUSTOM_CODE_HEADER,P?.metafields)??null,customCodeBody:h(c.CUSTOM_CODE_BODY,P?.metafields)??null,pageHandle:P.handle??null,customFonts:B,interaction:P?.interaction,pageBackground:d(P)})}catch(e){throw m(e),e}};export{getStaticPagePropsV2};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "12.0.0-dev.113",
3
+ "version": "12.0.0-dev.118",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",