@burdenoff/microfe-notification 2026.1127.1 → 2026.1129.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 (53) hide show
  1. package/dist/NotificationRoutes.d.ts +10 -0
  2. package/dist/NotificationRoutes.js +76 -71
  3. package/dist/NotificationRoutes.js.map +1 -1
  4. package/dist/generated/global-operations.d.ts +58 -3
  5. package/dist/generated/global-operations.js +31 -23
  6. package/dist/generated/global-operations.js.map +1 -1
  7. package/dist/generated/global-types.d.ts +10933 -581
  8. package/dist/hooks/useNotificationAnalytics.d.ts +1 -1
  9. package/dist/hooks/useNotificationAnalytics.js.map +1 -1
  10. package/dist/hooks/useNotifications.d.ts +7 -0
  11. package/dist/hooks/useNotifications.js +1 -1
  12. package/dist/hooks/useNotifications.js.map +1 -1
  13. package/dist/translations/en.d.ts +80 -0
  14. package/dist/types/index.d.ts +2 -1
  15. package/dist/v2/ArchivedRedirect.d.ts +1 -0
  16. package/dist/v2/ArchivedRedirect.js +14 -0
  17. package/dist/v2/ArchivedRedirect.js.map +1 -0
  18. package/dist/v2/InboxPage.d.ts +1 -0
  19. package/dist/v2/InboxPage.js +191 -0
  20. package/dist/v2/InboxPage.js.map +1 -0
  21. package/dist/v2/InboxRows.d.ts +10 -0
  22. package/dist/v2/InboxRows.js +101 -0
  23. package/dist/v2/InboxRows.js.map +1 -0
  24. package/dist/v2/KindIcon.d.ts +4 -0
  25. package/dist/v2/KindIcon.js +33 -0
  26. package/dist/v2/KindIcon.js.map +1 -0
  27. package/dist/v2/NotificationDetailPanel.d.ts +7 -0
  28. package/dist/v2/NotificationDetailPanel.js +200 -0
  29. package/dist/v2/NotificationDetailPanel.js.map +1 -0
  30. package/dist/v2/PreferencesPage.d.ts +1 -0
  31. package/dist/v2/PreferencesPage.js +139 -0
  32. package/dist/v2/PreferencesPage.js.map +1 -0
  33. package/dist/v2/__tests__/routeShapes.d.ts +13 -0
  34. package/dist/v2/model/days.d.ts +9 -0
  35. package/dist/v2/model/days.js +25 -0
  36. package/dist/v2/model/days.js.map +1 -0
  37. package/dist/v2/model/events.d.ts +17 -0
  38. package/dist/v2/model/events.js +72 -0
  39. package/dist/v2/model/events.js.map +1 -0
  40. package/dist/v2/model/icons.d.ts +6 -0
  41. package/dist/v2/model/icons.js +19 -0
  42. package/dist/v2/model/icons.js.map +1 -0
  43. package/dist/v2/model/inbox.d.ts +15 -0
  44. package/dist/v2/model/inbox.js +22 -0
  45. package/dist/v2/model/inbox.js.map +1 -0
  46. package/dist/v2/model/thing.d.ts +16 -0
  47. package/dist/v2/model/thing.js +41 -0
  48. package/dist/v2/model/thing.js.map +1 -0
  49. package/dist/v2/model/tr.d.ts +2 -0
  50. package/dist/v2/useNotificationDetail.d.ts +19 -0
  51. package/dist/v2/useNotificationDetail.js +65 -0
  52. package/dist/v2/useNotificationDetail.js.map +1 -0
  53. package/package.json +2 -2
@@ -0,0 +1,25 @@
1
+ // src/v2/model/days.ts
2
+ function e(e) {
3
+ return `${e.getFullYear()}-${e.getMonth() + 1}-${e.getDate()}`;
4
+ }
5
+ function t(t, n, r = /* @__PURE__ */ new Date(), i) {
6
+ let a = e(r), o = e(new Date(r.getFullYear(), r.getMonth(), r.getDate() - 1)), s = new Intl.DateTimeFormat(i, {
7
+ day: "numeric",
8
+ month: "long",
9
+ year: "numeric"
10
+ }), c = /* @__PURE__ */ new Map(), l = [...t].sort((e, t) => Date.parse(t.createdAt) - Date.parse(e.createdAt));
11
+ for (let t of l) {
12
+ let r = new Date(t.createdAt);
13
+ if (Number.isNaN(r.getTime())) continue;
14
+ let i = e(r), l = i === a ? n("notifications.v3.today", "Today") : i === o ? n("notifications.v3.yesterday", "Yesterday") : s.format(r), u = c.get(i) ?? {
15
+ key: i,
16
+ label: l,
17
+ items: []
18
+ };
19
+ u.items.push(t), c.set(i, u);
20
+ }
21
+ return [...c.values()];
22
+ }
23
+ export { t as groupByDay };
24
+
25
+ //# sourceMappingURL=days.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"days.js","names":["dayKey","date","groupByDay","today","now","yesterday","format","locale","groups","sorted","items","b","a","item","key","label","tr","group"],"sources":["../../../src/v2/model/days.ts"],"sourcesContent":["/**\n * The inbox's day groups (BOFF-16785, C1): Today, Yesterday, then the date, newest first.\n */\nimport type { Tr } from './tr';\n\nexport interface DayGroup<T> {\n key: string;\n label: string;\n items: T[];\n}\n\nfunction dayKey(date: Date): string {\n return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;\n}\n\nexport function groupByDay<T extends { createdAt: string }>(\n items: readonly T[],\n tr: Tr,\n now: Date = new Date(),\n locale?: string\n): DayGroup<T>[] {\n const today = dayKey(now);\n const yesterday = dayKey(new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1));\n const format = new Intl.DateTimeFormat(locale, {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n });\n const groups = new Map<string, DayGroup<T>>();\n const sorted = [...items].sort((a, b) => Date.parse(b.createdAt) - Date.parse(a.createdAt));\n for (const item of sorted) {\n const date = new Date(item.createdAt);\n if (Number.isNaN(date.getTime())) continue;\n const key = dayKey(date);\n const label =\n key === today\n ? tr('notifications.v3.today', 'Today')\n : key === yesterday\n ? tr('notifications.v3.yesterday', 'Yesterday')\n : format.format(date);\n const group = groups.get(key) ?? { key, label, items: [] };\n group.items.push(item);\n groups.set(key, group);\n }\n return [...groups.values()];\n}\n"],"mappings":";AAWA,SAASA,EAAO,GAAoB;CAClC,OAAO,GAAGC,EAAK,YAAY,EAAE,GAAGA,EAAK,SAAS,IAAI,EAAE,GAAGA,EAAK,QAAQ;AACtE;AAEA,SAAgBC,EACd,GACA,GACA,oBAAY,IAAI,KAAK,GACrB,GACe;CACf,IAAMC,IAAQH,EAAOI,CAAG,GAClBC,IAAYL,EAAO,IAAI,KAAKI,EAAI,YAAY,GAAGA,EAAI,SAAS,GAAGA,EAAI,QAAQ,IAAI,CAAC,CAAC,GACjFE,IAAS,IAAI,KAAK,eAAeC,GAAQ;EAC7C,KAAK;EACL,OAAO;EACP,MAAM;CACR,CAAC,GACKC,oBAAS,IAAI,IAAyB,GACtCC,IAAS,CAAC,GAAGC,CAAK,CAAC,CAAC,MAAM,GAAG,MAAM,KAAK,MAAMC,EAAE,SAAS,IAAI,KAAK,MAAMC,EAAE,SAAS,CAAC;CAC1F,KAAK,IAAMC,KAAQJ,GAAQ;EACzB,IAAMR,IAAO,IAAI,KAAKY,EAAK,SAAS;EACpC,IAAI,OAAO,MAAMZ,EAAK,QAAQ,CAAC,GAAG;EAClC,IAAMa,IAAMd,EAAOC,CAAI,GACjBc,IACJD,MAAQX,IACJa,EAAG,0BAA0B,OAAO,IACpCF,MAAQT,IACNW,EAAG,8BAA8B,WAAW,IAC5CV,EAAO,OAAOL,CAAI,GACpBgB,IAAQT,EAAO,IAAIM,CAAG,KAAK;GAAE;GAAK;GAAO,OAAO,CAAC;EAAE;EAEzD,AADAG,EAAM,MAAM,KAAKJ,CAAI,GACrBL,EAAO,IAAIM,GAAKG,CAAK;CACvB;CACA,OAAO,CAAC,GAAGT,EAAO,OAAO,CAAC;AAC5B"}
@@ -0,0 +1,17 @@
1
+ import { Tr } from './tr';
2
+ export type EventTone = 'ok' | 'bad' | 'waiting' | 'neutral';
3
+ export interface TimelineEvent {
4
+ id: string;
5
+ at: string;
6
+ words: string;
7
+ tone: EventTone;
8
+ }
9
+ export declare function eventWords(eventType: string, tr: Tr): {
10
+ words: string;
11
+ tone: EventTone;
12
+ };
13
+ export declare function timeline(events: readonly {
14
+ id: string;
15
+ eventType: string;
16
+ timestamp: string;
17
+ }[], tr: Tr): TimelineEvent[];
@@ -0,0 +1,72 @@
1
+ // src/v2/model/events.ts
2
+ function e(e, t) {
3
+ switch (e) {
4
+ case "CREATED": return {
5
+ words: t("notifications.v3.event.created", "Created"),
6
+ tone: "neutral"
7
+ };
8
+ case "SCHEDULED": return {
9
+ words: t("notifications.v3.event.scheduled", "Scheduled"),
10
+ tone: "waiting"
11
+ };
12
+ case "TRIGGERED":
13
+ case "SENT": return {
14
+ words: t("notifications.v3.event.sent", "Sent"),
15
+ tone: "neutral"
16
+ };
17
+ case "DELIVERED": return {
18
+ words: t("notifications.v3.event.delivered", "Delivered"),
19
+ tone: "ok"
20
+ };
21
+ case "OPENED": return {
22
+ words: t("notifications.v3.event.opened", "Opened"),
23
+ tone: "ok"
24
+ };
25
+ case "CLICKED": return {
26
+ words: t("notifications.v3.event.clicked", "Its action was used"),
27
+ tone: "ok"
28
+ };
29
+ case "RETRY": return {
30
+ words: t("notifications.v3.event.retry", "Tried again"),
31
+ tone: "waiting"
32
+ };
33
+ case "FAILED": return {
34
+ words: t("notifications.v3.event.failed", "Couldn’t be delivered"),
35
+ tone: "bad"
36
+ };
37
+ case "BOUNCED": return {
38
+ words: t("notifications.v3.event.bounced", "The address didn’t accept it"),
39
+ tone: "bad"
40
+ };
41
+ case "COMPLAINED": return {
42
+ words: t("notifications.v3.event.complained", "Marked as spam"),
43
+ tone: "bad"
44
+ };
45
+ case "UNSUBSCRIBED": return {
46
+ words: t("notifications.v3.event.unsubscribed", "Unsubscribed"),
47
+ tone: "neutral"
48
+ };
49
+ case "EXPIRED": return {
50
+ words: t("notifications.v3.event.expired", "Expired"),
51
+ tone: "neutral"
52
+ };
53
+ case "CANCELLED": return {
54
+ words: t("notifications.v3.event.cancelled", "Cancelled"),
55
+ tone: "neutral"
56
+ };
57
+ default: return {
58
+ words: t("notifications.v3.event.other", "Updated"),
59
+ tone: "neutral"
60
+ };
61
+ }
62
+ }
63
+ function t(t, n) {
64
+ return [...t].filter((e) => !Number.isNaN(Date.parse(e.timestamp))).sort((e, t) => Date.parse(e.timestamp) - Date.parse(t.timestamp)).map((t) => ({
65
+ id: t.id,
66
+ at: t.timestamp,
67
+ ...e(t.eventType, n)
68
+ }));
69
+ }
70
+ export { e as eventWords, t as timeline };
71
+
72
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","names":["eventWords","eventType","tr","timeline","events","event","a","b"],"sources":["../../../src/v2/model/events.ts"],"sourcesContent":["/**\n * A notification's timeline in words (BOFF-16785, C1): each delivery event as what happened, with a\n * tone (and so an icon), oldest first.\n */\nimport type { Tr } from './tr';\n\nexport type EventTone = 'ok' | 'bad' | 'waiting' | 'neutral';\n\nexport interface TimelineEvent {\n id: string;\n at: string;\n words: string;\n tone: EventTone;\n}\n\nexport function eventWords(eventType: string, tr: Tr): { words: string; tone: EventTone } {\n switch (eventType) {\n case 'CREATED':\n return { words: tr('notifications.v3.event.created', 'Created'), tone: 'neutral' };\n case 'SCHEDULED':\n return { words: tr('notifications.v3.event.scheduled', 'Scheduled'), tone: 'waiting' };\n case 'TRIGGERED':\n case 'SENT':\n return { words: tr('notifications.v3.event.sent', 'Sent'), tone: 'neutral' };\n case 'DELIVERED':\n return { words: tr('notifications.v3.event.delivered', 'Delivered'), tone: 'ok' };\n case 'OPENED':\n return { words: tr('notifications.v3.event.opened', 'Opened'), tone: 'ok' };\n case 'CLICKED':\n return { words: tr('notifications.v3.event.clicked', 'Its action was used'), tone: 'ok' };\n case 'RETRY':\n return { words: tr('notifications.v3.event.retry', 'Tried again'), tone: 'waiting' };\n case 'FAILED':\n return { words: tr('notifications.v3.event.failed', 'Couldn’t be delivered'), tone: 'bad' };\n case 'BOUNCED':\n return {\n words: tr('notifications.v3.event.bounced', 'The address didn’t accept it'),\n tone: 'bad',\n };\n case 'COMPLAINED':\n return { words: tr('notifications.v3.event.complained', 'Marked as spam'), tone: 'bad' };\n case 'UNSUBSCRIBED':\n return { words: tr('notifications.v3.event.unsubscribed', 'Unsubscribed'), tone: 'neutral' };\n case 'EXPIRED':\n return { words: tr('notifications.v3.event.expired', 'Expired'), tone: 'neutral' };\n case 'CANCELLED':\n return { words: tr('notifications.v3.event.cancelled', 'Cancelled'), tone: 'neutral' };\n default:\n return { words: tr('notifications.v3.event.other', 'Updated'), tone: 'neutral' };\n }\n}\n\nexport function timeline(\n events: readonly { id: string; eventType: string; timestamp: string }[],\n tr: Tr\n): TimelineEvent[] {\n return [...events]\n .filter((event) => !Number.isNaN(Date.parse(event.timestamp)))\n .sort((a, b) => Date.parse(a.timestamp) - Date.parse(b.timestamp))\n .map((event) => ({ id: event.id, at: event.timestamp, ...eventWords(event.eventType, tr) }));\n}\n"],"mappings":";AAeA,SAAgBA,EAAW,GAAmB,GAA4C;CACxF,QAAQC,GAAR;EACE,KAAK,WACH,OAAO;GAAE,OAAOC,EAAG,kCAAkC,SAAS;GAAG,MAAM;EAAU;EACnF,KAAK,aACH,OAAO;GAAE,OAAOA,EAAG,oCAAoC,WAAW;GAAG,MAAM;EAAU;EACvF,KAAK;EACL,KAAK,QACH,OAAO;GAAE,OAAOA,EAAG,+BAA+B,MAAM;GAAG,MAAM;EAAU;EAC7E,KAAK,aACH,OAAO;GAAE,OAAOA,EAAG,oCAAoC,WAAW;GAAG,MAAM;EAAK;EAClF,KAAK,UACH,OAAO;GAAE,OAAOA,EAAG,iCAAiC,QAAQ;GAAG,MAAM;EAAK;EAC5E,KAAK,WACH,OAAO;GAAE,OAAOA,EAAG,kCAAkC,qBAAqB;GAAG,MAAM;EAAK;EAC1F,KAAK,SACH,OAAO;GAAE,OAAOA,EAAG,gCAAgC,aAAa;GAAG,MAAM;EAAU;EACrF,KAAK,UACH,OAAO;GAAE,OAAOA,EAAG,iCAAiC,uBAAuB;GAAG,MAAM;EAAM;EAC5F,KAAK,WACH,OAAO;GACL,OAAOA,EAAG,kCAAkC,8BAA8B;GAC1E,MAAM;EACR;EACF,KAAK,cACH,OAAO;GAAE,OAAOA,EAAG,qCAAqC,gBAAgB;GAAG,MAAM;EAAM;EACzF,KAAK,gBACH,OAAO;GAAE,OAAOA,EAAG,uCAAuC,cAAc;GAAG,MAAM;EAAU;EAC7F,KAAK,WACH,OAAO;GAAE,OAAOA,EAAG,kCAAkC,SAAS;GAAG,MAAM;EAAU;EACnF,KAAK,aACH,OAAO;GAAE,OAAOA,EAAG,oCAAoC,WAAW;GAAG,MAAM;EAAU;EACvF,SACE,OAAO;GAAE,OAAOA,EAAG,gCAAgC,SAAS;GAAG,MAAM;EAAU;CACnF;AACF;AAEA,SAAgBC,EACd,GACA,GACiB;CACjB,OAAO,CAAC,GAAGC,CAAM,CAAC,CACf,QAAQ,MAAU,CAAC,OAAO,MAAM,KAAK,MAAMC,EAAM,SAAS,CAAC,CAAC,CAAC,CAC7D,MAAM,GAAG,MAAM,KAAK,MAAMC,EAAE,SAAS,IAAI,KAAK,MAAMC,EAAE,SAAS,CAAC,CAAC,CACjE,KAAK,OAAW;EAAE,IAAIF,EAAM;EAAI,IAAIA,EAAM;EAAW,GAAGL,EAAWK,EAAM,WAAWH,CAAE;CAAE,EAAE;AAC/F"}
@@ -0,0 +1,6 @@
1
+ import { Notification } from '../../types';
2
+ import { NotificationTone } from './inbox';
3
+ export type NotificationIconName = 'megaphone' | 'alert' | 'hand' | 'activity' | 'info';
4
+ /** The icon's colour adds to its shape, never replaces it. */
5
+ export declare const TONE_TEXT: Record<NotificationTone, string | undefined>;
6
+ export declare function notificationIconName(notification: Pick<Notification, 'type' | 'priority' | 'actions'>): NotificationIconName;
@@ -0,0 +1,19 @@
1
+ import { notificationTone as e } from "./inbox.js";
2
+ // src/v2/model/icons.ts
3
+ var t = {
4
+ bad: "alert",
5
+ warn: "hand",
6
+ accent: "activity",
7
+ neutral: "info"
8
+ }, n = {
9
+ bad: "text-status-error-text",
10
+ warn: "text-status-warning-text",
11
+ accent: void 0,
12
+ neutral: void 0
13
+ };
14
+ function r(n) {
15
+ return n.type === "MARKETING" ? "megaphone" : t[e(n)];
16
+ }
17
+ export { n as TONE_TEXT, r as notificationIconName };
18
+
19
+ //# sourceMappingURL=icons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.js","names":["TONE_ICON","TONE_TEXT","notificationIconName","notification","notificationTone"],"sources":["../../../src/v2/model/icons.ts"],"sourcesContent":["/**\n * A notification's icon and its colour (BOFF-16785, C1): the shape says the kind; the colour adds to\n * it, never replaces it.\n */\nimport type { Notification } from '../../types';\nimport { notificationTone, type NotificationTone } from './inbox';\n\nexport type NotificationIconName = 'megaphone' | 'alert' | 'hand' | 'activity' | 'info';\n\nconst TONE_ICON: Record<NotificationTone, NotificationIconName> = {\n bad: 'alert',\n warn: 'hand',\n accent: 'activity',\n neutral: 'info',\n};\n\n/** The icon's colour adds to its shape, never replaces it. */\nexport const TONE_TEXT: Record<NotificationTone, string | undefined> = {\n bad: 'text-status-error-text',\n warn: 'text-status-warning-text',\n accent: undefined,\n neutral: undefined,\n};\n\nexport function notificationIconName(\n notification: Pick<Notification, 'type' | 'priority' | 'actions'>\n): NotificationIconName {\n if (notification.type === 'MARKETING') return 'megaphone';\n return TONE_ICON[notificationTone(notification)];\n}\n"],"mappings":";;AASA,IAAMA,IAA4D;CAChE,KAAK;CACL,MAAM;CACN,QAAQ;CACR,SAAS;AACX,GAGaC,IAA0D;CACrE,KAAK;CACL,MAAM;CACN,QAAQ,KAAA;CACR,SAAS,KAAA;AACX;AAEA,SAAgBC,EACd,GACsB;CAEtB,OADIC,EAAa,SAAS,cAAoB,cACvCH,EAAUI,EAAiBD,CAAY;AAChD"}
@@ -0,0 +1,15 @@
1
+ import { Notification } from '../../types';
2
+ export declare const INBOX_TABS: readonly ["all", "unread", "action", "archived"];
3
+ export type InboxTab = (typeof INBOX_TABS)[number];
4
+ /** The `?tab=` value, when it names a tab; else All. */
5
+ export declare function readInboxTab(value: string | null | undefined): InboxTab;
6
+ /** It asks the person to do something: it carries action buttons. */
7
+ export declare function needsAction(notification: Pick<Notification, 'actions'>): boolean;
8
+ /**
9
+ * The tone of a notification's tile: `bad` for alerts and urgent ones, `warn` when it needs the
10
+ * person, `accent` for activity, `neutral` for everything else.
11
+ */
12
+ export type NotificationTone = 'bad' | 'warn' | 'accent' | 'neutral';
13
+ export declare function notificationTone(notification: Pick<Notification, 'type' | 'priority' | 'actions'>): NotificationTone;
14
+ /** Unread: never read, and not archived. */
15
+ export declare function isUnread(notification: Pick<Notification, 'readAt' | 'archivedAt'>): boolean;
@@ -0,0 +1,22 @@
1
+ // src/v2/model/inbox.ts
2
+ var e = [
3
+ "all",
4
+ "unread",
5
+ "action",
6
+ "archived"
7
+ ];
8
+ function t(t) {
9
+ return e.find((e) => e === t) ?? "all";
10
+ }
11
+ function n(e) {
12
+ return e.actions.length > 0;
13
+ }
14
+ function r(e) {
15
+ return e.type === "ALERT" || e.priority === "URGENT" ? "bad" : n(e) ? "warn" : e.type === "TRANSACTIONAL" ? "accent" : "neutral";
16
+ }
17
+ function i(e) {
18
+ return !e.readAt && !e.archivedAt;
19
+ }
20
+ export { e as INBOX_TABS, i as isUnread, n as needsAction, r as notificationTone, t as readInboxTab };
21
+
22
+ //# sourceMappingURL=inbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbox.js","names":["INBOX_TABS","readInboxTab","tab","value","needsAction","notification","notificationTone","isUnread"],"sources":["../../../src/v2/model/inbox.ts"],"sourcesContent":["/**\n * The inbox in plain words (BOFF-16785, C1; the mockup's `notif`): its tabs, what kind each\n * notification is (an icon and a tone, never colour alone), and when it needs the person.\n */\nimport type { Notification } from '../../types';\n\nexport const INBOX_TABS = ['all', 'unread', 'action', 'archived'] as const;\nexport type InboxTab = (typeof INBOX_TABS)[number];\n\n/** The `?tab=` value, when it names a tab; else All. */\nexport function readInboxTab(value: string | null | undefined): InboxTab {\n return INBOX_TABS.find((tab) => tab === value) ?? 'all';\n}\n\n/** It asks the person to do something: it carries action buttons. */\nexport function needsAction(notification: Pick<Notification, 'actions'>): boolean {\n return notification.actions.length > 0;\n}\n\n/**\n * The tone of a notification's tile: `bad` for alerts and urgent ones, `warn` when it needs the\n * person, `accent` for activity, `neutral` for everything else.\n */\nexport type NotificationTone = 'bad' | 'warn' | 'accent' | 'neutral';\n\nexport function notificationTone(\n notification: Pick<Notification, 'type' | 'priority' | 'actions'>\n): NotificationTone {\n if (notification.type === 'ALERT' || notification.priority === 'URGENT') return 'bad';\n if (needsAction(notification)) return 'warn';\n if (notification.type === 'TRANSACTIONAL') return 'accent';\n return 'neutral';\n}\n\n/** Unread: never read, and not archived. */\nexport function isUnread(notification: Pick<Notification, 'readAt' | 'archivedAt'>): boolean {\n return !notification.readAt && !notification.archivedAt;\n}\n"],"mappings":";AAMA,IAAaA,IAAa;CAAC;CAAO;CAAU;CAAU;AAAU;AAIhE,SAAgBC,EAAa,GAA4C;CACvE,OAAOD,EAAW,MAAM,MAAQE,MAAQC,CAAK,KAAK;AACpD;AAGA,SAAgBC,EAAY,GAAsD;CAChF,OAAOC,EAAa,QAAQ,SAAS;AACvC;AAQA,SAAgBC,EACd,GACkB;CAIlB,OAHID,EAAa,SAAS,WAAWA,EAAa,aAAa,WAAiB,QAC5ED,EAAYC,CAAY,IAAU,SAClCA,EAAa,SAAS,kBAAwB,WAC3C;AACT;AAGA,SAAgBE,EAAS,GAAoE;CAC3F,OAAO,CAACF,EAAa,UAAU,CAACA,EAAa;AAC/C"}
@@ -0,0 +1,16 @@
1
+ import { Tr } from './tr';
2
+ export interface NotificationThing {
3
+ workflowName: string;
4
+ step: string | null;
5
+ attempt: number | null;
6
+ affectedRuns: number | null;
7
+ firstSeenAt: string | null;
8
+ runId: string | null;
9
+ }
10
+ export declare function notificationThing(metadata: unknown): NotificationThing | null;
11
+ /** The block's lines, in words: "Step: Send invoice", "Attempt 3", "Affects 12 runs". */
12
+ export declare function thingFacts(thing: NotificationThing, tr: Tr): {
13
+ id: string;
14
+ label: string;
15
+ value: string;
16
+ }[];
@@ -0,0 +1,41 @@
1
+ // src/v2/model/thing.ts
2
+ function e(e) {
3
+ return typeof e == "string" && e.trim() ? e.trim() : null;
4
+ }
5
+ function t(e) {
6
+ let t = typeof e == "string" ? Number(e) : e;
7
+ return typeof t == "number" && Number.isFinite(t) && t >= 0 ? Math.floor(t) : null;
8
+ }
9
+ function n(n) {
10
+ if (typeof n != "object" || !n || Array.isArray(n)) return null;
11
+ let r = new Map(Object.entries(n)), i = e(r.get("workflowName"));
12
+ if (!i) return null;
13
+ let a = e(r.get("firstSeenAt"));
14
+ return {
15
+ workflowName: i,
16
+ step: e(r.get("stepName")) ?? e(r.get("nodeId")),
17
+ attempt: t(r.get("attempt")),
18
+ affectedRuns: t(r.get("affectedRuns")),
19
+ firstSeenAt: a && !Number.isNaN(Date.parse(a)) ? a : null,
20
+ runId: e(r.get("runId"))
21
+ };
22
+ }
23
+ function r(e, t) {
24
+ let n = [];
25
+ return e.step && n.push({
26
+ id: "step",
27
+ label: t("notifications.v3.thing.step", "Step"),
28
+ value: e.step
29
+ }), e.attempt !== null && n.push({
30
+ id: "attempt",
31
+ label: t("notifications.v3.thing.attempt", "Attempt"),
32
+ value: String(e.attempt)
33
+ }), e.affectedRuns !== null && n.push({
34
+ id: "runs",
35
+ label: t("notifications.v3.thing.affectedRuns", "Runs affected"),
36
+ value: String(e.affectedRuns)
37
+ }), n;
38
+ }
39
+ export { n as notificationThing, r as thingFacts };
40
+
41
+ //# sourceMappingURL=thing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thing.js","names":["text","value","count","number","notificationThing","metadata","fields","workflowName","firstSeen","thingFacts","facts","thing","tr"],"sources":["../../../src/v2/model/thing.ts"],"sourcesContent":["/**\n * \"The thing\" a notification is about (BOFF-16785, C1; decision 10, BE3): for a workflow\n * notification, wspace-workflow-svc puts the workflow's name, the step, the attempt, how many runs\n * it affected and when it was first seen in the notification's metadata. Anything missing is left\n * out; without a workflow name there is no block.\n */\nimport type { Tr } from './tr';\n\nexport interface NotificationThing {\n workflowName: string;\n step: string | null;\n attempt: number | null;\n affectedRuns: number | null;\n firstSeenAt: string | null;\n runId: string | null;\n}\n\nfunction text(value: unknown): string | null {\n return typeof value === 'string' && value.trim() ? value.trim() : null;\n}\n\nfunction count(value: unknown): number | null {\n const number = typeof value === 'string' ? Number(value) : value;\n return typeof number === 'number' && Number.isFinite(number) && number >= 0\n ? Math.floor(number)\n : null;\n}\n\nexport function notificationThing(metadata: unknown): NotificationThing | null {\n if (typeof metadata !== 'object' || metadata === null || Array.isArray(metadata)) return null;\n const fields = new Map(Object.entries(metadata));\n const workflowName = text(fields.get('workflowName'));\n if (!workflowName) return null;\n const firstSeen = text(fields.get('firstSeenAt'));\n return {\n workflowName,\n step: text(fields.get('stepName')) ?? text(fields.get('nodeId')),\n attempt: count(fields.get('attempt')),\n affectedRuns: count(fields.get('affectedRuns')),\n firstSeenAt: firstSeen && !Number.isNaN(Date.parse(firstSeen)) ? firstSeen : null,\n runId: text(fields.get('runId')),\n };\n}\n\n/** The block's lines, in words: \"Step: Send invoice\", \"Attempt 3\", \"Affects 12 runs\". */\nexport function thingFacts(\n thing: NotificationThing,\n tr: Tr\n): { id: string; label: string; value: string }[] {\n const facts: { id: string; label: string; value: string }[] = [];\n if (thing.step) {\n facts.push({ id: 'step', label: tr('notifications.v3.thing.step', 'Step'), value: thing.step });\n }\n if (thing.attempt !== null) {\n facts.push({\n id: 'attempt',\n label: tr('notifications.v3.thing.attempt', 'Attempt'),\n value: String(thing.attempt),\n });\n }\n if (thing.affectedRuns !== null) {\n facts.push({\n id: 'runs',\n label: tr('notifications.v3.thing.affectedRuns', 'Runs affected'),\n value: String(thing.affectedRuns),\n });\n }\n return facts;\n}\n"],"mappings":";AAiBA,SAASA,EAAK,GAA+B;CAC3C,OAAO,OAAOC,KAAU,YAAYA,EAAM,KAAK,IAAIA,EAAM,KAAK,IAAI;AACpE;AAEA,SAASC,EAAM,GAA+B;CAC5C,IAAMC,IAAS,OAAOF,KAAU,WAAW,OAAOA,CAAK,IAAIA;CAC3D,OAAO,OAAOE,KAAW,YAAY,OAAO,SAASA,CAAM,KAAKA,KAAU,IACtE,KAAK,MAAMA,CAAM,IACjB;AACN;AAEA,SAAgBC,EAAkB,GAA6C;CAC7E,IAAI,OAAOC,KAAa,aAAYA,KAAqB,MAAM,QAAQA,CAAQ,GAAG,OAAO;CACzF,IAAMC,IAAS,IAAI,IAAI,OAAO,QAAQD,CAAQ,CAAC,GACzCE,IAAeP,EAAKM,EAAO,IAAI,cAAc,CAAC;CACpD,IAAI,CAACC,GAAc,OAAO;CAC1B,IAAMC,IAAYR,EAAKM,EAAO,IAAI,aAAa,CAAC;CAChD,OAAO;EACL;EACA,MAAMN,EAAKM,EAAO,IAAI,UAAU,CAAC,KAAKN,EAAKM,EAAO,IAAI,QAAQ,CAAC;EAC/D,SAASJ,EAAMI,EAAO,IAAI,SAAS,CAAC;EACpC,cAAcJ,EAAMI,EAAO,IAAI,cAAc,CAAC;EAC9C,aAAaE,KAAa,CAAC,OAAO,MAAM,KAAK,MAAMA,CAAS,CAAC,IAAIA,IAAY;EAC7E,OAAOR,EAAKM,EAAO,IAAI,OAAO,CAAC;CACjC;AACF;AAGA,SAAgBG,EACd,GACA,GACgD;CAChD,IAAMC,IAAwD,CAAC;CAkB/D,OAjBIC,EAAM,QACRD,EAAM,KAAK;EAAE,IAAI;EAAQ,OAAOE,EAAG,+BAA+B,MAAM;EAAG,OAAOD,EAAM;CAAK,CAAC,GAE5FA,EAAM,YAAY,QACpBD,EAAM,KAAK;EACT,IAAI;EACJ,OAAOE,EAAG,kCAAkC,SAAS;EACrD,OAAO,OAAOD,EAAM,OAAO;CAC7B,CAAC,GAECA,EAAM,iBAAiB,QACzBD,EAAM,KAAK;EACT,IAAI;EACJ,OAAOE,EAAG,uCAAuC,eAAe;EAChE,OAAO,OAAOD,EAAM,YAAY;CAClC,CAAC,GAEID;AACT"}
@@ -0,0 +1,2 @@
1
+ /** The module's translate function (`useTr()`): a key, its English, and `{{name}}` values. */
2
+ export type Tr = (key: string, fallback: string, params?: Record<string, string | number>) => string;
@@ -0,0 +1,19 @@
1
+ import { GetNotificationQuery } from '../generated/global-operations';
2
+ export type NotificationDetailData = NonNullable<GetNotificationQuery['notification']>;
3
+ export type DetailState = {
4
+ status: 'loading';
5
+ } | {
6
+ status: 'ready';
7
+ notification: NotificationDetailData;
8
+ } | {
9
+ status: 'missing';
10
+ } | {
11
+ status: 'failed';
12
+ error: unknown;
13
+ };
14
+ export declare function useNotificationDetail(id: string | null): {
15
+ state: DetailState;
16
+ retry: () => void;
17
+ };
18
+ /** Mark notifications unread again: a row's "Mark as unread", and Undo after "Mark all as read". */
19
+ export declare function useMarkUnread(): (ids: readonly string[]) => Promise<void>;
@@ -0,0 +1,65 @@
1
+ import { useNotification as e } from "../providers/NotificationProvider.js";
2
+ import { USER_NOTIFICATION_CONTEXT as t, getGlobalNotificationClient as n } from "../graphql/global-client.js";
3
+ import { GetNotificationDocument as r, MarkNotificationAsUnreadDocument as i } from "../generated/global-operations.js";
4
+ import { useCallback as a, useEffect as o, useState as s } from "react";
5
+ // src/v2/useNotificationDetail.ts
6
+ var c = { status: "loading" }, l = { status: "missing" };
7
+ function u() {
8
+ let { authToken: t, apiGatewayUrl: r } = e();
9
+ return a(() => n(r ?? void 0, t ?? void 0), [r, t]);
10
+ }
11
+ function d(e) {
12
+ let n = u(), [i, d] = s(null), [f, p] = s(0), m = `${e ?? ""}:${f}`;
13
+ o(() => {
14
+ if (!e) return;
15
+ let i = !0;
16
+ return n().query({
17
+ query: r,
18
+ variables: { id: e },
19
+ context: t,
20
+ fetchPolicy: "network-only"
21
+ }).then(({ data: e }) => {
22
+ if (!i) return;
23
+ let t = e?.notification ?? null;
24
+ d({
25
+ key: m,
26
+ state: t ? {
27
+ status: "ready",
28
+ notification: t
29
+ } : l
30
+ });
31
+ }).catch((e) => {
32
+ i && d({
33
+ key: m,
34
+ state: {
35
+ status: "failed",
36
+ error: e
37
+ }
38
+ });
39
+ }), () => {
40
+ i = !1;
41
+ };
42
+ }, [
43
+ n,
44
+ e,
45
+ m
46
+ ]);
47
+ let h = a(() => p((e) => e + 1), []);
48
+ return {
49
+ state: e ? i?.key === m ? i.state : c : l,
50
+ retry: h
51
+ };
52
+ }
53
+ function f() {
54
+ let e = u();
55
+ return a(async (n) => {
56
+ await Promise.all(n.map((n) => e().mutate({
57
+ mutation: i,
58
+ variables: { id: n },
59
+ context: t
60
+ })));
61
+ }, [e]);
62
+ }
63
+ export { f as useMarkUnread, d as useNotificationDetail };
64
+
65
+ //# sourceMappingURL=useNotificationDetail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNotificationDetail.js","names":["LOADING","MISSING","useClient","useNotification","useCallback","getGlobalNotificationClient","apiGatewayUrl","authToken","useNotificationDetail","client","answer","setAnswer","useState","attempt","setAttempt","key","id","live","GetNotificationDocument","USER_NOTIFICATION_CONTEXT","notification","data","retry","value","useMarkUnread","ids","MarkNotificationAsUnreadDocument"],"sources":["../../src/v2/useNotificationDetail.ts"],"sourcesContent":["/**\n * One notification for its panel (BOFF-16785, C1; decision 10): `notification(id)` with its events\n * (owner or admin), through the same global client and person-scoped context as the inbox. Also\n * \"mark as unread\", which the inbox's hook doesn't offer.\n */\nimport { useCallback, useEffect, useState } from 'react';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { getGlobalNotificationClient, USER_NOTIFICATION_CONTEXT } from '../graphql/global-client';\nimport {\n GetNotificationDocument,\n MarkNotificationAsUnreadDocument,\n type GetNotificationQuery,\n type GetNotificationQueryVariables,\n type MarkNotificationAsUnreadMutation,\n type MarkNotificationAsUnreadMutationVariables,\n} from '../generated/global-operations';\n\nexport type NotificationDetailData = NonNullable<GetNotificationQuery['notification']>;\n\nexport type DetailState =\n | { status: 'loading' }\n | { status: 'ready'; notification: NotificationDetailData }\n | { status: 'missing' }\n | { status: 'failed'; error: unknown };\n\nconst LOADING: DetailState = { status: 'loading' };\nconst MISSING: DetailState = { status: 'missing' };\n\nfunction useClient() {\n const { authToken, apiGatewayUrl } = useNotification();\n return useCallback(\n () => getGlobalNotificationClient(apiGatewayUrl ?? undefined, authToken ?? undefined),\n [apiGatewayUrl, authToken]\n );\n}\n\nexport function useNotificationDetail(id: string | null) {\n const client = useClient();\n // The answer, with the notification and the attempt it is for: another id (or Try again) reads\n // as loading until its own answer arrives.\n const [answer, setAnswer] = useState<{ key: string; state: DetailState } | null>(null);\n const [attempt, setAttempt] = useState(0);\n const key = `${id ?? ''}:${attempt}`;\n\n useEffect(() => {\n if (!id) return;\n let live = true;\n void client()\n .query<GetNotificationQuery, GetNotificationQueryVariables>({\n query: GetNotificationDocument,\n variables: { id },\n context: USER_NOTIFICATION_CONTEXT,\n fetchPolicy: 'network-only',\n })\n .then(({ data }) => {\n if (!live) return;\n const notification = data?.notification ?? null;\n setAnswer({\n key,\n state: notification ? { status: 'ready', notification } : MISSING,\n });\n })\n .catch((error: unknown) => {\n if (live) setAnswer({ key, state: { status: 'failed', error } });\n });\n return () => {\n live = false;\n };\n }, [client, id, key]);\n\n const retry = useCallback(() => setAttempt((value) => value + 1), []);\n const state: DetailState = !id ? MISSING : answer?.key === key ? answer.state : LOADING;\n return { state, retry };\n}\n\n/** Mark notifications unread again: a row's \"Mark as unread\", and Undo after \"Mark all as read\". */\nexport function useMarkUnread() {\n const client = useClient();\n return useCallback(\n async (ids: readonly string[]) => {\n await Promise.all(\n ids.map((id) =>\n client().mutate<\n MarkNotificationAsUnreadMutation,\n MarkNotificationAsUnreadMutationVariables\n >({\n mutation: MarkNotificationAsUnreadDocument,\n variables: { id },\n context: USER_NOTIFICATION_CONTEXT,\n })\n )\n );\n },\n [client]\n );\n}\n"],"mappings":";;;;;AAyBA,IAAMA,IAAuB,EAAE,QAAQ,UAAU,GAC3CC,IAAuB,EAAE,QAAQ,UAAU;AAEjD,SAASC,IAAY;CACnB,IAAM,EAAE,cAAW,qBAAkBC,EAAgB;CACrD,OAAOC,QACCC,EAA4BC,KAAiB,KAAA,GAAWC,KAAa,KAAA,CAAS,GACpF,CAACD,GAAeC,CAAS,CAC3B;AACF;AAEA,SAAgBC,EAAsB,GAAmB;CACvD,IAAMC,IAASP,EAAU,GAGnB,CAACQ,GAAQC,KAAaC,EAAqD,IAAI,GAC/E,CAACC,GAASC,KAAcF,EAAS,CAAC,GAClCG,IAAM,GAAGC,KAAM,GAAG,GAAGH;CAE3B,QAAgB;EACd,IAAI,CAACG,GAAI;EACT,IAAIC,IAAO;EAmBX,OAlBAR,EAAY,CAAC,CACV,MAA2D;GAC1D,OAAOS;GACP,WAAW,EAAE,MAAG;GAChB,SAASC;GACT,aAAa;EACf,CAAC,CAAC,CACD,MAAM,EAAE,cAAW;GAClB,IAAI,CAACF,GAAM;GACX,IAAMG,IAAeC,GAAM,gBAAgB;GAC3C,EAAU;IACR;IACA,OAAOD,IAAe;KAAE,QAAQ;KAAS;IAAa,IAAInB;GAC5D,CAAC;EACH,CAAC,CAAC,CACD,OAAO,MAAmB;GACzB,AAAIgB,KAAMN,EAAU;IAAE;IAAK,OAAO;KAAE,QAAQ;KAAU;IAAM;GAAE,CAAC;EACjE,CAAC,SACU;GACX,IAAO;EACT;CACF,GAAG;EAACF;EAAQO;EAAID;CAAG,CAAC;CAEpB,IAAMO,IAAQlB,QAAkBU,GAAY,MAAUS,IAAQ,CAAC,GAAG,CAAC,CAAC;CAEpE,OAAO;EAAE,OADmBP,IAAeN,GAAQ,QAAQK,IAAML,EAAO,QAAQV,IAA/CC;EACjB;CAAM;AACxB;AAGA,SAAgBuB,IAAgB;CAC9B,IAAMf,IAASP,EAAU;CACzB,OAAOE,EACL,OAAO,MAA2B;EAChC,MAAM,QAAQ,IACZqB,EAAI,KAAK,MACPhB,EAAO,CAAC,CAAC,OAGP;GACA,UAAUiB;GACV,WAAW,EAAE,MAAG;GAChB,SAASP;EACX,CAAC,CACH,CACF;CACF,GACA,CAACV,CAAM,CACT;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-notification",
3
- "version": "2026.1127.1",
3
+ "version": "2026.1129.1",
4
4
  "description": "Notification microfrontend for multi-channel notification management",
5
5
  "type": "module",
6
6
  "imports": {
@@ -55,7 +55,7 @@
55
55
  },
56
56
  "dependencies": {
57
57
  "@apollo/client": "^4.3.7",
58
- "@burdenoff/fe-libs": "2026.1124.16",
58
+ "@burdenoff/fe-libs": "2026.1128.11",
59
59
  "@types/lodash-es": "^4.17.12",
60
60
  "graphql": "^16.15.0",
61
61
  "graphql-ws": "^6.4.1",