@umituz/react-native-auth 4.2.5 → 4.2.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-auth",
3
- "version": "4.2.5",
3
+ "version": "4.2.6",
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",
package/src/index.ts CHANGED
@@ -62,7 +62,7 @@ export type { UseAppleAuthResult } from './presentation/hooks/useAppleAuth';
62
62
  export { useAuthBottomSheet } from './presentation/hooks/useAuthBottomSheet';
63
63
  export type { SocialAuthConfiguration } from './presentation/hooks/useAuthBottomSheet';
64
64
  export { useAuthHandlers } from './presentation/hooks/useAuthHandlers';
65
- export type { AuthHandlersAppInfo, AuthHandlersTranslations } from './presentation/hooks/useAuthHandlers';
65
+ export type { AuthHandlersAppInfo, AuthHandlersTranslations, AuthHandlersOptions } from './presentation/hooks/useAuthHandlers';
66
66
  export { usePasswordPromptNavigation } from './presentation/hooks/usePasswordPromptNavigation';
67
67
  export type { UsePasswordPromptNavigationOptions, UsePasswordPromptNavigationReturn } from './presentation/hooks/usePasswordPromptNavigation';
68
68
 
@@ -31,10 +31,18 @@ export interface AuthHandlersTranslations {
31
31
  deleteAccountError?: string;
32
32
  }
33
33
 
34
+ export interface AuthHandlersOptions {
35
+ onClose?: () => void;
36
+ }
37
+
34
38
  /**
35
39
  * Hook that provides authentication-related handlers
36
40
  */
37
- export const useAuthHandlers = (appInfo: AuthHandlersAppInfo, translations?: AuthHandlersTranslations) => {
41
+ export const useAuthHandlers = (
42
+ appInfo: AuthHandlersAppInfo,
43
+ translations?: AuthHandlersTranslations,
44
+ options?: AuthHandlersOptions
45
+ ) => {
38
46
  const { signOut } = useAuth();
39
47
  const { showAuthModal } = useAuthModalStore();
40
48
 
@@ -93,6 +101,14 @@ export const useAuthHandlers = (appInfo: AuthHandlersAppInfo, translations?: Aut
93
101
  console.log("[useAuthHandlers] handleDeleteAccount called");
94
102
  }
95
103
  try {
104
+ if (options?.onClose) {
105
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
106
+ console.log("[useAuthHandlers] Closing modal before delete...");
107
+ }
108
+ options.onClose();
109
+ await new Promise(resolve => setTimeout(resolve, 300));
110
+ }
111
+
96
112
  if (typeof __DEV__ !== "undefined" && __DEV__) {
97
113
  console.log("[useAuthHandlers] Calling deleteAccountFromAuth...");
98
114
  }
@@ -110,7 +126,7 @@ export const useAuthHandlers = (appInfo: AuthHandlersAppInfo, translations?: Aut
110
126
  errorMessage || translations?.deleteAccountError || "Failed to delete account"
111
127
  );
112
128
  }
113
- }, [deleteAccountFromAuth, translations]);
129
+ }, [deleteAccountFromAuth, translations, options]);
114
130
 
115
131
  const handleSignIn = useCallback(() => {
116
132
  showAuthModal(undefined, "login");
@@ -68,16 +68,11 @@ export const usePasswordPromptNavigation = (
68
68
 
69
69
  try {
70
70
  if (typeof __DEV__ !== "undefined" && __DEV__) {
71
- console.log("[showPasswordPrompt] Navigating to PasswordPrompt with params:", { title, message });
72
- console.log("[showPasswordPrompt] AppNavigation.isReady():", AppNavigation.isReady());
73
- console.log("[showPasswordPrompt] AppNavigation.getCurrentRoute():", AppNavigation.getCurrentRoute());
74
- }
75
-
76
- if (!AppNavigation.isReady()) {
77
- throw new Error("Navigation is not ready");
71
+ console.log("[showPasswordPrompt] Navigating to PasswordPrompt");
78
72
  }
79
73
 
80
74
  AppNavigation.navigate('PasswordPrompt', params);
75
+
81
76
  if (typeof __DEV__ !== "undefined" && __DEV__) {
82
77
  console.log("[showPasswordPrompt] Navigation called successfully");
83
78
  }