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,120 +0,0 @@
1
- "use server";
2
-
3
- /**
4
- * account/onboarding/actions.ts — the onboarding page's read and write
5
- * (#8515, spec docs/specs/8515-standard-client-onboarding-diagnostic-and-spec.md
6
- * D12; the routes are D7's `GET` and D8's `POST /v1/member/onboarding`).
7
- *
8
- * - `readOnboardingForm` — `member.onboarding`, the standard onboarding
9
- * magnet's questions, or `form: null` while it is not open to the
10
- * caller. A 404 (no member area on this build, or a hub that does not
11
- * admit the route) is that same "not open" state; any other refusal is
12
- * `error`, so the page shows its error row with Retry.
13
- * - `submitOnboarding` — `member.submitOnboarding` with the answers.
14
- *
15
- * Both send `forwardedCookieInit()`'s init as built — the session cookie
16
- * plus the request's `Origin` on a single site, the hub credential on a
17
- * hub-mode spoke — so nothing here tests the topology, and no identity is
18
- * posted: the API takes the Person from the credential.
19
- *
20
- * The answers are the entries named `answer.<name>`; a repeated name becomes
21
- * an array, and so does a name the form lists under `multi` (a multi
22
- * question with one box checked still posts an array, which is what the API
23
- * asks of it). A value is sent as typed; one left empty or all-space is
24
- * omitted, because the API refuses `""`. The API checks every answer
25
- * against the form it serves — nothing here is trusted.
26
- *
27
- * Not a `*.actions.ts` file and no `*Action`-suffixed export: apps/mcp's
28
- * parity test reads that suffix, and the member routes have no MCP twin by
29
- * decision (8515 C4). Logs carry the function, the status and the code only
30
- * — never an answer or a credential.
31
- */
32
-
33
- import { member } from "@working-theory/api-client";
34
- import type { MemberOnboardingFormResponse } from "@working-theory/validation";
35
-
36
- import { forwardedCookieInit } from "../../../../../lib/server-api";
37
-
38
- /** The refusal codes the form has its own words for; anything else is `failed`. */
39
- const KNOWN_CODES = [
40
- "onboarding_off",
41
- "answers_invalid",
42
- "link_not_https",
43
- "too_many_requests",
44
- ] as const;
45
-
46
- export type OnboardingErrorCode = (typeof KNOWN_CODES)[number] | "failed";
47
-
48
- /** What the form shows after a submit. */
49
- export type OnboardingState =
50
- | { kind: "idle" }
51
- | { kind: "sent" }
52
- | { kind: "error"; code: OnboardingErrorCode };
53
-
54
- export type OnboardingForm = NonNullable<MemberOnboardingFormResponse["form"]>;
55
-
56
- export type OnboardingRead = { kind: "ok"; form: OnboardingForm | null } | { kind: "error" };
57
-
58
- /** PII-safe error identity for logs (`err.name` only). */
59
- function errorName(err: unknown): string {
60
- return err instanceof Error ? err.name : "unknown";
61
- }
62
-
63
- /** The `error.code` of a member refusal body, when it has one. */
64
- function errorCode(body: unknown): string | null {
65
- const code = (body as { error?: { code?: unknown } } | null)?.error?.code;
66
- return typeof code === "string" ? code : null;
67
- }
68
-
69
- function knownCode(status: number, code: string | null): OnboardingErrorCode {
70
- const known = KNOWN_CODES.find((candidate) => candidate === code);
71
- if (known) return known;
72
- // The hub's per-person budget and the per-IP limiter answer `429 rate_limited`.
73
- return status === 429 ? "too_many_requests" : "failed";
74
- }
75
-
76
- export async function readOnboardingForm(): Promise<OnboardingRead> {
77
- try {
78
- const res = await member.onboarding(await forwardedCookieInit());
79
- if (res.ok) return { kind: "ok", form: res.body.form };
80
- if (res.status === 404) return { kind: "ok", form: null };
81
- console.error(
82
- `[onboarding] readOnboardingForm status=${res.status} code=${errorCode(res.body) ?? "none"}`,
83
- );
84
- } catch (err) {
85
- console.error(`[onboarding] readOnboardingForm errName=${errorName(err)}`);
86
- }
87
- return { kind: "error" };
88
- }
89
-
90
- /** `(prev, formData)` for `useActionState`. */
91
- export async function submitOnboarding(
92
- _prev: OnboardingState,
93
- formData: FormData,
94
- ): Promise<OnboardingState> {
95
- // Action input is untrusted: a hand-built call may post anything.
96
- if (!(formData instanceof FormData)) return { kind: "error", code: "failed" };
97
-
98
- const multi = new Set(formData.getAll("multi").filter((v) => typeof v === "string"));
99
- const answers: Record<string, string | string[]> = {};
100
- for (const key of new Set(formData.keys())) {
101
- if (!key.startsWith("answer.")) continue;
102
- const name = key.slice("answer.".length);
103
- const values = formData
104
- .getAll(key)
105
- .filter((v): v is string => typeof v === "string" && v.trim() !== "");
106
- if (values.length === 0) continue;
107
- answers[name] = values.length > 1 || multi.has(name) ? values : values[0]!;
108
- }
109
-
110
- try {
111
- const res = await member.submitOnboarding({ answers }, await forwardedCookieInit());
112
- if (res.ok) return { kind: "sent" };
113
- const code = knownCode(res.status, errorCode(res.body));
114
- console.error(`[onboarding] submitOnboarding status=${res.status} code=${code}`);
115
- return { kind: "error", code };
116
- } catch (err) {
117
- console.error(`[onboarding] submitOnboarding errName=${errorName(err)}`);
118
- return { kind: "error", code: "failed" };
119
- }
120
- }
@@ -1,322 +0,0 @@
1
- "use client"; // owns the answers' state and posts them through useActionState
2
-
3
- /**
4
- * OnboardingForm — the client's onboarding questions (#8515, spec
5
- * docs/specs/8515-standard-client-onboarding-diagnostic-and-spec.md D12).
6
- *
7
- * Renders every served step in order — the server checks every answer and
8
- * evaluates no `showIf` (D9). A field step renders each field as `Input`
9
- * (text, email, tel, url), `Textarea` or `Select`; a segmentation step renders
10
- * each question as a `RadioGroup` (single choice) or one `Checkbox` per option
11
- * (`multi`), labelled by the step's title. Copy is the provider's
12
- * `LocalizedString`s, resolved for the form's `defaultLocale` (else its first
13
- * locale) and rendered as text, never markup.
14
- *
15
- * Every control is named `answer.<name>` — a multi question's checkboxes
16
- * repeat it. The form is controlled and posts what its state holds, so a
17
- * refusal keeps every answer: one `answer.<name>` entry per value, plus a
18
- * `multi` entry naming each multi question, so `submitOnboarding` sends a
19
- * multi answer as an array even when one box is checked. A link is sent as
20
- * typed (`inputMode="url"`, no browser URL check): the server's https rule
21
- * is the only one. On success a status line replaces the form.
22
- */
23
-
24
- import {
25
- Button,
26
- Checkbox,
27
- Heading,
28
- InlineMessage,
29
- Input,
30
- Label,
31
- RadioGroup,
32
- RadioGroupItem,
33
- Select,
34
- SelectContent,
35
- SelectItem,
36
- SelectTrigger,
37
- SelectValue,
38
- Text,
39
- Textarea,
40
- } from "@working-theory/ui/primitives";
41
- import { resolveLocalizedString, type MemberOnboardingStep } from "@working-theory/validation";
42
- import {
43
- startTransition,
44
- useActionState,
45
- useId,
46
- useState,
47
- type FormEvent,
48
- type ReactElement,
49
- } from "react";
50
-
51
- import {
52
- submitOnboarding,
53
- type OnboardingErrorCode,
54
- type OnboardingForm as OnboardingFormData,
55
- type OnboardingState,
56
- } from "./actions";
57
-
58
- type FieldStep = Extract<MemberOnboardingStep, { type: "field" }>;
59
- type SegmentationStep = Extract<MemberOnboardingStep, { type: "segmentation" }>;
60
- type FormField = FieldStep["fields"][number];
61
- type Question = SegmentationStep["questions"][number];
62
-
63
- export interface OnboardingFormLabels {
64
- optional: string;
65
- submit: string;
66
- submitting: string;
67
- sent: string;
68
- errors: Record<OnboardingErrorCode, string>;
69
- }
70
-
71
- export interface OnboardingFormProps {
72
- form: OnboardingFormData;
73
- labels: OnboardingFormLabels;
74
- }
75
-
76
- export function OnboardingForm({ form, labels }: OnboardingFormProps): ReactElement {
77
- const id = useId();
78
- const [answers, setAnswers] = useState<Record<string, string | string[]>>({});
79
- const [state, dispatch, pending] = useActionState<OnboardingState, FormData>(
80
- submitOnboarding,
81
- { kind: "idle" },
82
- );
83
-
84
- if (state.kind === "sent") {
85
- return (
86
- <InlineMessage
87
- variant="success"
88
- role="status"
89
- className="text-body-sm"
90
- data-testid="account-onboarding-sent"
91
- >
92
- {labels.sent}
93
- </InlineMessage>
94
- );
95
- }
96
-
97
- const text = (value: Record<string, string>): string =>
98
- resolveLocalizedString(value, form.defaultLocale, form.defaultLocale);
99
- const setAnswer = (name: string, value: string | string[]): void =>
100
- setAnswers((current) => ({ ...current, [name]: value }));
101
- const single = (name: string): string => {
102
- const value = answers[name];
103
- return typeof value === "string" ? value : "";
104
- };
105
- const picked = (name: string): string[] => {
106
- const value = answers[name];
107
- return Array.isArray(value) ? value : [];
108
- };
109
-
110
- const onSubmit = (event: FormEvent<HTMLFormElement>): void => {
111
- event.preventDefault();
112
- const formData = new FormData();
113
- for (const step of form.steps) {
114
- if (step.type !== "segmentation") continue;
115
- for (const question of step.questions) {
116
- if (question.multi) formData.append("multi", question.name);
117
- }
118
- }
119
- for (const [name, value] of Object.entries(answers)) {
120
- for (const one of Array.isArray(value) ? value : [value]) {
121
- formData.append(`answer.${name}`, one);
122
- }
123
- }
124
- startTransition(() => dispatch(formData));
125
- };
126
-
127
- const renderField = (field: FormField): ReactElement => {
128
- const controlId = `${id}-${field.name}`;
129
- const helpId = `${controlId}-help`;
130
- const help = field.copy.help ? text(field.copy.help) : null;
131
- const placeholder = field.copy.placeholder ? text(field.copy.placeholder) : undefined;
132
- const value = single(field.name);
133
- const common = {
134
- id: controlId,
135
- name: `answer.${field.name}`,
136
- required: field.required === true,
137
- ...(help ? { "aria-describedby": helpId } : {}),
138
- "data-testid": `account-onboarding-field-${field.name}`,
139
- };
140
- const onChange = (event: { target: { value: string } }): void =>
141
- setAnswer(field.name, event.target.value);
142
-
143
- let control: ReactElement;
144
- if (field.inputType === "textarea") {
145
- control = (
146
- <Textarea {...common} rows={4} value={value} placeholder={placeholder} onChange={onChange} />
147
- );
148
- } else if (field.inputType === "select") {
149
- control = (
150
- <Select
151
- name={common.name}
152
- required={common.required}
153
- value={value}
154
- onValueChange={(next) => setAnswer(field.name, next)}
155
- >
156
- <SelectTrigger
157
- id={controlId}
158
- {...(help ? { "aria-describedby": helpId } : {})}
159
- data-testid={common["data-testid"]}
160
- >
161
- <SelectValue {...(placeholder ? { placeholder } : {})} />
162
- </SelectTrigger>
163
- <SelectContent>
164
- {(field.options ?? []).map((option) => (
165
- <SelectItem key={option.value} value={option.value}>
166
- {text(option.label)}
167
- </SelectItem>
168
- ))}
169
- </SelectContent>
170
- </Select>
171
- );
172
- } else {
173
- control = (
174
- <Input
175
- {...common}
176
- // A url field takes text: no browser URL check, so the server's plain refusal is the rule.
177
- type={field.inputType === "url" ? "text" : field.inputType}
178
- {...(field.inputType === "url" ? { inputMode: "url" as const } : {})}
179
- value={value}
180
- placeholder={placeholder}
181
- onChange={onChange}
182
- />
183
- );
184
- }
185
-
186
- return (
187
- <div key={field.name} className="flex flex-col gap-2">
188
- <div className="flex items-baseline gap-2">
189
- <Label htmlFor={controlId}>{text(field.copy.label)}</Label>
190
- {field.required ? null : (
191
- <Text as="span" variant="caption">
192
- {labels.optional}
193
- </Text>
194
- )}
195
- </div>
196
- {control}
197
- {help ? (
198
- <Text as="p" id={helpId} variant="caption">
199
- {help}
200
- </Text>
201
- ) : null}
202
- </div>
203
- );
204
- };
205
-
206
- /** One question, labelled by its step's title (`titleId`). */
207
- const renderQuestion = (question: Question, titleId: string): ReactElement => {
208
- const groupId = `${id}-${question.name}`;
209
- const name = `answer.${question.name}`;
210
- const optionId = (index: number): string => `${groupId}-${index}`;
211
-
212
- if (!question.multi) {
213
- return (
214
- <RadioGroup
215
- key={question.name}
216
- aria-labelledby={titleId}
217
- name={name}
218
- required
219
- value={single(question.name)}
220
- onValueChange={(next) => setAnswer(question.name, next)}
221
- data-testid={`account-onboarding-field-${question.name}`}
222
- >
223
- {question.options.map((option, index) => (
224
- <div key={option.value} className="flex min-h-11 items-center gap-3">
225
- <RadioGroupItem id={optionId(index)} value={option.value} />
226
- <Label htmlFor={optionId(index)}>{text(option.label)}</Label>
227
- </div>
228
- ))}
229
- </RadioGroup>
230
- );
231
- }
232
-
233
- const exclusive = new Set(question.exclusiveValues ?? []);
234
- const values = picked(question.name);
235
- // A value in `exclusiveValues` stands alone (D9): checking it clears the
236
- // others, and checking another clears it. Kept in the options' order.
237
- const toggle = (value: string, checked: boolean): void => {
238
- const next = new Set(
239
- checked
240
- ? exclusive.has(value)
241
- ? [value]
242
- : [...values.filter((v) => !exclusive.has(v)), value]
243
- : values.filter((v) => v !== value),
244
- );
245
- setAnswer(
246
- question.name,
247
- question.options.map((o) => o.value).filter((v) => next.has(v)),
248
- );
249
- };
250
- return (
251
- <div
252
- key={question.name}
253
- role="group"
254
- aria-labelledby={titleId}
255
- className="flex flex-col"
256
- data-testid={`account-onboarding-field-${question.name}`}
257
- >
258
- {question.options.map((option, index) => (
259
- <div key={option.value} className="flex min-h-11 items-center gap-3">
260
- <Checkbox
261
- id={optionId(index)}
262
- name={name}
263
- value={option.value}
264
- checked={values.includes(option.value)}
265
- onCheckedChange={(checked) => toggle(option.value, checked === true)}
266
- />
267
- <Label htmlFor={optionId(index)}>{text(option.label)}</Label>
268
- </div>
269
- ))}
270
- </div>
271
- );
272
- };
273
-
274
- /** A segmentation step: its title once, then each question it asks. */
275
- const renderSegmentation = (step: SegmentationStep): ReactElement => {
276
- const titleId = `${id}-${step.key}-title`;
277
- return (
278
- <div key={step.key} className="flex flex-col gap-2">
279
- <Text as="p" id={titleId} variant="body-sm" className="font-semibold">
280
- {text(step.copy.title)}
281
- </Text>
282
- {step.questions.map((question) => renderQuestion(question, titleId))}
283
- </div>
284
- );
285
- };
286
-
287
- return (
288
- <form onSubmit={onSubmit} className="flex flex-col gap-6" data-testid="account-onboarding-form">
289
- {form.steps.map((step) =>
290
- step.type === "segmentation" ? (
291
- renderSegmentation(step)
292
- ) : (
293
- <div key={step.key} className="flex flex-col gap-4">
294
- {/* A one-field step's title is its field's label; a heading only when it groups several. */}
295
- {step.fields.length > 1 ? (
296
- <Heading level={2} visual={4}>
297
- {text(step.copy.title)}
298
- </Heading>
299
- ) : null}
300
- {step.fields.map(renderField)}
301
- </div>
302
- ),
303
- )}
304
- {state.kind === "error" ? (
305
- <InlineMessage variant="error" className="text-body-sm" data-testid="account-onboarding-error">
306
- {labels.errors[state.code]}
307
- </InlineMessage>
308
- ) : null}
309
- <div>
310
- <Button
311
- type="submit"
312
- disabled={pending}
313
- // 44px on a phone (a touch-first context); the 36px primary from md up.
314
- className="max-md:min-h-11"
315
- data-testid="account-onboarding-submit"
316
- >
317
- {pending ? labels.submitting : labels.submit}
318
- </Button>
319
- </div>
320
- </form>
321
- );
322
- }
@@ -1,126 +0,0 @@
1
- /**
2
- * /[locale]/account/onboarding — the client's onboarding questions (#8515,
3
- * spec docs/specs/8515-standard-client-onboarding-diagnostic-and-spec.md
4
- * D12).
5
- *
6
- * RSC, inside the account layout's SignedInShell. Reached from the Open
7
- * onboarding action on a message the business sent with Start onboarding
8
- * (`lib/account-config.ts`, D6). It reads the workspace's standard
9
- * onboarding magnet through `readOnboardingForm` (`GET /v1/member/onboarding`)
10
- * and renders:
11
- *
12
- * - the form's title and `OnboardingForm`, which posts the answers through
13
- * `submitOnboarding`;
14
- * - `form: null` — onboarding not open to this caller here (switched off,
15
- * not seeded, no Person, or no member area on this build) — a plain line
16
- * and a link back to the account;
17
- * - a failed read — the account area's error row with Retry (spec 7423
18
- * D12), never an empty page.
19
- *
20
- * Nothing here tests the topology: the read sends `forwardedCookieInit()`'s
21
- * init, so the same file serves a single site and a hub-mode spoke.
22
- */
23
-
24
- import { localeHref } from "@working-theory/ui";
25
- import { Heading, Link, Text } from "@working-theory/ui/primitives";
26
- import type { Metadata } from "next";
27
- import { getTranslations } from "next-intl/server";
28
- import type { ReactElement } from "react";
29
-
30
- import { accountSession } from "../account-data";
31
- import { ErrorRow } from "../error-row";
32
-
33
- import { readOnboardingForm } from "./actions";
34
- import { OnboardingForm } from "./onboarding-form";
35
-
36
- interface Props {
37
- params: Promise<{ locale: string }>;
38
- }
39
-
40
- export async function generateMetadata({ params }: Props): Promise<Metadata> {
41
- const { locale } = await params;
42
- const t = await getTranslations({ locale, namespace: "account" });
43
- return { title: t("onboarding.title") };
44
- }
45
-
46
- export default async function AccountOnboardingPage({ params }: Props): Promise<ReactElement> {
47
- const { locale } = await params;
48
- const t = await getTranslations({ locale, namespace: "account" });
49
- const session = await accountSession(locale);
50
-
51
- // Unreachable behind the (authed) gate — the layout renders the sign-in
52
- // gate instead — but the page still renders in parallel with it, so a
53
- // `notFound()` here would stream a 404 digest over the gate (the scaffold
54
- // render sweep's `streamed not-found`, as `../artifacts/page.tsx` records).
55
- // With no session: the heading alone, and nothing is read.
56
- if (!session) {
57
- return (
58
- <div className="max-w-3xl py-8" data-testid="account-onboarding">
59
- <Heading level={1} visual={2}>
60
- {t("onboarding.title")}
61
- </Heading>
62
- </div>
63
- );
64
- }
65
-
66
- const read = await readOnboardingForm();
67
-
68
- if (read.kind === "error") {
69
- return (
70
- <div className="max-w-3xl py-8" data-testid="account-onboarding">
71
- <Heading level={1} visual={2}>
72
- {t("onboarding.title")}
73
- </Heading>
74
- <ErrorRow
75
- className="mt-block-loose"
76
- message={t("onboarding.errors.load")}
77
- retryLabel={t("onboarding.retry")}
78
- />
79
- </div>
80
- );
81
- }
82
-
83
- if (read.form === null) {
84
- return (
85
- <div className="max-w-3xl py-8" data-testid="account-onboarding">
86
- <Heading level={1} visual={2}>
87
- {t("onboarding.title")}
88
- </Heading>
89
- <div className="mt-block-tight" data-testid="account-onboarding-unavailable">
90
- <Text as="p" variant="body-sm" tone="muted">
91
- {t("onboarding.unavailable")}
92
- </Text>
93
- </div>
94
- <Text as="p" variant="body-sm" className="mt-block-tight">
95
- <Link href={localeHref(locale, "/account")} data-testid="account-onboarding-back">
96
- {t("onboarding.back")}
97
- </Link>
98
- </Text>
99
- </div>
100
- );
101
- }
102
-
103
- return (
104
- <div className="flex max-w-3xl flex-col gap-8 py-8" data-testid="account-onboarding">
105
- <Heading level={1} visual={2}>
106
- {read.form.title}
107
- </Heading>
108
- <OnboardingForm
109
- form={read.form}
110
- labels={{
111
- optional: t("onboarding.optional"),
112
- submit: t("onboarding.submit"),
113
- submitting: t("onboarding.submitting"),
114
- sent: t("onboarding.sent"),
115
- errors: {
116
- onboarding_off: t("onboarding.errors.onboardingOff"),
117
- answers_invalid: t("onboarding.errors.answersInvalid"),
118
- link_not_https: t("onboarding.errors.linkNotHttps"),
119
- too_many_requests: t("onboarding.errors.tooManyRequests"),
120
- failed: t("onboarding.errors.failed"),
121
- },
122
- }}
123
- />
124
- </div>
125
- );
126
- }