@umituz/react-native-firebase 2.4.2 → 2.4.4

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-firebase",
3
- "version": "2.4.2",
3
+ "version": "2.4.4",
4
4
  "description": "Unified Firebase package for React Native apps - Auth and Firestore services using Firebase JS SDK (no native modules).",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -26,6 +26,3 @@ export {
26
26
  reauthenticateWithApple,
27
27
  getAppleReauthCredential,
28
28
  } from './infrastructure/services/reauthentication.service';
29
-
30
- export { PasswordPromptScreen } from './presentation/components/PasswordPromptScreen';
31
- export type { PasswordPromptScreenProps } from './presentation/components/PasswordPromptScreen';
@@ -4,6 +4,8 @@
4
4
  */
5
5
 
6
6
  import { deleteUser, type User } from "firebase/auth";
7
+
8
+ declare const __DEV__: boolean;
7
9
  import { getFirebaseAuth } from "../../../auth/infrastructure/config/FirebaseAuthClient";
8
10
  import {
9
11
  getUserAuthProvider,
@@ -23,10 +25,17 @@ export type { AccountDeletionOptions } from "../../application/ports/reauthentic
23
25
  export async function deleteCurrentUser(
24
26
  options: AccountDeletionOptions = { autoReauthenticate: true }
25
27
  ): Promise<AccountDeletionResult> {
28
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
29
+ console.log("[deleteCurrentUser] Called with options:", options);
30
+ }
31
+
26
32
  const auth = getFirebaseAuth();
27
33
  const user = auth?.currentUser;
28
34
 
29
35
  if (!auth || !user) {
36
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
37
+ console.log("[deleteCurrentUser] Auth not ready");
38
+ }
30
39
  return {
31
40
  success: false,
32
41
  error: { code: "auth/not-ready", message: "Auth not ready" },
@@ -35,6 +44,9 @@ export async function deleteCurrentUser(
35
44
  }
36
45
 
37
46
  if (user.isAnonymous) {
47
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
48
+ console.log("[deleteCurrentUser] Cannot delete anonymous user");
49
+ }
38
50
  return {
39
51
  success: false,
40
52
  error: { code: "auth/anonymous", message: "Cannot delete anonymous" },
@@ -43,9 +55,18 @@ export async function deleteCurrentUser(
43
55
  }
44
56
 
45
57
  const provider = getUserAuthProvider(user);
58
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
59
+ console.log("[deleteCurrentUser] User provider:", provider);
60
+ }
46
61
 
47
62
  if (provider === "password" && options.autoReauthenticate && options.onPasswordRequired) {
63
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
64
+ console.log("[deleteCurrentUser] Password provider, calling attemptReauth");
65
+ }
48
66
  const reauth = await attemptReauth(user, options);
67
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
68
+ console.log("[deleteCurrentUser] attemptReauth result:", reauth);
69
+ }
49
70
  if (reauth) return reauth;
50
71
  }
51
72
 
@@ -74,12 +95,26 @@ export async function deleteCurrentUser(
74
95
  }
75
96
 
76
97
  async function attemptReauth(user: User, options: AccountDeletionOptions): Promise<AccountDeletionResult | null> {
98
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
99
+ console.log("[attemptReauth] Called");
100
+ }
101
+
77
102
  const provider = getUserAuthProvider(user);
103
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
104
+ console.log("[attemptReauth] Provider:", provider);
105
+ }
106
+
78
107
  let res: { success: boolean; error?: { code?: string; message?: string } };
79
108
 
80
109
  if (provider === "apple.com") {
110
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
111
+ console.log("[attemptReauth] Apple provider");
112
+ }
81
113
  res = await reauthenticateWithApple(user);
82
114
  } else if (provider === "google.com") {
115
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
116
+ console.log("[attemptReauth] Google provider");
117
+ }
83
118
  let googleToken = options.googleIdToken;
84
119
  if (!googleToken && options.onGoogleReauthRequired) {
85
120
  const token = await options.onGoogleReauthRequired();
@@ -101,9 +136,18 @@ async function attemptReauth(user: User, options: AccountDeletionOptions): Promi
101
136
  }
102
137
  res = await reauthenticateWithGoogle(user, googleToken);
103
138
  } else if (provider === "password") {
139
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
140
+ console.log("[attemptReauth] Password provider, calling onPasswordRequired...");
141
+ }
104
142
  let password = options.password;
105
143
  if (!password && options.onPasswordRequired) {
144
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
145
+ console.log("[attemptReauth] Calling onPasswordRequired callback");
146
+ }
106
147
  const pwd = await options.onPasswordRequired();
148
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
149
+ console.log("[attemptReauth] onPasswordRequired returned:", pwd ? "password received" : "null/cancelled");
150
+ }
107
151
  if (!pwd) {
108
152
  return {
109
153
  success: false,
@@ -1,170 +0,0 @@
1
- /**
2
- * Password Prompt Screen
3
- * Navigation screen for password input during account deletion reauthentication
4
- */
5
-
6
- import React, { useState, useEffect } from 'react';
7
- import { View, StyleSheet, KeyboardAvoidingView, Platform, TouchableOpacity } from 'react-native';
8
- import {
9
- AtomicInput,
10
- AtomicButton,
11
- AtomicText,
12
- AtomicIcon,
13
- SafeAreaView,
14
- useAppDesignTokens
15
- } from '@umituz/react-native-design-system';
16
-
17
- export interface PasswordPromptScreenProps {
18
- route: {
19
- params: {
20
- onComplete: (password: string | null) => void;
21
- title?: string;
22
- message?: string;
23
- confirmText?: string;
24
- cancelText?: string;
25
- };
26
- };
27
- navigation: {
28
- goBack: () => void;
29
- };
30
- }
31
-
32
- export const PasswordPromptScreen: React.FC<PasswordPromptScreenProps> = ({
33
- route,
34
- navigation,
35
- }) => {
36
- const tokens = useAppDesignTokens();
37
- const [password, setPassword] = useState('');
38
- const [error, setError] = useState('');
39
-
40
- const {
41
- onComplete,
42
- title = 'Password Required',
43
- message = 'Enter your password to continue',
44
- confirmText = 'Confirm',
45
- cancelText = 'Cancel',
46
- } = route.params;
47
-
48
- useEffect(() => {
49
- return () => {
50
- onComplete(null);
51
- };
52
- }, [onComplete]);
53
-
54
- const handleConfirm = () => {
55
- if (!password.trim()) {
56
- setError('Password is required');
57
- return;
58
- }
59
- onComplete(password);
60
- navigation.goBack();
61
- };
62
-
63
- const handleCancel = () => {
64
- onComplete(null);
65
- navigation.goBack();
66
- };
67
-
68
- return (
69
- <SafeAreaView style={[styles.safeArea, { backgroundColor: tokens.colors.background }]} edges={['top', 'bottom']}>
70
- <View style={[styles.headerBar, { borderBottomColor: tokens.colors.border }]}>
71
- <TouchableOpacity onPress={handleCancel} style={styles.closeButton}>
72
- <AtomicIcon name="close" size="lg" color="textSecondary" />
73
- </TouchableOpacity>
74
- <AtomicText type="headlineLarge" fontWeight="600" color="textPrimary">
75
- {title}
76
- </AtomicText>
77
- <View style={styles.placeholder} />
78
- </View>
79
-
80
- <KeyboardAvoidingView
81
- behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
82
- style={styles.keyboardView}
83
- >
84
- <View style={[styles.container, { padding: tokens.spacing.xl }]}>
85
- <View style={styles.messageContainer}>
86
- <AtomicText type="bodyMedium" color="textSecondary" style={styles.message}>
87
- {message}
88
- </AtomicText>
89
- </View>
90
-
91
- <View style={styles.content}>
92
- <AtomicInput
93
- value={password}
94
- onChangeText={(text: string) => {
95
- setPassword(text);
96
- setError('');
97
- }}
98
- placeholder="Password"
99
- secureTextEntry
100
- autoFocus
101
- state={error ? 'error' : 'default'}
102
- helperText={error}
103
- style={{ marginBottom: tokens.spacing.md }}
104
- />
105
- </View>
106
-
107
- <View style={[styles.buttons, { gap: tokens.spacing.sm }]}>
108
- <AtomicButton
109
- title={cancelText}
110
- onPress={handleCancel}
111
- variant="secondary"
112
- style={styles.button}
113
- />
114
- <AtomicButton
115
- title={confirmText}
116
- onPress={handleConfirm}
117
- variant="primary"
118
- style={styles.button}
119
- />
120
- </View>
121
- </View>
122
- </KeyboardAvoidingView>
123
- </SafeAreaView>
124
- );
125
- };
126
-
127
- const styles = StyleSheet.create({
128
- safeArea: {
129
- flex: 1,
130
- },
131
- headerBar: {
132
- flexDirection: 'row',
133
- alignItems: 'center',
134
- justifyContent: 'space-between',
135
- paddingHorizontal: 16,
136
- paddingVertical: 12,
137
- borderBottomWidth: 1,
138
- },
139
- closeButton: {
140
- padding: 4,
141
- width: 40,
142
- },
143
- placeholder: {
144
- width: 40,
145
- },
146
- keyboardView: {
147
- flex: 1,
148
- },
149
- container: {
150
- flex: 1,
151
- justifyContent: 'center',
152
- },
153
- messageContainer: {
154
- marginBottom: 24,
155
- },
156
- message: {
157
- textAlign: 'center',
158
- lineHeight: 22,
159
- },
160
- content: {
161
- flex: 1,
162
- justifyContent: 'center',
163
- },
164
- buttons: {
165
- flexDirection: 'row',
166
- },
167
- button: {
168
- flex: 1,
169
- },
170
- });