@better-auth-ui/react 1.6.2 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/auth/use-authenticate.d.ts +30 -6
- package/dist/hooks/auth/use-is-username-available.d.ts +12 -11
- package/dist/hooks/auth/use-is-username-available.js +8 -7
- package/dist/hooks/auth/use-request-password-reset.d.ts +11 -15
- package/dist/hooks/auth/use-request-password-reset.js +8 -7
- package/dist/hooks/auth/use-reset-password.d.ts +13 -29
- package/dist/hooks/auth/use-reset-password.js +8 -7
- package/dist/hooks/auth/use-send-verification-email.d.ts +10 -14
- package/dist/hooks/auth/use-send-verification-email.js +8 -7
- package/dist/hooks/auth/use-session.d.ts +30 -4
- package/dist/hooks/auth/use-session.js +11 -10
- package/dist/hooks/auth/use-sign-in-email.d.ts +11 -37
- package/dist/hooks/auth/use-sign-in-email.js +11 -12
- package/dist/hooks/auth/use-sign-in-magic-link.d.ts +14 -18
- package/dist/hooks/auth/use-sign-in-magic-link.js +8 -7
- package/dist/hooks/auth/use-sign-in-passkey.d.ts +10 -47
- package/dist/hooks/auth/use-sign-in-passkey.js +11 -12
- package/dist/hooks/auth/use-sign-in-social.d.ts +30 -59
- package/dist/hooks/auth/use-sign-in-social.js +8 -7
- package/dist/hooks/auth/use-sign-in-username.d.ts +12 -40
- package/dist/hooks/auth/use-sign-in-username.js +11 -12
- package/dist/hooks/auth/use-sign-out.d.ts +10 -10
- package/dist/hooks/auth/use-sign-out.js +10 -12
- package/dist/hooks/auth/use-sign-up-email.d.ts +18 -101
- package/dist/hooks/auth/use-sign-up-email.js +11 -12
- package/dist/hooks/auth/use-user.d.ts +7 -5
- package/dist/hooks/settings/use-account-info.d.ts +9 -9
- package/dist/hooks/settings/use-account-info.js +13 -16
- package/dist/hooks/settings/use-add-passkey.d.ts +8 -30
- package/dist/hooks/settings/use-add-passkey.js +10 -11
- package/dist/hooks/settings/use-change-email.d.ts +11 -14
- package/dist/hooks/settings/use-change-email.js +11 -12
- package/dist/hooks/settings/use-change-password.d.ts +11 -43
- package/dist/hooks/settings/use-change-password.js +8 -7
- package/dist/hooks/settings/use-delete-passkey.d.ts +10 -12
- package/dist/hooks/settings/use-delete-passkey.js +11 -12
- package/dist/hooks/settings/use-delete-user.d.ts +13 -30
- package/dist/hooks/settings/use-delete-user.js +8 -7
- package/dist/hooks/settings/use-link-social.d.ts +22 -25
- package/dist/hooks/settings/use-link-social.js +8 -7
- package/dist/hooks/settings/use-list-accounts.d.ts +8 -6
- package/dist/hooks/settings/use-list-accounts.js +10 -16
- package/dist/hooks/settings/use-list-device-sessions.d.ts +29 -6
- package/dist/hooks/settings/use-list-device-sessions.js +10 -16
- package/dist/hooks/settings/use-list-sessions.d.ts +8 -5
- package/dist/hooks/settings/use-list-sessions.js +10 -16
- package/dist/hooks/settings/use-list-user-passkeys.d.ts +8 -5
- package/dist/hooks/settings/use-list-user-passkeys.js +10 -16
- package/dist/hooks/settings/use-revoke-multi-session.d.ts +11 -11
- package/dist/hooks/settings/use-revoke-multi-session.js +11 -12
- package/dist/hooks/settings/use-revoke-session.d.ts +11 -11
- package/dist/hooks/settings/use-revoke-session.js +11 -12
- package/dist/hooks/settings/use-set-active-session.d.ts +12 -29
- package/dist/hooks/settings/use-set-active-session.js +12 -13
- package/dist/hooks/settings/use-unlink-account.d.ts +12 -12
- package/dist/hooks/settings/use-unlink-account.js +11 -12
- package/dist/hooks/settings/use-update-user.d.ts +1178 -4
- package/dist/hooks/settings/use-update-user.js +17 -18
- package/dist/hooks/use-auth-mutation.d.ts +12 -0
- package/dist/hooks/use-auth-mutation.js +11 -0
- package/dist/hooks/use-auth-query.d.ts +14 -0
- package/dist/hooks/use-auth-query.js +15 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +33 -33
- package/dist/mutations/auth/is-username-available-options.d.ts +19 -0
- package/dist/mutations/auth/is-username-available-options.js +7 -0
- package/dist/mutations/auth/request-password-reset-options.d.ts +15 -0
- package/dist/mutations/auth/request-password-reset-options.js +7 -0
- package/dist/mutations/auth/reset-password-options.d.ts +17 -0
- package/dist/mutations/auth/reset-password-options.js +7 -0
- package/dist/mutations/auth/send-verification-email-options.d.ts +15 -0
- package/dist/mutations/auth/send-verification-email-options.js +7 -0
- package/dist/mutations/auth/sign-in-email-options.d.ts +23 -0
- package/dist/mutations/auth/sign-in-email-options.js +11 -0
- package/dist/mutations/auth/sign-in-magic-link-options.d.ts +23 -0
- package/dist/mutations/auth/sign-in-magic-link-options.js +11 -0
- package/dist/mutations/auth/sign-in-passkey-options.d.ts +15 -0
- package/dist/mutations/auth/sign-in-passkey-options.js +11 -0
- package/dist/mutations/auth/sign-in-social-options.d.ts +61 -0
- package/dist/mutations/auth/sign-in-social-options.js +11 -0
- package/dist/mutations/auth/sign-in-username-options.d.ts +19 -0
- package/dist/mutations/auth/sign-in-username-options.js +11 -0
- package/dist/mutations/auth/sign-out-options.d.ts +12 -0
- package/dist/mutations/auth/sign-out-options.js +7 -0
- package/dist/mutations/auth/sign-up-email-options.d.ts +1180 -0
- package/dist/mutations/auth/sign-up-email-options.js +11 -0
- package/dist/mutations/auth-mutation-options.d.ts +25 -0
- package/dist/mutations/auth-mutation-options.js +19 -0
- package/dist/mutations/settings/add-passkey-options.d.ts +15 -0
- package/dist/mutations/settings/add-passkey-options.js +11 -0
- package/dist/mutations/settings/change-email-options.d.ts +15 -0
- package/dist/mutations/settings/change-email-options.js +7 -0
- package/dist/mutations/settings/change-password-options.d.ts +17 -0
- package/dist/mutations/settings/change-password-options.js +7 -0
- package/dist/mutations/settings/delete-passkey-options.d.ts +13 -0
- package/dist/mutations/settings/delete-passkey-options.js +11 -0
- package/dist/mutations/settings/delete-user-options.d.ts +20 -0
- package/dist/mutations/settings/delete-user-options.js +7 -0
- package/dist/mutations/settings/link-social-options.d.ts +39 -0
- package/dist/mutations/settings/link-social-options.js +7 -0
- package/dist/mutations/settings/revoke-multi-session-options.d.ts +13 -0
- package/dist/mutations/settings/revoke-multi-session-options.js +11 -0
- package/dist/mutations/settings/revoke-session-options.d.ts +13 -0
- package/dist/mutations/settings/revoke-session-options.js +7 -0
- package/dist/mutations/settings/set-active-session-options.d.ts +13 -0
- package/dist/mutations/settings/set-active-session-options.js +11 -0
- package/dist/mutations/settings/unlink-account-options.d.ts +15 -0
- package/dist/mutations/settings/unlink-account-options.js +7 -0
- package/dist/mutations/settings/update-user-options.d.ts +1182 -0
- package/dist/mutations/settings/update-user-options.js +7 -0
- package/dist/queries/auth/session-options.d.ts +110 -0
- package/dist/queries/auth/session-options.js +7 -0
- package/dist/queries/auth-query-options.d.ts +29 -0
- package/dist/queries/auth-query-options.js +17 -0
- package/dist/queries/settings/account-info-options.d.ts +32 -0
- package/dist/queries/settings/account-info-options.js +12 -0
- package/dist/queries/settings/list-accounts-options.d.ts +53 -0
- package/dist/queries/settings/list-accounts-options.js +12 -0
- package/dist/queries/settings/list-device-sessions-options.d.ts +99 -0
- package/dist/queries/settings/list-device-sessions-options.js +12 -0
- package/dist/queries/settings/list-sessions-options.d.ts +54 -0
- package/dist/queries/settings/list-sessions-options.js +12 -0
- package/dist/queries/settings/list-user-passkeys-options.d.ts +18 -0
- package/dist/queries/settings/list-user-passkeys-options.js +12 -0
- package/package.json +1 -1
- package/src/hooks/auth/use-authenticate.ts +7 -10
- package/src/hooks/auth/use-is-username-available.ts +17 -8
- package/src/hooks/auth/use-request-password-reset.ts +19 -8
- package/src/hooks/auth/use-reset-password.ts +19 -9
- package/src/hooks/auth/use-send-verification-email.ts +18 -8
- package/src/hooks/auth/use-session.ts +20 -16
- package/src/hooks/auth/use-sign-in-email.ts +23 -16
- package/src/hooks/auth/use-sign-in-magic-link.ts +18 -10
- package/src/hooks/auth/use-sign-in-passkey.ts +24 -18
- package/src/hooks/auth/use-sign-in-social.ts +18 -8
- package/src/hooks/auth/use-sign-in-username.ts +24 -18
- package/src/hooks/auth/use-sign-out.ts +18 -17
- package/src/hooks/auth/use-sign-up-email.ts +24 -18
- package/src/hooks/auth/use-user.ts +7 -8
- package/src/hooks/settings/use-account-info.ts +29 -20
- package/src/hooks/settings/use-add-passkey.ts +22 -17
- package/src/hooks/settings/use-change-email.ts +21 -17
- package/src/hooks/settings/use-change-password.ts +18 -8
- package/src/hooks/settings/use-delete-passkey.ts +21 -16
- package/src/hooks/settings/use-delete-user.ts +18 -8
- package/src/hooks/settings/use-link-social.ts +18 -8
- package/src/hooks/settings/use-list-accounts.ts +25 -15
- package/src/hooks/settings/use-list-device-sessions.ts +26 -21
- package/src/hooks/settings/use-list-sessions.ts +25 -14
- package/src/hooks/settings/use-list-user-passkeys.ts +25 -16
- package/src/hooks/settings/use-revoke-multi-session.ts +25 -16
- package/src/hooks/settings/use-revoke-session.ts +25 -16
- package/src/hooks/settings/use-set-active-session.ts +35 -24
- package/src/hooks/settings/use-unlink-account.ts +22 -15
- package/src/hooks/settings/use-update-user.ts +29 -22
- package/src/hooks/use-auth-mutation.ts +29 -0
- package/src/hooks/use-auth-query.ts +36 -0
- package/src/index.ts +2 -2
- package/src/mutations/auth/is-username-available-options.ts +18 -0
- package/src/mutations/auth/request-password-reset-options.ts +14 -0
- package/src/mutations/auth/reset-password-options.ts +14 -0
- package/src/mutations/auth/send-verification-email-options.ts +14 -0
- package/src/mutations/auth/sign-in-email-options.ts +19 -0
- package/src/mutations/auth/sign-in-magic-link-options.ts +15 -0
- package/src/mutations/auth/sign-in-passkey-options.ts +15 -0
- package/src/mutations/auth/sign-in-social-options.ts +19 -0
- package/src/mutations/auth/sign-in-username-options.ts +15 -0
- package/src/mutations/auth/sign-out-options.ts +11 -0
- package/src/mutations/auth/sign-up-email-options.ts +15 -0
- package/src/mutations/auth-mutation-options.ts +49 -0
- package/src/mutations/settings/add-passkey-options.ts +15 -0
- package/src/mutations/settings/change-email-options.ts +11 -0
- package/src/mutations/settings/change-password-options.ts +14 -0
- package/src/mutations/settings/delete-passkey-options.ts +15 -0
- package/src/mutations/settings/delete-user-options.ts +11 -0
- package/src/mutations/settings/link-social-options.ts +11 -0
- package/src/mutations/settings/revoke-multi-session-options.ts +15 -0
- package/src/mutations/settings/revoke-session-options.ts +14 -0
- package/src/mutations/settings/set-active-session-options.ts +15 -0
- package/src/mutations/settings/unlink-account-options.ts +14 -0
- package/src/mutations/settings/update-user-options.ts +15 -0
- package/src/queries/auth/session-options.ts +18 -0
- package/src/queries/auth-query-options.ts +34 -0
- package/src/queries/settings/account-info-options.ts +25 -0
- package/src/queries/settings/list-accounts-options.ts +26 -0
- package/src/queries/settings/list-device-sessions-options.ts +24 -0
- package/src/queries/settings/list-sessions-options.ts +23 -0
- package/src/queries/settings/list-user-passkeys-options.ts +23 -0
- package/dist/hooks/auth/use-auth-mutation.d.ts +0 -18
- package/dist/hooks/auth/use-auth-mutation.js +0 -13
- package/dist/hooks/auth/use-auth-query.d.ts +0 -24
- package/dist/hooks/auth/use-auth-query.js +0 -13
- package/src/hooks/auth/use-auth-mutation.ts +0 -56
- package/src/hooks/auth/use-auth-query.ts +0 -50
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { signInSocialOptions } from '../../mutations/auth/sign-in-social-options';
|
|
3
|
+
export type UseSignInSocialParams = NonNullable<Parameters<AuthClient["signIn"]["social"]>[0]>;
|
|
4
|
+
export type UseSignInSocialOptions = Omit<ReturnType<typeof signInSocialOptions>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
6
|
* Hook that creates a mutation for social sign-in.
|
|
5
7
|
*
|
|
6
8
|
* The mutation initiates a social sign-in flow with the specified provider.
|
|
7
9
|
*
|
|
10
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
8
11
|
* @returns The `useMutation` result.
|
|
9
12
|
*/
|
|
10
|
-
export declare function useSignInSocial(options?:
|
|
13
|
+
export declare function useSignInSocial(options?: UseSignInSocialOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
11
14
|
provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
|
|
12
15
|
callbackURL?: string | undefined;
|
|
13
16
|
newUserCallbackURL?: string | undefined;
|
|
@@ -31,62 +34,30 @@ export declare function useSignInSocial(options?: UseAuthMutationOptions<AuthCli
|
|
|
31
34
|
requestSignUp?: boolean | undefined;
|
|
32
35
|
loginHint?: string | undefined;
|
|
33
36
|
additionalData?: Record<string, any> | undefined;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
} & {
|
|
38
|
+
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
39
|
+
provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
|
|
40
|
+
callbackURL?: string | undefined;
|
|
41
|
+
newUserCallbackURL?: string | undefined;
|
|
42
|
+
errorCallbackURL?: string | undefined;
|
|
43
|
+
disableRedirect?: boolean | undefined;
|
|
44
|
+
idToken?: {
|
|
45
|
+
token: string;
|
|
46
|
+
nonce?: string | undefined;
|
|
47
|
+
accessToken?: string | undefined;
|
|
48
|
+
refreshToken?: string | undefined;
|
|
49
|
+
expiresAt?: number | undefined;
|
|
50
|
+
user?: {
|
|
51
|
+
name?: {
|
|
52
|
+
firstName?: string | undefined;
|
|
53
|
+
lastName?: string | undefined;
|
|
54
|
+
} | undefined;
|
|
55
|
+
email?: string | undefined;
|
|
50
56
|
} | undefined;
|
|
51
|
-
email?: string | undefined;
|
|
52
57
|
} | undefined;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
fetchOptions?: FetchOptions | undefined;
|
|
60
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<{
|
|
61
|
-
redirect: boolean;
|
|
62
|
-
url: string;
|
|
63
|
-
} | (Omit<{
|
|
64
|
-
redirect: boolean;
|
|
65
|
-
token: string;
|
|
66
|
-
url: undefined;
|
|
67
|
-
user: {
|
|
68
|
-
id: string;
|
|
69
|
-
createdAt: Date;
|
|
70
|
-
updatedAt: Date;
|
|
71
|
-
email: string;
|
|
72
|
-
emailVerified: boolean;
|
|
73
|
-
name: string;
|
|
74
|
-
image?: string | null | undefined | undefined;
|
|
75
|
-
};
|
|
76
|
-
}, "user"> & {
|
|
77
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
78
|
-
id: string;
|
|
79
|
-
createdAt: Date;
|
|
80
|
-
updatedAt: Date;
|
|
81
|
-
email: string;
|
|
82
|
-
emailVerified: boolean;
|
|
83
|
-
name: string;
|
|
84
|
-
image?: string | null | undefined;
|
|
85
|
-
} & {} & {
|
|
86
|
-
username?: string | null | undefined;
|
|
87
|
-
displayUsername?: string | null | undefined;
|
|
88
|
-
}>;
|
|
89
|
-
}), {
|
|
90
|
-
code?: string | undefined;
|
|
91
|
-
message?: string | undefined;
|
|
92
|
-
}, FetchOptions["throw"] extends true ? true : false>>)>;
|
|
58
|
+
scopes?: string[] | undefined;
|
|
59
|
+
requestSignUp?: boolean | undefined;
|
|
60
|
+
loginHint?: string | undefined;
|
|
61
|
+
additionalData?: Record<string, any> | undefined;
|
|
62
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
63
|
+
}>, unknown>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import {
|
|
2
|
+
import { signInSocialOptions as t } from "../../mutations/auth/sign-in-social-options.js";
|
|
3
|
+
import { useMutation as n } from "@tanstack/react-query";
|
|
3
4
|
//#region src/hooks/auth/use-sign-in-social.ts
|
|
4
|
-
function
|
|
5
|
-
let { authClient:
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
function r(r) {
|
|
6
|
+
let { authClient: i } = e();
|
|
7
|
+
return n({
|
|
8
|
+
...t(i),
|
|
9
|
+
...r
|
|
9
10
|
});
|
|
10
11
|
}
|
|
11
12
|
//#endregion
|
|
12
|
-
export {
|
|
13
|
+
export { r as useSignInSocial };
|
|
@@ -1,53 +1,25 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { signInUsernameOptions } from '../../mutations/auth/sign-in-username-options';
|
|
3
|
+
export type UseSignInUsernameParams = NonNullable<Parameters<AuthClient["signIn"]["username"]>[0]>;
|
|
4
|
+
export type UseSignInUsernameOptions = Omit<ReturnType<typeof signInUsernameOptions>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
6
|
* Hook that creates a mutation for username/password sign-in.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
* refetches the session on completion.
|
|
8
|
+
* Resets the session query on completion so the new session is refetched.
|
|
8
9
|
*
|
|
10
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
9
11
|
* @returns The `useMutation` result.
|
|
10
12
|
*/
|
|
11
|
-
export declare function useSignInUsername(options?:
|
|
12
|
-
username: string;
|
|
13
|
-
password: string;
|
|
14
|
-
rememberMe?: boolean | undefined;
|
|
15
|
-
callbackURL?: string | undefined;
|
|
16
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
13
|
+
export declare function useSignInUsername(options?: UseSignInUsernameOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
17
14
|
username: string;
|
|
18
15
|
password: string;
|
|
19
16
|
rememberMe?: boolean | undefined;
|
|
20
17
|
callbackURL?: string | undefined;
|
|
21
18
|
} & {
|
|
22
|
-
fetchOptions?:
|
|
23
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<Omit<{
|
|
24
|
-
token: string;
|
|
25
|
-
user: {
|
|
26
|
-
id: string;
|
|
27
|
-
createdAt: Date;
|
|
28
|
-
updatedAt: Date;
|
|
29
|
-
email: string;
|
|
30
|
-
emailVerified: boolean;
|
|
31
|
-
name: string;
|
|
32
|
-
image?: string | null | undefined;
|
|
33
|
-
} & {
|
|
19
|
+
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
34
20
|
username: string;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
createdAt: Date;
|
|
41
|
-
updatedAt: Date;
|
|
42
|
-
email: string;
|
|
43
|
-
emailVerified: boolean;
|
|
44
|
-
name: string;
|
|
45
|
-
image?: string | null | undefined;
|
|
46
|
-
} & {} & {
|
|
47
|
-
username?: string | null | undefined;
|
|
48
|
-
displayUsername?: string | null | undefined;
|
|
49
|
-
}>;
|
|
50
|
-
}, {
|
|
51
|
-
code?: string | undefined;
|
|
52
|
-
message?: string | undefined;
|
|
53
|
-
}, FetchOptions["throw"] extends true ? true : false>>)>;
|
|
21
|
+
password: string;
|
|
22
|
+
rememberMe?: boolean | undefined;
|
|
23
|
+
callbackURL?: string | undefined;
|
|
24
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
25
|
+
}>, unknown>;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { sessionOptions as t } from "../../queries/auth/session-options.js";
|
|
3
|
+
import { signInUsernameOptions as n } from "../../mutations/auth/sign-in-username-options.js";
|
|
4
|
+
import { useMutation as r, useQueryClient as i } from "@tanstack/react-query";
|
|
4
5
|
//#region src/hooks/auth/use-sign-in-username.ts
|
|
5
|
-
function
|
|
6
|
-
let { authClient:
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
a.resetQueries({ queryKey: ["auth", "getSession"] }), await r?.onSuccess?.(...e);
|
|
13
|
-
}
|
|
6
|
+
function a(a) {
|
|
7
|
+
let { authClient: o } = e(), s = i();
|
|
8
|
+
return r({
|
|
9
|
+
...n(o),
|
|
10
|
+
...a,
|
|
11
|
+
onSuccess: async (...e) => {
|
|
12
|
+
s.resetQueries({ queryKey: t(o).queryKey }), await a?.onSuccess?.(...e);
|
|
14
13
|
}
|
|
15
14
|
});
|
|
16
15
|
}
|
|
17
16
|
//#endregion
|
|
18
|
-
export {
|
|
17
|
+
export { a as useSignInUsername };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { signOutOptions } from '../../mutations/auth/sign-out-options';
|
|
3
|
+
export type UseSignOutParams = NonNullable<Parameters<AuthClient["signOut"]>[0]>;
|
|
4
|
+
export type UseSignOutOptions = Omit<ReturnType<typeof signOutOptions>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
6
|
* Hook that creates a mutation for signing out.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
8
|
+
* Removes all cached auth queries on completion.
|
|
7
9
|
*
|
|
10
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
8
11
|
* @returns The `useMutation` result.
|
|
9
12
|
*/
|
|
10
|
-
export declare function useSignOut(options?:
|
|
11
|
-
query?: Record<string, any> | undefined;
|
|
12
|
-
fetchOptions?: FetchOptions | undefined;
|
|
13
|
-
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<{
|
|
13
|
+
export declare function useSignOut(options?: UseSignOutOptions): import('@tanstack/react-query').UseMutationResult<{
|
|
14
14
|
success: boolean;
|
|
15
|
-
}, {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
15
|
+
} | null, import('better-auth/client').BetterFetchError, void | import('better-auth').Prettify<{
|
|
16
|
+
query?: Record<string, any> | undefined;
|
|
17
|
+
fetchOptions?: import('better-auth').ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
18
|
+
}>, unknown>;
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { signOutOptions as t } from "../../mutations/auth/sign-out-options.js";
|
|
3
|
+
import { useMutation as n, useQueryClient as r } from "@tanstack/react-query";
|
|
4
4
|
//#region src/hooks/auth/use-sign-out.ts
|
|
5
|
-
function
|
|
6
|
-
let { authClient:
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
a.removeQueries({ queryKey: ["auth"] }), await r?.onSuccess?.(...e);
|
|
13
|
-
}
|
|
5
|
+
function i(i) {
|
|
6
|
+
let { authClient: a } = e(), o = r();
|
|
7
|
+
return n({
|
|
8
|
+
...t(a),
|
|
9
|
+
...i,
|
|
10
|
+
onSuccess: async (...e) => {
|
|
11
|
+
o.removeQueries({ queryKey: ["auth"] }), await i?.onSuccess?.(...e);
|
|
14
12
|
}
|
|
15
13
|
});
|
|
16
14
|
}
|
|
17
15
|
//#endregion
|
|
18
|
-
export {
|
|
16
|
+
export { i as useSignOut };
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { signUpEmailOptions } from '../../mutations/auth/sign-up-email-options';
|
|
3
|
+
export type UseSignUpEmailParams = NonNullable<Parameters<AuthClient["signUp"]["email"]>[0]>;
|
|
4
|
+
export type UseSignUpEmailOptions = Omit<ReturnType<typeof signUpEmailOptions>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
6
|
* Hook that creates a mutation for email/password sign-up.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
* refetches the session on success.
|
|
8
|
+
* Resets the session query on success so the new session is refetched.
|
|
8
9
|
*
|
|
10
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
9
11
|
* @returns The `useMutation` result.
|
|
10
12
|
*/
|
|
11
|
-
export declare function useSignUpEmail(options?:
|
|
12
|
-
name: string;
|
|
13
|
-
email: string;
|
|
14
|
-
password: string;
|
|
15
|
-
image?: string | undefined;
|
|
16
|
-
callbackURL?: string | undefined;
|
|
17
|
-
rememberMe?: boolean | undefined;
|
|
18
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<import('better-auth/client').InferSignUpEmailCtx<{
|
|
13
|
+
export declare function useSignUpEmail(options?: UseSignUpEmailOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<import('better-auth/client').InferSignUpEmailCtx<{
|
|
19
14
|
plugins: ({
|
|
20
15
|
id: "magic-link";
|
|
21
16
|
version: string;
|
|
@@ -883,25 +878,8 @@ export declare function useSignUpEmail(options?: UseAuthMutationOptions<AuthClie
|
|
|
883
878
|
};
|
|
884
879
|
} | {
|
|
885
880
|
data: {
|
|
886
|
-
session:
|
|
887
|
-
|
|
888
|
-
createdAt: Date;
|
|
889
|
-
updatedAt: Date;
|
|
890
|
-
userId: string;
|
|
891
|
-
expiresAt: Date;
|
|
892
|
-
token: string;
|
|
893
|
-
ipAddress?: string | null | undefined;
|
|
894
|
-
userAgent?: string | null | undefined;
|
|
895
|
-
};
|
|
896
|
-
user: {
|
|
897
|
-
id: string;
|
|
898
|
-
createdAt: Date;
|
|
899
|
-
updatedAt: Date;
|
|
900
|
-
email: string;
|
|
901
|
-
emailVerified: boolean;
|
|
902
|
-
name: string;
|
|
903
|
-
image?: string | null | undefined;
|
|
904
|
-
};
|
|
881
|
+
session: import('better-auth').Session;
|
|
882
|
+
user: import('better-auth').User;
|
|
905
883
|
};
|
|
906
884
|
error: null;
|
|
907
885
|
} | {
|
|
@@ -921,25 +899,8 @@ export declare function useSignUpEmail(options?: UseAuthMutationOptions<AuthClie
|
|
|
921
899
|
clientExtensionResults: import('@better-auth/passkey/client').AuthenticationExtensionsClientOutputs;
|
|
922
900
|
};
|
|
923
901
|
data: {
|
|
924
|
-
session:
|
|
925
|
-
|
|
926
|
-
createdAt: Date;
|
|
927
|
-
updatedAt: Date;
|
|
928
|
-
userId: string;
|
|
929
|
-
expiresAt: Date;
|
|
930
|
-
token: string;
|
|
931
|
-
ipAddress?: string | null | undefined;
|
|
932
|
-
userAgent?: string | null | undefined;
|
|
933
|
-
};
|
|
934
|
-
user: {
|
|
935
|
-
id: string;
|
|
936
|
-
createdAt: Date;
|
|
937
|
-
updatedAt: Date;
|
|
938
|
-
email: string;
|
|
939
|
-
emailVerified: boolean;
|
|
940
|
-
name: string;
|
|
941
|
-
image?: string | null | undefined;
|
|
942
|
-
};
|
|
902
|
+
session: import('better-auth').Session;
|
|
903
|
+
user: import('better-auth').User;
|
|
943
904
|
};
|
|
944
905
|
error: null;
|
|
945
906
|
} | {
|
|
@@ -1215,55 +1176,11 @@ export declare function useSignUpEmail(options?: UseAuthMutationOptions<AuthClie
|
|
|
1215
1176
|
INVALID_DISPLAY_USERNAME: import('better-auth').RawError<"INVALID_DISPLAY_USERNAME">;
|
|
1216
1177
|
};
|
|
1217
1178
|
})[];
|
|
1218
|
-
},
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
name: string;
|
|
1227
|
-
image?: string | null | undefined | undefined;
|
|
1228
|
-
};
|
|
1229
|
-
}, "user"> & {
|
|
1230
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
1231
|
-
id: string;
|
|
1232
|
-
createdAt: Date;
|
|
1233
|
-
updatedAt: Date;
|
|
1234
|
-
email: string;
|
|
1235
|
-
emailVerified: boolean;
|
|
1236
|
-
name: string;
|
|
1237
|
-
image?: string | null | undefined;
|
|
1238
|
-
} & {} & {
|
|
1239
|
-
username?: string | null | undefined;
|
|
1240
|
-
displayUsername?: string | null | undefined;
|
|
1241
|
-
}>;
|
|
1242
|
-
}) | (Omit<{
|
|
1243
|
-
token: string;
|
|
1244
|
-
user: {
|
|
1245
|
-
id: string;
|
|
1246
|
-
createdAt: Date;
|
|
1247
|
-
updatedAt: Date;
|
|
1248
|
-
email: string;
|
|
1249
|
-
emailVerified: boolean;
|
|
1250
|
-
name: string;
|
|
1251
|
-
image?: string | null | undefined | undefined;
|
|
1252
|
-
};
|
|
1253
|
-
}, "user"> & {
|
|
1254
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
1255
|
-
id: string;
|
|
1256
|
-
createdAt: Date;
|
|
1257
|
-
updatedAt: Date;
|
|
1258
|
-
email: string;
|
|
1259
|
-
emailVerified: boolean;
|
|
1260
|
-
name: string;
|
|
1261
|
-
image?: string | null | undefined;
|
|
1262
|
-
} & {} & {
|
|
1263
|
-
username?: string | null | undefined;
|
|
1264
|
-
displayUsername?: string | null | undefined;
|
|
1265
|
-
}>;
|
|
1266
|
-
}), {
|
|
1267
|
-
code?: string | undefined;
|
|
1268
|
-
message?: string | undefined;
|
|
1269
|
-
}, FetchOptions["throw"] extends true ? true : false>>)>;
|
|
1179
|
+
}, import('better-auth').ClientFetchOption<Partial<{
|
|
1180
|
+
name: string;
|
|
1181
|
+
email: string;
|
|
1182
|
+
password: string;
|
|
1183
|
+
image?: string | undefined;
|
|
1184
|
+
callbackURL?: string | undefined;
|
|
1185
|
+
rememberMe?: boolean | undefined;
|
|
1186
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>>, unknown>;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { sessionOptions as t } from "../../queries/auth/session-options.js";
|
|
3
|
+
import { signUpEmailOptions as n } from "../../mutations/auth/sign-up-email-options.js";
|
|
4
|
+
import { useMutation as r, useQueryClient as i } from "@tanstack/react-query";
|
|
4
5
|
//#region src/hooks/auth/use-sign-up-email.ts
|
|
5
|
-
function
|
|
6
|
-
let { authClient:
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
a.resetQueries({ queryKey: ["auth", "getSession"] }), await r?.onSuccess?.(...e);
|
|
13
|
-
}
|
|
6
|
+
function a(a) {
|
|
7
|
+
let { authClient: o } = e(), s = i();
|
|
8
|
+
return r({
|
|
9
|
+
...n(o),
|
|
10
|
+
...a,
|
|
11
|
+
onSuccess: async (...e) => {
|
|
12
|
+
s.resetQueries({ queryKey: t(o).queryKey }), await a?.onSuccess?.(...e);
|
|
14
13
|
}
|
|
15
14
|
});
|
|
16
15
|
}
|
|
17
16
|
//#endregion
|
|
18
|
-
export {
|
|
17
|
+
export { a as useSignUpEmail };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UseAuthQueryOptions } from './use-auth-query';
|
|
1
|
+
import { UseSessionOptions } from './use-session';
|
|
3
2
|
/**
|
|
4
3
|
* Retrieve the current authenticated user.
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Thin wrapper over `useSession` that returns `session.user` as `data`.
|
|
6
|
+
*
|
|
7
|
+
* @param options - Better Auth params (`query`, `fetchOptions`) and React
|
|
8
|
+
* Query options forwarded to `useQuery`.
|
|
9
|
+
* @returns React Query result with `data` narrowed to the user object.
|
|
8
10
|
*/
|
|
9
|
-
export declare function useUser(options?:
|
|
11
|
+
export declare function useUser(options?: UseSessionOptions): {
|
|
10
12
|
error: import('better-auth/client').BetterFetchError;
|
|
11
13
|
isError: true;
|
|
12
14
|
isPending: false;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { accountInfoOptions } from '../../queries/settings/account-info-options';
|
|
3
|
+
export type UseAccountInfoParams = NonNullable<Parameters<AuthClient["accountInfo"]>[0]>;
|
|
4
|
+
export type UseAccountInfoOptions = Omit<ReturnType<typeof accountInfoOptions>, "queryKey" | "queryFn"> & UseAccountInfoParams;
|
|
3
5
|
/**
|
|
4
|
-
* Retrieve provider-specific
|
|
6
|
+
* Retrieve provider-specific info for a linked account.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* from the account ID.
|
|
8
|
+
* Keyed per-user; waits for the active session and `options.query.accountId`
|
|
9
|
+
* before firing.
|
|
9
10
|
*
|
|
10
|
-
* @param
|
|
11
|
-
*
|
|
12
|
-
* @returns The react-query result containing account info data, loading state, and error state
|
|
11
|
+
* @param options - Better Auth params (`query`, `fetchOptions`) and React
|
|
12
|
+
* Query options forwarded to `useQuery`.
|
|
13
13
|
*/
|
|
14
|
-
export declare function useAccountInfo(
|
|
14
|
+
export declare function useAccountInfo(options?: UseAccountInfoOptions): import('@tanstack/react-query').UseQueryResult<{
|
|
15
15
|
user: import('better-auth').OAuth2UserInfo;
|
|
16
16
|
data: Record<string, any>;
|
|
17
17
|
} | null, import('better-auth/client').BetterFetchError>;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useSession as t } from "../auth/use-session.js";
|
|
3
|
+
import { accountInfoOptions as n } from "../../queries/settings/account-info-options.js";
|
|
4
|
+
import { skipToken as r, useQuery as i } from "@tanstack/react-query";
|
|
3
5
|
//#region src/hooks/settings/use-account-info.ts
|
|
4
|
-
function
|
|
5
|
-
let { authClient:
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
n
|
|
14
|
-
],
|
|
15
|
-
enabled: !!n,
|
|
16
|
-
...r
|
|
17
|
-
}
|
|
6
|
+
function a(a) {
|
|
7
|
+
let { authClient: o } = e(), { data: s } = t({ refetchOnMount: !1 }), c = s?.user.id, { query: l, fetchOptions: u, ...d } = a ?? {}, f = l?.accountId, p = !c || !f;
|
|
8
|
+
return i({
|
|
9
|
+
...n(o, c, {
|
|
10
|
+
query: l,
|
|
11
|
+
fetchOptions: u
|
|
12
|
+
}),
|
|
13
|
+
...p && { queryFn: r },
|
|
14
|
+
...d
|
|
18
15
|
});
|
|
19
16
|
}
|
|
20
17
|
//#endregion
|
|
21
|
-
export {
|
|
18
|
+
export { a as useAccountInfo };
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { addPasskeyOptions } from '../../mutations/settings/add-passkey-options';
|
|
3
|
+
export type UseAddPasskeyParams = NonNullable<Parameters<AuthClient["passkey"]["addPasskey"]>[0]>;
|
|
4
|
+
export type UseAddPasskeyOptions = Omit<ReturnType<typeof addPasskeyOptions>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
|
-
* Hook that creates a mutation for
|
|
6
|
+
* Hook that creates a mutation for registering a new passkey.
|
|
5
7
|
*
|
|
6
|
-
* Refetches the
|
|
8
|
+
* Refetches the user's passkey list on success.
|
|
7
9
|
*
|
|
10
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
8
11
|
* @returns The `useMutation` result.
|
|
9
12
|
*/
|
|
10
|
-
export declare function useAddPasskey(options?:
|
|
13
|
+
export declare function useAddPasskey(options?: UseAddPasskeyOptions): import('@tanstack/react-query').UseMutationResult<import('@better-auth/passkey/client').Passkey | null, import('better-auth/client').BetterFetchError, void | {
|
|
11
14
|
fetchOptions?: import('better-auth').ClientFetchOption;
|
|
12
15
|
name?: string;
|
|
13
16
|
authenticatorAttachment?: "platform" | "cross-platform";
|
|
@@ -15,29 +18,4 @@ export declare function useAddPasskey(options?: UseAuthMutationOptions<AuthClien
|
|
|
15
18
|
extensions?: import('@better-auth/passkey/client').AuthenticationExtensionsClientInputs;
|
|
16
19
|
useAutoRegister?: boolean;
|
|
17
20
|
returnWebAuthnResponse?: boolean;
|
|
18
|
-
}
|
|
19
|
-
data: null;
|
|
20
|
-
error: {
|
|
21
|
-
message?: string | undefined;
|
|
22
|
-
status: number;
|
|
23
|
-
statusText: string;
|
|
24
|
-
};
|
|
25
|
-
} | {
|
|
26
|
-
data: import('@better-auth/passkey/client').Passkey;
|
|
27
|
-
error: null;
|
|
28
|
-
} | {
|
|
29
|
-
webauthn: {
|
|
30
|
-
response: import('@better-auth/passkey/client').RegistrationResponseJSON;
|
|
31
|
-
clientExtensionResults: import('@better-auth/passkey/client').AuthenticationExtensionsClientOutputs;
|
|
32
|
-
};
|
|
33
|
-
data: import('@better-auth/passkey/client').Passkey;
|
|
34
|
-
error: null;
|
|
35
|
-
} | {
|
|
36
|
-
data: null;
|
|
37
|
-
error: {
|
|
38
|
-
code: string;
|
|
39
|
-
message: string;
|
|
40
|
-
status: number;
|
|
41
|
-
statusText: string;
|
|
42
|
-
};
|
|
43
|
-
}>>;
|
|
21
|
+
}, unknown>;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import {
|
|
2
|
+
import { addPasskeyOptions as t } from "../../mutations/settings/add-passkey-options.js";
|
|
3
3
|
import { useListUserPasskeys as n } from "./use-list-user-passkeys.js";
|
|
4
|
+
import { useMutation as r } from "@tanstack/react-query";
|
|
4
5
|
//#region src/hooks/settings/use-add-passkey.ts
|
|
5
|
-
function
|
|
6
|
-
let { authClient:
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
await a(), await r?.onSuccess?.(...e);
|
|
13
|
-
}
|
|
6
|
+
function i(i) {
|
|
7
|
+
let { authClient: a } = e(), { refetch: o } = n();
|
|
8
|
+
return r({
|
|
9
|
+
...t(a),
|
|
10
|
+
...i,
|
|
11
|
+
onSuccess: async (...e) => {
|
|
12
|
+
await o(), await i?.onSuccess?.(...e);
|
|
14
13
|
}
|
|
15
14
|
});
|
|
16
15
|
}
|
|
17
16
|
//#endregion
|
|
18
|
-
export {
|
|
17
|
+
export { i as useAddPasskey };
|