@better-auth-ui/heroui 1.6.5 → 1.6.7
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/auth/api-key/api-key-skeleton.d.ts +1 -0
- package/dist/components/auth/api-key/api-key-skeleton.js +21 -0
- package/dist/components/auth/api-key/api-key.d.ts +5 -0
- package/dist/components/auth/api-key/api-key.js +55 -0
- package/dist/components/auth/api-key/api-keys-empty.d.ts +4 -0
- package/dist/components/auth/api-key/api-keys-empty.js +35 -0
- package/dist/components/auth/api-key/api-keys.d.ts +6 -0
- package/dist/components/auth/api-key/api-keys.js +41 -0
- package/dist/components/auth/api-key/create-api-key-dialog.d.ts +5 -0
- package/dist/components/auth/api-key/create-api-key-dialog.js +74 -0
- package/dist/components/auth/api-key/delete-api-key-dialog.d.ts +7 -0
- package/dist/components/auth/api-key/delete-api-key-dialog.js +51 -0
- package/dist/components/auth/api-key/new-api-key-dialog.d.ts +7 -0
- package/dist/components/auth/api-key/new-api-key-dialog.js +60 -0
- package/dist/components/auth/delete-user/danger-zone.js +1 -1
- package/dist/components/auth/delete-user/delete-user.js +53 -53
- package/dist/components/auth/multi-session/switch-account-submenu-content.js +14 -15
- package/dist/components/auth/passkey/add-passkey-dialog.d.ts +0 -0
- package/dist/components/auth/passkey/delete-passkey-dialog.d.ts +0 -0
- package/dist/components/auth/passkey/passkey-skeleton.d.ts +0 -0
- package/dist/components/auth/passkey/passkeys-empty.d.ts +0 -0
- package/dist/components/auth/settings/security/linked-account.js +1 -1
- package/dist/components/auth/theme/theme-toggle-item.js +50 -46
- package/dist/components/auth/user/user-button.d.ts +27 -2
- package/dist/components/auth/user/user-button.js +48 -29
- package/dist/lib/auth/api-key-plugin.d.ts +23 -0
- package/dist/lib/auth/api-key-plugin.js +10 -0
- package/dist/plugins.d.ts +2 -0
- package/dist/plugins.js +22 -20
- package/package.json +14 -14
- package/src/components/auth/api-key/api-key-skeleton.tsx +17 -0
- package/src/components/auth/api-key/api-key.tsx +64 -0
- package/src/components/auth/api-key/api-keys-empty.tsx +33 -0
- package/src/components/auth/api-key/api-keys.tsx +71 -0
- package/src/components/auth/api-key/create-api-key-dialog.tsx +134 -0
- package/src/components/auth/api-key/delete-api-key-dialog.tsx +92 -0
- package/src/components/auth/api-key/new-api-key-dialog.tsx +94 -0
- package/src/components/auth/delete-user/danger-zone.tsx +1 -1
- package/src/components/auth/delete-user/delete-user.tsx +2 -7
- package/src/components/auth/multi-session/switch-account-submenu-content.tsx +1 -3
- package/src/components/auth/passkey/add-passkey-dialog.tsx +0 -0
- package/src/components/auth/passkey/delete-passkey-dialog.tsx +0 -0
- package/src/components/auth/passkey/passkey-skeleton.tsx +0 -0
- package/src/components/auth/passkey/passkeys-empty.tsx +0 -0
- package/src/components/auth/settings/security/linked-account.tsx +2 -4
- package/src/components/auth/theme/theme-toggle-item.tsx +2 -1
- package/src/components/auth/user/user-button.tsx +80 -13
- package/src/lib/auth/api-key-plugin.ts +15 -0
- package/src/plugins.ts +2 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ApiKeySkeleton(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Skeleton as e } from "@heroui/react";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/auth/api-key/api-key-skeleton.tsx
|
|
4
|
+
function r() {
|
|
5
|
+
return /* @__PURE__ */ t("div", {
|
|
6
|
+
className: "flex items-center justify-between",
|
|
7
|
+
children: /* @__PURE__ */ n("div", {
|
|
8
|
+
className: "flex items-center gap-3",
|
|
9
|
+
children: [/* @__PURE__ */ t(e, { className: "size-10 rounded-xl" }), /* @__PURE__ */ n("div", {
|
|
10
|
+
className: "flex flex-col gap-1",
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ t(e, { className: "h-4 w-28 rounded-lg" }),
|
|
13
|
+
/* @__PURE__ */ t(e, { className: "h-3 w-36 rounded-lg" }),
|
|
14
|
+
/* @__PURE__ */ t(e, { className: "h-3 w-32 rounded-lg" })
|
|
15
|
+
]
|
|
16
|
+
})]
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { r as ApiKeySkeleton };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { apiKeyPlugin as e } from "../../../lib/auth/api-key-plugin.js";
|
|
2
|
+
import { DeleteApiKeyDialog as t } from "./delete-api-key-dialog.js";
|
|
3
|
+
import { useAuth as n, useAuthPlugin as r } from "@better-auth-ui/react";
|
|
4
|
+
import { Key as i, Xmark as a } from "@gravity-ui/icons";
|
|
5
|
+
import { Button as o } from "@heroui/react";
|
|
6
|
+
import { useState as s } from "react";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/auth/api-key/api-key.tsx
|
|
9
|
+
function u({ apiKey: u }) {
|
|
10
|
+
let { localization: d } = n(), { localization: f } = r(e), [p, m] = s(!1), h = `${u.start}${"*".repeat(16)}`;
|
|
11
|
+
return /* @__PURE__ */ l("div", {
|
|
12
|
+
className: "flex items-center gap-3",
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ c("div", {
|
|
15
|
+
className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
|
|
16
|
+
children: /* @__PURE__ */ c(i, { className: "size-4.5" })
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ l("div", {
|
|
19
|
+
className: "flex flex-col min-w-0",
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ c("span", {
|
|
22
|
+
className: "text-sm font-medium leading-tight truncate",
|
|
23
|
+
children: u.name || f.apiKey
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ c("span", {
|
|
26
|
+
className: "text-xs text-muted font-mono truncate",
|
|
27
|
+
children: h
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ c("span", {
|
|
30
|
+
className: "text-xs text-muted",
|
|
31
|
+
children: new Date(u.createdAt).toLocaleString(void 0, {
|
|
32
|
+
dateStyle: "medium",
|
|
33
|
+
timeStyle: "short"
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ l(o, {
|
|
39
|
+
className: "ml-auto shrink-0",
|
|
40
|
+
variant: "outline",
|
|
41
|
+
size: "sm",
|
|
42
|
+
onPress: () => m(!0),
|
|
43
|
+
"aria-label": f.deleteApiKey,
|
|
44
|
+
children: [/* @__PURE__ */ c(a, {}), d.settings.delete]
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ c(t, {
|
|
47
|
+
isOpen: p,
|
|
48
|
+
onOpenChange: m,
|
|
49
|
+
apiKey: u
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { u as ApiKey };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { apiKeyPlugin as e } from "../../../lib/auth/api-key-plugin.js";
|
|
2
|
+
import { useAuthPlugin as t } from "@better-auth-ui/react";
|
|
3
|
+
import { Key as n } from "@gravity-ui/icons";
|
|
4
|
+
import { Button as r } from "@heroui/react";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/auth/api-key/api-keys-empty.tsx
|
|
7
|
+
function o({ onCreatePress: o }) {
|
|
8
|
+
let { localization: s } = t(e);
|
|
9
|
+
return /* @__PURE__ */ a("div", {
|
|
10
|
+
className: "flex flex-col items-center justify-center gap-4",
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ i("div", {
|
|
13
|
+
className: "flex size-10 items-center justify-center rounded-xl bg-surface-secondary",
|
|
14
|
+
children: /* @__PURE__ */ i(n, { className: "size-4.5" })
|
|
15
|
+
}),
|
|
16
|
+
/* @__PURE__ */ a("div", {
|
|
17
|
+
className: "flex flex-col items-center justify-center gap-1 text-center",
|
|
18
|
+
children: [/* @__PURE__ */ i("p", {
|
|
19
|
+
className: "text-sm font-semibold",
|
|
20
|
+
children: s.noApiKeys
|
|
21
|
+
}), /* @__PURE__ */ i("p", {
|
|
22
|
+
className: "text-muted text-xs",
|
|
23
|
+
children: s.apiKeysDescription
|
|
24
|
+
})]
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ i(r, {
|
|
27
|
+
size: "sm",
|
|
28
|
+
onPress: o,
|
|
29
|
+
children: s.createApiKey
|
|
30
|
+
})
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { o as ApiKeysEmpty };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { apiKeyPlugin as e } from "../../../lib/auth/api-key-plugin.js";
|
|
2
|
+
import { ApiKey as t } from "./api-key.js";
|
|
3
|
+
import { ApiKeySkeleton as n } from "./api-key-skeleton.js";
|
|
4
|
+
import { ApiKeysEmpty as r } from "./api-keys-empty.js";
|
|
5
|
+
import { CreateApiKeyDialog as i } from "./create-api-key-dialog.js";
|
|
6
|
+
import { useAuth as a, useAuthPlugin as o, useListApiKeys as s } from "@better-auth-ui/react";
|
|
7
|
+
import { Button as c, Card as l, cn as u } from "@heroui/react";
|
|
8
|
+
import { useState as d } from "react";
|
|
9
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
10
|
+
//#region src/components/auth/api-key/api-keys.tsx
|
|
11
|
+
function m({ className: m, variant: h }) {
|
|
12
|
+
let { authClient: g } = a(), { localization: _ } = o(e), { data: v, isPending: y } = s(g), [b, x] = d(!1);
|
|
13
|
+
return /* @__PURE__ */ p("div", {
|
|
14
|
+
className: u("flex flex-col gap-3", m),
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ p("div", {
|
|
17
|
+
className: "flex items-end justify-between gap-3",
|
|
18
|
+
children: [/* @__PURE__ */ f("h2", {
|
|
19
|
+
className: "text-sm font-semibold truncate",
|
|
20
|
+
children: _.apiKeys
|
|
21
|
+
}), /* @__PURE__ */ f(c, {
|
|
22
|
+
className: "shrink-0",
|
|
23
|
+
size: "sm",
|
|
24
|
+
isDisabled: y,
|
|
25
|
+
onPress: () => x(!0),
|
|
26
|
+
children: _.createApiKey
|
|
27
|
+
})]
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ f(l, {
|
|
30
|
+
variant: h,
|
|
31
|
+
children: /* @__PURE__ */ f(l.Content, { children: y ? /* @__PURE__ */ f(n, {}) : v?.apiKeys.length ? v?.apiKeys.map((e, n) => /* @__PURE__ */ p("div", { children: [n > 0 && /* @__PURE__ */ f("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ f(t, { apiKey: e })] }, e.id)) : /* @__PURE__ */ f(r, { onCreatePress: () => x(!0) }) })
|
|
32
|
+
}),
|
|
33
|
+
/* @__PURE__ */ f(i, {
|
|
34
|
+
isOpen: b,
|
|
35
|
+
onOpenChange: x
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { m as ApiKeys };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { apiKeyPlugin as e } from "../../../lib/auth/api-key-plugin.js";
|
|
2
|
+
import { NewApiKeyDialog as t } from "./new-api-key-dialog.js";
|
|
3
|
+
import { useAuth as n, useAuthPlugin as r, useCreateApiKey as i } from "@better-auth-ui/react";
|
|
4
|
+
import { Key as a } from "@gravity-ui/icons";
|
|
5
|
+
import { AlertDialog as o, Button as s, FieldError as c, Form as l, Input as u, Label as d, Spinner as f, TextField as p } from "@heroui/react";
|
|
6
|
+
import { useState as m } from "react";
|
|
7
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/auth/api-key/create-api-key-dialog.tsx
|
|
9
|
+
function v({ isOpen: v, onOpenChange: y }) {
|
|
10
|
+
let { authClient: b, localization: x } = n(), { localization: S } = r(e), { mutate: C, isPending: w } = i(b), [T, E] = m(!1), [D, O] = m(null), [k, A] = m(null), j = (e) => {
|
|
11
|
+
e || (O(null), A(null)), y(e);
|
|
12
|
+
};
|
|
13
|
+
return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(o.Backdrop, {
|
|
14
|
+
isOpen: v,
|
|
15
|
+
onOpenChange: j,
|
|
16
|
+
children: /* @__PURE__ */ g(o.Container, { children: /* @__PURE__ */ g(o.Dialog, { children: /* @__PURE__ */ _(l, {
|
|
17
|
+
onSubmit: (e) => {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
let t = new FormData(e.target).get("name");
|
|
20
|
+
C(t ? { name: t.trim() } : void 0, { onSuccess: (e) => {
|
|
21
|
+
j(!1), O(t), A(e.key), E(!0);
|
|
22
|
+
} });
|
|
23
|
+
},
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ g(o.CloseTrigger, {}),
|
|
26
|
+
/* @__PURE__ */ _(o.Header, { children: [/* @__PURE__ */ g(o.Icon, {
|
|
27
|
+
status: "default",
|
|
28
|
+
children: /* @__PURE__ */ g(a, {})
|
|
29
|
+
}), /* @__PURE__ */ g(o.Heading, { children: S.createApiKey })] }),
|
|
30
|
+
/* @__PURE__ */ _(o.Body, {
|
|
31
|
+
className: "overflow-visible",
|
|
32
|
+
children: [/* @__PURE__ */ g("p", {
|
|
33
|
+
className: "text-muted text-sm",
|
|
34
|
+
children: S.apiKeysDescription
|
|
35
|
+
}), /* @__PURE__ */ _(p, {
|
|
36
|
+
className: "mt-4",
|
|
37
|
+
id: "name",
|
|
38
|
+
name: "name",
|
|
39
|
+
isDisabled: w,
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ g(d, { children: S.name }),
|
|
42
|
+
/* @__PURE__ */ g(u, {
|
|
43
|
+
autoFocus: !0,
|
|
44
|
+
placeholder: x.settings.optional,
|
|
45
|
+
variant: "secondary"
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ g(c, {})
|
|
48
|
+
]
|
|
49
|
+
})]
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ _(o.Footer, { children: [/* @__PURE__ */ g(s, {
|
|
52
|
+
slot: "close",
|
|
53
|
+
variant: "tertiary",
|
|
54
|
+
isDisabled: w,
|
|
55
|
+
children: x.settings.cancel
|
|
56
|
+
}), /* @__PURE__ */ _(s, {
|
|
57
|
+
type: "submit",
|
|
58
|
+
isPending: w,
|
|
59
|
+
children: [w && /* @__PURE__ */ g(f, {
|
|
60
|
+
color: "current",
|
|
61
|
+
size: "sm"
|
|
62
|
+
}), S.createApiKey]
|
|
63
|
+
})] })
|
|
64
|
+
]
|
|
65
|
+
}) }) })
|
|
66
|
+
}), /* @__PURE__ */ g(t, {
|
|
67
|
+
isOpen: T,
|
|
68
|
+
onOpenChange: E,
|
|
69
|
+
secretKey: k,
|
|
70
|
+
name: D
|
|
71
|
+
})] });
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { v as CreateApiKeyDialog };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ListedApiKey } from '@better-auth-ui/react';
|
|
2
|
+
export type DeleteApiKeyDialogProps = {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onOpenChange: (open: boolean) => void;
|
|
5
|
+
apiKey: ListedApiKey;
|
|
6
|
+
};
|
|
7
|
+
export declare function DeleteApiKeyDialog({ isOpen, onOpenChange, apiKey }: DeleteApiKeyDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { apiKeyPlugin as e } from "../../../lib/auth/api-key-plugin.js";
|
|
2
|
+
import { useAuth as t, useAuthPlugin as n, useDeleteApiKey as r } from "@better-auth-ui/react";
|
|
3
|
+
import { Key as i } from "@gravity-ui/icons";
|
|
4
|
+
import { AlertDialog as a, Button as o, Input as s, Label as c, Spinner as l, TextField as u } from "@heroui/react";
|
|
5
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/auth/api-key/delete-api-key-dialog.tsx
|
|
7
|
+
function p({ isOpen: p, onOpenChange: m, apiKey: h }) {
|
|
8
|
+
let { authClient: g, localization: _ } = t(), { localization: v } = n(e), y = `${h.start}${"*".repeat(16)}`, { mutate: b, isPending: x } = r(g, { onSuccess: () => m(!1) });
|
|
9
|
+
return /* @__PURE__ */ d(a.Backdrop, {
|
|
10
|
+
isOpen: p,
|
|
11
|
+
onOpenChange: m,
|
|
12
|
+
children: /* @__PURE__ */ d(a.Container, { children: /* @__PURE__ */ f(a.Dialog, { children: [
|
|
13
|
+
/* @__PURE__ */ d(a.CloseTrigger, {}),
|
|
14
|
+
/* @__PURE__ */ f(a.Header, { children: [/* @__PURE__ */ d(a.Icon, {
|
|
15
|
+
status: "danger",
|
|
16
|
+
children: /* @__PURE__ */ d(i, {})
|
|
17
|
+
}), /* @__PURE__ */ d(a.Heading, { children: v.deleteApiKey })] }),
|
|
18
|
+
/* @__PURE__ */ f(a.Body, {
|
|
19
|
+
className: "flex flex-col gap-4 overflow-visible",
|
|
20
|
+
children: [/* @__PURE__ */ d("p", {
|
|
21
|
+
className: "text-muted text-sm",
|
|
22
|
+
children: v.deleteApiKeyWarning
|
|
23
|
+
}), /* @__PURE__ */ f(u, {
|
|
24
|
+
value: y,
|
|
25
|
+
className: "font-mono text-xs",
|
|
26
|
+
variant: "secondary",
|
|
27
|
+
children: [/* @__PURE__ */ d(c, { children: h.name || v.apiKey }), /* @__PURE__ */ d(s, {
|
|
28
|
+
readOnly: !0,
|
|
29
|
+
className: "font-mono text-xs"
|
|
30
|
+
})]
|
|
31
|
+
})]
|
|
32
|
+
}),
|
|
33
|
+
/* @__PURE__ */ f(a.Footer, { children: [/* @__PURE__ */ d(o, {
|
|
34
|
+
slot: "close",
|
|
35
|
+
variant: "tertiary",
|
|
36
|
+
isDisabled: x,
|
|
37
|
+
children: _.settings.cancel
|
|
38
|
+
}), /* @__PURE__ */ f(o, {
|
|
39
|
+
variant: "danger",
|
|
40
|
+
onPress: () => b({ keyId: h.id }),
|
|
41
|
+
isPending: x,
|
|
42
|
+
children: [x && /* @__PURE__ */ d(l, {
|
|
43
|
+
color: "current",
|
|
44
|
+
size: "sm"
|
|
45
|
+
}), v.deleteApiKey]
|
|
46
|
+
})] })
|
|
47
|
+
] }) })
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { p as DeleteApiKeyDialog };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type NewApiKeyDialogProps = {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
onOpenChange: (open: boolean) => void;
|
|
4
|
+
name: string | null;
|
|
5
|
+
secretKey: string | null;
|
|
6
|
+
};
|
|
7
|
+
export declare function NewApiKeyDialog({ isOpen, onOpenChange, name, secretKey }: NewApiKeyDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { apiKeyPlugin as e } from "../../../lib/auth/api-key-plugin.js";
|
|
2
|
+
import { useAuth as t, useAuthPlugin as n } from "@better-auth-ui/react";
|
|
3
|
+
import { Check as r, Copy as i, Key as a } from "@gravity-ui/icons";
|
|
4
|
+
import { AlertDialog as o, Button as s, InputGroup as c, Label as l, TextField as u, toast as d } from "@heroui/react";
|
|
5
|
+
import { useState as f } from "react";
|
|
6
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/auth/api-key/new-api-key-dialog.tsx
|
|
8
|
+
function h({ isOpen: h, onOpenChange: g, name: _, secretKey: v }) {
|
|
9
|
+
let { localization: y } = t(), { localization: b } = n(e), [x, S] = f(!1);
|
|
10
|
+
return /* @__PURE__ */ p(o.Backdrop, {
|
|
11
|
+
isOpen: h,
|
|
12
|
+
onOpenChange: g,
|
|
13
|
+
children: /* @__PURE__ */ p(o.Container, { children: /* @__PURE__ */ m(o.Dialog, { children: [
|
|
14
|
+
/* @__PURE__ */ p(o.CloseTrigger, {}),
|
|
15
|
+
/* @__PURE__ */ m(o.Header, { children: [/* @__PURE__ */ p(o.Icon, {
|
|
16
|
+
status: "warning",
|
|
17
|
+
children: /* @__PURE__ */ p(a, {})
|
|
18
|
+
}), /* @__PURE__ */ p(o.Heading, { children: b.newApiKey })] }),
|
|
19
|
+
/* @__PURE__ */ m(o.Body, {
|
|
20
|
+
className: "flex flex-col gap-4 overflow-visible",
|
|
21
|
+
children: [/* @__PURE__ */ p("p", {
|
|
22
|
+
className: "text-muted text-sm",
|
|
23
|
+
children: b.newApiKeyWarning
|
|
24
|
+
}), /* @__PURE__ */ m(u, {
|
|
25
|
+
value: v ?? "",
|
|
26
|
+
className: "font-mono text-xs",
|
|
27
|
+
children: [/* @__PURE__ */ p(l, { children: _ || b.apiKey }), /* @__PURE__ */ m(c, {
|
|
28
|
+
variant: "secondary",
|
|
29
|
+
children: [/* @__PURE__ */ p(c.Input, {
|
|
30
|
+
readOnly: !0,
|
|
31
|
+
className: "font-mono text-xs"
|
|
32
|
+
}), /* @__PURE__ */ p(c.Suffix, {
|
|
33
|
+
className: "px-0",
|
|
34
|
+
children: /* @__PURE__ */ p(s, {
|
|
35
|
+
isIconOnly: !0,
|
|
36
|
+
"aria-label": y.settings.copyToClipboard,
|
|
37
|
+
size: "sm",
|
|
38
|
+
variant: "ghost",
|
|
39
|
+
onPress: async () => {
|
|
40
|
+
if (v) try {
|
|
41
|
+
await navigator.clipboard.writeText(v), S(!0), setTimeout(() => S(!1), 1500);
|
|
42
|
+
} catch (e) {
|
|
43
|
+
d.danger(e instanceof Error ? e.message : String(e));
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
children: p(x ? r : i, {})
|
|
47
|
+
})
|
|
48
|
+
})]
|
|
49
|
+
})]
|
|
50
|
+
})]
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ p(o.Footer, { children: /* @__PURE__ */ p(s, {
|
|
53
|
+
slot: "close",
|
|
54
|
+
children: b.dismissNewKey
|
|
55
|
+
}) })
|
|
56
|
+
] }) })
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { h as NewApiKeyDialog };
|
|
@@ -9,7 +9,7 @@ function a({ className: a, variant: o, ...s }) {
|
|
|
9
9
|
className: n("flex w-full flex-col", a),
|
|
10
10
|
...s,
|
|
11
11
|
children: [/* @__PURE__ */ r("h2", {
|
|
12
|
-
className: n("text-sm font-semibold mb-3"),
|
|
12
|
+
className: n("text-sm font-semibold mb-3 text-danger"),
|
|
13
13
|
children: c.settings.dangerZone
|
|
14
14
|
}), /* @__PURE__ */ r(e, { variant: o })]
|
|
15
15
|
});
|
|
@@ -2,88 +2,88 @@ import { deleteUserPlugin as e } from "../../../lib/auth/delete-user-plugin.js";
|
|
|
2
2
|
import { authQueryKeys as t } from "@better-auth-ui/core";
|
|
3
3
|
import { useAuth as n, useAuthPlugin as r, useDeleteUser as i, useListAccounts as a } from "@better-auth-ui/react";
|
|
4
4
|
import { TriangleExclamation as o } from "@gravity-ui/icons";
|
|
5
|
-
import { AlertDialog as s, Button as c, Card as l, FieldError as u, Form as d, Input as f, Label as p, Spinner as m, TextField as h,
|
|
6
|
-
import { useState as
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { useQueryClient as
|
|
5
|
+
import { AlertDialog as s, Button as c, Card as l, FieldError as u, Form as d, Input as f, Label as p, Spinner as m, TextField as h, toast as g } from "@heroui/react";
|
|
6
|
+
import { useState as _ } from "react";
|
|
7
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
8
|
+
import { useQueryClient as b } from "@tanstack/react-query";
|
|
9
9
|
//#region src/components/auth/delete-user/delete-user.tsx
|
|
10
|
-
function
|
|
11
|
-
let { authClient:
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
e.preventDefault(),
|
|
15
|
-
|
|
16
|
-
to: `${
|
|
10
|
+
function x({ className: x, variant: S, ...C }) {
|
|
11
|
+
let { authClient: w, basePaths: T, localization: E, navigate: D, viewPaths: O } = n(), { localization: k, sendDeleteAccountVerification: A } = r(e), { data: j } = a(w), M = b(), [N, P] = _(!1), [F, I] = _(""), L = j?.some((e) => e.providerId === "credential"), R = !A && L, { mutate: z, isPending: B } = i(w), V = (e) => {
|
|
12
|
+
P(e), I("");
|
|
13
|
+
}, H = async (e) => {
|
|
14
|
+
e.preventDefault(), z({ ...R ? { password: F } : {} }, { onSuccess: () => {
|
|
15
|
+
P(!1), I(""), A ? g.success(k.deleteUserVerificationSent) : (g.success(k.deleteUserSuccess), M.removeQueries({ queryKey: t.all }), D({
|
|
16
|
+
to: `${T.auth}/${O.auth.signIn}`,
|
|
17
17
|
replace: !0
|
|
18
18
|
}));
|
|
19
19
|
} });
|
|
20
20
|
};
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
className:
|
|
23
|
-
variant:
|
|
24
|
-
...
|
|
25
|
-
children: /* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ v(l, {
|
|
22
|
+
className: x,
|
|
23
|
+
variant: S,
|
|
24
|
+
...C,
|
|
25
|
+
children: /* @__PURE__ */ y(l.Content, {
|
|
26
26
|
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
27
|
-
children: [/* @__PURE__ */
|
|
27
|
+
children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("p", {
|
|
28
28
|
className: "text-sm font-medium leading-tight",
|
|
29
|
-
children:
|
|
30
|
-
}), /* @__PURE__ */
|
|
29
|
+
children: k.deleteUser
|
|
30
|
+
}), /* @__PURE__ */ v("p", {
|
|
31
31
|
className: "text-muted text-xs mt-0.5",
|
|
32
|
-
children:
|
|
33
|
-
})] }), /* @__PURE__ */
|
|
34
|
-
isDisabled: !
|
|
32
|
+
children: k.deleteUserDescription
|
|
33
|
+
})] }), /* @__PURE__ */ y(s, { children: [/* @__PURE__ */ v(c, {
|
|
34
|
+
isDisabled: !j,
|
|
35
35
|
size: "sm",
|
|
36
|
-
variant: "danger",
|
|
37
|
-
onPress: () =>
|
|
38
|
-
children:
|
|
39
|
-
}), /* @__PURE__ */
|
|
40
|
-
isOpen:
|
|
41
|
-
onOpenChange:
|
|
42
|
-
children: /* @__PURE__ */
|
|
43
|
-
onSubmit:
|
|
36
|
+
variant: "danger-soft",
|
|
37
|
+
onPress: () => P(!0),
|
|
38
|
+
children: k.deleteUser
|
|
39
|
+
}), /* @__PURE__ */ v(s.Backdrop, {
|
|
40
|
+
isOpen: N,
|
|
41
|
+
onOpenChange: V,
|
|
42
|
+
children: /* @__PURE__ */ v(s.Container, { children: /* @__PURE__ */ v(s.Dialog, { children: /* @__PURE__ */ y(d, {
|
|
43
|
+
onSubmit: H,
|
|
44
44
|
children: [
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ v(s.CloseTrigger, {}),
|
|
46
|
+
/* @__PURE__ */ y(s.Header, { children: [/* @__PURE__ */ v(s.Icon, {
|
|
47
47
|
status: "danger",
|
|
48
|
-
children: /* @__PURE__ */
|
|
49
|
-
}), /* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
48
|
+
children: /* @__PURE__ */ v(o, {})
|
|
49
|
+
}), /* @__PURE__ */ v(s.Heading, { children: k.deleteUser })] }),
|
|
50
|
+
/* @__PURE__ */ y(s.Body, {
|
|
51
51
|
className: "overflow-visible",
|
|
52
|
-
children: [/* @__PURE__ */
|
|
52
|
+
children: [/* @__PURE__ */ v("p", {
|
|
53
53
|
className: "text-muted text-sm",
|
|
54
|
-
children:
|
|
55
|
-
}),
|
|
54
|
+
children: k.deleteUserDescription
|
|
55
|
+
}), R && /* @__PURE__ */ y(h, {
|
|
56
56
|
className: "mt-4",
|
|
57
57
|
name: "password",
|
|
58
58
|
type: "password",
|
|
59
|
-
isDisabled:
|
|
60
|
-
value:
|
|
61
|
-
onChange:
|
|
59
|
+
isDisabled: B,
|
|
60
|
+
value: F,
|
|
61
|
+
onChange: I,
|
|
62
62
|
children: [
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
/* @__PURE__ */
|
|
63
|
+
/* @__PURE__ */ v(p, { children: E.auth.password }),
|
|
64
|
+
/* @__PURE__ */ v(f, {
|
|
65
65
|
autoComplete: "current-password",
|
|
66
|
-
placeholder:
|
|
66
|
+
placeholder: E.auth.passwordPlaceholder,
|
|
67
67
|
required: !0,
|
|
68
68
|
variant: "secondary"
|
|
69
69
|
}),
|
|
70
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ v(u, {})
|
|
71
71
|
]
|
|
72
72
|
})]
|
|
73
73
|
}),
|
|
74
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ y(s.Footer, { children: [/* @__PURE__ */ v(c, {
|
|
75
75
|
slot: "close",
|
|
76
76
|
variant: "tertiary",
|
|
77
|
-
isDisabled:
|
|
78
|
-
children:
|
|
79
|
-
}), /* @__PURE__ */
|
|
77
|
+
isDisabled: B,
|
|
78
|
+
children: E.settings.cancel
|
|
79
|
+
}), /* @__PURE__ */ y(c, {
|
|
80
80
|
type: "submit",
|
|
81
81
|
variant: "danger",
|
|
82
|
-
isPending:
|
|
83
|
-
children: [
|
|
82
|
+
isPending: B,
|
|
83
|
+
children: [B && /* @__PURE__ */ v(m, {
|
|
84
84
|
color: "current",
|
|
85
85
|
size: "sm"
|
|
86
|
-
}),
|
|
86
|
+
}), k.deleteUser]
|
|
87
87
|
})] })
|
|
88
88
|
]
|
|
89
89
|
}) }) })
|
|
@@ -92,4 +92,4 @@ function S({ className: S, variant: C, ...w }) {
|
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
//#endregion
|
|
95
|
-
export {
|
|
95
|
+
export { x as DeleteUser };
|
|
@@ -3,27 +3,26 @@ import { SwitchAccountSubmenuItem as t } from "./switch-account-submenu-item.js"
|
|
|
3
3
|
import { multiSessionPlugin as n } from "../../../lib/auth/multi-session-plugin.js";
|
|
4
4
|
import { useAuth as r, useAuthPlugin as i, useListDeviceSessions as a, useSession as o } from "@better-auth-ui/react";
|
|
5
5
|
import { Check as s, CirclePlus as c } from "@gravity-ui/icons";
|
|
6
|
-
import { Dropdown as l, Label as u
|
|
7
|
-
import { jsx as
|
|
6
|
+
import { Dropdown as l, Label as u } from "@heroui/react";
|
|
7
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/auth/multi-session/switch-account-submenu-content.tsx
|
|
9
|
-
function
|
|
10
|
-
let { authClient:
|
|
11
|
-
return /* @__PURE__ */
|
|
9
|
+
function p() {
|
|
10
|
+
let { authClient: p, basePaths: m, viewPaths: h } = r(), { localization: g } = i(n), { data: _ } = o(p), { data: v, isPending: y } = a(p);
|
|
11
|
+
return /* @__PURE__ */ d(l.Popover, {
|
|
12
12
|
className: "min-w-40 md:min-w-56 max-w-[48svw]",
|
|
13
|
-
children: /* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
13
|
+
children: /* @__PURE__ */ f(l.Menu, { children: [
|
|
14
|
+
/* @__PURE__ */ f(l.Item, {
|
|
15
15
|
className: "px-2",
|
|
16
|
-
children: [/* @__PURE__ */
|
|
16
|
+
children: [/* @__PURE__ */ d(e, { isPending: y }), !y && /* @__PURE__ */ d(s, { className: "ml-auto" })]
|
|
17
17
|
}),
|
|
18
|
-
|
|
19
|
-
/* @__PURE__ */ f(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
children: [/* @__PURE__ */ f(c, { className: "text-muted" }), /* @__PURE__ */ f(u, { children: _.addAccount })]
|
|
18
|
+
v?.filter((e) => e.session.id !== _?.session?.id).map((e) => /* @__PURE__ */ d(t, { deviceSession: e }, e.session.id)),
|
|
19
|
+
/* @__PURE__ */ f(l.Item, {
|
|
20
|
+
textValue: g.addAccount,
|
|
21
|
+
href: `${m.auth}/${h.auth.signIn}`,
|
|
22
|
+
children: [/* @__PURE__ */ d(c, { className: "text-muted" }), /* @__PURE__ */ d(u, { children: g.addAccount })]
|
|
24
23
|
})
|
|
25
24
|
] })
|
|
26
25
|
});
|
|
27
26
|
}
|
|
28
27
|
//#endregion
|
|
29
|
-
export {
|
|
28
|
+
export { p as SwitchAccountSubmenuContent };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -11,7 +11,7 @@ function g({ account: g, provider: _ }) {
|
|
|
11
11
|
children: [
|
|
12
12
|
/* @__PURE__ */ m("div", {
|
|
13
13
|
className: f("flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary"),
|
|
14
|
-
children: m(D || c, { className:
|
|
14
|
+
children: m(D || c, { className: "size-4.5" })
|
|
15
15
|
}),
|
|
16
16
|
/* @__PURE__ */ h("div", {
|
|
17
17
|
className: "flex flex-col min-w-0",
|