@umituz/react-native-auth 3.6.52 → 3.6.54
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 +1 -1
- package/src/index.ts +1 -1
- package/src/infrastructure/adapters/StorageProviderAdapter.ts +4 -1
- package/src/infrastructure/providers/FirebaseAuthProvider.ts +4 -2
- package/src/infrastructure/services/app-service-helpers.ts +9 -4
- package/src/presentation/hooks/useAuth.ts +3 -3
- package/src/presentation/hooks/useAuthRequired.ts +2 -1
- package/src/presentation/hooks/useRequireAuth.ts +2 -1
- package/src/presentation/screens/change-password/index.ts +0 -4
- package/src/presentation/stores/authStore.ts +5 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-auth",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.54",
|
|
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",
|
package/src/index.ts
CHANGED
|
@@ -227,7 +227,7 @@ export { getAuthErrorLocalizationKey } from './presentation/utils/getAuthErrorMe
|
|
|
227
227
|
// App Service Helper (for configureAppServices)
|
|
228
228
|
export {
|
|
229
229
|
createAuthService,
|
|
230
|
-
type
|
|
230
|
+
type IAppAuthServiceHelper,
|
|
231
231
|
} from './infrastructure/services/app-service-helpers';
|
|
232
232
|
|
|
233
233
|
// Init Module Factory
|
|
@@ -37,7 +37,10 @@ export class StorageProviderAdapter implements IStorageProvider {
|
|
|
37
37
|
} else {
|
|
38
38
|
throw new Error("Unsupported storage implementation");
|
|
39
39
|
}
|
|
40
|
-
} catch {
|
|
40
|
+
} catch (error) {
|
|
41
|
+
if (__DEV__) {
|
|
42
|
+
console.warn("[StorageProviderAdapter] Failed to get value for key:", key, error);
|
|
43
|
+
}
|
|
41
44
|
return null;
|
|
42
45
|
}
|
|
43
46
|
}
|
|
@@ -129,8 +129,10 @@ export class FirebaseAuthProvider implements IAuthProvider {
|
|
|
129
129
|
await updateProfile(userCredential.user, {
|
|
130
130
|
displayName: credentials.displayName.trim(),
|
|
131
131
|
});
|
|
132
|
-
} catch {
|
|
133
|
-
|
|
132
|
+
} catch (error) {
|
|
133
|
+
if (__DEV__) {
|
|
134
|
+
console.warn("[FirebaseAuthProvider] Failed to update display name:", error);
|
|
135
|
+
}
|
|
134
136
|
}
|
|
135
137
|
}
|
|
136
138
|
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Creates ready-to-use auth service for configureAppServices
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { useAuthStore
|
|
6
|
+
import { useAuthStore } from "../../presentation/stores/authStore";
|
|
7
|
+
import { selectIsAuthenticated, selectUserId } from "../../presentation/stores/auth.selectors";
|
|
7
8
|
import { useAuthModalStore } from "../../presentation/stores/authModalStore";
|
|
8
9
|
|
|
9
|
-
export interface
|
|
10
|
+
export interface IAppAuthServiceHelper {
|
|
10
11
|
getUserId: () => string | null;
|
|
11
12
|
isAuthenticated: () => boolean;
|
|
12
13
|
requireAuth: () => string;
|
|
@@ -15,7 +16,7 @@ export interface IAuthService {
|
|
|
15
16
|
/**
|
|
16
17
|
* Creates an auth service implementation for configureAppServices
|
|
17
18
|
*/
|
|
18
|
-
export function createAuthService():
|
|
19
|
+
export function createAuthService(): IAppAuthServiceHelper {
|
|
19
20
|
return {
|
|
20
21
|
getUserId: () => selectUserId(useAuthStore.getState()),
|
|
21
22
|
isAuthenticated: () => selectIsAuthenticated(useAuthStore.getState()),
|
|
@@ -24,7 +25,11 @@ export function createAuthService(): IAuthService {
|
|
|
24
25
|
useAuthModalStore.getState().showAuthModal();
|
|
25
26
|
throw new Error("Auth required");
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
const userId = selectUserId(useAuthStore.getState());
|
|
29
|
+
if (!userId) {
|
|
30
|
+
throw new Error("User ID missing");
|
|
31
|
+
}
|
|
32
|
+
return userId;
|
|
28
33
|
},
|
|
29
34
|
};
|
|
30
35
|
}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { useCallback } from "react";
|
|
10
|
+
import { useAuthStore } from "../stores/authStore";
|
|
10
11
|
import {
|
|
11
|
-
useAuthStore,
|
|
12
12
|
selectUser,
|
|
13
13
|
selectLoading,
|
|
14
14
|
selectError,
|
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
selectIsAnonymous,
|
|
22
22
|
selectIsAuthReady,
|
|
23
23
|
selectIsRegisteredUser,
|
|
24
|
-
|
|
25
|
-
} from "
|
|
24
|
+
} from "../stores/auth.selectors";
|
|
25
|
+
import type { UserType } from "../../types/auth-store.types";
|
|
26
26
|
import {
|
|
27
27
|
useSignInMutation,
|
|
28
28
|
useSignUpMutation,
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { useCallback } from "react";
|
|
20
|
-
import { useAuthStore
|
|
20
|
+
import { useAuthStore } from "../stores/authStore";
|
|
21
|
+
import { selectIsAuthenticated, selectLoading, selectFirebaseUserId } from "../stores/auth.selectors";
|
|
21
22
|
import { useAuthModalStore } from "../stores/authModalStore";
|
|
22
23
|
import { selectShowAuthModal } from "../stores/auth.selectors";
|
|
23
24
|
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { useAuthStore
|
|
13
|
+
import { useAuthStore } from "../stores/authStore";
|
|
14
|
+
import { selectIsAuthenticated, selectFirebaseUserId } from "../stores/auth.selectors";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Get userId or throw if not authenticated
|
|
@@ -4,7 +4,3 @@
|
|
|
4
4
|
|
|
5
5
|
export { ChangePasswordScreen } from "./ChangePasswordScreen";
|
|
6
6
|
export type { ChangePasswordTranslations, ChangePasswordScreenProps } from "./ChangePasswordScreen.types";
|
|
7
|
-
export { RequirementItem } from "./RequirementItem";
|
|
8
|
-
export type { RequirementItemProps } from "./RequirementItem";
|
|
9
|
-
export { validatePassword } from "./ChangePasswordScreen.types";
|
|
10
|
-
export type { PasswordValidation } from "./ChangePasswordScreen.types";
|
|
@@ -14,14 +14,6 @@ import { mapToAuthUser } from "../../infrastructure/utils/UserMapper";
|
|
|
14
14
|
import type { AuthState, AuthActions, UserType } from "../../types/auth-store.types";
|
|
15
15
|
import { initialAuthState } from "../../types/auth-store.types";
|
|
16
16
|
import {
|
|
17
|
-
selectUser,
|
|
18
|
-
selectLoading,
|
|
19
|
-
selectIsAnonymousState,
|
|
20
|
-
selectError,
|
|
21
|
-
selectFirebaseUserId,
|
|
22
|
-
selectSetLoading,
|
|
23
|
-
selectSetError,
|
|
24
|
-
selectSetIsAnonymous,
|
|
25
17
|
selectUserId,
|
|
26
18
|
selectIsAuthenticated,
|
|
27
19
|
selectIsAnonymous,
|
|
@@ -30,19 +22,8 @@ import {
|
|
|
30
22
|
selectIsRegisteredUser,
|
|
31
23
|
} from "./auth.selectors";
|
|
32
24
|
|
|
33
|
-
// Re-export
|
|
34
|
-
export type { AuthState, AuthActions, UserType };
|
|
35
|
-
|
|
36
|
-
// Re-export selectors
|
|
25
|
+
// Re-export public selectors (consumed by index.ts)
|
|
37
26
|
export {
|
|
38
|
-
selectUser,
|
|
39
|
-
selectLoading,
|
|
40
|
-
selectIsAnonymousState,
|
|
41
|
-
selectError,
|
|
42
|
-
selectFirebaseUserId,
|
|
43
|
-
selectSetLoading,
|
|
44
|
-
selectSetError,
|
|
45
|
-
selectSetIsAnonymous,
|
|
46
27
|
selectUserId,
|
|
47
28
|
selectIsAuthenticated,
|
|
48
29
|
selectIsAnonymous,
|
|
@@ -51,7 +32,10 @@ export {
|
|
|
51
32
|
selectIsRegisteredUser,
|
|
52
33
|
};
|
|
53
34
|
|
|
54
|
-
// Re-export
|
|
35
|
+
// Re-export public types (consumed by index.ts)
|
|
36
|
+
export type { AuthState, AuthActions, UserType };
|
|
37
|
+
|
|
38
|
+
// Re-export listener functions (consumed by index.ts)
|
|
55
39
|
export {
|
|
56
40
|
initializeAuthListener,
|
|
57
41
|
resetAuthListener,
|