@oxyhq/services 6.10.7 → 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 +211 -21
- 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 +211 -21
- 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/queries/useSecurityQueries.d.ts +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useSecurityQueries.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/queries/useSecurityQueries.d.ts +1 -1
- package/lib/typescript/module/ui/hooks/queries/useSecurityQueries.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 +204 -18
- 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,534 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
View,
|
|
5
|
+
Text,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
ScrollView,
|
|
9
|
+
Modal,
|
|
10
|
+
Pressable,
|
|
11
|
+
Platform,
|
|
12
|
+
ActivityIndicator,
|
|
13
|
+
type ViewStyle,
|
|
14
|
+
} from 'react-native';
|
|
15
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
16
|
+
import { toast, useDialogControl, Dialog } from '@oxyhq/bloom';
|
|
17
|
+
import { useTheme } from '@oxyhq/bloom/theme';
|
|
18
|
+
import Avatar from './Avatar';
|
|
19
|
+
import { useOxy } from '../context/OxyContext';
|
|
20
|
+
import { useI18n } from '../hooks/useI18n';
|
|
21
|
+
import { logger as loggerUtil } from '@oxyhq/core';
|
|
22
|
+
import { buildAccountRows, type AccountRow } from './accountMenuRows';
|
|
23
|
+
|
|
24
|
+
export interface AccountMenuProps {
|
|
25
|
+
open: boolean;
|
|
26
|
+
onClose: () => void;
|
|
27
|
+
onNavigateManage: () => void;
|
|
28
|
+
onAddAccount: () => void;
|
|
29
|
+
/** Optional anchor coords (web only). Native ignores this and uses bottom-sheet style. */
|
|
30
|
+
anchor?: { top: number; right: number } | null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const isWeb = Platform.OS === 'web';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Reusable account menu modeled after the Google account chooser. Opens from
|
|
37
|
+
* the avatar entry point (`AccountMenuButton`) or any other trigger.
|
|
38
|
+
*
|
|
39
|
+
* Reads everything it needs from `useOxy()` — never receive a session via
|
|
40
|
+
* props. Renders as a popover anchored to the trigger on web, and as a
|
|
41
|
+
* full-width bottom-sheet style modal on native.
|
|
42
|
+
*/
|
|
43
|
+
const AccountMenu: React.FC<AccountMenuProps> = ({
|
|
44
|
+
open,
|
|
45
|
+
onClose,
|
|
46
|
+
onNavigateManage,
|
|
47
|
+
onAddAccount,
|
|
48
|
+
anchor,
|
|
49
|
+
}) => {
|
|
50
|
+
const {
|
|
51
|
+
user,
|
|
52
|
+
sessions,
|
|
53
|
+
activeSessionId,
|
|
54
|
+
switchSession,
|
|
55
|
+
logout,
|
|
56
|
+
logoutAll,
|
|
57
|
+
oxyServices,
|
|
58
|
+
} = useOxy();
|
|
59
|
+
const { t, locale } = useI18n();
|
|
60
|
+
const bloomTheme = useTheme();
|
|
61
|
+
|
|
62
|
+
const [busySessionId, setBusySessionId] = useState<string | null>(null);
|
|
63
|
+
const [signingOut, setSigningOut] = useState(false);
|
|
64
|
+
const [signingOutAll, setSigningOutAll] = useState(false);
|
|
65
|
+
|
|
66
|
+
const signOutDialog = useDialogControl();
|
|
67
|
+
const signOutAllDialog = useDialogControl();
|
|
68
|
+
|
|
69
|
+
const containerRef = useRef<View | null>(null);
|
|
70
|
+
const firstActionRef = useRef<View | null>(null);
|
|
71
|
+
|
|
72
|
+
const rows = useMemo<AccountRow[]>(() => buildAccountRows({
|
|
73
|
+
sessions,
|
|
74
|
+
activeSessionId,
|
|
75
|
+
user,
|
|
76
|
+
locale,
|
|
77
|
+
getAvatarUrl: (avatarId) => oxyServices.getFileDownloadUrl(avatarId, 'thumb'),
|
|
78
|
+
}), [sessions, activeSessionId, user, locale, oxyServices]);
|
|
79
|
+
|
|
80
|
+
const activeRow = useMemo<AccountRow | null>(() => {
|
|
81
|
+
return rows.find((r) => r.isActive) ?? null;
|
|
82
|
+
}, [rows]);
|
|
83
|
+
|
|
84
|
+
const inactiveRows = useMemo<AccountRow[]>(() => {
|
|
85
|
+
return rows.filter((r) => !r.isActive);
|
|
86
|
+
}, [rows]);
|
|
87
|
+
|
|
88
|
+
const handleSwitch = useCallback(async (sessionId: string) => {
|
|
89
|
+
if (sessionId === activeSessionId || busySessionId) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
setBusySessionId(sessionId);
|
|
93
|
+
try {
|
|
94
|
+
await switchSession(sessionId);
|
|
95
|
+
toast.success(t('accountSwitcher.toasts.switchSuccess') || 'Switched account');
|
|
96
|
+
onClose();
|
|
97
|
+
} catch (error) {
|
|
98
|
+
if (!__DEV__) {
|
|
99
|
+
loggerUtil.warn('Switch account failed', { component: 'AccountMenu' }, error as unknown);
|
|
100
|
+
}
|
|
101
|
+
toast.error(t('accountSwitcher.toasts.switchFailed') || 'Failed to switch account');
|
|
102
|
+
} finally {
|
|
103
|
+
setBusySessionId(null);
|
|
104
|
+
}
|
|
105
|
+
}, [activeSessionId, busySessionId, switchSession, t, onClose]);
|
|
106
|
+
|
|
107
|
+
const performSignOut = useCallback(async () => {
|
|
108
|
+
if (signingOut) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
setSigningOut(true);
|
|
112
|
+
try {
|
|
113
|
+
await logout();
|
|
114
|
+
toast.success(t('common.actions.signedOut') || 'Signed out');
|
|
115
|
+
onClose();
|
|
116
|
+
} catch (error) {
|
|
117
|
+
loggerUtil.warn('Sign out failed', { component: 'AccountMenu' }, error as unknown);
|
|
118
|
+
toast.error(t('common.errors.signOutFailed') || 'Failed to sign out');
|
|
119
|
+
} finally {
|
|
120
|
+
setSigningOut(false);
|
|
121
|
+
}
|
|
122
|
+
}, [signingOut, logout, t, onClose]);
|
|
123
|
+
|
|
124
|
+
const performSignOutAll = useCallback(async () => {
|
|
125
|
+
if (signingOutAll) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
setSigningOutAll(true);
|
|
129
|
+
try {
|
|
130
|
+
await logoutAll();
|
|
131
|
+
toast.success(t('accountSwitcher.toasts.signOutAllSuccess') || 'Signed out of all accounts');
|
|
132
|
+
onClose();
|
|
133
|
+
} catch (error) {
|
|
134
|
+
loggerUtil.warn('Sign out all failed', { component: 'AccountMenu' }, error as unknown);
|
|
135
|
+
toast.error(t('common.errors.signOutAllFailed') || 'Failed to sign out of all accounts');
|
|
136
|
+
} finally {
|
|
137
|
+
setSigningOutAll(false);
|
|
138
|
+
}
|
|
139
|
+
}, [signingOutAll, logoutAll, t, onClose]);
|
|
140
|
+
|
|
141
|
+
// Escape-to-close + focus management (web only).
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
if (!open || !isWeb || typeof document === 'undefined') {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
const onKey = (event: KeyboardEvent) => {
|
|
147
|
+
if (event.key === 'Escape') {
|
|
148
|
+
event.stopPropagation();
|
|
149
|
+
onClose();
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
document.addEventListener('keydown', onKey, true);
|
|
153
|
+
return () => document.removeEventListener('keydown', onKey, true);
|
|
154
|
+
}, [open, onClose]);
|
|
155
|
+
|
|
156
|
+
if (!open) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const overlayStyles: ViewStyle = isWeb
|
|
161
|
+
? styles.webOverlay
|
|
162
|
+
: styles.nativeOverlay;
|
|
163
|
+
|
|
164
|
+
const panelStyles: ViewStyle[] = isWeb
|
|
165
|
+
? [
|
|
166
|
+
styles.panelBase,
|
|
167
|
+
styles.panelWeb,
|
|
168
|
+
anchor
|
|
169
|
+
? { top: anchor.top, right: anchor.right }
|
|
170
|
+
: { top: 64, right: 16 },
|
|
171
|
+
{ backgroundColor: bloomTheme.colors.background, borderColor: bloomTheme.colors.border },
|
|
172
|
+
]
|
|
173
|
+
: [
|
|
174
|
+
styles.panelBase,
|
|
175
|
+
styles.panelNative,
|
|
176
|
+
{ backgroundColor: bloomTheme.colors.background },
|
|
177
|
+
];
|
|
178
|
+
|
|
179
|
+
const content = (
|
|
180
|
+
<View
|
|
181
|
+
ref={containerRef}
|
|
182
|
+
style={panelStyles}
|
|
183
|
+
accessibilityRole="menu"
|
|
184
|
+
accessibilityLabel={t('accountMenu.label') || 'Account menu'}
|
|
185
|
+
>
|
|
186
|
+
{/* 1) Header */}
|
|
187
|
+
{activeRow ? (
|
|
188
|
+
<View style={styles.header}>
|
|
189
|
+
<Avatar
|
|
190
|
+
uri={activeRow.avatarUri}
|
|
191
|
+
name={activeRow.displayName}
|
|
192
|
+
size={64}
|
|
193
|
+
/>
|
|
194
|
+
<Text
|
|
195
|
+
style={[styles.headerName, { color: bloomTheme.colors.text }]}
|
|
196
|
+
numberOfLines={1}
|
|
197
|
+
>
|
|
198
|
+
{activeRow.displayName}
|
|
199
|
+
</Text>
|
|
200
|
+
{activeRow.secondary ? (
|
|
201
|
+
<Text
|
|
202
|
+
style={[styles.headerSecondary, { color: bloomTheme.colors.textSecondary }]}
|
|
203
|
+
numberOfLines={1}
|
|
204
|
+
>
|
|
205
|
+
{activeRow.secondary}
|
|
206
|
+
</Text>
|
|
207
|
+
) : null}
|
|
208
|
+
</View>
|
|
209
|
+
) : (
|
|
210
|
+
<View style={styles.header}>
|
|
211
|
+
<Text style={[styles.headerName, { color: bloomTheme.colors.text }]}>
|
|
212
|
+
{t('common.status.notSignedIn') || 'Not signed in'}
|
|
213
|
+
</Text>
|
|
214
|
+
</View>
|
|
215
|
+
)}
|
|
216
|
+
|
|
217
|
+
{/* 2) Manage account */}
|
|
218
|
+
<TouchableOpacity
|
|
219
|
+
ref={firstActionRef as React.RefObject<View>}
|
|
220
|
+
accessibilityRole="menuitem"
|
|
221
|
+
accessibilityLabel={t('accountMenu.manage') || 'Manage your Oxy Account'}
|
|
222
|
+
style={[styles.primaryButton, { borderColor: bloomTheme.colors.border }]}
|
|
223
|
+
onPress={() => {
|
|
224
|
+
onClose();
|
|
225
|
+
onNavigateManage();
|
|
226
|
+
}}
|
|
227
|
+
>
|
|
228
|
+
<Text style={[styles.primaryButtonText, { color: bloomTheme.colors.primary }]}>
|
|
229
|
+
{t('accountMenu.manage') || 'Manage your Oxy Account'}
|
|
230
|
+
</Text>
|
|
231
|
+
</TouchableOpacity>
|
|
232
|
+
|
|
233
|
+
{/* 3) Account list */}
|
|
234
|
+
{rows.length > 0 ? (
|
|
235
|
+
<ScrollView
|
|
236
|
+
style={styles.list}
|
|
237
|
+
contentContainerStyle={styles.listContent}
|
|
238
|
+
showsVerticalScrollIndicator={false}
|
|
239
|
+
>
|
|
240
|
+
{rows.map((row) => {
|
|
241
|
+
const isBusy = busySessionId === row.sessionId;
|
|
242
|
+
return (
|
|
243
|
+
<TouchableOpacity
|
|
244
|
+
key={`account-${row.sessionId}`}
|
|
245
|
+
accessibilityRole="menuitem"
|
|
246
|
+
accessibilityLabel={row.displayName}
|
|
247
|
+
accessibilityState={{ selected: row.isActive }}
|
|
248
|
+
onPress={() => handleSwitch(row.sessionId)}
|
|
249
|
+
disabled={row.isActive || isBusy}
|
|
250
|
+
style={[
|
|
251
|
+
styles.row,
|
|
252
|
+
row.isActive && {
|
|
253
|
+
backgroundColor: bloomTheme.colors.primarySubtle,
|
|
254
|
+
},
|
|
255
|
+
]}
|
|
256
|
+
>
|
|
257
|
+
<Avatar
|
|
258
|
+
uri={row.avatarUri}
|
|
259
|
+
name={row.displayName}
|
|
260
|
+
size={36}
|
|
261
|
+
/>
|
|
262
|
+
<View style={styles.rowInfo}>
|
|
263
|
+
<Text
|
|
264
|
+
style={[styles.rowName, { color: bloomTheme.colors.text }]}
|
|
265
|
+
numberOfLines={1}
|
|
266
|
+
>
|
|
267
|
+
{row.displayName}
|
|
268
|
+
</Text>
|
|
269
|
+
{row.secondary ? (
|
|
270
|
+
<Text
|
|
271
|
+
style={[styles.rowSecondary, { color: bloomTheme.colors.textSecondary }]}
|
|
272
|
+
numberOfLines={1}
|
|
273
|
+
>
|
|
274
|
+
{row.secondary}
|
|
275
|
+
</Text>
|
|
276
|
+
) : null}
|
|
277
|
+
</View>
|
|
278
|
+
{isBusy ? (
|
|
279
|
+
<ActivityIndicator color={bloomTheme.colors.primary} size="small" />
|
|
280
|
+
) : row.isActive ? (
|
|
281
|
+
<Ionicons
|
|
282
|
+
name="checkmark-circle"
|
|
283
|
+
size={20}
|
|
284
|
+
color={bloomTheme.colors.primary}
|
|
285
|
+
/>
|
|
286
|
+
) : null}
|
|
287
|
+
</TouchableOpacity>
|
|
288
|
+
);
|
|
289
|
+
})}
|
|
290
|
+
</ScrollView>
|
|
291
|
+
) : null}
|
|
292
|
+
|
|
293
|
+
{/* 4) Add another account */}
|
|
294
|
+
<TouchableOpacity
|
|
295
|
+
accessibilityRole="menuitem"
|
|
296
|
+
accessibilityLabel={t('accountMenu.addAnother') || 'Add another account'}
|
|
297
|
+
onPress={() => {
|
|
298
|
+
onClose();
|
|
299
|
+
onAddAccount();
|
|
300
|
+
}}
|
|
301
|
+
style={[styles.row, styles.actionRow]}
|
|
302
|
+
>
|
|
303
|
+
<View
|
|
304
|
+
style={[
|
|
305
|
+
styles.actionIcon,
|
|
306
|
+
{ backgroundColor: bloomTheme.colors.primarySubtle },
|
|
307
|
+
]}
|
|
308
|
+
>
|
|
309
|
+
<Ionicons
|
|
310
|
+
name="person-add-outline"
|
|
311
|
+
size={18}
|
|
312
|
+
color={bloomTheme.colors.primary}
|
|
313
|
+
/>
|
|
314
|
+
</View>
|
|
315
|
+
<View style={styles.rowInfo}>
|
|
316
|
+
<Text style={[styles.rowName, { color: bloomTheme.colors.text }]}>
|
|
317
|
+
{t('accountMenu.addAnother') || 'Add another account'}
|
|
318
|
+
</Text>
|
|
319
|
+
</View>
|
|
320
|
+
</TouchableOpacity>
|
|
321
|
+
|
|
322
|
+
{/* 5) Sign out + sign out of all */}
|
|
323
|
+
<View style={[styles.footer, { borderTopColor: bloomTheme.colors.border }]}>
|
|
324
|
+
<TouchableOpacity
|
|
325
|
+
accessibilityRole="menuitem"
|
|
326
|
+
accessibilityLabel={t('common.actions.signOut') || 'Sign out'}
|
|
327
|
+
onPress={() => signOutDialog.open()}
|
|
328
|
+
disabled={signingOut || signingOutAll}
|
|
329
|
+
style={styles.footerButton}
|
|
330
|
+
>
|
|
331
|
+
{signingOut ? (
|
|
332
|
+
<ActivityIndicator color={bloomTheme.colors.error} size="small" />
|
|
333
|
+
) : (
|
|
334
|
+
<Text style={[styles.footerButtonText, { color: bloomTheme.colors.error }]}>
|
|
335
|
+
{t('common.actions.signOut') || 'Sign out'}
|
|
336
|
+
</Text>
|
|
337
|
+
)}
|
|
338
|
+
</TouchableOpacity>
|
|
339
|
+
{rows.length > 1 ? (
|
|
340
|
+
<TouchableOpacity
|
|
341
|
+
accessibilityRole="menuitem"
|
|
342
|
+
accessibilityLabel={t('accountMenu.signOutAll') || 'Sign out of all accounts'}
|
|
343
|
+
onPress={() => signOutAllDialog.open()}
|
|
344
|
+
disabled={signingOut || signingOutAll}
|
|
345
|
+
style={styles.footerButton}
|
|
346
|
+
>
|
|
347
|
+
{signingOutAll ? (
|
|
348
|
+
<ActivityIndicator color={bloomTheme.colors.error} size="small" />
|
|
349
|
+
) : (
|
|
350
|
+
<Text style={[styles.footerButtonText, { color: bloomTheme.colors.error }]}>
|
|
351
|
+
{t('accountMenu.signOutAll') || 'Sign out of all accounts'}
|
|
352
|
+
</Text>
|
|
353
|
+
)}
|
|
354
|
+
</TouchableOpacity>
|
|
355
|
+
) : null}
|
|
356
|
+
</View>
|
|
357
|
+
</View>
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
return (
|
|
361
|
+
<Modal
|
|
362
|
+
visible={open}
|
|
363
|
+
transparent
|
|
364
|
+
animationType={isWeb ? 'fade' : 'slide'}
|
|
365
|
+
onRequestClose={onClose}
|
|
366
|
+
>
|
|
367
|
+
<Pressable
|
|
368
|
+
accessibilityRole="button"
|
|
369
|
+
accessibilityLabel={t('common.actions.close') || 'Close'}
|
|
370
|
+
onPress={onClose}
|
|
371
|
+
style={overlayStyles}
|
|
372
|
+
>
|
|
373
|
+
{/* Stop propagation: tapping the panel must not close it. */}
|
|
374
|
+
<Pressable onPress={() => undefined} style={styles.panelTouchable}>
|
|
375
|
+
{content}
|
|
376
|
+
</Pressable>
|
|
377
|
+
</Pressable>
|
|
378
|
+
|
|
379
|
+
<Dialog
|
|
380
|
+
control={signOutDialog}
|
|
381
|
+
title={t('common.actions.signOut') || 'Sign out'}
|
|
382
|
+
description={t('common.confirms.signOut') || 'Are you sure you want to sign out?'}
|
|
383
|
+
actions={[
|
|
384
|
+
{
|
|
385
|
+
label: t('common.actions.signOut') || 'Sign out',
|
|
386
|
+
color: 'destructive',
|
|
387
|
+
onPress: performSignOut,
|
|
388
|
+
},
|
|
389
|
+
{ label: t('common.cancel') || 'Cancel', color: 'cancel' },
|
|
390
|
+
]}
|
|
391
|
+
/>
|
|
392
|
+
<Dialog
|
|
393
|
+
control={signOutAllDialog}
|
|
394
|
+
title={t('accountMenu.signOutAll') || 'Sign out of all accounts'}
|
|
395
|
+
description={t('common.confirms.signOutAll') || 'Are you sure you want to sign out of all accounts?'}
|
|
396
|
+
actions={[
|
|
397
|
+
{
|
|
398
|
+
label: t('accountMenu.signOutAll') || 'Sign out of all accounts',
|
|
399
|
+
color: 'destructive',
|
|
400
|
+
onPress: performSignOutAll,
|
|
401
|
+
},
|
|
402
|
+
{ label: t('common.cancel') || 'Cancel', color: 'cancel' },
|
|
403
|
+
]}
|
|
404
|
+
/>
|
|
405
|
+
</Modal>
|
|
406
|
+
);
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
const styles = StyleSheet.create({
|
|
410
|
+
webOverlay: {
|
|
411
|
+
flex: 1,
|
|
412
|
+
backgroundColor: 'transparent',
|
|
413
|
+
},
|
|
414
|
+
nativeOverlay: {
|
|
415
|
+
flex: 1,
|
|
416
|
+
backgroundColor: 'rgba(0,0,0,0.32)',
|
|
417
|
+
justifyContent: 'flex-end',
|
|
418
|
+
},
|
|
419
|
+
panelTouchable: {
|
|
420
|
+
// Pressable wrapper that owns no styling — just absorbs taps.
|
|
421
|
+
},
|
|
422
|
+
panelBase: {
|
|
423
|
+
borderRadius: 24,
|
|
424
|
+
paddingVertical: 12,
|
|
425
|
+
shadowColor: '#000',
|
|
426
|
+
shadowOpacity: 0.18,
|
|
427
|
+
shadowRadius: 24,
|
|
428
|
+
shadowOffset: { width: 0, height: 8 },
|
|
429
|
+
elevation: 12,
|
|
430
|
+
overflow: 'hidden',
|
|
431
|
+
},
|
|
432
|
+
panelWeb: {
|
|
433
|
+
position: 'absolute',
|
|
434
|
+
width: 360,
|
|
435
|
+
maxHeight: '85%',
|
|
436
|
+
borderWidth: 1,
|
|
437
|
+
},
|
|
438
|
+
panelNative: {
|
|
439
|
+
marginHorizontal: 0,
|
|
440
|
+
borderTopLeftRadius: 28,
|
|
441
|
+
borderTopRightRadius: 28,
|
|
442
|
+
borderBottomLeftRadius: 0,
|
|
443
|
+
borderBottomRightRadius: 0,
|
|
444
|
+
paddingTop: 20,
|
|
445
|
+
paddingBottom: 24,
|
|
446
|
+
maxHeight: '85%',
|
|
447
|
+
},
|
|
448
|
+
header: {
|
|
449
|
+
alignItems: 'center',
|
|
450
|
+
paddingHorizontal: 20,
|
|
451
|
+
paddingVertical: 16,
|
|
452
|
+
},
|
|
453
|
+
headerName: {
|
|
454
|
+
fontSize: 18,
|
|
455
|
+
fontWeight: '600',
|
|
456
|
+
marginTop: 12,
|
|
457
|
+
textAlign: 'center',
|
|
458
|
+
},
|
|
459
|
+
headerSecondary: {
|
|
460
|
+
fontSize: 14,
|
|
461
|
+
marginTop: 4,
|
|
462
|
+
textAlign: 'center',
|
|
463
|
+
},
|
|
464
|
+
primaryButton: {
|
|
465
|
+
marginHorizontal: 20,
|
|
466
|
+
marginBottom: 12,
|
|
467
|
+
paddingVertical: 12,
|
|
468
|
+
paddingHorizontal: 16,
|
|
469
|
+
borderRadius: 999,
|
|
470
|
+
borderWidth: 1,
|
|
471
|
+
alignItems: 'center',
|
|
472
|
+
},
|
|
473
|
+
primaryButtonText: {
|
|
474
|
+
fontSize: 14,
|
|
475
|
+
fontWeight: '600',
|
|
476
|
+
},
|
|
477
|
+
list: {
|
|
478
|
+
maxHeight: 280,
|
|
479
|
+
},
|
|
480
|
+
listContent: {
|
|
481
|
+
paddingHorizontal: 12,
|
|
482
|
+
paddingBottom: 4,
|
|
483
|
+
},
|
|
484
|
+
row: {
|
|
485
|
+
flexDirection: 'row',
|
|
486
|
+
alignItems: 'center',
|
|
487
|
+
paddingVertical: 10,
|
|
488
|
+
paddingHorizontal: 12,
|
|
489
|
+
borderRadius: 16,
|
|
490
|
+
marginVertical: 2,
|
|
491
|
+
},
|
|
492
|
+
actionRow: {
|
|
493
|
+
marginHorizontal: 12,
|
|
494
|
+
marginTop: 4,
|
|
495
|
+
},
|
|
496
|
+
actionIcon: {
|
|
497
|
+
width: 36,
|
|
498
|
+
height: 36,
|
|
499
|
+
borderRadius: 18,
|
|
500
|
+
alignItems: 'center',
|
|
501
|
+
justifyContent: 'center',
|
|
502
|
+
},
|
|
503
|
+
rowInfo: {
|
|
504
|
+
flex: 1,
|
|
505
|
+
marginLeft: 12,
|
|
506
|
+
},
|
|
507
|
+
rowName: {
|
|
508
|
+
fontSize: 15,
|
|
509
|
+
fontWeight: '500',
|
|
510
|
+
},
|
|
511
|
+
rowSecondary: {
|
|
512
|
+
fontSize: 13,
|
|
513
|
+
marginTop: 2,
|
|
514
|
+
},
|
|
515
|
+
footer: {
|
|
516
|
+
marginTop: 12,
|
|
517
|
+
paddingTop: 8,
|
|
518
|
+
paddingHorizontal: 12,
|
|
519
|
+
borderTopWidth: StyleSheet.hairlineWidth,
|
|
520
|
+
flexDirection: 'row',
|
|
521
|
+
flexWrap: 'wrap',
|
|
522
|
+
justifyContent: 'space-around',
|
|
523
|
+
},
|
|
524
|
+
footerButton: {
|
|
525
|
+
paddingVertical: 10,
|
|
526
|
+
paddingHorizontal: 12,
|
|
527
|
+
},
|
|
528
|
+
footerButtonText: {
|
|
529
|
+
fontSize: 14,
|
|
530
|
+
fontWeight: '600',
|
|
531
|
+
},
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
export default AccountMenu;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { useCallback, useRef, useState } from 'react';
|
|
3
|
+
import { TouchableOpacity, StyleSheet, Platform, type LayoutChangeEvent } from 'react-native';
|
|
4
|
+
import { getAccountDisplayName } from '@oxyhq/core';
|
|
5
|
+
import Avatar from './Avatar';
|
|
6
|
+
import AccountMenu from './AccountMenu';
|
|
7
|
+
import { useOxy } from '../context/OxyContext';
|
|
8
|
+
import { useI18n } from '../hooks/useI18n';
|
|
9
|
+
|
|
10
|
+
export interface AccountMenuButtonProps {
|
|
11
|
+
/** Avatar size (px). Defaults to 36 (Google account chip size). */
|
|
12
|
+
size?: number;
|
|
13
|
+
/** Called when the user picks "Manage your Oxy Account". */
|
|
14
|
+
onNavigateManage: () => void;
|
|
15
|
+
/** Called when the user picks "Add another account". */
|
|
16
|
+
onAddAccount: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const isWeb = Platform.OS === 'web';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Avatar entry-point that opens the unified {@link AccountMenu}. Reads the
|
|
23
|
+
* active account from `useOxy()` — never receive user data via props.
|
|
24
|
+
*
|
|
25
|
+
* Renders a small avatar chip (top-right friendly). Click → opens AccountMenu.
|
|
26
|
+
* Pure component: owns only the open-state and the trigger's measured anchor.
|
|
27
|
+
*/
|
|
28
|
+
const AccountMenuButton: React.FC<AccountMenuButtonProps> = ({
|
|
29
|
+
size = 36,
|
|
30
|
+
onNavigateManage,
|
|
31
|
+
onAddAccount,
|
|
32
|
+
}) => {
|
|
33
|
+
const { user, oxyServices, isAuthenticated } = useOxy();
|
|
34
|
+
const { t, locale } = useI18n();
|
|
35
|
+
const [open, setOpen] = useState(false);
|
|
36
|
+
const [anchor, setAnchor] = useState<{ top: number; right: number } | null>(null);
|
|
37
|
+
const triggerRef = useRef<React.ComponentRef<typeof TouchableOpacity>>(null);
|
|
38
|
+
|
|
39
|
+
const measureAnchor = useCallback(() => {
|
|
40
|
+
if (!isWeb || !triggerRef.current) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
// RN-Web exposes measure() on host views; use the native API.
|
|
44
|
+
triggerRef.current.measure?.((_x, _y, _w, h, pageX, pageY) => {
|
|
45
|
+
if (typeof window === 'undefined' || typeof pageX !== 'number') {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const right = Math.max(8, window.innerWidth - pageX - (_w ?? 0));
|
|
49
|
+
const top = pageY + h + 8;
|
|
50
|
+
setAnchor({ top, right });
|
|
51
|
+
});
|
|
52
|
+
}, []);
|
|
53
|
+
|
|
54
|
+
const handleOpen = useCallback(() => {
|
|
55
|
+
measureAnchor();
|
|
56
|
+
setOpen(true);
|
|
57
|
+
}, [measureAnchor]);
|
|
58
|
+
|
|
59
|
+
const handleClose = useCallback(() => setOpen(false), []);
|
|
60
|
+
|
|
61
|
+
const handleLayout = useCallback((_event: LayoutChangeEvent) => {
|
|
62
|
+
// Re-measure on layout changes so the popover doesn't drift after
|
|
63
|
+
// window resize / sticky-header relayout.
|
|
64
|
+
if (open) {
|
|
65
|
+
measureAnchor();
|
|
66
|
+
}
|
|
67
|
+
}, [measureAnchor, open]);
|
|
68
|
+
|
|
69
|
+
const displayName = getAccountDisplayName(user, locale);
|
|
70
|
+
const avatarUri = user?.avatar
|
|
71
|
+
? oxyServices.getFileDownloadUrl(user.avatar, 'thumb')
|
|
72
|
+
: undefined;
|
|
73
|
+
|
|
74
|
+
const accessibilityLabel = isAuthenticated
|
|
75
|
+
? (t('accountMenu.openWithUser', { name: displayName })
|
|
76
|
+
|| `Account menu for ${displayName}`)
|
|
77
|
+
: (t('accountMenu.open') || 'Account menu');
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<>
|
|
81
|
+
<TouchableOpacity
|
|
82
|
+
ref={triggerRef}
|
|
83
|
+
onPress={handleOpen}
|
|
84
|
+
onLayout={handleLayout}
|
|
85
|
+
accessibilityRole="button"
|
|
86
|
+
accessibilityLabel={accessibilityLabel}
|
|
87
|
+
accessibilityHint={t('accountMenu.openHint') || 'Opens the account menu'}
|
|
88
|
+
accessibilityState={{ expanded: open }}
|
|
89
|
+
style={[styles.trigger, { width: size, height: size, borderRadius: size / 2 }]}
|
|
90
|
+
hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
|
|
91
|
+
>
|
|
92
|
+
<Avatar uri={avatarUri} name={displayName} size={size} />
|
|
93
|
+
</TouchableOpacity>
|
|
94
|
+
<AccountMenu
|
|
95
|
+
open={open}
|
|
96
|
+
onClose={handleClose}
|
|
97
|
+
onNavigateManage={onNavigateManage}
|
|
98
|
+
onAddAccount={onAddAccount}
|
|
99
|
+
anchor={anchor}
|
|
100
|
+
/>
|
|
101
|
+
</>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const styles = StyleSheet.create({
|
|
106
|
+
trigger: {
|
|
107
|
+
overflow: 'hidden',
|
|
108
|
+
alignItems: 'center',
|
|
109
|
+
justifyContent: 'center',
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
export default AccountMenuButton;
|
|
@@ -13,7 +13,7 @@ import { useOxy } from '../context/OxyContext';
|
|
|
13
13
|
/**
|
|
14
14
|
* ActingAsBanner - Shows a subtle banner when the user is acting as a managed account.
|
|
15
15
|
*
|
|
16
|
-
* - Tap to open the
|
|
16
|
+
* - Tap to open the ManageAccount screen (account switcher lives in AccountMenu).
|
|
17
17
|
* - Long-press to switch back to the primary account immediately.
|
|
18
18
|
*
|
|
19
19
|
* Place this component in your app's layout where you want the banner to appear
|
|
@@ -39,7 +39,7 @@ const ActingAsBanner: React.FC = () => {
|
|
|
39
39
|
: activeAccount.name || activeAccount.username;
|
|
40
40
|
|
|
41
41
|
const handlePress = () => {
|
|
42
|
-
showBottomSheet?.('
|
|
42
|
+
showBottomSheet?.('ManageAccount');
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
const handleLongPress = () => {
|
|
@@ -5,7 +5,7 @@ import { useTheme } from '@oxyhq/bloom/theme';
|
|
|
5
5
|
import { useI18n } from '../hooks/useI18n';
|
|
6
6
|
import Avatar from './Avatar';
|
|
7
7
|
import { useOxy } from '../context/OxyContext';
|
|
8
|
-
import { useFileDownloadUrl } from '../hooks';
|
|
8
|
+
import { useFileDownloadUrl } from '../hooks/useFileDownloadUrl';
|
|
9
9
|
import { getAccountDisplayName, getAccountFallbackHandle } from '@oxyhq/core';
|
|
10
10
|
|
|
11
11
|
interface ProfileCardProps {
|
|
@@ -13,7 +13,7 @@ import Animated, {
|
|
|
13
13
|
} from 'react-native-reanimated';
|
|
14
14
|
import { useTheme } from '@oxyhq/bloom/theme';
|
|
15
15
|
import type { ThemeColors } from '@oxyhq/bloom/theme';
|
|
16
|
-
import { createAuthStyles } from '../styles';
|
|
16
|
+
import { createAuthStyles } from '../styles/authStyles';
|
|
17
17
|
import type { BaseScreenProps, StepController } from '../types/navigation';
|
|
18
18
|
import type { RouteName } from '../types/navigation';
|
|
19
19
|
import { screenContentStyle } from '../constants/spacing';
|