@edusight/notification-widget 1.0.36 → 1.0.41
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-DqQ0ehzG.js → components-CWbjrQKA.js} +129 -137
- package/dist/{components-DqQ0ehzG.js.map → components-CWbjrQKA.js.map} +1 -1
- package/dist/{components-D9Q1H53S.cjs → components-Cr9Sf7Cz.cjs} +9 -9
- package/dist/{components-D9Q1H53S.cjs.map → components-Cr9Sf7Cz.cjs.map} +1 -1
- package/dist/hooks-C6Z38jT_.cjs +2 -0
- package/dist/hooks-C6Z38jT_.cjs.map +1 -0
- package/dist/{hooks-C7dzVxIU.js → hooks-S0z2_-4B.js} +63 -50
- package/dist/hooks-S0z2_-4B.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 +5 -0
- package/dist/index.esm.js +177 -156
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/dist/hooks-C7dzVxIU.js.map +0 -1
- package/dist/hooks-kLhwdW29.cjs +0 -2
- package/dist/hooks-kLhwdW29.cjs.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsxs as i, jsx as t, Fragment as
|
|
1
|
+
import $, { Component as me, useState as z, useRef as B, useEffect as U, useCallback as I, useMemo as ie } from "react";
|
|
2
|
+
import { jsxs as i, jsx as t, Fragment as P } from "react/jsx-runtime";
|
|
3
3
|
var se = {
|
|
4
4
|
color: void 0,
|
|
5
5
|
size: void 0,
|
|
6
6
|
className: void 0,
|
|
7
7
|
style: void 0,
|
|
8
8
|
attr: void 0
|
|
9
|
-
}, J =
|
|
9
|
+
}, J = $.createContext && /* @__PURE__ */ $.createContext(se), ge = ["attr", "size", "title"];
|
|
10
10
|
function fe(e, r) {
|
|
11
11
|
if (e == null) return {};
|
|
12
12
|
var a = pe(e, r), n, s;
|
|
@@ -27,15 +27,15 @@ function pe(e, r) {
|
|
|
27
27
|
}
|
|
28
28
|
return a;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
30
|
+
function D() {
|
|
31
|
+
return D = Object.assign ? Object.assign.bind() : function(e) {
|
|
32
32
|
for (var r = 1; r < arguments.length; r++) {
|
|
33
33
|
var a = arguments[r];
|
|
34
34
|
for (var n in a)
|
|
35
35
|
Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n]);
|
|
36
36
|
}
|
|
37
37
|
return e;
|
|
38
|
-
},
|
|
38
|
+
}, D.apply(this, arguments);
|
|
39
39
|
}
|
|
40
40
|
function Q(e, r) {
|
|
41
41
|
var a = Object.keys(e);
|
|
@@ -47,7 +47,7 @@ function Q(e, r) {
|
|
|
47
47
|
}
|
|
48
48
|
return a;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function V(e) {
|
|
51
51
|
for (var r = 1; r < arguments.length; r++) {
|
|
52
52
|
var a = arguments[r] != null ? arguments[r] : {};
|
|
53
53
|
r % 2 ? Q(Object(a), !0).forEach(function(n) {
|
|
@@ -76,13 +76,13 @@ function xe(e, r) {
|
|
|
76
76
|
return (r === "string" ? String : Number)(e);
|
|
77
77
|
}
|
|
78
78
|
function le(e) {
|
|
79
|
-
return e && e.map((r, a) => /* @__PURE__ */
|
|
79
|
+
return e && e.map((r, a) => /* @__PURE__ */ $.createElement(r.tag, V({
|
|
80
80
|
key: a
|
|
81
81
|
}, r.attr), le(r.child)));
|
|
82
82
|
}
|
|
83
83
|
function w(e) {
|
|
84
|
-
return (r) => /* @__PURE__ */
|
|
85
|
-
attr:
|
|
84
|
+
return (r) => /* @__PURE__ */ $.createElement(we, D({
|
|
85
|
+
attr: V({}, e.attr)
|
|
86
86
|
}, r), le(e.child));
|
|
87
87
|
}
|
|
88
88
|
function we(e) {
|
|
@@ -92,21 +92,21 @@ function we(e) {
|
|
|
92
92
|
size: s,
|
|
93
93
|
title: l
|
|
94
94
|
} = e, u = fe(e, ge), h = s || a.size || "1em", d;
|
|
95
|
-
return a.className && (d = a.className), e.className && (d = (d ? d + " " : "") + e.className), /* @__PURE__ */
|
|
95
|
+
return a.className && (d = a.className), e.className && (d = (d ? d + " " : "") + e.className), /* @__PURE__ */ $.createElement("svg", D({
|
|
96
96
|
stroke: "currentColor",
|
|
97
97
|
fill: "currentColor",
|
|
98
98
|
strokeWidth: "0"
|
|
99
99
|
}, a.attr, n, u, {
|
|
100
100
|
className: d,
|
|
101
|
-
style:
|
|
101
|
+
style: V(V({
|
|
102
102
|
color: e.color || a.color
|
|
103
103
|
}, a.style), e.style),
|
|
104
104
|
height: h,
|
|
105
105
|
width: h,
|
|
106
106
|
xmlns: "http://www.w3.org/2000/svg"
|
|
107
|
-
}), l && /* @__PURE__ */
|
|
107
|
+
}), l && /* @__PURE__ */ $.createElement("title", null, l), e.children);
|
|
108
108
|
};
|
|
109
|
-
return J !== void 0 ? /* @__PURE__ */
|
|
109
|
+
return J !== void 0 ? /* @__PURE__ */ $.createElement(J.Consumer, null, (a) => r(a)) : r(se);
|
|
110
110
|
}
|
|
111
111
|
function ye(e) {
|
|
112
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);
|
|
@@ -233,16 +233,16 @@ function ze(e) {
|
|
|
233
233
|
function de(e) {
|
|
234
234
|
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);
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function Se(e) {
|
|
237
237
|
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);
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function je(e) {
|
|
240
240
|
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);
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function Ee(e) {
|
|
243
243
|
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);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function He(e) {
|
|
246
246
|
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);
|
|
247
247
|
}
|
|
248
248
|
function ce(e) {
|
|
@@ -257,7 +257,7 @@ function F(e) {
|
|
|
257
257
|
function Je(e) {
|
|
258
258
|
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);
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function Te(e) {
|
|
261
261
|
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);
|
|
262
262
|
}
|
|
263
263
|
function ee(e) {
|
|
@@ -269,7 +269,7 @@ function Ie(e) {
|
|
|
269
269
|
function ue(e) {
|
|
270
270
|
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);
|
|
271
271
|
}
|
|
272
|
-
const
|
|
272
|
+
const $e = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "p-3 text-center", "data-testid": "notifications-fallback", children: [
|
|
273
273
|
/* @__PURE__ */ t("div", { className: "text-[var(--widget-text-tertiary)] mb-2", children: /* @__PURE__ */ t(q, { className: "w-12 h-12 mx-auto" }) }),
|
|
274
274
|
/* @__PURE__ */ t("p", { className: "text-sm text-[var(--widget-text-secondary)] mb-3", children: r ? "Failed to load notifications" : "No notifications available" }),
|
|
275
275
|
e && /* @__PURE__ */ t(
|
|
@@ -327,7 +327,7 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
327
327
|
), Xe = ({ message: e = "Loading..." }) => /* @__PURE__ */ i("div", { className: "p-3 text-center", "data-testid": "loading-fallback", children: [
|
|
328
328
|
/* @__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" }),
|
|
329
329
|
/* @__PURE__ */ t("p", { className: "text-sm text-[var(--widget-text-secondary)]", children: e })
|
|
330
|
-
] }),
|
|
330
|
+
] }), Ae = (e, r) => {
|
|
331
331
|
switch (r) {
|
|
332
332
|
case "all":
|
|
333
333
|
return e;
|
|
@@ -364,8 +364,8 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
364
364
|
}
|
|
365
365
|
}, Be = (e, r, a, n = "newest") => {
|
|
366
366
|
let s = e;
|
|
367
|
-
return s =
|
|
368
|
-
},
|
|
367
|
+
return s = Ae(s, r), a && (s = Oe(s, a)), s = Le(s, n), s;
|
|
368
|
+
}, Re = ({
|
|
369
369
|
selectedNotifications: e,
|
|
370
370
|
onMarkAllAsRead: r,
|
|
371
371
|
onMarkAllAsUnread: a,
|
|
@@ -516,7 +516,7 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
516
516
|
position: a = "top",
|
|
517
517
|
delay: n = 200
|
|
518
518
|
}) => {
|
|
519
|
-
const [s, l] = z(!1), [u, h] = z({ x: 0, y: 0 }), d =
|
|
519
|
+
const [s, l] = z(!1), [u, h] = z({ x: 0, y: 0 }), d = B(null), m = B(null), v = () => {
|
|
520
520
|
d.current && clearTimeout(d.current), d.current = setTimeout(() => {
|
|
521
521
|
if (m.current) {
|
|
522
522
|
const x = m.current.getBoundingClientRect();
|
|
@@ -541,9 +541,9 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
541
541
|
}, g = () => {
|
|
542
542
|
d.current && clearTimeout(d.current), l(!1);
|
|
543
543
|
};
|
|
544
|
-
return
|
|
544
|
+
return U(() => () => {
|
|
545
545
|
d.current && clearTimeout(d.current);
|
|
546
|
-
}, []), /* @__PURE__ */ i(
|
|
546
|
+
}, []), /* @__PURE__ */ i(P, { children: [
|
|
547
547
|
/* @__PURE__ */ t(
|
|
548
548
|
"div",
|
|
549
549
|
{
|
|
@@ -558,8 +558,8 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
558
558
|
"div",
|
|
559
559
|
{
|
|
560
560
|
className: `
|
|
561
|
-
fixed z-50 px-2 py-1 text-xs font-medium text-
|
|
562
|
-
bg-
|
|
561
|
+
fixed z-50 px-2 py-1 text-xs font-medium text-white rounded-md pointer-events-none
|
|
562
|
+
bg-gray-900 shadow-lg
|
|
563
563
|
${{
|
|
564
564
|
top: "-translate-x-1/2 -translate-y-full",
|
|
565
565
|
bottom: "-translate-x-1/2 translate-y-0",
|
|
@@ -576,17 +576,17 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
576
576
|
}
|
|
577
577
|
)
|
|
578
578
|
] });
|
|
579
|
-
},
|
|
579
|
+
}, Pe = (e) => {
|
|
580
580
|
if (Number.isNaN(e.getTime())) return "Long ago";
|
|
581
581
|
const n = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), s = Math.floor(n / 6e4), l = Math.floor(n / 36e5), u = Math.floor(n / 864e5);
|
|
582
582
|
return s < 1 ? "Just now" : s < 60 ? `${s}m ago` : l < 24 ? `${l}h ago` : u < 7 ? `${u}d ago` : e.toLocaleDateString();
|
|
583
|
-
},
|
|
583
|
+
}, K = ({ type: e, className: r }) => {
|
|
584
584
|
const a = r || "w-4 h-4";
|
|
585
585
|
switch (e) {
|
|
586
586
|
case "mark_read":
|
|
587
587
|
return /* @__PURE__ */ t(q, { className: a });
|
|
588
588
|
case "snooze":
|
|
589
|
-
return /* @__PURE__ */ t(
|
|
589
|
+
return /* @__PURE__ */ t(Se, { className: a });
|
|
590
590
|
case "archive":
|
|
591
591
|
return /* @__PURE__ */ t(de, { className: a });
|
|
592
592
|
default:
|
|
@@ -598,7 +598,7 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
598
598
|
onSelectionChange: a,
|
|
599
599
|
isSelected: n = !1
|
|
600
600
|
}) => {
|
|
601
|
-
const [s, l] = z(!1), u = Number.isNaN(e.timestamp.getTime()), h = u ? void 0 : e.timestamp.toISOString(), d =
|
|
601
|
+
const [s, l] = z(!1), u = Number.isNaN(e.timestamp.getTime()), h = u ? void 0 : e.timestamp.toISOString(), d = Pe(e.timestamp), m = (g) => {
|
|
602
602
|
r && r(e.id, g), l(!1);
|
|
603
603
|
}, v = () => {
|
|
604
604
|
a && a(!n);
|
|
@@ -692,7 +692,7 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
692
692
|
}
|
|
693
693
|
}),
|
|
694
694
|
"aria-label": "Mark as read",
|
|
695
|
-
children: /* @__PURE__ */ t(
|
|
695
|
+
children: /* @__PURE__ */ t(K, { type: "mark_read" })
|
|
696
696
|
}
|
|
697
697
|
) }),
|
|
698
698
|
/* @__PURE__ */ t(W, { content: "Snooze", position: "top", children: /* @__PURE__ */ t(
|
|
@@ -702,7 +702,7 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
702
702
|
onClick: () => m({ type: "custom", label: "Snooze", handler: async () => {
|
|
703
703
|
} }),
|
|
704
704
|
"aria-label": "Snooze",
|
|
705
|
-
children: /* @__PURE__ */ t(
|
|
705
|
+
children: /* @__PURE__ */ t(K, { type: "snooze" })
|
|
706
706
|
}
|
|
707
707
|
) }),
|
|
708
708
|
/* @__PURE__ */ t(W, { content: "Archive", position: "top", children: /* @__PURE__ */ t(
|
|
@@ -712,7 +712,7 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
712
712
|
onClick: () => m({ type: "archive", label: "Archive", handler: async () => {
|
|
713
713
|
} }),
|
|
714
714
|
"aria-label": "Archive",
|
|
715
|
-
children: /* @__PURE__ */ t(
|
|
715
|
+
children: /* @__PURE__ */ t(K, { type: "archive" })
|
|
716
716
|
}
|
|
717
717
|
) })
|
|
718
718
|
]
|
|
@@ -733,7 +733,7 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
733
733
|
]
|
|
734
734
|
}
|
|
735
735
|
);
|
|
736
|
-
}, ae = ({ count: e = 3 }) => /* @__PURE__ */ t(
|
|
736
|
+
}, ae = ({ count: e = 3 }) => /* @__PURE__ */ t(P, { children: Array.from({ length: e }).map((r, a) => /* @__PURE__ */ i(
|
|
737
737
|
"div",
|
|
738
738
|
{
|
|
739
739
|
className: "flex items-start gap-3 px-4 py-3 border-b border-border-light animate-pulse",
|
|
@@ -763,8 +763,8 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
763
763
|
hasMore: d = !1,
|
|
764
764
|
className: m = ""
|
|
765
765
|
}) => {
|
|
766
|
-
const v =
|
|
767
|
-
|
|
766
|
+
const v = B(null), g = B(null), [y, x] = z(!1);
|
|
767
|
+
U(() => {
|
|
768
768
|
if (!(!h || !d || y))
|
|
769
769
|
return v.current = new IntersectionObserver(
|
|
770
770
|
(c) => {
|
|
@@ -843,7 +843,7 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
843
843
|
}
|
|
844
844
|
) }) }) : /* @__PURE__ */ i("div", { className: `flex flex-col h-full min-w-[20rem] ${m}`, children: [
|
|
845
845
|
u && n && /* @__PURE__ */ t(
|
|
846
|
-
|
|
846
|
+
Re,
|
|
847
847
|
{
|
|
848
848
|
selectedNotifications: s,
|
|
849
849
|
onMarkAllAsRead: async (c) => {
|
|
@@ -959,7 +959,7 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
959
959
|
d && /* @__PURE__ */ t("div", { ref: g, className: "py-2", children: y && /* @__PURE__ */ t(ae, { count: 3 }) })
|
|
960
960
|
] }) })
|
|
961
961
|
] });
|
|
962
|
-
},
|
|
962
|
+
}, E = ({
|
|
963
963
|
id: e,
|
|
964
964
|
label: r,
|
|
965
965
|
checked: a,
|
|
@@ -1048,22 +1048,22 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
1048
1048
|
const p = [...e.deliverySchedule.weekdays];
|
|
1049
1049
|
p[o] = !p[o], r("deliverySchedule.weekdays", p);
|
|
1050
1050
|
}, A = (o) => {
|
|
1051
|
-
const { scrollTop: p, scrollHeight: M, clientHeight:
|
|
1052
|
-
M - p -
|
|
1053
|
-
},
|
|
1051
|
+
const { scrollTop: p, scrollHeight: M, clientHeight: H } = o.currentTarget;
|
|
1052
|
+
M - p - H < 50 && l && s && !u && s();
|
|
1053
|
+
}, j = (o) => {
|
|
1054
1054
|
switch (o) {
|
|
1055
1055
|
case "email":
|
|
1056
1056
|
return /* @__PURE__ */ t(ze, { className: "w-4 h-4" });
|
|
1057
1057
|
case "push":
|
|
1058
1058
|
return /* @__PURE__ */ t(ee, { className: "w-4 h-4" });
|
|
1059
1059
|
case "sms":
|
|
1060
|
-
return /* @__PURE__ */ t(
|
|
1060
|
+
return /* @__PURE__ */ t(Te, { className: "w-4 h-4" });
|
|
1061
1061
|
case "inApp":
|
|
1062
|
-
return /* @__PURE__ */ t(
|
|
1062
|
+
return /* @__PURE__ */ t(je, { className: "w-4 h-4" });
|
|
1063
1063
|
default:
|
|
1064
1064
|
return null;
|
|
1065
1065
|
}
|
|
1066
|
-
},
|
|
1066
|
+
}, O = n || e.subscriptions;
|
|
1067
1067
|
return /* @__PURE__ */ i(
|
|
1068
1068
|
"div",
|
|
1069
1069
|
{
|
|
@@ -1091,33 +1091,33 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
1091
1091
|
),
|
|
1092
1092
|
d.global && /* @__PURE__ */ i("div", { className: "px-2 pb-1.5 divide-y divide-border-light bg-[var(--widget-background)]", children: [
|
|
1093
1093
|
/* @__PURE__ */ t(
|
|
1094
|
-
|
|
1094
|
+
E,
|
|
1095
1095
|
{
|
|
1096
1096
|
id: "channel-email",
|
|
1097
1097
|
label: "Email",
|
|
1098
|
-
icon:
|
|
1098
|
+
icon: j("email"),
|
|
1099
1099
|
checked: e.channels.email,
|
|
1100
1100
|
onChange: (o) => C("email", o),
|
|
1101
1101
|
disabled: a
|
|
1102
1102
|
}
|
|
1103
1103
|
),
|
|
1104
1104
|
/* @__PURE__ */ t(
|
|
1105
|
-
|
|
1105
|
+
E,
|
|
1106
1106
|
{
|
|
1107
1107
|
id: "channel-inapp",
|
|
1108
1108
|
label: "In-App",
|
|
1109
|
-
icon:
|
|
1109
|
+
icon: j("inApp"),
|
|
1110
1110
|
checked: e.channels.inApp,
|
|
1111
1111
|
onChange: (o) => C("inApp", o),
|
|
1112
1112
|
disabled: a
|
|
1113
1113
|
}
|
|
1114
1114
|
),
|
|
1115
1115
|
/* @__PURE__ */ t(
|
|
1116
|
-
|
|
1116
|
+
E,
|
|
1117
1117
|
{
|
|
1118
1118
|
id: "channel-push",
|
|
1119
1119
|
label: "Push",
|
|
1120
|
-
icon:
|
|
1120
|
+
icon: j("push"),
|
|
1121
1121
|
checked: e.channels.push,
|
|
1122
1122
|
onChange: (o) => C("push", o),
|
|
1123
1123
|
disabled: a
|
|
@@ -1135,16 +1135,15 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
1135
1135
|
children: [
|
|
1136
1136
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
1137
1137
|
/* @__PURE__ */ t(ke, { className: "w-5 h-5 text-widget-primary" }),
|
|
1138
|
-
/* @__PURE__ */ t("span", { className: "font-semibold text-sm text-text-primary", children: "
|
|
1138
|
+
/* @__PURE__ */ t("span", { className: "font-semibold text-sm text-text-primary", children: "Working Hours" })
|
|
1139
1139
|
] }),
|
|
1140
1140
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
1141
1141
|
/* @__PURE__ */ t(
|
|
1142
|
-
|
|
1142
|
+
E,
|
|
1143
1143
|
{
|
|
1144
1144
|
id: "schedule-enabled",
|
|
1145
|
-
checked:
|
|
1146
|
-
onChange: () =>
|
|
1147
|
-
},
|
|
1145
|
+
checked: e.deliverySchedule?.enabled || !1,
|
|
1146
|
+
onChange: (o) => r("deliverySchedule.enabled", o),
|
|
1148
1147
|
disabled: a
|
|
1149
1148
|
}
|
|
1150
1149
|
),
|
|
@@ -1160,57 +1159,50 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
1160
1159
|
]
|
|
1161
1160
|
}
|
|
1162
1161
|
),
|
|
1163
|
-
d.schedule && /* @__PURE__ */ i("div", { className: "px-2 py-1.5 space-y-2 animate-in slide-in-from-top-2 duration-200 bg-[var(--widget-background)]", children: [
|
|
1164
|
-
/* @__PURE__ */ t("div", { className: "text-
|
|
1165
|
-
/* @__PURE__ */
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
{
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
onChange: (E) => r("deliverySchedule.quietHours.end", E.target.value),
|
|
1205
|
-
disabled: a || !M
|
|
1206
|
-
}
|
|
1207
|
-
) })
|
|
1208
|
-
] }, o);
|
|
1209
|
-
})
|
|
1210
|
-
] })
|
|
1162
|
+
d.schedule && (e.deliverySchedule?.enabled || !1) && /* @__PURE__ */ i("div", { className: "px-2 py-1.5 space-y-2 animate-in slide-in-from-top-2 duration-200 bg-[var(--widget-background)]", children: [
|
|
1163
|
+
/* @__PURE__ */ t("div", { className: "text-xs text-[var(--widget-text-secondary)] mb-2", children: "Set your available hours for receiving notifications:" }),
|
|
1164
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: Fe.map((o, p) => {
|
|
1165
|
+
const M = e.deliverySchedule.weekdays[p], H = o.toLowerCase(), L = e.deliverySchedule.weeklySchedule?.[H] || {
|
|
1166
|
+
start: "09:00",
|
|
1167
|
+
end: "17:00"
|
|
1168
|
+
};
|
|
1169
|
+
return /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
1170
|
+
/* @__PURE__ */ t(
|
|
1171
|
+
E,
|
|
1172
|
+
{
|
|
1173
|
+
id: `day-${p}`,
|
|
1174
|
+
checked: M,
|
|
1175
|
+
onChange: () => f(p),
|
|
1176
|
+
disabled: a
|
|
1177
|
+
}
|
|
1178
|
+
),
|
|
1179
|
+
/* @__PURE__ */ t("div", { className: `text-xs font-medium w-16 ${M ? "text-text-primary" : "text-text-tertiary"}`, children: o.slice(0, 3) }),
|
|
1180
|
+
/* @__PURE__ */ t(
|
|
1181
|
+
"input",
|
|
1182
|
+
{
|
|
1183
|
+
type: "time",
|
|
1184
|
+
className: "flex-1 px-1.5 py-1 bg-widget-background border border-border rounded text-xs text-text-primary focus:outline-none focus:ring-1 focus:ring-widget-primary disabled:opacity-50 disabled:bg-widget-hover",
|
|
1185
|
+
value: L.start,
|
|
1186
|
+
onChange: (T) => r(`deliverySchedule.weeklySchedule.${H}.start`, T.target.value),
|
|
1187
|
+
disabled: a || !M
|
|
1188
|
+
}
|
|
1189
|
+
),
|
|
1190
|
+
/* @__PURE__ */ t("span", { className: "text-xs text-text-tertiary", children: "to" }),
|
|
1191
|
+
/* @__PURE__ */ t(
|
|
1192
|
+
"input",
|
|
1193
|
+
{
|
|
1194
|
+
type: "time",
|
|
1195
|
+
className: "flex-1 px-1.5 py-1 bg-widget-background border border-border rounded text-xs text-text-primary focus:outline-none focus:ring-1 focus:ring-widget-primary disabled:opacity-50 disabled:bg-widget-hover",
|
|
1196
|
+
value: L.end,
|
|
1197
|
+
onChange: (T) => r(`deliverySchedule.weeklySchedule.${H}.end`, T.target.value),
|
|
1198
|
+
disabled: a || !M
|
|
1199
|
+
}
|
|
1200
|
+
)
|
|
1201
|
+
] }, o);
|
|
1202
|
+
}) })
|
|
1211
1203
|
] })
|
|
1212
1204
|
] }),
|
|
1213
|
-
|
|
1205
|
+
O.length > 0 && O.map((o) => /* @__PURE__ */ i(
|
|
1214
1206
|
"div",
|
|
1215
1207
|
{
|
|
1216
1208
|
className: "border border-[var(--widget-border)] rounded-lg overflow-hidden",
|
|
@@ -1232,7 +1224,7 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
1232
1224
|
) }),
|
|
1233
1225
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
1234
1226
|
/* @__PURE__ */ t(
|
|
1235
|
-
|
|
1227
|
+
E,
|
|
1236
1228
|
{
|
|
1237
1229
|
id: `workflow-${o.workflowId}`,
|
|
1238
1230
|
checked: o.enabled,
|
|
@@ -1247,22 +1239,22 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
1247
1239
|
),
|
|
1248
1240
|
v[o.workflowId] && o.enabled && /* @__PURE__ */ i("div", { className: "px-2 pb-1.5 divide-y divide-border-light bg-[var(--widget-background)]", children: [
|
|
1249
1241
|
/* @__PURE__ */ t(
|
|
1250
|
-
|
|
1242
|
+
E,
|
|
1251
1243
|
{
|
|
1252
1244
|
id: `sub-${o.workflowId}-inapp`,
|
|
1253
1245
|
label: "In-App",
|
|
1254
|
-
icon:
|
|
1246
|
+
icon: j("inApp"),
|
|
1255
1247
|
checked: o.channels.inApp,
|
|
1256
1248
|
onChange: (p) => c(o.workflowId, "inApp", p),
|
|
1257
1249
|
disabled: a
|
|
1258
1250
|
}
|
|
1259
1251
|
),
|
|
1260
1252
|
/* @__PURE__ */ t(
|
|
1261
|
-
|
|
1253
|
+
E,
|
|
1262
1254
|
{
|
|
1263
1255
|
id: `sub-${o.workflowId}-push`,
|
|
1264
1256
|
label: "Push",
|
|
1265
|
-
icon:
|
|
1257
|
+
icon: j("push"),
|
|
1266
1258
|
checked: o.channels.push,
|
|
1267
1259
|
onChange: (p) => c(o.workflowId, "push", p),
|
|
1268
1260
|
disabled: a
|
|
@@ -1286,7 +1278,7 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
1286
1278
|
]
|
|
1287
1279
|
}
|
|
1288
1280
|
);
|
|
1289
|
-
},
|
|
1281
|
+
}, Ke = ({
|
|
1290
1282
|
notifications: e,
|
|
1291
1283
|
activeTab: r,
|
|
1292
1284
|
onTabChange: a,
|
|
@@ -1316,7 +1308,7 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
1316
1308
|
id: `tag:${v}`,
|
|
1317
1309
|
label: v,
|
|
1318
1310
|
count: g,
|
|
1319
|
-
icon: /* @__PURE__ */ t(
|
|
1311
|
+
icon: /* @__PURE__ */ t(Ee, { className: "w-4 h-4" })
|
|
1320
1312
|
}));
|
|
1321
1313
|
return [...d, ...m];
|
|
1322
1314
|
}, [e]);
|
|
@@ -1387,41 +1379,41 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
1387
1379
|
hasMoreSpecific: C,
|
|
1388
1380
|
isListLoading: k
|
|
1389
1381
|
}) => {
|
|
1390
|
-
const c =
|
|
1382
|
+
const c = B(null), f = B(null), [A, j] = z("all"), [O, o] = z(""), p = I(() => {
|
|
1391
1383
|
const b = window.__notificationSDK?.config, N = window.__notificationSDK?.client;
|
|
1392
1384
|
if (!b || !N) return null;
|
|
1393
|
-
const { tenantId:
|
|
1394
|
-
return !
|
|
1385
|
+
const { tenantId: S, environmentId: R, subscriberId: Y } = b;
|
|
1386
|
+
return !S || !R || !Y ? null : { client: N, tenantId: S, environmentId: R, subscriberId: Y };
|
|
1395
1387
|
}, []), M = I(
|
|
1396
1388
|
async (b) => {
|
|
1397
1389
|
const N = p();
|
|
1398
1390
|
if (!N)
|
|
1399
1391
|
return { success: !1, processedCount: 0, failedCount: b.length, errors: [] };
|
|
1400
1392
|
try {
|
|
1401
|
-
for (const
|
|
1393
|
+
for (const S of b)
|
|
1402
1394
|
await N.client.inbox.markAsRead(
|
|
1403
|
-
|
|
1395
|
+
S,
|
|
1404
1396
|
N.tenantId,
|
|
1405
1397
|
N.environmentId,
|
|
1406
1398
|
N.subscriberId
|
|
1407
1399
|
);
|
|
1408
1400
|
return { success: !0, processedCount: b.length, failedCount: 0, errors: [] };
|
|
1409
|
-
} catch (
|
|
1401
|
+
} catch (S) {
|
|
1410
1402
|
return {
|
|
1411
1403
|
success: !1,
|
|
1412
1404
|
processedCount: 0,
|
|
1413
1405
|
failedCount: b.length,
|
|
1414
|
-
errors: [{ notificationId: "", error:
|
|
1406
|
+
errors: [{ notificationId: "", error: S }]
|
|
1415
1407
|
};
|
|
1416
1408
|
}
|
|
1417
1409
|
},
|
|
1418
1410
|
[p]
|
|
1419
|
-
),
|
|
1411
|
+
), H = ie(() => Be(l, A, O), [l, A, O]), L = I(
|
|
1420
1412
|
(b) => {
|
|
1421
1413
|
c.current && !c.current.contains(b.target) && r();
|
|
1422
1414
|
},
|
|
1423
1415
|
[r]
|
|
1424
|
-
),
|
|
1416
|
+
), T = I(
|
|
1425
1417
|
(b) => {
|
|
1426
1418
|
b.key === "Escape" && r();
|
|
1427
1419
|
},
|
|
@@ -1433,24 +1425,24 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
1433
1425
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
1434
1426
|
);
|
|
1435
1427
|
if (N.length === 0) return;
|
|
1436
|
-
const
|
|
1437
|
-
b.shiftKey ? document.activeElement ===
|
|
1428
|
+
const S = N[0], R = N[N.length - 1];
|
|
1429
|
+
b.shiftKey ? document.activeElement === S && (R.focus(), b.preventDefault()) : document.activeElement === R && (S.focus(), b.preventDefault());
|
|
1438
1430
|
}
|
|
1439
1431
|
},
|
|
1440
1432
|
[e]
|
|
1441
1433
|
);
|
|
1442
|
-
if (
|
|
1434
|
+
if (U(() => (e ? (f.current = document.activeElement, document.addEventListener("mousedown", L), document.addEventListener("keydown", T), document.addEventListener("keydown", _), setTimeout(() => {
|
|
1443
1435
|
c.current?.querySelector(
|
|
1444
1436
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
1445
1437
|
)?.focus();
|
|
1446
|
-
}, 0)) : (f.current && f.current.focus(),
|
|
1447
|
-
document.removeEventListener("mousedown",
|
|
1448
|
-
}), [e,
|
|
1438
|
+
}, 0)) : (f.current && f.current.focus(), j("all"), o("")), () => {
|
|
1439
|
+
document.removeEventListener("mousedown", L), document.removeEventListener("keydown", T), document.removeEventListener("keydown", _);
|
|
1440
|
+
}), [e, L, T, _]), !e) return null;
|
|
1449
1441
|
const he = {
|
|
1450
1442
|
left: "left-0 origin-top-left",
|
|
1451
1443
|
right: "right-0 origin-top-right"
|
|
1452
1444
|
}, G = l.filter((b) => !b.isRead).length;
|
|
1453
|
-
return /* @__PURE__ */ i(
|
|
1445
|
+
return /* @__PURE__ */ i(P, { children: [
|
|
1454
1446
|
/* @__PURE__ */ t(
|
|
1455
1447
|
"div",
|
|
1456
1448
|
{
|
|
@@ -1501,7 +1493,7 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
1501
1493
|
onClick: () => s("notifications"),
|
|
1502
1494
|
"aria-label": "Back to notifications",
|
|
1503
1495
|
"data-testid": "back-button",
|
|
1504
|
-
children: /* @__PURE__ */ t(
|
|
1496
|
+
children: /* @__PURE__ */ t(He, { className: "w-5 h-5" })
|
|
1505
1497
|
}
|
|
1506
1498
|
),
|
|
1507
1499
|
/* @__PURE__ */ t(
|
|
@@ -1517,7 +1509,7 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
1517
1509
|
)
|
|
1518
1510
|
] })
|
|
1519
1511
|
] }),
|
|
1520
|
-
n === "notifications" ? /* @__PURE__ */ i(
|
|
1512
|
+
n === "notifications" ? /* @__PURE__ */ i(P, { children: [
|
|
1521
1513
|
/* @__PURE__ */ t("div", { className: "flex-shrink-0 px-4 py-2.5 border-b border-[var(--widget-border)] bg-[var(--widget-background)]", children: /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
1522
1514
|
/* @__PURE__ */ t("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none", children: /* @__PURE__ */ t(Ce, { className: "w-5 h-5 text-[var(--widget-text-tertiary)]" }) }),
|
|
1523
1515
|
/* @__PURE__ */ t(
|
|
@@ -1535,25 +1527,25 @@ const Ae = ({ onRetry: e, error: r }) => /* @__PURE__ */ i("div", { className: "
|
|
|
1535
1527
|
transition-colors
|
|
1536
1528
|
`,
|
|
1537
1529
|
placeholder: "Search notifications...",
|
|
1538
|
-
value:
|
|
1530
|
+
value: O,
|
|
1539
1531
|
onChange: (b) => o(b.target.value),
|
|
1540
1532
|
"aria-label": "Search notifications"
|
|
1541
1533
|
}
|
|
1542
1534
|
)
|
|
1543
1535
|
] }) }),
|
|
1544
1536
|
/* @__PURE__ */ t(
|
|
1545
|
-
|
|
1537
|
+
Ke,
|
|
1546
1538
|
{
|
|
1547
1539
|
notifications: l,
|
|
1548
1540
|
activeTab: A,
|
|
1549
|
-
onTabChange: (b) =>
|
|
1541
|
+
onTabChange: (b) => j(b),
|
|
1550
1542
|
size: v
|
|
1551
1543
|
}
|
|
1552
1544
|
),
|
|
1553
|
-
/* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto widget-scrollbar bg-[var(--widget-background)] max-h-[calc(var(--widget-popover-max-height)-200px)]", children: /* @__PURE__ */ t(X, { fallback: /* @__PURE__ */ t(
|
|
1545
|
+
/* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto widget-scrollbar bg-[var(--widget-background)] max-h-[calc(var(--widget-popover-max-height)-200px)]", children: /* @__PURE__ */ t(X, { fallback: /* @__PURE__ */ t($e, {}), children: /* @__PURE__ */ t(
|
|
1554
1546
|
Ve,
|
|
1555
1547
|
{
|
|
1556
|
-
notifications:
|
|
1548
|
+
notifications: H,
|
|
1557
1549
|
onNotificationAction: u
|
|
1558
1550
|
}
|
|
1559
1551
|
) }) }),
|
|
@@ -1600,4 +1592,4 @@ export {
|
|
|
1600
1592
|
Qe as S,
|
|
1601
1593
|
Je as a
|
|
1602
1594
|
};
|
|
1603
|
-
//# sourceMappingURL=components-
|
|
1595
|
+
//# sourceMappingURL=components-CWbjrQKA.js.map
|