@sonordev/site-kit 5.3.2 → 5.4.0
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/README.md +17 -0
- package/agent-manifest.json +5 -4
- package/dist/AnalyticsProvider-2XIOMRCN.mjs +11 -0
- package/dist/{AnalyticsProvider-2XK54UZW.mjs.map → AnalyticsProvider-2XIOMRCN.mjs.map} +1 -1
- package/dist/AnalyticsProvider-Y2P2BPOI.js +32 -0
- package/dist/{AnalyticsProvider-PM7SOGOS.js.map → AnalyticsProvider-Y2P2BPOI.js.map} +1 -1
- package/dist/{BlogViewTracker-3BIUF5TI.js → BlogViewTracker-6EGEDPP3.js} +6 -6
- package/dist/{BlogViewTracker-3BIUF5TI.js.map → BlogViewTracker-6EGEDPP3.js.map} +1 -1
- package/dist/{BlogViewTracker-KFUDRDQK.mjs → BlogViewTracker-R4YQ76WP.mjs} +5 -5
- package/dist/{BlogViewTracker-KFUDRDQK.mjs.map → BlogViewTracker-R4YQ76WP.mjs.map} +1 -1
- package/dist/ChatWidget-2OFWPCWF.js +20 -0
- package/dist/{ChatWidget-7BYSGNO2.js.map → ChatWidget-2OFWPCWF.js.map} +1 -1
- package/dist/ChatWidget-4AOGHYXQ.mjs +11 -0
- package/dist/{ChatWidget-4PHZHGG5.mjs.map → ChatWidget-4AOGHYXQ.mjs.map} +1 -1
- package/dist/EngageWidget-SFO2XRNG.mjs +9 -0
- package/dist/{EngageWidget-D6M6QWEC.mjs.map → EngageWidget-SFO2XRNG.mjs.map} +1 -1
- package/dist/EngageWidget-T4KAAD3G.js +18 -0
- package/dist/{EngageWidget-Q4ITKTMJ.js.map → EngageWidget-T4KAAD3G.js.map} +1 -1
- package/dist/{FileField-PQQDX4IR.mjs → FileField-7DF2SLPF.mjs} +5 -5
- package/dist/{FileField-PQQDX4IR.mjs.map → FileField-7DF2SLPF.mjs.map} +1 -1
- package/dist/{FileField-YBBIJOCK.js → FileField-CE2XNBBG.js} +6 -6
- package/dist/{FileField-YBBIJOCK.js.map → FileField-CE2XNBBG.js.map} +1 -1
- package/dist/{FormSpotlight-7TIIWFTP.mjs → FormSpotlight-IRLKSZGV.mjs} +3 -3
- package/dist/{FormSpotlight-7TIIWFTP.mjs.map → FormSpotlight-IRLKSZGV.mjs.map} +1 -1
- package/dist/{FormSpotlight-WUN24F3P.js → FormSpotlight-ZD3WR5BC.js} +15 -15
- package/dist/{FormSpotlight-WUN24F3P.js.map → FormSpotlight-ZD3WR5BC.js.map} +1 -1
- package/dist/{FormStage-TFN2GIBO.mjs → FormStage-2OSRNQJL.mjs} +3 -3
- package/dist/{FormStage-TFN2GIBO.mjs.map → FormStage-2OSRNQJL.mjs.map} +1 -1
- package/dist/{FormStage-CM7OVLUT.js → FormStage-OSPXOUQE.js} +13 -13
- package/dist/{FormStage-CM7OVLUT.js.map → FormStage-OSPXOUQE.js.map} +1 -1
- package/dist/ManagedForm-5G37EDJT.mjs +14 -0
- package/dist/{ManagedForm-ZUXLHEQU.mjs.map → ManagedForm-5G37EDJT.mjs.map} +1 -1
- package/dist/ManagedForm-JCHGBBQW.js +23 -0
- package/dist/{ManagedForm-N63YGVNY.js.map → ManagedForm-JCHGBBQW.js.map} +1 -1
- package/dist/{ManagedNewsletterForm-PIVJTU5L.js → ManagedNewsletterForm-4LVJZROZ.js} +8 -8
- package/dist/{ManagedNewsletterForm-PIVJTU5L.js.map → ManagedNewsletterForm-4LVJZROZ.js.map} +1 -1
- package/dist/{ManagedNewsletterForm-4AVKTZ2A.mjs → ManagedNewsletterForm-QJSVH23S.mjs} +7 -7
- package/dist/{ManagedNewsletterForm-4AVKTZ2A.mjs.map → ManagedNewsletterForm-QJSVH23S.mjs.map} +1 -1
- package/dist/{SignalCore-LT4NCPOR.mjs → SignalCore-L6Z3YTCF.mjs} +5 -5
- package/dist/{SignalCore-LT4NCPOR.mjs.map → SignalCore-L6Z3YTCF.mjs.map} +1 -1
- package/dist/{SignalCore-2M5TISM7.js → SignalCore-NQ4YEOI7.js} +11 -11
- package/dist/{SignalCore-2M5TISM7.js.map → SignalCore-NQ4YEOI7.js.map} +1 -1
- package/dist/SitemapSync-3LUZWBTB.js +18 -0
- package/dist/{SitemapSync-7OBOJG2L.js.map → SitemapSync-3LUZWBTB.js.map} +1 -1
- package/dist/SitemapSync-MYSTLJOM.mjs +9 -0
- package/dist/{SitemapSync-G3OLECFI.mjs.map → SitemapSync-MYSTLJOM.mjs.map} +1 -1
- package/dist/analytics/index.js +9 -9
- package/dist/analytics/index.mjs +4 -4
- package/dist/blog/AuthorPage.d.ts +1 -1
- package/dist/blog/AuthorPage.d.ts.map +1 -1
- package/dist/blog/BlogLayout.d.ts +3 -1
- package/dist/blog/BlogLayout.d.ts.map +1 -1
- package/dist/blog/BlogList.d.ts +3 -1
- package/dist/blog/BlogList.d.ts.map +1 -1
- package/dist/blog/BlogPost.d.ts +3 -1
- package/dist/blog/BlogPost.d.ts.map +1 -1
- package/dist/blog/BlogSidebar.d.ts +3 -1
- package/dist/blog/BlogSidebar.d.ts.map +1 -1
- package/dist/blog/ClusterLandingPage.d.ts +3 -1
- package/dist/blog/ClusterLandingPage.d.ts.map +1 -1
- package/dist/blog/ClusterNavigation.d.ts +3 -1
- package/dist/blog/ClusterNavigation.d.ts.map +1 -1
- package/dist/blog/RelatedPosts.d.ts +4 -1
- package/dist/blog/RelatedPosts.d.ts.map +1 -1
- package/dist/blog/artwork-components.test.d.ts +2 -0
- package/dist/blog/artwork-components.test.d.ts.map +1 -0
- package/dist/blog/artwork.d.ts +14 -0
- package/dist/blog/artwork.d.ts.map +1 -0
- package/dist/blog/artwork.test.d.ts +2 -0
- package/dist/blog/artwork.test.d.ts.map +1 -0
- package/dist/blog/blog-styles.d.ts.map +1 -1
- package/dist/blog/blog-tables.d.ts +13 -0
- package/dist/blog/blog-tables.d.ts.map +1 -0
- package/dist/blog/blog-tables.test.d.ts +2 -0
- package/dist/blog/blog-tables.test.d.ts.map +1 -0
- package/dist/blog/index.d.ts +3 -0
- package/dist/blog/index.d.ts.map +1 -1
- package/dist/blog/index.js +52 -30
- package/dist/blog/index.js.map +1 -1
- package/dist/blog/index.mjs +15 -12
- package/dist/blog/index.mjs.map +1 -1
- package/dist/blog/publication-render.test.d.ts +2 -0
- package/dist/blog/publication-render.test.d.ts.map +1 -0
- package/dist/blog/publication-routes.test.d.ts +2 -0
- package/dist/blog/publication-routes.test.d.ts.map +1 -0
- package/dist/blog/routes.d.ts +40 -0
- package/dist/blog/routes.d.ts.map +1 -0
- package/dist/blog/server-core.d.ts +28 -21
- package/dist/blog/server-core.d.ts.map +1 -1
- package/dist/blog/server-ui.d.ts +4 -0
- package/dist/blog/server-ui.d.ts.map +1 -1
- package/dist/blog/server-ui.js +49 -28
- package/dist/blog/server-ui.js.map +1 -1
- package/dist/blog/server-ui.mjs +9 -15
- package/dist/blog/server-ui.mjs.map +1 -1
- package/dist/blog/server.d.ts +28 -21
- package/dist/blog/server.d.ts.map +1 -1
- package/dist/blog/server.js +71 -42
- package/dist/blog/server.mjs +3 -2
- package/dist/blog/types.d.ts +8 -1
- package/dist/blog/types.d.ts.map +1 -1
- package/dist/blog-styles-6EY3BS5Y.js +595 -0
- package/dist/blog-styles-6EY3BS5Y.js.map +1 -0
- package/dist/blog-styles-7AKRUMV7.mjs +592 -0
- package/dist/blog-styles-7AKRUMV7.mjs.map +1 -0
- package/dist/blog-tables-DWDEWA3S.js +17 -0
- package/dist/blog-tables-DWDEWA3S.js.map +1 -0
- package/dist/blog-tables-QGIHOESZ.mjs +4 -0
- package/dist/blog-tables-QGIHOESZ.mjs.map +1 -0
- package/dist/{chunk-M7FWXEXC.js → chunk-2KIGFOPM.js} +5 -5
- package/dist/{chunk-M7FWXEXC.js.map → chunk-2KIGFOPM.js.map} +1 -1
- package/dist/chunk-4B4S56WJ.mjs +110 -0
- package/dist/chunk-4B4S56WJ.mjs.map +1 -0
- package/dist/{chunk-PZXKFHPO.js → chunk-4WQB2ORG.js} +14 -14
- package/dist/{chunk-PZXKFHPO.js.map → chunk-4WQB2ORG.js.map} +1 -1
- package/dist/{chunk-XQZTOWS3.js → chunk-5737U6DI.js} +14 -14
- package/dist/{chunk-XQZTOWS3.js.map → chunk-5737U6DI.js.map} +1 -1
- package/dist/{chunk-ZOJ3TLO5.mjs → chunk-6CUBSQMD.mjs} +3 -3
- package/dist/{chunk-ZOJ3TLO5.mjs.map → chunk-6CUBSQMD.mjs.map} +1 -1
- package/dist/{chunk-JBGRXICL.js → chunk-746RKQHA.js} +75 -70
- package/dist/chunk-746RKQHA.js.map +1 -0
- package/dist/{chunk-E33HJMRP.js → chunk-7IPSQ5JR.js} +6 -6
- package/dist/{chunk-E33HJMRP.js.map → chunk-7IPSQ5JR.js.map} +1 -1
- package/dist/{chunk-FDVE56JS.js → chunk-7PLH3H3W.js} +3 -3
- package/dist/{chunk-FDVE56JS.js.map → chunk-7PLH3H3W.js.map} +1 -1
- package/dist/chunk-7U7C6XRI.mjs +6 -0
- package/dist/{chunk-OUERH2T4.mjs.map → chunk-7U7C6XRI.mjs.map} +1 -1
- package/dist/{chunk-DZDWBQKA.mjs → chunk-7Y2UPFSY.mjs} +3 -3
- package/dist/{chunk-DZDWBQKA.mjs.map → chunk-7Y2UPFSY.mjs.map} +1 -1
- package/dist/{chunk-JSLYNYTB.mjs → chunk-A2VLEORI.mjs} +3 -3
- package/dist/{chunk-JSLYNYTB.mjs.map → chunk-A2VLEORI.mjs.map} +1 -1
- package/dist/{chunk-6QABCGM6.mjs → chunk-ACTLQ2RH.mjs} +3 -3
- package/dist/{chunk-6QABCGM6.mjs.map → chunk-ACTLQ2RH.mjs.map} +1 -1
- package/dist/{chunk-PEEQMI7U.js → chunk-AWFZIXCT.js} +11 -11
- package/dist/{chunk-PEEQMI7U.js.map → chunk-AWFZIXCT.js.map} +1 -1
- package/dist/{chunk-HVFXFPUJ.mjs → chunk-B36PTS7B.mjs} +413 -94
- package/dist/chunk-B36PTS7B.mjs.map +1 -0
- package/dist/{chunk-KPFPSOYS.js → chunk-DPDV5Z4G.js} +12 -12
- package/dist/{chunk-KPFPSOYS.js.map → chunk-DPDV5Z4G.js.map} +1 -1
- package/dist/{chunk-JTO3K5B7.mjs → chunk-DQM5GR2P.mjs} +4 -4
- package/dist/{chunk-JTO3K5B7.mjs.map → chunk-DQM5GR2P.mjs.map} +1 -1
- package/dist/{chunk-HDQTZAGE.mjs → chunk-EBMPXFOP.mjs} +3 -3
- package/dist/{chunk-HDQTZAGE.mjs.map → chunk-EBMPXFOP.mjs.map} +1 -1
- package/dist/{chunk-DHXQBTXE.mjs → chunk-EEQYKMGH.mjs} +75 -70
- package/dist/chunk-EEQYKMGH.mjs.map +1 -0
- package/dist/{chunk-6VG65AIA.mjs → chunk-G5I3XEQS.mjs} +3 -3
- package/dist/{chunk-6VG65AIA.mjs.map → chunk-G5I3XEQS.mjs.map} +1 -1
- package/dist/chunk-GHECYDSZ.mjs +134 -0
- package/dist/chunk-GHECYDSZ.mjs.map +1 -0
- package/dist/{chunk-6AZTRTCG.js → chunk-GQ6CUOLA.js} +15 -15
- package/dist/{chunk-6AZTRTCG.js.map → chunk-GQ6CUOLA.js.map} +1 -1
- package/dist/{chunk-5BZDHZCN.js → chunk-HBMF3M5F.js} +4 -4
- package/dist/{chunk-5BZDHZCN.js.map → chunk-HBMF3M5F.js.map} +1 -1
- package/dist/{chunk-AVM4OZHR.mjs → chunk-HDDV63XJ.mjs} +3 -3
- package/dist/{chunk-AVM4OZHR.mjs.map → chunk-HDDV63XJ.mjs.map} +1 -1
- package/dist/{chunk-KOP3DPIR.mjs → chunk-HH5KGXTK.mjs} +4 -4
- package/dist/{chunk-KOP3DPIR.mjs.map → chunk-HH5KGXTK.mjs.map} +1 -1
- package/dist/{chunk-CQUA2AUA.mjs → chunk-I4PDSDVE.mjs} +3 -3
- package/dist/{chunk-CQUA2AUA.mjs.map → chunk-I4PDSDVE.mjs.map} +1 -1
- package/dist/{chunk-757HXAYX.js → chunk-ITFZZ6YT.js} +3 -3
- package/dist/{chunk-757HXAYX.js.map → chunk-ITFZZ6YT.js.map} +1 -1
- package/dist/{chunk-N3C323NY.mjs → chunk-JJ26JKBJ.mjs} +3 -3
- package/dist/{chunk-N3C323NY.mjs.map → chunk-JJ26JKBJ.mjs.map} +1 -1
- package/dist/{chunk-Z33JXJTJ.js → chunk-KMGGAL2X.js} +2 -2
- package/dist/{chunk-Z33JXJTJ.js.map → chunk-KMGGAL2X.js.map} +1 -1
- package/dist/{chunk-TS3N3LGZ.mjs → chunk-KQ3VAOAF.mjs} +4 -4
- package/dist/{chunk-TS3N3LGZ.mjs.map → chunk-KQ3VAOAF.mjs.map} +1 -1
- package/dist/{chunk-GPNBBUEN.js → chunk-LBS4PRC7.js} +3 -3
- package/dist/{chunk-GPNBBUEN.js.map → chunk-LBS4PRC7.js.map} +1 -1
- package/dist/chunk-LC7AM4J5.js +118 -0
- package/dist/chunk-LC7AM4J5.js.map +1 -0
- package/dist/{chunk-4DE2KJ7R.js → chunk-LF4L3ZP5.js} +8 -8
- package/dist/{chunk-4DE2KJ7R.js.map → chunk-LF4L3ZP5.js.map} +1 -1
- package/dist/{chunk-DYKFC7WY.js → chunk-LHYVFWHL.js} +8 -8
- package/dist/{chunk-DYKFC7WY.js.map → chunk-LHYVFWHL.js.map} +1 -1
- package/dist/{chunk-67CHHDBL.mjs → chunk-LIYSLNEK.mjs} +96 -644
- package/dist/chunk-LIYSLNEK.mjs.map +1 -0
- package/dist/{chunk-G3YUSRCL.js → chunk-LUYUFILE.js} +4 -4
- package/dist/{chunk-G3YUSRCL.js.map → chunk-LUYUFILE.js.map} +1 -1
- package/dist/{chunk-ZKR5AJV5.mjs → chunk-MIFP6QEQ.mjs} +4 -4
- package/dist/{chunk-ZKR5AJV5.mjs.map → chunk-MIFP6QEQ.mjs.map} +1 -1
- package/dist/{chunk-QZ54OCWD.mjs → chunk-MTANHZKJ.mjs} +7 -7
- package/dist/{chunk-QZ54OCWD.mjs.map → chunk-MTANHZKJ.mjs.map} +1 -1
- package/dist/{chunk-NSLYY62T.mjs → chunk-N6AVWMIB.mjs} +4 -4
- package/dist/{chunk-NSLYY62T.mjs.map → chunk-N6AVWMIB.mjs.map} +1 -1
- package/dist/{chunk-OC6PU7U2.mjs → chunk-N6X76QUF.mjs} +3 -3
- package/dist/{chunk-OC6PU7U2.mjs.map → chunk-N6X76QUF.mjs.map} +1 -1
- package/dist/{chunk-42F5EK24.mjs → chunk-NUH245XK.mjs} +4 -4
- package/dist/{chunk-42F5EK24.mjs.map → chunk-NUH245XK.mjs.map} +1 -1
- package/dist/{chunk-MANX6422.js → chunk-OXZYP32B.js} +7 -7
- package/dist/{chunk-MANX6422.js.map → chunk-OXZYP32B.js.map} +1 -1
- package/dist/{chunk-K37JPEQW.js → chunk-QWLL3B6U.js} +15 -15
- package/dist/{chunk-K37JPEQW.js.map → chunk-QWLL3B6U.js.map} +1 -1
- package/dist/{chunk-AXAIUCSF.mjs → chunk-SJXGIUHP.mjs} +8 -8
- package/dist/{chunk-AXAIUCSF.mjs.map → chunk-SJXGIUHP.mjs.map} +1 -1
- package/dist/{chunk-4TU246Q4.mjs → chunk-SZHKNGNR.mjs} +2 -2
- package/dist/{chunk-4TU246Q4.mjs.map → chunk-SZHKNGNR.mjs.map} +1 -1
- package/dist/{chunk-R3LYTIVN.js → chunk-U53KN4SA.js} +5 -5
- package/dist/{chunk-R3LYTIVN.js.map → chunk-U53KN4SA.js.map} +1 -1
- package/dist/{chunk-Y7SRO7MJ.mjs → chunk-UOLY4NXK.mjs} +3 -3
- package/dist/{chunk-Y7SRO7MJ.mjs.map → chunk-UOLY4NXK.mjs.map} +1 -1
- package/dist/{chunk-Z7K5AMCE.js → chunk-URVGBWCP.js} +4 -4
- package/dist/{chunk-Z7K5AMCE.js.map → chunk-URVGBWCP.js.map} +1 -1
- package/dist/chunk-UTOHMK52.js +8 -0
- package/dist/{chunk-D37M7MIH.js.map → chunk-UTOHMK52.js.map} +1 -1
- package/dist/{chunk-FFJVQWKO.js → chunk-VA36CJRV.js} +4 -4
- package/dist/{chunk-FFJVQWKO.js.map → chunk-VA36CJRV.js.map} +1 -1
- package/dist/{chunk-A3NNUKFA.js → chunk-VWDT7H6L.js} +96 -644
- package/dist/chunk-VWDT7H6L.js.map +1 -0
- package/dist/{chunk-OIJ435IZ.js → chunk-WSUQ76LN.js} +18 -18
- package/dist/{chunk-OIJ435IZ.js.map → chunk-WSUQ76LN.js.map} +1 -1
- package/dist/{chunk-XW5KNCWJ.mjs → chunk-XWF7QPIP.mjs} +3 -3
- package/dist/{chunk-XW5KNCWJ.mjs.map → chunk-XWF7QPIP.mjs.map} +1 -1
- package/dist/chunk-YQTE32QK.js +137 -0
- package/dist/chunk-YQTE32QK.js.map +1 -0
- package/dist/{chunk-DVH3JHZ3.mjs → chunk-ZDFVYSKK.mjs} +4 -4
- package/dist/{chunk-DVH3JHZ3.mjs.map → chunk-ZDFVYSKK.mjs.map} +1 -1
- package/dist/{chunk-GFNXWS3I.js → chunk-ZLPXFV5Y.js} +5 -5
- package/dist/{chunk-GFNXWS3I.js.map → chunk-ZLPXFV5Y.js.map} +1 -1
- package/dist/{chunk-W23TMUKB.js → chunk-ZY5AVC4P.js} +418 -98
- package/dist/chunk-ZY5AVC4P.js.map +1 -0
- package/dist/cli/index.js +3 -3
- package/dist/cli/index.mjs +1 -1
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/commerce/index.js +56 -56
- package/dist/commerce/index.mjs +5 -5
- package/dist/engage/index.js +10 -10
- package/dist/engage/index.mjs +7 -7
- package/dist/fleet/index.js +8 -8
- package/dist/fleet/index.mjs +4 -4
- package/dist/forms/index.js +16 -16
- package/dist/forms/index.mjs +9 -9
- package/dist/forms/server.js +10 -10
- package/dist/forms/server.mjs +8 -8
- package/dist/forms/static.js +7 -7
- package/dist/forms/static.mjs +6 -6
- package/dist/images/index.js +11 -11
- package/dist/images/index.mjs +4 -4
- package/dist/index.js +63 -63
- package/dist/index.mjs +9 -9
- package/dist/layout/client.js +8 -8
- package/dist/layout/client.mjs +7 -7
- package/dist/layout/index.js +10 -10
- package/dist/layout/index.mjs +8 -8
- package/dist/llms/index.js +12 -12
- package/dist/llms/index.mjs +2 -2
- package/dist/maps/index.js +5 -5
- package/dist/maps/index.mjs +3 -3
- package/dist/search/index.js +4 -4
- package/dist/search/index.mjs +3 -3
- package/dist/seo/client.js +5 -5
- package/dist/seo/client.mjs +4 -4
- package/dist/seo/index.js +5 -5
- package/dist/seo/index.mjs +4 -4
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +2 -2
- package/dist/shared/version.d.ts +1 -1
- package/dist/signal/index.js +11 -11
- package/dist/signal/index.mjs +2 -2
- package/dist/sitemap/index.js +2 -2
- package/dist/sitemap/index.mjs +1 -1
- package/dist/sync/BookingWidget.d.ts +0 -23
- package/dist/sync/BookingWidget.d.ts.map +1 -1
- package/dist/sync/MeetingFormatStep.d.ts +13 -0
- package/dist/sync/MeetingFormatStep.d.ts.map +1 -0
- package/dist/sync/api.d.ts +9 -10
- package/dist/sync/api.d.ts.map +1 -1
- package/dist/sync/booking-flow.d.ts +7 -0
- package/dist/sync/booking-flow.d.ts.map +1 -0
- package/dist/sync/booking-flow.test.d.ts +2 -0
- package/dist/sync/booking-flow.test.d.ts.map +1 -0
- package/dist/sync/index.d.ts +2 -2
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +20 -16
- package/dist/sync/index.mjs +4 -4
- package/dist/sync/types.d.ts +34 -0
- package/dist/sync/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/AnalyticsProvider-2XK54UZW.mjs +0 -11
- package/dist/AnalyticsProvider-PM7SOGOS.js +0 -32
- package/dist/ChatWidget-4PHZHGG5.mjs +0 -11
- package/dist/ChatWidget-7BYSGNO2.js +0 -20
- package/dist/EngageWidget-D6M6QWEC.mjs +0 -9
- package/dist/EngageWidget-Q4ITKTMJ.js +0 -18
- package/dist/ManagedForm-N63YGVNY.js +0 -23
- package/dist/ManagedForm-ZUXLHEQU.mjs +0 -14
- package/dist/SitemapSync-7OBOJG2L.js +0 -18
- package/dist/SitemapSync-G3OLECFI.mjs +0 -9
- package/dist/chunk-67CHHDBL.mjs.map +0 -1
- package/dist/chunk-A3NNUKFA.js.map +0 -1
- package/dist/chunk-CGCYZJYX.mjs +0 -41
- package/dist/chunk-CGCYZJYX.mjs.map +0 -1
- package/dist/chunk-D37M7MIH.js +0 -8
- package/dist/chunk-DHXQBTXE.mjs.map +0 -1
- package/dist/chunk-HVFXFPUJ.mjs.map +0 -1
- package/dist/chunk-JBGRXICL.js.map +0 -1
- package/dist/chunk-OUERH2T4.mjs +0 -6
- package/dist/chunk-TPL2IHFI.js +0 -43
- package/dist/chunk-TPL2IHFI.js.map +0 -1
- package/dist/chunk-W23TMUKB.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SITE_KIT_VERSION } from './chunk-
|
|
1
|
+
import { SITE_KIT_VERSION } from './chunk-7U7C6XRI.mjs';
|
|
2
2
|
import 'server-only';
|
|
3
3
|
|
|
4
4
|
var MINT_PATH = "/api/public/site-token";
|
|
@@ -130,5 +130,5 @@ async function mintWithRetry(rawKey, apiUrl) {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
export { resolveClientCredential };
|
|
133
|
-
//# sourceMappingURL=chunk-
|
|
134
|
-
//# sourceMappingURL=chunk-
|
|
133
|
+
//# sourceMappingURL=chunk-6CUBSQMD.mjs.map
|
|
134
|
+
//# sourceMappingURL=chunk-6CUBSQMD.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server/mint-site-token.ts"],"names":[],"mappings":";;;AA4CA,IAAM,SAAA,GAAY,wBAAA;AAClB,IAAM,eAAA,GAAkB,GAAA;AACxB,IAAM,iBAAA,GAAoB,MAAA;AAO1B,IAAM,iBAAA,GAAoB,CAAA;AAC1B,IAAM,oBAAA,GAAuB,GAAA;AAC7B,IAAM,mBAAA,GAAsB,GAAA;AAM5B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AM,GAAA,CAAI,MAAA,EAAQ,EAAE,UAAA,EAAY,MAAA,EAAQ,WAAW,IAAA,CAAK,GAAA,EAAI,GAAI,GAAA,EAAQ,CAAA;AACxE,MAAA,OAAO,MAAA;AAAA,IACT;AAEA,IAAA,UAAA,GAAa,CAAA,KAAA,EAAQ,IAAI,MAAM,CAAA,CAAA;AAC/B,IAAA,IAAI,kBAAkB,GAAA,CAAI,MAAM,CAAA,IAAK,OAAA,GAAU,oBAAoB,CAAA,EAAG;AACpE,MAAA,MAAM,KAAA,GAAQ,YAAA,CAAa,GAAA,EAAK,OAAO,CAAA;AACvC,MAAA,OAAA,CAAQ,IAAA;AAAA,QACN,CAAA,oCAAA,EAAuC,GAAA,CAAI,MAAM,CAAA,cAAA,EAAiB,IAAA,CAAK,KAAA,CAAM,KAAK,CAAC,CAAA,YAAA,EACrE,OAAA,GAAU,CAAC,CAAA,CAAA,EAAI,iBAAiB,CAAA,EAAA;AAAA,OAChD;AACA,MAAA,MAAM,MAAM,KAAK,CAAA;AACjB,MAAA;AAAA,IACF;AACA,IAAA;AAAA,EACF;AAEA,EAAA,OAAO,UAAA,CAAW,UAAA,EAAY,MAAA,EAAQ,IAAA,CAAK,KAAK,CAAA;AAClD","file":"chunk-ZOJ3TLO5.mjs","sourcesContent":["/**\n * @sonordev/site-kit/server — Client-token minting (server-only)\n *\n * SiteKitLayout holds the raw `SONOR_API_KEY` server-side but must NOT ship it to\n * the browser. This mints a short-lived, project-scoped token (server-to-server,\n * authenticated with the raw key, no browser Origin so it passes domain-binding)\n * and returns THAT for the layout to inject instead.\n *\n * `import 'server-only'` makes importing this into a client bundle a hard build\n * error — the raw key stays on the server.\n *\n * FAILS CLOSED. If minting genuinely fails, this throws and the build fails —\n * it does NOT publish the raw key. A failed deploy is loud and recoverable; a\n * leaked project secret in public HTML is neither. The only paths that still\n * return the raw key are a 404 (an older API that predates the endpoint, an\n * expected state during rollout) and the explicit `SONOR_SITE_TOKEN_FALLBACK=raw`\n * escape hatch, for when shipping beats being blocked.\n *\n * That posture is not academic. Through 3.5.0 a throttled mint (HTTP 429)\n * returned the raw key AND cached it for 60s, so every page rendered in that\n * window shipped the secret: one real build came out with 180 of 272 prerendered\n * pages carrying it. The build \"succeeded\" and nothing downstream noticed.\n * Rate limiting is transient by definition — the fix is to wait and retry, not\n * to downgrade to publishing the key.\n *\n * Two things keep the request count low enough that throttling is rare:\n * - a module-level memo, so a worker mints once and every page reuses the seed;\n * - an in-flight map, because that memo is only populated AFTER the await. Next\n * renders pages concurrently, so without coalescing the first N concurrent\n * renders in a process all miss the cache and all fire a request — a\n * stampede per worker, multiplied by one worker per core. That is how a\n * single site exhausted a 60/min budget.\n *\n * SEED FRESHNESS: a static page's seed carries `iat` = build time, and the API\n * refuses to refresh a seed older than SITE_TOKEN_MAX_REFRESH_AGE_SECONDS\n * (sonor-api common/site-auth/site-token.util.ts — currently 400 days, raised\n * from 30 alongside this fix). A site not rebuilt within that window serves a\n * seed the client cannot refresh, and its forms/analytics/engage start failing\n * for new visitors. Keep that limit comfortably longer than the fleet's\n * realistic redeploy gap; marketing sites routinely go many months untouched.\n */\nimport 'server-only'\nimport { SITE_KIT_VERSION } from '../shared/version'\n\nconst MINT_PATH = '/api/public/site-token'\nconst MINT_TIMEOUT_MS = 4_000\nconst SITE_TOKEN_PREFIX = 'st1.'\n\n/**\n * Retry budget for transient failures (429 / 5xx / network). Rate limiting is\n * measured per minute, so a few seconds of backoff clears it; the whole ladder\n * costs at most ~20s once per build worker, and only when something is wrong.\n */\nconst MINT_MAX_ATTEMPTS = 4\nconst MINT_BACKOFF_BASE_MS = 500\nconst MINT_BACKOFF_CAP_MS = 8_000\n\ninterface CacheEntry {\n credential: string\n expiresAt: number\n}\nconst cache = new Map<string, CacheEntry>()\n\n/**\n * Requests already in flight, keyed by raw key. The `cache` above is only\n * written after the response lands, so concurrent renders would otherwise each\n * start their own mint. See the module header.\n */\nconst inflight = new Map<string, Promise<string>>()\n\nconst sleep = (ms: number) => new Promise<void>((r) => setTimeout(r, ms))\n\n/**\n * Honour `Retry-After` when the server sends it (delta-seconds or HTTP date),\n * otherwise exponential backoff. Capped so a misconfigured server cannot stall\n * a build indefinitely.\n */\nfunction retryDelayMs(res: Response | null, attempt: number): number {\n const header = res?.headers?.get?.('retry-after')\n if (header) {\n const seconds = Number(header)\n const ms = Number.isFinite(seconds)\n ? seconds * 1000\n : Date.parse(header) - Date.now()\n if (Number.isFinite(ms) && ms > 0) return Math.min(ms, MINT_BACKOFF_CAP_MS)\n }\n return Math.min(MINT_BACKOFF_BASE_MS * 2 ** attempt, MINT_BACKOFF_CAP_MS)\n}\n\n/** 429 and 5xx are transient; waiting is the correct response to both. */\nconst isRetryableStatus = (status: number) => status === 429 || status >= 500\n\n/**\n * The escape hatch, for when a broken mint must not block a release. Opt-in and\n * loud: it re-enables publishing the project secret in page HTML.\n */\nfunction rawFallbackAllowed(): boolean {\n return (\n typeof process !== 'undefined' &&\n process.env?.SONOR_SITE_TOKEN_FALLBACK === 'raw'\n )\n}\n\nfunction failClosed(reason: string, rawKey: string, now: number): string {\n if (rawFallbackAllowed()) {\n console.warn(\n `[SiteKitLayout] Token mint failed (${reason}) and SONOR_SITE_TOKEN_FALLBACK=raw is set; ` +\n 'injecting the RAW API KEY into page HTML. The key is publicly readable wherever ' +\n 'this page is served — unset the escape hatch once the mint is healthy.',\n )\n cache.set(rawKey, { credential: rawKey, expiresAt: now + 60_000 })\n return rawKey\n }\n throw new Error(\n `site-kit: could not mint a site token (${reason}). Refusing to publish the raw ` +\n 'SONOR_API_KEY in page HTML, so this build fails instead. Check that the mint ' +\n 'endpoint is reachable and the key is valid, then rebuild. To ship anyway — ' +\n 'which publishes the project secret in public HTML — set SONOR_SITE_TOKEN_FALLBACK=raw.',\n )\n}\n\ntype FetchLike = typeof fetch\n\n/**\n * Next.js monkey-patches `globalThis.fetch` so every call participates in its\n * Data Cache and static-generation tracking. This mint must NOT participate.\n *\n * `cache: 'no-store'` marks the calling scope dynamic, so during `next build`\n * Next throws DynamicServerError *before the request goes out*. On a statically\n * prerendered route the mint therefore never ran at all — the catch below\n * swallowed the bailout and every page shipped the raw key. (Verified against\n * Next 16.2.9: the mint endpoint received zero requests for a static build.)\n *\n * The two obvious repairs are both wrong:\n * - `next: { revalidate: N }` LOWERS the route's revalidate window\n * (patch-fetch.js: `finalRevalidate < revalidateStore.revalidate`), quietly\n * converting fully-static pages into ISR across the whole fleet.\n * - `next: { revalidate: false }` keeps pages static but writes the token into\n * the Data Cache, which hosts persist across builds — a fresh deploy could\n * re-bake a months-old seed, which is the exact failure we're removing.\n *\n * A credential mint is not page data and has no business in the page data cache.\n * So we call the original fetch Next saves on the patched one and stay invisible\n * to the framework: no bailout, no cache entry, no effect on staticness. The\n * module-level memo above is the only cache we want — one mint per build\n * process, and a build-fresh seed on every deploy.\n *\n * @internal Exported for unit tests; not part of the package's public API.\n */\nexport function resolveFetch(): { fn: FetchLike; unpatched: boolean } {\n const current = globalThis.fetch as\n | (FetchLike & { _nextOriginalFetch?: FetchLike })\n | undefined\n if (!current) throw new Error('site-kit: global fetch is unavailable')\n const original = current._nextOriginalFetch\n if (typeof original === 'function') return { fn: original, unpatched: true }\n return { fn: current, unpatched: false }\n}\n\n/**\n * Next signals \"this render must go dynamic\" by THROWING (DynamicServerError,\n * static-gen bailout, redirect/notFound digests, React's postpone). Those are\n * the framework's control flow, not a mint failure. Swallowing one makes Next\n * believe the render succeeded statically — which is precisely how the raw key\n * ended up stranded in prerendered HTML with no error anywhere. Let them\n * propagate; only real network/HTTP failures fall back to the raw key.\n *\n * @internal Exported for unit tests; not part of the package's public API.\n */\nexport function isFrameworkSignal(err: unknown): boolean {\n if (!err || typeof err !== 'object') return false\n const e = err as { digest?: unknown; code?: unknown; $$typeof?: unknown }\n if (e.digest === 'DYNAMIC_SERVER_USAGE') return true\n if (e.code === 'NEXT_STATIC_GEN_BAILOUT') return true\n if (typeof e.digest === 'string' && e.digest.startsWith('NEXT_')) return true\n if (e.$$typeof === Symbol.for('react.postpone')) return true\n return false\n}\n\nexport async function resolveClientCredential(\n rawKey: string,\n apiUrl: string,\n): Promise<string> {\n if (!rawKey) return ''\n // Env should hold a raw key; if it already looks like a token, pass it through.\n if (rawKey.startsWith(SITE_TOKEN_PREFIX)) return rawKey\n\n const cached = cache.get(rawKey)\n if (cached && cached.expiresAt > Date.now()) return cached.credential\n\n // Collapse concurrent renders onto one request rather than a stampede.\n const pending = inflight.get(rawKey)\n if (pending) return pending\n\n const request = mintWithRetry(rawKey, apiUrl)\n inflight.set(rawKey, request)\n try {\n return await request\n } finally {\n inflight.delete(rawKey)\n }\n}\n\nasync function mintWithRetry(rawKey: string, apiUrl: string): Promise<string> {\n const base = (apiUrl || 'https://api.sonor.io').replace(/\\/+$/, '')\n let lastReason = 'unknown error'\n\n for (let attempt = 0; attempt < MINT_MAX_ATTEMPTS; attempt++) {\n let res: Response | null = null\n try {\n const { fn: fetchFn, unpatched } = resolveFetch()\n res = await fetchFn(`${base}${MINT_PATH}`, {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n 'x-api-key': rawKey,\n 'x-sitekit-version': SITE_KIT_VERSION,\n },\n // Only meaningful on the fallback path, where a future Next stopped\n // exposing `_nextOriginalFetch` and we're back on the patched fetch.\n // `revalidate: false` is the one setting that neither bails out of static\n // generation nor downgrades the route to ISR; a Data Cache entry is the\n // lesser evil versus shipping the raw key again.\n ...(unpatched ? {} : ({ next: { revalidate: false } } as RequestInit)),\n signal:\n typeof AbortSignal !== 'undefined' && AbortSignal.timeout\n ? AbortSignal.timeout(MINT_TIMEOUT_MS)\n : undefined,\n })\n } catch (err) {\n // Never swallow the framework's own control flow — see isFrameworkSignal.\n if (isFrameworkSignal(err)) throw err\n lastReason = err instanceof Error ? err.message : 'network error'\n if (attempt < MINT_MAX_ATTEMPTS - 1) {\n await sleep(retryDelayMs(null, attempt))\n continue\n }\n break\n }\n\n if (res.ok) {\n const data: any = await res.json().catch(() => null)\n const token = data?.token\n const expiresIn = typeof data?.expiresIn === 'number' ? data.expiresIn : 3600\n if (typeof token === 'string' && token.startsWith(SITE_TOKEN_PREFIX)) {\n cache.set(rawKey, {\n credential: token,\n expiresAt: Date.now() + Math.min((expiresIn * 1000) / 2, 30 * 60_000),\n })\n return token\n }\n lastReason = 'mint returned no usable token'\n break\n }\n\n // 404 = an API older than the endpoint. Expected during rollout, and the raw\n // key is exactly what such an API still expects, so this stays a fallback\n // rather than a build failure.\n if (res.status === 404) {\n cache.set(rawKey, { credential: rawKey, expiresAt: Date.now() + 60_000 })\n return rawKey\n }\n\n lastReason = `HTTP ${res.status}`\n if (isRetryableStatus(res.status) && attempt < MINT_MAX_ATTEMPTS - 1) {\n const delay = retryDelayMs(res, attempt)\n console.warn(\n `[SiteKitLayout] Token mint returned ${res.status}; retrying in ${Math.round(delay)}ms ` +\n `(attempt ${attempt + 2}/${MINT_MAX_ATTEMPTS}).`,\n )\n await sleep(delay)\n continue\n }\n break\n }\n\n return failClosed(lastReason, rawKey, Date.now())\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/server/mint-site-token.ts"],"names":[],"mappings":";;;AA4CA,IAAM,SAAA,GAAY,wBAAA;AAClB,IAAM,eAAA,GAAkB,GAAA;AACxB,IAAM,iBAAA,GAAoB,MAAA;AAO1B,IAAM,iBAAA,GAAoB,CAAA;AAC1B,IAAM,oBAAA,GAAuB,GAAA;AAC7B,IAAM,mBAAA,GAAsB,GAAA;AAM5B,IAAM,KAAA,uBAAY,GAAA,EAAwB;AAO1C,IAAM,QAAA,uBAAe,GAAA,EAA6B;AAElD,IAAM,KAAA,GAAQ,CAAC,EAAA,KAAe,IAAI,OAAA,CAAc,CAAC,CAAA,KAAM,UAAA,CAAW,CAAA,EAAG,EAAE,CAAC,CAAA;AAOxE,SAAS,YAAA,CAAa,KAAsB,OAAA,EAAyB;AACnE,EAAA,MAAM,MAAA,GAAS,GAAA,EAAK,OAAA,EAAS,GAAA,GAAM,aAAa,CAAA;AAChD,EAAA,IAAI,MAA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AAA,CAAa,GAAA,EAAK,OAAO,CAAA;AACvC,MAAA,OAAA,CAAQ,IAAA;AAAA,QACN,CAAA,oCAAA,EAAuC,GAAA,CAAI,MAAM,CAAA,cAAA,EAAiB,IAAA,CAAK,KAAA,CAAM,KAAK,CAAC,CAAA,YAAA,EACrE,OAAA,GAAU,CAAC,CAAA,CAAA,EAAI,iBAAiB,CAAA,EAAA;AAAA,OAChD;AACA,MAAA,MAAM,MAAM,KAAK,CAAA;AACjB,MAAA;AAAA,IACF;AACA,IAAA;AAAA,EACF;AAEA,EAAA,OAAO,UAAA,CAAW,UAAA,EAAY,MAAA,EAAQ,IAAA,CAAK,KAAK,CAAA;AAClD","file":"chunk-6CUBSQMD.mjs","sourcesContent":["/**\n * @sonordev/site-kit/server — Client-token minting (server-only)\n *\n * SiteKitLayout holds the raw `SONOR_API_KEY` server-side but must NOT ship it to\n * the browser. This mints a short-lived, project-scoped token (server-to-server,\n * authenticated with the raw key, no browser Origin so it passes domain-binding)\n * and returns THAT for the layout to inject instead.\n *\n * `import 'server-only'` makes importing this into a client bundle a hard build\n * error — the raw key stays on the server.\n *\n * FAILS CLOSED. If minting genuinely fails, this throws and the build fails —\n * it does NOT publish the raw key. A failed deploy is loud and recoverable; a\n * leaked project secret in public HTML is neither. The only paths that still\n * return the raw key are a 404 (an older API that predates the endpoint, an\n * expected state during rollout) and the explicit `SONOR_SITE_TOKEN_FALLBACK=raw`\n * escape hatch, for when shipping beats being blocked.\n *\n * That posture is not academic. Through 3.5.0 a throttled mint (HTTP 429)\n * returned the raw key AND cached it for 60s, so every page rendered in that\n * window shipped the secret: one real build came out with 180 of 272 prerendered\n * pages carrying it. The build \"succeeded\" and nothing downstream noticed.\n * Rate limiting is transient by definition — the fix is to wait and retry, not\n * to downgrade to publishing the key.\n *\n * Two things keep the request count low enough that throttling is rare:\n * - a module-level memo, so a worker mints once and every page reuses the seed;\n * - an in-flight map, because that memo is only populated AFTER the await. Next\n * renders pages concurrently, so without coalescing the first N concurrent\n * renders in a process all miss the cache and all fire a request — a\n * stampede per worker, multiplied by one worker per core. That is how a\n * single site exhausted a 60/min budget.\n *\n * SEED FRESHNESS: a static page's seed carries `iat` = build time, and the API\n * refuses to refresh a seed older than SITE_TOKEN_MAX_REFRESH_AGE_SECONDS\n * (sonor-api common/site-auth/site-token.util.ts — currently 400 days, raised\n * from 30 alongside this fix). A site not rebuilt within that window serves a\n * seed the client cannot refresh, and its forms/analytics/engage start failing\n * for new visitors. Keep that limit comfortably longer than the fleet's\n * realistic redeploy gap; marketing sites routinely go many months untouched.\n */\nimport 'server-only'\nimport { SITE_KIT_VERSION } from '../shared/version'\n\nconst MINT_PATH = '/api/public/site-token'\nconst MINT_TIMEOUT_MS = 4_000\nconst SITE_TOKEN_PREFIX = 'st1.'\n\n/**\n * Retry budget for transient failures (429 / 5xx / network). Rate limiting is\n * measured per minute, so a few seconds of backoff clears it; the whole ladder\n * costs at most ~20s once per build worker, and only when something is wrong.\n */\nconst MINT_MAX_ATTEMPTS = 4\nconst MINT_BACKOFF_BASE_MS = 500\nconst MINT_BACKOFF_CAP_MS = 8_000\n\ninterface CacheEntry {\n credential: string\n expiresAt: number\n}\nconst cache = new Map<string, CacheEntry>()\n\n/**\n * Requests already in flight, keyed by raw key. The `cache` above is only\n * written after the response lands, so concurrent renders would otherwise each\n * start their own mint. See the module header.\n */\nconst inflight = new Map<string, Promise<string>>()\n\nconst sleep = (ms: number) => new Promise<void>((r) => setTimeout(r, ms))\n\n/**\n * Honour `Retry-After` when the server sends it (delta-seconds or HTTP date),\n * otherwise exponential backoff. Capped so a misconfigured server cannot stall\n * a build indefinitely.\n */\nfunction retryDelayMs(res: Response | null, attempt: number): number {\n const header = res?.headers?.get?.('retry-after')\n if (header) {\n const seconds = Number(header)\n const ms = Number.isFinite(seconds)\n ? seconds * 1000\n : Date.parse(header) - Date.now()\n if (Number.isFinite(ms) && ms > 0) return Math.min(ms, MINT_BACKOFF_CAP_MS)\n }\n return Math.min(MINT_BACKOFF_BASE_MS * 2 ** attempt, MINT_BACKOFF_CAP_MS)\n}\n\n/** 429 and 5xx are transient; waiting is the correct response to both. */\nconst isRetryableStatus = (status: number) => status === 429 || status >= 500\n\n/**\n * The escape hatch, for when a broken mint must not block a release. Opt-in and\n * loud: it re-enables publishing the project secret in page HTML.\n */\nfunction rawFallbackAllowed(): boolean {\n return (\n typeof process !== 'undefined' &&\n process.env?.SONOR_SITE_TOKEN_FALLBACK === 'raw'\n )\n}\n\nfunction failClosed(reason: string, rawKey: string, now: number): string {\n if (rawFallbackAllowed()) {\n console.warn(\n `[SiteKitLayout] Token mint failed (${reason}) and SONOR_SITE_TOKEN_FALLBACK=raw is set; ` +\n 'injecting the RAW API KEY into page HTML. The key is publicly readable wherever ' +\n 'this page is served — unset the escape hatch once the mint is healthy.',\n )\n cache.set(rawKey, { credential: rawKey, expiresAt: now + 60_000 })\n return rawKey\n }\n throw new Error(\n `site-kit: could not mint a site token (${reason}). Refusing to publish the raw ` +\n 'SONOR_API_KEY in page HTML, so this build fails instead. Check that the mint ' +\n 'endpoint is reachable and the key is valid, then rebuild. To ship anyway — ' +\n 'which publishes the project secret in public HTML — set SONOR_SITE_TOKEN_FALLBACK=raw.',\n )\n}\n\ntype FetchLike = typeof fetch\n\n/**\n * Next.js monkey-patches `globalThis.fetch` so every call participates in its\n * Data Cache and static-generation tracking. This mint must NOT participate.\n *\n * `cache: 'no-store'` marks the calling scope dynamic, so during `next build`\n * Next throws DynamicServerError *before the request goes out*. On a statically\n * prerendered route the mint therefore never ran at all — the catch below\n * swallowed the bailout and every page shipped the raw key. (Verified against\n * Next 16.2.9: the mint endpoint received zero requests for a static build.)\n *\n * The two obvious repairs are both wrong:\n * - `next: { revalidate: N }` LOWERS the route's revalidate window\n * (patch-fetch.js: `finalRevalidate < revalidateStore.revalidate`), quietly\n * converting fully-static pages into ISR across the whole fleet.\n * - `next: { revalidate: false }` keeps pages static but writes the token into\n * the Data Cache, which hosts persist across builds — a fresh deploy could\n * re-bake a months-old seed, which is the exact failure we're removing.\n *\n * A credential mint is not page data and has no business in the page data cache.\n * So we call the original fetch Next saves on the patched one and stay invisible\n * to the framework: no bailout, no cache entry, no effect on staticness. The\n * module-level memo above is the only cache we want — one mint per build\n * process, and a build-fresh seed on every deploy.\n *\n * @internal Exported for unit tests; not part of the package's public API.\n */\nexport function resolveFetch(): { fn: FetchLike; unpatched: boolean } {\n const current = globalThis.fetch as\n | (FetchLike & { _nextOriginalFetch?: FetchLike })\n | undefined\n if (!current) throw new Error('site-kit: global fetch is unavailable')\n const original = current._nextOriginalFetch\n if (typeof original === 'function') return { fn: original, unpatched: true }\n return { fn: current, unpatched: false }\n}\n\n/**\n * Next signals \"this render must go dynamic\" by THROWING (DynamicServerError,\n * static-gen bailout, redirect/notFound digests, React's postpone). Those are\n * the framework's control flow, not a mint failure. Swallowing one makes Next\n * believe the render succeeded statically — which is precisely how the raw key\n * ended up stranded in prerendered HTML with no error anywhere. Let them\n * propagate; only real network/HTTP failures fall back to the raw key.\n *\n * @internal Exported for unit tests; not part of the package's public API.\n */\nexport function isFrameworkSignal(err: unknown): boolean {\n if (!err || typeof err !== 'object') return false\n const e = err as { digest?: unknown; code?: unknown; $$typeof?: unknown }\n if (e.digest === 'DYNAMIC_SERVER_USAGE') return true\n if (e.code === 'NEXT_STATIC_GEN_BAILOUT') return true\n if (typeof e.digest === 'string' && e.digest.startsWith('NEXT_')) return true\n if (e.$$typeof === Symbol.for('react.postpone')) return true\n return false\n}\n\nexport async function resolveClientCredential(\n rawKey: string,\n apiUrl: string,\n): Promise<string> {\n if (!rawKey) return ''\n // Env should hold a raw key; if it already looks like a token, pass it through.\n if (rawKey.startsWith(SITE_TOKEN_PREFIX)) return rawKey\n\n const cached = cache.get(rawKey)\n if (cached && cached.expiresAt > Date.now()) return cached.credential\n\n // Collapse concurrent renders onto one request rather than a stampede.\n const pending = inflight.get(rawKey)\n if (pending) return pending\n\n const request = mintWithRetry(rawKey, apiUrl)\n inflight.set(rawKey, request)\n try {\n return await request\n } finally {\n inflight.delete(rawKey)\n }\n}\n\nasync function mintWithRetry(rawKey: string, apiUrl: string): Promise<string> {\n const base = (apiUrl || 'https://api.sonor.io').replace(/\\/+$/, '')\n let lastReason = 'unknown error'\n\n for (let attempt = 0; attempt < MINT_MAX_ATTEMPTS; attempt++) {\n let res: Response | null = null\n try {\n const { fn: fetchFn, unpatched } = resolveFetch()\n res = await fetchFn(`${base}${MINT_PATH}`, {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n 'x-api-key': rawKey,\n 'x-sitekit-version': SITE_KIT_VERSION,\n },\n // Only meaningful on the fallback path, where a future Next stopped\n // exposing `_nextOriginalFetch` and we're back on the patched fetch.\n // `revalidate: false` is the one setting that neither bails out of static\n // generation nor downgrades the route to ISR; a Data Cache entry is the\n // lesser evil versus shipping the raw key again.\n ...(unpatched ? {} : ({ next: { revalidate: false } } as RequestInit)),\n signal:\n typeof AbortSignal !== 'undefined' && AbortSignal.timeout\n ? AbortSignal.timeout(MINT_TIMEOUT_MS)\n : undefined,\n })\n } catch (err) {\n // Never swallow the framework's own control flow — see isFrameworkSignal.\n if (isFrameworkSignal(err)) throw err\n lastReason = err instanceof Error ? err.message : 'network error'\n if (attempt < MINT_MAX_ATTEMPTS - 1) {\n await sleep(retryDelayMs(null, attempt))\n continue\n }\n break\n }\n\n if (res.ok) {\n const data: any = await res.json().catch(() => null)\n const token = data?.token\n const expiresIn = typeof data?.expiresIn === 'number' ? data.expiresIn : 3600\n if (typeof token === 'string' && token.startsWith(SITE_TOKEN_PREFIX)) {\n cache.set(rawKey, {\n credential: token,\n expiresAt: Date.now() + Math.min((expiresIn * 1000) / 2, 30 * 60_000),\n })\n return token\n }\n lastReason = 'mint returned no usable token'\n break\n }\n\n // 404 = an API older than the endpoint. Expected during rollout, and the raw\n // key is exactly what such an API still expects, so this stays a fallback\n // rather than a build failure.\n if (res.status === 404) {\n cache.set(rawKey, { credential: rawKey, expiresAt: Date.now() + 60_000 })\n return rawKey\n }\n\n lastReason = `HTTP ${res.status}`\n if (isRetryableStatus(res.status) && attempt < MINT_MAX_ATTEMPTS - 1) {\n const delay = retryDelayMs(res, attempt)\n console.warn(\n `[SiteKitLayout] Token mint returned ${res.status}; retrying in ${Math.round(delay)}ms ` +\n `(attempt ${attempt + 2}/${MINT_MAX_ATTEMPTS}).`,\n )\n await sleep(delay)\n continue\n }\n break\n }\n\n return failClosed(lastReason, rawKey, Date.now())\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkLC7AM4J5_js = require('./chunk-LC7AM4J5.js');
|
|
3
4
|
var chunkO5GHP7UO_js = require('./chunk-O5GHP7UO.js');
|
|
4
5
|
|
|
5
6
|
// src/blog/excerpt.ts
|
|
@@ -181,15 +182,9 @@ async function getBlogCategories() {
|
|
|
181
182
|
return [];
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
|
-
function blogPathPrefix(options) {
|
|
185
|
-
const raw = (options.blogBasePath ?? "/blog").trim() || "/blog";
|
|
186
|
-
const withSlash = raw.startsWith("/") ? raw : `/${raw}`;
|
|
187
|
-
return withSlash.replace(/\/$/, "") || "/blog";
|
|
188
|
-
}
|
|
189
185
|
async function generateBlogPostMetadata(slug, options = {}) {
|
|
190
186
|
const post = await getBlogPost(slug);
|
|
191
187
|
const { siteName, siteUrl = "", defaultImage, twitterHandle } = options;
|
|
192
|
-
const base = blogPathPrefix(options);
|
|
193
188
|
if (!post) {
|
|
194
189
|
return {
|
|
195
190
|
title: "Post Not Found",
|
|
@@ -199,7 +194,7 @@ async function generateBlogPostMetadata(slug, options = {}) {
|
|
|
199
194
|
const title = post.meta_title || post.title;
|
|
200
195
|
const description = sanitizeExcerpt(post.meta_description || post.excerpt);
|
|
201
196
|
const image = post.featured_image || defaultImage;
|
|
202
|
-
const url =
|
|
197
|
+
const url = chunkLC7AM4J5_js.resolveBlogPostUrl(post, options);
|
|
203
198
|
return {
|
|
204
199
|
title,
|
|
205
200
|
description,
|
|
@@ -228,7 +223,7 @@ async function generateBlogPostMetadata(slug, options = {}) {
|
|
|
228
223
|
creator: twitterHandle
|
|
229
224
|
},
|
|
230
225
|
alternates: {
|
|
231
|
-
canonical:
|
|
226
|
+
canonical: url
|
|
232
227
|
},
|
|
233
228
|
other: {
|
|
234
229
|
"article:published_time": post.published_at || "",
|
|
@@ -245,14 +240,14 @@ function generateBlogIndexMetadata(options) {
|
|
|
245
240
|
defaultImage,
|
|
246
241
|
twitterHandle
|
|
247
242
|
} = options;
|
|
248
|
-
const base =
|
|
243
|
+
const base = chunkLC7AM4J5_js.createBlogRoutes(options).index;
|
|
249
244
|
return {
|
|
250
245
|
title,
|
|
251
246
|
description,
|
|
252
247
|
openGraph: {
|
|
253
248
|
title,
|
|
254
249
|
description,
|
|
255
|
-
url:
|
|
250
|
+
url: chunkLC7AM4J5_js.resolveBlogUrl(base, siteUrl),
|
|
256
251
|
siteName,
|
|
257
252
|
type: "website",
|
|
258
253
|
images: defaultImage ? [{ url: defaultImage }] : void 0
|
|
@@ -267,7 +262,7 @@ function generateBlogIndexMetadata(options) {
|
|
|
267
262
|
};
|
|
268
263
|
}
|
|
269
264
|
function generateBlogCategoryMetadata(categoryName, options = {}) {
|
|
270
|
-
const { siteName, siteUrl = "", defaultImage
|
|
265
|
+
const { siteName, siteUrl = "", defaultImage } = options;
|
|
271
266
|
const title = `${categoryName} - Blog`;
|
|
272
267
|
const description = `Browse all posts in ${categoryName}.`;
|
|
273
268
|
const slug = options.categorySlug ?? categoryName.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -277,43 +272,52 @@ function generateBlogCategoryMetadata(categoryName, options = {}) {
|
|
|
277
272
|
openGraph: {
|
|
278
273
|
title,
|
|
279
274
|
description,
|
|
280
|
-
url:
|
|
275
|
+
url: chunkLC7AM4J5_js.resolveBlogUrl(chunkLC7AM4J5_js.createBlogRoutes(options).category(slug), siteUrl),
|
|
281
276
|
siteName,
|
|
282
277
|
type: "website",
|
|
283
278
|
images: defaultImage ? [{ url: defaultImage }] : void 0
|
|
284
279
|
}
|
|
285
280
|
};
|
|
286
281
|
}
|
|
287
|
-
async function generateBlogStaticParams() {
|
|
288
|
-
const
|
|
289
|
-
return
|
|
282
|
+
async function generateBlogStaticParams(options = {}) {
|
|
283
|
+
const posts = await getBlogRouteEntries(options);
|
|
284
|
+
return posts.map((post) => {
|
|
285
|
+
const category = chunkLC7AM4J5_js.blogCategorySlug(post.category || options.category);
|
|
286
|
+
return { slug: post.slug, ...options.includeCategoryInPath && category ? { category } : {} };
|
|
287
|
+
});
|
|
290
288
|
}
|
|
291
289
|
async function generateCategoryStaticParams() {
|
|
292
290
|
const categories = await getBlogCategories();
|
|
293
291
|
return categories.map((c) => ({ category: c.slug }));
|
|
294
292
|
}
|
|
295
|
-
async function
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
293
|
+
async function getBlogRouteEntries(options, withCanonicals = false) {
|
|
294
|
+
if (withCanonicals || options.includeCategoryInPath || options.postPath) {
|
|
295
|
+
return (await getAllBlogPosts({ maxPosts: Infinity })).map((post) => ({ ...post, last_modified: post.updated_at }));
|
|
296
|
+
}
|
|
297
|
+
return getAllBlogSlugs();
|
|
298
|
+
}
|
|
299
|
+
async function generateBlogSitemap(siteUrl, options = {}) {
|
|
300
|
+
const slugs = await getBlogRouteEntries(options, true);
|
|
301
|
+
const categories = options.includeCategories === false ? [] : await getBlogCategories();
|
|
302
|
+
const clusters = options.includeClusters === false ? [] : await getTopicClusters();
|
|
299
303
|
const entries = [
|
|
300
304
|
// Blog index
|
|
301
305
|
{
|
|
302
|
-
url:
|
|
306
|
+
url: chunkLC7AM4J5_js.resolveBlogUrl(chunkLC7AM4J5_js.createBlogRoutes(options).index, siteUrl),
|
|
303
307
|
changeFrequency: "daily",
|
|
304
308
|
priority: 0.8
|
|
305
309
|
}
|
|
306
310
|
];
|
|
307
311
|
clusters.forEach((cluster) => {
|
|
308
312
|
entries.push({
|
|
309
|
-
url:
|
|
313
|
+
url: chunkLC7AM4J5_js.resolveBlogUrl(chunkLC7AM4J5_js.createBlogRoutes(options).cluster(cluster.cluster_slug), siteUrl),
|
|
310
314
|
changeFrequency: "weekly",
|
|
311
315
|
priority: 0.8
|
|
312
316
|
});
|
|
313
317
|
});
|
|
314
318
|
categories.forEach((cat) => {
|
|
315
319
|
entries.push({
|
|
316
|
-
url:
|
|
320
|
+
url: chunkLC7AM4J5_js.resolveBlogUrl(chunkLC7AM4J5_js.createBlogRoutes(options).category(cat.slug), siteUrl),
|
|
317
321
|
changeFrequency: "weekly",
|
|
318
322
|
priority: 0.6
|
|
319
323
|
});
|
|
@@ -321,7 +325,7 @@ async function generateBlogSitemap(siteUrl) {
|
|
|
321
325
|
slugs.forEach((post) => {
|
|
322
326
|
const isPillar = post.article_type === "pillar";
|
|
323
327
|
entries.push({
|
|
324
|
-
url:
|
|
328
|
+
url: chunkLC7AM4J5_js.resolveBlogPostUrl(post, { ...options, siteUrl }),
|
|
325
329
|
lastModified: post.last_modified ? new Date(post.last_modified) : void 0,
|
|
326
330
|
changeFrequency: isPillar ? "weekly" : "monthly",
|
|
327
331
|
priority: isPillar ? 0.9 : 0.7
|
|
@@ -336,7 +340,7 @@ function generateBlogPostSchema(post, options = {}) {
|
|
|
336
340
|
"@type": "BlogPosting",
|
|
337
341
|
headline: post.title,
|
|
338
342
|
description: sanitizeExcerpt(post.excerpt || post.meta_description),
|
|
339
|
-
url:
|
|
343
|
+
url: chunkLC7AM4J5_js.resolveBlogPostUrl(post, { ...options, siteUrl }),
|
|
340
344
|
datePublished: post.published_at,
|
|
341
345
|
dateModified: post.updated_at,
|
|
342
346
|
author: {
|
|
@@ -344,9 +348,8 @@ function generateBlogPostSchema(post, options = {}) {
|
|
|
344
348
|
name: typeof post.author === "string" ? post.author : post.author?.name
|
|
345
349
|
}
|
|
346
350
|
};
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
351
|
+
const articleImage = chunkLC7AM4J5_js.resolveBlogArtwork(post, "article").src;
|
|
352
|
+
if (articleImage) schema.image = articleImage;
|
|
350
353
|
if (siteName || logoUrl) {
|
|
351
354
|
schema.publisher = {
|
|
352
355
|
"@type": "Organization",
|
|
@@ -379,7 +382,7 @@ function generateBlogListSchema(options = {}) {
|
|
|
379
382
|
"@type": "Blog",
|
|
380
383
|
name: siteName ? `${siteName} Blog` : "Blog",
|
|
381
384
|
description: description || "Our latest articles and insights.",
|
|
382
|
-
url:
|
|
385
|
+
url: chunkLC7AM4J5_js.resolveBlogUrl(chunkLC7AM4J5_js.createBlogRoutes(options).index, siteUrl)
|
|
383
386
|
};
|
|
384
387
|
}
|
|
385
388
|
function generateFaqSchema(faqItems) {
|
|
@@ -404,7 +407,7 @@ function generateHowToSchema(post, steps, options = {}) {
|
|
|
404
407
|
"@type": "HowTo",
|
|
405
408
|
name: post.title,
|
|
406
409
|
description: sanitizeExcerpt(post.excerpt || post.meta_description),
|
|
407
|
-
image: post.
|
|
410
|
+
image: chunkLC7AM4J5_js.resolveBlogArtwork(post, "article").src,
|
|
408
411
|
totalTime: post.reading_time ? `PT${post.reading_time}M` : void 0,
|
|
409
412
|
step: steps.map((step, index) => ({
|
|
410
413
|
"@type": "HowToStep",
|
|
@@ -412,12 +415,14 @@ function generateHowToSchema(post, steps, options = {}) {
|
|
|
412
415
|
name: step.name,
|
|
413
416
|
text: step.text,
|
|
414
417
|
image: step.image,
|
|
415
|
-
url: step.url || `${siteUrl}
|
|
418
|
+
url: step.url || `${chunkLC7AM4J5_js.resolveBlogPostUrl(post, { ...options, siteUrl }).split("#")[0]}#step-${index + 1}`
|
|
416
419
|
}))
|
|
417
420
|
};
|
|
418
421
|
}
|
|
419
422
|
var FEED_MAX_POSTS = 100;
|
|
420
|
-
async function getAllBlogPosts() {
|
|
423
|
+
async function getAllBlogPosts(options = {}) {
|
|
424
|
+
const maxPosts = options.maxPosts ?? FEED_MAX_POSTS;
|
|
425
|
+
if (!(maxPosts > 0)) return [];
|
|
421
426
|
const config = chunkO5GHP7UO_js.resolveServerApiConfig();
|
|
422
427
|
if (!config) {
|
|
423
428
|
console.warn("[Blog] No API key configured");
|
|
@@ -427,7 +432,7 @@ async function getAllBlogPosts() {
|
|
|
427
432
|
const posts = [];
|
|
428
433
|
let page = 1;
|
|
429
434
|
try {
|
|
430
|
-
while (posts.length <
|
|
435
|
+
while (posts.length < maxPosts) {
|
|
431
436
|
const response = await fetch(
|
|
432
437
|
`${apiUrl}/public/blog/posts?per_page=50&page=${page}`,
|
|
433
438
|
{
|
|
@@ -437,14 +442,15 @@ async function getAllBlogPosts() {
|
|
|
437
442
|
);
|
|
438
443
|
if (!response.ok) break;
|
|
439
444
|
const data = await response.json();
|
|
440
|
-
|
|
441
|
-
|
|
445
|
+
const batch = data.posts || [];
|
|
446
|
+
posts.push(...batch);
|
|
447
|
+
if (!batch.length || !data.pagination?.has_next) break;
|
|
442
448
|
page += 1;
|
|
443
449
|
}
|
|
444
450
|
} catch (error) {
|
|
445
451
|
console.error("[Blog] Error fetching posts for RSS:", error);
|
|
446
452
|
}
|
|
447
|
-
return posts.slice(0,
|
|
453
|
+
return posts.slice(0, maxPosts);
|
|
448
454
|
}
|
|
449
455
|
function escapeXml(text) {
|
|
450
456
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -476,7 +482,7 @@ async function generateRssFeed(options) {
|
|
|
476
482
|
<lastBuildDate>${now}</lastBuildDate>
|
|
477
483
|
<pubDate>${now}</pubDate>
|
|
478
484
|
<ttl>${ttl}</ttl>
|
|
479
|
-
<atom:link href="${siteUrl}
|
|
485
|
+
<atom:link href="${escapeXml(chunkLC7AM4J5_js.resolveBlogUrl(chunkLC7AM4J5_js.createBlogRoutes(options).rss, siteUrl))}" rel="self" type="application/rss+xml"/>
|
|
480
486
|
`;
|
|
481
487
|
if (copyright) {
|
|
482
488
|
rss += ` <copyright>${escapeXml(copyright)}</copyright>
|
|
@@ -499,15 +505,15 @@ async function generateRssFeed(options) {
|
|
|
499
505
|
`;
|
|
500
506
|
}
|
|
501
507
|
for (const post of posts) {
|
|
502
|
-
const postUrl =
|
|
508
|
+
const postUrl = chunkLC7AM4J5_js.resolveBlogPostUrl(post, { ...options, siteUrl });
|
|
503
509
|
const pubDate = post.published_at ? new Date(post.published_at).toUTCString() : now;
|
|
504
510
|
const author = typeof post.author === "string" ? post.author : post.author?.name || "Unknown";
|
|
505
511
|
const fullContent = post.content_html || post.content || "";
|
|
506
512
|
const description2 = sanitizeExcerpt(post.excerpt, 300) || stripHtml(fullContent).substring(0, 300) + "...";
|
|
507
513
|
rss += ` <item>
|
|
508
514
|
<title>${escapeXml(post.title)}</title>
|
|
509
|
-
<link>${postUrl}</link>
|
|
510
|
-
<guid isPermaLink="true">${postUrl}</guid>
|
|
515
|
+
<link>${escapeXml(postUrl)}</link>
|
|
516
|
+
<guid isPermaLink="true">${escapeXml(postUrl)}</guid>
|
|
511
517
|
<description>${escapeXml(description2)}</description>
|
|
512
518
|
<content:encoded><![CDATA[${fullContent}]]></content:encoded>
|
|
513
519
|
<pubDate>${pubDate}</pubDate>
|
|
@@ -549,9 +555,9 @@ async function generateAtomFeed(options) {
|
|
|
549
555
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
|
550
556
|
<title>${escapeXml(siteName)}</title>
|
|
551
557
|
<subtitle>${escapeXml(description)}</subtitle>
|
|
552
|
-
<link href="${siteUrl}
|
|
558
|
+
<link href="${escapeXml(chunkLC7AM4J5_js.resolveBlogUrl(chunkLC7AM4J5_js.createBlogRoutes(options).atom, siteUrl))}" rel="self"/>
|
|
553
559
|
<link href="${siteUrl}"/>
|
|
554
|
-
<id>${siteUrl}
|
|
560
|
+
<id>${escapeXml(chunkLC7AM4J5_js.resolveBlogUrl(chunkLC7AM4J5_js.createBlogRoutes(options).index, siteUrl))}</id>
|
|
555
561
|
<updated>${now}</updated>
|
|
556
562
|
`;
|
|
557
563
|
if (managingEditor) {
|
|
@@ -561,15 +567,15 @@ async function generateAtomFeed(options) {
|
|
|
561
567
|
`;
|
|
562
568
|
}
|
|
563
569
|
for (const post of posts) {
|
|
564
|
-
const postUrl =
|
|
570
|
+
const postUrl = chunkLC7AM4J5_js.resolveBlogPostUrl(post, { ...options, siteUrl });
|
|
565
571
|
const updated = post.updated_at || post.published_at || now;
|
|
566
572
|
const published = post.published_at || now;
|
|
567
573
|
const author = typeof post.author === "string" ? post.author : post.author?.name || "Unknown";
|
|
568
574
|
const fullContent = post.content_html || post.content || "";
|
|
569
575
|
atom += ` <entry>
|
|
570
576
|
<title>${escapeXml(post.title)}</title>
|
|
571
|
-
<link href="${postUrl}"/>
|
|
572
|
-
<id>${postUrl}</id>
|
|
577
|
+
<link href="${escapeXml(postUrl)}"/>
|
|
578
|
+
<id>${escapeXml(postUrl)}</id>
|
|
573
579
|
<updated>${new Date(updated).toISOString()}</updated>
|
|
574
580
|
<published>${new Date(published).toISOString()}</published>
|
|
575
581
|
<author>
|
|
@@ -700,7 +706,7 @@ async function getPostsByCategory(categorySlug) {
|
|
|
700
706
|
}
|
|
701
707
|
}
|
|
702
708
|
function generateClusterItemListSchema(cluster, options = {}) {
|
|
703
|
-
const { siteUrl = ""
|
|
709
|
+
const { siteUrl = "" } = options;
|
|
704
710
|
return {
|
|
705
711
|
"@context": "https://schema.org",
|
|
706
712
|
"@type": "ItemList",
|
|
@@ -711,19 +717,19 @@ function generateClusterItemListSchema(cluster, options = {}) {
|
|
|
711
717
|
"@type": "ListItem",
|
|
712
718
|
position: i + 1,
|
|
713
719
|
name: post.title,
|
|
714
|
-
url:
|
|
720
|
+
url: chunkLC7AM4J5_js.resolveBlogPostUrl(post, { ...options, siteUrl })
|
|
715
721
|
}))
|
|
716
722
|
};
|
|
717
723
|
}
|
|
718
724
|
function generateClusterArticleSchema(post, cluster, options = {}) {
|
|
719
|
-
const { siteUrl = "",
|
|
725
|
+
const { siteUrl = "", siteName, logoUrl } = options;
|
|
720
726
|
const isPillar = post.article_type === "pillar";
|
|
721
727
|
const schema = {
|
|
722
728
|
"@context": "https://schema.org",
|
|
723
729
|
"@type": "Article",
|
|
724
730
|
headline: post.title,
|
|
725
731
|
description: sanitizeExcerpt(post.excerpt || post.meta_description),
|
|
726
|
-
url:
|
|
732
|
+
url: chunkLC7AM4J5_js.resolveBlogPostUrl(post, { ...options, siteUrl }),
|
|
727
733
|
datePublished: post.published_at,
|
|
728
734
|
dateModified: post.updated_at,
|
|
729
735
|
author: {
|
|
@@ -732,9 +738,8 @@ function generateClusterArticleSchema(post, cluster, options = {}) {
|
|
|
732
738
|
},
|
|
733
739
|
keywords: post.focus_keyphrase || post.keywords
|
|
734
740
|
};
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
}
|
|
741
|
+
const articleImage = chunkLC7AM4J5_js.resolveBlogArtwork(post, "article").src;
|
|
742
|
+
if (articleImage) schema.image = articleImage;
|
|
738
743
|
if (siteName || logoUrl) {
|
|
739
744
|
schema.publisher = {
|
|
740
745
|
"@type": "Organization",
|
|
@@ -746,13 +751,13 @@ function generateClusterArticleSchema(post, cluster, options = {}) {
|
|
|
746
751
|
schema.hasPart = cluster.supports.map((s) => ({
|
|
747
752
|
"@type": "Article",
|
|
748
753
|
headline: s.title,
|
|
749
|
-
url:
|
|
754
|
+
url: chunkLC7AM4J5_js.resolveBlogPostUrl(s, { ...options, siteUrl })
|
|
750
755
|
}));
|
|
751
756
|
} else if (!isPillar && cluster.pillar) {
|
|
752
757
|
schema.isPartOf = {
|
|
753
758
|
"@type": "Article",
|
|
754
759
|
headline: cluster.pillar.title,
|
|
755
|
-
url:
|
|
760
|
+
url: chunkLC7AM4J5_js.resolveBlogPostUrl(cluster.pillar, { ...options, siteUrl })
|
|
756
761
|
};
|
|
757
762
|
}
|
|
758
763
|
if (cluster.geo_target) {
|
|
@@ -764,21 +769,21 @@ function generateClusterArticleSchema(post, cluster, options = {}) {
|
|
|
764
769
|
return schema;
|
|
765
770
|
}
|
|
766
771
|
function generateClusterBreadcrumbSchema(post, cluster, options = {}) {
|
|
767
|
-
const { siteUrl = "", siteName = "Home"
|
|
772
|
+
const { siteUrl = "", siteName = "Home" } = options;
|
|
768
773
|
const items = [
|
|
769
774
|
{ "@type": "ListItem", position: 1, name: siteName, item: siteUrl },
|
|
770
|
-
{ "@type": "ListItem", position: 2, name: "Blog", item:
|
|
775
|
+
{ "@type": "ListItem", position: 2, name: "Blog", item: chunkLC7AM4J5_js.resolveBlogUrl(chunkLC7AM4J5_js.createBlogRoutes(options).index, siteUrl) },
|
|
771
776
|
{
|
|
772
777
|
"@type": "ListItem",
|
|
773
778
|
position: 3,
|
|
774
779
|
name: cluster.cluster_name,
|
|
775
|
-
item:
|
|
780
|
+
item: chunkLC7AM4J5_js.resolveBlogUrl(chunkLC7AM4J5_js.createBlogRoutes(options).cluster(cluster.cluster_slug), siteUrl)
|
|
776
781
|
},
|
|
777
782
|
{
|
|
778
783
|
"@type": "ListItem",
|
|
779
784
|
position: 4,
|
|
780
785
|
name: post.title,
|
|
781
|
-
item:
|
|
786
|
+
item: chunkLC7AM4J5_js.resolveBlogPostUrl(post, { ...options, siteUrl })
|
|
782
787
|
}
|
|
783
788
|
];
|
|
784
789
|
return {
|
|
@@ -788,32 +793,32 @@ function generateClusterBreadcrumbSchema(post, cluster, options = {}) {
|
|
|
788
793
|
};
|
|
789
794
|
}
|
|
790
795
|
function generateClusterLandingSchema(cluster, options = {}) {
|
|
791
|
-
const { siteUrl = "",
|
|
796
|
+
const { siteUrl = "", siteName } = options;
|
|
792
797
|
return {
|
|
793
798
|
"@context": "https://schema.org",
|
|
794
799
|
"@type": "CollectionPage",
|
|
795
800
|
name: cluster.cluster_name,
|
|
796
801
|
description: `Comprehensive guide to ${cluster.core_topic}`,
|
|
797
|
-
url:
|
|
802
|
+
url: chunkLC7AM4J5_js.resolveBlogUrl(chunkLC7AM4J5_js.createBlogRoutes(options).cluster(cluster.cluster_slug), siteUrl),
|
|
798
803
|
...siteName && {
|
|
799
804
|
isPartOf: { "@type": "WebSite", name: siteName, url: siteUrl }
|
|
800
805
|
},
|
|
801
806
|
mainEntity: cluster.pillar ? {
|
|
802
807
|
"@type": "Article",
|
|
803
808
|
headline: cluster.pillar.title,
|
|
804
|
-
url:
|
|
809
|
+
url: chunkLC7AM4J5_js.resolveBlogPostUrl(cluster.pillar, { ...options, siteUrl })
|
|
805
810
|
} : void 0,
|
|
806
811
|
hasPart: cluster.supports.map((s) => ({
|
|
807
812
|
"@type": "Article",
|
|
808
813
|
headline: s.title,
|
|
809
|
-
url:
|
|
814
|
+
url: chunkLC7AM4J5_js.resolveBlogPostUrl(s, { ...options, siteUrl })
|
|
810
815
|
}))
|
|
811
816
|
};
|
|
812
817
|
}
|
|
813
818
|
async function generateClusterPageMetadata(clusterSlug, options = {}) {
|
|
814
819
|
const cluster = await getTopicCluster(clusterSlug);
|
|
815
820
|
if (!cluster) return {};
|
|
816
|
-
const { siteName = "", siteUrl = ""
|
|
821
|
+
const { siteName = "", siteUrl = "" } = options;
|
|
817
822
|
const title = `${cluster.cluster_name}${siteName ? ` | ${siteName}` : ""}`;
|
|
818
823
|
const description = `Comprehensive guide to ${cluster.core_topic}. ${cluster.article_count} articles covering everything you need to know.`;
|
|
819
824
|
return {
|
|
@@ -822,7 +827,7 @@ async function generateClusterPageMetadata(clusterSlug, options = {}) {
|
|
|
822
827
|
openGraph: {
|
|
823
828
|
title,
|
|
824
829
|
description,
|
|
825
|
-
url:
|
|
830
|
+
url: chunkLC7AM4J5_js.resolveBlogUrl(chunkLC7AM4J5_js.createBlogRoutes(options).cluster(cluster.cluster_slug), siteUrl),
|
|
826
831
|
type: "website"
|
|
827
832
|
}
|
|
828
833
|
};
|
|
@@ -868,7 +873,7 @@ function generateBreadcrumbSchema(post, options = {}) {
|
|
|
868
873
|
"@type": "ListItem",
|
|
869
874
|
position: 2,
|
|
870
875
|
name: "Blog",
|
|
871
|
-
item:
|
|
876
|
+
item: chunkLC7AM4J5_js.resolveBlogUrl(chunkLC7AM4J5_js.createBlogRoutes(options).index, siteUrl)
|
|
872
877
|
}
|
|
873
878
|
];
|
|
874
879
|
if (post.category) {
|
|
@@ -878,20 +883,20 @@ function generateBreadcrumbSchema(post, options = {}) {
|
|
|
878
883
|
"@type": "ListItem",
|
|
879
884
|
position: 3,
|
|
880
885
|
name: categoryName,
|
|
881
|
-
item:
|
|
886
|
+
item: chunkLC7AM4J5_js.resolveBlogUrl(chunkLC7AM4J5_js.createBlogRoutes(options).category(categorySlug), siteUrl)
|
|
882
887
|
});
|
|
883
888
|
items.push({
|
|
884
889
|
"@type": "ListItem",
|
|
885
890
|
position: 4,
|
|
886
891
|
name: post.title,
|
|
887
|
-
item:
|
|
892
|
+
item: chunkLC7AM4J5_js.resolveBlogPostUrl(post, { ...options, siteUrl })
|
|
888
893
|
});
|
|
889
894
|
} else {
|
|
890
895
|
items.push({
|
|
891
896
|
"@type": "ListItem",
|
|
892
897
|
position: 3,
|
|
893
898
|
name: post.title,
|
|
894
|
-
item:
|
|
899
|
+
item: chunkLC7AM4J5_js.resolveBlogPostUrl(post, { ...options, siteUrl })
|
|
895
900
|
});
|
|
896
901
|
}
|
|
897
902
|
return {
|
|
@@ -1000,7 +1005,7 @@ function generateAuthorPageMetadata(author, options = {}) {
|
|
|
1000
1005
|
const { siteUrl = "", siteName } = options;
|
|
1001
1006
|
const title = `${author.name}${author.title ? ` - ${author.title}` : ""}`;
|
|
1002
1007
|
const description = author.short_bio || author.bio || `Articles by ${author.name}`;
|
|
1003
|
-
const url =
|
|
1008
|
+
const url = chunkLC7AM4J5_js.resolveBlogUrl(chunkLC7AM4J5_js.createBlogRoutes(options).author(author.slug), siteUrl);
|
|
1004
1009
|
return {
|
|
1005
1010
|
title,
|
|
1006
1011
|
description,
|
|
@@ -1063,5 +1068,5 @@ exports.sanitizeExcerpt = sanitizeExcerpt;
|
|
|
1063
1068
|
exports.validateBlogPostSeo = validateBlogPostSeo;
|
|
1064
1069
|
exports.validateMetaDescription = validateMetaDescription;
|
|
1065
1070
|
exports.validateSeoTitle = validateSeoTitle;
|
|
1066
|
-
//# sourceMappingURL=chunk-
|
|
1067
|
-
//# sourceMappingURL=chunk-
|
|
1071
|
+
//# sourceMappingURL=chunk-746RKQHA.js.map
|
|
1072
|
+
//# sourceMappingURL=chunk-746RKQHA.js.map
|