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