@facto-to/notifications 0.0.0-stage → 0.1.0-beta.1
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/LICENSE +204 -0
- package/README.md +53 -2
- package/dist/core.d.ts +184 -0
- package/dist/core.js +588 -0
- package/dist/react.d.ts +285 -0
- package/dist/react.js +414 -0
- package/dist/styles.css +1 -0
- package/dist/ui.d.ts +335 -0
- package/dist/ui.js +1124 -0
- package/package.json +88 -4
package/dist/ui.js
ADDED
|
@@ -0,0 +1,1124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as n, jsx as a, Fragment as D } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as st, useId as J, useState as A, useRef as z, useEffect as V } from "react";
|
|
4
|
+
import { IconButton as E, LogoStack as lt, Avatar as X, EmptyState as H, Button as S, Badge as L, Surface as Y, Icon as O, Tabs as K, TabsList as tt, TabsTrigger as at, TabsContent as et, ListSkeleton as nt, ErrorState as ot, Notice as dt, Sheet as ft, SheetContent as ut, SheetClose as ht, SheetDescription as pt, SheetTitle as _t, useToast as Nt } from "@facto-to/design-system";
|
|
5
|
+
import { useOptionalNotificationCenter as it } from "./react.js";
|
|
6
|
+
import { LruDedupeSet as mt } from "./core.js";
|
|
7
|
+
function vt({ size: t = 18, ...e }) {
|
|
8
|
+
return /* @__PURE__ */ n(
|
|
9
|
+
"svg",
|
|
10
|
+
{
|
|
11
|
+
width: t,
|
|
12
|
+
height: t,
|
|
13
|
+
viewBox: "0 0 24 24",
|
|
14
|
+
fill: "none",
|
|
15
|
+
stroke: "currentColor",
|
|
16
|
+
strokeWidth: 1.9,
|
|
17
|
+
strokeLinecap: "round",
|
|
18
|
+
strokeLinejoin: "round",
|
|
19
|
+
"aria-hidden": "true",
|
|
20
|
+
focusable: "false",
|
|
21
|
+
...e,
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ a("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }),
|
|
24
|
+
/* @__PURE__ */ a("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
function gt({ size: t = 14, ...e }) {
|
|
30
|
+
return /* @__PURE__ */ n(
|
|
31
|
+
"svg",
|
|
32
|
+
{
|
|
33
|
+
width: t,
|
|
34
|
+
height: t,
|
|
35
|
+
viewBox: "0 0 24 24",
|
|
36
|
+
fill: "none",
|
|
37
|
+
stroke: "currentColor",
|
|
38
|
+
strokeWidth: 2,
|
|
39
|
+
strokeLinecap: "round",
|
|
40
|
+
strokeLinejoin: "round",
|
|
41
|
+
"aria-hidden": "true",
|
|
42
|
+
focusable: "false",
|
|
43
|
+
...e,
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ a("path", { d: "M5 12h14" }),
|
|
46
|
+
/* @__PURE__ */ a("path", { d: "m12 5 7 7-7 7" })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
function yt({ size: t = 15, ...e }) {
|
|
52
|
+
return /* @__PURE__ */ n(
|
|
53
|
+
"svg",
|
|
54
|
+
{
|
|
55
|
+
width: t,
|
|
56
|
+
height: t,
|
|
57
|
+
viewBox: "0 0 24 24",
|
|
58
|
+
fill: "none",
|
|
59
|
+
stroke: "currentColor",
|
|
60
|
+
strokeWidth: 1.8,
|
|
61
|
+
strokeLinecap: "round",
|
|
62
|
+
strokeLinejoin: "round",
|
|
63
|
+
"aria-hidden": "true",
|
|
64
|
+
focusable: "false",
|
|
65
|
+
...e,
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ a("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
68
|
+
/* @__PURE__ */ a("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
69
|
+
/* @__PURE__ */ a("path", { d: "M8 13h8" }),
|
|
70
|
+
/* @__PURE__ */ a("path", { d: "M8 17h5" })
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
function bt({ size: t = 13, ...e }) {
|
|
76
|
+
return /* @__PURE__ */ n(
|
|
77
|
+
"svg",
|
|
78
|
+
{
|
|
79
|
+
width: t,
|
|
80
|
+
height: t,
|
|
81
|
+
viewBox: "0 0 24 24",
|
|
82
|
+
fill: "none",
|
|
83
|
+
stroke: "currentColor",
|
|
84
|
+
strokeWidth: 2,
|
|
85
|
+
strokeLinecap: "round",
|
|
86
|
+
strokeLinejoin: "round",
|
|
87
|
+
"aria-hidden": "true",
|
|
88
|
+
focusable: "false",
|
|
89
|
+
...e,
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ a("circle", { cx: "12", cy: "12", r: "10" }),
|
|
92
|
+
/* @__PURE__ */ a("path", { d: "M12 6v6l4 2" })
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
function wt({ size: t = 10, ...e }) {
|
|
98
|
+
return /* @__PURE__ */ a(
|
|
99
|
+
"svg",
|
|
100
|
+
{
|
|
101
|
+
width: t,
|
|
102
|
+
height: t,
|
|
103
|
+
viewBox: "0 0 24 24",
|
|
104
|
+
fill: "none",
|
|
105
|
+
stroke: "currentColor",
|
|
106
|
+
strokeWidth: 2.4,
|
|
107
|
+
strokeLinecap: "round",
|
|
108
|
+
strokeLinejoin: "round",
|
|
109
|
+
"aria-hidden": "true",
|
|
110
|
+
focusable: "false",
|
|
111
|
+
...e,
|
|
112
|
+
children: /* @__PURE__ */ a("path", { d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" })
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
function xt({ size: t = 10, ...e }) {
|
|
117
|
+
return /* @__PURE__ */ n(
|
|
118
|
+
"svg",
|
|
119
|
+
{
|
|
120
|
+
width: t,
|
|
121
|
+
height: t,
|
|
122
|
+
viewBox: "0 0 24 24",
|
|
123
|
+
fill: "none",
|
|
124
|
+
stroke: "currentColor",
|
|
125
|
+
strokeWidth: 2.5,
|
|
126
|
+
strokeLinecap: "round",
|
|
127
|
+
strokeLinejoin: "round",
|
|
128
|
+
"aria-hidden": "true",
|
|
129
|
+
focusable: "false",
|
|
130
|
+
...e,
|
|
131
|
+
children: [
|
|
132
|
+
/* @__PURE__ */ a("path", { d: "M12 8v5" }),
|
|
133
|
+
/* @__PURE__ */ a("path", { d: "M12 17h.01" })
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
function kt({ size: t = 10, ...e }) {
|
|
139
|
+
return /* @__PURE__ */ a(
|
|
140
|
+
"svg",
|
|
141
|
+
{
|
|
142
|
+
width: t,
|
|
143
|
+
height: t,
|
|
144
|
+
viewBox: "0 0 24 24",
|
|
145
|
+
fill: "none",
|
|
146
|
+
stroke: "currentColor",
|
|
147
|
+
strokeWidth: 3,
|
|
148
|
+
strokeLinecap: "round",
|
|
149
|
+
strokeLinejoin: "round",
|
|
150
|
+
"aria-hidden": "true",
|
|
151
|
+
focusable: "false",
|
|
152
|
+
...e,
|
|
153
|
+
children: /* @__PURE__ */ a("path", { d: "M20 6 9 17l-5-5" })
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
function Ct({ size: t = 15, ...e }) {
|
|
158
|
+
return /* @__PURE__ */ n(
|
|
159
|
+
"svg",
|
|
160
|
+
{
|
|
161
|
+
width: t,
|
|
162
|
+
height: t,
|
|
163
|
+
viewBox: "0 0 24 24",
|
|
164
|
+
fill: "none",
|
|
165
|
+
stroke: "currentColor",
|
|
166
|
+
strokeWidth: 2,
|
|
167
|
+
strokeLinecap: "round",
|
|
168
|
+
strokeLinejoin: "round",
|
|
169
|
+
"aria-hidden": "true",
|
|
170
|
+
focusable: "false",
|
|
171
|
+
...e,
|
|
172
|
+
children: [
|
|
173
|
+
/* @__PURE__ */ a("circle", { cx: "12", cy: "5", r: "1" }),
|
|
174
|
+
/* @__PURE__ */ a("circle", { cx: "12", cy: "12", r: "1" }),
|
|
175
|
+
/* @__PURE__ */ a("circle", { cx: "12", cy: "19", r: "1" })
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
const P = (...t) => t.filter(Boolean).join(" "), At = st(function({
|
|
181
|
+
variant: e = "dot",
|
|
182
|
+
unreadCount: o,
|
|
183
|
+
hasCritical: r = !1,
|
|
184
|
+
ariaLabel: l,
|
|
185
|
+
open: s,
|
|
186
|
+
size: d = "md",
|
|
187
|
+
className: m,
|
|
188
|
+
...u
|
|
189
|
+
}, c) {
|
|
190
|
+
const i = Number.isFinite(o) ? Math.max(0, Math.floor(o)) : 0, f = i > 99 ? "99+" : String(i), g = l ?? (i > 0 ? `Notifications (${i} unread)` : "Notifications");
|
|
191
|
+
return /* @__PURE__ */ n(
|
|
192
|
+
E,
|
|
193
|
+
{
|
|
194
|
+
...u,
|
|
195
|
+
ref: c,
|
|
196
|
+
size: d,
|
|
197
|
+
ariaLabel: g,
|
|
198
|
+
"aria-expanded": s !== void 0 ? s : u["aria-expanded"],
|
|
199
|
+
className: P(
|
|
200
|
+
"facto-notif-bell",
|
|
201
|
+
s && "facto-notif-bell--open",
|
|
202
|
+
m
|
|
203
|
+
),
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ a(vt, { size: 18 }),
|
|
206
|
+
i > 0 && e === "dot" && /* @__PURE__ */ a("span", { className: "facto-notif-bell__dot", "aria-hidden": "true" }),
|
|
207
|
+
i > 0 && e === "count" && /* @__PURE__ */ a(
|
|
208
|
+
"span",
|
|
209
|
+
{
|
|
210
|
+
className: P(
|
|
211
|
+
"facto-notif-bell__count",
|
|
212
|
+
r && "facto-notif-bell__count--critical"
|
|
213
|
+
),
|
|
214
|
+
"aria-hidden": "true",
|
|
215
|
+
children: f
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
}), W = (...t) => t.filter(Boolean).join(" ");
|
|
222
|
+
function Bt({
|
|
223
|
+
item: t,
|
|
224
|
+
onSelect: e,
|
|
225
|
+
highlighted: o = !1,
|
|
226
|
+
className: r
|
|
227
|
+
}) {
|
|
228
|
+
const l = t.severity === "critical" || t.statusTone === "danger" || t.amountTone === "danger", s = t.contextLabel ?? t.category, d = t.counterpartyLabel !== void 0 ? t.counterpartyLabel : "To:", m = W(
|
|
229
|
+
"facto-surface",
|
|
230
|
+
"facto-notif-tx-card",
|
|
231
|
+
!e && "facto-notif-tx-card--static",
|
|
232
|
+
l && "facto-notif-tx-card--danger",
|
|
233
|
+
o && "facto-notif-tx-card--highlighted",
|
|
234
|
+
r
|
|
235
|
+
), u = t.logos && t.logos.length > 0 ? /* @__PURE__ */ a(
|
|
236
|
+
lt,
|
|
237
|
+
{
|
|
238
|
+
logos: t.logos,
|
|
239
|
+
max: 2,
|
|
240
|
+
size: "md",
|
|
241
|
+
className: "facto-notif-tx-card__logos"
|
|
242
|
+
}
|
|
243
|
+
) : /* @__PURE__ */ a(
|
|
244
|
+
X,
|
|
245
|
+
{
|
|
246
|
+
fallback: t.title.slice(0, 2).toUpperCase(),
|
|
247
|
+
size: "md",
|
|
248
|
+
alt: ""
|
|
249
|
+
}
|
|
250
|
+
), c = /* @__PURE__ */ n(D, { children: [
|
|
251
|
+
/* @__PURE__ */ n("div", { className: "facto-notif-tx-card__top", children: [
|
|
252
|
+
/* @__PURE__ */ n("span", { className: "facto-notif-tx-card__meta", children: [
|
|
253
|
+
/* @__PURE__ */ a("span", { className: "facto-notif-tx-card__verb", children: s }),
|
|
254
|
+
t.statusLabel && /* @__PURE__ */ a(
|
|
255
|
+
"span",
|
|
256
|
+
{
|
|
257
|
+
className: W(
|
|
258
|
+
"facto-notif-tx-card__status",
|
|
259
|
+
t.statusTone === "danger" && "facto-notif-tx-card__status--danger",
|
|
260
|
+
t.statusTone === "success" && "facto-notif-tx-card__status--success"
|
|
261
|
+
),
|
|
262
|
+
children: t.statusLabel
|
|
263
|
+
}
|
|
264
|
+
)
|
|
265
|
+
] }),
|
|
266
|
+
/* @__PURE__ */ n("span", { className: "facto-notif-tx-card__time-wrap", children: [
|
|
267
|
+
/* @__PURE__ */ a("span", { className: "facto-notif-tx-card__time", children: t.timestamp }),
|
|
268
|
+
t.unread && /* @__PURE__ */ n(D, { children: [
|
|
269
|
+
/* @__PURE__ */ a("span", { className: "facto-notif-unread-dot", "aria-hidden": "true" }),
|
|
270
|
+
/* @__PURE__ */ a("span", { className: "facto-visually-hidden", children: "Unread" })
|
|
271
|
+
] })
|
|
272
|
+
] })
|
|
273
|
+
] }),
|
|
274
|
+
/* @__PURE__ */ n("div", { className: "facto-notif-tx-card__body", children: [
|
|
275
|
+
/* @__PURE__ */ n("div", { className: "facto-notif-tx-card__left", children: [
|
|
276
|
+
u,
|
|
277
|
+
/* @__PURE__ */ n("span", { className: "facto-notif-tx-card__entity", children: [
|
|
278
|
+
/* @__PURE__ */ a("span", { className: "facto-notif-tx-card__title", children: t.title }),
|
|
279
|
+
t.subtitle && /* @__PURE__ */ a("span", { className: "facto-notif-tx-card__sub", children: t.subtitle })
|
|
280
|
+
] })
|
|
281
|
+
] }),
|
|
282
|
+
(t.amountDisplay || t.counterparty) && /* @__PURE__ */ n("div", { className: "facto-notif-tx-card__right", children: [
|
|
283
|
+
t.amountDisplay && /* @__PURE__ */ a(
|
|
284
|
+
"span",
|
|
285
|
+
{
|
|
286
|
+
className: W(
|
|
287
|
+
"facto-notif-tx-card__amount",
|
|
288
|
+
t.amountTone === "positive" && "facto-notif-tx-card__amount--positive",
|
|
289
|
+
t.amountTone === "danger" && "facto-notif-tx-card__amount--danger"
|
|
290
|
+
),
|
|
291
|
+
children: t.amountDisplay
|
|
292
|
+
}
|
|
293
|
+
),
|
|
294
|
+
t.counterparty && /* @__PURE__ */ n("span", { className: "facto-notif-tx-card__route", children: [
|
|
295
|
+
d ? `${d} ` : "",
|
|
296
|
+
/* @__PURE__ */ a("span", { className: "facto-notif-tx-card__route-target", children: t.counterparty })
|
|
297
|
+
] })
|
|
298
|
+
] })
|
|
299
|
+
] })
|
|
300
|
+
] });
|
|
301
|
+
return e ? /* @__PURE__ */ a(
|
|
302
|
+
"button",
|
|
303
|
+
{
|
|
304
|
+
type: "button",
|
|
305
|
+
className: m,
|
|
306
|
+
onClick: () => e(t),
|
|
307
|
+
children: c
|
|
308
|
+
}
|
|
309
|
+
) : /* @__PURE__ */ a("div", { className: m, children: c });
|
|
310
|
+
}
|
|
311
|
+
function Lt({
|
|
312
|
+
items: t,
|
|
313
|
+
onSelect: e,
|
|
314
|
+
highlightedKey: o,
|
|
315
|
+
defaultDayLabel: r = "Today",
|
|
316
|
+
emptyTitle: l = "No notifications",
|
|
317
|
+
emptyDescription: s = "New activity will appear here automatically.",
|
|
318
|
+
className: d
|
|
319
|
+
}) {
|
|
320
|
+
if (t.length === 0)
|
|
321
|
+
return /* @__PURE__ */ a(H, { title: l, description: s });
|
|
322
|
+
const m = [], u = /* @__PURE__ */ new Map();
|
|
323
|
+
for (const c of t) {
|
|
324
|
+
const i = c.dayGroup || r;
|
|
325
|
+
let f = u.get(i);
|
|
326
|
+
f || (f = [], u.set(i, f), m.push({ label: i, items: f })), f.push(c);
|
|
327
|
+
}
|
|
328
|
+
return /* @__PURE__ */ a("div", { className: W("facto-notif-tx-groups", d), children: m.map((c) => /* @__PURE__ */ n(
|
|
329
|
+
"section",
|
|
330
|
+
{
|
|
331
|
+
className: "facto-notif-tx-group",
|
|
332
|
+
"aria-label": c.label,
|
|
333
|
+
children: [
|
|
334
|
+
/* @__PURE__ */ a("p", { className: "facto-notif-day-label", children: c.label }),
|
|
335
|
+
/* @__PURE__ */ a("ul", { className: "facto-notif-tx-list", children: c.items.map((i) => {
|
|
336
|
+
const f = !!(o && (i.aggregationKey === o || i.id === o));
|
|
337
|
+
return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
338
|
+
Bt,
|
|
339
|
+
{
|
|
340
|
+
item: i,
|
|
341
|
+
onSelect: e,
|
|
342
|
+
highlighted: f
|
|
343
|
+
}
|
|
344
|
+
) }, i.id);
|
|
345
|
+
}) })
|
|
346
|
+
]
|
|
347
|
+
},
|
|
348
|
+
c.label
|
|
349
|
+
)) });
|
|
350
|
+
}
|
|
351
|
+
const Q = (...t) => t.filter(Boolean).join(" ");
|
|
352
|
+
function Tt(t) {
|
|
353
|
+
const e = t.trim();
|
|
354
|
+
if (!e) return "N";
|
|
355
|
+
const o = e.includes("@") ? e.split("@")[0] : e, r = o.split(/[\s._-]+/).filter(Boolean);
|
|
356
|
+
return r.length >= 2 ? `${r[0][0] ?? ""}${r[1][0] ?? ""}`.toUpperCase() : o.slice(0, 2).toUpperCase();
|
|
357
|
+
}
|
|
358
|
+
function St(t) {
|
|
359
|
+
return t === "success" || t === "warning" || t === "danger" ? t : "neutral";
|
|
360
|
+
}
|
|
361
|
+
function ct({
|
|
362
|
+
item: t,
|
|
363
|
+
highlighted: e = !1,
|
|
364
|
+
inlineActions: o,
|
|
365
|
+
onSelect: r,
|
|
366
|
+
onAttachmentClick: l,
|
|
367
|
+
onReplySubmit: s,
|
|
368
|
+
replyPlaceholder: d = "Add a note…",
|
|
369
|
+
className: m
|
|
370
|
+
}) {
|
|
371
|
+
const u = J(), [c, i] = A(""), f = t.mandatory || t.mode === "mandatory_security" || t.severity === "critical", g = t.severity === "success", v = Tt(t.actorName ?? t.title), p = [t.timestamp];
|
|
372
|
+
t.contextLabel && p.push(t.contextLabel), t.occurrenceCount && t.occurrenceCount > 1 && p.push(`x${t.occurrenceCount}`);
|
|
373
|
+
function y(h) {
|
|
374
|
+
h.preventDefault();
|
|
375
|
+
const b = c.trim();
|
|
376
|
+
!b || !s || (s(t, b), i(""));
|
|
377
|
+
}
|
|
378
|
+
return /* @__PURE__ */ n(
|
|
379
|
+
"li",
|
|
380
|
+
{
|
|
381
|
+
className: Q(
|
|
382
|
+
"facto-notif-row",
|
|
383
|
+
e && "facto-notif-row--highlighted",
|
|
384
|
+
m
|
|
385
|
+
),
|
|
386
|
+
children: [
|
|
387
|
+
/* @__PURE__ */ n("div", { className: "facto-notif-row__avatar-wrap", "aria-hidden": "true", children: [
|
|
388
|
+
/* @__PURE__ */ a(
|
|
389
|
+
X,
|
|
390
|
+
{
|
|
391
|
+
src: t.actorAvatarUrl,
|
|
392
|
+
alt: "",
|
|
393
|
+
fallback: v,
|
|
394
|
+
size: "md",
|
|
395
|
+
className: "facto-notif-row__avatar"
|
|
396
|
+
}
|
|
397
|
+
),
|
|
398
|
+
/* @__PURE__ */ a(
|
|
399
|
+
"span",
|
|
400
|
+
{
|
|
401
|
+
className: Q(
|
|
402
|
+
"facto-notif-row__avatar-badge",
|
|
403
|
+
f && "facto-notif-row__avatar-badge--danger",
|
|
404
|
+
!f && g && "facto-notif-row__avatar-badge--success"
|
|
405
|
+
),
|
|
406
|
+
children: t.mandatory || t.mode === "mandatory_security" ? /* @__PURE__ */ a(wt, {}) : f ? /* @__PURE__ */ a(xt, {}) : /* @__PURE__ */ a(kt, {})
|
|
407
|
+
}
|
|
408
|
+
)
|
|
409
|
+
] }),
|
|
410
|
+
/* @__PURE__ */ n("div", { className: "facto-notif-row__content", children: [
|
|
411
|
+
/* @__PURE__ */ a("div", { className: "facto-notif-row__meta", children: p.join(" · ") }),
|
|
412
|
+
/* @__PURE__ */ n("p", { className: "facto-notif-row__headline", children: [
|
|
413
|
+
t.actorName && /* @__PURE__ */ n(D, { children: [
|
|
414
|
+
/* @__PURE__ */ a("strong", { className: "facto-notif-row__actor", children: t.actorName }),
|
|
415
|
+
" "
|
|
416
|
+
] }),
|
|
417
|
+
r ? /* @__PURE__ */ a(
|
|
418
|
+
"button",
|
|
419
|
+
{
|
|
420
|
+
type: "button",
|
|
421
|
+
className: "facto-notif-row__title-link",
|
|
422
|
+
onClick: () => r(t),
|
|
423
|
+
children: t.title
|
|
424
|
+
}
|
|
425
|
+
) : /* @__PURE__ */ a("span", { className: "facto-notif-row__title-text", children: t.title }),
|
|
426
|
+
t.unread && /* @__PURE__ */ n(D, { children: [
|
|
427
|
+
/* @__PURE__ */ a(
|
|
428
|
+
"span",
|
|
429
|
+
{
|
|
430
|
+
className: "facto-notif-unread-dot facto-notif-row__unread-dot",
|
|
431
|
+
"aria-hidden": "true"
|
|
432
|
+
}
|
|
433
|
+
),
|
|
434
|
+
/* @__PURE__ */ a("span", { className: "facto-visually-hidden", children: "Unread" })
|
|
435
|
+
] })
|
|
436
|
+
] }),
|
|
437
|
+
t.description && !t.quoteBody && /* @__PURE__ */ a("p", { className: "facto-notif-row__desc", children: t.description }),
|
|
438
|
+
t.quoteBody && /* @__PURE__ */ n("div", { className: "facto-notif-quote-box", children: [
|
|
439
|
+
/* @__PURE__ */ n("p", { className: "facto-notif-quote-text", children: [
|
|
440
|
+
t.quoteMention && /* @__PURE__ */ n(D, { children: [
|
|
441
|
+
/* @__PURE__ */ a("span", { className: "facto-notif-quote-mention", children: t.quoteMention }),
|
|
442
|
+
" "
|
|
443
|
+
] }),
|
|
444
|
+
t.quoteBody
|
|
445
|
+
] }),
|
|
446
|
+
s && /* @__PURE__ */ n(
|
|
447
|
+
"form",
|
|
448
|
+
{
|
|
449
|
+
className: "facto-notif-reply-form",
|
|
450
|
+
onSubmit: y,
|
|
451
|
+
children: [
|
|
452
|
+
/* @__PURE__ */ a("label", { className: "facto-visually-hidden", htmlFor: u, children: d }),
|
|
453
|
+
/* @__PURE__ */ a(
|
|
454
|
+
"input",
|
|
455
|
+
{
|
|
456
|
+
id: u,
|
|
457
|
+
type: "text",
|
|
458
|
+
className: "facto-input facto-notif-reply-input",
|
|
459
|
+
placeholder: d,
|
|
460
|
+
value: c,
|
|
461
|
+
onChange: (h) => i(h.target.value)
|
|
462
|
+
}
|
|
463
|
+
),
|
|
464
|
+
/* @__PURE__ */ a(
|
|
465
|
+
S,
|
|
466
|
+
{
|
|
467
|
+
type: "submit",
|
|
468
|
+
variant: "secondary",
|
|
469
|
+
size: "sm",
|
|
470
|
+
className: "facto-notif-reply-submit",
|
|
471
|
+
"aria-label": "Send note",
|
|
472
|
+
children: "↵"
|
|
473
|
+
}
|
|
474
|
+
)
|
|
475
|
+
]
|
|
476
|
+
}
|
|
477
|
+
)
|
|
478
|
+
] }),
|
|
479
|
+
o && o.length > 0 && /* @__PURE__ */ a("div", { className: "facto-notif-actions", children: o.map((h, b) => /* @__PURE__ */ a(
|
|
480
|
+
S,
|
|
481
|
+
{
|
|
482
|
+
variant: h.variant ?? "secondary",
|
|
483
|
+
size: "sm",
|
|
484
|
+
disabled: h.disabled,
|
|
485
|
+
loading: h.loading,
|
|
486
|
+
onClick: () => h.onClick(t),
|
|
487
|
+
children: h.label
|
|
488
|
+
},
|
|
489
|
+
`${h.label}-${b}`
|
|
490
|
+
)) }),
|
|
491
|
+
t.stateTransition && /* @__PURE__ */ n(D, { children: [
|
|
492
|
+
/* @__PURE__ */ n("div", { className: "facto-notif-state-diff", children: [
|
|
493
|
+
/* @__PURE__ */ a(L, { tone: "neutral", children: t.stateTransition.from }),
|
|
494
|
+
/* @__PURE__ */ a("span", { className: "facto-notif-state-arrow", "aria-hidden": "true", children: /* @__PURE__ */ a(gt, {}) }),
|
|
495
|
+
/* @__PURE__ */ a(L, { tone: St(t.stateTransition.toTone), children: t.stateTransition.to })
|
|
496
|
+
] }),
|
|
497
|
+
t.stateTransition.meta && /* @__PURE__ */ n("div", { className: "facto-notif-state-meta", children: [
|
|
498
|
+
/* @__PURE__ */ a(bt, {}),
|
|
499
|
+
/* @__PURE__ */ a("span", { children: t.stateTransition.meta })
|
|
500
|
+
] })
|
|
501
|
+
] }),
|
|
502
|
+
t.attachment && /* @__PURE__ */ n("div", { className: "facto-notif-attachment", children: [
|
|
503
|
+
/* @__PURE__ */ n("div", { className: "facto-notif-attachment__left", children: [
|
|
504
|
+
/* @__PURE__ */ a("span", { className: "facto-notif-attachment__icon", "aria-hidden": "true", children: /* @__PURE__ */ a(yt, {}) }),
|
|
505
|
+
/* @__PURE__ */ n("span", { className: "facto-notif-attachment__meta", children: [
|
|
506
|
+
/* @__PURE__ */ a("span", { className: "facto-notif-attachment__name", children: t.attachment.name }),
|
|
507
|
+
t.attachment.meta && /* @__PURE__ */ a("span", { className: "facto-notif-attachment__sub", children: t.attachment.meta })
|
|
508
|
+
] })
|
|
509
|
+
] }),
|
|
510
|
+
l && /* @__PURE__ */ a(
|
|
511
|
+
E,
|
|
512
|
+
{
|
|
513
|
+
size: "sm",
|
|
514
|
+
ariaLabel: `Inspect ${t.attachment.name}`,
|
|
515
|
+
onClick: () => l(t),
|
|
516
|
+
children: /* @__PURE__ */ a(Ct, {})
|
|
517
|
+
}
|
|
518
|
+
)
|
|
519
|
+
] })
|
|
520
|
+
] })
|
|
521
|
+
]
|
|
522
|
+
}
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
const Z = (...t) => t.filter(Boolean).join(" ");
|
|
526
|
+
function Et({
|
|
527
|
+
title: t = "Notification",
|
|
528
|
+
items: e,
|
|
529
|
+
tabs: o,
|
|
530
|
+
activeTab: r,
|
|
531
|
+
defaultTab: l,
|
|
532
|
+
onTabChange: s,
|
|
533
|
+
onMarkAllRead: d,
|
|
534
|
+
markAllReadLabel: m = "Mark all as read",
|
|
535
|
+
markAllReadDisabled: u = !1,
|
|
536
|
+
loading: c = !1,
|
|
537
|
+
error: i,
|
|
538
|
+
onRetry: f,
|
|
539
|
+
emptyTitle: g = "No notifications in this view",
|
|
540
|
+
emptyDescription: v = "All caught up for the current scope.",
|
|
541
|
+
highlightedKey: p,
|
|
542
|
+
renderRow: y,
|
|
543
|
+
getRowActions: h,
|
|
544
|
+
onSelectItem: b,
|
|
545
|
+
onAttachmentClick: C,
|
|
546
|
+
onReplySubmit: F,
|
|
547
|
+
headerEnd: M,
|
|
548
|
+
className: j
|
|
549
|
+
}) {
|
|
550
|
+
const T = J(), B = l ?? o?.[0]?.id ?? "all", [q, G] = A(B), U = r ?? q;
|
|
551
|
+
function w(_) {
|
|
552
|
+
r === void 0 && G(_), s?.(_);
|
|
553
|
+
}
|
|
554
|
+
function $(_) {
|
|
555
|
+
return c ? /* @__PURE__ */ a("div", { className: "facto-notif-feed__state", children: /* @__PURE__ */ a(nt, { rows: 4, label: "Loading notifications" }) }) : i ? /* @__PURE__ */ a("div", { className: "facto-notif-feed__state", children: /* @__PURE__ */ a(
|
|
556
|
+
ot,
|
|
557
|
+
{
|
|
558
|
+
title: "Unable to load notifications",
|
|
559
|
+
description: i,
|
|
560
|
+
onRetry: f
|
|
561
|
+
}
|
|
562
|
+
) }) : _.length === 0 ? /* @__PURE__ */ a(H, { title: g, description: v }) : /* @__PURE__ */ a("ul", { className: "facto-notif-feed__list", children: _.map((x) => {
|
|
563
|
+
if (y)
|
|
564
|
+
return /* @__PURE__ */ a("li", { className: "facto-notif-row", children: y(x) }, x.id);
|
|
565
|
+
const I = !!(p && (x.aggregationKey === p || x.id === p));
|
|
566
|
+
return /* @__PURE__ */ a(
|
|
567
|
+
ct,
|
|
568
|
+
{
|
|
569
|
+
item: x,
|
|
570
|
+
highlighted: I,
|
|
571
|
+
inlineActions: h?.(x),
|
|
572
|
+
onSelect: b,
|
|
573
|
+
onAttachmentClick: C,
|
|
574
|
+
onReplySubmit: F
|
|
575
|
+
},
|
|
576
|
+
x.id
|
|
577
|
+
);
|
|
578
|
+
}) });
|
|
579
|
+
}
|
|
580
|
+
return /* @__PURE__ */ n(
|
|
581
|
+
Y,
|
|
582
|
+
{
|
|
583
|
+
padding: "none",
|
|
584
|
+
className: Z("facto-notif-feed", j),
|
|
585
|
+
"aria-labelledby": T,
|
|
586
|
+
children: [
|
|
587
|
+
/* @__PURE__ */ n("div", { className: "facto-notif-feed__header", children: [
|
|
588
|
+
/* @__PURE__ */ a("h2", { id: T, className: "facto-notif-feed__title", children: t }),
|
|
589
|
+
/* @__PURE__ */ n("div", { className: "facto-notif-feed__header-actions", children: [
|
|
590
|
+
d && /* @__PURE__ */ a(
|
|
591
|
+
S,
|
|
592
|
+
{
|
|
593
|
+
variant: "text",
|
|
594
|
+
size: "sm",
|
|
595
|
+
disabled: u,
|
|
596
|
+
leadingIcon: /* @__PURE__ */ a(O, { name: "check", size: 14 }),
|
|
597
|
+
className: "facto-notif-mark-all",
|
|
598
|
+
onClick: d,
|
|
599
|
+
children: m
|
|
600
|
+
}
|
|
601
|
+
),
|
|
602
|
+
M
|
|
603
|
+
] })
|
|
604
|
+
] }),
|
|
605
|
+
o && o.length > 0 ? /* @__PURE__ */ n(K, { value: U, onValueChange: w, children: [
|
|
606
|
+
/* @__PURE__ */ a(
|
|
607
|
+
tt,
|
|
608
|
+
{
|
|
609
|
+
className: "facto-notif-tabs-list",
|
|
610
|
+
"aria-label": "Notification categories",
|
|
611
|
+
children: o.map((_) => /* @__PURE__ */ n(
|
|
612
|
+
at,
|
|
613
|
+
{
|
|
614
|
+
value: _.id,
|
|
615
|
+
className: "facto-notif-tabs-trigger",
|
|
616
|
+
children: [
|
|
617
|
+
/* @__PURE__ */ a("span", { children: _.label }),
|
|
618
|
+
_.count !== void 0 && _.count > 0 && /* @__PURE__ */ a(
|
|
619
|
+
"span",
|
|
620
|
+
{
|
|
621
|
+
className: Z(
|
|
622
|
+
"facto-notif-tab-count",
|
|
623
|
+
_.critical && "facto-notif-tab-count--danger"
|
|
624
|
+
),
|
|
625
|
+
children: _.count > 99 ? "99+" : _.count
|
|
626
|
+
}
|
|
627
|
+
)
|
|
628
|
+
]
|
|
629
|
+
},
|
|
630
|
+
_.id
|
|
631
|
+
))
|
|
632
|
+
}
|
|
633
|
+
),
|
|
634
|
+
o.map((_) => {
|
|
635
|
+
const x = _.filter ? e.filter(_.filter) : e;
|
|
636
|
+
return /* @__PURE__ */ a(
|
|
637
|
+
et,
|
|
638
|
+
{
|
|
639
|
+
value: _.id,
|
|
640
|
+
className: "facto-notif-tabs-content",
|
|
641
|
+
children: $(x)
|
|
642
|
+
},
|
|
643
|
+
_.id
|
|
644
|
+
);
|
|
645
|
+
})
|
|
646
|
+
] }) : $(e)
|
|
647
|
+
]
|
|
648
|
+
}
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
const Mt = (...t) => t.filter(Boolean).join(" ");
|
|
652
|
+
function Ht({
|
|
653
|
+
item: t,
|
|
654
|
+
currentOperator: e,
|
|
655
|
+
onClaim: o,
|
|
656
|
+
onResolve: r,
|
|
657
|
+
onSelect: l,
|
|
658
|
+
busy: s = !1,
|
|
659
|
+
claimLabel: d = "Claim",
|
|
660
|
+
resolveLabel: m = "Resolve",
|
|
661
|
+
className: u
|
|
662
|
+
}) {
|
|
663
|
+
const c = t.claimStatus ?? "open", i = t.occurrenceCount ?? 1, f = c === "claimed" && !!t.claimedBy && (!e || t.claimedBy !== e), g = c === "resolved" || c === "suppressed", v = [t.timestamp];
|
|
664
|
+
return t.contextLabel && v.push(t.contextLabel), t.subtitle && v.push(t.subtitle), /* @__PURE__ */ n(Y, { padding: "none", className: Mt("facto-notif-action-queue", u), children: [
|
|
665
|
+
/* @__PURE__ */ n("div", { className: "facto-notif-action-queue__top", children: [
|
|
666
|
+
/* @__PURE__ */ n("div", { className: "facto-notif-action-queue__copy", children: [
|
|
667
|
+
/* @__PURE__ */ a("h3", { className: "facto-notif-action-queue__title", children: l ? /* @__PURE__ */ a(
|
|
668
|
+
"button",
|
|
669
|
+
{
|
|
670
|
+
type: "button",
|
|
671
|
+
className: "facto-notif-row__title-link",
|
|
672
|
+
onClick: () => l(t),
|
|
673
|
+
children: t.title
|
|
674
|
+
}
|
|
675
|
+
) : t.title }),
|
|
676
|
+
/* @__PURE__ */ a("p", { className: "facto-notif-action-queue__sub", children: v.join(" · ") })
|
|
677
|
+
] }),
|
|
678
|
+
/* @__PURE__ */ n("div", { className: "facto-notif-action-queue__badges", children: [
|
|
679
|
+
i > 1 && /* @__PURE__ */ n(L, { tone: t.severity === "critical" ? "danger" : "neutral", children: [
|
|
680
|
+
"x",
|
|
681
|
+
i
|
|
682
|
+
] }),
|
|
683
|
+
c === "resolved" && /* @__PURE__ */ a(L, { tone: "success", children: "Resolved" }),
|
|
684
|
+
c === "suppressed" && /* @__PURE__ */ a(L, { tone: "neutral", children: "Suppressed" }),
|
|
685
|
+
c === "claimed" && /* @__PURE__ */ a(L, { tone: "neutral", children: t.claimedBy ? `Claimed by ${t.claimedBy}` : "Claimed" }),
|
|
686
|
+
c === "open" && /* @__PURE__ */ a(L, { tone: t.severity === "critical" ? "danger" : "neutral", children: "Open" })
|
|
687
|
+
] })
|
|
688
|
+
] }),
|
|
689
|
+
t.description && /* @__PURE__ */ a("p", { className: "facto-notif-row__desc", children: t.description }),
|
|
690
|
+
/* @__PURE__ */ n("div", { className: "facto-notif-action-queue__footer", children: [
|
|
691
|
+
/* @__PURE__ */ a("span", { className: "facto-notif-action-queue__claimer", children: t.claimedBy ? `Owner: ${t.claimedBy}` : g ? "Completed" : "Unassigned" }),
|
|
692
|
+
!g && (o || r) && /* @__PURE__ */ n("div", { className: "facto-notif-action-queue__actions", children: [
|
|
693
|
+
r && /* @__PURE__ */ a(
|
|
694
|
+
S,
|
|
695
|
+
{
|
|
696
|
+
variant: "secondary",
|
|
697
|
+
size: "sm",
|
|
698
|
+
disabled: s || f,
|
|
699
|
+
onClick: () => r(t.id),
|
|
700
|
+
children: m
|
|
701
|
+
}
|
|
702
|
+
),
|
|
703
|
+
o && c === "open" && /* @__PURE__ */ a(
|
|
704
|
+
S,
|
|
705
|
+
{
|
|
706
|
+
variant: "primary",
|
|
707
|
+
size: "sm",
|
|
708
|
+
disabled: s,
|
|
709
|
+
onClick: () => o(t.id),
|
|
710
|
+
children: d
|
|
711
|
+
}
|
|
712
|
+
)
|
|
713
|
+
] })
|
|
714
|
+
] })
|
|
715
|
+
] });
|
|
716
|
+
}
|
|
717
|
+
const jt = (...t) => t.filter(Boolean).join(" ");
|
|
718
|
+
function Ot({
|
|
719
|
+
tone: t = "danger",
|
|
720
|
+
title: e,
|
|
721
|
+
description: o,
|
|
722
|
+
occurrenceCount: r,
|
|
723
|
+
occurrenceLabel: l,
|
|
724
|
+
actionLabel: s,
|
|
725
|
+
onAction: d,
|
|
726
|
+
actionDisabled: m = !1,
|
|
727
|
+
secondaryAction: u,
|
|
728
|
+
className: c
|
|
729
|
+
}) {
|
|
730
|
+
const i = !!l || typeof r == "number" && r > 1, f = l ?? (r ? `x${r}` : null);
|
|
731
|
+
return /* @__PURE__ */ a(
|
|
732
|
+
dt,
|
|
733
|
+
{
|
|
734
|
+
tone: t,
|
|
735
|
+
title: e,
|
|
736
|
+
description: o,
|
|
737
|
+
action: i || !!(s && d) || !!u ? /* @__PURE__ */ n("div", { className: "facto-notif-incident__actions", children: [
|
|
738
|
+
i && f && /* @__PURE__ */ a(
|
|
739
|
+
L,
|
|
740
|
+
{
|
|
741
|
+
tone: t === "danger" ? "danger" : "neutral",
|
|
742
|
+
className: "facto-notif-incident__count",
|
|
743
|
+
children: f
|
|
744
|
+
}
|
|
745
|
+
),
|
|
746
|
+
u,
|
|
747
|
+
s && d && /* @__PURE__ */ a(
|
|
748
|
+
S,
|
|
749
|
+
{
|
|
750
|
+
variant: "secondary",
|
|
751
|
+
size: "sm",
|
|
752
|
+
disabled: m,
|
|
753
|
+
className: "facto-notif-incident__btn",
|
|
754
|
+
onClick: d,
|
|
755
|
+
children: s
|
|
756
|
+
}
|
|
757
|
+
)
|
|
758
|
+
] }) : void 0,
|
|
759
|
+
className: jt("facto-notif-incident", c)
|
|
760
|
+
}
|
|
761
|
+
);
|
|
762
|
+
}
|
|
763
|
+
const R = (...t) => t.filter(Boolean).join(" ");
|
|
764
|
+
function qt(t) {
|
|
765
|
+
switch (t) {
|
|
766
|
+
case "open":
|
|
767
|
+
return "Live";
|
|
768
|
+
case "connecting":
|
|
769
|
+
return "Connecting";
|
|
770
|
+
case "reconnecting":
|
|
771
|
+
return "Reconnecting";
|
|
772
|
+
case "revoked":
|
|
773
|
+
return "Session revoked";
|
|
774
|
+
case "closed":
|
|
775
|
+
return "Disconnected";
|
|
776
|
+
default:
|
|
777
|
+
return "Idle";
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
function $t({
|
|
781
|
+
title: t = "Notifications",
|
|
782
|
+
titleNode: e,
|
|
783
|
+
descriptionNode: o,
|
|
784
|
+
closeNode: r,
|
|
785
|
+
variant: l = "workspace",
|
|
786
|
+
items: s,
|
|
787
|
+
streamStatus: d,
|
|
788
|
+
loading: m = !1,
|
|
789
|
+
error: u,
|
|
790
|
+
onRetry: c,
|
|
791
|
+
onMarkAllRead: i,
|
|
792
|
+
markAllReadLabel: f = "Mark all as read",
|
|
793
|
+
onSelectItem: g,
|
|
794
|
+
onAttachmentClick: v,
|
|
795
|
+
onReplySubmit: p,
|
|
796
|
+
tabs: y,
|
|
797
|
+
activeTab: h,
|
|
798
|
+
defaultTab: b,
|
|
799
|
+
onTabChange: C,
|
|
800
|
+
getRowActions: F,
|
|
801
|
+
renderItem: M,
|
|
802
|
+
emptyTitle: j = "No notifications",
|
|
803
|
+
emptyDescription: T = "All caught up for the current scope.",
|
|
804
|
+
highlightedKey: B,
|
|
805
|
+
footer: q,
|
|
806
|
+
className: G
|
|
807
|
+
}) {
|
|
808
|
+
const U = b ?? y?.[0]?.id ?? "all", [w, $] = A(U), _ = h ?? w;
|
|
809
|
+
function x(N) {
|
|
810
|
+
h === void 0 && $(N), C?.(N);
|
|
811
|
+
}
|
|
812
|
+
function I(N) {
|
|
813
|
+
return m ? /* @__PURE__ */ a("div", { className: "facto-notif-feed__state", children: /* @__PURE__ */ a(nt, { rows: 4, label: "Loading notifications" }) }) : u ? /* @__PURE__ */ a("div", { className: "facto-notif-feed__state", children: /* @__PURE__ */ a(
|
|
814
|
+
ot,
|
|
815
|
+
{
|
|
816
|
+
title: "Unable to load notifications",
|
|
817
|
+
description: u,
|
|
818
|
+
onRetry: c
|
|
819
|
+
}
|
|
820
|
+
) }) : N.length === 0 ? /* @__PURE__ */ a(H, { title: j, description: T }) : M ? /* @__PURE__ */ a("ul", { className: "facto-notif-feed__list", children: N.map((k) => /* @__PURE__ */ a("li", { className: "facto-notif-row", children: M(k) }, k.id)) }) : l === "transactions" ? /* @__PURE__ */ a(
|
|
821
|
+
Lt,
|
|
822
|
+
{
|
|
823
|
+
items: N,
|
|
824
|
+
onSelect: g,
|
|
825
|
+
highlightedKey: B,
|
|
826
|
+
emptyTitle: j,
|
|
827
|
+
emptyDescription: T
|
|
828
|
+
}
|
|
829
|
+
) : /* @__PURE__ */ a("ul", { className: "facto-notif-feed__list", children: N.map((k) => {
|
|
830
|
+
const rt = !!(B && (k.aggregationKey === B || k.id === B));
|
|
831
|
+
return /* @__PURE__ */ a(
|
|
832
|
+
ct,
|
|
833
|
+
{
|
|
834
|
+
item: k,
|
|
835
|
+
highlighted: rt,
|
|
836
|
+
inlineActions: F?.(k),
|
|
837
|
+
onSelect: g,
|
|
838
|
+
onAttachmentClick: v,
|
|
839
|
+
onReplySubmit: p
|
|
840
|
+
},
|
|
841
|
+
k.id
|
|
842
|
+
);
|
|
843
|
+
}) });
|
|
844
|
+
}
|
|
845
|
+
return /* @__PURE__ */ n(
|
|
846
|
+
"div",
|
|
847
|
+
{
|
|
848
|
+
className: R(
|
|
849
|
+
"facto-notif-drawer-panel",
|
|
850
|
+
l === "transactions" && "facto-notif-drawer-panel--transactions",
|
|
851
|
+
G
|
|
852
|
+
),
|
|
853
|
+
children: [
|
|
854
|
+
/* @__PURE__ */ n("div", { className: "facto-notif-drawer__header", children: [
|
|
855
|
+
/* @__PURE__ */ n("div", { className: "facto-notif-drawer__heading", children: [
|
|
856
|
+
e ?? /* @__PURE__ */ a("h2", { className: "facto-notif-drawer__title", children: t }),
|
|
857
|
+
o,
|
|
858
|
+
d && /* @__PURE__ */ n("span", { className: "facto-notif-drawer__status", children: [
|
|
859
|
+
/* @__PURE__ */ a(
|
|
860
|
+
"span",
|
|
861
|
+
{
|
|
862
|
+
className: R(
|
|
863
|
+
"facto-notif-stream-dot",
|
|
864
|
+
d === "open" && "facto-notif-stream-dot--open",
|
|
865
|
+
d === "revoked" && "facto-notif-stream-dot--revoked"
|
|
866
|
+
),
|
|
867
|
+
"aria-hidden": "true"
|
|
868
|
+
}
|
|
869
|
+
),
|
|
870
|
+
/* @__PURE__ */ a("span", { children: qt(d) })
|
|
871
|
+
] })
|
|
872
|
+
] }),
|
|
873
|
+
/* @__PURE__ */ n("div", { className: "facto-notif-drawer__controls", children: [
|
|
874
|
+
i && /* @__PURE__ */ a(
|
|
875
|
+
S,
|
|
876
|
+
{
|
|
877
|
+
variant: "text",
|
|
878
|
+
size: "sm",
|
|
879
|
+
leadingIcon: /* @__PURE__ */ a(O, { name: "check", size: 14 }),
|
|
880
|
+
className: "facto-notif-mark-all",
|
|
881
|
+
onClick: i,
|
|
882
|
+
children: f
|
|
883
|
+
}
|
|
884
|
+
),
|
|
885
|
+
r
|
|
886
|
+
] })
|
|
887
|
+
] }),
|
|
888
|
+
y && y.length > 0 ? /* @__PURE__ */ n(
|
|
889
|
+
K,
|
|
890
|
+
{
|
|
891
|
+
value: _,
|
|
892
|
+
onValueChange: x,
|
|
893
|
+
className: "facto-notif-drawer__body",
|
|
894
|
+
children: [
|
|
895
|
+
/* @__PURE__ */ a(
|
|
896
|
+
tt,
|
|
897
|
+
{
|
|
898
|
+
className: "facto-notif-tabs-list",
|
|
899
|
+
"aria-label": "Notification categories",
|
|
900
|
+
children: y.map((N) => /* @__PURE__ */ n(
|
|
901
|
+
at,
|
|
902
|
+
{
|
|
903
|
+
value: N.id,
|
|
904
|
+
className: "facto-notif-tabs-trigger",
|
|
905
|
+
children: [
|
|
906
|
+
/* @__PURE__ */ a("span", { children: N.label }),
|
|
907
|
+
N.count !== void 0 && N.count > 0 && /* @__PURE__ */ a(
|
|
908
|
+
"span",
|
|
909
|
+
{
|
|
910
|
+
className: R(
|
|
911
|
+
"facto-notif-tab-count",
|
|
912
|
+
N.critical && "facto-notif-tab-count--danger"
|
|
913
|
+
),
|
|
914
|
+
children: N.count > 99 ? "99+" : N.count
|
|
915
|
+
}
|
|
916
|
+
)
|
|
917
|
+
]
|
|
918
|
+
},
|
|
919
|
+
N.id
|
|
920
|
+
))
|
|
921
|
+
}
|
|
922
|
+
),
|
|
923
|
+
y.map((N) => {
|
|
924
|
+
const k = N.filter ? s.filter(N.filter) : s;
|
|
925
|
+
return /* @__PURE__ */ a(
|
|
926
|
+
et,
|
|
927
|
+
{
|
|
928
|
+
value: N.id,
|
|
929
|
+
className: R(
|
|
930
|
+
"facto-notif-tabs-content",
|
|
931
|
+
l === "transactions" && "facto-notif-drawer__body--transactions"
|
|
932
|
+
),
|
|
933
|
+
children: I(k)
|
|
934
|
+
},
|
|
935
|
+
N.id
|
|
936
|
+
);
|
|
937
|
+
})
|
|
938
|
+
]
|
|
939
|
+
}
|
|
940
|
+
) : /* @__PURE__ */ a(
|
|
941
|
+
"div",
|
|
942
|
+
{
|
|
943
|
+
className: R(
|
|
944
|
+
"facto-notif-drawer__body",
|
|
945
|
+
l === "transactions" && "facto-notif-drawer__body--transactions"
|
|
946
|
+
),
|
|
947
|
+
children: I(s)
|
|
948
|
+
}
|
|
949
|
+
),
|
|
950
|
+
q && /* @__PURE__ */ a("div", { className: "facto-notif-drawer__footer", children: q })
|
|
951
|
+
]
|
|
952
|
+
}
|
|
953
|
+
);
|
|
954
|
+
}
|
|
955
|
+
function Vt({
|
|
956
|
+
open: t,
|
|
957
|
+
onOpenChange: e,
|
|
958
|
+
title: o = "Notifications",
|
|
959
|
+
description: r = "Recent notifications and realtime activity updates.",
|
|
960
|
+
variant: l = "workspace",
|
|
961
|
+
items: s,
|
|
962
|
+
streamStatus: d,
|
|
963
|
+
loading: m,
|
|
964
|
+
error: u,
|
|
965
|
+
onRetry: c,
|
|
966
|
+
onMarkAllRead: i,
|
|
967
|
+
markAllReadLabel: f,
|
|
968
|
+
onSelectItem: g,
|
|
969
|
+
onAttachmentClick: v,
|
|
970
|
+
onReplySubmit: p,
|
|
971
|
+
tabs: y,
|
|
972
|
+
activeTab: h,
|
|
973
|
+
defaultTab: b,
|
|
974
|
+
onTabChange: C,
|
|
975
|
+
getRowActions: F,
|
|
976
|
+
renderItem: M,
|
|
977
|
+
emptyTitle: j,
|
|
978
|
+
emptyDescription: T,
|
|
979
|
+
highlightedKey: B,
|
|
980
|
+
footer: q,
|
|
981
|
+
closeLabel: G = "Close notifications",
|
|
982
|
+
className: U
|
|
983
|
+
}) {
|
|
984
|
+
const w = it(), $ = s ?? w?.items ?? [], _ = d ?? w?.streamStatus, x = m ?? w?.loading ?? !1, I = u !== void 0 ? u : w?.error instanceof Error ? w.error.message : w?.error ? String(w.error) : void 0, N = c ?? (w ? () => {
|
|
985
|
+
w.refresh();
|
|
986
|
+
} : void 0), k = i ?? (w ? () => {
|
|
987
|
+
w.markAllRead();
|
|
988
|
+
} : void 0);
|
|
989
|
+
return /* @__PURE__ */ a(ft, { open: t, onOpenChange: e, children: /* @__PURE__ */ a(
|
|
990
|
+
ut,
|
|
991
|
+
{
|
|
992
|
+
side: "right",
|
|
993
|
+
className: R(
|
|
994
|
+
"facto-notif-drawer",
|
|
995
|
+
l === "transactions" && "facto-notif-drawer--transactions",
|
|
996
|
+
U
|
|
997
|
+
),
|
|
998
|
+
children: /* @__PURE__ */ a(
|
|
999
|
+
$t,
|
|
1000
|
+
{
|
|
1001
|
+
title: o,
|
|
1002
|
+
titleNode: /* @__PURE__ */ a(_t, { className: "facto-notif-drawer__title", children: o }),
|
|
1003
|
+
descriptionNode: /* @__PURE__ */ a(pt, { className: "facto-visually-hidden", children: r }),
|
|
1004
|
+
closeNode: /* @__PURE__ */ a(ht, { asChild: !0, children: /* @__PURE__ */ a(
|
|
1005
|
+
E,
|
|
1006
|
+
{
|
|
1007
|
+
ariaLabel: G,
|
|
1008
|
+
className: "facto-modal-close",
|
|
1009
|
+
children: /* @__PURE__ */ a(O, { name: "close", size: 16 })
|
|
1010
|
+
}
|
|
1011
|
+
) }),
|
|
1012
|
+
variant: l,
|
|
1013
|
+
items: $,
|
|
1014
|
+
streamStatus: _,
|
|
1015
|
+
loading: x,
|
|
1016
|
+
error: I,
|
|
1017
|
+
onRetry: N,
|
|
1018
|
+
onMarkAllRead: k,
|
|
1019
|
+
markAllReadLabel: f,
|
|
1020
|
+
onSelectItem: g,
|
|
1021
|
+
onAttachmentClick: v,
|
|
1022
|
+
onReplySubmit: p,
|
|
1023
|
+
tabs: y,
|
|
1024
|
+
activeTab: h,
|
|
1025
|
+
defaultTab: b,
|
|
1026
|
+
onTabChange: C,
|
|
1027
|
+
getRowActions: F,
|
|
1028
|
+
renderItem: M,
|
|
1029
|
+
emptyTitle: j,
|
|
1030
|
+
emptyDescription: T,
|
|
1031
|
+
highlightedKey: B,
|
|
1032
|
+
footer: q
|
|
1033
|
+
}
|
|
1034
|
+
)
|
|
1035
|
+
}
|
|
1036
|
+
) });
|
|
1037
|
+
}
|
|
1038
|
+
function It({
|
|
1039
|
+
envelope: t,
|
|
1040
|
+
item: e
|
|
1041
|
+
}) {
|
|
1042
|
+
return !!(t && (t.mode === "mandatory_security" || t.severity === "critical") || e && (e.mandatory || e.mode === "mandatory_security" || e.severity === "critical"));
|
|
1043
|
+
}
|
|
1044
|
+
function Rt({
|
|
1045
|
+
envelope: t,
|
|
1046
|
+
item: e
|
|
1047
|
+
}) {
|
|
1048
|
+
const o = e?.severity ?? t?.severity ?? "info", r = o === "critical" ? "error" : o === "warning" ? "warning" : o === "success" ? "success" : "info", l = e?.title ?? t?.meta.eventType ?? "Notification", s = e?.description ?? e?.subtitle;
|
|
1049
|
+
return { title: l, description: s, tone: r };
|
|
1050
|
+
}
|
|
1051
|
+
function Dt({ envelope: t, item: e }) {
|
|
1052
|
+
return t?.meta.eventId ?? e?.eventId ?? e?.id ?? null;
|
|
1053
|
+
}
|
|
1054
|
+
function Pt({
|
|
1055
|
+
envelope: t,
|
|
1056
|
+
item: e,
|
|
1057
|
+
shouldToast: o = It,
|
|
1058
|
+
formatToast: r = Rt,
|
|
1059
|
+
dedupeCapacity: l = 500,
|
|
1060
|
+
disabled: s = !1,
|
|
1061
|
+
actionLabel: d,
|
|
1062
|
+
onAction: m
|
|
1063
|
+
}) {
|
|
1064
|
+
const u = Nt(), c = it(), i = z(null);
|
|
1065
|
+
i.current || (i.current = new mt(l));
|
|
1066
|
+
const f = z({
|
|
1067
|
+
toast: u,
|
|
1068
|
+
shouldToast: o,
|
|
1069
|
+
formatToast: r,
|
|
1070
|
+
disabled: s,
|
|
1071
|
+
actionLabel: d,
|
|
1072
|
+
onAction: m
|
|
1073
|
+
});
|
|
1074
|
+
f.current = {
|
|
1075
|
+
toast: u,
|
|
1076
|
+
shouldToast: o,
|
|
1077
|
+
formatToast: r,
|
|
1078
|
+
disabled: s,
|
|
1079
|
+
actionLabel: d,
|
|
1080
|
+
onAction: m
|
|
1081
|
+
};
|
|
1082
|
+
const g = z((v) => {
|
|
1083
|
+
const p = f.current;
|
|
1084
|
+
if (p.disabled || !p.shouldToast(v)) return;
|
|
1085
|
+
const y = Dt(v);
|
|
1086
|
+
if (y && i.current && !i.current.remember(y))
|
|
1087
|
+
return;
|
|
1088
|
+
const h = p.formatToast(v), b = {
|
|
1089
|
+
id: y ?? void 0,
|
|
1090
|
+
description: h.description,
|
|
1091
|
+
duration: h.duration,
|
|
1092
|
+
action: p.actionLabel && p.onAction ? {
|
|
1093
|
+
label: p.actionLabel,
|
|
1094
|
+
altText: p.actionLabel,
|
|
1095
|
+
onClick: () => p.onAction?.(v)
|
|
1096
|
+
} : void 0
|
|
1097
|
+
}, C = h.tone ?? "info";
|
|
1098
|
+
C === "error" ? p.toast.error(h.title, b) : C === "warning" ? p.toast.warning(h.title, b) : C === "success" ? p.toast.success(h.title, b) : p.toast.info(h.title, b);
|
|
1099
|
+
});
|
|
1100
|
+
return V(() => {
|
|
1101
|
+
if (c)
|
|
1102
|
+
return c.subscribeLiveEvents((v) => {
|
|
1103
|
+
g.current(v);
|
|
1104
|
+
});
|
|
1105
|
+
}, [c]), V(() => {
|
|
1106
|
+
!t && !e || g.current({
|
|
1107
|
+
envelope: t ?? void 0,
|
|
1108
|
+
item: e ?? void 0
|
|
1109
|
+
});
|
|
1110
|
+
}, [t, e]), null;
|
|
1111
|
+
}
|
|
1112
|
+
export {
|
|
1113
|
+
Ht as ActionQueueCard,
|
|
1114
|
+
Ot as IncidentBanner,
|
|
1115
|
+
At as NotificationBell,
|
|
1116
|
+
Vt as NotificationDrawer,
|
|
1117
|
+
$t as NotificationDrawerPanel,
|
|
1118
|
+
ct as NotificationRow,
|
|
1119
|
+
Pt as NotificationToastBridge,
|
|
1120
|
+
Bt as TransactionNotificationCard,
|
|
1121
|
+
Lt as TransactionNotificationGroup,
|
|
1122
|
+
Et as WorkspaceNotificationFeed,
|
|
1123
|
+
It as defaultShouldToast
|
|
1124
|
+
};
|