@umituz/react-native-auth 3.4.29 → 3.4.31
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/README.md +426 -0
- package/package.json +1 -3
- package/src/application/README.md +513 -0
- package/src/domain/ConfigAndErrors.md +545 -0
- package/src/domain/README.md +293 -0
- package/src/domain/entities/AuthUser.md +377 -0
- package/src/domain/entities/UserProfile.md +443 -0
- package/src/infrastructure/README.md +576 -0
- package/src/infrastructure/services/README.md +417 -0
- package/src/presentation/README.md +770 -0
- package/src/presentation/components/AuthBackground.tsx +21 -0
- package/src/presentation/components/AuthContainer.tsx +3 -3
- package/src/presentation/components/LoginForm.md +331 -0
- package/src/presentation/components/PasswordIndicators.md +471 -0
- package/src/presentation/components/ProfileComponents.md +432 -0
- package/src/presentation/components/README.md +117 -0
- package/src/presentation/components/SocialLoginButtons.md +303 -0
- package/src/presentation/hooks/README.md +122 -0
- package/src/presentation/hooks/useAccountManagement.md +380 -0
- package/src/presentation/hooks/useAuth.md +255 -0
- package/src/presentation/hooks/useAuthBottomSheet.md +417 -0
- package/src/presentation/hooks/useAuthRequired.md +248 -0
- package/src/presentation/hooks/useProfileUpdate.md +327 -0
- package/src/presentation/hooks/useSocialLogin.md +411 -0
- package/src/presentation/hooks/useUserProfile.md +230 -0
- package/src/presentation/screens/README.md +198 -0
- package/src/presentation/components/AuthGradientBackground.tsx +0 -33
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth Background Component
|
|
3
|
+
* Standard background for auth screens
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { StyleSheet, View } from "react-native";
|
|
8
|
+
import { useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
9
|
+
|
|
10
|
+
export const AuthBackground: React.FC = () => {
|
|
11
|
+
const tokens = useAppDesignTokens();
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<View
|
|
15
|
+
style={[
|
|
16
|
+
StyleSheet.absoluteFill,
|
|
17
|
+
{ backgroundColor: tokens.colors.backgroundPrimary }
|
|
18
|
+
]}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auth Container Component
|
|
3
|
-
* Main container for auth screens with
|
|
3
|
+
* Main container for auth screens with background and scroll
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { useMemo } from "react";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "react-native";
|
|
13
13
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
14
14
|
import { useResponsive } from "@umituz/react-native-design-system";
|
|
15
|
-
import {
|
|
15
|
+
import { AuthBackground } from "./AuthBackground";
|
|
16
16
|
|
|
17
17
|
/** Layout constants for auth screens */
|
|
18
18
|
const AUTH_LAYOUT = {
|
|
@@ -39,7 +39,7 @@ export const AuthContainer: React.FC<AuthContainerProps> = ({ children }) => {
|
|
|
39
39
|
style={styles.container}
|
|
40
40
|
behavior="padding"
|
|
41
41
|
>
|
|
42
|
-
<
|
|
42
|
+
<AuthBackground />
|
|
43
43
|
<ScrollView
|
|
44
44
|
contentContainerStyle={[styles.scrollContent, dynamicStyles]}
|
|
45
45
|
keyboardShouldPersistTaps="handled"
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
# LoginForm & RegisterForm
|
|
2
|
+
|
|
3
|
+
Authentication formları için hazır component'ler.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## LoginForm
|
|
8
|
+
|
|
9
|
+
Email ve şifre ile giriş formu.
|
|
10
|
+
|
|
11
|
+
### Kullanım
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { LoginForm } from '@umituz/react-native-auth';
|
|
15
|
+
|
|
16
|
+
function LoginScreen() {
|
|
17
|
+
const navigation = useNavigation();
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<View>
|
|
21
|
+
<LoginForm
|
|
22
|
+
onNavigateToRegister={() => navigation.navigate('Register')}
|
|
23
|
+
/>
|
|
24
|
+
</View>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Props
|
|
30
|
+
|
|
31
|
+
| Prop | Tip | Required | Açıklama |
|
|
32
|
+
|------|-----|----------|----------|
|
|
33
|
+
| `onNavigateToRegister` | `() => void` | Yes | Kayıt ekranına navigasyon |
|
|
34
|
+
|
|
35
|
+
### Özellikler
|
|
36
|
+
|
|
37
|
+
- ✅ Email validasyonu
|
|
38
|
+
- ✅ Şifre validasyonu
|
|
39
|
+
- ✅ Loading state
|
|
40
|
+
- ✅ Hata gösterimi
|
|
41
|
+
- ✅ Keyboard navigation (Enter ile sonraki alana geçiş)
|
|
42
|
+
- ✅ Localisation desteği
|
|
43
|
+
- ✅ Disabled state (boş alanlar)
|
|
44
|
+
|
|
45
|
+
### Örnekler
|
|
46
|
+
|
|
47
|
+
#### Basit Kullanım
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
function LoginScreen() {
|
|
51
|
+
const navigation = useNavigation();
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<AuthContainer>
|
|
55
|
+
<AuthHeader title="Giriş Yap" />
|
|
56
|
+
<LoginForm
|
|
57
|
+
onNavigateToRegister={() => navigation.navigate('Register')}
|
|
58
|
+
/>
|
|
59
|
+
</AuthContainer>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### Social Login ile
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
function LoginScreen() {
|
|
68
|
+
const navigation = useNavigation();
|
|
69
|
+
const { signInWithGoogle, signInWithApple } = useSocialLogin();
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<AuthContainer>
|
|
73
|
+
<AuthHeader title="Giriş Yap" />
|
|
74
|
+
|
|
75
|
+
<LoginForm
|
|
76
|
+
onNavigateToRegister={() => navigation.navigate('Register')}
|
|
77
|
+
/>
|
|
78
|
+
|
|
79
|
+
<AuthDivider text="veya" />
|
|
80
|
+
|
|
81
|
+
<SocialLoginButtons
|
|
82
|
+
onGoogleSignIn={signInWithGoogle}
|
|
83
|
+
onAppleSignIn={signInWithApple}
|
|
84
|
+
/>
|
|
85
|
+
</AuthContainer>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### Custom AuthContainer ile
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
function CustomLoginScreen() {
|
|
94
|
+
return (
|
|
95
|
+
<ScrollView style={styles.container}>
|
|
96
|
+
<View style={styles.header}>
|
|
97
|
+
<Logo />
|
|
98
|
+
<Text style={styles.title}>Hoşgeldiniz</Text>
|
|
99
|
+
<Text style={styles.subtitle}>Devam etmek için giriş yapın</Text>
|
|
100
|
+
</View>
|
|
101
|
+
|
|
102
|
+
<View style={styles.formContainer}>
|
|
103
|
+
<LoginForm
|
|
104
|
+
onNavigateToRegister={() => navigation.navigate('Register')}
|
|
105
|
+
/>
|
|
106
|
+
</View>
|
|
107
|
+
|
|
108
|
+
<View style={styles.footer}>
|
|
109
|
+
<AuthLegalLinks />
|
|
110
|
+
</View>
|
|
111
|
+
</ScrollView>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## RegisterForm
|
|
119
|
+
|
|
120
|
+
Kullanıcı kayıt formu. DisplayName, email, şifre ve şifre tekrar alanlarını içerir.
|
|
121
|
+
|
|
122
|
+
### Kullanım
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
import { RegisterForm } from '@umituz/react-native-auth';
|
|
126
|
+
|
|
127
|
+
function RegisterScreen() {
|
|
128
|
+
const navigation = useNavigation();
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<View>
|
|
132
|
+
<RegisterForm
|
|
133
|
+
onNavigateToLogin={() => navigation.navigate('Login')}
|
|
134
|
+
onTermsPress={() => navigation.navigate('Terms')}
|
|
135
|
+
onPrivacyPress={() => navigation.navigate('Privacy')}
|
|
136
|
+
/>
|
|
137
|
+
</View>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Props
|
|
143
|
+
|
|
144
|
+
| Prop | Tip | Required | Açıklama |
|
|
145
|
+
|------|-----|----------|----------|
|
|
146
|
+
| `onNavigateToLogin` | `() => void` | Yes | Giriş ekranına navigasyon |
|
|
147
|
+
| `termsUrl` | `string` | No | Kullanım şartları URL |
|
|
148
|
+
| `privacyUrl` | `string` | No | Gizlilik politikası URL |
|
|
149
|
+
| `onTermsPress` | `() => void` | No | Kullanım şartları butonu handler |
|
|
150
|
+
| `onPrivacyPress` | `() => void` | No | Gizlilik politikası butonu handler |
|
|
151
|
+
|
|
152
|
+
### Özellikler
|
|
153
|
+
|
|
154
|
+
- ✅ DisplayName validasyonu
|
|
155
|
+
- ✅ Email validasyonu
|
|
156
|
+
- ✅ Şifre validasyonu
|
|
157
|
+
- ✅ Şifre eşleşme kontrolü
|
|
158
|
+
- ✅ Şifre güç göstergesi
|
|
159
|
+
- ✅ Loading state
|
|
160
|
+
- ✅ Hata gösterimi
|
|
161
|
+
- ✅ KVKK/Kullanım şartları kabulü
|
|
162
|
+
- ✅ Keyboard navigation
|
|
163
|
+
|
|
164
|
+
### Örnekler
|
|
165
|
+
|
|
166
|
+
#### Basit Kullanım
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
function RegisterScreen() {
|
|
170
|
+
const navigation = useNavigation();
|
|
171
|
+
|
|
172
|
+
return (
|
|
173
|
+
<AuthContainer>
|
|
174
|
+
<AuthHeader title="Kayıt Ol" />
|
|
175
|
+
<RegisterForm
|
|
176
|
+
onNavigateToLogin={() => navigation.navigate('Login')}
|
|
177
|
+
/>
|
|
178
|
+
</AuthContainer>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
#### Legal Links ile
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
function RegisterScreen() {
|
|
187
|
+
const navigation = useNavigation();
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<AuthContainer>
|
|
191
|
+
<AuthHeader title="Kayıt Ol" />
|
|
192
|
+
<RegisterForm
|
|
193
|
+
onNavigateToLogin={() => navigation.navigate('Login')}
|
|
194
|
+
termsUrl="https://example.com/terms"
|
|
195
|
+
privacyUrl="https://example.com/privacy"
|
|
196
|
+
/>
|
|
197
|
+
</AuthContainer>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### Custom Handlers ile
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
function RegisterScreen() {
|
|
206
|
+
const navigation = useNavigation();
|
|
207
|
+
|
|
208
|
+
const handleTermsPress = () => {
|
|
209
|
+
navigation.navigate('WebView', {
|
|
210
|
+
url: 'https://example.com/terms',
|
|
211
|
+
title: 'Kullanım Şartları',
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
const handlePrivacyPress = () => {
|
|
216
|
+
navigation.navigate('WebView', {
|
|
217
|
+
url: 'https://example.com/privacy',
|
|
218
|
+
title: 'Gizlilik Politikası',
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
return (
|
|
223
|
+
<AuthContainer>
|
|
224
|
+
<AuthHeader title="Kayıt Ol" />
|
|
225
|
+
<RegisterForm
|
|
226
|
+
onNavigateToLogin={() => navigation.navigate('Login')}
|
|
227
|
+
onTermsPress={handleTermsPress}
|
|
228
|
+
onPrivacyPress={handlePrivacyPress}
|
|
229
|
+
/>
|
|
230
|
+
</AuthContainer>
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
#### Social Login ile
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
function RegisterScreen() {
|
|
239
|
+
const navigation = useNavigation();
|
|
240
|
+
const { signInWithGoogle, signInWithApple } = useSocialLogin();
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
<AuthContainer>
|
|
244
|
+
<AuthHeader title="Kayıt Ol" />
|
|
245
|
+
|
|
246
|
+
<RegisterForm
|
|
247
|
+
onNavigateToLogin={() => navigation.navigate('Login')}
|
|
248
|
+
/>
|
|
249
|
+
|
|
250
|
+
<AuthDivider text="veya şununla devam et" />
|
|
251
|
+
|
|
252
|
+
<SocialLoginButtons
|
|
253
|
+
onGoogleSignIn={signInWithGoogle}
|
|
254
|
+
onAppleSignIn={signInWithApple}
|
|
255
|
+
/>
|
|
256
|
+
</AuthContainer>
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Form Validasyonu
|
|
262
|
+
|
|
263
|
+
### LoginForm Validasyonları
|
|
264
|
+
|
|
265
|
+
| Alan | Validasyon |
|
|
266
|
+
|------|------------|
|
|
267
|
+
| Email | Boş olamaz, geçerli email formatı |
|
|
268
|
+
| Password | Boş olamaz |
|
|
269
|
+
|
|
270
|
+
### RegisterForm Validasyonları
|
|
271
|
+
|
|
272
|
+
| Alan | Validasyon |
|
|
273
|
+
|------|------------|
|
|
274
|
+
| DisplayName | Boş olamaz |
|
|
275
|
+
| Email | Boş olamaz, geçerli email formatı |
|
|
276
|
+
| Password | Boş olamaz, minimum uzunluk, karmaşıklık |
|
|
277
|
+
| Confirm Password | Boş olamaz, password ile eşleşmeli |
|
|
278
|
+
|
|
279
|
+
## Password Requirements
|
|
280
|
+
|
|
281
|
+
RegisterForm otomatik olarak şifre gereksinimlerini kontrol eder:
|
|
282
|
+
|
|
283
|
+
```typescript
|
|
284
|
+
{
|
|
285
|
+
minLength: 8,
|
|
286
|
+
requireUppercase: true,
|
|
287
|
+
requireLowercase: true,
|
|
288
|
+
requireNumbers: true,
|
|
289
|
+
requireSpecialChars: true,
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Şifre Güç Göstergesi
|
|
294
|
+
|
|
295
|
+
RegisterForm otomatik olarak [`PasswordStrengthIndicator`](./PasswordStrengthIndicator.md) ve [`PasswordMatchIndicator`](./PasswordMatchIndicator.md) component'lerini kullanır:
|
|
296
|
+
|
|
297
|
+
```typescript
|
|
298
|
+
// Kullanıcı şifre girdikçe
|
|
299
|
+
// 1. Şifre gücü gösterilir (Zayıf/Orta/Güçlü)
|
|
300
|
+
// 2. Şifreler eşleşiyor mu gösterilir
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Hata Yönetimi
|
|
304
|
+
|
|
305
|
+
Form component'leri otomatik olarak hataları gösterir:
|
|
306
|
+
|
|
307
|
+
```typescript
|
|
308
|
+
// Email hatalı
|
|
309
|
+
<input state="error" helperText="Geçersiz email formatı" />
|
|
310
|
+
|
|
311
|
+
// Şifre çok kısa
|
|
312
|
+
<input state="error" helperText="Şifre en az 8 karakter olmalı" />
|
|
313
|
+
|
|
314
|
+
// Genel hata (Firebase, network vb.)
|
|
315
|
+
<AuthErrorDisplay error="Şifre hatalı" />
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## İlgili Component'ler
|
|
319
|
+
|
|
320
|
+
- [`AuthContainer`](./AuthContainer.md) - Layout container
|
|
321
|
+
- [`AuthHeader`](./AuthHeader.md) - Header component'i
|
|
322
|
+
- [`PasswordStrengthIndicator`](./PasswordStrengthIndicator.md) - Şifre güç göstergesi
|
|
323
|
+
- [`PasswordMatchIndicator`](./PasswordMatchIndicator.md) - Şifre eşleşme göstergesi
|
|
324
|
+
- [`SocialLoginButtons`](./SocialLoginButtons.md) - Social login butonları
|
|
325
|
+
- [`AuthLegalLinks`](./AuthLegalLinks.md) - Legal links
|
|
326
|
+
|
|
327
|
+
## İlgili Hook'lar
|
|
328
|
+
|
|
329
|
+
- [`useLoginForm`](../hooks/useLoginForm.md) - Login form state yönetimi
|
|
330
|
+
- [`useRegisterForm`](../hooks/useRegisterForm.md) - Register form state yönetimi
|
|
331
|
+
- [`useAuth`](../hooks/useAuth.md) - Ana auth state yönetimi
|