@oxyhq/services 6.10.8 → 7.0.0
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 +211 -49
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/client.js +25 -4
- package/lib/commonjs/ui/client.js.map +1 -1
- package/lib/commonjs/ui/components/AccountMenu.js +485 -0
- package/lib/commonjs/ui/components/AccountMenu.js.map +1 -0
- package/lib/commonjs/ui/components/AccountMenuButton.js +120 -0
- package/lib/commonjs/ui/components/AccountMenuButton.js.map +1 -0
- package/lib/commonjs/ui/components/ActingAsBanner.js +2 -2
- package/lib/commonjs/ui/components/ActingAsBanner.js.map +1 -1
- package/lib/commonjs/ui/components/ProfileCard.js +2 -2
- package/lib/commonjs/ui/components/ProfileCard.js.map +1 -1
- package/lib/commonjs/ui/components/StepBasedScreen.js +2 -2
- package/lib/commonjs/ui/components/StepBasedScreen.js.map +1 -1
- package/lib/commonjs/ui/components/accountMenuRows.js +45 -0
- package/lib/commonjs/ui/components/accountMenuRows.js.map +1 -0
- package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js +5 -5
- package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js.map +1 -1
- package/lib/commonjs/ui/components/payment/PaymentMethodStep.js +3 -2
- package/lib/commonjs/ui/components/payment/PaymentMethodStep.js.map +1 -1
- package/lib/commonjs/ui/components/theming.js +2 -2
- package/lib/commonjs/ui/components/theming.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +59 -131
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js +36 -2
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/mutationKeys.js +6 -0
- package/lib/commonjs/ui/hooks/mutations/mutationKeys.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +138 -1
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/queryKeys.js +67 -2
- package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +27 -2
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/useAuth.js +13 -2
- package/lib/commonjs/ui/hooks/useAuth.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionManagement.js +30 -0
- package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/commonjs/ui/index.js +132 -85
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/navigation/routes.js +6 -7
- package/lib/commonjs/ui/navigation/routes.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountVerificationScreen.js +3 -2
- package/lib/commonjs/ui/screens/AccountVerificationScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ConnectedAppsScreen.js +202 -0
- package/lib/commonjs/ui/screens/ConnectedAppsScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/CreateManagedAccountScreen.js +3 -2
- package/lib/commonjs/ui/screens/CreateManagedAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +3 -2
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FAQScreen.js +7 -4
- package/lib/commonjs/ui/screens/FAQScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FeedbackScreen.js +21 -16
- package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HelpSupportScreen.js +3 -2
- package/lib/commonjs/ui/screens/HelpSupportScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HistoryViewScreen.js +7 -4
- package/lib/commonjs/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +3 -2
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/LegalDocumentsScreen.js +6 -4
- package/lib/commonjs/ui/screens/LegalDocumentsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ManageAccountScreen.js +780 -0
- package/lib/commonjs/ui/screens/ManageAccountScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/NotificationsScreen.js +175 -0
- package/lib/commonjs/ui/screens/NotificationsScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +18 -12
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PreferencesScreen.js +220 -0
- package/lib/commonjs/ui/screens/PreferencesScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +14 -10
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +3 -3
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SavesCollectionsScreen.js +8 -5
- package/lib/commonjs/ui/screens/SavesCollectionsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SearchSettingsScreen.js +6 -4
- package/lib/commonjs/ui/screens/SearchSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/UserLinksScreen.js +3 -2
- package/lib/commonjs/ui/screens/UserLinksScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/UserListScreen.js +2 -2
- package/lib/commonjs/ui/screens/UserListScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js +3 -2
- package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaFAQScreen.js +3 -2
- package/lib/commonjs/ui/screens/karma/KarmaFAQScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js +2 -2
- package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js +4 -3
- package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js +3 -2
- package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
- package/lib/commonjs/ui/utils/activeAuthuser.js +85 -0
- package/lib/commonjs/ui/utils/activeAuthuser.js.map +1 -0
- package/lib/module/index.js +58 -16
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/client.js +5 -3
- package/lib/module/ui/client.js.map +1 -1
- package/lib/module/ui/components/AccountMenu.js +480 -0
- package/lib/module/ui/components/AccountMenu.js.map +1 -0
- package/lib/module/ui/components/AccountMenuButton.js +115 -0
- package/lib/module/ui/components/AccountMenuButton.js.map +1 -0
- package/lib/module/ui/components/ActingAsBanner.js +2 -2
- package/lib/module/ui/components/ActingAsBanner.js.map +1 -1
- package/lib/module/ui/components/ProfileCard.js +1 -1
- package/lib/module/ui/components/ProfileCard.js.map +1 -1
- package/lib/module/ui/components/StepBasedScreen.js +1 -1
- package/lib/module/ui/components/StepBasedScreen.js.map +1 -1
- package/lib/module/ui/components/accountMenuRows.js +41 -0
- package/lib/module/ui/components/accountMenuRows.js.map +1 -0
- package/lib/module/ui/components/payment/PaymentDetailsStep.js +1 -1
- package/lib/module/ui/components/payment/PaymentDetailsStep.js.map +1 -1
- package/lib/module/ui/components/payment/PaymentMethodStep.js +1 -1
- package/lib/module/ui/components/payment/PaymentMethodStep.js.map +1 -1
- package/lib/module/ui/components/theming.js +1 -1
- package/lib/module/ui/components/theming.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +59 -131
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js +36 -2
- package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/module/ui/hooks/mutations/mutationKeys.js +6 -0
- package/lib/module/ui/hooks/mutations/mutationKeys.js.map +1 -1
- package/lib/module/ui/hooks/mutations/useAccountMutations.js +135 -1
- package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/module/ui/hooks/queries/queryKeys.js +60 -1
- package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/module/ui/hooks/queries/useAccountQueries.js +24 -0
- package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/module/ui/hooks/useAuth.js +13 -2
- package/lib/module/ui/hooks/useAuth.js.map +1 -1
- package/lib/module/ui/hooks/useSessionManagement.js +30 -0
- package/lib/module/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/module/ui/index.js +34 -78
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/navigation/routes.js +6 -7
- package/lib/module/ui/navigation/routes.js.map +1 -1
- package/lib/module/ui/screens/AccountVerificationScreen.js +1 -1
- package/lib/module/ui/screens/AccountVerificationScreen.js.map +1 -1
- package/lib/module/ui/screens/ConnectedAppsScreen.js +198 -0
- package/lib/module/ui/screens/ConnectedAppsScreen.js.map +1 -0
- package/lib/module/ui/screens/CreateManagedAccountScreen.js +1 -1
- package/lib/module/ui/screens/CreateManagedAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/EditProfileFieldScreen.js +1 -1
- package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/module/ui/screens/FAQScreen.js +3 -1
- package/lib/module/ui/screens/FAQScreen.js.map +1 -1
- package/lib/module/ui/screens/FeedbackScreen.js +6 -2
- package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/module/ui/screens/HelpSupportScreen.js +1 -1
- package/lib/module/ui/screens/HelpSupportScreen.js.map +1 -1
- package/lib/module/ui/screens/HistoryViewScreen.js +3 -1
- package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/module/ui/screens/LanguageSelectorScreen.js +1 -1
- package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -1
- package/lib/module/ui/screens/LegalDocumentsScreen.js +2 -1
- package/lib/module/ui/screens/LegalDocumentsScreen.js.map +1 -1
- package/lib/module/ui/screens/ManageAccountScreen.js +775 -0
- package/lib/module/ui/screens/ManageAccountScreen.js.map +1 -0
- package/lib/module/ui/screens/NotificationsScreen.js +169 -0
- package/lib/module/ui/screens/NotificationsScreen.js.map +1 -0
- package/lib/module/ui/screens/PaymentGatewayScreen.js +9 -3
- package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/module/ui/screens/PreferencesScreen.js +214 -0
- package/lib/module/ui/screens/PreferencesScreen.js.map +1 -0
- package/lib/module/ui/screens/PrivacySettingsScreen.js +4 -1
- package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileScreen.js +2 -2
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/SavesCollectionsScreen.js +3 -1
- package/lib/module/ui/screens/SavesCollectionsScreen.js.map +1 -1
- package/lib/module/ui/screens/SearchSettingsScreen.js +2 -1
- package/lib/module/ui/screens/SearchSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/UserLinksScreen.js +1 -1
- package/lib/module/ui/screens/UserLinksScreen.js.map +1 -1
- package/lib/module/ui/screens/UserListScreen.js +1 -1
- package/lib/module/ui/screens/UserListScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaAboutScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaAboutScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaFAQScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaFAQScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaRewardsScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaRulesScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
- package/lib/module/ui/utils/activeAuthuser.js +79 -0
- package/lib/module/ui/utils/activeAuthuser.js.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +23 -6
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/client.d.ts +7 -2
- package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/AccountMenu.d.ts +23 -0
- package/lib/typescript/commonjs/ui/components/AccountMenu.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/AccountMenuButton.d.ts +19 -0
- package/lib/typescript/commonjs/ui/components/AccountMenuButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/accountMenuRows.d.ts +27 -0
- package/lib/typescript/commonjs/ui/components/accountMenuRows.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/mutationKeys.d.ts +5 -0
- package/lib/typescript/commonjs/ui/hooks/mutations/mutationKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +26 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts +32 -3
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts +10 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useAuth.d.ts +8 -2
- package/lib/typescript/commonjs/ui/hooks/useAuth.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useSessionManagement.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/index.d.ts +32 -18
- package/lib/typescript/commonjs/ui/index.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/{module/ui/screens/AccountOverviewScreen.d.ts → commonjs/ui/screens/ConnectedAppsScreen.d.ts} +1 -1
- package/lib/typescript/commonjs/ui/screens/ConnectedAppsScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/FAQScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/HistoryViewScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/LegalDocumentsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts +13 -0
- package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/{AccountOverviewScreen.d.ts → NotificationsScreen.d.ts} +1 -1
- package/lib/typescript/commonjs/ui/screens/NotificationsScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/PaymentGatewayScreen.d.ts +1 -1
- package/lib/typescript/commonjs/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/{AccountSettingsScreen.d.ts → PreferencesScreen.d.ts} +2 -5
- package/lib/typescript/commonjs/ui/screens/PreferencesScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/SavesCollectionsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/SearchSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/activeAuthuser.d.ts +42 -0
- package/lib/typescript/commonjs/ui/utils/activeAuthuser.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +23 -6
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/client.d.ts +7 -2
- package/lib/typescript/module/ui/client.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/AccountMenu.d.ts +23 -0
- package/lib/typescript/module/ui/components/AccountMenu.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/AccountMenuButton.d.ts +19 -0
- package/lib/typescript/module/ui/components/AccountMenuButton.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/accountMenuRows.d.ts +27 -0
- package/lib/typescript/module/ui/components/accountMenuRows.d.ts.map +1 -0
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/mutations/mutationKeys.d.ts +5 -0
- package/lib/typescript/module/ui/hooks/mutations/mutationKeys.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +26 -1
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts +32 -3
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts +10 -1
- package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useAuth.d.ts +8 -2
- package/lib/typescript/module/ui/hooks/useAuth.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useSessionManagement.d.ts.map +1 -1
- package/lib/typescript/module/ui/index.d.ts +32 -18
- package/lib/typescript/module/ui/index.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/{AccountSettingsScreen.d.ts → ConnectedAppsScreen.d.ts} +2 -5
- package/lib/typescript/module/ui/screens/ConnectedAppsScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/FAQScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/HistoryViewScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/LegalDocumentsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts +13 -0
- package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/NotificationsScreen.d.ts +5 -0
- package/lib/typescript/module/ui/screens/NotificationsScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/PaymentGatewayScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/PreferencesScreen.d.ts +5 -0
- package/lib/typescript/module/ui/screens/PreferencesScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/SavesCollectionsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/SearchSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/activeAuthuser.d.ts +42 -0
- package/lib/typescript/module/ui/utils/activeAuthuser.d.ts.map +1 -0
- package/package.json +20 -9
- package/src/index.ts +141 -47
- package/src/ui/client.ts +7 -2
- package/src/ui/components/AccountMenu.tsx +534 -0
- package/src/ui/components/AccountMenuButton.tsx +113 -0
- package/src/ui/components/ActingAsBanner.tsx +2 -2
- package/src/ui/components/ProfileCard.tsx +1 -1
- package/src/ui/components/StepBasedScreen.tsx +1 -1
- package/src/ui/components/accountMenuRows.ts +60 -0
- package/src/ui/components/payment/PaymentDetailsStep.tsx +1 -1
- package/src/ui/components/payment/PaymentMethodStep.tsx +1 -1
- package/src/ui/components/theming.tsx +1 -1
- package/src/ui/context/OxyContext.tsx +61 -145
- package/src/ui/context/hooks/useAuthOperations.ts +36 -2
- package/src/ui/hooks/mutations/mutationKeys.ts +11 -0
- package/src/ui/hooks/mutations/useAccountMutations.ts +154 -2
- package/src/ui/hooks/queries/queryKeys.ts +54 -4
- package/src/ui/hooks/queries/useAccountQueries.ts +25 -1
- package/src/ui/hooks/useAuth.ts +23 -4
- package/src/ui/hooks/useSessionManagement.ts +29 -0
- package/src/ui/index.ts +37 -98
- package/src/ui/navigation/routes.ts +9 -11
- package/src/ui/screens/AccountVerificationScreen.tsx +1 -1
- package/src/ui/screens/ConnectedAppsScreen.tsx +225 -0
- package/src/ui/screens/CreateManagedAccountScreen.tsx +1 -1
- package/src/ui/screens/EditProfileFieldScreen.tsx +1 -1
- package/src/ui/screens/FAQScreen.tsx +3 -1
- package/src/ui/screens/FeedbackScreen.tsx +6 -10
- package/src/ui/screens/HelpSupportScreen.tsx +1 -1
- package/src/ui/screens/HistoryViewScreen.tsx +3 -1
- package/src/ui/screens/LanguageSelectorScreen.tsx +1 -1
- package/src/ui/screens/LegalDocumentsScreen.tsx +2 -1
- package/src/ui/screens/ManageAccountScreen.tsx +1102 -0
- package/src/ui/screens/NotificationsScreen.tsx +189 -0
- package/src/ui/screens/PaymentGatewayScreen.tsx +10 -12
- package/src/ui/screens/PreferencesScreen.tsx +263 -0
- package/src/ui/screens/PrivacySettingsScreen.tsx +4 -1
- package/src/ui/screens/ProfileScreen.tsx +2 -2
- package/src/ui/screens/SavesCollectionsScreen.tsx +3 -1
- package/src/ui/screens/SearchSettingsScreen.tsx +2 -1
- package/src/ui/screens/UserLinksScreen.tsx +1 -1
- package/src/ui/screens/UserListScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaAboutScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaFAQScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaLeaderboardScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaRewardsScreen.tsx +1 -1
- package/src/ui/screens/karma/KarmaRulesScreen.tsx +1 -1
- package/src/ui/utils/activeAuthuser.ts +78 -0
- package/lib/commonjs/ui/components/feedback/index.js +0 -54
- package/lib/commonjs/ui/components/feedback/index.js.map +0 -1
- package/lib/commonjs/ui/components/icon/index.js +0 -21
- package/lib/commonjs/ui/components/icon/index.js.map +0 -1
- package/lib/commonjs/ui/components/index.js +0 -104
- package/lib/commonjs/ui/components/index.js.map +0 -1
- package/lib/commonjs/ui/components/modals/index.js +0 -14
- package/lib/commonjs/ui/components/modals/index.js.map +0 -1
- package/lib/commonjs/ui/components/payment/index.js +0 -80
- package/lib/commonjs/ui/components/payment/index.js.map +0 -1
- package/lib/commonjs/ui/hooks/index.js +0 -92
- package/lib/commonjs/ui/hooks/index.js.map +0 -1
- package/lib/commonjs/ui/hooks/mutations/index.js +0 -68
- package/lib/commonjs/ui/hooks/mutations/index.js.map +0 -1
- package/lib/commonjs/ui/hooks/queries/index.js +0 -155
- package/lib/commonjs/ui/hooks/queries/index.js.map +0 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +0 -344
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +0 -724
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +0 -643
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +0 -1029
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/SessionManagementScreen.js +0 -512
- package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +0 -1
- package/lib/commonjs/ui/styles/index.js +0 -39
- package/lib/commonjs/ui/styles/index.js.map +0 -1
- package/lib/module/ui/components/feedback/index.js +0 -8
- package/lib/module/ui/components/feedback/index.js.map +0 -1
- package/lib/module/ui/components/icon/index.js +0 -5
- package/lib/module/ui/components/icon/index.js.map +0 -1
- package/lib/module/ui/components/index.js +0 -18
- package/lib/module/ui/components/index.js.map +0 -1
- package/lib/module/ui/components/modals/index.js +0 -4
- package/lib/module/ui/components/modals/index.js.map +0 -1
- package/lib/module/ui/components/payment/index.js +0 -10
- package/lib/module/ui/components/payment/index.js.map +0 -1
- package/lib/module/ui/hooks/index.js +0 -11
- package/lib/module/ui/hooks/index.js.map +0 -1
- package/lib/module/ui/hooks/mutations/index.js +0 -15
- package/lib/module/ui/hooks/mutations/index.js.map +0 -1
- package/lib/module/ui/hooks/queries/index.js +0 -26
- package/lib/module/ui/hooks/queries/index.js.map +0 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +0 -339
- package/lib/module/ui/screens/AccountCenterScreen.js.map +0 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js +0 -719
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +0 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +0 -638
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +0 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +0 -1024
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +0 -1
- package/lib/module/ui/screens/SessionManagementScreen.js +0 -508
- package/lib/module/ui/screens/SessionManagementScreen.js.map +0 -1
- package/lib/module/ui/styles/index.js +0 -6
- package/lib/module/ui/styles/index.js.map +0 -1
- package/lib/typescript/commonjs/ui/components/feedback/index.d.ts +0 -7
- package/lib/typescript/commonjs/ui/components/feedback/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/components/icon/index.d.ts +0 -4
- package/lib/typescript/commonjs/ui/components/icon/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/components/index.d.ts +0 -13
- package/lib/typescript/commonjs/ui/components/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/components/modals/index.d.ts +0 -2
- package/lib/typescript/commonjs/ui/components/modals/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/components/payment/index.d.ts +0 -9
- package/lib/typescript/commonjs/ui/components/payment/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/hooks/index.d.ts +0 -9
- package/lib/typescript/commonjs/ui/hooks/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/index.d.ts +0 -9
- package/lib/typescript/commonjs/ui/hooks/mutations/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/hooks/queries/index.d.ts +0 -13
- package/lib/typescript/commonjs/ui/hooks/queries/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/screens/AccountCenterScreen.d.ts +0 -5
- package/lib/typescript/commonjs/ui/screens/AccountCenterScreen.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/screens/AccountOverviewScreen.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/screens/AccountSwitcherScreen.d.ts +0 -5
- package/lib/typescript/commonjs/ui/screens/AccountSwitcherScreen.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/screens/SessionManagementScreen.d.ts +0 -5
- package/lib/typescript/commonjs/ui/screens/SessionManagementScreen.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/styles/index.d.ts +0 -4
- package/lib/typescript/commonjs/ui/styles/index.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/feedback/index.d.ts +0 -7
- package/lib/typescript/module/ui/components/feedback/index.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/icon/index.d.ts +0 -4
- package/lib/typescript/module/ui/components/icon/index.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/index.d.ts +0 -13
- package/lib/typescript/module/ui/components/index.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/modals/index.d.ts +0 -2
- package/lib/typescript/module/ui/components/modals/index.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/payment/index.d.ts +0 -9
- package/lib/typescript/module/ui/components/payment/index.d.ts.map +0 -1
- package/lib/typescript/module/ui/hooks/index.d.ts +0 -9
- package/lib/typescript/module/ui/hooks/index.d.ts.map +0 -1
- package/lib/typescript/module/ui/hooks/mutations/index.d.ts +0 -9
- package/lib/typescript/module/ui/hooks/mutations/index.d.ts.map +0 -1
- package/lib/typescript/module/ui/hooks/queries/index.d.ts +0 -13
- package/lib/typescript/module/ui/hooks/queries/index.d.ts.map +0 -1
- package/lib/typescript/module/ui/screens/AccountCenterScreen.d.ts +0 -5
- package/lib/typescript/module/ui/screens/AccountCenterScreen.d.ts.map +0 -1
- package/lib/typescript/module/ui/screens/AccountOverviewScreen.d.ts.map +0 -1
- package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +0 -1
- package/lib/typescript/module/ui/screens/AccountSwitcherScreen.d.ts +0 -5
- package/lib/typescript/module/ui/screens/AccountSwitcherScreen.d.ts.map +0 -1
- package/lib/typescript/module/ui/screens/SessionManagementScreen.d.ts +0 -5
- package/lib/typescript/module/ui/screens/SessionManagementScreen.d.ts.map +0 -1
- package/lib/typescript/module/ui/styles/index.d.ts +0 -4
- package/lib/typescript/module/ui/styles/index.d.ts.map +0 -1
- package/src/ui/components/feedback/index.ts +0 -6
- package/src/ui/components/icon/index.ts +0 -3
- package/src/ui/components/index.ts +0 -15
- package/src/ui/components/modals/index.ts +0 -1
- package/src/ui/components/payment/index.ts +0 -9
- package/src/ui/hooks/index.ts +0 -13
- package/src/ui/hooks/mutations/index.ts +0 -25
- package/src/ui/hooks/queries/index.ts +0 -61
- package/src/ui/screens/AccountCenterScreen.tsx +0 -182
- package/src/ui/screens/AccountOverviewScreen.tsx +0 -696
- package/src/ui/screens/AccountSettingsScreen.tsx +0 -620
- package/src/ui/screens/AccountSwitcherScreen.tsx +0 -1003
- package/src/ui/screens/SessionManagementScreen.tsx +0 -477
- package/src/ui/styles/index.ts +0 -3
|
@@ -0,0 +1,1102 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
View,
|
|
5
|
+
Text,
|
|
6
|
+
ScrollView,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
ActivityIndicator,
|
|
9
|
+
TouchableOpacity,
|
|
10
|
+
RefreshControl,
|
|
11
|
+
Platform,
|
|
12
|
+
} from 'react-native';
|
|
13
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
14
|
+
import { Dialog, toast, useDialogControl } from '@oxyhq/bloom';
|
|
15
|
+
import { useTheme } from '@oxyhq/bloom/theme';
|
|
16
|
+
import { SettingsListGroup, SettingsListItem } from '@oxyhq/bloom/settings-list';
|
|
17
|
+
import {
|
|
18
|
+
getAccountDisplayName,
|
|
19
|
+
getAccountFallbackHandle,
|
|
20
|
+
logger as loggerUtil,
|
|
21
|
+
packageInfo,
|
|
22
|
+
} from '@oxyhq/core';
|
|
23
|
+
import type { BaseScreenProps } from '../types/navigation';
|
|
24
|
+
import Header from '../components/Header';
|
|
25
|
+
import Avatar from '../components/Avatar';
|
|
26
|
+
import { SettingsIcon } from '../components/SettingsIcon';
|
|
27
|
+
import DeleteAccountModal from '../components/modals/DeleteAccountModal';
|
|
28
|
+
import { useOxy } from '../context/OxyContext';
|
|
29
|
+
import { useI18n } from '../hooks/useI18n';
|
|
30
|
+
import { useCurrentUser } from '../hooks/queries/useAccountQueries';
|
|
31
|
+
import { useUserSubscription } from '../hooks/queries/usePaymentQueries';
|
|
32
|
+
import { useDeviceSessions } from '../hooks/queries/useServicesQueries';
|
|
33
|
+
import { useColorScheme } from '../hooks/useColorScheme';
|
|
34
|
+
import { Colors } from '../constants/theme';
|
|
35
|
+
import { normalizeColorScheme, normalizeTheme } from '../utils/themeUtils';
|
|
36
|
+
import { screenContentStyle } from '../constants/spacing';
|
|
37
|
+
|
|
38
|
+
interface DeviceSessionRow {
|
|
39
|
+
sessionId: string;
|
|
40
|
+
deviceId: string;
|
|
41
|
+
deviceName: string;
|
|
42
|
+
isActive: boolean;
|
|
43
|
+
lastActive: string;
|
|
44
|
+
expiresAt: string;
|
|
45
|
+
isCurrent: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const formatRelative = (dateString?: string): string => {
|
|
49
|
+
if (!dateString) {
|
|
50
|
+
return '—';
|
|
51
|
+
}
|
|
52
|
+
const date = new Date(dateString);
|
|
53
|
+
const now = new Date();
|
|
54
|
+
const diffMs = date.getTime() - now.getTime();
|
|
55
|
+
const absMin = Math.abs(diffMs) / 60000;
|
|
56
|
+
const isFuture = diffMs > 0;
|
|
57
|
+
if (absMin < 1) {
|
|
58
|
+
return isFuture ? 'in moments' : 'just now';
|
|
59
|
+
}
|
|
60
|
+
if (absMin < 60) {
|
|
61
|
+
const v = Math.floor(absMin);
|
|
62
|
+
return isFuture ? `in ${v}m` : `${v}m ago`;
|
|
63
|
+
}
|
|
64
|
+
const hrs = absMin / 60;
|
|
65
|
+
if (hrs < 24) {
|
|
66
|
+
const v = Math.floor(hrs);
|
|
67
|
+
return isFuture ? `in ${v}h` : `${v}h ago`;
|
|
68
|
+
}
|
|
69
|
+
const days = hrs / 24;
|
|
70
|
+
if (days < 7) {
|
|
71
|
+
const v = Math.floor(days);
|
|
72
|
+
return isFuture ? `in ${v}d` : `${v}d ago`;
|
|
73
|
+
}
|
|
74
|
+
return date.toLocaleDateString();
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Unified "Manage your Oxy Account" screen.
|
|
79
|
+
*
|
|
80
|
+
* Replaces AccountOverview + AccountSettings + the per-account half of
|
|
81
|
+
* SessionManagement. Lists ONLY the active user's profile, sessions on this
|
|
82
|
+
* device, and security/destructive actions for THIS account. Multi-account
|
|
83
|
+
* surface lives in {@link AccountMenu} — keep these concerns separate.
|
|
84
|
+
*/
|
|
85
|
+
const ManageAccountScreen: React.FC<BaseScreenProps> = ({
|
|
86
|
+
onClose,
|
|
87
|
+
goBack,
|
|
88
|
+
navigate,
|
|
89
|
+
theme,
|
|
90
|
+
}) => {
|
|
91
|
+
const bloomTheme = useTheme();
|
|
92
|
+
const { t, locale } = useI18n();
|
|
93
|
+
const colorScheme = useColorScheme();
|
|
94
|
+
const palette = useMemo(
|
|
95
|
+
() => Colors[normalizeColorScheme(colorScheme, normalizeTheme(theme))],
|
|
96
|
+
[colorScheme, theme],
|
|
97
|
+
);
|
|
98
|
+
const {
|
|
99
|
+
user: contextUser,
|
|
100
|
+
isAuthenticated,
|
|
101
|
+
oxyServices,
|
|
102
|
+
activeSessionId,
|
|
103
|
+
logout,
|
|
104
|
+
openAvatarPicker,
|
|
105
|
+
managedAccounts,
|
|
106
|
+
} = useOxy();
|
|
107
|
+
|
|
108
|
+
const { data: userFromQuery, isLoading: userLoading } = useCurrentUser({
|
|
109
|
+
enabled: isAuthenticated,
|
|
110
|
+
});
|
|
111
|
+
const user = userFromQuery ?? contextUser;
|
|
112
|
+
|
|
113
|
+
const { data: subscription } = useUserSubscription({ enabled: isAuthenticated });
|
|
114
|
+
const {
|
|
115
|
+
data: deviceSessions,
|
|
116
|
+
isLoading: deviceSessionsLoading,
|
|
117
|
+
refetch: refetchDeviceSessions,
|
|
118
|
+
isRefetching: deviceSessionsRefetching,
|
|
119
|
+
} = useDeviceSessions({ enabled: isAuthenticated && !!activeSessionId });
|
|
120
|
+
|
|
121
|
+
const signOutDialog = useDialogControl();
|
|
122
|
+
const signOutAllDevicesDialog = useDialogControl();
|
|
123
|
+
const removeDeviceDialog = useDialogControl();
|
|
124
|
+
const downloadDataDialog = useDialogControl();
|
|
125
|
+
const deleteAccountDialog = useDialogControl();
|
|
126
|
+
|
|
127
|
+
const [pendingRemoveDevice, setPendingRemoveDevice] = useState<DeviceSessionRow | null>(null);
|
|
128
|
+
const [removingDeviceId, setRemovingDeviceId] = useState<string | null>(null);
|
|
129
|
+
const [signingOutAllDevices, setSigningOutAllDevices] = useState(false);
|
|
130
|
+
const [signingOut, setSigningOut] = useState(false);
|
|
131
|
+
|
|
132
|
+
const displayName = useMemo(() => getAccountDisplayName(user, locale), [user, locale]);
|
|
133
|
+
const handle = useMemo(() => getAccountFallbackHandle(user), [user]);
|
|
134
|
+
const avatarUri = useMemo(() => {
|
|
135
|
+
return user?.avatar
|
|
136
|
+
? oxyServices.getFileDownloadUrl(user.avatar, 'thumb')
|
|
137
|
+
: undefined;
|
|
138
|
+
}, [user?.avatar, oxyServices]);
|
|
139
|
+
|
|
140
|
+
const handleSignOut = useCallback(async () => {
|
|
141
|
+
if (signingOut) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
setSigningOut(true);
|
|
145
|
+
try {
|
|
146
|
+
await logout();
|
|
147
|
+
toast.success(t('common.actions.signedOut') || 'Signed out');
|
|
148
|
+
onClose?.();
|
|
149
|
+
} catch (error) {
|
|
150
|
+
loggerUtil.warn('Sign out failed', { component: 'ManageAccountScreen' }, error as unknown);
|
|
151
|
+
toast.error(t('common.errors.signOutFailed') || 'Failed to sign out');
|
|
152
|
+
} finally {
|
|
153
|
+
setSigningOut(false);
|
|
154
|
+
}
|
|
155
|
+
}, [signingOut, logout, t, onClose]);
|
|
156
|
+
|
|
157
|
+
const confirmRemoveDevice = useCallback((device: DeviceSessionRow) => {
|
|
158
|
+
setPendingRemoveDevice(device);
|
|
159
|
+
removeDeviceDialog.open();
|
|
160
|
+
}, [removeDeviceDialog]);
|
|
161
|
+
|
|
162
|
+
const handleRemoveDevice = useCallback(async () => {
|
|
163
|
+
if (!pendingRemoveDevice || !activeSessionId) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const target = pendingRemoveDevice;
|
|
167
|
+
setRemovingDeviceId(target.sessionId);
|
|
168
|
+
try {
|
|
169
|
+
await oxyServices.logoutSession(activeSessionId, target.sessionId);
|
|
170
|
+
await refetchDeviceSessions();
|
|
171
|
+
toast.success(
|
|
172
|
+
t('manageAccount.toasts.deviceRemoved', { name: target.deviceName })
|
|
173
|
+
|| `Signed out from ${target.deviceName}`,
|
|
174
|
+
);
|
|
175
|
+
} catch (error) {
|
|
176
|
+
loggerUtil.warn('Remove device failed', { component: 'ManageAccountScreen' }, error as unknown);
|
|
177
|
+
toast.error(t('manageAccount.toasts.deviceRemoveFailed') || 'Failed to remove device');
|
|
178
|
+
} finally {
|
|
179
|
+
setRemovingDeviceId(null);
|
|
180
|
+
setPendingRemoveDevice(null);
|
|
181
|
+
}
|
|
182
|
+
}, [pendingRemoveDevice, activeSessionId, oxyServices, refetchDeviceSessions, t]);
|
|
183
|
+
|
|
184
|
+
const handleSignOutAllDevices = useCallback(async () => {
|
|
185
|
+
if (!activeSessionId || signingOutAllDevices) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
setSigningOutAllDevices(true);
|
|
189
|
+
try {
|
|
190
|
+
await oxyServices.logoutAllDeviceSessions(activeSessionId);
|
|
191
|
+
await refetchDeviceSessions();
|
|
192
|
+
toast.success(
|
|
193
|
+
t('manageAccount.toasts.allDevicesSignedOut')
|
|
194
|
+
|| 'Signed out from all other devices',
|
|
195
|
+
);
|
|
196
|
+
} catch (error) {
|
|
197
|
+
loggerUtil.warn('Sign out all devices failed', { component: 'ManageAccountScreen' }, error as unknown);
|
|
198
|
+
toast.error(
|
|
199
|
+
t('manageAccount.toasts.allDevicesFailed')
|
|
200
|
+
|| 'Failed to sign out from other devices',
|
|
201
|
+
);
|
|
202
|
+
} finally {
|
|
203
|
+
setSigningOutAllDevices(false);
|
|
204
|
+
}
|
|
205
|
+
}, [activeSessionId, signingOutAllDevices, oxyServices, refetchDeviceSessions, t]);
|
|
206
|
+
|
|
207
|
+
const performDownload = useCallback(
|
|
208
|
+
async (format: 'json' | 'csv') => {
|
|
209
|
+
if (!user) {
|
|
210
|
+
toast.error(
|
|
211
|
+
t('accountOverview.items.downloadData.error') || 'Service not available',
|
|
212
|
+
);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
try {
|
|
216
|
+
toast.info(
|
|
217
|
+
t('accountOverview.items.downloadData.downloading')
|
|
218
|
+
|| 'Preparing download...',
|
|
219
|
+
);
|
|
220
|
+
const blob = await oxyServices.downloadAccountData(format);
|
|
221
|
+
if (Platform.OS === 'web') {
|
|
222
|
+
const url = URL.createObjectURL(blob);
|
|
223
|
+
const link = document.createElement('a');
|
|
224
|
+
link.href = url;
|
|
225
|
+
link.download = `account-data-${Date.now()}.${format}`;
|
|
226
|
+
document.body.appendChild(link);
|
|
227
|
+
link.click();
|
|
228
|
+
document.body.removeChild(link);
|
|
229
|
+
URL.revokeObjectURL(url);
|
|
230
|
+
}
|
|
231
|
+
toast.success(
|
|
232
|
+
t('accountOverview.items.downloadData.success')
|
|
233
|
+
|| 'Data downloaded successfully',
|
|
234
|
+
);
|
|
235
|
+
} catch (error) {
|
|
236
|
+
loggerUtil.warn(
|
|
237
|
+
'Download account data failed',
|
|
238
|
+
{ component: 'ManageAccountScreen' },
|
|
239
|
+
error as unknown,
|
|
240
|
+
);
|
|
241
|
+
toast.error(
|
|
242
|
+
(error instanceof Error ? error.message : null)
|
|
243
|
+
|| t('accountOverview.items.downloadData.error')
|
|
244
|
+
|| 'Failed to download data',
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
[oxyServices, user, t],
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
const handleConfirmDelete = useCallback(
|
|
252
|
+
async (confirmText: string) => {
|
|
253
|
+
if (!user) {
|
|
254
|
+
throw new Error(
|
|
255
|
+
t('accountOverview.items.deleteAccount.error')
|
|
256
|
+
|| 'Service not available',
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
await oxyServices.deleteAccount(confirmText);
|
|
260
|
+
toast.success(
|
|
261
|
+
t('accountOverview.items.deleteAccount.success')
|
|
262
|
+
|| 'Account deleted successfully',
|
|
263
|
+
);
|
|
264
|
+
deleteAccountDialog.close();
|
|
265
|
+
await logout();
|
|
266
|
+
onClose?.();
|
|
267
|
+
},
|
|
268
|
+
[oxyServices, user, logout, onClose, t, deleteAccountDialog],
|
|
269
|
+
);
|
|
270
|
+
|
|
271
|
+
const handleDownloadData = useCallback(() => {
|
|
272
|
+
if (!user) {
|
|
273
|
+
toast.error(
|
|
274
|
+
t('accountOverview.items.downloadData.error') || 'Service not available',
|
|
275
|
+
);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
downloadDataDialog.open();
|
|
279
|
+
}, [user, t, downloadDataDialog]);
|
|
280
|
+
|
|
281
|
+
const handleDeleteAccount = useCallback(() => {
|
|
282
|
+
if (!user) {
|
|
283
|
+
toast.error(
|
|
284
|
+
t('accountOverview.items.deleteAccount.error') || 'User not available',
|
|
285
|
+
);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
deleteAccountDialog.open();
|
|
289
|
+
}, [user, t, deleteAccountDialog]);
|
|
290
|
+
|
|
291
|
+
if (!isAuthenticated) {
|
|
292
|
+
return (
|
|
293
|
+
<View style={[styles.container, { backgroundColor: bloomTheme.colors.background }]}>
|
|
294
|
+
<Header
|
|
295
|
+
title={t('manageAccount.title') || 'Manage your Oxy Account'}
|
|
296
|
+
onBack={goBack || onClose}
|
|
297
|
+
elevation="subtle"
|
|
298
|
+
/>
|
|
299
|
+
<View style={styles.center}>
|
|
300
|
+
<Text style={[styles.notSignedIn, { color: bloomTheme.colors.text }]}>
|
|
301
|
+
{t('common.status.notSignedIn') || 'Not signed in'}
|
|
302
|
+
</Text>
|
|
303
|
+
</View>
|
|
304
|
+
</View>
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (userLoading && !user) {
|
|
309
|
+
return (
|
|
310
|
+
<View style={[styles.container, { backgroundColor: bloomTheme.colors.background }]}>
|
|
311
|
+
<Header
|
|
312
|
+
title={t('manageAccount.title') || 'Manage your Oxy Account'}
|
|
313
|
+
onBack={goBack || onClose}
|
|
314
|
+
elevation="subtle"
|
|
315
|
+
/>
|
|
316
|
+
<View style={styles.center}>
|
|
317
|
+
<ActivityIndicator color={bloomTheme.colors.primary} size="large" />
|
|
318
|
+
</View>
|
|
319
|
+
</View>
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
const deviceRows: DeviceSessionRow[] = (deviceSessions ?? []) as DeviceSessionRow[];
|
|
324
|
+
const otherDevices = deviceRows.filter((d) => !d.isCurrent);
|
|
325
|
+
|
|
326
|
+
return (
|
|
327
|
+
<View style={[styles.container, { backgroundColor: bloomTheme.colors.background }]}>
|
|
328
|
+
<Header
|
|
329
|
+
title={t('manageAccount.title') || 'Manage your Oxy Account'}
|
|
330
|
+
onBack={goBack || onClose}
|
|
331
|
+
elevation="subtle"
|
|
332
|
+
/>
|
|
333
|
+
<ScrollView
|
|
334
|
+
style={styles.scroll}
|
|
335
|
+
contentContainerStyle={styles.scrollContent}
|
|
336
|
+
refreshControl={
|
|
337
|
+
<RefreshControl
|
|
338
|
+
refreshing={deviceSessionsRefetching}
|
|
339
|
+
onRefresh={refetchDeviceSessions}
|
|
340
|
+
tintColor={bloomTheme.colors.primary}
|
|
341
|
+
/>
|
|
342
|
+
}
|
|
343
|
+
>
|
|
344
|
+
{/* Profile card */}
|
|
345
|
+
<View
|
|
346
|
+
style={[
|
|
347
|
+
styles.profileCard,
|
|
348
|
+
{ backgroundColor: bloomTheme.colors.card },
|
|
349
|
+
]}
|
|
350
|
+
>
|
|
351
|
+
<TouchableOpacity
|
|
352
|
+
onPress={openAvatarPicker}
|
|
353
|
+
accessibilityRole="button"
|
|
354
|
+
accessibilityLabel={t('editProfile.changeAvatar') || 'Change avatar'}
|
|
355
|
+
style={styles.avatarTouchable}
|
|
356
|
+
>
|
|
357
|
+
<Avatar uri={avatarUri} name={displayName} size={88} />
|
|
358
|
+
<View
|
|
359
|
+
style={[
|
|
360
|
+
styles.avatarBadge,
|
|
361
|
+
{ backgroundColor: bloomTheme.colors.primary },
|
|
362
|
+
]}
|
|
363
|
+
>
|
|
364
|
+
<Ionicons name="camera" size={14} color={bloomTheme.colors.negativeForeground} />
|
|
365
|
+
</View>
|
|
366
|
+
</TouchableOpacity>
|
|
367
|
+
<Text
|
|
368
|
+
style={[styles.displayName, { color: bloomTheme.colors.text }]}
|
|
369
|
+
numberOfLines={1}
|
|
370
|
+
>
|
|
371
|
+
{displayName}
|
|
372
|
+
</Text>
|
|
373
|
+
{handle ? (
|
|
374
|
+
<Text
|
|
375
|
+
style={[styles.handle, { color: bloomTheme.colors.textSecondary }]}
|
|
376
|
+
numberOfLines={1}
|
|
377
|
+
>
|
|
378
|
+
{user?.username ? `@${handle}` : handle}
|
|
379
|
+
</Text>
|
|
380
|
+
) : null}
|
|
381
|
+
{user?.email ? (
|
|
382
|
+
<Text
|
|
383
|
+
style={[styles.email, { color: bloomTheme.colors.textSecondary }]}
|
|
384
|
+
numberOfLines={1}
|
|
385
|
+
>
|
|
386
|
+
{user.email}
|
|
387
|
+
</Text>
|
|
388
|
+
) : null}
|
|
389
|
+
</View>
|
|
390
|
+
|
|
391
|
+
{/* Profile section */}
|
|
392
|
+
<SettingsListGroup title={t('manageAccount.sections.profile') || 'Profile'}>
|
|
393
|
+
<SettingsListItem
|
|
394
|
+
icon={
|
|
395
|
+
<SettingsIcon
|
|
396
|
+
name="account-circle"
|
|
397
|
+
color={palette.iconPersonalInfo}
|
|
398
|
+
/>
|
|
399
|
+
}
|
|
400
|
+
title={t('manageAccount.items.editProfile.title') || 'Edit profile'}
|
|
401
|
+
description={
|
|
402
|
+
t('manageAccount.items.editProfile.subtitle')
|
|
403
|
+
|| 'Name, username, bio, links'
|
|
404
|
+
}
|
|
405
|
+
onPress={() =>
|
|
406
|
+
navigate?.('EditProfileField', { field: 'username' })
|
|
407
|
+
}
|
|
408
|
+
/>
|
|
409
|
+
<SettingsListItem
|
|
410
|
+
icon={
|
|
411
|
+
<SettingsIcon
|
|
412
|
+
name="palette"
|
|
413
|
+
color={palette.iconData}
|
|
414
|
+
/>
|
|
415
|
+
}
|
|
416
|
+
title={t('manageAccount.items.theme.title') || 'Theme color'}
|
|
417
|
+
description={
|
|
418
|
+
t('manageAccount.items.theme.subtitle')
|
|
419
|
+
|| 'Personalize your Bloom color'
|
|
420
|
+
}
|
|
421
|
+
onPress={() =>
|
|
422
|
+
navigate?.('EditProfileField', { field: 'color' })
|
|
423
|
+
}
|
|
424
|
+
/>
|
|
425
|
+
<SettingsListItem
|
|
426
|
+
icon={
|
|
427
|
+
<SettingsIcon
|
|
428
|
+
name="eye"
|
|
429
|
+
color={palette.iconHome}
|
|
430
|
+
/>
|
|
431
|
+
}
|
|
432
|
+
title={t('editProfile.items.previewProfile.title') || 'Preview profile'}
|
|
433
|
+
description={
|
|
434
|
+
t('editProfile.items.previewProfile.subtitle')
|
|
435
|
+
|| 'See how your profile looks to others'
|
|
436
|
+
}
|
|
437
|
+
onPress={() =>
|
|
438
|
+
user?.id ? navigate?.('Profile', { userId: user.id }) : undefined
|
|
439
|
+
}
|
|
440
|
+
disabled={!user?.id}
|
|
441
|
+
/>
|
|
442
|
+
<SettingsListItem
|
|
443
|
+
icon={
|
|
444
|
+
<SettingsIcon
|
|
445
|
+
name="check-circle"
|
|
446
|
+
color={palette.iconPersonalInfo}
|
|
447
|
+
/>
|
|
448
|
+
}
|
|
449
|
+
title={
|
|
450
|
+
t('editProfile.items.verifyAccount.title') || 'Verify account'
|
|
451
|
+
}
|
|
452
|
+
description={
|
|
453
|
+
t('editProfile.items.verifyAccount.subtitle')
|
|
454
|
+
|| 'Get a verified badge'
|
|
455
|
+
}
|
|
456
|
+
onPress={() => navigate?.('AccountVerification')}
|
|
457
|
+
/>
|
|
458
|
+
</SettingsListGroup>
|
|
459
|
+
|
|
460
|
+
{/* Sessions section */}
|
|
461
|
+
<SettingsListGroup
|
|
462
|
+
title={t('manageAccount.sections.sessions') || 'Sessions & devices'}
|
|
463
|
+
>
|
|
464
|
+
{deviceSessionsLoading ? (
|
|
465
|
+
<SettingsListItem
|
|
466
|
+
icon={
|
|
467
|
+
<SettingsIcon name="sync" color={bloomTheme.colors.primary} />
|
|
468
|
+
}
|
|
469
|
+
title={
|
|
470
|
+
t('manageAccount.sessions.loading') || 'Loading sessions…'
|
|
471
|
+
}
|
|
472
|
+
rightElement={
|
|
473
|
+
<ActivityIndicator
|
|
474
|
+
color={bloomTheme.colors.primary}
|
|
475
|
+
size="small"
|
|
476
|
+
/>
|
|
477
|
+
}
|
|
478
|
+
showChevron={false}
|
|
479
|
+
disabled
|
|
480
|
+
/>
|
|
481
|
+
) : deviceRows.length === 0 ? (
|
|
482
|
+
<SettingsListItem
|
|
483
|
+
icon={
|
|
484
|
+
<SettingsIcon
|
|
485
|
+
name="cellphone"
|
|
486
|
+
color={bloomTheme.colors.textTertiary}
|
|
487
|
+
/>
|
|
488
|
+
}
|
|
489
|
+
title={t('manageAccount.sessions.empty') || 'No active sessions'}
|
|
490
|
+
showChevron={false}
|
|
491
|
+
disabled
|
|
492
|
+
/>
|
|
493
|
+
) : (
|
|
494
|
+
deviceRows.map((device) => (
|
|
495
|
+
<SettingsListItem
|
|
496
|
+
key={`device-${device.sessionId}`}
|
|
497
|
+
icon={
|
|
498
|
+
<SettingsIcon
|
|
499
|
+
name={device.isCurrent ? 'cellphone' : 'cellphone-basic'}
|
|
500
|
+
color={
|
|
501
|
+
device.isCurrent
|
|
502
|
+
? bloomTheme.colors.success
|
|
503
|
+
: bloomTheme.colors.primary
|
|
504
|
+
}
|
|
505
|
+
/>
|
|
506
|
+
}
|
|
507
|
+
title={`${device.deviceName}${device.isCurrent ? ` (${t('manageAccount.sessions.thisDevice') || 'This device'})` : ''}`}
|
|
508
|
+
description={
|
|
509
|
+
t('manageAccount.sessions.lastActive', {
|
|
510
|
+
relative: formatRelative(device.lastActive),
|
|
511
|
+
}) || `Last active ${formatRelative(device.lastActive)}`
|
|
512
|
+
}
|
|
513
|
+
onPress={
|
|
514
|
+
device.isCurrent
|
|
515
|
+
? undefined
|
|
516
|
+
: () => confirmRemoveDevice(device)
|
|
517
|
+
}
|
|
518
|
+
disabled={
|
|
519
|
+
device.isCurrent
|
|
520
|
+
|| removingDeviceId === device.sessionId
|
|
521
|
+
}
|
|
522
|
+
rightElement={
|
|
523
|
+
!device.isCurrent ? (
|
|
524
|
+
removingDeviceId === device.sessionId ? (
|
|
525
|
+
<ActivityIndicator
|
|
526
|
+
color={bloomTheme.colors.error}
|
|
527
|
+
size="small"
|
|
528
|
+
/>
|
|
529
|
+
) : (
|
|
530
|
+
<Ionicons
|
|
531
|
+
name="log-out-outline"
|
|
532
|
+
size={18}
|
|
533
|
+
color={bloomTheme.colors.error}
|
|
534
|
+
/>
|
|
535
|
+
)
|
|
536
|
+
) : undefined
|
|
537
|
+
}
|
|
538
|
+
showChevron={false}
|
|
539
|
+
/>
|
|
540
|
+
))
|
|
541
|
+
)}
|
|
542
|
+
{otherDevices.length > 0 ? (
|
|
543
|
+
<SettingsListItem
|
|
544
|
+
icon={
|
|
545
|
+
<SettingsIcon
|
|
546
|
+
name="logout"
|
|
547
|
+
color={bloomTheme.colors.error}
|
|
548
|
+
/>
|
|
549
|
+
}
|
|
550
|
+
title={
|
|
551
|
+
t('manageAccount.sessions.signOutAllOnThisDevice')
|
|
552
|
+
|| 'Sign out of all other devices'
|
|
553
|
+
}
|
|
554
|
+
description={
|
|
555
|
+
t('manageAccount.sessions.signOutAllSubtitle', {
|
|
556
|
+
count: otherDevices.length,
|
|
557
|
+
})
|
|
558
|
+
|| `End ${otherDevices.length} other device session(s)`
|
|
559
|
+
}
|
|
560
|
+
onPress={() => signOutAllDevicesDialog.open()}
|
|
561
|
+
destructive
|
|
562
|
+
showChevron={false}
|
|
563
|
+
disabled={signingOutAllDevices}
|
|
564
|
+
rightElement={
|
|
565
|
+
signingOutAllDevices ? (
|
|
566
|
+
<ActivityIndicator
|
|
567
|
+
color={bloomTheme.colors.error}
|
|
568
|
+
size="small"
|
|
569
|
+
/>
|
|
570
|
+
) : undefined
|
|
571
|
+
}
|
|
572
|
+
/>
|
|
573
|
+
) : null}
|
|
574
|
+
</SettingsListGroup>
|
|
575
|
+
|
|
576
|
+
{/* Security section */}
|
|
577
|
+
<SettingsListGroup
|
|
578
|
+
title={t('manageAccount.sections.security') || 'Security'}
|
|
579
|
+
>
|
|
580
|
+
<SettingsListItem
|
|
581
|
+
icon={
|
|
582
|
+
<SettingsIcon
|
|
583
|
+
name="shield-check"
|
|
584
|
+
color={palette.iconSecurity}
|
|
585
|
+
/>
|
|
586
|
+
}
|
|
587
|
+
title={
|
|
588
|
+
t('manageAccount.items.security.title') || 'Security settings'
|
|
589
|
+
}
|
|
590
|
+
description={
|
|
591
|
+
t('manageAccount.items.security.subtitle')
|
|
592
|
+
|| 'Password, 2FA, recovery'
|
|
593
|
+
}
|
|
594
|
+
onPress={() => navigate?.('PrivacySettings')}
|
|
595
|
+
/>
|
|
596
|
+
<SettingsListItem
|
|
597
|
+
icon={
|
|
598
|
+
<SettingsIcon
|
|
599
|
+
name="star"
|
|
600
|
+
color={palette.iconPayments}
|
|
601
|
+
/>
|
|
602
|
+
}
|
|
603
|
+
title={
|
|
604
|
+
t('accountOverview.items.premium.title') || 'Oxy+'
|
|
605
|
+
}
|
|
606
|
+
description={
|
|
607
|
+
user?.isPremium
|
|
608
|
+
? (t('accountOverview.items.premium.manage') || 'Manage your premium plan')
|
|
609
|
+
: (t('accountOverview.items.premium.upgrade') || 'Upgrade to premium features')
|
|
610
|
+
}
|
|
611
|
+
onPress={() => navigate?.('PremiumSubscription')}
|
|
612
|
+
/>
|
|
613
|
+
{user?.isPremium || subscription?.status === 'active' ? (
|
|
614
|
+
<SettingsListItem
|
|
615
|
+
icon={
|
|
616
|
+
<SettingsIcon
|
|
617
|
+
name="credit-card"
|
|
618
|
+
color={palette.iconPersonalInfo}
|
|
619
|
+
/>
|
|
620
|
+
}
|
|
621
|
+
title={
|
|
622
|
+
t('manageAccount.items.billing.title') || 'Billing'
|
|
623
|
+
}
|
|
624
|
+
description={
|
|
625
|
+
t('manageAccount.items.billing.subtitle')
|
|
626
|
+
|| 'Manage subscription and payment methods'
|
|
627
|
+
}
|
|
628
|
+
onPress={() => navigate?.('PaymentGateway')}
|
|
629
|
+
/>
|
|
630
|
+
) : null}
|
|
631
|
+
</SettingsListGroup>
|
|
632
|
+
|
|
633
|
+
{/* Account & data */}
|
|
634
|
+
<SettingsListGroup
|
|
635
|
+
title={t('accountOverview.sections.quickActions') || 'Account & data'}
|
|
636
|
+
>
|
|
637
|
+
<SettingsListItem
|
|
638
|
+
icon={
|
|
639
|
+
<SettingsIcon name="clock" color={palette.iconSecurity} />
|
|
640
|
+
}
|
|
641
|
+
title={t('accountOverview.items.history.title') || 'History'}
|
|
642
|
+
description={
|
|
643
|
+
t('accountOverview.items.history.subtitle')
|
|
644
|
+
|| 'View and manage your search history'
|
|
645
|
+
}
|
|
646
|
+
onPress={() => navigate?.('HistoryView')}
|
|
647
|
+
/>
|
|
648
|
+
<SettingsListItem
|
|
649
|
+
icon={
|
|
650
|
+
<SettingsIcon name="bookmark" color={palette.iconStorage} />
|
|
651
|
+
}
|
|
652
|
+
title={
|
|
653
|
+
t('accountOverview.items.saves.title') || 'Saves & Collections'
|
|
654
|
+
}
|
|
655
|
+
description={
|
|
656
|
+
t('accountOverview.items.saves.subtitle')
|
|
657
|
+
|| 'View your saved items and collections'
|
|
658
|
+
}
|
|
659
|
+
onPress={() => navigate?.('SavesCollections')}
|
|
660
|
+
/>
|
|
661
|
+
<SettingsListItem
|
|
662
|
+
icon={
|
|
663
|
+
<SettingsIcon name="folder" color={palette.iconStorage} />
|
|
664
|
+
}
|
|
665
|
+
title={
|
|
666
|
+
t('accountCenter.items.fileManagement.title') || 'Files'
|
|
667
|
+
}
|
|
668
|
+
description={
|
|
669
|
+
t('accountCenter.items.fileManagement.subtitle')
|
|
670
|
+
|| 'Upload, download, and manage your files'
|
|
671
|
+
}
|
|
672
|
+
onPress={() => navigate?.('FileManagement')}
|
|
673
|
+
/>
|
|
674
|
+
<SettingsListItem
|
|
675
|
+
icon={
|
|
676
|
+
<SettingsIcon
|
|
677
|
+
name="download"
|
|
678
|
+
color={palette.iconPersonalInfo}
|
|
679
|
+
/>
|
|
680
|
+
}
|
|
681
|
+
title={
|
|
682
|
+
t('accountOverview.items.downloadData.title')
|
|
683
|
+
|| 'Download your data'
|
|
684
|
+
}
|
|
685
|
+
description={
|
|
686
|
+
t('accountOverview.items.downloadData.subtitle')
|
|
687
|
+
|| 'Export a copy of your account data'
|
|
688
|
+
}
|
|
689
|
+
onPress={handleDownloadData}
|
|
690
|
+
/>
|
|
691
|
+
</SettingsListGroup>
|
|
692
|
+
|
|
693
|
+
{/* Managed accounts */}
|
|
694
|
+
{managedAccounts.length > 0 || isAuthenticated ? (
|
|
695
|
+
<SettingsListGroup
|
|
696
|
+
title={
|
|
697
|
+
t('accountCenter.sections.managedAccounts')
|
|
698
|
+
|| 'Managed accounts'
|
|
699
|
+
}
|
|
700
|
+
>
|
|
701
|
+
<SettingsListItem
|
|
702
|
+
icon={
|
|
703
|
+
<SettingsIcon
|
|
704
|
+
name="account-switch"
|
|
705
|
+
color={palette.iconStorage}
|
|
706
|
+
/>
|
|
707
|
+
}
|
|
708
|
+
title={
|
|
709
|
+
t('accountCenter.items.manageIdentities.title')
|
|
710
|
+
|| 'Manage identities'
|
|
711
|
+
}
|
|
712
|
+
description={
|
|
713
|
+
managedAccounts.length > 0
|
|
714
|
+
? (
|
|
715
|
+
t('accountCenter.items.manageIdentities.count', {
|
|
716
|
+
count: managedAccounts.length,
|
|
717
|
+
})
|
|
718
|
+
|| `${managedAccounts.length} managed ${managedAccounts.length === 1 ? 'identity' : 'identities'}`
|
|
719
|
+
)
|
|
720
|
+
: (
|
|
721
|
+
t('accountCenter.items.manageIdentities.empty')
|
|
722
|
+
|| 'Sub-accounts you control'
|
|
723
|
+
)
|
|
724
|
+
}
|
|
725
|
+
onPress={() => navigate?.('CreateManagedAccount')}
|
|
726
|
+
/>
|
|
727
|
+
<SettingsListItem
|
|
728
|
+
icon={
|
|
729
|
+
<SettingsIcon
|
|
730
|
+
name="account-plus"
|
|
731
|
+
color={palette.iconPersonalInfo}
|
|
732
|
+
/>
|
|
733
|
+
}
|
|
734
|
+
title={
|
|
735
|
+
t('accountCenter.items.createIdentity.title')
|
|
736
|
+
|| 'Create new identity'
|
|
737
|
+
}
|
|
738
|
+
description={
|
|
739
|
+
t('accountCenter.items.createIdentity.subtitle')
|
|
740
|
+
|| 'Add a managed sub-account'
|
|
741
|
+
}
|
|
742
|
+
onPress={() => navigate?.('CreateManagedAccount')}
|
|
743
|
+
/>
|
|
744
|
+
</SettingsListGroup>
|
|
745
|
+
) : null}
|
|
746
|
+
|
|
747
|
+
{/* Preferences */}
|
|
748
|
+
<SettingsListGroup
|
|
749
|
+
title={t('manageAccount.sections.preferences') || 'Preferences'}
|
|
750
|
+
>
|
|
751
|
+
<SettingsListItem
|
|
752
|
+
icon={
|
|
753
|
+
<SettingsIcon name="cog" color={palette.iconData} />
|
|
754
|
+
}
|
|
755
|
+
title={t('preferences.title') || 'Preferences'}
|
|
756
|
+
description={
|
|
757
|
+
t('preferences.subtitle')
|
|
758
|
+
|| 'Theme, motion, and regional settings'
|
|
759
|
+
}
|
|
760
|
+
onPress={() => navigate?.('Preferences')}
|
|
761
|
+
/>
|
|
762
|
+
<SettingsListItem
|
|
763
|
+
icon={
|
|
764
|
+
<SettingsIcon name="bell" color={palette.iconPersonalInfo} />
|
|
765
|
+
}
|
|
766
|
+
title={t('notifications.title') || 'Notifications'}
|
|
767
|
+
description={
|
|
768
|
+
t('notifications.subtitle')
|
|
769
|
+
|| 'Manage push, email, and security alerts'
|
|
770
|
+
}
|
|
771
|
+
onPress={() => navigate?.('Notifications')}
|
|
772
|
+
/>
|
|
773
|
+
<SettingsListItem
|
|
774
|
+
icon={
|
|
775
|
+
<SettingsIcon name="translate" color={palette.iconPersonalInfo} />
|
|
776
|
+
}
|
|
777
|
+
title={t('language.title') || 'Language'}
|
|
778
|
+
description={
|
|
779
|
+
t('language.subtitle') || 'Choose your preferred language'
|
|
780
|
+
}
|
|
781
|
+
onPress={() => navigate?.('LanguageSelector')}
|
|
782
|
+
/>
|
|
783
|
+
<SettingsListItem
|
|
784
|
+
icon={
|
|
785
|
+
<SettingsIcon name="apps" color={palette.iconData} />
|
|
786
|
+
}
|
|
787
|
+
title={t('connectedApps.title') || 'Connected apps'}
|
|
788
|
+
description={
|
|
789
|
+
t('connectedApps.subtitle')
|
|
790
|
+
|| 'Manage third-party app access'
|
|
791
|
+
}
|
|
792
|
+
onPress={() => navigate?.('ConnectedApps')}
|
|
793
|
+
/>
|
|
794
|
+
<SettingsListItem
|
|
795
|
+
icon={
|
|
796
|
+
<SettingsIcon name="magnify" color={palette.iconSecurity} />
|
|
797
|
+
}
|
|
798
|
+
title={
|
|
799
|
+
t('accountOverview.items.searchSettings.title') || 'Search settings'
|
|
800
|
+
}
|
|
801
|
+
description={
|
|
802
|
+
t('accountOverview.items.searchSettings.subtitle')
|
|
803
|
+
|| 'SafeSearch and personalization'
|
|
804
|
+
}
|
|
805
|
+
onPress={() => navigate?.('SearchSettings')}
|
|
806
|
+
/>
|
|
807
|
+
</SettingsListGroup>
|
|
808
|
+
|
|
809
|
+
{/* Support */}
|
|
810
|
+
<SettingsListGroup
|
|
811
|
+
title={t('accountOverview.sections.support') || 'Support'}
|
|
812
|
+
>
|
|
813
|
+
<SettingsListItem
|
|
814
|
+
icon={
|
|
815
|
+
<SettingsIcon name="help-circle" color={palette.iconSecurity} />
|
|
816
|
+
}
|
|
817
|
+
title={t('accountOverview.items.help.title') || 'Help & support'}
|
|
818
|
+
description={
|
|
819
|
+
t('accountOverview.items.help.subtitle')
|
|
820
|
+
|| 'Get help and contact support'
|
|
821
|
+
}
|
|
822
|
+
onPress={() => navigate?.('HelpSupport')}
|
|
823
|
+
/>
|
|
824
|
+
<SettingsListItem
|
|
825
|
+
icon={
|
|
826
|
+
<SettingsIcon
|
|
827
|
+
name="message-text"
|
|
828
|
+
color={palette.iconData}
|
|
829
|
+
/>
|
|
830
|
+
}
|
|
831
|
+
title={t('feedback.title') || 'Send feedback'}
|
|
832
|
+
description={
|
|
833
|
+
t('feedback.subtitle') || 'Tell us what you think'
|
|
834
|
+
}
|
|
835
|
+
onPress={() => navigate?.('Feedback')}
|
|
836
|
+
/>
|
|
837
|
+
<SettingsListItem
|
|
838
|
+
icon={
|
|
839
|
+
<SettingsIcon name="information" color={palette.iconHome} />
|
|
840
|
+
}
|
|
841
|
+
title={t('accountOverview.items.about.title') || 'About'}
|
|
842
|
+
description={
|
|
843
|
+
t('accountOverview.items.about.subtitle')
|
|
844
|
+
|| 'Version and system details'
|
|
845
|
+
}
|
|
846
|
+
onPress={() => navigate?.('AppInfo')}
|
|
847
|
+
/>
|
|
848
|
+
</SettingsListGroup>
|
|
849
|
+
|
|
850
|
+
{/* Legal */}
|
|
851
|
+
<SettingsListGroup
|
|
852
|
+
title={t('manageAccount.sections.legal') || 'Legal'}
|
|
853
|
+
>
|
|
854
|
+
<SettingsListItem
|
|
855
|
+
icon={
|
|
856
|
+
<SettingsIcon
|
|
857
|
+
name="shield-check"
|
|
858
|
+
color={palette.iconPersonalInfo}
|
|
859
|
+
/>
|
|
860
|
+
}
|
|
861
|
+
title={
|
|
862
|
+
t('accountOverview.items.privacyPolicy.title') || 'Privacy policy'
|
|
863
|
+
}
|
|
864
|
+
description={
|
|
865
|
+
t('accountOverview.items.privacyPolicy.subtitle')
|
|
866
|
+
|| 'How we handle your data'
|
|
867
|
+
}
|
|
868
|
+
onPress={() => navigate?.('LegalDocuments', { initialStep: 1 })}
|
|
869
|
+
/>
|
|
870
|
+
<SettingsListItem
|
|
871
|
+
icon={
|
|
872
|
+
<SettingsIcon
|
|
873
|
+
name="file-document"
|
|
874
|
+
color={palette.iconSecurity}
|
|
875
|
+
/>
|
|
876
|
+
}
|
|
877
|
+
title={
|
|
878
|
+
t('accountOverview.items.termsOfService.title') || 'Terms of service'
|
|
879
|
+
}
|
|
880
|
+
description={
|
|
881
|
+
t('accountOverview.items.termsOfService.subtitle')
|
|
882
|
+
|| 'Terms and conditions of use'
|
|
883
|
+
}
|
|
884
|
+
onPress={() => navigate?.('LegalDocuments', { initialStep: 2 })}
|
|
885
|
+
/>
|
|
886
|
+
</SettingsListGroup>
|
|
887
|
+
|
|
888
|
+
{/* Danger zone */}
|
|
889
|
+
<SettingsListGroup
|
|
890
|
+
title={t('manageAccount.sections.dangerZone') || 'Danger zone'}
|
|
891
|
+
>
|
|
892
|
+
<SettingsListItem
|
|
893
|
+
icon={
|
|
894
|
+
<SettingsIcon name="delete" color={bloomTheme.colors.error} />
|
|
895
|
+
}
|
|
896
|
+
title={
|
|
897
|
+
t('accountOverview.items.deleteAccount.title') || 'Delete account'
|
|
898
|
+
}
|
|
899
|
+
description={
|
|
900
|
+
t('accountOverview.items.deleteAccount.subtitle')
|
|
901
|
+
|| 'Permanently delete your account and all data'
|
|
902
|
+
}
|
|
903
|
+
onPress={handleDeleteAccount}
|
|
904
|
+
destructive
|
|
905
|
+
/>
|
|
906
|
+
</SettingsListGroup>
|
|
907
|
+
|
|
908
|
+
{/* Sign out of this account */}
|
|
909
|
+
<SettingsListGroup>
|
|
910
|
+
<SettingsListItem
|
|
911
|
+
icon={
|
|
912
|
+
<SettingsIcon name="logout" color={bloomTheme.colors.error} />
|
|
913
|
+
}
|
|
914
|
+
title={
|
|
915
|
+
t('manageAccount.signOutOfThisAccount')
|
|
916
|
+
|| 'Sign out of this account'
|
|
917
|
+
}
|
|
918
|
+
onPress={() => signOutDialog.open()}
|
|
919
|
+
destructive
|
|
920
|
+
showChevron={false}
|
|
921
|
+
disabled={signingOut}
|
|
922
|
+
rightElement={
|
|
923
|
+
signingOut ? (
|
|
924
|
+
<ActivityIndicator
|
|
925
|
+
color={bloomTheme.colors.error}
|
|
926
|
+
size="small"
|
|
927
|
+
/>
|
|
928
|
+
) : undefined
|
|
929
|
+
}
|
|
930
|
+
/>
|
|
931
|
+
</SettingsListGroup>
|
|
932
|
+
|
|
933
|
+
<View style={styles.versionContainer}>
|
|
934
|
+
<Text
|
|
935
|
+
style={[
|
|
936
|
+
styles.versionText,
|
|
937
|
+
{ color: bloomTheme.colors.textTertiary },
|
|
938
|
+
]}
|
|
939
|
+
>
|
|
940
|
+
{t('accountCenter.version', { version: packageInfo.version })
|
|
941
|
+
|| `Version ${packageInfo.version}`}
|
|
942
|
+
</Text>
|
|
943
|
+
</View>
|
|
944
|
+
|
|
945
|
+
<View style={styles.footerSpacer} />
|
|
946
|
+
</ScrollView>
|
|
947
|
+
|
|
948
|
+
<Dialog
|
|
949
|
+
control={signOutDialog}
|
|
950
|
+
title={t('common.actions.signOut') || 'Sign out'}
|
|
951
|
+
description={
|
|
952
|
+
t('common.confirms.signOut')
|
|
953
|
+
|| 'Are you sure you want to sign out?'
|
|
954
|
+
}
|
|
955
|
+
actions={[
|
|
956
|
+
{
|
|
957
|
+
label: t('common.actions.signOut') || 'Sign out',
|
|
958
|
+
color: 'destructive',
|
|
959
|
+
onPress: handleSignOut,
|
|
960
|
+
},
|
|
961
|
+
{ label: t('common.cancel') || 'Cancel', color: 'cancel' },
|
|
962
|
+
]}
|
|
963
|
+
/>
|
|
964
|
+
<Dialog
|
|
965
|
+
control={signOutAllDevicesDialog}
|
|
966
|
+
title={
|
|
967
|
+
t('manageAccount.confirms.signOutAllDevicesTitle')
|
|
968
|
+
|| 'Sign out of all other devices'
|
|
969
|
+
}
|
|
970
|
+
description={
|
|
971
|
+
t('manageAccount.confirms.signOutAllDevices', {
|
|
972
|
+
count: otherDevices.length,
|
|
973
|
+
})
|
|
974
|
+
|| `End ${otherDevices.length} other device session(s)? This won't sign you out here.`
|
|
975
|
+
}
|
|
976
|
+
actions={[
|
|
977
|
+
{
|
|
978
|
+
label: t('common.actions.signOut') || 'Sign out',
|
|
979
|
+
color: 'destructive',
|
|
980
|
+
onPress: handleSignOutAllDevices,
|
|
981
|
+
},
|
|
982
|
+
{ label: t('common.cancel') || 'Cancel', color: 'cancel' },
|
|
983
|
+
]}
|
|
984
|
+
/>
|
|
985
|
+
<Dialog
|
|
986
|
+
control={removeDeviceDialog}
|
|
987
|
+
title={
|
|
988
|
+
t('manageAccount.confirms.removeDeviceTitle') || 'Remove device'
|
|
989
|
+
}
|
|
990
|
+
description={
|
|
991
|
+
pendingRemoveDevice
|
|
992
|
+
? (t('manageAccount.confirms.removeDevice', {
|
|
993
|
+
name: pendingRemoveDevice.deviceName,
|
|
994
|
+
})
|
|
995
|
+
|| `Sign out from "${pendingRemoveDevice.deviceName}"?`)
|
|
996
|
+
: ''
|
|
997
|
+
}
|
|
998
|
+
actions={[
|
|
999
|
+
{
|
|
1000
|
+
label: t('common.remove') || 'Remove',
|
|
1001
|
+
color: 'destructive',
|
|
1002
|
+
onPress: handleRemoveDevice,
|
|
1003
|
+
},
|
|
1004
|
+
{ label: t('common.cancel') || 'Cancel', color: 'cancel' },
|
|
1005
|
+
]}
|
|
1006
|
+
/>
|
|
1007
|
+
<Dialog
|
|
1008
|
+
control={downloadDataDialog}
|
|
1009
|
+
title={
|
|
1010
|
+
t('accountOverview.items.downloadData.confirmTitle')
|
|
1011
|
+
|| 'Download account data'
|
|
1012
|
+
}
|
|
1013
|
+
description={
|
|
1014
|
+
t('accountOverview.items.downloadData.confirmMessage')
|
|
1015
|
+
|| 'Choose the format for your account data export:'
|
|
1016
|
+
}
|
|
1017
|
+
actions={[
|
|
1018
|
+
{ label: 'JSON', onPress: () => performDownload('json') },
|
|
1019
|
+
{ label: 'CSV', onPress: () => performDownload('csv') },
|
|
1020
|
+
{ label: t('common.cancel') || 'Cancel', color: 'cancel' },
|
|
1021
|
+
]}
|
|
1022
|
+
/>
|
|
1023
|
+
{user ? (
|
|
1024
|
+
<DeleteAccountModal
|
|
1025
|
+
control={deleteAccountDialog}
|
|
1026
|
+
username={user.username || ''}
|
|
1027
|
+
onDelete={handleConfirmDelete}
|
|
1028
|
+
t={t}
|
|
1029
|
+
/>
|
|
1030
|
+
) : null}
|
|
1031
|
+
</View>
|
|
1032
|
+
);
|
|
1033
|
+
};
|
|
1034
|
+
|
|
1035
|
+
const styles = StyleSheet.create({
|
|
1036
|
+
container: {
|
|
1037
|
+
flex: 1,
|
|
1038
|
+
},
|
|
1039
|
+
center: {
|
|
1040
|
+
flex: 1,
|
|
1041
|
+
alignItems: 'center',
|
|
1042
|
+
justifyContent: 'center',
|
|
1043
|
+
},
|
|
1044
|
+
notSignedIn: {
|
|
1045
|
+
fontSize: 16,
|
|
1046
|
+
},
|
|
1047
|
+
scroll: {
|
|
1048
|
+
flex: 1,
|
|
1049
|
+
},
|
|
1050
|
+
scrollContent: {
|
|
1051
|
+
...screenContentStyle,
|
|
1052
|
+
paddingTop: 0,
|
|
1053
|
+
},
|
|
1054
|
+
profileCard: {
|
|
1055
|
+
alignItems: 'center',
|
|
1056
|
+
paddingVertical: 24,
|
|
1057
|
+
paddingHorizontal: 20,
|
|
1058
|
+
borderRadius: 24,
|
|
1059
|
+
marginBottom: 16,
|
|
1060
|
+
},
|
|
1061
|
+
avatarTouchable: {
|
|
1062
|
+
position: 'relative',
|
|
1063
|
+
marginBottom: 12,
|
|
1064
|
+
},
|
|
1065
|
+
avatarBadge: {
|
|
1066
|
+
position: 'absolute',
|
|
1067
|
+
right: 0,
|
|
1068
|
+
bottom: 0,
|
|
1069
|
+
width: 28,
|
|
1070
|
+
height: 28,
|
|
1071
|
+
borderRadius: 14,
|
|
1072
|
+
alignItems: 'center',
|
|
1073
|
+
justifyContent: 'center',
|
|
1074
|
+
borderWidth: 2,
|
|
1075
|
+
borderColor: '#fff',
|
|
1076
|
+
},
|
|
1077
|
+
displayName: {
|
|
1078
|
+
fontSize: 22,
|
|
1079
|
+
fontWeight: '700',
|
|
1080
|
+
marginBottom: 4,
|
|
1081
|
+
},
|
|
1082
|
+
handle: {
|
|
1083
|
+
fontSize: 14,
|
|
1084
|
+
marginBottom: 2,
|
|
1085
|
+
},
|
|
1086
|
+
email: {
|
|
1087
|
+
fontSize: 14,
|
|
1088
|
+
},
|
|
1089
|
+
footerSpacer: {
|
|
1090
|
+
height: 24,
|
|
1091
|
+
},
|
|
1092
|
+
versionContainer: {
|
|
1093
|
+
alignItems: 'center',
|
|
1094
|
+
marginTop: 12,
|
|
1095
|
+
marginBottom: 8,
|
|
1096
|
+
},
|
|
1097
|
+
versionText: {
|
|
1098
|
+
fontSize: 12,
|
|
1099
|
+
},
|
|
1100
|
+
});
|
|
1101
|
+
|
|
1102
|
+
export default ManageAccountScreen;
|