@burdenoff/fe-libs 2026.1118.3 → 2026.1118.4
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/platform-pages/index.d.ts +4 -0
- package/dist/platform-pages/oauth/AuthorizedAppsPage.d.ts +13 -0
- package/dist/platform-pages/oauth/AuthorizedAppsPage.js +154 -0
- package/dist/platform-pages/oauth/ConnectAuthorizePage.d.ts +23 -0
- package/dist/platform-pages/oauth/ConnectAuthorizePage.js +196 -0
- package/dist/platform-pages/oauth/operations.d.ts +49 -0
- package/dist/platform-pages/oauth/operations.js +55 -0
- package/dist/platform-pages.js +3 -1
- package/dist/shared/config/shellRoutes.js +7 -0
- package/package.json +1 -1
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* | `AppearanceSettingsPage` | `/settings/appearance` | protected, no gateway |
|
|
11
11
|
* | `AffiliatesPage` | `/affiliates` | protected (global gateway URL) |
|
|
12
12
|
* | `AcceptShareRoute` | `/share/accept/:token` | protected (workspace gateway) |
|
|
13
|
+
* | `ConnectAuthorizePage` | `/connect/authorize` | protected, shell-less (global) |
|
|
14
|
+
* | `AuthorizedAppsPage` | `/settings/authorized-apps` | protected (global gateway) |
|
|
13
15
|
*
|
|
14
16
|
* `AdminOverviewPage` (`/admin/overview`) lives in
|
|
15
17
|
* `@burdenoff/fe-libs/admin-overview` because it needs the optional
|
|
@@ -18,3 +20,5 @@
|
|
|
18
20
|
export { AppearanceSettingsPage } from './AppearanceSettingsPage';
|
|
19
21
|
export { AffiliatesPage, type AffiliatesPageProps } from './AffiliatesPage';
|
|
20
22
|
export { AcceptShareRoute, resolveAcceptedShareDestination, type AcceptShareRouteProps, } from './AcceptShareRoute';
|
|
23
|
+
export { ConnectAuthorizePage, type ConnectAuthorizePageProps } from './oauth/ConnectAuthorizePage';
|
|
24
|
+
export { AuthorizedAppsPage } from './oauth/AuthorizedAppsPage';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AuthorizedAppsPage: connectors (Claude, ChatGPT, ...) the signed-in user has
|
|
3
|
+
* allowed to act as them, with a way to revoke each one (BOFF-15144).
|
|
4
|
+
*
|
|
5
|
+
* Revoking ends the delegation: the gateways refuse the connector's current
|
|
6
|
+
* token on its next call and the auth service refuses to refresh it.
|
|
7
|
+
*
|
|
8
|
+
* Mount inside the shell's protected routes, e.g. `/settings/authorized-apps`.
|
|
9
|
+
* Named "Authorized apps" because "Connected apps" already means integration
|
|
10
|
+
* connections in the shells.
|
|
11
|
+
*/
|
|
12
|
+
export declare function AuthorizedAppsPage(): import('react').JSX.Element;
|
|
13
|
+
export default AuthorizedAppsPage;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { useAuthToken as e } from "../../shared/providers/shell/AuthTokenProvider.js";
|
|
2
|
+
import { useShellLabel as t } from "../../shared/providers/shell/useShellLabel.js";
|
|
3
|
+
import { AlertDialog as n, AlertDialogAction as r, AlertDialogCancel as i, AlertDialogContent as a, AlertDialogDescription as o, AlertDialogFooter as s, AlertDialogHeader as c, AlertDialogTitle as l } from "../../ui/alert-dialog.js";
|
|
4
|
+
import { Badge as u } from "../../ui/badge.js";
|
|
5
|
+
import { Button as d } from "../../ui/button.js";
|
|
6
|
+
import { Card as f, CardContent as p, CardDescription as m, CardHeader as h, CardTitle as g } from "../../ui/card.js";
|
|
7
|
+
import { EmptyState as _ } from "../../ui/empty-state.js";
|
|
8
|
+
import { Skeleton as v } from "../../ui/skeleton.js";
|
|
9
|
+
import { fetchConnections as y, fetchWorkspaces as b, revokeConnection as x } from "./operations.js";
|
|
10
|
+
import { useCallback as S, useEffect as C, useMemo as w, useState as T } from "react";
|
|
11
|
+
import { KeyRoundIcon as E, ShieldAlertIcon as D, ShieldCheckIcon as O } from "lucide-react";
|
|
12
|
+
import { jsx as k, jsxs as A } from "react/jsx-runtime";
|
|
13
|
+
// src/platform-pages/oauth/AuthorizedAppsPage.tsx
|
|
14
|
+
function j() {
|
|
15
|
+
let j = t(), { accessToken: M } = e(), [N, P] = T({ kind: "loading" }), [F, I] = T(null), [L, R] = T(!1), [z, B] = T(null), [V, H] = T(0), U = S(() => H((e) => e + 1), []);
|
|
16
|
+
C(() => {
|
|
17
|
+
let e = !1;
|
|
18
|
+
return Promise.all([y(M), b(M)]).then(([t, n]) => {
|
|
19
|
+
e || P({
|
|
20
|
+
kind: "ready",
|
|
21
|
+
connections: t,
|
|
22
|
+
workspaces: n
|
|
23
|
+
});
|
|
24
|
+
}).catch(() => {
|
|
25
|
+
e || P({ kind: "error" });
|
|
26
|
+
}), () => {
|
|
27
|
+
e = !0;
|
|
28
|
+
};
|
|
29
|
+
}, [M, V]);
|
|
30
|
+
let W = w(() => {
|
|
31
|
+
let e = /* @__PURE__ */ new Map();
|
|
32
|
+
if (N.kind === "ready") for (let t of N.workspaces) e.set(t.id, t.name);
|
|
33
|
+
return e;
|
|
34
|
+
}, [N]), G = S(async () => {
|
|
35
|
+
if (F) {
|
|
36
|
+
R(!0), B(null);
|
|
37
|
+
try {
|
|
38
|
+
await x(M, F.delegationId), I(null), U();
|
|
39
|
+
} catch {
|
|
40
|
+
B(j("authorizedApps.errors.revoke", "We could not revoke access. Try again in a moment."));
|
|
41
|
+
} finally {
|
|
42
|
+
R(!1);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, [
|
|
46
|
+
M,
|
|
47
|
+
j,
|
|
48
|
+
F,
|
|
49
|
+
U
|
|
50
|
+
]);
|
|
51
|
+
return /* @__PURE__ */ A("div", {
|
|
52
|
+
className: "min-h-full bg-bg-canvas",
|
|
53
|
+
children: [/* @__PURE__ */ A("div", {
|
|
54
|
+
className: "mx-auto w-full max-w-4xl space-y-4 px-4 py-6 md:px-6 lg:px-8",
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("h1", {
|
|
57
|
+
className: "text-xl font-semibold text-text-primary",
|
|
58
|
+
children: j("authorizedApps.title", "Authorized apps")
|
|
59
|
+
}), /* @__PURE__ */ k("p", {
|
|
60
|
+
className: "mt-1 text-sm text-text-secondary",
|
|
61
|
+
children: j("authorizedApps.description", "AI assistants and other apps you allowed to use your account. Each one works only in the workspace you chose, with your own role.")
|
|
62
|
+
})] }),
|
|
63
|
+
N.kind === "loading" && /* @__PURE__ */ A("div", {
|
|
64
|
+
className: "space-y-3",
|
|
65
|
+
"aria-busy": "true",
|
|
66
|
+
children: [/* @__PURE__ */ k(v, { className: "h-20 w-full" }), /* @__PURE__ */ k(v, { className: "h-20 w-full" })]
|
|
67
|
+
}),
|
|
68
|
+
N.kind === "error" && /* @__PURE__ */ k(f, { children: /* @__PURE__ */ A(h, { children: [/* @__PURE__ */ k(g, { children: j("authorizedApps.error.title", "We could not load your authorized apps") }), /* @__PURE__ */ k(m, { children: /* @__PURE__ */ k(d, {
|
|
69
|
+
variant: "outline",
|
|
70
|
+
size: "sm",
|
|
71
|
+
onClick: U,
|
|
72
|
+
children: j("authorizedApps.retry", "Try again")
|
|
73
|
+
}) })] }) }),
|
|
74
|
+
N.kind === "ready" && N.connections.length === 0 && /* @__PURE__ */ k(_, {
|
|
75
|
+
icon: /* @__PURE__ */ k(E, {
|
|
76
|
+
className: "size-6 text-action-primary-bg",
|
|
77
|
+
"aria-hidden": "true"
|
|
78
|
+
}),
|
|
79
|
+
title: j("authorizedApps.empty.title", "No authorized apps"),
|
|
80
|
+
description: j("authorizedApps.empty.body", "When you connect an app such as Claude or ChatGPT, it appears here.")
|
|
81
|
+
}),
|
|
82
|
+
N.kind === "ready" && N.connections.map((e) => /* @__PURE__ */ k(f, {
|
|
83
|
+
"data-testid": "authorized-app",
|
|
84
|
+
children: /* @__PURE__ */ A(p, {
|
|
85
|
+
className: "flex flex-col gap-3 py-4 sm:flex-row sm:items-center sm:justify-between",
|
|
86
|
+
children: [/* @__PURE__ */ A("div", {
|
|
87
|
+
className: "space-y-1",
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ A("div", {
|
|
90
|
+
className: "flex flex-wrap items-center gap-2",
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ k("span", {
|
|
93
|
+
className: "font-medium text-text-primary",
|
|
94
|
+
children: e.clientName
|
|
95
|
+
}),
|
|
96
|
+
e.verifiedClient ? /* @__PURE__ */ A(u, {
|
|
97
|
+
variant: "success",
|
|
98
|
+
children: [/* @__PURE__ */ k(O, { "aria-hidden": "true" }), j("oauthConnect.verified", "Verified")]
|
|
99
|
+
}) : /* @__PURE__ */ A(u, {
|
|
100
|
+
variant: "warning",
|
|
101
|
+
children: [/* @__PURE__ */ k(D, { "aria-hidden": "true" }), j("oauthConnect.unverified", "Unverified app")]
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ k(u, {
|
|
104
|
+
variant: "outline",
|
|
105
|
+
children: e.access === "BUILD" ? j("oauthConnect.access.build", "Read and build") : j("oauthConnect.access.read", "Read only")
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ k("p", {
|
|
110
|
+
className: "text-sm text-text-secondary",
|
|
111
|
+
children: j("authorizedApps.workspaces", "Workspace: {{names}}", { names: e.workspaceIds.map((e) => W.get(e) ?? j("authorizedApps.unknownWorkspace", "a workspace you left")).join(", ") })
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ k("p", {
|
|
114
|
+
className: "text-xs text-text-secondary",
|
|
115
|
+
children: j("authorizedApps.granted", "Allowed on {{date}}", { date: new Date(e.grantedAt).toLocaleDateString() })
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
}), /* @__PURE__ */ k(d, {
|
|
119
|
+
variant: "outline",
|
|
120
|
+
onClick: () => {
|
|
121
|
+
B(null), I(e);
|
|
122
|
+
},
|
|
123
|
+
children: j("authorizedApps.revoke", "Revoke access")
|
|
124
|
+
})]
|
|
125
|
+
})
|
|
126
|
+
}, e.delegationId))
|
|
127
|
+
]
|
|
128
|
+
}), /* @__PURE__ */ k(n, {
|
|
129
|
+
open: F !== null,
|
|
130
|
+
onOpenChange: (e) => {
|
|
131
|
+
!e && !L && I(null);
|
|
132
|
+
},
|
|
133
|
+
children: /* @__PURE__ */ A(a, { children: [
|
|
134
|
+
/* @__PURE__ */ A(c, { children: [/* @__PURE__ */ k(l, { children: j("authorizedApps.confirm.title", "Revoke access for {{client}}?", { client: F?.clientName ?? "" }) }), /* @__PURE__ */ k(o, { children: j("authorizedApps.confirm.body", "The app stops working with your account right away. To use it again, connect it again from the app.") })] }),
|
|
135
|
+
z && /* @__PURE__ */ k("p", {
|
|
136
|
+
role: "alert",
|
|
137
|
+
className: "text-sm text-status-error-text",
|
|
138
|
+
children: z
|
|
139
|
+
}),
|
|
140
|
+
/* @__PURE__ */ A(s, { children: [/* @__PURE__ */ k(i, {
|
|
141
|
+
disabled: L,
|
|
142
|
+
children: j("authorizedApps.confirm.cancel", "Keep access")
|
|
143
|
+
}), /* @__PURE__ */ k(r, {
|
|
144
|
+
disabled: L,
|
|
145
|
+
onClick: (e) => {
|
|
146
|
+
e.preventDefault(), G();
|
|
147
|
+
},
|
|
148
|
+
children: j("authorizedApps.confirm.revoke", "Revoke")
|
|
149
|
+
})] })
|
|
150
|
+
] })
|
|
151
|
+
})]
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
export { j as AuthorizedAppsPage, j as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConnectAuthorizePage: the consent screen a connector (Claude, ChatGPT, ...)
|
|
3
|
+
* sends the user to (BOFF-15144).
|
|
4
|
+
*
|
|
5
|
+
* The OAuth server parks the connector's request and redirects here with
|
|
6
|
+
* `?request=<id>`. The user, already signed in to the shell, picks one
|
|
7
|
+
* workspace and an access level, then approves or declines. Either way the
|
|
8
|
+
* auth service returns the URL that sends the browser back to the connector.
|
|
9
|
+
*
|
|
10
|
+
* Mount inside the shell's protected routes at `/connect/authorize`, shell-less
|
|
11
|
+
* (no app chrome), so a signed-out user goes through sign-in and comes back
|
|
12
|
+
* with the same query string.
|
|
13
|
+
*/
|
|
14
|
+
export interface ConnectAuthorizePageProps {
|
|
15
|
+
/** Display name of the product the connector will act in, e.g. "FluidGrids". */
|
|
16
|
+
productName: string;
|
|
17
|
+
/** Override for tests; defaults to `window.location.search`. */
|
|
18
|
+
search?: string;
|
|
19
|
+
/** Override for tests; defaults to `window.location.assign`. */
|
|
20
|
+
navigate?: (url: string) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function ConnectAuthorizePage({ productName, search, navigate, }: ConnectAuthorizePageProps): import('react').JSX.Element;
|
|
23
|
+
export default ConnectAuthorizePage;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { useAuthToken as e } from "../../shared/providers/shell/AuthTokenProvider.js";
|
|
2
|
+
import { useShellLabel as t } from "../../shared/providers/shell/useShellLabel.js";
|
|
3
|
+
import { Badge as n } from "../../ui/badge.js";
|
|
4
|
+
import { Button as r } from "../../ui/button.js";
|
|
5
|
+
import { Card as i, CardContent as a, CardDescription as o, CardFooter as s, CardHeader as c, CardTitle as l } from "../../ui/card.js";
|
|
6
|
+
import { NativeSelect as u } from "../../ui/select.js";
|
|
7
|
+
import { Skeleton as d } from "../../ui/skeleton.js";
|
|
8
|
+
import { OAuthRequestError as f, approveAuthorization as p, denyAuthorization as m, fetchAuthorizationRequest as h, fetchWorkspaces as g, isSafeRedirect as _ } from "./operations.js";
|
|
9
|
+
import { useCallback as v, useEffect as y, useMemo as b, useState as x } from "react";
|
|
10
|
+
import { ShieldAlertIcon as S, ShieldCheckIcon as C } from "lucide-react";
|
|
11
|
+
import { jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
12
|
+
// src/platform-pages/oauth/ConnectAuthorizePage.tsx
|
|
13
|
+
function E(e) {
|
|
14
|
+
window.location.assign(e);
|
|
15
|
+
}
|
|
16
|
+
function D({ productName: D, search: k, navigate: A = E }) {
|
|
17
|
+
let j = t(), { accessToken: M } = e(), N = b(() => new URLSearchParams(k ?? window.location.search).get("request") ?? "", [k]), [P, F] = x(() => N ? { kind: "loading" } : { kind: "expired" }), [I, L] = x(""), [R, z] = x("READ"), [B, V] = x(null), [H, U] = x(null);
|
|
18
|
+
y(() => {
|
|
19
|
+
if (!N) return;
|
|
20
|
+
let e = !1;
|
|
21
|
+
return Promise.all([h(M, N), g(M)]).then(([t, n]) => {
|
|
22
|
+
e || (F({
|
|
23
|
+
kind: "ready",
|
|
24
|
+
request: t,
|
|
25
|
+
workspaces: n
|
|
26
|
+
}), z(t.requestedAccess), n.length === 1 && n[0] && L(n[0].id));
|
|
27
|
+
}).catch((t) => {
|
|
28
|
+
e || F(t instanceof f && t.code === "NOT_FOUND" ? { kind: "expired" } : { kind: "error" });
|
|
29
|
+
}), () => {
|
|
30
|
+
e = !0;
|
|
31
|
+
};
|
|
32
|
+
}, [M, N]);
|
|
33
|
+
let W = v(async (e) => {
|
|
34
|
+
V(e), U(null);
|
|
35
|
+
try {
|
|
36
|
+
let t = e === "approve" ? await p(M, {
|
|
37
|
+
requestId: N,
|
|
38
|
+
workspaceId: I,
|
|
39
|
+
access: R
|
|
40
|
+
}) : await m(M, N);
|
|
41
|
+
if (!_(t)) throw new f("Unexpected redirect", void 0);
|
|
42
|
+
A(t);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
if (V(null), e instanceof f && e.code === "NOT_FOUND") {
|
|
45
|
+
F({ kind: "expired" });
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (e instanceof f && e.code === "FORBIDDEN") {
|
|
49
|
+
U(j("oauthConnect.errors.workspace", "You are not a member of that workspace."));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
U(j("oauthConnect.errors.generic", "Something went wrong. Try again in a moment."));
|
|
53
|
+
}
|
|
54
|
+
}, [
|
|
55
|
+
M,
|
|
56
|
+
R,
|
|
57
|
+
j,
|
|
58
|
+
A,
|
|
59
|
+
N,
|
|
60
|
+
I
|
|
61
|
+
]);
|
|
62
|
+
return /* @__PURE__ */ w("div", {
|
|
63
|
+
className: "flex min-h-screen items-center justify-center bg-bg-canvas px-4 py-10",
|
|
64
|
+
children: /* @__PURE__ */ T("div", {
|
|
65
|
+
className: "w-full max-w-lg",
|
|
66
|
+
children: [
|
|
67
|
+
P.kind === "loading" && /* @__PURE__ */ T(i, {
|
|
68
|
+
"aria-busy": "true",
|
|
69
|
+
children: [/* @__PURE__ */ T(c, { children: [/* @__PURE__ */ w(d, { className: "h-6 w-2/3" }), /* @__PURE__ */ w(d, { className: "mt-2 h-4 w-full" })] }), /* @__PURE__ */ T(a, {
|
|
70
|
+
className: "space-y-3",
|
|
71
|
+
children: [/* @__PURE__ */ w(d, { className: "h-10 w-full" }), /* @__PURE__ */ w(d, { className: "h-20 w-full" })]
|
|
72
|
+
})]
|
|
73
|
+
}),
|
|
74
|
+
P.kind === "expired" && /* @__PURE__ */ w(i, { children: /* @__PURE__ */ T(c, { children: [/* @__PURE__ */ w(l, { children: j("oauthConnect.expired.title", "This connection request has expired") }), /* @__PURE__ */ w(o, { children: j("oauthConnect.expired.body", "Requests are valid for 30 minutes and can be used once. Go back to the app you were connecting and start again.") })] }) }),
|
|
75
|
+
P.kind === "error" && /* @__PURE__ */ w(i, { children: /* @__PURE__ */ T(c, { children: [/* @__PURE__ */ w(l, { children: j("oauthConnect.error.title", "We could not load this request") }), /* @__PURE__ */ w(o, { children: j("oauthConnect.error.body", "Reload the page to try again.") })] }) }),
|
|
76
|
+
P.kind === "ready" && /* @__PURE__ */ T(i, { children: [
|
|
77
|
+
/* @__PURE__ */ T(c, { children: [
|
|
78
|
+
/* @__PURE__ */ T("div", {
|
|
79
|
+
className: "flex flex-wrap items-center gap-2",
|
|
80
|
+
children: [/* @__PURE__ */ w(l, { children: j("oauthConnect.title", "Connect {{client}} to {{product}}", {
|
|
81
|
+
client: P.request.clientName,
|
|
82
|
+
product: D
|
|
83
|
+
}) }), P.request.verifiedClient ? /* @__PURE__ */ T(n, {
|
|
84
|
+
variant: "success",
|
|
85
|
+
children: [/* @__PURE__ */ w(C, { "aria-hidden": "true" }), j("oauthConnect.verified", "Verified")]
|
|
86
|
+
}) : /* @__PURE__ */ T(n, {
|
|
87
|
+
variant: "warning",
|
|
88
|
+
children: [/* @__PURE__ */ w(S, { "aria-hidden": "true" }), j("oauthConnect.unverified", "Unverified app")]
|
|
89
|
+
})]
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ w(o, { children: j("oauthConnect.description", "{{client}} wants to use {{product}} as you. After you approve, you will be sent back to {{host}}.", {
|
|
92
|
+
client: P.request.clientName,
|
|
93
|
+
product: D,
|
|
94
|
+
host: P.request.redirectHost
|
|
95
|
+
}) }),
|
|
96
|
+
!P.request.verifiedClient && /* @__PURE__ */ w("p", {
|
|
97
|
+
className: "mt-2 text-sm text-status-warning-text",
|
|
98
|
+
children: j("oauthConnect.unverifiedWarning", "We could not confirm who made this app. Only continue if you started this connection yourself and you trust {{host}}.", { host: P.request.redirectHost })
|
|
99
|
+
})
|
|
100
|
+
] }),
|
|
101
|
+
/* @__PURE__ */ T(a, {
|
|
102
|
+
className: "space-y-5",
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ T("div", {
|
|
105
|
+
className: "space-y-2",
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ w("label", {
|
|
108
|
+
htmlFor: "oauth-connect-workspace",
|
|
109
|
+
className: "text-sm font-medium text-text-primary",
|
|
110
|
+
children: j("oauthConnect.workspace.label", "Workspace")
|
|
111
|
+
}),
|
|
112
|
+
P.workspaces.length === 0 ? /* @__PURE__ */ w("p", {
|
|
113
|
+
className: "text-sm text-text-secondary",
|
|
114
|
+
children: j("oauthConnect.workspace.none", "You are not a member of any workspace yet.")
|
|
115
|
+
}) : /* @__PURE__ */ w(u, {
|
|
116
|
+
id: "oauth-connect-workspace",
|
|
117
|
+
"aria-label": j("oauthConnect.workspace.label", "Workspace"),
|
|
118
|
+
placeholder: j("oauthConnect.workspace.placeholder", "Choose a workspace"),
|
|
119
|
+
value: I || void 0,
|
|
120
|
+
onValueChange: L,
|
|
121
|
+
options: P.workspaces.map((e) => ({
|
|
122
|
+
value: e.id,
|
|
123
|
+
label: e.name
|
|
124
|
+
}))
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ w("p", {
|
|
127
|
+
className: "text-xs text-text-secondary",
|
|
128
|
+
children: j("oauthConnect.workspace.hint", "The app can only see and change this one workspace, with your own role.")
|
|
129
|
+
})
|
|
130
|
+
]
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ T("fieldset", {
|
|
133
|
+
className: "space-y-2",
|
|
134
|
+
children: [/* @__PURE__ */ w("legend", {
|
|
135
|
+
className: "text-sm font-medium text-text-primary",
|
|
136
|
+
children: j("oauthConnect.access.label", "Access")
|
|
137
|
+
}), /* @__PURE__ */ T("div", {
|
|
138
|
+
role: "radiogroup",
|
|
139
|
+
className: "grid gap-2 sm:grid-cols-2",
|
|
140
|
+
children: [/* @__PURE__ */ w(O, {
|
|
141
|
+
selected: R === "READ",
|
|
142
|
+
onSelect: () => z("READ"),
|
|
143
|
+
title: j("oauthConnect.access.read", "Read only"),
|
|
144
|
+
body: j("oauthConnect.access.readBody", "See workflows, runs and logs. Cannot change anything.")
|
|
145
|
+
}), /* @__PURE__ */ w(O, {
|
|
146
|
+
selected: R === "BUILD",
|
|
147
|
+
disabled: P.request.requestedAccess !== "BUILD",
|
|
148
|
+
onSelect: () => z("BUILD"),
|
|
149
|
+
title: j("oauthConnect.access.build", "Read and build"),
|
|
150
|
+
body: j("oauthConnect.access.buildBody", "Also create, edit and run workflows. Deleting always asks for confirmation.")
|
|
151
|
+
})]
|
|
152
|
+
})]
|
|
153
|
+
}),
|
|
154
|
+
H && /* @__PURE__ */ w("p", {
|
|
155
|
+
role: "alert",
|
|
156
|
+
className: "text-sm text-status-error-text",
|
|
157
|
+
children: H
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
}),
|
|
161
|
+
/* @__PURE__ */ T(s, {
|
|
162
|
+
className: "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
163
|
+
children: [/* @__PURE__ */ w(r, {
|
|
164
|
+
variant: "outline",
|
|
165
|
+
disabled: B !== null,
|
|
166
|
+
onClick: () => void W("deny"),
|
|
167
|
+
children: j("oauthConnect.deny", "Cancel")
|
|
168
|
+
}), /* @__PURE__ */ w(r, {
|
|
169
|
+
disabled: B !== null || !I,
|
|
170
|
+
onClick: () => void W("approve"),
|
|
171
|
+
children: B === "approve" ? j("oauthConnect.approving", "Connecting…") : j("oauthConnect.approve", "Allow access")
|
|
172
|
+
})]
|
|
173
|
+
})
|
|
174
|
+
] })
|
|
175
|
+
]
|
|
176
|
+
})
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
function O({ selected: e, disabled: t = !1, onSelect: n, title: r, body: i }) {
|
|
180
|
+
return /* @__PURE__ */ T("button", {
|
|
181
|
+
type: "button",
|
|
182
|
+
role: "radio",
|
|
183
|
+
"aria-checked": e,
|
|
184
|
+
disabled: t,
|
|
185
|
+
onClick: n,
|
|
186
|
+
className: `rounded-card border p-3 text-start transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:cursor-not-allowed disabled:opacity-50 ${e ? "border-action-primary-bg bg-[var(--color-accent-soft)]" : "border-border-default bg-bg-surface hover:bg-bg-sunken"}`,
|
|
187
|
+
children: [/* @__PURE__ */ w("span", {
|
|
188
|
+
className: "block text-sm font-medium text-text-primary",
|
|
189
|
+
children: r
|
|
190
|
+
}), /* @__PURE__ */ w("span", {
|
|
191
|
+
className: "mt-1 block text-xs text-text-secondary",
|
|
192
|
+
children: i
|
|
193
|
+
})]
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
export { D as ConnectAuthorizePage, D as default };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL operations for connector consent and the Authorized apps page
|
|
3
|
+
* (BOFF-15144). All go to the global gateway as the signed-in user; the auth
|
|
4
|
+
* service refuses app and delegated tokens on every one of them.
|
|
5
|
+
*/
|
|
6
|
+
export type OAuthAccessLevel = 'READ' | 'BUILD';
|
|
7
|
+
export interface OAuthAuthorizationRequest {
|
|
8
|
+
requestId: string;
|
|
9
|
+
clientName: string;
|
|
10
|
+
redirectHost: string;
|
|
11
|
+
verifiedClient: boolean;
|
|
12
|
+
product: string;
|
|
13
|
+
requestedAccess: OAuthAccessLevel;
|
|
14
|
+
expiresAt: string;
|
|
15
|
+
}
|
|
16
|
+
export interface OAuthConnection {
|
|
17
|
+
delegationId: string;
|
|
18
|
+
clientName: string;
|
|
19
|
+
verifiedClient: boolean;
|
|
20
|
+
workspaceIds: string[];
|
|
21
|
+
access: OAuthAccessLevel;
|
|
22
|
+
grantedAt: string;
|
|
23
|
+
}
|
|
24
|
+
export interface WorkspaceOption {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
}
|
|
28
|
+
/** A GraphQL error with the server's code, for choosing what to show. */
|
|
29
|
+
export declare class OAuthRequestError extends Error {
|
|
30
|
+
readonly code: string | undefined;
|
|
31
|
+
constructor(message: string, code: string | undefined);
|
|
32
|
+
}
|
|
33
|
+
export declare function fetchAuthorizationRequest(authToken: string | null | undefined, requestId: string): Promise<OAuthAuthorizationRequest>;
|
|
34
|
+
export declare function approveAuthorization(authToken: string | null | undefined, input: {
|
|
35
|
+
requestId: string;
|
|
36
|
+
workspaceId: string;
|
|
37
|
+
access: OAuthAccessLevel;
|
|
38
|
+
}): Promise<string>;
|
|
39
|
+
export declare function denyAuthorization(authToken: string | null | undefined, requestId: string): Promise<string>;
|
|
40
|
+
export declare function fetchConnections(authToken: string | null | undefined): Promise<OAuthConnection[]>;
|
|
41
|
+
export declare function revokeConnection(authToken: string | null | undefined, delegationId: string): Promise<void>;
|
|
42
|
+
/** The user's workspaces (first 200), for the picker and for naming connections. */
|
|
43
|
+
export declare function fetchWorkspaces(authToken: string | null | undefined): Promise<WorkspaceOption[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Only send the browser to an http(s) URL. The auth service builds the
|
|
46
|
+
* redirect from the client's registered URI, so this is a second guard, not
|
|
47
|
+
* the first.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isSafeRedirect(url: string): boolean;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { graphqlFetch as e } from "../../shared/graphql/fetch.js";
|
|
2
|
+
// src/platform-pages/oauth/operations.ts
|
|
3
|
+
var t = class extends Error {
|
|
4
|
+
code;
|
|
5
|
+
constructor(e, t) {
|
|
6
|
+
super(e), this.code = t, this.name = "OAuthRequestError";
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
async function n(n, r, i) {
|
|
10
|
+
let a = await e({
|
|
11
|
+
gateway: "global",
|
|
12
|
+
query: r,
|
|
13
|
+
variables: i,
|
|
14
|
+
authToken: n ?? void 0
|
|
15
|
+
}), o = a.errors?.[0];
|
|
16
|
+
if (o || !a.data) {
|
|
17
|
+
let e = o?.extensions?.code;
|
|
18
|
+
throw new t(o?.message ?? "Request failed", typeof e == "string" ? e : void 0);
|
|
19
|
+
}
|
|
20
|
+
return a.data;
|
|
21
|
+
}
|
|
22
|
+
var r = "\n query OAuthAuthorizationRequest($requestId: String!) {\n oauthAuthorizationRequest(requestId: $requestId) {\n requestId clientName redirectHost verifiedClient product requestedAccess expiresAt\n }\n }\n", i = "\n mutation ApproveOAuthAuthorization($input: ApproveOAuthAuthorizationInput!) {\n approveOAuthAuthorization(input: $input) { redirectTo }\n }\n", a = "\n mutation DenyOAuthAuthorization($requestId: String!) {\n denyOAuthAuthorization(requestId: $requestId) { redirectTo }\n }\n", o = "\n query MyOAuthConnections {\n myOAuthConnections { delegationId clientName verifiedClient workspaceIds access grantedAt }\n }\n", s = "\n mutation RevokeOAuthConnection($id: ID!, $reason: String) {\n revokeDelegation(id: $id, reason: $reason)\n }\n", c = "\n query OAuthConsentWorkspaces($limit: Int, $offset: Int) {\n myWorkspaces(limit: $limit, offset: $offset) { items { id name } }\n }\n";
|
|
23
|
+
async function l(e, t) {
|
|
24
|
+
return (await n(e, r, { requestId: t })).oauthAuthorizationRequest;
|
|
25
|
+
}
|
|
26
|
+
async function u(e, t) {
|
|
27
|
+
return (await n(e, i, { input: t })).approveOAuthAuthorization.redirectTo;
|
|
28
|
+
}
|
|
29
|
+
async function d(e, t) {
|
|
30
|
+
return (await n(e, a, { requestId: t })).denyOAuthAuthorization.redirectTo;
|
|
31
|
+
}
|
|
32
|
+
async function f(e) {
|
|
33
|
+
return (await n(e, o)).myOAuthConnections;
|
|
34
|
+
}
|
|
35
|
+
async function p(e, t) {
|
|
36
|
+
await n(e, s, {
|
|
37
|
+
id: t,
|
|
38
|
+
reason: "Revoked from Authorized apps"
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async function m(e) {
|
|
42
|
+
return (await n(e, c, {
|
|
43
|
+
limit: 200,
|
|
44
|
+
offset: 0
|
|
45
|
+
})).myWorkspaces.items;
|
|
46
|
+
}
|
|
47
|
+
function h(e) {
|
|
48
|
+
try {
|
|
49
|
+
let t = new URL(e);
|
|
50
|
+
return t.protocol === "https:" || t.protocol === "http:";
|
|
51
|
+
} catch {
|
|
52
|
+
return !1;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export { t as OAuthRequestError, u as approveAuthorization, d as denyAuthorization, l as fetchAuthorizationRequest, f as fetchConnections, m as fetchWorkspaces, h as isSafeRedirect, p as revokeConnection };
|
package/dist/platform-pages.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { AppearanceSettingsPage as e } from "./platform-pages/AppearanceSettingsPage.js";
|
|
2
2
|
import { AffiliatesPage as t } from "./platform-pages/AffiliatesPage.js";
|
|
3
3
|
import { AcceptShareRoute as n, resolveAcceptedShareDestination as r } from "./platform-pages/AcceptShareRoute.js";
|
|
4
|
-
|
|
4
|
+
import { ConnectAuthorizePage as i } from "./platform-pages/oauth/ConnectAuthorizePage.js";
|
|
5
|
+
import { AuthorizedAppsPage as a } from "./platform-pages/oauth/AuthorizedAppsPage.js";
|
|
6
|
+
export { n as AcceptShareRoute, t as AffiliatesPage, e as AppearanceSettingsPage, a as AuthorizedAppsPage, i as ConnectAuthorizePage, r as resolveAcceptedShareDestination };
|