@epam/ai-dial-toolset-editor 1.3.0-dev.98 → 1.4.0-dev.5
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/components/AuthSection/AuthSection.d.ts.map +1 -1
- package/components/ConnectMcpUrlContent/ConnectMcpUrlContent.d.ts +4 -0
- package/components/ConnectMcpUrlContent/ConnectMcpUrlContent.d.ts.map +1 -1
- package/components/SettingsForm/SettingsForm.d.ts.map +1 -1
- package/components/ToolsetEditor/ToolsetEditor.d.ts.map +1 -1
- package/constants/toolsets.d.ts +3 -3
- package/constants/toolsets.d.ts.map +1 -1
- package/index.css +3 -2
- package/index.d.ts +3 -4
- package/index.d.ts.map +1 -1
- package/index.js +453 -438
- package/models/auth-section-props.d.ts +12 -0
- package/models/auth-section-props.d.ts.map +1 -1
- package/models/general-form-labels.d.ts +14 -0
- package/models/general-form-labels.d.ts.map +1 -0
- package/models/settings-form-props.d.ts +26 -0
- package/models/settings-form-props.d.ts.map +1 -1
- package/models/toolset-editor-props.d.ts +32 -15
- package/models/toolset-editor-props.d.ts.map +1 -1
- package/models/toolset-form.d.ts +6 -0
- package/models/toolset-form.d.ts.map +1 -1
- package/package.json +6 -6
- package/utils/toolsets.d.ts +2 -0
- package/utils/toolsets.d.ts.map +1 -1
- package/components/GeneralForm/GeneralForm.d.ts +0 -8
- package/components/GeneralForm/GeneralForm.d.ts.map +0 -1
- package/models/general-form-props.d.ts +0 -48
- package/models/general-form-props.d.ts.map +0 -1
package/index.js
CHANGED
|
@@ -1,492 +1,493 @@
|
|
|
1
|
-
import { DEFAULT_DEPLOYMENT_VERSION as e, DeploymentCreationFieldErrorCode as t, EntityEditor as n, MetadataField as r, MetadataForm as i,
|
|
2
|
-
import { ToolsetAuthTypes as
|
|
3
|
-
import { CopyButton as
|
|
1
|
+
import { DEFAULT_DEPLOYMENT_VERSION as e, DeploymentCreationFieldErrorCode as t, EntityEditor as n, MetadataField as r, MetadataForm as i, useMetadataForm as a, validateDeploymentCreationFields as o } from "@epam/ai-dial-builder-form";
|
|
2
|
+
import { ToolsetAuthTypes as s, ToolsetCredentialsLevel as c, WithLogin as l, getApiErrorDetails as u } from "@epam/ai-dial-chat-hooks";
|
|
3
|
+
import { CopyButton as d, ENTITY_DESCRIPTION_MAX_LENGTH as f, ENTITY_NAME_MAX_LENGTH as p, TAG_INPUT_TAG_CLASS_NAME as m, TextRefinementField as h, buildCssVars as g, mergeClasses as _, useCodeCopy as v, useTextRefinement as y } from "@epam/ai-dial-chat-shared";
|
|
4
4
|
import { memo as b, useCallback as x, useEffect as S, useMemo as C, useRef as w, useState as T } from "react";
|
|
5
|
-
import { IconBrandOauth as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { IconBrandOauth as E, IconKey as D, IconLockOff as O, IconLogin as ee, IconLogout as te } from "@tabler/icons-react";
|
|
6
|
+
import { CaptionText as k, ConfirmationPopup as ne, ConfirmationPopupVariant as re, DIAL_ICON_SIZE as ie, DIAL_KIT_ICON_STROKE as A, Input as j, LiveRegion as ae, LiveRegionElement as M, NeutralButton as oe, PasswordInput as N, Radio as P, RadioGroup as F, SegmentedControl as I, Select as L, TagInput as se } from "@epam/ai-dial-ui-kit";
|
|
7
|
+
import { jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
8
8
|
//#region src/constants/public-class-names.ts
|
|
9
|
-
var
|
|
9
|
+
var B = {
|
|
10
10
|
metadataSection: "dial-toolset-editor-metadata-section",
|
|
11
11
|
setupSection: "dial-toolset-editor-setup-section"
|
|
12
|
-
},
|
|
12
|
+
}, V = /* @__PURE__ */ function(e) {
|
|
13
13
|
return e.Http = "HTTP", e.Sse = "SSE", e;
|
|
14
|
-
}({}),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
}({}), ce = e, le = {
|
|
15
|
+
name: {
|
|
16
|
+
label: "Name",
|
|
17
|
+
placeholder: "Enter name"
|
|
18
|
+
},
|
|
19
|
+
description: {
|
|
20
|
+
label: "Description",
|
|
21
|
+
placeholder: "Describe what this toolset does"
|
|
22
|
+
},
|
|
23
|
+
iconUrl: {
|
|
24
|
+
label: "Avatar",
|
|
25
|
+
addAvatarLabel: "Add avatar",
|
|
26
|
+
captionText: "PNG, JPG or SVG (max 1 MB)"
|
|
27
|
+
},
|
|
28
|
+
version: {
|
|
29
|
+
label: "Version",
|
|
30
|
+
placeholder: "e.g. 1.0.0"
|
|
31
|
+
},
|
|
32
|
+
topics: {
|
|
33
|
+
label: "Tags",
|
|
34
|
+
placeholder: "Add tags, comma separated"
|
|
35
|
+
},
|
|
36
|
+
otherLocales: {
|
|
37
|
+
summaryLabel: "Locales",
|
|
38
|
+
addLabel: "Add locales",
|
|
39
|
+
editLabel: "Edit locales",
|
|
40
|
+
popupTitle: "Add locale",
|
|
41
|
+
addLocaleLabel: "Add locale",
|
|
42
|
+
localeRowLabel: "Locale",
|
|
43
|
+
languageLabel: "Language",
|
|
44
|
+
nameLabel: "Name",
|
|
45
|
+
namePlaceholder: "Enter name",
|
|
46
|
+
descriptionLabel: "About",
|
|
47
|
+
descriptionPlaceholder: "Enter brief description",
|
|
48
|
+
deleteAriaLabel: "Delete locale",
|
|
49
|
+
cancelLabel: "Cancel",
|
|
50
|
+
saveLabel: "Save"
|
|
51
|
+
},
|
|
52
|
+
ariaLabel: "General"
|
|
53
|
+
}, H = {
|
|
54
|
+
[s.OAuth]: E,
|
|
55
|
+
[s.ApiKey]: D,
|
|
56
|
+
[s.None]: O
|
|
18
57
|
}, ue = () => ({
|
|
19
|
-
authenticationType:
|
|
20
|
-
withLogin:
|
|
58
|
+
authenticationType: s.None,
|
|
59
|
+
withLogin: l.WithoutLogin,
|
|
21
60
|
isLoggedIn: !1
|
|
22
|
-
}),
|
|
61
|
+
}), U = () => ({
|
|
23
62
|
name: "",
|
|
24
|
-
version:
|
|
63
|
+
version: ce,
|
|
25
64
|
iconUrl: "",
|
|
26
65
|
description: "",
|
|
27
66
|
topics: [],
|
|
28
67
|
otherLocales: [],
|
|
29
68
|
endpoint: "",
|
|
30
|
-
protocol:
|
|
69
|
+
protocol: V.Http,
|
|
31
70
|
allowedTools: [],
|
|
32
71
|
auth: ue()
|
|
33
|
-
}),
|
|
72
|
+
}), W = (e) => {
|
|
34
73
|
if (!/^https?:\/\//.test(e) || e.endsWith(".") || e.endsWith("//")) return !1;
|
|
35
74
|
try {
|
|
36
75
|
return !!new URL(e);
|
|
37
76
|
} catch {
|
|
38
77
|
return !1;
|
|
39
78
|
}
|
|
40
|
-
},
|
|
79
|
+
}, G = (e) => W(e.trim()), de = /^[A-Za-z][A-Za-z0-9+.-]*:[^\s#]+$/, fe = 2048, pe = (e) => {
|
|
80
|
+
let t = e?.trim() ?? "";
|
|
81
|
+
if (!t) return !0;
|
|
82
|
+
if (t.length > fe || !de.test(t)) return !1;
|
|
83
|
+
try {
|
|
84
|
+
return !!new URL(t);
|
|
85
|
+
} catch {
|
|
86
|
+
return !1;
|
|
87
|
+
}
|
|
88
|
+
}, K = (e) => e.replace(/^(https?):\/([^/])/, "$1://$2"), q = (e) => {
|
|
41
89
|
let t = e?.trim() ?? "";
|
|
42
|
-
if (!t ||
|
|
90
|
+
if (!t || W(t)) return t;
|
|
43
91
|
let n = [t];
|
|
44
92
|
try {
|
|
45
93
|
let e = decodeURIComponent(t);
|
|
46
94
|
e !== t && n.push(e);
|
|
47
95
|
} catch {}
|
|
48
96
|
for (let e of n) {
|
|
49
|
-
let t =
|
|
50
|
-
if (
|
|
97
|
+
let t = K(e);
|
|
98
|
+
if (W(t)) return t;
|
|
51
99
|
}
|
|
52
100
|
return t;
|
|
53
|
-
},
|
|
101
|
+
}, J = (e, t = !1) => e.isLoggedIn ? !0 : e.authenticationType === s.ApiKey ? e.keyHeader?.trim() ? e.withLogin === l.WithoutLogin || !!(e.keyHeader?.trim() && e.apiKey?.trim()) : !1 : e.authenticationType === s.OAuth && e.withLogin === l.WithConfig ? !!e.clientId?.trim() && (t || !!e.clientSecret?.trim()) && G(e.authorizationEndpoint ?? "") && G(e.tokenEndpoint ?? "") && pe(e.resource) : !0, me = (e, t = !1) => Object.keys(o(e, { validateVersionPattern: !0 })).length === 0 && G(e.endpoint) && J(e.auth, t), Y = /* @__PURE__ */ new Set([
|
|
54
102
|
"name",
|
|
55
103
|
"description",
|
|
56
104
|
"iconUrl",
|
|
57
105
|
"version",
|
|
58
106
|
"topics",
|
|
59
107
|
"otherLocales"
|
|
60
|
-
]),
|
|
108
|
+
]), he = (e) => ({
|
|
61
109
|
name: e.name,
|
|
62
110
|
description: e.description,
|
|
63
111
|
iconUrl: e.iconUrl,
|
|
64
112
|
version: e.version,
|
|
65
113
|
topics: e.topics,
|
|
66
114
|
otherLocales: e.otherLocales
|
|
67
|
-
}),
|
|
115
|
+
}), ge = (e) => {
|
|
68
116
|
let t = {}, n = {};
|
|
69
|
-
for (let [r, i] of Object.entries(e)) (
|
|
117
|
+
for (let [r, i] of Object.entries(e)) (Y.has(r) ? t : n)[r] = i;
|
|
70
118
|
return {
|
|
71
119
|
metadata: t,
|
|
72
120
|
setup: n
|
|
73
121
|
};
|
|
74
|
-
},
|
|
75
|
-
name: {
|
|
76
|
-
label: "Name",
|
|
77
|
-
placeholder: "Enter name"
|
|
78
|
-
},
|
|
79
|
-
description: {
|
|
80
|
-
label: "Description",
|
|
81
|
-
placeholder: "Describe what this toolset does"
|
|
82
|
-
},
|
|
83
|
-
iconUrl: {
|
|
84
|
-
label: "Avatar",
|
|
85
|
-
addAvatarLabel: "Add avatar",
|
|
86
|
-
captionText: "PNG, JPG or SVG (max 1 MB)"
|
|
87
|
-
},
|
|
88
|
-
version: {
|
|
89
|
-
label: "Version",
|
|
90
|
-
placeholder: "e.g. 1.0.0"
|
|
91
|
-
},
|
|
92
|
-
topics: {
|
|
93
|
-
label: "Tags",
|
|
94
|
-
placeholder: "Add tags, comma separated"
|
|
95
|
-
},
|
|
96
|
-
otherLocales: {
|
|
97
|
-
summaryLabel: "Locales",
|
|
98
|
-
addLabel: "Add locales",
|
|
99
|
-
editLabel: "Edit locales",
|
|
100
|
-
popupTitle: "Add locale",
|
|
101
|
-
addLocaleLabel: "Add locale",
|
|
102
|
-
localeRowLabel: "Locale",
|
|
103
|
-
languageLabel: "Language",
|
|
104
|
-
nameLabel: "Name",
|
|
105
|
-
namePlaceholder: "Enter name",
|
|
106
|
-
descriptionLabel: "About",
|
|
107
|
-
descriptionPlaceholder: "Enter brief description",
|
|
108
|
-
deleteAriaLabel: "Delete locale",
|
|
109
|
-
cancelLabel: "Cancel",
|
|
110
|
-
saveLabel: "Save"
|
|
111
|
-
},
|
|
112
|
-
ariaLabel: "General"
|
|
113
|
-
}, ge = ({ form: e, errors: t, bucket: n, FileManagerModal: r, resolveIconUrl: a, allowedMimeTypes: o, maxFileSizeBytes: s, availableLocaleOptions: c, onChange: l, onNameBlur: u, onVersionBlur: f, renderDescription: p, labels: m }) => {
|
|
114
|
-
let h = x((e) => {
|
|
115
|
-
let [t] = e.files;
|
|
116
|
-
return (t ? d(t, n, { resolvePreviewUrl: a }) : null)?.url;
|
|
117
|
-
}, [n, a]);
|
|
118
|
-
return /* @__PURE__ */ D(i, {
|
|
119
|
-
values: e,
|
|
120
|
-
errors: t,
|
|
121
|
-
onChange: l,
|
|
122
|
-
onNameBlur: u,
|
|
123
|
-
onVersionBlur: f,
|
|
124
|
-
avatarPicker: C(() => ({
|
|
125
|
-
bucket: n,
|
|
126
|
-
FileManagerModal: r,
|
|
127
|
-
resolveIconUrl: a,
|
|
128
|
-
resolveAttachedIconUrl: h,
|
|
129
|
-
allowedMimeTypes: o,
|
|
130
|
-
maxFileSizeBytes: s
|
|
131
|
-
}), [
|
|
132
|
-
n,
|
|
133
|
-
r,
|
|
134
|
-
a,
|
|
135
|
-
h,
|
|
136
|
-
o,
|
|
137
|
-
s
|
|
138
|
-
]),
|
|
139
|
-
availableLocaleOptions: c,
|
|
140
|
-
renderDescription: p,
|
|
141
|
-
labels: C(() => ({
|
|
142
|
-
form: m?.form ?? q,
|
|
143
|
-
avatarPicker: m?.avatarPicker
|
|
144
|
-
}), [m?.form, m?.avatarPicker])
|
|
145
|
-
});
|
|
146
|
-
}, J = /* @__PURE__ */ function(e) {
|
|
122
|
+
}, X = /* @__PURE__ */ function(e) {
|
|
147
123
|
return e.Success = "success", e.Cancelled = "cancelled", e.PopupBlocked = "popup-blocked", e.InvalidConfig = "invalid-config", e.Failed = "failed", e;
|
|
148
|
-
}({}), _e = (e) => e ===
|
|
149
|
-
let [
|
|
150
|
-
|
|
124
|
+
}({}), _e = { openAccessDescription: "_openAccessDescription_1ltst_1" }, Z = "toolset-client-secret-keep-caption", ve = (e) => `******${e}`, ye = (e) => e === s.None ? l.WithoutLogin : l.WithLogin, Q = (e, t) => e === s.None ? t?.typeNone ?? "Open access" : e === s.OAuth ? t?.typeOAuth ?? "OAuth" : t?.typeApiKey ?? "API Key", be = ({ auth: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, endpoint: a, authActions: o, onOAuthLogin: d, onNotifySuccess: f, onNotifyError: p, onAuthChange: h, onEnsureSaved: g, labels: v, titleClassName: y = "dial-h3-text", openAccessDescriptionClassName: b = "dial-small-text" }) => {
|
|
125
|
+
let [x, S] = T(!1), [C, w] = T(!1), E = e.isLoggedIn || n || x, D = i && e.clientSecretHint && !e.clientSecret ? e.clientSecretHint : void 0, O = G(a) && J(e, i) && !E, ae = (t) => {
|
|
126
|
+
E || t === e.authenticationType || h({
|
|
151
127
|
authenticationType: t,
|
|
152
|
-
withLogin:
|
|
128
|
+
withLogin: ye(t)
|
|
153
129
|
});
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
},
|
|
157
|
-
switch (e.auth != null &&
|
|
158
|
-
case
|
|
159
|
-
|
|
130
|
+
}, M = (e) => {
|
|
131
|
+
h({ withLogin: e });
|
|
132
|
+
}, F = (e) => {
|
|
133
|
+
switch (e.auth != null && h(e.auth), e.status) {
|
|
134
|
+
case X.Success:
|
|
135
|
+
h({ isLoggedIn: !0 }), f(v?.loginSuccessMessage ?? "Successfully logged in.");
|
|
160
136
|
return;
|
|
161
|
-
case
|
|
162
|
-
p(
|
|
137
|
+
case X.PopupBlocked:
|
|
138
|
+
p(v?.errorPopupBlocked ?? "The login popup was blocked by your browser. Please allow popups for this site and try again.");
|
|
163
139
|
return;
|
|
164
|
-
case
|
|
165
|
-
p(
|
|
140
|
+
case X.InvalidConfig:
|
|
141
|
+
p(v?.errorOAuthConfigMissing ?? "The OAuth provider did not return a valid client configuration. Please check the endpoint or contact your administrator.");
|
|
166
142
|
return;
|
|
167
|
-
case
|
|
168
|
-
p(
|
|
143
|
+
case X.Failed:
|
|
144
|
+
p(v?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", e.traceId);
|
|
169
145
|
return;
|
|
170
|
-
case
|
|
146
|
+
case X.Cancelled: return;
|
|
171
147
|
}
|
|
172
|
-
},
|
|
173
|
-
if (!
|
|
174
|
-
if (e.authenticationType ===
|
|
175
|
-
|
|
148
|
+
}, L = async () => {
|
|
149
|
+
if (!O) return;
|
|
150
|
+
if (e.authenticationType === s.OAuth) {
|
|
151
|
+
S(!0);
|
|
176
152
|
try {
|
|
177
|
-
|
|
153
|
+
F(await d({
|
|
178
154
|
auth: e,
|
|
179
|
-
ensureSaved:
|
|
155
|
+
ensureSaved: g
|
|
180
156
|
}));
|
|
181
157
|
} finally {
|
|
182
|
-
|
|
158
|
+
S(!1);
|
|
183
159
|
}
|
|
184
160
|
return;
|
|
185
161
|
}
|
|
186
|
-
let t = await
|
|
162
|
+
let t = await g();
|
|
187
163
|
if (t) {
|
|
188
|
-
|
|
164
|
+
S(!0);
|
|
189
165
|
try {
|
|
190
166
|
let n = {
|
|
191
167
|
url: t,
|
|
192
|
-
credentialsLevel:
|
|
168
|
+
credentialsLevel: c.User,
|
|
193
169
|
authenticationType: e.authenticationType,
|
|
194
170
|
apiKey: e.apiKey?.trim()
|
|
195
171
|
};
|
|
196
|
-
await o.login(t, n),
|
|
172
|
+
await o.login(t, n), h({ isLoggedIn: !0 }), f(v?.loginSuccessMessage ?? "Successfully logged in.");
|
|
197
173
|
} catch (e) {
|
|
198
|
-
let { traceId: t } = await
|
|
199
|
-
p(
|
|
174
|
+
let { traceId: t } = await u(e);
|
|
175
|
+
p(v?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
|
|
200
176
|
} finally {
|
|
201
|
-
|
|
177
|
+
S(!1);
|
|
202
178
|
}
|
|
203
179
|
}
|
|
204
|
-
},
|
|
205
|
-
|
|
180
|
+
}, B = async () => {
|
|
181
|
+
S(!0);
|
|
206
182
|
try {
|
|
207
183
|
let t = {
|
|
208
184
|
url: r,
|
|
209
|
-
credentialsLevel:
|
|
185
|
+
credentialsLevel: c.User,
|
|
210
186
|
authenticationType: e.authenticationType
|
|
211
187
|
};
|
|
212
|
-
await o.logout(r, t),
|
|
188
|
+
await o.logout(r, t), h({ isLoggedIn: !1 }), w(!1), f(v?.logoutSuccessMessage ?? "Successfully logged out.");
|
|
213
189
|
} catch (e) {
|
|
214
|
-
let { traceId: t } = await
|
|
215
|
-
p(
|
|
190
|
+
let { traceId: t } = await u(e);
|
|
191
|
+
p(v?.errorLogoutFailed ?? "Failed to log out. Please try again.", t);
|
|
216
192
|
} finally {
|
|
217
|
-
|
|
193
|
+
S(!1);
|
|
218
194
|
}
|
|
219
|
-
},
|
|
195
|
+
}, V = () => e.isLoggedIn ? /* @__PURE__ */ R("div", {
|
|
220
196
|
className: "flex",
|
|
221
|
-
children: /* @__PURE__ */
|
|
222
|
-
label:
|
|
223
|
-
iconBefore: /* @__PURE__ */
|
|
224
|
-
size:
|
|
197
|
+
children: /* @__PURE__ */ R(oe, {
|
|
198
|
+
label: v?.logOutLabel ?? "Log out",
|
|
199
|
+
iconBefore: /* @__PURE__ */ R(te, {
|
|
200
|
+
size: ie.MD,
|
|
225
201
|
stroke: A
|
|
226
202
|
}),
|
|
227
|
-
onClick: () =>
|
|
228
|
-
disabled: n ||
|
|
203
|
+
onClick: () => w(!0),
|
|
204
|
+
disabled: n || x
|
|
229
205
|
})
|
|
230
|
-
}) : /* @__PURE__ */
|
|
206
|
+
}) : /* @__PURE__ */ R("div", {
|
|
231
207
|
className: "flex",
|
|
232
|
-
children: /* @__PURE__ */
|
|
233
|
-
label:
|
|
234
|
-
iconBefore: /* @__PURE__ */
|
|
235
|
-
size:
|
|
208
|
+
children: /* @__PURE__ */ R(oe, {
|
|
209
|
+
label: v?.logInLabel ?? "Log in",
|
|
210
|
+
iconBefore: /* @__PURE__ */ R(ee, {
|
|
211
|
+
size: ie.MD,
|
|
236
212
|
stroke: A
|
|
237
213
|
}),
|
|
238
|
-
onClick:
|
|
239
|
-
disabled: !
|
|
214
|
+
onClick: L,
|
|
215
|
+
disabled: !O
|
|
240
216
|
})
|
|
241
217
|
});
|
|
242
|
-
return /* @__PURE__ */
|
|
218
|
+
return /* @__PURE__ */ z("section", {
|
|
243
219
|
className: "flex flex-col gap-2",
|
|
244
220
|
children: [
|
|
245
|
-
/* @__PURE__ */
|
|
246
|
-
className:
|
|
247
|
-
children:
|
|
221
|
+
/* @__PURE__ */ R("h3", {
|
|
222
|
+
className: y,
|
|
223
|
+
children: v?.sectionTitle ?? "Authentication"
|
|
248
224
|
}),
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
"aria-label":
|
|
225
|
+
/* @__PURE__ */ R(I, {
|
|
226
|
+
"aria-label": v?.sectionTitle ?? "Authentication",
|
|
251
227
|
value: e.authenticationType,
|
|
252
|
-
onChange: (e) =>
|
|
228
|
+
onChange: (e) => ae(e),
|
|
253
229
|
segmentClassName: "px-2",
|
|
254
230
|
items: [
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
231
|
+
s.None,
|
|
232
|
+
s.OAuth,
|
|
233
|
+
s.ApiKey
|
|
258
234
|
].map((t) => {
|
|
259
|
-
let n =
|
|
235
|
+
let n = H[t];
|
|
260
236
|
return {
|
|
261
237
|
value: t,
|
|
262
|
-
label: /* @__PURE__ */
|
|
238
|
+
label: /* @__PURE__ */ z("div", {
|
|
263
239
|
className: "flex items-center gap-2",
|
|
264
|
-
children: [/* @__PURE__ */
|
|
240
|
+
children: [/* @__PURE__ */ R(n, {
|
|
265
241
|
className: "shrink-0",
|
|
266
|
-
size:
|
|
242
|
+
size: ie.SM,
|
|
267
243
|
stroke: A,
|
|
268
244
|
"aria-hidden": !0
|
|
269
|
-
}), /* @__PURE__ */
|
|
245
|
+
}), /* @__PURE__ */ R("span", {
|
|
270
246
|
className: "sr-only desktop:not-sr-only",
|
|
271
|
-
children:
|
|
247
|
+
children: Q(t, v)
|
|
272
248
|
})]
|
|
273
249
|
}),
|
|
274
|
-
disabled:
|
|
250
|
+
disabled: E && e.authenticationType !== t
|
|
275
251
|
};
|
|
276
252
|
})
|
|
277
253
|
}),
|
|
278
|
-
e.authenticationType ===
|
|
279
|
-
className: "
|
|
280
|
-
children:
|
|
254
|
+
e.authenticationType === s.None && /* @__PURE__ */ R("p", {
|
|
255
|
+
className: _("pt-2", b, _e.openAccessDescription),
|
|
256
|
+
children: v?.openAccessDescription ?? "Open endpoint, no credentials"
|
|
281
257
|
}),
|
|
282
|
-
e.authenticationType ===
|
|
258
|
+
e.authenticationType === s.OAuth && /* @__PURE__ */ z("div", {
|
|
283
259
|
className: "flex flex-col gap-3 pt-2",
|
|
284
260
|
children: [
|
|
285
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ z("div", {
|
|
286
262
|
className: "flex flex-col gap-2",
|
|
287
|
-
children: [/* @__PURE__ */
|
|
263
|
+
children: [/* @__PURE__ */ R(P, {
|
|
288
264
|
name: "oauth-login-mode",
|
|
289
265
|
id: "oauth-with-login",
|
|
290
|
-
value:
|
|
291
|
-
labelProps: { label:
|
|
292
|
-
isSelected: e.withLogin ===
|
|
293
|
-
disabled:
|
|
294
|
-
onChange:
|
|
295
|
-
}), /* @__PURE__ */
|
|
266
|
+
value: l.WithLogin,
|
|
267
|
+
labelProps: { label: v?.withLoginOAuthLabel ?? "Standard login" },
|
|
268
|
+
isSelected: e.withLogin === l.WithLogin,
|
|
269
|
+
disabled: E,
|
|
270
|
+
onChange: M
|
|
271
|
+
}), /* @__PURE__ */ R(P, {
|
|
296
272
|
name: "oauth-login-mode",
|
|
297
273
|
id: "oauth-with-config",
|
|
298
|
-
value:
|
|
299
|
-
labelProps: { label:
|
|
300
|
-
isSelected: e.withLogin ===
|
|
301
|
-
disabled:
|
|
302
|
-
onChange:
|
|
274
|
+
value: l.WithConfig,
|
|
275
|
+
labelProps: { label: v?.withConfigOAuthLabel ?? "Custom login" },
|
|
276
|
+
isSelected: e.withLogin === l.WithConfig,
|
|
277
|
+
disabled: E,
|
|
278
|
+
onChange: M
|
|
303
279
|
})]
|
|
304
280
|
}),
|
|
305
|
-
e.withLogin ===
|
|
281
|
+
e.withLogin === l.WithConfig && /* @__PURE__ */ z("div", {
|
|
306
282
|
className: "flex flex-col gap-3",
|
|
307
283
|
children: [
|
|
308
|
-
/* @__PURE__ */
|
|
284
|
+
/* @__PURE__ */ R(j, {
|
|
309
285
|
id: "toolset-client-id",
|
|
310
286
|
value: e.clientId ?? "",
|
|
311
|
-
onChange: (e) =>
|
|
287
|
+
onChange: (e) => h({ clientId: e ?? "" }),
|
|
312
288
|
labelProps: {
|
|
313
|
-
label:
|
|
289
|
+
label: v?.clientIdLabel ?? "Client ID",
|
|
314
290
|
required: !0
|
|
315
291
|
},
|
|
316
|
-
placeholder:
|
|
292
|
+
placeholder: v?.clientIdPlaceholder ?? "Enter client ID",
|
|
317
293
|
error: t.clientId || void 0,
|
|
318
294
|
invalid: !!t.clientId,
|
|
319
|
-
disabled:
|
|
295
|
+
disabled: E
|
|
320
296
|
}),
|
|
321
|
-
/* @__PURE__ */
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
297
|
+
/* @__PURE__ */ z("div", {
|
|
298
|
+
className: "flex flex-col gap-1",
|
|
299
|
+
children: [/* @__PURE__ */ R(N, {
|
|
300
|
+
id: "toolset-client-secret",
|
|
301
|
+
value: e.clientSecret ?? "",
|
|
302
|
+
onChange: (e) => h({ clientSecret: e ?? "" }),
|
|
303
|
+
labelProps: {
|
|
304
|
+
label: v?.clientSecretLabel ?? "Client secret",
|
|
305
|
+
required: !i
|
|
306
|
+
},
|
|
307
|
+
placeholder: D == null ? v?.clientSecretPlaceholder ?? "Enter client secret" : (v?.clientSecretHintPlaceholder ?? ve)(D),
|
|
308
|
+
"aria-describedby": D == null ? void 0 : Z,
|
|
309
|
+
showPasswordLabel: v?.showClientSecretLabel ?? "Show client secret",
|
|
310
|
+
hidePasswordLabel: v?.hideClientSecretLabel ?? "Hide client secret",
|
|
311
|
+
error: t.clientSecret || void 0,
|
|
312
|
+
invalid: !!t.clientSecret,
|
|
313
|
+
disabled: E
|
|
314
|
+
}), D != null && /* @__PURE__ */ R(k, {
|
|
315
|
+
id: Z,
|
|
316
|
+
text: v?.clientSecretKeepCaption ?? "Leave empty to keep the saved secret."
|
|
317
|
+
})]
|
|
335
318
|
}),
|
|
336
|
-
/* @__PURE__ */
|
|
319
|
+
/* @__PURE__ */ R(j, {
|
|
337
320
|
id: "toolset-authorization-endpoint",
|
|
338
321
|
value: e.authorizationEndpoint ?? "",
|
|
339
|
-
onChange: (e) =>
|
|
340
|
-
labelProps: {
|
|
341
|
-
|
|
322
|
+
onChange: (e) => h({ authorizationEndpoint: e ?? "" }),
|
|
323
|
+
labelProps: {
|
|
324
|
+
label: v?.authorizationEndpointLabel ?? "Authorization endpoint",
|
|
325
|
+
required: !0
|
|
326
|
+
},
|
|
327
|
+
placeholder: v?.authorizationEndpointPlaceholder ?? "Enter authorization endpoint",
|
|
342
328
|
error: t.authorizationEndpoint || void 0,
|
|
343
329
|
invalid: !!t.authorizationEndpoint,
|
|
344
|
-
disabled:
|
|
330
|
+
disabled: E
|
|
345
331
|
}),
|
|
346
|
-
/* @__PURE__ */
|
|
332
|
+
/* @__PURE__ */ R(j, {
|
|
347
333
|
id: "toolset-token-endpoint",
|
|
348
334
|
value: e.tokenEndpoint ?? "",
|
|
349
|
-
onChange: (e) =>
|
|
350
|
-
labelProps: {
|
|
351
|
-
|
|
335
|
+
onChange: (e) => h({ tokenEndpoint: e ?? "" }),
|
|
336
|
+
labelProps: {
|
|
337
|
+
label: v?.tokenEndpointLabel ?? "Token endpoint",
|
|
338
|
+
required: !0
|
|
339
|
+
},
|
|
340
|
+
placeholder: v?.tokenEndpointPlaceholder ?? "Enter token endpoint",
|
|
352
341
|
error: t.tokenEndpoint || void 0,
|
|
353
342
|
invalid: !!t.tokenEndpoint,
|
|
354
|
-
disabled:
|
|
343
|
+
disabled: E
|
|
355
344
|
}),
|
|
356
|
-
/* @__PURE__ */
|
|
345
|
+
/* @__PURE__ */ R(se, {
|
|
357
346
|
id: "toolset-scopes",
|
|
358
|
-
labelProps: { label:
|
|
359
|
-
placeholder:
|
|
347
|
+
labelProps: { label: v?.scopesLabel ?? "Scopes" },
|
|
348
|
+
placeholder: v?.scopesPlaceholder ?? "Enter scopes",
|
|
360
349
|
value: e.scopes ?? [],
|
|
361
|
-
onChange: (e) =>
|
|
362
|
-
disabled:
|
|
363
|
-
tagClassName:
|
|
350
|
+
onChange: (e) => h({ scopes: e }),
|
|
351
|
+
disabled: E,
|
|
352
|
+
tagClassName: m
|
|
353
|
+
}),
|
|
354
|
+
/* @__PURE__ */ R(j, {
|
|
355
|
+
id: "toolset-resource",
|
|
356
|
+
value: e.resource ?? "",
|
|
357
|
+
onChange: (e) => h({ resource: e ?? "" }),
|
|
358
|
+
labelProps: { label: v?.resourceLabel ?? "Resource" },
|
|
359
|
+
placeholder: v?.resourcePlaceholder ?? "Enter resource URI",
|
|
360
|
+
error: t.resource || void 0,
|
|
361
|
+
invalid: !!t.resource,
|
|
362
|
+
disabled: E
|
|
364
363
|
})
|
|
365
364
|
]
|
|
366
365
|
}),
|
|
367
|
-
|
|
366
|
+
V()
|
|
368
367
|
]
|
|
369
368
|
}),
|
|
370
|
-
e.authenticationType ===
|
|
369
|
+
e.authenticationType === s.ApiKey && /* @__PURE__ */ z("div", {
|
|
371
370
|
className: "flex flex-col gap-3 pt-2",
|
|
372
371
|
children: [
|
|
373
|
-
/* @__PURE__ */
|
|
372
|
+
/* @__PURE__ */ z("div", {
|
|
374
373
|
className: "flex flex-col gap-2",
|
|
375
|
-
children: [/* @__PURE__ */
|
|
374
|
+
children: [/* @__PURE__ */ R(P, {
|
|
376
375
|
name: "apikey-login-mode",
|
|
377
376
|
id: "apikey-with-login",
|
|
378
|
-
value:
|
|
379
|
-
labelProps: { label:
|
|
380
|
-
isSelected: e.withLogin ===
|
|
381
|
-
disabled:
|
|
382
|
-
onChange:
|
|
383
|
-
}), /* @__PURE__ */
|
|
377
|
+
value: l.WithLogin,
|
|
378
|
+
labelProps: { label: v?.withLoginLabel ?? "With login" },
|
|
379
|
+
isSelected: e.withLogin === l.WithLogin,
|
|
380
|
+
disabled: E,
|
|
381
|
+
onChange: M
|
|
382
|
+
}), /* @__PURE__ */ R(P, {
|
|
384
383
|
name: "apikey-login-mode",
|
|
385
384
|
id: "apikey-without-login",
|
|
386
|
-
value:
|
|
387
|
-
labelProps: { label:
|
|
388
|
-
isSelected: e.withLogin ===
|
|
389
|
-
disabled:
|
|
390
|
-
onChange:
|
|
385
|
+
value: l.WithoutLogin,
|
|
386
|
+
labelProps: { label: v?.withoutLoginLabel ?? "Without login" },
|
|
387
|
+
isSelected: e.withLogin === l.WithoutLogin,
|
|
388
|
+
disabled: E,
|
|
389
|
+
onChange: M
|
|
391
390
|
})]
|
|
392
391
|
}),
|
|
393
|
-
/* @__PURE__ */
|
|
392
|
+
/* @__PURE__ */ z("div", {
|
|
394
393
|
className: "flex flex-col gap-3",
|
|
395
|
-
children: [/* @__PURE__ */
|
|
394
|
+
children: [/* @__PURE__ */ R(j, {
|
|
396
395
|
id: "toolset-key-header",
|
|
397
396
|
value: e.keyHeader ?? "",
|
|
398
|
-
onChange: (e) =>
|
|
397
|
+
onChange: (e) => h({ keyHeader: e ?? "" }),
|
|
399
398
|
labelProps: {
|
|
400
|
-
label:
|
|
399
|
+
label: v?.keyHeaderLabel ?? "API Key parameter name",
|
|
401
400
|
required: !0
|
|
402
401
|
},
|
|
403
|
-
placeholder:
|
|
402
|
+
placeholder: v?.keyHeaderPlaceholder ?? "Enter API key parameter name",
|
|
404
403
|
error: t.keyHeader || void 0,
|
|
405
404
|
invalid: !!t.keyHeader,
|
|
406
|
-
disabled:
|
|
407
|
-
}), e.withLogin ===
|
|
405
|
+
disabled: E
|
|
406
|
+
}), e.withLogin === l.WithLogin && /* @__PURE__ */ R(N, {
|
|
408
407
|
id: "toolset-api-key",
|
|
409
408
|
value: e.apiKey ?? "",
|
|
410
|
-
onChange: (e) =>
|
|
409
|
+
onChange: (e) => h({ apiKey: e ?? "" }),
|
|
411
410
|
labelProps: {
|
|
412
|
-
label:
|
|
411
|
+
label: v?.apiKeyLabel ?? "API key",
|
|
413
412
|
required: !0
|
|
414
413
|
},
|
|
415
|
-
placeholder:
|
|
416
|
-
showPasswordLabel:
|
|
417
|
-
hidePasswordLabel:
|
|
414
|
+
placeholder: v?.apiKeyPlaceholder ?? "Enter API key",
|
|
415
|
+
showPasswordLabel: v?.showApiKeyLabel ?? "Show API key",
|
|
416
|
+
hidePasswordLabel: v?.hideApiKeyLabel ?? "Hide API key",
|
|
418
417
|
error: t.apiKey || void 0,
|
|
419
418
|
invalid: !!t.apiKey,
|
|
420
|
-
disabled:
|
|
419
|
+
disabled: E
|
|
421
420
|
})]
|
|
422
421
|
}),
|
|
423
|
-
e.withLogin !==
|
|
422
|
+
e.withLogin !== l.WithoutLogin && V()
|
|
424
423
|
]
|
|
425
424
|
}),
|
|
426
|
-
|
|
427
|
-
open:
|
|
428
|
-
header:
|
|
429
|
-
description:
|
|
430
|
-
confirmLabel:
|
|
431
|
-
cancelLabel:
|
|
432
|
-
variant:
|
|
433
|
-
isLoading:
|
|
434
|
-
disableConfirmButton:
|
|
435
|
-
onConfirm:
|
|
436
|
-
onCancel: () =>
|
|
437
|
-
onClose: () =>
|
|
425
|
+
C && /* @__PURE__ */ R(ne, {
|
|
426
|
+
open: C,
|
|
427
|
+
header: v?.logoutConfirmTitle ?? "Log out?",
|
|
428
|
+
description: v?.logoutConfirmDescription ?? "Are you sure you want to log out? You will need to re-enter your credentials to use this toolset again.",
|
|
429
|
+
confirmLabel: v?.logOutLabel ?? "Log out",
|
|
430
|
+
cancelLabel: v?.cancelLabel ?? "Cancel",
|
|
431
|
+
variant: re.Danger,
|
|
432
|
+
isLoading: x,
|
|
433
|
+
disableConfirmButton: x,
|
|
434
|
+
onConfirm: B,
|
|
435
|
+
onCancel: () => w(!1),
|
|
436
|
+
onClose: () => w(!1)
|
|
438
437
|
})
|
|
439
438
|
]
|
|
440
439
|
});
|
|
441
|
-
},
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
440
|
+
}, xe = {
|
|
441
|
+
title: "_title_17wsg_1",
|
|
442
|
+
description: "_description_17wsg_5"
|
|
443
|
+
}, Se = b(({ url: e, className: t, labels: n, titleClassName: r = "dial-body-semi-text", descriptionClassName: i = "dial-small-text" }) => {
|
|
444
|
+
let { isCopied: a, copy: o } = v(e), s = n?.copiedLabel ?? "Copied!";
|
|
445
|
+
return /* @__PURE__ */ z("div", {
|
|
446
|
+
className: _("flex flex-col gap-3", t),
|
|
445
447
|
children: [
|
|
446
|
-
/* @__PURE__ */
|
|
448
|
+
/* @__PURE__ */ z("div", {
|
|
447
449
|
className: "flex flex-col gap-1",
|
|
448
|
-
children: [/* @__PURE__ */
|
|
449
|
-
className: "
|
|
450
|
+
children: [/* @__PURE__ */ R("p", {
|
|
451
|
+
className: _("text-start", r, xe.title),
|
|
450
452
|
children: n?.title ?? "Connect toolset"
|
|
451
|
-
}), /* @__PURE__ */
|
|
452
|
-
className: "
|
|
453
|
+
}), /* @__PURE__ */ R("p", {
|
|
454
|
+
className: _("text-start", i, xe.description),
|
|
453
455
|
children: n?.description ?? "Copy endpoint URL to easily integrate toolset into your workflows"
|
|
454
456
|
})]
|
|
455
457
|
}),
|
|
456
|
-
/* @__PURE__ */
|
|
457
|
-
copiedLabel:
|
|
458
|
+
/* @__PURE__ */ R("div", { children: /* @__PURE__ */ R(d, {
|
|
459
|
+
copiedLabel: s,
|
|
458
460
|
copyLabel: n?.copyLabel ?? "Copy URL",
|
|
459
|
-
isCopied:
|
|
460
|
-
onClick:
|
|
461
|
+
isCopied: a,
|
|
462
|
+
onClick: o
|
|
461
463
|
}) }),
|
|
462
|
-
/* @__PURE__ */
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
children: r ? a : ""
|
|
464
|
+
/* @__PURE__ */ R(ae, {
|
|
465
|
+
visuallyHidden: !0,
|
|
466
|
+
as: M.Span,
|
|
467
|
+
children: a ? s : ""
|
|
467
468
|
})
|
|
468
469
|
]
|
|
469
470
|
});
|
|
470
|
-
}),
|
|
471
|
-
let [
|
|
472
|
-
value:
|
|
471
|
+
}), Ce = { connectDivider: "_connectDivider_obfkd_1" }, we = ({ form: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, connectUrl: a, listToolNames: o, authActions: s, onOAuthLogin: c, onNotifySuccess: l, onNotifyError: u, onChange: d, onAuthChange: f, onEnsureSaved: p, labels: h, colors: v, typography: y }) => {
|
|
472
|
+
let [b, x] = T(null), w = !!a && !!r, E = C(() => [{
|
|
473
|
+
value: V.Http,
|
|
473
474
|
label: "HTTP"
|
|
474
475
|
}, {
|
|
475
|
-
value:
|
|
476
|
+
value: V.Sse,
|
|
476
477
|
label: "SSE"
|
|
477
478
|
}], []);
|
|
478
479
|
return S(() => {
|
|
479
|
-
if (!r || !o || !
|
|
480
|
-
|
|
480
|
+
if (!r || !o || !J(e.auth, i)) {
|
|
481
|
+
x(null);
|
|
481
482
|
return;
|
|
482
483
|
}
|
|
483
484
|
let t = !1;
|
|
484
485
|
return (async () => {
|
|
485
486
|
try {
|
|
486
487
|
let e = await o(r);
|
|
487
|
-
t ||
|
|
488
|
+
t || x(e.length > 0 ? e : null);
|
|
488
489
|
} catch {
|
|
489
|
-
t ||
|
|
490
|
+
t || x(null);
|
|
490
491
|
}
|
|
491
492
|
})(), () => {
|
|
492
493
|
t = !0;
|
|
@@ -497,56 +498,62 @@ var ce = {
|
|
|
497
498
|
e.auth,
|
|
498
499
|
e.endpoint,
|
|
499
500
|
o
|
|
500
|
-
]), /* @__PURE__ */
|
|
501
|
+
]), /* @__PURE__ */ z("div", {
|
|
501
502
|
className: "flex max-w-[1060px] flex-col gap-4",
|
|
503
|
+
style: g({
|
|
504
|
+
"--te-connect-title": v?.connectTitle,
|
|
505
|
+
"--te-connect-description": v?.connectDescription,
|
|
506
|
+
"--te-connect-divider": v?.connectDivider,
|
|
507
|
+
"--te-open-access-description": v?.openAccessDescription
|
|
508
|
+
}),
|
|
502
509
|
children: [
|
|
503
|
-
/* @__PURE__ */
|
|
510
|
+
/* @__PURE__ */ R(j, {
|
|
504
511
|
id: "toolset-endpoint",
|
|
505
512
|
value: e.endpoint,
|
|
506
513
|
onChange: (e) => d({ endpoint: e ?? "" }),
|
|
507
514
|
labelProps: {
|
|
508
|
-
label:
|
|
515
|
+
label: h?.endpointLabel ?? "Endpoint",
|
|
509
516
|
required: !0
|
|
510
517
|
},
|
|
511
|
-
placeholder:
|
|
512
|
-
caption:
|
|
518
|
+
placeholder: h?.endpointPlaceholder ?? "https://...",
|
|
519
|
+
caption: h?.endpointCaption ?? "The HTTPS address where the server accepts MCP requests. Choose the transport under Protocol below.",
|
|
513
520
|
error: t.endpoint || void 0,
|
|
514
521
|
invalid: !!t.endpoint
|
|
515
522
|
}),
|
|
516
|
-
/* @__PURE__ */
|
|
523
|
+
/* @__PURE__ */ R(F, {
|
|
517
524
|
labelProps: {
|
|
518
|
-
label:
|
|
525
|
+
label: h?.protocolLabel ?? "Protocol",
|
|
519
526
|
required: !0
|
|
520
527
|
},
|
|
521
528
|
id: "toolset-protocol",
|
|
522
|
-
items:
|
|
529
|
+
items: E,
|
|
523
530
|
value: e.protocol,
|
|
524
531
|
onChange: (e) => {
|
|
525
532
|
d({ protocol: e });
|
|
526
533
|
}
|
|
527
534
|
}),
|
|
528
|
-
|
|
535
|
+
b ? /* @__PURE__ */ R(L, {
|
|
529
536
|
id: "toolset-allowed-tools",
|
|
530
537
|
multiple: !0,
|
|
531
538
|
searchable: !0,
|
|
532
539
|
selectAll: !0,
|
|
533
|
-
labelProps: { label:
|
|
534
|
-
placeholder:
|
|
535
|
-
options:
|
|
540
|
+
labelProps: { label: h?.allowedToolsLabel ?? "Allowed tools" },
|
|
541
|
+
placeholder: h?.allowedToolsSelectPlaceholder ?? "Select allowed tools",
|
|
542
|
+
options: b.map((e) => ({
|
|
536
543
|
value: e,
|
|
537
544
|
label: e
|
|
538
545
|
})),
|
|
539
546
|
value: e.allowedTools,
|
|
540
547
|
onChange: (e) => d({ allowedTools: e })
|
|
541
|
-
}) : /* @__PURE__ */
|
|
548
|
+
}) : /* @__PURE__ */ R(se, {
|
|
542
549
|
id: "toolset-allowed-tools",
|
|
543
|
-
labelProps: { label:
|
|
544
|
-
placeholder:
|
|
550
|
+
labelProps: { label: h?.allowedToolsLabel ?? "Allowed tools" },
|
|
551
|
+
placeholder: h?.allowedToolsPlaceholder ?? "Add tools, comma separated",
|
|
545
552
|
value: e.allowedTools,
|
|
546
553
|
onChange: (e) => d({ allowedTools: e }),
|
|
547
|
-
tagClassName:
|
|
554
|
+
tagClassName: m
|
|
548
555
|
}),
|
|
549
|
-
/* @__PURE__ */
|
|
556
|
+
/* @__PURE__ */ R(be, {
|
|
550
557
|
auth: e.auth,
|
|
551
558
|
errors: t,
|
|
552
559
|
isSaving: n,
|
|
@@ -559,209 +566,217 @@ var ce = {
|
|
|
559
566
|
onNotifyError: u,
|
|
560
567
|
onAuthChange: f,
|
|
561
568
|
onEnsureSaved: p,
|
|
562
|
-
labels:
|
|
569
|
+
labels: h?.auth,
|
|
570
|
+
titleClassName: y?.authTitleClassName,
|
|
571
|
+
openAccessDescriptionClassName: y?.openAccessDescriptionClassName
|
|
563
572
|
}),
|
|
564
|
-
|
|
573
|
+
w && /* @__PURE__ */ R(Se, {
|
|
565
574
|
url: a ?? "",
|
|
566
|
-
labels:
|
|
567
|
-
|
|
575
|
+
labels: h?.connect,
|
|
576
|
+
titleClassName: y?.connectTitleClassName,
|
|
577
|
+
descriptionClassName: y?.connectDescriptionClassName,
|
|
578
|
+
className: _("border-t pt-4", Ce.connectDivider)
|
|
568
579
|
})
|
|
569
580
|
]
|
|
570
581
|
});
|
|
571
|
-
},
|
|
582
|
+
}, Te = [
|
|
572
583
|
"keyHeader",
|
|
573
584
|
"apiKey",
|
|
574
585
|
"clientId",
|
|
575
586
|
"clientSecret",
|
|
576
587
|
"authorizationEndpoint",
|
|
577
|
-
"tokenEndpoint"
|
|
578
|
-
|
|
588
|
+
"tokenEndpoint",
|
|
589
|
+
"resource"
|
|
590
|
+
], Ee = ["endpoint", ...Te], $ = new Set(Ee), De = { validateVersionPattern: !0 }, Oe = (e) => {
|
|
579
591
|
let t = {};
|
|
580
|
-
for (let n of Object.keys(e))
|
|
592
|
+
for (let n of Object.keys(e)) $.has(n) && (t[n] = !0);
|
|
581
593
|
return t;
|
|
582
|
-
},
|
|
583
|
-
let N = !!
|
|
594
|
+
}, ke = ({ initialForm: e, toolsetId: o, onPersist: c, onPostSaveLogin: d, onToolsetsChanged: m, onSaveSuccess: g, onSaveComplete: _, onBack: v, onDirtyChange: b, buildMcpUrl: E, listToolNames: D, authActions: O, onOAuthLogin: ee, onNotifySuccess: te, onNotifyError: k, avatarPicker: ne, availableLocaleOptions: re, formatLocaleLabel: ie, onRefineDescription: A, labels: j, colors: ae, typography: M, isVersionReadOnly: oe = !1 }) => {
|
|
595
|
+
let N = !!o, [P, F] = T(""), I = o || P, [L, se] = T({
|
|
584
596
|
initialForm: e,
|
|
585
597
|
key: 0
|
|
586
|
-
}), [
|
|
598
|
+
}), [z, V] = T(e);
|
|
587
599
|
L.initialForm !== e && (se({
|
|
588
600
|
initialForm: e,
|
|
589
601
|
key: L.key + 1
|
|
590
|
-
}),
|
|
591
|
-
let { values:
|
|
592
|
-
initialValues:
|
|
593
|
-
validationOptions:
|
|
602
|
+
}), V(e));
|
|
603
|
+
let ce = C(() => he(e), [e]), { values: H, setValues: ue, markTouched: U, visibleErrorCodes: W, attemptSubmit: de } = a({
|
|
604
|
+
initialValues: ce,
|
|
605
|
+
validationOptions: De,
|
|
594
606
|
reseedKey: L.key
|
|
595
|
-
}), [
|
|
596
|
-
...
|
|
597
|
-
...
|
|
598
|
-
}), [
|
|
607
|
+
}), [fe, K] = T(e), q = C(() => ({
|
|
608
|
+
...fe,
|
|
609
|
+
...H
|
|
610
|
+
}), [fe, H]), J = C(() => JSON.stringify(q) !== JSON.stringify(z), [q, z]);
|
|
599
611
|
S(() => {
|
|
600
|
-
|
|
601
|
-
}, [
|
|
602
|
-
let [
|
|
612
|
+
b?.(J);
|
|
613
|
+
}, [J, b]);
|
|
614
|
+
let [Y, X] = T(!1), [_e, Z] = T({}), [ve, ye] = T({}), Q = w(null);
|
|
603
615
|
S(() => {
|
|
604
|
-
|
|
616
|
+
K(e), Q.current = e, Z({}), ye({}), F("");
|
|
605
617
|
}, [e]);
|
|
606
|
-
let
|
|
607
|
-
let { metadata: t, setup: n } =
|
|
608
|
-
Object.keys(t).length > 0 && (ue(t), "name" in t &&
|
|
618
|
+
let be = x((e) => {
|
|
619
|
+
let { metadata: t, setup: n } = ge(e);
|
|
620
|
+
Object.keys(t).length > 0 && (ue(t), "name" in t && U(r.Name), "version" in t && U(r.Version)), Object.keys(n).length !== 0 && (K((e) => ({
|
|
609
621
|
...e,
|
|
610
622
|
...n
|
|
611
|
-
})),
|
|
623
|
+
})), ye((e) => ({
|
|
612
624
|
...e,
|
|
613
|
-
...
|
|
614
|
-
})),
|
|
625
|
+
...Oe(n)
|
|
626
|
+
})), Z((e) => {
|
|
615
627
|
let t = { ...e };
|
|
616
628
|
for (let e of Object.keys(n)) delete t[e];
|
|
617
629
|
return t;
|
|
618
630
|
}));
|
|
619
|
-
}, [ue,
|
|
620
|
-
|
|
631
|
+
}, [ue, U]), xe = x((e) => {
|
|
632
|
+
K((t) => ({
|
|
621
633
|
...t,
|
|
622
634
|
auth: {
|
|
623
635
|
...t.auth,
|
|
624
636
|
...e
|
|
625
637
|
}
|
|
626
|
-
})),
|
|
638
|
+
})), ye((t) => ({
|
|
627
639
|
...t,
|
|
628
|
-
...
|
|
629
|
-
})),
|
|
640
|
+
...Oe(e)
|
|
641
|
+
})), Z((t) => {
|
|
630
642
|
let n = { ...t };
|
|
631
|
-
if ("authenticationType" in e || "withLogin" in e || "isLoggedIn" in e) for (let e of
|
|
643
|
+
if ("authenticationType" in e || "withLogin" in e || "isLoggedIn" in e) for (let e of Te) delete n[e];
|
|
632
644
|
else for (let t of Object.keys(e)) delete n[t];
|
|
633
645
|
return n;
|
|
634
|
-
}), "isLoggedIn" in e &&
|
|
635
|
-
}, [
|
|
636
|
-
if (I &&
|
|
637
|
-
|
|
646
|
+
}), "isLoggedIn" in e && m();
|
|
647
|
+
}, [m]), Se = x(async () => {
|
|
648
|
+
if (I && Q.current != null && JSON.stringify(Q.current) === JSON.stringify(q)) return I;
|
|
649
|
+
X(!0);
|
|
638
650
|
try {
|
|
639
|
-
let e = await
|
|
640
|
-
return e ? (I || F(e),
|
|
651
|
+
let e = await c(q, I);
|
|
652
|
+
return e ? (I || F(e), Q.current = q, V(q), b?.(!1), await m(), e) : null;
|
|
641
653
|
} catch {
|
|
642
654
|
return null;
|
|
643
655
|
} finally {
|
|
644
|
-
|
|
656
|
+
X(!1);
|
|
645
657
|
}
|
|
646
658
|
}, [
|
|
647
|
-
|
|
659
|
+
q,
|
|
648
660
|
I,
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
]),
|
|
653
|
-
let t =
|
|
654
|
-
return e.endpoint.trim() ?
|
|
655
|
-
}, [
|
|
656
|
-
let e = de(), t = $(
|
|
657
|
-
if (!e || Object.keys(t).length > 0)
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
}
|
|
661
|
-
Y({}), J(!0);
|
|
662
|
-
try {
|
|
663
|
-
let e = await a(K, I);
|
|
664
|
-
if (!e) return;
|
|
665
|
-
z(K), await l(), d(K);
|
|
661
|
+
c,
|
|
662
|
+
m,
|
|
663
|
+
b
|
|
664
|
+
]), Ce = x(async () => await Se() ?? !1, [Se]), $ = x((e) => {
|
|
665
|
+
let t = j?.validation, n = {};
|
|
666
|
+
return e.endpoint.trim() ? G(e.endpoint) || (n.endpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL") : n.endpoint = t?.endpointRequired ?? "Endpoint is required", e.auth.isLoggedIn || (e.auth.authenticationType === s.ApiKey && (e.auth.keyHeader?.trim() || (n.keyHeader = t?.keyHeaderRequired ?? "Key name is required"), e.auth.withLogin === l.WithLogin && !e.auth.apiKey?.trim() && (n.apiKey = t?.apiKeyRequired ?? "API key is required")), e.auth.authenticationType === s.OAuth && e.auth.withLogin === l.WithConfig && (e.auth.clientId?.trim() || (n.clientId = t?.clientIdRequired ?? "Client ID is required"), !N && !e.auth.clientSecret?.trim() && (n.clientSecret = t?.clientSecretRequired ?? "Client secret is required"), e.auth.authorizationEndpoint?.trim() ? G(e.auth.authorizationEndpoint) || (n.authorizationEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL") : n.authorizationEndpoint = t?.authorizationEndpointRequired ?? "Authorization endpoint is required", e.auth.tokenEndpoint?.trim() ? G(e.auth.tokenEndpoint) || (n.tokenEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL") : n.tokenEndpoint = t?.tokenEndpointRequired ?? "Token endpoint is required", pe(e.auth.resource) || (n.resource = t?.resourceInvalid ?? "Enter an absolute URI without a fragment"))), n;
|
|
667
|
+
}, [j, N]), ke = x(async () => {
|
|
668
|
+
let e = de(), t = $(q);
|
|
669
|
+
if (!e || Object.keys(t).length > 0) Z(t);
|
|
670
|
+
else {
|
|
671
|
+
Z({}), X(!0);
|
|
666
672
|
try {
|
|
667
|
-
await
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
673
|
+
let e = await c(q, I);
|
|
674
|
+
if (!e) return;
|
|
675
|
+
V(q), await m(), g(q);
|
|
676
|
+
try {
|
|
677
|
+
await d(e, q.auth), _();
|
|
678
|
+
} catch (e) {
|
|
679
|
+
let { traceId: t } = await u(e);
|
|
680
|
+
k(j?.settings?.auth?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
|
|
681
|
+
}
|
|
682
|
+
} catch {} finally {
|
|
683
|
+
X(!1);
|
|
671
684
|
}
|
|
672
|
-
} catch {} finally {
|
|
673
|
-
J(!1);
|
|
674
685
|
}
|
|
675
686
|
}, [
|
|
676
687
|
de,
|
|
677
|
-
|
|
688
|
+
q,
|
|
678
689
|
$,
|
|
679
690
|
I,
|
|
680
|
-
|
|
681
|
-
|
|
691
|
+
c,
|
|
692
|
+
m,
|
|
693
|
+
g,
|
|
694
|
+
_,
|
|
682
695
|
d,
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
onRefine: j,
|
|
691
|
-
disabled: q,
|
|
696
|
+
k,
|
|
697
|
+
j
|
|
698
|
+
]), Ae = y({
|
|
699
|
+
value: H.description,
|
|
700
|
+
onChange: (e) => be({ description: e }),
|
|
701
|
+
onRefine: A,
|
|
702
|
+
disabled: Y,
|
|
692
703
|
resetKey: L.key
|
|
693
|
-
}),
|
|
704
|
+
}), je = A ? (e, t) => /* @__PURE__ */ R(h, {
|
|
694
705
|
isEnabled: !0,
|
|
695
706
|
fieldId: t,
|
|
696
|
-
label:
|
|
697
|
-
labels:
|
|
698
|
-
refinement:
|
|
699
|
-
disabled:
|
|
707
|
+
label: j?.general?.form?.description.label ?? "Description",
|
|
708
|
+
labels: j?.refinement,
|
|
709
|
+
refinement: Ae,
|
|
710
|
+
disabled: Ae.isPending || Y,
|
|
700
711
|
children: e
|
|
701
|
-
}) : void 0,
|
|
702
|
-
|
|
703
|
-
|
|
712
|
+
}) : void 0, Me = C(() => ({
|
|
713
|
+
form: j?.general?.form ?? le,
|
|
714
|
+
avatarPicker: j?.general?.avatarPicker
|
|
715
|
+
}), [j?.general?.form, j?.general?.avatarPicker]), Ne = C(() => !me(q, N), [q, N]), Pe = C(() => {
|
|
716
|
+
let e = j?.validation, n = $(q), r = { ..._e };
|
|
717
|
+
for (let e of Ee) {
|
|
704
718
|
if (!ve[e]) continue;
|
|
705
719
|
let t = n[e];
|
|
706
720
|
t ? r[e] = t : delete r[e];
|
|
707
721
|
}
|
|
708
|
-
return
|
|
722
|
+
return W.name === t.Required ? r.name = e?.nameRequired ?? "Name is required" : W.name === t.TooLong ? r.name = e?.nameTooLong ?? `Use ${p} characters or fewer.` : W.name === t.ControlCharacters && (r.name = e?.nameControlCharacters ?? "Remove line breaks, tabs and other control characters."), W.description === t.TooLong && (r.description = e?.descriptionTooLong ?? `Use ${f} characters or fewer.`), W.version === t.InvalidFormat && (r.version = e?.versionInvalid ?? "Version may only contain letters, digits, dots, underscores, and dashes"), r;
|
|
709
723
|
}, [
|
|
710
724
|
ve,
|
|
711
725
|
_e,
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
726
|
+
q,
|
|
727
|
+
j,
|
|
728
|
+
W,
|
|
715
729
|
$
|
|
716
|
-
]),
|
|
717
|
-
return /* @__PURE__ */
|
|
718
|
-
title: N ?
|
|
719
|
-
onBack:
|
|
720
|
-
onCancel:
|
|
721
|
-
onSubmit:
|
|
722
|
-
submitLabel: N ?
|
|
723
|
-
isSubmitting:
|
|
724
|
-
isSubmitDisabled:
|
|
725
|
-
metadataSectionClassName:
|
|
726
|
-
setupSectionClassName:
|
|
730
|
+
]), Fe = E && I ? E(I) : void 0;
|
|
731
|
+
return /* @__PURE__ */ R(n, {
|
|
732
|
+
title: N ? j?.layout?.editTitle ?? "Edit toolset" : j?.layout?.createTitle ?? "Create toolset",
|
|
733
|
+
onBack: v,
|
|
734
|
+
onCancel: v,
|
|
735
|
+
onSubmit: ke,
|
|
736
|
+
submitLabel: N ? j?.layout?.saveLabel ?? "Save" : j?.layout?.createLabel ?? "Create",
|
|
737
|
+
isSubmitting: Y,
|
|
738
|
+
isSubmitDisabled: Ne || Ae.isPending,
|
|
739
|
+
metadataSectionClassName: B.metadataSection,
|
|
740
|
+
setupSectionClassName: B.setupSection,
|
|
727
741
|
labels: {
|
|
728
|
-
backAriaLabel:
|
|
729
|
-
savingStatusLabel:
|
|
730
|
-
metadataTitle:
|
|
731
|
-
setupTitle:
|
|
732
|
-
cancelLabel:
|
|
742
|
+
backAriaLabel: j?.layout?.backAriaLabel ?? "Back to catalog",
|
|
743
|
+
savingStatusLabel: j?.layout?.savingStatusLabel ?? "Saving",
|
|
744
|
+
metadataTitle: j?.layout?.metadataSectionTitle ?? "Metadata",
|
|
745
|
+
setupTitle: j?.layout?.setupSectionTitle ?? "Setup",
|
|
746
|
+
cancelLabel: j?.layout?.cancelLabel ?? "Cancel"
|
|
733
747
|
},
|
|
734
|
-
metadata: /* @__PURE__ */
|
|
735
|
-
|
|
736
|
-
errors:
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
labels: M?.general
|
|
748
|
+
metadata: /* @__PURE__ */ R(i, {
|
|
749
|
+
values: q,
|
|
750
|
+
errors: Pe,
|
|
751
|
+
onChange: be,
|
|
752
|
+
avatarPicker: ne,
|
|
753
|
+
availableLocaleOptions: re,
|
|
754
|
+
formatLocaleLabel: ie,
|
|
755
|
+
renderDescription: je,
|
|
756
|
+
labels: Me,
|
|
757
|
+
isVersionReadOnly: oe,
|
|
758
|
+
versionReadOnlyTooltip: j?.versionReadOnlyTooltip
|
|
746
759
|
}),
|
|
747
|
-
setup: /* @__PURE__ */
|
|
748
|
-
form:
|
|
749
|
-
errors:
|
|
750
|
-
isSaving:
|
|
760
|
+
setup: /* @__PURE__ */ R(we, {
|
|
761
|
+
form: q,
|
|
762
|
+
errors: Pe,
|
|
763
|
+
isSaving: Y,
|
|
751
764
|
toolsetId: I,
|
|
752
765
|
isEditMode: N,
|
|
753
|
-
connectUrl:
|
|
754
|
-
listToolNames:
|
|
755
|
-
authActions:
|
|
756
|
-
onOAuthLogin:
|
|
757
|
-
onNotifySuccess:
|
|
758
|
-
onNotifyError:
|
|
759
|
-
onChange:
|
|
760
|
-
onAuthChange:
|
|
761
|
-
onEnsureSaved:
|
|
762
|
-
labels:
|
|
766
|
+
connectUrl: Fe,
|
|
767
|
+
listToolNames: D,
|
|
768
|
+
authActions: O,
|
|
769
|
+
onOAuthLogin: ee,
|
|
770
|
+
onNotifySuccess: te,
|
|
771
|
+
onNotifyError: k,
|
|
772
|
+
onChange: be,
|
|
773
|
+
onAuthChange: xe,
|
|
774
|
+
onEnsureSaved: Ce,
|
|
775
|
+
labels: j?.settings,
|
|
776
|
+
colors: ae?.settings,
|
|
777
|
+
typography: M?.settings
|
|
763
778
|
})
|
|
764
779
|
});
|
|
765
780
|
};
|
|
766
781
|
//#endregion
|
|
767
|
-
export {
|
|
782
|
+
export { H as AUTH_TYPE_ICONS, ce as DEFAULT_TOOLSET_VERSION, B as TOOLSET_EDITOR_CLASS, ke as ToolsetEditor, X as ToolsetOAuthLoginStatus, V as ToolsetTransportType, U as getDefaultToolsetForm, J as isToolsetAuthValid, me as isToolsetFormValid, G as isValidEndpointUrl, q as normalizeReturnedEndpointUrl };
|