@oxyhq/services 10.5.0 → 11.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.map +1 -1
- package/lib/commonjs/ui/components/AccountMenu.js +9 -5
- package/lib/commonjs/ui/components/AccountMenu.js.map +1 -1
- package/lib/commonjs/ui/components/AnotherDeviceQR.js +51 -56
- package/lib/commonjs/ui/components/AnotherDeviceQR.js.map +1 -1
- package/lib/commonjs/ui/components/BottomSheetRouter.js +1 -0
- package/lib/commonjs/ui/components/BottomSheetRouter.js.map +1 -1
- package/lib/commonjs/ui/components/FollowButton.js +18 -5
- package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +23 -7
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/SignInModal.js +20 -1
- package/lib/commonjs/ui/components/SignInModal.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/FileViewer.js +19 -9
- package/lib/commonjs/ui/components/fileManagement/FileViewer.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/UploadPreview.js +4 -2
- package/lib/commonjs/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +153 -19
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js +6 -17
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/mutationFactory.js +5 -5
- package/lib/commonjs/ui/hooks/mutations/mutationFactory.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +38 -38
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/useServicesMutations.js +2 -2
- package/lib/commonjs/ui/hooks/mutations/useServicesMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/queryKeys.js +3 -3
- package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +1 -1
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/usePaymentQueries.js +16 -12
- package/lib/commonjs/ui/hooks/queries/usePaymentQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useServicesQueries.js +10 -6
- package/lib/commonjs/ui/hooks/queries/useServicesQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/queryClient.js +6 -5
- package/lib/commonjs/ui/hooks/queryClient.js.map +1 -1
- package/lib/commonjs/ui/hooks/useOxyAuthSession.js +40 -2
- package/lib/commonjs/ui/hooks/useOxyAuthSession.js.map +1 -1
- package/lib/commonjs/ui/hooks/useProfileEditing.js +21 -0
- package/lib/commonjs/ui/hooks/useProfileEditing.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionManagement.js +3 -3
- package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountVerificationScreen.js +100 -108
- package/lib/commonjs/ui/screens/AccountVerificationScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AppInfoScreen.js +227 -273
- package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AvatarCropScreen.js +10 -4
- package/lib/commonjs/ui/screens/AvatarCropScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ConnectedAppsScreen.js +20 -37
- package/lib/commonjs/ui/screens/ConnectedAppsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CreateManagedAccountScreen.js +89 -201
- package/lib/commonjs/ui/screens/CreateManagedAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +80 -208
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FAQScreen.js +56 -208
- package/lib/commonjs/ui/screens/FAQScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FeedbackScreen.js +303 -352
- package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +20 -20
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HelpSupportScreen.js +77 -89
- package/lib/commonjs/ui/screens/HelpSupportScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HistoryViewScreen.js +43 -58
- package/lib/commonjs/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +67 -90
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/LearnMoreUsernamesScreen.js +77 -177
- package/lib/commonjs/ui/screens/LearnMoreUsernamesScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/LegalDocumentsScreen.js +113 -107
- package/lib/commonjs/ui/screens/LegalDocumentsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ManageAccountScreen.js +55 -114
- package/lib/commonjs/ui/screens/ManageAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/NotificationsScreen.js +67 -85
- package/lib/commonjs/ui/screens/NotificationsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/OxyAuthScreen.js +71 -135
- package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +15 -9
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PreferencesScreen.js +65 -83
- package/lib/commonjs/ui/screens/PreferencesScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +378 -1023
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +294 -242
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +192 -305
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SavesCollectionsScreen.js +57 -97
- package/lib/commonjs/ui/screens/SavesCollectionsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SearchSettingsScreen.js +41 -41
- package/lib/commonjs/ui/screens/SearchSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/UserLinksScreen.js +17 -24
- package/lib/commonjs/ui/screens/UserLinksScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/UserListScreen.js +83 -214
- package/lib/commonjs/ui/screens/UserListScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js +115 -77
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustAboutScreen.js +70 -57
- package/lib/commonjs/ui/screens/trust/TrustAboutScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js +136 -332
- package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustFAQScreen.js +47 -137
- package/lib/commonjs/ui/screens/trust/TrustFAQScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustLeaderboardScreen.js +182 -115
- package/lib/commonjs/ui/screens/trust/TrustLeaderboardScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js +138 -214
- package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustRulesScreen.js +54 -92
- package/lib/commonjs/ui/screens/trust/TrustRulesScreen.js.map +1 -1
- package/lib/commonjs/ui/utils/activeAuthuser.js +15 -9
- package/lib/commonjs/ui/utils/activeAuthuser.js.map +1 -1
- package/lib/commonjs/ui/utils/avatarUtils.js +1 -1
- package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/components/AccountMenu.js +10 -6
- package/lib/module/ui/components/AccountMenu.js.map +1 -1
- package/lib/module/ui/components/AnotherDeviceQR.js +50 -56
- package/lib/module/ui/components/AnotherDeviceQR.js.map +1 -1
- package/lib/module/ui/components/BottomSheetRouter.js +2 -1
- package/lib/module/ui/components/BottomSheetRouter.js.map +1 -1
- package/lib/module/ui/components/FollowButton.js +18 -5
- package/lib/module/ui/components/FollowButton.js.map +1 -1
- package/lib/module/ui/components/OxyProvider.js +23 -7
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/SignInModal.js +20 -1
- package/lib/module/ui/components/SignInModal.js.map +1 -1
- package/lib/module/ui/components/fileManagement/FileViewer.js +19 -9
- package/lib/module/ui/components/fileManagement/FileViewer.js.map +1 -1
- package/lib/module/ui/components/fileManagement/UploadPreview.js +4 -2
- package/lib/module/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +154 -20
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js +6 -17
- package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/module/ui/hooks/mutations/mutationFactory.js +5 -5
- package/lib/module/ui/hooks/mutations/mutationFactory.js.map +1 -1
- package/lib/module/ui/hooks/mutations/useAccountMutations.js +38 -38
- package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/module/ui/hooks/mutations/useServicesMutations.js +2 -2
- package/lib/module/ui/hooks/mutations/useServicesMutations.js.map +1 -1
- package/lib/module/ui/hooks/queries/queryKeys.js +3 -3
- package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/module/ui/hooks/queries/useAccountQueries.js +1 -1
- package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/module/ui/hooks/queries/usePaymentQueries.js +16 -12
- package/lib/module/ui/hooks/queries/usePaymentQueries.js.map +1 -1
- package/lib/module/ui/hooks/queries/useServicesQueries.js +9 -6
- package/lib/module/ui/hooks/queries/useServicesQueries.js.map +1 -1
- package/lib/module/ui/hooks/queryClient.js +6 -5
- package/lib/module/ui/hooks/queryClient.js.map +1 -1
- package/lib/module/ui/hooks/useOxyAuthSession.js +40 -2
- package/lib/module/ui/hooks/useOxyAuthSession.js.map +1 -1
- package/lib/module/ui/hooks/useProfileEditing.js +21 -0
- package/lib/module/ui/hooks/useProfileEditing.js.map +1 -1
- package/lib/module/ui/hooks/useSessionManagement.js +4 -3
- package/lib/module/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/module/ui/screens/AccountVerificationScreen.js +101 -109
- package/lib/module/ui/screens/AccountVerificationScreen.js.map +1 -1
- package/lib/module/ui/screens/AppInfoScreen.js +228 -275
- package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/module/ui/screens/AvatarCropScreen.js +10 -4
- package/lib/module/ui/screens/AvatarCropScreen.js.map +1 -1
- package/lib/module/ui/screens/ConnectedAppsScreen.js +19 -39
- package/lib/module/ui/screens/ConnectedAppsScreen.js.map +1 -1
- package/lib/module/ui/screens/CreateManagedAccountScreen.js +90 -202
- package/lib/module/ui/screens/CreateManagedAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/EditProfileFieldScreen.js +77 -205
- package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/module/ui/screens/FAQScreen.js +55 -207
- package/lib/module/ui/screens/FAQScreen.js.map +1 -1
- package/lib/module/ui/screens/FeedbackScreen.js +301 -350
- package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +20 -20
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/HelpSupportScreen.js +78 -90
- package/lib/module/ui/screens/HelpSupportScreen.js.map +1 -1
- package/lib/module/ui/screens/HistoryViewScreen.js +44 -59
- package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/module/ui/screens/LanguageSelectorScreen.js +68 -91
- package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -1
- package/lib/module/ui/screens/LearnMoreUsernamesScreen.js +75 -177
- package/lib/module/ui/screens/LearnMoreUsernamesScreen.js.map +1 -1
- package/lib/module/ui/screens/LegalDocumentsScreen.js +116 -108
- package/lib/module/ui/screens/LegalDocumentsScreen.js.map +1 -1
- package/lib/module/ui/screens/ManageAccountScreen.js +52 -112
- package/lib/module/ui/screens/ManageAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/NotificationsScreen.js +68 -86
- package/lib/module/ui/screens/NotificationsScreen.js.map +1 -1
- package/lib/module/ui/screens/OxyAuthScreen.js +69 -134
- package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/module/ui/screens/PaymentGatewayScreen.js +16 -10
- package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/module/ui/screens/PreferencesScreen.js +66 -84
- package/lib/module/ui/screens/PreferencesScreen.js.map +1 -1
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js +366 -1012
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/module/ui/screens/PrivacySettingsScreen.js +295 -243
- package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileScreen.js +189 -302
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/SavesCollectionsScreen.js +58 -98
- package/lib/module/ui/screens/SavesCollectionsScreen.js.map +1 -1
- package/lib/module/ui/screens/SearchSettingsScreen.js +42 -42
- package/lib/module/ui/screens/SearchSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/UserLinksScreen.js +18 -25
- package/lib/module/ui/screens/UserLinksScreen.js.map +1 -1
- package/lib/module/ui/screens/UserListScreen.js +81 -212
- package/lib/module/ui/screens/UserListScreen.js.map +1 -1
- package/lib/module/ui/screens/WelcomeNewUserScreen.js +114 -76
- package/lib/module/ui/screens/WelcomeNewUserScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustAboutScreen.js +69 -57
- package/lib/module/ui/screens/trust/TrustAboutScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustCenterScreen.js +135 -332
- package/lib/module/ui/screens/trust/TrustCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustFAQScreen.js +48 -138
- package/lib/module/ui/screens/trust/TrustFAQScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustLeaderboardScreen.js +184 -117
- package/lib/module/ui/screens/trust/TrustLeaderboardScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustRewardsScreen.js +132 -208
- package/lib/module/ui/screens/trust/TrustRewardsScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustRulesScreen.js +58 -94
- package/lib/module/ui/screens/trust/TrustRulesScreen.js.map +1 -1
- package/lib/module/ui/utils/activeAuthuser.js +15 -9
- package/lib/module/ui/utils/activeAuthuser.js.map +1 -1
- package/lib/module/ui/utils/avatarUtils.js +1 -1
- package/lib/module/ui/utils/avatarUtils.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +1 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/AccountMenu.d.ts +2 -0
- package/lib/typescript/commonjs/ui/components/AccountMenu.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/AnotherDeviceQR.d.ts +12 -2
- package/lib/typescript/commonjs/ui/components/AnotherDeviceQR.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/BottomSheetRouter.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/FollowButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts +3 -2
- package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/SignInModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/TouchableRipple/TouchableRipple.native.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/TouchableRipple/TouchableRipple.native.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +34 -0
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +3 -0
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts +3 -3
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queryClient.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useOxyAuthSession.d.ts +22 -0
- package/lib/typescript/commonjs/ui/hooks/useOxyAuthSession.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useProfileEditing.d.ts +3 -0
- package/lib/typescript/commonjs/ui/hooks/useProfileEditing.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useSessionManagement.d.ts +2 -1
- package/lib/typescript/commonjs/ui/hooks/useSessionManagement.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountVerificationScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AppInfoScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AvatarCropScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/ConnectedAppsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/CreateManagedAccountScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/FAQScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/HelpSupportScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/HistoryViewScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/LanguageSelectorScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/LearnMoreUsernamesScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/LegalDocumentsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/NotificationsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/OxyAuthScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/PreferencesScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/PremiumSubscriptionScreen.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/SavesCollectionsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/SearchSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/UserLinksScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/UserListScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/trust/TrustAboutScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/trust/TrustCenterScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/trust/TrustFAQScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/trust/TrustLeaderboardScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/trust/TrustRewardsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/trust/TrustRulesScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/activeAuthuser.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +1 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/AccountMenu.d.ts +2 -0
- package/lib/typescript/module/ui/components/AccountMenu.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/AnotherDeviceQR.d.ts +12 -2
- package/lib/typescript/module/ui/components/AnotherDeviceQR.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/BottomSheetRouter.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/FollowButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyProvider.d.ts +3 -2
- package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/SignInModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TouchableRipple/TouchableRipple.native.d.ts +1 -1
- package/lib/typescript/module/ui/components/TouchableRipple/TouchableRipple.native.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/OxyContext.d.ts +34 -0
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +3 -0
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts +3 -3
- package/lib/typescript/module/ui/hooks/queries/queryKeys.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.map +1 -1
- package/lib/typescript/module/ui/hooks/useOxyAuthSession.d.ts +22 -0
- package/lib/typescript/module/ui/hooks/useOxyAuthSession.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useProfileEditing.d.ts +3 -0
- package/lib/typescript/module/ui/hooks/useProfileEditing.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useSessionManagement.d.ts +2 -1
- package/lib/typescript/module/ui/hooks/useSessionManagement.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountVerificationScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AppInfoScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AvatarCropScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/ConnectedAppsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/CreateManagedAccountScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FAQScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/HelpSupportScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/HistoryViewScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/LanguageSelectorScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/LearnMoreUsernamesScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/LegalDocumentsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/NotificationsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/OxyAuthScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/PreferencesScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/PremiumSubscriptionScreen.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/SavesCollectionsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/SearchSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/UserLinksScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/UserListScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/WelcomeNewUserScreen.d.ts.map +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.map +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.map +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.map +1 -1
- package/lib/typescript/module/ui/utils/activeAuthuser.d.ts.map +1 -1
- package/lib/typescript/types/expo-haptics.d.ts +42 -0
- package/package.json +24 -31
- package/src/index.ts +1 -0
- package/src/types/expo-haptics.d.ts +42 -0
- package/src/ui/components/AccountMenu.tsx +11 -5
- package/src/ui/components/AnotherDeviceQR.tsx +53 -45
- package/src/ui/components/BottomSheetRouter.tsx +2 -1
- package/src/ui/components/FollowButton.tsx +24 -5
- package/src/ui/components/OxyProvider.tsx +22 -8
- package/src/ui/components/SignInModal.tsx +21 -2
- package/src/ui/components/TouchableRipple/TouchableRipple.native.tsx +1 -1
- package/src/ui/components/fileManagement/FileViewer.tsx +9 -9
- package/src/ui/components/fileManagement/UploadPreview.tsx +2 -2
- package/src/ui/context/OxyContext.tsx +178 -21
- package/src/ui/context/hooks/useAuthOperations.ts +6 -17
- package/src/ui/hooks/mutations/mutationFactory.ts +5 -5
- package/src/ui/hooks/mutations/useAccountMutations.ts +38 -38
- package/src/ui/hooks/mutations/useServicesMutations.ts +2 -2
- package/src/ui/hooks/queries/queryKeys.ts +6 -3
- package/src/ui/hooks/queries/useAccountQueries.ts +1 -1
- package/src/ui/hooks/queries/usePaymentQueries.ts +12 -12
- package/src/ui/hooks/queries/useServicesQueries.ts +9 -6
- package/src/ui/hooks/queryClient.ts +5 -5
- package/src/ui/hooks/useOxyAuthSession.ts +76 -2
- package/src/ui/hooks/useProfileEditing.ts +24 -0
- package/src/ui/hooks/useSessionManagement.ts +9 -6
- package/src/ui/screens/AccountVerificationScreen.tsx +101 -113
- package/src/ui/screens/AppInfoScreen.tsx +200 -238
- package/src/ui/screens/AvatarCropScreen.tsx +17 -4
- package/src/ui/screens/ConnectedAppsScreen.tsx +16 -34
- package/src/ui/screens/CreateManagedAccountScreen.tsx +94 -170
- package/src/ui/screens/EditProfileFieldScreen.tsx +77 -190
- package/src/ui/screens/FAQScreen.tsx +77 -208
- package/src/ui/screens/FeedbackScreen.tsx +330 -239
- package/src/ui/screens/FileManagementScreen.tsx +20 -20
- package/src/ui/screens/HelpSupportScreen.tsx +67 -82
- package/src/ui/screens/HistoryViewScreen.tsx +32 -38
- package/src/ui/screens/LanguageSelectorScreen.tsx +79 -93
- package/src/ui/screens/LearnMoreUsernamesScreen.tsx +81 -164
- package/src/ui/screens/LegalDocumentsScreen.tsx +184 -123
- package/src/ui/screens/ManageAccountScreen.tsx +48 -114
- package/src/ui/screens/NotificationsScreen.tsx +107 -106
- package/src/ui/screens/OxyAuthScreen.tsx +76 -109
- package/src/ui/screens/PaymentGatewayScreen.tsx +16 -7
- package/src/ui/screens/PreferencesScreen.tsx +96 -116
- package/src/ui/screens/PremiumSubscriptionScreen.tsx +419 -872
- package/src/ui/screens/PrivacySettingsScreen.tsx +203 -185
- package/src/ui/screens/ProfileScreen.tsx +158 -200
- package/src/ui/screens/SavesCollectionsScreen.tsx +78 -125
- package/src/ui/screens/SearchSettingsScreen.tsx +52 -41
- package/src/ui/screens/UserLinksScreen.tsx +18 -25
- package/src/ui/screens/UserListScreen.tsx +95 -188
- package/src/ui/screens/WelcomeNewUserScreen.tsx +109 -36
- package/src/ui/screens/trust/TrustAboutScreen.tsx +52 -41
- package/src/ui/screens/trust/TrustCenterScreen.tsx +184 -222
- package/src/ui/screens/trust/TrustFAQScreen.tsx +64 -124
- package/src/ui/screens/trust/TrustLeaderboardScreen.tsx +190 -67
- package/src/ui/screens/trust/TrustRewardsScreen.tsx +147 -182
- package/src/ui/screens/trust/TrustRulesScreen.tsx +77 -50
- package/src/ui/utils/activeAuthuser.ts +15 -9
- package/src/ui/utils/avatarUtils.ts +1 -1
- package/lib/commonjs/ui/components/feedback/FormInput.js +0 -72
- package/lib/commonjs/ui/components/feedback/FormInput.js.map +0 -1
- package/lib/commonjs/ui/components/feedback/feedbackStyles.js +0 -261
- package/lib/commonjs/ui/components/feedback/feedbackStyles.js.map +0 -1
- package/lib/module/ui/components/feedback/FormInput.js +0 -67
- package/lib/module/ui/components/feedback/FormInput.js.map +0 -1
- package/lib/module/ui/components/feedback/feedbackStyles.js +0 -256
- package/lib/module/ui/components/feedback/feedbackStyles.js.map +0 -1
- package/lib/typescript/commonjs/ui/components/feedback/FormInput.d.ts +0 -20
- package/lib/typescript/commonjs/ui/components/feedback/FormInput.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/components/feedback/feedbackStyles.d.ts +0 -279
- package/lib/typescript/commonjs/ui/components/feedback/feedbackStyles.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/feedback/FormInput.d.ts +0 -20
- package/lib/typescript/module/ui/components/feedback/FormInput.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/feedback/feedbackStyles.d.ts +0 -279
- package/lib/typescript/module/ui/components/feedback/feedbackStyles.d.ts.map +0 -1
- package/src/ui/components/feedback/FormInput.tsx +0 -84
- package/src/ui/components/feedback/feedbackStyles.ts +0 -246
|
@@ -40,10 +40,10 @@ export const useUpdateProfile = () => {
|
|
|
40
40
|
// Optimistic update
|
|
41
41
|
onMutate: async (updates) => {
|
|
42
42
|
// Cancel outgoing refetches
|
|
43
|
-
await queryClient.cancelQueries({ queryKey: queryKeys.accounts.current() });
|
|
43
|
+
await queryClient.cancelQueries({ queryKey: queryKeys.accounts.current(activeSessionId) });
|
|
44
44
|
|
|
45
45
|
// Snapshot previous value
|
|
46
|
-
const previousUser = queryClient.getQueryData<User>(queryKeys.accounts.current());
|
|
46
|
+
const previousUser = queryClient.getQueryData<User>(queryKeys.accounts.current(activeSessionId));
|
|
47
47
|
|
|
48
48
|
// Optimistically update
|
|
49
49
|
if (previousUser) {
|
|
@@ -54,7 +54,7 @@ export const useUpdateProfile = () => {
|
|
|
54
54
|
? { ...previousUser.name, ...updates.name }
|
|
55
55
|
: previousUser.name,
|
|
56
56
|
};
|
|
57
|
-
queryClient.setQueryData<User>(queryKeys.accounts.current(), optimisticUser);
|
|
57
|
+
queryClient.setQueryData<User>(queryKeys.accounts.current(activeSessionId), optimisticUser);
|
|
58
58
|
|
|
59
59
|
// Also update profile query if sessionId is available
|
|
60
60
|
if (activeSessionId) {
|
|
@@ -74,9 +74,9 @@ export const useUpdateProfile = () => {
|
|
|
74
74
|
return acc;
|
|
75
75
|
}, {});
|
|
76
76
|
|
|
77
|
-
const current = queryClient.getQueryData<User>(queryKeys.accounts.current());
|
|
77
|
+
const current = queryClient.getQueryData<User>(queryKeys.accounts.current(activeSessionId));
|
|
78
78
|
if (current) {
|
|
79
|
-
queryClient.setQueryData<User>(queryKeys.accounts.current(), {
|
|
79
|
+
queryClient.setQueryData<User>(queryKeys.accounts.current(activeSessionId), {
|
|
80
80
|
...current,
|
|
81
81
|
...partialRollback,
|
|
82
82
|
});
|
|
@@ -96,7 +96,7 @@ export const useUpdateProfile = () => {
|
|
|
96
96
|
// On success, invalidate and refetch
|
|
97
97
|
onSuccess: (data, updates) => {
|
|
98
98
|
// Update cache with server response
|
|
99
|
-
queryClient.setQueryData(queryKeys.accounts.current(), data);
|
|
99
|
+
queryClient.setQueryData(queryKeys.accounts.current(activeSessionId), data);
|
|
100
100
|
if (activeSessionId) {
|
|
101
101
|
queryClient.setQueryData(queryKeys.users.profile(activeSessionId), data);
|
|
102
102
|
}
|
|
@@ -143,8 +143,8 @@ export const useUploadAvatar = () => {
|
|
|
143
143
|
});
|
|
144
144
|
},
|
|
145
145
|
onMutate: async (file) => {
|
|
146
|
-
await queryClient.cancelQueries({ queryKey: queryKeys.accounts.current() });
|
|
147
|
-
const previousUser = queryClient.getQueryData<User>(queryKeys.accounts.current());
|
|
146
|
+
await queryClient.cancelQueries({ queryKey: queryKeys.accounts.current(activeSessionId) });
|
|
147
|
+
const previousUser = queryClient.getQueryData<User>(queryKeys.accounts.current(activeSessionId));
|
|
148
148
|
|
|
149
149
|
// Optimistically set a temporary avatar (using file URI as placeholder)
|
|
150
150
|
if (previousUser) {
|
|
@@ -152,7 +152,7 @@ export const useUploadAvatar = () => {
|
|
|
152
152
|
...previousUser,
|
|
153
153
|
avatar: file.uri, // Temporary, will be replaced with fileId
|
|
154
154
|
};
|
|
155
|
-
queryClient.setQueryData<User>(queryKeys.accounts.current(), optimisticUser);
|
|
155
|
+
queryClient.setQueryData<User>(queryKeys.accounts.current(activeSessionId), optimisticUser);
|
|
156
156
|
if (activeSessionId) {
|
|
157
157
|
queryClient.setQueryData<User>(queryKeys.users.profile(activeSessionId), optimisticUser);
|
|
158
158
|
}
|
|
@@ -164,9 +164,9 @@ export const useUploadAvatar = () => {
|
|
|
164
164
|
// Avatar upload only mutates the `avatar` field — restore only that key
|
|
165
165
|
if (context?.previousUser) {
|
|
166
166
|
const previousAvatar = context.previousUser.avatar;
|
|
167
|
-
const current = queryClient.getQueryData<User>(queryKeys.accounts.current());
|
|
167
|
+
const current = queryClient.getQueryData<User>(queryKeys.accounts.current(activeSessionId));
|
|
168
168
|
if (current) {
|
|
169
|
-
queryClient.setQueryData<User>(queryKeys.accounts.current(), {
|
|
169
|
+
queryClient.setQueryData<User>(queryKeys.accounts.current(activeSessionId), {
|
|
170
170
|
...current,
|
|
171
171
|
avatar: previousAvatar,
|
|
172
172
|
});
|
|
@@ -184,7 +184,7 @@ export const useUploadAvatar = () => {
|
|
|
184
184
|
toast.error(error instanceof Error ? error.message : 'Failed to upload avatar');
|
|
185
185
|
},
|
|
186
186
|
onSuccess: (data) => {
|
|
187
|
-
queryClient.setQueryData(queryKeys.accounts.current(), data);
|
|
187
|
+
queryClient.setQueryData(queryKeys.accounts.current(activeSessionId), data);
|
|
188
188
|
if (activeSessionId) {
|
|
189
189
|
queryClient.setQueryData(queryKeys.users.profile(activeSessionId), data);
|
|
190
190
|
}
|
|
@@ -270,10 +270,10 @@ export const useUpdateAccountSettings = () => {
|
|
|
270
270
|
},
|
|
271
271
|
onMutate: async ({ updates }) => {
|
|
272
272
|
await queryClient.cancelQueries({ queryKey: queryKeys.accounts.settings() });
|
|
273
|
-
const previousUser = queryClient.getQueryData<User>(queryKeys.accounts.current());
|
|
273
|
+
const previousUser = queryClient.getQueryData<User>(queryKeys.accounts.current(activeSessionId));
|
|
274
274
|
|
|
275
275
|
if (previousUser) {
|
|
276
|
-
queryClient.setQueryData<User>(queryKeys.accounts.current(), {
|
|
276
|
+
queryClient.setQueryData<User>(queryKeys.accounts.current(activeSessionId), {
|
|
277
277
|
...previousUser,
|
|
278
278
|
privacySettings: {
|
|
279
279
|
...previousUser.privacySettings,
|
|
@@ -294,9 +294,9 @@ export const useUpdateAccountSettings = () => {
|
|
|
294
294
|
return acc;
|
|
295
295
|
}, {});
|
|
296
296
|
|
|
297
|
-
const current = queryClient.getQueryData<User>(queryKeys.accounts.current());
|
|
297
|
+
const current = queryClient.getQueryData<User>(queryKeys.accounts.current(activeSessionId));
|
|
298
298
|
if (current) {
|
|
299
|
-
queryClient.setQueryData<User>(queryKeys.accounts.current(), {
|
|
299
|
+
queryClient.setQueryData<User>(queryKeys.accounts.current(activeSessionId), {
|
|
300
300
|
...current,
|
|
301
301
|
privacySettings: {
|
|
302
302
|
...(current.privacySettings ?? {}),
|
|
@@ -308,7 +308,7 @@ export const useUpdateAccountSettings = () => {
|
|
|
308
308
|
toast.error(error instanceof Error ? error.message : 'Failed to update settings');
|
|
309
309
|
},
|
|
310
310
|
onSuccess: (data) => {
|
|
311
|
-
queryClient.setQueryData(queryKeys.accounts.current(), data);
|
|
311
|
+
queryClient.setQueryData(queryKeys.accounts.current(activeSessionId), data);
|
|
312
312
|
|
|
313
313
|
// Update authStore so frontend components see the changes immediately
|
|
314
314
|
useAuthStore.getState().setUser(data);
|
|
@@ -328,7 +328,7 @@ export const useUpdateAccountSettings = () => {
|
|
|
328
328
|
return {
|
|
329
329
|
...mutation,
|
|
330
330
|
mutate: (updates: Partial<PrivacySettings>): void => {
|
|
331
|
-
const currentUser = user ?? queryClient.getQueryData<User>(queryKeys.accounts.current());
|
|
331
|
+
const currentUser = user ?? queryClient.getQueryData<User>(queryKeys.accounts.current(activeSessionId));
|
|
332
332
|
if (!currentUser) {
|
|
333
333
|
toast.error('Cannot update account settings: no current user');
|
|
334
334
|
return;
|
|
@@ -336,7 +336,7 @@ export const useUpdateAccountSettings = () => {
|
|
|
336
336
|
mutation.mutate({ updates, currentUser });
|
|
337
337
|
},
|
|
338
338
|
mutateAsync: async (updates: Partial<PrivacySettings>): Promise<User> => {
|
|
339
|
-
const currentUser = user ?? queryClient.getQueryData<User>(queryKeys.accounts.current());
|
|
339
|
+
const currentUser = user ?? queryClient.getQueryData<User>(queryKeys.accounts.current(activeSessionId));
|
|
340
340
|
if (!currentUser) {
|
|
341
341
|
throw new Error('Cannot update account settings: no current user');
|
|
342
342
|
}
|
|
@@ -373,11 +373,11 @@ export const useUpdatePrivacySettings = () => {
|
|
|
373
373
|
|
|
374
374
|
// Cancel outgoing refetches
|
|
375
375
|
await queryClient.cancelQueries({ queryKey: queryKeys.privacy.settings(targetUserId) });
|
|
376
|
-
await queryClient.cancelQueries({ queryKey: queryKeys.accounts.current() });
|
|
376
|
+
await queryClient.cancelQueries({ queryKey: queryKeys.accounts.current(activeSessionId) });
|
|
377
377
|
|
|
378
378
|
// Snapshot previous values
|
|
379
379
|
const previousPrivacySettings = queryClient.getQueryData(queryKeys.privacy.settings(targetUserId));
|
|
380
|
-
const previousUser = queryClient.getQueryData<User>(queryKeys.accounts.current());
|
|
380
|
+
const previousUser = queryClient.getQueryData<User>(queryKeys.accounts.current(activeSessionId));
|
|
381
381
|
|
|
382
382
|
// Optimistically update privacy settings
|
|
383
383
|
if (previousPrivacySettings) {
|
|
@@ -389,7 +389,7 @@ export const useUpdatePrivacySettings = () => {
|
|
|
389
389
|
|
|
390
390
|
// Also update user query if available
|
|
391
391
|
if (previousUser) {
|
|
392
|
-
queryClient.setQueryData<User>(queryKeys.accounts.current(), {
|
|
392
|
+
queryClient.setQueryData<User>(queryKeys.accounts.current(activeSessionId), {
|
|
393
393
|
...previousUser,
|
|
394
394
|
privacySettings: {
|
|
395
395
|
...previousUser.privacySettings,
|
|
@@ -431,9 +431,9 @@ export const useUpdatePrivacySettings = () => {
|
|
|
431
431
|
(acc as Record<string, unknown>)[key as string] = previousPrivacy[key as string];
|
|
432
432
|
return acc;
|
|
433
433
|
}, {});
|
|
434
|
-
const current = queryClient.getQueryData<User>(queryKeys.accounts.current());
|
|
434
|
+
const current = queryClient.getQueryData<User>(queryKeys.accounts.current(activeSessionId));
|
|
435
435
|
if (current) {
|
|
436
|
-
queryClient.setQueryData<User>(queryKeys.accounts.current(), {
|
|
436
|
+
queryClient.setQueryData<User>(queryKeys.accounts.current(activeSessionId), {
|
|
437
437
|
...current,
|
|
438
438
|
privacySettings: {
|
|
439
439
|
...(current.privacySettings ?? {}),
|
|
@@ -479,7 +479,7 @@ export const useUpdatePrivacySettings = () => {
|
|
|
479
479
|
}),
|
|
480
480
|
);
|
|
481
481
|
|
|
482
|
-
const currentUser = queryClient.getQueryData<User>(queryKeys.accounts.current());
|
|
482
|
+
const currentUser = queryClient.getQueryData<User>(queryKeys.accounts.current(activeSessionId));
|
|
483
483
|
if (currentUser) {
|
|
484
484
|
const updatedUser: User = {
|
|
485
485
|
...currentUser,
|
|
@@ -489,7 +489,7 @@ export const useUpdatePrivacySettings = () => {
|
|
|
489
489
|
...incoming,
|
|
490
490
|
},
|
|
491
491
|
};
|
|
492
|
-
queryClient.setQueryData<User>(queryKeys.accounts.current(), updatedUser);
|
|
492
|
+
queryClient.setQueryData<User>(queryKeys.accounts.current(activeSessionId), updatedUser);
|
|
493
493
|
useAuthStore.getState().setUser(updatedUser);
|
|
494
494
|
}
|
|
495
495
|
// Deliberately NOT invalidating any queries here. invalidateAccountQueries
|
|
@@ -538,11 +538,11 @@ export const useUpdateNotificationPreferences = () => {
|
|
|
538
538
|
);
|
|
539
539
|
},
|
|
540
540
|
onMutate: async (preferences) => {
|
|
541
|
-
await queryClient.cancelQueries({ queryKey: queryKeys.accounts.current() });
|
|
542
|
-
const previousUser = queryClient.getQueryData<User>(queryKeys.accounts.current());
|
|
541
|
+
await queryClient.cancelQueries({ queryKey: queryKeys.accounts.current(activeSessionId) });
|
|
542
|
+
const previousUser = queryClient.getQueryData<User>(queryKeys.accounts.current(activeSessionId));
|
|
543
543
|
|
|
544
544
|
if (previousUser) {
|
|
545
|
-
queryClient.setQueryData<User>(queryKeys.accounts.current(), {
|
|
545
|
+
queryClient.setQueryData<User>(queryKeys.accounts.current(activeSessionId), {
|
|
546
546
|
...previousUser,
|
|
547
547
|
notificationPreferences: {
|
|
548
548
|
...previousUser.notificationPreferences,
|
|
@@ -555,9 +555,9 @@ export const useUpdateNotificationPreferences = () => {
|
|
|
555
555
|
},
|
|
556
556
|
onError: (error, _preferences, context) => {
|
|
557
557
|
if (context?.previousUser) {
|
|
558
|
-
const current = queryClient.getQueryData<User>(queryKeys.accounts.current());
|
|
558
|
+
const current = queryClient.getQueryData<User>(queryKeys.accounts.current(activeSessionId));
|
|
559
559
|
if (current) {
|
|
560
|
-
queryClient.setQueryData<User>(queryKeys.accounts.current(), {
|
|
560
|
+
queryClient.setQueryData<User>(queryKeys.accounts.current(activeSessionId), {
|
|
561
561
|
...current,
|
|
562
562
|
notificationPreferences: context.previousUser.notificationPreferences,
|
|
563
563
|
});
|
|
@@ -570,7 +570,7 @@ export const useUpdateNotificationPreferences = () => {
|
|
|
570
570
|
);
|
|
571
571
|
},
|
|
572
572
|
onSuccess: (data) => {
|
|
573
|
-
queryClient.setQueryData(queryKeys.accounts.current(), data);
|
|
573
|
+
queryClient.setQueryData(queryKeys.accounts.current(activeSessionId), data);
|
|
574
574
|
useAuthStore.getState().setUser(data);
|
|
575
575
|
invalidateAccountQueries(queryClient);
|
|
576
576
|
},
|
|
@@ -596,11 +596,11 @@ export const useUpdateUserPreferences = () => {
|
|
|
596
596
|
);
|
|
597
597
|
},
|
|
598
598
|
onMutate: async (preferences) => {
|
|
599
|
-
await queryClient.cancelQueries({ queryKey: queryKeys.accounts.current() });
|
|
600
|
-
const previousUser = queryClient.getQueryData<User>(queryKeys.accounts.current());
|
|
599
|
+
await queryClient.cancelQueries({ queryKey: queryKeys.accounts.current(activeSessionId) });
|
|
600
|
+
const previousUser = queryClient.getQueryData<User>(queryKeys.accounts.current(activeSessionId));
|
|
601
601
|
|
|
602
602
|
if (previousUser) {
|
|
603
|
-
queryClient.setQueryData<User>(queryKeys.accounts.current(), {
|
|
603
|
+
queryClient.setQueryData<User>(queryKeys.accounts.current(activeSessionId), {
|
|
604
604
|
...previousUser,
|
|
605
605
|
userPreferences: {
|
|
606
606
|
...previousUser.userPreferences,
|
|
@@ -613,9 +613,9 @@ export const useUpdateUserPreferences = () => {
|
|
|
613
613
|
},
|
|
614
614
|
onError: (error, _preferences, context) => {
|
|
615
615
|
if (context?.previousUser) {
|
|
616
|
-
const current = queryClient.getQueryData<User>(queryKeys.accounts.current());
|
|
616
|
+
const current = queryClient.getQueryData<User>(queryKeys.accounts.current(activeSessionId));
|
|
617
617
|
if (current) {
|
|
618
|
-
queryClient.setQueryData<User>(queryKeys.accounts.current(), {
|
|
618
|
+
queryClient.setQueryData<User>(queryKeys.accounts.current(activeSessionId), {
|
|
619
619
|
...current,
|
|
620
620
|
userPreferences: context.previousUser.userPreferences,
|
|
621
621
|
});
|
|
@@ -624,7 +624,7 @@ export const useUpdateUserPreferences = () => {
|
|
|
624
624
|
toast.error(error instanceof Error ? error.message : 'Failed to update preferences');
|
|
625
625
|
},
|
|
626
626
|
onSuccess: (data) => {
|
|
627
|
-
queryClient.setQueryData(queryKeys.accounts.current(), data);
|
|
627
|
+
queryClient.setQueryData(queryKeys.accounts.current(activeSessionId), data);
|
|
628
628
|
useAuthStore.getState().setUser(data);
|
|
629
629
|
invalidateAccountQueries(queryClient);
|
|
630
630
|
},
|
|
@@ -17,12 +17,12 @@ export const useSwitchSession = () => {
|
|
|
17
17
|
mutationFn: async (sessionId: string) => {
|
|
18
18
|
return await switchSession(sessionId);
|
|
19
19
|
},
|
|
20
|
-
onSuccess: (user) => {
|
|
20
|
+
onSuccess: (user, sessionId) => {
|
|
21
21
|
// Invalidate all session queries
|
|
22
22
|
invalidateSessionQueries(queryClient);
|
|
23
23
|
|
|
24
24
|
// Update current user query
|
|
25
|
-
queryClient.setQueryData(queryKeys.accounts.current(), user);
|
|
25
|
+
queryClient.setQueryData(queryKeys.accounts.current(sessionId), user);
|
|
26
26
|
|
|
27
27
|
// Invalidate account queries
|
|
28
28
|
queryClient.invalidateQueries({ queryKey: queryKeys.accounts.all });
|
|
@@ -17,7 +17,10 @@ export const queryKeys = {
|
|
|
17
17
|
list: (sessionIds: string[]) => [...queryKeys.accounts.lists(), sessionIds] as const,
|
|
18
18
|
details: () => [...queryKeys.accounts.all, 'detail'] as const,
|
|
19
19
|
detail: (sessionId: string) => [...queryKeys.accounts.details(), sessionId] as const,
|
|
20
|
-
current: (
|
|
20
|
+
current: (sessionId?: string | null) =>
|
|
21
|
+
sessionId
|
|
22
|
+
? ([...queryKeys.accounts.all, 'current', sessionId] as const)
|
|
23
|
+
: ([...queryKeys.accounts.all, 'current'] as const),
|
|
21
24
|
settings: () => [...queryKeys.accounts.all, 'settings'] as const,
|
|
22
25
|
},
|
|
23
26
|
|
|
@@ -46,7 +49,7 @@ export const queryKeys = {
|
|
|
46
49
|
devices: {
|
|
47
50
|
all: ['devices'] as const,
|
|
48
51
|
lists: () => [...queryKeys.devices.all, 'list'] as const,
|
|
49
|
-
list: (
|
|
52
|
+
list: (accountScope?: string) => [...queryKeys.devices.lists(), accountScope] as const,
|
|
50
53
|
details: () => [...queryKeys.devices.all, 'detail'] as const,
|
|
51
54
|
detail: (deviceId: string) => [...queryKeys.devices.details(), deviceId] as const,
|
|
52
55
|
},
|
|
@@ -71,7 +74,7 @@ export const queryKeys = {
|
|
|
71
74
|
// Storage usage queries
|
|
72
75
|
storage: {
|
|
73
76
|
all: ['storage'] as const,
|
|
74
|
-
usage: () => [...queryKeys.storage.all, 'usage'] as const,
|
|
77
|
+
usage: (accountScope?: string) => [...queryKeys.storage.all, 'usage', accountScope] as const,
|
|
75
78
|
},
|
|
76
79
|
|
|
77
80
|
// Connected apps (FedCM grants the user has authorized)
|
|
@@ -65,7 +65,7 @@ export const useCurrentUser = (options?: { enabled?: boolean }) => {
|
|
|
65
65
|
const queryClient = useQueryClient();
|
|
66
66
|
|
|
67
67
|
const query = useQuery({
|
|
68
|
-
queryKey: queryKeys.accounts.current(),
|
|
68
|
+
queryKey: queryKeys.accounts.current(activeSessionId),
|
|
69
69
|
queryFn: async () => {
|
|
70
70
|
if (!activeSessionId) {
|
|
71
71
|
throw new Error('No active session');
|
|
@@ -34,10 +34,10 @@ import type {
|
|
|
34
34
|
* API's `{ plan: 'basic' }` fallback when the user has never subscribed.
|
|
35
35
|
*/
|
|
36
36
|
export const useUserSubscription = (options?: { enabled?: boolean }) => {
|
|
37
|
-
const { oxyServices, isAuthenticated, activeSessionId } = useOxy();
|
|
37
|
+
const { oxyServices, isAuthenticated, activeSessionId, user } = useOxy();
|
|
38
38
|
|
|
39
39
|
return useQuery({
|
|
40
|
-
queryKey: queryKeys.payments.subscription(),
|
|
40
|
+
queryKey: queryKeys.payments.subscription(user?.id),
|
|
41
41
|
queryFn: async () => {
|
|
42
42
|
return authenticatedApiCall<Subscription>(
|
|
43
43
|
oxyServices,
|
|
@@ -45,7 +45,7 @@ export const useUserSubscription = (options?: { enabled?: boolean }) => {
|
|
|
45
45
|
() => oxyServices.getCurrentUserSubscription(),
|
|
46
46
|
);
|
|
47
47
|
},
|
|
48
|
-
enabled: (options?.enabled !== false) && isAuthenticated,
|
|
48
|
+
enabled: (options?.enabled !== false) && isAuthenticated && !!user?.id,
|
|
49
49
|
// Subscription state changes rarely; tolerate a longer fresh window.
|
|
50
50
|
staleTime: 5 * 60 * 1000, // 5 minutes
|
|
51
51
|
gcTime: 30 * 60 * 1000, // 30 minutes
|
|
@@ -59,10 +59,10 @@ export const useUserSubscription = (options?: { enabled?: boolean }) => {
|
|
|
59
59
|
* returns the user's `deposit` and `purchase` transactions newest-first.
|
|
60
60
|
*/
|
|
61
61
|
export const useUserPayments = (options?: { enabled?: boolean }) => {
|
|
62
|
-
const { oxyServices, isAuthenticated, activeSessionId } = useOxy();
|
|
62
|
+
const { oxyServices, isAuthenticated, activeSessionId, user } = useOxy();
|
|
63
63
|
|
|
64
64
|
return useQuery({
|
|
65
|
-
queryKey: queryKeys.payments.history(),
|
|
65
|
+
queryKey: queryKeys.payments.history(user?.id),
|
|
66
66
|
queryFn: async () => {
|
|
67
67
|
return authenticatedApiCall<Payment[]>(
|
|
68
68
|
oxyServices,
|
|
@@ -70,7 +70,7 @@ export const useUserPayments = (options?: { enabled?: boolean }) => {
|
|
|
70
70
|
() => oxyServices.getUserPayments(),
|
|
71
71
|
);
|
|
72
72
|
},
|
|
73
|
-
enabled: (options?.enabled !== false) && isAuthenticated,
|
|
73
|
+
enabled: (options?.enabled !== false) && isAuthenticated && !!user?.id,
|
|
74
74
|
// Billing history is append-mostly; a short fresh window is fine.
|
|
75
75
|
staleTime: 2 * 60 * 1000, // 2 minutes
|
|
76
76
|
gcTime: 30 * 60 * 1000, // 30 minutes
|
|
@@ -84,10 +84,10 @@ export const useUserPayments = (options?: { enabled?: boolean }) => {
|
|
|
84
84
|
* Balance changes frequently, so the fresh window is intentionally short.
|
|
85
85
|
*/
|
|
86
86
|
export const useUserWallet = (options?: { enabled?: boolean }) => {
|
|
87
|
-
const { oxyServices, isAuthenticated, activeSessionId } = useOxy();
|
|
87
|
+
const { oxyServices, isAuthenticated, activeSessionId, user } = useOxy();
|
|
88
88
|
|
|
89
89
|
return useQuery({
|
|
90
|
-
queryKey: queryKeys.payments.wallet(),
|
|
90
|
+
queryKey: queryKeys.payments.wallet(user?.id),
|
|
91
91
|
queryFn: async () => {
|
|
92
92
|
return authenticatedApiCall<Wallet>(
|
|
93
93
|
oxyServices,
|
|
@@ -95,7 +95,7 @@ export const useUserWallet = (options?: { enabled?: boolean }) => {
|
|
|
95
95
|
() => oxyServices.getCurrentUserWallet(),
|
|
96
96
|
);
|
|
97
97
|
},
|
|
98
|
-
enabled: (options?.enabled !== false) && isAuthenticated,
|
|
98
|
+
enabled: (options?.enabled !== false) && isAuthenticated && !!user?.id,
|
|
99
99
|
staleTime: 60 * 1000, // 1 minute (balance moves often)
|
|
100
100
|
gcTime: 10 * 60 * 1000, // 10 minutes
|
|
101
101
|
});
|
|
@@ -116,12 +116,12 @@ export const useUserWalletTransactions = (
|
|
|
116
116
|
params?: { limit?: number; offset?: number },
|
|
117
117
|
options?: { enabled?: boolean },
|
|
118
118
|
) => {
|
|
119
|
-
const { oxyServices, isAuthenticated, activeSessionId } = useOxy();
|
|
119
|
+
const { oxyServices, isAuthenticated, activeSessionId, user } = useOxy();
|
|
120
120
|
const limit = params?.limit;
|
|
121
121
|
const offset = params?.offset;
|
|
122
122
|
|
|
123
123
|
return useQuery({
|
|
124
|
-
queryKey: queryKeys.payments.walletTransactions(limit, offset),
|
|
124
|
+
queryKey: queryKeys.payments.walletTransactions(limit, offset, user?.id),
|
|
125
125
|
queryFn: async () => {
|
|
126
126
|
return authenticatedApiCall<WalletTransactionsResponse>(
|
|
127
127
|
oxyServices,
|
|
@@ -129,7 +129,7 @@ export const useUserWalletTransactions = (
|
|
|
129
129
|
() => oxyServices.getCurrentUserWalletTransactions({ limit, offset }),
|
|
130
130
|
);
|
|
131
131
|
},
|
|
132
|
-
enabled: (options?.enabled !== false) && isAuthenticated,
|
|
132
|
+
enabled: (options?.enabled !== false) && isAuthenticated && !!user?.id,
|
|
133
133
|
staleTime: 60 * 1000, // 1 minute (ledger updates frequently)
|
|
134
134
|
gcTime: 10 * 60 * 1000, // 10 minutes
|
|
135
135
|
});
|
|
@@ -5,6 +5,9 @@ import { queryKeys } from './queryKeys';
|
|
|
5
5
|
import { useOxy } from '../../context/OxyContext';
|
|
6
6
|
import { fetchSessionsWithFallback, mapSessionsToClient } from '../../utils/sessionHelpers';
|
|
7
7
|
|
|
8
|
+
const accountQueryScope = (activeSessionId: string | null, actingAs?: string | null): string =>
|
|
9
|
+
`${activeSessionId ?? 'no-session'}:${actingAs ?? 'self'}`;
|
|
10
|
+
|
|
8
11
|
/**
|
|
9
12
|
* Get all active sessions for the current user
|
|
10
13
|
*/
|
|
@@ -90,10 +93,10 @@ export const useDeviceSessions = (options?: { enabled?: boolean }) => {
|
|
|
90
93
|
* Get user devices
|
|
91
94
|
*/
|
|
92
95
|
export const useUserDevices = (options?: { enabled?: boolean }) => {
|
|
93
|
-
const { oxyServices, isAuthenticated, activeSessionId } = useOxy();
|
|
96
|
+
const { oxyServices, isAuthenticated, activeSessionId, actingAs } = useOxy();
|
|
94
97
|
|
|
95
98
|
return useQuery({
|
|
96
|
-
queryKey: queryKeys.devices.list(),
|
|
99
|
+
queryKey: queryKeys.devices.list(accountQueryScope(activeSessionId, actingAs)),
|
|
97
100
|
queryFn: async () => {
|
|
98
101
|
return authenticatedApiCall(
|
|
99
102
|
oxyServices,
|
|
@@ -101,7 +104,7 @@ export const useUserDevices = (options?: { enabled?: boolean }) => {
|
|
|
101
104
|
() => oxyServices.getUserDevices()
|
|
102
105
|
);
|
|
103
106
|
},
|
|
104
|
-
enabled: (options?.enabled !== false) && isAuthenticated,
|
|
107
|
+
enabled: (options?.enabled !== false) && isAuthenticated && !!activeSessionId,
|
|
105
108
|
staleTime: 5 * 60 * 1000,
|
|
106
109
|
gcTime: 30 * 60 * 1000,
|
|
107
110
|
});
|
|
@@ -132,10 +135,10 @@ export const useSecurityInfo = (options?: { enabled?: boolean }) => {
|
|
|
132
135
|
* `useEffect` fetches.
|
|
133
136
|
*/
|
|
134
137
|
export const useAccountStorageUsage = (options?: { enabled?: boolean }) => {
|
|
135
|
-
const { oxyServices, isAuthenticated, activeSessionId } = useOxy();
|
|
138
|
+
const { oxyServices, isAuthenticated, activeSessionId, actingAs } = useOxy();
|
|
136
139
|
|
|
137
140
|
return useQuery<AccountStorageUsageResponse>({
|
|
138
|
-
queryKey: queryKeys.storage.usage(),
|
|
141
|
+
queryKey: queryKeys.storage.usage(accountQueryScope(activeSessionId, actingAs)),
|
|
139
142
|
queryFn: async () => {
|
|
140
143
|
return authenticatedApiCall(
|
|
141
144
|
oxyServices,
|
|
@@ -143,7 +146,7 @@ export const useAccountStorageUsage = (options?: { enabled?: boolean }) => {
|
|
|
143
146
|
() => oxyServices.getAccountStorageUsage()
|
|
144
147
|
);
|
|
145
148
|
},
|
|
146
|
-
enabled: (options?.enabled !== false) && isAuthenticated,
|
|
149
|
+
enabled: (options?.enabled !== false) && isAuthenticated && !!activeSessionId,
|
|
147
150
|
staleTime: 5 * 60 * 1000,
|
|
148
151
|
gcTime: 30 * 60 * 1000,
|
|
149
152
|
});
|
|
@@ -33,7 +33,7 @@ import { createAsyncStoragePersister } from '@tanstack/query-async-storage-persi
|
|
|
33
33
|
import { isDev } from '@oxyhq/core';
|
|
34
34
|
import type { StorageInterface } from '../utils/storageHelpers';
|
|
35
35
|
|
|
36
|
-
const QUERY_CACHE_KEY = '
|
|
36
|
+
const QUERY_CACHE_KEY = 'oxy_query_cache_v3';
|
|
37
37
|
const QUERY_CACHE_MAX_AGE = 30 * 24 * 60 * 60 * 1000; // 30 days
|
|
38
38
|
const QUERY_PERSIST_THROTTLE_MS = 1_000;
|
|
39
39
|
|
|
@@ -50,7 +50,6 @@ const PERSISTED_QUERY_PREFIXES: ReadonlyArray<string> = [
|
|
|
50
50
|
'sessions',
|
|
51
51
|
'devices',
|
|
52
52
|
'privacy',
|
|
53
|
-
'payments',
|
|
54
53
|
];
|
|
55
54
|
|
|
56
55
|
/**
|
|
@@ -209,9 +208,10 @@ export const attachQueryPersistence = (
|
|
|
209
208
|
return { unsubscribe, restored };
|
|
210
209
|
};
|
|
211
210
|
|
|
212
|
-
// Legacy
|
|
213
|
-
// written by older builds.
|
|
214
|
-
|
|
211
|
+
// Legacy cache keys — kept so we can opportunistically purge stale blobs
|
|
212
|
+
// written by older builds. v2 may contain persisted payments data, so the
|
|
213
|
+
// active key is bumped to v3 and old blobs are only removed during explicit clears.
|
|
214
|
+
const LEGACY_QUERY_CACHE_KEYS: ReadonlyArray<string> = ['oxy_query_cache_v2', 'oxy_query_cache'];
|
|
215
215
|
|
|
216
216
|
/**
|
|
217
217
|
* Remove the persisted query+mutation cache (used on full sign-out / data
|
|
@@ -53,6 +53,27 @@ export interface AuthSession {
|
|
|
53
53
|
expiresAt: number;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Extended `POST /auth/session/create` response (the "Sign in with Oxy" handoff
|
|
58
|
+
* fields, Workstream C2). Both are optional so this hook degrades gracefully
|
|
59
|
+
* when the handoff backend is not yet deployed — the legacy `oxyauth://<token>`
|
|
60
|
+
* QR (`qrData`) remains the fallback.
|
|
61
|
+
*/
|
|
62
|
+
interface AuthSessionCreateResponse {
|
|
63
|
+
/**
|
|
64
|
+
* Public, single-use authorize code carried in the QR / deep-link. NEVER the
|
|
65
|
+
* secret `sessionToken` — the approver resolves the requesting app's identity
|
|
66
|
+
* from this code server-side.
|
|
67
|
+
*/
|
|
68
|
+
authorizeCode?: string;
|
|
69
|
+
/** Ready-to-render deep-link / universal-link string (`oxycommons://approve?...`). */
|
|
70
|
+
qrPayload?: string;
|
|
71
|
+
/** Session lifecycle status (e.g. `'pending'`). */
|
|
72
|
+
status?: string;
|
|
73
|
+
/** Server-authoritative expiry (epoch ms); the client-proposed value is the fallback. */
|
|
74
|
+
expiresAt?: number;
|
|
75
|
+
}
|
|
76
|
+
|
|
56
77
|
/** Real-time auth-session socket payload (also matches the poll status shape). */
|
|
57
78
|
interface AuthUpdatePayload {
|
|
58
79
|
status: 'authorized' | 'cancelled' | 'expired';
|
|
@@ -76,6 +97,21 @@ export interface UseOxyAuthSessionResult {
|
|
|
76
97
|
authSession: AuthSession | null;
|
|
77
98
|
/** The QR payload string (`oxyauth://<token>`), or `''` when no session. */
|
|
78
99
|
qrData: string;
|
|
100
|
+
/**
|
|
101
|
+
* The PUBLIC, single-use authorize code for the "Sign in with Oxy" handoff,
|
|
102
|
+
* or `null` when the handoff backend did not return one. The approver (the
|
|
103
|
+
* Oxy identity app) resolves the requesting app's identity from this code —
|
|
104
|
+
* it is safe to display; it is NOT the secret `sessionToken`.
|
|
105
|
+
*/
|
|
106
|
+
authorizeCode: string | null;
|
|
107
|
+
/**
|
|
108
|
+
* The structured "Sign in with Oxy" deep-link payload
|
|
109
|
+
* (`oxycommons://approve?...`) to render in the cross-device QR and to open on
|
|
110
|
+
* the same device, or `null` when the handoff backend did not return one.
|
|
111
|
+
* Render this (preferred over `qrData`) in the QR and pass it to
|
|
112
|
+
* `Linking.openURL` for same-device approval.
|
|
113
|
+
*/
|
|
114
|
+
qrPayload: string | null;
|
|
79
115
|
/** `true` while the session is being created (initial spinner). */
|
|
80
116
|
isLoading: boolean;
|
|
81
117
|
/** A user-facing error message, or `null`. Drives the retry UI. */
|
|
@@ -89,6 +125,13 @@ export interface UseOxyAuthSessionResult {
|
|
|
89
125
|
* This is the action behind the platform-primary "Continue with Oxy" button.
|
|
90
126
|
*/
|
|
91
127
|
openAuthApproval: () => Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Same-device "Sign in with Oxy" handoff: deep-link to `qrPayload`
|
|
130
|
+
* (`oxycommons://approve?...`) so the native Oxy identity app opens directly
|
|
131
|
+
* to approve. No-op when no `qrPayload` was returned. The socket / poll still
|
|
132
|
+
* completes the sign-in once the approval lands.
|
|
133
|
+
*/
|
|
134
|
+
openSameDeviceApproval: () => Promise<void>;
|
|
92
135
|
/** Tear down the current session and create a fresh one (the retry action). */
|
|
93
136
|
retry: () => void;
|
|
94
137
|
/** Disconnect the socket and stop polling. Idempotent. */
|
|
@@ -198,6 +241,9 @@ export function useOxyAuthSession(
|
|
|
198
241
|
const [isLoading, setIsLoading] = useState(true);
|
|
199
242
|
const [error, setError] = useState<string | null>(null);
|
|
200
243
|
const [isWaiting, setIsWaiting] = useState(false);
|
|
244
|
+
// "Sign in with Oxy" handoff fields surfaced from the `create` response.
|
|
245
|
+
const [authorizeCode, setAuthorizeCode] = useState<string | null>(null);
|
|
246
|
+
const [qrPayload, setQrPayload] = useState<string | null>(null);
|
|
201
247
|
|
|
202
248
|
const socketRef = useRef<Socket | null>(null);
|
|
203
249
|
const pollingIntervalRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
|
@@ -376,6 +422,9 @@ export function useOxyAuthSession(
|
|
|
376
422
|
const generateAuthSession = useCallback(async () => {
|
|
377
423
|
setIsLoading(true);
|
|
378
424
|
setError(null);
|
|
425
|
+
// Reset the handoff fields for the fresh session (also clears them on retry).
|
|
426
|
+
setAuthorizeCode(null);
|
|
427
|
+
setQrPayload(null);
|
|
379
428
|
isProcessingRef.current = false;
|
|
380
429
|
|
|
381
430
|
// The cross-app device sign-in flow identifies the requesting app by its
|
|
@@ -393,8 +442,11 @@ export function useOxyAuthSession(
|
|
|
393
442
|
const sessionToken = generateSessionToken();
|
|
394
443
|
const expiresAt = Date.now() + AUTH_SESSION_EXPIRY_MS;
|
|
395
444
|
|
|
396
|
-
// Register the auth session with the server.
|
|
397
|
-
|
|
445
|
+
// Register the auth session with the server. The response carries the
|
|
446
|
+
// "Sign in with Oxy" handoff fields (public `authorizeCode` + structured
|
|
447
|
+
// `qrPayload`) when the handoff backend is deployed; both are optional, so
|
|
448
|
+
// the legacy `oxyauth://<token>` QR path keeps working without them.
|
|
449
|
+
const createResponse = await oxyServices.makeRequest<AuthSessionCreateResponse>(
|
|
398
450
|
'POST',
|
|
399
451
|
'/auth/session/create',
|
|
400
452
|
{ sessionToken, expiresAt, clientId },
|
|
@@ -402,6 +454,8 @@ export function useOxyAuthSession(
|
|
|
402
454
|
);
|
|
403
455
|
|
|
404
456
|
setAuthSession({ sessionToken, expiresAt });
|
|
457
|
+
setAuthorizeCode(createResponse?.authorizeCode ?? null);
|
|
458
|
+
setQrPayload(createResponse?.qrPayload ?? null);
|
|
405
459
|
setIsWaiting(true);
|
|
406
460
|
|
|
407
461
|
// Socket is the fast path; the poll is a transport-independent backstop
|
|
@@ -461,6 +515,23 @@ export function useOxyAuthSession(
|
|
|
461
515
|
}
|
|
462
516
|
}, [authSession, oxyServices]);
|
|
463
517
|
|
|
518
|
+
// Same-device "Sign in with Oxy" handoff: deep-link to the `qrPayload`
|
|
519
|
+
// (`oxycommons://approve?...`) so the native Oxy identity app opens directly
|
|
520
|
+
// to approve. The socket / poll already resolves the flow once the approval
|
|
521
|
+
// lands, so this only needs to launch the deep link. No-op when the handoff
|
|
522
|
+
// backend returned no `qrPayload`.
|
|
523
|
+
const openSameDeviceApproval = useCallback(async () => {
|
|
524
|
+
if (!qrPayload) {
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
try {
|
|
528
|
+
await Linking.openURL(qrPayload);
|
|
529
|
+
} catch (err) {
|
|
530
|
+
debug.error('Unable to open the Oxy app for approval:', err);
|
|
531
|
+
setError('Unable to open the Oxy app. Scan the QR code from another device instead.');
|
|
532
|
+
}
|
|
533
|
+
}, [qrPayload]);
|
|
534
|
+
|
|
464
535
|
// Tear down and recreate the session (the retry action).
|
|
465
536
|
const retry = useCallback(() => {
|
|
466
537
|
cleanup();
|
|
@@ -546,10 +617,13 @@ export function useOxyAuthSession(
|
|
|
546
617
|
return {
|
|
547
618
|
authSession,
|
|
548
619
|
qrData,
|
|
620
|
+
authorizeCode,
|
|
621
|
+
qrPayload,
|
|
549
622
|
isLoading,
|
|
550
623
|
error,
|
|
551
624
|
isWaiting,
|
|
552
625
|
openAuthApproval,
|
|
626
|
+
openSameDeviceApproval,
|
|
553
627
|
retry,
|
|
554
628
|
cleanup,
|
|
555
629
|
};
|