@activecollab/components 2.0.593 → 2.0.594
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/cjs/presentation/appsAndIntegrations/McpIntegration.js +848 -0
- package/dist/cjs/presentation/appsAndIntegrations/McpIntegration.js.map +1 -0
- package/dist/cjs/presentation/appsAndIntegrations/mcpData.js +149 -0
- package/dist/cjs/presentation/appsAndIntegrations/mcpData.js.map +1 -0
- package/dist/cjs/presentation/shared/CopySnippet.js +56 -0
- package/dist/cjs/presentation/shared/CopySnippet.js.map +1 -0
- package/dist/cjs/presentation/shared/LinkingCommandsButton.js +21 -62
- package/dist/cjs/presentation/shared/LinkingCommandsButton.js.map +1 -1
- package/dist/cjs/presentation/shared/index.js +8 -0
- package/dist/cjs/presentation/shared/index.js.map +1 -1
- package/dist/esm/presentation/appsAndIntegrations/McpIntegration.d.ts +18 -0
- package/dist/esm/presentation/appsAndIntegrations/McpIntegration.d.ts.map +1 -0
- package/dist/esm/presentation/appsAndIntegrations/McpIntegration.js +735 -0
- package/dist/esm/presentation/appsAndIntegrations/McpIntegration.js.map +1 -0
- package/dist/esm/presentation/appsAndIntegrations/mcpData.d.ts +53 -0
- package/dist/esm/presentation/appsAndIntegrations/mcpData.d.ts.map +1 -0
- package/dist/esm/presentation/appsAndIntegrations/mcpData.js +143 -0
- package/dist/esm/presentation/appsAndIntegrations/mcpData.js.map +1 -0
- package/dist/esm/presentation/shared/CopySnippet.d.ts +7 -0
- package/dist/esm/presentation/shared/CopySnippet.d.ts.map +1 -0
- package/dist/esm/presentation/shared/CopySnippet.js +40 -0
- package/dist/esm/presentation/shared/CopySnippet.js.map +1 -0
- package/dist/esm/presentation/shared/LinkingCommandsButton.d.ts.map +1 -1
- package/dist/esm/presentation/shared/LinkingCommandsButton.js +19 -57
- package/dist/esm/presentation/shared/LinkingCommandsButton.js.map +1 -1
- package/dist/esm/presentation/shared/index.d.ts +2 -0
- package/dist/esm/presentation/shared/index.d.ts.map +1 -1
- package/dist/esm/presentation/shared/index.js +1 -0
- package/dist/esm/presentation/shared/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,735 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["tokens", "onAddNew", "onDisconnectAll"];
|
|
4
|
+
import React, { useMemo, useState } from "react";
|
|
5
|
+
import styled from "styled-components";
|
|
6
|
+
import { MCP_EXAMPLES, MCP_PRO_TIPS, MCP_TOKEN_DETAILS } from "./mcpData";
|
|
7
|
+
import { Accordion, AccordionItem, AccordionItemBody, AccordionItemHead } from "../../components/Accordion";
|
|
8
|
+
import { Button } from "../../components/Button";
|
|
9
|
+
import { Checkbox } from "../../components/Checkbox";
|
|
10
|
+
import { Chip } from "../../components/Chip";
|
|
11
|
+
import { ChooseV2 } from "../../components/ChooseV2";
|
|
12
|
+
import { ConfirmDialog } from "../../components/ConfirmDialog";
|
|
13
|
+
import { Dialog } from "../../components/Dialog";
|
|
14
|
+
import { Dot } from "../../components/Dot";
|
|
15
|
+
import { IconButton } from "../../components/IconButton";
|
|
16
|
+
import { CopyIcon, HelpIcon, InfoIcon, MoveIcon, TrashIcon } from "../../components/Icons";
|
|
17
|
+
import { Input, InputPassword } from "../../components/Input";
|
|
18
|
+
import { Label } from "../../components/Label";
|
|
19
|
+
import { Link } from "../../components/Links";
|
|
20
|
+
import { Select } from "../../components/Select";
|
|
21
|
+
import { SelectTrigger } from "../../components/SelectTrigger";
|
|
22
|
+
import { Tooltip } from "../../components/Tooltip";
|
|
23
|
+
import { Trigger } from "../../components/Trigger";
|
|
24
|
+
import { Body2, Caption1, Header3 } from "../../components/Typography";
|
|
25
|
+
import { CopySnippet, LG, MONO } from "../shared";
|
|
26
|
+
|
|
27
|
+
/* ------------------------------------------------------------------ */
|
|
28
|
+
/* Render-time helpers (mirror groupMcpTokens.js, useMcpDateFormatters) */
|
|
29
|
+
/* ------------------------------------------------------------------ */
|
|
30
|
+
|
|
31
|
+
const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
32
|
+
/** The year the mock-up treats as "this year" (formatDateSmart drops it). */
|
|
33
|
+
const CURRENT_YEAR = 2026;
|
|
34
|
+
const formatDate = ts => {
|
|
35
|
+
if (!ts) return "";
|
|
36
|
+
const d = new Date(ts * 1000);
|
|
37
|
+
const day = MONTHS[d.getUTCMonth()] + " " + d.getUTCDate() + ".";
|
|
38
|
+
return d.getUTCFullYear() === CURRENT_YEAR ? day : day + " " + d.getUTCFullYear();
|
|
39
|
+
};
|
|
40
|
+
const formatDateWithTime = ts => {
|
|
41
|
+
if (!ts) return "";
|
|
42
|
+
const d = new Date(ts * 1000);
|
|
43
|
+
const hh = String(d.getUTCHours()).padStart(2, "0");
|
|
44
|
+
const mm = String(d.getUTCMinutes()).padStart(2, "0");
|
|
45
|
+
return MONTHS[d.getUTCMonth()] + " " + d.getUTCDate() + ". " + d.getUTCFullYear() + " " + hh + ":" + mm;
|
|
46
|
+
};
|
|
47
|
+
const displayNameOf = item => item.client_display_name || item.client_id_hostname || "";
|
|
48
|
+
const grantsByClient = rows => rows.reduce((map, item) => {
|
|
49
|
+
if (item.is_oauth && item.client_id) {
|
|
50
|
+
map.set(item.client_id, [...(map.get(item.client_id) || []), item]);
|
|
51
|
+
}
|
|
52
|
+
return map;
|
|
53
|
+
}, new Map());
|
|
54
|
+
const groupRows = rows => {
|
|
55
|
+
const grants = grantsByClient(rows);
|
|
56
|
+
const placed = new Set();
|
|
57
|
+
return rows.flatMap(item => {
|
|
58
|
+
if (!item.is_oauth) {
|
|
59
|
+
return [{
|
|
60
|
+
kind: "token",
|
|
61
|
+
key: "token-" + item.id,
|
|
62
|
+
item
|
|
63
|
+
}];
|
|
64
|
+
}
|
|
65
|
+
const connections = grants.get(item.client_id || "") || [];
|
|
66
|
+
if (connections.length < 2) {
|
|
67
|
+
return [{
|
|
68
|
+
kind: "grant",
|
|
69
|
+
key: "grant-" + item.id,
|
|
70
|
+
item
|
|
71
|
+
}];
|
|
72
|
+
}
|
|
73
|
+
if (placed.has(item.client_id || "")) return [];
|
|
74
|
+
placed.add(item.client_id || "");
|
|
75
|
+
return [{
|
|
76
|
+
kind: "group",
|
|
77
|
+
key: "group-" + item.client_id,
|
|
78
|
+
items: connections
|
|
79
|
+
}];
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/** Mirrors OauthClientLabel.jsx: bold name, hostname in parentheses. */
|
|
84
|
+
const ClientLabel = _ref => {
|
|
85
|
+
let item = _ref.item;
|
|
86
|
+
const name = item.client_display_name;
|
|
87
|
+
const host = item.client_id_hostname;
|
|
88
|
+
if (name && host && name !== host) {
|
|
89
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("b", null, /*#__PURE__*/React.createElement("bdi", null, name)), " ", "(", /*#__PURE__*/React.createElement("bdi", null, host), ")");
|
|
90
|
+
}
|
|
91
|
+
return /*#__PURE__*/React.createElement("b", null, /*#__PURE__*/React.createElement("bdi", null, name || host));
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/* ------------------------------------------------------------------ */
|
|
95
|
+
/* Tokens table (mirrors McpTokensList / McpTokenItem / group) */
|
|
96
|
+
/* ------------------------------------------------------------------ */
|
|
97
|
+
|
|
98
|
+
const StyledTable = styled.div.withConfig({
|
|
99
|
+
displayName: "McpIntegration__StyledTable",
|
|
100
|
+
componentId: "sc-x8hck0-0"
|
|
101
|
+
})(["border:1px solid var(--color-theme-400);border-radius:8px;.mt-scroll{overflow-x:auto;}.mt-inner{min-width:974px;}.mt-row{box-sizing:border-box;display:flex;align-items:center;gap:24px;min-height:48px;padding:0 16px 0 20px;}.mt-row.grouped .col-client{padding-left:20px;}.mt-head{background-color:var(--color-theme-200);border-radius:8px 8px 0 0;}.mt-bordered{border-top:1px solid var(--color-theme-400);}.col-client{box-sizing:border-box;display:flex;flex:1;flex-direction:column;justify-content:center;min-width:250px;width:100%;overflow:hidden;padding:4px 0;}.col-date{width:100px;flex-shrink:0;}.col-token{display:flex;align-items:center;width:140px;flex-shrink:0;overflow:hidden;user-select:none;}.col-token .c-dot{margin:2px 0 0 4px;flex-shrink:0;}.col-icon{width:32px;flex-shrink:0;}.col-access{width:140px;flex-shrink:0;}.col-access .access-trigger{box-sizing:border-box;width:100%;padding:0;}.identity-line{display:flex;align-items:center;gap:8px;overflow:hidden;}.hostname{word-break:break-all;font-family:", ";}.expired-line{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;}.group-head{box-sizing:border-box;display:flex;align-items:center;gap:16px;min-height:48px;padding:4px 16px 4px 20px;}.group-head .identity{display:flex;flex:1;flex-direction:column;justify-content:center;min-width:0;overflow:hidden;}.add-trigger{width:100%;}.add-row{box-sizing:border-box;display:flex;align-items:center;min-height:48px;padding:12px 16px 12px 20px;}"], MONO);
|
|
102
|
+
const StatusChip = _ref2 => {
|
|
103
|
+
let label = _ref2.label;
|
|
104
|
+
return /*#__PURE__*/React.createElement(Chip, {
|
|
105
|
+
label: label,
|
|
106
|
+
backgroundColor: "var(--color-theme-300)",
|
|
107
|
+
typographyProps: {
|
|
108
|
+
variant: "Caption 1",
|
|
109
|
+
weight: "medium",
|
|
110
|
+
color: "secondary",
|
|
111
|
+
align: "center"
|
|
112
|
+
},
|
|
113
|
+
style: {
|
|
114
|
+
borderRadius: 6,
|
|
115
|
+
flexShrink: 0
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
const ClientIdentity = _ref3 => {
|
|
120
|
+
let item = _ref3.item,
|
|
121
|
+
connectionCount = _ref3.connectionCount;
|
|
122
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
123
|
+
className: "identity-line"
|
|
124
|
+
}, /*#__PURE__*/React.createElement(Body2, {
|
|
125
|
+
overflow: "truncate",
|
|
126
|
+
whitespace: "no-wrap"
|
|
127
|
+
}, /*#__PURE__*/React.createElement("bdi", null, displayNameOf(item))), item.is_oauth ? /*#__PURE__*/React.createElement(StatusChip, {
|
|
128
|
+
label: "OAuth"
|
|
129
|
+
}) : null, connectionCount ? /*#__PURE__*/React.createElement(Caption1, {
|
|
130
|
+
color: "tertiary",
|
|
131
|
+
style: {
|
|
132
|
+
flexShrink: 0
|
|
133
|
+
}
|
|
134
|
+
}, connectionCount, " connections") : null), item.client_id_hostname ? /*#__PURE__*/React.createElement(Caption1, {
|
|
135
|
+
color: "tertiary",
|
|
136
|
+
className: "hostname"
|
|
137
|
+
}, /*#__PURE__*/React.createElement("bdi", null, item.client_id_hostname)) : null);
|
|
138
|
+
};
|
|
139
|
+
const ConnectionDetails = _ref4 => {
|
|
140
|
+
let item = _ref4.item,
|
|
141
|
+
grouped = _ref4.grouped;
|
|
142
|
+
const connectedOn = item.granted_on ? "Connected on " + formatDate(item.granted_on) : "";
|
|
143
|
+
const label = item.client_label || connectedOn;
|
|
144
|
+
const showConnectedOn = grouped && Boolean(item.client_label) && Boolean(connectedOn);
|
|
145
|
+
const LabelTypography = grouped ? Body2 : Caption1;
|
|
146
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, label ? /*#__PURE__*/React.createElement(LabelTypography, {
|
|
147
|
+
color: grouped ? undefined : "tertiary",
|
|
148
|
+
overflow: "truncate",
|
|
149
|
+
whitespace: "no-wrap"
|
|
150
|
+
}, /*#__PURE__*/React.createElement("bdi", null, label)) : null, showConnectedOn ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
151
|
+
title: formatDateWithTime(item.granted_on)
|
|
152
|
+
}, /*#__PURE__*/React.createElement(Caption1, {
|
|
153
|
+
color: "tertiary",
|
|
154
|
+
overflow: "truncate",
|
|
155
|
+
whitespace: "no-wrap"
|
|
156
|
+
}, connectedOn)) : null, item.is_expired ? /*#__PURE__*/React.createElement("div", {
|
|
157
|
+
className: "expired-line"
|
|
158
|
+
}, /*#__PURE__*/React.createElement(StatusChip, {
|
|
159
|
+
label: "Expired"
|
|
160
|
+
}), /*#__PURE__*/React.createElement(Caption1, {
|
|
161
|
+
color: "tertiary"
|
|
162
|
+
}, "Connect the agent again to use it")) : null);
|
|
163
|
+
};
|
|
164
|
+
const ACCESS_OPTIONS = [{
|
|
165
|
+
id: "read",
|
|
166
|
+
name: "Read Only"
|
|
167
|
+
}, {
|
|
168
|
+
id: "write",
|
|
169
|
+
name: "Read and Write"
|
|
170
|
+
}];
|
|
171
|
+
|
|
172
|
+
/** Mirrors TokenAccessControl.jsx for a token that holds only MCP access. */
|
|
173
|
+
const AccessControl = _ref5 => {
|
|
174
|
+
var _ACCESS_OPTIONS$find;
|
|
175
|
+
let item = _ref5.item,
|
|
176
|
+
onChange = _ref5.onChange;
|
|
177
|
+
const selected = item.is_read_write ? "write" : "read";
|
|
178
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
179
|
+
options: ACCESS_OPTIONS,
|
|
180
|
+
selected: selected,
|
|
181
|
+
onChange: value => onChange(value === "write"),
|
|
182
|
+
keepSameOptionsOrder: true,
|
|
183
|
+
disableSearch: true,
|
|
184
|
+
forceCloseMenu: true,
|
|
185
|
+
disableVirtualization: true,
|
|
186
|
+
target: /*#__PURE__*/React.createElement(SelectTrigger, {
|
|
187
|
+
mode: "flat",
|
|
188
|
+
className: "access-trigger"
|
|
189
|
+
}, (_ACCESS_OPTIONS$find = ACCESS_OPTIONS.find(option => option.id === selected)) == null ? void 0 : _ACCESS_OPTIONS$find.name)
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
const TokenItem = _ref6 => {
|
|
193
|
+
let item = _ref6.item,
|
|
194
|
+
grouped = _ref6.grouped,
|
|
195
|
+
onDelete = _ref6.onDelete,
|
|
196
|
+
onUseToken = _ref6.onUseToken,
|
|
197
|
+
onAccessChange = _ref6.onAccessChange;
|
|
198
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
199
|
+
className: "mt-bordered"
|
|
200
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
201
|
+
className: grouped ? "mt-row grouped" : "mt-row"
|
|
202
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
203
|
+
className: "col-client"
|
|
204
|
+
}, grouped ? null : /*#__PURE__*/React.createElement(ClientIdentity, {
|
|
205
|
+
item: item
|
|
206
|
+
}), item.is_oauth ? /*#__PURE__*/React.createElement(ConnectionDetails, {
|
|
207
|
+
item: item,
|
|
208
|
+
grouped: grouped
|
|
209
|
+
}) : null), /*#__PURE__*/React.createElement(Tooltip, {
|
|
210
|
+
title: formatDateWithTime(item.last_used_on)
|
|
211
|
+
}, /*#__PURE__*/React.createElement(Body2, {
|
|
212
|
+
color: "tertiary",
|
|
213
|
+
className: "col-date"
|
|
214
|
+
}, formatDate(item.last_used_on))), /*#__PURE__*/React.createElement(Tooltip, {
|
|
215
|
+
title: item.is_oauth ? "" : formatDateWithTime(item.expires_on),
|
|
216
|
+
disable: item.is_oauth || !item.expires_on
|
|
217
|
+
}, /*#__PURE__*/React.createElement(Body2, {
|
|
218
|
+
color: "tertiary",
|
|
219
|
+
className: "col-date"
|
|
220
|
+
}, !item.is_oauth && item.expires_on ? formatDate(item.expires_on) : "—")), /*#__PURE__*/React.createElement(Body2, {
|
|
221
|
+
color: "tertiary",
|
|
222
|
+
className: "col-token"
|
|
223
|
+
}, item.is_oauth ? null : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, item.token), Array.from({
|
|
224
|
+
length: 7
|
|
225
|
+
}, (_, index) => /*#__PURE__*/React.createElement(Dot, {
|
|
226
|
+
key: index,
|
|
227
|
+
size: 8,
|
|
228
|
+
color: "var(--color-theme-600)"
|
|
229
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
230
|
+
className: "col-icon"
|
|
231
|
+
}, item.is_oauth ? null : /*#__PURE__*/React.createElement(Tooltip, {
|
|
232
|
+
title: "Use Token"
|
|
233
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
234
|
+
variant: "text gray",
|
|
235
|
+
onClick: () => onUseToken(item)
|
|
236
|
+
}, /*#__PURE__*/React.createElement(MoveIcon, null)))), /*#__PURE__*/React.createElement("div", {
|
|
237
|
+
className: "col-access"
|
|
238
|
+
}, item.is_expired ? null : /*#__PURE__*/React.createElement(AccessControl, {
|
|
239
|
+
item: item,
|
|
240
|
+
onChange: isReadWrite => onAccessChange(item, isReadWrite)
|
|
241
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
242
|
+
className: "col-icon"
|
|
243
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
244
|
+
title: "Delete Token"
|
|
245
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
246
|
+
variant: "text gray",
|
|
247
|
+
onClick: () => onDelete(item)
|
|
248
|
+
}, /*#__PURE__*/React.createElement(TrashIcon, null))))));
|
|
249
|
+
};
|
|
250
|
+
const TokensTable = _ref7 => {
|
|
251
|
+
let tokens = _ref7.tokens,
|
|
252
|
+
onAddNew = _ref7.onAddNew,
|
|
253
|
+
onDisconnectAll = _ref7.onDisconnectAll,
|
|
254
|
+
itemProps = _objectWithoutPropertiesLoose(_ref7, _excluded);
|
|
255
|
+
const rows = useMemo(() => groupRows(tokens), [tokens]);
|
|
256
|
+
return /*#__PURE__*/React.createElement(StyledTable, null, /*#__PURE__*/React.createElement("div", {
|
|
257
|
+
className: "mt-scroll"
|
|
258
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
259
|
+
className: "mt-inner"
|
|
260
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
261
|
+
className: "mt-row mt-head"
|
|
262
|
+
}, /*#__PURE__*/React.createElement(Body2, {
|
|
263
|
+
className: "col-client",
|
|
264
|
+
weight: "bold"
|
|
265
|
+
}, "MCP Client"), /*#__PURE__*/React.createElement(Body2, {
|
|
266
|
+
className: "col-date",
|
|
267
|
+
weight: "bold"
|
|
268
|
+
}, "Last Use"), /*#__PURE__*/React.createElement(Body2, {
|
|
269
|
+
className: "col-date",
|
|
270
|
+
weight: "bold"
|
|
271
|
+
}, "Expires"), /*#__PURE__*/React.createElement(Body2, {
|
|
272
|
+
className: "col-token",
|
|
273
|
+
weight: "bold"
|
|
274
|
+
}, "Token"), /*#__PURE__*/React.createElement("div", {
|
|
275
|
+
className: "col-icon"
|
|
276
|
+
}), /*#__PURE__*/React.createElement(Body2, {
|
|
277
|
+
className: "col-access",
|
|
278
|
+
weight: "bold"
|
|
279
|
+
}, "Access"), /*#__PURE__*/React.createElement("div", {
|
|
280
|
+
className: "col-icon"
|
|
281
|
+
})), rows.map(row => row.kind === "group" ? /*#__PURE__*/React.createElement("div", {
|
|
282
|
+
key: row.key,
|
|
283
|
+
className: "mt-bordered"
|
|
284
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
285
|
+
className: "group-head"
|
|
286
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
287
|
+
className: "identity"
|
|
288
|
+
}, /*#__PURE__*/React.createElement(ClientIdentity, {
|
|
289
|
+
item: row.items[0],
|
|
290
|
+
connectionCount: row.items.length
|
|
291
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
292
|
+
variant: "text gray",
|
|
293
|
+
onClick: () => onDisconnectAll(row.items)
|
|
294
|
+
}, "Disconnect")), row.items.map(item => /*#__PURE__*/React.createElement(TokenItem, _extends({
|
|
295
|
+
key: "grant-" + item.id,
|
|
296
|
+
item: item,
|
|
297
|
+
grouped: true
|
|
298
|
+
}, itemProps)))) : /*#__PURE__*/React.createElement(TokenItem, _extends({
|
|
299
|
+
key: row.key,
|
|
300
|
+
item: row.item
|
|
301
|
+
}, itemProps))))), /*#__PURE__*/React.createElement("div", {
|
|
302
|
+
className: "mt-bordered"
|
|
303
|
+
}, /*#__PURE__*/React.createElement(Trigger, {
|
|
304
|
+
className: "add-trigger",
|
|
305
|
+
onClick: onAddNew
|
|
306
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
307
|
+
className: "add-row"
|
|
308
|
+
}, /*#__PURE__*/React.createElement(Body2, {
|
|
309
|
+
color: "theme-primary"
|
|
310
|
+
}, "+ Add Token")))));
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
/* ------------------------------------------------------------------ */
|
|
314
|
+
/* Prompt examples + pro tips (mirrors McpTipsAndExamples.jsx) */
|
|
315
|
+
/* ------------------------------------------------------------------ */
|
|
316
|
+
|
|
317
|
+
const StyledTips = styled.div.withConfig({
|
|
318
|
+
displayName: "McpIntegration__StyledTips",
|
|
319
|
+
componentId: "sc-x8hck0-1"
|
|
320
|
+
})(["display:flex;flex-direction:column;gap:24px;width:100%;margin:24px 0 60px;@media (min-width:", "){flex-direction:row;}.tips-examples{display:flex;flex-direction:column;gap:24px;@media (min-width:", "){width:55.6%;}}.tips-heading{display:flex;flex-direction:column;gap:2px;}.tips-examples ul{display:flex;flex-direction:column;gap:12px;margin:0;}.tips-pro{display:flex;flex-direction:column;padding:0 16px;@media (min-width:", "){width:44.4%;padding-top:8px;}}.tips-pro-title{display:flex;align-items:center;gap:8px;height:44px;}"], LG, LG, LG);
|
|
321
|
+
const TipsAndExamples = () => /*#__PURE__*/React.createElement(StyledTips, null, /*#__PURE__*/React.createElement("div", {
|
|
322
|
+
className: "tips-examples"
|
|
323
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
324
|
+
className: "tips-heading"
|
|
325
|
+
}, /*#__PURE__*/React.createElement(Header3, null, "Prompt Examples"), /*#__PURE__*/React.createElement(Body2, null, "Ready-to-use prompts to inspire your team. Just copy, customize, and go!")), /*#__PURE__*/React.createElement(Accordion, {
|
|
326
|
+
preExpanded: ["no-0"]
|
|
327
|
+
}, MCP_EXAMPLES.map((group, index) => /*#__PURE__*/React.createElement(AccordionItem, {
|
|
328
|
+
key: group.name,
|
|
329
|
+
id: "no-" + index
|
|
330
|
+
}, /*#__PURE__*/React.createElement(AccordionItemHead, null, /*#__PURE__*/React.createElement(Body2, null, group.name)), /*#__PURE__*/React.createElement(AccordionItemBody, null, /*#__PURE__*/React.createElement(Body2, null, /*#__PURE__*/React.createElement("ul", null, group.examples.map(example => /*#__PURE__*/React.createElement("li", {
|
|
331
|
+
key: example.name
|
|
332
|
+
}, /*#__PURE__*/React.createElement("b", null, example.name, " "), example.prompt_example))))))))), /*#__PURE__*/React.createElement("div", {
|
|
333
|
+
className: "tips-pro"
|
|
334
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
335
|
+
className: "tips-pro-title"
|
|
336
|
+
}, /*#__PURE__*/React.createElement(InfoIcon, {
|
|
337
|
+
style: {
|
|
338
|
+
fill: "var(--color-theme-900)"
|
|
339
|
+
}
|
|
340
|
+
}), /*#__PURE__*/React.createElement(Body2, {
|
|
341
|
+
weight: "bold"
|
|
342
|
+
}, "Pro Tips")), /*#__PURE__*/React.createElement(Body2, null, /*#__PURE__*/React.createElement("ol", null, MCP_PRO_TIPS.map(tip => /*#__PURE__*/React.createElement("li", {
|
|
343
|
+
key: tip
|
|
344
|
+
}, tip)))), /*#__PURE__*/React.createElement(Body2, {
|
|
345
|
+
italic: true
|
|
346
|
+
}, "Copy these prompts, customize them with your project names and team members, and start managing your agency's work through conversation!")));
|
|
347
|
+
|
|
348
|
+
/* ------------------------------------------------------------------ */
|
|
349
|
+
/* Add MCP Client dialog (mirrors McpTokenAddDialog.jsx) */
|
|
350
|
+
/* ------------------------------------------------------------------ */
|
|
351
|
+
|
|
352
|
+
const CLIENT_OPTIONS = [{
|
|
353
|
+
id: "claude",
|
|
354
|
+
name: "Claude",
|
|
355
|
+
client_name: "Claude",
|
|
356
|
+
vendor: "Anthropic"
|
|
357
|
+
}, {
|
|
358
|
+
id: "langdock",
|
|
359
|
+
name: "Langdock",
|
|
360
|
+
client_name: "Langdock",
|
|
361
|
+
vendor: "Langdock GmbH"
|
|
362
|
+
}, {
|
|
363
|
+
id: "other",
|
|
364
|
+
name: "Other",
|
|
365
|
+
client_name: "",
|
|
366
|
+
vendor: ""
|
|
367
|
+
}];
|
|
368
|
+
const DialogTitleRow = styled(Dialog.Title).withConfig({
|
|
369
|
+
displayName: "McpIntegration__DialogTitleRow",
|
|
370
|
+
componentId: "sc-x8hck0-2"
|
|
371
|
+
})(["display:flex;justify-content:space-between;align-items:center;"]);
|
|
372
|
+
const DialogBody = styled.div.withConfig({
|
|
373
|
+
displayName: "McpIntegration__DialogBody",
|
|
374
|
+
componentId: "sc-x8hck0-3"
|
|
375
|
+
})(["display:flex;flex-direction:column;gap:16px;.field{display:flex;flex-direction:column;gap:4px;}.field .c-input-wrapper{width:100%;max-width:360px;}.chooser-label{margin-bottom:8px;}.checkbox-row{display:flex;align-items:center;gap:8px;}.checkbox-row label{margin-bottom:0;cursor:pointer;}"]);
|
|
376
|
+
const AddClientDialog = _ref8 => {
|
|
377
|
+
let open = _ref8.open,
|
|
378
|
+
onClose = _ref8.onClose,
|
|
379
|
+
onAdd = _ref8.onAdd;
|
|
380
|
+
const _useState = useState(""),
|
|
381
|
+
password = _useState[0],
|
|
382
|
+
setPassword = _useState[1];
|
|
383
|
+
const _useState2 = useState([]),
|
|
384
|
+
selected = _useState2[0],
|
|
385
|
+
setSelected = _useState2[1];
|
|
386
|
+
const _useState3 = useState(""),
|
|
387
|
+
clientName = _useState3[0],
|
|
388
|
+
setClientName = _useState3[1];
|
|
389
|
+
const _useState4 = useState(""),
|
|
390
|
+
vendor = _useState4[0],
|
|
391
|
+
setVendor = _useState4[1];
|
|
392
|
+
const _useState5 = useState(true),
|
|
393
|
+
readOnly = _useState5[0],
|
|
394
|
+
setReadOnly = _useState5[1];
|
|
395
|
+
const _useState6 = useState(false),
|
|
396
|
+
submitted = _useState6[0],
|
|
397
|
+
setSubmitted = _useState6[1];
|
|
398
|
+
const isOther = selected.includes("other");
|
|
399
|
+
const option = CLIENT_OPTIONS.find(o => o.id === selected[0]);
|
|
400
|
+
const name = isOther ? clientName.trim() : (option == null ? void 0 : option.client_name) || "";
|
|
401
|
+
const vendorName = isOther ? vendor.trim() : (option == null ? void 0 : option.vendor) || "";
|
|
402
|
+
const passwordInvalid = submitted && !password.trim();
|
|
403
|
+
const clientInvalid = submitted && !name;
|
|
404
|
+
const vendorInvalid = submitted && isOther && !vendorName;
|
|
405
|
+
const submit = () => {
|
|
406
|
+
setSubmitted(true);
|
|
407
|
+
if (!password.trim() || !name || !vendorName) return;
|
|
408
|
+
onAdd({
|
|
409
|
+
client_name: name,
|
|
410
|
+
client_vendor: vendorName,
|
|
411
|
+
is_read_write: !readOnly
|
|
412
|
+
});
|
|
413
|
+
};
|
|
414
|
+
return /*#__PURE__*/React.createElement(Dialog, {
|
|
415
|
+
open: open,
|
|
416
|
+
onClose: onClose,
|
|
417
|
+
size: "m"
|
|
418
|
+
}, /*#__PURE__*/React.createElement(DialogTitleRow, {
|
|
419
|
+
disableDefaultHeading: true
|
|
420
|
+
}, /*#__PURE__*/React.createElement(Header3, null, "Add MCP Client"), /*#__PURE__*/React.createElement(Link, {
|
|
421
|
+
variant: "tertiary",
|
|
422
|
+
as: "a",
|
|
423
|
+
href: "#"
|
|
424
|
+
}, /*#__PURE__*/React.createElement(HelpIcon, {
|
|
425
|
+
style: {
|
|
426
|
+
width: 14,
|
|
427
|
+
height: 14,
|
|
428
|
+
flexShrink: 0
|
|
429
|
+
}
|
|
430
|
+
}), "Learn More")), /*#__PURE__*/React.createElement(Dialog.ContentDivider, null), /*#__PURE__*/React.createElement(Dialog.Content, null, /*#__PURE__*/React.createElement(DialogBody, null, /*#__PURE__*/React.createElement("div", {
|
|
431
|
+
className: "field"
|
|
432
|
+
}, /*#__PURE__*/React.createElement(Label, {
|
|
433
|
+
htmlFor: "mcp-password",
|
|
434
|
+
invalid: passwordInvalid
|
|
435
|
+
}, "Your Password*"), /*#__PURE__*/React.createElement(InputPassword, {
|
|
436
|
+
autoFocus: true,
|
|
437
|
+
id: "mcp-password",
|
|
438
|
+
name: "password",
|
|
439
|
+
value: password,
|
|
440
|
+
invalid: passwordInvalid,
|
|
441
|
+
autoComplete: "new-password",
|
|
442
|
+
errorMessage: passwordInvalid ? "Password is required" : undefined,
|
|
443
|
+
onChange: value => setPassword(value)
|
|
444
|
+
}), /*#__PURE__*/React.createElement(Caption1, {
|
|
445
|
+
color: "tertiary"
|
|
446
|
+
}, "We need to make sure it\u2019s you")), /*#__PURE__*/React.createElement("div", {
|
|
447
|
+
className: "field"
|
|
448
|
+
}, /*#__PURE__*/React.createElement(Body2, {
|
|
449
|
+
className: "chooser-label",
|
|
450
|
+
weight: "bold"
|
|
451
|
+
}, "Chat Client"), /*#__PURE__*/React.createElement(ChooseV2, {
|
|
452
|
+
required: true,
|
|
453
|
+
options: CLIENT_OPTIONS.map(_ref9 => {
|
|
454
|
+
let id = _ref9.id,
|
|
455
|
+
label = _ref9.name;
|
|
456
|
+
return {
|
|
457
|
+
id,
|
|
458
|
+
name: label
|
|
459
|
+
};
|
|
460
|
+
}),
|
|
461
|
+
invalid: clientInvalid && !isOther,
|
|
462
|
+
selected: selected,
|
|
463
|
+
onChange: setSelected
|
|
464
|
+
})), isOther ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
465
|
+
className: "field"
|
|
466
|
+
}, /*#__PURE__*/React.createElement(Label, {
|
|
467
|
+
htmlFor: "mcp-client",
|
|
468
|
+
invalid: clientInvalid
|
|
469
|
+
}, "Client*"), /*#__PURE__*/React.createElement(Input, {
|
|
470
|
+
id: "mcp-client",
|
|
471
|
+
value: clientName,
|
|
472
|
+
invalid: clientInvalid,
|
|
473
|
+
onChange: e => setClientName(e.target.value)
|
|
474
|
+
}), /*#__PURE__*/React.createElement(Caption1, {
|
|
475
|
+
color: "tertiary"
|
|
476
|
+
}, "Name of the app that will use this token")), /*#__PURE__*/React.createElement("div", {
|
|
477
|
+
className: "field"
|
|
478
|
+
}, /*#__PURE__*/React.createElement(Label, {
|
|
479
|
+
htmlFor: "mcp-vendor",
|
|
480
|
+
invalid: vendorInvalid
|
|
481
|
+
}, "Vendor*"), /*#__PURE__*/React.createElement(Input, {
|
|
482
|
+
id: "mcp-vendor",
|
|
483
|
+
value: vendor,
|
|
484
|
+
invalid: vendorInvalid,
|
|
485
|
+
onChange: e => setVendor(e.target.value)
|
|
486
|
+
}), /*#__PURE__*/React.createElement(Caption1, {
|
|
487
|
+
color: "tertiary"
|
|
488
|
+
}, "Name of the organization that made the app"))) : /*#__PURE__*/React.createElement(Body2, null, "ActiveCollab will issue a new access token, and provide you with connection instructions."), /*#__PURE__*/React.createElement(Body2, null, "This token works only with AI tools connected through MCP. Other apps and integrations that connect to ActiveCollab through the API cannot use it. For those, create an API token in", " ", /*#__PURE__*/React.createElement(Link, {
|
|
489
|
+
variant: "text link-primary",
|
|
490
|
+
as: "a",
|
|
491
|
+
href: "#"
|
|
492
|
+
}, "Apps & Integrations"), ", under Utilities."), /*#__PURE__*/React.createElement("div", {
|
|
493
|
+
className: "checkbox-row"
|
|
494
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
495
|
+
id: "mcp-read-only",
|
|
496
|
+
checked: readOnly,
|
|
497
|
+
onChange: e => setReadOnly(e.target.checked)
|
|
498
|
+
}), /*#__PURE__*/React.createElement(Label, {
|
|
499
|
+
htmlFor: "mcp-read-only",
|
|
500
|
+
weight: "regular"
|
|
501
|
+
}, "Token is read-only")), /*#__PURE__*/React.createElement(Body2, null, "Let AI model only read from ActiveCollab, and restrict access to write tools, like project or task creation, commenting, etc."))), /*#__PURE__*/React.createElement(Dialog.ContentDivider, null), /*#__PURE__*/React.createElement(Dialog.Actions, null, /*#__PURE__*/React.createElement(Button, {
|
|
502
|
+
variant: "primary",
|
|
503
|
+
onClick: submit
|
|
504
|
+
}, "Add"), /*#__PURE__*/React.createElement(Button, {
|
|
505
|
+
variant: "secondary",
|
|
506
|
+
onClick: onClose
|
|
507
|
+
}, "Cancel")));
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
/* ------------------------------------------------------------------ */
|
|
511
|
+
/* Use Token dialog (mirrors McpTokenDialog.jsx + TokenDialog.jsx) */
|
|
512
|
+
/* ------------------------------------------------------------------ */
|
|
513
|
+
|
|
514
|
+
const StyledCopyField = styled.div.withConfig({
|
|
515
|
+
displayName: "McpIntegration__StyledCopyField",
|
|
516
|
+
componentId: "sc-x8hck0-4"
|
|
517
|
+
})(["display:flex;flex-direction:column;gap:4px;.cf-row{display:flex;align-items:center;gap:16px;}.cf-box{box-sizing:border-box;display:flex;align-items:center;width:100%;max-width:360px;height:32px;border:1px solid var(--color-theme-500);border-radius:6px;overflow:hidden;}.cf-value{display:flex;align-items:center;min-width:0;margin:0 8px;user-select:none;}.cf-value .c-dot{margin:2px 0 0 4px;flex-shrink:0;}"]);
|
|
518
|
+
|
|
519
|
+
/** Mirrors CopyToClipboard/CopyField.jsx. */
|
|
520
|
+
const CopyField = _ref0 => {
|
|
521
|
+
let label = _ref0.label,
|
|
522
|
+
children = _ref0.children;
|
|
523
|
+
return /*#__PURE__*/React.createElement(StyledCopyField, null, /*#__PURE__*/React.createElement(Caption1, {
|
|
524
|
+
weight: "bold"
|
|
525
|
+
}, label), /*#__PURE__*/React.createElement("div", {
|
|
526
|
+
className: "cf-row"
|
|
527
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
528
|
+
className: "cf-box"
|
|
529
|
+
}, /*#__PURE__*/React.createElement(Body2, {
|
|
530
|
+
className: "cf-value",
|
|
531
|
+
overflow: "truncate",
|
|
532
|
+
whitespace: "no-wrap"
|
|
533
|
+
}, children)), /*#__PURE__*/React.createElement(Tooltip, {
|
|
534
|
+
title: "Copy " + label + " to clipboard"
|
|
535
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
536
|
+
type: "button",
|
|
537
|
+
variant: "text gray",
|
|
538
|
+
size: "medium"
|
|
539
|
+
}, /*#__PURE__*/React.createElement(CopyIcon, null)))));
|
|
540
|
+
};
|
|
541
|
+
const UseTokenBody = styled.div.withConfig({
|
|
542
|
+
displayName: "McpIntegration__UseTokenBody",
|
|
543
|
+
componentId: "sc-x8hck0-5"
|
|
544
|
+
})(["display:flex;flex-direction:column;gap:16px;.instructions{display:flex;flex-direction:column;gap:12px;margin-top:8px;}.instructions p{margin:0 0 14px;}"]);
|
|
545
|
+
const configSnippet = (url, token) => "{\n \u2026\n \"mcpServers\": {\n \"ActiveCollab Project Management\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"mcp-remote@0.1.38\",\n \"" + url + "\",\n \"--header\",\n \"Authorization: Bearer ${AUTH_TOKEN}\"\n ],\n \"env\": {\n \"AUTH_TOKEN\": \"" + token + "\"\n }\n }\n }\n \u2026\n}";
|
|
546
|
+
const ClientInstructions = _ref1 => {
|
|
547
|
+
let clientName = _ref1.clientName;
|
|
548
|
+
if (clientName === "Langdock") {
|
|
549
|
+
return /*#__PURE__*/React.createElement(Body2, null, /*#__PURE__*/React.createElement("p", null, "Open Langdock and select ", /*#__PURE__*/React.createElement("b", null, "Integrations"), " from the main menu."), /*#__PURE__*/React.createElement("p", null, "In the upper-right corner, click ", /*#__PURE__*/React.createElement("b", null, "Add Integration"), ", then choose", " ", /*#__PURE__*/React.createElement("b", null, "From Scratch"), "."), /*#__PURE__*/React.createElement("p", null, "A dialog will open. Select ", /*#__PURE__*/React.createElement("b", null, "Connect remote MCP"), ". Paste the", " ", /*#__PURE__*/React.createElement("b", null, "ActiveCollab MCP server URL"), " and select ", /*#__PURE__*/React.createElement("b", null, "API key"), " as the authorization method."), /*#__PURE__*/React.createElement("p", null, "A new integration will be created. Click ", /*#__PURE__*/React.createElement("b", null, "Test Connect"), " to verify the connection. If the test succeeds, Langdock will display a list of actions available from ActiveCollab."), /*#__PURE__*/React.createElement("p", null, "Select the actions you want Langdock to be able to access and use."));
|
|
550
|
+
}
|
|
551
|
+
if (clientName === "Claude") {
|
|
552
|
+
return /*#__PURE__*/React.createElement(Body2, null, "Make sure that you have Node.js 20.19.0 or newer installed. Put this in your Claude Desktop configuration file, and restart Claude Desktop:");
|
|
553
|
+
}
|
|
554
|
+
return /*#__PURE__*/React.createElement(Body2, null, /*#__PURE__*/React.createElement("p", null, "Refer to your client or tool documentation for specific instructions on connecting to an MCP server."), /*#__PURE__*/React.createElement("p", null, "The credentials provided above are intended for use with the streamable HTTP transport protocol."), "If your client requires a JSON configuration to define MCP servers, use the appropriate fields (such as server URL, transport type, and authentication token) based on the example below. Ensure the configuration matches your client's expected schema and supports streamable HTTP transport.");
|
|
555
|
+
};
|
|
556
|
+
const UseTokenDialog = _ref10 => {
|
|
557
|
+
let token = _ref10.token,
|
|
558
|
+
onClose = _ref10.onClose;
|
|
559
|
+
const details = MCP_TOKEN_DETAILS;
|
|
560
|
+
const isLangdock = (token == null ? void 0 : token.client_name) === "Langdock";
|
|
561
|
+
return /*#__PURE__*/React.createElement(Dialog, {
|
|
562
|
+
open: !!token,
|
|
563
|
+
onClose: onClose,
|
|
564
|
+
size: "l",
|
|
565
|
+
dismissOnBackdropClick: true
|
|
566
|
+
}, /*#__PURE__*/React.createElement(Dialog.Title, {
|
|
567
|
+
onClose: onClose
|
|
568
|
+
}, "Use Token"), /*#__PURE__*/React.createElement(Dialog.ContentDivider, null), /*#__PURE__*/React.createElement(Dialog.Content, null, /*#__PURE__*/React.createElement(UseTokenBody, null, /*#__PURE__*/React.createElement(CopyField, {
|
|
569
|
+
label: "MCP Server URL"
|
|
570
|
+
}, details.api_url), /*#__PURE__*/React.createElement(CopyField, {
|
|
571
|
+
label: "MCP token"
|
|
572
|
+
}, /*#__PURE__*/React.createElement("span", null, details.token.slice(0, 5)), Array.from({
|
|
573
|
+
length: 22
|
|
574
|
+
}, (_, index) => /*#__PURE__*/React.createElement(Dot, {
|
|
575
|
+
key: index,
|
|
576
|
+
size: 8,
|
|
577
|
+
color: "var(--color-theme-900)"
|
|
578
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
579
|
+
className: "instructions"
|
|
580
|
+
}, /*#__PURE__*/React.createElement(ClientInstructions, {
|
|
581
|
+
clientName: token == null ? void 0 : token.client_name
|
|
582
|
+
}), isLangdock ? null : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CopySnippet, {
|
|
583
|
+
code: configSnippet(details.api_url, details.token)
|
|
584
|
+
}), /*#__PURE__*/React.createElement(Body2, null, /*#__PURE__*/React.createElement(Link, {
|
|
585
|
+
variant: "text link-primary",
|
|
586
|
+
as: "a",
|
|
587
|
+
href: "#"
|
|
588
|
+
}, "Click here"), " ", "to learn more."))))));
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
/* ------------------------------------------------------------------ */
|
|
592
|
+
/* Empty state (McpIntegrationPage.jsx, no data) */
|
|
593
|
+
/* ------------------------------------------------------------------ */
|
|
594
|
+
|
|
595
|
+
const StyledEmpty = styled.div.withConfig({
|
|
596
|
+
displayName: "McpIntegration__StyledEmpty",
|
|
597
|
+
componentId: "sc-x8hck0-6"
|
|
598
|
+
})(["display:flex;flex-direction:column;align-items:flex-start;gap:16px;"]);
|
|
599
|
+
|
|
600
|
+
/* ------------------------------------------------------------------ */
|
|
601
|
+
/* Page content with all flows */
|
|
602
|
+
/* ------------------------------------------------------------------ */
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Everything under the MCP page header separator: the clients table (or the
|
|
606
|
+
* empty state), prompt examples, and the dialogs the page opens — Add MCP
|
|
607
|
+
* Client, Use Token, Delete Token, Disconnect Agent, Disconnect All
|
|
608
|
+
* Connections, and the OAuth access change confirmation.
|
|
609
|
+
*/
|
|
610
|
+
export const McpIntegrationContent = _ref11 => {
|
|
611
|
+
let initialTokens = _ref11.initialTokens;
|
|
612
|
+
const _useState7 = useState(initialTokens),
|
|
613
|
+
tokens = _useState7[0],
|
|
614
|
+
setTokens = _useState7[1];
|
|
615
|
+
const _useState8 = useState(false),
|
|
616
|
+
addOpen = _useState8[0],
|
|
617
|
+
setAddOpen = _useState8[1];
|
|
618
|
+
const _useState9 = useState(null),
|
|
619
|
+
useToken = _useState9[0],
|
|
620
|
+
setUseToken = _useState9[1];
|
|
621
|
+
const _useState0 = useState(null),
|
|
622
|
+
deleteItem = _useState0[0],
|
|
623
|
+
setDeleteItem = _useState0[1];
|
|
624
|
+
const _useState1 = useState(null),
|
|
625
|
+
disconnectAll = _useState1[0],
|
|
626
|
+
setDisconnectAll = _useState1[1];
|
|
627
|
+
const _useState10 = useState(null),
|
|
628
|
+
pendingAccess = _useState10[0],
|
|
629
|
+
setPendingAccess = _useState10[1];
|
|
630
|
+
const removeTokens = ids => setTokens(rows => rows.filter(row => !ids.includes(row.id)));
|
|
631
|
+
const setAccess = (id, isReadWrite) => setTokens(rows => rows.map(row => row.id === id ? _extends({}, row, {
|
|
632
|
+
is_read_write: isReadWrite
|
|
633
|
+
}) : row));
|
|
634
|
+
const handleAccessChange = (item, isReadWrite) => {
|
|
635
|
+
if (item.is_read_write === isReadWrite) return;
|
|
636
|
+
if (item.is_oauth) {
|
|
637
|
+
setPendingAccess({
|
|
638
|
+
item,
|
|
639
|
+
isReadWrite
|
|
640
|
+
});
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
setAccess(item.id, isReadWrite);
|
|
644
|
+
};
|
|
645
|
+
const handleAdd = token => {
|
|
646
|
+
const row = {
|
|
647
|
+
id: Math.max(0, ...tokens.map(t => t.id)) + 1,
|
|
648
|
+
is_oauth: false,
|
|
649
|
+
client_name: token.client_name,
|
|
650
|
+
client_vendor: token.client_vendor,
|
|
651
|
+
client_display_name: token.client_name + " by " + token.client_vendor,
|
|
652
|
+
token: "e4d09",
|
|
653
|
+
last_used_on: null,
|
|
654
|
+
expires_on: null,
|
|
655
|
+
is_read_write: token.is_read_write
|
|
656
|
+
};
|
|
657
|
+
setTokens(rows => [...rows, row]);
|
|
658
|
+
setAddOpen(false);
|
|
659
|
+
setUseToken(row);
|
|
660
|
+
};
|
|
661
|
+
const deleteConnectionCount = deleteItem != null && deleteItem.client_id ? tokens.filter(t => t.is_oauth && t.client_id === deleteItem.client_id).length : 0;
|
|
662
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, tokens.length ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TokensTable, {
|
|
663
|
+
tokens: tokens,
|
|
664
|
+
onAddNew: () => setAddOpen(true),
|
|
665
|
+
onDelete: setDeleteItem,
|
|
666
|
+
onDisconnectAll: setDisconnectAll,
|
|
667
|
+
onUseToken: setUseToken,
|
|
668
|
+
onAccessChange: handleAccessChange
|
|
669
|
+
}), /*#__PURE__*/React.createElement(TipsAndExamples, null)) : /*#__PURE__*/React.createElement(StyledEmpty, null, /*#__PURE__*/React.createElement(Header3, null, "Enable MCP"), /*#__PURE__*/React.createElement(Body2, null, "You don't have any MCP clients configured yet."), /*#__PURE__*/React.createElement(Button, {
|
|
670
|
+
variant: "primary",
|
|
671
|
+
onClick: () => setAddOpen(true)
|
|
672
|
+
}, "Add MCP Client")), addOpen ? /*#__PURE__*/React.createElement(AddClientDialog, {
|
|
673
|
+
open: addOpen,
|
|
674
|
+
onClose: () => setAddOpen(false),
|
|
675
|
+
onAdd: handleAdd
|
|
676
|
+
}) : null, /*#__PURE__*/React.createElement(UseTokenDialog, {
|
|
677
|
+
token: useToken,
|
|
678
|
+
onClose: () => setUseToken(null)
|
|
679
|
+
}), deleteItem && !deleteItem.is_oauth ? /*#__PURE__*/React.createElement(ConfirmDialog, {
|
|
680
|
+
open: true,
|
|
681
|
+
dialogTitle: "Delete Token",
|
|
682
|
+
dialogContent: /*#__PURE__*/React.createElement(React.Fragment, null, "Token will be permanently deleted, and", " ", /*#__PURE__*/React.createElement(ClientLabel, {
|
|
683
|
+
item: deleteItem
|
|
684
|
+
}), " will no longer be able to access ActiveCollab."),
|
|
685
|
+
confirmBtnText: "Delete",
|
|
686
|
+
onCancel: () => setDeleteItem(null),
|
|
687
|
+
onConfirm: () => {
|
|
688
|
+
removeTokens([deleteItem.id]);
|
|
689
|
+
setDeleteItem(null);
|
|
690
|
+
}
|
|
691
|
+
}) : null, deleteItem && deleteItem.is_oauth ? /*#__PURE__*/React.createElement(ConfirmDialog, {
|
|
692
|
+
open: true,
|
|
693
|
+
dialogTitle: "Disconnect Agent",
|
|
694
|
+
dialogContent: deleteConnectionCount < 2 ? /*#__PURE__*/React.createElement(React.Fragment, null, "This disconnects ", /*#__PURE__*/React.createElement(ClientLabel, {
|
|
695
|
+
item: deleteItem
|
|
696
|
+
}), ". It will have to connect again to use ActiveCollab.") : /*#__PURE__*/React.createElement(React.Fragment, null, "This disconnects this ", /*#__PURE__*/React.createElement(ClientLabel, {
|
|
697
|
+
item: deleteItem
|
|
698
|
+
}), " ", "connection, connected ", formatDate(deleteItem.granted_on), " and last used ", formatDateWithTime(deleteItem.last_used_on), ". Your other ", /*#__PURE__*/React.createElement(ClientLabel, {
|
|
699
|
+
item: deleteItem
|
|
700
|
+
}), " ", deleteConnectionCount - 1 === 1 ? "connection keeps" : "connections keep", " ", "working."),
|
|
701
|
+
confirmBtnText: "Disconnect",
|
|
702
|
+
onCancel: () => setDeleteItem(null),
|
|
703
|
+
onConfirm: () => {
|
|
704
|
+
removeTokens([deleteItem.id]);
|
|
705
|
+
setDeleteItem(null);
|
|
706
|
+
}
|
|
707
|
+
}) : null, disconnectAll ? /*#__PURE__*/React.createElement(ConfirmDialog, {
|
|
708
|
+
open: true,
|
|
709
|
+
dialogTitle: "Disconnect All Connections",
|
|
710
|
+
dialogContent: /*#__PURE__*/React.createElement(React.Fragment, null, "Disconnect ", /*#__PURE__*/React.createElement(ClientLabel, {
|
|
711
|
+
item: disconnectAll[0]
|
|
712
|
+
}), "? This disconnects all ", disconnectAll.length, " of your", " ", displayNameOf(disconnectAll[0]), " connections. Each of them will have to connect again to use ActiveCollab."),
|
|
713
|
+
confirmBtnText: "Disconnect All",
|
|
714
|
+
onCancel: () => setDisconnectAll(null),
|
|
715
|
+
onConfirm: () => {
|
|
716
|
+
removeTokens(disconnectAll.map(row => row.id));
|
|
717
|
+
setDisconnectAll(null);
|
|
718
|
+
}
|
|
719
|
+
}) : null, pendingAccess ? /*#__PURE__*/React.createElement(ConfirmDialog, {
|
|
720
|
+
open: true,
|
|
721
|
+
dialogTitle: pendingAccess.isReadWrite ? "Allow Write Access" : "Limit to Read-Only Access",
|
|
722
|
+
dialogContent: pendingAccess.isReadWrite ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ClientLabel, {
|
|
723
|
+
item: pendingAccess.item
|
|
724
|
+
}), " currently has read-only access. If you continue, it will be able to create and change tasks, comments, and other content on your behalf, starting now and until you change its access again.") : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ClientLabel, {
|
|
725
|
+
item: pendingAccess.item
|
|
726
|
+
}), " will no longer be able to create or change anything in your account, starting now. Actions it attempts will fail until you change its access again."),
|
|
727
|
+
confirmBtnText: pendingAccess.isReadWrite ? "Allow Write Access" : "Limit Access",
|
|
728
|
+
onCancel: () => setPendingAccess(null),
|
|
729
|
+
onConfirm: () => {
|
|
730
|
+
setAccess(pendingAccess.item.id, pendingAccess.isReadWrite);
|
|
731
|
+
setPendingAccess(null);
|
|
732
|
+
}
|
|
733
|
+
}) : null);
|
|
734
|
+
};
|
|
735
|
+
//# sourceMappingURL=McpIntegration.js.map
|