@umituz/react-native-auth 4.3.48 → 4.3.50
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.50",
|
|
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
|
@@ -37,7 +37,7 @@ export { SECURITY_LIMITS, sanitizeEmail, sanitizePassword, sanitizeName } from '
|
|
|
37
37
|
export type { SecurityLimitKey } from './infrastructure/utils/validation/sanitization';
|
|
38
38
|
export { isEmpty, isEmptyEmail, isEmptyPassword, isEmptyName, isNotEmpty, hasContent } from './infrastructure/utils/validation/validationHelpers';
|
|
39
39
|
export { safeCallback, safeCallbackSync } from './infrastructure/utils/safeCallback';
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
|
|
42
42
|
// =============================================================================
|
|
43
43
|
// PRESENTATION LAYER - Hooks
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { PersistentDeviceIdService } from '@umituz/react-native-design-system/device';
|
|
2
|
-
import { getFirebaseAuth } from '@umituz/react-native-firebase';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Get the effective user ID for services that need to track user data
|
|
6
|
-
*
|
|
7
|
-
* Returns:
|
|
8
|
-
* - Firebase Auth UID if user is authenticated (not anonymous)
|
|
9
|
-
* - Device ID if user is anonymous or not logged in
|
|
10
|
-
*
|
|
11
|
-
* This ensures:
|
|
12
|
-
* - Each authenticated user has their own data (subscriptions, credits, etc.)
|
|
13
|
-
* - Anonymous users are tracked by device
|
|
14
|
-
* - Multiple accounts on same device don't share data
|
|
15
|
-
*
|
|
16
|
-
* @returns Promise<string> User ID for service identification
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* const userId = await getEffectiveUserId();
|
|
21
|
-
* // Authenticated user: "firebase_uid_123"
|
|
22
|
-
* // Anonymous user: "device_abc456"
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export async function getEffectiveUserId(): Promise<string> {
|
|
26
|
-
const auth = getFirebaseAuth();
|
|
27
|
-
const currentUser = auth?.currentUser;
|
|
28
|
-
|
|
29
|
-
if (currentUser && !currentUser.isAnonymous) {
|
|
30
|
-
return currentUser.uid;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return PersistentDeviceIdService.getDeviceId();
|
|
34
|
-
}
|