@burdenoff/microfe-notification 2026.1029.1 → 2026.1109.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/AdminNotificationRoot.d.ts +33 -0
- package/dist/AdminNotificationRoot.js +9 -6
- package/dist/AdminNotificationRoot.js.map +1 -1
- package/dist/AdminNotificationRoutes.d.ts +1 -0
- package/dist/AdminNotificationRoutes.js +22 -23
- package/dist/AdminNotificationRoutes.js.map +1 -1
- package/dist/NotificationRoot.d.ts +29 -0
- package/dist/NotificationRoot.js +9 -6
- package/dist/NotificationRoot.js.map +1 -1
- package/dist/NotificationRoutes.d.ts +18 -0
- package/dist/NotificationRoutes.js +1 -2
- package/dist/NotificationRoutes.js.map +1 -1
- package/dist/UserNotificationRoot.d.ts +32 -0
- package/dist/UserNotificationRoot.js +9 -6
- package/dist/UserNotificationRoot.js.map +1 -1
- package/dist/UserNotificationRoutes.d.ts +16 -0
- package/dist/UserNotificationRoutes.js +9 -10
- package/dist/UserNotificationRoutes.js.map +1 -1
- package/dist/components/FeatureDisabledPage.d.ts +6 -0
- package/dist/components/FeatureDisabledPage.js +1 -2
- package/dist/components/FeatureDisabledPage.js.map +1 -1
- package/dist/components/NotificationBell.d.ts +13 -0
- package/dist/components/NotificationBell.js +6 -7
- package/dist/components/NotificationBell.js.map +1 -1
- package/dist/components/NotificationCard.d.ts +18 -0
- package/dist/components/NotificationCard.js +10 -11
- package/dist/components/NotificationCard.js.map +1 -1
- package/dist/components/NotificationPanel.d.ts +10 -0
- package/dist/components/NotificationPanel.js +5 -6
- package/dist/components/NotificationPanel.js.map +1 -1
- package/dist/components/RecipientSelector.d.ts +32 -0
- package/dist/components/RecipientSelector.js +2 -3
- package/dist/components/RecipientSelector.js.map +1 -1
- package/dist/components/TemplatePreview.d.ts +21 -0
- package/dist/components/TemplatePreview.js +3 -4
- package/dist/components/TemplatePreview.js.map +1 -1
- package/dist/components/VariableInserter.d.ts +11 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +4 -3
- package/dist/constants/permissions.d.ts +23 -0
- package/dist/constants/permissions.js +1 -2
- package/dist/constants/permissions.js.map +1 -1
- package/dist/dev/main.d.ts +0 -0
- package/dist/generated/global-operations.d.ts +2119 -0
- package/dist/generated/global-operations.js +80 -69
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.d.ts +23507 -0
- package/dist/generated/wspace-operations.d.ts +4 -0
- package/dist/generated/wspace-types.d.ts +57831 -0
- package/dist/graphql/global-client.d.ts +32 -0
- package/dist/graphql/global-client.js +23 -30
- package/dist/graphql/global-client.js.map +1 -1
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.js +7 -6
- package/dist/hooks/useNotificationAdmin.d.ts +46 -0
- package/dist/hooks/useNotificationAdmin.js +18 -17
- package/dist/hooks/useNotificationAdmin.js.map +1 -1
- package/dist/hooks/useNotificationAnalytics.d.ts +65 -0
- package/dist/hooks/useNotificationAnalytics.js +1 -2
- package/dist/hooks/useNotificationAnalytics.js.map +1 -1
- package/dist/hooks/useNotificationPreferences.d.ts +10 -0
- package/dist/hooks/useNotificationPreferences.js +7 -7
- package/dist/hooks/useNotificationPreferences.js.map +1 -1
- package/dist/hooks/useNotificationTemplates.d.ts +131 -0
- package/dist/hooks/useNotificationTemplates.js +1 -2
- package/dist/hooks/useNotificationTemplates.js.map +1 -1
- package/dist/hooks/useNotificationTopics.d.ts +35 -0
- package/dist/hooks/useNotificationTopics.js +22 -22
- package/dist/hooks/useNotificationTopics.js.map +1 -1
- package/dist/hooks/useNotifications.d.ts +39 -0
- package/dist/hooks/useNotifications.js +6 -4
- package/dist/hooks/useNotifications.js.map +1 -1
- package/dist/hooks/useSendNotification.d.ts +158 -0
- package/dist/hooks/useSendNotification.js +12 -10
- package/dist/hooks/useSendNotification.js.map +1 -1
- package/dist/hooks/useUserSearch.d.ts +26 -0
- package/dist/hooks/useUserSearch.js +8 -10
- package/dist/hooks/useUserSearch.js.map +1 -1
- package/dist/index.d.ts +36 -0
- package/dist/index.js +8 -8
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js +1 -2
- package/dist/node_modules/@apollo/client/errors/CombinedGraphQLErrors.js.map +1 -1
- package/dist/node_modules/@apollo/client/errors/utils.js +1 -2
- package/dist/node_modules/@apollo/client/errors/utils.js.map +1 -1
- package/dist/node_modules/@apollo/client/link/core/ApolloLink.js +7 -8
- package/dist/node_modules/@apollo/client/link/core/ApolloLink.js.map +1 -1
- package/dist/node_modules/@apollo/client/link/subscriptions/index.js +9 -10
- package/dist/node_modules/@apollo/client/link/subscriptions/index.js.map +1 -1
- package/dist/node_modules/@apollo/client/link/utils/createOperation.js +5 -6
- package/dist/node_modules/@apollo/client/link/utils/createOperation.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/caching/sizes.js +0 -1
- package/dist/node_modules/@apollo/client/utilities/caching/sizes.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/graphql/print.js +4 -5
- package/dist/node_modules/@apollo/client/utilities/graphql/print.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/caches.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/caches.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/checkDocument.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js +2 -3
- package/dist/node_modules/@apollo/client/utilities/internal/getMainDefinition.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/getMemoryInternals.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationDefinition.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/getOperationName.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/globals/global.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/globals/maybe.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/isNonNullObject.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/makeUniqueId.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/memoize.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/memoize.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js +1 -2
- package/dist/node_modules/@apollo/client/utilities/internal/stringifyForDisplay.js.map +1 -1
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js +2 -3
- package/dist/node_modules/@apollo/client/utilities/invariant/index.js.map +1 -1
- package/dist/node_modules/@apollo/client/version.js +2 -3
- package/dist/node_modules/@apollo/client/version.js.map +1 -1
- package/dist/node_modules/@wry/caches/lib/weak.js +1 -2
- package/dist/node_modules/@wry/caches/lib/weak.js.map +1 -1
- package/dist/node_modules/@wry/trie/lib/index.js +2 -3
- package/dist/node_modules/@wry/trie/lib/index.js.map +1 -1
- package/dist/node_modules/graphql-ws/dist/client.js +76 -69
- package/dist/node_modules/graphql-ws/dist/client.js.map +1 -1
- package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js +2 -3
- package/dist/node_modules/graphql-ws/dist/common-CGW11Fyb.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js +2 -3
- package/dist/node_modules/rxjs/dist/esm5/internal/NotificationFactories.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js +41 -42
- package/dist/node_modules/rxjs/dist/esm5/internal/Observable.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js +14 -15
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscriber.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js +21 -18
- package/dist/node_modules/rxjs/dist/esm5/internal/Subscription.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/config.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/observable/empty.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +2 -3
- package/dist/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/symbol/observable.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/errorContext.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/identity.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/isFunction.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/noop.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/pipe.js.map +1 -1
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +1 -2
- package/dist/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js.map +1 -1
- package/dist/node_modules/{rxjs/node_modules/tslib → tslib}/tslib.es6.js +1 -2
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/pages/CreateNotificationPage.d.ts +5 -0
- package/dist/pages/CreateNotificationPage.js +18 -19
- package/dist/pages/CreateNotificationPage.js.map +1 -1
- package/dist/pages/NotificationCenterPage.d.ts +6 -0
- package/dist/pages/NotificationCenterPage.js +13 -14
- package/dist/pages/NotificationCenterPage.js.map +1 -1
- package/dist/pages/NotificationHistoryAdminPage.d.ts +2 -0
- package/dist/pages/NotificationHistoryAdminPage.js +7 -8
- package/dist/pages/NotificationHistoryAdminPage.js.map +1 -1
- package/dist/pages/NotificationHistoryPage.d.ts +2 -0
- package/dist/pages/NotificationHistoryPage.js +13 -14
- package/dist/pages/NotificationHistoryPage.js.map +1 -1
- package/dist/pages/NotificationLandingPage.d.ts +10 -0
- package/dist/pages/NotificationLandingPage.js +5 -6
- package/dist/pages/NotificationLandingPage.js.map +1 -1
- package/dist/pages/NotificationPreferencesPage.d.ts +1 -0
- package/dist/pages/NotificationPreferencesPage.js +14 -15
- package/dist/pages/NotificationPreferencesPage.js.map +1 -1
- package/dist/pages/NotificationTemplatesPage.d.ts +7 -0
- package/dist/pages/NotificationTemplatesPage.js +25 -23
- package/dist/pages/NotificationTemplatesPage.js.map +1 -1
- package/dist/pages/NotificationTopicsPage.d.ts +1 -0
- package/dist/pages/NotificationTopicsPage.js +6 -7
- package/dist/pages/NotificationTopicsPage.js.map +1 -1
- package/dist/pages/TemplateEditorPage.d.ts +12 -0
- package/dist/pages/TemplateEditorPage.js +294 -285
- package/dist/pages/TemplateEditorPage.js.map +1 -1
- package/dist/providers/NotificationProvider.d.ts +11 -0
- package/dist/providers/NotificationProvider.js +1 -2
- package/dist/providers/NotificationProvider.js.map +1 -1
- package/dist/shared/hooks/useTr.d.ts +13 -0
- package/dist/shared/hooks/useTr.js +1 -2
- package/dist/shared/hooks/useTr.js.map +1 -1
- package/dist/store/notificationStore.d.ts +30 -0
- package/dist/store/notificationStore.js +1 -2
- package/dist/store/notificationStore.js.map +1 -1
- package/dist/test/happydom.d.ts +1 -0
- package/dist/translations/en.d.ts +468 -0
- package/dist/types/index.d.ts +249 -0
- package/dist/utils/inAppNavigation.d.ts +37 -0
- package/dist/utils/inAppNavigation.js +2 -3
- package/dist/utils/inAppNavigation.js.map +1 -1
- package/dist/utils/index.d.ts +68 -0
- package/dist/utils/index.js +16 -10
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/nativeBridge.d.ts +2 -0
- package/dist/utils/nativeBridge.js +1 -2
- package/dist/utils/notificationHistoryExport.d.ts +12 -0
- package/dist/utils/notificationHistoryExport.js +1 -2
- package/dist/utils/notificationHistoryExport.js.map +1 -1
- package/package.json +66 -48
- package/dist/node_modules/rxjs/node_modules/tslib/tslib.es6.js.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { useNotification as e } from "../providers/NotificationProvider.js";
|
|
2
|
-
import { useNotifications as t } from "../hooks/useNotifications.js";
|
|
3
|
-
import { filterNotifications as n, groupNotificationsByDate as r } from "../utils/index.js";
|
|
4
|
-
import { useNotificationTopics as i } from "../hooks/useNotificationTopics.js";
|
|
5
1
|
import "../hooks/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import { NotificationCard as
|
|
8
|
-
import {
|
|
2
|
+
import { useNotifications as e } from "../hooks/useNotifications.js";
|
|
3
|
+
import { NotificationCard as t } from "../components/NotificationCard.js";
|
|
4
|
+
import { useNotificationTopics as n } from "../hooks/useNotificationTopics.js";
|
|
5
|
+
import { filterNotifications as r, groupNotificationsByDate as i } from "../utils/index.js";
|
|
6
|
+
import { NOTIFICATION_PERMISSIONS as a } from "../constants/permissions.js";
|
|
7
|
+
import { useNotification as o } from "../providers/NotificationProvider.js";
|
|
8
|
+
import { useTr as s } from "../shared/hooks/useTr.js";
|
|
9
9
|
import { useMemo as c } from "react";
|
|
10
10
|
import { usePermissions as l } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
11
11
|
import { BellRing as u, CheckCheck as d, Search as f } from "lucide-react";
|
|
12
12
|
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
13
13
|
import { PushOptInToggle as g } from "@burdenoff/fe-libs/chrome";
|
|
14
14
|
import { AuroraBackground as _, Button as v, EmphasisPanel as y, GlassCard as b, GradientText as x, IllustratedEmptyState as S, PagePurpose as C } from "@burdenoff/fe-libs/ui";
|
|
15
|
-
|
|
15
|
+
// src/pages/NotificationCenterPage.tsx
|
|
16
16
|
var w = {
|
|
17
17
|
archived: !1,
|
|
18
18
|
channel: "IN_APP"
|
|
@@ -60,14 +60,14 @@ var w = {
|
|
|
60
60
|
}
|
|
61
61
|
];
|
|
62
62
|
function O() {
|
|
63
|
-
let O =
|
|
63
|
+
let O = s(), { hasPermission: k, isLoading: A } = l(), { currentUser: j } = o(), { notifications: M, unreadCount: N, notificationFilter: P, markAsRead: F, markAllAsRead: I, archiveNotification: L, recordAction: R, updateFilter: z, resetFilter: B } = e({
|
|
64
64
|
baseFilter: w,
|
|
65
65
|
unreadFilter: T
|
|
66
|
-
}), { topics: V } =
|
|
66
|
+
}), { topics: V } = n({ isActive: !0 }), H = c(() => r(M, P), [M, P]), U = c(() => i(H, O), [H, O]);
|
|
67
67
|
return A ? /* @__PURE__ */ m("div", {
|
|
68
68
|
className: "flex h-64 items-center justify-center",
|
|
69
69
|
children: /* @__PURE__ */ m("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
70
|
-
}) : !k(
|
|
70
|
+
}) : !k(a.NOTIFICATION_LIST) && !j?.id ? /* @__PURE__ */ m("div", {
|
|
71
71
|
className: "p-8 text-center text-text-secondary",
|
|
72
72
|
children: O("notifications.noPermissionView", "You don't have permission to view notifications.")
|
|
73
73
|
}) : /* @__PURE__ */ h("div", {
|
|
@@ -192,14 +192,14 @@ function O() {
|
|
|
192
192
|
/* @__PURE__ */ m("div", {
|
|
193
193
|
"data-tour": "notification-center-list",
|
|
194
194
|
className: "space-y-6",
|
|
195
|
-
children: H.length > 0 ? Object.entries(U).map(([e,
|
|
195
|
+
children: H.length > 0 ? Object.entries(U).map(([e, n]) => /* @__PURE__ */ h("div", {
|
|
196
196
|
className: "animate-in fade-in slide-in-from-bottom-2 duration-200",
|
|
197
197
|
children: [/* @__PURE__ */ m("h2", {
|
|
198
198
|
className: "text-sm font-semibold text-tertiary mb-3",
|
|
199
199
|
children: e
|
|
200
200
|
}), /* @__PURE__ */ m("div", {
|
|
201
201
|
className: "space-y-2",
|
|
202
|
-
children:
|
|
202
|
+
children: n.map((e) => /* @__PURE__ */ m(t, {
|
|
203
203
|
notification: e,
|
|
204
204
|
onMarkAsRead: F,
|
|
205
205
|
onArchive: L,
|
|
@@ -219,7 +219,6 @@ function O() {
|
|
|
219
219
|
]
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
|
-
//#endregion
|
|
223
222
|
export { O as NotificationCenterPage };
|
|
224
223
|
|
|
225
224
|
//# sourceMappingURL=NotificationCenterPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationCenterPage.js","names":[],"sources":["../../src/pages/NotificationCenterPage.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { Search, CheckCheck, BellRing } from 'lucide-react';\nimport { PushOptInToggle } from '@burdenoff/fe-libs/chrome';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n AuroraBackground,\n Button,\n EmphasisPanel,\n GlassCard,\n GradientText,\n IllustratedEmptyState,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotifications, useNotificationTopics } from '../hooks';\nimport { NotificationCard } from '../components/NotificationCard';\nimport { filterNotifications, groupNotificationsByDate } from '../utils';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport type { NotificationPriority, NotificationType } from '../types';\n\nconst CENTER_FILTER = { archived: false, channel: 'IN_APP' as const };\nconst CENTER_UNREAD_FILTER = { channel: 'IN_APP' };\nconst TYPE_OPTIONS: Array<{ value: NotificationType; labelKey: string; label: string }> = [\n { value: 'SYSTEM', labelKey: 'notifications.typeSystem', label: 'System' },\n { value: 'ALERT', labelKey: 'notifications.typeAlert', label: 'Alert' },\n { value: 'TRANSACTIONAL', labelKey: 'notifications.typeTransactional', label: 'Transactional' },\n { value: 'MARKETING', labelKey: 'notifications.typeMarketing', label: 'Marketing' },\n];\nconst PRIORITY_OPTIONS: Array<{ value: NotificationPriority; labelKey: string; label: string }> = [\n { value: 'URGENT', labelKey: 'notifications.priorityUrgent', label: 'Urgent' },\n { value: 'HIGH', labelKey: 'notifications.priorityHigh', label: 'High' },\n { value: 'NORMAL', labelKey: 'notifications.priorityNormal', label: 'Normal' },\n { value: 'LOW', labelKey: 'notifications.priorityLow', label: 'Low' },\n];\n\n/**\n * Notification Center Page\n *\n * Main page for viewing and managing in-app notifications\n */\nexport function NotificationCenterPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const {\n notifications,\n unreadCount,\n notificationFilter,\n markAsRead,\n markAllAsRead,\n archiveNotification,\n recordAction,\n updateFilter,\n resetFilter,\n } = useNotifications({ baseFilter: CENTER_FILTER, unreadFilter: CENTER_UNREAD_FILTER });\n const { topics } = useNotificationTopics({ isActive: true });\n\n // Filter and group notifications\n const filteredNotifications = useMemo(\n () => filterNotifications(notifications, notificationFilter),\n [notifications, notificationFilter]\n );\n const groupedNotifications = useMemo(\n () => groupNotificationsByDate(filteredNotifications, tr),\n [filteredNotifications, tr]\n );\n\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n if (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST) && !currentUser?.id) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr('notifications.noPermissionView', \"You don't have permission to view notifications.\")}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4 sm:space-y-6 p-3 sm:p-6 animate-in fade-in duration-200\">\n <PagePurpose icon={<BellRing size={16} />}>\n {tr(\n 'notifications.centerPurpose',\n 'Your in-app inbox. Everything the platform needs you to see — task assignments, mentions, alerts and system updates — lands here. Filter by type, priority or topic, mark items as read, and archive what you no longer need.'\n )}\n </PagePurpose>\n\n {/* Header — the page's single emphasis zone (unread summary + the one CTA).\n Wrapped in a relative overflow-hidden container so the AuroraBackground\n can sit behind it (at -z-10) without ever moving content. This is the\n MFE's single aurora hero. */}\n <div className=\"relative overflow-hidden rounded-2xl\">\n <AuroraBackground intensity=\"subtle\" />\n <EmphasisPanel\n data-tour=\"notification-center-header\"\n className=\"flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between sm:p-6\"\n >\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-primary\">\n <GradientText>{tr('notifications.centerTitle', 'Notification Center')}</GradientText>\n </h1>\n <p className=\"text-sm text-secondary mt-1\">\n {unreadCount > 0 ? (\n <>\n {tr('notifications.youHave', 'You have')}{' '}\n <span\n className=\"inline-flex items-center gap-1.5 font-semibold text-primary\"\n data-tour=\"notification-center-unread-count\"\n >\n <span className=\"inline-block h-2 w-2 rounded-full bg-accent-primary motion-safe:animate-vc-glow-pulse\" />\n {unreadCount}\n </span>{' '}\n {tr(\n unreadCount === 1\n ? 'notifications.unreadNotification'\n : 'notifications.unreadNotifications',\n unreadCount === 1 ? 'unread notification' : 'unread notifications'\n )}\n </>\n ) : (\n tr('notifications.allCaughtUp', 'All caught up!')\n )}\n </p>\n </div>\n\n {unreadCount > 0 && (\n <Button\n data-tour=\"notification-center-mark-all-read\"\n variant=\"outline\"\n onClick={markAllAsRead}\n className=\"gap-2\"\n >\n <CheckCheck size={16} />\n {tr('notifications.markAllAsRead', 'Mark All as Read')}\n </Button>\n )}\n </EmphasisPanel>\n </div>\n\n {/* Push opt-in — renders nothing when the surface has no push support\n (web without a service worker, or a shell that never registered a\n controller), so no wrapper card here to avoid an empty box in that\n case. Placed here too since this page, not just the bell dropdown,\n can be the first notification surface a user reaches. */}\n <PushOptInToggle />\n\n {/* Filters */}\n <GlassCard\n treatment=\"plain\"\n data-tour=\"notification-center-filters\"\n className=\"flex flex-col gap-3 border-border-seam p-3 sm:flex-row sm:flex-wrap sm:items-center sm:gap-4 sm:p-4\"\n >\n {/* Search */}\n <div className=\"relative flex-1\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n data-tour=\"notification-center-search\"\n type=\"text\"\n placeholder={tr('notifications.searchPlaceholder', 'Search notifications...')}\n value={notificationFilter.search}\n onChange={(e) => updateFilter({ search: e.target.value })}\n className=\"w-full pl-9 pr-4 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150\"\n />\n </div>\n\n {/* Type filter */}\n <select\n value={notificationFilter.type}\n onChange={(e) => updateFilter({ type: e.target.value as NotificationType | 'ALL' })}\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"ALL\">{tr('notifications.allTypes', 'All Types')}</option>\n {TYPE_OPTIONS.map((option) => (\n <option key={option.value} value={option.value}>\n {tr(option.labelKey, option.label)}\n </option>\n ))}\n </select>\n\n {/* Priority filter */}\n <select\n value={notificationFilter.priority}\n onChange={(e) =>\n updateFilter({ priority: e.target.value as NotificationPriority | 'ALL' })\n }\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"ALL\">{tr('notifications.allPriorities', 'All Priorities')}</option>\n {PRIORITY_OPTIONS.map((option) => (\n <option key={option.value} value={option.value}>\n {tr(option.labelKey, option.label)}\n </option>\n ))}\n </select>\n\n <select\n value={notificationFilter.topicId || ''}\n onChange={(e) => updateFilter({ topicId: e.target.value || undefined })}\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">{tr('notifications.allTopics', 'All Topics')}</option>\n {topics.map((topic) => (\n <option key={topic.id} value={topic.id}>\n {topic.name}\n </option>\n ))}\n </select>\n\n {/* Read/Unread filter */}\n <select\n value={\n notificationFilter.isRead === null\n ? 'ALL'\n : notificationFilter.isRead\n ? 'READ'\n : 'UNREAD'\n }\n onChange={(e) =>\n updateFilter({\n isRead: e.target.value === 'ALL' ? null : e.target.value === 'READ',\n })\n }\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"ALL\">{tr('notifications.filterAll', 'All')}</option>\n <option value=\"UNREAD\">{tr('notifications.filterUnread', 'Unread')}</option>\n <option value=\"READ\">{tr('notifications.filterRead', 'Read')}</option>\n </select>\n\n {/* Reset filters */}\n {(notificationFilter.search ||\n notificationFilter.type !== 'ALL' ||\n notificationFilter.priority !== 'ALL' ||\n notificationFilter.isRead !== null ||\n Boolean(notificationFilter.topicId)) && (\n <button\n onClick={resetFilter}\n className=\"px-3 py-2 text-sm text-tertiary hover:text-primary transition-colors duration-150\"\n >\n {tr('notifications.resetFilters', 'Reset')}\n </button>\n )}\n </GlassCard>\n\n {/* Notifications list */}\n <div data-tour=\"notification-center-list\" className=\"space-y-6\">\n {filteredNotifications.length > 0 ? (\n Object.entries(groupedNotifications).map(([group, groupNotifications]) => (\n <div key={group} className=\"animate-in fade-in slide-in-from-bottom-2 duration-200\">\n <h2 className=\"text-sm font-semibold text-tertiary mb-3\">{group}</h2>\n <div className=\"space-y-2\">\n {groupNotifications.map((notification) => (\n <NotificationCard\n key={notification.id}\n notification={notification}\n onMarkAsRead={markAsRead}\n onArchive={archiveNotification}\n onAction={recordAction}\n analyticsSource=\"center\"\n />\n ))}\n </div>\n </div>\n ))\n ) : (\n <div className=\"animate-in fade-in duration-200\">\n <IllustratedEmptyState\n illustration={notifications.length === 0 ? 'empty-notifications' : 'empty-search'}\n title={tr('notifications.noNotificationsFound', 'No notifications found')}\n description={\n notifications.length === 0\n ? tr(\n 'notifications.noNotificationsYet',\n \"You don't have any notifications yet. We'll notify you when something important happens.\"\n )\n : tr(\n 'notifications.adjustFilters',\n 'Try adjusting your filters to see more notifications.'\n )\n }\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,IAAM,IAAgB;CAAE,UAAU;CAAO,SAAS;CAAmB,EAC/D,IAAuB,EAAE,SAAS,UAAU,EAC5C,IAAoF;CACxF;EAAE,OAAO;EAAU,UAAU;EAA4B,OAAO;EAAU;CAC1E;EAAE,OAAO;EAAS,UAAU;EAA2B,OAAO;EAAS;CACvE;EAAE,OAAO;EAAiB,UAAU;EAAmC,OAAO;EAAiB;CAC/F;EAAE,OAAO;EAAa,UAAU;EAA+B,OAAO;EAAa;CACpF,EACK,IAA4F;CAChG;EAAE,OAAO;EAAU,UAAU;EAAgC,OAAO;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AD;IAAK,aAAU;IAA2B,WAAU;cACjD,EAAsB,SAAS,IAC9B,OAAO,QAAQ,EAAqB,CAAC,KAAK,CAAC,GAAO,OAChD,kBAAC,OAAD;KAAiB,WAAU;eAA3B,CACE,kBAAC,MAAD;MAAI,WAAU;gBAA4C;MAAW,CAAA,EACrE,kBAAC,OAAD;MAAK,WAAU;gBACZ,EAAmB,KAAK,MACvB,kBAAC,GAAD;OAEgB;OACd,cAAc;OACd,WAAW;OACX,UAAU;OACV,iBAAgB;OAChB,EANK,EAAa,GAMlB,CACF;MACE,CAAA,CACF;OAdI,EAcJ,CACN,GAEF,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,GAAD;MACE,cAAc,EAAc,WAAW,IAAI,wBAAwB;MACnE,OAAO,EAAG,sCAAsC,yBAAyB;MACzE,aACE,EAAc,WAAW,IACrB,EACE,oCACA,2FACD,GACD,EACE,+BACA,wDACD;MAEP,CAAA;KACE,CAAA;IAEJ,CAAA;GACF"}
|
|
1
|
+
{"version":3,"file":"NotificationCenterPage.js","names":["_Fragment","CENTER_FILTER","CENTER_UNREAD_FILTER","TYPE_OPTIONS","PRIORITY_OPTIONS","NotificationCenterPage","tr","useTr","permissionsLoading","usePermissions","useNotification","useNotifications","useNotificationTopics","filteredNotifications","useMemo","filterNotifications","notifications","notificationFilter","groupedNotifications","groupNotificationsByDate","hasPermission","NOTIFICATION_PERMISSIONS","currentUser","PagePurpose","BellRing","AuroraBackground","EmphasisPanel","GradientText","unreadCount","Fragment","Button","markAllAsRead","CheckCheck","PushOptInToggle","GlassCard","Search","updateFilter","option","topics","topic","resetFilter","group","groupNotifications","NotificationCard","markAsRead","archiveNotification","recordAction","notification","IllustratedEmptyState"],"sources":["../../src/pages/NotificationCenterPage.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { Search, CheckCheck, BellRing } from 'lucide-react';\nimport { PushOptInToggle } from '@burdenoff/fe-libs/chrome';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n AuroraBackground,\n Button,\n EmphasisPanel,\n GlassCard,\n GradientText,\n IllustratedEmptyState,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotifications, useNotificationTopics } from '../hooks';\nimport { NotificationCard } from '../components/NotificationCard';\nimport { filterNotifications, groupNotificationsByDate } from '../utils';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport type { NotificationPriority, NotificationType } from '../types';\n\nconst CENTER_FILTER = { archived: false, channel: 'IN_APP' as const };\nconst CENTER_UNREAD_FILTER = { channel: 'IN_APP' };\nconst TYPE_OPTIONS: Array<{ value: NotificationType; labelKey: string; label: string }> = [\n { value: 'SYSTEM', labelKey: 'notifications.typeSystem', label: 'System' },\n { value: 'ALERT', labelKey: 'notifications.typeAlert', label: 'Alert' },\n { value: 'TRANSACTIONAL', labelKey: 'notifications.typeTransactional', label: 'Transactional' },\n { value: 'MARKETING', labelKey: 'notifications.typeMarketing', label: 'Marketing' },\n];\nconst PRIORITY_OPTIONS: Array<{ value: NotificationPriority; labelKey: string; label: string }> = [\n { value: 'URGENT', labelKey: 'notifications.priorityUrgent', label: 'Urgent' },\n { value: 'HIGH', labelKey: 'notifications.priorityHigh', label: 'High' },\n { value: 'NORMAL', labelKey: 'notifications.priorityNormal', label: 'Normal' },\n { value: 'LOW', labelKey: 'notifications.priorityLow', label: 'Low' },\n];\n\n/**\n * Notification Center Page\n *\n * Main page for viewing and managing in-app notifications\n */\nexport function NotificationCenterPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const {\n notifications,\n unreadCount,\n notificationFilter,\n markAsRead,\n markAllAsRead,\n archiveNotification,\n recordAction,\n updateFilter,\n resetFilter,\n } = useNotifications({ baseFilter: CENTER_FILTER, unreadFilter: CENTER_UNREAD_FILTER });\n const { topics } = useNotificationTopics({ isActive: true });\n\n // Filter and group notifications\n const filteredNotifications = useMemo(\n () => filterNotifications(notifications, notificationFilter),\n [notifications, notificationFilter]\n );\n const groupedNotifications = useMemo(\n () => groupNotificationsByDate(filteredNotifications, tr),\n [filteredNotifications, tr]\n );\n\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n if (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST) && !currentUser?.id) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr('notifications.noPermissionView', \"You don't have permission to view notifications.\")}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4 sm:space-y-6 p-3 sm:p-6 animate-in fade-in duration-200\">\n <PagePurpose icon={<BellRing size={16} />}>\n {tr(\n 'notifications.centerPurpose',\n 'Your in-app inbox. Everything the platform needs you to see — task assignments, mentions, alerts and system updates — lands here. Filter by type, priority or topic, mark items as read, and archive what you no longer need.'\n )}\n </PagePurpose>\n\n {/* Header — the page's single emphasis zone (unread summary + the one CTA).\n Wrapped in a relative overflow-hidden container so the AuroraBackground\n can sit behind it (at -z-10) without ever moving content. This is the\n MFE's single aurora hero. */}\n <div className=\"relative overflow-hidden rounded-2xl\">\n <AuroraBackground intensity=\"subtle\" />\n <EmphasisPanel\n data-tour=\"notification-center-header\"\n className=\"flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between sm:p-6\"\n >\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-primary\">\n <GradientText>{tr('notifications.centerTitle', 'Notification Center')}</GradientText>\n </h1>\n <p className=\"text-sm text-secondary mt-1\">\n {unreadCount > 0 ? (\n <>\n {tr('notifications.youHave', 'You have')}{' '}\n <span\n className=\"inline-flex items-center gap-1.5 font-semibold text-primary\"\n data-tour=\"notification-center-unread-count\"\n >\n <span className=\"inline-block h-2 w-2 rounded-full bg-accent-primary motion-safe:animate-vc-glow-pulse\" />\n {unreadCount}\n </span>{' '}\n {tr(\n unreadCount === 1\n ? 'notifications.unreadNotification'\n : 'notifications.unreadNotifications',\n unreadCount === 1 ? 'unread notification' : 'unread notifications'\n )}\n </>\n ) : (\n tr('notifications.allCaughtUp', 'All caught up!')\n )}\n </p>\n </div>\n\n {unreadCount > 0 && (\n <Button\n data-tour=\"notification-center-mark-all-read\"\n variant=\"outline\"\n onClick={markAllAsRead}\n className=\"gap-2\"\n >\n <CheckCheck size={16} />\n {tr('notifications.markAllAsRead', 'Mark All as Read')}\n </Button>\n )}\n </EmphasisPanel>\n </div>\n\n {/* Push opt-in — renders nothing when the surface has no push support\n (web without a service worker, or a shell that never registered a\n controller), so no wrapper card here to avoid an empty box in that\n case. Placed here too since this page, not just the bell dropdown,\n can be the first notification surface a user reaches. */}\n <PushOptInToggle />\n\n {/* Filters */}\n <GlassCard\n treatment=\"plain\"\n data-tour=\"notification-center-filters\"\n className=\"flex flex-col gap-3 border-border-seam p-3 sm:flex-row sm:flex-wrap sm:items-center sm:gap-4 sm:p-4\"\n >\n {/* Search */}\n <div className=\"relative flex-1\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n data-tour=\"notification-center-search\"\n type=\"text\"\n placeholder={tr('notifications.searchPlaceholder', 'Search notifications...')}\n value={notificationFilter.search}\n onChange={(e) => updateFilter({ search: e.target.value })}\n className=\"w-full pl-9 pr-4 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150\"\n />\n </div>\n\n {/* Type filter */}\n <select\n value={notificationFilter.type}\n onChange={(e) => updateFilter({ type: e.target.value as NotificationType | 'ALL' })}\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"ALL\">{tr('notifications.allTypes', 'All Types')}</option>\n {TYPE_OPTIONS.map((option) => (\n <option key={option.value} value={option.value}>\n {tr(option.labelKey, option.label)}\n </option>\n ))}\n </select>\n\n {/* Priority filter */}\n <select\n value={notificationFilter.priority}\n onChange={(e) =>\n updateFilter({ priority: e.target.value as NotificationPriority | 'ALL' })\n }\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"ALL\">{tr('notifications.allPriorities', 'All Priorities')}</option>\n {PRIORITY_OPTIONS.map((option) => (\n <option key={option.value} value={option.value}>\n {tr(option.labelKey, option.label)}\n </option>\n ))}\n </select>\n\n <select\n value={notificationFilter.topicId || ''}\n onChange={(e) => updateFilter({ topicId: e.target.value || undefined })}\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">{tr('notifications.allTopics', 'All Topics')}</option>\n {topics.map((topic) => (\n <option key={topic.id} value={topic.id}>\n {topic.name}\n </option>\n ))}\n </select>\n\n {/* Read/Unread filter */}\n <select\n value={\n notificationFilter.isRead === null\n ? 'ALL'\n : notificationFilter.isRead\n ? 'READ'\n : 'UNREAD'\n }\n onChange={(e) =>\n updateFilter({\n isRead: e.target.value === 'ALL' ? null : e.target.value === 'READ',\n })\n }\n className=\"px-3 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150 scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"ALL\">{tr('notifications.filterAll', 'All')}</option>\n <option value=\"UNREAD\">{tr('notifications.filterUnread', 'Unread')}</option>\n <option value=\"READ\">{tr('notifications.filterRead', 'Read')}</option>\n </select>\n\n {/* Reset filters */}\n {(notificationFilter.search ||\n notificationFilter.type !== 'ALL' ||\n notificationFilter.priority !== 'ALL' ||\n notificationFilter.isRead !== null ||\n Boolean(notificationFilter.topicId)) && (\n <button\n onClick={resetFilter}\n className=\"px-3 py-2 text-sm text-tertiary hover:text-primary transition-colors duration-150\"\n >\n {tr('notifications.resetFilters', 'Reset')}\n </button>\n )}\n </GlassCard>\n\n {/* Notifications list */}\n <div data-tour=\"notification-center-list\" className=\"space-y-6\">\n {filteredNotifications.length > 0 ? (\n Object.entries(groupedNotifications).map(([group, groupNotifications]) => (\n <div key={group} className=\"animate-in fade-in slide-in-from-bottom-2 duration-200\">\n <h2 className=\"text-sm font-semibold text-tertiary mb-3\">{group}</h2>\n <div className=\"space-y-2\">\n {groupNotifications.map((notification) => (\n <NotificationCard\n key={notification.id}\n notification={notification}\n onMarkAsRead={markAsRead}\n onArchive={archiveNotification}\n onAction={recordAction}\n analyticsSource=\"center\"\n />\n ))}\n </div>\n </div>\n ))\n ) : (\n <div className=\"animate-in fade-in duration-200\">\n <IllustratedEmptyState\n illustration={notifications.length === 0 ? 'empty-notifications' : 'empty-search'}\n title={tr('notifications.noNotificationsFound', 'No notifications found')}\n description={\n notifications.length === 0\n ? tr(\n 'notifications.noNotificationsYet',\n \"You don't have any notifications yet. We'll notify you when something important happens.\"\n )\n : tr(\n 'notifications.adjustFilters',\n 'Try adjusting your filters to see more notifications.'\n )\n }\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,IAAMC,IAAgB;CAAE,UAAU;CAAO,SAAS;AAAkB,GAC9DC,IAAuB,EAAE,SAAS,SAAS,GAC3CC,IAAoF;CACxF;EAAE,OAAO;EAAU,UAAU;EAA4B,OAAO;CAAS;CACzE;EAAE,OAAO;EAAS,UAAU;EAA2B,OAAO;CAAQ;CACtE;EAAE,OAAO;EAAiB,UAAU;EAAmC,OAAO;CAAgB;CAC9F;EAAE,OAAO;EAAa,UAAU;EAA+B,O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,UAAD;QAAQ,OAAM;QAAU,UAAAA,EAAG,8BAA8B,QAAQ;OAAU,CAAA;OAC3E,kBAAC,UAAD;QAAQ,OAAM;QAAQ,UAAAA,EAAG,4BAA4B,MAAM;OAAU,CAAA;MAC/D;;MAGNW,EAAmB,UACnBA,EAAmB,SAAS,SAC5BA,EAAmB,aAAa,SAChCA,EAAmB,WAAW,QAC9B,EAAQA,EAAmB,YAC3B,kBAAC,UAAD;MACE,SAASuB;MACT,WAAU;MAET,UAAAlC,EAAG,8BAA8B,OAAO;KACnC,CAAA;IAED;;GAGX,kBAAC,OAAD;IAAK,aAAU;IAA2B,WAAU;IACjD,UAAAO,EAAsB,SAAS,IAC9B,OAAO,QAAQK,CAAoB,CAAC,CAAC,KAAK,CAACuB,GAAOC,OAChD,kBAAC,OAAD;KAAiB,WAAU;KAA3B,UAAA,CACE,kBAAC,MAAD;MAAI,WAAU;MAA4C,UAAAD;KAAU,CAAA,GACpE,kBAAC,OAAD;MAAK,WAAU;MACZ,UAAAC,EAAmB,KAAK,MACvB,kBAACC,GAAD;OAEgB;OACd,cAAcC;OACd,WAAWC;OACX,UAAUC;OACV,iBAAgB;MACjB,GANMC,EAAa,EAMnB,CACF;KACE,CAAA,CACF;IAdK,GAAAN,CAcL,CACN,IAED,kBAAC,OAAD;KAAK,WAAU;KACb,UAAA,kBAACO,GAAD;MACE,cAAchC,EAAc,WAAW,IAAI,wBAAwB;MACnE,OAAOV,EAAG,sCAAsC,wBAAwB;MACxE,aACEU,EAAc,WAAW,IACrBV,EACE,oCACA,0FACF,IACAA,EACE,+BACA,uDACF;KAEP,CAAA;IACE,CAAA;GAEJ,CAAA;EACF;;AAET"}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { useNotificationAdmin as e } from "../hooks/useNotificationAdmin.js";
|
|
2
2
|
import { useNotificationTopics as t } from "../hooks/useNotificationTopics.js";
|
|
3
|
+
import { NotificationCard as n } from "../components/NotificationCard.js";
|
|
3
4
|
import "../hooks/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { NOTIFICATION_PERMISSIONS as i } from "../constants/permissions.js";
|
|
5
|
+
import { NOTIFICATION_PERMISSIONS as r } from "../constants/permissions.js";
|
|
6
|
+
import { useTr as i } from "../shared/hooks/useTr.js";
|
|
7
7
|
import { exportNotificationsAsCsv as a } from "../utils/notificationHistoryExport.js";
|
|
8
8
|
import { useState as o } from "react";
|
|
9
9
|
import { usePermissions as s } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
10
10
|
import { CalendarClock as c, Download as l, RefreshCw as u, Search as d } from "lucide-react";
|
|
11
11
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
12
12
|
import { Button as h, EmphasisPanel as g, GlassCard as _, IllustratedEmptyState as v, NextSteps as y, PagePurpose as b, ShowMore as x } from "@burdenoff/fe-libs/ui";
|
|
13
|
-
|
|
13
|
+
// src/pages/NotificationHistoryAdminPage.tsx
|
|
14
14
|
function S(e) {
|
|
15
15
|
return e ? new Date(e).toLocaleString() : "—";
|
|
16
16
|
}
|
|
17
17
|
function C() {
|
|
18
|
-
let C =
|
|
18
|
+
let C = i(), { hasPermission: w, isLoading: T } = s(), { topics: E } = t(), { filters: D, setFilters: O, notifications: k, scheduledNotifications: A, selectedNotification: j, events: M, isLoading: N, loadNotification: P, archiveNotification: F, unarchiveNotification: I, cancelScheduledNotification: L, rescheduleNotification: R, clearSelection: z } = e(), [B, V] = o("");
|
|
19
19
|
return T ? /* @__PURE__ */ p("div", {
|
|
20
20
|
className: "flex h-64 items-center justify-center",
|
|
21
21
|
children: /* @__PURE__ */ p("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
22
|
-
}) : w(
|
|
22
|
+
}) : w(r.NOTIFICATION_LIST) ? /* @__PURE__ */ m("div", {
|
|
23
23
|
className: "space-y-4 sm:space-y-6",
|
|
24
24
|
children: [
|
|
25
25
|
/* @__PURE__ */ p(b, {
|
|
@@ -266,7 +266,7 @@ function C() {
|
|
|
266
266
|
type: "button",
|
|
267
267
|
onClick: () => P(e.id),
|
|
268
268
|
className: "block w-full text-left",
|
|
269
|
-
children: /* @__PURE__ */ p(
|
|
269
|
+
children: /* @__PURE__ */ p(n, {
|
|
270
270
|
notification: e,
|
|
271
271
|
compact: !0,
|
|
272
272
|
showArchivedState: !0,
|
|
@@ -530,7 +530,6 @@ function C() {
|
|
|
530
530
|
children: C("notifications.noPermissionHistory", "You don't have permission to view notification history.")
|
|
531
531
|
});
|
|
532
532
|
}
|
|
533
|
-
//#endregion
|
|
534
533
|
export { C as NotificationHistoryAdminPage };
|
|
535
534
|
|
|
536
535
|
//# sourceMappingURL=NotificationHistoryAdminPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationHistoryAdminPage.js","names":[],"sources":["../../src/pages/NotificationHistoryAdminPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { CalendarClock, Download, RefreshCw, Search } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n EmphasisPanel,\n GlassCard,\n IllustratedEmptyState,\n NextSteps,\n PagePurpose,\n ShowMore,\n} from '@burdenoff/fe-libs/ui';\nimport { NotificationCard } from '../components/NotificationCard';\nimport { useNotificationAdmin, useNotificationTopics } from '../hooks';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useTr } from '../shared/hooks/useTr';\nimport { exportNotificationsAsCsv } from '../utils/notificationHistoryExport';\n\nfunction formatDateTime(value?: string | null) {\n if (!value) return '—';\n return new Date(value).toLocaleString();\n}\n\n/** Admin Notification History — scheduled ops, delivery inspector, event timeline. */\nexport function NotificationHistoryAdminPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { topics } = useNotificationTopics();\n const {\n filters,\n setFilters,\n notifications,\n scheduledNotifications,\n selectedNotification,\n events,\n isLoading,\n loadNotification,\n archiveNotification,\n unarchiveNotification,\n cancelScheduledNotification,\n rescheduleNotification,\n clearSelection,\n } = useNotificationAdmin();\n const [rescheduleAt, setRescheduleAt] = useState('');\n\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n if (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST)) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionHistory',\n \"You don't have permission to view notification history.\"\n )}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4 sm:space-y-6\">\n <PagePurpose icon={<CalendarClock size={16} />}>\n {tr(\n 'notifications.adminHistoryPurpose',\n 'The operations console for everything your team has sent. Audit delivery outcomes (delivered, opened, clicked, failed, unsubscribed), inspect a single notification’s full event timeline, and manage the schedule — reschedule or cancel anything still pending. Use it to debug a campaign or prove a notification went out.'\n )}\n </PagePurpose>\n\n <NextSteps\n storageKey=\"notification-admin-history\"\n steps={[\n {\n id: 'inspect',\n label: tr('notifications.nextInspectLabel', 'Inspect a delivery'),\n description: tr(\n 'notifications.nextInspectDesc',\n 'Click any notification to see its receipts, opens, clicks and full event timeline.'\n ),\n onClick: () => {\n if (notifications[0]) {\n loadNotification(notifications[0].id);\n }\n },\n },\n {\n id: 'failed',\n label: tr('notifications.nextFailedLabel', 'Find failed deliveries'),\n description: tr(\n 'notifications.nextFailedDesc',\n 'Filter by a FAILED delivery state to triage what did not reach recipients.'\n ),\n onClick: () => setFilters((prev) => ({ ...prev, deliveryStatus: 'FAILED' })),\n },\n {\n id: 'export',\n label: tr('notifications.nextExportLabel', 'Export the current view'),\n description: tr(\n 'notifications.nextExportDesc',\n 'Download the filtered results as CSV for reporting or an external audit.'\n ),\n onClick: () => {\n if (notifications.length > 0) {\n exportNotificationsAsCsv(tr, notifications);\n }\n },\n },\n ]}\n />\n\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-primary\">\n {tr('notifications.adminHistoryTitle', 'Notification Operations')}\n </h1>\n <p className=\"text-sm text-secondary mt-1\">\n {tr(\n 'notifications.adminHistorySubtitle',\n 'Review sent and scheduled notifications, delivery outcomes, opens, clicks, and user activity.'\n )}\n </p>\n </div>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => exportNotificationsAsCsv(tr, notifications)}\n disabled={notifications.length === 0}\n className=\"gap-2\"\n >\n <Download size={16} />\n {tr('notifications.export', 'Export')}\n </Button>\n </div>\n\n <GlassCard treatment=\"plain\" className=\"grid gap-3 border-border-seam p-4 lg:grid-cols-6\">\n <label className=\"relative lg:col-span-2\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n value={filters.search}\n onChange={(event) => setFilters((prev) => ({ ...prev, search: event.target.value }))}\n placeholder={tr(\n 'notifications.searchByTitleOrContent',\n 'Search by title or content...'\n )}\n className=\"w-full rounded-md border border-default bg-bg-canvas py-2 pl-9 pr-3 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </label>\n\n <select\n value={filters.status}\n onChange={(event) => setFilters((prev) => ({ ...prev, status: event.target.value }))}\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"all\">{tr('notifications.allStatuses', 'All Statuses')}</option>\n <option value=\"PENDING\">PENDING</option>\n <option value=\"TRIGGERED\">TRIGGERED</option>\n <option value=\"SENT\">SENT</option>\n <option value=\"FAILED\">FAILED</option>\n <option value=\"CANCELLED\">CANCELLED</option>\n </select>\n\n <select\n value={filters.channel}\n onChange={(event) => setFilters((prev) => ({ ...prev, channel: event.target.value }))}\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"all\">{tr('notifications.allChannels', 'All Channels')}</option>\n <option value=\"EMAIL\">EMAIL</option>\n <option value=\"SMS\">SMS</option>\n <option value=\"PUSH\">PUSH</option>\n <option value=\"WHATSAPP\">WHATSAPP</option>\n <option value=\"IN_APP\">IN_APP</option>\n </select>\n\n <select\n value={filters.deliveryStatus}\n onChange={(event) =>\n setFilters((prev) => ({ ...prev, deliveryStatus: event.target.value }))\n }\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"all\">{tr('notifications.allDeliveryStates', 'All Delivery')}</option>\n <option value=\"DELIVERED\">DELIVERED</option>\n <option value=\"OPENED\">OPENED</option>\n <option value=\"CLICKED\">CLICKED</option>\n <option value=\"FAILED\">FAILED</option>\n <option value=\"UNSUBSCRIBED\">UNSUBSCRIBED</option>\n </select>\n\n <select\n value={filters.topicId}\n onChange={(event) => setFilters((prev) => ({ ...prev, topicId: event.target.value }))}\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">{tr('notifications.allTopics', 'All Topics')}</option>\n {topics.map((topic) => (\n <option key={topic.id} value={topic.id}>\n {topic.name}\n </option>\n ))}\n </select>\n\n <select\n value={filters.archived}\n onChange={(event) =>\n setFilters((prev) => ({\n ...prev,\n archived: event.target.value as typeof prev.archived,\n }))\n }\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"all\">{tr('notifications.activeAndArchived', 'Active + Archived')}</option>\n <option value=\"active\">{tr('notifications.activeOnly', 'Active Only')}</option>\n <option value=\"archived\">{tr('notifications.archivedOnly', 'Archived Only')}</option>\n </select>\n </GlassCard>\n\n <div className=\"grid gap-6 xl:grid-cols-[minmax(0,1fr),420px]\">\n <div className=\"space-y-6\">\n {/* Single emphasis zone — the live results list is the heart of this console. */}\n <EmphasisPanel className=\"p-4\">\n <div className=\"mb-4 flex items-center justify-between\">\n <div>\n <h2 className=\"text-base font-semibold text-primary\">\n {tr('notifications.sentNotifications', 'Notifications')}\n </h2>\n <p className=\"text-sm text-secondary\">\n {notifications.length} {tr('notifications.resultsFoundShort', 'results')}\n </p>\n </div>\n {isLoading && <RefreshCw size={16} className=\"animate-spin text-tertiary\" />}\n </div>\n\n <div className=\"space-y-3\">\n {notifications.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-search\"\n title={tr('notifications.noNotificationsFound', 'No notifications found')}\n description={tr(\n 'notifications.adjustSearchOrDateRange',\n 'Try adjusting your filters'\n )}\n />\n ) : (\n notifications.map((notification) => (\n <button\n key={notification.id}\n type=\"button\"\n onClick={() => loadNotification(notification.id)}\n className=\"block w-full text-left\"\n >\n <NotificationCard\n notification={notification}\n compact\n showArchivedState\n analyticsSource=\"admin_history\"\n />\n </button>\n ))\n )}\n </div>\n </EmphasisPanel>\n\n <section className=\"rounded-lg border border-border-seam bg-gloss-card p-4\">\n <div className=\"mb-4 flex items-center gap-2\">\n <CalendarClock size={18} className=\"text-accent-primary\" />\n <h2 className=\"text-base font-semibold text-primary\">\n {tr('notifications.scheduledNotifications', 'Scheduled Notifications')}\n </h2>\n </div>\n\n <div className=\"space-y-3\">\n {scheduledNotifications.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={tr('notifications.noScheduledNotifications', 'No scheduled notifications')}\n description={tr(\n 'notifications.noScheduledDescription',\n 'Notifications queued for a future send time will appear here, ready to reschedule or cancel.'\n )}\n />\n ) : (\n scheduledNotifications.map((scheduled) => (\n <div\n key={scheduled.id}\n className=\"rounded-md border border-default bg-bg-canvas p-4\"\n >\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h3 className=\"text-sm font-semibold text-primary\">\n {scheduled.notification.title}\n </h3>\n <p className=\"text-xs text-secondary\">\n {scheduled.notification.channel} • {scheduled.notification.type} •{' '}\n {formatDateTime(scheduled.scheduledFor)}\n </p>\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => loadNotification(scheduled.notification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.view', 'View')}\n </button>\n {scheduled.status === 'PENDING' && (\n <button\n type=\"button\"\n onClick={() => cancelScheduledNotification(scheduled.id)}\n className=\"rounded-md border border-status-error-border px-3 py-2 text-xs text-status-error-text hover:bg-status-error-bg-subtle\"\n >\n {tr('notifications.cancel', 'Cancel')}\n </button>\n )}\n </div>\n </div>\n </div>\n ))\n )}\n </div>\n </section>\n </div>\n\n <aside className=\"rounded-lg border border-border-seam bg-gloss-card p-4 xl:sticky xl:top-4 xl:max-h-[calc(100vh-2rem)] xl:self-start xl:overflow-y-auto\">\n {selectedNotification ? (\n <div className=\"space-y-4\">\n <div className=\"flex items-start justify-between gap-3\">\n <div>\n <h2 className=\"text-lg font-semibold text-primary\">\n {selectedNotification.title}\n </h2>\n <p className=\"text-sm text-secondary\">{selectedNotification.body}</p>\n </div>\n <button\n type=\"button\"\n onClick={clearSelection}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.close', 'Close')}\n </button>\n </div>\n\n <div className=\"grid gap-2 rounded-md border border-default bg-bg-canvas p-3 text-sm text-secondary\">\n <div>\n <strong>{tr('notifications.detail.status', 'Status')}:</strong>{' '}\n {selectedNotification.status}\n </div>\n <div>\n <strong>{tr('notifications.detail.delivery', 'Delivery')}:</strong>{' '}\n {selectedNotification.deliveryStatus || '—'}\n </div>\n <div>\n <strong>{tr('notifications.detail.topic', 'Topic')}:</strong>{' '}\n {selectedNotification.topic?.name || '—'}\n </div>\n <div>\n <strong>{tr('notifications.detail.created', 'Created')}:</strong>{' '}\n {formatDateTime(selectedNotification.createdAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.sent', 'Sent')}:</strong>{' '}\n {formatDateTime(selectedNotification.sentAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.delivered', 'Delivered')}:</strong>{' '}\n {formatDateTime(selectedNotification.deliveredAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.opened', 'Opened')}:</strong>{' '}\n {formatDateTime(selectedNotification.openedAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.clicked', 'Clicked')}:</strong>{' '}\n {formatDateTime(selectedNotification.clickedAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.read', 'Read')}:</strong>{' '}\n {formatDateTime(selectedNotification.readAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.recipient', 'Recipient')}:</strong>{' '}\n {selectedNotification.recipientEmail ||\n selectedNotification.recipientPhone ||\n selectedNotification.id}\n </div>\n </div>\n\n {selectedNotification.media.length > 0 && (\n <div className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold text-primary\">\n {tr('notifications.media', 'Media')}\n </h3>\n <div className=\"grid gap-3\">\n {selectedNotification.media.map((item) => (\n <a\n key={item.url}\n href={item.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"rounded-md border border-default bg-bg-canvas p-3 text-sm text-accent-primary hover:underline\"\n >\n {item.label || item.url}\n </a>\n ))}\n </div>\n </div>\n )}\n\n {selectedNotification.actions.length > 0 && (\n <div className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold text-primary\">\n {tr('notifications.actions', 'Actions')}\n </h3>\n <div className=\"grid gap-2\">\n {selectedNotification.actions.map((action) => (\n <div\n key={action.id}\n className=\"rounded-md border border-default bg-bg-canvas p-3 text-sm text-secondary\"\n >\n <div className=\"font-medium text-primary\">{action.label}</div>\n <div className=\"truncate text-xs\">{action.url}</div>\n </div>\n ))}\n </div>\n </div>\n )}\n\n {selectedNotification.scheduledNotification && (\n <div className=\"space-y-3 rounded-md border border-default bg-bg-canvas p-3\">\n <div className=\"text-sm font-semibold text-primary\">\n {tr('notifications.scheduling', 'Scheduling')}\n </div>\n <div className=\"text-sm text-secondary\">\n {formatDateTime(selectedNotification.scheduledNotification.scheduledFor)}\n </div>\n {selectedNotification.scheduledNotification.status === 'PENDING' && (\n <>\n <input\n type=\"datetime-local\"\n value={rescheduleAt}\n onChange={(event) => setRescheduleAt(event.target.value)}\n className=\"w-full rounded-md border border-default bg-surface px-3 py-2 text-sm text-primary\"\n />\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() =>\n rescheduleAt &&\n rescheduleNotification(\n selectedNotification.scheduledNotification!.id,\n new Date(rescheduleAt).toISOString()\n )\n }\n className=\"rounded-md bg-accent-primary px-3 py-2 text-xs font-medium text-text-inverse hover:opacity-90\"\n >\n {tr('notifications.reschedule', 'Reschedule')}\n </button>\n <button\n type=\"button\"\n onClick={() =>\n cancelScheduledNotification(\n selectedNotification.scheduledNotification!.id\n )\n }\n className=\"rounded-md border border-status-error-border px-3 py-2 text-xs text-status-error-text hover:bg-status-error-bg-subtle\"\n >\n {tr('notifications.cancel', 'Cancel')}\n </button>\n </div>\n </>\n )}\n </div>\n )}\n\n <div className=\"flex items-center gap-2\">\n {selectedNotification.archivedAt ? (\n <button\n type=\"button\"\n onClick={() => unarchiveNotification(selectedNotification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.restore', 'Restore')}\n </button>\n ) : (\n <button\n type=\"button\"\n onClick={() => archiveNotification(selectedNotification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.archive', 'Archive')}\n </button>\n )}\n </div>\n\n <div className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold text-primary\">\n {tr('notifications.eventTimeline', 'Event Timeline')}\n </h3>\n {events.length === 0 ? (\n <div className=\"rounded-md border border-dashed border-border-seam p-4 text-sm text-secondary\">\n {tr('notifications.noEvents', 'No events recorded yet.')}\n </div>\n ) : (\n <ShowMore collapsedHeight={180}>\n <div className=\"space-y-2\">\n {events.map((event) => (\n <div\n key={event.id}\n className=\"rounded-md border border-border-seam bg-surface p-3 text-sm text-secondary\"\n >\n <div className=\"font-medium text-primary\">{event.eventType}</div>\n <div>{formatDateTime(event.timestamp)}</div>\n {event.deliveryStatus && (\n <div>\n {tr('notifications.detail.delivery', 'Delivery')}:{' '}\n {event.deliveryStatus}\n </div>\n )}\n </div>\n ))}\n </div>\n </ShowMore>\n )}\n </div>\n </div>\n ) : (\n <div className=\"flex h-full min-h-[360px] items-center justify-center\">\n <IllustratedEmptyState\n illustration=\"empty-search\"\n title={tr('notifications.selectNotificationTitle', 'Nothing selected')}\n description={tr(\n 'notifications.selectNotificationForDetails',\n 'Select a notification to inspect details, delivery receipts, and activity.'\n )}\n />\n </div>\n )}\n </aside>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAAS,EAAe,GAAuB;AAE7C,QADK,IACE,IAAI,KAAK,EAAM,CAAC,gBAAgB,GADpB;;AAKrB,SAAgB,IAA+B;CAC7C,IAAM,IAAK,GAAO,EACZ,EAAE,kBAAe,WAAW,MAAuB,GAAgB,EACnE,EAAE,cAAW,GAAuB,EACpC,EACJ,YACA,eACA,kBACA,2BACA,yBACA,WACA,cACA,qBACA,wBACA,0BACA,gCACA,2BACA,sBACE,GAAsB,EACpB,CAAC,GAAc,KAAmB,EAAS,GAAG;AAqBpD,QAnBI,IAEA,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD,EAAK,WAAU,kFAAmF,CAAA;EAC9F,CAAA,GAIL,EAAc,EAAyB,kBAAkB,GAY5D,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,GAAD;IAAa,MAAM,kBAAC,GAAD,EAAe,MAAM,IAAM,CAAA;cAC3C,EACC,qCACA,iUACD;IACW,CAAA;GAEd,kBAAC,G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,kBAAC,OAAD;QAAK,WAAU;kBACZ,EAAqB,aACpB,kBAAC,UAAD;SACE,MAAK;SACL,eAAe,EAAsB,EAAqB,GAAG;SAC7D,WAAU;mBAET,EAAG,yBAAyB,UAAU;SAChC,CAAA,GAET,kBAAC,UAAD;SACE,MAAK;SACL,eAAe,EAAoB,EAAqB,GAAG;SAC3D,WAAU;mBAET,EAAG,yBAAyB,UAAU;SAChC,CAAA;QAEP,CAAA;OAEN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,MAAD;SAAI,WAAU;mBACX,EAAG,+BAA+B,iBAAiB;SACjD,CAAA,EACJ,EAAO,WAAW,IACjB,kBAAC,OAAD;SAAK,WAAU;mBACZ,EAAG,0BAA0B,0BAA0B;SACpD,CAAA,GAEN,kBAAC,GAAD;SAAU,iBAAiB;mBACzB,kBAAC,OAAD;UAAK,WAAU;oBACZ,EAAO,KAAK,MACX,kBAAC,OAAD;WAEE,WAAU;qBAFZ;YAIE,kBAAC,OAAD;aAAK,WAAU;uBAA4B,EAAM;aAAgB,CAAA;YACjE,kBAAC,OAAD,EAAA,UAAM,EAAe,EAAM,UAAU,EAAO,CAAA;YAC3C,EAAM,kBACL,kBAAC,OAAD,EAAA,UAAA;aACG,EAAG,iCAAiC,WAAW;aAAC;aAAE;aAClD,EAAM;aACH,EAAA,CAAA;YAEJ;aAXC,EAAM,GAWP,CACN;UACE,CAAA;SACG,CAAA,CAET;;OACF;UAEN,kBAAC,OAAD;MAAK,WAAU;gBACb,kBAAC,GAAD;OACE,cAAa;OACb,OAAO,EAAG,yCAAyC,mBAAmB;OACtE,aAAa,EACX,8CACA,6EACD;OACD,CAAA;MACE,CAAA;KAEF,CAAA,CACJ;;GACF;MA1eJ,kBAAC,OAAD;EAAK,WAAU;YACZ,EACC,qCACA,0DACD;EACG,CAAA"}
|
|
1
|
+
{"version":3,"file":"NotificationHistoryAdminPage.js","names":["_Fragment","formatDateTime","value","NotificationHistoryAdminPage","tr","useTr","permissionsLoading","usePermissions","useNotificationTopics","useNotificationAdmin","rescheduleAt","setRescheduleAt","useState","hasPermission","NOTIFICATION_PERMISSIONS","PagePurpose","CalendarClock","NextSteps","notifications","loadNotification","setFilters","prev","exportNotificationsAsCsv","Button","Download","GlassCard","Search","filters","event","topics","topic","EmphasisPanel","isLoading","RefreshCw","IllustratedEmptyState","notification","NotificationCard","scheduledNotifications","scheduled","cancelScheduledNotification","selectedNotification","clearSelection","item","action","Fragment","rescheduleNotification","unarchiveNotification","archiveNotification","events","ShowMore"],"sources":["../../src/pages/NotificationHistoryAdminPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { CalendarClock, Download, RefreshCw, Search } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n EmphasisPanel,\n GlassCard,\n IllustratedEmptyState,\n NextSteps,\n PagePurpose,\n ShowMore,\n} from '@burdenoff/fe-libs/ui';\nimport { NotificationCard } from '../components/NotificationCard';\nimport { useNotificationAdmin, useNotificationTopics } from '../hooks';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useTr } from '../shared/hooks/useTr';\nimport { exportNotificationsAsCsv } from '../utils/notificationHistoryExport';\n\nfunction formatDateTime(value?: string | null) {\n if (!value) return '—';\n return new Date(value).toLocaleString();\n}\n\n/** Admin Notification History — scheduled ops, delivery inspector, event timeline. */\nexport function NotificationHistoryAdminPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { topics } = useNotificationTopics();\n const {\n filters,\n setFilters,\n notifications,\n scheduledNotifications,\n selectedNotification,\n events,\n isLoading,\n loadNotification,\n archiveNotification,\n unarchiveNotification,\n cancelScheduledNotification,\n rescheduleNotification,\n clearSelection,\n } = useNotificationAdmin();\n const [rescheduleAt, setRescheduleAt] = useState('');\n\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n if (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST)) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionHistory',\n \"You don't have permission to view notification history.\"\n )}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4 sm:space-y-6\">\n <PagePurpose icon={<CalendarClock size={16} />}>\n {tr(\n 'notifications.adminHistoryPurpose',\n 'The operations console for everything your team has sent. Audit delivery outcomes (delivered, opened, clicked, failed, unsubscribed), inspect a single notification’s full event timeline, and manage the schedule — reschedule or cancel anything still pending. Use it to debug a campaign or prove a notification went out.'\n )}\n </PagePurpose>\n\n <NextSteps\n storageKey=\"notification-admin-history\"\n steps={[\n {\n id: 'inspect',\n label: tr('notifications.nextInspectLabel', 'Inspect a delivery'),\n description: tr(\n 'notifications.nextInspectDesc',\n 'Click any notification to see its receipts, opens, clicks and full event timeline.'\n ),\n onClick: () => {\n if (notifications[0]) {\n loadNotification(notifications[0].id);\n }\n },\n },\n {\n id: 'failed',\n label: tr('notifications.nextFailedLabel', 'Find failed deliveries'),\n description: tr(\n 'notifications.nextFailedDesc',\n 'Filter by a FAILED delivery state to triage what did not reach recipients.'\n ),\n onClick: () => setFilters((prev) => ({ ...prev, deliveryStatus: 'FAILED' })),\n },\n {\n id: 'export',\n label: tr('notifications.nextExportLabel', 'Export the current view'),\n description: tr(\n 'notifications.nextExportDesc',\n 'Download the filtered results as CSV for reporting or an external audit.'\n ),\n onClick: () => {\n if (notifications.length > 0) {\n exportNotificationsAsCsv(tr, notifications);\n }\n },\n },\n ]}\n />\n\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-primary\">\n {tr('notifications.adminHistoryTitle', 'Notification Operations')}\n </h1>\n <p className=\"text-sm text-secondary mt-1\">\n {tr(\n 'notifications.adminHistorySubtitle',\n 'Review sent and scheduled notifications, delivery outcomes, opens, clicks, and user activity.'\n )}\n </p>\n </div>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => exportNotificationsAsCsv(tr, notifications)}\n disabled={notifications.length === 0}\n className=\"gap-2\"\n >\n <Download size={16} />\n {tr('notifications.export', 'Export')}\n </Button>\n </div>\n\n <GlassCard treatment=\"plain\" className=\"grid gap-3 border-border-seam p-4 lg:grid-cols-6\">\n <label className=\"relative lg:col-span-2\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n value={filters.search}\n onChange={(event) => setFilters((prev) => ({ ...prev, search: event.target.value }))}\n placeholder={tr(\n 'notifications.searchByTitleOrContent',\n 'Search by title or content...'\n )}\n className=\"w-full rounded-md border border-default bg-bg-canvas py-2 pl-9 pr-3 text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent\"\n />\n </label>\n\n <select\n value={filters.status}\n onChange={(event) => setFilters((prev) => ({ ...prev, status: event.target.value }))}\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"all\">{tr('notifications.allStatuses', 'All Statuses')}</option>\n <option value=\"PENDING\">PENDING</option>\n <option value=\"TRIGGERED\">TRIGGERED</option>\n <option value=\"SENT\">SENT</option>\n <option value=\"FAILED\">FAILED</option>\n <option value=\"CANCELLED\">CANCELLED</option>\n </select>\n\n <select\n value={filters.channel}\n onChange={(event) => setFilters((prev) => ({ ...prev, channel: event.target.value }))}\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"all\">{tr('notifications.allChannels', 'All Channels')}</option>\n <option value=\"EMAIL\">EMAIL</option>\n <option value=\"SMS\">SMS</option>\n <option value=\"PUSH\">PUSH</option>\n <option value=\"WHATSAPP\">WHATSAPP</option>\n <option value=\"IN_APP\">IN_APP</option>\n </select>\n\n <select\n value={filters.deliveryStatus}\n onChange={(event) =>\n setFilters((prev) => ({ ...prev, deliveryStatus: event.target.value }))\n }\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"all\">{tr('notifications.allDeliveryStates', 'All Delivery')}</option>\n <option value=\"DELIVERED\">DELIVERED</option>\n <option value=\"OPENED\">OPENED</option>\n <option value=\"CLICKED\">CLICKED</option>\n <option value=\"FAILED\">FAILED</option>\n <option value=\"UNSUBSCRIBED\">UNSUBSCRIBED</option>\n </select>\n\n <select\n value={filters.topicId}\n onChange={(event) => setFilters((prev) => ({ ...prev, topicId: event.target.value }))}\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">{tr('notifications.allTopics', 'All Topics')}</option>\n {topics.map((topic) => (\n <option key={topic.id} value={topic.id}>\n {topic.name}\n </option>\n ))}\n </select>\n\n <select\n value={filters.archived}\n onChange={(event) =>\n setFilters((prev) => ({\n ...prev,\n archived: event.target.value as typeof prev.archived,\n }))\n }\n className=\"rounded-md border border-default bg-bg-canvas px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"all\">{tr('notifications.activeAndArchived', 'Active + Archived')}</option>\n <option value=\"active\">{tr('notifications.activeOnly', 'Active Only')}</option>\n <option value=\"archived\">{tr('notifications.archivedOnly', 'Archived Only')}</option>\n </select>\n </GlassCard>\n\n <div className=\"grid gap-6 xl:grid-cols-[minmax(0,1fr),420px]\">\n <div className=\"space-y-6\">\n {/* Single emphasis zone — the live results list is the heart of this console. */}\n <EmphasisPanel className=\"p-4\">\n <div className=\"mb-4 flex items-center justify-between\">\n <div>\n <h2 className=\"text-base font-semibold text-primary\">\n {tr('notifications.sentNotifications', 'Notifications')}\n </h2>\n <p className=\"text-sm text-secondary\">\n {notifications.length} {tr('notifications.resultsFoundShort', 'results')}\n </p>\n </div>\n {isLoading && <RefreshCw size={16} className=\"animate-spin text-tertiary\" />}\n </div>\n\n <div className=\"space-y-3\">\n {notifications.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-search\"\n title={tr('notifications.noNotificationsFound', 'No notifications found')}\n description={tr(\n 'notifications.adjustSearchOrDateRange',\n 'Try adjusting your filters'\n )}\n />\n ) : (\n notifications.map((notification) => (\n <button\n key={notification.id}\n type=\"button\"\n onClick={() => loadNotification(notification.id)}\n className=\"block w-full text-left\"\n >\n <NotificationCard\n notification={notification}\n compact\n showArchivedState\n analyticsSource=\"admin_history\"\n />\n </button>\n ))\n )}\n </div>\n </EmphasisPanel>\n\n <section className=\"rounded-lg border border-border-seam bg-gloss-card p-4\">\n <div className=\"mb-4 flex items-center gap-2\">\n <CalendarClock size={18} className=\"text-accent-primary\" />\n <h2 className=\"text-base font-semibold text-primary\">\n {tr('notifications.scheduledNotifications', 'Scheduled Notifications')}\n </h2>\n </div>\n\n <div className=\"space-y-3\">\n {scheduledNotifications.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={tr('notifications.noScheduledNotifications', 'No scheduled notifications')}\n description={tr(\n 'notifications.noScheduledDescription',\n 'Notifications queued for a future send time will appear here, ready to reschedule or cancel.'\n )}\n />\n ) : (\n scheduledNotifications.map((scheduled) => (\n <div\n key={scheduled.id}\n className=\"rounded-md border border-default bg-bg-canvas p-4\"\n >\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <h3 className=\"text-sm font-semibold text-primary\">\n {scheduled.notification.title}\n </h3>\n <p className=\"text-xs text-secondary\">\n {scheduled.notification.channel} • {scheduled.notification.type} •{' '}\n {formatDateTime(scheduled.scheduledFor)}\n </p>\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => loadNotification(scheduled.notification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.view', 'View')}\n </button>\n {scheduled.status === 'PENDING' && (\n <button\n type=\"button\"\n onClick={() => cancelScheduledNotification(scheduled.id)}\n className=\"rounded-md border border-status-error-border px-3 py-2 text-xs text-status-error-text hover:bg-status-error-bg-subtle\"\n >\n {tr('notifications.cancel', 'Cancel')}\n </button>\n )}\n </div>\n </div>\n </div>\n ))\n )}\n </div>\n </section>\n </div>\n\n <aside className=\"rounded-lg border border-border-seam bg-gloss-card p-4 xl:sticky xl:top-4 xl:max-h-[calc(100vh-2rem)] xl:self-start xl:overflow-y-auto\">\n {selectedNotification ? (\n <div className=\"space-y-4\">\n <div className=\"flex items-start justify-between gap-3\">\n <div>\n <h2 className=\"text-lg font-semibold text-primary\">\n {selectedNotification.title}\n </h2>\n <p className=\"text-sm text-secondary\">{selectedNotification.body}</p>\n </div>\n <button\n type=\"button\"\n onClick={clearSelection}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.close', 'Close')}\n </button>\n </div>\n\n <div className=\"grid gap-2 rounded-md border border-default bg-bg-canvas p-3 text-sm text-secondary\">\n <div>\n <strong>{tr('notifications.detail.status', 'Status')}:</strong>{' '}\n {selectedNotification.status}\n </div>\n <div>\n <strong>{tr('notifications.detail.delivery', 'Delivery')}:</strong>{' '}\n {selectedNotification.deliveryStatus || '—'}\n </div>\n <div>\n <strong>{tr('notifications.detail.topic', 'Topic')}:</strong>{' '}\n {selectedNotification.topic?.name || '—'}\n </div>\n <div>\n <strong>{tr('notifications.detail.created', 'Created')}:</strong>{' '}\n {formatDateTime(selectedNotification.createdAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.sent', 'Sent')}:</strong>{' '}\n {formatDateTime(selectedNotification.sentAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.delivered', 'Delivered')}:</strong>{' '}\n {formatDateTime(selectedNotification.deliveredAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.opened', 'Opened')}:</strong>{' '}\n {formatDateTime(selectedNotification.openedAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.clicked', 'Clicked')}:</strong>{' '}\n {formatDateTime(selectedNotification.clickedAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.read', 'Read')}:</strong>{' '}\n {formatDateTime(selectedNotification.readAt)}\n </div>\n <div>\n <strong>{tr('notifications.detail.recipient', 'Recipient')}:</strong>{' '}\n {selectedNotification.recipientEmail ||\n selectedNotification.recipientPhone ||\n selectedNotification.id}\n </div>\n </div>\n\n {selectedNotification.media.length > 0 && (\n <div className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold text-primary\">\n {tr('notifications.media', 'Media')}\n </h3>\n <div className=\"grid gap-3\">\n {selectedNotification.media.map((item) => (\n <a\n key={item.url}\n href={item.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"rounded-md border border-default bg-bg-canvas p-3 text-sm text-accent-primary hover:underline\"\n >\n {item.label || item.url}\n </a>\n ))}\n </div>\n </div>\n )}\n\n {selectedNotification.actions.length > 0 && (\n <div className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold text-primary\">\n {tr('notifications.actions', 'Actions')}\n </h3>\n <div className=\"grid gap-2\">\n {selectedNotification.actions.map((action) => (\n <div\n key={action.id}\n className=\"rounded-md border border-default bg-bg-canvas p-3 text-sm text-secondary\"\n >\n <div className=\"font-medium text-primary\">{action.label}</div>\n <div className=\"truncate text-xs\">{action.url}</div>\n </div>\n ))}\n </div>\n </div>\n )}\n\n {selectedNotification.scheduledNotification && (\n <div className=\"space-y-3 rounded-md border border-default bg-bg-canvas p-3\">\n <div className=\"text-sm font-semibold text-primary\">\n {tr('notifications.scheduling', 'Scheduling')}\n </div>\n <div className=\"text-sm text-secondary\">\n {formatDateTime(selectedNotification.scheduledNotification.scheduledFor)}\n </div>\n {selectedNotification.scheduledNotification.status === 'PENDING' && (\n <>\n <input\n type=\"datetime-local\"\n value={rescheduleAt}\n onChange={(event) => setRescheduleAt(event.target.value)}\n className=\"w-full rounded-md border border-default bg-surface px-3 py-2 text-sm text-primary\"\n />\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() =>\n rescheduleAt &&\n rescheduleNotification(\n selectedNotification.scheduledNotification!.id,\n new Date(rescheduleAt).toISOString()\n )\n }\n className=\"rounded-md bg-accent-primary px-3 py-2 text-xs font-medium text-text-inverse hover:opacity-90\"\n >\n {tr('notifications.reschedule', 'Reschedule')}\n </button>\n <button\n type=\"button\"\n onClick={() =>\n cancelScheduledNotification(\n selectedNotification.scheduledNotification!.id\n )\n }\n className=\"rounded-md border border-status-error-border px-3 py-2 text-xs text-status-error-text hover:bg-status-error-bg-subtle\"\n >\n {tr('notifications.cancel', 'Cancel')}\n </button>\n </div>\n </>\n )}\n </div>\n )}\n\n <div className=\"flex items-center gap-2\">\n {selectedNotification.archivedAt ? (\n <button\n type=\"button\"\n onClick={() => unarchiveNotification(selectedNotification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.restore', 'Restore')}\n </button>\n ) : (\n <button\n type=\"button\"\n onClick={() => archiveNotification(selectedNotification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.archive', 'Archive')}\n </button>\n )}\n </div>\n\n <div className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold text-primary\">\n {tr('notifications.eventTimeline', 'Event Timeline')}\n </h3>\n {events.length === 0 ? (\n <div className=\"rounded-md border border-dashed border-border-seam p-4 text-sm text-secondary\">\n {tr('notifications.noEvents', 'No events recorded yet.')}\n </div>\n ) : (\n <ShowMore collapsedHeight={180}>\n <div className=\"space-y-2\">\n {events.map((event) => (\n <div\n key={event.id}\n className=\"rounded-md border border-border-seam bg-surface p-3 text-sm text-secondary\"\n >\n <div className=\"font-medium text-primary\">{event.eventType}</div>\n <div>{formatDateTime(event.timestamp)}</div>\n {event.deliveryStatus && (\n <div>\n {tr('notifications.detail.delivery', 'Delivery')}:{' '}\n {event.deliveryStatus}\n </div>\n )}\n </div>\n ))}\n </div>\n </ShowMore>\n )}\n </div>\n </div>\n ) : (\n <div className=\"flex h-full min-h-[360px] items-center justify-center\">\n <IllustratedEmptyState\n illustration=\"empty-search\"\n title={tr('notifications.selectNotificationTitle', 'Nothing selected')}\n description={tr(\n 'notifications.selectNotificationForDetails',\n 'Select a notification to inspect details, delivery receipts, and activity.'\n )}\n />\n </div>\n )}\n </aside>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAASC,EAAe,GAAuB;CAE7C,OADKC,IACE,IAAI,KAAKA,CAAK,CAAC,CAAC,eAAe,IADnB;AAErB;AAGA,SAAgBC,IAA+B;CAC7C,IAAMC,IAAKC,EAAM,GACX,EAAE,kBAAe,WAAWC,MAAuBC,EAAe,GAClE,EAAE,cAAWC,EAAsB,GACnC,EACJ,YACA,eACA,kBACA,2BACA,yBACA,WACA,cACA,qBACA,wBACA,0BACA,gCACA,2BACA,sBACEC,EAAqB,GACnB,CAACC,GAAcC,KAAmBC,EAAS,EAAE;CAqBnD,OAnBIN,IAEA,kBAAC,OAAD;EAAK,WAAU;EACb,UAAA,kBAAC,OAAD,EAAK,WAAU,iFAAkF,CAAA;CAC9F,CAAA,IAIJO,EAAcC,EAAyB,iBAAiB,IAY3D,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,kBAACC,GAAD;IAAa,MAAM,kBAACC,GAAD,EAAe,MAAM,GAAK,CAAA;IAC1C,UAAAZ,EACC,qCACA,gUACF;GACW,CAAA;GAEb,kBAACa,GAAD;IACE,YAAW;IACX,OAAO;KACL;MACE,IAAI;MACJ,OAAOb,EAAG,kCAAkC,oBAAoB;MAChE,aAAaA,EACX,iCACA,oFACF;MACA,eAAe;OACb,AAAIc,EAAc,MAChBC,EAAiBD,EAA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AAC,OAAD;WAEE,WAAU;WAFZ,UAAA;YAIE,kBAAC,OAAD;aAAK,WAAU;aAA4B,UAAApB,EAAM;YAAe,CAAA;YAChE,kBAAC,OAAD,EAAA,UAAM3B,EAAe2B,EAAM,SAAS,EAAO,CAAA;YAC1CA,EAAM,kBACL,kBAAC,OAAD,EAAA,UAAA;aACGxB,EAAG,iCAAiC,UAAU;aAAE;aAAE;aAClDwB,EAAM;YACJ,EAAA,CAAA;WAEJ;UAXE,GAAAA,EAAM,EAWR,CACN;SACE,CAAA;QACG,CAAA,CAET;;MACF;KAEL,CAAA,IAAA,kBAAC,OAAD;MAAK,WAAU;MACb,UAAA,kBAACM,GAAD;OACE,cAAa;OACb,OAAO9B,EAAG,yCAAyC,kBAAkB;OACrE,aAAaA,EACX,8CACA,4EACF;MACD,CAAA;KACE,CAAA;IAEF,CAAA,CACJ;;EACF;C,KA1eH,kBAAC,OAAD;EAAK,WAAU;EACZ,UAAAA,EACC,qCACA,yDACF;CACG,CAAA;AAueX"}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NotificationCard as e } from "../components/NotificationCard.js";
|
|
2
2
|
import { useNotifications as t } from "../hooks/useNotifications.js";
|
|
3
3
|
import { useNotificationTopics as n } from "../hooks/useNotificationTopics.js";
|
|
4
4
|
import "../hooks/index.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { NOTIFICATION_PERMISSIONS as r } from "../constants/permissions.js";
|
|
6
|
+
import { useNotification as i } from "../providers/NotificationProvider.js";
|
|
7
|
+
import { useTr as a } from "../shared/hooks/useTr.js";
|
|
8
8
|
import { exportNotificationsAsCsv as o } from "../utils/notificationHistoryExport.js";
|
|
9
9
|
import { usePermissions as s } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
10
10
|
import { Download as c, History as l, Search as u } from "lucide-react";
|
|
11
11
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
12
12
|
import { Button as p, EmphasisPanel as m, GlassCard as h, IllustratedEmptyState as g, PagePurpose as _ } from "@burdenoff/fe-libs/ui";
|
|
13
|
-
|
|
13
|
+
// src/pages/NotificationHistoryPage.tsx
|
|
14
14
|
var v = {
|
|
15
15
|
archived: null,
|
|
16
16
|
channel: "ALL"
|
|
17
17
|
};
|
|
18
18
|
function y() {
|
|
19
|
-
let y =
|
|
19
|
+
let y = a(), { hasPermission: b, isLoading: x } = s(), { currentUser: S } = i(), { topics: C } = n({ isActive: !0 }), { notifications: w, notificationFilter: T, updateFilter: E, archiveNotification: D, unarchiveNotification: O, recordAction: k } = t({ baseFilter: v }), A = !!(T.search || T.topicId || T.dateRange.start || T.dateRange.end);
|
|
20
20
|
return x ? /* @__PURE__ */ d("div", {
|
|
21
21
|
className: "flex h-64 items-center justify-center",
|
|
22
22
|
children: /* @__PURE__ */ d("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
23
|
-
}) : !b(
|
|
23
|
+
}) : !b(r.NOTIFICATION_LIST) && !S?.id ? /* @__PURE__ */ d("div", {
|
|
24
24
|
className: "p-8 text-center text-text-secondary",
|
|
25
25
|
children: y("notifications.noPermissionHistory", "You don't have permission to view notification history.")
|
|
26
26
|
}) : /* @__PURE__ */ f("div", {
|
|
@@ -101,23 +101,23 @@ function y() {
|
|
|
101
101
|
}),
|
|
102
102
|
/* @__PURE__ */ d("div", {
|
|
103
103
|
className: "space-y-2",
|
|
104
|
-
children: w.length > 0 ? w.map((
|
|
104
|
+
children: w.length > 0 ? w.map((t) => /* @__PURE__ */ f("div", {
|
|
105
105
|
className: "space-y-2",
|
|
106
|
-
children: [/* @__PURE__ */ d(
|
|
107
|
-
notification:
|
|
106
|
+
children: [/* @__PURE__ */ d(e, {
|
|
107
|
+
notification: t,
|
|
108
108
|
onArchive: D,
|
|
109
109
|
onAction: k,
|
|
110
110
|
showArchivedState: !0,
|
|
111
111
|
analyticsSource: "history"
|
|
112
|
-
}),
|
|
112
|
+
}), t.archivedAt && /* @__PURE__ */ d("div", {
|
|
113
113
|
className: "flex justify-end",
|
|
114
114
|
children: /* @__PURE__ */ d("button", {
|
|
115
|
-
onClick: () => O(
|
|
115
|
+
onClick: () => O(t.id),
|
|
116
116
|
className: "rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken",
|
|
117
117
|
children: y("notifications.restore", "Restore")
|
|
118
118
|
})
|
|
119
119
|
})]
|
|
120
|
-
},
|
|
120
|
+
}, t.id)) : /* @__PURE__ */ d("div", {
|
|
121
121
|
className: "animate-in fade-in duration-200",
|
|
122
122
|
children: /* @__PURE__ */ d(g, {
|
|
123
123
|
illustration: A ? "empty-search" : "empty-notifications",
|
|
@@ -129,7 +129,6 @@ function y() {
|
|
|
129
129
|
]
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
|
-
//#endregion
|
|
133
132
|
export { y as NotificationHistoryPage };
|
|
134
133
|
|
|
135
134
|
//# sourceMappingURL=NotificationHistoryPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationHistoryPage.js","names":[],"sources":["../../src/pages/NotificationHistoryPage.tsx"],"sourcesContent":["import { Download, History, Search } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n EmphasisPanel,\n GlassCard,\n IllustratedEmptyState,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { NotificationCard } from '../components/NotificationCard';\nimport { useNotifications, useNotificationTopics } from '../hooks';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport { exportNotificationsAsCsv } from '../utils/notificationHistoryExport';\n\nconst HISTORY_FILTER = { archived: null, channel: 'ALL' as const };\n\n/** User Notification History — personal history, filter, CSV export, archive/unarchive. */\nexport function NotificationHistoryPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const { topics } = useNotificationTopics({ isActive: true });\n const {\n notifications,\n notificationFilter,\n updateFilter,\n archiveNotification,\n unarchiveNotification,\n recordAction,\n } = useNotifications({ baseFilter: HISTORY_FILTER });\n\n const hasActiveFilters = Boolean(\n notificationFilter.search ||\n notificationFilter.topicId ||\n notificationFilter.dateRange.start ||\n notificationFilter.dateRange.end\n );\n\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n if (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST) && !currentUser?.id) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionHistory',\n \"You don't have permission to view notification history.\"\n )}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4 sm:space-y-6 p-3 sm:p-6 animate-in fade-in duration-200\">\n <PagePurpose icon={<History size={16} />}>\n {tr(\n 'notifications.historyPurpose',\n 'A searchable archive of every notification you have ever received, across all channels (in-app, email, push and more). Look back through anything you read or archived, narrow by topic or date range, and export the results to CSV for your own records.'\n )}\n </PagePurpose>\n\n {/* Single emphasis zone — the header summary + the one export CTA. */}\n <EmphasisPanel\n data-tour=\"notification-history-header\"\n className=\"flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between sm:p-6\"\n >\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-primary\">\n {tr('notifications.historyTitle', 'Notification History')}\n </h1>\n <p className=\"text-sm text-secondary mt-1\">\n {tr('notifications.historySubtitle', 'View and search all your notifications')}\n </p>\n </div>\n\n <Button\n data-tour=\"notification-history-export\"\n variant=\"outline\"\n onClick={() => exportNotificationsAsCsv(tr, notifications)}\n disabled={notifications.length === 0}\n className=\"gap-2\"\n >\n <Download size={16} />\n {tr('notifications.export', 'Export')}\n </Button>\n </EmphasisPanel>\n\n <GlassCard\n treatment=\"plain\"\n className=\"grid gap-3 border-border-seam p-3 sm:grid-cols-2 sm:p-4 xl:grid-cols-5\"\n >\n <div className=\"relative sm:col-span-2 xl:col-span-2\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n placeholder={tr(\n 'notifications.searchByTitleOrContent',\n 'Search by title or content...'\n )}\n value={notificationFilter.search}\n onChange={(e) => updateFilter({ search: e.target.value })}\n className=\"w-full pl-9 pr-4 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150\"\n />\n </div>\n\n <select\n value={notificationFilter.topicId || ''}\n onChange={(event) => updateFilter({ topicId: event.target.value || undefined })}\n className=\"rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">{tr('notifications.allTopics', 'All Topics')}</option>\n {topics.map((topic) => (\n <option key={topic.id} value={topic.id}>\n {topic.name}\n </option>\n ))}\n </select>\n\n <input\n type=\"date\"\n aria-label={tr('notifications.startDate', 'Start date')}\n value={\n notificationFilter.dateRange.start\n ? notificationFilter.dateRange.start.toISOString().split('T')[0]\n : ''\n }\n onChange={(e) =>\n updateFilter({\n dateRange: {\n ...notificationFilter.dateRange,\n start: e.target.value ? new Date(e.target.value) : null,\n },\n })\n }\n className=\"rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary\"\n />\n\n <input\n type=\"date\"\n aria-label={tr('notifications.endDate', 'End date')}\n value={\n notificationFilter.dateRange.end\n ? notificationFilter.dateRange.end.toISOString().split('T')[0]\n : ''\n }\n onChange={(e) =>\n updateFilter({\n dateRange: {\n ...notificationFilter.dateRange,\n end: e.target.value ? new Date(e.target.value) : null,\n },\n })\n }\n className=\"rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary\"\n />\n </GlassCard>\n\n <div className=\"space-y-2\">\n {notifications.length > 0 ? (\n notifications.map((notification) => (\n <div key={notification.id} className=\"space-y-2\">\n <NotificationCard\n notification={notification}\n onArchive={archiveNotification}\n onAction={recordAction}\n showArchivedState\n analyticsSource=\"history\"\n />\n {notification.archivedAt && (\n <div className=\"flex justify-end\">\n <button\n onClick={() => unarchiveNotification(notification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.restore', 'Restore')}\n </button>\n </div>\n )}\n </div>\n ))\n ) : (\n <div className=\"animate-in fade-in duration-200\">\n <IllustratedEmptyState\n illustration={hasActiveFilters ? 'empty-search' : 'empty-notifications'}\n title={\n hasActiveFilters\n ? tr('notifications.noNotificationsFound', 'No notifications found')\n : tr('notifications.historyEmptyTitle', 'No history yet')\n }\n description={\n hasActiveFilters\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : tr(\n 'notifications.historyEmptyDescription',\n 'Notifications you receive will be archived here so you can always find them again.'\n )\n }\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,IAAM,IAAiB;CAAE,UAAU;CAAM,SAAS;CAAgB;AAGlE,SAAgB,IAA0B;CACxC,IAAM,IAAK,GAAO,EACZ,EAAE,kBAAe,WAAW,MAAuB,GAAgB,EACnE,EAAE,mBAAgB,GAAiB,EACnC,EAAE,cAAW,EAAsB,EAAE,UAAU,IAAM,CAAC,EACtD,EACJ,kBACA,uBACA,iBACA,wBACA,0BACA,oBACE,EAAiB,EAAE,YAAY,GAAgB,CAAC,EAE9C,IAAmB,GACvB,EAAmB,UACnB,EAAmB,WACnB,EAAmB,UAAU,SAC7B,EAAmB,UAAU;AAsB/B,QAnBI,IAEA,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD,EAAK,WAAU,kFAAmF,CAAA;EAC9F,CAAA,GAIN,CAAC,EAAc,EAAyB,kBAAkB,IAAI,CAAC,GAAa,KAE5E,kBAAC,OAAD;EAAK,WAAU;YACZ,EACC,qCACA,0DACD;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
+
{"version":3,"file":"NotificationHistoryPage.js","names":["HISTORY_FILTER","NotificationHistoryPage","tr","useTr","permissionsLoading","usePermissions","useNotification","useNotificationTopics","useNotifications","hasActiveFilters","notificationFilter","hasPermission","NOTIFICATION_PERMISSIONS","currentUser","PagePurpose","History","EmphasisPanel","Button","exportNotificationsAsCsv","notifications","Download","GlassCard","Search","updateFilter","event","topics","topic","NotificationCard","archiveNotification","recordAction","notification","unarchiveNotification","IllustratedEmptyState"],"sources":["../../src/pages/NotificationHistoryPage.tsx"],"sourcesContent":["import { Download, History, Search } from 'lucide-react';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n Button,\n EmphasisPanel,\n GlassCard,\n IllustratedEmptyState,\n PagePurpose,\n} from '@burdenoff/fe-libs/ui';\nimport { NotificationCard } from '../components/NotificationCard';\nimport { useNotifications, useNotificationTopics } from '../hooks';\nimport { NOTIFICATION_PERMISSIONS } from '../constants/permissions';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { useTr } from '../shared/hooks/useTr';\nimport { exportNotificationsAsCsv } from '../utils/notificationHistoryExport';\n\nconst HISTORY_FILTER = { archived: null, channel: 'ALL' as const };\n\n/** User Notification History — personal history, filter, CSV export, archive/unarchive. */\nexport function NotificationHistoryPage() {\n const tr = useTr();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const { currentUser } = useNotification();\n const { topics } = useNotificationTopics({ isActive: true });\n const {\n notifications,\n notificationFilter,\n updateFilter,\n archiveNotification,\n unarchiveNotification,\n recordAction,\n } = useNotifications({ baseFilter: HISTORY_FILTER });\n\n const hasActiveFilters = Boolean(\n notificationFilter.search ||\n notificationFilter.topicId ||\n notificationFilter.dateRange.start ||\n notificationFilter.dateRange.end\n );\n\n if (permissionsLoading) {\n return (\n <div className=\"flex h-64 items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent\" />\n </div>\n );\n }\n\n if (!hasPermission(NOTIFICATION_PERMISSIONS.NOTIFICATION_LIST) && !currentUser?.id) {\n return (\n <div className=\"p-8 text-center text-text-secondary\">\n {tr(\n 'notifications.noPermissionHistory',\n \"You don't have permission to view notification history.\"\n )}\n </div>\n );\n }\n\n return (\n <div className=\"space-y-4 sm:space-y-6 p-3 sm:p-6 animate-in fade-in duration-200\">\n <PagePurpose icon={<History size={16} />}>\n {tr(\n 'notifications.historyPurpose',\n 'A searchable archive of every notification you have ever received, across all channels (in-app, email, push and more). Look back through anything you read or archived, narrow by topic or date range, and export the results to CSV for your own records.'\n )}\n </PagePurpose>\n\n {/* Single emphasis zone — the header summary + the one export CTA. */}\n <EmphasisPanel\n data-tour=\"notification-history-header\"\n className=\"flex flex-col gap-4 p-5 sm:flex-row sm:items-center sm:justify-between sm:p-6\"\n >\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-primary\">\n {tr('notifications.historyTitle', 'Notification History')}\n </h1>\n <p className=\"text-sm text-secondary mt-1\">\n {tr('notifications.historySubtitle', 'View and search all your notifications')}\n </p>\n </div>\n\n <Button\n data-tour=\"notification-history-export\"\n variant=\"outline\"\n onClick={() => exportNotificationsAsCsv(tr, notifications)}\n disabled={notifications.length === 0}\n className=\"gap-2\"\n >\n <Download size={16} />\n {tr('notifications.export', 'Export')}\n </Button>\n </EmphasisPanel>\n\n <GlassCard\n treatment=\"plain\"\n className=\"grid gap-3 border-border-seam p-3 sm:grid-cols-2 sm:p-4 xl:grid-cols-5\"\n >\n <div className=\"relative sm:col-span-2 xl:col-span-2\">\n <Search size={16} className=\"absolute left-3 top-1/2 -translate-y-1/2 text-tertiary\" />\n <input\n type=\"text\"\n placeholder={tr(\n 'notifications.searchByTitleOrContent',\n 'Search by title or content...'\n )}\n value={notificationFilter.search}\n onChange={(e) => updateFilter({ search: e.target.value })}\n className=\"w-full pl-9 pr-4 py-2 text-sm text-primary bg-surface border border-default rounded-lg focus:outline-none focus:ring-2 focus:ring-accent transition-shadow duration-150\"\n />\n </div>\n\n <select\n value={notificationFilter.topicId || ''}\n onChange={(event) => updateFilter({ topicId: event.target.value || undefined })}\n className=\"rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n <option value=\"\">{tr('notifications.allTopics', 'All Topics')}</option>\n {topics.map((topic) => (\n <option key={topic.id} value={topic.id}>\n {topic.name}\n </option>\n ))}\n </select>\n\n <input\n type=\"date\"\n aria-label={tr('notifications.startDate', 'Start date')}\n value={\n notificationFilter.dateRange.start\n ? notificationFilter.dateRange.start.toISOString().split('T')[0]\n : ''\n }\n onChange={(e) =>\n updateFilter({\n dateRange: {\n ...notificationFilter.dateRange,\n start: e.target.value ? new Date(e.target.value) : null,\n },\n })\n }\n className=\"rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary\"\n />\n\n <input\n type=\"date\"\n aria-label={tr('notifications.endDate', 'End date')}\n value={\n notificationFilter.dateRange.end\n ? notificationFilter.dateRange.end.toISOString().split('T')[0]\n : ''\n }\n onChange={(e) =>\n updateFilter({\n dateRange: {\n ...notificationFilter.dateRange,\n end: e.target.value ? new Date(e.target.value) : null,\n },\n })\n }\n className=\"rounded-lg border border-default bg-surface px-3 py-2 text-sm text-primary\"\n />\n </GlassCard>\n\n <div className=\"space-y-2\">\n {notifications.length > 0 ? (\n notifications.map((notification) => (\n <div key={notification.id} className=\"space-y-2\">\n <NotificationCard\n notification={notification}\n onArchive={archiveNotification}\n onAction={recordAction}\n showArchivedState\n analyticsSource=\"history\"\n />\n {notification.archivedAt && (\n <div className=\"flex justify-end\">\n <button\n onClick={() => unarchiveNotification(notification.id)}\n className=\"rounded-md border border-default px-3 py-2 text-xs text-secondary hover:bg-bg-sunken\"\n >\n {tr('notifications.restore', 'Restore')}\n </button>\n </div>\n )}\n </div>\n ))\n ) : (\n <div className=\"animate-in fade-in duration-200\">\n <IllustratedEmptyState\n illustration={hasActiveFilters ? 'empty-search' : 'empty-notifications'}\n title={\n hasActiveFilters\n ? tr('notifications.noNotificationsFound', 'No notifications found')\n : tr('notifications.historyEmptyTitle', 'No history yet')\n }\n description={\n hasActiveFilters\n ? tr('notifications.adjustSearchOrDateRange', 'Try adjusting your filters')\n : tr(\n 'notifications.historyEmptyDescription',\n 'Notifications you receive will be archived here so you can always find them again.'\n )\n }\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,IAAMA,IAAiB;CAAE,UAAU;CAAM,SAAS;AAAe;AAGjE,SAAgBC,IAA0B;CACxC,IAAMC,IAAKC,EAAM,GACX,EAAE,kBAAe,WAAWC,MAAuBC,EAAe,GAClE,EAAE,mBAAgBC,EAAgB,GAClC,EAAE,cAAWC,EAAsB,EAAE,UAAU,GAAK,CAAC,GACrD,EACJ,kBACA,uBACA,iBACA,wBACA,0BACA,oBACEC,EAAiB,EAAE,YAAYR,EAAe,CAAC,GAE7CS,IAAmB,GACvBC,EAAmB,UACnBA,EAAmB,WACnBA,EAAmB,UAAU,SAC7BA,EAAmB,UAAU;CAsB/B,OAnBIN,IAEA,kBAAC,OAAD;EAAK,WAAU;EACb,UAAA,kBAAC,OAAD,EAAK,WAAU,iFAAkF,CAAA;CAC9F,CAAA,IAIL,CAACO,EAAcC,EAAyB,iBAAiB,KAAK,CAACC,GAAa,KAE5E,kBAAC,OAAD;EAAK,WAAU;EACZ,UAAAX,EACC,qCACA,yDACF;CACG,CAAA,IAKP,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,kBAACY,GAAD;IAAa,MAAM,kBAACC,GAAD,EAAS,MAAM,GAAK,CAAA;IACpC,UAAAb,EACC,gCACA,4PACF;GACW,CAAA;GAGb,kBAACc,GAAD;IACE,aAAU;IACV,WAAU;IAFZ,UAAA,CAIE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;KAAI,WAAU;KACX,UAAAd,EAAG,8BAA8B,sBAAsB;IACtD,CAAA,GACJ,kBAAC,KAAD;KAAG,WAAU;KACV,UA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I;MACrD,EACF,CAAC;MAEH,WAAU;KACX,CAAA;KAED,kBAAC,SAAD;MACE,MAAK;MACL,cAAYR,EAAG,yBAAyB,UAAU;MAClD,OACEQ,EAAmB,UAAU,MACzBA,EAAmB,UAAU,IAAI,YAAY,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAC1D;MAEN,WAAW,MACTa,EAAa,EACX,WAAW;OACT,GAAGb,EAAmB;OACtB,KAAK,EAAE,OAAO,QAAQ,IAAI,KAAK,EAAE,OAAO,KAAK,IAAI;MACnD,EACF,CAAC;MAEH,WAAU;KACX,CAAA;IACQ;;GAEX,kBAAC,OAAD;IAAK,WAAU;IACZ,UAAAS,EAAc,SAAS,IACtBA,EAAc,KAAK,MACjB,kBAAC,OAAD;KAA2B,WAAU;KAArC,UAAA,CACE,kBAACQ,GAAD;MACgB;MACd,WAAWC;MACX,UAAUC;MACV,mBAAA;MACA,iBAAgB;KACjB,CAAA,GACAC,EAAa,cACZ,kBAAC,OAAD;MAAK,WAAU;MACb,UAAA,kBAAC,UAAD;OACE,eAAeC,EAAsBD,EAAa,EAAE;OACpD,WAAU;OAET,UAAA5B,EAAG,yBAAyB,SAAS;MAChC,CAAA;KACL,CAAA,CAEJ;IAlBK,GAAA4B,EAAa,EAkBlB,CACN,IAED,kBAAC,OAAD;KAAK,WAAU;KACb,UAAA,kBAACE,GAAD;MACE,cAAcvB,IAAmB,iBAAiB;MAClD,OACEA,IACIP,EAAG,sCAAsC,wBAAwB,IACjEA,EAAG,mCAAmC,gBAAgB;MAE5D,aACEO,IACIP,EAAG,yCAAyC,4BAA4B,IACxEA,EACE,yCACA,oFACF;KAEP,CAAA;IACE,CAAA;GAEJ,CAAA;EACF;;AAET"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tabbed landing page for the Notification microfrontend.
|
|
3
|
+
*
|
|
4
|
+
* Admin-only tabs (Send, History, Templates, Topics) are gated by the
|
|
5
|
+
* notification.* feature flags. Gating is applied here because this
|
|
6
|
+
* page bypasses the route-level flag gates in AdminNotificationRoutes:
|
|
7
|
+
* without this check an admin landing on /notifications could click
|
|
8
|
+
* into any tab regardless of flag state.
|
|
9
|
+
*/
|
|
10
|
+
export declare function NotificationLandingPage(): import('react').JSX.Element;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { NotificationCenterPage as e } from "./NotificationCenterPage.js";
|
|
2
|
+
import { useTr as t } from "../shared/hooks/useTr.js";
|
|
3
3
|
import { Suspense as n, lazy as r, useEffect as i, useMemo as a } from "react";
|
|
4
4
|
import { useFeatureFlagDetails as o } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
5
5
|
import { useSearchParams as s } from "react-router";
|
|
6
6
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
7
|
import { Tabs as u } from "@burdenoff/fe-libs/chrome";
|
|
8
|
-
|
|
8
|
+
// src/pages/NotificationLandingPage.tsx
|
|
9
9
|
var d = r(() => import("./NotificationHistoryAdminPage.js").then((e) => ({ default: e.NotificationHistoryAdminPage }))), f = r(() => import("./NotificationTemplatesPage.js").then((e) => ({ default: e.NotificationTemplatesPage }))), p = r(() => import("./CreateNotificationPage.js").then((e) => ({ default: e.CreateNotificationPage }))), m = r(() => import("./NotificationTopicsPage.js").then((e) => ({ default: e.NotificationTopicsPage })));
|
|
10
10
|
function h() {
|
|
11
11
|
return /* @__PURE__ */ c("div", {
|
|
@@ -14,7 +14,7 @@ function h() {
|
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
function g() {
|
|
17
|
-
let [r, g] = s(), _ =
|
|
17
|
+
let [r, g] = s(), _ = t(), v = o("notification.templates"), y = o("notification.create"), b = o("notification.history"), x = v ? !!v.value : !1, S = y ? !!y.value : !1, C = b ? !!b.value : !1, w = a(() => [
|
|
18
18
|
{
|
|
19
19
|
id: "inbox",
|
|
20
20
|
label: _("notification.landing.tabs.inbox", "Inbox")
|
|
@@ -67,7 +67,7 @@ function g() {
|
|
|
67
67
|
})
|
|
68
68
|
}), /* @__PURE__ */ l("div", {
|
|
69
69
|
className: "flex-1 min-h-0 overflow-auto",
|
|
70
|
-
children: [E === "inbox" && /* @__PURE__ */ c(
|
|
70
|
+
children: [E === "inbox" && /* @__PURE__ */ c(e, {}), /* @__PURE__ */ l(n, {
|
|
71
71
|
fallback: /* @__PURE__ */ c(h, {}),
|
|
72
72
|
children: [
|
|
73
73
|
E === "send" && S && /* @__PURE__ */ c(p, {}),
|
|
@@ -79,7 +79,6 @@ function g() {
|
|
|
79
79
|
})]
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
-
//#endregion
|
|
83
82
|
export { g as NotificationLandingPage };
|
|
84
83
|
|
|
85
84
|
//# sourceMappingURL=NotificationLandingPage.js.map
|