@umituz/react-native-auth 3.4.30 → 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.
@@ -0,0 +1,432 @@
1
+ # Profile Components
2
+
3
+ Kullanıcı profili ve hesap yönetimi için component'ler.
4
+
5
+ ## Component'ler
6
+
7
+ - **[`ProfileSection`](#profilesection)** - Profil bölümü
8
+ - **[`AccountActions`](#accountactions)** - Hesap işlemleri
9
+
10
+ ---
11
+
12
+ ## ProfileSection
13
+
14
+ Kullanıcı profil bilgilerini gösteren component. Avatar, isim ve kullanıcı ID'si içerir.
15
+
16
+ ### Kullanım
17
+
18
+ ```typescript
19
+ import { ProfileSection } from '@umituz/react-native-auth';
20
+
21
+ function SettingsScreen() {
22
+ const profile = useUserProfile({
23
+ accountRoute: 'AccountSettings',
24
+ });
25
+
26
+ const navigation = useNavigation();
27
+
28
+ return (
29
+ <View>
30
+ <ProfileSection
31
+ profile={{
32
+ displayName: profile?.displayName,
33
+ userId: profile?.userId,
34
+ isAnonymous: profile?.isAnonymous || false,
35
+ avatarUrl: profile?.avatarUrl,
36
+ accountSettingsRoute: profile?.accountSettingsRoute,
37
+ }}
38
+ onPress={() => navigation.navigate('EditProfile')}
39
+ onSignIn={() => navigation.navigate('Login')}
40
+ signInText="Giriş Yap"
41
+ anonymousText="Misafir"
42
+ />
43
+ </View>
44
+ );
45
+ }
46
+ ```
47
+
48
+ ### Props
49
+
50
+ | Prop | Tip | Required | Açıklama |
51
+ |------|-----|----------|----------|
52
+ | `profile` | `ProfileSectionConfig` | Yes | Profil konfigürasyonu |
53
+ | `onPress` | `() => void` | No | Press handler (authenticated kullanıcılar için) |
54
+ | `onSignIn` | `() => void` | No | Sign-in handler (anonymous kullanıcılar için) |
55
+ | `signInText` | `string` | No | "Giriş Yap" metni |
56
+ | `anonymousText` | `string` | No | Anonymous kullanıcı metni |
57
+
58
+ #### ProfileSectionConfig
59
+
60
+ ```typescript
61
+ interface ProfileSectionConfig {
62
+ displayName?: string; // Görünen ad
63
+ userId?: string; // Kullanıcı ID'si
64
+ isAnonymous: boolean; // Anonymous mu
65
+ avatarUrl?: string; // Profil fotoğrafı URL'si
66
+ accountSettingsRoute?: string; // Hesap ayarları route'u
67
+ benefits?: string[]; // Faydalar listesi
68
+ }
69
+ ```
70
+
71
+ ### Örnekler
72
+
73
+ #### Authenticated Kullanıcı
74
+
75
+ ```typescript
76
+ function ProfileSection() {
77
+ const { user } = useAuth();
78
+
79
+ const profile = {
80
+ displayName: user?.displayName || user?.email,
81
+ userId: user?.uid,
82
+ isAnonymous: false,
83
+ avatarUrl: user?.photoURL,
84
+ accountSettingsRoute: 'AccountSettings',
85
+ };
86
+
87
+ const navigation = useNavigation();
88
+
89
+ return (
90
+ <ProfileSection
91
+ profile={profile}
92
+ onPress={() => navigation.navigate('EditProfile')}
93
+ />
94
+ );
95
+ }
96
+ ```
97
+
98
+ #### Anonymous Kullanıcı
99
+
100
+ ```typescript
101
+ function ProfileSection() {
102
+ const { user } = useAuth();
103
+
104
+ const profile = {
105
+ displayName: 'Misafir Kullanıcı',
106
+ userId: undefined,
107
+ isAnonymous: true,
108
+ avatarUrl: undefined,
109
+ };
110
+
111
+ const navigation = useNavigation();
112
+
113
+ return (
114
+ <ProfileSection
115
+ profile={profile}
116
+ onSignIn={() => navigation.navigate('Login')}
117
+ signInText="Giriş Yap"
118
+ />
119
+ );
120
+ }
121
+ ```
122
+
123
+ #### Benefits ile
124
+
125
+ ```typescript
126
+ function PremiumProfileSection() {
127
+ const { user } = useAuth();
128
+
129
+ const profile = {
130
+ displayName: user?.displayName,
131
+ userId: user?.uid,
132
+ isAnonymous: false,
133
+ avatarUrl: user?.photoURL,
134
+ benefits: [
135
+ 'Premium içeriklere erişim',
136
+ 'Reklamsız deneyim',
137
+ 'Özel indirimler',
138
+ ],
139
+ };
140
+
141
+ return <ProfileSection profile={profile} />;
142
+ }
143
+ ```
144
+
145
+ #### Dynamic Profile
146
+
147
+ ```typescript
148
+ function DynamicProfileSection() {
149
+ const { user } = useAuth();
150
+ const navigation = useNavigation();
151
+ const profile = useUserProfile();
152
+
153
+ const handlePress = () => {
154
+ if (profile?.isAnonymous) {
155
+ navigation.navigate('Login');
156
+ } else {
157
+ navigation.navigate('EditProfile');
158
+ }
159
+ };
160
+
161
+ return (
162
+ <ProfileSection
163
+ profile={{
164
+ displayName: profile?.displayName,
165
+ userId: profile?.userId,
166
+ isAnonymous: profile?.isAnonymous || false,
167
+ avatarUrl: profile?.avatarUrl,
168
+ benefits: profile?.isAnonymous
169
+ ? ['Hesap oluşturarak daha fazla özelliğe erişin']
170
+ : ['Premium üyelik alın', 'Ayrıcalıklı içeriklere erişin'],
171
+ }}
172
+ onPress={handlePress}
173
+ />
174
+ );
175
+ }
176
+ ```
177
+
178
+ ---
179
+
180
+ ## AccountActions
181
+
182
+ Hesap yönetimi işlemlerini içeren component. Çıkış yapma, şifre değiştirme ve hesap silme butonlarını sağlar.
183
+
184
+ ### Kullanım
185
+
186
+ ```typescript
187
+ import { AccountActions } from '@umituz/react-native-auth';
188
+
189
+ function AccountSettingsScreen() {
190
+ const { logout, deleteAccount } = useAccountManagement();
191
+ const navigation = useNavigation();
192
+
193
+ const config = {
194
+ logoutText: 'Çıkış Yap',
195
+ deleteAccountText: 'Hesabı Sil',
196
+ changePasswordText: 'Şifre Değiştir',
197
+ logoutConfirmTitle: 'Çıkış Yap',
198
+ logoutConfirmMessage: 'Çıkış yapmak istediğinizden emin misiniz?',
199
+ deleteConfirmTitle: 'Hesabı Sil',
200
+ deleteConfirmMessage: 'Bu işlem geri alınamaz. Devam etmek istiyor musunuz?',
201
+ deleteErrorTitle: 'Hata',
202
+ deleteErrorMessage: 'Hesap silinemedi. Lütfen tekrar deneyin.',
203
+ onLogout: async () => {
204
+ await logout();
205
+ navigation.replace('Login');
206
+ },
207
+ onDeleteAccount: async () => {
208
+ await deleteAccount();
209
+ navigation.replace('Login');
210
+ },
211
+ showChangePassword: true,
212
+ onChangePassword: () => {
213
+ navigation.navigate('ChangePassword');
214
+ },
215
+ };
216
+
217
+ return (
218
+ <View>
219
+ <AccountActions config={config} />
220
+ </View>
221
+ );
222
+ }
223
+ ```
224
+
225
+ ### Props
226
+
227
+ | Prop | Tip | Required | Açıklama |
228
+ |------|-----|----------|----------|
229
+ | `config` | `AccountActionsConfig` | Yes | Hesap işlemleri konfigürasyonu |
230
+
231
+ #### AccountActionsConfig
232
+
233
+ ```typescript
234
+ interface AccountActionsConfig {
235
+ logoutText: string; // "Çıkış Yap" butonu metni
236
+ deleteAccountText: string; // "Hesabı Sil" butonu metni
237
+ changePasswordText?: string; // "Şifre Değiştir" butonu metni
238
+ logoutConfirmTitle: string; // Çıkış onay başlığı
239
+ logoutConfirmMessage: string; // Çıkış onay mesajı
240
+ deleteConfirmTitle: string; // Silme onay başlığı
241
+ deleteConfirmMessage: string; // Silme onay mesajı
242
+ deleteErrorTitle?: string; // Silme hata başlığı
243
+ deleteErrorMessage?: string; // Silme hata mesajı
244
+ onLogout: () => Promise<void>; // Çıkış handler
245
+ onDeleteAccount: () => Promise<void>; // Silme handler
246
+ onChangePassword?: () => void; // Şifre değiştirme handler
247
+ showChangePassword?: boolean; // Şifre değiştirme butonu göster
248
+ }
249
+ ```
250
+
251
+ ### Örnekler
252
+
253
+ #### Basit Kullanım
254
+
255
+ ```typescript
256
+ function SimpleAccountActions() {
257
+ const { logout, deleteAccount } = useAccountManagement();
258
+
259
+ const config = {
260
+ logoutText: 'Çıkış Yap',
261
+ deleteAccountText: 'Hesabı Sil',
262
+ logoutConfirmTitle: 'Çıkış Yap',
263
+ logoutConfirmMessage: 'Çıkış yapmak istiyor musunuz?',
264
+ deleteConfirmTitle: 'Hesabı Sil',
265
+ deleteConfirmMessage: 'Hesabınızı silmek istediğinizden emin misiniz?',
266
+ onLogout: logout,
267
+ onDeleteAccount: deleteAccount,
268
+ };
269
+
270
+ return <AccountActions config={config} />;
271
+ }
272
+ ```
273
+
274
+ #### Şifre Değiştirme ile
275
+
276
+ ```typescript
277
+ function AccountActionsWithPasswordChange() {
278
+ const { logout, deleteAccount } = useAccountManagement();
279
+ const navigation = useNavigation();
280
+
281
+ const config = {
282
+ logoutText: 'Çıkış Yap',
283
+ deleteAccountText: 'Hesabı Sil',
284
+ changePasswordText: 'Şifre Değiştir',
285
+ logoutConfirmTitle: 'Çıkış Yap',
286
+ logoutConfirmMessage: 'Çıkış yapmak istiyor musunuz?',
287
+ deleteConfirmTitle: 'Hesabı Sil',
288
+ deleteConfirmMessage: 'Hesabınızı silmek istediğinizden emin misiniz?',
289
+ onLogout: async () => {
290
+ await logout();
291
+ navigation.replace('Login');
292
+ },
293
+ onDeleteAccount: async () => {
294
+ await deleteAccount();
295
+ navigation.replace('Login');
296
+ },
297
+ showChangePassword: true,
298
+ onChangePassword: () => {
299
+ navigation.navigate('ChangePassword');
300
+ },
301
+ };
302
+
303
+ return <AccountActions config={config} />;
304
+ }
305
+ ```
306
+
307
+ #### Custom Error Handling
308
+
309
+ ```typescript
310
+ function AccountActionsWithErrorHandling() {
311
+ const { logout, deleteAccount } = useAccountManagement();
312
+ const navigation = useNavigation();
313
+
314
+ const config = {
315
+ logoutText: 'Çıkış Yap',
316
+ deleteAccountText: 'Hesabı Sil',
317
+ logoutConfirmTitle: 'Çıkış Yap',
318
+ logoutConfirmMessage: 'Çıkış yapmak istiyor musunuz?',
319
+ deleteConfirmTitle: 'Hesabı Sil',
320
+ deleteConfirmMessage: 'Bu işlem geri alınamaz. Emin misiniz?',
321
+ deleteErrorTitle: 'Hesap Silinemedi',
322
+ deleteErrorMessage: 'Hesabınız silinirken bir hata oluştu. Lütfen daha sonra tekrar deneyin veya destek ile iletişime geçin.',
323
+ onLogout: async () => {
324
+ try {
325
+ await logout();
326
+ navigation.replace('Login');
327
+ } catch (error) {
328
+ Alert.alert('Hata', 'Çıkış yapılamadı');
329
+ }
330
+ },
331
+ onDeleteAccount: async () => {
332
+ try {
333
+ await deleteAccount();
334
+ Alert.alert('Başarılı', 'Hesabınız silindi');
335
+ navigation.replace('Login');
336
+ } catch (error) {
337
+ // Hata otomatik olarak gösterilir (deleteErrorMessage)
338
+ throw error;
339
+ }
340
+ },
341
+ };
342
+
343
+ return <AccountActions config={config} />;
344
+ }
345
+ ```
346
+
347
+ #### Anonymous Kullanıcı İçin
348
+
349
+ ```typescript
350
+ function AccountActionsAnonymous() {
351
+ const { isAnonymous } = useAuth();
352
+
353
+ if (isAnonymous) {
354
+ return (
355
+ <Button onPress={() => navigation.navigate('Register')}>
356
+ Hesap Oluştur
357
+ </Button>
358
+ );
359
+ }
360
+
361
+ const config = {
362
+ logoutText: 'Çıkış Yap',
363
+ deleteAccountText: 'Hesabı Sil',
364
+ logoutConfirmTitle: 'Çıkış Yap',
365
+ logoutConfirmMessage: 'Çıkış yapmak istiyor musunuz?',
366
+ deleteConfirmTitle: 'Hesabı Sil',
367
+ deleteConfirmMessage: 'Hesabınızı silmek istediğinizden emin misiniz?',
368
+ onLogout: logout,
369
+ onDeleteAccount: deleteAccount,
370
+ };
371
+
372
+ return <AccountActions config={config} />;
373
+ }
374
+ ```
375
+
376
+ ## Birlikte Kullanım
377
+
378
+ ```typescript
379
+ function AccountSettingsScreen() {
380
+ const profile = useUserProfile();
381
+ const { logout, deleteAccount } = useAccountManagement();
382
+ const navigation = useNavigation();
383
+
384
+ return (
385
+ <ScrollView>
386
+ {/* Profil bölümü */}
387
+ <ProfileSection
388
+ profile={{
389
+ displayName: profile?.displayName,
390
+ userId: profile?.userId,
391
+ isAnonymous: profile?.isAnonymous || false,
392
+ avatarUrl: profile?.avatarUrl,
393
+ }}
394
+ onPress={() => navigation.navigate('EditProfile')}
395
+ />
396
+
397
+ {/* Hesap işlemleri */}
398
+ {!profile?.isAnonymous && (
399
+ <AccountActions
400
+ config={{
401
+ logoutText: 'Çıkış Yap',
402
+ deleteAccountText: 'Hesabı Sil',
403
+ logoutConfirmTitle: 'Çıkış Yap',
404
+ logoutConfirmMessage: 'Çıkış yapmak istiyor musunuz?',
405
+ deleteConfirmTitle: 'Hesabı Sil',
406
+ deleteConfirmMessage: 'Bu işlem geri alınamaz. Emin misiniz?',
407
+ onLogout: async () => {
408
+ await logout();
409
+ navigation.replace('Login');
410
+ },
411
+ onDeleteAccount: async () => {
412
+ await deleteAccount();
413
+ navigation.replace('Login');
414
+ },
415
+ }}
416
+ />
417
+ )}
418
+ </ScrollView>
419
+ );
420
+ }
421
+ ```
422
+
423
+ ## İlgili Component'ler
424
+
425
+ - [`EditProfileForm`](./EditProfileForm.md) - Profil düzenleme formu
426
+ - [`EditProfileAvatar`](./EditProfileAvatar.md) - Profil fotoğrafı düzenleme
427
+
428
+ ## İlgili Hook'lar
429
+
430
+ - [`useUserProfile`](../hooks/useUserProfile.md) - Profil verileri hook'u
431
+ - [`useAccountManagement`](../hooks/useAccountManagement.md) - Hesap yönetimi hook'u
432
+ - [`useAuth`](../hooks/useAuth.md) - Ana auth state yönetimi
@@ -0,0 +1,117 @@
1
+ # Auth Components
2
+
3
+ React Native Auth paketi için UI component'leri koleksiyonu. Bu component'ler authentication ekranları ve formları için kullanılır.
4
+
5
+ ## Mevcut Component'ler
6
+
7
+ ### Layout & Container Components
8
+ - **[`AuthContainer`](./AuthContainer.tsx)** - Ana auth layout container
9
+ - **[`AuthHeader`](./AuthHeader.tsx)** - Auth ekranları için header
10
+ - **[`AuthFormCard`](./AuthFormCard.tsx)** - Form kartı container
11
+
12
+ ### Form Components
13
+ - **[`LoginForm`](./LoginForm.tsx)** - Giriş formu
14
+ - **[`RegisterForm`](./RegisterForm.tsx)** - Kayıt formu
15
+ - **[`EditProfileForm`](./EditProfileForm.tsx)** - Profil düzenleme formu
16
+ - **[`EditProfileAvatar`](./EditProfileAvatar.tsx)** - Profil fotoğrafı düzenleme
17
+
18
+ ### Password Indicators
19
+ - **[`PasswordStrengthIndicator`](./PasswordStrengthIndicator.tsx)** - Şifre güç göstergesi
20
+ - **[`PasswordMatchIndicator`](./PasswordMatchIndicator.tsx)** - Şifre eşleşme göstergesi
21
+
22
+ ### Social Login Components
23
+ - **[`SocialLoginButtons`](./SocialLoginButtons.tsx)** - Social login button'ları
24
+ - **[`AuthBottomSheet`](./AuthBottomSheet.tsx)** - Bottom sheet auth modal
25
+
26
+ ### Profile & Account Components
27
+ - **[`ProfileSection`](./ProfileSection.tsx)** - Profil bölümü
28
+ - **[`AccountActions`](./AccountActions.tsx)** - Hesap işlemleri
29
+ - **[`EditProfileActions`](./EditProfileActions.tsx)** - Profil düzenleme işlemleri
30
+
31
+ ### UI Helper Components
32
+ - **[`AuthLegalLinks`](./AuthLegalLinks.tsx)** - KVKK/Kullanım şartları linkleri
33
+ - **[`AuthDivider`](./AuthDivider.tsx)** - Ayırıcı çizgi
34
+ - **[`AuthLink`](./AuthLink.tsx)** - Navigasyon link'i
35
+ - **[`AuthErrorDisplay`](./AuthErrorDisplay.tsx)** - Hata gösterme
36
+ - **[`AuthBackground`](./AuthBackground.tsx)** - Standart arkaplan
37
+
38
+ ### Icons
39
+ - **[`GoogleIconSvg`](./icons/GoogleIconSvg.tsx)** - Google ikonu
40
+ - **[`AppleIconSvg`](./icons/AppleIconSvg.tsx)** - Apple ikonu
41
+
42
+ ## Kullanım
43
+
44
+ ```typescript
45
+ import {
46
+ AuthContainer,
47
+ AuthHeader,
48
+ LoginForm,
49
+ SocialLoginButtons,
50
+ PasswordStrengthIndicator,
51
+ } from '@umituz/react-native-auth';
52
+
53
+ function LoginScreen() {
54
+ return (
55
+ <AuthContainer>
56
+ <AuthHeader title="Giriş Yap" />
57
+ <LoginForm />
58
+ <SocialLoginButtons />
59
+ <AuthLegalLinks />
60
+ </AuthContainer>
61
+ );
62
+ }
63
+ ```
64
+
65
+ ## Component Detaylı Dokümantasyon
66
+
67
+ Her component hakkında detaylı bilgi için ilgili component'in içindeki README.md dosyasına bakın.
68
+
69
+ ## Tasarım Prensipleri
70
+
71
+ 1. **Reusable**: Component'ler farklı context'lerde kullanılabilir
72
+ 2. **Composable**: Küçük component'ler bir araya getirilerek büyük ekranlar oluşturulur
73
+ 3. **Type-Safe**: Tüm component'ler TypeScript ile yazılmıştır
74
+ 4. **Accessible**: Erişilebilirlik standartlarına uygun
75
+ 5. **Themeable**: Design system ile uyumlu
76
+
77
+ ## Konfigürasyon
78
+
79
+ ### Theme
80
+
81
+ Component'ler design system theme'ini kullanır:
82
+
83
+ ```typescript
84
+ import { ThemeProvider } from '@umituz/react-native-design-system-theme';
85
+
86
+ function App() {
87
+ return (
88
+ <ThemeProvider theme={yourTheme}>
89
+ <AuthContainer>
90
+ {/* Auth components */}
91
+ </AuthContainer>
92
+ </ThemeProvider>
93
+ );
94
+ }
95
+ ```
96
+
97
+ ### Localization
98
+
99
+ ```typescript
100
+ import { LocalizationProvider } from '@umituz/react-native-localization';
101
+
102
+ function App() {
103
+ return (
104
+ <LocalizationProvider locale="tr">
105
+ <AuthContainer>
106
+ {/* Auth components will use Turkish */}
107
+ </AuthContainer>
108
+ </LocalizationProvider>
109
+ );
110
+ }
111
+ ```
112
+
113
+ ## İlgili Modüller
114
+
115
+ - **[Hooks](../hooks/README.md)** - Auth hook'ları
116
+ - **[Screens](../screens/)** - Auth ekranları
117
+ - **[Navigation](../navigation/)** - Auth navigasyonu