@umituz/react-native-auth 3.2.15 → 3.2.16

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.2.15",
3
+ "version": "3.2.16",
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
@@ -96,6 +96,7 @@ export {
96
96
  export type {
97
97
  UserDocumentConfig,
98
98
  UserDocumentExtras,
99
+ UserDocumentUser,
99
100
  } from './infrastructure/services/UserDocumentService';
100
101
 
101
102
  // =============================================================================
@@ -5,11 +5,23 @@
5
5
  */
6
6
 
7
7
  import { doc, getDoc, setDoc, serverTimestamp } from "firebase/firestore";
8
+ import type { User } from "firebase/auth";
8
9
  import { getFirestore } from "@umituz/react-native-firebase";
9
- import type { AuthUser } from "../../domain/entities/AuthUser";
10
10
 
11
11
  declare const __DEV__: boolean;
12
12
 
13
+ /**
14
+ * Minimal user interface for document creation
15
+ * Compatible with both Firebase User and AuthUser
16
+ */
17
+ export interface UserDocumentUser {
18
+ uid: string;
19
+ displayName?: string | null;
20
+ email?: string | null;
21
+ photoURL?: string | null;
22
+ isAnonymous?: boolean;
23
+ }
24
+
13
25
  /**
14
26
  * Configuration for user document service
15
27
  */
@@ -51,7 +63,7 @@ export function configureUserDocumentService(config: UserDocumentConfig): void {
51
63
  /**
52
64
  * Get sign-up method from auth user
53
65
  */
54
- function getSignUpMethod(user: AuthUser): string | undefined {
66
+ function getSignUpMethod(user: UserDocumentUser): string | undefined {
55
67
  if (user.isAnonymous) return "anonymous";
56
68
  if (user.email) {
57
69
  const providerData = (
@@ -72,7 +84,7 @@ function getSignUpMethod(user: AuthUser): string | undefined {
72
84
  * Build base user data from auth user
73
85
  */
74
86
  function buildBaseData(
75
- user: AuthUser,
87
+ user: UserDocumentUser,
76
88
  extras?: UserDocumentExtras,
77
89
  ): Record<string, unknown> {
78
90
  const data: Record<string, unknown> = {
@@ -153,7 +165,7 @@ function buildUpdateData(
153
165
  * Creates new document or updates existing one
154
166
  */
155
167
  export async function ensureUserDocument(
156
- user: AuthUser,
168
+ user: UserDocumentUser | User,
157
169
  extras?: UserDocumentExtras,
158
170
  ): Promise<boolean> {
159
171
  const db = getFirestore();