@burdenoff/microfe-notification 2026.1109.1 → 2026.1114.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NotificationRoutes.js +108 -36
- package/dist/NotificationRoutes.js.map +1 -1
- package/dist/components/ConfirmDeleteDialog.d.ts +17 -0
- package/dist/components/ConfirmDeleteDialog.js +22 -0
- package/dist/components/ConfirmDeleteDialog.js.map +1 -0
- package/dist/components/NotificationCard.d.ts +10 -1
- package/dist/components/NotificationCard.js +103 -72
- package/dist/components/NotificationCard.js.map +1 -1
- package/dist/hooks/index.js +5 -5
- package/dist/hooks/usePreferenceToggles.d.ts +27 -0
- package/dist/hooks/usePreferenceToggles.js +84 -0
- package/dist/hooks/usePreferenceToggles.js.map +1 -0
- package/dist/navigation-v2/AdminPageV2.d.ts +14 -0
- package/dist/navigation-v2/AdminPageV2.js +51 -0
- package/dist/navigation-v2/AdminPageV2.js.map +1 -0
- package/dist/navigation-v2/AdminToolsMenu.d.ts +6 -0
- package/dist/navigation-v2/AdminToolsMenu.js +32 -0
- package/dist/navigation-v2/AdminToolsMenu.js.map +1 -0
- package/dist/navigation-v2/BackToNotifications.d.ts +2 -0
- package/dist/navigation-v2/BackToNotifications.js +20 -0
- package/dist/navigation-v2/BackToNotifications.js.map +1 -0
- package/dist/navigation-v2/FilterControls.d.ts +25 -0
- package/dist/navigation-v2/FilterControls.js +64 -0
- package/dist/navigation-v2/FilterControls.js.map +1 -0
- package/dist/navigation-v2/NotificationArchivedV2.d.ts +9 -0
- package/dist/navigation-v2/NotificationArchivedV2.js +174 -0
- package/dist/navigation-v2/NotificationArchivedV2.js.map +1 -0
- package/dist/navigation-v2/NotificationInboxV2.d.ts +9 -0
- package/dist/navigation-v2/NotificationInboxV2.js +309 -0
- package/dist/navigation-v2/NotificationInboxV2.js.map +1 -0
- package/dist/navigation-v2/NotificationSettingsV2.d.ts +9 -0
- package/dist/navigation-v2/NotificationSettingsV2.js +203 -0
- package/dist/navigation-v2/NotificationSettingsV2.js.map +1 -0
- package/dist/navigation-v2/NotificationsV2Landing.d.ts +9 -0
- package/dist/navigation-v2/NotificationsV2Landing.js +37 -0
- package/dist/navigation-v2/NotificationsV2Landing.js.map +1 -0
- package/dist/navigation-v2/__tests__/uiMocks.d.ts +71 -0
- package/dist/navigation-v2/inboxFilters.d.ts +8 -0
- package/dist/navigation-v2/inboxFilters.js +10 -0
- package/dist/navigation-v2/inboxFilters.js.map +1 -0
- package/dist/navigation-v2/paths.d.ts +24 -0
- package/dist/navigation-v2/paths.js +31 -0
- package/dist/navigation-v2/paths.js.map +1 -0
- package/dist/navigation-v2/settingsOptions.d.ts +12 -0
- package/dist/navigation-v2/settingsOptions.js +58 -0
- package/dist/navigation-v2/settingsOptions.js.map +1 -0
- package/dist/navigation-v2/useAdminTools.d.ts +22 -0
- package/dist/navigation-v2/useAdminTools.js +76 -0
- package/dist/navigation-v2/useAdminTools.js.map +1 -0
- package/dist/pages/CreateNotificationPage.js +577 -558
- package/dist/pages/CreateNotificationPage.js.map +1 -1
- package/dist/pages/NotificationCenterPage.d.ts +3 -1
- package/dist/pages/NotificationCenterPage.js +79 -74
- package/dist/pages/NotificationCenterPage.js.map +1 -1
- package/dist/pages/NotificationHistoryPage.d.ts +5 -1
- package/dist/pages/NotificationHistoryPage.js +52 -47
- package/dist/pages/NotificationHistoryPage.js.map +1 -1
- package/dist/pages/NotificationPreferencesPage.d.ts +4 -0
- package/dist/pages/NotificationPreferencesPage.js +97 -158
- package/dist/pages/NotificationPreferencesPage.js.map +1 -1
- package/dist/pages/NotificationTemplatesPage.js +184 -166
- package/dist/pages/NotificationTemplatesPage.js.map +1 -1
- package/dist/pages/NotificationTopicsPage.js +123 -108
- package/dist/pages/NotificationTopicsPage.js.map +1 -1
- package/dist/pages/TemplateEditorPage.js +339 -308
- package/dist/pages/TemplateEditorPage.js.map +1 -1
- package/dist/providers/NotificationProvider.js +6 -5
- package/dist/providers/NotificationProvider.js.map +1 -1
- package/dist/types/index.d.ts +8 -0
- package/package.json +2 -2
|
@@ -1,72 +1,144 @@
|
|
|
1
1
|
import { useNotification as e } from "./providers/NotificationProvider.js";
|
|
2
2
|
import { NotificationCenterPage as t } from "./pages/NotificationCenterPage.js";
|
|
3
3
|
import { NotificationLandingPage as n } from "./pages/NotificationLandingPage.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { AdminPageV2 as r } from "./navigation-v2/AdminPageV2.js";
|
|
5
|
+
import { NotificationsV2Landing as i } from "./navigation-v2/NotificationsV2Landing.js";
|
|
6
|
+
import { Suspense as a, lazy as o } from "react";
|
|
7
|
+
import { Navigate as s, Route as c, Routes as l } from "react-router";
|
|
8
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
7
9
|
// src/NotificationRoutes.tsx
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
var f = o(() => import("./pages/NotificationHistoryPage.js").then((e) => ({ default: e.NotificationHistoryPage }))), p = o(() => import("./pages/NotificationTemplatesPage.js").then((e) => ({ default: e.NotificationTemplatesPage }))), m = o(() => import("./pages/TemplateEditorPage.js").then((e) => ({ default: e.TemplateEditorPage }))), h = o(() => import("./pages/CreateNotificationPage.js").then((e) => ({ default: e.CreateNotificationPage }))), g = o(() => import("./pages/NotificationTopicsPage.js").then((e) => ({ default: e.NotificationTopicsPage }))), _ = o(() => import("./pages/NotificationPreferencesPage.js").then((e) => ({ default: e.NotificationPreferencesPage })));
|
|
11
|
+
function v() {
|
|
12
|
+
return /* @__PURE__ */ u("div", {
|
|
11
13
|
className: "flex h-64 items-center justify-center",
|
|
12
|
-
children: /* @__PURE__ */
|
|
14
|
+
children: /* @__PURE__ */ u("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
13
15
|
});
|
|
14
16
|
}
|
|
15
|
-
function
|
|
16
|
-
let { basePath:
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
fallback: /* @__PURE__ */
|
|
19
|
-
children: /* @__PURE__ */ l
|
|
20
|
-
/* @__PURE__ */ c
|
|
17
|
+
function y() {
|
|
18
|
+
let { basePath: r = "/", navigationV2: i } = e(), o = `${r.endsWith("/") ? r.slice(0, -1) : r}/center`;
|
|
19
|
+
return i ? /* @__PURE__ */ u(b, { centerPath: o }) : /* @__PURE__ */ u(a, {
|
|
20
|
+
fallback: /* @__PURE__ */ u(v, {}),
|
|
21
|
+
children: /* @__PURE__ */ d(l, { children: [
|
|
22
|
+
/* @__PURE__ */ u(c, {
|
|
21
23
|
index: !0,
|
|
22
|
-
element: /* @__PURE__ */
|
|
24
|
+
element: /* @__PURE__ */ u(n, {})
|
|
23
25
|
}),
|
|
24
|
-
/* @__PURE__ */ c
|
|
26
|
+
/* @__PURE__ */ u(c, {
|
|
25
27
|
path: "list",
|
|
26
|
-
element: /* @__PURE__ */
|
|
28
|
+
element: /* @__PURE__ */ u(t, {})
|
|
27
29
|
}),
|
|
28
|
-
/* @__PURE__ */ c
|
|
30
|
+
/* @__PURE__ */ u(c, {
|
|
29
31
|
path: "center",
|
|
30
|
-
element: /* @__PURE__ */
|
|
32
|
+
element: /* @__PURE__ */ u(t, {})
|
|
31
33
|
}),
|
|
32
|
-
/* @__PURE__ */ c
|
|
34
|
+
/* @__PURE__ */ u(c, {
|
|
33
35
|
path: "history",
|
|
34
|
-
element: /* @__PURE__ */
|
|
36
|
+
element: /* @__PURE__ */ u(f, {})
|
|
35
37
|
}),
|
|
36
|
-
/* @__PURE__ */ c
|
|
38
|
+
/* @__PURE__ */ u(c, {
|
|
37
39
|
path: "templates",
|
|
38
|
-
element: /* @__PURE__ */
|
|
40
|
+
element: /* @__PURE__ */ u(p, {})
|
|
39
41
|
}),
|
|
40
|
-
/* @__PURE__ */ c
|
|
42
|
+
/* @__PURE__ */ u(c, {
|
|
41
43
|
path: "templates/new",
|
|
42
|
-
element: /* @__PURE__ */
|
|
44
|
+
element: /* @__PURE__ */ u(m, {})
|
|
43
45
|
}),
|
|
44
|
-
/* @__PURE__ */ c
|
|
46
|
+
/* @__PURE__ */ u(c, {
|
|
45
47
|
path: "templates/:templateId",
|
|
46
|
-
element: /* @__PURE__ */
|
|
48
|
+
element: /* @__PURE__ */ u(m, {})
|
|
47
49
|
}),
|
|
48
|
-
/* @__PURE__ */ c
|
|
50
|
+
/* @__PURE__ */ u(c, {
|
|
49
51
|
path: "create",
|
|
50
|
-
element: /* @__PURE__ */
|
|
52
|
+
element: /* @__PURE__ */ u(h, {})
|
|
51
53
|
}),
|
|
52
|
-
/* @__PURE__ */ c
|
|
54
|
+
/* @__PURE__ */ u(c, {
|
|
53
55
|
path: "topics",
|
|
54
|
-
element: /* @__PURE__ */
|
|
56
|
+
element: /* @__PURE__ */ u(g, {})
|
|
55
57
|
}),
|
|
56
|
-
/* @__PURE__ */ c
|
|
58
|
+
/* @__PURE__ */ u(c, {
|
|
57
59
|
path: "preferences",
|
|
58
|
-
element: /* @__PURE__ */
|
|
60
|
+
element: /* @__PURE__ */ u(_, {})
|
|
59
61
|
}),
|
|
60
|
-
/* @__PURE__ */ c
|
|
62
|
+
/* @__PURE__ */ u(c, {
|
|
61
63
|
path: "*",
|
|
62
|
-
element: /* @__PURE__ */
|
|
63
|
-
to:
|
|
64
|
+
element: /* @__PURE__ */ u(s, {
|
|
65
|
+
to: o,
|
|
64
66
|
replace: !0
|
|
65
67
|
})
|
|
66
68
|
})
|
|
67
69
|
] })
|
|
68
70
|
});
|
|
69
71
|
}
|
|
70
|
-
|
|
72
|
+
function b({ centerPath: e }) {
|
|
73
|
+
return /* @__PURE__ */ u(a, {
|
|
74
|
+
fallback: /* @__PURE__ */ u(v, {}),
|
|
75
|
+
children: /* @__PURE__ */ d(l, { children: [
|
|
76
|
+
/* @__PURE__ */ u(c, {
|
|
77
|
+
index: !0,
|
|
78
|
+
element: /* @__PURE__ */ u(i, {})
|
|
79
|
+
}),
|
|
80
|
+
/* @__PURE__ */ u(c, {
|
|
81
|
+
path: "list",
|
|
82
|
+
element: /* @__PURE__ */ u(t, {})
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ u(c, {
|
|
85
|
+
path: "center",
|
|
86
|
+
element: /* @__PURE__ */ u(t, {})
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ u(c, {
|
|
89
|
+
path: "history",
|
|
90
|
+
element: /* @__PURE__ */ u(f, {})
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ u(c, {
|
|
93
|
+
path: "preferences",
|
|
94
|
+
element: /* @__PURE__ */ u(_, {})
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ u(c, {
|
|
97
|
+
path: "templates",
|
|
98
|
+
element: /* @__PURE__ */ u(r, {
|
|
99
|
+
tool: "templates",
|
|
100
|
+
children: /* @__PURE__ */ u(p, {})
|
|
101
|
+
})
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ u(c, {
|
|
104
|
+
path: "templates/new",
|
|
105
|
+
element: /* @__PURE__ */ u(r, {
|
|
106
|
+
tool: "templates",
|
|
107
|
+
children: /* @__PURE__ */ u(m, {})
|
|
108
|
+
})
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ u(c, {
|
|
111
|
+
path: "templates/:templateId",
|
|
112
|
+
element: /* @__PURE__ */ u(r, {
|
|
113
|
+
tool: "templates",
|
|
114
|
+
children: /* @__PURE__ */ u(m, {})
|
|
115
|
+
})
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ u(c, {
|
|
118
|
+
path: "create",
|
|
119
|
+
element: /* @__PURE__ */ u(r, {
|
|
120
|
+
tool: "send",
|
|
121
|
+
back: !1,
|
|
122
|
+
children: /* @__PURE__ */ u(h, {})
|
|
123
|
+
})
|
|
124
|
+
}),
|
|
125
|
+
/* @__PURE__ */ u(c, {
|
|
126
|
+
path: "topics",
|
|
127
|
+
element: /* @__PURE__ */ u(r, {
|
|
128
|
+
tool: "topics",
|
|
129
|
+
children: /* @__PURE__ */ u(g, {})
|
|
130
|
+
})
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ u(c, {
|
|
133
|
+
path: "*",
|
|
134
|
+
element: /* @__PURE__ */ u(s, {
|
|
135
|
+
to: e,
|
|
136
|
+
replace: !0
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
] })
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
export { y as NotificationRoutes };
|
|
71
143
|
|
|
72
144
|
//# sourceMappingURL=NotificationRoutes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationRoutes.js","names":["NotificationHistoryPage","lazy","m","NotificationTemplatesPage","TemplateEditorPage","CreateNotificationPage","NotificationTopicsPage","NotificationPreferencesPage","PageLoader","NotificationRoutes","useNotification","centerPath","basePath","Suspense","Routes","Route","NotificationLandingPage","NotificationCenterPage","Navigate"],"sources":["../src/NotificationRoutes.tsx"],"sourcesContent":["import { lazy, Suspense } from 'react';\nimport { Navigate, Route, Routes } from 'react-router';\nimport { useNotification } from './providers/NotificationProvider';\n\n// Eager load - Primary landing page\nimport { NotificationCenterPage } from './pages/NotificationCenterPage';\nimport { NotificationLandingPage } from './pages/NotificationLandingPage';\n\n// Lazy load - Secondary pages\nconst NotificationHistoryPage = lazy(() =>\n import('./pages/NotificationHistoryPage').then((m) => ({\n default: m.NotificationHistoryPage,\n }))\n);\nconst NotificationTemplatesPage = lazy(() =>\n import('./pages/NotificationTemplatesPage').then((m) => ({\n default: m.NotificationTemplatesPage,\n }))\n);\nconst TemplateEditorPage = lazy(() =>\n import('./pages/TemplateEditorPage').then((m) => ({ default: m.TemplateEditorPage }))\n);\nconst CreateNotificationPage = lazy(() =>\n import('./pages/CreateNotificationPage').then((m) => ({ default: m.CreateNotificationPage }))\n);\nconst NotificationTopicsPage = lazy(() =>\n import('./pages/NotificationTopicsPage').then((m) => ({ default: m.NotificationTopicsPage }))\n);\nconst NotificationPreferencesPage = lazy(() =>\n import('./pages/NotificationPreferencesPage').then((m) => ({\n default: m.NotificationPreferencesPage,\n }))\n);\n\n// Loading fallback component\nfunction PageLoader() {\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/**\n * Internal router for the Notification microfrontend.\n * This component handles routing within the microfrontend using React Router v7.\n *\n * Routes:\n * - / → Notification landing page\n * - /list → Notification center (canonical list alias used by shell nav homePath)\n * - /center → Notification center (in-app notifications)\n * - /history → Notification history and archive\n * - /templates → Notification templates list (admin)\n * - /templates/new → Create new template (admin)\n * - /templates/:templateId → Edit template (admin)\n * - /create → Create and send notification (admin)\n * - /topics → Manage topics (admin)\n * - /preferences → User topic preferences\n * - unmatched → Absolute redirect to /{basePath}/center (avoids relative redirect loops)\n */\nexport function NotificationRoutes() {\n const { basePath = '/' } = useNotification();\n const centerPath = `${basePath.endsWith('/') ? basePath.slice(0, -1) : basePath}/center`;\n\n return (\n <Suspense fallback={<PageLoader />}>\n <Routes>\n {/* Tabbed landing - default route */}\n <Route index element={<NotificationLandingPage />} />\n\n {/* Canonical list alias used by product-shell nav homePath */}\n <Route path=\"list\" element={<NotificationCenterPage />} />\n\n {/* User-facing routes (all users) */}\n <Route path=\"center\" element={<NotificationCenterPage />} />\n <Route path=\"history\" element={<NotificationHistoryPage />} />\n\n {/* Admin routes - Templates */}\n <Route path=\"templates\" element={<NotificationTemplatesPage />} />\n <Route path=\"templates/new\" element={<TemplateEditorPage />} />\n <Route path=\"templates/:templateId\" element={<TemplateEditorPage />} />\n\n {/* Admin routes - Create/Send Notification */}\n <Route path=\"create\" element={<CreateNotificationPage />} />\n <Route path=\"topics\" element={<NotificationTopicsPage />} />\n <Route path=\"preferences\" element={<NotificationPreferencesPage />} />\n\n {/* Catch-all route - absolute redirect so an unmatched path like /list\n cannot recursively append /center (e.g. /list/center/center/...) */}\n <Route path=\"*\" element={<Navigate to={centerPath} replace />} />\n </Routes>\n </Suspense>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"NotificationRoutes.js","names":["NotificationHistoryPage","lazy","m","NotificationTemplatesPage","TemplateEditorPage","CreateNotificationPage","NotificationTopicsPage","NotificationPreferencesPage","PageLoader","NotificationRoutes","useNotification","centerPath","basePath","navigationV2","NavigationV2Routes","Suspense","Routes","Route","NotificationLandingPage","NotificationCenterPage","Navigate","NotificationsV2Landing","AdminPageV2"],"sources":["../src/NotificationRoutes.tsx"],"sourcesContent":["import { lazy, Suspense } from 'react';\nimport { Navigate, Route, Routes } from 'react-router';\nimport { useNotification } from './providers/NotificationProvider';\n\n// Eager load - Primary landing page\nimport { NotificationCenterPage } from './pages/NotificationCenterPage';\nimport { NotificationLandingPage } from './pages/NotificationLandingPage';\nimport { AdminPageV2 } from './navigation-v2/AdminPageV2';\nimport { NotificationsV2Landing } from './navigation-v2/NotificationsV2Landing';\n\n// Lazy load - Secondary pages\nconst NotificationHistoryPage = lazy(() =>\n import('./pages/NotificationHistoryPage').then((m) => ({\n default: m.NotificationHistoryPage,\n }))\n);\nconst NotificationTemplatesPage = lazy(() =>\n import('./pages/NotificationTemplatesPage').then((m) => ({\n default: m.NotificationTemplatesPage,\n }))\n);\nconst TemplateEditorPage = lazy(() =>\n import('./pages/TemplateEditorPage').then((m) => ({ default: m.TemplateEditorPage }))\n);\nconst CreateNotificationPage = lazy(() =>\n import('./pages/CreateNotificationPage').then((m) => ({ default: m.CreateNotificationPage }))\n);\nconst NotificationTopicsPage = lazy(() =>\n import('./pages/NotificationTopicsPage').then((m) => ({ default: m.NotificationTopicsPage }))\n);\nconst NotificationPreferencesPage = lazy(() =>\n import('./pages/NotificationPreferencesPage').then((m) => ({\n default: m.NotificationPreferencesPage,\n }))\n);\n\n// Loading fallback component\nfunction PageLoader() {\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/**\n * Internal router for the Notification microfrontend.\n * This component handles routing within the microfrontend using React Router v7.\n *\n * Routes:\n * - / → Notification landing page\n * - /list → Notification center (canonical list alias used by shell nav homePath)\n * - /center → Notification center (in-app notifications)\n * - /history → Notification history and archive\n * - /templates → Notification templates list (admin)\n * - /templates/new → Create new template (admin)\n * - /templates/:templateId → Edit template (admin)\n * - /create → Create and send notification (admin)\n * - /topics → Manage topics (admin)\n * - /preferences → User topic preferences\n * - unmatched → Absolute redirect to /{basePath}/center (avoids relative redirect loops)\n */\nexport function NotificationRoutes() {\n const { basePath = '/', navigationV2 } = useNotification();\n const centerPath = `${basePath.endsWith('/') ? basePath.slice(0, -1) : basePath}/center`;\n\n if (navigationV2) return <NavigationV2Routes centerPath={centerPath} />;\n\n return (\n <Suspense fallback={<PageLoader />}>\n <Routes>\n {/* Tabbed landing - default route */}\n <Route index element={<NotificationLandingPage />} />\n\n {/* Canonical list alias used by product-shell nav homePath */}\n <Route path=\"list\" element={<NotificationCenterPage />} />\n\n {/* User-facing routes (all users) */}\n <Route path=\"center\" element={<NotificationCenterPage />} />\n <Route path=\"history\" element={<NotificationHistoryPage />} />\n\n {/* Admin routes - Templates */}\n <Route path=\"templates\" element={<NotificationTemplatesPage />} />\n <Route path=\"templates/new\" element={<TemplateEditorPage />} />\n <Route path=\"templates/:templateId\" element={<TemplateEditorPage />} />\n\n {/* Admin routes - Create/Send Notification */}\n <Route path=\"create\" element={<CreateNotificationPage />} />\n <Route path=\"topics\" element={<NotificationTopicsPage />} />\n <Route path=\"preferences\" element={<NotificationPreferencesPage />} />\n\n {/* Catch-all route - absolute redirect so an unmatched path like /list\n cannot recursively append /center (e.g. /list/center/center/...) */}\n <Route path=\"*\" element={<Navigate to={centerPath} replace />} />\n </Routes>\n </Suspense>\n );\n}\n\n/**\n * FluidGrids' Navigation v2 routes (BOFF-11872). Every URL of the classic\n * routes keeps working: `/` opens straight on the inbox (old `?tab=` values\n * still open their page), and the admin pages get a route-level permission\n * gate and a way back to the inbox.\n */\nfunction NavigationV2Routes({ centerPath }: { centerPath: string }) {\n return (\n <Suspense fallback={<PageLoader />}>\n <Routes>\n <Route index element={<NotificationsV2Landing />} />\n <Route path=\"list\" element={<NotificationCenterPage />} />\n <Route path=\"center\" element={<NotificationCenterPage />} />\n <Route path=\"history\" element={<NotificationHistoryPage />} />\n <Route path=\"preferences\" element={<NotificationPreferencesPage />} />\n <Route\n path=\"templates\"\n element={\n <AdminPageV2 tool=\"templates\">\n <NotificationTemplatesPage />\n </AdminPageV2>\n }\n />\n <Route\n path=\"templates/new\"\n element={\n <AdminPageV2 tool=\"templates\">\n <TemplateEditorPage />\n </AdminPageV2>\n }\n />\n <Route\n path=\"templates/:templateId\"\n element={\n <AdminPageV2 tool=\"templates\">\n <TemplateEditorPage />\n </AdminPageV2>\n }\n />\n <Route\n path=\"create\"\n element={\n <AdminPageV2 tool=\"send\" back={false}>\n <CreateNotificationPage />\n </AdminPageV2>\n }\n />\n <Route\n path=\"topics\"\n element={\n <AdminPageV2 tool=\"topics\">\n <NotificationTopicsPage />\n </AdminPageV2>\n }\n />\n <Route path=\"*\" element={<Navigate to={centerPath} replace />} />\n </Routes>\n </Suspense>\n );\n}\n"],"mappings":";;;;;;;;;AAWA,IAAMA,IAA0BC,QAC9B,OAAO,qCAAkC,CAAC,MAAM,OAAO,EACrD,SAASC,EAAE,wBACb,EAAE,CACJ,GACMC,IAA4BF,QAChC,OAAO,uCAAoC,CAAC,MAAM,OAAO,EACvD,SAASC,EAAE,0BACb,EAAE,CACJ,GACME,IAAqBH,QACzB,OAAO,gCAA6B,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,mBAAmB,EAAE,CACtF,GACMG,IAAyBJ,QAC7B,OAAO,oCAAiC,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,uBAAuB,EAAE,CAC9F,GACMI,IAAyBL,QAC7B,OAAO,oCAAiC,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,uBAAuB,EAAE,CAC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SACE,kBAACK,GAAD;KAAa,MAAK;KAAO,MAAM;KAC7B,UAAA,kBAACjB,GAAD,CAAyB,CAAA;IACd,CAAA;GAEhB,CAAA;GACD,kBAACY,GAAD;IACE,MAAK;IACL,SACE,kBAACK,GAAD;KAAa,MAAK;KAChB,UAAA,kBAAChB,GAAD,CAAyB,CAAA;IACd,CAAA;GAEhB,CAAA;GACD,kBAACW,GAAD;IAAO,MAAK;IAAI,SAAS,kBAACG,GAAD;KAAU,IAAIT;KAAY,SAAA;IAAS,CAAA;GAAI,CAAA;EAC1D,EAAA,CAAA;CACA,CAAA;AAEd"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ConfirmDeleteDialogProps {
|
|
2
|
+
/** Open while a delete waits for an answer. */
|
|
3
|
+
open: boolean;
|
|
4
|
+
/** Already translated, naming the item: "Delete topic". */
|
|
5
|
+
title: string;
|
|
6
|
+
/** Already translated, naming the item and the effect. */
|
|
7
|
+
description: string;
|
|
8
|
+
confirmLabel?: string;
|
|
9
|
+
onConfirm: () => void;
|
|
10
|
+
onCancel: () => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The confirmation before a destructive action (BOFF-11872): it names the
|
|
14
|
+
* item and what happens. Built on the fe-libs AlertDialog, so focus starts on
|
|
15
|
+
* Cancel and Escape cancels.
|
|
16
|
+
*/
|
|
17
|
+
export declare function ConfirmDeleteDialog({ open, title, description, confirmLabel, onConfirm, onCancel, }: ConfirmDeleteDialogProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useTr as e } from "../shared/hooks/useTr.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import { AlertDialog as r, AlertDialogAction as i, AlertDialogCancel as a, AlertDialogContent as o, AlertDialogDescription as s, AlertDialogFooter as c, AlertDialogHeader as l, AlertDialogTitle as u } from "@burdenoff/fe-libs/ui";
|
|
4
|
+
// src/components/ConfirmDeleteDialog.tsx
|
|
5
|
+
function d({ open: d, title: f, description: p, confirmLabel: m, onConfirm: h, onCancel: g }) {
|
|
6
|
+
let _ = e();
|
|
7
|
+
return /* @__PURE__ */ t(r, {
|
|
8
|
+
open: d,
|
|
9
|
+
onOpenChange: (e) => !e && g(),
|
|
10
|
+
children: /* @__PURE__ */ n(o, { children: [/* @__PURE__ */ n(l, { children: [/* @__PURE__ */ t(u, { children: f }), /* @__PURE__ */ t(s, { children: p })] }), /* @__PURE__ */ n(c, { children: [/* @__PURE__ */ t(a, {
|
|
11
|
+
onClick: g,
|
|
12
|
+
children: _("notifications.cancel", "Cancel")
|
|
13
|
+
}), /* @__PURE__ */ t(i, {
|
|
14
|
+
onClick: h,
|
|
15
|
+
className: "bg-action-danger-bg text-action-danger-text hover:bg-action-danger-bgHover",
|
|
16
|
+
children: m ?? _("notifications.delete", "Delete")
|
|
17
|
+
})] })] })
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export { d as ConfirmDeleteDialog };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=ConfirmDeleteDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmDeleteDialog.js","names":["ConfirmDeleteDialog","tr","useTr","AlertDialog","next","onCancel","AlertDialogContent","AlertDialogHeader","AlertDialogTitle","title","AlertDialogDescription","description","AlertDialogFooter","AlertDialogCancel","AlertDialogAction","onConfirm","confirmLabel"],"sources":["../../src/components/ConfirmDeleteDialog.tsx"],"sourcesContent":["import {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from '@burdenoff/fe-libs/ui';\nimport { useTr } from '../shared/hooks/useTr';\n\nexport interface ConfirmDeleteDialogProps {\n /** Open while a delete waits for an answer. */\n open: boolean;\n /** Already translated, naming the item: \"Delete topic\". */\n title: string;\n /** Already translated, naming the item and the effect. */\n description: string;\n confirmLabel?: string;\n onConfirm: () => void;\n onCancel: () => void;\n}\n\n/**\n * The confirmation before a destructive action (BOFF-11872): it names the\n * item and what happens. Built on the fe-libs AlertDialog, so focus starts on\n * Cancel and Escape cancels.\n */\nexport function ConfirmDeleteDialog({\n open,\n title,\n description,\n confirmLabel,\n onConfirm,\n onCancel,\n}: ConfirmDeleteDialogProps) {\n const tr = useTr();\n return (\n <AlertDialog open={open} onOpenChange={(next) => !next && onCancel()}>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>{title}</AlertDialogTitle>\n <AlertDialogDescription>{description}</AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel onClick={onCancel}>\n {tr('notifications.cancel', 'Cancel')}\n </AlertDialogCancel>\n <AlertDialogAction\n onClick={onConfirm}\n className=\"bg-action-danger-bg text-action-danger-text hover:bg-action-danger-bgHover\"\n >\n {confirmLabel ?? tr('notifications.delete', 'Delete')}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n );\n}\n"],"mappings":";;;;AA6BA,SAAgBA,EAAoB,EAClC,SACA,UACA,gBACA,iBACA,cACA,eAC2B;CAC3B,IAAMC,IAAKC,EAAM;CACjB,OACE,kBAACC,GAAD;EAAmB;EAAM,eAAe,MAAS,CAACC,KAAQC,EAAS;EACjE,UAAA,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD,EAAA,UAAmBC,EAAwB,CAAA,GAC3C,kBAACC,GAAD,EAAA,UAAyBC,EAAoC,CAAA,CAC5C,EAAA,CAAA,GACnB,kBAACC,GAAD,EAAA,UAAA,CACE,kBAACC,GAAD;GAAmB,SAASR;GACzB,UAAAJ,EAAG,wBAAwB,QAAQ;EACnB,CAAA,GACnB,kBAACa,GAAD;GACE,SAASC;GACT,WAAU;GAET,UAAAC,KAAgBf,EAAG,wBAAwB,QAAQ;EACnC,CAAA,CACF,EAAA,CAAA,CACD,EAAA,CAAA;CACT,CAAA;AAEjB"}
|
|
@@ -8,11 +8,20 @@ interface NotificationCardProps {
|
|
|
8
8
|
showArchivedState?: boolean;
|
|
9
9
|
compact?: boolean;
|
|
10
10
|
analyticsSource?: 'center' | 'panel' | 'history' | 'admin_history';
|
|
11
|
+
/**
|
|
12
|
+
* FluidGrids' Navigation v2 card (BOFF-11872): an archive icon with an
|
|
13
|
+
* "Archive" tooltip instead of "X", the priority footer only for Urgent or
|
|
14
|
+
* High (sentence case), "Open" for the link, and the topic chip only when
|
|
15
|
+
* `showTopic` is on. Other apps leave it off and keep today's card.
|
|
16
|
+
*/
|
|
17
|
+
navigationV2?: boolean;
|
|
18
|
+
/** Navigation v2 only: show the topic chip (a level-2 detail). */
|
|
19
|
+
showTopic?: boolean;
|
|
11
20
|
}
|
|
12
21
|
/**
|
|
13
22
|
* Notification card component
|
|
14
23
|
*
|
|
15
24
|
* Displays notification information with action buttons
|
|
16
25
|
*/
|
|
17
|
-
export declare function NotificationCard({ notification, onMarkAsRead, onArchive, onAction, onClick, showArchivedState, compact, analyticsSource, }: NotificationCardProps): import('react').JSX.Element;
|
|
26
|
+
export declare function NotificationCard({ notification, onMarkAsRead, onArchive, onAction, onClick, showArchivedState, compact, analyticsSource, navigationV2, showTopic, }: NotificationCardProps): import('react').JSX.Element;
|
|
18
27
|
export {};
|
|
@@ -3,117 +3,148 @@ import { useTr as t } from "../shared/hooks/useTr.js";
|
|
|
3
3
|
import { formatRelativeTime as n, getNotificationTypeIcon as r, getPriorityColor as i, getPriorityIcon as a, truncateText as o } from "../utils/index.js";
|
|
4
4
|
import { nativeImpact as s, nativeOpenUrl as c } from "../utils/nativeBridge.js";
|
|
5
5
|
import { navigateInApp as l } from "../utils/inAppNavigation.js";
|
|
6
|
-
import {
|
|
7
|
-
import { Fragment as
|
|
6
|
+
import { Archive as u, ExternalLink as d, X as f } from "lucide-react";
|
|
7
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
8
|
+
import { Tooltip as g, TooltipContent as _, TooltipTrigger as v } from "@burdenoff/fe-libs/ui";
|
|
8
9
|
// src/components/NotificationCard.tsx
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
var y = {
|
|
11
|
+
URGENT: {
|
|
12
|
+
key: "notifications.priorityUrgent",
|
|
13
|
+
label: "Urgent"
|
|
14
|
+
},
|
|
15
|
+
HIGH: {
|
|
16
|
+
key: "notifications.priorityHigh",
|
|
17
|
+
label: "High"
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
function b({ notification: b, onMarkAsRead: x, onArchive: S, onAction: C, onClick: w, showArchivedState: T = !1, compact: E = !1, analyticsSource: D = "center", navigationV2: O = !1, showTopic: k = !1 }) {
|
|
21
|
+
let A = t(), { trackNotificationOpened: j } = e(), M = !b.readAt, N = !!b.archivedAt, P = y[b.priority], F = () => {
|
|
22
|
+
j(b, D, "card"), w && w(b), M && x && x(b.id);
|
|
23
|
+
}, I = (e) => {
|
|
24
|
+
e.stopPropagation(), S && S(b.id);
|
|
25
|
+
}, L = (e) => {
|
|
15
26
|
l(e) || (e.startsWith("https://") ? c(e) : window.open(e, "_blank", "noopener,noreferrer"));
|
|
16
|
-
},
|
|
17
|
-
e.stopPropagation(), s("light"),
|
|
18
|
-
},
|
|
19
|
-
e.stopPropagation(), s("light"),
|
|
27
|
+
}, R = (e) => {
|
|
28
|
+
e.stopPropagation(), s("light"), b.actionUrl && (j(b, D, "primary_action"), C?.(b.id), L(b.actionUrl));
|
|
29
|
+
}, z = (e, t, n) => {
|
|
30
|
+
e.stopPropagation(), s("light"), j(b, D, "custom_action"), C?.(b.id, t), L(n);
|
|
20
31
|
};
|
|
21
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ h("div", {
|
|
22
33
|
"data-tour": "notification-card",
|
|
23
34
|
className: `
|
|
24
35
|
relative flex flex-col gap-2 p-4 rounded-lg border cursor-pointer
|
|
25
36
|
transition-[box-shadow,border-color,opacity] duration-200 ease-in-out
|
|
26
37
|
bg-gloss-card
|
|
27
|
-
${
|
|
28
|
-
${
|
|
38
|
+
${M ? "border-accent-primary/30 shadow-sm ring-1 ring-accent-primary/10" : "border-border-seam opacity-75"}
|
|
39
|
+
${T && N ? "border-dashed opacity-60" : ""}
|
|
29
40
|
hover:shadow-[var(--shadow-pop)] hover:border-accent-primary/30 hover:opacity-100
|
|
30
41
|
`,
|
|
31
|
-
onClick:
|
|
42
|
+
onClick: F,
|
|
32
43
|
children: [
|
|
33
|
-
|
|
34
|
-
/* @__PURE__ */
|
|
44
|
+
M && /* @__PURE__ */ m("div", { className: "absolute top-4 left-1.5 w-2.5 h-2.5 bg-accent-primary rounded-full shadow-sm shadow-accent-primary/50 motion-safe:animate-vc-glow-pulse" }),
|
|
45
|
+
/* @__PURE__ */ h("div", {
|
|
35
46
|
className: "flex items-start justify-between gap-2 ml-3",
|
|
36
|
-
children: [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ h("div", {
|
|
49
|
+
className: "flex items-center gap-2 flex-1 min-w-0",
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ m("span", {
|
|
52
|
+
className: "text-base",
|
|
53
|
+
"aria-hidden": "true",
|
|
54
|
+
children: r(b.type)
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ m("h3", {
|
|
57
|
+
className: `text-sm truncate ${M ? "font-bold text-primary" : "font-medium text-secondary"}`,
|
|
58
|
+
children: E ? o(b.title, 60) : b.title
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ m("span", {
|
|
61
|
+
className: "text-xs",
|
|
62
|
+
"aria-label": `Priority: ${b.priority}`,
|
|
63
|
+
children: a(b.priority)
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
}),
|
|
67
|
+
S && O && /* @__PURE__ */ h(g, { children: [/* @__PURE__ */ m(v, {
|
|
68
|
+
asChild: !0,
|
|
69
|
+
children: /* @__PURE__ */ m("button", {
|
|
70
|
+
type: "button",
|
|
71
|
+
"data-tour": "notification-archive-action",
|
|
72
|
+
onClick: I,
|
|
73
|
+
className: "flex-shrink-0 rounded p-1 transition-colors duration-150 hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
74
|
+
"aria-label": A("notifCommon.archiveNotification", "Archive notification"),
|
|
75
|
+
children: /* @__PURE__ */ m(u, {
|
|
76
|
+
size: 16,
|
|
77
|
+
className: "text-tertiary hover:text-secondary",
|
|
78
|
+
"aria-hidden": "true"
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
}), /* @__PURE__ */ m(_, { children: A("notifications.v2.archive", "Archive") })] }),
|
|
82
|
+
S && !O && /* @__PURE__ */ m("button", {
|
|
83
|
+
"data-tour": "notification-archive-action",
|
|
84
|
+
onClick: I,
|
|
85
|
+
className: "flex-shrink-0 p-1 hover:bg-bg-sunken rounded transition-colors duration-150",
|
|
86
|
+
"aria-label": A("notifCommon.archiveNotification", "Archive notification"),
|
|
87
|
+
children: /* @__PURE__ */ m(f, {
|
|
88
|
+
size: 16,
|
|
89
|
+
className: "text-tertiary hover:text-secondary"
|
|
52
90
|
})
|
|
53
|
-
]
|
|
54
|
-
}), _ && /* @__PURE__ */ p("button", {
|
|
55
|
-
"data-tour": "notification-archive-action",
|
|
56
|
-
onClick: O,
|
|
57
|
-
className: "flex-shrink-0 p-1 hover:bg-bg-sunken rounded transition-colors duration-150",
|
|
58
|
-
"aria-label": C("notifCommon.archiveNotification", "Archive notification"),
|
|
59
|
-
children: /* @__PURE__ */ p(d, {
|
|
60
|
-
size: 16,
|
|
61
|
-
className: "text-tertiary hover:text-secondary"
|
|
62
91
|
})
|
|
63
|
-
|
|
92
|
+
]
|
|
64
93
|
}),
|
|
65
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ h("div", {
|
|
66
95
|
className: "ml-3",
|
|
67
96
|
children: [
|
|
68
|
-
|
|
69
|
-
src:
|
|
70
|
-
alt:
|
|
97
|
+
b.media[0]?.url && /* @__PURE__ */ m("img", {
|
|
98
|
+
src: b.media[0].thumbnailUrl || b.media[0].url,
|
|
99
|
+
alt: b.media[0].label || b.title,
|
|
71
100
|
className: "mb-3 h-40 w-full rounded-md object-cover border border-default"
|
|
72
101
|
}),
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
className: `text-sm text-secondary ${
|
|
75
|
-
children:
|
|
102
|
+
/* @__PURE__ */ m("p", {
|
|
103
|
+
className: `text-sm text-secondary ${E ? "line-clamp-2" : ""}`,
|
|
104
|
+
children: E ? o(b.body, 120) : b.body
|
|
76
105
|
}),
|
|
77
|
-
|
|
106
|
+
b.topic && (!O || k) && /* @__PURE__ */ m("div", {
|
|
78
107
|
className: "mt-2 inline-flex items-center rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-secondary",
|
|
79
|
-
children:
|
|
108
|
+
children: b.topic.name
|
|
80
109
|
})
|
|
81
110
|
]
|
|
82
111
|
}),
|
|
83
|
-
|
|
112
|
+
b.actions.length > 0 && !E && /* @__PURE__ */ m("div", {
|
|
84
113
|
className: "ml-3 flex flex-wrap gap-2",
|
|
85
|
-
children:
|
|
86
|
-
onClick: (t) =>
|
|
114
|
+
children: b.actions.map((e) => /* @__PURE__ */ m("button", {
|
|
115
|
+
onClick: (t) => z(t, e.id, e.url),
|
|
87
116
|
className: `rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${e.style === "secondary" ? "bg-bg-sunken text-secondary hover:bg-bg-sunken/80" : e.style === "danger" ? "bg-status-error-bg-subtle text-status-error-text hover:opacity-80" : "bg-accent-primary text-white hover:opacity-90"}`,
|
|
88
117
|
children: e.label
|
|
89
118
|
}, e.id))
|
|
90
119
|
}),
|
|
91
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ h("div", {
|
|
92
121
|
className: "flex items-center justify-between gap-2 ml-3",
|
|
93
|
-
children: [/* @__PURE__ */
|
|
122
|
+
children: [/* @__PURE__ */ h("div", {
|
|
94
123
|
className: "flex items-center gap-2 text-xs text-tertiary",
|
|
95
124
|
children: [
|
|
96
|
-
/* @__PURE__ */ p("span", {
|
|
97
|
-
className: i(
|
|
98
|
-
children:
|
|
99
|
-
}),
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
|
|
104
|
-
|
|
125
|
+
O ? P && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("span", {
|
|
126
|
+
className: i(b.priority),
|
|
127
|
+
children: A(P.key, P.label)
|
|
128
|
+
}), /* @__PURE__ */ m("span", { children: "•" })] }) : /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("span", {
|
|
129
|
+
className: i(b.priority),
|
|
130
|
+
children: b.priority
|
|
131
|
+
}), /* @__PURE__ */ m("span", { children: "•" })] }),
|
|
132
|
+
T && N && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("span", { children: A("notifCommon.archived", "Archived") }), /* @__PURE__ */ m("span", { children: "•" })] }),
|
|
133
|
+
/* @__PURE__ */ m("time", {
|
|
134
|
+
dateTime: b.createdAt,
|
|
135
|
+
children: n(b.createdAt, A)
|
|
105
136
|
})
|
|
106
137
|
]
|
|
107
|
-
}),
|
|
108
|
-
onClick:
|
|
138
|
+
}), b.actionUrl && /* @__PURE__ */ h("button", {
|
|
139
|
+
onClick: R,
|
|
109
140
|
className: "flex items-center gap-1 text-xs text-accent-primary hover:text-accent-primary/80 transition-colors duration-150",
|
|
110
|
-
"aria-label":
|
|
111
|
-
children: [/* @__PURE__ */
|
|
141
|
+
"aria-label": A("notifCommon.openLink", "Open link"),
|
|
142
|
+
children: [/* @__PURE__ */ m("span", { children: O ? A("notifications.v2.open", "Open") : A("notifCommon.view", "View") }), /* @__PURE__ */ m(d, { size: 12 })]
|
|
112
143
|
})]
|
|
113
144
|
})
|
|
114
145
|
]
|
|
115
146
|
});
|
|
116
147
|
}
|
|
117
|
-
export {
|
|
148
|
+
export { b as NotificationCard };
|
|
118
149
|
|
|
119
150
|
//# sourceMappingURL=NotificationCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationCard.js","names":["_Fragment","NotificationCard","tr","useTr","useNotificationAnalytics","isUnread","notification","isArchived","handleClick","trackNotificationOpened","analyticsSource","onClick","onMarkAsRead","handleArchive","onArchive","openNotificationLink","navigateInApp","url","nativeOpenUrl","handleActionUrl","nativeImpact","onAction","handleActionClick","actionId","actionUrl","showArchivedState","getNotificationTypeIcon","compact","truncateText","getPriorityIcon","X","e","action","getPriorityColor","Fragment","formatRelativeTime","ExternalLink"],"sources":["../../src/components/NotificationCard.tsx"],"sourcesContent":["import { X, ExternalLink } from 'lucide-react';\nimport type { Notification } from '../types';\nimport { useNotificationAnalytics } from '../hooks/useNotificationAnalytics';\nimport { useTr } from '../shared/hooks/useTr';\nimport {\n formatRelativeTime,\n getPriorityColor,\n getPriorityIcon,\n getNotificationTypeIcon,\n truncateText,\n} from '../utils';\nimport { nativeImpact, nativeOpenUrl } from '../utils/nativeBridge';\nimport { navigateInApp } from '../utils/inAppNavigation';\n\ninterface NotificationCardProps {\n notification: Notification;\n onMarkAsRead?: (id: string) => void;\n onArchive?: (id: string) => void;\n onAction?: (notificationId: string, actionId?: string) => void;\n onClick?: (notification: Notification) => void;\n showArchivedState?: boolean;\n compact?: boolean;\n analyticsSource?: 'center' | 'panel' | 'history' | 'admin_history';\n}\n\n/**\n * Notification card component\n *\n * Displays notification information with action buttons\n */\nexport function NotificationCard({\n notification,\n onMarkAsRead,\n onArchive,\n onAction,\n onClick,\n showArchivedState = false,\n compact = false,\n analyticsSource = 'center',\n}: NotificationCardProps) {\n const tr = useTr();\n const { trackNotificationOpened } = useNotificationAnalytics();\n const isUnread = !notification.readAt;\n const isArchived = Boolean(notification.archivedAt);\n\n const handleClick = () => {\n trackNotificationOpened(notification, analyticsSource, 'card');\n if (onClick) {\n onClick(notification);\n }\n if (isUnread && onMarkAsRead) {\n onMarkAsRead(notification.id);\n }\n };\n\n const handleArchive = (e: React.MouseEvent) => {\n e.stopPropagation();\n if (onArchive) {\n onArchive(notification.id);\n }\n };\n\n // A link into this app (an agent, a run, a vibe) opens in place, like the\n // shell's notification bell; only a link that leaves the app opens a new tab\n // (or the system browser on native).\n const openNotificationLink = (url: string) => {\n if (navigateInApp(url)) return;\n if (url.startsWith('https://')) {\n void nativeOpenUrl(url);\n } else {\n window.open(url, '_blank', 'noopener,noreferrer');\n }\n };\n\n const handleActionUrl = (e: React.MouseEvent) => {\n e.stopPropagation();\n nativeImpact('light');\n if (notification.actionUrl) {\n trackNotificationOpened(notification, analyticsSource, 'primary_action');\n onAction?.(notification.id);\n openNotificationLink(notification.actionUrl);\n }\n };\n\n const handleActionClick = (e: React.MouseEvent, actionId: string, actionUrl: string) => {\n e.stopPropagation();\n nativeImpact('light');\n trackNotificationOpened(notification, analyticsSource, 'custom_action');\n onAction?.(notification.id, actionId);\n openNotificationLink(actionUrl);\n };\n\n return (\n <div\n data-tour=\"notification-card\"\n className={`\n relative flex flex-col gap-2 p-4 rounded-lg border cursor-pointer\n transition-[box-shadow,border-color,opacity] duration-200 ease-in-out\n bg-gloss-card\n ${isUnread ? 'border-accent-primary/30 shadow-sm ring-1 ring-accent-primary/10' : 'border-border-seam opacity-75'}\n ${showArchivedState && isArchived ? 'border-dashed opacity-60' : ''}\n hover:shadow-[var(--shadow-pop)] hover:border-accent-primary/30 hover:opacity-100\n `}\n onClick={handleClick}\n >\n {/* Unread indicator */}\n {isUnread && (\n <div className=\"absolute top-4 left-1.5 w-2.5 h-2.5 bg-accent-primary rounded-full shadow-sm shadow-accent-primary/50 motion-safe:animate-vc-glow-pulse\" />\n )}\n\n {/* Header */}\n <div className=\"flex items-start justify-between gap-2 ml-3\">\n <div className=\"flex items-center gap-2 flex-1 min-w-0\">\n <span className=\"text-base\" aria-hidden=\"true\">\n {getNotificationTypeIcon(notification.type)}\n </span>\n <h3\n className={`text-sm truncate ${isUnread ? 'font-bold text-primary' : 'font-medium text-secondary'}`}\n >\n {compact ? truncateText(notification.title, 60) : notification.title}\n </h3>\n <span className=\"text-xs\" aria-label={`Priority: ${notification.priority}`}>\n {getPriorityIcon(notification.priority)}\n </span>\n </div>\n\n {onArchive && (\n <button\n data-tour=\"notification-archive-action\"\n onClick={handleArchive}\n className=\"flex-shrink-0 p-1 hover:bg-bg-sunken rounded transition-colors duration-150\"\n aria-label={tr('notifCommon.archiveNotification', 'Archive notification')}\n >\n <X size={16} className=\"text-tertiary hover:text-secondary\" />\n </button>\n )}\n </div>\n\n {/* Body */}\n <div className=\"ml-3\">\n {notification.media[0]?.url && (\n <img\n src={notification.media[0].thumbnailUrl || notification.media[0].url}\n alt={notification.media[0].label || notification.title}\n className=\"mb-3 h-40 w-full rounded-md object-cover border border-default\"\n />\n )}\n <p className={`text-sm text-secondary ${compact ? 'line-clamp-2' : ''}`}>\n {compact ? truncateText(notification.body, 120) : notification.body}\n </p>\n {notification.topic && (\n <div className=\"mt-2 inline-flex items-center rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-secondary\">\n {notification.topic.name}\n </div>\n )}\n </div>\n\n {notification.actions.length > 0 && !compact && (\n <div className=\"ml-3 flex flex-wrap gap-2\">\n {notification.actions.map((action) => (\n <button\n key={action.id}\n onClick={(e) => handleActionClick(e, action.id, action.url)}\n className={`rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${\n action.style === 'secondary'\n ? 'bg-bg-sunken text-secondary hover:bg-bg-sunken/80'\n : action.style === 'danger'\n ? 'bg-status-error-bg-subtle text-status-error-text hover:opacity-80'\n : 'bg-accent-primary text-white hover:opacity-90'\n }`}\n >\n {action.label}\n </button>\n ))}\n </div>\n )}\n\n {/* Footer */}\n <div className=\"flex items-center justify-between gap-2 ml-3\">\n <div className=\"flex items-center gap-2 text-xs text-tertiary\">\n <span className={getPriorityColor(notification.priority)}>{notification.priority}</span>\n {showArchivedState && isArchived && (\n <>\n <span>•</span>\n <span>{tr('notifCommon.archived', 'Archived')}</span>\n </>\n )}\n <span>•</span>\n <time dateTime={notification.createdAt}>\n {formatRelativeTime(notification.createdAt, tr)}\n </time>\n </div>\n\n {notification.actionUrl && (\n <button\n onClick={handleActionUrl}\n className=\"flex items-center gap-1 text-xs text-accent-primary hover:text-accent-primary/80 transition-colors duration-150\"\n aria-label={tr('notifCommon.openLink', 'Open link')}\n >\n <span>{tr('notifCommon.view', 'View')}</span>\n <ExternalLink size={12} />\n </button>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AA8BA,SAAgBC,EAAiB,EAC/B,iBACA,iBACA,cACA,aACA,YACA,uBAAoB,IACpB,aAAU,IACV,qBAAkB,YACM;CACxB,IAAMC,IAAKC,EAAM,GACX,EAAE,+BAA4BC,EAAyB,GACvDC,IAAW,CAACC,EAAa,QACzBC,IAAa,EAAQD,EAAa,YAElCE,UAAoB;EAKxB,AAJAC,EAAwBH,GAAcI,GAAiB,MAAM,GACzDC,KACFA,EAAQL,CAAY,GAElBD,KAAYO,KACdA,EAAaN,EAAa,EAAE;CAEhC,GAEMO,KAAiB,MAAwB;EAE7C,AADA,EAAE,gBAAgB,GACdC,KACFA,EAAUR,EAAa,EAAE;CAE7B,GAKMS,KAAwB,MAAgB;EAC5C,AAAIC,EAAcC,CAAG,MACjBA,EAAI,WAAW,UAAU,IAC3BC,EAAmBD,CAAG,IAEtB,OAAO,KAAKA,GAAK,UAAU,qBAAqB;CAEpD,GAEME,KAAmB,MAAwB;EAG/C,AAFA,EAAE,gBAAgB,GAClBC,EAAa,OAAO,GAChBd,EAAa,cACfG,EAAwBH,GAAcI,GAAiB,gBAAgB,GACvEW,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AAM,EAAQ,CAAA,GAC5C,kBAACkC,GAAD,EAAc,MAAM,GAAK,CAAA,CACnB;IAEP,CAAA,CAAA;;EACF;;AAET"}
|
|
1
|
+
{"version":3,"file":"NotificationCard.js","names":["_Fragment","V2_PRIORITY_LABELS","NotificationCard","tr","useTr","useNotificationAnalytics","isUnread","notification","isArchived","v2Priority","handleClick","trackNotificationOpened","analyticsSource","onClick","onMarkAsRead","handleArchive","onArchive","openNotificationLink","navigateInApp","url","nativeOpenUrl","handleActionUrl","nativeImpact","onAction","handleActionClick","actionId","actionUrl","showArchivedState","getNotificationTypeIcon","compact","truncateText","getPriorityIcon","navigationV2","Tooltip","TooltipTrigger","Archive","TooltipContent","X","showTopic","e","action","Fragment","getPriorityColor","formatRelativeTime","ExternalLink"],"sources":["../../src/components/NotificationCard.tsx"],"sourcesContent":["import { Archive, X, ExternalLink } from 'lucide-react';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@burdenoff/fe-libs/ui';\nimport type { Notification } from '../types';\nimport { useNotificationAnalytics } from '../hooks/useNotificationAnalytics';\nimport { useTr } from '../shared/hooks/useTr';\nimport {\n formatRelativeTime,\n getPriorityColor,\n getPriorityIcon,\n getNotificationTypeIcon,\n truncateText,\n} from '../utils';\nimport { nativeImpact, nativeOpenUrl } from '../utils/nativeBridge';\nimport { navigateInApp } from '../utils/inAppNavigation';\n\ninterface NotificationCardProps {\n notification: Notification;\n onMarkAsRead?: (id: string) => void;\n onArchive?: (id: string) => void;\n onAction?: (notificationId: string, actionId?: string) => void;\n onClick?: (notification: Notification) => void;\n showArchivedState?: boolean;\n compact?: boolean;\n analyticsSource?: 'center' | 'panel' | 'history' | 'admin_history';\n /**\n * FluidGrids' Navigation v2 card (BOFF-11872): an archive icon with an\n * \"Archive\" tooltip instead of \"X\", the priority footer only for Urgent or\n * High (sentence case), \"Open\" for the link, and the topic chip only when\n * `showTopic` is on. Other apps leave it off and keep today's card.\n */\n navigationV2?: boolean;\n /** Navigation v2 only: show the topic chip (a level-2 detail). */\n showTopic?: boolean;\n}\n\n/** Navigation v2's priority footer: only the two that need attention, in sentence case. */\nconst V2_PRIORITY_LABELS: Partial<\n Record<Notification['priority'], { key: string; label: string }>\n> = {\n URGENT: { key: 'notifications.priorityUrgent', label: 'Urgent' },\n HIGH: { key: 'notifications.priorityHigh', label: 'High' },\n};\n\n/**\n * Notification card component\n *\n * Displays notification information with action buttons\n */\nexport function NotificationCard({\n notification,\n onMarkAsRead,\n onArchive,\n onAction,\n onClick,\n showArchivedState = false,\n compact = false,\n analyticsSource = 'center',\n navigationV2 = false,\n showTopic = false,\n}: NotificationCardProps) {\n const tr = useTr();\n const { trackNotificationOpened } = useNotificationAnalytics();\n const isUnread = !notification.readAt;\n const isArchived = Boolean(notification.archivedAt);\n const v2Priority = V2_PRIORITY_LABELS[notification.priority];\n\n const handleClick = () => {\n trackNotificationOpened(notification, analyticsSource, 'card');\n if (onClick) {\n onClick(notification);\n }\n if (isUnread && onMarkAsRead) {\n onMarkAsRead(notification.id);\n }\n };\n\n const handleArchive = (e: React.MouseEvent) => {\n e.stopPropagation();\n if (onArchive) {\n onArchive(notification.id);\n }\n };\n\n // A link into this app (an agent, a run, a vibe) opens in place, like the\n // shell's notification bell; only a link that leaves the app opens a new tab\n // (or the system browser on native).\n const openNotificationLink = (url: string) => {\n if (navigateInApp(url)) return;\n if (url.startsWith('https://')) {\n void nativeOpenUrl(url);\n } else {\n window.open(url, '_blank', 'noopener,noreferrer');\n }\n };\n\n const handleActionUrl = (e: React.MouseEvent) => {\n e.stopPropagation();\n nativeImpact('light');\n if (notification.actionUrl) {\n trackNotificationOpened(notification, analyticsSource, 'primary_action');\n onAction?.(notification.id);\n openNotificationLink(notification.actionUrl);\n }\n };\n\n const handleActionClick = (e: React.MouseEvent, actionId: string, actionUrl: string) => {\n e.stopPropagation();\n nativeImpact('light');\n trackNotificationOpened(notification, analyticsSource, 'custom_action');\n onAction?.(notification.id, actionId);\n openNotificationLink(actionUrl);\n };\n\n return (\n <div\n data-tour=\"notification-card\"\n className={`\n relative flex flex-col gap-2 p-4 rounded-lg border cursor-pointer\n transition-[box-shadow,border-color,opacity] duration-200 ease-in-out\n bg-gloss-card\n ${isUnread ? 'border-accent-primary/30 shadow-sm ring-1 ring-accent-primary/10' : 'border-border-seam opacity-75'}\n ${showArchivedState && isArchived ? 'border-dashed opacity-60' : ''}\n hover:shadow-[var(--shadow-pop)] hover:border-accent-primary/30 hover:opacity-100\n `}\n onClick={handleClick}\n >\n {/* Unread indicator */}\n {isUnread && (\n <div className=\"absolute top-4 left-1.5 w-2.5 h-2.5 bg-accent-primary rounded-full shadow-sm shadow-accent-primary/50 motion-safe:animate-vc-glow-pulse\" />\n )}\n\n {/* Header */}\n <div className=\"flex items-start justify-between gap-2 ml-3\">\n <div className=\"flex items-center gap-2 flex-1 min-w-0\">\n <span className=\"text-base\" aria-hidden=\"true\">\n {getNotificationTypeIcon(notification.type)}\n </span>\n <h3\n className={`text-sm truncate ${isUnread ? 'font-bold text-primary' : 'font-medium text-secondary'}`}\n >\n {compact ? truncateText(notification.title, 60) : notification.title}\n </h3>\n <span className=\"text-xs\" aria-label={`Priority: ${notification.priority}`}>\n {getPriorityIcon(notification.priority)}\n </span>\n </div>\n\n {onArchive && navigationV2 && (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n data-tour=\"notification-archive-action\"\n onClick={handleArchive}\n className=\"flex-shrink-0 rounded p-1 transition-colors duration-150 hover:bg-bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n aria-label={tr('notifCommon.archiveNotification', 'Archive notification')}\n >\n <Archive\n size={16}\n className=\"text-tertiary hover:text-secondary\"\n aria-hidden=\"true\"\n />\n </button>\n </TooltipTrigger>\n <TooltipContent>{tr('notifications.v2.archive', 'Archive')}</TooltipContent>\n </Tooltip>\n )}\n {onArchive && !navigationV2 && (\n <button\n data-tour=\"notification-archive-action\"\n onClick={handleArchive}\n className=\"flex-shrink-0 p-1 hover:bg-bg-sunken rounded transition-colors duration-150\"\n aria-label={tr('notifCommon.archiveNotification', 'Archive notification')}\n >\n <X size={16} className=\"text-tertiary hover:text-secondary\" />\n </button>\n )}\n </div>\n\n {/* Body */}\n <div className=\"ml-3\">\n {notification.media[0]?.url && (\n <img\n src={notification.media[0].thumbnailUrl || notification.media[0].url}\n alt={notification.media[0].label || notification.title}\n className=\"mb-3 h-40 w-full rounded-md object-cover border border-default\"\n />\n )}\n <p className={`text-sm text-secondary ${compact ? 'line-clamp-2' : ''}`}>\n {compact ? truncateText(notification.body, 120) : notification.body}\n </p>\n {notification.topic && (!navigationV2 || showTopic) && (\n <div className=\"mt-2 inline-flex items-center rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-secondary\">\n {notification.topic.name}\n </div>\n )}\n </div>\n\n {notification.actions.length > 0 && !compact && (\n <div className=\"ml-3 flex flex-wrap gap-2\">\n {notification.actions.map((action) => (\n <button\n key={action.id}\n onClick={(e) => handleActionClick(e, action.id, action.url)}\n className={`rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${\n action.style === 'secondary'\n ? 'bg-bg-sunken text-secondary hover:bg-bg-sunken/80'\n : action.style === 'danger'\n ? 'bg-status-error-bg-subtle text-status-error-text hover:opacity-80'\n : 'bg-accent-primary text-white hover:opacity-90'\n }`}\n >\n {action.label}\n </button>\n ))}\n </div>\n )}\n\n {/* Footer */}\n <div className=\"flex items-center justify-between gap-2 ml-3\">\n <div className=\"flex items-center gap-2 text-xs text-tertiary\">\n {navigationV2 ? (\n v2Priority && (\n <>\n <span className={getPriorityColor(notification.priority)}>\n {tr(v2Priority.key, v2Priority.label)}\n </span>\n <span>•</span>\n </>\n )\n ) : (\n <>\n <span className={getPriorityColor(notification.priority)}>\n {notification.priority}\n </span>\n <span>•</span>\n </>\n )}\n {showArchivedState && isArchived && (\n <>\n <span>{tr('notifCommon.archived', 'Archived')}</span>\n <span>•</span>\n </>\n )}\n <time dateTime={notification.createdAt}>\n {formatRelativeTime(notification.createdAt, tr)}\n </time>\n </div>\n\n {notification.actionUrl && (\n <button\n onClick={handleActionUrl}\n className=\"flex items-center gap-1 text-xs text-accent-primary hover:text-accent-primary/80 transition-colors duration-150\"\n aria-label={tr('notifCommon.openLink', 'Open link')}\n >\n <span>\n {navigationV2 ? tr('notifications.v2.open', 'Open') : tr('notifCommon.view', 'View')}\n </span>\n <ExternalLink size={12} />\n </button>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAoCA,IAAMC,IAEF;CACF,QAAQ;EAAE,KAAK;EAAgC,OAAO;CAAS;CAC/D,MAAM;EAAE,KAAK;EAA8B,OAAO;CAAO;AAC3D;AAOA,SAAgBC,EAAiB,EAC/B,iBACA,iBACA,cACA,aACA,YACA,uBAAoB,IACpB,aAAU,IACV,qBAAkB,UAClB,kBAAe,IACf,eAAY,MACY;CACxB,IAAMC,IAAKC,EAAM,GACX,EAAE,+BAA4BC,EAAyB,GACvDC,IAAW,CAACC,EAAa,QACzBC,IAAa,EAAQD,EAAa,YAClCE,IAAaR,EAAmBM,EAAa,WAE7CG,UAAoB;EAKxB,AAJAC,EAAwBJ,GAAcK,GAAiB,MAAM,GACzDC,KACFA,EAAQN,CAAY,GAElBD,KAAYQ,KACdA,EAAaP,EAAa,EAAE;CAEhC,GAEMQ,KAAiB,MAAwB;EAE7C,AADA,EAAE,gBAAgB,GACdC,KACFA,EAAUT,EAAa,EAAE;CAE7B,GAKMU,KAAwB,MAAgB;EAC5C,AAAIC,EAAcC,CAAG,MACjBA,EAAI,WAAW,UAAU,IAC3BC,EAAmBD,CAAG,IAEtB,OAAO,KAAKA,GAAK,UAAU,qBAAqB;CAEpD,GAEME,KAAmB,MAAwB;EAG/C,AAFA,EAAE,gBAAgB,GAClBC,EAAa,OAAO,GAChBf,EAAa,cACfI,EAAwBJ,GAAcK,GAAiB,gBAAgB,GACvEW,IAAWhB,EAAa,EAAE,GAC1BU,EAAqBV,EAAa,SAAS;CAE/C,GAEMi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AA,UAAA,CACE,kBAAC,QAAD;OAAM,WAAW0C,EAAiBnC,EAAa,QAAQ;OACpD,UAAAA,EAAa;MACV,CAAA,GACN,kBAAC,QAAD,EAAA,UAAM,IAAO,CAAA,CACb,EAAA,CAAA;MAEHoB,KAAqBnB,KACpB,kBAAAR,GAAA,EAAA,UAAA,CACE,kBAAC,QAAD,EAAA,UAAOG,EAAG,wBAAwB,UAAU,EAAQ,CAAA,GACpD,kBAAC,QAAD,EAAA,UAAM,IAAO,CAAA,CACb,EAAA,CAAA;MAEJ,kBAAC,QAAD;OAAM,UAAUI,EAAa;OAC1B,UAAAoC,EAAmBpC,EAAa,WAAWJ,CAAE;MAC1C,CAAA;KACH;IAEJ,CAAA,GAAAI,EAAa,aACZ,kBAAC,UAAD;KACE,SAASc;KACT,WAAU;KACV,cAAYlB,EAAG,wBAAwB,WAAW;KAHpD,UAAA,CAKE,kBAAC,QAAD,EAAA,UACG6B,IAAe7B,EAAG,yBAAyB,MAAM,IAAIA,EAAG,oBAAoB,MAAM,EAC/E,CAAA,GACN,kBAACyC,GAAD,EAAc,MAAM,GAAK,CAAA,CACnB;IAEP,CAAA,CAAA;;EACF;;AAET"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useNotifications as e } from "./useNotifications.js";
|
|
2
2
|
import { useNotificationAdmin as t } from "./useNotificationAdmin.js";
|
|
3
|
-
import
|
|
4
|
-
import { useNotificationTopics as
|
|
3
|
+
import "./useNotificationPreferences.js";
|
|
4
|
+
import { useNotificationTopics as n } from "./useNotificationTopics.js";
|
|
5
5
|
import "./useNotificationAnalytics.js";
|
|
6
|
-
import { useNotificationStore as
|
|
7
|
-
import { useNotification as
|
|
8
|
-
export {
|
|
6
|
+
import { useNotificationStore as r } from "../store/notificationStore.js";
|
|
7
|
+
import { useNotification as i } from "../providers/NotificationProvider.js";
|
|
8
|
+
export { i as useNotification, t as useNotificationAdmin, r as useNotificationStore, n as useNotificationTopics, e as useNotifications };
|