@better-auth-ui/react 1.6.3 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/auth/auth-provider.d.ts +23 -8
- package/dist/components/auth/auth-provider.js +32 -17
- package/dist/components/{email → auth/email}/email-changed.js +2 -2
- package/dist/components/{email → auth/email}/email-localization.js +1 -1
- package/dist/components/{email → auth/email}/email-styles.js +1 -1
- package/dist/components/{email → auth/email}/email-verification.js +2 -2
- package/dist/components/{email → auth/email}/magic-link.js +2 -2
- package/dist/components/{email → auth/email}/new-device.js +2 -2
- package/dist/components/{email → auth/email}/otp-email.js +2 -2
- package/dist/components/{email → auth/email}/password-changed.js +2 -2
- package/dist/components/{email → auth/email}/reset-password.js +2 -2
- package/dist/email.d.ts +1 -0
- package/dist/email.js +11 -0
- package/dist/hooks/auth/use-authenticate.d.ts +5 -28
- package/dist/hooks/auth/use-authenticate.js +12 -12
- package/dist/hooks/auth/use-user.d.ts +19 -314
- package/dist/hooks/auth/use-user.js +5 -5
- package/dist/hooks/use-auth-mutation.d.ts +12 -7
- package/dist/hooks/use-auth-plugin.d.ts +31 -0
- package/dist/hooks/use-auth-plugin.js +10 -0
- package/dist/hooks/use-auth-query.d.ts +3 -3
- package/dist/index.d.ts +33 -32
- package/dist/index.js +74 -83
- package/dist/lib/auth-client.d.ts +23 -3687
- package/dist/lib/auth-plugin.d.ts +59 -0
- package/dist/lib/auth-server.d.ts +16 -0
- package/dist/mutations/auth/request-password-reset-mutation.d.ts +26 -0
- package/dist/mutations/auth/request-password-reset-mutation.js +24 -0
- package/dist/mutations/auth/reset-password-mutation.d.ts +25 -0
- package/dist/mutations/auth/reset-password-mutation.js +24 -0
- package/dist/mutations/auth/send-verification-email-mutation.d.ts +24 -0
- package/dist/mutations/auth/send-verification-email-mutation.js +24 -0
- package/dist/mutations/auth/sign-in-email-mutation.d.ts +71 -0
- package/dist/mutations/auth/sign-in-email-mutation.js +29 -0
- package/dist/mutations/auth/sign-in-social-mutation.d.ts +77 -0
- package/dist/mutations/auth/sign-in-social-mutation.js +24 -0
- package/dist/mutations/auth/sign-out-mutation.d.ts +25 -0
- package/dist/mutations/auth/sign-out-mutation.js +28 -0
- package/dist/mutations/auth/sign-up-email-mutation.d.ts +105 -0
- package/dist/mutations/auth/sign-up-email-mutation.js +29 -0
- package/dist/mutations/auth-mutation-options.d.ts +37 -20
- package/dist/mutations/auth-mutation-options.js +2 -2
- package/dist/mutations/magic-link/sign-in-magic-link-mutation.d.ts +24 -0
- package/dist/mutations/magic-link/sign-in-magic-link-mutation.js +24 -0
- package/dist/mutations/multi-session/revoke-multi-session-mutation.d.ts +25 -0
- package/dist/mutations/multi-session/revoke-multi-session-mutation.js +29 -0
- package/dist/mutations/multi-session/set-active-session-mutation.d.ts +62 -0
- package/dist/mutations/multi-session/set-active-session-mutation.js +31 -0
- package/dist/mutations/passkey/add-passkey-mutation.d.ts +71 -0
- package/dist/mutations/passkey/add-passkey-mutation.js +29 -0
- package/dist/mutations/passkey/delete-passkey-mutation.d.ts +25 -0
- package/dist/mutations/passkey/delete-passkey-mutation.js +29 -0
- package/dist/mutations/passkey/sign-in-passkey-mutation.d.ts +105 -0
- package/dist/mutations/passkey/sign-in-passkey-mutation.js +29 -0
- package/dist/mutations/settings/change-email-mutation.d.ts +25 -0
- package/dist/mutations/settings/change-email-mutation.js +29 -0
- package/dist/mutations/settings/change-password-mutation.d.ts +78 -0
- package/dist/mutations/settings/change-password-mutation.js +24 -0
- package/dist/mutations/settings/delete-user-mutation.d.ts +26 -0
- package/dist/mutations/settings/delete-user-mutation.js +24 -0
- package/dist/mutations/settings/link-social-mutation.d.ts +26 -0
- package/dist/mutations/settings/link-social-mutation.js +24 -0
- package/dist/mutations/settings/revoke-session-mutation.d.ts +25 -0
- package/dist/mutations/settings/revoke-session-mutation.js +29 -0
- package/dist/mutations/settings/unlink-account-mutation.d.ts +25 -0
- package/dist/mutations/settings/unlink-account-mutation.js +29 -0
- package/dist/mutations/settings/update-user-mutation.d.ts +25 -0
- package/dist/mutations/settings/update-user-mutation.js +35 -0
- package/dist/mutations/username/is-username-available-mutation.d.ts +27 -0
- package/dist/mutations/username/is-username-available-mutation.js +24 -0
- package/dist/mutations/username/sign-in-username-mutation.d.ts +75 -0
- package/dist/mutations/username/sign-in-username-mutation.js +29 -0
- package/dist/queries/auth/session-query.d.ts +71 -0
- package/dist/queries/auth/session-query.js +30 -0
- package/dist/queries/auth-query-options.d.ts +26 -15
- package/dist/queries/multi-session/list-device-sessions-query.d.ts +76 -0
- package/dist/queries/multi-session/list-device-sessions-query.js +31 -0
- package/dist/queries/passkey/list-passkeys-query.d.ts +74 -0
- package/dist/queries/passkey/list-passkeys-query.js +31 -0
- package/dist/queries/settings/account-info-query.d.ts +85 -0
- package/dist/queries/settings/account-info-query.js +31 -0
- package/dist/queries/settings/list-accounts-query.d.ts +76 -0
- package/dist/queries/settings/list-accounts-query.js +31 -0
- package/dist/queries/settings/list-sessions-query.d.ts +74 -0
- package/dist/queries/settings/list-sessions-query.js +31 -0
- package/dist/server/queries/auth/session-query.d.ts +57 -0
- package/dist/server/queries/auth/session-query.js +13 -0
- package/dist/server/queries/multi-session/list-device-sessions-query.d.ts +60 -0
- package/dist/server/queries/multi-session/list-device-sessions-query.js +12 -0
- package/dist/server/queries/passkey/list-passkeys-query.d.ts +60 -0
- package/dist/server/queries/passkey/list-passkeys-query.js +12 -0
- package/dist/server/queries/settings/account-info-query.d.ts +68 -0
- package/dist/server/queries/settings/account-info-query.js +12 -0
- package/dist/server/queries/settings/list-accounts-query.d.ts +60 -0
- package/dist/server/queries/settings/list-accounts-query.js +12 -0
- package/dist/server/queries/settings/list-sessions-query.d.ts +60 -0
- package/dist/server/queries/settings/list-sessions-query.js +12 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.js +7 -0
- package/package.json +24 -22
- package/src/components/auth/auth-provider.tsx +87 -24
- package/src/components/{email → auth/email}/email-changed.tsx +1 -1
- package/src/components/{email → auth/email}/email-verification.tsx +1 -1
- package/src/components/{email → auth/email}/magic-link.tsx +1 -1
- package/src/components/{email → auth/email}/new-device.tsx +1 -1
- package/src/components/{email → auth/email}/otp-email.tsx +1 -1
- package/src/components/{email → auth/email}/password-changed.tsx +1 -1
- package/src/components/{email → auth/email}/reset-password.tsx +1 -1
- package/src/email.ts +1 -0
- package/src/hooks/auth/use-authenticate.ts +12 -6
- package/src/hooks/auth/use-user.ts +14 -9
- package/src/hooks/use-auth-mutation.ts +30 -12
- package/src/hooks/use-auth-plugin.ts +50 -0
- package/src/hooks/use-auth-query.ts +11 -7
- package/src/index.ts +33 -32
- package/src/lib/auth-client.ts +33 -31
- package/src/lib/auth-plugin.ts +75 -0
- package/src/lib/auth-server.ts +30 -0
- package/src/mutations/auth/request-password-reset-mutation.ts +58 -0
- package/src/mutations/auth/reset-password-mutation.ts +60 -0
- package/src/mutations/auth/send-verification-email-mutation.ts +58 -0
- package/src/mutations/auth/sign-in-email-mutation.ts +78 -0
- package/src/mutations/auth/sign-in-social-mutation.ts +64 -0
- package/src/mutations/auth/sign-out-mutation.ts +71 -0
- package/src/mutations/auth/sign-up-email-mutation.ts +74 -0
- package/src/mutations/auth-mutation-options.ts +83 -38
- package/src/mutations/magic-link/sign-in-magic-link-mutation.ts +59 -0
- package/src/mutations/multi-session/revoke-multi-session-mutation.ts +70 -0
- package/src/mutations/multi-session/set-active-session-mutation.ts +98 -0
- package/src/mutations/passkey/add-passkey-mutation.ts +66 -0
- package/src/mutations/passkey/delete-passkey-mutation.ts +66 -0
- package/src/mutations/passkey/sign-in-passkey-mutation.ts +74 -0
- package/src/mutations/settings/change-email-mutation.ts +67 -0
- package/src/mutations/settings/change-password-mutation.ts +59 -0
- package/src/mutations/settings/delete-user-mutation.ts +59 -0
- package/src/mutations/settings/link-social-mutation.ts +59 -0
- package/src/mutations/settings/revoke-session-mutation.ts +69 -0
- package/src/mutations/settings/unlink-account-mutation.ts +67 -0
- package/src/mutations/settings/update-user-mutation.ts +82 -0
- package/src/mutations/username/is-username-available-mutation.ts +62 -0
- package/src/mutations/username/sign-in-username-mutation.ts +74 -0
- package/src/queries/auth/session-query.ts +135 -0
- package/src/queries/auth-query-options.ts +61 -12
- package/src/queries/multi-session/list-device-sessions-query.ts +177 -0
- package/src/queries/passkey/list-passkeys-query.ts +154 -0
- package/src/queries/settings/account-info-query.ts +158 -0
- package/src/queries/settings/list-accounts-query.ts +156 -0
- package/src/queries/settings/list-sessions-query.ts +154 -0
- package/src/server/queries/auth/session-query.ts +94 -0
- package/src/server/queries/multi-session/list-device-sessions-query.ts +102 -0
- package/src/server/queries/passkey/list-passkeys-query.ts +100 -0
- package/src/server/queries/settings/account-info-query.ts +101 -0
- package/src/server/queries/settings/list-accounts-query.ts +101 -0
- package/src/server/queries/settings/list-sessions-query.ts +101 -0
- package/src/server.ts +7 -0
- package/dist/core.d.ts +0 -1
- package/dist/core.js +0 -1
- package/dist/hooks/auth/use-is-username-available.d.ts +0 -20
- package/dist/hooks/auth/use-is-username-available.js +0 -13
- package/dist/hooks/auth/use-request-password-reset.d.ts +0 -21
- package/dist/hooks/auth/use-request-password-reset.js +0 -13
- package/dist/hooks/auth/use-reset-password.d.ts +0 -23
- package/dist/hooks/auth/use-reset-password.js +0 -13
- package/dist/hooks/auth/use-send-verification-email.d.ts +0 -19
- package/dist/hooks/auth/use-send-verification-email.js +0 -13
- package/dist/hooks/auth/use-session.d.ts +0 -35
- package/dist/hooks/auth/use-session.js +0 -16
- package/dist/hooks/auth/use-sign-in-email.d.ts +0 -26
- package/dist/hooks/auth/use-sign-in-email.js +0 -17
- package/dist/hooks/auth/use-sign-in-magic-link.d.ts +0 -27
- package/dist/hooks/auth/use-sign-in-magic-link.js +0 -13
- package/dist/hooks/auth/use-sign-in-passkey.d.ts +0 -21
- package/dist/hooks/auth/use-sign-in-passkey.js +0 -17
- package/dist/hooks/auth/use-sign-in-social.d.ts +0 -63
- package/dist/hooks/auth/use-sign-in-social.js +0 -13
- package/dist/hooks/auth/use-sign-in-username.d.ts +0 -25
- package/dist/hooks/auth/use-sign-in-username.js +0 -17
- package/dist/hooks/auth/use-sign-out.d.ts +0 -18
- package/dist/hooks/auth/use-sign-out.js +0 -16
- package/dist/hooks/auth/use-sign-up-email.d.ts +0 -1186
- package/dist/hooks/auth/use-sign-up-email.js +0 -17
- package/dist/hooks/settings/use-account-info.d.ts +0 -17
- package/dist/hooks/settings/use-account-info.js +0 -18
- package/dist/hooks/settings/use-add-passkey.d.ts +0 -21
- package/dist/hooks/settings/use-add-passkey.js +0 -17
- package/dist/hooks/settings/use-change-email.d.ts +0 -21
- package/dist/hooks/settings/use-change-email.js +0 -17
- package/dist/hooks/settings/use-change-password.d.ts +0 -21
- package/dist/hooks/settings/use-change-password.js +0 -13
- package/dist/hooks/settings/use-delete-passkey.d.ts +0 -19
- package/dist/hooks/settings/use-delete-passkey.js +0 -17
- package/dist/hooks/settings/use-delete-user.d.ts +0 -24
- package/dist/hooks/settings/use-delete-user.js +0 -13
- package/dist/hooks/settings/use-link-social.d.ts +0 -43
- package/dist/hooks/settings/use-link-social.js +0 -13
- package/dist/hooks/settings/use-list-accounts.d.ts +0 -22
- package/dist/hooks/settings/use-list-accounts.js +0 -15
- package/dist/hooks/settings/use-list-device-sessions.d.ts +0 -34
- package/dist/hooks/settings/use-list-device-sessions.js +0 -15
- package/dist/hooks/settings/use-list-sessions.d.ts +0 -23
- package/dist/hooks/settings/use-list-sessions.js +0 -15
- package/dist/hooks/settings/use-list-user-passkeys.d.ts +0 -14
- package/dist/hooks/settings/use-list-user-passkeys.js +0 -15
- package/dist/hooks/settings/use-revoke-multi-session.d.ts +0 -19
- package/dist/hooks/settings/use-revoke-multi-session.js +0 -17
- package/dist/hooks/settings/use-revoke-session.d.ts +0 -19
- package/dist/hooks/settings/use-revoke-session.js +0 -17
- package/dist/hooks/settings/use-set-active-session.d.ts +0 -20
- package/dist/hooks/settings/use-set-active-session.js +0 -20
- package/dist/hooks/settings/use-unlink-account.d.ts +0 -21
- package/dist/hooks/settings/use-unlink-account.js +0 -17
- package/dist/hooks/settings/use-update-user.d.ts +0 -1185
- package/dist/hooks/settings/use-update-user.js +0 -24
- package/dist/lib/auth-client.js +0 -11
- package/dist/lib/auth-config.d.ts +0 -43
- package/dist/lib/auth-context.d.ts +0 -2
- package/dist/lib/auth-context.js +0 -6
- package/dist/mutations/auth/is-username-available-options.d.ts +0 -19
- package/dist/mutations/auth/is-username-available-options.js +0 -7
- package/dist/mutations/auth/request-password-reset-options.d.ts +0 -15
- package/dist/mutations/auth/request-password-reset-options.js +0 -7
- package/dist/mutations/auth/reset-password-options.d.ts +0 -17
- package/dist/mutations/auth/reset-password-options.js +0 -7
- package/dist/mutations/auth/send-verification-email-options.d.ts +0 -15
- package/dist/mutations/auth/send-verification-email-options.js +0 -7
- package/dist/mutations/auth/sign-in-email-options.d.ts +0 -23
- package/dist/mutations/auth/sign-in-email-options.js +0 -11
- package/dist/mutations/auth/sign-in-magic-link-options.d.ts +0 -23
- package/dist/mutations/auth/sign-in-magic-link-options.js +0 -11
- package/dist/mutations/auth/sign-in-passkey-options.d.ts +0 -15
- package/dist/mutations/auth/sign-in-passkey-options.js +0 -11
- package/dist/mutations/auth/sign-in-social-options.d.ts +0 -61
- package/dist/mutations/auth/sign-in-social-options.js +0 -11
- package/dist/mutations/auth/sign-in-username-options.d.ts +0 -19
- package/dist/mutations/auth/sign-in-username-options.js +0 -11
- package/dist/mutations/auth/sign-out-options.d.ts +0 -12
- package/dist/mutations/auth/sign-out-options.js +0 -7
- package/dist/mutations/auth/sign-up-email-options.d.ts +0 -1180
- package/dist/mutations/auth/sign-up-email-options.js +0 -11
- package/dist/mutations/settings/add-passkey-options.d.ts +0 -15
- package/dist/mutations/settings/add-passkey-options.js +0 -11
- package/dist/mutations/settings/change-email-options.d.ts +0 -15
- package/dist/mutations/settings/change-email-options.js +0 -7
- package/dist/mutations/settings/change-password-options.d.ts +0 -17
- package/dist/mutations/settings/change-password-options.js +0 -7
- package/dist/mutations/settings/delete-passkey-options.d.ts +0 -13
- package/dist/mutations/settings/delete-passkey-options.js +0 -11
- package/dist/mutations/settings/delete-user-options.d.ts +0 -20
- package/dist/mutations/settings/delete-user-options.js +0 -7
- package/dist/mutations/settings/link-social-options.d.ts +0 -39
- package/dist/mutations/settings/link-social-options.js +0 -7
- package/dist/mutations/settings/revoke-multi-session-options.d.ts +0 -13
- package/dist/mutations/settings/revoke-multi-session-options.js +0 -11
- package/dist/mutations/settings/revoke-session-options.d.ts +0 -13
- package/dist/mutations/settings/revoke-session-options.js +0 -7
- package/dist/mutations/settings/set-active-session-options.d.ts +0 -13
- package/dist/mutations/settings/set-active-session-options.js +0 -11
- package/dist/mutations/settings/unlink-account-options.d.ts +0 -15
- package/dist/mutations/settings/unlink-account-options.js +0 -7
- package/dist/mutations/settings/update-user-options.d.ts +0 -1182
- package/dist/mutations/settings/update-user-options.js +0 -7
- package/dist/queries/auth/session-options.d.ts +0 -110
- package/dist/queries/auth/session-options.js +0 -7
- package/dist/queries/settings/account-info-options.d.ts +0 -32
- package/dist/queries/settings/account-info-options.js +0 -12
- package/dist/queries/settings/list-accounts-options.d.ts +0 -53
- package/dist/queries/settings/list-accounts-options.js +0 -12
- package/dist/queries/settings/list-device-sessions-options.d.ts +0 -99
- package/dist/queries/settings/list-device-sessions-options.js +0 -12
- package/dist/queries/settings/list-sessions-options.d.ts +0 -54
- package/dist/queries/settings/list-sessions-options.js +0 -12
- package/dist/queries/settings/list-user-passkeys-options.d.ts +0 -18
- package/dist/queries/settings/list-user-passkeys-options.js +0 -12
- package/src/core.ts +0 -1
- package/src/hooks/auth/use-is-username-available.ts +0 -31
- package/src/hooks/auth/use-request-password-reset.ts +0 -33
- package/src/hooks/auth/use-reset-password.ts +0 -31
- package/src/hooks/auth/use-send-verification-email.ts +0 -31
- package/src/hooks/auth/use-session.ts +0 -31
- package/src/hooks/auth/use-sign-in-email.ts +0 -41
- package/src/hooks/auth/use-sign-in-magic-link.ts +0 -29
- package/src/hooks/auth/use-sign-in-passkey.ts +0 -40
- package/src/hooks/auth/use-sign-in-social.ts +0 -31
- package/src/hooks/auth/use-sign-in-username.ts +0 -40
- package/src/hooks/auth/use-sign-out.ts +0 -34
- package/src/hooks/auth/use-sign-up-email.ts +0 -40
- package/src/hooks/settings/use-account-info.ts +0 -40
- package/src/hooks/settings/use-add-passkey.ts +0 -37
- package/src/hooks/settings/use-change-email.ts +0 -37
- package/src/hooks/settings/use-change-password.ts +0 -29
- package/src/hooks/settings/use-delete-passkey.ts +0 -37
- package/src/hooks/settings/use-delete-user.ts +0 -29
- package/src/hooks/settings/use-link-social.ts +0 -29
- package/src/hooks/settings/use-list-accounts.ts +0 -39
- package/src/hooks/settings/use-list-device-sessions.ts +0 -39
- package/src/hooks/settings/use-list-sessions.ts +0 -39
- package/src/hooks/settings/use-list-user-passkeys.ts +0 -39
- package/src/hooks/settings/use-revoke-multi-session.ts +0 -39
- package/src/hooks/settings/use-revoke-session.ts +0 -39
- package/src/hooks/settings/use-set-active-session.ts +0 -58
- package/src/hooks/settings/use-unlink-account.ts +0 -37
- package/src/hooks/settings/use-update-user.ts +0 -50
- package/src/lib/auth-config.ts +0 -48
- package/src/lib/auth-context.ts +0 -6
- package/src/mutations/auth/is-username-available-options.ts +0 -18
- package/src/mutations/auth/request-password-reset-options.ts +0 -14
- package/src/mutations/auth/reset-password-options.ts +0 -14
- package/src/mutations/auth/send-verification-email-options.ts +0 -14
- package/src/mutations/auth/sign-in-email-options.ts +0 -19
- package/src/mutations/auth/sign-in-magic-link-options.ts +0 -15
- package/src/mutations/auth/sign-in-passkey-options.ts +0 -15
- package/src/mutations/auth/sign-in-social-options.ts +0 -19
- package/src/mutations/auth/sign-in-username-options.ts +0 -15
- package/src/mutations/auth/sign-out-options.ts +0 -11
- package/src/mutations/auth/sign-up-email-options.ts +0 -15
- package/src/mutations/settings/add-passkey-options.ts +0 -15
- package/src/mutations/settings/change-email-options.ts +0 -11
- package/src/mutations/settings/change-password-options.ts +0 -14
- package/src/mutations/settings/delete-passkey-options.ts +0 -15
- package/src/mutations/settings/delete-user-options.ts +0 -11
- package/src/mutations/settings/link-social-options.ts +0 -11
- package/src/mutations/settings/revoke-multi-session-options.ts +0 -15
- package/src/mutations/settings/revoke-session-options.ts +0 -14
- package/src/mutations/settings/set-active-session-options.ts +0 -15
- package/src/mutations/settings/unlink-account-options.ts +0 -14
- package/src/mutations/settings/update-user-options.ts +0 -15
- package/src/queries/auth/session-options.ts +0 -18
- package/src/queries/settings/account-info-options.ts +0 -25
- package/src/queries/settings/list-accounts-options.ts +0 -26
- package/src/queries/settings/list-device-sessions-options.ts +0 -24
- package/src/queries/settings/list-sessions-options.ts +0 -23
- package/src/queries/settings/list-user-passkeys-options.ts +0 -23
- /package/dist/components/{email → auth/email}/email-changed.d.ts +0 -0
- /package/dist/components/{email → auth/email}/email-localization.d.ts +0 -0
- /package/dist/components/{email → auth/email}/email-styles.d.ts +0 -0
- /package/dist/components/{email → auth/email}/email-verification.d.ts +0 -0
- /package/dist/components/{email → auth/email}/index.d.ts +0 -0
- /package/dist/components/{email → auth/email}/index.js +0 -0
- /package/dist/components/{email → auth/email}/magic-link.d.ts +0 -0
- /package/dist/components/{email → auth/email}/new-device.d.ts +0 -0
- /package/dist/components/{email → auth/email}/otp-email.d.ts +0 -0
- /package/dist/components/{email → auth/email}/password-changed.d.ts +0 -0
- /package/dist/components/{email → auth/email}/reset-password.d.ts +0 -0
- /package/src/components/{email → auth/email}/email-localization.tsx +0 -0
- /package/src/components/{email → auth/email}/email-styles.tsx +0 -0
- /package/src/components/{email → auth/email}/index.ts +0 -0
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
/**
|
|
3
|
-
* Query options factory for the current session.
|
|
4
|
-
*
|
|
5
|
-
* Access `.queryKey` on the returned options for cache seeding or
|
|
6
|
-
* invalidation: `queryClient.setQueryData(sessionOptions(authClient).queryKey, session)`.
|
|
7
|
-
*
|
|
8
|
-
* @param authClient - The Better Auth client.
|
|
9
|
-
* @param params - Parameters forwarded to `authClient.getSession`.
|
|
10
|
-
*/
|
|
11
|
-
export declare function sessionOptions(authClient: AuthClient, params?: Parameters<AuthClient["getSession"]>[0]): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<{
|
|
12
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
13
|
-
id: string;
|
|
14
|
-
createdAt: Date;
|
|
15
|
-
updatedAt: Date;
|
|
16
|
-
email: string;
|
|
17
|
-
emailVerified: boolean;
|
|
18
|
-
name: string;
|
|
19
|
-
image?: string | null | undefined;
|
|
20
|
-
} & {} & {
|
|
21
|
-
username?: string | null | undefined;
|
|
22
|
-
displayUsername?: string | null | undefined;
|
|
23
|
-
}>;
|
|
24
|
-
session: import('better-auth').StripEmptyObjects<{
|
|
25
|
-
id: string;
|
|
26
|
-
createdAt: Date;
|
|
27
|
-
updatedAt: Date;
|
|
28
|
-
userId: string;
|
|
29
|
-
expiresAt: Date;
|
|
30
|
-
token: string;
|
|
31
|
-
ipAddress?: string | null | undefined;
|
|
32
|
-
userAgent?: string | null | undefined;
|
|
33
|
-
}>;
|
|
34
|
-
} | null, import('better-auth/client').BetterFetchError, {
|
|
35
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
36
|
-
id: string;
|
|
37
|
-
createdAt: Date;
|
|
38
|
-
updatedAt: Date;
|
|
39
|
-
email: string;
|
|
40
|
-
emailVerified: boolean;
|
|
41
|
-
name: string;
|
|
42
|
-
image?: string | null | undefined;
|
|
43
|
-
} & {} & {
|
|
44
|
-
username?: string | null | undefined;
|
|
45
|
-
displayUsername?: string | null | undefined;
|
|
46
|
-
}>;
|
|
47
|
-
session: import('better-auth').StripEmptyObjects<{
|
|
48
|
-
id: string;
|
|
49
|
-
createdAt: Date;
|
|
50
|
-
updatedAt: Date;
|
|
51
|
-
userId: string;
|
|
52
|
-
expiresAt: Date;
|
|
53
|
-
token: string;
|
|
54
|
-
ipAddress?: string | null | undefined;
|
|
55
|
-
userAgent?: string | null | undefined;
|
|
56
|
-
}>;
|
|
57
|
-
} | null, readonly unknown[]>, "queryFn"> & {
|
|
58
|
-
queryFn?: import('@tanstack/react-query').QueryFunction<{
|
|
59
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
60
|
-
id: string;
|
|
61
|
-
createdAt: Date;
|
|
62
|
-
updatedAt: Date;
|
|
63
|
-
email: string;
|
|
64
|
-
emailVerified: boolean;
|
|
65
|
-
name: string;
|
|
66
|
-
image?: string | null | undefined;
|
|
67
|
-
} & {} & {
|
|
68
|
-
username?: string | null | undefined;
|
|
69
|
-
displayUsername?: string | null | undefined;
|
|
70
|
-
}>;
|
|
71
|
-
session: import('better-auth').StripEmptyObjects<{
|
|
72
|
-
id: string;
|
|
73
|
-
createdAt: Date;
|
|
74
|
-
updatedAt: Date;
|
|
75
|
-
userId: string;
|
|
76
|
-
expiresAt: Date;
|
|
77
|
-
token: string;
|
|
78
|
-
ipAddress?: string | null | undefined;
|
|
79
|
-
userAgent?: string | null | undefined;
|
|
80
|
-
}>;
|
|
81
|
-
} | null, readonly unknown[], never> | undefined;
|
|
82
|
-
} & {
|
|
83
|
-
queryKey: readonly unknown[] & {
|
|
84
|
-
[dataTagSymbol]: {
|
|
85
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
86
|
-
id: string;
|
|
87
|
-
createdAt: Date;
|
|
88
|
-
updatedAt: Date;
|
|
89
|
-
email: string;
|
|
90
|
-
emailVerified: boolean;
|
|
91
|
-
name: string;
|
|
92
|
-
image?: string | null | undefined;
|
|
93
|
-
} & {} & {
|
|
94
|
-
username?: string | null | undefined;
|
|
95
|
-
displayUsername?: string | null | undefined;
|
|
96
|
-
}>;
|
|
97
|
-
session: import('better-auth').StripEmptyObjects<{
|
|
98
|
-
id: string;
|
|
99
|
-
createdAt: Date;
|
|
100
|
-
updatedAt: Date;
|
|
101
|
-
userId: string;
|
|
102
|
-
expiresAt: Date;
|
|
103
|
-
token: string;
|
|
104
|
-
ipAddress?: string | null | undefined;
|
|
105
|
-
userAgent?: string | null | undefined;
|
|
106
|
-
}>;
|
|
107
|
-
} | null;
|
|
108
|
-
[dataTagErrorSymbol]: import('better-auth/client').BetterFetchError;
|
|
109
|
-
};
|
|
110
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
/**
|
|
3
|
-
* Query options factory for provider-specific account info.
|
|
4
|
-
*
|
|
5
|
-
* Keyed per-user. `userId` and `params` are both optional so the factory can
|
|
6
|
-
* build stable options before either is known — the consumer swaps `queryFn`
|
|
7
|
-
* for `skipToken` until ready.
|
|
8
|
-
*
|
|
9
|
-
* @param authClient - The Better Auth client.
|
|
10
|
-
* @param userId - The current signed in user's ID.
|
|
11
|
-
* @param params - Parameters forwarded to `authClient.accountInfo`.
|
|
12
|
-
*/
|
|
13
|
-
export declare function accountInfoOptions(authClient: AuthClient, userId?: string, params?: Parameters<AuthClient["accountInfo"]>[0]): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<{
|
|
14
|
-
user: import('better-auth').OAuth2UserInfo;
|
|
15
|
-
data: Record<string, any>;
|
|
16
|
-
} | null, import('better-auth/client').BetterFetchError, {
|
|
17
|
-
user: import('better-auth').OAuth2UserInfo;
|
|
18
|
-
data: Record<string, any>;
|
|
19
|
-
} | null, readonly unknown[]>, "queryFn"> & {
|
|
20
|
-
queryFn?: import('@tanstack/react-query').QueryFunction<{
|
|
21
|
-
user: import('better-auth').OAuth2UserInfo;
|
|
22
|
-
data: Record<string, any>;
|
|
23
|
-
} | null, readonly unknown[], never> | undefined;
|
|
24
|
-
} & {
|
|
25
|
-
queryKey: readonly unknown[] & {
|
|
26
|
-
[dataTagSymbol]: {
|
|
27
|
-
user: import('better-auth').OAuth2UserInfo;
|
|
28
|
-
data: Record<string, any>;
|
|
29
|
-
} | null;
|
|
30
|
-
[dataTagErrorSymbol]: import('better-auth/client').BetterFetchError;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { authQueryOptions as e } from "../auth-query-options.js";
|
|
2
|
-
//#region src/queries/settings/account-info-options.ts
|
|
3
|
-
function t(t, n, r) {
|
|
4
|
-
return e(t.accountInfo, [
|
|
5
|
-
"auth",
|
|
6
|
-
"user",
|
|
7
|
-
n,
|
|
8
|
-
"accountInfo"
|
|
9
|
-
], r);
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { t as accountInfoOptions };
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
/**
|
|
3
|
-
* Query options factory for a user's linked social accounts.
|
|
4
|
-
*
|
|
5
|
-
* Keyed per-user (enables offline account switching with a persister).
|
|
6
|
-
* `userId` is optional so the factory can build stable options before the
|
|
7
|
-
* active session resolves — the consumer swaps `queryFn` for `skipToken`
|
|
8
|
-
* until ready.
|
|
9
|
-
*
|
|
10
|
-
* @param authClient - The Better Auth client.
|
|
11
|
-
* @param userId - The current signed in user's ID.
|
|
12
|
-
* @param params - Parameters forwarded to `authClient.listAccounts`.
|
|
13
|
-
*/
|
|
14
|
-
export declare function listAccountsOptions(authClient: AuthClient, userId?: string, params?: Parameters<AuthClient["listAccounts"]>[0]): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<{
|
|
15
|
-
scopes: string[];
|
|
16
|
-
id: string;
|
|
17
|
-
createdAt: Date;
|
|
18
|
-
updatedAt: Date;
|
|
19
|
-
userId: string;
|
|
20
|
-
providerId: string;
|
|
21
|
-
accountId: string;
|
|
22
|
-
}[] | null, import('better-auth/client').BetterFetchError, {
|
|
23
|
-
scopes: string[];
|
|
24
|
-
id: string;
|
|
25
|
-
createdAt: Date;
|
|
26
|
-
updatedAt: Date;
|
|
27
|
-
userId: string;
|
|
28
|
-
providerId: string;
|
|
29
|
-
accountId: string;
|
|
30
|
-
}[] | null, readonly unknown[]>, "queryFn"> & {
|
|
31
|
-
queryFn?: import('@tanstack/react-query').QueryFunction<{
|
|
32
|
-
scopes: string[];
|
|
33
|
-
id: string;
|
|
34
|
-
createdAt: Date;
|
|
35
|
-
updatedAt: Date;
|
|
36
|
-
userId: string;
|
|
37
|
-
providerId: string;
|
|
38
|
-
accountId: string;
|
|
39
|
-
}[] | null, readonly unknown[], never> | undefined;
|
|
40
|
-
} & {
|
|
41
|
-
queryKey: readonly unknown[] & {
|
|
42
|
-
[dataTagSymbol]: {
|
|
43
|
-
scopes: string[];
|
|
44
|
-
id: string;
|
|
45
|
-
createdAt: Date;
|
|
46
|
-
updatedAt: Date;
|
|
47
|
-
userId: string;
|
|
48
|
-
providerId: string;
|
|
49
|
-
accountId: string;
|
|
50
|
-
}[] | null;
|
|
51
|
-
[dataTagErrorSymbol]: import('better-auth/client').BetterFetchError;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { authQueryOptions as e } from "../auth-query-options.js";
|
|
2
|
-
//#region src/queries/settings/list-accounts-options.ts
|
|
3
|
-
function t(t, n, r) {
|
|
4
|
-
return e(t.listAccounts, [
|
|
5
|
-
"auth",
|
|
6
|
-
"user",
|
|
7
|
-
n,
|
|
8
|
-
"listAccounts"
|
|
9
|
-
], r);
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { t as listAccountsOptions };
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
/**
|
|
3
|
-
* Query options factory for the current user's device sessions
|
|
4
|
-
* (multi-session account switcher).
|
|
5
|
-
*
|
|
6
|
-
* Keyed per-user (enables offline account switching with a persister).
|
|
7
|
-
*
|
|
8
|
-
* @param authClient - The Better Auth client.
|
|
9
|
-
* @param userId - The current signed in user's ID.
|
|
10
|
-
* @param params - Parameters forwarded to `authClient.multiSession.listDeviceSessions`.
|
|
11
|
-
*/
|
|
12
|
-
export declare function listDeviceSessionsOptions(authClient: AuthClient, userId?: string, params?: Parameters<AuthClient["multiSession"]["listDeviceSessions"]>[0]): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<{
|
|
13
|
-
session: {
|
|
14
|
-
id: string;
|
|
15
|
-
createdAt: Date;
|
|
16
|
-
updatedAt: Date;
|
|
17
|
-
userId: string;
|
|
18
|
-
expiresAt: Date;
|
|
19
|
-
token: string;
|
|
20
|
-
ipAddress?: string | null | undefined;
|
|
21
|
-
userAgent?: string | null | undefined;
|
|
22
|
-
};
|
|
23
|
-
user: {
|
|
24
|
-
id: string;
|
|
25
|
-
createdAt: Date;
|
|
26
|
-
updatedAt: Date;
|
|
27
|
-
email: string;
|
|
28
|
-
emailVerified: boolean;
|
|
29
|
-
name: string;
|
|
30
|
-
image?: string | null | undefined;
|
|
31
|
-
};
|
|
32
|
-
}[] | null, import('better-auth/client').BetterFetchError, {
|
|
33
|
-
session: {
|
|
34
|
-
id: string;
|
|
35
|
-
createdAt: Date;
|
|
36
|
-
updatedAt: Date;
|
|
37
|
-
userId: string;
|
|
38
|
-
expiresAt: Date;
|
|
39
|
-
token: string;
|
|
40
|
-
ipAddress?: string | null | undefined;
|
|
41
|
-
userAgent?: string | null | undefined;
|
|
42
|
-
};
|
|
43
|
-
user: {
|
|
44
|
-
id: string;
|
|
45
|
-
createdAt: Date;
|
|
46
|
-
updatedAt: Date;
|
|
47
|
-
email: string;
|
|
48
|
-
emailVerified: boolean;
|
|
49
|
-
name: string;
|
|
50
|
-
image?: string | null | undefined;
|
|
51
|
-
};
|
|
52
|
-
}[] | null, readonly unknown[]>, "queryFn"> & {
|
|
53
|
-
queryFn?: import('@tanstack/react-query').QueryFunction<{
|
|
54
|
-
session: {
|
|
55
|
-
id: string;
|
|
56
|
-
createdAt: Date;
|
|
57
|
-
updatedAt: Date;
|
|
58
|
-
userId: string;
|
|
59
|
-
expiresAt: Date;
|
|
60
|
-
token: string;
|
|
61
|
-
ipAddress?: string | null | undefined;
|
|
62
|
-
userAgent?: string | null | undefined;
|
|
63
|
-
};
|
|
64
|
-
user: {
|
|
65
|
-
id: string;
|
|
66
|
-
createdAt: Date;
|
|
67
|
-
updatedAt: Date;
|
|
68
|
-
email: string;
|
|
69
|
-
emailVerified: boolean;
|
|
70
|
-
name: string;
|
|
71
|
-
image?: string | null | undefined;
|
|
72
|
-
};
|
|
73
|
-
}[] | null, readonly unknown[], never> | undefined;
|
|
74
|
-
} & {
|
|
75
|
-
queryKey: readonly unknown[] & {
|
|
76
|
-
[dataTagSymbol]: {
|
|
77
|
-
session: {
|
|
78
|
-
id: string;
|
|
79
|
-
createdAt: Date;
|
|
80
|
-
updatedAt: Date;
|
|
81
|
-
userId: string;
|
|
82
|
-
expiresAt: Date;
|
|
83
|
-
token: string;
|
|
84
|
-
ipAddress?: string | null | undefined;
|
|
85
|
-
userAgent?: string | null | undefined;
|
|
86
|
-
};
|
|
87
|
-
user: {
|
|
88
|
-
id: string;
|
|
89
|
-
createdAt: Date;
|
|
90
|
-
updatedAt: Date;
|
|
91
|
-
email: string;
|
|
92
|
-
emailVerified: boolean;
|
|
93
|
-
name: string;
|
|
94
|
-
image?: string | null | undefined;
|
|
95
|
-
};
|
|
96
|
-
}[] | null;
|
|
97
|
-
[dataTagErrorSymbol]: import('better-auth/client').BetterFetchError;
|
|
98
|
-
};
|
|
99
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { authQueryOptions as e } from "../auth-query-options.js";
|
|
2
|
-
//#region src/queries/settings/list-device-sessions-options.ts
|
|
3
|
-
function t(t, n, r) {
|
|
4
|
-
return e(t.multiSession.listDeviceSessions, [
|
|
5
|
-
"auth",
|
|
6
|
-
"user",
|
|
7
|
-
n,
|
|
8
|
-
"listDeviceSessions"
|
|
9
|
-
], r);
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { t as listDeviceSessionsOptions };
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
/**
|
|
3
|
-
* Query options factory for the current user's active sessions.
|
|
4
|
-
*
|
|
5
|
-
* Keyed per-user (enables offline account switching with a persister).
|
|
6
|
-
*
|
|
7
|
-
* @param authClient - The Better Auth client.
|
|
8
|
-
* @param userId - The current signed in user's ID.
|
|
9
|
-
* @param params - Parameters forwarded to `authClient.listSessions`.
|
|
10
|
-
*/
|
|
11
|
-
export declare function listSessionsOptions(authClient: AuthClient, userId?: string, params?: Parameters<AuthClient["listSessions"]>[0]): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<import('better-auth').Prettify<{
|
|
12
|
-
id: string;
|
|
13
|
-
createdAt: Date;
|
|
14
|
-
updatedAt: Date;
|
|
15
|
-
userId: string;
|
|
16
|
-
expiresAt: Date;
|
|
17
|
-
token: string;
|
|
18
|
-
ipAddress?: string | null | undefined | undefined;
|
|
19
|
-
userAgent?: string | null | undefined | undefined;
|
|
20
|
-
}>[] | null, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
21
|
-
id: string;
|
|
22
|
-
createdAt: Date;
|
|
23
|
-
updatedAt: Date;
|
|
24
|
-
userId: string;
|
|
25
|
-
expiresAt: Date;
|
|
26
|
-
token: string;
|
|
27
|
-
ipAddress?: string | null | undefined | undefined;
|
|
28
|
-
userAgent?: string | null | undefined | undefined;
|
|
29
|
-
}>[] | null, readonly unknown[]>, "queryFn"> & {
|
|
30
|
-
queryFn?: import('@tanstack/react-query').QueryFunction<import('better-auth').Prettify<{
|
|
31
|
-
id: string;
|
|
32
|
-
createdAt: Date;
|
|
33
|
-
updatedAt: Date;
|
|
34
|
-
userId: string;
|
|
35
|
-
expiresAt: Date;
|
|
36
|
-
token: string;
|
|
37
|
-
ipAddress?: string | null | undefined | undefined;
|
|
38
|
-
userAgent?: string | null | undefined | undefined;
|
|
39
|
-
}>[] | null, readonly unknown[], never> | undefined;
|
|
40
|
-
} & {
|
|
41
|
-
queryKey: readonly unknown[] & {
|
|
42
|
-
[dataTagSymbol]: import('better-auth').Prettify<{
|
|
43
|
-
id: string;
|
|
44
|
-
createdAt: Date;
|
|
45
|
-
updatedAt: Date;
|
|
46
|
-
userId: string;
|
|
47
|
-
expiresAt: Date;
|
|
48
|
-
token: string;
|
|
49
|
-
ipAddress?: string | null | undefined | undefined;
|
|
50
|
-
userAgent?: string | null | undefined | undefined;
|
|
51
|
-
}>[] | null;
|
|
52
|
-
[dataTagErrorSymbol]: import('better-auth/client').BetterFetchError;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { authQueryOptions as e } from "../auth-query-options.js";
|
|
2
|
-
//#region src/queries/settings/list-sessions-options.ts
|
|
3
|
-
function t(t, n, r) {
|
|
4
|
-
return e(t.listSessions, [
|
|
5
|
-
"auth",
|
|
6
|
-
"user",
|
|
7
|
-
n,
|
|
8
|
-
"listSessions"
|
|
9
|
-
], r);
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { t as listSessionsOptions };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
/**
|
|
3
|
-
* Query options factory for the current user's passkeys.
|
|
4
|
-
*
|
|
5
|
-
* Keyed per-user (enables offline account switching with a persister).
|
|
6
|
-
*
|
|
7
|
-
* @param authClient - The Better Auth client.
|
|
8
|
-
* @param userId - The current signed in user's ID.
|
|
9
|
-
* @param params - Parameters forwarded to `authClient.passkey.listUserPasskeys`.
|
|
10
|
-
*/
|
|
11
|
-
export declare function listUserPasskeysOptions(authClient: AuthClient, userId?: string, params?: Parameters<AuthClient["passkey"]["listUserPasskeys"]>[0]): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<import('@better-auth/passkey/client').Passkey[] | null, import('better-auth/client').BetterFetchError, import('@better-auth/passkey/client').Passkey[] | null, readonly unknown[]>, "queryFn"> & {
|
|
12
|
-
queryFn?: import('@tanstack/react-query').QueryFunction<import('@better-auth/passkey/client').Passkey[] | null, readonly unknown[], never> | undefined;
|
|
13
|
-
} & {
|
|
14
|
-
queryKey: readonly unknown[] & {
|
|
15
|
-
[dataTagSymbol]: import('@better-auth/passkey/client').Passkey[] | null;
|
|
16
|
-
[dataTagErrorSymbol]: import('better-auth/client').BetterFetchError;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { authQueryOptions as e } from "../auth-query-options.js";
|
|
2
|
-
//#region src/queries/settings/list-user-passkeys-options.ts
|
|
3
|
-
function t(t, n, r) {
|
|
4
|
-
return e(t.passkey.listUserPasskeys, [
|
|
5
|
-
"auth",
|
|
6
|
-
"user",
|
|
7
|
-
n,
|
|
8
|
-
"listUserPasskeys"
|
|
9
|
-
], r);
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { t as listUserPasskeysOptions };
|
package/src/core.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@better-auth-ui/core"
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useMutation } from "@tanstack/react-query"
|
|
2
|
-
|
|
3
|
-
import { useAuth } from "../../components/auth/auth-provider"
|
|
4
|
-
import type { AuthClient } from "../../lib/auth-client"
|
|
5
|
-
import { isUsernameAvailableOptions } from "../../mutations/auth/is-username-available-options"
|
|
6
|
-
|
|
7
|
-
export type UseIsUsernameAvailableParams = NonNullable<
|
|
8
|
-
Parameters<AuthClient["isUsernameAvailable"]>[0]
|
|
9
|
-
>
|
|
10
|
-
|
|
11
|
-
export type UseIsUsernameAvailableOptions = Omit<
|
|
12
|
-
ReturnType<typeof isUsernameAvailableOptions>,
|
|
13
|
-
"mutationKey" | "mutationFn"
|
|
14
|
-
>
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Hook that creates a mutation to check if a username is available.
|
|
18
|
-
*
|
|
19
|
-
* @param options - React Query options forwarded to `useMutation`.
|
|
20
|
-
* @returns The `useMutation` result where data contains `{ available: boolean }`.
|
|
21
|
-
*/
|
|
22
|
-
export function useIsUsernameAvailable(
|
|
23
|
-
options?: UseIsUsernameAvailableOptions
|
|
24
|
-
) {
|
|
25
|
-
const { authClient } = useAuth()
|
|
26
|
-
|
|
27
|
-
return useMutation({
|
|
28
|
-
...isUsernameAvailableOptions(authClient),
|
|
29
|
-
...options
|
|
30
|
-
})
|
|
31
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { useMutation } from "@tanstack/react-query"
|
|
2
|
-
|
|
3
|
-
import { useAuth } from "../../components/auth/auth-provider"
|
|
4
|
-
import type { AuthClient } from "../../lib/auth-client"
|
|
5
|
-
import { requestPasswordResetOptions } from "../../mutations/auth/request-password-reset-options"
|
|
6
|
-
|
|
7
|
-
export type UseRequestPasswordResetParams = NonNullable<
|
|
8
|
-
Parameters<AuthClient["requestPasswordReset"]>[0]
|
|
9
|
-
>
|
|
10
|
-
|
|
11
|
-
export type UseRequestPasswordResetOptions = Omit<
|
|
12
|
-
ReturnType<typeof requestPasswordResetOptions>,
|
|
13
|
-
"mutationKey" | "mutationFn"
|
|
14
|
-
>
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Hook that creates a mutation for the forgot-password flow.
|
|
18
|
-
*
|
|
19
|
-
* Sends a password reset email for the provided address.
|
|
20
|
-
*
|
|
21
|
-
* @param options - React Query options forwarded to `useMutation`.
|
|
22
|
-
* @returns The `useMutation` result.
|
|
23
|
-
*/
|
|
24
|
-
export function useRequestPasswordReset(
|
|
25
|
-
options?: UseRequestPasswordResetOptions
|
|
26
|
-
) {
|
|
27
|
-
const { authClient } = useAuth()
|
|
28
|
-
|
|
29
|
-
return useMutation({
|
|
30
|
-
...requestPasswordResetOptions(authClient),
|
|
31
|
-
...options
|
|
32
|
-
})
|
|
33
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useMutation } from "@tanstack/react-query"
|
|
2
|
-
|
|
3
|
-
import { useAuth } from "../../components/auth/auth-provider"
|
|
4
|
-
import type { AuthClient } from "../../lib/auth-client"
|
|
5
|
-
import { resetPasswordOptions } from "../../mutations/auth/reset-password-options"
|
|
6
|
-
|
|
7
|
-
export type UseResetPasswordParams = NonNullable<
|
|
8
|
-
Parameters<AuthClient["resetPassword"]>[0]
|
|
9
|
-
>
|
|
10
|
-
|
|
11
|
-
export type UseResetPasswordOptions = Omit<
|
|
12
|
-
ReturnType<typeof resetPasswordOptions>,
|
|
13
|
-
"mutationKey" | "mutationFn"
|
|
14
|
-
>
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Hook that creates a mutation for the reset-password flow.
|
|
18
|
-
*
|
|
19
|
-
* Resets the user's password using the provided token and new password.
|
|
20
|
-
*
|
|
21
|
-
* @param options - React Query options forwarded to `useMutation`.
|
|
22
|
-
* @returns The `useMutation` result.
|
|
23
|
-
*/
|
|
24
|
-
export function useResetPassword(options?: UseResetPasswordOptions) {
|
|
25
|
-
const { authClient } = useAuth()
|
|
26
|
-
|
|
27
|
-
return useMutation({
|
|
28
|
-
...resetPasswordOptions(authClient),
|
|
29
|
-
...options
|
|
30
|
-
})
|
|
31
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useMutation } from "@tanstack/react-query"
|
|
2
|
-
|
|
3
|
-
import { useAuth } from "../../components/auth/auth-provider"
|
|
4
|
-
import type { AuthClient } from "../../lib/auth-client"
|
|
5
|
-
import { sendVerificationEmailOptions } from "../../mutations/auth/send-verification-email-options"
|
|
6
|
-
|
|
7
|
-
export type UseSendVerificationEmailParams = NonNullable<
|
|
8
|
-
Parameters<AuthClient["sendVerificationEmail"]>[0]
|
|
9
|
-
>
|
|
10
|
-
|
|
11
|
-
export type UseSendVerificationEmailOptions = Omit<
|
|
12
|
-
ReturnType<typeof sendVerificationEmailOptions>,
|
|
13
|
-
"mutationKey" | "mutationFn"
|
|
14
|
-
>
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Hook that creates a mutation to send a verification email.
|
|
18
|
-
*
|
|
19
|
-
* @param options - React Query options forwarded to `useMutation`.
|
|
20
|
-
* @returns The `useMutation` result.
|
|
21
|
-
*/
|
|
22
|
-
export function useSendVerificationEmail(
|
|
23
|
-
options?: UseSendVerificationEmailOptions
|
|
24
|
-
) {
|
|
25
|
-
const { authClient } = useAuth()
|
|
26
|
-
|
|
27
|
-
return useMutation({
|
|
28
|
-
...sendVerificationEmailOptions(authClient),
|
|
29
|
-
...options
|
|
30
|
-
})
|
|
31
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useQuery } from "@tanstack/react-query"
|
|
2
|
-
import { useAuth } from "../../components/auth/auth-provider"
|
|
3
|
-
import type { AuthClient } from "../../lib/auth-client"
|
|
4
|
-
import { sessionOptions } from "../../queries/auth/session-options"
|
|
5
|
-
|
|
6
|
-
export type UseSessionParams = NonNullable<
|
|
7
|
-
Parameters<AuthClient["getSession"]>[0]
|
|
8
|
-
>
|
|
9
|
-
|
|
10
|
-
export type UseSessionOptions = Omit<
|
|
11
|
-
ReturnType<typeof sessionOptions>,
|
|
12
|
-
"queryKey" | "queryFn"
|
|
13
|
-
> &
|
|
14
|
-
UseSessionParams
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Retrieve the current authentication session.
|
|
18
|
-
*
|
|
19
|
-
* @param options - Better Auth params (`query`, `fetchOptions`) and React
|
|
20
|
-
* Query options forwarded to `useQuery`.
|
|
21
|
-
* @returns React Query result for the session.
|
|
22
|
-
*/
|
|
23
|
-
export function useSession(options?: UseSessionOptions) {
|
|
24
|
-
const { authClient } = useAuth()
|
|
25
|
-
const { query, fetchOptions, ...queryOptions } = options ?? {}
|
|
26
|
-
|
|
27
|
-
return useQuery({
|
|
28
|
-
...sessionOptions(authClient, { query, fetchOptions }),
|
|
29
|
-
...queryOptions
|
|
30
|
-
})
|
|
31
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { useMutation, useQueryClient } from "@tanstack/react-query"
|
|
2
|
-
|
|
3
|
-
import { useAuth } from "../../components/auth/auth-provider"
|
|
4
|
-
import type { AuthClient } from "../../lib/auth-client"
|
|
5
|
-
import { signInEmailOptions } from "../../mutations/auth/sign-in-email-options"
|
|
6
|
-
import { sessionOptions } from "../../queries/auth/session-options"
|
|
7
|
-
|
|
8
|
-
export type UseSignInEmailParams = NonNullable<
|
|
9
|
-
Parameters<AuthClient["signIn"]["email"]>[0]
|
|
10
|
-
>
|
|
11
|
-
|
|
12
|
-
export type UseSignInEmailOptions = Omit<
|
|
13
|
-
ReturnType<typeof signInEmailOptions>,
|
|
14
|
-
"mutationKey" | "mutationFn"
|
|
15
|
-
>
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Hook that creates a mutation for email/password sign-in.
|
|
19
|
-
*
|
|
20
|
-
* The mutation sends an email/password sign-in request and
|
|
21
|
-
* refetches the session on completion.
|
|
22
|
-
*
|
|
23
|
-
* @param options - React Query options forwarded to `useMutation`.
|
|
24
|
-
* @returns The `useMutation` result.
|
|
25
|
-
*/
|
|
26
|
-
export function useSignInEmail(options?: UseSignInEmailOptions) {
|
|
27
|
-
const { authClient } = useAuth()
|
|
28
|
-
const queryClient = useQueryClient()
|
|
29
|
-
|
|
30
|
-
return useMutation({
|
|
31
|
-
...signInEmailOptions(authClient),
|
|
32
|
-
...options,
|
|
33
|
-
onSuccess: async (...args) => {
|
|
34
|
-
queryClient.resetQueries({
|
|
35
|
-
queryKey: sessionOptions(authClient).queryKey
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
await options?.onSuccess?.(...args)
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
}
|