@umituz/react-native-auth 4.3.26 → 4.3.28

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.26",
3
+ "version": "4.3.28",
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
@@ -55,8 +55,6 @@ export { useUserProfile } from './presentation/hooks/useUserProfile';
55
55
  export type { UserProfileData, UseUserProfileParams } from './presentation/hooks/useUserProfile';
56
56
  export { useAccountManagement } from './presentation/hooks/useAccountManagement';
57
57
  export type { UseAccountManagementReturn, UseAccountManagementOptions } from './presentation/hooks/useAccountManagement';
58
- export { useProfileUpdate } from './presentation/hooks/useProfileUpdate';
59
- export type { UseProfileUpdateReturn } from './presentation/hooks/useProfileUpdate';
60
58
  export { useProfileEdit } from './presentation/hooks/useProfileEdit';
61
59
  export type { ProfileEditFormState, UseProfileEditReturn } from './presentation/hooks/useProfileEdit';
62
60
  export { useSocialLogin } from './presentation/hooks/useSocialLogin';
@@ -34,13 +34,11 @@ export function useAuthBottomSheet(params: UseAuthBottomSheetParams = {}) {
34
34
  const { isAuthenticated, isAnonymous } = useAuth();
35
35
 
36
36
  // Social Auth Hooks
37
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
38
37
  const { signInWithGoogle, googleConfigured } = useGoogleAuth(socialConfig?.google);
39
38
  const { signInWithApple, appleAvailable } = useAppleAuth();
40
39
 
41
40
  // Determine enabled providers
42
41
  const providers = useMemo<SocialAuthProvider[]>(() => {
43
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
44
42
  return determineEnabledProviders(socialConfig, appleAvailable, googleConfigured);
45
43
  }, [socialConfig, appleAvailable, googleConfigured]);
46
44
 
@@ -100,7 +98,6 @@ export function useAuthBottomSheet(params: UseAuthBottomSheetParams = {}) {
100
98
  if (onGoogleSignIn) {
101
99
  await onGoogleSignIn();
102
100
  } else if (signInWithGoogle) {
103
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
104
101
  await signInWithGoogle();
105
102
  }
106
103
  } finally {
@@ -48,7 +48,6 @@ export function useLoginForm(config?: UseLoginFormConfig): UseLoginFormResult {
48
48
 
49
49
  const { fields, updateField } = useFormFields(
50
50
  { email: "", password: "" },
51
- null,
52
51
  { clearLocalError }
53
52
  );
54
53
 
@@ -105,10 +104,10 @@ export function useLoginForm(config?: UseLoginFormConfig): UseLoginFormResult {
105
104
  const handleContinueAnonymously = useCallback(async () => {
106
105
  try {
107
106
  await continueAnonymously();
108
- } catch {
109
- // Silently fail - anonymous mode is optional
107
+ } catch (err: unknown) {
108
+ setLocalError(handleAuthError(err));
110
109
  }
111
- }, [continueAnonymously]);
110
+ }, [continueAnonymously, handleAuthError]);
112
111
 
113
112
  const displayError = localError || error;
114
113
 
@@ -41,7 +41,6 @@ export function useRegisterForm(config?: UseRegisterFormConfig): UseRegisterForm
41
41
  password: "",
42
42
  confirmPassword: "",
43
43
  },
44
- setFieldErrors,
45
44
  { clearLocalError }
46
45
  );
47
46
 
@@ -53,17 +53,11 @@ export const useAuthStore = createStore<AuthState, AuthActions>({
53
53
 
54
54
  setIsAnonymous: (isAnonymous) => {
55
55
  const currentState = get();
56
- // Only update isAnonymous if it's consistent with the firebaseUser state
57
- // If we have a firebaseUser, isAnonymous should match it
58
- const currentUserIsAnonymous = currentState.firebaseUser?.isAnonymous ?? false;
59
-
60
- if (currentState.firebaseUser) {
61
- // We have a firebase user - sync isAnonymous with it
62
- set({ isAnonymous: currentUserIsAnonymous });
63
- } else {
64
- // No firebase user yet, allow setting isAnonymous for anonymous mode preference
65
- set({ isAnonymous });
66
- }
56
+ // When firebaseUser exists, always derive from it to stay consistent
57
+ const resolved = currentState.firebaseUser
58
+ ? currentState.firebaseUser.isAnonymous
59
+ : isAnonymous;
60
+ set({ isAnonymous: resolved });
67
61
  },
68
62
 
69
63
  setError: (error) => {
@@ -13,13 +13,11 @@ interface UseFormFieldOptions {
13
13
  /**
14
14
  * Hook for managing multiple form fields
15
15
  * @param initialFields - Initial field values
16
- * @param setFieldErrors - Function to set field errors in parent state
17
16
  * @param options - Additional options
18
17
  * @returns Field states and handlers
19
18
  */
20
19
  export function useFormFields<T extends Record<string, string>>(
21
20
  initialFields: T,
22
- _setFieldErrors: ((errors: Partial<Record<string, string>> | ((prev: Partial<Record<string, string>>) => Partial<Record<string, string>>)) => void) | null,
23
21
  options?: UseFormFieldOptions
24
22
  ) {
25
23
  type FieldKey = keyof T;
@@ -1,41 +0,0 @@
1
- /**
2
- * useProfileUpdate Hook
3
- * Hook for profile updates - implementation should be provided by app
4
- * Apps should use Firebase SDK directly or backend API
5
- */
6
-
7
- import { useCallback } from "react";
8
- import { useAuth } from "./useAuth";
9
- import type { UpdateProfileParams } from "../../domain/entities/UserProfile";
10
-
11
- export interface UseProfileUpdateReturn {
12
- updateProfile: (params: UpdateProfileParams) => Promise<void>;
13
- isUpdating: boolean;
14
- error: string | null;
15
- }
16
-
17
- export const useProfileUpdate = (): UseProfileUpdateReturn => {
18
- const { user } = useAuth();
19
-
20
- const updateProfile = useCallback(
21
- (_params: UpdateProfileParams) => {
22
- if (!user) {
23
- return Promise.reject(new Error("No user logged in"));
24
- }
25
-
26
- if (user.isAnonymous) {
27
- return Promise.reject(new Error("Anonymous users cannot update profile"));
28
- }
29
-
30
- return Promise.reject(new Error("Profile update not implemented - use Firebase SDK directly"));
31
- },
32
- [user],
33
- );
34
-
35
- return {
36
- updateProfile,
37
- isUpdating: false,
38
- error: null,
39
- };
40
- };
41
-