@schemavaults/auth-ui 0.6.52 → 0.6.54
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/ApiServersCard/api_servers_card.d.ts +1 -0
- package/dist/components/ApiServersCard/api_servers_card.js +1 -1
- package/dist/components/ApiServersCard/api_servers_card.js.map +1 -1
- package/dist/components/ApiServersTable/ApiServerRowActions.js +11 -3
- package/dist/components/ApiServersTable/ApiServerRowActions.js.map +1 -1
- package/dist/components/ApiServersTable/ApiServersTable.d.ts +2 -1
- package/dist/components/ApiServersTable/ApiServersTable.js +2 -2
- package/dist/components/ApiServersTable/ApiServersTable.js.map +1 -1
- package/dist/components/ApiServersTable/ApiServersTableConfigContext.d.ts +1 -0
- package/dist/components/ApiServersTable/ApiServersTableConfigContext.js +1 -0
- package/dist/components/ApiServersTable/ApiServersTableConfigContext.js.map +1 -1
- package/dist/components/AppsTable/frontend_app_actions.js +78 -79
- package/dist/components/AppsTable/frontend_app_actions.js.map +1 -1
- package/dist/components/DeleteApiServerDialog/DeleteApiServerDialog.d.ts +9 -0
- package/dist/components/DeleteApiServerDialog/DeleteApiServerDialog.js +56 -0
- package/dist/components/DeleteApiServerDialog/DeleteApiServerDialog.js.map +1 -0
- package/dist/components/DeleteApiServerDialog/index.d.ts +2 -0
- package/dist/components/DeleteApiServerDialog/index.js +2 -0
- package/dist/components/DeleteApiServerDialog/index.js.map +1 -0
- package/dist/components/DeleteAppDialog/DeleteAppDialog.d.ts +9 -0
- package/dist/components/DeleteAppDialog/DeleteAppDialog.js +56 -0
- package/dist/components/DeleteAppDialog/DeleteAppDialog.js.map +1 -0
- package/dist/components/DeleteAppDialog/index.d.ts +2 -0
- package/dist/components/DeleteAppDialog/index.js +2 -0
- package/dist/components/DeleteAppDialog/index.js.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -10,6 +10,7 @@ export interface ApiServersCardProps {
|
|
|
10
10
|
preloaded?: PreloadedApiServersTableData;
|
|
11
11
|
uuid: () => string;
|
|
12
12
|
showConnectAppToApi?: boolean;
|
|
13
|
+
isOrgOwner?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export declare function ApiServersCard(props: ApiServersCardProps): ReactElement;
|
|
15
16
|
export default ApiServersCard;
|
|
@@ -13,7 +13,7 @@ export function ApiServersCard(props) {
|
|
|
13
13
|
const cardClassName = cn("w-full", props.cardClassName);
|
|
14
14
|
const [createApiServerDialogOpen, setCreateApiServerDialogOpen] = useState(false);
|
|
15
15
|
const [connectAppToApiDialogOpen, setConnectAppToApiDialogOpen] = useState(false);
|
|
16
|
-
return (_jsx(CreateApiServerDialogOpenDispatchContext.Provider, { value: setCreateApiServerDialogOpen, children: _jsxs(ConnectAppToApiDialogOpenDispatchContext.Provider, { value: setConnectAppToApiDialogOpen, children: [_jsxs(Card, { className: cardClassName, children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: cardTitle }), _jsx(CardDescription, { children: cardDescription })] }), _jsx(CardContent, { children: _jsx(ApiServersTable, { queryType: props.queryType, organization_id: props.organization_id, preloaded: props.preloaded, showConnectAppToApi: props.showConnectAppToApi }) }), _jsx(CardFooter, { children: _jsx("div", { className: "flex flex-row items-start justify-start gap-2" }) })] }), _jsx(CreateApiServerDialog, { clearApiServersCache: clearUseApiServersCache, owner_organization_id: props.queryType === "all"
|
|
16
|
+
return (_jsx(CreateApiServerDialogOpenDispatchContext.Provider, { value: setCreateApiServerDialogOpen, children: _jsxs(ConnectAppToApiDialogOpenDispatchContext.Provider, { value: setConnectAppToApiDialogOpen, children: [_jsxs(Card, { className: cardClassName, children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: cardTitle }), _jsx(CardDescription, { children: cardDescription })] }), _jsx(CardContent, { children: _jsx(ApiServersTable, { queryType: props.queryType, organization_id: props.organization_id, preloaded: props.preloaded, showConnectAppToApi: props.showConnectAppToApi, isOrgOwner: props.isOrgOwner }) }), _jsx(CardFooter, { children: _jsx("div", { className: "flex flex-row items-start justify-start gap-2" }) })] }), _jsx(CreateApiServerDialog, { clearApiServersCache: clearUseApiServersCache, owner_organization_id: props.queryType === "all"
|
|
17
17
|
? SCHEMAVAULTS_ORGANIZATION_ID
|
|
18
18
|
: props.organization_id, open: createApiServerDialogOpen, onOpenChange: setCreateApiServerDialogOpen, uuid: props.uuid }), (props.queryType === "all" || props.showConnectAppToApi) && (_jsx(ConnectAppToApiDialog, { open: connectAppToApiDialogOpen, onOpenChange: setConnectAppToApiDialogOpen }))] }) }));
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api_servers_card.js","sourceRoot":"","sources":["../../../src/components/ApiServersCard/api_servers_card.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAqB,MAAM,OAAO,CAAC;AACpD,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,EACT,EAAE,GACH,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,eAAe,EACf,uBAAuB,GAExB,MAAM,8BAA8B,CAAC;AACtC,OAAO,qBAAqB,EAAE,EAC5B,wCAAwC,GACzC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,qBAAqB,EAAE,EAC5B,wCAAwC,GACzC,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"api_servers_card.js","sourceRoot":"","sources":["../../../src/components/ApiServersCard/api_servers_card.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAqB,MAAM,OAAO,CAAC;AACpD,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,EACT,EAAE,GACH,MAAM,kBAAkB,CAAC;AA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1D,IACR,EACP,KAAC,qBAAqB,IACpB,oBAAoB,EAAE,uBAAuB,EAC7C,qBAAqB,EACnB,KAAK,CAAC,SAAS,KAAK,KAAK;wBACvB,CAAC,CAAC,4BAA4B;wBAC9B,CAAC,CAAC,KAAK,CAAC,eAAe,EAE3B,IAAI,EAAE,yBAAyB,EAC/B,YAAY,EAAE,4BAA4B,EAC1C,IAAI,EAAE,KAAK,CAAC,IAAI,GAChB,EACD,CAAC,KAAK,CAAC,SAAS,KAAK,KAAK,IAAI,KAAK,CAAC,mBAAmB,CAAC,IAAI,CAC3D,KAAC,qBAAqB,IACpB,IAAI,EAAE,yBAAyB,EAC/B,YAAY,EAAE,4BAA4B,GAC1C,CACH,IACiD,GACF,CACrD,CAAC;AACJ,CAAC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useContext } from "react";
|
|
4
|
+
import { isHardcodedApiServerId } from "@schemavaults/app-definitions";
|
|
4
5
|
import { cn, useToast } from "@schemavaults/ui";
|
|
5
6
|
import { Button } from "@schemavaults/ui";
|
|
6
|
-
import { ClipboardCopy, Key, MoreHorizontal, PlugZap } from "lucide-react";
|
|
7
|
+
import { ClipboardCopy, Key, MoreHorizontal, PlugZap, Trash } from "lucide-react";
|
|
7
8
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@schemavaults/ui";
|
|
8
9
|
import { SCHEMAVAULTS_AUTH_SERVER, } from "@schemavaults/app-definitions";
|
|
9
10
|
import Link from "next/link";
|
|
10
11
|
import { ConnectAppToApiDialog } from "../ConnectAppToApiDialog";
|
|
12
|
+
import { DeleteApiServerDialog } from "../DeleteApiServerDialog";
|
|
11
13
|
import { ApiServersTableConfigContext } from "./ApiServersTableConfigContext";
|
|
12
14
|
const menuItemClassname = cn("flex flex-row flex-nowrap gap-2 items-center justify-start");
|
|
13
15
|
const menuItemIconClassname = cn("h-4 w-4");
|
|
@@ -15,7 +17,10 @@ export function ApiServerRowActions({ api, }) {
|
|
|
15
17
|
const api_server_id = api.api_server_id;
|
|
16
18
|
const { toast } = useToast();
|
|
17
19
|
const [connectDialogOpen, setConnectDialogOpen] = useState(false);
|
|
18
|
-
const
|
|
20
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
|
21
|
+
const { showConnectAppToApi, isOrgOwner } = useContext(ApiServersTableConfigContext);
|
|
22
|
+
const hardcoded = api.hardcoded && isHardcodedApiServerId(api_server_id);
|
|
23
|
+
const isDeleteDisabled = hardcoded || (!showConnectAppToApi && !isOrgOwner);
|
|
19
24
|
return (_jsxs(_Fragment, { children: [_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", className: "h-8 w-8 p-0", children: [_jsx("span", { className: "sr-only", children: "Open menu" }), _jsx(MoreHorizontal, { className: "h-4 w-4" })] }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsx(DropdownMenuLabel, { children: "Actions" }), _jsxs(DropdownMenuItem, { onClick: async (e) => {
|
|
20
25
|
e.preventDefault();
|
|
21
26
|
try {
|
|
@@ -42,6 +47,9 @@ export function ApiServerRowActions({ api, }) {
|
|
|
42
47
|
}, className: menuItemClassname, children: [_jsx(ClipboardCopy, { className: menuItemIconClassname }), " Copy API Server ID"] }), api_server_id !== SCHEMAVAULTS_AUTH_SERVER.api_server_id && (_jsx(Link, { href: `/apis/${api_server_id}/jwks-access-keys`, className: "hover:cursor-pointer", children: _jsxs(DropdownMenuItem, { className: menuItemClassname, children: [_jsx(Key, { className: menuItemIconClassname }), " Manage Access Keys"] }) })), showConnectAppToApi && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { onClick: (e) => {
|
|
43
48
|
e.preventDefault();
|
|
44
49
|
setConnectDialogOpen(true);
|
|
45
|
-
}, className: menuItemClassname, children: [_jsx(PlugZap, { className: menuItemIconClassname }), " Connect App to this API"] })] }))
|
|
50
|
+
}, className: menuItemClassname, children: [_jsx(PlugZap, { className: menuItemIconClassname }), " Connect App to this API"] })] })), !isDeleteDisabled && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { onClick: (e) => {
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
setDeleteDialogOpen(true);
|
|
53
|
+
}, className: menuItemClassname, children: [_jsx(Trash, { className: menuItemIconClassname }), " Delete API Server"] })] }))] })] }), showConnectAppToApi && (_jsx(ConnectAppToApiDialog, { open: connectDialogOpen, onOpenChange: setConnectDialogOpen, preselectedApiServerId: api_server_id })), !isDeleteDisabled && (_jsx(DeleteApiServerDialog, { api_server_id: api_server_id, api_server_name: api.api_server_name, open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen }))] }));
|
|
46
54
|
}
|
|
47
55
|
//# sourceMappingURL=ApiServerRowActions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiServerRowActions.js","sourceRoot":"","sources":["../../../src/components/ApiServersTable/ApiServerRowActions.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ApiServerRowActions.js","sourceRoot":"","sources":["../../../src/components/ApiServersTable/ApiServerRowActions.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,QAAQ,EAAE,U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
|
|
6
6
|
organization_id?: string;
|
|
7
7
|
preloaded?: PreloadedApiServersTableData | undefined;
|
|
8
8
|
showConnectAppToApi?: boolean;
|
|
9
|
+
isOrgOwner?: boolean;
|
|
9
10
|
}
|
|
10
|
-
export declare function ApiServersTable({ queryType, organization_id, preloaded, showConnectAppToApi, }: ApiServersDatatableProps): ReactElement;
|
|
11
|
+
export declare function ApiServersTable({ queryType, organization_id, preloaded, showConnectAppToApi, isOrgOwner, }: ApiServersDatatableProps): ReactElement;
|
|
11
12
|
export default ApiServersTable;
|
|
@@ -14,7 +14,7 @@ function ApiServersTableHeaderButtons({ queryType, showConnectAppToApi, }) {
|
|
|
14
14
|
const onOpenChangeConnectAppToApi = useContext(ConnectAppToApiDialogOpenDispatchContext);
|
|
15
15
|
return (_jsxs(_Fragment, { children: [(queryType === "all" || queryType === "org") && (_jsx(CreateApiServerDialogTrigger, { onOpenChange: onOpenChangeCreateApi })), (queryType === "all" || showConnectAppToApi) && (_jsx(ConnectAppToApiDialogTrigger, { onOpenChange: onOpenChangeConnectAppToApi }))] }));
|
|
16
16
|
}
|
|
17
|
-
export function ApiServersTable({ queryType, organization_id, preloaded, showConnectAppToApi, }) {
|
|
17
|
+
export function ApiServersTable({ queryType, organization_id, preloaded, showConnectAppToApi, isOrgOwner, }) {
|
|
18
18
|
const auth = useAuth();
|
|
19
19
|
const authClient = auth.ready ? auth.client.current : undefined;
|
|
20
20
|
const apis = useApiServersList({
|
|
@@ -37,7 +37,7 @@ export function ApiServersTable({ queryType, organization_id, preloaded, showCon
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}, [apis.data]);
|
|
40
|
-
const contextValue = useMemo(() => ({ showConnectAppToApi: showConnectAppToApi ?? false }), [showConnectAppToApi]);
|
|
40
|
+
const contextValue = useMemo(() => ({ showConnectAppToApi: showConnectAppToApi ?? false, isOrgOwner: isOrgOwner ?? false }), [showConnectAppToApi, isOrgOwner]);
|
|
41
41
|
if (!data && isLoading) {
|
|
42
42
|
return (_jsx("div", { className: "min-h-48 w-full flex items-center justify-center", children: _jsx(Loader2, { className: "h-12 w-12 animate-spin" }) }));
|
|
43
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiServersTable.js","sourceRoot":"","sources":["../../../src/components/ApiServersTable/ApiServersTable.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAW,UAAU,EAAE,OAAO,EAAqB,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EACL,wCAAwC,EACxC,4BAA4B,GAC7B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,wCAAwC,EACxC,4BAA4B,GAC7B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"ApiServersTable.js","sourceRoot":"","sources":["../../../src/components/ApiServersTable/ApiServersTable.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAW,UAAU,EAAE,OAAO,EAAqB,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EACL,wCAAwC,EACxC,4BAA4B,GAC7B,MAAM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AM,EAAE,IAAI;gBACZ,aAAa,EAAE,KAAK;gBACpB,eAAe,EAAE,IAAI;gBACrB,sBAAsB,EAAE,IAAI;gBAC5B,qBAAqB,EAAE,KAAK;aAC7B,EACD,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAC,QAAQ,EACtB,YAAY,EAAE;gBACZ,eAAe;gBACf,iBAAiB;gBACjB,wBAAwB;aACzB,GACD,GACoC,CACzC,CAAC;AACJ,CAAC;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiServersTableConfigContext.js","sourceRoot":"","sources":["../../../src/components/ApiServersTable/ApiServersTableConfigContext.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ApiServersTableConfigContext.js","sourceRoot":"","sources":["../../../src/components/ApiServersTable/ApiServersTableConfigContext.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAOtC,MAAM,CAAC,MAAM,4BAA4B,GACvC,aAAa,CAAwB;IACnC,mBAAmB,EAAE,KAAK;IAC1B,UAAU,EAAE,KAAK;CAClB,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { useTransition, useMemo, useContext } from "react";
|
|
3
|
+
import { useState, useTransition, useMemo, useContext } from "react";
|
|
4
4
|
import { cn, useToast } from "@schemavaults/ui";
|
|
5
5
|
import { Button } from "@schemavaults/ui";
|
|
6
6
|
import { AppWindow, ClipboardCopy, EarthLock, MoreHorizontal, PlayCircle, PlugZap, Trash, } from "lucide-react";
|
|
@@ -11,6 +11,7 @@ import { useAppDomains } from "./useAppDomains";
|
|
|
11
11
|
import { launchWebApp } from "./launchWebApp";
|
|
12
12
|
import { isHardcodedAppId, HARDCODED_CORE_SCHEMAVAULTS_APP_DOMAINS, } from "@schemavaults/app-definitions";
|
|
13
13
|
import { CreateAppDomainDialogOpenDispatchContext } from "../CreateAppDomainDialog";
|
|
14
|
+
import { DeleteAppDialog } from "../DeleteAppDialog";
|
|
14
15
|
const dropdownMenuActionsClassName = "hover:cursor-pointer flex flex-row gap-2 items-center justify-start pointer-events-auto";
|
|
15
16
|
class CantCopyWithinInsecureContextError extends Error {
|
|
16
17
|
}
|
|
@@ -63,96 +64,94 @@ export function FrontendApplicationActions({ app, queryType, isOrgOwner, }) {
|
|
|
63
64
|
const launchAppDisabled = !Array.isArray(appDomains.data) ||
|
|
64
65
|
appDomains.data.length === 0 ||
|
|
65
66
|
launchableAppDomains.length === 0;
|
|
66
|
-
const
|
|
67
|
+
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
|
68
|
+
const isDeleteAppDisabled = hardcoded || (!admin && !isOrgOwner);
|
|
67
69
|
const showAddAppDomain = (admin && queryType === "all") || (!!isOrgOwner && queryType === "org");
|
|
68
70
|
const showConnectApi = admin && queryType === "all";
|
|
69
|
-
return (
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
return (_jsxs(_Fragment, { children: [_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", className: "h-8 w-8 p-0", "data-testid": "app-actions-button", children: [_jsx("span", { className: "sr-only", children: "Open menu" }), _jsx(MoreHorizontal, { className: "h-4 w-4" })] }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsx(DropdownMenuLabel, { children: "Actions" }), !launchAppDisabled && (_jsxs(DropdownMenuItem, { className: cn(dropdownMenuActionsClassName), onClick: launchAppDisabled
|
|
72
|
+
? undefined
|
|
73
|
+
: () => {
|
|
74
|
+
try {
|
|
75
|
+
launchWebApp({
|
|
76
|
+
toast,
|
|
77
|
+
appDomains: Array.isArray(appDomains.data)
|
|
78
|
+
? appDomains.data
|
|
79
|
+
: [],
|
|
80
|
+
launchableAppDomains,
|
|
81
|
+
environment,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
console.error(e);
|
|
86
|
+
toast({
|
|
87
|
+
variant: "destructive",
|
|
88
|
+
title: "Failed to launch web app",
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}, disabled: launchAppDisabled, children: [_jsx(PlayCircle, { className: "h-4 w-4" }), " Launch App"] })), _jsxs(DropdownMenuItem, { className: cn(dropdownMenuActionsClassName), onClick: (e) => {
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
if (!window) {
|
|
94
|
+
throw new TypeError("Failed to load reference to 'window' global variable!");
|
|
95
|
+
}
|
|
72
96
|
try {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
launchableAppDomains,
|
|
79
|
-
environment,
|
|
80
|
-
});
|
|
97
|
+
if (!window.isSecureContext) {
|
|
98
|
+
throw new CantCopyWithinInsecureContextError("Access to clipboard is only allowed in secure contexts!");
|
|
99
|
+
}
|
|
100
|
+
const clipboard = window.navigator.clipboard;
|
|
101
|
+
clipboard.writeText(app.app_id);
|
|
81
102
|
}
|
|
82
103
|
catch (e) {
|
|
83
|
-
console.error(e);
|
|
104
|
+
console.error("Failed to copy app ID to clipboard: ", e);
|
|
105
|
+
let errorMessage = "An unknown error has occurred.";
|
|
106
|
+
if (e instanceof Error) {
|
|
107
|
+
errorMessage = e.message;
|
|
108
|
+
}
|
|
84
109
|
toast({
|
|
85
110
|
variant: "destructive",
|
|
86
|
-
title: "Failed to
|
|
111
|
+
title: "Failed to copy app ID to clipboard",
|
|
112
|
+
description: errorMessage,
|
|
87
113
|
});
|
|
88
|
-
|
|
89
|
-
}, disabled: launchAppDisabled, children: [_jsx(PlayCircle, { className: "h-4 w-4" }), " Launch App"] })), _jsxs(DropdownMenuItem, { className: cn(dropdownMenuActionsClassName), onClick: (e) => {
|
|
90
|
-
e.preventDefault();
|
|
91
|
-
if (!window) {
|
|
92
|
-
throw new TypeError("Failed to load reference to 'window' global variable!");
|
|
93
|
-
}
|
|
94
|
-
try {
|
|
95
|
-
if (!window.isSecureContext) {
|
|
96
|
-
throw new CantCopyWithinInsecureContextError("Access to clipboard is only allowed in secure contexts!");
|
|
97
|
-
}
|
|
98
|
-
const clipboard = window.navigator.clipboard;
|
|
99
|
-
clipboard.writeText(app.app_id);
|
|
100
|
-
}
|
|
101
|
-
catch (e) {
|
|
102
|
-
console.error("Failed to copy app ID to clipboard: ", e);
|
|
103
|
-
let errorMessage = "An unknown error has occurred.";
|
|
104
|
-
if (e instanceof Error) {
|
|
105
|
-
errorMessage = e.message;
|
|
114
|
+
return;
|
|
106
115
|
}
|
|
107
116
|
toast({
|
|
108
|
-
variant: "
|
|
109
|
-
title: "
|
|
110
|
-
description:
|
|
117
|
+
variant: "default",
|
|
118
|
+
title: "Successfully copied app ID to clipboard",
|
|
119
|
+
description: `You can now paste '${app.app_id}'`,
|
|
111
120
|
});
|
|
112
121
|
return;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
throw new Error("Auth client is not ready!");
|
|
122
|
+
}, "data-testid": "copy-app-id-menu-item", children: [_jsx(ClipboardCopy, { className: "h-4 w-4" }), " Copy app ID"] }), queryType !== "authorized" && _jsx(DropdownMenuSeparator, {}), queryType !== "authorized" && (_jsxs(DropdownMenuItem, { className: cn(dropdownMenuActionsClassName), onClick: () => {
|
|
123
|
+
startAuthorizingApp(async () => {
|
|
124
|
+
try {
|
|
125
|
+
if (!authContext ||
|
|
126
|
+
!authContext.ready ||
|
|
127
|
+
!authContext.client.current) {
|
|
128
|
+
throw new Error("Auth client is not ready!");
|
|
129
|
+
}
|
|
130
|
+
await sendAuthorizeFrontendAppRequest({
|
|
131
|
+
toast,
|
|
132
|
+
app_id: app.app_id,
|
|
133
|
+
auth: authContext.client.current,
|
|
134
|
+
});
|
|
127
135
|
}
|
|
128
|
-
|
|
129
|
-
toast
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}, children: [_jsx(PlugZap, { className: "h-4 w-4" }), " Connect API"] })), showAddAppDomain && (_jsxs(DropdownMenuItem, { className: cn(dropdownMenuActionsClassName), onClick: () => {
|
|
149
|
-
openAddAppDomainDialog(app.app_id);
|
|
150
|
-
return;
|
|
151
|
-
}, children: [_jsx(EarthLock, { className: "h-4 w-4" }), " Add domain"] })), !isDeleteAppDisabled && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { className: cn(dropdownMenuActionsClassName), onClick: () => {
|
|
152
|
-
toast({
|
|
153
|
-
variant: "default",
|
|
154
|
-
title: "Not implemented",
|
|
155
|
-
});
|
|
156
|
-
}, disabled: isDeleteAppDisabled, children: [_jsx(Trash, { className: "h-4 w-4" }), " Delete app"] })] }))] })] }) }));
|
|
136
|
+
catch (e) {
|
|
137
|
+
toast({
|
|
138
|
+
variant: "destructive",
|
|
139
|
+
title: "Failed to send authorize frontend app request",
|
|
140
|
+
description: e instanceof Error ? e.message : undefined,
|
|
141
|
+
});
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}, disabled: authorizingApp, children: [_jsx(AppWindow, { className: "h-4 w-4" }), " Authorize app"] })), showConnectApi && (_jsxs(DropdownMenuItem, { className: cn(dropdownMenuActionsClassName), onClick: () => {
|
|
146
|
+
toast({
|
|
147
|
+
variant: "default",
|
|
148
|
+
title: "Not implemented",
|
|
149
|
+
});
|
|
150
|
+
}, children: [_jsx(PlugZap, { className: "h-4 w-4" }), " Connect API"] })), showAddAppDomain && (_jsxs(DropdownMenuItem, { className: cn(dropdownMenuActionsClassName), onClick: () => {
|
|
151
|
+
openAddAppDomainDialog(app.app_id);
|
|
152
|
+
return;
|
|
153
|
+
}, children: [_jsx(EarthLock, { className: "h-4 w-4" }), " Add domain"] })), !isDeleteAppDisabled && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { className: cn(dropdownMenuActionsClassName), onClick: () => {
|
|
154
|
+
setDeleteDialogOpen(true);
|
|
155
|
+
}, disabled: isDeleteAppDisabled, children: [_jsx(Trash, { className: "h-4 w-4" }), " Delete app"] })] }))] })] }), !isDeleteAppDisabled && (_jsx(DeleteAppDialog, { app_id: app_id, app_name: app.app_name, open: deleteDialogOpen, onOpenChange: setDeleteDialogOpen }))] }));
|
|
157
156
|
}
|
|
158
157
|
//# sourceMappingURL=frontend_app_actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend_app_actions.js","sourceRoot":"","sources":["../../../src/components/AppsTable/frontend_app_actions.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAQb,OAAO,EAAqB,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"frontend_app_actions.js","sourceRoot":"","sources":["../../../src/components/AppsTable/frontend_app_actions.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAQb,OAAO,EAAqB,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxF,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EACL,SA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AAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
export interface DeleteApiServerDialogProps {
|
|
3
|
+
api_server_id: string;
|
|
4
|
+
api_server_name: string;
|
|
5
|
+
open: boolean;
|
|
6
|
+
onOpenChange: (open: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function DeleteApiServerDialog({ api_server_id, api_server_name, open, onOpenChange, }: DeleteApiServerDialogProps): ReactElement;
|
|
9
|
+
export default DeleteApiServerDialog;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, Input, Label, useToast, } from "@schemavaults/ui";
|
|
4
|
+
import { useState, useTransition } from "react";
|
|
5
|
+
import { Trash2 } from "lucide-react";
|
|
6
|
+
import { useSWRConfig } from "swr";
|
|
7
|
+
import { clearUseApiServersCache } from "../ApiServersTable/useApiServersList";
|
|
8
|
+
import { useAuth } from "@schemavaults/auth-react-provider";
|
|
9
|
+
export function DeleteApiServerDialog({ api_server_id, api_server_name, open, onOpenChange, }) {
|
|
10
|
+
const [confirmationInput, setConfirmationInput] = useState("");
|
|
11
|
+
const [deleting, startDeleting] = useTransition();
|
|
12
|
+
const { toast } = useToast();
|
|
13
|
+
const { mutate } = useSWRConfig();
|
|
14
|
+
const auth = useAuth();
|
|
15
|
+
const isConfirmed = confirmationInput === api_server_name;
|
|
16
|
+
function handleCancel() {
|
|
17
|
+
setConfirmationInput("");
|
|
18
|
+
onOpenChange(false);
|
|
19
|
+
}
|
|
20
|
+
function handleOpenChange(nextOpen) {
|
|
21
|
+
if (!nextOpen) {
|
|
22
|
+
setConfirmationInput("");
|
|
23
|
+
}
|
|
24
|
+
onOpenChange(nextOpen);
|
|
25
|
+
}
|
|
26
|
+
async function handleDelete() {
|
|
27
|
+
if (!isConfirmed)
|
|
28
|
+
return;
|
|
29
|
+
startDeleting(async () => {
|
|
30
|
+
try {
|
|
31
|
+
const authClient = auth.ready ? auth.client.current : undefined;
|
|
32
|
+
if (!authClient) {
|
|
33
|
+
throw new Error("Auth client is not available");
|
|
34
|
+
}
|
|
35
|
+
await authClient.deleteApiServer(api_server_id);
|
|
36
|
+
toast({
|
|
37
|
+
title: "API server deleted",
|
|
38
|
+
description: `The API server "${api_server_name}" has been permanently deleted.`,
|
|
39
|
+
});
|
|
40
|
+
setConfirmationInput("");
|
|
41
|
+
onOpenChange(false);
|
|
42
|
+
clearUseApiServersCache(mutate);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
toast({
|
|
46
|
+
variant: "destructive",
|
|
47
|
+
title: "Failed to delete API server",
|
|
48
|
+
description: error instanceof Error ? error.message : "An unknown error occurred",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return (_jsx(Dialog, { open: open, onOpenChange: handleOpenChange, children: _jsxs(DialogContent, { className: "sm:max-w-[425px]", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Delete API Server" }), _jsx(DialogDescription, { children: "This action cannot be undone. This will permanently delete the API server and remove all associated data including domains and access keys." })] }), _jsx("div", { className: "flex flex-col gap-4 py-4", children: _jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs(Label, { htmlFor: "confirm-api-server-name", children: ["Type ", _jsx("span", { className: "font-bold", children: api_server_name }), " to confirm"] }), _jsx(Input, { id: "confirm-api-server-name", "data-testid": "confirm-api-server-name-input", placeholder: api_server_name, value: confirmationInput, onChange: (e) => setConfirmationInput(e.target.value), disabled: deleting })] }) }), _jsxs(DialogFooter, { className: "gap-2 sm:gap-0", children: [_jsx(Button, { type: "button", variant: "outline", onClick: handleCancel, disabled: deleting, children: "Cancel" }), _jsxs(Button, { type: "button", variant: "destructive", onClick: handleDelete, disabled: !isConfirmed || deleting, "data-testid": "confirm-delete-api-server-button", children: [_jsx(Trash2, { className: "h-4 w-4 mr-2" }), "Delete API Server"] })] })] }) }));
|
|
54
|
+
}
|
|
55
|
+
export default DeleteApiServerDialog;
|
|
56
|
+
//# sourceMappingURL=DeleteApiServerDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeleteApiServerDialog.js","sourceRoot":"","sources":["../../../src/components/DeleteApiServerDialog/DeleteApiServerDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,MAAM,EACN,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,KAAK,EACL,KAAK,EACL,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAqB,QAAQ,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAS5D,MAAM,UAAU,qBAAqB,CAAC,EACpC,aAAa,EACb,eAAe,EACf,IAAI,EACJ,YAAY,GACe;IAC3B,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC/D,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,GAAG,aAAa,EAAE,CAAC;IAClD,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IAEvB,MAAM,WAAW,GAAG,iBAAiB,KAAK,eAAe,CAAC;IAE1D,SAAS,YAAY;QACnB,oBAAoB,CAAC,EAAE,CAAC,CAAC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kB,aACzC,MAAC,YAAY,eACX,KAAC,WAAW,oCAAgC,EAC5C,KAAC,iBAAiB,8JAGE,IACP,EAEf,cAAK,SAAS,EAAC,0BAA0B,YACvC,eAAK,SAAS,EAAC,qBAAqB,aAClC,MAAC,KAAK,IAAC,OAAO,EAAC,yBAAyB,sBACjC,eAAM,SAAS,EAAC,WAAW,YAAE,eAAe,GAAQ,mBAEnD,EACR,KAAC,KAAK,IACJ,EAAE,EAAC,yBAAyB,iBAChB,+BAA+B,EAC3C,WAAW,EAAE,eAAe,EAC5B,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACrD,QAAQ,EAAE,QAAQ,GAClB,IACE,GACF,EAEN,MAAC,YAAY,IAAC,SAAS,EAAC,gBAAgB,aACtC,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,QAAQ,uBAGX,EACT,MAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,aAAa,EACrB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,CAAC,WAAW,IAAI,QAAQ,iBACtB,kCAAkC,aAE9C,KAAC,MAAM,IAAC,SAAS,EAAC,cAAc,GAAG,yBAE5B,IACI,IACD,GACT,CACV,CAAC;AACJ,CAAC;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DeleteApiServerDialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
export interface DeleteAppDialogProps {
|
|
3
|
+
app_id: string;
|
|
4
|
+
app_name: string;
|
|
5
|
+
open: boolean;
|
|
6
|
+
onOpenChange: (open: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function DeleteAppDialog({ app_id, app_name, open, onOpenChange, }: DeleteAppDialogProps): ReactElement;
|
|
9
|
+
export default DeleteAppDialog;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, Input, Label, useToast, } from "@schemavaults/ui";
|
|
4
|
+
import { useState, useTransition } from "react";
|
|
5
|
+
import { Trash2 } from "lucide-react";
|
|
6
|
+
import { useSWRConfig } from "swr";
|
|
7
|
+
import { clearUseAppsListCache } from "../AppsTable/useAppsList";
|
|
8
|
+
import { useAuth } from "@schemavaults/auth-react-provider";
|
|
9
|
+
export function DeleteAppDialog({ app_id, app_name, open, onOpenChange, }) {
|
|
10
|
+
const [confirmationInput, setConfirmationInput] = useState("");
|
|
11
|
+
const [deleting, startDeleting] = useTransition();
|
|
12
|
+
const { toast } = useToast();
|
|
13
|
+
const { mutate } = useSWRConfig();
|
|
14
|
+
const auth = useAuth();
|
|
15
|
+
const isConfirmed = confirmationInput === app_name;
|
|
16
|
+
function handleCancel() {
|
|
17
|
+
setConfirmationInput("");
|
|
18
|
+
onOpenChange(false);
|
|
19
|
+
}
|
|
20
|
+
function handleOpenChange(nextOpen) {
|
|
21
|
+
if (!nextOpen) {
|
|
22
|
+
setConfirmationInput("");
|
|
23
|
+
}
|
|
24
|
+
onOpenChange(nextOpen);
|
|
25
|
+
}
|
|
26
|
+
async function handleDelete() {
|
|
27
|
+
if (!isConfirmed)
|
|
28
|
+
return;
|
|
29
|
+
startDeleting(async () => {
|
|
30
|
+
try {
|
|
31
|
+
const authClient = auth.ready ? auth.client.current : undefined;
|
|
32
|
+
if (!authClient) {
|
|
33
|
+
throw new Error("Auth client is not available");
|
|
34
|
+
}
|
|
35
|
+
await authClient.deleteClientApplication(app_id);
|
|
36
|
+
toast({
|
|
37
|
+
title: "App deleted",
|
|
38
|
+
description: `The app "${app_name}" has been permanently deleted.`,
|
|
39
|
+
});
|
|
40
|
+
setConfirmationInput("");
|
|
41
|
+
onOpenChange(false);
|
|
42
|
+
clearUseAppsListCache(mutate);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
toast({
|
|
46
|
+
variant: "destructive",
|
|
47
|
+
title: "Failed to delete app",
|
|
48
|
+
description: error instanceof Error ? error.message : "An unknown error occurred",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return (_jsx(Dialog, { open: open, onOpenChange: handleOpenChange, children: _jsxs(DialogContent, { className: "sm:max-w-[425px]", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Delete App" }), _jsx(DialogDescription, { children: "This action cannot be undone. This will permanently delete the app and remove all associated data including domains and API connections." })] }), _jsx("div", { className: "flex flex-col gap-4 py-4", children: _jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs(Label, { htmlFor: "confirm-app-name", children: ["Type ", _jsx("span", { className: "font-bold", children: app_name }), " to confirm"] }), _jsx(Input, { id: "confirm-app-name", "data-testid": "confirm-app-name-input", placeholder: app_name, value: confirmationInput, onChange: (e) => setConfirmationInput(e.target.value), disabled: deleting })] }) }), _jsxs(DialogFooter, { className: "gap-2 sm:gap-0", children: [_jsx(Button, { type: "button", variant: "outline", onClick: handleCancel, disabled: deleting, children: "Cancel" }), _jsxs(Button, { type: "button", variant: "destructive", onClick: handleDelete, disabled: !isConfirmed || deleting, "data-testid": "confirm-delete-app-button", children: [_jsx(Trash2, { className: "h-4 w-4 mr-2" }), "Delete App"] })] })] }) }));
|
|
54
|
+
}
|
|
55
|
+
export default DeleteAppDialog;
|
|
56
|
+
//# sourceMappingURL=DeleteAppDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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AS,EAAC,WAAW,YAAE,QAAQ,GAAQ,mBAC5C,EACR,KAAC,KAAK,IACJ,EAAE,EAAC,kBAAkB,iBACT,wBAAwB,EACpC,WAAW,EAAE,QAAQ,EACrB,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACrD,QAAQ,EAAE,QAAQ,GAClB,IACE,GACF,EAEN,MAAC,YAAY,IAAC,SAAS,EAAC,gBAAgB,aACtC,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,QAAQ,uBAGX,EACT,MAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,aAAa,EACrB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,CAAC,WAAW,IAAI,QAAQ,iBACtB,2BAA2B,aAEvC,KAAC,MAAM,IAAC,SAAS,EAAC,cAAc,GAAG,kBAE5B,IACI,IACD,GACT,CACV,CAAC;AACJ,CAAC;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DeleteAppDialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -42,3 +42,7 @@ export { SentInvitationsCard } from "./SentInvitationsCard";
|
|
|
42
42
|
export type { SentInvitationsCardProps } from "./SentInvitationsCard";
|
|
43
43
|
export { OrganizationSettingsCard } from "./OrganizationSettingsCard";
|
|
44
44
|
export type { OrganizationSettingsCardProps } from "./OrganizationSettingsCard";
|
|
45
|
+
export { DeleteAppDialog } from "./DeleteAppDialog";
|
|
46
|
+
export type { DeleteAppDialogProps } from "./DeleteAppDialog";
|
|
47
|
+
export { DeleteApiServerDialog } from "./DeleteApiServerDialog";
|
|
48
|
+
export type { DeleteApiServerDialogProps } from "./DeleteApiServerDialog";
|
package/dist/components/index.js
CHANGED
|
@@ -19,4 +19,6 @@ export { SentInvitationsTable } from "./SentInvitationsTable";
|
|
|
19
19
|
export { useSentInvitations, clearSentInvitationsCache, getSentInvitationsEndpoint, } from "./SentInvitationsTable";
|
|
20
20
|
export { SentInvitationsCard } from "./SentInvitationsCard";
|
|
21
21
|
export { OrganizationSettingsCard } from "./OrganizationSettingsCard";
|
|
22
|
+
export { DeleteAppDialog } from "./DeleteAppDialog";
|
|
23
|
+
export { DeleteApiServerDialog } from "./DeleteApiServerDialog";
|
|
22
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAG9B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,YAAY,CAAC;AAK3B,cAAc,kBAAkB,CAAC;AAKjC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAM5B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,iCAAiC,GAClC,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAMtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAM1D,OAAO,EAAE,uBAA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ACL,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schemavaults/auth-ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.54",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"description": "React.js UI components for authentication/authorization shared between different SchemaVaults apps",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@schemavaults/ui": "0.14.4",
|
|
14
|
-
"@schemavaults/auth-react-provider": "0.10.
|
|
14
|
+
"@schemavaults/auth-react-provider": "0.10.11",
|
|
15
15
|
"@schemavaults/app-definitions": "0.6.19",
|
|
16
16
|
"@schemavaults/auth-common": "0.9.5",
|
|
17
17
|
"@hookform/resolvers": "3.9.0"
|