react-query-firebase 1.3.3 → 2.0.0-rc2
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/src/analytics/useAnalytics.d.ts +1 -1
- package/dist/src/analytics/useLogEvent.js +1 -1
- package/dist/src/analytics/useSetAnalyticsCollectionEnabled.js +1 -1
- package/dist/src/auth/index.d.ts +0 -1
- package/dist/src/auth/index.js +0 -1
- package/dist/src/auth/useAuth.d.ts +1 -1
- package/dist/src/auth/useCreateUserWitEmailAndPasswordMutation.d.ts +5 -5
- package/dist/src/auth/useCreateUserWitEmailAndPasswordMutation.js +3 -3
- package/dist/src/auth/useCurrentUser.d.ts +1 -1
- package/dist/src/auth/useCurrentUser.js +4 -4
- package/dist/src/auth/useIdToken.js +1 -1
- package/dist/src/auth/useReauthenticateWitCredentialMutation.d.ts +7 -7
- package/dist/src/auth/useReauthenticateWitCredentialMutation.js +3 -3
- package/dist/src/auth/useReauthenticateWitRedirectMutation.d.ts +7 -7
- package/dist/src/auth/useReauthenticateWitRedirectMutation.js +3 -3
- package/dist/src/auth/useSendEmailVerificationMutation.d.ts +6 -6
- package/dist/src/auth/useSendEmailVerificationMutation.js +3 -3
- package/dist/src/auth/useSignInWitEmailAndPasswordMutation.d.ts +4 -4
- package/dist/src/auth/useSignInWitEmailAndPasswordMutation.js +2 -2
- package/dist/src/auth/useSignInWitRedirectMutation.d.ts +6 -6
- package/dist/src/auth/useSignInWitRedirectMutation.js +3 -3
- package/dist/src/auth/useSignOutMutation.d.ts +4 -4
- package/dist/src/auth/useSignOutMutation.js +3 -3
- package/dist/src/auth/useUpdateProfileMutation.d.ts +6 -6
- package/dist/src/auth/useUpdateProfileMutation.js +3 -3
- package/dist/src/context/FirebaseContext.d.ts +6 -10
- package/dist/src/context/FirebaseContextProvider.d.ts +25 -7
- package/dist/src/context/FirebaseContextProvider.js +41 -41
- package/dist/src/firestore/useAddDocMutation.d.ts +7 -9
- package/dist/src/firestore/useAddDocMutation.js +4 -5
- package/dist/src/firestore/useBatchWrite.d.ts +5 -5
- package/dist/src/firestore/useBatchWrite.js +1 -1
- package/dist/src/firestore/useCollectionReference.d.ts +5 -5
- package/dist/src/firestore/useCollectionReference.js +3 -5
- package/dist/src/firestore/useCompositeFilter.d.ts +7 -6
- package/dist/src/firestore/useCompositeFilter.js +12 -9
- package/dist/src/firestore/useCountQuery.d.ts +7 -7
- package/dist/src/firestore/useCountQuery.js +3 -3
- package/dist/src/firestore/useDeleteDocMutation.d.ts +6 -6
- package/dist/src/firestore/useDeleteDocMutation.js +1 -1
- package/dist/src/firestore/useDocReference.d.ts +6 -6
- package/dist/src/firestore/useDocReference.js +6 -10
- package/dist/src/firestore/useDocReferences.d.ts +6 -6
- package/dist/src/firestore/useDocReferences.js +4 -6
- package/dist/src/firestore/useFirestore.d.ts +1 -1
- package/dist/src/firestore/useGetDocData.d.ts +5 -5
- package/dist/src/firestore/useGetRealtimeDocData.d.ts +7 -7
- package/dist/src/firestore/useGetRealtimeDocData.js +1 -1
- package/dist/src/firestore/useInfiniteQuery.d.ts +5 -6
- package/dist/src/firestore/useInfiniteQuery.js +3 -3
- package/dist/src/firestore/useQuery.d.ts +7 -8
- package/dist/src/firestore/useQuery.js +5 -5
- package/dist/src/firestore/useRunTransaction.d.ts +5 -5
- package/dist/src/firestore/useRunTransaction.js +1 -1
- package/dist/src/firestore/useSetDocMutation.d.ts +7 -7
- package/dist/src/firestore/useSetDocMutation.js +2 -2
- package/dist/src/firestore/useUpdateDocMutation.d.ts +7 -8
- package/dist/src/firestore/useUpdateDocMutation.js +4 -4
- package/dist/src/firestore/utils/getDocData.d.ts +3 -3
- package/dist/src/firestore/utils/getDocData.js +1 -1
- package/dist/src/firestore/utils/getDocRef.d.ts +8 -8
- package/dist/src/firestore/utils/getDocRef.js +5 -9
- package/dist/src/firestore/utils/getDocSnap.d.ts +4 -4
- package/dist/src/firestore/utils/getDocSnap.js +2 -2
- package/dist/src/remoteConfig/useFetchAndActivate.js +1 -1
- package/dist/src/remoteConfig/useGetValue.d.ts +1 -1
- package/dist/src/remoteConfig/useGetValue.js +1 -1
- package/dist/src/remoteConfig/useRemoteConfig.d.ts +1 -1
- package/package.json +15 -5
- package/src/analytics/useLogEvent.ts +1 -1
- package/src/analytics/useSetAnalyticsCollectionEnabled.ts +1 -1
- package/src/auth/index.ts +0 -1
- package/src/auth/useCreateUserWitEmailAndPasswordMutation.ts +10 -5
- package/src/auth/useCurrentUser.ts +4 -4
- package/src/auth/useIdToken.ts +2 -2
- package/src/auth/useReauthenticateWitCredentialMutation.ts +12 -7
- package/src/auth/useReauthenticateWitRedirectMutation.ts +12 -7
- package/src/auth/useSendEmailVerificationMutation.ts +11 -6
- package/src/auth/useSignInWitEmailAndPasswordMutation.ts +9 -4
- package/src/auth/useSignInWitRedirectMutation.ts +11 -6
- package/src/auth/useSignOutMutation.ts +8 -5
- package/src/auth/useUpdateProfileMutation.ts +6 -6
- package/src/context/FirebaseContext.ts +6 -10
- package/src/context/FirebaseContextProvider.tsx +71 -44
- package/src/firestore/useAddDocMutation.ts +15 -22
- package/src/firestore/useBatchWrite.ts +7 -4
- package/src/firestore/useCollectionReference.ts +13 -9
- package/src/firestore/useCompositeFilter.ts +25 -30
- package/src/firestore/useCountQuery.ts +9 -13
- package/src/firestore/useDeleteDocMutation.ts +11 -10
- package/src/firestore/useDocReference.ts +23 -19
- package/src/firestore/useDocReferences.ts +15 -11
- package/src/firestore/useGetDocData.ts +14 -15
- package/src/firestore/useGetRealtimeDocData.ts +16 -10
- package/src/firestore/useInfiniteQuery.ts +9 -16
- package/src/firestore/useQuery.ts +11 -20
- package/src/firestore/useRunTransaction.ts +9 -4
- package/src/firestore/useSetDocMutation.ts +14 -11
- package/src/firestore/useUpdateDocMutation.ts +15 -21
- package/src/firestore/utils/getDocData.ts +7 -9
- package/src/firestore/utils/getDocRef.ts +13 -17
- package/src/firestore/utils/getDocSnap.ts +7 -9
- package/src/remoteConfig/useFetchAndActivate.ts +1 -1
- package/src/remoteConfig/useGetValue.ts +1 -1
- package/dist/src/auth/useAuthStateReady.d.ts +0 -6
- package/dist/src/auth/useAuthStateReady.js +0 -19
- package/src/auth/useAuthStateReady.ts +0 -24
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Hook to access Firebase analytics from the Firebase context.
|
|
3
3
|
* @returns {any} The analytics object from the Firebase context.
|
|
4
4
|
*/
|
|
5
|
-
export declare const useAnalytics: () => import("@firebase/analytics").
|
|
5
|
+
export declare const useAnalytics: () => import("@react-native-firebase/analytics").FirebaseAnalyticsTypes.Module;
|
package/dist/src/auth/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export * from "./useCreateUserWitEmailAndPasswordMutation";
|
|
|
4
4
|
export * from "./useSendEmailVerificationMutation";
|
|
5
5
|
export * from "./useSignInWitEmailAndPasswordMutation";
|
|
6
6
|
export * from "./useCurrentUser";
|
|
7
|
-
export * from "./useAuthStateReady";
|
|
8
7
|
export * from "./useSignInWitRedirectMutation";
|
|
9
8
|
export * from "./useUpdateProfileMutation";
|
|
10
9
|
export * from "./useSignOutMutation";
|
package/dist/src/auth/index.js
CHANGED
|
@@ -4,7 +4,6 @@ export * from "./useCreateUserWitEmailAndPasswordMutation";
|
|
|
4
4
|
export * from "./useSendEmailVerificationMutation";
|
|
5
5
|
export * from "./useSignInWitEmailAndPasswordMutation";
|
|
6
6
|
export * from "./useCurrentUser";
|
|
7
|
-
export * from "./useAuthStateReady";
|
|
8
7
|
export * from "./useSignInWitRedirectMutation";
|
|
9
8
|
export * from "./useUpdateProfileMutation";
|
|
10
9
|
export * from "./useSignOutMutation";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Custom hook to retrieve the authentication object from the Firebase context.
|
|
3
3
|
* @returns {Auth} The authentication object from the Firebase context.
|
|
4
4
|
*/
|
|
5
|
-
export declare const useAuth: () => import("firebase/auth").
|
|
5
|
+
export declare const useAuth: () => import("@react-native-firebase/auth").FirebaseAuthTypes.Module;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { FirebaseAuthTypes } from "@react-native-firebase/auth";
|
|
3
|
+
import { ReactNativeFirebase } from "@react-native-firebase/app";
|
|
4
4
|
export type UseCreateUserWitEmailAndPasswordMutationVariables = {
|
|
5
5
|
email: string;
|
|
6
6
|
password: string;
|
|
@@ -9,7 +9,7 @@ export type UseCreateUserWitEmailAndPasswordMutationVariables = {
|
|
|
9
9
|
* Custom hook to initiate a user creation process using email and password with Firebase authentication.
|
|
10
10
|
* This hook utilizes the `useMutation` functionality to support creating new user credentials asynchronously.
|
|
11
11
|
*
|
|
12
|
-
* @param {Omit<UseMutationOptions<UserCredential,
|
|
13
|
-
* @returns {UseMutationResult<UserCredential,
|
|
12
|
+
* @param {Omit<UseMutationOptions<FirebaseAuthTypes.UserCredential, ReactNativeFirebase.NativeFirebaseError, UseCreateUserWitEmailAndPasswordMutationVariables, TContext>, "mutationKey" | "mutationFn">} options - Optional settings to customize the mutation behavior, excluding `mutationKey` and `mutationFn`.
|
|
13
|
+
* @returns {UseMutationResult<FirebaseAuthTypes.UserCredential, ReactNativeFirebase.NativeFirebaseError, UseCreateUserWitEmailAndPasswordMutationVariables, TContext>} The result of the mutation which includes status, user credentials, and error information if any.
|
|
14
14
|
*/
|
|
15
|
-
export declare const useCreateUserWitEmailAndPasswordMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<UserCredential,
|
|
15
|
+
export declare const useCreateUserWitEmailAndPasswordMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<FirebaseAuthTypes.UserCredential, ReactNativeFirebase.NativeFirebaseError, UseCreateUserWitEmailAndPasswordMutationVariables, TContext>, "mutationKey" | "mutationFn">) => import("@tanstack/react-query").UseMutationResult<FirebaseAuthTypes.UserCredential, ReactNativeFirebase.NativeFirebaseError, UseCreateUserWitEmailAndPasswordMutationVariables, TContext>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
|
-
import { createUserWithEmailAndPassword } from "firebase/auth";
|
|
2
|
+
import { createUserWithEmailAndPassword } from "@react-native-firebase/auth";
|
|
3
3
|
import { useAuth } from "./useAuth";
|
|
4
4
|
import { CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY } from "./mutation-keys";
|
|
5
5
|
/**
|
|
6
6
|
* Custom hook to initiate a user creation process using email and password with Firebase authentication.
|
|
7
7
|
* This hook utilizes the `useMutation` functionality to support creating new user credentials asynchronously.
|
|
8
8
|
*
|
|
9
|
-
* @param {Omit<UseMutationOptions<UserCredential,
|
|
10
|
-
* @returns {UseMutationResult<UserCredential,
|
|
9
|
+
* @param {Omit<UseMutationOptions<FirebaseAuthTypes.UserCredential, ReactNativeFirebase.NativeFirebaseError, UseCreateUserWitEmailAndPasswordMutationVariables, TContext>, "mutationKey" | "mutationFn">} options - Optional settings to customize the mutation behavior, excluding `mutationKey` and `mutationFn`.
|
|
10
|
+
* @returns {UseMutationResult<FirebaseAuthTypes.UserCredential, ReactNativeFirebase.NativeFirebaseError, UseCreateUserWitEmailAndPasswordMutationVariables, TContext>} The result of the mutation which includes status, user credentials, and error information if any.
|
|
11
11
|
*/
|
|
12
12
|
export const useCreateUserWitEmailAndPasswordMutation = (options = {}) => {
|
|
13
13
|
const firebaseAuth = useAuth();
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* It listens for changes in the authentication state and updates the user accordingly.
|
|
4
4
|
* @returns {Object|null} The current authenticated user object or null if no user is authenticated.
|
|
5
5
|
*/
|
|
6
|
-
export declare const useCurrentUser: () => import("firebase/auth").User | null;
|
|
6
|
+
export declare const useCurrentUser: () => import("@react-native-firebase/auth").FirebaseAuthTypes.User | null;
|
|
@@ -6,15 +6,15 @@ import { useEffect, useState } from "react";
|
|
|
6
6
|
* @returns {Object|null} The current authenticated user object or null if no user is authenticated.
|
|
7
7
|
*/
|
|
8
8
|
export const useCurrentUser = () => {
|
|
9
|
-
const
|
|
10
|
-
const [currentUser, setCurrentUser] = useState(
|
|
9
|
+
const { onAuthStateChanged, currentUser: fbCurrentUser } = useAuth();
|
|
10
|
+
const [currentUser, setCurrentUser] = useState(fbCurrentUser);
|
|
11
11
|
useEffect(() => {
|
|
12
|
-
const unsubscribe =
|
|
12
|
+
const unsubscribe = onAuthStateChanged((user) => {
|
|
13
13
|
setCurrentUser(user);
|
|
14
14
|
});
|
|
15
15
|
return () => {
|
|
16
16
|
unsubscribe();
|
|
17
17
|
};
|
|
18
|
-
}, [currentUser?.uid
|
|
18
|
+
}, [currentUser?.uid, onAuthStateChanged]);
|
|
19
19
|
return currentUser;
|
|
20
20
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from "react";
|
|
2
2
|
import { useCurrentUser } from "./useCurrentUser";
|
|
3
|
-
import { onIdTokenChanged } from "firebase/auth";
|
|
3
|
+
import { onIdTokenChanged } from "@react-native-firebase/auth";
|
|
4
4
|
import { useAuth } from "./useAuth";
|
|
5
5
|
/**
|
|
6
6
|
* A hook to manage the ID token.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { FirebaseAuthTypes } from "@react-native-firebase/auth";
|
|
3
|
+
import { ReactNativeFirebase } from "@react-native-firebase/app";
|
|
4
4
|
export type UseReauthenticateWitCredentialMutationVariables = {
|
|
5
|
-
credential: AuthCredential;
|
|
6
|
-
user: User;
|
|
5
|
+
credential: FirebaseAuthTypes.AuthCredential;
|
|
6
|
+
user: FirebaseAuthTypes.User;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Custom hook to create a mutation for re-authenticating a user with a given credential.
|
|
10
10
|
* This hook utilizes useMutation from React Query to manage the asynchronous re-authentication
|
|
11
11
|
* process with Firebase credentials. It omits the default "mutationKey" and "mutationFn" options.
|
|
12
12
|
*
|
|
13
|
-
* @param {Omit<UseMutationOptions<UserCredential,
|
|
14
|
-
* @returns {UseMutationResult<UserCredential,
|
|
13
|
+
* @param {Omit<UseMutationOptions<FirebaseAuthTypes.UserCredential, ReactNativeFirebase.NativeFirebaseError, UseReauthenticateWitCredentialMutationVariables, TContext>, "mutationKey" | "mutationFn">} options - Optional mutation options excluding "mutationKey" and "mutationFn".
|
|
14
|
+
* @returns {UseMutationResult<FirebaseAuthTypes.UserCredential, ReactNativeFirebase.NativeFirebaseError, UseReauthenticateWitCredentialMutationVariables, TContext>} A useMutation result object managing the loading, error, and result state of the re-authentication mutation.
|
|
15
15
|
*/
|
|
16
|
-
export declare const useReauthenticateWitCredentialMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<UserCredential,
|
|
16
|
+
export declare const useReauthenticateWitCredentialMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<FirebaseAuthTypes.UserCredential, ReactNativeFirebase.NativeFirebaseError, UseReauthenticateWitCredentialMutationVariables, TContext>, "mutationKey" | "mutationFn">) => import("@tanstack/react-query").UseMutationResult<FirebaseAuthTypes.UserCredential, ReactNativeFirebase.NativeFirebaseError, UseReauthenticateWitCredentialMutationVariables, TContext>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
|
-
import { reauthenticateWithCredential } from "firebase/auth";
|
|
2
|
+
import { reauthenticateWithCredential } from "@react-native-firebase/auth";
|
|
3
3
|
import { REAUTHENTICATE_WITH_CREDENTIAL_MUTATION_KEY } from "./mutation-keys";
|
|
4
4
|
/**
|
|
5
5
|
* Custom hook to create a mutation for re-authenticating a user with a given credential.
|
|
6
6
|
* This hook utilizes useMutation from React Query to manage the asynchronous re-authentication
|
|
7
7
|
* process with Firebase credentials. It omits the default "mutationKey" and "mutationFn" options.
|
|
8
8
|
*
|
|
9
|
-
* @param {Omit<UseMutationOptions<UserCredential,
|
|
10
|
-
* @returns {UseMutationResult<UserCredential,
|
|
9
|
+
* @param {Omit<UseMutationOptions<FirebaseAuthTypes.UserCredential, ReactNativeFirebase.NativeFirebaseError, UseReauthenticateWitCredentialMutationVariables, TContext>, "mutationKey" | "mutationFn">} options - Optional mutation options excluding "mutationKey" and "mutationFn".
|
|
10
|
+
* @returns {UseMutationResult<FirebaseAuthTypes.UserCredential, ReactNativeFirebase.NativeFirebaseError, UseReauthenticateWitCredentialMutationVariables, TContext>} A useMutation result object managing the loading, error, and result state of the re-authentication mutation.
|
|
11
11
|
*/
|
|
12
12
|
export const useReauthenticateWitCredentialMutation = (options = {}) => {
|
|
13
13
|
return useMutation({
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { FirebaseAuthTypes, PopupRedirectResolver } from "@react-native-firebase/auth";
|
|
3
|
+
import { ReactNativeFirebase } from "@react-native-firebase/app";
|
|
4
4
|
export type UseReauthenticateWitRedirectMutationVariables = {
|
|
5
|
-
authProvider: AuthProvider;
|
|
5
|
+
authProvider: FirebaseAuthTypes.AuthProvider;
|
|
6
6
|
popupRedirectResolver?: PopupRedirectResolver;
|
|
7
|
-
user: User;
|
|
7
|
+
user: FirebaseAuthTypes.User;
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* Custom hook that provides a mutation to reauthenticate a user with a given authentication provider using redirection.
|
|
11
11
|
* This hook uses the `useMutation` hook from the React Query library to handle async mutation logic.
|
|
12
12
|
*
|
|
13
|
-
* @param {Omit<UseMutationOptions<void,
|
|
13
|
+
* @param {Omit<UseMutationOptions<void, ReactNativeFirebase.NativeFirebaseError, UseReauthenticateWitRedirectMutationVariables, TContext>, "mutationKey" | "mutationFn">} options - Optional configuration object for the mutation. It provides the ability to pass options to customize the behavior of the mutation.
|
|
14
14
|
* @template TContext - The type of any additional context you wish to pass to the mutation.
|
|
15
|
-
* @returns {UseMutationResult<void,
|
|
15
|
+
* @returns {UseMutationResult<void, ReactNativeFirebase.NativeFirebaseError, UseReauthenticateWitRedirectMutationVariables, TContext>} A mutation result object containing methods and state of the mutation.
|
|
16
16
|
*/
|
|
17
|
-
export declare const useReauthenticateWitRedirectMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<void,
|
|
17
|
+
export declare const useReauthenticateWitRedirectMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<void, ReactNativeFirebase.NativeFirebaseError, UseReauthenticateWitRedirectMutationVariables, TContext>, "mutationKey" | "mutationFn">) => import("@tanstack/react-query").UseMutationResult<void, ReactNativeFirebase.NativeFirebaseError, UseReauthenticateWitRedirectMutationVariables, TContext>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
|
-
import { reauthenticateWithRedirect } from "firebase/auth";
|
|
2
|
+
import { reauthenticateWithRedirect } from "@react-native-firebase/auth";
|
|
3
3
|
import { REAUTHENTICATE_WITH_REDIRECT_MUTATION_KEY } from "./mutation-keys";
|
|
4
4
|
/**
|
|
5
5
|
* Custom hook that provides a mutation to reauthenticate a user with a given authentication provider using redirection.
|
|
6
6
|
* This hook uses the `useMutation` hook from the React Query library to handle async mutation logic.
|
|
7
7
|
*
|
|
8
|
-
* @param {Omit<UseMutationOptions<void,
|
|
8
|
+
* @param {Omit<UseMutationOptions<void, ReactNativeFirebase.NativeFirebaseError, UseReauthenticateWitRedirectMutationVariables, TContext>, "mutationKey" | "mutationFn">} options - Optional configuration object for the mutation. It provides the ability to pass options to customize the behavior of the mutation.
|
|
9
9
|
* @template TContext - The type of any additional context you wish to pass to the mutation.
|
|
10
|
-
* @returns {UseMutationResult<void,
|
|
10
|
+
* @returns {UseMutationResult<void, ReactNativeFirebase.NativeFirebaseError, UseReauthenticateWitRedirectMutationVariables, TContext>} A mutation result object containing methods and state of the mutation.
|
|
11
11
|
*/
|
|
12
12
|
export const useReauthenticateWitRedirectMutation = (options = {}) => {
|
|
13
13
|
return useMutation({
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { FirebaseAuthTypes } from "@react-native-firebase/auth";
|
|
3
|
+
import { ReactNativeFirebase } from "@react-native-firebase/app";
|
|
4
4
|
export type UseSendEmailVerificationMutationVariables = {
|
|
5
|
-
user: User;
|
|
5
|
+
user: FirebaseAuthTypes.User;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
8
|
* A custom hook to create a mutation for sending an email verification to a user using Firebase.
|
|
9
9
|
* This uses the `useMutation` hook from a query library and wraps it with specific configuration options.
|
|
10
|
-
* @param {Omit<UseMutationOptions<void,
|
|
11
|
-
* @returns {UseMutationResult<void,
|
|
10
|
+
* @param {Omit<UseMutationOptions<void, ReactNativeFirebase.NativeReactNativeFirebase.NativeFirebaseError, UseSendEmailVerificationMutationVariables, TContext>, "queryKey" | "queryFn">} options - Configuration options for the mutation, excluding `queryKey` and `queryFn`.
|
|
11
|
+
* @returns {UseMutationResult<void, NativeReactNativeFirebase.NativeFirebaseError, UseSendEmailVerificationMutationVariables, TContext>} An object containing mutation state and functions for managing the mutation lifecycle.
|
|
12
12
|
*/
|
|
13
|
-
export declare const useSendEmailVerificationMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<void,
|
|
13
|
+
export declare const useSendEmailVerificationMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<void, ReactNativeFirebase.NativeFirebaseError, UseSendEmailVerificationMutationVariables, TContext>, "queryKey" | "queryFn">) => import("@tanstack/react-query").UseMutationResult<void, ReactNativeFirebase.NativeFirebaseError, UseSendEmailVerificationMutationVariables, TContext>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
|
-
import { sendEmailVerification } from "firebase/auth";
|
|
2
|
+
import { sendEmailVerification } from "@react-native-firebase/auth";
|
|
3
3
|
import { SEND_EMAIL_VERIFICATION_MUTATION_KEY } from "./mutation-keys";
|
|
4
4
|
/**
|
|
5
5
|
* A custom hook to create a mutation for sending an email verification to a user using Firebase.
|
|
6
6
|
* This uses the `useMutation` hook from a query library and wraps it with specific configuration options.
|
|
7
|
-
* @param {Omit<UseMutationOptions<void,
|
|
8
|
-
* @returns {UseMutationResult<void,
|
|
7
|
+
* @param {Omit<UseMutationOptions<void, ReactNativeFirebase.NativeReactNativeFirebase.NativeFirebaseError, UseSendEmailVerificationMutationVariables, TContext>, "queryKey" | "queryFn">} options - Configuration options for the mutation, excluding `queryKey` and `queryFn`.
|
|
8
|
+
* @returns {UseMutationResult<void, NativeReactNativeFirebase.NativeFirebaseError, UseSendEmailVerificationMutationVariables, TContext>} An object containing mutation state and functions for managing the mutation lifecycle.
|
|
9
9
|
*/
|
|
10
10
|
export const useSendEmailVerificationMutation = (options = {}) => {
|
|
11
11
|
return useMutation({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { FirebaseAuthTypes } from "@react-native-firebase/auth";
|
|
3
|
+
import { ReactNativeFirebase } from "@react-native-firebase/app";
|
|
4
4
|
export type UseSignInWitEmailAndPasswordMutationVariables = {
|
|
5
5
|
email: string;
|
|
6
6
|
password: string;
|
|
@@ -9,7 +9,7 @@ export type UseSignInWitEmailAndPasswordMutationVariables = {
|
|
|
9
9
|
* Custom hook to perform a sign-in operation using email and password with Firebase Authentication.
|
|
10
10
|
* It utilizes the `useMutation` hook to manage the asynchronous operation and its state.
|
|
11
11
|
*
|
|
12
|
-
* @param {Omit<UseMutationOptions<UserCredential,
|
|
12
|
+
* @param {Omit<UseMutationOptions<FirebaseAuthTypes.UserCredential, ReactNativeFirebase.NativeFirebaseError, UseSignInWitEmailAndPasswordMutationVariables, TContext>, 'mutationKey' | 'mutationFn'>} options - Options to configure the mutation, excluding 'mutationKey' and 'mutationFn'.
|
|
13
13
|
* @returns {MutationResult} A mutation object containing the result of the sign-in process and helper functions.
|
|
14
14
|
*/
|
|
15
|
-
export declare const useSignInWitEmailAndPasswordMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<UserCredential,
|
|
15
|
+
export declare const useSignInWitEmailAndPasswordMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<FirebaseAuthTypes.UserCredential, ReactNativeFirebase.NativeFirebaseError, UseSignInWitEmailAndPasswordMutationVariables, TContext>, "mutationKey" | "mutationFn">) => import("@tanstack/react-query").UseMutationResult<FirebaseAuthTypes.UserCredential, ReactNativeFirebase.NativeFirebaseError, UseSignInWitEmailAndPasswordMutationVariables, TContext>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
|
-
import { signInWithEmailAndPassword } from "firebase/auth";
|
|
2
|
+
import { signInWithEmailAndPassword } from "@react-native-firebase/auth";
|
|
3
3
|
import { useAuth } from "./useAuth";
|
|
4
4
|
import { SIGN_IN_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY } from "./mutation-keys";
|
|
5
5
|
/**
|
|
6
6
|
* Custom hook to perform a sign-in operation using email and password with Firebase Authentication.
|
|
7
7
|
* It utilizes the `useMutation` hook to manage the asynchronous operation and its state.
|
|
8
8
|
*
|
|
9
|
-
* @param {Omit<UseMutationOptions<UserCredential,
|
|
9
|
+
* @param {Omit<UseMutationOptions<FirebaseAuthTypes.UserCredential, ReactNativeFirebase.NativeFirebaseError, UseSignInWitEmailAndPasswordMutationVariables, TContext>, 'mutationKey' | 'mutationFn'>} options - Options to configure the mutation, excluding 'mutationKey' and 'mutationFn'.
|
|
10
10
|
* @returns {MutationResult} A mutation object containing the result of the sign-in process and helper functions.
|
|
11
11
|
*/
|
|
12
12
|
export const useSignInWitEmailAndPasswordMutation = (options = {}) => {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { FirebaseAuthTypes, PopupRedirectResolver } from "@react-native-firebase/auth";
|
|
3
|
+
import { ReactNativeFirebase } from "@react-native-firebase/app";
|
|
4
4
|
export type UseSignInWitRedirectMutationVariables = {
|
|
5
|
-
authProvider: AuthProvider;
|
|
5
|
+
authProvider: FirebaseAuthTypes.AuthProvider;
|
|
6
6
|
popupRedirectResolver?: PopupRedirectResolver;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Custom hook for handling Firebase authentication using sign-in with redirect functionality.
|
|
10
10
|
* This hook utilizes the `useMutation` mechanism to perform the sign-in operation.
|
|
11
|
-
* @param {Omit<UseMutationOptions<void,
|
|
12
|
-
* @returns {UseMutationResult<void,
|
|
11
|
+
* @param {Omit<UseMutationOptions<void, ReactNativeFirebase.NativeFirebaseError, UseSignInWitRedirectMutationVariables, TContext>, "mutationKey" | "mutationFn">} options - Optional configurations for the mutation, omitting the mutationKey and mutationFn properties.
|
|
12
|
+
* @returns {UseMutationResult<void, ReactNativeFirebase.NativeFirebaseError, UseSignInWitRedirectMutationVariables, TContext>} The result object from the useMutation hook, containing the mutation function and its current state.
|
|
13
13
|
*/
|
|
14
|
-
export declare const useSignInWitRedirectMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<void,
|
|
14
|
+
export declare const useSignInWitRedirectMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<void, ReactNativeFirebase.NativeFirebaseError, UseSignInWitRedirectMutationVariables, TContext>, "mutationKey" | "mutationFn">) => import("@tanstack/react-query").UseMutationResult<void, ReactNativeFirebase.NativeFirebaseError, UseSignInWitRedirectMutationVariables, TContext>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
|
-
import { signInWithRedirect } from "firebase/auth";
|
|
2
|
+
import { signInWithRedirect } from "@react-native-firebase/auth";
|
|
3
3
|
import { useAuth } from "./useAuth";
|
|
4
4
|
import { SIGN_IN_WITH_REDIRECT_MUTATION_KEY } from "./mutation-keys";
|
|
5
5
|
/**
|
|
6
6
|
* Custom hook for handling Firebase authentication using sign-in with redirect functionality.
|
|
7
7
|
* This hook utilizes the `useMutation` mechanism to perform the sign-in operation.
|
|
8
|
-
* @param {Omit<UseMutationOptions<void,
|
|
9
|
-
* @returns {UseMutationResult<void,
|
|
8
|
+
* @param {Omit<UseMutationOptions<void, ReactNativeFirebase.NativeFirebaseError, UseSignInWitRedirectMutationVariables, TContext>, "mutationKey" | "mutationFn">} options - Optional configurations for the mutation, omitting the mutationKey and mutationFn properties.
|
|
9
|
+
* @returns {UseMutationResult<void, ReactNativeFirebase.NativeFirebaseError, UseSignInWitRedirectMutationVariables, TContext>} The result object from the useMutation hook, containing the mutation function and its current state.
|
|
10
10
|
*/
|
|
11
11
|
export const useSignInWitRedirectMutation = (options = {}) => {
|
|
12
12
|
const firebaseAuth = useAuth();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import {
|
|
2
|
+
import { ReactNativeFirebase } from "@react-native-firebase/app";
|
|
3
3
|
/**
|
|
4
4
|
* Custom hook for handling the sign-out mutation using Firebase authentication.
|
|
5
5
|
* It wraps the useMutation hook to provide a sign-out function with Firebase.
|
|
6
6
|
*
|
|
7
|
-
* @param {Omit<UseMutationOptions<void,
|
|
8
|
-
* @returns {UseMutationResult<void,
|
|
7
|
+
* @param {Omit<UseMutationOptions<void, ReactNativeFirebase.NativeFirebaseError, void, TContext>, "queryKey" | "queryFn">} options - Configuration options for the mutation, excluding "queryKey" and "queryFn".
|
|
8
|
+
* @returns {UseMutationResult<void, ReactNativeFirebase.NativeFirebaseError, void, TContext>} A mutation object for handling the sign-out process, including methods for mutating and state tracking.
|
|
9
9
|
*/
|
|
10
|
-
export declare const useSignOutMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<void,
|
|
10
|
+
export declare const useSignOutMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<void, ReactNativeFirebase.NativeFirebaseError, void, TContext>, "queryKey" | "queryFn">) => import("@tanstack/react-query").UseMutationResult<void, ReactNativeFirebase.NativeFirebaseError, void, TContext>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
|
-
import { signOut } from "firebase/auth";
|
|
2
|
+
import { signOut } from "@react-native-firebase/auth";
|
|
3
3
|
import { SIGN_OUT_MUTATION_KEY } from "./mutation-keys";
|
|
4
4
|
import { useAuth } from "./useAuth";
|
|
5
5
|
/**
|
|
6
6
|
* Custom hook for handling the sign-out mutation using Firebase authentication.
|
|
7
7
|
* It wraps the useMutation hook to provide a sign-out function with Firebase.
|
|
8
8
|
*
|
|
9
|
-
* @param {Omit<UseMutationOptions<void,
|
|
10
|
-
* @returns {UseMutationResult<void,
|
|
9
|
+
* @param {Omit<UseMutationOptions<void, ReactNativeFirebase.NativeFirebaseError, void, TContext>, "queryKey" | "queryFn">} options - Configuration options for the mutation, excluding "queryKey" and "queryFn".
|
|
10
|
+
* @returns {UseMutationResult<void, ReactNativeFirebase.NativeFirebaseError, void, TContext>} A mutation object for handling the sign-out process, including methods for mutating and state tracking.
|
|
11
11
|
*/
|
|
12
12
|
export const useSignOutMutation = (options = {}) => {
|
|
13
13
|
const firebaseAuth = useAuth();
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { FirebaseAuthTypes } from "@react-native-firebase/auth";
|
|
3
|
+
import { ReactNativeFirebase } from "@react-native-firebase/app";
|
|
4
4
|
export type UseUpdateProfileMutationVariables = {
|
|
5
5
|
displayName?: string;
|
|
6
|
-
user: User;
|
|
6
|
+
user: FirebaseAuthTypes.User;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Custom hook to manage the mutation for updating a user's profile.
|
|
10
10
|
* Utilizes Firebase for updating the user's display name.
|
|
11
11
|
*
|
|
12
|
-
* @param {Omit<UseMutationOptions<void,
|
|
13
|
-
* @returns {UseMutationResult<void,
|
|
12
|
+
* @param {Omit<UseMutationOptions<void, ReactNativeFirebase.NativeFirebaseError, UseUpdateProfileMutationVariables, TContext>, "mutationKey" | "mutationFn">} options - Configuration options for the mutation, excluding mutationKey and mutationFn.
|
|
13
|
+
* @returns {UseMutationResult<void, ReactNativeFirebase.NativeFirebaseError, UseUpdateProfileMutationVariables, TContext>} The result of the mutation operation including statuses, data, and error information.
|
|
14
14
|
*/
|
|
15
|
-
export declare const useUpdateProfileMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<void,
|
|
15
|
+
export declare const useUpdateProfileMutation: <TContext = unknown>(options?: Omit<UseMutationOptions<void, ReactNativeFirebase.NativeFirebaseError, UseUpdateProfileMutationVariables, TContext>, "mutationKey" | "mutationFn">) => import("@tanstack/react-query").UseMutationResult<void, ReactNativeFirebase.NativeFirebaseError, UseUpdateProfileMutationVariables, TContext>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
|
-
import { updateProfile } from "firebase/auth";
|
|
2
|
+
import { updateProfile } from "@react-native-firebase/auth";
|
|
3
3
|
import { CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY } from "./mutation-keys";
|
|
4
4
|
/**
|
|
5
5
|
* Custom hook to manage the mutation for updating a user's profile.
|
|
6
6
|
* Utilizes Firebase for updating the user's display name.
|
|
7
7
|
*
|
|
8
|
-
* @param {Omit<UseMutationOptions<void,
|
|
9
|
-
* @returns {UseMutationResult<void,
|
|
8
|
+
* @param {Omit<UseMutationOptions<void, ReactNativeFirebase.NativeFirebaseError, UseUpdateProfileMutationVariables, TContext>, "mutationKey" | "mutationFn">} options - Configuration options for the mutation, excluding mutationKey and mutationFn.
|
|
9
|
+
* @returns {UseMutationResult<void, ReactNativeFirebase.NativeFirebaseError, UseUpdateProfileMutationVariables, TContext>} The result of the mutation operation including statuses, data, and error information.
|
|
10
10
|
*/
|
|
11
11
|
export const useUpdateProfileMutation = (options = {}) => {
|
|
12
12
|
return useMutation({
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Analytics } from "firebase/analytics";
|
|
3
|
-
import { Firestore } from "firebase/firestore";
|
|
4
|
-
import { FirebaseApp } from "firebase/app";
|
|
5
|
-
import { RemoteConfig } from "firebase/remote-config";
|
|
1
|
+
import { firebase } from "@react-native-firebase/auth";
|
|
6
2
|
type FirebaseContextValue = {
|
|
7
|
-
auth:
|
|
8
|
-
analytics:
|
|
9
|
-
firebase:
|
|
10
|
-
remoteConfig:
|
|
11
|
-
firestore:
|
|
3
|
+
auth: ReturnType<typeof firebase.auth>;
|
|
4
|
+
analytics: ReturnType<typeof firebase.analytics>;
|
|
5
|
+
firebase: ReturnType<typeof firebase.app>;
|
|
6
|
+
remoteConfig: ReturnType<typeof firebase.remoteConfig>;
|
|
7
|
+
firestore: ReturnType<typeof firebase.firestore>;
|
|
12
8
|
};
|
|
13
9
|
/**
|
|
14
10
|
* FirebaseContext is a shared context across children that provides access to firebase features
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { FirebaseAnalyticsTypes } from "@react-native-firebase/analytics";
|
|
3
|
+
import { FirebaseRemoteConfigTypes } from "@react-native-firebase/remote-config";
|
|
4
|
+
import { ReactNativeFirebase } from "@react-native-firebase/app";
|
|
5
|
+
/**
|
|
6
|
+
* @inline
|
|
7
|
+
* @see https://firebase.google.com/docs/reference/js/firestore_.firestoresettings
|
|
8
|
+
*/
|
|
9
|
+
export type FirestoreSettings = {
|
|
10
|
+
cacheSizeBytes?: number;
|
|
11
|
+
experimentalAutoDetectLongPolling?: boolean;
|
|
12
|
+
experimentalForceLongPolling?: boolean;
|
|
13
|
+
experimentalLongPollingOptions?: {
|
|
14
|
+
timeoutSeconds: number;
|
|
15
|
+
};
|
|
16
|
+
host?: string;
|
|
17
|
+
ignoreUndefinedProperties?: boolean;
|
|
18
|
+
localCache?: {
|
|
19
|
+
kind: "memory" | "persistent";
|
|
20
|
+
};
|
|
21
|
+
ssl?: boolean;
|
|
22
|
+
};
|
|
6
23
|
/**
|
|
7
24
|
* @inline
|
|
8
25
|
*/
|
|
@@ -42,6 +59,7 @@ export type FirebaseContextProviderEmulators = {
|
|
|
42
59
|
* @inline
|
|
43
60
|
*/
|
|
44
61
|
export type FirebaseContextProviderProps = PropsWithChildren & {
|
|
62
|
+
platform: "Web" | "ReactNative";
|
|
45
63
|
/**
|
|
46
64
|
* Defines configuration for firebase emulators
|
|
47
65
|
*/
|
|
@@ -49,7 +67,7 @@ export type FirebaseContextProviderProps = PropsWithChildren & {
|
|
|
49
67
|
/**
|
|
50
68
|
* Configuration options for Firebase initialization. {@link https://firebase.google.com/docs/web/setup#config-object | Learn about the Firebase config object}
|
|
51
69
|
*/
|
|
52
|
-
options:
|
|
70
|
+
options: ReactNativeFirebase.FirebaseAppOptions;
|
|
53
71
|
/**
|
|
54
72
|
* Flag indicating whether Firebase Auth should be enabled.
|
|
55
73
|
*/
|
|
@@ -71,7 +89,7 @@ export type FirebaseContextProviderProps = PropsWithChildren & {
|
|
|
71
89
|
* security_storage: "denied"
|
|
72
90
|
* }
|
|
73
91
|
*/
|
|
74
|
-
consentSettings?: ConsentSettings;
|
|
92
|
+
consentSettings?: FirebaseAnalyticsTypes.ConsentSettings;
|
|
75
93
|
/**
|
|
76
94
|
* Specifies custom configurations for your Cloud Firestore instance.
|
|
77
95
|
* You must set these before invoking any other methods.
|
|
@@ -88,7 +106,7 @@ export type FirebaseContextProviderProps = PropsWithChildren & {
|
|
|
88
106
|
* Configuration options for Firebase Remote Config Settings. {@link https://firebase.google.com/docs/reference/js/remote-config.remoteconfigsettings | Learn about the Firebase Remote COnfig Settings object}
|
|
89
107
|
* @defaultValue `true`
|
|
90
108
|
*/
|
|
91
|
-
remoteConfigSettings?:
|
|
109
|
+
remoteConfigSettings?: FirebaseRemoteConfigTypes.ConfigSettings;
|
|
92
110
|
/**
|
|
93
111
|
* Configuration options for Firebase Remote Config Defaults.
|
|
94
112
|
*/
|