@better-auth-ui/react 1.6.2 → 1.6.4

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 (271) hide show
  1. package/dist/components/auth/auth-provider.d.ts +23 -8
  2. package/dist/components/auth/auth-provider.js +32 -17
  3. package/dist/components/{email → auth/email}/email-changed.js +2 -2
  4. package/dist/components/{email → auth/email}/email-localization.js +1 -1
  5. package/dist/components/{email → auth/email}/email-styles.js +1 -1
  6. package/dist/components/{email → auth/email}/email-verification.js +2 -2
  7. package/dist/components/{email → auth/email}/magic-link.js +2 -2
  8. package/dist/components/{email → auth/email}/new-device.js +2 -2
  9. package/dist/components/{email → auth/email}/otp-email.js +2 -2
  10. package/dist/components/{email → auth/email}/password-changed.js +2 -2
  11. package/dist/components/{email → auth/email}/reset-password.js +2 -2
  12. package/dist/email.d.ts +1 -0
  13. package/dist/email.js +11 -0
  14. package/dist/hooks/auth/use-authenticate.d.ts +6 -5
  15. package/dist/hooks/auth/use-authenticate.js +12 -12
  16. package/dist/hooks/auth/use-user.d.ts +18 -311
  17. package/dist/hooks/auth/use-user.js +5 -5
  18. package/dist/hooks/use-auth-mutation.d.ts +17 -0
  19. package/dist/hooks/use-auth-mutation.js +11 -0
  20. package/dist/hooks/use-auth-plugin.d.ts +31 -0
  21. package/dist/hooks/use-auth-plugin.js +10 -0
  22. package/dist/hooks/use-auth-query.d.ts +14 -0
  23. package/dist/hooks/use-auth-query.js +15 -0
  24. package/dist/index.d.ts +35 -34
  25. package/dist/index.js +74 -83
  26. package/dist/lib/auth-client.d.ts +23 -3687
  27. package/dist/lib/auth-plugin.d.ts +59 -0
  28. package/dist/lib/auth-server.d.ts +16 -0
  29. package/dist/mutations/auth/request-password-reset-mutation.d.ts +26 -0
  30. package/dist/mutations/auth/request-password-reset-mutation.js +24 -0
  31. package/dist/mutations/auth/reset-password-mutation.d.ts +25 -0
  32. package/dist/mutations/auth/reset-password-mutation.js +24 -0
  33. package/dist/mutations/auth/send-verification-email-mutation.d.ts +24 -0
  34. package/dist/mutations/auth/send-verification-email-mutation.js +24 -0
  35. package/dist/mutations/auth/sign-in-email-mutation.d.ts +71 -0
  36. package/dist/mutations/auth/sign-in-email-mutation.js +29 -0
  37. package/dist/mutations/auth/sign-in-social-mutation.d.ts +77 -0
  38. package/dist/mutations/auth/sign-in-social-mutation.js +24 -0
  39. package/dist/mutations/auth/sign-out-mutation.d.ts +25 -0
  40. package/dist/mutations/auth/sign-out-mutation.js +28 -0
  41. package/dist/mutations/auth/sign-up-email-mutation.d.ts +105 -0
  42. package/dist/mutations/auth/sign-up-email-mutation.js +29 -0
  43. package/dist/mutations/auth-mutation-options.d.ts +42 -0
  44. package/dist/mutations/auth-mutation-options.js +19 -0
  45. package/dist/mutations/magic-link/sign-in-magic-link-mutation.d.ts +24 -0
  46. package/dist/mutations/magic-link/sign-in-magic-link-mutation.js +24 -0
  47. package/dist/mutations/multi-session/revoke-multi-session-mutation.d.ts +25 -0
  48. package/dist/mutations/multi-session/revoke-multi-session-mutation.js +29 -0
  49. package/dist/mutations/multi-session/set-active-session-mutation.d.ts +62 -0
  50. package/dist/mutations/multi-session/set-active-session-mutation.js +31 -0
  51. package/dist/mutations/passkey/add-passkey-mutation.d.ts +71 -0
  52. package/dist/mutations/passkey/add-passkey-mutation.js +29 -0
  53. package/dist/mutations/passkey/delete-passkey-mutation.d.ts +25 -0
  54. package/dist/mutations/passkey/delete-passkey-mutation.js +29 -0
  55. package/dist/mutations/passkey/sign-in-passkey-mutation.d.ts +105 -0
  56. package/dist/mutations/passkey/sign-in-passkey-mutation.js +29 -0
  57. package/dist/mutations/settings/change-email-mutation.d.ts +25 -0
  58. package/dist/mutations/settings/change-email-mutation.js +29 -0
  59. package/dist/mutations/settings/change-password-mutation.d.ts +78 -0
  60. package/dist/mutations/settings/change-password-mutation.js +24 -0
  61. package/dist/mutations/settings/delete-user-mutation.d.ts +26 -0
  62. package/dist/mutations/settings/delete-user-mutation.js +24 -0
  63. package/dist/mutations/settings/link-social-mutation.d.ts +26 -0
  64. package/dist/mutations/settings/link-social-mutation.js +24 -0
  65. package/dist/mutations/settings/revoke-session-mutation.d.ts +25 -0
  66. package/dist/mutations/settings/revoke-session-mutation.js +29 -0
  67. package/dist/mutations/settings/unlink-account-mutation.d.ts +25 -0
  68. package/dist/mutations/settings/unlink-account-mutation.js +29 -0
  69. package/dist/mutations/settings/update-user-mutation.d.ts +25 -0
  70. package/dist/mutations/settings/update-user-mutation.js +35 -0
  71. package/dist/mutations/username/is-username-available-mutation.d.ts +27 -0
  72. package/dist/mutations/username/is-username-available-mutation.js +24 -0
  73. package/dist/mutations/username/sign-in-username-mutation.d.ts +75 -0
  74. package/dist/mutations/username/sign-in-username-mutation.js +29 -0
  75. package/dist/queries/auth/session-query.d.ts +71 -0
  76. package/dist/queries/auth/session-query.js +30 -0
  77. package/dist/queries/auth-query-options.d.ts +40 -0
  78. package/dist/queries/auth-query-options.js +17 -0
  79. package/dist/queries/multi-session/list-device-sessions-query.d.ts +76 -0
  80. package/dist/queries/multi-session/list-device-sessions-query.js +31 -0
  81. package/dist/queries/passkey/list-passkeys-query.d.ts +74 -0
  82. package/dist/queries/passkey/list-passkeys-query.js +31 -0
  83. package/dist/queries/settings/account-info-query.d.ts +85 -0
  84. package/dist/queries/settings/account-info-query.js +31 -0
  85. package/dist/queries/settings/list-accounts-query.d.ts +76 -0
  86. package/dist/queries/settings/list-accounts-query.js +31 -0
  87. package/dist/queries/settings/list-sessions-query.d.ts +74 -0
  88. package/dist/queries/settings/list-sessions-query.js +31 -0
  89. package/dist/server/queries/auth/session-query.d.ts +57 -0
  90. package/dist/server/queries/auth/session-query.js +13 -0
  91. package/dist/server/queries/multi-session/list-device-sessions-query.d.ts +60 -0
  92. package/dist/server/queries/multi-session/list-device-sessions-query.js +12 -0
  93. package/dist/server/queries/passkey/list-passkeys-query.d.ts +60 -0
  94. package/dist/server/queries/passkey/list-passkeys-query.js +12 -0
  95. package/dist/server/queries/settings/account-info-query.d.ts +68 -0
  96. package/dist/server/queries/settings/account-info-query.js +12 -0
  97. package/dist/server/queries/settings/list-accounts-query.d.ts +60 -0
  98. package/dist/server/queries/settings/list-accounts-query.js +12 -0
  99. package/dist/server/queries/settings/list-sessions-query.d.ts +60 -0
  100. package/dist/server/queries/settings/list-sessions-query.js +12 -0
  101. package/dist/server.d.ts +7 -0
  102. package/dist/server.js +7 -0
  103. package/package.json +24 -22
  104. package/src/components/auth/auth-provider.tsx +87 -24
  105. package/src/components/{email → auth/email}/email-changed.tsx +1 -1
  106. package/src/components/{email → auth/email}/email-verification.tsx +1 -1
  107. package/src/components/{email → auth/email}/magic-link.tsx +1 -1
  108. package/src/components/{email → auth/email}/new-device.tsx +1 -1
  109. package/src/components/{email → auth/email}/otp-email.tsx +1 -1
  110. package/src/components/{email → auth/email}/password-changed.tsx +1 -1
  111. package/src/components/{email → auth/email}/reset-password.tsx +1 -1
  112. package/src/email.ts +1 -0
  113. package/src/hooks/auth/use-authenticate.ts +13 -10
  114. package/src/hooks/auth/use-user.ts +12 -8
  115. package/src/hooks/use-auth-mutation.ts +47 -0
  116. package/src/hooks/use-auth-plugin.ts +50 -0
  117. package/src/hooks/use-auth-query.ts +40 -0
  118. package/src/index.ts +35 -34
  119. package/src/lib/auth-client.ts +33 -31
  120. package/src/lib/auth-plugin.ts +75 -0
  121. package/src/lib/auth-server.ts +30 -0
  122. package/src/mutations/auth/request-password-reset-mutation.ts +58 -0
  123. package/src/mutations/auth/reset-password-mutation.ts +60 -0
  124. package/src/mutations/auth/send-verification-email-mutation.ts +58 -0
  125. package/src/mutations/auth/sign-in-email-mutation.ts +78 -0
  126. package/src/mutations/auth/sign-in-social-mutation.ts +64 -0
  127. package/src/mutations/auth/sign-out-mutation.ts +71 -0
  128. package/src/mutations/auth/sign-up-email-mutation.ts +74 -0
  129. package/src/mutations/auth-mutation-options.ts +94 -0
  130. package/src/mutations/magic-link/sign-in-magic-link-mutation.ts +59 -0
  131. package/src/mutations/multi-session/revoke-multi-session-mutation.ts +70 -0
  132. package/src/mutations/multi-session/set-active-session-mutation.ts +98 -0
  133. package/src/mutations/passkey/add-passkey-mutation.ts +66 -0
  134. package/src/mutations/passkey/delete-passkey-mutation.ts +66 -0
  135. package/src/mutations/passkey/sign-in-passkey-mutation.ts +74 -0
  136. package/src/mutations/settings/change-email-mutation.ts +67 -0
  137. package/src/mutations/settings/change-password-mutation.ts +59 -0
  138. package/src/mutations/settings/delete-user-mutation.ts +59 -0
  139. package/src/mutations/settings/link-social-mutation.ts +59 -0
  140. package/src/mutations/settings/revoke-session-mutation.ts +69 -0
  141. package/src/mutations/settings/unlink-account-mutation.ts +67 -0
  142. package/src/mutations/settings/update-user-mutation.ts +82 -0
  143. package/src/mutations/username/is-username-available-mutation.ts +62 -0
  144. package/src/mutations/username/sign-in-username-mutation.ts +74 -0
  145. package/src/queries/auth/session-query.ts +135 -0
  146. package/src/queries/auth-query-options.ts +83 -0
  147. package/src/queries/multi-session/list-device-sessions-query.ts +177 -0
  148. package/src/queries/passkey/list-passkeys-query.ts +154 -0
  149. package/src/queries/settings/account-info-query.ts +158 -0
  150. package/src/queries/settings/list-accounts-query.ts +156 -0
  151. package/src/queries/settings/list-sessions-query.ts +154 -0
  152. package/src/server/queries/auth/session-query.ts +94 -0
  153. package/src/server/queries/multi-session/list-device-sessions-query.ts +102 -0
  154. package/src/server/queries/passkey/list-passkeys-query.ts +100 -0
  155. package/src/server/queries/settings/account-info-query.ts +101 -0
  156. package/src/server/queries/settings/list-accounts-query.ts +101 -0
  157. package/src/server/queries/settings/list-sessions-query.ts +101 -0
  158. package/src/server.ts +7 -0
  159. package/dist/core.d.ts +0 -1
  160. package/dist/core.js +0 -1
  161. package/dist/hooks/auth/use-auth-mutation.d.ts +0 -18
  162. package/dist/hooks/auth/use-auth-mutation.js +0 -13
  163. package/dist/hooks/auth/use-auth-query.d.ts +0 -24
  164. package/dist/hooks/auth/use-auth-query.js +0 -13
  165. package/dist/hooks/auth/use-is-username-available.d.ts +0 -19
  166. package/dist/hooks/auth/use-is-username-available.js +0 -12
  167. package/dist/hooks/auth/use-request-password-reset.d.ts +0 -25
  168. package/dist/hooks/auth/use-request-password-reset.js +0 -12
  169. package/dist/hooks/auth/use-reset-password.d.ts +0 -39
  170. package/dist/hooks/auth/use-reset-password.js +0 -12
  171. package/dist/hooks/auth/use-send-verification-email.d.ts +0 -23
  172. package/dist/hooks/auth/use-send-verification-email.js +0 -12
  173. package/dist/hooks/auth/use-session.d.ts +0 -9
  174. package/dist/hooks/auth/use-session.js +0 -15
  175. package/dist/hooks/auth/use-sign-in-email.d.ts +0 -52
  176. package/dist/hooks/auth/use-sign-in-email.js +0 -18
  177. package/dist/hooks/auth/use-sign-in-magic-link.d.ts +0 -31
  178. package/dist/hooks/auth/use-sign-in-magic-link.js +0 -12
  179. package/dist/hooks/auth/use-sign-in-passkey.d.ts +0 -58
  180. package/dist/hooks/auth/use-sign-in-passkey.js +0 -18
  181. package/dist/hooks/auth/use-sign-in-social.d.ts +0 -92
  182. package/dist/hooks/auth/use-sign-in-social.js +0 -12
  183. package/dist/hooks/auth/use-sign-in-username.d.ts +0 -53
  184. package/dist/hooks/auth/use-sign-in-username.js +0 -18
  185. package/dist/hooks/auth/use-sign-out.d.ts +0 -18
  186. package/dist/hooks/auth/use-sign-out.js +0 -18
  187. package/dist/hooks/auth/use-sign-up-email.d.ts +0 -1269
  188. package/dist/hooks/auth/use-sign-up-email.js +0 -18
  189. package/dist/hooks/settings/use-account-info.d.ts +0 -17
  190. package/dist/hooks/settings/use-account-info.js +0 -21
  191. package/dist/hooks/settings/use-add-passkey.d.ts +0 -43
  192. package/dist/hooks/settings/use-add-passkey.js +0 -18
  193. package/dist/hooks/settings/use-change-email.d.ts +0 -24
  194. package/dist/hooks/settings/use-change-email.js +0 -18
  195. package/dist/hooks/settings/use-change-password.d.ts +0 -53
  196. package/dist/hooks/settings/use-change-password.js +0 -12
  197. package/dist/hooks/settings/use-delete-passkey.d.ts +0 -21
  198. package/dist/hooks/settings/use-delete-passkey.js +0 -18
  199. package/dist/hooks/settings/use-delete-user.d.ts +0 -41
  200. package/dist/hooks/settings/use-delete-user.js +0 -12
  201. package/dist/hooks/settings/use-link-social.d.ts +0 -46
  202. package/dist/hooks/settings/use-link-social.js +0 -12
  203. package/dist/hooks/settings/use-list-accounts.d.ts +0 -20
  204. package/dist/hooks/settings/use-list-accounts.js +0 -21
  205. package/dist/hooks/settings/use-list-device-sessions.d.ts +0 -11
  206. package/dist/hooks/settings/use-list-device-sessions.js +0 -21
  207. package/dist/hooks/settings/use-list-sessions.d.ts +0 -20
  208. package/dist/hooks/settings/use-list-sessions.js +0 -21
  209. package/dist/hooks/settings/use-list-user-passkeys.d.ts +0 -11
  210. package/dist/hooks/settings/use-list-user-passkeys.js +0 -21
  211. package/dist/hooks/settings/use-revoke-multi-session.d.ts +0 -19
  212. package/dist/hooks/settings/use-revoke-multi-session.js +0 -18
  213. package/dist/hooks/settings/use-revoke-session.d.ts +0 -19
  214. package/dist/hooks/settings/use-revoke-session.js +0 -18
  215. package/dist/hooks/settings/use-set-active-session.d.ts +0 -37
  216. package/dist/hooks/settings/use-set-active-session.js +0 -21
  217. package/dist/hooks/settings/use-unlink-account.d.ts +0 -21
  218. package/dist/hooks/settings/use-unlink-account.js +0 -18
  219. package/dist/hooks/settings/use-update-user.d.ts +0 -11
  220. package/dist/hooks/settings/use-update-user.js +0 -25
  221. package/dist/lib/auth-client.js +0 -11
  222. package/dist/lib/auth-config.d.ts +0 -43
  223. package/dist/lib/auth-context.d.ts +0 -2
  224. package/dist/lib/auth-context.js +0 -6
  225. package/src/core.ts +0 -1
  226. package/src/hooks/auth/use-auth-mutation.ts +0 -56
  227. package/src/hooks/auth/use-auth-query.ts +0 -50
  228. package/src/hooks/auth/use-is-username-available.ts +0 -22
  229. package/src/hooks/auth/use-request-password-reset.ts +0 -22
  230. package/src/hooks/auth/use-reset-password.ts +0 -21
  231. package/src/hooks/auth/use-send-verification-email.ts +0 -21
  232. package/src/hooks/auth/use-session.ts +0 -27
  233. package/src/hooks/auth/use-sign-in-email.ts +0 -34
  234. package/src/hooks/auth/use-sign-in-magic-link.ts +0 -21
  235. package/src/hooks/auth/use-sign-in-passkey.ts +0 -34
  236. package/src/hooks/auth/use-sign-in-social.ts +0 -21
  237. package/src/hooks/auth/use-sign-in-username.ts +0 -34
  238. package/src/hooks/auth/use-sign-out.ts +0 -33
  239. package/src/hooks/auth/use-sign-up-email.ts +0 -34
  240. package/src/hooks/settings/use-account-info.ts +0 -31
  241. package/src/hooks/settings/use-add-passkey.ts +0 -32
  242. package/src/hooks/settings/use-change-email.ts +0 -33
  243. package/src/hooks/settings/use-change-password.ts +0 -19
  244. package/src/hooks/settings/use-delete-passkey.ts +0 -32
  245. package/src/hooks/settings/use-delete-user.ts +0 -19
  246. package/src/hooks/settings/use-link-social.ts +0 -19
  247. package/src/hooks/settings/use-list-accounts.ts +0 -29
  248. package/src/hooks/settings/use-list-device-sessions.ts +0 -34
  249. package/src/hooks/settings/use-list-sessions.ts +0 -28
  250. package/src/hooks/settings/use-list-user-passkeys.ts +0 -30
  251. package/src/hooks/settings/use-revoke-multi-session.ts +0 -30
  252. package/src/hooks/settings/use-revoke-session.ts +0 -30
  253. package/src/hooks/settings/use-set-active-session.ts +0 -47
  254. package/src/hooks/settings/use-unlink-account.ts +0 -30
  255. package/src/hooks/settings/use-update-user.ts +0 -43
  256. package/src/lib/auth-config.ts +0 -48
  257. package/src/lib/auth-context.ts +0 -6
  258. /package/dist/components/{email → auth/email}/email-changed.d.ts +0 -0
  259. /package/dist/components/{email → auth/email}/email-localization.d.ts +0 -0
  260. /package/dist/components/{email → auth/email}/email-styles.d.ts +0 -0
  261. /package/dist/components/{email → auth/email}/email-verification.d.ts +0 -0
  262. /package/dist/components/{email → auth/email}/index.d.ts +0 -0
  263. /package/dist/components/{email → auth/email}/index.js +0 -0
  264. /package/dist/components/{email → auth/email}/magic-link.d.ts +0 -0
  265. /package/dist/components/{email → auth/email}/new-device.d.ts +0 -0
  266. /package/dist/components/{email → auth/email}/otp-email.d.ts +0 -0
  267. /package/dist/components/{email → auth/email}/password-changed.d.ts +0 -0
  268. /package/dist/components/{email → auth/email}/reset-password.d.ts +0 -0
  269. /package/src/components/{email → auth/email}/email-localization.tsx +0 -0
  270. /package/src/components/{email → auth/email}/email-styles.tsx +0 -0
  271. /package/src/components/{email → auth/email}/index.ts +0 -0
@@ -1,18 +0,0 @@
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";
4
- //#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
- }
14
- }
15
- });
16
- }
17
- //#endregion
18
- export { r as useSignUpEmail };
@@ -1,17 +0,0 @@
1
- import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthQueryOptions } from '../auth/use-auth-query';
3
- /**
4
- * Retrieve provider-specific account info for a given account ID.
5
- *
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.
9
- *
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
13
- */
14
- export declare function useAccountInfo(accountId?: string, options?: Partial<UseAuthQueryOptions<AuthClient["accountInfo"]>>): import('@tanstack/react-query').UseQueryResult<{
15
- user: import('better-auth').OAuth2UserInfo;
16
- data: Record<string, any>;
17
- } | null, import('better-auth/client').BetterFetchError>;
@@ -1,21 +0,0 @@
1
- import { useAuth as e } from "../../components/auth/auth-provider.js";
2
- import { useAuthQuery as t } from "../auth/use-auth-query.js";
3
- //#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
- }
18
- });
19
- }
20
- //#endregion
21
- export { n as useAccountInfo };
@@ -1,43 +0,0 @@
1
- import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthMutationOptions } from '../auth/use-auth-mutation';
3
- /**
4
- * Hook that creates a mutation for adding a new passkey.
5
- *
6
- * Refetches the passkeys list on success.
7
- *
8
- * @returns The `useMutation` result.
9
- */
10
- export declare function useAddPasskey(options?: UseAuthMutationOptions<AuthClient["passkey"]["addPasskey"]>): import('../..').UseAuthMutationResult<(opts?: {
11
- fetchOptions?: import('better-auth').ClientFetchOption;
12
- name?: string;
13
- authenticatorAttachment?: "platform" | "cross-platform";
14
- context?: string | null;
15
- extensions?: import('@better-auth/passkey/client').AuthenticationExtensionsClientInputs;
16
- useAutoRegister?: boolean;
17
- 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
- }>>;
@@ -1,18 +0,0 @@
1
- import { useAuth as e } from "../../components/auth/auth-provider.js";
2
- import { useAuthMutation as t } from "../auth/use-auth-mutation.js";
3
- import { useListUserPasskeys as n } from "./use-list-user-passkeys.js";
4
- //#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
- }
14
- }
15
- });
16
- }
17
- //#endregion
18
- export { r as useAddPasskey };
@@ -1,24 +0,0 @@
1
- import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthMutationOptions } from '../auth/use-auth-mutation';
3
- /**
4
- * Hook that creates a mutation for changing the current user's email address.
5
- *
6
- * The mutation sends an email-change request and shows success or error toasts.
7
- * On success the callback URL is set to the account settings view.
8
- *
9
- * @returns The `useMutation` result.
10
- */
11
- export declare function useChangeEmail(options?: UseAuthMutationOptions<AuthClient["changeEmail"]>): import('../..').UseAuthMutationResult<(<FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
12
- newEmail: string;
13
- callbackURL?: string | undefined;
14
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
15
- newEmail: string;
16
- callbackURL?: string | undefined;
17
- } & {
18
- fetchOptions?: FetchOptions | undefined;
19
- }>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<{
20
- status: boolean;
21
- }, {
22
- code?: string | undefined;
23
- message?: string | undefined;
24
- }, FetchOptions["throw"] extends true ? true : false>>)>;
@@ -1,18 +0,0 @@
1
- import { useAuth as e } from "../../components/auth/auth-provider.js";
2
- import { useAuthMutation as t } from "../auth/use-auth-mutation.js";
3
- import { useSession as n } from "../auth/use-session.js";
4
- //#region src/hooks/settings/use-change-email.ts
5
- function r(r) {
6
- let { authClient: i } = e(), { refetch: a } = n({ refetchOnMount: !1 });
7
- return t({
8
- authFn: i.changeEmail,
9
- options: {
10
- ...r,
11
- onSuccess: async (...e) => {
12
- a(), await r?.onSuccess?.(...e);
13
- }
14
- }
15
- });
16
- }
17
- //#endregion
18
- export { r as useChangeEmail };
@@ -1,53 +0,0 @@
1
- import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthMutationOptions } from '../auth/use-auth-mutation';
3
- /**
4
- * Hook that creates a mutation for changing the authenticated user's password.
5
- *
6
- * @returns The `useMutation` result.
7
- */
8
- export declare function useChangePassword(options?: UseAuthMutationOptions<AuthClient["changePassword"]>): import('../..').UseAuthMutationResult<(<FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
9
- newPassword: string;
10
- currentPassword: string;
11
- revokeOtherSessions?: boolean | undefined;
12
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
13
- newPassword: string;
14
- currentPassword: string;
15
- revokeOtherSessions?: boolean | undefined;
16
- } & {
17
- fetchOptions?: FetchOptions | undefined;
18
- }>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<Omit<{
19
- token: string | null;
20
- user: {
21
- id: string;
22
- createdAt: Date;
23
- updatedAt: Date;
24
- email: string;
25
- emailVerified: boolean;
26
- name: string;
27
- image?: string | null | undefined;
28
- } & Record<string, any> & {
29
- id: string;
30
- createdAt: Date;
31
- updatedAt: Date;
32
- email: string;
33
- emailVerified: boolean;
34
- name: string;
35
- image?: string | null | undefined;
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>>)>;
@@ -1,12 +0,0 @@
1
- import { useAuth as e } from "../../components/auth/auth-provider.js";
2
- import { useAuthMutation as t } from "../auth/use-auth-mutation.js";
3
- //#region src/hooks/settings/use-change-password.ts
4
- function n(n) {
5
- let { authClient: r } = e();
6
- return t({
7
- authFn: r.changePassword,
8
- options: n
9
- });
10
- }
11
- //#endregion
12
- export { n as useChangePassword };
@@ -1,21 +0,0 @@
1
- import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthMutationOptions } from '../auth/use-auth-mutation';
3
- /**
4
- * Hook that creates a mutation for deleting a passkey.
5
- *
6
- * Refetches the passkeys list on success.
7
- *
8
- * @returns The `useMutation` result.
9
- */
10
- export declare function useDeletePasskey(options?: UseAuthMutationOptions<AuthClient["passkey"]["deletePasskey"]>): import('../..').UseAuthMutationResult<(<FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
11
- id: string;
12
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
13
- id: string;
14
- } & {
15
- fetchOptions?: FetchOptions | undefined;
16
- }>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<{
17
- status: boolean;
18
- }, {
19
- code?: string | undefined;
20
- message?: string | undefined;
21
- }, FetchOptions["throw"] extends true ? true : false>>)>;
@@ -1,18 +0,0 @@
1
- import { useAuth as e } from "../../components/auth/auth-provider.js";
2
- import { useAuthMutation as t } from "../auth/use-auth-mutation.js";
3
- import { useListUserPasskeys as n } from "./use-list-user-passkeys.js";
4
- //#region src/hooks/settings/use-delete-passkey.ts
5
- function r(r) {
6
- let { authClient: i } = e(), { refetch: a } = n();
7
- return t({
8
- authFn: i.passkey.deletePasskey,
9
- options: {
10
- ...r,
11
- onSuccess: async (...e) => {
12
- await a(), await r?.onSuccess?.(...e);
13
- }
14
- }
15
- });
16
- }
17
- //#endregion
18
- export { r as useDeletePasskey };
@@ -1,41 +0,0 @@
1
- import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthMutationOptions } from '../auth/use-auth-mutation';
3
- /**
4
- * Hook that creates a mutation for deleting the authenticated user account.
5
- *
6
- * @returns The `useMutation` result.
7
- */
8
- export declare function useDeleteUser(options?: UseAuthMutationOptions<AuthClient["deleteUser"]>): import('../..').UseAuthMutationResult<(<FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
9
- callbackURL?: string | undefined;
10
- password?: string | undefined;
11
- token?: string | undefined;
12
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import('better-auth').Prettify<{
13
- callbackURL?: string | undefined;
14
- password?: string | undefined;
15
- token?: string | undefined;
16
- } & {
17
- fetchOptions?: FetchOptions | undefined;
18
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<{
19
- success: boolean;
20
- message: string;
21
- }, {
22
- code?: string | undefined;
23
- message?: string | undefined;
24
- }, FetchOptions["throw"] extends true ? true : false>>) & {
25
- callback: <FetchOptions extends import('better-auth').ClientFetchOption<never, Partial<{
26
- token: string;
27
- callbackURL?: string | undefined;
28
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
29
- query: {
30
- token: string;
31
- callbackURL?: string | undefined;
32
- };
33
- fetchOptions?: FetchOptions | undefined;
34
- }>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<{
35
- success: boolean;
36
- message: string;
37
- }, {
38
- code?: string | undefined;
39
- message?: string | undefined;
40
- }, FetchOptions["throw"] extends true ? true : false>>;
41
- }>;
@@ -1,12 +0,0 @@
1
- import { useAuth as e } from "../../components/auth/auth-provider.js";
2
- import { useAuthMutation as t } from "../auth/use-auth-mutation.js";
3
- //#region src/hooks/settings/use-delete-user.ts
4
- function n(n) {
5
- let { authClient: r } = e();
6
- return t({
7
- authFn: r.deleteUser,
8
- options: n
9
- });
10
- }
11
- //#endregion
12
- export { n as useDeleteUser };
@@ -1,46 +0,0 @@
1
- import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthMutationOptions } from '../auth/use-auth-mutation';
3
- /**
4
- * Hook that creates a mutation for linking a social provider to the current user.
5
- *
6
- * @returns The `useMutation` result.
7
- */
8
- export declare function useLinkSocial(options?: UseAuthMutationOptions<AuthClient["linkSocial"]>): import('../..').UseAuthMutationResult<(<FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
9
- provider: unknown;
10
- callbackURL?: string | undefined;
11
- idToken?: {
12
- token: string;
13
- nonce?: string | undefined;
14
- accessToken?: string | undefined;
15
- refreshToken?: string | undefined;
16
- scopes?: string[] | undefined;
17
- } | undefined;
18
- requestSignUp?: boolean | undefined;
19
- scopes?: string[] | undefined;
20
- errorCallbackURL?: string | undefined;
21
- disableRedirect?: boolean | undefined;
22
- additionalData?: Record<string, any> | undefined;
23
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
24
- provider: unknown;
25
- callbackURL?: string | undefined;
26
- idToken?: {
27
- token: string;
28
- nonce?: string | undefined;
29
- accessToken?: string | undefined;
30
- refreshToken?: string | undefined;
31
- scopes?: string[] | undefined;
32
- } | undefined;
33
- requestSignUp?: boolean | undefined;
34
- scopes?: string[] | undefined;
35
- errorCallbackURL?: string | undefined;
36
- disableRedirect?: boolean | undefined;
37
- additionalData?: Record<string, any> | undefined;
38
- } & {
39
- fetchOptions?: FetchOptions | undefined;
40
- }>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<{
41
- url: string;
42
- redirect: boolean;
43
- }, {
44
- code?: string | undefined;
45
- message?: string | undefined;
46
- }, FetchOptions["throw"] extends true ? true : false>>)>;
@@ -1,12 +0,0 @@
1
- import { useAuth as e } from "../../components/auth/auth-provider.js";
2
- import { useAuthMutation as t } from "../auth/use-auth-mutation.js";
3
- //#region src/hooks/settings/use-link-social.ts
4
- function n(n) {
5
- let { authClient: r } = e();
6
- return t({
7
- authFn: r.linkSocial,
8
- options: n
9
- });
10
- }
11
- //#endregion
12
- export { n as useLinkSocial };
@@ -1,20 +0,0 @@
1
- import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthQueryOptions } from '../auth/use-auth-query';
3
- /**
4
- * Retrieve the current user's linked social accounts.
5
- *
6
- * The query runs only when at least one social provider is configured and a session exists.
7
- * The provided `options` are forwarded to both `useSession` and `useQuery`, allowing customization of initial data and query behavior.
8
- *
9
- * @param options - Optional react-query / initial-data options forwarded to `useSession` and `useQuery`
10
- * @returns The react-query result containing linked accounts data, loading state, and error state
11
- */
12
- export declare function useListAccounts(options?: Partial<UseAuthQueryOptions<AuthClient["listAccounts"]>>): import('@tanstack/react-query').UseQueryResult<{
13
- scopes: string[];
14
- id: string;
15
- createdAt: Date;
16
- updatedAt: Date;
17
- userId: string;
18
- providerId: string;
19
- accountId: string;
20
- }[] | null, import('better-auth/client').BetterFetchError>;
@@ -1,21 +0,0 @@
1
- import { useAuth as e } from "../../components/auth/auth-provider.js";
2
- import { useAuthQuery as t } from "../auth/use-auth-query.js";
3
- import { useSession as n } from "../auth/use-session.js";
4
- //#region src/hooks/settings/use-list-accounts.ts
5
- function r(r) {
6
- let { authClient: i } = e(), { data: a } = n({ refetchOnMount: !1 });
7
- return t({
8
- authFn: i.listAccounts,
9
- options: {
10
- queryKey: [
11
- "auth",
12
- "listAccounts",
13
- a?.user.id
14
- ],
15
- enabled: !!a,
16
- ...r
17
- }
18
- });
19
- }
20
- //#endregion
21
- export { r as useListAccounts };
@@ -1,11 +0,0 @@
1
- import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthQueryOptions, UseAuthQueryResult } from '../auth/use-auth-query';
3
- /**
4
- * Retrieve device sessions for multi-session account switching.
5
- *
6
- * The query is enabled only when `multiSession` is true and session data is available.
7
- *
8
- * @param options - Optional React Query options to customize the query behavior.
9
- * @returns The React Query result for the device sessions list; `data` is the array of device session objects and includes loading and error states.
10
- */
11
- export declare function useListDeviceSessions(options?: Partial<UseAuthQueryOptions<AuthClient["multiSession"]["listDeviceSessions"]>>): UseAuthQueryResult<AuthClient["multiSession"]["listDeviceSessions"]>;
@@ -1,21 +0,0 @@
1
- import { useAuth as e } from "../../components/auth/auth-provider.js";
2
- import { useAuthQuery as t } from "../auth/use-auth-query.js";
3
- import { useSession as n } from "../auth/use-session.js";
4
- //#region src/hooks/settings/use-list-device-sessions.ts
5
- function r(r) {
6
- let { authClient: i } = e(), { data: a } = n({ refetchOnMount: !1 });
7
- return t({
8
- authFn: i.multiSession.listDeviceSessions,
9
- options: {
10
- queryKey: [
11
- "auth",
12
- "multiSession",
13
- "listDeviceSessions"
14
- ],
15
- enabled: !!a,
16
- ...r
17
- }
18
- });
19
- }
20
- //#endregion
21
- export { r as useListDeviceSessions };
@@ -1,20 +0,0 @@
1
- import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthQueryOptions } from '../auth/use-auth-query';
3
- /**
4
- * Retrieve the active sessions (devices where the current user is signed in).
5
- *
6
- * The underlying query is enabled only when session data is available.
7
- *
8
- * @param options - Optional React Query options to customize the query behavior.
9
- * @returns The React Query result for the sessions list; `data` is the array of session objects, and the result includes loading and error states.
10
- */
11
- export declare function useListSessions(options?: Partial<UseAuthQueryOptions<AuthClient["listSessions"]>>): import('@tanstack/react-query').UseQueryResult<import('better-auth').Prettify<{
12
- id: string;
13
- createdAt: Date;
14
- updatedAt: Date;
15
- userId: string;
16
- expiresAt: Date;
17
- token: string;
18
- ipAddress?: string | null | undefined | undefined;
19
- userAgent?: string | null | undefined | undefined;
20
- }>[] | null, import('better-auth/client').BetterFetchError>;
@@ -1,21 +0,0 @@
1
- import { useAuth as e } from "../../components/auth/auth-provider.js";
2
- import { useAuthQuery as t } from "../auth/use-auth-query.js";
3
- import { useSession as n } from "../auth/use-session.js";
4
- //#region src/hooks/settings/use-list-sessions.ts
5
- function r(r) {
6
- let { authClient: i } = e(), { data: a } = n({ refetchOnMount: !1 });
7
- return t({
8
- authFn: i.listSessions,
9
- options: {
10
- queryKey: [
11
- "auth",
12
- "listSessions",
13
- a?.user.id
14
- ],
15
- enabled: !!a,
16
- ...r
17
- }
18
- });
19
- }
20
- //#endregion
21
- export { r as useListSessions };
@@ -1,11 +0,0 @@
1
- import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthQueryOptions } from '../auth/use-auth-query';
3
- /**
4
- * Retrieve the passkeys registered for the current user.
5
- *
6
- * The underlying query is enabled only when session data is available.
7
- *
8
- * @param options - Optional React Query options to customize the query behavior.
9
- * @returns The React Query result for the passkeys list.
10
- */
11
- export declare function useListUserPasskeys(options?: Partial<UseAuthQueryOptions<AuthClient["passkey"]["listUserPasskeys"]>>): import('@tanstack/react-query').UseQueryResult<import('@better-auth/passkey/client').Passkey[] | null, import('better-auth/client').BetterFetchError>;
@@ -1,21 +0,0 @@
1
- import { useAuth as e } from "../../components/auth/auth-provider.js";
2
- import { useAuthQuery as t } from "../auth/use-auth-query.js";
3
- import { useSession as n } from "../auth/use-session.js";
4
- //#region src/hooks/settings/use-list-user-passkeys.ts
5
- function r(r) {
6
- let { authClient: i } = e(), { data: a } = n({ refetchOnMount: !1 });
7
- return t({
8
- authFn: i.passkey.listUserPasskeys,
9
- options: {
10
- queryKey: [
11
- "auth",
12
- "listUserPasskeys",
13
- a?.user.id
14
- ],
15
- enabled: !!a,
16
- ...r
17
- }
18
- });
19
- }
20
- //#endregion
21
- export { r as useListUserPasskeys };
@@ -1,19 +0,0 @@
1
- import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthMutationOptions } from '../auth/use-auth-mutation';
3
- /**
4
- * Hook that creates a mutation for revoking a device session in multi-session mode.
5
- *
6
- * @returns The `useMutation` result.
7
- */
8
- export declare function useRevokeMultiSession(options?: UseAuthMutationOptions<AuthClient["multiSession"]["revoke"]>): import('../..').UseAuthMutationResult<(<FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
9
- sessionToken: string;
10
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
11
- sessionToken: string;
12
- } & {
13
- fetchOptions?: FetchOptions | undefined;
14
- }>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<{
15
- status: boolean;
16
- }, {
17
- code?: string | undefined;
18
- message?: string | undefined;
19
- }, FetchOptions["throw"] extends true ? true : false>>)>;
@@ -1,18 +0,0 @@
1
- import { useAuth as e } from "../../components/auth/auth-provider.js";
2
- import { useAuthMutation as t } from "../auth/use-auth-mutation.js";
3
- import { useListDeviceSessions as n } from "./use-list-device-sessions.js";
4
- //#region src/hooks/settings/use-revoke-multi-session.ts
5
- function r(r) {
6
- let { authClient: i } = e(), { refetch: a } = n({ refetchOnMount: !1 });
7
- return t({
8
- authFn: i.multiSession.revoke,
9
- options: {
10
- ...r,
11
- onSuccess: async (...e) => {
12
- await a(), await r?.onSuccess?.(...e);
13
- }
14
- }
15
- });
16
- }
17
- //#endregion
18
- export { r as useRevokeMultiSession };
@@ -1,19 +0,0 @@
1
- import { AuthClient } from '../../lib/auth-client';
2
- import { UseAuthMutationOptions } from '../auth/use-auth-mutation';
3
- /**
4
- * Hook that creates a mutation for revoking a user session.
5
- *
6
- * @returns The `useMutation` result.
7
- */
8
- export declare function useRevokeSession(options?: UseAuthMutationOptions<AuthClient["revokeSession"]>): import('../..').UseAuthMutationResult<(<FetchOptions extends import('better-auth').ClientFetchOption<Partial<{
9
- token: string;
10
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import('better-auth').Prettify<{
11
- token: string;
12
- } & {
13
- fetchOptions?: FetchOptions | undefined;
14
- }>, data_1?: FetchOptions | undefined) => Promise<import('better-auth/client').BetterFetchResponse<{
15
- status: boolean;
16
- }, {
17
- code?: string | undefined;
18
- message?: string | undefined;
19
- }, FetchOptions["throw"] extends true ? true : false>>)>;
@@ -1,18 +0,0 @@
1
- import { useAuth as e } from "../../components/auth/auth-provider.js";
2
- import { useAuthMutation as t } from "../auth/use-auth-mutation.js";
3
- import { useListSessions as n } from "./use-list-sessions.js";
4
- //#region src/hooks/settings/use-revoke-session.ts
5
- function r(r) {
6
- let { authClient: i } = e(), { refetch: a } = n({ refetchOnMount: !1 });
7
- return t({
8
- authFn: i.revokeSession,
9
- options: {
10
- ...r,
11
- onSuccess: async (...e) => {
12
- await a(), await r?.onSuccess?.(...e);
13
- }
14
- }
15
- });
16
- }
17
- //#endregion
18
- export { r as useRevokeSession };