create-ailk 0.37.1 → 0.38.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 (230) 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 +18 -11
  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 +9 -15
  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 +67 -0
  26. package/dist/routes.d.ts +103 -0
  27. package/dist/routes.js +708 -0
  28. package/dist/site-manifest.js +1 -1
  29. package/dist/site-roster.d.ts +2 -1
  30. package/dist/site-roster.js +30 -8
  31. package/dist/spoke-checkout.d.ts +28 -27
  32. package/dist/spoke-checkout.js +71 -102
  33. package/dist/surfaces.d.ts +18 -0
  34. package/dist/surfaces.js +47 -282
  35. package/dist/sync-routes.d.ts +14 -1
  36. package/dist/sync-routes.js +86 -5
  37. package/dist/topology.d.ts +15 -1
  38. package/dist/topology.js +20 -4
  39. package/dist/update.d.ts +17 -2
  40. package/dist/update.js +480 -77
  41. package/package.json +3 -3
  42. package/templates/README.md +1 -1
  43. package/templates/apps/mcp/CLAUDE.md +5 -3
  44. package/templates/apps/web/CLAUDE.md +62 -20
  45. package/templates/apps/web/account.config.tsx +101 -0
  46. package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +3 -161
  47. package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +3 -139
  48. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +3 -406
  49. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +2 -190
  50. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +3 -182
  51. package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +8 -420
  52. package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +1 -1
  53. package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +8 -214
  54. package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +8 -115
  55. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +2 -80
  56. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +8 -121
  57. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +3 -154
  58. package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +7 -149
  59. package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +3 -143
  60. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +3 -126
  61. package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +8 -302
  62. package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +2 -102
  63. package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +3 -240
  64. package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +3 -131
  65. package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +2 -24
  66. package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +3 -60
  67. package/templates/apps/web/app/[locale]/layout.tsx +45 -28
  68. package/templates/apps/web/app/apple-icon.tsx +72 -0
  69. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +22 -12
  70. package/templates/apps/web/app/og/__tests__/__snapshots__/card.test.tsx.snap +3 -0
  71. package/templates/apps/web/app/og/__tests__/card.test.tsx +129 -0
  72. package/templates/apps/web/app/og/__tests__/route.test.ts +3 -4
  73. package/templates/apps/web/app/og/route.tsx +155 -72
  74. package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +12 -0
  75. package/templates/apps/web/i18n/request.ts +44 -1
  76. package/templates/apps/web/jest.config.cjs +13 -1
  77. package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
  78. package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +70 -0
  79. package/templates/apps/web/lib/__tests__/nav-label-keys.test.ts +14 -0
  80. package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +148 -61
  81. package/templates/apps/web/lib/__tests__/served-pages.test.ts +77 -0
  82. package/templates/apps/web/lib/__tests__/server-api.test.ts +37 -5
  83. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +26 -13
  84. package/templates/apps/web/lib/listings.tsx +2 -2
  85. package/templates/apps/web/lib/nav-label-keys.ts +16 -2
  86. package/templates/apps/web/lib/paid-section-contracts.ts +35 -6
  87. package/templates/apps/web/lib/paid-sections.generated.ts +8 -0
  88. package/templates/apps/web/lib/profile-back-link.ts +105 -32
  89. package/templates/apps/web/lib/served-pages.ts +95 -0
  90. package/templates/apps/web/lib/site-brand.tsx +3 -5
  91. package/templates/apps/web/messages/en.json +8 -684
  92. package/templates/apps/web/middleware.ts +3 -1
  93. package/templates/apps/web/next.config.mjs +27 -0
  94. package/templates/apps/web/package.json +1 -0
  95. package/templates/customizations.yaml +9 -0
  96. package/templates/package.json +3 -1
  97. package/templates/tools/lint-architecture.ts +164 -11
  98. package/versions.json +48 -47
  99. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/account-frame-sign-out.test.tsx +0 -175
  100. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +0 -301
  101. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +0 -515
  102. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +0 -883
  103. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +0 -758
  104. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +0 -264
  105. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +0 -167
  106. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +0 -730
  107. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +0 -355
  108. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +0 -97
  109. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +0 -375
  110. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +0 -323
  111. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +0 -1208
  112. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +0 -418
  113. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +0 -462
  114. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +0 -63
  115. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -406
  116. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +0 -93
  117. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +0 -208
  118. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +0 -340
  119. package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +0 -182
  120. package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +0 -353
  121. package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +0 -57
  122. package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +0 -58
  123. package/templates/apps/web/app/[locale]/(authed)/account/agreements-gate.ts +0 -61
  124. package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +0 -184
  125. package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +0 -426
  126. package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +0 -76
  127. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +0 -65
  128. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +0 -172
  129. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +0 -333
  130. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +0 -936
  131. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +0 -193
  132. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +0 -476
  133. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +0 -184
  134. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +0 -197
  135. package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +0 -99
  136. package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +0 -123
  137. package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +0 -303
  138. package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +0 -274
  139. package/templates/apps/web/app/[locale]/(authed)/account/error-row.tsx +0 -35
  140. package/templates/apps/web/app/[locale]/(authed)/account/for-you-labels.ts +0 -36
  141. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +0 -215
  142. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +0 -65
  143. package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +0 -36
  144. package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +0 -27
  145. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +0 -149
  146. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +0 -42
  147. package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +0 -132
  148. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +0 -122
  149. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +0 -215
  150. package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +0 -73
  151. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +0 -107
  152. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +0 -87
  153. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +0 -215
  154. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +0 -43
  155. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +0 -88
  156. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +0 -31
  157. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +0 -35
  158. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +0 -266
  159. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +0 -116
  160. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +0 -12
  161. package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +0 -219
  162. package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +0 -365
  163. package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +0 -86
  164. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +0 -120
  165. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +0 -322
  166. package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +0 -173
  167. package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +0 -103
  168. package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +0 -116
  169. package/templates/apps/web/app/[locale]/(authed)/account/retry-button.tsx +0 -27
  170. package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +0 -258
  171. package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +0 -130
  172. package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +0 -92
  173. package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +0 -121
  174. package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +0 -37
  175. package/templates/apps/web/app/[locale]/(authed)/account/support/support-form.tsx +0 -98
  176. package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +0 -100
  177. package/templates/apps/web/app/[locale]/checkout/__tests__/pages.test.tsx +0 -139
  178. package/templates/apps/web/app/[locale]/checkout/__tests__/thank-you-account.test.tsx +0 -146
  179. package/templates/apps/web/app/[locale]/checkout/thank-you/page.tsx +0 -114
  180. package/templates/apps/web/app/[locale]/checkout/unavailable/page.tsx +0 -51
  181. package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +0 -614
  182. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +0 -43
  183. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +0 -214
  184. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +0 -197
  185. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +0 -286
  186. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +0 -520
  187. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +0 -376
  188. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +0 -306
  189. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/account-invite.actions.test.ts +0 -69
  190. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +0 -398
  191. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +0 -704
  192. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +0 -173
  193. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +0 -141
  194. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/verify.test.tsx +0 -249
  195. package/templates/apps/web/app/[locale]/flows/[slug]/account-invite.actions.ts +0 -35
  196. package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +0 -92
  197. package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +0 -177
  198. package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +0 -472
  199. package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +0 -48
  200. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +0 -100
  201. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +0 -99
  202. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -820
  203. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -203
  204. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +0 -194
  205. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +0 -284
  206. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +0 -302
  207. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +0 -402
  208. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/landing.test.tsx +0 -293
  209. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -485
  210. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +0 -231
  211. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/checkout-seam.ts +0 -74
  212. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +0 -36
  213. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -420
  214. package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +0 -85
  215. package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +0 -91
  216. package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +0 -32
  217. package/templates/apps/web/app/[locale]/flows/[slug]/verify/page.tsx +0 -153
  218. package/templates/apps/web/app/[locale]/flows/[slug]/verify.actions.ts +0 -151
  219. package/templates/apps/web/app/[locale]/meet/confirmed/BookingHandOff.tsx +0 -128
  220. package/templates/apps/web/app/[locale]/meet/confirmed/__tests__/BookingHandOff.test.tsx +0 -126
  221. package/templates/apps/web/app/[locale]/purchase/__tests__/cancel.test.tsx +0 -162
  222. package/templates/apps/web/app/[locale]/purchase/__tests__/module-scope.test.ts +0 -68
  223. package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +0 -411
  224. package/templates/apps/web/app/[locale]/purchase/cancel/page.tsx +0 -115
  225. package/templates/apps/web/app/[locale]/purchase/success/page.tsx +0 -348
  226. package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
  227. package/templates/apps/web/lib/account-config.ts +0 -678
  228. package/templates/apps/web/lib/checkout-config.ts +0 -16
  229. package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
  230. package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
@@ -1,154 +1,3 @@
1
- /**
2
- * /[locale]/account/invitations/[invitationId] — accept an invitation to an
3
- * organization (#11106, spec
4
- * docs/specs/11106-the-workforce-foundation-roles-by-spec.md D5; AC-3).
5
- *
6
- * The mailed link is `/sign-in?next=/account/invitations/<id>&email=<address>`:
7
- * a signed-out visitor lands on `/sign-in` with the invited address already
8
- * filled, and this page sits under `(authed)`, whose gate redirects any other
9
- * signed-out visit to `/sign-in?next=…`. Signed in, the page reads the
10
- * invitation (`readInvitation`), which the API answers only for the invited,
11
- * VERIFIED address:
12
- *
13
- * - pending: the organization, the inviter and the role, and Accept — a
14
- * form POST to `acceptInvitation`, which creates the Membership and
15
- * returns here with `?joined=1`. A GET of this page writes nothing;
16
- * - another address: "This invitation is for a different email address.
17
- * Sign out and sign in with the invited address.";
18
- * - no such invitation, or a build without the invitation routes (404):
19
- * `notFound()`;
20
- * - accepted, expired or no longer open: one line saying so.
21
- *
22
- * After joining, the person reaches the Admin through its own sign-in, which
23
- * now admits them. Every string is an `account.invitation.*` message.
24
- */
25
-
26
- import { Button, Container, Heading, InlineMessage, Text } from "@working-theory/ui/primitives";
27
- import type { Metadata } from "next";
28
- import { notFound } from "next/navigation";
29
- import { getTranslations } from "next-intl/server";
30
- import type { ReactElement, ReactNode } from "react";
31
-
32
- import { acceptInvitation, readInvitation } from "./actions";
33
- import { isInvitationId } from "./invitation-id";
34
-
35
- interface Props {
36
- params: Promise<{ locale: string; invitationId: string }>;
37
- searchParams: Promise<{ joined?: string | string[]; error?: string | 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("invitation.accept"), robots: { index: false, follow: false } };
44
- }
45
-
46
- /** `?error=` → its line's key; an unknown value is the generic failure. */
47
- const ERROR_KEYS = {
48
- invitation_for_another_address: "invitation.otherAddress",
49
- invitation_not_pending: "invitation.notPending",
50
- invitation_expired: "invitation.expired",
51
- invitation_void: "invitation.void",
52
- already_member: "invitation.alreadyMember",
53
- } as const;
54
-
55
- function errorKeyFor(
56
- error: string | string[] | undefined,
57
- ): (typeof ERROR_KEYS)[keyof typeof ERROR_KEYS] | "invitation.failed" | null {
58
- if (typeof error !== "string") return null;
59
- return Object.hasOwn(ERROR_KEYS, error)
60
- ? ERROR_KEYS[error as keyof typeof ERROR_KEYS]
61
- : "invitation.failed";
62
- }
63
-
64
- function Frame({ children }: { children: ReactNode }): ReactElement {
65
- return (
66
- <Container className="py-section">
67
- <div className="flex max-w-prose flex-col gap-4" data-testid="account-invitation">
68
- {children}
69
- </div>
70
- </Container>
71
- );
72
- }
73
-
74
- export default async function AccountInvitationPage({
75
- params,
76
- searchParams,
77
- }: Props): Promise<ReactElement> {
78
- const { locale, invitationId } = await params;
79
- const { joined, error } = await searchParams;
80
- if (!isInvitationId(invitationId)) notFound();
81
- const t = await getTranslations({ locale, namespace: "account" });
82
- const read = await readInvitation(invitationId);
83
-
84
- if (read.kind === "not_found") notFound();
85
- if (read.kind === "other_address" || read.kind === "failed") {
86
- return (
87
- <Frame>
88
- <InlineMessage
89
- variant="error"
90
- role="alert"
91
- data-testid={read.kind === "other_address" ? "account-invitation-other-address" : "account-invitation-failed"}
92
- >
93
- {t(read.kind === "other_address" ? "invitation.otherAddress" : "invitation.failed")}
94
- </InlineMessage>
95
- </Frame>
96
- );
97
- }
98
-
99
- const { invitation } = read;
100
- const organization = invitation.organizationName;
101
-
102
- if (invitation.status === "accepted" && joined === "1") {
103
- return (
104
- <Frame>
105
- <div data-testid="account-invitation-joined">
106
- <Heading level={1} visual={3}>
107
- {t("invitation.joined", { organization })}
108
- </Heading>
109
- </div>
110
- <Text as="p" variant="body" tone="muted">
111
- {t("invitation.joinedLead")}
112
- </Text>
113
- </Frame>
114
- );
115
- }
116
-
117
- const expired =
118
- invitation.expiresAt !== null && Date.parse(invitation.expiresAt) <= Date.now();
119
- if (invitation.status !== "pending" || expired) {
120
- return (
121
- <Frame>
122
- <InlineMessage variant="default" role="status" data-testid="account-invitation-closed">
123
- {t(expired && invitation.status === "pending" ? "invitation.expired" : "invitation.notPending")}
124
- </InlineMessage>
125
- </Frame>
126
- );
127
- }
128
-
129
- const role = t(`invitation.roles.${invitation.role}`);
130
- const errorKey = errorKeyFor(error);
131
-
132
- return (
133
- <Frame>
134
- <Heading level={1} visual={3}>
135
- {t("invitation.title", { organization })}
136
- </Heading>
137
- <Text as="p" variant="body" data-testid="account-invitation-lead">
138
- {invitation.inviterName
139
- ? t("invitation.lead", { inviter: invitation.inviterName, organization, role })
140
- : t("invitation.leadNoInviter", { organization, role })}
141
- </Text>
142
- {errorKey ? (
143
- <InlineMessage variant="error" role="alert" data-testid="account-invitation-error">
144
- {t(errorKey)}
145
- </InlineMessage>
146
- ) : null}
147
- <form action={acceptInvitation.bind(null, invitationId, locale)} data-testid="account-invitation-form">
148
- <Button type="submit" size="big" data-testid="account-invitation-accept">
149
- {t("invitation.accept")}
150
- </Button>
151
- </form>
152
- </Frame>
153
- );
154
- }
1
+ // Generated by create-ailk routes from @working-theory/account 0.61.0 — do not edit.
2
+ export { default } from "@working-theory/account/invitations/[invitationId]/page";
3
+ export { generateMetadata } from "@working-theory/account/invitations/[invitationId]/page";
@@ -1,152 +1,10 @@
1
- /**
2
- * The account layout — the base account area's frame (#7430, spec 7423 U4 ·
3
- * D4, D13; DESIGN.md §2b).
4
- *
5
- * RSC. Every `/account` route but the four Settings tabs renders inside
6
- * `SignedInShell` (through the client `AccountFrame`; the tabs draw their own
7
- * standalone settings frame, #8430): the site's logo as the rail's top tile, linking
8
- * home; the rail's rows — Inbox, a Library group holding Artifacts and
9
- * Appointments (#8231 D1, #11154); a footer of the avatar and ? alone;
10
- * the card avatar menu (name, then Settings and Log out); the ? help menu
11
- * (Contact support, and Help center when `AILK_HELP_CENTER_URL` is set);
12
- * and below `md` a tab bar reading avatar · Inbox · For you · Help (#7469).
13
- * The locale layout renders no marketing frame and no consent Banner on
14
- * these paths (D4, `isAccountPath`).
15
- *
16
- * The aside is the For-you panel, fed by `accountForYouSources` plus the
17
- * area's own "Add your name" item (`loadForYou`, deduped per request with
18
- * the Inbox's phone For you tab); with no items there is no aside.
19
- *
20
- * #8465 — `SIGN_OUT_ENDPOINT` (set only on a spoke that signs in through its
21
- * hub) rides down as a prop; the client frame cannot import the generated
22
- * seam. After that sign-out the frame lands on the site's home (#11095 D4):
23
- * the spoke's `/account` would sign the person straight back in while their
24
- * hub session lives.
25
- *
26
- * The `(authed)` layout above owns the signed-out gate, so a missing session
27
- * here is a race (it expired between the two layouts): the page renders
28
- * unframed and degrades on its own.
29
- *
30
- * #8765 D7 — after the session check the layout reads the caller's
31
- * account-level sign-up agreements (`GET /v1/consent/account`). While any
32
- * is not current, it returns `AgreementsInterstitial` IN PLACE of the frame
33
- * and its children, so no account page loads behind it. It fails closed
34
- * (SEC-8765-C): any answer but a 2xx or a 404 — a thrown read, a 401, 403,
35
- * 429 or 5xx — shows the interstitial from the web's own copy of the
36
- * registry, with the "new" title, and logs `read_failed`. Only a 404, an
37
- * older hub with no such route, renders the account as before. The gate is
38
- * on the account area's pages, never the member API (SEC-8765-L).
39
- */
1
+ // Generated by create-ailk routes from @working-theory/account 0.61.0 — do not edit.
2
+ import Page from "@working-theory/account/layout";
40
3
 
41
- import { localeHref } from "@working-theory/ui";
42
- import { getTranslations } from "next-intl/server";
43
- import type { ReactElement, ReactNode } from "react";
4
+ import config from "../../../../account.config";
44
5
 
45
- import { siteLogo } from "../../../../lib/site-logo";
46
- import { SIGN_OUT_ENDPOINT } from "../../../../lib/topology.generated";
47
-
48
- import { accountSession, loadForYou } from "./account-data";
49
- import { AccountFrame } from "./account-frame";
50
- import { outstandingAgreements } from "./agreements-gate";
51
- import { AgreementsInterstitial } from "./agreements-prompt";
52
- import { forYouLabels } from "./for-you-labels";
53
-
54
- /** The value when it parses as an https URL, else undefined: operator config is rendered as an href. */
55
- function httpsUrl(value: string | undefined): string | undefined {
56
- if (!value) return undefined;
57
- try {
58
- return new URL(value).protocol === "https:" ? value : undefined;
59
- } catch {
60
- return undefined;
61
- }
62
- }
63
-
64
- interface Props {
65
- children: ReactNode;
66
- params: Promise<{ locale: string }>;
67
- }
68
-
69
- export default async function AccountLayout({
70
- children,
71
- params,
72
- }: Props): Promise<ReactElement> {
73
- const { locale } = await params;
74
- const session = await accountSession(locale);
75
- if (!session) return <>{children}</>;
76
-
77
- const t = await getTranslations({ locale, namespace: "account" });
78
- const signOutProps = SIGN_OUT_ENDPOINT
79
- ? {
80
- signOutEndpoint: SIGN_OUT_ENDPOINT,
81
- signInHref: localeHref(locale, "/"),
82
- }
83
- : {};
84
-
85
- const outstanding = await outstandingAgreements(session.ctx);
86
- if (outstanding.length > 0) {
87
- return (
88
- <AgreementsInterstitial
89
- locale={locale}
90
- agreements={outstanding}
91
- {...signOutProps}
92
- labels={{
93
- titleNew: t("agreements.titleNew"),
94
- titleUpdated: t("agreements.titleUpdated"),
95
- lead: t("agreements.lead"),
96
- accept: t("agreements.accept"),
97
- signOut: t("agreements.signOut"),
98
- error: t("agreements.error"),
99
- signOutFailed: t("frame.signOutFailed"),
100
- }}
101
- />
102
- );
103
- }
104
-
105
- const forYou = await loadForYou(locale);
106
- const { name, email } = session.ctx.user;
107
- const helpCenterUrl = httpsUrl(process.env.AILK_HELP_CENTER_URL);
108
-
109
- return (
110
- <AccountFrame
111
- locale={locale}
112
- user={{ name: name ?? email, email }}
113
- logo={siteLogo()}
114
- helpItems={[
115
- {
116
- id: "support",
117
- label: t("frame.contactSupport"),
118
- href: localeHref(locale, "/account/support"),
119
- },
120
- ...(helpCenterUrl
121
- ? [{ id: "help-center", label: t("frame.helpCenter"), href: helpCenterUrl }]
122
- : []),
123
- ]}
124
- forYou={{ items: forYou.items, now: forYou.now, labels: forYouLabels(session.ctx.t) }}
125
- {...signOutProps}
126
- labels={{
127
- home: t("frame.home"),
128
- inbox: t("frame.inbox"),
129
- forYou: t("frame.forYou"),
130
- settings: t("frame.settings"),
131
- library: t("frame.library"),
132
- artifacts: t("frame.artifacts"),
133
- appointments: t("frame.appointments"),
134
- signOutFailed: t("frame.signOutFailed"),
135
- signOut: t("frame.signOut"),
136
- help: t("frame.help"),
137
- accountMenu: t("frame.accountMenu"),
138
- tabBar: t("frame.tabBar"),
139
- sidebar: t("frame.sidebar"),
140
- collapseSidebar: t("frame.collapseSidebar"),
141
- expandSidebar: t("frame.expandSidebar"),
142
- collapseAside: t("frame.collapseAside"),
143
- expandAside: t("frame.expandAside"),
144
- aside: t("forYou.title"),
145
- openAside: t("frame.openAside"),
146
- closeAside: t("frame.closeAside"),
147
- }}
148
- >
149
- {children}
150
- </AccountFrame>
151
- );
6
+ export default async function Route(
7
+ props: Omit<Parameters<typeof Page>[0], "config">,
8
+ ) {
9
+ return Page({ ...props, config });
152
10
  }
@@ -1,143 +1,3 @@
1
- /**
2
- * /[locale]/account/notifications — User settings › Notifications (#8339
3
- * D8; #8438 D15 — what we send you; #11163 — Ploy's three-row shape).
4
- *
5
- * RSC, outside the account layout's SignedInShell (#8430), in the member's
6
- * settings frame (D7) — standalone, the Admin's shape. Always renders
7
- * (decision A, operator 2026-10-12): a `ConsentSwitchList` of the site
8
- * registry's `area: "communications"` purposes (`consent` and
9
- * `preference`), each read from `GET /v1/member/consents`'s OWN state and
10
- * `effective` default (no row ⇒ on for a preference, off for a consent).
11
- * With none declared, one `account-notifications-empty` line.
12
- *
13
- * A row is a TITLE, a one-line description and a switch (#11163, operator
14
- * 2026-11-08) — never the purpose's consent statement, which stays on the
15
- * form that collects it and in the ledger. The three registry purposes the
16
- * site ships are named by this app's own messages
17
- * (`settings.notifications.purposes.<id>`): Email notifications ·
18
- * Onboarding · Marketing, in registry order; a purpose a site adds is titled
19
- * by its registry description. Under the rows one muted line says what is
20
- * always sent.
21
- *
22
- * The cookie-settings link moved to Privacy (#8438 D14, C6) — this tab no
23
- * longer renders it.
24
- */
25
-
26
- import { member } from "@working-theory/api-client";
27
- import {
28
- AccountSettingsFrame,
29
- AccountSettingsPane,
30
- ConsentSwitchList,
31
- type ConsentSwitchRow,
32
- } from "@working-theory/templates/account";
33
- import {
34
- formatLocalTime,
35
- SERVER_TIME_ZONE,
36
- } from "@working-theory/ui/primitives";
37
- import {
38
- EMAIL_NOTIFICATIONS_PURPOSE_ID,
39
- NEWSLETTER_PURPOSE_ID,
40
- ONBOARDING_PURPOSE_ID,
41
- } from "@working-theory/validation";
42
- import type { Metadata } from "next";
43
- import { getTranslations } from "next-intl/server";
44
- import type { ReactElement } from "react";
45
-
46
- import { accountSession } from "../account-data";
47
- import { setConsentAction } from "../privacy/actions";
48
- import { memberSettingsFrame, type Translate } from "../settings-frame";
49
-
50
- /**
51
- * The registry purposes this app names itself (#11163): purpose id → the
52
- * `settings.notifications.purposes` key carrying its title and line.
53
- */
54
- const NAMED_PURPOSES = {
55
- [EMAIL_NOTIFICATIONS_PURPOSE_ID]: "email_notifications",
56
- [ONBOARDING_PURPOSE_ID]: "onboarding",
57
- [NEWSLETTER_PURPOSE_ID]: "newsletter",
58
- } as const;
59
-
60
- function isNamedPurpose(id: string): id is keyof typeof NAMED_PURPOSES {
61
- return Object.prototype.hasOwnProperty.call(NAMED_PURPOSES, id);
62
- }
63
-
64
- interface Props {
65
- params: Promise<{ locale: string }>;
66
- }
67
-
68
- export async function generateMetadata({ params }: Props): Promise<Metadata> {
69
- const { locale } = await params;
70
- const t = await getTranslations({ locale, namespace: "account" });
71
- return { title: t("settings.notifications.title"), description: t("settings.notifications.lead") };
72
- }
73
-
74
- export default async function AccountNotificationsPage({ params }: Props): Promise<ReactElement> {
75
- const { locale } = await params;
76
- const t = await getTranslations({ locale, namespace: "account" });
77
- const session = await accountSession(locale);
78
- const frame = memberSettingsFrame(locale, t as unknown as Translate, "notifications");
79
- const name = session?.ctx.user.name || session?.ctx.user.email || "";
80
-
81
- let rows: ConsentSwitchRow[] = [];
82
- let unavailable = false;
83
- if (session) {
84
- try {
85
- const res = await member.consents(session.ctx.init, { locale });
86
- if (res.ok) {
87
- rows = res.body.purposes
88
- .filter((purpose) => purpose.area === "communications")
89
- .map((purpose) => ({
90
- id: purpose.id,
91
- ...(isNamedPurpose(purpose.id)
92
- ? {
93
- label: t(`settings.notifications.purposes.${NAMED_PURPOSES[purpose.id]}.title`),
94
- description: t(
95
- `settings.notifications.purposes.${NAMED_PURPOSES[purpose.id]}.description`,
96
- ),
97
- }
98
- : { label: purpose.description }),
99
- granted: purpose.effective,
100
- ...(purpose.state
101
- ? {
102
- dateLine: purpose.state.granted
103
- ? t("settings.privacy.given", { date: formatDate(purpose.state.at, locale) })
104
- : t("settings.privacy.withdrawn", { date: formatDate(purpose.state.at, locale) }),
105
- }
106
- : {}),
107
- }));
108
- } else {
109
- unavailable = true;
110
- }
111
- } catch {
112
- unavailable = true;
113
- }
114
- }
115
-
116
- return (
117
- <AccountSettingsFrame {...frame} name={name}>
118
- <AccountSettingsPane
119
- id="account-settings-notifications"
120
- title={t("settings.notifications.title")}
121
- lead={t("settings.notifications.lead")}
122
- >
123
- {unavailable ? (
124
- <span data-testid="account-notifications-unavailable">{t("settings.privacy.unavailable")}</span>
125
- ) : (
126
- <ConsentSwitchList
127
- rows={rows}
128
- onChange={setConsentAction}
129
- emptyLine={t("settings.notifications.empty")}
130
- footLine={t("settings.notifications.alwaysSent")}
131
- testIdPrefix="account-notifications"
132
- />
133
- )}
134
- </AccountSettingsPane>
135
- </AccountSettingsFrame>
136
- );
137
- }
138
-
139
- // #11159: a `t()` argument is a string, so this RSC reads the day in the
140
- // server fallback zone — never the host's, which the unpinned form read.
141
- function formatDate(iso: string, locale: string): string {
142
- return formatLocalTime(iso, "date", { timeZone: SERVER_TIME_ZONE, locale });
143
- }
1
+ // Generated by create-ailk routes from @working-theory/account 0.61.0 — do not edit.
2
+ export { default } from "@working-theory/account/notifications/page";
3
+ export { generateMetadata } from "@working-theory/account/notifications/page";
@@ -1,126 +1,3 @@
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
- }
1
+ // Generated by create-ailk routes from @working-theory/account 0.61.0 — do not edit.
2
+ export { default } from "@working-theory/account/onboarding/page";
3
+ export { generateMetadata } from "@working-theory/account/onboarding/page";