@burdenoff/microfe-notification 2026.529.2 → 2026.601.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.
@@ -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 { Navigate as u, Route as d, Routes as f, useNavigate as p } from "react-router-dom";
10
- import { useGlobalUi as m } from "@burdenoff/fe-libs/shared/providers/shell";
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 } = m(), n = p(), { basePath: r } = e();
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, p = o ? !!o.value : !1, m = s ? !!s.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(f, { children: [
42
- /* @__PURE__ */ h(d, {
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(d, {
46
+ /* @__PURE__ */ h(f, {
47
47
  path: "center",
48
48
  element: /* @__PURE__ */ h(n, {})
49
49
  }),
50
- /* @__PURE__ */ h(d, {
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(d, {
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(d, {
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(d, {
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
- p && /* @__PURE__ */ h(d, {
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
- p && /* @__PURE__ */ h(d, {
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(d, {
98
+ /* @__PURE__ */ h(f, {
99
99
  path: "*",
100
- element: /* @__PURE__ */ h(u, {
100
+ element: /* @__PURE__ */ h(d, {
101
101
  to: "..",
102
102
  replace: !0,
103
103
  relative: "path"
@@ -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 { 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";
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 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}`);
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 (f) return f([
16
+ if (p) return p([
13
17
  {
14
18
  id: "notification-center",
15
- label: "Notification Center",
16
- path: h(m, "center"),
17
- icon: /* @__PURE__ */ u(o, { size: 20 }),
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(m, "history"),
25
- icon: /* @__PURE__ */ u(a, { size: 20 }),
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(m, "templates"),
33
- icon: /* @__PURE__ */ u(s, { size: 20 }),
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(m, "topics"),
41
- icon: /* @__PURE__ */ u(l, { size: 20 }),
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(m, "preferences"),
49
- icon: /* @__PURE__ */ u(c, { size: 20 }),
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
- }, [f, m]), n(() => {
55
- if (p) return p([{
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
- }, [p]), /* @__PURE__ */ u(r, {
63
- fallback: /* @__PURE__ */ u("div", {
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__ */ u(i, {
75
+ children: /* @__PURE__ */ d(i, {
68
76
  workspaceId: null,
69
77
  gateway: "global",
70
78
  defaultEnabled: !0,
71
- children: /* @__PURE__ */ u(e, {
72
- ...d,
73
- children: /* @__PURE__ */ u(t, {})
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 { d as NotificationRoot };
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":";;;;;;;;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"}
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 { Archive as a, Bell as o, Settings2 as s } from "lucide-react";
7
- import { jsx as c } from "react/jsx-runtime";
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 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}`);
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 (u) return u([
16
+ if (d) return d([
13
17
  {
14
18
  id: "user-notification-center",
15
- label: "Notification Center",
16
- path: h(f, "center"),
17
- icon: /* @__PURE__ */ c(o, { size: 20 }),
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
- ...m ? [{
25
+ ..._ ? [{
22
26
  id: "user-notification-history",
23
- label: "History",
24
- path: h(f, "history"),
25
- icon: /* @__PURE__ */ c(a, { size: 20 }),
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: h(f, "preferences"),
33
- icon: /* @__PURE__ */ c(s, { size: 20 }),
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
- u,
40
- f,
43
+ d,
44
+ p,
45
+ _,
41
46
  m
42
47
  ]), n(() => {
43
- if (d) return d([{
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
- }, [d]), /* @__PURE__ */ c(r, {
51
- fallback: /* @__PURE__ */ c("div", {
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__ */ c(e, {
56
- ...l,
57
- children: /* @__PURE__ */ c(t, {})
60
+ children: /* @__PURE__ */ l(e, {
61
+ ...u,
62
+ children: /* @__PURE__ */ l(t, {})
58
63
  })
59
64
  });
60
65
  }
61
66
  //#endregion
62
- export { l as UserNotificationRoot };
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":";;;;;;;;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"}
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"}
@@ -1,56 +1,86 @@
1
1
  import { getMainDefinition as e } from "../node_modules/@apollo/client/utilities/internal/getMainDefinition.js";
2
2
  import { GraphQLWsLink as t } from "../node_modules/@apollo/client/link/subscriptions/index.js";
3
3
  import { createClient as n } from "../node_modules/graphql-ws/dist/client.js";
4
- import { ApolloClient as r, HttpLink as i, InMemoryCache as a, from as o, split as s } from "@apollo/client";
5
- import { setContext as c } from "@apollo/client/link/context";
6
- import { onError as l } from "@apollo/client/link/error";
7
- import { isAuthNetworkError as u, redirectToLogin as d } from "@burdenoff/fe-libs/shared/utils";
4
+ import { ApolloClient as r, ApolloLink as i, HttpLink as a, InMemoryCache as o, Observable as s, from as c, split as l } from "@apollo/client";
5
+ import { setContext as u } from "@apollo/client/link/context";
6
+ import { onError as d } from "@apollo/client/link/error";
7
+ import { isAuthNetworkError as f, redirectToLogin as p } from "@burdenoff/fe-libs/shared/utils";
8
8
  //#region src/graphql/global-client.ts
9
- function f(e = []) {
9
+ function m(e = []) {
10
10
  return e.some((e) => {
11
11
  let t = typeof e.extensions?.code == "string" ? e.extensions.code : "", n = typeof e.extensions?.errorCode == "string" ? e.extensions.errorCode : "", r = (e.message ?? "").toLowerCase();
12
12
  return t === "UNAUTHENTICATED" || n === "TOKEN_EXPIRED" || r.includes("token_expired") || r.includes("token expired") || r.includes("session expired") || r.includes("unauthorized") || r.includes("unauthenticated") || r.includes("authentication required") || r.includes("workspace context missing");
13
13
  });
14
14
  }
15
- var p = null, m = null, h = null;
15
+ function h(t) {
16
+ let n = e(t);
17
+ return n.kind === "OperationDefinition" && n.operation === "mutation";
18
+ }
16
19
  function g(e) {
20
+ let t = e.errors;
21
+ return Array.isArray(t) && t.length > 0;
22
+ }
23
+ function _(e) {
24
+ return new i((t, n) => {
25
+ let r = h(t.query) && t.getContext().autoRefreshAfterMutation !== !1 && t.getContext().skipMutationAutoRefresh !== !0;
26
+ return new s((i) => {
27
+ let a = n(t).subscribe({
28
+ next: (t) => {
29
+ i.next(t), !(!r || g(t)) && e()?.refetchQueries({ include: "active" });
30
+ },
31
+ error: (e) => {
32
+ i.error(e);
33
+ },
34
+ complete: () => {
35
+ i.complete();
36
+ }
37
+ });
38
+ return () => {
39
+ a.unsubscribe();
40
+ };
41
+ });
42
+ });
43
+ }
44
+ var v = null, y = null, b = null;
45
+ function x(e) {
17
46
  let t = e.replace(/\/$/, "");
18
47
  return t.endsWith("/graphql") ? t : t.endsWith("/global") ? `${t}/graphql` : `${t}/global/graphql`;
19
48
  }
20
- function _(e) {
49
+ function S(e) {
21
50
  return e.startsWith("https://") ? e.replace("https://", "wss://") : e.startsWith("http://") ? e.replace("http://", "ws://") : e;
22
51
  }
23
- function v(v, y) {
24
- let b = g(v || "https://gw-global.local.burdenoff.com/global/graphql"), x = y ?? null;
25
- if (p && m === b && h === x) return p;
26
- m = b, h = x;
27
- let S = new i({ uri: b }), C = typeof window < "u" ? new t(n({
28
- url: _(b),
29
- connectionParams: () => ({ authorization: y ? `Bearer ${y}` : "" }),
52
+ function C(i, s) {
53
+ let h = x(i || "https://gw-global.local.burdenoff.com/global/graphql"), g = s ?? null;
54
+ if (v && y === h && b === g) return v;
55
+ y = h, b = g;
56
+ let C = new a({ uri: h }), w = typeof window < "u" ? new t(n({
57
+ url: S(h),
58
+ connectionParams: () => ({ authorization: s ? `Bearer ${s}` : "" }),
30
59
  lazy: !0,
31
60
  retryAttempts: 3
32
- })) : null, w = c((e, t) => ({ headers: {
61
+ })) : null, T = u((e, t) => ({ headers: {
33
62
  ...t.headers,
34
- authorization: y ? `Bearer ${y}` : ""
35
- } }));
36
- return p = new r({
37
- link: o([
38
- l(({ error: e }) => {
39
- if (e) {
40
- if (f("errors" in e && Array.isArray(e.errors) ? e.errors : [])) {
41
- d();
42
- return;
43
- }
44
- e instanceof Error && u(e) && d();
45
- }
46
- }),
47
- w,
48
- C ? s(({ query: t }) => {
49
- let n = e(t);
50
- return n.kind === "OperationDefinition" && n.operation === "subscription";
51
- }, C, S) : S
63
+ authorization: s ? `Bearer ${s}` : ""
64
+ } })), E = d(({ error: e }) => {
65
+ if (e) {
66
+ if (m("errors" in e && Array.isArray(e.errors) ? e.errors : [])) {
67
+ p();
68
+ return;
69
+ }
70
+ e instanceof Error && f(e) && p();
71
+ }
72
+ }), D = w ? l(({ query: t }) => {
73
+ let n = e(t);
74
+ return n.kind === "OperationDefinition" && n.operation === "subscription";
75
+ }, w, C) : C;
76
+ return v = new r({
77
+ link: c([
78
+ E,
79
+ _(() => v),
80
+ T,
81
+ D
52
82
  ]),
53
- cache: new a({ typePolicies: {
83
+ cache: new o({ typePolicies: {
54
84
  Query: { fields: {
55
85
  notifications: { merge(e, t) {
56
86
  return t;
@@ -67,9 +97,9 @@ function v(v, y) {
67
97
  query: { fetchPolicy: "cache-first" },
68
98
  mutate: { fetchPolicy: "network-only" }
69
99
  }
70
- }), p;
100
+ }), v;
71
101
  }
72
102
  //#endregion
73
- export { v as getGlobalNotificationClient };
103
+ export { C as getGlobalNotificationClient };
74
104
 
75
105
  //# sourceMappingURL=global-client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"global-client.js","names":[],"sources":["../../src/graphql/global-client.ts"],"sourcesContent":["import { ApolloClient, InMemoryCache, HttpLink, from, split } from '@apollo/client';\nimport { setContext } from '@apollo/client/link/context';\nimport { onError } from '@apollo/client/link/error';\nimport { GraphQLWsLink } from '@apollo/client/link/subscriptions';\nimport { getMainDefinition } from '@apollo/client/utilities';\nimport { isAuthNetworkError, redirectToLogin } from '@burdenoff/fe-libs/shared/utils';\nimport { createClient } from 'graphql-ws';\n\nfunction hasSessionAuthErrors(\n errors: ReadonlyArray<{ message?: string; extensions?: Record<string, unknown> }> = []\n): boolean {\n return errors.some((error) => {\n const code = typeof error.extensions?.code === 'string' ? error.extensions.code : '';\n const errorCode =\n typeof error.extensions?.errorCode === 'string' ? error.extensions.errorCode : '';\n const message = (error.message ?? '').toLowerCase();\n\n return (\n code === 'UNAUTHENTICATED' ||\n errorCode === 'TOKEN_EXPIRED' ||\n message.includes('token_expired') ||\n message.includes('token expired') ||\n message.includes('session expired') ||\n message.includes('unauthorized') ||\n message.includes('unauthenticated') ||\n message.includes('authentication required') ||\n message.includes('workspace context missing')\n );\n });\n}\n\nlet globalClientInstance: InstanceType<typeof ApolloClient> | null = null;\nlet currentGlobalUrl: string | null = null;\nlet currentAuthToken: string | null = null;\n\n/**\n * Default Global Gateway URL\n * Notifications are a GLOBAL service and must use the global gateway\n */\nexport const DEFAULT_GLOBAL_GATEWAY_URL = 'https://gw-global.local.burdenoff.com/global/graphql';\n\nfunction toGraphqlUrl(url: string): string {\n const normalized = url.replace(/\\/$/, '');\n if (normalized.endsWith('/graphql')) return normalized;\n if (normalized.endsWith('/global')) return `${normalized}/graphql`;\n return `${normalized}/global/graphql`;\n}\n\nfunction toSubscriptionUrl(url: string): string {\n if (url.startsWith('https://')) return url.replace('https://', 'wss://');\n if (url.startsWith('http://')) return url.replace('http://', 'ws://');\n return url;\n}\n\n/**\n * Get or create the singleton Apollo client for global notification operations\n *\n * @param globalGatewayUrl - Global Gateway GraphQL URL (default: https://gw-global.local.burdenoff.com/global/graphql)\n * @param authToken - Optional JWT auth token\n */\nexport function getGlobalNotificationClient(\n globalGatewayUrl?: string,\n authToken?: string\n): InstanceType<typeof ApolloClient> {\n const url = toGraphqlUrl(globalGatewayUrl || DEFAULT_GLOBAL_GATEWAY_URL);\n const nextAuthToken = authToken ?? null;\n\n // Return existing instance if config hasn't changed\n if (globalClientInstance && currentGlobalUrl === url && currentAuthToken === nextAuthToken) {\n return globalClientInstance;\n }\n\n // Update current config\n currentGlobalUrl = url;\n currentAuthToken = nextAuthToken;\n\n const httpLink = new HttpLink({\n uri: url,\n });\n\n const wsLink =\n typeof window !== 'undefined'\n ? new GraphQLWsLink(\n createClient({\n url: toSubscriptionUrl(url),\n connectionParams: () => ({\n authorization: authToken ? `Bearer ${authToken}` : '',\n }),\n lazy: true,\n retryAttempts: 3,\n })\n )\n : null;\n\n const authLink = setContext((_, prevContext) => {\n return {\n headers: {\n ...(prevContext.headers as Record<string, string>),\n authorization: authToken ? `Bearer ${authToken}` : '',\n },\n };\n });\n\n const errorLink = onError(({ error }) => {\n if (!error) return;\n\n const graphQLErrors = 'errors' in error && Array.isArray(error.errors) ? error.errors : [];\n\n if (hasSessionAuthErrors(graphQLErrors)) {\n redirectToLogin();\n return;\n }\n\n if (error instanceof Error && isAuthNetworkError(error)) {\n redirectToLogin();\n }\n });\n\n const transportLink = wsLink\n ? split(\n ({ query }) => {\n const definition = getMainDefinition(query);\n return (\n definition.kind === 'OperationDefinition' && definition.operation === 'subscription'\n );\n },\n wsLink,\n httpLink\n )\n : httpLink;\n\n globalClientInstance = new ApolloClient({\n link: from([errorLink, authLink, transportLink]),\n cache: new InMemoryCache({\n typePolicies: {\n Query: {\n fields: {\n notifications: {\n merge(_existing: unknown, incoming: unknown) {\n return incoming;\n },\n },\n notificationTemplates: {\n merge(_existing: unknown, incoming: unknown) {\n return incoming;\n },\n },\n },\n },\n Notification: {\n keyFields: ['id'],\n },\n NotificationTemplate: {\n keyFields: ['id'],\n },\n },\n }),\n defaultOptions: {\n watchQuery: {\n fetchPolicy: 'cache-and-network',\n },\n query: {\n fetchPolicy: 'cache-first',\n },\n mutate: {\n fetchPolicy: 'network-only',\n },\n },\n });\n\n return globalClientInstance;\n}\n\n/**\n * Reset the singleton client (useful for testing or re-initialization)\n */\nexport function resetGlobalNotificationClient(): void {\n if (globalClientInstance) {\n globalClientInstance.clearStore();\n globalClientInstance = null;\n currentGlobalUrl = null;\n currentAuthToken = null;\n }\n}\n"],"mappings":";;;;;;;;AAQA,SAAS,EACP,IAAoF,EAAE,EAC7E;AACT,QAAO,EAAO,MAAM,MAAU;EAC5B,IAAM,IAAO,OAAO,EAAM,YAAY,QAAS,WAAW,EAAM,WAAW,OAAO,IAC5E,IACJ,OAAO,EAAM,YAAY,aAAc,WAAW,EAAM,WAAW,YAAY,IAC3E,KAAW,EAAM,WAAW,IAAI,aAAa;AAEnD,SACE,MAAS,qBACT,MAAc,mBACd,EAAQ,SAAS,gBAAgB,IACjC,EAAQ,SAAS,gBAAgB,IACjC,EAAQ,SAAS,kBAAkB,IACnC,EAAQ,SAAS,eAAe,IAChC,EAAQ,SAAS,kBAAkB,IACnC,EAAQ,SAAS,0BAA0B,IAC3C,EAAQ,SAAS,4BAA4B;GAE/C;;AAGJ,IAAI,IAAiE,MACjE,IAAkC,MAClC,IAAkC;AAQtC,SAAS,EAAa,GAAqB;CACzC,IAAM,IAAa,EAAI,QAAQ,OAAO,GAAG;AAGzC,QAFI,EAAW,SAAS,WAAW,GAAS,IACxC,EAAW,SAAS,UAAU,GAAS,GAAG,EAAW,YAClD,GAAG,EAAW;;AAGvB,SAAS,EAAkB,GAAqB;AAG9C,QAFI,EAAI,WAAW,WAAW,GAAS,EAAI,QAAQ,YAAY,SAAS,GACpE,EAAI,WAAW,UAAU,GAAS,EAAI,QAAQ,WAAW,QAAQ,GAC9D;;AAST,SAAgB,EACd,GACA,GACmC;CACnC,IAAM,IAAM,EAAa,KAAA,uDAA+C,EAClE,IAAgB,KAAa;AAGnC,KAAI,KAAwB,MAAqB,KAAO,MAAqB,EAC3E,QAAO;AAKT,CADA,IAAmB,GACnB,IAAmB;CAEnB,IAAM,IAAW,IAAI,EAAS,EAC5B,KAAK,GACN,CAAC,EAEI,IACJ,OAAO,SAAW,MACd,IAAI,EACF,EAAa;EACX,KAAK,EAAkB,EAAI;EAC3B,yBAAyB,EACvB,eAAe,IAAY,UAAU,MAAc,IACpD;EACD,MAAM;EACN,eAAe;EAChB,CAAC,CACH,GACD,MAEA,IAAW,GAAY,GAAG,OACvB,EACL,SAAS;EACP,GAAI,EAAY;EAChB,eAAe,IAAY,UAAU,MAAc;EACpD,EACF,EACD;AAqEF,QAvCA,IAAuB,IAAI,EAAa;EACtC,MAAM,EAAK;GA7BK,GAAS,EAAE,eAAY;AAClC,WAIL;SAAI,EAFkB,YAAY,KAAS,MAAM,QAAQ,EAAM,OAAO,GAAG,EAAM,SAAS,EAAE,CAEnD,EAAE;AACvC,SAAiB;AACjB;;AAGF,KAAI,aAAiB,SAAS,EAAmB,EAAM,IACrD,GAAiB;;KAEnB;GAgBuB;GAdH,IAClB,GACG,EAAE,eAAY;IACb,IAAM,IAAa,EAAkB,EAAM;AAC3C,WACE,EAAW,SAAS,yBAAyB,EAAW,cAAc;MAG1E,GACA,EACD,GACD;GAG6C,CAAC;EAChD,OAAO,IAAI,EAAc,EACvB,cAAc;GACZ,OAAO,EACL,QAAQ;IACN,eAAe,EACb,MAAM,GAAoB,GAAmB;AAC3C,YAAO;OAEV;IACD,uBAAuB,EACrB,MAAM,GAAoB,GAAmB;AAC3C,YAAO;OAEV;IACF,EACF;GACD,cAAc,EACZ,WAAW,CAAC,KAAK,EAClB;GACD,sBAAsB,EACpB,WAAW,CAAC,KAAK,EAClB;GACF,EACF,CAAC;EACF,gBAAgB;GACd,YAAY,EACV,aAAa,qBACd;GACD,OAAO,EACL,aAAa,eACd;GACD,QAAQ,EACN,aAAa,gBACd;GACF;EACF,CAAC,EAEK"}
1
+ {"version":3,"file":"global-client.js","names":[],"sources":["../../src/graphql/global-client.ts"],"sourcesContent":["import {\n ApolloClient,\n ApolloLink,\n type FetchResult,\n InMemoryCache,\n HttpLink,\n Observable,\n from,\n split,\n} from '@apollo/client';\nimport { setContext } from '@apollo/client/link/context';\nimport { onError } from '@apollo/client/link/error';\nimport { GraphQLWsLink } from '@apollo/client/link/subscriptions';\nimport { getMainDefinition } from '@apollo/client/utilities';\nimport { isAuthNetworkError, redirectToLogin } from '@burdenoff/fe-libs/shared/utils';\nimport { createClient } from 'graphql-ws';\n\nfunction hasSessionAuthErrors(\n errors: ReadonlyArray<{ message?: string; extensions?: Record<string, unknown> }> = []\n): boolean {\n return errors.some((error) => {\n const code = typeof error.extensions?.code === 'string' ? error.extensions.code : '';\n const errorCode =\n typeof error.extensions?.errorCode === 'string' ? error.extensions.errorCode : '';\n const message = (error.message ?? '').toLowerCase();\n\n return (\n code === 'UNAUTHENTICATED' ||\n errorCode === 'TOKEN_EXPIRED' ||\n message.includes('token_expired') ||\n message.includes('token expired') ||\n message.includes('session expired') ||\n message.includes('unauthorized') ||\n message.includes('unauthenticated') ||\n message.includes('authentication required') ||\n message.includes('workspace context missing')\n );\n });\n}\n\nfunction isMutationOperation(query: Parameters<typeof getMainDefinition>[0]): boolean {\n const definition = getMainDefinition(query);\n return definition.kind === 'OperationDefinition' && definition.operation === 'mutation';\n}\n\nfunction hasGraphQLResultErrors(result: FetchResult<Record<string, unknown>>): boolean {\n const errors = result.errors;\n return Array.isArray(errors) && errors.length > 0;\n}\n\nfunction createMutationAutoRefreshLink(\n getClient: () => InstanceType<typeof ApolloClient> | null\n): ApolloLink {\n return new ApolloLink((operation, forward) => {\n const shouldRefreshAfterMutation =\n isMutationOperation(operation.query) &&\n operation.getContext().autoRefreshAfterMutation !== false &&\n operation.getContext().skipMutationAutoRefresh !== true;\n\n return new Observable<FetchResult<Record<string, unknown>>>((observer) => {\n const subscription = forward(operation).subscribe({\n next: (result) => {\n observer.next(result as FetchResult<Record<string, unknown>>);\n if (!shouldRefreshAfterMutation || hasGraphQLResultErrors(result)) return;\n\n void getClient()?.refetchQueries({ include: 'active' });\n },\n error: (error: unknown) => {\n observer.error(error);\n },\n complete: () => {\n observer.complete();\n },\n });\n\n return () => {\n subscription.unsubscribe();\n };\n });\n });\n}\n\nlet globalClientInstance: InstanceType<typeof ApolloClient> | null = null;\nlet currentGlobalUrl: string | null = null;\nlet currentAuthToken: string | null = null;\n\n/**\n * Default Global Gateway URL\n * Notifications are a GLOBAL service and must use the global gateway\n */\nexport const DEFAULT_GLOBAL_GATEWAY_URL = 'https://gw-global.local.burdenoff.com/global/graphql';\n\nfunction toGraphqlUrl(url: string): string {\n const normalized = url.replace(/\\/$/, '');\n if (normalized.endsWith('/graphql')) return normalized;\n if (normalized.endsWith('/global')) return `${normalized}/graphql`;\n return `${normalized}/global/graphql`;\n}\n\nfunction toSubscriptionUrl(url: string): string {\n if (url.startsWith('https://')) return url.replace('https://', 'wss://');\n if (url.startsWith('http://')) return url.replace('http://', 'ws://');\n return url;\n}\n\n/**\n * Get or create the singleton Apollo client for global notification operations\n *\n * @param globalGatewayUrl - Global Gateway GraphQL URL (default: https://gw-global.local.burdenoff.com/global/graphql)\n * @param authToken - Optional JWT auth token\n */\nexport function getGlobalNotificationClient(\n globalGatewayUrl?: string,\n authToken?: string\n): InstanceType<typeof ApolloClient> {\n const url = toGraphqlUrl(globalGatewayUrl || DEFAULT_GLOBAL_GATEWAY_URL);\n const nextAuthToken = authToken ?? null;\n\n // Return existing instance if config hasn't changed\n if (globalClientInstance && currentGlobalUrl === url && currentAuthToken === nextAuthToken) {\n return globalClientInstance;\n }\n\n // Update current config\n currentGlobalUrl = url;\n currentAuthToken = nextAuthToken;\n\n const httpLink = new HttpLink({\n uri: url,\n });\n\n const wsLink =\n typeof window !== 'undefined'\n ? new GraphQLWsLink(\n createClient({\n url: toSubscriptionUrl(url),\n connectionParams: () => ({\n authorization: authToken ? `Bearer ${authToken}` : '',\n }),\n lazy: true,\n retryAttempts: 3,\n })\n )\n : null;\n\n const authLink = setContext((_, prevContext) => {\n return {\n headers: {\n ...(prevContext.headers as Record<string, string>),\n authorization: authToken ? `Bearer ${authToken}` : '',\n },\n };\n });\n\n const errorLink = onError(({ error }) => {\n if (!error) return;\n\n const graphQLErrors = 'errors' in error && Array.isArray(error.errors) ? error.errors : [];\n\n if (hasSessionAuthErrors(graphQLErrors)) {\n redirectToLogin();\n return;\n }\n\n if (error instanceof Error && isAuthNetworkError(error)) {\n redirectToLogin();\n }\n });\n\n const transportLink = wsLink\n ? split(\n ({ query }) => {\n const definition = getMainDefinition(query);\n return (\n definition.kind === 'OperationDefinition' && definition.operation === 'subscription'\n );\n },\n wsLink,\n httpLink\n )\n : httpLink;\n\n const mutationAutoRefreshLink = createMutationAutoRefreshLink(() => globalClientInstance);\n\n globalClientInstance = new ApolloClient({\n link: from([errorLink, mutationAutoRefreshLink, authLink, transportLink]),\n cache: new InMemoryCache({\n typePolicies: {\n Query: {\n fields: {\n notifications: {\n merge(_existing: unknown, incoming: unknown) {\n return incoming;\n },\n },\n notificationTemplates: {\n merge(_existing: unknown, incoming: unknown) {\n return incoming;\n },\n },\n },\n },\n Notification: {\n keyFields: ['id'],\n },\n NotificationTemplate: {\n keyFields: ['id'],\n },\n },\n }),\n defaultOptions: {\n watchQuery: {\n fetchPolicy: 'cache-and-network',\n },\n query: {\n fetchPolicy: 'cache-first',\n },\n mutate: {\n fetchPolicy: 'network-only',\n },\n },\n });\n\n return globalClientInstance;\n}\n\n/**\n * Reset the singleton client (useful for testing or re-initialization)\n */\nexport function resetGlobalNotificationClient(): void {\n if (globalClientInstance) {\n globalClientInstance.clearStore();\n globalClientInstance = null;\n currentGlobalUrl = null;\n currentAuthToken = null;\n }\n}\n"],"mappings":";;;;;;;;AAiBA,SAAS,EACP,IAAoF,EAAE,EAC7E;AACT,QAAO,EAAO,MAAM,MAAU;EAC5B,IAAM,IAAO,OAAO,EAAM,YAAY,QAAS,WAAW,EAAM,WAAW,OAAO,IAC5E,IACJ,OAAO,EAAM,YAAY,aAAc,WAAW,EAAM,WAAW,YAAY,IAC3E,KAAW,EAAM,WAAW,IAAI,aAAa;AAEnD,SACE,MAAS,qBACT,MAAc,mBACd,EAAQ,SAAS,gBAAgB,IACjC,EAAQ,SAAS,gBAAgB,IACjC,EAAQ,SAAS,kBAAkB,IACnC,EAAQ,SAAS,eAAe,IAChC,EAAQ,SAAS,kBAAkB,IACnC,EAAQ,SAAS,0BAA0B,IAC3C,EAAQ,SAAS,4BAA4B;GAE/C;;AAGJ,SAAS,EAAoB,GAAyD;CACpF,IAAM,IAAa,EAAkB,EAAM;AAC3C,QAAO,EAAW,SAAS,yBAAyB,EAAW,cAAc;;AAG/E,SAAS,EAAuB,GAAuD;CACrF,IAAM,IAAS,EAAO;AACtB,QAAO,MAAM,QAAQ,EAAO,IAAI,EAAO,SAAS;;AAGlD,SAAS,EACP,GACY;AACZ,QAAO,IAAI,GAAY,GAAW,MAAY;EAC5C,IAAM,IACJ,EAAoB,EAAU,MAAM,IACpC,EAAU,YAAY,CAAC,6BAA6B,MACpD,EAAU,YAAY,CAAC,4BAA4B;AAErD,SAAO,IAAI,GAAkD,MAAa;GACxE,IAAM,IAAe,EAAQ,EAAU,CAAC,UAAU;IAChD,OAAO,MAAW;AAChB,OAAS,KAAK,EAA+C,EACzD,GAAC,KAA8B,EAAuB,EAAO,KAE5D,GAAW,EAAE,eAAe,EAAE,SAAS,UAAU,CAAC;;IAEzD,QAAQ,MAAmB;AACzB,OAAS,MAAM,EAAM;;IAEvB,gBAAgB;AACd,OAAS,UAAU;;IAEtB,CAAC;AAEF,gBAAa;AACX,MAAa,aAAa;;IAE5B;GACF;;AAGJ,IAAI,IAAiE,MACjE,IAAkC,MAClC,IAAkC;AAQtC,SAAS,EAAa,GAAqB;CACzC,IAAM,IAAa,EAAI,QAAQ,OAAO,GAAG;AAGzC,QAFI,EAAW,SAAS,WAAW,GAAS,IACxC,EAAW,SAAS,UAAU,GAAS,GAAG,EAAW,YAClD,GAAG,EAAW;;AAGvB,SAAS,EAAkB,GAAqB;AAG9C,QAFI,EAAI,WAAW,WAAW,GAAS,EAAI,QAAQ,YAAY,SAAS,GACpE,EAAI,WAAW,UAAU,GAAS,EAAI,QAAQ,WAAW,QAAQ,GAC9D;;AAST,SAAgB,EACd,GACA,GACmC;CACnC,IAAM,IAAM,EAAa,KAAA,uDAA+C,EAClE,IAAgB,KAAa;AAGnC,KAAI,KAAwB,MAAqB,KAAO,MAAqB,EAC3E,QAAO;AAKT,CADA,IAAmB,GACnB,IAAmB;CAEnB,IAAM,IAAW,IAAI,EAAS,EAC5B,KAAK,GACN,CAAC,EAEI,IACJ,OAAO,SAAW,MACd,IAAI,EACF,EAAa;EACX,KAAK,EAAkB,EAAI;EAC3B,yBAAyB,EACvB,eAAe,IAAY,UAAU,MAAc,IACpD;EACD,MAAM;EACN,eAAe;EAChB,CAAC,CACH,GACD,MAEA,IAAW,GAAY,GAAG,OACvB,EACL,SAAS;EACP,GAAI,EAAY;EAChB,eAAe,IAAY,UAAU,MAAc;EACpD,EACF,EACD,EAEI,IAAY,GAAS,EAAE,eAAY;AAClC,SAIL;OAAI,EAFkB,YAAY,KAAS,MAAM,QAAQ,EAAM,OAAO,GAAG,EAAM,SAAS,EAAE,CAEnD,EAAE;AACvC,OAAiB;AACjB;;AAGF,GAAI,aAAiB,SAAS,EAAmB,EAAM,IACrD,GAAiB;;GAEnB,EAEI,IAAgB,IAClB,GACG,EAAE,eAAY;EACb,IAAM,IAAa,EAAkB,EAAM;AAC3C,SACE,EAAW,SAAS,yBAAyB,EAAW,cAAc;IAG1E,GACA,EACD,GACD;AA2CJ,QAvCA,IAAuB,IAAI,EAAa;EACtC,MAAM,EAAK;GAAC;GAHkB,QAAoC,EAAqB;GAGvC;GAAU;GAAc,CAAC;EACzE,OAAO,IAAI,EAAc,EACvB,cAAc;GACZ,OAAO,EACL,QAAQ;IACN,eAAe,EACb,MAAM,GAAoB,GAAmB;AAC3C,YAAO;OAEV;IACD,uBAAuB,EACrB,MAAM,GAAoB,GAAmB;AAC3C,YAAO;OAEV;IACF,EACF;GACD,cAAc,EACZ,WAAW,CAAC,KAAK,EAClB;GACD,sBAAsB,EACpB,WAAW,CAAC,KAAK,EAClB;GACF,EACF,CAAC;EACF,gBAAgB;GACd,YAAY,EACV,aAAa,qBACd;GACD,OAAO,EACL,aAAa,eACd;GACD,QAAQ,EACN,aAAa,gBACd;GACF;EACF,CAAC,EAEK"}
@@ -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 { AlertCircle as oe, ArrowLeft as se, Bell as ce, CheckCircle2 as s, Eye as le, EyeOff as ue, FileText as de, ImagePlus as fe, Link2 as pe, Loader2 as c, Mail as me, MessageSquare as l, Send as he, Smartphone as ge, User as u, Users as _e, X as ve } from "lucide-react";
13
- import { useNavigate as ye } from "react-router-dom";
14
- import { useGlobalUi as be, usePermissions as xe } from "@burdenoff/fe-libs/shared/providers/shell";
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: me,
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: ge,
33
+ icon: ve,
34
34
  description: "Mobile push notification"
35
35
  },
36
36
  {
37
37
  value: "WEBHOOK",
38
38
  label: "Webhook",
39
- icon: pe,
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 me = ye(), l = n(), { hasPermission: ge, isLoading: Oe, refreshPermissions: ke } = xe(), { showToast: Ae } = be(), { 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([{
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 = ge(te.NOTIFICATION_CREATE), _t = ge(te.NOTIFICATION_SEND);
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: () => me("/notifications/center"),
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(se, { size: 20 })
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 ? ue : le, { size: 16 }), l("notifications.preview", "Preview")]
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 : he, { size: 16 }), p ? l("notifications.sending", "Sending...") : J ? l("notifications.sent", "Sent!") : W ? l("notifications.schedule", "Schedule") : l("notifications.sendNotification", "Send Notification")]
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(oe, {
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(de, {
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(ce, {
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(_e, {
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(ve, {
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(ce, {
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(ve, {
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(de, {
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: () => me("/notifications/templates/new"),
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(pe, {
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(fe, {
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 { Bell as l, Search as u } from "lucide-react";
11
- import { usePermissions as d } from "@burdenoff/fe-libs/shared/providers/shell";
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 } = d(), { currentUser: x } = e(), { notifications: S, unreadCount: C, notificationFilter: w, markAsRead: T, markAllAsRead: E, archiveNotification: D, recordAction: O, updateFilter: k, resetFilter: A } = t({
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(u, {
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(l, {
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 { CalendarClock as s, Download as c, RefreshCw as l, Search as u } from "lucide-react";
10
- import { usePermissions as d } from "@burdenoff/fe-libs/shared/providers/shell";
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 } = d(), { 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("");
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(c, { size: 16 }), g("notifications.export", "Export")]
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(u, {
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(l, {
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(s, {
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 { Archive as s, Download as c, Search as l } from "lucide-react";
10
- import { usePermissions as u } from "@burdenoff/fe-libs/shared/providers/shell";
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 } = u(), { currentUser: _ } = e(), { topics: v } = n({ isActive: !0 }), { notifications: y, notificationFilter: b, updateFilter: x, archiveNotification: S, unarchiveNotification: C, recordAction: w } = t({ baseFilter: p });
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(c, { size: 16 }), m("notifications.export", "Export")]
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(l, {
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(s, {
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 { BellRing as f, Search as p, ToggleLeft as m, ToggleRight as h } from "lucide-react";
11
- import { usePermissions as g } from "@burdenoff/fe-libs/shared/providers/shell";
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 } = g(), { currentUser: E } = e(), { topics: D, isLoading: O } = r({
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__ */ _(f, {
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 ? h : m, { size: 18 }), r ? C("notifications.saving", "Saving...") : n ? C("notifications.enabled", "Enabled") : C("notifications.disabled", "Disabled")]
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__ */ _(p, {
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 { AlertCircle as c, FileText as l, Loader2 as u, Plus as d, RefreshCw as f, Search as p, Trash2 as m } from "lucide-react";
7
- import { useNavigate as h } from "react-router-dom";
8
- import { usePermissions as g } from "@burdenoff/fe-libs/shared/providers/shell";
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 = h(), w = e(), { locale: T } = y(), { hasPermission: E, isLoading: D } = g(), { 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) => {
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__ */ _(u, {
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__ */ _(c, {
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__ */ _(f, { size: 14 }), w("notifTemplates.retry", "Retry")]
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__ */ _(d, { size: 16 }), w("notifTemplates.createTemplate", "Create Template")]
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__ */ _(p, {
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__ */ _(m, { size: 14 }),
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__ */ _(c, {
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__ */ _(l, {
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__ */ _(l, {
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__ */ _(u, {
261
+ children: A && z === e.id ? /* @__PURE__ */ _(d, {
262
262
  size: 14,
263
263
  className: "animate-spin"
264
- }) : /* @__PURE__ */ _(m, { size: 14 })
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__ */ _(u, {
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 { Plus as a, Save as o, Search as s, Trash2 as c } from "lucide-react";
7
- import { usePermissions as l } from "@burdenoff/fe-libs/shared/providers/shell";
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 } = l(), { topics: _, isLoading: v, createTopic: y, updateTopic: b, deleteTopic: x } = e(), [S, C] = i(""), [w, T] = i(null), [E, D] = i({
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(a, {
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(o, { size: 16 }), w ? m("notifications.saveTopic", "Save Topic") : m("notifications.createTopicButton", "Create Topic")]
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(s, {
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(c, { size: 14 }), m("notifications.delete", "Delete")]
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 { AlertCircle as l, ArrowLeft as re, Code as ie, Eye as u, EyeOff as d, Loader2 as f, Plus as ae, Save as p, Trash2 as oe, Type as se, Variable as ce } from "lucide-react";
9
- import { useNavigate as le, useParams as ue } from "react-router-dom";
10
- import { useGlobalUi as de, usePermissions as fe } from "@burdenoff/fe-libs/shared/providers/shell";
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 = le(), y = t(), { locale: b } = pe(), { templateId: x } = ue(), S = !!x, { hasPermission: ye, isLoading: be, refreshPermissions: xe } = fe(), { showToast: Se } = de(), { 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");
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(re, {
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(se, { size: 12 }), y("notifTemplates.contentMode.text", "Text")]
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(ie, { size: 12 }), y("notifTemplates.contentMode.html", "HTML")]
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(ce, {
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(ae, { size: 12 }), y("notifTemplates.addVariable", "Add Variable")]
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(oe, { size: 14 })
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 { MemoryRouter as n } from "react-router-dom";
3
- import { PermissionProvider as r } from "@burdenoff/fe-libs/shared/providers/shell";
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(r, {
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(n, { children: e })
30
+ children: /* @__PURE__ */ i(r, { children: e })
31
31
  });
32
32
  };
33
33
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-notification",
3
- "version": "2026.529.2",
3
+ "version": "2026.601.1",
4
4
  "description": "Notification microfrontend for multi-channel notification management",
5
5
  "type": "module",
6
6
  "imports": {