@umituz/react-native-auth 3.8.5 → 4.0.1

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.8.5",
3
+ "version": "4.0.1",
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",
@@ -103,6 +103,6 @@
103
103
  "LICENSE"
104
104
  ],
105
105
  "dependencies": {
106
- "@umituz/react-native-firebase": "^1.14.3"
106
+ "@umituz/react-native-firebase": "^2.0.2"
107
107
  }
108
108
  }
@@ -111,52 +111,15 @@ export const useAccountManagement = (
111
111
  setIsDeletingAccount(true);
112
112
 
113
113
  try {
114
- // First attempt - Firebase will check if reauthentication is needed
115
- const result = await deleteCurrentUser({ autoReauthenticate: true });
116
-
117
- if (result.success) {
118
- return;
119
- }
120
-
121
- // Handle password reauthentication
122
- if (result.error?.code === "auth/password-reauth") {
123
- const password = await passwordHandler();
124
- if (!password) {
125
- throw new Error("Password required to delete account");
126
- }
127
-
128
- // Retry with password
129
- const retryResult = await deleteCurrentUser({
130
- autoReauthenticate: true,
131
- password,
132
- });
133
-
134
- if (!retryResult.success) {
135
- throw new Error(retryResult.error?.message || "Failed to delete account");
136
- }
137
-
138
- return;
114
+ const result = await deleteCurrentUser({
115
+ autoReauthenticate: true,
116
+ onPasswordRequired: passwordHandler,
117
+ onGoogleReauthRequired: onReauthRequired,
118
+ });
119
+
120
+ if (!result.success) {
121
+ throw new Error(result.error?.message || "Failed to delete account");
139
122
  }
140
-
141
- // Handle social auth reauthentication
142
- if (result.requiresReauth && onReauthRequired) {
143
- const reauthSuccess = await onReauthRequired();
144
- if (!reauthSuccess) {
145
- throw new Error("Reauthentication required to delete account");
146
- }
147
-
148
- // Retry after social reauth
149
- const retryResult = await deleteCurrentUser({ autoReauthenticate: true });
150
-
151
- if (!retryResult.success) {
152
- throw new Error(retryResult.error?.message || "Failed to delete account");
153
- }
154
-
155
- return;
156
- }
157
-
158
- // Other errors
159
- throw new Error(result.error?.message || "Failed to delete account");
160
123
  } finally {
161
124
  setIsDeletingAccount(false);
162
125
  }