@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,9 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UseAuthQueryOptions, UseAuthQueryResult } from './use-auth-query';
|
|
1
|
+
import { UseSessionOptions } from './use-session';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
3
|
+
* Calls `useSession` and redirects unauthenticated users to the sign-in page,
|
|
4
|
+
* preserving the current URL as a `redirectTo` query param.
|
|
5
5
|
*
|
|
6
|
-
* @param options -
|
|
7
|
-
*
|
|
6
|
+
* @param options - Better Auth params (`query`, `fetchOptions`) and React
|
|
7
|
+
* Query options forwarded to `useQuery`.
|
|
8
|
+
* @returns React Query result for the session.
|
|
8
9
|
*/
|
|
9
|
-
export declare function useAuthenticate(options?:
|
|
10
|
+
export declare function useAuthenticate(options?: UseSessionOptions): import('@tanstack/react-query').UseQueryResult<{
|
|
11
|
+
user: import('better-auth').StripEmptyObjects<{
|
|
12
|
+
id: string;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
updatedAt: Date;
|
|
15
|
+
email: string;
|
|
16
|
+
emailVerified: boolean;
|
|
17
|
+
name: string;
|
|
18
|
+
image?: string | null | undefined;
|
|
19
|
+
} & {} & {
|
|
20
|
+
username?: string | null | undefined;
|
|
21
|
+
displayUsername?: string | null | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
session: import('better-auth').StripEmptyObjects<{
|
|
24
|
+
id: string;
|
|
25
|
+
createdAt: Date;
|
|
26
|
+
updatedAt: Date;
|
|
27
|
+
userId: string;
|
|
28
|
+
expiresAt: Date;
|
|
29
|
+
token: string;
|
|
30
|
+
ipAddress?: string | null | undefined;
|
|
31
|
+
userAgent?: string | null | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
} | null, import('better-auth/client').BetterFetchError>;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { isUsernameAvailableOptions } from '../../mutations/auth/is-username-available-options';
|
|
3
|
+
export type UseIsUsernameAvailableParams = NonNullable<Parameters<AuthClient["isUsernameAvailable"]>[0]>;
|
|
4
|
+
export type UseIsUsernameAvailableOptions = Omit<ReturnType<typeof isUsernameAvailableOptions>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
6
|
* Hook that creates a mutation to check if a username is available.
|
|
5
7
|
*
|
|
8
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
6
9
|
* @returns The `useMutation` result where data contains `{ available: boolean }`.
|
|
7
10
|
*/
|
|
8
|
-
export declare function useIsUsernameAvailable(options?:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
export declare function useIsUsernameAvailable(options?: UseIsUsernameAvailableOptions): import('@tanstack/react-query').UseMutationResult<{
|
|
12
|
+
available: boolean;
|
|
13
|
+
message: string | null;
|
|
14
|
+
}, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
11
15
|
username: string;
|
|
12
16
|
} & {
|
|
13
|
-
fetchOptions?:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
code?: string | undefined;
|
|
18
|
-
message?: string | undefined;
|
|
19
|
-
}, FetchOptions["throw"] extends true ? true : false>>)>;
|
|
17
|
+
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
18
|
+
username: string;
|
|
19
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
20
|
+
}>, unknown>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import {
|
|
2
|
+
import { isUsernameAvailableOptions as t } from "../../mutations/auth/is-username-available-options.js";
|
|
3
|
+
import { useMutation as n } from "@tanstack/react-query";
|
|
3
4
|
//#region src/hooks/auth/use-is-username-available.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 useIsUsernameAvailable };
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { requestPasswordResetOptions } from '../../mutations/auth/request-password-reset-options';
|
|
3
|
+
export type UseRequestPasswordResetParams = NonNullable<Parameters<AuthClient["requestPasswordReset"]>[0]>;
|
|
4
|
+
export type UseRequestPasswordResetOptions = Omit<ReturnType<typeof requestPasswordResetOptions>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
6
|
* Hook that creates a mutation for the forgot-password flow.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
* and navigates to the sign-in view on success.
|
|
8
|
+
* Sends a password reset email for the provided address.
|
|
8
9
|
*
|
|
10
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
9
11
|
* @returns The `useMutation` result.
|
|
10
12
|
*/
|
|
11
|
-
export declare function useRequestPasswordReset(options?:
|
|
12
|
-
email: string;
|
|
13
|
-
redirectTo?: string | undefined;
|
|
14
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
13
|
+
export declare function useRequestPasswordReset(options?: UseRequestPasswordResetOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
15
14
|
email: string;
|
|
16
15
|
redirectTo?: string | undefined;
|
|
17
16
|
} & {
|
|
18
|
-
fetchOptions?:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
code?: string | undefined;
|
|
24
|
-
message?: string | undefined;
|
|
25
|
-
}, FetchOptions["throw"] extends true ? true : false>>)>;
|
|
17
|
+
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
18
|
+
email: string;
|
|
19
|
+
redirectTo?: string | undefined;
|
|
20
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
21
|
+
}>, unknown>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import {
|
|
2
|
+
import { requestPasswordResetOptions as t } from "../../mutations/auth/request-password-reset-options.js";
|
|
3
|
+
import { useMutation as n } from "@tanstack/react-query";
|
|
3
4
|
//#region src/hooks/auth/use-request-password-reset.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 useRequestPasswordReset };
|
|
@@ -1,39 +1,23 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { resetPasswordOptions } from '../../mutations/auth/reset-password-options';
|
|
3
|
+
export type UseResetPasswordParams = NonNullable<Parameters<AuthClient["resetPassword"]>[0]>;
|
|
4
|
+
export type UseResetPasswordOptions = Omit<ReturnType<typeof resetPasswordOptions>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
6
|
* Hook that creates a mutation for the reset-password flow.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
8
|
+
* Resets the user's password using the provided token and new password.
|
|
7
9
|
*
|
|
10
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
8
11
|
* @returns The `useMutation` result.
|
|
9
12
|
*/
|
|
10
|
-
export declare function useResetPassword(options?:
|
|
11
|
-
newPassword: string;
|
|
12
|
-
token?: string | undefined;
|
|
13
|
-
}> & Record<string, any>, Partial<{
|
|
14
|
-
token?: string | undefined;
|
|
15
|
-
}> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
13
|
+
export declare function useResetPassword(options?: UseResetPasswordOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
16
14
|
newPassword: string;
|
|
17
15
|
token?: string | undefined;
|
|
18
16
|
} & {
|
|
19
|
-
fetchOptions?:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}, {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
":token": <FetchOptions extends import('better-auth').ClientFetchOption<never, Partial<{
|
|
27
|
-
callbackURL: string;
|
|
28
|
-
}> & Record<string, any>, {
|
|
29
|
-
token: string;
|
|
30
|
-
}>>(data_0: import('better-auth').Prettify<{
|
|
31
|
-
query: {
|
|
32
|
-
callbackURL: string;
|
|
33
|
-
};
|
|
34
|
-
fetchOptions?: FetchOptions | undefined;
|
|
35
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<never, {
|
|
36
|
-
code?: string | undefined;
|
|
37
|
-
message?: string | undefined;
|
|
38
|
-
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
39
|
-
}>;
|
|
17
|
+
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
18
|
+
newPassword: string;
|
|
19
|
+
token?: string | undefined;
|
|
20
|
+
}> & Record<string, any>, Partial<{
|
|
21
|
+
token?: string | undefined;
|
|
22
|
+
}> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
23
|
+
}>, unknown>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import {
|
|
2
|
+
import { resetPasswordOptions as t } from "../../mutations/auth/reset-password-options.js";
|
|
3
|
+
import { useMutation as n } from "@tanstack/react-query";
|
|
3
4
|
//#region src/hooks/auth/use-reset-password.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 useResetPassword };
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { sendVerificationEmailOptions } from '../../mutations/auth/send-verification-email-options';
|
|
3
|
+
export type UseSendVerificationEmailParams = NonNullable<Parameters<AuthClient["sendVerificationEmail"]>[0]>;
|
|
4
|
+
export type UseSendVerificationEmailOptions = Omit<ReturnType<typeof sendVerificationEmailOptions>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
6
|
* Hook that creates a mutation to send a verification email.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
8
9
|
* @returns The `useMutation` result.
|
|
9
10
|
*/
|
|
10
|
-
export declare function useSendVerificationEmail(options?:
|
|
11
|
-
email: string;
|
|
12
|
-
callbackURL?: string | undefined;
|
|
13
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
11
|
+
export declare function useSendVerificationEmail(options?: UseSendVerificationEmailOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
14
12
|
email: string;
|
|
15
13
|
callbackURL?: string | undefined;
|
|
16
14
|
} & {
|
|
17
|
-
fetchOptions?:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
message?: string | undefined;
|
|
23
|
-
}, FetchOptions["throw"] extends true ? true : false>>)>;
|
|
15
|
+
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
16
|
+
email: string;
|
|
17
|
+
callbackURL?: string | undefined;
|
|
18
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
19
|
+
}>, unknown>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import {
|
|
2
|
+
import { sendVerificationEmailOptions as t } from "../../mutations/auth/send-verification-email-options.js";
|
|
3
|
+
import { useMutation as n } from "@tanstack/react-query";
|
|
3
4
|
//#region src/hooks/auth/use-send-verification-email.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 useSendVerificationEmail };
|
|
@@ -1,9 +1,35 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { sessionOptions } from '../../queries/auth/session-options';
|
|
3
|
+
export type UseSessionParams = NonNullable<Parameters<AuthClient["getSession"]>[0]>;
|
|
4
|
+
export type UseSessionOptions = Omit<ReturnType<typeof sessionOptions>, "queryKey" | "queryFn"> & UseSessionParams;
|
|
3
5
|
/**
|
|
4
6
|
* Retrieve the current authentication session.
|
|
5
7
|
*
|
|
6
|
-
* @param options -
|
|
7
|
-
*
|
|
8
|
+
* @param options - Better Auth params (`query`, `fetchOptions`) and React
|
|
9
|
+
* Query options forwarded to `useQuery`.
|
|
10
|
+
* @returns React Query result for the session.
|
|
8
11
|
*/
|
|
9
|
-
export declare function useSession(options?:
|
|
12
|
+
export declare function useSession(options?: UseSessionOptions): import('@tanstack/react-query').UseQueryResult<{
|
|
13
|
+
user: import('better-auth').StripEmptyObjects<{
|
|
14
|
+
id: string;
|
|
15
|
+
createdAt: Date;
|
|
16
|
+
updatedAt: Date;
|
|
17
|
+
email: string;
|
|
18
|
+
emailVerified: boolean;
|
|
19
|
+
name: string;
|
|
20
|
+
image?: string | null | undefined;
|
|
21
|
+
} & {} & {
|
|
22
|
+
username?: string | null | undefined;
|
|
23
|
+
displayUsername?: string | null | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
session: import('better-auth').StripEmptyObjects<{
|
|
26
|
+
id: string;
|
|
27
|
+
createdAt: Date;
|
|
28
|
+
updatedAt: Date;
|
|
29
|
+
userId: string;
|
|
30
|
+
expiresAt: Date;
|
|
31
|
+
token: string;
|
|
32
|
+
ipAddress?: string | null | undefined;
|
|
33
|
+
userAgent?: string | null | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
} | null, import('better-auth/client').BetterFetchError>;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import {
|
|
2
|
+
import { sessionOptions as t } from "../../queries/auth/session-options.js";
|
|
3
|
+
import { useQuery as n } from "@tanstack/react-query";
|
|
3
4
|
//#region src/hooks/auth/use-session.ts
|
|
4
|
-
function
|
|
5
|
-
let { authClient:
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
function r(r) {
|
|
6
|
+
let { authClient: i } = e(), { query: a, fetchOptions: o, ...s } = r ?? {};
|
|
7
|
+
return n({
|
|
8
|
+
...t(i, {
|
|
9
|
+
query: a,
|
|
10
|
+
fetchOptions: o
|
|
11
|
+
}),
|
|
12
|
+
...s
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
15
|
//#endregion
|
|
15
|
-
export {
|
|
16
|
+
export { r as useSession };
|
|
@@ -1,52 +1,26 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { signInEmailOptions } from '../../mutations/auth/sign-in-email-options';
|
|
3
|
+
export type UseSignInEmailParams = NonNullable<Parameters<AuthClient["signIn"]["email"]>[0]>;
|
|
4
|
+
export type UseSignInEmailOptions = Omit<ReturnType<typeof signInEmailOptions>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
6
|
* Hook that creates a mutation for email/password sign-in.
|
|
5
7
|
*
|
|
6
8
|
* The mutation sends an email/password sign-in request and
|
|
7
9
|
* refetches the session on completion.
|
|
8
10
|
*
|
|
11
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
9
12
|
* @returns The `useMutation` result.
|
|
10
13
|
*/
|
|
11
|
-
export declare function useSignInEmail(options?:
|
|
12
|
-
email: string;
|
|
13
|
-
password: string;
|
|
14
|
-
callbackURL?: string | undefined;
|
|
15
|
-
rememberMe?: boolean | undefined;
|
|
16
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
14
|
+
export declare function useSignInEmail(options?: UseSignInEmailOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
17
15
|
email: string;
|
|
18
16
|
password: string;
|
|
19
17
|
callbackURL?: string | undefined;
|
|
20
18
|
rememberMe?: boolean | undefined;
|
|
21
19
|
} & {
|
|
22
|
-
fetchOptions?:
|
|
23
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<Omit<{
|
|
24
|
-
redirect: boolean;
|
|
25
|
-
token: string;
|
|
26
|
-
url?: string | undefined;
|
|
27
|
-
user: {
|
|
28
|
-
id: string;
|
|
29
|
-
createdAt: Date;
|
|
30
|
-
updatedAt: Date;
|
|
31
|
-
email: string;
|
|
32
|
-
emailVerified: boolean;
|
|
33
|
-
name: string;
|
|
34
|
-
image?: string | null | undefined | undefined;
|
|
35
|
-
};
|
|
36
|
-
}, "user"> & {
|
|
37
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
38
|
-
id: string;
|
|
39
|
-
createdAt: Date;
|
|
40
|
-
updatedAt: Date;
|
|
20
|
+
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
41
21
|
email: string;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} &
|
|
46
|
-
|
|
47
|
-
displayUsername?: string | null | undefined;
|
|
48
|
-
}>;
|
|
49
|
-
}, {
|
|
50
|
-
code?: string | undefined;
|
|
51
|
-
message?: string | undefined;
|
|
52
|
-
}, FetchOptions["throw"] extends true ? true : false>>)>;
|
|
22
|
+
password: string;
|
|
23
|
+
callbackURL?: string | undefined;
|
|
24
|
+
rememberMe?: boolean | undefined;
|
|
25
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
26
|
+
}>, 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 { signInEmailOptions as n } from "../../mutations/auth/sign-in-email-options.js";
|
|
4
|
+
import { useMutation as r, useQueryClient as i } from "@tanstack/react-query";
|
|
4
5
|
//#region src/hooks/auth/use-sign-in-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 useSignInEmail };
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { signInMagicLinkOptions } from '../../mutations/auth/sign-in-magic-link-options';
|
|
3
|
+
export type UseSignInMagicLinkParams = NonNullable<Parameters<AuthClient["signIn"]["magicLink"]>[0]>;
|
|
4
|
+
export type UseSignInMagicLinkOptions = Omit<ReturnType<typeof signInMagicLinkOptions>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
6
|
* Hook that creates a mutation for magic-link sign-in.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
8
9
|
* @returns The `useMutation` result.
|
|
9
10
|
*/
|
|
10
|
-
export declare function useSignInMagicLink(options?:
|
|
11
|
-
email: string;
|
|
12
|
-
name?: string | undefined;
|
|
13
|
-
callbackURL?: string | undefined;
|
|
14
|
-
newUserCallbackURL?: string | undefined;
|
|
15
|
-
errorCallbackURL?: string | undefined;
|
|
16
|
-
metadata?: Record<string, any> | undefined;
|
|
17
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
|
|
11
|
+
export declare function useSignInMagicLink(options?: UseSignInMagicLinkOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
18
12
|
email: string;
|
|
19
13
|
name?: string | undefined;
|
|
20
14
|
callbackURL?: string | undefined;
|
|
@@ -22,10 +16,12 @@ export declare function useSignInMagicLink(options?: UseAuthMutationOptions<Auth
|
|
|
22
16
|
errorCallbackURL?: string | undefined;
|
|
23
17
|
metadata?: Record<string, any> | undefined;
|
|
24
18
|
} & {
|
|
25
|
-
fetchOptions?:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
20
|
+
email: string;
|
|
21
|
+
name?: string | undefined;
|
|
22
|
+
callbackURL?: string | undefined;
|
|
23
|
+
newUserCallbackURL?: string | undefined;
|
|
24
|
+
errorCallbackURL?: string | undefined;
|
|
25
|
+
metadata?: Record<string, any> | undefined;
|
|
26
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
27
|
+
}>, unknown>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import {
|
|
2
|
+
import { signInMagicLinkOptions as t } from "../../mutations/auth/sign-in-magic-link-options.js";
|
|
3
|
+
import { useMutation as n } from "@tanstack/react-query";
|
|
3
4
|
//#region src/hooks/auth/use-sign-in-magic-link.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 useSignInMagicLink };
|
|
@@ -1,58 +1,21 @@
|
|
|
1
1
|
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import {
|
|
2
|
+
import { signInPasskeyOptions } from '../../mutations/auth/sign-in-passkey-options';
|
|
3
|
+
export type UseSignInPasskeyParams = NonNullable<Parameters<AuthClient["signIn"]["passkey"]>[0]>;
|
|
4
|
+
export type UseSignInPasskeyOptions = Omit<ReturnType<typeof signInPasskeyOptions>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
6
|
* Hook that creates a mutation for passkey 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 useSignInPasskey(options?:
|
|
13
|
+
export declare function useSignInPasskey(options?: UseSignInPasskeyOptions): import('@tanstack/react-query').UseMutationResult<{
|
|
14
|
+
session: import('better-auth').Session;
|
|
15
|
+
user: import('better-auth').User;
|
|
16
|
+
} | null, import('better-auth/client').BetterFetchError, void | {
|
|
12
17
|
autoFill?: boolean;
|
|
13
18
|
extensions?: import('@better-auth/passkey/client').AuthenticationExtensionsClientInputs;
|
|
14
19
|
returnWebAuthnResponse?: boolean;
|
|
15
20
|
fetchOptions?: import('better-auth').ClientFetchOption;
|
|
16
|
-
}
|
|
17
|
-
data: null;
|
|
18
|
-
error: {
|
|
19
|
-
message?: string | undefined;
|
|
20
|
-
status: number;
|
|
21
|
-
statusText: string;
|
|
22
|
-
};
|
|
23
|
-
} | {
|
|
24
|
-
data: {
|
|
25
|
-
session: import('better-auth').Session;
|
|
26
|
-
user: import('better-auth').User;
|
|
27
|
-
};
|
|
28
|
-
error: null;
|
|
29
|
-
} | {
|
|
30
|
-
webauthn: {
|
|
31
|
-
response: import('@better-auth/passkey/client').AuthenticationResponseJSON;
|
|
32
|
-
clientExtensionResults: import('@better-auth/passkey/client').AuthenticationExtensionsClientOutputs;
|
|
33
|
-
};
|
|
34
|
-
data: null;
|
|
35
|
-
error: {
|
|
36
|
-
message?: string | undefined;
|
|
37
|
-
status: number;
|
|
38
|
-
statusText: string;
|
|
39
|
-
};
|
|
40
|
-
} | {
|
|
41
|
-
webauthn: {
|
|
42
|
-
response: import('@better-auth/passkey/client').AuthenticationResponseJSON;
|
|
43
|
-
clientExtensionResults: import('@better-auth/passkey/client').AuthenticationExtensionsClientOutputs;
|
|
44
|
-
};
|
|
45
|
-
data: {
|
|
46
|
-
session: import('better-auth').Session;
|
|
47
|
-
user: import('better-auth').User;
|
|
48
|
-
};
|
|
49
|
-
error: null;
|
|
50
|
-
} | {
|
|
51
|
-
data: null;
|
|
52
|
-
error: {
|
|
53
|
-
code: string;
|
|
54
|
-
message: string;
|
|
55
|
-
status: number;
|
|
56
|
-
statusText: string;
|
|
57
|
-
};
|
|
58
|
-
}>>;
|
|
21
|
+
}, 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 { signInPasskeyOptions as n } from "../../mutations/auth/sign-in-passkey-options.js";
|
|
4
|
+
import { useMutation as r, useQueryClient as i } from "@tanstack/react-query";
|
|
4
5
|
//#region src/hooks/auth/use-sign-in-passkey.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 useSignInPasskey };
|