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