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