@burdenoff/microfe-channel 2026.625.1 → 2026.625.3
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/channel/modules/channels/pages/ChannelDashboardPage.js +73 -76
- package/dist/channel/modules/channels/pages/ChannelDashboardPage.js.map +1 -1
- package/dist/channel/modules/channels/pages/ChannelDetailsPage.js +407 -353
- package/dist/channel/modules/channels/pages/ChannelDetailsPage.js.map +1 -1
- package/dist/channel/modules/channels/pages/ChannelSettingsPage.js +93 -87
- package/dist/channel/modules/channels/pages/ChannelSettingsPage.js.map +1 -1
- package/dist/channel/modules/channels/pages/ChannelUsersPage.js +119 -96
- package/dist/channel/modules/channels/pages/ChannelUsersPage.js.map +1 -1
- package/dist/channel/modules/channels/pages/ChannelsListPage.js +219 -196
- package/dist/channel/modules/channels/pages/ChannelsListPage.js.map +1 -1
- package/dist/channel/modules/channels/pages/ConnectionDetailsPage.js +277 -232
- package/dist/channel/modules/channels/pages/ConnectionDetailsPage.js.map +1 -1
- package/dist/channel/modules/channels/pages/ConnectionsListPage.js +112 -91
- package/dist/channel/modules/channels/pages/ConnectionsListPage.js.map +1 -1
- package/dist/channel/modules/channels/pages/CreateChannelPage.js +28 -22
- package/dist/channel/modules/channels/pages/CreateChannelPage.js.map +1 -1
- package/dist/channel/modules/channels/pages/CreateConnectionPage.js +72 -65
- package/dist/channel/modules/channels/pages/CreateConnectionPage.js.map +1 -1
- package/dist/channel/modules/channels/pages/DeliveryHistoryPage.js +101 -93
- package/dist/channel/modules/channels/pages/DeliveryHistoryPage.js.map +1 -1
- package/dist/channel/modules/channels/pages/EditChannelPage.js +154 -148
- package/dist/channel/modules/channels/pages/EditChannelPage.js.map +1 -1
- package/dist/channel/modules/channels/pages/EditConnectionPage.js +69 -62
- package/dist/channel/modules/channels/pages/EditConnectionPage.js.map +1 -1
- package/dist/channel/modules/channels/pages/SendMessagePage.js +131 -124
- package/dist/channel/modules/channels/pages/SendMessagePage.js.map +1 -1
- package/dist/channel/modules/channels/pages/WebhookEventsPage.js +152 -129
- package/dist/channel/modules/channels/pages/WebhookEventsPage.js.map +1 -1
- package/package.json +2 -2
|
@@ -2,122 +2,122 @@ import { useChannel as e } from "../../../providers/ChannelProvider.js";
|
|
|
2
2
|
import { useChannel as t } from "../../../hooks/useChannels.js";
|
|
3
3
|
import { PermissionGuard as n } from "../../../components/PermissionGuard.js";
|
|
4
4
|
import { CHANNEL_PERMISSIONS as r } from "../../../constants/permissions.js";
|
|
5
|
-
import { useExportDeliveryAttempts as
|
|
6
|
-
import { useCallback as
|
|
7
|
-
import { useI18n as
|
|
8
|
-
import { AlertCircle as
|
|
9
|
-
import { useNavigate as
|
|
10
|
-
import { usePermissions as
|
|
5
|
+
import { useExportDeliveryAttempts as ee } from "../hooks/useExport.js";
|
|
6
|
+
import { useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
|
|
7
|
+
import { useI18n as c } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
8
|
+
import { AlertCircle as l, ArrowLeft as te, CheckCircle2 as u, ChevronLeft as d, ChevronRight as ne, Clock as f, Download as p, Loader2 as m, RefreshCw as h, RotateCcw as g, Send as _, XCircle as v } from "lucide-react";
|
|
9
|
+
import { useNavigate as y, useParams as b } from "react-router-dom";
|
|
10
|
+
import { usePermissions as re } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
11
11
|
import { Fragment as ie, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
12
|
-
import { CTAOverflowMenu as C,
|
|
12
|
+
import { CTAOverflowMenu as C, EmphasisPanel as w, IllustratedEmptyState as ae, PagePurpose as oe, ResponsiveTable as se } from "@burdenoff/fe-libs/ui";
|
|
13
13
|
//#region src/channel/modules/channels/pages/DeliveryHistoryPage.tsx
|
|
14
14
|
var T = {
|
|
15
15
|
PENDING: {
|
|
16
16
|
label: "Pending",
|
|
17
17
|
color: "text-text-secondary bg-bg-sunken",
|
|
18
|
-
icon:
|
|
18
|
+
icon: f
|
|
19
19
|
},
|
|
20
20
|
QUEUED: {
|
|
21
21
|
label: "Queued",
|
|
22
22
|
color: "text-accent-primary bg-accent-primary-subtle",
|
|
23
|
-
icon:
|
|
23
|
+
icon: f
|
|
24
24
|
},
|
|
25
25
|
SENDING: {
|
|
26
26
|
label: "Sending",
|
|
27
27
|
color: "text-accent-primary bg-accent-primary/10",
|
|
28
|
-
icon:
|
|
28
|
+
icon: _
|
|
29
29
|
},
|
|
30
30
|
SENT: {
|
|
31
31
|
label: "Sent",
|
|
32
32
|
color: "text-status-success-text bg-status-success-bg-subtle",
|
|
33
|
-
icon:
|
|
33
|
+
icon: u
|
|
34
34
|
},
|
|
35
35
|
DELIVERED: {
|
|
36
36
|
label: "Delivered",
|
|
37
37
|
color: "text-status-success-text bg-status-success-bg-subtle",
|
|
38
|
-
icon:
|
|
38
|
+
icon: u
|
|
39
39
|
},
|
|
40
40
|
FAILED: {
|
|
41
41
|
label: "Failed",
|
|
42
42
|
color: "text-status-error-text bg-status-error-bg-subtle",
|
|
43
|
-
icon:
|
|
43
|
+
icon: v
|
|
44
44
|
},
|
|
45
45
|
BOUNCED: {
|
|
46
46
|
label: "Bounced",
|
|
47
47
|
color: "text-status-warning-text bg-status-warning-bg-subtle",
|
|
48
|
-
icon:
|
|
48
|
+
icon: l
|
|
49
49
|
},
|
|
50
50
|
REJECTED: {
|
|
51
51
|
label: "Rejected",
|
|
52
52
|
color: "text-status-error-text bg-status-error-bg-subtle",
|
|
53
|
-
icon:
|
|
53
|
+
icon: v
|
|
54
54
|
},
|
|
55
55
|
RATE_LIMITED: {
|
|
56
56
|
label: "Rate Limited",
|
|
57
57
|
color: "text-status-warning-text bg-status-warning-bg-subtle",
|
|
58
|
-
icon:
|
|
58
|
+
icon: f
|
|
59
59
|
},
|
|
60
60
|
RETRYING: {
|
|
61
61
|
label: "Retrying",
|
|
62
62
|
color: "text-accent-primary bg-accent-primary/10",
|
|
63
|
-
icon:
|
|
63
|
+
icon: h
|
|
64
64
|
},
|
|
65
65
|
OPENED: {
|
|
66
66
|
label: "Opened",
|
|
67
67
|
color: "text-status-success-text bg-status-success-bg-subtle",
|
|
68
|
-
icon:
|
|
68
|
+
icon: u
|
|
69
69
|
},
|
|
70
70
|
CLICKED: {
|
|
71
71
|
label: "Clicked",
|
|
72
72
|
color: "text-status-success-text bg-status-success-bg-subtle",
|
|
73
|
-
icon:
|
|
73
|
+
icon: u
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
function E() {
|
|
77
|
-
let { channelId:
|
|
78
|
-
let n =
|
|
77
|
+
let { channelId: u } = b(), f = y(), { hasPermission: v } = re(), E = v(r.CHANNEL_DELIVERY_EXPORT), { t: ce } = c(), D = (e, t) => {
|
|
78
|
+
let n = ce(e);
|
|
79
79
|
return n === e ? t : n;
|
|
80
|
-
}, { organizationId: O } = e(), { triggerExport:
|
|
81
|
-
if (
|
|
82
|
-
|
|
80
|
+
}, { organizationId: O } = e(), { triggerExport: le, isExporting: k, exportError: A } = ee(O ?? void 0, u), [j, M] = s(!0), [N, P] = s([]), [F, I] = s(null), [L, R] = s(null), [z, B] = s(25), [V, H] = s(0), [U, W] = s([void 0]), [G, K] = s(0), { channel: q, isLoading: ue, error: J, fetchDeliveryAttempts: Y, retryDelivery: de } = t(u), X = i(async (e) => {
|
|
81
|
+
if (u) {
|
|
82
|
+
M(!0), R(null);
|
|
83
83
|
try {
|
|
84
84
|
let t = await Y(z, e);
|
|
85
|
-
return
|
|
85
|
+
return P(t.items), H(t.total), t.nextCursor;
|
|
86
86
|
} finally {
|
|
87
|
-
|
|
87
|
+
M(!1);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
}, [
|
|
91
|
-
|
|
91
|
+
u,
|
|
92
92
|
Y,
|
|
93
93
|
z
|
|
94
|
-
]), Z =
|
|
95
|
-
|
|
94
|
+
]), Z = o(X), Q = o(U);
|
|
95
|
+
a(() => {
|
|
96
96
|
Z.current = X, Q.current = U;
|
|
97
97
|
});
|
|
98
|
-
let $ =
|
|
99
|
-
|
|
98
|
+
let $ = o(!0);
|
|
99
|
+
a(() => {
|
|
100
100
|
Promise.resolve().then(() => {
|
|
101
101
|
W([void 0]), K(0), Z.current(void 0);
|
|
102
102
|
});
|
|
103
|
-
}, [z]),
|
|
103
|
+
}, [z]), a(() => {
|
|
104
104
|
if ($.current) {
|
|
105
105
|
$.current = !1;
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
Promise.resolve().then(() => Z.current(Q.current[G]));
|
|
109
|
-
}, [G]),
|
|
110
|
-
if (!
|
|
109
|
+
}, [G]), a(() => {
|
|
110
|
+
if (!u || G !== 0) return;
|
|
111
111
|
let e = setInterval(() => {
|
|
112
112
|
X(void 0);
|
|
113
113
|
}, 6e4);
|
|
114
114
|
return () => clearInterval(e);
|
|
115
115
|
}, [
|
|
116
|
-
|
|
116
|
+
u,
|
|
117
117
|
G,
|
|
118
118
|
X
|
|
119
119
|
]);
|
|
120
|
-
let
|
|
120
|
+
let fe = i(async () => {
|
|
121
121
|
let e = await X(U[G]);
|
|
122
122
|
e && W((t) => {
|
|
123
123
|
let n = [...t];
|
|
@@ -127,28 +127,28 @@ function E() {
|
|
|
127
127
|
U,
|
|
128
128
|
G,
|
|
129
129
|
X
|
|
130
|
-
]),
|
|
130
|
+
]), pe = i(() => {
|
|
131
131
|
let e = G - 1;
|
|
132
132
|
K(e), X(U[e]);
|
|
133
133
|
}, [
|
|
134
134
|
U,
|
|
135
135
|
G,
|
|
136
136
|
X
|
|
137
|
-
]),
|
|
137
|
+
]), me = N.length === z, he = G > 0, ge = async (e) => {
|
|
138
138
|
I(e), R(null);
|
|
139
139
|
try {
|
|
140
|
-
let t = await
|
|
140
|
+
let t = await de(e);
|
|
141
141
|
t.success ? await X(U[G]) : R(t.error || "Retry failed");
|
|
142
142
|
} finally {
|
|
143
143
|
I(null);
|
|
144
144
|
}
|
|
145
|
-
},
|
|
145
|
+
}, _e = (e) => T[e] || T.PENDING, ve = [
|
|
146
146
|
{
|
|
147
147
|
key: "status",
|
|
148
148
|
header: D("channel.status", "Status"),
|
|
149
149
|
priority: "primary",
|
|
150
150
|
cell: (e) => {
|
|
151
|
-
let t =
|
|
151
|
+
let t = _e(e.status), n = t.icon;
|
|
152
152
|
return /* @__PURE__ */ S("div", {
|
|
153
153
|
className: "flex items-center gap-2",
|
|
154
154
|
children: [/* @__PURE__ */ x(n, {
|
|
@@ -197,11 +197,11 @@ function E() {
|
|
|
197
197
|
permission: r.CHANNEL_DELIVERY_EXECUTE,
|
|
198
198
|
children: /* @__PURE__ */ S("button", {
|
|
199
199
|
type: "button",
|
|
200
|
-
onClick: () =>
|
|
200
|
+
onClick: () => ge(e.id),
|
|
201
201
|
disabled: F === e.id,
|
|
202
202
|
className: "flex items-center gap-1 px-2 py-1 text-xs font-medium text-accent-primary hover:bg-accent-primary/10 rounded transition-colors disabled:opacity-50",
|
|
203
203
|
title: D("channel.retryDelivery", "Retry this delivery"),
|
|
204
|
-
children: [/* @__PURE__ */ x(
|
|
204
|
+
children: [/* @__PURE__ */ x(g, {
|
|
205
205
|
size: 12,
|
|
206
206
|
className: F === e.id ? "animate-spin" : ""
|
|
207
207
|
}), F === e.id ? D("channel.retrying", "Retrying...") : D("channel.retry", "Retry")]
|
|
@@ -209,10 +209,10 @@ function E() {
|
|
|
209
209
|
}) : null
|
|
210
210
|
}
|
|
211
211
|
];
|
|
212
|
-
return
|
|
212
|
+
return ue ? /* @__PURE__ */ x("output", {
|
|
213
213
|
className: "flex items-center justify-center min-h-screen",
|
|
214
214
|
"aria-label": D("channel.loading", "Loading"),
|
|
215
|
-
children: /* @__PURE__ */ x(
|
|
215
|
+
children: /* @__PURE__ */ x(m, {
|
|
216
216
|
size: 32,
|
|
217
217
|
className: "animate-spin text-accent-primary",
|
|
218
218
|
"aria-hidden": "true"
|
|
@@ -222,7 +222,7 @@ function E() {
|
|
|
222
222
|
children: /* @__PURE__ */ S("div", {
|
|
223
223
|
className: "flex items-center gap-3 p-4 bg-status-error-bg-subtle border border-status-error-border rounded-lg",
|
|
224
224
|
children: [
|
|
225
|
-
/* @__PURE__ */ x(
|
|
225
|
+
/* @__PURE__ */ x(l, {
|
|
226
226
|
size: 20,
|
|
227
227
|
className: "text-status-error-text"
|
|
228
228
|
}),
|
|
@@ -232,7 +232,7 @@ function E() {
|
|
|
232
232
|
}) }),
|
|
233
233
|
/* @__PURE__ */ x("button", {
|
|
234
234
|
type: "button",
|
|
235
|
-
onClick: () =>
|
|
235
|
+
onClick: () => f(`/channels/${u}`),
|
|
236
236
|
className: "ml-auto px-3 py-1 text-sm text-status-error-text hover:bg-status-error-bg-subtle rounded transition-colors",
|
|
237
237
|
children: "Go Back"
|
|
238
238
|
})
|
|
@@ -249,10 +249,10 @@ function E() {
|
|
|
249
249
|
className: "flex items-center gap-3",
|
|
250
250
|
children: [/* @__PURE__ */ x("button", {
|
|
251
251
|
type: "button",
|
|
252
|
-
onClick: () =>
|
|
252
|
+
onClick: () => f(`/channels/${u}`),
|
|
253
253
|
"aria-label": D("channel.backToChannel", "Back to channel"),
|
|
254
254
|
className: "p-2 text-text-secondary hover:text-text-primary hover:bg-bg-sunken rounded-lg transition-colors",
|
|
255
|
-
children: /* @__PURE__ */ x(
|
|
255
|
+
children: /* @__PURE__ */ x(te, {
|
|
256
256
|
size: 20,
|
|
257
257
|
"aria-hidden": "true"
|
|
258
258
|
})
|
|
@@ -289,42 +289,42 @@ function E() {
|
|
|
289
289
|
]
|
|
290
290
|
}), /* @__PURE__ */ x(C, { actions: [{
|
|
291
291
|
label: D("channel.refresh", "Refresh"),
|
|
292
|
-
icon: /* @__PURE__ */ x(
|
|
292
|
+
icon: /* @__PURE__ */ x(h, {
|
|
293
293
|
size: 16,
|
|
294
|
-
className:
|
|
294
|
+
className: j ? "animate-spin" : "",
|
|
295
295
|
"aria-hidden": "true"
|
|
296
296
|
}),
|
|
297
|
-
disabled:
|
|
297
|
+
disabled: j,
|
|
298
298
|
onSelect: () => void X(U[G])
|
|
299
299
|
}, ...E ? [{
|
|
300
300
|
label: D("channel.export", "Export"),
|
|
301
|
-
icon:
|
|
301
|
+
icon: k ? /* @__PURE__ */ x(m, {
|
|
302
302
|
size: 16,
|
|
303
303
|
className: "animate-spin",
|
|
304
304
|
"aria-hidden": "true"
|
|
305
|
-
}) : /* @__PURE__ */ x(
|
|
305
|
+
}) : /* @__PURE__ */ x(p, {
|
|
306
306
|
size: 16,
|
|
307
307
|
"aria-hidden": "true"
|
|
308
308
|
}),
|
|
309
|
-
disabled:
|
|
310
|
-
onSelect: () => void
|
|
309
|
+
disabled: k,
|
|
310
|
+
onSelect: () => void le()
|
|
311
311
|
}] : []] })]
|
|
312
312
|
})]
|
|
313
313
|
}),
|
|
314
|
-
|
|
314
|
+
A && /* @__PURE__ */ S("div", {
|
|
315
315
|
className: "p-4 bg-status-error-bg-subtle border border-status-error-border rounded-lg flex items-center gap-3",
|
|
316
|
-
children: [/* @__PURE__ */ x(
|
|
316
|
+
children: [/* @__PURE__ */ x(l, {
|
|
317
317
|
size: 20,
|
|
318
318
|
className: "text-status-error-text"
|
|
319
319
|
}), /* @__PURE__ */ x("p", {
|
|
320
320
|
className: "text-sm text-status-error-text flex-1",
|
|
321
|
-
children:
|
|
321
|
+
children: A
|
|
322
322
|
})]
|
|
323
323
|
}),
|
|
324
324
|
L && /* @__PURE__ */ S("div", {
|
|
325
325
|
className: "p-4 bg-status-error-bg-subtle border border-status-error-border rounded-lg flex items-center gap-3",
|
|
326
326
|
children: [
|
|
327
|
-
/* @__PURE__ */ x(
|
|
327
|
+
/* @__PURE__ */ x(l, {
|
|
328
328
|
size: 20,
|
|
329
329
|
className: "text-status-error-text"
|
|
330
330
|
}),
|
|
@@ -340,44 +340,52 @@ function E() {
|
|
|
340
340
|
})
|
|
341
341
|
]
|
|
342
342
|
}),
|
|
343
|
-
/* @__PURE__ */ x(
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
343
|
+
/* @__PURE__ */ x(oe, {
|
|
344
|
+
icon: /* @__PURE__ */ x(_, {
|
|
345
|
+
size: 15,
|
|
346
|
+
"aria-hidden": "true"
|
|
347
|
+
}),
|
|
348
|
+
children: D("channel.deliveryHistoryPurpose", "A per-message audit trail of everything this channel has tried to send — sent, delivered, opened, bounced or failed — with the error returned by the provider. Use it to confirm a notification actually went out, to debug why a delivery failed, and to retry failed attempts one by one. Records are kept for 7 days.")
|
|
349
|
+
}),
|
|
350
|
+
/* @__PURE__ */ S(w, {
|
|
351
|
+
className: "flex items-center gap-3 p-4",
|
|
352
|
+
children: [/* @__PURE__ */ x("span", {
|
|
353
|
+
className: "rounded-lg bg-accent-orange/10 p-2",
|
|
354
|
+
children: /* @__PURE__ */ x(_, {
|
|
355
|
+
size: 18,
|
|
356
|
+
className: "text-accent-orange",
|
|
357
|
+
"aria-hidden": "true"
|
|
358
|
+
})
|
|
359
|
+
}), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S("p", {
|
|
360
|
+
className: "text-sm font-semibold text-text-primary",
|
|
361
|
+
children: [
|
|
362
|
+
V,
|
|
363
|
+
" ",
|
|
364
|
+
V === 1 ? D("channel.deliveryAttemptSingular", "delivery attempt") : D("channel.deliveryAttemptsPlural", "delivery attempts")
|
|
365
|
+
]
|
|
366
|
+
}), /* @__PURE__ */ x("p", {
|
|
347
367
|
className: "text-sm text-text-secondary",
|
|
348
|
-
children: "
|
|
349
|
-
})
|
|
368
|
+
children: D("channel.deliveryHistoryBannerHint", "All message attempts sent through this channel, retained for 7 days. Retry any failed delivery to attempt sending again.")
|
|
369
|
+
})] })]
|
|
350
370
|
}),
|
|
351
|
-
|
|
371
|
+
j ? /* @__PURE__ */ S("div", {
|
|
352
372
|
className: "bg-surface border border-border-seam rounded-lg px-4 py-12 text-center",
|
|
353
|
-
children: [/* @__PURE__ */ x(
|
|
373
|
+
children: [/* @__PURE__ */ x(m, {
|
|
354
374
|
size: 24,
|
|
355
375
|
className: "animate-spin text-accent-primary mx-auto"
|
|
356
376
|
}), /* @__PURE__ */ x("p", {
|
|
357
377
|
className: "text-sm text-text-secondary mt-2",
|
|
358
378
|
children: "Loading delivery attempts…"
|
|
359
379
|
})]
|
|
360
|
-
}) : /* @__PURE__ */ x(
|
|
361
|
-
columns:
|
|
362
|
-
data:
|
|
380
|
+
}) : /* @__PURE__ */ x(se, {
|
|
381
|
+
columns: ve,
|
|
382
|
+
data: N,
|
|
363
383
|
rowKey: (e) => e.id,
|
|
364
384
|
className: "bg-surface border border-border-seam rounded-lg",
|
|
365
|
-
emptyState: /* @__PURE__ */
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
size: 32,
|
|
370
|
-
className: "text-text-secondary"
|
|
371
|
-
}),
|
|
372
|
-
/* @__PURE__ */ x("p", {
|
|
373
|
-
className: "text-sm font-medium text-text-primary",
|
|
374
|
-
children: D("channel.noDeliveryAttempts", "No delivery attempts yet")
|
|
375
|
-
}),
|
|
376
|
-
/* @__PURE__ */ x("p", {
|
|
377
|
-
className: "text-xs text-text-secondary",
|
|
378
|
-
children: D("channel.sendMessageToSeeHistory", "Send a message through this channel to see delivery history")
|
|
379
|
-
})
|
|
380
|
-
]
|
|
385
|
+
emptyState: /* @__PURE__ */ x(ae, {
|
|
386
|
+
illustration: "empty-notifications",
|
|
387
|
+
title: D("channel.noDeliveryAttempts", "No delivery attempts yet"),
|
|
388
|
+
description: D("channel.sendMessageToSeeHistory", "Send a message through this channel to see delivery history")
|
|
381
389
|
})
|
|
382
390
|
}),
|
|
383
391
|
/* @__PURE__ */ S("div", {
|
|
@@ -403,16 +411,16 @@ function E() {
|
|
|
403
411
|
className: "flex items-center gap-2",
|
|
404
412
|
children: [/* @__PURE__ */ S("button", {
|
|
405
413
|
type: "button",
|
|
406
|
-
onClick:
|
|
407
|
-
disabled: !
|
|
414
|
+
onClick: pe,
|
|
415
|
+
disabled: !he || j,
|
|
408
416
|
className: "flex items-center gap-1 px-3 py-1.5 text-sm border border-border-subtle rounded-lg hover:bg-bg-sunken transition-colors disabled:opacity-40 disabled:cursor-not-allowed",
|
|
409
|
-
children: [/* @__PURE__ */ x(
|
|
417
|
+
children: [/* @__PURE__ */ x(d, { size: 16 }), D("channel.previous", "Previous")]
|
|
410
418
|
}), /* @__PURE__ */ S("button", {
|
|
411
419
|
type: "button",
|
|
412
|
-
onClick: () => void
|
|
413
|
-
disabled: !
|
|
420
|
+
onClick: () => void fe(),
|
|
421
|
+
disabled: !me || j,
|
|
414
422
|
className: "flex items-center gap-1 px-3 py-1.5 text-sm border border-border-subtle rounded-lg hover:bg-bg-sunken transition-colors disabled:opacity-40 disabled:cursor-not-allowed",
|
|
415
|
-
children: [D("channel.next", "Next"), /* @__PURE__ */ x(
|
|
423
|
+
children: [D("channel.next", "Next"), /* @__PURE__ */ x(ne, { size: 16 })]
|
|
416
424
|
})]
|
|
417
425
|
})]
|
|
418
426
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeliveryHistoryPage.js","names":[],"sources":["../../../../../src/channel/modules/channels/pages/DeliveryHistoryPage.tsx"],"sourcesContent":["/**\n * Delivery History Page\n *\n * Displays message delivery attempts for a specific channel with retry capability\n */\n\nimport { useState, useEffect, useCallback, useRef } from 'react';\nimport { useParams, useNavigate } from 'react-router-dom';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n ArrowLeft,\n Loader2,\n AlertCircle,\n CheckCircle2,\n XCircle,\n Clock,\n RefreshCw,\n Send,\n RotateCcw,\n Download,\n ChevronLeft,\n ChevronRight,\n} from 'lucide-react';\nimport {\n CTAOverflowMenu,\n GlassCard,\n ResponsiveTable,\n type ResponsiveTableColumn,\n} from '@burdenoff/fe-libs/ui';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useChannel, type DeliveryStatus, type DeliveryAttempt } from '../../../hooks/useChannels';\nimport { useChannel as useChannelContext } from '../../../providers/ChannelProvider';\nimport { PermissionGuard } from '../../../components/PermissionGuard';\nimport { CHANNEL_PERMISSIONS } from '../../../constants/permissions';\nimport { useExportDeliveryAttempts } from '../hooks/useExport';\n\nconst STATUS_CONFIG: Record<\n DeliveryStatus,\n { label: string; color: string; icon: typeof CheckCircle2 }\n> = {\n PENDING: { label: 'Pending', color: 'text-text-secondary bg-bg-sunken', icon: Clock },\n QUEUED: { label: 'Queued', color: 'text-accent-primary bg-accent-primary-subtle', icon: Clock },\n SENDING: { label: 'Sending', color: 'text-accent-primary bg-accent-primary/10', icon: Send },\n SENT: {\n label: 'Sent',\n color: 'text-status-success-text bg-status-success-bg-subtle',\n icon: CheckCircle2,\n },\n DELIVERED: {\n label: 'Delivered',\n color: 'text-status-success-text bg-status-success-bg-subtle',\n icon: CheckCircle2,\n },\n FAILED: {\n label: 'Failed',\n color: 'text-status-error-text bg-status-error-bg-subtle',\n icon: XCircle,\n },\n BOUNCED: {\n label: 'Bounced',\n color: 'text-status-warning-text bg-status-warning-bg-subtle',\n icon: AlertCircle,\n },\n REJECTED: {\n label: 'Rejected',\n color: 'text-status-error-text bg-status-error-bg-subtle',\n icon: XCircle,\n },\n RATE_LIMITED: {\n label: 'Rate Limited',\n color: 'text-status-warning-text bg-status-warning-bg-subtle',\n icon: Clock,\n },\n RETRYING: {\n label: 'Retrying',\n color: 'text-accent-primary bg-accent-primary/10',\n icon: RefreshCw,\n },\n OPENED: {\n label: 'Opened',\n color: 'text-status-success-text bg-status-success-bg-subtle',\n icon: CheckCircle2,\n },\n CLICKED: {\n label: 'Clicked',\n color: 'text-status-success-text bg-status-success-bg-subtle',\n icon: CheckCircle2,\n },\n};\n\nexport function DeliveryHistoryPage() {\n const { channelId } = useParams<{ channelId: string }>();\n const navigate = useNavigate();\n const { hasPermission } = usePermissions();\n const canExport = hasPermission(CHANNEL_PERMISSIONS.CHANNEL_DELIVERY_EXPORT);\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const value = t(key);\n return value === key ? fallback : value;\n };\n const { organizationId } = useChannelContext();\n const {\n triggerExport: exportDeliveries,\n isExporting: isExportingDeliveries,\n exportError: exportDeliveriesError,\n } = useExportDeliveryAttempts(organizationId ?? undefined, channelId);\n const [isLoadingAttempts, setIsLoadingAttempts] = useState(true);\n const [attempts, setAttempts] = useState<DeliveryAttempt[]>([]);\n const [retryingId, setRetryingId] = useState<string | null>(null);\n const [retryError, setRetryError] = useState<string | null>(null);\n const [limit, setLimit] = useState(25);\n const [total, setTotal] = useState(0);\n // Cursor stack: index 0 is always undefined (first page), subsequent entries are cursors\n const [cursorStack, setCursorStack] = useState<(string | undefined)[]>([undefined]);\n const [currentPageIdx, setCurrentPageIdx] = useState(0);\n\n const { channel, isLoading, error, fetchDeliveryAttempts, retryDelivery } = useChannel(channelId);\n\n const loadAttempts = useCallback(\n async (cursor?: string) => {\n if (!channelId) return;\n setIsLoadingAttempts(true);\n setRetryError(null);\n try {\n const result = await fetchDeliveryAttempts(limit, cursor);\n setAttempts(result.items);\n setTotal(result.total);\n return result.nextCursor;\n } finally {\n setIsLoadingAttempts(false);\n }\n },\n [channelId, fetchDeliveryAttempts, limit]\n );\n\n const loadAttemptsRef = useRef(loadAttempts);\n const cursorStackRef = useRef(cursorStack);\n useEffect(() => {\n loadAttemptsRef.current = loadAttempts;\n cursorStackRef.current = cursorStack;\n });\n const isFirstPageRender = useRef(true);\n\n useEffect(() => {\n void Promise.resolve().then(() => {\n setCursorStack([undefined]);\n setCurrentPageIdx(0);\n void loadAttemptsRef.current(undefined);\n });\n }, [limit]);\n\n useEffect(() => {\n if (isFirstPageRender.current) {\n isFirstPageRender.current = false;\n return;\n }\n void Promise.resolve().then(() =>\n loadAttemptsRef.current(cursorStackRef.current[currentPageIdx])\n );\n }, [currentPageIdx]);\n\n // Poll for delivery attempt updates every 60 s on first page only\n useEffect(() => {\n if (!channelId || currentPageIdx !== 0) return;\n const timer = setInterval(() => {\n void loadAttempts(undefined);\n }, 60_000);\n return () => clearInterval(timer);\n }, [channelId, currentPageIdx, loadAttempts]);\n\n const handleNextPage = useCallback(async () => {\n const nextCursor = await loadAttempts(cursorStack[currentPageIdx]);\n if (nextCursor) {\n setCursorStack((prev) => {\n const next = [...prev];\n if (!next[currentPageIdx + 1]) {\n next[currentPageIdx + 1] = nextCursor;\n }\n return next;\n });\n }\n setCurrentPageIdx((p) => p + 1);\n }, [cursorStack, currentPageIdx, loadAttempts]);\n\n const handlePrevPage = useCallback(() => {\n const prevIdx = currentPageIdx - 1;\n setCurrentPageIdx(prevIdx);\n void loadAttempts(cursorStack[prevIdx]);\n }, [cursorStack, currentPageIdx, loadAttempts]);\n\n const hasNextPage = attempts.length === limit;\n const hasPrevPage = currentPageIdx > 0;\n\n const handleRetry = async (attemptId: string) => {\n setRetryingId(attemptId);\n setRetryError(null);\n try {\n const result = await retryDelivery(attemptId);\n if (!result.success) {\n setRetryError(result.error || 'Retry failed');\n } else {\n await loadAttempts(cursorStack[currentPageIdx]);\n }\n } finally {\n setRetryingId(null);\n }\n };\n\n const getStatusConfig = (status: DeliveryStatus) => {\n return STATUS_CONFIG[status] || STATUS_CONFIG.PENDING;\n };\n\n const deliveryColumns: ResponsiveTableColumn<DeliveryAttempt>[] = [\n {\n key: 'status',\n header: tr('channel.status', 'Status'),\n priority: 'primary',\n cell: (delivery) => {\n const statusConfig = getStatusConfig(delivery.status as DeliveryStatus);\n const StatusIcon = statusConfig.icon;\n return (\n <div className=\"flex items-center gap-2\">\n <StatusIcon size={14} className={statusConfig.color.split(' ')[0]} />\n <span className={`text-sm font-medium ${statusConfig.color}`}>\n {statusConfig.label}\n </span>\n </div>\n );\n },\n },\n {\n key: 'content',\n header: tr('channel.content', 'Content'),\n priority: 'primary',\n cellClassName: 'text-sm text-text-primary truncate max-w-xs',\n cell: (delivery) => delivery.content,\n },\n {\n key: 'sentAt',\n header: tr('channel.sentAt', 'Sent At'),\n priority: 'secondary',\n cellClassName: 'text-sm text-text-secondary',\n cell: (delivery) =>\n delivery.sentAt ? new Date(delivery.sentAt).toLocaleString() : '-',\n },\n {\n key: 'retries',\n header: tr('channel.retries', 'Retries'),\n priority: 'secondary',\n cellClassName: 'text-sm text-text-secondary tabular-nums',\n cell: (delivery) => delivery.retryCount,\n },\n {\n key: 'error',\n header: tr('channel.error', 'Error'),\n priority: 'secondary',\n cellClassName: 'text-sm text-status-error-text max-w-xs truncate',\n cell: (delivery) => delivery.errorMessage || '-',\n },\n {\n key: 'actions',\n header: tr('channel.actions', 'Actions'),\n priority: 'secondary',\n cell: (delivery) => {\n const canRetry =\n delivery.status === 'FAILED' ||\n delivery.status === 'BOUNCED' ||\n delivery.status === 'REJECTED';\n if (!canRetry) return null;\n return (\n <PermissionGuard permission={CHANNEL_PERMISSIONS.CHANNEL_DELIVERY_EXECUTE}>\n <button\n type=\"button\"\n onClick={() => handleRetry(delivery.id)}\n disabled={retryingId === delivery.id}\n className=\"flex items-center gap-1 px-2 py-1 text-xs font-medium text-accent-primary hover:bg-accent-primary/10 rounded transition-colors disabled:opacity-50\"\n title={tr('channel.retryDelivery', 'Retry this delivery')}\n >\n <RotateCcw\n size={12}\n className={retryingId === delivery.id ? 'animate-spin' : ''}\n />\n {retryingId === delivery.id\n ? tr('channel.retrying', 'Retrying...')\n : tr('channel.retry', 'Retry')}\n </button>\n </PermissionGuard>\n );\n },\n },\n ];\n\n // Loading state\n if (isLoading) {\n return (\n <output\n className=\"flex items-center justify-center min-h-screen\"\n aria-label={tr('channel.loading', 'Loading')}\n >\n <Loader2 size={32} className=\"animate-spin text-accent-primary\" aria-hidden=\"true\" />\n </output>\n );\n }\n\n // Error state\n if (error || !channel) {\n return (\n <div className=\"p-6\">\n <div className=\"flex items-center gap-3 p-4 bg-status-error-bg-subtle border border-status-error-border rounded-lg\">\n <AlertCircle size={20} className=\"text-status-error-text\" />\n <div>\n <p className=\"text-sm font-medium text-status-error-text\">\n {error || 'Channel not found'}\n </p>\n </div>\n <button\n type=\"button\"\n onClick={() => navigate(`/channels/${channelId}`)}\n className=\"ml-auto px-3 py-1 text-sm text-status-error-text hover:bg-status-error-bg-subtle rounded transition-colors\"\n >\n Go Back\n </button>\n </div>\n </div>\n );\n }\n\n return (\n <PermissionGuard permission={CHANNEL_PERMISSIONS.CHANNEL_DELIVERY_READ}>\n <div className=\"space-y-6 p-3 sm:p-6\">\n {/* Header */}\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between\">\n <div className=\"flex items-center gap-3\">\n <button\n type=\"button\"\n onClick={() => navigate(`/channels/${channelId}`)}\n aria-label={tr('channel.backToChannel', 'Back to channel')}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-bg-sunken rounded-lg transition-colors\"\n >\n <ArrowLeft size={20} aria-hidden=\"true\" />\n </button>\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-text-primary\">\n {tr('channel.deliveryHistory', 'Delivery History')}\n </h1>\n <p className=\"text-sm text-text-secondary mt-1\">\n {channel.name} - Message deliveries\n </p>\n </div>\n </div>\n <div className=\"flex items-center gap-3\">\n <select\n value={limit}\n onChange={(e) => setLimit(Number(e.target.value))}\n className=\"px-3 py-2 text-sm bg-surface border border-border-subtle rounded-lg focus:outline-none focus:ring-2 focus:ring-action-primary-bg/50 text-text-primary\"\n >\n <option value={10}>10 results</option>\n <option value={25}>25 results</option>\n <option value={50}>50 results</option>\n <option value={100}>100 results</option>\n </select>\n <CTAOverflowMenu\n actions={[\n {\n label: tr('channel.refresh', 'Refresh'),\n icon: (\n <RefreshCw\n size={16}\n className={isLoadingAttempts ? 'animate-spin' : ''}\n aria-hidden=\"true\"\n />\n ),\n disabled: isLoadingAttempts,\n onSelect: () => void loadAttempts(cursorStack[currentPageIdx]),\n },\n ...(canExport\n ? [\n {\n label: tr('channel.export', 'Export'),\n icon: isExportingDeliveries ? (\n <Loader2 size={16} className=\"animate-spin\" aria-hidden=\"true\" />\n ) : (\n <Download size={16} aria-hidden=\"true\" />\n ),\n disabled: isExportingDeliveries,\n onSelect: () => void exportDeliveries(),\n },\n ]\n : []),\n ]}\n />\n </div>\n </div>\n\n {/* Export Error Banner */}\n {exportDeliveriesError && (\n <div className=\"p-4 bg-status-error-bg-subtle border border-status-error-border rounded-lg flex items-center gap-3\">\n <AlertCircle size={20} className=\"text-status-error-text\" />\n <p className=\"text-sm text-status-error-text flex-1\">{exportDeliveriesError}</p>\n </div>\n )}\n\n {/* Error Banner */}\n {retryError && (\n <div className=\"p-4 bg-status-error-bg-subtle border border-status-error-border rounded-lg flex items-center gap-3\">\n <AlertCircle size={20} className=\"text-status-error-text\" />\n <p className=\"text-sm text-status-error-text flex-1\">{retryError}</p>\n <button\n type=\"button\"\n onClick={() => setRetryError(null)}\n className=\"text-status-error-text hover:text-status-error-text\"\n >\n {tr('channel.dismiss', 'Dismiss')}\n </button>\n </div>\n )}\n\n {/* Info Banner */}\n <GlassCard treatment=\"insight\" className=\"p-4 border-border-seam\">\n <p className=\"text-sm text-text-secondary\">\n Delivery history shows all message attempts sent through this channel. Data is retained\n for 7 days. Click retry on a failed delivery to attempt sending again.\n </p>\n </GlassCard>\n\n {/* Deliveries List */}\n {isLoadingAttempts ? (\n <div className=\"bg-surface border border-border-seam rounded-lg px-4 py-12 text-center\">\n <Loader2 size={24} className=\"animate-spin text-accent-primary mx-auto\" />\n <p className=\"text-sm text-text-secondary mt-2\">Loading delivery attempts…</p>\n </div>\n ) : (\n <ResponsiveTable\n columns={deliveryColumns}\n data={attempts}\n rowKey={(delivery) => delivery.id}\n className=\"bg-surface border border-border-seam rounded-lg\"\n emptyState={\n <div className=\"flex flex-col items-center gap-2 py-8\">\n <Send size={32} className=\"text-text-secondary\" />\n <p className=\"text-sm font-medium text-text-primary\">\n {tr('channel.noDeliveryAttempts', 'No delivery attempts yet')}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'channel.sendMessageToSeeHistory',\n 'Send a message through this channel to see delivery history'\n )}\n </p>\n </div>\n }\n />\n )}\n\n {/* Pagination footer */}\n <div className=\"flex items-center justify-between\">\n <p className=\"text-sm text-text-secondary\">\n {total > 0 && (\n <>\n {tr('channel.page', 'Page')}{' '}\n <span className=\"font-medium\">{currentPageIdx + 1}</span>\n {' · '}\n {tr('channel.totalRecords', 'Total')}: <span className=\"font-medium\">{total}</span>\n </>\n )}\n </p>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={handlePrevPage}\n disabled={!hasPrevPage || isLoadingAttempts}\n className=\"flex items-center gap-1 px-3 py-1.5 text-sm border border-border-subtle rounded-lg hover:bg-bg-sunken transition-colors disabled:opacity-40 disabled:cursor-not-allowed\"\n >\n <ChevronLeft size={16} />\n {tr('channel.previous', 'Previous')}\n </button>\n <button\n type=\"button\"\n onClick={() => void handleNextPage()}\n disabled={!hasNextPage || isLoadingAttempts}\n className=\"flex items-center gap-1 px-3 py-1.5 text-sm border border-border-subtle rounded-lg hover:bg-bg-sunken transition-colors disabled:opacity-40 disabled:cursor-not-allowed\"\n >\n {tr('channel.next', 'Next')}\n <ChevronRight size={16} />\n </button>\n </div>\n </div>\n </div>\n </PermissionGuard>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAoCA,IAAM,IAGF;CACF,SAAS;EAAE,OAAO;EAAW,OAAO;EAAoC,MAAM;EAAO;CACrF,QAAQ;EAAE,OAAO;EAAU,OAAO;EAAgD,MAAM;EAAO;CAC/F,SAAS;EAAE,OAAO;EAAW,OAAO;EAA4C,MAAM;EAAM;CAC5F,MAAM;EACJ,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD,WAAW;EACT,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD,QAAQ;EACN,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD,SAAS;EACP,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD,UAAU;EACR,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD,cAAc;EACZ,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD,UAAU;EACR,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD,QAAQ;EACN,OAAO;EACP,OAAO;EACP,MAAM;EACP;CAC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../../../src/channel/modules/channels/pages/DeliveryHistoryPage.tsx"],"sourcesContent":["/**\n * Delivery History Page\n *\n * Displays message delivery attempts for a specific channel with retry capability\n */\n\nimport { useState, useEffect, useCallback, useRef } from 'react';\nimport { useParams, useNavigate } from 'react-router-dom';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n ArrowLeft,\n Loader2,\n AlertCircle,\n CheckCircle2,\n XCircle,\n Clock,\n RefreshCw,\n Send,\n RotateCcw,\n Download,\n ChevronLeft,\n ChevronRight,\n} from 'lucide-react';\nimport {\n CTAOverflowMenu,\n EmphasisPanel,\n ResponsiveTable,\n IllustratedEmptyState,\n PagePurpose,\n type ResponsiveTableColumn,\n} from '@burdenoff/fe-libs/ui';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useChannel, type DeliveryStatus, type DeliveryAttempt } from '../../../hooks/useChannels';\nimport { useChannel as useChannelContext } from '../../../providers/ChannelProvider';\nimport { PermissionGuard } from '../../../components/PermissionGuard';\nimport { CHANNEL_PERMISSIONS } from '../../../constants/permissions';\nimport { useExportDeliveryAttempts } from '../hooks/useExport';\n\nconst STATUS_CONFIG: Record<\n DeliveryStatus,\n { label: string; color: string; icon: typeof CheckCircle2 }\n> = {\n PENDING: { label: 'Pending', color: 'text-text-secondary bg-bg-sunken', icon: Clock },\n QUEUED: { label: 'Queued', color: 'text-accent-primary bg-accent-primary-subtle', icon: Clock },\n SENDING: { label: 'Sending', color: 'text-accent-primary bg-accent-primary/10', icon: Send },\n SENT: {\n label: 'Sent',\n color: 'text-status-success-text bg-status-success-bg-subtle',\n icon: CheckCircle2,\n },\n DELIVERED: {\n label: 'Delivered',\n color: 'text-status-success-text bg-status-success-bg-subtle',\n icon: CheckCircle2,\n },\n FAILED: {\n label: 'Failed',\n color: 'text-status-error-text bg-status-error-bg-subtle',\n icon: XCircle,\n },\n BOUNCED: {\n label: 'Bounced',\n color: 'text-status-warning-text bg-status-warning-bg-subtle',\n icon: AlertCircle,\n },\n REJECTED: {\n label: 'Rejected',\n color: 'text-status-error-text bg-status-error-bg-subtle',\n icon: XCircle,\n },\n RATE_LIMITED: {\n label: 'Rate Limited',\n color: 'text-status-warning-text bg-status-warning-bg-subtle',\n icon: Clock,\n },\n RETRYING: {\n label: 'Retrying',\n color: 'text-accent-primary bg-accent-primary/10',\n icon: RefreshCw,\n },\n OPENED: {\n label: 'Opened',\n color: 'text-status-success-text bg-status-success-bg-subtle',\n icon: CheckCircle2,\n },\n CLICKED: {\n label: 'Clicked',\n color: 'text-status-success-text bg-status-success-bg-subtle',\n icon: CheckCircle2,\n },\n};\n\nexport function DeliveryHistoryPage() {\n const { channelId } = useParams<{ channelId: string }>();\n const navigate = useNavigate();\n const { hasPermission } = usePermissions();\n const canExport = hasPermission(CHANNEL_PERMISSIONS.CHANNEL_DELIVERY_EXPORT);\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const value = t(key);\n return value === key ? fallback : value;\n };\n const { organizationId } = useChannelContext();\n const {\n triggerExport: exportDeliveries,\n isExporting: isExportingDeliveries,\n exportError: exportDeliveriesError,\n } = useExportDeliveryAttempts(organizationId ?? undefined, channelId);\n const [isLoadingAttempts, setIsLoadingAttempts] = useState(true);\n const [attempts, setAttempts] = useState<DeliveryAttempt[]>([]);\n const [retryingId, setRetryingId] = useState<string | null>(null);\n const [retryError, setRetryError] = useState<string | null>(null);\n const [limit, setLimit] = useState(25);\n const [total, setTotal] = useState(0);\n // Cursor stack: index 0 is always undefined (first page), subsequent entries are cursors\n const [cursorStack, setCursorStack] = useState<(string | undefined)[]>([undefined]);\n const [currentPageIdx, setCurrentPageIdx] = useState(0);\n\n const { channel, isLoading, error, fetchDeliveryAttempts, retryDelivery } = useChannel(channelId);\n\n const loadAttempts = useCallback(\n async (cursor?: string) => {\n if (!channelId) return;\n setIsLoadingAttempts(true);\n setRetryError(null);\n try {\n const result = await fetchDeliveryAttempts(limit, cursor);\n setAttempts(result.items);\n setTotal(result.total);\n return result.nextCursor;\n } finally {\n setIsLoadingAttempts(false);\n }\n },\n [channelId, fetchDeliveryAttempts, limit]\n );\n\n const loadAttemptsRef = useRef(loadAttempts);\n const cursorStackRef = useRef(cursorStack);\n useEffect(() => {\n loadAttemptsRef.current = loadAttempts;\n cursorStackRef.current = cursorStack;\n });\n const isFirstPageRender = useRef(true);\n\n useEffect(() => {\n void Promise.resolve().then(() => {\n setCursorStack([undefined]);\n setCurrentPageIdx(0);\n void loadAttemptsRef.current(undefined);\n });\n }, [limit]);\n\n useEffect(() => {\n if (isFirstPageRender.current) {\n isFirstPageRender.current = false;\n return;\n }\n void Promise.resolve().then(() =>\n loadAttemptsRef.current(cursorStackRef.current[currentPageIdx])\n );\n }, [currentPageIdx]);\n\n // Poll for delivery attempt updates every 60 s on first page only\n useEffect(() => {\n if (!channelId || currentPageIdx !== 0) return;\n const timer = setInterval(() => {\n void loadAttempts(undefined);\n }, 60_000);\n return () => clearInterval(timer);\n }, [channelId, currentPageIdx, loadAttempts]);\n\n const handleNextPage = useCallback(async () => {\n const nextCursor = await loadAttempts(cursorStack[currentPageIdx]);\n if (nextCursor) {\n setCursorStack((prev) => {\n const next = [...prev];\n if (!next[currentPageIdx + 1]) {\n next[currentPageIdx + 1] = nextCursor;\n }\n return next;\n });\n }\n setCurrentPageIdx((p) => p + 1);\n }, [cursorStack, currentPageIdx, loadAttempts]);\n\n const handlePrevPage = useCallback(() => {\n const prevIdx = currentPageIdx - 1;\n setCurrentPageIdx(prevIdx);\n void loadAttempts(cursorStack[prevIdx]);\n }, [cursorStack, currentPageIdx, loadAttempts]);\n\n const hasNextPage = attempts.length === limit;\n const hasPrevPage = currentPageIdx > 0;\n\n const handleRetry = async (attemptId: string) => {\n setRetryingId(attemptId);\n setRetryError(null);\n try {\n const result = await retryDelivery(attemptId);\n if (!result.success) {\n setRetryError(result.error || 'Retry failed');\n } else {\n await loadAttempts(cursorStack[currentPageIdx]);\n }\n } finally {\n setRetryingId(null);\n }\n };\n\n const getStatusConfig = (status: DeliveryStatus) => {\n return STATUS_CONFIG[status] || STATUS_CONFIG.PENDING;\n };\n\n const deliveryColumns: ResponsiveTableColumn<DeliveryAttempt>[] = [\n {\n key: 'status',\n header: tr('channel.status', 'Status'),\n priority: 'primary',\n cell: (delivery) => {\n const statusConfig = getStatusConfig(delivery.status as DeliveryStatus);\n const StatusIcon = statusConfig.icon;\n return (\n <div className=\"flex items-center gap-2\">\n <StatusIcon size={14} className={statusConfig.color.split(' ')[0]} />\n <span className={`text-sm font-medium ${statusConfig.color}`}>\n {statusConfig.label}\n </span>\n </div>\n );\n },\n },\n {\n key: 'content',\n header: tr('channel.content', 'Content'),\n priority: 'primary',\n cellClassName: 'text-sm text-text-primary truncate max-w-xs',\n cell: (delivery) => delivery.content,\n },\n {\n key: 'sentAt',\n header: tr('channel.sentAt', 'Sent At'),\n priority: 'secondary',\n cellClassName: 'text-sm text-text-secondary',\n cell: (delivery) =>\n delivery.sentAt ? new Date(delivery.sentAt).toLocaleString() : '-',\n },\n {\n key: 'retries',\n header: tr('channel.retries', 'Retries'),\n priority: 'secondary',\n cellClassName: 'text-sm text-text-secondary tabular-nums',\n cell: (delivery) => delivery.retryCount,\n },\n {\n key: 'error',\n header: tr('channel.error', 'Error'),\n priority: 'secondary',\n cellClassName: 'text-sm text-status-error-text max-w-xs truncate',\n cell: (delivery) => delivery.errorMessage || '-',\n },\n {\n key: 'actions',\n header: tr('channel.actions', 'Actions'),\n priority: 'secondary',\n cell: (delivery) => {\n const canRetry =\n delivery.status === 'FAILED' ||\n delivery.status === 'BOUNCED' ||\n delivery.status === 'REJECTED';\n if (!canRetry) return null;\n return (\n <PermissionGuard permission={CHANNEL_PERMISSIONS.CHANNEL_DELIVERY_EXECUTE}>\n <button\n type=\"button\"\n onClick={() => handleRetry(delivery.id)}\n disabled={retryingId === delivery.id}\n className=\"flex items-center gap-1 px-2 py-1 text-xs font-medium text-accent-primary hover:bg-accent-primary/10 rounded transition-colors disabled:opacity-50\"\n title={tr('channel.retryDelivery', 'Retry this delivery')}\n >\n <RotateCcw\n size={12}\n className={retryingId === delivery.id ? 'animate-spin' : ''}\n />\n {retryingId === delivery.id\n ? tr('channel.retrying', 'Retrying...')\n : tr('channel.retry', 'Retry')}\n </button>\n </PermissionGuard>\n );\n },\n },\n ];\n\n // Loading state\n if (isLoading) {\n return (\n <output\n className=\"flex items-center justify-center min-h-screen\"\n aria-label={tr('channel.loading', 'Loading')}\n >\n <Loader2 size={32} className=\"animate-spin text-accent-primary\" aria-hidden=\"true\" />\n </output>\n );\n }\n\n // Error state\n if (error || !channel) {\n return (\n <div className=\"p-6\">\n <div className=\"flex items-center gap-3 p-4 bg-status-error-bg-subtle border border-status-error-border rounded-lg\">\n <AlertCircle size={20} className=\"text-status-error-text\" />\n <div>\n <p className=\"text-sm font-medium text-status-error-text\">\n {error || 'Channel not found'}\n </p>\n </div>\n <button\n type=\"button\"\n onClick={() => navigate(`/channels/${channelId}`)}\n className=\"ml-auto px-3 py-1 text-sm text-status-error-text hover:bg-status-error-bg-subtle rounded transition-colors\"\n >\n Go Back\n </button>\n </div>\n </div>\n );\n }\n\n return (\n <PermissionGuard permission={CHANNEL_PERMISSIONS.CHANNEL_DELIVERY_READ}>\n <div className=\"space-y-6 p-3 sm:p-6\">\n {/* Header */}\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between\">\n <div className=\"flex items-center gap-3\">\n <button\n type=\"button\"\n onClick={() => navigate(`/channels/${channelId}`)}\n aria-label={tr('channel.backToChannel', 'Back to channel')}\n className=\"p-2 text-text-secondary hover:text-text-primary hover:bg-bg-sunken rounded-lg transition-colors\"\n >\n <ArrowLeft size={20} aria-hidden=\"true\" />\n </button>\n <div>\n <h1 className=\"text-xl sm:text-2xl font-bold text-text-primary\">\n {tr('channel.deliveryHistory', 'Delivery History')}\n </h1>\n <p className=\"text-sm text-text-secondary mt-1\">\n {channel.name} - Message deliveries\n </p>\n </div>\n </div>\n <div className=\"flex items-center gap-3\">\n <select\n value={limit}\n onChange={(e) => setLimit(Number(e.target.value))}\n className=\"px-3 py-2 text-sm bg-surface border border-border-subtle rounded-lg focus:outline-none focus:ring-2 focus:ring-action-primary-bg/50 text-text-primary\"\n >\n <option value={10}>10 results</option>\n <option value={25}>25 results</option>\n <option value={50}>50 results</option>\n <option value={100}>100 results</option>\n </select>\n <CTAOverflowMenu\n actions={[\n {\n label: tr('channel.refresh', 'Refresh'),\n icon: (\n <RefreshCw\n size={16}\n className={isLoadingAttempts ? 'animate-spin' : ''}\n aria-hidden=\"true\"\n />\n ),\n disabled: isLoadingAttempts,\n onSelect: () => void loadAttempts(cursorStack[currentPageIdx]),\n },\n ...(canExport\n ? [\n {\n label: tr('channel.export', 'Export'),\n icon: isExportingDeliveries ? (\n <Loader2 size={16} className=\"animate-spin\" aria-hidden=\"true\" />\n ) : (\n <Download size={16} aria-hidden=\"true\" />\n ),\n disabled: isExportingDeliveries,\n onSelect: () => void exportDeliveries(),\n },\n ]\n : []),\n ]}\n />\n </div>\n </div>\n\n {/* Export Error Banner */}\n {exportDeliveriesError && (\n <div className=\"p-4 bg-status-error-bg-subtle border border-status-error-border rounded-lg flex items-center gap-3\">\n <AlertCircle size={20} className=\"text-status-error-text\" />\n <p className=\"text-sm text-status-error-text flex-1\">{exportDeliveriesError}</p>\n </div>\n )}\n\n {/* Error Banner */}\n {retryError && (\n <div className=\"p-4 bg-status-error-bg-subtle border border-status-error-border rounded-lg flex items-center gap-3\">\n <AlertCircle size={20} className=\"text-status-error-text\" />\n <p className=\"text-sm text-status-error-text flex-1\">{retryError}</p>\n <button\n type=\"button\"\n onClick={() => setRetryError(null)}\n className=\"text-status-error-text hover:text-status-error-text\"\n >\n {tr('channel.dismiss', 'Dismiss')}\n </button>\n </div>\n )}\n\n {/* Page purpose */}\n <PagePurpose icon={<Send size={15} aria-hidden=\"true\" />}>\n {tr(\n 'channel.deliveryHistoryPurpose',\n 'A per-message audit trail of everything this channel has tried to send — sent, delivered, opened, bounced or failed — with the error returned by the provider. Use it to confirm a notification actually went out, to debug why a delivery failed, and to retry failed attempts one by one. Records are kept for 7 days.'\n )}\n </PagePurpose>\n\n {/* Emphasis — delivery total summary */}\n <EmphasisPanel className=\"flex items-center gap-3 p-4\">\n <span className=\"rounded-lg bg-accent-orange/10 p-2\">\n <Send size={18} className=\"text-accent-orange\" aria-hidden=\"true\" />\n </span>\n <div>\n <p className=\"text-sm font-semibold text-text-primary\">\n {total}{' '}\n {total === 1\n ? tr('channel.deliveryAttemptSingular', 'delivery attempt')\n : tr('channel.deliveryAttemptsPlural', 'delivery attempts')}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'channel.deliveryHistoryBannerHint',\n 'All message attempts sent through this channel, retained for 7 days. Retry any failed delivery to attempt sending again.'\n )}\n </p>\n </div>\n </EmphasisPanel>\n\n {/* Deliveries List */}\n {isLoadingAttempts ? (\n <div className=\"bg-surface border border-border-seam rounded-lg px-4 py-12 text-center\">\n <Loader2 size={24} className=\"animate-spin text-accent-primary mx-auto\" />\n <p className=\"text-sm text-text-secondary mt-2\">Loading delivery attempts…</p>\n </div>\n ) : (\n <ResponsiveTable\n columns={deliveryColumns}\n data={attempts}\n rowKey={(delivery) => delivery.id}\n className=\"bg-surface border border-border-seam rounded-lg\"\n emptyState={\n <IllustratedEmptyState\n illustration=\"empty-notifications\"\n title={tr('channel.noDeliveryAttempts', 'No delivery attempts yet')}\n description={tr(\n 'channel.sendMessageToSeeHistory',\n 'Send a message through this channel to see delivery history'\n )}\n />\n }\n />\n )}\n\n {/* Pagination footer */}\n <div className=\"flex items-center justify-between\">\n <p className=\"text-sm text-text-secondary\">\n {total > 0 && (\n <>\n {tr('channel.page', 'Page')}{' '}\n <span className=\"font-medium\">{currentPageIdx + 1}</span>\n {' · '}\n {tr('channel.totalRecords', 'Total')}: <span className=\"font-medium\">{total}</span>\n </>\n )}\n </p>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={handlePrevPage}\n disabled={!hasPrevPage || isLoadingAttempts}\n className=\"flex items-center gap-1 px-3 py-1.5 text-sm border border-border-subtle rounded-lg hover:bg-bg-sunken transition-colors disabled:opacity-40 disabled:cursor-not-allowed\"\n >\n <ChevronLeft size={16} />\n {tr('channel.previous', 'Previous')}\n </button>\n <button\n type=\"button\"\n onClick={() => void handleNextPage()}\n disabled={!hasNextPage || isLoadingAttempts}\n className=\"flex items-center gap-1 px-3 py-1.5 text-sm border border-border-subtle rounded-lg hover:bg-bg-sunken transition-colors disabled:opacity-40 disabled:cursor-not-allowed\"\n >\n {tr('channel.next', 'Next')}\n <ChevronRight size={16} />\n </button>\n </div>\n </div>\n </div>\n </PermissionGuard>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAsCA,IAAM,IAGF;CACF,SAAS;EAAE,OAAO;EAAW,OAAO;EAAoC,MAAM;EAAO;CACrF,QAAQ;EAAE,OAAO;EAAU,OAAO;EAAgD,MAAM;EAAO;CAC/F,SAAS;EAAE,OAAO;EAAW,OAAO;EAA4C,MAAM;EAAM;CAC5F,MAAM;EACJ,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD,WAAW;EACT,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD,QAAQ;EACN,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD,SAAS;EACP,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD,UAAU;EACR,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD,cAAc;EACZ,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD,UAAU;EACR,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD,QAAQ;EACN,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD,SAAS;EACP,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACF;AAED,SAAgB,IAAsB;CACpC,IAAM,EAAE,iBAAc,GAAkC,EAClD,IAAW,GAAa,EACxB,EAAE,qBAAkB,IAAgB,EACpC,IAAY,EAAc,EAAoB,wBAAwB,EACtE,EAAE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