create-ailk 0.36.0 → 0.37.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 (94) hide show
  1. package/component-catalog.json +40 -1
  2. package/component-catalog.md +7 -5
  3. package/dist/surfaces.js +60 -19
  4. package/dist/update.d.ts +19 -1
  5. package/dist/update.js +293 -35
  6. package/package.json +3 -3
  7. package/templates/.env.example +17 -0
  8. package/templates/apps/api/.env.example +38 -0
  9. package/templates/apps/api/CLAUDE.md +3 -0
  10. package/templates/apps/api/src/lib/__mocks__/prisma.ts +7 -0
  11. package/templates/apps/mcp/CLAUDE.md +1 -1
  12. package/templates/apps/web/CLAUDE.md +28 -1
  13. package/templates/apps/web/app/[locale]/(auth)/reset-password/__tests__/return.test.tsx +179 -0
  14. package/templates/apps/web/app/[locale]/(auth)/reset-password/page.tsx +22 -2
  15. package/templates/apps/web/app/[locale]/(auth)/reset-password/reset-password-card.tsx +9 -2
  16. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +240 -76
  17. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +242 -28
  18. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +369 -196
  19. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +26 -1
  20. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +17 -6
  21. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +51 -12
  22. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +17 -2
  23. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +153 -2
  24. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +206 -23
  25. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +150 -188
  26. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +235 -177
  27. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +63 -0
  28. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -3
  29. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +340 -0
  30. package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +7 -5
  31. package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +19 -3
  32. package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +8 -4
  33. package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +161 -0
  34. package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +426 -0
  35. package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +76 -0
  36. package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +139 -0
  37. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +92 -24
  38. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +32 -1
  39. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +76 -3
  40. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +290 -41
  41. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +109 -11
  42. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +43 -44
  43. package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +99 -0
  44. package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +123 -0
  45. package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +309 -113
  46. package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +192 -65
  47. package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +52 -7
  48. package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +36 -0
  49. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +70 -2
  50. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +42 -0
  51. package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +55 -58
  52. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +2 -1
  53. package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +73 -0
  54. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +12 -9
  55. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +18 -4
  56. package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +20 -2
  57. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +43 -0
  58. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +125 -0
  59. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +88 -0
  60. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +31 -0
  61. package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +3 -2
  62. package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +33 -8
  63. package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +31 -52
  64. package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +44 -4
  65. package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +69 -49
  66. package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +173 -0
  67. package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +42 -4
  68. package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +102 -0
  69. package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +147 -137
  70. package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +258 -0
  71. package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +18 -21
  72. package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +34 -6
  73. package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +37 -7
  74. package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +0 -2
  75. package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +8 -5
  76. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +3 -2
  77. package/templates/apps/web/app/api/auth/hub/password/__tests__/return.test.ts +86 -0
  78. package/templates/apps/web/app/api/auth/hub/password/__tests__/route.test.ts +368 -0
  79. package/templates/apps/web/app/api/auth/hub/password/return.ts +86 -0
  80. package/templates/apps/web/app/api/auth/hub/password/route.ts +171 -0
  81. package/templates/apps/web/app/api/hub-session/__tests__/routes.test.ts +263 -0
  82. package/templates/apps/web/app/api/hub-session/password/return/route.ts +69 -0
  83. package/templates/apps/web/app/api/hub-session/password/route.ts +106 -0
  84. package/templates/apps/web/lib/__tests__/account-config.test.ts +129 -1
  85. package/templates/apps/web/lib/__tests__/offerings-pricing.test.ts +33 -0
  86. package/templates/apps/web/lib/account-config.ts +132 -8
  87. package/templates/apps/web/lib/auth-routes.ts +11 -6
  88. package/templates/apps/web/lib/offerings-pricing.ts +4 -1
  89. package/templates/apps/web/messages/en.json +156 -80
  90. package/versions.json +48 -48
  91. package/templates/apps/web/app/[locale]/(authed)/account/components/schedule-service.tsx +0 -276
  92. package/templates/apps/web/app/[locale]/(authed)/account/components/send-message.tsx +0 -128
  93. package/templates/apps/web/app/[locale]/(authed)/account/settings/__tests__/theme-modes.test.ts +0 -42
  94. package/templates/apps/web/app/[locale]/(authed)/account/settings/theme-modes.ts +0 -40
@@ -0,0 +1,31 @@
1
+ "use server";
2
+
3
+ /**
4
+ * thread-write.ts — the member thread composer's post (#11152).
5
+ *
6
+ * The thread's composer has one field; the member write it runs is the
7
+ * EXISTING one — `sendMessage` (`../../new-actions.ts`, #8170's
8
+ * `member.sendMessage`, `POST /v1/member/messages`) — handed the body as
9
+ * typed and a subject cut from its first line (`threadSubject`). No new
10
+ * write, no new route: the message lands as the same inbound `Interaction`
11
+ * on the person's Person the retired lightbox wrote, so the Admin's thread
12
+ * for that person shows it (#11157). The refusal codes are `sendMessage`'s
13
+ * own; the composer's host maps each to its line.
14
+ *
15
+ * Not a `*.actions.ts` file and no `*Action`-suffixed export, for the same
16
+ * reason `new-actions.ts` is not (apps/mcp's parity test reads that suffix;
17
+ * the member writes have no MCP twin by decision). Action input is
18
+ * untrusted: anything but a string is `invalid_input`.
19
+ */
20
+
21
+ import { sendMessage, type NewActionState } from "../../new-actions";
22
+
23
+ import { threadSubject } from "./thread-data";
24
+
25
+ export async function postThreadMessage(body: unknown): Promise<NewActionState> {
26
+ if (typeof body !== "string") return { kind: "error", code: "invalid_input" };
27
+ const formData = new FormData();
28
+ formData.set("subject", threadSubject(body));
29
+ formData.set("body", body);
30
+ return sendMessage({ kind: "idle" }, formData);
31
+ }
@@ -5,8 +5,8 @@
5
5
  * RSC. Every `/account` route but the four Settings tabs renders inside
6
6
  * `SignedInShell` (through the client `AccountFrame`; the tabs draw their own
7
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, then
9
- * Settings (#8231 D1); a footer of the avatar and ? alone;
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
10
  * the card avatar menu (name, then Settings and Log out); the ? help menu
11
11
  * (Contact support, and Help center when `AILK_HELP_CENTER_URL` is set);
12
12
  * and below `md` a tab bar reading avatar · Inbox · For you · Help (#7469).
@@ -130,6 +130,7 @@ export default async function AccountLayout({
130
130
  settings: t("frame.settings"),
131
131
  library: t("frame.library"),
132
132
  artifacts: t("frame.artifacts"),
133
+ appointments: t("frame.appointments"),
133
134
  signOutFailed: t("frame.signOutFailed"),
134
135
  signOut: t("frame.signOut"),
135
136
  help: t("frame.help"),
@@ -7,8 +7,10 @@
7
7
  *
8
8
  * Its rows are the contributed New actions the Inbox page found offered
9
9
  * (`accountNewActions`, each already gated by its own member read). A row is
10
- * a menu item, never a link: it opens that action's popup in one dialog over
11
- * the Inbox. With no action offered there is no menu at all.
10
+ * a menu item: it opens that action's popup in one dialog over the Inbox, or
11
+ * — an action with `href` (#11154: Schedule appointment; #11152: Send
12
+ * message, to the member thread page) — navigates to that account page. With
13
+ * no action offered there is no menu at all.
12
14
  *
13
15
  * Two triggers share the dialog: the desktop New in the page's header row
14
16
  * (`md` up), and a compact + the frame's phone top bar holds. The frame hands
@@ -18,9 +20,9 @@
18
20
  *
19
21
  * A popup body talks back through `useNewMenuPopup()`: `close(true)` after a
20
22
  * successful write closes the dialog and refreshes the Inbox, `open(id)`
21
- * switches to another offered action. The two popups that read on open share
23
+ * switches to another offered action. A popup that reads on open uses
22
24
  * `useOpenRead` and `NewPopupStatus`, so loading, a failed read and its retry
23
- * look the same in both (D5).
25
+ * look the same in every popup (D5).
24
26
  */
25
27
 
26
28
  import {
@@ -54,11 +56,13 @@ import { createPortal } from "react-dom";
54
56
 
55
57
  import type { NewActionErrorCode } from "./new-actions";
56
58
 
57
- /** One offered action, its label already translated. */
59
+ /** One offered action, its label already translated: a popup, or a page to navigate to (#11154). */
58
60
  export interface NewMenuAction {
59
61
  id: string;
60
62
  label: string;
61
- popup: ReactNode;
63
+ popup?: ReactNode;
64
+ /** The localized path the row navigates to; such a row has no popup. */
65
+ href?: string;
62
66
  }
63
67
 
64
68
  export interface NewMenuLabels {
@@ -125,11 +129,13 @@ function ActionMenu({
125
129
  actions,
126
130
  label,
127
131
  onPick,
132
+ onNavigate,
128
133
  }: {
129
134
  compact: boolean;
130
135
  actions: readonly NewMenuAction[];
131
136
  label: string;
132
137
  onPick: (id: string, trigger: HTMLElement | null) => void;
138
+ onNavigate: (href: string) => void;
133
139
  }): ReactElement {
134
140
  const triggerRef = useRef<HTMLButtonElement>(null);
135
141
  // A pick hands focus to the dialog, so the closing menu must not take it back.
@@ -175,9 +181,15 @@ function ActionMenu({
175
181
  <DropdownMenuItem
176
182
  key={action.id}
177
183
  onSelect={() => {
184
+ // A link row navigates and leaves focus to the next page (#11154).
185
+ if (action.href !== undefined) {
186
+ onNavigate(action.href);
187
+ return;
188
+ }
178
189
  picked.current = true;
179
190
  onPick(action.id, triggerRef.current);
180
191
  }}
192
+ {...(action.href !== undefined ? { "data-href": action.href } : {})}
181
193
  data-testid={`account-new-menu-item-${action.id}`}
182
194
  >
183
195
  {action.label}
@@ -222,13 +234,26 @@ export function NewMenu({
222
234
  returnFocus.current = trigger;
223
235
  setOpenId(id);
224
236
  };
237
+ const onNavigate = (href: string): void => router.push(href);
225
238
 
226
239
  return (
227
240
  <>
228
- <ActionMenu compact={false} actions={actions} label={labels.trigger} onPick={onPick} />
241
+ <ActionMenu
242
+ compact={false}
243
+ actions={actions}
244
+ label={labels.trigger}
245
+ onPick={onPick}
246
+ onNavigate={onNavigate}
247
+ />
229
248
  {slot
230
249
  ? createPortal(
231
- <ActionMenu compact actions={actions} label={labels.trigger} onPick={onPick} />,
250
+ <ActionMenu
251
+ compact
252
+ actions={actions}
253
+ label={labels.trigger}
254
+ onPick={onPick}
255
+ onNavigate={onNavigate}
256
+ />,
232
257
  slot,
233
258
  )
234
259
  : null}
@@ -20,7 +20,11 @@
20
20
  * `ctx`, its init, its user or `t` itself — so no credential or email reaches
21
21
  * the client payload (SEC-8233-1). `popups` is keyed on the config's own id
22
22
  * union, so a read added there without a popup here is a type error, never a
23
- * menu row that opens nothing.
23
+ * menu row that opens nothing. A read carrying `href` is a link row and
24
+ * binds no popup: Schedule appointment (#11154) navigates to
25
+ * `/account/appointments`, the retired schedule popup's one booking path;
26
+ * Send message (#11152) navigates to `/account/inbox/thread`, the member's
27
+ * thread page, whose composer took over from the retired message lightbox.
24
28
  */
25
29
 
26
30
  import type {
@@ -30,16 +34,26 @@ import type {
30
34
  } from "@working-theory/templates/account";
31
35
  import type { ReactNode } from "react";
32
36
 
33
- import {
34
- accountNewActions,
35
- type AccountNewActionId,
36
- } from "../../../../lib/account-config";
37
+ import { accountNewActions } from "../../../../lib/account-config";
37
38
 
38
39
  import { RequestQuote } from "./components/request-quote";
39
- import { ScheduleService } from "./components/schedule-service";
40
- import { SendMessage } from "./components/send-message";
40
+ import type { NewActionErrorCode } from "./new-actions";
41
41
  import type { NewPopupLabels } from "./new-menu";
42
42
 
43
+ /** Each refusal code's plain line — the popups' and the thread composer's (#11152) one map. */
44
+ export function newActionErrorLabels(t: AccountTranslate): Record<NewActionErrorCode, string> {
45
+ return {
46
+ link_not_https: t("new.errors.linkNotHttps"),
47
+ answers_invalid: t("new.errors.answersInvalid"),
48
+ request_form_off: t("new.errors.requestFormOff"),
49
+ meeting_type_not_offered: t("new.errors.meetingTypeNotOffered"),
50
+ slot_unavailable: t("new.errors.slotUnavailable"),
51
+ too_many_requests: t("new.errors.tooManyRequests"),
52
+ invalid_input: t("new.errors.invalidInput"),
53
+ failed: t("new.errors.failed"),
54
+ };
55
+ }
56
+
43
57
  /** The strings every popup shares — plain strings, so nothing else crosses to the client. */
44
58
  function popupLabels(t: AccountTranslate): NewPopupLabels {
45
59
  return {
@@ -48,60 +62,25 @@ function popupLabels(t: AccountTranslate): NewPopupLabels {
48
62
  retry: t("new.retry"),
49
63
  submitting: t("new.submitting"),
50
64
  optional: t("new.optional"),
51
- errors: {
52
- link_not_https: t("new.errors.linkNotHttps"),
53
- answers_invalid: t("new.errors.answersInvalid"),
54
- request_form_off: t("new.errors.requestFormOff"),
55
- meeting_type_not_offered: t("new.errors.meetingTypeNotOffered"),
56
- slot_unavailable: t("new.errors.slotUnavailable"),
57
- too_many_requests: t("new.errors.tooManyRequests"),
58
- invalid_input: t("new.errors.invalidInput"),
59
- failed: t("new.errors.failed"),
60
- },
65
+ errors: newActionErrorLabels(t),
61
66
  };
62
67
  }
63
68
 
69
+ /** The ids of the reads that open a popup — every read without an `href` (#11154). */
70
+ type AccountNewPopupId = Exclude<(typeof accountNewActions)[number], { href: string }>["id"];
71
+
64
72
  /** The popup each action opens, keyed on the config's ids (D6–D8). */
65
73
  const popups = {
66
- "schedule-service": ({ locale, t }) => (
67
- <ScheduleService
68
- locale={locale}
69
- labels={{
70
- ...popupLabels(t),
71
- service: t("new.schedule.service"),
72
- // The popup fills each type's own minutes into the literal placeholder.
73
- duration: t("new.schedule.duration", { minutes: "{minutes}" }),
74
- time: t("new.schedule.time"),
75
- notes: t("new.schedule.notes"),
76
- submit: t("new.schedule.submit"),
77
- none: t("new.schedule.none"),
78
- suggest: t("new.schedule.suggest"),
79
- noSlots: t("new.schedule.noSlots"),
80
- }}
81
- />
82
- ),
83
74
  "request-quote": ({ locale, t }) => (
84
- <RequestQuote locale={locale} labels={{ ...popupLabels(t), submit: t("new.quote.submit") }} />
85
- ),
86
- "send-message": ({ locale, t }) => (
87
- <SendMessage
75
+ <RequestQuote
88
76
  locale={locale}
89
- labels={{
90
- ...popupLabels(t),
91
- subject: t("new.message.subject"),
92
- body: t("new.message.body"),
93
- link: t("new.message.link"),
94
- linkHelp: t("new.message.linkHelp"),
95
- submit: t("new.message.submit"),
96
- }}
77
+ labels={{ ...popupLabels(t), submit: t("new.quote.submit"), pickDate: t("new.quote.pickDate") }}
97
78
  />
98
79
  ),
99
- } satisfies Record<AccountNewActionId, (ctx: AccountContext) => ReactNode>;
80
+ } satisfies Record<AccountNewPopupId, (ctx: AccountContext) => ReactNode>;
100
81
 
101
- /** The New actions in menu order (D2), each with its popup — what the Inbox page offers. */
82
+ /** The New actions in menu order (D2), each with its popup or its page — what the Inbox page offers. */
102
83
  export const newActions: readonly AccountNewAction[] = accountNewActions.map(
103
- (read) => ({
104
- ...read,
105
- renderPopup: popups[read.id],
106
- }),
84
+ (read): AccountNewAction =>
85
+ "href" in read ? read : { ...read, renderPopup: popups[read.id] },
107
86
  );
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * /[locale]/account/notifications — User settings › Notifications (#8339
3
- * D8; #8438 D15 — what we send you).
3
+ * D8; #8438 D15 — what we send you; #11163 — Ploy's three-row shape).
4
4
  *
5
5
  * RSC, outside the account layout's SignedInShell (#8430), in the member's
6
6
  * settings frame (D7) — standalone, the Admin's shape. Always renders
@@ -10,6 +10,15 @@
10
10
  * `effective` default (no row ⇒ on for a preference, off for a consent).
11
11
  * With none declared, one `account-notifications-empty` line.
12
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
+ *
13
22
  * The cookie-settings link moved to Privacy (#8438 D14, C6) — this tab no
14
23
  * longer renders it.
15
24
  */
@@ -21,6 +30,15 @@ import {
21
30
  ConsentSwitchList,
22
31
  type ConsentSwitchRow,
23
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";
24
42
  import type { Metadata } from "next";
25
43
  import { getTranslations } from "next-intl/server";
26
44
  import type { ReactElement } from "react";
@@ -29,6 +47,19 @@ import { accountSession } from "../account-data";
29
47
  import { setConsentAction } from "../privacy/actions";
30
48
  import { memberSettingsFrame, type Translate } from "../settings-frame";
31
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
+ }
32
63
 
33
64
  interface Props {
34
65
  params: Promise<{ locale: string }>;
@@ -57,9 +88,15 @@ export default async function AccountNotificationsPage({ params }: Props): Promi
57
88
  .filter((purpose) => purpose.area === "communications")
58
89
  .map((purpose) => ({
59
90
  id: purpose.id,
60
- label: purpose.statement,
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 }),
61
99
  granted: purpose.effective,
62
- ...(purpose.description ? { description: purpose.description } : {}),
63
100
  ...(purpose.state
64
101
  ? {
65
102
  dateLine: purpose.state.granted
@@ -90,6 +127,7 @@ export default async function AccountNotificationsPage({ params }: Props): Promi
90
127
  rows={rows}
91
128
  onChange={setConsentAction}
92
129
  emptyLine={t("settings.notifications.empty")}
130
+ footLine={t("settings.notifications.alwaysSent")}
93
131
  testIdPrefix="account-notifications"
94
132
  />
95
133
  )}
@@ -98,6 +136,8 @@ export default async function AccountNotificationsPage({ params }: Props): Promi
98
136
  );
99
137
  }
100
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.
101
141
  function formatDate(iso: string, locale: string): string {
102
- return new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(new Date(iso));
142
+ return formatLocalTime(iso, "date", { timeZone: SERVER_TIME_ZONE, locale });
103
143
  }
@@ -3,17 +3,34 @@
3
3
  * D6a, D9, D12; #8231 D3; DESIGN.md §5.4).
4
4
  *
5
5
  * RSC, rendered inside the account layout's SignedInShell. One filtered
6
- * list: the tabs All · Purchases · Scheduled, each with a count, All
7
- * selected, through the shared `InboxList` (`@working-theory/templates/account`):
6
+ * list: the tabs All · Messages · Orders · Scheduled (#11149, operator
7
+ * rulings 2026-11-08), each with a count, All selected, through the shared
8
+ * `InboxList` (`@working-theory/templates/account`). `?tab=<id>` opens
9
+ * another tab; any other value, the frame's own `?tab=for-you` included,
10
+ * opens All:
8
11
  *
9
- * - All — every loaded row, newest first. The kinds in `updates` or
10
- * `needs-you` (`result`, `piece`, `message`) show here only.
11
- * - Purchases — the kinds whose section is `purchases` (the `purchase`
12
- * kind, and any a module adds), newest first.
12
+ * - All — every loaded row, newest first: the union of the other tabs,
13
+ * each row once, plus the kinds in `updates` or `needs-you` (`result`,
14
+ * `piece`), which show here only.
15
+ * - Messages (#11157) — the conversation kinds (`accountChatKinds`): the
16
+ * provider's messages and the member's own sent requests and messages,
17
+ * newest first, each the entry the member thread page opens. A request
18
+ * the member just posted is here and under All on the next render (the
19
+ * New menu refreshes the route after a post).
20
+ * - Orders — the kinds whose section is `purchases` (the `purchase` kind,
21
+ * and any a module adds), newest first. The tab keeps the contract's
22
+ * id, `purchases` (the section id, the `purchase` kind and
23
+ * `GET /v1/member/purchases` are unchanged); only its label — the key
24
+ * `inbox.tabs.purchases` — reads Orders, the Admin's word for the same
25
+ * records (#9170).
13
26
  * - Scheduled — the kinds whose section is `upcoming` (`appointment`):
14
27
  * first the items still upcoming, soonest first (no time last), then the
15
28
  * rest, newest first. Each kind's own read decides which is upcoming.
16
29
  *
30
+ * No lead line under the title (#11149): the Admin's Inbox has none, and
31
+ * the tabs say what the list holds. The tabs follow the title row at the
32
+ * list's own `mt-block-loose`, the token the Admin's list sits at.
33
+ *
17
34
  * What needs the person is never an Inbox row: `email-unverified`,
18
35
  * `payment-due` and "Add your name" are For-you items (D9 as amended). From
19
36
  * `md` up they are the layout's aside.
@@ -27,7 +44,7 @@
27
44
  * type tag, title, Open or View, and ✕; the empty line when none waits,
28
45
  * and D12's error row above the list when a For-you source failed.
29
46
  * The h1 sits above both panels, visually hidden below `md` (the phone has
30
- * no large title). At `md`+ only the Inbox panel shows, lead included.
47
+ * no large title). At `md`+ only the Inbox panel shows.
31
48
  *
32
49
  * D12 — any read that fails (a kind or a For-you source) renders an error
33
50
  * row with Retry above the list; the list then holds what DID load, never a
@@ -52,7 +69,8 @@ import {
52
69
  type AccountContext,
53
70
  type InboxListRow,
54
71
  } from "@working-theory/templates/account";
55
- import { Heading, Text } from "@working-theory/ui/primitives";
72
+ import { localeHref } from "@working-theory/ui";
73
+ import { Heading, LocalTime } from "@working-theory/ui/primitives";
56
74
  import {
57
75
  CalendarClock,
58
76
  ClipboardList,
@@ -62,9 +80,11 @@ import {
62
80
  import type { Metadata } from "next";
63
81
  import { headers } from "next/headers";
64
82
  import { getTranslations } from "next-intl/server";
83
+ import type { ComponentType, ReactElement } from "react";
84
+
85
+ import { accountChatKinds } from "../../../../lib/account-config";
65
86
  import { SITE_NAME } from "../../../../lib/site-brand";
66
87
  import { readSession } from "../../../../lib/topology.generated";
67
- import type { ComponentType, ReactElement } from "react";
68
88
 
69
89
  import {
70
90
  accountSession,
@@ -82,6 +102,8 @@ import { newActions } from "./new-popups";
82
102
 
83
103
  interface Props {
84
104
  params: Promise<{ locale: string }>;
105
+ /** `?tab=` — an Inbox tab id opens that tab (#11149); the frame reads the same key for the phone's For you tab. */
106
+ searchParams?: Promise<{ tab?: string | string[] }>;
85
107
  }
86
108
 
87
109
  export async function generateMetadata({ params }: Props): Promise<Metadata> {
@@ -132,7 +154,10 @@ async function loadNewActions(
132
154
  actions.push({
133
155
  id: action.id,
134
156
  label: ctx.t(action.label),
135
- popup: action.renderPopup(ctx),
157
+ // #11154 — a link row navigates to its page; the rest open a popup.
158
+ ...(action.href !== undefined
159
+ ? { href: localeHref(ctx.locale, action.href) }
160
+ : { popup: action.renderPopup?.(ctx) }),
136
161
  });
137
162
  });
138
163
  return {
@@ -149,8 +174,12 @@ function scheduledOrder(rows: readonly LoadedInboxItem[]): LoadedInboxItem[] {
149
174
  return [...upcoming, ...rows.filter(({ item }) => item.upcoming !== true)];
150
175
  }
151
176
 
152
- export default async function AccountInboxPage({ params }: Props): Promise<ReactElement | null> {
177
+ export default async function AccountInboxPage({
178
+ params,
179
+ searchParams,
180
+ }: Props): Promise<ReactElement | null> {
153
181
  const { locale } = await params;
182
+ const requestedTab = ((await searchParams) ?? {}).tab;
154
183
  const t = await getTranslations({ locale, namespace: "account" });
155
184
  const session = await accountSession(locale);
156
185
 
@@ -173,26 +202,36 @@ export default async function AccountInboxPage({ params }: Props): Promise<React
173
202
  { actions: [], failed: false },
174
203
  ];
175
204
 
176
- const dateFormat = new Intl.DateTimeFormat(locale, {
177
- month: "short",
178
- day: "numeric",
179
- timeZone: "UTC",
180
- });
205
+ // #11175: the caption carries the day as a `LocalTime` node — the server
206
+ // fallback zone in this RSC's render, the viewer's own once the row
207
+ // hydrates.
181
208
  const toRow = ({ kind, item }: LoadedInboxItem): InboxListRow => {
182
209
  const label = translate(kind.label);
183
210
  const icon = KIND_ICON[kind.kind];
184
211
  return {
185
212
  id: `${kind.kind}:${item.id}`,
186
213
  ...(icon ? { icon } : {}),
187
- caption: item.at
188
- ? `${label} · ${dateFormat.format(new Date(item.at))}`
189
- : label,
214
+ caption: item.at ? (
215
+ <>
216
+ {label}
217
+ {" · "}
218
+ <LocalTime at={item.at} preset="month-day" locale={locale} />
219
+ </>
220
+ ) : (
221
+ label
222
+ ),
190
223
  title: item.title,
191
224
  href: inboxItemHref(locale, kind.kind, item.id),
192
225
  };
193
226
  };
194
227
 
195
228
  const all = inbox.items.map(toRow);
229
+ // #11157 — the conversation kinds alone: the provider's messages and the
230
+ // member's own sent requests and messages, newest first as loaded.
231
+ const messages = inbox.items
232
+ .filter(({ kind }) => accountChatKinds.has(kind.kind))
233
+ .map(toRow);
234
+ // #11149 — the Orders tab: the kinds whose section is `purchases`.
196
235
  const purchases = inbox.items
197
236
  .filter(({ kind }) => kind.section === "purchases")
198
237
  .map(toRow);
@@ -200,6 +239,13 @@ export default async function AccountInboxPage({ params }: Props): Promise<React
200
239
  inbox.items.filter(({ kind }) => kind.section === "upcoming"),
201
240
  ).map(toRow);
202
241
  const failed = inbox.failed || forYou.failed || newMenu.failed;
242
+ // The `purchases` tab is Orders: the contract's section id, the Admin's word (#11149).
243
+ const tabs = [
244
+ { id: "all", label: t("inbox.tabs.all"), count: all.length, rows: all },
245
+ { id: "messages", label: t("inbox.tabs.messages"), count: messages.length, rows: messages },
246
+ { id: "purchases", label: t("inbox.tabs.purchases"), count: purchases.length, rows: purchases },
247
+ { id: "scheduled", label: t("inbox.tabs.scheduled"), count: scheduled.length, rows: scheduled },
248
+ ];
203
249
 
204
250
  return (
205
251
  // The phone's top bar already clears the canvas — no top inset there.
@@ -216,15 +262,6 @@ export default async function AccountInboxPage({ params }: Props): Promise<React
216
262
  />
217
263
  </div>
218
264
  <PhoneTabPanel tabs={["inbox"]} desktop data-testid="inbox-panel-inbox">
219
- <Text
220
- as="p"
221
- variant="body-sm"
222
- tone="muted"
223
- className="mt-block-tight hidden md:block"
224
- >
225
- {t("inbox.lead")}
226
- </Text>
227
-
228
265
  {failed ? (
229
266
  <ErrorRow
230
267
  message={t("inbox.error")}
@@ -234,27 +271,10 @@ export default async function AccountInboxPage({ params }: Props): Promise<React
234
271
  ) : null}
235
272
 
236
273
  <InboxList
237
- tabs={[
238
- {
239
- id: "all",
240
- label: t("inbox.tabs.all"),
241
- count: all.length,
242
- rows: all,
243
- },
244
- {
245
- id: "purchases",
246
- label: t("inbox.tabs.purchases"),
247
- count: purchases.length,
248
- rows: purchases,
249
- },
250
- {
251
- id: "scheduled",
252
- label: t("inbox.tabs.scheduled"),
253
- count: scheduled.length,
254
- rows: scheduled,
255
- },
256
- ]}
257
- defaultTab="all"
274
+ tabs={tabs}
275
+ // #11149 — `?tab=<id>` opens that tab; anything else (a repeated
276
+ // value, the frame's `for-you`) opens All.
277
+ defaultTab={tabs.find((tab) => tab.id === requestedTab)?.id ?? "all"}
258
278
  {...(failed ? {} : { emptyLine: t("inbox.empty") })}
259
279
  />
260
280
  </PhoneTabPanel>