@variamosple/variamos-components 0.1.2 → 0.2.0

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.
@@ -1,16 +1,17 @@
1
1
  import { jsx as o, Fragment as u } from "react/jsx-runtime";
2
- import d, { useEffect as c } from "react";
2
+ import d, { useEffect as m } from "react";
3
3
  import { Spinner as f } from "react-bootstrap";
4
4
  import "../../Context/AnalyticsContext.js";
5
5
  import "../../Context/MenuContext.js";
6
6
  import { useRouter as p } from "../../Context/RouterContext.js";
7
7
  import { useSession as l } from "../../Context/SessionContext.js";
8
- const P = ({
8
+ import "../../Context/NotificationContext.js";
9
+ const v = ({
9
10
  redirectPath: i,
10
- children: m
11
+ children: c
11
12
  }) => {
12
13
  const [a, h] = d.useState(!1), { isAuthenticated: t, isLoading: r } = l(), { navigate: n } = p();
13
- return c(() => {
14
+ return m(() => {
14
15
  if (!r && !t && !a) {
15
16
  const e = window.location.href, s = new URLSearchParams();
16
17
  s.set("redirectTo", encodeURIComponent(e)), h(!0), setTimeout(
@@ -18,7 +19,7 @@ const P = ({
18
19
  300
19
20
  );
20
21
  }
21
- }, [t, r, i, n, a]), c(() => {
22
+ }, [t, r, i, n, a]), m(() => {
22
23
  const e = new URL(window.location.href);
23
24
  e.searchParams.has("authToken") && (localStorage.setItem("authToken", e.searchParams.get("authToken")), e.searchParams.delete("authToken"), window.history.replaceState({}, "", e));
24
25
  }, []), r || !t ? /* @__PURE__ */ o("div", { className: "d-flex justify-content-center align-items-center w-100 h-100", children: /* @__PURE__ */ o(
@@ -28,8 +29,8 @@ const P = ({
28
29
  variant: "primary",
29
30
  style: { width: "3rem", height: "3rem", borderWidth: "0.5rem" }
30
31
  }
31
- ) }) : /* @__PURE__ */ o(u, { children: m });
32
+ ) }) : /* @__PURE__ */ o(u, { children: c });
32
33
  };
33
34
  export {
34
- P as AuthWrapper
35
+ v as AuthWrapper
35
36
  };
@@ -5,10 +5,11 @@ import "../../Context/AnalyticsContext.js";
5
5
  import { useMenu as C } from "../../Context/MenuContext.js";
6
6
  import { useRouter as b } from "../../Context/RouterContext.js";
7
7
  import { useSession as x } from "../../Context/SessionContext.js";
8
+ import "../../Context/NotificationContext.js";
8
9
  import { mapToWebTarget as L } from "../../Model/Router.js";
9
10
  import { Events as y } from "../../Common/Events.js";
10
11
  import { BugFormModal as U } from "./BugFormModal.js";
11
- const u = {}, O = ({ adminApiUrl: B }) => {
12
+ const u = {}, Q = ({ adminApiUrl: B }) => {
12
13
  const { user: o, isAuthenticated: m, logout: P } = x(), { options: l } = C(), { navigate: A } = b(), [R, c] = h(!1), [k] = h([
13
14
  "Editor",
14
15
  "Model",
@@ -91,5 +92,5 @@ const u = {}, O = ({ adminApiUrl: B }) => {
91
92
  ] });
92
93
  };
93
94
  export {
94
- O as HeaderOptions
95
+ Q as HeaderOptions
95
96
  };
@@ -5,8 +5,9 @@ import "../../Context/AnalyticsContext.js";
5
5
  import "../../Context/MenuContext.js";
6
6
  import { useRouter as C } from "../../Context/RouterContext.js";
7
7
  import { useSession as N } from "../../Context/SessionContext.js";
8
+ import "../../Context/NotificationContext.js";
8
9
  import { mapToWebTarget as m } from "../../Model/Router.js";
9
- const y = ({
10
+ const z = ({
10
11
  title: e,
11
12
  type: w,
12
13
  location: g,
@@ -46,5 +47,5 @@ const y = ({
46
47
  )) });
47
48
  };
48
49
  export {
49
- y as MenuItemComponent
50
+ z as MenuItemComponent
50
51
  };
@@ -5,8 +5,9 @@ import "../../Context/AnalyticsContext.js";
5
5
  import { useMenu as N } from "../../Context/MenuContext.js";
6
6
  import { useRouter as v } from "../../Context/RouterContext.js";
7
7
  import { useSession as R } from "../../Context/SessionContext.js";
8
- const H = () => {
9
- const { navigate: f } = v(), { subMenu: n } = N(), { user: r } = R(), t = w(() => {
8
+ import "../../Context/NotificationContext.js";
9
+ const L = () => {
10
+ const { navigate: p } = v(), { subMenu: n } = N(), { user: r } = R(), t = w(() => {
10
11
  const l = (r == null ? void 0 : r.roles) || [], m = (r == null ? void 0 : r.permissions) || [];
11
12
  return n ? n.filter((o) => {
12
13
  var a, c;
@@ -19,20 +20,20 @@ const H = () => {
19
20
  (e) => m.includes(e)
20
21
  )), i;
21
22
  }) : [];
22
- }, [n, r]), p = (l) => () => {
23
- f(l);
23
+ }, [n, r]), f = (l) => () => {
24
+ p(l);
24
25
  };
25
26
  return t.length ? /* @__PURE__ */ s(h, { className: "py-1 shadow-sm bg-white", children: /* @__PURE__ */ s(g, { children: /* @__PURE__ */ s(d, { className: "d-flex justify-content-center w-100 gap-3", children: t.map((l) => /* @__PURE__ */ s(
26
27
  d.Link,
27
28
  {
28
29
  as: "button",
29
30
  className: "btn btn-link p-0",
30
- onClick: p(l.location),
31
+ onClick: f(l.location),
31
32
  children: l.title
32
33
  },
33
34
  l.location
34
35
  )) }) }) }) : null;
35
36
  };
36
37
  export {
37
- H as SubHeader
38
+ L as SubHeader
38
39
  };
@@ -4,10 +4,11 @@ import "../../Context/AnalyticsContext.js";
4
4
  import { useMenu as f } from "../../Context/MenuContext.js";
5
5
  import { useRouter as g } from "../../Context/RouterContext.js";
6
6
  import { useSession as N } from "../../Context/SessionContext.js";
7
+ import "../../Context/NotificationContext.js";
7
8
  import { HeaderOptions as k } from "./HeaderOptions.js";
8
9
  import { MenuItemComponent as n } from "./MenuItem.js";
9
10
  import { SubHeader as b } from "./SubHeader.js";
10
- const M = ({
11
+ const B = ({
11
12
  logoUrl: a,
12
13
  logoAlt: m = "App logo",
13
14
  signInUrl: s,
@@ -42,5 +43,5 @@ const M = ({
42
43
  ] });
43
44
  };
44
45
  export {
45
- M as Header
46
+ B as Header
46
47
  };
@@ -4,7 +4,8 @@ import "../../Context/AnalyticsContext.js";
4
4
  import "../../Context/MenuContext.js";
5
5
  import { useRouter as a } from "../../Context/RouterContext.js";
6
6
  import "../../Context/SessionContext.js";
7
- const u = ({ homePath: e }) => {
7
+ import "../../Context/NotificationContext.js";
8
+ const h = ({ homePath: e }) => {
8
9
  const { navigate: r } = a();
9
10
  return /* @__PURE__ */ o(i, { className: "d-flex flex-column justify-content-center align-items-center vh-100 text-center", children: [
10
11
  /* @__PURE__ */ t("h1", { className: "display-1 fw-bold text-danger", children: "403" }),
@@ -13,5 +14,5 @@ const u = ({ homePath: e }) => {
13
14
  ] });
14
15
  };
15
16
  export {
16
- u as NotAuthorized
17
+ h as NotAuthorized
17
18
  };
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ export interface NotificationBellProps {
3
+ onClick?: () => void;
4
+ className?: string;
5
+ }
6
+ export declare const NotificationBell: React.FC<NotificationBellProps>;
@@ -0,0 +1,36 @@
1
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
+ import { Button as a, Badge as n } from "react-bootstrap";
3
+ import { Bell as s } from "react-bootstrap-icons";
4
+ import { useNotifications as l } from "../../Context/NotificationContext.js";
5
+ const f = ({
6
+ onClick: o,
7
+ className: i = ""
8
+ }) => {
9
+ const { unreadCount: t } = l();
10
+ return /* @__PURE__ */ r(
11
+ a,
12
+ {
13
+ variant: "link",
14
+ onClick: o,
15
+ className: `position-relative p-2 text-dark ${i}`,
16
+ "aria-label": "Notifications",
17
+ style: { boxShadow: "none" },
18
+ children: [
19
+ /* @__PURE__ */ e(s, { size: 22 }),
20
+ t > 0 && /* @__PURE__ */ e(
21
+ n,
22
+ {
23
+ pill: !0,
24
+ bg: "danger",
25
+ className: "position-absolute translate-middle-y start-50 top-0 border border-white",
26
+ style: { fontSize: "0.65rem", padding: "0.25em 0.5em" },
27
+ children: t > 99 ? "99+" : t
28
+ }
29
+ )
30
+ ]
31
+ }
32
+ );
33
+ };
34
+ export {
35
+ f as NotificationBell
36
+ };
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ export interface NotificationDrawerProps {
3
+ show: boolean;
4
+ onClose: () => void;
5
+ }
6
+ export declare const NotificationDrawer: React.FC<NotificationDrawerProps>;
@@ -0,0 +1,166 @@
1
+ import { jsxs as i, jsx as e, Fragment as x } from "react/jsx-runtime";
2
+ import { useState as b, useEffect as z } from "react";
3
+ import { Offcanvas as o, Button as r, Nav as l, Spinner as C, ListGroup as N } from "react-bootstrap";
4
+ import { ArrowLeft as L, Gear as R, Inbox as E, Trash as g, CheckAll as I, CircleFill as K } from "react-bootstrap-icons";
5
+ import { useNotifications as B } from "../../Context/NotificationContext.js";
6
+ import { NotificationSettings as F } from "./NotificationSettings.js";
7
+ const _ = {
8
+ review_assigned: {
9
+ title: "Language Review Assigned",
10
+ body: "You have been assigned to review the translation for {{languageName}}."
11
+ },
12
+ project_created: {
13
+ title: "Project Created",
14
+ body: "The project '{{projectName}}' has been created successfully."
15
+ },
16
+ test_template: {
17
+ title: "Notification Test",
18
+ body: "Hello {{name}}, this is a real-time notification test."
19
+ }
20
+ }, P = ({
21
+ show: c,
22
+ onClose: y
23
+ }) => {
24
+ const {
25
+ notifications: d,
26
+ isLoading: u,
27
+ fetchNotifications: v,
28
+ markAsRead: k,
29
+ markAllAsRead: w,
30
+ emptyTrash: S
31
+ } = B(), [a, T] = b("inbox"), [m, h] = b(!1);
32
+ z(() => {
33
+ c && v(a);
34
+ }, [c, a]);
35
+ const f = (t, n) => {
36
+ let s = t;
37
+ for (const p of Object.keys(n))
38
+ s = s.replace(new RegExp(`{{${p}}}`, "g"), String(n[p]));
39
+ return s;
40
+ }, j = (t) => {
41
+ const n = _[t.templateKey] || {
42
+ title: "New Alert",
43
+ body: `Notification template: ${t.templateKey}`
44
+ };
45
+ return {
46
+ title: f(n.title, t.variables),
47
+ body: f(n.body, t.variables)
48
+ };
49
+ }, A = (t) => new Date(t).toLocaleDateString(void 0, {
50
+ hour: "2-digit",
51
+ minute: "2-digit"
52
+ });
53
+ return /* @__PURE__ */ i(o, { show: c, onHide: y, placement: "end", className: "text-dark", children: [
54
+ /* @__PURE__ */ e(o.Header, { closeButton: !0, className: "border-bottom", children: /* @__PURE__ */ e(o.Title, { className: "d-flex align-items-center w-100", children: m ? /* @__PURE__ */ i(x, { children: [
55
+ /* @__PURE__ */ e(
56
+ r,
57
+ {
58
+ variant: "link",
59
+ className: "p-0 me-2 text-dark",
60
+ onClick: () => h(!1),
61
+ "aria-label": "Back",
62
+ children: /* @__PURE__ */ e(L, { size: 20 })
63
+ }
64
+ ),
65
+ /* @__PURE__ */ e("span", { children: "Settings" })
66
+ ] }) : /* @__PURE__ */ i("div", { className: "d-flex justify-content-between align-items-center w-100 me-3", children: [
67
+ /* @__PURE__ */ e("span", { children: "Notifications" }),
68
+ /* @__PURE__ */ e(
69
+ r,
70
+ {
71
+ variant: "link",
72
+ className: "p-0 text-secondary",
73
+ onClick: () => h(!0),
74
+ "aria-label": "Notification Settings",
75
+ style: { boxShadow: "none" },
76
+ children: /* @__PURE__ */ e(R, { size: 20 })
77
+ }
78
+ )
79
+ ] }) }) }),
80
+ /* @__PURE__ */ e(o.Body, { className: "p-0 d-flex flex-column h-100", children: m ? /* @__PURE__ */ e("div", { className: "p-3", children: /* @__PURE__ */ e(F, {}) }) : /* @__PURE__ */ i(x, { children: [
81
+ /* @__PURE__ */ i(
82
+ l,
83
+ {
84
+ variant: "tabs",
85
+ activeKey: a,
86
+ onSelect: (t) => T(t),
87
+ className: "px-3 pt-2 bg-light border-bottom",
88
+ children: [
89
+ /* @__PURE__ */ e(l.Item, { children: /* @__PURE__ */ i(l.Link, { eventKey: "inbox", className: "d-flex align-items-center", children: [
90
+ /* @__PURE__ */ e(E, { className: "me-2" }),
91
+ "Inbox"
92
+ ] }) }),
93
+ /* @__PURE__ */ e(l.Item, { children: /* @__PURE__ */ i(l.Link, { eventKey: "trash", className: "d-flex align-items-center", children: [
94
+ /* @__PURE__ */ e(g, { className: "me-2" }),
95
+ "Trash"
96
+ ] }) })
97
+ ]
98
+ }
99
+ ),
100
+ d.length > 0 && /* @__PURE__ */ e("div", { className: "d-flex justify-content-end align-items-center p-2 bg-light border-bottom px-3", children: a === "inbox" ? /* @__PURE__ */ i(
101
+ r,
102
+ {
103
+ variant: "link",
104
+ size: "sm",
105
+ className: "p-0 text-primary text-decoration-none d-flex align-items-center",
106
+ onClick: w,
107
+ children: [
108
+ /* @__PURE__ */ e(I, { className: "me-1", size: 18 }),
109
+ "Mark all as read"
110
+ ]
111
+ }
112
+ ) : /* @__PURE__ */ i(
113
+ r,
114
+ {
115
+ variant: "link",
116
+ size: "sm",
117
+ className: "p-0 text-danger text-decoration-none d-flex align-items-center",
118
+ onClick: S,
119
+ children: [
120
+ /* @__PURE__ */ e(g, { className: "me-1", size: 16 }),
121
+ "Empty Trash"
122
+ ]
123
+ }
124
+ ) }),
125
+ /* @__PURE__ */ e("div", { className: "flex-grow-1 overflow-auto", children: u ? /* @__PURE__ */ e("div", { className: "text-center py-5", children: /* @__PURE__ */ e(C, { animation: "border", variant: "primary" }) }) : d.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center py-5 text-muted", children: /* @__PURE__ */ e("p", { className: "mb-0", children: a === "inbox" ? "Your inbox is empty!" : "No deleted notifications." }) }) : /* @__PURE__ */ e(N, { variant: "flush", children: d.map((t) => {
126
+ const { title: n, body: s } = j(t);
127
+ return /* @__PURE__ */ e(
128
+ N.Item,
129
+ {
130
+ className: `p-3 border-bottom position-relative ${a === "inbox" && !t.isRead ? "bg-light" : ""}`,
131
+ style: { transition: "background-color 0.2s" },
132
+ children: /* @__PURE__ */ i("div", { className: "d-flex justify-content-between align-items-start", children: [
133
+ /* @__PURE__ */ i("div", { className: "pe-3", children: [
134
+ /* @__PURE__ */ e(
135
+ "h6",
136
+ {
137
+ className: `mb-1 ${a === "inbox" && !t.isRead ? "font-weight-bold text-dark" : "text-secondary"}`,
138
+ style: { fontSize: "0.95rem" },
139
+ children: n
140
+ }
141
+ ),
142
+ /* @__PURE__ */ e("p", { className: "text-muted small mb-2", children: s }),
143
+ /* @__PURE__ */ e("span", { className: "text-muted", style: { fontSize: "0.75rem" }, children: A(t.createdAt) })
144
+ ] }),
145
+ a === "inbox" && !t.isRead && /* @__PURE__ */ e(
146
+ r,
147
+ {
148
+ variant: "link",
149
+ className: "p-0 text-primary border-0",
150
+ onClick: () => k(t.id),
151
+ title: "Mark as read",
152
+ style: { boxShadow: "none" },
153
+ children: /* @__PURE__ */ e(K, { size: 10, className: "text-primary" })
154
+ }
155
+ )
156
+ ] })
157
+ },
158
+ t.id
159
+ );
160
+ }) }) })
161
+ ] }) })
162
+ ] });
163
+ };
164
+ export {
165
+ P as NotificationDrawer
166
+ };
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare const NotificationSettings: React.FC;
@@ -0,0 +1,68 @@
1
+ import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
+ import { Spinner as u, Alert as b, Card as c, Form as s } from "react-bootstrap";
3
+ import { useNotifications as y } from "../../Context/NotificationContext.js";
4
+ const N = () => {
5
+ const { preferences: n, updatePreferences: i, isLoading: o } = y(), a = (e) => {
6
+ n && i({ [e]: !n[e] });
7
+ }, d = (e) => {
8
+ if (!n) return;
9
+ const h = n.mutedEventTypes.includes(e) ? n.mutedEventTypes.filter((p) => p !== e) : [...n.mutedEventTypes, e];
10
+ i({ mutedEventTypes: h });
11
+ };
12
+ if (o && !n)
13
+ return /* @__PURE__ */ t("div", { className: "text-center py-4", children: /* @__PURE__ */ t(u, { animation: "border", size: "sm" }) });
14
+ if (!n)
15
+ return /* @__PURE__ */ t(b, { variant: "warning", children: "Unable to load notification preferences." });
16
+ const m = [
17
+ { key: "review_assigned", label: "Review Assignments (Relectures)" },
18
+ { key: "project_created", label: "Project Creations" },
19
+ { key: "system_alert", label: "System Alerts" }
20
+ ];
21
+ return /* @__PURE__ */ t(c, { className: "border-0 shadow-sm", children: /* @__PURE__ */ l(c.Body, { className: "p-3", children: [
22
+ /* @__PURE__ */ t("h6", { className: "mb-3 text-secondary font-weight-bold", children: "Notification Channels" }),
23
+ /* @__PURE__ */ l(s.Group, { className: "mb-3", children: [
24
+ /* @__PURE__ */ t(
25
+ s.Check,
26
+ {
27
+ type: "switch",
28
+ id: "channel-inapp",
29
+ label: "In-App Notifications (Real-Time)",
30
+ checked: n.inAppEnabled,
31
+ onChange: () => a("inAppEnabled"),
32
+ className: "mb-2"
33
+ }
34
+ ),
35
+ /* @__PURE__ */ t(
36
+ s.Check,
37
+ {
38
+ type: "switch",
39
+ id: "channel-email",
40
+ label: "Email Alerts",
41
+ checked: n.emailEnabled,
42
+ onChange: () => a("emailEnabled")
43
+ }
44
+ )
45
+ ] }),
46
+ /* @__PURE__ */ t("hr", {}),
47
+ /* @__PURE__ */ t("h6", { className: "mb-3 text-secondary font-weight-bold", children: "Mute Event Types" }),
48
+ /* @__PURE__ */ t("p", { className: "text-muted small mb-3", children: "Check events you do NOT want to receive notifications for." }),
49
+ /* @__PURE__ */ t(s.Group, { children: m.map((e) => {
50
+ const r = n.mutedEventTypes.includes(e.key);
51
+ return /* @__PURE__ */ t(
52
+ s.Check,
53
+ {
54
+ type: "checkbox",
55
+ id: `mute-${e.key}`,
56
+ label: e.label,
57
+ checked: r,
58
+ onChange: () => d(e.key),
59
+ className: "mb-2 text-dark"
60
+ },
61
+ e.key
62
+ );
63
+ }) })
64
+ ] }) });
65
+ };
66
+ export {
67
+ N as NotificationSettings
68
+ };
@@ -0,0 +1,3 @@
1
+ export * from './NotificationBell';
2
+ export * from './NotificationDrawer';
3
+ export * from './NotificationSettings';
@@ -0,0 +1,8 @@
1
+ import { NotificationBell as i } from "./NotificationBell.js";
2
+ import { NotificationDrawer as e } from "./NotificationDrawer.js";
3
+ import { NotificationSettings as a } from "./NotificationSettings.js";
4
+ export {
5
+ i as NotificationBell,
6
+ e as NotificationDrawer,
7
+ a as NotificationSettings
8
+ };
@@ -4,29 +4,30 @@ import "../../Context/AnalyticsContext.js";
4
4
  import "../../Context/MenuContext.js";
5
5
  import { useRouter as h } from "../../Context/RouterContext.js";
6
6
  import { useSession as d } from "../../Context/SessionContext.js";
7
- const F = ({
8
- notAuthorizedPath: e,
7
+ import "../../Context/NotificationContext.js";
8
+ const L = ({
9
+ notAuthorizedPath: r,
9
10
  allowedPermissions: i = [],
10
- children: c
11
+ children: p
11
12
  }) => {
12
- var m;
13
- const { isAuthenticated: n, isLoading: r, user: t } = d(), { navigate: s } = h();
13
+ var s;
14
+ const { isAuthenticated: e, isLoading: n, user: t } = d(), { navigate: m } = h();
14
15
  return g(() => {
15
- if (!r && n) {
16
+ if (!n && e) {
16
17
  const o = (t == null ? void 0 : t.permissions) || [];
17
- !i.length || o.some((p) => i.includes(p)) || s(e);
18
+ !i.length || o.some((c) => i.includes(c)) || m(r);
18
19
  }
19
20
  }, [
20
- r,
21
21
  n,
22
22
  e,
23
- s,
23
+ r,
24
+ m,
24
25
  t,
25
26
  i
26
- ]), i.length > 0 && !((m = t == null ? void 0 : t.permissions) != null && m.some(
27
+ ]), i.length > 0 && !((s = t == null ? void 0 : t.permissions) != null && s.some(
27
28
  (o) => i.includes(o)
28
- )) ? null : /* @__PURE__ */ f(u, { children: c });
29
+ )) ? null : /* @__PURE__ */ f(u, { children: p });
29
30
  };
30
31
  export {
31
- F as ProtectedRoute
32
+ L as ProtectedRoute
32
33
  };
@@ -5,3 +5,4 @@ export * from './Header';
5
5
  export * from './NotAuthorized';
6
6
  export * from './Paginator';
7
7
  export * from './ProtectedRoute';
8
+ export * from './Notifications';
@@ -1,16 +1,22 @@
1
1
  import { AuthWrapper as t } from "./AuthWrapper/index.js";
2
- import { confirmationModalDefaultProps as p } from "./ConfirmationModal/index.js";
3
- import { Footer as m } from "./Footer/index.js";
4
- import { Header as x } from "./Header/index.js";
5
- import { NotAuthorized as i } from "./NotAuthorized/index.js";
6
- import { Paginator as n } from "./Paginator/index.js";
7
- import { ProtectedRoute as c } from "./ProtectedRoute/index.js";
2
+ import { confirmationModalDefaultProps as f } from "./ConfirmationModal/index.js";
3
+ import { Footer as p } from "./Footer/index.js";
4
+ import { Header as m } from "./Header/index.js";
5
+ import { NotAuthorized as n } from "./NotAuthorized/index.js";
6
+ import { Paginator as d } from "./Paginator/index.js";
7
+ import { ProtectedRoute as u } from "./ProtectedRoute/index.js";
8
+ import { NotificationBell as P } from "./Notifications/NotificationBell.js";
9
+ import { NotificationDrawer as h } from "./Notifications/NotificationDrawer.js";
10
+ import { NotificationSettings as A } from "./Notifications/NotificationSettings.js";
8
11
  export {
9
12
  t as AuthWrapper,
10
- m as Footer,
11
- x as Header,
12
- i as NotAuthorized,
13
- n as Paginator,
14
- c as ProtectedRoute,
15
- p as confirmationModalDefaultProps
13
+ p as Footer,
14
+ m as Header,
15
+ n as NotAuthorized,
16
+ P as NotificationBell,
17
+ h as NotificationDrawer,
18
+ A as NotificationSettings,
19
+ d as Paginator,
20
+ u as ProtectedRoute,
21
+ f as confirmationModalDefaultProps
16
22
  };
@@ -0,0 +1,33 @@
1
+ import { FC, ReactNode } from 'react';
2
+ export interface NotificationItem {
3
+ id: string;
4
+ templateKey: string;
5
+ variables: Record<string, any>;
6
+ metadata: Record<string, any>;
7
+ isRead: boolean;
8
+ createdAt: string;
9
+ }
10
+ export interface UserNotificationPreferences {
11
+ emailEnabled: boolean;
12
+ inAppEnabled: boolean;
13
+ mutedEventTypes: string[];
14
+ }
15
+ interface NotificationContextType {
16
+ notifications: NotificationItem[];
17
+ unreadCount: number;
18
+ preferences: UserNotificationPreferences | null;
19
+ isLoading: boolean;
20
+ fetchNotifications: (folder?: "inbox" | "trash", page?: number, limit?: number) => Promise<void>;
21
+ markAsRead: (id: string) => Promise<void>;
22
+ markAllAsRead: () => Promise<void>;
23
+ emptyTrash: () => Promise<void>;
24
+ fetchPreferences: () => Promise<void>;
25
+ updatePreferences: (updates: Partial<UserNotificationPreferences>) => Promise<void>;
26
+ }
27
+ export interface NotificationProviderProps {
28
+ apiUrl: string;
29
+ children: ReactNode;
30
+ }
31
+ export declare const NotificationProvider: FC<NotificationProviderProps>;
32
+ export declare const useNotifications: () => NotificationContextType;
33
+ export {};