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.
Files changed (377) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js +4 -0
  3. package/dist/react-native/analytics/index.d.ts +3 -0
  4. package/dist/react-native/analytics/index.js +3 -0
  5. package/{react-native/analytics/useAnalytics.ts → dist/react-native/analytics/useAnalytics.js} +1 -3
  6. package/{react-native → dist/react-native}/analytics/useLogEvent.js +1 -1
  7. package/{react-native → dist/react-native}/analytics/useSetAnalyticsCollectionEnabled.js +1 -1
  8. package/dist/react-native/auth/index.d.ts +19 -0
  9. package/dist/react-native/auth/index.js +19 -0
  10. package/{react-native/auth/useAuth.ts → dist/react-native/auth/useAuth.js} +1 -3
  11. package/{react-native → dist/react-native}/auth/useAuthStateReady.js +1 -1
  12. package/{react-native → dist/react-native}/auth/useCreateUserWitEmailAndPasswordMutation.js +2 -2
  13. package/{react-native → dist/react-native}/auth/useCurrentUser.js +1 -1
  14. package/{react-native → dist/react-native}/auth/useIdToken.js +2 -2
  15. package/{react-native → dist/react-native}/auth/useLinkWithCredentialMutation.js +1 -1
  16. package/{react-native → dist/react-native}/auth/useReauthenticateWitCredentialMutation.js +1 -1
  17. package/{react-native → dist/react-native}/auth/useReauthenticateWitRedirectMutation.js +1 -1
  18. package/{react-native → dist/react-native}/auth/useSendEmailVerificationMutation.js +1 -1
  19. package/{react-native → dist/react-native}/auth/useSignInAnonymouslyMutation.js +2 -2
  20. package/{react-native → dist/react-native}/auth/useSignInWitEmailAndPasswordMutation.js +2 -2
  21. package/{react-native → dist/react-native}/auth/useSignInWitRedirectMutation.js +2 -2
  22. package/{react-native → dist/react-native}/auth/useSignInWithCredentialMutation.js +2 -2
  23. package/{react-native → dist/react-native}/auth/useSignOutMutation.js +2 -2
  24. package/{react-native → dist/react-native}/auth/useUpdateProfileMutation.js +1 -1
  25. package/{react-native → dist/react-native}/context/FirebaseContextProvider.js +1 -1
  26. package/dist/react-native/context/index.d.ts +1 -0
  27. package/dist/react-native/context/index.js +1 -0
  28. package/dist/react-native/firestore/index.d.ts +23 -0
  29. package/dist/react-native/firestore/index.js +23 -0
  30. package/{react-native → dist/react-native}/firestore/useAddDocMutation.d.ts +1 -1
  31. package/{react-native → dist/react-native}/firestore/useBatchWrite.js +1 -1
  32. package/{react-native → dist/react-native}/firestore/useCollectionReference.d.ts +1 -1
  33. package/{react-native → dist/react-native}/firestore/useCollectionReference.js +1 -1
  34. package/{react-native → dist/react-native}/firestore/useCompositeFilter.d.ts +2 -2
  35. package/{react-native → dist/react-native}/firestore/useCompositeFilter.js +1 -1
  36. package/{react-native → dist/react-native}/firestore/useCountQuery.d.ts +2 -2
  37. package/{react-native → dist/react-native}/firestore/useDeleteDocMutation.d.ts +1 -1
  38. package/{react-native → dist/react-native}/firestore/useDocReference.d.ts +2 -2
  39. package/{react-native → dist/react-native}/firestore/useDocReference.js +2 -2
  40. package/{react-native → dist/react-native}/firestore/useDocReferences.d.ts +2 -2
  41. package/{react-native → dist/react-native}/firestore/useDocReferences.js +2 -2
  42. package/{web → dist/react-native}/firestore/useEnsureDoc.d.ts +2 -2
  43. package/{react-native → dist/react-native}/firestore/useEnsureDoc.js +3 -3
  44. package/{react-native/firestore/useFirestore.ts → dist/react-native/firestore/useFirestore.js} +1 -2
  45. package/{react-native → dist/react-native}/firestore/useGetDocData.d.ts +2 -2
  46. package/{web → dist/react-native}/firestore/useGetDocData.js +2 -2
  47. package/{react-native → dist/react-native}/firestore/useGetRealtimeDocData.d.ts +1 -1
  48. package/{react-native → dist/react-native}/firestore/useGetRealtimeDocData.js +1 -1
  49. package/{react-native → dist/react-native}/firestore/useInfiniteQuery.d.ts +2 -2
  50. package/{react-native → dist/react-native}/firestore/useQuery.d.ts +2 -2
  51. package/{react-native → dist/react-native}/firestore/useQueryConstraints.d.ts +2 -2
  52. package/{react-native → dist/react-native}/firestore/useQueryConstraints.js +1 -1
  53. package/{react-native → dist/react-native}/firestore/useRunTransaction.js +1 -1
  54. package/{react-native → dist/react-native}/firestore/useSetDocMutation.d.ts +1 -1
  55. package/{react-native → dist/react-native}/firestore/useUpdateDocMutation.d.ts +1 -1
  56. package/{react-native → dist/react-native}/firestore/utils/buildCompositeFilter.d.ts +1 -1
  57. package/{react-native → dist/react-native}/firestore/utils/buildQueryConstraint.d.ts +1 -1
  58. package/{react-native → dist/react-native}/firestore/utils/getDocData.d.ts +2 -2
  59. package/{react-native → dist/react-native}/firestore/utils/getDocData.js +1 -1
  60. package/{react-native → dist/react-native}/firestore/utils/getDocRef.d.ts +1 -1
  61. package/{react-native → dist/react-native}/firestore/utils/getDocSnap.d.ts +2 -2
  62. package/{react-native → dist/react-native}/firestore/utils/getDocSnap.js +1 -1
  63. package/dist/react-native/index.d.ts +1 -0
  64. package/dist/react-native/index.js +1 -0
  65. package/dist/react-native/remoteConfig/index.d.ts +3 -0
  66. package/dist/react-native/remoteConfig/index.js +3 -0
  67. package/{react-native → dist/react-native}/remoteConfig/useFetchAndActivate.js +1 -1
  68. package/{react-native → dist/react-native}/remoteConfig/useGetValue.js +1 -1
  69. package/{react-native/remoteConfig/useRemoteConfig.ts → dist/react-native/remoteConfig/useRemoteConfig.js} +1 -2
  70. package/{types → dist/types}/QueryConstraints.d.ts +1 -1
  71. package/dist/types/index.d.ts +2 -0
  72. package/dist/types/index.js +2 -0
  73. package/dist/web/analytics/index.d.ts +3 -0
  74. package/dist/web/analytics/index.js +3 -0
  75. package/{web/analytics/useAnalytics.ts → dist/web/analytics/useAnalytics.js} +1 -3
  76. package/{web → dist/web}/analytics/useLogEvent.js +1 -1
  77. package/{web → dist/web}/analytics/useSetAnalyticsCollectionEnabled.js +1 -1
  78. package/dist/web/auth/index.d.ts +20 -0
  79. package/dist/web/auth/index.js +20 -0
  80. package/{web/auth/useAuth.ts → dist/web/auth/useAuth.js} +1 -3
  81. package/{web → dist/web}/auth/useAuthStateReady.js +1 -1
  82. package/{web → dist/web}/auth/useCreateUserWitEmailAndPasswordMutation.js +2 -2
  83. package/{web → dist/web}/auth/useCurrentUser.js +1 -1
  84. package/{web → dist/web}/auth/useGetRedirectResultMutation.js +2 -2
  85. package/{web → dist/web}/auth/useIdToken.js +2 -2
  86. package/{web → dist/web}/auth/useLinkWithCredentialMutation.js +1 -1
  87. package/{web → dist/web}/auth/useReauthenticateWitCredentialMutation.js +1 -1
  88. package/{web → dist/web}/auth/useReauthenticateWitRedirectMutation.js +1 -1
  89. package/{web → dist/web}/auth/useSendEmailVerificationMutation.js +1 -1
  90. package/{web → dist/web}/auth/useSignInAnonymouslyMutation.js +2 -2
  91. package/{web → dist/web}/auth/useSignInWitEmailAndPasswordMutation.js +2 -2
  92. package/{web → dist/web}/auth/useSignInWitRedirectMutation.js +2 -2
  93. package/{web → dist/web}/auth/useSignInWithCredentialMutation.js +2 -2
  94. package/{web → dist/web}/auth/useSignOutMutation.js +2 -2
  95. package/{web → dist/web}/auth/useUpdateProfileMutation.js +1 -1
  96. package/{web → dist/web}/context/FirebaseContextProvider.js +1 -1
  97. package/dist/web/context/index.d.ts +1 -0
  98. package/dist/web/context/index.js +1 -0
  99. package/dist/web/firestore/index.d.ts +23 -0
  100. package/dist/web/firestore/index.js +23 -0
  101. package/{web → dist/web}/firestore/useAddDocMutation.d.ts +1 -1
  102. package/{web → dist/web}/firestore/useBatchWrite.js +1 -1
  103. package/{web → dist/web}/firestore/useCollectionReference.d.ts +1 -1
  104. package/{web → dist/web}/firestore/useCollectionReference.js +1 -1
  105. package/{web → dist/web}/firestore/useCompositeFilter.d.ts +2 -2
  106. package/{web → dist/web}/firestore/useCompositeFilter.js +1 -1
  107. package/{web → dist/web}/firestore/useCountQuery.d.ts +2 -2
  108. package/{web → dist/web}/firestore/useDeleteDocMutation.d.ts +1 -1
  109. package/{web → dist/web}/firestore/useDocReference.d.ts +2 -2
  110. package/{web → dist/web}/firestore/useDocReference.js +2 -2
  111. package/{web → dist/web}/firestore/useDocReferences.d.ts +2 -2
  112. package/{web → dist/web}/firestore/useDocReferences.js +2 -2
  113. package/{react-native → dist/web}/firestore/useEnsureDoc.d.ts +2 -2
  114. package/{web → dist/web}/firestore/useEnsureDoc.js +3 -3
  115. package/{web/firestore/useFirestore.ts → dist/web/firestore/useFirestore.js} +1 -2
  116. package/{web → dist/web}/firestore/useGetDocData.d.ts +2 -2
  117. package/{react-native → dist/web}/firestore/useGetDocData.js +2 -2
  118. package/{web → dist/web}/firestore/useGetRealtimeDocData.d.ts +1 -1
  119. package/{web → dist/web}/firestore/useGetRealtimeDocData.js +1 -1
  120. package/{web → dist/web}/firestore/useInfiniteQuery.d.ts +2 -2
  121. package/{web → dist/web}/firestore/useQuery.d.ts +2 -2
  122. package/{web → dist/web}/firestore/useQueryConstraints.d.ts +2 -2
  123. package/{web → dist/web}/firestore/useQueryConstraints.js +1 -1
  124. package/{web → dist/web}/firestore/useRunTransaction.js +1 -1
  125. package/{web → dist/web}/firestore/useSetDocMutation.d.ts +1 -1
  126. package/{web → dist/web}/firestore/useUpdateDocMutation.d.ts +1 -1
  127. package/{web → dist/web}/firestore/utils/buildCompositeFilter.d.ts +1 -1
  128. package/{web → dist/web}/firestore/utils/buildQueryConstraint.d.ts +1 -1
  129. package/{web → dist/web}/firestore/utils/getDocData.d.ts +2 -2
  130. package/{web → dist/web}/firestore/utils/getDocData.js +1 -1
  131. package/{web → dist/web}/firestore/utils/getDocRef.d.ts +1 -1
  132. package/{web → dist/web}/firestore/utils/getDocSnap.d.ts +2 -2
  133. package/{web → dist/web}/firestore/utils/getDocSnap.js +1 -1
  134. package/dist/web/index.d.ts +1 -0
  135. package/dist/web/index.js +1 -0
  136. package/dist/web/remoteConfig/index.d.ts +3 -0
  137. package/dist/web/remoteConfig/index.js +3 -0
  138. package/{web → dist/web}/remoteConfig/useFetchAndActivate.js +1 -1
  139. package/{web → dist/web}/remoteConfig/useGetValue.js +1 -1
  140. package/{web/remoteConfig/useRemoteConfig.ts → dist/web/remoteConfig/useRemoteConfig.js} +1 -2
  141. package/package.json +37 -17
  142. package/react-native/analytics/index.d.ts +0 -3
  143. package/react-native/analytics/index.js +0 -3
  144. package/react-native/analytics/index.ts +0 -3
  145. package/react-native/analytics/useAnalytics.js +0 -10
  146. package/react-native/analytics/useLogEvent.ts +0 -34
  147. package/react-native/analytics/useSetAnalyticsCollectionEnabled.ts +0 -22
  148. package/react-native/auth/index.d.ts +0 -19
  149. package/react-native/auth/index.js +0 -19
  150. package/react-native/auth/index.ts +0 -19
  151. package/react-native/auth/mutation-keys.ts +0 -22
  152. package/react-native/auth/useAppleAuthProviderCredential.ts +0 -31
  153. package/react-native/auth/useAuth.js +0 -10
  154. package/react-native/auth/useAuthStateReady.ts +0 -39
  155. package/react-native/auth/useCreateUserWitEmailAndPasswordMutation.ts +0 -38
  156. package/react-native/auth/useCurrentUser.ts +0 -26
  157. package/react-native/auth/useEmailAuthProviderCredential.ts +0 -38
  158. package/react-native/auth/useFacebookAuthProviderCredential.ts +0 -31
  159. package/react-native/auth/useIdToken.ts +0 -83
  160. package/react-native/auth/useLinkWithCredentialMutation.ts +0 -35
  161. package/react-native/auth/useReauthenticateWitCredentialMutation.ts +0 -36
  162. package/react-native/auth/useReauthenticateWitRedirectMutation.ts +0 -42
  163. package/react-native/auth/useSendEmailVerificationMutation.ts +0 -33
  164. package/react-native/auth/useSignInAnonymouslyMutation.ts +0 -52
  165. package/react-native/auth/useSignInWitEmailAndPasswordMutation.ts +0 -39
  166. package/react-native/auth/useSignInWitRedirectMutation.ts +0 -38
  167. package/react-native/auth/useSignInWithCredentialMutation.ts +0 -36
  168. package/react-native/auth/useSignOutMutation.ts +0 -28
  169. package/react-native/auth/useUpdateProfileMutation.ts +0 -30
  170. package/react-native/context/FirebaseContext.ts +0 -25
  171. package/react-native/context/FirebaseContextProvider.tsx +0 -264
  172. package/react-native/context/index.d.ts +0 -1
  173. package/react-native/context/index.js +0 -1
  174. package/react-native/context/index.ts +0 -1
  175. package/react-native/firestore/index.d.ts +0 -23
  176. package/react-native/firestore/index.js +0 -23
  177. package/react-native/firestore/index.ts +0 -23
  178. package/react-native/firestore/useAddDocMutation.ts +0 -80
  179. package/react-native/firestore/useBatchWrite.ts +0 -58
  180. package/react-native/firestore/useCollectionReference.ts +0 -58
  181. package/react-native/firestore/useCompositeFilter.ts +0 -60
  182. package/react-native/firestore/useCountQuery.ts +0 -85
  183. package/react-native/firestore/useDeleteDocMutation.ts +0 -71
  184. package/react-native/firestore/useDocReference.ts +0 -42
  185. package/react-native/firestore/useDocReferences.ts +0 -40
  186. package/react-native/firestore/useEnsureDoc.ts +0 -79
  187. package/react-native/firestore/useFirestore.js +0 -13
  188. package/react-native/firestore/useGetDocData.ts +0 -52
  189. package/react-native/firestore/useGetRealtimeDocData.ts +0 -106
  190. package/react-native/firestore/useInfiniteQuery.ts +0 -115
  191. package/react-native/firestore/useQuery.ts +0 -89
  192. package/react-native/firestore/useQueryConstraints.ts +0 -44
  193. package/react-native/firestore/useRunTransaction.ts +0 -55
  194. package/react-native/firestore/useSetDocMutation.ts +0 -76
  195. package/react-native/firestore/useUpdateDocMutation.ts +0 -77
  196. package/react-native/firestore/utils/buildCompositeFilter.ts +0 -75
  197. package/react-native/firestore/utils/buildQueryConstraint.ts +0 -54
  198. package/react-native/firestore/utils/getDocData.ts +0 -33
  199. package/react-native/firestore/utils/getDocRef.ts +0 -41
  200. package/react-native/firestore/utils/getDocSnap.ts +0 -34
  201. package/react-native/index.d.ts +0 -1
  202. package/react-native/index.js +0 -1
  203. package/react-native/index.ts +0 -1
  204. package/react-native/remoteConfig/index.d.ts +0 -3
  205. package/react-native/remoteConfig/index.js +0 -3
  206. package/react-native/remoteConfig/index.ts +0 -3
  207. package/react-native/remoteConfig/useFetchAndActivate.ts +0 -36
  208. package/react-native/remoteConfig/useGetValue.ts +0 -16
  209. package/react-native/remoteConfig/useRemoteConfig.js +0 -10
  210. package/types/AppModel.ts +0 -10
  211. package/types/QueryConstraints.ts +0 -57
  212. package/types/index.d.ts +0 -2
  213. package/types/index.js +0 -2
  214. package/types/index.ts +0 -2
  215. package/web/analytics/index.d.ts +0 -3
  216. package/web/analytics/index.js +0 -3
  217. package/web/analytics/index.ts +0 -3
  218. package/web/analytics/useAnalytics.js +0 -10
  219. package/web/analytics/useLogEvent.ts +0 -34
  220. package/web/analytics/useSetAnalyticsCollectionEnabled.ts +0 -22
  221. package/web/auth/index.d.ts +0 -20
  222. package/web/auth/index.js +0 -20
  223. package/web/auth/index.ts +0 -20
  224. package/web/auth/mutation-keys.ts +0 -23
  225. package/web/auth/useAppleAuthProviderCredential.ts +0 -32
  226. package/web/auth/useAuth.js +0 -10
  227. package/web/auth/useAuthStateReady.ts +0 -30
  228. package/web/auth/useCreateUserWitEmailAndPasswordMutation.ts +0 -33
  229. package/web/auth/useCurrentUser.ts +0 -25
  230. package/web/auth/useEmailAuthProviderCredential.ts +0 -38
  231. package/web/auth/useFacebookAuthProviderCredential.ts +0 -31
  232. package/web/auth/useGetRedirectResultMutation.ts +0 -27
  233. package/web/auth/useIdToken.ts +0 -83
  234. package/web/auth/useLinkWithCredentialMutation.ts +0 -30
  235. package/web/auth/useReauthenticateWitCredentialMutation.ts +0 -31
  236. package/web/auth/useReauthenticateWitRedirectMutation.ts +0 -37
  237. package/web/auth/useSendEmailVerificationMutation.ts +0 -28
  238. package/web/auth/useSignInAnonymouslyMutation.ts +0 -49
  239. package/web/auth/useSignInWitEmailAndPasswordMutation.ts +0 -34
  240. package/web/auth/useSignInWitRedirectMutation.ts +0 -33
  241. package/web/auth/useSignInWithCredentialMutation.ts +0 -31
  242. package/web/auth/useSignOutMutation.ts +0 -25
  243. package/web/auth/useUpdateProfileMutation.ts +0 -30
  244. package/web/context/FirebaseContext.ts +0 -25
  245. package/web/context/FirebaseContextProvider.tsx +0 -263
  246. package/web/context/index.d.ts +0 -1
  247. package/web/context/index.js +0 -1
  248. package/web/context/index.ts +0 -1
  249. package/web/firestore/index.d.ts +0 -23
  250. package/web/firestore/index.js +0 -23
  251. package/web/firestore/index.ts +0 -23
  252. package/web/firestore/useAddDocMutation.ts +0 -74
  253. package/web/firestore/useBatchWrite.ts +0 -58
  254. package/web/firestore/useCollectionReference.ts +0 -58
  255. package/web/firestore/useCompositeFilter.ts +0 -55
  256. package/web/firestore/useCountQuery.ts +0 -90
  257. package/web/firestore/useDeleteDocMutation.ts +0 -69
  258. package/web/firestore/useDocReference.ts +0 -43
  259. package/web/firestore/useDocReferences.ts +0 -40
  260. package/web/firestore/useEnsureDoc.ts +0 -92
  261. package/web/firestore/useFirestore.js +0 -13
  262. package/web/firestore/useGetDocData.ts +0 -52
  263. package/web/firestore/useGetRealtimeDocData.ts +0 -105
  264. package/web/firestore/useInfiniteQuery.ts +0 -117
  265. package/web/firestore/useQuery.ts +0 -94
  266. package/web/firestore/useQueryConstraints.ts +0 -44
  267. package/web/firestore/useRunTransaction.ts +0 -56
  268. package/web/firestore/useSetDocMutation.ts +0 -77
  269. package/web/firestore/useUpdateDocMutation.ts +0 -78
  270. package/web/firestore/utils/buildCompositeFilter.ts +0 -73
  271. package/web/firestore/utils/buildQueryConstraint.ts +0 -55
  272. package/web/firestore/utils/getDocData.ts +0 -33
  273. package/web/firestore/utils/getDocRef.ts +0 -43
  274. package/web/firestore/utils/getDocSnap.ts +0 -34
  275. package/web/index.d.ts +0 -1
  276. package/web/index.js +0 -1
  277. package/web/index.ts +0 -1
  278. package/web/remoteConfig/index.d.ts +0 -3
  279. package/web/remoteConfig/index.js +0 -3
  280. package/web/remoteConfig/index.ts +0 -3
  281. package/web/remoteConfig/useFetchAndActivate.ts +0 -36
  282. package/web/remoteConfig/useGetValue.ts +0 -16
  283. package/web/remoteConfig/useRemoteConfig.js +0 -10
  284. /package/{react-native → dist/react-native}/analytics/useAnalytics.d.ts +0 -0
  285. /package/{react-native → dist/react-native}/analytics/useLogEvent.d.ts +0 -0
  286. /package/{react-native → dist/react-native}/analytics/useSetAnalyticsCollectionEnabled.d.ts +0 -0
  287. /package/{react-native → dist/react-native}/auth/mutation-keys.d.ts +0 -0
  288. /package/{react-native → dist/react-native}/auth/mutation-keys.js +0 -0
  289. /package/{react-native → dist/react-native}/auth/useAppleAuthProviderCredential.d.ts +0 -0
  290. /package/{react-native → dist/react-native}/auth/useAppleAuthProviderCredential.js +0 -0
  291. /package/{react-native → dist/react-native}/auth/useAuth.d.ts +0 -0
  292. /package/{react-native → dist/react-native}/auth/useAuthStateReady.d.ts +0 -0
  293. /package/{react-native → dist/react-native}/auth/useCreateUserWitEmailAndPasswordMutation.d.ts +0 -0
  294. /package/{react-native → dist/react-native}/auth/useCurrentUser.d.ts +0 -0
  295. /package/{react-native → dist/react-native}/auth/useEmailAuthProviderCredential.d.ts +0 -0
  296. /package/{react-native → dist/react-native}/auth/useEmailAuthProviderCredential.js +0 -0
  297. /package/{react-native → dist/react-native}/auth/useFacebookAuthProviderCredential.d.ts +0 -0
  298. /package/{react-native → dist/react-native}/auth/useFacebookAuthProviderCredential.js +0 -0
  299. /package/{react-native → dist/react-native}/auth/useIdToken.d.ts +0 -0
  300. /package/{react-native → dist/react-native}/auth/useLinkWithCredentialMutation.d.ts +0 -0
  301. /package/{react-native → dist/react-native}/auth/useReauthenticateWitCredentialMutation.d.ts +0 -0
  302. /package/{react-native → dist/react-native}/auth/useReauthenticateWitRedirectMutation.d.ts +0 -0
  303. /package/{react-native → dist/react-native}/auth/useSendEmailVerificationMutation.d.ts +0 -0
  304. /package/{react-native → dist/react-native}/auth/useSignInAnonymouslyMutation.d.ts +0 -0
  305. /package/{react-native → dist/react-native}/auth/useSignInWitEmailAndPasswordMutation.d.ts +0 -0
  306. /package/{react-native → dist/react-native}/auth/useSignInWitRedirectMutation.d.ts +0 -0
  307. /package/{react-native → dist/react-native}/auth/useSignInWithCredentialMutation.d.ts +0 -0
  308. /package/{react-native → dist/react-native}/auth/useSignOutMutation.d.ts +0 -0
  309. /package/{react-native → dist/react-native}/auth/useUpdateProfileMutation.d.ts +0 -0
  310. /package/{react-native → dist/react-native}/context/FirebaseContext.d.ts +0 -0
  311. /package/{react-native → dist/react-native}/context/FirebaseContext.js +0 -0
  312. /package/{react-native → dist/react-native}/context/FirebaseContextProvider.d.ts +0 -0
  313. /package/{react-native → dist/react-native}/firestore/useAddDocMutation.js +0 -0
  314. /package/{react-native → dist/react-native}/firestore/useBatchWrite.d.ts +0 -0
  315. /package/{react-native → dist/react-native}/firestore/useCountQuery.js +0 -0
  316. /package/{react-native → dist/react-native}/firestore/useDeleteDocMutation.js +0 -0
  317. /package/{react-native → dist/react-native}/firestore/useFirestore.d.ts +0 -0
  318. /package/{react-native → dist/react-native}/firestore/useInfiniteQuery.js +0 -0
  319. /package/{react-native → dist/react-native}/firestore/useQuery.js +0 -0
  320. /package/{react-native → dist/react-native}/firestore/useRunTransaction.d.ts +0 -0
  321. /package/{react-native → dist/react-native}/firestore/useSetDocMutation.js +0 -0
  322. /package/{react-native → dist/react-native}/firestore/useUpdateDocMutation.js +0 -0
  323. /package/{react-native → dist/react-native}/firestore/utils/buildCompositeFilter.js +0 -0
  324. /package/{react-native → dist/react-native}/firestore/utils/buildQueryConstraint.js +0 -0
  325. /package/{react-native → dist/react-native}/firestore/utils/getDocRef.js +0 -0
  326. /package/{react-native → dist/react-native}/remoteConfig/useFetchAndActivate.d.ts +0 -0
  327. /package/{react-native → dist/react-native}/remoteConfig/useGetValue.d.ts +0 -0
  328. /package/{react-native → dist/react-native}/remoteConfig/useRemoteConfig.d.ts +0 -0
  329. /package/{types → dist/types}/AppModel.d.ts +0 -0
  330. /package/{types → dist/types}/AppModel.js +0 -0
  331. /package/{types → dist/types}/QueryConstraints.js +0 -0
  332. /package/{web → dist/web}/analytics/useAnalytics.d.ts +0 -0
  333. /package/{web → dist/web}/analytics/useLogEvent.d.ts +0 -0
  334. /package/{web → dist/web}/analytics/useSetAnalyticsCollectionEnabled.d.ts +0 -0
  335. /package/{web → dist/web}/auth/mutation-keys.d.ts +0 -0
  336. /package/{web → dist/web}/auth/mutation-keys.js +0 -0
  337. /package/{web → dist/web}/auth/useAppleAuthProviderCredential.d.ts +0 -0
  338. /package/{web → dist/web}/auth/useAppleAuthProviderCredential.js +0 -0
  339. /package/{web → dist/web}/auth/useAuth.d.ts +0 -0
  340. /package/{web → dist/web}/auth/useAuthStateReady.d.ts +0 -0
  341. /package/{web → dist/web}/auth/useCreateUserWitEmailAndPasswordMutation.d.ts +0 -0
  342. /package/{web → dist/web}/auth/useCurrentUser.d.ts +0 -0
  343. /package/{web → dist/web}/auth/useEmailAuthProviderCredential.d.ts +0 -0
  344. /package/{web → dist/web}/auth/useEmailAuthProviderCredential.js +0 -0
  345. /package/{web → dist/web}/auth/useFacebookAuthProviderCredential.d.ts +0 -0
  346. /package/{web → dist/web}/auth/useFacebookAuthProviderCredential.js +0 -0
  347. /package/{web → dist/web}/auth/useGetRedirectResultMutation.d.ts +0 -0
  348. /package/{web → dist/web}/auth/useIdToken.d.ts +0 -0
  349. /package/{web → dist/web}/auth/useLinkWithCredentialMutation.d.ts +0 -0
  350. /package/{web → dist/web}/auth/useReauthenticateWitCredentialMutation.d.ts +0 -0
  351. /package/{web → dist/web}/auth/useReauthenticateWitRedirectMutation.d.ts +0 -0
  352. /package/{web → dist/web}/auth/useSendEmailVerificationMutation.d.ts +0 -0
  353. /package/{web → dist/web}/auth/useSignInAnonymouslyMutation.d.ts +0 -0
  354. /package/{web → dist/web}/auth/useSignInWitEmailAndPasswordMutation.d.ts +0 -0
  355. /package/{web → dist/web}/auth/useSignInWitRedirectMutation.d.ts +0 -0
  356. /package/{web → dist/web}/auth/useSignInWithCredentialMutation.d.ts +0 -0
  357. /package/{web → dist/web}/auth/useSignOutMutation.d.ts +0 -0
  358. /package/{web → dist/web}/auth/useUpdateProfileMutation.d.ts +0 -0
  359. /package/{web → dist/web}/context/FirebaseContext.d.ts +0 -0
  360. /package/{web → dist/web}/context/FirebaseContext.js +0 -0
  361. /package/{web → dist/web}/context/FirebaseContextProvider.d.ts +0 -0
  362. /package/{web → dist/web}/firestore/useAddDocMutation.js +0 -0
  363. /package/{web → dist/web}/firestore/useBatchWrite.d.ts +0 -0
  364. /package/{web → dist/web}/firestore/useCountQuery.js +0 -0
  365. /package/{web → dist/web}/firestore/useDeleteDocMutation.js +0 -0
  366. /package/{web → dist/web}/firestore/useFirestore.d.ts +0 -0
  367. /package/{web → dist/web}/firestore/useInfiniteQuery.js +0 -0
  368. /package/{web → dist/web}/firestore/useQuery.js +0 -0
  369. /package/{web → dist/web}/firestore/useRunTransaction.d.ts +0 -0
  370. /package/{web → dist/web}/firestore/useSetDocMutation.js +0 -0
  371. /package/{web → dist/web}/firestore/useUpdateDocMutation.js +0 -0
  372. /package/{web → dist/web}/firestore/utils/buildCompositeFilter.js +0 -0
  373. /package/{web → dist/web}/firestore/utils/buildQueryConstraint.js +0 -0
  374. /package/{web → dist/web}/firestore/utils/getDocRef.js +0 -0
  375. /package/{web → dist/web}/remoteConfig/useFetchAndActivate.d.ts +0 -0
  376. /package/{web → dist/web}/remoteConfig/useGetValue.d.ts +0 -0
  377. /package/{web → dist/web}/remoteConfig/useRemoteConfig.d.ts +0 -0
@@ -1,34 +0,0 @@
1
- import { logEvent } from "firebase/analytics";
2
- import { useCallback, useMemo } from "react";
3
- import { useAnalytics } from "./useAnalytics";
4
-
5
- type UseLogEventOptions = {
6
- eventName: string;
7
- eventParams?: {
8
- [key: string]: unknown;
9
- };
10
- };
11
-
12
- /**
13
- * Custom hook to create a log event function that logs an analytics event with specified parameters.
14
- * @param {Object} options - The options for the log event.
15
- * @param {string} options.eventName - The name of the event to be logged.
16
- * @param {Object} options.eventParams - The parameters to be sent along with the event.
17
- * @returns {Object} An object containing a `logEvent` function that, when called, logs the event.
18
- */
19
- export const useLogEvent = ({ eventName, eventParams }: UseLogEventOptions) => {
20
- const analytics = useAnalytics();
21
-
22
- const logEventCallback = useCallback(() => {
23
- if (analytics) {
24
- logEvent(analytics, eventName, eventParams);
25
- }
26
- }, [eventName, eventParams, analytics]);
27
-
28
- return useMemo(
29
- () => ({
30
- logEvent: logEventCallback
31
- }),
32
- [logEventCallback]
33
- );
34
- };
@@ -1,22 +0,0 @@
1
- import { setAnalyticsCollectionEnabled } from "firebase/analytics";
2
- import { useEffect } from "react";
3
- import { useAnalytics } from "./useAnalytics";
4
-
5
- type UseSetAnalyticsCollectionEnabledOptions = {
6
- enabled?: boolean;
7
- };
8
-
9
- /**
10
- * Custom hook to enable or disable analytics collection
11
- * @param {Object} options - The options for hook.
12
- * @param {string} options.enabled - Flag that identifies if analytics collection is enabled.
13
- */
14
- export const useSetAnalyticsCollectionEnabled = ({ enabled = false }: UseSetAnalyticsCollectionEnabledOptions) => {
15
- const analytics = useAnalytics();
16
-
17
- useEffect(() => {
18
- if (analytics) {
19
- setAnalyticsCollectionEnabled(analytics, enabled);
20
- }
21
- }, [analytics, enabled]);
22
- };
@@ -1,20 +0,0 @@
1
- export * from "./mutation-keys";
2
- export * from "./useAuth";
3
- export * from "./useCreateUserWitEmailAndPasswordMutation";
4
- export * from "./useSendEmailVerificationMutation";
5
- export * from "./useSignInWitEmailAndPasswordMutation";
6
- export * from "./useCurrentUser";
7
- export * from "./useAuthStateReady";
8
- export * from "./useSignInWitRedirectMutation";
9
- export * from "./useUpdateProfileMutation";
10
- export * from "./useSignOutMutation";
11
- export * from "./useIdToken";
12
- export * from "./useReauthenticateWitCredentialMutation";
13
- export * from "./useReauthenticateWitRedirectMutation";
14
- export * from "./useSignInAnonymouslyMutation";
15
- export * from "./useEmailAuthProviderCredential";
16
- export * from "./useFacebookAuthProviderCredential";
17
- export * from "./useAppleAuthProviderCredential";
18
- export * from "./useLinkWithCredentialMutation";
19
- export * from "./useSignInWithCredentialMutation";
20
- export * from "./useGetRedirectResultMutation";
package/web/auth/index.js DELETED
@@ -1,20 +0,0 @@
1
- export * from "./mutation-keys";
2
- export * from "./useAuth";
3
- export * from "./useCreateUserWitEmailAndPasswordMutation";
4
- export * from "./useSendEmailVerificationMutation";
5
- export * from "./useSignInWitEmailAndPasswordMutation";
6
- export * from "./useCurrentUser";
7
- export * from "./useAuthStateReady";
8
- export * from "./useSignInWitRedirectMutation";
9
- export * from "./useUpdateProfileMutation";
10
- export * from "./useSignOutMutation";
11
- export * from "./useIdToken";
12
- export * from "./useReauthenticateWitCredentialMutation";
13
- export * from "./useReauthenticateWitRedirectMutation";
14
- export * from "./useSignInAnonymouslyMutation";
15
- export * from "./useEmailAuthProviderCredential";
16
- export * from "./useFacebookAuthProviderCredential";
17
- export * from "./useAppleAuthProviderCredential";
18
- export * from "./useLinkWithCredentialMutation";
19
- export * from "./useSignInWithCredentialMutation";
20
- export * from "./useGetRedirectResultMutation";
package/web/auth/index.ts DELETED
@@ -1,20 +0,0 @@
1
- export * from "./mutation-keys";
2
- export * from "./useAuth";
3
- export * from "./useCreateUserWitEmailAndPasswordMutation";
4
- export * from "./useSendEmailVerificationMutation";
5
- export * from "./useSignInWitEmailAndPasswordMutation";
6
- export * from "./useCurrentUser";
7
- export * from "./useAuthStateReady";
8
- export * from "./useSignInWitRedirectMutation";
9
- export * from "./useUpdateProfileMutation";
10
- export * from "./useSignOutMutation";
11
- export * from "./useIdToken";
12
- export * from "./useReauthenticateWitCredentialMutation";
13
- export * from "./useReauthenticateWitRedirectMutation";
14
- export * from "./useSignInAnonymouslyMutation";
15
- export * from "./useEmailAuthProviderCredential";
16
- export * from "./useFacebookAuthProviderCredential";
17
- export * from "./useAppleAuthProviderCredential";
18
- export * from "./useLinkWithCredentialMutation";
19
- export * from "./useSignInWithCredentialMutation";
20
- export * from "./useGetRedirectResultMutation";
@@ -1,23 +0,0 @@
1
- export const CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY = [
2
- "FIREBASE",
3
- "AUTH",
4
- "CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION"
5
- ] as const;
6
- export const GET_REDIRECT_RESULT_MUTATION_KEY = ["FIREBASE", "AUTH", "GET_REDIRECT_RESULT_MUTATION"] as const;
7
- export const SEND_EMAIL_VERIFICATION_MUTATION_KEY = ["FIREBASE", "AUTH", "SEND_EMAIL_VERIFICATION_MUTATION"] as const;
8
- export const SIGN_IN_ANONYMOUSLY_MUTATION_KEY = ["FIREBASE", "AUTH", "SIGN_IN_ANONYMOUSLY_MUTATION"] as const;
9
- export const SIGN_IN_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY = [
10
- "FIREBASE",
11
- "AUTH",
12
- "SIGN_IN_WITH_EMAIL_AND_PASSWORD_MUTATION"
13
- ] as const;
14
- export const SIGN_IN_WITH_REDIRECT_MUTATION_KEY = ["FIREBASE", "AUTH", "SIGN_IN_WITH_REDIRECT_MUTATION"] as const;
15
- export const SIGN_IN_WITH_CREDENTIAL_MUTATION_KEY = ["FIREBASE", "AUTH", "SIGN_IN_WITH_CREDENTIAL_MUTATION"] as const;
16
- export const LINK_WITH_CREDENTIAL_MUTATION_KEY = ["FIREBASE", "AUTH", "LINK_WITH_CREDENTIAL_MUTATION"] as const;
17
- export const SIGN_OUT_MUTATION_KEY = ["FIREBASE", "AUTH", "SIGN_OUT"] as const;
18
- export const REAUTHENTICATE_WITH_REDIRECT_MUTATION_KEY = ["FIREBASE", "AUTH", "REAUTHENTICATE_WITH_REDIRECT"] as const;
19
- export const REAUTHENTICATE_WITH_CREDENTIAL_MUTATION_KEY = [
20
- "FIREBASE",
21
- "AUTH",
22
- "REAUTHENTICATE_WITH_CREDENTIAL"
23
- ] as const;
@@ -1,32 +0,0 @@
1
- import { AuthCredential, OAuthProvider } from "firebase/auth";
2
- import { useCallback } from "react";
3
-
4
- type Credential = {
5
- token: string;
6
- nonce: string;
7
- };
8
-
9
- /**
10
- * A custom hook that returns an auth credential for facebook.
11
- *
12
- * @group Hook
13
- * @param {AuthProvider} provider alas of a provider
14
- *
15
- * @returns {AuthCredential}
16
- *
17
- * @example
18
- * ```jsx
19
- * export const MyComponent = () => {
20
- * const getCredential = useAppleAuthProviderCredential();
21
- * // ...
22
- * getCredential({token, nonce: ''})
23
- * };
24
- * ```
25
- */
26
-
27
- export const useAppleAuthProviderCredential = () => {
28
- return useCallback((credential: Credential): AuthCredential => {
29
- const authProvider = new OAuthProvider("apple.com");
30
- return authProvider.credential({ accessToken: credential.token, rawNonce: credential.nonce });
31
- }, []);
32
- };
@@ -1,10 +0,0 @@
1
- import { useContext } from "react";
2
- import { FirebaseContext } from "../context/FirebaseContext";
3
- /**
4
- * Custom hook to retrieve the authentication object from the Firebase context.
5
- * @returns {Auth} The authentication object from the Firebase context.
6
- */
7
- export const useAuth = () => {
8
- const { auth } = useContext(FirebaseContext);
9
- return auth;
10
- };
@@ -1,30 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { useAuth } from "./useAuth";
3
-
4
- /**
5
- * A custom hook that determines if the Firebase authentication state is ready.
6
- * It uses Firebase authentication to check if the auth state is ready and updates the state accordingly.
7
- *
8
- * @group Hook
9
- *
10
- * @returns {boolean}
11
- *
12
- * @example
13
- * ```jsx
14
- * export const MyComponent = () => {
15
- * const isAuthStateReady = useAuthStateReady();
16
- * console.log(isAuthStateReady);
17
- * };
18
- * ```
19
- */
20
- export const useAuthStateReady = () => {
21
- const firebaseAuth = useAuth();
22
-
23
- const [isAuthStateReady, setIsAuthStateReady] = useState(false);
24
-
25
- useEffect(() => {
26
- firebaseAuth.authStateReady().then(() => setIsAuthStateReady(true));
27
- }, [firebaseAuth]);
28
-
29
- return isAuthStateReady;
30
- };
@@ -1,33 +0,0 @@
1
- import { useMutation, UseMutationOptions } from "@tanstack/react-query";
2
- import { createUserWithEmailAndPassword, UserCredential } from "firebase/auth";
3
- import { FirebaseError } from "firebase/app";
4
- import { useAuth } from "./useAuth";
5
- import { CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY } from "./mutation-keys";
6
-
7
- export type UseCreateUserWitEmailAndPasswordMutationVariables = {
8
- email: string;
9
- password: string;
10
- };
11
-
12
- /**
13
- * Custom hook to initiate a user creation process using email and password with Firebase authentication.
14
- * This hook utilizes the `useMutation` functionality to support creating new user credentials asynchronously.
15
- *
16
- * @param {Omit<UseMutationOptions<UserCredential, FirebaseError, UseCreateUserWitEmailAndPasswordMutationVariables, TContext>, "mutationKey" | "mutationFn">} options - Optional settings to customize the mutation behavior, excluding `mutationKey` and `mutationFn`.
17
- * @returns {UseMutationResult<UserCredential, FirebaseError, UseCreateUserWitEmailAndPasswordMutationVariables, TContext>} The result of the mutation which includes status, user credentials, and error information if any.
18
- */
19
- export const useCreateUserWitEmailAndPasswordMutation = <TContext = unknown>(
20
- options: Omit<
21
- UseMutationOptions<UserCredential, FirebaseError, UseCreateUserWitEmailAndPasswordMutationVariables, TContext>,
22
- "mutationKey" | "mutationFn"
23
- > = {}
24
- ) => {
25
- const firebaseAuth = useAuth();
26
-
27
- return useMutation({
28
- ...options,
29
- mutationFn: async ({ email, password }: UseCreateUserWitEmailAndPasswordMutationVariables) =>
30
- await createUserWithEmailAndPassword(firebaseAuth, email, password),
31
- mutationKey: CREATE_USER_WITH_EMAIL_AND_PASSWORD_MUTATION_KEY
32
- });
33
- };
@@ -1,25 +0,0 @@
1
- import { onAuthStateChanged } from "firebase/auth";
2
- import { useEffect, useState } from "react";
3
- import { useAuth } from "./useAuth";
4
-
5
- /**
6
- * Hook that provides the current authenticated user from Firebase Auth.
7
- * It listens for changes in the authentication state and updates the user accordingly.
8
- * @returns {Object|null} The current authenticated user object or null if no user is authenticated.
9
- */
10
- export const useCurrentUser = () => {
11
- const firebaseAuth = useAuth();
12
-
13
- const [currentUser, setCurrentUser] = useState(firebaseAuth.currentUser);
14
-
15
- useEffect(() => {
16
- const unsubscribe = onAuthStateChanged(firebaseAuth, (user) => {
17
- setCurrentUser(user);
18
- });
19
- return () => {
20
- unsubscribe();
21
- };
22
- }, [currentUser?.uid, firebaseAuth]);
23
-
24
- return currentUser;
25
- };
@@ -1,38 +0,0 @@
1
- import { EmailAuthProvider, AuthCredential } from "firebase/auth";
2
- import { useCallback } from "react";
3
-
4
- type Credential = {
5
- email: string;
6
- password?: string;
7
- emailLink?: string;
8
- };
9
-
10
- /**
11
- * A custom hook that returns an auth credential for email.
12
- *
13
- * @group Hook
14
- * @param {AuthProvider} provider alas of a provider
15
- *
16
- * @returns {AuthCredential}
17
- *
18
- * @example
19
- * ```jsx
20
- * export const MyComponent = () => {
21
- * const getCredential = useEmailAuthProviderCredential();
22
- * // ...
23
- * getCredential({email, password})
24
- * };
25
- * ```
26
- */
27
-
28
- export const useEmailAuthProviderCredential = () => {
29
- return useCallback((credential: Credential): AuthCredential => {
30
- if (credential.password) {
31
- return EmailAuthProvider.credential(credential.email, credential.password);
32
- }
33
- if (credential.emailLink) {
34
- return EmailAuthProvider.credentialWithLink(credential.email, credential.emailLink);
35
- }
36
- throw new Error("One of: password or emailLink must be provided");
37
- }, []);
38
- };
@@ -1,31 +0,0 @@
1
- import { FacebookAuthProvider, AuthCredential } from "firebase/auth";
2
- import { useCallback } from "react";
3
-
4
- type Credential = {
5
- token: string;
6
- nonce?: string;
7
- };
8
-
9
- /**
10
- * A custom hook that returns an auth credential for facebook.
11
- *
12
- * @group Hook
13
- * @param {AuthProvider} provider alas of a provider
14
- *
15
- * @returns {AuthCredential}
16
- *
17
- * @example
18
- * ```jsx
19
- * export const MyComponent = () => {
20
- * const getCredential = useFacebookAuthProviderCredential();
21
- * // ...
22
- * getCredential({token, nonce: ''})
23
- * };
24
- * ```
25
- */
26
-
27
- export const useFacebookAuthProviderCredential = () => {
28
- return useCallback((credential: Credential): AuthCredential => {
29
- return FacebookAuthProvider.credential(credential.token);
30
- }, []);
31
- };
@@ -1,27 +0,0 @@
1
- import { useMutation, UseMutationOptions } from "@tanstack/react-query";
2
- import { getRedirectResult, UserCredential } from "firebase/auth";
3
- import { FirebaseError } from "firebase/app";
4
- import { useAuth } from "./useAuth";
5
- import { GET_REDIRECT_RESULT_MUTATION_KEY } from "./mutation-keys";
6
-
7
- /**
8
- * Custom hook to retrieve redirect result after sign in with redirect.
9
- * This hook utilizes the `useMutation` functionality to support creating new user credentials asynchronously.
10
- *
11
- * @param {Omit<UseMutationOptions<UserCredential, FirebaseError, void, TContext>, "mutationKey" | "mutationFn">} options - Optional settings to customize the mutation behavior, excluding `mutationKey` and `mutationFn`.
12
- * @returns {UseMutationResult<UserCredential, FirebaseError, void, TContext>} The result of the mutation which includes status, user credentials, and error information if any.
13
- */
14
- export const useGetRedirectResultMutation = <TContext = unknown>(
15
- options: Omit<
16
- UseMutationOptions<UserCredential | null, FirebaseError, void, TContext>,
17
- "mutationKey" | "mutationFn"
18
- > = {}
19
- ) => {
20
- const firebaseAuth = useAuth();
21
-
22
- return useMutation({
23
- ...options,
24
- mutationFn: async () => await getRedirectResult(firebaseAuth),
25
- mutationKey: GET_REDIRECT_RESULT_MUTATION_KEY
26
- });
27
- };
@@ -1,83 +0,0 @@
1
- import { useCallback, useEffect, useState } from "react";
2
- import { onIdTokenChanged, getIdToken } from "firebase/auth";
3
- import { useCurrentUser } from "./useCurrentUser";
4
- import { useAuth } from "./useAuth";
5
-
6
- /**
7
- * @inline
8
- */
9
- export type UseIdTokenResult = {
10
- idToken: string;
11
- refresh: () => Promise<string | undefined>;
12
- };
13
-
14
- /**
15
- * A hook to manage the ID token.
16
- * It monitors changes to the ID token and provides the token itself along with a refresh method to update the token when needed.
17
- *
18
- * @group Hook
19
- *
20
- * @returns {UseIdTokenResult}
21
- *
22
- * @example
23
- * ```jsx
24
- * export const MyComponent = () => {
25
- * const result = useIdToken();
26
- * useEffect(() => {
27
- * const timeout = setTimeout(() => {
28
- * result.refresh();
29
- * }, 5000);
30
- * return () => clearTimeout();
31
- * }, [])
32
- * console.log(resilt.idToken);
33
- * };
34
- * ```
35
- */
36
- export const useIdToken = (): UseIdTokenResult => {
37
- const auth = useAuth();
38
-
39
- const currentUser = useCurrentUser();
40
- const [idToken, setIdToken] = useState("");
41
-
42
- const callback = useCallback(async () => {
43
- if (!currentUser) {
44
- setIdToken("");
45
- return;
46
- }
47
-
48
- const idToken = await getIdToken(currentUser);
49
- setIdToken(idToken);
50
- }, [currentUser]);
51
-
52
- const refresh = useCallback(async () => {
53
- if (!currentUser) {
54
- return;
55
- }
56
-
57
- const idToken = await getIdToken(currentUser, true);
58
- return idToken;
59
- }, [currentUser]);
60
-
61
- useEffect(() => {
62
- setTimeout(callback, 0);
63
- }, [callback]);
64
-
65
- useEffect(() => {
66
- const unsubscribe = onIdTokenChanged(auth, (user) => {
67
- if (user) {
68
- getIdToken(user).then((idToken) => {
69
- setIdToken(idToken);
70
- });
71
- } else {
72
- setIdToken("");
73
- }
74
- });
75
-
76
- return () => unsubscribe();
77
- }, [setIdToken, auth]);
78
-
79
- return {
80
- idToken,
81
- refresh
82
- };
83
- };
@@ -1,30 +0,0 @@
1
- import { useMutation, UseMutationOptions } from "@tanstack/react-query";
2
- import { linkWithCredential, User, AuthCredential, UserCredential } from "firebase/auth";
3
-
4
- import { FirebaseError } from "firebase/app";
5
- import { LINK_WITH_CREDENTIAL_MUTATION_KEY } from "./mutation-keys";
6
-
7
- export type UseLinkWitCredentialMutationVariables = {
8
- user: User;
9
- credential: AuthCredential;
10
- };
11
-
12
- /**
13
- * Custom hook for handling linking of Firebase account to auth provider using credential
14
- * This hook utilizes the `useMutation` mechanism to perform the sign-in operation.
15
- * @param {Omit<UseMutationOptions<UserCredential, FirebaseError, UseLinkWitCredentialMutationVariables, TContext>, "mutationKey" | "mutationFn">} options - Optional configurations for the mutation, omitting the mutationKey and mutationFn properties.
16
- * @returns {UseMutationResult<UserCredential, FirebaseError, UseLinkWitCredentialMutationVariables, TContext>} The result object from the useMutation hook, containing the mutation function and its current state.
17
- */
18
- export const useLinkWithCredentialMutation = <TContext = unknown>(
19
- options: Omit<
20
- UseMutationOptions<UserCredential, FirebaseError, UseLinkWitCredentialMutationVariables, TContext>,
21
- "mutationKey" | "mutationFn"
22
- > = {}
23
- ) => {
24
- return useMutation({
25
- ...options,
26
- mutationFn: async ({ user, credential }: UseLinkWitCredentialMutationVariables) =>
27
- linkWithCredential(user, credential),
28
- mutationKey: LINK_WITH_CREDENTIAL_MUTATION_KEY
29
- });
30
- };
@@ -1,31 +0,0 @@
1
- import { useMutation, UseMutationOptions } from "@tanstack/react-query";
2
- import { reauthenticateWithCredential, User, AuthCredential, UserCredential } from "firebase/auth";
3
- import { FirebaseError } from "firebase/app";
4
- import { REAUTHENTICATE_WITH_CREDENTIAL_MUTATION_KEY } from "./mutation-keys";
5
-
6
- export type UseReauthenticateWitCredentialMutationVariables = {
7
- credential: AuthCredential;
8
- user: User;
9
- };
10
-
11
- /**
12
- * Custom hook to create a mutation for re-authenticating a user with a given credential.
13
- * This hook utilizes useMutation from React Query to manage the asynchronous re-authentication
14
- * process with Firebase credentials. It omits the default "mutationKey" and "mutationFn" options.
15
- *
16
- * @param {Omit<UseMutationOptions<UserCredential, FirebaseError, UseReauthenticateWitCredentialMutationVariables, TContext>, "mutationKey" | "mutationFn">} options - Optional mutation options excluding "mutationKey" and "mutationFn".
17
- * @returns {UseMutationResult<UserCredential, FirebaseError, UseReauthenticateWitCredentialMutationVariables, TContext>} A useMutation result object managing the loading, error, and result state of the re-authentication mutation.
18
- */
19
- export const useReauthenticateWitCredentialMutation = <TContext = unknown>(
20
- options: Omit<
21
- UseMutationOptions<UserCredential, FirebaseError, UseReauthenticateWitCredentialMutationVariables, TContext>,
22
- "mutationKey" | "mutationFn"
23
- > = {}
24
- ) => {
25
- return useMutation({
26
- ...options,
27
- mutationFn: async ({ credential, user }: UseReauthenticateWitCredentialMutationVariables) =>
28
- reauthenticateWithCredential(user, credential),
29
- mutationKey: REAUTHENTICATE_WITH_CREDENTIAL_MUTATION_KEY
30
- });
31
- };
@@ -1,37 +0,0 @@
1
- import { useMutation, UseMutationOptions } from "@tanstack/react-query";
2
- import { reauthenticateWithRedirect, AuthProvider, PopupRedirectResolver, User } from "firebase/auth";
3
-
4
- import { FirebaseError } from "firebase/app";
5
- import { REAUTHENTICATE_WITH_REDIRECT_MUTATION_KEY } from "./mutation-keys";
6
-
7
- export type UseReauthenticateWitRedirectMutationVariables = {
8
- authProvider: AuthProvider;
9
- popupRedirectResolver?: PopupRedirectResolver;
10
- user: User;
11
- };
12
-
13
- /**
14
- * Custom hook that provides a mutation to reauthenticate a user with a given authentication provider using redirection.
15
- * This hook uses the `useMutation` hook from the React Query library to handle async mutation logic.
16
- *
17
- * @param {Omit<UseMutationOptions<void, FirebaseError, 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.
18
- * @template TContext - The type of any additional context you wish to pass to the mutation.
19
- * @returns {UseMutationResult<void, FirebaseError, UseReauthenticateWitRedirectMutationVariables, TContext>} A mutation result object containing methods and state of the mutation.
20
- */
21
- export const useReauthenticateWitRedirectMutation = <TContext = unknown>(
22
- options: Omit<
23
- UseMutationOptions<void, FirebaseError, UseReauthenticateWitRedirectMutationVariables, TContext>,
24
- "mutationKey" | "mutationFn"
25
- > = {}
26
- ) => {
27
- return useMutation({
28
- ...options,
29
- mutationFn: async ({
30
- authProvider,
31
- user,
32
- popupRedirectResolver
33
- }: UseReauthenticateWitRedirectMutationVariables) =>
34
- reauthenticateWithRedirect(user, authProvider, popupRedirectResolver),
35
- mutationKey: REAUTHENTICATE_WITH_REDIRECT_MUTATION_KEY
36
- });
37
- };
@@ -1,28 +0,0 @@
1
- import { useMutation, UseMutationOptions } from "@tanstack/react-query";
2
- import { sendEmailVerification, User } from "firebase/auth";
3
-
4
- import { FirebaseError } from "firebase/app";
5
- import { SEND_EMAIL_VERIFICATION_MUTATION_KEY } from "./mutation-keys";
6
-
7
- export type UseSendEmailVerificationMutationVariables = {
8
- user: User;
9
- };
10
-
11
- /**
12
- * A custom hook to create a mutation for sending an email verification to a user using Firebase.
13
- * This uses the `useMutation` hook from a query library and wraps it with specific configuration options.
14
- * @param {Omit<UseMutationOptions<void, FirebaseError, UseSendEmailVerificationMutationVariables, TContext>, "queryKey" | "queryFn">} options - Configuration options for the mutation, excluding `queryKey` and `queryFn`.
15
- * @returns {UseMutationResult<void, FirebaseError, UseSendEmailVerificationMutationVariables, TContext>} An object containing mutation state and functions for managing the mutation lifecycle.
16
- */
17
- export const useSendEmailVerificationMutation = <TContext = unknown>(
18
- options: Omit<
19
- UseMutationOptions<void, FirebaseError, UseSendEmailVerificationMutationVariables, TContext>,
20
- "queryKey" | "queryFn"
21
- > = {}
22
- ) => {
23
- return useMutation({
24
- ...options,
25
- mutationFn: async ({ user }) => await sendEmailVerification(user),
26
- mutationKey: SEND_EMAIL_VERIFICATION_MUTATION_KEY
27
- });
28
- };
@@ -1,49 +0,0 @@
1
- import { useMutation, UseMutationOptions } from "@tanstack/react-query";
2
- import { signInAnonymously, UserCredential } from "firebase/auth";
3
-
4
- import { ReactNativeFirebase } from "@react-native-firebase/app";
5
- import { useAuth } from "./useAuth";
6
- import { SIGN_IN_ANONYMOUSLY_MUTATION_KEY } from "./mutation-keys";
7
-
8
- /**
9
- * @inline
10
- */
11
- export type UseSignInAnonymouslyMutationOptions = {
12
- /**
13
- * Options for useMutation hook excluding mutationFn. MutationKey will be equal to reference.path by default.
14
- */
15
- options?: Omit<UseMutationOptions<UserCredential, ReactNativeFirebase.NativeFirebaseError, void>, "mutationFn">;
16
- };
17
-
18
- /**
19
- * Executes a mutation and returns users credentials
20
- *
21
- * @group Hook
22
- *
23
- * @param {useSignInAnonymouslyMutation} options - Configuration options for the mutation.
24
- *
25
- * @returns {UseMutationResult<AppModelType, Error, UseAddDocMutationValues<AppModelType>, TContext>} A mutation result
26
- *
27
- * @example
28
- * ```jsx
29
- * export const MyComponent = () => {
30
- * const {mutate} = useSignInAnonymouslyMutation({
31
- * options: {
32
- * },
33
- * });
34
- *
35
- * // ....
36
- * mutate();
37
- * // ....
38
- * };
39
- * ```
40
- */
41
- export const useSignInAnonymouslyMutation = ({ options = {} }: UseSignInAnonymouslyMutationOptions = {}) => {
42
- const firebaseAuth = useAuth();
43
-
44
- return useMutation({
45
- ...options,
46
- mutationKey: SIGN_IN_ANONYMOUSLY_MUTATION_KEY,
47
- mutationFn: async () => signInAnonymously(firebaseAuth)
48
- });
49
- };