@burdenoff/microfe-botmanor 2026.1120.26 → 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.
Files changed (68) hide show
  1. package/dist/botlit/BotmanorRootInner.js +43 -41
  2. package/dist/botlit/BotmanorRootInner.js.map +1 -1
  3. package/dist/botlit/components/ChannelRoutesPanel.js +8 -8
  4. package/dist/botlit/components/ChannelRoutesPanel.js.map +1 -1
  5. package/dist/botlit/components/CreateChannelRouteDialog.js +7 -7
  6. package/dist/botlit/components/GettingStartedChecklist.d.ts +13 -0
  7. package/dist/botlit/components/GettingStartedChecklist.js +126 -0
  8. package/dist/botlit/components/GettingStartedChecklist.js.map +1 -0
  9. package/dist/botlit/components/HandoffConfigPanel.js +133 -132
  10. package/dist/botlit/components/HandoffConfigPanel.js.map +1 -1
  11. package/dist/botlit/components/HandoffTargetPickers.d.ts +28 -0
  12. package/dist/botlit/components/HandoffTargetPickers.js +180 -0
  13. package/dist/botlit/components/HandoffTargetPickers.js.map +1 -0
  14. package/dist/botlit/components/PageLayout.d.ts +7 -0
  15. package/dist/botlit/components/PageLayout.js +4 -1
  16. package/dist/botlit/components/PageLayout.js.map +1 -1
  17. package/dist/botlit/hooks/index.js +2 -2
  18. package/dist/botlit/hooks/useHandoffInbox.d.ts +26 -0
  19. package/dist/botlit/hooks/useHandoffInbox.js +126 -0
  20. package/dist/botlit/hooks/useHandoffInbox.js.map +1 -0
  21. package/dist/botlit/hooks/useHandoffs.js +36 -63
  22. package/dist/botlit/hooks/useHandoffs.js.map +1 -1
  23. package/dist/botlit/hooks/useMyIntegrationConnections.d.ts +4 -0
  24. package/dist/botlit/hooks/useMyIntegrationConnections.js +26 -0
  25. package/dist/botlit/hooks/useMyIntegrationConnections.js.map +1 -0
  26. package/dist/botlit/hooks/useStorePublishing.d.ts +1 -1
  27. package/dist/botlit/hooks/useWorkspaceMemberDirectory.d.ts +26 -0
  28. package/dist/botlit/hooks/useWorkspaceMemberDirectory.js +84 -0
  29. package/dist/botlit/hooks/useWorkspaceMemberDirectory.js.map +1 -0
  30. package/dist/botlit/index.d.ts +1 -0
  31. package/dist/botlit/index.js +2 -1
  32. package/dist/botlit/pages/AgentsListPage.js +1 -0
  33. package/dist/botlit/pages/AgentsListPage.js.map +1 -1
  34. package/dist/botlit/pages/BotChannelsTab.js +313 -275
  35. package/dist/botlit/pages/BotChannelsTab.js.map +1 -1
  36. package/dist/botlit/pages/BotsListPage.js +1 -0
  37. package/dist/botlit/pages/BotsListPage.js.map +1 -1
  38. package/dist/botlit/pages/BucketDetailPage.js +16 -16
  39. package/dist/botlit/pages/BucketDetailPage.js.map +1 -1
  40. package/dist/botlit/pages/ChannelDetailPage.js +12 -12
  41. package/dist/botlit/pages/ChannelsPage.js +6 -6
  42. package/dist/botlit/pages/ChannelsPage.js.map +1 -1
  43. package/dist/botlit/pages/ChatPage.js +1 -0
  44. package/dist/botlit/pages/ChatPage.js.map +1 -1
  45. package/dist/botlit/pages/DashboardPage.js +33 -26
  46. package/dist/botlit/pages/DashboardPage.js.map +1 -1
  47. package/dist/botlit/pages/ExecutionsPage.js +9 -8
  48. package/dist/botlit/pages/ExecutionsPage.js.map +1 -1
  49. package/dist/botlit/pages/HandoffsPage.js +190 -149
  50. package/dist/botlit/pages/HandoffsPage.js.map +1 -1
  51. package/dist/botlit/pages/KnowledgeBasesPage.js +1 -0
  52. package/dist/botlit/pages/KnowledgeBasesPage.js.map +1 -1
  53. package/dist/botlit/tours/tourRoutes.d.ts +25 -0
  54. package/dist/botlit/tours/tourRoutes.js +108 -0
  55. package/dist/botlit/tours/tourRoutes.js.map +1 -0
  56. package/dist/botlit/utils/gettingStarted.d.ts +16 -0
  57. package/dist/botlit/utils/gettingStarted.js +7 -0
  58. package/dist/botlit/utils/gettingStarted.js.map +1 -0
  59. package/dist/botlit/utils/handoffInbox.d.ts +64 -0
  60. package/dist/botlit/utils/handoffInbox.js +62 -0
  61. package/dist/botlit/utils/handoffInbox.js.map +1 -0
  62. package/dist/generated/wspace-operations.d.ts +193 -0
  63. package/dist/generated/wspace-operations.js +134 -87
  64. package/dist/generated/wspace-operations.js.map +1 -1
  65. package/dist/generated/wspace-types.js +8 -6
  66. package/dist/generated/wspace-types.js.map +1 -1
  67. package/dist/index.js +2 -1
  68. 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 { Input as f, Textarea as p } from "../components/Input.js";
9
+ import { Textarea as f } from "../components/Input.js";
10
10
  import "../hooks/index.js";
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 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";
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 j = "handoff", M = [
22
+ var N = "handoff", P = [
19
23
  {
20
24
  id: "active",
21
25
  statuses: [
22
- h.Requested,
23
- h.Assigned,
24
- h.Accepted
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
- h.Resolved,
33
- h.Released,
34
- h.Rejected
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
- ], N = ({ handoff: t }) => {
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__ */ O(l, {
58
+ return /* @__PURE__ */ A(l, {
55
59
  variant: "outline",
56
60
  children: r[t.trigger] ?? t.trigger
57
61
  });
58
- }, P = ({ status: t }) => {
62
+ }, F = ({ status: t }) => {
59
63
  let n = e(), r = {
60
- [h.Requested]: {
64
+ [m.Requested]: {
61
65
  text: n("botlit.handoffs.status.requested", "Requested"),
62
66
  variant: "warning"
63
67
  },
64
- [h.Assigned]: {
68
+ [m.Assigned]: {
65
69
  text: n("botlit.handoffs.status.assigned", "Assigned"),
66
70
  variant: "warning"
67
71
  },
68
- [h.Accepted]: {
72
+ [m.Accepted]: {
69
73
  text: n("botlit.handoffs.status.accepted", "Accepted"),
70
74
  variant: "success"
71
75
  },
72
- [h.Resolved]: {
76
+ [m.Resolved]: {
73
77
  text: n("botlit.handoffs.status.resolved", "Resolved"),
74
78
  variant: "outline"
75
79
  },
76
- [h.Released]: {
80
+ [m.Released]: {
77
81
  text: n("botlit.handoffs.status.released", "Released to bot"),
78
82
  variant: "outline"
79
83
  },
80
- [h.Rejected]: {
84
+ [m.Rejected]: {
81
85
  text: n("botlit.handoffs.status.rejected", "Rejected"),
82
86
  variant: "destructive"
83
87
  },
84
- [h.Expired]: {
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__ */ O(l, {
96
+ return /* @__PURE__ */ A(l, {
93
97
  variant: r.variant,
94
98
  children: r.text
95
99
  });
96
- }, F = 1e4;
100
+ }, ae = 1e4;
97
101
  function I(e, t) {
98
102
  return Math.round((new Date(e).getTime() - t) / 6e4);
99
103
  }
100
- var L = ({ handoff: t }) => {
101
- let n = e(), [r, i] = E(() => Date.now()), a = g(t.status) && !t.firstResponseAt;
102
- if (w(() => {
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__ */ O(l, {
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__ */ O(l, {
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__ */ O(l, {
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
- }, R = {
125
- [m.Customer]: {
128
+ }, L = {
129
+ [p.Customer]: {
126
130
  key: "botlit.handoffs.thread.customer",
127
131
  label: "Customer"
128
132
  },
129
- [m.Bot]: {
133
+ [p.Bot]: {
130
134
  key: "botlit.handoffs.thread.bot",
131
135
  label: "Bot"
132
136
  },
133
- [m.Operator]: {
137
+ [p.Operator]: {
134
138
  key: "botlit.handoffs.thread.operator",
135
139
  label: "Operator"
136
140
  }
137
- }, re = ({ handoffId: t, messages: n }) => {
141
+ }, R = ({ handoffId: t, messages: n }) => {
138
142
  let r = e();
139
- return n.length === 0 ? /* @__PURE__ */ O("p", {
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__ */ O("ol", {
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 = R[e.role] ?? {
151
+ let t = L[e.role] ?? {
148
152
  key: "",
149
153
  label: String(e.role)
150
154
  };
151
- return /* @__PURE__ */ k("li", {
155
+ return /* @__PURE__ */ j("li", {
152
156
  className: "grid gap-0.5",
153
- children: [/* @__PURE__ */ k("span", {
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
- C(e.createdAt)
163
+ h(e.createdAt)
160
164
  ]
161
- }), /* @__PURE__ */ O("span", {
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, 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
+ }, 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
- }, [i]);
176
- let G = b(U ? t.id : void 0), K = G.refetch;
177
- w(() => {
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
- }, F);
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] = 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) => {
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(), r();
199
+ }), J(""), await G.refetch(), a();
196
200
  } catch {}
197
- }, ae = async (e) => {
201
+ }, ue = async (e) => {
198
202
  e.preventDefault();
199
203
  let n = Y.trim();
200
204
  if (n) try {
201
- await j({
205
+ await N({
202
206
  id: t.id,
203
207
  assigneeId: n
204
- }), X(""), r();
208
+ }), X(""), a();
205
209
  } catch {}
206
210
  }, $ = async (e) => {
207
211
  try {
208
- await e(t.id), r();
209
- } catch {}
212
+ await e(t.id), a();
213
+ } catch (e) {
214
+ w(e) && a();
215
+ }
210
216
  };
211
- return /* @__PURE__ */ k("li", {
217
+ return /* @__PURE__ */ j("li", {
212
218
  ref: W,
213
219
  "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"}`,
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__ */ k("div", {
223
+ /* @__PURE__ */ j("div", {
218
224
  className: "flex flex-wrap items-center gap-2",
219
225
  children: [
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, {
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__ */ O("span", {
237
+ /* @__PURE__ */ A("span", {
228
238
  className: "text-xs text-text-secondary",
229
- children: a("botlit.handoffs.opened", "Opened {{time}}", { time: C(t.createdAt) })
239
+ children: s("botlit.handoffs.opened", "Opened {{time}}", { time: h(t.createdAt) })
230
240
  })
231
241
  ]
232
242
  }),
233
- /* @__PURE__ */ O("p", {
243
+ /* @__PURE__ */ A("p", {
234
244
  className: "text-sm text-text-primary",
235
245
  children: t.reason
236
246
  }),
237
- t.userMessage ? /* @__PURE__ */ O("blockquote", {
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__ */ k("div", {
251
+ /* @__PURE__ */ j("div", {
242
252
  className: "flex flex-wrap items-center gap-2 text-xs text-text-secondary",
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]
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__ */ O("div", { children: /* @__PURE__ */ O(c, {
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: i,
260
+ linked: o,
251
261
  open: !U
252
262
  }),
253
- children: U ? a("botlit.handoffs.thread.hide", "Hide conversation") : a("botlit.handoffs.thread.show", "Show conversation")
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__ */ O("p", {
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: a("botlit.handoffs.thread.loading", "Loading conversation…")
259
- }) : G.error ? /* @__PURE__ */ O("p", {
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__ */ O(re, {
273
+ }) : /* @__PURE__ */ A(R, {
264
274
  handoffId: t.id,
265
275
  messages: G.data
266
276
  }) : null,
267
- B && t.replyChannel ? /* @__PURE__ */ k("form", {
277
+ B && t.replyChannel ? /* @__PURE__ */ j("form", {
268
278
  className: "grid gap-2",
269
- onSubmit: (e) => void ie(e),
279
+ onSubmit: (e) => void le(e),
270
280
  children: [
271
- /* @__PURE__ */ O("label", {
281
+ /* @__PURE__ */ A("label", {
272
282
  className: "text-sm font-medium text-text-primary",
273
283
  htmlFor: `reply-${t.id}`,
274
- children: a("botlit.handoffs.reply.label", "Reply to the customer")
284
+ children: s("botlit.handoffs.reply.label", "Reply to the customer")
275
285
  }),
276
- /* @__PURE__ */ O(p, {
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: a("botlit.handoffs.reply.placeholder", "Sent in the same thread as the bot — the bot stays quiet until you hand back.")
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__ */ O("div", { children: /* @__PURE__ */ O(c, {
294
+ /* @__PURE__ */ A("div", { children: /* @__PURE__ */ A(c, {
285
295
  size: "sm",
286
296
  type: "submit",
287
297
  disabled: Z || !q.trim(),
288
- children: a("botlit.handoffs.reply.send", "Send reply")
298
+ children: s("botlit.handoffs.reply.send", "Send reply")
289
299
  }) })
290
300
  ]
291
301
  }) : null,
292
- B && !t.replyChannel ? /* @__PURE__ */ O("p", {
302
+ B && !t.replyChannel ? /* @__PURE__ */ A("p", {
293
303
  className: "text-sm text-text-secondary",
294
- children: a("botlit.handoffs.reply.webChat", "This conversation came from web chat, which has no channel to reply on.")
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__ */ k("form", {
306
+ z ? /* @__PURE__ */ j("form", {
297
307
  className: "flex flex-wrap items-center gap-2",
298
- onSubmit: (e) => void ae(e),
308
+ onSubmit: (e) => void ue(e),
299
309
  children: [
300
- /* @__PURE__ */ O("label", {
310
+ /* @__PURE__ */ A("label", {
301
311
  className: "sr-only",
302
312
  htmlFor: `assign-${t.id}`,
303
- children: a("botlit.handoffs.assign.label", "Assign to (user id)")
313
+ children: s("botlit.handoffs.assign.label", "Assign to a teammate")
304
314
  }),
305
- /* @__PURE__ */ O(f, {
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
- placeholder: a("botlit.handoffs.assign.placeholder", "Teammate user id")
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__ */ O(c, {
328
+ /* @__PURE__ */ A(c, {
313
329
  size: "sm",
314
330
  variant: "outline",
315
331
  type: "submit",
316
332
  disabled: Z || !Y.trim(),
317
- children: a("botlit.handoffs.assign.submit", "Assign")
333
+ children: s("botlit.handoffs.assign.submit", "Assign")
318
334
  })
319
335
  ]
320
336
  }) : null,
321
- Q ? /* @__PURE__ */ O("p", {
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__ */ k("div", {
342
+ /* @__PURE__ */ j("div", {
327
343
  className: "flex flex-wrap gap-2",
328
- children: [t.status === h.Requested || t.status === h.Assigned ? /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(c, {
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 $(o),
332
- children: a("botlit.handoffs.actions.takeOver", "Take over")
333
- }), /* @__PURE__ */ O(c, {
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 $(T),
338
- children: a("botlit.handoffs.actions.reject", "Reject")
339
- })] }) : null, t.status === h.Accepted ? /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(c, {
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 $(u),
344
- children: a("botlit.handoffs.actions.handBack", "Hand back to bot")
345
- }), /* @__PURE__ */ O(c, {
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 $(m),
349
- children: a("botlit.handoffs.actions.resolve", "Resolve")
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__ */ O("p", {
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] = E(null), r = e ? "all" : "active";
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] = 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, {
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__ */ k("div", {
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__ */ k("div", {
394
+ /* @__PURE__ */ j("div", {
379
395
  className: "flex flex-wrap items-center gap-2",
380
- children: [M.map((e) => /* @__PURE__ */ O(c, {
381
- size: "sm",
382
- variant: m === e.id ? "primary" : "outline",
383
- onClick: () => h(e.id),
384
- children: l(e.labelKey, e.label)
385
- }, e.id)), /* @__PURE__ */ O(c, {
386
- size: "sm",
387
- variant: "outline",
388
- onClick: () => void _.refetch(),
389
- children: l("botlit.handoffs.refresh", "Refresh")
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__ */ O(B, {
416
+ /* @__PURE__ */ A(B, {
393
417
  linkedId: p,
394
418
  filter: m,
395
- items: _.loading || _.error ? null : _.data?.items ?? 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__ */ O("p", {
433
+ _.loading && _.items.length === 0 ? /* @__PURE__ */ A("p", {
398
434
  role: "status",
399
435
  children: l("botlit.handoffs.loading", "Loading handoffs…")
400
- }) : _.error ? /* @__PURE__ */ O(d, {
436
+ }) : _.error && _.items.length === 0 ? /* @__PURE__ */ A(d, {
401
437
  resource: l("botlit.handoffs.errorResource", "handoffs"),
402
438
  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", {
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: _.data.items.map((e) => /* @__PURE__ */ O(z, {
446
+ children: _.items.map((e) => /* @__PURE__ */ A(z, {
407
447
  handoff: e,
408
448
  agents: b,
409
- onChanged: () => void _.refetch(),
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__ */ O(u, {
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
- _.data && _.data.hasMore ? /* @__PURE__ */ O("p", {
417
- className: "text-sm text-text-secondary",
418
- children: l("botlit.handoffs.truncated", "Showing the {{shown}} most recent of {{total}} handoffs — narrow the filter to see the rest.", {
419
- shown: _.data.items.length,
420
- total: _.data.total
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 { j as HANDOFF_QUERY_PARAM, H as HandoffsPage };
468
+ export { N as HANDOFF_QUERY_PARAM, H as HandoffsPage };
428
469
 
429
470
  //# sourceMappingURL=HandoffsPage.js.map