@umituz/react-native-auth 4.1.2 → 4.2.0

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": "4.1.2",
3
+ "version": "4.2.0",
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",
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { useCallback, useState } from "react";
7
7
  import { useAuth } from "./useAuth";
8
- import { deleteCurrentUser, usePasswordPrompt } from "@umituz/react-native-firebase";
8
+ import { deleteCurrentUser } from "@umituz/react-native-firebase";
9
9
 
10
10
  export interface UseAccountManagementOptions {
11
11
  /**
@@ -15,16 +15,9 @@ export interface UseAccountManagementOptions {
15
15
  onReauthRequired?: () => Promise<string | null>;
16
16
  /**
17
17
  * Callback invoked when password reauthentication is required
18
- * If not provided, built-in Alert.prompt will be used
18
+ * Required for password-based accounts
19
19
  */
20
20
  onPasswordRequired?: () => Promise<string | null>;
21
- /**
22
- * Translations for built-in password prompt
23
- */
24
- passwordPromptTitle?: string;
25
- passwordPromptMessage?: string;
26
- passwordPromptCancel?: string;
27
- passwordPromptConfirm?: string;
28
21
  }
29
22
 
30
23
  export interface UseAccountManagementReturn {
@@ -32,7 +25,6 @@ export interface UseAccountManagementReturn {
32
25
  deleteAccount: () => Promise<void>;
33
26
  isLoading: boolean;
34
27
  isDeletingAccount: boolean;
35
- PasswordPromptComponent: React.ReactNode;
36
28
  }
37
29
 
38
30
  export const useAccountManagement = (
@@ -41,23 +33,7 @@ export const useAccountManagement = (
41
33
  const { user, loading, signOut } = useAuth();
42
34
  const [isDeletingAccount, setIsDeletingAccount] = useState(false);
43
35
 
44
- const {
45
- onReauthRequired,
46
- onPasswordRequired,
47
- passwordPromptTitle = "Password Required",
48
- passwordPromptMessage = "Enter your password to delete account",
49
- passwordPromptCancel = "Cancel",
50
- passwordPromptConfirm = "Confirm",
51
- } = options;
52
-
53
- const { showPasswordPrompt, PasswordPromptComponent } = usePasswordPrompt({
54
- title: passwordPromptTitle,
55
- message: passwordPromptMessage,
56
- cancelText: passwordPromptCancel,
57
- confirmText: passwordPromptConfirm,
58
- });
59
-
60
- const passwordHandler = onPasswordRequired || showPasswordPrompt;
36
+ const { onReauthRequired, onPasswordRequired } = options;
61
37
 
62
38
  const logout = useCallback(async () => {
63
39
  await signOut();
@@ -77,7 +53,7 @@ export const useAccountManagement = (
77
53
  try {
78
54
  const result = await deleteCurrentUser({
79
55
  autoReauthenticate: true,
80
- onPasswordRequired: passwordHandler,
56
+ onPasswordRequired,
81
57
  onGoogleReauthRequired: onReauthRequired,
82
58
  });
83
59
 
@@ -87,13 +63,12 @@ export const useAccountManagement = (
87
63
  } finally {
88
64
  setIsDeletingAccount(false);
89
65
  }
90
- }, [user, passwordHandler, onReauthRequired]);
66
+ }, [user, onPasswordRequired, onReauthRequired]);
91
67
 
92
68
  return {
93
69
  logout,
94
70
  deleteAccount,
95
71
  isLoading: loading,
96
72
  isDeletingAccount,
97
- PasswordPromptComponent,
98
73
  };
99
74
  };