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,131 +0,0 @@
1
- /**
2
- * /[locale]/account/security — User settings › Security (#8339 D8; #8431 D3;
3
- * #11162).
4
- *
5
- * RSC, outside the account layout's SignedInShell (#8430), in the member's
6
- * four-tab settings frame (D7) — standalone, the Admin's shape. It shows how
7
- * this person signs in, then Log out, through the shared `SecuritySettings`
8
- * (`security-panel.tsx` supplies its actions):
9
- *
10
- * - a site or hub that can email a password link: the Password row, set
11
- * or changed by an emailed link to the person's own address;
12
- * - any other site: one sentence naming the deployment's methods;
13
- * - a spoke that signs in through its hub: the SAME Password row (#11162),
14
- * its state read from the hub for the signed-in person, its link mailed
15
- * by the hub through the spoke's own `/api/hub-session/password` — no
16
- * "managed at <hub>" sentence and no link to the hub's Security page.
17
- *
18
- * `security-source.ts` picks the variant; this page turns it into text.
19
- */
20
-
21
- import { AccountSettingsFrame, AccountSettingsPane } from "@working-theory/templates/account";
22
- import { localeHref } from "@working-theory/ui";
23
- import type { Metadata } from "next";
24
- import { headers } from "next/headers";
25
- import { getTranslations } from "next-intl/server";
26
- import type { ReactElement } from "react";
27
-
28
- import { SIGN_IN_PATH, SIGN_OUT_ENDPOINT } from "../../../../../lib/topology.generated";
29
- import { accountSession } from "../account-data";
30
- import { ErrorRow } from "../error-row";
31
- import { memberSettingsFrame, type Translate } from "../settings-frame";
32
- import type { SignInMethodId } from "../sign-in-method";
33
-
34
- import { SecurityPanel, type SecurityPanelVariant } from "./security-panel";
35
- import { securitySource } from "./security-source";
36
-
37
- interface Props {
38
- params: Promise<{ locale: string }>;
39
- }
40
-
41
- export async function generateMetadata({ params }: Props): Promise<Metadata> {
42
- const { locale } = await params;
43
- const t = await getTranslations({ locale, namespace: "account" });
44
- return { title: t("settings.security.title"), description: t("settings.signIn.lead") };
45
- }
46
-
47
- /** The spoke's same-origin route that asks the hub to mail a password link (#11162). */
48
- const HUB_SESSION_PASSWORD_PATH = "/api/hub-session/password";
49
-
50
- /** Each sign-in method's phrase in the sentence (C5). */
51
- const METHOD_KEYS = {
52
- google: "settings.security.methods.google",
53
- github: "settings.security.methods.github",
54
- "magic-link": "settings.security.methods.magicLink",
55
- email: "settings.security.methods.password",
56
- } as const satisfies Record<SignInMethodId, string>;
57
-
58
- export default async function AccountSecurityPage({ params }: Props): Promise<ReactElement> {
59
- const { locale } = await params;
60
- const t = await getTranslations({ locale, namespace: "account" });
61
- const session = await accountSession(locale);
62
- const frame = memberSettingsFrame(locale, t as unknown as Translate, "security");
63
- const email = session?.ctx.user.email ?? "";
64
- const name = session?.ctx.user.name || email;
65
-
66
- const source = await securitySource(await headers(), session?.ctx.init);
67
-
68
- let variant: SecurityPanelVariant | null;
69
- if (source.kind !== "sentence") {
70
- // Both the password and the hub (#11162) sources are the Password row;
71
- // `null` is its unavailable line — a failed read, or a hub with no state.
72
- variant = source.hasPassword === null ? null : { kind: "password", hasPassword: source.hasPassword };
73
- } else {
74
- const methods = source.methods.map((id) => t(METHOD_KEYS[id], { email }));
75
- variant = {
76
- kind: "sentence",
77
- text:
78
- methods.length > 0
79
- ? t("settings.security.signsInWith", {
80
- methods: new Intl.ListFormat(locale, { type: "disjunction" }).format(methods),
81
- })
82
- : t("settings.security.signedInAs", { email }),
83
- };
84
- }
85
-
86
- return (
87
- <AccountSettingsFrame {...frame} name={name}>
88
- <AccountSettingsPane
89
- id="account-settings-security"
90
- title={t("settings.security.title")}
91
- lead={t("settings.signIn.lead")}
92
- >
93
- <SecurityPanel
94
- variant={variant}
95
- failed={
96
- <ErrorRow message={t("settings.security.passwordUnavailable")} retryLabel={t("inbox.retry")} />
97
- }
98
- email={email}
99
- // Absolute and same-origin, built here from BETTER_AUTH_URL — the
100
- // `(auth)/forgot-password/page.tsx` derivation.
101
- resetUrl={`${process.env.BETTER_AUTH_URL ?? ""}${localeHref(locale, "/reset-password")}`}
102
- // On a spoke the hub mails the link, asked through this same-origin
103
- // route (#11162); a site or hub asks Better Auth itself.
104
- passwordEndpoint={source.kind === "hub" ? HUB_SESSION_PASSWORD_PATH : null}
105
- locale={locale}
106
- signOutEndpoint={SIGN_OUT_ENDPOINT}
107
- // A hub-session sign-out lands home: the spoke's /account would sign
108
- // the person straight back in (#11095 D4). A hub keeps /sign-in.
109
- signInHref={localeHref(locale, SIGN_OUT_ENDPOINT ? "/" : (SIGN_IN_PATH ?? "/"))}
110
- labels={{
111
- methodsHeading: t("settings.security.methodsHeading"),
112
- passwordLabel: t("settings.security.passwordLabel"),
113
- passwordSet: t("settings.security.passwordSet"),
114
- passwordNotSet: t("settings.security.passwordNotSet"),
115
- setHint: t("settings.security.setHint"),
116
- changeHint: t("settings.security.changeHint"),
117
- setNote: t("settings.security.setNote", { email }),
118
- changeNote: t("settings.security.changeNote", { email }),
119
- setButton: t("settings.security.setButton"),
120
- changeButton: t("settings.security.changeButton"),
121
- sending: t("settings.security.sending"),
122
- sent: t("settings.security.sent"),
123
- sendFailed: t("settings.security.sendFailed"),
124
- logOut: t("settings.security.logOut"),
125
- logOutFailed: t("settings.security.logOutFailed"),
126
- }}
127
- />
128
- </AccountSettingsPane>
129
- </AccountSettingsFrame>
130
- );
131
- }
@@ -1,130 +0,0 @@
1
- "use client"; // Better Auth's client calls (requestPasswordReset, signOut) and router navigation need the browser
2
-
3
- /**
4
- * SecurityPanel — the member's adapter over `SecuritySettings` (#8431 D3;
5
- * #11162).
6
- *
7
- * The page (RSC) resolves the variant, the strings, the person's own address,
8
- * the reset link's absolute `redirectTo` and where Log out lands; this island
9
- * supplies the two actions:
10
- *
11
- * - the Password row's request: on a spoke that signs in through its hub,
12
- * one same-origin POST of `{ locale }` to the spoke's password route,
13
- * which asks the hub to mail the signed-in person's own address (#11162);
14
- * elsewhere Better Auth's `requestPasswordReset` for the person's OWN
15
- * address, with the server-built `redirectTo` (never one derived from
16
- * `window.location` — `forgot-password-card.tsx`'s rule). No address and
17
- * no password ever leaves this island;
18
- * - Log out: the spoke's same-origin sign-out endpoint when the page passes
19
- * one, else Better Auth's `signOut`. Only a log-out that succeeded
20
- * navigates (the `SignOutTrigger` rule).
21
- *
22
- * Its `authClient` is its own module-scope `createAuthClient()`, the
23
- * `account-frame.tsx` idiom — never imported from `(auth)/`, a tree a spoke
24
- * drops.
25
- */
26
-
27
- import {
28
- SecuritySettings,
29
- type SecuritySettingsLabels,
30
- type SecuritySignIn,
31
- } from "@working-theory/templates/account";
32
- import { createAuthClient } from "better-auth/react";
33
- import { useRouter } from "next/navigation";
34
- import type { ReactElement, ReactNode } from "react";
35
-
36
- const authClient = createAuthClient();
37
-
38
- /** The variant as the page resolved it — serializable, no functions. */
39
- export type SecurityPanelVariant =
40
- | { kind: "password"; hasPassword: boolean }
41
- | { kind: "sentence"; text: string };
42
-
43
- export interface SecurityPanelProps {
44
- /** `null`: the accounts read failed; `failed` renders in its place. */
45
- variant: SecurityPanelVariant | null;
46
- failed?: ReactNode;
47
- /** The session's own address — the only one a link is ever requested for. */
48
- email: string;
49
- /** The absolute reset page the emailed link returns to. */
50
- resetUrl: string;
51
- /**
52
- * A spoke's same-origin password route (#11162), which asks the hub to mail
53
- * the link; `null` asks Better Auth here.
54
- */
55
- passwordEndpoint: string | null;
56
- /** The locale the hub's set-password page renders in. */
57
- locale: string;
58
- /** A spoke's same-origin sign-out route; `null` signs out through Better Auth. */
59
- signOutEndpoint: string | null;
60
- /** The site's sign-in page, where Log out lands. */
61
- signInHref: string;
62
- labels: SecuritySettingsLabels;
63
- }
64
-
65
- export function SecurityPanel({
66
- variant,
67
- failed,
68
- email,
69
- resetUrl,
70
- passwordEndpoint,
71
- locale,
72
- signOutEndpoint,
73
- signInHref,
74
- labels,
75
- }: SecurityPanelProps): ReactElement {
76
- const router = useRouter();
77
-
78
- async function requestLink(): Promise<boolean> {
79
- if (passwordEndpoint !== null) {
80
- // The person is the sealed session's, never a body field; only the
81
- // route's 202 is a sent link.
82
- try {
83
- const res = await fetch(passwordEndpoint, {
84
- method: "POST",
85
- credentials: "same-origin",
86
- headers: { "content-type": "application/json" },
87
- body: JSON.stringify({ locale }),
88
- });
89
- return res.status === 202;
90
- } catch {
91
- return false;
92
- }
93
- }
94
- // A refusal (the rate limit, the method off) resolves with `{ error }`; a
95
- // network failure rejects. Both read as not sent.
96
- return authClient.requestPasswordReset({ email, redirectTo: resetUrl }).then(
97
- (res) => !res?.error,
98
- () => false,
99
- );
100
- }
101
-
102
- async function logOut(): Promise<boolean> {
103
- let ok: boolean;
104
- try {
105
- if (signOutEndpoint !== null) {
106
- const res = await fetch(signOutEndpoint, { method: "POST", credentials: "same-origin" });
107
- ok = res.ok;
108
- } else {
109
- const res = await authClient.signOut();
110
- ok = !res?.error;
111
- }
112
- } catch {
113
- ok = false;
114
- }
115
- // A failed log-out leaves the person signed in: navigate nowhere.
116
- if (!ok) return false;
117
- router.push(signInHref);
118
- router.refresh();
119
- return true;
120
- }
121
-
122
- const signIn: SecuritySignIn | null =
123
- variant === null
124
- ? null
125
- : variant.kind === "password"
126
- ? { kind: "password", hasPassword: variant.hasPassword, onRequestLink: requestLink }
127
- : variant;
128
-
129
- return <SecuritySettings signIn={signIn} failed={failed} onLogOut={logOut} labels={labels} />;
130
- }
@@ -1,92 +0,0 @@
1
- /**
2
- * account/security/security-source.ts (server code) — which sign-in variant
3
- * the member's Security tab shows (#8431 D2, spec
4
- * docs/specs/8431-account-security-tab-human-sign-spec.md; #11162).
5
- *
6
- * - hub — a spoke that signs in through its hub: whether this person
7
- * has a password, read live from the hub's
8
- * `GET /v1/hub-sign-in/me` with the session's own credential
9
- * (#11162). `null` when the hub answers no state — a hub
10
- * older than #11162, a refusal, a failed read — and the tab
11
- * shows its unavailable line, never a form.
12
- * - password — a site or hub that can email a password link
13
- * (`resetSendConfigured()`, C1): whether this person has a
14
- * password, from the session's own accounts.
15
- * - sentence — any other site: the deployment's configured methods.
16
- *
17
- * It tests no topology constant and imports nothing that loads `auth.ts`:
18
- * `sign-in-method.ts` and the generated seam stay the account tree's seams
19
- * (a hub-sign-in spoke drops `auth.ts`, and `spokeExclusions` refuses any
20
- * surviving account file that reaches it).
21
- *
22
- * The seam is read as a namespace, never by a named import: a site whose
23
- * seam was rendered before #8431 lacks the accounts reader (D2a), and a
24
- * Security route `sync-routes` copies into it must still compile. There it
25
- * shows the sentence — a retry cannot fix a stale seam (D2b).
26
- */
27
-
28
- import { hubSignIn } from "@working-theory/api-client";
29
-
30
- import { resetSendConfigured } from "../../../../../lib/auth-env";
31
- import * as seam from "../../../../../lib/topology.generated";
32
- import { logReadFailure } from "../account-data";
33
- import { signInMethod, type SignInMethodId } from "../sign-in-method";
34
-
35
- export type SecuritySource =
36
- /** `hasPassword: null` — the accounts read failed. */
37
- | { kind: "password"; hasPassword: boolean | null }
38
- | { kind: "sentence"; methods: SignInMethodId[] }
39
- /** `hasPassword: null` — the hub answered no state (#11162). */
40
- | { kind: "hub"; hasPassword: boolean | null };
41
-
42
- type OwnAccountsReader = (headers: Headers) => Promise<ReadonlyArray<{ providerId: string }> | null>;
43
-
44
- /** The account area's request init — on a hub-mode spoke, the credential as a Bearer header. */
45
- type HubReadInit = Parameters<typeof hubSignIn.me>[0];
46
-
47
- /** The seam's accounts reader (D2a), or `null` on a seam rendered before it existed. */
48
- function ownAccountsReader(): OwnAccountsReader | null {
49
- const reader: unknown = Reflect.get(seam, "readOwnAccounts");
50
- return typeof reader === "function" ? (reader as OwnAccountsReader) : null;
51
- }
52
-
53
- /**
54
- * Whether the hub's person has a password (#11162): `hasPassword` from the
55
- * hub's `me` read with the session's credential. `null` when there is no
56
- * credential to ask with, when the hub refuses it, when it answers without
57
- * the field (a hub older than #11162), or when the read fails.
58
- */
59
- async function hubPasswordState(init: HubReadInit | undefined): Promise<boolean | null> {
60
- if (init === undefined) return null;
61
- try {
62
- const res = await hubSignIn.me(init);
63
- if (!res.ok) return null;
64
- return typeof res.body.hasPassword === "boolean" ? res.body.hasPassword : null;
65
- } catch (err) {
66
- logReadFailure("security-hub", err);
67
- return null;
68
- }
69
- }
70
-
71
- export async function securitySource(
72
- headers: Headers,
73
- init: HubReadInit | undefined,
74
- ): Promise<SecuritySource> {
75
- const signIn = signInMethod();
76
- if (signIn.kind === "hub") {
77
- return { kind: "hub", hasPassword: await hubPasswordState(init) };
78
- }
79
- if (!resetSendConfigured()) return { kind: "sentence", methods: signIn.methods };
80
-
81
- const read = ownAccountsReader();
82
- if (read === null) return { kind: "sentence", methods: signIn.methods };
83
- try {
84
- const accounts = await read(headers);
85
- // `null` is a topology with no local accounts, which never reaches here.
86
- if (accounts === null) return { kind: "password", hasPassword: null };
87
- return { kind: "password", hasPassword: accounts.some((a) => a.providerId === "credential") };
88
- } catch (err) {
89
- logReadFailure("security-password", err);
90
- return { kind: "password", hasPassword: null };
91
- }
92
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * /[locale]/account/settings — redirects to User settings › General (#8232,
3
- * spec docs/specs/8232-member-settings-account-general-and-spec.md D8).
4
- *
5
- * Settings is four tabs since #8339 — General · Security · Notifications ·
6
- * Billing — and this one-page, anchored route (#7430) only forwards. A URL
7
- * fragment never reaches the server, so `#billing` cannot be redirected
8
- * here: the browser carries it across this redirect, and General's
9
- * `BillingAnchor` sends it on to Billing; `#general` lands on General as it
10
- * is. The hub's authorize step still sends an unverified person here
11
- * (`VERIFY_EMAIL_PATH`), and this redirect carries them on.
12
- */
13
-
14
- import { localeHref } from "@working-theory/ui";
15
- import { redirect } from "next/navigation";
16
-
17
- interface Props {
18
- params: Promise<{ locale: string }>;
19
- }
20
-
21
- export default async function AccountSettingsPage({ params }: Props): Promise<never> {
22
- const { locale } = await params;
23
- redirect(localeHref(locale, "/account/general"));
24
- }
@@ -1,121 +0,0 @@
1
- /**
2
- * settings-frame.tsx — User settings' four tabs, General · Security ·
3
- * Notifications · Billing (#8339 D7; builds on #8232 D1).
4
- *
5
- * `memberSettingsFrame` supplies the member's half of the shared
6
- * `AccountSettingsFrame` (@working-theory/templates/account, spec 8339 D2):
7
- * `standalone: true` — the Admin's shape, full height and flush, because the
8
- * account layout renders these routes outside its AppShell (#8430) — Back to
9
- * the Inbox, and the tabs of `SETTINGS_ROUTES`. Every member settings page
10
- * calls it and renders the result through `AccountSettingsFrame` (General,
11
- * via the shared `AccountSettings`) or directly (Security, Notifications,
12
- * Billing).
13
- *
14
- * `SettingsSection` is the shape a contributed section
15
- * (`accountSettingsSections`, `accountBillingSections`) and Billing's own
16
- * trailing content take; since #11167 the pane draws every group as a card,
17
- * so the section carries no top rule of its own.
18
- *
19
- * #8441 — `SETTINGS_ROUTES` is the ONE place the settings routes are named:
20
- * the tabs here and `isSettingsPath` (which `account-frame.tsx` takes these
21
- * routes out of its shell with) both read it, so a tab added here is a tab
22
- * that renders outside the shell — never a second `<main>` nested in the
23
- * shell's. Adding a tab is one line here (plus its page and message).
24
- */
25
-
26
- import type { AccountSettingsFrameProps, AccountSettingsTab } from "@working-theory/templates/account";
27
- import { localeHref } from "@working-theory/ui";
28
- import { Heading, Icon, Text } from "@working-theory/ui/primitives";
29
- import { Bell, CreditCard, Lock, ShieldCheck, UserRound } from "lucide-react";
30
- import type { ReactElement, ReactNode } from "react";
31
-
32
- /** The `next-intl` translator General/Security/Notifications/Billing each
33
- * hold. Widened from `getTranslations`'s own literal-key-checked type (the
34
- * `AccountTranslate` idiom, `account-data.ts`) — a settings page's own
35
- * string keys are static, but the function is shared across four route
36
- * files with four different generic instantiations. Call sites cast their
37
- * own `t` with `as unknown as Translate`. */
38
- export type Translate = (key: string, values?: Record<string, unknown>) => string;
39
-
40
- /** User settings' tabs, in the reference's order (#8339 D7; #8438 D14 adds
41
- * Privacy before Billing) — each one a route that renders outside the
42
- * account shell (#8430, #8441). */
43
- export const SETTINGS_ROUTES = [
44
- { key: "general", path: "/account/general", titleKey: "settings.general.title", icon: UserRound },
45
- { key: "security", path: "/account/security", titleKey: "settings.security.title", icon: ShieldCheck },
46
- { key: "notifications", path: "/account/notifications", titleKey: "settings.notifications.title", icon: Bell },
47
- { key: "privacy", path: "/account/privacy", titleKey: "settings.privacy.title", icon: Lock },
48
- { key: "billing", path: "/account/billing", titleKey: "settings.billing.title", icon: CreditCard },
49
- ] as const;
50
-
51
- export type SettingsTabKey = (typeof SETTINGS_ROUTES)[number]["key"];
52
-
53
- /** Whether `pathname` is one of `SETTINGS_ROUTES`: the request locale's
54
- * `/<locale>` prefix removed, then the rest compared whole — so a sub-route
55
- * (`/account/billing/history`) is not a settings route unless it is listed. */
56
- export function isSettingsPath(pathname: string, locale: string): boolean {
57
- const prefix = `/${locale}`;
58
- const bare =
59
- pathname === prefix || pathname.startsWith(`${prefix}/`) ? pathname.slice(prefix.length) : pathname;
60
- return SETTINGS_ROUTES.some(({ path }) => path === bare);
61
- }
62
-
63
- /** The member's half of `AccountSettingsFrameProps` — every settings page's
64
- * `frame` prop, less `name` (the caller's own session) and `children`. */
65
- export function memberSettingsFrame(
66
- locale: string,
67
- t: Translate,
68
- active: SettingsTabKey,
69
- ): Omit<AccountSettingsFrameProps, "name" | "children"> {
70
- const tabs: readonly AccountSettingsTab[] = SETTINGS_ROUTES.map(({ key, path, titleKey, icon }) => ({
71
- key,
72
- label: t(titleKey),
73
- href: localeHref(locale, path),
74
- icon: <Icon icon={icon} size="sm" decorative className="shrink-0" />,
75
- }));
76
-
77
- return {
78
- standalone: true,
79
- back: { label: t("settings.back"), href: localeHref(locale, "/account") },
80
- railLabel: t("settings.title"),
81
- accountLabel: t("settings.account"),
82
- menuLabel: t("settings.menu"),
83
- closeMenuLabel: t("settings.closeMenu"),
84
- tabs,
85
- active,
86
- };
87
- }
88
-
89
- /** The section role DESIGN.md §5.12 names: a title, a muted subtitle, then the fields — one card of the pane (#11167). */
90
- export function SettingsSection({
91
- id,
92
- title,
93
- lead,
94
- children,
95
- }: {
96
- id: string;
97
- title: string;
98
- lead?: string;
99
- children: ReactNode;
100
- }): ReactElement {
101
- return (
102
- <section
103
- id={id}
104
- aria-labelledby={`${id}-title`}
105
- className="flex scroll-mt-8 flex-col gap-4"
106
- data-testid={`account-settings-${id}`}
107
- >
108
- <div>
109
- <Heading level={2} visual={4} id={`${id}-title`}>
110
- {title}
111
- </Heading>
112
- {lead ? (
113
- <Text as="p" variant="body-sm" tone="muted" className="mt-1">
114
- {lead}
115
- </Text>
116
- ) : null}
117
- </div>
118
- {children}
119
- </section>
120
- );
121
- }
@@ -1,37 +0,0 @@
1
- /**
2
- * account/sign-in-method.ts (server code) — how a member signs in, for User settings ›
3
- * Security's sign-in block (#8232, spec
4
- * docs/specs/8232-member-settings-account-general-and-spec.md D7).
5
- *
6
- * One of the account tree's TWO topology seams (roadmap D1; the other is
7
- * `billing-source.ts`): no other file under the account tree tests
8
- * `SIGN_IN_PROVIDER`, `TOPOLOGY` or `SIGN_IN_ENABLED`.
9
- *
10
- * - A spoke that signs in through its hub (`SIGN_IN_PROVIDER === "hub"`,
11
- * #7894) answers `hub`, with the hub's host when it is configured.
12
- * - Any other site answers `site`, with the sign-in methods this deployment
13
- * has configured. Better Auth's session does not say which one this
14
- * member used, so the list is the deployment's (C7).
15
- */
16
-
17
- import { getActiveProviderIds } from "../../../../lib/auth-env";
18
- import { hubSessionConfig } from "../../../../lib/hub-session/config";
19
- import { SIGN_IN_PROVIDER } from "../../../../lib/topology.generated";
20
-
21
- /** The sign-in methods General names, in the order it lists them. */
22
- export const SIGN_IN_METHODS = ["google", "github", "magic-link", "email"] as const;
23
-
24
- export type SignInMethodId = (typeof SIGN_IN_METHODS)[number];
25
-
26
- export type SignInMethod =
27
- | { kind: "hub"; hubHost: string | null }
28
- | { kind: "site"; methods: SignInMethodId[] };
29
-
30
- export function signInMethod(): SignInMethod {
31
- if (SIGN_IN_PROVIDER === "hub") {
32
- const config = hubSessionConfig();
33
- return { kind: "hub", hubHost: config === null ? null : new URL(config.hubOrigin).host };
34
- }
35
- const active = new Set(getActiveProviderIds());
36
- return { kind: "site", methods: SIGN_IN_METHODS.filter((id) => active.has(id)) };
37
- }
@@ -1,60 +0,0 @@
1
- /**
2
- * /[locale]/account/support — Contact support (#7430, spec 7423 U4 · D11).
3
- *
4
- * RSC, inside the account layout's SignedInShell. Reached from the help
5
- * menu (the rail's ? and the phone tab bar's Help), never a rail row (D13).
6
- * The form files a contact lead of kind `support` with the session's email,
7
- * so it lands in the admin Inbox as a message; the reply goes to that email.
8
- */
9
-
10
- import { Heading, Text } from "@working-theory/ui/primitives";
11
- import type { Metadata } from "next";
12
- import { getTranslations } from "next-intl/server";
13
- import type { ReactElement } from "react";
14
-
15
- import { accountSession } from "../account-data";
16
-
17
- import { SupportForm } from "./support-form";
18
-
19
- interface Props {
20
- params: Promise<{ locale: string }>;
21
- }
22
-
23
- export async function generateMetadata({ params }: Props): Promise<Metadata> {
24
- const { locale } = await params;
25
- const t = await getTranslations({ locale, namespace: "account" });
26
- return { title: t("support.title") };
27
- }
28
-
29
- export default async function AccountSupportPage({ params }: Props): Promise<ReactElement> {
30
- const { locale } = await params;
31
- const t = await getTranslations({ locale, namespace: "account" });
32
- const session = await accountSession(locale);
33
-
34
- return (
35
- <div className="flex max-w-3xl flex-col gap-8 py-8" data-testid="account-support">
36
- <div>
37
- <Heading level={1} visual={2}>
38
- {t("support.title")}
39
- </Heading>
40
- {session ? (
41
- <Text as="p" variant="body-sm" tone="muted" className="mt-block-tight">
42
- {t("support.lead", { email: session.ctx.user.email })}
43
- </Text>
44
- ) : null}
45
- </div>
46
- <SupportForm
47
- labels={{
48
- subject: t("support.subject"),
49
- message: t("support.message"),
50
- submit: t("support.submit"),
51
- submitting: t("support.submitting"),
52
- required: t("support.required"),
53
- success: t("support.success"),
54
- error: t("support.error"),
55
- unavailable: t("support.unavailable"),
56
- }}
57
- />
58
- </div>
59
- );
60
- }