@gem-sdk/pages 17.0.0-staging.18 → 17.0.0-staging.22
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.
- package/dist/cjs/constants/index.js +1 -1
- package/dist/cjs/libs/api/get-home-page-props-v2.js +1 -1
- package/dist/cjs/libs/api/get-static-page-props-v2.js +1 -1
- package/dist/cjs/pages/static-v2.js +2 -2
- package/dist/esm/constants/index.js +1 -1
- package/dist/esm/libs/api/get-home-page-props-v2.js +1 -1
- package/dist/esm/libs/api/get-static-page-props-v2.js +1 -1
- package/dist/esm/pages/static-v2.js +2 -2
- package/dist/types/index.d.ts +1 -0
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.PublishedThemePageMetafields=void 0,function(e){e.CUSTOM_CODE_HEADER="custom_code_header",e.CUSTOM_CODE_BODY="custom_code_body",e.ANALYTICS_GA_TRACKING_ID="analytics_ga_tracking_id",e.ANALYTICS_FB_PIXEL_ID="analytics_fb_pixel_id",e.ANALYTICS_TIKTOK_PIXEL_ID="analytics_tiktok_pixel_id",e.GLOBAL_META_DESCRIPTION="global-meta-description",e.GLOBAL_META_TITLE="global-meta-title",e.GLOBAL_META_THUMBNAIL="global-meta-thumbnail",e.NOINDEX_KEY="noindex",e.NOFOLLOW_KEY="nofollow"}(exports.PublishedThemePageMetafields||(exports.PublishedThemePageMetafields={})),exports.LIBRARY_TYPE_ENUM=void 0,function(e){e.TEMPLATES="templates",e.SECTIONS="sections",e.POST_PURCHASE_UPSELL="post-purchase-upsell",e.THEME_SECTIONS="theme-sections",e.EXISTING_PAGES="existing-page",e.OFFER_PAGE_TEMPLATES="offer-page-templates"}(exports.LIBRARY_TYPE_ENUM||(exports.LIBRARY_TYPE_ENUM={}));
|
|
1
|
+
"use strict";exports.PublishedThemePageMetafields=void 0,function(e){e.CUSTOM_CODE_HEADER="custom_code_header",e.CUSTOM_CODE_BODY="custom_code_body",e.ANALYTICS_GA_TRACKING_ID="analytics_ga_tracking_id",e.ANALYTICS_FB_PIXEL_ID="analytics_fb_pixel_id",e.ANALYTICS_TIKTOK_PIXEL_ID="analytics_tiktok_pixel_id",e.GLOBAL_META_DESCRIPTION="global-meta-description",e.GLOBAL_META_TITLE="global-meta-title",e.GLOBAL_META_THUMBNAIL="global-meta-thumbnail",e.NOINDEX_KEY="noindex",e.NOFOLLOW_KEY="nofollow",e.ILP_DISABLE_GS_FONT="ilp_disable_gs_font"}(exports.PublishedThemePageMetafields||(exports.PublishedThemePageMetafields={})),exports.LIBRARY_TYPE_ENUM=void 0,function(e){e.TEMPLATES="templates",e.SECTIONS="sections",e.POST_PURCHASE_UPSELL="post-purchase-upsell",e.THEME_SECTIONS="theme-sections",e.EXISTING_PAGES="existing-page",e.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"),index=require("../../constants/index.js"),getMetafield=require("../helpers/get-metafield.js"),customFonts=require("../custom-fonts.js"),generateSeoLinks=require("../helpers/generate-seo-links.js");const getHomePagePropsV2=(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"),index=require("../../constants/index.js"),getMetafield=require("../helpers/get-metafield.js"),customFonts=require("../custom-fonts.js"),generateSeoLinks=require("../helpers/generate-seo-links.js");const getHomePagePropsV2=(e,t)=>async()=>{try{let a={slugType:"STATIC"},[l,s,i,o]=await Promise.allSettled([e([core.PublishedThemePagesDocument,a]),e([core.StorePropertyDocument.toString()]),t([adapterShopify.ShopMetaDocument]),e([core.PublishedShopMetasDocument,{keys:["source_font",index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL]}])]);if("rejected"===l.status)throw Error(l.reason?.[0]);let d="fulfilled"===o.status?o.value:void 0,n=d?.publishedShopMetas?.find(e=>e?.key==="source_font"),r=l.value?.publishedThemePages?.[0],u=l.value?.publishedThemePages?.[0]?.themePageCustomFonts;if(!r)throw Error("No data builder found for Home page");let g=normalize.parseBuilderTemplateV2(r),[h,m,P,p]=await Promise.all([googleFonts.getStaticFontFacesFromPageTemplate({pageTemplate:g,sourceFont:n?.value,data:r?.pageStyle?.data}),googleFonts.getStaticFontFacesFromGlobalStyle({data:r?.pageStyle?.data,sourceFont:n?.value}),getFallback.getFallbackV2(e,g),customFonts.getCustomFonts(u)]),f=r.isMobile??!1,c=getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,r?.metafields)||d?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value,T=parseJson.parseJson(getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL,r?.metafields)||d?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value),M="true"===getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ILP_DISABLE_GS_FONT,r?.metafields),y="fulfilled"===i.status?i.value:void 0,b="fulfilled"===s.status?s.value:void 0,S=b?.storeProperty?.favicon??"/favicon/favicon-32x32.png",_={defaultTitle:y?.shop.name,title:r?.name??"Home",description:c??y?.shop.description,openGraph:{locale:y?.localization.country.isoCode,title:r?.name??y?.shop.name,description:c??y?.shop.description,images:T?[T]:[]},additionalMetaTags:[{name:"theme-color",content:"#000000"}],canonical:`https://${b?.storeProperty?.primaryDomain}/`,additionalLinkTags:generateSeoLinks.generateSeoLinks({favicon:S,shopMeta:y})},I=y?.localization.language.isoCode??null,A=y?.localization.country.isoCode??null,L=I&&A?`${I}-${A}`:null;return parseJson.serializableJson({id:l.value?.publishedThemePages?.[0]?.id??null,shopID:l.value?.publishedThemePages?.[0]?.shopID??null,themeStyle:genCss.genCSS(r?.pageStyle?.data,f),fontStyle:m,elementFontStyle:h,builderData:g,swr:{fallback:P},moneyFormat:y?.shop.moneyFormat??null,currency:y?.localization.country.currency.isoCode??null,languageIsoCode:I,countryIsoCode:A,locale:L,swatches:parseJson.parseJson(b?.storeProperty?.swatchesConfig),seo:_,mobileOnly:f,disableGsFont:M,gaTrackingId:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_GA_TRACKING_ID,r?.metafields)??null,facebookPixelId:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_FB_PIXEL_ID,r?.metafields)??null,tiktokPixelId:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_TIKTOK_PIXEL_ID,r?.metafields)??null,customCodeHeader:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_HEADER,r?.metafields)??null,customCodeBody:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_BODY,r?.metafields)??null,pageHandle:r.handle??null,customFonts:p})}catch(e){throw nextjs.captureException(e),e}};exports.getHomePagePropsV2=getHomePagePropsV2;
|
|
@@ -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,t)=>async a=>{try{let l="STATIC",i={slug:a,slugType:l},[s,o,d,n]=await Promise.allSettled([e([core.PublishedThemePagesDocument,i]),e([core.StorePropertyDocument.toString()]),t([adapterShopify.ShopMetaDocument]),e([core.PublishedShopMetasDocument,{keys:["source_font",index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL]}])]);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"),g=s.value.publishedThemePages?.[0],h=s.value?.publishedThemePages?.[0]?.themePageCustomFonts;if(!g)throw Error(`No data builder found for slug: /${a}`);let P=normalize.parseBuilderTemplateV2(g),[m,f,c,p]=await Promise.all([googleFonts.getStaticFontFacesFromPageTemplate({pageTemplate:P,sourceFont:u?.value,data:g?.pageStyle?.data}),googleFonts.getStaticFontFacesFromGlobalStyle({data:g?.pageStyle?.data,sourceFont:u?.value}),getFallback.getFallbackV2(e,P),customFonts.getCustomFonts(h)]),T=g.isMobile??!1,M=getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,g?.metafields)||r?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value,y=getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_TITLE,g?.metafields)||r?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.GLOBAL_META_TITLE)?.value,b=parseJson.parseJson(getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL,g?.metafields)||r?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value),S=getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.NOINDEX_KEY,g?.metafields)||r?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.NOINDEX_KEY)?.value,_=getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.NOFOLLOW_KEY,g?.metafields)||r?.publishedShopMetas?.find(e=>e?.key===index.PublishedThemePageMetafields.NOFOLLOW_KEY)?.value;console.log("\uD83D\uDE80 ~ getStaticPagePropsV2 ~ dataBuilder?.metafields:",g?.metafields);let L="true"===getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ILP_DISABLE_GS_FONT,g?.metafields);console.log("\uD83D\uDE80 ~ getStaticPagePropsV2 ~ disableGsFont 1:",L);let I="fulfilled"===d.status?d.value:void 0,x="fulfilled"===o.status?o.value:void 0,A=x?.storeProperty?.favicon??"/favicon/favicon-32x32.png",B={defaultTitle:I?.shop.name,title:y||g?.name,description:M??I?.shop.description,openGraph:{locale:I?.localization.country.isoCode,title:(y||g?.name)??I?.shop.name,description:M??I?.shop.description,images:b?[b]:[]},noindex:"true"===S,nofollow:"true"===_,canonical:`https://${x?.storeProperty?.primaryDomain}/${a}`,additionalMetaTags:[{name:"theme-color",content:"#000000"}],additionalLinkTags:generateSeoLinks.generateSeoLinks({favicon:A,shopMeta:I})},E=I?.localization.language.isoCode??null,F=I?.localization.country.isoCode??null,O=E&&F?`${E}-${F}`:null;return parseJson.serializableJson({id:s.value?.publishedThemePages?.[0]?.id??null,shopID:s.value?.publishedThemePages?.[0]?.shopID??null,themeStyle:genCss.genCSS(g?.pageStyle?.data,T),fontStyle:f,elementFontStyle:m,builderData:P,pageType:l,moneyFormat:I?.shop.moneyFormat??null,currency:I?.localization.country.currency.isoCode??null,languageIsoCode:E,countryIsoCode:F,locale:O,swr:{fallback:c},swatches:parseJson.parseJson(x?.storeProperty?.swatchesConfig),seo:B,mobileOnly:T,disableGsFont:L,gaTrackingId:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_GA_TRACKING_ID,g?.metafields)??null,facebookPixelId:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_FB_PIXEL_ID,g?.metafields)??null,tiktokPixelId:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_TIKTOK_PIXEL_ID,g?.metafields)??null,customCodeHeader:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_HEADER,g?.metafields)??null,customCodeBody:getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_BODY,g?.metafields)??null,pageHandle:g.handle??null,customFonts:p,interaction:g?.interaction,pageBackground:normalize.extractPageBackground(g)})}catch(e){throw nextjs.captureException(e),e}};exports.getStaticPagePropsV2=getStaticPagePropsV2;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),nextSeo=require("next-seo"),Head=require("next/head"),router=require("next/router"),useTrackingView=require("../libs/hooks/use-tracking-view.js"),parseHtml=require("../libs/parse-html.js"),Header=require("../components/builder/Header.js"),FooterForPostPurchase=require("../components/FooterForPostPurchase.js"),Script=require("next/script"),react=require("react"),usePageViewedTracking=require("../libs/hooks/usePageViewedTracking.js"),FontLink=require("../components/FontLink.js");const StaticPageV2=({components:e,builderData:s,sectionData:t,seo:r,themeStyle:i,fontStyle:n,elementFontStyle:a,customCodeHeader:o,shopToken:u,pageHandle:l,customFonts:c,isPostPurchase:d,shopName:g,productOffers:m,publicStoreFrontData:p,dynamicDiscountOffer:x,isPreview:j,interaction:h,pageBackground:f,sellingPlanSetting:R,buyerConsentPreCheck:P,id:k,shopID:y,domainTrackingIlp:_})=>{let
|
|
1
|
+
"use strict";var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),nextSeo=require("next-seo"),Head=require("next/head"),router=require("next/router"),useTrackingView=require("../libs/hooks/use-tracking-view.js"),parseHtml=require("../libs/parse-html.js"),Header=require("../components/builder/Header.js"),FooterForPostPurchase=require("../components/FooterForPostPurchase.js"),Script=require("next/script"),react=require("react"),usePageViewedTracking=require("../libs/hooks/usePageViewedTracking.js"),FontLink=require("../components/FontLink.js");const StaticPageV2=({components:e,builderData:s,sectionData:t,seo:r,themeStyle:i,fontStyle:n,elementFontStyle:a,customCodeHeader:o,shopToken:u,pageHandle:l,customFonts:c,isPostPurchase:d,shopName:g,productOffers:m,publicStoreFrontData:p,dynamicDiscountOffer:x,isPreview:j,interaction:h,pageBackground:f,sellingPlanSetting:R,buyerConsentPreCheck:P,id:k,shopID:y,domainTrackingIlp:_,disableGsFont:S})=>{let v=router.useRouter(),{t:b}=core.useI18n(),q=process.env.NEXT_GP_BASE_ASSET_URL||"https://assets.gemcommerce.xyz";useTrackingView.useTrackingView(u,l,v.isFallback),usePageViewedTracking.usePageViewedTracking({id:k,shopID:y,domain:_});let F="custom-code-header";if(react.useEffect(()=>{let e=document.querySelectorAll(`[class*="${F}-"]`),s=[];e.length>1&&e.forEach(e=>{let t=e.className;if(s.includes(t)){e.remove();return}s.push(t)})},[]),v.isFallback)return jsxRuntime.jsx("div",{className:"gp-flex gp-h-[100vh] gp-items-center gp-justify-center",children:jsxRuntime.jsxs("div",{className:"gp-flex gp-gap-2",children:[jsxRuntime.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"}),jsxRuntime.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"}),jsxRuntime.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"})]})});let T=(h?.value||[]).length>0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(nextSeo.NextSeo,{...r}),jsxRuntime.jsxs(Head,{children:[parseHtml.parseHtml(F,o,!0),i&&jsxRuntime.jsx("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:i}},"global-style"),c&&jsxRuntime.jsx("style",{"data-id":"custom-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:c}},n),f?.isUsePageBackground&&f?.background&&jsxRuntime.jsx("style",{children:`
|
|
2
2
|
body {
|
|
3
3
|
background: ${f.background};
|
|
4
4
|
}
|
|
5
|
-
`},`page_background_${f?.background}`)]}),n&&jsxRuntime.jsx(FontLink.FontLink,{fontStyle:n,dataId:"google-fonts"}),a&&a.map((e,s)=>jsxRuntime.jsx(FontLink.FontLink,{fontStyle:e,dataId:"google-element-fonts"},s)),jsxRuntime.jsx(core.PageProvider,{productOffers:m,publicStoreFrontData:p,dynamicDiscountOffer:x,sellingPlanMeta:R,buyerConsentChecked:P,children:jsxRuntime.jsx(core.BuilderComponentProvider,{components:e,children:jsxRuntime.jsx(core.I18nProvider,{t:
|
|
5
|
+
`},`page_background_${f?.background}`)]}),n&&!S&&jsxRuntime.jsx(FontLink.FontLink,{fontStyle:n,dataId:"google-fonts"}),a&&a.map((e,s)=>jsxRuntime.jsx(FontLink.FontLink,{fontStyle:e,dataId:"google-element-fonts"},s)),jsxRuntime.jsx(core.PageProvider,{productOffers:m,publicStoreFrontData:p,dynamicDiscountOffer:x,sellingPlanMeta:R,buyerConsentChecked:P,children:jsxRuntime.jsx(core.BuilderComponentProvider,{components:e,children:jsxRuntime.jsx(core.I18nProvider,{t:b,children:jsxRuntime.jsxs("div",{className:`${d?"gp-bg-white post-purchase-page":""} `,role:"main",children:[d&&jsxRuntime.jsx(Header.default,{pageType:"POST_PURCHASE"}),T&&jsxRuntime.jsx("div",{dangerouslySetInnerHTML:{__html:`<div id="gp-interaction" style="display: none;">${JSON.stringify(h?.value||[])}</div>`}}),jsxRuntime.jsx(core.SectionProvider,{data:t,children:s?.map(e=>jsxRuntime.jsxs(core.BuilderProvider,{state:e.data,lazy:e.lazy,priority:e.priority,isPostPurchase:d,isPreview:j,children:[jsxRuntime.jsx(core.Render,{uid:e.uid}),T&&jsxRuntime.jsx(Script,{defer:!0,src:`${q}/assets-v2/gp-flow-action-lip-v7-5.js`})]},e.uid))}),d&&jsxRuntime.jsx(FooterForPostPurchase.default,{shopName:g||""})]})})})})]})};exports.StaticPageV2=StaticPageV2;
|
|
@@ -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",_.ILP_DISABLE_GS_FONT="ilp_disable_gs_font"}(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{getStaticFontFacesFromPageTemplate as l,getStaticFontFacesFromGlobalStyle 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}from"../helpers/normalize.js";import{parseJson as m,serializableJson as d}from"../helpers/parse-json.js";import{captureException as p}from"@sentry/nextjs";import{PublishedThemePageMetafields as u}from"../../constants/index.js";import{getPublishedThemePageMetafieldByKey as f}from"../helpers/get-metafield.js";import{getCustomFonts as c}from"../custom-fonts.js";import{generateSeoLinks as h}from"../helpers/generate-seo-links.js";let getHomePagePropsV2=(g,T)=>async()=>{try{let p={slugType:"STATIC"},[_,
|
|
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{getStaticFontFacesFromPageTemplate as l,getStaticFontFacesFromGlobalStyle 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}from"../helpers/normalize.js";import{parseJson as m,serializableJson as d}from"../helpers/parse-json.js";import{captureException as p}from"@sentry/nextjs";import{PublishedThemePageMetafields as u}from"../../constants/index.js";import{getPublishedThemePageMetafieldByKey as f}from"../helpers/get-metafield.js";import{getCustomFonts as c}from"../custom-fonts.js";import{generateSeoLinks as h}from"../helpers/generate-seo-links.js";let getHomePagePropsV2=(g,T)=>async()=>{try{let p={slugType:"STATIC"},[_,I,A,y]=await Promise.allSettled([g([e,p]),g([o.toString()]),T([a]),g([t,{keys:["source_font",u.GLOBAL_META_DESCRIPTION,u.GLOBAL_META_THUMBNAIL]}])]);if("rejected"===_.status)throw Error(_.reason?.[0]);let L="fulfilled"===y.status?y.value:void 0,P=L?.publishedShopMetas?.find(e=>e?.key==="source_font"),C=_.value?.publishedThemePages?.[0],S=_.value?.publishedThemePages?.[0]?.themePageCustomFonts;if(!C)throw Error("No data builder found for Home page");let E=n(C),[v,M,O,D]=await Promise.all([l({pageTemplate:E,sourceFont:P?.value,data:C?.pageStyle?.data}),s({data:C?.pageStyle?.data,sourceFont:P?.value}),r(g,E),c(S)]),k=C.isMobile??!1,B=f(u.GLOBAL_META_DESCRIPTION,C?.metafields)||L?.publishedShopMetas?.find(e=>e?.key===u.GLOBAL_META_DESCRIPTION)?.value,b=m(f(u.GLOBAL_META_THUMBNAIL,C?.metafields)||L?.publishedShopMetas?.find(e=>e?.key===u.GLOBAL_META_THUMBNAIL)?.value),j="true"===f(u.ILP_DISABLE_GS_FONT,C?.metafields),N="fulfilled"===A.status?A.value:void 0,G="fulfilled"===I.status?I.value:void 0,H=G?.storeProperty?.favicon??"/favicon/favicon-32x32.png",w={defaultTitle:N?.shop.name,title:C?.name??"Home",description:B??N?.shop.description,openGraph:{locale:N?.localization.country.isoCode,title:C?.name??N?.shop.name,description:B??N?.shop.description,images:b?[b]:[]},additionalMetaTags:[{name:"theme-color",content:"#000000"}],canonical:`https://${G?.storeProperty?.primaryDomain}/`,additionalLinkTags:h({favicon:H,shopMeta:N})},F=N?.localization.language.isoCode??null,x=N?.localization.country.isoCode??null,z=F&&x?`${F}-${x}`:null;return d({id:_.value?.publishedThemePages?.[0]?.id??null,shopID:_.value?.publishedThemePages?.[0]?.shopID??null,themeStyle:i(C?.pageStyle?.data,k),fontStyle:M,elementFontStyle:v,builderData:E,swr:{fallback:O},moneyFormat:N?.shop.moneyFormat??null,currency:N?.localization.country.currency.isoCode??null,languageIsoCode:F,countryIsoCode:x,locale:z,swatches:m(G?.storeProperty?.swatchesConfig),seo:w,mobileOnly:k,disableGsFont:j,gaTrackingId:f(u.ANALYTICS_GA_TRACKING_ID,C?.metafields)??null,facebookPixelId:f(u.ANALYTICS_FB_PIXEL_ID,C?.metafields)??null,tiktokPixelId:f(u.ANALYTICS_TIKTOK_PIXEL_ID,C?.metafields)??null,customCodeHeader:f(u.CUSTOM_CODE_HEADER,C?.metafields)??null,customCodeBody:f(u.CUSTOM_CODE_BODY,C?.metafields)??null,pageHandle:C.handle??null,customFonts:D})}catch(e){throw p(e),e}};export{getHomePagePropsV2};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PublishedThemePagesDocument as e,StorePropertyDocument as
|
|
1
|
+
import{PublishedThemePagesDocument as e,StorePropertyDocument as t,PublishedShopMetasDocument as o}from"@gem-sdk/core";import{ShopMetaDocument as a}from"@gem-sdk/adapter-shopify";import{getStaticFontFacesFromPageTemplate as l,getStaticFontFacesFromGlobalStyle 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 c}from"../helpers/get-metafield.js";import{PublishedThemePageMetafields as h}from"../../constants/index.js";import{generateSeoLinks as g}from"../helpers/generate-seo-links.js";let getStaticPagePropsV2=(T,_)=>async L=>{try{let m="STATIC",I={slug:L,slugType:m},[A,y,E,S]=await Promise.allSettled([T([e,I]),T([t.toString()]),_([a]),T([o,{keys:["source_font",h.GLOBAL_META_DESCRIPTION,h.GLOBAL_META_THUMBNAIL]}])]);if("rejected"===A.status)throw Error(A.reason?.[0]);let O="fulfilled"===S.status?S.value:void 0,P=O?.publishedShopMetas?.find(e=>e?.key==="source_font"),M=A.value.publishedThemePages?.[0],v=A.value?.publishedThemePages?.[0]?.themePageCustomFonts;if(!M)throw Error(`No data builder found for slug: /${L}`);let C=n(M),[N,k,B,D]=await Promise.all([l({pageTemplate:C,sourceFont:P?.value,data:M?.pageStyle?.data}),s({data:M?.pageStyle?.data,sourceFont:P?.value}),r(T,C),f(v)]),b=M.isMobile??!1,G=c(h.GLOBAL_META_DESCRIPTION,M?.metafields)||O?.publishedShopMetas?.find(e=>e?.key===h.GLOBAL_META_DESCRIPTION)?.value,j=c(h.GLOBAL_META_TITLE,M?.metafields)||O?.publishedShopMetas?.find(e=>e?.key===h.GLOBAL_META_TITLE)?.value,F=u(c(h.GLOBAL_META_THUMBNAIL,M?.metafields)||O?.publishedShopMetas?.find(e=>e?.key===h.GLOBAL_META_THUMBNAIL)?.value),w=c(h.NOINDEX_KEY,M?.metafields)||O?.publishedShopMetas?.find(e=>e?.key===h.NOINDEX_KEY)?.value,Y=c(h.NOFOLLOW_KEY,M?.metafields)||O?.publishedShopMetas?.find(e=>e?.key===h.NOFOLLOW_KEY)?.value;console.log("\uD83D\uDE80 ~ getStaticPagePropsV2 ~ dataBuilder?.metafields:",M?.metafields);let x="true"===c(h.ILP_DISABLE_GS_FONT,M?.metafields);console.log("\uD83D\uDE80 ~ getStaticPagePropsV2 ~ disableGsFont 1:",x);let K="fulfilled"===E.status?E.value:void 0,H="fulfilled"===y.status?y.value:void 0,z=H?.storeProperty?.favicon??"/favicon/favicon-32x32.png",R={defaultTitle:K?.shop.name,title:j||M?.name,description:G??K?.shop.description,openGraph:{locale:K?.localization.country.isoCode,title:(j||M?.name)??K?.shop.name,description:G??K?.shop.description,images:F?[F]:[]},noindex:"true"===w,nofollow:"true"===Y,canonical:`https://${H?.storeProperty?.primaryDomain}/${L}`,additionalMetaTags:[{name:"theme-color",content:"#000000"}],additionalLinkTags:g({favicon:z,shopMeta:K})},U=K?.localization.language.isoCode??null,$=K?.localization.country.isoCode??null,V=U&&$?`${U}-${$}`:null;return p({id:A.value?.publishedThemePages?.[0]?.id??null,shopID:A.value?.publishedThemePages?.[0]?.shopID??null,themeStyle:i(M?.pageStyle?.data,b),fontStyle:k,elementFontStyle:N,builderData:C,pageType:m,moneyFormat:K?.shop.moneyFormat??null,currency:K?.localization.country.currency.isoCode??null,languageIsoCode:U,countryIsoCode:$,locale:V,swr:{fallback:B},swatches:u(H?.storeProperty?.swatchesConfig),seo:R,mobileOnly:b,disableGsFont:x,gaTrackingId:c(h.ANALYTICS_GA_TRACKING_ID,M?.metafields)??null,facebookPixelId:c(h.ANALYTICS_FB_PIXEL_ID,M?.metafields)??null,tiktokPixelId:c(h.ANALYTICS_TIKTOK_PIXEL_ID,M?.metafields)??null,customCodeHeader:c(h.CUSTOM_CODE_HEADER,M?.metafields)??null,customCodeBody:c(h.CUSTOM_CODE_BODY,M?.metafields)??null,pageHandle:M.handle??null,customFonts:D,interaction:M?.interaction,pageBackground:d(M)})}catch(e){throw m(e),e}};export{getStaticPagePropsV2};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{useI18n as s,PageProvider as r,BuilderComponentProvider as n,I18nProvider as o,SectionProvider as i,BuilderProvider as l,Render as p}from"@gem-sdk/core";import{NextSeo as c}from"next-seo";import m from"next/head";import{useRouter as d}from"next/router";import{useTrackingView as g}from"../libs/hooks/use-tracking-view.js";import{parseHtml as u}from"../libs/parse-html.js";import f from"../components/builder/Header.js";import h from"../components/FooterForPostPurchase.js";import y from"next/script";import{useEffect as _}from"react";import{usePageViewedTracking as b}from"../libs/hooks/usePageViewedTracking.js";import{FontLink as k}from"../components/FontLink.js";let StaticPageV2=({components:v,builderData:S,sectionData:P,seo:x,themeStyle:N,fontStyle:j,elementFontStyle:T,customCodeHeader:F,shopToken:I,pageHandle:$,customFonts:w,isPostPurchase:E,shopName:H,productOffers:L,publicStoreFrontData:q,dynamicDiscountOffer:A,isPreview:M,interaction:O,pageBackground:z,sellingPlanSetting:C,buyerConsentPreCheck:D,id:U,shopID:V,domainTrackingIlp:B})=>{let
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{useI18n as s,PageProvider as r,BuilderComponentProvider as n,I18nProvider as o,SectionProvider as i,BuilderProvider as l,Render as p}from"@gem-sdk/core";import{NextSeo as c}from"next-seo";import m from"next/head";import{useRouter as d}from"next/router";import{useTrackingView as g}from"../libs/hooks/use-tracking-view.js";import{parseHtml as u}from"../libs/parse-html.js";import f from"../components/builder/Header.js";import h from"../components/FooterForPostPurchase.js";import y from"next/script";import{useEffect as _}from"react";import{usePageViewedTracking as b}from"../libs/hooks/usePageViewedTracking.js";import{FontLink as k}from"../components/FontLink.js";let StaticPageV2=({components:v,builderData:S,sectionData:P,seo:x,themeStyle:N,fontStyle:j,elementFontStyle:T,customCodeHeader:F,shopToken:I,pageHandle:$,customFonts:w,isPostPurchase:E,shopName:H,productOffers:L,publicStoreFrontData:q,dynamicDiscountOffer:A,isPreview:M,interaction:O,pageBackground:z,sellingPlanSetting:C,buyerConsentPreCheck:D,id:U,shopID:V,domainTrackingIlp:B,disableGsFont:R})=>{let G=d(),{t:J}=s(),X=process.env.NEXT_GP_BASE_ASSET_URL||"https://assets.gemcommerce.xyz";g(I,$,G.isFallback),b({id:U,shopID:V,domain:B});let K="custom-code-header";if(_(()=>{let e=document.querySelectorAll(`[class*="${K}-"]`),t=[];e.length>1&&e.forEach(e=>{let a=e.className;if(t.includes(a)){e.remove();return}t.push(a)})},[]),G.isFallback)return e("div",{className:"gp-flex gp-h-[100vh] gp-items-center gp-justify-center",children:t("div",{className:"gp-flex gp-gap-2",children:[e("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"}),e("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"}),e("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"})]})});let Q=(O?.value||[]).length>0;return t(a,{children:[e(c,{...x}),t(m,{children:[u(K,F,!0),N&&e("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:N}},"global-style"),w&&e("style",{"data-id":"custom-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:w}},j),z?.isUsePageBackground&&z?.background&&e("style",{children:`
|
|
2
2
|
body {
|
|
3
3
|
background: ${z.background};
|
|
4
4
|
}
|
|
5
|
-
`},`page_background_${z?.background}`)]}),j&&e(k,{fontStyle:j,dataId:"google-fonts"}),T&&T.map((t,a)=>e(k,{fontStyle:t,dataId:"google-element-fonts"},a)),e(r,{productOffers:L,publicStoreFrontData:q,dynamicDiscountOffer:A,sellingPlanMeta:C,buyerConsentChecked:D,children:e(n,{components:v,children:e(o,{t:
|
|
5
|
+
`},`page_background_${z?.background}`)]}),j&&!R&&e(k,{fontStyle:j,dataId:"google-fonts"}),T&&T.map((t,a)=>e(k,{fontStyle:t,dataId:"google-element-fonts"},a)),e(r,{productOffers:L,publicStoreFrontData:q,dynamicDiscountOffer:A,sellingPlanMeta:C,buyerConsentChecked:D,children:e(n,{components:v,children:e(o,{t:J,children:t("div",{className:`${E?"gp-bg-white post-purchase-page":""} `,role:"main",children:[E&&e(f,{pageType:"POST_PURCHASE"}),Q&&e("div",{dangerouslySetInnerHTML:{__html:`<div id="gp-interaction" style="display: none;">${JSON.stringify(O?.value||[])}</div>`}}),e(i,{data:P,children:S?.map(a=>t(l,{state:a.data,lazy:a.lazy,priority:a.priority,isPostPurchase:E,isPreview:M,children:[e(p,{uid:a.uid}),Q&&e(y,{defer:!0,src:`${X}/assets-v2/gp-flow-action-lip-v7-5.js`})]},a.uid))}),E&&e(h,{shopName:H||""})]})})})})]})};export{StaticPageV2};
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/pages",
|
|
3
|
-
"version": "17.0.0-staging.
|
|
3
|
+
"version": "17.0.0-staging.22",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"next": "14.2.35"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@gem-sdk/core": "17.0.0-staging.
|
|
31
|
-
"@gem-sdk/plugin-cookie-bar": "
|
|
32
|
-
"@gem-sdk/plugin-quick-view": "
|
|
33
|
-
"@gem-sdk/plugin-sticky-add-to-cart": "
|
|
30
|
+
"@gem-sdk/core": "17.0.0-staging.20",
|
|
31
|
+
"@gem-sdk/plugin-cookie-bar": "17.0.0-staging.20",
|
|
32
|
+
"@gem-sdk/plugin-quick-view": "17.0.0-staging.20",
|
|
33
|
+
"@gem-sdk/plugin-sticky-add-to-cart": "17.0.0-staging.20"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"next": "14.2.35"
|