@umituz/react-native-auth 3.4.52 → 3.4.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-auth",
3
- "version": "3.4.52",
3
+ "version": "3.4.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",
@@ -9,8 +9,12 @@ import {
9
9
  signOut as firebaseSignOut,
10
10
  onAuthStateChanged,
11
11
  updateProfile,
12
+ EmailAuthProvider,
13
+ linkWithCredential,
12
14
  type Auth,
13
15
  } from "firebase/auth";
16
+
17
+ declare const __DEV__: boolean;
14
18
  import type {
15
19
  IAuthProvider,
16
20
  AuthCredentials,
@@ -72,11 +76,44 @@ export class FirebaseAuthProvider implements IAuthProvider {
72
76
  }
73
77
 
74
78
  try {
75
- const userCredential = await createUserWithEmailAndPassword(
76
- this.auth,
77
- credentials.email.trim(),
78
- credentials.password
79
- );
79
+ const currentUser = this.auth.currentUser;
80
+ const isAnonymous = currentUser?.isAnonymous ?? false;
81
+
82
+ let userCredential;
83
+
84
+ // Convert anonymous user to permanent account
85
+ if (currentUser && isAnonymous) {
86
+ if (__DEV__) {
87
+ console.log("[FirebaseAuthProvider] Converting anonymous user to authenticated:", {
88
+ anonymousId: currentUser.uid.slice(0, 8),
89
+ });
90
+ }
91
+
92
+ const credential = EmailAuthProvider.credential(
93
+ credentials.email.trim(),
94
+ credentials.password
95
+ );
96
+
97
+ userCredential = await linkWithCredential(currentUser, credential);
98
+
99
+ if (__DEV__) {
100
+ console.log("[FirebaseAuthProvider] Anonymous user converted successfully:", {
101
+ userId: userCredential.user.uid.slice(0, 8),
102
+ sameUser: currentUser.uid === userCredential.user.uid,
103
+ });
104
+ }
105
+ } else {
106
+ // Create new user
107
+ if (__DEV__) {
108
+ console.log("[FirebaseAuthProvider] Creating new user account");
109
+ }
110
+
111
+ userCredential = await createUserWithEmailAndPassword(
112
+ this.auth,
113
+ credentials.email.trim(),
114
+ credentials.password
115
+ );
116
+ }
80
117
 
81
118
  if (credentials.displayName && userCredential.user) {
82
119
  try {
@@ -3,7 +3,7 @@
3
3
  * Bottom sheet modal for authentication (Login/Register)
4
4
  */
5
5
 
6
- import React from "react";
6
+ import React, { useEffect } from "react";
7
7
  import { View, TouchableOpacity, ScrollView } from "react-native";
8
8
  import {
9
9
  useAppDesignTokens,
@@ -19,6 +19,8 @@ import { RegisterForm } from "./RegisterForm";
19
19
  import { SocialLoginButtons } from "./SocialLoginButtons";
20
20
  import { styles } from "./AuthBottomSheet.styles";
21
21
 
22
+ declare const __DEV__: boolean;
23
+
22
24
  export interface AuthBottomSheetProps {
23
25
  termsUrl?: string;
24
26
  privacyUrl?: string;
@@ -58,6 +60,22 @@ export const AuthBottomSheet: React.FC<AuthBottomSheetProps> = ({
58
60
  handleAppleSignIn,
59
61
  } = useAuthBottomSheet({ socialConfig, onGoogleSignIn, onAppleSignIn });
60
62
 
63
+ useEffect(() => {
64
+ if (__DEV__) {
65
+ console.log("[AuthBottomSheet] Rendered with:", {
66
+ mode,
67
+ providersCount: providers.length,
68
+ hasModalRef: !!modalRef.current,
69
+ hasTermsUrl: !!termsUrl,
70
+ hasPrivacyUrl: !!privacyUrl,
71
+ });
72
+ }
73
+ }, [mode, providers.length, termsUrl, privacyUrl, modalRef]);
74
+
75
+ if (__DEV__) {
76
+ console.log("[AuthBottomSheet] Rendering...");
77
+ }
78
+
61
79
  return (
62
80
  <BottomSheetModal
63
81
  ref={modalRef}
@@ -3,7 +3,7 @@
3
3
  * Single Responsibility: Render login form UI
4
4
  */
5
5
 
6
- import React, { useRef } from "react";
6
+ import React, { useRef, useEffect } from "react";
7
7
  import { View, StyleSheet, TextInput } from "react-native";
8
8
  import { AtomicInput, AtomicButton } from "@umituz/react-native-design-system";
9
9
  import { useLocalization } from "@umituz/react-native-localization";
@@ -11,6 +11,8 @@ import { useLoginForm } from "../hooks/useLoginForm";
11
11
  import { AuthErrorDisplay } from "./AuthErrorDisplay";
12
12
  import { AuthLink } from "./AuthLink";
13
13
 
14
+ declare const __DEV__: boolean;
15
+
14
16
  interface LoginFormProps {
15
17
  onNavigateToRegister: () => void;
16
18
  }
@@ -30,6 +32,21 @@ export const LoginForm: React.FC<LoginFormProps> = ({ onNavigateToRegister }) =>
30
32
  displayError,
31
33
  } = useLoginForm();
32
34
 
35
+ useEffect(() => {
36
+ if (__DEV__) {
37
+ console.log("[LoginForm] Mounted/Updated:", {
38
+ hasEmail: !!email,
39
+ hasPassword: !!password,
40
+ loading,
41
+ hasError: !!displayError,
42
+ });
43
+ }
44
+ }, [email, password, loading, displayError]);
45
+
46
+ if (__DEV__) {
47
+ console.log("[LoginForm] Rendering...");
48
+ }
49
+
33
50
  return (
34
51
  <>
35
52
  <View style={styles.inputContainer}>