@umituz/react-native-firebase 2.4.5 → 2.4.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-firebase",
3
- "version": "2.4.5",
3
+ "version": "2.4.6",
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",
@@ -67,13 +67,30 @@ export async function deleteCurrentUser(
67
67
  if (typeof __DEV__ !== "undefined" && __DEV__) {
68
68
  console.log("[deleteCurrentUser] attemptReauth result:", reauth);
69
69
  }
70
- if (reauth) return reauth;
70
+ if (reauth) {
71
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
72
+ console.log("[deleteCurrentUser] Reauth returned result, returning:", reauth);
73
+ }
74
+ return reauth;
75
+ }
76
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
77
+ console.log("[deleteCurrentUser] Reauth returned null, continuing to deleteUser");
78
+ }
71
79
  }
72
80
 
73
81
  try {
82
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
83
+ console.log("[deleteCurrentUser] Calling deleteUser");
84
+ }
74
85
  await deleteUser(user);
86
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
87
+ console.log("[deleteCurrentUser] deleteUser successful");
88
+ }
75
89
  return successResult();
76
90
  } catch (error: unknown) {
91
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
92
+ console.error("[deleteCurrentUser] deleteUser failed:", error);
93
+ }
77
94
  const errorInfo = toAuthErrorInfo(error);
78
95
  const code = errorInfo.code;
79
96
  const message = errorInfo.message;
@@ -149,34 +166,57 @@ async function attemptReauth(user: User, options: AccountDeletionOptions): Promi
149
166
  console.log("[attemptReauth] onPasswordRequired returned:", pwd ? "password received" : "null/cancelled");
150
167
  }
151
168
  if (!pwd) {
169
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
170
+ console.log("[attemptReauth] Password was null/cancelled, returning error");
171
+ }
152
172
  return {
153
173
  success: false,
154
174
  error: { code: "auth/password-reauth-cancelled", message: "Password reauth cancelled" },
155
175
  requiresReauth: true
156
176
  };
157
177
  }
178
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
179
+ console.log("[attemptReauth] Password received, setting password variable");
180
+ }
158
181
  password = pwd;
159
182
  }
160
183
  if (!password) {
184
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
185
+ console.log("[attemptReauth] No password available after callback, returning error");
186
+ }
161
187
  return {
162
188
  success: false,
163
189
  error: { code: "auth/password-reauth", message: "Password required" },
164
190
  requiresReauth: true
165
191
  };
166
192
  }
193
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
194
+ console.log("[attemptReauth] Calling reauthenticateWithPassword");
195
+ }
167
196
  res = await reauthenticateWithPassword(user, password);
197
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
198
+ console.log("[attemptReauth] reauthenticateWithPassword result:", res);
199
+ }
168
200
  } else {
169
201
  return null;
170
202
  }
171
203
 
172
204
  if (res.success) {
205
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
206
+ console.log("[attemptReauth] Reauthentication successful, calling deleteUser");
207
+ }
173
208
  try {
174
- // After reauthentication, get fresh user reference from auth
175
209
  const auth = getFirebaseAuth();
176
210
  const currentUser = auth?.currentUser || user;
177
211
  await deleteUser(currentUser);
212
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
213
+ console.log("[attemptReauth] deleteUser successful after reauth");
214
+ }
178
215
  return successResult();
179
216
  } catch (err: unknown) {
217
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
218
+ console.error("[attemptReauth] deleteUser failed after reauth:", err);
219
+ }
180
220
  const errorInfo = toAuthErrorInfo(err);
181
221
  return {
182
222
  success: false,
@@ -186,6 +226,9 @@ async function attemptReauth(user: User, options: AccountDeletionOptions): Promi
186
226
  }
187
227
  }
188
228
 
229
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
230
+ console.log("[attemptReauth] Reauthentication failed, returning error");
231
+ }
189
232
  return {
190
233
  success: false,
191
234
  error: {