@burdenoff/microfe-notification 2026.424.101
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/README.md +376 -0
- package/dist/AdminNotificationRoot.d.ts +35 -0
- package/dist/AdminNotificationRoot.d.ts.map +1 -0
- package/dist/AdminNotificationRoot.js +81 -0
- package/dist/AdminNotificationRoot.js.map +1 -0
- package/dist/AdminNotificationRoutes.d.ts +2 -0
- package/dist/AdminNotificationRoutes.d.ts.map +1 -0
- package/dist/AdminNotificationRoutes.js +108 -0
- package/dist/AdminNotificationRoutes.js.map +1 -0
- package/dist/NotificationRoot.d.ts +31 -0
- package/dist/NotificationRoot.d.ts.map +1 -0
- package/dist/NotificationRoot.js +81 -0
- package/dist/NotificationRoot.js.map +1 -0
- package/dist/NotificationRoutes.d.ts +17 -0
- package/dist/NotificationRoutes.d.ts.map +1 -0
- package/dist/NotificationRoutes.js +67 -0
- package/dist/NotificationRoutes.js.map +1 -0
- package/dist/UserNotificationRoot.d.ts +34 -0
- package/dist/UserNotificationRoot.d.ts.map +1 -0
- package/dist/UserNotificationRoot.js +64 -0
- package/dist/UserNotificationRoot.js.map +1 -0
- package/dist/UserNotificationRoutes.d.ts +15 -0
- package/dist/UserNotificationRoutes.d.ts.map +1 -0
- package/dist/UserNotificationRoutes.js +52 -0
- package/dist/UserNotificationRoutes.js.map +1 -0
- package/dist/__tests__/setup.d.ts +2 -0
- package/dist/__tests__/setup.d.ts.map +1 -0
- package/dist/components/NotificationBell.d.ts +14 -0
- package/dist/components/NotificationBell.d.ts.map +1 -0
- package/dist/components/NotificationBell.js +47 -0
- package/dist/components/NotificationBell.js.map +1 -0
- package/dist/components/NotificationCard.d.ts +19 -0
- package/dist/components/NotificationCard.d.ts.map +1 -0
- package/dist/components/NotificationCard.js +112 -0
- package/dist/components/NotificationCard.js.map +1 -0
- package/dist/components/NotificationPanel.d.ts +11 -0
- package/dist/components/NotificationPanel.d.ts.map +1 -0
- package/dist/components/NotificationPanel.js +100 -0
- package/dist/components/NotificationPanel.js.map +1 -0
- package/dist/components/RecipientSelector.d.ts +34 -0
- package/dist/components/RecipientSelector.d.ts.map +1 -0
- package/dist/components/RecipientSelector.js +212 -0
- package/dist/components/RecipientSelector.js.map +1 -0
- package/dist/components/TemplatePreview.d.ts +22 -0
- package/dist/components/TemplatePreview.d.ts.map +1 -0
- package/dist/components/TemplatePreview.js +425 -0
- package/dist/components/TemplatePreview.js.map +1 -0
- package/dist/components/VariableInserter.d.ts +12 -0
- package/dist/components/VariableInserter.d.ts.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +3 -0
- package/dist/constants/permissions.d.ts +24 -0
- package/dist/constants/permissions.d.ts.map +1 -0
- package/dist/constants/permissions.js +17 -0
- package/dist/constants/permissions.js.map +1 -0
- package/dist/dev/main.d.ts +2 -0
- package/dist/dev/main.d.ts.map +1 -0
- package/dist/generated/global-operations.d.ts +1408 -0
- package/dist/generated/global-operations.d.ts.map +1 -0
- package/dist/generated/global-operations.js +514 -0
- package/dist/generated/global-operations.js.map +1 -0
- package/dist/generated/global-types.d.ts +20773 -0
- package/dist/generated/global-types.d.ts.map +1 -0
- package/dist/generated/wspace-operations.d.ts +2 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -0
- package/dist/generated/wspace-types.d.ts +53363 -0
- package/dist/generated/wspace-types.d.ts.map +1 -0
- package/dist/graphql/global-client.d.ts +19 -0
- package/dist/graphql/global-client.d.ts.map +1 -0
- package/dist/graphql/global-client.js +57 -0
- package/dist/graphql/global-client.js.map +1 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hooks/useNotificationAdmin.d.ts +51 -0
- package/dist/hooks/useNotificationAdmin.d.ts.map +1 -0
- package/dist/hooks/useNotificationAdmin.js +203 -0
- package/dist/hooks/useNotificationAdmin.js.map +1 -0
- package/dist/hooks/useNotificationTemplates.d.ts +136 -0
- package/dist/hooks/useNotificationTemplates.d.ts.map +1 -0
- package/dist/hooks/useNotificationTemplates.js +168 -0
- package/dist/hooks/useNotificationTemplates.js.map +1 -0
- package/dist/hooks/useNotificationTopics.d.ts +36 -0
- package/dist/hooks/useNotificationTopics.d.ts.map +1 -0
- package/dist/hooks/useNotificationTopics.js +127 -0
- package/dist/hooks/useNotificationTopics.js.map +1 -0
- package/dist/hooks/useNotifications.d.ts +36 -0
- package/dist/hooks/useNotifications.d.ts.map +1 -0
- package/dist/hooks/useNotifications.js +289 -0
- package/dist/hooks/useNotifications.js.map +1 -0
- package/dist/hooks/useSendNotification.d.ts +159 -0
- package/dist/hooks/useSendNotification.d.ts.map +1 -0
- package/dist/hooks/useSendNotification.js +123 -0
- package/dist/hooks/useSendNotification.js.map +1 -0
- package/dist/hooks/useUserSearch.d.ts +27 -0
- package/dist/hooks/useUserSearch.d.ts.map +1 -0
- package/dist/hooks/useUserSearch.js +76 -0
- package/dist/hooks/useUserSearch.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/pages/CreateNotificationPage.d.ts +6 -0
- package/dist/pages/CreateNotificationPage.d.ts.map +1 -0
- package/dist/pages/CreateNotificationPage.js +1366 -0
- package/dist/pages/CreateNotificationPage.js.map +1 -0
- package/dist/pages/NotificationCenterPage.d.ts +7 -0
- package/dist/pages/NotificationCenterPage.d.ts.map +1 -0
- package/dist/pages/NotificationCenterPage.js +203 -0
- package/dist/pages/NotificationCenterPage.js.map +1 -0
- package/dist/pages/NotificationHistoryAdminPage.d.ts +3 -0
- package/dist/pages/NotificationHistoryAdminPage.d.ts.map +1 -0
- package/dist/pages/NotificationHistoryAdminPage.js +484 -0
- package/dist/pages/NotificationHistoryAdminPage.js.map +1 -0
- package/dist/pages/NotificationHistoryPage.d.ts +3 -0
- package/dist/pages/NotificationHistoryPage.d.ts.map +1 -0
- package/dist/pages/NotificationHistoryPage.js +136 -0
- package/dist/pages/NotificationHistoryPage.js.map +1 -0
- package/dist/pages/NotificationLandingPage.d.ts +11 -0
- package/dist/pages/NotificationLandingPage.d.ts.map +1 -0
- package/dist/pages/NotificationLandingPage.js +85 -0
- package/dist/pages/NotificationLandingPage.js.map +1 -0
- package/dist/pages/NotificationPreferencesPage.d.ts +2 -0
- package/dist/pages/NotificationPreferencesPage.d.ts.map +1 -0
- package/dist/pages/NotificationPreferencesPage.js +108 -0
- package/dist/pages/NotificationPreferencesPage.js.map +1 -0
- package/dist/pages/NotificationTemplatesPage.d.ts +8 -0
- package/dist/pages/NotificationTemplatesPage.d.ts.map +1 -0
- package/dist/pages/NotificationTemplatesPage.js +310 -0
- package/dist/pages/NotificationTemplatesPage.js.map +1 -0
- package/dist/pages/NotificationTopicsPage.d.ts +2 -0
- package/dist/pages/NotificationTopicsPage.d.ts.map +1 -0
- package/dist/pages/NotificationTopicsPage.js +254 -0
- package/dist/pages/NotificationTopicsPage.js.map +1 -0
- package/dist/pages/TemplateEditorPage.d.ts +13 -0
- package/dist/pages/TemplateEditorPage.d.ts.map +1 -0
- package/dist/pages/TemplateEditorPage.js +790 -0
- package/dist/pages/TemplateEditorPage.js.map +1 -0
- package/dist/providers/NotificationProvider.d.ts +19 -0
- package/dist/providers/NotificationProvider.d.ts.map +1 -0
- package/dist/providers/NotificationProvider.js +35 -0
- package/dist/providers/NotificationProvider.js.map +1 -0
- package/dist/shared/hooks/useTr.d.ts +14 -0
- package/dist/shared/hooks/useTr.d.ts.map +1 -0
- package/dist/shared/hooks/useTr.js +14 -0
- package/dist/shared/hooks/useTr.js.map +1 -0
- package/dist/store/notificationStore.d.ts +32 -0
- package/dist/store/notificationStore.d.ts.map +1 -0
- package/dist/store/notificationStore.js +124 -0
- package/dist/store/notificationStore.js.map +1 -0
- package/dist/types/index.d.ts +215 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/index.d.ts +68 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +122 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/notificationHistoryExport.d.ts +13 -0
- package/dist/utils/notificationHistoryExport.d.ts.map +1 -0
- package/dist/utils/notificationHistoryExport.js +29 -0
- package/dist/utils/notificationHistoryExport.js.map +1 -0
- package/package.json +115 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { NotificationRootProps } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Root component for the Notification microfrontend.
|
|
5
|
+
*
|
|
6
|
+
* This is the main entry point that host applications import and render.
|
|
7
|
+
* It sets up the necessary providers and renders the internal routing.
|
|
8
|
+
* Automatically registers navigation items with the shell if registration functions are provided.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import { NotificationRoot, type NotificationRootProps } from '@burdenoff/micro-fe/notification';
|
|
13
|
+
*
|
|
14
|
+
* function App() {
|
|
15
|
+
* const props: NotificationRootProps = {
|
|
16
|
+
* basePath: '/notifications',
|
|
17
|
+
* navigate: (path) => router.push(path),
|
|
18
|
+
* currentUser: { id: '1', email: 'user@example.com' },
|
|
19
|
+
* workspaceId: 'ws-123',
|
|
20
|
+
* apiGatewayUrl: 'https://api.example.com',
|
|
21
|
+
* authToken: 'token',
|
|
22
|
+
* registerNavItems: (items) => { return () => {}; },
|
|
23
|
+
* onNotificationClick: (notification) => console.log('Clicked:', notification),
|
|
24
|
+
* };
|
|
25
|
+
*
|
|
26
|
+
* return <NotificationRoot {...props} />;
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function NotificationRoot(props: NotificationRootProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
//# sourceMappingURL=NotificationRoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationRoot.d.ts","sourceRoot":"","sources":["../src/NotificationRoot.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAuB,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAG1E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,2CAkG5D"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { NotificationProvider as e } from "./providers/NotificationProvider.js";
|
|
2
|
+
import { NotificationRoutes as t } from "./NotificationRoutes.js";
|
|
3
|
+
import { useEffect as n } from "react";
|
|
4
|
+
import { ErrorBoundary as r } from "@burdenoff/fe-libs/shared/components";
|
|
5
|
+
import { FeatureFlagProvider as i } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
6
|
+
import { Archive as a, Bell as o, FileText as s, Settings2 as c, Tag as l } from "lucide-react";
|
|
7
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
8
|
+
//#region src/NotificationRoot.tsx
|
|
9
|
+
function d(d) {
|
|
10
|
+
let { registerNavItems: f, registerFooterItems: p, basePath: m = "/" } = d, h = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
|
|
11
|
+
return n(() => {
|
|
12
|
+
if (f) return f([
|
|
13
|
+
{
|
|
14
|
+
id: "notification-center",
|
|
15
|
+
label: "Notification Center",
|
|
16
|
+
path: h(m, "center"),
|
|
17
|
+
icon: /* @__PURE__ */ u(o, { size: 20 }),
|
|
18
|
+
order: 10,
|
|
19
|
+
group: "notifications"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "notification-history",
|
|
23
|
+
label: "History",
|
|
24
|
+
path: h(m, "history"),
|
|
25
|
+
icon: /* @__PURE__ */ u(a, { size: 20 }),
|
|
26
|
+
order: 20,
|
|
27
|
+
group: "notifications"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "notification-templates",
|
|
31
|
+
label: "Templates",
|
|
32
|
+
path: h(m, "templates"),
|
|
33
|
+
icon: /* @__PURE__ */ u(s, { size: 20 }),
|
|
34
|
+
order: 30,
|
|
35
|
+
group: "notifications"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "notification-topics",
|
|
39
|
+
label: "Topics",
|
|
40
|
+
path: h(m, "topics"),
|
|
41
|
+
icon: /* @__PURE__ */ u(l, { size: 20 }),
|
|
42
|
+
order: 40,
|
|
43
|
+
group: "notifications"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "notification-preferences",
|
|
47
|
+
label: "Preferences",
|
|
48
|
+
path: h(m, "preferences"),
|
|
49
|
+
icon: /* @__PURE__ */ u(c, { size: 20 }),
|
|
50
|
+
order: 50,
|
|
51
|
+
group: "notifications"
|
|
52
|
+
}
|
|
53
|
+
]);
|
|
54
|
+
}, [f, m]), n(() => {
|
|
55
|
+
if (p) return p([{
|
|
56
|
+
id: "notification-status",
|
|
57
|
+
label: "Notifications Ready",
|
|
58
|
+
type: "status",
|
|
59
|
+
order: 10,
|
|
60
|
+
section: "left"
|
|
61
|
+
}]);
|
|
62
|
+
}, [p]), /* @__PURE__ */ u(r, {
|
|
63
|
+
fallback: /* @__PURE__ */ u("div", {
|
|
64
|
+
className: "p-6 text-center text-text-secondary",
|
|
65
|
+
children: "Something went wrong loading this module. Please refresh the page."
|
|
66
|
+
}),
|
|
67
|
+
children: /* @__PURE__ */ u(i, {
|
|
68
|
+
workspaceId: null,
|
|
69
|
+
gateway: "global",
|
|
70
|
+
defaultEnabled: !0,
|
|
71
|
+
children: /* @__PURE__ */ u(e, {
|
|
72
|
+
...d,
|
|
73
|
+
children: /* @__PURE__ */ u(t, {})
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
export { d as NotificationRoot };
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=NotificationRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationRoot.js","names":[],"sources":["../src/NotificationRoot.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { ErrorBoundary } from '@burdenoff/fe-libs/shared/components';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { Bell, Archive, FileText, Settings2, Tag } from 'lucide-react';\nimport { NotificationProvider } from './providers/NotificationProvider';\nimport type { NavItem, FooterItem, NotificationRootProps } from './types';\nimport { NotificationRoutes } from './NotificationRoutes';\n\n/**\n * Root component for the Notification microfrontend.\n *\n * This is the main entry point that host applications import and render.\n * It sets up the necessary providers and renders the internal routing.\n * Automatically registers navigation items with the shell if registration functions are provided.\n *\n * @example\n * ```tsx\n * import { NotificationRoot, type NotificationRootProps } from '@burdenoff/micro-fe/notification';\n *\n * function App() {\n * const props: NotificationRootProps = {\n * basePath: '/notifications',\n * navigate: (path) => router.push(path),\n * currentUser: { id: '1', email: 'user@example.com' },\n * workspaceId: 'ws-123',\n * apiGatewayUrl: 'https://api.example.com',\n * authToken: 'token',\n * registerNavItems: (items) => { return () => {}; },\n * onNotificationClick: (notification) => console.log('Clicked:', notification),\n * };\n *\n * return <NotificationRoot {...props} />;\n * }\n * ```\n */\nexport function NotificationRoot(props: NotificationRootProps) {\n const { registerNavItems, registerFooterItems, basePath = '/' } = props;\n\n // Helper to join paths correctly, avoiding double slashes\n const joinPath = (base: string, path: string): string => {\n const cleanBase = base.endsWith('/') ? base.slice(0, -1) : base;\n const cleanPath = path.startsWith('/') ? path : `/${path}`;\n return cleanBase + cleanPath;\n };\n\n // Register navigation items with the shell\n useEffect(() => {\n if (!registerNavItems) return;\n\n const navItems: NavItem[] = [\n {\n id: 'notification-center',\n label: 'Notification Center',\n path: joinPath(basePath, 'center'),\n icon: <Bell size={20} />,\n order: 10,\n group: 'notifications',\n },\n {\n id: 'notification-history',\n label: 'History',\n path: joinPath(basePath, 'history'),\n icon: <Archive size={20} />,\n order: 20,\n group: 'notifications',\n },\n {\n id: 'notification-templates',\n label: 'Templates',\n path: joinPath(basePath, 'templates'),\n icon: <FileText size={20} />,\n order: 30,\n group: 'notifications',\n // Admin only - host should filter based on permissions\n },\n {\n id: 'notification-topics',\n label: 'Topics',\n path: joinPath(basePath, 'topics'),\n icon: <Tag size={20} />,\n order: 40,\n group: 'notifications',\n },\n {\n id: 'notification-preferences',\n label: 'Preferences',\n path: joinPath(basePath, 'preferences'),\n icon: <Settings2 size={20} />,\n order: 50,\n group: 'notifications',\n },\n ];\n\n // Register and get cleanup function\n const cleanup = registerNavItems(navItems);\n\n // Return cleanup function to unregister on unmount\n return cleanup;\n }, [registerNavItems, basePath]);\n\n // Register footer items (status indicator in left section)\n useEffect(() => {\n if (!registerFooterItems) return;\n\n const footerItems: FooterItem[] = [\n {\n id: 'notification-status',\n label: 'Notifications Ready',\n type: 'status',\n order: 10,\n section: 'left',\n },\n ];\n\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n }, [registerFooterItems]);\n\n return (\n <ErrorBoundary\n fallback={\n <div className=\"p-6 text-center text-text-secondary\">\n Something went wrong loading this module. Please refresh the page.\n </div>\n }\n >\n <FeatureFlagProvider workspaceId={null} gateway=\"global\" defaultEnabled={true}>\n <NotificationProvider {...props}>\n <NotificationRoutes />\n </NotificationProvider>\n </FeatureFlagProvider>\n </ErrorBoundary>\n );\n}\n"],"mappings":";;;;;;;;AAmCA,SAAgB,EAAiB,GAA8B;CAC7D,IAAM,EAAE,qBAAkB,wBAAqB,cAAW,QAAQ,GAG5D,KAAY,GAAc,OACZ,EAAK,SAAS,IAAI,GAAG,EAAK,MAAM,GAAG,GAAG,GAAG,MACzC,EAAK,WAAW,IAAI,GAAG,IAAO,IAAI;AA6EtD,QAxEA,QAAgB;AACT,QAkDL,QAHgB,EA7CY;GAC1B;IACE,IAAI;IACJ,OAAO;IACP,MAAM,EAAS,GAAU,SAAS;IAClC,MAAM,kBAAC,GAAD,EAAM,MAAM,IAAM,CAAA;IACxB,OAAO;IACP,OAAO;IACR;GACD;IACE,IAAI;IACJ,OAAO;IACP,MAAM,EAAS,GAAU,UAAU;IACnC,MAAM,kBAAC,GAAD,EAAS,MAAM,IAAM,CAAA;IAC3B,OAAO;IACP,OAAO;IACR;GACD;IACE,IAAI;IACJ,OAAO;IACP,MAAM,EAAS,GAAU,YAAY;IACrC,MAAM,kBAAC,GAAD,EAAU,MAAM,IAAM,CAAA;IAC5B,OAAO;IACP,OAAO;IAER;GACD;IACE,IAAI;IACJ,OAAO;IACP,MAAM,EAAS,GAAU,SAAS;IAClC,MAAM,kBAAC,GAAD,EAAK,MAAM,IAAM,CAAA;IACvB,OAAO;IACP,OAAO;IACR;GACD;IACE,IAAI;IACJ,OAAO;IACP,MAAM,EAAS,GAAU,cAAc;IACvC,MAAM,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA;IAC7B,OAAO;IACP,OAAO;IACR;GACF,CAGyC;IAIzC,CAAC,GAAkB,EAAS,CAAC,EAGhC,QAAgB;AACT,QAaL,QADgB,EAVkB,CAChC;GACE,IAAI;GACJ,OAAO;GACP,MAAM;GACN,OAAO;GACP,SAAS;GACV,CACF,CAE+C;IAE/C,CAAC,EAAoB,CAAC,EAGvB,kBAAC,GAAD;EACE,UACE,kBAAC,OAAD;GAAK,WAAU;aAAsC;GAE/C,CAAA;YAGR,kBAAC,GAAD;GAAqB,aAAa;GAAM,SAAQ;GAAS,gBAAgB;aACvE,kBAAC,GAAD;IAAsB,GAAI;cACxB,kBAAC,GAAD,EAAsB,CAAA;IACD,CAAA;GACH,CAAA;EACR,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal router for the Notification microfrontend.
|
|
3
|
+
* This component handles routing within the microfrontend using React Router v7.
|
|
4
|
+
*
|
|
5
|
+
* Routes:
|
|
6
|
+
* - / → Redirect to notification center
|
|
7
|
+
* - /center → Notification center (in-app notifications)
|
|
8
|
+
* - /history → Notification history and archive
|
|
9
|
+
* - /templates → Notification templates list (admin)
|
|
10
|
+
* - /templates/new → Create new template (admin)
|
|
11
|
+
* - /templates/:templateId → Edit template (admin)
|
|
12
|
+
* - /create → Create and send notification (admin)
|
|
13
|
+
* - /topics → Manage topics (admin)
|
|
14
|
+
* - /preferences → User topic preferences
|
|
15
|
+
*/
|
|
16
|
+
export declare function NotificationRoutes(): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=NotificationRoutes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationRoutes.d.ts","sourceRoot":"","sources":["../src/NotificationRoutes.tsx"],"names":[],"mappings":"AA0CA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,4CA0BjC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { NotificationCenterPage as e } from "./pages/NotificationCenterPage.js";
|
|
2
|
+
import { NotificationLandingPage as t } from "./pages/NotificationLandingPage.js";
|
|
3
|
+
import { Suspense as n, lazy as r } from "react";
|
|
4
|
+
import { Navigate as i, Route as a, Routes as o } from "react-router-dom";
|
|
5
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
6
|
+
//#region src/NotificationRoutes.tsx
|
|
7
|
+
var l = r(() => import("./pages/NotificationHistoryPage.js").then((e) => ({ default: e.NotificationHistoryPage }))), u = r(() => import("./pages/NotificationTemplatesPage.js").then((e) => ({ default: e.NotificationTemplatesPage }))), d = r(() => import("./pages/TemplateEditorPage.js").then((e) => ({ default: e.TemplateEditorPage }))), f = r(() => import("./pages/CreateNotificationPage.js").then((e) => ({ default: e.CreateNotificationPage }))), p = r(() => import("./pages/NotificationTopicsPage.js").then((e) => ({ default: e.NotificationTopicsPage }))), m = r(() => import("./pages/NotificationPreferencesPage.js").then((e) => ({ default: e.NotificationPreferencesPage })));
|
|
8
|
+
function h() {
|
|
9
|
+
return /* @__PURE__ */ s("div", {
|
|
10
|
+
className: "flex h-64 items-center justify-center",
|
|
11
|
+
children: /* @__PURE__ */ s("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function g() {
|
|
15
|
+
return /* @__PURE__ */ s(n, {
|
|
16
|
+
fallback: /* @__PURE__ */ s(h, {}),
|
|
17
|
+
children: /* @__PURE__ */ c(o, { children: [
|
|
18
|
+
/* @__PURE__ */ s(a, {
|
|
19
|
+
index: !0,
|
|
20
|
+
element: /* @__PURE__ */ s(t, {})
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ s(a, {
|
|
23
|
+
path: "center",
|
|
24
|
+
element: /* @__PURE__ */ s(e, {})
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ s(a, {
|
|
27
|
+
path: "history",
|
|
28
|
+
element: /* @__PURE__ */ s(l, {})
|
|
29
|
+
}),
|
|
30
|
+
/* @__PURE__ */ s(a, {
|
|
31
|
+
path: "templates",
|
|
32
|
+
element: /* @__PURE__ */ s(u, {})
|
|
33
|
+
}),
|
|
34
|
+
/* @__PURE__ */ s(a, {
|
|
35
|
+
path: "templates/new",
|
|
36
|
+
element: /* @__PURE__ */ s(d, {})
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ s(a, {
|
|
39
|
+
path: "templates/:templateId",
|
|
40
|
+
element: /* @__PURE__ */ s(d, {})
|
|
41
|
+
}),
|
|
42
|
+
/* @__PURE__ */ s(a, {
|
|
43
|
+
path: "create",
|
|
44
|
+
element: /* @__PURE__ */ s(f, {})
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ s(a, {
|
|
47
|
+
path: "topics",
|
|
48
|
+
element: /* @__PURE__ */ s(p, {})
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ s(a, {
|
|
51
|
+
path: "preferences",
|
|
52
|
+
element: /* @__PURE__ */ s(m, {})
|
|
53
|
+
}),
|
|
54
|
+
/* @__PURE__ */ s(a, {
|
|
55
|
+
path: "*",
|
|
56
|
+
element: /* @__PURE__ */ s(i, {
|
|
57
|
+
to: "center",
|
|
58
|
+
replace: !0
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
] })
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { g as NotificationRoutes };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=NotificationRoutes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationRoutes.js","names":[],"sources":["../src/NotificationRoutes.tsx"],"sourcesContent":["import { lazy, Suspense } from 'react';\nimport { Navigate, Route, Routes } from 'react-router-dom';\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 * - / → Redirect to notification center\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 */\nexport function NotificationRoutes() {\n return (\n <Suspense fallback={<PageLoader />}>\n <Routes>\n {/* Tabbed landing - default route */}\n <Route index element={<NotificationLandingPage />} />\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 - redirect to center (relative path so it works with any basePath) */}\n <Route path=\"*\" element={<Navigate to=\"center\" replace />} />\n </Routes>\n </Suspense>\n );\n}\n"],"mappings":";;;;;;AAQA,IAAM,IAA0B,QAC9B,OAAO,sCAAmC,MAAM,OAAO,EACrD,SAAS,EAAE,yBACZ,EAAE,CACJ,EACK,IAA4B,QAChC,OAAO,wCAAqC,MAAM,OAAO,EACvD,SAAS,EAAE,2BACZ,EAAE,CACJ,EACK,IAAqB,QACzB,OAAO,iCAA8B,MAAM,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,CACtF,EACK,IAAyB,QAC7B,OAAO,qCAAkC,MAAM,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,CAC9F,EACK,IAAyB,QAC7B,OAAO,qCAAkC,MAAM,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,CAC9F,EACK,IAA8B,QAClC,OAAO,0CAAuC,MAAM,OAAO,EACzD,SAAS,EAAE,6BACZ,EAAE,CACJ;AAGD,SAAS,IAAa;AACpB,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD,EAAK,WAAU,kFAAmF,CAAA;EAC9F,CAAA;;AAmBV,SAAgB,IAAqB;AACnC,QACE,kBAAC,GAAD;EAAU,UAAU,kBAAC,GAAD,EAAc,CAAA;YAChC,kBAAC,GAAD,EAAA,UAAA;GAEE,kBAAC,GAAD;IAAO,OAAA;IAAM,SAAS,kBAAC,GAAD,EAA2B,CAAA;IAAI,CAAA;GAGrD,kBAAC,GAAD;IAAO,MAAK;IAAS,SAAS,kBAAC,GAAD,EAA0B,CAAA;IAAI,CAAA;GAC5D,kBAAC,GAAD;IAAO,MAAK;IAAU,SAAS,kBAAC,GAAD,EAA2B,CAAA;IAAI,CAAA;GAG9D,kBAAC,GAAD;IAAO,MAAK;IAAY,SAAS,kBAAC,GAAD,EAA6B,CAAA;IAAI,CAAA;GAClE,kBAAC,GAAD;IAAO,MAAK;IAAgB,SAAS,kBAAC,GAAD,EAAsB,CAAA;IAAI,CAAA;GAC/D,kBAAC,GAAD;IAAO,MAAK;IAAwB,SAAS,kBAAC,GAAD,EAAsB,CAAA;IAAI,CAAA;GAGvE,kBAAC,GAAD;IAAO,MAAK;IAAS,SAAS,kBAAC,GAAD,EAA0B,CAAA;IAAI,CAAA;GAC5D,kBAAC,GAAD;IAAO,MAAK;IAAS,SAAS,kBAAC,GAAD,EAA0B,CAAA;IAAI,CAAA;GAC5D,kBAAC,GAAD;IAAO,MAAK;IAAc,SAAS,kBAAC,GAAD,EAA+B,CAAA;IAAI,CAAA;GAGtE,kBAAC,GAAD;IAAO,MAAK;IAAI,SAAS,kBAAC,GAAD;KAAU,IAAG;KAAS,SAAA;KAAU,CAAA;IAAI,CAAA;GACtD,EAAA,CAAA;EACA,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { NotificationRootProps } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* User Root component for the Notification microfrontend.
|
|
5
|
+
*
|
|
6
|
+
* This is the entry point host product shells should import. It exposes only
|
|
7
|
+
* the user-facing notification surfaces (Notification Center, History) and
|
|
8
|
+
* sets up the required provider stack.
|
|
9
|
+
*
|
|
10
|
+
* For the full admin experience (templates, create/send notification) use
|
|
11
|
+
* `AdminNotificationRoot` instead.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { UserNotificationRoot, type NotificationRootProps } from '@burdenoff/micro-fe/notification';
|
|
16
|
+
*
|
|
17
|
+
* function App() {
|
|
18
|
+
* const props: NotificationRootProps = {
|
|
19
|
+
* basePath: '/notifications',
|
|
20
|
+
* navigate: (path) => router.push(path),
|
|
21
|
+
* currentUser: { id: '1', email: 'user@example.com' },
|
|
22
|
+
* workspaceId: 'ws-123',
|
|
23
|
+
* apiGatewayUrl: 'https://api.example.com',
|
|
24
|
+
* authToken: 'token',
|
|
25
|
+
* registerNavItems: (items) => { return () => {}; },
|
|
26
|
+
* onNotificationClick: (notification) => console.log('Clicked:', notification),
|
|
27
|
+
* };
|
|
28
|
+
*
|
|
29
|
+
* return <UserNotificationRoot {...props} />;
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function UserNotificationRoot(props: NotificationRootProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
//# sourceMappingURL=UserNotificationRoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserNotificationRoot.d.ts","sourceRoot":"","sources":["../src/UserNotificationRoot.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAuB,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAG1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,qBAAqB,2CA4FhE"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { NotificationProvider as e } from "./providers/NotificationProvider.js";
|
|
2
|
+
import { UserNotificationRoutes as t } from "./UserNotificationRoutes.js";
|
|
3
|
+
import { useEffect as n } from "react";
|
|
4
|
+
import { ErrorBoundary as r } from "@burdenoff/fe-libs/shared/components";
|
|
5
|
+
import { useFeatureFlagDetails as i } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
6
|
+
import { Archive as a, Bell as o, Settings2 as s } from "lucide-react";
|
|
7
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
8
|
+
//#region src/UserNotificationRoot.tsx
|
|
9
|
+
function l(l) {
|
|
10
|
+
let { registerNavItems: u, registerFooterItems: d, basePath: f = "/" } = l, p = i("notification.history"), m = p ? !!p.value : !1, h = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
|
|
11
|
+
return n(() => {
|
|
12
|
+
if (u) return u([
|
|
13
|
+
{
|
|
14
|
+
id: "user-notification-center",
|
|
15
|
+
label: "Notification Center",
|
|
16
|
+
path: h(f, "center"),
|
|
17
|
+
icon: /* @__PURE__ */ c(o, { size: 20 }),
|
|
18
|
+
order: 10,
|
|
19
|
+
group: "notifications"
|
|
20
|
+
},
|
|
21
|
+
...m ? [{
|
|
22
|
+
id: "user-notification-history",
|
|
23
|
+
label: "History",
|
|
24
|
+
path: h(f, "history"),
|
|
25
|
+
icon: /* @__PURE__ */ c(a, { size: 20 }),
|
|
26
|
+
order: 20,
|
|
27
|
+
group: "notifications"
|
|
28
|
+
}] : [],
|
|
29
|
+
{
|
|
30
|
+
id: "user-notification-preferences",
|
|
31
|
+
label: "Preferences",
|
|
32
|
+
path: h(f, "preferences"),
|
|
33
|
+
icon: /* @__PURE__ */ c(s, { size: 20 }),
|
|
34
|
+
order: 30,
|
|
35
|
+
group: "notifications"
|
|
36
|
+
}
|
|
37
|
+
]);
|
|
38
|
+
}, [
|
|
39
|
+
u,
|
|
40
|
+
f,
|
|
41
|
+
m
|
|
42
|
+
]), n(() => {
|
|
43
|
+
if (d) return d([{
|
|
44
|
+
id: "user-notification-status",
|
|
45
|
+
label: "Notifications Ready",
|
|
46
|
+
type: "status",
|
|
47
|
+
order: 10,
|
|
48
|
+
section: "left"
|
|
49
|
+
}]);
|
|
50
|
+
}, [d]), /* @__PURE__ */ c(r, {
|
|
51
|
+
fallback: /* @__PURE__ */ c("div", {
|
|
52
|
+
className: "p-6 text-center text-text-secondary",
|
|
53
|
+
children: "Something went wrong loading this module. Please refresh the page."
|
|
54
|
+
}),
|
|
55
|
+
children: /* @__PURE__ */ c(e, {
|
|
56
|
+
...l,
|
|
57
|
+
children: /* @__PURE__ */ c(t, {})
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { l as UserNotificationRoot };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=UserNotificationRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserNotificationRoot.js","names":[],"sources":["../src/UserNotificationRoot.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { ErrorBoundary } from '@burdenoff/fe-libs/shared/components';\nimport { useFeatureFlagDetails } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { Bell, Archive, Settings2 } from 'lucide-react';\nimport { NotificationProvider } from './providers/NotificationProvider';\nimport type { NavItem, FooterItem, NotificationRootProps } from './types';\nimport { UserNotificationRoutes } from './UserNotificationRoutes';\n\n/**\n * User Root component for the Notification microfrontend.\n *\n * This is the entry point host product shells should import. It exposes only\n * the user-facing notification surfaces (Notification Center, History) and\n * sets up the required provider stack.\n *\n * For the full admin experience (templates, create/send notification) use\n * `AdminNotificationRoot` instead.\n *\n * @example\n * ```tsx\n * import { UserNotificationRoot, type NotificationRootProps } from '@burdenoff/micro-fe/notification';\n *\n * function App() {\n * const props: NotificationRootProps = {\n * basePath: '/notifications',\n * navigate: (path) => router.push(path),\n * currentUser: { id: '1', email: 'user@example.com' },\n * workspaceId: 'ws-123',\n * apiGatewayUrl: 'https://api.example.com',\n * authToken: 'token',\n * registerNavItems: (items) => { return () => {}; },\n * onNotificationClick: (notification) => console.log('Clicked:', notification),\n * };\n *\n * return <UserNotificationRoot {...props} />;\n * }\n * ```\n */\nexport function UserNotificationRoot(props: NotificationRootProps) {\n const { registerNavItems, registerFooterItems, basePath = '/' } = props;\n\n // Component-level feature gate. `notification.history` is declared as\n // unreleased (defaultValue=false). We use `useFeatureFlagDetails` and\n // explicitly fall back to `false` when the flag is absent from the cache,\n // because the provider's global default-allow would otherwise return `true`\n // for unseeded flags — which would defeat the whole point of the unreleased\n // pattern.\n const historyDetails = useFeatureFlagDetails('notification.history');\n const historyEnabled = historyDetails ? Boolean(historyDetails.value) : false;\n\n // Helper to join paths correctly, avoiding double slashes\n const joinPath = (base: string, path: string): string => {\n const cleanBase = base.endsWith('/') ? base.slice(0, -1) : base;\n const cleanPath = path.startsWith('/') ? path : `/${path}`;\n return cleanBase + cleanPath;\n };\n\n // Register navigation items with the shell (user-facing only)\n useEffect(() => {\n if (!registerNavItems) return;\n\n const navItems: NavItem[] = [\n {\n id: 'user-notification-center',\n label: 'Notification Center',\n path: joinPath(basePath, 'center'),\n icon: <Bell size={20} />,\n order: 10,\n group: 'notifications',\n },\n ...(historyEnabled\n ? [\n {\n id: 'user-notification-history',\n label: 'History',\n path: joinPath(basePath, 'history'),\n icon: <Archive size={20} />,\n order: 20,\n group: 'notifications',\n },\n ]\n : []),\n {\n id: 'user-notification-preferences',\n label: 'Preferences',\n path: joinPath(basePath, 'preferences'),\n icon: <Settings2 size={20} />,\n order: 30,\n group: 'notifications',\n },\n ];\n\n // Register and get cleanup function\n const cleanup = registerNavItems(navItems);\n\n // Return cleanup function to unregister on unmount\n return cleanup;\n }, [registerNavItems, basePath, historyEnabled]);\n\n // Register footer items (status indicator in left section)\n useEffect(() => {\n if (!registerFooterItems) return;\n\n const footerItems: FooterItem[] = [\n {\n id: 'user-notification-status',\n label: 'Notifications Ready',\n type: 'status',\n order: 10,\n section: 'left',\n },\n ];\n\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n }, [registerFooterItems]);\n\n return (\n <ErrorBoundary\n fallback={\n <div className=\"p-6 text-center text-text-secondary\">\n Something went wrong loading this module. Please refresh the page.\n </div>\n }\n >\n <NotificationProvider {...props}>\n <UserNotificationRoutes />\n </NotificationProvider>\n </ErrorBoundary>\n );\n}\n"],"mappings":";;;;;;;;AAsCA,SAAgB,EAAqB,GAA8B;CACjE,IAAM,EAAE,qBAAkB,wBAAqB,cAAW,QAAQ,GAQ5D,IAAiB,EAAsB,uBAAuB,EAC9D,IAAiB,IAAiB,EAAQ,EAAe,QAAS,IAGlE,KAAY,GAAc,OACZ,EAAK,SAAS,IAAI,GAAG,EAAK,MAAM,GAAG,GAAG,GAAG,MACzC,EAAK,WAAW,IAAI,GAAG,IAAO,IAAI;AAgEtD,QA3DA,QAAgB;AACT,QAqCL,QAHgB,EAhCY;GAC1B;IACE,IAAI;IACJ,OAAO;IACP,MAAM,EAAS,GAAU,SAAS;IAClC,MAAM,kBAAC,GAAD,EAAM,MAAM,IAAM,CAAA;IACxB,OAAO;IACP,OAAO;IACR;GACD,GAAI,IACA,CACE;IACE,IAAI;IACJ,OAAO;IACP,MAAM,EAAS,GAAU,UAAU;IACnC,MAAM,kBAAC,GAAD,EAAS,MAAM,IAAM,CAAA;IAC3B,OAAO;IACP,OAAO;IACR,CACF,GACD,EAAE;GACN;IACE,IAAI;IACJ,OAAO;IACP,MAAM,EAAS,GAAU,cAAc;IACvC,MAAM,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA;IAC7B,OAAO;IACP,OAAO;IACR;GACF,CAGyC;IAIzC;EAAC;EAAkB;EAAU;EAAe,CAAC,EAGhD,QAAgB;AACT,QAaL,QADgB,EAVkB,CAChC;GACE,IAAI;GACJ,OAAO;GACP,MAAM;GACN,OAAO;GACP,SAAS;GACV,CACF,CAE+C;IAE/C,CAAC,EAAoB,CAAC,EAGvB,kBAAC,GAAD;EACE,UACE,kBAAC,OAAD;GAAK,WAAU;aAAsC;GAE/C,CAAA;YAGR,kBAAC,GAAD;GAAsB,GAAI;aACxB,kBAAC,GAAD,EAA0B,CAAA;GACL,CAAA;EACT,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal router for the User-facing Notification microfrontend.
|
|
3
|
+
* This component handles routing within the microfrontend using React Router v7.
|
|
4
|
+
*
|
|
5
|
+
* Only exposes user-facing routes intended for product shells. RBAC permissions
|
|
6
|
+
* still gate in-page actions via usePermissions checks.
|
|
7
|
+
*
|
|
8
|
+
* Routes:
|
|
9
|
+
* - / → Redirect to notification center
|
|
10
|
+
* - /center → Notification center (in-app notifications)
|
|
11
|
+
* - /history → Notification history and archive
|
|
12
|
+
* - /preferences → Topic subscriptions and preferences
|
|
13
|
+
*/
|
|
14
|
+
export declare function UserNotificationRoutes(): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=UserNotificationRoutes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserNotificationRoutes.d.ts","sourceRoot":"","sources":["../src/UserNotificationRoutes.tsx"],"names":[],"mappings":"AA4BA;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,4CA0BrC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { NotificationCenterPage as e } from "./pages/NotificationCenterPage.js";
|
|
2
|
+
import { Suspense as t, lazy as n } from "react";
|
|
3
|
+
import { useFeatureFlagDetails as r } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
4
|
+
import { Navigate as i, Route as a, Routes as o } from "react-router-dom";
|
|
5
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
6
|
+
//#region src/UserNotificationRoutes.tsx
|
|
7
|
+
var l = n(() => import("./pages/NotificationHistoryPage.js").then((e) => ({ default: e.NotificationHistoryPage }))), u = n(() => import("./pages/NotificationPreferencesPage.js").then((e) => ({ default: e.NotificationPreferencesPage })));
|
|
8
|
+
function d() {
|
|
9
|
+
return /* @__PURE__ */ s("div", {
|
|
10
|
+
className: "flex h-64 items-center justify-center",
|
|
11
|
+
children: /* @__PURE__ */ s("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function f() {
|
|
15
|
+
let n = r("notification.history"), f = n ? !!n.value : !1;
|
|
16
|
+
return /* @__PURE__ */ s(t, {
|
|
17
|
+
fallback: /* @__PURE__ */ s(d, {}),
|
|
18
|
+
children: /* @__PURE__ */ c(o, { children: [
|
|
19
|
+
/* @__PURE__ */ s(a, {
|
|
20
|
+
index: !0,
|
|
21
|
+
element: /* @__PURE__ */ s(i, {
|
|
22
|
+
to: "center",
|
|
23
|
+
replace: !0
|
|
24
|
+
})
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ s(a, {
|
|
27
|
+
path: "center",
|
|
28
|
+
element: /* @__PURE__ */ s(e, {})
|
|
29
|
+
}),
|
|
30
|
+
f && /* @__PURE__ */ s(a, {
|
|
31
|
+
path: "history",
|
|
32
|
+
element: /* @__PURE__ */ s(l, {})
|
|
33
|
+
}),
|
|
34
|
+
/* @__PURE__ */ s(a, {
|
|
35
|
+
path: "preferences",
|
|
36
|
+
element: /* @__PURE__ */ s(u, {})
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ s(a, {
|
|
39
|
+
path: "*",
|
|
40
|
+
element: /* @__PURE__ */ s(i, {
|
|
41
|
+
to: "..",
|
|
42
|
+
replace: !0,
|
|
43
|
+
relative: "path"
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
] })
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { f as UserNotificationRoutes };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=UserNotificationRoutes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserNotificationRoutes.js","names":[],"sources":["../src/UserNotificationRoutes.tsx"],"sourcesContent":["import { lazy, Suspense } from 'react';\nimport { Navigate, Route, Routes } from 'react-router-dom';\nimport { useFeatureFlagDetails } from '@burdenoff/fe-libs/shared/feature-flags';\n\n// Eager load - Primary landing page\nimport { NotificationCenterPage } from './pages/NotificationCenterPage';\n\n// Lazy load - Secondary pages\nconst NotificationHistoryPage = lazy(() =>\n import('./pages/NotificationHistoryPage').then((m) => ({\n default: m.NotificationHistoryPage,\n }))\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 User-facing Notification microfrontend.\n * This component handles routing within the microfrontend using React Router v7.\n *\n * Only exposes user-facing routes intended for product shells. RBAC permissions\n * still gate in-page actions via usePermissions checks.\n *\n * Routes:\n * - / → Redirect to notification center\n * - /center → Notification center (in-app notifications)\n * - /history → Notification history and archive\n * - /preferences → Topic subscriptions and preferences\n */\nexport function UserNotificationRoutes() {\n // Component-level feature gate. `notification.history` is declared as\n // unreleased (defaultValue=false). We use `useFeatureFlagDetails` and\n // explicitly fall back to `false` when the flag is absent from the cache,\n // because the provider's global default-allow would otherwise return `true`\n // for unseeded flags — which would defeat the whole point of the unreleased\n // pattern.\n const historyDetails = useFeatureFlagDetails('notification.history');\n const historyEnabled = historyDetails ? Boolean(historyDetails.value) : false;\n\n return (\n <Suspense fallback={<PageLoader />}>\n <Routes>\n {/* Default redirect to notification center */}\n <Route index element={<Navigate to=\"center\" replace />} />\n\n {/* User-facing routes (all users) */}\n <Route path=\"center\" element={<NotificationCenterPage />} />\n {historyEnabled && <Route path=\"history\" element={<NotificationHistoryPage />} />}\n <Route path=\"preferences\" element={<NotificationPreferencesPage />} />\n\n {/* Catch-all route - redirect to index using path-relative navigation */}\n <Route path=\"*\" element={<Navigate to=\"..\" replace relative=\"path\" />} />\n </Routes>\n </Suspense>\n );\n}\n"],"mappings":";;;;;;AAQA,IAAM,IAA0B,QAC9B,OAAO,sCAAmC,MAAM,OAAO,EACrD,SAAS,EAAE,yBACZ,EAAE,CACJ,EACK,IAA8B,QAClC,OAAO,0CAAuC,MAAM,OAAO,EACzD,SAAS,EAAE,6BACZ,EAAE,CACJ;AAGD,SAAS,IAAa;AACpB,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD,EAAK,WAAU,kFAAmF,CAAA;EAC9F,CAAA;;AAiBV,SAAgB,IAAyB;CAOvC,IAAM,IAAiB,EAAsB,uBAAuB,EAC9D,IAAiB,IAAiB,EAAQ,EAAe,QAAS;AAExE,QACE,kBAAC,GAAD;EAAU,UAAU,kBAAC,GAAD,EAAc,CAAA;YAChC,kBAAC,GAAD,EAAA,UAAA;GAEE,kBAAC,GAAD;IAAO,OAAA;IAAM,SAAS,kBAAC,GAAD;KAAU,IAAG;KAAS,SAAA;KAAU,CAAA;IAAI,CAAA;GAG1D,kBAAC,GAAD;IAAO,MAAK;IAAS,SAAS,kBAAC,GAAD,EAA0B,CAAA;IAAI,CAAA;GAC3D,KAAkB,kBAAC,GAAD;IAAO,MAAK;IAAU,SAAS,kBAAC,GAAD,EAA2B,CAAA;IAAI,CAAA;GACjF,kBAAC,GAAD;IAAO,MAAK;IAAc,SAAS,kBAAC,GAAD,EAA+B,CAAA;IAAI,CAAA;GAGtE,kBAAC,GAAD;IAAO,MAAK;IAAI,SAAS,kBAAC,GAAD;KAAU,IAAG;KAAK,SAAA;KAAQ,UAAS;KAAS,CAAA;IAAI,CAAA;GAClE,EAAA,CAAA;EACA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/__tests__/setup.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification bell icon with unread count badge
|
|
3
|
+
*
|
|
4
|
+
* This component should be placed in the global header/navbar
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <NotificationBell onClick={() => navigate('/notifications/center')} />
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare function NotificationBell({ onClick }: {
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=NotificationBell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationBell.d.ts","sourceRoot":"","sources":["../../src/components/NotificationBell.tsx"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,2CAqDrE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useNotification as e } from "../providers/NotificationProvider.js";
|
|
2
|
+
import { getGlobalNotificationClient as t } from "../graphql/global-client.js";
|
|
3
|
+
import { useNotificationStore as n } from "../store/notificationStore.js";
|
|
4
|
+
import { GetMyUnreadNotificationCountDocument as r } from "../generated/global-operations.js";
|
|
5
|
+
import { useTr as i } from "../shared/hooks/useTr.js";
|
|
6
|
+
import { useCallback as a, useEffect as o } from "react";
|
|
7
|
+
import { Bell as s } from "lucide-react";
|
|
8
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/NotificationBell.tsx
|
|
10
|
+
function u({ onClick: u }) {
|
|
11
|
+
let d = i(), { authToken: f, apiGatewayUrl: p } = e(), { unreadCount: m, togglePanel: h, setUnreadCount: g } = n(), _ = a(async () => {
|
|
12
|
+
try {
|
|
13
|
+
let e = await t(p ?? void 0, f ?? void 0).query({
|
|
14
|
+
query: r,
|
|
15
|
+
variables: { filter: { channel: "IN_APP" } },
|
|
16
|
+
fetchPolicy: "network-only"
|
|
17
|
+
});
|
|
18
|
+
typeof e.data?.myUnreadNotificationCount == "number" && g(e.data.myUnreadNotificationCount);
|
|
19
|
+
} catch {}
|
|
20
|
+
}, [
|
|
21
|
+
p,
|
|
22
|
+
f,
|
|
23
|
+
g
|
|
24
|
+
]);
|
|
25
|
+
return o(() => {
|
|
26
|
+
_();
|
|
27
|
+
let e = window.setInterval(_, 5e3);
|
|
28
|
+
return () => window.clearInterval(e);
|
|
29
|
+
}, [_]), /* @__PURE__ */ l("button", {
|
|
30
|
+
onClick: () => {
|
|
31
|
+
u ? u() : h();
|
|
32
|
+
},
|
|
33
|
+
className: "relative inline-flex items-center justify-center p-2 rounded-md hover:bg-muted transition-all duration-150 hover:scale-105",
|
|
34
|
+
"aria-label": `${d("notifCommon.notifications", "Notifications")}${m > 0 ? ` (${m} ${d("notifCommon.unread", "unread")})` : ""}`,
|
|
35
|
+
children: [/* @__PURE__ */ c(s, {
|
|
36
|
+
size: 20,
|
|
37
|
+
className: "text-primary"
|
|
38
|
+
}), m > 0 && /* @__PURE__ */ c("span", {
|
|
39
|
+
className: "absolute top-1 right-1 flex items-center justify-center min-w-[18px] h-[18px] px-1 text-xs font-semibold text-white bg-error rounded-full animate-pulse",
|
|
40
|
+
children: m > 99 ? "99+" : m
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { u as NotificationBell };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=NotificationBell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationBell.js","names":[],"sources":["../../src/components/NotificationBell.tsx"],"sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { Bell } from 'lucide-react';\nimport { useNotification } from '../providers/NotificationProvider';\nimport { getGlobalNotificationClient } from '../graphql/global-client';\nimport { GetMyUnreadNotificationCountDocument } from '../generated/global-operations';\nimport type { GetMyUnreadNotificationCountQuery } from '../generated/global-operations';\nimport { useNotificationStore } from '../store/notificationStore';\nimport { useTr } from '../shared/hooks/useTr';\n\n/**\n * Notification bell icon with unread count badge\n *\n * This component should be placed in the global header/navbar\n *\n * @example\n * ```tsx\n * <NotificationBell onClick={() => navigate('/notifications/center')} />\n * ```\n */\nexport function NotificationBell({ onClick }: { onClick?: () => void }) {\n const tr = useTr();\n const { authToken, apiGatewayUrl } = useNotification();\n const { unreadCount, togglePanel, setUnreadCount } = useNotificationStore();\n\n const refreshUnreadCount = useCallback(async () => {\n try {\n const client = getGlobalNotificationClient(\n apiGatewayUrl ?? undefined,\n authToken ?? undefined\n );\n const result = await client.query<GetMyUnreadNotificationCountQuery>({\n query: GetMyUnreadNotificationCountDocument,\n variables: { filter: { channel: 'IN_APP' } },\n fetchPolicy: 'network-only',\n });\n\n if (typeof result.data?.myUnreadNotificationCount === 'number') {\n setUnreadCount(result.data.myUnreadNotificationCount);\n }\n } catch {\n // Keep bell resilient; do not surface errors here.\n }\n }, [apiGatewayUrl, authToken, setUnreadCount]);\n\n useEffect(() => {\n refreshUnreadCount();\n const interval = window.setInterval(refreshUnreadCount, 5000);\n return () => window.clearInterval(interval);\n }, [refreshUnreadCount]);\n\n const handleClick = () => {\n if (onClick) {\n onClick();\n } else {\n togglePanel();\n }\n };\n\n return (\n <button\n onClick={handleClick}\n className=\"relative inline-flex items-center justify-center p-2 rounded-md hover:bg-muted transition-all duration-150 hover:scale-105\"\n aria-label={`${tr('notifCommon.notifications', 'Notifications')}${unreadCount > 0 ? ` (${unreadCount} ${tr('notifCommon.unread', 'unread')})` : ''}`}\n >\n <Bell size={20} className=\"text-primary\" />\n {unreadCount > 0 && (\n <span className=\"absolute top-1 right-1 flex items-center justify-center min-w-[18px] h-[18px] px-1 text-xs font-semibold text-white bg-error rounded-full animate-pulse\">\n {unreadCount > 99 ? '99+' : unreadCount}\n </span>\n )}\n </button>\n );\n}\n"],"mappings":";;;;;;;;;AAmBA,SAAgB,EAAiB,EAAE,cAAqC;CACtE,IAAM,IAAK,GAAO,EACZ,EAAE,cAAW,qBAAkB,GAAiB,EAChD,EAAE,gBAAa,gBAAa,sBAAmB,GAAsB,EAErE,IAAqB,EAAY,YAAY;AACjD,MAAI;GAKF,IAAM,IAAS,MAJA,EACb,KAAiB,KAAA,GACjB,KAAa,KAAA,EACd,CAC2B,MAAyC;IACnE,OAAO;IACP,WAAW,EAAE,QAAQ,EAAE,SAAS,UAAU,EAAE;IAC5C,aAAa;IACd,CAAC;AAEF,GAAI,OAAO,EAAO,MAAM,6BAA8B,YACpD,EAAe,EAAO,KAAK,0BAA0B;UAEjD;IAGP;EAAC;EAAe;EAAW;EAAe,CAAC;AAgB9C,QAdA,QAAgB;AACd,KAAoB;EACpB,IAAM,IAAW,OAAO,YAAY,GAAoB,IAAK;AAC7D,eAAa,OAAO,cAAc,EAAS;IAC1C,CAAC,EAAmB,CAAC,EAWtB,kBAAC,UAAD;EACE,eAVsB;AACxB,GAAI,IACF,GAAS,GAET,GAAa;;EAOb,WAAU;EACV,cAAY,GAAG,EAAG,6BAA6B,gBAAgB,GAAG,IAAc,IAAI,KAAK,EAAY,GAAG,EAAG,sBAAsB,SAAS,CAAC,KAAK;YAHlJ,CAKE,kBAAC,GAAD;GAAM,MAAM;GAAI,WAAU;GAAiB,CAAA,EAC1C,IAAc,KACb,kBAAC,QAAD;GAAM,WAAU;aACb,IAAc,KAAK,QAAQ;GACvB,CAAA,CAEF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Notification } from '../types';
|
|
2
|
+
|
|
3
|
+
interface NotificationCardProps {
|
|
4
|
+
notification: Notification;
|
|
5
|
+
onMarkAsRead?: (id: string) => void;
|
|
6
|
+
onArchive?: (id: string) => void;
|
|
7
|
+
onAction?: (notificationId: string, actionId?: string) => void;
|
|
8
|
+
onClick?: (notification: Notification) => void;
|
|
9
|
+
showArchivedState?: boolean;
|
|
10
|
+
compact?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Notification card component
|
|
14
|
+
*
|
|
15
|
+
* Displays notification information with action buttons
|
|
16
|
+
*/
|
|
17
|
+
export declare function NotificationCard({ notification, onMarkAsRead, onArchive, onAction, onClick, showArchivedState, compact, }: NotificationCardProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=NotificationCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationCard.d.ts","sourceRoot":"","sources":["../../src/components/NotificationCard.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAU7C,UAAU,qBAAqB;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IAC/C,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,OAAO,EACP,iBAAyB,EACzB,OAAe,GAChB,EAAE,qBAAqB,2CAkJvB"}
|