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