@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.
Files changed (194) hide show
  1. package/dist/hooks/auth/use-authenticate.d.ts +30 -6
  2. package/dist/hooks/auth/use-is-username-available.d.ts +12 -11
  3. package/dist/hooks/auth/use-is-username-available.js +8 -7
  4. package/dist/hooks/auth/use-request-password-reset.d.ts +11 -15
  5. package/dist/hooks/auth/use-request-password-reset.js +8 -7
  6. package/dist/hooks/auth/use-reset-password.d.ts +13 -29
  7. package/dist/hooks/auth/use-reset-password.js +8 -7
  8. package/dist/hooks/auth/use-send-verification-email.d.ts +10 -14
  9. package/dist/hooks/auth/use-send-verification-email.js +8 -7
  10. package/dist/hooks/auth/use-session.d.ts +30 -4
  11. package/dist/hooks/auth/use-session.js +11 -10
  12. package/dist/hooks/auth/use-sign-in-email.d.ts +11 -37
  13. package/dist/hooks/auth/use-sign-in-email.js +11 -12
  14. package/dist/hooks/auth/use-sign-in-magic-link.d.ts +14 -18
  15. package/dist/hooks/auth/use-sign-in-magic-link.js +8 -7
  16. package/dist/hooks/auth/use-sign-in-passkey.d.ts +10 -47
  17. package/dist/hooks/auth/use-sign-in-passkey.js +11 -12
  18. package/dist/hooks/auth/use-sign-in-social.d.ts +30 -59
  19. package/dist/hooks/auth/use-sign-in-social.js +8 -7
  20. package/dist/hooks/auth/use-sign-in-username.d.ts +12 -40
  21. package/dist/hooks/auth/use-sign-in-username.js +11 -12
  22. package/dist/hooks/auth/use-sign-out.d.ts +10 -10
  23. package/dist/hooks/auth/use-sign-out.js +10 -12
  24. package/dist/hooks/auth/use-sign-up-email.d.ts +18 -101
  25. package/dist/hooks/auth/use-sign-up-email.js +11 -12
  26. package/dist/hooks/auth/use-user.d.ts +7 -5
  27. package/dist/hooks/settings/use-account-info.d.ts +9 -9
  28. package/dist/hooks/settings/use-account-info.js +13 -16
  29. package/dist/hooks/settings/use-add-passkey.d.ts +8 -30
  30. package/dist/hooks/settings/use-add-passkey.js +10 -11
  31. package/dist/hooks/settings/use-change-email.d.ts +11 -14
  32. package/dist/hooks/settings/use-change-email.js +11 -12
  33. package/dist/hooks/settings/use-change-password.d.ts +11 -43
  34. package/dist/hooks/settings/use-change-password.js +8 -7
  35. package/dist/hooks/settings/use-delete-passkey.d.ts +10 -12
  36. package/dist/hooks/settings/use-delete-passkey.js +11 -12
  37. package/dist/hooks/settings/use-delete-user.d.ts +13 -30
  38. package/dist/hooks/settings/use-delete-user.js +8 -7
  39. package/dist/hooks/settings/use-link-social.d.ts +22 -25
  40. package/dist/hooks/settings/use-link-social.js +8 -7
  41. package/dist/hooks/settings/use-list-accounts.d.ts +8 -6
  42. package/dist/hooks/settings/use-list-accounts.js +10 -16
  43. package/dist/hooks/settings/use-list-device-sessions.d.ts +29 -6
  44. package/dist/hooks/settings/use-list-device-sessions.js +10 -16
  45. package/dist/hooks/settings/use-list-sessions.d.ts +8 -5
  46. package/dist/hooks/settings/use-list-sessions.js +10 -16
  47. package/dist/hooks/settings/use-list-user-passkeys.d.ts +8 -5
  48. package/dist/hooks/settings/use-list-user-passkeys.js +10 -16
  49. package/dist/hooks/settings/use-revoke-multi-session.d.ts +11 -11
  50. package/dist/hooks/settings/use-revoke-multi-session.js +11 -12
  51. package/dist/hooks/settings/use-revoke-session.d.ts +11 -11
  52. package/dist/hooks/settings/use-revoke-session.js +11 -12
  53. package/dist/hooks/settings/use-set-active-session.d.ts +12 -29
  54. package/dist/hooks/settings/use-set-active-session.js +12 -13
  55. package/dist/hooks/settings/use-unlink-account.d.ts +12 -12
  56. package/dist/hooks/settings/use-unlink-account.js +11 -12
  57. package/dist/hooks/settings/use-update-user.d.ts +1178 -4
  58. package/dist/hooks/settings/use-update-user.js +17 -18
  59. package/dist/hooks/use-auth-mutation.d.ts +12 -0
  60. package/dist/hooks/use-auth-mutation.js +11 -0
  61. package/dist/hooks/use-auth-query.d.ts +14 -0
  62. package/dist/hooks/use-auth-query.js +15 -0
  63. package/dist/index.d.ts +2 -2
  64. package/dist/index.js +33 -33
  65. package/dist/mutations/auth/is-username-available-options.d.ts +19 -0
  66. package/dist/mutations/auth/is-username-available-options.js +7 -0
  67. package/dist/mutations/auth/request-password-reset-options.d.ts +15 -0
  68. package/dist/mutations/auth/request-password-reset-options.js +7 -0
  69. package/dist/mutations/auth/reset-password-options.d.ts +17 -0
  70. package/dist/mutations/auth/reset-password-options.js +7 -0
  71. package/dist/mutations/auth/send-verification-email-options.d.ts +15 -0
  72. package/dist/mutations/auth/send-verification-email-options.js +7 -0
  73. package/dist/mutations/auth/sign-in-email-options.d.ts +23 -0
  74. package/dist/mutations/auth/sign-in-email-options.js +11 -0
  75. package/dist/mutations/auth/sign-in-magic-link-options.d.ts +23 -0
  76. package/dist/mutations/auth/sign-in-magic-link-options.js +11 -0
  77. package/dist/mutations/auth/sign-in-passkey-options.d.ts +15 -0
  78. package/dist/mutations/auth/sign-in-passkey-options.js +11 -0
  79. package/dist/mutations/auth/sign-in-social-options.d.ts +61 -0
  80. package/dist/mutations/auth/sign-in-social-options.js +11 -0
  81. package/dist/mutations/auth/sign-in-username-options.d.ts +19 -0
  82. package/dist/mutations/auth/sign-in-username-options.js +11 -0
  83. package/dist/mutations/auth/sign-out-options.d.ts +12 -0
  84. package/dist/mutations/auth/sign-out-options.js +7 -0
  85. package/dist/mutations/auth/sign-up-email-options.d.ts +1180 -0
  86. package/dist/mutations/auth/sign-up-email-options.js +11 -0
  87. package/dist/mutations/auth-mutation-options.d.ts +25 -0
  88. package/dist/mutations/auth-mutation-options.js +19 -0
  89. package/dist/mutations/settings/add-passkey-options.d.ts +15 -0
  90. package/dist/mutations/settings/add-passkey-options.js +11 -0
  91. package/dist/mutations/settings/change-email-options.d.ts +15 -0
  92. package/dist/mutations/settings/change-email-options.js +7 -0
  93. package/dist/mutations/settings/change-password-options.d.ts +17 -0
  94. package/dist/mutations/settings/change-password-options.js +7 -0
  95. package/dist/mutations/settings/delete-passkey-options.d.ts +13 -0
  96. package/dist/mutations/settings/delete-passkey-options.js +11 -0
  97. package/dist/mutations/settings/delete-user-options.d.ts +20 -0
  98. package/dist/mutations/settings/delete-user-options.js +7 -0
  99. package/dist/mutations/settings/link-social-options.d.ts +39 -0
  100. package/dist/mutations/settings/link-social-options.js +7 -0
  101. package/dist/mutations/settings/revoke-multi-session-options.d.ts +13 -0
  102. package/dist/mutations/settings/revoke-multi-session-options.js +11 -0
  103. package/dist/mutations/settings/revoke-session-options.d.ts +13 -0
  104. package/dist/mutations/settings/revoke-session-options.js +7 -0
  105. package/dist/mutations/settings/set-active-session-options.d.ts +13 -0
  106. package/dist/mutations/settings/set-active-session-options.js +11 -0
  107. package/dist/mutations/settings/unlink-account-options.d.ts +15 -0
  108. package/dist/mutations/settings/unlink-account-options.js +7 -0
  109. package/dist/mutations/settings/update-user-options.d.ts +1182 -0
  110. package/dist/mutations/settings/update-user-options.js +7 -0
  111. package/dist/queries/auth/session-options.d.ts +110 -0
  112. package/dist/queries/auth/session-options.js +7 -0
  113. package/dist/queries/auth-query-options.d.ts +29 -0
  114. package/dist/queries/auth-query-options.js +17 -0
  115. package/dist/queries/settings/account-info-options.d.ts +32 -0
  116. package/dist/queries/settings/account-info-options.js +12 -0
  117. package/dist/queries/settings/list-accounts-options.d.ts +53 -0
  118. package/dist/queries/settings/list-accounts-options.js +12 -0
  119. package/dist/queries/settings/list-device-sessions-options.d.ts +99 -0
  120. package/dist/queries/settings/list-device-sessions-options.js +12 -0
  121. package/dist/queries/settings/list-sessions-options.d.ts +54 -0
  122. package/dist/queries/settings/list-sessions-options.js +12 -0
  123. package/dist/queries/settings/list-user-passkeys-options.d.ts +18 -0
  124. package/dist/queries/settings/list-user-passkeys-options.js +12 -0
  125. package/package.json +1 -1
  126. package/src/hooks/auth/use-authenticate.ts +7 -10
  127. package/src/hooks/auth/use-is-username-available.ts +17 -8
  128. package/src/hooks/auth/use-request-password-reset.ts +19 -8
  129. package/src/hooks/auth/use-reset-password.ts +19 -9
  130. package/src/hooks/auth/use-send-verification-email.ts +18 -8
  131. package/src/hooks/auth/use-session.ts +20 -16
  132. package/src/hooks/auth/use-sign-in-email.ts +23 -16
  133. package/src/hooks/auth/use-sign-in-magic-link.ts +18 -10
  134. package/src/hooks/auth/use-sign-in-passkey.ts +24 -18
  135. package/src/hooks/auth/use-sign-in-social.ts +18 -8
  136. package/src/hooks/auth/use-sign-in-username.ts +24 -18
  137. package/src/hooks/auth/use-sign-out.ts +18 -17
  138. package/src/hooks/auth/use-sign-up-email.ts +24 -18
  139. package/src/hooks/auth/use-user.ts +7 -8
  140. package/src/hooks/settings/use-account-info.ts +29 -20
  141. package/src/hooks/settings/use-add-passkey.ts +22 -17
  142. package/src/hooks/settings/use-change-email.ts +21 -17
  143. package/src/hooks/settings/use-change-password.ts +18 -8
  144. package/src/hooks/settings/use-delete-passkey.ts +21 -16
  145. package/src/hooks/settings/use-delete-user.ts +18 -8
  146. package/src/hooks/settings/use-link-social.ts +18 -8
  147. package/src/hooks/settings/use-list-accounts.ts +25 -15
  148. package/src/hooks/settings/use-list-device-sessions.ts +26 -21
  149. package/src/hooks/settings/use-list-sessions.ts +25 -14
  150. package/src/hooks/settings/use-list-user-passkeys.ts +25 -16
  151. package/src/hooks/settings/use-revoke-multi-session.ts +25 -16
  152. package/src/hooks/settings/use-revoke-session.ts +25 -16
  153. package/src/hooks/settings/use-set-active-session.ts +35 -24
  154. package/src/hooks/settings/use-unlink-account.ts +22 -15
  155. package/src/hooks/settings/use-update-user.ts +29 -22
  156. package/src/hooks/use-auth-mutation.ts +29 -0
  157. package/src/hooks/use-auth-query.ts +36 -0
  158. package/src/index.ts +2 -2
  159. package/src/mutations/auth/is-username-available-options.ts +18 -0
  160. package/src/mutations/auth/request-password-reset-options.ts +14 -0
  161. package/src/mutations/auth/reset-password-options.ts +14 -0
  162. package/src/mutations/auth/send-verification-email-options.ts +14 -0
  163. package/src/mutations/auth/sign-in-email-options.ts +19 -0
  164. package/src/mutations/auth/sign-in-magic-link-options.ts +15 -0
  165. package/src/mutations/auth/sign-in-passkey-options.ts +15 -0
  166. package/src/mutations/auth/sign-in-social-options.ts +19 -0
  167. package/src/mutations/auth/sign-in-username-options.ts +15 -0
  168. package/src/mutations/auth/sign-out-options.ts +11 -0
  169. package/src/mutations/auth/sign-up-email-options.ts +15 -0
  170. package/src/mutations/auth-mutation-options.ts +49 -0
  171. package/src/mutations/settings/add-passkey-options.ts +15 -0
  172. package/src/mutations/settings/change-email-options.ts +11 -0
  173. package/src/mutations/settings/change-password-options.ts +14 -0
  174. package/src/mutations/settings/delete-passkey-options.ts +15 -0
  175. package/src/mutations/settings/delete-user-options.ts +11 -0
  176. package/src/mutations/settings/link-social-options.ts +11 -0
  177. package/src/mutations/settings/revoke-multi-session-options.ts +15 -0
  178. package/src/mutations/settings/revoke-session-options.ts +14 -0
  179. package/src/mutations/settings/set-active-session-options.ts +15 -0
  180. package/src/mutations/settings/unlink-account-options.ts +14 -0
  181. package/src/mutations/settings/update-user-options.ts +15 -0
  182. package/src/queries/auth/session-options.ts +18 -0
  183. package/src/queries/auth-query-options.ts +34 -0
  184. package/src/queries/settings/account-info-options.ts +25 -0
  185. package/src/queries/settings/list-accounts-options.ts +26 -0
  186. package/src/queries/settings/list-device-sessions-options.ts +24 -0
  187. package/src/queries/settings/list-sessions-options.ts +23 -0
  188. package/src/queries/settings/list-user-passkeys-options.ts +23 -0
  189. package/dist/hooks/auth/use-auth-mutation.d.ts +0 -18
  190. package/dist/hooks/auth/use-auth-mutation.js +0 -13
  191. package/dist/hooks/auth/use-auth-query.d.ts +0 -24
  192. package/dist/hooks/auth/use-auth-query.js +0 -13
  193. package/src/hooks/auth/use-auth-mutation.ts +0 -56
  194. package/src/hooks/auth/use-auth-query.ts +0 -50
@@ -1,13 +1,16 @@
1
1
  import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthMutationOptions } from './use-auth-mutation';
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?: UseAuthMutationOptions<AuthClient["signIn"]["social"]>): import('./use-auth-mutation').UseAuthMutationResult<(<FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
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
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
35
- 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";
36
- callbackURL?: string | undefined;
37
- newUserCallbackURL?: string | undefined;
38
- errorCallbackURL?: string | undefined;
39
- disableRedirect?: boolean | undefined;
40
- idToken?: {
41
- token: string;
42
- nonce?: string | undefined;
43
- accessToken?: string | undefined;
44
- refreshToken?: string | undefined;
45
- expiresAt?: number | undefined;
46
- user?: {
47
- name?: {
48
- firstName?: string | undefined;
49
- lastName?: string | undefined;
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
- } | undefined;
54
- scopes?: string[] | undefined;
55
- requestSignUp?: boolean | undefined;
56
- loginHint?: string | undefined;
57
- additionalData?: Record<string, any> | undefined;
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 { useAuthMutation as t } from "./use-auth-mutation.js";
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 n(n) {
5
- let { authClient: r } = e();
6
- return t({
7
- authFn: r.signIn.social,
8
- options: n
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 { n as useSignInSocial };
13
+ export { r as useSignInSocial };
@@ -1,53 +1,25 @@
1
1
  import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthMutationOptions } from './use-auth-mutation';
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
- * The mutation sends a username/password sign-in request and
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?: UseAuthMutationOptions<AuthClient["signIn"]["username"]>): import('./use-auth-mutation').UseAuthMutationResult<(<FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
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?: FetchOptions | undefined;
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
- displayUsername: string;
36
- };
37
- }, "user"> & {
38
- user: import('better-auth').StripEmptyObjects<{
39
- id: string;
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 { useAuthMutation as t } from "./use-auth-mutation.js";
3
- import { useQueryClient as n } from "@tanstack/react-query";
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 r(r) {
6
- let { authClient: i } = e(), a = n();
7
- return t({
8
- authFn: i.signIn.username,
9
- options: {
10
- ...r,
11
- onSuccess: async (...e) => {
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 { r as useSignInUsername };
17
+ export { a as useSignInUsername };
@@ -1,18 +1,18 @@
1
1
  import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthMutationOptions } from './use-auth-mutation';
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
- * The mutation signs out the current user and removes auth queries from cache.
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?: UseAuthMutationOptions<AuthClient["signOut"]>): import('./use-auth-mutation').UseAuthMutationResult<(<FetchOptions extends import('better-auth').ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import('better-auth').Prettify<{
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
- code?: string | undefined;
17
- message?: string | undefined;
18
- }, FetchOptions["throw"] extends true ? true : false>>)>;
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 { useAuthMutation as t } from "./use-auth-mutation.js";
3
- import { useQueryClient as n } from "@tanstack/react-query";
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 r(r) {
6
- let { authClient: i } = e(), a = n();
7
- return t({
8
- authFn: i.signOut,
9
- options: {
10
- ...r,
11
- onSuccess: async (...e) => {
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 { r as useSignOut };
16
+ export { i as useSignOut };
@@ -1,21 +1,16 @@
1
1
  import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthMutationOptions } from './use-auth-mutation';
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
- * The mutation sends an email/password sign-up request and
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?: UseAuthMutationOptions<AuthClient["signUp"]["email"]>): import('./use-auth-mutation').UseAuthMutationResult<(<FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
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
- id: string;
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
- id: string;
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
- }, FetchOptions>>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<(Omit<{
1219
- token: null;
1220
- user: {
1221
- id: string;
1222
- createdAt: Date;
1223
- updatedAt: Date;
1224
- email: string;
1225
- emailVerified: boolean;
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 { useAuthMutation as t } from "./use-auth-mutation.js";
3
- import { useQueryClient as n } from "@tanstack/react-query";
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 r(r) {
6
- let { authClient: i } = e(), a = n();
7
- return t({
8
- authFn: i.signUp.email,
9
- options: {
10
- ...r,
11
- onSuccess: async (...e) => {
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 { r as useSignUpEmail };
17
+ export { a as useSignUpEmail };
@@ -1,12 +1,14 @@
1
- import { AuthClient } from '../../lib/auth-client';
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
- * @param options - Options to merge into the React Query configuration for the session query.
7
- * @returns The React Query result with `data` containing the user object from the session.
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?: Partial<UseAuthQueryOptions<AuthClient["getSession"]>>): {
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 { UseAuthQueryOptions } from '../auth/use-auth-query';
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 account info for a given account ID.
6
+ * Retrieve provider-specific info for a linked account.
5
7
  *
6
- * Uses the `accountInfo` API endpoint to fetch detailed information
7
- * from the social provider. The provider is automatically detected
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 accountId - The provider-given account ID to fetch info for
11
- * @param options - Optional react-query options forwarded to `useQuery`
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(accountId?: string, options?: Partial<UseAuthQueryOptions<AuthClient["accountInfo"]>>): import('@tanstack/react-query').UseQueryResult<{
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 { useAuthQuery as t } from "../auth/use-auth-query.js";
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 n(n, r) {
5
- let { authClient: i } = e();
6
- return t({
7
- authFn: i.accountInfo,
8
- params: { query: { accountId: n } },
9
- options: {
10
- queryKey: [
11
- "auth",
12
- "accountInfo",
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 { n as useAccountInfo };
18
+ export { a as useAccountInfo };
@@ -1,13 +1,16 @@
1
1
  import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthMutationOptions } from '../auth/use-auth-mutation';
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 adding a new passkey.
6
+ * Hook that creates a mutation for registering a new passkey.
5
7
  *
6
- * Refetches the passkeys list on success.
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?: UseAuthMutationOptions<AuthClient["passkey"]["addPasskey"]>): import('../..').UseAuthMutationResult<(opts?: {
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
- } | undefined, fetchOpts?: import('better-auth').ClientFetchOption | undefined) => Promise<{
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 { useAuthMutation as t } from "../auth/use-auth-mutation.js";
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 r(r) {
6
- let { authClient: i } = e(), { refetch: a } = n();
7
- return t({
8
- authFn: i.passkey.addPasskey,
9
- options: {
10
- ...r,
11
- onSuccess: async (...e) => {
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 { r as useAddPasskey };
17
+ export { i as useAddPasskey };