react-query-firebase 2.13.3 → 2.13.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/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/react-native/analytics/index.d.ts +3 -0
- package/dist/react-native/analytics/index.js +3 -0
- package/{react-native/analytics/useAnalytics.ts → dist/react-native/analytics/useAnalytics.js} +1 -3
- package/{react-native → dist/react-native}/analytics/useLogEvent.js +1 -1
- package/{react-native → dist/react-native}/analytics/useSetAnalyticsCollectionEnabled.js +1 -1
- package/dist/react-native/auth/index.d.ts +19 -0
- package/dist/react-native/auth/index.js +19 -0
- package/{react-native/auth/useAuth.ts → dist/react-native/auth/useAuth.js} +1 -3
- package/{react-native → dist/react-native}/auth/useAuthStateReady.js +1 -1
- package/{react-native → dist/react-native}/auth/useCreateUserWitEmailAndPasswordMutation.js +2 -2
- package/{react-native → dist/react-native}/auth/useCurrentUser.js +1 -1
- package/{react-native → dist/react-native}/auth/useIdToken.js +2 -2
- package/{react-native → dist/react-native}/auth/useLinkWithCredentialMutation.js +1 -1
- package/{react-native → dist/react-native}/auth/useReauthenticateWitCredentialMutation.js +1 -1
- package/{react-native → dist/react-native}/auth/useReauthenticateWitRedirectMutation.js +1 -1
- package/{react-native → dist/react-native}/auth/useSendEmailVerificationMutation.js +1 -1
- package/{react-native → dist/react-native}/auth/useSignInAnonymouslyMutation.js +2 -2
- package/{react-native → dist/react-native}/auth/useSignInWitEmailAndPasswordMutation.js +2 -2
- package/{react-native → dist/react-native}/auth/useSignInWitRedirectMutation.js +2 -2
- package/{react-native → dist/react-native}/auth/useSignInWithCredentialMutation.js +2 -2
- package/{react-native → dist/react-native}/auth/useSignOutMutation.js +2 -2
- package/{react-native → dist/react-native}/auth/useUpdateProfileMutation.js +1 -1
- package/{react-native → dist/react-native}/context/FirebaseContextProvider.js +1 -1
- package/dist/react-native/context/index.d.ts +1 -0
- package/dist/react-native/context/index.js +1 -0
- package/dist/react-native/firestore/index.d.ts +23 -0
- package/dist/react-native/firestore/index.js +23 -0
- package/{react-native → dist/react-native}/firestore/useAddDocMutation.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/useBatchWrite.js +1 -1
- package/{react-native → dist/react-native}/firestore/useCollectionReference.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/useCollectionReference.js +1 -1
- package/{react-native → dist/react-native}/firestore/useCompositeFilter.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/useCompositeFilter.js +1 -1
- package/{react-native → dist/react-native}/firestore/useCountQuery.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/useDeleteDocMutation.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/useDocReference.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/useDocReference.js +2 -2
- package/{react-native → dist/react-native}/firestore/useDocReferences.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/useDocReferences.js +2 -2
- package/{web → dist/react-native}/firestore/useEnsureDoc.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/useEnsureDoc.js +3 -3
- package/{react-native/firestore/useFirestore.ts → dist/react-native/firestore/useFirestore.js} +1 -2
- package/{react-native → dist/react-native}/firestore/useGetDocData.d.ts +2 -2
- package/{web → dist/react-native}/firestore/useGetDocData.js +2 -2
- package/{react-native → dist/react-native}/firestore/useGetRealtimeDocData.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/useGetRealtimeDocData.js +1 -1
- package/{react-native → dist/react-native}/firestore/useInfiniteQuery.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/useQuery.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/useQueryConstraints.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/useQueryConstraints.js +1 -1
- package/{react-native → dist/react-native}/firestore/useRunTransaction.js +1 -1
- package/{react-native → dist/react-native}/firestore/useSetDocMutation.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/useUpdateDocMutation.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/utils/buildCompositeFilter.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/utils/buildQueryConstraint.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/utils/getDocData.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/utils/getDocData.js +1 -1
- package/{react-native → dist/react-native}/firestore/utils/getDocRef.d.ts +1 -1
- package/{react-native → dist/react-native}/firestore/utils/getDocSnap.d.ts +2 -2
- package/{react-native → dist/react-native}/firestore/utils/getDocSnap.js +1 -1
- package/dist/react-native/index.d.ts +1 -0
- package/dist/react-native/index.js +1 -0
- package/dist/react-native/remoteConfig/index.d.ts +3 -0
- package/dist/react-native/remoteConfig/index.js +3 -0
- package/{react-native → dist/react-native}/remoteConfig/useFetchAndActivate.js +1 -1
- package/{react-native → dist/react-native}/remoteConfig/useGetValue.js +1 -1
- package/{react-native/remoteConfig/useRemoteConfig.ts → dist/react-native/remoteConfig/useRemoteConfig.js} +1 -2
- package/{types → dist/types}/QueryConstraints.d.ts +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/web/analytics/index.d.ts +3 -0
- package/dist/web/analytics/index.js +3 -0
- package/{web/analytics/useAnalytics.ts → dist/web/analytics/useAnalytics.js} +1 -3
- package/{web → dist/web}/analytics/useLogEvent.js +1 -1
- package/{web → dist/web}/analytics/useSetAnalyticsCollectionEnabled.js +1 -1
- package/dist/web/auth/index.d.ts +20 -0
- package/dist/web/auth/index.js +20 -0
- package/{web/auth/useAuth.ts → dist/web/auth/useAuth.js} +1 -3
- package/{web → dist/web}/auth/useAuthStateReady.js +1 -1
- package/{web → dist/web}/auth/useCreateUserWitEmailAndPasswordMutation.js +2 -2
- package/{web → dist/web}/auth/useCurrentUser.js +1 -1
- package/{web → dist/web}/auth/useGetRedirectResultMutation.js +2 -2
- package/{web → dist/web}/auth/useIdToken.js +2 -2
- package/{web → dist/web}/auth/useLinkWithCredentialMutation.js +1 -1
- package/{web → dist/web}/auth/useReauthenticateWitCredentialMutation.js +1 -1
- package/{web → dist/web}/auth/useReauthenticateWitRedirectMutation.js +1 -1
- package/{web → dist/web}/auth/useSendEmailVerificationMutation.js +1 -1
- package/{web → dist/web}/auth/useSignInAnonymouslyMutation.js +2 -2
- package/{web → dist/web}/auth/useSignInWitEmailAndPasswordMutation.js +2 -2
- package/{web → dist/web}/auth/useSignInWitRedirectMutation.js +2 -2
- package/{web → dist/web}/auth/useSignInWithCredentialMutation.js +2 -2
- package/{web → dist/web}/auth/useSignOutMutation.js +2 -2
- package/{web → dist/web}/auth/useUpdateProfileMutation.js +1 -1
- package/{web → dist/web}/context/FirebaseContextProvider.js +1 -1
- package/dist/web/context/index.d.ts +1 -0
- package/dist/web/context/index.js +1 -0
- package/dist/web/firestore/index.d.ts +23 -0
- package/dist/web/firestore/index.js +23 -0
- package/{web → dist/web}/firestore/useAddDocMutation.d.ts +1 -1
- package/{web → dist/web}/firestore/useBatchWrite.js +1 -1
- package/{web → dist/web}/firestore/useCollectionReference.d.ts +1 -1
- package/{web → dist/web}/firestore/useCollectionReference.js +1 -1
- package/{web → dist/web}/firestore/useCompositeFilter.d.ts +2 -2
- package/{web → dist/web}/firestore/useCompositeFilter.js +1 -1
- package/{web → dist/web}/firestore/useCountQuery.d.ts +2 -2
- package/{web → dist/web}/firestore/useDeleteDocMutation.d.ts +1 -1
- package/{web → dist/web}/firestore/useDocReference.d.ts +2 -2
- package/{web → dist/web}/firestore/useDocReference.js +2 -2
- package/{web → dist/web}/firestore/useDocReferences.d.ts +2 -2
- package/{web → dist/web}/firestore/useDocReferences.js +2 -2
- package/{react-native → dist/web}/firestore/useEnsureDoc.d.ts +2 -2
- package/{web → dist/web}/firestore/useEnsureDoc.js +3 -3
- package/{web/firestore/useFirestore.ts → dist/web/firestore/useFirestore.js} +1 -2
- package/{web → dist/web}/firestore/useGetDocData.d.ts +2 -2
- package/{react-native → dist/web}/firestore/useGetDocData.js +2 -2
- package/{web → dist/web}/firestore/useGetRealtimeDocData.d.ts +1 -1
- package/{web → dist/web}/firestore/useGetRealtimeDocData.js +1 -1
- package/{web → dist/web}/firestore/useInfiniteQuery.d.ts +2 -2
- package/{web → dist/web}/firestore/useQuery.d.ts +2 -2
- package/{web → dist/web}/firestore/useQueryConstraints.d.ts +2 -2
- package/{web → dist/web}/firestore/useQueryConstraints.js +1 -1
- package/{web → dist/web}/firestore/useRunTransaction.js +1 -1
- package/{web → dist/web}/firestore/useSetDocMutation.d.ts +1 -1
- package/{web → dist/web}/firestore/useUpdateDocMutation.d.ts +1 -1
- package/{web → dist/web}/firestore/utils/buildCompositeFilter.d.ts +1 -1
- package/{web → dist/web}/firestore/utils/buildQueryConstraint.d.ts +1 -1
- package/{web → dist/web}/firestore/utils/getDocData.d.ts +2 -2
- package/{web → dist/web}/firestore/utils/getDocData.js +1 -1
- package/{web → dist/web}/firestore/utils/getDocRef.d.ts +1 -1
- package/{web → dist/web}/firestore/utils/getDocSnap.d.ts +2 -2
- package/{web → dist/web}/firestore/utils/getDocSnap.js +1 -1
- package/dist/web/index.d.ts +1 -0
- package/dist/web/index.js +1 -0
- package/dist/web/remoteConfig/index.d.ts +3 -0
- package/dist/web/remoteConfig/index.js +3 -0
- package/{web → dist/web}/remoteConfig/useFetchAndActivate.js +1 -1
- package/{web → dist/web}/remoteConfig/useGetValue.js +1 -1
- package/{web/remoteConfig/useRemoteConfig.ts → dist/web/remoteConfig/useRemoteConfig.js} +1 -2
- package/package.json +37 -17
- package/react-native/analytics/index.d.ts +0 -3
- package/react-native/analytics/index.js +0 -3
- package/react-native/analytics/index.ts +0 -3
- package/react-native/analytics/useAnalytics.js +0 -10
- package/react-native/analytics/useLogEvent.ts +0 -34
- package/react-native/analytics/useSetAnalyticsCollectionEnabled.ts +0 -22
- package/react-native/auth/index.d.ts +0 -19
- package/react-native/auth/index.js +0 -19
- package/react-native/auth/index.ts +0 -19
- package/react-native/auth/mutation-keys.ts +0 -22
- package/react-native/auth/useAppleAuthProviderCredential.ts +0 -31
- package/react-native/auth/useAuth.js +0 -10
- package/react-native/auth/useAuthStateReady.ts +0 -39
- package/react-native/auth/useCreateUserWitEmailAndPasswordMutation.ts +0 -38
- package/react-native/auth/useCurrentUser.ts +0 -26
- package/react-native/auth/useEmailAuthProviderCredential.ts +0 -38
- package/react-native/auth/useFacebookAuthProviderCredential.ts +0 -31
- package/react-native/auth/useIdToken.ts +0 -83
- package/react-native/auth/useLinkWithCredentialMutation.ts +0 -35
- package/react-native/auth/useReauthenticateWitCredentialMutation.ts +0 -36
- package/react-native/auth/useReauthenticateWitRedirectMutation.ts +0 -42
- package/react-native/auth/useSendEmailVerificationMutation.ts +0 -33
- package/react-native/auth/useSignInAnonymouslyMutation.ts +0 -52
- package/react-native/auth/useSignInWitEmailAndPasswordMutation.ts +0 -39
- package/react-native/auth/useSignInWitRedirectMutation.ts +0 -38
- package/react-native/auth/useSignInWithCredentialMutation.ts +0 -36
- package/react-native/auth/useSignOutMutation.ts +0 -28
- package/react-native/auth/useUpdateProfileMutation.ts +0 -30
- package/react-native/context/FirebaseContext.ts +0 -25
- package/react-native/context/FirebaseContextProvider.tsx +0 -264
- package/react-native/context/index.d.ts +0 -1
- package/react-native/context/index.js +0 -1
- package/react-native/context/index.ts +0 -1
- package/react-native/firestore/index.d.ts +0 -23
- package/react-native/firestore/index.js +0 -23
- package/react-native/firestore/index.ts +0 -23
- package/react-native/firestore/useAddDocMutation.ts +0 -80
- package/react-native/firestore/useBatchWrite.ts +0 -58
- package/react-native/firestore/useCollectionReference.ts +0 -58
- package/react-native/firestore/useCompositeFilter.ts +0 -60
- package/react-native/firestore/useCountQuery.ts +0 -85
- package/react-native/firestore/useDeleteDocMutation.ts +0 -71
- package/react-native/firestore/useDocReference.ts +0 -42
- package/react-native/firestore/useDocReferences.ts +0 -40
- package/react-native/firestore/useEnsureDoc.ts +0 -79
- package/react-native/firestore/useFirestore.js +0 -13
- package/react-native/firestore/useGetDocData.ts +0 -52
- package/react-native/firestore/useGetRealtimeDocData.ts +0 -106
- package/react-native/firestore/useInfiniteQuery.ts +0 -115
- package/react-native/firestore/useQuery.ts +0 -89
- package/react-native/firestore/useQueryConstraints.ts +0 -44
- package/react-native/firestore/useRunTransaction.ts +0 -55
- package/react-native/firestore/useSetDocMutation.ts +0 -76
- package/react-native/firestore/useUpdateDocMutation.ts +0 -77
- package/react-native/firestore/utils/buildCompositeFilter.ts +0 -75
- package/react-native/firestore/utils/buildQueryConstraint.ts +0 -54
- package/react-native/firestore/utils/getDocData.ts +0 -33
- package/react-native/firestore/utils/getDocRef.ts +0 -41
- package/react-native/firestore/utils/getDocSnap.ts +0 -34
- package/react-native/index.d.ts +0 -1
- package/react-native/index.js +0 -1
- package/react-native/index.ts +0 -1
- package/react-native/remoteConfig/index.d.ts +0 -3
- package/react-native/remoteConfig/index.js +0 -3
- package/react-native/remoteConfig/index.ts +0 -3
- package/react-native/remoteConfig/useFetchAndActivate.ts +0 -36
- package/react-native/remoteConfig/useGetValue.ts +0 -16
- package/react-native/remoteConfig/useRemoteConfig.js +0 -10
- package/types/AppModel.ts +0 -10
- package/types/QueryConstraints.ts +0 -57
- package/types/index.d.ts +0 -2
- package/types/index.js +0 -2
- package/types/index.ts +0 -2
- package/web/analytics/index.d.ts +0 -3
- package/web/analytics/index.js +0 -3
- package/web/analytics/index.ts +0 -3
- package/web/analytics/useAnalytics.js +0 -10
- package/web/analytics/useLogEvent.ts +0 -34
- package/web/analytics/useSetAnalyticsCollectionEnabled.ts +0 -22
- package/web/auth/index.d.ts +0 -20
- package/web/auth/index.js +0 -20
- package/web/auth/index.ts +0 -20
- package/web/auth/mutation-keys.ts +0 -23
- package/web/auth/useAppleAuthProviderCredential.ts +0 -32
- package/web/auth/useAuth.js +0 -10
- package/web/auth/useAuthStateReady.ts +0 -30
- package/web/auth/useCreateUserWitEmailAndPasswordMutation.ts +0 -33
- package/web/auth/useCurrentUser.ts +0 -25
- package/web/auth/useEmailAuthProviderCredential.ts +0 -38
- package/web/auth/useFacebookAuthProviderCredential.ts +0 -31
- package/web/auth/useGetRedirectResultMutation.ts +0 -27
- package/web/auth/useIdToken.ts +0 -83
- package/web/auth/useLinkWithCredentialMutation.ts +0 -30
- package/web/auth/useReauthenticateWitCredentialMutation.ts +0 -31
- package/web/auth/useReauthenticateWitRedirectMutation.ts +0 -37
- package/web/auth/useSendEmailVerificationMutation.ts +0 -28
- package/web/auth/useSignInAnonymouslyMutation.ts +0 -49
- package/web/auth/useSignInWitEmailAndPasswordMutation.ts +0 -34
- package/web/auth/useSignInWitRedirectMutation.ts +0 -33
- package/web/auth/useSignInWithCredentialMutation.ts +0 -31
- package/web/auth/useSignOutMutation.ts +0 -25
- package/web/auth/useUpdateProfileMutation.ts +0 -30
- package/web/context/FirebaseContext.ts +0 -25
- package/web/context/FirebaseContextProvider.tsx +0 -263
- package/web/context/index.d.ts +0 -1
- package/web/context/index.js +0 -1
- package/web/context/index.ts +0 -1
- package/web/firestore/index.d.ts +0 -23
- package/web/firestore/index.js +0 -23
- package/web/firestore/index.ts +0 -23
- package/web/firestore/useAddDocMutation.ts +0 -74
- package/web/firestore/useBatchWrite.ts +0 -58
- package/web/firestore/useCollectionReference.ts +0 -58
- package/web/firestore/useCompositeFilter.ts +0 -55
- package/web/firestore/useCountQuery.ts +0 -90
- package/web/firestore/useDeleteDocMutation.ts +0 -69
- package/web/firestore/useDocReference.ts +0 -43
- package/web/firestore/useDocReferences.ts +0 -40
- package/web/firestore/useEnsureDoc.ts +0 -92
- package/web/firestore/useFirestore.js +0 -13
- package/web/firestore/useGetDocData.ts +0 -52
- package/web/firestore/useGetRealtimeDocData.ts +0 -105
- package/web/firestore/useInfiniteQuery.ts +0 -117
- package/web/firestore/useQuery.ts +0 -94
- package/web/firestore/useQueryConstraints.ts +0 -44
- package/web/firestore/useRunTransaction.ts +0 -56
- package/web/firestore/useSetDocMutation.ts +0 -77
- package/web/firestore/useUpdateDocMutation.ts +0 -78
- package/web/firestore/utils/buildCompositeFilter.ts +0 -73
- package/web/firestore/utils/buildQueryConstraint.ts +0 -55
- package/web/firestore/utils/getDocData.ts +0 -33
- package/web/firestore/utils/getDocRef.ts +0 -43
- package/web/firestore/utils/getDocSnap.ts +0 -34
- package/web/index.d.ts +0 -1
- package/web/index.js +0 -1
- package/web/index.ts +0 -1
- package/web/remoteConfig/index.d.ts +0 -3
- package/web/remoteConfig/index.js +0 -3
- package/web/remoteConfig/index.ts +0 -3
- package/web/remoteConfig/useFetchAndActivate.ts +0 -36
- package/web/remoteConfig/useGetValue.ts +0 -16
- package/web/remoteConfig/useRemoteConfig.js +0 -10
- /package/{react-native → dist/react-native}/analytics/useAnalytics.d.ts +0 -0
- /package/{react-native → dist/react-native}/analytics/useLogEvent.d.ts +0 -0
- /package/{react-native → dist/react-native}/analytics/useSetAnalyticsCollectionEnabled.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/mutation-keys.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/mutation-keys.js +0 -0
- /package/{react-native → dist/react-native}/auth/useAppleAuthProviderCredential.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useAppleAuthProviderCredential.js +0 -0
- /package/{react-native → dist/react-native}/auth/useAuth.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useAuthStateReady.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useCreateUserWitEmailAndPasswordMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useCurrentUser.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useEmailAuthProviderCredential.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useEmailAuthProviderCredential.js +0 -0
- /package/{react-native → dist/react-native}/auth/useFacebookAuthProviderCredential.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useFacebookAuthProviderCredential.js +0 -0
- /package/{react-native → dist/react-native}/auth/useIdToken.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useLinkWithCredentialMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useReauthenticateWitCredentialMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useReauthenticateWitRedirectMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useSendEmailVerificationMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useSignInAnonymouslyMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useSignInWitEmailAndPasswordMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useSignInWitRedirectMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useSignInWithCredentialMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useSignOutMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/auth/useUpdateProfileMutation.d.ts +0 -0
- /package/{react-native → dist/react-native}/context/FirebaseContext.d.ts +0 -0
- /package/{react-native → dist/react-native}/context/FirebaseContext.js +0 -0
- /package/{react-native → dist/react-native}/context/FirebaseContextProvider.d.ts +0 -0
- /package/{react-native → dist/react-native}/firestore/useAddDocMutation.js +0 -0
- /package/{react-native → dist/react-native}/firestore/useBatchWrite.d.ts +0 -0
- /package/{react-native → dist/react-native}/firestore/useCountQuery.js +0 -0
- /package/{react-native → dist/react-native}/firestore/useDeleteDocMutation.js +0 -0
- /package/{react-native → dist/react-native}/firestore/useFirestore.d.ts +0 -0
- /package/{react-native → dist/react-native}/firestore/useInfiniteQuery.js +0 -0
- /package/{react-native → dist/react-native}/firestore/useQuery.js +0 -0
- /package/{react-native → dist/react-native}/firestore/useRunTransaction.d.ts +0 -0
- /package/{react-native → dist/react-native}/firestore/useSetDocMutation.js +0 -0
- /package/{react-native → dist/react-native}/firestore/useUpdateDocMutation.js +0 -0
- /package/{react-native → dist/react-native}/firestore/utils/buildCompositeFilter.js +0 -0
- /package/{react-native → dist/react-native}/firestore/utils/buildQueryConstraint.js +0 -0
- /package/{react-native → dist/react-native}/firestore/utils/getDocRef.js +0 -0
- /package/{react-native → dist/react-native}/remoteConfig/useFetchAndActivate.d.ts +0 -0
- /package/{react-native → dist/react-native}/remoteConfig/useGetValue.d.ts +0 -0
- /package/{react-native → dist/react-native}/remoteConfig/useRemoteConfig.d.ts +0 -0
- /package/{types → dist/types}/AppModel.d.ts +0 -0
- /package/{types → dist/types}/AppModel.js +0 -0
- /package/{types → dist/types}/QueryConstraints.js +0 -0
- /package/{web → dist/web}/analytics/useAnalytics.d.ts +0 -0
- /package/{web → dist/web}/analytics/useLogEvent.d.ts +0 -0
- /package/{web → dist/web}/analytics/useSetAnalyticsCollectionEnabled.d.ts +0 -0
- /package/{web → dist/web}/auth/mutation-keys.d.ts +0 -0
- /package/{web → dist/web}/auth/mutation-keys.js +0 -0
- /package/{web → dist/web}/auth/useAppleAuthProviderCredential.d.ts +0 -0
- /package/{web → dist/web}/auth/useAppleAuthProviderCredential.js +0 -0
- /package/{web → dist/web}/auth/useAuth.d.ts +0 -0
- /package/{web → dist/web}/auth/useAuthStateReady.d.ts +0 -0
- /package/{web → dist/web}/auth/useCreateUserWitEmailAndPasswordMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useCurrentUser.d.ts +0 -0
- /package/{web → dist/web}/auth/useEmailAuthProviderCredential.d.ts +0 -0
- /package/{web → dist/web}/auth/useEmailAuthProviderCredential.js +0 -0
- /package/{web → dist/web}/auth/useFacebookAuthProviderCredential.d.ts +0 -0
- /package/{web → dist/web}/auth/useFacebookAuthProviderCredential.js +0 -0
- /package/{web → dist/web}/auth/useGetRedirectResultMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useIdToken.d.ts +0 -0
- /package/{web → dist/web}/auth/useLinkWithCredentialMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useReauthenticateWitCredentialMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useReauthenticateWitRedirectMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useSendEmailVerificationMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useSignInAnonymouslyMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useSignInWitEmailAndPasswordMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useSignInWitRedirectMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useSignInWithCredentialMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useSignOutMutation.d.ts +0 -0
- /package/{web → dist/web}/auth/useUpdateProfileMutation.d.ts +0 -0
- /package/{web → dist/web}/context/FirebaseContext.d.ts +0 -0
- /package/{web → dist/web}/context/FirebaseContext.js +0 -0
- /package/{web → dist/web}/context/FirebaseContextProvider.d.ts +0 -0
- /package/{web → dist/web}/firestore/useAddDocMutation.js +0 -0
- /package/{web → dist/web}/firestore/useBatchWrite.d.ts +0 -0
- /package/{web → dist/web}/firestore/useCountQuery.js +0 -0
- /package/{web → dist/web}/firestore/useDeleteDocMutation.js +0 -0
- /package/{web → dist/web}/firestore/useFirestore.d.ts +0 -0
- /package/{web → dist/web}/firestore/useInfiniteQuery.js +0 -0
- /package/{web → dist/web}/firestore/useQuery.js +0 -0
- /package/{web → dist/web}/firestore/useRunTransaction.d.ts +0 -0
- /package/{web → dist/web}/firestore/useSetDocMutation.js +0 -0
- /package/{web → dist/web}/firestore/useUpdateDocMutation.js +0 -0
- /package/{web → dist/web}/firestore/utils/buildCompositeFilter.js +0 -0
- /package/{web → dist/web}/firestore/utils/buildQueryConstraint.js +0 -0
- /package/{web → dist/web}/firestore/utils/getDocRef.js +0 -0
- /package/{web → dist/web}/remoteConfig/useFetchAndActivate.d.ts +0 -0
- /package/{web → dist/web}/remoteConfig/useGetValue.d.ts +0 -0
- /package/{web → dist/web}/remoteConfig/useRemoteConfig.d.ts +0 -0
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import { signInWithEmailAndPassword, UserCredential } from "firebase/auth";
|
|
3
|
-
|
|
4
|
-
import { FirebaseError } from "firebase/app";
|
|
5
|
-
import { useAuth } from "./useAuth";
|
|
6
|
-
import { SIGN_IN_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY } from "./mutation-keys";
|
|
7
|
-
|
|
8
|
-
export type UseSignInWitEmailAndPasswordMutationVariables = {
|
|
9
|
-
email: string;
|
|
10
|
-
password: string;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Custom hook to perform a sign-in operation using email and password with Firebase Authentication.
|
|
15
|
-
* It utilizes the `useMutation` hook to manage the asynchronous operation and its state.
|
|
16
|
-
*
|
|
17
|
-
* @param {Omit<UseMutationOptions<UserCredential, FirebaseError, UseSignInWitEmailAndPasswordMutationVariables, TContext>, 'mutationKey' | 'mutationFn'>} options - Options to configure the mutation, excluding 'mutationKey' and 'mutationFn'.
|
|
18
|
-
* @returns {MutationResult} A mutation object containing the result of the sign-in process and helper functions.
|
|
19
|
-
*/
|
|
20
|
-
export const useSignInWitEmailAndPasswordMutation = <TContext = unknown>(
|
|
21
|
-
options: Omit<
|
|
22
|
-
UseMutationOptions<UserCredential, FirebaseError, UseSignInWitEmailAndPasswordMutationVariables, TContext>,
|
|
23
|
-
"mutationKey" | "mutationFn"
|
|
24
|
-
> = {}
|
|
25
|
-
) => {
|
|
26
|
-
const firebaseAuth = useAuth();
|
|
27
|
-
|
|
28
|
-
return useMutation({
|
|
29
|
-
...options,
|
|
30
|
-
mutationFn: async ({ email, password }: UseSignInWitEmailAndPasswordMutationVariables) =>
|
|
31
|
-
signInWithEmailAndPassword(firebaseAuth, email, password),
|
|
32
|
-
mutationKey: SIGN_IN_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY
|
|
33
|
-
});
|
|
34
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import { signInWithRedirect, AuthProvider, PopupRedirectResolver } from "firebase/auth";
|
|
3
|
-
|
|
4
|
-
import { FirebaseError } from "firebase/app";
|
|
5
|
-
import { useAuth } from "./useAuth";
|
|
6
|
-
import { SIGN_IN_WITH_REDIRECT_MUTATION_KEY } from "./mutation-keys";
|
|
7
|
-
|
|
8
|
-
export type UseSignInWitRedirectMutationVariables = {
|
|
9
|
-
authProvider: AuthProvider;
|
|
10
|
-
popupRedirectResolver?: PopupRedirectResolver;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Custom hook for handling Firebase authentication using sign-in with redirect functionality.
|
|
15
|
-
* This hook utilizes the `useMutation` mechanism to perform the sign-in operation.
|
|
16
|
-
* @param {Omit<UseMutationOptions<void, FirebaseError, UseSignInWitRedirectMutationVariables, TContext>, "mutationKey" | "mutationFn">} options - Optional configurations for the mutation, omitting the mutationKey and mutationFn properties.
|
|
17
|
-
* @returns {UseMutationResult<void, FirebaseError, UseSignInWitRedirectMutationVariables, TContext>} The result object from the useMutation hook, containing the mutation function and its current state.
|
|
18
|
-
*/
|
|
19
|
-
export const useSignInWitRedirectMutation = <TContext = unknown>(
|
|
20
|
-
options: Omit<
|
|
21
|
-
UseMutationOptions<void, FirebaseError, UseSignInWitRedirectMutationVariables, TContext>,
|
|
22
|
-
"mutationKey" | "mutationFn"
|
|
23
|
-
> = {}
|
|
24
|
-
) => {
|
|
25
|
-
const firebaseAuth = useAuth();
|
|
26
|
-
|
|
27
|
-
return useMutation({
|
|
28
|
-
...options,
|
|
29
|
-
mutationFn: async ({ authProvider, popupRedirectResolver }: UseSignInWitRedirectMutationVariables) =>
|
|
30
|
-
signInWithRedirect(firebaseAuth, authProvider, popupRedirectResolver),
|
|
31
|
-
mutationKey: SIGN_IN_WITH_REDIRECT_MUTATION_KEY
|
|
32
|
-
});
|
|
33
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import { AuthCredential, UserCredential, signInWithCredential } from "firebase/auth";
|
|
3
|
-
|
|
4
|
-
import { FirebaseError } from "firebase/app";
|
|
5
|
-
import { SIGN_IN_WITH_CREDENTIAL_MUTATION_KEY } from "./mutation-keys";
|
|
6
|
-
import { useAuth } from "./useAuth";
|
|
7
|
-
|
|
8
|
-
export type UseSignInWithCredentialMutationVariables = {
|
|
9
|
-
credential: AuthCredential;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Custom hook for handling sign in using credential
|
|
14
|
-
* This hook utilizes the `useMutation` mechanism to perform the sign-in operation.
|
|
15
|
-
* @param {Omit<UseMutationOptions<UserCredential, FirebaseError, UseSignInWithCredentialMutationVariables, TContext>, "mutationKey" | "mutationFn">} options - Optional configurations for the mutation, omitting the mutationKey and mutationFn properties.
|
|
16
|
-
* @returns {UseMutationResult<UserCredential, FirebaseError, UseSignInWithCredentialMutationVariables, TContext>} The result object from the useMutation hook, containing the mutation function and its current state.
|
|
17
|
-
*/
|
|
18
|
-
export const useSignInWithCredentialMutation = <TContext = unknown>(
|
|
19
|
-
options: Omit<
|
|
20
|
-
UseMutationOptions<UserCredential, FirebaseError, UseSignInWithCredentialMutationVariables, TContext>,
|
|
21
|
-
"mutationKey" | "mutationFn"
|
|
22
|
-
> = {}
|
|
23
|
-
) => {
|
|
24
|
-
const auth = useAuth();
|
|
25
|
-
return useMutation({
|
|
26
|
-
...options,
|
|
27
|
-
mutationFn: async ({ credential }: UseSignInWithCredentialMutationVariables) =>
|
|
28
|
-
signInWithCredential(auth, credential),
|
|
29
|
-
mutationKey: SIGN_IN_WITH_CREDENTIAL_MUTATION_KEY
|
|
30
|
-
});
|
|
31
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import { signOut } from "firebase/auth";
|
|
3
|
-
|
|
4
|
-
import { FirebaseError } from "firebase/app";
|
|
5
|
-
import { SIGN_OUT_MUTATION_KEY } from "./mutation-keys";
|
|
6
|
-
import { useAuth } from "./useAuth";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Custom hook for handling the sign-out mutation using Firebase authentication.
|
|
10
|
-
* It wraps the useMutation hook to provide a sign-out function with Firebase.
|
|
11
|
-
*
|
|
12
|
-
* @param {Omit<UseMutationOptions<void, FirebaseError, void, TContext>, "queryKey" | "queryFn">} options - Configuration options for the mutation, excluding "queryKey" and "queryFn".
|
|
13
|
-
* @returns {UseMutationResult<void, FirebaseError, void, TContext>} A mutation object for handling the sign-out process, including methods for mutating and state tracking.
|
|
14
|
-
*/
|
|
15
|
-
export const useSignOutMutation = <TContext = unknown>(
|
|
16
|
-
options: Omit<UseMutationOptions<void, FirebaseError, void, TContext>, "queryKey" | "queryFn"> = {}
|
|
17
|
-
) => {
|
|
18
|
-
const firebaseAuth = useAuth();
|
|
19
|
-
|
|
20
|
-
return useMutation({
|
|
21
|
-
...options,
|
|
22
|
-
mutationFn: async () => await signOut(firebaseAuth),
|
|
23
|
-
mutationKey: SIGN_OUT_MUTATION_KEY
|
|
24
|
-
});
|
|
25
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import { updateProfile, User } from "firebase/auth";
|
|
3
|
-
import { FirebaseError } from "firebase/app";
|
|
4
|
-
import { CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY } from "./mutation-keys";
|
|
5
|
-
|
|
6
|
-
export type UseUpdateProfileMutationVariables = {
|
|
7
|
-
displayName?: string;
|
|
8
|
-
user: User;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Custom hook to manage the mutation for updating a user's profile.
|
|
13
|
-
* Utilizes Firebase for updating the user's display name.
|
|
14
|
-
*
|
|
15
|
-
* @param {Omit<UseMutationOptions<void, FirebaseError, UseUpdateProfileMutationVariables, TContext>, "mutationKey" | "mutationFn">} options - Configuration options for the mutation, excluding mutationKey and mutationFn.
|
|
16
|
-
* @returns {UseMutationResult<void, FirebaseError, UseUpdateProfileMutationVariables, TContext>} The result of the mutation operation including statuses, data, and error information.
|
|
17
|
-
*/
|
|
18
|
-
export const useUpdateProfileMutation = <TContext = unknown>(
|
|
19
|
-
options: Omit<
|
|
20
|
-
UseMutationOptions<void, FirebaseError, UseUpdateProfileMutationVariables, TContext>,
|
|
21
|
-
"mutationKey" | "mutationFn"
|
|
22
|
-
> = {}
|
|
23
|
-
) => {
|
|
24
|
-
return useMutation({
|
|
25
|
-
...options,
|
|
26
|
-
mutationFn: async ({ displayName, user }: UseUpdateProfileMutationVariables) =>
|
|
27
|
-
await updateProfile(user, { displayName }),
|
|
28
|
-
mutationKey: CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY
|
|
29
|
-
});
|
|
30
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { createContext } from "react";
|
|
4
|
-
|
|
5
|
-
import { Auth } from "firebase/auth";
|
|
6
|
-
import { Analytics } from "firebase/analytics";
|
|
7
|
-
import { Firestore } from "firebase/firestore";
|
|
8
|
-
import { FirebaseApp } from "firebase/app";
|
|
9
|
-
import { RemoteConfig } from "firebase/remote-config";
|
|
10
|
-
|
|
11
|
-
type FirebaseContextValue = {
|
|
12
|
-
auth: Auth;
|
|
13
|
-
analytics: Analytics;
|
|
14
|
-
firebase: FirebaseApp;
|
|
15
|
-
remoteConfig: RemoteConfig;
|
|
16
|
-
firestore: Firestore;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* FirebaseContext is a shared context across children that provides access to firebase features
|
|
21
|
-
*
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
export const FirebaseContext = createContext<FirebaseContextValue>({} as FirebaseContextValue);
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import React, { PropsWithChildren, useEffect, useMemo } from "react";
|
|
2
|
-
import {
|
|
3
|
-
browserLocalPersistence,
|
|
4
|
-
browserSessionPersistence,
|
|
5
|
-
connectAuthEmulator,
|
|
6
|
-
getAuth,
|
|
7
|
-
Persistence,
|
|
8
|
-
setPersistence
|
|
9
|
-
} from "firebase/auth";
|
|
10
|
-
import { ConsentSettings, getAnalytics, setAnalyticsCollectionEnabled, setConsent } from "firebase/analytics";
|
|
11
|
-
import { getRemoteConfig, RemoteConfigSettings } from "firebase/remote-config";
|
|
12
|
-
import { connectFirestoreEmulator, FirestoreSettings, initializeFirestore } from "firebase/firestore";
|
|
13
|
-
import { FirebaseOptions, initializeApp } from "firebase/app";
|
|
14
|
-
import { FirebaseContext } from "./FirebaseContext";
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @inline
|
|
18
|
-
*/
|
|
19
|
-
export type FirebaseContextProviderFirestoreEmulatorConfig = {
|
|
20
|
-
/**
|
|
21
|
-
* Host to connect to Firebase Firestore Emulator
|
|
22
|
-
*/
|
|
23
|
-
host: string;
|
|
24
|
-
/**
|
|
25
|
-
* Port to connect to Firebase Firestore Emulator
|
|
26
|
-
*/
|
|
27
|
-
port: number;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @inline
|
|
32
|
-
*/
|
|
33
|
-
export type FirebaseContextProviderAuthEmulatorConfig = {
|
|
34
|
-
/**
|
|
35
|
-
* Host to connect to Firebase Auth Emulator
|
|
36
|
-
*/
|
|
37
|
-
host: string;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @inline
|
|
42
|
-
*/
|
|
43
|
-
export type FirebaseContextProviderEmulators = {
|
|
44
|
-
/**
|
|
45
|
-
* Defines configuration for Firebase Firestore emulator. Optional.
|
|
46
|
-
*/
|
|
47
|
-
firestore?: FirebaseContextProviderFirestoreEmulatorConfig;
|
|
48
|
-
/**
|
|
49
|
-
* Defines configuration for Firebase Auth emulator. Optional
|
|
50
|
-
*/
|
|
51
|
-
auth?: FirebaseContextProviderAuthEmulatorConfig;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @inline
|
|
56
|
-
*/
|
|
57
|
-
export type FirebaseContextProviderProps = PropsWithChildren & {
|
|
58
|
-
/**
|
|
59
|
-
* Defines configuration for firebase emulators
|
|
60
|
-
*/
|
|
61
|
-
emulators?: FirebaseContextProviderEmulators;
|
|
62
|
-
/**
|
|
63
|
-
* Configuration options for Firebase initialization. {@link https://firebase.google.com/docs/web/setup#config-object | Learn about the Firebase config object}
|
|
64
|
-
*/
|
|
65
|
-
options: FirebaseOptions;
|
|
66
|
-
/**
|
|
67
|
-
* Flag indicating whether Firebase Auth should be enabled.
|
|
68
|
-
*/
|
|
69
|
-
authEnabled?: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Flag indicating whether Firebase Analytics should be enabled.
|
|
72
|
-
* @defaultValue `true`
|
|
73
|
-
*/
|
|
74
|
-
analyticsEnabled?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Default user consent settings. Make sure to either use a consent platform or install custom consent form for a certain regions.
|
|
77
|
-
* @defaultValue {
|
|
78
|
-
* ad_personalization: "denied",
|
|
79
|
-
* ad_storage: "denied",
|
|
80
|
-
* ad_user_data: "denied",
|
|
81
|
-
* analytics_storage: "denied",
|
|
82
|
-
* functionality_storage: "denied",
|
|
83
|
-
* personalization_storage: "denied",
|
|
84
|
-
* security_storage: "denied"
|
|
85
|
-
* }
|
|
86
|
-
*/
|
|
87
|
-
consentSettings?: ConsentSettings;
|
|
88
|
-
/**
|
|
89
|
-
* Specifies custom configurations for your Cloud Firestore instance.
|
|
90
|
-
* You must set these before invoking any other methods.
|
|
91
|
-
* {@link https://firebase.google.com/docs/reference/js/firestore_.firestoresettings}
|
|
92
|
-
* @defaultValue {}
|
|
93
|
-
*/
|
|
94
|
-
firestoreSettings?: FirestoreSettings;
|
|
95
|
-
/**
|
|
96
|
-
* Flag indicating whether Firebase Firestore should be enabled.
|
|
97
|
-
* @defaultValue `true`
|
|
98
|
-
*/
|
|
99
|
-
firestoreEnabled?: boolean;
|
|
100
|
-
/**
|
|
101
|
-
* 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}
|
|
102
|
-
* @defaultValue `true`
|
|
103
|
-
*/
|
|
104
|
-
remoteConfigSettings?: RemoteConfigSettings;
|
|
105
|
-
/**
|
|
106
|
-
* Configuration options for Firebase Remote Config Defaults.
|
|
107
|
-
*/
|
|
108
|
-
remoteConfigDefaults?: { [key: string]: string | number | boolean };
|
|
109
|
-
/**
|
|
110
|
-
* Flag indicating whether Firebase Remote Config should be enabled.
|
|
111
|
-
* @defaultValue `true`
|
|
112
|
-
*/
|
|
113
|
-
remoteConfigEnabled?: boolean;
|
|
114
|
-
/**
|
|
115
|
-
* Firebase persistence type
|
|
116
|
-
* @defaultValue 'LOCAL'
|
|
117
|
-
*/
|
|
118
|
-
authPersistenceType?: "SESSION" | "LOCAL" | "NONE" | "COOKIE";
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* FirebaseContextProvider component configures and provides Firebase services to its children.
|
|
123
|
-
* Initializes Firebase app and enables optional Firebase services such as Firestore, Auth, Analytics,
|
|
124
|
-
* and Remote Config based on the provided configuration and parameters.
|
|
125
|
-
*
|
|
126
|
-
* @group Component
|
|
127
|
-
*
|
|
128
|
-
* @param {FirebaseContextProviderProps} props
|
|
129
|
-
*
|
|
130
|
-
* @returns {FirebaseContextProvider<FirebaseContextProviderProps>}
|
|
131
|
-
*
|
|
132
|
-
* @example
|
|
133
|
-
* ```jsx
|
|
134
|
-
* const firebaseConfig = {};
|
|
135
|
-
* export const App = () => {
|
|
136
|
-
* return (
|
|
137
|
-
* <FirebaseContextProvider options={firebaseConfig}>
|
|
138
|
-
* <ChildComponent />
|
|
139
|
-
* </FirebaseContextProvider>
|
|
140
|
-
* );
|
|
141
|
-
* };
|
|
142
|
-
* ```
|
|
143
|
-
*/
|
|
144
|
-
export const FirebaseContextProvider: React.FC<FirebaseContextProviderProps> = ({
|
|
145
|
-
emulators,
|
|
146
|
-
options,
|
|
147
|
-
children,
|
|
148
|
-
authEnabled = true,
|
|
149
|
-
firestoreEnabled = true,
|
|
150
|
-
analyticsEnabled = true,
|
|
151
|
-
consentSettings = {},
|
|
152
|
-
remoteConfigEnabled = true,
|
|
153
|
-
remoteConfigSettings,
|
|
154
|
-
remoteConfigDefaults = {},
|
|
155
|
-
firestoreSettings,
|
|
156
|
-
authPersistenceType
|
|
157
|
-
}) => {
|
|
158
|
-
const firebase = useMemo(() => {
|
|
159
|
-
return initializeApp(options);
|
|
160
|
-
}, [options]);
|
|
161
|
-
|
|
162
|
-
useEffect(() => {
|
|
163
|
-
setConsent({
|
|
164
|
-
ad_personalization: "denied",
|
|
165
|
-
ad_storage: "denied",
|
|
166
|
-
ad_user_data: "denied",
|
|
167
|
-
analytics_storage: "denied",
|
|
168
|
-
functionality_storage: "denied",
|
|
169
|
-
personalization_storage: "denied",
|
|
170
|
-
security_storage: "denied",
|
|
171
|
-
...consentSettings
|
|
172
|
-
});
|
|
173
|
-
}, [consentSettings]);
|
|
174
|
-
|
|
175
|
-
const firestore = useMemo(() => {
|
|
176
|
-
if (firestoreEnabled) {
|
|
177
|
-
const localFirestore = initializeFirestore(firebase, firestoreSettings || {});
|
|
178
|
-
|
|
179
|
-
if (emulators?.firestore?.host && emulators?.firestore?.port) {
|
|
180
|
-
connectFirestoreEmulator(localFirestore, emulators.firestore.host, emulators.firestore.port);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return localFirestore;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return null;
|
|
187
|
-
}, [firestoreSettings, emulators, firestoreEnabled, firebase]);
|
|
188
|
-
|
|
189
|
-
const authPersistence = useMemo(() => {
|
|
190
|
-
switch (authPersistenceType) {
|
|
191
|
-
case "NONE":
|
|
192
|
-
case "COOKIE":
|
|
193
|
-
return { type: "NONE" } as Persistence;
|
|
194
|
-
case "SESSION":
|
|
195
|
-
return browserSessionPersistence;
|
|
196
|
-
default:
|
|
197
|
-
case "LOCAL":
|
|
198
|
-
return browserLocalPersistence;
|
|
199
|
-
}
|
|
200
|
-
}, [authPersistenceType]);
|
|
201
|
-
|
|
202
|
-
const auth = useMemo(() => {
|
|
203
|
-
if (authEnabled) {
|
|
204
|
-
const localAuth = getAuth(firebase);
|
|
205
|
-
if (emulators?.auth?.host) {
|
|
206
|
-
connectAuthEmulator(localAuth, emulators?.auth?.host, {
|
|
207
|
-
disableWarnings: true
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
return localAuth;
|
|
211
|
-
}
|
|
212
|
-
return null;
|
|
213
|
-
}, [emulators?.auth, authEnabled, firebase]);
|
|
214
|
-
|
|
215
|
-
useEffect(() => {
|
|
216
|
-
if (authPersistence && auth) {
|
|
217
|
-
setPersistence(auth, authPersistence);
|
|
218
|
-
}
|
|
219
|
-
}, [auth, authPersistence]);
|
|
220
|
-
|
|
221
|
-
const analytics = useMemo(() => {
|
|
222
|
-
if (analyticsEnabled && options.measurementId && typeof window !== "undefined") {
|
|
223
|
-
return getAnalytics(firebase);
|
|
224
|
-
}
|
|
225
|
-
return null;
|
|
226
|
-
}, [analyticsEnabled, options.measurementId, firebase]);
|
|
227
|
-
|
|
228
|
-
const remoteConfig = useMemo(() => {
|
|
229
|
-
if (remoteConfigEnabled && typeof window !== "undefined") {
|
|
230
|
-
const localRemoteConfig = getRemoteConfig(firebase);
|
|
231
|
-
if (remoteConfigSettings) {
|
|
232
|
-
localRemoteConfig.settings.fetchTimeoutMillis = remoteConfigSettings.fetchTimeoutMillis;
|
|
233
|
-
localRemoteConfig.settings.minimumFetchIntervalMillis = remoteConfigSettings.minimumFetchIntervalMillis;
|
|
234
|
-
localRemoteConfig.defaultConfig = remoteConfigDefaults;
|
|
235
|
-
}
|
|
236
|
-
return localRemoteConfig;
|
|
237
|
-
}
|
|
238
|
-
return null;
|
|
239
|
-
}, [remoteConfigEnabled, firebase, remoteConfigDefaults, remoteConfigSettings]);
|
|
240
|
-
|
|
241
|
-
const contextValue = useMemo(
|
|
242
|
-
() => ({
|
|
243
|
-
firebase,
|
|
244
|
-
auth,
|
|
245
|
-
analytics,
|
|
246
|
-
firestore,
|
|
247
|
-
remoteConfig
|
|
248
|
-
}),
|
|
249
|
-
[firebase, auth, analytics, firestore, remoteConfig]
|
|
250
|
-
);
|
|
251
|
-
|
|
252
|
-
useEffect(() => {
|
|
253
|
-
if (contextValue.analytics) {
|
|
254
|
-
setAnalyticsCollectionEnabled(contextValue.analytics, consentSettings?.analytics_storage === "granted");
|
|
255
|
-
}
|
|
256
|
-
}, [consentSettings?.analytics_storage, contextValue.analytics]);
|
|
257
|
-
|
|
258
|
-
return (
|
|
259
|
-
<FirebaseContext.Provider value={contextValue as React.ContextType<typeof FirebaseContext>}>
|
|
260
|
-
{children}
|
|
261
|
-
</FirebaseContext.Provider>
|
|
262
|
-
);
|
|
263
|
-
};
|
package/web/context/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./FirebaseContextProvider";
|
package/web/context/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./FirebaseContextProvider";
|
package/web/context/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./FirebaseContextProvider";
|
package/web/firestore/index.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export * from "./useFirestore";
|
|
2
|
-
export * from "./useAddDocMutation";
|
|
3
|
-
export * from "./useBatchWrite";
|
|
4
|
-
export * from "./useCollectionReference";
|
|
5
|
-
export * from "./useCompositeFilter";
|
|
6
|
-
export * from "./useCountQuery";
|
|
7
|
-
export * from "./useDeleteDocMutation";
|
|
8
|
-
export * from "./useDocReference";
|
|
9
|
-
export * from "./useDocReferences";
|
|
10
|
-
export * from "./useGetDocData";
|
|
11
|
-
export * from "./useInfiniteQuery";
|
|
12
|
-
export * from "./useQuery";
|
|
13
|
-
export * from "./useRunTransaction";
|
|
14
|
-
export * from "./useSetDocMutation";
|
|
15
|
-
export * from "./useUpdateDocMutation";
|
|
16
|
-
export * from "./useGetRealtimeDocData";
|
|
17
|
-
export * from "./useQueryConstraints";
|
|
18
|
-
export * from "./useEnsureDoc";
|
|
19
|
-
export * from "./utils/getDocData";
|
|
20
|
-
export * from "./utils/getDocSnap";
|
|
21
|
-
export * from "./utils/getDocRef";
|
|
22
|
-
export * from "./utils/buildQueryConstraint";
|
|
23
|
-
export * from "./utils/buildCompositeFilter";
|
package/web/firestore/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export * from "./useFirestore";
|
|
2
|
-
export * from "./useAddDocMutation";
|
|
3
|
-
export * from "./useBatchWrite";
|
|
4
|
-
export * from "./useCollectionReference";
|
|
5
|
-
export * from "./useCompositeFilter";
|
|
6
|
-
export * from "./useCountQuery";
|
|
7
|
-
export * from "./useDeleteDocMutation";
|
|
8
|
-
export * from "./useDocReference";
|
|
9
|
-
export * from "./useDocReferences";
|
|
10
|
-
export * from "./useGetDocData";
|
|
11
|
-
export * from "./useInfiniteQuery";
|
|
12
|
-
export * from "./useQuery";
|
|
13
|
-
export * from "./useRunTransaction";
|
|
14
|
-
export * from "./useSetDocMutation";
|
|
15
|
-
export * from "./useUpdateDocMutation";
|
|
16
|
-
export * from "./useGetRealtimeDocData";
|
|
17
|
-
export * from "./useQueryConstraints";
|
|
18
|
-
export * from "./useEnsureDoc";
|
|
19
|
-
export * from "./utils/getDocData";
|
|
20
|
-
export * from "./utils/getDocSnap";
|
|
21
|
-
export * from "./utils/getDocRef";
|
|
22
|
-
export * from "./utils/buildQueryConstraint";
|
|
23
|
-
export * from "./utils/buildCompositeFilter";
|
package/web/firestore/index.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export * from "./useFirestore";
|
|
2
|
-
export * from "./useAddDocMutation";
|
|
3
|
-
export * from "./useBatchWrite";
|
|
4
|
-
export * from "./useCollectionReference";
|
|
5
|
-
export * from "./useCompositeFilter";
|
|
6
|
-
export * from "./useCountQuery";
|
|
7
|
-
export * from "./useDeleteDocMutation";
|
|
8
|
-
export * from "./useDocReference";
|
|
9
|
-
export * from "./useDocReferences";
|
|
10
|
-
export * from "./useGetDocData";
|
|
11
|
-
export * from "./useInfiniteQuery";
|
|
12
|
-
export * from "./useQuery";
|
|
13
|
-
export * from "./useRunTransaction";
|
|
14
|
-
export * from "./useSetDocMutation";
|
|
15
|
-
export * from "./useUpdateDocMutation";
|
|
16
|
-
export * from "./useGetRealtimeDocData";
|
|
17
|
-
export * from "./useQueryConstraints";
|
|
18
|
-
export * from "./useEnsureDoc";
|
|
19
|
-
export * from "./utils/getDocData";
|
|
20
|
-
export * from "./utils/getDocSnap";
|
|
21
|
-
export * from "./utils/getDocRef";
|
|
22
|
-
export * from "./utils/buildQueryConstraint";
|
|
23
|
-
export * from "./utils/buildCompositeFilter";
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import { addDoc, WithFieldValue, CollectionReference, getDoc } from "firebase/firestore";
|
|
3
|
-
|
|
4
|
-
import { FirebaseError } from "firebase/app";
|
|
5
|
-
import { useMemo } from "react";
|
|
6
|
-
import { AppModel } from "../../types";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @inline
|
|
10
|
-
*/
|
|
11
|
-
export type UseAddDocMutationValues<AppModelType> = {
|
|
12
|
-
/**
|
|
13
|
-
* Data to write
|
|
14
|
-
*/
|
|
15
|
-
data: WithFieldValue<AppModelType>;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @inline
|
|
20
|
-
*/
|
|
21
|
-
export type UseAddDocMutationOptions<AppModelType extends AppModel = AppModel, TContext = unknown> = {
|
|
22
|
-
/**
|
|
23
|
-
* Reference to a collection where document must be added
|
|
24
|
-
*/
|
|
25
|
-
collectionReference: CollectionReference<AppModelType, AppModelType>;
|
|
26
|
-
/**
|
|
27
|
-
* Options for useMutation hook excluding mutationFn. MutationKey will be equal to reference.path by default.
|
|
28
|
-
*/
|
|
29
|
-
options?: Omit<
|
|
30
|
-
UseMutationOptions<AppModelType, FirebaseError, UseAddDocMutationValues<AppModelType>, TContext>,
|
|
31
|
-
"mutationFn"
|
|
32
|
-
>;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Executes a mutation and returns added document
|
|
37
|
-
*
|
|
38
|
-
* @group Hook
|
|
39
|
-
*
|
|
40
|
-
* @param {UseAddDocMutationOptions<AppModelType>} options - Configuration options for the mutation.
|
|
41
|
-
*
|
|
42
|
-
* @returns {UseMutationResult<AppModelType, Error, UseAddDocMutationValues<AppModelType>, TContext>} A mutation result
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```jsx
|
|
46
|
-
* export const MyComponent = () => {
|
|
47
|
-
* const {mutate} = useAddDocMutation({
|
|
48
|
-
* options: {
|
|
49
|
-
* },
|
|
50
|
-
* reference: collection(),
|
|
51
|
-
* });
|
|
52
|
-
*
|
|
53
|
-
* // ....
|
|
54
|
-
* mutate({data: {test: 'value'}});
|
|
55
|
-
* // ....
|
|
56
|
-
* };
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
export const useAddDocMutation = <AppModelType extends AppModel = AppModel, TContext = unknown>({
|
|
60
|
-
collectionReference,
|
|
61
|
-
options = {}
|
|
62
|
-
}: UseAddDocMutationOptions<AppModelType, TContext>) => {
|
|
63
|
-
const mutationKey = useMemo(() => [collectionReference.path], [collectionReference.path]);
|
|
64
|
-
|
|
65
|
-
return useMutation({
|
|
66
|
-
mutationKey,
|
|
67
|
-
...options,
|
|
68
|
-
mutationFn: async ({ data }) => {
|
|
69
|
-
const docRef = await addDoc<AppModelType, AppModelType>(collectionReference, data);
|
|
70
|
-
const docSnap = await getDoc(docRef);
|
|
71
|
-
return { ...docSnap.data(), uid: docSnap.id } as AppModelType;
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { useMutation, UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
-
import { writeBatch, WriteBatch } from "firebase/firestore";
|
|
3
|
-
|
|
4
|
-
import { FirebaseError } from "firebase/app";
|
|
5
|
-
import { useFirestore } from "./useFirestore";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @inline
|
|
9
|
-
*/
|
|
10
|
-
export type UseBatchWriteVariables = (batch: WriteBatch) => Promise<void> | void;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @inline
|
|
14
|
-
*/
|
|
15
|
-
export type UseBatchWriteOptions = {
|
|
16
|
-
/**
|
|
17
|
-
* Options for useMutation hook excluding mutationFn. MutationKey will be equal to reference.path by default.
|
|
18
|
-
*/
|
|
19
|
-
options?: Omit<UseMutationOptions<void, FirebaseError, UseBatchWriteVariables>, "mutationFn">;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Custom hook to perform batch write operations using Firestore.
|
|
24
|
-
*
|
|
25
|
-
* @group Hook
|
|
26
|
-
*
|
|
27
|
-
* @param {UseBatchWriteOptions} options - Configuration options for the query.
|
|
28
|
-
*
|
|
29
|
-
* @returns {UseMutationResult<void, Error, UseAddDocMutationValues<AppModelType>>} A mutation result
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```jsx
|
|
33
|
-
* export const MyComponent = () => {
|
|
34
|
-
* const {mutate} = useBatchWrite({
|
|
35
|
-
* options: {
|
|
36
|
-
* },
|
|
37
|
-
* });
|
|
38
|
-
*
|
|
39
|
-
* // ....
|
|
40
|
-
* mutate(() => {
|
|
41
|
-
* ref.update({...})
|
|
42
|
-
* });
|
|
43
|
-
* // ....
|
|
44
|
-
* };
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export const useBatchWrite = ({ options = {} }: UseBatchWriteOptions = {}) => {
|
|
48
|
-
const db = useFirestore();
|
|
49
|
-
|
|
50
|
-
return useMutation({
|
|
51
|
-
...options,
|
|
52
|
-
mutationFn: async (batchWriteFn) => {
|
|
53
|
-
const batch = writeBatch(db);
|
|
54
|
-
await batchWriteFn(batch);
|
|
55
|
-
return batch.commit();
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
};
|