@gentiq/ui 1.0.0-alpha.10 → 1.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ConnectorMentionList-C96T5A0h.js +77 -0
- package/dist/ConnectorsSettings-a4kJpfxV.js +554 -0
- package/dist/{FeedbackSettings-oq019el1.js → FeedbackSettings-DEx_MG3e.js} +13 -13
- package/dist/SchedulesSettings-BOAY8g-i.js +574 -0
- package/dist/{VoiceInput-sKSP-X3z.js → VoiceInput-BxrMT7Sn.js} +2 -2
- package/dist/index.d.ts +412 -11
- package/dist/index.es.js +72 -44
- package/dist/internal.d.ts +133 -1
- package/dist/internal.es.js +59 -79
- package/dist/{shared-BKh4GbRI.js → shared-BqghN38E.js} +1 -1
- package/dist/shared-C0zGnIf8.js +226 -0
- package/dist/{shared-BtZa4J_w.js → shared-C6NokIol.js} +113 -113
- package/dist/shared-HOMT87-R.js +5775 -0
- package/dist/shared-opU08IAK.js +9 -0
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/dist/MessageEditor-thFldVmz.js +0 -25
- package/dist/shared-DO5kF-Zj.js +0 -5136
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { useGentiqTranslation as p, useGentiqLanguage as x } from "@gentiq/react";
|
|
4
|
+
import { Check as f, Settings2 as g } from "lucide-react";
|
|
5
|
+
import { c as b } from "./shared-C6NokIol.js";
|
|
6
|
+
import { C as h } from "./shared-HOMT87-R.js";
|
|
7
|
+
function C({
|
|
8
|
+
id: s,
|
|
9
|
+
connectors: a,
|
|
10
|
+
activeIndex: c,
|
|
11
|
+
onHighlight: d,
|
|
12
|
+
onSelect: m,
|
|
13
|
+
onOpenSettings: l
|
|
14
|
+
}) {
|
|
15
|
+
const { t: r } = p(["connectors"]), { dir: u } = x();
|
|
16
|
+
return /* @__PURE__ */ o(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
id: s,
|
|
20
|
+
role: "listbox",
|
|
21
|
+
dir: u,
|
|
22
|
+
"aria-label": r("composer_label"),
|
|
23
|
+
onMouseDown: (t) => t.preventDefault(),
|
|
24
|
+
className: "absolute bottom-full start-0 mb-2 z-30 w-72 max-w-[calc(100vw-2rem)] rounded-2xl border border-border/60 bg-popover p-1.5 text-popover-foreground shadow-xl",
|
|
25
|
+
children: [
|
|
26
|
+
a.length === 0 ? /* @__PURE__ */ e("div", { className: "px-2.5 py-2 text-xs text-muted-foreground", children: r("empty") }) : /* @__PURE__ */ e("div", { className: "max-h-60 overflow-y-auto", children: a.map((t, n) => {
|
|
27
|
+
const i = n === c;
|
|
28
|
+
return /* @__PURE__ */ o(
|
|
29
|
+
"button",
|
|
30
|
+
{
|
|
31
|
+
id: `${s}-option-${n}`,
|
|
32
|
+
type: "button",
|
|
33
|
+
role: "option",
|
|
34
|
+
"aria-selected": i,
|
|
35
|
+
onMouseEnter: () => d(n),
|
|
36
|
+
onClick: () => m(t),
|
|
37
|
+
className: b(
|
|
38
|
+
"flex w-full cursor-pointer items-center justify-between gap-2 rounded-xl px-2.5 py-2 text-start text-sm outline-hidden transition-colors",
|
|
39
|
+
i ? "bg-accent text-accent-foreground" : "text-popover-foreground hover:bg-accent/60"
|
|
40
|
+
),
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ o("span", { className: "flex min-w-0 items-center gap-2.5", children: [
|
|
43
|
+
/* @__PURE__ */ e("span", { className: "grid size-7 shrink-0 place-items-center rounded-lg bg-foreground/[0.06] text-foreground/75", children: /* @__PURE__ */ e(
|
|
44
|
+
h,
|
|
45
|
+
{
|
|
46
|
+
icon: t.icon,
|
|
47
|
+
className: "size-4 text-current",
|
|
48
|
+
glyphClassName: "text-sm"
|
|
49
|
+
}
|
|
50
|
+
) }),
|
|
51
|
+
/* @__PURE__ */ e("span", { className: "truncate font-medium", children: t.name })
|
|
52
|
+
] }),
|
|
53
|
+
t.connected ? t.enabled ? /* @__PURE__ */ e(f, { className: "size-4 shrink-0 text-primary" }) : null : /* @__PURE__ */ e("span", { className: "shrink-0 text-xs text-muted-foreground", children: r("connect") })
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
t.id
|
|
57
|
+
);
|
|
58
|
+
}) }),
|
|
59
|
+
l && /* @__PURE__ */ o(
|
|
60
|
+
"button",
|
|
61
|
+
{
|
|
62
|
+
type: "button",
|
|
63
|
+
onClick: l,
|
|
64
|
+
className: "mt-1 flex w-full cursor-pointer items-center gap-2 rounded-xl border-t border-border/40 px-2.5 pt-2 pb-1.5 text-start text-xs text-muted-foreground hover:bg-accent/60 hover:text-accent-foreground",
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ e(g, { className: "size-3.5 shrink-0" }),
|
|
67
|
+
/* @__PURE__ */ e("span", { children: r("manage_in_settings") })
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
C as ConnectorMentionList
|
|
77
|
+
};
|
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as e, jsxs as r, Fragment as Y } from "react/jsx-runtime";
|
|
3
|
+
import { useId as W, useState as c } from "react";
|
|
4
|
+
import { RefreshCw as Z, Plus as ee, Plug as ae, KeyRound as se, Wrench as te, Unplug as re, Trash2 as le } from "lucide-react";
|
|
5
|
+
import { toast as _ } from "sonner";
|
|
6
|
+
import { useGentiqTranslation as A, useGentiqLanguage as q, useConnectorActions as B, getLocalizedErrorMessage as $, useConnectorTools as ie, useConnectors as de, Connectors as R } from "@gentiq/react";
|
|
7
|
+
import { D as E, e as G, f as J, g as Q, J as g, Q as w, X, B as v, h as H, K, M as S, N as T, O as I, P as b, c as ne } from "./shared-C6NokIol.js";
|
|
8
|
+
import { S as M } from "./shared-opU08IAK.js";
|
|
9
|
+
import { C as oe } from "./shared-HOMT87-R.js";
|
|
10
|
+
function ce({
|
|
11
|
+
connector: n,
|
|
12
|
+
onClose: t
|
|
13
|
+
}) {
|
|
14
|
+
const s = W(), { t: l } = A(["connectors", "errors"]), { connectApiKey: u } = B(), [m, N] = c(""), [y, f] = c(n.account_label ?? ""), o = u.isPending, C = async (i) => {
|
|
15
|
+
if (i.preventDefault(), !(o || !m.trim()))
|
|
16
|
+
try {
|
|
17
|
+
await u.mutateAsync({
|
|
18
|
+
id: n.id,
|
|
19
|
+
data: {
|
|
20
|
+
api_key: m.trim(),
|
|
21
|
+
account_label: y.trim() || void 0
|
|
22
|
+
}
|
|
23
|
+
}), _.success(l("connected_toast")), t();
|
|
24
|
+
} catch (x) {
|
|
25
|
+
_.error($(x, l));
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return /* @__PURE__ */ r("form", { onSubmit: (i) => {
|
|
29
|
+
C(i);
|
|
30
|
+
}, className: "space-y-4", children: [
|
|
31
|
+
n.api_key_instructions && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground rounded-lg bg-muted/40 p-3", children: n.api_key_instructions }),
|
|
32
|
+
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
33
|
+
/* @__PURE__ */ e(g, { htmlFor: `${s}-key`, children: l("api_key_dialog.key_label") }),
|
|
34
|
+
/* @__PURE__ */ e(
|
|
35
|
+
w,
|
|
36
|
+
{
|
|
37
|
+
id: `${s}-key`,
|
|
38
|
+
type: "password",
|
|
39
|
+
dir: "ltr",
|
|
40
|
+
value: m,
|
|
41
|
+
onChange: (i) => N(i.target.value),
|
|
42
|
+
placeholder: l("api_key_dialog.key_placeholder"),
|
|
43
|
+
required: !0,
|
|
44
|
+
disabled: o,
|
|
45
|
+
autoComplete: "off"
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
] }),
|
|
49
|
+
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
50
|
+
/* @__PURE__ */ e(g, { htmlFor: `${s}-label`, children: l("api_key_dialog.account_label") }),
|
|
51
|
+
/* @__PURE__ */ e(
|
|
52
|
+
w,
|
|
53
|
+
{
|
|
54
|
+
id: `${s}-label`,
|
|
55
|
+
value: y,
|
|
56
|
+
onChange: (i) => f(i.target.value),
|
|
57
|
+
placeholder: l("api_key_dialog.account_placeholder"),
|
|
58
|
+
disabled: o
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
] }),
|
|
62
|
+
/* @__PURE__ */ r(X, { children: [
|
|
63
|
+
/* @__PURE__ */ e(v, { type: "button", variant: "outline", onClick: t, disabled: o, children: l("api_key_dialog.cancel") }),
|
|
64
|
+
/* @__PURE__ */ e(v, { type: "submit", disabled: o || !m.trim(), children: l(o ? "api_key_dialog.saving" : "api_key_dialog.submit") })
|
|
65
|
+
] })
|
|
66
|
+
] });
|
|
67
|
+
}
|
|
68
|
+
function ue({
|
|
69
|
+
open: n,
|
|
70
|
+
onOpenChange: t,
|
|
71
|
+
connector: s
|
|
72
|
+
}) {
|
|
73
|
+
const { t: l } = A("connectors"), { dir: u } = q();
|
|
74
|
+
return /* @__PURE__ */ e(E, { open: n, onOpenChange: t, children: /* @__PURE__ */ r(G, { dir: u, className: "sm:max-w-[440px]", children: [
|
|
75
|
+
/* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(Q, { children: l("api_key_dialog.title", { name: s?.name ?? "" }) }) }),
|
|
76
|
+
s && /* @__PURE__ */ e(
|
|
77
|
+
ce,
|
|
78
|
+
{
|
|
79
|
+
connector: s,
|
|
80
|
+
onClose: () => t(!1)
|
|
81
|
+
},
|
|
82
|
+
`${n ? "open" : "closed"}-${s.id}`
|
|
83
|
+
)
|
|
84
|
+
] }) });
|
|
85
|
+
}
|
|
86
|
+
function me({ open: n, onOpenChange: t, connector: s }) {
|
|
87
|
+
const { t: l } = A(["connectors", "errors"]), { dir: u } = q(), { toggle: m } = B(), { data: N, isLoading: y, isFetching: f, refetch: o } = ie(s?.id ?? "", {
|
|
88
|
+
enabled: n && !!(s?.id && s?.connected)
|
|
89
|
+
}), C = async (i, x) => {
|
|
90
|
+
if (s)
|
|
91
|
+
try {
|
|
92
|
+
await m.mutateAsync({
|
|
93
|
+
id: s.id,
|
|
94
|
+
data: {
|
|
95
|
+
enabled: s.enabled,
|
|
96
|
+
tool_overrides: {
|
|
97
|
+
...s.tool_overrides ?? {},
|
|
98
|
+
[i]: x
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
} catch (p) {
|
|
103
|
+
_.error($(p, l));
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
return /* @__PURE__ */ e(E, { open: n, onOpenChange: t, children: /* @__PURE__ */ r(G, { dir: u, className: "sm:max-w-[560px]", children: [
|
|
107
|
+
/* @__PURE__ */ e(J, { children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-2 pe-6", children: [
|
|
108
|
+
/* @__PURE__ */ e(Q, { children: l("tools_dialog.title", { name: s?.name ?? "" }) }),
|
|
109
|
+
/* @__PURE__ */ r(
|
|
110
|
+
v,
|
|
111
|
+
{
|
|
112
|
+
type: "button",
|
|
113
|
+
size: "sm",
|
|
114
|
+
variant: "ghost",
|
|
115
|
+
className: "h-8 gap-1.5 text-xs",
|
|
116
|
+
disabled: f,
|
|
117
|
+
onClick: () => {
|
|
118
|
+
o();
|
|
119
|
+
},
|
|
120
|
+
children: [
|
|
121
|
+
/* @__PURE__ */ e(Z, { className: `size-3.5 ${f ? "animate-spin" : ""}` }),
|
|
122
|
+
l("tools_dialog.refresh")
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
] }) }),
|
|
127
|
+
/* @__PURE__ */ e("div", { className: "max-h-[60vh] overflow-y-auto space-y-2.5 pe-1", children: y ? /* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
128
|
+
/* @__PURE__ */ e(M, { className: "h-14 w-full rounded-xl" }),
|
|
129
|
+
/* @__PURE__ */ e(M, { className: "h-14 w-full rounded-xl" })
|
|
130
|
+
] }) : N?.tools.length ? N.tools.map((i) => /* @__PURE__ */ r(
|
|
131
|
+
"div",
|
|
132
|
+
{
|
|
133
|
+
className: "rounded-xl border border-border/50 bg-muted/20 p-3 flex items-start justify-between gap-3",
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ r("div", { className: "min-w-0 space-y-1", children: [
|
|
136
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
137
|
+
/* @__PURE__ */ e("span", { dir: "ltr", className: "text-xs font-mono font-medium text-foreground", children: i.name }),
|
|
138
|
+
i.read_only && /* @__PURE__ */ e(H, { variant: "secondary", children: l("tools_dialog.read_only") }),
|
|
139
|
+
i.destructive && /* @__PURE__ */ e(H, { variant: "destructive", children: l("tools_dialog.destructive") })
|
|
140
|
+
] }),
|
|
141
|
+
i.description && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: i.description })
|
|
142
|
+
] }),
|
|
143
|
+
/* @__PURE__ */ r(
|
|
144
|
+
K,
|
|
145
|
+
{
|
|
146
|
+
dir: u,
|
|
147
|
+
value: s?.tool_overrides?.[i.name] ?? i.approval,
|
|
148
|
+
disabled: m.isPending,
|
|
149
|
+
onValueChange: (x) => {
|
|
150
|
+
C(i.name, x);
|
|
151
|
+
},
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ e(S, { "aria-label": i.name, className: "w-[155px] shrink-0 h-8 text-xs", children: /* @__PURE__ */ e(T, {}) }),
|
|
154
|
+
/* @__PURE__ */ r(I, { children: [
|
|
155
|
+
/* @__PURE__ */ e(b, { value: "allow", children: l("tools_dialog.mode_allow") }),
|
|
156
|
+
/* @__PURE__ */ e(b, { value: "ask", children: l("tools_dialog.mode_ask") }),
|
|
157
|
+
/* @__PURE__ */ e(b, { value: "deny", children: l("tools_dialog.mode_deny") })
|
|
158
|
+
] })
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
i.name
|
|
165
|
+
)) : /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground py-6 text-center", children: l("tools_dialog.empty") }) })
|
|
166
|
+
] }) });
|
|
167
|
+
}
|
|
168
|
+
function he({ onClose: n }) {
|
|
169
|
+
const t = W(), { t: s } = A(["connectors", "errors"]), { dir: l } = q(), { createUserMCP: u } = B(), [m, N] = c(""), [y, f] = c(""), [o, C] = c(""), [i, x] = c("streamable-http"), [p, k] = c("none"), [z, L] = c(""), [P, U] = c("Authorization"), [D, O] = c("Bearer "), [F, j] = c("writes"), a = u.isPending, h = async (d) => {
|
|
170
|
+
if (d.preventDefault(), !a)
|
|
171
|
+
try {
|
|
172
|
+
await u.mutateAsync({
|
|
173
|
+
name: m.trim(),
|
|
174
|
+
description: y.trim(),
|
|
175
|
+
url: o.trim(),
|
|
176
|
+
transport: i,
|
|
177
|
+
auth_kind: p,
|
|
178
|
+
api_key: p === "api_key" && z.trim() || void 0,
|
|
179
|
+
header_name: p === "api_key" ? P.trim() || "Authorization" : void 0,
|
|
180
|
+
header_prefix: p === "api_key" ? D : void 0,
|
|
181
|
+
approval: F
|
|
182
|
+
}), _.success(s("connected_toast")), n();
|
|
183
|
+
} catch (V) {
|
|
184
|
+
_.error($(V, s));
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
return /* @__PURE__ */ r("form", { onSubmit: (d) => {
|
|
188
|
+
h(d);
|
|
189
|
+
}, className: "space-y-4", children: [
|
|
190
|
+
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
191
|
+
/* @__PURE__ */ e(g, { htmlFor: `${t}-name`, children: s("custom_dialog.name") }),
|
|
192
|
+
/* @__PURE__ */ e(
|
|
193
|
+
w,
|
|
194
|
+
{
|
|
195
|
+
id: `${t}-name`,
|
|
196
|
+
value: m,
|
|
197
|
+
onChange: (d) => N(d.target.value),
|
|
198
|
+
placeholder: s("custom_dialog.name_placeholder"),
|
|
199
|
+
required: !0,
|
|
200
|
+
disabled: a
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
] }),
|
|
204
|
+
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
205
|
+
/* @__PURE__ */ e(g, { htmlFor: `${t}-desc`, children: s("custom_dialog.description") }),
|
|
206
|
+
/* @__PURE__ */ e(
|
|
207
|
+
w,
|
|
208
|
+
{
|
|
209
|
+
id: `${t}-desc`,
|
|
210
|
+
value: y,
|
|
211
|
+
onChange: (d) => f(d.target.value),
|
|
212
|
+
placeholder: s("custom_dialog.description_placeholder"),
|
|
213
|
+
disabled: a
|
|
214
|
+
}
|
|
215
|
+
)
|
|
216
|
+
] }),
|
|
217
|
+
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
218
|
+
/* @__PURE__ */ e(g, { htmlFor: `${t}-url`, children: s("custom_dialog.url") }),
|
|
219
|
+
/* @__PURE__ */ e(
|
|
220
|
+
w,
|
|
221
|
+
{
|
|
222
|
+
id: `${t}-url`,
|
|
223
|
+
type: "url",
|
|
224
|
+
dir: "ltr",
|
|
225
|
+
value: o,
|
|
226
|
+
onChange: (d) => C(d.target.value),
|
|
227
|
+
placeholder: s("custom_dialog.url_placeholder"),
|
|
228
|
+
required: !0,
|
|
229
|
+
disabled: a
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
] }),
|
|
233
|
+
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
234
|
+
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
235
|
+
/* @__PURE__ */ e(g, { htmlFor: `${t}-transport`, children: s("custom_dialog.transport") }),
|
|
236
|
+
/* @__PURE__ */ r(
|
|
237
|
+
K,
|
|
238
|
+
{
|
|
239
|
+
dir: l,
|
|
240
|
+
value: i,
|
|
241
|
+
onValueChange: (d) => x(d),
|
|
242
|
+
disabled: a,
|
|
243
|
+
children: [
|
|
244
|
+
/* @__PURE__ */ e(S, { id: `${t}-transport`, className: "w-full", children: /* @__PURE__ */ e(T, {}) }),
|
|
245
|
+
/* @__PURE__ */ r(I, { children: [
|
|
246
|
+
/* @__PURE__ */ e(b, { value: "streamable-http", children: s("custom_dialog.transport_streamable") }),
|
|
247
|
+
/* @__PURE__ */ e(b, { value: "sse", children: s("custom_dialog.transport_sse") })
|
|
248
|
+
] })
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
] }),
|
|
253
|
+
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
254
|
+
/* @__PURE__ */ e(g, { htmlFor: `${t}-approval`, children: s("custom_dialog.approval") }),
|
|
255
|
+
/* @__PURE__ */ r(
|
|
256
|
+
K,
|
|
257
|
+
{
|
|
258
|
+
dir: l,
|
|
259
|
+
value: F,
|
|
260
|
+
onValueChange: (d) => j(d),
|
|
261
|
+
disabled: a,
|
|
262
|
+
children: [
|
|
263
|
+
/* @__PURE__ */ e(S, { id: `${t}-approval`, className: "w-full", children: /* @__PURE__ */ e(T, {}) }),
|
|
264
|
+
/* @__PURE__ */ r(I, { children: [
|
|
265
|
+
/* @__PURE__ */ e(b, { value: "writes", children: s("custom_dialog.approval_writes") }),
|
|
266
|
+
/* @__PURE__ */ e(b, { value: "always", children: s("custom_dialog.approval_always") }),
|
|
267
|
+
/* @__PURE__ */ e(b, { value: "never", children: s("custom_dialog.approval_never") })
|
|
268
|
+
] })
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
)
|
|
272
|
+
] })
|
|
273
|
+
] }),
|
|
274
|
+
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
275
|
+
/* @__PURE__ */ e(g, { htmlFor: `${t}-auth`, children: s("custom_dialog.auth") }),
|
|
276
|
+
/* @__PURE__ */ r(
|
|
277
|
+
K,
|
|
278
|
+
{
|
|
279
|
+
dir: l,
|
|
280
|
+
value: p,
|
|
281
|
+
onValueChange: (d) => k(d),
|
|
282
|
+
disabled: a,
|
|
283
|
+
children: [
|
|
284
|
+
/* @__PURE__ */ e(S, { id: `${t}-auth`, className: "w-full", children: /* @__PURE__ */ e(T, {}) }),
|
|
285
|
+
/* @__PURE__ */ r(I, { children: [
|
|
286
|
+
/* @__PURE__ */ e(b, { value: "none", children: s("custom_dialog.auth_none") }),
|
|
287
|
+
/* @__PURE__ */ e(b, { value: "api_key", children: s("custom_dialog.auth_api_key") })
|
|
288
|
+
] })
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
] }),
|
|
293
|
+
p === "api_key" && /* @__PURE__ */ r("div", { className: "space-y-3 rounded-xl border border-border/50 bg-muted/20 p-3", children: [
|
|
294
|
+
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
295
|
+
/* @__PURE__ */ e(g, { htmlFor: `${t}-api-key`, children: s("custom_dialog.api_key") }),
|
|
296
|
+
/* @__PURE__ */ e(
|
|
297
|
+
w,
|
|
298
|
+
{
|
|
299
|
+
id: `${t}-api-key`,
|
|
300
|
+
type: "password",
|
|
301
|
+
dir: "ltr",
|
|
302
|
+
value: z,
|
|
303
|
+
onChange: (d) => L(d.target.value),
|
|
304
|
+
placeholder: s("api_key_dialog.key_placeholder"),
|
|
305
|
+
required: !0,
|
|
306
|
+
disabled: a
|
|
307
|
+
}
|
|
308
|
+
)
|
|
309
|
+
] }),
|
|
310
|
+
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-2.5", children: [
|
|
311
|
+
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
312
|
+
/* @__PURE__ */ e(g, { htmlFor: `${t}-header-name`, children: s("custom_dialog.header_name") }),
|
|
313
|
+
/* @__PURE__ */ e(
|
|
314
|
+
w,
|
|
315
|
+
{
|
|
316
|
+
id: `${t}-header-name`,
|
|
317
|
+
dir: "ltr",
|
|
318
|
+
value: P,
|
|
319
|
+
onChange: (d) => U(d.target.value),
|
|
320
|
+
placeholder: s("custom_dialog.header_name_placeholder"),
|
|
321
|
+
disabled: a
|
|
322
|
+
}
|
|
323
|
+
)
|
|
324
|
+
] }),
|
|
325
|
+
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
326
|
+
/* @__PURE__ */ e(g, { htmlFor: `${t}-header-prefix`, children: s("custom_dialog.header_prefix") }),
|
|
327
|
+
/* @__PURE__ */ e(
|
|
328
|
+
w,
|
|
329
|
+
{
|
|
330
|
+
id: `${t}-header-prefix`,
|
|
331
|
+
dir: "ltr",
|
|
332
|
+
value: D,
|
|
333
|
+
onChange: (d) => O(d.target.value),
|
|
334
|
+
placeholder: s("custom_dialog.header_prefix_placeholder"),
|
|
335
|
+
disabled: a
|
|
336
|
+
}
|
|
337
|
+
)
|
|
338
|
+
] })
|
|
339
|
+
] })
|
|
340
|
+
] }),
|
|
341
|
+
/* @__PURE__ */ r(X, { children: [
|
|
342
|
+
/* @__PURE__ */ e(v, { type: "button", variant: "outline", onClick: n, disabled: a, children: s("custom_dialog.cancel") }),
|
|
343
|
+
/* @__PURE__ */ e(v, { type: "submit", disabled: a, children: s(a ? "custom_dialog.saving" : "custom_dialog.submit") })
|
|
344
|
+
] })
|
|
345
|
+
] });
|
|
346
|
+
}
|
|
347
|
+
function pe({ open: n, onOpenChange: t }) {
|
|
348
|
+
const { t: s } = A("connectors"), { dir: l } = q();
|
|
349
|
+
return /* @__PURE__ */ e(E, { open: n, onOpenChange: t, children: /* @__PURE__ */ r(G, { dir: l, className: "sm:max-w-[500px]", children: [
|
|
350
|
+
/* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(Q, { children: s("custom_dialog.title") }) }),
|
|
351
|
+
/* @__PURE__ */ e(he, { onClose: () => t(!1) }, n ? "open" : "closed")
|
|
352
|
+
] }) });
|
|
353
|
+
}
|
|
354
|
+
function Ce({ sectionMode: n = "editable" } = {}) {
|
|
355
|
+
const { t } = A(["connectors", "errors"]), { data: s, isLoading: l } = de(), { startOAuth: u, disconnect: m, toggle: N, deleteUserMCP: y } = B(), [f, o] = c(null), [C, i] = c(null), [x, p] = c(!1), k = n === "faded", z = s?.connectors ?? [], L = !!s?.allow_user_mcp, P = s?.max_user_mcp ?? 0, U = z.filter((a) => a.source === "user").length, D = P > 0 && U >= P, O = async (a) => {
|
|
356
|
+
if (a.auth_kind === "api_key") {
|
|
357
|
+
o(a);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (a.auth_kind === "oauth2")
|
|
361
|
+
try {
|
|
362
|
+
const h = await u.mutateAsync({
|
|
363
|
+
id: a.id,
|
|
364
|
+
returnPath: window.location.pathname
|
|
365
|
+
});
|
|
366
|
+
h.authorization_url && window.location.assign(h.authorization_url);
|
|
367
|
+
} catch (h) {
|
|
368
|
+
_.error($(h, t));
|
|
369
|
+
}
|
|
370
|
+
}, F = async (a) => {
|
|
371
|
+
if (window.confirm(t("disconnect_confirm", { name: a.name })))
|
|
372
|
+
try {
|
|
373
|
+
await m.mutateAsync(a.id), _.success(t("disconnected"));
|
|
374
|
+
} catch (h) {
|
|
375
|
+
_.error($(h, t));
|
|
376
|
+
}
|
|
377
|
+
}, j = async (a) => {
|
|
378
|
+
if (window.confirm(t("delete_confirm", { name: a.name })))
|
|
379
|
+
try {
|
|
380
|
+
await y.mutateAsync(a.id), _.success(t("deleted"));
|
|
381
|
+
} catch (h) {
|
|
382
|
+
_.error($(h, t));
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
return /* @__PURE__ */ r("div", { className: ne("space-y-5", k && "opacity-50 pointer-events-none"), children: [
|
|
386
|
+
L && /* @__PURE__ */ e("div", { className: "flex justify-end", children: /* @__PURE__ */ r(
|
|
387
|
+
v,
|
|
388
|
+
{
|
|
389
|
+
type: "button",
|
|
390
|
+
size: "sm",
|
|
391
|
+
onClick: () => p(!0),
|
|
392
|
+
disabled: k || D,
|
|
393
|
+
className: "rounded-full gap-1.5",
|
|
394
|
+
children: [
|
|
395
|
+
/* @__PURE__ */ e(ee, { className: "size-4" }),
|
|
396
|
+
t("add_custom")
|
|
397
|
+
]
|
|
398
|
+
}
|
|
399
|
+
) }),
|
|
400
|
+
l ? /* @__PURE__ */ r("div", { className: "space-y-3", children: [
|
|
401
|
+
/* @__PURE__ */ e(M, { className: "h-24 w-full rounded-2xl" }),
|
|
402
|
+
/* @__PURE__ */ e(M, { className: "h-24 w-full rounded-2xl" })
|
|
403
|
+
] }) : z.length ? /* @__PURE__ */ e(R.Root, { className: "space-y-3", children: z.map((a) => {
|
|
404
|
+
const h = !a.connected || a.status === "expired" || a.status === "error";
|
|
405
|
+
return /* @__PURE__ */ r(
|
|
406
|
+
R.Item,
|
|
407
|
+
{
|
|
408
|
+
connector: a,
|
|
409
|
+
className: "rounded-2xl border border-border/50 bg-muted/20 p-4 space-y-3",
|
|
410
|
+
children: [
|
|
411
|
+
/* @__PURE__ */ r("div", { className: "flex items-start gap-3", children: [
|
|
412
|
+
/* @__PURE__ */ e("span", { className: "grid size-8 shrink-0 place-items-center rounded-xl border border-border/50 bg-background text-muted-foreground", children: /* @__PURE__ */ e(
|
|
413
|
+
oe,
|
|
414
|
+
{
|
|
415
|
+
icon: a.icon,
|
|
416
|
+
className: "size-4",
|
|
417
|
+
glyphClassName: "text-sm"
|
|
418
|
+
}
|
|
419
|
+
) }),
|
|
420
|
+
/* @__PURE__ */ r("div", { className: "min-w-0 flex-1 space-y-1", children: [
|
|
421
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
422
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-sm text-foreground", children: a.name }),
|
|
423
|
+
/* @__PURE__ */ e(
|
|
424
|
+
H,
|
|
425
|
+
{
|
|
426
|
+
variant: a.status === "error" ? "destructive" : a.status === "connected" ? "secondary" : "outline",
|
|
427
|
+
children: t(`status_${a.status}`)
|
|
428
|
+
}
|
|
429
|
+
),
|
|
430
|
+
a.account_label && /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: a.account_label })
|
|
431
|
+
] }),
|
|
432
|
+
a.description && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: a.description }),
|
|
433
|
+
a.last_error && /* @__PURE__ */ e("p", { className: "text-xs text-destructive", children: a.last_error })
|
|
434
|
+
] })
|
|
435
|
+
] }),
|
|
436
|
+
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-1.5 pt-1 border-t border-border/30", children: [
|
|
437
|
+
a.requires_user_credentials && h && /* @__PURE__ */ r(
|
|
438
|
+
v,
|
|
439
|
+
{
|
|
440
|
+
type: "button",
|
|
441
|
+
size: "sm",
|
|
442
|
+
variant: "default",
|
|
443
|
+
className: "h-8 gap-1.5 text-xs",
|
|
444
|
+
disabled: k || u.isPending,
|
|
445
|
+
onClick: () => {
|
|
446
|
+
O(a);
|
|
447
|
+
},
|
|
448
|
+
children: [
|
|
449
|
+
/* @__PURE__ */ e(se, { className: "size-3.5" }),
|
|
450
|
+
a.connected ? t("reconnect") : t("connect")
|
|
451
|
+
]
|
|
452
|
+
}
|
|
453
|
+
),
|
|
454
|
+
a.connected && /* @__PURE__ */ r(Y, { children: [
|
|
455
|
+
/* @__PURE__ */ e(R.Toggle, { asChild: !0, children: /* @__PURE__ */ e(
|
|
456
|
+
v,
|
|
457
|
+
{
|
|
458
|
+
type: "button",
|
|
459
|
+
size: "sm",
|
|
460
|
+
variant: a.enabled ? "secondary" : "outline",
|
|
461
|
+
className: "h-8 text-xs",
|
|
462
|
+
disabled: k,
|
|
463
|
+
"aria-label": t("enabled_label", { name: a.name }),
|
|
464
|
+
onClick: (d) => {
|
|
465
|
+
d.preventDefault(), N.mutate(
|
|
466
|
+
{ id: a.id, data: { enabled: !a.enabled } },
|
|
467
|
+
{ onError: (V) => _.error($(V, t)) }
|
|
468
|
+
);
|
|
469
|
+
},
|
|
470
|
+
children: t("enabled_label", { name: a.name })
|
|
471
|
+
}
|
|
472
|
+
) }),
|
|
473
|
+
/* @__PURE__ */ r(
|
|
474
|
+
v,
|
|
475
|
+
{
|
|
476
|
+
type: "button",
|
|
477
|
+
size: "sm",
|
|
478
|
+
variant: "ghost",
|
|
479
|
+
className: "h-8 gap-1.5 text-xs",
|
|
480
|
+
onClick: () => i(a),
|
|
481
|
+
children: [
|
|
482
|
+
/* @__PURE__ */ e(te, { className: "size-3.5" }),
|
|
483
|
+
t("tools_button")
|
|
484
|
+
]
|
|
485
|
+
}
|
|
486
|
+
),
|
|
487
|
+
a.requires_user_credentials && /* @__PURE__ */ r(
|
|
488
|
+
v,
|
|
489
|
+
{
|
|
490
|
+
type: "button",
|
|
491
|
+
size: "sm",
|
|
492
|
+
variant: "ghost",
|
|
493
|
+
className: "h-8 gap-1.5 text-xs",
|
|
494
|
+
disabled: k || m.isPending,
|
|
495
|
+
onClick: () => {
|
|
496
|
+
F(a);
|
|
497
|
+
},
|
|
498
|
+
children: [
|
|
499
|
+
/* @__PURE__ */ e(re, { className: "size-3.5" }),
|
|
500
|
+
t("disconnect")
|
|
501
|
+
]
|
|
502
|
+
}
|
|
503
|
+
)
|
|
504
|
+
] }),
|
|
505
|
+
a.source === "user" && /* @__PURE__ */ e(
|
|
506
|
+
v,
|
|
507
|
+
{
|
|
508
|
+
type: "button",
|
|
509
|
+
size: "sm",
|
|
510
|
+
variant: "ghost",
|
|
511
|
+
className: "h-8 gap-1.5 text-xs text-destructive hover:text-destructive ms-auto",
|
|
512
|
+
disabled: k || y.isPending,
|
|
513
|
+
onClick: () => {
|
|
514
|
+
j(a);
|
|
515
|
+
},
|
|
516
|
+
"aria-label": t("delete_custom"),
|
|
517
|
+
children: /* @__PURE__ */ e(le, { className: "size-3.5" })
|
|
518
|
+
}
|
|
519
|
+
)
|
|
520
|
+
] })
|
|
521
|
+
]
|
|
522
|
+
},
|
|
523
|
+
a.id
|
|
524
|
+
);
|
|
525
|
+
}) }) : /* @__PURE__ */ r("div", { className: "rounded-2xl border border-dashed border-border/60 p-8 text-center space-y-2", children: [
|
|
526
|
+
/* @__PURE__ */ e(ae, { className: "size-8 mx-auto text-muted-foreground/60", "aria-hidden": !0 }),
|
|
527
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("empty") })
|
|
528
|
+
] }),
|
|
529
|
+
/* @__PURE__ */ e(
|
|
530
|
+
ue,
|
|
531
|
+
{
|
|
532
|
+
open: !!f,
|
|
533
|
+
onOpenChange: (a) => {
|
|
534
|
+
a || o(null);
|
|
535
|
+
},
|
|
536
|
+
connector: f
|
|
537
|
+
}
|
|
538
|
+
),
|
|
539
|
+
/* @__PURE__ */ e(
|
|
540
|
+
me,
|
|
541
|
+
{
|
|
542
|
+
open: !!C,
|
|
543
|
+
onOpenChange: (a) => {
|
|
544
|
+
a || i(null);
|
|
545
|
+
},
|
|
546
|
+
connector: C
|
|
547
|
+
}
|
|
548
|
+
),
|
|
549
|
+
/* @__PURE__ */ e(pe, { open: x, onOpenChange: p })
|
|
550
|
+
] });
|
|
551
|
+
}
|
|
552
|
+
export {
|
|
553
|
+
Ce as ConnectorsSettings
|
|
554
|
+
};
|