@edusight/notification-widget 1.0.18 → 1.0.28
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/CHANGELOG.md +6 -0
- package/README.md +764 -52
- package/dist/components-BJ465mfK.js +1534 -0
- package/dist/components-BJ465mfK.js.map +1 -0
- package/dist/components-ytSNU0U3.cjs +72 -0
- package/dist/components-ytSNU0U3.cjs.map +1 -0
- package/dist/hooks-CACL0Qzv.cjs +2 -0
- package/dist/hooks-CACL0Qzv.cjs.map +1 -0
- package/dist/hooks-DQflK_dw.js +160 -0
- package/dist/hooks-DQflK_dw.js.map +1 -0
- package/dist/index.cjs.js +2 -46
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +1 -0
- package/dist/index.d.ts +245 -19
- package/dist/index.esm.js +679 -5027
- package/dist/index.esm.js.map +1 -1
- package/package.json +33 -22
- package/dist/components/EmptyState.d.ts +0 -7
- package/dist/components/EmptyState.d.ts.map +0 -1
- package/dist/components/NotificationBell.d.ts +0 -8
- package/dist/components/NotificationBell.d.ts.map +0 -1
- package/dist/components/NotificationCenter.d.ts +0 -19
- package/dist/components/NotificationCenter.d.ts.map +0 -1
- package/dist/components/NotificationGroup.d.ts +0 -13
- package/dist/components/NotificationGroup.d.ts.map +0 -1
- package/dist/components/NotificationItem.d.ts +0 -10
- package/dist/components/NotificationItem.d.ts.map +0 -1
- package/dist/components/NotificationList.d.ts +0 -16
- package/dist/components/NotificationList.d.ts.map +0 -1
- package/dist/components/Preferences.d.ts +0 -10
- package/dist/components/Preferences.d.ts.map +0 -1
- package/dist/hooks/useNotificationCenter.d.ts +0 -23
- package/dist/hooks/useNotificationCenter.d.ts.map +0 -1
- package/dist/hooks/useNotifications.d.ts +0 -22
- package/dist/hooks/useNotifications.d.ts.map +0 -1
- package/dist/hooks/useWebSocket.d.ts +0 -21
- package/dist/hooks/useWebSocket.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/interfaces/notification-client.interface.d.ts +0 -3
- package/dist/interfaces/notification-client.interface.d.ts.map +0 -1
- package/dist/notification-widget.css +0 -1
- package/dist/services/notification-service.d.ts +0 -9
- package/dist/services/notification-service.d.ts.map +0 -1
- package/dist/services/websocket-service.d.ts +0 -36
- package/dist/services/websocket-service.d.ts.map +0 -1
- package/dist/theme/notification-theme.d.ts +0 -3
- package/dist/theme/notification-theme.d.ts.map +0 -1
|
@@ -0,0 +1,1534 @@
|
|
|
1
|
+
import z, { useState as k, useRef as j, useEffect as R, useCallback as S, useMemo as Z, Component as de } from "react";
|
|
2
|
+
import { jsxs as i, jsx as t, Fragment as E } from "react/jsx-runtime";
|
|
3
|
+
var ee = {
|
|
4
|
+
color: void 0,
|
|
5
|
+
size: void 0,
|
|
6
|
+
className: void 0,
|
|
7
|
+
style: void 0,
|
|
8
|
+
attr: void 0
|
|
9
|
+
}, U = z.createContext && /* @__PURE__ */ z.createContext(ee), ce = ["attr", "size", "title"];
|
|
10
|
+
function ue(e, r) {
|
|
11
|
+
if (e == null) return {};
|
|
12
|
+
var a = he(e, r), n, s;
|
|
13
|
+
if (Object.getOwnPropertySymbols) {
|
|
14
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
15
|
+
for (s = 0; s < o.length; s++)
|
|
16
|
+
n = o[s], !(r.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (a[n] = e[n]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
}
|
|
20
|
+
function he(e, r) {
|
|
21
|
+
if (e == null) return {};
|
|
22
|
+
var a = {};
|
|
23
|
+
for (var n in e)
|
|
24
|
+
if (Object.prototype.hasOwnProperty.call(e, n)) {
|
|
25
|
+
if (r.indexOf(n) >= 0) continue;
|
|
26
|
+
a[n] = e[n];
|
|
27
|
+
}
|
|
28
|
+
return a;
|
|
29
|
+
}
|
|
30
|
+
function T() {
|
|
31
|
+
return T = Object.assign ? Object.assign.bind() : function(e) {
|
|
32
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
33
|
+
var a = arguments[r];
|
|
34
|
+
for (var n in a)
|
|
35
|
+
Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n]);
|
|
36
|
+
}
|
|
37
|
+
return e;
|
|
38
|
+
}, T.apply(this, arguments);
|
|
39
|
+
}
|
|
40
|
+
function K(e, r) {
|
|
41
|
+
var a = Object.keys(e);
|
|
42
|
+
if (Object.getOwnPropertySymbols) {
|
|
43
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
44
|
+
r && (n = n.filter(function(s) {
|
|
45
|
+
return Object.getOwnPropertyDescriptor(e, s).enumerable;
|
|
46
|
+
})), a.push.apply(a, n);
|
|
47
|
+
}
|
|
48
|
+
return a;
|
|
49
|
+
}
|
|
50
|
+
function I(e) {
|
|
51
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
52
|
+
var a = arguments[r] != null ? arguments[r] : {};
|
|
53
|
+
r % 2 ? K(Object(a), !0).forEach(function(n) {
|
|
54
|
+
me(e, n, a[n]);
|
|
55
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(a)) : K(Object(a)).forEach(function(n) {
|
|
56
|
+
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(a, n));
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return e;
|
|
60
|
+
}
|
|
61
|
+
function me(e, r, a) {
|
|
62
|
+
return r = fe(r), r in e ? Object.defineProperty(e, r, { value: a, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = a, e;
|
|
63
|
+
}
|
|
64
|
+
function fe(e) {
|
|
65
|
+
var r = ge(e, "string");
|
|
66
|
+
return typeof r == "symbol" ? r : r + "";
|
|
67
|
+
}
|
|
68
|
+
function ge(e, r) {
|
|
69
|
+
if (typeof e != "object" || !e) return e;
|
|
70
|
+
var a = e[Symbol.toPrimitive];
|
|
71
|
+
if (a !== void 0) {
|
|
72
|
+
var n = a.call(e, r);
|
|
73
|
+
if (typeof n != "object") return n;
|
|
74
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
75
|
+
}
|
|
76
|
+
return (r === "string" ? String : Number)(e);
|
|
77
|
+
}
|
|
78
|
+
function te(e) {
|
|
79
|
+
return e && e.map((r, a) => /* @__PURE__ */ z.createElement(r.tag, I({
|
|
80
|
+
key: a
|
|
81
|
+
}, r.attr), te(r.child)));
|
|
82
|
+
}
|
|
83
|
+
function w(e) {
|
|
84
|
+
return (r) => /* @__PURE__ */ z.createElement(pe, T({
|
|
85
|
+
attr: I({}, e.attr)
|
|
86
|
+
}, r), te(e.child));
|
|
87
|
+
}
|
|
88
|
+
function pe(e) {
|
|
89
|
+
var r = (a) => {
|
|
90
|
+
var {
|
|
91
|
+
attr: n,
|
|
92
|
+
size: s,
|
|
93
|
+
title: o
|
|
94
|
+
} = e, m = ue(e, ce), g = s || a.size || "1em", f;
|
|
95
|
+
return a.className && (f = a.className), e.className && (f = (f ? f + " " : "") + e.className), /* @__PURE__ */ z.createElement("svg", T({
|
|
96
|
+
stroke: "currentColor",
|
|
97
|
+
fill: "currentColor",
|
|
98
|
+
strokeWidth: "0"
|
|
99
|
+
}, a.attr, n, m, {
|
|
100
|
+
className: f,
|
|
101
|
+
style: I(I({
|
|
102
|
+
color: e.color || a.color
|
|
103
|
+
}, a.style), e.style),
|
|
104
|
+
height: g,
|
|
105
|
+
width: g,
|
|
106
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
107
|
+
}), o && /* @__PURE__ */ z.createElement("title", null, o), e.children);
|
|
108
|
+
};
|
|
109
|
+
return U !== void 0 ? /* @__PURE__ */ z.createElement(U.Consumer, null, (a) => r(a)) : r(ee);
|
|
110
|
+
}
|
|
111
|
+
function ve(e) {
|
|
112
|
+
return w({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M257 120.471c7.083 0 23.911 4.479 23.911 4.479 45.589 10.447 77.678 52.439 77.678 99.85V352.412l9.321 9.364 7.788 7.823H136.302l7.788-7.823 9.321-9.364V224.8c0-47.41 32.089-89.403 77.678-99.85 0 0 18.043-4.479 23.911-4.479M256 48c-17.602 0-31.059 13.518-31.059 31.2v14.559c-59.015 13.523-103.53 67.601-103.53 131.041v114.4L80 380.8v20.8h352v-20.8l-41.411-41.6V224.8c0-63.44-44.516-117.518-103.53-131.041V79.2c0-17.682-13.457-31.2-31.059-31.2zm41.411 374.4h-82.823c0 22.881 18.633 41.6 41.412 41.6s41.411-18.719 41.411-41.6z" }, child: [] }] })(e);
|
|
113
|
+
}
|
|
114
|
+
const Fe = ({
|
|
115
|
+
unreadCount: e,
|
|
116
|
+
onClick: r,
|
|
117
|
+
size: a,
|
|
118
|
+
className: n = "",
|
|
119
|
+
disabled: s = !1
|
|
120
|
+
}) => {
|
|
121
|
+
const o = (d) => d === 0 ? "" : d > 99 ? "99+" : d.toString(), m = (d) => {
|
|
122
|
+
s || (d.key === "Enter" || d.key === " ") && (d.preventDefault(), r());
|
|
123
|
+
}, g = o(e), f = e > 0;
|
|
124
|
+
return /* @__PURE__ */ i(
|
|
125
|
+
"button",
|
|
126
|
+
{
|
|
127
|
+
type: "button",
|
|
128
|
+
className: `
|
|
129
|
+
relative inline-flex items-center justify-center
|
|
130
|
+
rounded-full
|
|
131
|
+
text-[var(--widget-text-secondary)] hover:text-[var(--widget-text)]
|
|
132
|
+
bg-transparent hover:bg-[var(--widget-bg-hover)]
|
|
133
|
+
border-0 cursor-pointer
|
|
134
|
+
transition-colors duration-300
|
|
135
|
+
focus:outline-none focus:ring-1 focus:ring-[var(--widget-primary)] focus:ring-offset-1
|
|
136
|
+
disabled:opacity-70 disabled:cursor-not-allowed
|
|
137
|
+
w-10 h-10
|
|
138
|
+
${n}
|
|
139
|
+
`,
|
|
140
|
+
onClick: r,
|
|
141
|
+
onKeyDown: m,
|
|
142
|
+
disabled: s,
|
|
143
|
+
"aria-label": f ? `Notifications (${e} unread)` : "Notifications",
|
|
144
|
+
"aria-expanded": !1,
|
|
145
|
+
"aria-haspopup": "dialog",
|
|
146
|
+
"data-testid": "bell-component",
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ t(ve, { className: "w-6 h-6" }),
|
|
149
|
+
f && /* @__PURE__ */ t(
|
|
150
|
+
"span",
|
|
151
|
+
{
|
|
152
|
+
className: `
|
|
153
|
+
absolute top-1 right-1
|
|
154
|
+
inline-flex items-center justify-center
|
|
155
|
+
min-w-[17px] h-[17px]
|
|
156
|
+
px-1
|
|
157
|
+
text-[8px] font-bold leading-none
|
|
158
|
+
text-white bg-[var(--widget-primary)]
|
|
159
|
+
rounded-full
|
|
160
|
+
animate-in zoom-in-50 duration-300
|
|
161
|
+
`,
|
|
162
|
+
"aria-hidden": "true",
|
|
163
|
+
"data-testid": "unread-badge",
|
|
164
|
+
children: g
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
/* @__PURE__ */ t("span", { className: "sr-only", children: f ? `${e} unread notifications` : "No unread notifications" })
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
};
|
|
172
|
+
function D(e) {
|
|
173
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }, child: [] }] })(e);
|
|
174
|
+
}
|
|
175
|
+
function be(e) {
|
|
176
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" }, child: [] }] })(e);
|
|
177
|
+
}
|
|
178
|
+
function xe(e) {
|
|
179
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z" }, child: [] }, { tag: "path", attr: { d: "M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z" }, child: [] }] })(e);
|
|
180
|
+
}
|
|
181
|
+
function we(e) {
|
|
182
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" }, child: [] }] })(e);
|
|
183
|
+
}
|
|
184
|
+
function re(e) {
|
|
185
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0V0z" }, child: [] }, { tag: "path", attr: { d: "M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.488.488 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 0 0-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z" }, child: [] }] })(e);
|
|
186
|
+
}
|
|
187
|
+
function We(e) {
|
|
188
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }, child: [] }] })(e);
|
|
189
|
+
}
|
|
190
|
+
function ye(e) {
|
|
191
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" }, child: [] }] })(e);
|
|
192
|
+
}
|
|
193
|
+
function Ne(e) {
|
|
194
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z" }, child: [] }] })(e);
|
|
195
|
+
}
|
|
196
|
+
function ae(e) {
|
|
197
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27zM12 17.5 6.5 12H10v-2h4v2h3.5L12 17.5zM5.12 5l.81-1h12l.94 1H5.12z" }, child: [] }] })(e);
|
|
198
|
+
}
|
|
199
|
+
function ke(e) {
|
|
200
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z" }, child: [] }, { tag: "path", attr: { d: "M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z" }, child: [] }] })(e);
|
|
201
|
+
}
|
|
202
|
+
function Ce(e) {
|
|
203
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M17 1.01 7 1c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-1.99-2-1.99zM17 19H7V5h10v14z" }, child: [] }] })(e);
|
|
204
|
+
}
|
|
205
|
+
function Me(e) {
|
|
206
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "m21.41 11.58-9-9C12.05 2.22 11.55 2 11 2H4c-1.1 0-2 .9-2 2v7c0 .55.22 1.05.59 1.42l9 9c.36.36.86.58 1.41.58.55 0 1.05-.22 1.41-.59l7-7c.37-.36.59-.86.59-1.41 0-.55-.23-1.06-.59-1.42zM5.5 7C4.67 7 4 6.33 4 5.5S4.67 4 5.5 4 7 4.67 7 5.5 6.33 7 5.5 7z" }, child: [] }] })(e);
|
|
207
|
+
}
|
|
208
|
+
function ze(e) {
|
|
209
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" }, child: [] }] })(e);
|
|
210
|
+
}
|
|
211
|
+
function ne(e) {
|
|
212
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }, child: [] }] })(e);
|
|
213
|
+
}
|
|
214
|
+
function q(e) {
|
|
215
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z" }, child: [] }] })(e);
|
|
216
|
+
}
|
|
217
|
+
function L(e) {
|
|
218
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z" }, child: [] }] })(e);
|
|
219
|
+
}
|
|
220
|
+
function Ue(e) {
|
|
221
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M17.65 6.35A7.958 7.958 0 0 0 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z" }, child: [] }] })(e);
|
|
222
|
+
}
|
|
223
|
+
function Se(e) {
|
|
224
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM9 11H7V9h2v2zm4 0h-2V9h2v2zm4 0h-2V9h2v2z" }, child: [] }] })(e);
|
|
225
|
+
}
|
|
226
|
+
function G(e) {
|
|
227
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M12 22c1.1 0 2-.9 2-2h-4a2 2 0 0 0 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z" }, child: [] }] })(e);
|
|
228
|
+
}
|
|
229
|
+
function je(e) {
|
|
230
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0z" }, child: [] }, { tag: "path", attr: { d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z" }, child: [] }, { tag: "path", attr: { d: "M14 17H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z" }, child: [] }] })(e);
|
|
231
|
+
}
|
|
232
|
+
function ie(e) {
|
|
233
|
+
return w({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0V0z" }, child: [] }, { tag: "path", attr: { d: "M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V8l8 5 8-5v10zm-8-7L4 6h16l-8 5z" }, child: [] }] })(e);
|
|
234
|
+
}
|
|
235
|
+
const B = ({
|
|
236
|
+
content: e,
|
|
237
|
+
children: r,
|
|
238
|
+
position: a = "top",
|
|
239
|
+
delay: n = 200
|
|
240
|
+
}) => {
|
|
241
|
+
const [s, o] = k(!1), [m, g] = k({ x: 0, y: 0 }), f = j(null), d = j(null), y = () => {
|
|
242
|
+
f.current && clearTimeout(f.current), f.current = setTimeout(() => {
|
|
243
|
+
if (d.current) {
|
|
244
|
+
const p = d.current.getBoundingClientRect();
|
|
245
|
+
let l = 0, u = 0;
|
|
246
|
+
switch (a) {
|
|
247
|
+
case "top":
|
|
248
|
+
l = p.left + p.width / 2, u = p.top - 8;
|
|
249
|
+
break;
|
|
250
|
+
case "bottom":
|
|
251
|
+
l = p.left + p.width / 2, u = p.bottom + 8;
|
|
252
|
+
break;
|
|
253
|
+
case "left":
|
|
254
|
+
l = p.left - 8, u = p.top + p.height / 2;
|
|
255
|
+
break;
|
|
256
|
+
case "right":
|
|
257
|
+
l = p.right + 8, u = p.top + p.height / 2;
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
g({ x: l, y: u }), o(!0);
|
|
261
|
+
}
|
|
262
|
+
}, n);
|
|
263
|
+
}, c = () => {
|
|
264
|
+
f.current && clearTimeout(f.current), o(!1);
|
|
265
|
+
};
|
|
266
|
+
return R(() => () => {
|
|
267
|
+
f.current && clearTimeout(f.current);
|
|
268
|
+
}, []), /* @__PURE__ */ i(E, { children: [
|
|
269
|
+
/* @__PURE__ */ t(
|
|
270
|
+
"div",
|
|
271
|
+
{
|
|
272
|
+
ref: d,
|
|
273
|
+
onMouseEnter: y,
|
|
274
|
+
onMouseLeave: c,
|
|
275
|
+
className: "inline-flex",
|
|
276
|
+
children: r
|
|
277
|
+
}
|
|
278
|
+
),
|
|
279
|
+
s && /* @__PURE__ */ t(
|
|
280
|
+
"div",
|
|
281
|
+
{
|
|
282
|
+
className: `
|
|
283
|
+
fixed z-50 px-2 py-1 text-xs font-medium text-white rounded-md pointer-events-none
|
|
284
|
+
bg-[var(--widget-text)] shadow-lg
|
|
285
|
+
${{
|
|
286
|
+
top: "-translate-x-1/2 -translate-y-full",
|
|
287
|
+
bottom: "-translate-x-1/2 translate-y-0",
|
|
288
|
+
left: "-translate-x-full -translate-y-1/2",
|
|
289
|
+
right: "translate-x-0 -translate-y-1/2"
|
|
290
|
+
}[a]}
|
|
291
|
+
animate-in fade-in-0 zoom-in-95 duration-200
|
|
292
|
+
`,
|
|
293
|
+
style: {
|
|
294
|
+
left: `${m.x}px`,
|
|
295
|
+
top: `${m.y}px`
|
|
296
|
+
},
|
|
297
|
+
children: e
|
|
298
|
+
}
|
|
299
|
+
)
|
|
300
|
+
] });
|
|
301
|
+
}, He = (e) => {
|
|
302
|
+
if (Number.isNaN(e.getTime())) return "Long ago";
|
|
303
|
+
const n = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), s = Math.floor(n / 6e4), o = Math.floor(n / 36e5), m = Math.floor(n / 864e5);
|
|
304
|
+
return s < 1 ? "Just now" : s < 60 ? `${s}m ago` : o < 24 ? `${o}h ago` : m < 7 ? `${m}d ago` : e.toLocaleDateString();
|
|
305
|
+
}, P = ({ type: e, className: r }) => {
|
|
306
|
+
const a = r || "w-4 h-4";
|
|
307
|
+
switch (e) {
|
|
308
|
+
case "mark_read":
|
|
309
|
+
return /* @__PURE__ */ t(D, { className: a });
|
|
310
|
+
case "snooze":
|
|
311
|
+
return /* @__PURE__ */ t(ke, { className: a });
|
|
312
|
+
case "archive":
|
|
313
|
+
return /* @__PURE__ */ t(ae, { className: a });
|
|
314
|
+
default:
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
}, Ee = ({
|
|
318
|
+
notification: e,
|
|
319
|
+
onActionClick: r,
|
|
320
|
+
onSelectionChange: a,
|
|
321
|
+
isSelected: n = !1
|
|
322
|
+
}) => {
|
|
323
|
+
const [s, o] = k(!1), m = Number.isNaN(e.timestamp.getTime()), g = m ? void 0 : e.timestamp.toISOString(), f = He(e.timestamp), d = (c) => {
|
|
324
|
+
r && r(c), o(!1);
|
|
325
|
+
}, y = () => {
|
|
326
|
+
a && a(!n);
|
|
327
|
+
};
|
|
328
|
+
return /* @__PURE__ */ i(
|
|
329
|
+
"div",
|
|
330
|
+
{
|
|
331
|
+
className: `
|
|
332
|
+
relative group flex items-start gap-3 px-4 py-3 border-b border-border-light
|
|
333
|
+
transition-all duration-200
|
|
334
|
+
bg-widget-background hover:bg-widget-hover
|
|
335
|
+
${n ? "bg-widget-primary-light" : ""}
|
|
336
|
+
`,
|
|
337
|
+
onMouseEnter: () => o(!0),
|
|
338
|
+
onMouseLeave: () => o(!1),
|
|
339
|
+
"data-testid": "notification-item",
|
|
340
|
+
"data-notification-id": e.id,
|
|
341
|
+
children: [
|
|
342
|
+
a && /* @__PURE__ */ t("div", { className: "flex-shrink-0 pt-0.5", children: /* @__PURE__ */ t(
|
|
343
|
+
"input",
|
|
344
|
+
{
|
|
345
|
+
type: "checkbox",
|
|
346
|
+
checked: n,
|
|
347
|
+
onChange: y,
|
|
348
|
+
className: "w-4 h-4 text-[var(--widget-primary)] border-[var(--widget-border)] rounded cursor-pointer focus:ring-2 focus:ring-[var(--widget-primary)] focus:ring-offset-0",
|
|
349
|
+
"aria-label": `Select notification: ${e.subject}`
|
|
350
|
+
}
|
|
351
|
+
) }),
|
|
352
|
+
/* @__PURE__ */ t("div", { className: "flex-shrink-0", children: e.avatar ? /* @__PURE__ */ t(
|
|
353
|
+
"img",
|
|
354
|
+
{
|
|
355
|
+
src: e.avatar,
|
|
356
|
+
alt: "",
|
|
357
|
+
className: "w-10 h-10 rounded-full object-cover border border-border",
|
|
358
|
+
"aria-hidden": "true",
|
|
359
|
+
loading: "lazy"
|
|
360
|
+
}
|
|
361
|
+
) : /* @__PURE__ */ t("div", { className: "w-10 h-10 rounded-full bg-gradient-to-br from-widget-primary to-widget-primary-hover flex items-center justify-center shadow-sm", children: /* @__PURE__ */ t("span", { className: "text-white font-semibold text-base", children: e.subject.charAt(0).toUpperCase() }) }) }),
|
|
362
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
363
|
+
/* @__PURE__ */ i("div", { className: "flex items-start justify-between gap-2 mb-0.5", children: [
|
|
364
|
+
/* @__PURE__ */ t("h3", { className: `text-sm leading-5 text-[var(--widget-text)] ${e.isRead ? "font-medium" : "font-semibold"}`, children: e.subject }),
|
|
365
|
+
!e.isRead && /* @__PURE__ */ t("div", { className: "flex-shrink-0 mt-1.5 ml-1", children: /* @__PURE__ */ t("div", { className: "w-2 h-2 rounded-full bg-unread-indicator shadow-sm", "aria-label": "Unread", role: "img" }) })
|
|
366
|
+
] }),
|
|
367
|
+
/* @__PURE__ */ t("p", { className: "text-sm text-[var(--widget-text-secondary)] line-clamp-2 leading-relaxed mb-2", children: e.body }),
|
|
368
|
+
e.actions && e.actions.length > 0 && /* @__PURE__ */ t("div", { className: "flex items-center gap-2 mb-2", children: e.actions.map((c, b) => /* @__PURE__ */ t(
|
|
369
|
+
"button",
|
|
370
|
+
{
|
|
371
|
+
onClick: (p) => {
|
|
372
|
+
p.stopPropagation(), d(c);
|
|
373
|
+
},
|
|
374
|
+
className: `
|
|
375
|
+
px-3 py-1.5 rounded-md text-sm font-medium transition-colors
|
|
376
|
+
${b === 0 ? "bg-[var(--widget-primary)] text-white hover:bg-[var(--widget-primary-hover)] shadow-sm" : "bg-transparent text-[var(--widget-text-secondary)] hover:bg-[var(--widget-bg-hover)] border border-[var(--widget-border)]"}
|
|
377
|
+
`,
|
|
378
|
+
children: c.label
|
|
379
|
+
},
|
|
380
|
+
b
|
|
381
|
+
)) }),
|
|
382
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between min-h-[20px]", children: [
|
|
383
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ t("time", { className: "text-xs text-[var(--widget-text-tertiary)]", dateTime: g, children: f }) }),
|
|
384
|
+
/* @__PURE__ */ i(
|
|
385
|
+
"div",
|
|
386
|
+
{
|
|
387
|
+
className: `flex items-center gap-1 transition-opacity duration-200 ${s ? "opacity-100" : "opacity-0"}`,
|
|
388
|
+
onClick: (c) => c.stopPropagation(),
|
|
389
|
+
children: [
|
|
390
|
+
/* @__PURE__ */ t(B, { content: "Mark as read", position: "top", children: /* @__PURE__ */ t(
|
|
391
|
+
"button",
|
|
392
|
+
{
|
|
393
|
+
className: "inline-flex items-center justify-center w-7 h-7 rounded-md text-[var(--widget-text-secondary)] hover:text-[var(--widget-text)] hover:bg-[var(--widget-bg-hover)] transition-colors",
|
|
394
|
+
onClick: () => d({ type: "mark_read", label: "Mark as read", handler: async () => {
|
|
395
|
+
} }),
|
|
396
|
+
"aria-label": "Mark as read",
|
|
397
|
+
children: /* @__PURE__ */ t(P, { type: "mark_read" })
|
|
398
|
+
}
|
|
399
|
+
) }),
|
|
400
|
+
/* @__PURE__ */ t(B, { content: "Snooze", position: "top", children: /* @__PURE__ */ t(
|
|
401
|
+
"button",
|
|
402
|
+
{
|
|
403
|
+
className: "inline-flex items-center justify-center w-7 h-7 rounded-md text-[var(--widget-text-secondary)] hover:text-[var(--widget-text)] hover:bg-[var(--widget-bg-hover)] transition-colors",
|
|
404
|
+
onClick: () => d({ type: "custom", label: "Snooze", handler: async () => {
|
|
405
|
+
} }),
|
|
406
|
+
"aria-label": "Snooze",
|
|
407
|
+
children: /* @__PURE__ */ t(P, { type: "snooze" })
|
|
408
|
+
}
|
|
409
|
+
) }),
|
|
410
|
+
/* @__PURE__ */ t(B, { content: "Archive", position: "top", children: /* @__PURE__ */ t(
|
|
411
|
+
"button",
|
|
412
|
+
{
|
|
413
|
+
className: "inline-flex items-center justify-center w-7 h-7 rounded-md text-[var(--widget-text-secondary)] hover:text-[var(--widget-text)] hover:bg-[var(--widget-bg-hover)] transition-colors",
|
|
414
|
+
onClick: () => d({ type: "archive", label: "Archive", handler: async () => {
|
|
415
|
+
} }),
|
|
416
|
+
"aria-label": "Archive",
|
|
417
|
+
children: /* @__PURE__ */ t(P, { type: "archive" })
|
|
418
|
+
}
|
|
419
|
+
) })
|
|
420
|
+
]
|
|
421
|
+
}
|
|
422
|
+
)
|
|
423
|
+
] })
|
|
424
|
+
] }),
|
|
425
|
+
/* @__PURE__ */ i("div", { className: "sr-only", children: [
|
|
426
|
+
"Notification from ",
|
|
427
|
+
m ? "Unknown time" : e.timestamp.toLocaleString(),
|
|
428
|
+
".",
|
|
429
|
+
e.isRead ? "Read" : "Unread",
|
|
430
|
+
".",
|
|
431
|
+
e.isArchived ? "Archived" : "Active",
|
|
432
|
+
"."
|
|
433
|
+
] })
|
|
434
|
+
]
|
|
435
|
+
}
|
|
436
|
+
);
|
|
437
|
+
}, Y = ({ count: e = 3 }) => /* @__PURE__ */ t(E, { children: Array.from({ length: e }).map((r, a) => /* @__PURE__ */ i(
|
|
438
|
+
"div",
|
|
439
|
+
{
|
|
440
|
+
className: "flex items-start gap-3 px-4 py-3 border-b border-border-light animate-pulse",
|
|
441
|
+
children: [
|
|
442
|
+
/* @__PURE__ */ t("div", { className: "flex-shrink-0", children: /* @__PURE__ */ t("div", { className: "w-10 h-10 rounded-full bg-widget-hover" }) }),
|
|
443
|
+
/* @__PURE__ */ i("div", { className: "flex-1 space-y-2", children: [
|
|
444
|
+
/* @__PURE__ */ t("div", { className: "h-4 w-3/4 rounded bg-widget-hover" }),
|
|
445
|
+
/* @__PURE__ */ i("div", { className: "space-y-1", children: [
|
|
446
|
+
/* @__PURE__ */ t("div", { className: "h-3 w-full rounded bg-widget-hover" }),
|
|
447
|
+
/* @__PURE__ */ t("div", { className: "h-3 w-5/6 rounded bg-widget-hover" })
|
|
448
|
+
] }),
|
|
449
|
+
/* @__PURE__ */ t("div", { className: "h-3 w-16 rounded bg-widget-hover" })
|
|
450
|
+
] }),
|
|
451
|
+
/* @__PURE__ */ t("div", { className: "flex-shrink-0", children: /* @__PURE__ */ t("div", { className: "w-2 h-2 rounded-full bg-widget-hover" }) })
|
|
452
|
+
]
|
|
453
|
+
},
|
|
454
|
+
a
|
|
455
|
+
)) }), J = ({
|
|
456
|
+
title: e = "No Items",
|
|
457
|
+
description: r = "There are no items to display",
|
|
458
|
+
icon: a
|
|
459
|
+
}) => /* @__PURE__ */ i("div", { className: "flex flex-col items-center justify-center py-8 px-4", children: [
|
|
460
|
+
a && /* @__PURE__ */ t("div", { className: "mb-4", children: a }),
|
|
461
|
+
/* @__PURE__ */ t("h3", { className: "text-lg font-semibold text-text-primary mb-2", children: e }),
|
|
462
|
+
/* @__PURE__ */ t("p", { className: "text-sm text-text-secondary text-center", children: r })
|
|
463
|
+
] }), Te = ({
|
|
464
|
+
selectedNotifications: e,
|
|
465
|
+
onMarkAllAsRead: r,
|
|
466
|
+
onMarkAllAsUnread: a,
|
|
467
|
+
onArchiveAll: n,
|
|
468
|
+
onDeleteAll: s,
|
|
469
|
+
onClearSelection: o,
|
|
470
|
+
className: m = ""
|
|
471
|
+
}) => {
|
|
472
|
+
const [g, f] = k(!1), [d, y] = k(null), c = e.length, b = async (p, l) => {
|
|
473
|
+
if (c !== 0) {
|
|
474
|
+
f(!0), y(null);
|
|
475
|
+
try {
|
|
476
|
+
const u = await p(e);
|
|
477
|
+
y(u), u.success && o();
|
|
478
|
+
} catch (u) {
|
|
479
|
+
y({
|
|
480
|
+
success: !1,
|
|
481
|
+
processedCount: 0,
|
|
482
|
+
failedCount: c,
|
|
483
|
+
errors: [{ notificationId: "", error: u }]
|
|
484
|
+
});
|
|
485
|
+
} finally {
|
|
486
|
+
f(!1);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
return c === 0 ? null : /* @__PURE__ */ i(
|
|
491
|
+
"div",
|
|
492
|
+
{
|
|
493
|
+
className: `border-t border-border bg-widget-primary-light p-2 ${m}`,
|
|
494
|
+
children: [
|
|
495
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
496
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
497
|
+
/* @__PURE__ */ i(
|
|
498
|
+
"span",
|
|
499
|
+
{
|
|
500
|
+
className: "text-sm font-medium text-widget-primary",
|
|
501
|
+
children: [
|
|
502
|
+
c,
|
|
503
|
+
" notification",
|
|
504
|
+
c !== 1 ? "s" : "",
|
|
505
|
+
" selected"
|
|
506
|
+
]
|
|
507
|
+
}
|
|
508
|
+
),
|
|
509
|
+
d && !d.success && /* @__PURE__ */ i(
|
|
510
|
+
"span",
|
|
511
|
+
{
|
|
512
|
+
className: "text-xs text-[var(--widget-error)]",
|
|
513
|
+
children: [
|
|
514
|
+
d.failedCount,
|
|
515
|
+
" failed"
|
|
516
|
+
]
|
|
517
|
+
}
|
|
518
|
+
)
|
|
519
|
+
] }),
|
|
520
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
521
|
+
/* @__PURE__ */ i(
|
|
522
|
+
"button",
|
|
523
|
+
{
|
|
524
|
+
type: "button",
|
|
525
|
+
onClick: () => b(r),
|
|
526
|
+
disabled: g,
|
|
527
|
+
className: "inline-flex items-center px-2 py-1 text-xs font-medium text-blue-700 bg-white border border-blue-300 rounded hover:bg-blue-50 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
|
|
528
|
+
"data-testid": "bulk-mark-read",
|
|
529
|
+
children: [
|
|
530
|
+
/* @__PURE__ */ t(D, { className: "mr-1 w-4 h-4" }),
|
|
531
|
+
"Mark Read"
|
|
532
|
+
]
|
|
533
|
+
}
|
|
534
|
+
),
|
|
535
|
+
/* @__PURE__ */ i(
|
|
536
|
+
"button",
|
|
537
|
+
{
|
|
538
|
+
type: "button",
|
|
539
|
+
onClick: () => b(a),
|
|
540
|
+
disabled: g,
|
|
541
|
+
className: "inline-flex items-center px-2 py-1 text-xs font-medium text-blue-700 bg-white border border-blue-300 rounded hover:bg-blue-50 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
|
|
542
|
+
"data-testid": "bulk-mark-unread",
|
|
543
|
+
children: [
|
|
544
|
+
/* @__PURE__ */ t(ie, { className: "mr-1 w-4 h-4" }),
|
|
545
|
+
"Mark Unread"
|
|
546
|
+
]
|
|
547
|
+
}
|
|
548
|
+
),
|
|
549
|
+
/* @__PURE__ */ i(
|
|
550
|
+
"button",
|
|
551
|
+
{
|
|
552
|
+
type: "button",
|
|
553
|
+
onClick: () => b(n),
|
|
554
|
+
disabled: g,
|
|
555
|
+
className: "inline-flex items-center px-2 py-1 text-xs font-medium text-text-secondary bg-white border border-border rounded hover:bg-widget-hover focus:outline-none focus:ring-2 focus:ring-text-secondary disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
|
|
556
|
+
"data-testid": "bulk-archive",
|
|
557
|
+
children: [
|
|
558
|
+
/* @__PURE__ */ t(ae, { className: "mr-1 w-4 h-4" }),
|
|
559
|
+
"Archive"
|
|
560
|
+
]
|
|
561
|
+
}
|
|
562
|
+
),
|
|
563
|
+
/* @__PURE__ */ i(
|
|
564
|
+
"button",
|
|
565
|
+
{
|
|
566
|
+
type: "button",
|
|
567
|
+
onClick: () => {
|
|
568
|
+
window.confirm(`Are you sure you want to delete ${c} notification${c !== 1 ? "s" : ""}? This action cannot be undone.`) && b(s);
|
|
569
|
+
},
|
|
570
|
+
disabled: g,
|
|
571
|
+
className: "inline-flex items-center px-2 py-1 text-xs font-medium text-[var(--widget-error)] bg-white border border-[var(--widget-error)]/30 rounded hover:bg-[var(--widget-error)]/10 focus:outline-none focus:ring-2 focus:ring-[var(--widget-error)] disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
|
|
572
|
+
"data-testid": "bulk-delete",
|
|
573
|
+
children: [
|
|
574
|
+
/* @__PURE__ */ t(be, { className: "mr-1 w-4 h-4" }),
|
|
575
|
+
"Delete"
|
|
576
|
+
]
|
|
577
|
+
}
|
|
578
|
+
),
|
|
579
|
+
/* @__PURE__ */ t(
|
|
580
|
+
"button",
|
|
581
|
+
{
|
|
582
|
+
type: "button",
|
|
583
|
+
onClick: o,
|
|
584
|
+
disabled: g,
|
|
585
|
+
className: "inline-flex items-center px-1 py-1 text-xs font-medium text-text-secondary hover:text-text-primary focus:outline-none focus:ring-2 focus:ring-text-secondary disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
|
|
586
|
+
"data-testid": "clear-selection",
|
|
587
|
+
"aria-label": "Clear selection",
|
|
588
|
+
children: /* @__PURE__ */ t(ne, { className: "w-5 h-5" })
|
|
589
|
+
}
|
|
590
|
+
)
|
|
591
|
+
] })
|
|
592
|
+
] }),
|
|
593
|
+
g && /* @__PURE__ */ i("div", { className: "mt-2 flex items-center gap-2", children: [
|
|
594
|
+
/* @__PURE__ */ t("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--widget-primary)]" }),
|
|
595
|
+
/* @__PURE__ */ t(
|
|
596
|
+
"span",
|
|
597
|
+
{
|
|
598
|
+
className: "text-xs text-[var(--widget-primary)]",
|
|
599
|
+
children: "Processing..."
|
|
600
|
+
}
|
|
601
|
+
)
|
|
602
|
+
] }),
|
|
603
|
+
d && /* @__PURE__ */ t("div", { className: "mt-2", children: d.success ? /* @__PURE__ */ i(
|
|
604
|
+
"div",
|
|
605
|
+
{
|
|
606
|
+
className: "text-xs text-[var(--widget-success)]",
|
|
607
|
+
children: [
|
|
608
|
+
"Successfully processed ",
|
|
609
|
+
d.processedCount,
|
|
610
|
+
" notification",
|
|
611
|
+
d.processedCount !== 1 ? "s" : ""
|
|
612
|
+
]
|
|
613
|
+
}
|
|
614
|
+
) : /* @__PURE__ */ i(
|
|
615
|
+
"div",
|
|
616
|
+
{
|
|
617
|
+
className: "text-xs text-[var(--widget-error)]",
|
|
618
|
+
children: [
|
|
619
|
+
d.processedCount > 0 && /* @__PURE__ */ i("span", { children: [
|
|
620
|
+
"Processed ",
|
|
621
|
+
d.processedCount,
|
|
622
|
+
", "
|
|
623
|
+
] }),
|
|
624
|
+
"Failed to process ",
|
|
625
|
+
d.failedCount,
|
|
626
|
+
" notification",
|
|
627
|
+
d.failedCount !== 1 ? "s" : ""
|
|
628
|
+
]
|
|
629
|
+
}
|
|
630
|
+
) })
|
|
631
|
+
]
|
|
632
|
+
}
|
|
633
|
+
);
|
|
634
|
+
}, Ie = ({
|
|
635
|
+
notifications: e,
|
|
636
|
+
isLoading: r = !1,
|
|
637
|
+
error: a,
|
|
638
|
+
onNotificationAction: n,
|
|
639
|
+
selectedNotifications: s = [],
|
|
640
|
+
onSelectionChange: o,
|
|
641
|
+
onSelectAll: m,
|
|
642
|
+
onLoadMore: g,
|
|
643
|
+
hasMore: f = !1,
|
|
644
|
+
className: d = ""
|
|
645
|
+
}) => {
|
|
646
|
+
const y = j(null), c = j(null), [b, p] = k(!1);
|
|
647
|
+
R(() => {
|
|
648
|
+
if (!(!g || !f || b))
|
|
649
|
+
return y.current = new IntersectionObserver(
|
|
650
|
+
(h) => {
|
|
651
|
+
h[0].isIntersecting && f && !b && (p(!0), g(), setTimeout(() => p(!1), 500));
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
root: null,
|
|
655
|
+
rootMargin: "100px",
|
|
656
|
+
threshold: 0.1
|
|
657
|
+
}
|
|
658
|
+
), c.current && y.current.observe(c.current), () => {
|
|
659
|
+
y.current && y.current.disconnect();
|
|
660
|
+
};
|
|
661
|
+
}, [g, f, b]);
|
|
662
|
+
const l = S(async (h) => {
|
|
663
|
+
try {
|
|
664
|
+
h.handler && await h.handler(""), n && h.type && n("", h);
|
|
665
|
+
} catch {
|
|
666
|
+
}
|
|
667
|
+
}, [n]), u = S((h, v) => {
|
|
668
|
+
o && o(h, v);
|
|
669
|
+
}, [o]);
|
|
670
|
+
return r && e.length === 0 ? /* @__PURE__ */ t("div", { className: `flex flex-col h-full bg-widget-background ${d}`, children: /* @__PURE__ */ t(Y, { count: 5 }) }) : a ? /* @__PURE__ */ t("div", { className: `flex flex-col h-full bg-widget-background ${d}`, children: /* @__PURE__ */ t("div", { className: "flex items-center justify-center flex-1 py-12", children: /* @__PURE__ */ t(
|
|
671
|
+
J,
|
|
672
|
+
{
|
|
673
|
+
title: "Error Loading Notifications",
|
|
674
|
+
description: "Failed to load notifications. Please try again.",
|
|
675
|
+
icon: /* @__PURE__ */ t(
|
|
676
|
+
"svg",
|
|
677
|
+
{
|
|
678
|
+
className: "w-12 h-12 text-[var(--widget-error)]",
|
|
679
|
+
fill: "none",
|
|
680
|
+
stroke: "currentColor",
|
|
681
|
+
viewBox: "0 0 24 24",
|
|
682
|
+
children: /* @__PURE__ */ t(
|
|
683
|
+
"path",
|
|
684
|
+
{
|
|
685
|
+
strokeLinecap: "round",
|
|
686
|
+
strokeLinejoin: "round",
|
|
687
|
+
strokeWidth: 2,
|
|
688
|
+
d: "M12 8v4m0 4v.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
689
|
+
}
|
|
690
|
+
)
|
|
691
|
+
}
|
|
692
|
+
)
|
|
693
|
+
}
|
|
694
|
+
) }) }) : e.length === 0 ? /* @__PURE__ */ t("div", { className: `flex flex-col h-full bg-widget-background ${d}`, children: /* @__PURE__ */ t("div", { className: "flex items-center justify-center flex-1 py-12", children: /* @__PURE__ */ t(
|
|
695
|
+
J,
|
|
696
|
+
{
|
|
697
|
+
title: "No Notifications",
|
|
698
|
+
description: "You're all caught up! No notifications to display.",
|
|
699
|
+
icon: /* @__PURE__ */ t(
|
|
700
|
+
"svg",
|
|
701
|
+
{
|
|
702
|
+
className: "w-12 h-12 text-[var(--widget-text-tertiary)]",
|
|
703
|
+
fill: "none",
|
|
704
|
+
stroke: "currentColor",
|
|
705
|
+
viewBox: "0 0 24 24",
|
|
706
|
+
children: /* @__PURE__ */ t(
|
|
707
|
+
"path",
|
|
708
|
+
{
|
|
709
|
+
strokeLinecap: "round",
|
|
710
|
+
strokeLinejoin: "round",
|
|
711
|
+
strokeWidth: 2,
|
|
712
|
+
d: "M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"
|
|
713
|
+
}
|
|
714
|
+
)
|
|
715
|
+
}
|
|
716
|
+
)
|
|
717
|
+
}
|
|
718
|
+
) }) }) : /* @__PURE__ */ i("div", { className: `flex flex-col h-full ${d}`, children: [
|
|
719
|
+
m && n && /* @__PURE__ */ t(
|
|
720
|
+
Te,
|
|
721
|
+
{
|
|
722
|
+
selectedNotifications: s,
|
|
723
|
+
onMarkAllAsRead: async (h) => {
|
|
724
|
+
try {
|
|
725
|
+
for (const v of h)
|
|
726
|
+
n(v, { type: "mark_read", label: "Mark as read", handler: async () => {
|
|
727
|
+
} });
|
|
728
|
+
return {
|
|
729
|
+
success: !0,
|
|
730
|
+
processedCount: h.length,
|
|
731
|
+
failedCount: 0,
|
|
732
|
+
errors: []
|
|
733
|
+
};
|
|
734
|
+
} catch (v) {
|
|
735
|
+
return {
|
|
736
|
+
success: !1,
|
|
737
|
+
processedCount: 0,
|
|
738
|
+
failedCount: h.length,
|
|
739
|
+
errors: [{ notificationId: "", error: v }]
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
},
|
|
743
|
+
onMarkAllAsUnread: async (h) => {
|
|
744
|
+
try {
|
|
745
|
+
for (const v of h)
|
|
746
|
+
n(v, { type: "mark_unread", label: "Mark as unread", handler: async () => {
|
|
747
|
+
} });
|
|
748
|
+
return {
|
|
749
|
+
success: !0,
|
|
750
|
+
processedCount: h.length,
|
|
751
|
+
failedCount: 0,
|
|
752
|
+
errors: []
|
|
753
|
+
};
|
|
754
|
+
} catch (v) {
|
|
755
|
+
return {
|
|
756
|
+
success: !1,
|
|
757
|
+
processedCount: 0,
|
|
758
|
+
failedCount: h.length,
|
|
759
|
+
errors: [{ notificationId: "", error: v }]
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
},
|
|
763
|
+
onArchiveAll: async (h) => {
|
|
764
|
+
try {
|
|
765
|
+
for (const v of h)
|
|
766
|
+
n(v, { type: "archive", label: "Archive", handler: async () => {
|
|
767
|
+
} });
|
|
768
|
+
return {
|
|
769
|
+
success: !0,
|
|
770
|
+
processedCount: h.length,
|
|
771
|
+
failedCount: 0,
|
|
772
|
+
errors: []
|
|
773
|
+
};
|
|
774
|
+
} catch (v) {
|
|
775
|
+
return {
|
|
776
|
+
success: !1,
|
|
777
|
+
processedCount: 0,
|
|
778
|
+
failedCount: h.length,
|
|
779
|
+
errors: [{ notificationId: "", error: v }]
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
},
|
|
783
|
+
onDeleteAll: async (h) => {
|
|
784
|
+
try {
|
|
785
|
+
for (const v of h)
|
|
786
|
+
n(v, { type: "delete", label: "Delete", handler: async () => {
|
|
787
|
+
} });
|
|
788
|
+
return {
|
|
789
|
+
success: !0,
|
|
790
|
+
processedCount: h.length,
|
|
791
|
+
failedCount: 0,
|
|
792
|
+
errors: []
|
|
793
|
+
};
|
|
794
|
+
} catch (v) {
|
|
795
|
+
return {
|
|
796
|
+
success: !1,
|
|
797
|
+
processedCount: 0,
|
|
798
|
+
failedCount: h.length,
|
|
799
|
+
errors: [{ notificationId: "", error: v }]
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
onClearSelection: () => m(!1)
|
|
804
|
+
}
|
|
805
|
+
),
|
|
806
|
+
/* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto widget-scrollbar bg-widget-background", children: /* @__PURE__ */ i("div", { children: [
|
|
807
|
+
e.map((h) => /* @__PURE__ */ t(
|
|
808
|
+
Ee,
|
|
809
|
+
{
|
|
810
|
+
notification: h,
|
|
811
|
+
onActionClick: l,
|
|
812
|
+
isSelected: s.includes(h.id),
|
|
813
|
+
onSelectionChange: o ? (v) => u(h.id, v) : void 0
|
|
814
|
+
},
|
|
815
|
+
h.id
|
|
816
|
+
)),
|
|
817
|
+
f && /* @__PURE__ */ t("div", { ref: c, className: "py-2", children: b && /* @__PURE__ */ t(Y, { count: 3 }) })
|
|
818
|
+
] }) })
|
|
819
|
+
] });
|
|
820
|
+
}, Ae = ({
|
|
821
|
+
notifications: e,
|
|
822
|
+
activeTab: r,
|
|
823
|
+
onTabChange: a,
|
|
824
|
+
size: n = "medium",
|
|
825
|
+
className: s = ""
|
|
826
|
+
}) => {
|
|
827
|
+
const o = Z(() => {
|
|
828
|
+
const m = e.length, g = e.filter((c) => !c.isRead).length, f = /* @__PURE__ */ new Map();
|
|
829
|
+
e.forEach((c) => {
|
|
830
|
+
c.tags.forEach((b) => {
|
|
831
|
+
f.set(b, (f.get(b) || 0) + 1);
|
|
832
|
+
});
|
|
833
|
+
});
|
|
834
|
+
const d = [
|
|
835
|
+
{
|
|
836
|
+
id: "all",
|
|
837
|
+
label: "All",
|
|
838
|
+
count: m,
|
|
839
|
+
icon: /* @__PURE__ */ t(je, { className: "w-4 h-4" })
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
id: "unread",
|
|
843
|
+
label: "Unread",
|
|
844
|
+
count: g,
|
|
845
|
+
icon: /* @__PURE__ */ t(ie, { className: "w-4 h-4" })
|
|
846
|
+
}
|
|
847
|
+
], y = Array.from(f.entries()).sort(([, c], [, b]) => b - c).slice(0, 5).map(([c, b]) => ({
|
|
848
|
+
id: `tag:${c}`,
|
|
849
|
+
label: c,
|
|
850
|
+
count: b,
|
|
851
|
+
icon: /* @__PURE__ */ t(Me, { className: "w-4 h-4" })
|
|
852
|
+
}));
|
|
853
|
+
return [...d, ...y];
|
|
854
|
+
}, [e]);
|
|
855
|
+
return /* @__PURE__ */ t(
|
|
856
|
+
"div",
|
|
857
|
+
{
|
|
858
|
+
className: `
|
|
859
|
+
flex items-center gap-1 overflow-x-auto widget-scrollbar border-b border-[var(--widget-border)] bg-[var(--widget-bg)] px-2 py-1.5
|
|
860
|
+
${s}
|
|
861
|
+
`,
|
|
862
|
+
role: "tablist",
|
|
863
|
+
children: o.map((m) => {
|
|
864
|
+
const g = r === m.id;
|
|
865
|
+
return /* @__PURE__ */ i(
|
|
866
|
+
"button",
|
|
867
|
+
{
|
|
868
|
+
onClick: () => a(m.id),
|
|
869
|
+
className: `
|
|
870
|
+
flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-all whitespace-nowrap outline-none focus:ring-2 focus:ring-widget-primary focus:ring-offset-1
|
|
871
|
+
${g ? "bg-widget-primary text-white shadow-sm" : "text-text-secondary hover:bg-widget-hover hover:text-text-primary"}
|
|
872
|
+
`,
|
|
873
|
+
role: "tab",
|
|
874
|
+
"aria-selected": g,
|
|
875
|
+
"data-testid": `tab-${m.id}`,
|
|
876
|
+
children: [
|
|
877
|
+
m.icon && /* @__PURE__ */ t("span", { className: `${g ? "text-white" : "text-[var(--widget-text-tertiary)]"}`, children: m.icon }),
|
|
878
|
+
/* @__PURE__ */ t("span", { children: m.label }),
|
|
879
|
+
m.count !== void 0 && m.count > 0 && /* @__PURE__ */ t(
|
|
880
|
+
"span",
|
|
881
|
+
{
|
|
882
|
+
className: `
|
|
883
|
+
ml-0.5 px-1.5 py-0.5 rounded-full text-[10px] font-bold leading-none
|
|
884
|
+
${g ? "bg-white/20 text-white" : "bg-[var(--widget-bg-secondary)] text-[var(--widget-text-tertiary)]"}
|
|
885
|
+
`,
|
|
886
|
+
children: m.count > 99 ? "99+" : m.count
|
|
887
|
+
}
|
|
888
|
+
)
|
|
889
|
+
]
|
|
890
|
+
},
|
|
891
|
+
m.id
|
|
892
|
+
);
|
|
893
|
+
})
|
|
894
|
+
}
|
|
895
|
+
);
|
|
896
|
+
}, M = ({
|
|
897
|
+
id: e,
|
|
898
|
+
label: r,
|
|
899
|
+
checked: a,
|
|
900
|
+
onChange: n,
|
|
901
|
+
disabled: s = !1,
|
|
902
|
+
icon: o
|
|
903
|
+
}) => /* @__PURE__ */ i("div", { className: "flex items-center justify-between py-2.5", children: [
|
|
904
|
+
r && /* @__PURE__ */ i("label", { htmlFor: e, className: "flex items-center gap-2 text-sm font-medium text-text-primary cursor-pointer", children: [
|
|
905
|
+
o && /* @__PURE__ */ t("span", { className: "text-widget-primary", children: o }),
|
|
906
|
+
/* @__PURE__ */ t("span", { children: r })
|
|
907
|
+
] }),
|
|
908
|
+
/* @__PURE__ */ t(
|
|
909
|
+
"button",
|
|
910
|
+
{
|
|
911
|
+
type: "button",
|
|
912
|
+
id: e,
|
|
913
|
+
role: "switch",
|
|
914
|
+
"aria-checked": a,
|
|
915
|
+
disabled: s,
|
|
916
|
+
className: `
|
|
917
|
+
relative inline-flex h-3 w-6 flex-shrink-0 rounded-full border-2 border-transparent
|
|
918
|
+
transition-colors duration-200 ease-in-out
|
|
919
|
+
focus:outline-none focus:ring-2 focus:ring-widget-primary focus:ring-offset-2
|
|
920
|
+
${a ? "bg-widget-primary" : "bg-border"}
|
|
921
|
+
${s ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
|
|
922
|
+
`,
|
|
923
|
+
onClick: () => !s && n(!a),
|
|
924
|
+
children: /* @__PURE__ */ t(
|
|
925
|
+
"span",
|
|
926
|
+
{
|
|
927
|
+
className: `
|
|
928
|
+
pointer-events-none inline-block h-2 w-2 transform rounded-full bg-white shadow-sm ring-0
|
|
929
|
+
transition duration-200 ease-in-out
|
|
930
|
+
${a ? "translate-x-3" : "translate-x-0"}
|
|
931
|
+
`
|
|
932
|
+
}
|
|
933
|
+
)
|
|
934
|
+
}
|
|
935
|
+
)
|
|
936
|
+
] }), $e = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], Oe = ({
|
|
937
|
+
preferences: e,
|
|
938
|
+
onPreferenceChange: r,
|
|
939
|
+
isLoading: a
|
|
940
|
+
}) => {
|
|
941
|
+
const [n, s] = k({
|
|
942
|
+
global: !0,
|
|
943
|
+
schedule: !1
|
|
944
|
+
}), [o, m] = k({}), g = (l) => {
|
|
945
|
+
s((u) => ({ ...u, [l]: !u[l] }));
|
|
946
|
+
}, f = (l) => {
|
|
947
|
+
m((u) => ({ ...u, [l]: !u[l] }));
|
|
948
|
+
}, d = (l, u) => {
|
|
949
|
+
r(`channels.${l}`, u);
|
|
950
|
+
}, y = (l, u) => {
|
|
951
|
+
r(`subscriptions.${l}.enabled`, u);
|
|
952
|
+
}, c = (l, u, h) => {
|
|
953
|
+
r(`subscriptions.${l}.channels.${u}`, h);
|
|
954
|
+
}, b = (l) => {
|
|
955
|
+
const u = [...e.deliverySchedule.weekdays];
|
|
956
|
+
u[l] = !u[l], r("deliverySchedule.weekdays", u);
|
|
957
|
+
}, p = (l) => {
|
|
958
|
+
switch (l) {
|
|
959
|
+
case "email":
|
|
960
|
+
return /* @__PURE__ */ t(Ne, { className: "w-4 h-4" });
|
|
961
|
+
case "push":
|
|
962
|
+
return /* @__PURE__ */ t(G, { className: "w-4 h-4" });
|
|
963
|
+
case "sms":
|
|
964
|
+
return /* @__PURE__ */ t(Se, { className: "w-4 h-4" });
|
|
965
|
+
case "inApp":
|
|
966
|
+
return /* @__PURE__ */ t(Ce, { className: "w-4 h-4" });
|
|
967
|
+
default:
|
|
968
|
+
return null;
|
|
969
|
+
}
|
|
970
|
+
};
|
|
971
|
+
return /* @__PURE__ */ i("div", { className: "h-full overflow-y-auto widget-scrollbar p-2", "data-testid": "preferences-view", children: [
|
|
972
|
+
a && /* @__PURE__ */ t("div", { className: "absolute inset-0 bg-[var(--widget-bg)]/75 backdrop-blur-sm flex items-center justify-center z-10", children: /* @__PURE__ */ t("div", { className: "w-8 h-8 border-2 border-[var(--widget-primary)] border-t-transparent rounded-full animate-spin" }) }),
|
|
973
|
+
/* @__PURE__ */ i("div", { className: "space-y-2", children: [
|
|
974
|
+
/* @__PURE__ */ i("div", { className: "border border-[var(--widget-border)] rounded-lg overflow-hidden", children: [
|
|
975
|
+
/* @__PURE__ */ i(
|
|
976
|
+
"button",
|
|
977
|
+
{
|
|
978
|
+
type: "button",
|
|
979
|
+
onClick: () => g("global"),
|
|
980
|
+
className: "w-full flex items-center justify-between px-2 py-1.5 bg-[var(--widget-bg-secondary)] hover:bg-[var(--widget-bg-hover)] transition-colors",
|
|
981
|
+
children: [
|
|
982
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
983
|
+
/* @__PURE__ */ t(G, { className: "w-5 h-5 text-widget-primary" }),
|
|
984
|
+
/* @__PURE__ */ t("span", { className: "font-semibold text-sm text-text-primary", children: "Global Preferences" })
|
|
985
|
+
] }),
|
|
986
|
+
n.global ? /* @__PURE__ */ t(q, { className: "w-5 h-5 text-text-secondary" }) : /* @__PURE__ */ t(L, { className: "w-5 h-5 text-text-secondary" })
|
|
987
|
+
]
|
|
988
|
+
}
|
|
989
|
+
),
|
|
990
|
+
n.global && /* @__PURE__ */ i("div", { className: "px-2 pb-1.5 bg-widget-background divide-y divide-border-light", children: [
|
|
991
|
+
/* @__PURE__ */ t(
|
|
992
|
+
M,
|
|
993
|
+
{
|
|
994
|
+
id: "channel-email",
|
|
995
|
+
label: "Email",
|
|
996
|
+
icon: p("email"),
|
|
997
|
+
checked: e.channels.email,
|
|
998
|
+
onChange: (l) => d("email", l),
|
|
999
|
+
disabled: a
|
|
1000
|
+
}
|
|
1001
|
+
),
|
|
1002
|
+
/* @__PURE__ */ t(
|
|
1003
|
+
M,
|
|
1004
|
+
{
|
|
1005
|
+
id: "channel-inapp",
|
|
1006
|
+
label: "In-App",
|
|
1007
|
+
icon: p("inApp"),
|
|
1008
|
+
checked: e.channels.inApp,
|
|
1009
|
+
onChange: (l) => d("inApp", l),
|
|
1010
|
+
disabled: a
|
|
1011
|
+
}
|
|
1012
|
+
),
|
|
1013
|
+
/* @__PURE__ */ t(
|
|
1014
|
+
M,
|
|
1015
|
+
{
|
|
1016
|
+
id: "channel-push",
|
|
1017
|
+
label: "Push",
|
|
1018
|
+
icon: p("push"),
|
|
1019
|
+
checked: e.channels.push,
|
|
1020
|
+
onChange: (l) => d("push", l),
|
|
1021
|
+
disabled: a
|
|
1022
|
+
}
|
|
1023
|
+
)
|
|
1024
|
+
] })
|
|
1025
|
+
] }),
|
|
1026
|
+
/* @__PURE__ */ i("div", { className: "border border-[var(--widget-border)] rounded-lg overflow-hidden bg-[var(--widget-bg)]", children: [
|
|
1027
|
+
/* @__PURE__ */ i(
|
|
1028
|
+
"button",
|
|
1029
|
+
{
|
|
1030
|
+
type: "button",
|
|
1031
|
+
onClick: () => g("schedule"),
|
|
1032
|
+
className: "w-full flex items-center justify-between px-2 py-1.5 bg-[var(--widget-bg-secondary)] hover:bg-[var(--widget-bg-hover)] transition-colors",
|
|
1033
|
+
children: [
|
|
1034
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
1035
|
+
/* @__PURE__ */ t(xe, { className: "w-5 h-5 text-widget-primary" }),
|
|
1036
|
+
/* @__PURE__ */ t("span", { className: "font-semibold text-sm text-text-primary", children: "Schedule" })
|
|
1037
|
+
] }),
|
|
1038
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
1039
|
+
/* @__PURE__ */ t(
|
|
1040
|
+
M,
|
|
1041
|
+
{
|
|
1042
|
+
id: "schedule-enabled",
|
|
1043
|
+
checked: n.schedule,
|
|
1044
|
+
onChange: () => {
|
|
1045
|
+
},
|
|
1046
|
+
disabled: a
|
|
1047
|
+
}
|
|
1048
|
+
),
|
|
1049
|
+
/* @__PURE__ */ t(
|
|
1050
|
+
"div",
|
|
1051
|
+
{
|
|
1052
|
+
className: `transition-transform duration-200 ${n.schedule ? "rotate-180" : ""}`,
|
|
1053
|
+
"aria-hidden": "true",
|
|
1054
|
+
children: /* @__PURE__ */ t(L, { className: "w-5 h-5 text-text-secondary" })
|
|
1055
|
+
}
|
|
1056
|
+
)
|
|
1057
|
+
] })
|
|
1058
|
+
]
|
|
1059
|
+
}
|
|
1060
|
+
),
|
|
1061
|
+
n.schedule && /* @__PURE__ */ i("div", { className: "px-2 py-1.5 space-y-2 animate-in slide-in-from-top-2 duration-200", children: [
|
|
1062
|
+
/* @__PURE__ */ t("div", { className: "text-sm text-[var(--widget-text-secondary)]", children: "Allow notifications between:" }),
|
|
1063
|
+
/* @__PURE__ */ i("div", { className: "grid grid-cols-[auto_1fr_auto_auto] gap-x-4 gap-y-3 items-center", children: [
|
|
1064
|
+
/* @__PURE__ */ t("div", { className: "col-span-2 text-xs font-semibold text-[var(--widget-text-tertiary)] pl-1", children: "Days" }),
|
|
1065
|
+
/* @__PURE__ */ t("div", { className: "text-xs font-semibold text-[var(--widget-text-tertiary)] w-[88px]", children: "From" }),
|
|
1066
|
+
/* @__PURE__ */ t("div", { className: "text-xs font-semibold text-[var(--widget-text-tertiary)] w-[88px]", children: "To" }),
|
|
1067
|
+
$e.map((l, u) => {
|
|
1068
|
+
const h = e.deliverySchedule.weekdays[u];
|
|
1069
|
+
return /* @__PURE__ */ i(z.Fragment, { children: [
|
|
1070
|
+
/* @__PURE__ */ t("div", { className: "flex items-center h-8", children: /* @__PURE__ */ t(
|
|
1071
|
+
M,
|
|
1072
|
+
{
|
|
1073
|
+
id: `day-${u}`,
|
|
1074
|
+
checked: h,
|
|
1075
|
+
onChange: () => b(u),
|
|
1076
|
+
disabled: a
|
|
1077
|
+
}
|
|
1078
|
+
) }),
|
|
1079
|
+
/* @__PURE__ */ t("div", { className: `text-sm ${h ? "text-text-primary" : "text-text-tertiary"}`, children: l }),
|
|
1080
|
+
/* @__PURE__ */ t("div", { className: "w-[88px]", children: /* @__PURE__ */ t(
|
|
1081
|
+
"input",
|
|
1082
|
+
{
|
|
1083
|
+
type: "time",
|
|
1084
|
+
className: "w-full px-2 py-1 bg-widget-background border border-border rounded text-sm text-text-primary focus:outline-none focus:ring-1 focus:ring-widget-primary disabled:opacity-50 disabled:bg-widget-hover",
|
|
1085
|
+
value: e.deliverySchedule.quietHours.start,
|
|
1086
|
+
onChange: (v) => r("deliverySchedule.quietHours.start", v.target.value),
|
|
1087
|
+
disabled: a || !h
|
|
1088
|
+
}
|
|
1089
|
+
) }),
|
|
1090
|
+
/* @__PURE__ */ t("div", { className: "w-[88px]", children: /* @__PURE__ */ t(
|
|
1091
|
+
"input",
|
|
1092
|
+
{
|
|
1093
|
+
type: "time",
|
|
1094
|
+
className: "w-full px-2 py-1 bg-widget-background border border-border rounded text-sm text-text-primary focus:outline-none focus:ring-1 focus:ring-widget-primary disabled:opacity-50 disabled:bg-widget-hover",
|
|
1095
|
+
value: e.deliverySchedule.quietHours.end,
|
|
1096
|
+
onChange: (v) => r("deliverySchedule.quietHours.end", v.target.value),
|
|
1097
|
+
disabled: a || !h
|
|
1098
|
+
}
|
|
1099
|
+
) })
|
|
1100
|
+
] }, l);
|
|
1101
|
+
})
|
|
1102
|
+
] })
|
|
1103
|
+
] })
|
|
1104
|
+
] }),
|
|
1105
|
+
e.subscriptions.length > 0 && e.subscriptions.map((l) => /* @__PURE__ */ i("div", { className: "border border-[var(--widget-border)] rounded-lg overflow-hidden", children: [
|
|
1106
|
+
/* @__PURE__ */ i(
|
|
1107
|
+
"button",
|
|
1108
|
+
{
|
|
1109
|
+
type: "button",
|
|
1110
|
+
onClick: () => f(l.workflowId),
|
|
1111
|
+
className: "w-full flex items-center justify-between px-2 py-1.5 bg-[var(--widget-bg-secondary)] hover:bg-[var(--widget-bg-hover)] transition-colors",
|
|
1112
|
+
children: [
|
|
1113
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ t("span", { className: "text-sm font-medium text-text-primary", children: l.name }) }),
|
|
1114
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
1115
|
+
/* @__PURE__ */ t(
|
|
1116
|
+
M,
|
|
1117
|
+
{
|
|
1118
|
+
id: `workflow-${l.workflowId}`,
|
|
1119
|
+
checked: l.enabled,
|
|
1120
|
+
onChange: (u) => y(l.workflowId, u),
|
|
1121
|
+
disabled: a
|
|
1122
|
+
}
|
|
1123
|
+
),
|
|
1124
|
+
o[l.workflowId] ? /* @__PURE__ */ t(q, { className: "w-5 h-5 text-text-secondary" }) : /* @__PURE__ */ t(L, { className: "w-5 h-5 text-text-secondary" })
|
|
1125
|
+
] })
|
|
1126
|
+
]
|
|
1127
|
+
}
|
|
1128
|
+
),
|
|
1129
|
+
o[l.workflowId] && l.enabled && /* @__PURE__ */ i("div", { className: "px-2 pb-1.5 bg-widget-background divide-y divide-border-light", children: [
|
|
1130
|
+
/* @__PURE__ */ t(
|
|
1131
|
+
M,
|
|
1132
|
+
{
|
|
1133
|
+
id: `sub-${l.workflowId}-inapp`,
|
|
1134
|
+
label: "In-App",
|
|
1135
|
+
icon: p("inApp"),
|
|
1136
|
+
checked: l.channels.inApp,
|
|
1137
|
+
onChange: (u) => c(l.workflowId, "inApp", u),
|
|
1138
|
+
disabled: a
|
|
1139
|
+
}
|
|
1140
|
+
),
|
|
1141
|
+
/* @__PURE__ */ t(
|
|
1142
|
+
M,
|
|
1143
|
+
{
|
|
1144
|
+
id: `sub-${l.workflowId}-push`,
|
|
1145
|
+
label: "Push",
|
|
1146
|
+
icon: p("push"),
|
|
1147
|
+
checked: l.channels.push,
|
|
1148
|
+
onChange: (u) => c(l.workflowId, "push", u),
|
|
1149
|
+
disabled: a
|
|
1150
|
+
}
|
|
1151
|
+
)
|
|
1152
|
+
] })
|
|
1153
|
+
] }, l.workflowId))
|
|
1154
|
+
] })
|
|
1155
|
+
] });
|
|
1156
|
+
};
|
|
1157
|
+
class Q extends de {
|
|
1158
|
+
constructor(r) {
|
|
1159
|
+
super(r), this.state = {
|
|
1160
|
+
hasError: !1,
|
|
1161
|
+
error: null
|
|
1162
|
+
};
|
|
1163
|
+
}
|
|
1164
|
+
static getDerivedStateFromError(r) {
|
|
1165
|
+
return {
|
|
1166
|
+
hasError: !0,
|
|
1167
|
+
error: r
|
|
1168
|
+
};
|
|
1169
|
+
}
|
|
1170
|
+
componentDidCatch(r, a) {
|
|
1171
|
+
const { componentName: n = "Unknown Component", onError: s } = this.props;
|
|
1172
|
+
s && s(r, a);
|
|
1173
|
+
}
|
|
1174
|
+
render() {
|
|
1175
|
+
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ t(
|
|
1176
|
+
"div",
|
|
1177
|
+
{
|
|
1178
|
+
className: "p-2 text-sm text-gray-500 bg-gray-50 border border-gray-200 rounded",
|
|
1179
|
+
"data-testid": "component-error-fallback",
|
|
1180
|
+
children: /* @__PURE__ */ i("span", { children: [
|
|
1181
|
+
"Unable to load ",
|
|
1182
|
+
this.props.componentName || "component"
|
|
1183
|
+
] })
|
|
1184
|
+
}
|
|
1185
|
+
) : this.props.children;
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
const Le = ({ onRetry: e, error: r }) => /* @__PURE__ */ i(
|
|
1189
|
+
"div",
|
|
1190
|
+
{
|
|
1191
|
+
className: "p-3 text-center",
|
|
1192
|
+
"data-testid": "notifications-fallback",
|
|
1193
|
+
children: [
|
|
1194
|
+
/* @__PURE__ */ t("div", { className: "text-[var(--widget-text-tertiary)] mb-2", children: /* @__PURE__ */ t(D, { className: "w-12 h-12 mx-auto" }) }),
|
|
1195
|
+
/* @__PURE__ */ t(
|
|
1196
|
+
"p",
|
|
1197
|
+
{
|
|
1198
|
+
className: "text-sm text-[var(--widget-text-secondary)] mb-3",
|
|
1199
|
+
children: r ? "Failed to load notifications" : "No notifications available"
|
|
1200
|
+
}
|
|
1201
|
+
),
|
|
1202
|
+
e && /* @__PURE__ */ t(
|
|
1203
|
+
"button",
|
|
1204
|
+
{
|
|
1205
|
+
type: "button",
|
|
1206
|
+
className: "text-sm text-[var(--widget-primary)] hover:text-[var(--widget-primary-hover)] font-medium transition-colors",
|
|
1207
|
+
onClick: e,
|
|
1208
|
+
children: "Try again"
|
|
1209
|
+
}
|
|
1210
|
+
)
|
|
1211
|
+
]
|
|
1212
|
+
}
|
|
1213
|
+
), X = ({ onRetry: e, onBack: r }) => /* @__PURE__ */ i(
|
|
1214
|
+
"div",
|
|
1215
|
+
{
|
|
1216
|
+
className: "p-3 text-center",
|
|
1217
|
+
"data-testid": "preferences-fallback",
|
|
1218
|
+
children: [
|
|
1219
|
+
/* @__PURE__ */ t("div", { className: "text-[var(--widget-text-tertiary)] mb-2", children: /* @__PURE__ */ t(re, { className: "w-12 h-12 mx-auto" }) }),
|
|
1220
|
+
/* @__PURE__ */ t(
|
|
1221
|
+
"p",
|
|
1222
|
+
{
|
|
1223
|
+
className: "text-sm text-[var(--widget-text-secondary)] mb-3",
|
|
1224
|
+
children: "Unable to load preferences"
|
|
1225
|
+
}
|
|
1226
|
+
),
|
|
1227
|
+
/* @__PURE__ */ i("div", { className: "space-x-2", children: [
|
|
1228
|
+
e && /* @__PURE__ */ t(
|
|
1229
|
+
"button",
|
|
1230
|
+
{
|
|
1231
|
+
type: "button",
|
|
1232
|
+
className: "text-sm text-[var(--widget-primary)] hover:text-[var(--widget-primary-hover)] font-medium transition-colors",
|
|
1233
|
+
onClick: e,
|
|
1234
|
+
children: "Try again"
|
|
1235
|
+
}
|
|
1236
|
+
),
|
|
1237
|
+
r && /* @__PURE__ */ t(
|
|
1238
|
+
"button",
|
|
1239
|
+
{
|
|
1240
|
+
type: "button",
|
|
1241
|
+
className: "text-sm text-[var(--widget-text-secondary)] hover:text-[var(--widget-text)] font-medium transition-colors",
|
|
1242
|
+
onClick: r,
|
|
1243
|
+
children: "Back"
|
|
1244
|
+
}
|
|
1245
|
+
)
|
|
1246
|
+
] })
|
|
1247
|
+
]
|
|
1248
|
+
}
|
|
1249
|
+
), Ke = ({ onRetry: e, error: r }) => /* @__PURE__ */ i(
|
|
1250
|
+
"div",
|
|
1251
|
+
{
|
|
1252
|
+
className: "p-3 text-center bg-[var(--widget-warning)]/10 border border-[var(--widget-warning)]/20 rounded-lg",
|
|
1253
|
+
"data-testid": "sdk-connection-fallback",
|
|
1254
|
+
children: [
|
|
1255
|
+
/* @__PURE__ */ t("div", { className: "text-[var(--widget-warning)] mb-2", children: /* @__PURE__ */ t(ye, { className: "w-12 h-12 mx-auto" }) }),
|
|
1256
|
+
/* @__PURE__ */ t(
|
|
1257
|
+
"p",
|
|
1258
|
+
{
|
|
1259
|
+
className: "text-sm text-[var(--widget-warning)] mb-3 font-medium",
|
|
1260
|
+
children: "Connection to notification service failed"
|
|
1261
|
+
}
|
|
1262
|
+
),
|
|
1263
|
+
r && process.env.NODE_ENV === "development" && /* @__PURE__ */ t(
|
|
1264
|
+
"p",
|
|
1265
|
+
{
|
|
1266
|
+
className: "text-xs text-[var(--widget-warning)] mb-3 font-mono opacity-80",
|
|
1267
|
+
children: r
|
|
1268
|
+
}
|
|
1269
|
+
),
|
|
1270
|
+
e && /* @__PURE__ */ t(
|
|
1271
|
+
"button",
|
|
1272
|
+
{
|
|
1273
|
+
type: "button",
|
|
1274
|
+
className: "text-sm font-medium bg-[var(--widget-warning)]/20 text-[var(--widget-warning)] hover:bg-[var(--widget-warning)]/30 px-3 py-1 rounded transition-colors",
|
|
1275
|
+
onClick: e,
|
|
1276
|
+
children: "Retry connection"
|
|
1277
|
+
}
|
|
1278
|
+
)
|
|
1279
|
+
]
|
|
1280
|
+
}
|
|
1281
|
+
), qe = ({ message: e = "Loading..." }) => /* @__PURE__ */ i(
|
|
1282
|
+
"div",
|
|
1283
|
+
{
|
|
1284
|
+
className: "p-3 text-center",
|
|
1285
|
+
"data-testid": "loading-fallback",
|
|
1286
|
+
children: [
|
|
1287
|
+
/* @__PURE__ */ t("div", { className: "w-6 h-6 border-2 border-[var(--widget-primary)] border-t-transparent rounded-full animate-spin mx-auto mb-2" }),
|
|
1288
|
+
/* @__PURE__ */ t(
|
|
1289
|
+
"p",
|
|
1290
|
+
{
|
|
1291
|
+
className: "text-sm text-[var(--widget-text-secondary)]",
|
|
1292
|
+
children: e
|
|
1293
|
+
}
|
|
1294
|
+
)
|
|
1295
|
+
]
|
|
1296
|
+
}
|
|
1297
|
+
), Be = (e, r) => {
|
|
1298
|
+
switch (r) {
|
|
1299
|
+
case "all":
|
|
1300
|
+
return e;
|
|
1301
|
+
case "unread":
|
|
1302
|
+
return e.filter((a) => !a.isRead);
|
|
1303
|
+
default:
|
|
1304
|
+
if (r.startsWith("tag:")) {
|
|
1305
|
+
const a = r.substring(4);
|
|
1306
|
+
return e.filter(
|
|
1307
|
+
(n) => n.tags.includes(a)
|
|
1308
|
+
);
|
|
1309
|
+
}
|
|
1310
|
+
return e;
|
|
1311
|
+
}
|
|
1312
|
+
}, Pe = (e, r) => {
|
|
1313
|
+
if (!r.trim())
|
|
1314
|
+
return e;
|
|
1315
|
+
const a = r.toLowerCase().trim();
|
|
1316
|
+
return e.filter((n) => {
|
|
1317
|
+
const s = n.subject.toLowerCase(), o = n.body.toLowerCase(), m = n.tags.join(" ").toLowerCase();
|
|
1318
|
+
return s.includes(a) || o.includes(a) || m.includes(a);
|
|
1319
|
+
});
|
|
1320
|
+
}, Re = (e, r) => {
|
|
1321
|
+
const a = [...e];
|
|
1322
|
+
switch (r) {
|
|
1323
|
+
case "newest":
|
|
1324
|
+
return a.sort((n, s) => s.timestamp.getTime() - n.timestamp.getTime());
|
|
1325
|
+
case "oldest":
|
|
1326
|
+
return a.sort((n, s) => n.timestamp.getTime() - s.timestamp.getTime());
|
|
1327
|
+
case "unread-first":
|
|
1328
|
+
return a.sort((n, s) => n.isRead === s.isRead ? s.timestamp.getTime() - n.timestamp.getTime() : n.isRead ? 1 : -1);
|
|
1329
|
+
case "read-first":
|
|
1330
|
+
return a.sort((n, s) => n.isRead === s.isRead ? s.timestamp.getTime() - n.timestamp.getTime() : n.isRead ? -1 : 1);
|
|
1331
|
+
default:
|
|
1332
|
+
return a;
|
|
1333
|
+
}
|
|
1334
|
+
}, De = (e, r, a, n = "newest") => {
|
|
1335
|
+
let s = e;
|
|
1336
|
+
return s = Be(s, r), a && (s = Pe(s, a)), s = Re(s, n), s;
|
|
1337
|
+
}, Ge = ({
|
|
1338
|
+
isOpen: e,
|
|
1339
|
+
onClose: r,
|
|
1340
|
+
position: a,
|
|
1341
|
+
currentView: n,
|
|
1342
|
+
onViewChange: s,
|
|
1343
|
+
notifications: o,
|
|
1344
|
+
onNotificationAction: m,
|
|
1345
|
+
preferences: g,
|
|
1346
|
+
onPreferenceChange: f,
|
|
1347
|
+
isPreferencesLoading: d = !1,
|
|
1348
|
+
size: y = "medium"
|
|
1349
|
+
}) => {
|
|
1350
|
+
const c = j(null), b = j(null), [p, l] = k("all"), [u, h] = k([]), [v, V] = k(""), _ = S(() => {
|
|
1351
|
+
const x = window.__notificationSDK?.config, N = window.__notificationSDK?.client;
|
|
1352
|
+
if (!x || !N) return null;
|
|
1353
|
+
const { tenantId: C, environmentId: H, subscriberId: W } = x;
|
|
1354
|
+
return !C || !H || !W ? null : { client: N, tenantId: C, environmentId: H, subscriberId: W };
|
|
1355
|
+
}, []), se = S(async (x) => {
|
|
1356
|
+
const N = _();
|
|
1357
|
+
if (!N) return { success: !1, processedCount: 0, failedCount: x.length, errors: [] };
|
|
1358
|
+
try {
|
|
1359
|
+
for (const C of x)
|
|
1360
|
+
await N.client.inbox.markAsRead(C, N.tenantId, N.environmentId, N.subscriberId);
|
|
1361
|
+
return { success: !0, processedCount: x.length, failedCount: 0, errors: [] };
|
|
1362
|
+
} catch (C) {
|
|
1363
|
+
return { success: !1, processedCount: 0, failedCount: x.length, errors: [{ notificationId: "", error: C }] };
|
|
1364
|
+
}
|
|
1365
|
+
}, [_]), le = Z(() => De(o, p, v), [o, p, v]), A = S((x) => {
|
|
1366
|
+
c.current && !c.current.contains(x.target) && r();
|
|
1367
|
+
}, [r]), $ = S((x) => {
|
|
1368
|
+
x.key === "Escape" && r();
|
|
1369
|
+
}, [r]), O = S((x) => {
|
|
1370
|
+
if (!(!e || !c.current) && x.key === "Tab") {
|
|
1371
|
+
const N = c.current.querySelectorAll(
|
|
1372
|
+
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
1373
|
+
);
|
|
1374
|
+
if (N.length === 0) return;
|
|
1375
|
+
const C = N[0], H = N[N.length - 1];
|
|
1376
|
+
x.shiftKey ? document.activeElement === C && (H.focus(), x.preventDefault()) : document.activeElement === H && (C.focus(), x.preventDefault());
|
|
1377
|
+
}
|
|
1378
|
+
}, [e]);
|
|
1379
|
+
if (R(() => (e ? (b.current = document.activeElement, document.addEventListener("mousedown", A), document.addEventListener("keydown", $), document.addEventListener("keydown", O), setTimeout(() => {
|
|
1380
|
+
c.current?.querySelector(
|
|
1381
|
+
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
1382
|
+
)?.focus();
|
|
1383
|
+
}, 0)) : (b.current && b.current.focus(), l("all"), h([]), V("")), () => {
|
|
1384
|
+
document.removeEventListener("mousedown", A), document.removeEventListener("keydown", $), document.removeEventListener("keydown", O);
|
|
1385
|
+
}), [e, A, $, O]), !e) return null;
|
|
1386
|
+
const oe = {
|
|
1387
|
+
left: "left-0 origin-top-left",
|
|
1388
|
+
right: "right-0 origin-top-right"
|
|
1389
|
+
}, F = o.filter((x) => !x.isRead).length;
|
|
1390
|
+
return /* @__PURE__ */ i(E, { children: [
|
|
1391
|
+
/* @__PURE__ */ t(
|
|
1392
|
+
"div",
|
|
1393
|
+
{
|
|
1394
|
+
className: "fixed inset-0 bg-black/20 backdrop-blur-sm z-40 md:hidden transition-opacity duration-200",
|
|
1395
|
+
"aria-hidden": "true",
|
|
1396
|
+
onClick: r
|
|
1397
|
+
}
|
|
1398
|
+
),
|
|
1399
|
+
/* @__PURE__ */ i(
|
|
1400
|
+
"div",
|
|
1401
|
+
{
|
|
1402
|
+
ref: c,
|
|
1403
|
+
className: `
|
|
1404
|
+
absolute top-full mt-2 ${oe[a]}
|
|
1405
|
+
w-[var(--widget-popover-width,400px)] max-h-[var(--widget-popover-max-height,580px)]
|
|
1406
|
+
bg-widget-background border border-border rounded-2xl
|
|
1407
|
+
shadow-[var(--widget-shadow-xl)]
|
|
1408
|
+
z-50 flex flex-col
|
|
1409
|
+
animate-in fade-in-0 zoom-in-95 duration-200
|
|
1410
|
+
max-sm:fixed max-sm:inset-x-4 max-sm:top-16 max-sm:bottom-4
|
|
1411
|
+
max-sm:w-auto max-sm:max-w-none max-sm:max-h-[calc(100vh-120px)]
|
|
1412
|
+
`,
|
|
1413
|
+
role: "dialog",
|
|
1414
|
+
"aria-modal": "true",
|
|
1415
|
+
"aria-label": "Notifications",
|
|
1416
|
+
"data-testid": "inbox-popover",
|
|
1417
|
+
children: [
|
|
1418
|
+
/* @__PURE__ */ i("div", { className: "flex-shrink-0 flex items-center justify-between px-3 py-2 border-b border-border bg-widget-background", children: [
|
|
1419
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ t("h2", { className: "text-sm font-semibold text-[var(--widget-text)]", children: n === "notifications" ? "Notifications" : "Preferences" }) }),
|
|
1420
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: [
|
|
1421
|
+
n === "notifications" && /* @__PURE__ */ t(
|
|
1422
|
+
"button",
|
|
1423
|
+
{
|
|
1424
|
+
type: "button",
|
|
1425
|
+
className: "inline-flex items-center justify-center w-6 h-6 rounded-lg text-[var(--widget-text-secondary)] hover:text-[var(--widget-text)] hover:bg-[var(--widget-bg-hover)] transition-colors",
|
|
1426
|
+
onClick: () => s("preferences"),
|
|
1427
|
+
"aria-label": "Open preferences",
|
|
1428
|
+
"data-testid": "preferences-button",
|
|
1429
|
+
children: /* @__PURE__ */ t(re, { className: "w-4 h-4" })
|
|
1430
|
+
}
|
|
1431
|
+
),
|
|
1432
|
+
n === "preferences" && /* @__PURE__ */ t(
|
|
1433
|
+
"button",
|
|
1434
|
+
{
|
|
1435
|
+
type: "button",
|
|
1436
|
+
className: "inline-flex items-center justify-center w-6 h-6 rounded-lg text-[var(--widget-text-secondary)] hover:text-[var(--widget-text)] hover:bg-[var(--widget-bg-hover)] transition-colors",
|
|
1437
|
+
onClick: () => s("notifications"),
|
|
1438
|
+
"aria-label": "Back to notifications",
|
|
1439
|
+
"data-testid": "back-button",
|
|
1440
|
+
children: /* @__PURE__ */ t(ze, { className: "w-5 h-5" })
|
|
1441
|
+
}
|
|
1442
|
+
),
|
|
1443
|
+
/* @__PURE__ */ t(
|
|
1444
|
+
"button",
|
|
1445
|
+
{
|
|
1446
|
+
type: "button",
|
|
1447
|
+
className: "inline-flex items-center justify-center w-6 h-6 rounded-lg text-[var(--widget-text-secondary)] hover:text-[var(--widget-text)] hover:bg-[var(--widget-bg-hover)] transition-colors",
|
|
1448
|
+
onClick: r,
|
|
1449
|
+
"aria-label": "Close notifications",
|
|
1450
|
+
"data-testid": "close-button",
|
|
1451
|
+
children: /* @__PURE__ */ t(ne, { className: "w-5 h-5" })
|
|
1452
|
+
}
|
|
1453
|
+
)
|
|
1454
|
+
] })
|
|
1455
|
+
] }),
|
|
1456
|
+
n === "notifications" ? /* @__PURE__ */ i(E, { children: [
|
|
1457
|
+
/* @__PURE__ */ t("div", { className: "flex-shrink-0 px-3 py-2 border-b border-border bg-widget-background", children: /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
1458
|
+
/* @__PURE__ */ t("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none", children: /* @__PURE__ */ t(we, { className: "w-5 h-5 text-[var(--widget-text-tertiary)]" }) }),
|
|
1459
|
+
/* @__PURE__ */ t(
|
|
1460
|
+
"input",
|
|
1461
|
+
{
|
|
1462
|
+
type: "text",
|
|
1463
|
+
className: `\r
|
|
1464
|
+
w-full pl-10 pr-3 py-1 \r
|
|
1465
|
+
bg-[var(--widget-bg-secondary)] \r
|
|
1466
|
+
border border-[var(--widget-border)] \r
|
|
1467
|
+
rounded-lg \r
|
|
1468
|
+
text-sm text-[var(--widget-text)] \r
|
|
1469
|
+
placeholder:text-[var(--widget-text-tertiary)]\r
|
|
1470
|
+
focus:outline-none focus:ring-2 focus:ring-[var(--widget-primary)] focus:border-transparent\r
|
|
1471
|
+
transition-colors\r
|
|
1472
|
+
`,
|
|
1473
|
+
placeholder: "Search notifications...",
|
|
1474
|
+
value: v,
|
|
1475
|
+
onChange: (x) => V(x.target.value),
|
|
1476
|
+
"aria-label": "Search notifications"
|
|
1477
|
+
}
|
|
1478
|
+
)
|
|
1479
|
+
] }) }),
|
|
1480
|
+
/* @__PURE__ */ t(
|
|
1481
|
+
Ae,
|
|
1482
|
+
{
|
|
1483
|
+
notifications: o,
|
|
1484
|
+
activeTab: p,
|
|
1485
|
+
onTabChange: (x) => l(x),
|
|
1486
|
+
size: y
|
|
1487
|
+
}
|
|
1488
|
+
),
|
|
1489
|
+
/* @__PURE__ */ t("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ t(Q, { fallback: /* @__PURE__ */ t(Le, {}), children: /* @__PURE__ */ t(
|
|
1490
|
+
Ie,
|
|
1491
|
+
{
|
|
1492
|
+
notifications: le,
|
|
1493
|
+
onNotificationAction: m
|
|
1494
|
+
}
|
|
1495
|
+
) }) }),
|
|
1496
|
+
F > 0 && /* @__PURE__ */ t("div", { className: "flex-shrink-0 px-3 py-2 border-t border-border bg-widget-hover", children: /* @__PURE__ */ t(
|
|
1497
|
+
"button",
|
|
1498
|
+
{
|
|
1499
|
+
type: "button",
|
|
1500
|
+
className: "w-full px-4 py-2 text-sm font-medium text-[var(--widget-primary)] hover:text-[var(--widget-primary-hover)] hover:bg-[var(--widget-primary-light)] rounded-lg transition-colors",
|
|
1501
|
+
onClick: () => {
|
|
1502
|
+
const x = o.filter((N) => !N.isRead).map((N) => N.id);
|
|
1503
|
+
se(x);
|
|
1504
|
+
},
|
|
1505
|
+
"aria-label": `Mark all ${F} notifications as read`,
|
|
1506
|
+
children: "Mark all as read"
|
|
1507
|
+
}
|
|
1508
|
+
) })
|
|
1509
|
+
] }) : /* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto widget-scrollbar", children: /* @__PURE__ */ t(Q, { fallback: /* @__PURE__ */ t(X, {}), children: g && f ? /* @__PURE__ */ t(
|
|
1510
|
+
Oe,
|
|
1511
|
+
{
|
|
1512
|
+
preferences: g,
|
|
1513
|
+
onPreferenceChange: f,
|
|
1514
|
+
isLoading: d,
|
|
1515
|
+
onBack: () => s("notifications")
|
|
1516
|
+
}
|
|
1517
|
+
) : /* @__PURE__ */ t(X, {}) }) })
|
|
1518
|
+
]
|
|
1519
|
+
}
|
|
1520
|
+
)
|
|
1521
|
+
] });
|
|
1522
|
+
};
|
|
1523
|
+
export {
|
|
1524
|
+
Fe as B,
|
|
1525
|
+
Q as C,
|
|
1526
|
+
Ge as I,
|
|
1527
|
+
qe as L,
|
|
1528
|
+
We as M,
|
|
1529
|
+
Ee as N,
|
|
1530
|
+
Oe as P,
|
|
1531
|
+
Ke as S,
|
|
1532
|
+
Ue as a
|
|
1533
|
+
};
|
|
1534
|
+
//# sourceMappingURL=components-BJ465mfK.js.map
|