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,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The spoke's Security tab asks for a password link (#11162) —
|
|
3
|
-
* `POST /api/hub-session/password`.
|
|
4
|
-
*
|
|
5
|
-
* On a spoke that signs in through its hub, the Security tab renders the
|
|
6
|
-
* Password row itself; its Set / Change password button posts here. This
|
|
7
|
-
* route asks the hub web, server to server as the spoke's client, to mail the
|
|
8
|
-
* SIGNED-IN person the hub's own set-password link — the person comes from
|
|
9
|
-
* the sealed session cookie, never from the body, so a spoke cannot ask for
|
|
10
|
-
* anyone it did not sign in. The link lands on the hub's set-password page,
|
|
11
|
-
* which returns the person to this site's `/account/security`.
|
|
12
|
-
*
|
|
13
|
-
* 1. 404 unless `SIGN_IN_PROVIDER` is `"hub"`; not configured → 503.
|
|
14
|
-
* 2. Same-origin only (`Sec-Fetch-Site`, `Origin`), else 403.
|
|
15
|
-
* 3. No session cookie, or one that does not open → 401.
|
|
16
|
-
* 4. 10 posts per visitor per 10 minutes (429), then the bot check (503).
|
|
17
|
-
* 5. The body is `spokePasswordBodySchema`: `{ locale }` and nothing else —
|
|
18
|
-
* a `password` key, or any other, is 400. The spoke never holds or
|
|
19
|
-
* accepts a password.
|
|
20
|
-
* 6. The hub web's `POST /api/auth/hub/password` gets the client, its
|
|
21
|
-
* callback, the session's credential, the locale and the return path
|
|
22
|
-
* (`/account/security` under that locale); the hub API checks the
|
|
23
|
-
* client and the credential before anything is mailed.
|
|
24
|
-
* 7. 202 `{ sent: true }`; the hub's `invalid_grant` (a credential it no
|
|
25
|
-
* longer honours) → 401; anything else → 503.
|
|
26
|
-
*
|
|
27
|
-
* Nothing here logs the credential, the cookie or an address. Every answer
|
|
28
|
-
* is `Cache-Control: no-store`.
|
|
29
|
-
*/
|
|
30
|
-
import { spokePasswordBodySchema } from "@working-theory/validation";
|
|
31
|
-
|
|
32
|
-
import { runBotCheck } from "../../../../lib/bot-check";
|
|
33
|
-
import { hubSessionConfig } from "../../../../lib/hub-session/config";
|
|
34
|
-
import { hubError, localeOfPath, postToHub, readBodyText } from "../../../../lib/hub-session/entry";
|
|
35
|
-
import { isSameOrigin, readHubSessionPayload } from "../../../../lib/hub-session/session";
|
|
36
|
-
import { SIGN_IN_PROVIDER } from "../../../../lib/topology.generated";
|
|
37
|
-
import { takeVisitorLimit } from "../../../../src/lib/rate-limit";
|
|
38
|
-
|
|
39
|
-
/** The hub web's password route. */
|
|
40
|
-
const HUB_PASSWORD_PATH = "/api/auth/hub/password";
|
|
41
|
-
|
|
42
|
-
/** The per-visitor budget for this route. */
|
|
43
|
-
const VISITOR_LIMIT = 10;
|
|
44
|
-
const VISITOR_WINDOW_MS = 10 * 60_000;
|
|
45
|
-
|
|
46
|
-
const DEFAULT_LOCALE = "en";
|
|
47
|
-
|
|
48
|
-
function json(status: number, body: Record<string, unknown>): Response {
|
|
49
|
-
return new Response(JSON.stringify(body), {
|
|
50
|
-
status,
|
|
51
|
-
headers: { "Content-Type": "application/json", "Cache-Control": "no-store" },
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const refuse = (status: number, error: string): Response => json(status, { error });
|
|
56
|
-
|
|
57
|
-
/** The parsed JSON body, or `undefined` when it is too large or does not parse. */
|
|
58
|
-
async function readJson(request: Request): Promise<unknown> {
|
|
59
|
-
const text = await readBodyText(request);
|
|
60
|
-
if (text === null) return undefined;
|
|
61
|
-
try {
|
|
62
|
-
return JSON.parse(text) as unknown;
|
|
63
|
-
} catch {
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// platform-decisions-waiver: api-versioning — a sign-in step of the spoke's own form, not a versioned API contract (spec 11096 §6)
|
|
69
|
-
export async function POST(request: Request): Promise<Response> {
|
|
70
|
-
if (SIGN_IN_PROVIDER !== "hub") return new Response(null, { status: 404 });
|
|
71
|
-
const config = hubSessionConfig();
|
|
72
|
-
if (config === null) return refuse(503, "temporarily_unavailable");
|
|
73
|
-
if (!isSameOrigin(request, config.siteOrigin)) return refuse(403, "forbidden");
|
|
74
|
-
|
|
75
|
-
const session = readHubSessionPayload(request.headers);
|
|
76
|
-
if (session === null) return refuse(401, "no_session");
|
|
77
|
-
|
|
78
|
-
if (!takeVisitorLimit("hub-session-password", request.headers, VISITOR_LIMIT, VISITOR_WINDOW_MS).allowed) {
|
|
79
|
-
return refuse(429, "rate_limited");
|
|
80
|
-
}
|
|
81
|
-
const bot = await runBotCheck({ source: "hub-session", target: "password", scope: "write" });
|
|
82
|
-
if (bot !== "pass") return refuse(503, "temporarily_unavailable");
|
|
83
|
-
|
|
84
|
-
const parsed = spokePasswordBodySchema.safeParse(await readJson(request));
|
|
85
|
-
if (!parsed.success) return refuse(400, "invalid_request");
|
|
86
|
-
// An enabled locale, else the default — the one the Security tab is under.
|
|
87
|
-
const locale = localeOfPath(`/${parsed.data.locale}`);
|
|
88
|
-
|
|
89
|
-
const answer = await postToHub(config, HUB_PASSWORD_PATH, {
|
|
90
|
-
client_id: config.clientId,
|
|
91
|
-
redirect_uri: config.redirectUri,
|
|
92
|
-
access_token: session.accessToken,
|
|
93
|
-
locale,
|
|
94
|
-
return_path: `${locale === DEFAULT_LOCALE ? "" : `/${locale}`}/account/security`,
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
if (answer?.status === 202) return json(202, { sent: true });
|
|
98
|
-
if (answer?.status === 400 && hubError(answer) === "invalid_grant") {
|
|
99
|
-
return refuse(401, "invalid_session");
|
|
100
|
-
}
|
|
101
|
-
// The hub's error code is a closed enum, never an address.
|
|
102
|
-
console.warn(
|
|
103
|
-
`[hub-session] password link not sent status=${answer === null ? "unreachable" : answer.status} error=${hubError(answer) ?? "none"}`,
|
|
104
|
-
);
|
|
105
|
-
return refuse(503, "temporarily_unavailable");
|
|
106
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Start a sign-in through the hub (#7894 D2, D7) — `GET /api/hub-session/sign-in?next=<path>`.
|
|
3
|
-
*
|
|
4
|
-
* Mints a `state` and a PKCE verifier (32 random bytes each, base64url), seals
|
|
5
|
-
* them with the sanitized `next` into the flow cookie for ten minutes, and
|
|
6
|
-
* sends the visitor to the hub's `/api/auth/hub/authorize` with the S256
|
|
7
|
-
* challenge. The redirect URI is this site's configured origin plus
|
|
8
|
-
* `/api/hub-session/callback` — never derived from the request's `Host`.
|
|
9
|
-
*
|
|
10
|
-
* - not a hub-mode spoke (`SIGN_IN_PROVIDER` is not `"hub"`): 404;
|
|
11
|
-
* - hub mode but not configured: 303 to the site's home (#11095 D4) —
|
|
12
|
-
* `/account` would redirect straight back here.
|
|
13
|
-
*
|
|
14
|
-
* Hinted email (#8757 D9): a single `?email=` that `accountEmailHintSchema`
|
|
15
|
-
* accepts rides to the hub as `login_hint`, so its sign-in form opens with
|
|
16
|
-
* the address typed. A refused or repeated value is dropped. The hint goes on
|
|
17
|
-
* the authorize URL only — never into the sealed flow cookie.
|
|
18
|
-
*
|
|
19
|
-
* Sign-up hint (#9912 D2): exactly one `?prompt=create` (the gate's "Sign up")
|
|
20
|
-
* rides to the hub as `prompt=create`, so a visitor with no hub session lands
|
|
21
|
-
* on its sign-up screen instead of sign-in; the round trip is otherwise the
|
|
22
|
-
* same. Any other value, an empty or a repeated one adds nothing, and the hint
|
|
23
|
-
* never enters the flow cookie.
|
|
24
|
-
*
|
|
25
|
-
* Google (#11096 D4): exactly one `?provider=google` (the spoke form's
|
|
26
|
-
* "Continue with Google") rides to the hub as `provider_hint=google`, which
|
|
27
|
-
* sends a visitor with no hub session straight to Google, with no sign-in
|
|
28
|
-
* card. Any other value, an empty or a repeated one adds nothing, and the
|
|
29
|
-
* hint never enters the flow cookie.
|
|
30
|
-
*
|
|
31
|
-
* Nothing here logs the state, the verifier or the challenge.
|
|
32
|
-
*/
|
|
33
|
-
import { accountEmailHintSchema } from "@working-theory/validation";
|
|
34
|
-
|
|
35
|
-
import { hubSessionConfig } from "../../../../lib/hub-session/config";
|
|
36
|
-
import {
|
|
37
|
-
HUB_SESSION_HOME_PATH,
|
|
38
|
-
seeOther,
|
|
39
|
-
startHubFlow,
|
|
40
|
-
} from "../../../../lib/hub-session/session";
|
|
41
|
-
import { SIGN_IN_PROVIDER } from "../../../../lib/topology.generated";
|
|
42
|
-
|
|
43
|
-
/** The hub's browser step (spec 7894 D4). */
|
|
44
|
-
const AUTHORIZE_PATH = "/api/auth/hub/authorize";
|
|
45
|
-
|
|
46
|
-
/** #8757 D9 — the one `email` the hint schema accepts; repeated or refused → none. */
|
|
47
|
-
function emailHint(params: URLSearchParams): string | undefined {
|
|
48
|
-
const values = params.getAll("email");
|
|
49
|
-
if (values.length !== 1) return undefined;
|
|
50
|
-
const parsed = accountEmailHintSchema.safeParse(values[0]);
|
|
51
|
-
return parsed.success ? parsed.data : undefined;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** #9912 D2 — `"create"` when the one `prompt` is exactly that, else none. */
|
|
55
|
-
function signUpHint(params: URLSearchParams): "create" | undefined {
|
|
56
|
-
const values = params.getAll("prompt");
|
|
57
|
-
return values.length === 1 && values[0] === "create" ? "create" : undefined;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** #11096 D4 — `"google"` when the one `provider` is exactly that, else none. */
|
|
61
|
-
function providerHint(params: URLSearchParams): "google" | undefined {
|
|
62
|
-
const values = params.getAll("provider");
|
|
63
|
-
return values.length === 1 && values[0] === "google" ? "google" : undefined;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// platform-decisions-waiver: api-versioning — sign-in redirect endpoint, not a versioned API contract (spec 7894 §7)
|
|
67
|
-
export function GET(request: Request): Response {
|
|
68
|
-
if (SIGN_IN_PROVIDER !== "hub") return new Response(null, { status: 404 });
|
|
69
|
-
const config = hubSessionConfig();
|
|
70
|
-
if (config === null) return seeOther(HUB_SESSION_HOME_PATH);
|
|
71
|
-
|
|
72
|
-
const params = new URL(request.url).searchParams;
|
|
73
|
-
const flow = startHubFlow(config, params.get("next"));
|
|
74
|
-
|
|
75
|
-
const authorize = new URL(AUTHORIZE_PATH, config.hubOrigin);
|
|
76
|
-
const query = new URLSearchParams({
|
|
77
|
-
response_type: "code",
|
|
78
|
-
client_id: config.clientId,
|
|
79
|
-
redirect_uri: config.redirectUri,
|
|
80
|
-
state: flow.state,
|
|
81
|
-
code_challenge: flow.challenge,
|
|
82
|
-
code_challenge_method: "S256",
|
|
83
|
-
});
|
|
84
|
-
if (signUpHint(params) !== undefined) query.set("prompt", "create");
|
|
85
|
-
const loginHint = emailHint(params);
|
|
86
|
-
if (loginHint !== undefined) query.set("login_hint", loginHint);
|
|
87
|
-
if (providerHint(params) !== undefined) query.set("provider_hint", "google");
|
|
88
|
-
authorize.search = query.toString();
|
|
89
|
-
|
|
90
|
-
return seeOther(authorize.toString(), [flow.cookie]);
|
|
91
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sign out of a spoke that signs in through its hub (#7894 D7) — `POST /api/hub-session/sign-out`.
|
|
3
|
-
*
|
|
4
|
-
* The signed-in Nav's "Sign out" posts here (`SIGN_OUT_ENDPOINT`). It revokes
|
|
5
|
-
* the credential at the hub (best-effort: a hub that cannot be reached still
|
|
6
|
-
* leaves the visitor signed out here), clears the session cookie and answers
|
|
7
|
-
* 204.
|
|
8
|
-
*
|
|
9
|
-
* Same-origin only: a `Sec-Fetch-Site` other than `same-origin`, an `Origin`
|
|
10
|
-
* that is not this site's configured origin, or a request carrying neither is
|
|
11
|
-
* refused 403 before anything is revoked, so another site cannot sign a
|
|
12
|
-
* visitor out. POST only — Next answers 405 to any other method.
|
|
13
|
-
*/
|
|
14
|
-
import { hubSignIn } from "@working-theory/api-client";
|
|
15
|
-
|
|
16
|
-
import { hubSessionConfig } from "../../../../lib/hub-session/config";
|
|
17
|
-
import {
|
|
18
|
-
cookieHeader,
|
|
19
|
-
isSameOrigin,
|
|
20
|
-
readHubSessionPayload,
|
|
21
|
-
sessionCookieName,
|
|
22
|
-
} from "../../../../lib/hub-session/session";
|
|
23
|
-
import { SIGN_IN_PROVIDER } from "../../../../lib/topology.generated";
|
|
24
|
-
|
|
25
|
-
// platform-decisions-waiver: api-versioning — sign-in redirect endpoint, not a versioned API contract (spec 7894 §7)
|
|
26
|
-
export async function POST(request: Request): Promise<Response> {
|
|
27
|
-
if (SIGN_IN_PROVIDER !== "hub") return new Response(null, { status: 404 });
|
|
28
|
-
const config = hubSessionConfig();
|
|
29
|
-
if (!isSameOrigin(request, config?.siteOrigin ?? null)) {
|
|
30
|
-
return new Response(null, { status: 403 });
|
|
31
|
-
}
|
|
32
|
-
if (config === null) return new Response(null, { status: 204 });
|
|
33
|
-
|
|
34
|
-
const payload = readHubSessionPayload(request.headers);
|
|
35
|
-
if (payload !== null) {
|
|
36
|
-
try {
|
|
37
|
-
await hubSignIn.revoke(
|
|
38
|
-
{ clientId: config.clientId, clientSecret: config.clientSecret },
|
|
39
|
-
{ accessToken: payload.accessToken },
|
|
40
|
-
);
|
|
41
|
-
} catch (err) {
|
|
42
|
-
console.error(
|
|
43
|
-
`[hub-session] revoke failed errName=${err instanceof Error ? err.name : "unknown"}`,
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return new Response(null, {
|
|
48
|
-
status: 204,
|
|
49
|
-
headers: {
|
|
50
|
-
"Cache-Control": "no-store",
|
|
51
|
-
"Set-Cookie": cookieHeader(sessionCookieName(config), "", 0, config),
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use client"; // Better Auth's client signOut + router navigation need the browser
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* SignOutTrigger — wraps the signed-in Nav's "Sign out" trigger (#4984).
|
|
5
|
-
*
|
|
6
|
-
* With an `endpoint` (a spoke that signs in through its hub, #7894 D10) it
|
|
7
|
-
* POSTs there — the hub-session sign-out, which revokes the credential and
|
|
8
|
-
* clears the session cookie — and navigates home only when that succeeded;
|
|
9
|
-
* without one it calls Better Auth's client exactly as before.
|
|
10
|
-
*
|
|
11
|
-
* The locale layout (RSC) reads the session and authors the "Sign out" nav
|
|
12
|
-
* action as `kind: "flow"`; Nav hands the rendered trigger `<Button>` back
|
|
13
|
-
* through `renderFlowTrigger` — composed in a client Nav until #11095 D6, on the client side
|
|
14
|
-
* of the RSC boundary (#7402) — and this component clones it with the real
|
|
15
|
-
* sign-out handler. Same `createAuthClient()` idiom as `SignInGate`.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import { createAuthClient } from "better-auth/react";
|
|
19
|
-
import { useRouter } from "next/navigation";
|
|
20
|
-
import type { ReactElement, ReactNode } from "react";
|
|
21
|
-
import { cloneElement, isValidElement } from "react";
|
|
22
|
-
|
|
23
|
-
const authClient = createAuthClient();
|
|
24
|
-
|
|
25
|
-
export interface SignOutTriggerProps {
|
|
26
|
-
/** The Nav-rendered trigger button. */
|
|
27
|
-
children: ReactNode;
|
|
28
|
-
/** Where to land after signing out. Defaults to the site home. */
|
|
29
|
-
homeHref?: string;
|
|
30
|
-
/** A same-origin sign-out route to POST to instead of Better Auth's client. */
|
|
31
|
-
endpoint?: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function SignOutTrigger({
|
|
35
|
-
children,
|
|
36
|
-
homeHref = "/",
|
|
37
|
-
endpoint,
|
|
38
|
-
}: SignOutTriggerProps): ReactElement {
|
|
39
|
-
const router = useRouter();
|
|
40
|
-
|
|
41
|
-
const handleSignOut = async (): Promise<void> => {
|
|
42
|
-
if (endpoint !== undefined) {
|
|
43
|
-
// A refused or failed sign-out leaves the visitor signed in, so the
|
|
44
|
-
// page must not pretend otherwise by navigating away.
|
|
45
|
-
try {
|
|
46
|
-
const res = await fetch(endpoint, { method: "POST", credentials: "same-origin" });
|
|
47
|
-
if (!res.ok) return;
|
|
48
|
-
} catch {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
} else {
|
|
52
|
-
await authClient.signOut();
|
|
53
|
-
}
|
|
54
|
-
router.push(homeHref);
|
|
55
|
-
router.refresh();
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
if (!isValidElement(children)) return <>{children}</>;
|
|
59
|
-
return cloneElement(children as ReactElement<{ onClick?: () => void }>, {
|
|
60
|
-
onClick: () => void handleSignOut(),
|
|
61
|
-
});
|
|
62
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for the auth-route predicate (#5963).
|
|
3
|
-
*
|
|
4
|
-
* `isAuthPath()` is the ONE list the locale layout branches on and the five
|
|
5
|
-
* `(auth)` page segments are named from, so the layout and the routes cannot
|
|
6
|
-
* drift. Covers bare paths, locale-prefixed paths, near misses, nested paths,
|
|
7
|
-
* and the absent-header fail-safe — and the same for `isAccountPath()` (#7430).
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { AUTH_SEGMENTS, isAccountPath, isAuthPath, isBookingPath } from "../auth-routes";
|
|
11
|
-
|
|
12
|
-
const LOCALES = ["en", "fr", "de"];
|
|
13
|
-
|
|
14
|
-
describe("AUTH_SEGMENTS", () => {
|
|
15
|
-
it("names exactly the six auth routes", () => {
|
|
16
|
-
expect([...AUTH_SEGMENTS]).toEqual([
|
|
17
|
-
"sign-in",
|
|
18
|
-
"sign-up",
|
|
19
|
-
"forgot-password",
|
|
20
|
-
"reset-password",
|
|
21
|
-
"verify-email",
|
|
22
|
-
"consent",
|
|
23
|
-
]);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
describe("isAuthPath", () => {
|
|
28
|
-
it.each(AUTH_SEGMENTS)("matches the bare /%s path", (segment) => {
|
|
29
|
-
expect(isAuthPath(`/${segment}`, LOCALES)).toBe(true);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it.each(AUTH_SEGMENTS)("matches the locale-prefixed /fr/%s path", (segment) => {
|
|
33
|
-
expect(isAuthPath(`/fr/${segment}`, LOCALES)).toBe(true);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("matches a trailing-slash auth path", () => {
|
|
37
|
-
expect(isAuthPath("/sign-in/", LOCALES)).toBe(true);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("matches an auth path carrying a query string", () => {
|
|
41
|
-
expect(isAuthPath("/sign-in?next=/account", LOCALES)).toBe(true);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("matches a nested path under an auth segment", () => {
|
|
45
|
-
expect(isAuthPath("/reset-password/confirm", LOCALES)).toBe(true);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it("does not match a near miss", () => {
|
|
49
|
-
expect(isAuthPath("/sign-in-x", LOCALES)).toBe(false);
|
|
50
|
-
expect(isAuthPath("/sign", LOCALES)).toBe(false);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it("does not match a marketing path", () => {
|
|
54
|
-
expect(isAuthPath("/pricing", LOCALES)).toBe(false);
|
|
55
|
-
expect(isAuthPath("/fr/pricing", LOCALES)).toBe(false);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it("does not match the locale root or the site root", () => {
|
|
59
|
-
expect(isAuthPath("/", LOCALES)).toBe(false);
|
|
60
|
-
expect(isAuthPath("/fr", LOCALES)).toBe(false);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it("does not strip a prefix that is not an enabled locale", () => {
|
|
64
|
-
// `/es` is not enabled here, so `es` is the first segment, not a prefix.
|
|
65
|
-
expect(isAuthPath("/es/sign-in", LOCALES)).toBe(false);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it("fails to NOT-an-auth-path for an empty or absent pathname", () => {
|
|
69
|
-
// The fail-safe direction (§ D1): an absent `x-pathname` must never strip
|
|
70
|
-
// a marketing page's chrome. The worst case is an auth page WITH chrome,
|
|
71
|
-
// which the (auth) group's own tests catch.
|
|
72
|
-
expect(isAuthPath("", LOCALES)).toBe(false);
|
|
73
|
-
expect(isAuthPath(undefined, LOCALES)).toBe(false);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
describe("isAccountPath (#7430, spec 7423 D4)", () => {
|
|
78
|
-
it("matches the account root, bare and locale-prefixed", () => {
|
|
79
|
-
expect(isAccountPath("/account", LOCALES)).toBe(true);
|
|
80
|
-
expect(isAccountPath("/en/account", LOCALES)).toBe(true);
|
|
81
|
-
expect(isAccountPath("/fr/account", LOCALES)).toBe(true);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it("matches every path under /account", () => {
|
|
85
|
-
expect(isAccountPath("/account/settings", LOCALES)).toBe(true);
|
|
86
|
-
expect(isAccountPath("/account/support", LOCALES)).toBe(true);
|
|
87
|
-
expect(isAccountPath("/fr/account/inbox/purchase/fc_1", LOCALES)).toBe(true);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it("matches a trailing slash and a query string", () => {
|
|
91
|
-
expect(isAccountPath("/account/", LOCALES)).toBe(true);
|
|
92
|
-
expect(isAccountPath("/account?tab=all", LOCALES)).toBe(true);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it("does not match a near miss or a marketing path", () => {
|
|
96
|
-
expect(isAccountPath("/accounts", LOCALES)).toBe(false);
|
|
97
|
-
expect(isAccountPath("/about", LOCALES)).toBe(false);
|
|
98
|
-
expect(isAccountPath("/blog/account", LOCALES)).toBe(false);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it("does not match an auth path", () => {
|
|
102
|
-
expect(isAccountPath("/sign-in?next=/account", LOCALES)).toBe(false);
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it("does not strip a prefix that is not an enabled locale", () => {
|
|
106
|
-
expect(isAccountPath("/es/account", LOCALES)).toBe(false);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it("fails to NOT-an-account-path for an empty or absent pathname", () => {
|
|
110
|
-
expect(isAccountPath("", LOCALES)).toBe(false);
|
|
111
|
-
expect(isAccountPath(undefined, LOCALES)).toBe(false);
|
|
112
|
-
expect(isAccountPath(null, LOCALES)).toBe(false);
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// #8843 D10 — the booking pages render without the marketing chrome.
|
|
117
|
-
describe("isBookingPath (#8843)", () => {
|
|
118
|
-
it("matches /meet, a meeting page and /private, bare or locale-prefixed", () => {
|
|
119
|
-
for (const path of ["/meet", "/meet/", "/meet/intro", "/en/meet/intro", "/fr/meet", "/private", "/fr/private"]) {
|
|
120
|
-
expect(isBookingPath(path, LOCALES)).toBe(true);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it("does not match the confirmation page, which keeps the marketing chrome", () => {
|
|
125
|
-
expect(isBookingPath("/meet/confirmed", LOCALES)).toBe(false);
|
|
126
|
-
expect(isBookingPath("/fr/meet/confirmed", LOCALES)).toBe(false);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it("does not match a near miss or a marketing path", () => {
|
|
130
|
-
expect(isBookingPath("/meeting", LOCALES)).toBe(false);
|
|
131
|
-
expect(isBookingPath("/privacy", LOCALES)).toBe(false);
|
|
132
|
-
expect(isBookingPath("/blog/meet", LOCALES)).toBe(false);
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it("fails to NOT-a-booking-path for an empty or absent pathname", () => {
|
|
136
|
-
expect(isBookingPath("", LOCALES)).toBe(false);
|
|
137
|
-
expect(isBookingPath(undefined, LOCALES)).toBe(false);
|
|
138
|
-
expect(isBookingPath(null, LOCALES)).toBe(false);
|
|
139
|
-
});
|
|
140
|
-
});
|