@burdenoff/microfe-integrations 2026.1117.3 → 2026.1118.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/generated/global-types.d.ts +398 -121
- package/dist/generated/wspace-operations.d.ts +727 -0
- package/dist/generated/wspace-operations.js +453 -174
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +3838 -130
- package/dist/generated/wspace-types.js +28 -10
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/integrations/ConnectSourceDialog.js +30 -21
- package/dist/integrations/ConnectSourceDialog.js.map +1 -1
- package/dist/integrations/IntegrationsUserRoutes.js +32 -27
- package/dist/integrations/IntegrationsUserRoutes.js.map +1 -1
- package/dist/integrations/connected-apps/components/ActivitySections.d.ts +31 -0
- package/dist/integrations/connected-apps/components/ActivitySections.js +147 -0
- package/dist/integrations/connected-apps/components/ActivitySections.js.map +1 -0
- package/dist/integrations/connected-apps/components/AppItems.d.ts +26 -0
- package/dist/integrations/connected-apps/components/AppItems.js +171 -0
- package/dist/integrations/connected-apps/components/AppItems.js.map +1 -0
- package/dist/integrations/connected-apps/components/AppPanels.d.ts +48 -0
- package/dist/integrations/connected-apps/components/AppPanels.js +244 -0
- package/dist/integrations/connected-apps/components/AppPanels.js.map +1 -0
- package/dist/integrations/connected-apps/components/AppsSections.d.ts +30 -0
- package/dist/integrations/connected-apps/components/AppsSections.js +133 -0
- package/dist/integrations/connected-apps/components/AppsSections.js.map +1 -0
- package/dist/integrations/connected-apps/components/ConnectionActionDialogs.d.ts +30 -0
- package/dist/integrations/connected-apps/components/ConnectionActionDialogs.js +200 -0
- package/dist/integrations/connected-apps/components/ConnectionActionDialogs.js.map +1 -0
- package/dist/integrations/connected-apps/components/ConnectionActions.d.ts +38 -0
- package/dist/integrations/connected-apps/components/ConnectionActions.js +162 -0
- package/dist/integrations/connected-apps/components/ConnectionActions.js.map +1 -0
- package/dist/integrations/connected-apps/components/ConnectionHealth.d.ts +19 -0
- package/dist/integrations/connected-apps/components/ConnectionHealth.js +136 -0
- package/dist/integrations/connected-apps/components/ConnectionHealth.js.map +1 -0
- package/dist/integrations/connected-apps/components/ConnectionItems.d.ts +38 -0
- package/dist/integrations/connected-apps/components/ConnectionItems.js +358 -0
- package/dist/integrations/connected-apps/components/ConnectionItems.js.map +1 -0
- package/dist/integrations/connected-apps/components/ConnectionPanels.d.ts +37 -0
- package/dist/integrations/connected-apps/components/ConnectionPanels.js +248 -0
- package/dist/integrations/connected-apps/components/ConnectionPanels.js.map +1 -0
- package/dist/integrations/connected-apps/components/ConnectionsSections.d.ts +44 -0
- package/dist/integrations/connected-apps/components/ConnectionsSections.js +222 -0
- package/dist/integrations/connected-apps/components/ConnectionsSections.js.map +1 -0
- package/dist/integrations/connected-apps/components/Explainer.d.ts +3 -0
- package/dist/integrations/connected-apps/components/Explainer.js +56 -0
- package/dist/integrations/connected-apps/components/Explainer.js.map +1 -0
- package/dist/integrations/connected-apps/components/ListOrigin.d.ts +21 -0
- package/dist/integrations/connected-apps/components/ListOrigin.js +35 -0
- package/dist/integrations/connected-apps/components/ListOrigin.js.map +1 -0
- package/dist/integrations/connected-apps/components/Notices.d.ts +9 -0
- package/dist/integrations/connected-apps/components/Notices.js +71 -0
- package/dist/integrations/connected-apps/components/Notices.js.map +1 -0
- package/dist/integrations/connected-apps/components/PageFrame.d.ts +27 -0
- package/dist/integrations/connected-apps/components/PageFrame.js +55 -0
- package/dist/integrations/connected-apps/components/PageFrame.js.map +1 -0
- package/dist/integrations/connected-apps/components/Panels.d.ts +28 -0
- package/dist/integrations/connected-apps/components/Panels.js +50 -0
- package/dist/integrations/connected-apps/components/Panels.js.map +1 -0
- package/dist/integrations/connected-apps/components/Results.d.ts +50 -0
- package/dist/integrations/connected-apps/components/Results.js +129 -0
- package/dist/integrations/connected-apps/components/Results.js.map +1 -0
- package/dist/integrations/connected-apps/components/SearchPicker.d.ts +20 -0
- package/dist/integrations/connected-apps/components/SearchPicker.js +139 -0
- package/dist/integrations/connected-apps/components/SearchPicker.js.map +1 -0
- package/dist/integrations/connected-apps/components/StatusChip.d.ts +11 -0
- package/dist/integrations/connected-apps/components/StatusChip.js +40 -0
- package/dist/integrations/connected-apps/components/StatusChip.js.map +1 -0
- package/dist/integrations/connected-apps/components/Toolbar.d.ts +74 -0
- package/dist/integrations/connected-apps/components/Toolbar.js +216 -0
- package/dist/integrations/connected-apps/components/Toolbar.js.map +1 -0
- package/dist/integrations/connected-apps/components/styles.d.ts +12 -0
- package/dist/integrations/connected-apps/components/styles.js +15 -0
- package/dist/integrations/connected-apps/components/styles.js.map +1 -0
- package/dist/integrations/connected-apps/connect/AppPicker.d.ts +7 -0
- package/dist/integrations/connected-apps/connect/AppPicker.js +257 -0
- package/dist/integrations/connected-apps/connect/AppPicker.js.map +1 -0
- package/dist/integrations/connected-apps/connect/ConnectAppDialog.d.ts +18 -0
- package/dist/integrations/connected-apps/connect/ConnectAppDialog.js +224 -0
- package/dist/integrations/connected-apps/connect/ConnectAppDialog.js.map +1 -0
- package/dist/integrations/connected-apps/hooks/useCanCreateConnection.d.ts +1 -0
- package/dist/integrations/connected-apps/hooks/useCanCreateConnection.js +10 -0
- package/dist/integrations/connected-apps/hooks/useCanCreateConnection.js.map +1 -0
- package/dist/integrations/connected-apps/hooks/useConnectedAppsData.d.ts +372 -0
- package/dist/integrations/connected-apps/hooks/useConnectedAppsData.js +311 -0
- package/dist/integrations/connected-apps/hooks/useConnectedAppsData.js.map +1 -0
- package/dist/integrations/connected-apps/hooks/useListState.d.ts +21 -0
- package/dist/integrations/connected-apps/hooks/useListState.js +43 -0
- package/dist/integrations/connected-apps/hooks/useListState.js.map +1 -0
- package/dist/integrations/connected-apps/hooks/usePageChrome.d.ts +12 -0
- package/dist/integrations/connected-apps/hooks/usePageChrome.js +46 -0
- package/dist/integrations/connected-apps/hooks/usePageChrome.js.map +1 -0
- package/dist/integrations/connected-apps/model/activity.d.ts +26 -0
- package/dist/integrations/connected-apps/model/activity.js +79 -0
- package/dist/integrations/connected-apps/model/activity.js.map +1 -0
- package/dist/integrations/connected-apps/model/apps.d.ts +68 -0
- package/dist/integrations/connected-apps/model/apps.js +101 -0
- package/dist/integrations/connected-apps/model/apps.js.map +1 -0
- package/dist/integrations/connected-apps/model/connections.d.ts +58 -0
- package/dist/integrations/connected-apps/model/connections.js +55 -0
- package/dist/integrations/connected-apps/model/connections.js.map +1 -0
- package/dist/integrations/connected-apps/model/health.d.ts +30 -0
- package/dist/integrations/connected-apps/model/health.js +54 -0
- package/dist/integrations/connected-apps/model/health.js.map +1 -0
- package/dist/integrations/connected-apps/model/queries.d.ts +56 -0
- package/dist/integrations/connected-apps/model/queries.js +117 -0
- package/dist/integrations/connected-apps/model/queries.js.map +1 -0
- package/dist/integrations/connected-apps/model/status.d.ts +36 -0
- package/dist/integrations/connected-apps/model/status.js +73 -0
- package/dist/integrations/connected-apps/model/status.js.map +1 -0
- package/dist/integrations/connected-apps/model/translate.d.ts +2 -0
- package/dist/integrations/connected-apps/model/urlState.d.ts +52 -0
- package/dist/integrations/connected-apps/model/urlState.js +87 -0
- package/dist/integrations/connected-apps/model/urlState.js.map +1 -0
- package/dist/integrations/connected-apps/pages/ActivityPage.d.ts +1 -0
- package/dist/integrations/connected-apps/pages/ActivityPage.js +261 -0
- package/dist/integrations/connected-apps/pages/ActivityPage.js.map +1 -0
- package/dist/integrations/connected-apps/pages/AppDetailsPage.d.ts +1 -0
- package/dist/integrations/connected-apps/pages/AppDetailsPage.js +163 -0
- package/dist/integrations/connected-apps/pages/AppDetailsPage.js.map +1 -0
- package/dist/integrations/connected-apps/pages/AppsPage.d.ts +1 -0
- package/dist/integrations/connected-apps/pages/AppsPage.js +209 -0
- package/dist/integrations/connected-apps/pages/AppsPage.js.map +1 -0
- package/dist/integrations/connected-apps/pages/ConnectionDetailsPage.d.ts +1 -0
- package/dist/integrations/connected-apps/pages/ConnectionDetailsPage.js +240 -0
- package/dist/integrations/connected-apps/pages/ConnectionDetailsPage.js.map +1 -0
- package/dist/integrations/connected-apps/pages/ConnectionsPage.d.ts +1 -0
- package/dist/integrations/connected-apps/pages/ConnectionsPage.js +254 -0
- package/dist/integrations/connected-apps/pages/ConnectionsPage.js.map +1 -0
- package/dist/integrations/providers/IntegrationsProvider.js +22 -21
- package/dist/integrations/providers/IntegrationsProvider.js.map +1 -1
- package/dist/integrations/translations/en.d.ts +426 -0
- package/dist/integrations/types/index.d.ts +9 -0
- package/package.json +2 -2
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { AddConnectionDialog as e } from "../../components/AddConnectionDialog.js";
|
|
2
|
+
import { ConnectionModalFrame as t } from "../../components/ConnectionModalFrame.js";
|
|
3
|
+
import { INTEGRATION_PERMISSIONS as n } from "../../constants/permissions.js";
|
|
4
|
+
import { useTestConnection as r } from "../../hooks/useConnections.js";
|
|
5
|
+
import { useTr as i } from "../../hooks/useTr.js";
|
|
6
|
+
import { useIntegrations as a } from "../../providers/IntegrationsProvider.js";
|
|
7
|
+
import { joinPath as o } from "../../utils/paths.js";
|
|
8
|
+
import { useOriginState as s } from "../components/ListOrigin.js";
|
|
9
|
+
import { alwaysKeepsKey as c } from "../model/apps.js";
|
|
10
|
+
import { QUERIES_AFTER_CHANGE as l } from "../model/connections.js";
|
|
11
|
+
import { AppPicker as u } from "./AppPicker.js";
|
|
12
|
+
import { useEffect as d, useMemo as f, useState as p } from "react";
|
|
13
|
+
import { AlertTriangle as m, CheckCircle2 as h, ExternalLink as g, Loader2 as _, Vault as v, XCircle as y, Zap as b } from "lucide-react";
|
|
14
|
+
import { Link as x } from "react-router";
|
|
15
|
+
import { useApolloClient as S } from "@apollo/client/react";
|
|
16
|
+
import { usePermissions as C } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
17
|
+
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
18
|
+
import { createConnectionsApi as D } from "@burdenoff/fe-libs/connections";
|
|
19
|
+
import { Button as O } from "@burdenoff/fe-libs/ui";
|
|
20
|
+
// src/integrations/connected-apps/connect/ConnectAppDialog.tsx
|
|
21
|
+
function k({ open: t, onClose: n, preselectedProviderId: r, preselectedProviderKey: i, onConnectionCreated: a, presentation: o = "dialog", pickerTitle: s, extraConfig: c }) {
|
|
22
|
+
let d = S(), [f, m] = p(r ?? null);
|
|
23
|
+
if (!t) return null;
|
|
24
|
+
let h = f ? null : i ?? null;
|
|
25
|
+
return !f && !h ? /* @__PURE__ */ T(u, {
|
|
26
|
+
onClose: n,
|
|
27
|
+
onPick: m,
|
|
28
|
+
presentation: o,
|
|
29
|
+
title: s
|
|
30
|
+
}) : /* @__PURE__ */ T(M, {
|
|
31
|
+
providerId: f,
|
|
32
|
+
providerKey: h,
|
|
33
|
+
presentation: o,
|
|
34
|
+
onClose: n,
|
|
35
|
+
children: /* @__PURE__ */ T(e, {
|
|
36
|
+
open: !0,
|
|
37
|
+
onClose: n,
|
|
38
|
+
preselectedProviderId: f,
|
|
39
|
+
preselectedProviderKey: h,
|
|
40
|
+
presentation: o,
|
|
41
|
+
extraConfig: c,
|
|
42
|
+
onConnectionCreated: (e) => {
|
|
43
|
+
d.refetchQueries({ include: l }), a?.(e);
|
|
44
|
+
},
|
|
45
|
+
renderSuccessAction: (e) => /* @__PURE__ */ T(N, {
|
|
46
|
+
created: e,
|
|
47
|
+
onClose: n
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function A(e, t) {
|
|
53
|
+
let r = S(), { hasPermission: i, isLoading: a } = C(), o = !a && i(n.VAULT_CREATE), s = f(() => D(r), [r]), l = `${e ?? ""}|${t ?? ""}`, [u, m] = p(null);
|
|
54
|
+
return d(() => {
|
|
55
|
+
if (a || o) return;
|
|
56
|
+
let n = !1;
|
|
57
|
+
return Promise.all([s.listVaults(), s.getProvider({
|
|
58
|
+
id: e ?? void 0,
|
|
59
|
+
key: t ?? void 0
|
|
60
|
+
})]).then(([e, t]) => {
|
|
61
|
+
if (n) return;
|
|
62
|
+
let r = !t || c(t);
|
|
63
|
+
m({
|
|
64
|
+
target: l,
|
|
65
|
+
readiness: e.length === 0 && r ? "blocked" : "ready"
|
|
66
|
+
});
|
|
67
|
+
}).catch(() => {
|
|
68
|
+
n || m({
|
|
69
|
+
target: l,
|
|
70
|
+
readiness: "ready"
|
|
71
|
+
});
|
|
72
|
+
}), () => {
|
|
73
|
+
n = !0;
|
|
74
|
+
};
|
|
75
|
+
}, [
|
|
76
|
+
s,
|
|
77
|
+
e,
|
|
78
|
+
t,
|
|
79
|
+
l,
|
|
80
|
+
o,
|
|
81
|
+
a
|
|
82
|
+
]), a ? "checking" : o ? "ready" : u?.target === l ? u.readiness : "checking";
|
|
83
|
+
}
|
|
84
|
+
var j = "connected-apps-no-vault-title";
|
|
85
|
+
function M({ providerId: e, providerKey: n, presentation: r, onClose: a, children: o }) {
|
|
86
|
+
let s = i(), c = A(e, n);
|
|
87
|
+
return c === "ready" ? /* @__PURE__ */ T(w, { children: o }) : c === "checking" ? /* @__PURE__ */ E(t, {
|
|
88
|
+
onClose: a,
|
|
89
|
+
labelledBy: j,
|
|
90
|
+
presentation: r,
|
|
91
|
+
size: "notice",
|
|
92
|
+
testId: "connected-apps-vault-check",
|
|
93
|
+
children: [/* @__PURE__ */ T(_, {
|
|
94
|
+
className: "size-8 text-text-secondary motion-safe:animate-spin",
|
|
95
|
+
"aria-hidden": "true"
|
|
96
|
+
}), /* @__PURE__ */ T("h2", {
|
|
97
|
+
id: j,
|
|
98
|
+
className: "text-sm text-text-secondary",
|
|
99
|
+
children: s("integrations.connectedApps.vault.checking", "Getting the form ready…")
|
|
100
|
+
})]
|
|
101
|
+
}) : /* @__PURE__ */ E(t, {
|
|
102
|
+
onClose: a,
|
|
103
|
+
labelledBy: j,
|
|
104
|
+
presentation: r,
|
|
105
|
+
size: "notice",
|
|
106
|
+
testId: "connected-apps-no-vault",
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ T("span", {
|
|
109
|
+
className: "flex size-12 items-center justify-center rounded-[14px] border border-status-warning-border bg-status-warning-bg-subtle",
|
|
110
|
+
children: /* @__PURE__ */ T(v, {
|
|
111
|
+
className: "size-5 text-status-warning-text",
|
|
112
|
+
"aria-hidden": "true"
|
|
113
|
+
})
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ T("h2", {
|
|
116
|
+
id: j,
|
|
117
|
+
className: "text-lg font-semibold text-text-primary",
|
|
118
|
+
children: s("integrations.connectedApps.vault.title", "No vault to keep the key in")
|
|
119
|
+
}),
|
|
120
|
+
/* @__PURE__ */ T("p", {
|
|
121
|
+
className: "text-sm text-text-secondary",
|
|
122
|
+
children: s("integrations.connectedApps.vault.text", "Connections keep their keys in a vault, and this workspace has none you can use. Ask a workspace admin to create one, then connect the app again.")
|
|
123
|
+
}),
|
|
124
|
+
/* @__PURE__ */ T(O, {
|
|
125
|
+
variant: "outline",
|
|
126
|
+
onClick: a,
|
|
127
|
+
children: s("integrations.connectedApps.actions.close", "Close")
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function N({ created: e, onClose: t }) {
|
|
133
|
+
let n = i(), c = s(), { basePath: l } = a(), { testConnection: u } = r(), [d, f] = p({ kind: "idle" }), v = async () => {
|
|
134
|
+
f({ kind: "running" });
|
|
135
|
+
try {
|
|
136
|
+
let t = await u(e.id);
|
|
137
|
+
if (!t) throw Error(n("integrations.connectedApps.testing.noAnswer", "The test did not answer."));
|
|
138
|
+
f(t.success ? {
|
|
139
|
+
kind: "passed",
|
|
140
|
+
latencyMs: typeof t.latencyMs == "number" ? t.latencyMs : null
|
|
141
|
+
} : {
|
|
142
|
+
kind: "failed",
|
|
143
|
+
message: t.message
|
|
144
|
+
});
|
|
145
|
+
} catch (e) {
|
|
146
|
+
f({
|
|
147
|
+
kind: "failed",
|
|
148
|
+
message: e instanceof Error ? e.message : String(e)
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
return /* @__PURE__ */ E("div", {
|
|
153
|
+
className: "flex w-full max-w-md flex-col items-center gap-3",
|
|
154
|
+
"data-testid": "connected-apps-success-actions",
|
|
155
|
+
children: [
|
|
156
|
+
d.kind === "passed" && /* @__PURE__ */ E("p", {
|
|
157
|
+
role: "status",
|
|
158
|
+
className: "flex items-center gap-2 rounded-lg border border-status-success-border bg-status-success-bg-subtle px-3 py-2 text-sm font-medium text-status-success-text",
|
|
159
|
+
children: [/* @__PURE__ */ T(h, {
|
|
160
|
+
className: "size-4",
|
|
161
|
+
"aria-hidden": "true"
|
|
162
|
+
}), d.latencyMs === null ? n("integrations.connectedApps.testing.passed", "Test passed") : n("integrations.connectedApps.testing.passedIn", "Test passed in {{ms}} ms", { ms: d.latencyMs })]
|
|
163
|
+
}),
|
|
164
|
+
d.kind === "failed" && /* @__PURE__ */ E("div", {
|
|
165
|
+
role: "alert",
|
|
166
|
+
className: "flex w-full items-start gap-2 rounded-lg border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-start text-sm text-status-error-text",
|
|
167
|
+
children: [/* @__PURE__ */ T(y, {
|
|
168
|
+
className: "mt-0.5 size-4 shrink-0",
|
|
169
|
+
"aria-hidden": "true"
|
|
170
|
+
}), /* @__PURE__ */ E("span", { children: [/* @__PURE__ */ T("span", {
|
|
171
|
+
className: "block font-semibold",
|
|
172
|
+
children: n("integrations.connectedApps.testing.failed", "Test failed")
|
|
173
|
+
}), /* @__PURE__ */ T("span", {
|
|
174
|
+
className: "break-words",
|
|
175
|
+
children: d.message
|
|
176
|
+
})] })]
|
|
177
|
+
}),
|
|
178
|
+
/* @__PURE__ */ E("div", {
|
|
179
|
+
className: "flex flex-wrap justify-center gap-2",
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ E(O, {
|
|
182
|
+
variant: "outline",
|
|
183
|
+
onClick: () => void v(),
|
|
184
|
+
disabled: d.kind === "running",
|
|
185
|
+
children: [d.kind === "running" ? /* @__PURE__ */ T(_, {
|
|
186
|
+
className: "size-4 motion-safe:animate-spin",
|
|
187
|
+
"aria-hidden": "true"
|
|
188
|
+
}) : /* @__PURE__ */ T(b, {
|
|
189
|
+
className: "size-4",
|
|
190
|
+
"aria-hidden": "true"
|
|
191
|
+
}), n("integrations.connectedApps.testing.run", "Test connection")]
|
|
192
|
+
}),
|
|
193
|
+
l && /* @__PURE__ */ T(O, {
|
|
194
|
+
variant: "outline",
|
|
195
|
+
asChild: !0,
|
|
196
|
+
children: /* @__PURE__ */ E(x, {
|
|
197
|
+
to: o(l, `connections/${e.id}`),
|
|
198
|
+
state: c,
|
|
199
|
+
onClick: t,
|
|
200
|
+
children: [/* @__PURE__ */ T(g, {
|
|
201
|
+
className: "size-4",
|
|
202
|
+
"aria-hidden": "true"
|
|
203
|
+
}), n("integrations.connectedApps.success.open", "Open connection")]
|
|
204
|
+
})
|
|
205
|
+
}),
|
|
206
|
+
/* @__PURE__ */ T(O, {
|
|
207
|
+
onClick: t,
|
|
208
|
+
children: n("integrations.connectedApps.actions.done", "Done")
|
|
209
|
+
})
|
|
210
|
+
]
|
|
211
|
+
}),
|
|
212
|
+
d.kind === "failed" && /* @__PURE__ */ E("p", {
|
|
213
|
+
className: "flex items-center gap-1.5 text-xs text-text-secondary",
|
|
214
|
+
children: [/* @__PURE__ */ T(m, {
|
|
215
|
+
className: "size-3.5 text-status-warning-text",
|
|
216
|
+
"aria-hidden": "true"
|
|
217
|
+
}), n("integrations.connectedApps.testing.failedHint", "The connection is saved. Fix the account or key on its page, then test again.")]
|
|
218
|
+
})
|
|
219
|
+
]
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
export { k as ConnectAppDialog };
|
|
223
|
+
|
|
224
|
+
//# sourceMappingURL=ConnectAppDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectAppDialog.js","names":["_Fragment","Link","Link$1","ConnectAppDialog","client","useApolloClient","picked","setPicked","useState","preselectedProviderId","open","providerKey","preselectedProviderKey","AppPicker","pickerTitle","VaultGate","AddConnectionDialog","QUERIES_AFTER_CHANGE","onConnectionCreated","connectionId","ConnectedActions","useVaultReadiness","permissionsLoading","usePermissions","canCreateVault","hasPermission","INTEGRATION_PERMISSIONS","api","useMemo","createConnectionsApi","target","providerId","checked","setChecked","useEffect","cancelled","vaults","provider","keepsKey","alwaysKeepsKey","NO_VAULT_TITLE_ID","tr","useTr","readiness","Fragment","ConnectionModalFrame","Loader2","Vault","Button","onClose","originState","useOriginState","useIntegrations","useTestConnection","test","setTest","runTest","result","testConnection","created","error","CheckCircle2","XCircle","Zap","basePath","joinPath","ExternalLink","AlertTriangle"],"sources":["../../../../src/integrations/connected-apps/connect/ConnectAppDialog.tsx"],"sourcesContent":["/**\n * \"Connect an app\" for the redesigned Connected apps (BOFF-15373).\n *\n * Three parts, in order:\n * 1. The app picker (AppPicker.tsx): searched on the server and paged by 20\n * with the Templates pager, Popular apps and categories first.\n * 2. An honest check before the form: connections keep their keys in a vault.\n * In a workspace with no vault, a person who cannot create one is told so\n * instead of being handed a form whose button can only fail.\n * 3. The shared one-screen form (`@burdenoff/fe-libs/connections`, through\n * `AddConnectionDialog`), unchanged: sign-in or key, permissions, name,\n * who can use it, where the key is kept. Its success panel gets \"Test\n * connection\" (the service tests a saved connection) and \"Open connection\".\n *\n * Reconnect is not here: it signs in again on an existing record through\n * `AddConnectionDialog` directly (see ConnectionActions).\n */\nimport { useEffect, useMemo, useState, type ReactNode } from 'react';\nimport { Link } from 'react-router';\nimport { useApolloClient } from '@apollo/client/react';\nimport {\n AlertTriangle,\n CheckCircle2,\n ExternalLink,\n Loader2,\n Vault,\n XCircle,\n Zap,\n} from 'lucide-react';\nimport {\n createConnectionsApi,\n type ConnectionDialogPresentation,\n type CreatedConnection,\n} from '@burdenoff/fe-libs/connections';\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { Button } from '@burdenoff/fe-libs/ui';\n\nimport { AddConnectionDialog } from '../../components/AddConnectionDialog';\nimport { ConnectionModalFrame } from '../../components/ConnectionModalFrame';\nimport { INTEGRATION_PERMISSIONS } from '../../constants/permissions';\nimport { useTestConnection } from '../../hooks/useConnections';\nimport { useTr } from '../../hooks/useTr';\nimport { useIntegrations } from '../../providers/IntegrationsProvider';\nimport { joinPath } from '../../utils/paths';\nimport { useOriginState } from '../components/ListOrigin';\nimport { alwaysKeepsKey } from '../model/apps';\nimport { QUERIES_AFTER_CHANGE } from '../model/connections';\nimport { AppPicker } from './AppPicker';\n\nexport interface ConnectAppDialogProps {\n open: boolean;\n onClose: () => void;\n /** Open on this app instead of the picker. */\n preselectedProviderId?: string | null;\n /** Open on this app, by key (a deep link or a workflow node knows the key). */\n preselectedProviderKey?: string | null;\n /** Called with the new connection's id once it is created and authenticated. */\n onConnectionCreated?: (connectionId: string) => void;\n /** `sheet`: a bottom sheet on phones, as the assistant's \"Connect a source\". */\n presentation?: ConnectionDialogPresentation;\n /** The picker's heading; \"Connect an app\" by default. */\n pickerTitle?: string;\n /** Settings stored on the new connection. */\n extraConfig?: Record<string, unknown>;\n}\n\nexport function ConnectAppDialog({\n open,\n onClose,\n preselectedProviderId,\n preselectedProviderKey,\n onConnectionCreated,\n presentation = 'dialog',\n pickerTitle,\n extraConfig,\n}: ConnectAppDialogProps) {\n const client = useApolloClient();\n const [picked, setPicked] = useState<string | null>(preselectedProviderId ?? null);\n if (!open) return null;\n const providerKey = picked ? null : (preselectedProviderKey ?? null);\n if (!picked && !providerKey) {\n return (\n <AppPicker\n onClose={onClose}\n onPick={setPicked}\n presentation={presentation}\n title={pickerTitle}\n />\n );\n }\n return (\n <VaultGate\n providerId={picked}\n providerKey={providerKey}\n presentation={presentation}\n onClose={onClose}\n >\n <AddConnectionDialog\n open\n onClose={onClose}\n preselectedProviderId={picked}\n preselectedProviderKey={providerKey}\n presentation={presentation}\n extraConfig={extraConfig}\n onConnectionCreated={(connectionId) => {\n // The shared dialog refetches today's list query; these pages read their own.\n void client.refetchQueries({ include: QUERIES_AFTER_CHANGE });\n onConnectionCreated?.(connectionId);\n }}\n renderSuccessAction={(created) => <ConnectedActions created={created} onClose={onClose} />}\n />\n </VaultGate>\n );\n}\n\n// ─── 2. The vault check ─────────────────────────────────────────────────────\n\ntype VaultReadiness = 'checking' | 'ready' | 'blocked';\n\n/**\n * Whether the form can work: a key needs a vault, and this person either has\n * one to use or may create one. Apps whose access is minted for the workspace\n * (no key to keep) never need one. A failed check lets the form decide.\n */\nfunction useVaultReadiness(providerId: string | null, providerKey: string | null): VaultReadiness {\n const client = useApolloClient();\n const { hasPermission, isLoading: permissionsLoading } = usePermissions();\n const canCreateVault = !permissionsLoading && hasPermission(INTEGRATION_PERMISSIONS.VAULT_CREATE);\n const api = useMemo(() => createConnectionsApi(client), [client]);\n const target = `${providerId ?? ''}|${providerKey ?? ''}`;\n // The answer for one app; a different app is checked again.\n const [checked, setChecked] = useState<{ target: string; readiness: VaultReadiness } | null>(\n null\n );\n\n useEffect(() => {\n if (permissionsLoading || canCreateVault) return;\n let cancelled = false;\n Promise.all([\n api.listVaults(),\n api.getProvider({ id: providerId ?? undefined, key: providerKey ?? undefined }),\n ])\n .then(([vaults, provider]) => {\n if (cancelled) return;\n // Blocked only when no way to connect this app can work without a vault:\n // the person may pick any of its methods in the form.\n const keepsKey = provider ? alwaysKeepsKey(provider) : true;\n setChecked({ target, readiness: vaults.length === 0 && keepsKey ? 'blocked' : 'ready' });\n })\n .catch(() => {\n if (!cancelled) setChecked({ target, readiness: 'ready' });\n });\n return () => {\n cancelled = true;\n };\n }, [api, providerId, providerKey, target, canCreateVault, permissionsLoading]);\n\n if (permissionsLoading) return 'checking';\n if (canCreateVault) return 'ready';\n return checked?.target === target ? checked.readiness : 'checking';\n}\n\nconst NO_VAULT_TITLE_ID = 'connected-apps-no-vault-title';\n\nfunction VaultGate({\n providerId,\n providerKey,\n presentation,\n onClose,\n children,\n}: {\n providerId: string | null;\n providerKey: string | null;\n presentation: ConnectionDialogPresentation;\n onClose: () => void;\n children: ReactNode;\n}) {\n const tr = useTr();\n const readiness = useVaultReadiness(providerId, providerKey);\n if (readiness === 'ready') return <>{children}</>;\n if (readiness === 'checking') {\n return (\n <ConnectionModalFrame\n onClose={onClose}\n labelledBy={NO_VAULT_TITLE_ID}\n presentation={presentation}\n size=\"notice\"\n testId=\"connected-apps-vault-check\"\n >\n <Loader2\n className=\"size-8 text-text-secondary motion-safe:animate-spin\"\n aria-hidden=\"true\"\n />\n <h2 id={NO_VAULT_TITLE_ID} className=\"text-sm text-text-secondary\">\n {tr('integrations.connectedApps.vault.checking', 'Getting the form ready…')}\n </h2>\n </ConnectionModalFrame>\n );\n }\n return (\n <ConnectionModalFrame\n onClose={onClose}\n labelledBy={NO_VAULT_TITLE_ID}\n presentation={presentation}\n size=\"notice\"\n testId=\"connected-apps-no-vault\"\n >\n <span className=\"flex size-12 items-center justify-center rounded-[14px] border border-status-warning-border bg-status-warning-bg-subtle\">\n <Vault className=\"size-5 text-status-warning-text\" aria-hidden=\"true\" />\n </span>\n <h2 id={NO_VAULT_TITLE_ID} className=\"text-lg font-semibold text-text-primary\">\n {tr('integrations.connectedApps.vault.title', 'No vault to keep the key in')}\n </h2>\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'integrations.connectedApps.vault.text',\n 'Connections keep their keys in a vault, and this workspace has none you can use. Ask a workspace admin to create one, then connect the app again.'\n )}\n </p>\n <Button variant=\"outline\" onClick={onClose}>\n {tr('integrations.connectedApps.actions.close', 'Close')}\n </Button>\n </ConnectionModalFrame>\n );\n}\n\n// ─── 3. After it connects ───────────────────────────────────────────────────\n\ntype TestState =\n | { kind: 'idle' }\n | { kind: 'running' }\n | { kind: 'passed'; latencyMs: number | null }\n | { kind: 'failed'; message: string };\n\n/** The success panel's actions: test the new connection, open it, or finish. */\nfunction ConnectedActions({\n created,\n onClose,\n}: {\n created: CreatedConnection;\n onClose: () => void;\n}) {\n const tr = useTr();\n const originState = useOriginState();\n const { basePath } = useIntegrations();\n const { testConnection } = useTestConnection();\n const [test, setTest] = useState<TestState>({ kind: 'idle' });\n\n const runTest = async () => {\n setTest({ kind: 'running' });\n try {\n const result = await testConnection(created.id);\n if (!result)\n throw new Error(\n tr('integrations.connectedApps.testing.noAnswer', 'The test did not answer.')\n );\n setTest(\n result.success\n ? {\n kind: 'passed',\n latencyMs: typeof result.latencyMs === 'number' ? result.latencyMs : null,\n }\n : { kind: 'failed', message: result.message }\n );\n } catch (error) {\n setTest({ kind: 'failed', message: error instanceof Error ? error.message : String(error) });\n }\n };\n\n return (\n <div\n className=\"flex w-full max-w-md flex-col items-center gap-3\"\n data-testid=\"connected-apps-success-actions\"\n >\n {test.kind === 'passed' && (\n <p\n role=\"status\"\n className=\"flex items-center gap-2 rounded-lg border border-status-success-border bg-status-success-bg-subtle px-3 py-2 text-sm font-medium text-status-success-text\"\n >\n <CheckCircle2 className=\"size-4\" aria-hidden=\"true\" />\n {test.latencyMs !== null\n ? tr('integrations.connectedApps.testing.passedIn', 'Test passed in {{ms}} ms', {\n ms: test.latencyMs,\n })\n : tr('integrations.connectedApps.testing.passed', 'Test passed')}\n </p>\n )}\n {test.kind === 'failed' && (\n <div\n role=\"alert\"\n className=\"flex w-full items-start gap-2 rounded-lg border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-start text-sm text-status-error-text\"\n >\n <XCircle className=\"mt-0.5 size-4 shrink-0\" aria-hidden=\"true\" />\n <span>\n <span className=\"block font-semibold\">\n {tr('integrations.connectedApps.testing.failed', 'Test failed')}\n </span>\n <span className=\"break-words\">{test.message}</span>\n </span>\n </div>\n )}\n <div className=\"flex flex-wrap justify-center gap-2\">\n <Button variant=\"outline\" onClick={() => void runTest()} disabled={test.kind === 'running'}>\n {test.kind === 'running' ? (\n <Loader2 className=\"size-4 motion-safe:animate-spin\" aria-hidden=\"true\" />\n ) : (\n <Zap className=\"size-4\" aria-hidden=\"true\" />\n )}\n {tr('integrations.connectedApps.testing.run', 'Test connection')}\n </Button>\n {basePath && (\n <Button variant=\"outline\" asChild>\n <Link\n to={joinPath(basePath, `connections/${created.id}`)}\n state={originState}\n onClick={onClose}\n >\n <ExternalLink className=\"size-4\" aria-hidden=\"true\" />\n {tr('integrations.connectedApps.success.open', 'Open connection')}\n </Link>\n </Button>\n )}\n <Button onClick={onClose}>{tr('integrations.connectedApps.actions.done', 'Done')}</Button>\n </div>\n {test.kind === 'failed' && (\n <p className=\"flex items-center gap-1.5 text-xs text-text-secondary\">\n <AlertTriangle className=\"size-3.5 text-status-warning-text\" aria-hidden=\"true\" />\n {tr(\n 'integrations.connectedApps.testing.failedHint',\n 'The connection is saved. Fix the account or key on its page, then test again.'\n )}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkEA,SAAgBG,EAAiB,EAC/B,SACA,YACA,0BACA,2BACA,wBACA,kBAAe,UACf,gBACA,kBACwB;CACxB,IAAMC,IAASC,EAAgB,GACzB,CAACC,GAAQC,KAAaC,EAAwBC,KAAyB,IAAI;CACjF,IAAI,CAACC,GAAM,OAAO;CAClB,IAAMC,IAAcL,IAAS,OAAQM,KAA0B;CAW/D,OAVI,CAACN,KAAU,CAACK,IAEZ,kBAACE,GAAD;EACW;EACT,QAAQN;EACM;EACd,OAAOO;CACR,CAAA,IAIH,kBAACC,GAAD;EACE,YAAYT;EACC;EACC;EACL;EAET,UAAA,kBAACU,GAAD;GACE,MAAA;GACS;GACT,uBAAuBV;GACvB,wBAAwBK;GACV;GACD;GACb,sBAAsB,MAAiB;IAGrC,AADAP,EAAY,eAAe,EAAE,SAASa,EAAqB,CAAC,GAC5DC,IAAsBC,CAAY;GACpC;GACA,sBAAsB,MAAY,kBAACC,GAAD;IAA2B;IAAkB;GAAU,CAAA;EAC1F,CAAA;CACQ,CAAA;AAEf;AAWA,SAASC,EAAkB,GAA2B,GAA4C;CAChG,IAAMjB,IAASC,EAAgB,GACzB,EAAE,kBAAe,WAAWiB,MAAuBC,EAAe,GAClEC,IAAiB,CAACF,KAAsB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AAD;IAAG,WAAU;IAAb,UAAA,CACE,kBAACa,GAAD;KAAe,WAAU;KAAoC,eAAY;IAAQ,CAAA,GAChF1B,EACC,iDACA,+EACF,CACC;;EAEF;;AAET"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useCanCreateConnection(): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { INTEGRATION_PERMISSIONS as e } from "../../constants/permissions.js";
|
|
2
|
+
import { usePermissions as t } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
3
|
+
// src/integrations/connected-apps/hooks/useCanCreateConnection.ts
|
|
4
|
+
function n() {
|
|
5
|
+
let { hasPermission: n, isLoading: r } = t();
|
|
6
|
+
return !r && n(e.CONNECTION_CREATE);
|
|
7
|
+
}
|
|
8
|
+
export { n as useCanCreateConnection };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=useCanCreateConnection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCanCreateConnection.js","names":["useCanCreateConnection","usePermissions","isLoading","hasPermission","INTEGRATION_PERMISSIONS"],"sources":["../../../../src/integrations/connected-apps/hooks/useCanCreateConnection.ts"],"sourcesContent":["/**\n * Whether the person's role may create connections (BOFF-15373). False while\n * permissions load, so no Connect button flashes up and then disappears.\n */\nimport { usePermissions } from '@burdenoff/fe-libs/shared/providers/shell';\n\nimport { INTEGRATION_PERMISSIONS } from '../../constants/permissions';\n\nexport function useCanCreateConnection(): boolean {\n const { hasPermission, isLoading } = usePermissions();\n return !isLoading && hasPermission(INTEGRATION_PERMISSIONS.CONNECTION_CREATE);\n}\n"],"mappings":";;;AAQA,SAAgBA,IAAkC;CAChD,IAAM,EAAE,kBAAe,iBAAcC,EAAe;CACpD,OAAO,CAACC,KAAaC,EAAcC,EAAwB,iBAAiB;AAC9E"}
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { ErrorLike } from '@apollo/client';
|
|
2
|
+
import { CategoryFacet } from '@burdenoff/fe-libs/ui';
|
|
3
|
+
import { ConnectedAppProviderFieldsFragment, GetAppCategoryCountsQuery, GetAppConnectionsQuery, GetAppDetailsQuery, GetConnectedAppDetailsQuery, GetConnectedAppsStatusCountsQuery } from '../../../generated/wspace-operations';
|
|
4
|
+
import { PluginStatus, ProviderCategory } from '../../../generated/wspace-types';
|
|
5
|
+
import { ConnectionCountScope } from '../model/queries';
|
|
6
|
+
import { ActivityUrlState, AppsUrlState, ConnectionsUrlState } from '../model/urlState';
|
|
7
|
+
/** What every paged list hands its page. */
|
|
8
|
+
export interface PagedResult<T> {
|
|
9
|
+
items: T[];
|
|
10
|
+
total: number;
|
|
11
|
+
/** The server has answered at least once (this page or the one before). */
|
|
12
|
+
hasData: boolean;
|
|
13
|
+
/** This page is loading and `items` still holds the previous one. */
|
|
14
|
+
pageLoading: boolean;
|
|
15
|
+
/** The current page's own answer is in (for clamping a page past the end). */
|
|
16
|
+
settled: boolean;
|
|
17
|
+
loading: boolean;
|
|
18
|
+
error: ErrorLike | undefined;
|
|
19
|
+
refetch: () => void;
|
|
20
|
+
}
|
|
21
|
+
export declare function useConnectionsPage(state: ConnectionsUrlState): PagedResult<{
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
description: string | null;
|
|
25
|
+
status: import('../../../generated/wspace-types').ConnectionStatus;
|
|
26
|
+
errorMessage: string | null;
|
|
27
|
+
lastUsedAt: string | null;
|
|
28
|
+
lastHealthCheck: string | null;
|
|
29
|
+
externalAccountEmail: string | null;
|
|
30
|
+
externalAccountName: string | null;
|
|
31
|
+
authMethodKey: string | null;
|
|
32
|
+
visibility: import('../../../generated/wspace-types').ConnectionVisibility;
|
|
33
|
+
myAccess: import('../../../generated/wspace-types').ConnectionAccess | null;
|
|
34
|
+
ownerId: string;
|
|
35
|
+
vaultId: string | null;
|
|
36
|
+
credentialSecretId: string | null;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
updatedAt: string;
|
|
39
|
+
authMethod: {
|
|
40
|
+
id: string;
|
|
41
|
+
key: string;
|
|
42
|
+
authType: import('../../../generated/wspace-types').AuthType;
|
|
43
|
+
} | null;
|
|
44
|
+
provider: {
|
|
45
|
+
id: string;
|
|
46
|
+
key: string;
|
|
47
|
+
name: string;
|
|
48
|
+
category: ProviderCategory;
|
|
49
|
+
authType: import('../../../generated/wspace-types').AuthType;
|
|
50
|
+
icon: string | null;
|
|
51
|
+
color: string | null;
|
|
52
|
+
};
|
|
53
|
+
}>;
|
|
54
|
+
/** Server totals per status group, for the chips and the attention banner. */
|
|
55
|
+
export interface StatusCounts {
|
|
56
|
+
all: number;
|
|
57
|
+
attention: number;
|
|
58
|
+
error: number;
|
|
59
|
+
expired: number;
|
|
60
|
+
working: number;
|
|
61
|
+
unfinished: number;
|
|
62
|
+
off: number;
|
|
63
|
+
disconnected: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Status totals for `scope`: the list's search, app and owner filters for the
|
|
67
|
+
* chips, `WORKSPACE_COUNT_SCOPE` for the workspace's own count line and banner.
|
|
68
|
+
*/
|
|
69
|
+
export declare function useConnectionStatusCounts(scope: ConnectionCountScope): {
|
|
70
|
+
counts: StatusCounts | null;
|
|
71
|
+
loading: boolean;
|
|
72
|
+
error: ErrorLike | undefined;
|
|
73
|
+
refetch: import('@apollo/client/react/internal').RefetchFunction<GetConnectedAppsStatusCountsQuery, {
|
|
74
|
+
all?: import('../../../generated/wspace-types').ConnectionFilterInput | null | undefined;
|
|
75
|
+
active?: import('../../../generated/wspace-types').ConnectionFilterInput | null | undefined;
|
|
76
|
+
error?: import('../../../generated/wspace-types').ConnectionFilterInput | null | undefined;
|
|
77
|
+
expired?: import('../../../generated/wspace-types').ConnectionFilterInput | null | undefined;
|
|
78
|
+
pendingAuth?: import('../../../generated/wspace-types').ConnectionFilterInput | null | undefined;
|
|
79
|
+
inactive?: import('../../../generated/wspace-types').ConnectionFilterInput | null | undefined;
|
|
80
|
+
revoked?: import('../../../generated/wspace-types').ConnectionFilterInput | null | undefined;
|
|
81
|
+
}, "all">;
|
|
82
|
+
};
|
|
83
|
+
export declare function useConnectionDetails(id: string): {
|
|
84
|
+
connection: {
|
|
85
|
+
grantedScopes: Array<string>;
|
|
86
|
+
credentialSecretName: string | null;
|
|
87
|
+
allowSelfHosted: boolean;
|
|
88
|
+
createdBy: string;
|
|
89
|
+
id: string;
|
|
90
|
+
name: string;
|
|
91
|
+
description: string | null;
|
|
92
|
+
status: import('../../../generated/wspace-types').ConnectionStatus;
|
|
93
|
+
errorMessage: string | null;
|
|
94
|
+
lastUsedAt: string | null;
|
|
95
|
+
lastHealthCheck: string | null;
|
|
96
|
+
externalAccountEmail: string | null;
|
|
97
|
+
externalAccountName: string | null;
|
|
98
|
+
authMethodKey: string | null;
|
|
99
|
+
visibility: import('../../../generated/wspace-types').ConnectionVisibility;
|
|
100
|
+
myAccess: import('../../../generated/wspace-types').ConnectionAccess | null;
|
|
101
|
+
ownerId: string;
|
|
102
|
+
vaultId: string | null;
|
|
103
|
+
credentialSecretId: string | null;
|
|
104
|
+
createdAt: string;
|
|
105
|
+
updatedAt: string;
|
|
106
|
+
shares: Array<{
|
|
107
|
+
principalType: import('../../../generated/wspace-types').ConnectionSharePrincipalType;
|
|
108
|
+
principalId: string;
|
|
109
|
+
role: import('../../../generated/wspace-types').ConnectionShareRole;
|
|
110
|
+
}>;
|
|
111
|
+
authMethod: {
|
|
112
|
+
id: string;
|
|
113
|
+
key: string;
|
|
114
|
+
displayName: string;
|
|
115
|
+
authType: import('../../../generated/wspace-types').AuthType;
|
|
116
|
+
flow: import('../../../generated/wspace-types').AuthMethodFlow;
|
|
117
|
+
} | null;
|
|
118
|
+
provider: {
|
|
119
|
+
website: string | null;
|
|
120
|
+
docsUrl: string | null;
|
|
121
|
+
availableScopes: Record<string, unknown> | null;
|
|
122
|
+
defaultScopes: Array<string>;
|
|
123
|
+
id: string;
|
|
124
|
+
key: string;
|
|
125
|
+
name: string;
|
|
126
|
+
category: ProviderCategory;
|
|
127
|
+
authType: import('../../../generated/wspace-types').AuthType;
|
|
128
|
+
icon: string | null;
|
|
129
|
+
color: string | null;
|
|
130
|
+
};
|
|
131
|
+
} | null;
|
|
132
|
+
/** The server has answered: a null connection then means it is not available. */
|
|
133
|
+
answered: boolean;
|
|
134
|
+
loading: boolean;
|
|
135
|
+
error: ErrorLike | undefined;
|
|
136
|
+
refetch: import('@apollo/client/react/internal').RefetchFunction<GetConnectedAppDetailsQuery, {
|
|
137
|
+
id: string | number;
|
|
138
|
+
}, "all">;
|
|
139
|
+
};
|
|
140
|
+
/** Display names for workspace members (the connection's owner). */
|
|
141
|
+
export declare function usePeopleNames(userIds: string[]): Map<string, string>;
|
|
142
|
+
/**
|
|
143
|
+
* Names of the connections a page of activity mentions: one request, one
|
|
144
|
+
* `getConnection` per distinct id (a page has at most 20).
|
|
145
|
+
*/
|
|
146
|
+
export declare function useConnectionNames(ids: readonly string[]): Map<string, ConnectionNameRecord>;
|
|
147
|
+
export interface ConnectionNameRecord {
|
|
148
|
+
id: string;
|
|
149
|
+
name: string;
|
|
150
|
+
provider: {
|
|
151
|
+
id: string;
|
|
152
|
+
key: string;
|
|
153
|
+
name: string;
|
|
154
|
+
category: string;
|
|
155
|
+
icon: string | null;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
export declare function useAppsPage(state: AppsUrlState): PagedResult<{
|
|
159
|
+
id: string;
|
|
160
|
+
key: string;
|
|
161
|
+
name: string;
|
|
162
|
+
description: string | null;
|
|
163
|
+
category: ProviderCategory;
|
|
164
|
+
authType: import('../../../generated/wspace-types').AuthType;
|
|
165
|
+
icon: string | null;
|
|
166
|
+
color: string | null;
|
|
167
|
+
website: string | null;
|
|
168
|
+
docsUrl: string | null;
|
|
169
|
+
pluginStatus: PluginStatus;
|
|
170
|
+
isEnabled: boolean;
|
|
171
|
+
connectionCount: number;
|
|
172
|
+
authMethods: Array<{
|
|
173
|
+
id: string;
|
|
174
|
+
key: string;
|
|
175
|
+
displayName: string;
|
|
176
|
+
authType: import('../../../generated/wspace-types').AuthType;
|
|
177
|
+
flow: import('../../../generated/wspace-types').AuthMethodFlow;
|
|
178
|
+
isConfigured: boolean;
|
|
179
|
+
isDefault: boolean;
|
|
180
|
+
isEnabled: boolean;
|
|
181
|
+
displayOrder: number;
|
|
182
|
+
}>;
|
|
183
|
+
}>;
|
|
184
|
+
/** The categories in the data, largest first, with the total they add up to. */
|
|
185
|
+
export declare function categoryFacets(data: GetAppCategoryCountsQuery | undefined): {
|
|
186
|
+
facets: CategoryFacet[];
|
|
187
|
+
total: number;
|
|
188
|
+
};
|
|
189
|
+
/** How many apps the workspace can connect (0 until known). */
|
|
190
|
+
export declare function useAppCatalogTotal(): number;
|
|
191
|
+
export declare function useAppCategoryCounts(state: AppsUrlState): {
|
|
192
|
+
loading: boolean;
|
|
193
|
+
facets: CategoryFacet[];
|
|
194
|
+
total: number;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* The popular apps this workspace offers, in fe-libs' popular order: one
|
|
198
|
+
* request for the few keys, never the whole catalog.
|
|
199
|
+
*/
|
|
200
|
+
export declare function usePopularApps(limit: number): {
|
|
201
|
+
apps: ConnectedAppProviderFieldsFragment[];
|
|
202
|
+
loading: boolean;
|
|
203
|
+
};
|
|
204
|
+
/** Apps whose name, key or description matches, for pickers: one page of 20. */
|
|
205
|
+
export declare function useAppSearch(search: string, page: number, category: ProviderCategory | null, enabled?: boolean): PagedResult<{
|
|
206
|
+
id: string;
|
|
207
|
+
key: string;
|
|
208
|
+
name: string;
|
|
209
|
+
description: string | null;
|
|
210
|
+
category: ProviderCategory;
|
|
211
|
+
authType: import('../../../generated/wspace-types').AuthType;
|
|
212
|
+
icon: string | null;
|
|
213
|
+
color: string | null;
|
|
214
|
+
website: string | null;
|
|
215
|
+
docsUrl: string | null;
|
|
216
|
+
pluginStatus: PluginStatus;
|
|
217
|
+
isEnabled: boolean;
|
|
218
|
+
connectionCount: number;
|
|
219
|
+
authMethods: Array<{
|
|
220
|
+
id: string;
|
|
221
|
+
key: string;
|
|
222
|
+
displayName: string;
|
|
223
|
+
authType: import('../../../generated/wspace-types').AuthType;
|
|
224
|
+
flow: import('../../../generated/wspace-types').AuthMethodFlow;
|
|
225
|
+
isConfigured: boolean;
|
|
226
|
+
isDefault: boolean;
|
|
227
|
+
isEnabled: boolean;
|
|
228
|
+
displayOrder: number;
|
|
229
|
+
}>;
|
|
230
|
+
}>;
|
|
231
|
+
/** Connections whose name or description matches, for the activity filter. */
|
|
232
|
+
export declare function useConnectionSearch(search: string, enabled: boolean): PagedResult<{
|
|
233
|
+
id: string;
|
|
234
|
+
name: string;
|
|
235
|
+
description: string | null;
|
|
236
|
+
status: import('../../../generated/wspace-types').ConnectionStatus;
|
|
237
|
+
errorMessage: string | null;
|
|
238
|
+
lastUsedAt: string | null;
|
|
239
|
+
lastHealthCheck: string | null;
|
|
240
|
+
externalAccountEmail: string | null;
|
|
241
|
+
externalAccountName: string | null;
|
|
242
|
+
authMethodKey: string | null;
|
|
243
|
+
visibility: import('../../../generated/wspace-types').ConnectionVisibility;
|
|
244
|
+
myAccess: import('../../../generated/wspace-types').ConnectionAccess | null;
|
|
245
|
+
ownerId: string;
|
|
246
|
+
vaultId: string | null;
|
|
247
|
+
credentialSecretId: string | null;
|
|
248
|
+
createdAt: string;
|
|
249
|
+
updatedAt: string;
|
|
250
|
+
authMethod: {
|
|
251
|
+
id: string;
|
|
252
|
+
key: string;
|
|
253
|
+
authType: import('../../../generated/wspace-types').AuthType;
|
|
254
|
+
} | null;
|
|
255
|
+
provider: {
|
|
256
|
+
id: string;
|
|
257
|
+
key: string;
|
|
258
|
+
name: string;
|
|
259
|
+
category: ProviderCategory;
|
|
260
|
+
authType: import('../../../generated/wspace-types').AuthType;
|
|
261
|
+
icon: string | null;
|
|
262
|
+
color: string | null;
|
|
263
|
+
};
|
|
264
|
+
}>;
|
|
265
|
+
export declare function useAppDetails(id: string): {
|
|
266
|
+
app: {
|
|
267
|
+
availableScopes: Record<string, unknown> | null;
|
|
268
|
+
defaultScopes: Array<string>;
|
|
269
|
+
pluginVersion: string | null;
|
|
270
|
+
pluginAuthor: string | null;
|
|
271
|
+
isBuiltIn: boolean;
|
|
272
|
+
supportedFeatures: Array<string>;
|
|
273
|
+
id: string;
|
|
274
|
+
key: string;
|
|
275
|
+
name: string;
|
|
276
|
+
description: string | null;
|
|
277
|
+
category: ProviderCategory;
|
|
278
|
+
authType: import('../../../generated/wspace-types').AuthType;
|
|
279
|
+
icon: string | null;
|
|
280
|
+
color: string | null;
|
|
281
|
+
website: string | null;
|
|
282
|
+
docsUrl: string | null;
|
|
283
|
+
pluginStatus: PluginStatus;
|
|
284
|
+
isEnabled: boolean;
|
|
285
|
+
connectionCount: number;
|
|
286
|
+
authMethods: Array<{
|
|
287
|
+
description: string | null;
|
|
288
|
+
defaultScopes: Array<string>;
|
|
289
|
+
availableScopes: Record<string, unknown> | null;
|
|
290
|
+
id: string;
|
|
291
|
+
key: string;
|
|
292
|
+
displayName: string;
|
|
293
|
+
authType: import('../../../generated/wspace-types').AuthType;
|
|
294
|
+
flow: import('../../../generated/wspace-types').AuthMethodFlow;
|
|
295
|
+
isConfigured: boolean;
|
|
296
|
+
isDefault: boolean;
|
|
297
|
+
isEnabled: boolean;
|
|
298
|
+
displayOrder: number;
|
|
299
|
+
}>;
|
|
300
|
+
} | null;
|
|
301
|
+
/** The server has answered: a null app then means it is not in the catalog. */
|
|
302
|
+
answered: boolean;
|
|
303
|
+
loading: boolean;
|
|
304
|
+
error: ErrorLike | undefined;
|
|
305
|
+
refetch: import('@apollo/client/react/internal').RefetchFunction<GetAppDetailsQuery, {
|
|
306
|
+
id: string | number;
|
|
307
|
+
}, "all">;
|
|
308
|
+
};
|
|
309
|
+
/** The first `limit` of the workspace's connections to one app, with the total. */
|
|
310
|
+
export declare function useAppConnections(providerId: string, limit: number): {
|
|
311
|
+
items: {
|
|
312
|
+
id: string;
|
|
313
|
+
name: string;
|
|
314
|
+
description: string | null;
|
|
315
|
+
status: import('../../../generated/wspace-types').ConnectionStatus;
|
|
316
|
+
errorMessage: string | null;
|
|
317
|
+
lastUsedAt: string | null;
|
|
318
|
+
lastHealthCheck: string | null;
|
|
319
|
+
externalAccountEmail: string | null;
|
|
320
|
+
externalAccountName: string | null;
|
|
321
|
+
authMethodKey: string | null;
|
|
322
|
+
visibility: import('../../../generated/wspace-types').ConnectionVisibility;
|
|
323
|
+
myAccess: import('../../../generated/wspace-types').ConnectionAccess | null;
|
|
324
|
+
ownerId: string;
|
|
325
|
+
vaultId: string | null;
|
|
326
|
+
credentialSecretId: string | null;
|
|
327
|
+
createdAt: string;
|
|
328
|
+
updatedAt: string;
|
|
329
|
+
authMethod: {
|
|
330
|
+
id: string;
|
|
331
|
+
key: string;
|
|
332
|
+
authType: import('../../../generated/wspace-types').AuthType;
|
|
333
|
+
} | null;
|
|
334
|
+
provider: {
|
|
335
|
+
id: string;
|
|
336
|
+
key: string;
|
|
337
|
+
name: string;
|
|
338
|
+
category: ProviderCategory;
|
|
339
|
+
authType: import('../../../generated/wspace-types').AuthType;
|
|
340
|
+
icon: string | null;
|
|
341
|
+
color: string | null;
|
|
342
|
+
};
|
|
343
|
+
}[];
|
|
344
|
+
total: number;
|
|
345
|
+
hasData: boolean;
|
|
346
|
+
loading: boolean;
|
|
347
|
+
error: ErrorLike | undefined;
|
|
348
|
+
refetch: import('@apollo/client/react/internal').RefetchFunction<GetAppConnectionsQuery, {
|
|
349
|
+
providerId: string | number;
|
|
350
|
+
pagination?: import('../../../generated/wspace-types').IntegrationsPaginationInput | null | undefined;
|
|
351
|
+
}, "all">;
|
|
352
|
+
};
|
|
353
|
+
export declare function useActivityPage(state: ActivityUrlState, now: number, skip: boolean): PagedResult<{
|
|
354
|
+
id: string;
|
|
355
|
+
connectionId: string | null;
|
|
356
|
+
action: import('../../../generated/wspace-types').LogAction;
|
|
357
|
+
level: import('../../../generated/wspace-types').LogLevel;
|
|
358
|
+
message: string;
|
|
359
|
+
requestUrl: string | null;
|
|
360
|
+
requestMethod: string | null;
|
|
361
|
+
responseStatus: number | null;
|
|
362
|
+
createdAt: string;
|
|
363
|
+
}>;
|
|
364
|
+
/**
|
|
365
|
+
* A host's `onConnectionSelect`, handed the same full record today's list
|
|
366
|
+
* hands it: the redesigned rows load only what they show, so the connection
|
|
367
|
+
* is read in full (from the cache when the connection page already loaded it)
|
|
368
|
+
* before the host hears of it. Null when the host passed no callback.
|
|
369
|
+
*/
|
|
370
|
+
export declare function useSelectConnection(): ((id: string) => void) | null;
|
|
371
|
+
/** The same for a host's `onProviderSelect`, with today's full app record. */
|
|
372
|
+
export declare function useSelectApp(): ((id: string) => void) | null;
|