@burdenoff/microfe-botmanor 2026.1120.16 → 2026.1120.18

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.
@@ -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 x, useReleaseHandoff as ee, useReplyToHandoff as S, useResolveHandoff as C } from "../hooks/useHandoffs.js";
13
- import { formatRelativeTime as w } from "../utils/formatters.js";
14
- import { useEffect as T, useMemo as E, useState as D } from "react";
15
- import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
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
- ], M = ({ handoff: t }) => {
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__ */ k(l, {
54
+ return /* @__PURE__ */ O(l, {
54
55
  variant: "outline",
55
56
  children: r[t.trigger] ?? t.trigger
56
57
  });
57
- }, N = ({ status: t }) => {
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__ */ k(l, {
92
+ return /* @__PURE__ */ O(l, {
92
93
  variant: r.variant,
93
94
  children: r.text
94
95
  });
95
- }, P = 1e4;
96
- function F(e, t) {
96
+ }, F = 1e4;
97
+ function I(e, t) {
97
98
  return Math.round((new Date(e).getTime() - t) / 6e4);
98
99
  }
99
- var I = ({ handoff: t }) => {
100
- let n = e(), [r, i] = D(() => Date.now()), a = g(t.status) && !t.firstResponseAt;
101
- if (T(() => {
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__ */ k(l, {
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__ */ k(l, {
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(F(t.slaDueAt, r), 0);
118
- return /* @__PURE__ */ k(l, {
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
- }, L = {
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
- }, R = ({ handoffId: t, messages: n }) => {
137
+ }, re = ({ handoffId: t, messages: n }) => {
137
138
  let r = e();
138
- return n.length === 0 ? /* @__PURE__ */ k("p", {
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__ */ k("ol", {
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 = L[e.role] ?? {
147
+ let t = R[e.role] ?? {
147
148
  key: "",
148
149
  label: String(e.role)
149
150
  };
150
- return /* @__PURE__ */ A("li", {
151
+ return /* @__PURE__ */ k("li", {
151
152
  className: "grid gap-0.5",
152
- children: [/* @__PURE__ */ A("span", {
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
- w(e.createdAt)
159
+ C(e.createdAt)
159
160
  ]
160
- }), /* @__PURE__ */ k("span", {
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 i = e(), [a, o] = _(), [s, u] = ee(), [d, m] = C(), [y, E] = x(), [j, F] = v(), [L, z] = S(), B = g(t.status), V = t.status === h.Accepted, [H, U] = D(!1), W = b(H ? t.id : void 0), G = W.refetch;
169
- T(() => {
170
- if (!H || !B) return;
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
- G();
173
- }, P);
180
+ K();
181
+ }, F);
174
182
  return () => window.clearInterval(e);
175
183
  }, [
176
- H,
177
- B,
178
- G
184
+ U,
185
+ z,
186
+ K
179
187
  ]);
180
- let [K, q] = D(""), [J, Y] = D(""), X = o.loading || u.loading || m.loading || E.loading || F.loading || z.loading, Z = o.error ?? u.error ?? m.error ?? E.error ?? F.error ?? z.error, Q = async (e) => {
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 = K.trim();
190
+ let n = q.trim();
183
191
  if (n) try {
184
- await L({
192
+ await I({
185
193
  id: t.id,
186
194
  message: n
187
- }), q(""), await W.refetch(), r();
195
+ }), J(""), await G.refetch(), r();
188
196
  } catch {}
189
- }, te = async (e) => {
197
+ }, ae = async (e) => {
190
198
  e.preventDefault();
191
- let n = J.trim();
199
+ let n = Y.trim();
192
200
  if (n) try {
193
201
  await j({
194
202
  id: t.id,
195
203
  assigneeId: n
196
- }), Y(""), r();
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__ */ A("li", {
204
- className: "grid gap-3 rounded-card border border-border-seam bg-bg-surface p-4",
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__ */ A("div", {
217
+ /* @__PURE__ */ k("div", {
207
218
  className: "flex flex-wrap items-center gap-2",
208
219
  children: [
209
- /* @__PURE__ */ k(N, { status: t.status }),
210
- /* @__PURE__ */ k(M, { handoff: t }),
211
- /* @__PURE__ */ k(I, { handoff: t }),
212
- t.replyChannel ? /* @__PURE__ */ k(l, {
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__ */ k("span", {
227
+ /* @__PURE__ */ O("span", {
217
228
  className: "text-xs text-text-secondary",
218
- children: i("botlit.handoffs.opened", "Opened {{time}}", { time: w(t.createdAt) })
229
+ children: a("botlit.handoffs.opened", "Opened {{time}}", { time: C(t.createdAt) })
219
230
  })
220
231
  ]
221
232
  }),
222
- /* @__PURE__ */ k("p", {
233
+ /* @__PURE__ */ O("p", {
223
234
  className: "text-sm text-text-primary",
224
235
  children: t.reason
225
236
  }),
226
- t.userMessage ? /* @__PURE__ */ k("blockquote", {
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__ */ A("div", {
241
+ /* @__PURE__ */ k("div", {
231
242
  className: "flex flex-wrap items-center gap-2 text-xs text-text-secondary",
232
- children: [/* @__PURE__ */ k("span", { children: n.get(t.agentId) ? i("botlit.handoffs.agent", "Agent {{name}}", { name: n.get(t.agentId) }) : i("botlit.handoffs.conversation", "Conversation {{key}}", { key: t.conversationKey }) }), t.assignedToId ? /* @__PURE__ */ k("span", { children: i("botlit.handoffs.assignedTo", "· with {{who}}", { who: t.assignedToId }) }) : null]
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__ */ k("div", { children: /* @__PURE__ */ k(c, {
245
+ /* @__PURE__ */ O("div", { children: /* @__PURE__ */ O(c, {
235
246
  size: "sm",
236
247
  variant: "ghost",
237
- "aria-expanded": H,
238
- onClick: () => U((e) => !e),
239
- children: H ? i("botlit.handoffs.thread.hide", "Hide conversation") : i("botlit.handoffs.thread.show", "Show conversation")
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
- H ? W.loading && W.data.length === 0 ? /* @__PURE__ */ k("p", {
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: i("botlit.handoffs.thread.loading", "Loading conversation…")
245
- }) : W.error ? /* @__PURE__ */ k("p", {
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: W.error.message
249
- }) : /* @__PURE__ */ k(R, {
262
+ children: G.error.message
263
+ }) : /* @__PURE__ */ O(re, {
250
264
  handoffId: t.id,
251
- messages: W.data
265
+ messages: G.data
252
266
  }) : null,
253
- V && t.replyChannel ? /* @__PURE__ */ A("form", {
267
+ B && t.replyChannel ? /* @__PURE__ */ k("form", {
254
268
  className: "grid gap-2",
255
- onSubmit: (e) => void Q(e),
269
+ onSubmit: (e) => void ie(e),
256
270
  children: [
257
- /* @__PURE__ */ k("label", {
271
+ /* @__PURE__ */ O("label", {
258
272
  className: "text-sm font-medium text-text-primary",
259
273
  htmlFor: `reply-${t.id}`,
260
- children: i("botlit.handoffs.reply.label", "Reply to the customer")
274
+ children: a("botlit.handoffs.reply.label", "Reply to the customer")
261
275
  }),
262
- /* @__PURE__ */ k(p, {
276
+ /* @__PURE__ */ O(p, {
263
277
  id: `reply-${t.id}`,
264
- value: K,
278
+ value: q,
265
279
  maxLength: 4e3,
266
280
  rows: 3,
267
- onChange: (e) => q(e.target.value),
268
- placeholder: i("botlit.handoffs.reply.placeholder", "Sent in the same thread as the bot — the bot stays quiet until you hand back.")
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__ */ k("div", { children: /* @__PURE__ */ k(c, {
284
+ /* @__PURE__ */ O("div", { children: /* @__PURE__ */ O(c, {
271
285
  size: "sm",
272
286
  type: "submit",
273
- disabled: X || !K.trim(),
274
- children: i("botlit.handoffs.reply.send", "Send reply")
287
+ disabled: Z || !q.trim(),
288
+ children: a("botlit.handoffs.reply.send", "Send reply")
275
289
  }) })
276
290
  ]
277
291
  }) : null,
278
- V && !t.replyChannel ? /* @__PURE__ */ k("p", {
292
+ B && !t.replyChannel ? /* @__PURE__ */ O("p", {
279
293
  className: "text-sm text-text-secondary",
280
- children: i("botlit.handoffs.reply.webChat", "This conversation came from web chat, which has no channel to reply on.")
294
+ children: a("botlit.handoffs.reply.webChat", "This conversation came from web chat, which has no channel to reply on.")
281
295
  }) : null,
282
- B ? /* @__PURE__ */ A("form", {
296
+ z ? /* @__PURE__ */ k("form", {
283
297
  className: "flex flex-wrap items-center gap-2",
284
- onSubmit: (e) => void te(e),
298
+ onSubmit: (e) => void ae(e),
285
299
  children: [
286
- /* @__PURE__ */ k("label", {
300
+ /* @__PURE__ */ O("label", {
287
301
  className: "sr-only",
288
302
  htmlFor: `assign-${t.id}`,
289
- children: i("botlit.handoffs.assign.label", "Assign to (user id)")
303
+ children: a("botlit.handoffs.assign.label", "Assign to (user id)")
290
304
  }),
291
- /* @__PURE__ */ k(f, {
305
+ /* @__PURE__ */ O(f, {
292
306
  id: `assign-${t.id}`,
293
307
  className: "max-w-xs",
294
- value: J,
295
- onChange: (e) => Y(e.target.value),
296
- placeholder: i("botlit.handoffs.assign.placeholder", "Teammate user id")
308
+ value: Y,
309
+ onChange: (e) => X(e.target.value),
310
+ placeholder: a("botlit.handoffs.assign.placeholder", "Teammate user id")
297
311
  }),
298
- /* @__PURE__ */ k(c, {
312
+ /* @__PURE__ */ O(c, {
299
313
  size: "sm",
300
314
  variant: "outline",
301
315
  type: "submit",
302
- disabled: X || !J.trim(),
303
- children: i("botlit.handoffs.assign.submit", "Assign")
316
+ disabled: Z || !Y.trim(),
317
+ children: a("botlit.handoffs.assign.submit", "Assign")
304
318
  })
305
319
  ]
306
320
  }) : null,
307
- Z ? /* @__PURE__ */ k("p", {
321
+ Q ? /* @__PURE__ */ O("p", {
308
322
  role: "alert",
309
323
  className: "text-sm text-status-danger-text",
310
- children: Z.message
324
+ children: Q.message
311
325
  }) : null,
312
- /* @__PURE__ */ A("div", {
326
+ /* @__PURE__ */ k("div", {
313
327
  className: "flex flex-wrap gap-2",
314
- children: [t.status === h.Requested || t.status === h.Assigned ? /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k(c, {
328
+ children: [t.status === h.Requested || t.status === h.Assigned ? /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(c, {
315
329
  size: "sm",
316
- disabled: X,
317
- onClick: () => void $(a),
318
- children: i("botlit.handoffs.actions.takeOver", "Take over")
319
- }), /* @__PURE__ */ k(c, {
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: X,
323
- onClick: () => void $(y),
324
- children: i("botlit.handoffs.actions.reject", "Reject")
325
- })] }) : null, t.status === h.Accepted ? /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k(c, {
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: X,
329
- onClick: () => void $(s),
330
- children: i("botlit.handoffs.actions.handBack", "Hand back to bot")
331
- }), /* @__PURE__ */ k(c, {
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: X,
334
- onClick: () => void $(d),
335
- children: i("botlit.handoffs.actions.resolve", "Resolve")
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 l = e(), [f, p] = D("active"), m = j.find((e) => e.id === f) ?? j[0], h = y({ statuses: m.statuses ?? void 0 }), g = t(), _ = E(() => new Map((g.data ?? []).map((e) => [e.id, e.name])), [g.data]);
342
- return /* @__PURE__ */ k(n, {
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__ */ A("div", {
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__ */ A("div", {
378
+ /* @__PURE__ */ k("div", {
349
379
  className: "flex flex-wrap items-center gap-2",
350
- children: [j.map((e) => /* @__PURE__ */ k(c, {
380
+ children: [M.map((e) => /* @__PURE__ */ O(c, {
351
381
  size: "sm",
352
- variant: f === e.id ? "primary" : "outline",
353
- onClick: () => p(e.id),
382
+ variant: m === e.id ? "primary" : "outline",
383
+ onClick: () => h(e.id),
354
384
  children: l(e.labelKey, e.label)
355
- }, e.id)), /* @__PURE__ */ k(c, {
385
+ }, e.id)), /* @__PURE__ */ O(c, {
356
386
  size: "sm",
357
387
  variant: "outline",
358
- onClick: () => void h.refetch(),
388
+ onClick: () => void _.refetch(),
359
389
  children: l("botlit.handoffs.refresh", "Refresh")
360
390
  })]
361
391
  }),
362
- h.loading ? /* @__PURE__ */ k("p", {
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
- }) : h.error ? /* @__PURE__ */ k(d, {
400
+ }) : _.error ? /* @__PURE__ */ O(d, {
366
401
  resource: l("botlit.handoffs.errorResource", "handoffs"),
367
- error: h.error,
368
- onRetry: () => void h.refetch()
369
- }) : h.data && h.data.items.length > 0 ? /* @__PURE__ */ A(r, { children: [/* @__PURE__ */ A(o, { children: [/* @__PURE__ */ k(s, { children: l("botlit.handoffs.queue", "Team inbox") }), /* @__PURE__ */ k(a, { children: l("botlit.handoffs.queueDescription", "Newest first — accept a conversation to take it over.") })] }), /* @__PURE__ */ k(i, { children: /* @__PURE__ */ k("ul", {
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: h.data.items.map((e) => /* @__PURE__ */ k(z, {
406
+ children: _.data.items.map((e) => /* @__PURE__ */ O(z, {
372
407
  handoff: e,
373
- agents: _,
374
- onChanged: () => void h.refetch()
408
+ agents: b,
409
+ onChanged: () => void _.refetch(),
410
+ linked: e.id === p
375
411
  }, e.id))
376
- }) })] }) : /* @__PURE__ */ k(u, {
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
- h.data && h.data.hasMore ? /* @__PURE__ */ k("p", {
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: h.data.items.length,
384
- total: h.data.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 { B as HandoffsPage };
427
+ export { j as HANDOFF_QUERY_PARAM, H as HandoffsPage };
392
428
 
393
429
  //# sourceMappingURL=HandoffsPage.js.map