@umituz/react-native-auth 3.4.31 → 3.4.32

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.
@@ -1,19 +1,19 @@
1
1
  # Profile Components
2
2
 
3
- Kullanıcı profili ve hesap yönetimi için component'ler.
3
+ Components for user profile display and account management.
4
4
 
5
- ## Component'ler
5
+ ## Components
6
6
 
7
- - **[`ProfileSection`](#profilesection)** - Profil bölümü
8
- - **[`AccountActions`](#accountactions)** - Hesap işlemleri
7
+ - **[`ProfileSection`](#profilesection)** - Profile display section
8
+ - **[`AccountActions`](#accountactions)** - Account management actions
9
9
 
10
10
  ---
11
11
 
12
12
  ## ProfileSection
13
13
 
14
- Kullanıcı profil bilgilerini gösteren component. Avatar, isim ve kullanıcı ID'si içerir.
14
+ Component that displays user profile information including avatar, name, and user ID.
15
15
 
16
- ### Kullanım
16
+ ### Usage
17
17
 
18
18
  ```typescript
19
19
  import { ProfileSection } from '@umituz/react-native-auth';
@@ -37,8 +37,8 @@ function SettingsScreen() {
37
37
  }}
38
38
  onPress={() => navigation.navigate('EditProfile')}
39
39
  onSignIn={() => navigation.navigate('Login')}
40
- signInText="Giriş Yap"
41
- anonymousText="Misafir"
40
+ signInText="Sign In"
41
+ anonymousText="Guest"
42
42
  />
43
43
  </View>
44
44
  );
@@ -47,30 +47,30 @@ function SettingsScreen() {
47
47
 
48
48
  ### Props
49
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 |
50
+ | Prop | Type | Required | Description |
51
+ |------|------|----------|-------------|
52
+ | `profile` | `ProfileSectionConfig` | Yes | Profile configuration |
53
+ | `onPress` | `() => void` | No | Press handler (for authenticated users) |
54
+ | `onSignIn` | `() => void` | No | Sign-in handler (for anonymous users) |
55
+ | `signInText` | `string` | No | "Sign In" button text |
56
+ | `anonymousText` | `string` | No | Anonymous user label |
57
57
 
58
58
  #### ProfileSectionConfig
59
59
 
60
60
  ```typescript
61
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
62
+ displayName?: string; // Display name
63
+ userId?: string; // User ID
64
+ isAnonymous: boolean; // Is anonymous user
65
+ avatarUrl?: string; // Profile photo URL
66
+ accountSettingsRoute?: string; // Account settings route
67
+ benefits?: string[]; // Benefits list
68
68
  }
69
69
  ```
70
70
 
71
- ### Örnekler
71
+ ### Examples
72
72
 
73
- #### Authenticated Kullanıcı
73
+ #### Authenticated User
74
74
 
75
75
  ```typescript
76
76
  function ProfileSection() {
@@ -95,14 +95,14 @@ function ProfileSection() {
95
95
  }
96
96
  ```
97
97
 
98
- #### Anonymous Kullanıcı
98
+ #### Anonymous User
99
99
 
100
100
  ```typescript
101
101
  function ProfileSection() {
102
102
  const { user } = useAuth();
103
103
 
104
104
  const profile = {
105
- displayName: 'Misafir Kullanıcı',
105
+ displayName: 'Guest User',
106
106
  userId: undefined,
107
107
  isAnonymous: true,
108
108
  avatarUrl: undefined,
@@ -114,13 +114,13 @@ function ProfileSection() {
114
114
  <ProfileSection
115
115
  profile={profile}
116
116
  onSignIn={() => navigation.navigate('Login')}
117
- signInText="Giriş Yap"
117
+ signInText="Sign In"
118
118
  />
119
119
  );
120
120
  }
121
121
  ```
122
122
 
123
- #### Benefits ile
123
+ #### With Benefits
124
124
 
125
125
  ```typescript
126
126
  function PremiumProfileSection() {
@@ -132,9 +132,9 @@ function PremiumProfileSection() {
132
132
  isAnonymous: false,
133
133
  avatarUrl: user?.photoURL,
134
134
  benefits: [
135
- 'Premium içeriklere erişim',
136
- 'Reklamsız deneyim',
137
- 'Özel indirimler',
135
+ 'Access to premium content',
136
+ 'Ad-free experience',
137
+ 'Exclusive discounts',
138
138
  ],
139
139
  };
140
140
 
@@ -166,8 +166,8 @@ function DynamicProfileSection() {
166
166
  isAnonymous: profile?.isAnonymous || false,
167
167
  avatarUrl: profile?.avatarUrl,
168
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'],
169
+ ? ['Create an account to access more features']
170
+ : ['Get premium membership', 'Access exclusive content'],
171
171
  }}
172
172
  onPress={handlePress}
173
173
  />
@@ -175,13 +175,67 @@ function DynamicProfileSection() {
175
175
  }
176
176
  ```
177
177
 
178
+ #### With Custom Avatar
179
+
180
+ ```typescript
181
+ function ProfileSectionWithCustomAvatar() {
182
+ const { user } = useAuth();
183
+ const navigation = useNavigation();
184
+
185
+ const profile = {
186
+ displayName: user?.displayName || 'User',
187
+ userId: user?.uid,
188
+ isAnonymous: user?.isAnonymous || false,
189
+ avatarUrl: user?.photoURL || 'https://example.com/default-avatar.png',
190
+ accountSettingsRoute: 'AccountSettings',
191
+ };
192
+
193
+ return (
194
+ <ProfileSection
195
+ profile={profile}
196
+ onPress={() => navigation.navigate('EditProfile')}
197
+ />
198
+ );
199
+ }
200
+ ```
201
+
202
+ #### With Edit Indicator
203
+
204
+ ```typescript
205
+ function ProfileSectionWithEditIndicator() {
206
+ const profile = useUserProfile();
207
+ const navigation = useNavigation();
208
+
209
+ return (
210
+ <View>
211
+ <ProfileSection
212
+ profile={{
213
+ displayName: profile?.displayName,
214
+ userId: profile?.userId,
215
+ isAnonymous: profile?.isAnonymous || false,
216
+ avatarUrl: profile?.avatarUrl,
217
+ accountSettingsRoute: 'AccountSettings',
218
+ }}
219
+ onPress={() => navigation.navigate('EditProfile')}
220
+ />
221
+ <TouchableOpacity
222
+ style={styles.editButton}
223
+ onPress={() => navigation.navigate('EditProfile')}
224
+ >
225
+ <Text>Edit Profile</Text>
226
+ </TouchableOpacity>
227
+ </View>
228
+ );
229
+ }
230
+ ```
231
+
178
232
  ---
179
233
 
180
234
  ## AccountActions
181
235
 
182
- Hesap yönetimi işlemlerini içeren component. Çıkış yapma, şifre değiştirme ve hesap silme butonlarını sağlar.
236
+ Component for account management operations including sign out, password change, and account deletion.
183
237
 
184
- ### Kullanım
238
+ ### Usage
185
239
 
186
240
  ```typescript
187
241
  import { AccountActions } from '@umituz/react-native-auth';
@@ -191,15 +245,15 @@ function AccountSettingsScreen() {
191
245
  const navigation = useNavigation();
192
246
 
193
247
  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.',
248
+ logoutText: 'Sign Out',
249
+ deleteAccountText: 'Delete Account',
250
+ changePasswordText: 'Change Password',
251
+ logoutConfirmTitle: 'Sign Out',
252
+ logoutConfirmMessage: 'Are you sure you want to sign out?',
253
+ deleteConfirmTitle: 'Delete Account',
254
+ deleteConfirmMessage: 'This action cannot be undone. Continue?',
255
+ deleteErrorTitle: 'Error',
256
+ deleteErrorMessage: 'Account could not be deleted. Please try again.',
203
257
  onLogout: async () => {
204
258
  await logout();
205
259
  navigation.replace('Login');
@@ -224,45 +278,45 @@ function AccountSettingsScreen() {
224
278
 
225
279
  ### Props
226
280
 
227
- | Prop | Tip | Required | Açıklama |
228
- |------|-----|----------|----------|
229
- | `config` | `AccountActionsConfig` | Yes | Hesap işlemleri konfigürasyonu |
281
+ | Prop | Type | Required | Description |
282
+ |------|------|----------|-------------|
283
+ | `config` | `AccountActionsConfig` | Yes | Account actions configuration |
230
284
 
231
285
  #### AccountActionsConfig
232
286
 
233
287
  ```typescript
234
288
  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
289
+ logoutText: string; // "Sign Out" button text
290
+ deleteAccountText: string; // "Delete Account" button text
291
+ changePasswordText?: string; // "Change Password" button text
292
+ logoutConfirmTitle: string; // Sign out confirmation title
293
+ logoutConfirmMessage: string; // Sign out confirmation message
294
+ deleteConfirmTitle: string; // Delete confirmation title
295
+ deleteConfirmMessage: string; // Delete confirmation message
296
+ deleteErrorTitle?: string; // Delete error title
297
+ deleteErrorMessage?: string; // Delete error message
298
+ onLogout: () => Promise<void>; // Sign out handler
299
+ onDeleteAccount: () => Promise<void>; // Delete handler
300
+ onChangePassword?: () => void; // Change password handler
301
+ showChangePassword?: boolean; // Show change password button
248
302
  }
249
303
  ```
250
304
 
251
- ### Örnekler
305
+ ### Examples
252
306
 
253
- #### Basit Kullanım
307
+ #### Basic Usage
254
308
 
255
309
  ```typescript
256
310
  function SimpleAccountActions() {
257
311
  const { logout, deleteAccount } = useAccountManagement();
258
312
 
259
313
  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?',
314
+ logoutText: 'Sign Out',
315
+ deleteAccountText: 'Delete Account',
316
+ logoutConfirmTitle: 'Sign Out',
317
+ logoutConfirmMessage: 'Are you sure you want to sign out?',
318
+ deleteConfirmTitle: 'Delete Account',
319
+ deleteConfirmMessage: 'Are you sure you want to delete your account?',
266
320
  onLogout: logout,
267
321
  onDeleteAccount: deleteAccount,
268
322
  };
@@ -271,7 +325,7 @@ function SimpleAccountActions() {
271
325
  }
272
326
  ```
273
327
 
274
- #### Şifre Değiştirme ile
328
+ #### With Password Change
275
329
 
276
330
  ```typescript
277
331
  function AccountActionsWithPasswordChange() {
@@ -279,13 +333,13 @@ function AccountActionsWithPasswordChange() {
279
333
  const navigation = useNavigation();
280
334
 
281
335
  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?',
336
+ logoutText: 'Sign Out',
337
+ deleteAccountText: 'Delete Account',
338
+ changePasswordText: 'Change Password',
339
+ logoutConfirmTitle: 'Sign Out',
340
+ logoutConfirmMessage: 'Are you sure you want to sign out?',
341
+ deleteConfirmTitle: 'Delete Account',
342
+ deleteConfirmMessage: 'Are you sure you want to delete your account?',
289
343
  onLogout: async () => {
290
344
  await logout();
291
345
  navigation.replace('Login');
@@ -304,7 +358,7 @@ function AccountActionsWithPasswordChange() {
304
358
  }
305
359
  ```
306
360
 
307
- #### Custom Error Handling
361
+ #### With Custom Error Handling
308
362
 
309
363
  ```typescript
310
364
  function AccountActionsWithErrorHandling() {
@@ -312,29 +366,29 @@ function AccountActionsWithErrorHandling() {
312
366
  const navigation = useNavigation();
313
367
 
314
368
  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.',
369
+ logoutText: 'Sign Out',
370
+ deleteAccountText: 'Delete Account',
371
+ logoutConfirmTitle: 'Sign Out',
372
+ logoutConfirmMessage: 'Are you sure you want to sign out?',
373
+ deleteConfirmTitle: 'Delete Account',
374
+ deleteConfirmMessage: 'This action cannot be undone. Continue?',
375
+ deleteErrorTitle: 'Account Deletion Failed',
376
+ deleteErrorMessage: 'An error occurred while deleting your account. Please try again later or contact support.',
323
377
  onLogout: async () => {
324
378
  try {
325
379
  await logout();
326
380
  navigation.replace('Login');
327
381
  } catch (error) {
328
- Alert.alert('Hata', 'Çıkış yapılamadı');
382
+ Alert.alert('Error', 'Failed to sign out');
329
383
  }
330
384
  },
331
385
  onDeleteAccount: async () => {
332
386
  try {
333
387
  await deleteAccount();
334
- Alert.alert('Başarılı', 'Hesabınız silindi');
388
+ Alert.alert('Success', 'Your account has been deleted');
335
389
  navigation.replace('Login');
336
390
  } catch (error) {
337
- // Hata otomatik olarak gösterilir (deleteErrorMessage)
391
+ // Error is automatically shown (deleteErrorMessage)
338
392
  throw error;
339
393
  }
340
394
  },
@@ -344,7 +398,7 @@ function AccountActionsWithErrorHandling() {
344
398
  }
345
399
  ```
346
400
 
347
- #### Anonymous Kullanıcı İçin
401
+ #### For Anonymous Users
348
402
 
349
403
  ```typescript
350
404
  function AccountActionsAnonymous() {
@@ -353,18 +407,18 @@ function AccountActionsAnonymous() {
353
407
  if (isAnonymous) {
354
408
  return (
355
409
  <Button onPress={() => navigation.navigate('Register')}>
356
- Hesap Oluştur
410
+ Create Account
357
411
  </Button>
358
412
  );
359
413
  }
360
414
 
361
415
  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?',
416
+ logoutText: 'Sign Out',
417
+ deleteAccountText: 'Delete Account',
418
+ logoutConfirmTitle: 'Sign Out',
419
+ logoutConfirmMessage: 'Are you sure you want to sign out?',
420
+ deleteConfirmTitle: 'Delete Account',
421
+ deleteConfirmMessage: 'Are you sure you want to delete your account?',
368
422
  onLogout: logout,
369
423
  onDeleteAccount: deleteAccount,
370
424
  };
@@ -373,7 +427,70 @@ function AccountActionsAnonymous() {
373
427
  }
374
428
  ```
375
429
 
376
- ## Birlikte Kullanım
430
+ #### With Loading States
431
+
432
+ ```typescript
433
+ function AccountActionsWithLoading() {
434
+ const { logout, deleteAccount, isLoading, isDeletingAccount } = useAccountManagement();
435
+ const navigation = useNavigation();
436
+
437
+ const config = {
438
+ logoutText: isLoading ? 'Signing out...' : 'Sign Out',
439
+ deleteAccountText: isDeletingAccount ? 'Deleting...' : 'Delete Account',
440
+ logoutConfirmTitle: 'Sign Out',
441
+ logoutConfirmMessage: 'Are you sure?',
442
+ deleteConfirmTitle: 'Delete Account',
443
+ deleteConfirmMessage: 'This cannot be undone. Continue?',
444
+ onLogout: async () => {
445
+ await logout();
446
+ navigation.replace('Login');
447
+ },
448
+ onDeleteAccount: async () => {
449
+ await deleteAccount();
450
+ navigation.replace('Login');
451
+ },
452
+ };
453
+
454
+ return (
455
+ <AccountActions
456
+ config={config}
457
+ isLoading={isLoading}
458
+ isDeletingAccount={isDeletingAccount}
459
+ />
460
+ );
461
+ }
462
+ ```
463
+
464
+ #### With Analytics
465
+
466
+ ```typescript
467
+ function AccountActionsWithAnalytics() {
468
+ const { logout, deleteAccount } = useAccountManagement();
469
+ const analytics = useAnalytics();
470
+
471
+ const config = {
472
+ logoutText: 'Sign Out',
473
+ deleteAccountText: 'Delete Account',
474
+ logoutConfirmTitle: 'Sign Out',
475
+ logoutConfirmMessage: 'Are you sure?',
476
+ deleteConfirmTitle: 'Delete Account',
477
+ deleteConfirmMessage: 'This cannot be undone.',
478
+ onLogout: async () => {
479
+ analytics.trackEvent('account_logout');
480
+ await logout();
481
+ },
482
+ onDeleteAccount: async () => {
483
+ analytics.trackEvent('account_delete_initiated');
484
+ await deleteAccount();
485
+ analytics.trackEvent('account_delete_completed');
486
+ },
487
+ };
488
+
489
+ return <AccountActions config={config} />;
490
+ }
491
+ ```
492
+
493
+ ## Combined Usage
377
494
 
378
495
  ```typescript
379
496
  function AccountSettingsScreen() {
@@ -383,7 +500,7 @@ function AccountSettingsScreen() {
383
500
 
384
501
  return (
385
502
  <ScrollView>
386
- {/* Profil bölümü */}
503
+ {/* Profile section */}
387
504
  <ProfileSection
388
505
  profile={{
389
506
  displayName: profile?.displayName,
@@ -394,16 +511,16 @@ function AccountSettingsScreen() {
394
511
  onPress={() => navigation.navigate('EditProfile')}
395
512
  />
396
513
 
397
- {/* Hesap işlemleri */}
514
+ {/* Account actions */}
398
515
  {!profile?.isAnonymous && (
399
516
  <AccountActions
400
517
  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?',
518
+ logoutText: 'Sign Out',
519
+ deleteAccountText: 'Delete Account',
520
+ logoutConfirmTitle: 'Sign Out',
521
+ logoutConfirmMessage: 'Are you sure you want to sign out?',
522
+ deleteConfirmTitle: 'Delete Account',
523
+ deleteConfirmMessage: 'This action cannot be undone. Continue?',
407
524
  onLogout: async () => {
408
525
  await logout();
409
526
  navigation.replace('Login');
@@ -420,13 +537,39 @@ function AccountSettingsScreen() {
420
537
  }
421
538
  ```
422
539
 
423
- ## İlgili Component'ler
540
+ ## Styling
541
+
542
+ Components use design system tokens:
543
+
544
+ ```typescript
545
+ {
546
+ colors: {
547
+ primary: tokens.colors.primary,
548
+ danger: tokens.colors.error,
549
+ text: tokens.colors.textPrimary,
550
+ background: tokens.colors.background,
551
+ },
552
+ spacing: tokens.spacing,
553
+ }
554
+ ```
555
+
556
+ ## Accessibility
557
+
558
+ Components include accessibility features:
559
+
560
+ - ✅ Screen reader labels
561
+ - ✅ Accessibility hints
562
+ - ✅ Proper touch targets
563
+ - ✅ High contrast support
564
+ - ✅ Semantic button labels
565
+
566
+ ## Related Components
424
567
 
425
- - [`EditProfileForm`](./EditProfileForm.md) - Profil düzenleme formu
426
- - [`EditProfileAvatar`](./EditProfileAvatar.md) - Profil fotoğrafı düzenleme
568
+ - [`EditProfileForm`](./README.md) - Profile editing form
569
+ - [`EditProfileAvatar`](./README.md) - Profile photo editing
427
570
 
428
- ## İlgili Hook'lar
571
+ ## Related Hooks
429
572
 
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
573
+ - [`useUserProfile`](../hooks/useUserProfile.md) - Profile data hook
574
+ - [`useAccountManagement`](../hooks/useAccountManagement.md) - Account management hook
575
+ - [`useAuth`](../hooks/useAuth.md) - Main auth state management