@owlmeans/web-auth-token 0.1.18-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -0
- package/agent-meta/manifest.json +16 -0
- package/agent-meta/skills/web-auth-token/SKILL.md +128 -0
- package/build/@/components/ui/alert.d.ts +10 -0
- package/build/@/components/ui/alert.d.ts.map +1 -0
- package/build/@/components/ui/alert.js +26 -0
- package/build/@/components/ui/alert.js.map +1 -0
- package/build/@/components/ui/badge.d.ts +10 -0
- package/build/@/components/ui/badge.d.ts.map +1 -0
- package/build/@/components/ui/badge.js +23 -0
- package/build/@/components/ui/badge.js.map +1 -0
- package/build/@/components/ui/button.d.ts +11 -0
- package/build/@/components/ui/button.d.ts.map +1 -0
- package/build/@/components/ui/button.js +32 -0
- package/build/@/components/ui/button.js.map +1 -0
- package/build/@/components/ui/card.d.ts +10 -0
- package/build/@/components/ui/card.d.ts.map +1 -0
- package/build/@/components/ui/card.js +25 -0
- package/build/@/components/ui/card.js.map +1 -0
- package/build/@/components/ui/dialog.d.ts +17 -0
- package/build/@/components/ui/dialog.d.ts.map +1 -0
- package/build/@/components/ui/dialog.js +36 -0
- package/build/@/components/ui/dialog.js.map +1 -0
- package/build/@/components/ui/input.d.ts +4 -0
- package/build/@/components/ui/input.d.ts.map +1 -0
- package/build/@/components/ui/input.js +7 -0
- package/build/@/components/ui/input.js.map +1 -0
- package/build/@/components/ui/label.d.ts +5 -0
- package/build/@/components/ui/label.d.ts.map +1 -0
- package/build/@/components/ui/label.js +8 -0
- package/build/@/components/ui/label.js.map +1 -0
- package/build/@/components/ui/select.d.ts +16 -0
- package/build/@/components/ui/select.d.ts.map +1 -0
- package/build/@/components/ui/select.js +38 -0
- package/build/@/components/ui/select.js.map +1 -0
- package/build/@/components/ui/table.d.ts +11 -0
- package/build/@/components/ui/table.d.ts.map +1 -0
- package/build/@/components/ui/table.js +28 -0
- package/build/@/components/ui/table.js.map +1 -0
- package/build/@/lib/utils.d.ts +3 -0
- package/build/@/lib/utils.d.ts.map +1 -0
- package/build/@/lib/utils.js +6 -0
- package/build/@/lib/utils.js.map +1 -0
- package/build/components/connected.d.ts +16 -0
- package/build/components/connected.d.ts.map +1 -0
- package/build/components/connected.js +14 -0
- package/build/components/connected.js.map +1 -0
- package/build/components/index.d.ts +3 -0
- package/build/components/index.d.ts.map +1 -0
- package/build/components/index.js +3 -0
- package/build/components/index.js.map +1 -0
- package/build/components/panel.d.ts +11 -0
- package/build/components/panel.d.ts.map +1 -0
- package/build/components/panel.js +119 -0
- package/build/components/panel.js.map +1 -0
- package/build/consts.d.ts +19 -0
- package/build/consts.d.ts.map +1 -0
- package/build/consts.js +19 -0
- package/build/consts.js.map +1 -0
- package/build/helpers.d.ts +18 -0
- package/build/helpers.d.ts.map +1 -0
- package/build/helpers.js +45 -0
- package/build/helpers.js.map +1 -0
- package/build/hooks/use-access-tokens.d.ts +11 -0
- package/build/hooks/use-access-tokens.d.ts.map +1 -0
- package/build/hooks/use-access-tokens.js +74 -0
- package/build/hooks/use-access-tokens.js.map +1 -0
- package/build/i18n/be.json +51 -0
- package/build/i18n/de.json +51 -0
- package/build/i18n/en.json +51 -0
- package/build/i18n/es.json +51 -0
- package/build/i18n/pl.json +51 -0
- package/build/i18n/ru.json +51 -0
- package/build/i18n/uk.json +51 -0
- package/build/i18n.d.ts +2 -0
- package/build/i18n.d.ts.map +1 -0
- package/build/i18n.js +17 -0
- package/build/i18n.js.map +1 -0
- package/build/index.d.ts +8 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +7 -0
- package/build/index.js.map +1 -0
- package/build/types.d.ts +54 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/build/utils.d.ts +13 -0
- package/build/utils.d.ts.map +1 -0
- package/build/utils.js +14 -0
- package/build/utils.js.map +1 -0
- package/components.json +21 -0
- package/package.json +68 -0
- package/src/@/components/ui/alert.tsx +70 -0
- package/src/@/components/ui/badge.tsx +47 -0
- package/src/@/components/ui/button.tsx +60 -0
- package/src/@/components/ui/card.tsx +93 -0
- package/src/@/components/ui/dialog.tsx +147 -0
- package/src/@/components/ui/input.tsx +22 -0
- package/src/@/components/ui/label.tsx +23 -0
- package/src/@/components/ui/select.tsx +184 -0
- package/src/@/components/ui/table.tsx +115 -0
- package/src/@/globals.css +57 -0
- package/src/@/lib/utils.ts +6 -0
- package/src/components/connected.tsx +34 -0
- package/src/components/index.ts +2 -0
- package/src/components/panel.tsx +310 -0
- package/src/consts.ts +21 -0
- package/src/helpers.ts +50 -0
- package/src/hooks/use-access-tokens.ts +83 -0
- package/src/i18n/be.json +51 -0
- package/src/i18n/de.json +51 -0
- package/src/i18n/en.json +51 -0
- package/src/i18n/es.json +51 -0
- package/src/i18n/pl.json +51 -0
- package/src/i18n/ru.json +51 -0
- package/src/i18n/uk.json +51 -0
- package/src/i18n.ts +18 -0
- package/src/index.ts +7 -0
- package/src/types.ts +59 -0
- package/src/utils.ts +14 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../src/@/components/ui/select.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAExE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAEhC,SAAS,MAAM,CAAC,EACd,GAAG,KAAK,EAC0C;IAClD,OAAO,KAAC,eAAe,CAAC,IAAI,iBAAW,QAAQ,KAAK,KAAK,GAAI,CAAA;AAC/D,CAAC;AAED,SAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EAC2C;IACnD,OAAO,KAAC,eAAe,CAAC,KAAK,iBAAW,cAAc,KAAK,KAAK,GAAI,CAAA;AACtE,CAAC;AAED,SAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EA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GACZ,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare function Table({ className, ...props }: React.ComponentProps<"table">): React.JSX.Element;
|
|
3
|
+
declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
|
|
4
|
+
declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
|
|
5
|
+
declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): React.JSX.Element;
|
|
6
|
+
declare function TableRow({ className, ...props }: React.ComponentProps<"tr">): React.JSX.Element;
|
|
7
|
+
declare function TableHead({ className, ...props }: React.ComponentProps<"th">): React.JSX.Element;
|
|
8
|
+
declare function TableCell({ className, ...props }: React.ComponentProps<"td">): React.JSX.Element;
|
|
9
|
+
declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): React.JSX.Element;
|
|
10
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
11
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/@/components/ui/table.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,iBAAS,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,qBAapE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,qBAQ1E;AAED,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,qBAQxE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,qBAW1E;AAED,iBAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBAWpE;AAED,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBAWrE;AAED,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,qBAWrE;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,qBAQjC;AAED,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,GACb,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '@/lib/utils';
|
|
3
|
+
function Table({ className, ...props }) {
|
|
4
|
+
return (_jsx("div", { "data-slot": "table-container", className: "relative w-full overflow-x-auto", children: _jsx("table", { "data-slot": "table", className: cn("w-full caption-bottom text-sm", className), ...props }) }));
|
|
5
|
+
}
|
|
6
|
+
function TableHeader({ className, ...props }) {
|
|
7
|
+
return (_jsx("thead", { "data-slot": "table-header", className: cn("[&_tr]:border-b", className), ...props }));
|
|
8
|
+
}
|
|
9
|
+
function TableBody({ className, ...props }) {
|
|
10
|
+
return (_jsx("tbody", { "data-slot": "table-body", className: cn("[&_tr:last-child]:border-0", className), ...props }));
|
|
11
|
+
}
|
|
12
|
+
function TableFooter({ className, ...props }) {
|
|
13
|
+
return (_jsx("tfoot", { "data-slot": "table-footer", className: cn("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0", className), ...props }));
|
|
14
|
+
}
|
|
15
|
+
function TableRow({ className, ...props }) {
|
|
16
|
+
return (_jsx("tr", { "data-slot": "table-row", className: cn("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors", className), ...props }));
|
|
17
|
+
}
|
|
18
|
+
function TableHead({ className, ...props }) {
|
|
19
|
+
return (_jsx("th", { "data-slot": "table-head", className: cn("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props }));
|
|
20
|
+
}
|
|
21
|
+
function TableCell({ className, ...props }) {
|
|
22
|
+
return (_jsx("td", { "data-slot": "table-cell", className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props }));
|
|
23
|
+
}
|
|
24
|
+
function TableCaption({ className, ...props }) {
|
|
25
|
+
return (_jsx("caption", { "data-slot": "table-caption", className: cn("text-muted-foreground mt-4 text-sm", className), ...props }));
|
|
26
|
+
}
|
|
27
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
28
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../../src/@/components/ui/table.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAEhC,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAiC;IACnE,OAAO,CACL,2BACY,iBAAiB,EAC3B,SAAS,EAAC,iCAAiC,YAE3C,6BACY,OAAO,EACjB,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,KACrD,KAAK,GACT,GACE,CACP,CAAA;AACH,CAAC;AAED,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAiC;IACzE,OAAO,CACL,6BACY,cAAc,EACxB,SAAS,EAAE,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,KAC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,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/@/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAG5C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/@/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,MAAM,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,MAAM,UAAU,EAAE,CAAC,GAAG,MAAoB;IACxC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;AAC9B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { AccessTokensAliases } from '../types.js';
|
|
3
|
+
export interface ConnectedAccessTokensPanelProps {
|
|
4
|
+
/** Override where the three routes are mounted. Defaults to the `authToken` alias tree. */
|
|
5
|
+
aliases?: AccessTokensAliases;
|
|
6
|
+
/** Already-translated copy shown beside a freshly issued token — see `AccessTokensPanelProps`. */
|
|
7
|
+
usageHint?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The panel wired to the token entrypoints of the current context.
|
|
11
|
+
*
|
|
12
|
+
* This is the whole feature in one element, and the only piece that talks to a server. Anything
|
|
13
|
+
* that needs a different transport renders `AccessTokensPanel` against its own state instead.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ConnectedAccessTokensPanel: FC<ConnectedAccessTokensPanelProps>;
|
|
16
|
+
//# sourceMappingURL=connected.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connected.d.ts","sourceRoot":"","sources":["../../src/components/connected.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAG/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEtD,MAAM,WAAW,+BAA+B;IAC9C,2FAA2F;IAC3F,OAAO,CAAC,EAAE,mBAAmB,CAAA;IAC7B,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,EAAE,EAAE,CAAC,+BAA+B,CAe1E,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useAccessTokens } from '../hooks/use-access-tokens.js';
|
|
3
|
+
import { AccessTokensPanel } from './panel.js';
|
|
4
|
+
/**
|
|
5
|
+
* The panel wired to the token entrypoints of the current context.
|
|
6
|
+
*
|
|
7
|
+
* This is the whole feature in one element, and the only piece that talks to a server. Anything
|
|
8
|
+
* that needs a different transport renders `AccessTokensPanel` against its own state instead.
|
|
9
|
+
*/
|
|
10
|
+
export const ConnectedAccessTokensPanel = ({ aliases, usageHint }) => {
|
|
11
|
+
const { items, issued, loading, error, create, revoke, dismissIssued } = useAccessTokens(aliases);
|
|
12
|
+
return _jsx(AccessTokensPanel, { items: items, issued: issued, loading: loading, error: error, onCreate: create, onRevoke: revoke, onDismissIssued: dismissIssued, usageHint: usageHint });
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=connected.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connected.js","sourceRoot":"","sources":["../../src/components/connected.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAU9C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAwC,CAAC,EAC9E,OAAO,EAAE,SAAS,EACnB,EAAE,EAAE;IACH,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;IAEjG,OAAO,KAAC,iBAAiB,IACvB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,aAAa,EAC9B,SAAS,EAAE,SAAS,GACpB,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { AccessTokensPanelProps } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The access-token management surface.
|
|
5
|
+
*
|
|
6
|
+
* Presentational by contract: it performs no I/O of its own, renders exactly what it is given and
|
|
7
|
+
* reports what the user pressed. `ConnectedAccessTokensPanel` is this component wired to
|
|
8
|
+
* `useAccessTokens`; an application with its own transport mounts this one directly.
|
|
9
|
+
*/
|
|
10
|
+
export declare const AccessTokensPanel: FC<AccessTokensPanelProps>;
|
|
11
|
+
//# sourceMappingURL=panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../../src/components/panel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAa,MAAM,OAAO,CAAA;AAyB1C,OAAO,KAAK,EAAqB,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAc5E;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAsQxD,CAAA"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useId, useState } from 'react';
|
|
3
|
+
import { useI18nLib, useLanguage } from '@owlmeans/client-i18n';
|
|
4
|
+
import { AUTH_TOKEN_NAME_MAX } from '@owlmeans/auth-token';
|
|
5
|
+
import { Check, Copy, Loader2, Plus, Trash2 } from 'lucide-react';
|
|
6
|
+
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
|
|
7
|
+
import { Badge } from '@/components/ui/badge';
|
|
8
|
+
import { Button } from '@/components/ui/button';
|
|
9
|
+
import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
|
10
|
+
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
|
11
|
+
import { Input } from '@/components/ui/input';
|
|
12
|
+
import { Label } from '@/components/ui/label';
|
|
13
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
|
14
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
|
15
|
+
import { AUTH_TOKEN_I18N, DAY_SECONDS, TOKEN_EXPIRY_CHOICES, TOKEN_EXPIRY_NEVER } from '../consts.js';
|
|
16
|
+
import { formatMoment, tokenStatus } from '../helpers.js';
|
|
17
|
+
/**
|
|
18
|
+
* A revoked token stays in the list so its name still resolves, and it must not read like a
|
|
19
|
+
* working one — so only `active` gets the filled badge, and the two dead states are quiet.
|
|
20
|
+
*/
|
|
21
|
+
const STATUS_VARIANT = {
|
|
22
|
+
active: 'default',
|
|
23
|
+
expired: 'secondary',
|
|
24
|
+
revoked: 'outline',
|
|
25
|
+
};
|
|
26
|
+
const COLUMNS = 7;
|
|
27
|
+
/**
|
|
28
|
+
* The access-token management surface.
|
|
29
|
+
*
|
|
30
|
+
* Presentational by contract: it performs no I/O of its own, renders exactly what it is given and
|
|
31
|
+
* reports what the user pressed. `ConnectedAccessTokensPanel` is this component wired to
|
|
32
|
+
* `useAccessTokens`; an application with its own transport mounts this one directly.
|
|
33
|
+
*/
|
|
34
|
+
export const AccessTokensPanel = ({ items, issued, loading, error, onCreate, onRevoke, onDismissIssued, usageHint }) => {
|
|
35
|
+
const t = useI18nLib(AUTH_TOKEN_I18N, 'panel');
|
|
36
|
+
const [lng] = useLanguage();
|
|
37
|
+
const fieldId = useId();
|
|
38
|
+
const [createOpen, setCreateOpen] = useState(false);
|
|
39
|
+
const [name, setName] = useState('');
|
|
40
|
+
const [expiry, setExpiry] = useState(String(TOKEN_EXPIRY_CHOICES[0]));
|
|
41
|
+
const [submitting, setSubmitting] = useState(false);
|
|
42
|
+
const [copied, setCopied] = useState(false);
|
|
43
|
+
const [revokeTarget, setRevokeTarget] = useState(null);
|
|
44
|
+
const [revoking, setRevoking] = useState(false);
|
|
45
|
+
// An issued token FORCES the dialog open: it exists nowhere else, and a dialog that could be
|
|
46
|
+
// closed while it is set would lose the one copy the user was ever going to see.
|
|
47
|
+
const dialogOpen = createOpen || issued != null;
|
|
48
|
+
const closeDialog = useCallback(() => {
|
|
49
|
+
setCreateOpen(false);
|
|
50
|
+
setCopied(false);
|
|
51
|
+
setName('');
|
|
52
|
+
setExpiry(String(TOKEN_EXPIRY_CHOICES[0]));
|
|
53
|
+
if (issued != null) {
|
|
54
|
+
onDismissIssued();
|
|
55
|
+
}
|
|
56
|
+
}, [issued, onDismissIssued]);
|
|
57
|
+
const changeDialog = useCallback((next) => {
|
|
58
|
+
if (next) {
|
|
59
|
+
setCreateOpen(true);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
closeDialog();
|
|
63
|
+
}
|
|
64
|
+
}, [closeDialog]);
|
|
65
|
+
const submit = useCallback(async (event) => {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
const trimmed = name.trim();
|
|
68
|
+
if (trimmed === '' || submitting)
|
|
69
|
+
return;
|
|
70
|
+
setSubmitting(true);
|
|
71
|
+
try {
|
|
72
|
+
await onCreate(expiry === TOKEN_EXPIRY_NEVER
|
|
73
|
+
? { name: trimmed }
|
|
74
|
+
: { name: trimmed, expiresIn: Number(expiry) * DAY_SECONDS });
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
setSubmitting(false);
|
|
78
|
+
}
|
|
79
|
+
}, [name, expiry, submitting, onCreate]);
|
|
80
|
+
const copy = useCallback(async () => {
|
|
81
|
+
if (issued == null)
|
|
82
|
+
return;
|
|
83
|
+
try {
|
|
84
|
+
await navigator.clipboard?.writeText(issued.token);
|
|
85
|
+
setCopied(true);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// A missing or refused clipboard (an insecure origin, a denied permission) is not worth a
|
|
89
|
+
// failure banner — the value is on screen and selectable. The button simply doesn't claim a
|
|
90
|
+
// copy it did not make.
|
|
91
|
+
}
|
|
92
|
+
}, [issued]);
|
|
93
|
+
const confirmRevoke = useCallback(async () => {
|
|
94
|
+
if (revokeTarget == null || revoking)
|
|
95
|
+
return;
|
|
96
|
+
setRevoking(true);
|
|
97
|
+
try {
|
|
98
|
+
await onRevoke(revokeTarget);
|
|
99
|
+
setRevokeTarget(null);
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
setRevoking(false);
|
|
103
|
+
}
|
|
104
|
+
}, [revokeTarget, revoking, onRevoke]);
|
|
105
|
+
return _jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: t('title') }), _jsx(CardDescription, { children: t('description') }), _jsx(CardAction, { children: _jsxs(Button, { type: "button", "data-testid": "account-token-create", onClick: () => setCreateOpen(true), children: [_jsx(Plus, { "aria-hidden": true }), t('create')] }) })] }), _jsxs(CardContent, { className: "flex flex-col gap-4", children: [error != null && _jsxs(Alert, { variant: "destructive", children: [_jsx(AlertTitle, { children: t('error') }), _jsx(AlertDescription, { children: error.message })] }), _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t('col.display') }), _jsx(TableHead, { children: t('col.name') }), _jsx(TableHead, { children: t('col.created') }), _jsx(TableHead, { children: t('col.last-used') }), _jsx(TableHead, { children: t('col.expires') }), _jsx(TableHead, { children: t('col.status') }), _jsx(TableHead, { className: "w-0", children: _jsx("span", { className: "sr-only", children: t('revoke') }) })] }) }), _jsx(TableBody, { children: loading === true && items.length === 0
|
|
106
|
+
? _jsx(TableRow, { children: _jsx(TableCell, { colSpan: COLUMNS, className: "text-muted-foreground py-8 text-center", children: _jsx(Loader2, { className: "mx-auto size-4 animate-spin", "aria-hidden": true }) }) })
|
|
107
|
+
: items.length === 0
|
|
108
|
+
? _jsx(TableRow, { children: _jsx(TableCell, { colSpan: COLUMNS, className: "text-muted-foreground py-8 text-center", children: t('empty') }) })
|
|
109
|
+
: items.map(item => {
|
|
110
|
+
const status = tokenStatus(item);
|
|
111
|
+
return _jsxs(TableRow, { "data-testid": "account-token-row", "data-token-id": item.id, children: [_jsx(TableCell, { className: "font-mono text-xs", children: item.display }), _jsx(TableCell, { className: "font-medium", children: item.name }), _jsx(TableCell, { children: formatMoment(item.createdAt, lng) ?? '' }), _jsx(TableCell, { children: formatMoment(item.lastUsedAt, lng) ?? t('never-used') }), _jsx(TableCell, { children: formatMoment(item.expiresAt, lng) ?? t('never') }), _jsx(TableCell, { children: _jsx(Badge, { variant: STATUS_VARIANT[status], children: t(`status.${status}`) }) }), _jsx(TableCell, { className: "text-right", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon", "data-testid": "account-token-revoke", "aria-label": t('revoke'), title: t('revoke'), disabled: status === 'revoked' || item.id == null, onClick: () => { if (item.id != null)
|
|
112
|
+
setRevokeTarget(item.id); }, children: _jsx(Trash2, { "aria-hidden": true }) }) })] }, item.id ?? item.display);
|
|
113
|
+
}) })] })] }), _jsx(Dialog, { open: dialogOpen, onOpenChange: changeDialog, children: _jsx(DialogContent, { closeLabel: t('dialog.cancel'), children: issued != null
|
|
114
|
+
? _jsxs(_Fragment, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: t('dialog.issued-title') }), _jsx(DialogDescription, { children: t('dialog.issued-note') })] }), _jsxs("div", { className: "flex flex-col gap-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { readOnly: true, value: issued.token, "data-testid": "account-token-value", className: "font-mono text-xs", onFocus: event => event.currentTarget.select() }), _jsxs(Button, { type: "button", variant: "outline", "data-testid": "account-token-copy", onClick: () => { void copy(); }, children: [copied ? _jsx(Check, { "aria-hidden": true }) : _jsx(Copy, { "aria-hidden": true }), copied ? t('dialog.copied') : t('dialog.copy')] })] }), usageHint != null && usageHint !== ''
|
|
115
|
+
&& _jsx("p", { className: "text-muted-foreground text-sm", children: usageHint })] }), _jsx(DialogFooter, { children: _jsx(Button, { type: "button", onClick: closeDialog, children: t('dialog.done') }) })] })
|
|
116
|
+
: _jsxs("form", { onSubmit: event => { void submit(event); }, children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: t('dialog.title') }), _jsx(DialogDescription, { children: t('dialog.description') })] }), _jsxs("div", { className: "flex flex-col gap-4 py-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { htmlFor: `${fieldId}-name`, children: t('dialog.name-label') }), _jsx(Input, { id: `${fieldId}-name`, "data-testid": "account-token-name", value: name, maxLength: AUTH_TOKEN_NAME_MAX, placeholder: t('dialog.name-placeholder'), onChange: event => setName(event.target.value) })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { htmlFor: `${fieldId}-expiry`, children: t('dialog.expiry-label') }), _jsxs(Select, { value: expiry, onValueChange: setExpiry, children: [_jsx(SelectTrigger, { id: `${fieldId}-expiry`, className: "w-full", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [TOKEN_EXPIRY_CHOICES.map(days => _jsx(SelectItem, { value: String(days), children: t(`dialog.expiry.${days}`) }, days)), _jsx(SelectItem, { value: TOKEN_EXPIRY_NEVER, children: t('dialog.expiry.never') })] })] })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "outline", onClick: closeDialog, children: t('dialog.cancel') }), _jsxs(Button, { type: "submit", "data-testid": "account-token-submit", disabled: name.trim() === '' || submitting, children: [submitting && _jsx(Loader2, { className: "animate-spin", "aria-hidden": true }), t('dialog.create')] })] })] }) }) }), _jsx(Dialog, { open: revokeTarget != null, onOpenChange: next => { if (!next)
|
|
117
|
+
setRevokeTarget(null); }, children: _jsxs(DialogContent, { closeLabel: t('revoke-confirm.cancel'), children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: t('revoke-confirm.title') }), _jsx(DialogDescription, { children: t('revoke-confirm.description') })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "outline", onClick: () => setRevokeTarget(null), children: t('revoke-confirm.cancel') }), _jsxs(Button, { type: "button", variant: "destructive", disabled: revoking, onClick: () => { void confirmRevoke(); }, children: [revoking && _jsx(Loader2, { className: "animate-spin", "aria-hidden": true }), t('revoke-confirm.confirm')] })] })] }) })] });
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel.js","sourceRoot":"","sources":["../../src/components/panel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEpD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,KAAK,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EAAE,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI;oBAAE,eAAe,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC,YAE1D,MAAC,aAAa,IAAC,UAAU,EAAE,CAAC,CAAC,uBAAuB,CAAC,aACnD,MAAC,YAAY,eACX,KAAC,WAAW,cAAE,CAAC,CAAC,sBAAsB,CAAC,GAAe,EACtD,KAAC,iBAAiB,cAAE,CAAC,CAAC,4BAA4B,CAAC,GAAqB,IAC3D,EACf,MAAC,YAAY,eACX,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,YACzE,CAAC,CAAC,uBAAuB,CAAC,GACpB,EACT,MAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,aAAa,EACrB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,GAAG,KAAK,aAAa,EAAE,CAAA,CAAC,CAAC,aAEtC,QAAQ,IAAI,KAAC,OAAO,IAAC,SAAS,EAAC,cAAc,wBAAe,EAC5D,CAAC,CAAC,wBAAwB,CAAC,IACrB,IACI,IACD,GACT,IACJ,CAAA;AACT,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The library-tier i18n resource this package registers under.
|
|
3
|
+
*
|
|
4
|
+
* Every string the panel renders is addressed as `lib : auth-token.panel.<key>`, so an application
|
|
5
|
+
* overrides any of them by registering the same resource at the app tier — see the README.
|
|
6
|
+
*/
|
|
7
|
+
export declare const AUTH_TOKEN_I18N = "auth-token";
|
|
8
|
+
/** The lifetimes the create form offers, in days. */
|
|
9
|
+
export declare const TOKEN_EXPIRY_CHOICES: readonly [30, 90, 365];
|
|
10
|
+
/**
|
|
11
|
+
* The fourth choice, which is the absence of a lifetime.
|
|
12
|
+
*
|
|
13
|
+
* A `Select` carries strings, and `expiresIn` is simply omitted from the request body for this one
|
|
14
|
+
* — `CreateAccessToken` reads an absent lifetime as "no expiry".
|
|
15
|
+
*/
|
|
16
|
+
export declare const TOKEN_EXPIRY_NEVER = "never";
|
|
17
|
+
/** `CreateAccessToken.expiresIn` is seconds, while the choices above are days. */
|
|
18
|
+
export declare const DAY_SECONDS: number;
|
|
19
|
+
//# sourceMappingURL=consts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,eAAe,eAAe,CAAA;AAE3C,qDAAqD;AACrD,eAAO,MAAM,oBAAoB,YAAI,EAAE,EAAE,EAAE,EAAE,GAAG,CAAU,CAAA;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,UAAU,CAAA;AAEzC,kFAAkF;AAClF,eAAO,MAAM,WAAW,QAAe,CAAA"}
|
package/build/consts.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The library-tier i18n resource this package registers under.
|
|
3
|
+
*
|
|
4
|
+
* Every string the panel renders is addressed as `lib : auth-token.panel.<key>`, so an application
|
|
5
|
+
* overrides any of them by registering the same resource at the app tier — see the README.
|
|
6
|
+
*/
|
|
7
|
+
export const AUTH_TOKEN_I18N = 'auth-token';
|
|
8
|
+
/** The lifetimes the create form offers, in days. */
|
|
9
|
+
export const TOKEN_EXPIRY_CHOICES = [30, 90, 365];
|
|
10
|
+
/**
|
|
11
|
+
* The fourth choice, which is the absence of a lifetime.
|
|
12
|
+
*
|
|
13
|
+
* A `Select` carries strings, and `expiresIn` is simply omitted from the request body for this one
|
|
14
|
+
* — `CreateAccessToken` reads an absent lifetime as "no expiry".
|
|
15
|
+
*/
|
|
16
|
+
export const TOKEN_EXPIRY_NEVER = 'never';
|
|
17
|
+
/** `CreateAccessToken.expiresIn` is seconds, while the choices above are days. */
|
|
18
|
+
export const DAY_SECONDS = 24 * 60 * 60;
|
|
19
|
+
//# sourceMappingURL=consts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAA;AAE3C,qDAAqD;AACrD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAU,CAAA;AAE1D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAA;AAEzC,kFAAkF;AAClF,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AccessTokenView } from '@owlmeans/auth-token';
|
|
2
|
+
import type { AccessTokenStatus } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* What a token's badge says.
|
|
5
|
+
*
|
|
6
|
+
* Revocation outranks expiry: a token revoked before its lifetime ran out is revoked, and saying
|
|
7
|
+
* "expired" about it would suggest it could be renewed. Both outrank `active`, which is what is
|
|
8
|
+
* left when neither happened.
|
|
9
|
+
*/
|
|
10
|
+
export declare const tokenStatus: (item: AccessTokenView) => AccessTokenStatus;
|
|
11
|
+
/**
|
|
12
|
+
* One of a record's moments, in the reader's own language, or null when there is none.
|
|
13
|
+
*
|
|
14
|
+
* Null is the caller's cue to render its own copy — `never` for a token without an expiry,
|
|
15
|
+
* `never-used` for one nothing has presented yet — because an empty cell says neither.
|
|
16
|
+
*/
|
|
17
|
+
export declare const formatMoment: (value: Date | string | null | undefined, lng?: string) => string | null;
|
|
18
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAgBnD;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,SAAU,eAAe,KAAG,iBAKnD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,UAChB,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,QAAQ,MAAM,KACpD,MAAM,GAAG,IAUX,CAAA"}
|
package/build/helpers.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A record's date field, whatever shape it arrived in.
|
|
3
|
+
*
|
|
4
|
+
* The record types say `Date`, and JSON over the wire says string — so a component that trusted
|
|
5
|
+
* the type would call `toLocaleString` on a string and throw. An unparseable value answers null
|
|
6
|
+
* rather than `Invalid Date`, which renders as those two words in every language.
|
|
7
|
+
*/
|
|
8
|
+
const toDate = (value) => {
|
|
9
|
+
if (value == null)
|
|
10
|
+
return null;
|
|
11
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
12
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* What a token's badge says.
|
|
16
|
+
*
|
|
17
|
+
* Revocation outranks expiry: a token revoked before its lifetime ran out is revoked, and saying
|
|
18
|
+
* "expired" about it would suggest it could be renewed. Both outrank `active`, which is what is
|
|
19
|
+
* left when neither happened.
|
|
20
|
+
*/
|
|
21
|
+
export const tokenStatus = (item) => {
|
|
22
|
+
if (item.revokedAt != null)
|
|
23
|
+
return 'revoked';
|
|
24
|
+
const expires = toDate(item.expiresAt);
|
|
25
|
+
return expires != null && expires.getTime() <= Date.now() ? 'expired' : 'active';
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* One of a record's moments, in the reader's own language, or null when there is none.
|
|
29
|
+
*
|
|
30
|
+
* Null is the caller's cue to render its own copy — `never` for a token without an expiry,
|
|
31
|
+
* `never-used` for one nothing has presented yet — because an empty cell says neither.
|
|
32
|
+
*/
|
|
33
|
+
export const formatMoment = (value, lng) => {
|
|
34
|
+
const date = toDate(value);
|
|
35
|
+
if (date == null)
|
|
36
|
+
return null;
|
|
37
|
+
try {
|
|
38
|
+
return new Intl.DateTimeFormat(lng, { dateStyle: 'medium', timeStyle: 'short' }).format(date);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// An unknown language tag throws rather than falling back, and a date is not worth a blank row.
|
|
42
|
+
return date.toISOString();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,MAAM,GAAG,CAAC,KAAuC,EAAe,EAAE;IACtE,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,IAAI,CAAA;IAC9B,MAAM,IAAI,GAAG,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAA;IAE5D,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;AACnD,CAAC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAqB,EAAqB,EAAE;IACtE,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI;QAAE,OAAO,SAAS,CAAA;IAC5C,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAEtC,OAAO,OAAO,IAAI,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAA;AAClF,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,KAAuC,EAAE,GAAY,EACtC,EAAE;IACjB,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAC1B,IAAI,IAAI,IAAI,IAAI;QAAE,OAAO,IAAI,CAAA;IAE7B,IAAI,CAAC;QACH,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC/F,CAAC;IAAC,MAAM,CAAC;QACP,gGAAgG;QAChG,OAAO,IAAI,CAAC,WAAW,EAAE,CAAA;IAC3B,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AccessTokensAliases, UseAccessTokens } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The I/O half of the token surface.
|
|
4
|
+
*
|
|
5
|
+
* Nothing thrown here reaches the caller. A panel that cannot list its tokens must still render —
|
|
6
|
+
* with the failure on it — because the alternative is an error boundary swallowing the whole
|
|
7
|
+
* screen and a user who cannot even see that revoking is still possible. Every failure lands in
|
|
8
|
+
* `error` instead, and the next operation clears it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useAccessTokens: (aliases?: AccessTokensAliases) => UseAccessTokens;
|
|
11
|
+
//# sourceMappingURL=use-access-tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-access-tokens.d.ts","sourceRoot":"","sources":["../../src/hooks/use-access-tokens.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AASvE;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,aAAc,mBAAmB,KAAG,eAyD/D,CAAA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { useContext } from '@owlmeans/client';
|
|
3
|
+
import { ResilientError } from '@owlmeans/error';
|
|
4
|
+
import { authToken } from '@owlmeans/auth-token';
|
|
5
|
+
/** The aliases `makeAuthTokenEntrypoints` declares, which is what an unconfigured host mounts. */
|
|
6
|
+
const DEFAULT_ALIASES = {
|
|
7
|
+
list: authToken.list,
|
|
8
|
+
create: authToken.create,
|
|
9
|
+
revoke: authToken.revoke,
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The I/O half of the token surface.
|
|
13
|
+
*
|
|
14
|
+
* Nothing thrown here reaches the caller. A panel that cannot list its tokens must still render —
|
|
15
|
+
* with the failure on it — because the alternative is an error boundary swallowing the whole
|
|
16
|
+
* screen and a user who cannot even see that revoking is still possible. Every failure lands in
|
|
17
|
+
* `error` instead, and the next operation clears it.
|
|
18
|
+
*/
|
|
19
|
+
export const useAccessTokens = (aliases) => {
|
|
20
|
+
const ctx = useContext();
|
|
21
|
+
const list = aliases?.list ?? DEFAULT_ALIASES.list;
|
|
22
|
+
const create = aliases?.create ?? DEFAULT_ALIASES.create;
|
|
23
|
+
const revoke = aliases?.revoke ?? DEFAULT_ALIASES.revoke;
|
|
24
|
+
const [items, setItems] = useState([]);
|
|
25
|
+
const [issued, setIssued] = useState(null);
|
|
26
|
+
const [loading, setLoading] = useState(true);
|
|
27
|
+
const [error, setError] = useState(null);
|
|
28
|
+
const reload = useCallback(async () => {
|
|
29
|
+
setLoading(true);
|
|
30
|
+
setError(null);
|
|
31
|
+
try {
|
|
32
|
+
const result = await ctx.entrypoint(list).call();
|
|
33
|
+
setItems(result.items);
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
setError(ResilientError.ensure(e));
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
setLoading(false);
|
|
40
|
+
}
|
|
41
|
+
}, [ctx, list]);
|
|
42
|
+
useEffect(() => { void reload(); }, [reload]);
|
|
43
|
+
/**
|
|
44
|
+
* The plaintext is kept so the panel can show it once. It is never persisted anywhere — a reload
|
|
45
|
+
* of the page is the same as pressing Done, which is the property that makes showing it safe.
|
|
46
|
+
*/
|
|
47
|
+
const createToken = useCallback(async (body) => {
|
|
48
|
+
setError(null);
|
|
49
|
+
try {
|
|
50
|
+
const result = await ctx.entrypoint(create).call({ body });
|
|
51
|
+
setIssued(result);
|
|
52
|
+
await reload();
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
setError(ResilientError.ensure(e));
|
|
56
|
+
}
|
|
57
|
+
}, [ctx, create, reload]);
|
|
58
|
+
const revokeToken = useCallback(async (id) => {
|
|
59
|
+
setError(null);
|
|
60
|
+
try {
|
|
61
|
+
await ctx.entrypoint(revoke).call({ params: { id } });
|
|
62
|
+
await reload();
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
setError(ResilientError.ensure(e));
|
|
66
|
+
}
|
|
67
|
+
}, [ctx, revoke, reload]);
|
|
68
|
+
const dismissIssued = useCallback(() => { setIssued(null); }, []);
|
|
69
|
+
return {
|
|
70
|
+
items, issued, loading, error,
|
|
71
|
+
reload, create: createToken, revoke: revokeToken, dismissIssued,
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=use-access-tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-access-tokens.js","sourceRoot":"","sources":["../../src/hooks/use-access-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAMhD,kGAAkG;AAClG,MAAM,eAAe,GAAwB;IAC3C,IAAI,EAAE,SAAS,CAAC,IAAI;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,CAAC,CAAA;IAEhE,OAAO;QACL,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK;QAC7B,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa;KAChE,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"panel": {
|
|
3
|
+
"title": "Токены доступу",
|
|
4
|
+
"description": "Доўгажывучыя токены, з якімі скрыпт ці інтэграцыя звяртаецца да API ад вашага імя.",
|
|
5
|
+
"create": "Стварыць токен",
|
|
6
|
+
"empty": "Токенаў доступу пакуль няма.",
|
|
7
|
+
"col": {
|
|
8
|
+
"display": "Токен",
|
|
9
|
+
"name": "Назва",
|
|
10
|
+
"created": "Створаны",
|
|
11
|
+
"last-used": "Апошняе выкарыстанне",
|
|
12
|
+
"expires": "Сканчаецца",
|
|
13
|
+
"status": "Статус"
|
|
14
|
+
},
|
|
15
|
+
"never": "Ніколі",
|
|
16
|
+
"never-used": "Не выкарыстоўваўся",
|
|
17
|
+
"status": {
|
|
18
|
+
"active": "Актыўны",
|
|
19
|
+
"expired": "Скончыўся",
|
|
20
|
+
"revoked": "Адкліканы"
|
|
21
|
+
},
|
|
22
|
+
"revoke": "Адклікаць",
|
|
23
|
+
"revoke-confirm": {
|
|
24
|
+
"title": "Адклікаць гэты токен?",
|
|
25
|
+
"description": "Усё, што яго яшчэ выкарыстоўвае, адразу перастане працаваць. Адрабіць гэта немагчыма.",
|
|
26
|
+
"cancel": "Скасаваць",
|
|
27
|
+
"confirm": "Адклікаць"
|
|
28
|
+
},
|
|
29
|
+
"dialog": {
|
|
30
|
+
"title": "Стварэнне токена доступу",
|
|
31
|
+
"description": "Назавіце яго паводле месца выкарыстання, каб пазней адрозніваць свае токены.",
|
|
32
|
+
"name-label": "Назва",
|
|
33
|
+
"name-placeholder": "Разгортванне CI",
|
|
34
|
+
"expiry-label": "Сканчаецца",
|
|
35
|
+
"expiry": {
|
|
36
|
+
"30": "Праз 30 дзён",
|
|
37
|
+
"90": "Праз 90 дзён",
|
|
38
|
+
"365": "Праз год",
|
|
39
|
+
"never": "Ніколі"
|
|
40
|
+
},
|
|
41
|
+
"create": "Стварыць",
|
|
42
|
+
"cancel": "Скасаваць",
|
|
43
|
+
"issued-title": "Ваш новы токен доступу",
|
|
44
|
+
"issued-note": "Скапіруйце яго зараз — больш ён не будзе паказаны.",
|
|
45
|
+
"copy": "Скапіраваць",
|
|
46
|
+
"copied": "Скапіравана",
|
|
47
|
+
"done": "Гатова"
|
|
48
|
+
},
|
|
49
|
+
"error": "Нешта пайшло не так"
|
|
50
|
+
}
|
|
51
|
+
}
|