@better-auth-ui/heroui 1.6.3 → 1.6.5
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/additional-field.d.ts +4 -0
- package/dist/components/auth/additional-field.js +270 -0
- package/dist/components/auth/auth-provider.d.ts +4 -6
- package/dist/components/auth/auth.d.ts +1 -1
- package/dist/components/auth/auth.js +54 -28
- package/dist/components/{settings/security → auth/delete-user}/danger-zone.d.ts +1 -1
- package/dist/components/{settings/security → auth/delete-user}/danger-zone.js +1 -1
- package/dist/components/auth/delete-user/delete-user.js +95 -0
- package/dist/components/{email → auth/email}/email-changed-email.d.ts +2 -2
- package/dist/components/{email → auth/email}/email-changed-email.js +7 -7
- package/dist/components/{email → auth/email}/email-verification-email.d.ts +2 -2
- package/dist/components/{email → auth/email}/email-verification-email.js +7 -7
- package/dist/components/auth/email/magic-link-email.d.ts +3 -0
- package/dist/components/{email → auth/email}/magic-link-email.js +7 -7
- package/dist/components/auth/email/new-device-email.d.ts +3 -0
- package/dist/components/{email → auth/email}/new-device-email.js +7 -7
- package/dist/components/auth/email/otp-email.d.ts +3 -0
- package/dist/components/{email → auth/email}/otp-email.js +6 -6
- package/dist/components/{email → auth/email}/password-changed-email.d.ts +2 -2
- package/dist/components/{email → auth/email}/password-changed-email.js +7 -7
- package/dist/components/{email → auth/email}/reset-password-email.d.ts +2 -2
- package/dist/components/{email → auth/email}/reset-password-email.js +7 -7
- package/dist/components/auth/forgot-password.d.ts +1 -1
- package/dist/components/auth/forgot-password.js +70 -48
- package/dist/components/auth/magic-link/magic-link-button.d.ts +11 -0
- package/dist/components/auth/magic-link/magic-link-button.js +20 -0
- package/dist/components/auth/magic-link/magic-link.d.ts +16 -0
- package/dist/components/auth/magic-link/magic-link.js +87 -0
- package/dist/components/{settings/account → auth/multi-session}/manage-account.d.ts +2 -6
- package/dist/components/auth/multi-session/manage-account.js +49 -0
- package/dist/components/auth/multi-session/manage-accounts.js +34 -0
- package/dist/components/{user/switch-account-menu.d.ts → auth/multi-session/switch-account-submenu-content.d.ts} +3 -3
- package/dist/components/auth/multi-session/switch-account-submenu-content.js +29 -0
- package/dist/components/{user/switch-account-item.d.ts → auth/multi-session/switch-account-submenu-item.d.ts} +2 -2
- package/dist/components/auth/multi-session/switch-account-submenu-item.js +20 -0
- package/dist/components/auth/multi-session/switch-account-submenu.d.ts +13 -0
- package/dist/components/auth/multi-session/switch-account-submenu.js +24 -0
- package/dist/components/auth/passkey/passkey-button.d.ts +6 -0
- package/dist/components/auth/passkey/passkey-button.js +24 -0
- package/dist/components/auth/passkey/passkey.js +45 -0
- package/dist/components/auth/passkey/passkeys.js +106 -0
- package/dist/components/auth/provider-button.d.ts +6 -8
- package/dist/components/auth/provider-button.js +16 -20
- package/dist/components/auth/provider-buttons.d.ts +3 -4
- package/dist/components/auth/provider-buttons.js +9 -10
- package/dist/components/auth/reset-password.js +110 -107
- package/dist/components/{settings → auth/settings}/account/account-settings.d.ts +5 -2
- package/dist/components/auth/settings/account/account-settings.js +20 -0
- package/dist/components/auth/settings/account/change-avatar.js +89 -0
- package/dist/components/{settings → auth/settings}/account/change-email.js +17 -17
- package/dist/components/{settings → auth/settings}/account/user-profile.d.ts +2 -3
- package/dist/components/auth/settings/account/user-profile.js +86 -0
- package/dist/components/auth/settings/security/active-session.js +59 -0
- package/dist/components/{settings → auth/settings}/security/active-sessions.js +4 -4
- package/dist/components/auth/settings/security/change-password.js +189 -0
- package/dist/components/auth/settings/security/linked-account.js +56 -0
- package/dist/components/{settings → auth/settings}/security/linked-accounts.js +5 -5
- package/dist/components/{settings → auth/settings}/security/security-settings.d.ts +1 -1
- package/dist/components/auth/settings/security/security-settings.js +22 -0
- package/dist/components/auth/settings/settings.js +45 -0
- package/dist/components/auth/sign-in.js +66 -85
- package/dist/components/auth/sign-out.js +11 -11
- package/dist/components/auth/sign-up.js +128 -148
- package/dist/components/{settings/account → auth/theme}/appearance.d.ts +3 -6
- package/dist/components/auth/theme/appearance.js +72 -0
- package/dist/components/auth/theme/theme-toggle-item.d.ts +5 -0
- package/dist/components/auth/theme/theme-toggle-item.js +58 -0
- package/dist/components/auth/user/user-avatar.js +29 -0
- package/dist/components/{user → auth/user}/user-button.d.ts +2 -6
- package/dist/components/auth/user/user-button.js +55 -0
- package/dist/components/auth/user/user-view.js +37 -0
- package/dist/components/auth/username/sign-in-username.d.ts +14 -0
- package/dist/components/auth/username/sign-in-username.js +148 -0
- package/dist/components/auth/username/username-field.d.ts +8 -0
- package/dist/components/auth/username/username-field.js +53 -0
- package/dist/email.d.ts +7 -0
- package/dist/email.js +9 -0
- package/dist/index.d.ts +12 -27
- package/dist/index.js +20 -35
- package/dist/lib/auth/auth-plugin.d.ts +44 -0
- package/dist/lib/auth/delete-user-plugin.d.ts +17 -0
- package/dist/lib/auth/delete-user-plugin.js +10 -0
- package/dist/lib/auth/magic-link-plugin.d.ts +31 -0
- package/dist/lib/auth/magic-link-plugin.js +13 -0
- package/dist/lib/auth/multi-session-plugin.d.ts +18 -0
- package/dist/lib/auth/multi-session-plugin.js +12 -0
- package/dist/lib/auth/passkey-plugin.d.ts +20 -0
- package/dist/lib/auth/passkey-plugin.js +12 -0
- package/dist/lib/auth/theme-plugin.d.ts +68 -0
- package/dist/lib/auth/theme-plugin.js +23 -0
- package/dist/lib/auth/username-plugin.d.ts +63 -0
- package/dist/lib/auth/username-plugin.js +18 -0
- package/dist/plugins.d.ts +20 -0
- package/dist/plugins.js +21 -0
- package/package.json +19 -21
- package/src/components/auth/additional-field.tsx +554 -0
- package/src/components/auth/auth-provider.tsx +5 -6
- package/src/components/auth/auth.tsx +99 -35
- package/src/components/{settings/security → auth/delete-user}/danger-zone.tsx +1 -1
- package/src/components/{settings/security → auth/delete-user}/delete-user.tsx +30 -20
- package/src/components/{email → auth/email}/email-changed-email.tsx +2 -2
- package/src/components/{email → auth/email}/email-verification-email.tsx +2 -2
- package/src/components/{email → auth/email}/magic-link-email.tsx +2 -2
- package/src/components/{email → auth/email}/new-device-email.tsx +2 -2
- package/src/components/{email → auth/email}/otp-email.tsx +2 -2
- package/src/components/{email → auth/email}/password-changed-email.tsx +2 -2
- package/src/components/{email → auth/email}/reset-password-email.tsx +2 -2
- package/src/components/auth/forgot-password.tsx +42 -17
- package/src/components/auth/magic-link/magic-link-button.tsx +61 -0
- package/src/components/auth/{magic-link.tsx → magic-link/magic-link.tsx} +55 -40
- package/src/components/{settings/account → auth/multi-session}/manage-account.tsx +16 -13
- package/src/components/{settings/account → auth/multi-session}/manage-accounts.tsx +14 -5
- package/src/components/{user/switch-account-menu.tsx → auth/multi-session/switch-account-submenu-content.tsx} +18 -11
- package/src/components/{user/switch-account-item.tsx → auth/multi-session/switch-account-submenu-item.tsx} +17 -5
- package/src/components/auth/multi-session/switch-account-submenu.tsx +50 -0
- package/src/components/auth/passkey/passkey-button.tsx +56 -0
- package/src/components/{settings/security → auth/passkey}/passkey.tsx +20 -6
- package/src/components/auth/passkey/passkeys.tsx +196 -0
- package/src/components/auth/provider-button.tsx +27 -29
- package/src/components/auth/provider-buttons.tsx +6 -11
- package/src/components/auth/reset-password.tsx +13 -7
- package/src/components/{settings → auth/settings}/account/account-settings.tsx +15 -13
- package/src/components/{settings → auth/settings}/account/change-avatar.tsx +4 -3
- package/src/components/{settings → auth/settings}/account/change-email.tsx +3 -3
- package/src/components/auth/settings/account/user-profile.tsx +171 -0
- package/src/components/{settings → auth/settings}/security/active-session.tsx +8 -5
- package/src/components/{settings → auth/settings}/security/active-sessions.tsx +3 -3
- package/src/components/{settings → auth/settings}/security/change-password.tsx +14 -9
- package/src/components/{settings → auth/settings}/security/linked-account.tsx +12 -8
- package/src/components/{settings → auth/settings}/security/linked-accounts.tsx +2 -2
- package/src/components/{settings → auth/settings}/security/security-settings.tsx +7 -6
- package/src/components/{settings → auth/settings}/settings.tsx +2 -2
- package/src/components/auth/sign-in.tsx +50 -61
- package/src/components/auth/sign-out.tsx +2 -2
- package/src/components/auth/sign-up.tsx +119 -131
- package/src/components/{settings/account → auth/theme}/appearance.tsx +17 -24
- package/src/components/auth/theme/theme-toggle-item.tsx +110 -0
- package/src/components/{user → auth/user}/user-avatar.tsx +12 -4
- package/src/components/{user → auth/user}/user-button.tsx +15 -88
- package/src/components/{user → auth/user}/user-view.tsx +12 -4
- package/src/components/auth/username/sign-in-username.tsx +299 -0
- package/src/components/auth/username/username-field.tsx +124 -0
- package/src/email.ts +9 -0
- package/src/index.tsx +12 -27
- package/src/lib/auth/auth-plugin.ts +67 -0
- package/src/lib/auth/delete-user-plugin.ts +15 -0
- package/src/lib/auth/magic-link-plugin.ts +26 -0
- package/src/lib/auth/multi-session-plugin.ts +17 -0
- package/src/lib/auth/passkey-plugin.ts +17 -0
- package/src/lib/auth/theme-plugin.ts +86 -0
- package/src/lib/auth/username-plugin.tsx +30 -0
- package/src/plugins.ts +23 -0
- package/dist/components/auth/magic-link-button.d.ts +0 -13
- package/dist/components/auth/magic-link-button.js +0 -16
- package/dist/components/auth/magic-link.d.ts +0 -17
- package/dist/components/auth/magic-link.js +0 -99
- package/dist/components/auth/passkey-button.d.ts +0 -4
- package/dist/components/auth/passkey-button.js +0 -21
- package/dist/components/email/magic-link-email.d.ts +0 -3
- package/dist/components/email/new-device-email.d.ts +0 -3
- package/dist/components/email/otp-email.d.ts +0 -3
- package/dist/components/settings/account/account-settings.js +0 -23
- package/dist/components/settings/account/appearance.js +0 -71
- package/dist/components/settings/account/change-avatar.js +0 -89
- package/dist/components/settings/account/manage-account.js +0 -48
- package/dist/components/settings/account/manage-accounts.js +0 -33
- package/dist/components/settings/account/user-profile.js +0 -103
- package/dist/components/settings/security/active-session.js +0 -59
- package/dist/components/settings/security/change-password.js +0 -189
- package/dist/components/settings/security/delete-user.js +0 -92
- package/dist/components/settings/security/linked-account.js +0 -56
- package/dist/components/settings/security/passkey.js +0 -43
- package/dist/components/settings/security/passkeys.js +0 -53
- package/dist/components/settings/security/security-settings.js +0 -25
- package/dist/components/settings/settings.js +0 -45
- package/dist/components/user/switch-account-item.js +0 -20
- package/dist/components/user/switch-account-menu.js +0 -28
- package/dist/components/user/user-avatar.js +0 -29
- package/dist/components/user/user-button.js +0 -91
- package/dist/components/user/user-view.js +0 -37
- package/dist/core.d.ts +0 -1
- package/dist/core.js +0 -1
- package/dist/react-exports.d.ts +0 -1
- package/dist/react-exports.js +0 -1
- package/src/components/auth/magic-link-button.tsx +0 -43
- package/src/components/auth/passkey-button.tsx +0 -35
- package/src/components/settings/account/user-profile.tsx +0 -217
- package/src/components/settings/security/passkeys.tsx +0 -96
- package/src/core.ts +0 -1
- package/src/react-exports.ts +0 -1
- /package/dist/components/{settings/security → auth/delete-user}/delete-user.d.ts +0 -0
- /package/dist/components/{settings/account → auth/multi-session}/manage-accounts.d.ts +0 -0
- /package/dist/components/{settings/security → auth/passkey}/passkey.d.ts +0 -0
- /package/dist/components/{settings/security → auth/passkey}/passkeys.d.ts +0 -0
- /package/dist/components/{settings → auth/settings}/account/change-avatar.d.ts +0 -0
- /package/dist/components/{settings → auth/settings}/account/change-email.d.ts +0 -0
- /package/dist/components/{settings → auth/settings}/security/active-session.d.ts +0 -0
- /package/dist/components/{settings → auth/settings}/security/active-sessions.d.ts +0 -0
- /package/dist/components/{settings → auth/settings}/security/change-password.d.ts +0 -0
- /package/dist/components/{settings → auth/settings}/security/linked-account.d.ts +0 -0
- /package/dist/components/{settings → auth/settings}/security/linked-accounts.d.ts +0 -0
- /package/dist/components/{settings → auth/settings}/settings.d.ts +0 -0
- /package/dist/components/{user → auth/user}/user-avatar.d.ts +0 -0
- /package/dist/components/{user → auth/user}/user-view.d.ts +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
//#region src/components/email/otp-email.tsx
|
|
1
|
+
import { cn as e } from "@heroui/react";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { OtpEmail as n } from "@better-auth-ui/react/email";
|
|
4
|
+
//#region src/components/auth/email/otp-email.tsx
|
|
5
5
|
function r({ colors: r, classNames: i, ...a }) {
|
|
6
|
-
return /* @__PURE__ */ n
|
|
6
|
+
return /* @__PURE__ */ t(n, {
|
|
7
7
|
colors: {
|
|
8
8
|
light: {
|
|
9
9
|
background: "#F5F5F5",
|
|
@@ -20,7 +20,7 @@ function r({ colors: r, classNames: i, ...a }) {
|
|
|
20
20
|
},
|
|
21
21
|
classNames: {
|
|
22
22
|
...i,
|
|
23
|
-
card:
|
|
23
|
+
card: e("border-none rounded-3xl", i?.card)
|
|
24
24
|
},
|
|
25
25
|
...a
|
|
26
26
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PasswordChangedEmailProps } from '@better-auth-ui/react';
|
|
2
|
-
export type { PasswordChangedEmailProps } from '@better-auth-ui/react';
|
|
1
|
+
import { PasswordChangedEmailProps } from '@better-auth-ui/react/email';
|
|
2
|
+
export type { PasswordChangedEmailProps } from '@better-auth-ui/react/email';
|
|
3
3
|
export declare function PasswordChangedEmail({ colors, classNames, ...props }: PasswordChangedEmailProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
//#region src/components/email/password-changed-email.tsx
|
|
1
|
+
import { cn as e } from "@heroui/react";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { PasswordChangedEmail as n } from "@better-auth-ui/react/email";
|
|
4
|
+
//#region src/components/auth/email/password-changed-email.tsx
|
|
5
5
|
function r({ colors: r, classNames: i, ...a }) {
|
|
6
|
-
return /* @__PURE__ */ n
|
|
6
|
+
return /* @__PURE__ */ t(n, {
|
|
7
7
|
colors: {
|
|
8
8
|
light: {
|
|
9
9
|
background: "#F5F5F5",
|
|
@@ -20,8 +20,8 @@ function r({ colors: r, classNames: i, ...a }) {
|
|
|
20
20
|
},
|
|
21
21
|
classNames: {
|
|
22
22
|
...i,
|
|
23
|
-
card:
|
|
24
|
-
button:
|
|
23
|
+
card: e("border-none rounded-3xl", i?.card),
|
|
24
|
+
button: e("rounded-full", i?.button)
|
|
25
25
|
},
|
|
26
26
|
...a
|
|
27
27
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ResetPasswordEmailProps } from '@better-auth-ui/react';
|
|
2
|
-
export type { ResetPasswordEmailProps } from '@better-auth-ui/react';
|
|
1
|
+
import { ResetPasswordEmailProps } from '@better-auth-ui/react/email';
|
|
2
|
+
export type { ResetPasswordEmailProps } from '@better-auth-ui/react/email';
|
|
3
3
|
export declare function ResetPasswordEmail({ colors, classNames, ...props }: ResetPasswordEmailProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
//#region src/components/email/reset-password-email.tsx
|
|
1
|
+
import { cn as e } from "@heroui/react";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { ResetPasswordEmail as n } from "@better-auth-ui/react/email";
|
|
4
|
+
//#region src/components/auth/email/reset-password-email.tsx
|
|
5
5
|
function r({ colors: r, classNames: i, ...a }) {
|
|
6
|
-
return /* @__PURE__ */ n
|
|
6
|
+
return /* @__PURE__ */ t(n, {
|
|
7
7
|
colors: {
|
|
8
8
|
light: {
|
|
9
9
|
background: "#F5F5F5",
|
|
@@ -20,8 +20,8 @@ function r({ colors: r, classNames: i, ...a }) {
|
|
|
20
20
|
},
|
|
21
21
|
classNames: {
|
|
22
22
|
...i,
|
|
23
|
-
card:
|
|
24
|
-
button:
|
|
23
|
+
card: e("border-none rounded-3xl", i?.card),
|
|
24
|
+
button: e("rounded-full", i?.button)
|
|
25
25
|
},
|
|
26
26
|
...a
|
|
27
27
|
});
|
|
@@ -7,7 +7,7 @@ export type ForgotPasswordProps = {
|
|
|
7
7
|
* Render a card-based "Forgot Password" form that sends a password-reset email.
|
|
8
8
|
*
|
|
9
9
|
* The form displays an email input, submit button, and a link back to sign-in.
|
|
10
|
-
* Toasts are displayed on success or error via the `
|
|
10
|
+
* Toasts are displayed on success or error via the `useRequestPasswordReset` hook.
|
|
11
11
|
*
|
|
12
12
|
* @param className - Optional additional CSS class names applied to the card
|
|
13
13
|
* @returns The forgot-password form UI as a JSX element
|
|
@@ -1,61 +1,83 @@
|
|
|
1
|
-
import { useAuth as e,
|
|
2
|
-
import { Button as
|
|
3
|
-
import { jsx as
|
|
1
|
+
import { useAuth as e, useFetchOptions as t, useRequestPasswordReset as n } from "@better-auth-ui/react";
|
|
2
|
+
import { Button as r, Card as i, Description as a, FieldError as o, Form as s, Input as c, Label as l, Link as u, Spinner as d, TextField as f, cn as p, toast as m } from "@heroui/react";
|
|
3
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/auth/forgot-password.tsx
|
|
5
|
-
function
|
|
6
|
-
let { basePaths:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
function _({ className: _, variant: v, ...y }) {
|
|
6
|
+
let { authClient: b, basePaths: x, localization: S, viewPaths: C, navigate: w, plugins: T } = e(), { fetchOptions: E, resetFetchOptions: D } = t(), { mutate: O, isPending: k } = n(b, {
|
|
7
|
+
onError: (e) => {
|
|
8
|
+
m.danger(e.error?.message || e.message), D();
|
|
9
|
+
},
|
|
10
|
+
onSuccess: () => {
|
|
11
|
+
m.success(S.auth.passwordResetEmailSent), w({ to: `${x.auth}/${C.auth.signIn}` });
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
function A(e) {
|
|
15
|
+
e.preventDefault(), O({
|
|
16
|
+
email: new FormData(e.currentTarget).get("email"),
|
|
17
|
+
fetchOptions: E
|
|
18
|
+
});
|
|
11
19
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
let j = T.find((e) => e.captchaComponent)?.captchaComponent;
|
|
21
|
+
return /* @__PURE__ */ g(i, {
|
|
22
|
+
className: p("w-full max-w-sm gap-4 md:p-6", _),
|
|
23
|
+
variant: v,
|
|
24
|
+
...y,
|
|
16
25
|
children: [
|
|
17
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ h(i.Header, { children: /* @__PURE__ */ h(i.Title, {
|
|
18
27
|
className: "text-xl font-semibold mb-1",
|
|
19
|
-
children:
|
|
28
|
+
children: S.auth.forgotPassword
|
|
20
29
|
}) }),
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
type: "email",
|
|
27
|
-
autoComplete: "email",
|
|
28
|
-
isDisabled: w,
|
|
30
|
+
/* @__PURE__ */ h(i.Content, {
|
|
31
|
+
className: "gap-4",
|
|
32
|
+
children: /* @__PURE__ */ g(s, {
|
|
33
|
+
onSubmit: A,
|
|
34
|
+
className: "flex flex-col gap-4",
|
|
29
35
|
children: [
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
/* @__PURE__ */ g(f, {
|
|
37
|
+
name: "email",
|
|
38
|
+
type: "email",
|
|
39
|
+
autoComplete: "email",
|
|
40
|
+
isDisabled: k,
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ h(l, { children: S.auth.email }),
|
|
43
|
+
/* @__PURE__ */ h(c, {
|
|
44
|
+
placeholder: S.auth.emailPlaceholder,
|
|
45
|
+
required: !0,
|
|
46
|
+
variant: v === "transparent" ? "primary" : "secondary"
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ h(o, {})
|
|
49
|
+
]
|
|
50
|
+
}),
|
|
51
|
+
j && /* @__PURE__ */ h("div", {
|
|
52
|
+
className: "flex justify-center",
|
|
53
|
+
children: j
|
|
35
54
|
}),
|
|
36
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ h("div", {
|
|
56
|
+
className: "flex flex-col gap-3",
|
|
57
|
+
children: /* @__PURE__ */ g(r, {
|
|
58
|
+
type: "submit",
|
|
59
|
+
className: "w-full",
|
|
60
|
+
isPending: k,
|
|
61
|
+
children: [k && /* @__PURE__ */ h(d, {
|
|
62
|
+
color: "current",
|
|
63
|
+
size: "sm"
|
|
64
|
+
}), S.auth.sendResetLink]
|
|
65
|
+
})
|
|
66
|
+
})
|
|
37
67
|
]
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
color: "current",
|
|
44
|
-
size: "sm"
|
|
45
|
-
}), b.auth.sendResetLink]
|
|
46
|
-
})]
|
|
47
|
-
}) }),
|
|
48
|
-
/* @__PURE__ */ m(r.Footer, {
|
|
49
|
-
className: "flex-col",
|
|
50
|
-
children: /* @__PURE__ */ h(i, {
|
|
68
|
+
})
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ h(i.Footer, {
|
|
71
|
+
className: "flex-col gap-3",
|
|
72
|
+
children: /* @__PURE__ */ g(a, {
|
|
51
73
|
className: "text-sm",
|
|
52
74
|
children: [
|
|
53
|
-
|
|
75
|
+
S.auth.rememberYourPassword,
|
|
54
76
|
" ",
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
href: `${
|
|
57
|
-
className: "text-accent
|
|
58
|
-
children:
|
|
77
|
+
/* @__PURE__ */ h(u, {
|
|
78
|
+
href: `${x.auth}/${C.auth.signIn}`,
|
|
79
|
+
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
80
|
+
children: S.auth.signIn
|
|
59
81
|
})
|
|
60
82
|
]
|
|
61
83
|
})
|
|
@@ -64,4 +86,4 @@ function g({ className: g, variant: _, ...v }) {
|
|
|
64
86
|
});
|
|
65
87
|
}
|
|
66
88
|
//#endregion
|
|
67
|
-
export {
|
|
89
|
+
export { _ as ForgotPassword };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AuthView } from '@better-auth-ui/core';
|
|
2
|
+
export type MagicLinkButtonProps = {
|
|
3
|
+
/** @remarks `AuthView` */
|
|
4
|
+
view?: AuthView;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Toggle button between the password sign-in and magic-link routes.
|
|
8
|
+
*
|
|
9
|
+
* @param view - Current auth view. On `"magicLink"` this links back to password sign-in.
|
|
10
|
+
*/
|
|
11
|
+
export declare function MagicLinkButton({ view }: MagicLinkButtonProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { magicLinkPlugin as e } from "../../../lib/auth/magic-link-plugin.js";
|
|
2
|
+
import { authMutationKeys as t } from "@better-auth-ui/core";
|
|
3
|
+
import { useAuth as n, useAuthPlugin as r } from "@better-auth-ui/react";
|
|
4
|
+
import { Envelope as i, Lock as a } from "@gravity-ui/icons";
|
|
5
|
+
import { Link as o, cn as s } from "@heroui/react";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
import { useIsMutating as u } from "@tanstack/react-query";
|
|
8
|
+
import { buttonVariants as d } from "@heroui/styles";
|
|
9
|
+
//#region src/components/auth/magic-link/magic-link-button.tsx
|
|
10
|
+
function f({ view: f }) {
|
|
11
|
+
let { basePaths: p, emailAndPassword: m, viewPaths: h, localization: g } = n(), _ = u({ mutationKey: t.signIn.all }) + u({ mutationKey: t.signUp.all }) > 0, { localization: v, viewPaths: y } = r(e), b = f === "magicLink";
|
|
12
|
+
return b && !m?.enabled ? null : /* @__PURE__ */ l(o, {
|
|
13
|
+
href: `${p.auth}/${b ? h.auth.signIn : y.auth.magicLink}`,
|
|
14
|
+
isDisabled: _,
|
|
15
|
+
className: s(d({ variant: "tertiary" }), "w-full gap-2", _ && "status-disabled"),
|
|
16
|
+
children: [c(b ? a : i, {}), g.auth.continueWith.replace("{{provider}}", b ? g.auth.password : v.magicLink)]
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { f as MagicLinkButton };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CardProps } from '@heroui/react';
|
|
2
|
+
import { SocialLayout } from '../provider-buttons';
|
|
3
|
+
export type MagicLinkProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
socialLayout?: SocialLayout;
|
|
6
|
+
socialPosition?: "top" | "bottom";
|
|
7
|
+
variant?: CardProps["variant"];
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Magic-link sign-in form.
|
|
11
|
+
*
|
|
12
|
+
* @param socialLayout - Provider button layout.
|
|
13
|
+
* @param socialPosition - `"top"` or `"bottom"`. Defaults to `"bottom"`.
|
|
14
|
+
* @param variant - Card variant.
|
|
15
|
+
*/
|
|
16
|
+
export declare function MagicLink({ className, socialLayout, socialPosition, variant, ...props }: MagicLinkProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { FieldSeparator as e } from "../field-separator.js";
|
|
2
|
+
import { ProviderButtons as t } from "../provider-buttons.js";
|
|
3
|
+
import { magicLinkPlugin as n } from "../../../lib/auth/magic-link-plugin.js";
|
|
4
|
+
import { authMutationKeys as r } from "@better-auth-ui/core";
|
|
5
|
+
import { useAuth as i, useAuthPlugin as a, useSignInMagicLink as o } from "@better-auth-ui/react";
|
|
6
|
+
import { Button as s, Card as c, Description as l, FieldError as u, Form as d, Input as f, Label as p, Link as m, Spinner as h, TextField as g, cn as _, toast as v } from "@heroui/react";
|
|
7
|
+
import { useState as y } from "react";
|
|
8
|
+
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
9
|
+
import { useIsMutating as C } from "@tanstack/react-query";
|
|
10
|
+
//#region src/components/auth/magic-link/magic-link.tsx
|
|
11
|
+
function w({ className: w, socialLayout: T, socialPosition: E = "bottom", variant: D, ...O }) {
|
|
12
|
+
let { authClient: k, basePaths: A, baseURL: j, emailAndPassword: M, localization: N, plugins: P, redirectTo: F, socialProviders: I, viewPaths: L } = i(), { localization: R } = a(n), [z, B] = y(""), { mutate: V, isPending: H } = o(k, { onSuccess: () => {
|
|
13
|
+
B(""), v.success(R.magicLinkSent);
|
|
14
|
+
} }), U = C({ mutationKey: r.signIn.all }) + C({ mutationKey: r.signUp.all }) > 0, W = (e) => {
|
|
15
|
+
e.preventDefault(), V({
|
|
16
|
+
email: z,
|
|
17
|
+
callbackURL: `${j}${F}`
|
|
18
|
+
});
|
|
19
|
+
}, G = !!I?.length;
|
|
20
|
+
return /* @__PURE__ */ S(c, {
|
|
21
|
+
className: _("w-full max-w-sm gap-4 md:p-6", w),
|
|
22
|
+
variant: D,
|
|
23
|
+
...O,
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ x(c.Header, { children: /* @__PURE__ */ x(c.Title, {
|
|
26
|
+
className: "text-xl font-semibold mb-1",
|
|
27
|
+
children: N.auth.signIn
|
|
28
|
+
}) }),
|
|
29
|
+
/* @__PURE__ */ S(c.Content, {
|
|
30
|
+
className: "gap-4",
|
|
31
|
+
children: [
|
|
32
|
+
E === "top" && /* @__PURE__ */ S(b, { children: [!!I?.length && /* @__PURE__ */ x(t, { socialLayout: T }), G && /* @__PURE__ */ x(e, { children: N.auth.or })] }),
|
|
33
|
+
/* @__PURE__ */ S(d, {
|
|
34
|
+
onSubmit: W,
|
|
35
|
+
className: "flex flex-col gap-4",
|
|
36
|
+
children: [/* @__PURE__ */ S(g, {
|
|
37
|
+
name: "email",
|
|
38
|
+
type: "email",
|
|
39
|
+
autoComplete: "email",
|
|
40
|
+
isDisabled: U,
|
|
41
|
+
value: z,
|
|
42
|
+
onChange: B,
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ x(p, { children: N.auth.email }),
|
|
45
|
+
/* @__PURE__ */ x(f, {
|
|
46
|
+
placeholder: N.auth.emailPlaceholder,
|
|
47
|
+
required: !0,
|
|
48
|
+
variant: D === "transparent" ? "primary" : "secondary"
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ x(u, {})
|
|
51
|
+
]
|
|
52
|
+
}), /* @__PURE__ */ S("div", {
|
|
53
|
+
className: "flex flex-col gap-3",
|
|
54
|
+
children: [/* @__PURE__ */ S(s, {
|
|
55
|
+
type: "submit",
|
|
56
|
+
className: "w-full",
|
|
57
|
+
isPending: U,
|
|
58
|
+
children: [H && /* @__PURE__ */ x(h, {
|
|
59
|
+
color: "current",
|
|
60
|
+
size: "sm"
|
|
61
|
+
}), R.sendMagicLink]
|
|
62
|
+
}), P.flatMap((e) => (e.authButtons ?? []).map((t, n) => /* @__PURE__ */ x(t, { view: "magicLink" }, `${e.id}-${n.toString()}`)))]
|
|
63
|
+
})]
|
|
64
|
+
}),
|
|
65
|
+
E === "bottom" && /* @__PURE__ */ S(b, { children: [G && /* @__PURE__ */ x(e, { children: N.auth.or }), !!I?.length && /* @__PURE__ */ x(t, { socialLayout: T })] })
|
|
66
|
+
]
|
|
67
|
+
}),
|
|
68
|
+
M?.enabled && /* @__PURE__ */ x(c.Footer, {
|
|
69
|
+
className: "flex-col gap-3",
|
|
70
|
+
children: /* @__PURE__ */ S(l, {
|
|
71
|
+
className: "text-sm",
|
|
72
|
+
children: [
|
|
73
|
+
N.auth.needToCreateAnAccount,
|
|
74
|
+
" ",
|
|
75
|
+
/* @__PURE__ */ x(m, {
|
|
76
|
+
href: `${A.auth}/${L.auth.signUp}`,
|
|
77
|
+
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
78
|
+
children: N.auth.signUp
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { w as MagicLink };
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type DeviceSession = {
|
|
3
|
-
session: Session;
|
|
4
|
-
user: User;
|
|
5
|
-
};
|
|
1
|
+
import { ListDeviceSession } from '@better-auth-ui/react';
|
|
6
2
|
export type ManageAccountProps = {
|
|
7
|
-
deviceSession?:
|
|
3
|
+
deviceSession?: ListDeviceSession | null;
|
|
8
4
|
isPending?: boolean;
|
|
9
5
|
};
|
|
10
6
|
/**
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { UserView as e } from "../user/user-view.js";
|
|
2
|
+
import { multiSessionPlugin as t } from "../../../lib/auth/multi-session-plugin.js";
|
|
3
|
+
import { useAuth as n, useAuthPlugin as r, useRevokeMultiSession as i, useSetActiveSession as a, useUser as o } from "@better-auth-ui/react";
|
|
4
|
+
import { ArrowRightArrowLeft as s, ArrowRightFromSquare as c, Ellipsis as l } from "@gravity-ui/icons";
|
|
5
|
+
import { Button as u, Dropdown as d, Spinner as f, toast as p } from "@heroui/react";
|
|
6
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/auth/multi-session/manage-account.tsx
|
|
8
|
+
function g({ deviceSession: g, isPending: _ }) {
|
|
9
|
+
let { authClient: v, localization: y } = n(), { localization: b } = r(t), { data: x } = o(v), { mutate: S, isPending: C } = a(v, { onSuccess: () => window.scrollTo({ top: 0 }) }), { mutate: w, isPending: T } = i(v, { onSuccess: () => p.success(y.settings.revokeSessionSuccess) }), E = g?.session.userId === x?.id, D = C || T;
|
|
10
|
+
return /* @__PURE__ */ h("div", {
|
|
11
|
+
className: "flex items-center justify-between gap-3",
|
|
12
|
+
children: [
|
|
13
|
+
/* @__PURE__ */ m(e, {
|
|
14
|
+
user: g?.user,
|
|
15
|
+
isPending: _,
|
|
16
|
+
size: "md"
|
|
17
|
+
}),
|
|
18
|
+
g && E && /* @__PURE__ */ h(u, {
|
|
19
|
+
className: "shrink-0",
|
|
20
|
+
variant: "outline",
|
|
21
|
+
size: "sm",
|
|
22
|
+
onPress: () => w({ sessionToken: g.session.token }),
|
|
23
|
+
isDisabled: D,
|
|
24
|
+
children: [T ? /* @__PURE__ */ m(f, {
|
|
25
|
+
color: "current",
|
|
26
|
+
size: "sm"
|
|
27
|
+
}) : /* @__PURE__ */ m(c, {}), y.auth.signOut]
|
|
28
|
+
}),
|
|
29
|
+
g && !E && /* @__PURE__ */ h(d, { children: [/* @__PURE__ */ m(u, {
|
|
30
|
+
isIconOnly: !0,
|
|
31
|
+
variant: "ghost",
|
|
32
|
+
className: "shrink-0",
|
|
33
|
+
size: "sm",
|
|
34
|
+
isDisabled: D,
|
|
35
|
+
children: /* @__PURE__ */ m(l, {})
|
|
36
|
+
}), /* @__PURE__ */ m(d.Popover, { children: /* @__PURE__ */ h(d.Menu, { children: [/* @__PURE__ */ h(d.Item, {
|
|
37
|
+
textValue: b.switchAccount,
|
|
38
|
+
onAction: () => S({ sessionToken: g.session.token }),
|
|
39
|
+
children: [/* @__PURE__ */ m(s, { className: "text-muted" }), b.switchAccount]
|
|
40
|
+
}), /* @__PURE__ */ h(d.Item, {
|
|
41
|
+
textValue: y.auth.signOut,
|
|
42
|
+
onAction: () => w({ sessionToken: g.session.token }),
|
|
43
|
+
children: [/* @__PURE__ */ m(c, { className: "text-muted" }), y.auth.signOut]
|
|
44
|
+
})] }) })] })
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { g as ManageAccount };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { multiSessionPlugin as e } from "../../../lib/auth/multi-session-plugin.js";
|
|
2
|
+
import { ManageAccount as t } from "./manage-account.js";
|
|
3
|
+
import { useAuth as n, useAuthPlugin as r, useListDeviceSessions as i, useSession as a } from "@better-auth-ui/react";
|
|
4
|
+
import { Card as o, cn as s } from "@heroui/react";
|
|
5
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/auth/multi-session/manage-accounts.tsx
|
|
7
|
+
function u({ className: u, variant: d, ...f }) {
|
|
8
|
+
let { authClient: p } = n(), { localization: m } = r(e), { data: h } = a(p), { data: g, isPending: _ } = i(p), v = g?.filter((e) => e.session.id !== h?.session.id), y = [{
|
|
9
|
+
key: h?.session.id ?? "current",
|
|
10
|
+
deviceSession: _ ? null : h,
|
|
11
|
+
isPending: _
|
|
12
|
+
}, ...v?.map((e) => ({
|
|
13
|
+
key: e.session.id,
|
|
14
|
+
deviceSession: e,
|
|
15
|
+
isPending: !1
|
|
16
|
+
})) ?? []];
|
|
17
|
+
return /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("h2", {
|
|
18
|
+
className: s("text-sm font-semibold mb-3"),
|
|
19
|
+
children: m.manageAccounts
|
|
20
|
+
}), /* @__PURE__ */ c(o, {
|
|
21
|
+
className: s(u),
|
|
22
|
+
variant: d,
|
|
23
|
+
...f,
|
|
24
|
+
children: /* @__PURE__ */ c(o.Content, {
|
|
25
|
+
className: "gap-0",
|
|
26
|
+
children: y.map((e, n) => /* @__PURE__ */ l("div", { children: [n > 0 && /* @__PURE__ */ c("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ c(t, {
|
|
27
|
+
deviceSession: e.deviceSession,
|
|
28
|
+
isPending: e.isPending
|
|
29
|
+
})] }, e.key))
|
|
30
|
+
})
|
|
31
|
+
})] });
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { u as ManageAccounts };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Render the
|
|
2
|
+
* Render the submenu content for switching between multiple authenticated sessions.
|
|
3
3
|
*
|
|
4
4
|
* Shows the current session with a checkmark, lists other device sessions that can be activated,
|
|
5
5
|
* and provides an option to add a new account. This component should be rendered inside a
|
|
6
6
|
* Dropdown.SubmenuTrigger to defer the useListDeviceSessions query until the submenu is opened.
|
|
7
7
|
*
|
|
8
|
-
* @returns The switch account
|
|
8
|
+
* @returns The switch account submenu content as a JSX element
|
|
9
9
|
*/
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function SwitchAccountSubmenuContent(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { UserView as e } from "../user/user-view.js";
|
|
2
|
+
import { SwitchAccountSubmenuItem as t } from "./switch-account-submenu-item.js";
|
|
3
|
+
import { multiSessionPlugin as n } from "../../../lib/auth/multi-session-plugin.js";
|
|
4
|
+
import { useAuth as r, useAuthPlugin as i, useListDeviceSessions as a, useSession as o } from "@better-auth-ui/react";
|
|
5
|
+
import { Check as s, CirclePlus as c } from "@gravity-ui/icons";
|
|
6
|
+
import { Dropdown as l, Label as u, Separator as d } from "@heroui/react";
|
|
7
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/auth/multi-session/switch-account-submenu-content.tsx
|
|
9
|
+
function m() {
|
|
10
|
+
let { authClient: m, basePaths: h, viewPaths: g } = r(), { localization: _ } = i(n), { data: v } = o(m), { data: y, isPending: b } = a(m);
|
|
11
|
+
return /* @__PURE__ */ f(l.Popover, {
|
|
12
|
+
className: "min-w-40 md:min-w-56 max-w-[48svw]",
|
|
13
|
+
children: /* @__PURE__ */ p(l.Menu, { children: [
|
|
14
|
+
/* @__PURE__ */ p(l.Item, {
|
|
15
|
+
className: "px-2",
|
|
16
|
+
children: [/* @__PURE__ */ f(e, { isPending: b }), !b && /* @__PURE__ */ f(s, { className: "ml-auto" })]
|
|
17
|
+
}),
|
|
18
|
+
y?.filter((e) => e.session.id !== v?.session?.id).map((e) => /* @__PURE__ */ f(t, { deviceSession: e }, e.session.id)),
|
|
19
|
+
/* @__PURE__ */ f(d, {}),
|
|
20
|
+
/* @__PURE__ */ p(l.Item, {
|
|
21
|
+
textValue: _.addAccount,
|
|
22
|
+
href: `${h.auth}/${g.auth.signIn}`,
|
|
23
|
+
children: [/* @__PURE__ */ f(c, { className: "text-muted" }), /* @__PURE__ */ f(u, { children: _.addAccount })]
|
|
24
|
+
})
|
|
25
|
+
] })
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { m as SwitchAccountSubmenuContent };
|
|
@@ -3,7 +3,7 @@ type DeviceSession = {
|
|
|
3
3
|
session: Session;
|
|
4
4
|
user: User;
|
|
5
5
|
};
|
|
6
|
-
export type
|
|
6
|
+
export type SwitchAccountSubmenuItemProps = {
|
|
7
7
|
deviceSession: DeviceSession;
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
@@ -12,5 +12,5 @@ export type SwitchAccountItemProps = {
|
|
|
12
12
|
* @param deviceSession - The device session to display and switch to when pressed
|
|
13
13
|
* @returns The switch account dropdown item as a JSX element
|
|
14
14
|
*/
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function SwitchAccountSubmenuItem({ deviceSession }: SwitchAccountSubmenuItemProps): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { UserView as e } from "../user/user-view.js";
|
|
2
|
+
import { useAuth as t, useSetActiveSession as n } from "@better-auth-ui/react";
|
|
3
|
+
import { Dropdown as r, Spinner as i } from "@heroui/react";
|
|
4
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/auth/multi-session/switch-account-submenu-item.tsx
|
|
6
|
+
function s({ deviceSession: s }) {
|
|
7
|
+
let { authClient: c } = t(), { mutate: l, isPending: u } = n(c, { onSuccess: () => window.scrollTo({ top: 0 }) });
|
|
8
|
+
return /* @__PURE__ */ o(r.Item, {
|
|
9
|
+
className: "px-2",
|
|
10
|
+
isDisabled: u,
|
|
11
|
+
onPress: () => l({ sessionToken: s.session.token }),
|
|
12
|
+
children: [/* @__PURE__ */ a(e, { user: s.user }), u && /* @__PURE__ */ a(i, {
|
|
13
|
+
color: "current",
|
|
14
|
+
size: "sm",
|
|
15
|
+
className: "ml-auto"
|
|
16
|
+
})]
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { s as SwitchAccountSubmenuItem };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type SwitchAccountSubmenuProps = {
|
|
2
|
+
className?: string;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Render a dropdown submenu for switching between multiple authenticated sessions.
|
|
6
|
+
*
|
|
7
|
+
* This component renders as a submenu trigger that opens the switch account menu.
|
|
8
|
+
* It should be rendered inside a Dropdown.Menu.
|
|
9
|
+
*
|
|
10
|
+
* @param className - Optional additional CSS class names
|
|
11
|
+
* @returns The switch account submenu as a JSX element
|
|
12
|
+
*/
|
|
13
|
+
export declare function SwitchAccountSubmenu({ className }: SwitchAccountSubmenuProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SwitchAccountSubmenuContent as e } from "./switch-account-submenu-content.js";
|
|
2
|
+
import { multiSessionPlugin as t } from "../../../lib/auth/multi-session-plugin.js";
|
|
3
|
+
import { useAuth as n, useAuthPlugin as r, useSession as i } from "@better-auth-ui/react";
|
|
4
|
+
import { Persons as a } from "@gravity-ui/icons";
|
|
5
|
+
import { Dropdown as o, Label as s } from "@heroui/react";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/auth/multi-session/switch-account-submenu.tsx
|
|
8
|
+
function u({ className: u }) {
|
|
9
|
+
let { authClient: d } = n(), { data: f } = i(d), { localization: p } = r(t);
|
|
10
|
+
return f ? /* @__PURE__ */ l(o.SubmenuTrigger, { children: [/* @__PURE__ */ l(o.Item, {
|
|
11
|
+
className: u,
|
|
12
|
+
textValue: p.switchAccount,
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ c(a, { className: "text-muted" }),
|
|
15
|
+
/* @__PURE__ */ c(s, { children: p.switchAccount }),
|
|
16
|
+
/* @__PURE__ */ c(o.SubmenuIndicator, {})
|
|
17
|
+
]
|
|
18
|
+
}), /* @__PURE__ */ c(o.Popover, {
|
|
19
|
+
className: "min-w-40 md:min-w-56 max-w-[48svw]",
|
|
20
|
+
children: /* @__PURE__ */ c(e, {})
|
|
21
|
+
})] }) : null;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { u as SwitchAccountSubmenu };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { passkeyPlugin as e } from "../../../lib/auth/passkey-plugin.js";
|
|
2
|
+
import { authMutationKeys as t } from "@better-auth-ui/core";
|
|
3
|
+
import { useAuth as n, useAuthPlugin as r, useSignInPasskey as i } from "@better-auth-ui/react";
|
|
4
|
+
import { Fingerprint as a } from "@gravity-ui/icons";
|
|
5
|
+
import { Button as o, Spinner as s } from "@heroui/react";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
import { useIsMutating as u } from "@tanstack/react-query";
|
|
8
|
+
//#region src/components/auth/passkey/passkey-button.tsx
|
|
9
|
+
function d({ view: d }) {
|
|
10
|
+
let { authClient: f, localization: p, redirectTo: m, navigate: h } = n(), { localization: g } = r(e), { mutate: _, isPending: v } = i(f, { onSuccess: () => h({ to: m }) }), y = u({ mutationKey: t.signIn.all }) + u({ mutationKey: t.signUp.all }) > 0;
|
|
11
|
+
return d === "signUp" ? null : /* @__PURE__ */ l(o, {
|
|
12
|
+
className: "w-full",
|
|
13
|
+
variant: "tertiary",
|
|
14
|
+
isDisabled: y,
|
|
15
|
+
isPending: v,
|
|
16
|
+
onPress: () => _(),
|
|
17
|
+
children: [v ? /* @__PURE__ */ c(s, {
|
|
18
|
+
color: "current",
|
|
19
|
+
size: "sm"
|
|
20
|
+
}) : /* @__PURE__ */ c(a, {}), p.auth.continueWith.replace("{{provider}}", g.passkey)]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { d as PasskeyButton };
|