@burdenoff/microfe-notification 2026.1129.2 → 2026.1130.1

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 (48) hide show
  1. package/dist/NotificationRoutes.js +73 -72
  2. package/dist/NotificationRoutes.js.map +1 -1
  3. package/dist/hooks/useSendNotification.d.ts +1 -1
  4. package/dist/hooks/useSendNotification.js.map +1 -1
  5. package/dist/translations/en.d.ts +55 -0
  6. package/dist/v2/InboxPage.js +150 -138
  7. package/dist/v2/InboxPage.js.map +1 -1
  8. package/dist/v2/NotificationDetailPanel.d.ts +9 -5
  9. package/dist/v2/NotificationDetailPanel.js +66 -51
  10. package/dist/v2/NotificationDetailPanel.js.map +1 -1
  11. package/dist/v2/PreferencesPage.js +80 -84
  12. package/dist/v2/PreferencesPage.js.map +1 -1
  13. package/dist/v2/admin/DeliveryLogPage.js +44 -48
  14. package/dist/v2/admin/DeliveryLogPage.js.map +1 -1
  15. package/dist/v2/admin/TemplateEditor.js +28 -33
  16. package/dist/v2/admin/TemplateEditor.js.map +1 -1
  17. package/dist/v2/admin/TemplateFields.js +1 -1
  18. package/dist/v2/admin/TemplateFields.js.map +1 -1
  19. package/dist/v2/admin/TemplatePage.js +19 -19
  20. package/dist/v2/admin/TemplatePage.js.map +1 -1
  21. package/dist/v2/admin/TemplatesPage.js +123 -127
  22. package/dist/v2/admin/TemplatesPage.js.map +1 -1
  23. package/dist/v2/admin/TopicsPage.js +101 -105
  24. package/dist/v2/admin/TopicsPage.js.map +1 -1
  25. package/dist/v2/admin/templateText.js +22 -17
  26. package/dist/v2/admin/templateText.js.map +1 -1
  27. package/dist/v2/send/MessageTab.d.ts +4 -0
  28. package/dist/v2/send/MessageTab.js +152 -0
  29. package/dist/v2/send/MessageTab.js.map +1 -0
  30. package/dist/v2/send/PeopleTab.d.ts +4 -0
  31. package/dist/v2/send/PeopleTab.js +156 -0
  32. package/dist/v2/send/PeopleTab.js.map +1 -0
  33. package/dist/v2/send/SendNotificationDialog.d.ts +4 -0
  34. package/dist/v2/send/SendNotificationDialog.js +98 -0
  35. package/dist/v2/send/SendNotificationDialog.js.map +1 -0
  36. package/dist/v2/send/SendRedirect.d.ts +1 -0
  37. package/dist/v2/send/SendRedirect.js +20 -0
  38. package/dist/v2/send/SendRedirect.js.map +1 -0
  39. package/dist/v2/send/WhenTab.d.ts +4 -0
  40. package/dist/v2/send/WhenTab.js +64 -0
  41. package/dist/v2/send/WhenTab.js.map +1 -0
  42. package/dist/v2/send/sendModel.d.ts +47 -0
  43. package/dist/v2/send/sendModel.js +90 -0
  44. package/dist/v2/send/sendModel.js.map +1 -0
  45. package/dist/v2/send/useSendDraft.d.ts +24 -0
  46. package/dist/v2/send/useSendDraft.js +120 -0
  47. package/dist/v2/send/useSendDraft.js.map +1 -0
  48. package/package.json +1 -1
@@ -1,19 +1,22 @@
1
1
  import { useNotifications as e } from "../hooks/useNotifications.js";
2
2
  import { useTr as t } from "../shared/hooks/useTr.js";
3
3
  import { useNotificationPaths as n } from "../navigation-v2/paths.js";
4
- import { useAdminTools as r } from "../navigation-v2/useAdminTools.js";
5
- import { INBOX_TABS as i, isUnread as a, needsAction as o, readInboxTab as s } from "./model/inbox.js";
6
- import { InboxRows as c } from "./InboxRows.js";
7
- import { NotificationDetailPanel as l } from "./NotificationDetailPanel.js";
8
- import { useMarkUnread as u } from "./useNotificationDetail.js";
9
- import { useMemo as d } from "react";
10
- import { CheckCheck as f, Search as p } from "lucide-react";
11
- import { Navigate as m, useNavigate as h, useSearchParams as g } from "react-router";
12
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
13
- import { PageHeader as y } from "@burdenoff/fe-libs/chrome";
14
- import { Button as b, EmptyState as x, Input as S, LoadError as C, PageTabs as w, useNotify as T } from "@burdenoff/fe-libs/ui";
4
+ import { holdsAdminToolPermission as r, useAdminTools as i } from "../navigation-v2/useAdminTools.js";
5
+ import { INBOX_TABS as a, isUnread as o, needsAction as s, readInboxTab as c } from "./model/inbox.js";
6
+ import { InboxRows as l } from "./InboxRows.js";
7
+ import { NotificationDetailPanel as u } from "./NotificationDetailPanel.js";
8
+ import { useMarkUnread as d } from "./useNotificationDetail.js";
9
+ import { SendNotificationDialog as f } from "./send/SendNotificationDialog.js";
10
+ import { SEND_PARAM as p } from "./send/sendModel.js";
11
+ import { useMemo as m } from "react";
12
+ import { usePermissions as h } from "@burdenoff/fe-libs/shared/providers/shell";
13
+ import { CheckCheck as g, Search as _ } from "lucide-react";
14
+ import { Navigate as v, useNavigate as y, useSearchParams as b } from "react-router";
15
+ import { jsx as x, jsxs as S } from "react/jsx-runtime";
16
+ import { PageHeader as C } from "@burdenoff/fe-libs/chrome";
17
+ import { Button as w, EmptyState as T, Input as E, LoadError as D, PageTabs as O, WorkspacePage as k, useNotify as A } from "@burdenoff/fe-libs/ui";
15
18
  // src/v2/InboxPage.tsx
16
- var E = {
19
+ var j = {
17
20
  all: {
18
21
  archived: !1,
19
22
  channel: "IN_APP"
@@ -31,145 +34,154 @@ var E = {
31
34
  archived: !0,
32
35
  channel: "IN_APP"
33
36
  }
34
- }, D = { channel: "IN_APP" };
35
- function O(e, t) {
37
+ }, M = { channel: "IN_APP" };
38
+ function N(e, t) {
36
39
  return e === "send" ? t.send : e === "templates" ? t.templates : e === "topics" ? t.topics : e === "history" ? t.deliveryLog : null;
37
40
  }
38
- function k() {
39
- let e = n(), [t] = g(), r = O(t.get("tab"), e);
40
- return r ? /* @__PURE__ */ _(m, {
41
+ function P() {
42
+ let e = n(), [t] = b(), r = N(t.get("tab"), e);
43
+ return r ? /* @__PURE__ */ x(v, {
41
44
  to: r,
42
45
  replace: !0
43
- }) : /* @__PURE__ */ _(A, {});
46
+ }) : /* @__PURE__ */ x(F, {});
44
47
  }
45
- function A() {
46
- let m = t(), x = h(), O = T(), k = n(), { tools: A } = r(), [M, N] = g(), P = s(M.get("tab")), F = M.get("open"), I = e({
47
- baseFilter: E[P],
48
- unreadFilter: D
49
- }), L = u(), R = d(() => P === "action" ? I.notifications.filter(o) : I.notifications, [I.notifications, P]), z = I.notificationFilter.search ?? "", B = (e) => {
50
- let t = new URLSearchParams(M);
51
- e ? t.set("open", e) : t.delete("open"), N(t);
52
- }, V = async () => {
53
- let e = I.allNotifications.filter(a).map((e) => e.id), t = e.length >= I.unreadCount;
54
- await I.markAllAsRead(), O({
55
- title: m("notifications.v3.markedAll", "Marked {{count}} as read", { count: I.unreadCount || e.length }),
48
+ function F() {
49
+ let v = t(), T = y(), N = A(), P = n(), { tools: F } = i(), { hasPermission: L, isLoading: R } = h(), [z, B] = b(), V = z.get("send") === "1" && !R && r("send", L), H = c(z.get("tab")), U = z.get("open"), W = e({
50
+ baseFilter: j[H],
51
+ unreadFilter: M
52
+ }), G = d(), K = m(() => H === "action" ? W.notifications.filter(s) : W.notifications, [W.notifications, H]), q = W.notificationFilter.search ?? "", J = (e) => {
53
+ let t = new URLSearchParams(z);
54
+ e ? t.set("open", e) : t.delete("open"), B(t);
55
+ }, Y = (e) => {
56
+ let t = new URLSearchParams(z);
57
+ e ? t.set(p, "1") : t.delete(p), B(t);
58
+ }, X = async () => {
59
+ let e = W.allNotifications.filter(o).map((e) => e.id), t = e.length >= W.unreadCount;
60
+ await W.markAllAsRead(), N({
61
+ title: v("notifications.v3.markedAll", "Marked {{count}} as read", { count: W.unreadCount || e.length }),
56
62
  tone: "success",
57
63
  undo: t && e.length > 0 ? async () => {
58
- await L(e), await I.refetch();
64
+ await G(e), await W.refetch();
59
65
  } : void 0
60
66
  });
61
- }, H = {
62
- all: m("notifications.v3.tab.all", "All"),
63
- unread: m("notifications.v3.tab.unread", "Unread"),
64
- action: m("notifications.v3.tab.action", "Needs action"),
65
- archived: m("notifications.v3.tab.archived", "Archived")
67
+ }, Z = {
68
+ all: v("notifications.v3.tab.all", "All"),
69
+ unread: v("notifications.v3.tab.unread", "Unread"),
70
+ action: v("notifications.v3.tab.action", "Needs action"),
71
+ archived: v("notifications.v3.tab.archived", "Archived")
66
72
  };
67
- return /* @__PURE__ */ v("div", {
68
- "data-account-pages-v2": "notifications",
69
- className: "flex w-full min-w-0 flex-col",
70
- children: [
71
- /* @__PURE__ */ _(y, {
72
- variant: "compact",
73
- title: m("notifications.v3.title", "Notifications"),
74
- description: m("notifications.v3.purpose", "Everything that needs you, and everything you were told."),
75
- primary: /* @__PURE__ */ v(b, {
76
- variant: "outline",
77
- disabled: I.unreadCount === 0,
78
- onClick: () => void V(),
79
- "data-testid": "inbox-mark-all",
80
- children: [/* @__PURE__ */ _(f, { "aria-hidden": "true" }), m("notifications.v3.markAll", "Mark all as read")]
81
- }),
82
- settings: {
83
- label: m("notifications.v3.settings", "Notification settings"),
84
- onClick: () => x(k.preferences)
85
- },
86
- more: A.map((e) => ({
87
- id: e.id,
88
- label: e.label,
89
- onSelect: () => x(e.href)
90
- }))
91
- }),
92
- /* @__PURE__ */ _(w, {
93
- ariaLabel: m("notifications.v3.title", "Notifications"),
94
- activeId: P,
95
- tabs: i.map((e) => ({
96
- id: e,
97
- label: H[e],
98
- href: `?tab=${e}`,
99
- badge: e === "unread" && I.unreadCount > 0 ? I.unreadCount : void 0
100
- }))
73
+ return /* @__PURE__ */ S(k, { children: [
74
+ /* @__PURE__ */ x(C, {
75
+ variant: "compact",
76
+ title: v("notifications.v3.title", "Notifications"),
77
+ description: v("notifications.v3.purpose", "Everything that needs you, and everything you were told."),
78
+ primary: /* @__PURE__ */ S(w, {
79
+ variant: "outline",
80
+ disabled: W.unreadCount === 0,
81
+ onClick: () => void X(),
82
+ "data-testid": "inbox-mark-all",
83
+ children: [/* @__PURE__ */ x(g, { "aria-hidden": "true" }), v("notifications.v3.markAll", "Mark all as read")]
101
84
  }),
102
- /* @__PURE__ */ v("div", {
103
- className: "mt-4 flex flex-col gap-3",
104
- children: [
105
- /* @__PURE__ */ v("label", {
106
- className: "relative block max-w-md",
107
- children: [
108
- /* @__PURE__ */ _("span", {
109
- className: "sr-only",
110
- children: m("notifications.v3.search", "Search notifications")
111
- }),
112
- /* @__PURE__ */ _(p, {
113
- className: "pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-text-muted",
114
- "aria-hidden": "true"
115
- }),
116
- /* @__PURE__ */ _(S, {
117
- type: "search",
118
- className: "pl-9",
119
- value: z,
120
- placeholder: m("notifications.v3.search", "Search notifications"),
121
- onChange: (e) => I.updateFilter({ search: e.target.value }),
122
- "data-testid": "inbox-search"
123
- })
124
- ]
125
- }),
126
- I.error && R.length === 0 ? /* @__PURE__ */ _(C, {
127
- what: m("notifications.v3.title", "Notifications"),
128
- error: I.error,
129
- onRetry: () => void I.refetch()
130
- }) : !I.isLoading && R.length === 0 ? /* @__PURE__ */ _(j, {
131
- tab: P,
132
- searching: !!z.trim()
133
- }) : /* @__PURE__ */ _(c, {
134
- notifications: R,
135
- loading: I.isLoading && R.length === 0,
136
- onOpen: (e) => {
137
- B(e);
138
- let t = R.find((t) => t.id === e);
139
- t && a(t) && I.markAsRead(e);
140
- },
141
- onMarkRead: (e) => void I.markAsRead(e),
142
- onMarkUnread: (e) => void L([e]).then(() => I.refetch()),
143
- onArchive: (e) => void I.archiveNotification(e),
144
- onRestore: (e) => void I.unarchiveNotification(e)
145
- }),
146
- I.hasMore ? /* @__PURE__ */ _("div", {
147
- className: "flex justify-center",
148
- children: /* @__PURE__ */ _(b, {
149
- variant: "ghost",
150
- busy: I.isLoadingMore,
151
- onClick: () => void I.loadMore(),
152
- "data-testid": "inbox-more",
153
- children: m("notifications.v3.more", "Show more")
85
+ settings: {
86
+ label: v("notifications.v3.settings", "Notification settings"),
87
+ onClick: () => T(P.preferences)
88
+ },
89
+ more: F.map((e) => e.id === "send" ? {
90
+ id: e.id,
91
+ label: v("notifications.v3.send.title", "Send a notification"),
92
+ onSelect: () => Y(!0)
93
+ } : {
94
+ id: e.id,
95
+ label: e.label,
96
+ onSelect: () => T(e.href)
97
+ })
98
+ }),
99
+ /* @__PURE__ */ x(O, {
100
+ ariaLabel: v("notifications.v3.title", "Notifications"),
101
+ activeId: H,
102
+ tabs: a.map((e) => ({
103
+ id: e,
104
+ label: Z[e],
105
+ href: `?tab=${e}`,
106
+ badge: e === "unread" && W.unreadCount > 0 ? W.unreadCount : void 0
107
+ }))
108
+ }),
109
+ /* @__PURE__ */ S("div", {
110
+ className: "flex flex-col gap-3",
111
+ children: [
112
+ /* @__PURE__ */ S("label", {
113
+ className: "relative block max-w-md",
114
+ children: [
115
+ /* @__PURE__ */ x("span", {
116
+ className: "sr-only",
117
+ children: v("notifications.v3.search", "Search notifications")
118
+ }),
119
+ /* @__PURE__ */ x(_, {
120
+ className: "pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-text-muted",
121
+ "aria-hidden": "true"
122
+ }),
123
+ /* @__PURE__ */ x(E, {
124
+ type: "search",
125
+ className: "pl-9",
126
+ value: q,
127
+ placeholder: v("notifications.v3.search", "Search notifications"),
128
+ onChange: (e) => W.updateFilter({ search: e.target.value }),
129
+ "data-testid": "inbox-search"
154
130
  })
155
- }) : null
156
- ]
157
- }),
158
- /* @__PURE__ */ _(l, {
159
- id: F,
160
- onClose: () => B(null),
161
- onMarkUnread: (e) => void L([e]).then(() => I.refetch()),
162
- onArchive: (e) => {
163
- I.archiveNotification(e), B(null);
131
+ ]
132
+ }),
133
+ W.error && K.length === 0 ? /* @__PURE__ */ x(D, {
134
+ what: v("notifications.v3.title", "Notifications"),
135
+ error: W.error,
136
+ onRetry: () => void W.refetch()
137
+ }) : !W.isLoading && K.length === 0 ? /* @__PURE__ */ x(I, {
138
+ tab: H,
139
+ searching: !!q.trim()
140
+ }) : /* @__PURE__ */ x(l, {
141
+ notifications: K,
142
+ loading: W.isLoading && K.length === 0,
143
+ onOpen: (e) => {
144
+ J(e);
145
+ let t = K.find((t) => t.id === e);
146
+ t && o(t) && W.markAsRead(e);
147
+ },
148
+ onMarkRead: (e) => void W.markAsRead(e),
149
+ onMarkUnread: (e) => void G([e]).then(() => W.refetch()),
150
+ onArchive: (e) => void W.archiveNotification(e),
151
+ onRestore: (e) => void W.unarchiveNotification(e)
152
+ }),
153
+ W.hasMore ? /* @__PURE__ */ x("div", {
154
+ className: "flex justify-center",
155
+ children: /* @__PURE__ */ x(w, {
156
+ variant: "ghost",
157
+ busy: W.isLoadingMore,
158
+ onClick: () => void W.loadMore(),
159
+ "data-testid": "inbox-more",
160
+ children: v("notifications.v3.more", "Show more")
161
+ })
162
+ }) : null
163
+ ]
164
+ }),
165
+ /* @__PURE__ */ x(u, {
166
+ id: U,
167
+ onClose: () => J(null),
168
+ inboxActions: {
169
+ markUnread: (e) => void G([e]).then(() => W.refetch()),
170
+ archive: (e) => {
171
+ W.archiveNotification(e), J(null);
164
172
  },
165
- onRestore: (e) => void I.unarchiveNotification(e)
166
- })
167
- ]
168
- });
173
+ restore: (e) => void W.unarchiveNotification(e)
174
+ }
175
+ }),
176
+ /* @__PURE__ */ x(f, {
177
+ open: V,
178
+ onClose: () => Y(!1)
179
+ })
180
+ ] });
169
181
  }
170
- function j({ tab: e, searching: n }) {
182
+ function I({ tab: e, searching: n }) {
171
183
  let r = t();
172
- if (n) return /* @__PURE__ */ _(x, {
184
+ if (n) return /* @__PURE__ */ x(T, {
173
185
  kind: "no-results",
174
186
  title: r("notifications.v3.empty.searchTitle", "No notifications match"),
175
187
  description: r("notifications.v3.empty.searchBody", "Try other words.")
@@ -180,12 +192,12 @@ function j({ tab: e, searching: n }) {
180
192
  action: [r("notifications.v3.empty.actionTitle", "Nothing waiting for you"), r("notifications.v3.empty.actionBody", "Approvals and requests show up here.")],
181
193
  archived: [r("notifications.v3.empty.archivedTitle", "Nothing archived"), r("notifications.v3.empty.archivedBody", "Archive a notification to keep it out of the way. It stays here.")]
182
194
  }[e];
183
- return /* @__PURE__ */ _(x, {
195
+ return /* @__PURE__ */ x(T, {
184
196
  kind: e === "archived" ? "first-use" : "all-done",
185
197
  title: i,
186
198
  description: a
187
199
  });
188
200
  }
189
- export { k as InboxPage };
201
+ export { P as InboxPage };
190
202
 
191
203
  //# sourceMappingURL=InboxPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InboxPage.js","names":["Inbox","TAB_FILTERS","UNREAD_FILTER","oldTabTarget","tab","paths","InboxPage","useNotificationPaths","params","useSearchParams","target","Navigate","Inbox$1","tr","useTr","navigate","useNavigate","notify","useNotify","useAdminTools","setParams","readInboxTab","openId","inbox","useNotifications","markUnread","useMarkUnread","shown","useMemo","needsAction","search","open","next","id","markAll","unreadIds","isUnread","n","everyOne","tabLabel","PageHeader","Button","CheckCheck","tools","tool","PageTabs","INBOX_TABS","Search","Input","event","LoadError","InboxEmpty","InboxRows","notification","NotificationDetailPanel","searching","EmptyState","title","description"],"sources":["../../src/v2/InboxPage.tsx"],"sourcesContent":["/**\n * Notifications (BOFF-16785, C1; the mockup's `notif`), under fe-libs' `accountPagesV2`: the inbox\n * at the list width, tabs All · Unread · Needs action · Archived (`?tab=`), compact rows grouped by\n * day, \"Mark all as read\" with Undo, the settings under the gear and, for admins, Send, Templates,\n * Topics and the Delivery log in ⋯. A row opens its panel (`?open=<id>`, decision 10). The same\n * queries as the inbox today (`useNotifications`).\n */\nimport { useMemo } from 'react';\nimport { Navigate, useNavigate, useSearchParams } from 'react-router';\nimport { CheckCheck, Search } from 'lucide-react';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport { Button, EmptyState, Input, LoadError, PageTabs, useNotify } from '@burdenoff/fe-libs/ui';\nimport { useNotifications } from '../hooks';\nimport type { NotificationFilter } from '../types';\nimport { useTr } from '../shared/hooks/useTr';\nimport { useNotificationPaths } from '../navigation-v2/paths';\nimport { useAdminTools } from '../navigation-v2/useAdminTools';\nimport { INBOX_TABS, isUnread, needsAction, readInboxTab, type InboxTab } from './model/inbox';\nimport { InboxRows } from './InboxRows';\nimport { NotificationDetailPanel } from './NotificationDetailPanel';\nimport { useMarkUnread } from './useNotificationDetail';\n\n/** What each tab asks the service for: the in-app inbox, archived or not, unread or not. */\nconst TAB_FILTERS: Record<InboxTab, Partial<NotificationFilter>> = {\n all: { archived: false, channel: 'IN_APP' },\n unread: { archived: false, channel: 'IN_APP', isRead: false },\n action: { archived: false, channel: 'IN_APP' },\n archived: { archived: true, channel: 'IN_APP' },\n};\nconst UNREAD_FILTER = { channel: 'IN_APP' };\n\n/** Where today's `?tab=` values still go (the round-1 landing's links). */\nfunction oldTabTarget(\n tab: string | null,\n paths: ReturnType<typeof useNotificationPaths>\n): string | null {\n if (tab === 'send') return paths.send;\n if (tab === 'templates') return paths.templates;\n if (tab === 'topics') return paths.topics;\n if (tab === 'history') return paths.deliveryLog;\n return null;\n}\n\nexport function InboxPage() {\n const paths = useNotificationPaths();\n const [params] = useSearchParams();\n const target = oldTabTarget(params.get('tab'), paths);\n if (target) return <Navigate to={target} replace />;\n return <Inbox />;\n}\n\nfunction Inbox() {\n const tr = useTr();\n const navigate = useNavigate();\n const notify = useNotify();\n const paths = useNotificationPaths();\n const { tools } = useAdminTools();\n const [params, setParams] = useSearchParams();\n const tab = readInboxTab(params.get('tab'));\n const openId = params.get('open');\n const inbox = useNotifications({ baseFilter: TAB_FILTERS[tab], unreadFilter: UNREAD_FILTER });\n const markUnread = useMarkUnread();\n const shown = useMemo(\n () => (tab === 'action' ? inbox.notifications.filter(needsAction) : inbox.notifications),\n [inbox.notifications, tab]\n );\n const search = inbox.notificationFilter.search ?? '';\n\n const open = (id: string | null) => {\n const next = new URLSearchParams(params);\n if (id) next.set('open', id);\n else next.delete('open');\n setParams(next);\n };\n\n const markAll = async () => {\n // Undo can only bring back what's loaded: offer it when every unread one is on the page.\n const unreadIds = inbox.allNotifications.filter(isUnread).map((n) => n.id);\n const everyOne = unreadIds.length >= inbox.unreadCount;\n await inbox.markAllAsRead();\n notify({\n title: tr('notifications.v3.markedAll', 'Marked {{count}} as read', {\n count: inbox.unreadCount || unreadIds.length,\n }),\n tone: 'success',\n undo:\n everyOne && unreadIds.length > 0\n ? async () => {\n await markUnread(unreadIds);\n await inbox.refetch();\n }\n : undefined,\n });\n };\n\n const tabLabel: Record<InboxTab, string> = {\n all: tr('notifications.v3.tab.all', 'All'),\n unread: tr('notifications.v3.tab.unread', 'Unread'),\n action: tr('notifications.v3.tab.action', 'Needs action'),\n archived: tr('notifications.v3.tab.archived', 'Archived'),\n };\n\n return (\n <div data-account-pages-v2=\"notifications\" className=\"flex w-full min-w-0 flex-col\">\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.title', 'Notifications')}\n description={tr(\n 'notifications.v3.purpose',\n 'Everything that needs you, and everything you were told.'\n )}\n primary={\n <Button\n variant=\"outline\"\n disabled={inbox.unreadCount === 0}\n onClick={() => void markAll()}\n data-testid=\"inbox-mark-all\"\n >\n <CheckCheck aria-hidden=\"true\" />\n {tr('notifications.v3.markAll', 'Mark all as read')}\n </Button>\n }\n settings={{\n label: tr('notifications.v3.settings', 'Notification settings'),\n onClick: () => navigate(paths.preferences),\n }}\n more={tools.map((tool) => ({\n id: tool.id,\n label: tool.label,\n onSelect: () => navigate(tool.href),\n }))}\n />\n <PageTabs\n ariaLabel={tr('notifications.v3.title', 'Notifications')}\n activeId={tab}\n tabs={INBOX_TABS.map((id) => ({\n id,\n label: tabLabel[id],\n href: `?tab=${id}`,\n badge: id === 'unread' && inbox.unreadCount > 0 ? inbox.unreadCount : undefined,\n }))}\n />\n <div className=\"mt-4 flex flex-col gap-3\">\n <label className=\"relative block max-w-md\">\n <span className=\"sr-only\">{tr('notifications.v3.search', 'Search notifications')}</span>\n <Search\n className=\"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-text-muted\"\n aria-hidden=\"true\"\n />\n <Input\n type=\"search\"\n className=\"pl-9\"\n value={search}\n placeholder={tr('notifications.v3.search', 'Search notifications')}\n onChange={(event) => inbox.updateFilter({ search: event.target.value })}\n data-testid=\"inbox-search\"\n />\n </label>\n {inbox.error && shown.length === 0 ? (\n <LoadError\n what={tr('notifications.v3.title', 'Notifications')}\n error={inbox.error}\n onRetry={() => void inbox.refetch()}\n />\n ) : !inbox.isLoading && shown.length === 0 ? (\n <InboxEmpty tab={tab} searching={Boolean(search.trim())} />\n ) : (\n <InboxRows\n notifications={shown}\n loading={inbox.isLoading && shown.length === 0}\n onOpen={(id) => {\n open(id);\n const notification = shown.find((n) => n.id === id);\n if (notification && isUnread(notification)) void inbox.markAsRead(id);\n }}\n onMarkRead={(id) => void inbox.markAsRead(id)}\n onMarkUnread={(id) => void markUnread([id]).then(() => inbox.refetch())}\n onArchive={(id) => void inbox.archiveNotification(id)}\n onRestore={(id) => void inbox.unarchiveNotification(id)}\n />\n )}\n {inbox.hasMore ? (\n <div className=\"flex justify-center\">\n <Button\n variant=\"ghost\"\n busy={inbox.isLoadingMore}\n onClick={() => void inbox.loadMore()}\n data-testid=\"inbox-more\"\n >\n {tr('notifications.v3.more', 'Show more')}\n </Button>\n </div>\n ) : null}\n </div>\n <NotificationDetailPanel\n id={openId}\n onClose={() => open(null)}\n onMarkUnread={(id) => void markUnread([id]).then(() => inbox.refetch())}\n onArchive={(id) => {\n void inbox.archiveNotification(id);\n open(null);\n }}\n onRestore={(id) => void inbox.unarchiveNotification(id)}\n />\n </div>\n );\n}\n\nfunction InboxEmpty({ tab, searching }: { tab: InboxTab; searching: boolean }) {\n const tr = useTr();\n if (searching) {\n return (\n <EmptyState\n kind=\"no-results\"\n title={tr('notifications.v3.empty.searchTitle', 'No notifications match')}\n description={tr('notifications.v3.empty.searchBody', 'Try other words.')}\n />\n );\n }\n const words: Record<InboxTab, [string, string]> = {\n all: [\n tr('notifications.v3.empty.allTitle', 'You’re all caught up'),\n tr('notifications.v3.empty.allBody', 'New notifications show up here and on the bell.'),\n ],\n unread: [\n tr('notifications.v3.empty.unreadTitle', 'Nothing unread'),\n tr('notifications.v3.empty.allBody', 'New notifications show up here and on the bell.'),\n ],\n action: [\n tr('notifications.v3.empty.actionTitle', 'Nothing waiting for you'),\n tr('notifications.v3.empty.actionBody', 'Approvals and requests show up here.'),\n ],\n archived: [\n tr('notifications.v3.empty.archivedTitle', 'Nothing archived'),\n tr(\n 'notifications.v3.empty.archivedBody',\n 'Archive a notification to keep it out of the way. It stays here.'\n ),\n ],\n };\n const [title, description] = words[tab];\n return (\n <EmptyState\n kind={tab === 'archived' ? 'first-use' : 'all-done'}\n title={title}\n description={description}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAuBA,IAAMC,IAA6D;CACjE,KAAK;EAAE,UAAU;EAAO,SAAS;CAAS;CAC1C,QAAQ;EAAE,UAAU;EAAO,SAAS;EAAU,QAAQ;CAAM;CAC5D,QAAQ;EAAE,UAAU;EAAO,SAAS;CAAS;CAC7C,UAAU;EAAE,UAAU;EAAM,SAAS;CAAS;AAChD,GACMC,IAAgB,EAAE,SAAS,SAAS;AAG1C,SAASC,EACP,GACA,GACe;CAKf,OAJIC,MAAQ,SAAeC,EAAM,OAC7BD,MAAQ,cAAoBC,EAAM,YAClCD,MAAQ,WAAiBC,EAAM,SAC/BD,MAAQ,YAAkBC,EAAM,cAC7B;AACT;AAEA,SAAgBC,IAAY;CAC1B,IAAMD,IAAQE,EAAqB,GAC7B,CAACC,KAAUC,EAAgB,GAC3BC,IAASP,EAAaK,EAAO,IAAI,KAAK,GAAGH,CAAK;CAEpD,OADIK,IAAe,kBAACC,GAAD;EAAU,IAAID;EAAQ,SAAA;CAAS,CAAA,IAC3C,kBAACV,GAAD,CAAQ,CAAA;AACjB;AAEA,SAASA,IAAQ;CACf,IAAMa,IAAKC,EAAM,GACXC,IAAWC,EAAY,GACvBC,IAASC,EAAU,GACnBb,IAAQE,EAAqB,GAC7B,EAAE,aAAUY,EAAc,GAC1B,CAACX,GAAQY,KAAaX,EAAgB,GACtCL,IAAMiB,EAAab,EAAO,IAAI,KAAK,CAAC,GACpCc,IAASd,EAAO,IAAI,MAAM,GAC1Be,IAAQC,EAAiB;EAAE,YAAYvB,EAAYG;EAAM,cAAcF;CAAc,CAAC,GACtFuB,IAAaC,EAAc,GAC3BC,IAAQC,QACLxB,MAAQ,WAAWmB,EAAM,cAAc,OAAOM,CAAW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,sCAAsC,yBAAyB,GAClEA,EAAG,qCAAqC,sCAAsC,CAChF;EACA,UAAU,CACRA,EAAG,wCAAwC,kBAAkB,GAC7DA,EACE,uCACA,kEACF,CACF;CAE2B,EAAMT;CACnC,OACE,kBAACoD,GAAD;EACE,MAAMpD,MAAQ,aAAa,cAAc;EAClC;EACM;CACd,CAAA;AAEL"}
1
+ {"version":3,"file":"InboxPage.js","names":["Inbox","TAB_FILTERS","UNREAD_FILTER","oldTabTarget","tab","paths","InboxPage","useNotificationPaths","params","useSearchParams","target","Navigate","Inbox$1","tr","useTr","navigate","useNavigate","notify","useNotify","useAdminTools","permissionsLoading","usePermissions","setParams","sendOpen","holdsAdminToolPermission","hasPermission","readInboxTab","openId","inbox","useNotifications","markUnread","useMarkUnread","shown","useMemo","needsAction","search","open","next","id","showSend","show","SEND_PARAM","markAll","unreadIds","isUnread","n","everyOne","tabLabel","WorkspacePage","PageHeader","Button","CheckCheck","tools","tool","PageTabs","INBOX_TABS","Search","Input","event","LoadError","InboxEmpty","InboxRows","notification","NotificationDetailPanel","SendNotificationDialog","searching","EmptyState","title","description"],"sources":["../../src/v2/InboxPage.tsx"],"sourcesContent":["/**\n * Notifications (BOFF-16785, C1; the mockup's `notif`), under fe-libs' `accountPagesV2`: the inbox\n * at the list width, tabs All · Unread · Needs action · Archived (`?tab=`), compact rows grouped by\n * day, \"Mark all as read\" with Undo, the settings under the gear and, for admins, Send a\n * notification (a dialog, `?send=1`), Templates, Topics and the Delivery log in ⋯. A row opens its panel (`?open=<id>`, decision 10). The same\n * queries as the inbox today (`useNotifications`).\n */\nimport { useMemo } from 'react';\nimport { Navigate, useNavigate, useSearchParams } from 'react-router';\nimport { CheckCheck, Search } from 'lucide-react';\nimport { PageHeader } from '@burdenoff/fe-libs/chrome';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n EmptyState,\n Input,\n LoadError,\n PageTabs,\n WorkspacePage,\n useNotify,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotifications } from '../hooks';\nimport type { NotificationFilter } from '../types';\nimport { useTr } from '../shared/hooks/useTr';\nimport { useNotificationPaths } from '../navigation-v2/paths';\nimport { holdsAdminToolPermission, useAdminTools } from '../navigation-v2/useAdminTools';\nimport { INBOX_TABS, isUnread, needsAction, readInboxTab, type InboxTab } from './model/inbox';\nimport { InboxRows } from './InboxRows';\nimport { NotificationDetailPanel } from './NotificationDetailPanel';\nimport { useMarkUnread } from './useNotificationDetail';\nimport { SendNotificationDialog } from './send/SendNotificationDialog';\nimport { SEND_PARAM } from './send/sendModel';\n\n/** What each tab asks the service for: the in-app inbox, archived or not, unread or not. */\nconst TAB_FILTERS: Record<InboxTab, Partial<NotificationFilter>> = {\n all: { archived: false, channel: 'IN_APP' },\n unread: { archived: false, channel: 'IN_APP', isRead: false },\n action: { archived: false, channel: 'IN_APP' },\n archived: { archived: true, channel: 'IN_APP' },\n};\nconst UNREAD_FILTER = { channel: 'IN_APP' };\n\n/** Where today's `?tab=` values still go (the round-1 landing's links). */\nfunction oldTabTarget(\n tab: string | null,\n paths: ReturnType<typeof useNotificationPaths>\n): string | null {\n if (tab === 'send') return paths.send;\n if (tab === 'templates') return paths.templates;\n if (tab === 'topics') return paths.topics;\n if (tab === 'history') return paths.deliveryLog;\n return null;\n}\n\nexport function InboxPage() {\n const paths = useNotificationPaths();\n const [params] = useSearchParams();\n const target = oldTabTarget(params.get('tab'), paths);\n if (target) return <Navigate to={target} replace />;\n return <Inbox />;\n}\n\nfunction Inbox() {\n const tr = useTr();\n const navigate = useNavigate();\n const notify = useNotify();\n const paths = useNotificationPaths();\n const { tools } = useAdminTools();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const [params, setParams] = useSearchParams();\n // Send a notification (C2b): a dialog over the inbox, for whoever may send.\n const sendOpen =\n params.get(SEND_PARAM) === '1' &&\n !permissionsLoading &&\n holdsAdminToolPermission('send', hasPermission);\n const tab = readInboxTab(params.get('tab'));\n const openId = params.get('open');\n const inbox = useNotifications({ baseFilter: TAB_FILTERS[tab], unreadFilter: UNREAD_FILTER });\n const markUnread = useMarkUnread();\n const shown = useMemo(\n () => (tab === 'action' ? inbox.notifications.filter(needsAction) : inbox.notifications),\n [inbox.notifications, tab]\n );\n const search = inbox.notificationFilter.search ?? '';\n\n const open = (id: string | null) => {\n const next = new URLSearchParams(params);\n if (id) next.set('open', id);\n else next.delete('open');\n setParams(next);\n };\n\n const showSend = (show: boolean) => {\n const next = new URLSearchParams(params);\n if (show) next.set(SEND_PARAM, '1');\n else next.delete(SEND_PARAM);\n setParams(next);\n };\n\n const markAll = async () => {\n // Undo can only bring back what's loaded: offer it when every unread one is on the page.\n const unreadIds = inbox.allNotifications.filter(isUnread).map((n) => n.id);\n const everyOne = unreadIds.length >= inbox.unreadCount;\n await inbox.markAllAsRead();\n notify({\n title: tr('notifications.v3.markedAll', 'Marked {{count}} as read', {\n count: inbox.unreadCount || unreadIds.length,\n }),\n tone: 'success',\n undo:\n everyOne && unreadIds.length > 0\n ? async () => {\n await markUnread(unreadIds);\n await inbox.refetch();\n }\n : undefined,\n });\n };\n\n const tabLabel: Record<InboxTab, string> = {\n all: tr('notifications.v3.tab.all', 'All'),\n unread: tr('notifications.v3.tab.unread', 'Unread'),\n action: tr('notifications.v3.tab.action', 'Needs action'),\n archived: tr('notifications.v3.tab.archived', 'Archived'),\n };\n\n return (\n <WorkspacePage>\n <PageHeader\n variant=\"compact\"\n title={tr('notifications.v3.title', 'Notifications')}\n description={tr(\n 'notifications.v3.purpose',\n 'Everything that needs you, and everything you were told.'\n )}\n primary={\n <Button\n variant=\"outline\"\n disabled={inbox.unreadCount === 0}\n onClick={() => void markAll()}\n data-testid=\"inbox-mark-all\"\n >\n <CheckCheck aria-hidden=\"true\" />\n {tr('notifications.v3.markAll', 'Mark all as read')}\n </Button>\n }\n settings={{\n label: tr('notifications.v3.settings', 'Notification settings'),\n onClick: () => navigate(paths.preferences),\n }}\n more={tools.map((tool) =>\n tool.id === 'send'\n ? {\n id: tool.id,\n label: tr('notifications.v3.send.title', 'Send a notification'),\n onSelect: () => showSend(true),\n }\n : { id: tool.id, label: tool.label, onSelect: () => navigate(tool.href) }\n )}\n />\n <PageTabs\n ariaLabel={tr('notifications.v3.title', 'Notifications')}\n activeId={tab}\n tabs={INBOX_TABS.map((id) => ({\n id,\n label: tabLabel[id],\n href: `?tab=${id}`,\n badge: id === 'unread' && inbox.unreadCount > 0 ? inbox.unreadCount : undefined,\n }))}\n />\n <div className=\"flex flex-col gap-3\">\n <label className=\"relative block max-w-md\">\n <span className=\"sr-only\">{tr('notifications.v3.search', 'Search notifications')}</span>\n <Search\n className=\"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-text-muted\"\n aria-hidden=\"true\"\n />\n <Input\n type=\"search\"\n className=\"pl-9\"\n value={search}\n placeholder={tr('notifications.v3.search', 'Search notifications')}\n onChange={(event) => inbox.updateFilter({ search: event.target.value })}\n data-testid=\"inbox-search\"\n />\n </label>\n {inbox.error && shown.length === 0 ? (\n <LoadError\n what={tr('notifications.v3.title', 'Notifications')}\n error={inbox.error}\n onRetry={() => void inbox.refetch()}\n />\n ) : !inbox.isLoading && shown.length === 0 ? (\n <InboxEmpty tab={tab} searching={Boolean(search.trim())} />\n ) : (\n <InboxRows\n notifications={shown}\n loading={inbox.isLoading && shown.length === 0}\n onOpen={(id) => {\n open(id);\n const notification = shown.find((n) => n.id === id);\n if (notification && isUnread(notification)) void inbox.markAsRead(id);\n }}\n onMarkRead={(id) => void inbox.markAsRead(id)}\n onMarkUnread={(id) => void markUnread([id]).then(() => inbox.refetch())}\n onArchive={(id) => void inbox.archiveNotification(id)}\n onRestore={(id) => void inbox.unarchiveNotification(id)}\n />\n )}\n {inbox.hasMore ? (\n <div className=\"flex justify-center\">\n <Button\n variant=\"ghost\"\n busy={inbox.isLoadingMore}\n onClick={() => void inbox.loadMore()}\n data-testid=\"inbox-more\"\n >\n {tr('notifications.v3.more', 'Show more')}\n </Button>\n </div>\n ) : null}\n </div>\n <NotificationDetailPanel\n id={openId}\n onClose={() => open(null)}\n inboxActions={{\n markUnread: (id) => void markUnread([id]).then(() => inbox.refetch()),\n archive: (id) => {\n void inbox.archiveNotification(id);\n open(null);\n },\n restore: (id) => void inbox.unarchiveNotification(id),\n }}\n />\n <SendNotificationDialog open={sendOpen} onClose={() => showSend(false)} />\n </WorkspacePage>\n );\n}\n\nfunction InboxEmpty({ tab, searching }: { tab: InboxTab; searching: boolean }) {\n const tr = useTr();\n if (searching) {\n return (\n <EmptyState\n kind=\"no-results\"\n title={tr('notifications.v3.empty.searchTitle', 'No notifications match')}\n description={tr('notifications.v3.empty.searchBody', 'Try other words.')}\n />\n );\n }\n const words: Record<InboxTab, [string, string]> = {\n all: [\n tr('notifications.v3.empty.allTitle', 'You’re all caught up'),\n tr('notifications.v3.empty.allBody', 'New notifications show up here and on the bell.'),\n ],\n unread: [\n tr('notifications.v3.empty.unreadTitle', 'Nothing unread'),\n tr('notifications.v3.empty.allBody', 'New notifications show up here and on the bell.'),\n ],\n action: [\n tr('notifications.v3.empty.actionTitle', 'Nothing waiting for you'),\n tr('notifications.v3.empty.actionBody', 'Approvals and requests show up here.'),\n ],\n archived: [\n tr('notifications.v3.empty.archivedTitle', 'Nothing archived'),\n tr(\n 'notifications.v3.empty.archivedBody',\n 'Archive a notification to keep it out of the way. It stays here.'\n ),\n ],\n };\n const [title, description] = words[tab];\n return (\n <EmptyState\n kind={tab === 'archived' ? 'first-use' : 'all-done'}\n title={title}\n description={description}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkCA,IAAMC,IAA6D;CACjE,KAAK;EAAE,UAAU;EAAO,SAAS;CAAS;CAC1C,QAAQ;EAAE,UAAU;EAAO,SAAS;EAAU,QAAQ;CAAM;CAC5D,QAAQ;EAAE,UAAU;EAAO,SAAS;CAAS;CAC7C,UAAU;EAAE,UAAU;EAAM,SAAS;CAAS;AAChD,GACMC,IAAgB,EAAE,SAAS,SAAS;AA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AkC,iDAAiD,CACxF;EACA,QAAQ,CACNA,EAAG,sCAAsC,yBAAyB,GAClEA,EAAG,qCAAqC,sCAAsC,CAChF;EACA,UAAU,CACRA,EAAG,wCAAwC,kBAAkB,GAC7DA,EACE,uCACA,kEACF,CACF;CAE2B,EAAMT;CACnC,OACE,kBAAC8D,GAAD;EACE,MAAM9D,MAAQ,aAAa,cAAc;EAClC;EACM;CACd,CAAA;AAEL"}
@@ -1,8 +1,12 @@
1
- export declare function NotificationDetailPanel({ id, onClose, onMarkUnread, onArchive, onRestore, }: {
1
+ /** What the person can do with their own notification: absent in the admins' delivery log. */
2
+ export interface InboxActions {
3
+ markUnread: (id: string) => void;
4
+ archive: (id: string) => void;
5
+ restore: (id: string) => void;
6
+ }
7
+ export declare function NotificationDetailPanel({ id, onClose, inboxActions, }: {
2
8
  id: string | null;
3
9
  onClose: () => void;
4
- /** The person's own inbox: absent in the admins' delivery log, which only reads. */
5
- onMarkUnread?: (id: string) => void;
6
- onArchive?: (id: string) => void;
7
- onRestore?: (id: string) => void;
10
+ /** The person's own inbox; the delivery log only reads, so it leaves these out. */
11
+ inboxActions?: InboxActions;
8
12
  }): import('react').JSX.Element;
@@ -13,57 +13,72 @@ import { Button as g, DetailPanel as _, IconTile as v, LoadError as y, Skeleton
13
13
  function C(e) {
14
14
  t(e) || window.open(e, "_blank", "noopener,noreferrer");
15
15
  }
16
- function w({ id: t, onClose: r, onMarkUnread: a, onArchive: o, onRestore: s }) {
17
- let l = e(), { state: u, retry: d } = c(t), f = u.status === "ready" ? u.notification : null, p = f ? n(f) : null;
16
+ function w({ id: t, onClose: r, inboxActions: a }) {
17
+ let o = e(), { state: s, retry: l } = c(t), u = s.status === "ready" ? s.notification : null, d = u ? n(u) : null, f = d && a ? /* @__PURE__ */ m(T, {
18
+ notification: d,
19
+ actions: a
20
+ }) : void 0;
18
21
  return /* @__PURE__ */ m(_, {
19
22
  open: !!t,
20
23
  onOpenChange: (e) => e ? void 0 : r(),
21
- title: p?.title ?? l("notifications.v3.panel.loading", "Notification"),
22
- sub: p ? /* @__PURE__ */ m(T, { notification: p }) : void 0,
23
- tile: p ? /* @__PURE__ */ m(v, {
24
+ title: d?.title ?? o("notifications.v3.panel.loading", "Notification"),
25
+ sub: d ? /* @__PURE__ */ m(D, { notification: d }) : void 0,
26
+ tile: d ? /* @__PURE__ */ m(v, {
24
27
  size: "md",
25
- children: /* @__PURE__ */ m(i, { notification: p })
28
+ children: /* @__PURE__ */ m(i, { notification: d })
26
29
  }) : void 0,
27
- closeLabel: l("notifications.v3.panel.close", "Close"),
30
+ closeLabel: o("notifications.v3.panel.close", "Close"),
28
31
  "data-testid": "notification-panel",
29
- footer: p && a && o && s ? /* @__PURE__ */ h("div", {
30
- className: "flex w-full flex-wrap gap-2",
31
- children: [/* @__PURE__ */ m(g, {
32
- variant: "outline",
33
- onClick: () => a(p.id),
34
- children: l("notifications.v3.markUnread", "Mark as unread")
35
- }), p.archivedAt ? /* @__PURE__ */ m(g, {
36
- variant: "ghost",
37
- onClick: () => s(p.id),
38
- children: l("notifications.v3.restore", "Move back to the inbox")
39
- }) : /* @__PURE__ */ m(g, {
40
- variant: "ghost",
41
- onClick: () => o(p.id),
42
- children: l("notifications.v3.archive", "Archive")
43
- })]
44
- }) : void 0,
45
- children: u.status === "loading" ? /* @__PURE__ */ h("div", {
46
- className: "flex flex-col gap-3",
47
- "aria-busy": "true",
48
- children: [
49
- /* @__PURE__ */ m(b, { className: "h-4 w-3/4" }),
50
- /* @__PURE__ */ m(b, { className: "h-4 w-2/3" }),
51
- /* @__PURE__ */ m(b, { className: "h-24 w-full" })
52
- ]
53
- }) : u.status === "failed" ? /* @__PURE__ */ m(y, {
54
- what: l("notifications.v3.panel.what", "This notification"),
55
- error: u.error,
56
- onRetry: d
57
- }) : u.status === "missing" || !f || !p ? /* @__PURE__ */ m("p", {
58
- className: "m-0 text-sm text-text-secondary",
59
- children: l("notifications.v3.panel.missing", "This notification isn’t available any more. It may have been deleted.")
60
- }) : /* @__PURE__ */ m(E, {
61
- notification: p,
62
- data: f
32
+ footer: f,
33
+ children: /* @__PURE__ */ m(E, {
34
+ state: s,
35
+ retry: l,
36
+ notification: d
63
37
  })
64
38
  });
65
39
  }
66
- function T({ notification: t }) {
40
+ function T({ notification: t, actions: n }) {
41
+ let r = e();
42
+ return /* @__PURE__ */ h("div", {
43
+ className: "flex w-full flex-wrap gap-2",
44
+ children: [/* @__PURE__ */ m(g, {
45
+ variant: "outline",
46
+ onClick: () => n.markUnread(t.id),
47
+ children: r("notifications.v3.markUnread", "Mark as unread")
48
+ }), t.archivedAt ? /* @__PURE__ */ m(g, {
49
+ variant: "ghost",
50
+ onClick: () => n.restore(t.id),
51
+ children: r("notifications.v3.restore", "Move back to the inbox")
52
+ }) : /* @__PURE__ */ m(g, {
53
+ variant: "ghost",
54
+ onClick: () => n.archive(t.id),
55
+ children: r("notifications.v3.archive", "Archive")
56
+ })]
57
+ });
58
+ }
59
+ function E({ state: t, retry: n, notification: r }) {
60
+ let i = e();
61
+ return t.status === "loading" ? /* @__PURE__ */ h("div", {
62
+ className: "flex flex-col gap-3",
63
+ "aria-busy": "true",
64
+ children: [
65
+ /* @__PURE__ */ m(b, { className: "h-4 w-3/4" }),
66
+ /* @__PURE__ */ m(b, { className: "h-4 w-2/3" }),
67
+ /* @__PURE__ */ m(b, { className: "h-24 w-full" })
68
+ ]
69
+ }) : t.status === "failed" ? /* @__PURE__ */ m(y, {
70
+ what: i("notifications.v3.panel.what", "This notification"),
71
+ error: t.error,
72
+ onRetry: n
73
+ }) : t.status !== "ready" || !r ? /* @__PURE__ */ m("p", {
74
+ className: "m-0 text-sm text-text-secondary",
75
+ children: i("notifications.v3.panel.missing", "This notification isn’t available any more. It may have been deleted.")
76
+ }) : /* @__PURE__ */ m(O, {
77
+ notification: r,
78
+ data: t.notification
79
+ });
80
+ }
81
+ function D({ notification: t }) {
67
82
  let n = e(), i = S();
68
83
  return /* @__PURE__ */ h("span", {
69
84
  className: "flex flex-wrap items-center gap-2",
@@ -76,7 +91,7 @@ function T({ notification: t }) {
76
91
  }) : null]
77
92
  });
78
93
  }
79
- function E({ notification: t, data: n }) {
94
+ function O({ notification: t, data: n }) {
80
95
  let r = e(), i = a(n.metadata), o = t.actions;
81
96
  return /* @__PURE__ */ h("div", {
82
97
  className: "flex flex-col gap-5",
@@ -86,7 +101,7 @@ function E({ notification: t, data: n }) {
86
101
  "data-testid": "panel-message",
87
102
  children: t.body
88
103
  }),
89
- i ? /* @__PURE__ */ m(D, {
104
+ i ? /* @__PURE__ */ m(k, {
90
105
  thing: i,
91
106
  actionUrl: t.actionUrl
92
107
  }) : null,
@@ -102,11 +117,11 @@ function E({ notification: t, data: n }) {
102
117
  children: [/* @__PURE__ */ m(l, { "aria-hidden": "true" }), r("notifications.v3.panel.open", "Open where it happened")]
103
118
  }) : null]
104
119
  }) : null,
105
- /* @__PURE__ */ m(A, { events: n.events })
120
+ /* @__PURE__ */ m(M, { events: n.events })
106
121
  ]
107
122
  });
108
123
  }
109
- function D({ thing: t, actionUrl: n }) {
124
+ function k({ thing: t, actionUrl: n }) {
110
125
  let r = e(), i = S(), a = o(t, r);
111
126
  return /* @__PURE__ */ h("section", {
112
127
  className: "flex flex-col gap-2 rounded-lg border border-border-subtle bg-bg-sunken p-3",
@@ -149,18 +164,18 @@ function D({ thing: t, actionUrl: n }) {
149
164
  ]
150
165
  });
151
166
  }
152
- var O = {
167
+ var A = {
153
168
  ok: u,
154
169
  bad: p,
155
170
  waiting: d,
156
171
  neutral: d
157
- }, k = {
172
+ }, j = {
158
173
  ok: "text-status-success-text",
159
174
  bad: "text-status-error-text",
160
175
  waiting: "text-status-warning-text",
161
176
  neutral: "text-text-muted"
162
177
  };
163
- function A({ events: t }) {
178
+ function M({ events: t }) {
164
179
  let n = e(), r = S(), i = s(t, n);
165
180
  return i.length === 0 ? null : /* @__PURE__ */ h("section", {
166
181
  className: "flex flex-col gap-2",
@@ -172,12 +187,12 @@ function A({ events: t }) {
172
187
  className: "m-0 flex list-none flex-col gap-2 p-0",
173
188
  "data-testid": "panel-timeline",
174
189
  children: i.map((e) => {
175
- let t = O[e.tone];
190
+ let t = A[e.tone];
176
191
  return /* @__PURE__ */ h("li", {
177
192
  className: "flex items-center gap-2 text-sm",
178
193
  children: [
179
194
  /* @__PURE__ */ m(t, {
180
- className: `size-4 ${k[e.tone]}`,
195
+ className: `size-4 ${j[e.tone]}`,
181
196
  "aria-hidden": "true"
182
197
  }),
183
198
  /* @__PURE__ */ m("span", {