@umituz/react-native-auth 2.0.2 → 2.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.
Files changed (94) hide show
  1. package/package.json +21 -32
  2. package/src/index.ts +8 -0
  3. package/src/presentation/components/AuthBottomSheet.tsx +175 -0
  4. package/src/presentation/stores/authModalStore.ts +72 -0
  5. package/README.md +0 -227
  6. package/lib/__tests__/services/AuthCoreService.test.d.ts +0 -4
  7. package/lib/__tests__/services/AuthCoreService.test.js +0 -198
  8. package/lib/__tests__/services/AuthPackage.test.d.ts +0 -4
  9. package/lib/__tests__/services/AuthPackage.test.js +0 -177
  10. package/lib/__tests__/services/GuestModeService.test.d.ts +0 -4
  11. package/lib/__tests__/services/GuestModeService.test.js +0 -141
  12. package/lib/__tests__/utils/AuthValidation.test.d.ts +0 -4
  13. package/lib/__tests__/utils/AuthValidation.test.js +0 -222
  14. package/lib/application/ports/IAuthProvider.d.ts +0 -42
  15. package/lib/application/ports/IAuthProvider.js +0 -5
  16. package/lib/application/ports/IAuthService.d.ts +0 -48
  17. package/lib/application/ports/IAuthService.js +0 -5
  18. package/lib/domain/entities/AuthUser.d.ts +0 -12
  19. package/lib/domain/entities/AuthUser.js +0 -5
  20. package/lib/domain/errors/AuthError.d.ts +0 -36
  21. package/lib/domain/errors/AuthError.js +0 -76
  22. package/lib/domain/value-objects/AuthConfig.d.ts +0 -16
  23. package/lib/domain/value-objects/AuthConfig.js +0 -14
  24. package/lib/index.d.ts +0 -45
  25. package/lib/index.js +0 -59
  26. package/lib/infrastructure/adapters/StorageProviderAdapter.d.ts +0 -16
  27. package/lib/infrastructure/adapters/StorageProviderAdapter.js +0 -72
  28. package/lib/infrastructure/adapters/UIProviderAdapter.d.ts +0 -18
  29. package/lib/infrastructure/adapters/UIProviderAdapter.js +0 -28
  30. package/lib/infrastructure/providers/FirebaseAuthProvider.d.ts +0 -19
  31. package/lib/infrastructure/providers/FirebaseAuthProvider.js +0 -94
  32. package/lib/infrastructure/services/AuthCoreService.d.ts +0 -22
  33. package/lib/infrastructure/services/AuthCoreService.js +0 -102
  34. package/lib/infrastructure/services/AuthEventService.d.ts +0 -28
  35. package/lib/infrastructure/services/AuthEventService.js +0 -88
  36. package/lib/infrastructure/services/AuthPackage.d.ts +0 -62
  37. package/lib/infrastructure/services/AuthPackage.js +0 -91
  38. package/lib/infrastructure/services/AuthService.d.ts +0 -42
  39. package/lib/infrastructure/services/AuthService.js +0 -123
  40. package/lib/infrastructure/services/GuestModeService.d.ts +0 -23
  41. package/lib/infrastructure/services/GuestModeService.js +0 -69
  42. package/lib/infrastructure/storage/GuestModeStorage.d.ts +0 -16
  43. package/lib/infrastructure/storage/GuestModeStorage.js +0 -73
  44. package/lib/infrastructure/utils/AuthErrorMapper.d.ts +0 -8
  45. package/lib/infrastructure/utils/AuthErrorMapper.js +0 -51
  46. package/lib/infrastructure/utils/AuthEventEmitter.d.ts +0 -12
  47. package/lib/infrastructure/utils/AuthEventEmitter.js +0 -25
  48. package/lib/infrastructure/utils/AuthValidation.d.ts +0 -49
  49. package/lib/infrastructure/utils/AuthValidation.js +0 -133
  50. package/lib/infrastructure/utils/UserMapper.d.ts +0 -15
  51. package/lib/infrastructure/utils/UserMapper.js +0 -16
  52. package/lib/presentation/components/AuthContainer.d.ts +0 -10
  53. package/lib/presentation/components/AuthContainer.js +0 -27
  54. package/lib/presentation/components/AuthDivider.d.ts +0 -6
  55. package/lib/presentation/components/AuthDivider.js +0 -36
  56. package/lib/presentation/components/AuthErrorDisplay.d.ts +0 -10
  57. package/lib/presentation/components/AuthErrorDisplay.js +0 -24
  58. package/lib/presentation/components/AuthFormCard.d.ts +0 -10
  59. package/lib/presentation/components/AuthFormCard.js +0 -19
  60. package/lib/presentation/components/AuthGradientBackground.d.ts +0 -6
  61. package/lib/presentation/components/AuthGradientBackground.js +0 -8
  62. package/lib/presentation/components/AuthHeader.d.ts +0 -11
  63. package/lib/presentation/components/AuthHeader.js +0 -38
  64. package/lib/presentation/components/AuthLegalLinks.d.ts +0 -28
  65. package/lib/presentation/components/AuthLegalLinks.js +0 -54
  66. package/lib/presentation/components/AuthLink.d.ts +0 -13
  67. package/lib/presentation/components/AuthLink.js +0 -27
  68. package/lib/presentation/components/LoginForm.d.ts +0 -10
  69. package/lib/presentation/components/LoginForm.js +0 -27
  70. package/lib/presentation/components/PasswordMatchIndicator.d.ts +0 -9
  71. package/lib/presentation/components/PasswordMatchIndicator.js +0 -30
  72. package/lib/presentation/components/PasswordStrengthIndicator.d.ts +0 -11
  73. package/lib/presentation/components/PasswordStrengthIndicator.js +0 -60
  74. package/lib/presentation/components/RegisterForm.d.ts +0 -14
  75. package/lib/presentation/components/RegisterForm.js +0 -30
  76. package/lib/presentation/hooks/useAuth.d.ts +0 -44
  77. package/lib/presentation/hooks/useAuth.js +0 -38
  78. package/lib/presentation/hooks/useAuthActions.d.ts +0 -15
  79. package/lib/presentation/hooks/useAuthActions.js +0 -162
  80. package/lib/presentation/hooks/useAuthState.d.ts +0 -19
  81. package/lib/presentation/hooks/useAuthState.js +0 -79
  82. package/lib/presentation/hooks/useLoginForm.d.ts +0 -21
  83. package/lib/presentation/hooks/useLoginForm.js +0 -131
  84. package/lib/presentation/hooks/useRegisterForm.d.ts +0 -31
  85. package/lib/presentation/hooks/useRegisterForm.js +0 -136
  86. package/lib/presentation/navigation/AuthNavigator.d.ts +0 -28
  87. package/lib/presentation/navigation/AuthNavigator.js +0 -37
  88. package/lib/presentation/screens/LoginScreen.d.ts +0 -6
  89. package/lib/presentation/screens/LoginScreen.js +0 -15
  90. package/lib/presentation/screens/RegisterScreen.d.ts +0 -12
  91. package/lib/presentation/screens/RegisterScreen.js +0 -15
  92. package/lib/presentation/utils/getAuthErrorMessage.d.ts +0 -8
  93. package/lib/presentation/utils/getAuthErrorMessage.js +0 -69
  94. package/src/domain/errors/AuthError.ts +0 -85
@@ -1,15 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useNavigation } from "@react-navigation/native";
3
- import { useLocalization } from "@umituz/react-native-localization";
4
- import { AuthContainer } from "../components/AuthContainer";
5
- import { AuthHeader } from "../components/AuthHeader";
6
- import { AuthFormCard } from "../components/AuthFormCard";
7
- import { RegisterForm } from "../components/RegisterForm";
8
- export const RegisterScreen = ({ termsUrl, privacyUrl, onTermsPress, onPrivacyPress, }) => {
9
- const { t } = useLocalization();
10
- const navigation = useNavigation();
11
- const handleNavigateToLogin = () => {
12
- navigation.navigate("Login");
13
- };
14
- return (_jsxs(AuthContainer, { children: [_jsx(AuthHeader, { title: t("auth.createAccount") }), _jsx(AuthFormCard, { children: _jsx(RegisterForm, { onNavigateToLogin: handleNavigateToLogin, termsUrl: termsUrl, privacyUrl: privacyUrl, onTermsPress: onTermsPress, onPrivacyPress: onPrivacyPress }) })] }));
15
- };
@@ -1,8 +0,0 @@
1
- /**
2
- * Get localized error message from AuthError
3
- * Maps error codes to localization keys
4
- */
5
- /**
6
- * Map AuthError code to localization key
7
- */
8
- export declare function getAuthErrorLocalizationKey(error: Error): string;
@@ -1,69 +0,0 @@
1
- /**
2
- * Get localized error message from AuthError
3
- * Maps error codes to localization keys
4
- */
5
- import { AuthError } from "../../domain/errors/AuthError";
6
- /**
7
- * Map AuthError code to localization key
8
- */
9
- export function getAuthErrorLocalizationKey(error) {
10
- const code = error instanceof AuthError ? error.code : undefined;
11
- // Map error codes to localization keys
12
- const errorCodeMap = {
13
- AUTH_INVALID_EMAIL: "auth.errors.invalidEmail",
14
- AUTH_WEAK_PASSWORD: "auth.errors.weakPassword",
15
- AUTH_USER_NOT_FOUND: "auth.errors.userNotFound",
16
- AUTH_WRONG_PASSWORD: "auth.errors.wrongPassword",
17
- AUTH_EMAIL_ALREADY_IN_USE: "auth.errors.emailAlreadyInUse",
18
- AUTH_NETWORK_ERROR: "auth.errors.networkError",
19
- AUTH_CONFIG_ERROR: "auth.errors.configurationError",
20
- AUTH_TOO_MANY_REQUESTS: "auth.errors.tooManyRequests",
21
- AUTH_USER_DISABLED: "auth.errors.userDisabled",
22
- AUTH_NOT_INITIALIZED: "auth.errors.authNotInitialized",
23
- };
24
- // Check error name for specific error types
25
- if (error.name === "AuthInvalidEmailError") {
26
- return "auth.errors.invalidEmail";
27
- }
28
- if (error.name === "AuthWeakPasswordError") {
29
- return "auth.errors.weakPassword";
30
- }
31
- if (error.name === "AuthUserNotFoundError") {
32
- return "auth.errors.userNotFound";
33
- }
34
- if (error.name === "AuthWrongPasswordError") {
35
- return "auth.errors.wrongPassword";
36
- }
37
- if (error.name === "AuthEmailAlreadyInUseError") {
38
- return "auth.errors.emailAlreadyInUse";
39
- }
40
- if (error.name === "AuthNetworkError") {
41
- return "auth.errors.networkError";
42
- }
43
- if (error.name === "AuthConfigurationError") {
44
- return "auth.errors.configurationError";
45
- }
46
- if (error.name === "AuthInitializationError") {
47
- return "auth.errors.authNotInitialized";
48
- }
49
- // Use code if available
50
- if (code && errorCodeMap[code]) {
51
- return errorCodeMap[code];
52
- }
53
- // Check error message for specific patterns
54
- const message = error.message.toLowerCase();
55
- if (message.includes("too many requests")) {
56
- return "auth.errors.tooManyRequests";
57
- }
58
- if (message.includes("user account has been disabled") || message.includes("user disabled")) {
59
- return "auth.errors.userDisabled";
60
- }
61
- if (message.includes("not properly configured") || message.includes("configuration")) {
62
- return "auth.errors.configurationError";
63
- }
64
- if (message.includes("not enabled") || message.includes("operation not allowed")) {
65
- return "auth.errors.operationNotAllowed";
66
- }
67
- // Default to unknown error
68
- return "auth.errors.unknownError";
69
- }
@@ -1,85 +0,0 @@
1
- /**
2
- * Auth Error Types
3
- * Domain-specific error classes for authentication operations
4
- */
5
-
6
- export class AuthError extends Error {
7
- constructor(message: string, public code?: string) {
8
- super(message);
9
- this.name = "AuthError";
10
- Object.setPrototypeOf(this, AuthError.prototype);
11
- }
12
- }
13
-
14
- export class AuthInitializationError extends AuthError {
15
- constructor(message: string = "Firebase Auth is not initialized") {
16
- super(message, "AUTH_NOT_INITIALIZED");
17
- this.name = "AuthInitializationError";
18
- Object.setPrototypeOf(this, AuthInitializationError.prototype);
19
- }
20
- }
21
-
22
- export class AuthConfigurationError extends AuthError {
23
- constructor(message: string = "Invalid auth configuration") {
24
- super(message, "AUTH_CONFIG_ERROR");
25
- this.name = "AuthConfigurationError";
26
- Object.setPrototypeOf(this, AuthConfigurationError.prototype);
27
- }
28
- }
29
-
30
- export class AuthValidationError extends AuthError {
31
- constructor(message: string, public field?: string) {
32
- super(message, "AUTH_VALIDATION_ERROR");
33
- this.name = "AuthValidationError";
34
- Object.setPrototypeOf(this, AuthValidationError.prototype);
35
- }
36
- }
37
-
38
- export class AuthNetworkError extends AuthError {
39
- constructor(message: string = "Network error during authentication") {
40
- super(message, "AUTH_NETWORK_ERROR");
41
- this.name = "AuthNetworkError";
42
- Object.setPrototypeOf(this, AuthNetworkError.prototype);
43
- }
44
- }
45
-
46
- export class AuthUserNotFoundError extends AuthError {
47
- constructor(message: string = "User not found") {
48
- super(message, "AUTH_USER_NOT_FOUND");
49
- this.name = "AuthUserNotFoundError";
50
- Object.setPrototypeOf(this, AuthUserNotFoundError.prototype);
51
- }
52
- }
53
-
54
- export class AuthWrongPasswordError extends AuthError {
55
- constructor(message: string = "Wrong password") {
56
- super(message, "AUTH_WRONG_PASSWORD");
57
- this.name = "AuthWrongPasswordError";
58
- Object.setPrototypeOf(this, AuthWrongPasswordError.prototype);
59
- }
60
- }
61
-
62
- export class AuthEmailAlreadyInUseError extends AuthError {
63
- constructor(message: string = "Email already in use") {
64
- super(message, "AUTH_EMAIL_ALREADY_IN_USE");
65
- this.name = "AuthEmailAlreadyInUseError";
66
- Object.setPrototypeOf(this, AuthEmailAlreadyInUseError.prototype);
67
- }
68
- }
69
-
70
- export class AuthWeakPasswordError extends AuthError {
71
- constructor(message: string = "Password is too weak") {
72
- super(message, "AUTH_WEAK_PASSWORD");
73
- this.name = "AuthWeakPasswordError";
74
- Object.setPrototypeOf(this, AuthWeakPasswordError.prototype);
75
- }
76
- }
77
-
78
- export class AuthInvalidEmailError extends AuthError {
79
- constructor(message: string = "Invalid email address") {
80
- super(message, "AUTH_INVALID_EMAIL");
81
- this.name = "AuthInvalidEmailError";
82
- Object.setPrototypeOf(this, AuthInvalidEmailError.prototype);
83
- }
84
- }
85
-