@variamosple/variamos-components 0.2.5 → 0.4.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.
Files changed (55) hide show
  1. package/README.md +29 -42
  2. package/dist/Common/Events.d.ts +3 -2
  3. package/dist/Common/Events.js +18 -11
  4. package/dist/Common/fieldOf.d.ts +2 -0
  5. package/dist/Common/fieldOf.js +7 -0
  6. package/dist/Common/isAllowedFor.d.ts +7 -0
  7. package/dist/Common/isAllowedFor.js +9 -0
  8. package/dist/Components/AuthWrapper/index.js +6 -6
  9. package/dist/Components/ConfirmationModal/index.js +3 -3
  10. package/dist/Components/Footer/index.js +1 -1
  11. package/dist/Components/Header/BugFormModal.d.ts +2 -0
  12. package/dist/Components/Header/BugFormModal.js +39 -37
  13. package/dist/Components/Header/HeaderOptions.js +79 -86
  14. package/dist/Components/Header/MenuItem.js +24 -34
  15. package/dist/Components/Header/SubHeader.js +17 -29
  16. package/dist/Components/Header/index.js +25 -13
  17. package/dist/Components/Header/submitBugReport.d.ts +14 -0
  18. package/dist/Components/Header/submitBugReport.js +22 -0
  19. package/dist/Components/NotAuthorized/index.js +1 -1
  20. package/dist/Components/Notifications/NotificationBell.js +10 -10
  21. package/dist/Components/Notifications/NotificationCard.d.ts +9 -0
  22. package/dist/Components/Notifications/NotificationCard.js +81 -0
  23. package/dist/Components/Notifications/NotificationDrawer.js +139 -191
  24. package/dist/Components/Notifications/NotificationSettings.js +32 -28
  25. package/dist/Components/Notifications/mutedEventTypes.js +9 -9
  26. package/dist/Components/Notifications/notificationText.d.ts +7 -0
  27. package/dist/Components/Notifications/notificationText.js +38 -0
  28. package/dist/Components/Paginator/index.js +22 -22
  29. package/dist/Components/ProtectedRoute/index.js +18 -18
  30. package/dist/Components/index.d.ts +1 -1
  31. package/dist/Components/index.js +10 -10
  32. package/dist/Context/AnalyticsContext.d.ts +2 -2
  33. package/dist/Context/AnalyticsContext.js +15 -15
  34. package/dist/Context/MenuContext.js +39 -47
  35. package/dist/Context/NotificationContext.d.ts +2 -14
  36. package/dist/Context/NotificationContext.js +393 -458
  37. package/dist/Context/SessionContext.js +72 -78
  38. package/dist/Context/index.d.ts +1 -1
  39. package/dist/Context/index.js +11 -11
  40. package/dist/Context/notificationAccessToken.d.ts +1 -3
  41. package/dist/Context/notificationAccessToken.js +15 -19
  42. package/dist/Context/notificationApi.d.ts +43 -0
  43. package/dist/Context/notificationApi.js +83 -0
  44. package/dist/Context/storedSessionToken.d.ts +8 -0
  45. package/dist/Context/storedSessionToken.js +11 -0
  46. package/dist/Context/useNotificationState.d.ts +35 -0
  47. package/dist/Context/useNotificationState.js +92 -0
  48. package/dist/Hooks/useDebouncedValue.js +20 -16
  49. package/dist/Hooks/usePaginatedQuery.js +14 -20
  50. package/dist/Hooks/useQuery.js +6 -6
  51. package/dist/Model/ResponseModel.d.ts +2 -2
  52. package/dist/Model/ResponseModel.js +9 -4
  53. package/dist/Model/SessionInfoResponse.d.ts +0 -1
  54. package/dist/main.js +21 -21
  55. package/package.json +19 -17
@@ -1,201 +1,149 @@
1
- import { jsxs as i, jsx as e, Fragment as N } from "react/jsx-runtime";
2
- import { useState as y, useEffect as L } from "react";
3
- import { Offcanvas as d, Button as r, Nav as c, Spinner as E } from "react-bootstrap";
4
- import { ArrowLeft as M, Gear as H, Inbox as I, Trash as b, CheckAll as K, CircleFill as R } from "react-bootstrap-icons";
5
- import { useNotifications as _ } from "../../Context/NotificationContext.js";
6
- import { NotificationSettings as B } from "./NotificationSettings.js";
7
- const F = {
8
- review_assigned: {
9
- title: "Language Review Assigned",
10
- body: "You have been assigned to review the translation for {{languageName}}."
1
+ import { jsxs as t, jsx as e, Fragment as N } from "react/jsx-runtime";
2
+ import { useState as p, useEffect as y } from "react";
3
+ import { Offcanvas as c, Button as d, Nav as s, Spinner as S } from "react-bootstrap";
4
+ import { ArrowLeft as w, Gear as A, Inbox as z, Trash as b, CheckAll as C } from "react-bootstrap-icons";
5
+ import { useNotifications as I } from "../../Context/NotificationContext.js";
6
+ import { NotificationCard as L } from "./NotificationCard.js";
7
+ import { NotificationSettings as T } from "./NotificationSettings.js";
8
+ const j = (i) => i === "inbox" || i === "trash", B = ({
9
+ folder: i,
10
+ isLoading: m,
11
+ notifications: a,
12
+ onMarkAsRead: f,
13
+ onDelete: l
14
+ }) => m ? /* @__PURE__ */ e("div", { className: "text-center py-5", children: /* @__PURE__ */ e(S, { animation: "border", variant: "primary" }) }) : a.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center py-5 text-muted", children: /* @__PURE__ */ e("p", { className: "mb-0", children: i === "inbox" ? "Your inbox is empty!" : "No deleted notifications." }) }) : /* @__PURE__ */ e("div", { className: "px-3", children: a.map((o) => /* @__PURE__ */ e(
15
+ L,
16
+ {
17
+ item: o,
18
+ inInbox: i === "inbox",
19
+ onMarkAsRead: f,
20
+ onDelete: l
11
21
  },
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
- admin_alert: {
21
- title: "{{title}}",
22
- body: "{{body}}"
23
- }
24
- }, G = ({
25
- show: m,
26
- onClose: u
22
+ o.id
23
+ )) }), G = ({
24
+ show: i,
25
+ onClose: m
27
26
  }) => {
28
27
  const {
29
- notifications: f,
30
- isLoading: v,
31
- fetchNotifications: k,
32
- markAsRead: w,
33
- markAllAsRead: S,
34
- emptyTrash: T,
35
- deleteNotification: z
36
- } = _(), [n, C] = y("inbox"), [p, x] = y(!1);
37
- L(() => {
38
- m && k(n);
39
- }, [m, n]);
40
- const g = (t, a) => {
41
- let s = t;
42
- for (const l of Object.keys(a))
43
- s = s.replace(new RegExp(`{{${l}}}`, "g"), String(a[l]));
44
- return s;
45
- }, j = (t) => {
46
- const a = F[t.templateKey] || {
47
- title: "New Alert",
48
- body: `Notification template: ${t.templateKey}`
49
- };
50
- return {
51
- title: g(a.title, t.variables),
52
- body: g(a.body, t.variables)
53
- };
54
- }, A = (t) => new Date(t).toLocaleDateString(void 0, {
55
- hour: "2-digit",
56
- minute: "2-digit"
57
- });
58
- return /* @__PURE__ */ i(d, { show: m, onHide: u, placement: "end", className: "text-dark", children: [
59
- /* @__PURE__ */ e(d.Header, { closeButton: !0, className: "border-bottom", children: /* @__PURE__ */ e(d.Title, { className: "d-flex align-items-center w-100", children: p ? /* @__PURE__ */ i(N, { children: [
60
- /* @__PURE__ */ e(
61
- r,
62
- {
63
- variant: "link",
64
- className: "p-0 me-2 text-dark",
65
- onClick: () => x(!1),
66
- "aria-label": "Back",
67
- children: /* @__PURE__ */ e(M, { size: 20 })
68
- }
69
- ),
70
- /* @__PURE__ */ e("span", { children: "Settings" })
71
- ] }) : /* @__PURE__ */ i("div", { className: "d-flex justify-content-between align-items-center w-100 me-3", children: [
72
- /* @__PURE__ */ e("span", { children: "Notifications" }),
73
- /* @__PURE__ */ e(
74
- r,
75
- {
76
- variant: "link",
77
- className: "p-0 text-secondary",
78
- onClick: () => x(!0),
79
- "aria-label": "Notification Settings",
80
- style: { boxShadow: "none" },
81
- children: /* @__PURE__ */ e(H, { size: 20 })
82
- }
83
- )
84
- ] }) }) }),
85
- /* @__PURE__ */ e(d.Body, { className: "p-0 d-flex flex-column h-100", children: p ? /* @__PURE__ */ e("div", { className: "p-3", children: /* @__PURE__ */ e(B, {}) }) : /* @__PURE__ */ i(N, { children: [
86
- /* @__PURE__ */ i(
87
- c,
88
- {
89
- variant: "tabs",
90
- activeKey: n,
91
- onSelect: (t) => C(t),
92
- className: "px-3 pt-2 bg-light border-bottom",
93
- children: [
94
- /* @__PURE__ */ e(c.Item, { children: /* @__PURE__ */ i(c.Link, { eventKey: "inbox", className: "d-flex align-items-center", children: [
95
- /* @__PURE__ */ e(I, { className: "me-2" }),
96
- "Inbox"
97
- ] }) }),
98
- /* @__PURE__ */ e(c.Item, { children: /* @__PURE__ */ i(c.Link, { eventKey: "trash", className: "d-flex align-items-center", children: [
99
- /* @__PURE__ */ e(b, { className: "me-2" }),
100
- "Trash"
101
- ] }) })
102
- ]
103
- }
104
- ),
105
- f.length > 0 && /* @__PURE__ */ e("div", { className: "d-flex justify-content-end align-items-center p-2 bg-light border-bottom px-3", children: n === "inbox" ? /* @__PURE__ */ i(
106
- r,
107
- {
108
- variant: "link",
109
- size: "sm",
110
- className: "p-0 text-primary text-decoration-none d-flex align-items-center",
111
- onClick: S,
112
- children: [
113
- /* @__PURE__ */ e(K, { className: "me-1", size: 18 }),
114
- "Mark all as read"
115
- ]
116
- }
117
- ) : /* @__PURE__ */ i(
118
- r,
119
- {
120
- variant: "link",
121
- size: "sm",
122
- className: "p-0 text-danger text-decoration-none d-flex align-items-center",
123
- onClick: T,
124
- children: [
125
- /* @__PURE__ */ e(b, { className: "me-1", size: 16 }),
126
- "Empty Trash"
127
- ]
128
- }
129
- ) }),
130
- /* @__PURE__ */ e("div", { className: "flex-grow-1 overflow-auto bg-light pt-3", children: v ? /* @__PURE__ */ e("div", { className: "text-center py-5", children: /* @__PURE__ */ e(E, { animation: "border", variant: "primary" }) }) : f.length === 0 ? /* @__PURE__ */ e("div", { className: "text-center py-5 text-muted", children: /* @__PURE__ */ e("p", { className: "mb-0", children: n === "inbox" ? "Your inbox is empty!" : "No deleted notifications." }) }) : /* @__PURE__ */ e("div", { className: "px-3", children: f.map((t) => {
131
- const { title: a, body: s } = j(t), l = n === "inbox" && !t.isRead;
132
- return /* @__PURE__ */ e(
133
- "div",
134
- {
135
- className: `p-3 mb-2 rounded border shadow-sm ${l ? "bg-white border-primary-subtle" : "bg-white border-light"}`,
136
- style: {
137
- transition: "all 0.2s ease-in-out",
138
- borderLeft: l ? "4px solid #0d6efd" : "1px solid #dee2e6"
139
- },
140
- children: /* @__PURE__ */ i("div", { className: "d-flex justify-content-between align-items-start", children: [
141
- /* @__PURE__ */ i("div", { className: "pe-2 flex-grow-1", children: [
142
- /* @__PURE__ */ e(
143
- "h6",
144
- {
145
- className: `mb-1 ${l ? "fw-bold text-dark" : "text-secondary fw-semibold"}`,
146
- style: { fontSize: "0.9rem", lineHeight: "1.25" },
147
- children: a
148
- }
149
- ),
150
- /* @__PURE__ */ e(
151
- "p",
152
- {
153
- className: "mb-2 text-muted",
154
- style: { fontSize: "0.8rem", color: "#6c757d", lineHeight: "1.3" },
155
- children: s
156
- }
157
- ),
158
- /* @__PURE__ */ e("span", { className: "text-muted d-block", style: { fontSize: "0.7rem" }, children: A(t.createdAt) })
159
- ] }),
160
- /* @__PURE__ */ i("div", { className: "d-flex align-items-center gap-2", children: [
161
- l && /* @__PURE__ */ e(
162
- r,
28
+ notifications: a,
29
+ isLoading: f,
30
+ fetchNotifications: l,
31
+ markAsRead: o,
32
+ markAllAsRead: v,
33
+ emptyTrash: g,
34
+ deleteNotification: u
35
+ } = I(), [r, k] = p("inbox"), [h, x] = p(!1);
36
+ return y(() => {
37
+ i && l(r);
38
+ }, [i, r, l]), /* @__PURE__ */ t(
39
+ c,
40
+ {
41
+ show: i,
42
+ onHide: m,
43
+ placement: "end",
44
+ className: "text-dark",
45
+ children: [
46
+ /* @__PURE__ */ e(c.Header, { closeButton: !0, className: "border-bottom", children: /* @__PURE__ */ e(c.Title, { className: "d-flex align-items-center w-100", children: h ? /* @__PURE__ */ t(N, { children: [
47
+ /* @__PURE__ */ e(
48
+ d,
49
+ {
50
+ variant: "link",
51
+ className: "p-0 me-2 text-dark",
52
+ onClick: () => x(!1),
53
+ "aria-label": "Back",
54
+ children: /* @__PURE__ */ e(w, { size: 20 })
55
+ }
56
+ ),
57
+ /* @__PURE__ */ e("span", { children: "Settings" })
58
+ ] }) : /* @__PURE__ */ t("div", { className: "d-flex justify-content-between align-items-center w-100 me-3", children: [
59
+ /* @__PURE__ */ e("span", { children: "Notifications" }),
60
+ /* @__PURE__ */ e(
61
+ d,
62
+ {
63
+ variant: "link",
64
+ className: "p-0 text-secondary",
65
+ onClick: () => x(!0),
66
+ "aria-label": "Notification Settings",
67
+ style: { boxShadow: "none" },
68
+ children: /* @__PURE__ */ e(A, { size: 20 })
69
+ }
70
+ )
71
+ ] }) }) }),
72
+ /* @__PURE__ */ e(c.Body, { className: "p-0 d-flex flex-column h-100", children: h ? /* @__PURE__ */ e("div", { className: "p-3", children: /* @__PURE__ */ e(T, {}) }) : /* @__PURE__ */ t(N, { children: [
73
+ /* @__PURE__ */ t(
74
+ s,
75
+ {
76
+ variant: "tabs",
77
+ activeKey: r,
78
+ onSelect: (n) => {
79
+ j(n) && k(n);
80
+ },
81
+ className: "px-3 pt-2 bg-light border-bottom",
82
+ children: [
83
+ /* @__PURE__ */ e(s.Item, { children: /* @__PURE__ */ t(
84
+ s.Link,
163
85
  {
164
- variant: "link",
165
- className: "p-1 text-primary border-0 d-flex align-items-center",
166
- onClick: () => w(t.id),
167
- title: "Mark as read",
168
- style: { boxShadow: "none" },
169
- children: /* @__PURE__ */ e(R, { size: 8, className: "text-primary" })
86
+ eventKey: "inbox",
87
+ className: "d-flex align-items-center",
88
+ children: [
89
+ /* @__PURE__ */ e(z, { className: "me-2" }),
90
+ "Inbox"
91
+ ]
170
92
  }
171
- ),
172
- n === "inbox" && /* @__PURE__ */ e(
173
- r,
93
+ ) }),
94
+ /* @__PURE__ */ e(s.Item, { children: /* @__PURE__ */ t(
95
+ s.Link,
174
96
  {
175
- variant: "link",
176
- className: "p-1 text-secondary border-0 d-flex align-items-center",
177
- onClick: () => z(t.id),
178
- title: "Move to trash",
179
- style: { boxShadow: "none" },
180
- onMouseEnter: (h) => {
181
- const o = h.currentTarget.querySelector("svg");
182
- o && (o.style.fill = "#dc3545");
183
- },
184
- onMouseLeave: (h) => {
185
- const o = h.currentTarget.querySelector("svg");
186
- o && (o.style.fill = "currentColor");
187
- },
188
- children: /* @__PURE__ */ e(b, { size: 14, style: { transition: "fill 0.2s" } })
97
+ eventKey: "trash",
98
+ className: "d-flex align-items-center",
99
+ children: [
100
+ /* @__PURE__ */ e(b, { className: "me-2" }),
101
+ "Trash"
102
+ ]
189
103
  }
190
- )
191
- ] })
192
- ] })
193
- },
194
- t.id
195
- );
196
- }) }) })
197
- ] }) })
198
- ] });
104
+ ) })
105
+ ]
106
+ }
107
+ ),
108
+ a.length > 0 ? /* @__PURE__ */ e("div", { className: "d-flex justify-content-end align-items-center p-2 bg-light border-bottom px-3", children: r === "inbox" ? /* @__PURE__ */ t(
109
+ d,
110
+ {
111
+ variant: "link",
112
+ size: "sm",
113
+ className: "p-0 text-primary text-decoration-none d-flex align-items-center",
114
+ onClick: () => void v(),
115
+ children: [
116
+ /* @__PURE__ */ e(C, { className: "me-1", size: 18 }),
117
+ "Mark all as read"
118
+ ]
119
+ }
120
+ ) : /* @__PURE__ */ t(
121
+ d,
122
+ {
123
+ variant: "link",
124
+ size: "sm",
125
+ className: "p-0 text-danger text-decoration-none d-flex align-items-center",
126
+ onClick: () => void g(),
127
+ children: [
128
+ /* @__PURE__ */ e(b, { className: "me-1", size: 16 }),
129
+ "Empty Trash"
130
+ ]
131
+ }
132
+ ) }) : null,
133
+ /* @__PURE__ */ e("div", { className: "flex-grow-1 overflow-auto bg-light pt-3", children: /* @__PURE__ */ e(
134
+ B,
135
+ {
136
+ folder: r,
137
+ isLoading: f,
138
+ notifications: a,
139
+ onMarkAsRead: (n) => void o(n),
140
+ onDelete: (n) => void u(n)
141
+ }
142
+ ) })
143
+ ] }) })
144
+ ]
145
+ }
146
+ );
199
147
  };
200
148
  export {
201
149
  G as NotificationDrawer
@@ -1,36 +1,37 @@
1
- import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
- import { Spinner as m, Alert as h, Card as s, Form as a } from "react-bootstrap";
3
- import { useNotifications as p } from "../../Context/NotificationContext.js";
4
- import { MUTABLE_EVENT_TYPES as u, isEventMuted as b, toggleMuted as f } from "./mutedEventTypes.js";
5
- const k = () => {
6
- const { preferences: t, updatePreferences: i, isLoading: c } = p(), r = (n) => {
7
- t && i({ [n]: !t[n] });
8
- }, l = (n) => {
9
- t && i({
10
- mutedEventTypes: f(t.mutedEventTypes, n)
1
+ import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
+ import { useId as h } from "react";
3
+ import { Spinner as p, Alert as u, Card as c, Form as i } from "react-bootstrap";
4
+ import { useNotifications as b } from "../../Context/NotificationContext.js";
5
+ import { MUTABLE_EVENT_TYPES as f, isEventMuted as y, toggleMuted as N } from "./mutedEventTypes.js";
6
+ const x = () => {
7
+ const { preferences: n, updatePreferences: o, isLoading: l } = b(), a = h(), r = (t) => {
8
+ n && o({ [t]: !n[t] });
9
+ }, d = (t) => {
10
+ n && o({
11
+ mutedEventTypes: N(n.mutedEventTypes, t)
11
12
  });
12
13
  };
13
- return c && !t ? /* @__PURE__ */ e("div", { className: "text-center py-4", children: /* @__PURE__ */ e(m, { animation: "border", size: "sm" }) }) : t ? /* @__PURE__ */ e(s, { className: "border-0 shadow-sm", children: /* @__PURE__ */ o(s.Body, { className: "p-3", children: [
14
+ return l && !n ? /* @__PURE__ */ e("div", { className: "text-center py-4", children: /* @__PURE__ */ e(p, { animation: "border", size: "sm" }) }) : n ? /* @__PURE__ */ e(c, { className: "border-0 shadow-sm", children: /* @__PURE__ */ s(c.Body, { className: "p-3", children: [
14
15
  /* @__PURE__ */ e("h6", { className: "mb-3 text-secondary font-weight-bold", children: "Notification Channels" }),
15
- /* @__PURE__ */ o(a.Group, { className: "mb-3", children: [
16
+ /* @__PURE__ */ s(i.Group, { className: "mb-3", children: [
16
17
  /* @__PURE__ */ e(
17
- a.Check,
18
+ i.Check,
18
19
  {
19
20
  type: "switch",
20
- id: "channel-inapp",
21
+ id: `${a}-channel-inapp`,
21
22
  label: "In-App Notifications (Real-Time)",
22
- checked: t.inAppEnabled,
23
+ checked: n.inAppEnabled,
23
24
  onChange: () => r("inAppEnabled"),
24
25
  className: "mb-2"
25
26
  }
26
27
  ),
27
28
  /* @__PURE__ */ e(
28
- a.Check,
29
+ i.Check,
29
30
  {
30
31
  type: "switch",
31
- id: "channel-email",
32
+ id: `${a}-channel-email`,
32
33
  label: "Email Alerts",
33
- checked: t.emailEnabled,
34
+ checked: n.emailEnabled,
34
35
  onChange: () => r("emailEnabled")
35
36
  }
36
37
  )
@@ -38,23 +39,26 @@ const k = () => {
38
39
  /* @__PURE__ */ e("hr", {}),
39
40
  /* @__PURE__ */ e("h6", { className: "mb-3 text-secondary font-weight-bold", children: "Mute Event Types" }),
40
41
  /* @__PURE__ */ e("p", { className: "text-muted small mb-3", children: "Check events you do NOT want to receive notifications for." }),
41
- /* @__PURE__ */ e(a.Group, { children: u.map((n) => {
42
- const d = b(t.mutedEventTypes, n.key);
42
+ /* @__PURE__ */ e(i.Group, { children: f.map((t) => {
43
+ const m = y(
44
+ n.mutedEventTypes,
45
+ t.key
46
+ );
43
47
  return /* @__PURE__ */ e(
44
- a.Check,
48
+ i.Check,
45
49
  {
46
50
  type: "checkbox",
47
- id: `mute-${n.key}`,
48
- label: n.label,
49
- checked: d,
50
- onChange: () => l(n.key),
51
+ id: `${a}-mute-${t.key}`,
52
+ label: t.label,
53
+ checked: m,
54
+ onChange: () => d(t.key),
51
55
  className: "mb-2 text-dark"
52
56
  },
53
- n.key
57
+ t.key
54
58
  );
55
59
  }) })
56
- ] }) }) : /* @__PURE__ */ e(h, { variant: "warning", children: "Unable to load notification preferences." });
60
+ ] }) }) : /* @__PURE__ */ e(u, { variant: "warning", children: "Unable to load notification preferences." });
57
61
  };
58
62
  export {
59
- k as NotificationSettings
63
+ x as NotificationSettings
60
64
  };
@@ -1,5 +1,5 @@
1
- const c = [
2
- { key: "review_assigned", label: "Review Assignments (Relectures)" },
1
+ const o = [
2
+ { key: "review_assigned", label: "Review Assignments" },
3
3
  { key: "project_created", label: "Project Creations" },
4
4
  {
5
5
  key: "admin_alert",
@@ -7,16 +7,16 @@ const c = [
7
7
  }
8
8
  ], a = {
9
9
  admin_alert: ["system_alert"]
10
- }, n = (e) => [e, ...a[e] ?? []];
10
+ }, r = (e) => [e, ...a[e] ?? []];
11
11
  function i(e, t) {
12
- return n(t).some((s) => e.includes(s));
12
+ return r(t).some((s) => e.includes(s));
13
13
  }
14
- function o(e, t) {
15
- const s = n(t), r = e.filter((l) => !s.includes(l));
16
- return i(e, t) ? r : [...r, t];
14
+ function c(e, t) {
15
+ const s = r(t), n = e.filter((l) => !s.includes(l));
16
+ return i(e, t) ? n : [...n, t];
17
17
  }
18
18
  export {
19
- c as MUTABLE_EVENT_TYPES,
19
+ o as MUTABLE_EVENT_TYPES,
20
20
  i as isEventMuted,
21
- o as toggleMuted
21
+ c as toggleMuted
22
22
  };
@@ -0,0 +1,7 @@
1
+ import { NotificationItem } from '../../Context/notificationApi';
2
+ export declare function renderTemplateText(template: string, variables: Record<string, unknown>): string;
3
+ /** The title and body shown for a notification. */
4
+ export declare function notificationTextOf(item: NotificationItem): {
5
+ title: string;
6
+ body: string;
7
+ };
@@ -0,0 +1,38 @@
1
+ const l = {
2
+ review_assigned: {
3
+ title: "Language Review Assigned",
4
+ body: "You have been assigned to review the translation for {{languageName}}."
5
+ },
6
+ project_created: {
7
+ title: "Project Created",
8
+ body: "The project '{{projectName}}' has been created successfully."
9
+ },
10
+ test_template: {
11
+ title: "Notification Test",
12
+ body: "Hello {{name}}, this is a real-time notification test."
13
+ },
14
+ admin_alert: {
15
+ title: "{{title}}",
16
+ body: "{{body}}"
17
+ }
18
+ };
19
+ function a(e, t) {
20
+ let i = e;
21
+ for (const [o, n] of Object.entries(t))
22
+ i = i.split(`{{${o}}}`).join(String(n));
23
+ return i;
24
+ }
25
+ function r(e) {
26
+ const t = l[e.templateKey] ?? {
27
+ title: "New Alert",
28
+ body: `Notification template: ${e.templateKey}`
29
+ };
30
+ return {
31
+ title: a(t.title, e.variables),
32
+ body: a(t.body, e.variables)
33
+ };
34
+ }
35
+ export {
36
+ r as notificationTextOf,
37
+ a as renderTemplateText
38
+ };
@@ -1,15 +1,15 @@
1
1
  import { jsxs as k, jsx as s } from "react/jsx-runtime";
2
2
  import { useMemo as p } from "react";
3
- import { Pagination as f } from "react-bootstrap";
3
+ import { Pagination as l } from "react-bootstrap";
4
4
  const n = (m, i) => {
5
- const l = [];
5
+ const f = [];
6
6
  for (let c = m; c <= i; c++)
7
- l.push(c);
8
- return l;
7
+ f.push(c);
8
+ return f;
9
9
  }, M = 5, v = ({
10
10
  currentPage: m,
11
11
  totalPages: i,
12
- onPageChange: l
12
+ onPageChange: f
13
13
  }) => {
14
14
  const c = p(() => {
15
15
  if (m === 1 && i === 1)
@@ -21,59 +21,59 @@ const n = (m, i) => {
21
21
  let d, h;
22
22
  return m <= Math.ceil(M / 2) ? (d = 2, h = Math.min(M + 1, i - 1)) : m + Math.floor(M / 2) >= i ? (d = Math.max(i - M, 2), h = i - 1) : (d = m - Math.floor(M / 2), h = m + Math.floor(M / 2)), h = Math.min(h, i - 1), d = Math.max(d, 2), n(d, h);
23
23
  }, [m, i]);
24
- return /* @__PURE__ */ k(f, { className: "d-flex justify-content-end", children: [
24
+ return /* @__PURE__ */ k(l, { className: "d-flex justify-content-end", children: [
25
25
  /* @__PURE__ */ s(
26
- f.First,
26
+ l.First,
27
27
  {
28
- onClick: () => l(1),
28
+ onClick: () => f(1),
29
29
  disabled: m === 1
30
30
  }
31
31
  ),
32
32
  /* @__PURE__ */ s(
33
- f.Prev,
33
+ l.Prev,
34
34
  {
35
- onClick: () => l(m - 1),
35
+ onClick: () => f(m - 1),
36
36
  disabled: m === 1
37
37
  }
38
38
  ),
39
39
  /* @__PURE__ */ s(
40
- f.Item,
40
+ l.Item,
41
41
  {
42
42
  active: m === 1,
43
- onClick: () => l(1),
43
+ onClick: () => f(1),
44
44
  children: "1"
45
45
  }
46
46
  ),
47
- i > 2 && !c.includes(2) && /* @__PURE__ */ s(f.Ellipsis, {}),
47
+ i > 2 && !c.includes(2) && /* @__PURE__ */ s(l.Ellipsis, {}),
48
48
  c.map((d) => /* @__PURE__ */ s(
49
- f.Item,
49
+ l.Item,
50
50
  {
51
51
  active: m === d,
52
- onClick: () => l(d),
52
+ onClick: () => f(d),
53
53
  children: d
54
54
  },
55
55
  d
56
56
  )),
57
- i > M && !c.includes(i - 1) && /* @__PURE__ */ s(f.Ellipsis, {}),
57
+ i > M && !c.includes(i - 1) && /* @__PURE__ */ s(l.Ellipsis, {}),
58
58
  i > 1 && /* @__PURE__ */ s(
59
- f.Item,
59
+ l.Item,
60
60
  {
61
61
  active: m === i,
62
- onClick: () => l(i),
62
+ onClick: () => f(i),
63
63
  children: i
64
64
  }
65
65
  ),
66
66
  /* @__PURE__ */ s(
67
- f.Next,
67
+ l.Next,
68
68
  {
69
- onClick: () => l(m + 1),
69
+ onClick: () => f(m + 1),
70
70
  disabled: m === i
71
71
  }
72
72
  ),
73
73
  /* @__PURE__ */ s(
74
- f.Last,
74
+ l.Last,
75
75
  {
76
- onClick: () => l(i),
76
+ onClick: () => f(i),
77
77
  disabled: m === i
78
78
  }
79
79
  )