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