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,49 +0,0 @@
|
|
|
1
|
-
// Case Studies list page. Reads CaseStudiesList MDX via the content adapter and emits
|
|
2
|
-
// a JSON-LD CollectionPage via the dispatcher.
|
|
3
|
-
// It lists every CaseStudy page through one generated card section (#10121,
|
|
4
|
-
// apps/web/lib/hub-children.tsx — the /alternatives and /templates shape).
|
|
5
|
-
import type {
|
|
6
|
-
getMdxSlugs as defaultGetMdxSlugs,
|
|
7
|
-
getMdxSource as defaultGetMdxSource,
|
|
8
|
-
getPageSections as defaultGetPageSections,
|
|
9
|
-
} from "@working-theory/page-renderer";
|
|
10
|
-
import { renderPage, renderPageMetadata } from "@working-theory/page-renderer";
|
|
11
|
-
import type { Metadata } from "next";
|
|
12
|
-
import type { ReactElement } from "react";
|
|
13
|
-
|
|
14
|
-
import { type HubConfig, hubPageInput } from "../../../lib/hub-children";
|
|
15
|
-
|
|
16
|
-
interface Props {
|
|
17
|
-
params: Promise<{ locale: string }>;
|
|
18
|
-
getMdxSource?: typeof defaultGetMdxSource;
|
|
19
|
-
getPageSections?: typeof defaultGetPageSections;
|
|
20
|
-
getMdxSlugs?: typeof defaultGetMdxSlugs;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const HUB: HubConfig = {
|
|
24
|
-
listType: "CaseStudiesList",
|
|
25
|
-
slug: "case-studies",
|
|
26
|
-
childType: "CaseStudy",
|
|
27
|
-
linkLabel: "Read the case study",
|
|
28
|
-
sectionId: "case-study-cards",
|
|
29
|
-
body: "mdx-body",
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export async function generateMetadata({
|
|
33
|
-
params,
|
|
34
|
-
}: Pick<Props, "params">): Promise<Metadata> {
|
|
35
|
-
const { locale } = await params;
|
|
36
|
-
return renderPageMetadata({ type: "CaseStudiesList", slug: "case-studies", locale });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default async function Page({
|
|
40
|
-
params,
|
|
41
|
-
...loaders
|
|
42
|
-
}: Props): Promise<ReactElement> {
|
|
43
|
-
const { locale } = await params;
|
|
44
|
-
return renderPage({
|
|
45
|
-
type: "CaseStudiesList",
|
|
46
|
-
slug: "case-studies",
|
|
47
|
-
...(await hubPageInput(HUB, locale, loaders)),
|
|
48
|
-
});
|
|
49
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HTML snapshot regression tests for clients/page.tsx → @working-theory/page-renderer migration.
|
|
3
|
-
*
|
|
4
|
-
* Two-commit strategy:
|
|
5
|
-
* Commit 1: this file added; snapshots captured against pre-migration route (RED-passing).
|
|
6
|
-
* Commit 2: route migrated; same snapshots verify diff=0 (GREEN).
|
|
7
|
-
*
|
|
8
|
-
* Two states tested:
|
|
9
|
-
* - empty: getMdxSource returns null → empty-state branch
|
|
10
|
-
* - populated: getMdxSource returns a minimal MdxPageSource → full render
|
|
11
|
-
*
|
|
12
|
-
* Failure = snapshot diff > 0 bytes. DO NOT regenerate snapshots to pass.
|
|
13
|
-
*/
|
|
14
|
-
import React from "react";
|
|
15
|
-
import { render } from "@testing-library/react";
|
|
16
|
-
|
|
17
|
-
// ── @working-theory/ui mock ─────────────────────────────────────────────────────────────
|
|
18
|
-
jest.mock("@working-theory/ui", () => ({
|
|
19
|
-
// #7745: renderPage's mdx-body branch frames its head and body in the
|
|
20
|
-
// section Container and renders the body through MDXContent + the shared map.
|
|
21
|
-
Container: ({
|
|
22
|
-
children,
|
|
23
|
-
}: {
|
|
24
|
-
children?: React.ReactNode;
|
|
25
|
-
}): React.ReactElement => React.createElement("div", null, children),
|
|
26
|
-
MDXContent: ({
|
|
27
|
-
children,
|
|
28
|
-
}: {
|
|
29
|
-
children?: React.ReactNode;
|
|
30
|
-
}): React.ReactElement => React.createElement(React.Fragment, null, children),
|
|
31
|
-
getMDXComponents: (overrides?: Record<string, unknown>) => ({ ...overrides }),
|
|
32
|
-
// #4446/#4447: renderPage's own fallback/empty-state title now composes
|
|
33
|
-
// Heading (mobile type-budget classes, #4417) instead of a bare <h1>.
|
|
34
|
-
Heading: ({
|
|
35
|
-
children,
|
|
36
|
-
level,
|
|
37
|
-
}: {
|
|
38
|
-
children: React.ReactNode;
|
|
39
|
-
level: number;
|
|
40
|
-
}): React.ReactElement => React.createElement(`h${level}`, null, children),
|
|
41
|
-
SectionRenderer: ({ sections }: { sections: unknown[] }) =>
|
|
42
|
-
React.createElement("div", {
|
|
43
|
-
"data-testid": "section-renderer",
|
|
44
|
-
"data-section-count": String(sections.length),
|
|
45
|
-
}),
|
|
46
|
-
}));
|
|
47
|
-
|
|
48
|
-
import ClientsPage from "../page";
|
|
49
|
-
|
|
50
|
-
const getMdxSourceEmpty = jest.fn().mockResolvedValue(null);
|
|
51
|
-
|
|
52
|
-
describe("ClientsPage — snapshot regression", () => {
|
|
53
|
-
it("empty state renders deterministic HTML", async () => {
|
|
54
|
-
const element = await ClientsPage({
|
|
55
|
-
params: Promise.resolve({ locale: "en" }),
|
|
56
|
-
getMdxSource: getMdxSourceEmpty,
|
|
57
|
-
});
|
|
58
|
-
const { container } = render(element);
|
|
59
|
-
expect(container.innerHTML).toMatchInlineSnapshot(
|
|
60
|
-
`"<main id="main"><h1>Clients</h1><p data-testid="section-empty-state">Clients listing coming soon.</p></main>"`,
|
|
61
|
-
);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it("populated state renders deterministic HTML", async () => {
|
|
65
|
-
const source = {
|
|
66
|
-
frontmatter: {
|
|
67
|
-
type: "ClientsList" as const,
|
|
68
|
-
slug: "clients",
|
|
69
|
-
title: "Our Clients",
|
|
70
|
-
description: "Companies that trust us.",
|
|
71
|
-
},
|
|
72
|
-
body: "",
|
|
73
|
-
};
|
|
74
|
-
const getMdxSourcePopulated = jest.fn().mockResolvedValue(source);
|
|
75
|
-
|
|
76
|
-
const element = await ClientsPage({
|
|
77
|
-
params: Promise.resolve({ locale: "en" }),
|
|
78
|
-
getMdxSource: getMdxSourcePopulated,
|
|
79
|
-
});
|
|
80
|
-
const { container } = render(element);
|
|
81
|
-
expect(container.innerHTML).toMatchInlineSnapshot(
|
|
82
|
-
`"<script type="application/ld+json" data-testid="json-ld">{"@context":"https://schema.org","@type":"CollectionPage","inLanguage":"en","name":"Our Clients","description":"Companies that trust us.","mainEntity":{"@type":"ItemList","itemListElement":[{"@type":"Organization"}]}}</script><main id="main"><div><div data-testid="markdown-view-toggle" class="ailk-markdown-view-toggle"><div class="flex justify-end mb-3"><div role="radiogroup" aria-label="Page view" data-testid="markdown-view-toggle" class="inline-flex items-center gap-0.5 rounded-lg p-1 bg-(--color-surface-secondary)"><button class="inline-flex items-center justify-center gap-2 font-medium motion-safe:transition motion-safe:duration-(--button-hover-duration) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--color-accent) focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50 [&>svg]:shrink-0 text-(--color-fg) not-disabled:hover:bg-(--button-hover-quiet-bg) not-disabled:hover:text-(--button-hover-quiet-fg) not-disabled:hover:opacity-(--button-hover-opacity) not-disabled:hover:transform-(--button-hover-transform) not-disabled:hover:shadow-(--button-hover-shadow) not-disabled:active:bg-gray-200 not-disabled:active:text-(--color-fg) rounded-control px-control-x h-(--control-height-thin) text-caption leading-none rounded-md px-3 text-body-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--color-accent) focus-visible:ring-offset-1 min-w-(--control-height-thin) min-h-(--control-height-big) bg-(--color-bg) text-(--color-fg) shadow-sm" type="button" role="radio" aria-checked="true" aria-label="Rendered" tabindex="0" data-testid="markdown-view-toggle-rendered">Rendered</button><button class="inline-flex items-center justify-center gap-2 font-medium motion-safe:transition motion-safe:duration-(--button-hover-duration) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--color-accent) focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50 [&>svg]:shrink-0 text-(--color-fg) not-disabled:hover:bg-(--button-hover-quiet-bg) not-disabled:hover:text-(--button-hover-quiet-fg) not-disabled:hover:opacity-(--button-hover-opacity) not-disabled:hover:transform-(--button-hover-transform) not-disabled:hover:shadow-(--button-hover-shadow) not-disabled:active:bg-gray-200 not-disabled:active:text-(--color-fg) rounded-control px-control-x h-(--control-height-thin) text-caption leading-none rounded-md px-3 text-body-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--color-accent) focus-visible:ring-offset-1 min-w-(--control-height-thin) min-h-(--control-height-big) text-(--color-text-muted) hover:text-(--color-fg)" type="button" role="radio" aria-checked="false" aria-label="Markdown" tabindex="-1" data-testid="markdown-view-toggle-markdown">Markdown</button></div></div><div role="status" aria-live="polite" aria-atomic="true" class="sr-only" data-testid="markdown-view-toggle-status">Showing Rendered view</div><div data-testid="markdown-view-rendered"><article data-testid="mdx-body"><div data-testid="mdx-remote" data-source=""></div></article></div></div></div></main>"`,
|
|
83
|
-
);
|
|
84
|
-
});
|
|
85
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// Clients list page. Reads ClientsList MDX via the content adapter and emits
|
|
2
|
-
// a JSON-LD CollectionPage via the dispatcher.
|
|
3
|
-
import type {
|
|
4
|
-
getMdxSource as defaultGetMdxSource,
|
|
5
|
-
} from "@working-theory/page-renderer";
|
|
6
|
-
import {
|
|
7
|
-
getMdxSource as loadMdxSource,
|
|
8
|
-
renderPage,
|
|
9
|
-
renderPageMetadata,
|
|
10
|
-
} from "@working-theory/page-renderer";
|
|
11
|
-
import type { Metadata } from "next";
|
|
12
|
-
import type { ReactElement } from "react";
|
|
13
|
-
|
|
14
|
-
import { honourNavOnly } from "../../../lib/hub-children";
|
|
15
|
-
|
|
16
|
-
interface Props {
|
|
17
|
-
params: Promise<{ locale: string }>;
|
|
18
|
-
getMdxSource?: typeof defaultGetMdxSource;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function generateMetadata({
|
|
22
|
-
params,
|
|
23
|
-
}: Pick<Props, "params">): Promise<Metadata> {
|
|
24
|
-
const { locale } = await params;
|
|
25
|
-
return renderPageMetadata({ type: "ClientsList", slug: "clients", locale });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default async function Page({
|
|
29
|
-
params,
|
|
30
|
-
getMdxSource,
|
|
31
|
-
}: Props): Promise<ReactElement> {
|
|
32
|
-
const { locale } = await params;
|
|
33
|
-
const source = await (getMdxSource ?? loadMdxSource)(
|
|
34
|
-
"ClientsList",
|
|
35
|
-
"clients",
|
|
36
|
-
locale,
|
|
37
|
-
);
|
|
38
|
-
honourNavOnly(source?.frontmatter, locale, []);
|
|
39
|
-
return renderPage({
|
|
40
|
-
type: "ClientsList",
|
|
41
|
-
slug: "clients",
|
|
42
|
-
locale,
|
|
43
|
-
translationsNamespace: "clients",
|
|
44
|
-
bodyMode: "mdx-body",
|
|
45
|
-
...(getMdxSource !== undefined && { getMdxSource }),
|
|
46
|
-
});
|
|
47
|
-
}
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
"use client"; // owns which surface is showing (conversation vs. fallback form) + submission/analytics wiring
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ConversationalIntakeWrapper — apps/web's host around
|
|
5
|
-
* `ConversationalIntake` (#4534, integration leg of epic #4521). Consumes
|
|
6
|
-
* the block (#4543) and its engine (#4532) as published from
|
|
7
|
-
* `@working-theory/ui`, unmodified — this file owns none of the
|
|
8
|
-
* conversation logic, only:
|
|
9
|
-
*
|
|
10
|
-
* 1. Submission — `onComplete` hands the finished answers to the SAME
|
|
11
|
-
* `captureLeadAction` (`./contact.actions.ts`) the shared
|
|
12
|
-
* `LeadCaptureForm` on `/contact` already uses, built as a `FormData` (imperatively, not a real
|
|
13
|
-
* `<form>` submit — React 19 Server Actions are plain async functions).
|
|
14
|
-
* That action posts through the EXISTING `POST /v1/leads/submit` route
|
|
15
|
-
* (`apps/api/src/routes/leads`, consumed via `@working-theory/api-client`,
|
|
16
|
-
* never modified). Reusing this ONE action — rather than a second
|
|
17
|
-
* `*Action`-suffixed export — is deliberate: a second export would trip
|
|
18
|
-
* `apps/mcp/__tests__/parity.test.ts`'s Server-Action↔MCP-tool 1:1 count
|
|
19
|
-
* for a capability (lead capture) that already has its MCP twin
|
|
20
|
-
* (`ailkCaptureLead`); this is the SAME capability, invoked from a
|
|
21
|
-
* second web surface, not a new one. `contact.actions.ts`'s own
|
|
22
|
-
* doc-comment covers the additive `source` FormData field this file
|
|
23
|
-
* sets to distinguish intake-originated leads.
|
|
24
|
-
* 2. Skip fallback — `onSkip` swaps to the shared `LeadCaptureForm` block
|
|
25
|
-
* (#6730 — the one contact form), bound to the same action,
|
|
26
|
-
* carrying over whatever answers were already captured as its
|
|
27
|
-
* `initialValues` prefill. A failed auto-submit on `onComplete` falls
|
|
28
|
-
* back the same way, so a lead is never silently lost.
|
|
29
|
-
* 3. Per-turn analytics — `getThinkingDelayMs` is `ConversationalIntake`'s
|
|
30
|
-
* documented override seam (exported prop, used by the block's own
|
|
31
|
-
* tests for deterministic timing). Wrapping it — incrementing a turn
|
|
32
|
-
* counter and reporting it via `recordIntakeTurn`
|
|
33
|
-
* (`./intake-analytics.ts`), then returning an unchanged random delay
|
|
34
|
-
* from the exported `THINKING_DELAY_MIN_MS`/`THINKING_DELAY_MAX_MS`
|
|
35
|
-
* bounds — taps the ONE seam the block exposes once per turn, without
|
|
36
|
-
* touching its production pacing (behavior-contract item 5 stays
|
|
37
|
-
* intact: replies are never instant) and without needing the block's
|
|
38
|
-
* internal engine (not part of `@working-theory/ui`'s public surface —
|
|
39
|
-
* see packages/ui/src/blocks/index.ts).
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
import {
|
|
43
|
-
Container,
|
|
44
|
-
ConversationalIntake,
|
|
45
|
-
type ConversationalIntakeProps,
|
|
46
|
-
InlineMessage,
|
|
47
|
-
LeadCaptureForm,
|
|
48
|
-
localeHref,
|
|
49
|
-
THINKING_DELAY_MAX_MS,
|
|
50
|
-
THINKING_DELAY_MIN_MS,
|
|
51
|
-
} from "@working-theory/ui";
|
|
52
|
-
import { useLocale, useTranslations } from "next-intl";
|
|
53
|
-
import { useCallback, useMemo, useRef, useState } from "react";
|
|
54
|
-
|
|
55
|
-
import { contactFormText } from "./contact-form-text";
|
|
56
|
-
import { captureLeadAction } from "./contact.actions";
|
|
57
|
-
import { recordIntakeTurn } from "./intake-analytics";
|
|
58
|
-
import { buildContactIntakeScript } from "./intake-script";
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Uniform-random pause in [THINKING_DELAY_MIN_MS, THINKING_DELAY_MAX_MS] —
|
|
62
|
-
* mirrors `ConversationalIntake`'s own default picker (not exported; only
|
|
63
|
-
* the bounds are). Reimplemented from those bounds rather than importing
|
|
64
|
-
* the block's internals, so wrapping `getThinkingDelayMs` for analytics
|
|
65
|
-
* changes nothing about production pacing.
|
|
66
|
-
*/
|
|
67
|
-
function pickThinkingDelayMs(): number {
|
|
68
|
-
const span = THINKING_DELAY_MAX_MS - THINKING_DELAY_MIN_MS;
|
|
69
|
-
return THINKING_DELAY_MIN_MS + Math.floor(Math.random() * (span + 1));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Fires `recordIntakeTurn` on a later microtask, swallowing any failure — a
|
|
74
|
-
* synchronous throw from the Server Action reference or a rejected promise
|
|
75
|
-
* alike — so analytics can never stall a turn, the Skip fallback, or the lead
|
|
76
|
-
* submit (#6465).
|
|
77
|
-
*/
|
|
78
|
-
function fireIntakeTurn(input: Parameters<typeof recordIntakeTurn>[0]): void {
|
|
79
|
-
Promise.resolve()
|
|
80
|
-
.then(() => recordIntakeTurn(input))
|
|
81
|
-
.catch(() => {});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Builds the FormData captureLeadAction expects from the engine's answers.
|
|
86
|
-
* Called only once the terms turn was accepted, so it posts consent=true
|
|
87
|
-
* (#8730 D2) — the action checks it for every source.
|
|
88
|
-
*/
|
|
89
|
-
function answersToFormData(answers: Record<string, string>): FormData {
|
|
90
|
-
const formData = new FormData();
|
|
91
|
-
if (answers["name"] !== undefined) formData.set("name", answers["name"]);
|
|
92
|
-
if (answers["email"] !== undefined) formData.set("email", answers["email"]);
|
|
93
|
-
if (answers["message"] !== undefined)
|
|
94
|
-
formData.set("message", answers["message"]);
|
|
95
|
-
formData.set("source", "conversational-intake");
|
|
96
|
-
formData.set("consent", "true");
|
|
97
|
-
return formData;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
type Surface = "intake" | "form";
|
|
101
|
-
|
|
102
|
-
/** The terminal engine state `ConversationalIntake` hands `onComplete`/`onSkip`. */
|
|
103
|
-
type IntakeState = Parameters<
|
|
104
|
-
NonNullable<ConversationalIntakeProps["onComplete"]>
|
|
105
|
-
>[0];
|
|
106
|
-
|
|
107
|
-
// NO_HAND_IMPLEMENT_OK: operator-directed live Free-template reference pass.
|
|
108
|
-
// `inline` drops the page-level Container so the intake can sit inside the
|
|
109
|
-
// hero's right column (the /contact two-column layout).
|
|
110
|
-
export function ConversationalIntakeWrapper({
|
|
111
|
-
inline = false,
|
|
112
|
-
}: { inline?: boolean } = {}) {
|
|
113
|
-
const t = useTranslations("contact");
|
|
114
|
-
const locale = useLocale();
|
|
115
|
-
const script = useMemo(
|
|
116
|
-
() =>
|
|
117
|
-
buildContactIntakeScript({
|
|
118
|
-
nameAck: t("intake.nameAck"),
|
|
119
|
-
namePrompt: t("intake.namePrompt"),
|
|
120
|
-
messageAck: t("intake.messageAck"),
|
|
121
|
-
messagePrompt: t("intake.messagePrompt"),
|
|
122
|
-
emailAck: t("intake.emailAck"),
|
|
123
|
-
emailPrompt: t("intake.emailPrompt"),
|
|
124
|
-
consentAck: t("intake.consentAck"),
|
|
125
|
-
consentPrompt: t("intake.consentPrompt"),
|
|
126
|
-
consentAccept: t("intake.consentAccept"),
|
|
127
|
-
consentDecline: t("intake.consentDecline"),
|
|
128
|
-
skipMessage: t("intake.skipMessage"),
|
|
129
|
-
completionMessage: t("intake.completionMessage"),
|
|
130
|
-
}),
|
|
131
|
-
[t],
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
const [surface, setSurface] = useState<Surface>("intake");
|
|
135
|
-
const [initialValues, setInitialValues] = useState<Record<string, string>>(
|
|
136
|
-
{},
|
|
137
|
-
);
|
|
138
|
-
const [submitError, setSubmitError] = useState<string | undefined>(
|
|
139
|
-
undefined,
|
|
140
|
-
);
|
|
141
|
-
const turnIndexRef = useRef(0);
|
|
142
|
-
|
|
143
|
-
const getThinkingDelayMs = useCallback(() => {
|
|
144
|
-
turnIndexRef.current += 1;
|
|
145
|
-
fireIntakeTurn({
|
|
146
|
-
turnIndex: turnIndexRef.current,
|
|
147
|
-
status: "in_progress",
|
|
148
|
-
locale,
|
|
149
|
-
});
|
|
150
|
-
return pickThinkingDelayMs();
|
|
151
|
-
}, [locale]);
|
|
152
|
-
|
|
153
|
-
const fallBackToForm = useCallback((answers: Record<string, string>) => {
|
|
154
|
-
// exactOptionalPropertyTypes-safe (mirrors flow.actions.ts's own
|
|
155
|
-
// rationale): omit an absent answer's key entirely rather than setting
|
|
156
|
-
// it to an explicit `undefined`.
|
|
157
|
-
setInitialValues({
|
|
158
|
-
...(answers["name"] !== undefined && { name: answers["name"] }),
|
|
159
|
-
...(answers["email"] !== undefined && { email: answers["email"] }),
|
|
160
|
-
...(answers["message"] !== undefined && {
|
|
161
|
-
message: answers["message"],
|
|
162
|
-
}),
|
|
163
|
-
});
|
|
164
|
-
setSurface("form");
|
|
165
|
-
}, []);
|
|
166
|
-
|
|
167
|
-
const handleComplete = useCallback(
|
|
168
|
-
({ answers }: IntakeState) => {
|
|
169
|
-
fireIntakeTurn({
|
|
170
|
-
turnIndex: turnIndexRef.current,
|
|
171
|
-
status: "completed",
|
|
172
|
-
locale,
|
|
173
|
-
});
|
|
174
|
-
// #8730 D2 — the engine records the tapped pill's label; anything but
|
|
175
|
-
// the accept label is not acceptance, so nothing is sent and the form,
|
|
176
|
-
// with its own terms box, takes over.
|
|
177
|
-
if (answers["consent"] !== t("intake.consentAccept")) {
|
|
178
|
-
fallBackToForm(answers);
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
void (async () => {
|
|
182
|
-
const result = await captureLeadAction(null, answersToFormData(answers));
|
|
183
|
-
if (result?.kind !== "success") {
|
|
184
|
-
setSubmitError(t("intake.submitError"));
|
|
185
|
-
fallBackToForm(answers);
|
|
186
|
-
}
|
|
187
|
-
})();
|
|
188
|
-
},
|
|
189
|
-
[locale, t, fallBackToForm],
|
|
190
|
-
);
|
|
191
|
-
|
|
192
|
-
const handleSkip = useCallback(
|
|
193
|
-
({ answers }: IntakeState) => {
|
|
194
|
-
fireIntakeTurn({
|
|
195
|
-
turnIndex: turnIndexRef.current,
|
|
196
|
-
status: "skipped",
|
|
197
|
-
locale,
|
|
198
|
-
});
|
|
199
|
-
fallBackToForm(answers);
|
|
200
|
-
},
|
|
201
|
-
[locale, fallBackToForm],
|
|
202
|
-
);
|
|
203
|
-
|
|
204
|
-
if (surface === "form") {
|
|
205
|
-
return (
|
|
206
|
-
<Container className={inline ? "p-0" : "py-section"}>
|
|
207
|
-
{submitError ? (
|
|
208
|
-
<InlineMessage
|
|
209
|
-
variant="error"
|
|
210
|
-
data-testid="contact-intake-submit-error"
|
|
211
|
-
>
|
|
212
|
-
{submitError}
|
|
213
|
-
</InlineMessage>
|
|
214
|
-
) : null}
|
|
215
|
-
<LeadCaptureForm
|
|
216
|
-
action={captureLeadAction}
|
|
217
|
-
text={contactFormText(t)}
|
|
218
|
-
termsHref={localeHref(locale, "/terms")}
|
|
219
|
-
// #8661 D7 — the same three policy links /contact passes, so the
|
|
220
|
-
// catalog's three-link statement resolves here too.
|
|
221
|
-
policies={{
|
|
222
|
-
terms: localeHref(locale, "/terms"),
|
|
223
|
-
privacy: localeHref(locale, "/privacy"),
|
|
224
|
-
working_agreement: localeHref(locale, "/working-agreement"),
|
|
225
|
-
}}
|
|
226
|
-
initialValues={initialValues}
|
|
227
|
-
/>
|
|
228
|
-
</Container>
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return (
|
|
233
|
-
<Container className={inline ? "p-0" : "py-section"}>
|
|
234
|
-
<ConversationalIntake
|
|
235
|
-
script={script}
|
|
236
|
-
onComplete={handleComplete}
|
|
237
|
-
onSkip={handleSkip}
|
|
238
|
-
getThinkingDelayMs={getThinkingDelayMs}
|
|
239
|
-
labels={{
|
|
240
|
-
guidedBadge: t("intake.guidedBadge"),
|
|
241
|
-
skip: t("intake.skip"),
|
|
242
|
-
send: t("intake.send"),
|
|
243
|
-
freeTextPlaceholder: t("intake.freeTextPlaceholder"),
|
|
244
|
-
}}
|
|
245
|
-
data-testid="contact-conversational-intake"
|
|
246
|
-
/>
|
|
247
|
-
</Container>
|
|
248
|
-
);
|
|
249
|
-
}
|