@umituz/react-native-auth 3.4.30 → 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.
- 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 +222 -0
- package/src/presentation/components/PasswordIndicators.md +260 -0
- package/src/presentation/components/ProfileComponents.md +575 -0
- package/src/presentation/components/README.md +117 -0
- package/src/presentation/components/SocialLoginButtons.md +340 -0
- package/src/presentation/hooks/README.md +122 -0
- package/src/presentation/hooks/useAccountManagement.md +386 -0
- package/src/presentation/hooks/useAuth.md +255 -0
- package/src/presentation/hooks/useAuthBottomSheet.md +414 -0
- package/src/presentation/hooks/useAuthRequired.md +248 -0
- package/src/presentation/hooks/useProfileUpdate.md +327 -0
- package/src/presentation/hooks/useSocialLogin.md +356 -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,575 @@
|
|
|
1
|
+
# Profile Components
|
|
2
|
+
|
|
3
|
+
Components for user profile display and account management.
|
|
4
|
+
|
|
5
|
+
## Components
|
|
6
|
+
|
|
7
|
+
- **[`ProfileSection`](#profilesection)** - Profile display section
|
|
8
|
+
- **[`AccountActions`](#accountactions)** - Account management actions
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## ProfileSection
|
|
13
|
+
|
|
14
|
+
Component that displays user profile information including avatar, name, and user ID.
|
|
15
|
+
|
|
16
|
+
### Usage
|
|
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="Sign In"
|
|
41
|
+
anonymousText="Guest"
|
|
42
|
+
/>
|
|
43
|
+
</View>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Props
|
|
49
|
+
|
|
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
|
+
|
|
58
|
+
#### ProfileSectionConfig
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
interface ProfileSectionConfig {
|
|
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
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Examples
|
|
72
|
+
|
|
73
|
+
#### Authenticated User
|
|
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 User
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
function ProfileSection() {
|
|
102
|
+
const { user } = useAuth();
|
|
103
|
+
|
|
104
|
+
const profile = {
|
|
105
|
+
displayName: 'Guest User',
|
|
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="Sign In"
|
|
118
|
+
/>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### With Benefits
|
|
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
|
+
'Access to premium content',
|
|
136
|
+
'Ad-free experience',
|
|
137
|
+
'Exclusive discounts',
|
|
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
|
+
? ['Create an account to access more features']
|
|
170
|
+
: ['Get premium membership', 'Access exclusive content'],
|
|
171
|
+
}}
|
|
172
|
+
onPress={handlePress}
|
|
173
|
+
/>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
```
|
|
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
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## AccountActions
|
|
235
|
+
|
|
236
|
+
Component for account management operations including sign out, password change, and account deletion.
|
|
237
|
+
|
|
238
|
+
### Usage
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
import { AccountActions } from '@umituz/react-native-auth';
|
|
242
|
+
|
|
243
|
+
function AccountSettingsScreen() {
|
|
244
|
+
const { logout, deleteAccount } = useAccountManagement();
|
|
245
|
+
const navigation = useNavigation();
|
|
246
|
+
|
|
247
|
+
const config = {
|
|
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.',
|
|
257
|
+
onLogout: async () => {
|
|
258
|
+
await logout();
|
|
259
|
+
navigation.replace('Login');
|
|
260
|
+
},
|
|
261
|
+
onDeleteAccount: async () => {
|
|
262
|
+
await deleteAccount();
|
|
263
|
+
navigation.replace('Login');
|
|
264
|
+
},
|
|
265
|
+
showChangePassword: true,
|
|
266
|
+
onChangePassword: () => {
|
|
267
|
+
navigation.navigate('ChangePassword');
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
return (
|
|
272
|
+
<View>
|
|
273
|
+
<AccountActions config={config} />
|
|
274
|
+
</View>
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Props
|
|
280
|
+
|
|
281
|
+
| Prop | Type | Required | Description |
|
|
282
|
+
|------|------|----------|-------------|
|
|
283
|
+
| `config` | `AccountActionsConfig` | Yes | Account actions configuration |
|
|
284
|
+
|
|
285
|
+
#### AccountActionsConfig
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
interface AccountActionsConfig {
|
|
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
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Examples
|
|
306
|
+
|
|
307
|
+
#### Basic Usage
|
|
308
|
+
|
|
309
|
+
```typescript
|
|
310
|
+
function SimpleAccountActions() {
|
|
311
|
+
const { logout, deleteAccount } = useAccountManagement();
|
|
312
|
+
|
|
313
|
+
const config = {
|
|
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?',
|
|
320
|
+
onLogout: logout,
|
|
321
|
+
onDeleteAccount: deleteAccount,
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
return <AccountActions config={config} />;
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
#### With Password Change
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
function AccountActionsWithPasswordChange() {
|
|
332
|
+
const { logout, deleteAccount } = useAccountManagement();
|
|
333
|
+
const navigation = useNavigation();
|
|
334
|
+
|
|
335
|
+
const config = {
|
|
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?',
|
|
343
|
+
onLogout: async () => {
|
|
344
|
+
await logout();
|
|
345
|
+
navigation.replace('Login');
|
|
346
|
+
},
|
|
347
|
+
onDeleteAccount: async () => {
|
|
348
|
+
await deleteAccount();
|
|
349
|
+
navigation.replace('Login');
|
|
350
|
+
},
|
|
351
|
+
showChangePassword: true,
|
|
352
|
+
onChangePassword: () => {
|
|
353
|
+
navigation.navigate('ChangePassword');
|
|
354
|
+
},
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
return <AccountActions config={config} />;
|
|
358
|
+
}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
#### With Custom Error Handling
|
|
362
|
+
|
|
363
|
+
```typescript
|
|
364
|
+
function AccountActionsWithErrorHandling() {
|
|
365
|
+
const { logout, deleteAccount } = useAccountManagement();
|
|
366
|
+
const navigation = useNavigation();
|
|
367
|
+
|
|
368
|
+
const config = {
|
|
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.',
|
|
377
|
+
onLogout: async () => {
|
|
378
|
+
try {
|
|
379
|
+
await logout();
|
|
380
|
+
navigation.replace('Login');
|
|
381
|
+
} catch (error) {
|
|
382
|
+
Alert.alert('Error', 'Failed to sign out');
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
onDeleteAccount: async () => {
|
|
386
|
+
try {
|
|
387
|
+
await deleteAccount();
|
|
388
|
+
Alert.alert('Success', 'Your account has been deleted');
|
|
389
|
+
navigation.replace('Login');
|
|
390
|
+
} catch (error) {
|
|
391
|
+
// Error is automatically shown (deleteErrorMessage)
|
|
392
|
+
throw error;
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
return <AccountActions config={config} />;
|
|
398
|
+
}
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
#### For Anonymous Users
|
|
402
|
+
|
|
403
|
+
```typescript
|
|
404
|
+
function AccountActionsAnonymous() {
|
|
405
|
+
const { isAnonymous } = useAuth();
|
|
406
|
+
|
|
407
|
+
if (isAnonymous) {
|
|
408
|
+
return (
|
|
409
|
+
<Button onPress={() => navigation.navigate('Register')}>
|
|
410
|
+
Create Account
|
|
411
|
+
</Button>
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
const config = {
|
|
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?',
|
|
422
|
+
onLogout: logout,
|
|
423
|
+
onDeleteAccount: deleteAccount,
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
return <AccountActions config={config} />;
|
|
427
|
+
}
|
|
428
|
+
```
|
|
429
|
+
|
|
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
|
|
494
|
+
|
|
495
|
+
```typescript
|
|
496
|
+
function AccountSettingsScreen() {
|
|
497
|
+
const profile = useUserProfile();
|
|
498
|
+
const { logout, deleteAccount } = useAccountManagement();
|
|
499
|
+
const navigation = useNavigation();
|
|
500
|
+
|
|
501
|
+
return (
|
|
502
|
+
<ScrollView>
|
|
503
|
+
{/* Profile section */}
|
|
504
|
+
<ProfileSection
|
|
505
|
+
profile={{
|
|
506
|
+
displayName: profile?.displayName,
|
|
507
|
+
userId: profile?.userId,
|
|
508
|
+
isAnonymous: profile?.isAnonymous || false,
|
|
509
|
+
avatarUrl: profile?.avatarUrl,
|
|
510
|
+
}}
|
|
511
|
+
onPress={() => navigation.navigate('EditProfile')}
|
|
512
|
+
/>
|
|
513
|
+
|
|
514
|
+
{/* Account actions */}
|
|
515
|
+
{!profile?.isAnonymous && (
|
|
516
|
+
<AccountActions
|
|
517
|
+
config={{
|
|
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?',
|
|
524
|
+
onLogout: async () => {
|
|
525
|
+
await logout();
|
|
526
|
+
navigation.replace('Login');
|
|
527
|
+
},
|
|
528
|
+
onDeleteAccount: async () => {
|
|
529
|
+
await deleteAccount();
|
|
530
|
+
navigation.replace('Login');
|
|
531
|
+
},
|
|
532
|
+
}}
|
|
533
|
+
/>
|
|
534
|
+
)}
|
|
535
|
+
</ScrollView>
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
```
|
|
539
|
+
|
|
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
|
|
567
|
+
|
|
568
|
+
- [`EditProfileForm`](./README.md) - Profile editing form
|
|
569
|
+
- [`EditProfileAvatar`](./README.md) - Profile photo editing
|
|
570
|
+
|
|
571
|
+
## Related Hooks
|
|
572
|
+
|
|
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
|
|
@@ -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
|