@umituz/react-native-auth 4.3.79 → 4.3.81
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 +4 -1
- package/src/index.ts +303 -6
- package/src/infrastructure/utils/AuthValidation.ts +2 -2
- package/src/infrastructure/utils/calculators/passwordStrengthCalculator.ts +2 -2
- package/src/infrastructure/utils/listener/anonymousSignIn/createAnonymousSignInHandler.ts +0 -1
- package/src/infrastructure/utils/listener/anonymousSignIn/types.ts +3 -1
- package/src/infrastructure/utils/validation/types.ts +2 -28
- package/src/init/index.ts +9 -0
- package/src/presentation/components/PasswordStrengthIndicator.tsx +1 -1
- package/src/presentation/components/RegisterForm/RegisterForm.tsx +3 -1
- package/src/presentation/components/RegisterForm/RegisterFormFields.tsx +3 -2
- package/src/presentation/hooks/auth/types.ts +0 -1
- package/src/presentation/hooks/auth/useAuthBottomSheet.ts +7 -5
- package/src/presentation/hooks/auth/useSocialAuthHandlers.ts +2 -2
- package/src/presentation/hooks/useAuthBottomSheet.ts +2 -2
- package/src/presentation/utils/authTransition.util.ts +4 -2
- package/src/presentation/utils/form/usePasswordValidation.hook.ts +3 -3
- package/src/shared/error-handling/handlers/FormErrorHandler.ts +1 -6
- package/src/shared/error-handling/handlers/index.ts +1 -1
- package/src/shared/error-handling/mappers/ErrorMapper.ts +5 -1
- package/src/shared/error-handling/types/ErrorTypes.ts +5 -0
- package/src/shared/error-handling/types/index.ts +1 -0
- package/src/shared/form/builders/FieldBuilder.ts +1 -2
- package/src/shared/form/builders/FormBuilder.ts +1 -3
- package/src/shared/form/utils/formUtils.ts +1 -1
- package/src/shared/validation/rules/ValidationRule.ts +3 -3
- package/src/shared/validation/sanitizers/NameSanitizer.ts +22 -0
- package/src/shared/validation/sanitizers/index.ts +1 -0
- package/src/shared/validation/types.ts +1 -1
- package/src/shared/validation/validators/EmailValidator.ts +1 -1
- package/src/shared/validation/validators/NameValidator.ts +1 -1
- package/src/shared/validation/validators/PasswordValidator.ts +2 -2
- package/src/exports/domain.ts +0 -32
- package/src/exports/infrastructure.ts +0 -80
- package/src/exports/presentation.ts +0 -115
- package/src/exports/shared.ts +0 -93
- package/src/exports/utils.ts +0 -10
- package/src/shared/error-handling/index.ts +0 -19
- package/src/shared/form/index.ts +0 -51
- package/src/shared/form/utils/index.ts +0 -6
- package/src/shared/validation/index.ts +0 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-auth",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.81",
|
|
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",
|
|
@@ -65,6 +65,9 @@
|
|
|
65
65
|
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
66
66
|
"@react-native-community/datetimepicker": "^8.2.0",
|
|
67
67
|
"@react-native-community/slider": "^5.1.1",
|
|
68
|
+
"@react-navigation/bottom-tabs": "^7.15.5",
|
|
69
|
+
"@react-navigation/native": "^7.1.33",
|
|
70
|
+
"@react-navigation/stack": "^7.8.5",
|
|
68
71
|
"@tanstack/query-async-storage-persister": "^5.66.7",
|
|
69
72
|
"@tanstack/react-query": "^5.0.0",
|
|
70
73
|
"@tanstack/react-query-persist-client": "^5.66.7",
|
package/src/index.ts
CHANGED
|
@@ -8,24 +8,321 @@
|
|
|
8
8
|
// =============================================================================
|
|
9
9
|
// DOMAIN LAYER
|
|
10
10
|
// =============================================================================
|
|
11
|
-
export
|
|
11
|
+
export type { AuthUser, AuthProviderType } from './domain/entities/AuthUser';
|
|
12
|
+
export type { UserProfile, UpdateProfileParams } from './domain/entities/UserProfile';
|
|
13
|
+
export {
|
|
14
|
+
AuthError,
|
|
15
|
+
AuthInitializationError,
|
|
16
|
+
AuthConfigurationError,
|
|
17
|
+
AuthValidationError,
|
|
18
|
+
AuthNetworkError,
|
|
19
|
+
AuthUserNotFoundError,
|
|
20
|
+
AuthWrongPasswordError,
|
|
21
|
+
AuthEmailAlreadyInUseError,
|
|
22
|
+
AuthWeakPasswordError,
|
|
23
|
+
AuthInvalidEmailError,
|
|
24
|
+
} from './domain/errors/AuthError';
|
|
25
|
+
export type {
|
|
26
|
+
AuthConfig,
|
|
27
|
+
PasswordConfig,
|
|
28
|
+
SocialAuthConfig,
|
|
29
|
+
SocialProviderConfig,
|
|
30
|
+
GoogleAuthConfig,
|
|
31
|
+
AppleAuthConfig,
|
|
32
|
+
SocialAuthProvider,
|
|
33
|
+
} from './domain/value-objects/AuthConfig';
|
|
34
|
+
export {
|
|
35
|
+
DEFAULT_AUTH_CONFIG,
|
|
36
|
+
DEFAULT_PASSWORD_CONFIG,
|
|
37
|
+
DEFAULT_SOCIAL_CONFIG,
|
|
38
|
+
} from './domain/value-objects/AuthConfig';
|
|
12
39
|
|
|
13
40
|
// =============================================================================
|
|
14
41
|
// INFRASTRUCTURE LAYER
|
|
15
42
|
// =============================================================================
|
|
16
|
-
export
|
|
43
|
+
export type { AuthCredentials, SignUpCredentials } from './infrastructure/repositories/AuthRepository';
|
|
44
|
+
|
|
45
|
+
// Services
|
|
46
|
+
export {
|
|
47
|
+
AuthService,
|
|
48
|
+
initializeAuthService,
|
|
49
|
+
getAuthService,
|
|
50
|
+
resetAuthService,
|
|
51
|
+
} from './infrastructure/services/AuthService';
|
|
52
|
+
export {
|
|
53
|
+
initializeAuth,
|
|
54
|
+
isAuthInitialized,
|
|
55
|
+
resetAuthInitialization,
|
|
56
|
+
} from './infrastructure/services/initializeAuth';
|
|
57
|
+
export type { InitializeAuthOptions } from './infrastructure/services/initializeAuth';
|
|
58
|
+
|
|
59
|
+
// Storage
|
|
60
|
+
export type { IStorageProvider } from './infrastructure/types/Storage.types';
|
|
61
|
+
export {
|
|
62
|
+
createStorageProvider,
|
|
63
|
+
StorageProviderAdapter,
|
|
64
|
+
} from './infrastructure/adapters/StorageProviderAdapter';
|
|
65
|
+
|
|
66
|
+
// Validation
|
|
67
|
+
export {
|
|
68
|
+
validateEmail,
|
|
69
|
+
validatePasswordForLogin,
|
|
70
|
+
validatePasswordForRegister,
|
|
71
|
+
validatePasswordConfirmation,
|
|
72
|
+
validateDisplayName,
|
|
73
|
+
} from './infrastructure/utils/AuthValidation';
|
|
74
|
+
export type {
|
|
75
|
+
FormValidationError,
|
|
76
|
+
FormValidationResult,
|
|
77
|
+
} from './infrastructure/utils/validation/types';
|
|
78
|
+
export {
|
|
79
|
+
SECURITY_LIMITS,
|
|
80
|
+
sanitizeEmail,
|
|
81
|
+
sanitizePassword,
|
|
82
|
+
sanitizeName,
|
|
83
|
+
} from './infrastructure/utils/validation/sanitization';
|
|
84
|
+
export type { SecurityLimitKey } from './infrastructure/utils/validation/sanitization';
|
|
85
|
+
export {
|
|
86
|
+
isEmpty,
|
|
87
|
+
isEmptyEmail,
|
|
88
|
+
isEmptyPassword,
|
|
89
|
+
isEmptyName,
|
|
90
|
+
isNotEmpty,
|
|
91
|
+
hasContent,
|
|
92
|
+
} from './infrastructure/utils/validation/validationHelpers';
|
|
93
|
+
export { safeCallback, safeCallbackSync } from './infrastructure/utils/safeCallback';
|
|
94
|
+
|
|
95
|
+
// Calculators
|
|
96
|
+
export {
|
|
97
|
+
calculateUserId,
|
|
98
|
+
calculateHasFirebaseUser,
|
|
99
|
+
calculateIsAnonymous,
|
|
100
|
+
calculateIsAuthenticated,
|
|
101
|
+
calculateUserType,
|
|
102
|
+
calculateIsAuthReady,
|
|
103
|
+
calculateDerivedAuthState,
|
|
104
|
+
collectFieldErrors,
|
|
105
|
+
extractFieldError,
|
|
106
|
+
hasFieldErrors,
|
|
107
|
+
getFirstErrorMessage,
|
|
108
|
+
calculateUserProfileDisplay,
|
|
109
|
+
calculatePasswordRequirements,
|
|
110
|
+
calculatePasswordsMatch,
|
|
111
|
+
calculatePasswordValidation,
|
|
112
|
+
calculatePasswordStrength,
|
|
113
|
+
} from './infrastructure/utils/calculators';
|
|
114
|
+
|
|
115
|
+
// =============================================================================
|
|
116
|
+
// PRESENTATION LAYER - Hooks
|
|
117
|
+
// =============================================================================
|
|
118
|
+
export { useAuth } from './presentation/hooks/useAuth';
|
|
119
|
+
export type { UseAuthResult } from './presentation/hooks/useAuth';
|
|
120
|
+
export { useLoginForm } from './presentation/hooks/useLoginForm';
|
|
121
|
+
export type { UseLoginFormConfig, UseLoginFormResult } from './presentation/hooks/useLoginForm';
|
|
122
|
+
export { useRegisterForm } from './presentation/hooks/useRegisterForm';
|
|
123
|
+
export type {
|
|
124
|
+
UseRegisterFormConfig,
|
|
125
|
+
UseRegisterFormResult,
|
|
126
|
+
} from './presentation/hooks/useRegisterForm';
|
|
127
|
+
export { useAuthRequired } from './presentation/hooks/useAuthRequired';
|
|
128
|
+
export { useRequireAuth, useUserId } from './presentation/hooks/useRequireAuth';
|
|
129
|
+
export { useUserProfile } from './presentation/hooks/useUserProfile';
|
|
130
|
+
export type {
|
|
131
|
+
UserProfileData,
|
|
132
|
+
UseUserProfileParams,
|
|
133
|
+
} from './presentation/hooks/useUserProfile';
|
|
134
|
+
export { useAccountManagement } from './presentation/hooks/useAccountManagement';
|
|
135
|
+
export type {
|
|
136
|
+
UseAccountManagementReturn,
|
|
137
|
+
UseAccountManagementOptions,
|
|
138
|
+
} from './presentation/hooks/useAccountManagement';
|
|
139
|
+
export { useAppleAuth } from './presentation/hooks/useAppleAuth';
|
|
140
|
+
export type { UseAppleAuthResult } from './presentation/hooks/useAppleAuth';
|
|
141
|
+
export { useAuthBottomSheet } from './presentation/hooks/useAuthBottomSheet';
|
|
142
|
+
export type {
|
|
143
|
+
SocialAuthConfiguration,
|
|
144
|
+
} from './presentation/hooks/useAuthBottomSheet';
|
|
145
|
+
export { useAuthHandlers } from './presentation/hooks/useAuthHandlers';
|
|
146
|
+
export type {
|
|
147
|
+
AuthHandlersAppInfo,
|
|
148
|
+
AuthHandlersTranslations,
|
|
149
|
+
} from './presentation/hooks/useAuthHandlers';
|
|
150
|
+
export { usePasswordPromptNavigation } from './presentation/hooks/usePasswordPromptNavigation';
|
|
151
|
+
export type {
|
|
152
|
+
UsePasswordPromptNavigationOptions,
|
|
153
|
+
UsePasswordPromptNavigationReturn,
|
|
154
|
+
} from './presentation/hooks/usePasswordPromptNavigation';
|
|
155
|
+
export { useAuthErrorHandler } from './presentation/hooks/useAuthErrorHandler';
|
|
156
|
+
export type {
|
|
157
|
+
UseAuthErrorHandlerConfig,
|
|
158
|
+
UseAuthErrorHandlerResult,
|
|
159
|
+
} from './presentation/hooks/useAuthErrorHandler';
|
|
160
|
+
export { useLocalError } from './presentation/hooks/useLocalError';
|
|
161
|
+
export type { UseLocalErrorResult } from './presentation/hooks/useLocalError';
|
|
162
|
+
|
|
163
|
+
// =============================================================================
|
|
164
|
+
// PRESENTATION LAYER - Components
|
|
165
|
+
// =============================================================================
|
|
166
|
+
export { AuthProvider } from './presentation/providers/AuthProvider';
|
|
167
|
+
export type { ErrorFallbackProps } from './presentation/providers/AuthProvider';
|
|
168
|
+
export { LoginScreen } from './presentation/screens/LoginScreen';
|
|
169
|
+
export type { LoginScreenProps } from './presentation/screens/LoginScreen';
|
|
170
|
+
export { RegisterScreen } from './presentation/screens/RegisterScreen';
|
|
171
|
+
export type { RegisterScreenProps } from './presentation/screens/RegisterScreen';
|
|
172
|
+
export { AccountScreen } from './presentation/screens/AccountScreen';
|
|
173
|
+
export type {
|
|
174
|
+
AccountScreenProps,
|
|
175
|
+
AccountScreenConfig,
|
|
176
|
+
} from './presentation/screens/AccountScreen';
|
|
177
|
+
export { EditProfileScreen } from './presentation/screens/EditProfileScreen';
|
|
178
|
+
export type {
|
|
179
|
+
EditProfileScreenProps,
|
|
180
|
+
} from './presentation/screens/EditProfileScreen';
|
|
181
|
+
export { PasswordPromptScreen } from './presentation/screens/PasswordPromptScreen';
|
|
182
|
+
export type {
|
|
183
|
+
PasswordPromptScreenProps,
|
|
184
|
+
} from './presentation/screens/PasswordPromptScreen';
|
|
185
|
+
export { AuthNavigator } from './presentation/navigation/AuthNavigator';
|
|
186
|
+
export type { AuthStackParamList } from './presentation/navigation/AuthNavigator';
|
|
187
|
+
export { AuthBottomSheet } from './presentation/components/AuthBottomSheet';
|
|
188
|
+
export type {
|
|
189
|
+
AuthBottomSheetProps,
|
|
190
|
+
AuthBottomSheetTranslations,
|
|
191
|
+
} from './presentation/components/AuthBottomSheet';
|
|
192
|
+
export { ProfileSection } from './presentation/components/ProfileSection';
|
|
193
|
+
export type {
|
|
194
|
+
ProfileSectionProps,
|
|
195
|
+
ProfileSectionConfig,
|
|
196
|
+
} from './presentation/components/ProfileSection';
|
|
17
197
|
|
|
18
198
|
// =============================================================================
|
|
19
|
-
// PRESENTATION LAYER
|
|
199
|
+
// PRESENTATION LAYER - Stores
|
|
20
200
|
// =============================================================================
|
|
21
|
-
export
|
|
201
|
+
export { useAuthStore } from './presentation/stores/authStore';
|
|
202
|
+
export { useAuthModalStore } from './presentation/stores/authModalStore';
|
|
203
|
+
export {
|
|
204
|
+
initializeAuthListener,
|
|
205
|
+
resetAuthListener,
|
|
206
|
+
isAuthListenerInitialized,
|
|
207
|
+
} from './presentation/stores/initializeAuthListener';
|
|
208
|
+
export type {
|
|
209
|
+
AuthState,
|
|
210
|
+
AuthActions,
|
|
211
|
+
UserType,
|
|
212
|
+
AuthListenerOptions,
|
|
213
|
+
} from './types/auth-store.types';
|
|
214
|
+
export type { AuthModalMode } from './presentation/stores/auth.selectors';
|
|
215
|
+
export {
|
|
216
|
+
selectUser,
|
|
217
|
+
selectLoading,
|
|
218
|
+
selectError,
|
|
219
|
+
selectSetLoading,
|
|
220
|
+
selectSetError,
|
|
221
|
+
selectSetIsAnonymous,
|
|
222
|
+
selectShowAuthModal,
|
|
223
|
+
selectUserId,
|
|
224
|
+
selectIsAuthenticated,
|
|
225
|
+
selectHasFirebaseUser,
|
|
226
|
+
selectIsAnonymous,
|
|
227
|
+
selectUserType,
|
|
228
|
+
selectIsAuthReady,
|
|
229
|
+
selectFirebaseUserId,
|
|
230
|
+
selectAuthState,
|
|
231
|
+
} from './presentation/stores/auth.selectors';
|
|
22
232
|
|
|
23
233
|
// =============================================================================
|
|
24
234
|
// SHARED LAYER (New Modular Utilities)
|
|
25
235
|
// =============================================================================
|
|
26
|
-
|
|
236
|
+
// Validation
|
|
237
|
+
export { EmailValidator, PasswordValidator, NameValidator } from './shared/validation/validators';
|
|
238
|
+
export {
|
|
239
|
+
EmailSanitizer,
|
|
240
|
+
PasswordSanitizer,
|
|
241
|
+
NameSanitizer,
|
|
242
|
+
} from './shared/validation/sanitizers';
|
|
243
|
+
export {
|
|
244
|
+
BaseValidationRule,
|
|
245
|
+
RequiredRule,
|
|
246
|
+
RegexRule,
|
|
247
|
+
MinLengthRule,
|
|
248
|
+
} from './shared/validation/rules';
|
|
249
|
+
export type {
|
|
250
|
+
ValidationResult,
|
|
251
|
+
PasswordRequirements,
|
|
252
|
+
PasswordStrengthResult,
|
|
253
|
+
ValidationRule,
|
|
254
|
+
ValidatorConfig,
|
|
255
|
+
} from './shared/validation/types';
|
|
256
|
+
|
|
257
|
+
// Error Handling
|
|
258
|
+
export {
|
|
259
|
+
ErrorMapper,
|
|
260
|
+
DEFAULT_AUTH_ERROR_MAPPINGS,
|
|
261
|
+
FieldErrorMapper,
|
|
262
|
+
} from './shared/error-handling/mappers';
|
|
263
|
+
export { ErrorHandler, FormErrorHandler } from './shared/error-handling/handlers';
|
|
264
|
+
export type {
|
|
265
|
+
FieldError,
|
|
266
|
+
FormFieldErrors,
|
|
267
|
+
ErrorMap,
|
|
268
|
+
ErrorMappingConfig,
|
|
269
|
+
FormErrorHandlerConfig,
|
|
270
|
+
} from './shared/error-handling/types';
|
|
271
|
+
|
|
272
|
+
// Form
|
|
273
|
+
export { useField, useForm } from './shared/form/builders';
|
|
274
|
+
export type {
|
|
275
|
+
UseFieldOptions,
|
|
276
|
+
UseFieldResult,
|
|
277
|
+
UseFormOptions,
|
|
278
|
+
UseFormResult,
|
|
279
|
+
} from './shared/form/builders';
|
|
280
|
+
export {
|
|
281
|
+
isFormValid,
|
|
282
|
+
isFormDirty,
|
|
283
|
+
isFormTouched,
|
|
284
|
+
getFormErrors,
|
|
285
|
+
getFirstFormError,
|
|
286
|
+
countFormErrors,
|
|
287
|
+
getFieldError,
|
|
288
|
+
fieldHasError,
|
|
289
|
+
isFieldTouched,
|
|
290
|
+
resetFormState,
|
|
291
|
+
} from './shared/form/state';
|
|
292
|
+
export {
|
|
293
|
+
sanitizeFormValues,
|
|
294
|
+
extractFields,
|
|
295
|
+
areRequiredFieldsFilled,
|
|
296
|
+
getEmptyRequiredFields,
|
|
297
|
+
createFieldOptions,
|
|
298
|
+
mergeFormErrors,
|
|
299
|
+
clearFieldErrors,
|
|
300
|
+
} from './shared/form/utils/formUtils';
|
|
301
|
+
export {
|
|
302
|
+
createFieldChangeHandler,
|
|
303
|
+
createFieldBlurHandler,
|
|
304
|
+
debounceFieldChange,
|
|
305
|
+
isFieldValueEmpty,
|
|
306
|
+
sanitizeFieldValue,
|
|
307
|
+
formatFieldValue,
|
|
308
|
+
validateFieldValue,
|
|
309
|
+
getFieldDisplayValue,
|
|
310
|
+
truncateFieldValue,
|
|
311
|
+
} from './shared/form/utils/fieldUtils';
|
|
312
|
+
export type {
|
|
313
|
+
FieldState,
|
|
314
|
+
FormState,
|
|
315
|
+
FieldChangeHandler,
|
|
316
|
+
FormFieldConfig,
|
|
317
|
+
FormConfig,
|
|
318
|
+
} from './shared/form/types';
|
|
27
319
|
|
|
28
320
|
// =============================================================================
|
|
29
321
|
// UTILITIES & INIT
|
|
30
322
|
// =============================================================================
|
|
31
|
-
export
|
|
323
|
+
export {
|
|
324
|
+
getAuthErrorLocalizationKey,
|
|
325
|
+
resolveErrorMessage,
|
|
326
|
+
} from './presentation/utils/getAuthErrorMessage';
|
|
327
|
+
export { createAuthInitModule } from './init/createAuthInitModule';
|
|
328
|
+
export type { AuthInitModuleConfig } from './init/createAuthInitModule';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { PasswordConfig } from "
|
|
1
|
+
import type { PasswordConfig } from "@domain/value-objects/AuthConfig";
|
|
2
2
|
import { isEmptyEmail, isEmptyPassword, isEmptyName } from "./validation/validationHelpers";
|
|
3
3
|
import type {
|
|
4
4
|
ValidationResult,
|
|
5
5
|
PasswordStrengthResult,
|
|
6
6
|
PasswordRequirements,
|
|
7
|
-
} from "
|
|
7
|
+
} from "@shared/validation/types";
|
|
8
8
|
|
|
9
9
|
// Export validation types
|
|
10
10
|
export type {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
validatePasswordConfirmation,
|
|
10
10
|
} from "../AuthValidation";
|
|
11
11
|
import type { PasswordConfig } from "../../../domain/value-objects/AuthConfig";
|
|
12
|
-
import type { PasswordRequirements } from "
|
|
12
|
+
import type { PasswordRequirements } from "@shared/validation/types";
|
|
13
13
|
|
|
14
14
|
interface PasswordValidationInput {
|
|
15
15
|
password: string;
|
|
@@ -36,7 +36,7 @@ export function calculatePasswordRequirements(
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const result = validatePasswordForRegister(password, config);
|
|
39
|
-
return result.requirements;
|
|
39
|
+
return result.requirements ?? { hasMinLength: false };
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Anonymous Sign-In Types
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import type { User } from 'firebase/auth';
|
|
6
|
+
|
|
5
7
|
export interface AnonymousSignInCallbacks {
|
|
6
8
|
onSignInSuccess: () => void;
|
|
7
9
|
onSignInFailure: (error: Error) => void;
|
|
@@ -14,7 +16,7 @@ export interface AnonymousSignInOptions {
|
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export interface AnonymousStore {
|
|
17
|
-
setFirebaseUser: (user:
|
|
19
|
+
setFirebaseUser: (user: User | null) => void;
|
|
18
20
|
setLoading: (loading: boolean) => void;
|
|
19
21
|
setInitialized: (initialized: boolean) => void;
|
|
20
22
|
setError: (error: string | null) => void;
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Validation Types
|
|
3
|
-
*
|
|
2
|
+
* Form Validation Types
|
|
3
|
+
* Infrastructure-specific form validation types
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Single field validation result
|
|
8
|
-
* Used for validating individual fields (email, password, etc.)
|
|
9
|
-
*/
|
|
10
|
-
export interface ValidationResult {
|
|
11
|
-
isValid: boolean;
|
|
12
|
-
error?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
6
|
/**
|
|
16
7
|
* Form validation error
|
|
17
8
|
* Represents an error for a specific form field
|
|
@@ -30,20 +21,3 @@ export interface FormValidationResult {
|
|
|
30
21
|
errors: FormValidationError[];
|
|
31
22
|
}
|
|
32
23
|
|
|
33
|
-
/**
|
|
34
|
-
* Password requirements
|
|
35
|
-
* Tracks which password requirements are met
|
|
36
|
-
*/
|
|
37
|
-
export interface PasswordRequirements {
|
|
38
|
-
hasMinLength: boolean;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Password strength validation result
|
|
43
|
-
* Extends ValidationResult with password-specific requirements
|
|
44
|
-
*/
|
|
45
|
-
export interface PasswordStrengthResult {
|
|
46
|
-
isValid: boolean;
|
|
47
|
-
error?: string;
|
|
48
|
-
requirements: PasswordRequirements;
|
|
49
|
-
}
|
|
@@ -3,7 +3,7 @@ import { View, StyleSheet } from "react-native";
|
|
|
3
3
|
import { useAppDesignTokens } from "@umituz/react-native-design-system/theme";
|
|
4
4
|
import { AtomicText } from "@umituz/react-native-design-system/atoms";
|
|
5
5
|
import type { ColorVariant } from "@umituz/react-native-design-system/typography";
|
|
6
|
-
import type { PasswordRequirements } from "
|
|
6
|
+
import type { PasswordRequirements } from "@shared/validation/types";
|
|
7
7
|
|
|
8
8
|
export interface PasswordStrengthTranslations {
|
|
9
9
|
minLength: string;
|
|
@@ -61,7 +61,9 @@ export const RegisterForm = memo<RegisterFormProps>(({
|
|
|
61
61
|
|
|
62
62
|
<AtomicButton
|
|
63
63
|
variant="primary"
|
|
64
|
-
onPress={() =>
|
|
64
|
+
onPress={() => {
|
|
65
|
+
handleSignUp().catch(() => {});
|
|
66
|
+
}}
|
|
65
67
|
disabled={loading || !email.trim() || !password || !confirmPassword}
|
|
66
68
|
fullWidth
|
|
67
69
|
style={styles.signUpButton}
|
|
@@ -11,6 +11,7 @@ import { FormPasswordInput } from '../form/FormPasswordInput';
|
|
|
11
11
|
import { PasswordStrengthIndicator } from '../PasswordStrengthIndicator';
|
|
12
12
|
import { PasswordMatchIndicator } from '../PasswordMatchIndicator';
|
|
13
13
|
import type { RegisterFormTranslations } from './types';
|
|
14
|
+
import type { PasswordRequirements } from '@shared/validation/types';
|
|
14
15
|
|
|
15
16
|
export interface RegisterFormFieldsProps {
|
|
16
17
|
displayName: string;
|
|
@@ -19,14 +20,14 @@ export interface RegisterFormFieldsProps {
|
|
|
19
20
|
confirmPassword: string;
|
|
20
21
|
fieldErrors: Record<string, string | null>;
|
|
21
22
|
loading: boolean;
|
|
22
|
-
passwordRequirements:
|
|
23
|
+
passwordRequirements: PasswordRequirements;
|
|
23
24
|
passwordsMatch: boolean;
|
|
24
25
|
translations: RegisterFormTranslations;
|
|
25
26
|
onDisplayNameChange: (value: string) => void;
|
|
26
27
|
onEmailChange: (value: string) => void;
|
|
27
28
|
onPasswordChange: (value: string) => void;
|
|
28
29
|
onConfirmPasswordChange: (value: string) => void;
|
|
29
|
-
onSubmit: () => void
|
|
30
|
+
onSubmit: () => Promise<void>;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export const RegisterFormFields: React.FC<RegisterFormFieldsProps> = ({
|
|
@@ -7,6 +7,8 @@ import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
|
7
7
|
import type { BottomSheetModalRef } from '@umituz/react-native-design-system/molecules';
|
|
8
8
|
import { useAuthModalStore } from '../../stores/authModalStore';
|
|
9
9
|
import { useAuth } from '../useAuth';
|
|
10
|
+
import { useAppleAuth } from '../useAppleAuth';
|
|
11
|
+
import { useGoogleAuth } from '../useGoogleAuth';
|
|
10
12
|
import { determineEnabledProviders } from '../../utils/socialAuthHandler.util';
|
|
11
13
|
import { useAuthTransitions, executeAfterAuth } from '../../utils/authTransition.util';
|
|
12
14
|
import { useSocialAuthHandlers } from './useSocialAuthHandlers';
|
|
@@ -22,6 +24,10 @@ export function useAuthBottomSheet(params: UseAuthBottomSheetParams = {}) {
|
|
|
22
24
|
useAuthModalStore();
|
|
23
25
|
const { isAuthenticated, isAnonymous } = useAuth();
|
|
24
26
|
|
|
27
|
+
// Social auth availability
|
|
28
|
+
const { appleAvailable } = useAppleAuth();
|
|
29
|
+
const { googleConfigured } = useGoogleAuth();
|
|
30
|
+
|
|
25
31
|
// Social auth handlers
|
|
26
32
|
const { handleGoogleSignIn, handleAppleSignIn, googleLoading, appleLoading } =
|
|
27
33
|
useSocialAuthHandlers(socialConfig, onGoogleSignIn, onAppleSignIn);
|
|
@@ -59,11 +65,9 @@ export function useAuthBottomSheet(params: UseAuthBottomSheetParams = {}) {
|
|
|
59
65
|
hideAuthModal();
|
|
60
66
|
onAuthSuccess?.();
|
|
61
67
|
|
|
62
|
-
|
|
68
|
+
return executeAfterAuth(() => {
|
|
63
69
|
executePendingCallback();
|
|
64
70
|
});
|
|
65
|
-
|
|
66
|
-
return () => clearTimeout(timeoutId);
|
|
67
71
|
}
|
|
68
72
|
return undefined;
|
|
69
73
|
}
|
|
@@ -106,5 +110,3 @@ export function useAuthBottomSheet(params: UseAuthBottomSheetParams = {}) {
|
|
|
106
110
|
]
|
|
107
111
|
);
|
|
108
112
|
}
|
|
109
|
-
|
|
110
|
-
// TODO: Fix appleAvailable and googleConfigured references
|
|
@@ -14,8 +14,8 @@ export function useSocialAuthHandlers(
|
|
|
14
14
|
onAppleSignIn?: () => Promise<void>
|
|
15
15
|
): SocialAuthHandlers {
|
|
16
16
|
// Social Auth Hooks
|
|
17
|
-
const { signInWithGoogle
|
|
18
|
-
const { signInWithApple
|
|
17
|
+
const { signInWithGoogle } = useGoogleAuth(socialConfig?.google);
|
|
18
|
+
const { signInWithApple } = useAppleAuth();
|
|
19
19
|
|
|
20
20
|
// Social auth loading states
|
|
21
21
|
const [googleLoading, setGoogleLoading] = useState(false);
|
|
@@ -84,11 +84,11 @@ export function useAuthBottomSheet(params: UseAuthBottomSheetParams = {}) {
|
|
|
84
84
|
hideAuthModal();
|
|
85
85
|
onAuthSuccess?.();
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
executeAfterAuth(() => {
|
|
88
88
|
executePendingCallback();
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return undefined;
|
|
92
92
|
}
|
|
93
93
|
return undefined;
|
|
94
94
|
}
|
|
@@ -66,10 +66,12 @@ export function useAuthTransitions(
|
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* Execute callback with delay after auth
|
|
69
|
+
* @returns Cleanup function to cancel the timeout
|
|
69
70
|
*/
|
|
70
71
|
export function executeAfterAuth(
|
|
71
72
|
callback: () => void,
|
|
72
73
|
delay: number = 100
|
|
73
|
-
):
|
|
74
|
-
|
|
74
|
+
): () => void {
|
|
75
|
+
const timeoutId = setTimeout(callback, delay);
|
|
76
|
+
return () => clearTimeout(timeoutId);
|
|
75
77
|
}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { useMemo } from "react";
|
|
8
|
-
import type { PasswordRequirements } from "
|
|
9
|
-
import type { PasswordConfig } from "
|
|
10
|
-
import { calculatePasswordValidation } from "
|
|
8
|
+
import type { PasswordRequirements } from "@shared/validation/types";
|
|
9
|
+
import type { PasswordConfig } from "@domain/value-objects/AuthConfig";
|
|
10
|
+
import { calculatePasswordValidation } from "@infrastructure/utils/calculators/passwordStrengthCalculator";
|
|
11
11
|
|
|
12
12
|
interface UsePasswordValidationResult {
|
|
13
13
|
passwordRequirements: PasswordRequirements;
|
|
@@ -3,15 +3,10 @@
|
|
|
3
3
|
* Handles form-specific error logic
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { FieldError, ErrorMap } from '../types/ErrorTypes';
|
|
6
|
+
import type { FieldError, ErrorMap, FormErrorHandlerConfig } from '../types/ErrorTypes';
|
|
7
7
|
import { ErrorHandler } from './ErrorHandler';
|
|
8
8
|
import { FieldErrorMapper } from '../mappers/FieldErrorMapper';
|
|
9
9
|
|
|
10
|
-
export interface FormErrorHandlerConfig {
|
|
11
|
-
translations?: ErrorMap;
|
|
12
|
-
errorMappings?: Partial<typeof DEFAULT_AUTH_ERROR_MAPPINGS>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
10
|
export class FormErrorHandler extends ErrorHandler {
|
|
16
11
|
constructor(config: FormErrorHandlerConfig = {}) {
|
|
17
12
|
super(config.translations, config.errorMappings);
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
import type { ErrorMap, ErrorMappingConfig } from '../types/ErrorTypes';
|
|
7
7
|
|
|
8
|
+
interface ErrorWithCode extends Error {
|
|
9
|
+
code?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
export class ErrorMapper {
|
|
9
13
|
private config: ErrorMappingConfig;
|
|
10
14
|
|
|
@@ -25,7 +29,7 @@ export class ErrorMapper {
|
|
|
25
29
|
return this.config.defaultKey!;
|
|
26
30
|
}
|
|
27
31
|
|
|
28
|
-
const code = (error as
|
|
32
|
+
const code = (error as ErrorWithCode).code;
|
|
29
33
|
const name = error.name;
|
|
30
34
|
|
|
31
35
|
// First check by error name (most specific)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { useCallback, useRef } from 'react';
|
|
7
|
-
import type {
|
|
7
|
+
import type { FieldChangeHandler, FormFieldConfig } from '../types/FormTypes';
|
|
8
8
|
|
|
9
9
|
export interface UseFieldOptions extends FormFieldConfig {
|
|
10
10
|
initialValue?: string;
|
|
@@ -31,7 +31,6 @@ export function useField(
|
|
|
31
31
|
): UseFieldResult {
|
|
32
32
|
const {
|
|
33
33
|
initialValue = '',
|
|
34
|
-
validateOnChange = false,
|
|
35
34
|
clearErrorOnChange = true,
|
|
36
35
|
onValueChange,
|
|
37
36
|
onErrorClear,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { useCallback, useRef } from 'react';
|
|
7
|
-
import type {
|
|
7
|
+
import type { FormConfig } from '../types/FormTypes';
|
|
8
8
|
|
|
9
9
|
export interface UseFormOptions<T extends Record<string, string>> extends FormConfig {
|
|
10
10
|
initialValues: T;
|
|
@@ -34,8 +34,6 @@ export function useForm<T extends Record<string, string>>(
|
|
|
34
34
|
): UseFormResult<T> {
|
|
35
35
|
const {
|
|
36
36
|
initialValues,
|
|
37
|
-
validateOnBlur = false,
|
|
38
|
-
clearErrorsOnSubmit = true,
|
|
39
37
|
onFieldChange,
|
|
40
38
|
onErrorsClear,
|
|
41
39
|
} = options;
|
|
@@ -16,7 +16,7 @@ export function sanitizeFormValues<T extends Record<string, string>>(
|
|
|
16
16
|
if (key in sanitized) {
|
|
17
17
|
const sanitizer = sanitizers[key];
|
|
18
18
|
if (sanitizer) {
|
|
19
|
-
sanitized[key] = sanitizer(sanitized[key]);
|
|
19
|
+
sanitized[key] = sanitizer(sanitized[key]) as T[Extract<keyof T, string>];
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Base class and common validation rules
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { ValidationResult
|
|
6
|
+
import type { ValidationResult } from '../types';
|
|
7
7
|
|
|
8
|
-
export abstract class BaseValidationRule<T =
|
|
8
|
+
export abstract class BaseValidationRule<T = unknown> {
|
|
9
9
|
abstract validate(value: T): ValidationResult;
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -19,7 +19,7 @@ export class RequiredRule extends BaseValidationRule<string | null | undefined>
|
|
|
19
19
|
|
|
20
20
|
validate(value: string | null | undefined): ValidationResult {
|
|
21
21
|
if (!value || value.trim() === '') {
|
|
22
|
-
return { isValid: false, error: `auth.validation.${thisFieldNameToKey()}.required` };
|
|
22
|
+
return { isValid: false, error: `auth.validation.${this.thisFieldNameToKey()}.required` };
|
|
23
23
|
}
|
|
24
24
|
return { isValid: true };
|
|
25
25
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Name Sanitizer
|
|
3
|
+
* Handles display name input sanitization
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export class NameSanitizer {
|
|
7
|
+
/**
|
|
8
|
+
* Sanitize name input
|
|
9
|
+
* Trims whitespace and normalizes internal spaces
|
|
10
|
+
*/
|
|
11
|
+
static sanitize(name: string | null | undefined): string {
|
|
12
|
+
if (!name) return '';
|
|
13
|
+
return name.trim().replace(/\s+/g, ' ');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Check if name is empty
|
|
18
|
+
*/
|
|
19
|
+
static isEmpty(name: string | null | undefined): boolean {
|
|
20
|
+
return !name || name.trim() === '';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Handles password validation with strength requirements
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { PasswordStrengthResult, ValidationResult
|
|
7
|
-
import {
|
|
6
|
+
import type { PasswordStrengthResult, ValidationResult } from '../types';
|
|
7
|
+
import { RequiredRule } from '../rules/ValidationRule';
|
|
8
8
|
import { PasswordSanitizer } from '../sanitizers/PasswordSanitizer';
|
|
9
9
|
|
|
10
10
|
export interface PasswordConfig {
|
package/src/exports/domain.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Domain Layer Exports
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export type { AuthUser, AuthProviderType } from '../domain/entities/AuthUser';
|
|
6
|
-
export type { UserProfile, UpdateProfileParams } from '../domain/entities/UserProfile';
|
|
7
|
-
export {
|
|
8
|
-
AuthError,
|
|
9
|
-
AuthInitializationError,
|
|
10
|
-
AuthConfigurationError,
|
|
11
|
-
AuthValidationError,
|
|
12
|
-
AuthNetworkError,
|
|
13
|
-
AuthUserNotFoundError,
|
|
14
|
-
AuthWrongPasswordError,
|
|
15
|
-
AuthEmailAlreadyInUseError,
|
|
16
|
-
AuthWeakPasswordError,
|
|
17
|
-
AuthInvalidEmailError,
|
|
18
|
-
} from '../domain/errors/AuthError';
|
|
19
|
-
export type {
|
|
20
|
-
AuthConfig,
|
|
21
|
-
PasswordConfig,
|
|
22
|
-
SocialAuthConfig,
|
|
23
|
-
SocialProviderConfig,
|
|
24
|
-
GoogleAuthConfig,
|
|
25
|
-
AppleAuthConfig,
|
|
26
|
-
SocialAuthProvider,
|
|
27
|
-
} from '../domain/value-objects/AuthConfig';
|
|
28
|
-
export {
|
|
29
|
-
DEFAULT_AUTH_CONFIG,
|
|
30
|
-
DEFAULT_PASSWORD_CONFIG,
|
|
31
|
-
DEFAULT_SOCIAL_CONFIG,
|
|
32
|
-
} from '../domain/value-objects/AuthConfig';
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Infrastructure Layer Exports
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export type { AuthCredentials, SignUpCredentials } from '../infrastructure/repositories/AuthRepository';
|
|
6
|
-
|
|
7
|
-
// Services
|
|
8
|
-
export {
|
|
9
|
-
AuthService,
|
|
10
|
-
initializeAuthService,
|
|
11
|
-
getAuthService,
|
|
12
|
-
resetAuthService,
|
|
13
|
-
} from '../infrastructure/services/AuthService';
|
|
14
|
-
export {
|
|
15
|
-
initializeAuth,
|
|
16
|
-
isAuthInitialized,
|
|
17
|
-
resetAuthInitialization,
|
|
18
|
-
} from '../infrastructure/services/initializeAuth';
|
|
19
|
-
export type { InitializeAuthOptions } from '../infrastructure/services/initializeAuth';
|
|
20
|
-
|
|
21
|
-
// Storage
|
|
22
|
-
export type { IStorageProvider } from '../infrastructure/types/Storage.types';
|
|
23
|
-
export {
|
|
24
|
-
createStorageProvider,
|
|
25
|
-
StorageProviderAdapter,
|
|
26
|
-
} from '../infrastructure/adapters/StorageProviderAdapter';
|
|
27
|
-
|
|
28
|
-
// Validation
|
|
29
|
-
export {
|
|
30
|
-
validateEmail,
|
|
31
|
-
validatePasswordForLogin,
|
|
32
|
-
validatePasswordForRegister,
|
|
33
|
-
validatePasswordConfirmation,
|
|
34
|
-
validateDisplayName,
|
|
35
|
-
} from '../infrastructure/utils/AuthValidation';
|
|
36
|
-
export type {
|
|
37
|
-
ValidationResult,
|
|
38
|
-
PasswordStrengthResult,
|
|
39
|
-
PasswordRequirements,
|
|
40
|
-
} from '../infrastructure/utils/AuthValidation';
|
|
41
|
-
export type {
|
|
42
|
-
FormValidationError,
|
|
43
|
-
FormValidationResult,
|
|
44
|
-
} from '../infrastructure/utils/validation/types';
|
|
45
|
-
export {
|
|
46
|
-
SECURITY_LIMITS,
|
|
47
|
-
sanitizeEmail,
|
|
48
|
-
sanitizePassword,
|
|
49
|
-
sanitizeName,
|
|
50
|
-
} from '../infrastructure/utils/validation/sanitization';
|
|
51
|
-
export type { SecurityLimitKey } from '../infrastructure/utils/validation/sanitization';
|
|
52
|
-
export {
|
|
53
|
-
isEmpty,
|
|
54
|
-
isEmptyEmail,
|
|
55
|
-
isEmptyPassword,
|
|
56
|
-
isEmptyName,
|
|
57
|
-
isNotEmpty,
|
|
58
|
-
hasContent,
|
|
59
|
-
} from '../infrastructure/utils/validation/validationHelpers';
|
|
60
|
-
export { safeCallback, safeCallbackSync } from '../infrastructure/utils/safeCallback';
|
|
61
|
-
|
|
62
|
-
// Calculators
|
|
63
|
-
export {
|
|
64
|
-
calculateUserId,
|
|
65
|
-
calculateHasFirebaseUser,
|
|
66
|
-
calculateIsAnonymous,
|
|
67
|
-
calculateIsAuthenticated,
|
|
68
|
-
calculateUserType,
|
|
69
|
-
calculateIsAuthReady,
|
|
70
|
-
calculateDerivedAuthState,
|
|
71
|
-
collectFieldErrors,
|
|
72
|
-
extractFieldError,
|
|
73
|
-
hasFieldErrors,
|
|
74
|
-
getFirstErrorMessage,
|
|
75
|
-
calculateUserProfileDisplay,
|
|
76
|
-
calculatePasswordRequirements,
|
|
77
|
-
calculatePasswordsMatch,
|
|
78
|
-
calculatePasswordValidation,
|
|
79
|
-
calculatePasswordStrength,
|
|
80
|
-
} from '../infrastructure/utils/calculators';
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Presentation Layer Exports
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
// Hooks
|
|
6
|
-
export { useAuth } from '../presentation/hooks/useAuth';
|
|
7
|
-
export type { UseAuthResult } from '../presentation/hooks/useAuth';
|
|
8
|
-
export { useLoginForm } from '../presentation/hooks/useLoginForm';
|
|
9
|
-
export type { UseLoginFormConfig, UseLoginFormResult } from '../presentation/hooks/useLoginForm';
|
|
10
|
-
export { useRegisterForm } from '../presentation/hooks/useRegisterForm';
|
|
11
|
-
export type {
|
|
12
|
-
UseRegisterFormConfig,
|
|
13
|
-
UseRegisterFormResult,
|
|
14
|
-
} from '../presentation/hooks/useRegisterForm';
|
|
15
|
-
export { useAuthRequired } from '../presentation/hooks/useAuthRequired';
|
|
16
|
-
export { useRequireAuth, useUserId } from '../presentation/hooks/useRequireAuth';
|
|
17
|
-
export { useUserProfile } from '../presentation/hooks/useUserProfile';
|
|
18
|
-
export type {
|
|
19
|
-
UserProfileData,
|
|
20
|
-
UseUserProfileParams,
|
|
21
|
-
} from '../presentation/hooks/useUserProfile';
|
|
22
|
-
export { useAccountManagement } from '../presentation/hooks/useAccountManagement';
|
|
23
|
-
export type {
|
|
24
|
-
UseAccountManagementReturn,
|
|
25
|
-
UseAccountManagementOptions,
|
|
26
|
-
} from '../presentation/hooks/useAccountManagement';
|
|
27
|
-
export { useAppleAuth } from '../presentation/hooks/useAppleAuth';
|
|
28
|
-
export type { UseAppleAuthResult } from '../presentation/hooks/useAppleAuth';
|
|
29
|
-
export { useAuthBottomSheet } from '../presentation/hooks/useAuthBottomSheet';
|
|
30
|
-
export type {
|
|
31
|
-
SocialAuthConfiguration,
|
|
32
|
-
} from '../presentation/hooks/useAuthBottomSheet';
|
|
33
|
-
export { useAuthHandlers } from '../presentation/hooks/useAuthHandlers';
|
|
34
|
-
export type {
|
|
35
|
-
AuthHandlersAppInfo,
|
|
36
|
-
AuthHandlersTranslations,
|
|
37
|
-
} from '../presentation/hooks/useAuthHandlers';
|
|
38
|
-
export { usePasswordPromptNavigation } from '../presentation/hooks/usePasswordPromptNavigation';
|
|
39
|
-
export type {
|
|
40
|
-
UsePasswordPromptNavigationOptions,
|
|
41
|
-
UsePasswordPromptNavigationReturn,
|
|
42
|
-
} from '../presentation/hooks/usePasswordPromptNavigation';
|
|
43
|
-
export { useAuthErrorHandler } from '../presentation/hooks/useAuthErrorHandler';
|
|
44
|
-
export type {
|
|
45
|
-
UseAuthErrorHandlerConfig,
|
|
46
|
-
UseAuthErrorHandlerResult,
|
|
47
|
-
} from '../presentation/hooks/useAuthErrorHandler';
|
|
48
|
-
export { useLocalError } from '../presentation/hooks/useLocalError';
|
|
49
|
-
export type { UseLocalErrorResult } from '../presentation/hooks/useLocalError';
|
|
50
|
-
|
|
51
|
-
// Components
|
|
52
|
-
export { AuthProvider } from '../presentation/providers/AuthProvider';
|
|
53
|
-
export type { ErrorFallbackProps } from '../presentation/providers/AuthProvider';
|
|
54
|
-
export { LoginScreen } from '../presentation/screens/LoginScreen';
|
|
55
|
-
export type { LoginScreenProps } from '../presentation/screens/LoginScreen';
|
|
56
|
-
export { RegisterScreen } from '../presentation/screens/RegisterScreen';
|
|
57
|
-
export type { RegisterScreenProps } from '../presentation/screens/RegisterScreen';
|
|
58
|
-
export { AccountScreen } from '../presentation/screens/AccountScreen';
|
|
59
|
-
export type {
|
|
60
|
-
AccountScreenProps,
|
|
61
|
-
AccountScreenConfig,
|
|
62
|
-
} from '../presentation/screens/AccountScreen';
|
|
63
|
-
export { EditProfileScreen } from '../presentation/screens/EditProfileScreen';
|
|
64
|
-
export type {
|
|
65
|
-
EditProfileScreenProps,
|
|
66
|
-
} from '../presentation/screens/EditProfileScreen';
|
|
67
|
-
export { PasswordPromptScreen } from '../presentation/screens/PasswordPromptScreen';
|
|
68
|
-
export type {
|
|
69
|
-
PasswordPromptScreenProps,
|
|
70
|
-
} from '../presentation/screens/PasswordPromptScreen';
|
|
71
|
-
export { AuthNavigator } from '../presentation/navigation/AuthNavigator';
|
|
72
|
-
export type { AuthStackParamList } from '../presentation/navigation/AuthNavigator';
|
|
73
|
-
export { AuthBottomSheet } from '../presentation/components/AuthBottomSheet';
|
|
74
|
-
export type {
|
|
75
|
-
AuthBottomSheetProps,
|
|
76
|
-
AuthBottomSheetTranslations,
|
|
77
|
-
} from '../presentation/components/AuthBottomSheet';
|
|
78
|
-
export { ProfileSection } from '../presentation/components/ProfileSection';
|
|
79
|
-
export type {
|
|
80
|
-
ProfileSectionProps,
|
|
81
|
-
ProfileSectionConfig,
|
|
82
|
-
} from '../presentation/components/ProfileSection';
|
|
83
|
-
|
|
84
|
-
// Stores
|
|
85
|
-
export { useAuthStore } from '../presentation/stores/authStore';
|
|
86
|
-
export { useAuthModalStore } from '../presentation/stores/authModalStore';
|
|
87
|
-
export {
|
|
88
|
-
initializeAuthListener,
|
|
89
|
-
resetAuthListener,
|
|
90
|
-
isAuthListenerInitialized,
|
|
91
|
-
} from '../presentation/stores/initializeAuthListener';
|
|
92
|
-
export type {
|
|
93
|
-
AuthState,
|
|
94
|
-
AuthActions,
|
|
95
|
-
UserType,
|
|
96
|
-
AuthListenerOptions,
|
|
97
|
-
} from '../types/auth-store.types';
|
|
98
|
-
export type { AuthModalMode } from '../presentation/stores/auth.selectors';
|
|
99
|
-
export {
|
|
100
|
-
selectUser,
|
|
101
|
-
selectLoading,
|
|
102
|
-
selectError,
|
|
103
|
-
selectSetLoading,
|
|
104
|
-
selectSetError,
|
|
105
|
-
selectSetIsAnonymous,
|
|
106
|
-
selectShowAuthModal,
|
|
107
|
-
selectUserId,
|
|
108
|
-
selectIsAuthenticated,
|
|
109
|
-
selectHasFirebaseUser,
|
|
110
|
-
selectIsAnonymous,
|
|
111
|
-
selectUserType,
|
|
112
|
-
selectIsAuthReady,
|
|
113
|
-
selectFirebaseUserId,
|
|
114
|
-
selectAuthState,
|
|
115
|
-
} from '../presentation/stores/auth.selectors';
|
package/src/exports/shared.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Layer Exports
|
|
3
|
-
* New modular utilities
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Validation
|
|
7
|
-
export {
|
|
8
|
-
EmailValidator,
|
|
9
|
-
PasswordValidator,
|
|
10
|
-
NameValidator,
|
|
11
|
-
} from '../shared/validation/validators';
|
|
12
|
-
export type { PasswordConfig } from '../shared/validation/validators';
|
|
13
|
-
export {
|
|
14
|
-
EmailSanitizer,
|
|
15
|
-
PasswordSanitizer,
|
|
16
|
-
NameSanitizer,
|
|
17
|
-
} from '../shared/validation/sanitizers';
|
|
18
|
-
export {
|
|
19
|
-
BaseValidationRule,
|
|
20
|
-
RequiredRule,
|
|
21
|
-
RegexRule,
|
|
22
|
-
MinLengthRule,
|
|
23
|
-
} from '../shared/validation/rules';
|
|
24
|
-
export type {
|
|
25
|
-
ValidationResult,
|
|
26
|
-
PasswordRequirements,
|
|
27
|
-
PasswordStrengthResult,
|
|
28
|
-
ValidationRule,
|
|
29
|
-
ValidatorConfig,
|
|
30
|
-
} from '../shared/validation/types';
|
|
31
|
-
|
|
32
|
-
// Error Handling
|
|
33
|
-
export {
|
|
34
|
-
ErrorMapper,
|
|
35
|
-
DEFAULT_AUTH_ERROR_MAPPINGS,
|
|
36
|
-
FieldErrorMapper,
|
|
37
|
-
} from '../shared/error-handling/mappers';
|
|
38
|
-
export { ErrorHandler, FormErrorHandler } from '../shared/error-handling/handlers';
|
|
39
|
-
export type {
|
|
40
|
-
FieldError,
|
|
41
|
-
FormFieldErrors,
|
|
42
|
-
ErrorMap,
|
|
43
|
-
ErrorMappingConfig,
|
|
44
|
-
FormErrorHandlerConfig,
|
|
45
|
-
} from '../shared/error-handling/types';
|
|
46
|
-
|
|
47
|
-
// Form
|
|
48
|
-
export { useField, useForm } from '../shared/form/builders';
|
|
49
|
-
export type {
|
|
50
|
-
UseFieldOptions,
|
|
51
|
-
UseFieldResult,
|
|
52
|
-
UseFormOptions,
|
|
53
|
-
UseFormResult,
|
|
54
|
-
} from '../shared/form/builders';
|
|
55
|
-
export {
|
|
56
|
-
isFormValid,
|
|
57
|
-
isFormDirty,
|
|
58
|
-
isFormTouched,
|
|
59
|
-
getFormErrors,
|
|
60
|
-
getFirstFormError,
|
|
61
|
-
countFormErrors,
|
|
62
|
-
getFieldError,
|
|
63
|
-
fieldHasError,
|
|
64
|
-
isFieldTouched,
|
|
65
|
-
resetFormState,
|
|
66
|
-
} from '../shared/form/state';
|
|
67
|
-
export {
|
|
68
|
-
sanitizeFormValues,
|
|
69
|
-
extractFields,
|
|
70
|
-
areRequiredFieldsFilled,
|
|
71
|
-
getEmptyRequiredFields,
|
|
72
|
-
createFieldOptions,
|
|
73
|
-
mergeFormErrors,
|
|
74
|
-
clearFieldErrors,
|
|
75
|
-
} from '../shared/form/utils/formUtils';
|
|
76
|
-
export {
|
|
77
|
-
createFieldChangeHandler,
|
|
78
|
-
createFieldBlurHandler,
|
|
79
|
-
debounceFieldChange,
|
|
80
|
-
isFieldValueEmpty,
|
|
81
|
-
sanitizeFieldValue,
|
|
82
|
-
formatFieldValue,
|
|
83
|
-
validateFieldValue,
|
|
84
|
-
getFieldDisplayValue,
|
|
85
|
-
truncateFieldValue,
|
|
86
|
-
} from '../shared/form/utils/fieldUtils';
|
|
87
|
-
export type {
|
|
88
|
-
FieldState,
|
|
89
|
-
FormState,
|
|
90
|
-
FieldChangeHandler,
|
|
91
|
-
FormFieldConfig,
|
|
92
|
-
FormConfig,
|
|
93
|
-
} from '../shared/form/types';
|
package/src/exports/utils.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utilities & Init Exports
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
getAuthErrorLocalizationKey,
|
|
7
|
-
resolveErrorMessage,
|
|
8
|
-
} from '../presentation/utils/getAuthErrorMessage';
|
|
9
|
-
export { createAuthInitModule } from '../init/createAuthInitModule';
|
|
10
|
-
export type { AuthInitModuleConfig } from '../init/createAuthInitModule';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error Handling Module Public API
|
|
3
|
-
* Centralized error handling system
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Types
|
|
7
|
-
export type {
|
|
8
|
-
FieldError,
|
|
9
|
-
FormFieldErrors,
|
|
10
|
-
ErrorMap,
|
|
11
|
-
ErrorMappingConfig,
|
|
12
|
-
} from './types';
|
|
13
|
-
|
|
14
|
-
// Mappers
|
|
15
|
-
export { ErrorMapper, DEFAULT_AUTH_ERROR_MAPPINGS, FieldErrorMapper } from './mappers';
|
|
16
|
-
|
|
17
|
-
// Handlers
|
|
18
|
-
export { ErrorHandler, FormErrorHandler } from './handlers';
|
|
19
|
-
export type { FormErrorHandlerConfig } from './handlers';
|
package/src/shared/form/index.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Form Module Public API
|
|
3
|
-
* Centralized form state management system
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Types
|
|
7
|
-
export type {
|
|
8
|
-
FieldState,
|
|
9
|
-
FormState,
|
|
10
|
-
FieldChangeHandler,
|
|
11
|
-
FormFieldConfig,
|
|
12
|
-
FormConfig,
|
|
13
|
-
} from './types';
|
|
14
|
-
|
|
15
|
-
// Builders
|
|
16
|
-
export { useField, useForm } from './builders';
|
|
17
|
-
export type { UseFieldOptions, UseFieldResult, UseFormOptions, UseFormResult } from './builders';
|
|
18
|
-
|
|
19
|
-
// State utilities
|
|
20
|
-
export {
|
|
21
|
-
isFormValid,
|
|
22
|
-
isFormDirty,
|
|
23
|
-
isFormTouched,
|
|
24
|
-
getFormErrors,
|
|
25
|
-
getFirstFormError,
|
|
26
|
-
countFormErrors,
|
|
27
|
-
getFieldError,
|
|
28
|
-
fieldHasError,
|
|
29
|
-
isFieldTouched,
|
|
30
|
-
resetFormState,
|
|
31
|
-
} from './state';
|
|
32
|
-
|
|
33
|
-
// Utils
|
|
34
|
-
export {
|
|
35
|
-
sanitizeFormValues,
|
|
36
|
-
extractFields,
|
|
37
|
-
areRequiredFieldsFilled,
|
|
38
|
-
getEmptyRequiredFields,
|
|
39
|
-
createFieldOptions,
|
|
40
|
-
mergeFormErrors,
|
|
41
|
-
clearFieldErrors,
|
|
42
|
-
createFieldChangeHandler,
|
|
43
|
-
createFieldBlurHandler,
|
|
44
|
-
debounceFieldChange,
|
|
45
|
-
isFieldValueEmpty,
|
|
46
|
-
sanitizeFieldValue,
|
|
47
|
-
formatFieldValue,
|
|
48
|
-
validateFieldValue,
|
|
49
|
-
getFieldDisplayValue,
|
|
50
|
-
truncateFieldValue,
|
|
51
|
-
} from './utils';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validation Module Public API
|
|
3
|
-
* Centralized validation system
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Types
|
|
7
|
-
export type {
|
|
8
|
-
ValidationResult,
|
|
9
|
-
PasswordRequirements,
|
|
10
|
-
PasswordStrengthResult,
|
|
11
|
-
ValidationRule,
|
|
12
|
-
ValidatorConfig,
|
|
13
|
-
} from './types';
|
|
14
|
-
|
|
15
|
-
// Validators
|
|
16
|
-
export { EmailValidator, PasswordValidator, NameValidator } from './validators';
|
|
17
|
-
export type { PasswordConfig } from './validators';
|
|
18
|
-
|
|
19
|
-
// Sanitizers
|
|
20
|
-
export { EmailSanitizer, PasswordSanitizer, NameSanitizer } from './sanitizers';
|
|
21
|
-
|
|
22
|
-
// Rules
|
|
23
|
-
export { BaseValidationRule, RequiredRule, RegexRule, MinLengthRule } from './rules';
|