@edusight/notification-widget 1.0.28 → 1.0.30
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/dist/components-B9Z6HsnI.cjs +70 -0
- package/dist/{components-ytSNU0U3.cjs.map → components-B9Z6HsnI.cjs.map} +1 -1
- package/dist/{components-BJ465mfK.js → components-DgV3nlCC.js} +214 -199
- package/dist/{components-BJ465mfK.js.map → components-DgV3nlCC.js.map} +1 -1
- package/dist/hooks-CggRWw6Q.cjs +2 -0
- package/dist/hooks-CggRWw6Q.cjs.map +1 -0
- package/dist/hooks-Cv5k48VE.js +159 -0
- package/dist/hooks-Cv5k48VE.js.map +1 -0
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +241 -177
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
- package/dist/components-ytSNU0U3.cjs +0 -72
- package/dist/hooks-CACL0Qzv.cjs +0 -2
- package/dist/hooks-CACL0Qzv.cjs.map +0 -1
- package/dist/hooks-DQflK_dw.js +0 -160
- package/dist/hooks-DQflK_dw.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import z, { useState as k, useRef as j, useEffect as
|
|
1
|
+
import z, { useState as k, useRef as j, useEffect as D, useCallback as S, useMemo as Z, Component as de } from "react";
|
|
2
2
|
import { jsxs as i, jsx as t, Fragment as E } from "react/jsx-runtime";
|
|
3
3
|
var ee = {
|
|
4
4
|
color: void 0,
|
|
@@ -91,13 +91,13 @@ function pe(e) {
|
|
|
91
91
|
attr: n,
|
|
92
92
|
size: s,
|
|
93
93
|
title: o
|
|
94
|
-
} = e,
|
|
95
|
-
return a.className && (
|
|
94
|
+
} = e, h = ue(e, ce), g = s || a.size || "1em", m;
|
|
95
|
+
return a.className && (m = a.className), e.className && (m = (m ? m + " " : "") + e.className), /* @__PURE__ */ z.createElement("svg", T({
|
|
96
96
|
stroke: "currentColor",
|
|
97
97
|
fill: "currentColor",
|
|
98
98
|
strokeWidth: "0"
|
|
99
|
-
}, a.attr, n,
|
|
100
|
-
className:
|
|
99
|
+
}, a.attr, n, h, {
|
|
100
|
+
className: m,
|
|
101
101
|
style: I(I({
|
|
102
102
|
color: e.color || a.color
|
|
103
103
|
}, a.style), e.style),
|
|
@@ -118,9 +118,9 @@ const Fe = ({
|
|
|
118
118
|
className: n = "",
|
|
119
119
|
disabled: s = !1
|
|
120
120
|
}) => {
|
|
121
|
-
const o = (d) => d === 0 ? "" : d > 99 ? "99+" : d.toString(),
|
|
121
|
+
const o = (d) => d === 0 ? "" : d > 99 ? "99+" : d.toString(), h = (d) => {
|
|
122
122
|
s || (d.key === "Enter" || d.key === " ") && (d.preventDefault(), r());
|
|
123
|
-
}, g = o(e),
|
|
123
|
+
}, g = o(e), m = e > 0;
|
|
124
124
|
return /* @__PURE__ */ i(
|
|
125
125
|
"button",
|
|
126
126
|
{
|
|
@@ -138,38 +138,42 @@ const Fe = ({
|
|
|
138
138
|
${n}
|
|
139
139
|
`,
|
|
140
140
|
onClick: r,
|
|
141
|
-
onKeyDown:
|
|
141
|
+
onKeyDown: h,
|
|
142
142
|
disabled: s,
|
|
143
|
-
"aria-label":
|
|
143
|
+
"aria-label": m ? `Notifications (${e} unread)` : "Notifications",
|
|
144
144
|
"aria-expanded": !1,
|
|
145
145
|
"aria-haspopup": "dialog",
|
|
146
146
|
"data-testid": "bell-component",
|
|
147
147
|
children: [
|
|
148
|
-
/* @__PURE__ */
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
148
|
+
/* @__PURE__ */ i("div", { className: "relative inline-flex items-center justify-center", children: [
|
|
149
|
+
/* @__PURE__ */ t(ve, { className: "w-6 h-6" }),
|
|
150
|
+
m && /* @__PURE__ */ t(
|
|
151
|
+
"span",
|
|
152
|
+
{
|
|
153
|
+
className: `\r
|
|
154
|
+
absolute\r
|
|
155
|
+
flex items-center justify-center\r
|
|
156
|
+
w-[16px] h-[16px]\r
|
|
157
|
+
text-[10px] font-bold leading-none\r
|
|
158
|
+
text-white bg-red-500\r
|
|
159
|
+
rounded-full\r
|
|
160
|
+
border border-white dark:border-gray-900\r
|
|
161
|
+
shadow-sm\r
|
|
162
|
+
pointer-events-none\r
|
|
163
|
+
`,
|
|
164
|
+
"aria-hidden": "true",
|
|
165
|
+
"data-testid": "unread-badge",
|
|
166
|
+
style: { marginTop: "-25px", marginRight: "-25px" },
|
|
167
|
+
children: g
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
] }),
|
|
171
|
+
/* @__PURE__ */ t("span", { className: "sr-only", children: m ? `${e} unread notifications` : "No unread notifications" })
|
|
168
172
|
]
|
|
169
173
|
}
|
|
170
174
|
);
|
|
171
175
|
};
|
|
172
|
-
function
|
|
176
|
+
function V(e) {
|
|
173
177
|
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
178
|
}
|
|
175
179
|
function be(e) {
|
|
@@ -214,7 +218,7 @@ function ne(e) {
|
|
|
214
218
|
function q(e) {
|
|
215
219
|
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
220
|
}
|
|
217
|
-
function
|
|
221
|
+
function B(e) {
|
|
218
222
|
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
223
|
}
|
|
220
224
|
function Ue(e) {
|
|
@@ -232,39 +236,39 @@ function je(e) {
|
|
|
232
236
|
function ie(e) {
|
|
233
237
|
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
238
|
}
|
|
235
|
-
const
|
|
239
|
+
const P = ({
|
|
236
240
|
content: e,
|
|
237
241
|
children: r,
|
|
238
242
|
position: a = "top",
|
|
239
243
|
delay: n = 200
|
|
240
244
|
}) => {
|
|
241
|
-
const [s, o] = k(!1), [
|
|
242
|
-
|
|
245
|
+
const [s, o] = k(!1), [h, g] = k({ x: 0, y: 0 }), m = j(null), d = j(null), y = () => {
|
|
246
|
+
m.current && clearTimeout(m.current), m.current = setTimeout(() => {
|
|
243
247
|
if (d.current) {
|
|
244
|
-
const
|
|
248
|
+
const v = d.current.getBoundingClientRect();
|
|
245
249
|
let l = 0, u = 0;
|
|
246
250
|
switch (a) {
|
|
247
251
|
case "top":
|
|
248
|
-
l =
|
|
252
|
+
l = v.left + v.width / 2, u = v.top - 8;
|
|
249
253
|
break;
|
|
250
254
|
case "bottom":
|
|
251
|
-
l =
|
|
255
|
+
l = v.left + v.width / 2, u = v.bottom + 8;
|
|
252
256
|
break;
|
|
253
257
|
case "left":
|
|
254
|
-
l =
|
|
258
|
+
l = v.left - 8, u = v.top + v.height / 2;
|
|
255
259
|
break;
|
|
256
260
|
case "right":
|
|
257
|
-
l =
|
|
261
|
+
l = v.right + 8, u = v.top + v.height / 2;
|
|
258
262
|
break;
|
|
259
263
|
}
|
|
260
264
|
g({ x: l, y: u }), o(!0);
|
|
261
265
|
}
|
|
262
266
|
}, n);
|
|
263
267
|
}, c = () => {
|
|
264
|
-
|
|
268
|
+
m.current && clearTimeout(m.current), o(!1);
|
|
265
269
|
};
|
|
266
|
-
return
|
|
267
|
-
|
|
270
|
+
return D(() => () => {
|
|
271
|
+
m.current && clearTimeout(m.current);
|
|
268
272
|
}, []), /* @__PURE__ */ i(E, { children: [
|
|
269
273
|
/* @__PURE__ */ t(
|
|
270
274
|
"div",
|
|
@@ -291,8 +295,8 @@ const B = ({
|
|
|
291
295
|
animate-in fade-in-0 zoom-in-95 duration-200
|
|
292
296
|
`,
|
|
293
297
|
style: {
|
|
294
|
-
left: `${
|
|
295
|
-
top: `${
|
|
298
|
+
left: `${h.x}px`,
|
|
299
|
+
top: `${h.y}px`
|
|
296
300
|
},
|
|
297
301
|
children: e
|
|
298
302
|
}
|
|
@@ -300,13 +304,13 @@ const B = ({
|
|
|
300
304
|
] });
|
|
301
305
|
}, He = (e) => {
|
|
302
306
|
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),
|
|
304
|
-
return s < 1 ? "Just now" : s < 60 ? `${s}m ago` : o < 24 ? `${o}h ago` :
|
|
305
|
-
},
|
|
307
|
+
const n = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), s = Math.floor(n / 6e4), o = Math.floor(n / 36e5), h = Math.floor(n / 864e5);
|
|
308
|
+
return s < 1 ? "Just now" : s < 60 ? `${s}m ago` : o < 24 ? `${o}h ago` : h < 7 ? `${h}d ago` : e.toLocaleDateString();
|
|
309
|
+
}, R = ({ type: e, className: r }) => {
|
|
306
310
|
const a = r || "w-4 h-4";
|
|
307
311
|
switch (e) {
|
|
308
312
|
case "mark_read":
|
|
309
|
-
return /* @__PURE__ */ t(
|
|
313
|
+
return /* @__PURE__ */ t(V, { className: a });
|
|
310
314
|
case "snooze":
|
|
311
315
|
return /* @__PURE__ */ t(ke, { className: a });
|
|
312
316
|
case "archive":
|
|
@@ -320,8 +324,8 @@ const B = ({
|
|
|
320
324
|
onSelectionChange: a,
|
|
321
325
|
isSelected: n = !1
|
|
322
326
|
}) => {
|
|
323
|
-
const [s, o] = k(!1),
|
|
324
|
-
r && r(c), o(!1);
|
|
327
|
+
const [s, o] = k(!1), h = Number.isNaN(e.timestamp.getTime()), g = h ? void 0 : e.timestamp.toISOString(), m = He(e.timestamp), d = (c) => {
|
|
328
|
+
r && r(e.id, c), o(!1);
|
|
325
329
|
}, y = () => {
|
|
326
330
|
a && a(!n);
|
|
327
331
|
};
|
|
@@ -368,8 +372,8 @@ const B = ({
|
|
|
368
372
|
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
373
|
"button",
|
|
370
374
|
{
|
|
371
|
-
onClick: (
|
|
372
|
-
|
|
375
|
+
onClick: (v) => {
|
|
376
|
+
v.stopPropagation(), d(c);
|
|
373
377
|
},
|
|
374
378
|
className: `
|
|
375
379
|
px-3 py-1.5 rounded-md text-sm font-medium transition-colors
|
|
@@ -380,41 +384,41 @@ const B = ({
|
|
|
380
384
|
b
|
|
381
385
|
)) }),
|
|
382
386
|
/* @__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:
|
|
387
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ t("time", { className: "text-xs text-[var(--widget-text-tertiary)]", dateTime: g, children: m }) }),
|
|
384
388
|
/* @__PURE__ */ i(
|
|
385
389
|
"div",
|
|
386
390
|
{
|
|
387
391
|
className: `flex items-center gap-1 transition-opacity duration-200 ${s ? "opacity-100" : "opacity-0"}`,
|
|
388
392
|
onClick: (c) => c.stopPropagation(),
|
|
389
393
|
children: [
|
|
390
|
-
/* @__PURE__ */ t(
|
|
394
|
+
/* @__PURE__ */ t(P, { content: "Mark as read", position: "top", children: /* @__PURE__ */ t(
|
|
391
395
|
"button",
|
|
392
396
|
{
|
|
393
397
|
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
398
|
onClick: () => d({ type: "mark_read", label: "Mark as read", handler: async () => {
|
|
395
399
|
} }),
|
|
396
400
|
"aria-label": "Mark as read",
|
|
397
|
-
children: /* @__PURE__ */ t(
|
|
401
|
+
children: /* @__PURE__ */ t(R, { type: "mark_read" })
|
|
398
402
|
}
|
|
399
403
|
) }),
|
|
400
|
-
/* @__PURE__ */ t(
|
|
404
|
+
/* @__PURE__ */ t(P, { content: "Snooze", position: "top", children: /* @__PURE__ */ t(
|
|
401
405
|
"button",
|
|
402
406
|
{
|
|
403
407
|
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
408
|
onClick: () => d({ type: "custom", label: "Snooze", handler: async () => {
|
|
405
409
|
} }),
|
|
406
410
|
"aria-label": "Snooze",
|
|
407
|
-
children: /* @__PURE__ */ t(
|
|
411
|
+
children: /* @__PURE__ */ t(R, { type: "snooze" })
|
|
408
412
|
}
|
|
409
413
|
) }),
|
|
410
|
-
/* @__PURE__ */ t(
|
|
414
|
+
/* @__PURE__ */ t(P, { content: "Archive", position: "top", children: /* @__PURE__ */ t(
|
|
411
415
|
"button",
|
|
412
416
|
{
|
|
413
417
|
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
418
|
onClick: () => d({ type: "archive", label: "Archive", handler: async () => {
|
|
415
419
|
} }),
|
|
416
420
|
"aria-label": "Archive",
|
|
417
|
-
children: /* @__PURE__ */ t(
|
|
421
|
+
children: /* @__PURE__ */ t(R, { type: "archive" })
|
|
418
422
|
}
|
|
419
423
|
) })
|
|
420
424
|
]
|
|
@@ -424,7 +428,7 @@ const B = ({
|
|
|
424
428
|
] }),
|
|
425
429
|
/* @__PURE__ */ i("div", { className: "sr-only", children: [
|
|
426
430
|
"Notification from ",
|
|
427
|
-
|
|
431
|
+
h ? "Unknown time" : e.timestamp.toLocaleString(),
|
|
428
432
|
".",
|
|
429
433
|
e.isRead ? "Read" : "Unread",
|
|
430
434
|
".",
|
|
@@ -457,9 +461,8 @@ const B = ({
|
|
|
457
461
|
description: r = "There are no items to display",
|
|
458
462
|
icon: a
|
|
459
463
|
}) => /* @__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("
|
|
462
|
-
/* @__PURE__ */ t("p", { className: "text-sm text-text-secondary text-center", children: r })
|
|
464
|
+
a && /* @__PURE__ */ t("div", { className: "mb-4 text-gray-300", children: a }),
|
|
465
|
+
/* @__PURE__ */ t("p", { className: "text-sm text-text-gray-300 text-center", children: r })
|
|
463
466
|
] }), Te = ({
|
|
464
467
|
selectedNotifications: e,
|
|
465
468
|
onMarkAllAsRead: r,
|
|
@@ -467,13 +470,13 @@ const B = ({
|
|
|
467
470
|
onArchiveAll: n,
|
|
468
471
|
onDeleteAll: s,
|
|
469
472
|
onClearSelection: o,
|
|
470
|
-
className:
|
|
473
|
+
className: h = ""
|
|
471
474
|
}) => {
|
|
472
|
-
const [g,
|
|
475
|
+
const [g, m] = k(!1), [d, y] = k(null), c = e.length, b = async (v, l) => {
|
|
473
476
|
if (c !== 0) {
|
|
474
|
-
|
|
477
|
+
m(!0), y(null);
|
|
475
478
|
try {
|
|
476
|
-
const u = await
|
|
479
|
+
const u = await v(e);
|
|
477
480
|
y(u), u.success && o();
|
|
478
481
|
} catch (u) {
|
|
479
482
|
y({
|
|
@@ -483,14 +486,14 @@ const B = ({
|
|
|
483
486
|
errors: [{ notificationId: "", error: u }]
|
|
484
487
|
});
|
|
485
488
|
} finally {
|
|
486
|
-
|
|
489
|
+
m(!1);
|
|
487
490
|
}
|
|
488
491
|
}
|
|
489
492
|
};
|
|
490
493
|
return c === 0 ? null : /* @__PURE__ */ i(
|
|
491
494
|
"div",
|
|
492
495
|
{
|
|
493
|
-
className: `border-t border-border bg-widget-primary-light p-2 ${
|
|
496
|
+
className: `border-t border-border bg-widget-primary-light p-2 ${h}`,
|
|
494
497
|
children: [
|
|
495
498
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
496
499
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
@@ -527,7 +530,7 @@ const B = ({
|
|
|
527
530
|
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
531
|
"data-testid": "bulk-mark-read",
|
|
529
532
|
children: [
|
|
530
|
-
/* @__PURE__ */ t(
|
|
533
|
+
/* @__PURE__ */ t(V, { className: "mr-1 w-4 h-4" }),
|
|
531
534
|
"Mark Read"
|
|
532
535
|
]
|
|
533
536
|
}
|
|
@@ -638,17 +641,17 @@ const B = ({
|
|
|
638
641
|
onNotificationAction: n,
|
|
639
642
|
selectedNotifications: s = [],
|
|
640
643
|
onSelectionChange: o,
|
|
641
|
-
onSelectAll:
|
|
644
|
+
onSelectAll: h,
|
|
642
645
|
onLoadMore: g,
|
|
643
|
-
hasMore:
|
|
646
|
+
hasMore: m = !1,
|
|
644
647
|
className: d = ""
|
|
645
648
|
}) => {
|
|
646
|
-
const y = j(null), c = j(null), [b,
|
|
647
|
-
|
|
648
|
-
if (!(!g || !
|
|
649
|
+
const y = j(null), c = j(null), [b, v] = k(!1);
|
|
650
|
+
D(() => {
|
|
651
|
+
if (!(!g || !m || b))
|
|
649
652
|
return y.current = new IntersectionObserver(
|
|
650
|
-
(
|
|
651
|
-
|
|
653
|
+
(f) => {
|
|
654
|
+
f[0].isIntersecting && m && !b && (v(!0), g(), setTimeout(() => v(!1), 500));
|
|
652
655
|
},
|
|
653
656
|
{
|
|
654
657
|
root: null,
|
|
@@ -658,14 +661,14 @@ const B = ({
|
|
|
658
661
|
), c.current && y.current.observe(c.current), () => {
|
|
659
662
|
y.current && y.current.disconnect();
|
|
660
663
|
};
|
|
661
|
-
}, [g,
|
|
662
|
-
const l = S(async (
|
|
664
|
+
}, [g, m, b]);
|
|
665
|
+
const l = S(async (f, p) => {
|
|
663
666
|
try {
|
|
664
|
-
|
|
667
|
+
p.handler && await p.handler(f), n && p.type && n(f, p);
|
|
665
668
|
} catch {
|
|
666
669
|
}
|
|
667
|
-
}, [n]), u = S((
|
|
668
|
-
o && o(
|
|
670
|
+
}, [n]), u = S((f, p) => {
|
|
671
|
+
o && o(f, p);
|
|
669
672
|
}, [o]);
|
|
670
673
|
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
674
|
J,
|
|
@@ -716,105 +719,105 @@ const B = ({
|
|
|
716
719
|
)
|
|
717
720
|
}
|
|
718
721
|
) }) }) : /* @__PURE__ */ i("div", { className: `flex flex-col h-full ${d}`, children: [
|
|
719
|
-
|
|
722
|
+
h && n && /* @__PURE__ */ t(
|
|
720
723
|
Te,
|
|
721
724
|
{
|
|
722
725
|
selectedNotifications: s,
|
|
723
|
-
onMarkAllAsRead: async (
|
|
726
|
+
onMarkAllAsRead: async (f) => {
|
|
724
727
|
try {
|
|
725
|
-
for (const
|
|
726
|
-
n(
|
|
728
|
+
for (const p of f)
|
|
729
|
+
n(p, { type: "mark_read", label: "Mark as read", handler: async () => {
|
|
727
730
|
} });
|
|
728
731
|
return {
|
|
729
732
|
success: !0,
|
|
730
|
-
processedCount:
|
|
733
|
+
processedCount: f.length,
|
|
731
734
|
failedCount: 0,
|
|
732
735
|
errors: []
|
|
733
736
|
};
|
|
734
|
-
} catch (
|
|
737
|
+
} catch (p) {
|
|
735
738
|
return {
|
|
736
739
|
success: !1,
|
|
737
740
|
processedCount: 0,
|
|
738
|
-
failedCount:
|
|
739
|
-
errors: [{ notificationId: "", error:
|
|
741
|
+
failedCount: f.length,
|
|
742
|
+
errors: [{ notificationId: "", error: p }]
|
|
740
743
|
};
|
|
741
744
|
}
|
|
742
745
|
},
|
|
743
|
-
onMarkAllAsUnread: async (
|
|
746
|
+
onMarkAllAsUnread: async (f) => {
|
|
744
747
|
try {
|
|
745
|
-
for (const
|
|
746
|
-
n(
|
|
748
|
+
for (const p of f)
|
|
749
|
+
n(p, { type: "mark_unread", label: "Mark as unread", handler: async () => {
|
|
747
750
|
} });
|
|
748
751
|
return {
|
|
749
752
|
success: !0,
|
|
750
|
-
processedCount:
|
|
753
|
+
processedCount: f.length,
|
|
751
754
|
failedCount: 0,
|
|
752
755
|
errors: []
|
|
753
756
|
};
|
|
754
|
-
} catch (
|
|
757
|
+
} catch (p) {
|
|
755
758
|
return {
|
|
756
759
|
success: !1,
|
|
757
760
|
processedCount: 0,
|
|
758
|
-
failedCount:
|
|
759
|
-
errors: [{ notificationId: "", error:
|
|
761
|
+
failedCount: f.length,
|
|
762
|
+
errors: [{ notificationId: "", error: p }]
|
|
760
763
|
};
|
|
761
764
|
}
|
|
762
765
|
},
|
|
763
|
-
onArchiveAll: async (
|
|
766
|
+
onArchiveAll: async (f) => {
|
|
764
767
|
try {
|
|
765
|
-
for (const
|
|
766
|
-
n(
|
|
768
|
+
for (const p of f)
|
|
769
|
+
n(p, { type: "archive", label: "Archive", handler: async () => {
|
|
767
770
|
} });
|
|
768
771
|
return {
|
|
769
772
|
success: !0,
|
|
770
|
-
processedCount:
|
|
773
|
+
processedCount: f.length,
|
|
771
774
|
failedCount: 0,
|
|
772
775
|
errors: []
|
|
773
776
|
};
|
|
774
|
-
} catch (
|
|
777
|
+
} catch (p) {
|
|
775
778
|
return {
|
|
776
779
|
success: !1,
|
|
777
780
|
processedCount: 0,
|
|
778
|
-
failedCount:
|
|
779
|
-
errors: [{ notificationId: "", error:
|
|
781
|
+
failedCount: f.length,
|
|
782
|
+
errors: [{ notificationId: "", error: p }]
|
|
780
783
|
};
|
|
781
784
|
}
|
|
782
785
|
},
|
|
783
|
-
onDeleteAll: async (
|
|
786
|
+
onDeleteAll: async (f) => {
|
|
784
787
|
try {
|
|
785
|
-
for (const
|
|
786
|
-
n(
|
|
788
|
+
for (const p of f)
|
|
789
|
+
n(p, { type: "delete", label: "Delete", handler: async () => {
|
|
787
790
|
} });
|
|
788
791
|
return {
|
|
789
792
|
success: !0,
|
|
790
|
-
processedCount:
|
|
793
|
+
processedCount: f.length,
|
|
791
794
|
failedCount: 0,
|
|
792
795
|
errors: []
|
|
793
796
|
};
|
|
794
|
-
} catch (
|
|
797
|
+
} catch (p) {
|
|
795
798
|
return {
|
|
796
799
|
success: !1,
|
|
797
800
|
processedCount: 0,
|
|
798
|
-
failedCount:
|
|
799
|
-
errors: [{ notificationId: "", error:
|
|
801
|
+
failedCount: f.length,
|
|
802
|
+
errors: [{ notificationId: "", error: p }]
|
|
800
803
|
};
|
|
801
804
|
}
|
|
802
805
|
},
|
|
803
|
-
onClearSelection: () =>
|
|
806
|
+
onClearSelection: () => h(!1)
|
|
804
807
|
}
|
|
805
808
|
),
|
|
806
|
-
/* @__PURE__ */ t("div", { className: "flex-1
|
|
807
|
-
e.map((
|
|
809
|
+
/* @__PURE__ */ t("div", { className: "flex-1", children: /* @__PURE__ */ i("div", { children: [
|
|
810
|
+
e.map((f) => /* @__PURE__ */ t(
|
|
808
811
|
Ee,
|
|
809
812
|
{
|
|
810
|
-
notification:
|
|
813
|
+
notification: f,
|
|
811
814
|
onActionClick: l,
|
|
812
|
-
isSelected: s.includes(
|
|
813
|
-
onSelectionChange: o ? (
|
|
815
|
+
isSelected: s.includes(f.id),
|
|
816
|
+
onSelectionChange: o ? (p) => u(f.id, p) : void 0
|
|
814
817
|
},
|
|
815
|
-
|
|
818
|
+
f.id
|
|
816
819
|
)),
|
|
817
|
-
|
|
820
|
+
m && /* @__PURE__ */ t("div", { ref: c, className: "py-2", children: b && /* @__PURE__ */ t(Y, { count: 3 }) })
|
|
818
821
|
] }) })
|
|
819
822
|
] });
|
|
820
823
|
}, Ae = ({
|
|
@@ -825,17 +828,17 @@ const B = ({
|
|
|
825
828
|
className: s = ""
|
|
826
829
|
}) => {
|
|
827
830
|
const o = Z(() => {
|
|
828
|
-
const
|
|
831
|
+
const h = e.length, g = e.filter((c) => !c.isRead).length, m = /* @__PURE__ */ new Map();
|
|
829
832
|
e.forEach((c) => {
|
|
830
833
|
c.tags.forEach((b) => {
|
|
831
|
-
|
|
834
|
+
m.set(b, (m.get(b) || 0) + 1);
|
|
832
835
|
});
|
|
833
836
|
});
|
|
834
837
|
const d = [
|
|
835
838
|
{
|
|
836
839
|
id: "all",
|
|
837
840
|
label: "All",
|
|
838
|
-
count:
|
|
841
|
+
count: h,
|
|
839
842
|
icon: /* @__PURE__ */ t(je, { className: "w-4 h-4" })
|
|
840
843
|
},
|
|
841
844
|
{
|
|
@@ -844,7 +847,7 @@ const B = ({
|
|
|
844
847
|
count: g,
|
|
845
848
|
icon: /* @__PURE__ */ t(ie, { className: "w-4 h-4" })
|
|
846
849
|
}
|
|
847
|
-
], y = Array.from(
|
|
850
|
+
], y = Array.from(m.entries()).sort(([, c], [, b]) => b - c).slice(0, 5).map(([c, b]) => ({
|
|
848
851
|
id: `tag:${c}`,
|
|
849
852
|
label: c,
|
|
850
853
|
count: b,
|
|
@@ -856,39 +859,50 @@ const B = ({
|
|
|
856
859
|
"div",
|
|
857
860
|
{
|
|
858
861
|
className: `
|
|
859
|
-
flex items-center gap-1 overflow-x-auto widget-scrollbar border-b border-[var(--widget-border)]
|
|
862
|
+
flex items-center gap-1 overflow-x-auto widget-scrollbar border-b border-[var(--widget-border)] px-2 py-1.5
|
|
860
863
|
${s}
|
|
861
864
|
`,
|
|
865
|
+
style: { backgroundColor: "var(--widget-background)" },
|
|
862
866
|
role: "tablist",
|
|
863
|
-
children: o.map((
|
|
864
|
-
const g = r ===
|
|
867
|
+
children: o.map((h) => {
|
|
868
|
+
const g = r === h.id;
|
|
865
869
|
return /* @__PURE__ */ i(
|
|
866
870
|
"button",
|
|
867
871
|
{
|
|
868
|
-
onClick: () => a(
|
|
872
|
+
onClick: () => a(h.id),
|
|
869
873
|
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-
|
|
871
|
-
${g ? "
|
|
874
|
+
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-offset-1
|
|
875
|
+
${g ? "shadow-sm" : "tab-inactive"}
|
|
872
876
|
`,
|
|
877
|
+
style: g ? {
|
|
878
|
+
backgroundColor: "var(--widget-primary)",
|
|
879
|
+
color: "#ffffff"
|
|
880
|
+
} : {
|
|
881
|
+
color: "var(--widget-text-secondary)"
|
|
882
|
+
},
|
|
873
883
|
role: "tab",
|
|
874
884
|
"aria-selected": g,
|
|
875
|
-
"data-testid": `tab-${
|
|
885
|
+
"data-testid": `tab-${h.id}`,
|
|
876
886
|
children: [
|
|
877
|
-
|
|
878
|
-
/* @__PURE__ */ t("span", { children:
|
|
879
|
-
|
|
887
|
+
h.icon && /* @__PURE__ */ t("span", { style: { color: g ? "#ffffff" : "var(--widget-text-tertiary)" }, children: h.icon }),
|
|
888
|
+
/* @__PURE__ */ t("span", { children: h.label }),
|
|
889
|
+
h.count !== void 0 && h.count > 0 && /* @__PURE__ */ i(
|
|
880
890
|
"span",
|
|
881
891
|
{
|
|
882
|
-
className:
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
children:
|
|
892
|
+
className: "ml-1 text-[10px] font-semibold",
|
|
893
|
+
style: {
|
|
894
|
+
color: g ? "#ffffff" : "var(--widget-text-tertiary)"
|
|
895
|
+
},
|
|
896
|
+
children: [
|
|
897
|
+
"(",
|
|
898
|
+
h.count > 99 ? "99+" : h.count,
|
|
899
|
+
")"
|
|
900
|
+
]
|
|
887
901
|
}
|
|
888
902
|
)
|
|
889
903
|
]
|
|
890
904
|
},
|
|
891
|
-
|
|
905
|
+
h.id
|
|
892
906
|
);
|
|
893
907
|
})
|
|
894
908
|
}
|
|
@@ -914,10 +928,10 @@ const B = ({
|
|
|
914
928
|
"aria-checked": a,
|
|
915
929
|
disabled: s,
|
|
916
930
|
className: `
|
|
917
|
-
relative inline-flex h-
|
|
931
|
+
relative inline-flex h-5 w-9 flex-shrink-0 rounded-full border-2 border-transparent
|
|
918
932
|
transition-colors duration-200 ease-in-out
|
|
919
933
|
focus:outline-none focus:ring-2 focus:ring-widget-primary focus:ring-offset-2
|
|
920
|
-
${a ? "bg-widget-primary" : "bg-
|
|
934
|
+
${a ? "bg-widget-primary" : "bg-gray-300 dark:bg-gray-600"}
|
|
921
935
|
${s ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
|
|
922
936
|
`,
|
|
923
937
|
onClick: () => !s && n(!a),
|
|
@@ -925,15 +939,15 @@ const B = ({
|
|
|
925
939
|
"span",
|
|
926
940
|
{
|
|
927
941
|
className: `
|
|
928
|
-
pointer-events-none inline-block h-
|
|
942
|
+
pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow-md ring-0
|
|
929
943
|
transition duration-200 ease-in-out
|
|
930
|
-
${a ? "translate-x-
|
|
944
|
+
${a ? "translate-x-4" : "translate-x-0"}
|
|
931
945
|
`
|
|
932
946
|
}
|
|
933
947
|
)
|
|
934
948
|
}
|
|
935
949
|
)
|
|
936
|
-
] }),
|
|
950
|
+
] }), Oe = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], $e = ({
|
|
937
951
|
preferences: e,
|
|
938
952
|
onPreferenceChange: r,
|
|
939
953
|
isLoading: a
|
|
@@ -941,20 +955,20 @@ const B = ({
|
|
|
941
955
|
const [n, s] = k({
|
|
942
956
|
global: !0,
|
|
943
957
|
schedule: !1
|
|
944
|
-
}), [o,
|
|
958
|
+
}), [o, h] = k({}), g = (l) => {
|
|
945
959
|
s((u) => ({ ...u, [l]: !u[l] }));
|
|
946
|
-
},
|
|
947
|
-
|
|
960
|
+
}, m = (l) => {
|
|
961
|
+
h((u) => ({ ...u, [l]: !u[l] }));
|
|
948
962
|
}, d = (l, u) => {
|
|
949
963
|
r(`channels.${l}`, u);
|
|
950
964
|
}, y = (l, u) => {
|
|
951
965
|
r(`subscriptions.${l}.enabled`, u);
|
|
952
|
-
}, c = (l, u,
|
|
953
|
-
r(`subscriptions.${l}.channels.${u}`,
|
|
966
|
+
}, c = (l, u, f) => {
|
|
967
|
+
r(`subscriptions.${l}.channels.${u}`, f);
|
|
954
968
|
}, b = (l) => {
|
|
955
969
|
const u = [...e.deliverySchedule.weekdays];
|
|
956
970
|
u[l] = !u[l], r("deliverySchedule.weekdays", u);
|
|
957
|
-
},
|
|
971
|
+
}, v = (l) => {
|
|
958
972
|
switch (l) {
|
|
959
973
|
case "email":
|
|
960
974
|
return /* @__PURE__ */ t(Ne, { className: "w-4 h-4" });
|
|
@@ -968,7 +982,7 @@ const B = ({
|
|
|
968
982
|
return null;
|
|
969
983
|
}
|
|
970
984
|
};
|
|
971
|
-
return /* @__PURE__ */ i("div", { className: "h-full overflow-y-auto widget-scrollbar p-2", "data-testid": "preferences-view", children: [
|
|
985
|
+
return /* @__PURE__ */ i("div", { className: "h-full overflow-y-auto widget-scrollbar p-2", style: { backgroundColor: "var(--widget-background)" }, "data-testid": "preferences-view", children: [
|
|
972
986
|
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
987
|
/* @__PURE__ */ i("div", { className: "space-y-2", children: [
|
|
974
988
|
/* @__PURE__ */ i("div", { className: "border border-[var(--widget-border)] rounded-lg overflow-hidden", children: [
|
|
@@ -983,17 +997,17 @@ const B = ({
|
|
|
983
997
|
/* @__PURE__ */ t(G, { className: "w-5 h-5 text-widget-primary" }),
|
|
984
998
|
/* @__PURE__ */ t("span", { className: "font-semibold text-sm text-text-primary", children: "Global Preferences" })
|
|
985
999
|
] }),
|
|
986
|
-
n.global ? /* @__PURE__ */ t(q, { className: "w-5 h-5 text-text-secondary" }) : /* @__PURE__ */ t(
|
|
1000
|
+
n.global ? /* @__PURE__ */ t(q, { className: "w-5 h-5 text-text-secondary" }) : /* @__PURE__ */ t(B, { className: "w-5 h-5 text-text-secondary" })
|
|
987
1001
|
]
|
|
988
1002
|
}
|
|
989
1003
|
),
|
|
990
|
-
n.global && /* @__PURE__ */ i("div", { className: "px-2 pb-1.5
|
|
1004
|
+
n.global && /* @__PURE__ */ i("div", { className: "px-2 pb-1.5 divide-y divide-border-light", style: { backgroundColor: "var(--widget-background)" }, children: [
|
|
991
1005
|
/* @__PURE__ */ t(
|
|
992
1006
|
M,
|
|
993
1007
|
{
|
|
994
1008
|
id: "channel-email",
|
|
995
1009
|
label: "Email",
|
|
996
|
-
icon:
|
|
1010
|
+
icon: v("email"),
|
|
997
1011
|
checked: e.channels.email,
|
|
998
1012
|
onChange: (l) => d("email", l),
|
|
999
1013
|
disabled: a
|
|
@@ -1004,7 +1018,7 @@ const B = ({
|
|
|
1004
1018
|
{
|
|
1005
1019
|
id: "channel-inapp",
|
|
1006
1020
|
label: "In-App",
|
|
1007
|
-
icon:
|
|
1021
|
+
icon: v("inApp"),
|
|
1008
1022
|
checked: e.channels.inApp,
|
|
1009
1023
|
onChange: (l) => d("inApp", l),
|
|
1010
1024
|
disabled: a
|
|
@@ -1015,7 +1029,7 @@ const B = ({
|
|
|
1015
1029
|
{
|
|
1016
1030
|
id: "channel-push",
|
|
1017
1031
|
label: "Push",
|
|
1018
|
-
icon:
|
|
1032
|
+
icon: v("push"),
|
|
1019
1033
|
checked: e.channels.push,
|
|
1020
1034
|
onChange: (l) => d("push", l),
|
|
1021
1035
|
disabled: a
|
|
@@ -1023,7 +1037,7 @@ const B = ({
|
|
|
1023
1037
|
)
|
|
1024
1038
|
] })
|
|
1025
1039
|
] }),
|
|
1026
|
-
/* @__PURE__ */ i("div", { className: "border border-[var(--widget-border)] rounded-lg overflow-hidden
|
|
1040
|
+
/* @__PURE__ */ i("div", { className: "border border-[var(--widget-border)] rounded-lg overflow-hidden", style: { backgroundColor: "var(--widget-background)" }, children: [
|
|
1027
1041
|
/* @__PURE__ */ i(
|
|
1028
1042
|
"button",
|
|
1029
1043
|
{
|
|
@@ -1051,40 +1065,40 @@ const B = ({
|
|
|
1051
1065
|
{
|
|
1052
1066
|
className: `transition-transform duration-200 ${n.schedule ? "rotate-180" : ""}`,
|
|
1053
1067
|
"aria-hidden": "true",
|
|
1054
|
-
children: /* @__PURE__ */ t(
|
|
1068
|
+
children: /* @__PURE__ */ t(B, { className: "w-5 h-5 text-text-secondary" })
|
|
1055
1069
|
}
|
|
1056
1070
|
)
|
|
1057
1071
|
] })
|
|
1058
1072
|
]
|
|
1059
1073
|
}
|
|
1060
1074
|
),
|
|
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: [
|
|
1075
|
+
n.schedule && /* @__PURE__ */ i("div", { className: "px-2 py-1.5 space-y-2 animate-in slide-in-from-top-2 duration-200", style: { backgroundColor: "var(--widget-background)" }, children: [
|
|
1062
1076
|
/* @__PURE__ */ t("div", { className: "text-sm text-[var(--widget-text-secondary)]", children: "Allow notifications between:" }),
|
|
1063
1077
|
/* @__PURE__ */ i("div", { className: "grid grid-cols-[auto_1fr_auto_auto] gap-x-4 gap-y-3 items-center", children: [
|
|
1064
1078
|
/* @__PURE__ */ t("div", { className: "col-span-2 text-xs font-semibold text-[var(--widget-text-tertiary)] pl-1", children: "Days" }),
|
|
1065
1079
|
/* @__PURE__ */ t("div", { className: "text-xs font-semibold text-[var(--widget-text-tertiary)] w-[88px]", children: "From" }),
|
|
1066
1080
|
/* @__PURE__ */ t("div", { className: "text-xs font-semibold text-[var(--widget-text-tertiary)] w-[88px]", children: "To" }),
|
|
1067
|
-
|
|
1068
|
-
const
|
|
1081
|
+
Oe.map((l, u) => {
|
|
1082
|
+
const f = e.deliverySchedule.weekdays[u];
|
|
1069
1083
|
return /* @__PURE__ */ i(z.Fragment, { children: [
|
|
1070
1084
|
/* @__PURE__ */ t("div", { className: "flex items-center h-8", children: /* @__PURE__ */ t(
|
|
1071
1085
|
M,
|
|
1072
1086
|
{
|
|
1073
1087
|
id: `day-${u}`,
|
|
1074
|
-
checked:
|
|
1088
|
+
checked: f,
|
|
1075
1089
|
onChange: () => b(u),
|
|
1076
1090
|
disabled: a
|
|
1077
1091
|
}
|
|
1078
1092
|
) }),
|
|
1079
|
-
/* @__PURE__ */ t("div", { className: `text-sm ${
|
|
1093
|
+
/* @__PURE__ */ t("div", { className: `text-sm ${f ? "text-text-primary" : "text-text-tertiary"}`, children: l }),
|
|
1080
1094
|
/* @__PURE__ */ t("div", { className: "w-[88px]", children: /* @__PURE__ */ t(
|
|
1081
1095
|
"input",
|
|
1082
1096
|
{
|
|
1083
1097
|
type: "time",
|
|
1084
1098
|
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
1099
|
value: e.deliverySchedule.quietHours.start,
|
|
1086
|
-
onChange: (
|
|
1087
|
-
disabled: a || !
|
|
1100
|
+
onChange: (p) => r("deliverySchedule.quietHours.start", p.target.value),
|
|
1101
|
+
disabled: a || !f
|
|
1088
1102
|
}
|
|
1089
1103
|
) }),
|
|
1090
1104
|
/* @__PURE__ */ t("div", { className: "w-[88px]", children: /* @__PURE__ */ t(
|
|
@@ -1093,8 +1107,8 @@ const B = ({
|
|
|
1093
1107
|
type: "time",
|
|
1094
1108
|
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
1109
|
value: e.deliverySchedule.quietHours.end,
|
|
1096
|
-
onChange: (
|
|
1097
|
-
disabled: a || !
|
|
1110
|
+
onChange: (p) => r("deliverySchedule.quietHours.end", p.target.value),
|
|
1111
|
+
disabled: a || !f
|
|
1098
1112
|
}
|
|
1099
1113
|
) })
|
|
1100
1114
|
] }, l);
|
|
@@ -1107,7 +1121,7 @@ const B = ({
|
|
|
1107
1121
|
"button",
|
|
1108
1122
|
{
|
|
1109
1123
|
type: "button",
|
|
1110
|
-
onClick: () =>
|
|
1124
|
+
onClick: () => m(l.workflowId),
|
|
1111
1125
|
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
1126
|
children: [
|
|
1113
1127
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ t("span", { className: "text-sm font-medium text-text-primary", children: l.name }) }),
|
|
@@ -1121,18 +1135,18 @@ const B = ({
|
|
|
1121
1135
|
disabled: a
|
|
1122
1136
|
}
|
|
1123
1137
|
),
|
|
1124
|
-
o[l.workflowId] ? /* @__PURE__ */ t(q, { className: "w-5 h-5 text-text-secondary" }) : /* @__PURE__ */ t(
|
|
1138
|
+
o[l.workflowId] ? /* @__PURE__ */ t(q, { className: "w-5 h-5 text-text-secondary" }) : /* @__PURE__ */ t(B, { className: "w-5 h-5 text-text-secondary" })
|
|
1125
1139
|
] })
|
|
1126
1140
|
]
|
|
1127
1141
|
}
|
|
1128
1142
|
),
|
|
1129
|
-
o[l.workflowId] && l.enabled && /* @__PURE__ */ i("div", { className: "px-2 pb-1.5
|
|
1143
|
+
o[l.workflowId] && l.enabled && /* @__PURE__ */ i("div", { className: "px-2 pb-1.5 divide-y divide-border-light", style: { backgroundColor: "var(--widget-background)" }, children: [
|
|
1130
1144
|
/* @__PURE__ */ t(
|
|
1131
1145
|
M,
|
|
1132
1146
|
{
|
|
1133
1147
|
id: `sub-${l.workflowId}-inapp`,
|
|
1134
1148
|
label: "In-App",
|
|
1135
|
-
icon:
|
|
1149
|
+
icon: v("inApp"),
|
|
1136
1150
|
checked: l.channels.inApp,
|
|
1137
1151
|
onChange: (u) => c(l.workflowId, "inApp", u),
|
|
1138
1152
|
disabled: a
|
|
@@ -1143,7 +1157,7 @@ const B = ({
|
|
|
1143
1157
|
{
|
|
1144
1158
|
id: `sub-${l.workflowId}-push`,
|
|
1145
1159
|
label: "Push",
|
|
1146
|
-
icon:
|
|
1160
|
+
icon: v("push"),
|
|
1147
1161
|
checked: l.channels.push,
|
|
1148
1162
|
onChange: (u) => c(l.workflowId, "push", u),
|
|
1149
1163
|
disabled: a
|
|
@@ -1191,7 +1205,7 @@ const Le = ({ onRetry: e, error: r }) => /* @__PURE__ */ i(
|
|
|
1191
1205
|
className: "p-3 text-center",
|
|
1192
1206
|
"data-testid": "notifications-fallback",
|
|
1193
1207
|
children: [
|
|
1194
|
-
/* @__PURE__ */ t("div", { className: "text-[var(--widget-text-tertiary)] mb-2", children: /* @__PURE__ */ t(
|
|
1208
|
+
/* @__PURE__ */ t("div", { className: "text-[var(--widget-text-tertiary)] mb-2", children: /* @__PURE__ */ t(V, { className: "w-12 h-12 mx-auto" }) }),
|
|
1195
1209
|
/* @__PURE__ */ t(
|
|
1196
1210
|
"p",
|
|
1197
1211
|
{
|
|
@@ -1314,8 +1328,8 @@ const Le = ({ onRetry: e, error: r }) => /* @__PURE__ */ i(
|
|
|
1314
1328
|
return e;
|
|
1315
1329
|
const a = r.toLowerCase().trim();
|
|
1316
1330
|
return e.filter((n) => {
|
|
1317
|
-
const s = n.subject.toLowerCase(), o = n.body.toLowerCase(),
|
|
1318
|
-
return s.includes(a) || o.includes(a) ||
|
|
1331
|
+
const s = n.subject.toLowerCase(), o = n.body.toLowerCase(), h = n.tags.join(" ").toLowerCase();
|
|
1332
|
+
return s.includes(a) || o.includes(a) || h.includes(a);
|
|
1319
1333
|
});
|
|
1320
1334
|
}, Re = (e, r) => {
|
|
1321
1335
|
const a = [...e];
|
|
@@ -1341,13 +1355,13 @@ const Le = ({ onRetry: e, error: r }) => /* @__PURE__ */ i(
|
|
|
1341
1355
|
currentView: n,
|
|
1342
1356
|
onViewChange: s,
|
|
1343
1357
|
notifications: o,
|
|
1344
|
-
onNotificationAction:
|
|
1358
|
+
onNotificationAction: h,
|
|
1345
1359
|
preferences: g,
|
|
1346
|
-
onPreferenceChange:
|
|
1360
|
+
onPreferenceChange: m,
|
|
1347
1361
|
isPreferencesLoading: d = !1,
|
|
1348
1362
|
size: y = "medium"
|
|
1349
1363
|
}) => {
|
|
1350
|
-
const c = j(null), b = j(null), [
|
|
1364
|
+
const c = j(null), b = j(null), [v, l] = k("all"), [u, f] = k([]), [p, A] = k(""), _ = S(() => {
|
|
1351
1365
|
const x = window.__notificationSDK?.config, N = window.__notificationSDK?.client;
|
|
1352
1366
|
if (!x || !N) return null;
|
|
1353
1367
|
const { tenantId: C, environmentId: H, subscriberId: W } = x;
|
|
@@ -1362,11 +1376,11 @@ const Le = ({ onRetry: e, error: r }) => /* @__PURE__ */ i(
|
|
|
1362
1376
|
} catch (C) {
|
|
1363
1377
|
return { success: !1, processedCount: 0, failedCount: x.length, errors: [{ notificationId: "", error: C }] };
|
|
1364
1378
|
}
|
|
1365
|
-
}, [_]), le = Z(() => De(o,
|
|
1379
|
+
}, [_]), le = Z(() => De(o, v, p), [o, v, p]), O = S((x) => {
|
|
1366
1380
|
c.current && !c.current.contains(x.target) && r();
|
|
1367
1381
|
}, [r]), $ = S((x) => {
|
|
1368
1382
|
x.key === "Escape" && r();
|
|
1369
|
-
}, [r]),
|
|
1383
|
+
}, [r]), L = S((x) => {
|
|
1370
1384
|
if (!(!e || !c.current) && x.key === "Tab") {
|
|
1371
1385
|
const N = c.current.querySelectorAll(
|
|
1372
1386
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
@@ -1376,13 +1390,13 @@ const Le = ({ onRetry: e, error: r }) => /* @__PURE__ */ i(
|
|
|
1376
1390
|
x.shiftKey ? document.activeElement === C && (H.focus(), x.preventDefault()) : document.activeElement === H && (C.focus(), x.preventDefault());
|
|
1377
1391
|
}
|
|
1378
1392
|
}, [e]);
|
|
1379
|
-
if (
|
|
1393
|
+
if (D(() => (e ? (b.current = document.activeElement, document.addEventListener("mousedown", O), document.addEventListener("keydown", $), document.addEventListener("keydown", L), setTimeout(() => {
|
|
1380
1394
|
c.current?.querySelector(
|
|
1381
1395
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
1382
1396
|
)?.focus();
|
|
1383
|
-
}, 0)) : (b.current && b.current.focus(), l("all"),
|
|
1384
|
-
document.removeEventListener("mousedown",
|
|
1385
|
-
}), [e,
|
|
1397
|
+
}, 0)) : (b.current && b.current.focus(), l("all"), f([]), A("")), () => {
|
|
1398
|
+
document.removeEventListener("mousedown", O), document.removeEventListener("keydown", $), document.removeEventListener("keydown", L);
|
|
1399
|
+
}), [e, O, $, L]), !e) return null;
|
|
1386
1400
|
const oe = {
|
|
1387
1401
|
left: "left-0 origin-top-left",
|
|
1388
1402
|
right: "right-0 origin-top-right"
|
|
@@ -1403,20 +1417,21 @@ const Le = ({ onRetry: e, error: r }) => /* @__PURE__ */ i(
|
|
|
1403
1417
|
className: `
|
|
1404
1418
|
absolute top-full mt-2 ${oe[a]}
|
|
1405
1419
|
w-[var(--widget-popover-width,400px)] max-h-[var(--widget-popover-max-height,580px)]
|
|
1406
|
-
|
|
1420
|
+
border border-[var(--widget-border)] rounded-2xl overflow-hidden
|
|
1407
1421
|
shadow-[var(--widget-shadow-xl)]
|
|
1408
1422
|
z-50 flex flex-col
|
|
1409
1423
|
animate-in fade-in-0 zoom-in-95 duration-200
|
|
1410
1424
|
max-sm:fixed max-sm:inset-x-4 max-sm:top-16 max-sm:bottom-4
|
|
1411
1425
|
max-sm:w-auto max-sm:max-w-none max-sm:max-h-[calc(100vh-120px)]
|
|
1412
1426
|
`,
|
|
1427
|
+
style: { backgroundColor: "var(--widget-background)" },
|
|
1413
1428
|
role: "dialog",
|
|
1414
1429
|
"aria-modal": "true",
|
|
1415
1430
|
"aria-label": "Notifications",
|
|
1416
1431
|
"data-testid": "inbox-popover",
|
|
1417
1432
|
children: [
|
|
1418
|
-
/* @__PURE__ */ i("div", { className: "flex-shrink-0 flex items-center justify-between px-
|
|
1419
|
-
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ t("h2", { className: "text-
|
|
1433
|
+
/* @__PURE__ */ i("div", { className: "flex-shrink-0 flex items-center justify-between px-4 py-3 border-b border-[var(--widget-border)]", style: { backgroundColor: "var(--widget-background)" }, children: [
|
|
1434
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ t("h2", { className: "text-base font-semibold", style: { color: "var(--widget-text)" }, children: n === "notifications" ? "Notifications" : "Preferences" }) }),
|
|
1420
1435
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: [
|
|
1421
1436
|
n === "notifications" && /* @__PURE__ */ t(
|
|
1422
1437
|
"button",
|
|
@@ -1454,7 +1469,7 @@ const Le = ({ onRetry: e, error: r }) => /* @__PURE__ */ i(
|
|
|
1454
1469
|
] })
|
|
1455
1470
|
] }),
|
|
1456
1471
|
n === "notifications" ? /* @__PURE__ */ i(E, { children: [
|
|
1457
|
-
/* @__PURE__ */ t("div", { className: "flex-shrink-0 px-
|
|
1472
|
+
/* @__PURE__ */ t("div", { className: "flex-shrink-0 px-4 py-2.5 border-b border-[var(--widget-border)]", style: { backgroundColor: "var(--widget-background)" }, children: /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
1458
1473
|
/* @__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
1474
|
/* @__PURE__ */ t(
|
|
1460
1475
|
"input",
|
|
@@ -1471,8 +1486,8 @@ const Le = ({ onRetry: e, error: r }) => /* @__PURE__ */ i(
|
|
|
1471
1486
|
transition-colors\r
|
|
1472
1487
|
`,
|
|
1473
1488
|
placeholder: "Search notifications...",
|
|
1474
|
-
value:
|
|
1475
|
-
onChange: (x) =>
|
|
1489
|
+
value: p,
|
|
1490
|
+
onChange: (x) => A(x.target.value),
|
|
1476
1491
|
"aria-label": "Search notifications"
|
|
1477
1492
|
}
|
|
1478
1493
|
)
|
|
@@ -1481,19 +1496,19 @@ const Le = ({ onRetry: e, error: r }) => /* @__PURE__ */ i(
|
|
|
1481
1496
|
Ae,
|
|
1482
1497
|
{
|
|
1483
1498
|
notifications: o,
|
|
1484
|
-
activeTab:
|
|
1499
|
+
activeTab: v,
|
|
1485
1500
|
onTabChange: (x) => l(x),
|
|
1486
1501
|
size: y
|
|
1487
1502
|
}
|
|
1488
1503
|
),
|
|
1489
|
-
/* @__PURE__ */ t("div", { className: "flex-1
|
|
1504
|
+
/* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto widget-scrollbar", style: { backgroundColor: "var(--widget-background)", maxHeight: "calc(var(--widget-popover-max-height) - 200px)" }, children: /* @__PURE__ */ t(Q, { fallback: /* @__PURE__ */ t(Le, {}), children: /* @__PURE__ */ t(
|
|
1490
1505
|
Ie,
|
|
1491
1506
|
{
|
|
1492
1507
|
notifications: le,
|
|
1493
|
-
onNotificationAction:
|
|
1508
|
+
onNotificationAction: h
|
|
1494
1509
|
}
|
|
1495
1510
|
) }) }),
|
|
1496
|
-
F > 0 && /* @__PURE__ */ t("div", { className: "flex-shrink-0 px-
|
|
1511
|
+
F > 0 && /* @__PURE__ */ t("div", { className: "flex-shrink-0 px-4 py-2.5 border-t border-[var(--widget-border)]", style: { backgroundColor: "var(--widget-bg-hover)" }, children: /* @__PURE__ */ t(
|
|
1497
1512
|
"button",
|
|
1498
1513
|
{
|
|
1499
1514
|
type: "button",
|
|
@@ -1506,11 +1521,11 @@ const Le = ({ onRetry: e, error: r }) => /* @__PURE__ */ i(
|
|
|
1506
1521
|
children: "Mark all as read"
|
|
1507
1522
|
}
|
|
1508
1523
|
) })
|
|
1509
|
-
] }) : /* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto widget-scrollbar", children: /* @__PURE__ */ t(Q, { fallback: /* @__PURE__ */ t(X, {}), children: g &&
|
|
1510
|
-
|
|
1524
|
+
] }) : /* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto widget-scrollbar", children: /* @__PURE__ */ t(Q, { fallback: /* @__PURE__ */ t(X, {}), children: g && m ? /* @__PURE__ */ t(
|
|
1525
|
+
$e,
|
|
1511
1526
|
{
|
|
1512
1527
|
preferences: g,
|
|
1513
|
-
onPreferenceChange:
|
|
1528
|
+
onPreferenceChange: m,
|
|
1514
1529
|
isLoading: d,
|
|
1515
1530
|
onBack: () => s("notifications")
|
|
1516
1531
|
}
|
|
@@ -1527,8 +1542,8 @@ export {
|
|
|
1527
1542
|
qe as L,
|
|
1528
1543
|
We as M,
|
|
1529
1544
|
Ee as N,
|
|
1530
|
-
|
|
1545
|
+
$e as P,
|
|
1531
1546
|
Ke as S,
|
|
1532
1547
|
Ue as a
|
|
1533
1548
|
};
|
|
1534
|
-
//# sourceMappingURL=components-
|
|
1549
|
+
//# sourceMappingURL=components-DgV3nlCC.js.map
|