@better-auth-ui/react 1.6.0 → 1.6.2
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.d.ts +4 -3
- package/dist/components/auth/auth-provider.js +24 -40
- package/dist/components/email/email-changed.d.ts +2 -2
- package/dist/components/email/email-changed.js +154 -68
- package/dist/components/email/email-localization.js +18 -23
- package/dist/components/email/email-styles.js +52 -77
- package/dist/components/email/email-verification.d.ts +2 -2
- package/dist/components/email/email-verification.js +138 -73
- package/dist/components/email/index.d.ts +9 -9
- package/dist/components/email/index.js +9 -9
- package/dist/components/email/magic-link.d.ts +2 -2
- package/dist/components/email/magic-link.js +139 -70
- package/dist/components/email/new-device.d.ts +2 -2
- package/dist/components/email/new-device.js +221 -88
- package/dist/components/email/otp-email.d.ts +2 -2
- package/dist/components/email/otp-email.js +127 -63
- package/dist/components/email/password-changed.d.ts +2 -2
- package/dist/components/email/password-changed.js +157 -74
- package/dist/components/email/reset-password.d.ts +2 -2
- package/dist/components/email/reset-password.js +138 -66
- package/dist/components/icons/apple.d.ts +1 -1
- package/dist/components/icons/apple.js +16 -9
- package/dist/components/icons/atlassian.d.ts +1 -1
- package/dist/components/icons/atlassian.js +38 -13
- package/dist/components/icons/cognito.d.ts +1 -1
- package/dist/components/icons/cognito.js +19 -9
- package/dist/components/icons/discord.d.ts +1 -1
- package/dist/components/icons/discord.js +16 -9
- package/dist/components/icons/dropbox.d.ts +1 -1
- package/dist/components/icons/dropbox.js +16 -9
- package/dist/components/icons/facebook.d.ts +1 -1
- package/dist/components/icons/facebook.js +19 -11
- package/dist/components/icons/figma.d.ts +1 -1
- package/dist/components/icons/figma.js +34 -12
- package/dist/components/icons/github.d.ts +1 -1
- package/dist/components/icons/github.js +16 -11
- package/dist/components/icons/gitlab.d.ts +1 -1
- package/dist/components/icons/gitlab.js +30 -9
- package/dist/components/icons/google.d.ts +1 -1
- package/dist/components/icons/google.js +39 -9
- package/dist/components/icons/huggingface.d.ts +1 -1
- package/dist/components/icons/huggingface.js +38 -9
- package/dist/components/icons/index.d.ts +35 -35
- package/dist/components/icons/index.js +35 -35
- package/dist/components/icons/kakao.d.ts +1 -1
- package/dist/components/icons/kakao.js +16 -11
- package/dist/components/icons/kick.d.ts +1 -1
- package/dist/components/icons/kick.js +20 -11
- package/dist/components/icons/line.d.ts +1 -1
- package/dist/components/icons/line.js +16 -9
- package/dist/components/icons/linear.d.ts +1 -1
- package/dist/components/icons/linear.js +16 -9
- package/dist/components/icons/linkedin.d.ts +1 -1
- package/dist/components/icons/linkedin.js +33 -9
- package/dist/components/icons/microsoft.d.ts +1 -1
- package/dist/components/icons/microsoft.js +30 -9
- package/dist/components/icons/naver.d.ts +1 -1
- package/dist/components/icons/naver.js +16 -9
- package/dist/components/icons/notion.d.ts +1 -1
- package/dist/components/icons/notion.js +16 -9
- package/dist/components/icons/paybin.d.ts +1 -1
- package/dist/components/icons/paybin.js +32 -8
- package/dist/components/icons/paypal.d.ts +1 -1
- package/dist/components/icons/paypal.js +30 -9
- package/dist/components/icons/polar.d.ts +1 -1
- package/dist/components/icons/polar.js +24 -9
- package/dist/components/icons/railway.d.ts +1 -1
- package/dist/components/icons/railway.js +16 -9
- package/dist/components/icons/reddit.d.ts +1 -1
- package/dist/components/icons/reddit.js +21 -9
- package/dist/components/icons/roblox.d.ts +1 -1
- package/dist/components/icons/roblox.js +17 -12
- package/dist/components/icons/salesforce.d.ts +1 -1
- package/dist/components/icons/salesforce.js +16 -9
- package/dist/components/icons/slack.d.ts +1 -1
- package/dist/components/icons/slack.js +30 -9
- package/dist/components/icons/spotify.d.ts +1 -1
- package/dist/components/icons/spotify.js +16 -9
- package/dist/components/icons/tiktok.d.ts +1 -1
- package/dist/components/icons/tiktok.js +23 -10
- package/dist/components/icons/twitch.d.ts +1 -1
- package/dist/components/icons/twitch.js +43 -12
- package/dist/components/icons/vercel.d.ts +1 -1
- package/dist/components/icons/vercel.js +16 -9
- package/dist/components/icons/vk.d.ts +1 -1
- package/dist/components/icons/vk.js +16 -9
- package/dist/components/icons/wechat.d.ts +1 -1
- package/dist/components/icons/wechat.js +16 -9
- package/dist/components/icons/x.d.ts +1 -1
- package/dist/components/icons/x.js +16 -9
- package/dist/components/icons/zoom.d.ts +1 -1
- package/dist/components/icons/zoom.js +69 -11
- package/dist/components/settings/account/theme-preview.js +286 -7
- package/dist/core.d.ts +1 -1
- package/dist/hooks/auth/use-auth-mutation.d.ts +2 -2
- package/dist/hooks/auth/use-auth-mutation.js +12 -9
- package/dist/hooks/auth/use-auth-query.d.ts +3 -3
- package/dist/hooks/auth/use-auth-query.js +12 -9
- package/dist/hooks/auth/use-authenticate.d.ts +2 -2
- package/dist/hooks/auth/use-authenticate.js +22 -27
- package/dist/hooks/auth/use-is-username-available.d.ts +19 -0
- package/dist/hooks/auth/use-is-username-available.js +12 -0
- package/dist/hooks/auth/use-request-password-reset.d.ts +5 -6
- package/dist/hooks/auth/use-request-password-reset.js +11 -13
- package/dist/hooks/auth/use-reset-password.d.ts +8 -9
- package/dist/hooks/auth/use-reset-password.js +11 -12
- package/dist/hooks/auth/use-send-verification-email.d.ts +5 -6
- package/dist/hooks/auth/use-send-verification-email.js +11 -12
- package/dist/hooks/auth/use-session.d.ts +2 -2
- package/dist/hooks/auth/use-session.js +14 -17
- package/dist/hooks/auth/use-sign-in-email.d.ts +6 -7
- package/dist/hooks/auth/use-sign-in-email.js +17 -23
- package/dist/hooks/auth/use-sign-in-magic-link.d.ts +5 -6
- package/dist/hooks/auth/use-sign-in-magic-link.js +11 -12
- package/dist/hooks/auth/use-sign-in-passkey.d.ts +58 -0
- package/dist/hooks/auth/use-sign-in-passkey.js +18 -0
- package/dist/hooks/auth/use-sign-in-social.d.ts +8 -9
- package/dist/hooks/auth/use-sign-in-social.js +11 -12
- package/dist/hooks/auth/use-sign-in-username.d.ts +53 -0
- package/dist/hooks/auth/use-sign-in-username.js +18 -0
- package/dist/hooks/auth/use-sign-out.d.ts +4 -5
- package/dist/hooks/auth/use-sign-out.js +17 -23
- package/dist/hooks/auth/use-sign-up-email.d.ts +822 -79
- package/dist/hooks/auth/use-sign-up-email.js +17 -23
- package/dist/hooks/auth/use-user.d.ts +58 -58
- package/dist/hooks/auth/use-user.js +10 -13
- package/dist/hooks/settings/use-account-info.d.ts +5 -5
- package/dist/hooks/settings/use-account-info.js +20 -24
- package/dist/hooks/settings/use-add-passkey.d.ts +43 -0
- package/dist/hooks/settings/use-add-passkey.js +18 -0
- package/dist/hooks/settings/use-change-email.d.ts +5 -5
- package/dist/hooks/settings/use-change-email.js +17 -22
- package/dist/hooks/settings/use-change-password.d.ts +6 -7
- package/dist/hooks/settings/use-change-password.js +11 -10
- package/dist/hooks/settings/use-delete-passkey.d.ts +21 -0
- package/dist/hooks/settings/use-delete-passkey.js +18 -0
- package/dist/hooks/settings/use-delete-user.d.ts +8 -9
- package/dist/hooks/settings/use-delete-user.js +11 -10
- package/dist/hooks/settings/use-link-social.d.ts +5 -5
- package/dist/hooks/settings/use-link-social.js +11 -9
- package/dist/hooks/settings/use-list-accounts.d.ts +4 -4
- package/dist/hooks/settings/use-list-accounts.js +20 -22
- package/dist/hooks/settings/use-list-device-sessions.d.ts +2 -2
- package/dist/hooks/settings/use-list-device-sessions.js +20 -21
- package/dist/hooks/settings/use-list-sessions.d.ts +4 -4
- package/dist/hooks/settings/use-list-sessions.js +20 -21
- package/dist/hooks/settings/use-list-user-passkeys.d.ts +11 -0
- package/dist/hooks/settings/use-list-user-passkeys.js +21 -0
- package/dist/hooks/settings/use-revoke-multi-session.d.ts +5 -5
- package/dist/hooks/settings/use-revoke-multi-session.js +17 -19
- package/dist/hooks/settings/use-revoke-session.d.ts +5 -5
- package/dist/hooks/settings/use-revoke-session.js +17 -20
- package/dist/hooks/settings/use-set-active-session.d.ts +5 -5
- package/dist/hooks/settings/use-set-active-session.js +20 -27
- package/dist/hooks/settings/use-unlink-account.d.ts +5 -5
- package/dist/hooks/settings/use-unlink-account.js +17 -20
- package/dist/hooks/settings/use-update-user.d.ts +2 -2
- package/dist/hooks/settings/use-update-user.js +24 -28
- package/dist/index.d.ts +40 -32
- package/dist/index.js +84 -32
- package/dist/lib/auth-client.d.ts +2953 -1241
- package/dist/lib/auth-client.js +11 -5
- package/dist/lib/auth-config.d.ts +3 -3
- package/dist/lib/auth-context.d.ts +2 -2
- package/dist/lib/auth-context.js +5 -2
- package/dist/lib/provider-icons.d.ts +2 -2
- package/dist/lib/provider-icons.js +75 -47
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +7 -4
- package/package.json +16 -9
- package/src/components/auth/auth-provider.tsx +4 -6
- package/src/hooks/auth/use-authenticate.ts +3 -1
- package/src/hooks/auth/use-is-username-available.ts +22 -0
- package/src/hooks/auth/use-request-password-reset.ts +4 -6
- package/src/hooks/auth/use-reset-password.ts +4 -6
- package/src/hooks/auth/use-send-verification-email.ts +4 -6
- package/src/hooks/auth/use-session.ts +2 -1
- package/src/hooks/auth/use-sign-in-email.ts +9 -10
- package/src/hooks/auth/use-sign-in-magic-link.ts +4 -6
- package/src/hooks/auth/use-sign-in-passkey.ts +34 -0
- package/src/hooks/auth/use-sign-in-social.ts +4 -6
- package/src/hooks/auth/use-sign-in-username.ts +34 -0
- package/src/hooks/auth/use-sign-out.ts +6 -7
- package/src/hooks/auth/use-sign-up-email.ts +9 -10
- package/src/hooks/auth/use-user.ts +1 -2
- package/src/hooks/settings/use-account-info.ts +2 -1
- package/src/hooks/settings/use-add-passkey.ts +32 -0
- package/src/hooks/settings/use-change-email.ts +6 -6
- package/src/hooks/settings/use-change-password.ts +4 -6
- package/src/hooks/settings/use-delete-passkey.ts +32 -0
- package/src/hooks/settings/use-delete-user.ts +4 -6
- package/src/hooks/settings/use-link-social.ts +4 -4
- package/src/hooks/settings/use-list-accounts.ts +3 -1
- package/src/hooks/settings/use-list-device-sessions.ts +3 -1
- package/src/hooks/settings/use-list-sessions.ts +3 -1
- package/src/hooks/settings/use-list-user-passkeys.ts +30 -0
- package/src/hooks/settings/use-revoke-multi-session.ts +6 -6
- package/src/hooks/settings/use-revoke-session.ts +4 -5
- package/src/hooks/settings/use-set-active-session.ts +9 -8
- package/src/hooks/settings/use-unlink-account.ts +4 -5
- package/src/hooks/settings/use-update-user.ts +8 -9
- package/src/index.ts +8 -0
- package/src/lib/auth-client.ts +7 -1
- package/src/lib/auth-config.ts +1 -1
- package/dist/hooks/auth/use-forgot-password.d.ts +0 -20
- package/dist/hooks/auth/use-forgot-password.js +0 -14
- package/dist/hooks/use-hydrated.d.ts +0 -6
- package/dist/hooks/use-hydrated.js +0 -18
- package/dist/lib/auth-config.js +0 -1
- package/dist/lib/auth-hook-options.d.ts +0 -8
- package/dist/lib/auth-hook-options.js +0 -1
package/dist/lib/auth-client.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { passkeyClient as e } from "@better-auth/passkey/client";
|
|
2
|
+
import { magicLinkClient as t, multiSessionClient as n, usernameClient as r } from "better-auth/client/plugins";
|
|
3
|
+
import { createAuthClient as i } from "better-auth/react";
|
|
4
|
+
//#region src/lib/auth-client.ts
|
|
5
|
+
i({ plugins: [
|
|
6
|
+
t(),
|
|
7
|
+
n(),
|
|
8
|
+
e(),
|
|
9
|
+
r()
|
|
10
|
+
] });
|
|
11
|
+
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { AuthConfig as BaseAuthConfig } from '@better-auth-ui/core';
|
|
2
|
+
import { ComponentType, PropsWithChildren } from 'react';
|
|
3
|
+
import { AnyAuthClient, AuthClient } from './auth-client';
|
|
4
4
|
/**
|
|
5
5
|
* Extends the base AuthConfig with React-specific requirements including
|
|
6
6
|
* an authClient instance and a Link component for navigation.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const AuthContext: import(
|
|
1
|
+
import { AuthConfig } from './auth-config';
|
|
2
|
+
export declare const AuthContext: import('react').Context<AuthConfig | undefined>;
|
package/dist/lib/auth-context.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { SocialProvider } from 'better-auth/social-providers';
|
|
2
|
+
import { ComponentPropsWithRef, ComponentType } from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Mapping of social authentication provider names to their corresponding icon components.
|
|
5
5
|
*
|
|
@@ -1,48 +1,76 @@
|
|
|
1
|
-
import { Apple
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
import { Apple as e } from "../components/icons/apple.js";
|
|
2
|
+
import { Atlassian as t } from "../components/icons/atlassian.js";
|
|
3
|
+
import { Cognito as n } from "../components/icons/cognito.js";
|
|
4
|
+
import { Discord as r } from "../components/icons/discord.js";
|
|
5
|
+
import { Dropbox as i } from "../components/icons/dropbox.js";
|
|
6
|
+
import { Facebook as a } from "../components/icons/facebook.js";
|
|
7
|
+
import { Figma as o } from "../components/icons/figma.js";
|
|
8
|
+
import { GitHub as s } from "../components/icons/github.js";
|
|
9
|
+
import { GitLab as c } from "../components/icons/gitlab.js";
|
|
10
|
+
import { Google as l } from "../components/icons/google.js";
|
|
11
|
+
import { HuggingFace as u } from "../components/icons/huggingface.js";
|
|
12
|
+
import { Kakao as d } from "../components/icons/kakao.js";
|
|
13
|
+
import { Kick as f } from "../components/icons/kick.js";
|
|
14
|
+
import { Line as p } from "../components/icons/line.js";
|
|
15
|
+
import { Linear as m } from "../components/icons/linear.js";
|
|
16
|
+
import { LinkedIn as h } from "../components/icons/linkedin.js";
|
|
17
|
+
import { Microsoft as g } from "../components/icons/microsoft.js";
|
|
18
|
+
import { Naver as _ } from "../components/icons/naver.js";
|
|
19
|
+
import { Notion as v } from "../components/icons/notion.js";
|
|
20
|
+
import { Paybin as y } from "../components/icons/paybin.js";
|
|
21
|
+
import { PayPal as b } from "../components/icons/paypal.js";
|
|
22
|
+
import { Polar as x } from "../components/icons/polar.js";
|
|
23
|
+
import { Railway as S } from "../components/icons/railway.js";
|
|
24
|
+
import { Reddit as C } from "../components/icons/reddit.js";
|
|
25
|
+
import { Roblox as w } from "../components/icons/roblox.js";
|
|
26
|
+
import { Salesforce as T } from "../components/icons/salesforce.js";
|
|
27
|
+
import { Slack as E } from "../components/icons/slack.js";
|
|
28
|
+
import { Spotify as D } from "../components/icons/spotify.js";
|
|
29
|
+
import { TikTok as O } from "../components/icons/tiktok.js";
|
|
30
|
+
import { Twitch as k } from "../components/icons/twitch.js";
|
|
31
|
+
import { Vercel as A } from "../components/icons/vercel.js";
|
|
32
|
+
import { VK as j } from "../components/icons/vk.js";
|
|
33
|
+
import { WeChat as M } from "../components/icons/wechat.js";
|
|
34
|
+
import { X as N } from "../components/icons/x.js";
|
|
35
|
+
import { Zoom as P } from "../components/icons/zoom.js";
|
|
36
|
+
import "../components/icons/index.js";
|
|
37
|
+
//#region src/lib/provider-icons.ts
|
|
38
|
+
var F = {
|
|
39
|
+
apple: e,
|
|
40
|
+
atlassian: t,
|
|
41
|
+
cognito: n,
|
|
42
|
+
discord: r,
|
|
43
|
+
dropbox: i,
|
|
44
|
+
facebook: a,
|
|
45
|
+
figma: o,
|
|
46
|
+
github: s,
|
|
47
|
+
gitlab: c,
|
|
48
|
+
google: l,
|
|
49
|
+
huggingface: u,
|
|
50
|
+
kakao: d,
|
|
51
|
+
kick: f,
|
|
52
|
+
line: p,
|
|
53
|
+
linear: m,
|
|
54
|
+
linkedin: h,
|
|
55
|
+
microsoft: g,
|
|
56
|
+
naver: _,
|
|
57
|
+
notion: v,
|
|
58
|
+
paybin: y,
|
|
59
|
+
paypal: b,
|
|
60
|
+
polar: x,
|
|
61
|
+
railway: S,
|
|
62
|
+
reddit: C,
|
|
63
|
+
roblox: w,
|
|
64
|
+
salesforce: T,
|
|
65
|
+
slack: E,
|
|
66
|
+
spotify: D,
|
|
67
|
+
tiktok: O,
|
|
68
|
+
twitch: k,
|
|
69
|
+
twitter: N,
|
|
70
|
+
vercel: A,
|
|
71
|
+
vk: j,
|
|
72
|
+
wechat: M,
|
|
73
|
+
zoom: P
|
|
48
74
|
};
|
|
75
|
+
//#endregion
|
|
76
|
+
export { F as providerIcons };
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClassValue } from 'clsx';
|
|
2
2
|
export declare function cn(...inputs: ClassValue[]): string;
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { clsx } from "clsx";
|
|
2
|
-
import { twMerge } from "tailwind-merge";
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { clsx as e } from "clsx";
|
|
2
|
+
import { twMerge as t } from "tailwind-merge";
|
|
3
|
+
//#region src/lib/utils.ts
|
|
4
|
+
function n(...n) {
|
|
5
|
+
return t(e(n));
|
|
5
6
|
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { n as cn };
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth-ui/react",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "
|
|
6
|
+
"build": "vite build",
|
|
7
7
|
"dev": "tsc --watch",
|
|
8
8
|
"email": "email dev --dir src/components/email -p 9000",
|
|
9
9
|
"test": "vitest"
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
|
-
"
|
|
20
|
-
"
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
21
|
},
|
|
22
22
|
"./core": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
23
|
+
"types": "./dist/core.d.ts",
|
|
24
|
+
"import": "./dist/core.js"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
@@ -33,12 +33,13 @@
|
|
|
33
33
|
"@types/react": "^19.2.14",
|
|
34
34
|
"@vitejs/plugin-react": "^6.0.1",
|
|
35
35
|
"@vitest/browser-playwright": "^4.1.4",
|
|
36
|
-
"better-auth": "^1.6.
|
|
36
|
+
"@better-auth/passkey": "^1.6.5",
|
|
37
|
+
"better-auth": "^1.6.5",
|
|
37
38
|
"clsx": "^2.1.1",
|
|
38
39
|
"playwright": "^1.59.1",
|
|
39
40
|
"react": "^19.2.5",
|
|
40
41
|
"react-dom": "^19.2.5",
|
|
41
|
-
"react-email": "^
|
|
42
|
+
"react-email": "^6.0.0",
|
|
42
43
|
"tailwind-merge": "^3.5.0",
|
|
43
44
|
"tailwindcss": "^4.2.2",
|
|
44
45
|
"vitest": "^4.1.4",
|
|
@@ -50,7 +51,8 @@
|
|
|
50
51
|
"peerDependencies": {
|
|
51
52
|
"@react-email/components": ">=1.0.12",
|
|
52
53
|
"@tanstack/react-query": ">=5.99.0",
|
|
53
|
-
"better-auth": ">=1.6.
|
|
54
|
+
"@better-auth/passkey": ">=1.6.5",
|
|
55
|
+
"better-auth": ">=1.6.5",
|
|
54
56
|
"clsx": ">=2.0.0",
|
|
55
57
|
"react": ">=19.2.5",
|
|
56
58
|
"react-dom": ">=19.2.5",
|
|
@@ -58,6 +60,11 @@
|
|
|
58
60
|
"tailwindcss": ">=4.2.2",
|
|
59
61
|
"zod": ">=4.3.0"
|
|
60
62
|
},
|
|
63
|
+
"repository": {
|
|
64
|
+
"type": "git",
|
|
65
|
+
"url": "https://github.com/better-auth-ui/better-auth-ui",
|
|
66
|
+
"directory": "packages/react"
|
|
67
|
+
},
|
|
61
68
|
"publishConfig": {
|
|
62
69
|
"access": "public"
|
|
63
70
|
}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import { deepmerge, defaultAuthConfig } from "@better-auth-ui/core"
|
|
4
|
-
import {
|
|
5
|
-
type AnyAuthClient,
|
|
6
|
-
type AnyAuthConfig,
|
|
7
|
-
type AuthConfig,
|
|
8
|
-
AuthContext
|
|
9
|
-
} from "@better-auth-ui/react"
|
|
10
4
|
import {
|
|
11
5
|
QueryClient,
|
|
12
6
|
QueryClientContext,
|
|
@@ -14,6 +8,10 @@ import {
|
|
|
14
8
|
} from "@tanstack/react-query"
|
|
15
9
|
import { type PropsWithChildren, useContext } from "react"
|
|
16
10
|
|
|
11
|
+
import type { AnyAuthClient } from "../../lib/auth-client"
|
|
12
|
+
import type { AnyAuthConfig, AuthConfig } from "../../lib/auth-config"
|
|
13
|
+
import { AuthContext } from "../../lib/auth-context"
|
|
14
|
+
|
|
17
15
|
const fallbackQueryClient = new QueryClient()
|
|
18
16
|
|
|
19
17
|
const baseAuthConfig: AnyAuthConfig = {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { type AuthClient, useAuth } from "@better-auth-ui/react"
|
|
2
1
|
import { useEffect } from "react"
|
|
2
|
+
|
|
3
|
+
import { useAuth } from "../../components/auth/auth-provider"
|
|
4
|
+
import type { AuthClient } from "../../lib/auth-client"
|
|
3
5
|
import type { UseAuthQueryOptions, UseAuthQueryResult } from "./use-auth-query"
|
|
4
6
|
import { useSession } from "./use-session"
|
|
5
7
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useAuth } from "../../components/auth/auth-provider"
|
|
2
|
+
import type { AuthClient } from "../../lib/auth-client"
|
|
3
|
+
import {
|
|
4
|
+
type UseAuthMutationOptions,
|
|
5
|
+
useAuthMutation
|
|
6
|
+
} from "./use-auth-mutation"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Hook that creates a mutation to check if a username is available.
|
|
10
|
+
*
|
|
11
|
+
* @returns The `useMutation` result where data contains `{ available: boolean }`.
|
|
12
|
+
*/
|
|
13
|
+
export function useIsUsernameAvailable(
|
|
14
|
+
options?: UseAuthMutationOptions<AuthClient["isUsernameAvailable"]>
|
|
15
|
+
) {
|
|
16
|
+
const { authClient } = useAuth()
|
|
17
|
+
|
|
18
|
+
return useAuthMutation({
|
|
19
|
+
authFn: authClient.isUsernameAvailable,
|
|
20
|
+
options
|
|
21
|
+
})
|
|
22
|
+
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
import { useAuth } from "../../components/auth/auth-provider"
|
|
2
|
+
import type { AuthClient } from "../../lib/auth-client"
|
|
1
3
|
import {
|
|
2
|
-
type
|
|
3
|
-
useAuth,
|
|
4
|
+
type UseAuthMutationOptions,
|
|
4
5
|
useAuthMutation
|
|
5
|
-
} from "
|
|
6
|
-
import type { UseAuthMutationOptions } from "./use-auth-mutation"
|
|
7
|
-
|
|
8
|
-
export { useAuthMutation } from "./use-auth-mutation"
|
|
6
|
+
} from "./use-auth-mutation"
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* Hook that creates a mutation for the forgot-password flow.
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
import { useAuth } from "../../components/auth/auth-provider"
|
|
2
|
+
import type { AuthClient } from "../../lib/auth-client"
|
|
1
3
|
import {
|
|
2
|
-
type
|
|
3
|
-
useAuth,
|
|
4
|
+
type UseAuthMutationOptions,
|
|
4
5
|
useAuthMutation
|
|
5
|
-
} from "
|
|
6
|
-
import type { UseAuthMutationOptions } from "./use-auth-mutation"
|
|
7
|
-
|
|
8
|
-
export { useAuthMutation } from "./use-auth-mutation"
|
|
6
|
+
} from "./use-auth-mutation"
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* Hook that creates a mutation for the reset-password flow.
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
import { useAuth } from "../../components/auth/auth-provider"
|
|
2
|
+
import type { AuthClient } from "../../lib/auth-client"
|
|
1
3
|
import {
|
|
2
|
-
type
|
|
3
|
-
useAuth,
|
|
4
|
+
type UseAuthMutationOptions,
|
|
4
5
|
useAuthMutation
|
|
5
|
-
} from "
|
|
6
|
-
import type { UseAuthMutationOptions } from "./use-auth-mutation"
|
|
7
|
-
|
|
8
|
-
export { useAuthMutation } from "./use-auth-mutation"
|
|
6
|
+
} from "./use-auth-mutation"
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* Hook that creates a mutation to send a verification email.
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type AuthClient,
|
|
3
|
-
useAuth,
|
|
4
|
-
useAuthMutation,
|
|
5
|
-
useSession
|
|
6
|
-
} from "@better-auth-ui/react"
|
|
7
|
-
import type { UseAuthMutationOptions } from "./use-auth-mutation"
|
|
1
|
+
import { useQueryClient } from "@tanstack/react-query"
|
|
8
2
|
|
|
9
|
-
|
|
3
|
+
import { useAuth } from "../../components/auth/auth-provider"
|
|
4
|
+
import type { AuthClient } from "../../lib/auth-client"
|
|
5
|
+
import {
|
|
6
|
+
type UseAuthMutationOptions,
|
|
7
|
+
useAuthMutation
|
|
8
|
+
} from "./use-auth-mutation"
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Hook that creates a mutation for email/password sign-in.
|
|
@@ -20,14 +19,14 @@ export function useSignInEmail(
|
|
|
20
19
|
options?: UseAuthMutationOptions<AuthClient["signIn"]["email"]>
|
|
21
20
|
) {
|
|
22
21
|
const { authClient } = useAuth()
|
|
23
|
-
const
|
|
22
|
+
const queryClient = useQueryClient()
|
|
24
23
|
|
|
25
24
|
return useAuthMutation({
|
|
26
25
|
authFn: authClient.signIn.email,
|
|
27
26
|
options: {
|
|
28
27
|
...options,
|
|
29
28
|
onSuccess: async (...args) => {
|
|
30
|
-
|
|
29
|
+
queryClient.resetQueries({ queryKey: ["auth", "getSession"] })
|
|
31
30
|
await options?.onSuccess?.(...args)
|
|
32
31
|
}
|
|
33
32
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
import { useAuth } from "../../components/auth/auth-provider"
|
|
2
|
+
import type { AuthClient } from "../../lib/auth-client"
|
|
1
3
|
import {
|
|
2
|
-
type
|
|
3
|
-
useAuth,
|
|
4
|
+
type UseAuthMutationOptions,
|
|
4
5
|
useAuthMutation
|
|
5
|
-
} from "
|
|
6
|
-
import type { UseAuthMutationOptions } from "./use-auth-mutation"
|
|
7
|
-
|
|
8
|
-
export { useAuthMutation } from "./use-auth-mutation"
|
|
6
|
+
} from "./use-auth-mutation"
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* Hook that creates a mutation for magic-link sign-in.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useQueryClient } from "@tanstack/react-query"
|
|
2
|
+
|
|
3
|
+
import { useAuth } from "../../components/auth/auth-provider"
|
|
4
|
+
import type { AuthClient } from "../../lib/auth-client"
|
|
5
|
+
import {
|
|
6
|
+
type UseAuthMutationOptions,
|
|
7
|
+
useAuthMutation
|
|
8
|
+
} from "./use-auth-mutation"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Hook that creates a mutation for passkey sign-in.
|
|
12
|
+
*
|
|
13
|
+
* The mutation sends a passkey sign-in request and
|
|
14
|
+
* refetches the session on completion.
|
|
15
|
+
*
|
|
16
|
+
* @returns The `useMutation` result.
|
|
17
|
+
*/
|
|
18
|
+
export function useSignInPasskey(
|
|
19
|
+
options?: UseAuthMutationOptions<AuthClient["signIn"]["passkey"]>
|
|
20
|
+
) {
|
|
21
|
+
const { authClient } = useAuth()
|
|
22
|
+
const queryClient = useQueryClient()
|
|
23
|
+
|
|
24
|
+
return useAuthMutation({
|
|
25
|
+
authFn: authClient.signIn.passkey,
|
|
26
|
+
options: {
|
|
27
|
+
...options,
|
|
28
|
+
onSuccess: async (...args) => {
|
|
29
|
+
queryClient.resetQueries({ queryKey: ["auth", "getSession"] })
|
|
30
|
+
await options?.onSuccess?.(...args)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
import { useAuth } from "../../components/auth/auth-provider"
|
|
2
|
+
import type { AuthClient } from "../../lib/auth-client"
|
|
1
3
|
import {
|
|
2
|
-
type
|
|
3
|
-
useAuth,
|
|
4
|
+
type UseAuthMutationOptions,
|
|
4
5
|
useAuthMutation
|
|
5
|
-
} from "
|
|
6
|
-
import type { UseAuthMutationOptions } from "./use-auth-mutation"
|
|
7
|
-
|
|
8
|
-
export { useAuthMutation } from "./use-auth-mutation"
|
|
6
|
+
} from "./use-auth-mutation"
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* Hook that creates a mutation for social sign-in.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useQueryClient } from "@tanstack/react-query"
|
|
2
|
+
|
|
3
|
+
import { useAuth } from "../../components/auth/auth-provider"
|
|
4
|
+
import type { AuthClient } from "../../lib/auth-client"
|
|
5
|
+
import {
|
|
6
|
+
type UseAuthMutationOptions,
|
|
7
|
+
useAuthMutation
|
|
8
|
+
} from "./use-auth-mutation"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Hook that creates a mutation for username/password sign-in.
|
|
12
|
+
*
|
|
13
|
+
* The mutation sends a username/password sign-in request and
|
|
14
|
+
* refetches the session on completion.
|
|
15
|
+
*
|
|
16
|
+
* @returns The `useMutation` result.
|
|
17
|
+
*/
|
|
18
|
+
export function useSignInUsername(
|
|
19
|
+
options?: UseAuthMutationOptions<AuthClient["signIn"]["username"]>
|
|
20
|
+
) {
|
|
21
|
+
const { authClient } = useAuth()
|
|
22
|
+
const queryClient = useQueryClient()
|
|
23
|
+
|
|
24
|
+
return useAuthMutation({
|
|
25
|
+
authFn: authClient.signIn.username,
|
|
26
|
+
options: {
|
|
27
|
+
...options,
|
|
28
|
+
onSuccess: async (...args) => {
|
|
29
|
+
queryClient.resetQueries({ queryKey: ["auth", "getSession"] })
|
|
30
|
+
await options?.onSuccess?.(...args)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type AuthClient,
|
|
3
|
-
useAuth,
|
|
4
|
-
useAuthMutation
|
|
5
|
-
} from "@better-auth-ui/react"
|
|
6
1
|
import { useQueryClient } from "@tanstack/react-query"
|
|
7
|
-
import type { UseAuthMutationOptions } from "./use-auth-mutation"
|
|
8
2
|
|
|
9
|
-
|
|
3
|
+
import { useAuth } from "../../components/auth/auth-provider"
|
|
4
|
+
import type { AuthClient } from "../../lib/auth-client"
|
|
5
|
+
import {
|
|
6
|
+
type UseAuthMutationOptions,
|
|
7
|
+
useAuthMutation
|
|
8
|
+
} from "./use-auth-mutation"
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Hook that creates a mutation for signing out.
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type AuthClient,
|
|
3
|
-
useAuth,
|
|
4
|
-
useAuthMutation,
|
|
5
|
-
useSession
|
|
6
|
-
} from "@better-auth-ui/react"
|
|
7
|
-
import type { UseAuthMutationOptions } from "./use-auth-mutation"
|
|
1
|
+
import { useQueryClient } from "@tanstack/react-query"
|
|
8
2
|
|
|
9
|
-
|
|
3
|
+
import { useAuth } from "../../components/auth/auth-provider"
|
|
4
|
+
import type { AuthClient } from "../../lib/auth-client"
|
|
5
|
+
import {
|
|
6
|
+
type UseAuthMutationOptions,
|
|
7
|
+
useAuthMutation
|
|
8
|
+
} from "./use-auth-mutation"
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Hook that creates a mutation for email/password sign-up.
|
|
@@ -20,14 +19,14 @@ export function useSignUpEmail(
|
|
|
20
19
|
options?: UseAuthMutationOptions<AuthClient["signUp"]["email"]>
|
|
21
20
|
) {
|
|
22
21
|
const { authClient } = useAuth()
|
|
23
|
-
const
|
|
22
|
+
const queryClient = useQueryClient()
|
|
24
23
|
|
|
25
24
|
return useAuthMutation({
|
|
26
25
|
authFn: authClient.signUp.email,
|
|
27
26
|
options: {
|
|
28
27
|
...options,
|
|
29
28
|
onSuccess: async (...args) => {
|
|
30
|
-
|
|
29
|
+
queryClient.resetQueries({ queryKey: ["auth", "getSession"] })
|
|
31
30
|
await options?.onSuccess?.(...args)
|
|
32
31
|
}
|
|
33
32
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useAuth } from "../../components/auth/auth-provider"
|
|
2
|
+
import type { AuthClient } from "../../lib/auth-client"
|
|
2
3
|
import { type UseAuthQueryOptions, useAuthQuery } from "../auth/use-auth-query"
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useAuth } from "../../components/auth/auth-provider"
|
|
2
|
+
import type { AuthClient } from "../../lib/auth-client"
|
|
3
|
+
import {
|
|
4
|
+
type UseAuthMutationOptions,
|
|
5
|
+
useAuthMutation
|
|
6
|
+
} from "../auth/use-auth-mutation"
|
|
7
|
+
import { useListUserPasskeys } from "./use-list-user-passkeys"
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Hook that creates a mutation for adding a new passkey.
|
|
11
|
+
*
|
|
12
|
+
* Refetches the passkeys list on success.
|
|
13
|
+
*
|
|
14
|
+
* @returns The `useMutation` result.
|
|
15
|
+
*/
|
|
16
|
+
export function useAddPasskey(
|
|
17
|
+
options?: UseAuthMutationOptions<AuthClient["passkey"]["addPasskey"]>
|
|
18
|
+
) {
|
|
19
|
+
const { authClient } = useAuth()
|
|
20
|
+
const { refetch } = useListUserPasskeys()
|
|
21
|
+
|
|
22
|
+
return useAuthMutation({
|
|
23
|
+
authFn: authClient.passkey.addPasskey,
|
|
24
|
+
options: {
|
|
25
|
+
...options,
|
|
26
|
+
onSuccess: async (...args) => {
|
|
27
|
+
await refetch()
|
|
28
|
+
await options?.onSuccess?.(...args)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { useAuth } from "../../components/auth/auth-provider"
|
|
2
|
+
import type { AuthClient } from "../../lib/auth-client"
|
|
1
3
|
import {
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "@better-auth-ui/react"
|
|
7
|
-
import type { UseAuthMutationOptions } from "../auth/use-auth-mutation"
|
|
4
|
+
type UseAuthMutationOptions,
|
|
5
|
+
useAuthMutation
|
|
6
|
+
} from "../auth/use-auth-mutation"
|
|
7
|
+
import { useSession } from "../auth/use-session"
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Hook that creates a mutation for changing the current user's email address.
|