@better-auth-ui/react 1.6.7 → 1.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/auth/auth-context.d.ts +3 -0
- package/dist/components/auth/auth-context.js +4 -0
- package/dist/components/auth/auth-provider.d.ts +4 -4
- package/dist/components/auth/auth-provider.js +65 -41
- package/dist/components/auth/email/email-changed.d.ts +2 -2
- package/dist/components/auth/email/email-changed.js +68 -154
- package/dist/components/auth/email/email-localization.d.ts +11 -3
- package/dist/components/auth/email/email-localization.js +25 -18
- package/dist/components/auth/email/email-styles.js +77 -52
- package/dist/components/auth/email/email-verification.d.ts +2 -2
- package/dist/components/auth/email/email-verification.js +73 -138
- package/dist/components/auth/email/index.d.ts +10 -9
- package/dist/components/auth/email/index.js +10 -9
- package/dist/components/auth/email/magic-link.d.ts +2 -2
- package/dist/components/auth/email/magic-link.js +70 -139
- package/dist/components/auth/email/new-device.d.ts +2 -2
- package/dist/components/auth/email/new-device.js +88 -221
- package/dist/components/auth/email/organization-invitation.d.ts +121 -0
- package/dist/components/auth/email/organization-invitation.js +110 -0
- package/dist/components/auth/email/otp-email.d.ts +2 -2
- package/dist/components/auth/email/otp-email.js +63 -127
- package/dist/components/auth/email/password-changed.d.ts +2 -2
- package/dist/components/auth/email/password-changed.js +74 -157
- package/dist/components/auth/email/reset-password.d.ts +2 -2
- package/dist/components/auth/email/reset-password.js +66 -138
- package/dist/components/auth/fetch-options-provider.d.ts +1 -1
- package/dist/components/auth/fetch-options-provider.js +28 -27
- package/dist/components/icons/apple.d.ts +1 -1
- package/dist/components/icons/apple.js +9 -16
- package/dist/components/icons/atlassian.d.ts +1 -1
- package/dist/components/icons/atlassian.js +13 -38
- package/dist/components/icons/cognito.d.ts +1 -1
- package/dist/components/icons/cognito.js +9 -19
- package/dist/components/icons/discord.d.ts +1 -1
- package/dist/components/icons/discord.js +9 -16
- package/dist/components/icons/dropbox.d.ts +1 -1
- package/dist/components/icons/dropbox.js +9 -16
- package/dist/components/icons/facebook.d.ts +1 -1
- package/dist/components/icons/facebook.js +11 -19
- package/dist/components/icons/figma.d.ts +1 -1
- package/dist/components/icons/figma.js +12 -34
- package/dist/components/icons/github.d.ts +1 -1
- package/dist/components/icons/github.js +11 -16
- package/dist/components/icons/gitlab.d.ts +1 -1
- package/dist/components/icons/gitlab.js +9 -30
- package/dist/components/icons/google.d.ts +1 -1
- package/dist/components/icons/google.js +9 -39
- package/dist/components/icons/huggingface.d.ts +1 -1
- package/dist/components/icons/huggingface.js +9 -38
- package/dist/components/icons/index.d.ts +35 -35
- package/dist/components/icons/index.js +35 -35
- package/dist/components/icons/kakao.d.ts +1 -1
- package/dist/components/icons/kakao.js +11 -16
- package/dist/components/icons/kick.d.ts +1 -1
- package/dist/components/icons/kick.js +11 -20
- package/dist/components/icons/line.d.ts +1 -1
- package/dist/components/icons/line.js +9 -16
- package/dist/components/icons/linear.d.ts +1 -1
- package/dist/components/icons/linear.js +9 -16
- package/dist/components/icons/linkedin.d.ts +1 -1
- package/dist/components/icons/linkedin.js +9 -33
- package/dist/components/icons/microsoft.d.ts +1 -1
- package/dist/components/icons/microsoft.js +9 -30
- package/dist/components/icons/naver.d.ts +1 -1
- package/dist/components/icons/naver.js +9 -16
- package/dist/components/icons/notion.d.ts +1 -1
- package/dist/components/icons/notion.js +9 -16
- package/dist/components/icons/paybin.d.ts +1 -1
- package/dist/components/icons/paybin.js +8 -32
- package/dist/components/icons/paypal.d.ts +1 -1
- package/dist/components/icons/paypal.js +9 -30
- package/dist/components/icons/polar.d.ts +1 -1
- package/dist/components/icons/polar.js +9 -24
- package/dist/components/icons/railway.d.ts +1 -1
- package/dist/components/icons/railway.js +9 -16
- package/dist/components/icons/reddit.d.ts +1 -1
- package/dist/components/icons/reddit.js +9 -21
- package/dist/components/icons/roblox.d.ts +1 -1
- package/dist/components/icons/roblox.js +12 -17
- package/dist/components/icons/salesforce.d.ts +1 -1
- package/dist/components/icons/salesforce.js +9 -16
- package/dist/components/icons/slack.d.ts +1 -1
- package/dist/components/icons/slack.js +9 -30
- package/dist/components/icons/spotify.d.ts +1 -1
- package/dist/components/icons/spotify.js +9 -16
- package/dist/components/icons/tiktok.d.ts +1 -1
- package/dist/components/icons/tiktok.js +10 -23
- package/dist/components/icons/twitch.d.ts +1 -1
- package/dist/components/icons/twitch.js +12 -43
- package/dist/components/icons/vercel.d.ts +1 -1
- package/dist/components/icons/vercel.js +9 -16
- package/dist/components/icons/vk.d.ts +1 -1
- package/dist/components/icons/vk.js +9 -16
- package/dist/components/icons/wechat.d.ts +1 -1
- package/dist/components/icons/wechat.js +9 -16
- package/dist/components/icons/x.d.ts +1 -1
- package/dist/components/icons/x.js +9 -16
- package/dist/components/icons/zoom.d.ts +1 -1
- package/dist/components/icons/zoom.js +11 -69
- package/dist/components/mutation-invalidator.d.ts +1 -0
- package/dist/components/mutation-invalidator.js +31 -0
- package/dist/components/settings/account/theme-preview.js +7 -286
- package/dist/email.d.ts +1 -1
- package/dist/email.js +1 -11
- package/dist/hooks/auth/use-authenticate.d.ts +3 -3
- package/dist/hooks/auth/use-authenticate.js +28 -22
- package/dist/hooks/auth/use-user.d.ts +34 -34
- package/dist/hooks/auth/use-user.js +14 -10
- package/dist/hooks/use-auth-mutation.d.ts +4 -4
- package/dist/hooks/use-auth-mutation.js +18 -10
- package/dist/hooks/use-auth-plugin.d.ts +1 -1
- package/dist/hooks/use-auth-plugin.js +26 -8
- package/dist/hooks/use-auth-query.d.ts +3 -3
- package/dist/hooks/use-auth-query.js +20 -14
- package/dist/index.d.ts +48 -45
- package/dist/index.js +47 -79
- package/dist/lib/auth-client.d.ts +7 -4
- package/dist/lib/auth-client.js +1 -0
- package/dist/lib/auth-plugin.d.ts +19 -3
- package/dist/lib/auth-plugin.js +1 -0
- package/dist/lib/auth-server.d.ts +10 -3
- package/dist/lib/auth-server.js +1 -0
- package/dist/lib/provider-icons.d.ts +2 -2
- package/dist/lib/provider-icons.js +47 -75
- package/dist/lib/settings-tab.d.ts +19 -0
- package/dist/lib/settings-tab.js +1 -0
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +4 -7
- package/dist/mutations/api-key/create-api-key-mutation.d.ts +9 -7
- package/dist/mutations/api-key/create-api-key-mutation.js +37 -27
- package/dist/mutations/api-key/delete-api-key-mutation.d.ts +10 -6
- package/dist/mutations/api-key/delete-api-key-mutation.js +37 -27
- package/dist/mutations/auth/request-password-reset-mutation.d.ts +4 -4
- package/dist/mutations/auth/request-password-reset-mutation.js +31 -22
- package/dist/mutations/auth/reset-password-mutation.d.ts +4 -4
- package/dist/mutations/auth/reset-password-mutation.js +32 -22
- package/dist/mutations/auth/send-verification-email-mutation.d.ts +4 -4
- package/dist/mutations/auth/send-verification-email-mutation.js +31 -22
- package/dist/mutations/auth/sign-in-email-mutation.d.ts +10 -10
- package/dist/mutations/auth/sign-in-email-mutation.js +38 -27
- package/dist/mutations/auth/sign-in-social-mutation.d.ts +6 -6
- package/dist/mutations/auth/sign-in-social-mutation.js +36 -22
- package/dist/mutations/auth/sign-out-mutation.d.ts +9 -7
- package/dist/mutations/auth/sign-out-mutation.js +39 -26
- package/dist/mutations/auth/sign-up-email-mutation.d.ts +12 -12
- package/dist/mutations/auth/sign-up-email-mutation.js +34 -27
- package/dist/mutations/auth-mutation-options.d.ts +2 -2
- package/dist/mutations/auth-mutation-options.js +22 -18
- package/dist/mutations/magic-link/sign-in-magic-link-mutation.d.ts +4 -4
- package/dist/mutations/magic-link/sign-in-magic-link-mutation.js +31 -22
- package/dist/mutations/multi-session/revoke-multi-session-mutation.d.ts +8 -8
- package/dist/mutations/multi-session/revoke-multi-session-mutation.js +37 -27
- package/dist/mutations/multi-session/set-active-session-mutation.d.ts +8 -9
- package/dist/mutations/multi-session/set-active-session-mutation.js +38 -29
- package/dist/mutations/organization/accept-invitation-mutation.d.ts +43 -0
- package/dist/mutations/organization/accept-invitation-mutation.js +32 -0
- package/dist/mutations/organization/cancel-invitation-mutation.d.ts +25 -0
- package/dist/mutations/organization/cancel-invitation-mutation.js +28 -0
- package/dist/mutations/organization/check-slug-mutation.d.ts +21 -0
- package/dist/mutations/organization/check-slug-mutation.js +30 -0
- package/dist/mutations/organization/create-organization-mutation.d.ts +39 -0
- package/dist/mutations/organization/create-organization-mutation.js +29 -0
- package/dist/mutations/organization/delete-organization-mutation.d.ts +21 -0
- package/dist/mutations/organization/delete-organization-mutation.js +29 -0
- package/dist/mutations/organization/index.d.ts +12 -0
- package/dist/mutations/organization/index.js +12 -0
- package/dist/mutations/organization/invite-member-mutation.d.ts +43 -0
- package/dist/mutations/organization/invite-member-mutation.js +35 -0
- package/dist/mutations/organization/leave-organization-mutation.d.ts +65 -0
- package/dist/mutations/organization/leave-organization-mutation.js +32 -0
- package/dist/mutations/organization/reject-invitation-mutation.d.ts +31 -0
- package/dist/mutations/organization/reject-invitation-mutation.js +25 -0
- package/dist/mutations/organization/remove-member-mutation.d.ts +35 -0
- package/dist/mutations/organization/remove-member-mutation.js +29 -0
- package/dist/mutations/organization/set-active-organization-mutation.d.ts +71 -0
- package/dist/mutations/organization/set-active-organization-mutation.js +72 -0
- package/dist/mutations/organization/update-member-role-mutation.d.ts +31 -0
- package/dist/mutations/organization/update-member-role-mutation.js +36 -0
- package/dist/mutations/organization/update-organization-mutation.d.ts +21 -0
- package/dist/mutations/organization/update-organization-mutation.js +36 -0
- package/dist/mutations/passkey/add-passkey-mutation.d.ts +16 -16
- package/dist/mutations/passkey/add-passkey-mutation.js +38 -27
- package/dist/mutations/passkey/delete-passkey-mutation.d.ts +8 -8
- package/dist/mutations/passkey/delete-passkey-mutation.js +37 -27
- package/dist/mutations/passkey/sign-in-passkey-mutation.d.ts +24 -24
- package/dist/mutations/passkey/sign-in-passkey-mutation.js +36 -27
- package/dist/mutations/settings/change-email-mutation.d.ts +9 -8
- package/dist/mutations/settings/change-email-mutation.js +35 -27
- package/dist/mutations/settings/change-password-mutation.d.ts +6 -6
- package/dist/mutations/settings/change-password-mutation.js +31 -22
- package/dist/mutations/settings/delete-user-mutation.d.ts +4 -4
- package/dist/mutations/settings/delete-user-mutation.js +31 -22
- package/dist/mutations/settings/link-social-mutation.d.ts +4 -4
- package/dist/mutations/settings/link-social-mutation.js +31 -22
- package/dist/mutations/settings/revoke-session-mutation.d.ts +8 -8
- package/dist/mutations/settings/revoke-session-mutation.js +37 -27
- package/dist/mutations/settings/unlink-account-mutation.d.ts +8 -8
- package/dist/mutations/settings/unlink-account-mutation.js +37 -27
- package/dist/mutations/settings/update-user-mutation.d.ts +8 -8
- package/dist/mutations/settings/update-user-mutation.js +34 -33
- package/dist/mutations/username/is-username-available-mutation.d.ts +4 -4
- package/dist/mutations/username/is-username-available-mutation.js +34 -22
- package/dist/mutations/username/sign-in-username-mutation.d.ts +10 -10
- package/dist/mutations/username/sign-in-username-mutation.js +35 -27
- package/dist/plugins/captcha-plugin.d.ts +3 -3
- package/dist/plugins/captcha-plugin.js +31 -26
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +1 -2
- package/dist/queries/api-key/list-api-keys-query.d.ts +20 -11
- package/dist/queries/api-key/list-api-keys-query.js +52 -29
- package/dist/queries/auth/session-query.d.ts +6 -6
- package/dist/queries/auth/session-query.js +70 -28
- package/dist/queries/auth-query-options.d.ts +2 -2
- package/dist/queries/auth-query-options.js +20 -16
- package/dist/queries/multi-session/list-device-sessions-query.d.ts +8 -8
- package/dist/queries/multi-session/list-device-sessions-query.js +83 -29
- package/dist/queries/organization/active-organization-query.d.ts +39 -0
- package/dist/queries/organization/active-organization-query.js +37 -0
- package/dist/queries/organization/full-organization-query.d.ts +37 -0
- package/dist/queries/organization/full-organization-query.js +31 -0
- package/dist/queries/organization/has-permission-query.d.ts +21 -0
- package/dist/queries/organization/has-permission-query.js +38 -0
- package/dist/queries/organization/index.d.ts +7 -0
- package/dist/queries/organization/index.js +7 -0
- package/dist/queries/organization/list-invitations-query.d.ts +29 -0
- package/dist/queries/organization/list-invitations-query.js +37 -0
- package/dist/queries/organization/list-members-query.d.ts +61 -0
- package/dist/queries/organization/list-members-query.js +37 -0
- package/dist/queries/organization/list-organizations-query.d.ts +22 -0
- package/dist/queries/organization/list-organizations-query.js +31 -0
- package/dist/queries/organization/list-user-invitations-query.d.ts +29 -0
- package/dist/queries/organization/list-user-invitations-query.js +31 -0
- package/dist/queries/passkey/list-passkeys-query.d.ts +8 -8
- package/dist/queries/passkey/list-passkeys-query.js +81 -29
- package/dist/queries/settings/account-info-query.d.ts +6 -6
- package/dist/queries/settings/account-info-query.js +85 -29
- package/dist/queries/settings/list-accounts-query.d.ts +6 -6
- package/dist/queries/settings/list-accounts-query.js +83 -29
- package/dist/queries/settings/list-sessions-query.d.ts +6 -6
- package/dist/queries/settings/list-sessions-query.js +81 -29
- package/dist/server/queries/api-key/list-api-keys-query.d.ts +83 -0
- package/dist/server/queries/api-key/list-api-keys-query.js +49 -0
- package/dist/server/queries/auth/session-query.d.ts +5 -5
- package/dist/server/queries/auth/session-query.js +50 -12
- package/dist/server/queries/multi-session/list-device-sessions-query.d.ts +7 -7
- package/dist/server/queries/multi-session/list-device-sessions-query.js +53 -11
- package/dist/server/queries/organization/active-organization-query.d.ts +61 -0
- package/dist/server/queries/organization/active-organization-query.js +25 -0
- package/dist/server/queries/organization/full-organization-query.d.ts +42 -0
- package/dist/server/queries/organization/full-organization-query.js +21 -0
- package/dist/server/queries/organization/has-permission-query.d.ts +66 -0
- package/dist/server/queries/organization/has-permission-query.js +23 -0
- package/dist/server/queries/organization/list-invitations-query.d.ts +34 -0
- package/dist/server/queries/organization/list-invitations-query.js +21 -0
- package/dist/server/queries/organization/list-members-query.d.ts +66 -0
- package/dist/server/queries/organization/list-members-query.js +21 -0
- package/dist/server/queries/organization/list-organizations-query.d.ts +27 -0
- package/dist/server/queries/organization/list-organizations-query.js +21 -0
- package/dist/server/queries/organization/list-user-invitations-query.d.ts +34 -0
- package/dist/server/queries/organization/list-user-invitations-query.js +21 -0
- package/dist/server/queries/passkey/list-passkeys-query.d.ts +7 -7
- package/dist/server/queries/passkey/list-passkeys-query.js +53 -11
- package/dist/server/queries/settings/account-info-query.d.ts +5 -5
- package/dist/server/queries/settings/account-info-query.js +53 -11
- package/dist/server/queries/settings/list-accounts-query.d.ts +5 -5
- package/dist/server/queries/settings/list-accounts-query.js +53 -11
- package/dist/server/queries/settings/list-sessions-query.d.ts +5 -5
- package/dist/server/queries/settings/list-sessions-query.js +53 -11
- package/dist/server.d.ts +15 -7
- package/dist/server.js +14 -7
- package/package.json +20 -17
- package/src/components/auth/auth-context.tsx +7 -0
- package/src/components/auth/auth-provider.tsx +19 -31
- package/src/components/auth/email/email-localization.tsx +5 -3
- package/src/components/auth/email/index.ts +1 -0
- package/src/components/auth/email/organization-invitation.tsx +454 -0
- package/src/components/mutation-invalidator.tsx +67 -0
- package/src/index.ts +3 -0
- package/src/lib/auth-client.ts +7 -0
- package/src/lib/auth-plugin.ts +17 -0
- package/src/lib/auth-server.ts +17 -1
- package/src/lib/settings-tab.ts +21 -0
- package/src/mutations/api-key/create-api-key-mutation.ts +34 -19
- package/src/mutations/api-key/delete-api-key-mutation.ts +36 -19
- package/src/mutations/auth/sign-in-email-mutation.ts +18 -22
- package/src/mutations/auth/sign-out-mutation.ts +19 -13
- package/src/mutations/auth/sign-up-email-mutation.ts +18 -22
- package/src/mutations/multi-session/revoke-multi-session-mutation.ts +31 -20
- package/src/mutations/multi-session/set-active-session-mutation.ts +25 -44
- package/src/mutations/organization/accept-invitation-mutation.ts +71 -0
- package/src/mutations/organization/cancel-invitation-mutation.ts +67 -0
- package/src/mutations/organization/check-slug-mutation.ts +55 -0
- package/src/mutations/organization/create-organization-mutation.ts +71 -0
- package/src/mutations/organization/delete-organization-mutation.ts +71 -0
- package/src/mutations/organization/index.ts +12 -0
- package/src/mutations/organization/invite-member-mutation.ts +81 -0
- package/src/mutations/organization/leave-organization-mutation.ts +74 -0
- package/src/mutations/organization/reject-invitation-mutation.ts +64 -0
- package/src/mutations/organization/remove-member-mutation.ts +67 -0
- package/src/mutations/organization/set-active-organization-mutation.ts +142 -0
- package/src/mutations/organization/update-member-role-mutation.ts +81 -0
- package/src/mutations/organization/update-organization-mutation.ts +84 -0
- package/src/mutations/passkey/add-passkey-mutation.ts +28 -17
- package/src/mutations/passkey/delete-passkey-mutation.ts +27 -17
- package/src/mutations/passkey/sign-in-passkey-mutation.ts +18 -21
- package/src/mutations/settings/change-email-mutation.ts +22 -18
- package/src/mutations/settings/delete-user-mutation.ts +2 -2
- package/src/mutations/settings/revoke-session-mutation.ts +24 -19
- package/src/mutations/settings/unlink-account-mutation.ts +24 -17
- package/src/mutations/settings/update-user-mutation.ts +18 -30
- package/src/mutations/username/is-username-available-mutation.ts +2 -2
- package/src/mutations/username/sign-in-username-mutation.ts +20 -23
- package/src/queries/api-key/list-api-keys-query.ts +20 -8
- package/src/queries/multi-session/list-device-sessions-query.ts +2 -2
- package/src/queries/organization/active-organization-query.ts +140 -0
- package/src/queries/organization/full-organization-query.ts +113 -0
- package/src/queries/organization/has-permission-query.ts +124 -0
- package/src/queries/organization/index.ts +7 -0
- package/src/queries/organization/list-invitations-query.ts +133 -0
- package/src/queries/organization/list-members-query.ts +133 -0
- package/src/queries/organization/list-organizations-query.ts +122 -0
- package/src/queries/organization/list-user-invitations-query.ts +122 -0
- package/src/queries/passkey/list-passkeys-query.ts +2 -2
- package/src/server/queries/api-key/list-api-keys-query.ts +94 -0
- package/src/server/queries/multi-session/list-device-sessions-query.ts +2 -2
- package/src/server/queries/organization/active-organization-query.ts +92 -0
- package/src/server/queries/organization/full-organization-query.ts +64 -0
- package/src/server/queries/organization/has-permission-query.ts +66 -0
- package/src/server/queries/organization/list-invitations-query.ts +81 -0
- package/src/server/queries/organization/list-members-query.ts +75 -0
- package/src/server/queries/organization/list-organizations-query.ts +67 -0
- package/src/server/queries/organization/list-user-invitations-query.ts +68 -0
- package/src/server/queries/passkey/list-passkeys-query.ts +2 -2
- package/src/server.ts +8 -0
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { type QueryClient } from "@tanstack/react-query";
|
|
2
|
+
import type { BetterFetchError } from "better-auth/react";
|
|
3
|
+
import type { PasskeyAuthClient } from "../../lib/auth-client";
|
|
3
4
|
export type DeletePasskeyParams<TAuthClient extends PasskeyAuthClient> = Parameters<TAuthClient["passkey"]["deletePasskey"]>[0];
|
|
4
|
-
export type DeletePasskeyOptions<TAuthClient extends PasskeyAuthClient> = Omit<ReturnType<typeof deletePasskeyOptions<TAuthClient>>, "mutationKey" | "mutationFn">;
|
|
5
|
+
export type DeletePasskeyOptions<TAuthClient extends PasskeyAuthClient> = Omit<ReturnType<typeof deletePasskeyOptions<TAuthClient>>, "mutationKey" | "mutationFn" | "meta">;
|
|
5
6
|
/**
|
|
6
7
|
* Mutation options factory for deleting a passkey.
|
|
7
8
|
*
|
|
8
9
|
* @param authClient - The Better Auth client.
|
|
9
10
|
*/
|
|
10
|
-
export declare function deletePasskeyOptions<TAuthClient extends PasskeyAuthClient>(authClient: TAuthClient): import(
|
|
11
|
+
export declare function deletePasskeyOptions<TAuthClient extends PasskeyAuthClient>(authClient: TAuthClient): import("@tanstack/react-query").WithRequired<import("@tanstack/react-query").UseMutationOptions<{
|
|
11
12
|
status: boolean;
|
|
12
13
|
}, BetterFetchError, DeletePasskeyParams<TAuthClient>, unknown>, "mutationKey">;
|
|
13
14
|
/**
|
|
14
15
|
* Create a mutation for deleting a passkey.
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
-
* list
|
|
18
|
-
* `onSuccess`, `onError`, and `retry`.
|
|
17
|
+
* On success, `MutationInvalidator` awaits invalidation of the user's
|
|
18
|
+
* passkey list (see `meta.awaits`).
|
|
19
19
|
*
|
|
20
20
|
* @param authClient - The Better Auth client with the passkey plugin.
|
|
21
21
|
* @param options - React Query options forwarded to `useMutation`.
|
|
22
22
|
*/
|
|
23
|
-
export declare function useDeletePasskey<TAuthClient extends PasskeyAuthClient>(authClient: TAuthClient, options?: DeletePasskeyOptions<TAuthClient
|
|
23
|
+
export declare function useDeletePasskey<TAuthClient extends PasskeyAuthClient>(authClient: TAuthClient, options?: DeletePasskeyOptions<TAuthClient>, queryClient?: QueryClient): import("@tanstack/react-query").UseMutationResult<{
|
|
24
24
|
status: boolean;
|
|
25
25
|
}, BetterFetchError, DeletePasskeyParams<TAuthClient>, unknown>;
|
|
@@ -1,29 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { mutationOptions
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { passkeyMutationKeys, passkeyQueryKeys } from "@better-auth-ui/core/plugins";
|
|
2
|
+
import { mutationOptions, useMutation } from "@tanstack/react-query";
|
|
3
|
+
import { useSession } from "../../queries/auth/session-query";
|
|
4
|
+
/**
|
|
5
|
+
* Mutation options factory for deleting a passkey.
|
|
6
|
+
*
|
|
7
|
+
* @param authClient - The Better Auth client.
|
|
8
|
+
*/
|
|
9
|
+
export function deletePasskeyOptions(authClient) {
|
|
10
|
+
const mutationKey = passkeyMutationKeys.deletePasskey;
|
|
11
|
+
const mutationFn = (params) => authClient.passkey.deletePasskey({
|
|
12
|
+
...params,
|
|
13
|
+
fetchOptions: { ...params?.fetchOptions, throw: true }
|
|
14
|
+
});
|
|
15
|
+
return mutationOptions({
|
|
16
|
+
mutationKey,
|
|
17
|
+
mutationFn
|
|
18
|
+
});
|
|
17
19
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Create a mutation for deleting a passkey.
|
|
22
|
+
*
|
|
23
|
+
* On success, `MutationInvalidator` awaits invalidation of the user's
|
|
24
|
+
* passkey list (see `meta.awaits`).
|
|
25
|
+
*
|
|
26
|
+
* @param authClient - The Better Auth client with the passkey plugin.
|
|
27
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
28
|
+
*/
|
|
29
|
+
export function useDeletePasskey(authClient, options, queryClient) {
|
|
30
|
+
const { data: session } = useSession(authClient, undefined, queryClient);
|
|
31
|
+
const userId = session?.user.id;
|
|
32
|
+
return useMutation({
|
|
33
|
+
...deletePasskeyOptions(authClient),
|
|
34
|
+
...options,
|
|
35
|
+
meta: {
|
|
36
|
+
awaits: [passkeyQueryKeys.lists(userId)]
|
|
37
|
+
}
|
|
38
|
+
}, queryClient);
|
|
27
39
|
}
|
|
28
|
-
//#endregion
|
|
29
|
-
export { i as deletePasskeyOptions, a as useDeletePasskey };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { type QueryClient } from "@tanstack/react-query";
|
|
2
|
+
import type { BetterFetchError } from "better-auth/react";
|
|
3
|
+
import type { PasskeyAuthClient } from "../../lib/auth-client";
|
|
3
4
|
export type SignInPasskeyParams<TAuthClient extends PasskeyAuthClient> = Parameters<TAuthClient["signIn"]["passkey"]>[0];
|
|
4
|
-
export type SignInPasskeyOptions<TAuthClient extends PasskeyAuthClient> = Omit<ReturnType<typeof signInPasskeyOptions<TAuthClient>>, "mutationKey" | "mutationFn">;
|
|
5
|
+
export type SignInPasskeyOptions<TAuthClient extends PasskeyAuthClient> = Omit<ReturnType<typeof signInPasskeyOptions<TAuthClient>>, "mutationKey" | "mutationFn" | "meta">;
|
|
5
6
|
/**
|
|
6
7
|
* Mutation options factory for passkey sign-in.
|
|
7
8
|
*
|
|
8
9
|
* @param authClient - The Better Auth client with the passkey plugin.
|
|
9
10
|
*/
|
|
10
|
-
export declare function signInPasskeyOptions<TAuthClient extends PasskeyAuthClient>(authClient: TAuthClient): import(
|
|
11
|
+
export declare function signInPasskeyOptions<TAuthClient extends PasskeyAuthClient>(authClient: TAuthClient): import("@tanstack/react-query").WithRequired<import("@tanstack/react-query").UseMutationOptions<{
|
|
11
12
|
data: null;
|
|
12
13
|
error: {
|
|
13
14
|
message?: string | undefined;
|
|
@@ -16,8 +17,8 @@ export declare function signInPasskeyOptions<TAuthClient extends PasskeyAuthClie
|
|
|
16
17
|
};
|
|
17
18
|
} | {
|
|
18
19
|
data: {
|
|
19
|
-
session: import(
|
|
20
|
-
user: import(
|
|
20
|
+
session: import("better-auth").Session;
|
|
21
|
+
user: import("better-auth").User;
|
|
21
22
|
};
|
|
22
23
|
error: null;
|
|
23
24
|
} | {
|
|
@@ -30,8 +31,8 @@ export declare function signInPasskeyOptions<TAuthClient extends PasskeyAuthClie
|
|
|
30
31
|
};
|
|
31
32
|
} | {
|
|
32
33
|
webauthn: {
|
|
33
|
-
response: import(
|
|
34
|
-
clientExtensionResults: import(
|
|
34
|
+
response: import("@better-auth/passkey/client").AuthenticationResponseJSON;
|
|
35
|
+
clientExtensionResults: import("@better-auth/passkey/client").AuthenticationExtensionsClientOutputs;
|
|
35
36
|
};
|
|
36
37
|
data: null;
|
|
37
38
|
error: {
|
|
@@ -41,26 +42,25 @@ export declare function signInPasskeyOptions<TAuthClient extends PasskeyAuthClie
|
|
|
41
42
|
};
|
|
42
43
|
} | {
|
|
43
44
|
webauthn: {
|
|
44
|
-
response: import(
|
|
45
|
-
clientExtensionResults: import(
|
|
45
|
+
response: import("@better-auth/passkey/client").AuthenticationResponseJSON;
|
|
46
|
+
clientExtensionResults: import("@better-auth/passkey/client").AuthenticationExtensionsClientOutputs;
|
|
46
47
|
};
|
|
47
48
|
data: {
|
|
48
|
-
session: import(
|
|
49
|
-
user: import(
|
|
49
|
+
session: import("better-auth").Session;
|
|
50
|
+
user: import("better-auth").User;
|
|
50
51
|
};
|
|
51
52
|
error: null;
|
|
52
53
|
}, BetterFetchError, void | SignInPasskeyParams<TAuthClient> | undefined, unknown>, "mutationKey">;
|
|
53
54
|
/**
|
|
54
55
|
* Create a mutation for passkey sign-in.
|
|
55
56
|
*
|
|
56
|
-
*
|
|
57
|
-
* the new session is refetched
|
|
58
|
-
* such as `onSuccess`, `onError`, and `retry`.
|
|
57
|
+
* On success, `MutationInvalidator` awaits invalidation of the session
|
|
58
|
+
* query so the new session is refetched (see `meta.awaits`).
|
|
59
59
|
*
|
|
60
60
|
* @param authClient - The Better Auth client with the passkey plugin.
|
|
61
61
|
* @param options - React Query options forwarded to `useMutation`.
|
|
62
62
|
*/
|
|
63
|
-
export declare function useSignInPasskey<TAuthClient extends PasskeyAuthClient>(authClient: TAuthClient, options?: SignInPasskeyOptions<TAuthClient
|
|
63
|
+
export declare function useSignInPasskey<TAuthClient extends PasskeyAuthClient>(authClient: TAuthClient, options?: SignInPasskeyOptions<TAuthClient>, queryClient?: QueryClient): import("@tanstack/react-query").UseMutationResult<{
|
|
64
64
|
data: null;
|
|
65
65
|
error: {
|
|
66
66
|
message?: string | undefined;
|
|
@@ -69,8 +69,8 @@ export declare function useSignInPasskey<TAuthClient extends PasskeyAuthClient>(
|
|
|
69
69
|
};
|
|
70
70
|
} | {
|
|
71
71
|
data: {
|
|
72
|
-
session: import(
|
|
73
|
-
user: import(
|
|
72
|
+
session: import("better-auth").Session;
|
|
73
|
+
user: import("better-auth").User;
|
|
74
74
|
};
|
|
75
75
|
error: null;
|
|
76
76
|
} | {
|
|
@@ -83,8 +83,8 @@ export declare function useSignInPasskey<TAuthClient extends PasskeyAuthClient>(
|
|
|
83
83
|
};
|
|
84
84
|
} | {
|
|
85
85
|
webauthn: {
|
|
86
|
-
response: import(
|
|
87
|
-
clientExtensionResults: import(
|
|
86
|
+
response: import("@better-auth/passkey/client").AuthenticationResponseJSON;
|
|
87
|
+
clientExtensionResults: import("@better-auth/passkey/client").AuthenticationExtensionsClientOutputs;
|
|
88
88
|
};
|
|
89
89
|
data: null;
|
|
90
90
|
error: {
|
|
@@ -94,12 +94,12 @@ export declare function useSignInPasskey<TAuthClient extends PasskeyAuthClient>(
|
|
|
94
94
|
};
|
|
95
95
|
} | {
|
|
96
96
|
webauthn: {
|
|
97
|
-
response: import(
|
|
98
|
-
clientExtensionResults: import(
|
|
97
|
+
response: import("@better-auth/passkey/client").AuthenticationResponseJSON;
|
|
98
|
+
clientExtensionResults: import("@better-auth/passkey/client").AuthenticationExtensionsClientOutputs;
|
|
99
99
|
};
|
|
100
100
|
data: {
|
|
101
|
-
session: import(
|
|
102
|
-
user: import(
|
|
101
|
+
session: import("better-auth").Session;
|
|
102
|
+
user: import("better-auth").User;
|
|
103
103
|
};
|
|
104
104
|
error: null;
|
|
105
105
|
}, BetterFetchError, void | SignInPasskeyParams<TAuthClient> | undefined, unknown>;
|
|
@@ -1,29 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { authQueryKeys } from "@better-auth-ui/core";
|
|
2
|
+
import { passkeyMutationKeys } from "@better-auth-ui/core/plugins";
|
|
3
|
+
import { mutationOptions, useMutation } from "@tanstack/react-query";
|
|
4
|
+
/**
|
|
5
|
+
* Mutation options factory for passkey sign-in.
|
|
6
|
+
*
|
|
7
|
+
* @param authClient - The Better Auth client with the passkey plugin.
|
|
8
|
+
*/
|
|
9
|
+
export function signInPasskeyOptions(authClient) {
|
|
10
|
+
const mutationKey = passkeyMutationKeys.signIn;
|
|
11
|
+
// biome-ignore lint/suspicious/noConfusingVoidType: void allows no-arg mutate
|
|
12
|
+
const mutationFn = (params) => authClient.signIn.passkey({
|
|
13
|
+
...(params ?? {}),
|
|
14
|
+
fetchOptions: { ...params?.fetchOptions, throw: true }
|
|
15
|
+
});
|
|
16
|
+
return mutationOptions({
|
|
17
|
+
mutationKey,
|
|
18
|
+
mutationFn
|
|
19
|
+
});
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Create a mutation for passkey sign-in.
|
|
23
|
+
*
|
|
24
|
+
* On success, `MutationInvalidator` awaits invalidation of the session
|
|
25
|
+
* query so the new session is refetched (see `meta.awaits`).
|
|
26
|
+
*
|
|
27
|
+
* @param authClient - The Better Auth client with the passkey plugin.
|
|
28
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
29
|
+
*/
|
|
30
|
+
export function useSignInPasskey(authClient, options, queryClient) {
|
|
31
|
+
return useMutation({
|
|
32
|
+
...signInPasskeyOptions(authClient),
|
|
33
|
+
...options,
|
|
34
|
+
meta: {
|
|
35
|
+
awaits: [authQueryKeys.session]
|
|
36
|
+
}
|
|
37
|
+
}, queryClient);
|
|
27
38
|
}
|
|
28
|
-
//#endregion
|
|
29
|
-
export { a as signInPasskeyOptions, o as useSignInPasskey };
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { type QueryClient } from "@tanstack/react-query";
|
|
2
|
+
import type { BetterFetchError } from "better-auth/react";
|
|
3
|
+
import type { AuthClient } from "../../lib/auth-client";
|
|
3
4
|
export type ChangeEmailParams<TAuthClient extends AuthClient> = Parameters<TAuthClient["changeEmail"]>[0];
|
|
4
|
-
export type ChangeEmailOptions<TAuthClient extends AuthClient> = Omit<ReturnType<typeof changeEmailOptions<TAuthClient>>, "mutationKey" | "mutationFn">;
|
|
5
|
+
export type ChangeEmailOptions<TAuthClient extends AuthClient> = Omit<ReturnType<typeof changeEmailOptions<TAuthClient>>, "mutationKey" | "mutationFn" | "meta">;
|
|
5
6
|
/**
|
|
6
7
|
* Mutation options factory for changing the current user's email address.
|
|
7
8
|
*
|
|
8
9
|
* @param authClient - The Better Auth client.
|
|
9
10
|
*/
|
|
10
|
-
export declare function changeEmailOptions<TAuthClient extends AuthClient>(authClient: TAuthClient): import(
|
|
11
|
+
export declare function changeEmailOptions<TAuthClient extends AuthClient>(authClient: TAuthClient): import("@tanstack/react-query").WithRequired<import("@tanstack/react-query").UseMutationOptions<{
|
|
11
12
|
status: boolean;
|
|
12
13
|
}, BetterFetchError, ChangeEmailParams<TAuthClient>, unknown>, "mutationKey">;
|
|
13
14
|
/**
|
|
14
15
|
* Create a mutation for changing the current user's email address.
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* On success, `MutationInvalidator` awaits invalidation of the session
|
|
18
|
+
* query so the new email is reflected on the user object (see
|
|
19
|
+
* `meta.awaits`).
|
|
19
20
|
*
|
|
20
21
|
* @param authClient - The Better Auth client.
|
|
21
22
|
* @param options - React Query options forwarded to `useMutation`.
|
|
22
23
|
*/
|
|
23
|
-
export declare function useChangeEmail<TAuthClient extends AuthClient>(authClient: TAuthClient, options?: ChangeEmailOptions<TAuthClient
|
|
24
|
+
export declare function useChangeEmail<TAuthClient extends AuthClient>(authClient: TAuthClient, options?: ChangeEmailOptions<TAuthClient>, queryClient?: QueryClient): import("@tanstack/react-query").UseMutationResult<{
|
|
24
25
|
status: boolean;
|
|
25
26
|
}, BetterFetchError, ChangeEmailParams<TAuthClient>, unknown>;
|
|
@@ -1,29 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { authMutationKeys, authQueryKeys } from "@better-auth-ui/core";
|
|
2
|
+
import { mutationOptions, useMutation } from "@tanstack/react-query";
|
|
3
|
+
/**
|
|
4
|
+
* Mutation options factory for changing the current user's email address.
|
|
5
|
+
*
|
|
6
|
+
* @param authClient - The Better Auth client.
|
|
7
|
+
*/
|
|
8
|
+
export function changeEmailOptions(authClient) {
|
|
9
|
+
const mutationKey = authMutationKeys.changeEmail;
|
|
10
|
+
const mutationFn = (params) => authClient.changeEmail({
|
|
11
|
+
...params,
|
|
12
|
+
fetchOptions: { ...params?.fetchOptions, throw: true }
|
|
13
|
+
});
|
|
14
|
+
return mutationOptions({
|
|
15
|
+
mutationKey,
|
|
16
|
+
mutationFn
|
|
17
|
+
});
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Create a mutation for changing the current user's email address.
|
|
21
|
+
*
|
|
22
|
+
* On success, `MutationInvalidator` awaits invalidation of the session
|
|
23
|
+
* query so the new email is reflected on the user object (see
|
|
24
|
+
* `meta.awaits`).
|
|
25
|
+
*
|
|
26
|
+
* @param authClient - The Better Auth client.
|
|
27
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
28
|
+
*/
|
|
29
|
+
export function useChangeEmail(authClient, options, queryClient) {
|
|
30
|
+
return useMutation({
|
|
31
|
+
...changeEmailOptions(authClient),
|
|
32
|
+
...options,
|
|
33
|
+
meta: {
|
|
34
|
+
awaits: [authQueryKeys.session]
|
|
35
|
+
}
|
|
36
|
+
}, queryClient);
|
|
27
37
|
}
|
|
28
|
-
//#endregion
|
|
29
|
-
export { i as changeEmailOptions, a as useChangeEmail };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BetterFetchError } from
|
|
2
|
-
import { AuthClient } from
|
|
1
|
+
import type { BetterFetchError } from "better-auth/react";
|
|
2
|
+
import type { AuthClient } from "../../lib/auth-client";
|
|
3
3
|
export type ChangePasswordParams<TAuthClient extends AuthClient> = Parameters<TAuthClient["changePassword"]>[0];
|
|
4
4
|
export type ChangePasswordOptions<TAuthClient extends AuthClient> = Omit<ReturnType<typeof changePasswordOptions<TAuthClient>>, "mutationKey" | "mutationFn">;
|
|
5
5
|
/**
|
|
@@ -7,7 +7,7 @@ export type ChangePasswordOptions<TAuthClient extends AuthClient> = Omit<ReturnT
|
|
|
7
7
|
*
|
|
8
8
|
* @param authClient - The Better Auth client.
|
|
9
9
|
*/
|
|
10
|
-
export declare function changePasswordOptions<TAuthClient extends AuthClient>(authClient: TAuthClient): import(
|
|
10
|
+
export declare function changePasswordOptions<TAuthClient extends AuthClient>(authClient: TAuthClient): import("@tanstack/react-query").WithRequired<import("@tanstack/react-query").UseMutationOptions<Omit<{
|
|
11
11
|
token: string | null;
|
|
12
12
|
user: {
|
|
13
13
|
id: string;
|
|
@@ -27,7 +27,7 @@ export declare function changePasswordOptions<TAuthClient extends AuthClient>(au
|
|
|
27
27
|
image?: string | null | undefined;
|
|
28
28
|
};
|
|
29
29
|
}, "user"> & {
|
|
30
|
-
user: import(
|
|
30
|
+
user: import("better-auth").StripEmptyObjects<{
|
|
31
31
|
id: string;
|
|
32
32
|
createdAt: Date;
|
|
33
33
|
updatedAt: Date;
|
|
@@ -46,7 +46,7 @@ export declare function changePasswordOptions<TAuthClient extends AuthClient>(au
|
|
|
46
46
|
* @param authClient - The Better Auth client.
|
|
47
47
|
* @param options - React Query options forwarded to `useMutation`.
|
|
48
48
|
*/
|
|
49
|
-
export declare function useChangePassword<TAuthClient extends AuthClient>(authClient: TAuthClient, options?: ChangePasswordOptions<TAuthClient>): import(
|
|
49
|
+
export declare function useChangePassword<TAuthClient extends AuthClient>(authClient: TAuthClient, options?: ChangePasswordOptions<TAuthClient>): import("@tanstack/react-query").UseMutationResult<Omit<{
|
|
50
50
|
token: string | null;
|
|
51
51
|
user: {
|
|
52
52
|
id: string;
|
|
@@ -66,7 +66,7 @@ export declare function useChangePassword<TAuthClient extends AuthClient>(authCl
|
|
|
66
66
|
image?: string | null | undefined;
|
|
67
67
|
};
|
|
68
68
|
}, "user"> & {
|
|
69
|
-
user: import(
|
|
69
|
+
user: import("better-auth").StripEmptyObjects<{
|
|
70
70
|
id: string;
|
|
71
71
|
createdAt: Date;
|
|
72
72
|
updatedAt: Date;
|
|
@@ -1,24 +1,33 @@
|
|
|
1
|
-
import { authMutationKeys
|
|
2
|
-
import { mutationOptions
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { authMutationKeys } from "@better-auth-ui/core";
|
|
2
|
+
import { mutationOptions, useMutation } from "@tanstack/react-query";
|
|
3
|
+
/**
|
|
4
|
+
* Mutation options factory for changing the authenticated user's password.
|
|
5
|
+
*
|
|
6
|
+
* @param authClient - The Better Auth client.
|
|
7
|
+
*/
|
|
8
|
+
export function changePasswordOptions(authClient) {
|
|
9
|
+
const mutationKey = authMutationKeys.changePassword;
|
|
10
|
+
const mutationFn = (params) => authClient.changePassword({
|
|
11
|
+
...params,
|
|
12
|
+
fetchOptions: { ...params?.fetchOptions, throw: true }
|
|
13
|
+
});
|
|
14
|
+
return mutationOptions({
|
|
15
|
+
mutationKey,
|
|
16
|
+
mutationFn
|
|
17
|
+
});
|
|
16
18
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Create a mutation for changing the authenticated user's password.
|
|
21
|
+
*
|
|
22
|
+
* Wraps `authClient.changePassword` and forwards React Query mutation
|
|
23
|
+
* options such as `onSuccess`, `onError`, and `retry`.
|
|
24
|
+
*
|
|
25
|
+
* @param authClient - The Better Auth client.
|
|
26
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
27
|
+
*/
|
|
28
|
+
export function useChangePassword(authClient, options) {
|
|
29
|
+
return useMutation({
|
|
30
|
+
...changePasswordOptions(authClient),
|
|
31
|
+
...options
|
|
32
|
+
});
|
|
22
33
|
}
|
|
23
|
-
//#endregion
|
|
24
|
-
export { r as changePasswordOptions, i as useChangePassword };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BetterFetchError } from
|
|
2
|
-
import { AuthClient } from
|
|
1
|
+
import type { BetterFetchError } from "better-auth/react";
|
|
2
|
+
import type { AuthClient } from "../../lib/auth-client";
|
|
3
3
|
export type DeleteUserParams<TAuthClient extends AuthClient> = Parameters<TAuthClient["deleteUser"]>[0];
|
|
4
4
|
export type DeleteUserOptions<TAuthClient extends AuthClient> = Omit<ReturnType<typeof deleteUserOptions<TAuthClient>>, "mutationKey" | "mutationFn">;
|
|
5
5
|
/**
|
|
@@ -7,7 +7,7 @@ export type DeleteUserOptions<TAuthClient extends AuthClient> = Omit<ReturnType<
|
|
|
7
7
|
*
|
|
8
8
|
* @param authClient - The Better Auth client.
|
|
9
9
|
*/
|
|
10
|
-
export declare function deleteUserOptions<TAuthClient extends AuthClient>(authClient: TAuthClient): import(
|
|
10
|
+
export declare function deleteUserOptions<TAuthClient extends AuthClient>(authClient: TAuthClient): import("@tanstack/react-query").WithRequired<import("@tanstack/react-query").UseMutationOptions<{
|
|
11
11
|
success: boolean;
|
|
12
12
|
message: string;
|
|
13
13
|
}, BetterFetchError, DeleteUserParams<TAuthClient>, unknown>, "mutationKey">;
|
|
@@ -20,7 +20,7 @@ export declare function deleteUserOptions<TAuthClient extends AuthClient>(authCl
|
|
|
20
20
|
* @param authClient - The Better Auth client.
|
|
21
21
|
* @param options - React Query options forwarded to `useMutation`.
|
|
22
22
|
*/
|
|
23
|
-
export declare function useDeleteUser<TAuthClient extends AuthClient>(authClient: TAuthClient, options?: DeleteUserOptions<TAuthClient>): import(
|
|
23
|
+
export declare function useDeleteUser<TAuthClient extends AuthClient>(authClient: TAuthClient, options?: DeleteUserOptions<TAuthClient>): import("@tanstack/react-query").UseMutationResult<{
|
|
24
24
|
success: boolean;
|
|
25
25
|
message: string;
|
|
26
26
|
}, BetterFetchError, DeleteUserParams<TAuthClient>, unknown>;
|
|
@@ -1,24 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { mutationOptions
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { deleteUserMutationKeys } from "@better-auth-ui/core/plugins";
|
|
2
|
+
import { mutationOptions, useMutation } from "@tanstack/react-query";
|
|
3
|
+
/**
|
|
4
|
+
* Mutation options factory for deleting the authenticated user's account.
|
|
5
|
+
*
|
|
6
|
+
* @param authClient - The Better Auth client.
|
|
7
|
+
*/
|
|
8
|
+
export function deleteUserOptions(authClient) {
|
|
9
|
+
const mutationKey = deleteUserMutationKeys.deleteUser;
|
|
10
|
+
const mutationFn = (params) => authClient.deleteUser({
|
|
11
|
+
...params,
|
|
12
|
+
fetchOptions: { ...params?.fetchOptions, throw: true }
|
|
13
|
+
});
|
|
14
|
+
return mutationOptions({
|
|
15
|
+
mutationKey,
|
|
16
|
+
mutationFn
|
|
17
|
+
});
|
|
16
18
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Create a mutation for deleting the authenticated user's account.
|
|
21
|
+
*
|
|
22
|
+
* Wraps `authClient.deleteUser` and forwards React Query mutation options
|
|
23
|
+
* such as `onSuccess`, `onError`, and `retry`.
|
|
24
|
+
*
|
|
25
|
+
* @param authClient - The Better Auth client.
|
|
26
|
+
* @param options - React Query options forwarded to `useMutation`.
|
|
27
|
+
*/
|
|
28
|
+
export function useDeleteUser(authClient, options) {
|
|
29
|
+
return useMutation({
|
|
30
|
+
...deleteUserOptions(authClient),
|
|
31
|
+
...options
|
|
32
|
+
});
|
|
22
33
|
}
|
|
23
|
-
//#endregion
|
|
24
|
-
export { r as deleteUserOptions, i as useDeleteUser };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BetterFetchError } from
|
|
2
|
-
import { AuthClient } from
|
|
1
|
+
import type { BetterFetchError } from "better-auth/react";
|
|
2
|
+
import type { AuthClient } from "../../lib/auth-client";
|
|
3
3
|
export type LinkSocialParams<TAuthClient extends AuthClient> = Parameters<TAuthClient["linkSocial"]>[0];
|
|
4
4
|
export type LinkSocialOptions<TAuthClient extends AuthClient> = Omit<ReturnType<typeof linkSocialOptions<TAuthClient>>, "mutationKey" | "mutationFn">;
|
|
5
5
|
/**
|
|
@@ -7,7 +7,7 @@ export type LinkSocialOptions<TAuthClient extends AuthClient> = Omit<ReturnType<
|
|
|
7
7
|
*
|
|
8
8
|
* @param authClient - The Better Auth client.
|
|
9
9
|
*/
|
|
10
|
-
export declare function linkSocialOptions<TAuthClient extends AuthClient>(authClient: TAuthClient): import(
|
|
10
|
+
export declare function linkSocialOptions<TAuthClient extends AuthClient>(authClient: TAuthClient): import("@tanstack/react-query").WithRequired<import("@tanstack/react-query").UseMutationOptions<{
|
|
11
11
|
url: string;
|
|
12
12
|
redirect: boolean;
|
|
13
13
|
}, BetterFetchError, LinkSocialParams<TAuthClient>, unknown>, "mutationKey">;
|
|
@@ -20,7 +20,7 @@ export declare function linkSocialOptions<TAuthClient extends AuthClient>(authCl
|
|
|
20
20
|
* @param authClient - The Better Auth client.
|
|
21
21
|
* @param options - React Query options forwarded to `useMutation`.
|
|
22
22
|
*/
|
|
23
|
-
export declare function useLinkSocial<TAuthClient extends AuthClient>(authClient: TAuthClient, options?: LinkSocialOptions<TAuthClient>): import(
|
|
23
|
+
export declare function useLinkSocial<TAuthClient extends AuthClient>(authClient: TAuthClient, options?: LinkSocialOptions<TAuthClient>): import("@tanstack/react-query").UseMutationResult<{
|
|
24
24
|
url: string;
|
|
25
25
|
redirect: boolean;
|
|
26
26
|
}, BetterFetchError, LinkSocialParams<TAuthClient>, unknown>;
|