@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
|
@@ -1,620 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Text,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
ActivityIndicator,
|
|
7
|
-
ScrollView,
|
|
8
|
-
Animated,
|
|
9
|
-
Platform,
|
|
10
|
-
Image,
|
|
11
|
-
} from 'react-native';
|
|
12
|
-
import { MaterialCommunityIcons } from '@expo/vector-icons';
|
|
13
|
-
import type { BaseScreenProps } from '../types/navigation';
|
|
14
|
-
import { Dialog, toast, useDialogControl } from '@oxyhq/bloom';
|
|
15
|
-
import { useAuthStore } from '../stores/authStore';
|
|
16
|
-
import { SettingsListGroup, SettingsListItem } from '@oxyhq/bloom/settings-list';
|
|
17
|
-
import { useI18n } from '../hooks/useI18n';
|
|
18
|
-
import { useTheme } from '@oxyhq/bloom/theme';
|
|
19
|
-
import { useColorScheme } from '../hooks/useColorScheme';
|
|
20
|
-
import { Colors } from '../constants/theme';
|
|
21
|
-
import { normalizeColorScheme } from '../utils/themeUtils';
|
|
22
|
-
import type { ProfileFieldType } from './EditProfileFieldScreen';
|
|
23
|
-
import { getDisplayName } from '../utils/userUtils';
|
|
24
|
-
import { useOxy } from '../context/OxyContext';
|
|
25
|
-
import { useCurrentUser } from '../hooks/queries/useAccountQueries';
|
|
26
|
-
import { useUploadAvatar } from '../hooks/mutations/useAccountMutations';
|
|
27
|
-
import {
|
|
28
|
-
SECTION_GAP_LARGE,
|
|
29
|
-
COMPONENT_GAP,
|
|
30
|
-
HEADER_PADDING_TOP_SETTINGS,
|
|
31
|
-
createScreenContentStyle,
|
|
32
|
-
} from '../constants/spacing';
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const AccountSettingsScreen: React.FC<BaseScreenProps & { initialField?: string; initialSection?: string }> = ({
|
|
37
|
-
onClose,
|
|
38
|
-
theme,
|
|
39
|
-
goBack,
|
|
40
|
-
navigate,
|
|
41
|
-
initialField,
|
|
42
|
-
initialSection,
|
|
43
|
-
scrollTo,
|
|
44
|
-
}) => {
|
|
45
|
-
// Use useOxy() hook for OxyContext values
|
|
46
|
-
const {
|
|
47
|
-
oxyServices,
|
|
48
|
-
isAuthenticated,
|
|
49
|
-
} = useOxy();
|
|
50
|
-
const { t } = useI18n();
|
|
51
|
-
|
|
52
|
-
// Use TanStack Query for user data
|
|
53
|
-
const { data: user, isLoading: userLoading } = useCurrentUser({ enabled: isAuthenticated });
|
|
54
|
-
const uploadAvatarMutation = useUploadAvatar();
|
|
55
|
-
|
|
56
|
-
// Dialog controls
|
|
57
|
-
const removeAvatarDialog = useDialogControl();
|
|
58
|
-
|
|
59
|
-
// Fall back to the auth store while the query is loading so the screen
|
|
60
|
-
// can render immediately with cached profile data on subsequent visits.
|
|
61
|
-
const userFromStore = useAuthStore((state) => state.user);
|
|
62
|
-
const finalUser = user || userFromStore;
|
|
63
|
-
const isUpdatingAvatar = uploadAvatarMutation.isPending;
|
|
64
|
-
const [optimisticAvatarId, setOptimisticAvatarId] = useState<string | null>(null);
|
|
65
|
-
const scrollViewRef = useRef<ScrollView>(null);
|
|
66
|
-
const avatarSectionRef = useRef<View>(null);
|
|
67
|
-
|
|
68
|
-
// Section refs for navigation
|
|
69
|
-
const profilePictureSectionRef = useRef<View>(null);
|
|
70
|
-
const basicInfoSectionRef = useRef<View>(null);
|
|
71
|
-
const aboutSectionRef = useRef<View>(null);
|
|
72
|
-
const quickActionsSectionRef = useRef<View>(null);
|
|
73
|
-
const securitySectionRef = useRef<View>(null);
|
|
74
|
-
|
|
75
|
-
// Section Y positions for scrolling
|
|
76
|
-
const [profilePictureSectionY, setProfilePictureSectionY] = useState<number | null>(null);
|
|
77
|
-
const [basicInfoSectionY, setBasicInfoSectionY] = useState<number | null>(null);
|
|
78
|
-
const [aboutSectionY, setAboutSectionY] = useState<number | null>(null);
|
|
79
|
-
const [quickActionsSectionY, setQuickActionsSectionY] = useState<number | null>(null);
|
|
80
|
-
const [securitySectionY, setSecuritySectionY] = useState<number | null>(null);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// Form state
|
|
85
|
-
const [displayName, setDisplayName] = useState('');
|
|
86
|
-
const [lastName, setLastName] = useState('');
|
|
87
|
-
const [username, setUsername] = useState('');
|
|
88
|
-
const [email, setEmail] = useState('');
|
|
89
|
-
const [bio, setBio] = useState('');
|
|
90
|
-
const [location, setLocation] = useState('');
|
|
91
|
-
const [links, setLinks] = useState<string[]>([]);
|
|
92
|
-
const [avatarFileId, setAvatarFileId] = useState('');
|
|
93
|
-
|
|
94
|
-
// Navigation helper for editing fields
|
|
95
|
-
const navigateToEditField = useCallback((fieldType: ProfileFieldType) => {
|
|
96
|
-
navigate?.('EditProfileField', { fieldType });
|
|
97
|
-
}, [navigate]);
|
|
98
|
-
|
|
99
|
-
// Location and links state (for display only - modals handle editing)
|
|
100
|
-
const [locations, setLocations] = useState<Array<{
|
|
101
|
-
id: string;
|
|
102
|
-
name: string;
|
|
103
|
-
label?: string;
|
|
104
|
-
coordinates?: { lat: number; lon: number };
|
|
105
|
-
}>>([]);
|
|
106
|
-
const [linksMetadata, setLinksMetadata] = useState<Array<{
|
|
107
|
-
url: string;
|
|
108
|
-
title?: string;
|
|
109
|
-
description?: string;
|
|
110
|
-
image?: string;
|
|
111
|
-
id: string;
|
|
112
|
-
}>>([]);
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
// Get theme colors
|
|
116
|
-
const bloomTheme = useTheme();
|
|
117
|
-
const colorScheme = useColorScheme();
|
|
118
|
-
|
|
119
|
-
// Extract colors for convenience
|
|
120
|
-
const colors = Colors[normalizeColorScheme(colorScheme, theme || 'light')];
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
// Track initialization to prevent unnecessary resets
|
|
124
|
-
const isInitializedRef = useRef(false);
|
|
125
|
-
const previousUserIdRef = useRef<string | null>(null);
|
|
126
|
-
const previousAvatarRef = useRef<string | null>(null);
|
|
127
|
-
|
|
128
|
-
// Load user data - only reset fields when user actually changes (not just avatar)
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
if (finalUser) {
|
|
131
|
-
const currentUserId = finalUser.id;
|
|
132
|
-
const currentAvatar = finalUser.avatar ?? '';
|
|
133
|
-
const isNewUser = previousUserIdRef.current !== currentUserId;
|
|
134
|
-
const isAvatarOnlyUpdate = !isNewUser && previousUserIdRef.current === currentUserId &&
|
|
135
|
-
previousAvatarRef.current !== currentAvatar &&
|
|
136
|
-
previousAvatarRef.current !== null;
|
|
137
|
-
const shouldInitialize = !isInitializedRef.current || isNewUser;
|
|
138
|
-
|
|
139
|
-
// Only reset all fields if it's a new user or first load
|
|
140
|
-
// Skip reset if it's just an avatar update
|
|
141
|
-
if (shouldInitialize && !isAvatarOnlyUpdate) {
|
|
142
|
-
const userDisplayName = typeof finalUser.name === 'string'
|
|
143
|
-
? finalUser.name
|
|
144
|
-
: finalUser.name?.first || finalUser.name?.full || '';
|
|
145
|
-
const userLastName = typeof finalUser.name === 'object' ? finalUser.name?.last || '' : '';
|
|
146
|
-
setDisplayName(userDisplayName);
|
|
147
|
-
setLastName(userLastName);
|
|
148
|
-
setUsername(finalUser.username || '');
|
|
149
|
-
setEmail(finalUser.email || '');
|
|
150
|
-
setBio(finalUser.bio || '');
|
|
151
|
-
setLocation(finalUser.location || '');
|
|
152
|
-
|
|
153
|
-
// Handle locations - convert single location to array format
|
|
154
|
-
if (finalUser.locations && Array.isArray(finalUser.locations)) {
|
|
155
|
-
setLocations(finalUser.locations.map((loc: any, index: number) => ({
|
|
156
|
-
id: loc.id || `existing-${index}`,
|
|
157
|
-
name: loc.name,
|
|
158
|
-
label: loc.label,
|
|
159
|
-
coordinates: loc.coordinates
|
|
160
|
-
})));
|
|
161
|
-
} else if (finalUser.location) {
|
|
162
|
-
// Convert single location string to array format
|
|
163
|
-
setLocations([{
|
|
164
|
-
id: 'existing-0',
|
|
165
|
-
name: finalUser.location,
|
|
166
|
-
label: 'Location'
|
|
167
|
-
}]);
|
|
168
|
-
} else {
|
|
169
|
-
setLocations([]);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Handle links - simple and direct like other fields
|
|
173
|
-
if (finalUser.linksMetadata && Array.isArray(finalUser.linksMetadata)) {
|
|
174
|
-
const urls = finalUser.linksMetadata.map((l: any) => l.url);
|
|
175
|
-
setLinks(urls);
|
|
176
|
-
const metadataWithIds = finalUser.linksMetadata.map((link: any, index: number) => ({
|
|
177
|
-
...link,
|
|
178
|
-
id: link.id || `existing-${index}`
|
|
179
|
-
}));
|
|
180
|
-
setLinksMetadata(metadataWithIds);
|
|
181
|
-
} else if (Array.isArray(finalUser.links)) {
|
|
182
|
-
const simpleLinks = finalUser.links.map((l: any) => typeof l === 'string' ? l : l.link).filter(Boolean);
|
|
183
|
-
setLinks(simpleLinks);
|
|
184
|
-
const linksWithMetadata = simpleLinks.map((url: string, index: number) => ({
|
|
185
|
-
url,
|
|
186
|
-
title: url.replace(/^https?:\/\//, '').replace(/\/$/, ''),
|
|
187
|
-
description: `Link to ${url}`,
|
|
188
|
-
image: undefined,
|
|
189
|
-
id: `existing-${index}`
|
|
190
|
-
}));
|
|
191
|
-
setLinksMetadata(linksWithMetadata);
|
|
192
|
-
} else if (finalUser.website) {
|
|
193
|
-
setLinks([finalUser.website]);
|
|
194
|
-
setLinksMetadata([{
|
|
195
|
-
url: finalUser.website,
|
|
196
|
-
title: finalUser.website.replace(/^https?:\/\//, '').replace(/\/$/, ''),
|
|
197
|
-
description: `Link to ${finalUser.website}`,
|
|
198
|
-
image: undefined,
|
|
199
|
-
id: 'existing-0'
|
|
200
|
-
}]);
|
|
201
|
-
} else {
|
|
202
|
-
setLinks([]);
|
|
203
|
-
setLinksMetadata([]);
|
|
204
|
-
}
|
|
205
|
-
isInitializedRef.current = true;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// Update avatar only if it changed and we're not in optimistic/updating state
|
|
209
|
-
// This allows the server response to update the avatar without resetting other fields
|
|
210
|
-
// But don't override if we have a pending optimistic update
|
|
211
|
-
if (currentAvatar !== avatarFileId && !isUpdatingAvatar && !optimisticAvatarId) {
|
|
212
|
-
setAvatarFileId(currentAvatar);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// If we just finished updating and the server avatar matches our optimistic one, clear optimistic state
|
|
216
|
-
// Also clear if the server avatar matches our current avatarFileId (update completed)
|
|
217
|
-
if (isUpdatingAvatar === false && optimisticAvatarId) {
|
|
218
|
-
if (currentAvatar === optimisticAvatarId || currentAvatar === avatarFileId) {
|
|
219
|
-
setOptimisticAvatarId(null);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
previousUserIdRef.current = currentUserId;
|
|
224
|
-
previousAvatarRef.current = currentAvatar;
|
|
225
|
-
}
|
|
226
|
-
}, [finalUser, avatarFileId, isUpdatingAvatar, optimisticAvatarId]);
|
|
227
|
-
|
|
228
|
-
// Set initial editing field if provided via props (e.g., from navigation)
|
|
229
|
-
// Handle initialSection prop to scroll to specific section
|
|
230
|
-
const hasScrolledToSectionRef = useRef(false);
|
|
231
|
-
const previousInitialSectionRef = useRef<string | undefined>(undefined);
|
|
232
|
-
const SCROLL_OFFSET = 100; // Offset to show section near top of viewport
|
|
233
|
-
|
|
234
|
-
// Map section names to their Y positions
|
|
235
|
-
const sectionYPositions = useMemo(() => ({
|
|
236
|
-
profilePicture: profilePictureSectionY,
|
|
237
|
-
basicInfo: basicInfoSectionY,
|
|
238
|
-
about: aboutSectionY,
|
|
239
|
-
quickActions: quickActionsSectionY,
|
|
240
|
-
security: securitySectionY,
|
|
241
|
-
}), [profilePictureSectionY, basicInfoSectionY, aboutSectionY, quickActionsSectionY, securitySectionY]);
|
|
242
|
-
|
|
243
|
-
useEffect(() => {
|
|
244
|
-
// If initialSection changed, reset the flag
|
|
245
|
-
if (previousInitialSectionRef.current !== initialSection) {
|
|
246
|
-
hasScrolledToSectionRef.current = false;
|
|
247
|
-
previousInitialSectionRef.current = initialSection;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// Scroll to the specified section if initialSection is provided and we haven't scrolled yet
|
|
251
|
-
if (initialSection && !hasScrolledToSectionRef.current) {
|
|
252
|
-
const sectionY = sectionYPositions[initialSection as keyof typeof sectionYPositions];
|
|
253
|
-
|
|
254
|
-
if (sectionY !== null && sectionY !== undefined && scrollTo) {
|
|
255
|
-
requestAnimationFrame(() => {
|
|
256
|
-
requestAnimationFrame(() => {
|
|
257
|
-
scrollTo(Math.max(0, sectionY - SCROLL_OFFSET), true);
|
|
258
|
-
hasScrolledToSectionRef.current = true;
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}, [initialSection, sectionYPositions]);
|
|
264
|
-
|
|
265
|
-
const handleAvatarRemoveConfirmed = useCallback(() => {
|
|
266
|
-
setAvatarFileId('');
|
|
267
|
-
toast.success(t('editProfile.toasts.avatarRemoved') || 'Avatar removed');
|
|
268
|
-
}, [t]);
|
|
269
|
-
|
|
270
|
-
const handleAvatarRemove = useCallback(() => {
|
|
271
|
-
removeAvatarDialog.open();
|
|
272
|
-
}, [removeAvatarDialog]);
|
|
273
|
-
|
|
274
|
-
const { openAvatarPicker } = useOxy();
|
|
275
|
-
|
|
276
|
-
// Handlers to navigate to edit screens
|
|
277
|
-
const handleOpenDisplayNameModal = useCallback(() => navigateToEditField('displayName'), [navigateToEditField]);
|
|
278
|
-
const handleOpenUsernameModal = useCallback(() => navigateToEditField('username'), [navigateToEditField]);
|
|
279
|
-
const handleOpenEmailModal = useCallback(() => navigateToEditField('email'), [navigateToEditField]);
|
|
280
|
-
const handleOpenBioModal = useCallback(() => navigateToEditField('bio'), [navigateToEditField]);
|
|
281
|
-
const handleOpenLocationModal = useCallback(() => navigateToEditField('locations'), [navigateToEditField]);
|
|
282
|
-
const handleOpenLinksModal = useCallback(() => navigateToEditField('links'), [navigateToEditField]);
|
|
283
|
-
|
|
284
|
-
// Handle initialField prop - navigate to appropriate edit screen
|
|
285
|
-
useEffect(() => {
|
|
286
|
-
if (initialField) {
|
|
287
|
-
// Special handling for avatar - open avatar picker directly
|
|
288
|
-
if (initialField === 'avatar') {
|
|
289
|
-
setTimeout(() => {
|
|
290
|
-
openAvatarPicker();
|
|
291
|
-
}, 300);
|
|
292
|
-
} else {
|
|
293
|
-
// Navigate to edit screen
|
|
294
|
-
setTimeout(() => {
|
|
295
|
-
const fieldTypeMap: Record<string, ProfileFieldType> = {
|
|
296
|
-
displayName: 'displayName',
|
|
297
|
-
username: 'username',
|
|
298
|
-
email: 'email',
|
|
299
|
-
bio: 'bio',
|
|
300
|
-
location: 'locations',
|
|
301
|
-
locations: 'locations',
|
|
302
|
-
links: 'links',
|
|
303
|
-
};
|
|
304
|
-
const fieldType = fieldTypeMap[initialField];
|
|
305
|
-
if (fieldType) {
|
|
306
|
-
navigateToEditField(fieldType);
|
|
307
|
-
}
|
|
308
|
-
}, 300);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}, [initialField, openAvatarPicker, navigateToEditField]);
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
// Memoize display name for avatar
|
|
317
|
-
const displayNameForAvatar = useMemo(() => getDisplayName(finalUser), [finalUser]);
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
if (userLoading || !isAuthenticated) {
|
|
323
|
-
return (
|
|
324
|
-
<View style={[styles.container, { justifyContent: 'center', backgroundColor: bloomTheme.colors.background }]}>
|
|
325
|
-
<ActivityIndicator size="large" color={bloomTheme.colors.primary} />
|
|
326
|
-
</View>
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
return (
|
|
331
|
-
<View style={[styles.container, { backgroundColor: bloomTheme.colors.background }]}>
|
|
332
|
-
<ScrollView
|
|
333
|
-
ref={scrollViewRef}
|
|
334
|
-
style={styles.content}
|
|
335
|
-
contentContainerStyle={styles.scrollContent}
|
|
336
|
-
showsVerticalScrollIndicator={false}
|
|
337
|
-
>
|
|
338
|
-
{/* Title and Subtitle Header */}
|
|
339
|
-
<View style={[styles.headerContainer, styles.headerSection]}>
|
|
340
|
-
<Text style={[styles.modernTitle, { marginBottom: 0, marginTop: 0 }]} className="text-foreground">
|
|
341
|
-
{t('accountOverview.items.editProfile.title') || t('editProfile.title') || 'Edit Profile'}
|
|
342
|
-
</Text>
|
|
343
|
-
<Text style={[styles.modernSubtitle, { marginBottom: 0, marginTop: 0 }]} className="text-muted-foreground">
|
|
344
|
-
{t('accountOverview.items.editProfile.subtitle') || t('editProfile.subtitle') || 'Manage your profile and preferences'}
|
|
345
|
-
</Text>
|
|
346
|
-
</View>
|
|
347
|
-
|
|
348
|
-
{/* Profile Picture Section */}
|
|
349
|
-
<View
|
|
350
|
-
ref={(ref) => {
|
|
351
|
-
avatarSectionRef.current = ref;
|
|
352
|
-
profilePictureSectionRef.current = ref;
|
|
353
|
-
}}
|
|
354
|
-
style={styles.section}
|
|
355
|
-
onLayout={(event) => {
|
|
356
|
-
const { y } = event.nativeEvent.layout;
|
|
357
|
-
setProfilePictureSectionY(y);
|
|
358
|
-
}}
|
|
359
|
-
>
|
|
360
|
-
<Text style={styles.sectionTitle} className="text-muted-foreground">
|
|
361
|
-
{t('editProfile.sections.profilePicture') || 'PROFILE PICTURE'}
|
|
362
|
-
</Text>
|
|
363
|
-
<View style={styles.groupedSectionWrapper}>
|
|
364
|
-
<SettingsListGroup>
|
|
365
|
-
<SettingsListItem
|
|
366
|
-
icon={(optimisticAvatarId || avatarFileId) ? (
|
|
367
|
-
isUpdatingAvatar ? (
|
|
368
|
-
<Animated.View style={{ position: 'relative', width: 36, height: 36 }}>
|
|
369
|
-
<Animated.Image
|
|
370
|
-
source={{ uri: oxyServices.getFileDownloadUrl(optimisticAvatarId || avatarFileId, 'thumb') }}
|
|
371
|
-
style={{
|
|
372
|
-
width: 36,
|
|
373
|
-
height: 36,
|
|
374
|
-
borderRadius: 18,
|
|
375
|
-
opacity: 0.6
|
|
376
|
-
}}
|
|
377
|
-
/>
|
|
378
|
-
<View style={{
|
|
379
|
-
position: 'absolute',
|
|
380
|
-
top: 0,
|
|
381
|
-
left: 0,
|
|
382
|
-
right: 0,
|
|
383
|
-
bottom: 0,
|
|
384
|
-
justifyContent: 'center',
|
|
385
|
-
alignItems: 'center',
|
|
386
|
-
backgroundColor: bloomTheme.colors.overlay,
|
|
387
|
-
borderRadius: 18,
|
|
388
|
-
}}>
|
|
389
|
-
<ActivityIndicator size="small" color={colors.tint} />
|
|
390
|
-
</View>
|
|
391
|
-
</Animated.View>
|
|
392
|
-
) : (
|
|
393
|
-
<Image
|
|
394
|
-
source={{ uri: oxyServices.getFileDownloadUrl(optimisticAvatarId || avatarFileId, 'thumb') }}
|
|
395
|
-
style={{ width: 36, height: 36, borderRadius: 18 }}
|
|
396
|
-
/>
|
|
397
|
-
)
|
|
398
|
-
) : (
|
|
399
|
-
<MaterialCommunityIcons name="account-outline" size={20} color={colors.sidebarIconPersonalInfo} />
|
|
400
|
-
)}
|
|
401
|
-
title="Profile Photo"
|
|
402
|
-
description={isUpdatingAvatar
|
|
403
|
-
? 'Updating profile picture...'
|
|
404
|
-
: (avatarFileId ? 'Tap to change your profile picture' : 'Tap to add a profile picture')}
|
|
405
|
-
onPress={isUpdatingAvatar ? undefined : openAvatarPicker}
|
|
406
|
-
disabled={isUpdatingAvatar}
|
|
407
|
-
/>
|
|
408
|
-
{avatarFileId && !isUpdatingAvatar ? (
|
|
409
|
-
<SettingsListItem
|
|
410
|
-
icon={<MaterialCommunityIcons name="delete-outline" size={20} color={colors.sidebarIconSharing} />}
|
|
411
|
-
title="Remove Photo"
|
|
412
|
-
description="Delete current profile picture"
|
|
413
|
-
onPress={handleAvatarRemove}
|
|
414
|
-
/>
|
|
415
|
-
) : null}
|
|
416
|
-
</SettingsListGroup>
|
|
417
|
-
</View>
|
|
418
|
-
</View>
|
|
419
|
-
|
|
420
|
-
{/* Basic Information */}
|
|
421
|
-
<View
|
|
422
|
-
ref={basicInfoSectionRef}
|
|
423
|
-
style={styles.section}
|
|
424
|
-
onLayout={(event) => {
|
|
425
|
-
const { y } = event.nativeEvent.layout;
|
|
426
|
-
setBasicInfoSectionY(y);
|
|
427
|
-
}}
|
|
428
|
-
>
|
|
429
|
-
<Text style={styles.sectionTitle} className="text-muted-foreground">
|
|
430
|
-
{t('editProfile.sections.basicInfo') || 'BASIC INFORMATION'}
|
|
431
|
-
</Text>
|
|
432
|
-
<View style={styles.groupedSectionWrapper}>
|
|
433
|
-
<SettingsListGroup>
|
|
434
|
-
<SettingsListItem
|
|
435
|
-
icon={<MaterialCommunityIcons name="account-outline" size={20} color={colors.sidebarIconPersonalInfo} />}
|
|
436
|
-
title={t('editProfile.items.displayName.title') || 'Display Name'}
|
|
437
|
-
description={[displayName, lastName].filter(Boolean).join(' ') || (t('editProfile.items.displayName.add') || 'Add your display name')}
|
|
438
|
-
onPress={handleOpenDisplayNameModal}
|
|
439
|
-
/>
|
|
440
|
-
<SettingsListItem
|
|
441
|
-
icon={<MaterialCommunityIcons name="at" size={20} color={colors.sidebarIconData} />}
|
|
442
|
-
title={t('editProfile.items.username.title') || 'Username'}
|
|
443
|
-
description={username || (t('editProfile.items.username.choose') || 'Choose a username')}
|
|
444
|
-
onPress={handleOpenUsernameModal}
|
|
445
|
-
/>
|
|
446
|
-
<SettingsListItem
|
|
447
|
-
icon={<MaterialCommunityIcons name="email-outline" size={20} color={colors.sidebarIconSecurity} />}
|
|
448
|
-
title={t('editProfile.items.email.title') || 'Email'}
|
|
449
|
-
description={email || (t('editProfile.items.email.add') || 'Add your email address')}
|
|
450
|
-
onPress={handleOpenEmailModal}
|
|
451
|
-
/>
|
|
452
|
-
</SettingsListGroup>
|
|
453
|
-
</View>
|
|
454
|
-
</View>
|
|
455
|
-
|
|
456
|
-
{/* About You */}
|
|
457
|
-
<View
|
|
458
|
-
ref={aboutSectionRef}
|
|
459
|
-
style={styles.section}
|
|
460
|
-
onLayout={(event) => {
|
|
461
|
-
const { y } = event.nativeEvent.layout;
|
|
462
|
-
setAboutSectionY(y);
|
|
463
|
-
}}
|
|
464
|
-
>
|
|
465
|
-
<Text style={styles.sectionTitle} className="text-muted-foreground">
|
|
466
|
-
{t('editProfile.sections.about') || 'ABOUT YOU'}
|
|
467
|
-
</Text>
|
|
468
|
-
<View style={styles.groupedSectionWrapper}>
|
|
469
|
-
<SettingsListGroup>
|
|
470
|
-
<SettingsListItem
|
|
471
|
-
icon={<MaterialCommunityIcons name="text-box-outline" size={20} color={colors.sidebarIconPersonalInfo} />}
|
|
472
|
-
title={t('editProfile.items.bio.title') || 'Bio'}
|
|
473
|
-
description={bio || (t('editProfile.items.bio.placeholder') || 'Tell people about yourself')}
|
|
474
|
-
onPress={handleOpenBioModal}
|
|
475
|
-
/>
|
|
476
|
-
<SettingsListItem
|
|
477
|
-
icon={<MaterialCommunityIcons name="map-marker-outline" size={20} color={colors.sidebarIconSharing} />}
|
|
478
|
-
title={t('editProfile.items.locations.title') || 'Locations'}
|
|
479
|
-
description={locations.length > 0
|
|
480
|
-
? (locations.length === 1
|
|
481
|
-
? (t('editProfile.items.locations.count', { count: locations.length }) || `${locations.length} location added`)
|
|
482
|
-
: (t('editProfile.items.locations.count_plural', { count: locations.length }) || `${locations.length} locations added`))
|
|
483
|
-
: (t('editProfile.items.locations.add') || 'Add your locations')}
|
|
484
|
-
onPress={handleOpenLocationModal}
|
|
485
|
-
/>
|
|
486
|
-
<SettingsListItem
|
|
487
|
-
icon={<MaterialCommunityIcons name="link-variant" size={20} color={colors.sidebarIconSharing} />}
|
|
488
|
-
title={t('editProfile.items.links.title') || 'Links'}
|
|
489
|
-
description={linksMetadata.length > 0
|
|
490
|
-
? (linksMetadata.length === 1
|
|
491
|
-
? (t('editProfile.items.links.count', { count: linksMetadata.length }) || `${linksMetadata.length} link added`)
|
|
492
|
-
: (t('editProfile.items.links.count_plural', { count: linksMetadata.length }) || `${linksMetadata.length} links added`))
|
|
493
|
-
: (t('editProfile.items.links.add') || 'Add your links')}
|
|
494
|
-
onPress={handleOpenLinksModal}
|
|
495
|
-
/>
|
|
496
|
-
</SettingsListGroup>
|
|
497
|
-
</View>
|
|
498
|
-
</View>
|
|
499
|
-
|
|
500
|
-
{/* Quick Actions */}
|
|
501
|
-
<View
|
|
502
|
-
ref={quickActionsSectionRef}
|
|
503
|
-
style={styles.section}
|
|
504
|
-
onLayout={(event) => {
|
|
505
|
-
const { y } = event.nativeEvent.layout;
|
|
506
|
-
setQuickActionsSectionY(y);
|
|
507
|
-
}}
|
|
508
|
-
>
|
|
509
|
-
<Text style={styles.sectionTitle} className="text-muted-foreground">
|
|
510
|
-
{t('editProfile.sections.quickActions') || 'QUICK ACTIONS'}
|
|
511
|
-
</Text>
|
|
512
|
-
<View style={styles.groupedSectionWrapper}>
|
|
513
|
-
<SettingsListGroup>
|
|
514
|
-
<SettingsListItem
|
|
515
|
-
icon={<MaterialCommunityIcons name="eye" size={20} color={colors.sidebarIconHome} />}
|
|
516
|
-
title={t('editProfile.items.previewProfile.title') || 'Preview Profile'}
|
|
517
|
-
description={t('editProfile.items.previewProfile.subtitle') || 'See how your profile looks to others'}
|
|
518
|
-
onPress={() => navigate?.('Profile', { userId: finalUser?.id })}
|
|
519
|
-
/>
|
|
520
|
-
<SettingsListItem
|
|
521
|
-
icon={<MaterialCommunityIcons name="shield-check" size={20} color={colors.sidebarIconSecurity} />}
|
|
522
|
-
title={t('editProfile.items.privacySettings.title') || 'Privacy Settings'}
|
|
523
|
-
description={t('editProfile.items.privacySettings.subtitle') || 'Control who can see your profile'}
|
|
524
|
-
onPress={() => navigate?.('PrivacySettings')}
|
|
525
|
-
/>
|
|
526
|
-
<SettingsListItem
|
|
527
|
-
icon={<MaterialCommunityIcons name="check-circle" size={20} color={colors.sidebarIconPersonalInfo} />}
|
|
528
|
-
title={t('editProfile.items.verifyAccount.title') || 'Verify Account'}
|
|
529
|
-
description={t('editProfile.items.verifyAccount.subtitle') || 'Get a verified badge'}
|
|
530
|
-
onPress={() => navigate?.('AccountVerification')}
|
|
531
|
-
/>
|
|
532
|
-
</SettingsListGroup>
|
|
533
|
-
</View>
|
|
534
|
-
</View>
|
|
535
|
-
|
|
536
|
-
{/* Security */}
|
|
537
|
-
<View
|
|
538
|
-
ref={securitySectionRef}
|
|
539
|
-
style={styles.section}
|
|
540
|
-
onLayout={(event) => {
|
|
541
|
-
const { y } = event.nativeEvent.layout;
|
|
542
|
-
setSecuritySectionY(y);
|
|
543
|
-
}}
|
|
544
|
-
>
|
|
545
|
-
<Text style={styles.sectionTitle} className="text-muted-foreground">
|
|
546
|
-
{t('editProfile.sections.security') || 'SECURITY'}
|
|
547
|
-
</Text>
|
|
548
|
-
<View style={styles.groupedSectionWrapper}>
|
|
549
|
-
</View>
|
|
550
|
-
</View>
|
|
551
|
-
</ScrollView>
|
|
552
|
-
<Dialog
|
|
553
|
-
control={removeAvatarDialog}
|
|
554
|
-
title={t('editProfile.confirms.removeAvatarTitle') || 'Remove Avatar'}
|
|
555
|
-
description={t('editProfile.confirms.removeAvatar') || 'Remove your profile picture?'}
|
|
556
|
-
actions={[
|
|
557
|
-
{
|
|
558
|
-
label: t('common.remove') || 'Remove',
|
|
559
|
-
color: 'destructive',
|
|
560
|
-
onPress: handleAvatarRemoveConfirmed,
|
|
561
|
-
},
|
|
562
|
-
{ label: t('common.cancel') || 'Cancel', color: 'cancel' },
|
|
563
|
-
]}
|
|
564
|
-
/>
|
|
565
|
-
</View>
|
|
566
|
-
);
|
|
567
|
-
};
|
|
568
|
-
|
|
569
|
-
const styles = StyleSheet.create({
|
|
570
|
-
container: {
|
|
571
|
-
flexShrink: 1,
|
|
572
|
-
width: '100%',
|
|
573
|
-
},
|
|
574
|
-
content: {
|
|
575
|
-
flexShrink: 1,
|
|
576
|
-
},
|
|
577
|
-
scrollContent: createScreenContentStyle(HEADER_PADDING_TOP_SETTINGS),
|
|
578
|
-
headerContainer: {
|
|
579
|
-
width: '100%',
|
|
580
|
-
maxWidth: 420,
|
|
581
|
-
alignSelf: 'center',
|
|
582
|
-
marginBottom: SECTION_GAP_LARGE,
|
|
583
|
-
},
|
|
584
|
-
headerSection: {
|
|
585
|
-
alignItems: 'flex-start',
|
|
586
|
-
width: '100%',
|
|
587
|
-
gap: COMPONENT_GAP,
|
|
588
|
-
},
|
|
589
|
-
modernTitle: {
|
|
590
|
-
fontWeight: Platform.OS === 'web' ? 'bold' : undefined,
|
|
591
|
-
fontSize: 42,
|
|
592
|
-
lineHeight: 50.4, // 42 * 1.2
|
|
593
|
-
textAlign: 'left',
|
|
594
|
-
letterSpacing: -0.5,
|
|
595
|
-
},
|
|
596
|
-
modernSubtitle: {
|
|
597
|
-
fontSize: 18,
|
|
598
|
-
lineHeight: 24,
|
|
599
|
-
textAlign: 'left',
|
|
600
|
-
maxWidth: 320,
|
|
601
|
-
alignSelf: 'flex-start',
|
|
602
|
-
opacity: 0.8,
|
|
603
|
-
},
|
|
604
|
-
section: {
|
|
605
|
-
marginBottom: SECTION_GAP_LARGE,
|
|
606
|
-
},
|
|
607
|
-
sectionTitle: {
|
|
608
|
-
fontSize: 13,
|
|
609
|
-
fontWeight: '600',
|
|
610
|
-
marginBottom: 8,
|
|
611
|
-
marginTop: 4,
|
|
612
|
-
textTransform: 'uppercase',
|
|
613
|
-
letterSpacing: 0.5,
|
|
614
|
-
},
|
|
615
|
-
groupedSectionWrapper: {
|
|
616
|
-
backgroundColor: 'transparent',
|
|
617
|
-
},
|
|
618
|
-
});
|
|
619
|
-
|
|
620
|
-
export default React.memo(AccountSettingsScreen);
|