@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.
Files changed (30) hide show
  1. package/dist/botlit/components/HandoffConfigPanel.js +133 -132
  2. package/dist/botlit/components/HandoffConfigPanel.js.map +1 -1
  3. package/dist/botlit/components/HandoffTargetPickers.d.ts +28 -0
  4. package/dist/botlit/components/HandoffTargetPickers.js +180 -0
  5. package/dist/botlit/components/HandoffTargetPickers.js.map +1 -0
  6. package/dist/botlit/hooks/index.js +2 -2
  7. package/dist/botlit/hooks/useHandoffInbox.d.ts +26 -0
  8. package/dist/botlit/hooks/useHandoffInbox.js +126 -0
  9. package/dist/botlit/hooks/useHandoffInbox.js.map +1 -0
  10. package/dist/botlit/hooks/useHandoffs.js +36 -63
  11. package/dist/botlit/hooks/useHandoffs.js.map +1 -1
  12. package/dist/botlit/hooks/useMyIntegrationConnections.d.ts +4 -0
  13. package/dist/botlit/hooks/useMyIntegrationConnections.js +26 -0
  14. package/dist/botlit/hooks/useMyIntegrationConnections.js.map +1 -0
  15. package/dist/botlit/hooks/useWorkspaceMemberDirectory.d.ts +26 -0
  16. package/dist/botlit/hooks/useWorkspaceMemberDirectory.js +84 -0
  17. package/dist/botlit/hooks/useWorkspaceMemberDirectory.js.map +1 -0
  18. package/dist/botlit/pages/BotChannelsTab.js +288 -250
  19. package/dist/botlit/pages/BotChannelsTab.js.map +1 -1
  20. package/dist/botlit/pages/HandoffsPage.js +190 -149
  21. package/dist/botlit/pages/HandoffsPage.js.map +1 -1
  22. package/dist/botlit/utils/handoffInbox.d.ts +64 -0
  23. package/dist/botlit/utils/handoffInbox.js +62 -0
  24. package/dist/botlit/utils/handoffInbox.js.map +1 -0
  25. package/dist/generated/wspace-operations.d.ts +160 -0
  26. package/dist/generated/wspace-operations.js +128 -87
  27. package/dist/generated/wspace-operations.js.map +1 -1
  28. package/dist/generated/wspace-types.js +8 -6
  29. package/dist/generated/wspace-types.js.map +1 -1
  30. package/package.json +1 -1
@@ -7,31 +7,33 @@ import { EmptyState as l } from "../components/EmptyState.js";
7
7
  import { Input as u } from "../components/Input.js";
8
8
  import { useAllChannelConnectors as d, useBotChannelRoutes as f, useChannelConnector as p, useCreateChannelConnector as m, useCreateChannelRoute as h, useDeleteChannelRoute as g, useFindChannelConnector as _, useUpdateChannelConnector as v } from "../hooks/useChannels.js";
9
9
  import { ChannelSelectorSheet as y } from "../components/ChannelSelectorSheet.js";
10
- import { InboundWebhookCard as b } from "../components/ChannelSetupPanels.js";
11
- import { useBotlit as x } from "../providers/BotlitProvider.js";
10
+ import { useMyIntegrationConnections as b } from "../hooks/useMyIntegrationConnections.js";
11
+ import { linkableConnections as x } from "../utils/handoffInbox.js";
12
12
  import { PLATFORM_CREDENTIALS as S, connectorPlatform as C, useInboundChannel as w } from "../hooks/useChannelSetup.js";
13
- import { isNative as T, nativeCopyText as E, nativeNotify as D, nativeOpenUrl as O, nativeToast as k } from "../../utils/nativeBridge.js";
13
+ import { InboundWebhookCard as T } from "../components/ChannelSetupPanels.js";
14
+ import { useBotlit as E } from "../providers/BotlitProvider.js";
15
+ import { isNative as D, nativeCopyText as O, nativeNotify as k, nativeOpenUrl as A, nativeToast as j } from "../../utils/nativeBridge.js";
14
16
  import "../hooks/index.js";
15
- import { useGlobalChannels as A, useLinkIntegrationConnection as j, useMyUserPlatformConnection as M, useRevokeSlackConnection as N, useToggleSlackNotifications as P } from "../hooks/useUserPlatformConnection.js";
16
- import { ensureActiveConnector as F } from "../utils/channelConnectors.js";
17
+ import { useGlobalChannels as M, useLinkIntegrationConnection as N, useMyUserPlatformConnection as P, useRevokeSlackConnection as F, useToggleSlackNotifications as I } from "../hooks/useUserPlatformConnection.js";
18
+ import { ensureActiveConnector as L } from "../utils/channelConnectors.js";
17
19
  import "../permissions/index.js";
18
- import { ChannelType as I } from "../../generated/global-types.js";
19
- import { useCallback as L, useMemo as ee, useState as R } from "react";
20
- import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
21
- import { Bell as H, BellOff as te, CheckCircle2 as ne, Code as re, ExternalLink as ie, Globe as U, Loader2 as W, Mail as G, MessageCircle as K, MessageSquare as q, Plus as ae, Radio as J, Slack as Y, Trash2 as X, Unlink as oe, Users as se, Webhook as ce } from "lucide-react";
20
+ import { ChannelType as R } from "../../generated/global-types.js";
21
+ import { useCallback as z, useMemo as ee, useState as B } from "react";
22
+ import { Fragment as te, jsx as V, jsxs as H } from "react/jsx-runtime";
23
+ import { Bell as ne, BellOff as U, CheckCircle2 as re, Code as W, ExternalLink as G, Globe as K, Loader2 as q, Mail as ie, MessageCircle as J, MessageSquare as Y, Plus as ae, Radio as X, Slack as oe, Trash2 as se, Unlink as ce, Users as le, Webhook as ue } from "lucide-react";
22
24
  import { toast as Z } from "sonner";
23
25
  // src/botlit/pages/BotChannelsTab.tsx
24
- var le = {
26
+ var de = {
25
27
  SLACK: "slack-user",
26
28
  TEAMS: "teams-user",
27
29
  DISCORD: "discord-user",
28
30
  WHATSAPP: "whatsapp-user"
29
- }, ue = /* @__PURE__ */ new Set([
31
+ }, fe = /* @__PURE__ */ new Set([
30
32
  "SLACK",
31
33
  "TEAMS",
32
34
  "DISCORD"
33
- ]), de = /* @__PURE__ */ new Set(["ACTIVE", "DRAFT"]), Q = "connector:";
34
- function fe(e) {
35
+ ]), pe = /* @__PURE__ */ new Set(["ACTIVE", "DRAFT"]), Q = "connector:";
36
+ function me(e) {
35
37
  return e ? {
36
38
  SLACK_BOT: "Slack Bot",
37
39
  SLACK_WEBHOOK: "Slack Webhook",
@@ -62,308 +64,344 @@ function $(e) {
62
64
  case "SLACK": return {
63
65
  label: "Slack",
64
66
  badgeClass: "bg-bg-sunken text-text-secondary",
65
- icon: /* @__PURE__ */ B(Y, { size: 18 }),
67
+ icon: /* @__PURE__ */ V(oe, { size: 18 }),
66
68
  accentBg: "bg-accent",
67
69
  accentText: "text-text-primary"
68
70
  };
69
71
  case "TEAMS": return {
70
72
  label: "Teams",
71
73
  badgeClass: "bg-bg-sunken text-text-secondary",
72
- icon: /* @__PURE__ */ B(se, { size: 18 }),
74
+ icon: /* @__PURE__ */ V(le, { size: 18 }),
73
75
  accentBg: "bg-accent",
74
76
  accentText: "text-text-primary"
75
77
  };
76
78
  case "DISCORD": return {
77
79
  label: "Discord",
78
80
  badgeClass: "bg-bg-sunken text-text-secondary",
79
- icon: /* @__PURE__ */ B(K, { size: 18 }),
81
+ icon: /* @__PURE__ */ V(J, { size: 18 }),
80
82
  accentBg: "bg-accent",
81
83
  accentText: "text-text-primary"
82
84
  };
83
85
  case "WHATSAPP": return {
84
86
  label: "WhatsApp",
85
87
  badgeClass: "bg-bg-sunken text-text-secondary",
86
- icon: /* @__PURE__ */ B(q, { size: 18 }),
88
+ icon: /* @__PURE__ */ V(Y, { size: 18 }),
87
89
  accentBg: "bg-accent",
88
90
  accentText: "text-text-primary"
89
91
  };
90
92
  case "EMAIL": return {
91
93
  label: "Email",
92
94
  badgeClass: "bg-bg-sunken text-text-secondary",
93
- icon: /* @__PURE__ */ B(G, { size: 18 }),
95
+ icon: /* @__PURE__ */ V(ie, { size: 18 }),
94
96
  accentBg: "bg-accent",
95
97
  accentText: "text-text-primary"
96
98
  };
97
99
  case "SMS": return {
98
100
  label: "SMS",
99
101
  badgeClass: "bg-bg-sunken text-text-secondary",
100
- icon: /* @__PURE__ */ B(q, { size: 18 }),
102
+ icon: /* @__PURE__ */ V(Y, { size: 18 }),
101
103
  accentBg: "bg-accent",
102
104
  accentText: "text-text-primary"
103
105
  };
104
106
  case "WEBHOOK": return {
105
107
  label: "Webhook",
106
108
  badgeClass: "bg-bg-sunken text-text-secondary",
107
- icon: /* @__PURE__ */ B(ce, { size: 18 }),
109
+ icon: /* @__PURE__ */ V(ue, { size: 18 }),
108
110
  accentBg: "bg-accent",
109
111
  accentText: "text-text-primary"
110
112
  };
111
113
  case "WEB_WIDGET": return {
112
114
  label: "Web Widget",
113
115
  badgeClass: "bg-bg-sunken text-text-secondary",
114
- icon: /* @__PURE__ */ B(U, { size: 18 }),
116
+ icon: /* @__PURE__ */ V(K, { size: 18 }),
115
117
  accentBg: "bg-accent",
116
118
  accentText: "text-text-primary"
117
119
  };
118
120
  case "CUSTOM": return {
119
121
  label: "Custom",
120
122
  badgeClass: "bg-bg-sunken text-text-secondary",
121
- icon: /* @__PURE__ */ B(re, { size: 18 }),
123
+ icon: /* @__PURE__ */ V(W, { size: 18 }),
122
124
  accentBg: "bg-accent",
123
125
  accentText: "text-text-primary"
124
126
  };
125
127
  default: return {
126
128
  label: e,
127
129
  badgeClass: "bg-bg-sunken text-text-secondary",
128
- icon: /* @__PURE__ */ B(J, { size: 18 }),
130
+ icon: /* @__PURE__ */ V(X, { size: 18 }),
129
131
  accentBg: "bg-accent",
130
132
  accentText: "text-text-primary"
131
133
  };
132
134
  }
133
135
  }
134
- var pe = ({ routeId: e, connectorId: t, channelId: n, platform: r, onRemoved: o, onReconnect: l }) => {
135
- let { data: d, loading: f } = p(t), m = d?.credentialsRefId ?? n, { data: h, loading: _, refetch: v } = M(m), { toggle: y, loading: b } = P(), { revoke: x, loading: S } = N(), { link: C } = j(), [w] = g(), [O, A] = R(""), [F, I] = R(!1), L = $(r);
136
- return f ? /* @__PURE__ */ B("div", { className: "h-32 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }) : /* @__PURE__ */ V("div", {
136
+ var he = ({ routeId: e, connectorId: t, channelId: n, platform: r, onRemoved: o, onReconnect: l }) => {
137
+ let { data: d, loading: f } = p(t), m = d?.credentialsRefId ?? n, { data: h, loading: _, refetch: v } = P(m), { toggle: y, loading: S } = I(), { revoke: C, loading: w } = F(), { link: T } = N(), [E] = g(), [A, M] = B(""), [L, R] = B(!1), z = $(r), te = !_ && !h?.dmAllowed, W = b(te), G = ee(() => x(W.data, r), [W.data, r]), K = G.some((e) => e.id === A) ? A : G[0]?.id ?? "";
138
+ return f ? /* @__PURE__ */ V("div", { className: "h-32 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }) : /* @__PURE__ */ H("div", {
137
139
  className: "rounded-lg border border-border-subtle bg-bg-sunken/30 p-4 space-y-3",
138
- children: [/* @__PURE__ */ V("div", {
140
+ children: [/* @__PURE__ */ H("div", {
139
141
  className: "flex items-center justify-between",
140
- children: [/* @__PURE__ */ B("span", {
142
+ children: [/* @__PURE__ */ V("span", {
141
143
  className: "text-xs text-text-secondary font-medium uppercase tracking-wide",
142
144
  children: "Connected workspace"
143
- }), /* @__PURE__ */ B(a, {
145
+ }), /* @__PURE__ */ V(a, {
144
146
  permission: i.CHANNEL_DELETE,
145
- children: /* @__PURE__ */ B(s, {
147
+ children: /* @__PURE__ */ V(s, {
146
148
  variant: "ghost",
147
149
  size: "icon",
148
150
  onClick: async () => {
149
- if (confirm(`Remove this ${L.label} channel from the bot?`)) try {
150
- await w(e), o(), Z.success(`${L.label} channel removed`), T() && D("success");
151
+ if (confirm(`Remove this ${z.label} channel from the bot?`)) try {
152
+ await E(e), o(), Z.success(`${z.label} channel removed`), D() && k("success");
151
153
  } catch (e) {
152
- Z.error(e instanceof Error ? e.message : "Failed to remove"), T() && D("error");
154
+ Z.error(e instanceof Error ? e.message : "Failed to remove"), D() && k("error");
153
155
  }
154
156
  },
155
157
  className: "h-7 w-7 text-text-secondary hover:text-status-error-text",
156
158
  title: "Remove channel",
157
- children: /* @__PURE__ */ B(X, { size: 13 })
159
+ children: /* @__PURE__ */ V(se, { size: 13 })
158
160
  })
159
161
  })]
160
- }), _ ? /* @__PURE__ */ V("div", {
162
+ }), _ ? /* @__PURE__ */ H("div", {
161
163
  className: "flex items-center gap-2 py-2 text-text-secondary",
162
- children: [/* @__PURE__ */ B(W, {
164
+ children: [/* @__PURE__ */ V(q, {
163
165
  size: 14,
164
166
  className: "animate-spin"
165
- }), /* @__PURE__ */ V("span", {
167
+ }), /* @__PURE__ */ H("span", {
166
168
  className: "text-xs",
167
169
  children: [
168
170
  "Checking ",
169
- L.label,
171
+ z.label,
170
172
  " connection…"
171
173
  ]
172
174
  })]
173
- }) : h?.dmAllowed ? /* @__PURE__ */ V("div", {
175
+ }) : h?.dmAllowed ? /* @__PURE__ */ H("div", {
174
176
  className: "space-y-2",
175
177
  children: [
176
- /* @__PURE__ */ V("div", {
178
+ /* @__PURE__ */ H("div", {
177
179
  className: "flex items-center gap-3 p-3 rounded-lg bg-bg-surface border border-border-subtle",
178
180
  children: [
179
- /* @__PURE__ */ B(ne, {
181
+ /* @__PURE__ */ V(re, {
180
182
  size: 16,
181
183
  className: "text-status-success-text shrink-0"
182
184
  }),
183
- /* @__PURE__ */ V("div", {
185
+ /* @__PURE__ */ H("div", {
184
186
  className: "min-w-0 flex-1",
185
187
  children: [
186
- /* @__PURE__ */ B("p", {
188
+ /* @__PURE__ */ V("p", {
187
189
  className: "font-medium text-sm",
188
190
  children: h.externalDisplayName || h.externalUsername || h.externalUserId
189
191
  }),
190
- h.externalUsername && /* @__PURE__ */ V("p", {
192
+ h.externalUsername && /* @__PURE__ */ H("p", {
191
193
  className: "text-xs text-text-secondary",
192
194
  children: ["@", h.externalUsername]
193
195
  }),
194
- h.connectedAt && /* @__PURE__ */ V("p", {
196
+ h.connectedAt && /* @__PURE__ */ H("p", {
195
197
  className: "text-xs text-text-secondary",
196
198
  children: ["Connected ", new Date(h.connectedAt).toLocaleDateString()]
197
199
  })
198
200
  ]
199
201
  }),
200
- h.isTokenExpired && /* @__PURE__ */ B(c, {
202
+ h.isTokenExpired && /* @__PURE__ */ V(c, {
201
203
  variant: "outline",
202
204
  className: "text-xs text-status-warning-text border-status-warning-border",
203
205
  children: "Token expired"
204
206
  })
205
207
  ]
206
208
  }),
207
- h.integrationConnectionId && /* @__PURE__ */ V("div", {
209
+ h.integrationConnectionId && /* @__PURE__ */ H("div", {
208
210
  className: "space-y-1.5",
209
- children: [/* @__PURE__ */ B("label", {
211
+ children: [/* @__PURE__ */ V("label", {
210
212
  className: "text-xs font-medium text-text-secondary",
211
213
  children: "Integration Connection ID"
212
- }), /* @__PURE__ */ B(u, {
214
+ }), /* @__PURE__ */ V(u, {
213
215
  value: h.integrationConnectionId,
214
216
  readOnly: !0,
215
217
  className: "text-xs font-mono bg-bg-sunken/50 cursor-default",
216
218
  onClick: (e) => {
217
- e.currentTarget.select(), E(h.integrationConnectionId), Z.success("Connection ID copied to clipboard"), T() && k("Copied");
219
+ e.currentTarget.select(), O(h.integrationConnectionId), Z.success("Connection ID copied to clipboard"), D() && j("Copied");
218
220
  },
219
221
  title: "Click to copy"
220
222
  })]
221
223
  }),
222
- /* @__PURE__ */ V("div", {
224
+ /* @__PURE__ */ H("div", {
223
225
  className: "flex items-center justify-between p-3 border border-border-subtle rounded-lg bg-bg-surface",
224
- children: [/* @__PURE__ */ V("div", {
226
+ children: [/* @__PURE__ */ H("div", {
225
227
  className: "flex items-center gap-2",
226
- children: [h.notificationsEnabled ? /* @__PURE__ */ B(H, {
228
+ children: [h.notificationsEnabled ? /* @__PURE__ */ V(ne, {
227
229
  size: 14,
228
230
  className: "text-primary"
229
- }) : /* @__PURE__ */ B(te, {
231
+ }) : /* @__PURE__ */ V(U, {
230
232
  size: 14,
231
233
  className: "text-text-secondary"
232
- }), /* @__PURE__ */ V("div", { children: [/* @__PURE__ */ B("p", {
234
+ }), /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("p", {
233
235
  className: "text-sm font-medium",
234
236
  children: "DM Notifications"
235
- }), /* @__PURE__ */ B("p", {
237
+ }), /* @__PURE__ */ V("p", {
236
238
  className: "text-xs text-text-secondary",
237
- children: h.notificationsEnabled ? `Bot will DM you on ${L.label}` : "DM notifications paused"
239
+ children: h.notificationsEnabled ? `Bot will DM you on ${z.label}` : "DM notifications paused"
238
240
  })] })]
239
- }), /* @__PURE__ */ B(s, {
241
+ }), /* @__PURE__ */ V(s, {
240
242
  variant: "outline",
241
243
  size: "sm",
242
- isLoading: b,
244
+ isLoading: S,
243
245
  onClick: async () => {
244
246
  await y(h.id, !h.notificationsEnabled) && await v();
245
247
  },
246
248
  children: h.notificationsEnabled ? "Disable" : "Enable"
247
249
  })]
248
250
  }),
249
- /* @__PURE__ */ V("div", {
251
+ /* @__PURE__ */ H("div", {
250
252
  className: "flex gap-2 justify-end pt-1",
251
- children: [h.isTokenExpired && /* @__PURE__ */ B(s, {
253
+ children: [h.isTokenExpired && /* @__PURE__ */ V(s, {
252
254
  variant: "outline",
253
255
  size: "sm",
254
- leftIcon: L.icon,
256
+ leftIcon: z.icon,
255
257
  onClick: l,
256
258
  children: "Reconnect"
257
- }), /* @__PURE__ */ B(s, {
259
+ }), /* @__PURE__ */ V(s, {
258
260
  variant: "destructive",
259
261
  size: "sm",
260
- leftIcon: /* @__PURE__ */ B(oe, { size: 13 }),
261
- isLoading: S,
262
+ leftIcon: /* @__PURE__ */ V(ce, { size: 13 }),
263
+ isLoading: w,
262
264
  onClick: async () => {
263
- await x(h.id) && await v();
265
+ await C(h.id) && await v();
264
266
  },
265
267
  children: "Disconnect"
266
268
  })]
267
269
  })
268
270
  ]
269
- }) : /* @__PURE__ */ V("div", {
271
+ }) : /* @__PURE__ */ H("div", {
270
272
  className: "space-y-3 py-2",
271
273
  children: [
272
- /* @__PURE__ */ V("div", {
274
+ /* @__PURE__ */ H("div", {
273
275
  className: "flex items-center gap-2 p-3 rounded-lg bg-bg-surface border border-border-subtle",
274
- children: [/* @__PURE__ */ B("div", {
276
+ children: [/* @__PURE__ */ V("div", {
275
277
  className: "p-2 rounded-full bg-bg-sunken shrink-0",
276
- children: /* @__PURE__ */ B("span", {
278
+ children: /* @__PURE__ */ V("span", {
277
279
  className: "text-text-secondary",
278
- children: L.icon
280
+ children: z.icon
279
281
  })
280
- }), /* @__PURE__ */ V("div", {
282
+ }), /* @__PURE__ */ H("div", {
281
283
  className: "flex-1 min-w-0",
282
- children: [/* @__PURE__ */ B("p", {
284
+ children: [/* @__PURE__ */ V("p", {
283
285
  className: "font-medium text-sm",
284
286
  children: "No personal account connected"
285
- }), /* @__PURE__ */ V("p", {
287
+ }), /* @__PURE__ */ H("p", {
286
288
  className: "text-xs text-text-secondary mt-0.5",
287
289
  children: [
288
290
  "Connect your ",
289
- L.label,
291
+ z.label,
290
292
  " account to receive bot DMs"
291
293
  ]
292
294
  })]
293
295
  })]
294
296
  }),
295
- /* @__PURE__ */ V("div", {
297
+ /* @__PURE__ */ H("div", {
296
298
  className: "p-3 rounded-lg bg-bg-sunken/50 space-y-2",
297
- children: [/* @__PURE__ */ B("p", {
299
+ children: [/* @__PURE__ */ V("p", {
298
300
  className: "text-xs font-medium text-text-secondary",
299
301
  children: "Connect your account:"
300
- }), /* @__PURE__ */ V("ol", {
302
+ }), /* @__PURE__ */ H("ol", {
301
303
  className: "list-decimal list-inside space-y-1 text-xs text-text-secondary",
302
304
  children: [
303
- /* @__PURE__ */ B("li", { children: "Click \"Open Integrations\" below (opens in new tab)" }),
304
- /* @__PURE__ */ V("li", { children: [
305
+ /* @__PURE__ */ V("li", { children: "Click \"Open Integrations\" below (opens in new tab)" }),
306
+ /* @__PURE__ */ H("li", { children: [
305
307
  "Connect your ",
306
- L.label,
308
+ z.label,
307
309
  " account via OAuth"
308
310
  ] }),
309
- /* @__PURE__ */ B("li", { children: "Copy the Connection ID from the integrations page" }),
310
- /* @__PURE__ */ B("li", { children: "Paste it below and click \"Link Connection\"" })
311
+ /* @__PURE__ */ V("li", { children: "Come back, choose the account below and click \"Link account\"" })
311
312
  ]
312
313
  })]
313
314
  }),
314
- /* @__PURE__ */ B(s, {
315
+ /* @__PURE__ */ V(s, {
315
316
  variant: "outline",
316
317
  size: "sm",
317
- leftIcon: L.icon,
318
+ leftIcon: z.icon,
318
319
  onClick: l,
319
320
  className: "w-full",
320
321
  children: "Open Integrations →"
321
322
  }),
322
- /* @__PURE__ */ V("div", {
323
- className: "flex gap-2",
324
- children: [/* @__PURE__ */ B(u, {
325
- placeholder: "Paste integration connection ID...",
326
- value: O,
327
- onChange: (e) => A(e.target.value),
328
- className: "flex-1 text-sm"
329
- }), /* @__PURE__ */ B(s, {
323
+ W.loading ? /* @__PURE__ */ V("p", {
324
+ role: "status",
325
+ className: "text-xs text-text-secondary",
326
+ children: "Loading your connected accounts…"
327
+ }) : W.error ? /* @__PURE__ */ H("div", {
328
+ role: "alert",
329
+ className: "flex flex-wrap items-center gap-2 text-xs text-status-error-text",
330
+ children: [/* @__PURE__ */ V("span", { children: W.error.message }), /* @__PURE__ */ V(s, {
330
331
  size: "sm",
331
- onClick: async () => {
332
- if (!O.trim()) Z.error("Please enter an integration connection ID");
333
- else {
334
- I(!0);
335
- try {
336
- let e = await C(O.trim(), m);
337
- e ? (Z.success(`${e.externalDisplayName ?? e.externalUsername ?? "Account"} connected! The bot can now send you direct messages.`), await v(), A("")) : Z.error("Failed to link connection. Please verify the ID and try again.");
338
- } catch (e) {
339
- Z.error(e instanceof Error ? e.message : "Failed to link connection");
340
- } finally {
341
- I(!1);
342
- }
343
- }
344
- },
345
- isLoading: F,
346
- disabled: !O.trim() || F,
347
- children: "Link Connection"
332
+ variant: "outline",
333
+ onClick: () => void W.refetch(),
334
+ children: "Try again"
348
335
  })]
336
+ }) : G.length === 0 ? /* @__PURE__ */ H("div", {
337
+ className: "flex flex-wrap items-center gap-2 text-xs text-text-secondary",
338
+ children: [/* @__PURE__ */ H("span", { children: [
339
+ "No connected ",
340
+ z.label,
341
+ " account yet. Connect one in Integrations, then refresh."
342
+ ] }), /* @__PURE__ */ V(s, {
343
+ size: "sm",
344
+ variant: "outline",
345
+ onClick: () => void W.refetch(),
346
+ children: "Refresh"
347
+ })]
348
+ }) : /* @__PURE__ */ H("div", {
349
+ className: "flex gap-2",
350
+ children: [
351
+ /* @__PURE__ */ V("label", {
352
+ className: "sr-only",
353
+ htmlFor: `link-connection-${e}`,
354
+ children: `Your ${z.label} account`
355
+ }),
356
+ /* @__PURE__ */ V("select", {
357
+ id: `link-connection-${e}`,
358
+ className: "h-9 flex-1 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)]",
359
+ value: K,
360
+ onChange: (e) => M(e.target.value),
361
+ children: G.map((e) => /* @__PURE__ */ V("option", {
362
+ value: e.id,
363
+ children: e.externalAccountName ?? e.externalAccountEmail ?? e.name
364
+ }, e.id))
365
+ }),
366
+ /* @__PURE__ */ V(s, {
367
+ size: "sm",
368
+ onClick: async () => {
369
+ if (!K) Z.error(`Choose a connected ${z.label} account first`);
370
+ else {
371
+ R(!0);
372
+ try {
373
+ let e = await T(K, m);
374
+ e ? (Z.success(`${e.externalDisplayName ?? e.externalUsername ?? "Account"} connected! The bot can now send you direct messages.`), await v(), M("")) : Z.error("Failed to link the account. Reconnect it in Integrations and try again.");
375
+ } catch (e) {
376
+ Z.error(e instanceof Error ? e.message : "Failed to link connection");
377
+ } finally {
378
+ R(!1);
379
+ }
380
+ }
381
+ },
382
+ isLoading: L,
383
+ disabled: !K || L,
384
+ children: "Link account"
385
+ })
386
+ ]
349
387
  })
350
388
  ]
351
389
  })]
352
390
  });
353
- }, me = ({ channel: o, routes: l, botId: u, botName: d, onRoutesChanged: f }) => {
354
- let { basePath: p } = x(), [g] = h(), [y] = m(), [b] = v(), S = _(), [C, w] = R(!1), E = o.platform, D = $(E), k = fe(o.adapterType), A = C, j = L((e) => {
355
- let t = le[E];
391
+ }, ge = ({ channel: o, routes: l, botId: u, botName: d, onRoutesChanged: f }) => {
392
+ let { basePath: p } = E(), [g] = h(), [y] = m(), [b] = v(), x = _(), [S, C] = B(!1), w = o.platform, T = $(w), O = me(o.adapterType), k = S, j = z((e) => {
393
+ let t = de[w];
356
394
  if (!t) return;
357
395
  let n = window.location.origin + window.location.pathname + window.location.search, r = `${p ? p.replace(/\/(botmanor|botlit)(\/.*)?$/, "/integrations") : "/integrations"}/connections/add?${new URLSearchParams({
358
396
  providerKey: t,
359
397
  returnTo: n,
360
398
  channelId: e
361
399
  }).toString()}`;
362
- T() && /^https?:\/\//.test(r) ? O(r) : window.open(r, "_blank");
363
- }, [E, p]), M = L(async () => {
364
- w(!0);
400
+ D() && /^https?:\/\//.test(r) ? A(r) : window.open(r, "_blank");
401
+ }, [w, p]), M = z(async () => {
402
+ C(!0);
365
403
  try {
366
- let e = await S(o.id), t = await F(o, e, {
404
+ let e = await x(o.id), t = await L(o, e, {
367
405
  create: y,
368
406
  activate: (e) => b({
369
407
  connectorId: e,
@@ -380,104 +418,104 @@ var pe = ({ routeId: e, connectorId: t, channelId: n, platform: r, onRemoved: o,
380
418
  }
381
419
  }), await f(), j(o.id);
382
420
  } catch (e) {
383
- Z.error(e instanceof Error ? e.message : `Failed to connect ${D.label}`), w(!1);
421
+ Z.error(e instanceof Error ? e.message : `Failed to connect ${T.label}`), C(!1);
384
422
  }
385
423
  }, [
386
424
  u,
387
425
  d,
388
426
  o,
389
- S,
427
+ x,
390
428
  y,
391
429
  b,
392
430
  g,
393
- D.label,
431
+ T.label,
394
432
  j,
395
433
  f
396
- ]), N = L(() => {
434
+ ]), N = z(() => {
397
435
  j(o.id);
398
436
  }, [o.id, j]);
399
- return /* @__PURE__ */ V(e, { children: [/* @__PURE__ */ V(n, {
437
+ return /* @__PURE__ */ H(e, { children: [/* @__PURE__ */ H(n, {
400
438
  className: "flex flex-row items-center justify-between pb-3",
401
- children: [/* @__PURE__ */ V("div", {
439
+ children: [/* @__PURE__ */ H("div", {
402
440
  className: "flex items-center gap-2.5",
403
- children: [/* @__PURE__ */ B("div", {
404
- className: `p-1.5 rounded-md ${D.accentBg}`,
405
- children: /* @__PURE__ */ B("span", {
406
- className: D.accentText,
407
- children: D.icon
441
+ children: [/* @__PURE__ */ V("div", {
442
+ className: `p-1.5 rounded-md ${T.accentBg}`,
443
+ children: /* @__PURE__ */ V("span", {
444
+ className: T.accentText,
445
+ children: T.icon
408
446
  })
409
- }), /* @__PURE__ */ V("div", { children: [/* @__PURE__ */ B(r, {
447
+ }), /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V(r, {
410
448
  className: "text-base",
411
449
  children: o.name
412
- }), k && /* @__PURE__ */ B("p", {
450
+ }), O && /* @__PURE__ */ V("p", {
413
451
  className: "text-xs text-text-secondary mt-0.5",
414
- children: k
452
+ children: O
415
453
  })] })]
416
- }), /* @__PURE__ */ V("div", {
454
+ }), /* @__PURE__ */ H("div", {
417
455
  className: "flex items-center gap-1.5",
418
- children: [/* @__PURE__ */ B("span", {
419
- className: `px-2 py-0.5 text-xs font-semibold rounded-full ${D.badgeClass}`,
420
- children: D.label
421
- }), l.some((e) => e.isActive) ? /* @__PURE__ */ B(c, {
456
+ children: [/* @__PURE__ */ V("span", {
457
+ className: `px-2 py-0.5 text-xs font-semibold rounded-full ${T.badgeClass}`,
458
+ children: T.label
459
+ }), l.some((e) => e.isActive) ? /* @__PURE__ */ V(c, {
422
460
  variant: "outline",
423
461
  className: "text-xs text-status-success-text border-status-success-border bg-status-success-bg-subtle",
424
462
  children: "Active"
425
- }) : l.length > 0 && /* @__PURE__ */ B(c, {
463
+ }) : l.length > 0 && /* @__PURE__ */ V(c, {
426
464
  variant: "outline",
427
465
  className: "text-xs",
428
466
  title: "Turn the route on in Channels",
429
467
  children: "Off"
430
468
  })]
431
469
  })]
432
- }), /* @__PURE__ */ B(t, { children: l.length > 0 ? /* @__PURE__ */ B("div", {
470
+ }), /* @__PURE__ */ V(t, { children: l.length > 0 ? /* @__PURE__ */ V("div", {
433
471
  className: "space-y-3",
434
- children: l.map((e) => /* @__PURE__ */ B(pe, {
472
+ children: l.map((e) => /* @__PURE__ */ V(he, {
435
473
  routeId: e.id,
436
474
  connectorId: e.connectorId,
437
475
  channelId: o.id,
438
- platform: E,
476
+ platform: w,
439
477
  onRemoved: f,
440
478
  onReconnect: N
441
479
  }, e.id))
442
- }) : /* @__PURE__ */ V("div", {
480
+ }) : /* @__PURE__ */ H("div", {
443
481
  className: "flex flex-col items-center gap-4 py-8 text-center",
444
482
  children: [
445
- /* @__PURE__ */ B("div", {
483
+ /* @__PURE__ */ V("div", {
446
484
  className: "p-4 rounded-full bg-bg-sunken",
447
- children: /* @__PURE__ */ B("span", {
485
+ children: /* @__PURE__ */ V("span", {
448
486
  className: "text-text-secondary",
449
- children: D.icon
487
+ children: T.icon
450
488
  })
451
489
  }),
452
- /* @__PURE__ */ V("div", { children: [/* @__PURE__ */ B("p", {
490
+ /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("p", {
453
491
  className: "font-medium text-sm",
454
492
  children: "Not connected to this bot"
455
- }), /* @__PURE__ */ V("p", {
493
+ }), /* @__PURE__ */ H("p", {
456
494
  className: "text-xs text-text-secondary mt-1",
457
495
  children: [
458
496
  "Enable ",
459
- D.label,
497
+ T.label,
460
498
  " for this bot. Users will connect their personal accounts separately."
461
499
  ]
462
500
  })] }),
463
- /* @__PURE__ */ B(a, {
501
+ /* @__PURE__ */ V(a, {
464
502
  permission: i.CHANNEL_CREATE,
465
- children: /* @__PURE__ */ V(s, {
466
- leftIcon: D.icon,
503
+ children: /* @__PURE__ */ H(s, {
504
+ leftIcon: T.icon,
467
505
  onClick: M,
468
- isLoading: A,
506
+ isLoading: k,
469
507
  children: [
470
508
  "Set up ",
471
- D.label,
509
+ T.label,
472
510
  " channel"
473
511
  ]
474
512
  })
475
513
  })
476
514
  ]
477
515
  }) })] });
478
- }, he = ({ connector: o, routes: l, botId: u, botName: d, onRoutesChanged: f }) => {
479
- let { navigateTo: p, workspaceId: m } = x(), [_] = h(), [y] = g(), [E] = v(), [O, k] = R(!1), A = $(o.type), j = o.status === "ACTIVE", M = C(o.type) ? o.credentialsRefId : null, { data: N, loading: P, error: F, refetch: I } = w(M), ee = L(async () => {
480
- k(!0);
516
+ }, _e = ({ connector: o, routes: l, botId: u, botName: d, onRoutesChanged: f }) => {
517
+ let { navigateTo: p, workspaceId: m } = E(), [_] = h(), [y] = g(), [b] = v(), [x, O] = B(!1), A = $(o.type), j = o.status === "ACTIVE", M = C(o.type) ? o.credentialsRefId : null, { data: N, loading: P, error: F, refetch: I } = w(M), L = z(async () => {
518
+ O(!0);
481
519
  try {
482
520
  let e = await _({
483
521
  connectorId: o.id,
@@ -489,18 +527,18 @@ var pe = ({ routeId: e, connectorId: t, channelId: n, platform: r, onRemoved: o,
489
527
  }
490
528
  });
491
529
  if (!j) try {
492
- await E({
530
+ await b({
493
531
  connectorId: o.id,
494
532
  input: { status: "ACTIVE" }
495
533
  });
496
534
  } catch (t) {
497
535
  throw await y(e.id).catch(() => void 0), await f(), t;
498
536
  }
499
- await f(), M && await I(), Z.success(`${o.name} now answers with ${d}`), T() && D("success");
537
+ await f(), M && await I(), Z.success(`${o.name} now answers with ${d}`), D() && k("success");
500
538
  } catch (e) {
501
- Z.error(e instanceof Error ? e.message : `Failed to route ${o.name}`), T() && D("error");
539
+ Z.error(e instanceof Error ? e.message : `Failed to route ${o.name}`), D() && k("error");
502
540
  } finally {
503
- k(!1);
541
+ O(!1);
504
542
  }
505
543
  }, [
506
544
  j,
@@ -513,96 +551,96 @@ var pe = ({ routeId: e, connectorId: t, channelId: n, platform: r, onRemoved: o,
513
551
  M,
514
552
  f,
515
553
  I,
516
- E
517
- ]), z = L(async (e) => {
554
+ b
555
+ ]), R = z(async (e) => {
518
556
  if (confirm(`Remove ${o.name} from this bot?`)) try {
519
- await y(e), await f(), Z.success(`${o.name} removed from the bot`), T() && D("success");
557
+ await y(e), await f(), Z.success(`${o.name} removed from the bot`), D() && k("success");
520
558
  } catch (e) {
521
- Z.error(e instanceof Error ? e.message : "Failed to remove"), T() && D("error");
559
+ Z.error(e instanceof Error ? e.message : "Failed to remove"), D() && k("error");
522
560
  }
523
561
  }, [
524
562
  o.name,
525
563
  y,
526
564
  f
527
565
  ]);
528
- return /* @__PURE__ */ V(e, { children: [/* @__PURE__ */ V(n, {
566
+ return /* @__PURE__ */ H(e, { children: [/* @__PURE__ */ H(n, {
529
567
  className: "flex flex-row items-center justify-between pb-3",
530
- children: [/* @__PURE__ */ V("div", {
568
+ children: [/* @__PURE__ */ H("div", {
531
569
  className: "flex items-center gap-2.5",
532
- children: [/* @__PURE__ */ B("div", {
570
+ children: [/* @__PURE__ */ V("div", {
533
571
  className: `p-1.5 rounded-md ${A.accentBg}`,
534
- children: /* @__PURE__ */ B("span", {
572
+ children: /* @__PURE__ */ V("span", {
535
573
  className: A.accentText,
536
574
  children: A.icon
537
575
  })
538
- }), /* @__PURE__ */ V("div", { children: [/* @__PURE__ */ B(r, {
576
+ }), /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V(r, {
539
577
  className: "text-base",
540
578
  children: o.name
541
- }), o.description && /* @__PURE__ */ B("p", {
579
+ }), o.description && /* @__PURE__ */ V("p", {
542
580
  className: "text-xs text-text-secondary mt-0.5",
543
581
  children: o.description
544
582
  })] })]
545
- }), /* @__PURE__ */ V("div", {
583
+ }), /* @__PURE__ */ H("div", {
546
584
  className: "flex items-center gap-1.5",
547
- children: [/* @__PURE__ */ B("span", {
585
+ children: [/* @__PURE__ */ V("span", {
548
586
  className: `px-2 py-0.5 text-xs font-semibold rounded-full ${A.badgeClass}`,
549
587
  children: A.label
550
- }), /* @__PURE__ */ B(c, {
588
+ }), /* @__PURE__ */ V(c, {
551
589
  variant: "outline",
552
590
  className: "text-xs",
553
591
  children: j ? "Active" : "Draft"
554
592
  })]
555
593
  })]
556
- }), /* @__PURE__ */ V(t, {
594
+ }), /* @__PURE__ */ H(t, {
557
595
  className: "space-y-4",
558
596
  children: [
559
- l.length > 0 ? /* @__PURE__ */ B("div", {
597
+ l.length > 0 ? /* @__PURE__ */ V("div", {
560
598
  className: "space-y-2",
561
- children: l.map((e) => /* @__PURE__ */ V("div", {
599
+ children: l.map((e) => /* @__PURE__ */ H("div", {
562
600
  className: "flex items-center justify-between rounded-lg border border-border-subtle bg-bg-sunken/30 px-3 py-2",
563
- children: [/* @__PURE__ */ V("span", {
601
+ children: [/* @__PURE__ */ H("span", {
564
602
  className: "text-sm",
565
603
  children: [
566
604
  e.isActive ? "Answers" : "Turned off for",
567
605
  " ",
568
- e.locationId === "*" ? "every location" : /* @__PURE__ */ B("code", { children: e.locationId }),
569
- !e.isActive && /* @__PURE__ */ B("span", {
606
+ e.locationId === "*" ? "every location" : /* @__PURE__ */ V("code", { children: e.locationId }),
607
+ !e.isActive && /* @__PURE__ */ V("span", {
570
608
  className: "ml-2 text-xs text-text-secondary",
571
609
  children: "(turn it on in Channels to answer here)"
572
610
  })
573
611
  ]
574
- }), /* @__PURE__ */ B(a, {
612
+ }), /* @__PURE__ */ V(a, {
575
613
  permission: i.CHANNEL_DELETE,
576
- children: /* @__PURE__ */ B(s, {
614
+ children: /* @__PURE__ */ V(s, {
577
615
  variant: "ghost",
578
616
  size: "icon",
579
- onClick: () => void z(e.id),
617
+ onClick: () => void R(e.id),
580
618
  className: "h-7 w-7 text-text-secondary hover:text-status-error-text",
581
619
  title: "Remove channel",
582
620
  "aria-label": `Remove ${o.name} from the bot`,
583
- children: /* @__PURE__ */ B(X, { size: 14 })
621
+ children: /* @__PURE__ */ V(se, { size: 14 })
584
622
  })
585
623
  })]
586
624
  }, e.id))
587
- }) : /* @__PURE__ */ V("div", {
625
+ }) : /* @__PURE__ */ H("div", {
588
626
  className: "flex flex-col items-center gap-3 py-6 text-center",
589
- children: [/* @__PURE__ */ B("p", {
627
+ children: [/* @__PURE__ */ V("p", {
590
628
  className: "text-sm text-text-secondary",
591
629
  children: j ? `Route every message of this channel to ${d}.` : `Activate this connector and route every message of it to ${d}.`
592
- }), /* @__PURE__ */ B(a, {
630
+ }), /* @__PURE__ */ V(a, {
593
631
  permission: i.CHANNEL_CREATE,
594
- children: /* @__PURE__ */ B(a, {
632
+ children: /* @__PURE__ */ V(a, {
595
633
  permission: j ? i.CHANNEL_CREATE : i.CHANNEL_UPDATE,
596
- children: /* @__PURE__ */ B(s, {
634
+ children: /* @__PURE__ */ V(s, {
597
635
  leftIcon: A.icon,
598
- onClick: () => void ee(),
599
- isLoading: O,
636
+ onClick: () => void L(),
637
+ isLoading: x,
600
638
  children: "Route to this bot"
601
639
  })
602
640
  })
603
641
  })]
604
642
  }),
605
- M && l.length > 0 && /* @__PURE__ */ B(b, {
643
+ M && l.length > 0 && /* @__PURE__ */ V(T, {
606
644
  channel: N,
607
645
  loading: P,
608
646
  error: F,
@@ -612,172 +650,172 @@ var pe = ({ routeId: e, connectorId: t, channelId: n, platform: r, onRemoved: o,
612
650
  usesInboundUrl: S[o.type]?.usesInboundUrl ?? !0,
613
651
  onRefresh: () => void I()
614
652
  }),
615
- /* @__PURE__ */ B(s, {
653
+ /* @__PURE__ */ V(s, {
616
654
  variant: "ghost",
617
655
  size: "sm",
618
- leftIcon: /* @__PURE__ */ B(ie, { size: 14 }),
656
+ leftIcon: /* @__PURE__ */ V(G, { size: 14 }),
619
657
  onClick: () => p(`channels/${o.id}`),
620
658
  children: "Open connector"
621
659
  })
622
660
  ]
623
661
  })] });
624
- }, ge = ({ route: e, oauthChannels: t, botId: n, botName: r, onRoutesChanged: i }) => {
662
+ }, ve = ({ route: e, oauthChannels: t, botId: n, botName: r, onRoutesChanged: i }) => {
625
663
  let { data: a } = p(e.connectorId), o = t.find((e) => e.id === a?.credentialsRefId);
626
- return a ? !o || !ue.has(o.platform) ? /* @__PURE__ */ B(he, {
664
+ return a ? !o || !fe.has(o.platform) ? /* @__PURE__ */ V(_e, {
627
665
  connector: a,
628
666
  routes: [e],
629
667
  botId: n,
630
668
  botName: r,
631
669
  onRoutesChanged: i
632
- }) : /* @__PURE__ */ B(me, {
670
+ }) : /* @__PURE__ */ V(ge, {
633
671
  channel: o,
634
672
  routes: [e],
635
673
  botId: n,
636
674
  botName: r,
637
675
  onRoutesChanged: i
638
676
  }) : null;
639
- }, _e = ({ botId: n, botName: r }) => {
640
- let { organizationId: c } = x(), u = ee(() => ({
641
- channelType: I.Communication,
677
+ }, ye = ({ botId: n, botName: r }) => {
678
+ let { organizationId: c } = E(), u = ee(() => ({
679
+ channelType: R.Communication,
642
680
  organizationId: c || void 0
643
- }), [c]), { data: p, loading: m, error: h, refetch: g } = A(u), { data: _, loading: v, error: b, refetch: S } = f(n), [C, w] = R(!1), [T, E] = R(null), { data: D, loading: O, error: k, refetch: j } = d(), M = L(async () => {
644
- await Promise.all([S(), j()]);
645
- }, [S, j]), N = p.filter((e) => ue.has(e.platform)), P = N.filter((e) => e.status === "ACTIVE" && (!c || e.organizationId === c)), F = new Set(_.map((e) => D.find((t) => t.id === e.connectorId)).map((e) => e?.credentialsRefId).filter((e) => !!e)), H = !m && !v && !O && !h && !b && !k, te = P.filter((e) => H && !F.has(e.id)), ne = new Set(N.map((e) => e.id)), re = new Set(_.map((e) => e.connectorId)), ie = o(i.CHANNEL_UPDATE), U = D.filter((e) => H && de.has(e.status) && (e.status === "ACTIVE" || ie) && !re.has(e.id) && !(e.credentialsRefId && ne.has(e.credentialsRefId))), W = [...U.map((e) => ({
681
+ }), [c]), { data: p, loading: m, error: h, refetch: g } = M(u), { data: _, loading: v, error: b, refetch: x } = f(n), [S, C] = B(!1), [w, T] = B(null), { data: D, loading: O, error: k, refetch: A } = d(), j = z(async () => {
682
+ await Promise.all([x(), A()]);
683
+ }, [x, A]), N = p.filter((e) => fe.has(e.platform)), P = N.filter((e) => e.status === "ACTIVE" && (!c || e.organizationId === c)), F = new Set(_.map((e) => D.find((t) => t.id === e.connectorId)).map((e) => e?.credentialsRefId).filter((e) => !!e)), I = !m && !v && !O && !h && !b && !k, L = P.filter((e) => I && !F.has(e.id)), ne = new Set(N.map((e) => e.id)), U = new Set(_.map((e) => e.connectorId)), re = o(i.CHANNEL_UPDATE), W = D.filter((e) => I && pe.has(e.status) && (e.status === "ACTIVE" || re) && !U.has(e.id) && !(e.credentialsRefId && ne.has(e.credentialsRefId))), G = [...W.map((e) => ({
646
684
  id: `${Q}${e.id}`,
647
685
  name: e.name,
648
686
  platform: e.type,
649
687
  description: e.description ?? void 0
650
- })), ...te], G = {}, K = {};
651
- W.forEach((e) => {
688
+ })), ...L], K = {}, q = {};
689
+ G.forEach((e) => {
652
690
  let t = e.platform, n = $(t);
653
- K[t] = n, G[t] = n.icon;
691
+ q[t] = n, K[t] = n.icon;
654
692
  });
655
- let q = L((e, t) => {
656
- E(e);
657
- }, []), J = T?.startsWith(Q) ? D.find((e) => `${Q}${e.id}` === T) : void 0, Y = N.length > 0 || U.length > 0;
658
- if (m && p.length === 0 || v && _.length === 0 || O && D.length === 0) return /* @__PURE__ */ V("div", {
693
+ let ie = z((e, t) => {
694
+ T(e);
695
+ }, []), J = w?.startsWith(Q) ? D.find((e) => `${Q}${e.id}` === w) : void 0, Y = N.length > 0 || W.length > 0;
696
+ if (m && p.length === 0 || v && _.length === 0 || O && D.length === 0) return /* @__PURE__ */ H("div", {
659
697
  className: "space-y-4",
660
698
  children: [
661
- /* @__PURE__ */ B("div", { className: "h-10 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg w-52" }),
662
- /* @__PURE__ */ B("div", { className: "h-48 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }),
663
- /* @__PURE__ */ B("div", { className: "h-48 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" })
699
+ /* @__PURE__ */ V("div", { className: "h-10 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg w-52" }),
700
+ /* @__PURE__ */ V("div", { className: "h-48 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }),
701
+ /* @__PURE__ */ V("div", { className: "h-48 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" })
664
702
  ]
665
703
  });
666
704
  let X = _.length > 0;
667
- return /* @__PURE__ */ V("div", {
705
+ return /* @__PURE__ */ H("div", {
668
706
  className: "space-y-4",
669
707
  children: [
670
- /* @__PURE__ */ V("div", {
708
+ /* @__PURE__ */ H("div", {
671
709
  className: "flex items-start justify-between gap-3",
672
- children: [/* @__PURE__ */ V("div", { children: [/* @__PURE__ */ B("h3", {
710
+ children: [/* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("h3", {
673
711
  className: "font-semibold text-base",
674
712
  children: "Channel Connections"
675
- }), /* @__PURE__ */ B("p", {
713
+ }), /* @__PURE__ */ V("p", {
676
714
  className: "text-sm text-text-secondary mt-0.5",
677
715
  children: "Communication platforms available for this bot"
678
- })] }), X && W.length > 0 && /* @__PURE__ */ B(a, {
716
+ })] }), X && G.length > 0 && /* @__PURE__ */ V(a, {
679
717
  permission: i.CHANNEL_CREATE,
680
- children: /* @__PURE__ */ B(s, {
718
+ children: /* @__PURE__ */ V(s, {
681
719
  variant: "outline",
682
720
  size: "sm",
683
- leftIcon: /* @__PURE__ */ B(ae, { size: 14 }),
684
- onClick: () => w(!0),
721
+ leftIcon: /* @__PURE__ */ V(ae, { size: 14 }),
722
+ onClick: () => C(!0),
685
723
  children: "Connect Channel"
686
724
  })
687
725
  })]
688
726
  }),
689
- h && /* @__PURE__ */ V("div", {
727
+ h && /* @__PURE__ */ H("div", {
690
728
  className: "flex items-center justify-between gap-2 rounded-lg border border-status-error-border/40 bg-status-error-bg/10 px-3 py-2 text-sm text-status-error-text",
691
- children: [/* @__PURE__ */ V("span", { children: ["Failed to load channels: ", h.message] }), /* @__PURE__ */ B(s, {
729
+ children: [/* @__PURE__ */ H("span", { children: ["Failed to load channels: ", h.message] }), /* @__PURE__ */ V(s, {
692
730
  variant: "ghost",
693
731
  size: "sm",
694
732
  onClick: () => void g(),
695
733
  children: "Retry"
696
734
  })]
697
735
  }),
698
- b && /* @__PURE__ */ V("div", {
736
+ b && /* @__PURE__ */ H("div", {
699
737
  className: "flex items-center justify-between gap-2 rounded-lg border border-status-error-border/40 bg-status-error-bg/10 px-3 py-2 text-sm text-status-error-text",
700
- children: [/* @__PURE__ */ V("span", { children: ["Failed to load this bot's channel routes: ", b.message] }), /* @__PURE__ */ B(s, {
738
+ children: [/* @__PURE__ */ H("span", { children: ["Failed to load this bot's channel routes: ", b.message] }), /* @__PURE__ */ V(s, {
701
739
  variant: "ghost",
702
740
  size: "sm",
703
- onClick: () => void S(),
741
+ onClick: () => void x(),
704
742
  children: "Retry"
705
743
  })]
706
744
  }),
707
- k && /* @__PURE__ */ V("div", {
745
+ k && /* @__PURE__ */ H("div", {
708
746
  className: "flex items-center justify-between gap-2 rounded-lg border border-status-error-border/40 bg-status-error-bg/10 px-3 py-2 text-sm text-status-error-text",
709
- children: [/* @__PURE__ */ V("span", { children: ["Failed to load channel connectors: ", k.message] }), /* @__PURE__ */ B(s, {
747
+ children: [/* @__PURE__ */ H("span", { children: ["Failed to load channel connectors: ", k.message] }), /* @__PURE__ */ V(s, {
710
748
  variant: "ghost",
711
749
  size: "sm",
712
- onClick: () => void j(),
750
+ onClick: () => void A(),
713
751
  children: "Retry"
714
752
  })]
715
753
  }),
716
- H && !Y && !X && /* @__PURE__ */ B(e, { children: /* @__PURE__ */ B(t, {
754
+ I && !Y && !X && /* @__PURE__ */ V(e, { children: /* @__PURE__ */ V(t, {
717
755
  className: "py-12",
718
- children: /* @__PURE__ */ B(l, {
756
+ children: /* @__PURE__ */ V(l, {
719
757
  illustration: "empty-notifications",
720
758
  title: "No channels available",
721
759
  description: "No channel connectors exist in this workspace yet. Create one under Channels, then route it to this bot here."
722
760
  })
723
761
  }) }),
724
- H && Y && !X && !T && /* @__PURE__ */ B(e, { children: /* @__PURE__ */ B(t, {
762
+ I && Y && !X && !w && /* @__PURE__ */ V(e, { children: /* @__PURE__ */ V(t, {
725
763
  className: "py-12",
726
- children: /* @__PURE__ */ B(l, {
764
+ children: /* @__PURE__ */ V(l, {
727
765
  illustration: "empty-notifications",
728
766
  title: "No channels connected",
729
767
  description: "Connect a channel — Slack, Teams, Discord, WhatsApp, a web widget or a webhook — to let people talk to this bot there.",
730
- action: /* @__PURE__ */ B(a, {
768
+ action: /* @__PURE__ */ V(a, {
731
769
  permission: i.CHANNEL_CREATE,
732
- children: /* @__PURE__ */ B(s, {
733
- leftIcon: /* @__PURE__ */ B(ae, { size: 16 }),
734
- onClick: () => w(!0),
770
+ children: /* @__PURE__ */ V(s, {
771
+ leftIcon: /* @__PURE__ */ V(ae, { size: 16 }),
772
+ onClick: () => C(!0),
735
773
  children: "Connect Channel"
736
774
  })
737
775
  })
738
776
  })
739
777
  }) }),
740
- (X || T) && /* @__PURE__ */ V("div", {
778
+ (X || w) && /* @__PURE__ */ H("div", {
741
779
  className: "space-y-4",
742
780
  children: [
743
- _.map((e) => /* @__PURE__ */ B(ge, {
781
+ _.map((e) => /* @__PURE__ */ V(ve, {
744
782
  route: e,
745
783
  oauthChannels: N,
746
784
  botId: n,
747
785
  botName: r,
748
- onRoutesChanged: M
786
+ onRoutesChanged: j
749
787
  }, e.id)),
750
- J && /* @__PURE__ */ B(he, {
788
+ J && /* @__PURE__ */ V(_e, {
751
789
  connector: J,
752
790
  routes: [],
753
791
  botId: n,
754
792
  botName: r,
755
793
  onRoutesChanged: async () => {
756
- await M(), E(null);
794
+ await j(), T(null);
757
795
  }
758
796
  }, J.id),
759
- T && !J && /* @__PURE__ */ B(z, { children: N.filter((e) => e.id === T).map((e) => /* @__PURE__ */ B(me, {
797
+ w && !J && /* @__PURE__ */ V(te, { children: N.filter((e) => e.id === w).map((e) => /* @__PURE__ */ V(ge, {
760
798
  channel: e,
761
799
  routes: _.filter((e) => !1),
762
800
  botId: n,
763
801
  botName: r,
764
802
  onRoutesChanged: async () => {
765
- await M(), E(null);
803
+ await j(), T(null);
766
804
  }
767
805
  }, e.id)) })
768
806
  ]
769
807
  }),
770
- /* @__PURE__ */ B(y, {
771
- open: C,
772
- onClose: () => w(!1),
773
- onSelectChannel: q,
774
- availableChannels: W,
775
- platformIcons: G,
776
- platformMeta: K
808
+ /* @__PURE__ */ V(y, {
809
+ open: S,
810
+ onClose: () => C(!1),
811
+ onSelectChannel: ie,
812
+ availableChannels: G,
813
+ platformIcons: K,
814
+ platformMeta: q
777
815
  })
778
816
  ]
779
817
  });
780
818
  };
781
- export { _e as BotChannelsTab };
819
+ export { ye as BotChannelsTab };
782
820
 
783
821
  //# sourceMappingURL=BotChannelsTab.js.map