@oxyhq/services 6.9.43 → 6.9.45
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/lib/commonjs/index.js +9 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/components/ActingAsBanner.js +143 -0
- package/lib/commonjs/ui/components/ActingAsBanner.js.map +1 -0
- package/lib/commonjs/ui/components/OxyPayButton.js +4 -2
- package/lib/commonjs/ui/components/OxyPayButton.js.map +1 -1
- package/lib/commonjs/ui/components/OxySignInButton.js +83 -82
- package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
- package/lib/commonjs/ui/components/SettingRow.js +11 -5
- package/lib/commonjs/ui/components/SettingRow.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js +76 -121
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/UploadPreview.js +32 -18
- package/lib/commonjs/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/commonjs/ui/components/icon/OxyIcon.js +5 -4
- package/lib/commonjs/ui/components/icon/OxyIcon.js.map +1 -1
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js +11 -9
- package/lib/commonjs/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/commonjs/ui/components/internal/PinInput.js +3 -2
- package/lib/commonjs/ui/components/internal/PinInput.js.map +1 -1
- package/lib/commonjs/ui/components/modals/DeleteAccountModal.js +83 -219
- package/lib/commonjs/ui/components/modals/DeleteAccountModal.js.map +1 -1
- package/lib/commonjs/ui/constants/theme.js +2 -2
- package/lib/commonjs/ui/constants/theme.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +78 -3
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/navigation/routes.js +3 -2
- package/lib/commonjs/ui/navigation/routes.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +33 -11
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +70 -79
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +22 -10
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +376 -82
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountVerificationScreen.js +21 -9
- package/lib/commonjs/ui/screens/AccountVerificationScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CreateManagedAccountScreen.js +346 -0
- package/lib/commonjs/ui/screens/CreateManagedAccountScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/FileManagementScreen.js +83 -50
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HistoryViewScreen.js +80 -101
- package/lib/commonjs/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +66 -93
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SessionManagementScreen.js +101 -66
- package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/utils/fileManagement.js +0 -21
- package/lib/commonjs/ui/utils/fileManagement.js.map +1 -1
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/components/ActingAsBanner.js +140 -0
- package/lib/module/ui/components/ActingAsBanner.js.map +1 -0
- package/lib/module/ui/components/OxyPayButton.js +4 -2
- package/lib/module/ui/components/OxyPayButton.js.map +1 -1
- package/lib/module/ui/components/OxySignInButton.js +84 -83
- package/lib/module/ui/components/OxySignInButton.js.map +1 -1
- package/lib/module/ui/components/SettingRow.js +11 -5
- package/lib/module/ui/components/SettingRow.js.map +1 -1
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js +76 -122
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/module/ui/components/fileManagement/UploadPreview.js +32 -19
- package/lib/module/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/module/ui/components/icon/OxyIcon.js +5 -4
- package/lib/module/ui/components/icon/OxyIcon.js.map +1 -1
- package/lib/module/ui/components/internal/GroupedPillButtons.js +11 -9
- package/lib/module/ui/components/internal/GroupedPillButtons.js.map +1 -1
- package/lib/module/ui/components/internal/PinInput.js +3 -2
- package/lib/module/ui/components/internal/PinInput.js.map +1 -1
- package/lib/module/ui/components/modals/DeleteAccountModal.js +83 -220
- package/lib/module/ui/components/modals/DeleteAccountModal.js.map +1 -1
- package/lib/module/ui/constants/theme.js +2 -2
- package/lib/module/ui/constants/theme.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +78 -3
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/navigation/routes.js +3 -2
- package/lib/module/ui/navigation/routes.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +32 -11
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js +71 -80
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +22 -10
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +375 -82
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountVerificationScreen.js +22 -10
- package/lib/module/ui/screens/AccountVerificationScreen.js.map +1 -1
- package/lib/module/ui/screens/CreateManagedAccountScreen.js +342 -0
- package/lib/module/ui/screens/CreateManagedAccountScreen.js.map +1 -0
- package/lib/module/ui/screens/FileManagementScreen.js +85 -52
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/HistoryViewScreen.js +80 -101
- package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js +66 -94
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/module/ui/screens/SessionManagementScreen.js +101 -67
- package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/module/ui/utils/fileManagement.js +0 -20
- package/lib/module/ui/utils/fileManagement.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +1 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ActingAsBanner.d.ts +4 -0
- package/lib/typescript/commonjs/ui/components/ActingAsBanner.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/OxyPayButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts +0 -1
- package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/SettingRow.d.ts +2 -2
- package/lib/typescript/commonjs/ui/components/SettingRow.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts +3 -4
- package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/fileManagement/UploadPreview.d.ts +2 -3
- package/lib/typescript/commonjs/ui/components/fileManagement/UploadPreview.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/icon/OxyIcon.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/internal/PinInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/modals/DeleteAccountModal.d.ts +2 -2
- package/lib/typescript/commonjs/ui/components/modals/DeleteAccountModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +6 -0
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts +1 -1
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountCenterScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountVerificationScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/CreateManagedAccountScreen.d.ts +5 -0
- package/lib/typescript/commonjs/ui/screens/CreateManagedAccountScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/HistoryViewScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/SessionManagementScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts +0 -4
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +1 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ActingAsBanner.d.ts +4 -0
- package/lib/typescript/module/ui/components/ActingAsBanner.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/OxyPayButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxySignInButton.d.ts +0 -1
- package/lib/typescript/module/ui/components/OxySignInButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/SettingRow.d.ts +2 -2
- package/lib/typescript/module/ui/components/SettingRow.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts +3 -4
- package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/fileManagement/UploadPreview.d.ts +2 -3
- package/lib/typescript/module/ui/components/fileManagement/UploadPreview.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/icon/OxyIcon.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/internal/PinInput.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/modals/DeleteAccountModal.d.ts +2 -2
- package/lib/typescript/module/ui/components/modals/DeleteAccountModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/OxyContext.d.ts +6 -0
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/routes.d.ts +1 -1
- package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountCenterScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountVerificationScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/CreateManagedAccountScreen.d.ts +5 -0
- package/lib/typescript/module/ui/screens/CreateManagedAccountScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/HistoryViewScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/SessionManagementScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/fileManagement.d.ts +0 -4
- package/lib/typescript/module/ui/utils/fileManagement.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +3 -0
- package/src/ui/components/ActingAsBanner.tsx +135 -0
- package/src/ui/components/OxyPayButton.tsx +5 -3
- package/src/ui/components/OxySignInButton.tsx +82 -81
- package/src/ui/components/SettingRow.tsx +14 -7
- package/src/ui/components/fileManagement/FileDetailsModal.tsx +69 -99
- package/src/ui/components/fileManagement/UploadPreview.tsx +58 -46
- package/src/ui/components/icon/OxyIcon.tsx +5 -4
- package/src/ui/components/internal/GroupedPillButtons.tsx +15 -12
- package/src/ui/components/internal/PinInput.tsx +4 -3
- package/src/ui/components/modals/DeleteAccountModal.tsx +79 -221
- package/src/ui/constants/theme.ts +2 -2
- package/src/ui/context/OxyContext.tsx +85 -0
- package/src/ui/navigation/routes.ts +3 -1
- package/src/ui/screens/AccountCenterScreen.tsx +40 -122
- package/src/ui/screens/AccountOverviewScreen.tsx +63 -98
- package/src/ui/screens/AccountSettingsScreen.tsx +21 -7
- package/src/ui/screens/AccountSwitcherScreen.tsx +344 -87
- package/src/ui/screens/AccountVerificationScreen.tsx +24 -16
- package/src/ui/screens/CreateManagedAccountScreen.tsx +338 -0
- package/src/ui/screens/FileManagementScreen.tsx +62 -54
- package/src/ui/screens/HistoryViewScreen.tsx +57 -204
- package/src/ui/screens/PremiumSubscriptionScreen.tsx +73 -93
- package/src/ui/screens/SessionManagementScreen.tsx +101 -73
- package/src/ui/utils/fileManagement.ts +0 -30
- package/lib/commonjs/ui/utils/confirmAction.js +0 -28
- package/lib/commonjs/ui/utils/confirmAction.js.map +0 -1
- package/lib/module/ui/utils/confirmAction.js +0 -25
- package/lib/module/ui/utils/confirmAction.js.map +0 -1
- package/lib/typescript/commonjs/ui/utils/confirmAction.d.ts +0 -7
- package/lib/typescript/commonjs/ui/utils/confirmAction.d.ts.map +0 -1
- package/lib/typescript/module/ui/utils/confirmAction.d.ts +0 -7
- package/lib/typescript/module/ui/utils/confirmAction.d.ts.map +0 -1
- package/src/ui/utils/confirmAction.ts +0 -23
|
@@ -1,31 +1,23 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { useState, useCallback } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
TouchableOpacity,
|
|
8
|
-
StyleSheet,
|
|
9
|
-
Modal,
|
|
10
|
-
KeyboardAvoidingView,
|
|
11
|
-
Platform,
|
|
12
|
-
} from 'react-native';
|
|
3
|
+
import { View, Text, TextInput, TouchableOpacity } from 'react-native';
|
|
4
|
+
import * as Dialog from '@oxyhq/bloom/dialog';
|
|
5
|
+
import type { DialogControlProps } from '@oxyhq/bloom/dialog';
|
|
6
|
+
import * as Prompt from '@oxyhq/bloom/prompt';
|
|
13
7
|
import OxyIcon from '../icon/OxyIcon';
|
|
14
8
|
import { useTheme } from '@oxyhq/bloom/theme';
|
|
15
9
|
import { Loading } from '@oxyhq/bloom/loading';
|
|
16
10
|
|
|
17
11
|
interface DeleteAccountModalProps {
|
|
18
|
-
|
|
12
|
+
control: DialogControlProps;
|
|
19
13
|
username: string;
|
|
20
|
-
onClose: () => void;
|
|
21
14
|
onDelete: (password: string) => Promise<void>;
|
|
22
15
|
t: (key: string, params?: Record<string, string>) => string | undefined;
|
|
23
16
|
}
|
|
24
17
|
|
|
25
18
|
const DeleteAccountModal: React.FC<DeleteAccountModalProps> = ({
|
|
26
|
-
|
|
19
|
+
control,
|
|
27
20
|
username,
|
|
28
|
-
onClose,
|
|
29
21
|
onDelete,
|
|
30
22
|
t,
|
|
31
23
|
}) => {
|
|
@@ -46,7 +38,7 @@ const DeleteAccountModal: React.FC<DeleteAccountModalProps> = ({
|
|
|
46
38
|
|
|
47
39
|
try {
|
|
48
40
|
await onDelete(password);
|
|
49
|
-
//
|
|
41
|
+
// Dialog will be closed by parent on success
|
|
50
42
|
} catch (err: unknown) {
|
|
51
43
|
setError((err instanceof Error ? err.message : null) || t('deleteAccount.error') || 'Failed to delete account');
|
|
52
44
|
} finally {
|
|
@@ -54,234 +46,100 @@ const DeleteAccountModal: React.FC<DeleteAccountModalProps> = ({
|
|
|
54
46
|
}
|
|
55
47
|
}, [isValid, password, onDelete, t]);
|
|
56
48
|
|
|
57
|
-
const
|
|
49
|
+
const handleCleanup = useCallback(() => {
|
|
58
50
|
if (isDeleting) return;
|
|
59
51
|
setPassword('');
|
|
60
52
|
setConfirmUsername('');
|
|
61
53
|
setError(null);
|
|
62
|
-
|
|
63
|
-
}, [isDeleting
|
|
54
|
+
setShowPassword(false);
|
|
55
|
+
}, [isDeleting]);
|
|
64
56
|
|
|
65
57
|
return (
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
74
|
-
style={styles.overlay}
|
|
75
|
-
>
|
|
76
|
-
<TouchableOpacity
|
|
77
|
-
style={[styles.backdrop, { backgroundColor: theme.colors.overlay }]}
|
|
78
|
-
activeOpacity={1}
|
|
79
|
-
onPress={handleClose}
|
|
80
|
-
/>
|
|
81
|
-
<View style={[styles.modal, { backgroundColor: theme.colors.background }]}>
|
|
82
|
-
<View style={styles.header}>
|
|
83
|
-
<OxyIcon name="alert" size={32} color={theme.colors.error} />
|
|
84
|
-
<Text className="text-destructive" style={styles.title}>
|
|
85
|
-
{t('deleteAccount.title') || 'Delete Account'}
|
|
86
|
-
</Text>
|
|
87
|
-
</View>
|
|
88
|
-
|
|
89
|
-
<Text className="text-foreground" style={styles.warning}>
|
|
90
|
-
{t('deleteAccount.warning') || 'This action cannot be undone. Your account and all associated data will be permanently deleted.'}
|
|
58
|
+
<Dialog.Outer control={control} onClose={handleCleanup}>
|
|
59
|
+
<Dialog.Handle />
|
|
60
|
+
<Dialog.ScrollableInner label="Delete Account">
|
|
61
|
+
<View className="flex-row items-center mb-4 gap-3">
|
|
62
|
+
<OxyIcon name="alert" size={32} color={theme.colors.error} />
|
|
63
|
+
<Text className="text-destructive text-xl font-bold">
|
|
64
|
+
{t('deleteAccount.title') || 'Delete Account'}
|
|
91
65
|
</Text>
|
|
66
|
+
</View>
|
|
92
67
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
<Text className="text-
|
|
103
|
-
{
|
|
68
|
+
<Text className="text-foreground text-sm leading-5 mb-5">
|
|
69
|
+
{t('deleteAccount.warning') || 'This action cannot be undone. Your account and all associated data will be permanently deleted.'}
|
|
70
|
+
</Text>
|
|
71
|
+
|
|
72
|
+
{error && (
|
|
73
|
+
<View
|
|
74
|
+
className="p-3 rounded-lg mb-4"
|
|
75
|
+
style={{ backgroundColor: `${theme.colors.error}20` }}
|
|
76
|
+
>
|
|
77
|
+
<Text className="text-destructive text-sm text-center">
|
|
78
|
+
{error}
|
|
104
79
|
</Text>
|
|
105
|
-
<View className="border-border bg-background" style={styles.inputContainer}>
|
|
106
|
-
<TextInput
|
|
107
|
-
className="text-foreground"
|
|
108
|
-
style={styles.input}
|
|
109
|
-
value={password}
|
|
110
|
-
onChangeText={setPassword}
|
|
111
|
-
placeholder={t('deleteAccount.passwordPlaceholder') || 'Password'}
|
|
112
|
-
placeholderTextColor={theme.colors.textSecondary}
|
|
113
|
-
secureTextEntry={!showPassword}
|
|
114
|
-
autoCapitalize="none"
|
|
115
|
-
editable={!isDeleting}
|
|
116
|
-
/>
|
|
117
|
-
<TouchableOpacity
|
|
118
|
-
onPress={() => setShowPassword(!showPassword)}
|
|
119
|
-
style={styles.eyeButton}
|
|
120
|
-
>
|
|
121
|
-
<OxyIcon
|
|
122
|
-
name={showPassword ? 'eye-off' : 'eye'}
|
|
123
|
-
size={20}
|
|
124
|
-
color={theme.colors.textSecondary}
|
|
125
|
-
/>
|
|
126
|
-
</TouchableOpacity>
|
|
127
|
-
</View>
|
|
128
80
|
</View>
|
|
81
|
+
)}
|
|
129
82
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
83
|
+
<View className="mb-4">
|
|
84
|
+
<Text className="text-muted-foreground text-[13px] mb-2">
|
|
85
|
+
{t('deleteAccount.passwordLabel') || 'Enter your password'}
|
|
86
|
+
</Text>
|
|
87
|
+
<View className="flex-row items-center border border-border bg-background rounded-lg">
|
|
134
88
|
<TextInput
|
|
135
|
-
className="text-foreground
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
{
|
|
140
|
-
borderColor: confirmUsername === username ? theme.colors.success : theme.colors.border,
|
|
141
|
-
},
|
|
142
|
-
]}
|
|
143
|
-
value={confirmUsername}
|
|
144
|
-
onChangeText={setConfirmUsername}
|
|
145
|
-
placeholder={username}
|
|
89
|
+
className="text-foreground flex-1 text-base py-3 px-4"
|
|
90
|
+
value={password}
|
|
91
|
+
onChangeText={setPassword}
|
|
92
|
+
placeholder={t('deleteAccount.passwordPlaceholder') || 'Password'}
|
|
146
93
|
placeholderTextColor={theme.colors.textSecondary}
|
|
94
|
+
secureTextEntry={!showPassword}
|
|
147
95
|
autoCapitalize="none"
|
|
148
|
-
autoCorrect={false}
|
|
149
96
|
editable={!isDeleting}
|
|
150
97
|
/>
|
|
151
|
-
</View>
|
|
152
|
-
|
|
153
|
-
<View style={styles.buttons}>
|
|
154
98
|
<TouchableOpacity
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
onPress={handleClose}
|
|
158
|
-
disabled={isDeleting}
|
|
99
|
+
onPress={() => setShowPassword(!showPassword)}
|
|
100
|
+
className="p-3"
|
|
159
101
|
>
|
|
160
|
-
<
|
|
161
|
-
{
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
<TouchableOpacity
|
|
166
|
-
style={[
|
|
167
|
-
styles.button,
|
|
168
|
-
styles.deleteButton,
|
|
169
|
-
{ backgroundColor: isValid ? theme.colors.error : `${theme.colors.error}50` },
|
|
170
|
-
]}
|
|
171
|
-
onPress={handleDelete}
|
|
172
|
-
disabled={!isValid || isDeleting}
|
|
173
|
-
>
|
|
174
|
-
{isDeleting ? (
|
|
175
|
-
<Loading size="small" />
|
|
176
|
-
) : (
|
|
177
|
-
<Text style={[styles.deleteButtonText, { color: theme.colors.card }]}>
|
|
178
|
-
{t('deleteAccount.confirm') || 'Delete Forever'}
|
|
179
|
-
</Text>
|
|
180
|
-
)}
|
|
102
|
+
<OxyIcon
|
|
103
|
+
name={showPassword ? 'eye-off' : 'eye'}
|
|
104
|
+
size={20}
|
|
105
|
+
color={theme.colors.textSecondary}
|
|
106
|
+
/>
|
|
181
107
|
</TouchableOpacity>
|
|
182
108
|
</View>
|
|
183
109
|
</View>
|
|
184
|
-
|
|
185
|
-
|
|
110
|
+
|
|
111
|
+
<View className="mb-4">
|
|
112
|
+
<Text className="text-muted-foreground text-[13px] mb-2">
|
|
113
|
+
{t('deleteAccount.confirmLabel', { username }) || `Type "${username}" to confirm`}
|
|
114
|
+
</Text>
|
|
115
|
+
<TextInput
|
|
116
|
+
className="text-foreground bg-background text-base py-3 px-4 border rounded-lg"
|
|
117
|
+
style={{
|
|
118
|
+
borderColor: confirmUsername === username ? theme.colors.success : theme.colors.border,
|
|
119
|
+
}}
|
|
120
|
+
value={confirmUsername}
|
|
121
|
+
onChangeText={setConfirmUsername}
|
|
122
|
+
placeholder={username}
|
|
123
|
+
placeholderTextColor={theme.colors.textSecondary}
|
|
124
|
+
autoCapitalize="none"
|
|
125
|
+
autoCorrect={false}
|
|
126
|
+
editable={!isDeleting}
|
|
127
|
+
/>
|
|
128
|
+
</View>
|
|
129
|
+
|
|
130
|
+
<Prompt.Actions>
|
|
131
|
+
<Prompt.Action
|
|
132
|
+
onPress={handleDelete}
|
|
133
|
+
color="negative"
|
|
134
|
+
cta={isDeleting ? undefined : (t('deleteAccount.confirm') || 'Delete Forever')}
|
|
135
|
+
disabled={!isValid || isDeleting}
|
|
136
|
+
shouldCloseOnPress={false}
|
|
137
|
+
/>
|
|
138
|
+
<Prompt.Cancel cta={t('common.cancel') || 'Cancel'} />
|
|
139
|
+
</Prompt.Actions>
|
|
140
|
+
</Dialog.ScrollableInner>
|
|
141
|
+
</Dialog.Outer>
|
|
186
142
|
);
|
|
187
143
|
};
|
|
188
144
|
|
|
189
|
-
const styles = StyleSheet.create({
|
|
190
|
-
overlay: {
|
|
191
|
-
flex: 1,
|
|
192
|
-
justifyContent: 'center',
|
|
193
|
-
alignItems: 'center',
|
|
194
|
-
},
|
|
195
|
-
backdrop: {
|
|
196
|
-
...StyleSheet.absoluteFillObject,
|
|
197
|
-
},
|
|
198
|
-
modal: {
|
|
199
|
-
width: '90%',
|
|
200
|
-
maxWidth: 400,
|
|
201
|
-
borderRadius: 16,
|
|
202
|
-
padding: 24,
|
|
203
|
-
shadowColor: '#000',
|
|
204
|
-
shadowOffset: { width: 0, height: 4 },
|
|
205
|
-
shadowOpacity: 0.3,
|
|
206
|
-
shadowRadius: 8,
|
|
207
|
-
elevation: 8,
|
|
208
|
-
},
|
|
209
|
-
header: {
|
|
210
|
-
flexDirection: 'row',
|
|
211
|
-
alignItems: 'center',
|
|
212
|
-
marginBottom: 16,
|
|
213
|
-
gap: 12,
|
|
214
|
-
},
|
|
215
|
-
title: {
|
|
216
|
-
fontSize: 20,
|
|
217
|
-
fontWeight: '700',
|
|
218
|
-
},
|
|
219
|
-
warning: {
|
|
220
|
-
fontSize: 14,
|
|
221
|
-
lineHeight: 20,
|
|
222
|
-
marginBottom: 20,
|
|
223
|
-
},
|
|
224
|
-
errorContainer: {
|
|
225
|
-
padding: 12,
|
|
226
|
-
borderRadius: 8,
|
|
227
|
-
marginBottom: 16,
|
|
228
|
-
},
|
|
229
|
-
errorText: {
|
|
230
|
-
fontSize: 14,
|
|
231
|
-
textAlign: 'center',
|
|
232
|
-
},
|
|
233
|
-
inputGroup: {
|
|
234
|
-
marginBottom: 16,
|
|
235
|
-
},
|
|
236
|
-
label: {
|
|
237
|
-
fontSize: 13,
|
|
238
|
-
marginBottom: 8,
|
|
239
|
-
},
|
|
240
|
-
inputContainer: {
|
|
241
|
-
flexDirection: 'row',
|
|
242
|
-
alignItems: 'center',
|
|
243
|
-
borderWidth: 1,
|
|
244
|
-
borderRadius: 8,
|
|
245
|
-
},
|
|
246
|
-
input: {
|
|
247
|
-
flex: 1,
|
|
248
|
-
fontSize: 16,
|
|
249
|
-
paddingVertical: 12,
|
|
250
|
-
paddingHorizontal: 16,
|
|
251
|
-
},
|
|
252
|
-
confirmInput: {
|
|
253
|
-
borderWidth: 1,
|
|
254
|
-
borderRadius: 8,
|
|
255
|
-
},
|
|
256
|
-
eyeButton: {
|
|
257
|
-
padding: 12,
|
|
258
|
-
},
|
|
259
|
-
buttons: {
|
|
260
|
-
flexDirection: 'row',
|
|
261
|
-
gap: 12,
|
|
262
|
-
marginTop: 8,
|
|
263
|
-
},
|
|
264
|
-
button: {
|
|
265
|
-
flex: 1,
|
|
266
|
-
paddingVertical: 14,
|
|
267
|
-
borderRadius: 8,
|
|
268
|
-
alignItems: 'center',
|
|
269
|
-
justifyContent: 'center',
|
|
270
|
-
},
|
|
271
|
-
cancelButton: {
|
|
272
|
-
borderWidth: 1,
|
|
273
|
-
},
|
|
274
|
-
deleteButton: {
|
|
275
|
-
minHeight: 48,
|
|
276
|
-
},
|
|
277
|
-
buttonText: {
|
|
278
|
-
fontSize: 16,
|
|
279
|
-
fontWeight: '600',
|
|
280
|
-
},
|
|
281
|
-
deleteButtonText: {
|
|
282
|
-
fontSize: 16,
|
|
283
|
-
fontWeight: '600',
|
|
284
|
-
},
|
|
285
|
-
});
|
|
286
|
-
|
|
287
145
|
export default DeleteAccountModal;
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from 'react';
|
|
12
12
|
import { OxyServices } from '@oxyhq/core';
|
|
13
13
|
import type { User, ApiError, SessionLoginResponse } from '@oxyhq/core';
|
|
14
|
+
import type { ManagedAccount, CreateManagedAccountInput } from '@oxyhq/core';
|
|
14
15
|
import { KeyManager } from '@oxyhq/core';
|
|
15
16
|
import type { ClientSession } from '@oxyhq/core';
|
|
16
17
|
import { toast } from '../../lib/sonner';
|
|
@@ -85,6 +86,13 @@ export interface OxyContextState {
|
|
|
85
86
|
useFollow?: UseFollowHook;
|
|
86
87
|
showBottomSheet?: (screenOrConfig: RouteName | { screen: RouteName; props?: Record<string, unknown> }) => void;
|
|
87
88
|
openAvatarPicker: () => void;
|
|
89
|
+
|
|
90
|
+
// Managed accounts (sub-accounts / managed identities)
|
|
91
|
+
actingAs: string | null;
|
|
92
|
+
managedAccounts: ManagedAccount[];
|
|
93
|
+
setActingAs: (userId: string | null) => void;
|
|
94
|
+
refreshManagedAccounts: () => Promise<void>;
|
|
95
|
+
createManagedAccount: (data: CreateManagedAccountInput) => Promise<ManagedAccount>;
|
|
88
96
|
}
|
|
89
97
|
|
|
90
98
|
const OxyContext = createContext<OxyContextState | null>(null);
|
|
@@ -645,6 +653,68 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
645
653
|
showBottomSheet: showBottomSheetForContext,
|
|
646
654
|
});
|
|
647
655
|
|
|
656
|
+
// --- Managed accounts state ---
|
|
657
|
+
const [actingAs, setActingAsState] = useState<string | null>(null);
|
|
658
|
+
const [managedAccounts, setManagedAccounts] = useState<ManagedAccount[]>([]);
|
|
659
|
+
|
|
660
|
+
// Restore actingAs from storage on startup
|
|
661
|
+
useEffect(() => {
|
|
662
|
+
if (!storage || !initialized) return;
|
|
663
|
+
let mounted = true;
|
|
664
|
+
(async () => {
|
|
665
|
+
try {
|
|
666
|
+
const stored = await storage.getItem(`${storageKeyPrefix}_acting_as`);
|
|
667
|
+
if (mounted && stored) {
|
|
668
|
+
setActingAsState(stored);
|
|
669
|
+
oxyServices.setActingAs(stored);
|
|
670
|
+
}
|
|
671
|
+
} catch (err) {
|
|
672
|
+
if (__DEV__) {
|
|
673
|
+
loggerUtil.debug('Failed to restore actingAs from storage', { component: 'OxyContext' }, err as unknown);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
})();
|
|
677
|
+
return () => { mounted = false; };
|
|
678
|
+
}, [storage, initialized, storageKeyPrefix, oxyServices]);
|
|
679
|
+
|
|
680
|
+
// Load managed accounts when authenticated
|
|
681
|
+
const refreshManagedAccounts = useCallback(async (): Promise<void> => {
|
|
682
|
+
if (!isAuthenticated) return;
|
|
683
|
+
try {
|
|
684
|
+
const accounts = await oxyServices.getManagedAccounts();
|
|
685
|
+
setManagedAccounts(accounts);
|
|
686
|
+
} catch (err) {
|
|
687
|
+
if (__DEV__) {
|
|
688
|
+
loggerUtil.debug('Failed to load managed accounts', { component: 'OxyContext' }, err as unknown);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}, [isAuthenticated, oxyServices]);
|
|
692
|
+
|
|
693
|
+
useEffect(() => {
|
|
694
|
+
if (isAuthenticated && initialized && tokenReady) {
|
|
695
|
+
refreshManagedAccounts();
|
|
696
|
+
}
|
|
697
|
+
}, [isAuthenticated, initialized, tokenReady, refreshManagedAccounts]);
|
|
698
|
+
|
|
699
|
+
const setActingAs = useCallback((userId: string | null) => {
|
|
700
|
+
oxyServices.setActingAs(userId);
|
|
701
|
+
setActingAsState(userId);
|
|
702
|
+
// Persist to storage
|
|
703
|
+
if (storage) {
|
|
704
|
+
if (userId) {
|
|
705
|
+
storage.setItem(`${storageKeyPrefix}_acting_as`, userId).catch(() => {});
|
|
706
|
+
} else {
|
|
707
|
+
storage.removeItem(`${storageKeyPrefix}_acting_as`).catch(() => {});
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}, [oxyServices, storage, storageKeyPrefix]);
|
|
711
|
+
|
|
712
|
+
const createManagedAccountFn = useCallback(async (data: CreateManagedAccountInput): Promise<ManagedAccount> => {
|
|
713
|
+
const account = await oxyServices.createManagedAccount(data);
|
|
714
|
+
await refreshManagedAccounts();
|
|
715
|
+
return account;
|
|
716
|
+
}, [oxyServices, refreshManagedAccounts]);
|
|
717
|
+
|
|
648
718
|
const contextValue: OxyContextState = useMemo(() => ({
|
|
649
719
|
user,
|
|
650
720
|
sessions,
|
|
@@ -678,6 +748,11 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
678
748
|
useFollow: useFollowHook,
|
|
679
749
|
showBottomSheet: showBottomSheetForContext,
|
|
680
750
|
openAvatarPicker,
|
|
751
|
+
actingAs,
|
|
752
|
+
managedAccounts,
|
|
753
|
+
setActingAs,
|
|
754
|
+
refreshManagedAccounts,
|
|
755
|
+
createManagedAccount: createManagedAccountFn,
|
|
681
756
|
}), [
|
|
682
757
|
activeSessionId,
|
|
683
758
|
signIn,
|
|
@@ -709,6 +784,11 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
709
784
|
user,
|
|
710
785
|
showBottomSheetForContext,
|
|
711
786
|
openAvatarPicker,
|
|
787
|
+
actingAs,
|
|
788
|
+
managedAccounts,
|
|
789
|
+
setActingAs,
|
|
790
|
+
refreshManagedAccounts,
|
|
791
|
+
createManagedAccountFn,
|
|
712
792
|
]);
|
|
713
793
|
|
|
714
794
|
return (
|
|
@@ -753,6 +833,11 @@ const LOADING_STATE: OxyContextState = {
|
|
|
753
833
|
storageKeyPrefix: 'oxy_session',
|
|
754
834
|
oxyServices: null as any,
|
|
755
835
|
openAvatarPicker: () => {},
|
|
836
|
+
actingAs: null,
|
|
837
|
+
managedAccounts: [],
|
|
838
|
+
setActingAs: () => {},
|
|
839
|
+
refreshManagedAccounts: noop,
|
|
840
|
+
createManagedAccount: noop,
|
|
756
841
|
};
|
|
757
842
|
|
|
758
843
|
export const useOxy = (): OxyContextState => {
|
|
@@ -39,7 +39,8 @@ export type RouteName =
|
|
|
39
39
|
| 'AboutKarma'
|
|
40
40
|
| 'KarmaFAQ'
|
|
41
41
|
| 'FollowersList' // List of user's followers
|
|
42
|
-
| 'FollowingList'
|
|
42
|
+
| 'FollowingList' // List of users being followed
|
|
43
|
+
| 'CreateManagedAccount'; // Create a new managed sub-account
|
|
43
44
|
|
|
44
45
|
// Lazy screen loaders - functions that return screen components on-demand
|
|
45
46
|
// This breaks the require cycle by deferring imports until screens are actually needed
|
|
@@ -80,6 +81,7 @@ const screenLoaders: Record<RouteName, () => ComponentType<BaseScreenProps>> = {
|
|
|
80
81
|
// User list screens (followers/following)
|
|
81
82
|
FollowersList: () => require('../screens/FollowersListScreen').default,
|
|
82
83
|
FollowingList: () => require('../screens/FollowingListScreen').default,
|
|
84
|
+
CreateManagedAccount: () => require('../screens/CreateManagedAccountScreen').default,
|
|
83
85
|
};
|
|
84
86
|
|
|
85
87
|
// Cache loaded components to avoid re-requiring
|