create-ailk 0.37.1 → 0.39.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 +129 -0
- package/component-catalog.json +44 -6
- package/component-catalog.md +6 -5
- package/dist/add-module.js +16 -1
- package/dist/add-route.d.ts +2 -2
- package/dist/add-route.js +19 -12
- package/dist/cli.js +52 -0
- package/dist/declined-routes.d.ts +13 -0
- package/dist/declined-routes.js +74 -0
- package/dist/derive-architecture.d.ts +0 -6
- package/dist/derive-architecture.js +12 -16
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/language-import.d.ts +93 -0
- package/dist/language-import.js +270 -43
- package/dist/lib/import-mdx.js +1 -1
- package/dist/lib/scaffold-render-sweep.d.ts +6 -3
- package/dist/lib/scaffold-render-sweep.js +8 -4
- package/dist/migrate-content.d.ts +6 -2
- package/dist/migrate-content.js +62 -5
- package/dist/module-architecture.js +139 -103
- package/dist/paid-sections.d.ts +13 -0
- package/dist/paid-sections.js +35 -5
- package/dist/programmatic.js +6 -16
- package/dist/remove-module.js +73 -2
- package/dist/routes.d.ts +130 -0
- package/dist/routes.js +954 -0
- package/dist/site-manifest.js +6 -4
- package/dist/site-roster.d.ts +11 -2
- package/dist/site-roster.js +63 -21
- package/dist/spoke-checkout.d.ts +28 -27
- package/dist/spoke-checkout.js +71 -102
- package/dist/surfaces.d.ts +26 -0
- package/dist/surfaces.js +105 -293
- package/dist/sync-routes.d.ts +14 -1
- package/dist/sync-routes.js +108 -10
- package/dist/template-record.js +3 -1
- package/dist/topology.d.ts +26 -1
- package/dist/topology.js +273 -7
- package/dist/update.d.ts +17 -2
- package/dist/update.js +480 -77
- package/package.json +3 -3
- package/templates/README.md +1 -1
- package/templates/apps/mcp/CLAUDE.md +5 -3
- package/templates/apps/web/CLAUDE.md +87 -23
- package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +5 -1
- package/templates/apps/web/__tests__/__mocks__/next-intl.ts +5 -1
- package/templates/apps/web/__tests__/auth/seam.test.ts +34 -0
- package/templates/apps/web/account.config.tsx +100 -0
- 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 +2 -2
- package/templates/apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx +1 -1
- package/templates/apps/web/app/[locale]/layout.tsx +46 -29
- package/templates/apps/web/app/apple-icon.tsx +72 -0
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +22 -12
- package/templates/apps/web/app/og/__tests__/__snapshots__/card.test.tsx.snap +3 -0
- package/templates/apps/web/app/og/__tests__/card.test.tsx +129 -0
- package/templates/apps/web/app/og/__tests__/route.test.ts +3 -4
- package/templates/apps/web/app/og/route.tsx +155 -72
- package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +12 -0
- package/templates/apps/web/auth.config.tsx +107 -0
- package/templates/apps/web/auth.ts +2 -1
- package/templates/apps/web/i18n/request.ts +51 -1
- package/templates/apps/web/jest.config.cjs +17 -1
- package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
- package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +73 -0
- package/templates/apps/web/lib/__tests__/nav-label-keys.test.ts +14 -0
- package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +148 -61
- package/templates/apps/web/lib/__tests__/served-pages.test.ts +77 -0
- package/templates/apps/web/lib/__tests__/server-api.test.ts +37 -5
- package/templates/apps/web/lib/__tests__/structured-data.test.tsx +26 -13
- package/templates/apps/web/lib/listings.tsx +2 -2
- package/templates/apps/web/lib/nav-label-keys.ts +16 -2
- package/templates/apps/web/lib/paid-section-contracts.ts +35 -6
- package/templates/apps/web/lib/paid-sections.generated.ts +8 -0
- package/templates/apps/web/lib/profile-back-link.ts +105 -32
- package/templates/apps/web/lib/served-pages.ts +95 -0
- package/templates/apps/web/lib/server-api.ts +1 -1
- package/templates/apps/web/lib/site-brand.tsx +3 -5
- package/templates/apps/web/lib/topology.generated.ts +5 -0
- package/templates/apps/web/messages/en.json +8 -836
- package/templates/apps/web/middleware.ts +15 -26
- package/templates/apps/web/next.config.mjs +35 -0
- package/templates/apps/web/package.json +2 -0
- package/templates/apps/web/types/messages.d.ts +6 -1
- package/templates/customizations.yaml +9 -0
- package/templates/package.json +3 -1
- package/templates/tools/lint-architecture.ts +164 -11
- package/versions.json +49 -47
- 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/__tests__/account-frame-sign-out.test.tsx +0 -175
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +0 -301
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +0 -515
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +0 -883
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +0 -758
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +0 -264
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +0 -167
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +0 -730
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +0 -355
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +0 -97
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +0 -375
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +0 -323
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +0 -1208
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +0 -418
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +0 -462
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +0 -63
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -406
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +0 -93
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +0 -208
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +0 -340
- package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +0 -182
- package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +0 -353
- package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +0 -57
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +0 -58
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-gate.ts +0 -61
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +0 -184
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +0 -161
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +0 -426
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +0 -76
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +0 -139
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +0 -406
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +0 -65
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +0 -172
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +0 -190
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +0 -333
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +0 -936
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +0 -193
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +0 -476
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +0 -184
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +0 -197
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +0 -182
- package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +0 -99
- package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +0 -123
- package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +0 -424
- package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +0 -303
- package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +0 -274
- package/templates/apps/web/app/[locale]/(authed)/account/error-row.tsx +0 -35
- package/templates/apps/web/app/[locale]/(authed)/account/for-you-labels.ts +0 -36
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +0 -65
- package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +0 -36
- package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +0 -27
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +0 -149
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +0 -42
- package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +0 -132
- package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +0 -218
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +0 -122
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +0 -73
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +0 -107
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +0 -87
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +0 -119
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +0 -80
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +0 -43
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +0 -125
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +0 -88
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +0 -31
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +0 -35
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +0 -266
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +0 -116
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +0 -12
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +0 -154
- package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +0 -152
- package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +0 -219
- package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +0 -365
- package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +0 -86
- package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +0 -143
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +0 -120
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +0 -322
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +0 -126
- package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +0 -306
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +0 -173
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +0 -103
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +0 -102
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +0 -240
- package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +0 -116
- package/templates/apps/web/app/[locale]/(authed)/account/retry-button.tsx +0 -27
- package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +0 -258
- package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +0 -131
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +0 -130
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +0 -92
- package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +0 -24
- package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +0 -121
- package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +0 -37
- package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +0 -60
- package/templates/apps/web/app/[locale]/(authed)/account/support/support-form.tsx +0 -98
- package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +0 -100
- package/templates/apps/web/app/[locale]/checkout/__tests__/pages.test.tsx +0 -139
- package/templates/apps/web/app/[locale]/checkout/__tests__/thank-you-account.test.tsx +0 -146
- package/templates/apps/web/app/[locale]/checkout/thank-you/page.tsx +0 -114
- package/templates/apps/web/app/[locale]/checkout/unavailable/page.tsx +0 -51
- package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +0 -614
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +0 -43
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +0 -214
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +0 -197
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +0 -286
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +0 -520
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +0 -376
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +0 -306
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/account-invite.actions.test.ts +0 -69
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +0 -398
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +0 -704
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +0 -173
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +0 -141
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/verify.test.tsx +0 -249
- package/templates/apps/web/app/[locale]/flows/[slug]/account-invite.actions.ts +0 -35
- package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +0 -92
- package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +0 -177
- package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +0 -472
- package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +0 -48
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +0 -100
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +0 -99
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -820
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -203
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +0 -194
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +0 -284
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +0 -302
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +0 -402
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/landing.test.tsx +0 -293
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -485
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +0 -231
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/checkout-seam.ts +0 -74
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +0 -36
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -420
- package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +0 -85
- package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +0 -91
- package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +0 -32
- package/templates/apps/web/app/[locale]/flows/[slug]/verify/page.tsx +0 -153
- package/templates/apps/web/app/[locale]/flows/[slug]/verify.actions.ts +0 -151
- package/templates/apps/web/app/[locale]/meet/confirmed/BookingHandOff.tsx +0 -128
- package/templates/apps/web/app/[locale]/meet/confirmed/__tests__/BookingHandOff.test.tsx +0 -126
- package/templates/apps/web/app/[locale]/purchase/__tests__/cancel.test.tsx +0 -162
- package/templates/apps/web/app/[locale]/purchase/__tests__/module-scope.test.ts +0 -68
- package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +0 -411
- package/templates/apps/web/app/[locale]/purchase/cancel/page.tsx +0 -115
- package/templates/apps/web/app/[locale]/purchase/success/page.tsx +0 -348
- 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__/account-config.test.ts +0 -704
- package/templates/apps/web/lib/__tests__/auth-routes.test.ts +0 -140
- package/templates/apps/web/lib/account-config.ts +0 -678
- package/templates/apps/web/lib/auth-routes.ts +0 -125
- package/templates/apps/web/lib/checkout-config.ts +0 -16
- 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/next-path.ts +0 -35
- package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
- package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
|
@@ -9,9 +9,28 @@
|
|
|
9
9
|
* namespace pass `apps/api`'s same-origin CSRF check (`isOriginAllowed`),
|
|
10
10
|
* which Node's server-side `fetch` cannot satisfy on its own since it never
|
|
11
11
|
* sets `Origin`.
|
|
12
|
+
*
|
|
13
|
+
* On a spoke that signs in through its hub (`SIGN_IN_PROVIDER === "hub"`) it
|
|
14
|
+
* returns the hub credential instead. The provider is the seam's, mocked to
|
|
15
|
+
* the one each case tests — never the site's generated value (#11246).
|
|
12
16
|
*/
|
|
13
17
|
import { forwardedCookieInit } from "../server-api";
|
|
14
|
-
|
|
18
|
+
|
|
19
|
+
const mockSeam: { SIGN_IN_PROVIDER: "site" | "hub" } = { SIGN_IN_PROVIDER: "site" };
|
|
20
|
+
// eslint-disable-next-line no-restricted-syntax -- #507: the generated topology seam is per-site; this suite pins the topology it tests (#11246)
|
|
21
|
+
jest.mock("../topology.generated", () => ({
|
|
22
|
+
__esModule: true,
|
|
23
|
+
get SIGN_IN_PROVIDER() {
|
|
24
|
+
return mockSeam.SIGN_IN_PROVIDER;
|
|
25
|
+
},
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
const mockHubSessionInit = jest.fn();
|
|
29
|
+
// eslint-disable-next-line no-restricted-syntax -- #507: hubSessionInit is mocked so the hub branch is asserted without a sealed cookie (#11246)
|
|
30
|
+
jest.mock("@working-theory/auth/hub-session", () => ({
|
|
31
|
+
__esModule: true,
|
|
32
|
+
hubSessionInit: () => mockHubSessionInit(),
|
|
33
|
+
}));
|
|
15
34
|
|
|
16
35
|
const mockCookies = jest.fn();
|
|
17
36
|
const mockHeaders = jest.fn();
|
|
@@ -24,12 +43,13 @@ jest.mock("next/headers", () => ({
|
|
|
24
43
|
|
|
25
44
|
describe("forwardedCookieInit", () => {
|
|
26
45
|
beforeEach(() => {
|
|
46
|
+
mockSeam.SIGN_IN_PROVIDER = "site";
|
|
47
|
+
mockHubSessionInit.mockReset();
|
|
27
48
|
mockCookies.mockReset();
|
|
28
49
|
mockHeaders.mockReset();
|
|
29
50
|
});
|
|
30
51
|
|
|
31
|
-
|
|
32
|
-
(TOPOLOGY === "hub" ? it : it.skip)(
|
|
52
|
+
it(
|
|
33
53
|
"forwards cookie + origin when the incoming request carries an Origin header",
|
|
34
54
|
async () => {
|
|
35
55
|
mockCookies.mockResolvedValue({
|
|
@@ -50,8 +70,7 @@ describe("forwardedCookieInit", () => {
|
|
|
50
70
|
},
|
|
51
71
|
);
|
|
52
72
|
|
|
53
|
-
|
|
54
|
-
(TOPOLOGY === "hub" ? it : it.skip)(
|
|
73
|
+
it(
|
|
55
74
|
"forwards cookie alone — no origin key at all — when Origin is absent",
|
|
56
75
|
async () => {
|
|
57
76
|
mockCookies.mockResolvedValue({
|
|
@@ -67,4 +86,17 @@ describe("forwardedCookieInit", () => {
|
|
|
67
86
|
expect(init.headers).not.toHaveProperty("origin");
|
|
68
87
|
},
|
|
69
88
|
);
|
|
89
|
+
|
|
90
|
+
it("on a spoke that signs in through its hub, returns the hub credential and reads no cookie", async () => {
|
|
91
|
+
mockSeam.SIGN_IN_PROVIDER = "hub";
|
|
92
|
+
mockHubSessionInit.mockResolvedValue({
|
|
93
|
+
headers: { authorization: "Bearer hub-token" },
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const init = await forwardedCookieInit();
|
|
97
|
+
|
|
98
|
+
expect(init).toEqual({ headers: { authorization: "Bearer hub-token" } });
|
|
99
|
+
expect(mockCookies).not.toHaveBeenCalled();
|
|
100
|
+
expect(mockHeaders).not.toHaveBeenCalled();
|
|
101
|
+
});
|
|
70
102
|
});
|
|
@@ -438,8 +438,13 @@ const CHECKOUT_PAGE_MARKER = "Standard spoke checkout page (#8748)";
|
|
|
438
438
|
// record), so its updated copy of this test must still exempt them.
|
|
439
439
|
const LEGACY_CHECKOUT_PAGE_MARKER = "GENERATED by create-ailk (#7838)";
|
|
440
440
|
const CHECKOUT_PAGE_NOINDEX_LINE = "robots: { index: false, follow: false }";
|
|
441
|
+
// #11253 — the two pages ship in `@working-theory/ui-commerce`, and a site's
|
|
442
|
+
// route file is the one `create-ailk routes` generates: it carries neither the
|
|
443
|
+
// marker nor the noindex line (the package's `pages.test.tsx` pins the
|
|
444
|
+
// noindex), so each requirement also accepts the generator's header.
|
|
445
|
+
const GENERATED_CHECKOUT_ROUTE = "// Generated by create-ailk routes from @working-theory/ui-commerce";
|
|
441
446
|
// #8840 D13 — the marker every standard magnet page carries in its header
|
|
442
|
-
// comment (`
|
|
447
|
+
// comment (`packages-paid/ui-signal-collectors/src/pages/flows/[slug]/magnet-page.tsx`), and the
|
|
443
448
|
// renderer it must import. A magnet page renders no `renderPage` call this
|
|
444
449
|
// harness can read, and its landing's JSON-LD comes from the hub's record, so
|
|
445
450
|
// a page carrying both is exempt at ANY route: `create-ailk add-route magnet`
|
|
@@ -515,11 +520,12 @@ const NO_STRUCTURED_DATA_ROUTES: ReadonlyArray<{
|
|
|
515
520
|
reason: "interactive flow engine, API-backed",
|
|
516
521
|
subtree: true,
|
|
517
522
|
},
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
+
{
|
|
524
|
+
route: "meet",
|
|
525
|
+
reason:
|
|
526
|
+
"booking pages ship in @working-theory/ui-scheduling (#11252); its suites check the JSON-LD",
|
|
527
|
+
subtree: true,
|
|
528
|
+
},
|
|
523
529
|
{ route: "private", reason: "private booking index, API-backed and noindex (#8843 D8)" },
|
|
524
530
|
{
|
|
525
531
|
route: "unsubscribe",
|
|
@@ -560,8 +566,8 @@ const NO_STRUCTURED_DATA_ROUTES: ReadonlyArray<{
|
|
|
560
566
|
reason:
|
|
561
567
|
"spoke checkout return page (#8748) — noindex, renders sections only, no JSON-LD",
|
|
562
568
|
requires: [
|
|
563
|
-
[CHECKOUT_PAGE_MARKER, LEGACY_CHECKOUT_PAGE_MARKER],
|
|
564
|
-
CHECKOUT_PAGE_NOINDEX_LINE,
|
|
569
|
+
[CHECKOUT_PAGE_MARKER, LEGACY_CHECKOUT_PAGE_MARKER, GENERATED_CHECKOUT_ROUTE],
|
|
570
|
+
[CHECKOUT_PAGE_NOINDEX_LINE, GENERATED_CHECKOUT_ROUTE],
|
|
565
571
|
],
|
|
566
572
|
},
|
|
567
573
|
{
|
|
@@ -569,8 +575,8 @@ const NO_STRUCTURED_DATA_ROUTES: ReadonlyArray<{
|
|
|
569
575
|
reason:
|
|
570
576
|
"spoke checkout return page (#8748) — noindex, renders sections only, no JSON-LD",
|
|
571
577
|
requires: [
|
|
572
|
-
[CHECKOUT_PAGE_MARKER, LEGACY_CHECKOUT_PAGE_MARKER],
|
|
573
|
-
CHECKOUT_PAGE_NOINDEX_LINE,
|
|
578
|
+
[CHECKOUT_PAGE_MARKER, LEGACY_CHECKOUT_PAGE_MARKER, GENERATED_CHECKOUT_ROUTE],
|
|
579
|
+
[CHECKOUT_PAGE_NOINDEX_LINE, GENERATED_CHECKOUT_ROUTE],
|
|
574
580
|
],
|
|
575
581
|
},
|
|
576
582
|
];
|
|
@@ -941,9 +947,9 @@ describe("structured data — a hub's own page is not rendered at its detail rou
|
|
|
941
947
|
//
|
|
942
948
|
// Proof that the two conditional entries above key on the FILE, not the
|
|
943
949
|
// route alone, and that every pre-existing entry is unaffected. The
|
|
944
|
-
// monorepo's own
|
|
945
|
-
//
|
|
946
|
-
// every PR.
|
|
950
|
+
// monorepo's own checkout routes are generated route files (#11253), so the
|
|
951
|
+
// route walk above meets only that shape — these cases are what exercise D1's
|
|
952
|
+
// marker and noindex requirements on every PR.
|
|
947
953
|
|
|
948
954
|
describe("structured data — exemption(route, src) keys the generated checkout routes on the file (#8513)", () => {
|
|
949
955
|
const GENERATED_SRC = `// The checkout thank-you page — ${CHECKOUT_PAGE_MARKER}.\nexport async function generateMetadata() {\n return { ${CHECKOUT_PAGE_NOINDEX_LINE} };\n}\n`;
|
|
@@ -972,6 +978,13 @@ describe("structured data — exemption(route, src) keys the generated checkout
|
|
|
972
978
|
expect(exemption("checkout/unavailable", legacy)).toContain("noindex");
|
|
973
979
|
});
|
|
974
980
|
|
|
981
|
+
it("exempts the route file create-ailk routes generates from @working-theory/ui-commerce (#11253)", () => {
|
|
982
|
+
const generated = `// oss: false\n${GENERATED_CHECKOUT_ROUTE} 0.24.0 — do not edit.\nexport default async function Route() {}\n`;
|
|
983
|
+
expect(exemption("checkout/thank-you", generated)).toContain("noindex");
|
|
984
|
+
expect(exemption("checkout/unavailable", generated)).toContain("noindex");
|
|
985
|
+
expect(exemption("checkout/thank-you", generated.replace("ui-commerce", "ui-scheduling"))).toBeUndefined();
|
|
986
|
+
});
|
|
987
|
+
|
|
975
988
|
it("does not exempt a neighboring checkout route or an unrelated route", () => {
|
|
976
989
|
expect(exemption("checkout/other", GENERATED_SRC)).toBeUndefined();
|
|
977
990
|
expect(exemption("about", GENERATED_SRC)).toBeUndefined();
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
* switch: `./listings-config.ts` is its one reader
|
|
26
26
|
* (`NEXT_PUBLIC_AILK_LISTING_SITE_KEY`, falling back to
|
|
27
27
|
* `AILK_LISTING_PUBLIC_KEY`, #7872 D8). The package is
|
|
28
|
-
* reached the way `
|
|
29
|
-
* `loadUiSignalCollectors()` in the generated paid-sections registry (#7536),
|
|
28
|
+
* reached the way `i18n/request.ts` reaches each page package's catalog:
|
|
29
|
+
* through `loadUiSignalCollectors()` in the generated paid-sections registry (#7536),
|
|
30
30
|
* a bundled `import()` where the site carries the package and a stub that
|
|
31
31
|
* answers `null` where it does not, so a keyless build resolves no paid
|
|
32
32
|
* package.
|
|
@@ -62,13 +62,27 @@ export function collectNavLabelKeys(
|
|
|
62
62
|
return keys;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Whether an ICU message has an argument: a `{` outside a quoted literal. ICU
|
|
67
|
+
* quotes only from an apostrophe that comes before a special character
|
|
68
|
+
* (`{ } # |`), and `''` is a literal apostrophe — so `Don't miss {name}` has
|
|
69
|
+
* an argument and `'{Feature 1}'` does not.
|
|
70
|
+
*/
|
|
71
|
+
function hasIcuArgument(message: string): boolean {
|
|
72
|
+
return message.replace(/''/g, "").replace(/'[{}#|][^']*'?/g, "").includes("{");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The string keys of a message catalog's `nav` namespace — labels only: a
|
|
77
|
+
* message with an ICU argument (`"Back to {name}"`) needs values, so it is
|
|
78
|
+
* never resolved bare as a label.
|
|
79
|
+
*/
|
|
66
80
|
export function navMessageKeys(catalog: unknown): string[] {
|
|
67
81
|
if (typeof catalog !== "object" || catalog === null) return [];
|
|
68
82
|
const nav = (catalog as Record<string, unknown>)["nav"];
|
|
69
83
|
if (typeof nav !== "object" || nav === null) return [];
|
|
70
84
|
return Object.entries(nav)
|
|
71
|
-
.filter(([, value]) => typeof value === "string")
|
|
85
|
+
.filter(([, value]) => typeof value === "string" && !hasIcuArgument(value))
|
|
72
86
|
.map(([key]) => key);
|
|
73
87
|
}
|
|
74
88
|
|
|
@@ -9,14 +9,43 @@
|
|
|
9
9
|
* package is a type error here.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* `@working-theory/ui-commerce`: the checkout and purchase pages' message
|
|
14
|
+
* catalog (`checkoutThankYou`, `checkoutUnavailable`, `purchase`), merged
|
|
15
|
+
* under the site's own by `i18n/request.ts` (#11253 D4), and the flows
|
|
16
|
+
* results page's price card `signal-collectors.config.tsx` loads into its
|
|
17
|
+
* `checkout` slot (#11251 D4). The card's props are left open: this base file
|
|
18
|
+
* can name no signal-collectors type, and the card restates the slot's props
|
|
19
|
+
* structurally (`FlowResultsPriceCard.tsx`).
|
|
20
|
+
*/
|
|
13
21
|
export interface UiCommerceContract {
|
|
14
|
-
|
|
22
|
+
commerceMessages(locale: string): Record<string, unknown> | undefined;
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- a React component of the slot's props; this file imports nothing, React's types included
|
|
24
|
+
FlowResultsPriceCard: (props: any) => any;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* `@working-theory/ui-signal-collectors`: the flows pages' message catalog
|
|
29
|
+
* (`flow`, `flowVerify`), merged under the site's own by `i18n/request.ts`
|
|
30
|
+
* (#11251 D6).
|
|
31
|
+
*/
|
|
32
|
+
export interface UiSignalCollectorsContract {
|
|
33
|
+
flowsMessages(locale: string): Record<string, unknown> | undefined;
|
|
15
34
|
}
|
|
16
35
|
|
|
17
36
|
/**
|
|
18
|
-
* `@working-theory/ui-
|
|
19
|
-
*
|
|
20
|
-
* `ListingDetail`.
|
|
37
|
+
* `@working-theory/ui-scheduling`: the booking pages' message catalog
|
|
38
|
+
* (`schedule`), merged under the site's own by `i18n/request.ts` (#11252 D4).
|
|
21
39
|
*/
|
|
22
|
-
export
|
|
40
|
+
export interface UiSchedulingContract {
|
|
41
|
+
schedulingMessages(locale: string): Record<string, unknown> | undefined;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* `@working-theory/ui-docs-blog`: the docs and blog pages' message catalog
|
|
46
|
+
* (`docs`, `blog`), merged under the site's own by `i18n/request.ts`
|
|
47
|
+
* (#11254 D4).
|
|
48
|
+
*/
|
|
49
|
+
export interface UiDocsBlogContract {
|
|
50
|
+
docsBlogMessages(locale: string): Record<string, unknown> | undefined;
|
|
51
|
+
}
|
|
@@ -6,9 +6,17 @@
|
|
|
6
6
|
// dynamic import; one this site does not carry is a stub that answers null.
|
|
7
7
|
import type {
|
|
8
8
|
UiCommerceContract,
|
|
9
|
+
UiDocsBlogContract,
|
|
10
|
+
UiSchedulingContract,
|
|
9
11
|
UiSignalCollectorsContract,
|
|
10
12
|
} from "./paid-section-contracts";
|
|
11
13
|
|
|
14
|
+
export const loadUiDocsBlog = async (): Promise<UiDocsBlogContract | null> =>
|
|
15
|
+
null;
|
|
16
|
+
|
|
17
|
+
export const loadUiScheduling =
|
|
18
|
+
async (): Promise<UiSchedulingContract | null> => null;
|
|
19
|
+
|
|
12
20
|
export const loadUiSignalCollectors =
|
|
13
21
|
async (): Promise<UiSignalCollectorsContract | null> => null;
|
|
14
22
|
|
|
@@ -1,51 +1,124 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
2
|
+
* The bare header's back arrow: where it goes and what it is called
|
|
3
|
+
* (operator handoff 2026-11-09, superseding #7744 D7's people-slide rule).
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* The arrow goes to the page's PARENT — the path with its last segment
|
|
6
|
+
* dropped, the locale prefix kept (`/meet/discovery` → `/meet`,
|
|
7
|
+
* `/es/meet/discovery` → `/es/meet`). A parent the site does not serve is
|
|
8
|
+
* skipped and the walk goes up again; past the top it is the home, so a
|
|
9
|
+
* top-level page's arrow still goes home and the arrow never links a 404.
|
|
10
|
+
*
|
|
11
|
+
* The return to the slide a visitor left from is not decided here: it is
|
|
12
|
+
* `@working-theory/ui`'s `NavBackLink` + `deck-return.ts` (#8644), which
|
|
13
|
+
* rewrites this href client-side on a matching arrival from a deck, whatever
|
|
14
|
+
* this href is. A direct arrival keeps the parent computed here.
|
|
9
15
|
*
|
|
10
16
|
* No Next.js import — pure functions, asserted directly by their own suite,
|
|
11
17
|
* in the `auth-routes.ts` idiom.
|
|
12
18
|
*/
|
|
13
19
|
|
|
14
|
-
/**
|
|
15
|
-
|
|
20
|
+
/** `pathname` without its query, hash, trailing slash and enabled-locale prefix. */
|
|
21
|
+
function barePath(pathname: string, locales: readonly string[]): string {
|
|
22
|
+
// Trailing slashes trimmed by a loop, not an anchored `/\/+$/`: the header
|
|
23
|
+
// can be client-set, and that regex backtracks quadratically on a long run.
|
|
24
|
+
let path = pathname.split(/[?#]/)[0] ?? "";
|
|
25
|
+
let end = path.length;
|
|
26
|
+
while (end > 0 && path[end - 1] === "/") end--;
|
|
27
|
+
path = path.slice(0, end);
|
|
28
|
+
const bare =
|
|
29
|
+
locales.length > 0
|
|
30
|
+
? path.replace(new RegExp(`^/(${locales.map(escapeRegExp).join("|")})(?=/|$)`), "")
|
|
31
|
+
: path;
|
|
32
|
+
return bare === "" ? "/" : bare;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function escapeRegExp(segment: string): string {
|
|
36
|
+
return segment.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
37
|
+
}
|
|
16
38
|
|
|
17
39
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
40
|
+
* The page's served parent as a bare (locale-less) path, nearest first, or
|
|
41
|
+
* `null` when no ancestor below the home is served.
|
|
20
42
|
*
|
|
21
|
-
* Fail-safe direction: an absent or empty pathname answers `
|
|
22
|
-
* missing `x-pathname` header leaves the
|
|
43
|
+
* Fail-safe direction: an absent or empty pathname answers `null`, so a
|
|
44
|
+
* missing `x-pathname` header leaves the arrow pointing home.
|
|
23
45
|
*/
|
|
24
|
-
export function
|
|
25
|
-
pathname: string | null | undefined
|
|
26
|
-
locales: readonly string[]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
);
|
|
46
|
+
export function servedParent(input: {
|
|
47
|
+
pathname: string | null | undefined;
|
|
48
|
+
locales: readonly string[];
|
|
49
|
+
served: (barePath: string) => boolean;
|
|
50
|
+
}): string | null {
|
|
51
|
+
const { pathname, locales, served } = input;
|
|
52
|
+
if (!pathname) return null;
|
|
53
|
+
const segments = barePath(pathname, locales).split("/").filter(Boolean);
|
|
54
|
+
for (let depth = segments.length - 1; depth >= 1; depth--) {
|
|
55
|
+
const parent = `/${segments.slice(0, depth).join("/")}`;
|
|
56
|
+
if (served(parent)) return parent;
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
38
59
|
}
|
|
39
60
|
|
|
40
|
-
/**
|
|
61
|
+
/** The arrow's server href: the served parent under the home's locale prefix, else `homePath`. */
|
|
41
62
|
export function backLinkHref(input: {
|
|
42
63
|
pathname: string | null | undefined;
|
|
43
64
|
homePath: string;
|
|
44
|
-
home: string;
|
|
45
65
|
locales: readonly string[];
|
|
66
|
+
served: (barePath: string) => boolean;
|
|
46
67
|
}): string {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
68
|
+
return parentHref(servedParent(input), input.homePath);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** A bare parent under the home's locale prefix; `homePath` itself for no parent. */
|
|
72
|
+
export function parentHref(parent: string | null, homePath: string): string {
|
|
73
|
+
if (parent === null) return homePath;
|
|
74
|
+
return homePath === "/" ? parent : `${homePath}${parent}`;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Path → label for every `{ labelKey, path }` entry anywhere in the nav and
|
|
79
|
+
* footer configs (flyout features, groups, columns), first entry winning.
|
|
80
|
+
* Every such path is a route the site carries (`lib/nav-config.ts`).
|
|
81
|
+
*/
|
|
82
|
+
export function navLabelsByPath(
|
|
83
|
+
nodes: unknown,
|
|
84
|
+
labelFor: (key: string) => string,
|
|
85
|
+
): Map<string, string> {
|
|
86
|
+
const labels = new Map<string, string>();
|
|
87
|
+
const visit = (node: unknown): void => {
|
|
88
|
+
if (Array.isArray(node)) {
|
|
89
|
+
node.forEach(visit);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (typeof node !== "object" || node === null) return;
|
|
93
|
+
const entry = node as Record<string, unknown>;
|
|
94
|
+
if (
|
|
95
|
+
typeof entry.path === "string" &&
|
|
96
|
+
typeof entry.labelKey === "string" &&
|
|
97
|
+
!labels.has(entry.path)
|
|
98
|
+
) {
|
|
99
|
+
labels.set(entry.path, labelFor(entry.labelKey));
|
|
100
|
+
}
|
|
101
|
+
Object.values(entry).forEach(visit);
|
|
102
|
+
};
|
|
103
|
+
visit(nodes);
|
|
104
|
+
return labels;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The name the arrow's label gives its destination ("Back to <name>"): the
|
|
109
|
+
* parent's nav label, else its page title, else its last segment in words
|
|
110
|
+
* (`/meet` → "Meet", `/case-studies` → "Case studies"), so the label always
|
|
111
|
+
* names where the link goes.
|
|
112
|
+
*/
|
|
113
|
+
export function backLinkName(
|
|
114
|
+
parent: string,
|
|
115
|
+
sources: {
|
|
116
|
+
navLabels: ReadonlyMap<string, string>;
|
|
117
|
+
titles: ReadonlyMap<string, string>;
|
|
118
|
+
},
|
|
119
|
+
): string {
|
|
120
|
+
const named = sources.navLabels.get(parent) || sources.titles.get(parent);
|
|
121
|
+
if (named) return named;
|
|
122
|
+
const words = (parent.split("/").pop() ?? "").replace(/-/g, " ");
|
|
123
|
+
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
51
124
|
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The site's served pages for one locale, as bare (locale-less) path → page
|
|
3
|
+
* title — what the bare header's back arrow walks up through
|
|
4
|
+
* (operator handoff 2026-11-09, `lib/profile-back-link.ts`).
|
|
5
|
+
*
|
|
6
|
+
* Two sources, each one this app already serves from:
|
|
7
|
+
* 1. Every content page the sitemap lists, at the path it lists it at
|
|
8
|
+
* (`app/sitemap.xml/route.ts`: `listPages` per type, `listedPath` over
|
|
9
|
+
* the site's listing, docs rows and `ThankYouPage` left out). Title =
|
|
10
|
+
* the page's frontmatter `title`.
|
|
11
|
+
* 2. Every fixed, code-rendered route in the routes map (`ROUTES` rows with
|
|
12
|
+
* no `:` segment and no `contentPath`) whose module's pages this site
|
|
13
|
+
* carries (`lib/modules.generated.ts`) — `/meet` is one: its index is
|
|
14
|
+
* code, its seeds are detail pages. No title.
|
|
15
|
+
* A route with seed content counts only through source 1, so a scaffold
|
|
16
|
+
* that dropped that surface's content never gets a link to a missing page.
|
|
17
|
+
* The layout adds the nav and footer paths itself (every nav entry is a
|
|
18
|
+
* route the site carries — `lib/nav-config.ts`).
|
|
19
|
+
*
|
|
20
|
+
* Shared per server instance for 60 seconds per locale, and fail-safe: any
|
|
21
|
+
* read that throws leaves that source out, so the arrow degrades toward the
|
|
22
|
+
* home, never to an error.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { SCHEMA_ORG_TYPES } from "@working-theory/content-adapters";
|
|
26
|
+
import type { SchemaOrgType } from "@working-theory/content-adapters";
|
|
27
|
+
import { getContentAdapter, listedPath } from "@working-theory/page-renderer";
|
|
28
|
+
import { ROUTES } from "@working-theory/templates/routes";
|
|
29
|
+
|
|
30
|
+
import { pagePathFor } from "../src/lib/routes";
|
|
31
|
+
|
|
32
|
+
import { isDocsType } from "./docs-index";
|
|
33
|
+
import {
|
|
34
|
+
DOCS_BLOG_PAGES,
|
|
35
|
+
MARKETING_PAGES,
|
|
36
|
+
SCHEDULING_PAGES,
|
|
37
|
+
} from "./modules.generated";
|
|
38
|
+
import { SITE_LISTING } from "./site-listing";
|
|
39
|
+
|
|
40
|
+
const TTL_MS = 60_000;
|
|
41
|
+
|
|
42
|
+
/** The modules whose code-rendered pages a site may carry, by its generated flags. */
|
|
43
|
+
const MODULE_PAGES: Readonly<Record<string, boolean>> = {
|
|
44
|
+
marketing: MARKETING_PAGES,
|
|
45
|
+
scheduling: SCHEDULING_PAGES,
|
|
46
|
+
"docs-blog": DOCS_BLOG_PAGES,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const cache = new Map<
|
|
50
|
+
string,
|
|
51
|
+
{ at: number; pages: Promise<ReadonlyMap<string, string>> }
|
|
52
|
+
>();
|
|
53
|
+
|
|
54
|
+
async function readServedPages(
|
|
55
|
+
locale: string,
|
|
56
|
+
): Promise<ReadonlyMap<string, string>> {
|
|
57
|
+
const pages = new Map<string, string>();
|
|
58
|
+
|
|
59
|
+
for (const row of ROUTES) {
|
|
60
|
+
if (row.route.includes(":") || row.contentPath !== undefined) continue;
|
|
61
|
+
if (MODULE_PAGES[row.module] !== true) continue;
|
|
62
|
+
pages.set(row.route, "");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
const adapter = getContentAdapter();
|
|
67
|
+
const types = SCHEMA_ORG_TYPES as readonly SchemaOrgType[];
|
|
68
|
+
const lists = await Promise.all(
|
|
69
|
+
types.map((type) => adapter.listPages(type, locale).catch(() => [])),
|
|
70
|
+
);
|
|
71
|
+
for (const list of lists) {
|
|
72
|
+
for (const page of list) {
|
|
73
|
+
if (isDocsType(page.type) || page.type === "ThankYouPage") continue;
|
|
74
|
+
const path = listedPath(SITE_LISTING, page, pagePathFor);
|
|
75
|
+
if (path !== null) pages.set(path, page.title);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
} catch {
|
|
79
|
+
// No adapter: the code-rendered routes alone.
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return pages;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Bare path → title ("" when the page has none) for every page served in `locale`. */
|
|
86
|
+
export function servedPages(
|
|
87
|
+
locale: string,
|
|
88
|
+
): Promise<ReadonlyMap<string, string>> {
|
|
89
|
+
const now = Date.now();
|
|
90
|
+
const hit = cache.get(locale);
|
|
91
|
+
if (hit && now - hit.at < TTL_MS) return hit.pages;
|
|
92
|
+
const pages = readServedPages(locale);
|
|
93
|
+
cache.set(locale, { at: now, pages });
|
|
94
|
+
return pages;
|
|
95
|
+
}
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
* rather than re-parsing the wire envelope by hand).
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import { hubSessionInit } from "@working-theory/auth/hub-session";
|
|
25
26
|
import { cookies, headers } from "next/headers";
|
|
26
27
|
|
|
27
|
-
import { hubSessionInit } from "./hub-session/session";
|
|
28
28
|
import { SIGN_IN_PROVIDER } from "./topology.generated";
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -120,11 +120,9 @@ function readSiteFrontmatter(): SiteFrontmatter | null {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
// Read once at module init — mirrors the existing SITE_NAME contract (a
|
|
123
|
-
// plain constant, not a function)
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
// #4157 sites — deliberately does NOT import this module; see its own
|
|
127
|
-
// comment).
|
|
123
|
+
// plain constant, not a function). Every consumer of this module runs in the
|
|
124
|
+
// Node.js runtime, since `content/` is not readable from the Edge runtime —
|
|
125
|
+
// `app/og/route.tsx` included, which moved to Node to read the brand (#11244).
|
|
128
126
|
const siteFrontmatter = readSiteFrontmatter();
|
|
129
127
|
|
|
130
128
|
export const SITE_NAME =
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
// readPhoneStep and loadPhoneApi read and write the account's phone step
|
|
15
15
|
// through Better Auth on a hub (#11138); a spoke's hub holds the person, so
|
|
16
16
|
// both answer null.
|
|
17
|
+
import type { AuthInstance } from "@working-theory/auth/site";
|
|
17
18
|
|
|
18
19
|
export const TOPOLOGY: "hub" | "spoke" = "hub";
|
|
19
20
|
export const UNSERVED_MCP_TOOLS: readonly string[] = [];
|
|
@@ -37,6 +38,10 @@ export async function readSession(headers: Headers): Promise<SiteSession> {
|
|
|
37
38
|
return auth.api.getSession({ headers });
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
export function loadAuth(): Promise<AuthInstance | null> {
|
|
42
|
+
return import("../auth").then((m) => m.auth);
|
|
43
|
+
}
|
|
44
|
+
|
|
40
45
|
export async function readOwnAccounts(
|
|
41
46
|
headers: Headers,
|
|
42
47
|
): Promise<ReadonlyArray<{ providerId: string }> | null> {
|