@umituz/react-native-auth 3.6.4 → 3.6.6
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": "3.6.
|
|
3
|
+
"version": "3.6.6",
|
|
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,22 +23,38 @@ export interface UserDocumentConfig {
|
|
|
23
23
|
/** Additional fields to store with user document */
|
|
24
24
|
extraFields?: Record<string, unknown>;
|
|
25
25
|
/** Callback to collect device/app info */
|
|
26
|
-
collectExtras?: () => Promise<
|
|
26
|
+
collectExtras?: () => Promise<UserDocumentExtras>;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* User document extras from device/app
|
|
31
31
|
*/
|
|
32
32
|
export interface UserDocumentExtras {
|
|
33
|
+
[key: string]: string | number | boolean | null | undefined;
|
|
33
34
|
deviceId?: string;
|
|
35
|
+
persistentDeviceId?: string;
|
|
36
|
+
nativeDeviceId?: string;
|
|
34
37
|
platform?: string;
|
|
35
38
|
deviceModel?: string;
|
|
36
39
|
deviceBrand?: string;
|
|
40
|
+
deviceName?: string;
|
|
41
|
+
deviceType?: number | string;
|
|
42
|
+
deviceYearClass?: number | string;
|
|
43
|
+
isDevice?: boolean;
|
|
44
|
+
osName?: string;
|
|
37
45
|
osVersion?: string;
|
|
46
|
+
osBuildId?: string;
|
|
47
|
+
totalMemory?: number | string;
|
|
38
48
|
appVersion?: string;
|
|
39
49
|
buildNumber?: string;
|
|
40
50
|
locale?: string;
|
|
51
|
+
region?: string;
|
|
41
52
|
timezone?: string;
|
|
53
|
+
screenWidth?: number;
|
|
54
|
+
screenHeight?: number;
|
|
55
|
+
screenScale?: number;
|
|
56
|
+
fontScale?: number;
|
|
57
|
+
isLandscape?: boolean;
|
|
42
58
|
previousAnonymousUserId?: string;
|
|
43
59
|
signUpMethod?: string;
|
|
44
60
|
}
|
|
@@ -7,6 +7,7 @@ import type { Auth, User } from "firebase/auth";
|
|
|
7
7
|
import { getFirebaseAuth } from "@umituz/react-native-firebase";
|
|
8
8
|
import { initializeAuthService } from "./AuthService";
|
|
9
9
|
import { configureUserDocumentService } from "./UserDocumentService";
|
|
10
|
+
import type { UserDocumentExtras } from "./UserDocumentService";
|
|
10
11
|
import { collectDeviceExtras } from "@umituz/react-native-design-system";
|
|
11
12
|
import { initializeAuthListener } from "../../presentation/stores/initializeAuthListener";
|
|
12
13
|
import { createAuthStateHandler } from "../utils/authStateHandler";
|
|
@@ -17,7 +18,7 @@ import type { IStorageProvider } from "../types/Storage.types";
|
|
|
17
18
|
export interface InitializeAuthOptions {
|
|
18
19
|
userCollection?: string;
|
|
19
20
|
extraFields?: Record<string, unknown>;
|
|
20
|
-
collectExtras?: () => Promise<
|
|
21
|
+
collectExtras?: () => Promise<UserDocumentExtras>;
|
|
21
22
|
storageProvider?: IStorageProvider;
|
|
22
23
|
autoAnonymousSignIn?: boolean;
|
|
23
24
|
onUserConverted?: (anonymousId: string, authenticatedId: string) => void | Promise<void>;
|
|
@@ -43,15 +43,17 @@ export function buildBaseData(
|
|
|
43
43
|
isAnonymous: user.isAnonymous,
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
if (extras) {
|
|
47
|
+
const internalFields = ["signUpMethod", "previousAnonymousUserId"];
|
|
48
|
+
Object.keys(extras).forEach((key) => {
|
|
49
|
+
if (!internalFields.includes(key)) {
|
|
50
|
+
const val = extras[key];
|
|
51
|
+
if (val !== undefined) {
|
|
52
|
+
data[key] = val;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
55
57
|
|
|
56
58
|
return data;
|
|
57
59
|
}
|