@burdenoff/microfe-integrations 2026.923.1 → 2026.929.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,7 +2,8 @@ import { useIntegrations as e } from "./integrations/providers/IntegrationsProvi
2
2
  import { INTEGRATION_PERMISSIONS as t } from "./integrations/constants/permissions.js";
3
3
  import { useIntegrationsStore as n } from "./integrations/store/integrationsStore.js";
4
4
  import { IntegrationsRoot as r } from "./integrations/IntegrationsRoot.js";
5
- import { IntegrationsAdminRoot as i } from "./integrations/IntegrationsAdminRoot.js";
6
- import { AddConnectionWizard as a } from "./integrations/pages/AddConnectionWizard.js";
5
+ import { ConnectionsPanel as i } from "./integrations/ConnectionsPanel.js";
6
+ import { IntegrationsAdminRoot as a } from "./integrations/IntegrationsAdminRoot.js";
7
+ import { AddConnectionWizard as o } from "./integrations/pages/AddConnectionWizard.js";
7
8
  import "./integrations/index.js";
8
- export { a as AddConnectionWizard, t as INTEGRATION_PERMISSIONS, i as IntegrationsAdminRoot, r as IntegrationsRoot, e as useIntegrations, n as useIntegrationsStore };
9
+ export { o as AddConnectionWizard, i as ConnectionsPanel, t as INTEGRATION_PERMISSIONS, a as IntegrationsAdminRoot, r as IntegrationsRoot, e as useIntegrations, n as useIntegrationsStore };
@@ -0,0 +1,18 @@
1
+ import { FC } from 'react';
2
+ import { IntegrationsRootProps } from './types';
3
+
4
+ /**
5
+ * The same props `IntegrationsRoot` takes.
6
+ *
7
+ * ★ `registerNavItems` / `registerFooterItems` are deliberately NOT called
8
+ * here: they register items with the host's shell chrome, which is wrong for a
9
+ * surface that lives and dies with a dialog. They cannot be typed away —
10
+ * `IntegrationsRootProps` extends `MicrofrontendRootProps`, which is
11
+ * `Record<string, unknown>`, so an index signature makes `keyof` equal `string`
12
+ * and `Omit` collapses every field to `unknown` rather than removing two. An
13
+ * `Omit` here would look like a constraint while silently destroying the types
14
+ * of the props that matter, so this is an alias and the contract is the doc.
15
+ */
16
+ export type ConnectionsPanelProps = IntegrationsRootProps;
17
+ export declare const ConnectionsPanel: FC<ConnectionsPanelProps>;
18
+ //# sourceMappingURL=ConnectionsPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectionsPanel.d.ts","sourceRoot":"","sources":["../../src/integrations/ConnectionsPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAMhC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAE1D,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAuBtD,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { IntegrationsProvider as e } from "./providers/IntegrationsProvider.js";
2
+ import { useTr as t } from "./hooks/useTr.js";
3
+ import { ConnectionsList as n } from "./pages/ConnectionsList.js";
4
+ import { ErrorBoundary as r } from "@burdenoff/fe-libs/shared/components";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import { FeatureFlagProvider as o } from "@burdenoff/fe-libs/shared/feature-flags";
7
+ //#region src/integrations/ConnectionsPanel.tsx
8
+ var s = (s) => {
9
+ let c = t();
10
+ return /* @__PURE__ */ i(o, {
11
+ workspaceId: s.workspaceId ?? null,
12
+ gateway: "global",
13
+ defaultEnabled: !1,
14
+ children: /* @__PURE__ */ i(r, {
15
+ fallback: /* @__PURE__ */ a("div", {
16
+ className: "p-6 text-center text-text-secondary",
17
+ children: [
18
+ c("integrations.errorBoundary.title", "Something went wrong loading this module."),
19
+ " ",
20
+ c("integrations.errorBoundary.refresh", "Please refresh the page.")
21
+ ]
22
+ }),
23
+ children: /* @__PURE__ */ i(e, {
24
+ ...s,
25
+ children: /* @__PURE__ */ i(n, {})
26
+ })
27
+ })
28
+ });
29
+ };
30
+ //#endregion
31
+ export { s as ConnectionsPanel };
32
+
33
+ //# sourceMappingURL=ConnectionsPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectionsPanel.js","names":[],"sources":["../../src/integrations/ConnectionsPanel.tsx"],"sourcesContent":["/**\n * The connections screen, without the router.\n *\n * ★★ WHY THIS EXISTS AND `IntegrationsRoot` COULD NOT BE USED. The assistant's\n * attach menu offers \"Connect a source\", and it was reported that it \"opens the\n * page but I need a popup in the centre\" — navigating away tears the user out\n * of the conversation they were having. A host wants to render the connections\n * screen inside a dialog, over whatever page the user is on.\n *\n * `IntegrationsRoot` cannot do that. It renders `IntegrationsUserRoutes`, whose\n * `<Routes>` matches against the CURRENT URL. Mounted in a dialog while the\n * user sits at `/dashboard`, the inner routes match none of their paths and\n * fall through to `<Route path=\"*\" element={<Navigate to=\"\" replace />} />` —\n * so opening the dialog would navigate the host app. Wrapping it in a\n * `MemoryRouter` is not an escape either: react-router still asserts\n * `You cannot render a <Router> inside another <Router>`, so it throws.\n *\n * ★ `ConnectionsList` itself needs no router. It takes `navigate` from\n * `IntegrationsProvider` — a plain callback the host supplies — so it works\n * anywhere its providers are mounted. This composes exactly the provider stack\n * `IntegrationsRoot` does, minus the routes and minus the shell nav/footer\n * registration, which a dialog has no business performing.\n *\n * ★ The SAME screen, not a second implementation. Products reuse this rather\n * than growing their own connection management, which is the thing this module\n * exists to own.\n */\nimport type { FC } from 'react';\nimport { ErrorBoundary } from '@burdenoff/fe-libs/shared/components';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { IntegrationsProvider } from './providers/IntegrationsProvider';\nimport { ConnectionsList } from './pages/ConnectionsList';\nimport { useTr } from './hooks/useTr';\nimport type { IntegrationsRootProps } from './types';\n\n/**\n * The same props `IntegrationsRoot` takes.\n *\n * ★ `registerNavItems` / `registerFooterItems` are deliberately NOT called\n * here: they register items with the host's shell chrome, which is wrong for a\n * surface that lives and dies with a dialog. They cannot be typed away —\n * `IntegrationsRootProps` extends `MicrofrontendRootProps`, which is\n * `Record<string, unknown>`, so an index signature makes `keyof` equal `string`\n * and `Omit` collapses every field to `unknown` rather than removing two. An\n * `Omit` here would look like a constraint while silently destroying the types\n * of the props that matter, so this is an alias and the contract is the doc.\n */\nexport type ConnectionsPanelProps = IntegrationsRootProps;\n\nexport const ConnectionsPanel: FC<ConnectionsPanelProps> = (props) => {\n const tr = useTr();\n\n return (\n <FeatureFlagProvider\n workspaceId={props.workspaceId ?? null}\n gateway=\"global\"\n defaultEnabled={false}\n >\n <ErrorBoundary\n fallback={\n <div className=\"p-6 text-center text-text-secondary\">\n {tr('integrations.errorBoundary.title', 'Something went wrong loading this module.')}{' '}\n {tr('integrations.errorBoundary.refresh', 'Please refresh the page.')}\n </div>\n }\n >\n <IntegrationsProvider {...props}>\n <ConnectionsList />\n </IntegrationsProvider>\n </ErrorBoundary>\n </FeatureFlagProvider>\n );\n};\n"],"mappings":";;;;;;;AAiDA,IAAa,KAA+C,MAAU;CACpE,IAAM,IAAK,GAAO;AAElB,QACE,kBAAC,GAAD;EACE,aAAa,EAAM,eAAe;EAClC,SAAQ;EACR,gBAAgB;YAEhB,kBAAC,GAAD;GACE,UACE,kBAAC,OAAD;IAAK,WAAU;cAAf;KACG,EAAG,oCAAoC,4CAA4C;KAAE;KACrF,EAAG,sCAAsC,2BAA2B;KACjE;;aAGR,kBAAC,GAAD;IAAsB,GAAI;cACxB,kBAAC,GAAD,EAAmB,CAAA;IACE,CAAA;GACT,CAAA;EACI,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"AddConnectionDialog.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/AddConnectionDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAmDH,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,sCAs/B1B"}
1
+ {"version":3,"file":"AddConnectionDialog.d.ts","sourceRoot":"","sources":["../../../src/integrations/components/AddConnectionDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAoDH,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,sCAyiC1B"}
@@ -13,38 +13,38 @@ import { AuthMethodNotice as de, AuthMethodSelector as fe } from "./AuthMethodSe
13
13
  import { ProviderIcon as a } from "./ProviderIcon.js";
14
14
  import { SchemaForm as pe, initialValuesFromSchema as me, isSchemaComplete as he, parseFormSchema as ge, visibleValues as _e } from "./SchemaForm.js";
15
15
  import { useCallback as ve, useEffect as o, useId as ye, useMemo as s, useRef as c, useState as l } from "react";
16
- import { AlertCircle as u, Check as be, CheckCircle2 as xe, ExternalLink as Se, Info as Ce, Link2 as we, Loader2 as d, Search as Te, Shield as f, X as Ee } from "lucide-react";
17
- import { usePermissions as De } from "@burdenoff/fe-libs/shared/providers/shell";
16
+ import { AlertCircle as u, Check as be, CheckCircle2 as xe, Copy as Se, ExternalLink as Ce, Info as we, Link2 as Te, Loader2 as d, Search as Ee, Shield as f, X as De } from "lucide-react";
17
+ import { usePermissions as Oe } from "@burdenoff/fe-libs/shared/providers/shell";
18
18
  import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
19
- import { IllustratedEmptyState as Oe } from "@burdenoff/fe-libs/ui";
19
+ import { IllustratedEmptyState as ke } from "@burdenoff/fe-libs/ui";
20
20
  //#region src/integrations/components/AddConnectionDialog.tsx
21
- var ke = 1100, Ae = 1101;
21
+ var Ae = 1100, je = 1101;
22
22
  function g({ open: g, onClose: _, preselectedProviderId: v, onConnectionCreated: y }) {
23
- let b = t(), je = te(), x = ee(), { apiGatewayUrl: S } = e(), { providers: C, loading: w } = ie(), Me = s(() => v ? (C ?? []).find((e) => e.id === v) ?? null : null, [C, v]), { provider: Ne, loading: Pe } = re(!w && v && !Me ? v : ""), T = Me ?? Ne, Fe = !!v && !T && (w || Pe), { hasPermission: Ie, isLoading: Le } = De(), Re = !Le && Ie(r.CONNECTION_CREATE), { createConnection: ze, loading: Be } = se(), { initiateOAuth: Ve, loading: He } = ce(), { authenticateConnection: Ue, loading: We } = ae(), { authenticateWithServiceAccount: Ge, loading: Ke } = oe(), [qe] = ne({ fetchPolicy: "network-only" }), [E, D] = l(null), [O, k] = l(!v), [A, Je] = l("connection"), [j, M] = l(""), [N, P] = l(""), [F, Ye] = l(""), [I, Xe] = l(null), [L, R] = l({}), [z, Ze] = l({
23
+ let b = t(), Me = te(), x = ee(), { apiGatewayUrl: S } = e(), { providers: C, loading: w } = ie(), Ne = s(() => v ? (C ?? []).find((e) => e.id === v) ?? null : null, [C, v]), { provider: Pe, loading: Fe } = re(!w && v && !Ne ? v : ""), T = Ne ?? Pe, Ie = !!v && !T && (w || Fe), { hasPermission: Le, isLoading: Re } = Oe(), ze = !Re && Le(r.CONNECTION_CREATE), { createConnection: Be, loading: Ve } = se(), { initiateOAuth: He, loading: Ue } = ce(), { authenticateConnection: We, loading: Ge } = ae(), { authenticateWithServiceAccount: Ke, loading: qe } = oe(), [Je] = ne({ fetchPolicy: "network-only" }), [E, D] = l(null), [O, k] = l(!v), [A, Ye] = l("connection"), [j, Xe] = l(""), [M, N] = l(""), [P, Ze] = l(""), [F, Qe] = l(null), [I, L] = l({}), [R, $e] = l({
24
24
  mode: "managed",
25
25
  vaultId: "",
26
26
  secretId: "",
27
27
  managedSecretName: ""
28
- }), [Qe, B] = l(""), [V, H] = l(!1), [$e, U] = l(!1), [, et] = l(null), W = c(null), G = c(null), tt = c(null), nt = ye(), K = (e) => `${nt}-${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 ?? i(E?.authType), rt = J?.authType ?? E?.authType, X = s(() => J?.defaultScopes?.length ? J.defaultScopes : E?.defaultScopes ?? [], [J, E]), Z = s(() => ge(J?.configSchema ?? E?.configSchema), [J, E]);
28
+ }), [et, z] = l(""), [tt, nt] = l(!1), [B, V] = l(!1), [rt, H] = l(!1), [, it] = l(null), U = c(null), W = c(null), at = c(null), ot = ye(), G = (e) => `${ot}-${e}`, K = s(() => (E?.authMethods ?? []).filter((e) => e.isEnabled), [E]), q = s(() => K.find((e) => e.key === F) ?? K[0] ?? null, [K, F]), J = q?.flow ?? i(E?.authType), st = q?.authType ?? E?.authType, Y = S ? `${S}/integrations/oauth/callback` : "/integrations/oauth/callback", X = s(() => q?.defaultScopes?.length ? q.defaultScopes : E?.defaultScopes ?? [], [q, E]), Z = s(() => ge(q?.configSchema ?? E?.configSchema), [q, E]);
29
29
  o(() => {
30
- R(me(Z)), B("");
31
- }, [I, E?.id]), o(() => {
30
+ L(me(Z)), z("");
31
+ }, [F, E?.id]), o(() => {
32
32
  if (!g) return;
33
33
  let e = (e) => {
34
34
  e.key === "Escape" && _();
35
35
  };
36
36
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
37
37
  }, [g, _]), o(() => () => {
38
- G.current?.(), W.current && !W.current.closed && W.current.close();
38
+ W.current?.(), U.current && !U.current.closed && U.current.close();
39
39
  }, []), o(() => {
40
- g && (Je("connection"), M(""), P(""), Ye(""), Xe(null), R({}), Ze({
40
+ g && (Ye("connection"), Xe(""), N(""), Ze(""), Qe(null), L({}), $e({
41
41
  mode: "managed",
42
42
  vaultId: "",
43
43
  secretId: "",
44
44
  managedSecretName: ""
45
- }), B(""), H(!1), U(!1), et(null), v ? (k(!1), D(null)) : (k(!0), D(null)));
45
+ }), z(""), V(!1), H(!1), it(null), v ? (k(!1), D(null)) : (k(!0), D(null)));
46
46
  }, [g, v]), o(() => {
47
- g && v && T && !E && (D(T), P(`${T.name} Connection`), k(!1));
47
+ g && v && T && !E && (D(T), N(`${T.name} Connection`), k(!1));
48
48
  }, [
49
49
  g,
50
50
  v,
@@ -52,148 +52,148 @@ function g({ open: g, onClose: _, preselectedProviderId: v, onConnectionCreated:
52
52
  E
53
53
  ]), o(() => {
54
54
  if (g && O) {
55
- let e = setTimeout(() => tt.current?.focus(), 100);
55
+ let e = setTimeout(() => at.current?.focus(), 100);
56
56
  return () => clearTimeout(e);
57
57
  }
58
58
  }, [g, O]);
59
- let Q = s(() => {
59
+ let ct = !!(Z && Object.prototype.hasOwnProperty.call(Z.properties ?? {}, "clientId")), Q = s(() => {
60
60
  let e = (C ?? []).filter((e) => e.pluginStatus === "installed" && e.isEnabled);
61
61
  if (!j.trim()) return e;
62
62
  let t = j.toLowerCase();
63
63
  return e.filter((e) => e.name.toLowerCase().includes(t) || (e.description ?? "").toLowerCase().includes(t) || e.key.toLowerCase().includes(t));
64
- }, [C, j]), it = s(() => {
64
+ }, [C, j]), lt = s(() => {
65
65
  let e = {};
66
66
  return Q.forEach((t) => {
67
67
  let n = t.category;
68
68
  e[n] || (e[n] = []), e[n].push(t);
69
69
  }), e;
70
- }, [Q]), at = ve((e) => {
71
- D(e), P(`${e.name} Connection`), k(!1), B("");
72
- }, []), $ = Be || He || $e || We || Ke, ot = ve(async () => {
73
- if (!E || !N.trim()) return;
74
- let e = Y === "minted";
70
+ }, [Q]), ut = ve((e) => {
71
+ D(e), N(`${e.name} Connection`), k(!1), z("");
72
+ }, []), $ = Ve || Ue || rt || Ge || qe, dt = ve(async () => {
73
+ if (!E || !M.trim()) return;
74
+ let e = J === "minted";
75
75
  if (!e) {
76
- if (!z.vaultId) {
77
- B(b("integrations.addConnection.errors.vaultRequired", "Please select a vault for storing or referencing credentials"));
76
+ if (!R.vaultId) {
77
+ z(b("integrations.addConnection.errors.vaultRequired", "Please select a vault for storing or referencing credentials"));
78
78
  return;
79
79
  }
80
- if (z.mode === "existing" && !z.secretId) {
81
- B(b("integrations.addConnection.errors.secretRequired", "Please select an existing vault secret to reuse"));
80
+ if (R.mode === "existing" && !R.secretId) {
81
+ z(b("integrations.addConnection.errors.secretRequired", "Please select an existing vault secret to reuse"));
82
82
  return;
83
83
  }
84
84
  }
85
- if (Y === "oauth2" && Z && !he(Z, L)) {
86
- B(b("integrations.addConnection.errors.fieldsRequired", "Please fill in all required fields"));
85
+ if (J === "oauth2" && Z && !he(Z, I)) {
86
+ z(b("integrations.addConnection.errors.fieldsRequired", "Please fill in all required fields"));
87
87
  return;
88
88
  }
89
- if (J && !J.isConfigured) {
90
- B(b("integrations.addConnection.authentication.methodNotConfigured", "This authentication method is not configured in this environment. Ask an administrator to add its credentials, or pick another method."));
89
+ if (q && !q.isConfigured) {
90
+ z(b("integrations.addConnection.authentication.methodNotConfigured", "This authentication method is not configured in this environment. Ask an administrator to add its credentials, or pick another method."));
91
91
  return;
92
92
  }
93
93
  try {
94
- B("");
95
- let t = await ze({
96
- name: N.trim(),
97
- description: F.trim() || void 0,
94
+ z("");
95
+ let t = await Be({
96
+ name: M.trim(),
97
+ description: P.trim() || void 0,
98
98
  providerId: E.id,
99
- authMethodKey: I ?? void 0,
100
- ...Y === "oauth2" && Z ? { config: _e(Z, L) } : {},
99
+ authMethodKey: F ?? void 0,
100
+ ...J === "oauth2" && Z ? { config: _e(Z, I) } : {},
101
101
  ...e ? {} : {
102
- vaultId: z.vaultId,
103
- credentialSecretId: z.mode === "existing" ? z.secretId : void 0,
104
- managedSecretName: z.mode === "managed" && z.managedSecretName.trim() || void 0
102
+ vaultId: R.vaultId,
103
+ credentialSecretId: R.mode === "existing" ? R.secretId : void 0,
104
+ managedSecretName: R.mode === "managed" && R.managedSecretName.trim() || void 0
105
105
  }
106
106
  });
107
107
  if (!t) {
108
- B(b("integrations.addConnection.errors.createFailed", "Failed to create connection"));
108
+ z(b("integrations.addConnection.errors.createFailed", "Failed to create connection"));
109
109
  return;
110
110
  }
111
- switch (et(t), Y) {
111
+ switch (it(t), J) {
112
112
  case "oauth2": {
113
- let e = await Ve(t, S ? `${S}/integrations/oauth/callback` : "/integrations/oauth/callback", E.key);
113
+ let e = await He(t, Y, E.key);
114
114
  if (e?.redirectUrl) {
115
115
  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`);
116
116
  if (!i) {
117
- B(b("integrations.addConnection.authentication.popupBlocked", "Popup was blocked. Please allow popups for this site and try again."));
117
+ z(b("integrations.addConnection.authentication.popupBlocked", "Popup was blocked. Please allow popups for this site and try again."));
118
118
  return;
119
119
  }
120
- W.current = i, U(!0), G.current?.(), G.current = le({
120
+ U.current = i, H(!0), W.current?.(), W.current = le({
121
121
  connectionId: t,
122
122
  popup: i,
123
123
  fetchConnectionStatus: async () => {
124
- let { data: e } = await qe({ variables: { id: t } });
124
+ let { data: e } = await Je({ variables: { id: t } });
125
125
  return e?.getConnection ?? null;
126
126
  },
127
127
  onSuccess: () => {
128
- H(!0), y?.(t);
128
+ V(!0), y?.(t);
129
129
  },
130
- onError: B,
130
+ onError: z,
131
131
  onSettled: () => {
132
- G.current = null, W.current = null, U(!1);
132
+ W.current = null, U.current = null, H(!1);
133
133
  }
134
134
  });
135
135
  return;
136
136
  }
137
- H(!0), y?.(t);
137
+ V(!0), y?.(t);
138
138
  break;
139
139
  }
140
140
  case "minted":
141
- rt === "service_account" && await Ge(t, X.length > 0 ? X : void 0), H(!0), y?.(t);
141
+ st === "service_account" && await Ke(t, X.length > 0 ? X : void 0), V(!0), y?.(t);
142
142
  break;
143
143
  default: {
144
- if (Z && !he(Z, L)) {
145
- B(b("integrations.addConnection.errors.fieldsRequired", "Please fill in all required fields"));
144
+ if (Z && !he(Z, I)) {
145
+ z(b("integrations.addConnection.errors.fieldsRequired", "Please fill in all required fields"));
146
146
  return;
147
147
  }
148
148
  let e = {};
149
- for (let [t, n] of Object.entries(_e(Z, L))) if (typeof n == "string") {
149
+ for (let [t, n] of Object.entries(_e(Z, I))) if (typeof n == "string") {
150
150
  let r = n.trim();
151
151
  r && (e[t] = r);
152
152
  } else n != null && (e[t] = n);
153
- await Ue(t, I ?? void 0, e), H(!0), y?.(t);
153
+ await We(t, F ?? void 0, e), V(!0), y?.(t);
154
154
  }
155
155
  }
156
156
  } catch (e) {
157
- B(e instanceof Error ? e.message : b("integrations.addConnection.errors.authFailed", "Authentication failed"));
157
+ z(e instanceof Error ? e.message : b("integrations.addConnection.errors.authFailed", "Authentication failed"));
158
158
  }
159
159
  }, [
160
160
  E,
161
- N,
161
+ M,
162
+ P,
162
163
  F,
163
- I,
164
- Y,
165
- rt,
164
+ J,
165
+ st,
166
166
  X,
167
167
  Z,
168
- L,
169
- J,
170
- ze,
171
- Ve,
172
- qe,
173
- Ue,
174
- Ge,
168
+ I,
169
+ q,
170
+ Be,
171
+ He,
172
+ Je,
173
+ We,
174
+ Ke,
175
175
  S,
176
176
  y,
177
- z,
177
+ R,
178
178
  b
179
- ]), st = [{
179
+ ]), ft = [{
180
180
  key: "connection",
181
181
  label: b("integrations.addConnection.tabs.connection", "Connection"),
182
- icon: we
182
+ icon: Te
183
183
  }, {
184
184
  key: "details",
185
185
  label: b("integrations.addConnection.tabs.details", "Details"),
186
- icon: Ce
186
+ icon: we
187
187
  }];
188
- return g ? !Re && !Le ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("div", {
189
- style: { zIndex: ke },
188
+ return g ? !ze && !Re ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("div", {
189
+ style: { zIndex: Ae },
190
190
  className: "fixed inset-0 bg-bg-overlay animate-in fade-in-0 duration-200",
191
191
  onClick: _
192
192
  }), /* @__PURE__ */ h("div", {
193
193
  role: "dialog",
194
194
  "aria-modal": "true",
195
195
  "aria-labelledby": "add-connection-denied-title",
196
- style: { zIndex: Ae },
196
+ style: { zIndex: je },
197
197
  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",
198
198
  children: [
199
199
  /* @__PURE__ */ m(f, {
@@ -217,14 +217,14 @@ function g({ open: g, onClose: _, preselectedProviderId: v, onConnectionCreated:
217
217
  })
218
218
  ]
219
219
  })] }) : /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("div", {
220
- style: { zIndex: ke },
220
+ style: { zIndex: Ae },
221
221
  className: "fixed inset-0 bg-bg-overlay animate-in fade-in-0 duration-200",
222
222
  onClick: _
223
223
  }), /* @__PURE__ */ h("div", {
224
224
  role: "dialog",
225
225
  "aria-modal": "true",
226
226
  "aria-labelledby": "add-connection-dialog-title",
227
- style: { zIndex: Ae },
227
+ style: { zIndex: je },
228
228
  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",
229
229
  children: [/* @__PURE__ */ h("div", {
230
230
  className: "flex items-center justify-between px-5 py-4 border-b border-border-subtle flex-shrink-0",
@@ -250,21 +250,21 @@ function g({ open: g, onClose: _, preselectedProviderId: v, onConnectionCreated:
250
250
  })] })
251
251
  }), /* @__PURE__ */ h("div", {
252
252
  className: "flex items-center gap-2",
253
- children: [E && !O && !V && /* @__PURE__ */ h("button", {
253
+ children: [E && !O && !B && /* @__PURE__ */ h("button", {
254
254
  type: "button",
255
- onClick: ot,
256
- disabled: $ || !N.trim(),
255
+ onClick: dt,
256
+ disabled: $ || !M.trim(),
257
257
  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",
258
258
  children: [$ ? /* @__PURE__ */ m(d, {
259
259
  size: 14,
260
260
  className: "animate-spin"
261
- }) : /* @__PURE__ */ m(be, { size: 14 }), $e ? b("integrations.addConnection.actions.waiting", "Waiting...") : b("integrations.addConnection.actions.connect", "Connect")]
261
+ }) : /* @__PURE__ */ m(be, { size: 14 }), rt ? b("integrations.addConnection.actions.waiting", "Waiting...") : b("integrations.addConnection.actions.connect", "Connect")]
262
262
  }), /* @__PURE__ */ m("button", {
263
263
  type: "button",
264
264
  onClick: _,
265
265
  className: "p-1.5 rounded-md hover:bg-accent transition-colors text-text-secondary hover:text-text-primary",
266
266
  "aria-label": b("integrations.addConnection.actions.close", "Close dialog"),
267
- children: /* @__PURE__ */ m(Ee, { size: 20 })
267
+ children: /* @__PURE__ */ m(De, { size: 20 })
268
268
  })]
269
269
  })]
270
270
  }), /* @__PURE__ */ h("div", {
@@ -279,14 +279,14 @@ function g({ open: g, onClose: _, preselectedProviderId: v, onConnectionCreated:
279
279
  }),
280
280
  /* @__PURE__ */ h("div", {
281
281
  className: "relative mb-4",
282
- children: [/* @__PURE__ */ m(Te, {
282
+ children: [/* @__PURE__ */ m(Ee, {
283
283
  size: 16,
284
284
  className: "absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary"
285
285
  }), /* @__PURE__ */ m("input", {
286
- ref: tt,
286
+ ref: at,
287
287
  type: "text",
288
288
  value: j,
289
- onChange: (e) => M(e.target.value),
289
+ onChange: (e) => Xe(e.target.value),
290
290
  placeholder: b("integrations.addConnection.search.placeholder", "Search installed providers..."),
291
291
  "aria-label": b("integrations.addConnection.search.ariaLabel", "Search installed providers"),
292
292
  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"
@@ -298,18 +298,18 @@ function g({ open: g, onClose: _, preselectedProviderId: v, onConnectionCreated:
298
298
  size: 24,
299
299
  className: "animate-spin text-text-secondary"
300
300
  })
301
- }) : Q.length === 0 ? /* @__PURE__ */ m(Oe, {
301
+ }) : Q.length === 0 ? /* @__PURE__ */ m(ke, {
302
302
  illustration: j ? "empty-search" : "empty-data",
303
303
  title: j ? b("integrations.addConnection.empty.noMatchingProviders", "No matching providers") : b("integrations.addConnection.empty.noInstalledProviders", "No installed providers yet"),
304
304
  description: j ? b("integrations.addConnection.empty.matchingDescription", "No installed provider matches your search. Try a different term or install one from the catalog.", { query: j }) : b("integrations.addConnection.empty.installedDescription", "You need at least one installed, enabled provider before you can create a connection. Install one from the catalog to get started.")
305
305
  }) : /* @__PURE__ */ m("div", {
306
306
  className: "max-h-[400px] overflow-y-auto space-y-1",
307
- children: Object.entries(it).map(([e, t]) => /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("div", {
307
+ children: Object.entries(lt).map(([e, t]) => /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("div", {
308
308
  className: "px-2 py-1.5 text-xs font-semibold text-text-secondary uppercase tracking-wider",
309
- children: je(e)
309
+ children: Me(e)
310
310
  }), t.map((e) => /* @__PURE__ */ h("button", {
311
311
  type: "button",
312
- onClick: () => at(e),
312
+ onClick: () => ut(e),
313
313
  className: "w-full flex items-center gap-3 px-3 py-2.5 rounded-md hover:bg-accent/50 transition-colors text-left",
314
314
  children: [/* @__PURE__ */ m(a, {
315
315
  provider: e,
@@ -328,14 +328,14 @@ function g({ open: g, onClose: _, preselectedProviderId: v, onConnectionCreated:
328
328
  })
329
329
  ]
330
330
  }),
331
- !O && !E && Fe && /* @__PURE__ */ m("div", {
331
+ !O && !E && Ie && /* @__PURE__ */ m("div", {
332
332
  className: "flex-1 flex items-center justify-center",
333
333
  children: /* @__PURE__ */ m(d, {
334
334
  size: 32,
335
335
  className: "animate-spin text-text-secondary"
336
336
  })
337
337
  }),
338
- !O && !E && !Fe && v && /* @__PURE__ */ h("div", {
338
+ !O && !E && !Ie && v && /* @__PURE__ */ h("div", {
339
339
  className: "flex-1 flex flex-col items-center justify-center p-8 text-center",
340
340
  children: [/* @__PURE__ */ m(u, {
341
341
  size: 32,
@@ -345,7 +345,7 @@ function g({ open: g, onClose: _, preselectedProviderId: v, onConnectionCreated:
345
345
  children: b("integrations.addConnection.providerUnavailable", "This provider isn't available.")
346
346
  })]
347
347
  }),
348
- V && E && /* @__PURE__ */ h("div", {
348
+ B && E && /* @__PURE__ */ h("div", {
349
349
  className: "flex-1 flex flex-col items-center justify-center p-8 text-center",
350
350
  children: [
351
351
  /* @__PURE__ */ m("div", {
@@ -371,13 +371,13 @@ function g({ open: g, onClose: _, preselectedProviderId: v, onConnectionCreated:
371
371
  })
372
372
  ]
373
373
  }),
374
- E && !O && !V && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("div", {
374
+ E && !O && !B && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("div", {
375
375
  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",
376
- children: st.map((e) => {
376
+ children: ft.map((e) => {
377
377
  let t = e.icon;
378
378
  return /* @__PURE__ */ h("button", {
379
379
  type: "button",
380
- onClick: () => Je(e.key),
380
+ onClick: () => Ye(e.key),
381
381
  className: n("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"),
382
382
  children: [/* @__PURE__ */ m(t, { size: 16 }), e.label]
383
383
  }, e.key);
@@ -387,18 +387,18 @@ function g({ open: g, onClose: _, preselectedProviderId: v, onConnectionCreated:
387
387
  children: [A === "connection" && /* @__PURE__ */ h("div", {
388
388
  className: "space-y-5",
389
389
  children: [
390
- Qe && /* @__PURE__ */ h("div", {
390
+ et && /* @__PURE__ */ h("div", {
391
391
  className: "flex items-center gap-2 px-3 py-2 rounded-md bg-status-error-bg/10 border border-status-error-border/20",
392
392
  children: [/* @__PURE__ */ m(u, {
393
393
  size: 16,
394
394
  className: "text-status-error-text flex-shrink-0"
395
395
  }), /* @__PURE__ */ m("span", {
396
396
  className: "text-sm text-status-error-text",
397
- children: Qe
397
+ children: et
398
398
  })]
399
399
  }),
400
400
  /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ h("label", {
401
- htmlFor: K("conn-name"),
401
+ htmlFor: G("conn-name"),
402
402
  className: "block text-sm font-medium text-text-primary mb-1.5",
403
403
  children: [
404
404
  b("integrations.addConnection.fields.connectionName", "Connection Name"),
@@ -409,32 +409,32 @@ function g({ open: g, onClose: _, preselectedProviderId: v, onConnectionCreated:
409
409
  })
410
410
  ]
411
411
  }), /* @__PURE__ */ m("input", {
412
- id: K("conn-name"),
412
+ id: G("conn-name"),
413
413
  "aria-label": b("integrations.addConnection.fields.connectionName", "Connection Name"),
414
414
  type: "text",
415
- value: N,
416
- onChange: (e) => P(e.target.value),
415
+ value: M,
416
+ onChange: (e) => N(e.target.value),
417
417
  placeholder: b("integrations.addConnection.fields.connectionNamePlaceholder", "e.g., My {{provider}} Connection", { provider: E.name }),
418
418
  disabled: $,
419
419
  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"
420
420
  })] }),
421
421
  /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("label", {
422
- htmlFor: K("conn-desc"),
422
+ htmlFor: G("conn-desc"),
423
423
  className: "block text-sm font-medium text-text-primary mb-1.5",
424
424
  children: b("integrations.addConnection.fields.description", "Description")
425
425
  }), /* @__PURE__ */ m("input", {
426
- id: K("conn-desc"),
426
+ id: G("conn-desc"),
427
427
  "aria-label": b("integrations.addConnection.fields.description", "Description"),
428
428
  type: "text",
429
- value: F,
430
- onChange: (e) => Ye(e.target.value),
429
+ value: P,
430
+ onChange: (e) => Ze(e.target.value),
431
431
  placeholder: b("integrations.addConnection.fields.descriptionPlaceholder", "Optional description..."),
432
432
  disabled: $,
433
433
  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"
434
434
  })] }),
435
435
  E.authType !== "service_account" && /* @__PURE__ */ m(ue, {
436
- value: z,
437
- onChange: Ze,
436
+ value: R,
437
+ onChange: $e,
438
438
  providerAuthType: E.authType
439
439
  }),
440
440
  /* @__PURE__ */ h("div", {
@@ -450,45 +450,68 @@ function g({ open: g, onClose: _, preselectedProviderId: v, onConnectionCreated:
450
450
  className: "text-primary"
451
451
  }),
452
452
  b("integrations.addConnection.authentication.title", "Authentication"),
453
- q.length <= 1 && /* @__PURE__ */ h("span", {
453
+ K.length <= 1 && /* @__PURE__ */ h("span", {
454
454
  className: "text-text-secondary font-normal",
455
455
  children: [
456
456
  "·",
457
457
  " ",
458
- J?.displayName ?? x(E.authType)
458
+ q?.displayName ?? x(E.authType)
459
459
  ]
460
460
  })
461
461
  ]
462
462
  }), /* @__PURE__ */ m(fe, {
463
- methods: q,
464
- selectedKey: I,
465
- onSelect: Xe,
463
+ methods: K,
464
+ selectedKey: F,
465
+ onSelect: Qe,
466
466
  disabled: $,
467
- idPrefix: K("auth-method"),
467
+ idPrefix: G("auth-method"),
468
468
  compact: !0
469
469
  })]
470
470
  }),
471
471
  /* @__PURE__ */ m("div", {
472
472
  className: "space-y-2",
473
- children: /* @__PURE__ */ m(de, { method: J })
473
+ children: /* @__PURE__ */ m(de, { method: q })
474
474
  }),
475
- Y === "oauth2" && /* @__PURE__ */ h(p, { children: [Z && /* @__PURE__ */ m(pe, {
476
- schema: Z,
477
- values: L,
478
- onChange: R,
479
- disabled: $,
480
- idPrefix: K("oauth-cfg")
481
- }), /* @__PURE__ */ h("div", {
482
- className: "flex items-center gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default",
483
- children: [/* @__PURE__ */ m(Se, {
484
- size: 14,
485
- className: "text-status-info-text flex-shrink-0"
486
- }), /* @__PURE__ */ m("span", {
487
- className: "text-xs text-status-info-text",
488
- children: b("integrations.addConnection.authentication.oauthPopupInfo", "A popup window will open for {{provider}} sign-in", { provider: E.name })
489
- })]
490
- })] }),
491
- Y === "minted" && /* @__PURE__ */ h("div", {
475
+ J === "oauth2" && /* @__PURE__ */ h(p, { children: [
476
+ Z && /* @__PURE__ */ m(pe, {
477
+ schema: Z,
478
+ values: I,
479
+ onChange: L,
480
+ disabled: $,
481
+ idPrefix: G("oauth-cfg")
482
+ }),
483
+ ct && /* @__PURE__ */ h("div", {
484
+ className: "rounded-md border border-border-subtle bg-bg-surface px-3 py-2 space-y-1.5",
485
+ children: [/* @__PURE__ */ h("div", {
486
+ className: "flex items-center justify-between gap-2",
487
+ children: [/* @__PURE__ */ m("span", {
488
+ className: "text-xs font-medium text-text-primary",
489
+ children: b("integrations.addConnection.authentication.redirectUriLabel", "Redirect URL to register in your app")
490
+ }), /* @__PURE__ */ h("button", {
491
+ type: "button",
492
+ onClick: () => {
493
+ navigator.clipboard?.writeText(Y), nt(!0), window.setTimeout(() => nt(!1), 2e3);
494
+ },
495
+ className: "inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline",
496
+ children: [/* @__PURE__ */ m(Se, { size: 12 }), tt ? b("integrations.addConnection.authentication.copied", "Copied") : b("integrations.addConnection.authentication.copy", "Copy")]
497
+ })]
498
+ }), /* @__PURE__ */ m("code", {
499
+ className: "block break-all text-xs text-text-secondary",
500
+ children: Y
501
+ })]
502
+ }),
503
+ /* @__PURE__ */ h("div", {
504
+ className: "flex items-center gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default",
505
+ children: [/* @__PURE__ */ m(Ce, {
506
+ size: 14,
507
+ className: "text-status-info-text flex-shrink-0"
508
+ }), /* @__PURE__ */ m("span", {
509
+ className: "text-xs text-status-info-text",
510
+ children: b("integrations.addConnection.authentication.oauthPopupInfo", "A popup window will open for {{provider}} sign-in", { provider: E.name })
511
+ })]
512
+ })
513
+ ] }),
514
+ J === "minted" && /* @__PURE__ */ h("div", {
492
515
  className: "flex items-center gap-2 px-3 py-2 rounded-md bg-status-info-bg-subtle border border-border-default",
493
516
  children: [/* @__PURE__ */ m(f, {
494
517
  size: 14,
@@ -498,15 +521,15 @@ function g({ open: g, onClose: _, preselectedProviderId: v, onConnectionCreated:
498
521
  children: b("integrations.addConnection.authentication.serviceAccount.description", "No credentials to enter — access is granted on your behalf and tokens are issued per use.", { provider: E.name })
499
522
  })]
500
523
  }),
501
- Y === "fields" && (Z ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("p", {
524
+ J === "fields" && (Z ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("p", {
502
525
  className: "text-xs text-text-secondary",
503
526
  children: b("integrations.addConnection.authentication.secretsEncrypted", "Secret values are stored encrypted and never shown again.")
504
527
  }), /* @__PURE__ */ m(pe, {
505
528
  schema: Z,
506
- values: L,
507
- onChange: R,
529
+ values: I,
530
+ onChange: L,
508
531
  disabled: $,
509
- idPrefix: K("cred")
532
+ idPrefix: G("cred")
510
533
  })] }) : /* @__PURE__ */ h("div", {
511
534
  className: "flex items-center gap-2 px-3 py-2 rounded-md bg-status-error-bg-subtle border border-border-default",
512
535
  children: [/* @__PURE__ */ m(u, {
@@ -542,7 +565,7 @@ function g({ open: g, onClose: _, preselectedProviderId: v, onConnectionCreated:
542
565
  x(E.authType),
543
566
  " ·",
544
567
  " ",
545
- je(E.category)
568
+ Me(E.category)
546
569
  ]
547
570
  })] })]
548
571
  }),
@@ -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 { useTr } from '../hooks/useTr';\nimport { useCategoryLabel, useAuthTypeLabel } from '../hooks/useLabel';\nimport { legacyFlowForAuthType } 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 tr = useTr();\n const getCategoryLabel = useCategoryLabel();\n const getAuthTypeLabel = useAuthTypeLabel();\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(\n tr(\n 'integrations.addConnection.errors.vaultRequired',\n 'Please select a vault for storing or referencing credentials'\n )\n );\n return;\n }\n if (credentialStorage.mode === 'existing' && !credentialStorage.secretId) {\n setErrorMessage(\n tr(\n 'integrations.addConnection.errors.secretRequired',\n 'Please select an existing vault secret to reuse'\n )\n );\n return;\n }\n }\n\n if (authFlow === 'oauth2' && activeSchema && !isSchemaComplete(activeSchema, fieldValues)) {\n setErrorMessage(\n tr('integrations.addConnection.errors.fieldsRequired', 'Please fill in all required fields')\n );\n return;\n }\n\n if (selectedAuthMethod && !selectedAuthMethod.isConfigured) {\n setErrorMessage(\n tr(\n 'integrations.addConnection.authentication.methodNotConfigured',\n 'This authentication method is not configured in this environment. Ask an administrator to add its credentials, or pick another method.'\n )\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(\n tr('integrations.addConnection.errors.createFailed', 'Failed to create connection')\n );\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 tr(\n 'integrations.addConnection.authentication.popupBlocked',\n 'Popup was blocked. Please allow popups for this site and try again.'\n )\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(\n tr(\n 'integrations.addConnection.errors.fieldsRequired',\n 'Please fill in all required fields'\n )\n );\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(\n err instanceof Error\n ? err.message\n : tr('integrations.addConnection.errors.authFailed', 'Authentication failed')\n );\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 tr,\n ]);\n\n // Tab items\n const tabs: { key: DialogTab; label: string; icon: typeof Link2 }[] = [\n {\n key: 'connection',\n label: tr('integrations.addConnection.tabs.connection', 'Connection'),\n icon: Link2,\n },\n { key: 'details', label: tr('integrations.addConnection.tabs.details', '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 {tr('integrations.addConnection.denied.title', 'Access Denied')}\n </h2>\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'integrations.addConnection.denied.description',\n \"You don't have permission to create connections.\"\n )}\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 {tr('integrations.common.close', '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 {tr('integrations.addConnection.dialog.accountTitle', '{{provider}} account', {\n provider: selectedProvider.name,\n })}\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 {tr('integrations.addConnection.dialog.title', 'Add new credential')}\n </h2>\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'integrations.addConnection.dialog.subtitle',\n 'Select an app or service to connect to'\n )}\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\n ? tr('integrations.addConnection.actions.waiting', 'Waiting...')\n : /* ★ \"Connect\", not \"Save\". This dialog only ever CREATES a\n connection, and a user told to \"find the Connect button\"\n could not: the word appeared nowhere in the flow. Reported\n from production, and confirmed by driving it — the only\n action control read \"Save\".\n\n ★ A dedicated key, not `integrations.common.save`, which\n ProviderEditorPage also uses. Repurposing the shared key\n would rename that button too, and re-pointing a seeded key\n leaves already-translated locales showing the old word. */\n tr('integrations.addConnection.actions.connect', 'Connect')}\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={tr('integrations.addConnection.actions.close', 'Close dialog')}\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 {tr(\n 'integrations.addConnection.dialog.subtitle',\n 'Select an app or service to connect to'\n )}\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={tr(\n 'integrations.addConnection.search.placeholder',\n 'Search installed providers...'\n )}\n aria-label={tr(\n 'integrations.addConnection.search.ariaLabel',\n 'Search installed providers'\n )}\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={\n searchQuery\n ? tr(\n 'integrations.addConnection.empty.noMatchingProviders',\n 'No matching providers'\n )\n : tr(\n 'integrations.addConnection.empty.noInstalledProviders',\n 'No installed providers yet'\n )\n }\n description={\n searchQuery\n ? tr(\n 'integrations.addConnection.empty.matchingDescription',\n 'No installed provider matches your search. Try a different term or install one from the catalog.',\n { query: searchQuery }\n )\n : tr(\n 'integrations.addConnection.empty.installedDescription',\n 'You need at least one installed, enabled provider before you can create a connection. Install one from the catalog to get started.'\n )\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\">\n {tr(\n 'integrations.addConnection.providerUnavailable',\n \"This provider isn't available.\"\n )}\n </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\">\n {tr('integrations.addConnection.success.title', 'Connection Created!')}\n </h3>\n <p className=\"text-sm text-text-secondary mb-6\">\n {tr(\n 'integrations.addConnection.success.description',\n 'Your {{provider}} connection has been set up successfully.',\n { provider: selectedProvider.name }\n )}\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 {tr('integrations.addConnection.actions.close', '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 {tr('integrations.addConnection.fields.connectionName', 'Connection Name')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n id={fieldId('conn-name')}\n aria-label={tr(\n 'integrations.addConnection.fields.connectionName',\n 'Connection Name'\n )}\n type=\"text\"\n value={connectionName}\n onChange={(e) => setConnectionName(e.target.value)}\n placeholder={tr(\n 'integrations.addConnection.fields.connectionNamePlaceholder',\n 'e.g., My {{provider}} Connection',\n { provider: selectedProvider.name }\n )}\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 {tr('integrations.addConnection.fields.description', 'Description')}\n </label>\n <input\n id={fieldId('conn-desc')}\n aria-label={tr(\n 'integrations.addConnection.fields.description',\n 'Description'\n )}\n type=\"text\"\n value={connectionDescription}\n onChange={(e) => setConnectionDescription(e.target.value)}\n placeholder={tr(\n 'integrations.addConnection.fields.descriptionPlaceholder',\n 'Optional description...'\n )}\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 {tr('integrations.addConnection.authentication.title', 'Authentication')}\n {authMethods.length <= 1 && (\n <span className=\"text-text-secondary font-normal\">\n &middot;{' '}\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 {tr(\n 'integrations.addConnection.authentication.oauthPopupInfo',\n 'A popup window will open for {{provider}} sign-in',\n { provider: selectedProvider.name }\n )}\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 {tr(\n 'integrations.addConnection.authentication.serviceAccount.description',\n 'No credentials to enter — access is granted on your behalf and tokens are issued per use.',\n { provider: selectedProvider.name }\n )}\n </span>\n </div>\n )}\n\n {authFlow === 'fields' &&\n (activeSchema ? (\n <>\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'integrations.addConnection.authentication.secretsEncrypted',\n 'Secret values are stored encrypted and never shown again.'\n )}\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 {tr(\n 'integrations.addConnection.authentication.noForm',\n 'This authentication method does not declare a configuration form.'\n )}\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\">\n {tr('integrations.addConnection.tabs.details', 'Details')}\n </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)} &middot;{' '}\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 {tr('integrations.addConnection.fields.description', '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 {tr('integrations.providerDetail.sections.website', '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 {tr(\n 'integrations.providerDetail.sections.documentation',\n 'Documentation'\n )}\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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,CAAA,GA9jBa"}
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 Copy,\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 { useTr } from '../hooks/useTr';\nimport { useCategoryLabel, useAuthTypeLabel } from '../hooks/useLabel';\nimport { legacyFlowForAuthType } 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 tr = useTr();\n const getCategoryLabel = useCategoryLabel();\n const getAuthTypeLabel = useAuthTypeLabel();\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 [redirectCopied, setRedirectCopied] = useState(false);\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\n // The exact value the provider will compare against at the callback. Built\n // here rather than only at submit time so the dialog can show the user what\n // to register in their own OAuth app.\n const oauthCallbackUrl = apiGatewayUrl\n ? `${apiGatewayUrl}/integrations/oauth/callback`\n : '/integrations/oauth/callback';\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 // True for \"Custom OAuth 2.0\" and the generic OAuth provider — the methods\n // where the user brings an app of their own and therefore needs the redirect\n // URL. Derived from the schema rather than a hardcoded method key so an\n // admin-authored method that asks for a client id gets the same help.\n const collectsOwnClientId = Boolean(\n activeSchema && Object.prototype.hasOwnProperty.call(activeSchema.properties ?? {}, 'clientId')\n );\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(\n tr(\n 'integrations.addConnection.errors.vaultRequired',\n 'Please select a vault for storing or referencing credentials'\n )\n );\n return;\n }\n if (credentialStorage.mode === 'existing' && !credentialStorage.secretId) {\n setErrorMessage(\n tr(\n 'integrations.addConnection.errors.secretRequired',\n 'Please select an existing vault secret to reuse'\n )\n );\n return;\n }\n }\n\n if (authFlow === 'oauth2' && activeSchema && !isSchemaComplete(activeSchema, fieldValues)) {\n setErrorMessage(\n tr('integrations.addConnection.errors.fieldsRequired', 'Please fill in all required fields')\n );\n return;\n }\n\n if (selectedAuthMethod && !selectedAuthMethod.isConfigured) {\n setErrorMessage(\n tr(\n 'integrations.addConnection.authentication.methodNotConfigured',\n 'This authentication method is not configured in this environment. Ask an administrator to add its credentials, or pick another method.'\n )\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(\n tr('integrations.addConnection.errors.createFailed', 'Failed to create connection')\n );\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 result = await initiateOAuth(connId, oauthCallbackUrl, 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 tr(\n 'integrations.addConnection.authentication.popupBlocked',\n 'Popup was blocked. Please allow popups for this site and try again.'\n )\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(\n tr(\n 'integrations.addConnection.errors.fieldsRequired',\n 'Please fill in all required fields'\n )\n );\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(\n err instanceof Error\n ? err.message\n : tr('integrations.addConnection.errors.authFailed', 'Authentication failed')\n );\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 tr,\n ]);\n\n // Tab items\n const tabs: { key: DialogTab; label: string; icon: typeof Link2 }[] = [\n {\n key: 'connection',\n label: tr('integrations.addConnection.tabs.connection', 'Connection'),\n icon: Link2,\n },\n { key: 'details', label: tr('integrations.addConnection.tabs.details', '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 {tr('integrations.addConnection.denied.title', 'Access Denied')}\n </h2>\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'integrations.addConnection.denied.description',\n \"You don't have permission to create connections.\"\n )}\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 {tr('integrations.common.close', '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 {tr('integrations.addConnection.dialog.accountTitle', '{{provider}} account', {\n provider: selectedProvider.name,\n })}\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 {tr('integrations.addConnection.dialog.title', 'Add new credential')}\n </h2>\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'integrations.addConnection.dialog.subtitle',\n 'Select an app or service to connect to'\n )}\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\n ? tr('integrations.addConnection.actions.waiting', 'Waiting...')\n : /* ★ \"Connect\", not \"Save\". This dialog only ever CREATES a\n connection, and a user told to \"find the Connect button\"\n could not: the word appeared nowhere in the flow. Reported\n from production, and confirmed by driving it — the only\n action control read \"Save\".\n\n ★ A dedicated key, not `integrations.common.save`, which\n ProviderEditorPage also uses. Repurposing the shared key\n would rename that button too, and re-pointing a seeded key\n leaves already-translated locales showing the old word. */\n tr('integrations.addConnection.actions.connect', 'Connect')}\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={tr('integrations.addConnection.actions.close', 'Close dialog')}\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 {tr(\n 'integrations.addConnection.dialog.subtitle',\n 'Select an app or service to connect to'\n )}\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={tr(\n 'integrations.addConnection.search.placeholder',\n 'Search installed providers...'\n )}\n aria-label={tr(\n 'integrations.addConnection.search.ariaLabel',\n 'Search installed providers'\n )}\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={\n searchQuery\n ? tr(\n 'integrations.addConnection.empty.noMatchingProviders',\n 'No matching providers'\n )\n : tr(\n 'integrations.addConnection.empty.noInstalledProviders',\n 'No installed providers yet'\n )\n }\n description={\n searchQuery\n ? tr(\n 'integrations.addConnection.empty.matchingDescription',\n 'No installed provider matches your search. Try a different term or install one from the catalog.',\n { query: searchQuery }\n )\n : tr(\n 'integrations.addConnection.empty.installedDescription',\n 'You need at least one installed, enabled provider before you can create a connection. Install one from the catalog to get started.'\n )\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\">\n {tr(\n 'integrations.addConnection.providerUnavailable',\n \"This provider isn't available.\"\n )}\n </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\">\n {tr('integrations.addConnection.success.title', 'Connection Created!')}\n </h3>\n <p className=\"text-sm text-text-secondary mb-6\">\n {tr(\n 'integrations.addConnection.success.description',\n 'Your {{provider}} connection has been set up successfully.',\n { provider: selectedProvider.name }\n )}\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 {tr('integrations.addConnection.actions.close', '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 {tr('integrations.addConnection.fields.connectionName', 'Connection Name')}{' '}\n <span className=\"text-status-error-text\">*</span>\n </label>\n <input\n id={fieldId('conn-name')}\n aria-label={tr(\n 'integrations.addConnection.fields.connectionName',\n 'Connection Name'\n )}\n type=\"text\"\n value={connectionName}\n onChange={(e) => setConnectionName(e.target.value)}\n placeholder={tr(\n 'integrations.addConnection.fields.connectionNamePlaceholder',\n 'e.g., My {{provider}} Connection',\n { provider: selectedProvider.name }\n )}\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 {tr('integrations.addConnection.fields.description', 'Description')}\n </label>\n <input\n id={fieldId('conn-desc')}\n aria-label={tr(\n 'integrations.addConnection.fields.description',\n 'Description'\n )}\n type=\"text\"\n value={connectionDescription}\n onChange={(e) => setConnectionDescription(e.target.value)}\n placeholder={tr(\n 'integrations.addConnection.fields.descriptionPlaceholder',\n 'Optional description...'\n )}\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 {tr('integrations.addConnection.authentication.title', 'Authentication')}\n {authMethods.length <= 1 && (\n <span className=\"text-text-secondary font-normal\">\n &middot;{' '}\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 {/* A user supplying their own OAuth app has to\n register this exact URL in it, or the provider\n rejects the handshake with a redirect_uri\n mismatch — the single most common way a\n bring-your-own-app setup fails. Shown only for\n methods that ask for a client id, since it is\n noise for the managed ones. */}\n {collectsOwnClientId && (\n <div className=\"rounded-md border border-border-subtle bg-bg-surface px-3 py-2 space-y-1.5\">\n <div className=\"flex items-center justify-between gap-2\">\n <span className=\"text-xs font-medium text-text-primary\">\n {tr(\n 'integrations.addConnection.authentication.redirectUriLabel',\n 'Redirect URL to register in your app'\n )}\n </span>\n <button\n type=\"button\"\n onClick={() => {\n void navigator.clipboard?.writeText(oauthCallbackUrl);\n setRedirectCopied(true);\n window.setTimeout(() => setRedirectCopied(false), 2000);\n }}\n className=\"inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline\"\n >\n <Copy size={12} />\n {redirectCopied\n ? tr(\n 'integrations.addConnection.authentication.copied',\n 'Copied'\n )\n : tr('integrations.addConnection.authentication.copy', 'Copy')}\n </button>\n </div>\n <code className=\"block break-all text-xs text-text-secondary\">\n {oauthCallbackUrl}\n </code>\n </div>\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 {tr(\n 'integrations.addConnection.authentication.oauthPopupInfo',\n 'A popup window will open for {{provider}} sign-in',\n { provider: selectedProvider.name }\n )}\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 {tr(\n 'integrations.addConnection.authentication.serviceAccount.description',\n 'No credentials to enter — access is granted on your behalf and tokens are issued per use.',\n { provider: selectedProvider.name }\n )}\n </span>\n </div>\n )}\n\n {authFlow === 'fields' &&\n (activeSchema ? (\n <>\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'integrations.addConnection.authentication.secretsEncrypted',\n 'Secret values are stored encrypted and never shown again.'\n )}\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 {tr(\n 'integrations.addConnection.authentication.noForm',\n 'This authentication method does not declare a configuration form.'\n )}\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\">\n {tr('integrations.addConnection.tabs.details', 'Details')}\n </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)} &middot;{' '}\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 {tr('integrations.addConnection.fields.description', '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 {tr('integrations.providerDetail.sections.website', '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 {tr(\n 'integrations.providerDetail.sections.documentation',\n 'Documentation'\n )}\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":";;;;;;;;;;;;;;;;;;;;AAsFA,IAAM,KAAY,MACZ,KAAW;AAEjB,SAAgB,EAAoB,EAClC,SACA,YACA,0BACA,0BAC2B;CAE3B,IAAM,IAAK,GAAO,EACZ,KAAmB,IAAkB,EACrC,IAAmB,IAAkB,EACrC,EAAE,qBAAkB,GAAiB,EACrC,EAAE,cAAW,SAAS,MAAqB,IAAc,EAIzD,KAAiB,QAEnB,KACM,KAAa,EAAE,EAAE,MAAM,MAA2B,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AEP,EAAiB,WAChB,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,OAAD;SAAK,WAAU;mBACZ,EACC,sDACA,gBACD;SACG,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,GArmBa"}
@@ -23,6 +23,8 @@
23
23
  * ```
24
24
  */
25
25
  export { IntegrationsRoot } from './IntegrationsRoot';
26
+ export { ConnectionsPanel } from './ConnectionsPanel';
27
+ export type { ConnectionsPanelProps } from './ConnectionsPanel';
26
28
  export { IntegrationsAdminRoot } from './IntegrationsAdminRoot';
27
29
  export type { IntegrationsRootProps, IntegrationProvider, IntegrationConnection } from './types';
28
30
  export { useIntegrations } from './providers/IntegrationsProvider';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,YAAY,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,YAAY,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -2,5 +2,6 @@ import "./providers/IntegrationsProvider.js";
2
2
  import "./constants/permissions.js";
3
3
  import "./store/integrationsStore.js";
4
4
  import "./IntegrationsRoot.js";
5
+ import "./ConnectionsPanel.js";
5
6
  import "./IntegrationsAdminRoot.js";
6
7
  import "./pages/AddConnectionWizard.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-integrations",
3
- "version": "2026.923.1",
3
+ "version": "2026.929.1",
4
4
  "description": "Burdenoff Integrations Microfrontend - Plugin-based provider and connection management interface",
5
5
  "type": "module",
6
6
  "files": [