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,279 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared cases for the hub child-card tests (#10121).
|
|
3
|
-
*
|
|
4
|
-
* Each hub's test lives beside its route
|
|
5
|
-
* (`app/[locale]/<hub>/__tests__/hub-children.test.tsx`) so a scaffold that
|
|
6
|
-
* drops a gated hub drops its test with it (#10157). This module imports no
|
|
7
|
-
* route, so it ships to every scaffold and type-checks without any hub.
|
|
8
|
-
*
|
|
9
|
-
* `renderPage`/`renderPageMetadata` are mocked at the
|
|
10
|
-
* `@working-theory/page-renderer` boundary in each test file, the /templates
|
|
11
|
-
* test shape: each assertion inspects the sections a hub hands `renderPage`.
|
|
12
|
-
* The JSON-LD is built from those same sections with the real `buildJsonLd`,
|
|
13
|
-
* as `renderPage` does, so the cards and the ItemList are compared on one
|
|
14
|
-
* input per hub.
|
|
15
|
-
*/
|
|
16
|
-
import { buildJsonLd } from "@working-theory/schema";
|
|
17
|
-
import type { ReactElement } from "react";
|
|
18
|
-
|
|
19
|
-
export type Section = {
|
|
20
|
-
type: string;
|
|
21
|
-
id?: string;
|
|
22
|
-
data?: Record<string, unknown>;
|
|
23
|
-
};
|
|
24
|
-
export type Loaders = {
|
|
25
|
-
getMdxSource: jest.Mock;
|
|
26
|
-
getPageSections: jest.Mock;
|
|
27
|
-
getMdxSlugs: jest.Mock;
|
|
28
|
-
};
|
|
29
|
-
export type HubPage = (
|
|
30
|
-
props: {
|
|
31
|
-
params: Promise<{ locale: string }>;
|
|
32
|
-
} & Loaders,
|
|
33
|
-
) => Promise<ReactElement>;
|
|
34
|
-
export type RenderPageMock = jest.Mock<Promise<string>, unknown[]>;
|
|
35
|
-
|
|
36
|
-
/** [route, page, list type, child type, body rule] — one row per hub. */
|
|
37
|
-
export type HubRow = [
|
|
38
|
-
string,
|
|
39
|
-
HubPage,
|
|
40
|
-
string,
|
|
41
|
-
string,
|
|
42
|
-
"sections" | "mdx-body" | "composed",
|
|
43
|
-
];
|
|
44
|
-
|
|
45
|
-
export const HERO: Section = {
|
|
46
|
-
type: "hero",
|
|
47
|
-
id: "hero",
|
|
48
|
-
data: { headline: "Hub" },
|
|
49
|
-
};
|
|
50
|
-
export const CLOSING: Section = {
|
|
51
|
-
type: "cta",
|
|
52
|
-
id: "closing",
|
|
53
|
-
data: { headline: "Go" },
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/** Loaders for one hub: its seed, its declared sections, and its children. */
|
|
57
|
-
export function loaders(
|
|
58
|
-
listType: string,
|
|
59
|
-
childType: string,
|
|
60
|
-
children: Record<string, { title?: string; description?: string } | null>,
|
|
61
|
-
declared: Section[],
|
|
62
|
-
hubSections = true,
|
|
63
|
-
): Loaders {
|
|
64
|
-
return {
|
|
65
|
-
getMdxSource: jest.fn(async (type: string, slug: string) => {
|
|
66
|
-
if (type === listType) {
|
|
67
|
-
return {
|
|
68
|
-
frontmatter: {
|
|
69
|
-
type,
|
|
70
|
-
slug,
|
|
71
|
-
title: "Hub",
|
|
72
|
-
description: "The hub.",
|
|
73
|
-
...(hubSections && { sections: declared }),
|
|
74
|
-
},
|
|
75
|
-
body: "",
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
if (type !== childType) return null;
|
|
79
|
-
const child = children[slug];
|
|
80
|
-
return child === null || child === undefined
|
|
81
|
-
? null
|
|
82
|
-
: { frontmatter: { type, slug, ...child }, body: "" };
|
|
83
|
-
}),
|
|
84
|
-
getPageSections: jest.fn(async () => declared),
|
|
85
|
-
getMdxSlugs: jest.fn(async (type: string) =>
|
|
86
|
-
type === childType ? Object.keys(children) : [],
|
|
87
|
-
),
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/** Renders a hub and returns the one input it handed `renderPage`. */
|
|
92
|
-
export async function renderInput(
|
|
93
|
-
mockRenderPage: RenderPageMock,
|
|
94
|
-
page: HubPage,
|
|
95
|
-
l: Loaders,
|
|
96
|
-
) {
|
|
97
|
-
mockRenderPage.mockClear();
|
|
98
|
-
await page({ params: Promise.resolve({ locale: "en" }), ...l });
|
|
99
|
-
expect(mockRenderPage).toHaveBeenCalledTimes(1);
|
|
100
|
-
return mockRenderPage.mock.calls[0]?.[0] as {
|
|
101
|
-
type: string;
|
|
102
|
-
slug: string;
|
|
103
|
-
bodyMode?: string;
|
|
104
|
-
trailing?: { props: { sections: Section[] } };
|
|
105
|
-
getPageSections: (fm: unknown) => Promise<Section[]>;
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export const titlesOf = (section: unknown) =>
|
|
110
|
-
(section as { data: { items: { title: string }[] } } | null)?.data.items.map(
|
|
111
|
-
(i) => i.title,
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
/** The five cases every hub meets, registered as one `describe` per hub. */
|
|
115
|
-
export function describeHub(
|
|
116
|
-
[route, page, listType, childType, body]: HubRow,
|
|
117
|
-
mockRenderPage: RenderPageMock,
|
|
118
|
-
): void {
|
|
119
|
-
describe(`/${route} hub`, () => {
|
|
120
|
-
// Out of slug order on purpose, plus one slug that does not load.
|
|
121
|
-
const children = {
|
|
122
|
-
zeta: { title: "Zeta", description: "Zeta page." },
|
|
123
|
-
alpha: { title: "Alpha", description: "Alpha page." },
|
|
124
|
-
gone: null,
|
|
125
|
-
beta: { title: "Beta" },
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
it("generates one card per child page, sorted by slug, before the closing CTA", async () => {
|
|
129
|
-
const input = await renderInput(
|
|
130
|
-
mockRenderPage,
|
|
131
|
-
page,
|
|
132
|
-
loaders(listType, childType, children, [HERO, CLOSING]),
|
|
133
|
-
);
|
|
134
|
-
expect(input.type).toBe(listType);
|
|
135
|
-
expect(input.slug).toBe(route);
|
|
136
|
-
|
|
137
|
-
const sections = await input.getPageSections({});
|
|
138
|
-
expect(sections.map((s) => s.type)).toEqual(["hero", "items", "cta"]);
|
|
139
|
-
const items = (sections[1]?.data as { items: unknown[] }).items;
|
|
140
|
-
expect(items).toEqual([
|
|
141
|
-
expect.objectContaining({
|
|
142
|
-
title: "Alpha",
|
|
143
|
-
description: "Alpha page.",
|
|
144
|
-
link: expect.objectContaining({ href: `/${route}/alpha` }),
|
|
145
|
-
}),
|
|
146
|
-
expect.objectContaining({
|
|
147
|
-
title: "Beta",
|
|
148
|
-
description: "",
|
|
149
|
-
link: expect.objectContaining({ href: `/${route}/beta` }),
|
|
150
|
-
}),
|
|
151
|
-
expect.objectContaining({
|
|
152
|
-
title: "Zeta",
|
|
153
|
-
link: expect.objectContaining({ href: `/${route}/zeta` }),
|
|
154
|
-
}),
|
|
155
|
-
]);
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
it("lists the same pages in the CollectionPage ItemList as in the cards", async () => {
|
|
159
|
-
const input = await renderInput(
|
|
160
|
-
mockRenderPage,
|
|
161
|
-
page,
|
|
162
|
-
loaders(listType, childType, children, [HERO, CLOSING]),
|
|
163
|
-
);
|
|
164
|
-
const sections = await input.getPageSections({});
|
|
165
|
-
// eslint-disable-next-line no-restricted-syntax -- buildJsonLd returns a loose JSON-LD node; this case reads one nested key of it
|
|
166
|
-
const jsonLd = buildJsonLd({
|
|
167
|
-
type: listType,
|
|
168
|
-
slug: route,
|
|
169
|
-
title: "Hub",
|
|
170
|
-
description: "The hub.",
|
|
171
|
-
locale: "en",
|
|
172
|
-
sections,
|
|
173
|
-
} as never) as unknown as {
|
|
174
|
-
mainEntity: { itemListElement: { name?: string }[] };
|
|
175
|
-
};
|
|
176
|
-
expect(jsonLd.mainEntity.itemListElement.map((e) => e.name)).toEqual([
|
|
177
|
-
"Alpha",
|
|
178
|
-
"Beta",
|
|
179
|
-
"Zeta",
|
|
180
|
-
]);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it("gives an already-linked child no second card", async () => {
|
|
184
|
-
const authored: Section = {
|
|
185
|
-
type: "items",
|
|
186
|
-
id: "authored",
|
|
187
|
-
data: {
|
|
188
|
-
items: [
|
|
189
|
-
{
|
|
190
|
-
title: "Alpha (hand-written)",
|
|
191
|
-
link: { label: "Read", href: `/en/${route}/alpha/` },
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
title: "Zeta (hand-written)",
|
|
195
|
-
link: {
|
|
196
|
-
label: "Read",
|
|
197
|
-
href: `https://example.com/${route}/zeta?x=1`,
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
|
-
],
|
|
201
|
-
},
|
|
202
|
-
};
|
|
203
|
-
const input = await renderInput(
|
|
204
|
-
mockRenderPage,
|
|
205
|
-
page,
|
|
206
|
-
loaders(listType, childType, children, [HERO, authored, CLOSING]),
|
|
207
|
-
);
|
|
208
|
-
const sections = await input.getPageSections({});
|
|
209
|
-
const titles = (s: Section | undefined) =>
|
|
210
|
-
(s?.data as { items: { title: string }[] }).items.map((i) => i.title);
|
|
211
|
-
if (body === "mdx-body") {
|
|
212
|
-
// A prose hub never renders its declared sections, so links there do
|
|
213
|
-
// not count: every child gets a visible card after the body.
|
|
214
|
-
expect(sections.map((s) => s.type)).toEqual([
|
|
215
|
-
"hero",
|
|
216
|
-
"items",
|
|
217
|
-
"items",
|
|
218
|
-
"cta",
|
|
219
|
-
]);
|
|
220
|
-
expect(titles(sections[2])).toEqual(["Alpha", "Beta", "Zeta"]);
|
|
221
|
-
} else {
|
|
222
|
-
// The missing child continues the authored grid: one list, no duplicate.
|
|
223
|
-
expect(sections.map((s) => s.id)).toEqual([
|
|
224
|
-
"hero",
|
|
225
|
-
"authored",
|
|
226
|
-
"closing",
|
|
227
|
-
]);
|
|
228
|
-
expect(titles(sections[1])).toEqual([
|
|
229
|
-
"Alpha (hand-written)",
|
|
230
|
-
"Zeta (hand-written)",
|
|
231
|
-
"Beta",
|
|
232
|
-
]);
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
it("renders its authored sections unchanged with zero child pages", async () => {
|
|
237
|
-
const input = await renderInput(
|
|
238
|
-
mockRenderPage,
|
|
239
|
-
page,
|
|
240
|
-
loaders(listType, childType, {}, [HERO, CLOSING]),
|
|
241
|
-
);
|
|
242
|
-
expect(await input.getPageSections({})).toEqual([HERO, CLOSING]);
|
|
243
|
-
expect(input.trailing).toBeUndefined();
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
it("keeps the hub's body rule, rendering the cards after a prose body", async () => {
|
|
247
|
-
const prose = await renderInput(
|
|
248
|
-
mockRenderPage,
|
|
249
|
-
page,
|
|
250
|
-
loaders(listType, childType, children, [], false),
|
|
251
|
-
);
|
|
252
|
-
if (body === "sections") {
|
|
253
|
-
expect(prose.bodyMode).toBeUndefined();
|
|
254
|
-
expect(prose.trailing).toBeUndefined();
|
|
255
|
-
} else {
|
|
256
|
-
// A prose seed renders its MDX body, with the cards after it.
|
|
257
|
-
expect(prose.bodyMode).toBe("mdx-body");
|
|
258
|
-
expect(prose.trailing?.props.sections.map((s) => s.type)).toEqual([
|
|
259
|
-
"items",
|
|
260
|
-
]);
|
|
261
|
-
expect(await prose.getPageSections({})).toEqual(
|
|
262
|
-
prose.trailing?.props.sections,
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
const composed = await renderInput(
|
|
267
|
-
mockRenderPage,
|
|
268
|
-
page,
|
|
269
|
-
loaders(listType, childType, children, [HERO, CLOSING]),
|
|
270
|
-
);
|
|
271
|
-
if (body === "mdx-body") {
|
|
272
|
-
expect(composed.bodyMode).toBe("mdx-body");
|
|
273
|
-
} else {
|
|
274
|
-
expect(composed.bodyMode).toBeUndefined();
|
|
275
|
-
expect(composed.trailing).toBeUndefined();
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The route-family helper (#10051 D5, AC-6) — the generic pieces a content
|
|
3
|
-
* hub uses: list every detail page of a type, and slot a generated section in
|
|
4
|
-
* before the page's closing CTAs.
|
|
5
|
-
*/
|
|
6
|
-
import { insertBeforeClosingCtas, listDetailPages } from "../route-family";
|
|
7
|
-
|
|
8
|
-
jest.mock("@working-theory/page-renderer", () => ({
|
|
9
|
-
getMdxSlugs: jest.fn(async () => ["c", "a", "gone", "b"]),
|
|
10
|
-
getMdxSource: jest.fn(),
|
|
11
|
-
}));
|
|
12
|
-
|
|
13
|
-
describe("listDetailPages", () => {
|
|
14
|
-
it("returns every loaded page sorted by slug, dropping a null load", async () => {
|
|
15
|
-
const load = jest.fn(async (_type: string, slug: string) =>
|
|
16
|
-
slug === "gone" ? null : { frontmatter: { title: slug.toUpperCase() } },
|
|
17
|
-
);
|
|
18
|
-
const pages = await listDetailPages("TemplatePage", "en", load as never);
|
|
19
|
-
expect(pages).toEqual([
|
|
20
|
-
{ slug: "a", frontmatter: { title: "A" } },
|
|
21
|
-
{ slug: "b", frontmatter: { title: "B" } },
|
|
22
|
-
{ slug: "c", frontmatter: { title: "C" } },
|
|
23
|
-
]);
|
|
24
|
-
expect(load).toHaveBeenCalledWith("TemplatePage", "a", "en");
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe("insertBeforeClosingCtas", () => {
|
|
29
|
-
const section = (type: string, id: string) => ({ type, id }) as never;
|
|
30
|
-
|
|
31
|
-
it("places the section before a trailing run of two cta sections", () => {
|
|
32
|
-
const result = insertBeforeClosingCtas(
|
|
33
|
-
[section("hero", "h"), section("cta", "c1"), section("cta", "c2")],
|
|
34
|
-
section("items", "new"),
|
|
35
|
-
);
|
|
36
|
-
expect(result.map((s: { id: string }) => s.id)).toEqual([
|
|
37
|
-
"h",
|
|
38
|
-
"new",
|
|
39
|
-
"c1",
|
|
40
|
-
"c2",
|
|
41
|
-
]);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("appends when the page does not end in a cta", () => {
|
|
45
|
-
const result = insertBeforeClosingCtas(
|
|
46
|
-
[section("cta", "c1"), section("hero", "h")],
|
|
47
|
-
section("items", "new"),
|
|
48
|
-
);
|
|
49
|
-
expect(result.map((s: { id: string }) => s.id)).toEqual(["c1", "h", "new"]);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it("appends to an empty page", () => {
|
|
53
|
-
expect(insertBeforeClosingCtas([], section("items", "new"))).toHaveLength(
|
|
54
|
-
1,
|
|
55
|
-
);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment node
|
|
3
|
-
*/
|
|
4
|
-
// #10043 D8, AC-6 — the services listing: a service's public path, a
|
|
5
|
-
// category's list of its services and the hub's re-pointed links.
|
|
6
|
-
import { PageSectionsSchema } from "@working-theory/validation";
|
|
7
|
-
|
|
8
|
-
type Mod = typeof import("../service-listing");
|
|
9
|
-
|
|
10
|
-
function load(value: string | undefined): Mod {
|
|
11
|
-
const saved = process.env.NEXT_PUBLIC_AILK_SERVICES_PATH;
|
|
12
|
-
if (value === undefined) delete process.env.NEXT_PUBLIC_AILK_SERVICES_PATH;
|
|
13
|
-
else process.env.NEXT_PUBLIC_AILK_SERVICES_PATH = value;
|
|
14
|
-
let mod: Mod | undefined;
|
|
15
|
-
try {
|
|
16
|
-
jest.isolateModules(() => {
|
|
17
|
-
mod = require("../service-listing") as Mod;
|
|
18
|
-
});
|
|
19
|
-
} finally {
|
|
20
|
-
if (saved === undefined) delete process.env.NEXT_PUBLIC_AILK_SERVICES_PATH;
|
|
21
|
-
else process.env.NEXT_PUBLIC_AILK_SERVICES_PATH = saved;
|
|
22
|
-
}
|
|
23
|
-
return mod!;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const labels = {
|
|
27
|
-
childrenHeading: "Services in this area",
|
|
28
|
-
viewService: "View service",
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const pages = [
|
|
32
|
-
{
|
|
33
|
-
slug: "a",
|
|
34
|
-
frontmatter: {
|
|
35
|
-
title: "A",
|
|
36
|
-
description: "A desc.",
|
|
37
|
-
summary: "A sum.",
|
|
38
|
-
parent: "ai",
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
{ slug: "ai", frontmatter: { title: "AI", description: "AI desc." } },
|
|
42
|
-
{
|
|
43
|
-
slug: "b",
|
|
44
|
-
frontmatter: { title: "B", description: "B desc.", parent: "ai" },
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
slug: "c",
|
|
48
|
-
frontmatter: { title: "C", description: "C desc.", parent: "other" },
|
|
49
|
-
},
|
|
50
|
-
];
|
|
51
|
-
|
|
52
|
-
describe("service-listing with services.path /capabilities", () => {
|
|
53
|
-
const mod = load("/capabilities");
|
|
54
|
-
|
|
55
|
-
it("builds the public path under the base and the category", () => {
|
|
56
|
-
expect(mod.servicePublicPath("x")).toBe("/capabilities/x");
|
|
57
|
-
expect(mod.servicePublicPath("x", "ai")).toBe("/capabilities/ai/x");
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it("lists a category's services in slug order, summary else description", () => {
|
|
61
|
-
const children = mod.childServices(pages, "ai");
|
|
62
|
-
const section = mod.serviceChildrenSection(children, labels);
|
|
63
|
-
expect(section.data.headline).toBe("Services in this area");
|
|
64
|
-
expect(section.data.items).toEqual([
|
|
65
|
-
{
|
|
66
|
-
title: "A",
|
|
67
|
-
description: "A sum.",
|
|
68
|
-
link: { label: "View service", href: "/capabilities/ai/a" },
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
title: "B",
|
|
72
|
-
description: "B desc.",
|
|
73
|
-
link: { label: "View service", href: "/capabilities/ai/b" },
|
|
74
|
-
},
|
|
75
|
-
]);
|
|
76
|
-
expect(PageSectionsSchema.safeParse([section]).success).toBe(true);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it("re-points a hub section link onto the base and leaves an absolute URL", () => {
|
|
80
|
-
const sections = [
|
|
81
|
-
{
|
|
82
|
-
type: "items",
|
|
83
|
-
id: "s",
|
|
84
|
-
data: {
|
|
85
|
-
items: [
|
|
86
|
-
{ title: "X", link: { label: "Go", href: "/services/x" } },
|
|
87
|
-
{
|
|
88
|
-
title: "Y",
|
|
89
|
-
link: { label: "Go", href: "https://example.com/services" },
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
];
|
|
95
|
-
const mapped = mod.withPublicServicesSections(sections);
|
|
96
|
-
expect(mapped[0]?.data.items.map((i) => i.link.href)).toEqual([
|
|
97
|
-
"/capabilities/x",
|
|
98
|
-
"https://example.com/services",
|
|
99
|
-
]);
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
describe("service-listing with no services.path", () => {
|
|
104
|
-
const mod = load(undefined);
|
|
105
|
-
|
|
106
|
-
it("returns the same sections array", () => {
|
|
107
|
-
const sections = [{ type: "items", id: "s", data: { items: [] } }];
|
|
108
|
-
expect(mod.withPublicServicesSections(sections)).toBe(sections);
|
|
109
|
-
expect(mod.servicePublicPath("x", "ai")).toBe("/services/ai/x");
|
|
110
|
-
});
|
|
111
|
-
});
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The template-listing mapping (#10051 D6, AC-6) — a TemplatePage's
|
|
3
|
-
* frontmatter to a hub card, an action label and the detail page's
|
|
4
|
-
* generated sections. Pure; no I/O.
|
|
5
|
-
*/
|
|
6
|
-
import { PageSectionsSchema } from "@working-theory/validation";
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
templateActionLabel,
|
|
10
|
-
templateCard,
|
|
11
|
-
templateDetailSections,
|
|
12
|
-
type TemplateLabels,
|
|
13
|
-
} from "../template-listing";
|
|
14
|
-
|
|
15
|
-
const labels: TemplateLabels = {
|
|
16
|
-
getIt: "Get it",
|
|
17
|
-
startFree: "Start free",
|
|
18
|
-
viewDemo: "View demo",
|
|
19
|
-
viewTemplate: "View template",
|
|
20
|
-
included: "What's included",
|
|
21
|
-
demoBadge: "Live demo",
|
|
22
|
-
moreCategories: (count) => `+${count} more`,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const full = {
|
|
26
|
-
slug: "a",
|
|
27
|
-
frontmatter: {
|
|
28
|
-
title: "Template A",
|
|
29
|
-
description: "Description A.",
|
|
30
|
-
summary: "Summary A.",
|
|
31
|
-
thumbnail: "/img/a.png",
|
|
32
|
-
categories: ["accounting", "not-a-category", "legal"],
|
|
33
|
-
demoUrl: "https://a.salessmyth.com",
|
|
34
|
-
getItUrl: "/contact",
|
|
35
|
-
price: 0,
|
|
36
|
-
includes: [
|
|
37
|
-
{ title: "Base site", description: "Pages and structured data." },
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const bare = {
|
|
43
|
-
slug: "b",
|
|
44
|
-
frontmatter: {
|
|
45
|
-
title: "Template B",
|
|
46
|
-
description: "Description B.",
|
|
47
|
-
getItUrl: "https://buy.example.com/b",
|
|
48
|
-
includes: [
|
|
49
|
-
{ title: "Base site", description: "Pages and structured data." },
|
|
50
|
-
],
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
describe("templateCard", () => {
|
|
55
|
-
it("maps every present field", () => {
|
|
56
|
-
expect(templateCard(full, labels)).toEqual({
|
|
57
|
-
title: "Template A",
|
|
58
|
-
description: "Summary A.",
|
|
59
|
-
image: { src: "/img/a.png", alt: "Template A" },
|
|
60
|
-
eyebrow: "Accounting · Legal",
|
|
61
|
-
badge: "Live demo",
|
|
62
|
-
link: { label: "View template", href: "/templates/a" },
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it("omits image, eyebrow and badge when their fields are absent, and falls back to description", () => {
|
|
67
|
-
expect(templateCard(bare, labels)).toEqual({
|
|
68
|
-
title: "Template B",
|
|
69
|
-
description: "Description B.",
|
|
70
|
-
link: { label: "View template", href: "/templates/b" },
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it("omits the eyebrow when every category slug is unknown", () => {
|
|
75
|
-
const card = templateCard(
|
|
76
|
-
{ slug: "c", frontmatter: { ...bare.frontmatter, categories: ["nope"] } },
|
|
77
|
-
labels,
|
|
78
|
-
);
|
|
79
|
-
expect(card).not.toHaveProperty("eyebrow");
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it("shows at most three category names, then +N more", () => {
|
|
83
|
-
const card = templateCard(
|
|
84
|
-
{
|
|
85
|
-
slug: "d",
|
|
86
|
-
frontmatter: {
|
|
87
|
-
...bare.frontmatter,
|
|
88
|
-
categories: ["accounting", "legal", "consulting", "hvac", "roofing"],
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
labels,
|
|
92
|
-
);
|
|
93
|
-
expect(card.eyebrow).toBe("Accounting · Legal · Consulting · +2 more");
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
describe("templateActionLabel", () => {
|
|
98
|
-
it("is Start free only for a price of exactly 0", () => {
|
|
99
|
-
expect(templateActionLabel(0, labels)).toBe("Start free");
|
|
100
|
-
expect(templateActionLabel(undefined, labels)).toBe("Get it");
|
|
101
|
-
expect(templateActionLabel(5, labels)).toBe("Get it");
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
describe("templateDetailSections", () => {
|
|
106
|
-
it("builds a hero and a What's included section", () => {
|
|
107
|
-
const [hero, included] = templateDetailSections(full.frontmatter, labels);
|
|
108
|
-
expect(hero).toMatchObject({
|
|
109
|
-
type: "hero",
|
|
110
|
-
data: {
|
|
111
|
-
headline: "Template A",
|
|
112
|
-
subheadline: "Summary A.",
|
|
113
|
-
eyebrow: "Accounting · Legal",
|
|
114
|
-
image: { src: "/img/a.png", alt: "Template A" },
|
|
115
|
-
primaryCta: { label: "Start free", href: "/contact" },
|
|
116
|
-
secondaryCta: {
|
|
117
|
-
label: "View demo",
|
|
118
|
-
href: "https://a.salessmyth.com",
|
|
119
|
-
variant: "outline",
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
});
|
|
123
|
-
expect(included).toEqual({
|
|
124
|
-
type: "items",
|
|
125
|
-
id: "template-included",
|
|
126
|
-
data: {
|
|
127
|
-
headline: "What's included",
|
|
128
|
-
variant: "minimal",
|
|
129
|
-
items: [
|
|
130
|
-
{ title: "Base site", description: "Pages and structured data." },
|
|
131
|
-
],
|
|
132
|
-
},
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
it("omits the demo link, image and eyebrow when absent", () => {
|
|
137
|
-
const [hero] = templateDetailSections(bare.frontmatter, labels);
|
|
138
|
-
const data = (hero as { data: Record<string, unknown> }).data;
|
|
139
|
-
expect(data.primaryCta).toEqual({
|
|
140
|
-
label: "Get it",
|
|
141
|
-
href: "https://buy.example.com/b",
|
|
142
|
-
});
|
|
143
|
-
expect(data).not.toHaveProperty("secondaryCta");
|
|
144
|
-
expect(data).not.toHaveProperty("image");
|
|
145
|
-
expect(data).not.toHaveProperty("eyebrow");
|
|
146
|
-
expect(data.subheadline).toBe("Description B.");
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it.each([
|
|
150
|
-
["full", full.frontmatter],
|
|
151
|
-
["bare", bare.frontmatter],
|
|
152
|
-
])("the %s result parses PageSectionsSchema", (_label, frontmatter) => {
|
|
153
|
-
expect(
|
|
154
|
-
PageSectionsSchema.safeParse(templateDetailSections(frontmatter, labels))
|
|
155
|
-
.success,
|
|
156
|
-
).toBe(true);
|
|
157
|
-
});
|
|
158
|
-
});
|