@gem-sdk/pages 12.0.0-dev.77 → 12.0.0-dev.80
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";exports.PublishedThemePageMetafields=void 0,function(
|
|
1
|
+
"use strict";exports.PublishedThemePageMetafields=void 0,function(_){_.CUSTOM_CODE_HEADER="custom_code_header",_.CUSTOM_CODE_BODY="custom_code_body",_.ANALYTICS_GA_TRACKING_ID="analytics_ga_tracking_id",_.ANALYTICS_FB_PIXEL_ID="analytics_fb_pixel_id",_.ANALYTICS_TIKTOK_PIXEL_ID="analytics_tiktok_pixel_id",_.GLOBAL_META_DESCRIPTION="global-meta-description",_.GLOBAL_META_TITLE="global-meta-title",_.GLOBAL_META_THUMBNAIL="global-meta-thumbnail",_.NOINDEX_KEY="noindex",_.NOFOLLOW_KEY="nofollow",_.SHOW_PRICE_CURRENCY="show_price_currency",_.MONEY_WITH_CURRENCY_FORMAT="money_with_currency_format"}(exports.PublishedThemePageMetafields||(exports.PublishedThemePageMetafields={})),exports.LIBRARY_TYPE_ENUM=void 0,function(_){_.TEMPLATES="templates",_.SECTIONS="sections",_.POST_PURCHASE_UPSELL="post-purchase-upsell",_.THEME_SECTIONS="theme-sections",_.EXISTING_PAGES="existing-page",_.OFFER_PAGE_TEMPLATES="offer-page-templates"}(exports.LIBRARY_TYPE_ENUM||(exports.LIBRARY_TYPE_ENUM={}));
|
|
@@ -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,
|
|
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 +1 @@
|
|
|
1
|
-
var PublishedThemePageMetafields,LIBRARY_TYPE_ENUM;!function(
|
|
1
|
+
var PublishedThemePageMetafields,LIBRARY_TYPE_ENUM;!function(_){_.CUSTOM_CODE_HEADER="custom_code_header",_.CUSTOM_CODE_BODY="custom_code_body",_.ANALYTICS_GA_TRACKING_ID="analytics_ga_tracking_id",_.ANALYTICS_FB_PIXEL_ID="analytics_fb_pixel_id",_.ANALYTICS_TIKTOK_PIXEL_ID="analytics_tiktok_pixel_id",_.GLOBAL_META_DESCRIPTION="global-meta-description",_.GLOBAL_META_TITLE="global-meta-title",_.GLOBAL_META_THUMBNAIL="global-meta-thumbnail",_.NOINDEX_KEY="noindex",_.NOFOLLOW_KEY="nofollow",_.SHOW_PRICE_CURRENCY="show_price_currency",_.MONEY_WITH_CURRENCY_FORMAT="money_with_currency_format"}(PublishedThemePageMetafields||(PublishedThemePageMetafields={})),function(_){_.TEMPLATES="templates",_.SECTIONS="sections",_.POST_PURCHASE_UPSELL="post-purchase-upsell",_.THEME_SECTIONS="theme-sections",_.EXISTING_PAGES="existing-page",_.OFFER_PAGE_TEMPLATES="offer-page-templates"}(LIBRARY_TYPE_ENUM||(LIBRARY_TYPE_ENUM={}));export{LIBRARY_TYPE_ENUM,PublishedThemePageMetafields};
|
|
@@ -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
|
|
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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/pages",
|
|
3
|
-
"version": "12.0.0-dev.
|
|
3
|
+
"version": "12.0.0-dev.80",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"next": "14.2.35"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@gem-sdk/core": "12.0.0-dev.
|
|
30
|
+
"@gem-sdk/core": "12.0.0-dev.79",
|
|
31
31
|
"@gem-sdk/plugin-cookie-bar": "12.0.0-dev.53",
|
|
32
32
|
"@gem-sdk/plugin-quick-view": "12.0.0-dev.53",
|
|
33
33
|
"@gem-sdk/plugin-sticky-add-to-cart": "12.0.0-dev.53"
|