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,81 +0,0 @@
|
|
|
1
|
-
// TemplatePage detail (#10051 D7) — one template at /templates/<slug>,
|
|
2
|
-
// listed by the /templates hub. Reads the TemplatePage MDX for the given
|
|
3
|
-
// slug and renders in sections mode: a generated hero (name, summary,
|
|
4
|
-
// thumbnail, categories, Get it / Start free, View demo) and "What's
|
|
5
|
-
// included", built from the frontmatter, then the page's own declared
|
|
6
|
-
// sections. A page whose first declared section is a `hero` keeps its own
|
|
7
|
-
// hero and drops the generated one. JSON-LD: a WebPage whose mainEntity is a
|
|
8
|
-
// schema.org Product carrying an Offer. Unknown slugs 404 through
|
|
9
|
-
// renderPage's detail branch.
|
|
10
|
-
//
|
|
11
|
-
// Gated off by default (surfaces.ts `templates` surface): no roster names
|
|
12
|
-
// this route, so a fresh scaffold excludes it. `create-ailk add-route
|
|
13
|
-
// templates` installs it.
|
|
14
|
-
import type {
|
|
15
|
-
getMdxSource as defaultGetMdxSource,
|
|
16
|
-
getPageSections as defaultGetPageSections,
|
|
17
|
-
} from "@working-theory/page-renderer";
|
|
18
|
-
import {
|
|
19
|
-
getPageSections as loadPageSections,
|
|
20
|
-
renderPage,
|
|
21
|
-
renderPageMetadata,
|
|
22
|
-
} from "@working-theory/page-renderer";
|
|
23
|
-
import type { Metadata } from "next";
|
|
24
|
-
import { getTranslations } from "next-intl/server";
|
|
25
|
-
import type { ReactElement } from "react";
|
|
26
|
-
|
|
27
|
-
import {
|
|
28
|
-
templateDetailSections,
|
|
29
|
-
templateLabels,
|
|
30
|
-
} from "../../../../lib/template-listing";
|
|
31
|
-
|
|
32
|
-
interface Props {
|
|
33
|
-
params: Promise<{ locale: string; slug: string }>;
|
|
34
|
-
getMdxSource?: typeof defaultGetMdxSource;
|
|
35
|
-
getPageSections?: typeof defaultGetPageSections;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
type Section = Awaited<ReturnType<typeof defaultGetPageSections>>[number];
|
|
39
|
-
|
|
40
|
-
export async function generateMetadata({
|
|
41
|
-
params,
|
|
42
|
-
}: Pick<Props, "params">): Promise<Metadata> {
|
|
43
|
-
const { locale, slug } = await params;
|
|
44
|
-
return renderPageMetadata({ type: "TemplatePage", slug, locale });
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default async function Page({
|
|
48
|
-
params,
|
|
49
|
-
getMdxSource,
|
|
50
|
-
getPageSections,
|
|
51
|
-
}: Props): Promise<ReactElement> {
|
|
52
|
-
const { locale, slug } = await params;
|
|
53
|
-
const loadSections = getPageSections ?? loadPageSections;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* The generated sections first, then the declared ones. Runs only when a
|
|
57
|
-
* source exists, so the translations read here never shadows renderPage's
|
|
58
|
-
* null-source 404 (no `translationsNamespace` is passed, #7537).
|
|
59
|
-
*/
|
|
60
|
-
async function withTemplate(frontmatter: unknown): Promise<Section[]> {
|
|
61
|
-
const declared = await loadSections(frontmatter);
|
|
62
|
-
const t = await getTranslations({ namespace: "templates", locale });
|
|
63
|
-
const [hero, included] = templateDetailSections(
|
|
64
|
-
frontmatter,
|
|
65
|
-
templateLabels(t),
|
|
66
|
-
);
|
|
67
|
-
// An author's own leading hero takes the generated hero's place at the top.
|
|
68
|
-
const [first, ...rest] = declared;
|
|
69
|
-
return first?.type === "hero"
|
|
70
|
-
? [first, included, ...rest]
|
|
71
|
-
: [hero, included, ...declared];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return renderPage({
|
|
75
|
-
type: "TemplatePage",
|
|
76
|
-
slug,
|
|
77
|
-
locale,
|
|
78
|
-
getPageSections: withTemplate,
|
|
79
|
-
...(getMdxSource !== undefined && { getMdxSource }),
|
|
80
|
-
});
|
|
81
|
-
}
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for /templates (#10051 D7, AC-4) — the TemplatesList hub.
|
|
3
|
-
*
|
|
4
|
-
* `renderPage`/`renderPageMetadata`/`getMdxSlugs` are mocked at the
|
|
5
|
-
* `@working-theory/page-renderer` boundary, the /reports test shape — each
|
|
6
|
-
* assertion inspects the sections the route hands `renderPage`. The JSON-LD
|
|
7
|
-
* is built from those same sections with the real `buildTemplatesList`, as
|
|
8
|
-
* `renderPage` does, so the card count and the ItemList are compared on one
|
|
9
|
-
* input.
|
|
10
|
-
*/
|
|
11
|
-
import { buildTemplatesList } from "@working-theory/schema";
|
|
12
|
-
|
|
13
|
-
const mockRenderPage = jest.fn(async (..._args: unknown[]) => "<rendered/>");
|
|
14
|
-
const mockRenderPageMetadata = jest.fn((..._args: unknown[]) => undefined);
|
|
15
|
-
const mockGetMdxSlugs = jest.fn((..._args: unknown[]) =>
|
|
16
|
-
Promise.resolve<string[]>([]),
|
|
17
|
-
);
|
|
18
|
-
const mockNotFound = jest.fn(() => {
|
|
19
|
-
throw new Error("NEXT_NOT_FOUND");
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
jest.mock("next/navigation", () => ({
|
|
23
|
-
__esModule: true,
|
|
24
|
-
notFound: () => mockNotFound(),
|
|
25
|
-
}));
|
|
26
|
-
|
|
27
|
-
jest.mock("@working-theory/page-renderer", () => ({
|
|
28
|
-
__esModule: true,
|
|
29
|
-
getMdxSlugs: (...args: unknown[]) => mockGetMdxSlugs(...args),
|
|
30
|
-
renderPage: (...args: unknown[]) => mockRenderPage(...args),
|
|
31
|
-
renderPageMetadata: (...args: unknown[]) => mockRenderPageMetadata(...args),
|
|
32
|
-
// Never reached — every call in this suite passes both via DI props.
|
|
33
|
-
getMdxSource: jest.fn(),
|
|
34
|
-
getPageSections: jest.fn(),
|
|
35
|
-
}));
|
|
36
|
-
|
|
37
|
-
const MESSAGES: Record<string, string> = {
|
|
38
|
-
emptyState: "Templates coming soon.",
|
|
39
|
-
getIt: "Get it",
|
|
40
|
-
startFree: "Start free",
|
|
41
|
-
viewDemo: "View demo",
|
|
42
|
-
viewTemplate: "View template",
|
|
43
|
-
included: "What's included",
|
|
44
|
-
demoBadge: "Live demo",
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
jest.mock("next-intl/server", () => ({
|
|
48
|
-
__esModule: true,
|
|
49
|
-
getTranslations: () => Promise.resolve((key: string) => MESSAGES[key] ?? key),
|
|
50
|
-
}));
|
|
51
|
-
|
|
52
|
-
import TemplatesPage, { generateMetadata } from "../page";
|
|
53
|
-
|
|
54
|
-
const HUB_SOURCE = {
|
|
55
|
-
frontmatter: {
|
|
56
|
-
type: "TemplatesList",
|
|
57
|
-
slug: "templates",
|
|
58
|
-
title: "Templates",
|
|
59
|
-
description: "Every template we sell.",
|
|
60
|
-
},
|
|
61
|
-
body: "",
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const TEMPLATE_SOURCES: Record<
|
|
65
|
-
string,
|
|
66
|
-
{ frontmatter: Record<string, unknown>; body: string }
|
|
67
|
-
> = {
|
|
68
|
-
a: {
|
|
69
|
-
frontmatter: {
|
|
70
|
-
type: "TemplatePage",
|
|
71
|
-
slug: "a",
|
|
72
|
-
title: "Template A",
|
|
73
|
-
description: "Description A.",
|
|
74
|
-
summary: "Summary A.",
|
|
75
|
-
price: 0,
|
|
76
|
-
priceCurrency: "USD",
|
|
77
|
-
demoUrl: "https://a.salessmyth.com",
|
|
78
|
-
categories: ["accounting"],
|
|
79
|
-
thumbnail: "/img/a.png",
|
|
80
|
-
getItUrl: "/contact",
|
|
81
|
-
includes: [{ title: "Base site", description: "Pages." }],
|
|
82
|
-
},
|
|
83
|
-
body: "",
|
|
84
|
-
},
|
|
85
|
-
b: {
|
|
86
|
-
frontmatter: {
|
|
87
|
-
type: "TemplatePage",
|
|
88
|
-
slug: "b",
|
|
89
|
-
title: "Template B",
|
|
90
|
-
description: "Description B.",
|
|
91
|
-
getItUrl: "/contact",
|
|
92
|
-
includes: [{ title: "Base site", description: "Pages." }],
|
|
93
|
-
},
|
|
94
|
-
body: "",
|
|
95
|
-
},
|
|
96
|
-
c: {
|
|
97
|
-
frontmatter: {
|
|
98
|
-
type: "TemplatePage",
|
|
99
|
-
slug: "c",
|
|
100
|
-
title: "Template C",
|
|
101
|
-
description: "Description C.",
|
|
102
|
-
getItUrl: "/contact",
|
|
103
|
-
includes: [{ title: "Base site", description: "Pages." }],
|
|
104
|
-
},
|
|
105
|
-
body: "",
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const CTA = { type: "cta", id: "closing", data: { headline: "Talk to us" } };
|
|
110
|
-
|
|
111
|
-
function loaderFor(slugs: string[]) {
|
|
112
|
-
mockGetMdxSlugs.mockResolvedValue([...slugs].reverse());
|
|
113
|
-
return jest.fn(async (type: string, slug: string) => {
|
|
114
|
-
if (type === "TemplatesList") return HUB_SOURCE;
|
|
115
|
-
return slugs.includes(slug) ? (TEMPLATE_SOURCES[slug] ?? null) : null;
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
type Section = { type: string; id: string; data: Record<string, unknown> };
|
|
120
|
-
|
|
121
|
-
async function renderedSections(slugs: string[], declared: Section[] = [CTA]) {
|
|
122
|
-
await TemplatesPage({
|
|
123
|
-
params: Promise.resolve({ locale: "en" }),
|
|
124
|
-
getMdxSource: loaderFor(slugs) as never,
|
|
125
|
-
getPageSections: jest.fn(async () => declared) as never,
|
|
126
|
-
});
|
|
127
|
-
const input = mockRenderPage.mock.calls[0]![0] as {
|
|
128
|
-
getPageSections: (fm: unknown) => Promise<Section[]>;
|
|
129
|
-
};
|
|
130
|
-
return input.getPageSections(HUB_SOURCE.frontmatter);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function cardsOf(sections: Section[]) {
|
|
134
|
-
const grid = sections.find((s) => s.id === "template-cards");
|
|
135
|
-
return (grid?.data.items ?? []) as Array<Record<string, unknown>>;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
beforeEach(() => jest.clearAllMocks());
|
|
139
|
-
|
|
140
|
-
describe("TemplatesPage — hub seed absent", () => {
|
|
141
|
-
it("calls notFound() and never reaches renderPage", async () => {
|
|
142
|
-
await expect(
|
|
143
|
-
TemplatesPage({
|
|
144
|
-
params: Promise.resolve({ locale: "en" }),
|
|
145
|
-
getMdxSource: jest.fn().mockResolvedValue(null),
|
|
146
|
-
getPageSections: jest.fn(),
|
|
147
|
-
}),
|
|
148
|
-
).rejects.toThrow("NEXT_NOT_FOUND");
|
|
149
|
-
expect(mockNotFound).toHaveBeenCalledTimes(1);
|
|
150
|
-
expect(mockRenderPage).not.toHaveBeenCalled();
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
describe("TemplatesPage — metadata", () => {
|
|
155
|
-
it("resolves TemplatesList slug templates", async () => {
|
|
156
|
-
await generateMetadata({ params: Promise.resolve({ locale: "en" }) });
|
|
157
|
-
expect(mockRenderPageMetadata).toHaveBeenCalledWith({
|
|
158
|
-
type: "TemplatesList",
|
|
159
|
-
slug: "templates",
|
|
160
|
-
locale: "en",
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
describe("TemplatesPage — the generated card grid (#10051 AC-4)", () => {
|
|
166
|
-
it("renders TemplatesList with the templates namespace", async () => {
|
|
167
|
-
await renderedSections(["a", "b"]);
|
|
168
|
-
expect(mockRenderPage.mock.calls[0]![0]).toMatchObject({
|
|
169
|
-
type: "TemplatesList",
|
|
170
|
-
slug: "templates",
|
|
171
|
-
translationsNamespace: "templates",
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
it("renders two cards in slug order with every D2 field present", async () => {
|
|
176
|
-
const cards = cardsOf(await renderedSections(["a", "b"]));
|
|
177
|
-
expect(cards).toEqual([
|
|
178
|
-
{
|
|
179
|
-
title: "Template A",
|
|
180
|
-
description: "Summary A.",
|
|
181
|
-
image: { src: "/img/a.png", alt: "Template A" },
|
|
182
|
-
eyebrow: "Accounting",
|
|
183
|
-
badge: "Live demo",
|
|
184
|
-
link: { label: "View template", href: "/templates/a" },
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
title: "Template B",
|
|
188
|
-
description: "Description B.",
|
|
189
|
-
link: { label: "View template", href: "/templates/b" },
|
|
190
|
-
},
|
|
191
|
-
]);
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
it("renders three cards when a third source is added, with no hub change", async () => {
|
|
195
|
-
expect(cardsOf(await renderedSections(["a", "b", "c"]))).toHaveLength(3);
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
it("places the generated section before the seed's trailing cta", async () => {
|
|
199
|
-
const hero = {
|
|
200
|
-
type: "hero",
|
|
201
|
-
id: "hub-hero",
|
|
202
|
-
data: { headline: "Templates" },
|
|
203
|
-
};
|
|
204
|
-
const sections = await renderedSections(["a"], [hero, CTA]);
|
|
205
|
-
expect(sections.map((s) => s.id)).toEqual([
|
|
206
|
-
"hub-hero",
|
|
207
|
-
"template-cards",
|
|
208
|
-
"closing",
|
|
209
|
-
]);
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
it("renders the empty-state note and no card with zero sources", async () => {
|
|
213
|
-
const sections = await renderedSections([]);
|
|
214
|
-
expect(cardsOf(sections)).toHaveLength(0);
|
|
215
|
-
expect(sections.find((s) => s.id === "template-cards-empty")?.data).toEqual(
|
|
216
|
-
{
|
|
217
|
-
body: "Templates coming soon.",
|
|
218
|
-
align: "center",
|
|
219
|
-
},
|
|
220
|
-
);
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
it("emits an ItemList with as many elements as cards", async () => {
|
|
224
|
-
const sections = await renderedSections(["a", "b", "c"]);
|
|
225
|
-
// eslint-disable-next-line no-restricted-syntax -- the builder returns a loose JSON-LD node; this test reads one nested key of it
|
|
226
|
-
const jsonLd = buildTemplatesList({
|
|
227
|
-
type: "TemplatesList",
|
|
228
|
-
slug: "templates",
|
|
229
|
-
title: "Templates",
|
|
230
|
-
description: "Every template we sell.",
|
|
231
|
-
sections,
|
|
232
|
-
} as never) as unknown as { mainEntity: { itemListElement: unknown[] } };
|
|
233
|
-
expect(jsonLd.mainEntity.itemListElement).toHaveLength(
|
|
234
|
-
cardsOf(sections).length,
|
|
235
|
-
);
|
|
236
|
-
});
|
|
237
|
-
});
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// TemplatesList hub (#10051 D7) — the /templates page. Reads the
|
|
2
|
-
// TemplatesList MDX via the content adapter, inserts one generated `items`
|
|
3
|
-
// section carrying a card per TemplatePage (so the visible card grid and the
|
|
4
|
-
// CollectionPage's ItemList JSON-LD — built from the same sections — always
|
|
5
|
-
// agree, the /alternatives shape), and emits via the dispatcher.
|
|
6
|
-
//
|
|
7
|
-
// notFound() when the hub seed is absent (the /alternatives rule). With zero
|
|
8
|
-
// TemplatePage files the generated section is a content-block carrying the
|
|
9
|
-
// translated empty-state note (the /reports rule). Either sits before the
|
|
10
|
-
// page's trailing closing CTA(s) (#7745 D4).
|
|
11
|
-
//
|
|
12
|
-
// Gated off by default (surfaces.ts `templates` surface): no roster names
|
|
13
|
-
// this route, so a fresh scaffold excludes it. `create-ailk add-route
|
|
14
|
-
// templates` installs it with one seed per AILK template.
|
|
15
|
-
import type {
|
|
16
|
-
getMdxSource as defaultGetMdxSource,
|
|
17
|
-
getPageSections as defaultGetPageSections,
|
|
18
|
-
} from "@working-theory/page-renderer";
|
|
19
|
-
import {
|
|
20
|
-
getMdxSource as loadMdxSource,
|
|
21
|
-
getPageSections as loadPageSections,
|
|
22
|
-
renderPage,
|
|
23
|
-
renderPageMetadata,
|
|
24
|
-
} from "@working-theory/page-renderer";
|
|
25
|
-
import type { Metadata } from "next";
|
|
26
|
-
import { notFound } from "next/navigation";
|
|
27
|
-
import { getTranslations } from "next-intl/server";
|
|
28
|
-
import type { ReactElement } from "react";
|
|
29
|
-
|
|
30
|
-
import { honourNavOnly } from "../../../lib/hub-children";
|
|
31
|
-
import {
|
|
32
|
-
insertBeforeClosingCtas,
|
|
33
|
-
listDetailPages,
|
|
34
|
-
} from "../../../lib/route-family";
|
|
35
|
-
import { templateCard, templateLabels } from "../../../lib/template-listing";
|
|
36
|
-
|
|
37
|
-
interface Props {
|
|
38
|
-
params: Promise<{ locale: string }>;
|
|
39
|
-
getMdxSource?: typeof defaultGetMdxSource;
|
|
40
|
-
getPageSections?: typeof defaultGetPageSections;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
type Section = Awaited<ReturnType<typeof defaultGetPageSections>>[number];
|
|
44
|
-
|
|
45
|
-
export async function generateMetadata({
|
|
46
|
-
params,
|
|
47
|
-
}: Pick<Props, "params">): Promise<Metadata> {
|
|
48
|
-
const { locale } = await params;
|
|
49
|
-
return renderPageMetadata({
|
|
50
|
-
type: "TemplatesList",
|
|
51
|
-
slug: "templates",
|
|
52
|
-
locale,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export default async function Page({
|
|
57
|
-
params,
|
|
58
|
-
getMdxSource,
|
|
59
|
-
getPageSections,
|
|
60
|
-
}: Props): Promise<ReactElement> {
|
|
61
|
-
const { locale } = await params;
|
|
62
|
-
const load = getMdxSource ?? loadMdxSource;
|
|
63
|
-
const loadSections = getPageSections ?? loadPageSections;
|
|
64
|
-
|
|
65
|
-
const source = await load("TemplatesList", "templates", locale);
|
|
66
|
-
if (source === null) {
|
|
67
|
-
notFound();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const pages = await listDetailPages("TemplatePage", locale, load);
|
|
71
|
-
honourNavOnly(
|
|
72
|
-
source.frontmatter,
|
|
73
|
-
locale,
|
|
74
|
-
pages.map((page) => `/templates/${page.slug}`),
|
|
75
|
-
);
|
|
76
|
-
const t = await getTranslations({ namespace: "templates", locale });
|
|
77
|
-
const labels = templateLabels(t);
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* One generated section listing every TemplatePage — D4's "lists every
|
|
81
|
-
* template page automatically", and the ItemList JSON-LD agrees with it
|
|
82
|
-
* because `renderPage` builds both from these sections.
|
|
83
|
-
*/
|
|
84
|
-
async function withTemplates(frontmatter: unknown): Promise<Section[]> {
|
|
85
|
-
const declared = await loadSections(frontmatter);
|
|
86
|
-
const generated: Section =
|
|
87
|
-
pages.length > 0
|
|
88
|
-
? {
|
|
89
|
-
type: "items",
|
|
90
|
-
id: "template-cards",
|
|
91
|
-
// A tile is one click target per card (design review round 1, B1).
|
|
92
|
-
data: {
|
|
93
|
-
variant: "tile",
|
|
94
|
-
tileHover: "outline",
|
|
95
|
-
items: pages.map((page) => templateCard(page, labels)),
|
|
96
|
-
},
|
|
97
|
-
}
|
|
98
|
-
: {
|
|
99
|
-
type: "content-block",
|
|
100
|
-
id: "template-cards-empty",
|
|
101
|
-
data: { body: t("emptyState"), align: "center" },
|
|
102
|
-
};
|
|
103
|
-
return insertBeforeClosingCtas(declared, generated);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return renderPage({
|
|
107
|
-
type: "TemplatesList",
|
|
108
|
-
slug: "templates",
|
|
109
|
-
locale,
|
|
110
|
-
translationsNamespace: "templates",
|
|
111
|
-
getPageSections: withTemplates,
|
|
112
|
-
...(getMdxSource !== undefined && { getMdxSource }),
|
|
113
|
-
});
|
|
114
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// Terms page. Reads the TermsPage MDX frontmatter, renders sections via
|
|
2
|
-
// SectionRenderer, and emits a JSON-LD <script>.
|
|
3
|
-
import type {
|
|
4
|
-
getMdxSource as defaultGetMdxSource,
|
|
5
|
-
getPageSections as defaultGetPageSections} from "@working-theory/page-renderer";
|
|
6
|
-
import {
|
|
7
|
-
renderPage,
|
|
8
|
-
renderPageMetadata
|
|
9
|
-
} from "@working-theory/page-renderer";
|
|
10
|
-
import type { Metadata } from "next";
|
|
11
|
-
import type { ReactElement } from "react";
|
|
12
|
-
|
|
13
|
-
interface Props {
|
|
14
|
-
params: Promise<{ locale: string }>;
|
|
15
|
-
getMdxSource?: typeof defaultGetMdxSource;
|
|
16
|
-
getPageSections?: typeof defaultGetPageSections;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export async function generateMetadata({
|
|
20
|
-
params,
|
|
21
|
-
}: Pick<Props, "params">): Promise<Metadata> {
|
|
22
|
-
const { locale } = await params;
|
|
23
|
-
return renderPageMetadata({ type: "TermsPage", slug: "terms", locale });
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export default async function Page({
|
|
27
|
-
params,
|
|
28
|
-
getMdxSource,
|
|
29
|
-
getPageSections,
|
|
30
|
-
}: Props): Promise<ReactElement> {
|
|
31
|
-
const { locale } = await params;
|
|
32
|
-
return renderPage({
|
|
33
|
-
type: "TermsPage",
|
|
34
|
-
slug: "terms",
|
|
35
|
-
locale,
|
|
36
|
-
translationsNamespace: "terms",
|
|
37
|
-
...(getMdxSource !== undefined && { getMdxSource }),
|
|
38
|
-
...(getPageSections !== undefined && { getPageSections }),
|
|
39
|
-
});
|
|
40
|
-
}
|
package/templates/apps/web/app/[locale]/testimonials/__tests__/page-renderer-migration.test.tsx
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HTML snapshot regression tests for testimonials/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 TestimonialsPage from "../page";
|
|
49
|
-
|
|
50
|
-
const getMdxSourceEmpty = jest.fn().mockResolvedValue(null);
|
|
51
|
-
|
|
52
|
-
describe("TestimonialsPage — snapshot regression", () => {
|
|
53
|
-
it("empty state renders deterministic HTML", async () => {
|
|
54
|
-
const element = await TestimonialsPage({
|
|
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>Testimonials</h1><p data-testid="section-empty-state">Testimonials coming soon.</p></main>"`,
|
|
61
|
-
);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it("populated state renders deterministic HTML", async () => {
|
|
65
|
-
const source = {
|
|
66
|
-
frontmatter: {
|
|
67
|
-
type: "TestimonialsList" as const,
|
|
68
|
-
slug: "testimonials",
|
|
69
|
-
title: "Customer Testimonials",
|
|
70
|
-
description: "What our customers say.",
|
|
71
|
-
},
|
|
72
|
-
body: "",
|
|
73
|
-
};
|
|
74
|
-
const getMdxSourcePopulated = jest.fn().mockResolvedValue(source);
|
|
75
|
-
|
|
76
|
-
const element = await TestimonialsPage({
|
|
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":"Customer Testimonials","description":"What our customers say.","mainEntity":{"@type":"ItemList","itemListElement":[{"@type":"Review"}]},"aggregateRating":{"@context":"https://schema.org","@type":"AggregateRating","ratingValue":4.9,"reviewCount":0,"bestRating":5,"worstRating":1,"itemReviewed":{"@type":"SoftwareApplication"}}}</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,51 +0,0 @@
|
|
|
1
|
-
// Testimonials list page. Reads TestimonialsList 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({
|
|
26
|
-
type: "TestimonialsList",
|
|
27
|
-
slug: "testimonials",
|
|
28
|
-
locale,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default async function Page({
|
|
33
|
-
params,
|
|
34
|
-
getMdxSource,
|
|
35
|
-
}: Props): Promise<ReactElement> {
|
|
36
|
-
const { locale } = await params;
|
|
37
|
-
const source = await (getMdxSource ?? loadMdxSource)(
|
|
38
|
-
"TestimonialsList",
|
|
39
|
-
"testimonials",
|
|
40
|
-
locale,
|
|
41
|
-
);
|
|
42
|
-
honourNavOnly(source?.frontmatter, locale, []);
|
|
43
|
-
return renderPage({
|
|
44
|
-
type: "TestimonialsList",
|
|
45
|
-
slug: "testimonials",
|
|
46
|
-
locale,
|
|
47
|
-
translationsNamespace: "testimonials",
|
|
48
|
-
bodyMode: "mdx-body",
|
|
49
|
-
...(getMdxSource !== undefined && { getMdxSource }),
|
|
50
|
-
});
|
|
51
|
-
}
|