@burdenoff/microfe-integrations 2026.810.2 → 2026.810.3
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":"AddConnectionDialog.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/AddConnectionDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAqDH,MAAM,WAAW,wBAAwB;IACvC,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,mCAAmC;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,4DAA4D;IAC5D,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,yDAAyD;IACzD,mBAAmB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CACtD;AAmBD,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,OAAO,EACP,qBAAqB,EACrB,mBAAmB,GACpB,EAAE,wBAAwB,
|
|
1
|
+
{"version":3,"file":"AddConnectionDialog.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/AddConnectionDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAqDH,MAAM,WAAW,wBAAwB;IACvC,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,mCAAmC;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,4DAA4D;IAC5D,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,yDAAyD;IACzD,mBAAmB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CACtD;AAmBD,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,OAAO,EACP,qBAAqB,EACrB,mBAAmB,GACpB,EAAE,wBAAwB,sCAw3B1B"}
|
|
@@ -10,64 +10,64 @@ import { CredentialStorageSelector as le } from "./CredentialStorageSelector.js"
|
|
|
10
10
|
import { AuthMethodNotice as ue, AuthMethodSelector as de } from "./AuthMethodSelector.js";
|
|
11
11
|
import { ProviderIcon as a } from "./ProviderIcon.js";
|
|
12
12
|
import { SchemaForm as fe, initialValuesFromSchema as pe, isSchemaComplete as me, parseFormSchema as he, visibleValues as ge } from "./SchemaForm.js";
|
|
13
|
-
import { useCallback as
|
|
14
|
-
import { AlertCircle as
|
|
15
|
-
import { usePermissions as
|
|
16
|
-
import { Fragment as
|
|
17
|
-
import { IllustratedEmptyState as
|
|
13
|
+
import { useCallback as _e, useEffect as o, useId as ve, useMemo as s, useRef as c, useState as l } from "react";
|
|
14
|
+
import { AlertCircle as u, Check as ye, CheckCircle2 as be, ExternalLink as xe, Info as Se, Link2 as Ce, Loader2 as d, Search as we, Shield as f, X as Te } from "lucide-react";
|
|
15
|
+
import { usePermissions as Ee } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
16
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
17
|
+
import { IllustratedEmptyState as De } from "@burdenoff/fe-libs/ui";
|
|
18
18
|
//#region src/integrations/components/AddConnectionDialog.tsx
|
|
19
|
-
var
|
|
20
|
-
function
|
|
21
|
-
let { apiGatewayUrl:
|
|
19
|
+
var Oe = 1100, ke = 1101;
|
|
20
|
+
function g({ open: g, onClose: _, preselectedProviderId: v, onConnectionCreated: y }) {
|
|
21
|
+
let { apiGatewayUrl: b } = e(), { providers: x, loading: S } = re(), Ae = s(() => v ? (x ?? []).find((e) => e.id === v) ?? null : null, [x, v]), { provider: je, loading: Me } = ne(!S && v && !Ae ? v : ""), C = Ae ?? je, w = !!v && !C && (S || Me), { hasPermission: Ne, isLoading: Pe } = Ee(), Fe = !Pe && Ne(n.CONNECTION_CREATE), { createConnection: T, loading: Ie } = oe(), { initiateOAuth: Le, loading: Re } = se(), { authenticateConnection: ze, loading: Be } = ie(), { authenticateWithServiceAccount: Ve, loading: He } = ae(), [Ue] = te({ fetchPolicy: "network-only" }), [E, D] = l(null), [O, k] = l(!v), [A, We] = l("connection"), [j, Ge] = l(""), [M, N] = l(""), [P, F] = l(""), [I, Ke] = l(null), [L, R] = l({}), [z, qe] = l({
|
|
22
22
|
mode: "managed",
|
|
23
23
|
vaultId: "",
|
|
24
24
|
secretId: "",
|
|
25
25
|
managedSecretName: ""
|
|
26
|
-
}), [Je, B] =
|
|
27
|
-
|
|
26
|
+
}), [Je, B] = l(""), [V, H] = l(!1), [Ye, U] = l(!1), [, Xe] = l(null), W = c(null), G = c(null), Ze = c(null), Qe = ve(), K = (e) => `${Qe}-${e}`, q = s(() => (E?.authMethods ?? []).filter((e) => e.isEnabled), [E]), J = s(() => q.find((e) => e.key === I) ?? q[0] ?? null, [q, I]), Y = J?.flow ?? ee(E?.authType), $e = J?.authType ?? E?.authType, X = s(() => J?.defaultScopes?.length ? J.defaultScopes : E?.defaultScopes ?? [], [J, E]), Z = s(() => he(J?.configSchema ?? E?.configSchema), [J, E]);
|
|
27
|
+
o(() => {
|
|
28
28
|
R(pe(Z)), B("");
|
|
29
|
-
}, [
|
|
30
|
-
if (!
|
|
29
|
+
}, [I, E?.id]), o(() => {
|
|
30
|
+
if (!g) return;
|
|
31
31
|
let e = (e) => {
|
|
32
|
-
e.key === "Escape" &&
|
|
32
|
+
e.key === "Escape" && _();
|
|
33
33
|
};
|
|
34
34
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
35
|
-
}, [
|
|
35
|
+
}, [g, _]), o(() => () => {
|
|
36
36
|
G.current?.(), W.current && !W.current.closed && W.current.close();
|
|
37
|
-
}, []),
|
|
38
|
-
|
|
37
|
+
}, []), o(() => {
|
|
38
|
+
g && (We("connection"), Ge(""), N(""), F(""), Ke(null), R({}), qe({
|
|
39
39
|
mode: "managed",
|
|
40
40
|
vaultId: "",
|
|
41
41
|
secretId: "",
|
|
42
42
|
managedSecretName: ""
|
|
43
|
-
}), B(""), H(!1), U(!1), Xe(null),
|
|
44
|
-
}, [
|
|
45
|
-
|
|
43
|
+
}), B(""), H(!1), U(!1), Xe(null), v ? (k(!1), D(null)) : (k(!0), D(null)));
|
|
44
|
+
}, [g, v]), o(() => {
|
|
45
|
+
g && v && C && !E && (D(C), N(`${C.name} Connection`), k(!1));
|
|
46
46
|
}, [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
g,
|
|
48
|
+
v,
|
|
49
|
+
C,
|
|
50
50
|
E
|
|
51
|
-
]),
|
|
52
|
-
if (
|
|
51
|
+
]), o(() => {
|
|
52
|
+
if (g && O) {
|
|
53
53
|
let e = setTimeout(() => Ze.current?.focus(), 100);
|
|
54
54
|
return () => clearTimeout(e);
|
|
55
55
|
}
|
|
56
|
-
}, [
|
|
57
|
-
let Q =
|
|
58
|
-
let e = (
|
|
56
|
+
}, [g, O]);
|
|
57
|
+
let Q = s(() => {
|
|
58
|
+
let e = (x ?? []).filter((e) => e.pluginStatus === "installed" && e.isEnabled);
|
|
59
59
|
if (!j.trim()) return e;
|
|
60
60
|
let t = j.toLowerCase();
|
|
61
61
|
return e.filter((e) => e.name.toLowerCase().includes(t) || (e.description ?? "").toLowerCase().includes(t) || e.key.toLowerCase().includes(t));
|
|
62
|
-
}, [
|
|
62
|
+
}, [x, j]), et = s(() => {
|
|
63
63
|
let e = {};
|
|
64
64
|
return Q.forEach((t) => {
|
|
65
65
|
let n = t.category;
|
|
66
66
|
e[n] || (e[n] = []), e[n].push(t);
|
|
67
67
|
}), e;
|
|
68
|
-
}, [Q]), tt =
|
|
68
|
+
}, [Q]), tt = _e((e) => {
|
|
69
69
|
D(e), N(`${e.name} Connection`), k(!1), B("");
|
|
70
|
-
}, []), $ = Ie || Re || Ye || Be || He, nt =
|
|
70
|
+
}, []), $ = Ie || Re || Ye || Be || He, nt = _e(async () => {
|
|
71
71
|
if (!E || !M.trim()) return;
|
|
72
72
|
let e = Y === "minted";
|
|
73
73
|
if (!e) {
|
|
@@ -90,11 +90,11 @@ function _({ open: _, onClose: v, preselectedProviderId: y, onConnectionCreated:
|
|
|
90
90
|
}
|
|
91
91
|
try {
|
|
92
92
|
B("");
|
|
93
|
-
let t = await
|
|
93
|
+
let t = await T({
|
|
94
94
|
name: M.trim(),
|
|
95
95
|
description: P.trim() || void 0,
|
|
96
96
|
providerId: E.id,
|
|
97
|
-
authMethodKey:
|
|
97
|
+
authMethodKey: I ?? void 0,
|
|
98
98
|
...Y === "oauth2" && Z ? { config: ge(Z, L) } : {},
|
|
99
99
|
...e ? {} : {
|
|
100
100
|
vaultId: z.vaultId,
|
|
@@ -108,7 +108,7 @@ function _({ open: _, onClose: v, preselectedProviderId: y, onConnectionCreated:
|
|
|
108
108
|
}
|
|
109
109
|
switch (Xe(t), Y) {
|
|
110
110
|
case "oauth2": {
|
|
111
|
-
let e = await Le(t,
|
|
111
|
+
let e = await Le(t, b ? `${b}/integrations/oauth/callback` : "/integrations/oauth/callback", E.key);
|
|
112
112
|
if (e?.redirectUrl) {
|
|
113
113
|
let n = window.screenX + (window.innerWidth - 600) / 2, r = window.screenY + (window.innerHeight - 700) / 2, i = window.open(e.redirectUrl, "oauth_popup", `width=600,height=700,left=${n},top=${r},toolbar=no,menubar=no,scrollbars=yes,resizable=yes`);
|
|
114
114
|
if (!i) {
|
|
@@ -123,7 +123,7 @@ function _({ open: _, onClose: v, preselectedProviderId: y, onConnectionCreated:
|
|
|
123
123
|
return e?.getConnection ?? null;
|
|
124
124
|
},
|
|
125
125
|
onSuccess: () => {
|
|
126
|
-
H(!0),
|
|
126
|
+
H(!0), y?.(t);
|
|
127
127
|
},
|
|
128
128
|
onError: B,
|
|
129
129
|
onSettled: () => {
|
|
@@ -132,11 +132,11 @@ function _({ open: _, onClose: v, preselectedProviderId: y, onConnectionCreated:
|
|
|
132
132
|
});
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
|
-
H(!0),
|
|
135
|
+
H(!0), y?.(t);
|
|
136
136
|
break;
|
|
137
137
|
}
|
|
138
138
|
case "minted":
|
|
139
|
-
$e === "service_account" && await Ve(t, X.length > 0 ? X : void 0), H(!0),
|
|
139
|
+
$e === "service_account" && await Ve(t, X.length > 0 ? X : void 0), H(!0), y?.(t);
|
|
140
140
|
break;
|
|
141
141
|
default: {
|
|
142
142
|
if (Z && !me(Z, L)) {
|
|
@@ -148,7 +148,7 @@ function _({ open: _, onClose: v, preselectedProviderId: y, onConnectionCreated:
|
|
|
148
148
|
let r = n.trim();
|
|
149
149
|
r && (e[t] = r);
|
|
150
150
|
} else n != null && (e[t] = n);
|
|
151
|
-
await ze(t,
|
|
151
|
+
await ze(t, I ?? void 0, e), H(!0), y?.(t);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
} catch (e) {
|
|
@@ -158,146 +158,128 @@ function _({ open: _, onClose: v, preselectedProviderId: y, onConnectionCreated:
|
|
|
158
158
|
E,
|
|
159
159
|
M,
|
|
160
160
|
P,
|
|
161
|
-
|
|
161
|
+
I,
|
|
162
162
|
Y,
|
|
163
163
|
$e,
|
|
164
164
|
X,
|
|
165
165
|
Z,
|
|
166
166
|
L,
|
|
167
167
|
J,
|
|
168
|
-
|
|
168
|
+
T,
|
|
169
169
|
Le,
|
|
170
170
|
Ue,
|
|
171
171
|
ze,
|
|
172
172
|
Ve,
|
|
173
|
-
x,
|
|
174
173
|
b,
|
|
174
|
+
y,
|
|
175
175
|
z
|
|
176
176
|
]), rt = [{
|
|
177
177
|
key: "connection",
|
|
178
178
|
label: "Connection",
|
|
179
|
-
icon:
|
|
179
|
+
icon: Ce
|
|
180
180
|
}, {
|
|
181
181
|
key: "details",
|
|
182
182
|
label: "Details",
|
|
183
|
-
icon:
|
|
183
|
+
icon: Se
|
|
184
184
|
}];
|
|
185
|
-
return
|
|
186
|
-
style: { zIndex:
|
|
185
|
+
return g ? !Fe && !Pe ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("div", {
|
|
186
|
+
style: { zIndex: Oe },
|
|
187
187
|
className: "fixed inset-0 bg-bg-overlay animate-in fade-in-0 duration-200",
|
|
188
|
-
onClick:
|
|
189
|
-
}), /* @__PURE__ */
|
|
188
|
+
onClick: _
|
|
189
|
+
}), /* @__PURE__ */ h("div", {
|
|
190
190
|
role: "dialog",
|
|
191
191
|
"aria-modal": "true",
|
|
192
192
|
"aria-labelledby": "add-connection-denied-title",
|
|
193
|
-
style: { zIndex:
|
|
193
|
+
style: { zIndex: ke },
|
|
194
194
|
className: "fixed inset-x-4 top-1/2 mx-auto flex max-w-md -translate-y-1/2 flex-col items-center gap-4 rounded-xl border border-border-subtle bg-bg-surface p-8 shadow-2xl text-center",
|
|
195
195
|
children: [
|
|
196
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ m(f, {
|
|
197
197
|
size: 40,
|
|
198
198
|
className: "text-text-secondary"
|
|
199
199
|
}),
|
|
200
|
-
/* @__PURE__ */
|
|
200
|
+
/* @__PURE__ */ m("h2", {
|
|
201
201
|
id: "add-connection-denied-title",
|
|
202
202
|
className: "text-lg font-semibold text-text-primary",
|
|
203
203
|
children: "Access Denied"
|
|
204
204
|
}),
|
|
205
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ m("p", {
|
|
206
206
|
className: "text-sm text-text-secondary",
|
|
207
207
|
children: "You don't have permission to create connections."
|
|
208
208
|
}),
|
|
209
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ m("button", {
|
|
210
210
|
type: "button",
|
|
211
|
-
onClick:
|
|
211
|
+
onClick: _,
|
|
212
212
|
className: "px-4 py-2 text-sm font-medium rounded-md border border-border-subtle hover:bg-accent transition-colors",
|
|
213
213
|
children: "Close"
|
|
214
214
|
})
|
|
215
215
|
]
|
|
216
|
-
})] }) : /* @__PURE__ */
|
|
217
|
-
style: { zIndex:
|
|
216
|
+
})] }) : /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("div", {
|
|
217
|
+
style: { zIndex: Oe },
|
|
218
218
|
className: "fixed inset-0 bg-bg-overlay animate-in fade-in-0 duration-200",
|
|
219
|
-
onClick:
|
|
220
|
-
}), /* @__PURE__ */
|
|
219
|
+
onClick: _
|
|
220
|
+
}), /* @__PURE__ */ h("div", {
|
|
221
221
|
role: "dialog",
|
|
222
222
|
"aria-modal": "true",
|
|
223
223
|
"aria-labelledby": "add-connection-dialog-title",
|
|
224
|
-
style: { zIndex:
|
|
224
|
+
style: { zIndex: ke },
|
|
225
225
|
className: "fixed inset-x-4 top-4 bottom-4 mx-auto flex w-auto max-w-3xl flex-col overflow-hidden rounded-xl border border-border-subtle bg-bg-surface shadow-2xl animate-in fade-in-0 zoom-in-95 duration-200 sm:inset-x-6 sm:top-1/2 sm:bottom-auto sm:max-h-[min(90vh,56rem)] sm:w-full sm:-translate-y-1/2",
|
|
226
|
-
children: [/* @__PURE__ */
|
|
226
|
+
children: [/* @__PURE__ */ h("div", {
|
|
227
227
|
className: "flex items-center justify-between px-5 py-4 border-b border-border-subtle flex-shrink-0",
|
|
228
|
-
children: [/* @__PURE__ */
|
|
228
|
+
children: [/* @__PURE__ */ m("div", {
|
|
229
229
|
className: "flex items-center gap-3",
|
|
230
|
-
children: E && !O ? /* @__PURE__ */
|
|
230
|
+
children: E && !O ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(a, {
|
|
231
231
|
provider: E,
|
|
232
232
|
size: 32
|
|
233
|
-
}), /* @__PURE__ */
|
|
233
|
+
}), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ h("h2", {
|
|
234
234
|
id: "add-connection-dialog-title",
|
|
235
235
|
className: "text-base font-semibold text-text-primary",
|
|
236
236
|
children: [E.name, " account"]
|
|
237
|
-
}), /* @__PURE__ */
|
|
237
|
+
}), /* @__PURE__ */ m("p", {
|
|
238
238
|
className: "text-xs text-text-secondary",
|
|
239
239
|
children: r(E.authType)
|
|
240
|
-
})] })] }) : /* @__PURE__ */
|
|
240
|
+
})] })] }) : /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("h2", {
|
|
241
241
|
id: "add-connection-dialog-title",
|
|
242
242
|
className: "text-base font-semibold text-text-primary",
|
|
243
243
|
children: "Add new credential"
|
|
244
|
-
}), /* @__PURE__ */
|
|
244
|
+
}), /* @__PURE__ */ m("p", {
|
|
245
245
|
className: "text-xs text-text-secondary",
|
|
246
246
|
children: "Select an app or service to connect to"
|
|
247
247
|
})] })
|
|
248
|
-
}), /* @__PURE__ */
|
|
248
|
+
}), /* @__PURE__ */ h("div", {
|
|
249
249
|
className: "flex items-center gap-2",
|
|
250
|
-
children: [
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
E && !O && !V && /* @__PURE__ */ g("button", {
|
|
267
|
-
type: "button",
|
|
268
|
-
onClick: nt,
|
|
269
|
-
disabled: $ || !M.trim(),
|
|
270
|
-
className: "inline-flex items-center gap-1.5 px-4 py-1.5 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors disabled:opacity-50",
|
|
271
|
-
children: [$ ? /* @__PURE__ */ h(f, {
|
|
272
|
-
size: 14,
|
|
273
|
-
className: "animate-spin"
|
|
274
|
-
}) : /* @__PURE__ */ h(ve, { size: 14 }), Ye ? "Waiting..." : "Save"]
|
|
275
|
-
}),
|
|
276
|
-
/* @__PURE__ */ h("button", {
|
|
277
|
-
type: "button",
|
|
278
|
-
onClick: v,
|
|
279
|
-
className: "p-1.5 rounded-md hover:bg-accent transition-colors text-text-secondary hover:text-text-primary",
|
|
280
|
-
"aria-label": "Close",
|
|
281
|
-
children: /* @__PURE__ */ h(we, { size: 20 })
|
|
282
|
-
})
|
|
283
|
-
]
|
|
250
|
+
children: [E && !O && !V && /* @__PURE__ */ h("button", {
|
|
251
|
+
type: "button",
|
|
252
|
+
onClick: nt,
|
|
253
|
+
disabled: $ || !M.trim(),
|
|
254
|
+
className: "inline-flex items-center gap-1.5 px-4 py-1.5 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors disabled:opacity-50",
|
|
255
|
+
children: [$ ? /* @__PURE__ */ m(d, {
|
|
256
|
+
size: 14,
|
|
257
|
+
className: "animate-spin"
|
|
258
|
+
}) : /* @__PURE__ */ m(ye, { size: 14 }), Ye ? "Waiting..." : "Save"]
|
|
259
|
+
}), /* @__PURE__ */ m("button", {
|
|
260
|
+
type: "button",
|
|
261
|
+
onClick: _,
|
|
262
|
+
className: "p-1.5 rounded-md hover:bg-accent transition-colors text-text-secondary hover:text-text-primary",
|
|
263
|
+
"aria-label": "Close",
|
|
264
|
+
children: /* @__PURE__ */ m(Te, { size: 20 })
|
|
265
|
+
})]
|
|
284
266
|
})]
|
|
285
|
-
}), /* @__PURE__ */
|
|
267
|
+
}), /* @__PURE__ */ h("div", {
|
|
286
268
|
className: "flex flex-1 min-h-0 overflow-hidden",
|
|
287
269
|
children: [
|
|
288
|
-
O && !E && /* @__PURE__ */
|
|
270
|
+
O && !E && /* @__PURE__ */ h("div", {
|
|
289
271
|
className: "flex-1 p-5 overflow-y-auto",
|
|
290
272
|
children: [
|
|
291
|
-
/* @__PURE__ */
|
|
273
|
+
/* @__PURE__ */ m("p", {
|
|
292
274
|
className: "text-sm text-text-secondary mb-3",
|
|
293
275
|
children: "Select an app or service to connect to"
|
|
294
276
|
}),
|
|
295
|
-
/* @__PURE__ */
|
|
277
|
+
/* @__PURE__ */ h("div", {
|
|
296
278
|
className: "relative mb-4",
|
|
297
|
-
children: [/* @__PURE__ */
|
|
279
|
+
children: [/* @__PURE__ */ m(we, {
|
|
298
280
|
size: 16,
|
|
299
281
|
className: "absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary"
|
|
300
|
-
}), /* @__PURE__ */
|
|
282
|
+
}), /* @__PURE__ */ m("input", {
|
|
301
283
|
ref: Ze,
|
|
302
284
|
type: "text",
|
|
303
285
|
value: j,
|
|
@@ -307,34 +289,34 @@ function _({ open: _, onClose: v, preselectedProviderId: y, onConnectionCreated:
|
|
|
307
289
|
className: "w-full pl-9 pr-3 py-2.5 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary"
|
|
308
290
|
})]
|
|
309
291
|
}),
|
|
310
|
-
|
|
292
|
+
S ? /* @__PURE__ */ m("div", {
|
|
311
293
|
className: "flex items-center justify-center py-8",
|
|
312
|
-
children: /* @__PURE__ */
|
|
294
|
+
children: /* @__PURE__ */ m(d, {
|
|
313
295
|
size: 24,
|
|
314
296
|
className: "animate-spin text-text-secondary"
|
|
315
297
|
})
|
|
316
|
-
}) : Q.length === 0 ? /* @__PURE__ */
|
|
298
|
+
}) : Q.length === 0 ? /* @__PURE__ */ m(De, {
|
|
317
299
|
illustration: j ? "empty-search" : "empty-data",
|
|
318
300
|
title: j ? "No matching providers" : "No providers available",
|
|
319
301
|
description: j ? `No installed provider matches “${j}”. Try a different term.` : "Install and enable a provider from the catalog to create a connection."
|
|
320
|
-
}) : /* @__PURE__ */
|
|
302
|
+
}) : /* @__PURE__ */ m("div", {
|
|
321
303
|
className: "max-h-[400px] overflow-y-auto space-y-1",
|
|
322
|
-
children: Object.entries(et).map(([e, t]) => /* @__PURE__ */
|
|
304
|
+
children: Object.entries(et).map(([e, t]) => /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("div", {
|
|
323
305
|
className: "px-2 py-1.5 text-xs font-semibold text-text-secondary uppercase tracking-wider",
|
|
324
306
|
children: i(e)
|
|
325
|
-
}), t.map((e) => /* @__PURE__ */
|
|
307
|
+
}), t.map((e) => /* @__PURE__ */ h("button", {
|
|
326
308
|
type: "button",
|
|
327
309
|
onClick: () => tt(e),
|
|
328
310
|
className: "w-full flex items-center gap-3 px-3 py-2.5 rounded-md hover:bg-accent/50 transition-colors text-left",
|
|
329
|
-
children: [/* @__PURE__ */
|
|
311
|
+
children: [/* @__PURE__ */ m(a, {
|
|
330
312
|
provider: e,
|
|
331
313
|
size: 32
|
|
332
|
-
}), /* @__PURE__ */
|
|
314
|
+
}), /* @__PURE__ */ h("div", {
|
|
333
315
|
className: "flex-1 min-w-0",
|
|
334
|
-
children: [/* @__PURE__ */
|
|
316
|
+
children: [/* @__PURE__ */ m("div", {
|
|
335
317
|
className: "text-sm font-medium text-text-primary",
|
|
336
318
|
children: e.name
|
|
337
|
-
}), /* @__PURE__ */
|
|
319
|
+
}), /* @__PURE__ */ m("div", {
|
|
338
320
|
className: "text-xs text-text-secondary",
|
|
339
321
|
children: r(e.authType)
|
|
340
322
|
})]
|
|
@@ -343,38 +325,38 @@ function _({ open: _, onClose: v, preselectedProviderId: y, onConnectionCreated:
|
|
|
343
325
|
})
|
|
344
326
|
]
|
|
345
327
|
}),
|
|
346
|
-
!O && !E &&
|
|
328
|
+
!O && !E && w && /* @__PURE__ */ m("div", {
|
|
347
329
|
className: "flex-1 flex items-center justify-center",
|
|
348
|
-
children: /* @__PURE__ */
|
|
330
|
+
children: /* @__PURE__ */ m(d, {
|
|
349
331
|
size: 32,
|
|
350
332
|
className: "animate-spin text-text-secondary"
|
|
351
333
|
})
|
|
352
334
|
}),
|
|
353
|
-
!O && !E && !
|
|
335
|
+
!O && !E && !w && v && /* @__PURE__ */ h("div", {
|
|
354
336
|
className: "flex-1 flex flex-col items-center justify-center p-8 text-center",
|
|
355
|
-
children: [/* @__PURE__ */
|
|
337
|
+
children: [/* @__PURE__ */ m(u, {
|
|
356
338
|
size: 32,
|
|
357
339
|
className: "text-text-secondary mb-3"
|
|
358
|
-
}), /* @__PURE__ */
|
|
340
|
+
}), /* @__PURE__ */ m("p", {
|
|
359
341
|
className: "text-sm text-text-secondary",
|
|
360
342
|
children: "This provider isn't available."
|
|
361
343
|
})]
|
|
362
344
|
}),
|
|
363
|
-
V && E && /* @__PURE__ */
|
|
345
|
+
V && E && /* @__PURE__ */ h("div", {
|
|
364
346
|
className: "flex-1 flex flex-col items-center justify-center p-8 text-center",
|
|
365
347
|
children: [
|
|
366
|
-
/* @__PURE__ */
|
|
348
|
+
/* @__PURE__ */ m("div", {
|
|
367
349
|
className: "p-3 rounded-full bg-status-success-bg-subtle mb-4",
|
|
368
|
-
children: /* @__PURE__ */
|
|
350
|
+
children: /* @__PURE__ */ m(be, {
|
|
369
351
|
size: 48,
|
|
370
352
|
className: "text-status-success-text"
|
|
371
353
|
})
|
|
372
354
|
}),
|
|
373
|
-
/* @__PURE__ */
|
|
355
|
+
/* @__PURE__ */ m("h3", {
|
|
374
356
|
className: "text-lg font-semibold text-text-primary mb-1",
|
|
375
357
|
children: "Connection Created!"
|
|
376
358
|
}),
|
|
377
|
-
/* @__PURE__ */
|
|
359
|
+
/* @__PURE__ */ h("p", {
|
|
378
360
|
className: "text-sm text-text-secondary mb-6",
|
|
379
361
|
children: [
|
|
380
362
|
"Your ",
|
|
@@ -382,48 +364,48 @@ function _({ open: _, onClose: v, preselectedProviderId: y, onConnectionCreated:
|
|
|
382
364
|
" connection has been set up successfully."
|
|
383
365
|
]
|
|
384
366
|
}),
|
|
385
|
-
/* @__PURE__ */
|
|
367
|
+
/* @__PURE__ */ m("button", {
|
|
386
368
|
type: "button",
|
|
387
|
-
onClick:
|
|
369
|
+
onClick: _,
|
|
388
370
|
className: "px-4 py-2 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors",
|
|
389
371
|
children: "Close dialog"
|
|
390
372
|
})
|
|
391
373
|
]
|
|
392
374
|
}),
|
|
393
|
-
E && !O && !V && /* @__PURE__ */
|
|
375
|
+
E && !O && !V && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("div", {
|
|
394
376
|
className: "w-full border-b border-border-subtle sm:w-40 sm:border-b-0 sm:border-r flex-shrink-0 py-3 overflow-x-auto",
|
|
395
377
|
children: rt.map((e) => {
|
|
396
378
|
let n = e.icon;
|
|
397
|
-
return /* @__PURE__ */
|
|
379
|
+
return /* @__PURE__ */ h("button", {
|
|
398
380
|
type: "button",
|
|
399
381
|
onClick: () => We(e.key),
|
|
400
382
|
className: t("flex min-w-max items-center gap-2 px-4 py-2 text-sm font-medium transition-colors sm:w-full", A === e.key ? "text-text-primary bg-accent/50 border-b-2 border-primary sm:border-b-0 sm:border-l-2" : "text-text-secondary hover:text-text-primary hover:bg-accent/30 border-b-2 border-transparent sm:border-b-0 sm:border-l-2"),
|
|
401
|
-
children: [/* @__PURE__ */
|
|
383
|
+
children: [/* @__PURE__ */ m(n, { size: 16 }), e.label]
|
|
402
384
|
}, e.key);
|
|
403
385
|
})
|
|
404
|
-
}), /* @__PURE__ */
|
|
386
|
+
}), /* @__PURE__ */ h("div", {
|
|
405
387
|
className: "flex-1 p-5 overflow-y-auto",
|
|
406
|
-
children: [A === "connection" && /* @__PURE__ */
|
|
388
|
+
children: [A === "connection" && /* @__PURE__ */ h("div", {
|
|
407
389
|
className: "space-y-5",
|
|
408
390
|
children: [
|
|
409
|
-
Je && /* @__PURE__ */
|
|
391
|
+
Je && /* @__PURE__ */ h("div", {
|
|
410
392
|
className: "flex items-center gap-2 px-3 py-2 rounded-md bg-status-error-bg/10 border border-status-error-border/20",
|
|
411
|
-
children: [/* @__PURE__ */
|
|
393
|
+
children: [/* @__PURE__ */ m(u, {
|
|
412
394
|
size: 16,
|
|
413
395
|
className: "text-status-error-text flex-shrink-0"
|
|
414
|
-
}), /* @__PURE__ */
|
|
396
|
+
}), /* @__PURE__ */ m("span", {
|
|
415
397
|
className: "text-sm text-status-error-text",
|
|
416
398
|
children: Je
|
|
417
399
|
})]
|
|
418
400
|
}),
|
|
419
|
-
/* @__PURE__ */
|
|
401
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ h("label", {
|
|
420
402
|
htmlFor: K("conn-name"),
|
|
421
403
|
className: "block text-sm font-medium text-text-primary mb-1.5",
|
|
422
|
-
children: ["Connection Name ", /* @__PURE__ */
|
|
404
|
+
children: ["Connection Name ", /* @__PURE__ */ m("span", {
|
|
423
405
|
className: "text-status-error-text",
|
|
424
406
|
children: "*"
|
|
425
407
|
})]
|
|
426
|
-
}), /* @__PURE__ */
|
|
408
|
+
}), /* @__PURE__ */ m("input", {
|
|
427
409
|
id: K("conn-name"),
|
|
428
410
|
"aria-label": "Connection Name",
|
|
429
411
|
type: "text",
|
|
@@ -433,72 +415,72 @@ function _({ open: _, onClose: v, preselectedProviderId: y, onConnectionCreated:
|
|
|
433
415
|
disabled: $,
|
|
434
416
|
className: "w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50"
|
|
435
417
|
})] }),
|
|
436
|
-
/* @__PURE__ */
|
|
418
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("label", {
|
|
437
419
|
htmlFor: K("conn-desc"),
|
|
438
420
|
className: "block text-sm font-medium text-text-primary mb-1.5",
|
|
439
421
|
children: "Description"
|
|
440
|
-
}), /* @__PURE__ */
|
|
422
|
+
}), /* @__PURE__ */ m("input", {
|
|
441
423
|
id: K("conn-desc"),
|
|
442
424
|
"aria-label": "Description",
|
|
443
425
|
type: "text",
|
|
444
426
|
value: P,
|
|
445
|
-
onChange: (e) =>
|
|
427
|
+
onChange: (e) => F(e.target.value),
|
|
446
428
|
placeholder: "Optional description",
|
|
447
429
|
disabled: $,
|
|
448
430
|
className: "w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50"
|
|
449
431
|
})] }),
|
|
450
|
-
E.authType !== "service_account" && /* @__PURE__ */
|
|
432
|
+
E.authType !== "service_account" && /* @__PURE__ */ m(le, {
|
|
451
433
|
value: z,
|
|
452
434
|
onChange: qe,
|
|
453
435
|
providerAuthType: E.authType
|
|
454
436
|
}),
|
|
455
|
-
/* @__PURE__ */
|
|
437
|
+
/* @__PURE__ */ h("div", {
|
|
456
438
|
className: "rounded-md border border-border-subtle/50 bg-bg-surface p-4 space-y-3",
|
|
457
439
|
children: [
|
|
458
|
-
/* @__PURE__ */ g("h3", {
|
|
459
|
-
className: "font-medium text-text-primary flex items-center gap-2 text-sm",
|
|
460
|
-
children: [
|
|
461
|
-
/* @__PURE__ */ h(p, {
|
|
462
|
-
size: 16,
|
|
463
|
-
className: "text-primary"
|
|
464
|
-
}),
|
|
465
|
-
"Authentication",
|
|
466
|
-
q.length <= 1 && /* @__PURE__ */ g("span", {
|
|
467
|
-
className: "text-text-secondary font-normal",
|
|
468
|
-
children: [
|
|
469
|
-
"·",
|
|
470
|
-
" ",
|
|
471
|
-
J?.displayName ?? r(E.authType)
|
|
472
|
-
]
|
|
473
|
-
})
|
|
474
|
-
]
|
|
475
|
-
}),
|
|
476
440
|
/* @__PURE__ */ h("div", {
|
|
477
|
-
className: "
|
|
478
|
-
children: /* @__PURE__ */ h(
|
|
441
|
+
className: "flex items-center justify-between gap-3",
|
|
442
|
+
children: [/* @__PURE__ */ h("h3", {
|
|
443
|
+
className: "font-medium text-text-primary flex items-center gap-2 text-sm",
|
|
444
|
+
children: [
|
|
445
|
+
/* @__PURE__ */ m(f, {
|
|
446
|
+
size: 16,
|
|
447
|
+
className: "text-primary"
|
|
448
|
+
}),
|
|
449
|
+
"Authentication",
|
|
450
|
+
q.length <= 1 && /* @__PURE__ */ h("span", {
|
|
451
|
+
className: "text-text-secondary font-normal",
|
|
452
|
+
children: [
|
|
453
|
+
"·",
|
|
454
|
+
" ",
|
|
455
|
+
J?.displayName ?? r(E.authType)
|
|
456
|
+
]
|
|
457
|
+
})
|
|
458
|
+
]
|
|
459
|
+
}), /* @__PURE__ */ m(de, {
|
|
479
460
|
methods: q,
|
|
480
|
-
selectedKey:
|
|
481
|
-
onSelect:
|
|
461
|
+
selectedKey: I,
|
|
462
|
+
onSelect: Ke,
|
|
482
463
|
disabled: $,
|
|
483
|
-
idPrefix: K("auth-method
|
|
484
|
-
|
|
464
|
+
idPrefix: K("auth-method"),
|
|
465
|
+
compact: !0
|
|
466
|
+
})]
|
|
485
467
|
}),
|
|
486
|
-
/* @__PURE__ */
|
|
487
|
-
className:
|
|
488
|
-
children: /* @__PURE__ */
|
|
468
|
+
/* @__PURE__ */ m("div", {
|
|
469
|
+
className: "space-y-2",
|
|
470
|
+
children: /* @__PURE__ */ m(ue, { method: J })
|
|
489
471
|
}),
|
|
490
|
-
Y === "oauth2" && /* @__PURE__ */
|
|
472
|
+
Y === "oauth2" && /* @__PURE__ */ h(p, { children: [Z && /* @__PURE__ */ m(fe, {
|
|
491
473
|
schema: Z,
|
|
492
474
|
values: L,
|
|
493
475
|
onChange: R,
|
|
494
476
|
disabled: $,
|
|
495
477
|
idPrefix: K("oauth-cfg")
|
|
496
|
-
}), /* @__PURE__ */
|
|
478
|
+
}), /* @__PURE__ */ h("div", {
|
|
497
479
|
className: "flex items-center gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default",
|
|
498
|
-
children: [/* @__PURE__ */
|
|
480
|
+
children: [/* @__PURE__ */ m(xe, {
|
|
499
481
|
size: 14,
|
|
500
482
|
className: "text-status-info-text flex-shrink-0"
|
|
501
|
-
}), /* @__PURE__ */
|
|
483
|
+
}), /* @__PURE__ */ h("span", {
|
|
502
484
|
className: "text-xs text-status-info-text",
|
|
503
485
|
children: [
|
|
504
486
|
"A popup window will open for ",
|
|
@@ -507,31 +489,31 @@ function _({ open: _, onClose: v, preselectedProviderId: y, onConnectionCreated:
|
|
|
507
489
|
]
|
|
508
490
|
})]
|
|
509
491
|
})] }),
|
|
510
|
-
Y === "minted" && /* @__PURE__ */
|
|
492
|
+
Y === "minted" && /* @__PURE__ */ h("div", {
|
|
511
493
|
className: "flex items-center gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default",
|
|
512
|
-
children: [/* @__PURE__ */
|
|
494
|
+
children: [/* @__PURE__ */ m(f, {
|
|
513
495
|
size: 14,
|
|
514
496
|
className: "text-status-info-text flex-shrink-0"
|
|
515
|
-
}), /* @__PURE__ */
|
|
497
|
+
}), /* @__PURE__ */ m("span", {
|
|
516
498
|
className: "text-xs text-status-info-text",
|
|
517
499
|
children: "No credentials to enter — access is granted on your behalf and tokens are issued per use."
|
|
518
500
|
})]
|
|
519
501
|
}),
|
|
520
|
-
Y === "fields" && (Z ? /* @__PURE__ */
|
|
502
|
+
Y === "fields" && (Z ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("p", {
|
|
521
503
|
className: "text-xs text-text-secondary",
|
|
522
504
|
children: "Secret values are stored encrypted and never shown again."
|
|
523
|
-
}), /* @__PURE__ */
|
|
505
|
+
}), /* @__PURE__ */ m(fe, {
|
|
524
506
|
schema: Z,
|
|
525
507
|
values: L,
|
|
526
508
|
onChange: R,
|
|
527
509
|
disabled: $,
|
|
528
510
|
idPrefix: K("cred")
|
|
529
|
-
})] }) : /* @__PURE__ */
|
|
511
|
+
})] }) : /* @__PURE__ */ h("div", {
|
|
530
512
|
className: "flex items-center gap-2 px-3 py-2 rounded-md bg-status-error-bg-subtle border border-border-default",
|
|
531
|
-
children: [/* @__PURE__ */
|
|
513
|
+
children: [/* @__PURE__ */ m(u, {
|
|
532
514
|
size: 16,
|
|
533
515
|
className: "text-status-error-text flex-shrink-0"
|
|
534
|
-
}), /* @__PURE__ */
|
|
516
|
+
}), /* @__PURE__ */ m("span", {
|
|
535
517
|
className: "text-sm text-status-error-text",
|
|
536
518
|
children: "This authentication method does not declare a configuration form."
|
|
537
519
|
})]
|
|
@@ -539,23 +521,23 @@ function _({ open: _, onClose: v, preselectedProviderId: y, onConnectionCreated:
|
|
|
539
521
|
]
|
|
540
522
|
})
|
|
541
523
|
]
|
|
542
|
-
}), A === "details" && /* @__PURE__ */
|
|
524
|
+
}), A === "details" && /* @__PURE__ */ h("div", {
|
|
543
525
|
className: "space-y-4",
|
|
544
|
-
children: [/* @__PURE__ */
|
|
526
|
+
children: [/* @__PURE__ */ m("h3", {
|
|
545
527
|
className: "text-sm font-semibold text-text-primary",
|
|
546
528
|
children: "Details"
|
|
547
|
-
}), /* @__PURE__ */
|
|
529
|
+
}), /* @__PURE__ */ h("div", {
|
|
548
530
|
className: "space-y-3",
|
|
549
531
|
children: [
|
|
550
|
-
/* @__PURE__ */
|
|
532
|
+
/* @__PURE__ */ h("div", {
|
|
551
533
|
className: "flex items-center gap-3 p-3 rounded-md border border-border-subtle",
|
|
552
|
-
children: [/* @__PURE__ */
|
|
534
|
+
children: [/* @__PURE__ */ m(a, {
|
|
553
535
|
provider: E,
|
|
554
536
|
size: 40
|
|
555
|
-
}), /* @__PURE__ */
|
|
537
|
+
}), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("p", {
|
|
556
538
|
className: "text-sm font-medium text-text-primary",
|
|
557
539
|
children: E.name
|
|
558
|
-
}), /* @__PURE__ */
|
|
540
|
+
}), /* @__PURE__ */ h("p", {
|
|
559
541
|
className: "text-xs text-text-secondary",
|
|
560
542
|
children: [
|
|
561
543
|
r(E.authType),
|
|
@@ -565,27 +547,27 @@ function _({ open: _, onClose: v, preselectedProviderId: y, onConnectionCreated:
|
|
|
565
547
|
]
|
|
566
548
|
})] })]
|
|
567
549
|
}),
|
|
568
|
-
E.description && /* @__PURE__ */
|
|
550
|
+
E.description && /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("div", {
|
|
569
551
|
className: "text-xs font-medium text-text-secondary uppercase tracking-wider",
|
|
570
552
|
children: "Description"
|
|
571
|
-
}), /* @__PURE__ */
|
|
553
|
+
}), /* @__PURE__ */ m("p", {
|
|
572
554
|
className: "text-sm text-text-primary mt-1",
|
|
573
555
|
children: E.description
|
|
574
556
|
})] }),
|
|
575
|
-
E.website && /* @__PURE__ */
|
|
557
|
+
E.website && /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("div", {
|
|
576
558
|
className: "text-xs font-medium text-text-secondary uppercase tracking-wider",
|
|
577
559
|
children: "Website"
|
|
578
|
-
}), /* @__PURE__ */
|
|
560
|
+
}), /* @__PURE__ */ m("a", {
|
|
579
561
|
href: E.website,
|
|
580
562
|
target: "_blank",
|
|
581
563
|
rel: "noopener noreferrer",
|
|
582
564
|
className: "block text-sm text-primary hover:underline mt-1",
|
|
583
565
|
children: E.website
|
|
584
566
|
})] }),
|
|
585
|
-
E.docsUrl && /* @__PURE__ */
|
|
567
|
+
E.docsUrl && /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("div", {
|
|
586
568
|
className: "text-xs font-medium text-text-secondary uppercase tracking-wider",
|
|
587
569
|
children: "Documentation"
|
|
588
|
-
}), /* @__PURE__ */
|
|
570
|
+
}), /* @__PURE__ */ m("a", {
|
|
589
571
|
href: E.docsUrl,
|
|
590
572
|
target: "_blank",
|
|
591
573
|
rel: "noopener noreferrer",
|
|
@@ -601,6 +583,6 @@ function _({ open: _, onClose: v, preselectedProviderId: y, onConnectionCreated:
|
|
|
601
583
|
})] }) : null;
|
|
602
584
|
}
|
|
603
585
|
//#endregion
|
|
604
|
-
export {
|
|
586
|
+
export { g as AddConnectionDialog };
|
|
605
587
|
|
|
606
588
|
//# sourceMappingURL=AddConnectionDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddConnectionDialog.js","names":[],"sources":["../../../src/integrations/components/AddConnectionDialog.tsx"],"sourcesContent":["/**\n * AddConnectionDialog -- n8n-style popup for creating new connections.\n *\n * Replaces the full-page AddConnectionWizard with an inline modal dialog.\n * Uses the same hooks and GraphQL operations that already exist in\n * microfe-integrations (useCreateConnection, useInitiateOAuth, etc.).\n *\n * Opens from any page via Zustand store state, so there is no navigation\n * to /connections/add — the dialog overlays the current page.\n */\n\nimport { useState, useMemo, useCallback, useEffect, useRef, useId } from 'react';\nimport {\n X,\n Check,\n Loader2,\n AlertCircle,\n CheckCircle2,\n Search,\n ExternalLink,\n Shield,\n Link2,\n Info,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\nimport {\n getAuthTypeLabel,\n getCategoryLabel,\n legacyFlowForAuthType,\n} from '../utils/integrationsHelpers';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { useProviders, useProvider } from '../hooks/useProviders';\nimport {\n useCreateConnection,\n useInitiateOAuth,\n useAuthenticateConnection,\n useAuthenticateWithServiceAccount,\n} from '../hooks/useConnections';\nimport { useGetConnectionLazyQuery } from '../../generated/wspace-operations';\nimport { waitForOAuthPopupCompletion } from '../utils/oauthPopup';\nimport {\n CredentialStorageSelector,\n type CredentialStorageState,\n} from './CredentialStorageSelector';\nimport { AuthMethodNotice, AuthMethodSelector } from './AuthMethodSelector';\nimport { ProviderIcon } from './ProviderIcon';\nimport {\n SchemaForm,\n initialValuesFromSchema,\n isSchemaComplete,\n parseFormSchema,\n visibleValues,\n} from './SchemaForm';\nimport type { IntegrationProvider } from '../types';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface AddConnectionDialogProps {\n /** Whether the dialog is open */\n open: boolean;\n /** Callback to close the dialog */\n onClose: () => void;\n /** Pre-selected provider ID (skips provider picker step) */\n preselectedProviderId?: string | null;\n /** Callback when a connection is successfully created */\n onConnectionCreated?: (connectionId: string) => void;\n}\n\ntype DialogTab = 'connection' | 'details';\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * Above the app shell's header (`z-index: 100`).\n *\n * The dialog used to sit at Tailwind's `z-50`, so the shell header painted over\n * its top edge and swallowed the title and the Method control — the dialog\n * looked \"cut off\" no matter how its height was constrained. A modal must\n * out-rank the chrome it covers, and Tailwind's scale stops well below it.\n */\nconst OVERLAY_Z = 1100;\nconst DIALOG_Z = 1101;\n\nexport function AddConnectionDialog({\n open,\n onClose,\n preselectedProviderId,\n onConnectionCreated,\n}: AddConnectionDialogProps) {\n // Provider data\n const { apiGatewayUrl } = useIntegrations();\n const { providers, loading: providersLoading } = useProviders();\n // A preselected id may not be in the catalog page (disabled provider linked\n // from its own detail page). Resolve such ids via a direct by-id fetch so the\n // dialog never dead-ends on a blank body.\n const providerInList = useMemo(\n () =>\n preselectedProviderId\n ? ((providers ?? []).find((p: IntegrationProvider) => p.id === preselectedProviderId) ??\n null)\n : null,\n [providers, preselectedProviderId]\n );\n // Only fetch once the catalog has loaded and confirmed the id isn't in the\n // filtered list — avoids a redundant GetProvider for visible providers.\n const { provider: fetchedPreselectedProvider, loading: fetchedPreselectedLoading } = useProvider(\n !providersLoading && preselectedProviderId && !providerInList ? preselectedProviderId : ''\n );\n const resolvedPreselectedProvider = providerInList ?? fetchedPreselectedProvider;\n // True while a preselected provider is still being resolved (catalog load or\n // the by-id fallback fetch) — keeps the body showing a spinner, not blank.\n const preselectedResolving =\n !!preselectedProviderId &&\n !resolvedPreselectedProvider &&\n (providersLoading || fetchedPreselectedLoading);\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canCreate = !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE);\n\n // Mutations\n const { createConnection, loading: creating } = useCreateConnection();\n const { initiateOAuth, loading: oauthLoading } = useInitiateOAuth();\n const { authenticateConnection, loading: authenticating } = useAuthenticateConnection();\n const { authenticateWithServiceAccount, loading: serviceAccountLoading } =\n useAuthenticateWithServiceAccount();\n const [fetchConnection] = useGetConnectionLazyQuery({ fetchPolicy: 'network-only' });\n\n // State\n const [selectedProvider, setSelectedProvider] = useState<IntegrationProvider | null>(null);\n const [showPicker, setShowPicker] = useState(!preselectedProviderId);\n const [activeTab, setActiveTab] = useState<DialogTab>('connection');\n const [searchQuery, setSearchQuery] = useState('');\n const [connectionName, setConnectionName] = useState('');\n const [connectionDescription, setConnectionDescription] = useState('');\n /** Auth method the user picked; null until a provider is selected. */\n const [selectedAuthMethodKey, setSelectedAuthMethodKey] = useState<string | null>(null);\n /** Values for the selected method's schema-described fields. */\n const [fieldValues, setFieldValues] = useState<Record<string, unknown>>({});\n const [credentialStorage, setCredentialStorage] = useState<CredentialStorageState>({\n mode: 'managed',\n vaultId: '',\n secretId: '',\n managedSecretName: '',\n });\n const [errorMessage, setErrorMessage] = useState('');\n const [success, setSuccess] = useState(false);\n const [oauthWaiting, setOauthWaiting] = useState(false);\n const [, setCreatedConnectionId] = useState<string | null>(null);\n\n const oauthPopupRef = useRef<Window | null>(null);\n const oauthCleanupRef = useRef<(() => void) | null>(null);\n const searchInputRef = useRef<HTMLInputElement>(null);\n const idPrefix = useId();\n const fieldId = (name: string) => `${idPrefix}-${name}`;\n\n // ── Auth method resolution ────────────────────────────────────────────────\n // Everything the auth section renders and submits derives from the selected\n // method. Providers with a single method behave exactly as before.\n const authMethods = useMemo(\n () => (selectedProvider?.authMethods ?? []).filter((method) => method.isEnabled),\n [selectedProvider]\n );\n const selectedAuthMethod = useMemo(\n () =>\n authMethods.find((method) => method.key === selectedAuthMethodKey) ?? authMethods[0] ?? null,\n [authMethods, selectedAuthMethodKey]\n );\n // Fall back to the provider's own authType for providers whose methods have\n // not been fetched (older fragments) or backfilled yet.\n const authFlow = selectedAuthMethod?.flow ?? legacyFlowForAuthType(selectedProvider?.authType);\n const authTypeForMethod = selectedAuthMethod?.authType ?? selectedProvider?.authType;\n // Memoized: a fresh array each render would re-create handleSubmit's\n // useCallback on every render.\n const authScopes = useMemo(\n () =>\n selectedAuthMethod?.defaultScopes?.length\n ? selectedAuthMethod.defaultScopes\n : (selectedProvider?.defaultScopes ?? []),\n [selectedAuthMethod, selectedProvider]\n );\n const activeSchema = useMemo(\n () => parseFormSchema(selectedAuthMethod?.configSchema ?? selectedProvider?.configSchema),\n [selectedAuthMethod, selectedProvider]\n );\n\n // Selecting a different method must not carry the previous method's values\n // over — they belong to a different credential shape entirely.\n useEffect(() => {\n // Seeded from the schema's declared defaults, not empty: a rendered control\n // shows its default as selected, so leaving state empty made validation\n // treat a visible value as missing and dropped it from the submission.\n setFieldValues(initialValuesFromSchema(activeSchema));\n setErrorMessage('');\n // activeSchema is derived from these two, so it is not an extra trigger.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedAuthMethodKey, selectedProvider?.id]);\n\n useEffect(() => {\n if (!open) return undefined;\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onClose();\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [open, onClose]);\n\n // Cleanup OAuth listener and popup on unmount.\n useEffect(() => {\n return () => {\n oauthCleanupRef.current?.();\n if (oauthPopupRef.current && !oauthPopupRef.current.closed) {\n oauthPopupRef.current.close();\n }\n };\n }, []);\n\n // Reset state when dialog opens\n useEffect(() => {\n if (open) {\n setActiveTab('connection');\n setSearchQuery('');\n setConnectionName('');\n setConnectionDescription('');\n setSelectedAuthMethodKey(null);\n setFieldValues({});\n setCredentialStorage({ mode: 'managed', vaultId: '', secretId: '', managedSecretName: '' });\n setErrorMessage('');\n setSuccess(false);\n setOauthWaiting(false);\n setCreatedConnectionId(null);\n\n if (preselectedProviderId) {\n setShowPicker(false);\n setSelectedProvider(null); // will be set by effect below\n } else {\n setShowPicker(true);\n setSelectedProvider(null);\n }\n }\n }, [open, preselectedProviderId]);\n\n // Find and set preselected provider (from the filtered list or, for hidden\n // built-ins, the direct by-id fetch above).\n useEffect(() => {\n if (open && preselectedProviderId && resolvedPreselectedProvider && !selectedProvider) {\n setSelectedProvider(resolvedPreselectedProvider);\n setConnectionName(`${resolvedPreselectedProvider.name} Connection`);\n setShowPicker(false);\n }\n }, [open, preselectedProviderId, resolvedPreselectedProvider, selectedProvider]);\n\n // Auto-focus search input when picker is shown\n useEffect(() => {\n if (open && showPicker) {\n const timeoutId = setTimeout(() => searchInputRef.current?.focus(), 100);\n return () => clearTimeout(timeoutId);\n }\n return undefined;\n }, [open, showPicker]);\n\n // Filter providers for picker\n const filteredProviders = useMemo(() => {\n const installed = (providers ?? []).filter(\n (p: IntegrationProvider) => p.pluginStatus === 'installed' && p.isEnabled\n );\n if (!searchQuery.trim()) return installed;\n const q = searchQuery.toLowerCase();\n return installed.filter(\n (p: IntegrationProvider) =>\n p.name.toLowerCase().includes(q) ||\n (p.description ?? '').toLowerCase().includes(q) ||\n p.key.toLowerCase().includes(q)\n );\n }, [providers, searchQuery]);\n\n // Group providers by category\n const groupedProviders = useMemo(() => {\n const groups: Record<string, IntegrationProvider[]> = {};\n filteredProviders.forEach((p: IntegrationProvider) => {\n const cat = p.category;\n if (!groups[cat]) groups[cat] = [];\n groups[cat].push(p);\n });\n return groups;\n }, [filteredProviders]);\n\n const handleSelectProvider = useCallback((provider: IntegrationProvider) => {\n setSelectedProvider(provider);\n setConnectionName(`${provider.name} Connection`);\n setShowPicker(false);\n setErrorMessage('');\n }, []);\n\n const isAuthenticating =\n creating || oauthLoading || oauthWaiting || authenticating || serviceAccountLoading;\n\n // Main submit handler\n const handleSubmit = useCallback(async () => {\n if (!selectedProvider || !connectionName.trim()) return;\n\n // Methods that mint tokens on demand store no credential, so they need no\n // vault/secret — skip the credential-storage requirement entirely.\n const isServiceAccount = authFlow === 'minted';\n\n if (!isServiceAccount) {\n if (!credentialStorage.vaultId) {\n setErrorMessage('Please select a vault for this connection');\n return;\n }\n if (credentialStorage.mode === 'existing' && !credentialStorage.secretId) {\n setErrorMessage('Please select an existing vault secret');\n return;\n }\n }\n\n if (authFlow === 'oauth2' && activeSchema && !isSchemaComplete(activeSchema, fieldValues)) {\n setErrorMessage('Please fill in all required fields');\n return;\n }\n\n if (selectedAuthMethod && !selectedAuthMethod.isConfigured) {\n setErrorMessage(\n 'This authentication method is not configured in this environment. Ask an administrator to add its credentials, or pick another method.'\n );\n return;\n }\n\n try {\n setErrorMessage('');\n\n // Step 1: Create the connection\n const connId = await createConnection({\n name: connectionName.trim(),\n description: connectionDescription.trim() || undefined,\n providerId: selectedProvider.id,\n authMethodKey: selectedAuthMethodKey ?? undefined,\n // OAuth methods collect non-secret routing settings (tenant subdomain,\n // base URL) rather than a credential, so they belong on the connection\n // config, which getConnectionToken already reads for baseUrl.\n ...(authFlow === 'oauth2' && activeSchema\n ? { config: visibleValues(activeSchema, fieldValues) as Record<string, unknown> }\n : {}),\n ...(isServiceAccount\n ? {}\n : {\n vaultId: credentialStorage.vaultId,\n credentialSecretId:\n credentialStorage.mode === 'existing' ? credentialStorage.secretId : undefined,\n managedSecretName:\n credentialStorage.mode === 'managed'\n ? credentialStorage.managedSecretName.trim() || undefined\n : undefined,\n }),\n });\n\n if (!connId) {\n setErrorMessage('Failed to create connection');\n return;\n }\n\n setCreatedConnectionId(connId);\n\n // Step 2: Authenticate. Driven by the auth method's *flow*, not by a\n // per-auth-type branch: FIELDS methods all submit their schema values\n // through one generic mutation, so adding an auth type needs no new case\n // here and no new mutation to call.\n switch (authFlow) {\n case 'oauth2': {\n const callbackUrl = apiGatewayUrl\n ? `${apiGatewayUrl}/integrations/oauth/callback`\n : '/integrations/oauth/callback';\n const result = await initiateOAuth(connId, callbackUrl, selectedProvider.key);\n if (result?.redirectUrl) {\n const width = 600;\n const height = 700;\n const left = window.screenX + (window.innerWidth - width) / 2;\n const top = window.screenY + (window.innerHeight - height) / 2;\n const popup = window.open(\n result.redirectUrl,\n 'oauth_popup',\n `width=${width},height=${height},left=${left},top=${top},toolbar=no,menubar=no,scrollbars=yes,resizable=yes`\n );\n if (!popup) {\n setErrorMessage(\n 'Popup was blocked. Please allow popups for this site and try again.'\n );\n return;\n }\n oauthPopupRef.current = popup;\n setOauthWaiting(true);\n\n oauthCleanupRef.current?.();\n oauthCleanupRef.current = waitForOAuthPopupCompletion({\n connectionId: connId,\n popup,\n fetchConnectionStatus: async () => {\n const { data } = await fetchConnection({ variables: { id: connId } });\n return data?.getConnection ?? null;\n },\n onSuccess: () => {\n setSuccess(true);\n onConnectionCreated?.(connId);\n },\n onError: setErrorMessage,\n onSettled: () => {\n oauthCleanupRef.current = null;\n oauthPopupRef.current = null;\n setOauthWaiting(false);\n },\n });\n\n return;\n }\n setSuccess(true);\n onConnectionCreated?.(connId);\n break;\n }\n case 'minted': {\n // Nothing to collect and nothing stored. SERVICE_ACCOUNT still records\n // the user's delegation for the reserved app; WORKSPACE_APP_TOKEN\n // connections are pure config and are already usable.\n if (authTypeForMethod === 'service_account') {\n await authenticateWithServiceAccount(\n connId,\n authScopes.length > 0 ? authScopes : undefined\n );\n }\n setSuccess(true);\n onConnectionCreated?.(connId);\n break;\n }\n default: {\n // FIELDS: submit whatever the method's schema asked for.\n if (activeSchema) {\n if (!isSchemaComplete(activeSchema, fieldValues)) {\n setErrorMessage('Please fill in all required fields');\n return;\n }\n }\n // Only fields the user can currently see: a `showIf` field that was\n // filled and then hidden must not be submitted, or we would store a\n // credential the user no longer intends to send.\n const values: Record<string, unknown> = {};\n for (const [field, value] of Object.entries(visibleValues(activeSchema, fieldValues))) {\n if (typeof value === 'string') {\n const trimmed = value.trim();\n if (trimmed) values[field] = trimmed;\n } else if (value !== undefined && value !== null) {\n values[field] = value;\n }\n }\n await authenticateConnection(connId, selectedAuthMethodKey ?? undefined, values);\n setSuccess(true);\n onConnectionCreated?.(connId);\n }\n }\n } catch (err) {\n setErrorMessage(err instanceof Error ? err.message : 'Connection failed');\n }\n }, [\n selectedProvider,\n connectionName,\n connectionDescription,\n selectedAuthMethodKey,\n authFlow,\n authTypeForMethod,\n authScopes,\n activeSchema,\n fieldValues,\n selectedAuthMethod,\n createConnection,\n initiateOAuth,\n fetchConnection,\n authenticateConnection,\n authenticateWithServiceAccount,\n apiGatewayUrl,\n onConnectionCreated,\n credentialStorage,\n ]);\n\n // Tab items\n const tabs: { key: DialogTab; label: string; icon: typeof Link2 }[] = [\n { key: 'connection', label: 'Connection', icon: Link2 },\n { key: 'details', label: 'Details', icon: Info },\n ];\n\n if (!open) return null;\n\n if (!canCreate && !permissionsLoading) {\n return (\n <>\n <div\n style={{ zIndex: OVERLAY_Z }}\n className=\"fixed inset-0 bg-bg-overlay animate-in fade-in-0 duration-200\"\n onClick={onClose}\n />\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"add-connection-denied-title\"\n style={{ zIndex: DIALOG_Z }}\n className=\"fixed inset-x-4 top-1/2 mx-auto flex max-w-md -translate-y-1/2 flex-col items-center gap-4 rounded-xl border border-border-subtle bg-bg-surface p-8 shadow-2xl text-center\"\n >\n <Shield size={40} className=\"text-text-secondary\" />\n <h2 id=\"add-connection-denied-title\" className=\"text-lg font-semibold text-text-primary\">\n Access Denied\n </h2>\n <p className=\"text-sm text-text-secondary\">\n You don't have permission to create connections.\n </p>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"px-4 py-2 text-sm font-medium rounded-md border border-border-subtle hover:bg-accent transition-colors\"\n >\n Close\n </button>\n </div>\n </>\n );\n }\n\n return (\n <>\n {/* Backdrop */}\n <div\n style={{ zIndex: OVERLAY_Z }}\n className=\"fixed inset-0 bg-bg-overlay animate-in fade-in-0 duration-200\"\n onClick={onClose}\n />\n\n {/* Dialog */}\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"add-connection-dialog-title\"\n /* `sm:` centres the dialog with `top-1/2 bottom-auto`, which leaves its\n height unbounded — a tall provider form grew past the viewport and was\n clipped at BOTH ends, taking the title and the Save button with it.\n The max-height puts the overflow back where it belongs: the scrollable\n body below. */\n style={{ zIndex: DIALOG_Z }}\n className=\"fixed inset-x-4 top-4 bottom-4 mx-auto flex w-auto max-w-3xl flex-col overflow-hidden rounded-xl border border-border-subtle bg-bg-surface shadow-2xl animate-in fade-in-0 zoom-in-95 duration-200 sm:inset-x-6 sm:top-1/2 sm:bottom-auto sm:max-h-[min(90vh,56rem)] sm:w-full sm:-translate-y-1/2\"\n >\n {/* Header */}\n <div className=\"flex items-center justify-between px-5 py-4 border-b border-border-subtle flex-shrink-0\">\n <div className=\"flex items-center gap-3\">\n {selectedProvider && !showPicker ? (\n <>\n <ProviderIcon provider={selectedProvider} size={32} />\n <div>\n <h2\n id=\"add-connection-dialog-title\"\n className=\"text-base font-semibold text-text-primary\"\n >\n {selectedProvider.name} account\n </h2>\n <p className=\"text-xs text-text-secondary\">\n {getAuthTypeLabel(selectedProvider.authType)}\n </p>\n </div>\n </>\n ) : (\n <div>\n <h2\n id=\"add-connection-dialog-title\"\n className=\"text-base font-semibold text-text-primary\"\n >\n Add new credential\n </h2>\n <p className=\"text-xs text-text-secondary\">\n Select an app or service to connect to\n </p>\n </div>\n )}\n </div>\n <div className=\"flex items-center gap-2\">\n {/* The method decides what the whole form below looks like, so it\n belongs beside the title rather than buried among the fields it\n governs — and it stays visible while the body scrolls. Rendered\n only when there is a genuine choice to make. */}\n {selectedProvider && !showPicker && !success && authMethods.length > 1 && (\n <div className=\"hidden items-center gap-2 sm:flex\">\n <label\n htmlFor={`${fieldId('auth-method')}-auth-method`}\n className=\"text-xs font-medium text-text-secondary whitespace-nowrap\"\n >\n Method\n </label>\n <AuthMethodSelector\n methods={authMethods}\n selectedKey={selectedAuthMethodKey}\n onSelect={setSelectedAuthMethodKey}\n disabled={isAuthenticating}\n idPrefix={fieldId('auth-method')}\n compact\n />\n </div>\n )}\n {selectedProvider && !showPicker && !success && (\n <button\n type=\"button\"\n onClick={handleSubmit}\n disabled={isAuthenticating || !connectionName.trim()}\n className=\"inline-flex items-center gap-1.5 px-4 py-1.5 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors disabled:opacity-50\"\n >\n {isAuthenticating ? (\n <Loader2 size={14} className=\"animate-spin\" />\n ) : (\n <Check size={14} />\n )}\n {oauthWaiting ? 'Waiting...' : 'Save'}\n </button>\n )}\n <button\n type=\"button\"\n onClick={onClose}\n className=\"p-1.5 rounded-md hover:bg-accent transition-colors text-text-secondary hover:text-text-primary\"\n aria-label=\"Close\"\n >\n <X size={20} />\n </button>\n </div>\n </div>\n\n {/* Body */}\n <div className=\"flex flex-1 min-h-0 overflow-hidden\">\n {/* Provider Picker Mode */}\n {showPicker && !selectedProvider && (\n <div className=\"flex-1 p-5 overflow-y-auto\">\n <p className=\"text-sm text-text-secondary mb-3\">\n Select an app or service to connect to\n </p>\n <div className=\"relative mb-4\">\n <Search\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary\"\n />\n <input\n ref={searchInputRef}\n type=\"text\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n placeholder=\"Search providers...\"\n aria-label=\"Search providers\"\n className=\"w-full pl-9 pr-3 py-2.5 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n\n {providersLoading ? (\n <div className=\"flex items-center justify-center py-8\">\n <Loader2 size={24} className=\"animate-spin text-text-secondary\" />\n </div>\n ) : filteredProviders.length === 0 ? (\n <IllustratedEmptyState\n illustration={searchQuery ? 'empty-search' : 'empty-data'}\n title={searchQuery ? 'No matching providers' : 'No providers available'}\n description={\n searchQuery\n ? `No installed provider matches “${searchQuery}”. Try a different term.`\n : 'Install and enable a provider from the catalog to create a connection.'\n }\n />\n ) : (\n <div className=\"max-h-[400px] overflow-y-auto space-y-1\">\n {Object.entries(groupedProviders).map(([category, categoryProviders]) => (\n <div key={category}>\n <div className=\"px-2 py-1.5 text-xs font-semibold text-text-secondary uppercase tracking-wider\">\n {getCategoryLabel(category as IntegrationProvider['category'])}\n </div>\n {categoryProviders.map((provider) => (\n <button\n key={provider.id}\n type=\"button\"\n onClick={() => handleSelectProvider(provider)}\n className=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-md hover:bg-accent/50 transition-colors text-left\"\n >\n <ProviderIcon provider={provider} size={32} />\n <div className=\"flex-1 min-w-0\">\n <div className=\"text-sm font-medium text-text-primary\">\n {provider.name}\n </div>\n <div className=\"text-xs text-text-secondary\">\n {getAuthTypeLabel(provider.authType)}\n </div>\n </div>\n </button>\n ))}\n </div>\n ))}\n </div>\n )}\n </div>\n )}\n\n {/* Loading preselected provider (catalog load or by-id fallback fetch) */}\n {!showPicker && !selectedProvider && preselectedResolving && (\n <div className=\"flex-1 flex items-center justify-center\">\n <Loader2 size={32} className=\"animate-spin text-text-secondary\" />\n </div>\n )}\n\n {/* Preselected provider couldn't be resolved (invalid id / fetch error) */}\n {!showPicker && !selectedProvider && !preselectedResolving && preselectedProviderId && (\n <div className=\"flex-1 flex flex-col items-center justify-center p-8 text-center\">\n <AlertCircle size={32} className=\"text-text-secondary mb-3\" />\n <p className=\"text-sm text-text-secondary\">This provider isn't available.</p>\n </div>\n )}\n\n {/* Success State */}\n {success && selectedProvider && (\n <div className=\"flex-1 flex flex-col items-center justify-center p-8 text-center\">\n <div className=\"p-3 rounded-full bg-status-success-bg-subtle mb-4\">\n <CheckCircle2 size={48} className=\"text-status-success-text\" />\n </div>\n <h3 className=\"text-lg font-semibold text-text-primary mb-1\">Connection Created!</h3>\n <p className=\"text-sm text-text-secondary mb-6\">\n Your {selectedProvider.name} connection has been set up successfully.\n </p>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"px-4 py-2 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors\"\n >\n Close dialog\n </button>\n </div>\n )}\n\n {/* Form Mode (with sidebar tabs) */}\n {selectedProvider && !showPicker && !success && (\n <>\n {/* Left Sidebar Tabs */}\n <div className=\"w-full border-b border-border-subtle sm:w-40 sm:border-b-0 sm:border-r flex-shrink-0 py-3 overflow-x-auto\">\n {tabs.map((tab) => {\n const TabIcon = tab.icon;\n return (\n <button\n key={tab.key}\n type=\"button\"\n onClick={() => setActiveTab(tab.key)}\n className={cn(\n 'flex min-w-max items-center gap-2 px-4 py-2 text-sm font-medium transition-colors sm:w-full',\n activeTab === tab.key\n ? 'text-text-primary bg-accent/50 border-b-2 border-primary sm:border-b-0 sm:border-l-2'\n : 'text-text-secondary hover:text-text-primary hover:bg-accent/30 border-b-2 border-transparent sm:border-b-0 sm:border-l-2'\n )}\n >\n <TabIcon size={16} />\n {tab.label}\n </button>\n );\n })}\n </div>\n\n {/* Main Content Area */}\n <div className=\"flex-1 p-5 overflow-y-auto\">\n {/* Connection Tab */}\n {activeTab === 'connection' && (\n <div className=\"space-y-5\">\n {/* Error Banner */}\n {errorMessage && (\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-error-bg/10 border border-status-error-border/20\">\n <AlertCircle size={16} className=\"text-status-error-text flex-shrink-0\" />\n <span className=\"text-sm text-status-error-text\">{errorMessage}</span>\n </div>\n )}\n\n {/* Connection Name */}\n <div>\n <label\n htmlFor={fieldId('conn-name')}\n className=\"block text-sm font-medium text-text-primary mb-1.5\"\n >\n Connection Name <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n id={fieldId('conn-name')}\n aria-label=\"Connection Name\"\n type=\"text\"\n value={connectionName}\n onChange={(e) => setConnectionName(e.target.value)}\n placeholder={`My ${selectedProvider.name} Connection`}\n disabled={isAuthenticating}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50\"\n />\n </div>\n\n {/* Description */}\n <div>\n <label\n htmlFor={fieldId('conn-desc')}\n className=\"block text-sm font-medium text-text-primary mb-1.5\"\n >\n Description\n </label>\n <input\n id={fieldId('conn-desc')}\n aria-label=\"Description\"\n type=\"text\"\n value={connectionDescription}\n onChange={(e) => setConnectionDescription(e.target.value)}\n placeholder=\"Optional description\"\n disabled={isAuthenticating}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50\"\n />\n </div>\n\n {/* First-party SERVICE_ACCOUNT connections store no\n credential, so they need no vault/secret picker. */}\n {selectedProvider.authType !== 'service_account' && (\n <CredentialStorageSelector\n value={credentialStorage}\n onChange={setCredentialStorage}\n providerAuthType={selectedProvider.authType}\n />\n )}\n\n {/* Authentication — entirely data-driven.\n The method dropdown appears only when the provider offers\n a choice; the fields below come from that method's\n configSchema, so no provider or auth type has bespoke\n markup here. */}\n <div className=\"rounded-md border border-border-subtle/50 bg-bg-surface p-4 space-y-3\">\n <h3 className=\"font-medium text-text-primary flex items-center gap-2 text-sm\">\n <Shield size={16} className=\"text-primary\" />\n Authentication\n {authMethods.length <= 1 && (\n <span className=\"text-text-secondary font-normal\">\n ·{' '}\n {selectedAuthMethod?.displayName ??\n getAuthTypeLabel(selectedProvider.authType)}\n </span>\n )}\n </h3>\n\n {/* The header carries the control on wide screens; below\n `sm:` there is no room for it there, so it appears\n here instead. Exactly one is ever visible. */}\n <div className=\"sm:hidden\">\n <AuthMethodSelector\n methods={authMethods}\n // Raw key, not the resolved method: the selector needs\n // to see null vs stale itself, or its placeholder can\n // never render.\n selectedKey={selectedAuthMethodKey}\n onSelect={setSelectedAuthMethodKey}\n disabled={isAuthenticating}\n idPrefix={fieldId('auth-method-inline')}\n />\n </div>\n {/* What the chosen method means, kept beside the fields it\n governs whichever control was used to choose it. */}\n <div\n className={\n authMethods.length > 1 ? 'hidden space-y-2 sm:block' : 'space-y-2'\n }\n >\n <AuthMethodNotice method={selectedAuthMethod} />\n </div>\n\n {authFlow === 'oauth2' && (\n <>\n {/* An OAuth method may still declare fields — a tenant\n subdomain, a base URL, bring-your-own-app settings.\n Rendering them only for the `fields` flow made such\n methods impossible to use: the inputs never\n appeared and nothing was ever collected. */}\n {activeSchema && (\n <SchemaForm\n schema={activeSchema}\n values={fieldValues}\n onChange={setFieldValues}\n disabled={isAuthenticating}\n idPrefix={fieldId('oauth-cfg')}\n />\n )}\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default\">\n <ExternalLink\n size={14}\n className=\"text-status-info-text flex-shrink-0\"\n />\n <span className=\"text-xs text-status-info-text\">\n A popup window will open for {selectedProvider.name} sign-in\n </span>\n </div>\n </>\n )}\n\n {authFlow === 'minted' && (\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default\">\n <Shield size={14} className=\"text-status-info-text flex-shrink-0\" />\n <span className=\"text-xs text-status-info-text\">\n No credentials to enter — access is granted on your behalf and tokens\n are issued per use.\n </span>\n </div>\n )}\n\n {authFlow === 'fields' &&\n (activeSchema ? (\n <>\n <p className=\"text-xs text-text-secondary\">\n Secret values are stored encrypted and never shown again.\n </p>\n <SchemaForm\n schema={activeSchema}\n values={fieldValues}\n onChange={setFieldValues}\n disabled={isAuthenticating}\n idPrefix={fieldId('cred')}\n />\n </>\n ) : (\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-error-bg-subtle border border-border-default\">\n <AlertCircle\n size={16}\n className=\"text-status-error-text flex-shrink-0\"\n />\n <span className=\"text-sm text-status-error-text\">\n This authentication method does not declare a configuration form.\n </span>\n </div>\n ))}\n </div>\n </div>\n )}\n\n {/* Details Tab */}\n {activeTab === 'details' && (\n <div className=\"space-y-4\">\n <h3 className=\"text-sm font-semibold text-text-primary\">Details</h3>\n <div className=\"space-y-3\">\n <div className=\"flex items-center gap-3 p-3 rounded-md border border-border-subtle\">\n <ProviderIcon provider={selectedProvider} size={40} />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {selectedProvider.name}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {getAuthTypeLabel(selectedProvider.authType)} ·{' '}\n {getCategoryLabel(selectedProvider.category)}\n </p>\n </div>\n </div>\n {selectedProvider.description && (\n <div>\n <div className=\"text-xs font-medium text-text-secondary uppercase tracking-wider\">\n Description\n </div>\n <p className=\"text-sm text-text-primary mt-1\">\n {selectedProvider.description}\n </p>\n </div>\n )}\n {selectedProvider.website && (\n <div>\n <div className=\"text-xs font-medium text-text-secondary uppercase tracking-wider\">\n Website\n </div>\n <a\n href={selectedProvider.website}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"block text-sm text-primary hover:underline mt-1\"\n >\n {selectedProvider.website}\n </a>\n </div>\n )}\n {selectedProvider.docsUrl && (\n <div>\n <div className=\"text-xs font-medium text-text-secondary uppercase tracking-wider\">\n Documentation\n </div>\n <a\n href={selectedProvider.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"block text-sm text-primary hover:underline mt-1\"\n >\n {selectedProvider.docsUrl}\n </a>\n </div>\n )}\n </div>\n </div>\n )}\n </div>\n </>\n )}\n </div>\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuFA,IAAM,KAAY,MACZ,KAAW;AAEjB,SAAgB,EAAoB,EAClC,SACA,YACA,0BACA,0BAC2B;CAE3B,IAAM,EAAE,qBAAkB,GAAiB,EACrC,EAAE,cAAW,SAAS,MAAqB,IAAc,EAIzD,IAAiB,QAEnB,KACM,KAAa,EAAE,EAAE,MAAM,MAA2B,EAAE,OAAO,EAAsB,IACnF,OACA,MACN,CAAC,GAAW,EAAsB,CACnC,EAGK,EAAE,UAAU,IAA4B,SAAS,OAA8B,GACnF,CAAC,KAAoB,KAAyB,CAAC,IAAiB,IAAwB,GACzF,EACK,IAA8B,KAAkB,IAGhD,KACJ,CAAC,CAAC,KACF,CAAC,MACA,KAAoB,KACjB,EAAE,mBAAe,WAAW,OAAuB,IAAgB,EACnE,KAAY,CAAC,MAAsB,GAAc,EAAwB,kBAAkB,EAG3F,EAAE,sBAAkB,SAAS,OAAa,IAAqB,EAC/D,EAAE,mBAAe,SAAS,OAAiB,IAAkB,EAC7D,EAAE,4BAAwB,SAAS,OAAmB,IAA2B,EACjF,EAAE,oCAAgC,SAAS,OAC/C,IAAmC,EAC/B,CAAC,MAAmB,GAA0B,EAAE,aAAa,gBAAgB,CAAC,EAG9E,CAAC,GAAkB,KAAuB,EAAqC,KAAK,EACpF,CAAC,GAAY,KAAiB,EAAS,CAAC,EAAsB,EAC9D,CAAC,GAAW,MAAgB,EAAoB,aAAa,EAC7D,CAAC,GAAa,MAAkB,EAAS,GAAG,EAC5C,CAAC,GAAgB,KAAqB,EAAS,GAAG,EAClD,CAAC,GAAuB,MAA4B,EAAS,GAAG,EAEhE,CAAC,GAAuB,KAA4B,EAAwB,KAAK,EA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G,WAAU;oBACV,EAAiB;UAChB,CAAA,EACJ,kBAAC,KAAD;UAAG,WAAU;oBAAb;WACG,EAAiB,EAAiB,SAAS;WAAC;WAAU;WACtD,EAAiB,EAAiB,SAAS;WAC1C;YACA,EAAA,CAAA,CACF;;QACL,EAAiB,eAChB,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,OAAD;SAAK,WAAU;mBAAmE;SAE5E,CAAA,EACN,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAiB;SAChB,CAAA,CACA,EAAA,CAAA;QAEP,EAAiB,WAChB,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,OAAD;SAAK,WAAU;mBAAmE;SAE5E,CAAA,EACN,kBAAC,KAAD;SACE,MAAM,EAAiB;SACvB,QAAO;SACP,KAAI;SACJ,WAAU;mBAET,EAAiB;SAChB,CAAA,CACA,EAAA,CAAA;QAEP,EAAiB,WAChB,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,OAAD;SAAK,WAAU;mBAAmE;SAE5E,CAAA,EACN,kBAAC,KAAD;SACE,MAAM,EAAiB;SACvB,QAAO;SACP,KAAI;SACJ,WAAU;mBAET,EAAiB;SAChB,CAAA,CACA,EAAA,CAAA;QAEJ;SACF;QAEJ;OACL,EAAA,CAAA;IAED;KACF;IACL,EAAA,CAAA,GA5fa"}
|
|
1
|
+
{"version":3,"file":"AddConnectionDialog.js","names":[],"sources":["../../../src/integrations/components/AddConnectionDialog.tsx"],"sourcesContent":["/**\n * AddConnectionDialog -- n8n-style popup for creating new connections.\n *\n * Replaces the full-page AddConnectionWizard with an inline modal dialog.\n * Uses the same hooks and GraphQL operations that already exist in\n * microfe-integrations (useCreateConnection, useInitiateOAuth, etc.).\n *\n * Opens from any page via Zustand store state, so there is no navigation\n * to /connections/add — the dialog overlays the current page.\n */\n\nimport { useState, useMemo, useCallback, useEffect, useRef, useId } from 'react';\nimport {\n X,\n Check,\n Loader2,\n AlertCircle,\n CheckCircle2,\n Search,\n ExternalLink,\n Shield,\n Link2,\n Info,\n} from 'lucide-react';\nimport { cn } from '../utils/cn';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\nimport {\n getAuthTypeLabel,\n getCategoryLabel,\n legacyFlowForAuthType,\n} from '../utils/integrationsHelpers';\nimport { useIntegrations } from '../providers/IntegrationsProvider';\nimport { INTEGRATION_PERMISSIONS } from '../constants/permissions';\nimport { useProviders, useProvider } from '../hooks/useProviders';\nimport {\n useCreateConnection,\n useInitiateOAuth,\n useAuthenticateConnection,\n useAuthenticateWithServiceAccount,\n} from '../hooks/useConnections';\nimport { useGetConnectionLazyQuery } from '../../generated/wspace-operations';\nimport { waitForOAuthPopupCompletion } from '../utils/oauthPopup';\nimport {\n CredentialStorageSelector,\n type CredentialStorageState,\n} from './CredentialStorageSelector';\nimport { AuthMethodNotice, AuthMethodSelector } from './AuthMethodSelector';\nimport { ProviderIcon } from './ProviderIcon';\nimport {\n SchemaForm,\n initialValuesFromSchema,\n isSchemaComplete,\n parseFormSchema,\n visibleValues,\n} from './SchemaForm';\nimport type { IntegrationProvider } from '../types';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface AddConnectionDialogProps {\n /** Whether the dialog is open */\n open: boolean;\n /** Callback to close the dialog */\n onClose: () => void;\n /** Pre-selected provider ID (skips provider picker step) */\n preselectedProviderId?: string | null;\n /** Callback when a connection is successfully created */\n onConnectionCreated?: (connectionId: string) => void;\n}\n\ntype DialogTab = 'connection' | 'details';\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * Above the app shell's header (`z-index: 100`).\n *\n * The dialog used to sit at Tailwind's `z-50`, so the shell header painted over\n * its top edge and swallowed the title and the Method control — the dialog\n * looked \"cut off\" no matter how its height was constrained. A modal must\n * out-rank the chrome it covers, and Tailwind's scale stops well below it.\n */\nconst OVERLAY_Z = 1100;\nconst DIALOG_Z = 1101;\n\nexport function AddConnectionDialog({\n open,\n onClose,\n preselectedProviderId,\n onConnectionCreated,\n}: AddConnectionDialogProps) {\n // Provider data\n const { apiGatewayUrl } = useIntegrations();\n const { providers, loading: providersLoading } = useProviders();\n // A preselected id may not be in the catalog page (disabled provider linked\n // from its own detail page). Resolve such ids via a direct by-id fetch so the\n // dialog never dead-ends on a blank body.\n const providerInList = useMemo(\n () =>\n preselectedProviderId\n ? ((providers ?? []).find((p: IntegrationProvider) => p.id === preselectedProviderId) ??\n null)\n : null,\n [providers, preselectedProviderId]\n );\n // Only fetch once the catalog has loaded and confirmed the id isn't in the\n // filtered list — avoids a redundant GetProvider for visible providers.\n const { provider: fetchedPreselectedProvider, loading: fetchedPreselectedLoading } = useProvider(\n !providersLoading && preselectedProviderId && !providerInList ? preselectedProviderId : ''\n );\n const resolvedPreselectedProvider = providerInList ?? fetchedPreselectedProvider;\n // True while a preselected provider is still being resolved (catalog load or\n // the by-id fallback fetch) — keeps the body showing a spinner, not blank.\n const preselectedResolving =\n !!preselectedProviderId &&\n !resolvedPreselectedProvider &&\n (providersLoading || fetchedPreselectedLoading);\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canCreate = !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE);\n\n // Mutations\n const { createConnection, loading: creating } = useCreateConnection();\n const { initiateOAuth, loading: oauthLoading } = useInitiateOAuth();\n const { authenticateConnection, loading: authenticating } = useAuthenticateConnection();\n const { authenticateWithServiceAccount, loading: serviceAccountLoading } =\n useAuthenticateWithServiceAccount();\n const [fetchConnection] = useGetConnectionLazyQuery({ fetchPolicy: 'network-only' });\n\n // State\n const [selectedProvider, setSelectedProvider] = useState<IntegrationProvider | null>(null);\n const [showPicker, setShowPicker] = useState(!preselectedProviderId);\n const [activeTab, setActiveTab] = useState<DialogTab>('connection');\n const [searchQuery, setSearchQuery] = useState('');\n const [connectionName, setConnectionName] = useState('');\n const [connectionDescription, setConnectionDescription] = useState('');\n /** Auth method the user picked; null until a provider is selected. */\n const [selectedAuthMethodKey, setSelectedAuthMethodKey] = useState<string | null>(null);\n /** Values for the selected method's schema-described fields. */\n const [fieldValues, setFieldValues] = useState<Record<string, unknown>>({});\n const [credentialStorage, setCredentialStorage] = useState<CredentialStorageState>({\n mode: 'managed',\n vaultId: '',\n secretId: '',\n managedSecretName: '',\n });\n const [errorMessage, setErrorMessage] = useState('');\n const [success, setSuccess] = useState(false);\n const [oauthWaiting, setOauthWaiting] = useState(false);\n const [, setCreatedConnectionId] = useState<string | null>(null);\n\n const oauthPopupRef = useRef<Window | null>(null);\n const oauthCleanupRef = useRef<(() => void) | null>(null);\n const searchInputRef = useRef<HTMLInputElement>(null);\n const idPrefix = useId();\n const fieldId = (name: string) => `${idPrefix}-${name}`;\n\n // ── Auth method resolution ────────────────────────────────────────────────\n // Everything the auth section renders and submits derives from the selected\n // method. Providers with a single method behave exactly as before.\n const authMethods = useMemo(\n () => (selectedProvider?.authMethods ?? []).filter((method) => method.isEnabled),\n [selectedProvider]\n );\n const selectedAuthMethod = useMemo(\n () =>\n authMethods.find((method) => method.key === selectedAuthMethodKey) ?? authMethods[0] ?? null,\n [authMethods, selectedAuthMethodKey]\n );\n // Fall back to the provider's own authType for providers whose methods have\n // not been fetched (older fragments) or backfilled yet.\n const authFlow = selectedAuthMethod?.flow ?? legacyFlowForAuthType(selectedProvider?.authType);\n const authTypeForMethod = selectedAuthMethod?.authType ?? selectedProvider?.authType;\n // Memoized: a fresh array each render would re-create handleSubmit's\n // useCallback on every render.\n const authScopes = useMemo(\n () =>\n selectedAuthMethod?.defaultScopes?.length\n ? selectedAuthMethod.defaultScopes\n : (selectedProvider?.defaultScopes ?? []),\n [selectedAuthMethod, selectedProvider]\n );\n const activeSchema = useMemo(\n () => parseFormSchema(selectedAuthMethod?.configSchema ?? selectedProvider?.configSchema),\n [selectedAuthMethod, selectedProvider]\n );\n\n // Selecting a different method must not carry the previous method's values\n // over — they belong to a different credential shape entirely.\n useEffect(() => {\n // Seeded from the schema's declared defaults, not empty: a rendered control\n // shows its default as selected, so leaving state empty made validation\n // treat a visible value as missing and dropped it from the submission.\n setFieldValues(initialValuesFromSchema(activeSchema));\n setErrorMessage('');\n // activeSchema is derived from these two, so it is not an extra trigger.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedAuthMethodKey, selectedProvider?.id]);\n\n useEffect(() => {\n if (!open) return undefined;\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onClose();\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [open, onClose]);\n\n // Cleanup OAuth listener and popup on unmount.\n useEffect(() => {\n return () => {\n oauthCleanupRef.current?.();\n if (oauthPopupRef.current && !oauthPopupRef.current.closed) {\n oauthPopupRef.current.close();\n }\n };\n }, []);\n\n // Reset state when dialog opens\n useEffect(() => {\n if (open) {\n setActiveTab('connection');\n setSearchQuery('');\n setConnectionName('');\n setConnectionDescription('');\n setSelectedAuthMethodKey(null);\n setFieldValues({});\n setCredentialStorage({ mode: 'managed', vaultId: '', secretId: '', managedSecretName: '' });\n setErrorMessage('');\n setSuccess(false);\n setOauthWaiting(false);\n setCreatedConnectionId(null);\n\n if (preselectedProviderId) {\n setShowPicker(false);\n setSelectedProvider(null); // will be set by effect below\n } else {\n setShowPicker(true);\n setSelectedProvider(null);\n }\n }\n }, [open, preselectedProviderId]);\n\n // Find and set preselected provider (from the filtered list or, for hidden\n // built-ins, the direct by-id fetch above).\n useEffect(() => {\n if (open && preselectedProviderId && resolvedPreselectedProvider && !selectedProvider) {\n setSelectedProvider(resolvedPreselectedProvider);\n setConnectionName(`${resolvedPreselectedProvider.name} Connection`);\n setShowPicker(false);\n }\n }, [open, preselectedProviderId, resolvedPreselectedProvider, selectedProvider]);\n\n // Auto-focus search input when picker is shown\n useEffect(() => {\n if (open && showPicker) {\n const timeoutId = setTimeout(() => searchInputRef.current?.focus(), 100);\n return () => clearTimeout(timeoutId);\n }\n return undefined;\n }, [open, showPicker]);\n\n // Filter providers for picker\n const filteredProviders = useMemo(() => {\n const installed = (providers ?? []).filter(\n (p: IntegrationProvider) => p.pluginStatus === 'installed' && p.isEnabled\n );\n if (!searchQuery.trim()) return installed;\n const q = searchQuery.toLowerCase();\n return installed.filter(\n (p: IntegrationProvider) =>\n p.name.toLowerCase().includes(q) ||\n (p.description ?? '').toLowerCase().includes(q) ||\n p.key.toLowerCase().includes(q)\n );\n }, [providers, searchQuery]);\n\n // Group providers by category\n const groupedProviders = useMemo(() => {\n const groups: Record<string, IntegrationProvider[]> = {};\n filteredProviders.forEach((p: IntegrationProvider) => {\n const cat = p.category;\n if (!groups[cat]) groups[cat] = [];\n groups[cat].push(p);\n });\n return groups;\n }, [filteredProviders]);\n\n const handleSelectProvider = useCallback((provider: IntegrationProvider) => {\n setSelectedProvider(provider);\n setConnectionName(`${provider.name} Connection`);\n setShowPicker(false);\n setErrorMessage('');\n }, []);\n\n const isAuthenticating =\n creating || oauthLoading || oauthWaiting || authenticating || serviceAccountLoading;\n\n // Main submit handler\n const handleSubmit = useCallback(async () => {\n if (!selectedProvider || !connectionName.trim()) return;\n\n // Methods that mint tokens on demand store no credential, so they need no\n // vault/secret — skip the credential-storage requirement entirely.\n const isServiceAccount = authFlow === 'minted';\n\n if (!isServiceAccount) {\n if (!credentialStorage.vaultId) {\n setErrorMessage('Please select a vault for this connection');\n return;\n }\n if (credentialStorage.mode === 'existing' && !credentialStorage.secretId) {\n setErrorMessage('Please select an existing vault secret');\n return;\n }\n }\n\n if (authFlow === 'oauth2' && activeSchema && !isSchemaComplete(activeSchema, fieldValues)) {\n setErrorMessage('Please fill in all required fields');\n return;\n }\n\n if (selectedAuthMethod && !selectedAuthMethod.isConfigured) {\n setErrorMessage(\n 'This authentication method is not configured in this environment. Ask an administrator to add its credentials, or pick another method.'\n );\n return;\n }\n\n try {\n setErrorMessage('');\n\n // Step 1: Create the connection\n const connId = await createConnection({\n name: connectionName.trim(),\n description: connectionDescription.trim() || undefined,\n providerId: selectedProvider.id,\n authMethodKey: selectedAuthMethodKey ?? undefined,\n // OAuth methods collect non-secret routing settings (tenant subdomain,\n // base URL) rather than a credential, so they belong on the connection\n // config, which getConnectionToken already reads for baseUrl.\n ...(authFlow === 'oauth2' && activeSchema\n ? { config: visibleValues(activeSchema, fieldValues) as Record<string, unknown> }\n : {}),\n ...(isServiceAccount\n ? {}\n : {\n vaultId: credentialStorage.vaultId,\n credentialSecretId:\n credentialStorage.mode === 'existing' ? credentialStorage.secretId : undefined,\n managedSecretName:\n credentialStorage.mode === 'managed'\n ? credentialStorage.managedSecretName.trim() || undefined\n : undefined,\n }),\n });\n\n if (!connId) {\n setErrorMessage('Failed to create connection');\n return;\n }\n\n setCreatedConnectionId(connId);\n\n // Step 2: Authenticate. Driven by the auth method's *flow*, not by a\n // per-auth-type branch: FIELDS methods all submit their schema values\n // through one generic mutation, so adding an auth type needs no new case\n // here and no new mutation to call.\n switch (authFlow) {\n case 'oauth2': {\n const callbackUrl = apiGatewayUrl\n ? `${apiGatewayUrl}/integrations/oauth/callback`\n : '/integrations/oauth/callback';\n const result = await initiateOAuth(connId, callbackUrl, selectedProvider.key);\n if (result?.redirectUrl) {\n const width = 600;\n const height = 700;\n const left = window.screenX + (window.innerWidth - width) / 2;\n const top = window.screenY + (window.innerHeight - height) / 2;\n const popup = window.open(\n result.redirectUrl,\n 'oauth_popup',\n `width=${width},height=${height},left=${left},top=${top},toolbar=no,menubar=no,scrollbars=yes,resizable=yes`\n );\n if (!popup) {\n setErrorMessage(\n 'Popup was blocked. Please allow popups for this site and try again.'\n );\n return;\n }\n oauthPopupRef.current = popup;\n setOauthWaiting(true);\n\n oauthCleanupRef.current?.();\n oauthCleanupRef.current = waitForOAuthPopupCompletion({\n connectionId: connId,\n popup,\n fetchConnectionStatus: async () => {\n const { data } = await fetchConnection({ variables: { id: connId } });\n return data?.getConnection ?? null;\n },\n onSuccess: () => {\n setSuccess(true);\n onConnectionCreated?.(connId);\n },\n onError: setErrorMessage,\n onSettled: () => {\n oauthCleanupRef.current = null;\n oauthPopupRef.current = null;\n setOauthWaiting(false);\n },\n });\n\n return;\n }\n setSuccess(true);\n onConnectionCreated?.(connId);\n break;\n }\n case 'minted': {\n // Nothing to collect and nothing stored. SERVICE_ACCOUNT still records\n // the user's delegation for the reserved app; WORKSPACE_APP_TOKEN\n // connections are pure config and are already usable.\n if (authTypeForMethod === 'service_account') {\n await authenticateWithServiceAccount(\n connId,\n authScopes.length > 0 ? authScopes : undefined\n );\n }\n setSuccess(true);\n onConnectionCreated?.(connId);\n break;\n }\n default: {\n // FIELDS: submit whatever the method's schema asked for.\n if (activeSchema) {\n if (!isSchemaComplete(activeSchema, fieldValues)) {\n setErrorMessage('Please fill in all required fields');\n return;\n }\n }\n // Only fields the user can currently see: a `showIf` field that was\n // filled and then hidden must not be submitted, or we would store a\n // credential the user no longer intends to send.\n const values: Record<string, unknown> = {};\n for (const [field, value] of Object.entries(visibleValues(activeSchema, fieldValues))) {\n if (typeof value === 'string') {\n const trimmed = value.trim();\n if (trimmed) values[field] = trimmed;\n } else if (value !== undefined && value !== null) {\n values[field] = value;\n }\n }\n await authenticateConnection(connId, selectedAuthMethodKey ?? undefined, values);\n setSuccess(true);\n onConnectionCreated?.(connId);\n }\n }\n } catch (err) {\n setErrorMessage(err instanceof Error ? err.message : 'Connection failed');\n }\n }, [\n selectedProvider,\n connectionName,\n connectionDescription,\n selectedAuthMethodKey,\n authFlow,\n authTypeForMethod,\n authScopes,\n activeSchema,\n fieldValues,\n selectedAuthMethod,\n createConnection,\n initiateOAuth,\n fetchConnection,\n authenticateConnection,\n authenticateWithServiceAccount,\n apiGatewayUrl,\n onConnectionCreated,\n credentialStorage,\n ]);\n\n // Tab items\n const tabs: { key: DialogTab; label: string; icon: typeof Link2 }[] = [\n { key: 'connection', label: 'Connection', icon: Link2 },\n { key: 'details', label: 'Details', icon: Info },\n ];\n\n if (!open) return null;\n\n if (!canCreate && !permissionsLoading) {\n return (\n <>\n <div\n style={{ zIndex: OVERLAY_Z }}\n className=\"fixed inset-0 bg-bg-overlay animate-in fade-in-0 duration-200\"\n onClick={onClose}\n />\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"add-connection-denied-title\"\n style={{ zIndex: DIALOG_Z }}\n className=\"fixed inset-x-4 top-1/2 mx-auto flex max-w-md -translate-y-1/2 flex-col items-center gap-4 rounded-xl border border-border-subtle bg-bg-surface p-8 shadow-2xl text-center\"\n >\n <Shield size={40} className=\"text-text-secondary\" />\n <h2 id=\"add-connection-denied-title\" className=\"text-lg font-semibold text-text-primary\">\n Access Denied\n </h2>\n <p className=\"text-sm text-text-secondary\">\n You don't have permission to create connections.\n </p>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"px-4 py-2 text-sm font-medium rounded-md border border-border-subtle hover:bg-accent transition-colors\"\n >\n Close\n </button>\n </div>\n </>\n );\n }\n\n return (\n <>\n {/* Backdrop */}\n <div\n style={{ zIndex: OVERLAY_Z }}\n className=\"fixed inset-0 bg-bg-overlay animate-in fade-in-0 duration-200\"\n onClick={onClose}\n />\n\n {/* Dialog */}\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby=\"add-connection-dialog-title\"\n /* `sm:` centres the dialog with `top-1/2 bottom-auto`, which leaves its\n height unbounded — a tall provider form grew past the viewport and was\n clipped at BOTH ends, taking the title and the Save button with it.\n The max-height puts the overflow back where it belongs: the scrollable\n body below. */\n style={{ zIndex: DIALOG_Z }}\n className=\"fixed inset-x-4 top-4 bottom-4 mx-auto flex w-auto max-w-3xl flex-col overflow-hidden rounded-xl border border-border-subtle bg-bg-surface shadow-2xl animate-in fade-in-0 zoom-in-95 duration-200 sm:inset-x-6 sm:top-1/2 sm:bottom-auto sm:max-h-[min(90vh,56rem)] sm:w-full sm:-translate-y-1/2\"\n >\n {/* Header */}\n <div className=\"flex items-center justify-between px-5 py-4 border-b border-border-subtle flex-shrink-0\">\n <div className=\"flex items-center gap-3\">\n {selectedProvider && !showPicker ? (\n <>\n <ProviderIcon provider={selectedProvider} size={32} />\n <div>\n <h2\n id=\"add-connection-dialog-title\"\n className=\"text-base font-semibold text-text-primary\"\n >\n {selectedProvider.name} account\n </h2>\n <p className=\"text-xs text-text-secondary\">\n {getAuthTypeLabel(selectedProvider.authType)}\n </p>\n </div>\n </>\n ) : (\n <div>\n <h2\n id=\"add-connection-dialog-title\"\n className=\"text-base font-semibold text-text-primary\"\n >\n Add new credential\n </h2>\n <p className=\"text-xs text-text-secondary\">\n Select an app or service to connect to\n </p>\n </div>\n )}\n </div>\n <div className=\"flex items-center gap-2\">\n {selectedProvider && !showPicker && !success && (\n <button\n type=\"button\"\n onClick={handleSubmit}\n disabled={isAuthenticating || !connectionName.trim()}\n className=\"inline-flex items-center gap-1.5 px-4 py-1.5 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors disabled:opacity-50\"\n >\n {isAuthenticating ? (\n <Loader2 size={14} className=\"animate-spin\" />\n ) : (\n <Check size={14} />\n )}\n {oauthWaiting ? 'Waiting...' : 'Save'}\n </button>\n )}\n <button\n type=\"button\"\n onClick={onClose}\n className=\"p-1.5 rounded-md hover:bg-accent transition-colors text-text-secondary hover:text-text-primary\"\n aria-label=\"Close\"\n >\n <X size={20} />\n </button>\n </div>\n </div>\n\n {/* Body */}\n <div className=\"flex flex-1 min-h-0 overflow-hidden\">\n {/* Provider Picker Mode */}\n {showPicker && !selectedProvider && (\n <div className=\"flex-1 p-5 overflow-y-auto\">\n <p className=\"text-sm text-text-secondary mb-3\">\n Select an app or service to connect to\n </p>\n <div className=\"relative mb-4\">\n <Search\n size={16}\n className=\"absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary\"\n />\n <input\n ref={searchInputRef}\n type=\"text\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n placeholder=\"Search providers...\"\n aria-label=\"Search providers\"\n className=\"w-full pl-9 pr-3 py-2.5 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n />\n </div>\n\n {providersLoading ? (\n <div className=\"flex items-center justify-center py-8\">\n <Loader2 size={24} className=\"animate-spin text-text-secondary\" />\n </div>\n ) : filteredProviders.length === 0 ? (\n <IllustratedEmptyState\n illustration={searchQuery ? 'empty-search' : 'empty-data'}\n title={searchQuery ? 'No matching providers' : 'No providers available'}\n description={\n searchQuery\n ? `No installed provider matches “${searchQuery}”. Try a different term.`\n : 'Install and enable a provider from the catalog to create a connection.'\n }\n />\n ) : (\n <div className=\"max-h-[400px] overflow-y-auto space-y-1\">\n {Object.entries(groupedProviders).map(([category, categoryProviders]) => (\n <div key={category}>\n <div className=\"px-2 py-1.5 text-xs font-semibold text-text-secondary uppercase tracking-wider\">\n {getCategoryLabel(category as IntegrationProvider['category'])}\n </div>\n {categoryProviders.map((provider) => (\n <button\n key={provider.id}\n type=\"button\"\n onClick={() => handleSelectProvider(provider)}\n className=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-md hover:bg-accent/50 transition-colors text-left\"\n >\n <ProviderIcon provider={provider} size={32} />\n <div className=\"flex-1 min-w-0\">\n <div className=\"text-sm font-medium text-text-primary\">\n {provider.name}\n </div>\n <div className=\"text-xs text-text-secondary\">\n {getAuthTypeLabel(provider.authType)}\n </div>\n </div>\n </button>\n ))}\n </div>\n ))}\n </div>\n )}\n </div>\n )}\n\n {/* Loading preselected provider (catalog load or by-id fallback fetch) */}\n {!showPicker && !selectedProvider && preselectedResolving && (\n <div className=\"flex-1 flex items-center justify-center\">\n <Loader2 size={32} className=\"animate-spin text-text-secondary\" />\n </div>\n )}\n\n {/* Preselected provider couldn't be resolved (invalid id / fetch error) */}\n {!showPicker && !selectedProvider && !preselectedResolving && preselectedProviderId && (\n <div className=\"flex-1 flex flex-col items-center justify-center p-8 text-center\">\n <AlertCircle size={32} className=\"text-text-secondary mb-3\" />\n <p className=\"text-sm text-text-secondary\">This provider isn't available.</p>\n </div>\n )}\n\n {/* Success State */}\n {success && selectedProvider && (\n <div className=\"flex-1 flex flex-col items-center justify-center p-8 text-center\">\n <div className=\"p-3 rounded-full bg-status-success-bg-subtle mb-4\">\n <CheckCircle2 size={48} className=\"text-status-success-text\" />\n </div>\n <h3 className=\"text-lg font-semibold text-text-primary mb-1\">Connection Created!</h3>\n <p className=\"text-sm text-text-secondary mb-6\">\n Your {selectedProvider.name} connection has been set up successfully.\n </p>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"px-4 py-2 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors\"\n >\n Close dialog\n </button>\n </div>\n )}\n\n {/* Form Mode (with sidebar tabs) */}\n {selectedProvider && !showPicker && !success && (\n <>\n {/* Left Sidebar Tabs */}\n <div className=\"w-full border-b border-border-subtle sm:w-40 sm:border-b-0 sm:border-r flex-shrink-0 py-3 overflow-x-auto\">\n {tabs.map((tab) => {\n const TabIcon = tab.icon;\n return (\n <button\n key={tab.key}\n type=\"button\"\n onClick={() => setActiveTab(tab.key)}\n className={cn(\n 'flex min-w-max items-center gap-2 px-4 py-2 text-sm font-medium transition-colors sm:w-full',\n activeTab === tab.key\n ? 'text-text-primary bg-accent/50 border-b-2 border-primary sm:border-b-0 sm:border-l-2'\n : 'text-text-secondary hover:text-text-primary hover:bg-accent/30 border-b-2 border-transparent sm:border-b-0 sm:border-l-2'\n )}\n >\n <TabIcon size={16} />\n {tab.label}\n </button>\n );\n })}\n </div>\n\n {/* Main Content Area */}\n <div className=\"flex-1 p-5 overflow-y-auto\">\n {/* Connection Tab */}\n {activeTab === 'connection' && (\n <div className=\"space-y-5\">\n {/* Error Banner */}\n {errorMessage && (\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-error-bg/10 border border-status-error-border/20\">\n <AlertCircle size={16} className=\"text-status-error-text flex-shrink-0\" />\n <span className=\"text-sm text-status-error-text\">{errorMessage}</span>\n </div>\n )}\n\n {/* Connection Name */}\n <div>\n <label\n htmlFor={fieldId('conn-name')}\n className=\"block text-sm font-medium text-text-primary mb-1.5\"\n >\n Connection Name <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n id={fieldId('conn-name')}\n aria-label=\"Connection Name\"\n type=\"text\"\n value={connectionName}\n onChange={(e) => setConnectionName(e.target.value)}\n placeholder={`My ${selectedProvider.name} Connection`}\n disabled={isAuthenticating}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50\"\n />\n </div>\n\n {/* Description */}\n <div>\n <label\n htmlFor={fieldId('conn-desc')}\n className=\"block text-sm font-medium text-text-primary mb-1.5\"\n >\n Description\n </label>\n <input\n id={fieldId('conn-desc')}\n aria-label=\"Description\"\n type=\"text\"\n value={connectionDescription}\n onChange={(e) => setConnectionDescription(e.target.value)}\n placeholder=\"Optional description\"\n disabled={isAuthenticating}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-md bg-bg-surface text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-50\"\n />\n </div>\n\n {/* First-party SERVICE_ACCOUNT connections store no\n credential, so they need no vault/secret picker. */}\n {selectedProvider.authType !== 'service_account' && (\n <CredentialStorageSelector\n value={credentialStorage}\n onChange={setCredentialStorage}\n providerAuthType={selectedProvider.authType}\n />\n )}\n\n {/* Authentication — entirely data-driven.\n The method dropdown appears only when the provider offers\n a choice; the fields below come from that method's\n configSchema, so no provider or auth type has bespoke\n markup here. */}\n <div className=\"rounded-md border border-border-subtle/50 bg-bg-surface p-4 space-y-3\">\n {/* The method sits on the heading row, right-aligned —\n it decides what every field below it is, so it belongs\n with the section title rather than among the fields it\n governs. Single-method providers show the method's\n name here instead, since there is nothing to choose. */}\n <div className=\"flex items-center justify-between gap-3\">\n <h3 className=\"font-medium text-text-primary flex items-center gap-2 text-sm\">\n <Shield size={16} className=\"text-primary\" />\n Authentication\n {authMethods.length <= 1 && (\n <span className=\"text-text-secondary font-normal\">\n ·{' '}\n {selectedAuthMethod?.displayName ??\n getAuthTypeLabel(selectedProvider.authType)}\n </span>\n )}\n </h3>\n <AuthMethodSelector\n methods={authMethods}\n // Raw key, not the resolved method: the selector needs\n // to see null vs stale itself, or its placeholder can\n // never render.\n selectedKey={selectedAuthMethodKey}\n onSelect={setSelectedAuthMethodKey}\n disabled={isAuthenticating}\n idPrefix={fieldId('auth-method')}\n compact\n />\n </div>\n\n {/* What the chosen method means, kept beside the fields\n it governs. */}\n <div className=\"space-y-2\">\n <AuthMethodNotice method={selectedAuthMethod} />\n </div>\n\n {authFlow === 'oauth2' && (\n <>\n {/* An OAuth method may still declare fields — a tenant\n subdomain, a base URL, bring-your-own-app settings.\n Rendering them only for the `fields` flow made such\n methods impossible to use: the inputs never\n appeared and nothing was ever collected. */}\n {activeSchema && (\n <SchemaForm\n schema={activeSchema}\n values={fieldValues}\n onChange={setFieldValues}\n disabled={isAuthenticating}\n idPrefix={fieldId('oauth-cfg')}\n />\n )}\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default\">\n <ExternalLink\n size={14}\n className=\"text-status-info-text flex-shrink-0\"\n />\n <span className=\"text-xs text-status-info-text\">\n A popup window will open for {selectedProvider.name} sign-in\n </span>\n </div>\n </>\n )}\n\n {authFlow === 'minted' && (\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default\">\n <Shield size={14} className=\"text-status-info-text flex-shrink-0\" />\n <span className=\"text-xs text-status-info-text\">\n No credentials to enter — access is granted on your behalf and tokens\n are issued per use.\n </span>\n </div>\n )}\n\n {authFlow === 'fields' &&\n (activeSchema ? (\n <>\n <p className=\"text-xs text-text-secondary\">\n Secret values are stored encrypted and never shown again.\n </p>\n <SchemaForm\n schema={activeSchema}\n values={fieldValues}\n onChange={setFieldValues}\n disabled={isAuthenticating}\n idPrefix={fieldId('cred')}\n />\n </>\n ) : (\n <div className=\"flex items-center gap-2 px-3 py-2 rounded-md bg-status-error-bg-subtle border border-border-default\">\n <AlertCircle\n size={16}\n className=\"text-status-error-text flex-shrink-0\"\n />\n <span className=\"text-sm text-status-error-text\">\n This authentication method does not declare a configuration form.\n </span>\n </div>\n ))}\n </div>\n </div>\n )}\n\n {/* Details Tab */}\n {activeTab === 'details' && (\n <div className=\"space-y-4\">\n <h3 className=\"text-sm font-semibold text-text-primary\">Details</h3>\n <div className=\"space-y-3\">\n <div className=\"flex items-center gap-3 p-3 rounded-md border border-border-subtle\">\n <ProviderIcon provider={selectedProvider} size={40} />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {selectedProvider.name}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {getAuthTypeLabel(selectedProvider.authType)} ·{' '}\n {getCategoryLabel(selectedProvider.category)}\n </p>\n </div>\n </div>\n {selectedProvider.description && (\n <div>\n <div className=\"text-xs font-medium text-text-secondary uppercase tracking-wider\">\n Description\n </div>\n <p className=\"text-sm text-text-primary mt-1\">\n {selectedProvider.description}\n </p>\n </div>\n )}\n {selectedProvider.website && (\n <div>\n <div className=\"text-xs font-medium text-text-secondary uppercase tracking-wider\">\n Website\n </div>\n <a\n href={selectedProvider.website}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"block text-sm text-primary hover:underline mt-1\"\n >\n {selectedProvider.website}\n </a>\n </div>\n )}\n {selectedProvider.docsUrl && (\n <div>\n <div className=\"text-xs font-medium text-text-secondary uppercase tracking-wider\">\n Documentation\n </div>\n <a\n href={selectedProvider.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"block text-sm text-primary hover:underline mt-1\"\n >\n {selectedProvider.docsUrl}\n </a>\n </div>\n )}\n </div>\n </div>\n )}\n </div>\n </>\n )}\n </div>\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuFA,IAAM,KAAY,MACZ,KAAW;AAEjB,SAAgB,EAAoB,EAClC,SACA,YACA,0BACA,0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