@umituz/react-native-auth 4.3.33 → 4.3.35
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-auth",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.35",
|
|
4
4
|
"description": "Authentication service for React Native apps - Secure, type-safe, and production-ready. Provider-agnostic design with dependency injection, configurable validation, and comprehensive error handling.",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -23,9 +23,7 @@ export function handleAuthStateChange(
|
|
|
23
23
|
): void {
|
|
24
24
|
try {
|
|
25
25
|
if (!user && autoAnonymousSignIn) {
|
|
26
|
-
// Start anonymous sign-in without blocking
|
|
27
26
|
void handleAnonymousMode(store, auth);
|
|
28
|
-
store.setFirebaseUser(null);
|
|
29
27
|
completeInitialization();
|
|
30
28
|
return;
|
|
31
29
|
}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
selectSetError,
|
|
14
14
|
selectSetIsAnonymous,
|
|
15
15
|
selectIsAuthenticated,
|
|
16
|
+
selectHasFirebaseUser,
|
|
16
17
|
selectUserId,
|
|
17
18
|
selectUserType,
|
|
18
19
|
selectIsAnonymous,
|
|
@@ -36,6 +37,7 @@ export interface UseAuthResult {
|
|
|
36
37
|
isAuthReady: boolean;
|
|
37
38
|
isAnonymous: boolean;
|
|
38
39
|
isAuthenticated: boolean;
|
|
40
|
+
hasFirebaseUser: boolean;
|
|
39
41
|
isRegisteredUser: boolean;
|
|
40
42
|
error: string | null;
|
|
41
43
|
signUp: (email: string, password: string, displayName?: string) => Promise<void>;
|
|
@@ -50,6 +52,7 @@ export function useAuth(): UseAuthResult {
|
|
|
50
52
|
const loading = useAuthStore(selectLoading);
|
|
51
53
|
const error = useAuthStore(selectError);
|
|
52
54
|
const isAuthenticated = useAuthStore(selectIsAuthenticated);
|
|
55
|
+
const hasFirebaseUser = useAuthStore(selectHasFirebaseUser);
|
|
53
56
|
const userId = useAuthStore(selectUserId);
|
|
54
57
|
const userType = useAuthStore(selectUserType);
|
|
55
58
|
const isAnonymous = useAuthStore(selectIsAnonymous);
|
|
@@ -130,7 +133,7 @@ export function useAuth(): UseAuthResult {
|
|
|
130
133
|
}, [setIsAnonymous, setLoading, setError, anonymousModeMutation]);
|
|
131
134
|
|
|
132
135
|
return {
|
|
133
|
-
user, userId, userType, loading, isAuthReady, isAnonymous, isAuthenticated, isRegisteredUser, error,
|
|
136
|
+
user, userId, userType, loading, isAuthReady, isAnonymous, isAuthenticated, hasFirebaseUser, isRegisteredUser, error,
|
|
134
137
|
signUp, signIn, signOut, continueAnonymously, setError,
|
|
135
138
|
};
|
|
136
139
|
}
|
|
@@ -87,6 +87,10 @@ export const selectIsAuthenticated = (state: AuthStore): boolean => {
|
|
|
87
87
|
return hasFirebaseUser && isNotAnonymous;
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
+
export const selectHasFirebaseUser = (state: AuthStore): boolean => {
|
|
91
|
+
return !!state.firebaseUser;
|
|
92
|
+
};
|
|
93
|
+
|
|
90
94
|
/**
|
|
91
95
|
* Check if user is anonymous
|
|
92
96
|
* Uses firebaseUser as single source of truth
|