@oxyhq/services 13.0.2 → 13.1.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 +18 -11
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/components/AccountMenuButton.js +8 -10
- package/lib/commonjs/ui/components/AccountMenuButton.js.map +1 -1
- package/lib/commonjs/ui/components/AccountSwitcher.js +65 -35
- package/lib/commonjs/ui/components/AccountSwitcher.js.map +1 -1
- package/lib/commonjs/ui/components/ProfileButton.js +233 -0
- package/lib/commonjs/ui/components/ProfileButton.js.map +1 -0
- package/lib/commonjs/ui/components/ProfileMenu.js +374 -0
- package/lib/commonjs/ui/components/ProfileMenu.js.map +1 -0
- package/lib/commonjs/ui/context/OxyContext.js +213 -101
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js +28 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +2 -2
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/usePaymentQueries.js +12 -12
- package/lib/commonjs/ui/hooks/queries/usePaymentQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useServicesQueries.js +8 -7
- package/lib/commonjs/ui/hooks/queries/useServicesQueries.js.map +1 -1
- package/lib/commonjs/ui/index.js +14 -0
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +11 -6
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +3 -3
- package/lib/commonjs/ui/screens/CreateAccountScreen.js +6 -4
- package/lib/commonjs/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +8 -7
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +13 -13
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HistoryViewScreen.js +7 -7
- package/lib/commonjs/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +5 -5
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ManageAccountScreen.js +17 -18
- package/lib/commonjs/ui/screens/ManageAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +3 -3
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +9 -9
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SavesCollectionsScreen.js +4 -4
- package/lib/commonjs/ui/screens/SavesCollectionsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SearchSettingsScreen.js +6 -6
- package/lib/commonjs/ui/screens/SearchSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js +6 -6
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js +4 -4
- package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js +4 -4
- package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js.map +1 -1
- package/lib/commonjs/ui/utils/activeAuthuser.js +76 -8
- package/lib/commonjs/ui/utils/activeAuthuser.js.map +1 -1
- package/lib/module/index.js +5 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/components/AccountMenuButton.js +8 -10
- package/lib/module/ui/components/AccountMenuButton.js.map +1 -1
- package/lib/module/ui/components/AccountSwitcher.js +65 -35
- package/lib/module/ui/components/AccountSwitcher.js.map +1 -1
- package/lib/module/ui/components/ProfileButton.js +228 -0
- package/lib/module/ui/components/ProfileButton.js.map +1 -0
- package/lib/module/ui/components/ProfileMenu.js +370 -0
- package/lib/module/ui/components/ProfileMenu.js.map +1 -0
- package/lib/module/ui/context/OxyContext.js +214 -102
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js +29 -2
- package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/module/ui/hooks/queries/useAccountQueries.js +2 -2
- package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/module/ui/hooks/queries/usePaymentQueries.js +12 -12
- package/lib/module/ui/hooks/queries/usePaymentQueries.js.map +1 -1
- package/lib/module/ui/hooks/queries/useServicesQueries.js +9 -7
- package/lib/module/ui/hooks/queries/useServicesQueries.js.map +1 -1
- package/lib/module/ui/index.js +2 -0
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +11 -6
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +3 -3
- package/lib/module/ui/screens/CreateAccountScreen.js +6 -4
- package/lib/module/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/EditProfileFieldScreen.js +8 -7
- package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +13 -13
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/HistoryViewScreen.js +7 -7
- package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/module/ui/screens/LanguageSelectorScreen.js +5 -5
- package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -1
- package/lib/module/ui/screens/ManageAccountScreen.js +17 -18
- package/lib/module/ui/screens/ManageAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js +3 -3
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/module/ui/screens/PrivacySettingsScreen.js +9 -9
- package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileScreen.js +1 -1
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/SavesCollectionsScreen.js +4 -4
- package/lib/module/ui/screens/SavesCollectionsScreen.js.map +1 -1
- package/lib/module/ui/screens/SearchSettingsScreen.js +6 -6
- package/lib/module/ui/screens/SearchSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/WelcomeNewUserScreen.js +6 -6
- package/lib/module/ui/screens/WelcomeNewUserScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustCenterScreen.js +4 -4
- package/lib/module/ui/screens/trust/TrustCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustRewardsScreen.js +4 -4
- package/lib/module/ui/screens/trust/TrustRewardsScreen.js.map +1 -1
- package/lib/module/ui/utils/activeAuthuser.js +74 -9
- package/lib/module/ui/utils/activeAuthuser.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +4 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/AccountMenuButton.d.ts +5 -7
- package/lib/typescript/commonjs/ui/components/AccountMenuButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/AccountSwitcher.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ActivityIndicator.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/ActivityIndicator.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/CrossFadeIcon.d.ts +2 -1
- package/lib/typescript/commonjs/ui/components/CrossFadeIcon.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/FontLoader.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/FontLoader.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/HelperText.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/HelperText.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts +46 -0
- package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/ProfileMenu.d.ts +39 -0
- package/lib/typescript/commonjs/ui/components/ProfileMenu.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/TextField/Addons/Outline.d.ts +2 -1
- package/lib/typescript/commonjs/ui/components/TextField/Addons/Outline.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/TextField/Addons/Underline.d.ts +2 -1
- package/lib/typescript/commonjs/ui/components/TextField/Addons/Underline.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/TextField/Adornment/TextFieldAffix.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/TextField/Adornment/TextFieldIcon.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/TextField/Label/InputLabel.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/TextField/Label/LabelBackground.d.ts +2 -1
- package/lib/typescript/commonjs/ui/components/TextField/Label/LabelBackground.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/TextField/TextFieldFlat.d.ts +2 -1
- package/lib/typescript/commonjs/ui/components/TextField/TextFieldFlat.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/TextField/TextFieldOutlined.d.ts +2 -1
- package/lib/typescript/commonjs/ui/components/TextField/TextFieldOutlined.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +11 -26
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/ThemeContext.d.ts +1 -1
- package/lib/typescript/commonjs/ui/context/ThemeContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/index.d.ts +2 -0
- package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountSwitcherScreen.d.ts +3 -3
- package/lib/typescript/commonjs/ui/screens/CreateAccountScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/activeAuthuser.d.ts +24 -0
- package/lib/typescript/commonjs/ui/utils/activeAuthuser.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +64 -61
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/client.d.ts +26 -26
- package/lib/typescript/module/ui/client.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/AccountMenuButton.d.ts +5 -7
- package/lib/typescript/module/ui/components/AccountMenuButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/AccountSwitcher.d.ts +1 -1
- package/lib/typescript/module/ui/components/AccountSwitcher.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ActivityIndicator.d.ts +2 -2
- package/lib/typescript/module/ui/components/ActivityIndicator.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/BottomSheetRouter.d.ts +1 -1
- package/lib/typescript/module/ui/components/BottomSheetRouter.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/CrossFadeIcon.d.ts +4 -3
- package/lib/typescript/module/ui/components/CrossFadeIcon.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/FontLoader.d.ts +1 -1
- package/lib/typescript/module/ui/components/FontLoader.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/HelperText.d.ts +1 -1
- package/lib/typescript/module/ui/components/HelperText.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/Icon.d.ts +1 -1
- package/lib/typescript/module/ui/components/Icon.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/IconButton/IconButton.d.ts +3 -3
- package/lib/typescript/module/ui/components/IconButton/IconButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/IconButton/utils.d.ts +1 -1
- package/lib/typescript/module/ui/components/IconButton/utils.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyPayButton.d.ts +1 -1
- package/lib/typescript/module/ui/components/OxyPayButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyProvider.d.ts +1 -1
- package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ProfileButton.d.ts +46 -0
- package/lib/typescript/module/ui/components/ProfileButton.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/ProfileMenu.d.ts +39 -0
- package/lib/typescript/module/ui/components/ProfileMenu.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/StepBasedScreen.d.ts +2 -2
- package/lib/typescript/module/ui/components/StepBasedScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/Surface.d.ts +2 -2
- package/lib/typescript/module/ui/components/Surface.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TextField/Addons/Outline.d.ts +3 -2
- package/lib/typescript/module/ui/components/TextField/Addons/Outline.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TextField/Addons/Underline.d.ts +3 -2
- package/lib/typescript/module/ui/components/TextField/Addons/Underline.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TextField/Adornment/TextFieldAdornment.d.ts +3 -3
- package/lib/typescript/module/ui/components/TextField/Adornment/TextFieldAdornment.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TextField/Adornment/TextFieldAffix.d.ts +3 -3
- package/lib/typescript/module/ui/components/TextField/Adornment/TextFieldAffix.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TextField/Adornment/TextFieldIcon.d.ts +4 -4
- package/lib/typescript/module/ui/components/TextField/Adornment/TextFieldIcon.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TextField/Adornment/types.d.ts +1 -1
- package/lib/typescript/module/ui/components/TextField/Adornment/types.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TextField/Adornment/utils.d.ts +1 -1
- package/lib/typescript/module/ui/components/TextField/Adornment/utils.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TextField/Label/InputLabel.d.ts +2 -2
- package/lib/typescript/module/ui/components/TextField/Label/InputLabel.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TextField/Label/LabelBackground.d.ts +3 -2
- package/lib/typescript/module/ui/components/TextField/Label/LabelBackground.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TextField/TextFieldFlat.d.ts +3 -2
- package/lib/typescript/module/ui/components/TextField/TextFieldFlat.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TextField/TextFieldOutlined.d.ts +3 -2
- package/lib/typescript/module/ui/components/TextField/TextFieldOutlined.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TextField/helpers.d.ts +3 -3
- package/lib/typescript/module/ui/components/TextField/helpers.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TextField/types.d.ts +1 -1
- package/lib/typescript/module/ui/components/TextField/types.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TextField.d.ts +4 -4
- package/lib/typescript/module/ui/components/TextField.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TouchableRipple/TouchableRipple.d.ts +3 -3
- package/lib/typescript/module/ui/components/TouchableRipple/TouchableRipple.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TouchableRipple/TouchableRipple.native.d.ts +3 -3
- package/lib/typescript/module/ui/components/TouchableRipple/TouchableRipple.native.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TouchableRipple/utils.d.ts +1 -1
- package/lib/typescript/module/ui/components/TouchableRipple/utils.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/Typography/AnimatedText.d.ts +3 -3
- package/lib/typescript/module/ui/components/Typography/AnimatedText.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/accountMenuRows.d.ts +1 -1
- package/lib/typescript/module/ui/components/accountMenuRows.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/feedback/ProgressIndicator.d.ts +1 -1
- package/lib/typescript/module/ui/components/feedback/ProgressIndicator.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/feedback/constants.d.ts +1 -1
- package/lib/typescript/module/ui/components/feedback/constants.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/feedback/useFeedbackForm.d.ts +1 -1
- package/lib/typescript/module/ui/components/feedback/useFeedbackForm.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/payment/PaymentDetailsStep.d.ts +1 -1
- package/lib/typescript/module/ui/components/payment/PaymentDetailsStep.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/payment/PaymentMethodStep.d.ts +1 -1
- package/lib/typescript/module/ui/components/payment/PaymentMethodStep.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/payment/PaymentReviewStep.d.ts +1 -1
- package/lib/typescript/module/ui/components/payment/PaymentReviewStep.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/payment/PaymentSuccessStep.d.ts +1 -1
- package/lib/typescript/module/ui/components/payment/PaymentSuccessStep.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/payment/PaymentSummaryStep.d.ts +1 -1
- package/lib/typescript/module/ui/components/payment/PaymentSummaryStep.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/payment/constants.d.ts +1 -1
- package/lib/typescript/module/ui/components/payment/constants.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/payment/paymentStyles.d.ts +1 -1
- package/lib/typescript/module/ui/components/payment/paymentStyles.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/theming.d.ts +1 -1
- package/lib/typescript/module/ui/components/theming.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/OxyContext.d.ts +14 -29
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/ThemeContext.d.ts +1 -1
- package/lib/typescript/module/ui/context/ThemeContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts +2 -2
- package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/usePaymentQueries.d.ts +1 -1
- package/lib/typescript/module/ui/hooks/queries/usePaymentQueries.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queryClient.d.ts +1 -1
- package/lib/typescript/module/ui/hooks/queryClient.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useAuth.d.ts +1 -1
- package/lib/typescript/module/ui/hooks/useAuth.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useAvatarPicker.d.ts +1 -1
- package/lib/typescript/module/ui/hooks/useAvatarPicker.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useLanguageManagement.d.ts +1 -1
- package/lib/typescript/module/ui/hooks/useLanguageManagement.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useSessionManagement.d.ts +1 -1
- package/lib/typescript/module/ui/hooks/useSessionManagement.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useStorage.d.ts +1 -1
- package/lib/typescript/module/ui/hooks/useStorage.d.ts.map +1 -1
- package/lib/typescript/module/ui/index.d.ts +30 -28
- package/lib/typescript/module/ui/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts +1 -1
- package/lib/typescript/module/ui/navigation/bottomSheetManager.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/AccountMembersScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/AccountMembersScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountSwitcherScreen.d.ts +4 -4
- package/lib/typescript/module/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountVerificationScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/AccountVerificationScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AppInfoScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/AppInfoScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AvatarCropScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/AvatarCropScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/ConnectedAppsScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/ConnectedAppsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/CreateAccountScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/CreateAccountScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FAQScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/FAQScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FeedbackScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FollowersListScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/FollowersListScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FollowingListScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/FollowingListScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/HelpSupportScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/HelpSupportScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/HistoryViewScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/HistoryViewScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/LanguageSelectorScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/LanguageSelectorScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/LearnMoreUsernamesScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/LearnMoreUsernamesScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/LegalDocumentsScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/LegalDocumentsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/NotificationsScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/NotificationsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/OxyAuthScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/OxyAuthScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/PaymentGatewayScreen.d.ts +2 -2
- package/lib/typescript/module/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/PreferencesScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/PreferencesScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/PremiumSubscriptionScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/PrivacySettingsScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/ProfileScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/ProfileScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/SavesCollectionsScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/SavesCollectionsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/SearchSettingsScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/SearchSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/UserLinksScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/UserLinksScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/UserListScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/UserListScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/WelcomeNewUserScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/trust/TrustAboutScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/trust/TrustAboutScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/trust/TrustCenterScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/trust/TrustCenterScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/trust/TrustFAQScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/trust/TrustFAQScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/trust/TrustLeaderboardScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/trust/TrustLeaderboardScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/trust/TrustRewardsScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/trust/TrustRewardsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/trust/TrustRulesScreen.d.ts +1 -1
- package/lib/typescript/module/ui/screens/trust/TrustRulesScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/server.d.ts +2 -2
- package/lib/typescript/module/ui/server.d.ts.map +1 -1
- package/lib/typescript/module/ui/types/fileManagement.d.ts +1 -1
- package/lib/typescript/module/ui/types/fileManagement.d.ts.map +1 -1
- package/lib/typescript/module/ui/types/navigation.d.ts +1 -1
- package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/activeAuthuser.d.ts +24 -0
- package/lib/typescript/module/ui/utils/activeAuthuser.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/fileManagement.d.ts +1 -1
- package/lib/typescript/module/ui/utils/fileManagement.d.ts.map +1 -1
- package/package.json +21 -20
- package/src/index.ts +8 -5
- package/src/ui/components/AccountMenuButton.tsx +9 -11
- package/src/ui/components/AccountSwitcher.tsx +71 -37
- package/src/ui/components/ProfileButton.tsx +270 -0
- package/src/ui/components/ProfileMenu.tsx +416 -0
- package/src/ui/context/OxyContext.tsx +217 -130
- package/src/ui/context/hooks/useAuthOperations.ts +35 -2
- package/src/ui/hooks/queries/useAccountQueries.ts +2 -2
- package/src/ui/hooks/queries/usePaymentQueries.ts +12 -12
- package/src/ui/hooks/queries/useServicesQueries.ts +9 -6
- package/src/ui/index.ts +2 -0
- package/src/ui/screens/AccountSettingsScreen.tsx +9 -5
- package/src/ui/screens/AccountSwitcherScreen.tsx +3 -3
- package/src/ui/screens/CreateAccountScreen.tsx +6 -4
- package/src/ui/screens/EditProfileFieldScreen.tsx +8 -7
- package/src/ui/screens/FileManagementScreen.tsx +13 -13
- package/src/ui/screens/HistoryViewScreen.tsx +7 -7
- package/src/ui/screens/LanguageSelectorScreen.tsx +5 -5
- package/src/ui/screens/ManageAccountScreen.tsx +17 -18
- package/src/ui/screens/PremiumSubscriptionScreen.tsx +3 -3
- package/src/ui/screens/PrivacySettingsScreen.tsx +9 -9
- package/src/ui/screens/ProfileScreen.tsx +1 -1
- package/src/ui/screens/SavesCollectionsScreen.tsx +5 -5
- package/src/ui/screens/SearchSettingsScreen.tsx +6 -6
- package/src/ui/screens/WelcomeNewUserScreen.tsx +6 -6
- package/src/ui/screens/trust/TrustCenterScreen.tsx +5 -5
- package/src/ui/screens/trust/TrustRewardsScreen.tsx +4 -4
- package/src/ui/utils/__tests__/activeAuthuser.test.ts +75 -0
- package/src/ui/utils/activeAuthuser.ts +74 -8
- package/lib/commonjs/ui/components/ActiveAccountBanner.js +0 -144
- package/lib/commonjs/ui/components/ActiveAccountBanner.js.map +0 -1
- package/lib/module/ui/components/ActiveAccountBanner.js +0 -141
- package/lib/module/ui/components/ActiveAccountBanner.js.map +0 -1
- package/lib/typescript/commonjs/ui/components/ActiveAccountBanner.d.ts +0 -4
- package/lib/typescript/commonjs/ui/components/ActiveAccountBanner.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/ActiveAccountBanner.d.ts +0 -4
- package/lib/typescript/module/ui/components/ActiveAccountBanner.d.ts.map +0 -1
- package/src/ui/components/ActiveAccountBanner.tsx +0 -130
|
@@ -43,7 +43,7 @@ import { useAuthOperations } from './hooks/useAuthOperations';
|
|
|
43
43
|
import { useDeviceManagement } from '../hooks/useDeviceManagement';
|
|
44
44
|
import { getStorageKeys, createPlatformStorage, type StorageInterface } from '../utils/storageHelpers';
|
|
45
45
|
import { isInvalidSessionError, isTimeoutOrNetworkError } from '../utils/errorHandlers';
|
|
46
|
-
import { readActiveAuthuser, writeActiveAuthuser } from '../utils/activeAuthuser';
|
|
46
|
+
import { readActiveAuthuser, writeActiveAuthuser, clearSignedOut, isSilentRestoreSuppressed } from '../utils/activeAuthuser';
|
|
47
47
|
import type { RouteName } from '../navigation/routes';
|
|
48
48
|
import { showBottomSheet as globalShowBottomSheet } from '../navigation/bottomSheetManager';
|
|
49
49
|
import { useQueryClient } from '@tanstack/react-query';
|
|
@@ -161,42 +161,26 @@ export interface OxyContextState {
|
|
|
161
161
|
// the caller). The cryptographic Commons/DID "identity" is a SEPARATE concept.
|
|
162
162
|
//
|
|
163
163
|
// UX concept: the user picks an account and the WHOLE app becomes that account
|
|
164
|
-
// — a genuine
|
|
165
|
-
//
|
|
166
|
-
//
|
|
167
|
-
//
|
|
168
|
-
// surfaces; `actingAs` is the low-level mechanism state.
|
|
169
|
-
/**
|
|
170
|
-
* The id of the account switched INTO (`X-Acting-As`), or `null` when the
|
|
171
|
-
* active account is the sign-in's own personal account. This is the underlying
|
|
172
|
-
* mechanism state — UI should present the result through {@link activeAccount}
|
|
173
|
-
* rather than framing it as delegation.
|
|
174
|
-
*/
|
|
175
|
-
actingAs: string | null;
|
|
164
|
+
// — a genuine, REAL-SESSION switch (`switchToAccount`), identical to switching
|
|
165
|
+
// between device sign-ins. There is NO separate "active account" concept:
|
|
166
|
+
// `user` IS the active account after a switch. The removed `X-Acting-As`
|
|
167
|
+
// delegation header is gone entirely.
|
|
176
168
|
/** Every account the caller can access — own personal root, owned, and shared — from `listAccounts()`. */
|
|
177
169
|
accounts: AccountNode[];
|
|
178
170
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* account, or while the switched-into id has not yet appeared in the loaded
|
|
182
|
-
* `accounts` list.
|
|
183
|
-
*/
|
|
184
|
-
actingAsAccount: AccountNode | null;
|
|
185
|
-
/**
|
|
186
|
-
* The effective ACTIVE account presented across the whole app — the account
|
|
187
|
-
* the user switched into when one is set and resolved, otherwise the signed-in
|
|
188
|
-
* user's own personal account. This is the single "who am I" source every
|
|
189
|
-
* identity surface (header avatar/name, profile chrome, context cues) should
|
|
190
|
-
* read, so a switch is reflected everywhere as a real account change.
|
|
171
|
+
* Switch the active session INTO an account from the {@link accounts} graph
|
|
172
|
+
* (a managed org/project/bot, or an account shared with the caller).
|
|
191
173
|
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
174
|
+
* Mints and plants a REAL session for the target via
|
|
175
|
+
* `oxyServices.switchToAccount`, then commits it into context state the SAME
|
|
176
|
+
* way sign-in / {@link switchSession} do — so afterwards `user` IS the target
|
|
177
|
+
* account and every request authenticates as it. The minted session joins the
|
|
178
|
+
* device multi-account set (server-set httpOnly `oxy_rt_<authuser>` cookie), so
|
|
179
|
+
* it survives reload / `refresh-all` and appears in the device account list
|
|
180
|
+
* exactly like a device sign-in. Refreshes the account graph and invalidates
|
|
181
|
+
* all React Query data so everything reloads as the new account.
|
|
197
182
|
*/
|
|
198
|
-
|
|
199
|
-
setActingAs: (accountId: string | null) => void;
|
|
183
|
+
switchToAccount: (accountId: string) => Promise<void>;
|
|
200
184
|
refreshAccounts: () => Promise<void>;
|
|
201
185
|
createAccount: (data: CreateAccountInput) => Promise<AccountNode>;
|
|
202
186
|
}
|
|
@@ -1325,6 +1309,54 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
1325
1309
|
}
|
|
1326
1310
|
}
|
|
1327
1311
|
|
|
1312
|
+
// LAST-ACTIVE-ACCOUNT priority (web multi-account). When the user has an
|
|
1313
|
+
// explicit persisted active slot (`oxy_active_authuser`, written on every
|
|
1314
|
+
// device sign-in / account SWITCH / cookie restore), the multi-account
|
|
1315
|
+
// refresh-cookie restore is the ONLY cold-boot step that honors WHICH slot
|
|
1316
|
+
// was last active — `restoreViaRefreshCookie` selects it via
|
|
1317
|
+
// `selectActiveRefreshAccount(accounts, readActiveAuthuser())`. The
|
|
1318
|
+
// `fedcm-silent` and per-apex `silent-iframe` steps only ever recover the
|
|
1319
|
+
// PRIMARY central IdP session, so if either ran first they would clobber a
|
|
1320
|
+
// switched (managed/org) account back to the primary on reload — the exact
|
|
1321
|
+
// "switch is lost on reload" regression. So when a slot selection exists we
|
|
1322
|
+
// run cookie-restore BEFORE those probes (and disable the later duplicate).
|
|
1323
|
+
//
|
|
1324
|
+
// Read ONCE here (synchronously usable by the step `enabled` gates below).
|
|
1325
|
+
// It is non-null ONLY on first-party web apps that persist the slot. Both the
|
|
1326
|
+
// device sign-in/switch paths AND `handleWebSSOSession` (FedCM/SSO/credentials
|
|
1327
|
+
// commit funnel) now persist it — but only when the session genuinely joined
|
|
1328
|
+
// the device set: `establishDeviceRefreshSlot` returns an `authuser` ONLY on
|
|
1329
|
+
// first-party web (same registrable apex as the API), so a cross-apex RP never
|
|
1330
|
+
// writes a phantom slot and native has no localStorage. Both therefore keep
|
|
1331
|
+
// their existing order untouched. The earlier `stored-session` step still runs
|
|
1332
|
+
// first (FIX-A latency), and when a slot exists but its cookies have all
|
|
1333
|
+
// lapsed, cookie-restore simply returns no accounts and the chain falls through
|
|
1334
|
+
// to the cross-domain fallbacks exactly as before.
|
|
1335
|
+
const prioritizeMultiAccount = isWebBrowser() && readActiveAuthuser() !== null;
|
|
1336
|
+
|
|
1337
|
+
// DELIBERATELY-SIGNED-OUT gate (web): when the user pressed "Sign out", any
|
|
1338
|
+
// credential that can silently re-mint a session may still be live on the
|
|
1339
|
+
// next reload — the central IdP session (FedCM credential association /
|
|
1340
|
+
// per-apex `fedcm_session` cookie) AND the device refresh cookies. Since
|
|
1341
|
+
// PR #455 the PRIMARY web session also joins the `oxy_rt_<authuser>` device
|
|
1342
|
+
// set, so the un-gated cookie-restore steps would `refresh-all` that still-
|
|
1343
|
+
// present cookie and sign the user back in without intent — exactly the
|
|
1344
|
+
// "sign-out is silently undone" regression. So this flag gates EVERY
|
|
1345
|
+
// AUTOMATIC silent-restore cold-boot step: `stored-session`,
|
|
1346
|
+
// `cookie-restore-active`, `fedcm-silent`, `silent-iframe`, and
|
|
1347
|
+
// `cookie-restore`. The gate — not a cookie wipe — is the authority: the
|
|
1348
|
+
// account may stay "known" for a fast deliberate re-sign-in, but no step
|
|
1349
|
+
// restores it silently while the flag is set. Read the durable flag ONCE here
|
|
1350
|
+
// (synchronously usable by every step `enabled` gate). Any deliberate sign-in
|
|
1351
|
+
// (password, FedCM, account switch, device claim) clears it, so there is no
|
|
1352
|
+
// "stuck signed out" state. The `sso-bounce` step needs no extra gate: it is
|
|
1353
|
+
// already self-suppressed after sign-out (its `hasPriorSession` hint is
|
|
1354
|
+
// cleared). `sso-return` is NOT gated — it commits the result of a deliberate
|
|
1355
|
+
// top-level `/sso` bounce the user just initiated. `shared-key-signin` is
|
|
1356
|
+
// native-only and the flag never sets on native (`markSignedOut` no-ops
|
|
1357
|
+
// off-web), so its gate would be moot; it is left untouched.
|
|
1358
|
+
const silentRestoreBlocked = isSilentRestoreSuppressed();
|
|
1359
|
+
|
|
1328
1360
|
try {
|
|
1329
1361
|
const outcome = await runColdBoot<true>({
|
|
1330
1362
|
steps: [
|
|
@@ -1342,12 +1374,17 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
1342
1374
|
},
|
|
1343
1375
|
},
|
|
1344
1376
|
{
|
|
1345
|
-
// 2) Stored-session bearer restore.
|
|
1346
|
-
//
|
|
1347
|
-
//
|
|
1348
|
-
// common WEB reload winner.
|
|
1377
|
+
// 2) Stored-session bearer restore. Runs on ALL platforms EXCEPT when
|
|
1378
|
+
// the deliberately-signed-out flag is set (web only — it never sets on
|
|
1379
|
+
// native, so native still always reaches exactly this step, its ONLY
|
|
1380
|
+
// restore path). This is also the common WEB reload winner.
|
|
1381
|
+
//
|
|
1382
|
+
// SIGNED-OUT GATE: after a deliberate full sign-out the stored session
|
|
1383
|
+
// state is cleared, so this would normally skip anyway — but the gate
|
|
1384
|
+
// makes that authoritative rather than incidental, so no residual
|
|
1385
|
+
// stored token can silently restore while the user is signed out.
|
|
1349
1386
|
//
|
|
1350
|
-
// ORDERING (FIX A): this step
|
|
1387
|
+
// ORDERING (FIX A): this step runs BEFORE the slow web-only
|
|
1351
1388
|
// probes (`fedcm-silent`, `silent-iframe`, `cookie-restore`). On a
|
|
1352
1389
|
// normal reload the local bearer validates in one round-trip and
|
|
1353
1390
|
// wins; `runColdBoot` then short-circuits and never even evaluates
|
|
@@ -1358,6 +1395,7 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
1358
1395
|
// local session this step skips and the cross-domain fallback chain
|
|
1359
1396
|
// (fedcm → iframe → cookie → sso-bounce) runs exactly as before.
|
|
1360
1397
|
id: 'stored-session',
|
|
1398
|
+
enabled: () => !silentRestoreBlocked,
|
|
1361
1399
|
run: async () => {
|
|
1362
1400
|
const restored = await restoreStoredSession();
|
|
1363
1401
|
if (restored) {
|
|
@@ -1419,6 +1457,34 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
1419
1457
|
return { kind: 'session', session: true };
|
|
1420
1458
|
},
|
|
1421
1459
|
},
|
|
1460
|
+
{
|
|
1461
|
+
// 2.75) LAST-ACTIVE multi-account restore (WEB, prioritized). Runs
|
|
1462
|
+
// ONLY when an explicit persisted slot selection exists
|
|
1463
|
+
// (`prioritizeMultiAccount`) — i.e. the user previously signed in or
|
|
1464
|
+
// SWITCHED accounts on this first-party app. It runs BEFORE the
|
|
1465
|
+
// `fedcm-silent` / `silent-iframe` probes (which only ever recover the
|
|
1466
|
+
// PRIMARY central session) so a switched managed/org account survives
|
|
1467
|
+
// reload instead of being clobbered back to the primary. The restore
|
|
1468
|
+
// itself is the SAME `restoreViaRefreshCookie` as the terminal-tier
|
|
1469
|
+
// step below: it rotates every device-local `oxy_rt_<authuser>` cookie
|
|
1470
|
+
// and picks the persisted slot via `selectActiveRefreshAccount`,
|
|
1471
|
+
// committing it (token + state + durable persistence + `markAuthResolved`).
|
|
1472
|
+
// When no slot is persisted this is disabled and the original order is
|
|
1473
|
+
// unchanged; when the slot's cookies have lapsed it returns no accounts
|
|
1474
|
+
// and the chain falls through to the cross-domain fallbacks below.
|
|
1475
|
+
//
|
|
1476
|
+
// SIGNED-OUT GATE: since PR #455 the primary's `oxy_rt` slot survives a
|
|
1477
|
+
// deliberate sign-out, so without this gate `refresh-all` would re-mint
|
|
1478
|
+
// and silently re-log-in the user on reload. The flag is cleared by any
|
|
1479
|
+
// deliberate sign-in (including an account SWITCH, which also writes the
|
|
1480
|
+
// new active slot), so the switch-survives-reload path is unaffected.
|
|
1481
|
+
id: 'cookie-restore-active',
|
|
1482
|
+
enabled: () => prioritizeMultiAccount && !silentRestoreBlocked,
|
|
1483
|
+
run: async () => {
|
|
1484
|
+
const restored = await restoreViaRefreshCookie();
|
|
1485
|
+
return restored ? { kind: 'session', session: true } : { kind: 'skip' };
|
|
1486
|
+
},
|
|
1487
|
+
},
|
|
1422
1488
|
{
|
|
1423
1489
|
// 3) FedCM silent reauthn (Chrome) against the CENTRAL IdP
|
|
1424
1490
|
// (auth.oxy.so). `silentSignInWithFedCM` plants the access token
|
|
@@ -1432,7 +1498,10 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
1432
1498
|
// valid local bearer, and skipping it avoids the silent round-trip.
|
|
1433
1499
|
id: 'fedcm-silent',
|
|
1434
1500
|
enabled: () =>
|
|
1435
|
-
!storedSessionRestored &&
|
|
1501
|
+
!storedSessionRestored &&
|
|
1502
|
+
!silentRestoreBlocked &&
|
|
1503
|
+
fedcmSupported &&
|
|
1504
|
+
!servicesSilentAttempted.has(silentKey),
|
|
1436
1505
|
run: async () => {
|
|
1437
1506
|
servicesSilentAttempted.add(silentKey);
|
|
1438
1507
|
const session = await oxyServices.silentSignInWithFedCM?.();
|
|
@@ -1467,7 +1536,7 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
1467
1536
|
// FIX-D: bounded by `SILENT_IFRAME_TIMEOUT` (plus `iframe.onerror`
|
|
1468
1537
|
// fail-fast in core) so a no-message iframe cannot stall cold boot.
|
|
1469
1538
|
id: 'silent-iframe',
|
|
1470
|
-
enabled: () => !storedSessionRestored && isWebBrowser(),
|
|
1539
|
+
enabled: () => !storedSessionRestored && !silentRestoreBlocked && isWebBrowser(),
|
|
1471
1540
|
run: async () => {
|
|
1472
1541
|
if (!commitWebSession) {
|
|
1473
1542
|
return { kind: 'skip' };
|
|
@@ -1493,8 +1562,20 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
1493
1562
|
// is correct; cross-domain restore is handled by the SSO bounce.
|
|
1494
1563
|
// FIX-D: `restoreViaRefreshCookie` bounds the request with
|
|
1495
1564
|
// `COOKIE_RESTORE_TIMEOUT` so a cross-domain stall cannot hang here.
|
|
1565
|
+
//
|
|
1566
|
+
// Disabled when `prioritizeMultiAccount` already ran the
|
|
1567
|
+
// `cookie-restore-active` step above (an explicit persisted slot) — that
|
|
1568
|
+
// earlier step is the identical restore, so this terminal-tier copy
|
|
1569
|
+
// would be a redundant second `refreshAllSessions`. It still runs in the
|
|
1570
|
+
// common no-persisted-slot case (e.g. first visit to a first-party app
|
|
1571
|
+
// whose central refresh cookies already exist).
|
|
1572
|
+
//
|
|
1573
|
+
// SIGNED-OUT GATE (same rationale as `cookie-restore-active`): the
|
|
1574
|
+
// primary's `oxy_rt` slot survives a deliberate sign-out (PR #455), so
|
|
1575
|
+
// this must be skipped while the signed-out flag is set or it would
|
|
1576
|
+
// silently re-restore the primary on reload.
|
|
1496
1577
|
id: 'cookie-restore',
|
|
1497
|
-
enabled: () => isWebBrowser(),
|
|
1578
|
+
enabled: () => isWebBrowser() && !prioritizeMultiAccount && !silentRestoreBlocked,
|
|
1498
1579
|
run: async () => {
|
|
1499
1580
|
const restored = await restoreViaRefreshCookie();
|
|
1500
1581
|
return restored ? { kind: 'session', session: true } : { kind: 'skip' };
|
|
@@ -1743,6 +1824,38 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
1743
1824
|
}
|
|
1744
1825
|
oxyServices.httpService.setTokens(session.accessToken);
|
|
1745
1826
|
|
|
1827
|
+
// A committed web session re-enables automatic silent restore: clear the
|
|
1828
|
+
// durable "deliberately signed out" flag. This funnel is reached by deliberate
|
|
1829
|
+
// sign-ins (password, interactive FedCM, `/sso` return) AND by the silent
|
|
1830
|
+
// cold-boot steps — but those are GATED on the flag, so when it is set they
|
|
1831
|
+
// never run and never reach here; clearing is therefore only hit on a genuine
|
|
1832
|
+
// (re-)sign-in or when restore was already permitted, both correct.
|
|
1833
|
+
clearSignedOut();
|
|
1834
|
+
|
|
1835
|
+
// Register this primary session in the device's first-party multi-account
|
|
1836
|
+
// refresh-cookie set (web only). Every web primary-session restore funnels
|
|
1837
|
+
// through here — FedCM silent (`/fedcm/exchange`), per-apex `/auth/silent`
|
|
1838
|
+
// iframe, central `/sso` return, and keyless password sign-in. Of those, only
|
|
1839
|
+
// a same-apex `/fedcm/exchange` plants an `oxy_rt_<authuser>` slot as a side
|
|
1840
|
+
// effect; the cross-origin/credential-less restores (`/sso/exchange`,
|
|
1841
|
+
// `/auth/silent` postMessage) cannot set an `api.oxy.so` cookie at all. So
|
|
1842
|
+
// WITHOUT this call a web primary never joins the device set: `refresh-all`
|
|
1843
|
+
// returns zero accounts, and account-switch persistence + the
|
|
1844
|
+
// `cookie-restore-active` cold-boot step have no foundation. Calling the shared
|
|
1845
|
+
// `POST /auth/session` primitive here makes EVERY primary participate in the
|
|
1846
|
+
// set, re-plants the rotated token, and records the active `authuser` so the
|
|
1847
|
+
// next cold boot's `cookie-restore-active` reconciles the persisted active
|
|
1848
|
+
// (possibly switched) account instead of `fedcm-silent` clobbering it back to
|
|
1849
|
+
// the primary. Best-effort: a `null` result (native / transient failure)
|
|
1850
|
+
// leaves the in-session token untouched.
|
|
1851
|
+
const primaryAuthuser = await oxyServices.establishDeviceRefreshSlot();
|
|
1852
|
+
// A non-null slot is returned ONLY on first-party web (the helper gates on
|
|
1853
|
+
// platform + same registrable apex), so recording the active slot here is safe
|
|
1854
|
+
// and never writes a phantom authuser for a cross-apex RP or native.
|
|
1855
|
+
if (typeof primaryAuthuser === 'number') {
|
|
1856
|
+
writeActiveAuthuser(primaryAuthuser);
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1746
1859
|
const clientSession = {
|
|
1747
1860
|
sessionId: session.sessionId,
|
|
1748
1861
|
deviceId: session.deviceId || '',
|
|
@@ -1750,6 +1863,7 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
1750
1863
|
lastActive: new Date().toISOString(),
|
|
1751
1864
|
userId: session.user.id?.toString() ?? '',
|
|
1752
1865
|
isCurrent: true,
|
|
1866
|
+
...(typeof primaryAuthuser === 'number' ? { authuser: primaryAuthuser } : null),
|
|
1753
1867
|
};
|
|
1754
1868
|
|
|
1755
1869
|
updateSessions([clientSession], { merge: true });
|
|
@@ -2018,38 +2132,8 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
2018
2132
|
});
|
|
2019
2133
|
|
|
2020
2134
|
// --- Account graph state ---
|
|
2021
|
-
const [actingAs, setActingAsState] = useState<string | null>(null);
|
|
2022
2135
|
const [accounts, setAccounts] = useState<AccountNode[]>([]);
|
|
2023
2136
|
|
|
2024
|
-
// Latest `actingAs`, mirrored into a ref so `refreshAccounts` can reconcile a
|
|
2025
|
-
// stale switch without taking `actingAs` as a dependency (which would re-run
|
|
2026
|
-
// the account load on every switch). See the reconciliation block below.
|
|
2027
|
-
const actingAsRef = useRef(actingAs);
|
|
2028
|
-
actingAsRef.current = actingAs;
|
|
2029
|
-
// `setActingAs` is declared after `refreshAccounts`; route the reconciliation
|
|
2030
|
-
// clear through a ref so the load callback can call the latest implementation.
|
|
2031
|
-
const setActingAsRef = useRef<((accountId: string | null) => void) | null>(null);
|
|
2032
|
-
|
|
2033
|
-
// Restore actingAs from storage on startup
|
|
2034
|
-
useEffect(() => {
|
|
2035
|
-
if (!storage || !initialized) return;
|
|
2036
|
-
let mounted = true;
|
|
2037
|
-
(async () => {
|
|
2038
|
-
try {
|
|
2039
|
-
const stored = await storage.getItem(`${storageKeyPrefix}_acting_as`);
|
|
2040
|
-
if (mounted && stored) {
|
|
2041
|
-
setActingAsState(stored);
|
|
2042
|
-
oxyServices.setActingAs(stored);
|
|
2043
|
-
}
|
|
2044
|
-
} catch (err) {
|
|
2045
|
-
if (__DEV__) {
|
|
2046
|
-
loggerUtil.debug('Failed to restore actingAs from storage', { component: 'OxyContext' }, err as unknown);
|
|
2047
|
-
}
|
|
2048
|
-
}
|
|
2049
|
-
})();
|
|
2050
|
-
return () => { mounted = false; };
|
|
2051
|
-
}, [storage, initialized, storageKeyPrefix, oxyServices]);
|
|
2052
|
-
|
|
2053
2137
|
// Load the unified account graph when authenticated
|
|
2054
2138
|
const refreshAccounts = useCallback(async (): Promise<void> => {
|
|
2055
2139
|
if (!isAuthenticated || !tokenReady || !oxyServices.getAccessToken()) {
|
|
@@ -2060,15 +2144,6 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
2060
2144
|
try {
|
|
2061
2145
|
const list = await oxyServices.listAccounts();
|
|
2062
2146
|
setAccounts(list);
|
|
2063
|
-
// Reconcile a stale switch: if the active account was switched INTO an id
|
|
2064
|
-
// that is no longer accessible (account removed/archived, or it belonged
|
|
2065
|
-
// to a now-inactive sign-in), drop back to the personal account so the
|
|
2066
|
-
// app never keeps sending a dead `X-Acting-As` header. `list` is the
|
|
2067
|
-
// authoritative accessible set on a successful fetch.
|
|
2068
|
-
const current = actingAsRef.current;
|
|
2069
|
-
if (current && !list.some((node) => node.accountId === current)) {
|
|
2070
|
-
setActingAsRef.current?.(null);
|
|
2071
|
-
}
|
|
2072
2147
|
} catch (err) {
|
|
2073
2148
|
if (isUnauthorizedStatus(err)) {
|
|
2074
2149
|
setAccounts([]);
|
|
@@ -2087,47 +2162,68 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
2087
2162
|
}
|
|
2088
2163
|
}, [isAuthenticated, initialized, tokenReady, refreshAccounts]);
|
|
2089
2164
|
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
if (
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2165
|
+
// Switch the active session INTO an account from the unified graph. In the
|
|
2166
|
+
// REAL-SESSION model this is identical to switching device sign-ins: mint a
|
|
2167
|
+
// real session for the target and make the whole app that account. The removed
|
|
2168
|
+
// `X-Acting-As` delegation header is gone — `oxyServices.switchToAccount`
|
|
2169
|
+
// plants the minted access token (the refresh token is the server-set httpOnly
|
|
2170
|
+
// `oxy_rt_<authuser>` cookie, so the session joins the device multi-account set
|
|
2171
|
+
// and survives reload / `refresh-all`). We then commit the session into context
|
|
2172
|
+
// state the SAME way sign-in / `switchSession` do, refresh the account graph,
|
|
2173
|
+
// and invalidate every query so all data reloads as the new account.
|
|
2174
|
+
const switchToAccount = useCallback(async (accountId: string): Promise<void> => {
|
|
2175
|
+
const result = await oxyServices.switchToAccount(accountId);
|
|
2176
|
+
if (!result?.user || !result?.sessionId) {
|
|
2177
|
+
throw new Error('Account switch did not return a valid session');
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
// A switch is a deliberate sign-in into an account: re-enable automatic silent
|
|
2181
|
+
// restore by clearing any prior "deliberately signed out" flag.
|
|
2182
|
+
clearSignedOut();
|
|
2183
|
+
|
|
2184
|
+
// `oxyServices.switchToAccount` already planted `result.accessToken` as the
|
|
2185
|
+
// active token; mirror the minted session into the multi-account store and
|
|
2186
|
+
// mark it current, recording the device `authuser` slot so web silent-switch
|
|
2187
|
+
// and the device account chooser can address it.
|
|
2188
|
+
const now = new Date();
|
|
2189
|
+
const clientSession: ClientSession = {
|
|
2190
|
+
sessionId: result.sessionId,
|
|
2191
|
+
deviceId: result.deviceId || '',
|
|
2192
|
+
expiresAt: result.expiresAt || new Date(now.getTime() + DEFAULT_SESSION_VALIDITY_MS).toISOString(),
|
|
2193
|
+
lastActive: now.toISOString(),
|
|
2194
|
+
userId: result.user.id?.toString() ?? '',
|
|
2195
|
+
isCurrent: true,
|
|
2196
|
+
...(typeof result.authuser === 'number' ? { authuser: result.authuser } : null),
|
|
2197
|
+
};
|
|
2198
|
+
updateSessions([clientSession], { merge: true });
|
|
2199
|
+
setActiveSessionId(result.sessionId);
|
|
2200
|
+
if (isWebBrowser() && typeof result.authuser === 'number') {
|
|
2201
|
+
writeActiveAuthuser(result.authuser);
|
|
2202
|
+
}
|
|
2203
|
+
await persistSessionDurably(result.sessionId);
|
|
2204
|
+
|
|
2205
|
+
// Fetch the canonical User for the new account (the switch result carries
|
|
2206
|
+
// only MinimalUserData); fall back to that minimal shape if the profile
|
|
2207
|
+
// fetch fails so the app still reflects the switched identity.
|
|
2208
|
+
let fullUser: User;
|
|
2209
|
+
try {
|
|
2210
|
+
fullUser = await oxyServices.getCurrentUser();
|
|
2211
|
+
} catch (profileError) {
|
|
2212
|
+
if (__DEV__) {
|
|
2213
|
+
loggerUtil.debug('Failed to fetch full user after account switch; using switch result user', { component: 'OxyContext', method: 'switchToAccount' }, profileError as unknown);
|
|
2110
2214
|
}
|
|
2215
|
+
fullUser = result.user as unknown as User;
|
|
2111
2216
|
}
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
// account's user when a switch is set and resolved, otherwise the signed-in
|
|
2123
|
-
// user's own personal account. Derived (no effect) so identity surfaces always
|
|
2124
|
-
// render the current account without separate syncing. Falls back to `user`
|
|
2125
|
-
// while a just-set switch has not yet resolved in `accounts`, so the header
|
|
2126
|
-
// never flashes empty mid-switch.
|
|
2127
|
-
const activeAccount = useMemo<User | null>(
|
|
2128
|
-
() => (actingAs && actingAsAccount ? actingAsAccount.account : user),
|
|
2129
|
-
[actingAs, actingAsAccount, user],
|
|
2130
|
-
);
|
|
2217
|
+
loginSuccess(fullUser);
|
|
2218
|
+
onAuthStateChange?.(fullUser);
|
|
2219
|
+
|
|
2220
|
+
// Reload the switchable account graph (the new active account's relationships
|
|
2221
|
+
// differ) and invalidate every query so all data refetches as the new
|
|
2222
|
+
// account — the deviceAccounts probe re-enumerates the multi-account set so
|
|
2223
|
+
// the switched account now appears as a device session.
|
|
2224
|
+
await refreshAccounts();
|
|
2225
|
+
queryClient.invalidateQueries();
|
|
2226
|
+
}, [oxyServices, updateSessions, setActiveSessionId, persistSessionDurably, loginSuccess, onAuthStateChange, refreshAccounts, queryClient]);
|
|
2131
2227
|
|
|
2132
2228
|
const createAccountFn = useCallback(async (data: CreateAccountInput): Promise<AccountNode> => {
|
|
2133
2229
|
const account = await oxyServices.createAccount(data);
|
|
@@ -2177,11 +2273,8 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
2177
2273
|
useFollow: useFollowHook,
|
|
2178
2274
|
showBottomSheet: showBottomSheetForContext,
|
|
2179
2275
|
openAvatarPicker,
|
|
2180
|
-
actingAs,
|
|
2181
2276
|
accounts,
|
|
2182
|
-
|
|
2183
|
-
activeAccount,
|
|
2184
|
-
setActingAs,
|
|
2277
|
+
switchToAccount,
|
|
2185
2278
|
refreshAccounts,
|
|
2186
2279
|
createAccount: createAccountFn,
|
|
2187
2280
|
}), [
|
|
@@ -2224,11 +2317,8 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
2224
2317
|
user,
|
|
2225
2318
|
showBottomSheetForContext,
|
|
2226
2319
|
openAvatarPicker,
|
|
2227
|
-
actingAs,
|
|
2228
2320
|
accounts,
|
|
2229
|
-
|
|
2230
|
-
activeAccount,
|
|
2231
|
-
setActingAs,
|
|
2321
|
+
switchToAccount,
|
|
2232
2322
|
refreshAccounts,
|
|
2233
2323
|
createAccountFn,
|
|
2234
2324
|
]);
|
|
@@ -2297,11 +2387,8 @@ const LOADING_STATE: OxyContextState = {
|
|
|
2297
2387
|
clientId: null,
|
|
2298
2388
|
oxyServices: LOADING_STATE_OXY_SERVICES,
|
|
2299
2389
|
openAvatarPicker: () => {},
|
|
2300
|
-
actingAs: null,
|
|
2301
2390
|
accounts: [],
|
|
2302
|
-
|
|
2303
|
-
activeAccount: null,
|
|
2304
|
-
setActingAs: () => {},
|
|
2391
|
+
switchToAccount: () => rejectMissingProvider<void>(),
|
|
2305
2392
|
refreshAccounts: () => rejectMissingProvider<void>(),
|
|
2306
2393
|
createAccount: () => rejectMissingProvider<AccountNode>(),
|
|
2307
2394
|
};
|
|
@@ -9,7 +9,13 @@ import type { StorageInterface } from '../../utils/storageHelpers';
|
|
|
9
9
|
import type { OxyServices } from '@oxyhq/core';
|
|
10
10
|
import { SignatureService } from '@oxyhq/core';
|
|
11
11
|
import { isWebBrowser } from '../../hooks/useWebSSO';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
clearActiveAuthuser,
|
|
14
|
+
clearSsoBounceState,
|
|
15
|
+
writeActiveAuthuser,
|
|
16
|
+
markSignedOut,
|
|
17
|
+
clearSignedOut,
|
|
18
|
+
} from '../../utils/activeAuthuser';
|
|
13
19
|
import { isCrossApexWeb, CrossApexDirectSignInError } from '../../../utils/crossApex';
|
|
14
20
|
|
|
15
21
|
export interface UseAuthOperationsOptions {
|
|
@@ -133,6 +139,23 @@ export const useAuthOperations = ({
|
|
|
133
139
|
deviceFingerprint,
|
|
134
140
|
);
|
|
135
141
|
|
|
142
|
+
// Deliberate sign-in re-enables automatic silent restore: clear the durable
|
|
143
|
+
// "deliberately signed out" flag so a prior sign-out no longer suppresses
|
|
144
|
+
// the `fedcm-silent` / per-apex iframe cold-boot steps.
|
|
145
|
+
clearSignedOut();
|
|
146
|
+
|
|
147
|
+
// Register this primary session in the device's first-party multi-account
|
|
148
|
+
// refresh-cookie set so a web key-based sign-in survives reload via
|
|
149
|
+
// `refresh-all` and coexists with switched accounts. `/auth/verify` mints the
|
|
150
|
+
// session but (unlike `/auth/login` / `/fedcm/exchange`) does NOT plant an
|
|
151
|
+
// `oxy_rt_<authuser>` slot, so we establish it here through the shared
|
|
152
|
+
// `POST /auth/session` primitive. No-op on native and cross-apex (returns
|
|
153
|
+
// `null`); records the active slot when one is genuinely allocated.
|
|
154
|
+
const verifyAuthuser = await oxyServices.establishDeviceRefreshSlot();
|
|
155
|
+
if (typeof verifyAuthuser === 'number') {
|
|
156
|
+
writeActiveAuthuser(verifyAuthuser);
|
|
157
|
+
}
|
|
158
|
+
|
|
136
159
|
// Get full user data
|
|
137
160
|
fullUser = await oxyServices.getUserBySession(sessionResponse.sessionId);
|
|
138
161
|
|
|
@@ -260,7 +283,14 @@ export const useAuthOperations = ({
|
|
|
260
283
|
await switchSession(filteredSessions[0].sessionId);
|
|
261
284
|
} else {
|
|
262
285
|
// Genuine FULL sign-out (no sessions remain): clear the per-origin
|
|
263
|
-
// SSO bounce state so a fresh deliberate sign-in can re-probe
|
|
286
|
+
// SSO bounce state so a fresh deliberate sign-in can re-probe, drop
|
|
287
|
+
// the persisted active device slot so the next cold boot does not
|
|
288
|
+
// prioritize a now-signed-out `oxy_active_authuser`, and SET the
|
|
289
|
+
// deliberately-signed-out flag so the silent cold-boot steps
|
|
290
|
+
// (`fedcm-silent` / per-apex iframe) do not re-mint a session from a
|
|
291
|
+
// still-live IdP session on the next reload (mirrors `logoutAll`).
|
|
292
|
+
markSignedOut();
|
|
293
|
+
clearActiveAuthuser();
|
|
264
294
|
clearSsoBounceState();
|
|
265
295
|
clearPriorSessionHintSafe(clearPriorSessionHint, logger);
|
|
266
296
|
await clearSessionState();
|
|
@@ -322,6 +352,9 @@ export const useAuthOperations = ({
|
|
|
322
352
|
if (isWebBrowser()) {
|
|
323
353
|
await oxyServices.logoutAllSessionsViaCookie();
|
|
324
354
|
clearActiveAuthuser();
|
|
355
|
+
// Deliberate full sign-out: suppress automatic silent restore on the next
|
|
356
|
+
// cold boot so a still-live IdP session does not re-mint a session.
|
|
357
|
+
markSignedOut();
|
|
325
358
|
}
|
|
326
359
|
// logoutAll is ALWAYS a full sign-out: clear the per-origin SSO bounce
|
|
327
360
|
// state (web-guarded internally) so a fresh sign-in can re-probe, and drop
|
|
@@ -232,11 +232,11 @@ export const useAuthorizedApps = (options?: { enabled?: boolean }) => {
|
|
|
232
232
|
* Get privacy settings for a user
|
|
233
233
|
*/
|
|
234
234
|
export const usePrivacySettings = (userId?: string, options?: { enabled?: boolean }) => {
|
|
235
|
-
const { oxyServices, activeSessionId,
|
|
235
|
+
const { oxyServices, activeSessionId, user } = useOxy();
|
|
236
236
|
// When no explicit user id is supplied, target the ACTIVE account (the
|
|
237
237
|
// account switched into) so "my privacy settings" reflects the current
|
|
238
238
|
// account, matching the imperative PrivacySettingsScreen.
|
|
239
|
-
const targetUserId = userId ||
|
|
239
|
+
const targetUserId = userId || user?.id;
|
|
240
240
|
|
|
241
241
|
return useQuery({
|
|
242
242
|
queryKey: queryKeys.privacy.settings(targetUserId),
|
|
@@ -34,10 +34,10 @@ import type {
|
|
|
34
34
|
* API's `{ plan: 'basic' }` fallback when the user has never subscribed.
|
|
35
35
|
*/
|
|
36
36
|
export const useUserSubscription = (options?: { enabled?: boolean }) => {
|
|
37
|
-
const { oxyServices, isAuthenticated, activeSessionId,
|
|
37
|
+
const { oxyServices, isAuthenticated, activeSessionId, user } = useOxy();
|
|
38
38
|
|
|
39
39
|
return useQuery({
|
|
40
|
-
queryKey: queryKeys.payments.subscription(
|
|
40
|
+
queryKey: queryKeys.payments.subscription(user?.id),
|
|
41
41
|
queryFn: async () => {
|
|
42
42
|
return authenticatedApiCall<Subscription>(
|
|
43
43
|
oxyServices,
|
|
@@ -45,7 +45,7 @@ export const useUserSubscription = (options?: { enabled?: boolean }) => {
|
|
|
45
45
|
() => oxyServices.getCurrentUserSubscription(),
|
|
46
46
|
);
|
|
47
47
|
},
|
|
48
|
-
enabled: (options?.enabled !== false) && isAuthenticated && !!
|
|
48
|
+
enabled: (options?.enabled !== false) && isAuthenticated && !!user?.id,
|
|
49
49
|
// Subscription state changes rarely; tolerate a longer fresh window.
|
|
50
50
|
staleTime: 5 * 60 * 1000, // 5 minutes
|
|
51
51
|
gcTime: 30 * 60 * 1000, // 30 minutes
|
|
@@ -59,10 +59,10 @@ export const useUserSubscription = (options?: { enabled?: boolean }) => {
|
|
|
59
59
|
* returns the user's `deposit` and `purchase` transactions newest-first.
|
|
60
60
|
*/
|
|
61
61
|
export const useUserPayments = (options?: { enabled?: boolean }) => {
|
|
62
|
-
const { oxyServices, isAuthenticated, activeSessionId,
|
|
62
|
+
const { oxyServices, isAuthenticated, activeSessionId, user } = useOxy();
|
|
63
63
|
|
|
64
64
|
return useQuery({
|
|
65
|
-
queryKey: queryKeys.payments.history(
|
|
65
|
+
queryKey: queryKeys.payments.history(user?.id),
|
|
66
66
|
queryFn: async () => {
|
|
67
67
|
return authenticatedApiCall<Payment[]>(
|
|
68
68
|
oxyServices,
|
|
@@ -70,7 +70,7 @@ export const useUserPayments = (options?: { enabled?: boolean }) => {
|
|
|
70
70
|
() => oxyServices.getUserPayments(),
|
|
71
71
|
);
|
|
72
72
|
},
|
|
73
|
-
enabled: (options?.enabled !== false) && isAuthenticated && !!
|
|
73
|
+
enabled: (options?.enabled !== false) && isAuthenticated && !!user?.id,
|
|
74
74
|
// Billing history is append-mostly; a short fresh window is fine.
|
|
75
75
|
staleTime: 2 * 60 * 1000, // 2 minutes
|
|
76
76
|
gcTime: 30 * 60 * 1000, // 30 minutes
|
|
@@ -84,10 +84,10 @@ export const useUserPayments = (options?: { enabled?: boolean }) => {
|
|
|
84
84
|
* Balance changes frequently, so the fresh window is intentionally short.
|
|
85
85
|
*/
|
|
86
86
|
export const useUserWallet = (options?: { enabled?: boolean }) => {
|
|
87
|
-
const { oxyServices, isAuthenticated, activeSessionId,
|
|
87
|
+
const { oxyServices, isAuthenticated, activeSessionId, user } = useOxy();
|
|
88
88
|
|
|
89
89
|
return useQuery({
|
|
90
|
-
queryKey: queryKeys.payments.wallet(
|
|
90
|
+
queryKey: queryKeys.payments.wallet(user?.id),
|
|
91
91
|
queryFn: async () => {
|
|
92
92
|
return authenticatedApiCall<Wallet>(
|
|
93
93
|
oxyServices,
|
|
@@ -95,7 +95,7 @@ export const useUserWallet = (options?: { enabled?: boolean }) => {
|
|
|
95
95
|
() => oxyServices.getCurrentUserWallet(),
|
|
96
96
|
);
|
|
97
97
|
},
|
|
98
|
-
enabled: (options?.enabled !== false) && isAuthenticated && !!
|
|
98
|
+
enabled: (options?.enabled !== false) && isAuthenticated && !!user?.id,
|
|
99
99
|
staleTime: 60 * 1000, // 1 minute (balance moves often)
|
|
100
100
|
gcTime: 10 * 60 * 1000, // 10 minutes
|
|
101
101
|
});
|
|
@@ -116,12 +116,12 @@ export const useUserWalletTransactions = (
|
|
|
116
116
|
params?: { limit?: number; offset?: number },
|
|
117
117
|
options?: { enabled?: boolean },
|
|
118
118
|
) => {
|
|
119
|
-
const { oxyServices, isAuthenticated, activeSessionId,
|
|
119
|
+
const { oxyServices, isAuthenticated, activeSessionId, user } = useOxy();
|
|
120
120
|
const limit = params?.limit;
|
|
121
121
|
const offset = params?.offset;
|
|
122
122
|
|
|
123
123
|
return useQuery({
|
|
124
|
-
queryKey: queryKeys.payments.walletTransactions(limit, offset,
|
|
124
|
+
queryKey: queryKeys.payments.walletTransactions(limit, offset, user?.id),
|
|
125
125
|
queryFn: async () => {
|
|
126
126
|
return authenticatedApiCall<WalletTransactionsResponse>(
|
|
127
127
|
oxyServices,
|
|
@@ -129,7 +129,7 @@ export const useUserWalletTransactions = (
|
|
|
129
129
|
() => oxyServices.getCurrentUserWalletTransactions({ limit, offset }),
|
|
130
130
|
);
|
|
131
131
|
},
|
|
132
|
-
enabled: (options?.enabled !== false) && isAuthenticated && !!
|
|
132
|
+
enabled: (options?.enabled !== false) && isAuthenticated && !!user?.id,
|
|
133
133
|
staleTime: 60 * 1000, // 1 minute (ledger updates frequently)
|
|
134
134
|
gcTime: 10 * 60 * 1000, // 10 minutes
|
|
135
135
|
});
|