@umituz/react-native-auth 2.0.2 → 2.2.1

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/domain/errors/AuthError.ts +11 -19
  3. package/src/index.ts +8 -0
  4. package/src/presentation/components/AuthBottomSheet.tsx +175 -0
  5. package/src/presentation/stores/authModalStore.ts +72 -0
  6. package/README.md +0 -227
  7. package/lib/__tests__/services/AuthCoreService.test.d.ts +0 -4
  8. package/lib/__tests__/services/AuthCoreService.test.js +0 -198
  9. package/lib/__tests__/services/AuthPackage.test.d.ts +0 -4
  10. package/lib/__tests__/services/AuthPackage.test.js +0 -177
  11. package/lib/__tests__/services/GuestModeService.test.d.ts +0 -4
  12. package/lib/__tests__/services/GuestModeService.test.js +0 -141
  13. package/lib/__tests__/utils/AuthValidation.test.d.ts +0 -4
  14. package/lib/__tests__/utils/AuthValidation.test.js +0 -222
  15. package/lib/application/ports/IAuthProvider.d.ts +0 -42
  16. package/lib/application/ports/IAuthProvider.js +0 -5
  17. package/lib/application/ports/IAuthService.d.ts +0 -48
  18. package/lib/application/ports/IAuthService.js +0 -5
  19. package/lib/domain/entities/AuthUser.d.ts +0 -12
  20. package/lib/domain/entities/AuthUser.js +0 -5
  21. package/lib/domain/errors/AuthError.d.ts +0 -36
  22. package/lib/domain/errors/AuthError.js +0 -76
  23. package/lib/domain/value-objects/AuthConfig.d.ts +0 -16
  24. package/lib/domain/value-objects/AuthConfig.js +0 -14
  25. package/lib/index.d.ts +0 -45
  26. package/lib/index.js +0 -59
  27. package/lib/infrastructure/adapters/StorageProviderAdapter.d.ts +0 -16
  28. package/lib/infrastructure/adapters/StorageProviderAdapter.js +0 -72
  29. package/lib/infrastructure/adapters/UIProviderAdapter.d.ts +0 -18
  30. package/lib/infrastructure/adapters/UIProviderAdapter.js +0 -28
  31. package/lib/infrastructure/providers/FirebaseAuthProvider.d.ts +0 -19
  32. package/lib/infrastructure/providers/FirebaseAuthProvider.js +0 -94
  33. package/lib/infrastructure/services/AuthCoreService.d.ts +0 -22
  34. package/lib/infrastructure/services/AuthCoreService.js +0 -102
  35. package/lib/infrastructure/services/AuthEventService.d.ts +0 -28
  36. package/lib/infrastructure/services/AuthEventService.js +0 -88
  37. package/lib/infrastructure/services/AuthPackage.d.ts +0 -62
  38. package/lib/infrastructure/services/AuthPackage.js +0 -91
  39. package/lib/infrastructure/services/AuthService.d.ts +0 -42
  40. package/lib/infrastructure/services/AuthService.js +0 -123
  41. package/lib/infrastructure/services/GuestModeService.d.ts +0 -23
  42. package/lib/infrastructure/services/GuestModeService.js +0 -69
  43. package/lib/infrastructure/storage/GuestModeStorage.d.ts +0 -16
  44. package/lib/infrastructure/storage/GuestModeStorage.js +0 -73
  45. package/lib/infrastructure/utils/AuthErrorMapper.d.ts +0 -8
  46. package/lib/infrastructure/utils/AuthErrorMapper.js +0 -51
  47. package/lib/infrastructure/utils/AuthEventEmitter.d.ts +0 -12
  48. package/lib/infrastructure/utils/AuthEventEmitter.js +0 -25
  49. package/lib/infrastructure/utils/AuthValidation.d.ts +0 -49
  50. package/lib/infrastructure/utils/AuthValidation.js +0 -133
  51. package/lib/infrastructure/utils/UserMapper.d.ts +0 -15
  52. package/lib/infrastructure/utils/UserMapper.js +0 -16
  53. package/lib/presentation/components/AuthContainer.d.ts +0 -10
  54. package/lib/presentation/components/AuthContainer.js +0 -27
  55. package/lib/presentation/components/AuthDivider.d.ts +0 -6
  56. package/lib/presentation/components/AuthDivider.js +0 -36
  57. package/lib/presentation/components/AuthErrorDisplay.d.ts +0 -10
  58. package/lib/presentation/components/AuthErrorDisplay.js +0 -24
  59. package/lib/presentation/components/AuthFormCard.d.ts +0 -10
  60. package/lib/presentation/components/AuthFormCard.js +0 -19
  61. package/lib/presentation/components/AuthGradientBackground.d.ts +0 -6
  62. package/lib/presentation/components/AuthGradientBackground.js +0 -8
  63. package/lib/presentation/components/AuthHeader.d.ts +0 -11
  64. package/lib/presentation/components/AuthHeader.js +0 -38
  65. package/lib/presentation/components/AuthLegalLinks.d.ts +0 -28
  66. package/lib/presentation/components/AuthLegalLinks.js +0 -54
  67. package/lib/presentation/components/AuthLink.d.ts +0 -13
  68. package/lib/presentation/components/AuthLink.js +0 -27
  69. package/lib/presentation/components/LoginForm.d.ts +0 -10
  70. package/lib/presentation/components/LoginForm.js +0 -27
  71. package/lib/presentation/components/PasswordMatchIndicator.d.ts +0 -9
  72. package/lib/presentation/components/PasswordMatchIndicator.js +0 -30
  73. package/lib/presentation/components/PasswordStrengthIndicator.d.ts +0 -11
  74. package/lib/presentation/components/PasswordStrengthIndicator.js +0 -60
  75. package/lib/presentation/components/RegisterForm.d.ts +0 -14
  76. package/lib/presentation/components/RegisterForm.js +0 -30
  77. package/lib/presentation/hooks/useAuth.d.ts +0 -44
  78. package/lib/presentation/hooks/useAuth.js +0 -38
  79. package/lib/presentation/hooks/useAuthActions.d.ts +0 -15
  80. package/lib/presentation/hooks/useAuthActions.js +0 -162
  81. package/lib/presentation/hooks/useAuthState.d.ts +0 -19
  82. package/lib/presentation/hooks/useAuthState.js +0 -79
  83. package/lib/presentation/hooks/useLoginForm.d.ts +0 -21
  84. package/lib/presentation/hooks/useLoginForm.js +0 -131
  85. package/lib/presentation/hooks/useRegisterForm.d.ts +0 -31
  86. package/lib/presentation/hooks/useRegisterForm.js +0 -136
  87. package/lib/presentation/navigation/AuthNavigator.d.ts +0 -28
  88. package/lib/presentation/navigation/AuthNavigator.js +0 -37
  89. package/lib/presentation/screens/LoginScreen.d.ts +0 -6
  90. package/lib/presentation/screens/LoginScreen.js +0 -15
  91. package/lib/presentation/screens/RegisterScreen.d.ts +0 -12
  92. package/lib/presentation/screens/RegisterScreen.js +0 -15
  93. package/lib/presentation/utils/getAuthErrorMessage.d.ts +0 -8
  94. package/lib/presentation/utils/getAuthErrorMessage.js +0 -69
@@ -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
- }