create-ailk 0.38.0 → 0.40.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/dist/add-route.js +16 -1
- package/dist/body-heading.d.ts +2 -1
- package/dist/body-heading.js +31 -3
- package/dist/derive-architecture.js +3 -1
- package/dist/module-architecture.js +0 -3
- package/dist/remove-module.js +27 -14
- package/dist/routes.d.ts +36 -2
- package/dist/routes.js +269 -23
- package/dist/site-manifest.js +6 -4
- package/dist/site-roster.d.ts +11 -3
- package/dist/site-roster.js +48 -22
- package/dist/surfaces.d.ts +13 -3
- package/dist/surfaces.js +128 -194
- package/dist/sync-routes.js +22 -5
- package/dist/template-record.js +3 -1
- package/dist/topology.d.ts +11 -0
- package/dist/topology.js +253 -3
- package/package.json +3 -3
- package/templates/apps/web/CLAUDE.md +32 -4
- package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +6 -1
- package/templates/apps/web/__tests__/__mocks__/next-intl.ts +6 -1
- package/templates/apps/web/__tests__/auth/seam.test.ts +34 -0
- package/templates/apps/web/account.config.tsx +2 -3
- package/templates/apps/web/app/[locale]/(authed)/account/connect/__tests__/page.test.tsx +1 -1
- package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +1 -1
- package/templates/apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx +1 -1
- package/templates/apps/web/app/[locale]/layout.tsx +2 -2
- package/templates/apps/web/auth.config.tsx +107 -0
- package/templates/apps/web/auth.ts +2 -1
- package/templates/apps/web/i18n/request.ts +13 -2
- package/templates/apps/web/jest.config.cjs +10 -0
- package/templates/apps/web/lib/__tests__/deck-page.test.ts +9 -0
- package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +3 -0
- package/templates/apps/web/lib/__tests__/in-page-magnet-self-request.test.ts +1 -1
- package/templates/apps/web/lib/__tests__/in-page-magnet.test.ts +2 -2
- package/templates/apps/web/lib/__tests__/pricing-page.test.ts +1 -1
- package/templates/apps/web/lib/__tests__/server-api.test.ts +1 -1
- package/templates/apps/web/lib/__tests__/structured-data.test.tsx +17 -4
- package/templates/apps/web/lib/in-page-magnet.ts +2 -2
- package/templates/apps/web/lib/pricing-page.ts +3 -3
- package/templates/apps/web/lib/server-api.ts +1 -1
- package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-email.ts +1 -1
- package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-lines.ts +1 -1
- package/templates/apps/web/lib/site-header.ts +1 -1
- package/templates/apps/web/lib/topology.generated.ts +5 -0
- package/templates/apps/web/messages/en.json +0 -271
- package/templates/apps/web/middleware.ts +12 -25
- package/templates/apps/web/next.config.mjs +15 -0
- package/templates/apps/web/package.json +2 -0
- package/templates/apps/web/site-pages.config.tsx +85 -0
- package/templates/apps/web/types/messages.d.ts +6 -1
- package/templates/tools/body-heading.ts +30 -3
- package/versions.json +50 -48
- package/templates/apps/web/app/[locale]/(auth)/__tests__/auth-pages.test.tsx +0 -322
- package/templates/apps/web/app/[locale]/(auth)/__tests__/password-reset.test.tsx +0 -554
- package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/consent-actions.test.ts +0 -56
- package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/page.test.tsx +0 -164
- package/templates/apps/web/app/[locale]/(auth)/consent/consent-form.tsx +0 -132
- package/templates/apps/web/app/[locale]/(auth)/consent/consent.actions.ts +0 -51
- package/templates/apps/web/app/[locale]/(auth)/consent/page.tsx +0 -144
- package/templates/apps/web/app/[locale]/(auth)/forgot-password/forgot-password-card.tsx +0 -101
- package/templates/apps/web/app/[locale]/(auth)/forgot-password/page.tsx +0 -111
- package/templates/apps/web/app/[locale]/(auth)/layout.tsx +0 -81
- package/templates/apps/web/app/[locale]/(auth)/legal-footnote.tsx +0 -35
- package/templates/apps/web/app/[locale]/(auth)/reset-password/__tests__/return.test.tsx +0 -179
- package/templates/apps/web/app/[locale]/(auth)/reset-password/page.tsx +0 -157
- package/templates/apps/web/app/[locale]/(auth)/reset-password/reset-password-card.tsx +0 -126
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/next-path.test.ts +0 -54
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/page.test.tsx +0 -628
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/remembered-method.test.ts +0 -43
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/sign-in-card.test.tsx +0 -266
- package/templates/apps/web/app/[locale]/(auth)/sign-in/next-path.ts +0 -20
- package/templates/apps/web/app/[locale]/(auth)/sign-in/page.tsx +0 -234
- package/templates/apps/web/app/[locale]/(auth)/sign-in/remembered-method.ts +0 -37
- package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-card.tsx +0 -323
- package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-text.ts +0 -93
- package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/page.test.tsx +0 -301
- package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/sign-up-card.test.tsx +0 -309
- package/templates/apps/web/app/[locale]/(auth)/sign-up/page.tsx +0 -201
- package/templates/apps/web/app/[locale]/(auth)/sign-up/sign-up-card.tsx +0 -366
- package/templates/apps/web/app/[locale]/(auth)/use-auth-card-flow.ts +0 -116
- package/templates/apps/web/app/[locale]/(auth)/verify-email/__tests__/actions.test.ts +0 -94
- package/templates/apps/web/app/[locale]/(auth)/verify-email/actions.ts +0 -77
- package/templates/apps/web/app/[locale]/(auth)/verify-email/page.tsx +0 -154
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +0 -3
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +0 -3
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +0 -3
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +0 -2
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +0 -3
- package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +0 -12
- package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +0 -12
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +0 -12
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +0 -2
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +0 -12
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +0 -3
- package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +0 -10
- package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +0 -3
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +0 -3
- package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +0 -12
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +0 -2
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +0 -3
- package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +0 -3
- package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +0 -2
- package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +0 -3
- package/templates/apps/web/app/[locale]/(authed)/leads/__tests__/page.test.tsx +0 -205
- package/templates/apps/web/app/[locale]/(authed)/leads/components/LeadsTable.tsx +0 -137
- package/templates/apps/web/app/[locale]/(authed)/leads/page.tsx +0 -122
- package/templates/apps/web/app/[locale]/(authed)/waitlist/components/ForbiddenState.tsx +0 -24
- package/templates/apps/web/app/[locale]/(authed)/waitlist/format.ts +0 -111
- package/templates/apps/web/app/[locale]/[slug]/[detail]/__tests__/page.test.tsx +0 -402
- package/templates/apps/web/app/[locale]/[slug]/[detail]/page.tsx +0 -143
- package/templates/apps/web/app/[locale]/[slug]/__tests__/page.test.tsx +0 -148
- package/templates/apps/web/app/[locale]/[slug]/page.tsx +0 -109
- package/templates/apps/web/app/[locale]/about/[slug]/page.tsx +0 -46
- package/templates/apps/web/app/[locale]/about/__tests__/about-routes.test.tsx +0 -353
- package/templates/apps/web/app/[locale]/about/page.tsx +0 -122
- package/templates/apps/web/app/[locale]/alternatives/__tests__/page.test.tsx +0 -161
- package/templates/apps/web/app/[locale]/alternatives/page.tsx +0 -112
- package/templates/apps/web/app/[locale]/careers/[slug]/[action]/page.tsx +0 -244
- package/templates/apps/web/app/[locale]/careers/[slug]/apply.actions.ts +0 -325
- package/templates/apps/web/app/[locale]/careers/[slug]/job-application-form.ts +0 -120
- package/templates/apps/web/app/[locale]/careers/[slug]/page.tsx +0 -73
- package/templates/apps/web/app/[locale]/careers/__tests__/apply.actions.test.ts +0 -497
- package/templates/apps/web/app/[locale]/careers/__tests__/careers-hub.test.tsx +0 -172
- package/templates/apps/web/app/[locale]/careers/__tests__/careers-set.test.tsx +0 -153
- package/templates/apps/web/app/[locale]/careers/__tests__/job-application-form.test.ts +0 -141
- package/templates/apps/web/app/[locale]/careers/__tests__/job-apply-page.test.tsx +0 -546
- package/templates/apps/web/app/[locale]/careers/__tests__/page-renderer-migration.test.tsx +0 -189
- package/templates/apps/web/app/[locale]/careers/page.tsx +0 -165
- package/templates/apps/web/app/[locale]/case-studies/[slug]/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/case-studies/__tests__/hub-children.test.tsx +0 -65
- package/templates/apps/web/app/[locale]/case-studies/__tests__/page-renderer-migration.test.tsx +0 -125
- package/templates/apps/web/app/[locale]/case-studies/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/clients/__tests__/page-renderer-migration.test.tsx +0 -85
- package/templates/apps/web/app/[locale]/clients/page.tsx +0 -47
- package/templates/apps/web/app/[locale]/contact/ConversationalIntakeWrapper.tsx +0 -249
- package/templates/apps/web/app/[locale]/contact/__tests__/ConversationalIntakeWrapper.test.tsx +0 -400
- package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-magnet.test.ts +0 -138
- package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-text.test.ts +0 -49
- package/templates/apps/web/app/[locale]/contact/__tests__/contact-magnet-page.test.tsx +0 -494
- package/templates/apps/web/app/[locale]/contact/__tests__/contact.actions.test.ts +0 -1122
- package/templates/apps/web/app/[locale]/contact/__tests__/intake-analytics.test.ts +0 -51
- package/templates/apps/web/app/[locale]/contact/__tests__/page-renderer-migration.test.tsx +0 -319
- package/templates/apps/web/app/[locale]/contact/contact-form-magnet.ts +0 -77
- package/templates/apps/web/app/[locale]/contact/contact-form-text.ts +0 -52
- package/templates/apps/web/app/[locale]/contact/contact.actions.ts +0 -403
- package/templates/apps/web/app/[locale]/contact/intake-analytics.ts +0 -49
- package/templates/apps/web/app/[locale]/contact/intake-script.ts +0 -92
- package/templates/apps/web/app/[locale]/contact/page.tsx +0 -267
- package/templates/apps/web/app/[locale]/courses/[slug]/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/courses/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/courses/__tests__/page-renderer-migration.test.tsx +0 -123
- package/templates/apps/web/app/[locale]/courses/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/events/[slug]/page.tsx +0 -57
- package/templates/apps/web/app/[locale]/events/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/events/__tests__/page-renderer-migration.test.tsx +0 -164
- package/templates/apps/web/app/[locale]/events/__tests__/program-event.test.tsx +0 -120
- package/templates/apps/web/app/[locale]/events/page.tsx +0 -60
- package/templates/apps/web/app/[locale]/faq/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/features/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/features/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/features/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/for/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/for/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/for/__tests__/page-renderer-migration.test.tsx +0 -90
- package/templates/apps/web/app/[locale]/for/page.tsx +0 -51
- package/templates/apps/web/app/[locale]/glossary/page.tsx +0 -53
- package/templates/apps/web/app/[locale]/how-to/[slug]/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/how-to/__tests__/page-renderer-migration.test.tsx +0 -78
- package/templates/apps/web/app/[locale]/how-to/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/integrations/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/integrations/__tests__/hub-children.test.tsx +0 -38
- package/templates/apps/web/app/[locale]/integrations/__tests__/page-renderer-migration.test.tsx +0 -141
- package/templates/apps/web/app/[locale]/integrations/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/launch-service/page.tsx +0 -44
- package/templates/apps/web/app/[locale]/newsletter/__tests__/page.test.tsx +0 -236
- package/templates/apps/web/app/[locale]/newsletter/page.tsx +0 -179
- package/templates/apps/web/app/[locale]/page.tsx +0 -147
- package/templates/apps/web/app/[locale]/partners/[slug]/page.tsx +0 -45
- package/templates/apps/web/app/[locale]/partners/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/partners/__tests__/page-renderer-migration.test.tsx +0 -125
- package/templates/apps/web/app/[locale]/partners/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/portfolio/[slug]/page.tsx +0 -46
- package/templates/apps/web/app/[locale]/portfolio/__tests__/hub-children.test.tsx +0 -38
- package/templates/apps/web/app/[locale]/portfolio/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/pricing/[slug]/__tests__/page.test.tsx +0 -324
- package/templates/apps/web/app/[locale]/pricing/[slug]/page.tsx +0 -87
- package/templates/apps/web/app/[locale]/pricing/__tests__/__snapshots__/unconnected.test.tsx.snap +0 -7
- package/templates/apps/web/app/[locale]/pricing/__tests__/offerings.test.tsx +0 -605
- package/templates/apps/web/app/[locale]/pricing/__tests__/page.test.tsx +0 -219
- package/templates/apps/web/app/[locale]/pricing/__tests__/pricing-pages.test.tsx +0 -215
- package/templates/apps/web/app/[locale]/pricing/__tests__/unconnected.test.tsx +0 -282
- package/templates/apps/web/app/[locale]/pricing/page.tsx +0 -120
- package/templates/apps/web/app/[locale]/privacy/page.tsx +0 -40
- package/templates/apps/web/app/[locale]/products/[slug]/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/products/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/products/__tests__/page-renderer-migration.test.tsx +0 -141
- package/templates/apps/web/app/[locale]/products/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/projects/[slug]/page.tsx +0 -37
- package/templates/apps/web/app/[locale]/projects/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/projects/__tests__/page-renderer-migration.test.tsx +0 -157
- package/templates/apps/web/app/[locale]/projects/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/purchase-policy/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/resources/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/resources/__tests__/hub-children.test.tsx +0 -38
- package/templates/apps/web/app/[locale]/resources/__tests__/page-renderer-migration.test.tsx +0 -151
- package/templates/apps/web/app/[locale]/resources/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/services/[slug]/[child]/page.tsx +0 -68
- package/templates/apps/web/app/[locale]/services/[slug]/page.tsx +0 -88
- package/templates/apps/web/app/[locale]/services/__tests__/hub-children.test.tsx +0 -158
- package/templates/apps/web/app/[locale]/services/__tests__/page-renderer-migration.test.tsx +0 -187
- package/templates/apps/web/app/[locale]/services/__tests__/service-detail-sections.test.tsx +0 -224
- package/templates/apps/web/app/[locale]/services/__tests__/service-families.test.tsx +0 -368
- package/templates/apps/web/app/[locale]/services/page.tsx +0 -71
- package/templates/apps/web/app/[locale]/software/[slug]/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/software/__tests__/page-renderer-migration.test.tsx +0 -81
- package/templates/apps/web/app/[locale]/software/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/team/[slug]/page.tsx +0 -45
- package/templates/apps/web/app/[locale]/team/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/team/__tests__/team-routes.test.tsx +0 -161
- package/templates/apps/web/app/[locale]/team/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/tech-articles/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/tech-articles/__tests__/page-renderer-migration.test.tsx +0 -82
- package/templates/apps/web/app/[locale]/tech-articles/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/templates/[slug]/__tests__/page.test.tsx +0 -203
- package/templates/apps/web/app/[locale]/templates/[slug]/page.tsx +0 -81
- package/templates/apps/web/app/[locale]/templates/__tests__/page.test.tsx +0 -237
- package/templates/apps/web/app/[locale]/templates/page.tsx +0 -114
- package/templates/apps/web/app/[locale]/terms/page.tsx +0 -40
- package/templates/apps/web/app/[locale]/testimonials/__tests__/page-renderer-migration.test.tsx +0 -85
- package/templates/apps/web/app/[locale]/testimonials/page.tsx +0 -51
- package/templates/apps/web/app/[locale]/thanks/[slug]/__tests__/page.test.tsx +0 -136
- package/templates/apps/web/app/[locale]/thanks/[slug]/page.tsx +0 -39
- package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe-rsc-boundary.test.tsx +0 -226
- package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe.test.tsx +0 -217
- package/templates/apps/web/app/[locale]/unsubscribe/page.tsx +0 -106
- package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe-button.tsx +0 -94
- package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe.actions.ts +0 -55
- package/templates/apps/web/app/[locale]/vs/[slug]/__tests__/page.test.tsx +0 -100
- package/templates/apps/web/app/[locale]/vs/[slug]/page.tsx +0 -60
- package/templates/apps/web/app/[locale]/whitepapers/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/whitepapers/__tests__/page-renderer-migration.test.tsx +0 -82
- package/templates/apps/web/app/[locale]/whitepapers/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/working-agreement/__tests__/page.test.tsx +0 -63
- package/templates/apps/web/app/[locale]/working-agreement/page.tsx +0 -41
- package/templates/apps/web/app/api/auth/[...all]/route.ts +0 -16
- package/templates/apps/web/app/api/auth/hub/__tests__/continuation.test.ts +0 -143
- package/templates/apps/web/app/api/auth/hub/__tests__/entry-routes.test.ts +0 -749
- package/templates/apps/web/app/api/auth/hub/authorize/__tests__/route.test.ts +0 -964
- package/templates/apps/web/app/api/auth/hub/authorize/route.ts +0 -390
- package/templates/apps/web/app/api/auth/hub/continuation.ts +0 -127
- package/templates/apps/web/app/api/auth/hub/continue/[ref]/__tests__/route.test.ts +0 -188
- package/templates/apps/web/app/api/auth/hub/continue/[ref]/route.ts +0 -53
- package/templates/apps/web/app/api/auth/hub/email/route.ts +0 -111
- package/templates/apps/web/app/api/auth/hub/entry-shared.ts +0 -163
- package/templates/apps/web/app/api/auth/hub/password/__tests__/return.test.ts +0 -86
- package/templates/apps/web/app/api/auth/hub/password/__tests__/route.test.ts +0 -368
- package/templates/apps/web/app/api/auth/hub/password/return.ts +0 -86
- package/templates/apps/web/app/api/auth/hub/password/route.ts +0 -171
- package/templates/apps/web/app/api/auth/hub/purchase/route.ts +0 -230
- package/templates/apps/web/app/api/auth/hub/purchase-link/route.ts +0 -174
- package/templates/apps/web/app/api/auth/hub/sign-up/route.ts +0 -60
- package/templates/apps/web/app/api/auth/hub/sign-up-evidence.ts +0 -97
- package/templates/apps/web/app/api/auth/mcp/__tests__/continuation.test.ts +0 -92
- package/templates/apps/web/app/api/auth/mcp/continuation.ts +0 -89
- package/templates/apps/web/app/api/auth/mcp/continue/[ref]/__tests__/route.test.ts +0 -59
- package/templates/apps/web/app/api/auth/mcp/continue/[ref]/route.ts +0 -41
- package/templates/apps/web/app/api/hub-session/__tests__/routes.test.ts +0 -1166
- package/templates/apps/web/app/api/hub-session/callback/route.ts +0 -134
- package/templates/apps/web/app/api/hub-session/email/route.ts +0 -125
- package/templates/apps/web/app/api/hub-session/one-tap/nonce/route.ts +0 -49
- package/templates/apps/web/app/api/hub-session/one-tap/route.ts +0 -106
- package/templates/apps/web/app/api/hub-session/open/route.ts +0 -111
- package/templates/apps/web/app/api/hub-session/password/return/route.ts +0 -69
- package/templates/apps/web/app/api/hub-session/password/route.ts +0 -106
- package/templates/apps/web/app/api/hub-session/sign-in/route.ts +0 -91
- package/templates/apps/web/app/api/hub-session/sign-out/route.ts +0 -54
- package/templates/apps/web/components/sign-out-trigger.tsx +0 -62
- package/templates/apps/web/lib/__tests__/auth-routes.test.ts +0 -140
- package/templates/apps/web/lib/__tests__/hub-children.fixtures.ts +0 -279
- package/templates/apps/web/lib/__tests__/route-family.test.ts +0 -57
- package/templates/apps/web/lib/__tests__/service-listing.test.ts +0 -111
- package/templates/apps/web/lib/__tests__/template-listing.test.ts +0 -158
- package/templates/apps/web/lib/auth-routes.ts +0 -125
- package/templates/apps/web/lib/hub-children.tsx +0 -351
- package/templates/apps/web/lib/hub-session/__tests__/hub-session.test.ts +0 -433
- package/templates/apps/web/lib/hub-session/__tests__/spoke-sign-in.test.tsx +0 -332
- package/templates/apps/web/lib/hub-session/config.ts +0 -110
- package/templates/apps/web/lib/hub-session/entry.ts +0 -238
- package/templates/apps/web/lib/hub-session/index.ts +0 -21
- package/templates/apps/web/lib/hub-session/one-tap.tsx +0 -148
- package/templates/apps/web/lib/hub-session/reseal.ts +0 -90
- package/templates/apps/web/lib/hub-session/seal.ts +0 -86
- package/templates/apps/web/lib/hub-session/session.ts +0 -298
- package/templates/apps/web/lib/hub-session/spoke-sign-in.tsx +0 -277
- package/templates/apps/web/lib/meet-placeholder.ts +0 -5
- package/templates/apps/web/lib/next-path.ts +0 -35
- package/templates/apps/web/lib/posting-title.ts +0 -39
- package/templates/apps/web/lib/route-family.ts +0 -69
- package/templates/apps/web/lib/service-listing.ts +0 -89
- package/templates/apps/web/lib/template-listing.ts +0 -169
- package/templates/apps/web/src/lib/__tests__/lead-write.test.ts +0 -187
- package/templates/apps/web/src/lib/lead-write.ts +0 -90
- /package/templates/apps/web/{app/[locale]/contact → lib}/__tests__/site-contact-lines.test.ts +0 -0
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The auth route group's segment list and its path predicate (#5963).
|
|
3
|
-
*
|
|
4
|
-
* ONE module, so the list `app/[locale]/layout.tsx` branches on to drop the
|
|
5
|
-
* marketing chrome and the list the `(auth)` group's page segments exist at
|
|
6
|
-
* cannot drift. A route group contributes no URL segment, so these are the
|
|
7
|
-
* real paths: `/sign-in`, `/sign-up`, `/forgot-password`, `/reset-password`,
|
|
8
|
-
* `/verify-email` and the MCP consent step `/consent` (#10357), each under next-intl's `as-needed` prefixing (bare for
|
|
9
|
-
* the default locale, `/<locale>/…` otherwise).
|
|
10
|
-
*
|
|
11
|
-
* `isAccountPath()` (#7430, spec 7423 D4) is the same predicate for the
|
|
12
|
-
* signed-in account area — `/account` and everything under it — which the
|
|
13
|
-
* layout also renders without the marketing chrome.
|
|
14
|
-
*
|
|
15
|
-
* `isBookingPath()` (#8843 D10) is the same predicate for the scheduling
|
|
16
|
-
* module's booking pages — `/meet`, `/meet/<slug>` and `/private`, never
|
|
17
|
-
* `/meet/confirmed`, plus the member's own booking page
|
|
18
|
-
* `/account/appointments/<slug>` (#11154) — which the layout renders
|
|
19
|
-
* chrome-free only where the module is installed (`lib/modules.generated.ts`)
|
|
20
|
-
* and the middleware grants the scheduling CSP. This module imports nothing,
|
|
21
|
-
* so edge code can import it too.
|
|
22
|
-
*
|
|
23
|
-
* No Next.js import — pure functions, asserted directly by their own suite.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/** The six segments the `(auth)` route group serves. */
|
|
27
|
-
export const AUTH_SEGMENTS = [
|
|
28
|
-
"sign-in",
|
|
29
|
-
"sign-up",
|
|
30
|
-
"forgot-password",
|
|
31
|
-
"reset-password",
|
|
32
|
-
"verify-email",
|
|
33
|
-
// The MCP consent step (#10357 D6).
|
|
34
|
-
"consent",
|
|
35
|
-
] as const;
|
|
36
|
-
|
|
37
|
-
export type AuthSegment = (typeof AUTH_SEGMENTS)[number];
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Whether `pathname` addresses one of the five auth routes.
|
|
41
|
-
*
|
|
42
|
-
* Locale-prefix-aware the same way `resolveLocalePath()` is: strip a leading
|
|
43
|
-
* `/<locale>` when it matches an ENABLED locale, then compare the first
|
|
44
|
-
* remaining segment against the list. A prefix that is not an enabled locale
|
|
45
|
-
* is a first segment, not a prefix.
|
|
46
|
-
*
|
|
47
|
-
* Fail-safe direction: an absent or empty pathname answers `false`. The
|
|
48
|
-
* layout's branch reads a header that can legitimately be missing (a direct
|
|
49
|
-
* render in a unit test, a path the middleware matcher excludes), and a
|
|
50
|
-
* missing header must never strip a marketing page's chrome. The worst case
|
|
51
|
-
* is an auth page that renders WITH chrome, which the group's own tests catch.
|
|
52
|
-
*/
|
|
53
|
-
export function isAuthPath(
|
|
54
|
-
pathname: string | undefined | null,
|
|
55
|
-
locales: readonly string[],
|
|
56
|
-
): boolean {
|
|
57
|
-
const first = firstSegment(pathname, locales);
|
|
58
|
-
return AUTH_SEGMENTS.some((segment) => segment === first);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Whether `pathname` addresses the account area: `/account` or any path
|
|
63
|
-
* under it, bare or locale-prefixed (spec 7423 D4). The same prefix rule and
|
|
64
|
-
* the same fail-safe direction as `isAuthPath()` — an absent or empty
|
|
65
|
-
* pathname answers `false`, so a missing header never strips a marketing
|
|
66
|
-
* page's chrome.
|
|
67
|
-
*/
|
|
68
|
-
export function isAccountPath(
|
|
69
|
-
pathname: string | undefined | null,
|
|
70
|
-
locales: readonly string[],
|
|
71
|
-
): boolean {
|
|
72
|
-
return firstSegment(pathname, locales) === "account";
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Whether `pathname` addresses a booking page: `/private`, `/meet`, or
|
|
77
|
-
* `/meet/<slug>` for any slug but `confirmed` (the booker's confirmation
|
|
78
|
-
* page, which keeps the marketing chrome), or the member's booking page
|
|
79
|
-
* `/account/appointments/<slug>` (#11154) — never the Appointments list
|
|
80
|
-
* itself, which embeds nothing. The same prefix rule and the same fail-safe
|
|
81
|
-
* direction as `isAuthPath()`.
|
|
82
|
-
*/
|
|
83
|
-
export function isBookingPath(
|
|
84
|
-
pathname: string | undefined | null,
|
|
85
|
-
locales: readonly string[],
|
|
86
|
-
): boolean {
|
|
87
|
-
const [first, second, third] = segments(pathname, locales);
|
|
88
|
-
if (first === "private") return true;
|
|
89
|
-
if (first === "account") return second === "appointments" && third !== undefined;
|
|
90
|
-
return first === "meet" && second !== "confirmed";
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* The first path segment after an enabled-locale prefix, or `undefined` for
|
|
95
|
-
* an absent or empty pathname.
|
|
96
|
-
*/
|
|
97
|
-
function firstSegment(
|
|
98
|
-
pathname: string | undefined | null,
|
|
99
|
-
locales: readonly string[],
|
|
100
|
-
): string | undefined {
|
|
101
|
-
return segments(pathname, locales)[0];
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* The path's segments after an enabled-locale prefix (empty for an absent or
|
|
106
|
-
* empty pathname). A trailing slash adds no segment.
|
|
107
|
-
*/
|
|
108
|
-
function segments(
|
|
109
|
-
pathname: string | undefined | null,
|
|
110
|
-
locales: readonly string[],
|
|
111
|
-
): string[] {
|
|
112
|
-
if (!pathname) return [];
|
|
113
|
-
|
|
114
|
-
// Drop a query string / fragment — `x-pathname` carries the path, but a
|
|
115
|
-
// caller passing a full request path should get the same verdict.
|
|
116
|
-
const path = pathname.split(/[?#]/)[0] ?? "";
|
|
117
|
-
const bare =
|
|
118
|
-
locales.length > 0
|
|
119
|
-
? path.replace(new RegExp(`^/(${locales.join("|")})(?=/|$)`), "")
|
|
120
|
-
: path;
|
|
121
|
-
|
|
122
|
-
const parts = bare.split("/").slice(1);
|
|
123
|
-
if (parts.at(-1) === "") parts.pop();
|
|
124
|
-
return parts;
|
|
125
|
-
}
|
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hub child cards (#10121) — the /alternatives (#6878 D9) and /templates
|
|
3
|
-
* (#10051 D7) shape, shared by the content hubs that list one child page
|
|
4
|
-
* type each (/for, /case-studies, /team, …).
|
|
5
|
-
*
|
|
6
|
-
* The hub adds a generated card per child page of its type that the hub's
|
|
7
|
-
* own sections do not already link: into the authored card grid that already
|
|
8
|
-
* lists its children when there is one, else as one new `items` section
|
|
9
|
-
* before any trailing closing CTA (#7745 D4). `renderPage` builds the CollectionPage
|
|
10
|
-
* ItemList JSON-LD from the same sections, so the visible cards and the
|
|
11
|
-
* ItemList always list the same pages. A child the hub already links keeps
|
|
12
|
-
* its hand-written card and gets no second one, so a hub whose MDX already
|
|
13
|
-
* links every child renders exactly as before.
|
|
14
|
-
*
|
|
15
|
-
* A prose hub (`bodyMode: "mdx-body"`) never reaches renderPage's
|
|
16
|
-
* SectionRenderer, so its generated section renders after the MDX body
|
|
17
|
-
* through renderPage's `trailing` slot.
|
|
18
|
-
*
|
|
19
|
-
* Base tree: no paid import, no `oss: false`.
|
|
20
|
-
*/
|
|
21
|
-
import type {
|
|
22
|
-
getMdxSlugs as defaultGetMdxSlugs,
|
|
23
|
-
getMdxSource as defaultGetMdxSource,
|
|
24
|
-
getPageSections as defaultGetPageSections,
|
|
25
|
-
renderPage,
|
|
26
|
-
SchemaOrgType,
|
|
27
|
-
} from "@working-theory/page-renderer";
|
|
28
|
-
import {
|
|
29
|
-
getMdxSlugs as loadMdxSlugs,
|
|
30
|
-
getMdxSource as loadMdxSource,
|
|
31
|
-
getPageSections as loadPageSections,
|
|
32
|
-
} from "@working-theory/page-renderer";
|
|
33
|
-
import { localeHref } from "@working-theory/ui";
|
|
34
|
-
import { SectionRenderer } from "@working-theory/ui/sections";
|
|
35
|
-
import { notFound, permanentRedirect } from "next/navigation";
|
|
36
|
-
|
|
37
|
-
import {
|
|
38
|
-
type DetailPage,
|
|
39
|
-
insertBeforeClosingCtas,
|
|
40
|
-
listDetailPages,
|
|
41
|
-
} from "./route-family";
|
|
42
|
-
|
|
43
|
-
type Section = Awaited<ReturnType<typeof defaultGetPageSections>>[number];
|
|
44
|
-
|
|
45
|
-
/** One hub: its list page, its child type, and how its body renders. */
|
|
46
|
-
export interface HubConfig {
|
|
47
|
-
/** The list page type, e.g. `UseCasesList`. */
|
|
48
|
-
listType: SchemaOrgType;
|
|
49
|
-
/** The hub's slug, translations namespace and route segment, e.g. `for`. */
|
|
50
|
-
slug: string;
|
|
51
|
-
/** The child page type, e.g. `UseCase`. */
|
|
52
|
-
childType: SchemaOrgType;
|
|
53
|
-
/** The card link label. */
|
|
54
|
-
linkLabel: string;
|
|
55
|
-
/** The generated section's id. */
|
|
56
|
-
sectionId: string;
|
|
57
|
-
/**
|
|
58
|
-
* The hub's existing body rule: `sections` always, `mdx-body` always, or
|
|
59
|
-
* `composed` — sections when the frontmatter carries `sections[]`, the MDX
|
|
60
|
-
* body otherwise.
|
|
61
|
-
*/
|
|
62
|
-
body: "sections" | "mdx-body" | "composed";
|
|
63
|
-
/** Which child pages the hub lists (default: all). */
|
|
64
|
-
includeChild?: (page: DetailPage) => boolean;
|
|
65
|
-
/**
|
|
66
|
-
* One listed page's card (default: title, description and a link to
|
|
67
|
-
* `/<slug>/<child>` labelled `linkLabel`).
|
|
68
|
-
*/
|
|
69
|
-
card?: (page: DetailPage) => HubCard;
|
|
70
|
-
/** A last pass over the hub's final sections (default: none). */
|
|
71
|
-
mapSections?: (sections: Section[]) => Section[];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/** One generated card. */
|
|
75
|
-
export interface HubCard {
|
|
76
|
-
title: string;
|
|
77
|
-
description?: string | undefined;
|
|
78
|
-
link?: { label: string; href: string } | undefined;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/** A hub route's injectable loaders (tests pass their own). */
|
|
82
|
-
export interface HubLoaders {
|
|
83
|
-
getMdxSource?: typeof defaultGetMdxSource;
|
|
84
|
-
getPageSections?: typeof defaultGetPageSections;
|
|
85
|
-
getMdxSlugs?: typeof defaultGetMdxSlugs;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* A link's path for matching: an absolute http(s) URL's pathname, the query
|
|
90
|
-
* and hash dropped, a leading `/` ensured and trailing `/`s trimmed.
|
|
91
|
-
*/
|
|
92
|
-
function linkPath(href: string): string | null {
|
|
93
|
-
let path = href.trim();
|
|
94
|
-
if (/^https?:\/\//i.test(path)) {
|
|
95
|
-
try {
|
|
96
|
-
path = new URL(path).pathname;
|
|
97
|
-
} catch {
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
path = path.split(/[?#]/)[0] ?? "";
|
|
102
|
-
if (!path.startsWith("/")) path = `/${path}`;
|
|
103
|
-
let end = path.length;
|
|
104
|
-
while (end > 0 && path[end - 1] === "/") end -= 1;
|
|
105
|
-
return path.slice(0, end);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/** A BCP-47-shaped first path segment: `en`, `pt-BR`, `zh-Hant`. */
|
|
109
|
-
const LOCALE_SEGMENT = /^[a-z]{2,3}(-[A-Za-z0-9]{2,8})?$/;
|
|
110
|
-
|
|
111
|
-
/** The path without one leading locale segment (`/en/for/a` → `/for/a`). */
|
|
112
|
-
function withoutLocale(path: string): string {
|
|
113
|
-
const end = path.indexOf("/", 1);
|
|
114
|
-
if (end === -1) return path;
|
|
115
|
-
return LOCALE_SEGMENT.test(path.slice(1, end)) ? path.slice(end) : path;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/** Whether a link path names `target`, with or without a locale prefix. */
|
|
119
|
-
function linksTo(path: string, target: string): boolean {
|
|
120
|
-
return path === target || withoutLocale(path) === target;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Every link path an MDX body carries: markdown link targets and `href`
|
|
125
|
-
* attributes, the forms a prose hub links its pages with.
|
|
126
|
-
*/
|
|
127
|
-
export function bodyLinkPaths(body: string): string[] {
|
|
128
|
-
const hrefs = [
|
|
129
|
-
...body.matchAll(/\]\(\s*<?([^)\s>]+)/g),
|
|
130
|
-
...body.matchAll(/\bhref\s*=\s*\{?\s*["']([^"']+)["']/g),
|
|
131
|
-
].map((match) => match[1] ?? "");
|
|
132
|
-
return hrefs
|
|
133
|
-
.map(linkPath)
|
|
134
|
-
.filter((path): path is string => path !== null);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Every link path the sections carry: any `href` or `url` string at any
|
|
139
|
-
* depth, so an `items` card link, a `team` member's `url` and a CTA all count.
|
|
140
|
-
*/
|
|
141
|
-
export function linkedPaths(sections: readonly unknown[]): string[] {
|
|
142
|
-
const paths: string[] = [];
|
|
143
|
-
const walk = (value: unknown): void => {
|
|
144
|
-
if (Array.isArray(value)) {
|
|
145
|
-
value.forEach(walk);
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
if (value === null || typeof value !== "object") return;
|
|
149
|
-
for (const [key, child] of Object.entries(value)) {
|
|
150
|
-
if ((key === "href" || key === "url") && typeof child === "string") {
|
|
151
|
-
const path = linkPath(child);
|
|
152
|
-
if (path !== null) paths.push(path);
|
|
153
|
-
} else {
|
|
154
|
-
walk(child);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
walk(sections);
|
|
159
|
-
return paths;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* The generated section: one card per child page the hub's rendered content
|
|
164
|
-
* does not already link (`linked`, from `linkedPaths` or `bodyLinkPaths`; a
|
|
165
|
-
* locale prefix or an absolute URL still counts as a link), or `null` when
|
|
166
|
-
* there is none.
|
|
167
|
-
*/
|
|
168
|
-
export function childCardsSection(
|
|
169
|
-
linked: readonly string[],
|
|
170
|
-
pages: readonly DetailPage[],
|
|
171
|
-
config: Pick<HubConfig, "slug" | "linkLabel" | "sectionId" | "card">,
|
|
172
|
-
): Section | null {
|
|
173
|
-
// A child counts as linked at its route path or at its card's own href (a
|
|
174
|
-
// hub whose public base differs from its route, #10043).
|
|
175
|
-
const items = pages.flatMap((page) => {
|
|
176
|
-
const card = config.card?.(page) ?? defaultCard(page, config);
|
|
177
|
-
const targets = [`/${config.slug}/${page.slug}`];
|
|
178
|
-
if (card.link !== undefined) targets.push(card.link.href);
|
|
179
|
-
const linkedAlready = linked.some((path) =>
|
|
180
|
-
targets.some((t) => linksTo(path, t)),
|
|
181
|
-
);
|
|
182
|
-
return linkedAlready ? [] : [card];
|
|
183
|
-
});
|
|
184
|
-
if (items.length === 0) return null;
|
|
185
|
-
return { type: "items", id: config.sectionId, data: { items } } as Section;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function defaultCard(
|
|
189
|
-
{ slug, frontmatter }: DetailPage,
|
|
190
|
-
config: Pick<HubConfig, "slug" | "linkLabel">,
|
|
191
|
-
): HubCard {
|
|
192
|
-
const fm = frontmatter as { title?: string; description?: string };
|
|
193
|
-
return {
|
|
194
|
-
title: fm.title ?? slug,
|
|
195
|
-
description: fm.description ?? "",
|
|
196
|
-
link: { label: config.linkLabel, href: `/${config.slug}/${slug}` },
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
type CardItem = { link?: { href?: string; variant?: string } };
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Place the generated cards. When an authored `items` section already lists
|
|
204
|
-
* children of this hub (a card linking `/<hub>/…`), the cards continue that
|
|
205
|
-
* grid, taking its card link variant, so the hub shows one list. Otherwise
|
|
206
|
-
* the generated section goes before the closing CTAs (#7745 D4).
|
|
207
|
-
*/
|
|
208
|
-
export function placeChildCards(
|
|
209
|
-
declared: Section[],
|
|
210
|
-
generated: Section,
|
|
211
|
-
hubSlug: string,
|
|
212
|
-
): Section[] {
|
|
213
|
-
const prefix = `/${hubSlug}/`;
|
|
214
|
-
const listsChildren = (section: Section): boolean =>
|
|
215
|
-
section.type === "items" &&
|
|
216
|
-
((section.data as { items?: CardItem[] }).items ?? []).some((item) => {
|
|
217
|
-
const href = item.link?.href;
|
|
218
|
-
const path = href === undefined ? null : linkPath(href);
|
|
219
|
-
// Raw first: a short hub slug (`for`) itself looks like a locale.
|
|
220
|
-
return (
|
|
221
|
-
path !== null &&
|
|
222
|
-
(path.startsWith(prefix) || withoutLocale(path).startsWith(prefix))
|
|
223
|
-
);
|
|
224
|
-
});
|
|
225
|
-
let at = declared.length - 1;
|
|
226
|
-
while (at >= 0 && !listsChildren(declared[at] as Section)) at -= 1;
|
|
227
|
-
if (at === -1) return insertBeforeClosingCtas(declared, generated);
|
|
228
|
-
|
|
229
|
-
const host = declared[at] as Section & { data: { items: CardItem[] } };
|
|
230
|
-
const variant = host.data.items.find((item) => item.link?.variant)?.link
|
|
231
|
-
?.variant;
|
|
232
|
-
const added = (generated.data as { items: CardItem[] }).items.map((item) =>
|
|
233
|
-
variant === undefined ? item : { ...item, link: { ...item.link, variant } },
|
|
234
|
-
);
|
|
235
|
-
const merged = {
|
|
236
|
-
...host,
|
|
237
|
-
data: { ...host.data, items: [...host.data.items, ...added] },
|
|
238
|
-
} as Section;
|
|
239
|
-
return [...declared.slice(0, at), merged, ...declared.slice(at + 1)];
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
function hasSections(frontmatter: unknown): boolean {
|
|
243
|
-
const sections = (frontmatter as { sections?: unknown }).sections;
|
|
244
|
-
return Array.isArray(sections) && sections.length > 0;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Nav only (#10200): a list that is a heading in the site navigation with no
|
|
249
|
-
* page of its own answers a permanent redirect to its first child — in the
|
|
250
|
-
* route's own child order — and 404 when it lists none. Any other page
|
|
251
|
-
* returns, and renders as before.
|
|
252
|
-
*/
|
|
253
|
-
export function honourNavOnly(
|
|
254
|
-
frontmatter: unknown,
|
|
255
|
-
locale: string,
|
|
256
|
-
childHrefs: readonly string[],
|
|
257
|
-
): void {
|
|
258
|
-
if ((frontmatter as { navOnly?: unknown } | undefined)?.navOnly !== true)
|
|
259
|
-
return;
|
|
260
|
-
const first = childHrefs[0];
|
|
261
|
-
if (first === undefined) notFound();
|
|
262
|
-
permanentRedirect(
|
|
263
|
-
localeHref(locale, first, process.env.NEXT_PUBLIC_DEFAULT_LOCALE ?? "en"),
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
type RenderPageInput = Parameters<typeof renderPage>[0];
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Everything a hub's `renderPage` call needs beyond its literal `type` and
|
|
271
|
-
* `slug`, which stay written out in each page.tsx where the content-render
|
|
272
|
-
* lint reads them.
|
|
273
|
-
*/
|
|
274
|
-
export async function hubPageInput(
|
|
275
|
-
config: HubConfig,
|
|
276
|
-
locale: string,
|
|
277
|
-
loaders: HubLoaders,
|
|
278
|
-
): Promise<Omit<RenderPageInput, "type" | "slug">> {
|
|
279
|
-
const load = loaders.getMdxSource ?? loadMdxSource;
|
|
280
|
-
const base = {
|
|
281
|
-
locale,
|
|
282
|
-
translationsNamespace: config.slug,
|
|
283
|
-
...(loaders.getMdxSource !== undefined && {
|
|
284
|
-
getMdxSource: loaders.getMdxSource,
|
|
285
|
-
}),
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
const source = await load(config.listType, config.slug, locale);
|
|
289
|
-
const mdxBody =
|
|
290
|
-
config.body === "mdx-body" ||
|
|
291
|
-
(config.body === "composed" &&
|
|
292
|
-
(source === null || !hasSections(source.frontmatter)));
|
|
293
|
-
if (source === null) {
|
|
294
|
-
// The hub's existing empty-state rule, unchanged.
|
|
295
|
-
return {
|
|
296
|
-
...base,
|
|
297
|
-
...(mdxBody && { bodyMode: "mdx-body" as const }),
|
|
298
|
-
...(loaders.getPageSections !== undefined && {
|
|
299
|
-
getPageSections: loaders.getPageSections,
|
|
300
|
-
}),
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
const listed = await listDetailPages(
|
|
305
|
-
config.childType,
|
|
306
|
-
locale,
|
|
307
|
-
load,
|
|
308
|
-
loaders.getMdxSlugs ?? loadMdxSlugs,
|
|
309
|
-
);
|
|
310
|
-
const pages = config.includeChild
|
|
311
|
-
? listed.filter(config.includeChild)
|
|
312
|
-
: listed;
|
|
313
|
-
honourNavOnly(
|
|
314
|
-
source.frontmatter,
|
|
315
|
-
locale,
|
|
316
|
-
pages.flatMap((page) => {
|
|
317
|
-
const card = config.card?.(page) ?? defaultCard(page, config);
|
|
318
|
-
return card.link === undefined ? [] : [card.link.href];
|
|
319
|
-
}),
|
|
320
|
-
);
|
|
321
|
-
const loadSections = loaders.getPageSections ?? loadPageSections;
|
|
322
|
-
const declared = await loadSections(source.frontmatter);
|
|
323
|
-
// A prose hub renders its MDX body, never its declared sections, so its
|
|
324
|
-
// existing links are read from the body and its cards stand alone after it.
|
|
325
|
-
const linked = mdxBody
|
|
326
|
-
? bodyLinkPaths(source.body)
|
|
327
|
-
: linkedPaths(declared);
|
|
328
|
-
const generated = childCardsSection(linked, pages, config);
|
|
329
|
-
// #10929 D3 — the loader builds from the frontmatter renderPage hands it,
|
|
330
|
-
// which under the database adapter carries the published words; the child
|
|
331
|
-
// pages and their card section are computed once, above.
|
|
332
|
-
const place = (sections: typeof declared) => {
|
|
333
|
-
const placed =
|
|
334
|
-
generated === null
|
|
335
|
-
? sections
|
|
336
|
-
: mdxBody
|
|
337
|
-
? insertBeforeClosingCtas(sections, generated)
|
|
338
|
-
: placeChildCards(sections, generated, config.slug);
|
|
339
|
-
return config.mapSections ? config.mapSections(placed) : placed;
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
return {
|
|
343
|
-
...base,
|
|
344
|
-
getPageSections: async (frontmatter) => place(await loadSections(frontmatter)),
|
|
345
|
-
...(mdxBody && { bodyMode: "mdx-body" as const }),
|
|
346
|
-
...(mdxBody &&
|
|
347
|
-
generated !== null && {
|
|
348
|
-
trailing: <SectionRenderer sections={[generated]} locale={locale} />,
|
|
349
|
-
}),
|
|
350
|
-
};
|
|
351
|
-
}
|