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