v0.1.0
Minor Changes
-
#11
fe2779cThanks @Timonwa! - Initial release. Typed React hooks for Firebase, one import per service. This release covers the shared core and the Auth service; Firestore and Storage follow.Auth —
@timonwa/firebase-hooks/authAuthProvider/useAuth— live user and custom claims viaonIdTokenChanged, plus app-wide defaults.- Sign in —
useLogin,useSignup,useOAuthSignIn(popup or redirect, redirect completed on return),useEmailLinkSignIn(needsEmailinstead ofwindow.prompt),usePhoneSignIn(managed reCAPTCHA,recaptchaSizeoption),useAnonymousSignIn,useCustomTokenSignIn,useLogout(your session teardown runs first). - Passwords —
useSendPasswordResetEmail,useConfirmPasswordReset(withverifyCode),useUpdatePassword. - Email —
useVerifyEmail,useSendEmailVerification,useUpdateEmail. - Account —
useUpdateProfile,useDeleteAccount,useReauthenticate,useLinkProvider,useUnlinkProvider. AUTH_ERROR_MESSAGES— a curatedauth/*message catalogue, applied only if you opt in.
Core —
@timonwa/firebase-hooksformatFirebaseError,getFirebaseErrorCode, and the sharedHookResult,HookErrorOptions,HookErrorContext,FormatFirebaseErrorOptions, andOnIdTokentypes.How it behaves
- Actions never throw. Each resolves to
{ success: true, ... }or{ success: false, error, code, cause }, whereerroris Firebase's own message unless you opt into formatting, andcauseis the untouched error. - Sign-in successes hand back Firebase's raw
UserCredentialalongside the user. - Server sessions plug in through
onIdTokenandonBeforeSignOut; throw inside either to abort the flow. onIdToken,onBeforeSignOut,actionCodeSettings,formatErrorMessage, and a fire-and-forgetonError(error, { action, code, message })observer are set once onAuthProvider; any hook can override them or opt out withnull.- Sensitive operations reauthenticate when given
currentPassword, and work without it for OAuth-only accounts.
Zero dependencies —
firebaseandreactare peers. Ships ESM and CJS with type declarations and a"use client"banner.