@cellarnode/ui 0.194.0 → 0.195.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/components/certification-upload-card.d.ts.map +1 -1
- package/dist/components/certification-upload-card.js +5 -2
- package/dist/components/certification-upload-card.js.map +1 -1
- package/dist/components/confirmation-dialog.d.ts +3 -1
- package/dist/components/confirmation-dialog.d.ts.map +1 -1
- package/dist/components/confirmation-dialog.js +20 -2
- package/dist/components/confirmation-dialog.js.map +1 -1
- package/dist/components/copy-button.d.ts +23 -0
- package/dist/components/copy-button.d.ts.map +1 -0
- package/dist/components/copy-button.js +53 -0
- package/dist/components/copy-button.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/profile/api-keys/_story-fixtures.d.ts +3 -0
- package/dist/profile/api-keys/_story-fixtures.d.ts.map +1 -0
- package/dist/profile/api-keys/_story-fixtures.js +3 -0
- package/dist/profile/api-keys/_story-fixtures.js.map +1 -0
- package/dist/profile/api-keys/api-key-secret-reveal.d.ts +42 -0
- package/dist/profile/api-keys/api-key-secret-reveal.d.ts.map +1 -0
- package/dist/profile/api-keys/api-key-secret-reveal.js +56 -0
- package/dist/profile/api-keys/api-key-secret-reveal.js.map +1 -0
- package/dist/profile/api-keys/api-keys-card.d.ts +56 -0
- package/dist/profile/api-keys/api-keys-card.d.ts.map +1 -0
- package/dist/profile/api-keys/api-keys-card.js +77 -0
- package/dist/profile/api-keys/api-keys-card.js.map +1 -0
- package/dist/profile/api-keys/client-snippets.d.ts +20 -0
- package/dist/profile/api-keys/client-snippets.d.ts.map +1 -0
- package/dist/profile/api-keys/client-snippets.js +79 -0
- package/dist/profile/api-keys/client-snippets.js.map +1 -0
- package/dist/profile/api-keys/connected-apps-card.d.ts +39 -0
- package/dist/profile/api-keys/connected-apps-card.d.ts.map +1 -0
- package/dist/profile/api-keys/connected-apps-card.js +54 -0
- package/dist/profile/api-keys/connected-apps-card.js.map +1 -0
- package/dist/profile/api-keys/create-api-key-dialog.d.ts +51 -0
- package/dist/profile/api-keys/create-api-key-dialog.d.ts.map +1 -0
- package/dist/profile/api-keys/create-api-key-dialog.js +114 -0
- package/dist/profile/api-keys/create-api-key-dialog.js.map +1 -0
- package/dist/profile/api-keys/format.d.ts +20 -0
- package/dist/profile/api-keys/format.d.ts.map +1 -0
- package/dist/profile/api-keys/format.js +58 -0
- package/dist/profile/api-keys/format.js.map +1 -0
- package/dist/profile/api-keys/index.d.ts +19 -0
- package/dist/profile/api-keys/index.d.ts.map +1 -0
- package/dist/profile/api-keys/index.js +10 -0
- package/dist/profile/api-keys/index.js.map +1 -0
- package/dist/profile/api-keys/mock-client.d.ts +23 -0
- package/dist/profile/api-keys/mock-client.d.ts.map +1 -0
- package/dist/profile/api-keys/mock-client.js +167 -0
- package/dist/profile/api-keys/mock-client.js.map +1 -0
- package/dist/profile/api-keys/profile-keys-section.d.ts +36 -0
- package/dist/profile/api-keys/profile-keys-section.d.ts.map +1 -0
- package/dist/profile/api-keys/profile-keys-section.js +97 -0
- package/dist/profile/api-keys/profile-keys-section.js.map +1 -0
- package/dist/profile/api-keys/revoke-confirm.d.ts +26 -0
- package/dist/profile/api-keys/revoke-confirm.d.ts.map +1 -0
- package/dist/profile/api-keys/revoke-confirm.js +26 -0
- package/dist/profile/api-keys/revoke-confirm.js.map +1 -0
- package/dist/profile/api-keys/scope-list.d.ts +36 -0
- package/dist/profile/api-keys/scope-list.d.ts.map +1 -0
- package/dist/profile/api-keys/scope-list.js +29 -0
- package/dist/profile/api-keys/scope-list.js.map +1 -0
- package/dist/profile/api-keys/types.d.ts +111 -0
- package/dist/profile/api-keys/types.d.ts.map +1 -0
- package/dist/profile/api-keys/types.js +147 -0
- package/dist/profile/api-keys/types.js.map +1 -0
- package/dist/profile/index.d.ts +1 -0
- package/dist/profile/index.d.ts.map +1 -1
- package/dist/profile/index.js +2 -0
- package/dist/profile/index.js.map +1 -1
- package/dist/profile/profile.d.ts +3 -1
- package/dist/profile/profile.d.ts.map +1 -1
- package/dist/profile/profile.js +2 -2
- package/dist/profile/profile.js.map +1 -1
- package/package.json +1 -1
- package/src/theme/tokens.css +5 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { ApiKeysCard } from "./api-keys-card.js";
|
|
2
|
+
export type { ApiKeysCardLabels, ApiKeysCardProps } from "./api-keys-card.js";
|
|
3
|
+
export { CreateApiKeyDialog } from "./create-api-key-dialog.js";
|
|
4
|
+
export type { CreateApiKeyDialogLabels, CreateApiKeyDialogProps } from "./create-api-key-dialog.js";
|
|
5
|
+
export { ApiKeySecretReveal } from "./api-key-secret-reveal.js";
|
|
6
|
+
export type { ApiKeySecretRevealLabels, ApiKeySecretRevealProps } from "./api-key-secret-reveal.js";
|
|
7
|
+
export { RevokeApiKeyConfirm, RevokeConnectedAppConfirm } from "./revoke-confirm.js";
|
|
8
|
+
export type { RevokeConfirmLabels } from "./revoke-confirm.js";
|
|
9
|
+
export { ConnectedAppsCard } from "./connected-apps-card.js";
|
|
10
|
+
export type { ConnectedAppsCardLabels, ConnectedAppsCardProps } from "./connected-apps-card.js";
|
|
11
|
+
export { ProfileKeysSection } from "./profile-keys-section.js";
|
|
12
|
+
export type { ProfileKeysSectionLabels, ProfileKeysSectionProps } from "./profile-keys-section.js";
|
|
13
|
+
export { buildClientSnippets } from "./client-snippets.js";
|
|
14
|
+
export type { ClientSnippet, ClientSnippetId } from "./client-snippets.js";
|
|
15
|
+
export { createMockProfileKeysClient, sampleGrants, sampleKeys } from "./mock-client.js";
|
|
16
|
+
export type { MockClientOptions } from "./mock-client.js";
|
|
17
|
+
export { API_KEY_LIMITS, API_KEY_SURFACES, MCP_BASE_URL, SURFACE_CATALOG, mcpUrl, scopeLabel, summarizeScopes, } from "./types.js";
|
|
18
|
+
export type { ApiKeyRow, ApiKeyStatus, ApiKeySurface, CreateApiKeyInput, CreatedApiKey, OAuthGrantRow, ProfileKeysClient, ScopeInfo, SurfaceInfo, } from "./types.js";
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/profile/api-keys/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,YAAY,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,YAAY,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAClF,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,YAAY,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACtF,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,MAAM,EACN,UAAU,EACV,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,SAAS,EACT,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,WAAW,GACZ,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { ApiKeysCard } from "./api-keys-card.js";
|
|
2
|
+
export { CreateApiKeyDialog } from "./create-api-key-dialog.js";
|
|
3
|
+
export { ApiKeySecretReveal } from "./api-key-secret-reveal.js";
|
|
4
|
+
export { RevokeApiKeyConfirm, RevokeConnectedAppConfirm } from "./revoke-confirm.js";
|
|
5
|
+
export { ConnectedAppsCard } from "./connected-apps-card.js";
|
|
6
|
+
export { ProfileKeysSection } from "./profile-keys-section.js";
|
|
7
|
+
export { buildClientSnippets } from "./client-snippets.js";
|
|
8
|
+
export { createMockProfileKeysClient, sampleGrants, sampleKeys } from "./mock-client.js";
|
|
9
|
+
export { API_KEY_LIMITS, API_KEY_SURFACES, MCP_BASE_URL, SURFACE_CATALOG, mcpUrl, scopeLabel, summarizeScopes, } from "./types.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/profile/api-keys/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAElF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,2BAA2B,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtF,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,MAAM,EACN,UAAU,EACV,eAAe,GAChB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ApiKeyRow, type OAuthGrantRow, type ProfileKeysClient } from "./types.js";
|
|
2
|
+
export interface MockClientOptions {
|
|
3
|
+
keys?: ApiKeyRow[];
|
|
4
|
+
grants?: OAuthGrantRow[];
|
|
5
|
+
/** Artificial latency, ms. Default 0. */
|
|
6
|
+
delayMs?: number;
|
|
7
|
+
/** Make a method reject, for error-state stories. */
|
|
8
|
+
failOn?: Partial<Record<keyof ProfileKeysClient, string>>;
|
|
9
|
+
now?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* In-memory {@link ProfileKeysClient} for Storybook, tests and dashboard demos (the real
|
|
13
|
+
* backend routes, T11, are not built yet). The generated key has the real shape
|
|
14
|
+
* (`cnp_` + 43 chars + `_` + 6) but is random and works nowhere.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createMockProfileKeysClient(options?: MockClientOptions): ProfileKeysClient & {
|
|
17
|
+
/** Every raw key this mock ever issued, so tests can assert the secret never reappears. */
|
|
18
|
+
readonly issued: string[];
|
|
19
|
+
};
|
|
20
|
+
/** Realistic sample rows, relative to `now`, for stories. */
|
|
21
|
+
export declare function sampleKeys(now: number): ApiKeyRow[];
|
|
22
|
+
export declare function sampleGrants(now: number): OAuthGrantRow[];
|
|
23
|
+
//# sourceMappingURL=mock-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-client.d.ts","sourceRoot":"","sources":["../../../src/profile/api-keys/mock-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAGd,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACvB,MAAM,SAAS,CAAC;AAIjB,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;IACzB,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAMD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,GAAE,iBAAsB,GAAG,iBAAiB,GAAG;IAChG,2FAA2F;IAC3F,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;CAC3B,CAuDA;AAED,6DAA6D;AAC7D,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,CAoEnD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,EAAE,CAgCzD"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { API_KEY_LIMITS, } from "./types.js";
|
|
2
|
+
const DAY = 86_400_000;
|
|
3
|
+
const BASE62 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
4
|
+
const randomPart = (n) => Array.from({ length: n }, () => BASE62[Math.floor(Math.random() * BASE62.length)]).join("");
|
|
5
|
+
/**
|
|
6
|
+
* In-memory {@link ProfileKeysClient} for Storybook, tests and dashboard demos (the real
|
|
7
|
+
* backend routes, T11, are not built yet). The generated key has the real shape
|
|
8
|
+
* (`cnp_` + 43 chars + `_` + 6) but is random and works nowhere.
|
|
9
|
+
*/
|
|
10
|
+
export function createMockProfileKeysClient(options = {}) {
|
|
11
|
+
const now = options.now ?? Date.now();
|
|
12
|
+
let keys = [...(options.keys ?? [])];
|
|
13
|
+
let grants = [...(options.grants ?? [])];
|
|
14
|
+
const issued = [];
|
|
15
|
+
const wait = () => new Promise((resolve) => setTimeout(resolve, options.delayMs ?? 0));
|
|
16
|
+
const guard = async (method) => {
|
|
17
|
+
await wait();
|
|
18
|
+
const failure = options.failOn?.[method];
|
|
19
|
+
if (failure !== undefined)
|
|
20
|
+
throw new Error(failure);
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
issued,
|
|
24
|
+
async listKeys() {
|
|
25
|
+
await guard("listKeys");
|
|
26
|
+
return keys.map((k) => ({ ...k }));
|
|
27
|
+
},
|
|
28
|
+
async createKey(input) {
|
|
29
|
+
await guard("createKey");
|
|
30
|
+
const key = `cnp_${randomPart(43)}_${randomPart(6)}`;
|
|
31
|
+
issued.push(key);
|
|
32
|
+
const expiresAt = input.expiresAt !== undefined
|
|
33
|
+
? input.expiresAt
|
|
34
|
+
: new Date(now + (input.expiresInDays ?? API_KEY_LIMITS.defaultExpiryDays) * DAY).toISOString();
|
|
35
|
+
const row = {
|
|
36
|
+
id: `key-${keys.length + 1}-${randomPart(4)}`,
|
|
37
|
+
name: input.name,
|
|
38
|
+
surface: input.surface,
|
|
39
|
+
scopes: input.scopes,
|
|
40
|
+
prefix: key.slice(0, 12),
|
|
41
|
+
hint: key.slice(-4),
|
|
42
|
+
createdAt: new Date(now).toISOString(),
|
|
43
|
+
expiresAt,
|
|
44
|
+
lastUsedAt: null,
|
|
45
|
+
status: "active",
|
|
46
|
+
};
|
|
47
|
+
keys = [row, ...keys];
|
|
48
|
+
return { ...row, key };
|
|
49
|
+
},
|
|
50
|
+
async revokeKey(id) {
|
|
51
|
+
await guard("revokeKey");
|
|
52
|
+
keys = keys.map((k) => (k.id === id ? { ...k, status: "revoked" } : k));
|
|
53
|
+
},
|
|
54
|
+
async listGrants() {
|
|
55
|
+
await guard("listGrants");
|
|
56
|
+
return grants.map((g) => ({ ...g }));
|
|
57
|
+
},
|
|
58
|
+
async revokeGrant(id) {
|
|
59
|
+
await guard("revokeGrant");
|
|
60
|
+
grants = grants.filter((g) => g.id !== id);
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Realistic sample rows, relative to `now`, for stories. */
|
|
65
|
+
export function sampleKeys(now) {
|
|
66
|
+
const iso = (offsetDays) => new Date(now + offsetDays * DAY).toISOString();
|
|
67
|
+
return [
|
|
68
|
+
{
|
|
69
|
+
id: "k1",
|
|
70
|
+
name: "Claude Code on my laptop",
|
|
71
|
+
surface: "producer",
|
|
72
|
+
scopes: [
|
|
73
|
+
"portfolios:read",
|
|
74
|
+
"beverages:read",
|
|
75
|
+
"variants:read",
|
|
76
|
+
"offers:read",
|
|
77
|
+
"tenders:read",
|
|
78
|
+
"matching:read",
|
|
79
|
+
"extraction:read",
|
|
80
|
+
],
|
|
81
|
+
prefix: "cnp_Zk3p9Qx2",
|
|
82
|
+
hint: "f8Ke",
|
|
83
|
+
createdAt: iso(-40),
|
|
84
|
+
expiresAt: iso(50),
|
|
85
|
+
lastUsedAt: iso(-0.01),
|
|
86
|
+
status: "active",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: "k2",
|
|
90
|
+
name: "xAI research agent",
|
|
91
|
+
surface: "readonly",
|
|
92
|
+
scopes: [
|
|
93
|
+
"portfolios:read",
|
|
94
|
+
"beverages:read",
|
|
95
|
+
"variants:read",
|
|
96
|
+
"offers:read",
|
|
97
|
+
"tenders:read",
|
|
98
|
+
"matching:read",
|
|
99
|
+
"extraction:read",
|
|
100
|
+
],
|
|
101
|
+
prefix: "cnp_Mn84LpA1",
|
|
102
|
+
hint: "q9Tz",
|
|
103
|
+
createdAt: iso(-12),
|
|
104
|
+
expiresAt: iso(78),
|
|
105
|
+
lastUsedAt: iso(-3),
|
|
106
|
+
status: "active",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: "k3",
|
|
110
|
+
name: "Old CI experiment",
|
|
111
|
+
surface: "producer",
|
|
112
|
+
scopes: ["offers:read", "offers:write"],
|
|
113
|
+
prefix: "cnp_Hd02VbC7",
|
|
114
|
+
hint: "a1Xc",
|
|
115
|
+
createdAt: iso(-200),
|
|
116
|
+
expiresAt: iso(-20),
|
|
117
|
+
lastUsedAt: iso(-45),
|
|
118
|
+
status: "expired",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: "k4",
|
|
122
|
+
name: "Cursor (leaked, rotated)",
|
|
123
|
+
surface: "producer",
|
|
124
|
+
scopes: ["beverages:read"],
|
|
125
|
+
prefix: "cnp_Rt55NwE3",
|
|
126
|
+
hint: "b7Lm",
|
|
127
|
+
createdAt: iso(-90),
|
|
128
|
+
expiresAt: iso(0.5),
|
|
129
|
+
lastUsedAt: null,
|
|
130
|
+
status: "revoked",
|
|
131
|
+
},
|
|
132
|
+
];
|
|
133
|
+
}
|
|
134
|
+
export function sampleGrants(now) {
|
|
135
|
+
const iso = (offsetDays) => new Date(now + offsetDays * DAY).toISOString();
|
|
136
|
+
return [
|
|
137
|
+
{
|
|
138
|
+
id: "g1",
|
|
139
|
+
clientName: "ChatGPT",
|
|
140
|
+
clientHost: "chatgpt.com",
|
|
141
|
+
unverified: false,
|
|
142
|
+
surface: "producer",
|
|
143
|
+
scopes: ["portfolios:read", "beverages:read", "variants:read", "offers:read", "offers:write"],
|
|
144
|
+
createdAt: iso(-30),
|
|
145
|
+
lastUsedAt: iso(-1),
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: "g2",
|
|
149
|
+
clientName: "my-weekend-agent",
|
|
150
|
+
clientHost: "localhost",
|
|
151
|
+
unverified: true,
|
|
152
|
+
surface: "readonly",
|
|
153
|
+
scopes: [
|
|
154
|
+
"portfolios:read",
|
|
155
|
+
"beverages:read",
|
|
156
|
+
"variants:read",
|
|
157
|
+
"offers:read",
|
|
158
|
+
"tenders:read",
|
|
159
|
+
"matching:read",
|
|
160
|
+
"extraction:read",
|
|
161
|
+
],
|
|
162
|
+
createdAt: iso(-3),
|
|
163
|
+
lastUsedAt: null,
|
|
164
|
+
},
|
|
165
|
+
];
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=mock-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-client.js","sourceRoot":"","sources":["../../../src/profile/api-keys/mock-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,GAMf,MAAM,SAAS,CAAC;AAEjB,MAAM,GAAG,GAAG,UAAU,CAAC;AAYvB,MAAM,MAAM,GAAG,gEAAgE,CAAC;AAChF,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,EAAE,CAC/B,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAE9F;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,UAA6B,EAAE;IAIzE,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;IACtC,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;IACrC,IAAI,MAAM,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;IACzC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7F,MAAM,KAAK,GAAG,KAAK,EAAE,MAA+B,EAAE,EAAE;QACtD,MAAM,IAAI,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,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E,GAAG,CAAC,CAAC,EAAE,CAAC;YACnB,SAAS,EAAE,GAAG,CAAC,GAAG,CAAC;YACnB,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,SAAS;SAClB;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,MAAM,GAAG,GAAG,CAAC,UAAkB,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,GAAG,GAAG,UAAU,GAAG,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IACnF,OAAO;QACL;YACE,EAAE,EAAE,IAAI;YACR,UAAU,EAAE,SAAS;YACrB,UAAU,EAAE,aAAa;YACzB,UAAU,EAAE,KAAK;YACjB,OAAO,EAAE,UAAU;YACnB,MAAM,EAAE,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,CAAC;YAC7F,SAAS,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;YACnB,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;SACpB;QACD;YACE,EAAE,EAAE,IAAI;YACR,UAAU,EAAE,kBAAkB;YAC9B,UAAU,EAAE,WAAW;YACvB,UAAU,EAAE,IAAI;YAChB,OAAO,EAAE,UAAU;YACnB,MAAM,EAAE;gBACN,iBAAiB;gBACjB,gBAAgB;gBAChB,eAAe;gBACf,aAAa;gBACb,cAAc;gBACd,eAAe;gBACf,iBAAiB;aAClB;YACD,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;YAClB,UAAU,EAAE,IAAI;SACjB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ApiKeySecretRevealLabels } from "./api-key-secret-reveal.js";
|
|
2
|
+
import { type ApiKeysCardLabels } from "./api-keys-card.js";
|
|
3
|
+
import { type ConnectedAppsCardLabels } from "./connected-apps-card.js";
|
|
4
|
+
import { type CreateApiKeyDialogLabels } from "./create-api-key-dialog.js";
|
|
5
|
+
import { type RevokeConfirmLabels } from "./revoke-confirm.js";
|
|
6
|
+
import type { ApiKeySurface, ProfileKeysClient } from "./types.js";
|
|
7
|
+
export interface ProfileKeysSectionLabels {
|
|
8
|
+
keys?: ApiKeysCardLabels;
|
|
9
|
+
grants?: ConnectedAppsCardLabels;
|
|
10
|
+
create?: CreateApiKeyDialogLabels;
|
|
11
|
+
secret?: ApiKeySecretRevealLabels;
|
|
12
|
+
revokeKey?: RevokeConfirmLabels;
|
|
13
|
+
revokeApp?: RevokeConfirmLabels;
|
|
14
|
+
/** Shown when a revoke fails. */
|
|
15
|
+
actionFailed?: string;
|
|
16
|
+
/** Announced after a key is revoked. "{name}" placeholder. */
|
|
17
|
+
keyRevoked?: string;
|
|
18
|
+
/** Announced after an app is disconnected. "{name}" placeholder. */
|
|
19
|
+
appDisconnected?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ProfileKeysSectionProps {
|
|
22
|
+
client: ProfileKeysClient;
|
|
23
|
+
/** Surfaces this org may offer when creating a key (never `admin`). */
|
|
24
|
+
surfaces?: readonly ApiKeySurface[] | undefined;
|
|
25
|
+
locale?: string | undefined;
|
|
26
|
+
now?: number | undefined;
|
|
27
|
+
mcpBaseUrl?: string | undefined;
|
|
28
|
+
labels?: ProfileKeysSectionLabels | undefined;
|
|
29
|
+
className?: string | undefined;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Both cards plus every dialog, wired to an injected {@link ProfileKeysClient}. Dashboards render
|
|
33
|
+
* this once (between the subscription and account-actions cards) and pass their own client.
|
|
34
|
+
*/
|
|
35
|
+
export declare function ProfileKeysSection({ client, surfaces, locale, now, mcpBaseUrl, labels, className, }: ProfileKeysSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
//# sourceMappingURL=profile-keys-section.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-keys-section.d.ts","sourceRoot":"","sources":["../../../src/profile/api-keys/profile-keys-section.tsx"],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ACjC,MAAM,EACN,QAAQ,EACR,MAAM,EACN,GAAG,EACH,UAAU,EACV,MAAM,EACN,SAAS,GACV,EAAE,uBAAuB,2CAsJzB"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { fmt } from "./format.js";
|
|
4
|
+
import { ApiKeySecretReveal } from "./api-key-secret-reveal.js";
|
|
5
|
+
import { ApiKeysCard } from "./api-keys-card.js";
|
|
6
|
+
import { ConnectedAppsCard } from "./connected-apps-card.js";
|
|
7
|
+
import { CreateApiKeyDialog } from "./create-api-key-dialog.js";
|
|
8
|
+
import { RevokeApiKeyConfirm, RevokeConnectedAppConfirm, } from "./revoke-confirm.js";
|
|
9
|
+
function useLoader(client, method) {
|
|
10
|
+
const [state, setState] = React.useState({
|
|
11
|
+
data: undefined,
|
|
12
|
+
isLoading: true,
|
|
13
|
+
isError: false,
|
|
14
|
+
});
|
|
15
|
+
const [tick, setTick] = React.useState(0);
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
let live = true;
|
|
18
|
+
// eslint-disable-next-line @eslint-react/set-state-in-effect -- a reload returns to the loading state; the result arrives async
|
|
19
|
+
setState((s) => ({ ...s, isLoading: s.data === undefined, isError: false }));
|
|
20
|
+
client[method]().then((data) => live && setState({ data, isLoading: false, isError: false }), () => live && setState((s) => ({ ...s, isLoading: false, isError: true })));
|
|
21
|
+
return () => {
|
|
22
|
+
live = false;
|
|
23
|
+
};
|
|
24
|
+
}, [client, method, tick]);
|
|
25
|
+
return { ...state, reload: () => setTick((n) => n + 1) };
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Both cards plus every dialog, wired to an injected {@link ProfileKeysClient}. Dashboards render
|
|
29
|
+
* this once (between the subscription and account-actions cards) and pass their own client.
|
|
30
|
+
*/
|
|
31
|
+
export function ProfileKeysSection({ client, surfaces, locale, now, mcpBaseUrl, labels, className, }) {
|
|
32
|
+
const keys = useLoader(client, "listKeys");
|
|
33
|
+
const grants = useLoader(client, "listGrants");
|
|
34
|
+
const [creating, setCreating] = React.useState(false);
|
|
35
|
+
const [revealed, setRevealed] = React.useState(null);
|
|
36
|
+
const [revokingKey, setRevokingKey] = React.useState(null);
|
|
37
|
+
const [revokingApp, setRevokingApp] = React.useState(null);
|
|
38
|
+
const [actionError, setActionError] = React.useState(false);
|
|
39
|
+
const [notice, setNotice] = React.useState("");
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
if (!notice)
|
|
42
|
+
return;
|
|
43
|
+
const t = setTimeout(() => setNotice(""), 8000);
|
|
44
|
+
return () => clearTimeout(t);
|
|
45
|
+
}, [notice]);
|
|
46
|
+
const ids = React.useId();
|
|
47
|
+
const keysHeadingId = `${ids}-keys`;
|
|
48
|
+
const appsHeadingId = `${ids}-apps`;
|
|
49
|
+
// After a revoke the row that opened the dialog is gone. The dialog reports when it has left the
|
|
50
|
+
// DOM (`onClosed`), and only then do we move focus to the card heading.
|
|
51
|
+
const pendingFocus = React.useRef(null);
|
|
52
|
+
const afterDialogClosed = () => {
|
|
53
|
+
const id = pendingFocus.current;
|
|
54
|
+
pendingFocus.current = null;
|
|
55
|
+
if (id)
|
|
56
|
+
requestAnimationFrame(() => document.getElementById(id)?.focus());
|
|
57
|
+
};
|
|
58
|
+
const create = async (input) => {
|
|
59
|
+
const created = await client.createKey(input);
|
|
60
|
+
setCreating(false);
|
|
61
|
+
setRevealed({ key: created.key, name: created.name, surface: created.surface });
|
|
62
|
+
keys.reload();
|
|
63
|
+
};
|
|
64
|
+
const guarded = async (run, done, headingId) => {
|
|
65
|
+
setActionError(false);
|
|
66
|
+
setNotice("");
|
|
67
|
+
try {
|
|
68
|
+
setNotice(await run());
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
setActionError(true);
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
done();
|
|
75
|
+
// The row that held focus is gone: send focus to the card heading.
|
|
76
|
+
pendingFocus.current = headingId;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return (_jsxs("div", { className: className ? `flex flex-col gap-6 ${className}` : "flex flex-col gap-6", children: [_jsx("div", { role: "status", className: notice
|
|
80
|
+
? "rounded-lg bg-(--tone-success-soft) px-3 py-2 text-sm/6 text-(--tone-success-fg)"
|
|
81
|
+
: "sr-only", children: notice }), actionError ? (_jsx("p", { role: "alert", className: "rounded-lg bg-(--tone-danger-soft) px-3 py-2 text-sm/6 text-(--tone-danger-fg)", children: labels?.actionFailed ?? "That did not work. Try again." })) : null, _jsx(ApiKeysCard, { keys: keys.data, isLoading: keys.isLoading, isError: keys.isError, onRetry: keys.reload, onCreate: () => setCreating(true), onRevoke: setRevokingKey, headingId: keysHeadingId, locale: locale, now: now, labels: labels?.keys }), _jsx(ConnectedAppsCard, { grants: grants.data, isLoading: grants.isLoading, isError: grants.isError, onRetry: grants.reload, onRevoke: setRevokingApp, headingId: appsHeadingId, locale: locale, now: now, labels: labels?.grants }), _jsx(CreateApiKeyDialog, { open: creating, onClose: () => setCreating(false), onSubmit: create, surfaces: surfaces, now: now, labels: labels?.create }), _jsx(ApiKeySecretReveal, { secret: revealed?.key ?? null, keyName: revealed?.name ?? "", surface: revealed?.surface ?? "readonly", mcpBaseUrl: mcpBaseUrl, labels: labels?.secret, onClose: () => setRevealed(null) }), _jsx(RevokeApiKeyConfirm, { apiKey: revokingKey, labels: labels?.revokeKey, onClosed: afterDialogClosed, onClose: () => setRevokingKey(null), onConfirm: () => guarded(async () => {
|
|
82
|
+
if (!revokingKey)
|
|
83
|
+
return "";
|
|
84
|
+
await client.revokeKey(revokingKey.id);
|
|
85
|
+
keys.reload();
|
|
86
|
+
return fmt(labels?.keyRevoked ?? "Key {name} revoked.", { name: revokingKey.name });
|
|
87
|
+
}, () => setRevokingKey(null), keysHeadingId) }), _jsx(RevokeConnectedAppConfirm, { grant: revokingApp, labels: labels?.revokeApp, onClosed: afterDialogClosed, onClose: () => setRevokingApp(null), onConfirm: () => guarded(async () => {
|
|
88
|
+
if (!revokingApp)
|
|
89
|
+
return "";
|
|
90
|
+
await client.revokeGrant(revokingApp.id);
|
|
91
|
+
grants.reload();
|
|
92
|
+
return fmt(labels?.appDisconnected ?? "{name} disconnected.", {
|
|
93
|
+
name: revokingApp.clientName,
|
|
94
|
+
});
|
|
95
|
+
}, () => setRevokingApp(null), appsHeadingId) })] }));
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=profile-keys-section.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-keys-section.js","sourceRoot":"","sources":["../../../src/profile/api-keys/profile-keys-section.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAiC,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAE,WAAW,EAA0B,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAgC,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAiC,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EACL,mBAAmB,EACnB,yBAAyB,GAE1B,MAAM,kBAAkB,CAAC;AAgB1B,SAAS,SAAS,CAChB,MAAyB,EACzB,MAAiC;IAEjC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAY;QAClD,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,KAAK;KACf,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC1C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,gIAAgI;QAChI,QAAQ,C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
|
5
|
+
description?: string;
|
|
6
|
+
warning?: string;
|
|
7
|
+
confirm?: string;
|
|
8
|
+
cancel?: string;
|
|
9
|
+
}
|
|
10
|
+
interface BaseProps {
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
/** Resolve to close; the button shows a loading state meanwhile. */
|
|
13
|
+
onConfirm: () => void | Promise<void>;
|
|
14
|
+
isPending?: boolean;
|
|
15
|
+
/** Called after the dialog left the DOM (to move focus somewhere that still exists). */
|
|
16
|
+
onClosed?: (() => void) | undefined;
|
|
17
|
+
labels?: RevokeConfirmLabels | undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare function RevokeApiKeyConfirm({ apiKey, onClose, onConfirm, isPending, onClosed, labels, }: BaseProps & {
|
|
20
|
+
apiKey: ApiKeyRow | null;
|
|
21
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function RevokeConnectedAppConfirm({ grant, onClose, onConfirm, isPending, onClosed, labels, }: BaseProps & {
|
|
23
|
+
grant: OAuthGrantRow | null;
|
|
24
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=revoke-confirm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revoke-confirm.d.ts","sourceRoot":"","sources":["../../../src/profile/api-keys/revoke-confirm.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExD,MAAM,WAAW,mBAAmB;IAClC,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAoBD,UAAU,SAAS;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,oEAAoE;IACpE,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACpC,MAAM,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;CAC1C;AAED,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,OAAO,EACP,SAAS,EACT,SAAS,EACT,QAAQ,EACR,MAAM,GACP,EAAE,SAAS,GAAG;IAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CAAA;CAAE,2CAiB1C;AAED,wBAAgB,yBAAyB,CAAC,EACxC,KAAK,EACL,OAAO,EACP,SAAS,EACT,SAAS,EACT,QAAQ,EACR,MAAM,GACP,EAAE,SAAS,GAAG;IAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;CAAE,2CAiB7C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ConfirmationDialog } from "../../components/confirmation-dialog.js";
|
|
3
|
+
import { fmt } from "./format.js";
|
|
4
|
+
const KEY_DEFAULTS = {
|
|
5
|
+
title: "Revoke {name}?",
|
|
6
|
+
description: "Any tool using this key stops working right away. You can create a new key at any time.",
|
|
7
|
+
warning: "",
|
|
8
|
+
confirm: "Revoke key",
|
|
9
|
+
cancel: "Keep key",
|
|
10
|
+
};
|
|
11
|
+
const APP_DEFAULTS = {
|
|
12
|
+
title: "Disconnect {name}?",
|
|
13
|
+
description: "The app loses access to your CellarNode data right away. You can connect it again later.",
|
|
14
|
+
warning: "",
|
|
15
|
+
confirm: "Disconnect",
|
|
16
|
+
cancel: "Keep connected",
|
|
17
|
+
};
|
|
18
|
+
export function RevokeApiKeyConfirm({ apiKey, onClose, onConfirm, isPending, onClosed, labels, }) {
|
|
19
|
+
const l = { ...KEY_DEFAULTS, ...labels };
|
|
20
|
+
return (_jsx(ConfirmationDialog, { open: apiKey !== null, onClose: onClose, onConfirm: onConfirm, tone: "danger", title: fmt(l.title, { name: apiKey?.name ?? "" }), description: l.description, ...(l.warning ? { warning: l.warning } : {}), confirmLabel: l.confirm, cancelLabel: l.cancel, ...(isPending !== undefined ? { isPending } : {}), ...(onClosed !== undefined ? { onClosed } : {}) }));
|
|
21
|
+
}
|
|
22
|
+
export function RevokeConnectedAppConfirm({ grant, onClose, onConfirm, isPending, onClosed, labels, }) {
|
|
23
|
+
const l = { ...APP_DEFAULTS, ...labels };
|
|
24
|
+
return (_jsx(ConfirmationDialog, { open: grant !== null, onClose: onClose, onConfirm: onConfirm, tone: "danger", title: fmt(l.title, { name: grant?.clientName ?? "" }), description: l.description, ...(l.warning ? { warning: l.warning } : {}), confirmLabel: l.confirm, cancelLabel: l.cancel, ...(isPending !== undefined ? { isPending } : {}), ...(onClosed !== undefined ? { onClosed } : {}) }));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=revoke-confirm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revoke-confirm.js","sourceRoot":"","sources":["../../../src/profile/api-keys/revoke-confirm.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAY/B,MAAM,YAAY,GAAG;IACnB,KAAK,EAAE,gBAAgB;IACvB,WAAW,EACT,yFAAyF;IAC3F,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,UAAU;CACnB,CAAC;AAEF,MAAM,YAAY,GAAG;IACnB,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EACT,0FAA0F;IAC5F,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,gBAAgB;CACzB,CAAC;AAYF,MAAM,UAAU,mBAAmB,CAAC,EAClC,MAAM,EACN,OAAO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E,UAAU,IAAI,EAAE,EAAE,CAAC,EACtD,WAAW,EAAE,CAAC,CAAC,WAAW,KACtB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAC7C,YAAY,EAAE,CAAC,CAAC,OAAO,EACvB,WAAW,EAAE,CAAC,CAAC,MAAM,KACjB,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAC9C,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAChD,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type SurfaceId } from "./types.js";
|
|
3
|
+
export interface ScopeListLabels {
|
|
4
|
+
readOnly?: string;
|
|
5
|
+
readAndChange?: string;
|
|
6
|
+
custom?: string;
|
|
7
|
+
/** "{count}" placeholder. */
|
|
8
|
+
viewPermissions?: string;
|
|
9
|
+
/** Singular form, used when exactly one scope. "{count}" placeholder. */
|
|
10
|
+
viewPermissionsOne?: string;
|
|
11
|
+
/** Used when the disclosure also holds extra detail (e.g. the created date). */
|
|
12
|
+
viewPermissionsAndDetails?: string;
|
|
13
|
+
/** Names a surface in the surface badge, e.g. map producer -> "Producer". Falls back to the catalog label. */
|
|
14
|
+
surfaces?: Partial<Record<string, string>>;
|
|
15
|
+
}
|
|
16
|
+
export declare const DEFAULT_SCOPE_LABELS: {
|
|
17
|
+
readOnly: string;
|
|
18
|
+
readAndChange: string;
|
|
19
|
+
custom: string;
|
|
20
|
+
viewPermissions: string;
|
|
21
|
+
viewPermissionsOne: string;
|
|
22
|
+
viewPermissionsAndDetails: string;
|
|
23
|
+
};
|
|
24
|
+
/** One line summarising a grant ("Read only"), with the plain-language permission list on demand. */
|
|
25
|
+
export declare function ScopeList({ surface, scopes, labels, children, }: {
|
|
26
|
+
surface: SurfaceId;
|
|
27
|
+
scopes: readonly string[];
|
|
28
|
+
labels?: ScopeListLabels | undefined;
|
|
29
|
+
/** Extra detail shown inside the disclosure (e.g. the created date). */
|
|
30
|
+
children?: React.ReactNode;
|
|
31
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare function SurfaceBadge({ surface, labels, }: {
|
|
33
|
+
surface: SurfaceId;
|
|
34
|
+
labels?: ScopeListLabels | undefined;
|
|
35
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
//# sourceMappingURL=scope-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-list.d.ts","sourceRoot":"","sources":["../../../src/profile/api-keys/scope-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAA4C,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAEnF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6BAA6B;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gFAAgF;IAChF,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,8GAA8G;IAC9G,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5C;AAED,eAAO,MAAM,oBAAoB;;;;;;;CAOhC,CAAC;AAEF,qGAAqG;AACrG,wBAAgB,SAAS,CAAC,EACxB,OAAO,EACP,MAAM,EACN,MAAM,EACN,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IACrC,wEAAwE;IACxE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,2CA+BA;AAED,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,MAAM,GACP,EAAE;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;CACtC,2CAMA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Badge } from "../../components/badge.js";
|
|
3
|
+
import { fmt } from "./format.js";
|
|
4
|
+
import { scopeLabel, summarizeScopes, surfaceInfo } from "./types.js";
|
|
5
|
+
export const DEFAULT_SCOPE_LABELS = {
|
|
6
|
+
readOnly: "Read only",
|
|
7
|
+
readAndChange: "Read and change",
|
|
8
|
+
custom: "Custom access",
|
|
9
|
+
viewPermissions: "{count} permissions",
|
|
10
|
+
viewPermissionsOne: "{count} permission",
|
|
11
|
+
viewPermissionsAndDetails: "{count} permissions and details",
|
|
12
|
+
};
|
|
13
|
+
/** One line summarising a grant ("Read only"), with the plain-language permission list on demand. */
|
|
14
|
+
export function ScopeList({ surface, scopes, labels, children, }) {
|
|
15
|
+
const l = { ...DEFAULT_SCOPE_LABELS, ...labels };
|
|
16
|
+
const kind = summarizeScopes(surface, scopes);
|
|
17
|
+
const summary = kind === "read" ? l.readOnly : kind === "write" ? l.readAndChange : l.custom;
|
|
18
|
+
return (_jsxs("div", { className: "text-sm/6 text-foreground", children: [_jsx("span", { className: "font-medium", children: summary }), _jsxs("details", { className: "mt-1 text-muted-foreground", children: [_jsx("summary", { className: "inline-flex min-h-11 cursor-pointer items-center rounded-sm text-sm/6 underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring sm:min-h-6", children: fmt(children
|
|
19
|
+
? l.viewPermissionsAndDetails
|
|
20
|
+
: scopes.length === 1
|
|
21
|
+
? l.viewPermissionsOne
|
|
22
|
+
: l.viewPermissions, {
|
|
23
|
+
count: scopes.length,
|
|
24
|
+
}) }), _jsx("ul", { className: "mt-1 flex flex-col gap-0.5 pl-4", children: scopes.map((id) => (_jsx("li", { className: "list-disc", children: scopeLabel(surface, id) }, id))) }), children ? _jsx("div", { className: "mt-2", children: children }) : null] })] }));
|
|
25
|
+
}
|
|
26
|
+
export function SurfaceBadge({ surface, labels, }) {
|
|
27
|
+
return (_jsx(Badge, { color: "info", className: "shrink-0 whitespace-nowrap", children: labels?.surfaces?.[surface] ?? surfaceInfo(surface).label }));
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=scope-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-list.js","sourceRoot":"","sources":["../../../src/profile/api-keys/scope-list.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAkB,MAAM,SAAS,CAAC;AAgBnF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,QAAQ,EAAE,WAAW;IACrB,aAAa,EAAE,iBAAiB;IAChC,MAAM,EAAE,eAAe;IACvB,eAAe,EAAE,qBAAqB;IACtC,kBAAkB,EAAE,oBAAoB;IACxC,yBAAyB,EAAE,iCAAiC;CAC7D,CAAC;AAEF,qGAAqG;AACrG,MAAM,UAAU,SAAS,CAAC,EACxB,OAAO,EACP,MAAM,EACN,MAAM,EACN,QAAQ,GAOT;IACC,MAAM,CAAC,GAAG,EAAE,GAAG,oBAAoB,EAAE,GAAG,MAAM,EAAE,CAAC;IACjD,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,IAAI,KAAK,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