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.
Files changed (304) hide show
  1. package/dist/add-route.js +16 -1
  2. package/dist/body-heading.d.ts +2 -1
  3. package/dist/body-heading.js +31 -3
  4. package/dist/derive-architecture.js +3 -1
  5. package/dist/module-architecture.js +0 -3
  6. package/dist/remove-module.js +27 -14
  7. package/dist/routes.d.ts +36 -2
  8. package/dist/routes.js +269 -23
  9. package/dist/site-manifest.js +6 -4
  10. package/dist/site-roster.d.ts +11 -3
  11. package/dist/site-roster.js +48 -22
  12. package/dist/surfaces.d.ts +13 -3
  13. package/dist/surfaces.js +128 -194
  14. package/dist/sync-routes.js +22 -5
  15. package/dist/template-record.js +3 -1
  16. package/dist/topology.d.ts +11 -0
  17. package/dist/topology.js +253 -3
  18. package/package.json +3 -3
  19. package/templates/apps/web/CLAUDE.md +32 -4
  20. package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +6 -1
  21. package/templates/apps/web/__tests__/__mocks__/next-intl.ts +6 -1
  22. package/templates/apps/web/__tests__/auth/seam.test.ts +34 -0
  23. package/templates/apps/web/account.config.tsx +2 -3
  24. package/templates/apps/web/app/[locale]/(authed)/account/connect/__tests__/page.test.tsx +1 -1
  25. package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +1 -1
  26. package/templates/apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx +1 -1
  27. package/templates/apps/web/app/[locale]/layout.tsx +2 -2
  28. package/templates/apps/web/auth.config.tsx +107 -0
  29. package/templates/apps/web/auth.ts +2 -1
  30. package/templates/apps/web/i18n/request.ts +13 -2
  31. package/templates/apps/web/jest.config.cjs +10 -0
  32. package/templates/apps/web/lib/__tests__/deck-page.test.ts +9 -0
  33. package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +3 -0
  34. package/templates/apps/web/lib/__tests__/in-page-magnet-self-request.test.ts +1 -1
  35. package/templates/apps/web/lib/__tests__/in-page-magnet.test.ts +2 -2
  36. package/templates/apps/web/lib/__tests__/pricing-page.test.ts +1 -1
  37. package/templates/apps/web/lib/__tests__/server-api.test.ts +1 -1
  38. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +17 -4
  39. package/templates/apps/web/lib/in-page-magnet.ts +2 -2
  40. package/templates/apps/web/lib/pricing-page.ts +3 -3
  41. package/templates/apps/web/lib/server-api.ts +1 -1
  42. package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-email.ts +1 -1
  43. package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-lines.ts +1 -1
  44. package/templates/apps/web/lib/site-header.ts +1 -1
  45. package/templates/apps/web/lib/topology.generated.ts +5 -0
  46. package/templates/apps/web/messages/en.json +0 -271
  47. package/templates/apps/web/middleware.ts +12 -25
  48. package/templates/apps/web/next.config.mjs +15 -0
  49. package/templates/apps/web/package.json +2 -0
  50. package/templates/apps/web/site-pages.config.tsx +85 -0
  51. package/templates/apps/web/types/messages.d.ts +6 -1
  52. package/templates/tools/body-heading.ts +30 -3
  53. package/versions.json +50 -48
  54. package/templates/apps/web/app/[locale]/(auth)/__tests__/auth-pages.test.tsx +0 -322
  55. package/templates/apps/web/app/[locale]/(auth)/__tests__/password-reset.test.tsx +0 -554
  56. package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/consent-actions.test.ts +0 -56
  57. package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/page.test.tsx +0 -164
  58. package/templates/apps/web/app/[locale]/(auth)/consent/consent-form.tsx +0 -132
  59. package/templates/apps/web/app/[locale]/(auth)/consent/consent.actions.ts +0 -51
  60. package/templates/apps/web/app/[locale]/(auth)/consent/page.tsx +0 -144
  61. package/templates/apps/web/app/[locale]/(auth)/forgot-password/forgot-password-card.tsx +0 -101
  62. package/templates/apps/web/app/[locale]/(auth)/forgot-password/page.tsx +0 -111
  63. package/templates/apps/web/app/[locale]/(auth)/layout.tsx +0 -81
  64. package/templates/apps/web/app/[locale]/(auth)/legal-footnote.tsx +0 -35
  65. package/templates/apps/web/app/[locale]/(auth)/reset-password/__tests__/return.test.tsx +0 -179
  66. package/templates/apps/web/app/[locale]/(auth)/reset-password/page.tsx +0 -157
  67. package/templates/apps/web/app/[locale]/(auth)/reset-password/reset-password-card.tsx +0 -126
  68. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/next-path.test.ts +0 -54
  69. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/page.test.tsx +0 -628
  70. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/remembered-method.test.ts +0 -43
  71. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/sign-in-card.test.tsx +0 -266
  72. package/templates/apps/web/app/[locale]/(auth)/sign-in/next-path.ts +0 -20
  73. package/templates/apps/web/app/[locale]/(auth)/sign-in/page.tsx +0 -234
  74. package/templates/apps/web/app/[locale]/(auth)/sign-in/remembered-method.ts +0 -37
  75. package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-card.tsx +0 -323
  76. package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-text.ts +0 -93
  77. package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/page.test.tsx +0 -301
  78. package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/sign-up-card.test.tsx +0 -309
  79. package/templates/apps/web/app/[locale]/(auth)/sign-up/page.tsx +0 -201
  80. package/templates/apps/web/app/[locale]/(auth)/sign-up/sign-up-card.tsx +0 -366
  81. package/templates/apps/web/app/[locale]/(auth)/use-auth-card-flow.ts +0 -116
  82. package/templates/apps/web/app/[locale]/(auth)/verify-email/__tests__/actions.test.ts +0 -94
  83. package/templates/apps/web/app/[locale]/(auth)/verify-email/actions.ts +0 -77
  84. package/templates/apps/web/app/[locale]/(auth)/verify-email/page.tsx +0 -154
  85. package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +0 -3
  86. package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +0 -3
  87. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +0 -3
  88. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +0 -2
  89. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +0 -3
  90. package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +0 -12
  91. package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +0 -12
  92. package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +0 -12
  93. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +0 -2
  94. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +0 -12
  95. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +0 -3
  96. package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +0 -10
  97. package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +0 -3
  98. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +0 -3
  99. package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +0 -12
  100. package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +0 -2
  101. package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +0 -3
  102. package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +0 -3
  103. package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +0 -2
  104. package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +0 -3
  105. package/templates/apps/web/app/[locale]/(authed)/leads/__tests__/page.test.tsx +0 -205
  106. package/templates/apps/web/app/[locale]/(authed)/leads/components/LeadsTable.tsx +0 -137
  107. package/templates/apps/web/app/[locale]/(authed)/leads/page.tsx +0 -122
  108. package/templates/apps/web/app/[locale]/(authed)/waitlist/components/ForbiddenState.tsx +0 -24
  109. package/templates/apps/web/app/[locale]/(authed)/waitlist/format.ts +0 -111
  110. package/templates/apps/web/app/[locale]/[slug]/[detail]/__tests__/page.test.tsx +0 -402
  111. package/templates/apps/web/app/[locale]/[slug]/[detail]/page.tsx +0 -143
  112. package/templates/apps/web/app/[locale]/[slug]/__tests__/page.test.tsx +0 -148
  113. package/templates/apps/web/app/[locale]/[slug]/page.tsx +0 -109
  114. package/templates/apps/web/app/[locale]/about/[slug]/page.tsx +0 -46
  115. package/templates/apps/web/app/[locale]/about/__tests__/about-routes.test.tsx +0 -353
  116. package/templates/apps/web/app/[locale]/about/page.tsx +0 -122
  117. package/templates/apps/web/app/[locale]/alternatives/__tests__/page.test.tsx +0 -161
  118. package/templates/apps/web/app/[locale]/alternatives/page.tsx +0 -112
  119. package/templates/apps/web/app/[locale]/careers/[slug]/[action]/page.tsx +0 -244
  120. package/templates/apps/web/app/[locale]/careers/[slug]/apply.actions.ts +0 -325
  121. package/templates/apps/web/app/[locale]/careers/[slug]/job-application-form.ts +0 -120
  122. package/templates/apps/web/app/[locale]/careers/[slug]/page.tsx +0 -73
  123. package/templates/apps/web/app/[locale]/careers/__tests__/apply.actions.test.ts +0 -497
  124. package/templates/apps/web/app/[locale]/careers/__tests__/careers-hub.test.tsx +0 -172
  125. package/templates/apps/web/app/[locale]/careers/__tests__/careers-set.test.tsx +0 -153
  126. package/templates/apps/web/app/[locale]/careers/__tests__/job-application-form.test.ts +0 -141
  127. package/templates/apps/web/app/[locale]/careers/__tests__/job-apply-page.test.tsx +0 -546
  128. package/templates/apps/web/app/[locale]/careers/__tests__/page-renderer-migration.test.tsx +0 -189
  129. package/templates/apps/web/app/[locale]/careers/page.tsx +0 -165
  130. package/templates/apps/web/app/[locale]/case-studies/[slug]/page.tsx +0 -49
  131. package/templates/apps/web/app/[locale]/case-studies/__tests__/hub-children.test.tsx +0 -65
  132. package/templates/apps/web/app/[locale]/case-studies/__tests__/page-renderer-migration.test.tsx +0 -125
  133. package/templates/apps/web/app/[locale]/case-studies/page.tsx +0 -49
  134. package/templates/apps/web/app/[locale]/clients/__tests__/page-renderer-migration.test.tsx +0 -85
  135. package/templates/apps/web/app/[locale]/clients/page.tsx +0 -47
  136. package/templates/apps/web/app/[locale]/contact/ConversationalIntakeWrapper.tsx +0 -249
  137. package/templates/apps/web/app/[locale]/contact/__tests__/ConversationalIntakeWrapper.test.tsx +0 -400
  138. package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-magnet.test.ts +0 -138
  139. package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-text.test.ts +0 -49
  140. package/templates/apps/web/app/[locale]/contact/__tests__/contact-magnet-page.test.tsx +0 -494
  141. package/templates/apps/web/app/[locale]/contact/__tests__/contact.actions.test.ts +0 -1122
  142. package/templates/apps/web/app/[locale]/contact/__tests__/intake-analytics.test.ts +0 -51
  143. package/templates/apps/web/app/[locale]/contact/__tests__/page-renderer-migration.test.tsx +0 -319
  144. package/templates/apps/web/app/[locale]/contact/contact-form-magnet.ts +0 -77
  145. package/templates/apps/web/app/[locale]/contact/contact-form-text.ts +0 -52
  146. package/templates/apps/web/app/[locale]/contact/contact.actions.ts +0 -403
  147. package/templates/apps/web/app/[locale]/contact/intake-analytics.ts +0 -49
  148. package/templates/apps/web/app/[locale]/contact/intake-script.ts +0 -92
  149. package/templates/apps/web/app/[locale]/contact/page.tsx +0 -267
  150. package/templates/apps/web/app/[locale]/courses/[slug]/page.tsx +0 -50
  151. package/templates/apps/web/app/[locale]/courses/__tests__/hub-children.test.tsx +0 -32
  152. package/templates/apps/web/app/[locale]/courses/__tests__/page-renderer-migration.test.tsx +0 -123
  153. package/templates/apps/web/app/[locale]/courses/page.tsx +0 -49
  154. package/templates/apps/web/app/[locale]/events/[slug]/page.tsx +0 -57
  155. package/templates/apps/web/app/[locale]/events/__tests__/hub-children.test.tsx +0 -32
  156. package/templates/apps/web/app/[locale]/events/__tests__/page-renderer-migration.test.tsx +0 -164
  157. package/templates/apps/web/app/[locale]/events/__tests__/program-event.test.tsx +0 -120
  158. package/templates/apps/web/app/[locale]/events/page.tsx +0 -60
  159. package/templates/apps/web/app/[locale]/faq/page.tsx +0 -54
  160. package/templates/apps/web/app/[locale]/features/[slug]/page.tsx +0 -54
  161. package/templates/apps/web/app/[locale]/features/__tests__/hub-children.test.tsx +0 -32
  162. package/templates/apps/web/app/[locale]/features/page.tsx +0 -50
  163. package/templates/apps/web/app/[locale]/for/[slug]/page.tsx +0 -54
  164. package/templates/apps/web/app/[locale]/for/__tests__/hub-children.test.tsx +0 -32
  165. package/templates/apps/web/app/[locale]/for/__tests__/page-renderer-migration.test.tsx +0 -90
  166. package/templates/apps/web/app/[locale]/for/page.tsx +0 -51
  167. package/templates/apps/web/app/[locale]/glossary/page.tsx +0 -53
  168. package/templates/apps/web/app/[locale]/how-to/[slug]/page.tsx +0 -50
  169. package/templates/apps/web/app/[locale]/how-to/__tests__/page-renderer-migration.test.tsx +0 -78
  170. package/templates/apps/web/app/[locale]/how-to/page.tsx +0 -50
  171. package/templates/apps/web/app/[locale]/integrations/[slug]/page.tsx +0 -54
  172. package/templates/apps/web/app/[locale]/integrations/__tests__/hub-children.test.tsx +0 -38
  173. package/templates/apps/web/app/[locale]/integrations/__tests__/page-renderer-migration.test.tsx +0 -141
  174. package/templates/apps/web/app/[locale]/integrations/page.tsx +0 -49
  175. package/templates/apps/web/app/[locale]/launch-service/page.tsx +0 -44
  176. package/templates/apps/web/app/[locale]/newsletter/__tests__/page.test.tsx +0 -236
  177. package/templates/apps/web/app/[locale]/newsletter/page.tsx +0 -179
  178. package/templates/apps/web/app/[locale]/page.tsx +0 -147
  179. package/templates/apps/web/app/[locale]/partners/[slug]/page.tsx +0 -45
  180. package/templates/apps/web/app/[locale]/partners/__tests__/hub-children.test.tsx +0 -32
  181. package/templates/apps/web/app/[locale]/partners/__tests__/page-renderer-migration.test.tsx +0 -125
  182. package/templates/apps/web/app/[locale]/partners/page.tsx +0 -49
  183. package/templates/apps/web/app/[locale]/portfolio/[slug]/page.tsx +0 -46
  184. package/templates/apps/web/app/[locale]/portfolio/__tests__/hub-children.test.tsx +0 -38
  185. package/templates/apps/web/app/[locale]/portfolio/page.tsx +0 -50
  186. package/templates/apps/web/app/[locale]/pricing/[slug]/__tests__/page.test.tsx +0 -324
  187. package/templates/apps/web/app/[locale]/pricing/[slug]/page.tsx +0 -87
  188. package/templates/apps/web/app/[locale]/pricing/__tests__/__snapshots__/unconnected.test.tsx.snap +0 -7
  189. package/templates/apps/web/app/[locale]/pricing/__tests__/offerings.test.tsx +0 -605
  190. package/templates/apps/web/app/[locale]/pricing/__tests__/page.test.tsx +0 -219
  191. package/templates/apps/web/app/[locale]/pricing/__tests__/pricing-pages.test.tsx +0 -215
  192. package/templates/apps/web/app/[locale]/pricing/__tests__/unconnected.test.tsx +0 -282
  193. package/templates/apps/web/app/[locale]/pricing/page.tsx +0 -120
  194. package/templates/apps/web/app/[locale]/privacy/page.tsx +0 -40
  195. package/templates/apps/web/app/[locale]/products/[slug]/page.tsx +0 -50
  196. package/templates/apps/web/app/[locale]/products/__tests__/hub-children.test.tsx +0 -32
  197. package/templates/apps/web/app/[locale]/products/__tests__/page-renderer-migration.test.tsx +0 -141
  198. package/templates/apps/web/app/[locale]/products/page.tsx +0 -49
  199. package/templates/apps/web/app/[locale]/projects/[slug]/page.tsx +0 -37
  200. package/templates/apps/web/app/[locale]/projects/__tests__/hub-children.test.tsx +0 -32
  201. package/templates/apps/web/app/[locale]/projects/__tests__/page-renderer-migration.test.tsx +0 -157
  202. package/templates/apps/web/app/[locale]/projects/page.tsx +0 -49
  203. package/templates/apps/web/app/[locale]/purchase-policy/page.tsx +0 -49
  204. package/templates/apps/web/app/[locale]/resources/[slug]/page.tsx +0 -54
  205. package/templates/apps/web/app/[locale]/resources/__tests__/hub-children.test.tsx +0 -38
  206. package/templates/apps/web/app/[locale]/resources/__tests__/page-renderer-migration.test.tsx +0 -151
  207. package/templates/apps/web/app/[locale]/resources/page.tsx +0 -49
  208. package/templates/apps/web/app/[locale]/services/[slug]/[child]/page.tsx +0 -68
  209. package/templates/apps/web/app/[locale]/services/[slug]/page.tsx +0 -88
  210. package/templates/apps/web/app/[locale]/services/__tests__/hub-children.test.tsx +0 -158
  211. package/templates/apps/web/app/[locale]/services/__tests__/page-renderer-migration.test.tsx +0 -187
  212. package/templates/apps/web/app/[locale]/services/__tests__/service-detail-sections.test.tsx +0 -224
  213. package/templates/apps/web/app/[locale]/services/__tests__/service-families.test.tsx +0 -368
  214. package/templates/apps/web/app/[locale]/services/page.tsx +0 -71
  215. package/templates/apps/web/app/[locale]/software/[slug]/page.tsx +0 -49
  216. package/templates/apps/web/app/[locale]/software/__tests__/page-renderer-migration.test.tsx +0 -81
  217. package/templates/apps/web/app/[locale]/software/page.tsx +0 -49
  218. package/templates/apps/web/app/[locale]/team/[slug]/page.tsx +0 -45
  219. package/templates/apps/web/app/[locale]/team/__tests__/hub-children.test.tsx +0 -32
  220. package/templates/apps/web/app/[locale]/team/__tests__/team-routes.test.tsx +0 -161
  221. package/templates/apps/web/app/[locale]/team/page.tsx +0 -50
  222. package/templates/apps/web/app/[locale]/tech-articles/[slug]/page.tsx +0 -54
  223. package/templates/apps/web/app/[locale]/tech-articles/__tests__/page-renderer-migration.test.tsx +0 -82
  224. package/templates/apps/web/app/[locale]/tech-articles/page.tsx +0 -49
  225. package/templates/apps/web/app/[locale]/templates/[slug]/__tests__/page.test.tsx +0 -203
  226. package/templates/apps/web/app/[locale]/templates/[slug]/page.tsx +0 -81
  227. package/templates/apps/web/app/[locale]/templates/__tests__/page.test.tsx +0 -237
  228. package/templates/apps/web/app/[locale]/templates/page.tsx +0 -114
  229. package/templates/apps/web/app/[locale]/terms/page.tsx +0 -40
  230. package/templates/apps/web/app/[locale]/testimonials/__tests__/page-renderer-migration.test.tsx +0 -85
  231. package/templates/apps/web/app/[locale]/testimonials/page.tsx +0 -51
  232. package/templates/apps/web/app/[locale]/thanks/[slug]/__tests__/page.test.tsx +0 -136
  233. package/templates/apps/web/app/[locale]/thanks/[slug]/page.tsx +0 -39
  234. package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe-rsc-boundary.test.tsx +0 -226
  235. package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe.test.tsx +0 -217
  236. package/templates/apps/web/app/[locale]/unsubscribe/page.tsx +0 -106
  237. package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe-button.tsx +0 -94
  238. package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe.actions.ts +0 -55
  239. package/templates/apps/web/app/[locale]/vs/[slug]/__tests__/page.test.tsx +0 -100
  240. package/templates/apps/web/app/[locale]/vs/[slug]/page.tsx +0 -60
  241. package/templates/apps/web/app/[locale]/whitepapers/[slug]/page.tsx +0 -54
  242. package/templates/apps/web/app/[locale]/whitepapers/__tests__/page-renderer-migration.test.tsx +0 -82
  243. package/templates/apps/web/app/[locale]/whitepapers/page.tsx +0 -49
  244. package/templates/apps/web/app/[locale]/working-agreement/__tests__/page.test.tsx +0 -63
  245. package/templates/apps/web/app/[locale]/working-agreement/page.tsx +0 -41
  246. package/templates/apps/web/app/api/auth/[...all]/route.ts +0 -16
  247. package/templates/apps/web/app/api/auth/hub/__tests__/continuation.test.ts +0 -143
  248. package/templates/apps/web/app/api/auth/hub/__tests__/entry-routes.test.ts +0 -749
  249. package/templates/apps/web/app/api/auth/hub/authorize/__tests__/route.test.ts +0 -964
  250. package/templates/apps/web/app/api/auth/hub/authorize/route.ts +0 -390
  251. package/templates/apps/web/app/api/auth/hub/continuation.ts +0 -127
  252. package/templates/apps/web/app/api/auth/hub/continue/[ref]/__tests__/route.test.ts +0 -188
  253. package/templates/apps/web/app/api/auth/hub/continue/[ref]/route.ts +0 -53
  254. package/templates/apps/web/app/api/auth/hub/email/route.ts +0 -111
  255. package/templates/apps/web/app/api/auth/hub/entry-shared.ts +0 -163
  256. package/templates/apps/web/app/api/auth/hub/password/__tests__/return.test.ts +0 -86
  257. package/templates/apps/web/app/api/auth/hub/password/__tests__/route.test.ts +0 -368
  258. package/templates/apps/web/app/api/auth/hub/password/return.ts +0 -86
  259. package/templates/apps/web/app/api/auth/hub/password/route.ts +0 -171
  260. package/templates/apps/web/app/api/auth/hub/purchase/route.ts +0 -230
  261. package/templates/apps/web/app/api/auth/hub/purchase-link/route.ts +0 -174
  262. package/templates/apps/web/app/api/auth/hub/sign-up/route.ts +0 -60
  263. package/templates/apps/web/app/api/auth/hub/sign-up-evidence.ts +0 -97
  264. package/templates/apps/web/app/api/auth/mcp/__tests__/continuation.test.ts +0 -92
  265. package/templates/apps/web/app/api/auth/mcp/continuation.ts +0 -89
  266. package/templates/apps/web/app/api/auth/mcp/continue/[ref]/__tests__/route.test.ts +0 -59
  267. package/templates/apps/web/app/api/auth/mcp/continue/[ref]/route.ts +0 -41
  268. package/templates/apps/web/app/api/hub-session/__tests__/routes.test.ts +0 -1166
  269. package/templates/apps/web/app/api/hub-session/callback/route.ts +0 -134
  270. package/templates/apps/web/app/api/hub-session/email/route.ts +0 -125
  271. package/templates/apps/web/app/api/hub-session/one-tap/nonce/route.ts +0 -49
  272. package/templates/apps/web/app/api/hub-session/one-tap/route.ts +0 -106
  273. package/templates/apps/web/app/api/hub-session/open/route.ts +0 -111
  274. package/templates/apps/web/app/api/hub-session/password/return/route.ts +0 -69
  275. package/templates/apps/web/app/api/hub-session/password/route.ts +0 -106
  276. package/templates/apps/web/app/api/hub-session/sign-in/route.ts +0 -91
  277. package/templates/apps/web/app/api/hub-session/sign-out/route.ts +0 -54
  278. package/templates/apps/web/components/sign-out-trigger.tsx +0 -62
  279. package/templates/apps/web/lib/__tests__/auth-routes.test.ts +0 -140
  280. package/templates/apps/web/lib/__tests__/hub-children.fixtures.ts +0 -279
  281. package/templates/apps/web/lib/__tests__/route-family.test.ts +0 -57
  282. package/templates/apps/web/lib/__tests__/service-listing.test.ts +0 -111
  283. package/templates/apps/web/lib/__tests__/template-listing.test.ts +0 -158
  284. package/templates/apps/web/lib/auth-routes.ts +0 -125
  285. package/templates/apps/web/lib/hub-children.tsx +0 -351
  286. package/templates/apps/web/lib/hub-session/__tests__/hub-session.test.ts +0 -433
  287. package/templates/apps/web/lib/hub-session/__tests__/spoke-sign-in.test.tsx +0 -332
  288. package/templates/apps/web/lib/hub-session/config.ts +0 -110
  289. package/templates/apps/web/lib/hub-session/entry.ts +0 -238
  290. package/templates/apps/web/lib/hub-session/index.ts +0 -21
  291. package/templates/apps/web/lib/hub-session/one-tap.tsx +0 -148
  292. package/templates/apps/web/lib/hub-session/reseal.ts +0 -90
  293. package/templates/apps/web/lib/hub-session/seal.ts +0 -86
  294. package/templates/apps/web/lib/hub-session/session.ts +0 -298
  295. package/templates/apps/web/lib/hub-session/spoke-sign-in.tsx +0 -277
  296. package/templates/apps/web/lib/meet-placeholder.ts +0 -5
  297. package/templates/apps/web/lib/next-path.ts +0 -35
  298. package/templates/apps/web/lib/posting-title.ts +0 -39
  299. package/templates/apps/web/lib/route-family.ts +0 -69
  300. package/templates/apps/web/lib/service-listing.ts +0 -89
  301. package/templates/apps/web/lib/template-listing.ts +0 -169
  302. package/templates/apps/web/src/lib/__tests__/lead-write.test.ts +0 -187
  303. package/templates/apps/web/src/lib/lead-write.ts +0 -90
  304. /package/templates/apps/web/{app/[locale]/contact → lib}/__tests__/site-contact-lines.test.ts +0 -0
@@ -1,402 +0,0 @@
1
- /**
2
- * Tests for the `[slug]/[detail]` route — the Free `/meet/<slug>` placeholder
3
- * detail pages (#6897 D2).
4
- *
5
- * - `slug !== "meet"` → notFound() immediately, never reaching getMdxSource.
6
- * - `slug === "meet"` and a BookCall source exists at `detail` → renders
7
- * through renderPage sections mode, no notFound() call.
8
- * - `slug === "meet"` and no BookCall source exists at `detail` → renderPage's
9
- * own detail-route branch (no translationsNamespace passed) calls
10
- * notFound().
11
- */
12
- import React from "react";
13
- import { render } from "@testing-library/react";
14
-
15
- jest.mock("next/navigation", () => ({
16
- __esModule: true,
17
- notFound: jest.fn(() => {
18
- throw new Error("NEXT_NOT_FOUND");
19
- }),
20
- }));
21
-
22
- // #7521 — the paid sections reach the listing extension through the generated
23
- // paid-sections registry, which a keyless scaffold renders as a stub answering
24
- // null. This suite supplies stand-ins through the registry itself, so it
25
- // passes in the monorepo and in every scaffold alike; the real sections are
26
- // `listing-directory.test.tsx`'s (ui-signal-collectors).
27
- // eslint-disable-next-line no-restricted-syntax -- the generated registry is the paid-package boundary; a scaffold renders it with or without the package
28
- jest.mock("../../../../../lib/paid-sections.generated", () => {
29
- const { createElement, Fragment } = jest.requireActual<typeof import("react")>("react");
30
- type Entry = { name: string; profile: Array<{ name: string; label: string; value: string }> };
31
- return {
32
- loadUiCommerce: async () => null,
33
- loadUiSignalCollectors: async () => ({
34
- ListingShelves: () => createElement("div", { "data-testid": "listing-shelves" }),
35
- ListingDetail: ({ entry }: { entry: Entry }) =>
36
- createElement(
37
- Fragment,
38
- null,
39
- createElement("h1", null, entry.name),
40
- createElement(
41
- "dl",
42
- null,
43
- ...entry.profile.flatMap((row) => [
44
- createElement("dt", { key: `${row.name}-dt` }, row.label),
45
- createElement("dd", { key: `${row.name}-dd` }, row.value),
46
- ]),
47
- ),
48
- ),
49
- }),
50
- };
51
- });
52
-
53
- // #10552 — an MDX body's `## ` lines render through the page's own component
54
- // map, so a heading's `id` is the real heading adapter's (AC-4).
55
- jest.mock("next-mdx-remote/rsc", () => {
56
- const { createElement, Fragment } = jest.requireActual<typeof import("react")>("react");
57
- return {
58
- MDXRemote: ({
59
- source,
60
- components,
61
- }: {
62
- source: string;
63
- components: Record<string, React.ComponentType<{ children?: React.ReactNode }>>;
64
- }) =>
65
- createElement(
66
- Fragment,
67
- null,
68
- ...source
69
- .split("\n")
70
- .filter((line) => line.trim() !== "")
71
- .map((line, i) =>
72
- line.startsWith("## ")
73
- ? createElement(components["h2"]!, { key: i }, line.slice(3))
74
- : createElement("p", { key: i }, line),
75
- ),
76
- ),
77
- };
78
- });
79
-
80
- jest.mock("@working-theory/ui", () => ({
81
- // #7789: renderPage's fallback page head renders inside the section Container.
82
- Container: ({ children }: { children?: React.ReactNode }) =>
83
- React.createElement("div", null, children),
84
- // #7521 — the rest of the real barrel, so the listing extension finds
85
- // `localeHref`; the two below still override.
86
- ...jest.requireActual("@working-theory/ui"),
87
- Heading: ({
88
- children,
89
- level,
90
- id,
91
- }: {
92
- children: React.ReactNode;
93
- level: number;
94
- id?: string;
95
- }): React.ReactElement => React.createElement(`h${level}`, id ? { id } : null, children),
96
- SectionRenderer: ({ sections }: { sections: unknown[] }) =>
97
- React.createElement("div", {
98
- "data-testid": "section-renderer",
99
- "data-section-count": String(sections.length),
100
- }),
101
- }));
102
-
103
- import { notFound } from "next/navigation";
104
-
105
- import { listingExtension } from "../../../../../lib/listings";
106
- import DetailPage, { generateMetadata } from "../page";
107
-
108
- // #10704 — a fixture suite: its content is shaped for the mdx source, whatever the site serves from.
109
- process.env.CONTENT_ADAPTER = "mdx";
110
-
111
- const mockNotFound = notFound as jest.MockedFunction<typeof notFound>;
112
-
113
- function makeSource(slug: string) {
114
- return {
115
- frontmatter: {
116
- type: "BookCall" as const,
117
- slug,
118
- title: `Title for ${slug}`,
119
- description: `Description for ${slug}`,
120
- sections: [
121
- {
122
- id: "hero",
123
- type: "hero" as const,
124
- data: { headline: `Title for ${slug}` },
125
- },
126
- ],
127
- },
128
- body: "",
129
- };
130
- }
131
-
132
- describe("[slug]/[detail] — the Free /meet/<slug> placeholder route (#6897 D2)", () => {
133
- beforeEach(() => {
134
- mockNotFound.mockClear();
135
- });
136
-
137
- it("renders a BookCall seed at meet/<detail> through renderPage sections mode", async () => {
138
- const getMdxSource = jest.fn().mockResolvedValue(makeSource("book-a-call"));
139
-
140
- const element = await DetailPage({
141
- params: Promise.resolve({ locale: "en", slug: "meet", detail: "book-a-call" }),
142
- getMdxSource,
143
- });
144
- const { container } = render(element);
145
-
146
- expect(getMdxSource).toHaveBeenCalledWith("BookCall", "book-a-call", "en");
147
- expect(
148
- container.querySelector("[data-testid='section-renderer']"),
149
- ).not.toBeNull();
150
- expect(
151
- container.querySelector("script[type='application/ld+json']"),
152
- ).not.toBeNull();
153
- expect(mockNotFound).not.toHaveBeenCalled();
154
- });
155
-
156
- it("404s for another hub — no BookCall source is ever read", async () => {
157
- const getMdxSource = jest.fn().mockResolvedValue(makeSource("book-a-call"));
158
-
159
- await expect(
160
- DetailPage({
161
- params: Promise.resolve({ locale: "en", slug: "not-meet", detail: "book-a-call" }),
162
- getMdxSource,
163
- }),
164
- ).rejects.toThrow("NEXT_NOT_FOUND");
165
- expect(mockNotFound).toHaveBeenCalledTimes(1);
166
- // #10552 — the program-event branch reads the Event source first; the
167
- // meet branch's BookCall read never runs for another hub.
168
- expect(getMdxSource).not.toHaveBeenCalledWith("BookCall", expect.anything(), expect.anything());
169
- });
170
-
171
- it("404s for an unknown detail slug under the meet hub", async () => {
172
- const getMdxSource = jest.fn().mockResolvedValue(null);
173
-
174
- await expect(
175
- DetailPage({
176
- params: Promise.resolve({ locale: "en", slug: "meet", detail: "not-a-page" }),
177
- getMdxSource,
178
- }),
179
- ).rejects.toThrow("NEXT_NOT_FOUND");
180
- expect(mockNotFound).toHaveBeenCalledTimes(1);
181
- });
182
- });
183
-
184
- // ── #7521 — a non-meet hub serves a listicle's accepted entry ──────────────
185
- //
186
- // Through the REAL listing extension: the key is set, the API read is a
187
- // fetch stub, and the paid sections are the registry stand-ins mocked above.
188
- describe("[slug]/[detail] — a listicle entry at /<landingPage>/<slug> (#7521)", () => {
189
- const priorKey = process.env["AILK_LISTING_PUBLIC_KEY"];
190
- const priorLocales = process.env["NEXT_PUBLIC_ENABLED_LOCALES"];
191
- const priorFetch = global.fetch;
192
-
193
- beforeEach(() => {
194
- mockNotFound.mockClear();
195
- process.env["AILK_LISTING_PUBLIC_KEY"] = "pk-detail-test";
196
- process.env["NEXT_PUBLIC_ENABLED_LOCALES"] = "en";
197
- global.fetch = jest.fn(async () => ({
198
- ok: true,
199
- status: 200,
200
- json: async () => ({
201
- ok: true,
202
- data: {
203
- landingPage: "/tools",
204
- entryType: "Organization",
205
- entries: [
206
- {
207
- id: "prjl_acme",
208
- slug: "acme",
209
- name: "Acme Tools",
210
- summary: "Tools for teams.",
211
- url: null,
212
- logoMarkUrl: null,
213
- featured: false,
214
- status: "active",
215
- windowEndsAt: null,
216
- decidedAt: null,
217
- waitlistCount: 0,
218
- profile: [{ name: "stage", label: "Stage", value: "Live", kind: "select" }],
219
- },
220
- ],
221
- },
222
- }),
223
- })) as jest.Mock;
224
- });
225
-
226
- afterEach(() => {
227
- if (priorKey === undefined) delete process.env["AILK_LISTING_PUBLIC_KEY"];
228
- else process.env["AILK_LISTING_PUBLIC_KEY"] = priorKey;
229
- if (priorLocales === undefined) delete process.env["NEXT_PUBLIC_ENABLED_LOCALES"];
230
- else process.env["NEXT_PUBLIC_ENABLED_LOCALES"] = priorLocales;
231
- global.fetch = priorFetch;
232
- });
233
-
234
- it("renders the accepted entry with its profile and entry-type JSON-LD", async () => {
235
- // `/tools` is a LandingPage, so the hub guard lets the directory read run.
236
- const getMdxSource = jest
237
- .fn()
238
- .mockImplementation(async (type: string) =>
239
- type === "LandingPage" ? makeSource("tools") : null,
240
- );
241
-
242
- const element = await DetailPage({
243
- params: Promise.resolve({ locale: "en", slug: "tools", detail: "acme" }),
244
- getMdxSource,
245
- });
246
- const { container } = render(element);
247
-
248
- expect(container.querySelector("h1")?.textContent).toBe("Acme Tools");
249
- expect(container.querySelector("dt")?.textContent).toBe("Stage");
250
- expect(container.querySelector("dd")?.textContent).toBe("Live");
251
- const ld = JSON.parse(
252
- container.querySelector("script[type='application/ld+json']")?.textContent ?? "{}",
253
- ) as Record<string, unknown>;
254
- expect(ld["@type"]).toBe("Organization");
255
- expect(String((global.fetch as jest.Mock).mock.calls[0][0])).toContain(
256
- "/v1/project-listings/directory?siteKey=pk-detail-test&landingPage=%2Ftools&locale=en",
257
- );
258
- expect(mockNotFound).not.toHaveBeenCalled();
259
- expect(getMdxSource).toHaveBeenCalledWith("LandingPage", "tools", "en");
260
- expect(getMdxSource).not.toHaveBeenCalledWith("BookCall", expect.anything(), expect.anything());
261
- });
262
-
263
- it("404s for an entry the directory does not hold", async () => {
264
- await expect(
265
- DetailPage({
266
- params: Promise.resolve({ locale: "en", slug: "tools", detail: "nope" }),
267
- getMdxSource: jest.fn().mockResolvedValue(makeSource("tools")),
268
- }),
269
- ).rejects.toThrow("NEXT_NOT_FOUND");
270
- });
271
-
272
- it("404s with no directory read when the hub is not a page (SEC-7521-D1)", async () => {
273
- const getMdxSource = jest.fn(async () => null);
274
-
275
- await expect(
276
- DetailPage({
277
- params: Promise.resolve({ locale: "en", slug: "made-up-hub", detail: "acme" }),
278
- getMdxSource,
279
- }),
280
- ).rejects.toThrow("NEXT_NOT_FOUND");
281
- expect(getMdxSource).toHaveBeenCalledWith("LandingPage", "made-up-hub", "en");
282
- expect(getMdxSource).toHaveBeenCalledWith("BlogList", "made-up-hub", "en");
283
- expect(global.fetch).not.toHaveBeenCalled();
284
- });
285
- });
286
-
287
- // ── #10552 — an Event under a program at /<program>/<event> ─────────────────
288
- describe("[slug]/[detail] — an Event under a program at /<program>/<event> (#10552)", () => {
289
- const landing = (slug: string, title: string) => ({
290
- frontmatter: { type: "LandingPage" as const, slug, title, description: `${title}.` },
291
- body: "",
292
- });
293
- const golf = (frontmatter: Record<string, unknown> = { parent: "younglife" }) => ({
294
- frontmatter: {
295
- type: "Event" as const,
296
- slug: "golf-tournament",
297
- title: "Golf Tournament 2026",
298
- description: "Our annual golf tournament.",
299
- publishedAt: "2026-06-12",
300
- ...frontmatter,
301
- },
302
- body: "Tee off with us.\n\n## Sponsorship\n\nBecome a hole sponsor.",
303
- });
304
- const loader = (
305
- pages: Record<string, ReturnType<typeof landing> | ReturnType<typeof golf>>,
306
- ) => jest.fn(async (type: string, slug: string) => pages[`${type}/${slug}`] ?? null);
307
- const params = (slug: string, detail = "golf-tournament") =>
308
- Promise.resolve({ locale: "en", slug, detail });
309
-
310
- let entryAt: jest.SpyInstance;
311
- beforeEach(() => {
312
- mockNotFound.mockClear();
313
- entryAt = jest.spyOn(listingExtension, "entryAt");
314
- });
315
- afterEach(() => entryAt.mockRestore());
316
-
317
- it("renders the Event with its Event JSON-LD and the program breadcrumb (AC-3)", async () => {
318
- const getMdxSource = loader({
319
- "LandingPage/younglife": landing("younglife", "Young Life"),
320
- "Event/golf-tournament": golf(),
321
- });
322
-
323
- const { container } = render(await DetailPage({ params: params("younglife"), getMdxSource }));
324
-
325
- expect(mockNotFound).not.toHaveBeenCalled();
326
- const ld = JSON.parse(
327
- container.querySelector("script[type='application/ld+json']")?.textContent ?? "{}",
328
- ) as Record<string, unknown>;
329
- const nodes = (ld["@graph"] ?? [ld]) as Array<Record<string, unknown>>;
330
- const event = nodes
331
- .map((node) => node["mainEntity"] as Record<string, unknown> | undefined)
332
- .find((entity) => entity?.["@type"] === "Event");
333
- expect(event).toMatchObject({ name: "Golf Tournament 2026", startDate: "2026-06-12" });
334
- const crumbs = nodes.find((node) => node["@type"] === "BreadcrumbList")?.[
335
- "itemListElement"
336
- ] as Array<Record<string, unknown>>;
337
- expect(crumbs[1]).toMatchObject({ name: "Young Life" });
338
- expect(crumbs[2]?.["item"]).toMatch(/\/younglife\/golf-tournament$/);
339
- expect(entryAt).not.toHaveBeenCalled();
340
-
341
- const metadata = await generateMetadata({ params: params("younglife"), getMdxSource });
342
- expect(metadata.title).toBe("Golf Tournament 2026");
343
- });
344
-
345
- it("offers add-to-calendar for Google, Outlook and Apple (.ics) at the program URL", async () => {
346
- const getMdxSource = loader({
347
- "LandingPage/younglife": landing("younglife", "Young Life"),
348
- "Event/golf-tournament": golf(),
349
- });
350
-
351
- const { container } = render(await DetailPage({ params: params("younglife"), getMdxSource }));
352
-
353
- const href = (id: string) =>
354
- container.querySelector(`[data-testid='add-to-calendar-${id}']`)?.getAttribute("href") ?? "";
355
- expect(href("google")).toMatch(/^https:\/\/calendar\.google\.com\//);
356
- expect(href("outlook")).toMatch(/^https:\/\/outlook\./);
357
- expect(href("apple")).toMatch(/^data:text\/calendar/);
358
- expect(decodeURIComponent(href("apple"))).toContain("/younglife/golf-tournament");
359
- });
360
-
361
- it("supports a #sponsorship anchor from the body heading (AC-4)", async () => {
362
- const getMdxSource = loader({
363
- "LandingPage/younglife": landing("younglife", "Young Life"),
364
- "Event/golf-tournament": golf(),
365
- });
366
-
367
- const { container } = render(await DetailPage({ params: params("younglife"), getMdxSource }));
368
-
369
- const anchors = container.querySelectorAll("#sponsorship");
370
- expect(anchors).toHaveLength(1);
371
- expect(anchors[0]?.tagName).toBe("H2");
372
- expect(anchors[0]?.textContent).toBe("Sponsorship");
373
- });
374
-
375
- it("serves it only under the program it names (AC-5)", async () => {
376
- const cases: Array<[string, ReturnType<typeof loader>]> = [
377
- [
378
- "other",
379
- loader({
380
- "LandingPage/other": landing("other", "Other"),
381
- "LandingPage/younglife": landing("younglife", "Young Life"),
382
- "Event/golf-tournament": golf(),
383
- }),
384
- ],
385
- ["younglife", loader({ "Event/golf-tournament": golf() })],
386
- [
387
- "younglife",
388
- loader({
389
- "LandingPage/younglife": landing("younglife", "Young Life"),
390
- "Event/golf-tournament": golf({}),
391
- }),
392
- ],
393
- ];
394
- for (const [slug, getMdxSource] of cases) {
395
- mockNotFound.mockClear();
396
- await expect(DetailPage({ params: params(slug), getMdxSource })).rejects.toThrow(
397
- "NEXT_NOT_FOUND",
398
- );
399
- expect(mockNotFound).toHaveBeenCalledTimes(1);
400
- }
401
- });
402
- });
@@ -1,143 +0,0 @@
1
- // Two-segment URLs: the Free /meet/<slug> placeholder detail pages (#6897
2
- // D2), an Event under a program (#10552), and a listicle directory's entry
3
- // pages (#7521).
4
- //
5
- // The meet hub: BookCall content served at /meet/<detail> by Next.js
6
- // static-segment precedence: wherever apps/web/app/[locale]/meet/ exists (the
7
- // scheduling module), that directory resolves every /meet/* URL first and this
8
- // route never runs. On a keyless scaffold, this route serves the four Free
9
- // placeholder detail pages. Unknown detail slug → notFound() (renderPage's own
10
- // detail-route branch: no translationsNamespace is passed, so a null source
11
- // 404s rather than rendering an empty-state placeholder — the same contract
12
- // `[slug]/page.tsx` documents).
13
- //
14
- // A program's event: `/<program>/<event>` serves the Event MDX `<event>` when
15
- // its frontmatter `parent` is `<program>` and `/<program>` is a LandingPage —
16
- // before the listing extension, so an event URL costs no listing read. Any
17
- // other combination falls through. A `parent` that names a static top-level
18
- // route directory (`events`, `services`, …) or `meet` is unreachable here:
19
- // Next.js serves the static directory first (spec 10552 § 5.3).
20
- //
21
- // Every other hub: `/<landingPage>/<entry>` for a listicle whose landing page
22
- // is a generic one-segment page (`/tools` → `[slug]/page.tsx`). The listing
23
- // extension (`lib/listings.tsx`) renders the accepted entry, or the route
24
- // 404s — with no key or no paid package it makes no read at all. The first
25
- // segment is the visitor's to choose, so the extension reads the directory
26
- // only once `/<slug>` is proved a page the `[slug]` route serves (a
27
- // LandingPage or BlogList source); a made-up hub costs no API read
28
- // (SEC-7521-D1). No MDX is read at `/<slug>/<detail>`, so no generic
29
- // two-segment content route exists: BookCall's slug pattern forbids "/", and
30
- // a generic join would also be reachable at a one-segment URL through the
31
- // `[slug]` route — a duplicate-content defect.
32
- //
33
- // Deliberately NO generateStaticParams, for the same reason as `[slug]/page.tsx`:
34
- // the locale layout reads cookies()/headers(), so this segment always renders
35
- // on request.
36
- import type { getMdxSource as defaultGetMdxSource } from "@working-theory/page-renderer";
37
- import {
38
- getMdxSource as loadMdxSource,
39
- renderPage,
40
- renderPageMetadata,
41
- } from "@working-theory/page-renderer";
42
- import type { Metadata } from "next";
43
- import { notFound } from "next/navigation";
44
- import type { ReactElement } from "react";
45
-
46
- import { listingExtension, type HubExists } from "../../../../lib/listings";
47
- import { MEET_PLACEHOLDER_HUB } from "../../../../lib/meet-placeholder";
48
-
49
- /** Whether `/<slug>` is a page the one-segment `[slug]` route would serve. */
50
- function hubPage(
51
- slug: string,
52
- locale: string,
53
- getMdxSource: typeof defaultGetMdxSource = loadMdxSource,
54
- ): HubExists {
55
- return async () =>
56
- (await getMdxSource("LandingPage", slug, locale)) !== null ||
57
- (await getMdxSource("BlogList", slug, locale)) !== null;
58
- }
59
-
60
- /** The Event `detail` when it names `slug` as its program and `/<slug>` is a LandingPage. */
61
- async function programEvent(
62
- slug: string,
63
- detail: string,
64
- locale: string,
65
- getMdxSource: typeof defaultGetMdxSource = loadMdxSource,
66
- ): Promise<Awaited<ReturnType<typeof defaultGetMdxSource>>> {
67
- const source = await getMdxSource("Event", detail, locale);
68
- if (source === null || source.frontmatter.parent !== slug) return null;
69
- return (await getMdxSource("LandingPage", slug, locale)) === null ? null : source;
70
- }
71
-
72
- interface Props {
73
- params: Promise<{ locale: string; slug: string; detail: string }>;
74
- /** Test-only DI override for getMdxSource. Production callers leave undefined. */
75
- getMdxSource?: typeof defaultGetMdxSource;
76
- }
77
-
78
- export async function generateMetadata({
79
- params,
80
- getMdxSource,
81
- }: Pick<Props, "params" | "getMdxSource">): Promise<Metadata> {
82
- const { locale, slug, detail } = await params;
83
- // Mirrors renderPageMetadata's own missing-frontmatter → {} contract: a
84
- // hub with no listing entry is the same "nothing to title" case, not a
85
- // thrown 404 — generateMetadata cannot itself change the response status.
86
- if (slug !== MEET_PLACEHOLDER_HUB) {
87
- if ((await programEvent(slug, detail, locale, getMdxSource)) !== null) {
88
- return renderPageMetadata({
89
- type: "Event",
90
- slug: detail,
91
- locale,
92
- ...(getMdxSource !== undefined && { getMdxSource }),
93
- });
94
- }
95
- return (
96
- (await listingExtension.entryMetadataAt(
97
- `/${slug}/${detail}`,
98
- detail,
99
- locale,
100
- hubPage(slug, locale),
101
- )) ?? {}
102
- );
103
- }
104
- return renderPageMetadata({ type: "BookCall", slug: detail, locale });
105
- }
106
-
107
- export default async function Page({
108
- params,
109
- getMdxSource,
110
- }: Props): Promise<ReactElement> {
111
- const { locale, slug, detail } = await params;
112
- if (slug !== MEET_PLACEHOLDER_HUB) {
113
- const event = await programEvent(slug, detail, locale, getMdxSource);
114
- if (event !== null) {
115
- // A composed Event renders its sections; a prose one its MDX body — the
116
- // rule events/[slug]/page.tsx applies.
117
- const sections = (event.frontmatter as { sections?: unknown[] }).sections;
118
- const composed = Array.isArray(sections) && sections.length > 0;
119
- return renderPage({
120
- type: "Event",
121
- slug: detail,
122
- locale,
123
- ...(composed ? {} : { bodyMode: "mdx-body" as const }),
124
- ...(getMdxSource !== undefined && { getMdxSource }),
125
- });
126
- }
127
- const entry = await listingExtension.entryAt(
128
- `/${slug}/${detail}`,
129
- detail,
130
- locale,
131
- hubPage(slug, locale, getMdxSource),
132
- );
133
- if (entry === null) notFound();
134
- return entry;
135
- }
136
- return renderPage({
137
- type: "BookCall",
138
- slug: detail,
139
- locale,
140
- populatedDescriptionTestId: `${detail}-description`,
141
- ...(getMdxSource !== undefined && { getMdxSource }),
142
- });
143
- }
@@ -1,148 +0,0 @@
1
- /**
2
- * Tests for the generic `[slug]` content route (#5469 D2).
3
- *
4
- * - Populated: getMdxSource returns a LandingPage source → renderPage
5
- * sections mode composes the page (JSON-LD + SectionRenderer), no
6
- * notFound() call, and the frontmatter `schema` override reaches the
7
- * emitted JSON-LD (the escape hatch, proven with a `HowTo` fixture).
8
- * - Unknown slug: getMdxSource returns null → renderPage's own detail-route
9
- * branch (no translationsNamespace passed) calls notFound().
10
- * - Resolution: the route asks the adapter for `LandingPage` first and, only
11
- * when that is null, `BlogList` (the Free /blog teaser — the one list type
12
- * that cannot own a route directory, since the docs-blog module owns
13
- * `blog/`). A BlogList source renders through renderPage with its own type,
14
- * so the JSON-LD is the BlogList builder's `Blog`.
15
- */
16
- import React from "react";
17
- import { render } from "@testing-library/react";
18
-
19
- jest.mock("next/navigation", () => ({
20
- __esModule: true,
21
- notFound: jest.fn(() => {
22
- throw new Error("NEXT_NOT_FOUND");
23
- }),
24
- }));
25
-
26
- jest.mock("@working-theory/ui", () => ({
27
- // #7789: renderPage's fallback page head renders inside the section Container.
28
- Container: ({ children }: { children?: React.ReactNode }) =>
29
- React.createElement("div", null, children),
30
- Heading: ({
31
- children,
32
- level,
33
- }: {
34
- children: React.ReactNode;
35
- level: number;
36
- }): React.ReactElement =>
37
- React.createElement(`h${level}`, null, children),
38
- SectionRenderer: ({ sections }: { sections: unknown[] }) =>
39
- React.createElement("div", {
40
- "data-testid": "section-renderer",
41
- "data-section-count": String(sections.length),
42
- }),
43
- }));
44
-
45
- import { notFound } from "next/navigation";
46
- import SlugPage from "../page";
47
-
48
- // #10704 — a fixture suite: its content is shaped for the mdx source, whatever the site serves from.
49
- process.env.CONTENT_ADAPTER = "mdx";
50
-
51
- const mockNotFound = notFound as jest.MockedFunction<typeof notFound>;
52
-
53
- function makeSource(slug: string, schema?: Record<string, unknown>) {
54
- return {
55
- frontmatter: {
56
- type: "LandingPage" as const,
57
- slug,
58
- title: `Title for ${slug}`,
59
- description: `Description for ${slug}`,
60
- ...(schema !== undefined && { schema }),
61
- sections: [
62
- {
63
- id: "hero",
64
- type: "hero" as const,
65
- data: { headline: `Title for ${slug}` },
66
- },
67
- ],
68
- },
69
- body: "",
70
- };
71
- }
72
-
73
- describe("[slug] — the generic content route (LandingPage, then BlogList)", () => {
74
- beforeEach(() => {
75
- mockNotFound.mockClear();
76
- });
77
-
78
- it("resolves the slug against LandingPage and renders through renderPage sections mode", async () => {
79
- const getMdxSource = jest.fn().mockResolvedValue(makeSource("how-it-works"));
80
-
81
- const element = await SlugPage({
82
- params: Promise.resolve({ locale: "en", slug: "how-it-works" }),
83
- getMdxSource,
84
- });
85
- const { container } = render(element);
86
-
87
- expect(getMdxSource).toHaveBeenCalledWith("LandingPage", "how-it-works", "en");
88
- expect(container.querySelector("[data-testid='section-renderer']")).not.toBeNull();
89
- expect(container.querySelector("script[type='application/ld+json']")).not.toBeNull();
90
- expect(mockNotFound).not.toHaveBeenCalled();
91
- });
92
-
93
- it("emits the frontmatter `schema` override in the JSON-LD (the HowTo escape hatch)", async () => {
94
- const getMdxSource = jest
95
- .fn()
96
- .mockResolvedValue(makeSource("how-it-works", { "@type": "HowTo" }));
97
-
98
- const element = await SlugPage({
99
- params: Promise.resolve({ locale: "en", slug: "how-it-works" }),
100
- getMdxSource,
101
- });
102
- const { container } = render(element);
103
-
104
- const script = container.querySelector("script[type='application/ld+json']");
105
- expect(script).not.toBeNull();
106
- expect(script?.textContent ?? "").toContain('"HowTo"');
107
- });
108
-
109
- it("falls back to BlogList when no LandingPage source exists (the Free /blog teaser)", async () => {
110
- const blog = {
111
- frontmatter: {
112
- type: "BlogList" as const,
113
- slug: "blog",
114
- title: "Blog",
115
- description: "This template does not include a blog.",
116
- sections: [{ id: "hero", type: "hero" as const, data: { headline: "Blog" } }],
117
- },
118
- body: "",
119
- };
120
- const getMdxSource = jest
121
- .fn()
122
- .mockImplementation(async (type: string) => (type === "BlogList" ? blog : null));
123
-
124
- const element = await SlugPage({
125
- params: Promise.resolve({ locale: "en", slug: "blog" }),
126
- getMdxSource,
127
- });
128
- const { container } = render(element);
129
-
130
- expect(getMdxSource).toHaveBeenNthCalledWith(1, "LandingPage", "blog", "en");
131
- expect(getMdxSource).toHaveBeenNthCalledWith(2, "BlogList", "blog", "en");
132
- const script = container.querySelector("script[type='application/ld+json']");
133
- expect(script?.textContent ?? "").toContain('"@type":"Blog"');
134
- expect(mockNotFound).not.toHaveBeenCalled();
135
- });
136
-
137
- it("calls notFound() for a slug with neither a LandingPage nor a BlogList source", async () => {
138
- const getMdxSource = jest.fn().mockResolvedValue(null);
139
-
140
- await expect(
141
- SlugPage({
142
- params: Promise.resolve({ locale: "en", slug: "not-a-page" }),
143
- getMdxSource,
144
- }),
145
- ).rejects.toThrow("NEXT_NOT_FOUND");
146
- expect(mockNotFound).toHaveBeenCalledTimes(1);
147
- });
148
- });