create-ailk 0.37.1 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. package/README.md +129 -0
  2. package/component-catalog.json +44 -6
  3. package/component-catalog.md +6 -5
  4. package/dist/add-module.js +16 -1
  5. package/dist/add-route.d.ts +2 -2
  6. package/dist/add-route.js +19 -12
  7. package/dist/cli.js +52 -0
  8. package/dist/declined-routes.d.ts +13 -0
  9. package/dist/declined-routes.js +74 -0
  10. package/dist/derive-architecture.d.ts +0 -6
  11. package/dist/derive-architecture.js +12 -16
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.js +3 -0
  14. package/dist/language-import.d.ts +93 -0
  15. package/dist/language-import.js +270 -43
  16. package/dist/lib/import-mdx.js +1 -1
  17. package/dist/lib/scaffold-render-sweep.d.ts +6 -3
  18. package/dist/lib/scaffold-render-sweep.js +8 -4
  19. package/dist/migrate-content.d.ts +6 -2
  20. package/dist/migrate-content.js +62 -5
  21. package/dist/module-architecture.js +139 -103
  22. package/dist/paid-sections.d.ts +13 -0
  23. package/dist/paid-sections.js +35 -5
  24. package/dist/programmatic.js +6 -16
  25. package/dist/remove-module.js +73 -2
  26. package/dist/routes.d.ts +130 -0
  27. package/dist/routes.js +954 -0
  28. package/dist/site-manifest.js +6 -4
  29. package/dist/site-roster.d.ts +11 -2
  30. package/dist/site-roster.js +63 -21
  31. package/dist/spoke-checkout.d.ts +28 -27
  32. package/dist/spoke-checkout.js +71 -102
  33. package/dist/surfaces.d.ts +26 -0
  34. package/dist/surfaces.js +105 -293
  35. package/dist/sync-routes.d.ts +14 -1
  36. package/dist/sync-routes.js +108 -10
  37. package/dist/template-record.js +3 -1
  38. package/dist/topology.d.ts +26 -1
  39. package/dist/topology.js +273 -7
  40. package/dist/update.d.ts +17 -2
  41. package/dist/update.js +480 -77
  42. package/package.json +3 -3
  43. package/templates/README.md +1 -1
  44. package/templates/apps/mcp/CLAUDE.md +5 -3
  45. package/templates/apps/web/CLAUDE.md +87 -23
  46. package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +5 -1
  47. package/templates/apps/web/__tests__/__mocks__/next-intl.ts +5 -1
  48. package/templates/apps/web/__tests__/auth/seam.test.ts +34 -0
  49. package/templates/apps/web/account.config.tsx +100 -0
  50. package/templates/apps/web/app/[locale]/(authed)/account/connect/__tests__/page.test.tsx +1 -1
  51. package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +2 -2
  52. package/templates/apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx +1 -1
  53. package/templates/apps/web/app/[locale]/layout.tsx +46 -29
  54. package/templates/apps/web/app/apple-icon.tsx +72 -0
  55. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +22 -12
  56. package/templates/apps/web/app/og/__tests__/__snapshots__/card.test.tsx.snap +3 -0
  57. package/templates/apps/web/app/og/__tests__/card.test.tsx +129 -0
  58. package/templates/apps/web/app/og/__tests__/route.test.ts +3 -4
  59. package/templates/apps/web/app/og/route.tsx +155 -72
  60. package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +12 -0
  61. package/templates/apps/web/auth.config.tsx +107 -0
  62. package/templates/apps/web/auth.ts +2 -1
  63. package/templates/apps/web/i18n/request.ts +51 -1
  64. package/templates/apps/web/jest.config.cjs +17 -1
  65. package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
  66. package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +73 -0
  67. package/templates/apps/web/lib/__tests__/nav-label-keys.test.ts +14 -0
  68. package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +148 -61
  69. package/templates/apps/web/lib/__tests__/served-pages.test.ts +77 -0
  70. package/templates/apps/web/lib/__tests__/server-api.test.ts +37 -5
  71. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +26 -13
  72. package/templates/apps/web/lib/listings.tsx +2 -2
  73. package/templates/apps/web/lib/nav-label-keys.ts +16 -2
  74. package/templates/apps/web/lib/paid-section-contracts.ts +35 -6
  75. package/templates/apps/web/lib/paid-sections.generated.ts +8 -0
  76. package/templates/apps/web/lib/profile-back-link.ts +105 -32
  77. package/templates/apps/web/lib/served-pages.ts +95 -0
  78. package/templates/apps/web/lib/server-api.ts +1 -1
  79. package/templates/apps/web/lib/site-brand.tsx +3 -5
  80. package/templates/apps/web/lib/topology.generated.ts +5 -0
  81. package/templates/apps/web/messages/en.json +8 -836
  82. package/templates/apps/web/middleware.ts +15 -26
  83. package/templates/apps/web/next.config.mjs +35 -0
  84. package/templates/apps/web/package.json +2 -0
  85. package/templates/apps/web/types/messages.d.ts +6 -1
  86. package/templates/customizations.yaml +9 -0
  87. package/templates/package.json +3 -1
  88. package/templates/tools/lint-architecture.ts +164 -11
  89. package/versions.json +49 -47
  90. package/templates/apps/web/app/[locale]/(auth)/__tests__/auth-pages.test.tsx +0 -322
  91. package/templates/apps/web/app/[locale]/(auth)/__tests__/password-reset.test.tsx +0 -554
  92. package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/consent-actions.test.ts +0 -56
  93. package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/page.test.tsx +0 -164
  94. package/templates/apps/web/app/[locale]/(auth)/consent/consent-form.tsx +0 -132
  95. package/templates/apps/web/app/[locale]/(auth)/consent/consent.actions.ts +0 -51
  96. package/templates/apps/web/app/[locale]/(auth)/consent/page.tsx +0 -144
  97. package/templates/apps/web/app/[locale]/(auth)/forgot-password/forgot-password-card.tsx +0 -101
  98. package/templates/apps/web/app/[locale]/(auth)/forgot-password/page.tsx +0 -111
  99. package/templates/apps/web/app/[locale]/(auth)/layout.tsx +0 -81
  100. package/templates/apps/web/app/[locale]/(auth)/legal-footnote.tsx +0 -35
  101. package/templates/apps/web/app/[locale]/(auth)/reset-password/__tests__/return.test.tsx +0 -179
  102. package/templates/apps/web/app/[locale]/(auth)/reset-password/page.tsx +0 -157
  103. package/templates/apps/web/app/[locale]/(auth)/reset-password/reset-password-card.tsx +0 -126
  104. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/next-path.test.ts +0 -54
  105. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/page.test.tsx +0 -628
  106. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/remembered-method.test.ts +0 -43
  107. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/sign-in-card.test.tsx +0 -266
  108. package/templates/apps/web/app/[locale]/(auth)/sign-in/next-path.ts +0 -20
  109. package/templates/apps/web/app/[locale]/(auth)/sign-in/page.tsx +0 -234
  110. package/templates/apps/web/app/[locale]/(auth)/sign-in/remembered-method.ts +0 -37
  111. package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-card.tsx +0 -323
  112. package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-text.ts +0 -93
  113. package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/page.test.tsx +0 -301
  114. package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/sign-up-card.test.tsx +0 -309
  115. package/templates/apps/web/app/[locale]/(auth)/sign-up/page.tsx +0 -201
  116. package/templates/apps/web/app/[locale]/(auth)/sign-up/sign-up-card.tsx +0 -366
  117. package/templates/apps/web/app/[locale]/(auth)/use-auth-card-flow.ts +0 -116
  118. package/templates/apps/web/app/[locale]/(auth)/verify-email/__tests__/actions.test.ts +0 -94
  119. package/templates/apps/web/app/[locale]/(auth)/verify-email/actions.ts +0 -77
  120. package/templates/apps/web/app/[locale]/(auth)/verify-email/page.tsx +0 -154
  121. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/account-frame-sign-out.test.tsx +0 -175
  122. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +0 -301
  123. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +0 -515
  124. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +0 -883
  125. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +0 -758
  126. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +0 -264
  127. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +0 -167
  128. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +0 -730
  129. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +0 -355
  130. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +0 -97
  131. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +0 -375
  132. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +0 -323
  133. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +0 -1208
  134. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +0 -418
  135. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +0 -462
  136. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +0 -63
  137. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -406
  138. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +0 -93
  139. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +0 -208
  140. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +0 -340
  141. package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +0 -182
  142. package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +0 -353
  143. package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +0 -57
  144. package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +0 -58
  145. package/templates/apps/web/app/[locale]/(authed)/account/agreements-gate.ts +0 -61
  146. package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +0 -184
  147. package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +0 -161
  148. package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +0 -426
  149. package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +0 -76
  150. package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +0 -139
  151. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +0 -406
  152. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +0 -65
  153. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +0 -172
  154. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +0 -190
  155. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +0 -333
  156. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +0 -936
  157. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +0 -193
  158. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +0 -476
  159. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +0 -184
  160. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +0 -197
  161. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +0 -182
  162. package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +0 -99
  163. package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +0 -123
  164. package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +0 -424
  165. package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +0 -303
  166. package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +0 -274
  167. package/templates/apps/web/app/[locale]/(authed)/account/error-row.tsx +0 -35
  168. package/templates/apps/web/app/[locale]/(authed)/account/for-you-labels.ts +0 -36
  169. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +0 -215
  170. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +0 -65
  171. package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +0 -36
  172. package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +0 -27
  173. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +0 -149
  174. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +0 -42
  175. package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +0 -132
  176. package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +0 -218
  177. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +0 -122
  178. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +0 -215
  179. package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +0 -73
  180. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +0 -107
  181. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +0 -87
  182. package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +0 -119
  183. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +0 -215
  184. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +0 -80
  185. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +0 -43
  186. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +0 -125
  187. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +0 -88
  188. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +0 -31
  189. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +0 -35
  190. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +0 -266
  191. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +0 -116
  192. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +0 -12
  193. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +0 -154
  194. package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +0 -152
  195. package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +0 -219
  196. package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +0 -365
  197. package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +0 -86
  198. package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +0 -143
  199. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +0 -120
  200. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +0 -322
  201. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +0 -126
  202. package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +0 -306
  203. package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +0 -173
  204. package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +0 -103
  205. package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +0 -102
  206. package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +0 -240
  207. package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +0 -116
  208. package/templates/apps/web/app/[locale]/(authed)/account/retry-button.tsx +0 -27
  209. package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +0 -258
  210. package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +0 -131
  211. package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +0 -130
  212. package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +0 -92
  213. package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +0 -24
  214. package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +0 -121
  215. package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +0 -37
  216. package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +0 -60
  217. package/templates/apps/web/app/[locale]/(authed)/account/support/support-form.tsx +0 -98
  218. package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +0 -100
  219. package/templates/apps/web/app/[locale]/checkout/__tests__/pages.test.tsx +0 -139
  220. package/templates/apps/web/app/[locale]/checkout/__tests__/thank-you-account.test.tsx +0 -146
  221. package/templates/apps/web/app/[locale]/checkout/thank-you/page.tsx +0 -114
  222. package/templates/apps/web/app/[locale]/checkout/unavailable/page.tsx +0 -51
  223. package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +0 -614
  224. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +0 -43
  225. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +0 -214
  226. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +0 -197
  227. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +0 -286
  228. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +0 -520
  229. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +0 -376
  230. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +0 -306
  231. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/account-invite.actions.test.ts +0 -69
  232. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +0 -398
  233. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +0 -704
  234. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +0 -173
  235. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +0 -141
  236. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/verify.test.tsx +0 -249
  237. package/templates/apps/web/app/[locale]/flows/[slug]/account-invite.actions.ts +0 -35
  238. package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +0 -92
  239. package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +0 -177
  240. package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +0 -472
  241. package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +0 -48
  242. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +0 -100
  243. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +0 -99
  244. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -820
  245. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -203
  246. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +0 -194
  247. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +0 -284
  248. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +0 -302
  249. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +0 -402
  250. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/landing.test.tsx +0 -293
  251. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -485
  252. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +0 -231
  253. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/checkout-seam.ts +0 -74
  254. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +0 -36
  255. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -420
  256. package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +0 -85
  257. package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +0 -91
  258. package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +0 -32
  259. package/templates/apps/web/app/[locale]/flows/[slug]/verify/page.tsx +0 -153
  260. package/templates/apps/web/app/[locale]/flows/[slug]/verify.actions.ts +0 -151
  261. package/templates/apps/web/app/[locale]/meet/confirmed/BookingHandOff.tsx +0 -128
  262. package/templates/apps/web/app/[locale]/meet/confirmed/__tests__/BookingHandOff.test.tsx +0 -126
  263. package/templates/apps/web/app/[locale]/purchase/__tests__/cancel.test.tsx +0 -162
  264. package/templates/apps/web/app/[locale]/purchase/__tests__/module-scope.test.ts +0 -68
  265. package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +0 -411
  266. package/templates/apps/web/app/[locale]/purchase/cancel/page.tsx +0 -115
  267. package/templates/apps/web/app/[locale]/purchase/success/page.tsx +0 -348
  268. package/templates/apps/web/app/api/auth/[...all]/route.ts +0 -16
  269. package/templates/apps/web/app/api/auth/hub/__tests__/continuation.test.ts +0 -143
  270. package/templates/apps/web/app/api/auth/hub/__tests__/entry-routes.test.ts +0 -749
  271. package/templates/apps/web/app/api/auth/hub/authorize/__tests__/route.test.ts +0 -964
  272. package/templates/apps/web/app/api/auth/hub/authorize/route.ts +0 -390
  273. package/templates/apps/web/app/api/auth/hub/continuation.ts +0 -127
  274. package/templates/apps/web/app/api/auth/hub/continue/[ref]/__tests__/route.test.ts +0 -188
  275. package/templates/apps/web/app/api/auth/hub/continue/[ref]/route.ts +0 -53
  276. package/templates/apps/web/app/api/auth/hub/email/route.ts +0 -111
  277. package/templates/apps/web/app/api/auth/hub/entry-shared.ts +0 -163
  278. package/templates/apps/web/app/api/auth/hub/password/__tests__/return.test.ts +0 -86
  279. package/templates/apps/web/app/api/auth/hub/password/__tests__/route.test.ts +0 -368
  280. package/templates/apps/web/app/api/auth/hub/password/return.ts +0 -86
  281. package/templates/apps/web/app/api/auth/hub/password/route.ts +0 -171
  282. package/templates/apps/web/app/api/auth/hub/purchase/route.ts +0 -230
  283. package/templates/apps/web/app/api/auth/hub/purchase-link/route.ts +0 -174
  284. package/templates/apps/web/app/api/auth/hub/sign-up/route.ts +0 -60
  285. package/templates/apps/web/app/api/auth/hub/sign-up-evidence.ts +0 -97
  286. package/templates/apps/web/app/api/auth/mcp/__tests__/continuation.test.ts +0 -92
  287. package/templates/apps/web/app/api/auth/mcp/continuation.ts +0 -89
  288. package/templates/apps/web/app/api/auth/mcp/continue/[ref]/__tests__/route.test.ts +0 -59
  289. package/templates/apps/web/app/api/auth/mcp/continue/[ref]/route.ts +0 -41
  290. package/templates/apps/web/app/api/hub-session/__tests__/routes.test.ts +0 -1166
  291. package/templates/apps/web/app/api/hub-session/callback/route.ts +0 -134
  292. package/templates/apps/web/app/api/hub-session/email/route.ts +0 -125
  293. package/templates/apps/web/app/api/hub-session/one-tap/nonce/route.ts +0 -49
  294. package/templates/apps/web/app/api/hub-session/one-tap/route.ts +0 -106
  295. package/templates/apps/web/app/api/hub-session/open/route.ts +0 -111
  296. package/templates/apps/web/app/api/hub-session/password/return/route.ts +0 -69
  297. package/templates/apps/web/app/api/hub-session/password/route.ts +0 -106
  298. package/templates/apps/web/app/api/hub-session/sign-in/route.ts +0 -91
  299. package/templates/apps/web/app/api/hub-session/sign-out/route.ts +0 -54
  300. package/templates/apps/web/components/sign-out-trigger.tsx +0 -62
  301. package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
  302. package/templates/apps/web/lib/__tests__/auth-routes.test.ts +0 -140
  303. package/templates/apps/web/lib/account-config.ts +0 -678
  304. package/templates/apps/web/lib/auth-routes.ts +0 -125
  305. package/templates/apps/web/lib/checkout-config.ts +0 -16
  306. package/templates/apps/web/lib/hub-session/__tests__/hub-session.test.ts +0 -433
  307. package/templates/apps/web/lib/hub-session/__tests__/spoke-sign-in.test.tsx +0 -332
  308. package/templates/apps/web/lib/hub-session/config.ts +0 -110
  309. package/templates/apps/web/lib/hub-session/entry.ts +0 -238
  310. package/templates/apps/web/lib/hub-session/index.ts +0 -21
  311. package/templates/apps/web/lib/hub-session/one-tap.tsx +0 -148
  312. package/templates/apps/web/lib/hub-session/reseal.ts +0 -90
  313. package/templates/apps/web/lib/hub-session/seal.ts +0 -86
  314. package/templates/apps/web/lib/hub-session/session.ts +0 -298
  315. package/templates/apps/web/lib/hub-session/spoke-sign-in.tsx +0 -277
  316. package/templates/apps/web/lib/next-path.ts +0 -35
  317. package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
  318. package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
@@ -1,115 +0,0 @@
1
- // oss: false
2
- /**
3
- * /[locale]/purchase/cancel — the checkout-canceled return page (#6084).
4
- *
5
- * NOTE on `// oss: false` — see the identical note in
6
- * `../success/page.tsx`: this page ALSO renders `payment-receipt` via the
7
- * paid `@working-theory/ui-commerce` package (D5), so it needs the same
8
- * `paths_excluded` + marker pair the `/meet` precedent uses. `create-ailk`'s
9
- * scaffold is unaffected — `CORE_ROUTE_DIRS` governs scaffold presence, not
10
- * this marker.
11
- *
12
- * D4 — reads NOTHING. No session id, no API call, no `searchParams` read.
13
- * States that nothing was charged and links back to `/services`. This is
14
- * what makes AC-2 trivially true and removes the whole page from D3's PII
15
- * surface: there is no read to leak.
16
- *
17
- * D5 — the SAME chassis as `/purchase/success`, with `outcome: "cancel"`
18
- * (a distinct, non-forgeable Stripe status — `PaymentResult.tsx`'s
19
- * `OUTCOME_STATUS.cancel = "canceled"` — that carries no schema.org
20
- * `PaymentComplete` node), no `items` section, and a `cta` whose primary
21
- * link is `/services`.
22
- *
23
- * D12 — base tree, request-time gate, mirroring `/purchase/success`.
24
- * `force-dynamic`: a static build without it would prerender the claim
25
- * check at BUILD time, so a site that buys commerce after its last deploy
26
- * would keep serving a prerendered 404.
27
- *
28
- * The `ui-commerce` package is registered LAZILY
29
- * (`../../../../src/lib/commerce-sections.ts`), mirroring
30
- * `/purchase/success` — never a top-level static import, since a keyless
31
- * scaffold carries no dependency on it by design (#5581 U6/D5). When it is
32
- * genuinely absent, this page falls back to an OSS `content-block` carrying
33
- * the same "Checkout canceled" copy.
34
- *
35
- * `noindex`: reachable only by cancelling a Checkout, never a page a
36
- * crawler should list.
37
- */
38
- import { SectionRenderer } from "@working-theory/ui/sections";
39
- import type { PageSection } from "@working-theory/validation";
40
- import type { Metadata } from "next";
41
- import { notFound } from "next/navigation";
42
- import { getTranslations } from "next-intl/server";
43
- import type { ReactElement } from "react";
44
-
45
- import { resolveCommerceClaim } from "../../../../src/lib/commerce-claim";
46
- import { ensureCommerceSectionsRegistered } from "../../../../src/lib/commerce-sections";
47
-
48
- // This page reads nothing and would otherwise be static — force it dynamic
49
- // so the commerce-claim check (D12) is evaluated per request, not baked
50
- // into a prerendered build.
51
- export const dynamic = "force-dynamic";
52
-
53
- interface Props {
54
- params: Promise<{ locale: string }>;
55
- }
56
-
57
- export async function generateMetadata({ params }: Props): Promise<Metadata> {
58
- const { locale } = await params;
59
- const t = await getTranslations({ locale, namespace: "purchase" });
60
- return {
61
- title: t("cancel.title"),
62
- description: t("cancel.message"),
63
- robots: { index: false, follow: true },
64
- };
65
- }
66
-
67
- export default async function Page({ params }: Props): Promise<ReactElement> {
68
- const { locale } = await params;
69
- const t = await getTranslations({ locale, namespace: "purchase" });
70
-
71
- // D12 — request-time gate, before any render.
72
- if (!(await resolveCommerceClaim())) {
73
- notFound();
74
- }
75
-
76
- const commerceSectionsAvailable = await ensureCommerceSectionsRegistered();
77
- const receipt: PageSection = commerceSectionsAvailable
78
- ? {
79
- id: "purchase-cancel-receipt",
80
- type: "payment-receipt",
81
- data: {
82
- outcome: "cancel",
83
- title: t("cancel.title"),
84
- message: t("cancel.message"),
85
- statusLabel: t("cancel.statusLabel"),
86
- },
87
- }
88
- : {
89
- id: "purchase-cancel-receipt-fallback",
90
- type: "content-block",
91
- data: {
92
- headline: t("cancel.title"),
93
- body: `${t("cancel.message")} ${t("cancel.statusLabel")}`,
94
- },
95
- };
96
-
97
- const sections: PageSection[] = [
98
- receipt,
99
- {
100
- id: "purchase-cancel-cta",
101
- type: "cta",
102
- data: {
103
- headline: t("cancel.ctaHeadline"),
104
- description: t("cancel.ctaDescription"),
105
- primaryCta: { label: t("cancel.ctaLabel"), href: "/services" },
106
- },
107
- },
108
- ];
109
-
110
- return (
111
- <main>
112
- <SectionRenderer sections={sections} locale={locale} />
113
- </main>
114
- );
115
- }
@@ -1,348 +0,0 @@
1
- // oss: false
2
- /**
3
- * /[locale]/purchase/success — the order-confirmation return page (#6084).
4
- *
5
- * NOTE on `// oss: false` — a DELIBERATE correction to the spec's NFR-4,
6
- * which assumed this page could ship unmarked like the base-tree checkout
7
- * API primitives (`routes/checkout/sessions.ts`, `tools/purchase.ts`). Those
8
- * import only OSS `@working-theory/stripe-client`; THIS page renders
9
- * `payment-receipt` via `registerCommerceSections()` from the PAID
10
- * `@working-theory/ui-commerce` package (D5) — the same shape `/meet`
11
- * already has for `@working-theory/ui-scheduling`. The architecture lint's
12
- * OSS→paid boundary rule (`architecture.yaml` forbidden_patterns) requires
13
- * either no marker + no paid import, or a `paths_excluded` entry PLUS this
14
- * marker (the `meet/**` precedent) — never no-marker-with-a-paid-import.
15
- * `create-ailk`'s scaffold is UNAFFECTED: `CORE_ROUTE_DIRS`
16
- * (`packages/create-ailk/src/surfaces.ts`) governs what a scaffold carries,
17
- * not this marker, so AC-4/FR-8 still hold — every scaffold gets this file
18
- * regardless. Only the ai-launch-kit-internal → ai-launch-kit PUBLIC-REPO
19
- * split (a different mechanism) reads this marker.
20
- *
21
- * READS the Checkout Session the Stripe webhook already granted (spec §1.2)
22
- * — this page never writes: no Prisma call, no Stripe write, no grant, no
23
- * stamp (AC-1, FR-3). It is reachable by anyone holding a `cs_…` id, with
24
- * no credential at all (D8) — the design below is built around that fact.
25
- *
26
- * D6 — the paid render is not forgeable. `outcome: "success"` is Stripe's
27
- * proof-of-payment status (a green chip, `data-outcome="success"`, and a
28
- * schema.org `PaymentComplete` node — `PaymentResult.tsx`), so the
29
- * `payment-receipt` section is constructed ONLY on a 2xx read with
30
- * `paymentStatus === "paid"`. Every other reachable state — no
31
- * `session_id`, an API failure, or a 2xx read that is not yet paid —
32
- * renders a DIFFERENT chassis (`content-block` → `cta`, not a
33
- * `CheckoutDeliveryPage`) with no badge, no `data-outcome` and no
34
- * `PaymentComplete` string anywhere in the DOM (AC-8).
35
- *
36
- * D12 — base tree, request-time gate. This page ships unconditionally in
37
- * every scaffold; whether it SERVES is decided per request by the
38
- * `commerce` licence claim (`../../../../src/lib/commerce-claim.ts`,
39
- * extracted from `.well-known/mcp.json`'s own check). `notFound()` on no
40
- * claim is indistinguishable from a build without the module — before any
41
- * API call, before any render.
42
- *
43
- * The `ui-commerce` package itself is registered LAZILY
44
- * (`../../../../src/lib/commerce-sections.ts`), never via a top-level
45
- * static import — a keyless scaffold carries no dependency on it by design
46
- * (#5581 U6/D5), and a static import would fail every keyless build
47
- * regardless of the request-time gate above. When the module genuinely is
48
- * not installed, `paidSections()` below falls back to an OSS
49
- * `content-block` carrying the same confirmation copy, rather than the bare
50
- * `payment-receipt` section `SectionRenderer` would otherwise silently
51
- * render as nothing (`ModuleAbsent` in production).
52
- *
53
- * `noindex`: reachable only by finishing (or trying) a Checkout, never a
54
- * page a crawler should list.
55
- *
56
- * #11095 D9 — "Open your account". A paid read whose answer carries
57
- * `customerEmail` (the hub serves it only for a paid Offerings session of
58
- * the caller's own workspace, under 24 h old) adds one link built by
59
- * `accountInviteHref`. Session Replay records `href`s, so the link sits in a
60
- * `data-sentry-block` wrapper, and the page sends no referrer (SEC-11095-5).
61
- */
62
- import { checkout } from "@working-theory/api-client";
63
- import type { CheckoutSessionReadResponse } from "@working-theory/api-client";
64
- import { Button, Container, Link } from "@working-theory/ui";
65
- import { SectionRenderer } from "@working-theory/ui/sections";
66
- import type { PageSection } from "@working-theory/validation";
67
- import { formatMoney } from "@working-theory/web-i18n";
68
- import type { Metadata } from "next";
69
- import { headers } from "next/headers";
70
- import { notFound } from "next/navigation";
71
- import { getTranslations } from "next-intl/server";
72
- import type { ReactElement } from "react";
73
-
74
- import { accountInviteHref } from "../../../../lib/account-invite";
75
- import { resolveCommerceClaim } from "../../../../src/lib/commerce-claim";
76
- import { ensureCommerceSectionsRegistered } from "../../../../src/lib/commerce-sections";
77
-
78
- // The success page reads `searchParams` (dynamic by construction); paired
79
- // with the cancel page's explicit `force-dynamic` so a site that buys
80
- // commerce after its last deploy is not stuck serving a prerendered 404
81
- // (D12).
82
- export const dynamic = "force-dynamic";
83
-
84
- /**
85
- * `next-intl`'s `getTranslations()` return type, so it can be passed
86
- * between the section builders below (this repo has no other precedent
87
- * typing it explicitly, since no other page passes `t` across functions).
88
- */
89
- type PurchaseT = Awaited<ReturnType<typeof getTranslations>>;
90
-
91
- interface Props {
92
- params: Promise<{ locale: string }>;
93
- searchParams?: Promise<{ session_id?: string | string[] }>;
94
- }
95
-
96
- /** First value only — a repeated query param must not become an array here. */
97
- function firstValue(raw: string | string[] | undefined): string | undefined {
98
- if (Array.isArray(raw)) return raw[0];
99
- return raw;
100
- }
101
-
102
- /**
103
- * Reads the visitor's real IP from THIS page's own incoming request —
104
- * never from the query string — preferring `x-forwarded-for` and falling
105
- * back to `x-real-ip`. Returns `undefined` rather than throwing on any
106
- * failure. A local copy of `flows/[slug]/checkout.actions.ts`'s identical
107
- * helper (#4730) — every RSC-to-API caller carries its own copy rather than
108
- * a shared import, since this one crosses the OSS/paid boundary the other
109
- * doesn't. Without it, `apps/api`'s rate limiter
110
- * (`middleware/rate-limit.ts`) sees the Next server's own egress IP for
111
- * every buyer, collapsing them into one shared bucket (security-review
112
- * finding on this issue's PR — #6084).
113
- */
114
- async function resolveVisitorIpInit(): Promise<
115
- { headers: Record<string, string> } | undefined
116
- > {
117
- try {
118
- const incoming = await headers();
119
- const visitorIp =
120
- incoming.get("x-forwarded-for") ?? incoming.get("x-real-ip");
121
- return visitorIp
122
- ? { headers: { "x-forwarded-for": visitorIp } }
123
- : undefined;
124
- } catch {
125
- return undefined;
126
- }
127
- }
128
-
129
- /** The onward `cta` section every one of D6's five rows carries (AC-7 — never a dead end). */
130
- function ctaSection(t: PurchaseT): PageSection {
131
- return {
132
- id: "purchase-success-cta",
133
- type: "cta",
134
- data: {
135
- headline: t("success.ctaHeadline"),
136
- description: t("success.ctaDescription"),
137
- primaryCta: { label: t("success.ctaLabel"), href: "/services" },
138
- },
139
- };
140
- }
141
-
142
- /** One card per paid line item — the D5 seam: `items`, not `payment-receipt`, carries the lines. */
143
- function itemsSection(
144
- lineItems: CheckoutSessionReadResponse["lineItems"],
145
- t: PurchaseT,
146
- locale: string,
147
- ): PageSection {
148
- return {
149
- id: "purchase-success-items",
150
- type: "items",
151
- data: {
152
- items: lineItems.map((line) => ({
153
- title: line.description,
154
- description: t("success.lineItem", {
155
- quantity: line.quantity,
156
- amount: formatMoney(line.amountTotal, line.currency, locale),
157
- }),
158
- })),
159
- },
160
- };
161
- }
162
-
163
- /**
164
- * D6's degraded-state row: no `session_id`, a shape-gate reject, an API
165
- * 404/non-2xx, or a session that isn't yet paid — all render honestly
166
- * rather than claiming a payment. `content-block` → `cta`; no
167
- * `payment-receipt`, so no badge and no schema.org node exists to be read.
168
- */
169
- function unknownSections(t: PurchaseT): PageSection[] {
170
- return [
171
- {
172
- id: "purchase-success-unknown",
173
- type: "content-block",
174
- data: {
175
- headline: t("success.unknownHeadline"),
176
- body: t("success.unknownBody"),
177
- },
178
- },
179
- ctaSection(t),
180
- ];
181
- }
182
-
183
- /** 2xx, `paymentStatus` is `"unpaid"` or `"no_payment_required"` — D6 row 2. */
184
- function pendingSections(
185
- session: CheckoutSessionReadResponse,
186
- t: PurchaseT,
187
- locale: string,
188
- ): PageSection[] {
189
- return [
190
- {
191
- id: "purchase-success-pending",
192
- type: "content-block",
193
- data: {
194
- headline: t("success.pendingHeadline"),
195
- body: t("success.pendingBody"),
196
- },
197
- },
198
- itemsSection(session.lineItems, t, locale),
199
- ctaSection(t),
200
- ];
201
- }
202
-
203
- /**
204
- * The OSS degrade for `paidSections()` — carries the same title/message/
205
- * status copy as `payment-receipt`, minus its badge/schema.org markers, for
206
- * a deployment where `@working-theory/ui-commerce` is genuinely not
207
- * installed (a keyless scaffold with a `commerce` licence claim but no
208
- * redeploy since buying it — `ensureCommerceSectionsRegistered()`'s own
209
- * doc comment).
210
- */
211
- function paidFallbackSection(t: PurchaseT): PageSection {
212
- return {
213
- id: "purchase-success-receipt-fallback",
214
- type: "content-block",
215
- data: {
216
- headline: t("success.title"),
217
- body: `${t("success.message")} ${t("success.statusLabel")}`,
218
- },
219
- };
220
- }
221
-
222
- /** 2xx AND `paymentStatus === "paid"` — the ONLY row that constructs `payment-receipt` (D6). */
223
- async function paidSections(
224
- session: CheckoutSessionReadResponse,
225
- t: PurchaseT,
226
- locale: string,
227
- ): Promise<PageSection[]> {
228
- const commerceSectionsAvailable = await ensureCommerceSectionsRegistered();
229
- const receipt: PageSection = commerceSectionsAvailable
230
- ? {
231
- id: "purchase-success-receipt",
232
- type: "payment-receipt",
233
- data: {
234
- outcome: "success",
235
- title: t("success.title"),
236
- message: t("success.message"),
237
- statusLabel: t("success.statusLabel"),
238
- amount: {
239
- amountMinor: session.amountTotal ?? 0,
240
- currency: session.currency,
241
- },
242
- locale,
243
- sessionId: session.id,
244
- sessionIdLabel: t("success.sessionIdLabel"),
245
- },
246
- }
247
- : paidFallbackSection(t);
248
- return [receipt, itemsSection(session.lineItems, t, locale), ctaSection(t)];
249
- }
250
-
251
- /** What the page renders: D6's sections, plus the paid read's account link (#11095 D9). */
252
- interface SuccessView {
253
- sections: PageSection[];
254
- accountHref: string | null;
255
- }
256
-
257
- /** D6's five-row table, collapsed to the three code paths that produce distinct output. */
258
- async function sectionsFor(
259
- sessionId: string | undefined,
260
- t: PurchaseT,
261
- locale: string,
262
- ): Promise<SuccessView> {
263
- const none = (sections: PageSection[]): SuccessView => ({
264
- sections,
265
- accountHref: null,
266
- });
267
- if (!sessionId) return none(unknownSections(t));
268
-
269
- // A malformed/oversized id (D8's shape gate) or an unknown session both
270
- // answer non-2xx here — the API's failure is logged server-side and never
271
- // surfaced to the buyer (spec §3 D6 table). `checkout.getSession()` calls
272
- // `fetch()` directly with no try/catch of its own
273
- // (`packages/api-client/src/http.ts`), so a network-level failure (the API
274
- // unreachable, DNS, a dropped connection) REJECTS rather than resolving
275
- // `{ ok: false }` — caught here so it degrades identically to a non-2xx
276
- // response instead of crashing the page (AC-7's "never a dead end",
277
- // code-review finding on this issue's PR).
278
- let res: Awaited<ReturnType<typeof checkout.getSession>>;
279
- try {
280
- res = await checkout.getSession(sessionId, await resolveVisitorIpInit());
281
- } catch {
282
- return none(unknownSections(t));
283
- }
284
- if (!res.ok) return none(unknownSections(t));
285
-
286
- if (res.body.paymentStatus !== "paid") {
287
- return none(pendingSections(res.body, t, locale));
288
- }
289
-
290
- const { customerEmail } = res.body;
291
- return {
292
- sections: await paidSections(res.body, t, locale),
293
- accountHref: customerEmail
294
- ? accountInviteHref(locale, customerEmail)
295
- : null,
296
- };
297
- }
298
-
299
- export async function generateMetadata({ params }: Props): Promise<Metadata> {
300
- const { locale } = await params;
301
- const t = await getTranslations({ locale, namespace: "purchase" });
302
- return {
303
- title: t("success.title"),
304
- description: t("success.message"),
305
- robots: { index: false, follow: true },
306
- referrer: "no-referrer",
307
- };
308
- }
309
-
310
- export default async function Page({
311
- params,
312
- searchParams,
313
- }: Props): Promise<ReactElement> {
314
- const { locale } = await params;
315
- const t: PurchaseT = await getTranslations({ locale, namespace: "purchase" });
316
-
317
- // D12 — request-time gate, before any API call and before any render.
318
- if (!(await resolveCommerceClaim())) {
319
- notFound();
320
- }
321
-
322
- const query = searchParams ? await searchParams : {};
323
- const sessionId = firstValue(query.session_id);
324
-
325
- const { sections, accountHref } = await sectionsFor(sessionId, t, locale);
326
-
327
- return (
328
- <main>
329
- <SectionRenderer sections={sections} locale={locale} />
330
- {accountHref !== null && (
331
- // Session Replay records the DOM, so the link (it carries the email) is blocked from it.
332
- <Container className="pb-section">
333
- <div data-sentry-block>
334
- <Button asChild size="big">
335
- <Link
336
- href={accountHref}
337
- variant="bare"
338
- data-testid="purchase-success-account"
339
- >
340
- {t("success.openAccount")}
341
- </Link>
342
- </Button>
343
- </div>
344
- </Container>
345
- )}
346
- </main>
347
- );
348
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * Better Auth catch-all route handler.
3
- *
4
- * Mounts Better Auth at /api/auth/* per its convention. This is the only
5
- * api-shaped code permitted in apps/web — all other HTTP logic lives in
6
- * apps/api (architecture.yaml).
7
- *
8
- * Replaces the deleted NextAuth catch-all at app/api/auth/[...nextauth]/.
9
- * Better Auth's toNextJsHandler returns GET + POST Web Fetch handlers that
10
- * Next.js App Router calls directly.
11
- */
12
- import { toNextJsHandler } from "better-auth/next-js";
13
-
14
- import { auth } from "../../../../auth";
15
-
16
- export const { GET, POST } = toNextJsHandler(auth.handler);
@@ -1,143 +0,0 @@
1
- /**
2
- * @jest-environment node
3
- */
4
-
5
- /**
6
- * The hub's sign-in continuation module (#8146 D3; spec AC-3(b), AC-4).
7
- * Pure functions over `seal.ts`; no mocks.
8
- */
9
- import { seal } from "../../../../../lib/hub-session/seal";
10
- import {
11
- CONTINUATION_REF_MAX,
12
- CONTINUATION_TTL_SECONDS,
13
- CONTINUE_PATH,
14
- mintContinuation,
15
- openContinuation,
16
- } from "../continuation";
17
-
18
- const SECRET = "k".repeat(43);
19
- const T = 1_790_000_000_000;
20
-
21
- const Q = new URLSearchParams({
22
- response_type: "code",
23
- client_id: "spoke_abc",
24
- redirect_uri: "https://spoke.example.com/api/hub-session/callback",
25
- state: "s".repeat(43),
26
- code_challenge: "c".repeat(43),
27
- code_challenge_method: "S256",
28
- }).toString();
29
-
30
- describe("constants", () => {
31
- it("pins the path, the ref cap and the 600 s life", () => {
32
- expect(CONTINUE_PATH).toBe("/api/auth/hub/continue");
33
- expect(CONTINUATION_REF_MAX).toBe(4096);
34
- expect(CONTINUATION_TTL_SECONDS).toBe(600);
35
- });
36
- });
37
-
38
- describe("AC-4 — the continuation lives 600 s and round-trips", () => {
39
- it("opens to the query it was minted from, up to the last millisecond", () => {
40
- const ref = mintContinuation(Q, SECRET, T);
41
- expect(openContinuation(ref, SECRET, T + 599_000)).toBe(Q);
42
- expect(openContinuation(ref, SECRET, T + 599_999)).toBe(Q);
43
- });
44
-
45
- it("is gone at exactly 600 s (exp <= now)", () => {
46
- const ref = mintContinuation(Q, SECRET, T);
47
- expect(openContinuation(ref, SECRET, T + 600_000)).toBeNull();
48
- expect(openContinuation(ref, SECRET, T + 600_001)).toBeNull();
49
- });
50
-
51
- it("is base64url only, so no decode can change it", () => {
52
- const ref = mintContinuation(Q, SECRET, T);
53
- expect(ref).toMatch(/^[A-Za-z0-9_-]+$/);
54
- expect(decodeURIComponent(decodeURIComponent(ref))).toBe(ref);
55
- expect(ref.length).toBeLessThan(CONTINUATION_REF_MAX);
56
- });
57
- });
58
-
59
- describe("AC-3(b) — a ref that is not ours opens to null", () => {
60
- const good = mintContinuation(Q, SECRET, T);
61
-
62
- it("flips the first character", () => {
63
- const flipped = (good[0] === "A" ? "B" : "A") + good.slice(1);
64
- expect(openContinuation(flipped, SECRET, T)).toBeNull();
65
- });
66
-
67
- it("sealed under another secret", () => {
68
- const other = mintContinuation(Q, "x".repeat(43), T);
69
- expect(openContinuation(other, SECRET, T)).toBeNull();
70
- });
71
-
72
- it('a valid payload sealed with purpose "flow" and the SAME AAD (only the key differs)', () => {
73
- const forged = seal(
74
- { v: 1, q: Q, exp: T + 600_000 },
75
- SECRET,
76
- "flow",
77
- "hub-continue",
78
- );
79
- expect(openContinuation(forged, SECRET, T)).toBeNull();
80
- });
81
-
82
- it("a value sealed under another name never opens as a continuation", () => {
83
- const forged = seal(
84
- { v: 1, q: Q, exp: T + 600_000 },
85
- SECRET,
86
- "continue",
87
- "ailk-hub-flow",
88
- );
89
- expect(openContinuation(forged, SECRET, T)).toBeNull();
90
- });
91
-
92
- it("exp in the past", () => {
93
- const expired = seal(
94
- { v: 1, q: Q, exp: T - 1 },
95
- SECRET,
96
- "continue",
97
- "hub-continue",
98
- );
99
- expect(openContinuation(expired, SECRET, T)).toBeNull();
100
- });
101
-
102
- it("4097 characters", () => {
103
- expect(openContinuation("A".repeat(4097), SECRET, T)).toBeNull();
104
- });
105
-
106
- it("a character outside base64url", () => {
107
- expect(openContinuation(`${good}%`, SECRET, T)).toBeNull();
108
- expect(openContinuation(`${good}?x=1`, SECRET, T)).toBeNull();
109
- expect(openContinuation("", SECRET, T)).toBeNull();
110
- });
111
-
112
- it("the base64url of plain JSON, unsealed", () => {
113
- const plain = Buffer.from(
114
- JSON.stringify({ v: 1, q: Q, exp: T + 600_000 }),
115
- ).toString("base64url");
116
- expect(openContinuation(plain, SECRET, T)).toBeNull();
117
- });
118
-
119
- it.each([
120
- ["a wrong version", { v: 2, q: Q, exp: T + 1000 }],
121
- ["an empty q", { v: 1, q: "", exp: T + 1000 }],
122
- ["a non-string q", { v: 1, q: 5, exp: T + 1000 }],
123
- ["a non-number exp", { v: 1, q: Q, exp: "later" }],
124
- ["a bare string", "hello"],
125
- ["null", null],
126
- ])("a sealed value with %s", (_name, value) => {
127
- const ref = seal(value, SECRET, "continue", "hub-continue");
128
- expect(openContinuation(ref, SECRET, T)).toBeNull();
129
- });
130
-
131
- it("re-serializes a forged q so a CR/LF is percent-encoded and never throws", () => {
132
- const ref = seal(
133
- { v: 1, q: "a=1\r\nX-Injected: 1", exp: T + 600_000 },
134
- SECRET,
135
- "continue",
136
- "hub-continue",
137
- );
138
- const opened = openContinuation(ref, SECRET, T);
139
- expect(opened).not.toBeNull();
140
- expect(opened).not.toMatch(/[\r\n]/);
141
- expect(() => new Headers({ Location: `/x?${opened}` })).not.toThrow();
142
- });
143
- });