@burdenoff/microfe-notification 2026.529.1 → 2026.531.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/AdminNotificationRoutes.js +15 -15
- package/dist/NotificationRoot.js +38 -30
- package/dist/NotificationRoot.js.map +1 -1
- package/dist/UserNotificationRoot.js +30 -25
- package/dist/UserNotificationRoot.js.map +1 -1
- package/dist/pages/CreateNotificationPage.js +23 -23
- package/dist/pages/NotificationCenterPage.js +5 -5
- package/dist/pages/NotificationHistoryAdminPage.js +7 -7
- package/dist/pages/NotificationHistoryPage.js +6 -6
- package/dist/pages/NotificationPreferencesPage.js +6 -6
- package/dist/pages/NotificationTemplatesPage.js +16 -16
- package/dist/pages/NotificationTopicsPage.js +7 -7
- package/dist/pages/TemplateEditorPage.js +10 -10
- package/dist/providers/NotificationProvider.js +4 -4
- package/package.json +1 -1
|
@@ -6,8 +6,8 @@ import { FeatureDisabledPage as i } from "./components/FeatureDisabledPage.js";
|
|
|
6
6
|
import { Suspense as a, lazy as o, useEffect as s } from "react";
|
|
7
7
|
import { PermissionGate as c } from "@burdenoff/fe-libs/shared/components";
|
|
8
8
|
import { useFeatureFlagDetails as l } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { useGlobalUi as u } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
10
|
+
import { Navigate as d, Route as f, Routes as p, useNavigate as m } from "react-router-dom";
|
|
11
11
|
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
12
12
|
//#region src/AdminNotificationRoutes.tsx
|
|
13
13
|
var _ = o(() => import("./pages/NotificationHistoryAdminPage.js").then((e) => ({ default: e.NotificationHistoryAdminPage }))), v = o(() => import("./pages/NotificationTemplatesPage.js").then((e) => ({ default: e.NotificationTemplatesPage }))), y = o(() => import("./pages/TemplateEditorPage.js").then((e) => ({ default: e.TemplateEditorPage }))), b = o(() => import("./pages/CreateNotificationPage.js").then((e) => ({ default: e.CreateNotificationPage }))), x = o(() => import("./pages/NotificationTopicsPage.js").then((e) => ({ default: e.NotificationTopicsPage })));
|
|
@@ -18,7 +18,7 @@ function S() {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
function C() {
|
|
21
|
-
let { showToast: t } =
|
|
21
|
+
let { showToast: t } = u(), n = m(), { basePath: r } = e();
|
|
22
22
|
return s(() => {
|
|
23
23
|
t("You do not have permission to access that notification page.", "warning"), n(`${r}/center`, { replace: !0 });
|
|
24
24
|
}, []), null;
|
|
@@ -35,26 +35,26 @@ function w(e) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
function T() {
|
|
38
|
-
let e = l("notification.templates"), o = l("notification.create"), s = l("notification.history"), c = e ? !!e.value : !1,
|
|
38
|
+
let e = l("notification.templates"), o = l("notification.create"), s = l("notification.history"), c = e ? !!e.value : !1, u = o ? !!o.value : !1, m = s ? !!s.value : !1;
|
|
39
39
|
return /* @__PURE__ */ h(a, {
|
|
40
40
|
fallback: /* @__PURE__ */ h(S, {}),
|
|
41
|
-
children: /* @__PURE__ */ g(
|
|
42
|
-
/* @__PURE__ */ h(
|
|
41
|
+
children: /* @__PURE__ */ g(p, { children: [
|
|
42
|
+
/* @__PURE__ */ h(f, {
|
|
43
43
|
index: !0,
|
|
44
44
|
element: /* @__PURE__ */ h(r, {})
|
|
45
45
|
}),
|
|
46
|
-
/* @__PURE__ */ h(
|
|
46
|
+
/* @__PURE__ */ h(f, {
|
|
47
47
|
path: "center",
|
|
48
48
|
element: /* @__PURE__ */ h(n, {})
|
|
49
49
|
}),
|
|
50
|
-
/* @__PURE__ */ h(
|
|
50
|
+
/* @__PURE__ */ h(f, {
|
|
51
51
|
path: "history",
|
|
52
52
|
element: m ? /* @__PURE__ */ h(_, {}) : /* @__PURE__ */ h(i, {
|
|
53
53
|
title: "Notification history is not enabled",
|
|
54
54
|
description: "This admin page is controlled by the notification.history feature flag. Enable the flag before validating delivery history."
|
|
55
55
|
})
|
|
56
56
|
}),
|
|
57
|
-
c && /* @__PURE__ */ h(
|
|
57
|
+
c && /* @__PURE__ */ h(f, {
|
|
58
58
|
path: "templates",
|
|
59
59
|
element: /* @__PURE__ */ h(w, {
|
|
60
60
|
permissions: [
|
|
@@ -66,21 +66,21 @@ function T() {
|
|
|
66
66
|
children: /* @__PURE__ */ h(v, {})
|
|
67
67
|
})
|
|
68
68
|
}),
|
|
69
|
-
c && /* @__PURE__ */ h(
|
|
69
|
+
c && /* @__PURE__ */ h(f, {
|
|
70
70
|
path: "templates/new",
|
|
71
71
|
element: /* @__PURE__ */ h(w, {
|
|
72
72
|
permission: t.TEMPLATE_CREATE,
|
|
73
73
|
children: /* @__PURE__ */ h(y, {})
|
|
74
74
|
})
|
|
75
75
|
}),
|
|
76
|
-
c && /* @__PURE__ */ h(
|
|
76
|
+
c && /* @__PURE__ */ h(f, {
|
|
77
77
|
path: "templates/:templateId",
|
|
78
78
|
element: /* @__PURE__ */ h(w, {
|
|
79
79
|
permission: t.TEMPLATE_UPDATE,
|
|
80
80
|
children: /* @__PURE__ */ h(y, {})
|
|
81
81
|
})
|
|
82
82
|
}),
|
|
83
|
-
|
|
83
|
+
u && /* @__PURE__ */ h(f, {
|
|
84
84
|
path: "create",
|
|
85
85
|
element: /* @__PURE__ */ h(w, {
|
|
86
86
|
permissions: [t.NOTIFICATION_CREATE, t.NOTIFICATION_SEND],
|
|
@@ -88,16 +88,16 @@ function T() {
|
|
|
88
88
|
children: /* @__PURE__ */ h(b, {})
|
|
89
89
|
})
|
|
90
90
|
}),
|
|
91
|
-
|
|
91
|
+
u && /* @__PURE__ */ h(f, {
|
|
92
92
|
path: "topics",
|
|
93
93
|
element: /* @__PURE__ */ h(w, {
|
|
94
94
|
permission: t.NOTIFICATION_CREATE,
|
|
95
95
|
children: /* @__PURE__ */ h(x, {})
|
|
96
96
|
})
|
|
97
97
|
}),
|
|
98
|
-
/* @__PURE__ */ h(
|
|
98
|
+
/* @__PURE__ */ h(f, {
|
|
99
99
|
path: "*",
|
|
100
|
-
element: /* @__PURE__ */ h(
|
|
100
|
+
element: /* @__PURE__ */ h(d, {
|
|
101
101
|
to: "..",
|
|
102
102
|
replace: !0,
|
|
103
103
|
relative: "path"
|
package/dist/NotificationRoot.js
CHANGED
|
@@ -3,79 +3,87 @@ import { NotificationRoutes as t } from "./NotificationRoutes.js";
|
|
|
3
3
|
import { useEffect as n } from "react";
|
|
4
4
|
import { ErrorBoundary as r } from "@burdenoff/fe-libs/shared/components";
|
|
5
5
|
import { FeatureFlagProvider as i } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useI18n as a } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
7
|
+
import { Archive as o, Bell as s, FileText as c, Settings2 as l, Tag as u } from "lucide-react";
|
|
8
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
8
9
|
//#region src/NotificationRoot.tsx
|
|
9
|
-
function
|
|
10
|
-
let { registerNavItems:
|
|
10
|
+
function f(f) {
|
|
11
|
+
let { registerNavItems: p, registerFooterItems: m, basePath: h = "/" } = f, { t: g } = a(), _ = (e, t) => {
|
|
12
|
+
let n = g(e);
|
|
13
|
+
return n === e ? t : n;
|
|
14
|
+
}, v = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
|
|
11
15
|
return n(() => {
|
|
12
|
-
if (
|
|
16
|
+
if (p) return p([
|
|
13
17
|
{
|
|
14
18
|
id: "notification-center",
|
|
15
|
-
label: "Notification Center",
|
|
16
|
-
path: h
|
|
17
|
-
icon: /* @__PURE__ */
|
|
19
|
+
label: _("notification.nav.center", "Notification Center"),
|
|
20
|
+
path: v(h, "center"),
|
|
21
|
+
icon: /* @__PURE__ */ d(s, { size: 20 }),
|
|
18
22
|
order: 10,
|
|
19
23
|
group: "notifications"
|
|
20
24
|
},
|
|
21
25
|
{
|
|
22
26
|
id: "notification-history",
|
|
23
|
-
label: "History",
|
|
24
|
-
path: h
|
|
25
|
-
icon: /* @__PURE__ */
|
|
27
|
+
label: _("notification.nav.history", "History"),
|
|
28
|
+
path: v(h, "history"),
|
|
29
|
+
icon: /* @__PURE__ */ d(o, { size: 20 }),
|
|
26
30
|
order: 20,
|
|
27
31
|
group: "notifications"
|
|
28
32
|
},
|
|
29
33
|
{
|
|
30
34
|
id: "notification-templates",
|
|
31
|
-
label: "Templates",
|
|
32
|
-
path: h
|
|
33
|
-
icon: /* @__PURE__ */
|
|
35
|
+
label: _("notification.nav.templates", "Templates"),
|
|
36
|
+
path: v(h, "templates"),
|
|
37
|
+
icon: /* @__PURE__ */ d(c, { size: 20 }),
|
|
34
38
|
order: 30,
|
|
35
39
|
group: "notifications"
|
|
36
40
|
},
|
|
37
41
|
{
|
|
38
42
|
id: "notification-topics",
|
|
39
|
-
label: "Topics",
|
|
40
|
-
path: h
|
|
41
|
-
icon: /* @__PURE__ */ u
|
|
43
|
+
label: _("notification.nav.topics", "Topics"),
|
|
44
|
+
path: v(h, "topics"),
|
|
45
|
+
icon: /* @__PURE__ */ d(u, { size: 20 }),
|
|
42
46
|
order: 40,
|
|
43
47
|
group: "notifications"
|
|
44
48
|
},
|
|
45
49
|
{
|
|
46
50
|
id: "notification-preferences",
|
|
47
|
-
label: "Preferences",
|
|
48
|
-
path: h
|
|
49
|
-
icon: /* @__PURE__ */
|
|
51
|
+
label: _("notification.nav.preferences", "Preferences"),
|
|
52
|
+
path: v(h, "preferences"),
|
|
53
|
+
icon: /* @__PURE__ */ d(l, { size: 20 }),
|
|
50
54
|
order: 50,
|
|
51
55
|
group: "notifications"
|
|
52
56
|
}
|
|
53
57
|
]);
|
|
54
|
-
}, [
|
|
55
|
-
|
|
58
|
+
}, [
|
|
59
|
+
p,
|
|
60
|
+
h,
|
|
61
|
+
g
|
|
62
|
+
]), n(() => {
|
|
63
|
+
if (m) return m([{
|
|
56
64
|
id: "notification-status",
|
|
57
|
-
label: "Notifications Ready",
|
|
65
|
+
label: _("notification.footer.ready", "Notifications Ready"),
|
|
58
66
|
type: "status",
|
|
59
67
|
order: 10,
|
|
60
68
|
section: "left"
|
|
61
69
|
}]);
|
|
62
|
-
}, [
|
|
63
|
-
fallback: /* @__PURE__ */
|
|
70
|
+
}, [m, g]), /* @__PURE__ */ d(r, {
|
|
71
|
+
fallback: /* @__PURE__ */ d("div", {
|
|
64
72
|
className: "p-6 text-center text-text-secondary",
|
|
65
73
|
children: "Something went wrong loading this module. Please refresh the page."
|
|
66
74
|
}),
|
|
67
|
-
children: /* @__PURE__ */
|
|
75
|
+
children: /* @__PURE__ */ d(i, {
|
|
68
76
|
workspaceId: null,
|
|
69
77
|
gateway: "global",
|
|
70
78
|
defaultEnabled: !0,
|
|
71
|
-
children: /* @__PURE__ */
|
|
72
|
-
...
|
|
73
|
-
children: /* @__PURE__ */
|
|
79
|
+
children: /* @__PURE__ */ d(e, {
|
|
80
|
+
...f,
|
|
81
|
+
children: /* @__PURE__ */ d(t, {})
|
|
74
82
|
})
|
|
75
83
|
})
|
|
76
84
|
});
|
|
77
85
|
}
|
|
78
86
|
//#endregion
|
|
79
|
-
export {
|
|
87
|
+
export { f as NotificationRoot };
|
|
80
88
|
|
|
81
89
|
//# sourceMappingURL=NotificationRoot.js.map
|
|
@@ -1 +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":"
|
|
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 { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\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 const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n };\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: tr('notification.nav.center', '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: tr('notification.nav.history', '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: tr('notification.nav.templates', '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: tr('notification.nav.topics', '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: tr('notification.nav.preferences', '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 // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [registerNavItems, basePath, t]);\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: tr('notification.footer.ready', 'Notifications Ready'),\n type: 'status',\n order: 10,\n section: 'left',\n },\n ];\n\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [registerFooterItems, t]);\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":";;;;;;;;;AAoCA,SAAgB,EAAiB,GAA8B;CAC7D,IAAM,EAAE,qBAAkB,wBAAqB,cAAW,QAAQ,GAC5D,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,MAA6B;EACpD,IAAM,IAAa,EAAE,EAAI;AACzB,SAAO,MAAe,IAAM,IAAW;IAInC,KAAY,GAAc,OACZ,EAAK,SAAS,IAAI,GAAG,EAAK,MAAM,GAAG,GAAG,GAAG,MACzC,EAAK,WAAW,IAAI,GAAG,IAAO,IAAI;AA+EtD,QA1EA,QAAgB;AACT,QAkDL,QAHgB,EA7CY;GAC1B;IACE,IAAI;IACJ,OAAO,EAAG,2BAA2B,sBAAsB;IAC3D,MAAM,EAAS,GAAU,SAAS;IAClC,MAAM,kBAAC,GAAD,EAAM,MAAM,IAAM,CAAA;IACxB,OAAO;IACP,OAAO;IACR;GACD;IACE,IAAI;IACJ,OAAO,EAAG,4BAA4B,UAAU;IAChD,MAAM,EAAS,GAAU,UAAU;IACnC,MAAM,kBAAC,GAAD,EAAS,MAAM,IAAM,CAAA;IAC3B,OAAO;IACP,OAAO;IACR;GACD;IACE,IAAI;IACJ,OAAO,EAAG,8BAA8B,YAAY;IACpD,MAAM,EAAS,GAAU,YAAY;IACrC,MAAM,kBAAC,GAAD,EAAU,MAAM,IAAM,CAAA;IAC5B,OAAO;IACP,OAAO;IAER;GACD;IACE,IAAI;IACJ,OAAO,EAAG,2BAA2B,SAAS;IAC9C,MAAM,EAAS,GAAU,SAAS;IAClC,MAAM,kBAAC,GAAD,EAAK,MAAM,IAAM,CAAA;IACvB,OAAO;IACP,OAAO;IACR;GACD;IACE,IAAI;IACJ,OAAO,EAAG,gCAAgC,cAAc;IACxD,MAAM,EAAS,GAAU,cAAc;IACvC,MAAM,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA;IAC7B,OAAO;IACP,OAAO;IACR;GACF,CAGyC;IAKzC;EAAC;EAAkB;EAAU;EAAE,CAAC,EAGnC,QAAgB;AACT,QAaL,QADgB,EAVkB,CAChC;GACE,IAAI;GACJ,OAAO,EAAG,6BAA6B,sBAAsB;GAC7D,MAAM;GACN,OAAO;GACP,SAAS;GACV,CACF,CAE+C;IAG/C,CAAC,GAAqB,EAAE,CAAC,EAG1B,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"}
|
|
@@ -3,62 +3,67 @@ import { UserNotificationRoutes as t } from "./UserNotificationRoutes.js";
|
|
|
3
3
|
import { useEffect as n } from "react";
|
|
4
4
|
import { ErrorBoundary as r } from "@burdenoff/fe-libs/shared/components";
|
|
5
5
|
import { useFeatureFlagDetails as i } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useI18n as a } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
7
|
+
import { Archive as o, Bell as s, Settings2 as c } from "lucide-react";
|
|
8
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
8
9
|
//#region src/UserNotificationRoot.tsx
|
|
9
|
-
function
|
|
10
|
-
let { registerNavItems:
|
|
10
|
+
function u(u) {
|
|
11
|
+
let { registerNavItems: d, registerFooterItems: f, basePath: p = "/" } = u, { t: m } = a(), h = (e, t) => {
|
|
12
|
+
let n = m(e);
|
|
13
|
+
return n === e ? t : n;
|
|
14
|
+
}, g = i("notification.history"), _ = g ? !!g.value : !1, v = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
|
|
11
15
|
return n(() => {
|
|
12
|
-
if (
|
|
16
|
+
if (d) return d([
|
|
13
17
|
{
|
|
14
18
|
id: "user-notification-center",
|
|
15
|
-
label: "Notification Center",
|
|
16
|
-
path:
|
|
17
|
-
icon: /* @__PURE__ */
|
|
19
|
+
label: h("notification.nav.center", "Notification Center"),
|
|
20
|
+
path: v(p, "center"),
|
|
21
|
+
icon: /* @__PURE__ */ l(s, { size: 20 }),
|
|
18
22
|
order: 10,
|
|
19
23
|
group: "notifications"
|
|
20
24
|
},
|
|
21
|
-
...
|
|
25
|
+
..._ ? [{
|
|
22
26
|
id: "user-notification-history",
|
|
23
|
-
label: "History",
|
|
24
|
-
path:
|
|
25
|
-
icon: /* @__PURE__ */
|
|
27
|
+
label: h("notification.nav.history", "History"),
|
|
28
|
+
path: v(p, "history"),
|
|
29
|
+
icon: /* @__PURE__ */ l(o, { size: 20 }),
|
|
26
30
|
order: 20,
|
|
27
31
|
group: "notifications"
|
|
28
32
|
}] : [],
|
|
29
33
|
{
|
|
30
34
|
id: "user-notification-preferences",
|
|
31
|
-
label: "Preferences",
|
|
32
|
-
path:
|
|
33
|
-
icon: /* @__PURE__ */ c
|
|
35
|
+
label: h("notification.nav.preferences", "Preferences"),
|
|
36
|
+
path: v(p, "preferences"),
|
|
37
|
+
icon: /* @__PURE__ */ l(c, { size: 20 }),
|
|
34
38
|
order: 30,
|
|
35
39
|
group: "notifications"
|
|
36
40
|
}
|
|
37
41
|
]);
|
|
38
42
|
}, [
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
d,
|
|
44
|
+
p,
|
|
45
|
+
_,
|
|
41
46
|
m
|
|
42
47
|
]), n(() => {
|
|
43
|
-
if (
|
|
48
|
+
if (f) return f([{
|
|
44
49
|
id: "user-notification-status",
|
|
45
|
-
label: "Notifications Ready",
|
|
50
|
+
label: h("notification.footer.ready", "Notifications Ready"),
|
|
46
51
|
type: "status",
|
|
47
52
|
order: 10,
|
|
48
53
|
section: "left"
|
|
49
54
|
}]);
|
|
50
|
-
}, [
|
|
51
|
-
fallback: /* @__PURE__ */
|
|
55
|
+
}, [f, m]), /* @__PURE__ */ l(r, {
|
|
56
|
+
fallback: /* @__PURE__ */ l("div", {
|
|
52
57
|
className: "p-6 text-center text-text-secondary",
|
|
53
58
|
children: "Something went wrong loading this module. Please refresh the page."
|
|
54
59
|
}),
|
|
55
|
-
children: /* @__PURE__ */
|
|
56
|
-
...
|
|
57
|
-
children: /* @__PURE__ */
|
|
60
|
+
children: /* @__PURE__ */ l(e, {
|
|
61
|
+
...u,
|
|
62
|
+
children: /* @__PURE__ */ l(t, {})
|
|
58
63
|
})
|
|
59
64
|
});
|
|
60
65
|
}
|
|
61
66
|
//#endregion
|
|
62
|
-
export {
|
|
67
|
+
export { u as UserNotificationRoot };
|
|
63
68
|
|
|
64
69
|
//# sourceMappingURL=UserNotificationRoot.js.map
|
|
@@ -1 +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":"
|
|
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 { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\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 const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n };\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: tr('notification.nav.center', '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: tr('notification.nav.history', '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: tr('notification.nav.preferences', '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 // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [registerNavItems, basePath, historyEnabled, t]);\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: tr('notification.footer.ready', 'Notifications Ready'),\n type: 'status',\n order: 10,\n section: 'left',\n },\n ];\n\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [registerFooterItems, t]);\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":";;;;;;;;;AAuCA,SAAgB,EAAqB,GAA8B;CACjE,IAAM,EAAE,qBAAkB,wBAAqB,cAAW,QAAQ,GAC5D,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,MAA6B;EACpD,IAAM,IAAa,EAAE,EAAI;AACzB,SAAO,MAAe,IAAM,IAAW;IASnC,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;AAkEtD,QA7DA,QAAgB;AACT,QAqCL,QAHgB,EAhCY;GAC1B;IACE,IAAI;IACJ,OAAO,EAAG,2BAA2B,sBAAsB;IAC3D,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,EAAG,4BAA4B,UAAU;IAChD,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,EAAG,gCAAgC,cAAc;IACxD,MAAM,EAAS,GAAU,cAAc;IACvC,MAAM,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA;IAC7B,OAAO;IACP,OAAO;IACR;GACF,CAGyC;IAKzC;EAAC;EAAkB;EAAU;EAAgB;EAAE,CAAC,EAGnD,QAAgB;AACT,QAaL,QADgB,EAVkB,CAChC;GACE,IAAI;GACJ,OAAO,EAAG,6BAA6B,sBAAsB;GAC7D,MAAM;GACN,OAAO;GACP,SAAS;GACV,CACF,CAE+C;IAG/C,CAAC,GAAqB,EAAE,CAAC,EAG1B,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"}
|
|
@@ -9,16 +9,16 @@ import { useNotificationTemplates as re } from "../hooks/useNotificationTemplate
|
|
|
9
9
|
import { useUserSearch as ie } from "../hooks/useUserSearch.js";
|
|
10
10
|
import { RecipientSelector as ae } from "../components/RecipientSelector.js";
|
|
11
11
|
import { useMemo as a, useState as o } from "react";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
12
|
+
import { useGlobalUi as oe, usePermissions as se } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
13
|
+
import { AlertCircle as ce, ArrowLeft as le, Bell as ue, CheckCircle2 as s, Eye as de, EyeOff as fe, FileText as pe, ImagePlus as me, Link2 as he, Loader2 as c, Mail as ge, MessageSquare as l, Send as _e, Smartphone as ve, User as u, Users as ye, X as be } from "lucide-react";
|
|
14
|
+
import { useNavigate as xe } from "react-router-dom";
|
|
15
15
|
import { Fragment as Se, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
16
16
|
//#region src/pages/CreateNotificationPage.tsx
|
|
17
17
|
var Ce = [
|
|
18
18
|
{
|
|
19
19
|
value: "EMAIL",
|
|
20
20
|
label: "Email",
|
|
21
|
-
icon:
|
|
21
|
+
icon: ge,
|
|
22
22
|
description: "Send via email"
|
|
23
23
|
},
|
|
24
24
|
{
|
|
@@ -30,13 +30,13 @@ var Ce = [
|
|
|
30
30
|
{
|
|
31
31
|
value: "PUSH",
|
|
32
32
|
label: "Push",
|
|
33
|
-
icon:
|
|
33
|
+
icon: ve,
|
|
34
34
|
description: "Mobile push notification"
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
value: "WEBHOOK",
|
|
38
38
|
label: "Webhook",
|
|
39
|
-
icon:
|
|
39
|
+
icon: he,
|
|
40
40
|
description: "POST to a webhook URL"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
@@ -163,7 +163,7 @@ var Ce = [
|
|
|
163
163
|
}
|
|
164
164
|
];
|
|
165
165
|
function Oe() {
|
|
166
|
-
let
|
|
166
|
+
let ge = xe(), l = n(), { hasPermission: ve, isLoading: Oe, refreshPermissions: ke } = se(), { showToast: Ae } = oe(), { sendNotification: je, sendBatch: Me, sendWithTemplate: Ne, isSending: p, error: Pe, lastResult: Fe, clearError: Ie, clearResult: Le } = ne(), { templates: m, isLoading: Re } = re(), { trackNotificationSent: ze } = e(), { searchUsers: h, fetchAllUsers: Be, results: g, isLoading: Ve, error: _ } = ie(), { topics: He } = t({ isActive: !0 }), [v, Ue] = o("compose"), [y, We] = o("EMAIL"), [b, Ge] = o("MARKETING"), [x, Ke] = o("MEDIUM"), [S, qe] = o([]), [C, w] = o("manual"), [T, E] = o([]), [D, Je] = o(!1), [O, Ye] = o(""), [k, Xe] = o(""), [A, Ze] = o(""), [j, Qe] = o(""), [$e, et] = o(""), [tt, nt] = o(!1), [M, rt] = o(""), [N, P] = o([{
|
|
167
167
|
url: "",
|
|
168
168
|
label: "",
|
|
169
169
|
kind: "image"
|
|
@@ -223,7 +223,7 @@ function Oe() {
|
|
|
223
223
|
className: "flex h-64 items-center justify-center",
|
|
224
224
|
children: /* @__PURE__ */ d("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
225
225
|
});
|
|
226
|
-
let gt =
|
|
226
|
+
let gt = ve(te.NOTIFICATION_CREATE), _t = ve(te.NOTIFICATION_SEND);
|
|
227
227
|
if (!gt || !_t) return /* @__PURE__ */ d("div", {
|
|
228
228
|
className: "p-8 text-center text-text-secondary",
|
|
229
229
|
children: l("notifications.noPermissionCreateAndSend", "You don't have permission to create and send notifications.")
|
|
@@ -368,9 +368,9 @@ function Oe() {
|
|
|
368
368
|
children: [/* @__PURE__ */ f("div", {
|
|
369
369
|
className: "flex items-center gap-4",
|
|
370
370
|
children: [/* @__PURE__ */ d("button", {
|
|
371
|
-
onClick: () =>
|
|
371
|
+
onClick: () => ge("/notifications/center"),
|
|
372
372
|
className: "p-2 text-text-secondary hover:text-text-primary hover:bg-bg-sunken rounded-lg transition-colors",
|
|
373
|
-
children: /* @__PURE__ */ d(
|
|
373
|
+
children: /* @__PURE__ */ d(le, { size: 20 })
|
|
374
374
|
}), /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("h1", {
|
|
375
375
|
className: "text-xl font-semibold text-text-primary",
|
|
376
376
|
children: l("notifications.sendTitle", "Send Notification")
|
|
@@ -383,7 +383,7 @@ function Oe() {
|
|
|
383
383
|
children: [/* @__PURE__ */ f("button", {
|
|
384
384
|
onClick: () => lt(!K),
|
|
385
385
|
className: `flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-lg transition-colors ${K ? "bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300" : "text-text-secondary hover:bg-bg-sunken"}`,
|
|
386
|
-
children: [d(K ?
|
|
386
|
+
children: [d(K ? fe : de, { size: 16 }), l("notifications.preview", "Preview")]
|
|
387
387
|
}), /* @__PURE__ */ f("button", {
|
|
388
388
|
onClick: St,
|
|
389
389
|
disabled: p || J,
|
|
@@ -391,7 +391,7 @@ function Oe() {
|
|
|
391
391
|
children: [p ? /* @__PURE__ */ d(c, {
|
|
392
392
|
size: 16,
|
|
393
393
|
className: "animate-spin"
|
|
394
|
-
}) : d(J ? s :
|
|
394
|
+
}) : d(J ? s : _e, { size: 16 }), p ? l("notifications.sending", "Sending...") : J ? l("notifications.sent", "Sent!") : W ? l("notifications.schedule", "Schedule") : l("notifications.sendNotification", "Send Notification")]
|
|
395
395
|
})]
|
|
396
396
|
})]
|
|
397
397
|
}),
|
|
@@ -422,7 +422,7 @@ function Oe() {
|
|
|
422
422
|
}),
|
|
423
423
|
wt && /* @__PURE__ */ f("div", {
|
|
424
424
|
className: "mx-6 mt-4 flex items-center gap-3 p-4 bg-status-error-bg-subtle border border-border-subtle rounded-lg",
|
|
425
|
-
children: [/* @__PURE__ */ d(
|
|
425
|
+
children: [/* @__PURE__ */ d(ce, {
|
|
426
426
|
size: 20,
|
|
427
427
|
className: "text-status-error-text flex-shrink-0"
|
|
428
428
|
}), /* @__PURE__ */ d("p", {
|
|
@@ -439,7 +439,7 @@ function Oe() {
|
|
|
439
439
|
className: "bg-bg-surface rounded-lg border border-border-subtle p-4",
|
|
440
440
|
children: [/* @__PURE__ */ f("div", {
|
|
441
441
|
className: "flex items-center gap-2 mb-4",
|
|
442
|
-
children: [/* @__PURE__ */ d(
|
|
442
|
+
children: [/* @__PURE__ */ d(pe, {
|
|
443
443
|
size: 18,
|
|
444
444
|
className: "text-text-secondary"
|
|
445
445
|
}), /* @__PURE__ */ d("h2", {
|
|
@@ -499,7 +499,7 @@ function Oe() {
|
|
|
499
499
|
className: "w-4 h-4 rounded border-border-default text-primary-600 focus:ring-primary-500"
|
|
500
500
|
}), /* @__PURE__ */ f("div", {
|
|
501
501
|
className: "flex items-center gap-2",
|
|
502
|
-
children: [/* @__PURE__ */ d(
|
|
502
|
+
children: [/* @__PURE__ */ d(ue, {
|
|
503
503
|
size: 16,
|
|
504
504
|
className: "text-primary-500"
|
|
505
505
|
}), /* @__PURE__ */ d("span", {
|
|
@@ -586,7 +586,7 @@ function Oe() {
|
|
|
586
586
|
children: [
|
|
587
587
|
/* @__PURE__ */ f("div", {
|
|
588
588
|
className: "flex items-center gap-2 mb-4",
|
|
589
|
-
children: [/* @__PURE__ */ d(
|
|
589
|
+
children: [/* @__PURE__ */ d(ye, {
|
|
590
590
|
size: 18,
|
|
591
591
|
className: "text-text-secondary"
|
|
592
592
|
}), /* @__PURE__ */ f("h2", {
|
|
@@ -757,7 +757,7 @@ function Oe() {
|
|
|
757
757
|
type: "button",
|
|
758
758
|
onClick: () => E((t) => t.filter((t) => t.id !== e.id)),
|
|
759
759
|
className: "rounded-full p-0.5 hover:bg-primary-100 dark:hover:bg-primary-800",
|
|
760
|
-
children: /* @__PURE__ */ d(
|
|
760
|
+
children: /* @__PURE__ */ d(be, {
|
|
761
761
|
size: 12,
|
|
762
762
|
className: "text-primary-500"
|
|
763
763
|
})
|
|
@@ -774,7 +774,7 @@ function Oe() {
|
|
|
774
774
|
children: [
|
|
775
775
|
/* @__PURE__ */ f("div", {
|
|
776
776
|
className: "flex items-center gap-2 mb-4",
|
|
777
|
-
children: [/* @__PURE__ */ d(
|
|
777
|
+
children: [/* @__PURE__ */ d(ue, {
|
|
778
778
|
size: 18,
|
|
779
779
|
className: "text-primary-500"
|
|
780
780
|
}), /* @__PURE__ */ f("h2", {
|
|
@@ -874,7 +874,7 @@ function Oe() {
|
|
|
874
874
|
type: "button",
|
|
875
875
|
onClick: () => z((t) => t.filter((t) => t.id !== e.id)),
|
|
876
876
|
className: "p-0.5 hover:bg-primary-100 dark:hover:bg-primary-800 rounded-full transition-colors",
|
|
877
|
-
children: /* @__PURE__ */ d(
|
|
877
|
+
children: /* @__PURE__ */ d(be, {
|
|
878
878
|
size: 12,
|
|
879
879
|
className: "text-primary-500"
|
|
880
880
|
})
|
|
@@ -907,7 +907,7 @@ function Oe() {
|
|
|
907
907
|
}) : m.length === 0 ? /* @__PURE__ */ f("div", {
|
|
908
908
|
className: "text-center py-8",
|
|
909
909
|
children: [
|
|
910
|
-
/* @__PURE__ */ d(
|
|
910
|
+
/* @__PURE__ */ d(pe, {
|
|
911
911
|
size: 32,
|
|
912
912
|
className: "mx-auto text-text-tertiary mb-2"
|
|
913
913
|
}),
|
|
@@ -916,7 +916,7 @@ function Oe() {
|
|
|
916
916
|
children: l("notifications.noTemplatesAvailable", "No templates available")
|
|
917
917
|
}),
|
|
918
918
|
/* @__PURE__ */ d("button", {
|
|
919
|
-
onClick: () =>
|
|
919
|
+
onClick: () => ge("/notifications/templates/new"),
|
|
920
920
|
className: "mt-2 text-sm text-primary-600 hover:text-primary-700",
|
|
921
921
|
children: l("notifications.createATemplate", "Create a template")
|
|
922
922
|
})
|
|
@@ -1084,7 +1084,7 @@ function Oe() {
|
|
|
1084
1084
|
className: "bg-bg-surface rounded-lg border border-border-subtle p-4",
|
|
1085
1085
|
children: [/* @__PURE__ */ f("div", {
|
|
1086
1086
|
className: "mb-4 flex items-center gap-2",
|
|
1087
|
-
children: [/* @__PURE__ */ d(
|
|
1087
|
+
children: [/* @__PURE__ */ d(he, {
|
|
1088
1088
|
size: 18,
|
|
1089
1089
|
className: "text-text-secondary"
|
|
1090
1090
|
}), /* @__PURE__ */ d("h2", {
|
|
@@ -1167,7 +1167,7 @@ function Oe() {
|
|
|
1167
1167
|
className: "bg-bg-surface rounded-lg border border-border-subtle p-4",
|
|
1168
1168
|
children: [/* @__PURE__ */ f("div", {
|
|
1169
1169
|
className: "mb-4 flex items-center gap-2",
|
|
1170
|
-
children: [/* @__PURE__ */ d(
|
|
1170
|
+
children: [/* @__PURE__ */ d(me, {
|
|
1171
1171
|
size: 18,
|
|
1172
1172
|
className: "text-text-secondary"
|
|
1173
1173
|
}), /* @__PURE__ */ d("h2", {
|
|
@@ -7,8 +7,8 @@ import { filterNotifications as i, groupNotificationsByDate as a } from "../util
|
|
|
7
7
|
import { NotificationCard as o } from "../components/NotificationCard.js";
|
|
8
8
|
import { NOTIFICATION_PERMISSIONS as s } from "../constants/permissions.js";
|
|
9
9
|
import { useMemo as c } from "react";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { usePermissions as l } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
11
|
+
import { Bell as u, Search as d } from "lucide-react";
|
|
12
12
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
13
13
|
//#region src/pages/NotificationCenterPage.tsx
|
|
14
14
|
var m = {
|
|
@@ -58,7 +58,7 @@ var m = {
|
|
|
58
58
|
}
|
|
59
59
|
];
|
|
60
60
|
function v() {
|
|
61
|
-
let v = r(), { hasPermission: y, isLoading: b } =
|
|
61
|
+
let v = r(), { hasPermission: y, isLoading: b } = l(), { currentUser: x } = e(), { notifications: S, unreadCount: C, notificationFilter: w, markAsRead: T, markAllAsRead: E, archiveNotification: D, recordAction: O, updateFilter: k, resetFilter: A } = t({
|
|
62
62
|
baseFilter: m,
|
|
63
63
|
unreadFilter: h
|
|
64
64
|
}), { topics: j } = n({ isActive: !0 }), M = c(() => i(S, w), [S, w]), N = c(() => a(M), [M]);
|
|
@@ -93,7 +93,7 @@ function v() {
|
|
|
93
93
|
children: [
|
|
94
94
|
/* @__PURE__ */ p("div", {
|
|
95
95
|
className: "relative flex-1",
|
|
96
|
-
children: [/* @__PURE__ */ f(
|
|
96
|
+
children: [/* @__PURE__ */ f(d, {
|
|
97
97
|
size: 16,
|
|
98
98
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
|
|
99
99
|
}), /* @__PURE__ */ f("input", {
|
|
@@ -188,7 +188,7 @@ function v() {
|
|
|
188
188
|
}, e)) : /* @__PURE__ */ p("div", {
|
|
189
189
|
className: "flex flex-col items-center justify-center py-12 text-center animate-in fade-in duration-300",
|
|
190
190
|
children: [
|
|
191
|
-
/* @__PURE__ */ f(
|
|
191
|
+
/* @__PURE__ */ f(u, {
|
|
192
192
|
size: 48,
|
|
193
193
|
className: "text-tertiary mb-4"
|
|
194
194
|
}),
|
|
@@ -6,15 +6,15 @@ import { NotificationCard as r } from "../components/NotificationCard.js";
|
|
|
6
6
|
import { NOTIFICATION_PERMISSIONS as i } from "../constants/permissions.js";
|
|
7
7
|
import { exportNotificationsAsCsv as a } from "../utils/notificationHistoryExport.js";
|
|
8
8
|
import { useState as o } from "react";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { usePermissions as s } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
10
|
+
import { CalendarClock as c, Download as l, RefreshCw as u, Search as d } from "lucide-react";
|
|
11
11
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
12
12
|
//#region src/pages/NotificationHistoryAdminPage.tsx
|
|
13
13
|
function h(e) {
|
|
14
14
|
return e ? new Date(e).toLocaleString() : "—";
|
|
15
15
|
}
|
|
16
16
|
function g() {
|
|
17
|
-
let g = n(), { hasPermission: _, isLoading: v } =
|
|
17
|
+
let g = n(), { hasPermission: _, isLoading: v } = s(), { topics: y } = t(), { filters: b, setFilters: x, notifications: S, scheduledNotifications: C, selectedNotification: w, events: T, isLoading: E, loadNotification: D, archiveNotification: O, unarchiveNotification: k, cancelScheduledNotification: A, rescheduleNotification: j, clearSelection: M } = e(), [N, P] = o("");
|
|
18
18
|
return v ? /* @__PURE__ */ p("div", {
|
|
19
19
|
className: "flex h-64 items-center justify-center",
|
|
20
20
|
children: /* @__PURE__ */ p("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
@@ -34,7 +34,7 @@ function g() {
|
|
|
34
34
|
onClick: () => a(g, S),
|
|
35
35
|
disabled: S.length === 0,
|
|
36
36
|
className: "inline-flex items-center gap-2 rounded-md border border-default px-4 py-2 text-sm text-secondary hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed",
|
|
37
|
-
children: [/* @__PURE__ */ p(
|
|
37
|
+
children: [/* @__PURE__ */ p(l, { size: 16 }), g("notifications.export", "Export")]
|
|
38
38
|
})]
|
|
39
39
|
}),
|
|
40
40
|
/* @__PURE__ */ m("div", {
|
|
@@ -42,7 +42,7 @@ function g() {
|
|
|
42
42
|
children: [
|
|
43
43
|
/* @__PURE__ */ m("label", {
|
|
44
44
|
className: "relative lg:col-span-2",
|
|
45
|
-
children: [/* @__PURE__ */ p(
|
|
45
|
+
children: [/* @__PURE__ */ p(d, {
|
|
46
46
|
size: 16,
|
|
47
47
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
|
|
48
48
|
}), /* @__PURE__ */ p("input", {
|
|
@@ -215,7 +215,7 @@ function g() {
|
|
|
215
215
|
" ",
|
|
216
216
|
g("notifications.resultsFoundShort", "results")
|
|
217
217
|
]
|
|
218
|
-
})] }), E && /* @__PURE__ */ p(
|
|
218
|
+
})] }), E && /* @__PURE__ */ p(u, {
|
|
219
219
|
size: 16,
|
|
220
220
|
className: "animate-spin text-tertiary"
|
|
221
221
|
})]
|
|
@@ -240,7 +240,7 @@ function g() {
|
|
|
240
240
|
className: "rounded-lg border border-default bg-surface p-4 shadow-sm",
|
|
241
241
|
children: [/* @__PURE__ */ m("div", {
|
|
242
242
|
className: "mb-4 flex items-center gap-2",
|
|
243
|
-
children: [/* @__PURE__ */ p(
|
|
243
|
+
children: [/* @__PURE__ */ p(c, {
|
|
244
244
|
size: 18,
|
|
245
245
|
className: "text-accent-primary"
|
|
246
246
|
}), /* @__PURE__ */ p("h2", {
|
|
@@ -6,8 +6,8 @@ import { useTr as r } from "../shared/hooks/useTr.js";
|
|
|
6
6
|
import { NotificationCard as i } from "../components/NotificationCard.js";
|
|
7
7
|
import { NOTIFICATION_PERMISSIONS as a } from "../constants/permissions.js";
|
|
8
8
|
import { exportNotificationsAsCsv as o } from "../utils/notificationHistoryExport.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { usePermissions as s } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
10
|
+
import { Archive as c, Download as l, Search as u } from "lucide-react";
|
|
11
11
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
12
12
|
//#region src/pages/NotificationHistoryPage.tsx
|
|
13
13
|
var p = {
|
|
@@ -15,7 +15,7 @@ var p = {
|
|
|
15
15
|
channel: "ALL"
|
|
16
16
|
};
|
|
17
17
|
function m() {
|
|
18
|
-
let m = r(), { hasPermission: h, isLoading: g } =
|
|
18
|
+
let m = r(), { hasPermission: h, isLoading: g } = s(), { currentUser: _ } = e(), { topics: v } = n({ isActive: !0 }), { notifications: y, notificationFilter: b, updateFilter: x, archiveNotification: S, unarchiveNotification: C, recordAction: w } = t({ baseFilter: p });
|
|
19
19
|
return g ? /* @__PURE__ */ d("div", {
|
|
20
20
|
className: "flex h-64 items-center justify-center",
|
|
21
21
|
children: /* @__PURE__ */ d("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
@@ -39,7 +39,7 @@ function m() {
|
|
|
39
39
|
onClick: () => o(m, y),
|
|
40
40
|
disabled: y.length === 0,
|
|
41
41
|
className: "flex items-center gap-2 px-4 py-2 text-sm font-medium text-accent-primary hover:text-accent-primary/80 border border-accent-primary hover:border-accent-primary/80 rounded-lg transition-all duration-150 hover:shadow-sm disabled:opacity-50 disabled:cursor-not-allowed",
|
|
42
|
-
children: [/* @__PURE__ */ d(
|
|
42
|
+
children: [/* @__PURE__ */ d(l, { size: 16 }), m("notifications.export", "Export")]
|
|
43
43
|
})]
|
|
44
44
|
}),
|
|
45
45
|
/* @__PURE__ */ f("div", {
|
|
@@ -47,7 +47,7 @@ function m() {
|
|
|
47
47
|
children: [
|
|
48
48
|
/* @__PURE__ */ f("div", {
|
|
49
49
|
className: "relative sm:col-span-2 xl:col-span-2",
|
|
50
|
-
children: [/* @__PURE__ */ d(
|
|
50
|
+
children: [/* @__PURE__ */ d(u, {
|
|
51
51
|
size: 16,
|
|
52
52
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
|
|
53
53
|
}), /* @__PURE__ */ d("input", {
|
|
@@ -113,7 +113,7 @@ function m() {
|
|
|
113
113
|
}, e.id)) : /* @__PURE__ */ f("div", {
|
|
114
114
|
className: "flex flex-col items-center justify-center py-12 text-center animate-in fade-in duration-300",
|
|
115
115
|
children: [
|
|
116
|
-
/* @__PURE__ */ d(
|
|
116
|
+
/* @__PURE__ */ d(c, {
|
|
117
117
|
size: 48,
|
|
118
118
|
className: "text-tertiary mb-4"
|
|
119
119
|
}),
|
|
@@ -7,8 +7,8 @@ import { useTr as i } from "../shared/hooks/useTr.js";
|
|
|
7
7
|
import { nativeImpact as a, nativeNotify as o } from "../utils/nativeBridge.js";
|
|
8
8
|
import { NOTIFICATION_PERMISSIONS as s } from "../constants/permissions.js";
|
|
9
9
|
import { useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { usePermissions as f } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
11
|
+
import { BellRing as p, Search as m, ToggleLeft as h, ToggleRight as g } from "lucide-react";
|
|
12
12
|
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
13
13
|
import { OptionalFields as y } from "@burdenoff/fe-libs/ui";
|
|
14
14
|
//#region src/pages/NotificationPreferencesPage.tsx
|
|
@@ -69,7 +69,7 @@ function S(e) {
|
|
|
69
69
|
return e.scope === "CHANNEL" ? `CHANNEL:${e.channel || ""}` : e.scope === "TYPE" ? `TYPE:${e.type || ""}` : e.scope === "TOPIC" ? `TOPIC:${e.topicId || ""}` : "GLOBAL";
|
|
70
70
|
}
|
|
71
71
|
function C() {
|
|
72
|
-
let C = i(), { hasPermission: w, isLoading: T } =
|
|
72
|
+
let C = i(), { hasPermission: w, isLoading: T } = f(), { currentUser: E } = e(), { topics: D, isLoading: O } = r({
|
|
73
73
|
type: "MARKETING",
|
|
74
74
|
isActive: !0
|
|
75
75
|
}), { preferencesByKey: k, isLoading: A, setPreference: j, deletePreference: M } = n(), { trackPreferenceUpdated: N } = t(), [P, F] = d(""), [I, L] = d(null), [R, z] = d(null), B = u(null), V = O || A;
|
|
@@ -148,7 +148,7 @@ function C() {
|
|
|
148
148
|
children: [/* @__PURE__ */ v("div", {
|
|
149
149
|
className: "flex items-center gap-2",
|
|
150
150
|
children: [
|
|
151
|
-
/* @__PURE__ */ _(
|
|
151
|
+
/* @__PURE__ */ _(p, {
|
|
152
152
|
size: 16,
|
|
153
153
|
className: "text-accent-primary"
|
|
154
154
|
}),
|
|
@@ -184,7 +184,7 @@ function C() {
|
|
|
184
184
|
topicId: e.topicId
|
|
185
185
|
}),
|
|
186
186
|
className: `inline-flex items-center gap-2 rounded-md border px-3 py-2 text-sm font-medium transition-colors ${n ? "border-accent-primary bg-action-primary-bg text-text-inverse hover:opacity-90" : "border-default bg-muted text-secondary hover:bg-muted/80"} disabled:cursor-not-allowed disabled:opacity-50`,
|
|
187
|
-
children: [_(n ?
|
|
187
|
+
children: [_(n ? g : h, { size: 18 }), r ? C("notifications.saving", "Saving...") : n ? C("notifications.enabled", "Enabled") : C("notifications.disabled", "Disabled")]
|
|
188
188
|
})]
|
|
189
189
|
})]
|
|
190
190
|
}), /* @__PURE__ */ _("div", {
|
|
@@ -266,7 +266,7 @@ function C() {
|
|
|
266
266
|
}),
|
|
267
267
|
/* @__PURE__ */ v("div", {
|
|
268
268
|
className: "relative max-w-xl",
|
|
269
|
-
children: [/* @__PURE__ */ _(
|
|
269
|
+
children: [/* @__PURE__ */ _(m, {
|
|
270
270
|
size: 16,
|
|
271
271
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
|
|
272
272
|
}), /* @__PURE__ */ _("input", {
|
|
@@ -3,9 +3,9 @@ import { nativeConfirm as t, nativeImpact as n, nativeNotify as r } from "../uti
|
|
|
3
3
|
import { NOTIFICATION_PERMISSIONS as i } from "../constants/permissions.js";
|
|
4
4
|
import { useNotificationTemplates as a } from "../hooks/useNotificationTemplates.js";
|
|
5
5
|
import { useMemo as o, useState as s } from "react";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { usePermissions as c } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
7
|
+
import { AlertCircle as l, FileText as u, Loader2 as d, Plus as f, RefreshCw as p, Search as m, Trash2 as h } from "lucide-react";
|
|
8
|
+
import { useNavigate as g } from "react-router-dom";
|
|
9
9
|
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
10
10
|
import { useI18n as y } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
11
11
|
//#region src/pages/NotificationTemplatesPage.tsx
|
|
@@ -28,7 +28,7 @@ function S(e, t) {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
function C() {
|
|
31
|
-
let C =
|
|
31
|
+
let C = g(), w = e(), { locale: T } = y(), { hasPermission: E, isLoading: D } = c(), { templates: O, isLoading: k, isDeleting: A, error: j, total: M, hasMore: N, filter: P, refetch: F, loadMore: I, deleteTemplate: L, updateFilter: R } = a(), [z, B] = s(null), [V, H] = s(null), [U, W] = s(/* @__PURE__ */ new Set()), G = o(() => O.filter((e) => U.has(e.id)), [U, O]), K = O.length > 0 && O.every((e) => U.has(e.id)), q = O.some((e) => U.has(e.id)) && !K, J = E(i.TEMPLATE_CREATE), Y = E(i.TEMPLATE_DELETE), X = async (e, i) => {
|
|
32
32
|
e.stopPropagation(), n("medium");
|
|
33
33
|
let a = w("notifTemplates.confirmDelete", `Delete template "${i.name}"? This cannot be undone.`), o = await t({
|
|
34
34
|
title: w("notifTemplates.deleteTitle", "Delete template"),
|
|
@@ -72,7 +72,7 @@ function C() {
|
|
|
72
72
|
children: /* @__PURE__ */ _("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" })
|
|
73
73
|
}) : E(i.TEMPLATE_LIST) || J || Y || E(i.TEMPLATE_UPDATE) ? k && O.length === 0 ? /* @__PURE__ */ v("div", {
|
|
74
74
|
className: "flex flex-col items-center justify-center h-64 gap-3",
|
|
75
|
-
children: [/* @__PURE__ */ _(
|
|
75
|
+
children: [/* @__PURE__ */ _(d, {
|
|
76
76
|
size: 28,
|
|
77
77
|
className: "animate-spin text-accent-primary"
|
|
78
78
|
}), /* @__PURE__ */ _("p", {
|
|
@@ -82,7 +82,7 @@ function C() {
|
|
|
82
82
|
}) : j && O.length === 0 ? /* @__PURE__ */ v("div", {
|
|
83
83
|
className: "flex flex-col items-center justify-center h-64 gap-4",
|
|
84
84
|
children: [
|
|
85
|
-
/* @__PURE__ */ _(
|
|
85
|
+
/* @__PURE__ */ _(l, {
|
|
86
86
|
size: 28,
|
|
87
87
|
className: "text-error"
|
|
88
88
|
}),
|
|
@@ -93,7 +93,7 @@ function C() {
|
|
|
93
93
|
/* @__PURE__ */ v("button", {
|
|
94
94
|
onClick: F,
|
|
95
95
|
className: "flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-accent-primary hover:bg-accent-primary/90 rounded-lg transition-all duration-150",
|
|
96
|
-
children: [/* @__PURE__ */ _(
|
|
96
|
+
children: [/* @__PURE__ */ _(p, { size: 14 }), w("notifTemplates.retry", "Retry")]
|
|
97
97
|
})
|
|
98
98
|
]
|
|
99
99
|
}) : /* @__PURE__ */ v("div", {
|
|
@@ -117,14 +117,14 @@ function C() {
|
|
|
117
117
|
})] }), J && /* @__PURE__ */ v("button", {
|
|
118
118
|
onClick: () => C("new"),
|
|
119
119
|
className: "flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-accent-primary hover:bg-accent-primary/90 rounded-lg transition-all duration-150 hover:shadow-md",
|
|
120
|
-
children: [/* @__PURE__ */ _(
|
|
120
|
+
children: [/* @__PURE__ */ _(f, { size: 16 }), w("notifTemplates.createTemplate", "Create Template")]
|
|
121
121
|
})]
|
|
122
122
|
}),
|
|
123
123
|
/* @__PURE__ */ v("div", {
|
|
124
124
|
className: "flex flex-col gap-3 sm:flex-row sm:items-center",
|
|
125
125
|
children: [/* @__PURE__ */ v("div", {
|
|
126
126
|
className: "relative flex-1",
|
|
127
|
-
children: [/* @__PURE__ */ _(
|
|
127
|
+
children: [/* @__PURE__ */ _(m, {
|
|
128
128
|
size: 16,
|
|
129
129
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
|
|
130
130
|
}), /* @__PURE__ */ _("input", {
|
|
@@ -197,7 +197,7 @@ function C() {
|
|
|
197
197
|
disabled: G.length === 0 || A,
|
|
198
198
|
className: "flex items-center gap-2 px-3 py-2 text-sm font-medium text-error border border-error/30 hover:bg-error/10 rounded-lg transition-all duration-150 disabled:opacity-50",
|
|
199
199
|
children: [
|
|
200
|
-
/* @__PURE__ */ _(
|
|
200
|
+
/* @__PURE__ */ _(h, { size: 14 }),
|
|
201
201
|
w("notifTemplates.deleteSelected", "Delete Selected"),
|
|
202
202
|
G.length > 0 ? ` (${G.length})` : ""
|
|
203
203
|
]
|
|
@@ -207,7 +207,7 @@ function C() {
|
|
|
207
207
|
}),
|
|
208
208
|
V && /* @__PURE__ */ v("div", {
|
|
209
209
|
className: "flex items-center gap-3 p-3 bg-error/10 border border-error/30 rounded-lg",
|
|
210
|
-
children: [/* @__PURE__ */ _(
|
|
210
|
+
children: [/* @__PURE__ */ _(l, {
|
|
211
211
|
size: 16,
|
|
212
212
|
className: "text-error shrink-0"
|
|
213
213
|
}), /* @__PURE__ */ _("p", {
|
|
@@ -217,7 +217,7 @@ function C() {
|
|
|
217
217
|
}),
|
|
218
218
|
O.length === 0 && !k && /* @__PURE__ */ v("div", {
|
|
219
219
|
className: "flex flex-col items-center justify-center h-48 gap-3",
|
|
220
|
-
children: [/* @__PURE__ */ _(
|
|
220
|
+
children: [/* @__PURE__ */ _(u, {
|
|
221
221
|
size: 32,
|
|
222
222
|
className: "text-tertiary"
|
|
223
223
|
}), /* @__PURE__ */ _("p", {
|
|
@@ -244,7 +244,7 @@ function C() {
|
|
|
244
244
|
onClick: (e) => e.stopPropagation(),
|
|
245
245
|
"aria-label": w("notifTemplates.selectTemplateAria", "Select template {{name}}").replace("{{name}}", e.name),
|
|
246
246
|
className: "h-4 w-4 rounded border-default text-accent-primary"
|
|
247
|
-
}), /* @__PURE__ */ _(
|
|
247
|
+
}), /* @__PURE__ */ _(u, {
|
|
248
248
|
size: 20,
|
|
249
249
|
className: "text-accent-primary"
|
|
250
250
|
})]
|
|
@@ -258,10 +258,10 @@ function C() {
|
|
|
258
258
|
disabled: A && z === e.id,
|
|
259
259
|
className: "opacity-0 group-hover:opacity-100 p-1 text-tertiary hover:text-error rounded transition-all duration-150",
|
|
260
260
|
title: w("notifTemplates.deleteTemplate", "Delete template"),
|
|
261
|
-
children: A && z === e.id ? /* @__PURE__ */ _(
|
|
261
|
+
children: A && z === e.id ? /* @__PURE__ */ _(d, {
|
|
262
262
|
size: 14,
|
|
263
263
|
className: "animate-spin"
|
|
264
|
-
}) : /* @__PURE__ */ _(
|
|
264
|
+
}) : /* @__PURE__ */ _(h, { size: 14 })
|
|
265
265
|
})]
|
|
266
266
|
})]
|
|
267
267
|
}),
|
|
@@ -306,7 +306,7 @@ function C() {
|
|
|
306
306
|
onClick: I,
|
|
307
307
|
disabled: k,
|
|
308
308
|
className: "flex items-center gap-2 px-4 py-2 text-sm text-secondary hover:text-primary border border-default rounded-lg transition-all duration-150 hover:shadow-sm",
|
|
309
|
-
children: [k ? /* @__PURE__ */ _(
|
|
309
|
+
children: [k ? /* @__PURE__ */ _(d, {
|
|
310
310
|
size: 14,
|
|
311
311
|
className: "animate-spin"
|
|
312
312
|
}) : null, w("notifTemplates.loadMore", "Load More")]
|
|
@@ -3,8 +3,8 @@ import "../hooks/index.js";
|
|
|
3
3
|
import { useTr as t } from "../shared/hooks/useTr.js";
|
|
4
4
|
import { NOTIFICATION_PERMISSIONS as n } from "../constants/permissions.js";
|
|
5
5
|
import { useMemo as r, useState as i } from "react";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { usePermissions as a } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
7
|
+
import { Plus as o, Save as s, Search as c, Trash2 as l } from "lucide-react";
|
|
8
8
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
9
|
//#region src/pages/NotificationTopicsPage.tsx
|
|
10
10
|
var f = [
|
|
@@ -29,7 +29,7 @@ function p(e) {
|
|
|
29
29
|
return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-");
|
|
30
30
|
}
|
|
31
31
|
function m() {
|
|
32
|
-
let m = t(), { hasPermission: h, isLoading: g } =
|
|
32
|
+
let m = t(), { hasPermission: h, isLoading: g } = a(), { topics: _, isLoading: v, createTopic: y, updateTopic: b, deleteTopic: x } = e(), [S, C] = i(""), [w, T] = i(null), [E, D] = i({
|
|
33
33
|
name: "",
|
|
34
34
|
slug: "",
|
|
35
35
|
description: "",
|
|
@@ -67,7 +67,7 @@ function m() {
|
|
|
67
67
|
children: [
|
|
68
68
|
/* @__PURE__ */ d("div", {
|
|
69
69
|
className: "flex items-center gap-2",
|
|
70
|
-
children: [/* @__PURE__ */ u(
|
|
70
|
+
children: [/* @__PURE__ */ u(o, {
|
|
71
71
|
size: 18,
|
|
72
72
|
className: "text-accent-primary"
|
|
73
73
|
}), /* @__PURE__ */ u("h2", {
|
|
@@ -143,7 +143,7 @@ function m() {
|
|
|
143
143
|
children: [/* @__PURE__ */ d("button", {
|
|
144
144
|
type: "submit",
|
|
145
145
|
className: "inline-flex items-center gap-2 rounded-md bg-accent-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90",
|
|
146
|
-
children: [/* @__PURE__ */ u(
|
|
146
|
+
children: [/* @__PURE__ */ u(s, { size: 16 }), w ? m("notifications.saveTopic", "Save Topic") : m("notifications.createTopicButton", "Create Topic")]
|
|
147
147
|
}), w && /* @__PURE__ */ u("button", {
|
|
148
148
|
type: "button",
|
|
149
149
|
onClick: () => {
|
|
@@ -164,7 +164,7 @@ function m() {
|
|
|
164
164
|
className: "space-y-4 rounded-lg border border-default bg-surface p-4 shadow-sm",
|
|
165
165
|
children: [/* @__PURE__ */ d("div", {
|
|
166
166
|
className: "relative max-w-md",
|
|
167
|
-
children: [/* @__PURE__ */ u(
|
|
167
|
+
children: [/* @__PURE__ */ u(c, {
|
|
168
168
|
size: 16,
|
|
169
169
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-tertiary"
|
|
170
170
|
}), /* @__PURE__ */ u("input", {
|
|
@@ -236,7 +236,7 @@ function m() {
|
|
|
236
236
|
type: "button",
|
|
237
237
|
onClick: () => x(e.id),
|
|
238
238
|
className: "inline-flex items-center gap-2 rounded-md border border-status-error-border px-3 py-2 text-sm text-status-error-text hover:bg-status-error-bg-subtle",
|
|
239
|
-
children: [/* @__PURE__ */ u(
|
|
239
|
+
children: [/* @__PURE__ */ u(l, { size: 14 }), m("notifications.delete", "Delete")]
|
|
240
240
|
})]
|
|
241
241
|
})]
|
|
242
242
|
}, e.id))
|
|
@@ -5,9 +5,9 @@ import { NOTIFICATION_PERMISSIONS as r } from "../constants/permissions.js";
|
|
|
5
5
|
import { useNotificationTemplate as i, useNotificationTemplates as ee } from "../hooks/useNotificationTemplates.js";
|
|
6
6
|
import { TemplatePreview as te } from "../components/TemplatePreview.js";
|
|
7
7
|
import { useCallback as a, useEffect as o, useMemo as s, useRef as ne, useState as c } from "react";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { useGlobalUi as re, usePermissions as ie } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
9
|
+
import { AlertCircle as l, ArrowLeft as ae, Code as oe, Eye as u, EyeOff as d, Loader2 as f, Plus as se, Save as p, Trash2 as ce, Type as le, Variable as ue } from "lucide-react";
|
|
10
|
+
import { useNavigate as de, useParams as fe } from "react-router-dom";
|
|
11
11
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
12
12
|
import { useI18n as pe } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
13
13
|
//#region src/pages/TemplateEditorPage.tsx
|
|
@@ -127,7 +127,7 @@ function ve(e) {
|
|
|
127
127
|
})) : [] : [];
|
|
128
128
|
}
|
|
129
129
|
function v() {
|
|
130
|
-
let v =
|
|
130
|
+
let v = de(), y = t(), { locale: b } = pe(), { templateId: x } = fe(), S = !!x, { hasPermission: ye, isLoading: be, refreshPermissions: xe } = ie(), { showToast: Se } = re(), { createTemplate: Ce, updateTemplate: we, isCreating: Te, isUpdating: Ee } = ee(), { trackTemplateSaved: De } = e(), { template: C, isLoading: Oe, error: ke } = i(S ? x : void 0), [w, T] = c(""), [E, D] = c(""), [O, k] = c(!1), [A, j] = c(""), [M, N] = c("TRANSACTIONAL"), [P, Ae] = c(""), [je, Me] = c("en"), [F, I] = c(""), [L, R] = c(""), [z, B] = c(""), [V, H] = c([]), [U, W] = c("text"), G = ne(null), K = ne(null), [q, J] = c(null), [Y, X] = c(null), [Z, Ne] = c(!0), [Pe, Fe] = c("email");
|
|
131
131
|
o(() => {
|
|
132
132
|
C && (T(C.name), D(C.slug), k(!0), j(C.description || ""), N(C.type), Me(C.locale || "en"), I(C.subject || ""), R(C.bodyTemplate || ""), B(C.htmlTemplate || ""), H(ve(C.variables)), C.htmlTemplate && W("html"));
|
|
133
133
|
}, [C]), o(() => {
|
|
@@ -280,7 +280,7 @@ function v() {
|
|
|
280
280
|
children: [/* @__PURE__ */ m("button", {
|
|
281
281
|
onClick: () => v("..", { relative: "path" }),
|
|
282
282
|
className: "p-2 hover:bg-muted rounded-lg transition-all duration-150",
|
|
283
|
-
children: /* @__PURE__ */ m(
|
|
283
|
+
children: /* @__PURE__ */ m(ae, {
|
|
284
284
|
size: 20,
|
|
285
285
|
className: "text-primary"
|
|
286
286
|
})
|
|
@@ -464,12 +464,12 @@ function v() {
|
|
|
464
464
|
type: "button",
|
|
465
465
|
onClick: () => W("text"),
|
|
466
466
|
className: `flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md transition-all duration-150 ${U === "text" ? "bg-surface text-primary shadow-sm" : "text-tertiary hover:text-primary"}`,
|
|
467
|
-
children: [/* @__PURE__ */ m(
|
|
467
|
+
children: [/* @__PURE__ */ m(le, { size: 12 }), y("notifTemplates.contentMode.text", "Text")]
|
|
468
468
|
}), /* @__PURE__ */ h("button", {
|
|
469
469
|
type: "button",
|
|
470
470
|
onClick: () => W("html"),
|
|
471
471
|
className: `flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md transition-all duration-150 ${U === "html" ? "bg-surface text-primary shadow-sm" : "text-tertiary hover:text-primary"}`,
|
|
472
|
-
children: [/* @__PURE__ */ m(
|
|
472
|
+
children: [/* @__PURE__ */ m(oe, { size: 12 }), y("notifTemplates.contentMode.html", "HTML")]
|
|
473
473
|
})]
|
|
474
474
|
})]
|
|
475
475
|
}),
|
|
@@ -548,7 +548,7 @@ function v() {
|
|
|
548
548
|
children: [/* @__PURE__ */ h("div", {
|
|
549
549
|
className: "flex items-center gap-2",
|
|
550
550
|
children: [
|
|
551
|
-
/* @__PURE__ */ m(
|
|
551
|
+
/* @__PURE__ */ m(ue, {
|
|
552
552
|
size: 16,
|
|
553
553
|
className: "text-accent-primary"
|
|
554
554
|
}),
|
|
@@ -569,7 +569,7 @@ function v() {
|
|
|
569
569
|
type: "button",
|
|
570
570
|
onClick: ze,
|
|
571
571
|
className: "flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-accent-primary bg-accent-primary/10 border border-accent-primary/20 rounded-lg hover:bg-accent-primary/20 transition-colors",
|
|
572
|
-
children: [/* @__PURE__ */ m(
|
|
572
|
+
children: [/* @__PURE__ */ m(se, { size: 12 }), y("notifTemplates.addVariable", "Add Variable")]
|
|
573
573
|
})]
|
|
574
574
|
}),
|
|
575
575
|
V.length === 0 && /* @__PURE__ */ h("p", {
|
|
@@ -631,7 +631,7 @@ function v() {
|
|
|
631
631
|
type: "button",
|
|
632
632
|
onClick: () => Be(t),
|
|
633
633
|
className: "mt-5 p-1.5 text-tertiary hover:text-error rounded transition-colors",
|
|
634
|
-
children: /* @__PURE__ */ m(
|
|
634
|
+
children: /* @__PURE__ */ m(ce, { size: 14 })
|
|
635
635
|
})
|
|
636
636
|
]
|
|
637
637
|
}, t))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContext as e, useContext as t } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { PermissionProvider as n } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
3
|
+
import { MemoryRouter as r } from "react-router-dom";
|
|
4
4
|
import { jsx as i } from "react/jsx-runtime";
|
|
5
5
|
//#region src/providers/NotificationProvider.tsx
|
|
6
6
|
var a = e(null), o = () => {
|
|
@@ -20,14 +20,14 @@ var a = e(null), o = () => {
|
|
|
20
20
|
};
|
|
21
21
|
return t ? /* @__PURE__ */ i(a.Provider, {
|
|
22
22
|
value: p,
|
|
23
|
-
children: /* @__PURE__ */ i(
|
|
23
|
+
children: /* @__PURE__ */ i(n, {
|
|
24
24
|
scopeId: null,
|
|
25
25
|
gateway: "global",
|
|
26
26
|
children: e
|
|
27
27
|
})
|
|
28
28
|
}) : /* @__PURE__ */ i(a.Provider, {
|
|
29
29
|
value: p,
|
|
30
|
-
children: /* @__PURE__ */ i(
|
|
30
|
+
children: /* @__PURE__ */ i(r, { children: e })
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
33
|
//#endregion
|