@umituz/react-native-firebase 1.13.29 → 1.13.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-firebase",
3
- "version": "1.13.29",
3
+ "version": "1.13.30",
4
4
  "description": "Unified Firebase package for React Native apps - Auth and Firestore services using Firebase JS SDK (no native modules).",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * Firebase Auth Store
3
- * Shared Zustand store for Firebase Auth state
3
+ * Basic Zustand store for Firebase Auth state
4
4
  *
5
- * CRITICAL: This store ensures only ONE auth listener is created,
6
- * preventing performance issues from multiple subscriptions.
5
+ * NOTE: For comprehensive auth state management including
6
+ * user types and guest mode, use @umituz/react-native-auth package.
7
+ * This store provides minimal state for low-level Firebase operations.
7
8
  */
8
9
 
9
10
  import { create } from "zustand";
@@ -27,7 +28,7 @@ type AuthStore = AuthState & AuthActions;
27
28
 
28
29
  let unsubscribe: (() => void) | null = null;
29
30
 
30
- export const useAuthStore = create<AuthStore>((set, get) => ({
31
+ export const useFirebaseAuthStore = create<AuthStore>((set, get) => ({
31
32
  user: null,
32
33
  loading: true,
33
34
  initialized: false,
@@ -36,7 +37,6 @@ export const useAuthStore = create<AuthStore>((set, get) => ({
36
37
  setupListener: (auth: Auth) => {
37
38
  const state = get();
38
39
 
39
- // Only setup listener once
40
40
  if (state.listenerSetup || unsubscribe) {
41
41
  return;
42
42
  }
@@ -44,9 +44,10 @@ export const useAuthStore = create<AuthStore>((set, get) => ({
44
44
  set({ listenerSetup: true });
45
45
 
46
46
  unsubscribe = onAuthStateChanged(auth, (currentUser: User | null) => {
47
- if (__DEV__) {
47
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
48
+ // eslint-disable-next-line no-console
48
49
  console.log(
49
- "[AuthStore] Auth state changed:",
50
+ "[FirebaseAuthStore] Auth state changed:",
50
51
  currentUser?.uid || "null"
51
52
  );
52
53
  }
@@ -1,38 +1,33 @@
1
1
  /**
2
2
  * useFirebaseAuth Hook
3
- * React hook for Firebase Auth state management
3
+ * React hook for raw Firebase Auth state
4
4
  *
5
- * Uses shared Zustand store to ensure only ONE auth listener exists.
6
- * This prevents performance issues from multiple subscriptions.
5
+ * NOTE: For comprehensive auth management (user types, guest mode, sign in/out),
6
+ * use useAuth from @umituz/react-native-auth package instead.
7
+ * This hook provides minimal Firebase Auth access.
7
8
  */
8
9
 
9
10
  import { useEffect } from "react";
10
11
  import type { User } from "firebase/auth";
11
12
  import { getFirebaseAuth } from "../../infrastructure/config/FirebaseAuthClient";
12
- import { useAuthStore } from "../../infrastructure/stores/auth.store";
13
+ import { useFirebaseAuthStore } from "../../infrastructure/stores/auth.store";
13
14
 
14
15
  export interface UseFirebaseAuthResult {
15
- /** Current authenticated user from Firebase Auth */
16
+ /** Current Firebase user */
16
17
  user: User | null;
17
- /** Whether auth state is loading (initial check) */
18
+ /** Whether auth state is loading */
18
19
  loading: boolean;
19
20
  /** Whether Firebase Auth is initialized */
20
21
  initialized: boolean;
21
22
  }
22
23
 
23
24
  /**
24
- * Hook for Firebase Auth state management
25
+ * Hook for raw Firebase Auth state
25
26
  *
26
27
  * Uses shared store to ensure only one listener is active.
27
- * Auth is pre-initialized in appInitializer, so no retry needed.
28
- *
29
- * @example
30
- * ```typescript
31
- * const { user, loading } = useFirebaseAuth();
32
- * ```
33
28
  */
34
29
  export function useFirebaseAuth(): UseFirebaseAuthResult {
35
- const { user, loading, initialized, setupListener } = useAuthStore();
30
+ const { user, loading, initialized, setupListener } = useFirebaseAuthStore();
36
31
 
37
32
  useEffect(() => {
38
33
  const auth = getFirebaseAuth();
@@ -41,7 +36,6 @@ export function useFirebaseAuth(): UseFirebaseAuthResult {
41
36
  return;
42
37
  }
43
38
 
44
- // Setup listener (will only run once due to store check)
45
39
  setupListener(auth);
46
40
  }, [setupListener]);
47
41