@epam/ai-dial-toolset-editor 1.3.0-dev.245 → 1.3.0-dev.248

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectMcpUrlContent.d.ts","sourceRoot":"","sources":["../../../src/components/ConnectMcpUrlContent/ConnectMcpUrlContent.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAEnF,UAAU,yBAAyB;IACjC,yCAAyC;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,MAAM,CAAC,EAAE,0BAA0B,CAAC;CACrC;;AAsCD,wBAA0C"}
1
+ {"version":3,"file":"ConnectMcpUrlContent.d.ts","sourceRoot":"","sources":["../../../src/components/ConnectMcpUrlContent/ConnectMcpUrlContent.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAEnF,UAAU,yBAAyB;IACjC,yCAAyC;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,MAAM,CAAC,EAAE,0BAA0B,CAAC;CACrC;;AAsCD,wBAA0C"}
package/index.js CHANGED
@@ -3,7 +3,7 @@ import { ToolsetAuthTypes as s, ToolsetCredentialsLevel as c, WithLogin as l, ge
3
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, mergeClasses as g, useCodeCopy as _, useTextRefinement as v } from "@epam/ai-dial-chat-shared";
4
4
  import { memo as y, useCallback as b, useEffect as x, useMemo as S, useRef as C, useState as w } from "react";
5
5
  import { IconBrandOauth as T, IconKey as E, IconLockOff as D, IconLogin as ee, IconLogout as te } from "@tabler/icons-react";
6
- import { CaptionText as ne, ConfirmationPopup as O, ConfirmationPopupVariant as re, DIAL_ICON_SIZE as k, DIAL_KIT_ICON_STROKE as A, Input as j, NeutralButton as M, PasswordInput as ie, Radio as N, RadioGroup as P, SegmentedControl as F, Select as ae, TagInput as I } from "@epam/ai-dial-ui-kit";
6
+ import { CaptionText as ne, ConfirmationPopup as O, ConfirmationPopupVariant as re, DIAL_ICON_SIZE as k, DIAL_KIT_ICON_STROKE as A, Input as j, LiveRegion as M, LiveRegionElement as ie, NeutralButton as N, PasswordInput as P, Radio as F, RadioGroup as ae, SegmentedControl as oe, Select as I, TagInput as se } from "@epam/ai-dial-ui-kit";
7
7
  import { jsx as L, jsxs as R } from "react/jsx-runtime";
8
8
  //#region src/constants/public-class-names.ts
9
9
  var z = {
@@ -11,7 +11,7 @@ var z = {
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
- }({}), V = e, oe = {
14
+ }({}), V = e, ce = {
15
15
  name: {
16
16
  label: "Name",
17
17
  placeholder: "Enter name"
@@ -54,11 +54,11 @@ var z = {
54
54
  [s.OAuth]: T,
55
55
  [s.ApiKey]: E,
56
56
  [s.None]: D
57
- }, U = () => ({
57
+ }, le = () => ({
58
58
  authenticationType: s.None,
59
59
  withLogin: l.WithoutLogin,
60
60
  isLoggedIn: !1
61
- }), W = () => ({
61
+ }), ue = () => ({
62
62
  name: "",
63
63
  version: V,
64
64
  iconUrl: "",
@@ -68,80 +68,80 @@ var z = {
68
68
  endpoint: "",
69
69
  protocol: B.Http,
70
70
  allowedTools: [],
71
- auth: U()
72
- }), G = (e) => {
71
+ auth: le()
72
+ }), U = (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
- }, K = (e) => G(e.trim()), se = (e) => e.replace(/^(https?):\/([^/])/, "$1://$2"), q = (e) => {
79
+ }, W = (e) => U(e.trim()), G = (e) => e.replace(/^(https?):\/([^/])/, "$1://$2"), de = (e) => {
80
80
  let t = e?.trim() ?? "";
81
- if (!t || G(t)) return t;
81
+ if (!t || U(t)) return t;
82
82
  let n = [t];
83
83
  try {
84
84
  let e = decodeURIComponent(t);
85
85
  e !== t && n.push(e);
86
86
  } catch {}
87
87
  for (let e of n) {
88
- let t = se(e);
89
- if (G(t)) return t;
88
+ let t = G(e);
89
+ if (U(t)) return t;
90
90
  }
91
91
  return t;
92
- }, 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()) && K(e.authorizationEndpoint ?? "") && K(e.tokenEndpoint ?? "") : !0, ce = (e, t = !1) => Object.keys(o(e, { validateVersionPattern: !0 })).length === 0 && K(e.endpoint) && J(e.auth, t), le = /* @__PURE__ */ new Set([
92
+ }, K = (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) && K(e.auth, t), q = /* @__PURE__ */ new Set([
93
93
  "name",
94
94
  "description",
95
95
  "iconUrl",
96
96
  "version",
97
97
  "topics",
98
98
  "otherLocales"
99
- ]), ue = (e) => ({
99
+ ]), pe = (e) => ({
100
100
  name: e.name,
101
101
  description: e.description,
102
102
  iconUrl: e.iconUrl,
103
103
  version: e.version,
104
104
  topics: e.topics,
105
105
  otherLocales: e.otherLocales
106
- }), de = (e) => {
106
+ }), me = (e) => {
107
107
  let t = {}, n = {};
108
- for (let [r, i] of Object.entries(e)) (le.has(r) ? t : n)[r] = i;
108
+ for (let [r, i] of Object.entries(e)) (q.has(r) ? t : n)[r] = i;
109
109
  return {
110
110
  metadata: t,
111
111
  setup: n
112
112
  };
113
- }, Y = /* @__PURE__ */ function(e) {
113
+ }, J = /* @__PURE__ */ function(e) {
114
114
  return e.Success = "success", e.Cancelled = "cancelled", e.PopupBlocked = "popup-blocked", e.InvalidConfig = "invalid-config", e.Failed = "failed", e;
115
- }({}), X = "toolset-client-secret-keep-caption", fe = (e) => `******${e}`, Z = (e) => e === s.None ? l.WithoutLogin : l.WithLogin, pe = (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: d, onNotifySuccess: f, onNotifyError: p, onAuthChange: h, onEnsureSaved: g, labels: _ }) => {
116
- let [v, y] = w(!1), [b, x] = w(!1), S = e.isLoggedIn || n || v, C = i && e.clientSecretHint && !e.clientSecret ? e.clientSecretHint : void 0, T = K(a) && J(e, i) && !S, E = (t) => {
115
+ }({}), Y = "toolset-client-secret-keep-caption", he = (e) => `******${e}`, X = (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: d, onNotifySuccess: f, onNotifyError: p, onAuthChange: h, onEnsureSaved: g, labels: _ }) => {
116
+ let [v, y] = w(!1), [b, x] = w(!1), S = e.isLoggedIn || n || v, C = i && e.clientSecretHint && !e.clientSecret ? e.clientSecretHint : void 0, T = W(a) && K(e, i) && !S, E = (t) => {
117
117
  S || t === e.authenticationType || h({
118
118
  authenticationType: t,
119
- withLogin: Z(t)
119
+ withLogin: X(t)
120
120
  });
121
121
  }, D = (e) => {
122
122
  h({ withLogin: e });
123
- }, P = (e) => {
123
+ }, M = (e) => {
124
124
  switch (e.auth != null && h(e.auth), e.status) {
125
- case Y.Success:
125
+ case J.Success:
126
126
  h({ isLoggedIn: !0 }), f(_?.loginSuccessMessage ?? "Successfully logged in.");
127
127
  return;
128
- case Y.PopupBlocked:
128
+ case J.PopupBlocked:
129
129
  p(_?.errorPopupBlocked ?? "The login popup was blocked by your browser. Please allow popups for this site and try again.");
130
130
  return;
131
- case Y.InvalidConfig:
131
+ case J.InvalidConfig:
132
132
  p(_?.errorOAuthConfigMissing ?? "The OAuth provider did not return a valid client configuration. Please check the endpoint or contact your administrator.");
133
133
  return;
134
- case Y.Failed:
134
+ case J.Failed:
135
135
  p(_?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", e.traceId);
136
136
  return;
137
- case Y.Cancelled: return;
137
+ case J.Cancelled: return;
138
138
  }
139
- }, ae = async () => {
139
+ }, ie = async () => {
140
140
  if (!T) return;
141
141
  if (e.authenticationType === s.OAuth) {
142
142
  y(!0);
143
143
  try {
144
- P(await d({
144
+ M(await d({
145
145
  auth: e,
146
146
  ensureSaved: g
147
147
  }));
@@ -168,7 +168,7 @@ var z = {
168
168
  y(!1);
169
169
  }
170
170
  }
171
- }, z = async () => {
171
+ }, ae = async () => {
172
172
  y(!0);
173
173
  try {
174
174
  let t = {
@@ -183,9 +183,9 @@ var z = {
183
183
  } finally {
184
184
  y(!1);
185
185
  }
186
- }, B = () => e.isLoggedIn ? /* @__PURE__ */ L("div", {
186
+ }, I = () => e.isLoggedIn ? /* @__PURE__ */ L("div", {
187
187
  className: "flex",
188
- children: /* @__PURE__ */ L(M, {
188
+ children: /* @__PURE__ */ L(N, {
189
189
  label: _?.logOutLabel ?? "Log out",
190
190
  iconBefore: /* @__PURE__ */ L(te, {
191
191
  size: k.MD,
@@ -196,13 +196,13 @@ var z = {
196
196
  })
197
197
  }) : /* @__PURE__ */ L("div", {
198
198
  className: "flex",
199
- children: /* @__PURE__ */ L(M, {
199
+ children: /* @__PURE__ */ L(N, {
200
200
  label: _?.logInLabel ?? "Log in",
201
201
  iconBefore: /* @__PURE__ */ L(ee, {
202
202
  size: k.MD,
203
203
  stroke: A
204
204
  }),
205
- onClick: ae,
205
+ onClick: ie,
206
206
  disabled: !T
207
207
  })
208
208
  });
@@ -213,7 +213,7 @@ var z = {
213
213
  className: "dial-h3-text",
214
214
  children: _?.sectionTitle ?? "Authentication"
215
215
  }),
216
- /* @__PURE__ */ L(F, {
216
+ /* @__PURE__ */ L(oe, {
217
217
  "aria-label": _?.sectionTitle ?? "Authentication",
218
218
  value: e.authenticationType,
219
219
  onChange: (e) => E(e),
@@ -235,7 +235,7 @@ var z = {
235
235
  "aria-hidden": !0
236
236
  }), /* @__PURE__ */ L("span", {
237
237
  className: "sr-only desktop:not-sr-only",
238
- children: pe(t, _)
238
+ children: Z(t, _)
239
239
  })]
240
240
  }),
241
241
  disabled: S && e.authenticationType !== t
@@ -251,7 +251,7 @@ var z = {
251
251
  children: [
252
252
  /* @__PURE__ */ R("div", {
253
253
  className: "flex flex-col gap-2",
254
- children: [/* @__PURE__ */ L(N, {
254
+ children: [/* @__PURE__ */ L(F, {
255
255
  name: "oauth-login-mode",
256
256
  id: "oauth-with-login",
257
257
  value: l.WithLogin,
@@ -259,7 +259,7 @@ var z = {
259
259
  isSelected: e.withLogin === l.WithLogin,
260
260
  disabled: S,
261
261
  onChange: D
262
- }), /* @__PURE__ */ L(N, {
262
+ }), /* @__PURE__ */ L(F, {
263
263
  name: "oauth-login-mode",
264
264
  id: "oauth-with-config",
265
265
  value: l.WithConfig,
@@ -287,7 +287,7 @@ var z = {
287
287
  }),
288
288
  /* @__PURE__ */ R("div", {
289
289
  className: "flex flex-col gap-1",
290
- children: [/* @__PURE__ */ L(ie, {
290
+ children: [/* @__PURE__ */ L(P, {
291
291
  id: "toolset-client-secret",
292
292
  value: e.clientSecret ?? "",
293
293
  onChange: (e) => h({ clientSecret: e ?? "" }),
@@ -295,15 +295,15 @@ var z = {
295
295
  label: _?.clientSecretLabel ?? "Client secret",
296
296
  required: !i
297
297
  },
298
- placeholder: C == null ? _?.clientSecretPlaceholder ?? "Enter client secret" : (_?.clientSecretHintPlaceholder ?? fe)(C),
299
- "aria-describedby": C == null ? void 0 : X,
298
+ placeholder: C == null ? _?.clientSecretPlaceholder ?? "Enter client secret" : (_?.clientSecretHintPlaceholder ?? he)(C),
299
+ "aria-describedby": C == null ? void 0 : Y,
300
300
  showPasswordLabel: _?.showClientSecretLabel ?? "Show client secret",
301
301
  hidePasswordLabel: _?.hideClientSecretLabel ?? "Hide client secret",
302
302
  error: t.clientSecret || void 0,
303
303
  invalid: !!t.clientSecret,
304
304
  disabled: S
305
305
  }), C != null && /* @__PURE__ */ L(ne, {
306
- id: X,
306
+ id: Y,
307
307
  text: _?.clientSecretKeepCaption ?? "Leave empty to keep the saved secret."
308
308
  })]
309
309
  }),
@@ -333,7 +333,7 @@ var z = {
333
333
  invalid: !!t.tokenEndpoint,
334
334
  disabled: S
335
335
  }),
336
- /* @__PURE__ */ L(I, {
336
+ /* @__PURE__ */ L(se, {
337
337
  id: "toolset-scopes",
338
338
  labelProps: { label: _?.scopesLabel ?? "Scopes" },
339
339
  placeholder: _?.scopesPlaceholder ?? "Enter scopes",
@@ -344,7 +344,7 @@ var z = {
344
344
  })
345
345
  ]
346
346
  }),
347
- B()
347
+ I()
348
348
  ]
349
349
  }),
350
350
  e.authenticationType === s.ApiKey && /* @__PURE__ */ R("div", {
@@ -352,7 +352,7 @@ var z = {
352
352
  children: [
353
353
  /* @__PURE__ */ R("div", {
354
354
  className: "flex flex-col gap-2",
355
- children: [/* @__PURE__ */ L(N, {
355
+ children: [/* @__PURE__ */ L(F, {
356
356
  name: "apikey-login-mode",
357
357
  id: "apikey-with-login",
358
358
  value: l.WithLogin,
@@ -360,7 +360,7 @@ var z = {
360
360
  isSelected: e.withLogin === l.WithLogin,
361
361
  disabled: S,
362
362
  onChange: D
363
- }), /* @__PURE__ */ L(N, {
363
+ }), /* @__PURE__ */ L(F, {
364
364
  name: "apikey-login-mode",
365
365
  id: "apikey-without-login",
366
366
  value: l.WithoutLogin,
@@ -384,7 +384,7 @@ var z = {
384
384
  error: t.keyHeader || void 0,
385
385
  invalid: !!t.keyHeader,
386
386
  disabled: S
387
- }), e.withLogin === l.WithLogin && /* @__PURE__ */ L(ie, {
387
+ }), e.withLogin === l.WithLogin && /* @__PURE__ */ L(P, {
388
388
  id: "toolset-api-key",
389
389
  value: e.apiKey ?? "",
390
390
  onChange: (e) => h({ apiKey: e ?? "" }),
@@ -400,7 +400,7 @@ var z = {
400
400
  disabled: S
401
401
  })]
402
402
  }),
403
- e.withLogin !== l.WithoutLogin && B()
403
+ e.withLogin !== l.WithoutLogin && I()
404
404
  ]
405
405
  }),
406
406
  b && /* @__PURE__ */ L(O, {
@@ -412,13 +412,13 @@ var z = {
412
412
  variant: re.Danger,
413
413
  isLoading: v,
414
414
  disableConfirmButton: v,
415
- onConfirm: z,
415
+ onConfirm: ae,
416
416
  onCancel: () => x(!1),
417
417
  onClose: () => x(!1)
418
418
  })
419
419
  ]
420
420
  });
421
- }, $ = y(({ url: e, className: t, labels: n }) => {
421
+ }, ge = y(({ url: e, className: t, labels: n }) => {
422
422
  let { isCopied: r, copy: i } = _(e), a = n?.copiedLabel ?? "Copied!";
423
423
  return /* @__PURE__ */ R("div", {
424
424
  className: g("flex flex-col gap-3", t),
@@ -439,15 +439,14 @@ var z = {
439
439
  isCopied: r,
440
440
  onClick: i
441
441
  }) }),
442
- /* @__PURE__ */ L("span", {
443
- role: "status",
444
- "aria-live": "polite",
445
- className: "sr-only",
442
+ /* @__PURE__ */ L(M, {
443
+ visuallyHidden: !0,
444
+ as: ie.Span,
446
445
  children: r ? a : ""
447
446
  })
448
447
  ]
449
448
  });
450
- }), me = ({ 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 }) => {
449
+ }), _e = ({ 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 }) => {
451
450
  let [g, _] = w(null), v = !!a && !!r, y = S(() => [{
452
451
  value: B.Http,
453
452
  label: "HTTP"
@@ -456,7 +455,7 @@ var z = {
456
455
  label: "SSE"
457
456
  }], []);
458
457
  return x(() => {
459
- if (!r || !o || !J(e.auth, i)) {
458
+ if (!r || !o || !K(e.auth, i)) {
460
459
  _(null);
461
460
  return;
462
461
  }
@@ -493,7 +492,7 @@ var z = {
493
492
  error: t.endpoint || void 0,
494
493
  invalid: !!t.endpoint
495
494
  }),
496
- /* @__PURE__ */ L(P, {
495
+ /* @__PURE__ */ L(ae, {
497
496
  labelProps: {
498
497
  label: h?.protocolLabel ?? "Protocol",
499
498
  required: !0
@@ -505,7 +504,7 @@ var z = {
505
504
  d({ protocol: e });
506
505
  }
507
506
  }),
508
- g ? /* @__PURE__ */ L(ae, {
507
+ g ? /* @__PURE__ */ L(I, {
509
508
  id: "toolset-allowed-tools",
510
509
  multiple: !0,
511
510
  searchable: !0,
@@ -518,7 +517,7 @@ var z = {
518
517
  })),
519
518
  value: e.allowedTools,
520
519
  onChange: (e) => d({ allowedTools: e })
521
- }) : /* @__PURE__ */ L(I, {
520
+ }) : /* @__PURE__ */ L(se, {
522
521
  id: "toolset-allowed-tools",
523
522
  labelProps: { label: h?.allowedToolsLabel ?? "Allowed tools" },
524
523
  placeholder: h?.allowedToolsPlaceholder ?? "Add tools, comma separated",
@@ -541,120 +540,120 @@ var z = {
541
540
  onEnsureSaved: p,
542
541
  labels: h?.auth
543
542
  }),
544
- v && /* @__PURE__ */ L($, {
543
+ v && /* @__PURE__ */ L(ge, {
545
544
  url: a ?? "",
546
545
  labels: h?.connect,
547
546
  className: "border-t border-tertiary pt-4"
548
547
  })
549
548
  ]
550
549
  });
551
- }, he = [
550
+ }, ve = [
552
551
  "keyHeader",
553
552
  "apiKey",
554
553
  "clientId",
555
554
  "clientSecret",
556
555
  "authorizationEndpoint",
557
556
  "tokenEndpoint"
558
- ], ge = ["endpoint", ...he], _e = new Set(ge), ve = { validateVersionPattern: !0 }, ye = (e) => {
557
+ ], ye = ["endpoint", ...ve], be = new Set(ye), xe = { validateVersionPattern: !0 }, Se = (e) => {
559
558
  let t = {};
560
- for (let n of Object.keys(e)) _e.has(n) && (t[n] = !0);
559
+ for (let n of Object.keys(e)) be.has(n) && (t[n] = !0);
561
560
  return t;
562
- }, be = ({ initialForm: e, toolsetId: o, onPersist: c, onPostSaveLogin: d, onToolsetsChanged: m, onSaveSuccess: g, onSaveComplete: _, onBack: y, onDirtyChange: T, buildMcpUrl: E, listToolNames: D, authActions: ee, onOAuthLogin: te, onNotifySuccess: ne, onNotifyError: O, avatarPicker: re, availableLocaleOptions: k, onRefineDescription: A, labels: j }) => {
561
+ }, Ce = ({ initialForm: e, toolsetId: o, onPersist: c, onPostSaveLogin: d, onToolsetsChanged: m, onSaveSuccess: g, onSaveComplete: _, onBack: y, onDirtyChange: T, buildMcpUrl: E, listToolNames: D, authActions: ee, onOAuthLogin: te, onNotifySuccess: ne, onNotifyError: O, avatarPicker: re, availableLocaleOptions: k, onRefineDescription: A, labels: j }) => {
563
562
  let M = !!o, [ie, N] = w(""), P = o || ie, [F, ae] = w({
564
563
  initialForm: e,
565
564
  key: 0
566
- }), [I, R] = w(e);
565
+ }), [oe, I] = w(e);
567
566
  F.initialForm !== e && (ae({
568
567
  initialForm: e,
569
568
  key: F.key + 1
570
- }), R(e));
571
- let B = S(() => ue(e), [e]), { values: V, setValues: H, markTouched: U, visibleErrorCodes: W, attemptSubmit: G } = a({
572
- initialValues: B,
573
- validationOptions: ve,
569
+ }), I(e));
570
+ let se = S(() => pe(e), [e]), { values: R, setValues: B, markTouched: V, visibleErrorCodes: H, attemptSubmit: le } = a({
571
+ initialValues: se,
572
+ validationOptions: xe,
574
573
  reseedKey: F.key
575
- }), [se, q] = w(e), J = S(() => ({
576
- ...se,
577
- ...V
578
- }), [se, V]), le = S(() => JSON.stringify(J) !== JSON.stringify(I), [J, I]);
574
+ }), [ue, U] = w(e), G = S(() => ({
575
+ ...ue,
576
+ ...R
577
+ }), [ue, R]), de = S(() => JSON.stringify(G) !== JSON.stringify(oe), [G, oe]);
579
578
  x(() => {
580
- T?.(le);
581
- }, [le, T]);
582
- let [Y, X] = w(!1), [fe, Z] = w({}), [pe, Q] = w({}), $ = C(null);
579
+ T?.(de);
580
+ }, [de, T]);
581
+ let [K, q] = w(!1), [J, Y] = w({}), [he, X] = w({}), Z = C(null);
583
582
  x(() => {
584
- q(e), $.current = e, Z({}), Q({}), N("");
583
+ U(e), Z.current = e, Y({}), X({}), N("");
585
584
  }, [e]);
586
- let _e = b((e) => {
587
- let { metadata: t, setup: n } = de(e);
588
- Object.keys(t).length > 0 && (H(t), "name" in t && U(r.Name), "version" in t && U(r.Version)), Object.keys(n).length !== 0 && (q((e) => ({
585
+ let Q = b((e) => {
586
+ let { metadata: t, setup: n } = me(e);
587
+ Object.keys(t).length > 0 && (B(t), "name" in t && V(r.Name), "version" in t && V(r.Version)), Object.keys(n).length !== 0 && (U((e) => ({
589
588
  ...e,
590
589
  ...n
591
- })), Q((e) => ({
590
+ })), X((e) => ({
592
591
  ...e,
593
- ...ye(n)
594
- })), Z((e) => {
592
+ ...Se(n)
593
+ })), Y((e) => {
595
594
  let t = { ...e };
596
595
  for (let e of Object.keys(n)) delete t[e];
597
596
  return t;
598
597
  }));
599
- }, [H, U]), be = b((e) => {
600
- q((t) => ({
598
+ }, [B, V]), ge = b((e) => {
599
+ U((t) => ({
601
600
  ...t,
602
601
  auth: {
603
602
  ...t.auth,
604
603
  ...e
605
604
  }
606
- })), Q((t) => ({
605
+ })), X((t) => ({
607
606
  ...t,
608
- ...ye(e)
609
- })), Z((t) => {
607
+ ...Se(e)
608
+ })), Y((t) => {
610
609
  let n = { ...t };
611
- if ("authenticationType" in e || "withLogin" in e || "isLoggedIn" in e) for (let e of he) delete n[e];
610
+ if ("authenticationType" in e || "withLogin" in e || "isLoggedIn" in e) for (let e of ve) delete n[e];
612
611
  else for (let t of Object.keys(e)) delete n[t];
613
612
  return n;
614
613
  }), "isLoggedIn" in e && m();
615
- }, [m]), xe = b(async () => {
616
- if (P && $.current != null && JSON.stringify($.current) === JSON.stringify(J)) return P;
617
- X(!0);
614
+ }, [m]), be = b(async () => {
615
+ if (P && Z.current != null && JSON.stringify(Z.current) === JSON.stringify(G)) return P;
616
+ q(!0);
618
617
  try {
619
- let e = await c(J, P);
620
- return e ? (P || N(e), $.current = J, R(J), T?.(!1), await m(), e) : null;
618
+ let e = await c(G, P);
619
+ return e ? (P || N(e), Z.current = G, I(G), T?.(!1), await m(), e) : null;
621
620
  } catch {
622
621
  return null;
623
622
  } finally {
624
- X(!1);
623
+ q(!1);
625
624
  }
626
625
  }, [
627
- J,
626
+ G,
628
627
  P,
629
628
  c,
630
629
  m,
631
630
  T
632
- ]), Se = b(async () => await xe() ?? !1, [xe]), Ce = b((e) => {
631
+ ]), Ce = b(async () => await be() ?? !1, [be]), $ = b((e) => {
633
632
  let t = j?.validation, n = {};
634
- return e.endpoint.trim() ? K(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() ? K(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() ? K(e.auth.tokenEndpoint) || (n.tokenEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL") : n.tokenEndpoint = t?.tokenEndpointRequired ?? "Token endpoint is required")), n;
633
+ 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"), !M && !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;
635
634
  }, [j, M]), we = b(async () => {
636
- let e = G(), t = Ce(J);
637
- if (!e || Object.keys(t).length > 0) Z(t);
635
+ let e = le(), t = $(G);
636
+ if (!e || Object.keys(t).length > 0) Y(t);
638
637
  else {
639
- Z({}), X(!0);
638
+ Y({}), q(!0);
640
639
  try {
641
- let e = await c(J, P);
640
+ let e = await c(G, P);
642
641
  if (!e) return;
643
- R(J), await m(), g(J);
642
+ I(G), await m(), g(G);
644
643
  try {
645
- await d(e, J.auth), _();
644
+ await d(e, G.auth), _();
646
645
  } catch (e) {
647
646
  let { traceId: t } = await u(e);
648
647
  O(j?.settings?.auth?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
649
648
  }
650
649
  } catch {} finally {
651
- X(!1);
650
+ q(!1);
652
651
  }
653
652
  }
654
653
  }, [
654
+ le,
655
655
  G,
656
- J,
657
- Ce,
656
+ $,
658
657
  P,
659
658
  c,
660
659
  m,
@@ -664,10 +663,10 @@ var z = {
664
663
  O,
665
664
  j
666
665
  ]), Te = v({
667
- value: V.description,
668
- onChange: (e) => _e({ description: e }),
666
+ value: R.description,
667
+ onChange: (e) => Q({ description: e }),
669
668
  onRefine: A,
670
- disabled: Y,
669
+ disabled: K,
671
670
  resetKey: F.key
672
671
  }), Ee = A ? (e, t) => /* @__PURE__ */ L(h, {
673
672
  isEnabled: !0,
@@ -675,26 +674,26 @@ var z = {
675
674
  label: j?.general?.form?.description.label ?? "Description",
676
675
  labels: j?.refinement,
677
676
  refinement: Te,
678
- disabled: Te.isPending || Y,
677
+ disabled: Te.isPending || K,
679
678
  children: e
680
679
  }) : void 0, De = S(() => ({
681
- form: j?.general?.form ?? oe,
680
+ form: j?.general?.form ?? ce,
682
681
  avatarPicker: j?.general?.avatarPicker
683
- }), [j?.general?.form, j?.general?.avatarPicker]), Oe = S(() => !ce(J, M), [J, M]), ke = S(() => {
684
- let e = j?.validation, n = Ce(J), r = { ...fe };
685
- for (let e of ge) {
686
- if (!pe[e]) continue;
682
+ }), [j?.general?.form, j?.general?.avatarPicker]), Oe = S(() => !fe(G, M), [G, M]), ke = S(() => {
683
+ let e = j?.validation, n = $(G), r = { ...J };
684
+ for (let e of ye) {
685
+ if (!he[e]) continue;
687
686
  let t = n[e];
688
687
  t ? r[e] = t : delete r[e];
689
688
  }
690
- 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;
689
+ return H.name === t.Required ? r.name = e?.nameRequired ?? "Name is required" : H.name === t.TooLong ? r.name = e?.nameTooLong ?? `Use ${p} 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 ${f} characters or fewer.`), H.version === t.InvalidFormat && (r.version = e?.versionInvalid ?? "Version may only contain letters, digits, dots, underscores, and dashes"), r;
691
690
  }, [
692
- pe,
693
- fe,
691
+ he,
694
692
  J,
693
+ G,
695
694
  j,
696
- W,
697
- Ce
695
+ H,
696
+ $
698
697
  ]), Ae = E && P ? E(P) : void 0;
699
698
  return /* @__PURE__ */ L(n, {
700
699
  title: M ? j?.layout?.editTitle ?? "Edit toolset" : j?.layout?.createTitle ?? "Create toolset",
@@ -702,7 +701,7 @@ var z = {
702
701
  onCancel: y,
703
702
  onSubmit: we,
704
703
  submitLabel: M ? j?.layout?.saveLabel ?? "Save" : j?.layout?.createLabel ?? "Create",
705
- isSubmitting: Y,
704
+ isSubmitting: K,
706
705
  isSubmitDisabled: Oe || Te.isPending,
707
706
  metadataSectionClassName: z.metadataSection,
708
707
  setupSectionClassName: z.setupSection,
@@ -714,18 +713,18 @@ var z = {
714
713
  cancelLabel: j?.layout?.cancelLabel ?? "Cancel"
715
714
  },
716
715
  metadata: /* @__PURE__ */ L(i, {
717
- values: J,
716
+ values: G,
718
717
  errors: ke,
719
- onChange: _e,
718
+ onChange: Q,
720
719
  avatarPicker: re,
721
720
  availableLocaleOptions: k,
722
721
  renderDescription: Ee,
723
722
  labels: De
724
723
  }),
725
- setup: /* @__PURE__ */ L(me, {
726
- form: J,
724
+ setup: /* @__PURE__ */ L(_e, {
725
+ form: G,
727
726
  errors: ke,
728
- isSaving: Y,
727
+ isSaving: K,
729
728
  toolsetId: P,
730
729
  isEditMode: M,
731
730
  connectUrl: Ae,
@@ -734,12 +733,12 @@ var z = {
734
733
  onOAuthLogin: te,
735
734
  onNotifySuccess: ne,
736
735
  onNotifyError: O,
737
- onChange: _e,
738
- onAuthChange: be,
739
- onEnsureSaved: Se,
736
+ onChange: Q,
737
+ onAuthChange: ge,
738
+ onEnsureSaved: Ce,
740
739
  labels: j?.settings
741
740
  })
742
741
  });
743
742
  };
744
743
  //#endregion
745
- export { H as AUTH_TYPE_ICONS, V as DEFAULT_TOOLSET_VERSION, z as TOOLSET_EDITOR_CLASS, be as ToolsetEditor, Y as ToolsetOAuthLoginStatus, B as ToolsetTransportType, W as getDefaultToolsetForm, J as isToolsetAuthValid, ce as isToolsetFormValid, K as isValidEndpointUrl, q as normalizeReturnedEndpointUrl };
744
+ export { H as AUTH_TYPE_ICONS, V as DEFAULT_TOOLSET_VERSION, z as TOOLSET_EDITOR_CLASS, Ce as ToolsetEditor, J as ToolsetOAuthLoginStatus, B as ToolsetTransportType, ue as getDefaultToolsetForm, K as isToolsetAuthValid, fe as isToolsetFormValid, W as isValidEndpointUrl, de as normalizeReturnedEndpointUrl };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-toolset-editor",
3
3
  "description": "Host-agnostic form for authoring and editing a DIAL MCP toolset",
4
- "version": "1.3.0-dev.245",
4
+ "version": "1.3.0-dev.248",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -18,12 +18,12 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@tabler/icons-react": "^3.44.0",
21
- "@epam/ai-dial-builder-form": "1.3.0-dev.245"
21
+ "@epam/ai-dial-builder-form": "1.3.0-dev.248"
22
22
  },
23
23
  "peerDependencies": {
24
- "@epam/ai-dial-chat-hooks": "1.3.0-dev.245",
25
- "@epam/ai-dial-chat-shared": "1.3.0-dev.245",
26
- "@epam/ai-dial-ui-kit": "^0.16.0-dev.45",
24
+ "@epam/ai-dial-chat-hooks": "1.3.0-dev.248",
25
+ "@epam/ai-dial-chat-shared": "1.3.0-dev.248",
26
+ "@epam/ai-dial-ui-kit": "^0.16.0-dev.56",
27
27
  "react": "^19.2.8"
28
28
  },
29
29
  "repository": {