@burdenoff/microfe-notification 2026.1125.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.
- package/dist/NotificationRoutes.d.ts +10 -0
- package/dist/NotificationRoutes.js +76 -71
- package/dist/NotificationRoutes.js.map +1 -1
- package/dist/components/NotificationPanel.js +0 -1
- package/dist/components/NotificationPanel.js.map +1 -1
- package/dist/generated/global-operations.d.ts +58 -3
- package/dist/generated/global-operations.js +31 -23
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.d.ts +10933 -581
- package/dist/graphql/global-client.js +34 -34
- package/dist/hooks/useNotificationAnalytics.d.ts +1 -1
- package/dist/hooks/useNotificationAnalytics.js.map +1 -1
- package/dist/hooks/useNotifications.d.ts +7 -0
- package/dist/hooks/useNotifications.js +1 -1
- package/dist/hooks/useNotifications.js.map +1 -1
- package/dist/index.js +9 -11
- package/dist/navigation-v2/NotificationArchivedV2.js +7 -8
- package/dist/navigation-v2/NotificationArchivedV2.js.map +1 -1
- package/dist/navigation-v2/NotificationInboxV2.js +8 -9
- package/dist/navigation-v2/NotificationInboxV2.js.map +1 -1
- package/dist/navigation-v2/NotificationSettingsV2.js +0 -1
- package/dist/navigation-v2/NotificationSettingsV2.js.map +1 -1
- package/dist/pages/NotificationCenterPage.js +5 -6
- package/dist/pages/NotificationCenterPage.js.map +1 -1
- package/dist/pages/NotificationHistoryAdminPage.js +9 -10
- package/dist/pages/NotificationHistoryAdminPage.js.map +1 -1
- package/dist/pages/NotificationHistoryPage.js +5 -6
- package/dist/pages/NotificationHistoryPage.js.map +1 -1
- package/dist/pages/NotificationPreferencesPage.js +0 -1
- package/dist/pages/NotificationPreferencesPage.js.map +1 -1
- package/dist/pages/NotificationTopicsPage.js +0 -1
- package/dist/pages/NotificationTopicsPage.js.map +1 -1
- package/dist/translations/en.d.ts +80 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/v2/ArchivedRedirect.d.ts +1 -0
- package/dist/v2/ArchivedRedirect.js +14 -0
- package/dist/v2/ArchivedRedirect.js.map +1 -0
- package/dist/v2/InboxPage.d.ts +1 -0
- package/dist/v2/InboxPage.js +191 -0
- package/dist/v2/InboxPage.js.map +1 -0
- package/dist/v2/InboxRows.d.ts +10 -0
- package/dist/v2/InboxRows.js +101 -0
- package/dist/v2/InboxRows.js.map +1 -0
- package/dist/v2/KindIcon.d.ts +4 -0
- package/dist/v2/KindIcon.js +33 -0
- package/dist/v2/KindIcon.js.map +1 -0
- package/dist/v2/NotificationDetailPanel.d.ts +7 -0
- package/dist/v2/NotificationDetailPanel.js +200 -0
- package/dist/v2/NotificationDetailPanel.js.map +1 -0
- package/dist/v2/PreferencesPage.d.ts +1 -0
- package/dist/v2/PreferencesPage.js +139 -0
- package/dist/v2/PreferencesPage.js.map +1 -0
- package/dist/v2/__tests__/routeShapes.d.ts +13 -0
- package/dist/v2/model/days.d.ts +9 -0
- package/dist/v2/model/days.js +25 -0
- package/dist/v2/model/days.js.map +1 -0
- package/dist/v2/model/events.d.ts +17 -0
- package/dist/v2/model/events.js +72 -0
- package/dist/v2/model/events.js.map +1 -0
- package/dist/v2/model/icons.d.ts +6 -0
- package/dist/v2/model/icons.js +19 -0
- package/dist/v2/model/icons.js.map +1 -0
- package/dist/v2/model/inbox.d.ts +15 -0
- package/dist/v2/model/inbox.js +22 -0
- package/dist/v2/model/inbox.js.map +1 -0
- package/dist/v2/model/thing.d.ts +16 -0
- package/dist/v2/model/thing.js +41 -0
- package/dist/v2/model/thing.js.map +1 -0
- package/dist/v2/model/tr.d.ts +2 -0
- package/dist/v2/useNotificationDetail.d.ts +19 -0
- package/dist/v2/useNotificationDetail.js +65 -0
- package/dist/v2/useNotificationDetail.js.map +1 -0
- package/package.json +5 -2
- package/dist/components/index.js +0 -4
- package/dist/hooks/index.js +0 -8
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js +0 -23
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js.map +0 -1
- package/dist/node_modules/@apollo/client/errors/utils.js +0 -15
- package/dist/node_modules/@apollo/client/errors/utils.js.map +0 -1
- package/dist/node_modules/@apollo/client/link/core/ApolloLink.js +0 -51
- package/dist/node_modules/@apollo/client/link/core/ApolloLink.js.map +0 -1
- package/dist/node_modules/@apollo/client/link/subscriptions/index.js +0 -40
- package/dist/node_modules/@apollo/client/link/subscriptions/index.js.map +0 -1
- package/dist/node_modules/@apollo/client/link/utils/createOperation.js +0 -33
- package/dist/node_modules/@apollo/client/link/utils/createOperation.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/caching/sizes.js +0 -5
- package/dist/node_modules/@apollo/client/utilities/caching/sizes.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/graphql/print.js +0 -15
- package/dist/node_modules/@apollo/client/utilities/graphql/print.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/caches.js +0 -18
- package/dist/node_modules/@apollo/client/utilities/internal/caches.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js +0 -20
- package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js +0 -16
- package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js +0 -8
- package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js +0 -8
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js +0 -7
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js +0 -8
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js +0 -9
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js +0 -7
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js +0 -9
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/memoize.js +0 -22
- package/dist/node_modules/@apollo/client/utilities/internal/memoize.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js +0 -9
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js.map +0 -1
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js +0 -56
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js.map +0 -1
- package/dist/node_modules/@apollo/client/version.js +0 -5
- package/dist/node_modules/@apollo/client/version.js.map +0 -1
- package/dist/node_modules/@wry/caches/lib/weak.js +0 -66
- package/dist/node_modules/@wry/caches/lib/weak.js.map +0 -1
- package/dist/node_modules/@wry/trie/lib/index.js +0 -52
- package/dist/node_modules/@wry/trie/lib/index.js.map +0 -1
- package/dist/node_modules/graphql-ws/dist/client.js +0 -279
- package/dist/node_modules/graphql-ws/dist/client.js.map +0 -1
- package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js +0 -61
- package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js +0 -20
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js +0 -77
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +0 -116
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +0 -96
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js +0 -11
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js +0 -8
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +0 -15
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +0 -7
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +0 -12
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +0 -10
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +0 -10
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +0 -21
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js +0 -7
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +0 -7
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +0 -5
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js +0 -12
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js.map +0 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +0 -13
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js.map +0 -1
- package/dist/node_modules/tslib/tslib.es6.js +0 -51
- package/dist/node_modules/tslib/tslib.es6.js.map +0 -1
|
@@ -467,5 +467,85 @@ export declare const enTranslations: {
|
|
|
467
467
|
usingTemplate: string;
|
|
468
468
|
view: string;
|
|
469
469
|
youHave: string;
|
|
470
|
+
v3: {
|
|
471
|
+
actionsFor: string;
|
|
472
|
+
archive: string;
|
|
473
|
+
empty: {
|
|
474
|
+
actionBody: string;
|
|
475
|
+
actionTitle: string;
|
|
476
|
+
allBody: string;
|
|
477
|
+
allTitle: string;
|
|
478
|
+
archivedBody: string;
|
|
479
|
+
archivedTitle: string;
|
|
480
|
+
searchBody: string;
|
|
481
|
+
searchTitle: string;
|
|
482
|
+
unreadTitle: string;
|
|
483
|
+
};
|
|
484
|
+
event: {
|
|
485
|
+
bounced: string;
|
|
486
|
+
cancelled: string;
|
|
487
|
+
clicked: string;
|
|
488
|
+
complained: string;
|
|
489
|
+
created: string;
|
|
490
|
+
delivered: string;
|
|
491
|
+
expired: string;
|
|
492
|
+
failed: string;
|
|
493
|
+
opened: string;
|
|
494
|
+
other: string;
|
|
495
|
+
retry: string;
|
|
496
|
+
scheduled: string;
|
|
497
|
+
sent: string;
|
|
498
|
+
unsubscribed: string;
|
|
499
|
+
};
|
|
500
|
+
markAll: string;
|
|
501
|
+
markedAll: string;
|
|
502
|
+
markRead: string;
|
|
503
|
+
markUnread: string;
|
|
504
|
+
more: string;
|
|
505
|
+
needsYou: string;
|
|
506
|
+
panel: {
|
|
507
|
+
close: string;
|
|
508
|
+
loading: string;
|
|
509
|
+
missing: string;
|
|
510
|
+
open: string;
|
|
511
|
+
what: string;
|
|
512
|
+
};
|
|
513
|
+
prefs: {
|
|
514
|
+
openInbox: string;
|
|
515
|
+
pause: string;
|
|
516
|
+
pausedNow: string;
|
|
517
|
+
pauseHelp: string;
|
|
518
|
+
pauseTitle: string;
|
|
519
|
+
purpose: string;
|
|
520
|
+
topicsTitle: string;
|
|
521
|
+
useDefault: string;
|
|
522
|
+
whatTitle: string;
|
|
523
|
+
whereTitle: string;
|
|
524
|
+
};
|
|
525
|
+
purpose: string;
|
|
526
|
+
read: string;
|
|
527
|
+
restore: string;
|
|
528
|
+
search: string;
|
|
529
|
+
settings: string;
|
|
530
|
+
tab: {
|
|
531
|
+
action: string;
|
|
532
|
+
all: string;
|
|
533
|
+
archived: string;
|
|
534
|
+
unread: string;
|
|
535
|
+
};
|
|
536
|
+
thing: {
|
|
537
|
+
affectedRuns: string;
|
|
538
|
+
attempt: string;
|
|
539
|
+
firstSeen: string;
|
|
540
|
+
label: string;
|
|
541
|
+
openRun: string;
|
|
542
|
+
step: string;
|
|
543
|
+
};
|
|
544
|
+
timeline: string;
|
|
545
|
+
title: string;
|
|
546
|
+
today: string;
|
|
547
|
+
unread: string;
|
|
548
|
+
yesterday: string;
|
|
549
|
+
};
|
|
470
550
|
};
|
|
471
551
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -188,7 +188,8 @@ export interface NotificationTopicSubscription {
|
|
|
188
188
|
topicId: string;
|
|
189
189
|
userId: string;
|
|
190
190
|
}
|
|
191
|
-
|
|
191
|
+
/** CATEGORY: a feature category such as "proactive" (global-notification-svc, BOFF-13164). */
|
|
192
|
+
export type NotificationPreferenceScope = 'GLOBAL' | 'CHANNEL' | 'TYPE' | 'TOPIC' | 'CATEGORY';
|
|
192
193
|
export type NotificationPreferenceFrequency = 'IMMEDIATE' | 'DAILY_DIGEST' | 'WEEKLY_DIGEST' | 'NEVER';
|
|
193
194
|
export interface NotificationPreference {
|
|
194
195
|
id: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ArchivedRedirect(): import('react').JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useNotificationPaths as e } from "../navigation-v2/paths.js";
|
|
2
|
+
import { Navigate as t } from "react-router";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
// src/v2/ArchivedRedirect.tsx
|
|
5
|
+
function r() {
|
|
6
|
+
let r = e();
|
|
7
|
+
return /* @__PURE__ */ n(t, {
|
|
8
|
+
to: `${r.inbox}?tab=archived`,
|
|
9
|
+
replace: !0
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export { r as ArchivedRedirect };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=ArchivedRedirect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArchivedRedirect.js","names":["ArchivedRedirect","paths","useNotificationPaths","Navigate"],"sources":["../../src/v2/ArchivedRedirect.tsx"],"sourcesContent":["/**\n * `/notifications/history` under fe-libs' `accountPagesV2` (BOFF-16785, C1): the inbox's Archived\n * tab. Only rendered under the opt-in.\n */\nimport { Navigate } from 'react-router';\nimport { useNotificationPaths } from '../navigation-v2/paths';\n\nexport function ArchivedRedirect() {\n const paths = useNotificationPaths();\n return <Navigate to={`${paths.inbox}?tab=archived`} replace />;\n}\n"],"mappings":";;;;AAOA,SAAgBA,IAAmB;CACjC,IAAMC,IAAQC,EAAqB;CACnC,OAAO,kBAACC,GAAD;EAAU,IAAI,GAAGF,EAAM,MAAM;EAAgB,SAAA;CAAS,CAAA;AAC/D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function InboxPage(): import('react').JSX.Element;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { useNotifications as e } from "../hooks/useNotifications.js";
|
|
2
|
+
import { useTr as t } from "../shared/hooks/useTr.js";
|
|
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";
|
|
15
|
+
// src/v2/InboxPage.tsx
|
|
16
|
+
var E = {
|
|
17
|
+
all: {
|
|
18
|
+
archived: !1,
|
|
19
|
+
channel: "IN_APP"
|
|
20
|
+
},
|
|
21
|
+
unread: {
|
|
22
|
+
archived: !1,
|
|
23
|
+
channel: "IN_APP",
|
|
24
|
+
isRead: !1
|
|
25
|
+
},
|
|
26
|
+
action: {
|
|
27
|
+
archived: !1,
|
|
28
|
+
channel: "IN_APP"
|
|
29
|
+
},
|
|
30
|
+
archived: {
|
|
31
|
+
archived: !0,
|
|
32
|
+
channel: "IN_APP"
|
|
33
|
+
}
|
|
34
|
+
}, D = { channel: "IN_APP" };
|
|
35
|
+
function O(e, t) {
|
|
36
|
+
return e === "send" ? t.send : e === "templates" ? t.templates : e === "topics" ? t.topics : e === "history" ? t.deliveryLog : null;
|
|
37
|
+
}
|
|
38
|
+
function k() {
|
|
39
|
+
let e = n(), [t] = g(), r = O(t.get("tab"), e);
|
|
40
|
+
return r ? /* @__PURE__ */ _(m, {
|
|
41
|
+
to: r,
|
|
42
|
+
replace: !0
|
|
43
|
+
}) : /* @__PURE__ */ _(A, {});
|
|
44
|
+
}
|
|
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 }),
|
|
56
|
+
tone: "success",
|
|
57
|
+
undo: t && e.length > 0 ? async () => {
|
|
58
|
+
await L(e), await I.refetch();
|
|
59
|
+
} : void 0
|
|
60
|
+
});
|
|
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")
|
|
66
|
+
};
|
|
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
|
+
}))
|
|
101
|
+
}),
|
|
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")
|
|
154
|
+
})
|
|
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);
|
|
164
|
+
},
|
|
165
|
+
onRestore: (e) => void I.unarchiveNotification(e)
|
|
166
|
+
})
|
|
167
|
+
]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function j({ tab: e, searching: n }) {
|
|
171
|
+
let r = t();
|
|
172
|
+
if (n) return /* @__PURE__ */ _(x, {
|
|
173
|
+
kind: "no-results",
|
|
174
|
+
title: r("notifications.v3.empty.searchTitle", "No notifications match"),
|
|
175
|
+
description: r("notifications.v3.empty.searchBody", "Try other words.")
|
|
176
|
+
});
|
|
177
|
+
let [i, a] = {
|
|
178
|
+
all: [r("notifications.v3.empty.allTitle", "You’re all caught up"), r("notifications.v3.empty.allBody", "New notifications show up here and on the bell.")],
|
|
179
|
+
unread: [r("notifications.v3.empty.unreadTitle", "Nothing unread"), r("notifications.v3.empty.allBody", "New notifications show up here and on the bell.")],
|
|
180
|
+
action: [r("notifications.v3.empty.actionTitle", "Nothing waiting for you"), r("notifications.v3.empty.actionBody", "Approvals and requests show up here.")],
|
|
181
|
+
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
|
+
}[e];
|
|
183
|
+
return /* @__PURE__ */ _(x, {
|
|
184
|
+
kind: e === "archived" ? "first-use" : "all-done",
|
|
185
|
+
title: i,
|
|
186
|
+
description: a
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
export { k as InboxPage };
|
|
190
|
+
|
|
191
|
+
//# sourceMappingURL=InboxPage.js.map
|
|
@@ -0,0 +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,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AKA,EAAM,SAAS;OACnC,eAAY;OAEX,UAAAV,EAAG,yBAAyB,WAAW;MAClC,CAAA;KACL,CAAA,IACH;IACD;;GACL,kBAACyC,GAAD;IACE,IAAIhC;IACJ,eAAeS,EAAK,IAAI;IACxB,eAAe,MAAO,KAAKN,EAAW,CAACQ,CAAE,CAAC,CAAC,CAAC,WAAWV,EAAM,QAAQ,CAAC;IACtE,YAAY,MAAO;KAEjB,AADAA,EAAW,oBAAoBU,CAAE,GACjCF,EAAK,IAAI;IACX;IACA,YAAY,MAAO,KAAKR,EAAM,sBAAsBU,CAAE;GACvD,CAAA;EACE;;AAET;AAEA,SAASkB,EAAW,EAAE,QAAK,gBAAoD;CAC7E,IAAMtC,IAAKC,EAAM;CACjB,IAAIyC,GACF,OACE,kBAACC,GAAD;EACE,MAAK;EACL,OAAO3C,EAAG,sCAAsC,wBAAwB;EACxE,aAAaA,EAAG,qCAAqC,kBAAkB;CACxE,CAAA;CAwBL,IAAM,CAAC4C,GAAOC,KAAe;EApB3B,KAAK,CACH7C,EAAG,mCAAmC,sBAAsB,GAC5DA,EAAG,kCAAkC,iDAAiD,CACxF;EACA,QAAQ,CACNA,EAAG,sCAAsC,gBAAgB,GACzDA,EAAG,kCAAkC,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,kBAACoD,GAAD;EACE,MAAMpD,MAAQ,aAAa,cAAc;EAClC;EACM;CACd,CAAA;AAEL"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Notification } from '../types';
|
|
2
|
+
export declare function InboxRows({ notifications, loading, onOpen, onMarkRead, onMarkUnread, onArchive, onRestore, }: {
|
|
3
|
+
notifications: readonly Notification[];
|
|
4
|
+
loading: boolean;
|
|
5
|
+
onOpen: (id: string) => void;
|
|
6
|
+
onMarkRead: (id: string) => void;
|
|
7
|
+
onMarkUnread: (id: string) => void;
|
|
8
|
+
onArchive: (id: string) => void;
|
|
9
|
+
onRestore: (id: string) => void;
|
|
10
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { useTr as e } from "../shared/hooks/useTr.js";
|
|
2
|
+
import { isUnread as t, needsAction as n } from "./model/inbox.js";
|
|
3
|
+
import { KindIcon as r } from "./KindIcon.js";
|
|
4
|
+
import { groupByDay as i } from "./model/days.js";
|
|
5
|
+
import { Circle as a, CircleDot as o } from "lucide-react";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
import { ActionMenu as l, IconTile as u, Skeleton as d, useWhenLabels as f } from "@burdenoff/fe-libs/ui";
|
|
8
|
+
// src/v2/InboxRows.tsx
|
|
9
|
+
function p({ notifications: p, loading: m, onOpen: h, onMarkRead: g, onMarkUnread: _, onArchive: v, onRestore: y }) {
|
|
10
|
+
let b = e(), x = f();
|
|
11
|
+
if (m) return /* @__PURE__ */ s("div", {
|
|
12
|
+
className: "flex flex-col gap-2",
|
|
13
|
+
"aria-busy": "true",
|
|
14
|
+
"data-testid": "inbox-loading",
|
|
15
|
+
children: Array.from({ length: 6 }, (e, t) => /* @__PURE__ */ s(d, { className: "h-14 w-full rounded-lg" }, t))
|
|
16
|
+
});
|
|
17
|
+
let S = i(p, b);
|
|
18
|
+
return /* @__PURE__ */ s("div", {
|
|
19
|
+
className: "flex flex-col gap-4",
|
|
20
|
+
"data-testid": "inbox-rows",
|
|
21
|
+
children: S.map((e) => /* @__PURE__ */ c("section", {
|
|
22
|
+
"aria-label": e.label,
|
|
23
|
+
className: "flex flex-col gap-1",
|
|
24
|
+
children: [/* @__PURE__ */ s("h2", {
|
|
25
|
+
className: "m-0 px-1 text-xs font-medium text-text-muted",
|
|
26
|
+
children: e.label
|
|
27
|
+
}), /* @__PURE__ */ s("ul", {
|
|
28
|
+
className: "m-0 flex list-none flex-col divide-y divide-border-subtle overflow-hidden rounded-lg border border-border-subtle bg-bg-surface p-0",
|
|
29
|
+
children: e.items.map((e) => {
|
|
30
|
+
let i = t(e);
|
|
31
|
+
return /* @__PURE__ */ c("li", {
|
|
32
|
+
className: "flex items-center gap-3 px-3 py-2.5",
|
|
33
|
+
"data-row-id": e.id,
|
|
34
|
+
"data-unread": i || void 0,
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ s("span", {
|
|
37
|
+
className: i ? "text-accent-primary" : "text-transparent",
|
|
38
|
+
role: "img",
|
|
39
|
+
"aria-label": i ? b("notifications.v3.unread", "Unread") : b("notifications.v3.read", "Read"),
|
|
40
|
+
children: s(i ? o : a, {
|
|
41
|
+
className: "size-3",
|
|
42
|
+
"aria-hidden": "true"
|
|
43
|
+
})
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ s(u, {
|
|
46
|
+
size: "sm",
|
|
47
|
+
children: /* @__PURE__ */ s(r, { notification: e })
|
|
48
|
+
}),
|
|
49
|
+
/* @__PURE__ */ c("button", {
|
|
50
|
+
type: "button",
|
|
51
|
+
className: "min-w-0 flex-1 cursor-pointer border-0 bg-transparent p-0 text-left",
|
|
52
|
+
onClick: () => h(e.id),
|
|
53
|
+
"data-testid": "inbox-open",
|
|
54
|
+
children: [/* @__PURE__ */ s("span", {
|
|
55
|
+
className: `block truncate text-sm ${i ? "font-semibold text-text-primary" : "text-text-primary"}`,
|
|
56
|
+
children: e.title
|
|
57
|
+
}), /* @__PURE__ */ s("span", {
|
|
58
|
+
className: "block truncate text-xs text-text-secondary",
|
|
59
|
+
children: e.body
|
|
60
|
+
})]
|
|
61
|
+
}),
|
|
62
|
+
n(e) ? /* @__PURE__ */ s("span", {
|
|
63
|
+
className: "hidden text-xs font-medium text-status-warning-text sm:inline",
|
|
64
|
+
children: b("notifications.v3.needsYou", "Needs you")
|
|
65
|
+
}) : null,
|
|
66
|
+
/* @__PURE__ */ s("time", {
|
|
67
|
+
className: "shrink-0 text-xs text-text-muted",
|
|
68
|
+
dateTime: e.createdAt,
|
|
69
|
+
children: x.moment(e.createdAt)
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ s(l, {
|
|
72
|
+
placement: "row",
|
|
73
|
+
label: b("notifications.v3.actionsFor", "Actions for {{title}}", { title: e.title }),
|
|
74
|
+
items: [i ? {
|
|
75
|
+
id: "read",
|
|
76
|
+
label: b("notifications.v3.markRead", "Mark as read"),
|
|
77
|
+
onSelect: () => g(e.id)
|
|
78
|
+
} : {
|
|
79
|
+
id: "unread",
|
|
80
|
+
label: b("notifications.v3.markUnread", "Mark as unread"),
|
|
81
|
+
onSelect: () => _(e.id)
|
|
82
|
+
}, e.archivedAt ? {
|
|
83
|
+
id: "restore",
|
|
84
|
+
label: b("notifications.v3.restore", "Move back to the inbox"),
|
|
85
|
+
onSelect: () => y(e.id)
|
|
86
|
+
} : {
|
|
87
|
+
id: "archive",
|
|
88
|
+
label: b("notifications.v3.archive", "Archive"),
|
|
89
|
+
onSelect: () => v(e.id)
|
|
90
|
+
}]
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
}, e.id);
|
|
94
|
+
})
|
|
95
|
+
})]
|
|
96
|
+
}, e.key))
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
export { p as InboxRows };
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=InboxRows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InboxRows.js","names":["InboxRows","tr","useTr","when","useWhenLabels","loading","Skeleton","index","groups","groupByDay","notifications","group","unread","isUnread","notification","jsx","CircleDot","Circle","IconTile","KindIcon","onOpen","needsAction","ActionMenu","onMarkRead","onMarkUnread","onRestore","onArchive"],"sources":["../../src/v2/InboxRows.tsx"],"sourcesContent":["/**\n * The inbox's rows (BOFF-16785, C1): grouped by day, each one line of plain words with an icon per\n * kind (never colour alone), an unread dot that says so, the time, and ⋯ (read or unread, archive\n * or restore). The row opens the notification's panel.\n */\nimport { Circle, CircleDot } from 'lucide-react';\nimport { ActionMenu, IconTile, Skeleton, useWhenLabels } from '@burdenoff/fe-libs/ui';\nimport type { Notification } from '../types';\nimport { useTr } from '../shared/hooks/useTr';\nimport { isUnread, needsAction } from './model/inbox';\nimport { KindIcon } from './KindIcon';\nimport { groupByDay } from './model/days';\n\nexport function InboxRows({\n notifications,\n loading,\n onOpen,\n onMarkRead,\n onMarkUnread,\n onArchive,\n onRestore,\n}: {\n notifications: readonly Notification[];\n loading: boolean;\n onOpen: (id: string) => void;\n onMarkRead: (id: string) => void;\n onMarkUnread: (id: string) => void;\n onArchive: (id: string) => void;\n onRestore: (id: string) => void;\n}) {\n const tr = useTr();\n const when = useWhenLabels();\n if (loading) {\n return (\n <div className=\"flex flex-col gap-2\" aria-busy=\"true\" data-testid=\"inbox-loading\">\n {Array.from({ length: 6 }, (_, index) => (\n <Skeleton key={index} className=\"h-14 w-full rounded-lg\" />\n ))}\n </div>\n );\n }\n const groups = groupByDay(notifications, tr);\n return (\n <div className=\"flex flex-col gap-4\" data-testid=\"inbox-rows\">\n {groups.map((group) => (\n <section key={group.key} aria-label={group.label} className=\"flex flex-col gap-1\">\n <h2 className=\"m-0 px-1 text-xs font-medium text-text-muted\">{group.label}</h2>\n <ul className=\"m-0 flex list-none flex-col divide-y divide-border-subtle overflow-hidden rounded-lg border border-border-subtle bg-bg-surface p-0\">\n {group.items.map((notification) => {\n const unread = isUnread(notification);\n return (\n <li\n key={notification.id}\n className=\"flex items-center gap-3 px-3 py-2.5\"\n data-row-id={notification.id}\n data-unread={unread || undefined}\n >\n <span\n className={unread ? 'text-accent-primary' : 'text-transparent'}\n role=\"img\"\n aria-label={\n unread\n ? tr('notifications.v3.unread', 'Unread')\n : tr('notifications.v3.read', 'Read')\n }\n >\n {unread ? (\n <CircleDot className=\"size-3\" aria-hidden=\"true\" />\n ) : (\n <Circle className=\"size-3\" aria-hidden=\"true\" />\n )}\n </span>\n <IconTile size=\"sm\">\n <KindIcon notification={notification} />\n </IconTile>\n <button\n type=\"button\"\n className=\"min-w-0 flex-1 cursor-pointer border-0 bg-transparent p-0 text-left\"\n onClick={() => onOpen(notification.id)}\n data-testid=\"inbox-open\"\n >\n <span\n className={`block truncate text-sm ${unread ? 'font-semibold text-text-primary' : 'text-text-primary'}`}\n >\n {notification.title}\n </span>\n <span className=\"block truncate text-xs text-text-secondary\">\n {notification.body}\n </span>\n </button>\n {needsAction(notification) ? (\n <span className=\"hidden text-xs font-medium text-status-warning-text sm:inline\">\n {tr('notifications.v3.needsYou', 'Needs you')}\n </span>\n ) : null}\n <time\n className=\"shrink-0 text-xs text-text-muted\"\n dateTime={notification.createdAt}\n >\n {when.moment(notification.createdAt)}\n </time>\n <ActionMenu\n placement=\"row\"\n label={tr('notifications.v3.actionsFor', 'Actions for {{title}}', {\n title: notification.title,\n })}\n items={[\n unread\n ? {\n id: 'read',\n label: tr('notifications.v3.markRead', 'Mark as read'),\n onSelect: () => onMarkRead(notification.id),\n }\n : {\n id: 'unread',\n label: tr('notifications.v3.markUnread', 'Mark as unread'),\n onSelect: () => onMarkUnread(notification.id),\n },\n notification.archivedAt\n ? {\n id: 'restore',\n label: tr('notifications.v3.restore', 'Move back to the inbox'),\n onSelect: () => onRestore(notification.id),\n }\n : {\n id: 'archive',\n label: tr('notifications.v3.archive', 'Archive'),\n onSelect: () => onArchive(notification.id),\n },\n ]}\n />\n </li>\n );\n })}\n </ul>\n </section>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAaA,SAAgBA,EAAU,EACxB,kBACA,YACA,WACA,eACA,iBACA,cACA,gBASC;CACD,IAAMC,IAAKC,EAAM,GACXC,IAAOC,EAAc;CAC3B,IAAIC,GACF,OACE,kBAAC,OAAD;EAAK,WAAU;EAAsB,aAAU;EAAO,eAAY;EAC/D,UAAA,MAAM,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,MAC7B,kBAACC,GAAD,EAAsB,WAAU,yBA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Q,GAAD;QACE,WAAU;QACV,OAAOrB,EAAG,+BAA+B,yBAAyB,EAChE,OAAOa,EAAa,MACtB,CAAC;QACD,OAAO,CACLF,IACI;SACE,IAAI;SACJ,OAAOX,EAAG,6BAA6B,cAAc;SACrD,gBAAgBsB,EAAWT,EAAa,EAAE;QAC5C,IACA;SACE,IAAI;SACJ,OAAOb,EAAG,+BAA+B,gBAAgB;SACzD,gBAAgBuB,EAAaV,EAAa,EAAE;QAC9C,GACJA,EAAa,aACT;SACE,IAAI;SACJ,OAAOb,EAAG,4BAA4B,wBAAwB;SAC9D,gBAAgBwB,EAAUX,EAAa,EAAE;QAC3C,IACA;SACE,IAAI;SACJ,OAAOb,EAAG,4BAA4B,SAAS;SAC/C,gBAAgByB,EAAUZ,EAAa,EAAE;QAC3C,CACN;OACD,CAAA;MACC;KA/EG,GAAAA,EAAa,EA+EhB;IAER,CAAC;GACC,CAAA,CACG;EA1FK,GAAAH,EAAM,GA0FX,CACV;CACE,CAAA;AAET"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { notificationTone as e } from "./model/inbox.js";
|
|
2
|
+
import { TONE_TEXT as t, notificationIconName as n } from "./model/icons.js";
|
|
3
|
+
import { AlertTriangle as r, Hand as i, Info as a, Megaphone as o, Zap as s } from "lucide-react";
|
|
4
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
5
|
+
// src/v2/KindIcon.tsx
|
|
6
|
+
function l({ notification: l }) {
|
|
7
|
+
let u = t[e(l)];
|
|
8
|
+
switch (n(l)) {
|
|
9
|
+
case "megaphone": return /* @__PURE__ */ c(o, {
|
|
10
|
+
"aria-hidden": "true",
|
|
11
|
+
className: u
|
|
12
|
+
});
|
|
13
|
+
case "alert": return /* @__PURE__ */ c(r, {
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
className: u
|
|
16
|
+
});
|
|
17
|
+
case "hand": return /* @__PURE__ */ c(i, {
|
|
18
|
+
"aria-hidden": "true",
|
|
19
|
+
className: u
|
|
20
|
+
});
|
|
21
|
+
case "activity": return /* @__PURE__ */ c(s, {
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
className: u
|
|
24
|
+
});
|
|
25
|
+
default: return /* @__PURE__ */ c(a, {
|
|
26
|
+
"aria-hidden": "true",
|
|
27
|
+
className: u
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export { l as KindIcon };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=KindIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KindIcon.js","names":["KindIcon","className","TONE_TEXT","notificationTone","notification","notificationIconName","Megaphone","AlertTriangle","Hand","Zap","Info"],"sources":["../../src/v2/KindIcon.tsx"],"sourcesContent":["/** A notification's kind as an icon (BOFF-16785, C1), coloured by its tone. */\nimport { AlertTriangle, Hand, Info, Megaphone, Zap } from 'lucide-react';\nimport type { Notification } from '../types';\nimport { notificationTone } from './model/inbox';\nimport { notificationIconName, TONE_TEXT } from './model/icons';\n\nexport function KindIcon({\n notification,\n}: {\n notification: Pick<Notification, 'type' | 'priority' | 'actions'>;\n}) {\n const className = TONE_TEXT[notificationTone(notification)];\n switch (notificationIconName(notification)) {\n case 'megaphone':\n return <Megaphone aria-hidden=\"true\" className={className} />;\n case 'alert':\n return <AlertTriangle aria-hidden=\"true\" className={className} />;\n case 'hand':\n return <Hand aria-hidden=\"true\" className={className} />;\n case 'activity':\n return <Zap aria-hidden=\"true\" className={className} />;\n default:\n return <Info aria-hidden=\"true\" className={className} />;\n }\n}\n"],"mappings":";;;;;AAMA,SAAgBA,EAAS,EACvB,mBAGC;CACD,IAAMC,IAAYC,EAAUC,EAAiBC,CAAY;CACzD,QAAQC,EAAqBD,CAAY,GAAzC;EACE,KAAK,aACH,OAAO,kBAACE,GAAD;GAAW,eAAY;GAAkB;EAAY,CAAA;EAC9D,KAAK,SACH,OAAO,kBAACC,GAAD;GAAe,eAAY;GAAkB;EAAY,CAAA;EAClE,KAAK,QACH,OAAO,kBAACC,GAAD;GAAM,eAAY;GAAkB;EAAY,CAAA;EACzD,KAAK,YACH,OAAO,kBAACC,GAAD;GAAK,eAAY;GAAkB;EAAY,CAAA;EACxD,SACE,OAAO,kBAACC,GAAD;GAAM,eAAY;GAAkB;EAAY,CAAA;CAC3D;AACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function NotificationDetailPanel({ id, onClose, onMarkUnread, onArchive, onRestore, }: {
|
|
2
|
+
id: string | null;
|
|
3
|
+
onClose: () => void;
|
|
4
|
+
onMarkUnread: (id: string) => void;
|
|
5
|
+
onArchive: (id: string) => void;
|
|
6
|
+
onRestore: (id: string) => void;
|
|
7
|
+
}): import('react').JSX.Element;
|