@better-auth-ui/react 1.6.9 → 1.6.11

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 (270) hide show
  1. package/dist/components/auth/auth-context.d.ts +2 -2
  2. package/dist/components/auth/auth-provider.d.ts +4 -4
  3. package/dist/components/auth/email/email-changed.d.ts +2 -2
  4. package/dist/components/auth/email/email-verification.d.ts +2 -2
  5. package/dist/components/auth/email/index.d.ts +10 -10
  6. package/dist/components/auth/email/magic-link.d.ts +2 -2
  7. package/dist/components/auth/email/new-device.d.ts +2 -2
  8. package/dist/components/auth/email/organization-invitation.d.ts +2 -2
  9. package/dist/components/auth/email/otp-email.d.ts +2 -2
  10. package/dist/components/auth/email/password-changed.d.ts +2 -2
  11. package/dist/components/auth/email/reset-password.d.ts +2 -2
  12. package/dist/components/auth/fetch-options-provider.d.ts +1 -1
  13. package/dist/components/icons/apple.d.ts +1 -1
  14. package/dist/components/icons/atlassian.d.ts +1 -1
  15. package/dist/components/icons/cognito.d.ts +1 -1
  16. package/dist/components/icons/discord.d.ts +1 -1
  17. package/dist/components/icons/dropbox.d.ts +1 -1
  18. package/dist/components/icons/facebook.d.ts +1 -1
  19. package/dist/components/icons/figma.d.ts +1 -1
  20. package/dist/components/icons/github.d.ts +1 -1
  21. package/dist/components/icons/gitlab.d.ts +1 -1
  22. package/dist/components/icons/google.d.ts +1 -1
  23. package/dist/components/icons/huggingface.d.ts +1 -1
  24. package/dist/components/icons/index.d.ts +35 -35
  25. package/dist/components/icons/kakao.d.ts +1 -1
  26. package/dist/components/icons/kick.d.ts +1 -1
  27. package/dist/components/icons/line.d.ts +1 -1
  28. package/dist/components/icons/linear.d.ts +1 -1
  29. package/dist/components/icons/linkedin.d.ts +1 -1
  30. package/dist/components/icons/microsoft.d.ts +1 -1
  31. package/dist/components/icons/naver.d.ts +1 -1
  32. package/dist/components/icons/notion.d.ts +1 -1
  33. package/dist/components/icons/paybin.d.ts +1 -1
  34. package/dist/components/icons/paypal.d.ts +1 -1
  35. package/dist/components/icons/polar.d.ts +1 -1
  36. package/dist/components/icons/railway.d.ts +1 -1
  37. package/dist/components/icons/reddit.d.ts +1 -1
  38. package/dist/components/icons/roblox.d.ts +1 -1
  39. package/dist/components/icons/salesforce.d.ts +1 -1
  40. package/dist/components/icons/slack.d.ts +1 -1
  41. package/dist/components/icons/spotify.d.ts +1 -1
  42. package/dist/components/icons/tiktok.d.ts +1 -1
  43. package/dist/components/icons/twitch.d.ts +1 -1
  44. package/dist/components/icons/vercel.d.ts +1 -1
  45. package/dist/components/icons/vk.d.ts +1 -1
  46. package/dist/components/icons/wechat.d.ts +1 -1
  47. package/dist/components/icons/x.d.ts +1 -1
  48. package/dist/components/icons/zoom.d.ts +1 -1
  49. package/dist/email.d.ts +1 -1
  50. package/dist/email.js +1348 -1
  51. package/dist/hooks/auth/use-authenticate.d.ts +3 -3
  52. package/dist/hooks/auth/use-user.d.ts +34 -34
  53. package/dist/hooks/use-auth-mutation.d.ts +4 -4
  54. package/dist/hooks/use-auth-plugin.d.ts +1 -1
  55. package/dist/hooks/use-auth-query.d.ts +3 -3
  56. package/dist/index.d.ts +48 -48
  57. package/dist/index.js +2469 -47
  58. package/dist/lib/auth-client.d.ts +4 -4
  59. package/dist/lib/auth-plugin.d.ts +4 -4
  60. package/dist/lib/auth-server.d.ts +4 -4
  61. package/dist/lib/provider-icons.d.ts +2 -2
  62. package/dist/lib/settings-tab.d.ts +2 -2
  63. package/dist/lib/utils.d.ts +1 -1
  64. package/dist/mutations/api-key/create-api-key-mutation.d.ts +5 -5
  65. package/dist/mutations/api-key/delete-api-key-mutation.d.ts +5 -5
  66. package/dist/mutations/auth/request-password-reset-mutation.d.ts +4 -4
  67. package/dist/mutations/auth/reset-password-mutation.d.ts +4 -4
  68. package/dist/mutations/auth/send-verification-email-mutation.d.ts +4 -4
  69. package/dist/mutations/auth/sign-in-email-mutation.d.ts +7 -7
  70. package/dist/mutations/auth/sign-in-social-mutation.d.ts +6 -6
  71. package/dist/mutations/auth/sign-out-mutation.d.ts +5 -5
  72. package/dist/mutations/auth/sign-up-email-mutation.d.ts +9 -9
  73. package/dist/mutations/auth-mutation-options.d.ts +2 -2
  74. package/dist/mutations/magic-link/sign-in-magic-link-mutation.d.ts +4 -4
  75. package/dist/mutations/multi-session/revoke-multi-session-mutation.d.ts +5 -5
  76. package/dist/mutations/multi-session/set-active-session-mutation.d.ts +5 -5
  77. package/dist/mutations/organization/accept-invitation-mutation.d.ts +7 -7
  78. package/dist/mutations/organization/cancel-invitation-mutation.d.ts +7 -7
  79. package/dist/mutations/organization/check-slug-mutation.d.ts +4 -4
  80. package/dist/mutations/organization/create-organization-mutation.d.ts +5 -5
  81. package/dist/mutations/organization/delete-organization-mutation.d.ts +5 -5
  82. package/dist/mutations/organization/index.d.ts +12 -12
  83. package/dist/mutations/organization/invite-member-mutation.d.ts +9 -9
  84. package/dist/mutations/organization/leave-organization-mutation.d.ts +5 -5
  85. package/dist/mutations/organization/reject-invitation-mutation.d.ts +7 -7
  86. package/dist/mutations/organization/remove-member-mutation.d.ts +5 -5
  87. package/dist/mutations/organization/set-active-organization-mutation.d.ts +7 -7
  88. package/dist/mutations/organization/update-member-role-mutation.d.ts +5 -5
  89. package/dist/mutations/organization/update-organization-mutation.d.ts +5 -5
  90. package/dist/mutations/passkey/add-passkey-mutation.d.ts +13 -13
  91. package/dist/mutations/passkey/delete-passkey-mutation.d.ts +5 -5
  92. package/dist/mutations/passkey/sign-in-passkey-mutation.d.ts +21 -21
  93. package/dist/mutations/settings/change-email-mutation.d.ts +5 -5
  94. package/dist/mutations/settings/change-password-mutation.d.ts +6 -6
  95. package/dist/mutations/settings/delete-user-mutation.d.ts +4 -4
  96. package/dist/mutations/settings/link-social-mutation.d.ts +4 -4
  97. package/dist/mutations/settings/revoke-session-mutation.d.ts +5 -5
  98. package/dist/mutations/settings/unlink-account-mutation.d.ts +5 -5
  99. package/dist/mutations/settings/update-user-mutation.d.ts +5 -5
  100. package/dist/mutations/username/is-username-available-mutation.d.ts +4 -4
  101. package/dist/mutations/username/sign-in-username-mutation.d.ts +7 -7
  102. package/dist/plugins/captcha-plugin.d.ts +1 -1
  103. package/dist/plugins.d.ts +1 -1
  104. package/dist/plugins.js +27 -1
  105. package/dist/queries/api-key/list-api-keys-query.d.ts +6 -6
  106. package/dist/queries/auth/session-query.d.ts +6 -6
  107. package/dist/queries/auth-query-options.d.ts +2 -2
  108. package/dist/queries/multi-session/list-device-sessions-query.d.ts +6 -6
  109. package/dist/queries/organization/active-organization-query.d.ts +8 -8
  110. package/dist/queries/organization/full-organization-query.d.ts +6 -6
  111. package/dist/queries/organization/has-permission-query.d.ts +6 -6
  112. package/dist/queries/organization/index.d.ts +7 -7
  113. package/dist/queries/organization/list-invitations-query.d.ts +6 -6
  114. package/dist/queries/organization/list-members-query.d.ts +6 -6
  115. package/dist/queries/organization/list-organizations-query.d.ts +6 -6
  116. package/dist/queries/organization/list-user-invitations-query.d.ts +6 -6
  117. package/dist/queries/passkey/list-passkeys-query.d.ts +6 -6
  118. package/dist/queries/settings/account-info-query.d.ts +6 -6
  119. package/dist/queries/settings/list-accounts-query.d.ts +6 -6
  120. package/dist/queries/settings/list-sessions-query.d.ts +6 -6
  121. package/dist/server/queries/api-key/list-api-keys-query.d.ts +5 -5
  122. package/dist/server/queries/auth/session-query.d.ts +5 -5
  123. package/dist/server/queries/multi-session/list-device-sessions-query.d.ts +5 -5
  124. package/dist/server/queries/organization/active-organization-query.d.ts +7 -7
  125. package/dist/server/queries/organization/full-organization-query.d.ts +5 -5
  126. package/dist/server/queries/organization/has-permission-query.d.ts +5 -5
  127. package/dist/server/queries/organization/list-invitations-query.d.ts +5 -5
  128. package/dist/server/queries/organization/list-members-query.d.ts +5 -5
  129. package/dist/server/queries/organization/list-organizations-query.d.ts +5 -5
  130. package/dist/server/queries/organization/list-user-invitations-query.d.ts +5 -5
  131. package/dist/server/queries/passkey/list-passkeys-query.d.ts +5 -5
  132. package/dist/server/queries/settings/account-info-query.d.ts +5 -5
  133. package/dist/server/queries/settings/list-accounts-query.d.ts +5 -5
  134. package/dist/server/queries/settings/list-sessions-query.d.ts +5 -5
  135. package/dist/server.d.ts +15 -15
  136. package/dist/server.js +131 -14
  137. package/dist/use-auth-plugin-ClcP84Uz.js +80 -0
  138. package/package.json +2 -2
  139. package/dist/components/auth/auth-context.js +0 -4
  140. package/dist/components/auth/auth-provider.js +0 -68
  141. package/dist/components/auth/email/email-changed.js +0 -70
  142. package/dist/components/auth/email/email-localization.js +0 -26
  143. package/dist/components/auth/email/email-styles.js +0 -129
  144. package/dist/components/auth/email/email-verification.js +0 -75
  145. package/dist/components/auth/email/index.js +0 -10
  146. package/dist/components/auth/email/magic-link.js +0 -72
  147. package/dist/components/auth/email/new-device.js +0 -90
  148. package/dist/components/auth/email/organization-invitation.js +0 -110
  149. package/dist/components/auth/email/otp-email.js +0 -65
  150. package/dist/components/auth/email/password-changed.js +0 -76
  151. package/dist/components/auth/email/reset-password.js +0 -68
  152. package/dist/components/auth/fetch-options-provider.js +0 -31
  153. package/dist/components/icons/apple.js +0 -10
  154. package/dist/components/icons/atlassian.js +0 -14
  155. package/dist/components/icons/cognito.js +0 -10
  156. package/dist/components/icons/discord.js +0 -10
  157. package/dist/components/icons/dropbox.js +0 -10
  158. package/dist/components/icons/facebook.js +0 -12
  159. package/dist/components/icons/figma.js +0 -13
  160. package/dist/components/icons/github.js +0 -12
  161. package/dist/components/icons/gitlab.js +0 -10
  162. package/dist/components/icons/google.js +0 -10
  163. package/dist/components/icons/huggingface.js +0 -10
  164. package/dist/components/icons/index.js +0 -35
  165. package/dist/components/icons/kakao.js +0 -12
  166. package/dist/components/icons/kick.js +0 -12
  167. package/dist/components/icons/line.js +0 -10
  168. package/dist/components/icons/linear.js +0 -10
  169. package/dist/components/icons/linkedin.js +0 -10
  170. package/dist/components/icons/microsoft.js +0 -10
  171. package/dist/components/icons/naver.js +0 -10
  172. package/dist/components/icons/notion.js +0 -10
  173. package/dist/components/icons/paybin.js +0 -9
  174. package/dist/components/icons/paypal.js +0 -10
  175. package/dist/components/icons/polar.js +0 -10
  176. package/dist/components/icons/railway.js +0 -10
  177. package/dist/components/icons/reddit.js +0 -10
  178. package/dist/components/icons/roblox.js +0 -13
  179. package/dist/components/icons/salesforce.js +0 -10
  180. package/dist/components/icons/slack.js +0 -10
  181. package/dist/components/icons/spotify.js +0 -10
  182. package/dist/components/icons/tiktok.js +0 -11
  183. package/dist/components/icons/twitch.js +0 -13
  184. package/dist/components/icons/vercel.js +0 -10
  185. package/dist/components/icons/vk.js +0 -10
  186. package/dist/components/icons/wechat.js +0 -10
  187. package/dist/components/icons/x.js +0 -10
  188. package/dist/components/icons/zoom.js +0 -12
  189. package/dist/components/mutation-invalidator.js +0 -31
  190. package/dist/components/settings/account/theme-preview.js +0 -10
  191. package/dist/hooks/auth/use-authenticate.js +0 -29
  192. package/dist/hooks/auth/use-user.js +0 -15
  193. package/dist/hooks/use-auth-mutation.js +0 -19
  194. package/dist/hooks/use-auth-plugin.js +0 -28
  195. package/dist/hooks/use-auth-query.js +0 -21
  196. package/dist/lib/auth-client.js +0 -1
  197. package/dist/lib/auth-plugin.js +0 -1
  198. package/dist/lib/auth-server.js +0 -1
  199. package/dist/lib/provider-icons.js +0 -48
  200. package/dist/lib/settings-tab.js +0 -1
  201. package/dist/lib/utils.js +0 -5
  202. package/dist/mutations/api-key/create-api-key-mutation.js +0 -39
  203. package/dist/mutations/api-key/delete-api-key-mutation.js +0 -39
  204. package/dist/mutations/auth/request-password-reset-mutation.js +0 -33
  205. package/dist/mutations/auth/reset-password-mutation.js +0 -34
  206. package/dist/mutations/auth/send-verification-email-mutation.js +0 -33
  207. package/dist/mutations/auth/sign-in-email-mutation.js +0 -40
  208. package/dist/mutations/auth/sign-in-social-mutation.js +0 -38
  209. package/dist/mutations/auth/sign-out-mutation.js +0 -41
  210. package/dist/mutations/auth/sign-up-email-mutation.js +0 -36
  211. package/dist/mutations/auth-mutation-options.js +0 -23
  212. package/dist/mutations/magic-link/sign-in-magic-link-mutation.js +0 -33
  213. package/dist/mutations/multi-session/revoke-multi-session-mutation.js +0 -39
  214. package/dist/mutations/multi-session/set-active-session-mutation.js +0 -40
  215. package/dist/mutations/organization/accept-invitation-mutation.js +0 -32
  216. package/dist/mutations/organization/cancel-invitation-mutation.js +0 -28
  217. package/dist/mutations/organization/check-slug-mutation.js +0 -30
  218. package/dist/mutations/organization/create-organization-mutation.js +0 -29
  219. package/dist/mutations/organization/delete-organization-mutation.js +0 -29
  220. package/dist/mutations/organization/index.js +0 -12
  221. package/dist/mutations/organization/invite-member-mutation.js +0 -35
  222. package/dist/mutations/organization/leave-organization-mutation.js +0 -32
  223. package/dist/mutations/organization/reject-invitation-mutation.js +0 -25
  224. package/dist/mutations/organization/remove-member-mutation.js +0 -29
  225. package/dist/mutations/organization/set-active-organization-mutation.js +0 -72
  226. package/dist/mutations/organization/update-member-role-mutation.js +0 -36
  227. package/dist/mutations/organization/update-organization-mutation.js +0 -36
  228. package/dist/mutations/passkey/add-passkey-mutation.js +0 -40
  229. package/dist/mutations/passkey/delete-passkey-mutation.js +0 -39
  230. package/dist/mutations/passkey/sign-in-passkey-mutation.js +0 -38
  231. package/dist/mutations/settings/change-email-mutation.js +0 -37
  232. package/dist/mutations/settings/change-password-mutation.js +0 -33
  233. package/dist/mutations/settings/delete-user-mutation.js +0 -33
  234. package/dist/mutations/settings/link-social-mutation.js +0 -33
  235. package/dist/mutations/settings/revoke-session-mutation.js +0 -39
  236. package/dist/mutations/settings/unlink-account-mutation.js +0 -39
  237. package/dist/mutations/settings/update-user-mutation.js +0 -36
  238. package/dist/mutations/username/is-username-available-mutation.js +0 -36
  239. package/dist/mutations/username/sign-in-username-mutation.js +0 -37
  240. package/dist/plugins/captcha-plugin.js +0 -34
  241. package/dist/queries/api-key/list-api-keys-query.js +0 -54
  242. package/dist/queries/auth/session-query.js +0 -72
  243. package/dist/queries/auth-query-options.js +0 -21
  244. package/dist/queries/multi-session/list-device-sessions-query.js +0 -85
  245. package/dist/queries/organization/active-organization-query.js +0 -37
  246. package/dist/queries/organization/full-organization-query.js +0 -31
  247. package/dist/queries/organization/has-permission-query.js +0 -38
  248. package/dist/queries/organization/index.js +0 -7
  249. package/dist/queries/organization/list-invitations-query.js +0 -37
  250. package/dist/queries/organization/list-members-query.js +0 -37
  251. package/dist/queries/organization/list-organizations-query.js +0 -31
  252. package/dist/queries/organization/list-user-invitations-query.js +0 -31
  253. package/dist/queries/passkey/list-passkeys-query.js +0 -83
  254. package/dist/queries/settings/account-info-query.js +0 -87
  255. package/dist/queries/settings/list-accounts-query.js +0 -85
  256. package/dist/queries/settings/list-sessions-query.js +0 -83
  257. package/dist/server/queries/api-key/list-api-keys-query.js +0 -49
  258. package/dist/server/queries/auth/session-query.js +0 -51
  259. package/dist/server/queries/multi-session/list-device-sessions-query.js +0 -54
  260. package/dist/server/queries/organization/active-organization-query.js +0 -25
  261. package/dist/server/queries/organization/full-organization-query.js +0 -21
  262. package/dist/server/queries/organization/has-permission-query.js +0 -23
  263. package/dist/server/queries/organization/list-invitations-query.js +0 -21
  264. package/dist/server/queries/organization/list-members-query.js +0 -21
  265. package/dist/server/queries/organization/list-organizations-query.js +0 -21
  266. package/dist/server/queries/organization/list-user-invitations-query.js +0 -21
  267. package/dist/server/queries/passkey/list-passkeys-query.js +0 -54
  268. package/dist/server/queries/settings/account-info-query.js +0 -54
  269. package/dist/server/queries/settings/list-accounts-query.js +0 -54
  270. package/dist/server/queries/settings/list-sessions-query.js +0 -54
@@ -1,21 +0,0 @@
1
- import { organizationQueryKeys } from "@better-auth-ui/core/plugins";
2
- import { queryOptions } from "@tanstack/react-query";
3
- /**
4
- * Query options factory for members of an organization.
5
- *
6
- * @param auth - The Better Auth server instance.
7
- * @param userId - The signed-in user's ID. Used for cache partitioning so
8
- * the key matches the client-side `listOrganizationMembersOptions` for SSR hydration.
9
- * @param params - Parameters forwarded to `auth.api.listMembers`.
10
- */
11
- export function listOrganizationMembersOptions(auth, userId, params) {
12
- const queryKey = organizationQueryKeys.members.list(userId, params?.query);
13
- const options = queryOptions({
14
- queryKey,
15
- queryFn: () => auth.api.listMembers(params)
16
- });
17
- return options;
18
- }
19
- export const ensureListOrganizationMembers = (queryClient, auth, userId, params) => queryClient.ensureQueryData(listOrganizationMembersOptions(auth, userId, params));
20
- export const prefetchListOrganizationMembers = (queryClient, auth, userId, params) => queryClient.prefetchQuery(listOrganizationMembersOptions(auth, userId, params));
21
- export const fetchListOrganizationMembers = (queryClient, auth, userId, params) => queryClient.fetchQuery(listOrganizationMembersOptions(auth, userId, params));
@@ -1,21 +0,0 @@
1
- import { organizationQueryKeys } from "@better-auth-ui/core/plugins";
2
- import { queryOptions } from "@tanstack/react-query";
3
- /**
4
- * Query options factory for organizations the current user belongs to.
5
- *
6
- * @param auth - The Better Auth server instance.
7
- * @param userId - The signed-in user's ID. Used for cache partitioning so
8
- * the key matches the client-side `listOrganizationsOptions` for SSR hydration.
9
- * @param params - Parameters forwarded to `auth.api.listOrganizations`.
10
- */
11
- export function listOrganizationsOptions(auth, userId, params) {
12
- const queryKey = organizationQueryKeys.list(userId, params?.query);
13
- const options = queryOptions({
14
- queryKey,
15
- queryFn: () => auth.api.listOrganizations(params)
16
- });
17
- return options;
18
- }
19
- export const ensureListOrganizations = (queryClient, auth, userId, params) => queryClient.ensureQueryData(listOrganizationsOptions(auth, userId, params));
20
- export const prefetchListOrganizations = (queryClient, auth, userId, params) => queryClient.prefetchQuery(listOrganizationsOptions(auth, userId, params));
21
- export const fetchListOrganizations = (queryClient, auth, userId, params) => queryClient.fetchQuery(listOrganizationsOptions(auth, userId, params));
@@ -1,21 +0,0 @@
1
- import { organizationQueryKeys } from "@better-auth-ui/core/plugins";
2
- import { queryOptions } from "@tanstack/react-query";
3
- /**
4
- * Query options factory for invitations addressed to the current user.
5
- *
6
- * @param auth - The Better Auth server instance.
7
- * @param userId - The signed-in user's ID. Used for cache partitioning so
8
- * the key matches the client-side `listUserInvitationsOptions` for SSR hydration.
9
- * @param params - Parameters forwarded to `auth.api.listUserInvitations`.
10
- */
11
- export function listUserInvitationsOptions(auth, userId, params) {
12
- const queryKey = organizationQueryKeys.userInvitations.list(userId, params?.query);
13
- const options = queryOptions({
14
- queryKey,
15
- queryFn: () => auth.api.listUserInvitations(params)
16
- });
17
- return options;
18
- }
19
- export const ensureListUserInvitations = (queryClient, auth, userId, params) => queryClient.ensureQueryData(listUserInvitationsOptions(auth, userId, params));
20
- export const prefetchListUserInvitations = (queryClient, auth, userId, params) => queryClient.prefetchQuery(listUserInvitationsOptions(auth, userId, params));
21
- export const fetchListUserInvitations = (queryClient, auth, userId, params) => queryClient.fetchQuery(listUserInvitationsOptions(auth, userId, params));
@@ -1,54 +0,0 @@
1
- import { passkeyQueryKeys } from "@better-auth-ui/core/plugins";
2
- import { queryOptions } from "@tanstack/react-query";
3
- /**
4
- * Query options factory for the current user's passkeys.
5
- *
6
- * @param auth - The Better Auth server instance with the passkey plugin.
7
- * @param userId - The signed-in user's ID. Used for cache partitioning so
8
- * the key matches the client-side `listPasskeysOptions` for SSR hydration.
9
- * @param params - Parameters forwarded to `auth.api.listPasskeys`.
10
- */
11
- export function listPasskeysOptions(auth, userId, params) {
12
- const queryKey = passkeyQueryKeys.list(userId, params?.query);
13
- const options = queryOptions({
14
- queryKey,
15
- queryFn: () => auth.api.listPasskeys(params)
16
- });
17
- return options;
18
- }
19
- /**
20
- * Get the current user's passkeys from the query cache, calling
21
- * `fetchListPasskeys` under the hood if no cached entry exists. Resolves
22
- * with the passkey list, making it suitable for reading directly in a server
23
- * component.
24
- *
25
- * @param queryClient - The React Query client used for SSR hydration.
26
- * @param auth - The Better Auth server instance with the passkey plugin.
27
- * @param userId - The signed-in user's ID, used for cache partitioning.
28
- * @param params - Parameters forwarded to `auth.api.listPasskeys`.
29
- */
30
- export const ensureListPasskeys = (queryClient, auth, userId, params) => queryClient.ensureQueryData(listPasskeysOptions(auth, userId, params));
31
- /**
32
- * Prefetch the current user's passkeys into the query cache. Behaves like
33
- * `fetchListPasskeys`, but does not throw on error and does not return
34
- * the data — use this when you only need the value to be available after
35
- * hydration.
36
- *
37
- * @param queryClient - The React Query client used for SSR hydration.
38
- * @param auth - The Better Auth server instance with the passkey plugin.
39
- * @param userId - The signed-in user's ID, used for cache partitioning.
40
- * @param params - Parameters forwarded to `auth.api.listPasskeys`.
41
- */
42
- export const prefetchListPasskeys = (queryClient, auth, userId, params) => queryClient.prefetchQuery(listPasskeysOptions(auth, userId, params));
43
- /**
44
- * Fetch and cache the current user's passkeys, resolving with the data or
45
- * throwing on error. If a cached entry exists and is neither invalidated
46
- * nor older than `staleTime`, the cached value is returned without a
47
- * network call; otherwise the latest data is fetched.
48
- *
49
- * @param queryClient - The React Query client used for SSR hydration.
50
- * @param auth - The Better Auth server instance with the passkey plugin.
51
- * @param userId - The signed-in user's ID, used for cache partitioning.
52
- * @param params - Parameters forwarded to `auth.api.listPasskeys`.
53
- */
54
- export const fetchListPasskeys = (queryClient, auth, userId, params) => queryClient.fetchQuery(listPasskeysOptions(auth, userId, params));
@@ -1,54 +0,0 @@
1
- import { authQueryKeys } from "@better-auth-ui/core";
2
- import { queryOptions } from "@tanstack/react-query";
3
- /**
4
- * Query options factory for provider-specific account info.
5
- *
6
- * @param auth - The Better Auth server instance.
7
- * @param userId - The signed-in user's ID. Used for cache partitioning so
8
- * the key matches the client-side `accountInfoOptions` for SSR hydration.
9
- * @param params - Parameters forwarded to `auth.api.accountInfo`.
10
- */
11
- export function accountInfoOptions(auth, userId, params) {
12
- const queryKey = authQueryKeys.accountInfo(userId, params?.query);
13
- const options = queryOptions({
14
- queryKey,
15
- queryFn: () => auth.api.accountInfo(params)
16
- });
17
- return options;
18
- }
19
- /**
20
- * Get the current user's provider-specific account info from the query
21
- * cache, calling `fetchAccountInfo` under the hood if no cached entry
22
- * exists. Resolves with the data, making it suitable for reading directly
23
- * in a server component.
24
- *
25
- * @param queryClient - The React Query client used for SSR hydration.
26
- * @param auth - The Better Auth server instance.
27
- * @param userId - The signed-in user's ID, used for cache partitioning.
28
- * @param params - Parameters forwarded to `auth.api.accountInfo`.
29
- */
30
- export const ensureAccountInfo = (queryClient, auth, userId, params) => queryClient.ensureQueryData(accountInfoOptions(auth, userId, params));
31
- /**
32
- * Prefetch the current user's provider-specific account info into the query
33
- * cache. Behaves like `fetchAccountInfo`, but does not throw on error and
34
- * does not return the data — use this when you only need the value to be
35
- * available after hydration.
36
- *
37
- * @param queryClient - The React Query client used for SSR hydration.
38
- * @param auth - The Better Auth server instance.
39
- * @param userId - The signed-in user's ID, used for cache partitioning.
40
- * @param params - Parameters forwarded to `auth.api.accountInfo`.
41
- */
42
- export const prefetchAccountInfo = (queryClient, auth, userId, params) => queryClient.prefetchQuery(accountInfoOptions(auth, userId, params));
43
- /**
44
- * Fetch and cache the current user's provider-specific account info,
45
- * resolving with the data or throwing on error. If a cached entry exists
46
- * and is neither invalidated nor older than `staleTime`, the cached value
47
- * is returned without a network call; otherwise the latest data is fetched.
48
- *
49
- * @param queryClient - The React Query client used for SSR hydration.
50
- * @param auth - The Better Auth server instance.
51
- * @param userId - The signed-in user's ID, used for cache partitioning.
52
- * @param params - Parameters forwarded to `auth.api.accountInfo`.
53
- */
54
- export const fetchAccountInfo = (queryClient, auth, userId, params) => queryClient.fetchQuery(accountInfoOptions(auth, userId, params));
@@ -1,54 +0,0 @@
1
- import { authQueryKeys } from "@better-auth-ui/core";
2
- import { queryOptions } from "@tanstack/react-query";
3
- /**
4
- * Query options factory for the current user's linked social accounts.
5
- *
6
- * @param auth - The Better Auth server instance.
7
- * @param userId - The signed-in user's ID. Used for cache partitioning so
8
- * the key matches the client-side `listAccountsOptions` for SSR hydration.
9
- * @param params - Parameters forwarded to `auth.api.listUserAccounts`.
10
- */
11
- export function listAccountsOptions(auth, userId, params) {
12
- const queryKey = authQueryKeys.listAccounts(userId, params?.query);
13
- const options = queryOptions({
14
- queryKey,
15
- queryFn: () => auth.api.listUserAccounts(params)
16
- });
17
- return options;
18
- }
19
- /**
20
- * Get the current user's linked social accounts from the query cache,
21
- * calling `fetchListAccounts` under the hood if no cached entry exists.
22
- * Resolves with the account list, making it suitable for reading directly
23
- * in a server component.
24
- *
25
- * @param queryClient - The React Query client used for SSR hydration.
26
- * @param auth - The Better Auth server instance.
27
- * @param userId - The signed-in user's ID, used for cache partitioning.
28
- * @param params - Parameters forwarded to `auth.api.listUserAccounts`.
29
- */
30
- export const ensureListAccounts = (queryClient, auth, userId, params) => queryClient.ensureQueryData(listAccountsOptions(auth, userId, params));
31
- /**
32
- * Prefetch the current user's linked social accounts into the query cache.
33
- * Behaves like `fetchListAccounts`, but does not throw on error and does
34
- * not return the data — use this when you only need the value to be
35
- * available after hydration.
36
- *
37
- * @param queryClient - The React Query client used for SSR hydration.
38
- * @param auth - The Better Auth server instance.
39
- * @param userId - The signed-in user's ID, used for cache partitioning.
40
- * @param params - Parameters forwarded to `auth.api.listUserAccounts`.
41
- */
42
- export const prefetchListAccounts = (queryClient, auth, userId, params) => queryClient.prefetchQuery(listAccountsOptions(auth, userId, params));
43
- /**
44
- * Fetch and cache the current user's linked social accounts, resolving
45
- * with the data or throwing on error. If a cached entry exists and is
46
- * neither invalidated nor older than `staleTime`, the cached value is
47
- * returned without a network call; otherwise the latest data is fetched.
48
- *
49
- * @param queryClient - The React Query client used for SSR hydration.
50
- * @param auth - The Better Auth server instance.
51
- * @param userId - The signed-in user's ID, used for cache partitioning.
52
- * @param params - Parameters forwarded to `auth.api.listUserAccounts`.
53
- */
54
- export const fetchListAccounts = (queryClient, auth, userId, params) => queryClient.fetchQuery(listAccountsOptions(auth, userId, params));
@@ -1,54 +0,0 @@
1
- import { authQueryKeys } from "@better-auth-ui/core";
2
- import { queryOptions } from "@tanstack/react-query";
3
- /**
4
- * Query options factory for the current user's active sessions.
5
- *
6
- * @param auth - The Better Auth server instance.
7
- * @param userId - The signed-in user's ID. Used for cache partitioning so
8
- * the key matches the client-side `listSessionsOptions` for SSR hydration.
9
- * @param params - Parameters forwarded to `auth.api.listSessions`.
10
- */
11
- export function listSessionsOptions(auth, userId, params) {
12
- const queryKey = authQueryKeys.listSessions(userId, params?.query);
13
- const options = queryOptions({
14
- queryKey,
15
- queryFn: () => auth.api.listSessions(params)
16
- });
17
- return options;
18
- }
19
- /**
20
- * Get the current user's active sessions from the query cache, calling
21
- * `fetchListSessions` under the hood if no cached entry exists. Resolves
22
- * with the session list, making it suitable for reading directly in a server
23
- * component.
24
- *
25
- * @param queryClient - The React Query client used for SSR hydration.
26
- * @param auth - The Better Auth server instance.
27
- * @param userId - The signed-in user's ID, used for cache partitioning.
28
- * @param params - Parameters forwarded to `auth.api.listSessions`.
29
- */
30
- export const ensureListSessions = (queryClient, auth, userId, params) => queryClient.ensureQueryData(listSessionsOptions(auth, userId, params));
31
- /**
32
- * Prefetch the current user's active sessions into the query cache. Behaves
33
- * like `fetchListSessions`, but does not throw on error and does not return
34
- * the data — use this when you only need the value to be available after
35
- * hydration.
36
- *
37
- * @param queryClient - The React Query client used for SSR hydration.
38
- * @param auth - The Better Auth server instance.
39
- * @param userId - The signed-in user's ID, used for cache partitioning.
40
- * @param params - Parameters forwarded to `auth.api.listSessions`.
41
- */
42
- export const prefetchListSessions = (queryClient, auth, userId, params) => queryClient.prefetchQuery(listSessionsOptions(auth, userId, params));
43
- /**
44
- * Fetch and cache the current user's active sessions, resolving with the
45
- * data or throwing on error. If a cached entry exists and is neither
46
- * invalidated nor older than `staleTime`, the cached value is returned
47
- * without a network call; otherwise the latest data is fetched.
48
- *
49
- * @param queryClient - The React Query client used for SSR hydration.
50
- * @param auth - The Better Auth server instance.
51
- * @param userId - The signed-in user's ID, used for cache partitioning.
52
- * @param params - Parameters forwarded to `auth.api.listSessions`.
53
- */
54
- export const fetchListSessions = (queryClient, auth, userId, params) => queryClient.fetchQuery(listSessionsOptions(auth, userId, params));