@umituz/react-native-auth 4.3.23 → 4.3.25

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.3.23",
3
+ "version": "4.3.25",
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,6 +5,8 @@
5
5
 
6
6
  import type { IStorageProvider } from "../types/Storage.types";
7
7
 
8
+ declare const __DEV__: boolean;
9
+
8
10
  /**
9
11
  * Interface that describes the shape of common storage implementations
10
12
  * to avoid using 'any' and resolve lint errors.
@@ -42,7 +44,10 @@ export class StorageProviderAdapter implements IStorageProvider {
42
44
  } else {
43
45
  throw new Error("Unsupported storage implementation");
44
46
  }
45
- } catch {
47
+ } catch (error) {
48
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
49
+ console.warn("[StorageProviderAdapter] get failed for key:", key, error);
50
+ }
46
51
  return null;
47
52
  }
48
53
  }
@@ -3,8 +3,6 @@ import { View, TouchableOpacity, StyleSheet } from "react-native";
3
3
  import { useAppDesignTokens, AtomicIcon, AtomicText, useAlert, AlertType, AlertMode } from "@umituz/react-native-design-system";
4
4
  import { actionButtonStyle } from "../utils/commonStyles";
5
5
 
6
- declare const __DEV__: boolean;
7
-
8
6
  export interface AccountActionsConfig {
9
7
  logoutText: string;
10
8
  deleteAccountText: string;
@@ -67,33 +65,17 @@ export const AccountActions: React.FC<AccountActionsProps> = ({ config }) => {
67
65
  };
68
66
 
69
67
  const handleDeleteAccount = () => {
70
- if (typeof __DEV__ !== "undefined" && __DEV__) {
71
- console.log("[AccountActions] handleDeleteAccount called, showing confirmation modal");
72
- }
73
68
  alert.show(AlertType.ERROR, AlertMode.MODAL, deleteConfirmTitle, deleteConfirmMessage, {
74
69
  actions: [
75
- { id: "cancel", label: cancelText, style: "secondary", onPress: () => {
76
- if (typeof __DEV__ !== "undefined" && __DEV__) {
77
- console.log("[AccountActions] Delete account cancelled");
78
- }
79
- } },
70
+ { id: "cancel", label: cancelText, style: "secondary", onPress: () => {} },
80
71
  {
81
72
  id: "confirm",
82
73
  label: deleteAccountText,
83
74
  style: "destructive",
84
75
  onPress: async () => {
85
- if (typeof __DEV__ !== "undefined" && __DEV__) {
86
- console.log("[AccountActions] Delete account confirmed, modal should be closed now, calling onDeleteAccount");
87
- }
88
76
  try {
89
77
  await onDeleteAccount();
90
- if (typeof __DEV__ !== "undefined" && __DEV__) {
91
- console.log("[AccountActions] onDeleteAccount completed successfully");
92
- }
93
- } catch (error) {
94
- if (typeof __DEV__ !== "undefined" && __DEV__) {
95
- console.error("[AccountActions] onDeleteAccount failed:", error);
96
- }
78
+ } catch {
97
79
  alert.showError(deleteErrorTitle, deleteErrorMessage, { mode: AlertMode.MODAL });
98
80
  }
99
81
  },
@@ -7,8 +7,6 @@ import { useCallback, useState } from "react";
7
7
  import { useAuth } from "./useAuth";
8
8
  import { deleteCurrentUser } from "@umituz/react-native-firebase";
9
9
 
10
- declare const __DEV__: boolean;
11
-
12
10
  export interface UseAccountManagementOptions {
13
11
  /**
14
12
  * Callback invoked when reauthentication is required (for Google/Apple)
@@ -42,10 +40,6 @@ export const useAccountManagement = (
42
40
  }, [signOut]);
43
41
 
44
42
  const deleteAccount = useCallback(async () => {
45
- if (typeof __DEV__ !== "undefined" && __DEV__) {
46
- console.log("[useAccountManagement] deleteAccount called, user:", user);
47
- }
48
-
49
43
  if (!user) {
50
44
  throw new Error("No user logged in");
51
45
  }
@@ -57,24 +51,12 @@ export const useAccountManagement = (
57
51
  setIsDeletingAccount(true);
58
52
 
59
53
  try {
60
- if (typeof __DEV__ !== "undefined" && __DEV__) {
61
- console.log("[useAccountManagement] Calling deleteCurrentUser with options:", {
62
- autoReauthenticate: true,
63
- hasOnPasswordRequired: !!onPasswordRequired,
64
- hasOnReauthRequired: !!onReauthRequired,
65
- });
66
- }
67
-
68
54
  const result = await deleteCurrentUser({
69
55
  autoReauthenticate: true,
70
56
  onPasswordRequired,
71
57
  onGoogleReauthRequired: onReauthRequired,
72
58
  });
73
59
 
74
- if (typeof __DEV__ !== "undefined" && __DEV__) {
75
- console.log("[useAccountManagement] deleteCurrentUser result:", result);
76
- }
77
-
78
60
  if (!result.success) {
79
61
  throw new Error(result.error?.message || "Failed to delete account");
80
62
  }
@@ -6,8 +6,6 @@ import { useAccountManagement } from "./useAccountManagement";
6
6
  import { AlertService } from "@umituz/react-native-design-system";
7
7
  import { usePasswordPromptNavigation } from "./usePasswordPromptNavigation";
8
8
 
9
- declare const __DEV__: boolean;
10
-
11
9
  export interface AuthHandlersAppInfo {
12
10
  appStoreUrl?: string;
13
11
  }
@@ -80,21 +78,9 @@ export const useAuthHandlers = (appInfo: AuthHandlersAppInfo, translations?: Aut
80
78
  }, [signOut, translations]);
81
79
 
82
80
  const handleDeleteAccount = useCallback(async () => {
83
- if (typeof __DEV__ !== "undefined" && __DEV__) {
84
- console.log("[useAuthHandlers] handleDeleteAccount called");
85
- }
86
81
  try {
87
- if (typeof __DEV__ !== "undefined" && __DEV__) {
88
- console.log("[useAuthHandlers] Calling deleteAccountFromAuth...");
89
- }
90
82
  await deleteAccountFromAuth();
91
- if (typeof __DEV__ !== "undefined" && __DEV__) {
92
- console.log("[useAuthHandlers] deleteAccountFromAuth completed successfully");
93
- }
94
83
  } catch (error) {
95
- if (typeof __DEV__ !== "undefined" && __DEV__) {
96
- console.error("[useAuthHandlers] deleteAccountFromAuth failed:", error);
97
- }
98
84
  const errorMessage = error instanceof Error ? error.message : String(error);
99
85
  AlertService.createErrorAlert(
100
86
  translations?.common || "Error",
@@ -3,8 +3,6 @@ import { CommonActions } from '@react-navigation/native';
3
3
  import { AppNavigation } from '@umituz/react-native-design-system';
4
4
  import { setPasswordPromptCallback } from '../utils/passwordPromptCallback';
5
5
 
6
- declare const __DEV__: boolean;
7
-
8
6
  export interface UsePasswordPromptNavigationOptions {
9
7
  title?: string;
10
8
  message?: string;
@@ -22,10 +20,6 @@ export const usePasswordPromptNavigation = (
22
20
  const { title, message, confirmText, cancelText } = options;
23
21
 
24
22
  const showPasswordPrompt = useCallback((): Promise<string | null> => {
25
- if (typeof __DEV__ !== "undefined" && __DEV__) {
26
- console.log("[showPasswordPrompt] Called");
27
- }
28
-
29
23
  return new Promise<string | null>((resolve) => {
30
24
  setPasswordPromptCallback(resolve);
31
25
 
@@ -44,14 +38,7 @@ export const usePasswordPromptNavigation = (
44
38
  ],
45
39
  })
46
40
  );
47
-
48
- if (typeof __DEV__ !== "undefined" && __DEV__) {
49
- console.log("[showPasswordPrompt] Navigation reset to PasswordPrompt");
50
- }
51
- } catch (error) {
52
- if (typeof __DEV__ !== "undefined" && __DEV__) {
53
- console.error("[showPasswordPrompt] Navigation failed:", error);
54
- }
41
+ } catch {
55
42
  setPasswordPromptCallback(null);
56
43
  resolve(null);
57
44
  }
@@ -10,8 +10,6 @@ import {
10
10
  } from '@umituz/react-native-design-system';
11
11
  import { resolvePasswordPrompt } from '../utils/passwordPromptCallback';
12
12
 
13
- declare const __DEV__: boolean;
14
-
15
13
  export interface PasswordPromptScreenProps {
16
14
  route: {
17
15
  params: {
@@ -34,10 +32,6 @@ export const PasswordPromptScreen: React.FC<PasswordPromptScreenProps> = ({
34
32
  const [password, setPassword] = useState('');
35
33
  const [error, setError] = useState('');
36
34
 
37
- if (typeof __DEV__ !== "undefined" && __DEV__) {
38
- console.log("[PasswordPromptScreen] Rendered");
39
- }
40
-
41
35
  const {
42
36
  title = 'Password Required',
43
37
  message = 'Enter your password to continue',
@@ -46,25 +40,15 @@ export const PasswordPromptScreen: React.FC<PasswordPromptScreenProps> = ({
46
40
  } = route.params;
47
41
 
48
42
  const handleConfirm = () => {
49
- if (typeof __DEV__ !== "undefined" && __DEV__) {
50
- console.log("[PasswordPromptScreen] handleConfirm called, password length:", password.length);
51
- }
52
- // Don't trim password - whitespace may be intentional
53
43
  if (!password) {
54
44
  setError('Password is required');
55
45
  return;
56
46
  }
57
- if (typeof __DEV__ !== "undefined" && __DEV__) {
58
- console.log("[PasswordPromptScreen] Resolving password prompt and going back");
59
- }
60
47
  resolvePasswordPrompt(password);
61
48
  navigation.goBack();
62
49
  };
63
50
 
64
51
  const handleCancel = () => {
65
- if (typeof __DEV__ !== "undefined" && __DEV__) {
66
- console.log("[PasswordPromptScreen] handleCancel called");
67
- }
68
52
  resolvePasswordPrompt(null);
69
53
  navigation.goBack();
70
54
  };
@@ -32,17 +32,8 @@ export const useAuthStore = createStore<AuthState, AuthActions>({
32
32
  isAnonymous: state.isAnonymous,
33
33
  initialized: state.initialized,
34
34
  }),
35
- migrate: (persistedState: unknown, version: number) => {
35
+ migrate: (persistedState: unknown) => {
36
36
  const state = (persistedState && typeof persistedState === "object" ? persistedState : {}) as Partial<AuthState>;
37
- if (version < 2) {
38
- return {
39
- ...initialAuthState,
40
- isAnonymous: state.isAnonymous ?? false,
41
- initialized: state.initialized ?? false,
42
- };
43
- }
44
- // Only restore persisted fields (isAnonymous, initialized)
45
- // Never restore runtime state (user, firebaseUser, loading, error)
46
37
  return {
47
38
  ...initialAuthState,
48
39
  isAnonymous: state.isAnonymous ?? false,