@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
|
@@ -14,7 +14,7 @@ import { useAuthOperations } from "./hooks/useAuthOperations.js";
|
|
|
14
14
|
import { useDeviceManagement } from "../hooks/useDeviceManagement.js";
|
|
15
15
|
import { getStorageKeys, createPlatformStorage } from "../utils/storageHelpers.js";
|
|
16
16
|
import { isInvalidSessionError, isTimeoutOrNetworkError } from "../utils/errorHandlers.js";
|
|
17
|
-
import { readActiveAuthuser, writeActiveAuthuser } from "../utils/activeAuthuser.js";
|
|
17
|
+
import { readActiveAuthuser, writeActiveAuthuser, clearSignedOut, isSilentRestoreSuppressed } from "../utils/activeAuthuser.js";
|
|
18
18
|
import { showBottomSheet as globalShowBottomSheet } from "../navigation/bottomSheetManager.js";
|
|
19
19
|
import { useQueryClient } from '@tanstack/react-query';
|
|
20
20
|
import { clearQueryCache } from "../hooks/queryClient.js";
|
|
@@ -1091,6 +1091,54 @@ export const OxyProvider = ({
|
|
|
1091
1091
|
}, priorSessionReadError);
|
|
1092
1092
|
}
|
|
1093
1093
|
}
|
|
1094
|
+
|
|
1095
|
+
// LAST-ACTIVE-ACCOUNT priority (web multi-account). When the user has an
|
|
1096
|
+
// explicit persisted active slot (`oxy_active_authuser`, written on every
|
|
1097
|
+
// device sign-in / account SWITCH / cookie restore), the multi-account
|
|
1098
|
+
// refresh-cookie restore is the ONLY cold-boot step that honors WHICH slot
|
|
1099
|
+
// was last active — `restoreViaRefreshCookie` selects it via
|
|
1100
|
+
// `selectActiveRefreshAccount(accounts, readActiveAuthuser())`. The
|
|
1101
|
+
// `fedcm-silent` and per-apex `silent-iframe` steps only ever recover the
|
|
1102
|
+
// PRIMARY central IdP session, so if either ran first they would clobber a
|
|
1103
|
+
// switched (managed/org) account back to the primary on reload — the exact
|
|
1104
|
+
// "switch is lost on reload" regression. So when a slot selection exists we
|
|
1105
|
+
// run cookie-restore BEFORE those probes (and disable the later duplicate).
|
|
1106
|
+
//
|
|
1107
|
+
// Read ONCE here (synchronously usable by the step `enabled` gates below).
|
|
1108
|
+
// It is non-null ONLY on first-party web apps that persist the slot. Both the
|
|
1109
|
+
// device sign-in/switch paths AND `handleWebSSOSession` (FedCM/SSO/credentials
|
|
1110
|
+
// commit funnel) now persist it — but only when the session genuinely joined
|
|
1111
|
+
// the device set: `establishDeviceRefreshSlot` returns an `authuser` ONLY on
|
|
1112
|
+
// first-party web (same registrable apex as the API), so a cross-apex RP never
|
|
1113
|
+
// writes a phantom slot and native has no localStorage. Both therefore keep
|
|
1114
|
+
// their existing order untouched. The earlier `stored-session` step still runs
|
|
1115
|
+
// first (FIX-A latency), and when a slot exists but its cookies have all
|
|
1116
|
+
// lapsed, cookie-restore simply returns no accounts and the chain falls through
|
|
1117
|
+
// to the cross-domain fallbacks exactly as before.
|
|
1118
|
+
const prioritizeMultiAccount = isWebBrowser() && readActiveAuthuser() !== null;
|
|
1119
|
+
|
|
1120
|
+
// DELIBERATELY-SIGNED-OUT gate (web): when the user pressed "Sign out", any
|
|
1121
|
+
// credential that can silently re-mint a session may still be live on the
|
|
1122
|
+
// next reload — the central IdP session (FedCM credential association /
|
|
1123
|
+
// per-apex `fedcm_session` cookie) AND the device refresh cookies. Since
|
|
1124
|
+
// PR #455 the PRIMARY web session also joins the `oxy_rt_<authuser>` device
|
|
1125
|
+
// set, so the un-gated cookie-restore steps would `refresh-all` that still-
|
|
1126
|
+
// present cookie and sign the user back in without intent — exactly the
|
|
1127
|
+
// "sign-out is silently undone" regression. So this flag gates EVERY
|
|
1128
|
+
// AUTOMATIC silent-restore cold-boot step: `stored-session`,
|
|
1129
|
+
// `cookie-restore-active`, `fedcm-silent`, `silent-iframe`, and
|
|
1130
|
+
// `cookie-restore`. The gate — not a cookie wipe — is the authority: the
|
|
1131
|
+
// account may stay "known" for a fast deliberate re-sign-in, but no step
|
|
1132
|
+
// restores it silently while the flag is set. Read the durable flag ONCE here
|
|
1133
|
+
// (synchronously usable by every step `enabled` gate). Any deliberate sign-in
|
|
1134
|
+
// (password, FedCM, account switch, device claim) clears it, so there is no
|
|
1135
|
+
// "stuck signed out" state. The `sso-bounce` step needs no extra gate: it is
|
|
1136
|
+
// already self-suppressed after sign-out (its `hasPriorSession` hint is
|
|
1137
|
+
// cleared). `sso-return` is NOT gated — it commits the result of a deliberate
|
|
1138
|
+
// top-level `/sso` bounce the user just initiated. `shared-key-signin` is
|
|
1139
|
+
// native-only and the flag never sets on native (`markSignedOut` no-ops
|
|
1140
|
+
// off-web), so its gate would be moot; it is left untouched.
|
|
1141
|
+
const silentRestoreBlocked = isSilentRestoreSuppressed();
|
|
1094
1142
|
try {
|
|
1095
1143
|
const outcome = await runColdBoot({
|
|
1096
1144
|
steps: [{
|
|
@@ -1111,12 +1159,17 @@ export const OxyProvider = ({
|
|
|
1111
1159
|
};
|
|
1112
1160
|
}
|
|
1113
1161
|
}, {
|
|
1114
|
-
// 2) Stored-session bearer restore.
|
|
1115
|
-
//
|
|
1116
|
-
//
|
|
1117
|
-
// common WEB reload winner.
|
|
1162
|
+
// 2) Stored-session bearer restore. Runs on ALL platforms EXCEPT when
|
|
1163
|
+
// the deliberately-signed-out flag is set (web only — it never sets on
|
|
1164
|
+
// native, so native still always reaches exactly this step, its ONLY
|
|
1165
|
+
// restore path). This is also the common WEB reload winner.
|
|
1166
|
+
//
|
|
1167
|
+
// SIGNED-OUT GATE: after a deliberate full sign-out the stored session
|
|
1168
|
+
// state is cleared, so this would normally skip anyway — but the gate
|
|
1169
|
+
// makes that authoritative rather than incidental, so no residual
|
|
1170
|
+
// stored token can silently restore while the user is signed out.
|
|
1118
1171
|
//
|
|
1119
|
-
// ORDERING (FIX A): this step
|
|
1172
|
+
// ORDERING (FIX A): this step runs BEFORE the slow web-only
|
|
1120
1173
|
// probes (`fedcm-silent`, `silent-iframe`, `cookie-restore`). On a
|
|
1121
1174
|
// normal reload the local bearer validates in one round-trip and
|
|
1122
1175
|
// wins; `runColdBoot` then short-circuits and never even evaluates
|
|
@@ -1127,6 +1180,7 @@ export const OxyProvider = ({
|
|
|
1127
1180
|
// local session this step skips and the cross-domain fallback chain
|
|
1128
1181
|
// (fedcm → iframe → cookie → sso-bounce) runs exactly as before.
|
|
1129
1182
|
id: 'stored-session',
|
|
1183
|
+
enabled: () => !silentRestoreBlocked,
|
|
1130
1184
|
run: async () => {
|
|
1131
1185
|
const restored = await restoreStoredSession();
|
|
1132
1186
|
if (restored) {
|
|
@@ -1195,6 +1249,38 @@ export const OxyProvider = ({
|
|
|
1195
1249
|
session: true
|
|
1196
1250
|
};
|
|
1197
1251
|
}
|
|
1252
|
+
}, {
|
|
1253
|
+
// 2.75) LAST-ACTIVE multi-account restore (WEB, prioritized). Runs
|
|
1254
|
+
// ONLY when an explicit persisted slot selection exists
|
|
1255
|
+
// (`prioritizeMultiAccount`) — i.e. the user previously signed in or
|
|
1256
|
+
// SWITCHED accounts on this first-party app. It runs BEFORE the
|
|
1257
|
+
// `fedcm-silent` / `silent-iframe` probes (which only ever recover the
|
|
1258
|
+
// PRIMARY central session) so a switched managed/org account survives
|
|
1259
|
+
// reload instead of being clobbered back to the primary. The restore
|
|
1260
|
+
// itself is the SAME `restoreViaRefreshCookie` as the terminal-tier
|
|
1261
|
+
// step below: it rotates every device-local `oxy_rt_<authuser>` cookie
|
|
1262
|
+
// and picks the persisted slot via `selectActiveRefreshAccount`,
|
|
1263
|
+
// committing it (token + state + durable persistence + `markAuthResolved`).
|
|
1264
|
+
// When no slot is persisted this is disabled and the original order is
|
|
1265
|
+
// unchanged; when the slot's cookies have lapsed it returns no accounts
|
|
1266
|
+
// and the chain falls through to the cross-domain fallbacks below.
|
|
1267
|
+
//
|
|
1268
|
+
// SIGNED-OUT GATE: since PR #455 the primary's `oxy_rt` slot survives a
|
|
1269
|
+
// deliberate sign-out, so without this gate `refresh-all` would re-mint
|
|
1270
|
+
// and silently re-log-in the user on reload. The flag is cleared by any
|
|
1271
|
+
// deliberate sign-in (including an account SWITCH, which also writes the
|
|
1272
|
+
// new active slot), so the switch-survives-reload path is unaffected.
|
|
1273
|
+
id: 'cookie-restore-active',
|
|
1274
|
+
enabled: () => prioritizeMultiAccount && !silentRestoreBlocked,
|
|
1275
|
+
run: async () => {
|
|
1276
|
+
const restored = await restoreViaRefreshCookie();
|
|
1277
|
+
return restored ? {
|
|
1278
|
+
kind: 'session',
|
|
1279
|
+
session: true
|
|
1280
|
+
} : {
|
|
1281
|
+
kind: 'skip'
|
|
1282
|
+
};
|
|
1283
|
+
}
|
|
1198
1284
|
}, {
|
|
1199
1285
|
// 3) FedCM silent reauthn (Chrome) against the CENTRAL IdP
|
|
1200
1286
|
// (auth.oxy.so). `silentSignInWithFedCM` plants the access token
|
|
@@ -1207,7 +1293,7 @@ export const OxyProvider = ({
|
|
|
1207
1293
|
// already recovered a local session — the probe cannot improve on a
|
|
1208
1294
|
// valid local bearer, and skipping it avoids the silent round-trip.
|
|
1209
1295
|
id: 'fedcm-silent',
|
|
1210
|
-
enabled: () => !storedSessionRestored && fedcmSupported && !servicesSilentAttempted.has(silentKey),
|
|
1296
|
+
enabled: () => !storedSessionRestored && !silentRestoreBlocked && fedcmSupported && !servicesSilentAttempted.has(silentKey),
|
|
1211
1297
|
run: async () => {
|
|
1212
1298
|
servicesSilentAttempted.add(silentKey);
|
|
1213
1299
|
const session = await oxyServices.silentSignInWithFedCM?.();
|
|
@@ -1246,7 +1332,7 @@ export const OxyProvider = ({
|
|
|
1246
1332
|
// FIX-D: bounded by `SILENT_IFRAME_TIMEOUT` (plus `iframe.onerror`
|
|
1247
1333
|
// fail-fast in core) so a no-message iframe cannot stall cold boot.
|
|
1248
1334
|
id: 'silent-iframe',
|
|
1249
|
-
enabled: () => !storedSessionRestored && isWebBrowser(),
|
|
1335
|
+
enabled: () => !storedSessionRestored && !silentRestoreBlocked && isWebBrowser(),
|
|
1250
1336
|
run: async () => {
|
|
1251
1337
|
if (!commitWebSession) {
|
|
1252
1338
|
return {
|
|
@@ -1278,8 +1364,20 @@ export const OxyProvider = ({
|
|
|
1278
1364
|
// is correct; cross-domain restore is handled by the SSO bounce.
|
|
1279
1365
|
// FIX-D: `restoreViaRefreshCookie` bounds the request with
|
|
1280
1366
|
// `COOKIE_RESTORE_TIMEOUT` so a cross-domain stall cannot hang here.
|
|
1367
|
+
//
|
|
1368
|
+
// Disabled when `prioritizeMultiAccount` already ran the
|
|
1369
|
+
// `cookie-restore-active` step above (an explicit persisted slot) — that
|
|
1370
|
+
// earlier step is the identical restore, so this terminal-tier copy
|
|
1371
|
+
// would be a redundant second `refreshAllSessions`. It still runs in the
|
|
1372
|
+
// common no-persisted-slot case (e.g. first visit to a first-party app
|
|
1373
|
+
// whose central refresh cookies already exist).
|
|
1374
|
+
//
|
|
1375
|
+
// SIGNED-OUT GATE (same rationale as `cookie-restore-active`): the
|
|
1376
|
+
// primary's `oxy_rt` slot survives a deliberate sign-out (PR #455), so
|
|
1377
|
+
// this must be skipped while the signed-out flag is set or it would
|
|
1378
|
+
// silently re-restore the primary on reload.
|
|
1281
1379
|
id: 'cookie-restore',
|
|
1282
|
-
enabled: () => isWebBrowser(),
|
|
1380
|
+
enabled: () => isWebBrowser() && !prioritizeMultiAccount && !silentRestoreBlocked,
|
|
1283
1381
|
run: async () => {
|
|
1284
1382
|
const restored = await restoreViaRefreshCookie();
|
|
1285
1383
|
return restored ? {
|
|
@@ -1519,13 +1617,48 @@ export const OxyProvider = ({
|
|
|
1519
1617
|
throw new Error('Session response did not include an access token');
|
|
1520
1618
|
}
|
|
1521
1619
|
oxyServices.httpService.setTokens(session.accessToken);
|
|
1620
|
+
|
|
1621
|
+
// A committed web session re-enables automatic silent restore: clear the
|
|
1622
|
+
// durable "deliberately signed out" flag. This funnel is reached by deliberate
|
|
1623
|
+
// sign-ins (password, interactive FedCM, `/sso` return) AND by the silent
|
|
1624
|
+
// cold-boot steps — but those are GATED on the flag, so when it is set they
|
|
1625
|
+
// never run and never reach here; clearing is therefore only hit on a genuine
|
|
1626
|
+
// (re-)sign-in or when restore was already permitted, both correct.
|
|
1627
|
+
clearSignedOut();
|
|
1628
|
+
|
|
1629
|
+
// Register this primary session in the device's first-party multi-account
|
|
1630
|
+
// refresh-cookie set (web only). Every web primary-session restore funnels
|
|
1631
|
+
// through here — FedCM silent (`/fedcm/exchange`), per-apex `/auth/silent`
|
|
1632
|
+
// iframe, central `/sso` return, and keyless password sign-in. Of those, only
|
|
1633
|
+
// a same-apex `/fedcm/exchange` plants an `oxy_rt_<authuser>` slot as a side
|
|
1634
|
+
// effect; the cross-origin/credential-less restores (`/sso/exchange`,
|
|
1635
|
+
// `/auth/silent` postMessage) cannot set an `api.oxy.so` cookie at all. So
|
|
1636
|
+
// WITHOUT this call a web primary never joins the device set: `refresh-all`
|
|
1637
|
+
// returns zero accounts, and account-switch persistence + the
|
|
1638
|
+
// `cookie-restore-active` cold-boot step have no foundation. Calling the shared
|
|
1639
|
+
// `POST /auth/session` primitive here makes EVERY primary participate in the
|
|
1640
|
+
// set, re-plants the rotated token, and records the active `authuser` so the
|
|
1641
|
+
// next cold boot's `cookie-restore-active` reconciles the persisted active
|
|
1642
|
+
// (possibly switched) account instead of `fedcm-silent` clobbering it back to
|
|
1643
|
+
// the primary. Best-effort: a `null` result (native / transient failure)
|
|
1644
|
+
// leaves the in-session token untouched.
|
|
1645
|
+
const primaryAuthuser = await oxyServices.establishDeviceRefreshSlot();
|
|
1646
|
+
// A non-null slot is returned ONLY on first-party web (the helper gates on
|
|
1647
|
+
// platform + same registrable apex), so recording the active slot here is safe
|
|
1648
|
+
// and never writes a phantom authuser for a cross-apex RP or native.
|
|
1649
|
+
if (typeof primaryAuthuser === 'number') {
|
|
1650
|
+
writeActiveAuthuser(primaryAuthuser);
|
|
1651
|
+
}
|
|
1522
1652
|
const clientSession = {
|
|
1523
1653
|
sessionId: session.sessionId,
|
|
1524
1654
|
deviceId: session.deviceId || '',
|
|
1525
1655
|
expiresAt: session.expiresAt || new Date(Date.now() + DEFAULT_SESSION_VALIDITY_MS).toISOString(),
|
|
1526
1656
|
lastActive: new Date().toISOString(),
|
|
1527
1657
|
userId: session.user.id?.toString() ?? '',
|
|
1528
|
-
isCurrent: true
|
|
1658
|
+
isCurrent: true,
|
|
1659
|
+
...(typeof primaryAuthuser === 'number' ? {
|
|
1660
|
+
authuser: primaryAuthuser
|
|
1661
|
+
} : null)
|
|
1529
1662
|
};
|
|
1530
1663
|
updateSessions([clientSession], {
|
|
1531
1664
|
merge: true
|
|
@@ -1760,42 +1893,8 @@ export const OxyProvider = ({
|
|
|
1760
1893
|
});
|
|
1761
1894
|
|
|
1762
1895
|
// --- Account graph state ---
|
|
1763
|
-
const [actingAs, setActingAsState] = useState(null);
|
|
1764
1896
|
const [accounts, setAccounts] = useState([]);
|
|
1765
1897
|
|
|
1766
|
-
// Latest `actingAs`, mirrored into a ref so `refreshAccounts` can reconcile a
|
|
1767
|
-
// stale switch without taking `actingAs` as a dependency (which would re-run
|
|
1768
|
-
// the account load on every switch). See the reconciliation block below.
|
|
1769
|
-
const actingAsRef = useRef(actingAs);
|
|
1770
|
-
actingAsRef.current = actingAs;
|
|
1771
|
-
// `setActingAs` is declared after `refreshAccounts`; route the reconciliation
|
|
1772
|
-
// clear through a ref so the load callback can call the latest implementation.
|
|
1773
|
-
const setActingAsRef = useRef(null);
|
|
1774
|
-
|
|
1775
|
-
// Restore actingAs from storage on startup
|
|
1776
|
-
useEffect(() => {
|
|
1777
|
-
if (!storage || !initialized) return;
|
|
1778
|
-
let mounted = true;
|
|
1779
|
-
(async () => {
|
|
1780
|
-
try {
|
|
1781
|
-
const stored = await storage.getItem(`${storageKeyPrefix}_acting_as`);
|
|
1782
|
-
if (mounted && stored) {
|
|
1783
|
-
setActingAsState(stored);
|
|
1784
|
-
oxyServices.setActingAs(stored);
|
|
1785
|
-
}
|
|
1786
|
-
} catch (err) {
|
|
1787
|
-
if (__DEV__) {
|
|
1788
|
-
loggerUtil.debug('Failed to restore actingAs from storage', {
|
|
1789
|
-
component: 'OxyContext'
|
|
1790
|
-
}, err);
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
})();
|
|
1794
|
-
return () => {
|
|
1795
|
-
mounted = false;
|
|
1796
|
-
};
|
|
1797
|
-
}, [storage, initialized, storageKeyPrefix, oxyServices]);
|
|
1798
|
-
|
|
1799
1898
|
// Load the unified account graph when authenticated
|
|
1800
1899
|
const refreshAccounts = useCallback(async () => {
|
|
1801
1900
|
if (!isAuthenticated || !tokenReady || !oxyServices.getAccessToken()) {
|
|
@@ -1805,15 +1904,6 @@ export const OxyProvider = ({
|
|
|
1805
1904
|
try {
|
|
1806
1905
|
const list = await oxyServices.listAccounts();
|
|
1807
1906
|
setAccounts(list);
|
|
1808
|
-
// Reconcile a stale switch: if the active account was switched INTO an id
|
|
1809
|
-
// that is no longer accessible (account removed/archived, or it belonged
|
|
1810
|
-
// to a now-inactive sign-in), drop back to the personal account so the
|
|
1811
|
-
// app never keeps sending a dead `X-Acting-As` header. `list` is the
|
|
1812
|
-
// authoritative accessible set on a successful fetch.
|
|
1813
|
-
const current = actingAsRef.current;
|
|
1814
|
-
if (current && !list.some(node => node.accountId === current)) {
|
|
1815
|
-
setActingAsRef.current?.(null);
|
|
1816
|
-
}
|
|
1817
1907
|
} catch (err) {
|
|
1818
1908
|
if (isUnauthorizedStatus(err)) {
|
|
1819
1909
|
setAccounts([]);
|
|
@@ -1832,48 +1922,76 @@ export const OxyProvider = ({
|
|
|
1832
1922
|
refreshAccounts();
|
|
1833
1923
|
}
|
|
1834
1924
|
}, [isAuthenticated, initialized, tokenReady, refreshAccounts]);
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1925
|
+
|
|
1926
|
+
// Switch the active session INTO an account from the unified graph. In the
|
|
1927
|
+
// REAL-SESSION model this is identical to switching device sign-ins: mint a
|
|
1928
|
+
// real session for the target and make the whole app that account. The removed
|
|
1929
|
+
// `X-Acting-As` delegation header is gone — `oxyServices.switchToAccount`
|
|
1930
|
+
// plants the minted access token (the refresh token is the server-set httpOnly
|
|
1931
|
+
// `oxy_rt_<authuser>` cookie, so the session joins the device multi-account set
|
|
1932
|
+
// and survives reload / `refresh-all`). We then commit the session into context
|
|
1933
|
+
// state the SAME way sign-in / `switchSession` do, refresh the account graph,
|
|
1934
|
+
// and invalidate every query so all data reloads as the new account.
|
|
1935
|
+
const switchToAccount = useCallback(async accountId => {
|
|
1936
|
+
const result = await oxyServices.switchToAccount(accountId);
|
|
1937
|
+
if (!result?.user || !result?.sessionId) {
|
|
1938
|
+
throw new Error('Account switch did not return a valid session');
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
// A switch is a deliberate sign-in into an account: re-enable automatic silent
|
|
1942
|
+
// restore by clearing any prior "deliberately signed out" flag.
|
|
1943
|
+
clearSignedOut();
|
|
1944
|
+
|
|
1945
|
+
// `oxyServices.switchToAccount` already planted `result.accessToken` as the
|
|
1946
|
+
// active token; mirror the minted session into the multi-account store and
|
|
1947
|
+
// mark it current, recording the device `authuser` slot so web silent-switch
|
|
1948
|
+
// and the device account chooser can address it.
|
|
1949
|
+
const now = new Date();
|
|
1950
|
+
const clientSession = {
|
|
1951
|
+
sessionId: result.sessionId,
|
|
1952
|
+
deviceId: result.deviceId || '',
|
|
1953
|
+
expiresAt: result.expiresAt || new Date(now.getTime() + DEFAULT_SESSION_VALIDITY_MS).toISOString(),
|
|
1954
|
+
lastActive: now.toISOString(),
|
|
1955
|
+
userId: result.user.id?.toString() ?? '',
|
|
1956
|
+
isCurrent: true,
|
|
1957
|
+
...(typeof result.authuser === 'number' ? {
|
|
1958
|
+
authuser: result.authuser
|
|
1959
|
+
} : null)
|
|
1960
|
+
};
|
|
1961
|
+
updateSessions([clientSession], {
|
|
1962
|
+
merge: true
|
|
1963
|
+
});
|
|
1964
|
+
setActiveSessionId(result.sessionId);
|
|
1965
|
+
if (isWebBrowser() && typeof result.authuser === 'number') {
|
|
1966
|
+
writeActiveAuthuser(result.authuser);
|
|
1967
|
+
}
|
|
1968
|
+
await persistSessionDurably(result.sessionId);
|
|
1969
|
+
|
|
1970
|
+
// Fetch the canonical User for the new account (the switch result carries
|
|
1971
|
+
// only MinimalUserData); fall back to that minimal shape if the profile
|
|
1972
|
+
// fetch fails so the app still reflects the switched identity.
|
|
1973
|
+
let fullUser;
|
|
1974
|
+
try {
|
|
1975
|
+
fullUser = await oxyServices.getCurrentUser();
|
|
1976
|
+
} catch (profileError) {
|
|
1977
|
+
if (__DEV__) {
|
|
1978
|
+
loggerUtil.debug('Failed to fetch full user after account switch; using switch result user', {
|
|
1979
|
+
component: 'OxyContext',
|
|
1980
|
+
method: 'switchToAccount'
|
|
1981
|
+
}, profileError);
|
|
1859
1982
|
}
|
|
1983
|
+
fullUser = result.user;
|
|
1860
1984
|
}
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
// account's user when a switch is set and resolved, otherwise the signed-in
|
|
1872
|
-
// user's own personal account. Derived (no effect) so identity surfaces always
|
|
1873
|
-
// render the current account without separate syncing. Falls back to `user`
|
|
1874
|
-
// while a just-set switch has not yet resolved in `accounts`, so the header
|
|
1875
|
-
// never flashes empty mid-switch.
|
|
1876
|
-
const activeAccount = useMemo(() => actingAs && actingAsAccount ? actingAsAccount.account : user, [actingAs, actingAsAccount, user]);
|
|
1985
|
+
loginSuccess(fullUser);
|
|
1986
|
+
onAuthStateChange?.(fullUser);
|
|
1987
|
+
|
|
1988
|
+
// Reload the switchable account graph (the new active account's relationships
|
|
1989
|
+
// differ) and invalidate every query so all data refetches as the new
|
|
1990
|
+
// account — the deviceAccounts probe re-enumerates the multi-account set so
|
|
1991
|
+
// the switched account now appears as a device session.
|
|
1992
|
+
await refreshAccounts();
|
|
1993
|
+
queryClient.invalidateQueries();
|
|
1994
|
+
}, [oxyServices, updateSessions, setActiveSessionId, persistSessionDurably, loginSuccess, onAuthStateChange, refreshAccounts, queryClient]);
|
|
1877
1995
|
const createAccountFn = useCallback(async data => {
|
|
1878
1996
|
const account = await oxyServices.createAccount(data);
|
|
1879
1997
|
await refreshAccounts();
|
|
@@ -1920,14 +2038,11 @@ export const OxyProvider = ({
|
|
|
1920
2038
|
useFollow: useFollowHook,
|
|
1921
2039
|
showBottomSheet: showBottomSheetForContext,
|
|
1922
2040
|
openAvatarPicker,
|
|
1923
|
-
actingAs,
|
|
1924
2041
|
accounts,
|
|
1925
|
-
|
|
1926
|
-
activeAccount,
|
|
1927
|
-
setActingAs,
|
|
2042
|
+
switchToAccount,
|
|
1928
2043
|
refreshAccounts,
|
|
1929
2044
|
createAccount: createAccountFn
|
|
1930
|
-
}), [activeSessionId, signIn, signInWithPassword, handleWebSSOSession, currentLanguage, currentLanguageMetadata, currentLanguageName, currentNativeLanguageName, error, getDeviceSessions, hasAccessToken, canUsePrivateApi, isPrivateApiPending, getPublicKey, hasIdentity, isAuthenticated, isLoading, logout, logoutAll, logoutAllDeviceSessions, oxyServices, storageKeyPrefix, clientId, refreshSessionsWithUser, sessions, setLanguage, storage, switchSessionForContext, tokenReady, hasAccessToken, canUsePrivateApi, isPrivateApiPending, authResolved, updateDeviceName, clearAllAccountData, useFollowHook, user, showBottomSheetForContext, openAvatarPicker,
|
|
2045
|
+
}), [activeSessionId, signIn, signInWithPassword, handleWebSSOSession, currentLanguage, currentLanguageMetadata, currentLanguageName, currentNativeLanguageName, error, getDeviceSessions, hasAccessToken, canUsePrivateApi, isPrivateApiPending, getPublicKey, hasIdentity, isAuthenticated, isLoading, logout, logoutAll, logoutAllDeviceSessions, oxyServices, storageKeyPrefix, clientId, refreshSessionsWithUser, sessions, setLanguage, storage, switchSessionForContext, tokenReady, hasAccessToken, canUsePrivateApi, isPrivateApiPending, authResolved, updateDeviceName, clearAllAccountData, useFollowHook, user, showBottomSheetForContext, openAvatarPicker, accounts, switchToAccount, refreshAccounts, createAccountFn]);
|
|
1931
2046
|
return /*#__PURE__*/_jsx(OxyContext.Provider, {
|
|
1932
2047
|
value: contextValue,
|
|
1933
2048
|
children: ssoCallbackIntercepting ? null : children
|
|
@@ -1986,11 +2101,8 @@ const LOADING_STATE = {
|
|
|
1986
2101
|
clientId: null,
|
|
1987
2102
|
oxyServices: LOADING_STATE_OXY_SERVICES,
|
|
1988
2103
|
openAvatarPicker: () => {},
|
|
1989
|
-
actingAs: null,
|
|
1990
2104
|
accounts: [],
|
|
1991
|
-
|
|
1992
|
-
activeAccount: null,
|
|
1993
|
-
setActingAs: () => {},
|
|
2105
|
+
switchToAccount: () => rejectMissingProvider(),
|
|
1994
2106
|
refreshAccounts: () => rejectMissingProvider(),
|
|
1995
2107
|
createAccount: () => rejectMissingProvider()
|
|
1996
2108
|
};
|