@umituz/react-native-auth 4.3.31 → 4.3.33
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.33",
|
|
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",
|
|
@@ -44,23 +44,10 @@ describe('AnonymousModeService', () => {
|
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
describe('auth integration', () => {
|
|
47
|
-
it('should enable
|
|
48
|
-
|
|
49
|
-
await anonymousModeService.enable(mockStorageProvider
|
|
50
|
-
expect(mockAuth.signOut).toHaveBeenCalled();
|
|
47
|
+
it('should enable anonymous mode', async () => {
|
|
48
|
+
mockStorageProvider.set.mockResolvedValue(undefined);
|
|
49
|
+
await anonymousModeService.enable(mockStorageProvider);
|
|
51
50
|
expect(anonymousModeService.getIsAnonymousMode()).toBe(true);
|
|
52
51
|
});
|
|
53
|
-
|
|
54
|
-
it('should wrap auth state callback correctly', () => {
|
|
55
|
-
const callback = jest.fn();
|
|
56
|
-
const wrapped = anonymousModeService.wrapAuthStateCallback(callback);
|
|
57
|
-
|
|
58
|
-
wrapped({ uid: 'u' } as any);
|
|
59
|
-
expect(callback).toHaveBeenCalledWith({ uid: 'u' });
|
|
60
|
-
|
|
61
|
-
anonymousModeService.setAnonymousMode(true);
|
|
62
|
-
wrapped({ uid: 'u' } as any);
|
|
63
|
-
expect(callback).toHaveBeenCalledWith(null);
|
|
64
|
-
});
|
|
65
52
|
});
|
|
66
53
|
});
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Handles anonymous mode functionality
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { AuthUser } from "../../domain/entities/AuthUser";
|
|
7
6
|
import { emitAnonymousModeEnabled } from "./AuthEventService";
|
|
8
7
|
import type { IStorageProvider } from "../types/Storage.types";
|
|
9
8
|
|
|
@@ -69,14 +68,4 @@ export class AnonymousModeService {
|
|
|
69
68
|
this.isAnonymousMode = enabled;
|
|
70
69
|
}
|
|
71
70
|
|
|
72
|
-
wrapAuthStateCallback(
|
|
73
|
-
callback: (user: AuthUser | null) => void
|
|
74
|
-
): (user: AuthUser | null) => void {
|
|
75
|
-
return (user: AuthUser | null) => {
|
|
76
|
-
// In anonymous mode, still pass the actual Firebase user
|
|
77
|
-
// The store will handle setting the isAnonymous flag appropriately
|
|
78
|
-
// This allows proper anonymous to registered user conversion
|
|
79
|
-
callback(user);
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
71
|
}
|
|
@@ -104,8 +104,7 @@ export class AuthService {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
onAuthStateChange(callback: (user: AuthUser | null) => void): () => void {
|
|
107
|
-
|
|
108
|
-
return this.repositoryInstance.onAuthStateChange(wrappedCallback);
|
|
107
|
+
return this.repositoryInstance.onAuthStateChange(callback);
|
|
109
108
|
}
|
|
110
109
|
|
|
111
110
|
getConfig(): AuthConfig { return this.config; }
|