@burdenoff/microfe-botmanor 2026.1120.28 → 2026.1123.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/dist/botlit/pages/AiOperationsPage.js +100 -95
- package/dist/botlit/pages/AiOperationsPage.js.map +1 -1
- package/dist/botlit/pages/HandoffsPage.js +183 -179
- package/dist/botlit/pages/HandoffsPage.js.map +1 -1
- package/dist/botlit/permissions/botmanorPermissions.d.ts +1 -0
- package/dist/botlit/permissions/botmanorPermissions.js +1 -0
- package/dist/botlit/permissions/botmanorPermissions.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
import { useTr as e } from "../../shared/hooks/useTr.js";
|
|
2
2
|
import { useAgents as t } from "../hooks/useAgents.js";
|
|
3
3
|
import { PageLayout as n } from "../components/PageLayout.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
4
|
+
import { BOTMANOR_PERMISSIONS as r } from "../permissions/botmanorPermissions.js";
|
|
5
|
+
import { useBotmanorPermission as i } from "../permissions/useBotmanorPermissions.js";
|
|
6
|
+
import { Card as a, CardContent as o, CardDescription as s, CardHeader as c, CardTitle as l } from "../components/Card.js";
|
|
7
|
+
import { Button as u } from "../components/Button.js";
|
|
8
|
+
import { Badge as d } from "../components/Badge.js";
|
|
9
|
+
import { EmptyState as f } from "../components/EmptyState.js";
|
|
10
|
+
import { ErrorState as p } from "../components/ErrorState.js";
|
|
11
|
+
import { Textarea as m } from "../components/Input.js";
|
|
10
12
|
import "../hooks/index.js";
|
|
11
|
-
import { BotmanorHandoffMessageRole as
|
|
12
|
-
import { formatRelativeTime as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { shortUserLabel as ne, useWorkspaceMemberDirectory as
|
|
16
|
-
import { isHandoffConflict as
|
|
17
|
-
import { LoadMore as
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
13
|
+
import { BotmanorHandoffMessageRole as h, BotmanorHandoffStatus as g } from "../../generated/wspace-types.js";
|
|
14
|
+
import { formatRelativeTime as _ } from "../utils/formatters.js";
|
|
15
|
+
import { useHandoffInbox as v } from "../hooks/useHandoffInbox.js";
|
|
16
|
+
import { isActiveHandoff as y, useAcceptHandoff as b, useAssignHandoff as x, useHandoffTranscript as S, useRejectHandoff as C, useReleaseHandoff as w, useReplyToHandoff as ee, useResolveHandoff as te } from "../hooks/useHandoffs.js";
|
|
17
|
+
import { shortUserLabel as ne, useWorkspaceMemberDirectory as T } from "../hooks/useWorkspaceMemberDirectory.js";
|
|
18
|
+
import { isHandoffConflict as E } from "../utils/handoffInbox.js";
|
|
19
|
+
import { LoadMore as D } from "../components/LoadMore.js";
|
|
20
|
+
import "../permissions/index.js";
|
|
21
|
+
import { useEffect as O, useMemo as k, useRef as re, useState as A } from "react";
|
|
22
|
+
import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
|
|
23
|
+
import { useSearchParams as P } from "react-router";
|
|
21
24
|
// src/botlit/pages/HandoffsPage.tsx
|
|
22
|
-
var
|
|
25
|
+
var F = "handoff", I = [
|
|
23
26
|
{
|
|
24
27
|
id: "active",
|
|
25
28
|
statuses: [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
g.Requested,
|
|
30
|
+
g.Assigned,
|
|
31
|
+
g.Accepted
|
|
29
32
|
],
|
|
30
33
|
labelKey: "botlit.handoffs.filter.active",
|
|
31
34
|
label: "Active"
|
|
@@ -33,9 +36,9 @@ var N = "handoff", P = [
|
|
|
33
36
|
{
|
|
34
37
|
id: "resolved",
|
|
35
38
|
statuses: [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
g.Resolved,
|
|
40
|
+
g.Released,
|
|
41
|
+
g.Rejected
|
|
39
42
|
],
|
|
40
43
|
labelKey: "botlit.handoffs.filter.resolved",
|
|
41
44
|
label: "Closed"
|
|
@@ -55,37 +58,37 @@ var N = "handoff", P = [
|
|
|
55
58
|
POLICY_REFUSAL: n("botlit.handoffs.trigger.policyRefusal", "Policy refusal"),
|
|
56
59
|
MANUAL: n("botlit.handoffs.trigger.manual", "Manual")
|
|
57
60
|
};
|
|
58
|
-
return /* @__PURE__ */
|
|
61
|
+
return /* @__PURE__ */ M(d, {
|
|
59
62
|
variant: "outline",
|
|
60
63
|
children: r[t.trigger] ?? t.trigger
|
|
61
64
|
});
|
|
62
|
-
},
|
|
65
|
+
}, ae = ({ status: t }) => {
|
|
63
66
|
let n = e(), r = {
|
|
64
|
-
[
|
|
67
|
+
[g.Requested]: {
|
|
65
68
|
text: n("botlit.handoffs.status.requested", "Requested"),
|
|
66
69
|
variant: "warning"
|
|
67
70
|
},
|
|
68
|
-
[
|
|
71
|
+
[g.Assigned]: {
|
|
69
72
|
text: n("botlit.handoffs.status.assigned", "Assigned"),
|
|
70
73
|
variant: "warning"
|
|
71
74
|
},
|
|
72
|
-
[
|
|
75
|
+
[g.Accepted]: {
|
|
73
76
|
text: n("botlit.handoffs.status.accepted", "Accepted"),
|
|
74
77
|
variant: "success"
|
|
75
78
|
},
|
|
76
|
-
[
|
|
79
|
+
[g.Resolved]: {
|
|
77
80
|
text: n("botlit.handoffs.status.resolved", "Resolved"),
|
|
78
81
|
variant: "outline"
|
|
79
82
|
},
|
|
80
|
-
[
|
|
83
|
+
[g.Released]: {
|
|
81
84
|
text: n("botlit.handoffs.status.released", "Released to bot"),
|
|
82
85
|
variant: "outline"
|
|
83
86
|
},
|
|
84
|
-
[
|
|
87
|
+
[g.Rejected]: {
|
|
85
88
|
text: n("botlit.handoffs.status.rejected", "Rejected"),
|
|
86
89
|
variant: "destructive"
|
|
87
90
|
},
|
|
88
|
-
[
|
|
91
|
+
[g.Expired]: {
|
|
89
92
|
text: n("botlit.handoffs.status.expired", "Expired"),
|
|
90
93
|
variant: "outline"
|
|
91
94
|
}
|
|
@@ -93,378 +96,379 @@ var N = "handoff", P = [
|
|
|
93
96
|
text: String(t),
|
|
94
97
|
variant: "outline"
|
|
95
98
|
};
|
|
96
|
-
return /* @__PURE__ */
|
|
99
|
+
return /* @__PURE__ */ M(d, {
|
|
97
100
|
variant: r.variant,
|
|
98
101
|
children: r.text
|
|
99
102
|
});
|
|
100
|
-
},
|
|
101
|
-
function
|
|
103
|
+
}, L = 1e4;
|
|
104
|
+
function R(e, t) {
|
|
102
105
|
return Math.round((new Date(e).getTime() - t) / 6e4);
|
|
103
106
|
}
|
|
104
107
|
var oe = ({ handoff: t }) => {
|
|
105
|
-
let n = e(), [r, i] =
|
|
106
|
-
if (
|
|
108
|
+
let n = e(), [r, i] = A(() => Date.now()), a = y(t.status) && !t.firstResponseAt;
|
|
109
|
+
if (O(() => {
|
|
107
110
|
if (!a) return;
|
|
108
111
|
let e = window.setInterval(() => i(Date.now()), 3e4);
|
|
109
112
|
return () => window.clearInterval(e);
|
|
110
113
|
}, [a]), !t.slaDueAt) return null;
|
|
111
|
-
if (t.slaBreached || a && new Date(t.slaDueAt).getTime() <= r) return /* @__PURE__ */
|
|
114
|
+
if (t.slaBreached || a && new Date(t.slaDueAt).getTime() <= r) return /* @__PURE__ */ M(d, {
|
|
112
115
|
variant: "destructive",
|
|
113
116
|
"data-testid": "handoff-sla",
|
|
114
117
|
children: n("botlit.handoffs.sla.breached", "SLA breached")
|
|
115
118
|
});
|
|
116
|
-
if (t.firstResponseAt) return /* @__PURE__ */
|
|
119
|
+
if (t.firstResponseAt) return /* @__PURE__ */ M(d, {
|
|
117
120
|
variant: "success",
|
|
118
121
|
"data-testid": "handoff-sla",
|
|
119
122
|
children: n("botlit.handoffs.sla.met", "SLA met")
|
|
120
123
|
});
|
|
121
124
|
if (!a) return null;
|
|
122
|
-
let o = Math.max(
|
|
123
|
-
return /* @__PURE__ */
|
|
125
|
+
let o = Math.max(R(t.slaDueAt, r), 0);
|
|
126
|
+
return /* @__PURE__ */ M(d, {
|
|
124
127
|
variant: "warning",
|
|
125
128
|
"data-testid": "handoff-sla",
|
|
126
129
|
children: n("botlit.handoffs.sla.due", "Reply due in {{minutes}} min", { minutes: o })
|
|
127
130
|
});
|
|
128
|
-
},
|
|
129
|
-
[
|
|
131
|
+
}, z = {
|
|
132
|
+
[h.Customer]: {
|
|
130
133
|
key: "botlit.handoffs.thread.customer",
|
|
131
134
|
label: "Customer"
|
|
132
135
|
},
|
|
133
|
-
[
|
|
136
|
+
[h.Bot]: {
|
|
134
137
|
key: "botlit.handoffs.thread.bot",
|
|
135
138
|
label: "Bot"
|
|
136
139
|
},
|
|
137
|
-
[
|
|
140
|
+
[h.Operator]: {
|
|
138
141
|
key: "botlit.handoffs.thread.operator",
|
|
139
142
|
label: "Operator"
|
|
140
143
|
}
|
|
141
|
-
},
|
|
144
|
+
}, se = ({ handoffId: t, messages: n }) => {
|
|
142
145
|
let r = e();
|
|
143
|
-
return n.length === 0 ? /* @__PURE__ */
|
|
146
|
+
return n.length === 0 ? /* @__PURE__ */ M("p", {
|
|
144
147
|
className: "text-sm text-text-secondary",
|
|
145
148
|
children: r("botlit.handoffs.thread.empty", "No messages on this handoff yet.")
|
|
146
|
-
}) : /* @__PURE__ */
|
|
149
|
+
}) : /* @__PURE__ */ M("ol", {
|
|
147
150
|
className: "grid gap-2 rounded-card border border-border-seam p-3",
|
|
148
151
|
"aria-label": r("botlit.handoffs.thread.label", "Conversation"),
|
|
149
152
|
"data-testid": `handoff-thread-${t}`,
|
|
150
153
|
children: n.map((e) => {
|
|
151
|
-
let t =
|
|
154
|
+
let t = z[e.role] ?? {
|
|
152
155
|
key: "",
|
|
153
156
|
label: String(e.role)
|
|
154
157
|
};
|
|
155
|
-
return /* @__PURE__ */
|
|
158
|
+
return /* @__PURE__ */ N("li", {
|
|
156
159
|
className: "grid gap-0.5",
|
|
157
|
-
children: [/* @__PURE__ */
|
|
160
|
+
children: [/* @__PURE__ */ N("span", {
|
|
158
161
|
className: "text-xs font-medium text-text-secondary",
|
|
159
162
|
children: [
|
|
160
163
|
t.key ? r(t.key, t.label) : t.label,
|
|
161
164
|
" ·",
|
|
162
165
|
" ",
|
|
163
|
-
|
|
166
|
+
_(e.createdAt)
|
|
164
167
|
]
|
|
165
|
-
}), /* @__PURE__ */
|
|
168
|
+
}), /* @__PURE__ */ M("span", {
|
|
166
169
|
className: "text-sm whitespace-pre-wrap text-text-primary",
|
|
167
170
|
children: e.text
|
|
168
171
|
})]
|
|
169
172
|
}, e.id);
|
|
170
173
|
})
|
|
171
174
|
});
|
|
172
|
-
},
|
|
173
|
-
let
|
|
174
|
-
|
|
175
|
-
|
|
175
|
+
}, B = ({ handoff: t, agents: n, members: r, isNew: i, canManage: a, onChanged: o, linked: s = !1 }) => {
|
|
176
|
+
let c = e(), [l, f] = b(), [p, h] = w(), [v, T] = te(), [D, k] = C(), [P, F] = x(), [I, R] = ee(), z = y(t.status), B = t.status === g.Accepted, [V, H] = A(null), U = V && V.linked === s ? V.open : s, W = re(null);
|
|
177
|
+
O(() => {
|
|
178
|
+
s && W.current?.scrollIntoView?.({
|
|
176
179
|
block: "center",
|
|
177
180
|
behavior: "smooth"
|
|
178
181
|
});
|
|
179
|
-
}, [
|
|
180
|
-
let G =
|
|
181
|
-
|
|
182
|
+
}, [s]);
|
|
183
|
+
let G = S(U ? t.id : void 0), K = G.refetch;
|
|
184
|
+
O(() => {
|
|
182
185
|
if (!U || !z) return;
|
|
183
186
|
let e = window.setInterval(() => {
|
|
184
187
|
K();
|
|
185
|
-
},
|
|
188
|
+
}, L);
|
|
186
189
|
return () => window.clearInterval(e);
|
|
187
190
|
}, [
|
|
188
191
|
U,
|
|
189
192
|
z,
|
|
190
193
|
K
|
|
191
194
|
]);
|
|
192
|
-
let [q, J] =
|
|
195
|
+
let [q, J] = A(""), [Y, X] = A(""), Z = f.loading || h.loading || T.loading || k.loading || F.loading || R.loading, Q = f.error ?? h.error ?? T.error ?? k.error ?? F.error ?? R.error, ce = Q ? E(Q) : !1, le = (e) => r.find((t) => t.userId === e)?.displayName ?? ne(e), ue = async (e) => {
|
|
193
196
|
e.preventDefault();
|
|
194
197
|
let n = q.trim();
|
|
195
198
|
if (n) try {
|
|
196
199
|
await I({
|
|
197
200
|
id: t.id,
|
|
198
201
|
message: n
|
|
199
|
-
}), J(""), await G.refetch(),
|
|
202
|
+
}), J(""), await G.refetch(), o();
|
|
200
203
|
} catch {}
|
|
201
|
-
},
|
|
204
|
+
}, de = async (e) => {
|
|
202
205
|
e.preventDefault();
|
|
203
206
|
let n = Y.trim();
|
|
204
207
|
if (n) try {
|
|
205
|
-
await
|
|
208
|
+
await P({
|
|
206
209
|
id: t.id,
|
|
207
210
|
assigneeId: n
|
|
208
|
-
}), X(""),
|
|
211
|
+
}), X(""), o();
|
|
209
212
|
} catch {}
|
|
210
213
|
}, $ = async (e) => {
|
|
211
214
|
try {
|
|
212
|
-
await e(t.id),
|
|
215
|
+
await e(t.id), o();
|
|
213
216
|
} catch (e) {
|
|
214
|
-
|
|
217
|
+
E(e) && o();
|
|
215
218
|
}
|
|
216
219
|
};
|
|
217
|
-
return /* @__PURE__ */
|
|
220
|
+
return /* @__PURE__ */ N("li", {
|
|
218
221
|
ref: W,
|
|
219
222
|
"data-testid": `handoff-row-${t.id}`,
|
|
220
|
-
"aria-current":
|
|
221
|
-
className: `grid gap-3 rounded-card border bg-bg-surface p-4 ${
|
|
223
|
+
"aria-current": s ? "true" : void 0,
|
|
224
|
+
className: `grid gap-3 rounded-card border bg-bg-surface p-4 ${s ? "border-primary ring-2 ring-primary" : "border-border-seam"}`,
|
|
222
225
|
children: [
|
|
223
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ N("div", {
|
|
224
227
|
className: "flex flex-wrap items-center gap-2",
|
|
225
228
|
children: [
|
|
226
|
-
i ? /* @__PURE__ */
|
|
229
|
+
i ? /* @__PURE__ */ M(d, {
|
|
227
230
|
variant: "default",
|
|
228
|
-
children:
|
|
231
|
+
children: c("botlit.handoffs.new", "New")
|
|
229
232
|
}) : null,
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
/* @__PURE__ */
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
t.replyChannel ? /* @__PURE__ */
|
|
233
|
+
/* @__PURE__ */ M(ae, { status: t.status }),
|
|
234
|
+
/* @__PURE__ */ M(ie, { handoff: t }),
|
|
235
|
+
/* @__PURE__ */ M(oe, { handoff: t }),
|
|
236
|
+
t.replyChannel ? /* @__PURE__ */ M(d, {
|
|
234
237
|
variant: "outline",
|
|
235
238
|
children: t.replyChannel
|
|
236
239
|
}) : null,
|
|
237
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ M("span", {
|
|
238
241
|
className: "text-xs text-text-secondary",
|
|
239
|
-
children:
|
|
242
|
+
children: c("botlit.handoffs.opened", "Opened {{time}}", { time: _(t.createdAt) })
|
|
240
243
|
})
|
|
241
244
|
]
|
|
242
245
|
}),
|
|
243
|
-
/* @__PURE__ */
|
|
246
|
+
/* @__PURE__ */ M("p", {
|
|
244
247
|
className: "text-sm text-text-primary",
|
|
245
248
|
children: t.reason
|
|
246
249
|
}),
|
|
247
|
-
t.userMessage ? /* @__PURE__ */
|
|
250
|
+
t.userMessage ? /* @__PURE__ */ M("blockquote", {
|
|
248
251
|
className: "border-l-2 border-border-seam pl-3 text-sm text-text-secondary italic",
|
|
249
252
|
children: t.userMessage
|
|
250
253
|
}) : null,
|
|
251
|
-
/* @__PURE__ */
|
|
254
|
+
/* @__PURE__ */ N("div", {
|
|
252
255
|
className: "flex flex-wrap items-center gap-2 text-xs text-text-secondary",
|
|
253
|
-
children: [/* @__PURE__ */
|
|
256
|
+
children: [/* @__PURE__ */ M("span", { children: n.get(t.agentId) ? c("botlit.handoffs.agent", "Agent {{name}}", { name: n.get(t.agentId) }) : c("botlit.handoffs.conversation", "Conversation {{key}}", { key: t.conversationKey }) }), t.assignedToId ? /* @__PURE__ */ M("span", { children: c("botlit.handoffs.assignedTo", "· with {{who}}", { who: le(t.assignedToId) }) }) : null]
|
|
254
257
|
}),
|
|
255
|
-
/* @__PURE__ */
|
|
258
|
+
/* @__PURE__ */ M("div", { children: /* @__PURE__ */ M(u, {
|
|
256
259
|
size: "sm",
|
|
257
260
|
variant: "ghost",
|
|
258
261
|
"aria-expanded": U,
|
|
259
262
|
onClick: () => H({
|
|
260
|
-
linked:
|
|
263
|
+
linked: s,
|
|
261
264
|
open: !U
|
|
262
265
|
}),
|
|
263
|
-
children: U ?
|
|
266
|
+
children: U ? c("botlit.handoffs.thread.hide", "Hide conversation") : c("botlit.handoffs.thread.show", "Show conversation")
|
|
264
267
|
}) }),
|
|
265
|
-
U ? G.loading && G.data.length === 0 ? /* @__PURE__ */
|
|
268
|
+
U ? G.loading && G.data.length === 0 ? /* @__PURE__ */ M("p", {
|
|
266
269
|
role: "status",
|
|
267
270
|
className: "text-sm text-text-secondary",
|
|
268
|
-
children:
|
|
269
|
-
}) : G.error ? /* @__PURE__ */
|
|
271
|
+
children: c("botlit.handoffs.thread.loading", "Loading conversation…")
|
|
272
|
+
}) : G.error ? /* @__PURE__ */ M("p", {
|
|
270
273
|
role: "alert",
|
|
271
274
|
className: "text-sm text-status-danger-text",
|
|
272
275
|
children: G.error.message
|
|
273
|
-
}) : /* @__PURE__ */
|
|
276
|
+
}) : /* @__PURE__ */ M(se, {
|
|
274
277
|
handoffId: t.id,
|
|
275
278
|
messages: G.data
|
|
276
279
|
}) : null,
|
|
277
|
-
B && t.replyChannel ? /* @__PURE__ */
|
|
280
|
+
a && B && t.replyChannel ? /* @__PURE__ */ N("form", {
|
|
278
281
|
className: "grid gap-2",
|
|
279
|
-
onSubmit: (e) => void
|
|
282
|
+
onSubmit: (e) => void ue(e),
|
|
280
283
|
children: [
|
|
281
|
-
/* @__PURE__ */
|
|
284
|
+
/* @__PURE__ */ M("label", {
|
|
282
285
|
className: "text-sm font-medium text-text-primary",
|
|
283
286
|
htmlFor: `reply-${t.id}`,
|
|
284
|
-
children:
|
|
287
|
+
children: c("botlit.handoffs.reply.label", "Reply to the customer")
|
|
285
288
|
}),
|
|
286
|
-
/* @__PURE__ */
|
|
289
|
+
/* @__PURE__ */ M(m, {
|
|
287
290
|
id: `reply-${t.id}`,
|
|
288
291
|
value: q,
|
|
289
292
|
maxLength: 4e3,
|
|
290
293
|
rows: 3,
|
|
291
294
|
onChange: (e) => J(e.target.value),
|
|
292
|
-
placeholder:
|
|
295
|
+
placeholder: c("botlit.handoffs.reply.placeholder", "Sent in the same thread as the bot — the bot stays quiet until you hand back.")
|
|
293
296
|
}),
|
|
294
|
-
/* @__PURE__ */
|
|
297
|
+
/* @__PURE__ */ M("div", { children: /* @__PURE__ */ M(u, {
|
|
295
298
|
size: "sm",
|
|
296
299
|
type: "submit",
|
|
297
300
|
disabled: Z || !q.trim(),
|
|
298
|
-
children:
|
|
301
|
+
children: c("botlit.handoffs.reply.send", "Send reply")
|
|
299
302
|
}) })
|
|
300
303
|
]
|
|
301
304
|
}) : null,
|
|
302
|
-
B && !t.replyChannel ? /* @__PURE__ */
|
|
305
|
+
B && !t.replyChannel ? /* @__PURE__ */ M("p", {
|
|
303
306
|
className: "text-sm text-text-secondary",
|
|
304
|
-
children:
|
|
307
|
+
children: c("botlit.handoffs.reply.webChat", "This conversation came from web chat, which has no channel to reply on.")
|
|
305
308
|
}) : null,
|
|
306
|
-
z ? /* @__PURE__ */
|
|
309
|
+
a && z ? /* @__PURE__ */ N("form", {
|
|
307
310
|
className: "flex flex-wrap items-center gap-2",
|
|
308
|
-
onSubmit: (e) => void
|
|
311
|
+
onSubmit: (e) => void de(e),
|
|
309
312
|
children: [
|
|
310
|
-
/* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ M("label", {
|
|
311
314
|
className: "sr-only",
|
|
312
315
|
htmlFor: `assign-${t.id}`,
|
|
313
|
-
children:
|
|
316
|
+
children: c("botlit.handoffs.assign.label", "Assign to a teammate")
|
|
314
317
|
}),
|
|
315
|
-
/* @__PURE__ */
|
|
318
|
+
/* @__PURE__ */ N("select", {
|
|
316
319
|
id: `assign-${t.id}`,
|
|
317
320
|
className: "h-9 max-w-xs rounded-md border border-border-default bg-bg-surface px-3 text-sm text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
|
|
318
321
|
value: Y,
|
|
319
322
|
onChange: (e) => X(e.target.value),
|
|
320
|
-
children: [/* @__PURE__ */
|
|
323
|
+
children: [/* @__PURE__ */ M("option", {
|
|
321
324
|
value: "",
|
|
322
|
-
children:
|
|
323
|
-
}), r.filter((e) => e.userId !== t.assignedToId).map((e) => /* @__PURE__ */
|
|
325
|
+
children: c("botlit.handoffs.assign.placeholder", "Choose a teammate")
|
|
326
|
+
}), r.filter((e) => e.userId !== t.assignedToId).map((e) => /* @__PURE__ */ M("option", {
|
|
324
327
|
value: e.userId,
|
|
325
328
|
children: e.email ? `${e.displayName} (${e.email})` : e.displayName
|
|
326
329
|
}, e.userId))]
|
|
327
330
|
}),
|
|
328
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ M(u, {
|
|
329
332
|
size: "sm",
|
|
330
333
|
variant: "outline",
|
|
331
334
|
type: "submit",
|
|
332
335
|
disabled: Z || !Y.trim(),
|
|
333
|
-
children:
|
|
336
|
+
children: c("botlit.handoffs.assign.submit", "Assign")
|
|
334
337
|
})
|
|
335
338
|
]
|
|
336
339
|
}) : null,
|
|
337
|
-
Q ? /* @__PURE__ */
|
|
340
|
+
Q ? /* @__PURE__ */ M("div", {
|
|
338
341
|
role: "alert",
|
|
339
342
|
className: "flex flex-wrap items-center gap-2 text-sm text-status-danger-text",
|
|
340
|
-
children: /* @__PURE__ */
|
|
343
|
+
children: /* @__PURE__ */ M("span", { children: ce ? c("botlit.handoffs.conflict", "A teammate changed this handoff first (for example, took it over). The inbox has been refreshed.") : Q.message })
|
|
341
344
|
}) : null,
|
|
342
|
-
/* @__PURE__ */
|
|
345
|
+
a ? /* @__PURE__ */ N("div", {
|
|
343
346
|
className: "flex flex-wrap gap-2",
|
|
344
|
-
children: [t.status ===
|
|
347
|
+
children: [t.status === g.Requested || t.status === g.Assigned ? /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M(u, {
|
|
345
348
|
size: "sm",
|
|
346
349
|
disabled: Z,
|
|
347
|
-
onClick: () => void $(
|
|
348
|
-
children:
|
|
349
|
-
}), /* @__PURE__ */
|
|
350
|
+
onClick: () => void $(l),
|
|
351
|
+
children: c("botlit.handoffs.actions.takeOver", "Take over")
|
|
352
|
+
}), /* @__PURE__ */ M(u, {
|
|
350
353
|
size: "sm",
|
|
351
354
|
variant: "outline",
|
|
352
355
|
disabled: Z,
|
|
353
356
|
onClick: () => void $(D),
|
|
354
|
-
children:
|
|
355
|
-
})] }) : null, t.status ===
|
|
357
|
+
children: c("botlit.handoffs.actions.reject", "Reject")
|
|
358
|
+
})] }) : null, t.status === g.Accepted ? /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M(u, {
|
|
356
359
|
size: "sm",
|
|
357
360
|
variant: "outline",
|
|
358
361
|
disabled: Z,
|
|
359
362
|
onClick: () => void $(p),
|
|
360
|
-
children:
|
|
361
|
-
}), /* @__PURE__ */
|
|
363
|
+
children: c("botlit.handoffs.actions.handBack", "Hand back to bot")
|
|
364
|
+
}), /* @__PURE__ */ M(u, {
|
|
362
365
|
size: "sm",
|
|
363
366
|
disabled: Z,
|
|
364
|
-
onClick: () => void $(
|
|
365
|
-
children:
|
|
367
|
+
onClick: () => void $(v),
|
|
368
|
+
children: c("botlit.handoffs.actions.resolve", "Resolve")
|
|
366
369
|
})] }) : null]
|
|
367
|
-
})
|
|
370
|
+
}) : null
|
|
368
371
|
]
|
|
369
372
|
});
|
|
370
|
-
},
|
|
373
|
+
}, V = ({ linkedId: t, filter: n, items: r }) => {
|
|
371
374
|
let i = e();
|
|
372
|
-
return !t || !r || r.some((e) => e.id === t) ? null : /* @__PURE__ */
|
|
375
|
+
return !t || !r || r.some((e) => e.id === t) ? null : /* @__PURE__ */ M("p", {
|
|
373
376
|
role: "status",
|
|
374
377
|
className: "text-sm text-text-secondary",
|
|
375
378
|
"data-testid": "handoff-link-missing",
|
|
376
379
|
children: n === "all" ? i("botlit.handoffs.linkMissing", "The handoff from your notification could not be found. It may have been removed.") : i("botlit.handoffs.linkMissingFiltered", "The handoff from your notification is not in this list. Switch to All to see every status.")
|
|
377
380
|
});
|
|
378
381
|
};
|
|
379
|
-
function
|
|
380
|
-
let [t, n] =
|
|
382
|
+
function H(e) {
|
|
383
|
+
let [t, n] = A(null), r = e ? "all" : "active";
|
|
381
384
|
return [t && t.linkedId === e ? t.filter : r, (t) => n({
|
|
382
385
|
linkedId: e,
|
|
383
386
|
filter: t
|
|
384
387
|
})];
|
|
385
388
|
}
|
|
386
|
-
var
|
|
387
|
-
let
|
|
388
|
-
return /* @__PURE__ */
|
|
389
|
-
title:
|
|
390
|
-
description:
|
|
391
|
-
children: /* @__PURE__ */
|
|
389
|
+
var U = () => {
|
|
390
|
+
let d = e(), m = i(r.AGENT_UPDATE), [h] = P(), g = h.get("handoff")?.trim() || null, [_, y] = H(g), b = I.find((e) => e.id === _) ?? I[0], x = v({ statuses: b.statuses ?? void 0 }), S = T(), C = t(), w = k(() => new Map((C.data ?? []).map((e) => [e.id, e.name])), [C.data]);
|
|
391
|
+
return /* @__PURE__ */ M(n, {
|
|
392
|
+
title: d("botlit.handoffs.title", "Human Handoffs"),
|
|
393
|
+
description: d("botlit.handoffs.description", "Conversations the runtime handed to your team. Taking one over stops the bot from replying until you hand it back."),
|
|
394
|
+
children: /* @__PURE__ */ N("div", {
|
|
392
395
|
className: "mx-auto flex w-full max-w-4xl flex-col gap-4 p-4",
|
|
393
396
|
children: [
|
|
394
|
-
/* @__PURE__ */
|
|
397
|
+
/* @__PURE__ */ N("div", {
|
|
395
398
|
className: "flex flex-wrap items-center gap-2",
|
|
396
399
|
children: [
|
|
397
|
-
|
|
400
|
+
I.map((e) => /* @__PURE__ */ M(u, {
|
|
398
401
|
size: "sm",
|
|
399
|
-
variant:
|
|
400
|
-
onClick: () =>
|
|
401
|
-
children:
|
|
402
|
+
variant: _ === e.id ? "primary" : "outline",
|
|
403
|
+
onClick: () => y(e.id),
|
|
404
|
+
children: d(e.labelKey, e.label)
|
|
402
405
|
}, e.id)),
|
|
403
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ M(u, {
|
|
404
407
|
size: "sm",
|
|
405
408
|
variant: "outline",
|
|
406
|
-
isLoading:
|
|
407
|
-
onClick: () => void
|
|
408
|
-
children:
|
|
409
|
+
isLoading: x.refreshing,
|
|
410
|
+
onClick: () => void x.refresh(),
|
|
411
|
+
children: d("botlit.handoffs.refresh", "Refresh")
|
|
409
412
|
}),
|
|
410
|
-
/* @__PURE__ */
|
|
413
|
+
/* @__PURE__ */ M("span", {
|
|
411
414
|
className: "text-xs text-text-secondary",
|
|
412
|
-
children:
|
|
415
|
+
children: d("botlit.handoffs.autoRefresh", "Updates automatically while this page is open.")
|
|
413
416
|
})
|
|
414
417
|
]
|
|
415
418
|
}),
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
-
linkedId:
|
|
418
|
-
filter:
|
|
419
|
-
items:
|
|
419
|
+
/* @__PURE__ */ M(V, {
|
|
420
|
+
linkedId: g,
|
|
421
|
+
filter: _,
|
|
422
|
+
items: x.loading || x.error ? null : x.items
|
|
420
423
|
}),
|
|
421
|
-
/* @__PURE__ */
|
|
424
|
+
/* @__PURE__ */ M("div", {
|
|
422
425
|
"aria-live": "polite",
|
|
423
|
-
children:
|
|
426
|
+
children: x.newIds.size > 0 ? /* @__PURE__ */ N("div", {
|
|
424
427
|
className: "flex flex-wrap items-center gap-2 rounded-card border border-status-info-border bg-status-info-bg-subtle p-3 text-sm text-text-primary",
|
|
425
|
-
children: [/* @__PURE__ */
|
|
428
|
+
children: [/* @__PURE__ */ M("span", { children: d("botlit.handoffs.newArrived", "{{count}} new handoff(s) arrived.", { count: x.newIds.size }) }), /* @__PURE__ */ M(u, {
|
|
426
429
|
size: "sm",
|
|
427
430
|
variant: "ghost",
|
|
428
|
-
onClick:
|
|
429
|
-
children:
|
|
431
|
+
onClick: x.acknowledgeNew,
|
|
432
|
+
children: d("botlit.handoffs.markSeen", "Mark as seen")
|
|
430
433
|
})]
|
|
431
434
|
}) : null
|
|
432
435
|
}),
|
|
433
|
-
|
|
436
|
+
x.loading && x.items.length === 0 ? /* @__PURE__ */ M("p", {
|
|
434
437
|
role: "status",
|
|
435
|
-
children:
|
|
436
|
-
}) :
|
|
437
|
-
resource:
|
|
438
|
-
error:
|
|
439
|
-
onRetry: () => void
|
|
440
|
-
}) :
|
|
438
|
+
children: d("botlit.handoffs.loading", "Loading handoffs…")
|
|
439
|
+
}) : x.error && x.items.length === 0 ? /* @__PURE__ */ M(p, {
|
|
440
|
+
resource: d("botlit.handoffs.errorResource", "handoffs"),
|
|
441
|
+
error: x.error,
|
|
442
|
+
onRetry: () => void x.refresh()
|
|
443
|
+
}) : x.items.length > 0 ? /* @__PURE__ */ N(a, { children: [/* @__PURE__ */ N(c, { children: [/* @__PURE__ */ M(l, { children: d("botlit.handoffs.queue", "Team inbox") }), /* @__PURE__ */ M(s, { children: d("botlit.handoffs.queueDescription", "Newest first — accept a conversation to take it over.") })] }), /* @__PURE__ */ N(o, { children: [x.error ? /* @__PURE__ */ M("p", {
|
|
441
444
|
role: "alert",
|
|
442
445
|
className: "mb-3 text-sm text-status-danger-text",
|
|
443
|
-
children:
|
|
444
|
-
}) : null, /* @__PURE__ */
|
|
446
|
+
children: d("botlit.handoffs.refreshFailed", "Could not refresh the inbox: {{message}}", { message: x.error.message })
|
|
447
|
+
}) : null, /* @__PURE__ */ M("ul", {
|
|
445
448
|
className: "grid gap-3",
|
|
446
|
-
children:
|
|
449
|
+
children: x.items.map((e) => /* @__PURE__ */ M(B, {
|
|
447
450
|
handoff: e,
|
|
448
|
-
agents:
|
|
449
|
-
members:
|
|
450
|
-
isNew:
|
|
451
|
-
|
|
452
|
-
|
|
451
|
+
agents: w,
|
|
452
|
+
members: S.members,
|
|
453
|
+
isNew: x.newIds.has(e.id),
|
|
454
|
+
canManage: m,
|
|
455
|
+
onChanged: () => void x.refresh(),
|
|
456
|
+
linked: e.id === g
|
|
453
457
|
}, e.id))
|
|
454
|
-
})] })] }) : /* @__PURE__ */
|
|
455
|
-
title:
|
|
456
|
-
description:
|
|
458
|
+
})] })] }) : /* @__PURE__ */ M(f, {
|
|
459
|
+
title: d("botlit.handoffs.empty", "No handoffs"),
|
|
460
|
+
description: d("botlit.handoffs.emptyDescription", "Nothing needs a human right now. Triggered handoffs from your agents land here.")
|
|
457
461
|
}),
|
|
458
|
-
/* @__PURE__ */
|
|
459
|
-
hasMore:
|
|
460
|
-
loadingMore:
|
|
461
|
-
onLoadMore: () => void
|
|
462
|
-
loadedCount:
|
|
462
|
+
/* @__PURE__ */ M(D, {
|
|
463
|
+
hasMore: x.hasMore,
|
|
464
|
+
loadingMore: x.loadingMore,
|
|
465
|
+
onLoadMore: () => void x.loadMore(),
|
|
466
|
+
loadedCount: x.items.length
|
|
463
467
|
})
|
|
464
468
|
]
|
|
465
469
|
})
|
|
466
470
|
});
|
|
467
471
|
};
|
|
468
|
-
export {
|
|
472
|
+
export { F as HANDOFF_QUERY_PARAM, U as HandoffsPage };
|
|
469
473
|
|
|
470
474
|
//# sourceMappingURL=HandoffsPage.js.map
|