@variamosple/variamos-components 0.2.4 → 0.3.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.
- package/README.md +27 -42
- package/dist/Common/Events.d.ts +3 -2
- package/dist/Common/Events.js +18 -11
- package/dist/Common/fieldOf.d.ts +2 -0
- package/dist/Common/fieldOf.js +7 -0
- package/dist/Common/isAllowedFor.d.ts +7 -0
- package/dist/Common/isAllowedFor.js +9 -0
- package/dist/Components/AuthWrapper/addressWithoutToken.d.ts +9 -0
- package/dist/Components/AuthWrapper/addressWithoutToken.js +7 -0
- package/dist/Components/AuthWrapper/index.js +18 -17
- package/dist/Components/ConfirmationModal/index.js +3 -3
- package/dist/Components/Footer/index.js +1 -1
- package/dist/Components/Header/BugFormModal.d.ts +2 -0
- package/dist/Components/Header/BugFormModal.js +39 -37
- package/dist/Components/Header/HeaderOptions.js +80 -86
- package/dist/Components/Header/MenuItem.js +24 -34
- package/dist/Components/Header/SubHeader.js +17 -29
- package/dist/Components/Header/index.js +25 -13
- package/dist/Components/Header/submitBugReport.d.ts +15 -0
- package/dist/Components/Header/submitBugReport.js +23 -0
- package/dist/Components/NotAuthorized/index.js +1 -1
- package/dist/Components/Notifications/NotificationBell.js +10 -10
- package/dist/Components/Notifications/NotificationCard.d.ts +9 -0
- package/dist/Components/Notifications/NotificationCard.js +81 -0
- package/dist/Components/Notifications/NotificationDrawer.js +139 -191
- package/dist/Components/Notifications/NotificationSettings.js +32 -28
- package/dist/Components/Notifications/mutedEventTypes.js +9 -9
- package/dist/Components/Notifications/notificationText.d.ts +7 -0
- package/dist/Components/Notifications/notificationText.js +38 -0
- package/dist/Components/Paginator/index.js +22 -22
- package/dist/Components/ProtectedRoute/index.js +18 -18
- package/dist/Components/index.d.ts +1 -1
- package/dist/Components/index.js +10 -10
- package/dist/Context/AnalyticsContext.d.ts +2 -2
- package/dist/Context/AnalyticsContext.js +15 -15
- package/dist/Context/MenuContext.js +39 -47
- package/dist/Context/NotificationContext.d.ts +2 -14
- package/dist/Context/NotificationContext.js +393 -458
- package/dist/Context/SessionContext.js +74 -81
- package/dist/Context/index.d.ts +1 -1
- package/dist/Context/index.js +11 -11
- package/dist/Context/notificationAccessToken.js +13 -13
- package/dist/Context/notificationApi.d.ts +43 -0
- package/dist/Context/notificationApi.js +83 -0
- package/dist/Context/useNotificationState.d.ts +35 -0
- package/dist/Context/useNotificationState.js +92 -0
- package/dist/Hooks/useDebouncedValue.js +20 -16
- package/dist/Hooks/usePaginatedQuery.js +14 -20
- package/dist/Hooks/useQuery.js +6 -6
- package/dist/Model/ResponseModel.d.ts +2 -2
- package/dist/Model/ResponseModel.js +9 -4
- package/dist/main.js +21 -21
- package/package.json +22 -15
|
@@ -1,201 +1,149 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Offcanvas as
|
|
4
|
-
import { ArrowLeft as
|
|
5
|
-
import { useNotifications as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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:
|
|
30
|
-
isLoading:
|
|
31
|
-
fetchNotifications:
|
|
32
|
-
markAsRead:
|
|
33
|
-
markAllAsRead:
|
|
34
|
-
emptyTrash:
|
|
35
|
-
deleteNotification:
|
|
36
|
-
} =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}, [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
165
|
-
className: "
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
-
|
|
173
|
-
|
|
93
|
+
) }),
|
|
94
|
+
/* @__PURE__ */ e(s.Item, { children: /* @__PURE__ */ t(
|
|
95
|
+
s.Link,
|
|
174
96
|
{
|
|
175
|
-
|
|
176
|
-
className: "
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
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__ */
|
|
16
|
+
/* @__PURE__ */ s(i.Group, { className: "mb-3", children: [
|
|
16
17
|
/* @__PURE__ */ e(
|
|
17
|
-
|
|
18
|
+
i.Check,
|
|
18
19
|
{
|
|
19
20
|
type: "switch",
|
|
20
|
-
id:
|
|
21
|
+
id: `${a}-channel-inapp`,
|
|
21
22
|
label: "In-App Notifications (Real-Time)",
|
|
22
|
-
checked:
|
|
23
|
+
checked: n.inAppEnabled,
|
|
23
24
|
onChange: () => r("inAppEnabled"),
|
|
24
25
|
className: "mb-2"
|
|
25
26
|
}
|
|
26
27
|
),
|
|
27
28
|
/* @__PURE__ */ e(
|
|
28
|
-
|
|
29
|
+
i.Check,
|
|
29
30
|
{
|
|
30
31
|
type: "switch",
|
|
31
|
-
id:
|
|
32
|
+
id: `${a}-channel-email`,
|
|
32
33
|
label: "Email Alerts",
|
|
33
|
-
checked:
|
|
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(
|
|
42
|
-
const
|
|
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
|
-
|
|
48
|
+
i.Check,
|
|
45
49
|
{
|
|
46
50
|
type: "checkbox",
|
|
47
|
-
id:
|
|
48
|
-
label:
|
|
49
|
-
checked:
|
|
50
|
-
onChange: () =>
|
|
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
|
-
|
|
57
|
+
t.key
|
|
54
58
|
);
|
|
55
59
|
}) })
|
|
56
|
-
] }) }) : /* @__PURE__ */ e(
|
|
60
|
+
] }) }) : /* @__PURE__ */ e(u, { variant: "warning", children: "Unable to load notification preferences." });
|
|
57
61
|
};
|
|
58
62
|
export {
|
|
59
|
-
|
|
63
|
+
x as NotificationSettings
|
|
60
64
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
{ key: "review_assigned", label: "Review Assignments
|
|
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
|
-
},
|
|
10
|
+
}, r = (e) => [e, ...a[e] ?? []];
|
|
11
11
|
function i(e, t) {
|
|
12
|
-
return
|
|
12
|
+
return r(t).some((s) => e.includes(s));
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const s =
|
|
16
|
-
return i(e, 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
|
-
|
|
19
|
+
o as MUTABLE_EVENT_TYPES,
|
|
20
20
|
i as isEventMuted,
|
|
21
|
-
|
|
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
|
|
3
|
+
import { Pagination as l } from "react-bootstrap";
|
|
4
4
|
const n = (m, i) => {
|
|
5
|
-
const
|
|
5
|
+
const f = [];
|
|
6
6
|
for (let c = m; c <= i; c++)
|
|
7
|
-
|
|
8
|
-
return
|
|
7
|
+
f.push(c);
|
|
8
|
+
return f;
|
|
9
9
|
}, M = 5, v = ({
|
|
10
10
|
currentPage: m,
|
|
11
11
|
totalPages: i,
|
|
12
|
-
onPageChange:
|
|
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(
|
|
24
|
+
return /* @__PURE__ */ k(l, { className: "d-flex justify-content-end", children: [
|
|
25
25
|
/* @__PURE__ */ s(
|
|
26
|
-
|
|
26
|
+
l.First,
|
|
27
27
|
{
|
|
28
|
-
onClick: () =>
|
|
28
|
+
onClick: () => f(1),
|
|
29
29
|
disabled: m === 1
|
|
30
30
|
}
|
|
31
31
|
),
|
|
32
32
|
/* @__PURE__ */ s(
|
|
33
|
-
|
|
33
|
+
l.Prev,
|
|
34
34
|
{
|
|
35
|
-
onClick: () =>
|
|
35
|
+
onClick: () => f(m - 1),
|
|
36
36
|
disabled: m === 1
|
|
37
37
|
}
|
|
38
38
|
),
|
|
39
39
|
/* @__PURE__ */ s(
|
|
40
|
-
|
|
40
|
+
l.Item,
|
|
41
41
|
{
|
|
42
42
|
active: m === 1,
|
|
43
|
-
onClick: () =>
|
|
43
|
+
onClick: () => f(1),
|
|
44
44
|
children: "1"
|
|
45
45
|
}
|
|
46
46
|
),
|
|
47
|
-
i > 2 && !c.includes(2) && /* @__PURE__ */ s(
|
|
47
|
+
i > 2 && !c.includes(2) && /* @__PURE__ */ s(l.Ellipsis, {}),
|
|
48
48
|
c.map((d) => /* @__PURE__ */ s(
|
|
49
|
-
|
|
49
|
+
l.Item,
|
|
50
50
|
{
|
|
51
51
|
active: m === d,
|
|
52
|
-
onClick: () =>
|
|
52
|
+
onClick: () => f(d),
|
|
53
53
|
children: d
|
|
54
54
|
},
|
|
55
55
|
d
|
|
56
56
|
)),
|
|
57
|
-
i > M && !c.includes(i - 1) && /* @__PURE__ */ s(
|
|
57
|
+
i > M && !c.includes(i - 1) && /* @__PURE__ */ s(l.Ellipsis, {}),
|
|
58
58
|
i > 1 && /* @__PURE__ */ s(
|
|
59
|
-
|
|
59
|
+
l.Item,
|
|
60
60
|
{
|
|
61
61
|
active: m === i,
|
|
62
|
-
onClick: () =>
|
|
62
|
+
onClick: () => f(i),
|
|
63
63
|
children: i
|
|
64
64
|
}
|
|
65
65
|
),
|
|
66
66
|
/* @__PURE__ */ s(
|
|
67
|
-
|
|
67
|
+
l.Next,
|
|
68
68
|
{
|
|
69
|
-
onClick: () =>
|
|
69
|
+
onClick: () => f(m + 1),
|
|
70
70
|
disabled: m === i
|
|
71
71
|
}
|
|
72
72
|
),
|
|
73
73
|
/* @__PURE__ */ s(
|
|
74
|
-
|
|
74
|
+
l.Last,
|
|
75
75
|
{
|
|
76
|
-
onClick: () =>
|
|
76
|
+
onClick: () => f(i),
|
|
77
77
|
disabled: m === i
|
|
78
78
|
}
|
|
79
79
|
)
|