@oxyhq/services 22.13.0 → 23.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/commonjs/index.js +74 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/notifications/deviceNotifications.js +424 -0
- package/lib/commonjs/notifications/deviceNotifications.js.map +1 -0
- package/lib/commonjs/ui/boot/runProviderColdBoot.js +20 -64
- package/lib/commonjs/ui/boot/runProviderColdBoot.js.map +1 -1
- package/lib/commonjs/ui/components/AvatarCameraBadge.js +3 -2
- package/lib/commonjs/ui/components/AvatarCameraBadge.js.map +1 -1
- package/lib/commonjs/ui/components/OxyAuthChooser.js +5 -4
- package/lib/commonjs/ui/components/OxyAuthChooser.js.map +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +5 -6
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/OxySignInRequestSurface.js +147 -0
- package/lib/commonjs/ui/components/OxySignInRequestSurface.js.map +1 -0
- package/lib/commonjs/ui/components/ProfileButton.js +4 -3
- package/lib/commonjs/ui/components/ProfileButton.js.map +1 -1
- package/lib/commonjs/ui/components/SettingsIcon.js +3 -2
- package/lib/commonjs/ui/components/SettingsIcon.js.map +1 -1
- package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js +7 -7
- package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js.map +1 -1
- package/lib/commonjs/ui/components/authChooser/SignInEntryView.js.map +1 -1
- package/lib/commonjs/ui/components/authChooser/SignInRequestView.js +65 -103
- package/lib/commonjs/ui/components/authChooser/SignInRequestView.js.map +1 -1
- package/lib/commonjs/ui/components/authChooser/TroubleDisclosure.js +0 -2
- package/lib/commonjs/ui/components/authChooser/TroubleDisclosure.js.map +1 -1
- package/lib/commonjs/ui/components/authChooser/primitives.js +5 -4
- package/lib/commonjs/ui/components/authChooser/primitives.js.map +1 -1
- package/lib/commonjs/ui/components/authChooser/requestSurfaces.js +14 -10
- package/lib/commonjs/ui/components/authChooser/requestSurfaces.js.map +1 -1
- package/lib/commonjs/ui/components/authChooser/types.js +11 -0
- package/lib/commonjs/ui/components/authChooser/types.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/AnimatedButton.js +3 -2
- package/lib/commonjs/ui/components/fileManagement/AnimatedButton.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js +3 -2
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/FileViewer.js +15 -14
- package/lib/commonjs/ui/components/fileManagement/FileViewer.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/UploadPreview.js +6 -5
- package/lib/commonjs/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/commonjs/ui/components/modals/DeleteAccountModal.js +3 -2
- package/lib/commonjs/ui/components/modals/DeleteAccountModal.js.map +1 -1
- package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js +6 -6
- package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js.map +1 -1
- package/lib/commonjs/ui/components/payment/PaymentMethodStep.js +5 -5
- package/lib/commonjs/ui/components/payment/PaymentMethodStep.js.map +1 -1
- package/lib/commonjs/ui/components/payment/PaymentReviewStep.js +10 -9
- package/lib/commonjs/ui/components/payment/PaymentReviewStep.js.map +1 -1
- package/lib/commonjs/ui/components/payment/PaymentSuccessStep.js +4 -3
- package/lib/commonjs/ui/components/payment/PaymentSuccessStep.js.map +1 -1
- package/lib/commonjs/ui/components/payment/PaymentSummaryStep.js +6 -5
- package/lib/commonjs/ui/components/payment/PaymentSummaryStep.js.map +1 -1
- package/lib/commonjs/ui/components/styles/shadow.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +14 -45
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/commitSessionFlow.js +0 -43
- package/lib/commonjs/ui/context/commitSessionFlow.js.map +1 -1
- package/lib/commonjs/ui/context/useOxyAccountGraph.js +3 -4
- package/lib/commonjs/ui/context/useOxyAccountGraph.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/userCache.js +17 -17
- package/lib/commonjs/ui/hooks/queries/userCache.js.map +1 -1
- package/lib/commonjs/ui/hooks/useAssets.js.map +1 -1
- package/lib/commonjs/ui/hooks/useAuth.js +4 -2
- package/lib/commonjs/ui/hooks/useAuth.js.map +1 -1
- package/lib/commonjs/ui/hooks/useOnlineStatus.js +3 -2
- package/lib/commonjs/ui/hooks/useOnlineStatus.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionManagement.js +0 -2
- package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountMembersScreen.js +4 -3
- package/lib/commonjs/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ConnectedAppsScreen.js +1 -1
- package/lib/commonjs/ui/screens/ConnectedAppsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CreateAccountScreen.js +7 -6
- package/lib/commonjs/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +4 -3
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FAQScreen.js +3 -2
- package/lib/commonjs/ui/screens/FAQScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FeedbackScreen.js +96 -96
- package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +19 -18
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HistoryViewScreen.js +4 -29
- package/lib/commonjs/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +4 -3
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ManageAccountScreen.js +2 -2
- package/lib/commonjs/ui/screens/ManageAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +3 -3
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +10 -9
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +1 -0
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +12 -13
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/UserListScreen.js +4 -4
- package/lib/commonjs/ui/screens/UserListScreen.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/fileManagement/FileLibraryError.js +4 -3
- package/lib/commonjs/ui/screens/fileManagement/FileLibraryError.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/FileListSection.js +4 -3
- package/lib/commonjs/ui/screens/fileManagement/FileListSection.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/PhotoPickerSection.js +5 -7
- package/lib/commonjs/ui/screens/fileManagement/PhotoPickerSection.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/UploadBar.js +3 -2
- package/lib/commonjs/ui/screens/fileManagement/UploadBar.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js +3 -2
- package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustLeaderboardScreen.js +5 -4
- package/lib/commonjs/ui/screens/trust/TrustLeaderboardScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js +4 -3
- package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js.map +1 -1
- package/lib/commonjs/ui/utils/fileManagement.js +24 -24
- package/lib/commonjs/ui/utils/fileManagement.js.map +1 -1
- package/lib/commonjs/ui/utils/netConnectivity.js +28 -0
- package/lib/commonjs/ui/utils/netConnectivity.js.map +1 -0
- package/lib/commonjs/ui/utils/oauthReturn.js +15 -28
- package/lib/commonjs/ui/utils/oauthReturn.js.map +1 -1
- package/lib/module/index.js +18 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/notifications/deviceNotifications.js +414 -0
- package/lib/module/notifications/deviceNotifications.js.map +1 -0
- package/lib/module/ui/boot/runProviderColdBoot.js +21 -65
- package/lib/module/ui/boot/runProviderColdBoot.js.map +1 -1
- package/lib/module/ui/components/AvatarCameraBadge.js +1 -1
- package/lib/module/ui/components/AvatarCameraBadge.js.map +1 -1
- package/lib/module/ui/components/OxyAuthChooser.js +5 -4
- package/lib/module/ui/components/OxyAuthChooser.js.map +1 -1
- package/lib/module/ui/components/OxyProvider.js +5 -6
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/OxySignInRequestSurface.js +141 -0
- package/lib/module/ui/components/OxySignInRequestSurface.js.map +1 -0
- package/lib/module/ui/components/ProfileButton.js +1 -1
- package/lib/module/ui/components/ProfileButton.js.map +1 -1
- package/lib/module/ui/components/SettingsIcon.js +1 -1
- package/lib/module/ui/components/SettingsIcon.js.map +1 -1
- package/lib/module/ui/components/authChooser/AccountsMenuView.js +1 -1
- package/lib/module/ui/components/authChooser/AccountsMenuView.js.map +1 -1
- package/lib/module/ui/components/authChooser/SignInEntryView.js.map +1 -1
- package/lib/module/ui/components/authChooser/SignInRequestView.js +66 -104
- package/lib/module/ui/components/authChooser/SignInRequestView.js.map +1 -1
- package/lib/module/ui/components/authChooser/TroubleDisclosure.js +0 -2
- package/lib/module/ui/components/authChooser/TroubleDisclosure.js.map +1 -1
- package/lib/module/ui/components/authChooser/primitives.js +1 -1
- package/lib/module/ui/components/authChooser/primitives.js.map +1 -1
- package/lib/module/ui/components/authChooser/requestSurfaces.js +13 -9
- package/lib/module/ui/components/authChooser/requestSurfaces.js.map +1 -1
- package/lib/module/ui/components/authChooser/types.js +11 -0
- package/lib/module/ui/components/authChooser/types.js.map +1 -1
- package/lib/module/ui/components/fileManagement/AnimatedButton.js +1 -1
- package/lib/module/ui/components/fileManagement/AnimatedButton.js.map +1 -1
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js +1 -1
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/module/ui/components/fileManagement/FileViewer.js +1 -1
- package/lib/module/ui/components/fileManagement/FileViewer.js.map +1 -1
- package/lib/module/ui/components/fileManagement/UploadPreview.js +1 -1
- package/lib/module/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/module/ui/components/modals/DeleteAccountModal.js +1 -1
- package/lib/module/ui/components/modals/DeleteAccountModal.js.map +1 -1
- package/lib/module/ui/components/payment/PaymentDetailsStep.js +1 -1
- package/lib/module/ui/components/payment/PaymentDetailsStep.js.map +1 -1
- package/lib/module/ui/components/payment/PaymentMethodStep.js +1 -1
- package/lib/module/ui/components/payment/PaymentMethodStep.js.map +1 -1
- package/lib/module/ui/components/payment/PaymentReviewStep.js +1 -1
- package/lib/module/ui/components/payment/PaymentReviewStep.js.map +1 -1
- package/lib/module/ui/components/payment/PaymentSuccessStep.js +1 -1
- package/lib/module/ui/components/payment/PaymentSuccessStep.js.map +1 -1
- package/lib/module/ui/components/payment/PaymentSummaryStep.js +1 -1
- package/lib/module/ui/components/payment/PaymentSummaryStep.js.map +1 -1
- package/lib/module/ui/components/styles/shadow.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +16 -47
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/commitSessionFlow.js +0 -42
- package/lib/module/ui/context/commitSessionFlow.js.map +1 -1
- package/lib/module/ui/context/useOxyAccountGraph.js +3 -4
- package/lib/module/ui/context/useOxyAccountGraph.js.map +1 -1
- package/lib/module/ui/hooks/queries/userCache.js +17 -17
- package/lib/module/ui/hooks/queries/userCache.js.map +1 -1
- package/lib/module/ui/hooks/useAssets.js.map +1 -1
- package/lib/module/ui/hooks/useAuth.js +4 -2
- package/lib/module/ui/hooks/useAuth.js.map +1 -1
- package/lib/module/ui/hooks/useOnlineStatus.js +3 -2
- package/lib/module/ui/hooks/useOnlineStatus.js.map +1 -1
- package/lib/module/ui/hooks/useSessionManagement.js +0 -2
- package/lib/module/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/module/ui/screens/AccountMembersScreen.js +1 -1
- package/lib/module/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/module/ui/screens/ConnectedAppsScreen.js +1 -1
- package/lib/module/ui/screens/ConnectedAppsScreen.js.map +1 -1
- package/lib/module/ui/screens/CreateAccountScreen.js +1 -1
- package/lib/module/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/EditProfileFieldScreen.js +1 -1
- package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/module/ui/screens/FAQScreen.js +1 -1
- package/lib/module/ui/screens/FAQScreen.js.map +1 -1
- package/lib/module/ui/screens/FeedbackScreen.js +91 -90
- package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +2 -1
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/HistoryViewScreen.js +4 -29
- package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/module/ui/screens/LanguageSelectorScreen.js +1 -1
- package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -1
- package/lib/module/ui/screens/ManageAccountScreen.js +1 -1
- package/lib/module/ui/screens/ManageAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/PaymentGatewayScreen.js +1 -1
- package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js +2 -2
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/module/ui/screens/PrivacySettingsScreen.js +1 -0
- package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileScreen.js +4 -5
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/UserListScreen.js +3 -3
- package/lib/module/ui/screens/UserListScreen.js.map +1 -1
- package/lib/module/ui/screens/WelcomeNewUserScreen.js +5 -6
- package/lib/module/ui/screens/WelcomeNewUserScreen.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/FileLibraryError.js +1 -1
- package/lib/module/ui/screens/fileManagement/FileLibraryError.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/FileListSection.js +1 -1
- package/lib/module/ui/screens/fileManagement/FileListSection.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/PhotoPickerSection.js +3 -5
- package/lib/module/ui/screens/fileManagement/PhotoPickerSection.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/UploadBar.js +1 -1
- package/lib/module/ui/screens/fileManagement/UploadBar.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustCenterScreen.js +1 -1
- package/lib/module/ui/screens/trust/TrustCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustLeaderboardScreen.js +3 -3
- package/lib/module/ui/screens/trust/TrustLeaderboardScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustRewardsScreen.js +1 -1
- package/lib/module/ui/screens/trust/TrustRewardsScreen.js.map +1 -1
- package/lib/module/ui/utils/fileManagement.js +25 -25
- package/lib/module/ui/utils/fileManagement.js.map +1 -1
- package/lib/module/ui/utils/netConnectivity.js +23 -0
- package/lib/module/ui/utils/netConnectivity.js.map +1 -0
- package/lib/module/ui/utils/oauthReturn.js +15 -27
- package/lib/module/ui/utils/oauthReturn.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +5 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/notifications/deviceNotifications.d.ts +173 -0
- package/lib/typescript/commonjs/notifications/deviceNotifications.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts +11 -30
- package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts +5 -3
- package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxySignInRequestSurface.d.ts +108 -0
- package/lib/typescript/commonjs/ui/components/OxySignInRequestSurface.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/SettingsIcon.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/SettingsIcon.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/authChooser/SignInEntryView.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/authChooser/SignInRequestView.d.ts +18 -18
- package/lib/typescript/commonjs/ui/components/authChooser/SignInRequestView.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/authChooser/TroubleDisclosure.d.ts +3 -10
- package/lib/typescript/commonjs/ui/components/authChooser/TroubleDisclosure.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/authChooser/requestSurfaces.d.ts +8 -4
- package/lib/typescript/commonjs/ui/components/authChooser/requestSurfaces.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts +18 -0
- package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/payment/types.d.ts +6 -6
- package/lib/typescript/commonjs/ui/components/payment/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/commitSessionFlow.d.ts +0 -40
- package/lib/typescript/commonjs/ui/context/commitSessionFlow.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts +4 -7
- package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts +0 -1
- package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/userCache.d.ts +2 -2
- package/lib/typescript/commonjs/ui/hooks/queries/userCache.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useAssets.d.ts +1 -1
- package/lib/typescript/commonjs/ui/hooks/useAssets.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useAsyncAction.d.ts +2 -2
- package/lib/typescript/commonjs/ui/hooks/useAsyncAction.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useAuth.d.ts +4 -2
- package/lib/typescript/commonjs/ui/hooks/useAuth.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useOnlineStatus.d.ts +3 -2
- package/lib/typescript/commonjs/ui/hooks/useOnlineStatus.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useSessionManagement.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/FeedbackScreen.d.ts +2 -2
- package/lib/typescript/commonjs/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/HistoryViewScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/ProfileScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/fileManagement/PhotoPickerSection.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/trust/TrustLeaderboardScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/types/navigation.d.ts +20 -19
- package/lib/typescript/commonjs/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts +5 -5
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/netConnectivity.d.ts +17 -0
- package/lib/typescript/commonjs/ui/utils/netConnectivity.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/utils/oauthReturn.d.ts +15 -12
- package/lib/typescript/commonjs/ui/utils/oauthReturn.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +5 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/notifications/deviceNotifications.d.ts +173 -0
- package/lib/typescript/module/notifications/deviceNotifications.d.ts.map +1 -0
- package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts +11 -30
- package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts +5 -3
- package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxySignInRequestSurface.d.ts +108 -0
- package/lib/typescript/module/ui/components/OxySignInRequestSurface.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/SettingsIcon.d.ts +1 -1
- package/lib/typescript/module/ui/components/SettingsIcon.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/authChooser/SignInEntryView.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/authChooser/SignInRequestView.d.ts +18 -18
- package/lib/typescript/module/ui/components/authChooser/SignInRequestView.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/authChooser/TroubleDisclosure.d.ts +3 -10
- package/lib/typescript/module/ui/components/authChooser/TroubleDisclosure.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/authChooser/requestSurfaces.d.ts +8 -4
- package/lib/typescript/module/ui/components/authChooser/requestSurfaces.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/authChooser/types.d.ts +18 -0
- package/lib/typescript/module/ui/components/authChooser/types.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/payment/types.d.ts +6 -6
- package/lib/typescript/module/ui/components/payment/types.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/commitSessionFlow.d.ts +0 -40
- package/lib/typescript/module/ui/context/commitSessionFlow.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/oxyContextTypes.d.ts +4 -7
- package/lib/typescript/module/ui/context/oxyContextTypes.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts +0 -1
- package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/userCache.d.ts +2 -2
- package/lib/typescript/module/ui/hooks/queries/userCache.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useAssets.d.ts +1 -1
- package/lib/typescript/module/ui/hooks/useAssets.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useAsyncAction.d.ts +2 -2
- package/lib/typescript/module/ui/hooks/useAsyncAction.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useAuth.d.ts +4 -2
- package/lib/typescript/module/ui/hooks/useAuth.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useOnlineStatus.d.ts +3 -2
- package/lib/typescript/module/ui/hooks/useOnlineStatus.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useSessionManagement.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FeedbackScreen.d.ts +2 -2
- package/lib/typescript/module/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/HistoryViewScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/ProfileScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/fileManagement/PhotoPickerSection.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/trust/TrustLeaderboardScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/types/navigation.d.ts +20 -19
- package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/fileManagement.d.ts +5 -5
- package/lib/typescript/module/ui/utils/fileManagement.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/netConnectivity.d.ts +17 -0
- package/lib/typescript/module/ui/utils/netConnectivity.d.ts.map +1 -0
- package/lib/typescript/module/ui/utils/oauthReturn.d.ts +15 -12
- package/lib/typescript/module/ui/utils/oauthReturn.d.ts.map +1 -1
- package/package.json +18 -8
- package/src/index.ts +32 -0
- package/src/notifications/deviceNotifications.ts +458 -0
- package/src/ui/boot/__tests__/coldBootNoIdpRedirect.test.ts +215 -0
- package/src/ui/boot/runProviderColdBoot.ts +24 -101
- package/src/ui/components/AvatarCameraBadge.tsx +1 -1
- package/src/ui/components/OxyAuthChooser.tsx +5 -4
- package/src/ui/components/OxyProvider.tsx +5 -6
- package/src/ui/components/OxySignInRequestSurface.tsx +202 -0
- package/src/ui/components/ProfileButton.tsx +1 -1
- package/src/ui/components/SettingsIcon.tsx +1 -1
- package/src/ui/components/authChooser/AccountsMenuView.tsx +1 -1
- package/src/ui/components/authChooser/SignInEntryView.tsx +9 -3
- package/src/ui/components/authChooser/SignInRequestView.tsx +78 -111
- package/src/ui/components/authChooser/TroubleDisclosure.tsx +3 -11
- package/src/ui/components/authChooser/primitives.tsx +1 -1
- package/src/ui/components/authChooser/requestSurfaces.tsx +15 -11
- package/src/ui/components/authChooser/types.ts +19 -0
- package/src/ui/components/fileManagement/AnimatedButton.tsx +1 -1
- package/src/ui/components/fileManagement/FileDetailsModal.tsx +1 -1
- package/src/ui/components/fileManagement/FileViewer.tsx +1 -1
- package/src/ui/components/fileManagement/UploadPreview.tsx +1 -1
- package/src/ui/components/modals/DeleteAccountModal.tsx +1 -1
- package/src/ui/components/payment/PaymentDetailsStep.tsx +1 -1
- package/src/ui/components/payment/PaymentMethodStep.tsx +1 -1
- package/src/ui/components/payment/PaymentReviewStep.tsx +1 -1
- package/src/ui/components/payment/PaymentSuccessStep.tsx +1 -1
- package/src/ui/components/payment/PaymentSummaryStep.tsx +1 -1
- package/src/ui/components/payment/types.ts +24 -24
- package/src/ui/components/styles/shadow.tsx +2 -2
- package/src/ui/context/OxyContext.tsx +15 -46
- package/src/ui/context/__tests__/commitSessionFlow.test.ts +0 -89
- package/src/ui/context/commitSessionFlow.ts +0 -61
- package/src/ui/context/oxyContextTypes.ts +4 -7
- package/src/ui/context/useOxyAccountGraph.ts +4 -4
- package/src/ui/hooks/queries/userCache.ts +169 -148
- package/src/ui/hooks/useAssets.ts +1 -1
- package/src/ui/hooks/useAsyncAction.ts +2 -2
- package/src/ui/hooks/useAuth.ts +4 -2
- package/src/ui/hooks/useOnlineStatus.ts +3 -2
- package/src/ui/hooks/useSessionManagement.ts +0 -2
- package/src/ui/screens/AccountMembersScreen.tsx +1 -1
- package/src/ui/screens/ConnectedAppsScreen.tsx +1 -1
- package/src/ui/screens/CreateAccountScreen.tsx +1 -1
- package/src/ui/screens/EditProfileFieldScreen.tsx +1 -1
- package/src/ui/screens/FAQScreen.tsx +1 -1
- package/src/ui/screens/FeedbackScreen.tsx +740 -574
- package/src/ui/screens/FileManagementScreen.tsx +2 -1
- package/src/ui/screens/HistoryViewScreen.tsx +4 -19
- package/src/ui/screens/LanguageSelectorScreen.tsx +1 -1
- package/src/ui/screens/ManageAccountScreen.tsx +1 -1
- package/src/ui/screens/PaymentGatewayScreen.tsx +1 -1
- package/src/ui/screens/PremiumSubscriptionScreen.tsx +2 -2
- package/src/ui/screens/PrivacySettingsScreen.tsx +1 -0
- package/src/ui/screens/ProfileScreen.tsx +6 -4
- package/src/ui/screens/UserListScreen.tsx +3 -3
- package/src/ui/screens/WelcomeNewUserScreen.tsx +6 -6
- package/src/ui/screens/fileManagement/FileLibraryError.tsx +1 -1
- package/src/ui/screens/fileManagement/FileListSection.tsx +1 -1
- package/src/ui/screens/fileManagement/PhotoPickerSection.tsx +3 -2
- package/src/ui/screens/fileManagement/UploadBar.tsx +1 -1
- package/src/ui/screens/trust/TrustCenterScreen.tsx +1 -1
- package/src/ui/screens/trust/TrustLeaderboardScreen.tsx +4 -3
- package/src/ui/screens/trust/TrustRewardsScreen.tsx +1 -1
- package/src/ui/types/navigation.ts +20 -19
- package/src/ui/utils/fileManagement.ts +108 -92
- package/src/ui/utils/netConnectivity.ts +27 -0
- package/src/ui/utils/oauthReturn.ts +15 -30
- package/lib/commonjs/ui/oauth/legacyRedirectLanes.js +0 -48
- package/lib/commonjs/ui/oauth/legacyRedirectLanes.js.map +0 -1
- package/lib/commonjs/ui/utils/crossOriginRestore.js +0 -140
- package/lib/commonjs/ui/utils/crossOriginRestore.js.map +0 -1
- package/lib/module/ui/oauth/legacyRedirectLanes.js +0 -44
- package/lib/module/ui/oauth/legacyRedirectLanes.js.map +0 -1
- package/lib/module/ui/utils/crossOriginRestore.js +0 -131
- package/lib/module/ui/utils/crossOriginRestore.js.map +0 -1
- package/lib/typescript/commonjs/ui/oauth/legacyRedirectLanes.d.ts +0 -40
- package/lib/typescript/commonjs/ui/oauth/legacyRedirectLanes.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/utils/crossOriginRestore.d.ts +0 -43
- package/lib/typescript/commonjs/ui/utils/crossOriginRestore.d.ts.map +0 -1
- package/lib/typescript/module/ui/oauth/legacyRedirectLanes.d.ts +0 -40
- package/lib/typescript/module/ui/oauth/legacyRedirectLanes.d.ts.map +0 -1
- package/lib/typescript/module/ui/utils/crossOriginRestore.d.ts +0 -43
- package/lib/typescript/module/ui/utils/crossOriginRestore.d.ts.map +0 -1
- package/src/ui/boot/__tests__/coldBootWebAuthMode.test.ts +0 -281
- package/src/ui/oauth/legacyRedirectLanes.ts +0 -43
- package/src/ui/utils/__tests__/crossOriginRestore.test.ts +0 -160
- package/src/ui/utils/crossOriginRestore.ts +0 -168
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import type { OxyServices } from '@oxyhq/core';
|
|
2
|
-
|
|
3
|
-
// Spy on the platform redirect so no real navigation happens and we can assert
|
|
4
|
-
// the authorize URL the silent-restore flow hands to the browser.
|
|
5
|
-
jest.mock('../../components/oauthNavigation', () => ({
|
|
6
|
-
redirectToAuthorize: jest.fn(),
|
|
7
|
-
}));
|
|
8
|
-
|
|
9
|
-
// jsdom's `location` is non-configurable, so the origin the code reads cannot be
|
|
10
|
-
// reassigned per-test. Instead, drive the ORIGIN-CLASSIFICATION predicates
|
|
11
|
-
// (whose real behaviour is covered by core's officialOrigins.test.ts) and keep
|
|
12
|
-
// every other core helper real (PKCE, authorize-URL builder, handshake store).
|
|
13
|
-
jest.mock('@oxyhq/core', () => {
|
|
14
|
-
const actual = jest.requireActual('@oxyhq/core');
|
|
15
|
-
return {
|
|
16
|
-
__esModule: true,
|
|
17
|
-
...actual,
|
|
18
|
-
isLoopbackOrigin: jest.fn(),
|
|
19
|
-
isOfficialWebOrigin: jest.fn(),
|
|
20
|
-
isIdpHubOrigin: jest.fn(),
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
import {
|
|
25
|
-
isLoopbackOrigin,
|
|
26
|
-
isOfficialWebOrigin,
|
|
27
|
-
isIdpHubOrigin,
|
|
28
|
-
OXY_OAUTH_REDIRECT_URI_STORAGE_KEY,
|
|
29
|
-
} from '@oxyhq/core';
|
|
30
|
-
import { redirectToAuthorize } from '../../components/oauthNavigation';
|
|
31
|
-
import {
|
|
32
|
-
isSilentRestoreEligibleOrigin,
|
|
33
|
-
maybeStartSilentOAuthRestore,
|
|
34
|
-
clearCrossOriginRestoreGuards,
|
|
35
|
-
} from '../crossOriginRestore';
|
|
36
|
-
|
|
37
|
-
const mockRedirect = redirectToAuthorize as jest.Mock;
|
|
38
|
-
const mockIsLoopback = isLoopbackOrigin as jest.Mock;
|
|
39
|
-
const mockIsOfficial = isOfficialWebOrigin as jest.Mock;
|
|
40
|
-
const mockIsIdpHub = isIdpHubOrigin as jest.Mock;
|
|
41
|
-
|
|
42
|
-
const OXY_SERVICES_STUB = {} as OxyServices;
|
|
43
|
-
|
|
44
|
-
/** Default to an eligible official origin; individual tests narrow this. */
|
|
45
|
-
function makeOriginEligible(): void {
|
|
46
|
-
mockIsLoopback.mockReturnValue(false);
|
|
47
|
-
mockIsIdpHub.mockReturnValue(false);
|
|
48
|
-
mockIsOfficial.mockReturnValue(true);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
describe('crossOriginRestore', () => {
|
|
52
|
-
beforeEach(() => {
|
|
53
|
-
mockRedirect.mockClear();
|
|
54
|
-
mockIsLoopback.mockReset();
|
|
55
|
-
mockIsOfficial.mockReset();
|
|
56
|
-
mockIsIdpHub.mockReset();
|
|
57
|
-
globalThis.sessionStorage?.clear();
|
|
58
|
-
clearCrossOriginRestoreGuards();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
describe('isSilentRestoreEligibleOrigin', () => {
|
|
62
|
-
it('rejects loopback / local-dev origins', () => {
|
|
63
|
-
mockIsLoopback.mockReturnValue(true);
|
|
64
|
-
mockIsIdpHub.mockReturnValue(false);
|
|
65
|
-
mockIsOfficial.mockReturnValue(true);
|
|
66
|
-
expect(isSilentRestoreEligibleOrigin('http://localhost:3000')).toBe(false);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('rejects the central IdP hub origin (no self-hop)', () => {
|
|
70
|
-
mockIsLoopback.mockReturnValue(false);
|
|
71
|
-
mockIsIdpHub.mockReturnValue(true);
|
|
72
|
-
mockIsOfficial.mockReturnValue(true);
|
|
73
|
-
expect(isSilentRestoreEligibleOrigin('https://auth.oxy.so')).toBe(false);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('rejects non-official origins', () => {
|
|
77
|
-
mockIsLoopback.mockReturnValue(false);
|
|
78
|
-
mockIsIdpHub.mockReturnValue(false);
|
|
79
|
-
mockIsOfficial.mockReturnValue(false);
|
|
80
|
-
expect(isSilentRestoreEligibleOrigin('https://evil.example')).toBe(false);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('accepts official, non-loopback, non-IdP origins', () => {
|
|
84
|
-
makeOriginEligible();
|
|
85
|
-
expect(isSilentRestoreEligibleOrigin('https://accounts.oxy.so')).toBe(true);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
describe('maybeStartSilentOAuthRestore', () => {
|
|
90
|
-
it('is SKIPPED on a loopback origin (no redirect)', async () => {
|
|
91
|
-
mockIsLoopback.mockReturnValue(true);
|
|
92
|
-
mockIsIdpHub.mockReturnValue(false);
|
|
93
|
-
mockIsOfficial.mockReturnValue(true);
|
|
94
|
-
const redirected = await maybeStartSilentOAuthRestore({
|
|
95
|
-
oxyServices: OXY_SERVICES_STUB,
|
|
96
|
-
clientId: 'oxy_dk_test',
|
|
97
|
-
});
|
|
98
|
-
expect(redirected).toBe(false);
|
|
99
|
-
expect(mockRedirect).not.toHaveBeenCalled();
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('is SKIPPED on a non-official origin (no redirect)', async () => {
|
|
103
|
-
mockIsLoopback.mockReturnValue(false);
|
|
104
|
-
mockIsIdpHub.mockReturnValue(false);
|
|
105
|
-
mockIsOfficial.mockReturnValue(false);
|
|
106
|
-
const redirected = await maybeStartSilentOAuthRestore({
|
|
107
|
-
oxyServices: OXY_SERVICES_STUB,
|
|
108
|
-
clientId: 'oxy_dk_test',
|
|
109
|
-
});
|
|
110
|
-
expect(redirected).toBe(false);
|
|
111
|
-
expect(mockRedirect).not.toHaveBeenCalled();
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it('redirects to the PROD IdP by default on an eligible origin', async () => {
|
|
115
|
-
makeOriginEligible();
|
|
116
|
-
const redirected = await maybeStartSilentOAuthRestore({
|
|
117
|
-
oxyServices: OXY_SERVICES_STUB,
|
|
118
|
-
clientId: 'oxy_dk_test',
|
|
119
|
-
});
|
|
120
|
-
expect(redirected).toBe(true);
|
|
121
|
-
expect(mockRedirect).toHaveBeenCalledTimes(1);
|
|
122
|
-
const url = mockRedirect.mock.calls[0][0] as string;
|
|
123
|
-
expect(url.startsWith('https://auth.oxy.so/authorize?')).toBe(true);
|
|
124
|
-
const params = new URL(url).searchParams;
|
|
125
|
-
expect(params.get('client_id')).toBe('oxy_dk_test');
|
|
126
|
-
expect(params.get('prompt')).toBe('none');
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('honors an authorizeBaseUrl override (self-hosted / staging IdP)', async () => {
|
|
130
|
-
makeOriginEligible();
|
|
131
|
-
const redirected = await maybeStartSilentOAuthRestore({
|
|
132
|
-
oxyServices: OXY_SERVICES_STUB,
|
|
133
|
-
clientId: 'oxy_dk_test',
|
|
134
|
-
authorizeBaseUrl: 'https://auth.staging.oxy.so/authorize',
|
|
135
|
-
});
|
|
136
|
-
expect(redirected).toBe(true);
|
|
137
|
-
const url = mockRedirect.mock.calls[0][0] as string;
|
|
138
|
-
expect(url.startsWith('https://auth.staging.oxy.so/authorize?')).toBe(true);
|
|
139
|
-
const params = new URL(url).searchParams;
|
|
140
|
-
expect(params.get('client_id')).toBe('oxy_dk_test');
|
|
141
|
-
expect(params.get('prompt')).toBe('none');
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
it('persists the path-qualified redirect_uri in the handshake for token exchange', async () => {
|
|
145
|
-
makeOriginEligible();
|
|
146
|
-
const redirectUri = 'https://app.example/oauth/callback';
|
|
147
|
-
const redirected = await maybeStartSilentOAuthRestore({
|
|
148
|
-
oxyServices: OXY_SERVICES_STUB,
|
|
149
|
-
clientId: 'oxy_dk_test',
|
|
150
|
-
redirectUri,
|
|
151
|
-
});
|
|
152
|
-
expect(redirected).toBe(true);
|
|
153
|
-
expect(globalThis.sessionStorage?.getItem(OXY_OAUTH_REDIRECT_URI_STORAGE_KEY)).toBe(
|
|
154
|
-
redirectUri,
|
|
155
|
-
);
|
|
156
|
-
const url = mockRedirect.mock.calls[0][0] as string;
|
|
157
|
-
expect(new URL(url).searchParams.get('redirect_uri')).toBe(redirectUri);
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
});
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import type { OxyServices } from '@oxyhq/core';
|
|
2
|
-
import {
|
|
3
|
-
buildOAuthAuthorizeUrl,
|
|
4
|
-
generateOAuthState,
|
|
5
|
-
generatePkcePair,
|
|
6
|
-
isIdpHubOrigin,
|
|
7
|
-
isLoopbackOrigin,
|
|
8
|
-
isOfficialWebOrigin,
|
|
9
|
-
OXY_CROSS_ORIGIN_RESTORE_ATTEMPTED_KEY,
|
|
10
|
-
OXY_SILENT_OAUTH_ATTEMPTED_KEY,
|
|
11
|
-
clearOAuthHandshake,
|
|
12
|
-
persistOAuthHandshake,
|
|
13
|
-
canonicalizeOAuthRedirectUri,
|
|
14
|
-
logger,
|
|
15
|
-
} from '@oxyhq/core';
|
|
16
|
-
import { isWebBrowser } from './isWebBrowser';
|
|
17
|
-
import { replaceUrlAfterOAuthReturn } from './oauthReturn';
|
|
18
|
-
import { redirectToAuthorize } from '../components/oauthNavigation';
|
|
19
|
-
|
|
20
|
-
function sessionStore(): Storage | undefined {
|
|
21
|
-
return (globalThis as { sessionStorage?: Storage }).sessionStorage;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** True when this tab already attempted cross-origin silent OAuth restore. */
|
|
25
|
-
export function isCrossOriginRestoreBlocked(): boolean {
|
|
26
|
-
const store = sessionStore();
|
|
27
|
-
if (!store) return false;
|
|
28
|
-
return Boolean(
|
|
29
|
-
store.getItem(OXY_CROSS_ORIGIN_RESTORE_ATTEMPTED_KEY) ||
|
|
30
|
-
store.getItem(OXY_SILENT_OAUTH_ATTEMPTED_KEY),
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/** Mark restore as attempted — never auto-retry until sign-out clears guards. */
|
|
35
|
-
export function markCrossOriginRestoreAttempted(): void {
|
|
36
|
-
const store = sessionStore();
|
|
37
|
-
if (!store) return;
|
|
38
|
-
store.setItem(OXY_CROSS_ORIGIN_RESTORE_ATTEMPTED_KEY, '1');
|
|
39
|
-
store.setItem(OXY_SILENT_OAUTH_ATTEMPTED_KEY, '1');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** Clear all cross-origin restore loop guards (call on sign-out). */
|
|
43
|
-
export function clearCrossOriginRestoreGuards(): void {
|
|
44
|
-
const store = sessionStore();
|
|
45
|
-
if (!store) return;
|
|
46
|
-
for (const key of [OXY_CROSS_ORIGIN_RESTORE_ATTEMPTED_KEY, OXY_SILENT_OAUTH_ATTEMPTED_KEY]) {
|
|
47
|
-
store.removeItem(key);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Whether cold boot should attempt silent cross-origin OAuth restore for the
|
|
53
|
-
* given web origin.
|
|
54
|
-
*
|
|
55
|
-
* Mirrors the hub-sync WRITE gate (`syncHubAfterSignIn`): only OFFICIAL Oxy web
|
|
56
|
-
* origins participate in cross-app SSO — a random third-party / preview origin
|
|
57
|
-
* must never have its tab bounced to the IdP. Additionally, loopback / local-dev
|
|
58
|
-
* origins are EXCLUDED here even though {@link isOfficialWebOrigin} treats them
|
|
59
|
-
* as official: a developer's local app must never be redirected to a hosted IdP
|
|
60
|
-
* on cold boot (it signs in through the in-app dialog instead). The central IdP
|
|
61
|
-
* hub's own origin is excluded to avoid a wasteful self-hop.
|
|
62
|
-
*/
|
|
63
|
-
export function isSilentRestoreEligibleOrigin(origin: string): boolean {
|
|
64
|
-
if (isLoopbackOrigin(origin)) return false;
|
|
65
|
-
if (isIdpHubOrigin()) return false;
|
|
66
|
-
return isOfficialWebOrigin(origin);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface SilentOAuthRestoreOptions {
|
|
70
|
-
oxyServices: OxyServices;
|
|
71
|
-
clientId: string;
|
|
72
|
-
redirectUri?: string;
|
|
73
|
-
scope?: string;
|
|
74
|
-
/**
|
|
75
|
-
* Authorize endpoint override (env-configurable per deployment). Defaults to
|
|
76
|
-
* the production Oxy IdP when unset, so a local/staging app points silent
|
|
77
|
-
* restore at its OWN IdP instead of production `auth.oxy.so`.
|
|
78
|
-
*/
|
|
79
|
-
authorizeBaseUrl?: string;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Top-level redirect to auth.oxy.so/authorize with `prompt=none` for silent
|
|
84
|
-
* cross-origin session restore on all web apps (official + third-party).
|
|
85
|
-
*/
|
|
86
|
-
export async function maybeStartSilentOAuthRestore(
|
|
87
|
-
opts: SilentOAuthRestoreOptions,
|
|
88
|
-
): Promise<boolean> {
|
|
89
|
-
if (!isWebBrowser()) return false;
|
|
90
|
-
|
|
91
|
-
const location = (globalThis as { location?: Location }).location;
|
|
92
|
-
if (!location) return false;
|
|
93
|
-
|
|
94
|
-
// Defense-in-depth: never bounce a loopback / non-official / IdP-hub origin to
|
|
95
|
-
// a hosted authorize endpoint (the caller gates on this too).
|
|
96
|
-
if (!isSilentRestoreEligibleOrigin(location.origin)) {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (isCrossOriginRestoreBlocked()) {
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const params = new URLSearchParams(location.search);
|
|
105
|
-
if (params.has('code') || params.has('error')) {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
try {
|
|
110
|
-
const { codeVerifier, codeChallenge } = await generatePkcePair();
|
|
111
|
-
const state = await generateOAuthState();
|
|
112
|
-
const redirectUri = canonicalizeOAuthRedirectUri(
|
|
113
|
-
opts.redirectUri ?? location.origin,
|
|
114
|
-
);
|
|
115
|
-
if (!persistOAuthHandshake(state, codeVerifier, redirectUri)) {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const authorizeUrl = buildOAuthAuthorizeUrl({
|
|
120
|
-
authorizeBaseUrl: opts.authorizeBaseUrl,
|
|
121
|
-
clientId: opts.clientId,
|
|
122
|
-
redirectUri,
|
|
123
|
-
state,
|
|
124
|
-
codeChallenge,
|
|
125
|
-
scope: opts.scope,
|
|
126
|
-
prompt: 'none',
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
markCrossOriginRestoreAttempted();
|
|
130
|
-
redirectToAuthorize(authorizeUrl);
|
|
131
|
-
return true;
|
|
132
|
-
} catch (error) {
|
|
133
|
-
logger.warn('Silent OAuth restore skipped', { component: 'crossOriginRestore' }, error);
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* When the RP lands with OAuth error params from a silent authorize attempt,
|
|
140
|
-
* strip them and return whether the error was terminal for silent restore.
|
|
141
|
-
*/
|
|
142
|
-
export function consumeSilentOAuthError(): 'login_required' | 'consent_required' | null {
|
|
143
|
-
if (!isWebBrowser()) return null;
|
|
144
|
-
const location = (globalThis as { location?: Location; history?: History }).location;
|
|
145
|
-
const history = (globalThis as { history?: History }).history;
|
|
146
|
-
if (!location) return null;
|
|
147
|
-
|
|
148
|
-
const params = new URLSearchParams(location.search);
|
|
149
|
-
const error = params.get('error');
|
|
150
|
-
if (error !== 'login_required' && error !== 'consent_required') {
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
markCrossOriginRestoreAttempted();
|
|
155
|
-
|
|
156
|
-
if (history?.replaceState) {
|
|
157
|
-
const url = new URL(location.href);
|
|
158
|
-
url.searchParams.delete('error');
|
|
159
|
-
url.searchParams.delete('error_description');
|
|
160
|
-
url.searchParams.delete('state');
|
|
161
|
-
// Silent restore failed, but the visitor still asked for a specific page.
|
|
162
|
-
// Put them back on it rather than leaving them on the bare origin the IdP
|
|
163
|
-
// redirected to.
|
|
164
|
-
replaceUrlAfterOAuthReturn(`${url.pathname}${url.search}${url.hash}`);
|
|
165
|
-
}
|
|
166
|
-
clearOAuthHandshake();
|
|
167
|
-
return error;
|
|
168
|
-
}
|