@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,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
+
import { UseSessionOptions } from '../../queries/auth/session-query';
|
|
2
3
|
/**
|
|
3
|
-
* Retrieve the current authenticated user.
|
|
4
|
+
* Retrieve the current authenticated user. Thin wrapper over `useSession`
|
|
5
|
+
* that returns `session.user` as `data`.
|
|
4
6
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @param options - Better Auth params (`query`, `fetchOptions`) and React
|
|
8
|
-
* Query options forwarded to `useQuery`.
|
|
9
|
-
* @returns React Query result with `data` narrowed to the user object.
|
|
7
|
+
* @param authClient - The Better Auth client.
|
|
8
|
+
* @param options - `getSession` params & `useQuery` options.
|
|
10
9
|
*/
|
|
11
|
-
export declare function useUser(options?: UseSessionOptions): {
|
|
10
|
+
export declare function useUser<TAuthClient extends AuthClient>(authClient: TAuthClient, options?: UseSessionOptions<TAuthClient>): {
|
|
12
11
|
error: import('better-auth/client').BetterFetchError;
|
|
13
12
|
isError: true;
|
|
14
13
|
isPending: false;
|
|
@@ -31,55 +30,9 @@ export declare function useUser(options?: UseSessionOptions): {
|
|
|
31
30
|
isRefetching: boolean;
|
|
32
31
|
isStale: boolean;
|
|
33
32
|
isEnabled: boolean;
|
|
34
|
-
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<
|
|
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, import('better-auth/client').BetterFetchError>>;
|
|
33
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<import('@tanstack/react-query').NoInfer<import('../..').InferData<TAuthClient["getSession"]>>, import('better-auth/client').BetterFetchError>>;
|
|
58
34
|
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
59
|
-
promise: Promise<
|
|
60
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
61
|
-
id: string;
|
|
62
|
-
createdAt: Date;
|
|
63
|
-
updatedAt: Date;
|
|
64
|
-
email: string;
|
|
65
|
-
emailVerified: boolean;
|
|
66
|
-
name: string;
|
|
67
|
-
image?: string | null | undefined;
|
|
68
|
-
} & {} & {
|
|
69
|
-
username?: string | null | undefined;
|
|
70
|
-
displayUsername?: string | null | undefined;
|
|
71
|
-
}>;
|
|
72
|
-
session: import('better-auth').StripEmptyObjects<{
|
|
73
|
-
id: string;
|
|
74
|
-
createdAt: Date;
|
|
75
|
-
updatedAt: Date;
|
|
76
|
-
userId: string;
|
|
77
|
-
expiresAt: Date;
|
|
78
|
-
token: string;
|
|
79
|
-
ipAddress?: string | null | undefined;
|
|
80
|
-
userAgent?: string | null | undefined;
|
|
81
|
-
}>;
|
|
82
|
-
} | null>;
|
|
35
|
+
promise: Promise<import('@tanstack/react-query').NoInfer<import('../..').InferData<TAuthClient["getSession"]>>>;
|
|
83
36
|
data: import('better-auth').StripEmptyObjects<{
|
|
84
37
|
id: string;
|
|
85
38
|
createdAt: Date;
|
|
@@ -88,9 +41,6 @@ export declare function useUser(options?: UseSessionOptions): {
|
|
|
88
41
|
emailVerified: boolean;
|
|
89
42
|
name: string;
|
|
90
43
|
image?: string | null | undefined;
|
|
91
|
-
} & {} & {
|
|
92
|
-
username?: string | null | undefined;
|
|
93
|
-
displayUsername?: string | null | undefined;
|
|
94
44
|
}> | undefined;
|
|
95
45
|
} | {
|
|
96
46
|
error: null;
|
|
@@ -115,55 +65,9 @@ export declare function useUser(options?: UseSessionOptions): {
|
|
|
115
65
|
isRefetching: boolean;
|
|
116
66
|
isStale: boolean;
|
|
117
67
|
isEnabled: boolean;
|
|
118
|
-
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<
|
|
119
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
120
|
-
id: string;
|
|
121
|
-
createdAt: Date;
|
|
122
|
-
updatedAt: Date;
|
|
123
|
-
email: string;
|
|
124
|
-
emailVerified: boolean;
|
|
125
|
-
name: string;
|
|
126
|
-
image?: string | null | undefined;
|
|
127
|
-
} & {} & {
|
|
128
|
-
username?: string | null | undefined;
|
|
129
|
-
displayUsername?: string | null | undefined;
|
|
130
|
-
}>;
|
|
131
|
-
session: import('better-auth').StripEmptyObjects<{
|
|
132
|
-
id: string;
|
|
133
|
-
createdAt: Date;
|
|
134
|
-
updatedAt: Date;
|
|
135
|
-
userId: string;
|
|
136
|
-
expiresAt: Date;
|
|
137
|
-
token: string;
|
|
138
|
-
ipAddress?: string | null | undefined;
|
|
139
|
-
userAgent?: string | null | undefined;
|
|
140
|
-
}>;
|
|
141
|
-
} | null, import('better-auth/client').BetterFetchError>>;
|
|
68
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<import('@tanstack/react-query').NoInfer<import('../..').InferData<TAuthClient["getSession"]>>, import('better-auth/client').BetterFetchError>>;
|
|
142
69
|
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
143
|
-
promise: Promise<
|
|
144
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
145
|
-
id: string;
|
|
146
|
-
createdAt: Date;
|
|
147
|
-
updatedAt: Date;
|
|
148
|
-
email: string;
|
|
149
|
-
emailVerified: boolean;
|
|
150
|
-
name: string;
|
|
151
|
-
image?: string | null | undefined;
|
|
152
|
-
} & {} & {
|
|
153
|
-
username?: string | null | undefined;
|
|
154
|
-
displayUsername?: string | null | undefined;
|
|
155
|
-
}>;
|
|
156
|
-
session: import('better-auth').StripEmptyObjects<{
|
|
157
|
-
id: string;
|
|
158
|
-
createdAt: Date;
|
|
159
|
-
updatedAt: Date;
|
|
160
|
-
userId: string;
|
|
161
|
-
expiresAt: Date;
|
|
162
|
-
token: string;
|
|
163
|
-
ipAddress?: string | null | undefined;
|
|
164
|
-
userAgent?: string | null | undefined;
|
|
165
|
-
}>;
|
|
166
|
-
} | null>;
|
|
70
|
+
promise: Promise<import('@tanstack/react-query').NoInfer<import('../..').InferData<TAuthClient["getSession"]>>>;
|
|
167
71
|
data: import('better-auth').StripEmptyObjects<{
|
|
168
72
|
id: string;
|
|
169
73
|
createdAt: Date;
|
|
@@ -172,9 +76,6 @@ export declare function useUser(options?: UseSessionOptions): {
|
|
|
172
76
|
emailVerified: boolean;
|
|
173
77
|
name: string;
|
|
174
78
|
image?: string | null | undefined;
|
|
175
|
-
} & {} & {
|
|
176
|
-
username?: string | null | undefined;
|
|
177
|
-
displayUsername?: string | null | undefined;
|
|
178
79
|
}> | undefined;
|
|
179
80
|
} | {
|
|
180
81
|
error: import('better-auth/client').BetterFetchError;
|
|
@@ -199,55 +100,9 @@ export declare function useUser(options?: UseSessionOptions): {
|
|
|
199
100
|
isRefetching: boolean;
|
|
200
101
|
isStale: boolean;
|
|
201
102
|
isEnabled: boolean;
|
|
202
|
-
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<
|
|
203
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
204
|
-
id: string;
|
|
205
|
-
createdAt: Date;
|
|
206
|
-
updatedAt: Date;
|
|
207
|
-
email: string;
|
|
208
|
-
emailVerified: boolean;
|
|
209
|
-
name: string;
|
|
210
|
-
image?: string | null | undefined;
|
|
211
|
-
} & {} & {
|
|
212
|
-
username?: string | null | undefined;
|
|
213
|
-
displayUsername?: string | null | undefined;
|
|
214
|
-
}>;
|
|
215
|
-
session: import('better-auth').StripEmptyObjects<{
|
|
216
|
-
id: string;
|
|
217
|
-
createdAt: Date;
|
|
218
|
-
updatedAt: Date;
|
|
219
|
-
userId: string;
|
|
220
|
-
expiresAt: Date;
|
|
221
|
-
token: string;
|
|
222
|
-
ipAddress?: string | null | undefined;
|
|
223
|
-
userAgent?: string | null | undefined;
|
|
224
|
-
}>;
|
|
225
|
-
} | null, import('better-auth/client').BetterFetchError>>;
|
|
103
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<import('@tanstack/react-query').NoInfer<import('../..').InferData<TAuthClient["getSession"]>>, import('better-auth/client').BetterFetchError>>;
|
|
226
104
|
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
227
|
-
promise: Promise<
|
|
228
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
229
|
-
id: string;
|
|
230
|
-
createdAt: Date;
|
|
231
|
-
updatedAt: Date;
|
|
232
|
-
email: string;
|
|
233
|
-
emailVerified: boolean;
|
|
234
|
-
name: string;
|
|
235
|
-
image?: string | null | undefined;
|
|
236
|
-
} & {} & {
|
|
237
|
-
username?: string | null | undefined;
|
|
238
|
-
displayUsername?: string | null | undefined;
|
|
239
|
-
}>;
|
|
240
|
-
session: import('better-auth').StripEmptyObjects<{
|
|
241
|
-
id: string;
|
|
242
|
-
createdAt: Date;
|
|
243
|
-
updatedAt: Date;
|
|
244
|
-
userId: string;
|
|
245
|
-
expiresAt: Date;
|
|
246
|
-
token: string;
|
|
247
|
-
ipAddress?: string | null | undefined;
|
|
248
|
-
userAgent?: string | null | undefined;
|
|
249
|
-
}>;
|
|
250
|
-
} | null>;
|
|
105
|
+
promise: Promise<import('@tanstack/react-query').NoInfer<import('../..').InferData<TAuthClient["getSession"]>>>;
|
|
251
106
|
data: import('better-auth').StripEmptyObjects<{
|
|
252
107
|
id: string;
|
|
253
108
|
createdAt: Date;
|
|
@@ -256,9 +111,6 @@ export declare function useUser(options?: UseSessionOptions): {
|
|
|
256
111
|
emailVerified: boolean;
|
|
257
112
|
name: string;
|
|
258
113
|
image?: string | null | undefined;
|
|
259
|
-
} & {} & {
|
|
260
|
-
username?: string | null | undefined;
|
|
261
|
-
displayUsername?: string | null | undefined;
|
|
262
114
|
}> | undefined;
|
|
263
115
|
} | {
|
|
264
116
|
error: null;
|
|
@@ -283,55 +135,9 @@ export declare function useUser(options?: UseSessionOptions): {
|
|
|
283
135
|
isRefetching: boolean;
|
|
284
136
|
isStale: boolean;
|
|
285
137
|
isEnabled: boolean;
|
|
286
|
-
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<
|
|
287
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
288
|
-
id: string;
|
|
289
|
-
createdAt: Date;
|
|
290
|
-
updatedAt: Date;
|
|
291
|
-
email: string;
|
|
292
|
-
emailVerified: boolean;
|
|
293
|
-
name: string;
|
|
294
|
-
image?: string | null | undefined;
|
|
295
|
-
} & {} & {
|
|
296
|
-
username?: string | null | undefined;
|
|
297
|
-
displayUsername?: string | null | undefined;
|
|
298
|
-
}>;
|
|
299
|
-
session: import('better-auth').StripEmptyObjects<{
|
|
300
|
-
id: string;
|
|
301
|
-
createdAt: Date;
|
|
302
|
-
updatedAt: Date;
|
|
303
|
-
userId: string;
|
|
304
|
-
expiresAt: Date;
|
|
305
|
-
token: string;
|
|
306
|
-
ipAddress?: string | null | undefined;
|
|
307
|
-
userAgent?: string | null | undefined;
|
|
308
|
-
}>;
|
|
309
|
-
} | null, import('better-auth/client').BetterFetchError>>;
|
|
138
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<import('@tanstack/react-query').NoInfer<import('../..').InferData<TAuthClient["getSession"]>>, import('better-auth/client').BetterFetchError>>;
|
|
310
139
|
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
311
|
-
promise: Promise<
|
|
312
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
313
|
-
id: string;
|
|
314
|
-
createdAt: Date;
|
|
315
|
-
updatedAt: Date;
|
|
316
|
-
email: string;
|
|
317
|
-
emailVerified: boolean;
|
|
318
|
-
name: string;
|
|
319
|
-
image?: string | null | undefined;
|
|
320
|
-
} & {} & {
|
|
321
|
-
username?: string | null | undefined;
|
|
322
|
-
displayUsername?: string | null | undefined;
|
|
323
|
-
}>;
|
|
324
|
-
session: import('better-auth').StripEmptyObjects<{
|
|
325
|
-
id: string;
|
|
326
|
-
createdAt: Date;
|
|
327
|
-
updatedAt: Date;
|
|
328
|
-
userId: string;
|
|
329
|
-
expiresAt: Date;
|
|
330
|
-
token: string;
|
|
331
|
-
ipAddress?: string | null | undefined;
|
|
332
|
-
userAgent?: string | null | undefined;
|
|
333
|
-
}>;
|
|
334
|
-
} | null>;
|
|
140
|
+
promise: Promise<import('@tanstack/react-query').NoInfer<import('../..').InferData<TAuthClient["getSession"]>>>;
|
|
335
141
|
data: import('better-auth').StripEmptyObjects<{
|
|
336
142
|
id: string;
|
|
337
143
|
createdAt: Date;
|
|
@@ -340,9 +146,6 @@ export declare function useUser(options?: UseSessionOptions): {
|
|
|
340
146
|
emailVerified: boolean;
|
|
341
147
|
name: string;
|
|
342
148
|
image?: string | null | undefined;
|
|
343
|
-
} & {} & {
|
|
344
|
-
username?: string | null | undefined;
|
|
345
|
-
displayUsername?: string | null | undefined;
|
|
346
149
|
}> | undefined;
|
|
347
150
|
} | {
|
|
348
151
|
error: null;
|
|
@@ -367,55 +170,9 @@ export declare function useUser(options?: UseSessionOptions): {
|
|
|
367
170
|
isRefetching: boolean;
|
|
368
171
|
isStale: boolean;
|
|
369
172
|
isEnabled: boolean;
|
|
370
|
-
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<
|
|
371
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
372
|
-
id: string;
|
|
373
|
-
createdAt: Date;
|
|
374
|
-
updatedAt: Date;
|
|
375
|
-
email: string;
|
|
376
|
-
emailVerified: boolean;
|
|
377
|
-
name: string;
|
|
378
|
-
image?: string | null | undefined;
|
|
379
|
-
} & {} & {
|
|
380
|
-
username?: string | null | undefined;
|
|
381
|
-
displayUsername?: string | null | undefined;
|
|
382
|
-
}>;
|
|
383
|
-
session: import('better-auth').StripEmptyObjects<{
|
|
384
|
-
id: string;
|
|
385
|
-
createdAt: Date;
|
|
386
|
-
updatedAt: Date;
|
|
387
|
-
userId: string;
|
|
388
|
-
expiresAt: Date;
|
|
389
|
-
token: string;
|
|
390
|
-
ipAddress?: string | null | undefined;
|
|
391
|
-
userAgent?: string | null | undefined;
|
|
392
|
-
}>;
|
|
393
|
-
} | null, import('better-auth/client').BetterFetchError>>;
|
|
173
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<import('@tanstack/react-query').NoInfer<import('../..').InferData<TAuthClient["getSession"]>>, import('better-auth/client').BetterFetchError>>;
|
|
394
174
|
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
395
|
-
promise: Promise<
|
|
396
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
397
|
-
id: string;
|
|
398
|
-
createdAt: Date;
|
|
399
|
-
updatedAt: Date;
|
|
400
|
-
email: string;
|
|
401
|
-
emailVerified: boolean;
|
|
402
|
-
name: string;
|
|
403
|
-
image?: string | null | undefined;
|
|
404
|
-
} & {} & {
|
|
405
|
-
username?: string | null | undefined;
|
|
406
|
-
displayUsername?: string | null | undefined;
|
|
407
|
-
}>;
|
|
408
|
-
session: import('better-auth').StripEmptyObjects<{
|
|
409
|
-
id: string;
|
|
410
|
-
createdAt: Date;
|
|
411
|
-
updatedAt: Date;
|
|
412
|
-
userId: string;
|
|
413
|
-
expiresAt: Date;
|
|
414
|
-
token: string;
|
|
415
|
-
ipAddress?: string | null | undefined;
|
|
416
|
-
userAgent?: string | null | undefined;
|
|
417
|
-
}>;
|
|
418
|
-
} | null>;
|
|
175
|
+
promise: Promise<import('@tanstack/react-query').NoInfer<import('../..').InferData<TAuthClient["getSession"]>>>;
|
|
419
176
|
data: import('better-auth').StripEmptyObjects<{
|
|
420
177
|
id: string;
|
|
421
178
|
createdAt: Date;
|
|
@@ -424,9 +181,6 @@ export declare function useUser(options?: UseSessionOptions): {
|
|
|
424
181
|
emailVerified: boolean;
|
|
425
182
|
name: string;
|
|
426
183
|
image?: string | null | undefined;
|
|
427
|
-
} & {} & {
|
|
428
|
-
username?: string | null | undefined;
|
|
429
|
-
displayUsername?: string | null | undefined;
|
|
430
184
|
}> | undefined;
|
|
431
185
|
} | {
|
|
432
186
|
isError: false;
|
|
@@ -451,55 +205,9 @@ export declare function useUser(options?: UseSessionOptions): {
|
|
|
451
205
|
isRefetching: boolean;
|
|
452
206
|
isStale: boolean;
|
|
453
207
|
isEnabled: boolean;
|
|
454
|
-
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<
|
|
455
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
456
|
-
id: string;
|
|
457
|
-
createdAt: Date;
|
|
458
|
-
updatedAt: Date;
|
|
459
|
-
email: string;
|
|
460
|
-
emailVerified: boolean;
|
|
461
|
-
name: string;
|
|
462
|
-
image?: string | null | undefined;
|
|
463
|
-
} & {} & {
|
|
464
|
-
username?: string | null | undefined;
|
|
465
|
-
displayUsername?: string | null | undefined;
|
|
466
|
-
}>;
|
|
467
|
-
session: import('better-auth').StripEmptyObjects<{
|
|
468
|
-
id: string;
|
|
469
|
-
createdAt: Date;
|
|
470
|
-
updatedAt: Date;
|
|
471
|
-
userId: string;
|
|
472
|
-
expiresAt: Date;
|
|
473
|
-
token: string;
|
|
474
|
-
ipAddress?: string | null | undefined;
|
|
475
|
-
userAgent?: string | null | undefined;
|
|
476
|
-
}>;
|
|
477
|
-
} | null, import('better-auth/client').BetterFetchError>>;
|
|
208
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<import('@tanstack/react-query').NoInfer<import('../..').InferData<TAuthClient["getSession"]>>, import('better-auth/client').BetterFetchError>>;
|
|
478
209
|
fetchStatus: import('@tanstack/react-query').FetchStatus;
|
|
479
|
-
promise: Promise<
|
|
480
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
481
|
-
id: string;
|
|
482
|
-
createdAt: Date;
|
|
483
|
-
updatedAt: Date;
|
|
484
|
-
email: string;
|
|
485
|
-
emailVerified: boolean;
|
|
486
|
-
name: string;
|
|
487
|
-
image?: string | null | undefined;
|
|
488
|
-
} & {} & {
|
|
489
|
-
username?: string | null | undefined;
|
|
490
|
-
displayUsername?: string | null | undefined;
|
|
491
|
-
}>;
|
|
492
|
-
session: import('better-auth').StripEmptyObjects<{
|
|
493
|
-
id: string;
|
|
494
|
-
createdAt: Date;
|
|
495
|
-
updatedAt: Date;
|
|
496
|
-
userId: string;
|
|
497
|
-
expiresAt: Date;
|
|
498
|
-
token: string;
|
|
499
|
-
ipAddress?: string | null | undefined;
|
|
500
|
-
userAgent?: string | null | undefined;
|
|
501
|
-
}>;
|
|
502
|
-
} | null>;
|
|
210
|
+
promise: Promise<import('@tanstack/react-query').NoInfer<import('../..').InferData<TAuthClient["getSession"]>>>;
|
|
503
211
|
data: import('better-auth').StripEmptyObjects<{
|
|
504
212
|
id: string;
|
|
505
213
|
createdAt: Date;
|
|
@@ -508,8 +216,5 @@ export declare function useUser(options?: UseSessionOptions): {
|
|
|
508
216
|
emailVerified: boolean;
|
|
509
217
|
name: string;
|
|
510
218
|
image?: string | null | undefined;
|
|
511
|
-
} & {} & {
|
|
512
|
-
username?: string | null | undefined;
|
|
513
|
-
displayUsername?: string | null | undefined;
|
|
514
219
|
}> | undefined;
|
|
515
220
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useSession as e } from "
|
|
1
|
+
import { useSession as e } from "../../queries/auth/session-query.js";
|
|
2
2
|
//#region src/hooks/auth/use-user.ts
|
|
3
|
-
function t(t) {
|
|
4
|
-
let { data:
|
|
3
|
+
function t(t, n) {
|
|
4
|
+
let { data: r, ...i } = e(t, n);
|
|
5
5
|
return {
|
|
6
|
-
data:
|
|
7
|
-
...
|
|
6
|
+
data: r?.user,
|
|
7
|
+
...i
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
//#endregion
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import { MutationKey } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
1
|
+
import { MutationKey, UseMutationOptions } from '@tanstack/react-query';
|
|
2
|
+
import { BetterFetchError } from 'better-auth/client';
|
|
3
|
+
import { AuthMutationFn, AuthMutationFnData, AuthMutationFnVariables } from '../mutations/auth-mutation-options';
|
|
4
|
+
type UseAuthMutationOptions<TFn extends AuthMutationFn> = Omit<UseMutationOptions<AuthMutationFnData<TFn>, BetterFetchError, AuthMutationFnVariables<TFn>>, "mutationKey" | "mutationFn">;
|
|
3
5
|
/**
|
|
4
|
-
* Escape-hatch hook for Better Auth endpoints that don't have a
|
|
5
|
-
* mutation hook in this library yet. Thin wrapper over
|
|
6
|
-
* `authMutationOptions`.
|
|
6
|
+
* Escape-hatch hook for Better Auth write endpoints that don't have a
|
|
7
|
+
* purpose-built mutation hook in this library yet. Thin wrapper over
|
|
8
|
+
* `useMutation` and `authMutationOptions`.
|
|
7
9
|
*
|
|
8
10
|
* @param authFn - Better Auth client method (e.g. `authClient.emailOtp.sendVerificationOtp`).
|
|
9
|
-
* @param mutationKey -
|
|
11
|
+
* @param mutationKey - Stable key for the mutation. Prefer an entry from
|
|
12
|
+
* `authMutationKeys` over an inline tuple so `useIsMutating` and global
|
|
13
|
+
* `MutationCache` observers line up.
|
|
10
14
|
* @param options - React Query options forwarded to `useMutation`.
|
|
11
15
|
*/
|
|
12
|
-
export declare function useAuthMutation<TFn extends
|
|
16
|
+
export declare function useAuthMutation<TFn extends AuthMutationFn, const TMutationKey extends MutationKey>(authFn: TFn, mutationKey: TMutationKey, options?: UseAuthMutationOptions<TFn>): import('@tanstack/react-query').UseMutationResult<Awaited<ReturnType<TFn>>, BetterFetchError, AuthMutationFnVariables<TFn>, unknown>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AuthPlugin } from '../lib/auth-plugin';
|
|
2
|
+
/**
|
|
3
|
+
* Plugin factory shape accepted by {@link useAuthPlugin}. The `id` is read as
|
|
4
|
+
* a static property — the factory is never invoked — so plugins with required
|
|
5
|
+
* options (e.g. `themePlugin`'s `setTheme`) can still be looked up.
|
|
6
|
+
*
|
|
7
|
+
* Always produced by `createAuthPlugin` from `@better-auth-ui/core`.
|
|
8
|
+
*/
|
|
9
|
+
export type AuthPluginFactory<T extends AuthPlugin = AuthPlugin> = {
|
|
10
|
+
id: string;
|
|
11
|
+
(...args: any[]): T;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Access a registered plugin by passing its factory.
|
|
15
|
+
*
|
|
16
|
+
* Use inside plugin slot components to read plugin state (localization,
|
|
17
|
+
* config, etc.) without prop drilling.
|
|
18
|
+
*
|
|
19
|
+
* Throws if the plugin isn't registered on `AuthProvider` — this is an
|
|
20
|
+
* invariant: plugin slot components only render when their plugin is in
|
|
21
|
+
* `plugins`.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* function PasskeyButton() {
|
|
26
|
+
* const { localization } = useAuthPlugin(passkeyPlugin)
|
|
27
|
+
* return <button>{localization.passkey}</button>
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function useAuthPlugin<T extends AuthPlugin>(pluginFactory: AuthPluginFactory<T>): T;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useAuth as e } from "../components/auth/auth-provider.js";
|
|
3
|
+
//#region src/hooks/use-auth-plugin.ts
|
|
4
|
+
function t(t) {
|
|
5
|
+
let { plugins: n } = e(), r = n?.find((e) => e.id === t.id);
|
|
6
|
+
if (!r) throw Error(`[Better Auth UI] useAuthPlugin: plugin "${t.id}" is not registered on AuthProvider.`);
|
|
7
|
+
return r;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as useAuthPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QueryKey } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
3
|
-
type UseAuthQueryOptions<TFn extends
|
|
2
|
+
import { AuthQueryFn, AuthQueryOptions } from '../queries/auth-query-options';
|
|
3
|
+
type UseAuthQueryOptions<TFn extends AuthQueryFn, TPrefix extends QueryKey> = Omit<AuthQueryOptions<TFn, TPrefix>, "queryKey" | "queryFn"> & Pick<NonNullable<Parameters<TFn>[0]>, "query" | "fetchOptions">;
|
|
4
4
|
/**
|
|
5
5
|
* Escape-hatch hook for Better Auth endpoints that don't have a purpose-built
|
|
6
6
|
* hook in this library yet. Thin wrapper over `useQuery` and `authQueryOptions`.
|
|
@@ -10,5 +10,5 @@ type UseAuthQueryOptions<TFn extends AuthFn, TQueryKey extends QueryKey> = Omit<
|
|
|
10
10
|
* @param options - Better Auth params (`query`, `fetchOptions`) and React
|
|
11
11
|
* Query options forwarded to `useQuery`.
|
|
12
12
|
*/
|
|
13
|
-
export declare function useAuthQuery<TFn extends
|
|
13
|
+
export declare function useAuthQuery<TFn extends AuthQueryFn, const TQueryKey extends QueryKey>(authFn: TFn, queryKey: TQueryKey, options?: UseAuthQueryOptions<TFn, TQueryKey>): import('@tanstack/react-query').UseQueryResult<import('@tanstack/react-query').NoInfer<import('..').AuthQueryFnData<TFn>>, import('better-auth/client').BetterFetchError>;
|
|
14
14
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
export * from './components/auth/auth-provider';
|
|
2
|
-
export * from './components/email';
|
|
3
2
|
export * from './components/icons';
|
|
4
3
|
export * from './components/settings/account/theme-preview';
|
|
5
4
|
export * from './hooks/auth/use-authenticate';
|
|
6
|
-
export * from './hooks/auth/use-is-username-available';
|
|
7
|
-
export * from './hooks/auth/use-request-password-reset';
|
|
8
|
-
export * from './hooks/auth/use-reset-password';
|
|
9
|
-
export * from './hooks/auth/use-send-verification-email';
|
|
10
|
-
export * from './hooks/auth/use-session';
|
|
11
|
-
export * from './hooks/auth/use-sign-in-email';
|
|
12
|
-
export * from './hooks/auth/use-sign-in-magic-link';
|
|
13
|
-
export * from './hooks/auth/use-sign-in-passkey';
|
|
14
|
-
export * from './hooks/auth/use-sign-in-social';
|
|
15
|
-
export * from './hooks/auth/use-sign-in-username';
|
|
16
|
-
export * from './hooks/auth/use-sign-out';
|
|
17
|
-
export * from './hooks/auth/use-sign-up-email';
|
|
18
5
|
export * from './hooks/auth/use-user';
|
|
19
|
-
export * from './hooks/settings/use-account-info';
|
|
20
|
-
export * from './hooks/settings/use-add-passkey';
|
|
21
|
-
export * from './hooks/settings/use-change-email';
|
|
22
|
-
export * from './hooks/settings/use-change-password';
|
|
23
|
-
export * from './hooks/settings/use-delete-passkey';
|
|
24
|
-
export * from './hooks/settings/use-delete-user';
|
|
25
|
-
export * from './hooks/settings/use-link-social';
|
|
26
|
-
export * from './hooks/settings/use-list-accounts';
|
|
27
|
-
export * from './hooks/settings/use-list-device-sessions';
|
|
28
|
-
export * from './hooks/settings/use-list-sessions';
|
|
29
|
-
export * from './hooks/settings/use-list-user-passkeys';
|
|
30
|
-
export * from './hooks/settings/use-revoke-multi-session';
|
|
31
|
-
export * from './hooks/settings/use-revoke-session';
|
|
32
|
-
export * from './hooks/settings/use-set-active-session';
|
|
33
|
-
export * from './hooks/settings/use-unlink-account';
|
|
34
|
-
export * from './hooks/settings/use-update-user';
|
|
35
6
|
export * from './hooks/use-auth-mutation';
|
|
7
|
+
export * from './hooks/use-auth-plugin';
|
|
36
8
|
export * from './hooks/use-auth-query';
|
|
37
|
-
export * from './lib/auth-client';
|
|
38
|
-
export * from './lib/auth-
|
|
39
|
-
export * from './lib/auth-context';
|
|
9
|
+
export type * from './lib/auth-client';
|
|
10
|
+
export * from './lib/auth-plugin';
|
|
40
11
|
export * from './lib/provider-icons';
|
|
12
|
+
export * from './mutations/auth/request-password-reset-mutation';
|
|
13
|
+
export * from './mutations/auth/reset-password-mutation';
|
|
14
|
+
export * from './mutations/auth/send-verification-email-mutation';
|
|
15
|
+
export * from './mutations/auth/sign-in-email-mutation';
|
|
16
|
+
export * from './mutations/auth/sign-in-social-mutation';
|
|
17
|
+
export * from './mutations/auth/sign-out-mutation';
|
|
18
|
+
export * from './mutations/auth/sign-up-email-mutation';
|
|
19
|
+
export * from './mutations/auth-mutation-options';
|
|
20
|
+
export * from './mutations/magic-link/sign-in-magic-link-mutation';
|
|
21
|
+
export * from './mutations/multi-session/revoke-multi-session-mutation';
|
|
22
|
+
export * from './mutations/multi-session/set-active-session-mutation';
|
|
23
|
+
export * from './mutations/passkey/add-passkey-mutation';
|
|
24
|
+
export * from './mutations/passkey/delete-passkey-mutation';
|
|
25
|
+
export * from './mutations/passkey/sign-in-passkey-mutation';
|
|
26
|
+
export * from './mutations/settings/change-email-mutation';
|
|
27
|
+
export * from './mutations/settings/change-password-mutation';
|
|
28
|
+
export * from './mutations/settings/delete-user-mutation';
|
|
29
|
+
export * from './mutations/settings/link-social-mutation';
|
|
30
|
+
export * from './mutations/settings/revoke-session-mutation';
|
|
31
|
+
export * from './mutations/settings/unlink-account-mutation';
|
|
32
|
+
export * from './mutations/settings/update-user-mutation';
|
|
33
|
+
export * from './mutations/username/is-username-available-mutation';
|
|
34
|
+
export * from './mutations/username/sign-in-username-mutation';
|
|
35
|
+
export * from './queries/auth/session-query';
|
|
36
|
+
export * from './queries/auth-query-options';
|
|
37
|
+
export * from './queries/multi-session/list-device-sessions-query';
|
|
38
|
+
export * from './queries/passkey/list-passkeys-query';
|
|
39
|
+
export * from './queries/settings/account-info-query';
|
|
40
|
+
export * from './queries/settings/list-accounts-query';
|
|
41
|
+
export * from './queries/settings/list-sessions-query';
|