@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.
Files changed (74) hide show
  1. package/dist/components/auth/auth-provider.js +12 -11
  2. package/dist/components/auth/auth.d.ts +1 -1
  3. package/dist/components/auth/error-toaster.d.ts +1 -0
  4. package/dist/components/auth/error-toaster.js +17 -0
  5. package/dist/components/auth/forgot-password.d.ts +1 -1
  6. package/dist/components/auth/forgot-password.js +3 -6
  7. package/dist/components/auth/magic-link.d.ts +1 -1
  8. package/dist/components/auth/magic-link.js +52 -64
  9. package/dist/components/auth/passkey-button.js +12 -15
  10. package/dist/components/auth/provider-button.d.ts +15 -0
  11. package/dist/components/auth/provider-button.js +29 -0
  12. package/dist/components/auth/provider-buttons.d.ts +4 -10
  13. package/dist/components/auth/provider-buttons.js +16 -23
  14. package/dist/components/auth/reset-password.d.ts +1 -1
  15. package/dist/components/auth/reset-password.js +3 -6
  16. package/dist/components/auth/sign-in.d.ts +1 -1
  17. package/dist/components/auth/sign-in.js +81 -93
  18. package/dist/components/auth/sign-up.d.ts +1 -1
  19. package/dist/components/auth/sign-up.js +99 -108
  20. package/dist/components/settings/account/appearance.d.ts +1 -1
  21. package/dist/components/settings/account/change-avatar.js +1 -1
  22. package/dist/components/settings/account/change-email.d.ts +1 -1
  23. package/dist/components/settings/account/change-email.js +1 -4
  24. package/dist/components/settings/account/manage-account.js +1 -4
  25. package/dist/components/settings/account/manage-accounts.d.ts +1 -1
  26. package/dist/components/settings/account/manage-accounts.js +16 -16
  27. package/dist/components/settings/account/user-profile.d.ts +1 -1
  28. package/dist/components/settings/account/user-profile.js +1 -4
  29. package/dist/components/settings/security/active-session.js +1 -4
  30. package/dist/components/settings/security/active-sessions.d.ts +1 -1
  31. package/dist/components/settings/security/active-sessions.js +17 -17
  32. package/dist/components/settings/security/change-password.d.ts +1 -1
  33. package/dist/components/settings/security/change-password.js +1 -4
  34. package/dist/components/settings/security/delete-user.d.ts +1 -1
  35. package/dist/components/settings/security/delete-user.js +6 -11
  36. package/dist/components/settings/security/linked-account.js +1 -7
  37. package/dist/components/settings/security/linked-accounts.d.ts +1 -1
  38. package/dist/components/settings/security/linked-accounts.js +18 -18
  39. package/dist/components/settings/security/passkey.js +19 -19
  40. package/dist/components/settings/security/passkeys.d.ts +1 -1
  41. package/dist/components/settings/security/passkeys.js +28 -28
  42. package/dist/components/user/switch-account-item.js +9 -9
  43. package/dist/components/user/switch-account-menu.js +16 -16
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.js +34 -33
  46. package/package.json +6 -4
  47. package/src/components/auth/auth-provider.tsx +4 -0
  48. package/src/components/auth/auth.tsx +1 -1
  49. package/src/components/auth/error-toaster.tsx +25 -0
  50. package/src/components/auth/forgot-password.tsx +1 -2
  51. package/src/components/auth/magic-link.tsx +3 -23
  52. package/src/components/auth/passkey-button.tsx +1 -2
  53. package/src/components/auth/provider-button.tsx +67 -0
  54. package/src/components/auth/provider-buttons.tsx +26 -43
  55. package/src/components/auth/reset-password.tsx +1 -2
  56. package/src/components/auth/sign-in.tsx +2 -20
  57. package/src/components/auth/sign-up.tsx +5 -20
  58. package/src/components/settings/account/appearance.tsx +1 -1
  59. package/src/components/settings/account/change-avatar.tsx +1 -3
  60. package/src/components/settings/account/change-email.tsx +2 -3
  61. package/src/components/settings/account/manage-account.tsx +1 -4
  62. package/src/components/settings/account/manage-accounts.tsx +3 -8
  63. package/src/components/settings/account/user-profile.tsx +1 -2
  64. package/src/components/settings/security/active-session.tsx +0 -1
  65. package/src/components/settings/security/active-sessions.tsx +3 -8
  66. package/src/components/settings/security/change-password.tsx +7 -4
  67. package/src/components/settings/security/delete-user.tsx +1 -4
  68. package/src/components/settings/security/linked-account.tsx +4 -14
  69. package/src/components/settings/security/linked-accounts.tsx +3 -8
  70. package/src/components/settings/security/passkey.tsx +2 -4
  71. package/src/components/settings/security/passkeys.tsx +4 -12
  72. package/src/components/user/switch-account-item.tsx +2 -4
  73. package/src/components/user/switch-account-menu.tsx +2 -7
  74. 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({ onError: (e) => c.danger(e.error?.message || e.message) }), { mutate: b, isPending: x } = n({
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, toast as o } from "@heroui/react";
4
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
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 l({ className: l, variant: u, ...d }) {
7
- let { localization: f } = t(), { data: p } = r(), { data: m, isPending: h } = n({ throwOnError: (e) => (e.error && o.danger(e.error.message), !1) }), g = m?.filter((e) => e.session.id !== p?.session.id), _ = [{
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: h ? null : p,
10
- isPending: h
11
- }, ...g?.map((e) => ({
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__ */ c("div", { children: [/* @__PURE__ */ s("h2", {
16
+ return /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("h2", {
17
17
  className: a("text-sm font-semibold mb-3"),
18
- children: f.settings.manageAccounts
19
- }), /* @__PURE__ */ s(i, {
20
- className: a(l),
21
- variant: u,
22
- ...d,
23
- children: /* @__PURE__ */ s(i.Content, {
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: _.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, {
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 { l as ManageAccounts };
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, toast as s } from "@heroui/react";
4
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
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 u({ className: a, variant: u, ...f }) {
7
- let { localization: p } = t(), { data: m } = r(), { data: h, isPending: g } = n({ throwOnError: (e) => (e.error && s.danger(e.error.message), !1) }), _ = h?.toSorted((e) => e.id === m?.session.id ? -1 : 1);
8
- return /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("h2", {
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: p.settings.activeSessions
11
- }), /* @__PURE__ */ c(i, {
10
+ children: f.settings.activeSessions
11
+ }), /* @__PURE__ */ s(i, {
12
12
  className: o(a),
13
- variant: u,
14
- ...f,
15
- children: /* @__PURE__ */ c(i.Content, {
13
+ variant: l,
14
+ ...d,
15
+ children: /* @__PURE__ */ s(i.Content, {
16
16
  className: "gap-0",
17
- children: g ? /* @__PURE__ */ c(d, {}) : _?.map((t, n) => /* @__PURE__ */ l("div", { children: [n > 0 && /* @__PURE__ */ c("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ c(e, { activeSession: t })] }, t.id))
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 d() {
22
- return /* @__PURE__ */ c("div", {
21
+ function u() {
22
+ return /* @__PURE__ */ s("div", {
23
23
  className: "flex items-center justify-between",
24
- children: /* @__PURE__ */ l("div", {
24
+ children: /* @__PURE__ */ c("div", {
25
25
  className: "flex items-center gap-3",
26
- children: [/* @__PURE__ */ c(a, { className: "size-10 rounded-xl" }), /* @__PURE__ */ l("div", {
26
+ children: [/* @__PURE__ */ s(a, { className: "size-10 rounded-xl" }), /* @__PURE__ */ c("div", {
27
27
  className: "flex flex-col gap-1",
28
- children: [/* @__PURE__ */ c(a, { className: "h-4 w-32 rounded-lg" }), /* @__PURE__ */ c(a, { className: "h-3 w-24 rounded-lg" })]
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 { u as ActiveSessions };
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
- onSuccess: () => {
13
- O(!1), A(""), S?.sendDeleteAccountVerification ? p.success(C.settings.deleteUserVerificationSent) : (p.success(C.settings.deleteUserSuccess), w({
14
- to: `${x.auth}/${T.auth.signIn}`,
15
- replace: !0
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, toast as o } from "@heroui/react";
4
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
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 l({ className: i, variant: l, ...d }) {
7
- let { localization: f, socialProviders: p } = t(), { data: m, isPending: h } = n({ throwOnError: (e) => (e.error && o.danger(e.error.message), !1) }), g = [...(m?.filter((e) => e.providerId !== "credential"))?.map((e) => ({
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
- })) ?? [], ...p?.map((e) => ({
11
+ })) ?? [], ...f?.map((e) => ({
12
12
  key: e,
13
13
  account: void 0,
14
14
  provider: e
15
15
  })) ?? []];
16
- return /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("h2", {
16
+ return /* @__PURE__ */ s("div", { children: [/* @__PURE__ */ o("h2", {
17
17
  className: a("text-sm font-semibold mb-3"),
18
- children: f.settings.linkedAccounts
19
- }), /* @__PURE__ */ s(r, {
18
+ children: d.settings.linkedAccounts
19
+ }), /* @__PURE__ */ o(r, {
20
20
  className: a(i),
21
- variant: l,
22
- ...d,
23
- children: /* @__PURE__ */ s(r.Content, {
21
+ variant: c,
22
+ ...u,
23
+ children: /* @__PURE__ */ o(r.Content, {
24
24
  className: "gap-0",
25
- children: h ? p?.map((e, t) => /* @__PURE__ */ c("div", { children: [t > 0 && /* @__PURE__ */ s("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ s(u, {})] }, e)) : 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, {
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 u() {
33
- return /* @__PURE__ */ s("div", {
32
+ function l() {
33
+ return /* @__PURE__ */ o("div", {
34
34
  className: "flex items-center justify-between",
35
- children: /* @__PURE__ */ c("div", {
35
+ children: /* @__PURE__ */ s("div", {
36
36
  className: "flex items-center gap-3",
37
- children: [/* @__PURE__ */ s(i, { className: "size-10 rounded-xl" }), /* @__PURE__ */ c("div", {
37
+ children: [/* @__PURE__ */ o(i, { className: "size-10 rounded-xl" }), /* @__PURE__ */ s("div", {
38
38
  className: "flex flex-col gap-1",
39
- children: [/* @__PURE__ */ s(i, { className: "h-4 w-20 rounded-lg" }), /* @__PURE__ */ s(i, { className: "h-3 w-32 rounded-lg" })]
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 { l as LinkedAccounts };
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, toast as i } from "@heroui/react";
3
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
4
- import { Fingerprint as s, Xmark as c } from "@gravity-ui/icons";
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 l({ passkey: l }) {
7
- let { localization: u } = e(), { mutate: d, isPending: f } = t({ onError: (e) => i.danger(e.error?.message || e.message) });
8
- return /* @__PURE__ */ o("div", {
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__ */ a("div", {
11
+ /* @__PURE__ */ i("div", {
12
12
  className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
13
- children: /* @__PURE__ */ a(s, { className: "size-4.5" })
13
+ children: /* @__PURE__ */ i(o, { className: "size-4.5" })
14
14
  }),
15
- /* @__PURE__ */ o("div", {
15
+ /* @__PURE__ */ a("div", {
16
16
  className: "flex flex-col min-w-0",
17
- children: [/* @__PURE__ */ a("span", {
17
+ children: [/* @__PURE__ */ i("span", {
18
18
  className: "text-sm font-medium leading-tight",
19
- children: l.name || u.auth.passkey
20
- }), /* @__PURE__ */ a("span", {
19
+ children: c.name || l.auth.passkey
20
+ }), /* @__PURE__ */ i("span", {
21
21
  className: "text-xs text-muted",
22
- children: new Date(l.createdAt).toLocaleString(void 0, {
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__ */ o(n, {
28
+ /* @__PURE__ */ a(n, {
29
29
  className: "ml-auto shrink-0",
30
30
  variant: "outline",
31
31
  size: "sm",
32
- isPending: f,
33
- onPress: () => d({ id: l.id }),
34
- children: [f ? /* @__PURE__ */ a(r, {
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__ */ a(c, {}), u.settings.delete]
37
+ }) : /* @__PURE__ */ i(s, {}), l.settings.delete]
38
38
  })
39
39
  ]
40
40
  });
41
41
  }
42
42
  //#endregion
43
- export { l as Passkey };
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, toast as l } from "@heroui/react";
4
- import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
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 p({ className: o, variant: p, ...h }) {
7
- let { localization: g } = n(), { data: _, isPending: v } = r({ throwOnError: (e) => (e.error && l.danger(e.error.message), !1) }), { mutate: y, isPending: b } = t({ onError: (e) => l.danger(e.error?.message || e.message) });
8
- return /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("h2", {
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: g.settings.passkeys
11
- }), /* @__PURE__ */ d(a, {
10
+ children: h.settings.passkeys
11
+ }), /* @__PURE__ */ u(a, {
12
12
  className: c(o),
13
- variant: p,
14
- ...h,
15
- children: /* @__PURE__ */ f(a.Content, {
13
+ variant: f,
14
+ ...m,
15
+ children: /* @__PURE__ */ d(a.Content, {
16
16
  className: "gap-0",
17
- children: [/* @__PURE__ */ f("div", {
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__ */ f("div", { children: [/* @__PURE__ */ d("p", {
19
+ children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
20
20
  className: "text-sm font-medium leading-tight",
21
- children: g.settings.passkeysDescription
22
- }), /* @__PURE__ */ d("p", {
21
+ children: h.settings.passkeysDescription
22
+ }), /* @__PURE__ */ u("p", {
23
23
  className: "text-muted text-xs mt-0.5",
24
- children: g.settings.passkeysInstructions
25
- })] }), /* @__PURE__ */ f(i, {
24
+ children: h.settings.passkeysInstructions
25
+ })] }), /* @__PURE__ */ d(i, {
26
26
  className: "shrink-0",
27
27
  size: "sm",
28
- isPending: b,
29
- isDisabled: v,
30
- onPress: () => y(),
31
- children: [b && /* @__PURE__ */ d(s, {
28
+ isPending: y,
29
+ isDisabled: _,
30
+ onPress: () => v(),
31
+ children: [y && /* @__PURE__ */ u(s, {
32
32
  color: "current",
33
33
  size: "sm"
34
- }), g.settings.addPasskey]
34
+ }), h.settings.addPasskey]
35
35
  })]
36
- }), v ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ d(m, {})] }) : _?.map((t) => /* @__PURE__ */ f("div", { children: [/* @__PURE__ */ d("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ d(e, { passkey: t })] }, t.id))]
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 m() {
41
- return /* @__PURE__ */ d("div", {
40
+ function p() {
41
+ return /* @__PURE__ */ u("div", {
42
42
  className: "flex items-center justify-between",
43
- children: /* @__PURE__ */ f("div", {
43
+ children: /* @__PURE__ */ d("div", {
44
44
  className: "flex items-center gap-3",
45
- children: [/* @__PURE__ */ d(o, { className: "size-10 rounded-xl" }), /* @__PURE__ */ f("div", {
45
+ children: [/* @__PURE__ */ u(o, { className: "size-10 rounded-xl" }), /* @__PURE__ */ d("div", {
46
46
  className: "flex flex-col gap-1",
47
- children: [/* @__PURE__ */ d(o, { className: "h-4 w-24 rounded-lg" }), /* @__PURE__ */ d(o, { className: "h-3 w-20 rounded-lg" })]
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 { p as Passkeys };
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, toast as i } from "@heroui/react";
4
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
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 s({ deviceSession: s }) {
7
- let { mutate: c, isPending: l } = t({ onError: (e) => i.danger(e.error?.message || e.message) });
8
- return /* @__PURE__ */ o(n.Item, {
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: l,
11
- onPress: () => c({ sessionToken: s.session.token }),
12
- children: [/* @__PURE__ */ a(e, { user: s.user }), l && /* @__PURE__ */ a(r, {
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 { s as SwitchAccountItem };
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, toast as c } from "@heroui/react";
5
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
6
- import { Check as d, CirclePlus as f } from "@gravity-ui/icons";
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 p() {
9
- let { basePaths: p, viewPaths: m, localization: h } = n(), { data: g } = i(), { data: _, isPending: v } = r({ throwOnError: (e) => (e.error && c.danger(e.error.message), !1) });
10
- return /* @__PURE__ */ l(a.Popover, {
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__ */ u(a.Menu, { children: [
13
- /* @__PURE__ */ u(a.Item, {
12
+ children: /* @__PURE__ */ l(a.Menu, { children: [
13
+ /* @__PURE__ */ l(a.Item, {
14
14
  className: "px-2",
15
- children: [/* @__PURE__ */ l(e, { isPending: v }), !v && /* @__PURE__ */ l(d, { className: "ml-auto" })]
15
+ children: [/* @__PURE__ */ c(e, { isPending: _ }), !_ && /* @__PURE__ */ c(u, { className: "ml-auto" })]
16
16
  }),
17
- _?.filter((e) => e.session.id !== g?.session?.id).map((e) => /* @__PURE__ */ l(t, { deviceSession: e }, e.session.id)),
18
- /* @__PURE__ */ l(s, {}),
19
- /* @__PURE__ */ u(a.Item, {
20
- textValue: h.auth.addAccount,
21
- href: `${p.auth}/${m.auth.signIn}`,
22
- children: [/* @__PURE__ */ l(f, { className: "text-muted" }), /* @__PURE__ */ l(o, { children: h.auth.addAccount })]
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 { p as SwitchAccountMenu };
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';