@burdenoff/microfe-botmanor 2026.1118.5 → 2026.1118.7

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 (46) hide show
  1. package/dist/botlit/components/AgentBindingsPanel.d.ts +4 -0
  2. package/dist/botlit/components/AgentBindingsPanel.js +305 -0
  3. package/dist/botlit/components/AgentBindingsPanel.js.map +1 -0
  4. package/dist/botlit/components/ChannelSetupPanels.d.ts +21 -0
  5. package/dist/botlit/components/ChannelSetupPanels.js +139 -0
  6. package/dist/botlit/components/ChannelSetupPanels.js.map +1 -0
  7. package/dist/botlit/hooks/index.d.ts +5 -1
  8. package/dist/botlit/hooks/index.js +14 -12
  9. package/dist/botlit/hooks/useAgentBindings.d.ts +58 -0
  10. package/dist/botlit/hooks/useAgentBindings.js +87 -0
  11. package/dist/botlit/hooks/useAgentBindings.js.map +1 -0
  12. package/dist/botlit/hooks/useChannelSetup.d.ts +96 -0
  13. package/dist/botlit/hooks/useChannelSetup.js +199 -0
  14. package/dist/botlit/hooks/useChannelSetup.js.map +1 -0
  15. package/dist/botlit/hooks/useChannels.d.ts +6 -0
  16. package/dist/botlit/hooks/useChannels.js +80 -58
  17. package/dist/botlit/hooks/useChannels.js.map +1 -1
  18. package/dist/botlit/hooks/useUserPlatformConnection.d.ts +1 -0
  19. package/dist/botlit/hooks/useUserPlatformConnection.js +1 -0
  20. package/dist/botlit/hooks/useUserPlatformConnection.js.map +1 -1
  21. package/dist/botlit/pages/AgentDetailPage.js +56 -55
  22. package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
  23. package/dist/botlit/pages/BotChannelsTab.js +204 -186
  24. package/dist/botlit/pages/BotChannelsTab.js.map +1 -1
  25. package/dist/botlit/pages/ChannelDetailPage.js +658 -526
  26. package/dist/botlit/pages/ChannelDetailPage.js.map +1 -1
  27. package/dist/botlit/pages/ChannelsPage.js +2 -1
  28. package/dist/botlit/pages/ChannelsPage.js.map +1 -1
  29. package/dist/botlit/pages/PromptStudioPage.js +365 -175
  30. package/dist/botlit/pages/PromptStudioPage.js.map +1 -1
  31. package/dist/botlit/providers/BotlitProvider.js +39 -35
  32. package/dist/botlit/providers/BotlitProvider.js.map +1 -1
  33. package/dist/botlit/types/index.d.ts +2 -0
  34. package/dist/botlit/utils/channelConnectors.d.ts +16 -0
  35. package/dist/botlit/utils/channelConnectors.js +24 -0
  36. package/dist/botlit/utils/channelConnectors.js.map +1 -0
  37. package/dist/botlit/utils/promptVariables.d.ts +6 -0
  38. package/dist/botlit/utils/promptVariables.js +20 -0
  39. package/dist/botlit/utils/promptVariables.js.map +1 -0
  40. package/dist/generated/wspace-operations.d.ts +314 -0
  41. package/dist/generated/wspace-operations.js +189 -101
  42. package/dist/generated/wspace-operations.js.map +1 -1
  43. package/dist/generated/wspace-types.d.ts +139 -0
  44. package/dist/generated/wspace-types.js +3 -1
  45. package/dist/generated/wspace-types.js.map +1 -1
  46. package/package.json +1 -1
@@ -8,26 +8,28 @@ import { Input as l } from "../components/Input.js";
8
8
  import { ChannelSelectorSheet as u } from "../components/ChannelSelectorSheet.js";
9
9
  import { useBotlit as d } from "../providers/BotlitProvider.js";
10
10
  import { isNative as f, nativeCopyText as p, nativeNotify as m, nativeOpenUrl as h, nativeToast as g } from "../../utils/nativeBridge.js";
11
- import { useBotChannelRoutes as _, useChannelConnector as v, useCreateChannelRoute as y, useDeleteChannelRoute as b } from "../hooks/useChannels.js";
11
+ import { useBotChannelRoutes as _, useChannelConnector as v, useChannelConnectors as y, useCreateChannelConnector as b, useCreateChannelRoute as x, useDeleteChannelRoute as S, useFindChannelConnector as C, useUpdateChannelConnector as w } from "../hooks/useChannels.js";
12
12
  import "../hooks/index.js";
13
- import { useGlobalChannels as x, useLinkIntegrationConnection as S, useMyUserPlatformConnection as C, useRevokeSlackConnection as w, useToggleSlackNotifications as T } from "../hooks/useUserPlatformConnection.js";
13
+ import { useGlobalChannels as T, useLinkIntegrationConnection as E, useMyUserPlatformConnection as D, useRevokeSlackConnection as O, useToggleSlackNotifications as k } from "../hooks/useUserPlatformConnection.js";
14
+ import { ensureActiveConnector as A } from "../utils/channelConnectors.js";
14
15
  import "../permissions/index.js";
15
- import { useCallback as E, useState as D } from "react";
16
- import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
17
- import { Bell as j, BellOff as M, CheckCircle2 as N, Loader2 as P, Mail as F, MessageCircle as I, MessageSquare as L, Plus as R, Radio as z, Slack as B, Trash2 as V, Unlink as H, Users as U } from "lucide-react";
18
- import { toast as W } from "sonner";
16
+ import { ChannelType as j } from "../../generated/global-types.js";
17
+ import { useCallback as M, useMemo as N, useState as P } from "react";
18
+ import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
19
+ import { Bell as R, BellOff as z, CheckCircle2 as B, Loader2 as V, Mail as H, MessageCircle as U, MessageSquare as W, Plus as G, Radio as K, Slack as q, Trash2 as J, Unlink as ee, Users as Y } from "lucide-react";
20
+ import { toast as X } from "sonner";
19
21
  // src/botlit/pages/BotChannelsTab.tsx
20
- var G = {
22
+ var te = {
21
23
  SLACK: "slack-user",
22
24
  TEAMS: "teams-user",
23
25
  DISCORD: "discord-user",
24
26
  WHATSAPP: "whatsapp-user"
25
- }, K = /* @__PURE__ */ new Set([
27
+ }, Z = /* @__PURE__ */ new Set([
26
28
  "SLACK",
27
29
  "TEAMS",
28
30
  "DISCORD"
29
31
  ]);
30
- function q(e) {
32
+ function ne(e) {
31
33
  return e ? {
32
34
  SLACK_BOT: "Slack Bot",
33
35
  SLACK_WEBHOOK: "Slack Webhook",
@@ -53,281 +55,281 @@ function q(e) {
53
55
  WEBHOOK_HTTP: "HTTP Webhook"
54
56
  }[e] ?? e.replace(/_/g, " ").toLowerCase().replace(/\b\w/g, (e) => e.toUpperCase()) : null;
55
57
  }
56
- function J(e) {
58
+ function Q(e) {
57
59
  switch (e) {
58
60
  case "SLACK": return {
59
61
  label: "Slack",
60
62
  badgeClass: "bg-bg-sunken text-text-secondary",
61
- icon: /* @__PURE__ */ k(B, { size: 18 }),
63
+ icon: /* @__PURE__ */ I(q, { size: 18 }),
62
64
  accentBg: "bg-accent",
63
65
  accentText: "text-text-primary"
64
66
  };
65
67
  case "TEAMS": return {
66
68
  label: "Teams",
67
69
  badgeClass: "bg-bg-sunken text-text-secondary",
68
- icon: /* @__PURE__ */ k(U, { size: 18 }),
70
+ icon: /* @__PURE__ */ I(Y, { size: 18 }),
69
71
  accentBg: "bg-accent",
70
72
  accentText: "text-text-primary"
71
73
  };
72
74
  case "DISCORD": return {
73
75
  label: "Discord",
74
76
  badgeClass: "bg-bg-sunken text-text-secondary",
75
- icon: /* @__PURE__ */ k(I, { size: 18 }),
77
+ icon: /* @__PURE__ */ I(U, { size: 18 }),
76
78
  accentBg: "bg-accent",
77
79
  accentText: "text-text-primary"
78
80
  };
79
81
  case "WHATSAPP": return {
80
82
  label: "WhatsApp",
81
83
  badgeClass: "bg-bg-sunken text-text-secondary",
82
- icon: /* @__PURE__ */ k(L, { size: 18 }),
84
+ icon: /* @__PURE__ */ I(W, { size: 18 }),
83
85
  accentBg: "bg-accent",
84
86
  accentText: "text-text-primary"
85
87
  };
86
88
  case "EMAIL": return {
87
89
  label: "Email",
88
90
  badgeClass: "bg-bg-sunken text-text-secondary",
89
- icon: /* @__PURE__ */ k(F, { size: 18 }),
91
+ icon: /* @__PURE__ */ I(H, { size: 18 }),
90
92
  accentBg: "bg-accent",
91
93
  accentText: "text-text-primary"
92
94
  };
93
95
  case "SMS": return {
94
96
  label: "SMS",
95
97
  badgeClass: "bg-bg-sunken text-text-secondary",
96
- icon: /* @__PURE__ */ k(L, { size: 18 }),
98
+ icon: /* @__PURE__ */ I(W, { size: 18 }),
97
99
  accentBg: "bg-accent",
98
100
  accentText: "text-text-primary"
99
101
  };
100
102
  default: return {
101
103
  label: e,
102
104
  badgeClass: "bg-bg-sunken text-text-secondary",
103
- icon: /* @__PURE__ */ k(z, { size: 18 }),
105
+ icon: /* @__PURE__ */ I(K, { size: 18 }),
104
106
  accentBg: "bg-accent",
105
107
  accentText: "text-text-primary"
106
108
  };
107
109
  }
108
110
  }
109
- var Y = ({ routeId: e, connectorId: t, channelId: n, platform: r, onRemoved: c, onReconnect: u }) => {
110
- let { data: d, loading: h } = v(t), _ = d?.credentialsRefId ?? n, { data: y, loading: x, refetch: E } = C(_), { toggle: O, loading: F } = T(), { revoke: I, loading: L } = w(), { link: R } = S(), [z] = b(), [B, U] = D(""), [G, K] = D(!1), q = J(r);
111
- return h ? /* @__PURE__ */ k("div", { className: "h-32 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }) : /* @__PURE__ */ A("div", {
111
+ var re = ({ routeId: e, connectorId: t, channelId: n, platform: r, onRemoved: c, onReconnect: u }) => {
112
+ let { data: d, loading: h } = v(t), _ = d?.credentialsRefId ?? n, { data: y, loading: b, refetch: x } = D(_), { toggle: C, loading: w } = k(), { revoke: T, loading: A } = O(), { link: j } = E(), [M] = S(), [N, F] = P(""), [H, U] = P(!1), W = Q(r);
113
+ return h ? /* @__PURE__ */ I("div", { className: "h-32 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }) : /* @__PURE__ */ L("div", {
112
114
  className: "rounded-lg border border-border-subtle bg-bg-sunken/30 p-4 space-y-3",
113
- children: [/* @__PURE__ */ A("div", {
115
+ children: [/* @__PURE__ */ L("div", {
114
116
  className: "flex items-center justify-between",
115
- children: [/* @__PURE__ */ k("span", {
117
+ children: [/* @__PURE__ */ I("span", {
116
118
  className: "text-xs text-text-secondary font-medium uppercase tracking-wide",
117
119
  children: "Connected workspace"
118
- }), /* @__PURE__ */ k(a, {
120
+ }), /* @__PURE__ */ I(a, {
119
121
  permission: i.CHANNEL_DELETE,
120
- children: /* @__PURE__ */ k(o, {
122
+ children: /* @__PURE__ */ I(o, {
121
123
  variant: "ghost",
122
124
  size: "icon",
123
125
  onClick: async () => {
124
- if (confirm(`Remove this ${q.label} channel from the bot?`)) try {
125
- await z(e), c(), W.success(`${q.label} channel removed`), f() && m("success");
126
+ if (confirm(`Remove this ${W.label} channel from the bot?`)) try {
127
+ await M(e), c(), X.success(`${W.label} channel removed`), f() && m("success");
126
128
  } catch (e) {
127
- W.error(e instanceof Error ? e.message : "Failed to remove"), f() && m("error");
129
+ X.error(e instanceof Error ? e.message : "Failed to remove"), f() && m("error");
128
130
  }
129
131
  },
130
132
  className: "h-7 w-7 text-text-secondary hover:text-status-error-text",
131
133
  title: "Remove channel",
132
- children: /* @__PURE__ */ k(V, { size: 13 })
134
+ children: /* @__PURE__ */ I(J, { size: 13 })
133
135
  })
134
136
  })]
135
- }), x ? /* @__PURE__ */ A("div", {
137
+ }), b ? /* @__PURE__ */ L("div", {
136
138
  className: "flex items-center gap-2 py-2 text-text-secondary",
137
- children: [/* @__PURE__ */ k(P, {
139
+ children: [/* @__PURE__ */ I(V, {
138
140
  size: 14,
139
141
  className: "animate-spin"
140
- }), /* @__PURE__ */ A("span", {
142
+ }), /* @__PURE__ */ L("span", {
141
143
  className: "text-xs",
142
144
  children: [
143
145
  "Checking ",
144
- q.label,
146
+ W.label,
145
147
  " connection…"
146
148
  ]
147
149
  })]
148
- }) : y?.dmAllowed ? /* @__PURE__ */ A("div", {
150
+ }) : y?.dmAllowed ? /* @__PURE__ */ L("div", {
149
151
  className: "space-y-2",
150
152
  children: [
151
- /* @__PURE__ */ A("div", {
153
+ /* @__PURE__ */ L("div", {
152
154
  className: "flex items-center gap-3 p-3 rounded-lg bg-bg-surface border border-border-subtle",
153
155
  children: [
154
- /* @__PURE__ */ k(N, {
156
+ /* @__PURE__ */ I(B, {
155
157
  size: 16,
156
158
  className: "text-status-success-text shrink-0"
157
159
  }),
158
- /* @__PURE__ */ A("div", {
160
+ /* @__PURE__ */ L("div", {
159
161
  className: "min-w-0 flex-1",
160
162
  children: [
161
- /* @__PURE__ */ k("p", {
163
+ /* @__PURE__ */ I("p", {
162
164
  className: "font-medium text-sm",
163
165
  children: y.externalDisplayName || y.externalUsername || y.externalUserId
164
166
  }),
165
- y.externalUsername && /* @__PURE__ */ A("p", {
167
+ y.externalUsername && /* @__PURE__ */ L("p", {
166
168
  className: "text-xs text-text-secondary",
167
169
  children: ["@", y.externalUsername]
168
170
  }),
169
- y.connectedAt && /* @__PURE__ */ A("p", {
171
+ y.connectedAt && /* @__PURE__ */ L("p", {
170
172
  className: "text-xs text-text-secondary",
171
173
  children: ["Connected ", new Date(y.connectedAt).toLocaleDateString()]
172
174
  })
173
175
  ]
174
176
  }),
175
- y.isTokenExpired && /* @__PURE__ */ k(s, {
177
+ y.isTokenExpired && /* @__PURE__ */ I(s, {
176
178
  variant: "outline",
177
179
  className: "text-xs text-status-warning-text border-status-warning-border",
178
180
  children: "Token expired"
179
181
  })
180
182
  ]
181
183
  }),
182
- y.integrationConnectionId && /* @__PURE__ */ A("div", {
184
+ y.integrationConnectionId && /* @__PURE__ */ L("div", {
183
185
  className: "space-y-1.5",
184
- children: [/* @__PURE__ */ k("label", {
186
+ children: [/* @__PURE__ */ I("label", {
185
187
  className: "text-xs font-medium text-text-secondary",
186
188
  children: "Integration Connection ID"
187
- }), /* @__PURE__ */ k(l, {
189
+ }), /* @__PURE__ */ I(l, {
188
190
  value: y.integrationConnectionId,
189
191
  readOnly: !0,
190
192
  className: "text-xs font-mono bg-bg-sunken/50 cursor-default",
191
193
  onClick: (e) => {
192
- e.currentTarget.select(), p(y.integrationConnectionId), W.success("Connection ID copied to clipboard"), f() && g("Copied");
194
+ e.currentTarget.select(), p(y.integrationConnectionId), X.success("Connection ID copied to clipboard"), f() && g("Copied");
193
195
  },
194
196
  title: "Click to copy"
195
197
  })]
196
198
  }),
197
- /* @__PURE__ */ A("div", {
199
+ /* @__PURE__ */ L("div", {
198
200
  className: "flex items-center justify-between p-3 border border-border-subtle rounded-lg bg-bg-surface",
199
- children: [/* @__PURE__ */ A("div", {
201
+ children: [/* @__PURE__ */ L("div", {
200
202
  className: "flex items-center gap-2",
201
- children: [y.notificationsEnabled ? /* @__PURE__ */ k(j, {
203
+ children: [y.notificationsEnabled ? /* @__PURE__ */ I(R, {
202
204
  size: 14,
203
205
  className: "text-primary"
204
- }) : /* @__PURE__ */ k(M, {
206
+ }) : /* @__PURE__ */ I(z, {
205
207
  size: 14,
206
208
  className: "text-text-secondary"
207
- }), /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("p", {
209
+ }), /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I("p", {
208
210
  className: "text-sm font-medium",
209
211
  children: "DM Notifications"
210
- }), /* @__PURE__ */ k("p", {
212
+ }), /* @__PURE__ */ I("p", {
211
213
  className: "text-xs text-text-secondary",
212
- children: y.notificationsEnabled ? `Bot will DM you on ${q.label}` : "DM notifications paused"
214
+ children: y.notificationsEnabled ? `Bot will DM you on ${W.label}` : "DM notifications paused"
213
215
  })] })]
214
- }), /* @__PURE__ */ k(o, {
216
+ }), /* @__PURE__ */ I(o, {
215
217
  variant: "outline",
216
218
  size: "sm",
217
- isLoading: F,
219
+ isLoading: w,
218
220
  onClick: async () => {
219
- await O(y.id, !y.notificationsEnabled) && await E();
221
+ await C(y.id, !y.notificationsEnabled) && await x();
220
222
  },
221
223
  children: y.notificationsEnabled ? "Disable" : "Enable"
222
224
  })]
223
225
  }),
224
- /* @__PURE__ */ A("div", {
226
+ /* @__PURE__ */ L("div", {
225
227
  className: "flex gap-2 justify-end pt-1",
226
- children: [y.isTokenExpired && /* @__PURE__ */ k(o, {
228
+ children: [y.isTokenExpired && /* @__PURE__ */ I(o, {
227
229
  variant: "outline",
228
230
  size: "sm",
229
- leftIcon: q.icon,
231
+ leftIcon: W.icon,
230
232
  onClick: u,
231
233
  children: "Reconnect"
232
- }), /* @__PURE__ */ k(o, {
234
+ }), /* @__PURE__ */ I(o, {
233
235
  variant: "destructive",
234
236
  size: "sm",
235
- leftIcon: /* @__PURE__ */ k(H, { size: 13 }),
236
- isLoading: L,
237
+ leftIcon: /* @__PURE__ */ I(ee, { size: 13 }),
238
+ isLoading: A,
237
239
  onClick: async () => {
238
- await I(y.id) && await E();
240
+ await T(y.id) && await x();
239
241
  },
240
242
  children: "Disconnect"
241
243
  })]
242
244
  })
243
245
  ]
244
- }) : /* @__PURE__ */ A("div", {
246
+ }) : /* @__PURE__ */ L("div", {
245
247
  className: "space-y-3 py-2",
246
248
  children: [
247
- /* @__PURE__ */ A("div", {
249
+ /* @__PURE__ */ L("div", {
248
250
  className: "flex items-center gap-2 p-3 rounded-lg bg-bg-surface border border-border-subtle",
249
- children: [/* @__PURE__ */ k("div", {
251
+ children: [/* @__PURE__ */ I("div", {
250
252
  className: "p-2 rounded-full bg-bg-sunken shrink-0",
251
- children: /* @__PURE__ */ k("span", {
253
+ children: /* @__PURE__ */ I("span", {
252
254
  className: "text-text-secondary",
253
- children: q.icon
255
+ children: W.icon
254
256
  })
255
- }), /* @__PURE__ */ A("div", {
257
+ }), /* @__PURE__ */ L("div", {
256
258
  className: "flex-1 min-w-0",
257
- children: [/* @__PURE__ */ k("p", {
259
+ children: [/* @__PURE__ */ I("p", {
258
260
  className: "font-medium text-sm",
259
261
  children: "No personal account connected"
260
- }), /* @__PURE__ */ A("p", {
262
+ }), /* @__PURE__ */ L("p", {
261
263
  className: "text-xs text-text-secondary mt-0.5",
262
264
  children: [
263
265
  "Connect your ",
264
- q.label,
266
+ W.label,
265
267
  " account to receive bot DMs"
266
268
  ]
267
269
  })]
268
270
  })]
269
271
  }),
270
- /* @__PURE__ */ A("div", {
272
+ /* @__PURE__ */ L("div", {
271
273
  className: "p-3 rounded-lg bg-bg-sunken/50 space-y-2",
272
- children: [/* @__PURE__ */ k("p", {
274
+ children: [/* @__PURE__ */ I("p", {
273
275
  className: "text-xs font-medium text-text-secondary",
274
276
  children: "Connect your account:"
275
- }), /* @__PURE__ */ A("ol", {
277
+ }), /* @__PURE__ */ L("ol", {
276
278
  className: "list-decimal list-inside space-y-1 text-xs text-text-secondary",
277
279
  children: [
278
- /* @__PURE__ */ k("li", { children: "Click \"Open Integrations\" below (opens in new tab)" }),
279
- /* @__PURE__ */ A("li", { children: [
280
+ /* @__PURE__ */ I("li", { children: "Click \"Open Integrations\" below (opens in new tab)" }),
281
+ /* @__PURE__ */ L("li", { children: [
280
282
  "Connect your ",
281
- q.label,
283
+ W.label,
282
284
  " account via OAuth"
283
285
  ] }),
284
- /* @__PURE__ */ k("li", { children: "Copy the Connection ID from the integrations page" }),
285
- /* @__PURE__ */ k("li", { children: "Paste it below and click \"Link Connection\"" })
286
+ /* @__PURE__ */ I("li", { children: "Copy the Connection ID from the integrations page" }),
287
+ /* @__PURE__ */ I("li", { children: "Paste it below and click \"Link Connection\"" })
286
288
  ]
287
289
  })]
288
290
  }),
289
- /* @__PURE__ */ k(o, {
291
+ /* @__PURE__ */ I(o, {
290
292
  variant: "outline",
291
293
  size: "sm",
292
- leftIcon: q.icon,
294
+ leftIcon: W.icon,
293
295
  onClick: u,
294
296
  className: "w-full",
295
297
  children: "Open Integrations →"
296
298
  }),
297
- /* @__PURE__ */ A("div", {
299
+ /* @__PURE__ */ L("div", {
298
300
  className: "flex gap-2",
299
- children: [/* @__PURE__ */ k(l, {
301
+ children: [/* @__PURE__ */ I(l, {
300
302
  placeholder: "Paste integration connection ID...",
301
- value: B,
302
- onChange: (e) => U(e.target.value),
303
+ value: N,
304
+ onChange: (e) => F(e.target.value),
303
305
  className: "flex-1 text-sm"
304
- }), /* @__PURE__ */ k(o, {
306
+ }), /* @__PURE__ */ I(o, {
305
307
  size: "sm",
306
308
  onClick: async () => {
307
- if (!B.trim()) W.error("Please enter an integration connection ID");
309
+ if (!N.trim()) X.error("Please enter an integration connection ID");
308
310
  else {
309
- K(!0);
311
+ U(!0);
310
312
  try {
311
- let e = await R(B.trim(), _);
312
- e ? (W.success(`${e.externalDisplayName ?? e.externalUsername ?? "Account"} connected! The bot can now send you direct messages.`), await E(), U("")) : W.error("Failed to link connection. Please verify the ID and try again.");
313
+ let e = await j(N.trim(), _);
314
+ e ? (X.success(`${e.externalDisplayName ?? e.externalUsername ?? "Account"} connected! The bot can now send you direct messages.`), await x(), F("")) : X.error("Failed to link connection. Please verify the ID and try again.");
313
315
  } catch (e) {
314
- W.error(e instanceof Error ? e.message : "Failed to link connection");
316
+ X.error(e instanceof Error ? e.message : "Failed to link connection");
315
317
  } finally {
316
- K(!1);
318
+ U(!1);
317
319
  }
318
320
  }
319
321
  },
320
- isLoading: G,
321
- disabled: !B.trim() || G,
322
+ isLoading: H,
323
+ disabled: !N.trim() || H,
322
324
  children: "Link Connection"
323
325
  })]
324
326
  })
325
327
  ]
326
328
  })]
327
329
  });
328
- }, X = ({ channel: c, routes: l, botId: u, botName: p, onRoutesChanged: m }) => {
329
- let { basePath: g } = d(), [_] = y(), [v, b] = D(!1), x = c.platform, S = J(x), C = q(c.adapterType), w = v, T = E((e) => {
330
- let t = G[x];
330
+ }, $ = ({ channel: c, routes: l, botId: u, botName: p, onRoutesChanged: m }) => {
331
+ let { basePath: g } = d(), [_] = x(), [v] = b(), [y] = w(), S = C(), [T, E] = P(!1), D = c.platform, O = Q(D), k = ne(c.adapterType), j = T, N = M((e) => {
332
+ let t = te[D];
331
333
  if (!t) return;
332
334
  let n = window.location.origin + window.location.pathname + window.location.search, r = `${g ? g.replace(/\/(botmanor|botlit)(\/.*)?$/, "/integrations") : "/integrations"}/connections/add?${new URLSearchParams({
333
335
  providerKey: t,
@@ -335,206 +337,222 @@ var Y = ({ routeId: e, connectorId: t, channelId: n, platform: r, onRemoved: c,
335
337
  channelId: e
336
338
  }).toString()}`;
337
339
  f() && /^https?:\/\//.test(r) ? h(r) : window.open(r, "_blank");
338
- }, [x, g]), O = E(async () => {
339
- b(!0);
340
+ }, [D, g]), F = M(async () => {
341
+ E(!0);
340
342
  try {
343
+ let e = await S(c.id), t = await A(c, e, {
344
+ create: v,
345
+ activate: (e) => y({
346
+ connectorId: e,
347
+ input: { status: "ACTIVE" }
348
+ })
349
+ });
341
350
  await _({
342
- connectorId: c.id,
351
+ connectorId: t.id,
343
352
  appId: u,
344
353
  locationId: "*",
345
354
  metadata: {
346
355
  locationName: "All channels & DMs",
347
356
  appName: p
348
357
  }
349
- }), await m(), T(c.id);
358
+ }), await m(), N(c.id);
350
359
  } catch (e) {
351
- W.error(e instanceof Error ? e.message : `Failed to connect ${S.label}`), b(!1);
360
+ X.error(e instanceof Error ? e.message : `Failed to connect ${O.label}`), E(!1);
352
361
  }
353
362
  }, [
354
363
  u,
355
364
  p,
356
- c.id,
365
+ c,
366
+ S,
367
+ v,
368
+ y,
357
369
  _,
358
- S.label,
359
- T,
370
+ O.label,
371
+ N,
360
372
  m
361
- ]), j = E(() => {
362
- T(c.id);
363
- }, [c.id, T]);
364
- return /* @__PURE__ */ A(e, { children: [/* @__PURE__ */ A(n, {
373
+ ]), R = M(() => {
374
+ N(c.id);
375
+ }, [c.id, N]);
376
+ return /* @__PURE__ */ L(e, { children: [/* @__PURE__ */ L(n, {
365
377
  className: "flex flex-row items-center justify-between pb-3",
366
- children: [/* @__PURE__ */ A("div", {
378
+ children: [/* @__PURE__ */ L("div", {
367
379
  className: "flex items-center gap-2.5",
368
- children: [/* @__PURE__ */ k("div", {
369
- className: `p-1.5 rounded-md ${S.accentBg}`,
370
- children: /* @__PURE__ */ k("span", {
371
- className: S.accentText,
372
- children: S.icon
380
+ children: [/* @__PURE__ */ I("div", {
381
+ className: `p-1.5 rounded-md ${O.accentBg}`,
382
+ children: /* @__PURE__ */ I("span", {
383
+ className: O.accentText,
384
+ children: O.icon
373
385
  })
374
- }), /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k(r, {
386
+ }), /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I(r, {
375
387
  className: "text-base",
376
388
  children: c.name
377
- }), C && /* @__PURE__ */ k("p", {
389
+ }), k && /* @__PURE__ */ I("p", {
378
390
  className: "text-xs text-text-secondary mt-0.5",
379
- children: C
391
+ children: k
380
392
  })] })]
381
- }), /* @__PURE__ */ A("div", {
393
+ }), /* @__PURE__ */ L("div", {
382
394
  className: "flex items-center gap-1.5",
383
- children: [/* @__PURE__ */ k("span", {
384
- className: `px-2 py-0.5 text-xs font-semibold rounded-full ${S.badgeClass}`,
385
- children: S.label
386
- }), l.length > 0 && /* @__PURE__ */ k(s, {
395
+ children: [/* @__PURE__ */ I("span", {
396
+ className: `px-2 py-0.5 text-xs font-semibold rounded-full ${O.badgeClass}`,
397
+ children: O.label
398
+ }), l.length > 0 && /* @__PURE__ */ I(s, {
387
399
  variant: "outline",
388
400
  className: "text-xs text-status-success-text border-status-success-border bg-status-success-bg-subtle",
389
401
  children: "Active"
390
402
  })]
391
403
  })]
392
- }), /* @__PURE__ */ k(t, { children: l.length > 0 ? /* @__PURE__ */ k("div", {
404
+ }), /* @__PURE__ */ I(t, { children: l.length > 0 ? /* @__PURE__ */ I("div", {
393
405
  className: "space-y-3",
394
- children: l.map((e) => /* @__PURE__ */ k(Y, {
406
+ children: l.map((e) => /* @__PURE__ */ I(re, {
395
407
  routeId: e.id,
396
408
  connectorId: e.connectorId,
397
409
  channelId: c.id,
398
- platform: x,
410
+ platform: D,
399
411
  onRemoved: m,
400
- onReconnect: j
412
+ onReconnect: R
401
413
  }, e.id))
402
- }) : /* @__PURE__ */ A("div", {
414
+ }) : /* @__PURE__ */ L("div", {
403
415
  className: "flex flex-col items-center gap-4 py-8 text-center",
404
416
  children: [
405
- /* @__PURE__ */ k("div", {
417
+ /* @__PURE__ */ I("div", {
406
418
  className: "p-4 rounded-full bg-bg-sunken",
407
- children: /* @__PURE__ */ k("span", {
419
+ children: /* @__PURE__ */ I("span", {
408
420
  className: "text-text-secondary",
409
- children: S.icon
421
+ children: O.icon
410
422
  })
411
423
  }),
412
- /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("p", {
424
+ /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I("p", {
413
425
  className: "font-medium text-sm",
414
426
  children: "Not connected to this bot"
415
- }), /* @__PURE__ */ A("p", {
427
+ }), /* @__PURE__ */ L("p", {
416
428
  className: "text-xs text-text-secondary mt-1",
417
429
  children: [
418
430
  "Enable ",
419
- S.label,
431
+ O.label,
420
432
  " for this bot. Users will connect their personal accounts separately."
421
433
  ]
422
434
  })] }),
423
- /* @__PURE__ */ k(a, {
435
+ /* @__PURE__ */ I(a, {
424
436
  permission: i.CHANNEL_CREATE,
425
- children: /* @__PURE__ */ A(o, {
426
- leftIcon: S.icon,
427
- onClick: O,
428
- isLoading: w,
437
+ children: /* @__PURE__ */ L(o, {
438
+ leftIcon: O.icon,
439
+ onClick: F,
440
+ isLoading: j,
429
441
  children: [
430
442
  "Set up ",
431
- S.label,
443
+ O.label,
432
444
  " channel"
433
445
  ]
434
446
  })
435
447
  })
436
448
  ]
437
449
  }) })] });
438
- }, Z = ({ route: e, oauthChannels: t, botId: n, botName: r, onRoutesChanged: i }) => {
450
+ }, ie = ({ route: e, oauthChannels: t, botId: n, botName: r, onRoutesChanged: i }) => {
439
451
  let { data: a } = v(e.connectorId), o = t.find((e) => e.id === a?.credentialsRefId);
440
- return !a || !o || !K.has(o.platform) ? null : /* @__PURE__ */ k(X, {
452
+ return !a || !o || !Z.has(o.platform) ? null : /* @__PURE__ */ I($, {
441
453
  channel: o,
442
454
  routes: [e],
443
455
  botId: n,
444
456
  botName: r,
445
457
  onRoutesChanged: i
446
458
  });
447
- }, Q = ({ botId: n, botName: r }) => {
448
- let { data: s, loading: l, error: d } = x(), { data: f, loading: p, refetch: m } = _(n), [h, g] = D(!1), [v, y] = D(null), b = E(async () => {
449
- await m();
450
- }, [m]), S = s.filter((e) => K.has(e.platform)), C = new Set(f.map((e) => S.find((e) => f.some((e) => e.connectorId))?.platform).filter(Boolean)), w = S.filter((e) => !C.has(e.platform)), T = {
451
- SLACK: /* @__PURE__ */ k(B, { size: 18 }),
452
- TEAMS: /* @__PURE__ */ k(U, { size: 18 }),
453
- DISCORD: /* @__PURE__ */ k(I, { size: 18 })
454
- }, j = {};
455
- S.forEach((e) => {
459
+ }, ae = ({ botId: n, botName: r }) => {
460
+ let { organizationId: s } = d(), l = N(() => ({
461
+ channelType: j.Communication,
462
+ organizationId: s || void 0
463
+ }), [s]), { data: f, loading: p, error: m } = T(l), { data: h, loading: g, refetch: v } = _(n), [b, x] = P(!1), [S, C] = P(null), w = M(async () => {
464
+ await v();
465
+ }, [v]), E = f.filter((e) => Z.has(e.platform)), D = E.filter((e) => e.status === "ACTIVE" && (!s || e.organizationId === s)), { data: O } = y(), k = new Set(h.map((e) => {
466
+ let t = O.find((t) => t.id === e.connectorId);
467
+ return E.find((e) => e.id === t?.credentialsRefId)?.platform;
468
+ }).filter((e) => !!e)), A = D.filter((e) => !k.has(e.platform)), R = {
469
+ SLACK: /* @__PURE__ */ I(q, { size: 18 }),
470
+ TEAMS: /* @__PURE__ */ I(Y, { size: 18 }),
471
+ DISCORD: /* @__PURE__ */ I(U, { size: 18 })
472
+ }, z = {};
473
+ E.forEach((e) => {
456
474
  let t = e.platform;
457
- j[t] = J(t);
475
+ z[t] = Q(t);
458
476
  });
459
- let M = E((e, t) => {
460
- y(e);
477
+ let B = M((e, t) => {
478
+ C(e);
461
479
  }, []);
462
- if (l || p) return /* @__PURE__ */ A("div", {
480
+ if (p || g) return /* @__PURE__ */ L("div", {
463
481
  className: "space-y-4",
464
482
  children: [
465
- /* @__PURE__ */ k("div", { className: "h-10 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg w-52" }),
466
- /* @__PURE__ */ k("div", { className: "h-48 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }),
467
- /* @__PURE__ */ k("div", { className: "h-48 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" })
483
+ /* @__PURE__ */ I("div", { className: "h-10 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg w-52" }),
484
+ /* @__PURE__ */ I("div", { className: "h-48 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" }),
485
+ /* @__PURE__ */ I("div", { className: "h-48 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" })
468
486
  ]
469
487
  });
470
- let N = f.length > 0;
471
- return /* @__PURE__ */ A("div", {
488
+ let V = h.length > 0;
489
+ return /* @__PURE__ */ L("div", {
472
490
  className: "space-y-4",
473
491
  children: [
474
- /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("h3", {
492
+ /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I("h3", {
475
493
  className: "font-semibold text-base",
476
494
  children: "Channel Connections"
477
- }), /* @__PURE__ */ k("p", {
495
+ }), /* @__PURE__ */ I("p", {
478
496
  className: "text-sm text-text-secondary mt-0.5",
479
497
  children: "Communication platforms available for this bot"
480
498
  })] }),
481
- d && /* @__PURE__ */ k("div", {
499
+ m && /* @__PURE__ */ I("div", {
482
500
  className: "flex items-start 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",
483
- children: /* @__PURE__ */ A("span", { children: ["Failed to load channels: ", d.message] })
501
+ children: /* @__PURE__ */ L("span", { children: ["Failed to load channels: ", m.message] })
484
502
  }),
485
- !d && S.length === 0 && /* @__PURE__ */ k(e, { children: /* @__PURE__ */ k(t, {
503
+ !m && E.length === 0 && /* @__PURE__ */ I(e, { children: /* @__PURE__ */ I(t, {
486
504
  className: "py-12",
487
- children: /* @__PURE__ */ k(c, {
505
+ children: /* @__PURE__ */ I(c, {
488
506
  illustration: "empty-notifications",
489
507
  title: "No channels available",
490
508
  description: "No active communication channels have been configured yet. Contact your administrator to set up channels."
491
509
  })
492
510
  }) }),
493
- !d && S.length > 0 && !N && !v && /* @__PURE__ */ k(e, { children: /* @__PURE__ */ k(t, {
511
+ !m && E.length > 0 && !V && !S && /* @__PURE__ */ I(e, { children: /* @__PURE__ */ I(t, {
494
512
  className: "py-12",
495
- children: /* @__PURE__ */ k(c, {
513
+ children: /* @__PURE__ */ I(c, {
496
514
  illustration: "empty-notifications",
497
515
  title: "No channels connected",
498
516
  description: "Connect a communication channel to enable bot conversations on platforms like Slack, Teams, or Discord.",
499
- action: /* @__PURE__ */ k(a, {
517
+ action: /* @__PURE__ */ I(a, {
500
518
  permission: i.CHANNEL_CREATE,
501
- children: /* @__PURE__ */ k(o, {
502
- leftIcon: /* @__PURE__ */ k(R, { size: 16 }),
503
- onClick: () => g(!0),
519
+ children: /* @__PURE__ */ I(o, {
520
+ leftIcon: /* @__PURE__ */ I(G, { size: 16 }),
521
+ onClick: () => x(!0),
504
522
  children: "Connect Channel"
505
523
  })
506
524
  })
507
525
  })
508
526
  }) }),
509
- S.length > 0 && (N || v) && /* @__PURE__ */ A("div", {
527
+ E.length > 0 && (V || S) && /* @__PURE__ */ L("div", {
510
528
  className: "space-y-4",
511
- children: [f.map((e) => /* @__PURE__ */ k(Z, {
529
+ children: [h.map((e) => /* @__PURE__ */ I(ie, {
512
530
  route: e,
513
- oauthChannels: S,
531
+ oauthChannels: E,
514
532
  botId: n,
515
533
  botName: r,
516
- onRoutesChanged: b
517
- }, e.id)), v && /* @__PURE__ */ k(O, { children: S.filter((e) => e.id === v).map((e) => /* @__PURE__ */ k(X, {
534
+ onRoutesChanged: w
535
+ }, e.id)), S && /* @__PURE__ */ I(F, { children: E.filter((e) => e.id === S).map((e) => /* @__PURE__ */ I($, {
518
536
  channel: e,
519
- routes: f.filter((e) => !1),
537
+ routes: h.filter((e) => !1),
520
538
  botId: n,
521
539
  botName: r,
522
540
  onRoutesChanged: async () => {
523
- await b(), y(null);
541
+ await w(), C(null);
524
542
  }
525
543
  }, e.id)) })]
526
544
  }),
527
- /* @__PURE__ */ k(u, {
528
- open: h,
529
- onClose: () => g(!1),
530
- onSelectChannel: M,
531
- availableChannels: w,
532
- platformIcons: T,
533
- platformMeta: j
545
+ /* @__PURE__ */ I(u, {
546
+ open: b,
547
+ onClose: () => x(!1),
548
+ onSelectChannel: B,
549
+ availableChannels: A,
550
+ platformIcons: R,
551
+ platformMeta: z
534
552
  })
535
553
  ]
536
554
  });
537
555
  };
538
- export { Q as BotChannelsTab };
556
+ export { ae as BotChannelsTab };
539
557
 
540
558
  //# sourceMappingURL=BotChannelsTab.js.map