@better-auth-ui/react 1.6.1 → 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 (302) hide show
  1. package/dist/components/auth/auth-provider.d.ts +4 -3
  2. package/dist/components/auth/auth-provider.js +24 -40
  3. package/dist/components/email/email-changed.d.ts +2 -2
  4. package/dist/components/email/email-changed.js +154 -68
  5. package/dist/components/email/email-localization.js +18 -23
  6. package/dist/components/email/email-styles.js +52 -77
  7. package/dist/components/email/email-verification.d.ts +2 -2
  8. package/dist/components/email/email-verification.js +138 -73
  9. package/dist/components/email/index.d.ts +9 -9
  10. package/dist/components/email/index.js +9 -9
  11. package/dist/components/email/magic-link.d.ts +2 -2
  12. package/dist/components/email/magic-link.js +139 -70
  13. package/dist/components/email/new-device.d.ts +2 -2
  14. package/dist/components/email/new-device.js +221 -88
  15. package/dist/components/email/otp-email.d.ts +2 -2
  16. package/dist/components/email/otp-email.js +127 -63
  17. package/dist/components/email/password-changed.d.ts +2 -2
  18. package/dist/components/email/password-changed.js +157 -74
  19. package/dist/components/email/reset-password.d.ts +2 -2
  20. package/dist/components/email/reset-password.js +138 -66
  21. package/dist/components/icons/apple.d.ts +1 -1
  22. package/dist/components/icons/apple.js +16 -9
  23. package/dist/components/icons/atlassian.d.ts +1 -1
  24. package/dist/components/icons/atlassian.js +38 -13
  25. package/dist/components/icons/cognito.d.ts +1 -1
  26. package/dist/components/icons/cognito.js +19 -9
  27. package/dist/components/icons/discord.d.ts +1 -1
  28. package/dist/components/icons/discord.js +16 -9
  29. package/dist/components/icons/dropbox.d.ts +1 -1
  30. package/dist/components/icons/dropbox.js +16 -9
  31. package/dist/components/icons/facebook.d.ts +1 -1
  32. package/dist/components/icons/facebook.js +19 -11
  33. package/dist/components/icons/figma.d.ts +1 -1
  34. package/dist/components/icons/figma.js +34 -12
  35. package/dist/components/icons/github.d.ts +1 -1
  36. package/dist/components/icons/github.js +16 -11
  37. package/dist/components/icons/gitlab.d.ts +1 -1
  38. package/dist/components/icons/gitlab.js +30 -9
  39. package/dist/components/icons/google.d.ts +1 -1
  40. package/dist/components/icons/google.js +39 -9
  41. package/dist/components/icons/huggingface.d.ts +1 -1
  42. package/dist/components/icons/huggingface.js +38 -9
  43. package/dist/components/icons/index.d.ts +35 -35
  44. package/dist/components/icons/index.js +35 -35
  45. package/dist/components/icons/kakao.d.ts +1 -1
  46. package/dist/components/icons/kakao.js +16 -11
  47. package/dist/components/icons/kick.d.ts +1 -1
  48. package/dist/components/icons/kick.js +20 -11
  49. package/dist/components/icons/line.d.ts +1 -1
  50. package/dist/components/icons/line.js +16 -9
  51. package/dist/components/icons/linear.d.ts +1 -1
  52. package/dist/components/icons/linear.js +16 -9
  53. package/dist/components/icons/linkedin.d.ts +1 -1
  54. package/dist/components/icons/linkedin.js +33 -9
  55. package/dist/components/icons/microsoft.d.ts +1 -1
  56. package/dist/components/icons/microsoft.js +30 -9
  57. package/dist/components/icons/naver.d.ts +1 -1
  58. package/dist/components/icons/naver.js +16 -9
  59. package/dist/components/icons/notion.d.ts +1 -1
  60. package/dist/components/icons/notion.js +16 -9
  61. package/dist/components/icons/paybin.d.ts +1 -1
  62. package/dist/components/icons/paybin.js +32 -8
  63. package/dist/components/icons/paypal.d.ts +1 -1
  64. package/dist/components/icons/paypal.js +30 -9
  65. package/dist/components/icons/polar.d.ts +1 -1
  66. package/dist/components/icons/polar.js +24 -9
  67. package/dist/components/icons/railway.d.ts +1 -1
  68. package/dist/components/icons/railway.js +16 -9
  69. package/dist/components/icons/reddit.d.ts +1 -1
  70. package/dist/components/icons/reddit.js +21 -9
  71. package/dist/components/icons/roblox.d.ts +1 -1
  72. package/dist/components/icons/roblox.js +17 -12
  73. package/dist/components/icons/salesforce.d.ts +1 -1
  74. package/dist/components/icons/salesforce.js +16 -9
  75. package/dist/components/icons/slack.d.ts +1 -1
  76. package/dist/components/icons/slack.js +30 -9
  77. package/dist/components/icons/spotify.d.ts +1 -1
  78. package/dist/components/icons/spotify.js +16 -9
  79. package/dist/components/icons/tiktok.d.ts +1 -1
  80. package/dist/components/icons/tiktok.js +23 -10
  81. package/dist/components/icons/twitch.d.ts +1 -1
  82. package/dist/components/icons/twitch.js +43 -12
  83. package/dist/components/icons/vercel.d.ts +1 -1
  84. package/dist/components/icons/vercel.js +16 -9
  85. package/dist/components/icons/vk.d.ts +1 -1
  86. package/dist/components/icons/vk.js +16 -9
  87. package/dist/components/icons/wechat.d.ts +1 -1
  88. package/dist/components/icons/wechat.js +16 -9
  89. package/dist/components/icons/x.d.ts +1 -1
  90. package/dist/components/icons/x.js +16 -9
  91. package/dist/components/icons/zoom.d.ts +1 -1
  92. package/dist/components/icons/zoom.js +69 -11
  93. package/dist/components/settings/account/theme-preview.js +286 -7
  94. package/dist/core.d.ts +1 -1
  95. package/dist/hooks/auth/use-authenticate.d.ts +30 -6
  96. package/dist/hooks/auth/use-authenticate.js +22 -27
  97. package/dist/hooks/auth/use-is-username-available.d.ts +20 -0
  98. package/dist/hooks/auth/use-is-username-available.js +13 -0
  99. package/dist/hooks/auth/use-request-password-reset.d.ts +12 -17
  100. package/dist/hooks/auth/use-request-password-reset.js +12 -13
  101. package/dist/hooks/auth/use-reset-password.d.ts +14 -31
  102. package/dist/hooks/auth/use-reset-password.js +12 -12
  103. package/dist/hooks/auth/use-send-verification-email.d.ts +11 -16
  104. package/dist/hooks/auth/use-send-verification-email.js +12 -12
  105. package/dist/hooks/auth/use-session.d.ts +31 -5
  106. package/dist/hooks/auth/use-session.js +15 -17
  107. package/dist/hooks/auth/use-sign-in-email.d.ts +12 -39
  108. package/dist/hooks/auth/use-sign-in-email.js +16 -24
  109. package/dist/hooks/auth/use-sign-in-magic-link.d.ts +15 -20
  110. package/dist/hooks/auth/use-sign-in-magic-link.js +12 -12
  111. package/dist/hooks/auth/use-sign-in-passkey.d.ts +13 -50
  112. package/dist/hooks/auth/use-sign-in-passkey.js +16 -24
  113. package/dist/hooks/auth/use-sign-in-social.d.ts +32 -62
  114. package/dist/hooks/auth/use-sign-in-social.js +12 -12
  115. package/dist/hooks/auth/use-sign-in-username.d.ts +25 -0
  116. package/dist/hooks/auth/use-sign-in-username.js +17 -0
  117. package/dist/hooks/auth/use-sign-out.d.ts +11 -12
  118. package/dist/hooks/auth/use-sign-out.js +15 -23
  119. package/dist/hooks/auth/use-sign-up-email.d.ts +178 -262
  120. package/dist/hooks/auth/use-sign-up-email.js +16 -24
  121. package/dist/hooks/auth/use-user.d.ts +63 -61
  122. package/dist/hooks/auth/use-user.js +10 -13
  123. package/dist/hooks/settings/use-account-info.d.ts +12 -12
  124. package/dist/hooks/settings/use-account-info.js +17 -24
  125. package/dist/hooks/settings/use-add-passkey.d.ts +11 -33
  126. package/dist/hooks/settings/use-add-passkey.js +16 -23
  127. package/dist/hooks/settings/use-change-email.d.ts +12 -15
  128. package/dist/hooks/settings/use-change-email.js +16 -22
  129. package/dist/hooks/settings/use-change-password.d.ts +12 -45
  130. package/dist/hooks/settings/use-change-password.js +12 -10
  131. package/dist/hooks/settings/use-delete-passkey.d.ts +11 -13
  132. package/dist/hooks/settings/use-delete-passkey.js +16 -23
  133. package/dist/hooks/settings/use-delete-user.d.ts +14 -32
  134. package/dist/hooks/settings/use-delete-user.js +12 -10
  135. package/dist/hooks/settings/use-link-social.d.ts +23 -26
  136. package/dist/hooks/settings/use-link-social.js +12 -9
  137. package/dist/hooks/settings/use-list-accounts.d.ts +10 -8
  138. package/dist/hooks/settings/use-list-accounts.js +14 -22
  139. package/dist/hooks/settings/use-list-device-sessions.d.ts +30 -7
  140. package/dist/hooks/settings/use-list-device-sessions.js +14 -21
  141. package/dist/hooks/settings/use-list-sessions.d.ts +10 -7
  142. package/dist/hooks/settings/use-list-sessions.js +14 -21
  143. package/dist/hooks/settings/use-list-user-passkeys.d.ts +9 -6
  144. package/dist/hooks/settings/use-list-user-passkeys.js +14 -21
  145. package/dist/hooks/settings/use-revoke-multi-session.d.ts +12 -12
  146. package/dist/hooks/settings/use-revoke-multi-session.js +16 -19
  147. package/dist/hooks/settings/use-revoke-session.d.ts +12 -12
  148. package/dist/hooks/settings/use-revoke-session.js +16 -20
  149. package/dist/hooks/settings/use-set-active-session.d.ts +13 -30
  150. package/dist/hooks/settings/use-set-active-session.js +19 -27
  151. package/dist/hooks/settings/use-unlink-account.d.ts +13 -13
  152. package/dist/hooks/settings/use-unlink-account.js +16 -20
  153. package/dist/hooks/settings/use-update-user.d.ts +1179 -5
  154. package/dist/hooks/settings/use-update-user.js +23 -28
  155. package/dist/hooks/use-auth-mutation.d.ts +12 -0
  156. package/dist/hooks/use-auth-mutation.js +11 -0
  157. package/dist/hooks/use-auth-query.d.ts +14 -0
  158. package/dist/hooks/use-auth-query.js +15 -0
  159. package/dist/index.d.ts +40 -36
  160. package/dist/index.js +84 -36
  161. package/dist/lib/auth-client.d.ts +1254 -1254
  162. package/dist/lib/auth-client.js +11 -11
  163. package/dist/lib/auth-config.d.ts +3 -3
  164. package/dist/lib/auth-context.d.ts +2 -2
  165. package/dist/lib/auth-context.js +5 -2
  166. package/dist/lib/provider-icons.d.ts +2 -2
  167. package/dist/lib/provider-icons.js +75 -47
  168. package/dist/lib/utils.d.ts +1 -1
  169. package/dist/lib/utils.js +7 -4
  170. package/dist/mutations/auth/is-username-available-options.d.ts +19 -0
  171. package/dist/mutations/auth/is-username-available-options.js +7 -0
  172. package/dist/mutations/auth/request-password-reset-options.d.ts +15 -0
  173. package/dist/mutations/auth/request-password-reset-options.js +7 -0
  174. package/dist/mutations/auth/reset-password-options.d.ts +17 -0
  175. package/dist/mutations/auth/reset-password-options.js +7 -0
  176. package/dist/mutations/auth/send-verification-email-options.d.ts +15 -0
  177. package/dist/mutations/auth/send-verification-email-options.js +7 -0
  178. package/dist/mutations/auth/sign-in-email-options.d.ts +23 -0
  179. package/dist/mutations/auth/sign-in-email-options.js +11 -0
  180. package/dist/mutations/auth/sign-in-magic-link-options.d.ts +23 -0
  181. package/dist/mutations/auth/sign-in-magic-link-options.js +11 -0
  182. package/dist/mutations/auth/sign-in-passkey-options.d.ts +15 -0
  183. package/dist/mutations/auth/sign-in-passkey-options.js +11 -0
  184. package/dist/mutations/auth/sign-in-social-options.d.ts +61 -0
  185. package/dist/mutations/auth/sign-in-social-options.js +11 -0
  186. package/dist/mutations/auth/sign-in-username-options.d.ts +19 -0
  187. package/dist/mutations/auth/sign-in-username-options.js +11 -0
  188. package/dist/mutations/auth/sign-out-options.d.ts +12 -0
  189. package/dist/mutations/auth/sign-out-options.js +7 -0
  190. package/dist/mutations/auth/sign-up-email-options.d.ts +1180 -0
  191. package/dist/mutations/auth/sign-up-email-options.js +11 -0
  192. package/dist/mutations/auth-mutation-options.d.ts +25 -0
  193. package/dist/mutations/auth-mutation-options.js +19 -0
  194. package/dist/mutations/settings/add-passkey-options.d.ts +15 -0
  195. package/dist/mutations/settings/add-passkey-options.js +11 -0
  196. package/dist/mutations/settings/change-email-options.d.ts +15 -0
  197. package/dist/mutations/settings/change-email-options.js +7 -0
  198. package/dist/mutations/settings/change-password-options.d.ts +17 -0
  199. package/dist/mutations/settings/change-password-options.js +7 -0
  200. package/dist/mutations/settings/delete-passkey-options.d.ts +13 -0
  201. package/dist/mutations/settings/delete-passkey-options.js +11 -0
  202. package/dist/mutations/settings/delete-user-options.d.ts +20 -0
  203. package/dist/mutations/settings/delete-user-options.js +7 -0
  204. package/dist/mutations/settings/link-social-options.d.ts +39 -0
  205. package/dist/mutations/settings/link-social-options.js +7 -0
  206. package/dist/mutations/settings/revoke-multi-session-options.d.ts +13 -0
  207. package/dist/mutations/settings/revoke-multi-session-options.js +11 -0
  208. package/dist/mutations/settings/revoke-session-options.d.ts +13 -0
  209. package/dist/mutations/settings/revoke-session-options.js +7 -0
  210. package/dist/mutations/settings/set-active-session-options.d.ts +13 -0
  211. package/dist/mutations/settings/set-active-session-options.js +11 -0
  212. package/dist/mutations/settings/unlink-account-options.d.ts +15 -0
  213. package/dist/mutations/settings/unlink-account-options.js +7 -0
  214. package/dist/mutations/settings/update-user-options.d.ts +1182 -0
  215. package/dist/mutations/settings/update-user-options.js +7 -0
  216. package/dist/queries/auth/session-options.d.ts +110 -0
  217. package/dist/queries/auth/session-options.js +7 -0
  218. package/dist/queries/auth-query-options.d.ts +29 -0
  219. package/dist/queries/auth-query-options.js +17 -0
  220. package/dist/queries/settings/account-info-options.d.ts +32 -0
  221. package/dist/queries/settings/account-info-options.js +12 -0
  222. package/dist/queries/settings/list-accounts-options.d.ts +53 -0
  223. package/dist/queries/settings/list-accounts-options.js +12 -0
  224. package/dist/queries/settings/list-device-sessions-options.d.ts +99 -0
  225. package/dist/queries/settings/list-device-sessions-options.js +12 -0
  226. package/dist/queries/settings/list-sessions-options.d.ts +54 -0
  227. package/dist/queries/settings/list-sessions-options.js +12 -0
  228. package/dist/queries/settings/list-user-passkeys-options.d.ts +18 -0
  229. package/dist/queries/settings/list-user-passkeys-options.js +12 -0
  230. package/package.json +11 -11
  231. package/src/components/auth/auth-provider.tsx +4 -6
  232. package/src/hooks/auth/use-authenticate.ts +8 -9
  233. package/src/hooks/auth/use-is-username-available.ts +31 -0
  234. package/src/hooks/auth/use-request-password-reset.ts +20 -11
  235. package/src/hooks/auth/use-reset-password.ts +20 -12
  236. package/src/hooks/auth/use-send-verification-email.ts +19 -11
  237. package/src/hooks/auth/use-session.ts +22 -17
  238. package/src/hooks/auth/use-sign-in-email.ts +24 -19
  239. package/src/hooks/auth/use-sign-in-magic-link.ts +19 -13
  240. package/src/hooks/auth/use-sign-in-passkey.ts +24 -18
  241. package/src/hooks/auth/use-sign-in-social.ts +19 -11
  242. package/src/hooks/auth/use-sign-in-username.ts +40 -0
  243. package/src/hooks/auth/use-sign-out.ts +20 -20
  244. package/src/hooks/auth/use-sign-up-email.ts +25 -21
  245. package/src/hooks/auth/use-user.ts +7 -9
  246. package/src/hooks/settings/use-account-info.ts +31 -21
  247. package/src/hooks/settings/use-add-passkey.ts +22 -17
  248. package/src/hooks/settings/use-change-email.ts +24 -20
  249. package/src/hooks/settings/use-change-password.ts +19 -11
  250. package/src/hooks/settings/use-delete-passkey.ts +21 -16
  251. package/src/hooks/settings/use-delete-user.ts +19 -11
  252. package/src/hooks/settings/use-link-social.ts +20 -10
  253. package/src/hooks/settings/use-list-accounts.ts +28 -16
  254. package/src/hooks/settings/use-list-device-sessions.ts +29 -22
  255. package/src/hooks/settings/use-list-sessions.ts +28 -15
  256. package/src/hooks/settings/use-list-user-passkeys.ts +28 -17
  257. package/src/hooks/settings/use-revoke-multi-session.ts +28 -19
  258. package/src/hooks/settings/use-revoke-session.ts +26 -18
  259. package/src/hooks/settings/use-set-active-session.ts +40 -28
  260. package/src/hooks/settings/use-unlink-account.ts +23 -17
  261. package/src/hooks/settings/use-update-user.ts +33 -27
  262. package/src/hooks/use-auth-mutation.ts +29 -0
  263. package/src/hooks/use-auth-query.ts +36 -0
  264. package/src/index.ts +4 -0
  265. package/src/lib/auth-config.ts +1 -1
  266. package/src/mutations/auth/is-username-available-options.ts +18 -0
  267. package/src/mutations/auth/request-password-reset-options.ts +14 -0
  268. package/src/mutations/auth/reset-password-options.ts +14 -0
  269. package/src/mutations/auth/send-verification-email-options.ts +14 -0
  270. package/src/mutations/auth/sign-in-email-options.ts +19 -0
  271. package/src/mutations/auth/sign-in-magic-link-options.ts +15 -0
  272. package/src/mutations/auth/sign-in-passkey-options.ts +15 -0
  273. package/src/mutations/auth/sign-in-social-options.ts +19 -0
  274. package/src/mutations/auth/sign-in-username-options.ts +15 -0
  275. package/src/mutations/auth/sign-out-options.ts +11 -0
  276. package/src/mutations/auth/sign-up-email-options.ts +15 -0
  277. package/src/mutations/auth-mutation-options.ts +49 -0
  278. package/src/mutations/settings/add-passkey-options.ts +15 -0
  279. package/src/mutations/settings/change-email-options.ts +11 -0
  280. package/src/mutations/settings/change-password-options.ts +14 -0
  281. package/src/mutations/settings/delete-passkey-options.ts +15 -0
  282. package/src/mutations/settings/delete-user-options.ts +11 -0
  283. package/src/mutations/settings/link-social-options.ts +11 -0
  284. package/src/mutations/settings/revoke-multi-session-options.ts +15 -0
  285. package/src/mutations/settings/revoke-session-options.ts +14 -0
  286. package/src/mutations/settings/set-active-session-options.ts +15 -0
  287. package/src/mutations/settings/unlink-account-options.ts +14 -0
  288. package/src/mutations/settings/update-user-options.ts +15 -0
  289. package/src/queries/auth/session-options.ts +18 -0
  290. package/src/queries/auth-query-options.ts +34 -0
  291. package/src/queries/settings/account-info-options.ts +25 -0
  292. package/src/queries/settings/list-accounts-options.ts +26 -0
  293. package/src/queries/settings/list-device-sessions-options.ts +24 -0
  294. package/src/queries/settings/list-sessions-options.ts +23 -0
  295. package/src/queries/settings/list-user-passkeys-options.ts +23 -0
  296. package/dist/hooks/auth/use-auth-mutation.d.ts +0 -18
  297. package/dist/hooks/auth/use-auth-mutation.js +0 -10
  298. package/dist/hooks/auth/use-auth-query.d.ts +0 -24
  299. package/dist/hooks/auth/use-auth-query.js +0 -10
  300. package/dist/lib/auth-config.js +0 -1
  301. package/src/hooks/auth/use-auth-mutation.ts +0 -56
  302. package/src/hooks/auth/use-auth-query.ts +0 -50
@@ -1,24 +1,21 @@
1
- import { type AuthClient } from "@better-auth-ui/react";
2
- import type { UseAuthMutationOptions } from "../auth/use-auth-mutation";
1
+ import { AuthClient } from '../../lib/auth-client';
2
+ import { changeEmailOptions } from '../../mutations/settings/change-email-options';
3
+ export type UseChangeEmailParams = NonNullable<Parameters<AuthClient["changeEmail"]>[0]>;
4
+ export type UseChangeEmailOptions = Omit<ReturnType<typeof changeEmailOptions>, "mutationKey" | "mutationFn">;
3
5
  /**
4
6
  * Hook that creates a mutation for changing the current user's email address.
5
7
  *
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
+ * Refetches the session on success to surface the new email.
8
9
  *
10
+ * @param options - React Query options forwarded to `useMutation`.
9
11
  * @returns The `useMutation` result.
10
12
  */
11
- export declare function useChangeEmail(options?: UseAuthMutationOptions<AuthClient["changeEmail"]>): import("../auth/use-auth-mutation").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<{
13
+ export declare function useChangeEmail(options?: UseChangeEmailOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
15
14
  newEmail: string;
16
15
  callbackURL?: string | undefined;
17
16
  } & {
18
- fetchOptions?: FetchOptions | undefined;
19
- }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
20
- status: boolean;
21
- }, {
22
- code?: string | undefined;
23
- message?: string | undefined;
24
- }, FetchOptions["throw"] extends true ? true : false>>)>;
17
+ fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
18
+ newEmail: string;
19
+ callbackURL?: string | undefined;
20
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
21
+ }>, unknown>;
@@ -1,23 +1,17 @@
1
- import { useAuth, useAuthMutation, useSession } from "@better-auth-ui/react";
2
- /**
3
- * Hook that creates a mutation for changing the current user's email address.
4
- *
5
- * The mutation sends an email-change request and shows success or error toasts.
6
- * On success the callback URL is set to the account settings view.
7
- *
8
- * @returns The `useMutation` result.
9
- */
10
- export function useChangeEmail(options) {
11
- const { authClient } = useAuth();
12
- const { refetch } = useSession({ refetchOnMount: false });
13
- return useAuthMutation({
14
- authFn: authClient.changeEmail,
15
- options: {
16
- ...options,
17
- onSuccess: async (...args) => {
18
- refetch();
19
- await options?.onSuccess?.(...args);
20
- }
21
- }
22
- });
1
+ import { useAuth as e } from "../../components/auth/auth-provider.js";
2
+ import { useSession as t } from "../auth/use-session.js";
3
+ import { changeEmailOptions as n } from "../../mutations/settings/change-email-options.js";
4
+ import { useMutation as r } from "@tanstack/react-query";
5
+ //#region src/hooks/settings/use-change-email.ts
6
+ function i(i) {
7
+ let { authClient: a } = e(), { refetch: o } = t({ refetchOnMount: !1 });
8
+ return r({
9
+ ...n(a),
10
+ ...i,
11
+ onSuccess: async (...e) => {
12
+ await o(), await i?.onSuccess?.(...e);
13
+ }
14
+ });
23
15
  }
16
+ //#endregion
17
+ export { i as useChangeEmail };
@@ -1,54 +1,21 @@
1
- import { type AuthClient } from "@better-auth-ui/react";
2
- import type { UseAuthMutationOptions } from "../auth/use-auth-mutation";
3
- export { useAuthMutation } from "../auth/use-auth-mutation";
1
+ import { AuthClient } from '../../lib/auth-client';
2
+ import { changePasswordOptions } from '../../mutations/settings/change-password-options';
3
+ export type UseChangePasswordParams = NonNullable<Parameters<AuthClient["changePassword"]>[0]>;
4
+ export type UseChangePasswordOptions = Omit<ReturnType<typeof changePasswordOptions>, "mutationKey" | "mutationFn">;
4
5
  /**
5
6
  * Hook that creates a mutation for changing the authenticated user's password.
6
7
  *
8
+ * @param options - React Query options forwarded to `useMutation`.
7
9
  * @returns The `useMutation` result.
8
10
  */
9
- export declare function useChangePassword(options?: UseAuthMutationOptions<AuthClient["changePassword"]>): import("../auth/use-auth-mutation").UseAuthMutationResult<(<FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
10
- newPassword: string;
11
- currentPassword: string;
12
- revokeOtherSessions?: boolean | 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 useChangePassword(options?: UseChangePasswordOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
14
12
  newPassword: string;
15
13
  currentPassword: string;
16
14
  revokeOtherSessions?: boolean | undefined;
17
15
  } & {
18
- fetchOptions?: FetchOptions | undefined;
19
- }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<Omit<{
20
- token: string | null;
21
- user: {
22
- id: string;
23
- createdAt: Date;
24
- updatedAt: Date;
25
- email: string;
26
- emailVerified: boolean;
27
- name: string;
28
- image?: string | null | undefined;
29
- } & Record<string, any> & {
30
- id: string;
31
- createdAt: Date;
32
- updatedAt: Date;
33
- email: string;
34
- emailVerified: boolean;
35
- name: string;
36
- image?: string | null | undefined;
37
- };
38
- }, "user"> & {
39
- user: import("better-auth").StripEmptyObjects<{
40
- id: string;
41
- createdAt: Date;
42
- updatedAt: Date;
43
- email: string;
44
- emailVerified: boolean;
45
- name: string;
46
- image?: string | null | undefined;
47
- } & {} & {
48
- username?: string | null | undefined;
49
- displayUsername?: string | null | undefined;
50
- }>;
51
- }, {
52
- code?: string | undefined;
53
- message?: string | undefined;
54
- }, FetchOptions["throw"] extends true ? true : false>>)>;
16
+ fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
17
+ newPassword: string;
18
+ currentPassword: string;
19
+ revokeOtherSessions?: boolean | undefined;
20
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
21
+ }>, unknown>;
@@ -1,11 +1,13 @@
1
- import { useAuth, useAuthMutation } from "@better-auth-ui/react";
2
- export { useAuthMutation } 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 function useChangePassword(options) {
9
- const { authClient } = useAuth();
10
- return useAuthMutation({ authFn: authClient.changePassword, options });
1
+ import { useAuth as e } from "../../components/auth/auth-provider.js";
2
+ import { changePasswordOptions as t } from "../../mutations/settings/change-password-options.js";
3
+ import { useMutation as n } from "@tanstack/react-query";
4
+ //#region src/hooks/settings/use-change-password.ts
5
+ function r(r) {
6
+ let { authClient: i } = e();
7
+ return n({
8
+ ...t(i),
9
+ ...r
10
+ });
11
11
  }
12
+ //#endregion
13
+ export { r as useChangePassword };
@@ -1,21 +1,19 @@
1
- import type { AuthClient } from "../../lib/auth-client";
2
- import { type UseAuthMutationOptions } from "../auth/use-auth-mutation";
1
+ import { AuthClient } from '../../lib/auth-client';
2
+ import { deletePasskeyOptions } from '../../mutations/settings/delete-passkey-options';
3
+ export type UseDeletePasskeyParams = NonNullable<Parameters<AuthClient["passkey"]["deletePasskey"]>[0]>;
4
+ export type UseDeletePasskeyOptions = Omit<ReturnType<typeof deletePasskeyOptions>, "mutationKey" | "mutationFn">;
3
5
  /**
4
6
  * Hook that creates a mutation for deleting a 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 useDeletePasskey(options?: UseAuthMutationOptions<AuthClient["passkey"]["deletePasskey"]>): import("../auth/use-auth-mutation").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
+ export declare function useDeletePasskey(options?: UseDeletePasskeyOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
13
14
  id: string;
14
15
  } & {
15
- fetchOptions?: FetchOptions | undefined;
16
- }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
17
- status: boolean;
18
- }, {
19
- code?: string | undefined;
20
- message?: string | undefined;
21
- }, FetchOptions["throw"] extends true ? true : false>>)>;
16
+ fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
17
+ id: string;
18
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
19
+ }>, unknown>;
@@ -1,24 +1,17 @@
1
- import { useAuth } from "../../components/auth/auth-provider";
2
- import { useAuthMutation } from "../auth/use-auth-mutation";
3
- import { useListUserPasskeys } from "./use-list-user-passkeys";
4
- /**
5
- * Hook that creates a mutation for deleting a passkey.
6
- *
7
- * Refetches the passkeys list on success.
8
- *
9
- * @returns The `useMutation` result.
10
- */
11
- export function useDeletePasskey(options) {
12
- const { authClient } = useAuth();
13
- const { refetch } = useListUserPasskeys();
14
- return useAuthMutation({
15
- authFn: authClient.passkey.deletePasskey,
16
- options: {
17
- ...options,
18
- onSuccess: async (...args) => {
19
- await refetch();
20
- await options?.onSuccess?.(...args);
21
- }
22
- }
23
- });
1
+ import { useAuth as e } from "../../components/auth/auth-provider.js";
2
+ import { useListUserPasskeys as t } from "./use-list-user-passkeys.js";
3
+ import { deletePasskeyOptions as n } from "../../mutations/settings/delete-passkey-options.js";
4
+ import { useMutation as r } from "@tanstack/react-query";
5
+ //#region src/hooks/settings/use-delete-passkey.ts
6
+ function i(i) {
7
+ let { authClient: a } = e(), { refetch: o } = t();
8
+ return r({
9
+ ...n(a),
10
+ ...i,
11
+ onSuccess: async (...e) => {
12
+ await o(), await i?.onSuccess?.(...e);
13
+ }
14
+ });
24
15
  }
16
+ //#endregion
17
+ export { i as useDeletePasskey };
@@ -1,42 +1,24 @@
1
- import { type AuthClient } from "@better-auth-ui/react";
2
- import type { UseAuthMutationOptions } from "../auth/use-auth-mutation";
3
- export { useAuthMutation } from "../auth/use-auth-mutation";
1
+ import { AuthClient } from '../../lib/auth-client';
2
+ import { deleteUserOptions } from '../../mutations/settings/delete-user-options';
3
+ export type UseDeleteUserParams = NonNullable<Parameters<AuthClient["deleteUser"]>[0]>;
4
+ export type UseDeleteUserOptions = Omit<ReturnType<typeof deleteUserOptions>, "mutationKey" | "mutationFn">;
4
5
  /**
5
6
  * Hook that creates a mutation for deleting the authenticated user account.
6
7
  *
8
+ * @param options - React Query options forwarded to `useMutation`.
7
9
  * @returns The `useMutation` result.
8
10
  */
9
- export declare function useDeleteUser(options?: UseAuthMutationOptions<AuthClient["deleteUser"]>): import("../auth/use-auth-mutation").UseAuthMutationResult<(<FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
10
- callbackURL?: string | undefined;
11
- password?: string | undefined;
12
- token?: 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 useDeleteUser(options?: UseDeleteUserOptions): import('@tanstack/react-query').UseMutationResult<{
12
+ success: boolean;
13
+ message: string;
14
+ } | null, import('better-auth/client').BetterFetchError, void | import('better-auth').Prettify<{
14
15
  callbackURL?: string | undefined;
15
16
  password?: string | undefined;
16
17
  token?: string | undefined;
17
18
  } & {
18
- fetchOptions?: FetchOptions | undefined;
19
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
20
- success: boolean;
21
- message: string;
22
- }, {
23
- code?: string | undefined;
24
- message?: string | undefined;
25
- }, FetchOptions["throw"] extends true ? true : false>>) & {
26
- callback: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
27
- token: string;
19
+ fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
28
20
  callbackURL?: string | undefined;
29
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
30
- query: {
31
- token: string;
32
- callbackURL?: string | undefined;
33
- };
34
- fetchOptions?: FetchOptions | undefined;
35
- }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
36
- success: boolean;
37
- message: string;
38
- }, {
39
- code?: string | undefined;
40
- message?: string | undefined;
41
- }, FetchOptions["throw"] extends true ? true : false>>;
42
- }>;
21
+ password?: string | undefined;
22
+ token?: string | undefined;
23
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
24
+ }>, unknown>;
@@ -1,11 +1,13 @@
1
- import { useAuth, useAuthMutation } from "@better-auth-ui/react";
2
- export { useAuthMutation } 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 function useDeleteUser(options) {
9
- const { authClient } = useAuth();
10
- return useAuthMutation({ authFn: authClient.deleteUser, options });
1
+ import { useAuth as e } from "../../components/auth/auth-provider.js";
2
+ import { deleteUserOptions as t } from "../../mutations/settings/delete-user-options.js";
3
+ import { useMutation as n } from "@tanstack/react-query";
4
+ //#region src/hooks/settings/use-delete-user.ts
5
+ function r(r) {
6
+ let { authClient: i } = e();
7
+ return n({
8
+ ...t(i),
9
+ ...r
10
+ });
11
11
  }
12
+ //#endregion
13
+ export { r as useDeleteUser };
@@ -1,26 +1,14 @@
1
- import { type AuthClient } from "@better-auth-ui/react";
2
- import type { UseAuthMutationOptions } from "../auth/use-auth-mutation";
1
+ import { AuthClient } from '../../lib/auth-client';
2
+ import { linkSocialOptions } from '../../mutations/settings/link-social-options';
3
+ export type UseLinkSocialParams = NonNullable<Parameters<AuthClient["linkSocial"]>[0]>;
4
+ export type UseLinkSocialOptions = Omit<ReturnType<typeof linkSocialOptions>, "mutationKey" | "mutationFn">;
3
5
  /**
4
6
  * Hook that creates a mutation for linking a social provider to the current user.
5
7
  *
8
+ * @param options - React Query options forwarded to `useMutation`.
6
9
  * @returns The `useMutation` result.
7
10
  */
8
- export declare function useLinkSocial(options?: UseAuthMutationOptions<AuthClient["linkSocial"]>): import("../auth/use-auth-mutation").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<{
11
+ export declare function useLinkSocial(options?: UseLinkSocialOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
24
12
  provider: unknown;
25
13
  callbackURL?: string | undefined;
26
14
  idToken?: {
@@ -36,11 +24,20 @@ export declare function useLinkSocial(options?: UseAuthMutationOptions<AuthClien
36
24
  disableRedirect?: boolean | undefined;
37
25
  additionalData?: Record<string, any> | undefined;
38
26
  } & {
39
- fetchOptions?: FetchOptions | undefined;
40
- }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
41
- url: string;
42
- redirect: boolean;
43
- }, {
44
- code?: string | undefined;
45
- message?: string | undefined;
46
- }, FetchOptions["throw"] extends true ? true : false>>)>;
27
+ fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
28
+ provider: unknown;
29
+ callbackURL?: string | undefined;
30
+ idToken?: {
31
+ token: string;
32
+ nonce?: string | undefined;
33
+ accessToken?: string | undefined;
34
+ refreshToken?: string | undefined;
35
+ scopes?: string[] | undefined;
36
+ } | undefined;
37
+ requestSignUp?: boolean | undefined;
38
+ scopes?: string[] | undefined;
39
+ errorCallbackURL?: string | undefined;
40
+ disableRedirect?: boolean | undefined;
41
+ additionalData?: Record<string, any> | undefined;
42
+ }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
43
+ }>, unknown>;
@@ -1,10 +1,13 @@
1
- import { useAuth, useAuthMutation } from "@better-auth-ui/react";
2
- /**
3
- * Hook that creates a mutation for linking a social provider to the current user.
4
- *
5
- * @returns The `useMutation` result.
6
- */
7
- export function useLinkSocial(options) {
8
- const { authClient } = useAuth();
9
- return useAuthMutation({ authFn: authClient.linkSocial, options });
1
+ import { useAuth as e } from "../../components/auth/auth-provider.js";
2
+ import { linkSocialOptions as t } from "../../mutations/settings/link-social-options.js";
3
+ import { useMutation as n } from "@tanstack/react-query";
4
+ //#region src/hooks/settings/use-link-social.ts
5
+ function r(r) {
6
+ let { authClient: i } = e();
7
+ return n({
8
+ ...t(i),
9
+ ...r
10
+ });
10
11
  }
12
+ //#endregion
13
+ export { r as useLinkSocial };
@@ -1,15 +1,17 @@
1
- import { type AuthClient } from "@better-auth-ui/react";
2
- import { type UseAuthQueryOptions } from "../auth/use-auth-query";
1
+ import { AuthClient } from '../../lib/auth-client';
2
+ import { listAccountsOptions } from '../../queries/settings/list-accounts-options';
3
+ export type UseListAccountsParams = NonNullable<Parameters<AuthClient["listAccounts"]>[0]>;
4
+ export type UseListAccountsOptions = Omit<ReturnType<typeof listAccountsOptions>, "queryKey" | "queryFn"> & UseListAccountsParams;
3
5
  /**
4
6
  * Retrieve the current user's linked social accounts.
5
7
  *
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
+ * Keyed per-user; waits for the active session before firing.
8
9
  *
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
10
+ * @param options - Better Auth params (`fetchOptions`) and React Query
11
+ * options forwarded to `useQuery`.
12
+ * @returns React Query result for the user's linked accounts.
11
13
  */
12
- export declare function useListAccounts(options?: Partial<UseAuthQueryOptions<AuthClient["listAccounts"]>>): import("@tanstack/react-query").UseQueryResult<{
14
+ export declare function useListAccounts(options?: UseListAccountsOptions): import('@tanstack/react-query').UseQueryResult<{
13
15
  scopes: string[];
14
16
  id: string;
15
17
  createdAt: Date;
@@ -17,4 +19,4 @@ export declare function useListAccounts(options?: Partial<UseAuthQueryOptions<Au
17
19
  userId: string;
18
20
  providerId: string;
19
21
  accountId: string;
20
- }[] | null, import("better-auth/react").BetterFetchError>;
22
+ }[] | null, import('better-auth/client').BetterFetchError>;
@@ -1,23 +1,15 @@
1
- import { useAuth, useSession } from "@better-auth-ui/react";
2
- import { useAuthQuery } 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 function useListAccounts(options) {
13
- const { authClient } = useAuth();
14
- const { data: session } = useSession({ refetchOnMount: false });
15
- return useAuthQuery({
16
- authFn: authClient.listAccounts,
17
- options: {
18
- queryKey: ["auth", "listAccounts", session?.user.id],
19
- enabled: !!session,
20
- ...options
21
- }
22
- });
1
+ import { useAuth as e } from "../../components/auth/auth-provider.js";
2
+ import { useSession as t } from "../auth/use-session.js";
3
+ import { listAccountsOptions as n } from "../../queries/settings/list-accounts-options.js";
4
+ import { skipToken as r, useQuery as i } from "@tanstack/react-query";
5
+ //#region src/hooks/settings/use-list-accounts.ts
6
+ function a(a) {
7
+ let { authClient: o } = e(), { data: s } = t({ refetchOnMount: !1 }), c = s?.user.id, l = !c, { fetchOptions: u, ...d } = a ?? {};
8
+ return i({
9
+ ...n(o, c, { fetchOptions: u }),
10
+ ...l && { queryFn: r },
11
+ ...d
12
+ });
23
13
  }
14
+ //#endregion
15
+ export { a as useListAccounts };
@@ -1,11 +1,34 @@
1
- import { type AuthClient } from "@better-auth-ui/react";
2
- import { type UseAuthQueryOptions, type UseAuthQueryResult } from "../auth/use-auth-query";
1
+ import { AuthClient } from '../../lib/auth-client';
2
+ import { listDeviceSessionsOptions } from '../../queries/settings/list-device-sessions-options';
3
+ export type UseListDeviceSessionsParams = NonNullable<Parameters<AuthClient["multiSession"]["listDeviceSessions"]>[0]>;
4
+ export type UseListDeviceSessionsOptions = Omit<ReturnType<typeof listDeviceSessionsOptions>, "queryKey" | "queryFn"> & UseListDeviceSessionsParams;
3
5
  /**
4
- * Retrieve device sessions for multi-session account switching.
6
+ * Retrieve the device sessions (multi-session account switcher).
5
7
  *
6
- * The query is enabled only when `multiSession` is true and session data is available.
8
+ * Keyed per-user; waits for the active session before firing.
7
9
  *
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
+ * @param options - Better Auth params (`fetchOptions`) and React Query
11
+ * options forwarded to `useQuery`.
12
+ * @returns React Query result for the device sessions list.
10
13
  */
11
- export declare function useListDeviceSessions(options?: Partial<UseAuthQueryOptions<AuthClient["multiSession"]["listDeviceSessions"]>>): UseAuthQueryResult<AuthClient["multiSession"]["listDeviceSessions"]>;
14
+ export declare function useListDeviceSessions(options?: UseListDeviceSessionsOptions): import('@tanstack/react-query').UseQueryResult<{
15
+ session: {
16
+ id: string;
17
+ createdAt: Date;
18
+ updatedAt: Date;
19
+ userId: string;
20
+ expiresAt: Date;
21
+ token: string;
22
+ ipAddress?: string | null | undefined;
23
+ userAgent?: string | null | undefined;
24
+ };
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
+ };
34
+ }[] | null, import('better-auth/client').BetterFetchError>;
@@ -1,22 +1,15 @@
1
- import { useAuth, useSession } from "@better-auth-ui/react";
2
- import { useAuthQuery } 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 function useListDeviceSessions(options) {
12
- const { authClient } = useAuth();
13
- const { data: session } = useSession({ refetchOnMount: false });
14
- return useAuthQuery({
15
- authFn: authClient.multiSession.listDeviceSessions,
16
- options: {
17
- queryKey: ["auth", "multiSession", "listDeviceSessions"],
18
- enabled: !!session,
19
- ...options
20
- }
21
- });
1
+ import { useAuth as e } from "../../components/auth/auth-provider.js";
2
+ import { useSession as t } from "../auth/use-session.js";
3
+ import { listDeviceSessionsOptions as n } from "../../queries/settings/list-device-sessions-options.js";
4
+ import { skipToken as r, useQuery as i } from "@tanstack/react-query";
5
+ //#region src/hooks/settings/use-list-device-sessions.ts
6
+ function a(a) {
7
+ let { authClient: o } = e(), { data: s } = t({ refetchOnMount: !1 }), c = s?.user.id, l = !c, { fetchOptions: u, ...d } = a ?? {};
8
+ return i({
9
+ ...n(o, c, { fetchOptions: u }),
10
+ ...l && { queryFn: r },
11
+ ...d
12
+ });
22
13
  }
14
+ //#endregion
15
+ export { a as useListDeviceSessions };
@@ -1,14 +1,17 @@
1
- import { type AuthClient } from "@better-auth-ui/react";
2
- import { type UseAuthQueryOptions } from "../auth/use-auth-query";
1
+ import { AuthClient } from '../../lib/auth-client';
2
+ import { listSessionsOptions } from '../../queries/settings/list-sessions-options';
3
+ export type UseListSessionsParams = NonNullable<Parameters<AuthClient["listSessions"]>[0]>;
4
+ export type UseListSessionsOptions = Omit<ReturnType<typeof listSessionsOptions>, "queryKey" | "queryFn"> & UseListSessionsParams;
3
5
  /**
4
6
  * Retrieve the active sessions (devices where the current user is signed in).
5
7
  *
6
- * The underlying query is enabled only when session data is available.
8
+ * Keyed per-user; waits for the active session before firing.
7
9
  *
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
+ * @param options - Better Auth params (`fetchOptions`) and React Query
11
+ * options forwarded to `useQuery`.
12
+ * @returns React Query result for the sessions list.
10
13
  */
11
- export declare function useListSessions(options?: Partial<UseAuthQueryOptions<AuthClient["listSessions"]>>): import("@tanstack/react-query").UseQueryResult<import("better-auth").Prettify<{
14
+ export declare function useListSessions(options?: UseListSessionsOptions): import('@tanstack/react-query').UseQueryResult<import('better-auth').Prettify<{
12
15
  id: string;
13
16
  createdAt: Date;
14
17
  updatedAt: Date;
@@ -17,4 +20,4 @@ export declare function useListSessions(options?: Partial<UseAuthQueryOptions<Au
17
20
  token: string;
18
21
  ipAddress?: string | null | undefined | undefined;
19
22
  userAgent?: string | null | undefined | undefined;
20
- }>[] | null, import("better-auth/react").BetterFetchError>;
23
+ }>[] | null, import('better-auth/client').BetterFetchError>;