@burdenoff/microfe-botmanor 2026.1027.2 → 2026.1028.1

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