@kelpie/ui 0.14.0 → 0.16.0
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/api/client.d.ts +5 -4
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +34 -7
- package/dist/api/client.js.map +1 -1
- package/dist/api/resource.d.ts +4 -4
- package/dist/api/resource.d.ts.map +1 -1
- package/dist/api/resource.js +4 -5
- package/dist/api/resource.js.map +1 -1
- package/dist/api/resources/members.d.ts +2 -2
- package/dist/api/resources/oauth.d.ts +21 -0
- package/dist/api/resources/oauth.d.ts.map +1 -0
- package/dist/api/resources/oauth.js +74 -0
- package/dist/api/resources/oauth.js.map +1 -0
- package/dist/api/resources/planItems.d.ts +1 -1
- package/dist/api/resources/planItems.d.ts.map +1 -1
- package/dist/api/resources/planItems.js +1 -1
- package/dist/api/resources/planItems.js.map +1 -1
- package/dist/api/resources/session.d.ts +1 -1
- package/dist/api/resources/session.js +1 -1
- package/dist/app/KelpieApp.d.ts.map +1 -1
- package/dist/app/KelpieApp.js +3 -1
- package/dist/app/KelpieApp.js.map +1 -1
- package/dist/components/ApiKeysPanel.d.ts.map +1 -1
- package/dist/components/ApiKeysPanel.js +4 -1
- package/dist/components/ApiKeysPanel.js.map +1 -1
- package/dist/components/Paginator.d.ts +1 -1
- package/dist/components/QueryState.js +7 -1
- package/dist/components/QueryState.js.map +1 -1
- package/dist/components/Shell.js +1 -1
- package/dist/components/SummaryBlock.d.ts +1 -1
- package/dist/components/SummaryBlock.js +1 -1
- package/dist/lib/mcpConfig.d.ts +10 -0
- package/dist/lib/mcpConfig.d.ts.map +1 -0
- package/dist/lib/mcpConfig.js +23 -0
- package/dist/lib/mcpConfig.js.map +1 -0
- package/dist/lib/money.d.ts +2 -2
- package/dist/lib/money.js +2 -2
- package/dist/pages/DealsPage.js +1 -1
- package/dist/pages/DealsPage.js.map +1 -1
- package/dist/pages/DecisionsPage.d.ts.map +1 -1
- package/dist/pages/DecisionsPage.js +5 -3
- package/dist/pages/DecisionsPage.js.map +1 -1
- package/dist/pages/FundraisingPage.js +1 -1
- package/dist/pages/FundraisingPage.js.map +1 -1
- package/dist/pages/OpportunitiesPage.js +1 -1
- package/dist/pages/OpportunitiesPage.js.map +1 -1
- package/dist/pages/PartnershipsPage.js +1 -1
- package/dist/pages/PartnershipsPage.js.map +1 -1
- package/dist/pages/PersonDetail.js +2 -2
- package/dist/pages/PersonDetail.js.map +1 -1
- package/dist/pages/account/AccountLayout.d.ts.map +1 -1
- package/dist/pages/account/AccountLayout.js +2 -1
- package/dist/pages/account/AccountLayout.js.map +1 -1
- package/dist/pages/account/ConnectedAppsPage.d.ts +7 -0
- package/dist/pages/account/ConnectedAppsPage.d.ts.map +1 -0
- package/dist/pages/account/ConnectedAppsPage.js +32 -0
- package/dist/pages/account/ConnectedAppsPage.js.map +1 -0
- package/dist/pages/admin/McpPage.d.ts.map +1 -1
- package/dist/pages/admin/McpPage.js +6 -14
- package/dist/pages/admin/McpPage.js.map +1 -1
- package/dist/pages/admin/ModulesPage.d.ts.map +1 -1
- package/dist/pages/admin/ModulesPage.js +5 -4
- package/dist/pages/admin/ModulesPage.js.map +1 -1
- package/dist/pages/auth/AuthLayout.d.ts +1 -1
- package/dist/pages/auth/AuthLayout.d.ts.map +1 -1
- package/dist/pages/auth/AuthLayout.js +1 -1
- package/dist/pages/auth/AuthLayout.js.map +1 -1
- package/dist/pages/auth/SignUpPage.d.ts +1 -1
- package/dist/pages/auth/SignUpPage.js +1 -1
- package/dist/pages/dashboard/DashboardPage.d.ts.map +1 -1
- package/dist/pages/dashboard/DashboardPage.js +14 -1
- package/dist/pages/dashboard/DashboardPage.js.map +1 -1
- package/dist/pages/dashboard/sections.d.ts.map +1 -1
- package/dist/pages/dashboard/sections.js +12 -4
- package/dist/pages/dashboard/sections.js.map +1 -1
- package/dist/pages/forms/SubmissionDetail.js +1 -1
- package/dist/pages/forms/SubmissionDetail.js.map +1 -1
- package/dist/pages/forms/SubmissionsTable.d.ts.map +1 -1
- package/dist/pages/forms/SubmissionsTable.js +4 -3
- package/dist/pages/forms/SubmissionsTable.js.map +1 -1
- package/dist/pages/hiringDirectory.js +2 -2
- package/dist/pages/hiringDirectory.js.map +1 -1
- package/dist/pages/oauth/ConsentPage.d.ts +14 -0
- package/dist/pages/oauth/ConsentPage.d.ts.map +1 -0
- package/dist/pages/oauth/ConsentPage.js +87 -0
- package/dist/pages/oauth/ConsentPage.js.map +1 -0
- package/dist/pages/onboarding/onboardingModules.d.ts +1 -1
- package/dist/pages/onboarding/onboardingRerun.d.ts +1 -1
- package/dist/pages/onboarding/onboardingRerun.js +1 -1
- package/dist/pages/positionDirectory.js +2 -2
- package/dist/pages/positionDirectory.js.map +1 -1
- package/dist/registry/contributions.d.ts +1 -1
- package/dist/registry/contributions.js +1 -1
- package/dist/registry/overridable.d.ts +1 -1
- package/dist/registry/registry.d.ts +3 -3
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +1 -1
- package/package.json +2 -2
- package/src/api/client.ts +39 -11
- package/src/api/resource.ts +6 -7
- package/src/api/resources/members.ts +2 -2
- package/src/api/resources/oauth.ts +112 -0
- package/src/api/resources/planItems.ts +1 -1
- package/src/api/resources/session.ts +1 -1
- package/src/app/KelpieApp.tsx +6 -0
- package/src/components/ApiKeysPanel.tsx +17 -0
- package/src/components/Paginator.tsx +1 -1
- package/src/components/QueryState.tsx +8 -1
- package/src/components/Shell.tsx +1 -1
- package/src/components/SummaryBlock.tsx +1 -1
- package/src/lib/mcpConfig.ts +24 -0
- package/src/lib/money.ts +2 -2
- package/src/pages/DealsPage.tsx +1 -1
- package/src/pages/DecisionsPage.tsx +5 -3
- package/src/pages/FormsPage.tsx +1 -1
- package/src/pages/FundraisingPage.tsx +1 -1
- package/src/pages/OpportunitiesPage.tsx +1 -1
- package/src/pages/PartnershipsPage.tsx +1 -1
- package/src/pages/PersonDetail.tsx +2 -2
- package/src/pages/account/AccountLayout.tsx +2 -1
- package/src/pages/account/ConnectedAppsPage.tsx +131 -0
- package/src/pages/admin/McpPage.tsx +37 -22
- package/src/pages/admin/ModulesPage.tsx +5 -4
- package/src/pages/auth/AuthLayout.tsx +1 -1
- package/src/pages/auth/SignUpPage.tsx +1 -1
- package/src/pages/dashboard/DashboardPage.tsx +28 -0
- package/src/pages/dashboard/sections.tsx +36 -12
- package/src/pages/forms/SubmissionDetail.tsx +1 -1
- package/src/pages/forms/SubmissionsTable.tsx +4 -3
- package/src/pages/hiringDirectory.ts +2 -2
- package/src/pages/oauth/ConsentPage.tsx +219 -0
- package/src/pages/onboarding/InvitesStepPage.tsx +1 -1
- package/src/pages/onboarding/onboardingModules.ts +1 -1
- package/src/pages/onboarding/onboardingRerun.ts +1 -1
- package/src/pages/positionDirectory.ts +2 -2
- package/src/registry/contributions.ts +1 -1
- package/src/registry/overridable.ts +1 -1
- package/src/registry/registry.ts +3 -3
|
@@ -13,7 +13,7 @@ import { AuthMethods } from './AuthMethods.tsx'
|
|
|
13
13
|
/**
|
|
14
14
|
* Creating an account, against `POST /v1/auth/signup`.
|
|
15
15
|
*
|
|
16
|
-
* Signup makes the user and nothing else,
|
|
16
|
+
* Signup makes the user and nothing else, so success
|
|
17
17
|
* lands on the email-verification screen rather than in the app or the first
|
|
18
18
|
* onboarding step: the account cannot create a workspace until it verifies.
|
|
19
19
|
* The response sets the session cookie, which is why that next page can
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Dashboard } from '@kelpie/schemas'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
import { useNavigate } from 'react-router'
|
|
2
4
|
|
|
3
5
|
import { useTimezone } from '../../api/resources/account.ts'
|
|
4
6
|
import { useDashboard } from '../../api/resources/dashboard.ts'
|
|
@@ -24,6 +26,8 @@ export function DashboardPage(): React.JSX.Element {
|
|
|
24
26
|
const { workspace } = useWorkspace()
|
|
25
27
|
const { nameById } = useMembers()
|
|
26
28
|
const timezone = useTimezone()
|
|
29
|
+
const navigate = useNavigate()
|
|
30
|
+
const [query, setQuery] = useState('')
|
|
27
31
|
const workspaceName = workspace?.name ?? 'This workspace'
|
|
28
32
|
|
|
29
33
|
return (
|
|
@@ -42,6 +46,30 @@ export function DashboardPage(): React.JSX.Element {
|
|
|
42
46
|
}
|
|
43
47
|
/>
|
|
44
48
|
|
|
49
|
+
<form
|
|
50
|
+
className="mb-6"
|
|
51
|
+
onSubmit={(event) => {
|
|
52
|
+
event.preventDefault()
|
|
53
|
+
const term = query.trim()
|
|
54
|
+
|
|
55
|
+
if (term.length === 0) {
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
void navigate(`/search?q=${encodeURIComponent(term)}`)
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
<input
|
|
63
|
+
value={query}
|
|
64
|
+
onChange={(event) => {
|
|
65
|
+
setQuery(event.target.value)
|
|
66
|
+
}}
|
|
67
|
+
aria-label="Search"
|
|
68
|
+
placeholder="Search…"
|
|
69
|
+
className="w-full max-w-xl rounded-md border border-transparent bg-surface-sunken px-3 py-2 text-[15px] text-ink outline-none transition placeholder:text-ink-faint focus:border-border focus:bg-surface-raised"
|
|
70
|
+
/>
|
|
71
|
+
</form>
|
|
72
|
+
|
|
45
73
|
{error !== null && <ErrorPanel error={error} />}
|
|
46
74
|
{isLoading && <LoadingPanel label="Loading the workspace…" />}
|
|
47
75
|
|
|
@@ -70,15 +70,39 @@ function EmptyOr({
|
|
|
70
70
|
return isEmpty ? <p className="text-[13px] text-ink-faint">{empty}</p> : <>{children}</>
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
/** Shared inner-list chrome: row rules only — the well is the outer edge. */
|
|
74
|
+
const LIST_DIVIDE = 'divide-y divide-border'
|
|
75
|
+
|
|
76
|
+
function SectionWell({
|
|
77
|
+
children,
|
|
78
|
+
tone = 'raised',
|
|
79
|
+
}: {
|
|
80
|
+
readonly children: ReactNode
|
|
81
|
+
readonly tone?: 'raised' | 'attention'
|
|
82
|
+
}): React.JSX.Element {
|
|
83
|
+
if (tone === 'attention') {
|
|
84
|
+
return (
|
|
85
|
+
<section className="relative overflow-hidden rounded-md border border-border bg-surface-sunken p-4 pl-5">
|
|
86
|
+
<span aria-hidden className="absolute inset-y-0 left-0 w-[3px] bg-danger" />
|
|
87
|
+
{children}
|
|
88
|
+
</section>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<section className="rounded-md border border-border bg-surface-raised p-4">{children}</section>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
73
97
|
export function AttentionList({ rows }: { readonly rows: readonly AttentionRow[] }): React.JSX.Element {
|
|
74
98
|
return (
|
|
75
|
-
<
|
|
99
|
+
<SectionWell tone="attention">
|
|
76
100
|
<SectionHeader
|
|
77
101
|
title="Needs attention"
|
|
78
102
|
description="Overdue Plans, partnership touchpoints, and contacts going cold."
|
|
79
103
|
/>
|
|
80
104
|
<EmptyOr isEmpty={rows.length === 0} empty="Nothing urgent right now.">
|
|
81
|
-
<ul className=
|
|
105
|
+
<ul className={LIST_DIVIDE}>
|
|
82
106
|
{rows.map((row) => (
|
|
83
107
|
<li key={row.id} className="py-3">
|
|
84
108
|
<div className="flex flex-wrap items-center gap-2">
|
|
@@ -102,7 +126,7 @@ export function AttentionList({ rows }: { readonly rows: readonly AttentionRow[]
|
|
|
102
126
|
))}
|
|
103
127
|
</ul>
|
|
104
128
|
</EmptyOr>
|
|
105
|
-
</
|
|
129
|
+
</SectionWell>
|
|
106
130
|
)
|
|
107
131
|
}
|
|
108
132
|
|
|
@@ -118,13 +142,13 @@ export function ActivityFeed({
|
|
|
118
142
|
readonly timezone: string
|
|
119
143
|
}): React.JSX.Element {
|
|
120
144
|
return (
|
|
121
|
-
<
|
|
145
|
+
<SectionWell>
|
|
122
146
|
<SectionHeader
|
|
123
147
|
title="Recent activity"
|
|
124
148
|
description="The latest events across people, companies, and pipelines."
|
|
125
149
|
/>
|
|
126
150
|
<EmptyOr isEmpty={activities.length === 0} empty="No activity yet.">
|
|
127
|
-
<ol className=
|
|
151
|
+
<ol className={LIST_DIVIDE}>
|
|
128
152
|
{activities.map((activity, index) => (
|
|
129
153
|
<li key={activity.id} className="flex gap-2 py-3">
|
|
130
154
|
<div className="relative flex w-5 shrink-0 justify-center">
|
|
@@ -167,7 +191,7 @@ export function ActivityFeed({
|
|
|
167
191
|
))}
|
|
168
192
|
</ol>
|
|
169
193
|
</EmptyOr>
|
|
170
|
-
</
|
|
194
|
+
</SectionWell>
|
|
171
195
|
)
|
|
172
196
|
}
|
|
173
197
|
|
|
@@ -198,10 +222,10 @@ export function NotesList({
|
|
|
198
222
|
readonly timezone: string
|
|
199
223
|
}): React.JSX.Element {
|
|
200
224
|
return (
|
|
201
|
-
<
|
|
225
|
+
<SectionWell>
|
|
202
226
|
<SectionHeader title="Recent notes" description="Pinned notes surface first." />
|
|
203
227
|
<EmptyOr isEmpty={notes.length === 0} empty="No notes yet.">
|
|
204
|
-
<ul className=
|
|
228
|
+
<ul className={LIST_DIVIDE}>
|
|
205
229
|
{notes.map((note) => (
|
|
206
230
|
<li key={note.id} className="py-3">
|
|
207
231
|
<div className="flex items-start justify-between gap-2">
|
|
@@ -227,7 +251,7 @@ export function NotesList({
|
|
|
227
251
|
))}
|
|
228
252
|
</ul>
|
|
229
253
|
</EmptyOr>
|
|
230
|
-
</
|
|
254
|
+
</SectionWell>
|
|
231
255
|
)
|
|
232
256
|
}
|
|
233
257
|
|
|
@@ -241,7 +265,7 @@ export function DecisionsList({
|
|
|
241
265
|
readonly timezone: string
|
|
242
266
|
}): React.JSX.Element {
|
|
243
267
|
return (
|
|
244
|
-
<
|
|
268
|
+
<SectionWell>
|
|
245
269
|
<div className="mb-3 flex items-start justify-between gap-2">
|
|
246
270
|
<div className="min-w-0">
|
|
247
271
|
<h2 className="text-[13px] font-semibold text-ink">Recent decisions</h2>
|
|
@@ -254,7 +278,7 @@ export function DecisionsList({
|
|
|
254
278
|
</Link>
|
|
255
279
|
</div>
|
|
256
280
|
<EmptyOr isEmpty={decisions.length === 0} empty="No decisions yet.">
|
|
257
|
-
<ul className=
|
|
281
|
+
<ul className={LIST_DIVIDE}>
|
|
258
282
|
{decisions.map((decision) => (
|
|
259
283
|
<li key={decision.id} className="py-3">
|
|
260
284
|
<p className="text-[13px] font-medium text-ink">{decision.body}</p>
|
|
@@ -276,6 +300,6 @@ export function DecisionsList({
|
|
|
276
300
|
))}
|
|
277
301
|
</ul>
|
|
278
302
|
</EmptyOr>
|
|
279
|
-
</
|
|
303
|
+
</SectionWell>
|
|
280
304
|
)
|
|
281
305
|
}
|
|
@@ -18,7 +18,7 @@ import { formatDateTime } from '../../lib/dates.ts'
|
|
|
18
18
|
* rather than the forms list.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
/**
|
|
21
|
+
/** `?limit=` maxes out at 200 (`docs/agents/api-and-webhooks.md`). */
|
|
22
22
|
const MAX_PAGE = 200
|
|
23
23
|
|
|
24
24
|
export function SubmissionDetail(): React.JSX.Element {
|
|
@@ -17,8 +17,9 @@ import { formatDateTime } from '../../lib/dates.ts'
|
|
|
17
17
|
* What has arrived through this form.
|
|
18
18
|
*
|
|
19
19
|
* Person and company names are joined client-side against one page each, the
|
|
20
|
-
* same way the Decisions page does it:
|
|
21
|
-
* neither list
|
|
20
|
+
* same way the Decisions page does it: the API has no include-expansion, and
|
|
21
|
+
* neither list filters on its own `?id=` (the repeatable id filters match a
|
|
22
|
+
* foreign key, not the record's id). A record past those pages is still
|
|
22
23
|
* linked, by its type rather than its name, which beats a raw id.
|
|
23
24
|
*
|
|
24
25
|
* A row opens `/forms/:id/submissions/:submissionId`. Inline person/company
|
|
@@ -26,7 +27,7 @@ import { formatDateTime } from '../../lib/dates.ts'
|
|
|
26
27
|
* also open the submission.
|
|
27
28
|
*/
|
|
28
29
|
|
|
29
|
-
/**
|
|
30
|
+
/** `?limit=` maxes out at 200 (`docs/agents/api-and-webhooks.md`). */
|
|
30
31
|
const MAX_PAGE = 200
|
|
31
32
|
|
|
32
33
|
export interface SubmissionsTableProps {
|
|
@@ -10,12 +10,12 @@ import { useRoles } from '../api/resources/roles.ts'
|
|
|
10
10
|
* The counts and names the hiring pages need beside their own records.
|
|
11
11
|
*
|
|
12
12
|
* A candidacy carries two ids and no words, so every page showing one needs a
|
|
13
|
-
* second resource to render it.
|
|
13
|
+
* second resource to render it. The API has no include-expansion; it has
|
|
14
14
|
* repeatable id filters, so each of these asks about exactly the rows on screen:
|
|
15
15
|
* one extra request for the page rather than one per row.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
/**
|
|
18
|
+
/** `?limit=` and an id filter both max out at 200 (`docs/agents/api-and-webhooks.md`). */
|
|
19
19
|
const MAX_PAGE = 200
|
|
20
20
|
|
|
21
21
|
export interface RoleCandidateCounts {
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { API_KEY_SCOPE_LABELS } from '@kelpie/schemas'
|
|
2
|
+
import type { ApiKeyScope, OAuthRequest } from '@kelpie/schemas'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
import { Link, Navigate, useParams } from 'react-router'
|
|
5
|
+
|
|
6
|
+
import { useApproveOAuthRequest, useDenyOAuthRequest, useOAuthRequest } from '../../api/resources/oauth.ts'
|
|
7
|
+
import { useSession } from '../../api/resources/session.ts'
|
|
8
|
+
import { ErrorPanel, LoadingPanel } from '../../components/QueryState.tsx'
|
|
9
|
+
import { AuthLayout } from '../auth/AuthLayout.tsx'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Where an MCP client sends a person to approve a connection:
|
|
13
|
+
* `/consent/:requestId`, reached by redirect from `/oauth/authorize`.
|
|
14
|
+
*
|
|
15
|
+
* Outside the session gate, like `/join`: a signed-out person is sent to sign
|
|
16
|
+
* in and brought back here, rather than landing on the dashboard with the
|
|
17
|
+
* request lost.
|
|
18
|
+
*
|
|
19
|
+
* The page shows the client's host as well as its name. A name is whatever the
|
|
20
|
+
* client registered; the host is where the browser will be sent, and is the
|
|
21
|
+
* part a person can check.
|
|
22
|
+
*/
|
|
23
|
+
export function ConsentPage(): React.JSX.Element {
|
|
24
|
+
const { requestId = '' } = useParams()
|
|
25
|
+
const { isLoading: sessionLoading, isSignedOut, error: sessionError } = useSession()
|
|
26
|
+
|
|
27
|
+
if (isSignedOut) {
|
|
28
|
+
return <Navigate to={`/login?next=${encodeURIComponent(`/consent/${requestId}`)}`} replace />
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (sessionError !== null) {
|
|
32
|
+
return (
|
|
33
|
+
<AuthLayout title="Connect an app">
|
|
34
|
+
<div className="mt-4">
|
|
35
|
+
<ErrorPanel error={sessionError} />
|
|
36
|
+
</div>
|
|
37
|
+
</AuthLayout>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (sessionLoading) {
|
|
42
|
+
return <LoadingPanel />
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return <ConsentForRequest requestId={requestId} />
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function ConsentForRequest({ requestId }: { readonly requestId: string }): React.JSX.Element {
|
|
49
|
+
const { request, isLoading, error } = useOAuthRequest(requestId)
|
|
50
|
+
|
|
51
|
+
if (error !== null) {
|
|
52
|
+
return (
|
|
53
|
+
<AuthLayout
|
|
54
|
+
title="This request is no longer valid"
|
|
55
|
+
description="It has expired, or it was already answered. Go back to the app and connect again."
|
|
56
|
+
>
|
|
57
|
+
<div className="mt-4">
|
|
58
|
+
<ErrorPanel error={error} />
|
|
59
|
+
</div>
|
|
60
|
+
</AuthLayout>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (isLoading || request === undefined) {
|
|
65
|
+
return <LoadingPanel label="Loading the request…" />
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return <ConsentForm request={request} />
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function ConsentForm({ request }: { readonly request: OAuthRequest }): React.JSX.Element {
|
|
72
|
+
const approve = useApproveOAuthRequest()
|
|
73
|
+
const deny = useDenyOAuthRequest()
|
|
74
|
+
const [workspaceId, setWorkspaceId] = useState(request.workspaces[0]?.id ?? '')
|
|
75
|
+
const [scopes, setScopes] = useState<readonly ApiKeyScope[]>(request.scopes)
|
|
76
|
+
const [leaving, setLeaving] = useState(false)
|
|
77
|
+
const busy = approve.isPending || deny.isPending || leaving
|
|
78
|
+
|
|
79
|
+
function leaveTo(url: string): void {
|
|
80
|
+
// The redirect goes to the client, which may be another site or an app on
|
|
81
|
+
// this computer, so it is a full navigation and not a router one.
|
|
82
|
+
setLeaving(true)
|
|
83
|
+
window.location.assign(url)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function toggle(scope: ApiKeyScope): void {
|
|
87
|
+
setScopes((current) => (current.includes(scope) ? current.filter((entry) => entry !== scope) : [...current, scope]))
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (request.workspaces.length === 0) {
|
|
91
|
+
return (
|
|
92
|
+
<AuthLayout
|
|
93
|
+
title={`Connect ${request.clientName}`}
|
|
94
|
+
description="A connection is made to one workspace, and this account is not a member of any."
|
|
95
|
+
>
|
|
96
|
+
<p className="mt-4 text-[13px] text-ink-muted">
|
|
97
|
+
<Link to="/onboarding/workspace" className="text-accent hover:underline">
|
|
98
|
+
Create a workspace
|
|
99
|
+
</Link>
|
|
100
|
+
, then go back to the app and connect again.
|
|
101
|
+
</p>
|
|
102
|
+
</AuthLayout>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (leaving) {
|
|
107
|
+
return (
|
|
108
|
+
<AuthLayout title="Returning to the app" description={`Sending you back to ${request.clientHost}.`}>
|
|
109
|
+
<p className="mt-4 text-[13px] text-ink-muted">You can close this tab if it does not move on.</p>
|
|
110
|
+
</AuthLayout>
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<AuthLayout
|
|
116
|
+
title={`Connect ${request.clientName}`}
|
|
117
|
+
description="This app wants to use Kelpie as you, through MCP."
|
|
118
|
+
footer={
|
|
119
|
+
<p className="text-[11px] text-ink-faint">
|
|
120
|
+
Remove the connection at any time under Account, Connected apps.
|
|
121
|
+
</p>
|
|
122
|
+
}
|
|
123
|
+
>
|
|
124
|
+
<div className="mt-5 space-y-4">
|
|
125
|
+
<div className="rounded-md border border-border bg-surface px-3 py-2.5">
|
|
126
|
+
<p className="text-[11px] font-medium tracking-wide text-ink-muted uppercase">Sends you back to</p>
|
|
127
|
+
<p className="mt-0.5 font-mono text-[13px] break-all text-ink">{request.clientHost}</p>
|
|
128
|
+
{request.clientUri !== null && (
|
|
129
|
+
<a
|
|
130
|
+
href={request.clientUri}
|
|
131
|
+
target="_blank"
|
|
132
|
+
rel="noreferrer"
|
|
133
|
+
className="mt-1 inline-block text-[12px] text-accent hover:underline"
|
|
134
|
+
>
|
|
135
|
+
About this app
|
|
136
|
+
</a>
|
|
137
|
+
)}
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
<label className="block">
|
|
141
|
+
<span className="mb-1.5 block text-[12px] font-medium text-ink">Workspace</span>
|
|
142
|
+
<select
|
|
143
|
+
value={workspaceId}
|
|
144
|
+
onChange={(event) => {
|
|
145
|
+
setWorkspaceId(event.target.value)
|
|
146
|
+
}}
|
|
147
|
+
className="w-full rounded-md border border-border bg-surface px-3 py-2 text-[13px] text-ink outline-none focus:border-accent"
|
|
148
|
+
>
|
|
149
|
+
{request.workspaces.map((workspace) => (
|
|
150
|
+
<option key={workspace.id} value={workspace.id}>
|
|
151
|
+
{workspace.name}
|
|
152
|
+
</option>
|
|
153
|
+
))}
|
|
154
|
+
</select>
|
|
155
|
+
<span className="mt-1 block text-[11px] text-ink-faint">
|
|
156
|
+
The app sees this workspace only. To use another, connect again.
|
|
157
|
+
</span>
|
|
158
|
+
</label>
|
|
159
|
+
|
|
160
|
+
<fieldset>
|
|
161
|
+
<legend className="mb-1.5 text-[12px] font-medium text-ink">Access</legend>
|
|
162
|
+
<div className="space-y-1.5">
|
|
163
|
+
{request.scopes.map((scope) => (
|
|
164
|
+
<label key={scope} className="flex items-center gap-2 text-[13px] text-ink">
|
|
165
|
+
<input
|
|
166
|
+
type="checkbox"
|
|
167
|
+
checked={scopes.includes(scope)}
|
|
168
|
+
onChange={() => {
|
|
169
|
+
toggle(scope)
|
|
170
|
+
}}
|
|
171
|
+
/>
|
|
172
|
+
{API_KEY_SCOPE_LABELS[scope]}
|
|
173
|
+
</label>
|
|
174
|
+
))}
|
|
175
|
+
</div>
|
|
176
|
+
<p className="mt-1.5 text-[11px] text-ink-faint">
|
|
177
|
+
The app can do no more than your own role allows. Clear an item to give less access.
|
|
178
|
+
</p>
|
|
179
|
+
</fieldset>
|
|
180
|
+
|
|
181
|
+
{approve.error !== null && <ErrorPanel error={approve.error} />}
|
|
182
|
+
{deny.error !== null && <ErrorPanel error={deny.error} />}
|
|
183
|
+
|
|
184
|
+
<div className="flex gap-2">
|
|
185
|
+
<button
|
|
186
|
+
type="button"
|
|
187
|
+
disabled={busy}
|
|
188
|
+
onClick={() => {
|
|
189
|
+
deny
|
|
190
|
+
.runAsync(request.id)
|
|
191
|
+
.then((decision) => {
|
|
192
|
+
leaveTo(decision.redirectUrl)
|
|
193
|
+
})
|
|
194
|
+
.catch(() => undefined)
|
|
195
|
+
}}
|
|
196
|
+
className="flex-1 rounded-md border border-border px-3.5 py-2 text-[12px] font-semibold text-ink transition hover:border-border-strong disabled:opacity-50"
|
|
197
|
+
>
|
|
198
|
+
Deny
|
|
199
|
+
</button>
|
|
200
|
+
<button
|
|
201
|
+
type="button"
|
|
202
|
+
disabled={busy || scopes.length === 0 || workspaceId.length === 0}
|
|
203
|
+
onClick={() => {
|
|
204
|
+
approve
|
|
205
|
+
.runAsync({ requestId: request.id, workspaceId, scopes })
|
|
206
|
+
.then((decision) => {
|
|
207
|
+
leaveTo(decision.redirectUrl)
|
|
208
|
+
})
|
|
209
|
+
.catch(() => undefined)
|
|
210
|
+
}}
|
|
211
|
+
className="flex-1 rounded-md bg-accent px-3.5 py-2 text-[12px] font-semibold text-accent-fg transition hover:bg-accent-hover disabled:opacity-50"
|
|
212
|
+
>
|
|
213
|
+
{approve.isPending ? 'Connecting…' : 'Allow'}
|
|
214
|
+
</button>
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
</AuthLayout>
|
|
218
|
+
)
|
|
219
|
+
}
|
|
@@ -18,7 +18,7 @@ import { isOnboardingRerun } from './onboardingRerun.ts'
|
|
|
18
18
|
* this because it sent nothing. Here a row carries its own outcome, a sent one
|
|
19
19
|
* is never sent twice, and the step only advances once nothing is outstanding.
|
|
20
20
|
*
|
|
21
|
-
* Skippable, per `
|
|
21
|
+
* Skippable, per `docs/guides/getting-started.md`. Admin → Team does the same job later.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
interface InviteRow {
|
|
@@ -8,7 +8,7 @@ import type { OrganisationChoiceId } from './handbookTemplates.ts'
|
|
|
8
8
|
* what writes the first `workspace_module_settings` rows for these six.
|
|
9
9
|
*
|
|
10
10
|
* Labels stay the domain names. Defaults and explanations follow the
|
|
11
|
-
* organisation type chosen on the previous step (`
|
|
11
|
+
* organisation type chosen on the previous step (`docs/guides/getting-started.md`).
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
export type OnboardingModuleId =
|
|
@@ -22,7 +22,7 @@ export function isOnboardingRerun(searchParams: URLSearchParams): boolean {
|
|
|
22
22
|
/**
|
|
23
23
|
* Keep the rerun flag and the organisation type when moving between onboarding
|
|
24
24
|
* routes. `org` is how the modules step knows which defaults to offer; nothing
|
|
25
|
-
* else is held in the browser
|
|
25
|
+
* else is held in the browser.
|
|
26
26
|
*/
|
|
27
27
|
export function onboardingPath(path: string, rerun: boolean, org?: string | null): string {
|
|
28
28
|
const params = new URLSearchParams()
|
|
@@ -7,7 +7,7 @@ import { usePositions } from '../api/resources/positions.ts'
|
|
|
7
7
|
* Titles and company names for the people on screen, and head counts for the
|
|
8
8
|
* companies on screen.
|
|
9
9
|
*
|
|
10
|
-
* A list row needs data from three resources, and
|
|
10
|
+
* A list row needs data from three resources, and the API has no
|
|
11
11
|
* include-expansion. What it does have is repeatable id filters, so each of
|
|
12
12
|
* these asks about exactly the rows the page is rendering: two extra requests
|
|
13
13
|
* for the page, not one per row, and no cap that a real workspace could grow
|
|
@@ -18,7 +18,7 @@ import { usePositions } from '../api/resources/positions.ts'
|
|
|
18
18
|
* answer rather than a slow one.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
/**
|
|
21
|
+
/** `?limit=` and an id filter both max out at 200 (`docs/agents/api-and-webhooks.md`). */
|
|
22
22
|
const MAX_PAGE = 200
|
|
23
23
|
|
|
24
24
|
export interface PeopleDirectory {
|
|
@@ -2,7 +2,7 @@ import type { ExtensibleRecordType } from '@kelpie/schemas'
|
|
|
2
2
|
import type { ReactNode } from 'react'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* What a UI module may add to the shell
|
|
5
|
+
* What a UI module may add to the shell.
|
|
6
6
|
*
|
|
7
7
|
* Every slot renders nothing when empty. A core page has to look finished with
|
|
8
8
|
* no modules loaded at all, because the open-source assembly is exactly that.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComponentType } from 'react'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* The override escape hatch
|
|
4
|
+
* The override escape hatch: a module replaces a core
|
|
5
5
|
* component outright. Prefer a slot; this is for the cases a slot cannot reach.
|
|
6
6
|
*
|
|
7
7
|
* A core component is replaceable only if it hands out a token, and the token
|
package/src/registry/registry.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { createOverrideStore } from './overridable.ts'
|
|
|
14
14
|
import type { Overridable, OverrideStore } from './overridable.ts'
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* The build-time UI extension registry
|
|
17
|
+
* The build-time UI extension registry.
|
|
18
18
|
*
|
|
19
19
|
* Composition is build-time, like the server runtime: an assembly lists its UI
|
|
20
20
|
* modules and this collects what they contribute. Nothing is loaded at runtime,
|
|
@@ -34,7 +34,7 @@ export interface UiModuleContext {
|
|
|
34
34
|
dashboardCard(card: DashboardCard): void
|
|
35
35
|
/** Another way to sign in, rendered beside the password form on `/login` and `/signup`. */
|
|
36
36
|
authMethod(method: AuthMethod): void
|
|
37
|
-
/** Replaces a core component. Prefer a slot
|
|
37
|
+
/** Replaces a core component. Prefer a slot. */
|
|
38
38
|
override<Props>(token: Overridable<Props>, component: ComponentType<Props>): void
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -200,6 +200,6 @@ export function registerUiModules(modules: readonly UiModule[]): UiExtensions {
|
|
|
200
200
|
* tree without a provider sees.
|
|
201
201
|
*
|
|
202
202
|
* Every slot is empty and every overridable renders its core fallback, which is
|
|
203
|
-
* the state
|
|
203
|
+
* the state core pages are required to look finished in.
|
|
204
204
|
*/
|
|
205
205
|
export const NO_UI_MODULES: UiExtensions = registerUiModules([])
|