@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.
- package/dist/botlit/components/AgentBindingsPanel.d.ts +4 -0
- package/dist/botlit/components/AgentBindingsPanel.js +305 -0
- package/dist/botlit/components/AgentBindingsPanel.js.map +1 -0
- package/dist/botlit/components/ChannelSetupPanels.d.ts +21 -0
- package/dist/botlit/components/ChannelSetupPanels.js +139 -0
- package/dist/botlit/components/ChannelSetupPanels.js.map +1 -0
- package/dist/botlit/hooks/index.d.ts +5 -1
- package/dist/botlit/hooks/index.js +14 -12
- package/dist/botlit/hooks/useAgentBindings.d.ts +58 -0
- package/dist/botlit/hooks/useAgentBindings.js +87 -0
- package/dist/botlit/hooks/useAgentBindings.js.map +1 -0
- package/dist/botlit/hooks/useChannelSetup.d.ts +96 -0
- package/dist/botlit/hooks/useChannelSetup.js +199 -0
- package/dist/botlit/hooks/useChannelSetup.js.map +1 -0
- package/dist/botlit/hooks/useChannels.d.ts +6 -0
- package/dist/botlit/hooks/useChannels.js +80 -58
- package/dist/botlit/hooks/useChannels.js.map +1 -1
- package/dist/botlit/hooks/useUserPlatformConnection.d.ts +1 -0
- package/dist/botlit/hooks/useUserPlatformConnection.js +1 -0
- package/dist/botlit/hooks/useUserPlatformConnection.js.map +1 -1
- package/dist/botlit/pages/AgentDetailPage.js +56 -55
- package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
- package/dist/botlit/pages/BotChannelsTab.js +204 -186
- package/dist/botlit/pages/BotChannelsTab.js.map +1 -1
- package/dist/botlit/pages/ChannelDetailPage.js +658 -526
- package/dist/botlit/pages/ChannelDetailPage.js.map +1 -1
- package/dist/botlit/pages/ChannelsPage.js +2 -1
- package/dist/botlit/pages/ChannelsPage.js.map +1 -1
- package/dist/botlit/pages/PromptStudioPage.js +365 -175
- package/dist/botlit/pages/PromptStudioPage.js.map +1 -1
- package/dist/botlit/providers/BotlitProvider.js +39 -35
- package/dist/botlit/providers/BotlitProvider.js.map +1 -1
- package/dist/botlit/types/index.d.ts +2 -0
- package/dist/botlit/utils/channelConnectors.d.ts +16 -0
- package/dist/botlit/utils/channelConnectors.js +24 -0
- package/dist/botlit/utils/channelConnectors.js.map +1 -0
- package/dist/botlit/utils/promptVariables.d.ts +6 -0
- package/dist/botlit/utils/promptVariables.js +20 -0
- package/dist/botlit/utils/promptVariables.js.map +1 -0
- package/dist/generated/wspace-operations.d.ts +314 -0
- package/dist/generated/wspace-operations.js +189 -101
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +139 -0
- package/dist/generated/wspace-types.js +3 -1
- package/dist/generated/wspace-types.js.map +1 -1
- 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,
|
|
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
|
|
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 {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
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
|
|
22
|
+
var te = {
|
|
21
23
|
SLACK: "slack-user",
|
|
22
24
|
TEAMS: "teams-user",
|
|
23
25
|
DISCORD: "discord-user",
|
|
24
26
|
WHATSAPP: "whatsapp-user"
|
|
25
|
-
},
|
|
27
|
+
}, Z = /* @__PURE__ */ new Set([
|
|
26
28
|
"SLACK",
|
|
27
29
|
"TEAMS",
|
|
28
30
|
"DISCORD"
|
|
29
31
|
]);
|
|
30
|
-
function
|
|
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
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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
|
|
110
|
-
let { data: d, loading: h } = v(t), _ = d?.credentialsRefId ?? n, { data: y, loading:
|
|
111
|
-
return h ? /* @__PURE__ */
|
|
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__ */
|
|
115
|
+
children: [/* @__PURE__ */ L("div", {
|
|
114
116
|
className: "flex items-center justify-between",
|
|
115
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
120
|
+
}), /* @__PURE__ */ I(a, {
|
|
119
121
|
permission: i.CHANNEL_DELETE,
|
|
120
|
-
children: /* @__PURE__ */
|
|
122
|
+
children: /* @__PURE__ */ I(o, {
|
|
121
123
|
variant: "ghost",
|
|
122
124
|
size: "icon",
|
|
123
125
|
onClick: async () => {
|
|
124
|
-
if (confirm(`Remove this ${
|
|
125
|
-
await
|
|
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
|
-
|
|
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__ */
|
|
134
|
+
children: /* @__PURE__ */ I(J, { size: 13 })
|
|
133
135
|
})
|
|
134
136
|
})]
|
|
135
|
-
}),
|
|
137
|
+
}), b ? /* @__PURE__ */ L("div", {
|
|
136
138
|
className: "flex items-center gap-2 py-2 text-text-secondary",
|
|
137
|
-
children: [/* @__PURE__ */
|
|
139
|
+
children: [/* @__PURE__ */ I(V, {
|
|
138
140
|
size: 14,
|
|
139
141
|
className: "animate-spin"
|
|
140
|
-
}), /* @__PURE__ */
|
|
142
|
+
}), /* @__PURE__ */ L("span", {
|
|
141
143
|
className: "text-xs",
|
|
142
144
|
children: [
|
|
143
145
|
"Checking ",
|
|
144
|
-
|
|
146
|
+
W.label,
|
|
145
147
|
" connection…"
|
|
146
148
|
]
|
|
147
149
|
})]
|
|
148
|
-
}) : y?.dmAllowed ? /* @__PURE__ */
|
|
150
|
+
}) : y?.dmAllowed ? /* @__PURE__ */ L("div", {
|
|
149
151
|
className: "space-y-2",
|
|
150
152
|
children: [
|
|
151
|
-
/* @__PURE__ */
|
|
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__ */
|
|
156
|
+
/* @__PURE__ */ I(B, {
|
|
155
157
|
size: 16,
|
|
156
158
|
className: "text-status-success-text shrink-0"
|
|
157
159
|
}),
|
|
158
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ L("div", {
|
|
159
161
|
className: "min-w-0 flex-1",
|
|
160
162
|
children: [
|
|
161
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
184
|
+
y.integrationConnectionId && /* @__PURE__ */ L("div", {
|
|
183
185
|
className: "space-y-1.5",
|
|
184
|
-
children: [/* @__PURE__ */
|
|
186
|
+
children: [/* @__PURE__ */ I("label", {
|
|
185
187
|
className: "text-xs font-medium text-text-secondary",
|
|
186
188
|
children: "Integration Connection ID"
|
|
187
|
-
}), /* @__PURE__ */
|
|
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),
|
|
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__ */
|
|
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__ */
|
|
201
|
+
children: [/* @__PURE__ */ L("div", {
|
|
200
202
|
className: "flex items-center gap-2",
|
|
201
|
-
children: [y.notificationsEnabled ? /* @__PURE__ */
|
|
203
|
+
children: [y.notificationsEnabled ? /* @__PURE__ */ I(R, {
|
|
202
204
|
size: 14,
|
|
203
205
|
className: "text-primary"
|
|
204
|
-
}) : /* @__PURE__ */
|
|
206
|
+
}) : /* @__PURE__ */ I(z, {
|
|
205
207
|
size: 14,
|
|
206
208
|
className: "text-text-secondary"
|
|
207
|
-
}), /* @__PURE__ */
|
|
209
|
+
}), /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I("p", {
|
|
208
210
|
className: "text-sm font-medium",
|
|
209
211
|
children: "DM Notifications"
|
|
210
|
-
}), /* @__PURE__ */
|
|
212
|
+
}), /* @__PURE__ */ I("p", {
|
|
211
213
|
className: "text-xs text-text-secondary",
|
|
212
|
-
children: y.notificationsEnabled ? `Bot will DM you on ${
|
|
214
|
+
children: y.notificationsEnabled ? `Bot will DM you on ${W.label}` : "DM notifications paused"
|
|
213
215
|
})] })]
|
|
214
|
-
}), /* @__PURE__ */
|
|
216
|
+
}), /* @__PURE__ */ I(o, {
|
|
215
217
|
variant: "outline",
|
|
216
218
|
size: "sm",
|
|
217
|
-
isLoading:
|
|
219
|
+
isLoading: w,
|
|
218
220
|
onClick: async () => {
|
|
219
|
-
await
|
|
221
|
+
await C(y.id, !y.notificationsEnabled) && await x();
|
|
220
222
|
},
|
|
221
223
|
children: y.notificationsEnabled ? "Disable" : "Enable"
|
|
222
224
|
})]
|
|
223
225
|
}),
|
|
224
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ L("div", {
|
|
225
227
|
className: "flex gap-2 justify-end pt-1",
|
|
226
|
-
children: [y.isTokenExpired && /* @__PURE__ */
|
|
228
|
+
children: [y.isTokenExpired && /* @__PURE__ */ I(o, {
|
|
227
229
|
variant: "outline",
|
|
228
230
|
size: "sm",
|
|
229
|
-
leftIcon:
|
|
231
|
+
leftIcon: W.icon,
|
|
230
232
|
onClick: u,
|
|
231
233
|
children: "Reconnect"
|
|
232
|
-
}), /* @__PURE__ */
|
|
234
|
+
}), /* @__PURE__ */ I(o, {
|
|
233
235
|
variant: "destructive",
|
|
234
236
|
size: "sm",
|
|
235
|
-
leftIcon: /* @__PURE__ */
|
|
236
|
-
isLoading:
|
|
237
|
+
leftIcon: /* @__PURE__ */ I(ee, { size: 13 }),
|
|
238
|
+
isLoading: A,
|
|
237
239
|
onClick: async () => {
|
|
238
|
-
await
|
|
240
|
+
await T(y.id) && await x();
|
|
239
241
|
},
|
|
240
242
|
children: "Disconnect"
|
|
241
243
|
})]
|
|
242
244
|
})
|
|
243
245
|
]
|
|
244
|
-
}) : /* @__PURE__ */
|
|
246
|
+
}) : /* @__PURE__ */ L("div", {
|
|
245
247
|
className: "space-y-3 py-2",
|
|
246
248
|
children: [
|
|
247
|
-
/* @__PURE__ */
|
|
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__ */
|
|
251
|
+
children: [/* @__PURE__ */ I("div", {
|
|
250
252
|
className: "p-2 rounded-full bg-bg-sunken shrink-0",
|
|
251
|
-
children: /* @__PURE__ */
|
|
253
|
+
children: /* @__PURE__ */ I("span", {
|
|
252
254
|
className: "text-text-secondary",
|
|
253
|
-
children:
|
|
255
|
+
children: W.icon
|
|
254
256
|
})
|
|
255
|
-
}), /* @__PURE__ */
|
|
257
|
+
}), /* @__PURE__ */ L("div", {
|
|
256
258
|
className: "flex-1 min-w-0",
|
|
257
|
-
children: [/* @__PURE__ */
|
|
259
|
+
children: [/* @__PURE__ */ I("p", {
|
|
258
260
|
className: "font-medium text-sm",
|
|
259
261
|
children: "No personal account connected"
|
|
260
|
-
}), /* @__PURE__ */
|
|
262
|
+
}), /* @__PURE__ */ L("p", {
|
|
261
263
|
className: "text-xs text-text-secondary mt-0.5",
|
|
262
264
|
children: [
|
|
263
265
|
"Connect your ",
|
|
264
|
-
|
|
266
|
+
W.label,
|
|
265
267
|
" account to receive bot DMs"
|
|
266
268
|
]
|
|
267
269
|
})]
|
|
268
270
|
})]
|
|
269
271
|
}),
|
|
270
|
-
/* @__PURE__ */
|
|
272
|
+
/* @__PURE__ */ L("div", {
|
|
271
273
|
className: "p-3 rounded-lg bg-bg-sunken/50 space-y-2",
|
|
272
|
-
children: [/* @__PURE__ */
|
|
274
|
+
children: [/* @__PURE__ */ I("p", {
|
|
273
275
|
className: "text-xs font-medium text-text-secondary",
|
|
274
276
|
children: "Connect your account:"
|
|
275
|
-
}), /* @__PURE__ */
|
|
277
|
+
}), /* @__PURE__ */ L("ol", {
|
|
276
278
|
className: "list-decimal list-inside space-y-1 text-xs text-text-secondary",
|
|
277
279
|
children: [
|
|
278
|
-
/* @__PURE__ */
|
|
279
|
-
/* @__PURE__ */
|
|
280
|
+
/* @__PURE__ */ I("li", { children: "Click \"Open Integrations\" below (opens in new tab)" }),
|
|
281
|
+
/* @__PURE__ */ L("li", { children: [
|
|
280
282
|
"Connect your ",
|
|
281
|
-
|
|
283
|
+
W.label,
|
|
282
284
|
" account via OAuth"
|
|
283
285
|
] }),
|
|
284
|
-
/* @__PURE__ */
|
|
285
|
-
/* @__PURE__ */
|
|
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__ */
|
|
291
|
+
/* @__PURE__ */ I(o, {
|
|
290
292
|
variant: "outline",
|
|
291
293
|
size: "sm",
|
|
292
|
-
leftIcon:
|
|
294
|
+
leftIcon: W.icon,
|
|
293
295
|
onClick: u,
|
|
294
296
|
className: "w-full",
|
|
295
297
|
children: "Open Integrations →"
|
|
296
298
|
}),
|
|
297
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ L("div", {
|
|
298
300
|
className: "flex gap-2",
|
|
299
|
-
children: [/* @__PURE__ */
|
|
301
|
+
children: [/* @__PURE__ */ I(l, {
|
|
300
302
|
placeholder: "Paste integration connection ID...",
|
|
301
|
-
value:
|
|
302
|
-
onChange: (e) =>
|
|
303
|
+
value: N,
|
|
304
|
+
onChange: (e) => F(e.target.value),
|
|
303
305
|
className: "flex-1 text-sm"
|
|
304
|
-
}), /* @__PURE__ */
|
|
306
|
+
}), /* @__PURE__ */ I(o, {
|
|
305
307
|
size: "sm",
|
|
306
308
|
onClick: async () => {
|
|
307
|
-
if (!
|
|
309
|
+
if (!N.trim()) X.error("Please enter an integration connection ID");
|
|
308
310
|
else {
|
|
309
|
-
|
|
311
|
+
U(!0);
|
|
310
312
|
try {
|
|
311
|
-
let e = await
|
|
312
|
-
e ? (
|
|
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
|
-
|
|
316
|
+
X.error(e instanceof Error ? e.message : "Failed to link connection");
|
|
315
317
|
} finally {
|
|
316
|
-
|
|
318
|
+
U(!1);
|
|
317
319
|
}
|
|
318
320
|
}
|
|
319
321
|
},
|
|
320
|
-
isLoading:
|
|
321
|
-
disabled: !
|
|
322
|
+
isLoading: H,
|
|
323
|
+
disabled: !N.trim() || H,
|
|
322
324
|
children: "Link Connection"
|
|
323
325
|
})]
|
|
324
326
|
})
|
|
325
327
|
]
|
|
326
328
|
})]
|
|
327
329
|
});
|
|
328
|
-
},
|
|
329
|
-
let { basePath: g } = d(), [_] =
|
|
330
|
-
let t =
|
|
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
|
-
}, [
|
|
339
|
-
|
|
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:
|
|
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(),
|
|
358
|
+
}), await m(), N(c.id);
|
|
350
359
|
} catch (e) {
|
|
351
|
-
|
|
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
|
|
365
|
+
c,
|
|
366
|
+
S,
|
|
367
|
+
v,
|
|
368
|
+
y,
|
|
357
369
|
_,
|
|
358
|
-
|
|
359
|
-
|
|
370
|
+
O.label,
|
|
371
|
+
N,
|
|
360
372
|
m
|
|
361
|
-
]),
|
|
362
|
-
|
|
363
|
-
}, [c.id,
|
|
364
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
378
|
+
children: [/* @__PURE__ */ L("div", {
|
|
367
379
|
className: "flex items-center gap-2.5",
|
|
368
|
-
children: [/* @__PURE__ */
|
|
369
|
-
className: `p-1.5 rounded-md ${
|
|
370
|
-
children: /* @__PURE__ */
|
|
371
|
-
className:
|
|
372
|
-
children:
|
|
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__ */
|
|
386
|
+
}), /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I(r, {
|
|
375
387
|
className: "text-base",
|
|
376
388
|
children: c.name
|
|
377
|
-
}),
|
|
389
|
+
}), k && /* @__PURE__ */ I("p", {
|
|
378
390
|
className: "text-xs text-text-secondary mt-0.5",
|
|
379
|
-
children:
|
|
391
|
+
children: k
|
|
380
392
|
})] })]
|
|
381
|
-
}), /* @__PURE__ */
|
|
393
|
+
}), /* @__PURE__ */ L("div", {
|
|
382
394
|
className: "flex items-center gap-1.5",
|
|
383
|
-
children: [/* @__PURE__ */
|
|
384
|
-
className: `px-2 py-0.5 text-xs font-semibold rounded-full ${
|
|
385
|
-
children:
|
|
386
|
-
}), l.length > 0 && /* @__PURE__ */
|
|
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__ */
|
|
404
|
+
}), /* @__PURE__ */ I(t, { children: l.length > 0 ? /* @__PURE__ */ I("div", {
|
|
393
405
|
className: "space-y-3",
|
|
394
|
-
children: l.map((e) => /* @__PURE__ */
|
|
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:
|
|
410
|
+
platform: D,
|
|
399
411
|
onRemoved: m,
|
|
400
|
-
onReconnect:
|
|
412
|
+
onReconnect: R
|
|
401
413
|
}, e.id))
|
|
402
|
-
}) : /* @__PURE__ */
|
|
414
|
+
}) : /* @__PURE__ */ L("div", {
|
|
403
415
|
className: "flex flex-col items-center gap-4 py-8 text-center",
|
|
404
416
|
children: [
|
|
405
|
-
/* @__PURE__ */
|
|
417
|
+
/* @__PURE__ */ I("div", {
|
|
406
418
|
className: "p-4 rounded-full bg-bg-sunken",
|
|
407
|
-
children: /* @__PURE__ */
|
|
419
|
+
children: /* @__PURE__ */ I("span", {
|
|
408
420
|
className: "text-text-secondary",
|
|
409
|
-
children:
|
|
421
|
+
children: O.icon
|
|
410
422
|
})
|
|
411
423
|
}),
|
|
412
|
-
/* @__PURE__ */
|
|
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__ */
|
|
427
|
+
}), /* @__PURE__ */ L("p", {
|
|
416
428
|
className: "text-xs text-text-secondary mt-1",
|
|
417
429
|
children: [
|
|
418
430
|
"Enable ",
|
|
419
|
-
|
|
431
|
+
O.label,
|
|
420
432
|
" for this bot. Users will connect their personal accounts separately."
|
|
421
433
|
]
|
|
422
434
|
})] }),
|
|
423
|
-
/* @__PURE__ */
|
|
435
|
+
/* @__PURE__ */ I(a, {
|
|
424
436
|
permission: i.CHANNEL_CREATE,
|
|
425
|
-
children: /* @__PURE__ */
|
|
426
|
-
leftIcon:
|
|
427
|
-
onClick:
|
|
428
|
-
isLoading:
|
|
437
|
+
children: /* @__PURE__ */ L(o, {
|
|
438
|
+
leftIcon: O.icon,
|
|
439
|
+
onClick: F,
|
|
440
|
+
isLoading: j,
|
|
429
441
|
children: [
|
|
430
442
|
"Set up ",
|
|
431
|
-
|
|
443
|
+
O.label,
|
|
432
444
|
" channel"
|
|
433
445
|
]
|
|
434
446
|
})
|
|
435
447
|
})
|
|
436
448
|
]
|
|
437
449
|
}) })] });
|
|
438
|
-
},
|
|
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 || !
|
|
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
|
-
},
|
|
448
|
-
let {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
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
|
-
|
|
475
|
+
z[t] = Q(t);
|
|
458
476
|
});
|
|
459
|
-
let
|
|
460
|
-
|
|
477
|
+
let B = M((e, t) => {
|
|
478
|
+
C(e);
|
|
461
479
|
}, []);
|
|
462
|
-
if (
|
|
480
|
+
if (p || g) return /* @__PURE__ */ L("div", {
|
|
463
481
|
className: "space-y-4",
|
|
464
482
|
children: [
|
|
465
|
-
/* @__PURE__ */
|
|
466
|
-
/* @__PURE__ */
|
|
467
|
-
/* @__PURE__ */
|
|
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
|
|
471
|
-
return /* @__PURE__ */
|
|
488
|
+
let V = h.length > 0;
|
|
489
|
+
return /* @__PURE__ */ L("div", {
|
|
472
490
|
className: "space-y-4",
|
|
473
491
|
children: [
|
|
474
|
-
/* @__PURE__ */
|
|
492
|
+
/* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I("h3", {
|
|
475
493
|
className: "font-semibold text-base",
|
|
476
494
|
children: "Channel Connections"
|
|
477
|
-
}), /* @__PURE__ */
|
|
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
|
-
|
|
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__ */
|
|
501
|
+
children: /* @__PURE__ */ L("span", { children: ["Failed to load channels: ", m.message] })
|
|
484
502
|
}),
|
|
485
|
-
!
|
|
503
|
+
!m && E.length === 0 && /* @__PURE__ */ I(e, { children: /* @__PURE__ */ I(t, {
|
|
486
504
|
className: "py-12",
|
|
487
|
-
children: /* @__PURE__ */
|
|
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
|
-
!
|
|
511
|
+
!m && E.length > 0 && !V && !S && /* @__PURE__ */ I(e, { children: /* @__PURE__ */ I(t, {
|
|
494
512
|
className: "py-12",
|
|
495
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
517
|
+
action: /* @__PURE__ */ I(a, {
|
|
500
518
|
permission: i.CHANNEL_CREATE,
|
|
501
|
-
children: /* @__PURE__ */
|
|
502
|
-
leftIcon: /* @__PURE__ */
|
|
503
|
-
onClick: () =>
|
|
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
|
-
|
|
527
|
+
E.length > 0 && (V || S) && /* @__PURE__ */ L("div", {
|
|
510
528
|
className: "space-y-4",
|
|
511
|
-
children: [
|
|
529
|
+
children: [h.map((e) => /* @__PURE__ */ I(ie, {
|
|
512
530
|
route: e,
|
|
513
|
-
oauthChannels:
|
|
531
|
+
oauthChannels: E,
|
|
514
532
|
botId: n,
|
|
515
533
|
botName: r,
|
|
516
|
-
onRoutesChanged:
|
|
517
|
-
}, e.id)),
|
|
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:
|
|
537
|
+
routes: h.filter((e) => !1),
|
|
520
538
|
botId: n,
|
|
521
539
|
botName: r,
|
|
522
540
|
onRoutesChanged: async () => {
|
|
523
|
-
await
|
|
541
|
+
await w(), C(null);
|
|
524
542
|
}
|
|
525
543
|
}, e.id)) })]
|
|
526
544
|
}),
|
|
527
|
-
/* @__PURE__ */
|
|
528
|
-
open:
|
|
529
|
-
onClose: () =>
|
|
530
|
-
onSelectChannel:
|
|
531
|
-
availableChannels:
|
|
532
|
-
platformIcons:
|
|
533
|
-
platformMeta:
|
|
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 {
|
|
556
|
+
export { ae as BotChannelsTab };
|
|
539
557
|
|
|
540
558
|
//# sourceMappingURL=BotChannelsTab.js.map
|