@better-auth-ui/heroui 1.6.2 → 1.6.3
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/auth-provider.js +12 -11
- package/dist/components/auth/auth.d.ts +1 -1
- package/dist/components/auth/error-toaster.d.ts +1 -0
- package/dist/components/auth/error-toaster.js +17 -0
- package/dist/components/auth/forgot-password.d.ts +1 -1
- package/dist/components/auth/forgot-password.js +3 -6
- package/dist/components/auth/magic-link.d.ts +1 -1
- package/dist/components/auth/magic-link.js +52 -64
- package/dist/components/auth/passkey-button.js +12 -15
- package/dist/components/auth/provider-button.d.ts +15 -0
- package/dist/components/auth/provider-button.js +29 -0
- package/dist/components/auth/provider-buttons.d.ts +4 -10
- package/dist/components/auth/provider-buttons.js +16 -23
- package/dist/components/auth/reset-password.d.ts +1 -1
- package/dist/components/auth/reset-password.js +3 -6
- package/dist/components/auth/sign-in.d.ts +1 -1
- package/dist/components/auth/sign-in.js +81 -93
- package/dist/components/auth/sign-up.d.ts +1 -1
- package/dist/components/auth/sign-up.js +99 -108
- package/dist/components/settings/account/appearance.d.ts +1 -1
- package/dist/components/settings/account/change-avatar.js +1 -1
- package/dist/components/settings/account/change-email.d.ts +1 -1
- package/dist/components/settings/account/change-email.js +1 -4
- package/dist/components/settings/account/manage-account.js +1 -4
- package/dist/components/settings/account/manage-accounts.d.ts +1 -1
- package/dist/components/settings/account/manage-accounts.js +16 -16
- package/dist/components/settings/account/user-profile.d.ts +1 -1
- package/dist/components/settings/account/user-profile.js +1 -4
- package/dist/components/settings/security/active-session.js +1 -4
- package/dist/components/settings/security/active-sessions.d.ts +1 -1
- package/dist/components/settings/security/active-sessions.js +17 -17
- package/dist/components/settings/security/change-password.d.ts +1 -1
- package/dist/components/settings/security/change-password.js +1 -4
- package/dist/components/settings/security/delete-user.d.ts +1 -1
- package/dist/components/settings/security/delete-user.js +6 -11
- package/dist/components/settings/security/linked-account.js +1 -7
- package/dist/components/settings/security/linked-accounts.d.ts +1 -1
- package/dist/components/settings/security/linked-accounts.js +18 -18
- package/dist/components/settings/security/passkey.js +19 -19
- package/dist/components/settings/security/passkeys.d.ts +1 -1
- package/dist/components/settings/security/passkeys.js +28 -28
- package/dist/components/user/switch-account-item.js +9 -9
- package/dist/components/user/switch-account-menu.js +16 -16
- package/dist/index.d.ts +1 -0
- package/dist/index.js +34 -33
- package/package.json +6 -4
- package/src/components/auth/auth-provider.tsx +4 -0
- package/src/components/auth/auth.tsx +1 -1
- package/src/components/auth/error-toaster.tsx +25 -0
- package/src/components/auth/forgot-password.tsx +1 -2
- package/src/components/auth/magic-link.tsx +3 -23
- package/src/components/auth/passkey-button.tsx +1 -2
- package/src/components/auth/provider-button.tsx +67 -0
- package/src/components/auth/provider-buttons.tsx +26 -43
- package/src/components/auth/reset-password.tsx +1 -2
- package/src/components/auth/sign-in.tsx +2 -20
- package/src/components/auth/sign-up.tsx +5 -20
- package/src/components/settings/account/appearance.tsx +1 -1
- package/src/components/settings/account/change-avatar.tsx +1 -3
- package/src/components/settings/account/change-email.tsx +2 -3
- package/src/components/settings/account/manage-account.tsx +1 -4
- package/src/components/settings/account/manage-accounts.tsx +3 -8
- package/src/components/settings/account/user-profile.tsx +1 -2
- package/src/components/settings/security/active-session.tsx +0 -1
- package/src/components/settings/security/active-sessions.tsx +3 -8
- package/src/components/settings/security/change-password.tsx +7 -4
- package/src/components/settings/security/delete-user.tsx +1 -4
- package/src/components/settings/security/linked-account.tsx +4 -14
- package/src/components/settings/security/linked-accounts.tsx +3 -8
- package/src/components/settings/security/passkey.tsx +2 -4
- package/src/components/settings/security/passkeys.tsx +4 -12
- package/src/components/user/switch-account-item.tsx +2 -4
- package/src/components/user/switch-account-menu.tsx +2 -7
- package/src/index.tsx +1 -0
|
@@ -5,10 +5,7 @@ import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
|
5
5
|
import { ArrowRightArrowLeft as d, ArrowRightFromSquare as f, Ellipsis as p } from "@gravity-ui/icons";
|
|
6
6
|
//#region src/components/settings/account/manage-account.tsx
|
|
7
7
|
function m({ deviceSession: m, isPending: h }) {
|
|
8
|
-
let { localization: g } = t(), { data: _ } = i(), { mutate: v, isPending: y } = r({
|
|
9
|
-
onError: (e) => c.danger(e.error?.message || e.message),
|
|
10
|
-
onSuccess: () => c.success(g.settings.revokeSessionSuccess)
|
|
11
|
-
}), S = m?.session.userId === _?.id, C = y || x;
|
|
8
|
+
let { localization: g } = t(), { data: _ } = i(), { mutate: v, isPending: y } = r(), { mutate: b, isPending: x } = n({ onSuccess: () => c.success(g.settings.revokeSessionSuccess) }), S = m?.session.userId === _?.id, C = y || x;
|
|
12
9
|
return /* @__PURE__ */ u("div", {
|
|
13
10
|
className: "flex items-center justify-between gap-3",
|
|
14
11
|
children: [
|
|
@@ -11,4 +11,4 @@ export type ManageAccountsProps = {
|
|
|
11
11
|
*
|
|
12
12
|
* @returns A JSX element containing the accounts management card
|
|
13
13
|
*/
|
|
14
|
-
export declare function ManageAccounts({ className, variant, ...props }: ManageAccountsProps & CardProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function ManageAccounts({ className, variant, ...props }: ManageAccountsProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { ManageAccount as e } from "./manage-account.js";
|
|
2
2
|
import { useAuth as t, useListDeviceSessions as n, useSession as r } from "@better-auth-ui/react";
|
|
3
|
-
import { Card as i, cn as a
|
|
4
|
-
import { jsx as
|
|
3
|
+
import { Card as i, cn as a } from "@heroui/react";
|
|
4
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/settings/account/manage-accounts.tsx
|
|
6
|
-
function
|
|
7
|
-
let { localization:
|
|
6
|
+
function c({ className: c, variant: l, ...u }) {
|
|
7
|
+
let { localization: d } = t(), { data: f } = r(), { data: p, isPending: m } = n(), h = p?.filter((e) => e.session.id !== f?.session.id), g = [{
|
|
8
8
|
key: "current",
|
|
9
|
-
deviceSession:
|
|
10
|
-
isPending:
|
|
11
|
-
}, ...
|
|
9
|
+
deviceSession: m ? null : f,
|
|
10
|
+
isPending: m
|
|
11
|
+
}, ...h?.map((e) => ({
|
|
12
12
|
key: e.session.id,
|
|
13
13
|
deviceSession: e,
|
|
14
14
|
isPending: !1
|
|
15
15
|
})) ?? []];
|
|
16
|
-
return /* @__PURE__ */
|
|
16
|
+
return /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("h2", {
|
|
17
17
|
className: a("text-sm font-semibold mb-3"),
|
|
18
|
-
children:
|
|
19
|
-
}), /* @__PURE__ */
|
|
20
|
-
className: a(
|
|
21
|
-
variant:
|
|
22
|
-
...
|
|
23
|
-
children: /* @__PURE__ */
|
|
18
|
+
children: d.settings.manageAccounts
|
|
19
|
+
}), /* @__PURE__ */ o(i, {
|
|
20
|
+
className: a(c),
|
|
21
|
+
variant: l,
|
|
22
|
+
...u,
|
|
23
|
+
children: /* @__PURE__ */ o(i.Content, {
|
|
24
24
|
className: "gap-0",
|
|
25
|
-
children:
|
|
25
|
+
children: g.map((t, n) => /* @__PURE__ */ s("div", { children: [n > 0 && /* @__PURE__ */ o("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ o(e, {
|
|
26
26
|
deviceSession: t.deviceSession,
|
|
27
27
|
isPending: t.isPending
|
|
28
28
|
})] }, t.key))
|
|
@@ -30,4 +30,4 @@ function l({ className: l, variant: u, ...d }) {
|
|
|
30
30
|
})] });
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
|
33
|
-
export {
|
|
33
|
+
export { c as ManageAccounts };
|
|
@@ -8,4 +8,4 @@ export type UserProfileProps = {
|
|
|
8
8
|
*
|
|
9
9
|
* @returns A JSX element containing the user profile card with avatar upload and editable form fields
|
|
10
10
|
*/
|
|
11
|
-
export declare function UserProfile({ className, variant, ...props }: UserProfileProps & CardProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function UserProfile({ className, variant, ...props }: UserProfileProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -21,10 +21,7 @@ function T({ className: T, variant: E, ...D }) {
|
|
|
21
21
|
function z(e) {
|
|
22
22
|
N(e), L(), k?.isUsernameAvailable && R.maybeExecute(e);
|
|
23
23
|
}
|
|
24
|
-
let { mutate: B, isPending: V } = i({
|
|
25
|
-
onError: (e) => _.danger(e.error?.message || e.message),
|
|
26
|
-
onSuccess: () => _.success(O.settings.profileUpdatedSuccess)
|
|
27
|
-
});
|
|
24
|
+
let { mutate: B, isPending: V } = i({ onSuccess: () => _.success(O.settings.profileUpdatedSuccess) });
|
|
28
25
|
function H(e) {
|
|
29
26
|
e.preventDefault(), B({
|
|
30
27
|
name: new FormData(e.currentTarget).get("name"),
|
|
@@ -18,10 +18,7 @@ function m(e) {
|
|
|
18
18
|
return n.format(0, "second");
|
|
19
19
|
}
|
|
20
20
|
function h({ activeSession: h }) {
|
|
21
|
-
let { basePaths: g, localization: _, viewPaths: v, navigate: y } = e(), { data: b } = n({ refetchOnMount: !1 }), { mutate: x, isPending: S } = t({
|
|
22
|
-
onError: (e) => o.danger(e.error?.message || e.message),
|
|
23
|
-
onSuccess: () => o.success(_.settings.revokeSessionSuccess)
|
|
24
|
-
}), C = h.token === b?.session.token, w = p.parse(h.userAgent || "");
|
|
21
|
+
let { basePaths: g, localization: _, viewPaths: v, navigate: y } = e(), { data: b } = n({ refetchOnMount: !1 }), { mutate: x, isPending: S } = t({ onSuccess: () => o.success(_.settings.revokeSessionSuccess) }), C = h.token === b?.session.token, w = p.parse(h.userAgent || "");
|
|
25
22
|
return /* @__PURE__ */ c("div", {
|
|
26
23
|
className: "flex items-center gap-3",
|
|
27
24
|
children: [
|
|
@@ -11,4 +11,4 @@ export type ActiveSessionsProps = {
|
|
|
11
11
|
*
|
|
12
12
|
* @returns A JSX element containing the sessions card
|
|
13
13
|
*/
|
|
14
|
-
export declare function ActiveSessions({ className, variant, ...props }: ActiveSessionsProps & CardProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function ActiveSessions({ className, variant, ...props }: ActiveSessionsProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { ActiveSession as e } from "./active-session.js";
|
|
2
2
|
import { useAuth as t, useListSessions as n, useSession as r } from "@better-auth-ui/react";
|
|
3
|
-
import { Card as i, Skeleton as a, cn as o
|
|
4
|
-
import { jsx as
|
|
3
|
+
import { Card as i, Skeleton as a, cn as o } from "@heroui/react";
|
|
4
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/settings/security/active-sessions.tsx
|
|
6
|
-
function
|
|
7
|
-
let { localization:
|
|
8
|
-
return /* @__PURE__ */
|
|
6
|
+
function l({ className: a, variant: l, ...d }) {
|
|
7
|
+
let { localization: f } = t(), { data: p } = r(), { data: m, isPending: h } = n(), g = m?.toSorted((e) => e.id === p?.session.id ? -1 : 1);
|
|
8
|
+
return /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("h2", {
|
|
9
9
|
className: o("text-sm font-semibold mb-3"),
|
|
10
|
-
children:
|
|
11
|
-
}), /* @__PURE__ */
|
|
10
|
+
children: f.settings.activeSessions
|
|
11
|
+
}), /* @__PURE__ */ s(i, {
|
|
12
12
|
className: o(a),
|
|
13
|
-
variant:
|
|
14
|
-
...
|
|
15
|
-
children: /* @__PURE__ */
|
|
13
|
+
variant: l,
|
|
14
|
+
...d,
|
|
15
|
+
children: /* @__PURE__ */ s(i.Content, {
|
|
16
16
|
className: "gap-0",
|
|
17
|
-
children:
|
|
17
|
+
children: h ? /* @__PURE__ */ s(u, {}) : g?.map((t, n) => /* @__PURE__ */ c("div", { children: [n > 0 && /* @__PURE__ */ s("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ s(e, { activeSession: t })] }, t.id))
|
|
18
18
|
})
|
|
19
19
|
})] });
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
return /* @__PURE__ */
|
|
21
|
+
function u() {
|
|
22
|
+
return /* @__PURE__ */ s("div", {
|
|
23
23
|
className: "flex items-center justify-between",
|
|
24
|
-
children: /* @__PURE__ */
|
|
24
|
+
children: /* @__PURE__ */ c("div", {
|
|
25
25
|
className: "flex items-center gap-3",
|
|
26
|
-
children: [/* @__PURE__ */
|
|
26
|
+
children: [/* @__PURE__ */ s(a, { className: "size-10 rounded-xl" }), /* @__PURE__ */ c("div", {
|
|
27
27
|
className: "flex flex-col gap-1",
|
|
28
|
-
children: [/* @__PURE__ */
|
|
28
|
+
children: [/* @__PURE__ */ s(a, { className: "h-4 w-32 rounded-lg" }), /* @__PURE__ */ s(a, { className: "h-3 w-24 rounded-lg" })]
|
|
29
29
|
})]
|
|
30
30
|
})
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
//#endregion
|
|
34
|
-
export {
|
|
34
|
+
export { l as ActiveSessions };
|
|
@@ -12,4 +12,4 @@ export type ChangePasswordProps = {
|
|
|
12
12
|
*
|
|
13
13
|
* @returns A JSX element containing the change-password or set-password card
|
|
14
14
|
*/
|
|
15
|
-
export declare function ChangePassword({ className, variant, ...props }: ChangePasswordProps & CardProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function ChangePassword({ className, variant, ...props }: ChangePasswordProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -20,10 +20,7 @@ function C({ className: t, variant: r, ...a }) {
|
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
function w({ className: t, variant: n, ...s }) {
|
|
23
|
-
let { localization: c } = e(), { data: l } = i(), { mutate: u, isPending: d } = r({
|
|
24
|
-
onError: (e) => _.danger(e.error?.message || e.message),
|
|
25
|
-
onSuccess: () => _.success(c.auth.passwordResetEmailSent)
|
|
26
|
-
}), f = () => {
|
|
23
|
+
let { localization: c } = e(), { data: l } = i(), { mutate: u, isPending: d } = r({ onSuccess: () => _.success(c.auth.passwordResetEmailSent) }), f = () => {
|
|
27
24
|
l?.user.email && u({ email: l.user.email });
|
|
28
25
|
};
|
|
29
26
|
return /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("h2", {
|
|
@@ -6,4 +6,4 @@ export type DeleteUserProps = {
|
|
|
6
6
|
/**
|
|
7
7
|
* Danger-zone card to delete the authenticated account, with a confirmation dialog and toasts.
|
|
8
8
|
*/
|
|
9
|
-
export declare function DeleteUser({ className, variant, ...props }: DeleteUserProps & CardProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function DeleteUser({ className, variant, ...props }: DeleteUserProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,17 +8,12 @@ function v({ className: v, variant: y, ...b }) {
|
|
|
8
8
|
let { basePaths: x, deleteUser: S, localization: C, navigate: w, viewPaths: T } = e(), { data: E } = n(), [D, O] = g(!1), [k, A] = g(""), j = E?.some((e) => e.providerId === "credential"), M = !S?.sendDeleteAccountVerification && j, { mutate: N, isPending: P } = t(), F = (e) => {
|
|
9
9
|
O(e), A("");
|
|
10
10
|
}, I = async (e) => {
|
|
11
|
-
e.preventDefault(), N({ ...M ? { password: k } : {} }, {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
onError: (e) => {
|
|
19
|
-
p.danger(e.error?.message || e.message);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
11
|
+
e.preventDefault(), N({ ...M ? { password: k } : {} }, { onSuccess: () => {
|
|
12
|
+
O(!1), A(""), S?.sendDeleteAccountVerification ? p.success(C.settings.deleteUserVerificationSent) : (p.success(C.settings.deleteUserSuccess), w({
|
|
13
|
+
to: `${x.auth}/${T.auth.signIn}`,
|
|
14
|
+
replace: !0
|
|
15
|
+
}));
|
|
16
|
+
} });
|
|
22
17
|
};
|
|
23
18
|
return /* @__PURE__ */ m(a, {
|
|
24
19
|
className: f("border border-danger", v),
|
|
@@ -5,13 +5,7 @@ import { Link as f, LinkSlash as p, PlugConnection as m } from "@gravity-ui/icon
|
|
|
5
5
|
import { getProviderName as h } from "@better-auth-ui/core";
|
|
6
6
|
//#region src/components/settings/security/linked-account.tsx
|
|
7
7
|
function g({ account: g, provider: _ }) {
|
|
8
|
-
let { baseURL: v, localization: y } = n(), { data: b, isPending: x } = t(g?.accountId, {
|
|
9
|
-
enabled: !!g,
|
|
10
|
-
throwOnError: (e) => (e.error && l.danger(e.error.message), !1)
|
|
11
|
-
}), { mutate: S, isPending: C } = r({ onError: (e) => l.danger(e.error?.message || e.message) }), { mutate: w, isPending: T } = i({
|
|
12
|
-
onError: (e) => l.danger(e.error?.message || e.message),
|
|
13
|
-
onSuccess: () => l.success(y.settings.accountUnlinked)
|
|
14
|
-
}), E = e[_], D = h(_), O = b?.data?.login || b?.data?.username || b?.user?.email || b?.user?.name || g?.accountId;
|
|
8
|
+
let { baseURL: v, localization: y } = n(), { data: b, isPending: x } = t({ query: { accountId: g?.accountId } }), { mutate: S, isPending: C } = r(), { mutate: w, isPending: T } = i({ onSuccess: () => l.success(y.settings.accountUnlinked) }), E = e[_], D = h(_), O = b?.data?.login || b?.data?.username || b?.user?.email || b?.user?.name || g?.accountId;
|
|
15
9
|
return /* @__PURE__ */ d("div", {
|
|
16
10
|
className: "flex items-center gap-3",
|
|
17
11
|
children: [
|
|
@@ -12,4 +12,4 @@ export type LinkedAccountsProps = {
|
|
|
12
12
|
*
|
|
13
13
|
* @returns A JSX element containing the linked accounts card
|
|
14
14
|
*/
|
|
15
|
-
export declare function LinkedAccounts({ className, variant, ...props }: LinkedAccountsProps & CardProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function LinkedAccounts({ className, variant, ...props }: LinkedAccountsProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
import { LinkedAccount as e } from "./linked-account.js";
|
|
2
2
|
import { useAuth as t, useListAccounts as n } from "@better-auth-ui/react";
|
|
3
|
-
import { Card as r, Skeleton as i, cn as a
|
|
4
|
-
import { jsx as
|
|
3
|
+
import { Card as r, Skeleton as i, cn as a } from "@heroui/react";
|
|
4
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/settings/security/linked-accounts.tsx
|
|
6
|
-
function
|
|
7
|
-
let { localization:
|
|
6
|
+
function c({ className: i, variant: c, ...u }) {
|
|
7
|
+
let { localization: d, socialProviders: f } = t(), { data: p, isPending: m } = n(), h = [...(p?.filter((e) => e.providerId !== "credential"))?.map((e) => ({
|
|
8
8
|
key: e.id,
|
|
9
9
|
account: e,
|
|
10
10
|
provider: e.providerId
|
|
11
|
-
})) ?? [], ...
|
|
11
|
+
})) ?? [], ...f?.map((e) => ({
|
|
12
12
|
key: e,
|
|
13
13
|
account: void 0,
|
|
14
14
|
provider: e
|
|
15
15
|
})) ?? []];
|
|
16
|
-
return /* @__PURE__ */
|
|
16
|
+
return /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("h2", {
|
|
17
17
|
className: a("text-sm font-semibold mb-3"),
|
|
18
|
-
children:
|
|
19
|
-
}), /* @__PURE__ */
|
|
18
|
+
children: d.settings.linkedAccounts
|
|
19
|
+
}), /* @__PURE__ */ o(r, {
|
|
20
20
|
className: a(i),
|
|
21
|
-
variant:
|
|
22
|
-
...
|
|
23
|
-
children: /* @__PURE__ */
|
|
21
|
+
variant: c,
|
|
22
|
+
...u,
|
|
23
|
+
children: /* @__PURE__ */ o(r.Content, {
|
|
24
24
|
className: "gap-0",
|
|
25
|
-
children:
|
|
25
|
+
children: m ? f?.map((e, t) => /* @__PURE__ */ s("div", { children: [t > 0 && /* @__PURE__ */ o("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ o(l, {})] }, e)) : h.map((t, n) => /* @__PURE__ */ s("div", { children: [n > 0 && /* @__PURE__ */ o("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ o(e, {
|
|
26
26
|
account: t.account,
|
|
27
27
|
provider: t.provider
|
|
28
28
|
})] }, t.key))
|
|
29
29
|
})
|
|
30
30
|
})] });
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return /* @__PURE__ */
|
|
32
|
+
function l() {
|
|
33
|
+
return /* @__PURE__ */ o("div", {
|
|
34
34
|
className: "flex items-center justify-between",
|
|
35
|
-
children: /* @__PURE__ */
|
|
35
|
+
children: /* @__PURE__ */ s("div", {
|
|
36
36
|
className: "flex items-center gap-3",
|
|
37
|
-
children: [/* @__PURE__ */
|
|
37
|
+
children: [/* @__PURE__ */ o(i, { className: "size-10 rounded-xl" }), /* @__PURE__ */ s("div", {
|
|
38
38
|
className: "flex flex-col gap-1",
|
|
39
|
-
children: [/* @__PURE__ */
|
|
39
|
+
children: [/* @__PURE__ */ o(i, { className: "h-4 w-20 rounded-lg" }), /* @__PURE__ */ o(i, { className: "h-3 w-32 rounded-lg" })]
|
|
40
40
|
})]
|
|
41
41
|
})
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
45
|
-
export {
|
|
45
|
+
export { c as LinkedAccounts };
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import { useAuth as e, useDeletePasskey as t } from "@better-auth-ui/react";
|
|
2
|
-
import { Button as n, Spinner as r
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { Fingerprint as
|
|
2
|
+
import { Button as n, Spinner as r } from "@heroui/react";
|
|
3
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
4
|
+
import { Fingerprint as o, Xmark as s } from "@gravity-ui/icons";
|
|
5
5
|
//#region src/components/settings/security/passkey.tsx
|
|
6
|
-
function
|
|
7
|
-
let { localization:
|
|
8
|
-
return /* @__PURE__ */
|
|
6
|
+
function c({ passkey: c }) {
|
|
7
|
+
let { localization: l } = e(), { mutate: u, isPending: d } = t();
|
|
8
|
+
return /* @__PURE__ */ a("div", {
|
|
9
9
|
className: "flex items-center gap-3",
|
|
10
10
|
children: [
|
|
11
|
-
/* @__PURE__ */
|
|
11
|
+
/* @__PURE__ */ i("div", {
|
|
12
12
|
className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
|
|
13
|
-
children: /* @__PURE__ */
|
|
13
|
+
children: /* @__PURE__ */ i(o, { className: "size-4.5" })
|
|
14
14
|
}),
|
|
15
|
-
/* @__PURE__ */
|
|
15
|
+
/* @__PURE__ */ a("div", {
|
|
16
16
|
className: "flex flex-col min-w-0",
|
|
17
|
-
children: [/* @__PURE__ */
|
|
17
|
+
children: [/* @__PURE__ */ i("span", {
|
|
18
18
|
className: "text-sm font-medium leading-tight",
|
|
19
|
-
children:
|
|
20
|
-
}), /* @__PURE__ */
|
|
19
|
+
children: c.name || l.auth.passkey
|
|
20
|
+
}), /* @__PURE__ */ i("span", {
|
|
21
21
|
className: "text-xs text-muted",
|
|
22
|
-
children: new Date(
|
|
22
|
+
children: new Date(c.createdAt).toLocaleString(void 0, {
|
|
23
23
|
dateStyle: "medium",
|
|
24
24
|
timeStyle: "short"
|
|
25
25
|
})
|
|
26
26
|
})]
|
|
27
27
|
}),
|
|
28
|
-
/* @__PURE__ */
|
|
28
|
+
/* @__PURE__ */ a(n, {
|
|
29
29
|
className: "ml-auto shrink-0",
|
|
30
30
|
variant: "outline",
|
|
31
31
|
size: "sm",
|
|
32
|
-
isPending:
|
|
33
|
-
onPress: () =>
|
|
34
|
-
children: [
|
|
32
|
+
isPending: d,
|
|
33
|
+
onPress: () => u({ id: c.id }),
|
|
34
|
+
children: [d ? /* @__PURE__ */ i(r, {
|
|
35
35
|
color: "current",
|
|
36
36
|
size: "sm"
|
|
37
|
-
}) : /* @__PURE__ */
|
|
37
|
+
}) : /* @__PURE__ */ i(s, {}), l.settings.delete]
|
|
38
38
|
})
|
|
39
39
|
]
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
//#endregion
|
|
43
|
-
export {
|
|
43
|
+
export { c as Passkey };
|
|
@@ -3,4 +3,4 @@ export type PasskeysProps = {
|
|
|
3
3
|
className?: string;
|
|
4
4
|
variant?: CardProps["variant"];
|
|
5
5
|
};
|
|
6
|
-
export declare function Passkeys({ className, variant, ...props }: PasskeysProps & CardProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function Passkeys({ className, variant, ...props }: PasskeysProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
import { Passkey as e } from "./passkey.js";
|
|
2
2
|
import { useAddPasskey as t, useAuth as n, useListUserPasskeys as r } from "@better-auth-ui/react";
|
|
3
|
-
import { Button as i, Card as a, Skeleton as o, Spinner as s, cn as c
|
|
4
|
-
import { Fragment as
|
|
3
|
+
import { Button as i, Card as a, Skeleton as o, Spinner as s, cn as c } from "@heroui/react";
|
|
4
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/settings/security/passkeys.tsx
|
|
6
|
-
function
|
|
7
|
-
let { localization:
|
|
8
|
-
return /* @__PURE__ */
|
|
6
|
+
function f({ className: o, variant: f, ...m }) {
|
|
7
|
+
let { localization: h } = n(), { data: g, isPending: _ } = r(), { mutate: v, isPending: y } = t();
|
|
8
|
+
return /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("h2", {
|
|
9
9
|
className: c("text-sm font-semibold mb-3"),
|
|
10
|
-
children:
|
|
11
|
-
}), /* @__PURE__ */
|
|
10
|
+
children: h.settings.passkeys
|
|
11
|
+
}), /* @__PURE__ */ u(a, {
|
|
12
12
|
className: c(o),
|
|
13
|
-
variant:
|
|
14
|
-
...
|
|
15
|
-
children: /* @__PURE__ */
|
|
13
|
+
variant: f,
|
|
14
|
+
...m,
|
|
15
|
+
children: /* @__PURE__ */ d(a.Content, {
|
|
16
16
|
className: "gap-0",
|
|
17
|
-
children: [/* @__PURE__ */
|
|
17
|
+
children: [/* @__PURE__ */ d("div", {
|
|
18
18
|
className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
|
|
19
|
-
children: [/* @__PURE__ */
|
|
19
|
+
children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
|
|
20
20
|
className: "text-sm font-medium leading-tight",
|
|
21
|
-
children:
|
|
22
|
-
}), /* @__PURE__ */
|
|
21
|
+
children: h.settings.passkeysDescription
|
|
22
|
+
}), /* @__PURE__ */ u("p", {
|
|
23
23
|
className: "text-muted text-xs mt-0.5",
|
|
24
|
-
children:
|
|
25
|
-
})] }), /* @__PURE__ */
|
|
24
|
+
children: h.settings.passkeysInstructions
|
|
25
|
+
})] }), /* @__PURE__ */ d(i, {
|
|
26
26
|
className: "shrink-0",
|
|
27
27
|
size: "sm",
|
|
28
|
-
isPending:
|
|
29
|
-
isDisabled:
|
|
30
|
-
onPress: () =>
|
|
31
|
-
children: [
|
|
28
|
+
isPending: y,
|
|
29
|
+
isDisabled: _,
|
|
30
|
+
onPress: () => v(),
|
|
31
|
+
children: [y && /* @__PURE__ */ u(s, {
|
|
32
32
|
color: "current",
|
|
33
33
|
size: "sm"
|
|
34
|
-
}),
|
|
34
|
+
}), h.settings.addPasskey]
|
|
35
35
|
})]
|
|
36
|
-
}),
|
|
36
|
+
}), _ ? /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ u(p, {})] }) : g?.map((t) => /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ u(e, { passkey: t })] }, t.id))]
|
|
37
37
|
})
|
|
38
38
|
})] });
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
return /* @__PURE__ */
|
|
40
|
+
function p() {
|
|
41
|
+
return /* @__PURE__ */ u("div", {
|
|
42
42
|
className: "flex items-center justify-between",
|
|
43
|
-
children: /* @__PURE__ */
|
|
43
|
+
children: /* @__PURE__ */ d("div", {
|
|
44
44
|
className: "flex items-center gap-3",
|
|
45
|
-
children: [/* @__PURE__ */
|
|
45
|
+
children: [/* @__PURE__ */ u(o, { className: "size-10 rounded-xl" }), /* @__PURE__ */ d("div", {
|
|
46
46
|
className: "flex flex-col gap-1",
|
|
47
|
-
children: [/* @__PURE__ */
|
|
47
|
+
children: [/* @__PURE__ */ u(o, { className: "h-4 w-24 rounded-lg" }), /* @__PURE__ */ u(o, { className: "h-3 w-20 rounded-lg" })]
|
|
48
48
|
})]
|
|
49
49
|
})
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
//#endregion
|
|
53
|
-
export {
|
|
53
|
+
export { f as Passkeys };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { UserView as e } from "./user-view.js";
|
|
2
2
|
import { useSetActiveSession as t } from "@better-auth-ui/react";
|
|
3
|
-
import { Dropdown as n, Spinner as r
|
|
4
|
-
import { jsx as
|
|
3
|
+
import { Dropdown as n, Spinner as r } from "@heroui/react";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/user/switch-account-item.tsx
|
|
6
|
-
function
|
|
7
|
-
let { mutate:
|
|
8
|
-
return /* @__PURE__ */
|
|
6
|
+
function o({ deviceSession: o }) {
|
|
7
|
+
let { mutate: s, isPending: c } = t();
|
|
8
|
+
return /* @__PURE__ */ a(n.Item, {
|
|
9
9
|
className: "px-2",
|
|
10
|
-
isDisabled:
|
|
11
|
-
onPress: () =>
|
|
12
|
-
children: [/* @__PURE__ */
|
|
10
|
+
isDisabled: c,
|
|
11
|
+
onPress: () => s({ sessionToken: o.session.token }),
|
|
12
|
+
children: [/* @__PURE__ */ i(e, { user: o.user }), c && /* @__PURE__ */ i(r, {
|
|
13
13
|
color: "current",
|
|
14
14
|
size: "sm",
|
|
15
15
|
className: "ml-auto"
|
|
@@ -17,4 +17,4 @@ function s({ deviceSession: s }) {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
//#endregion
|
|
20
|
-
export {
|
|
20
|
+
export { o as SwitchAccountItem };
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { UserView as e } from "./user-view.js";
|
|
2
2
|
import { SwitchAccountItem as t } from "./switch-account-item.js";
|
|
3
3
|
import { useAuth as n, useListDeviceSessions as r, useSession as i } from "@better-auth-ui/react";
|
|
4
|
-
import { Dropdown as a, Label as o, Separator as s
|
|
5
|
-
import { jsx as
|
|
6
|
-
import { Check as
|
|
4
|
+
import { Dropdown as a, Label as o, Separator as s } from "@heroui/react";
|
|
5
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
|
+
import { Check as u, CirclePlus as d } from "@gravity-ui/icons";
|
|
7
7
|
//#region src/components/user/switch-account-menu.tsx
|
|
8
|
-
function
|
|
9
|
-
let { basePaths:
|
|
10
|
-
return /* @__PURE__ */
|
|
8
|
+
function f() {
|
|
9
|
+
let { basePaths: f, viewPaths: p, localization: m } = n(), { data: h } = i(), { data: g, isPending: _ } = r();
|
|
10
|
+
return /* @__PURE__ */ c(a.Popover, {
|
|
11
11
|
className: "min-w-40 md:min-w-56 max-w-[48svw]",
|
|
12
|
-
children: /* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
12
|
+
children: /* @__PURE__ */ l(a.Menu, { children: [
|
|
13
|
+
/* @__PURE__ */ l(a.Item, {
|
|
14
14
|
className: "px-2",
|
|
15
|
-
children: [/* @__PURE__ */
|
|
15
|
+
children: [/* @__PURE__ */ c(e, { isPending: _ }), !_ && /* @__PURE__ */ c(u, { className: "ml-auto" })]
|
|
16
16
|
}),
|
|
17
|
-
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
textValue:
|
|
21
|
-
href: `${
|
|
22
|
-
children: [/* @__PURE__ */
|
|
17
|
+
g?.filter((e) => e.session.id !== h?.session?.id).map((e) => /* @__PURE__ */ c(t, { deviceSession: e }, e.session.id)),
|
|
18
|
+
/* @__PURE__ */ c(s, {}),
|
|
19
|
+
/* @__PURE__ */ l(a.Item, {
|
|
20
|
+
textValue: m.auth.addAccount,
|
|
21
|
+
href: `${f.auth}/${p.auth.signIn}`,
|
|
22
|
+
children: [/* @__PURE__ */ c(d, { className: "text-muted" }), /* @__PURE__ */ c(o, { children: m.auth.addAccount })]
|
|
23
23
|
})
|
|
24
24
|
] })
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
//#endregion
|
|
28
|
-
export {
|
|
28
|
+
export { f as SwitchAccountMenu };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './components/auth/forgot-password';
|
|
|
4
4
|
export * from './components/auth/magic-link';
|
|
5
5
|
export * from './components/auth/magic-link-button';
|
|
6
6
|
export * from './components/auth/passkey-button';
|
|
7
|
+
export * from './components/auth/provider-button';
|
|
7
8
|
export * from './components/auth/provider-buttons';
|
|
8
9
|
export * from './components/auth/reset-password';
|
|
9
10
|
export * from './components/auth/sign-in';
|