@oxyhq/services 22.8.7 → 22.10.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 +24 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/components/OxyAccountDialogScreen.js +150 -0
- package/lib/commonjs/ui/components/OxyAccountDialogScreen.js.map +1 -0
- package/lib/commonjs/ui/components/OxyAuthChooser.js +137 -40
- package/lib/commonjs/ui/components/OxyAuthChooser.js.map +1 -1
- package/lib/commonjs/ui/components/OxyConsentScreen.js +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +9 -29
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/ProfileButton.js +1 -1
- package/lib/commonjs/ui/components/RequireOxyAuth.js +1 -1
- package/lib/commonjs/ui/components/SurfaceHeaderAction.js +63 -0
- package/lib/commonjs/ui/components/SurfaceHeaderAction.js.map +1 -0
- package/lib/commonjs/ui/components/SurfaceScreen.js +193 -0
- package/lib/commonjs/ui/components/SurfaceScreen.js.map +1 -0
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js +46 -29
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/commonjs/ui/components/modals/DeleteAccountModal.js +47 -23
- package/lib/commonjs/ui/components/modals/DeleteAccountModal.js.map +1 -1
- package/lib/commonjs/ui/components/oxyAuthChooserStyles.js +22 -12
- package/lib/commonjs/ui/components/oxyAuthChooserStyles.js.map +1 -1
- package/lib/commonjs/ui/components/surfaces/ActionSheetSurface.js +83 -0
- package/lib/commonjs/ui/components/surfaces/ActionSheetSurface.js.map +1 -0
- package/lib/commonjs/ui/context/OxyContext.js +49 -4
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/hooks/useAvatarPicker.js +34 -39
- package/lib/commonjs/ui/hooks/useAvatarPicker.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSurfaceHeader.js +46 -0
- package/lib/commonjs/ui/hooks/useSurfaceHeader.js.map +1 -0
- package/lib/commonjs/ui/hooks/useSwitchableAccounts.js +1 -1
- package/lib/commonjs/ui/navigation/accountDialogManager.js +14 -2
- package/lib/commonjs/ui/navigation/accountDialogManager.js.map +1 -1
- package/lib/commonjs/ui/navigation/bottomSheetManager.js +38 -56
- package/lib/commonjs/ui/navigation/bottomSheetManager.js.map +1 -1
- package/lib/commonjs/ui/navigation/routes.js +7 -57
- package/lib/commonjs/ui/navigation/routes.js.map +1 -1
- package/lib/commonjs/ui/navigation/surfaceBackBridge.js +68 -0
- package/lib/commonjs/ui/navigation/surfaceBackBridge.js.map +1 -0
- package/lib/commonjs/ui/navigation/surfaceNavStack.js +98 -0
- package/lib/commonjs/ui/navigation/surfaceNavStack.js.map +1 -0
- package/lib/commonjs/ui/navigation/surfaceRegistry.js +152 -0
- package/lib/commonjs/ui/navigation/surfaceRegistry.js.map +1 -0
- package/lib/commonjs/ui/navigation/surfaces.js +256 -0
- package/lib/commonjs/ui/navigation/surfaces.js.map +1 -0
- package/lib/commonjs/ui/screens/AccountMembersScreen.js +214 -283
- package/lib/commonjs/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +88 -118
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountVerificationScreen.js +22 -36
- package/lib/commonjs/ui/screens/AccountVerificationScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AppInfoScreen.js +219 -226
- package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AvatarCropScreen.js +10 -14
- package/lib/commonjs/ui/screens/AvatarCropScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ConnectedAppsScreen.js +24 -39
- package/lib/commonjs/ui/screens/ConnectedAppsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CreateAccountScreen.js +136 -158
- package/lib/commonjs/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +29 -36
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/EditProfileScreen.js +101 -109
- package/lib/commonjs/ui/screens/EditProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FAQScreen.js +10 -15
- package/lib/commonjs/ui/screens/FAQScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FeedbackScreen.js +8 -16
- package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +219 -206
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HelpSupportScreen.js +62 -69
- package/lib/commonjs/ui/screens/HelpSupportScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HistoryViewScreen.js +63 -79
- package/lib/commonjs/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +69 -98
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/LearnMoreUsernamesScreen.js +8 -14
- package/lib/commonjs/ui/screens/LearnMoreUsernamesScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/LegalDocumentsScreen.js +77 -94
- package/lib/commonjs/ui/screens/LegalDocumentsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ManageAccountScreen.js +99 -134
- package/lib/commonjs/ui/screens/ManageAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/NotificationsScreen.js +69 -76
- package/lib/commonjs/ui/screens/NotificationsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +3 -8
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PreferencesScreen.js +67 -74
- package/lib/commonjs/ui/screens/PreferencesScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +55 -91
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +291 -304
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +100 -114
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SavesCollectionsScreen.js +38 -45
- package/lib/commonjs/ui/screens/SavesCollectionsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SearchSettingsScreen.js +44 -57
- package/lib/commonjs/ui/screens/SearchSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/UserLinksScreen.js +24 -31
- package/lib/commonjs/ui/screens/UserLinksScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/UserListScreen.js +14 -24
- package/lib/commonjs/ui/screens/UserListScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/PhotoPickerSection.js +1 -1
- package/lib/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.js +9 -7
- package/lib/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustAboutScreen.js +66 -75
- package/lib/commonjs/ui/screens/trust/TrustAboutScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js +111 -139
- package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustFAQScreen.js +13 -20
- package/lib/commonjs/ui/screens/trust/TrustFAQScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustLeaderboardScreen.js +14 -27
- package/lib/commonjs/ui/screens/trust/TrustLeaderboardScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js +68 -85
- package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustRulesScreen.js +28 -36
- package/lib/commonjs/ui/screens/trust/TrustRulesScreen.js.map +1 -1
- package/lib/commonjs/ui/types/surfaceScreen.js +6 -0
- package/lib/commonjs/ui/types/surfaceScreen.js.map +1 -0
- package/lib/module/index.js +12 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/components/OxyAccountDialogScreen.js +145 -0
- package/lib/module/ui/components/OxyAccountDialogScreen.js.map +1 -0
- package/lib/module/ui/components/OxyAuthChooser.js +137 -40
- package/lib/module/ui/components/OxyAuthChooser.js.map +1 -1
- package/lib/module/ui/components/OxyConsentScreen.js +1 -1
- package/lib/module/ui/components/OxyProvider.js +10 -30
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/ProfileButton.js +1 -1
- package/lib/module/ui/components/RequireOxyAuth.js +1 -1
- package/lib/module/ui/components/SurfaceHeaderAction.js +58 -0
- package/lib/module/ui/components/SurfaceHeaderAction.js.map +1 -0
- package/lib/module/ui/components/SurfaceScreen.js +188 -0
- package/lib/module/ui/components/SurfaceScreen.js.map +1 -0
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js +46 -29
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/module/ui/components/modals/DeleteAccountModal.js +46 -23
- package/lib/module/ui/components/modals/DeleteAccountModal.js.map +1 -1
- package/lib/module/ui/components/oxyAuthChooserStyles.js +22 -12
- package/lib/module/ui/components/oxyAuthChooserStyles.js.map +1 -1
- package/lib/module/ui/components/surfaces/ActionSheetSurface.js +78 -0
- package/lib/module/ui/components/surfaces/ActionSheetSurface.js.map +1 -0
- package/lib/module/ui/context/OxyContext.js +49 -4
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/hooks/useAvatarPicker.js +34 -39
- package/lib/module/ui/hooks/useAvatarPicker.js.map +1 -1
- package/lib/module/ui/hooks/useSurfaceHeader.js +42 -0
- package/lib/module/ui/hooks/useSurfaceHeader.js.map +1 -0
- package/lib/module/ui/hooks/useSwitchableAccounts.js +1 -1
- package/lib/module/ui/navigation/accountDialogManager.js +14 -2
- package/lib/module/ui/navigation/accountDialogManager.js.map +1 -1
- package/lib/module/ui/navigation/bottomSheetManager.js +37 -53
- package/lib/module/ui/navigation/bottomSheetManager.js.map +1 -1
- package/lib/module/ui/navigation/routes.js +6 -56
- package/lib/module/ui/navigation/routes.js.map +1 -1
- package/lib/module/ui/navigation/surfaceBackBridge.js +63 -0
- package/lib/module/ui/navigation/surfaceBackBridge.js.map +1 -0
- package/lib/module/ui/navigation/surfaceNavStack.js +95 -0
- package/lib/module/ui/navigation/surfaceNavStack.js.map +1 -0
- package/lib/module/ui/navigation/surfaceRegistry.js +146 -0
- package/lib/module/ui/navigation/surfaceRegistry.js.map +1 -0
- package/lib/module/ui/navigation/surfaces.js +244 -0
- package/lib/module/ui/navigation/surfaces.js.map +1 -0
- package/lib/module/ui/screens/AccountMembersScreen.js +218 -286
- package/lib/module/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +92 -121
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountVerificationScreen.js +25 -38
- package/lib/module/ui/screens/AccountVerificationScreen.js.map +1 -1
- package/lib/module/ui/screens/AppInfoScreen.js +220 -227
- package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/module/ui/screens/AvatarCropScreen.js +10 -14
- package/lib/module/ui/screens/AvatarCropScreen.js.map +1 -1
- package/lib/module/ui/screens/ConnectedAppsScreen.js +26 -40
- package/lib/module/ui/screens/ConnectedAppsScreen.js.map +1 -1
- package/lib/module/ui/screens/CreateAccountScreen.js +139 -160
- package/lib/module/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/EditProfileFieldScreen.js +32 -38
- package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/module/ui/screens/EditProfileScreen.js +102 -110
- package/lib/module/ui/screens/EditProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/FAQScreen.js +11 -15
- package/lib/module/ui/screens/FAQScreen.js.map +1 -1
- package/lib/module/ui/screens/FeedbackScreen.js +10 -17
- package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +222 -208
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/HelpSupportScreen.js +64 -70
- package/lib/module/ui/screens/HelpSupportScreen.js.map +1 -1
- package/lib/module/ui/screens/HistoryViewScreen.js +65 -81
- package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/module/ui/screens/LanguageSelectorScreen.js +71 -99
- package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -1
- package/lib/module/ui/screens/LearnMoreUsernamesScreen.js +10 -15
- package/lib/module/ui/screens/LearnMoreUsernamesScreen.js.map +1 -1
- package/lib/module/ui/screens/LegalDocumentsScreen.js +78 -94
- package/lib/module/ui/screens/LegalDocumentsScreen.js.map +1 -1
- package/lib/module/ui/screens/ManageAccountScreen.js +102 -137
- package/lib/module/ui/screens/ManageAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/NotificationsScreen.js +71 -77
- package/lib/module/ui/screens/NotificationsScreen.js.map +1 -1
- package/lib/module/ui/screens/PaymentGatewayScreen.js +4 -9
- package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/module/ui/screens/PreferencesScreen.js +69 -75
- package/lib/module/ui/screens/PreferencesScreen.js.map +1 -1
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js +58 -93
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/module/ui/screens/PrivacySettingsScreen.js +293 -305
- package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileScreen.js +102 -116
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/SavesCollectionsScreen.js +40 -46
- package/lib/module/ui/screens/SavesCollectionsScreen.js.map +1 -1
- package/lib/module/ui/screens/SearchSettingsScreen.js +46 -58
- package/lib/module/ui/screens/SearchSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/UserLinksScreen.js +26 -32
- package/lib/module/ui/screens/UserLinksScreen.js.map +1 -1
- package/lib/module/ui/screens/UserListScreen.js +14 -24
- package/lib/module/ui/screens/UserListScreen.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/PhotoPickerSection.js +1 -1
- package/lib/module/ui/screens/fileManagement/hooks/useFileUploadState.js +8 -7
- package/lib/module/ui/screens/fileManagement/hooks/useFileUploadState.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustAboutScreen.js +67 -75
- package/lib/module/ui/screens/trust/TrustAboutScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustCenterScreen.js +112 -139
- package/lib/module/ui/screens/trust/TrustCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustFAQScreen.js +15 -21
- package/lib/module/ui/screens/trust/TrustFAQScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustLeaderboardScreen.js +14 -26
- package/lib/module/ui/screens/trust/TrustLeaderboardScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustRewardsScreen.js +69 -85
- package/lib/module/ui/screens/trust/TrustRewardsScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustRulesScreen.js +30 -37
- package/lib/module/ui/screens/trust/TrustRulesScreen.js.map +1 -1
- package/lib/module/ui/types/surfaceScreen.js +4 -0
- package/lib/module/ui/types/surfaceScreen.js.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +2 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyAccountDialogScreen.d.ts +39 -0
- package/lib/typescript/commonjs/ui/components/OxyAccountDialogScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts +3 -3
- package/lib/typescript/commonjs/ui/components/OxyAuthChooser.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/ProfileButton.d.ts +2 -2
- package/lib/typescript/commonjs/ui/components/RequireOxyAuth.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/SurfaceHeaderAction.d.ts +16 -0
- package/lib/typescript/commonjs/ui/components/SurfaceHeaderAction.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/SurfaceScreen.d.ts +26 -0
- package/lib/typescript/commonjs/ui/components/SurfaceScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts +14 -4
- package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/modals/DeleteAccountModal.d.ts +17 -2
- package/lib/typescript/commonjs/ui/components/modals/DeleteAccountModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/oxyAuthChooserStyles.d.ts +19 -9
- package/lib/typescript/commonjs/ui/components/oxyAuthChooserStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/surfaces/ActionSheetSurface.d.ts +38 -0
- package/lib/typescript/commonjs/ui/components/surfaces/ActionSheetSurface.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useAvatarPicker.d.ts +7 -11
- package/lib/typescript/commonjs/ui/hooks/useAvatarPicker.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useSurfaceHeader.d.ts +31 -0
- package/lib/typescript/commonjs/ui/hooks/useSurfaceHeader.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hooks/useSwitchableAccounts.d.ts +1 -1
- package/lib/typescript/commonjs/ui/navigation/accountDialogManager.d.ts +14 -2
- package/lib/typescript/commonjs/ui/navigation/accountDialogManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/bottomSheetManager.d.ts +24 -16
- package/lib/typescript/commonjs/ui/navigation/bottomSheetManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts +2 -60
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/surfaceBackBridge.d.ts +16 -0
- package/lib/typescript/commonjs/ui/navigation/surfaceBackBridge.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/navigation/surfaceNavStack.d.ts +51 -0
- package/lib/typescript/commonjs/ui/navigation/surfaceNavStack.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/navigation/surfaceRegistry.d.ts +135 -0
- package/lib/typescript/commonjs/ui/navigation/surfaceRegistry.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/navigation/surfaces.d.ts +79 -0
- package/lib/typescript/commonjs/ui/navigation/surfaces.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/AccountMembersScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.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 +0 -4
- 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/CreateAccountScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/EditProfileScreen.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/FileManagementScreen.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 +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/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/fileManagement/hooks/useFileUploadState.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/types/navigation.d.ts +8 -0
- package/lib/typescript/commonjs/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/types/surfaceScreen.d.ts +38 -0
- package/lib/typescript/commonjs/ui/types/surfaceScreen.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +2 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyAccountDialogScreen.d.ts +39 -0
- package/lib/typescript/module/ui/components/OxyAccountDialogScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts +3 -3
- package/lib/typescript/module/ui/components/OxyAuthChooser.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/ProfileButton.d.ts +2 -2
- package/lib/typescript/module/ui/components/RequireOxyAuth.d.ts +1 -1
- package/lib/typescript/module/ui/components/SurfaceHeaderAction.d.ts +16 -0
- package/lib/typescript/module/ui/components/SurfaceHeaderAction.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/SurfaceScreen.d.ts +26 -0
- package/lib/typescript/module/ui/components/SurfaceScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts +14 -4
- package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/modals/DeleteAccountModal.d.ts +17 -2
- package/lib/typescript/module/ui/components/modals/DeleteAccountModal.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/oxyAuthChooserStyles.d.ts +19 -9
- package/lib/typescript/module/ui/components/oxyAuthChooserStyles.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/surfaces/ActionSheetSurface.d.ts +38 -0
- package/lib/typescript/module/ui/components/surfaces/ActionSheetSurface.d.ts.map +1 -0
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useAvatarPicker.d.ts +7 -11
- package/lib/typescript/module/ui/hooks/useAvatarPicker.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useSurfaceHeader.d.ts +31 -0
- package/lib/typescript/module/ui/hooks/useSurfaceHeader.d.ts.map +1 -0
- package/lib/typescript/module/ui/hooks/useSwitchableAccounts.d.ts +1 -1
- package/lib/typescript/module/ui/navigation/accountDialogManager.d.ts +14 -2
- package/lib/typescript/module/ui/navigation/accountDialogManager.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts +24 -16
- package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/routes.d.ts +2 -60
- package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/surfaceBackBridge.d.ts +16 -0
- package/lib/typescript/module/ui/navigation/surfaceBackBridge.d.ts.map +1 -0
- package/lib/typescript/module/ui/navigation/surfaceNavStack.d.ts +51 -0
- package/lib/typescript/module/ui/navigation/surfaceNavStack.d.ts.map +1 -0
- package/lib/typescript/module/ui/navigation/surfaceRegistry.d.ts +135 -0
- package/lib/typescript/module/ui/navigation/surfaceRegistry.d.ts.map +1 -0
- package/lib/typescript/module/ui/navigation/surfaces.d.ts +79 -0
- package/lib/typescript/module/ui/navigation/surfaces.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/AccountMembersScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountSettingsScreen.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 +0 -4
- 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/CreateAccountScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/EditProfileScreen.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/FileManagementScreen.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 +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/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/fileManagement/hooks/useFileUploadState.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/types/navigation.d.ts +8 -0
- package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/module/ui/types/surfaceScreen.d.ts +38 -0
- package/lib/typescript/module/ui/types/surfaceScreen.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +12 -5
- package/src/ui/components/OxyAccountDialogScreen.tsx +148 -0
- package/src/ui/components/OxyAuthChooser.tsx +153 -33
- package/src/ui/components/OxyConsentScreen.tsx +1 -1
- package/src/ui/components/OxyProvider.tsx +12 -34
- package/src/ui/components/ProfileButton.tsx +2 -2
- package/src/ui/components/RequireOxyAuth.tsx +1 -1
- package/src/ui/components/SurfaceHeaderAction.tsx +60 -0
- package/src/ui/components/SurfaceScreen.tsx +226 -0
- package/src/ui/components/fileManagement/FileDetailsModal.tsx +50 -36
- package/src/ui/components/modals/DeleteAccountModal.tsx +47 -26
- package/src/ui/components/oxyAuthChooserStyles.ts +22 -12
- package/src/ui/components/surfaces/ActionSheetSurface.tsx +98 -0
- package/src/ui/context/OxyContext.tsx +43 -3
- package/src/ui/hooks/useAvatarPicker.ts +53 -66
- package/src/ui/hooks/useSurfaceHeader.ts +56 -0
- package/src/ui/hooks/useSwitchableAccounts.ts +1 -1
- package/src/ui/navigation/__tests__/getSurfaceConfig.test.ts +39 -0
- package/src/ui/navigation/__tests__/surfaceNavStack.test.ts +68 -0
- package/src/ui/navigation/accountDialogManager.ts +14 -2
- package/src/ui/navigation/bottomSheetManager.ts +46 -73
- package/src/ui/navigation/routes.ts +7 -106
- package/src/ui/navigation/surfaceBackBridge.ts +69 -0
- package/src/ui/navigation/surfaceNavStack.ts +110 -0
- package/src/ui/navigation/surfaceRegistry.ts +240 -0
- package/src/ui/navigation/surfaces.ts +272 -0
- package/src/ui/screens/AccountMembersScreen.tsx +39 -100
- package/src/ui/screens/AccountSettingsScreen.tsx +32 -54
- package/src/ui/screens/AccountVerificationScreen.tsx +23 -51
- package/src/ui/screens/AppInfoScreen.tsx +6 -13
- package/src/ui/screens/AvatarCropScreen.tsx +8 -17
- package/src/ui/screens/ConnectedAppsScreen.tsx +39 -60
- package/src/ui/screens/CreateAccountScreen.tsx +13 -39
- package/src/ui/screens/EditProfileFieldScreen.tsx +30 -48
- package/src/ui/screens/EditProfileScreen.tsx +7 -16
- package/src/ui/screens/FAQScreen.tsx +9 -13
- package/src/ui/screens/FeedbackScreen.tsx +8 -22
- package/src/ui/screens/FileManagementScreen.tsx +191 -188
- package/src/ui/screens/HelpSupportScreen.tsx +7 -13
- package/src/ui/screens/HistoryViewScreen.tsx +26 -31
- package/src/ui/screens/LanguageSelectorScreen.tsx +12 -46
- package/src/ui/screens/LearnMoreUsernamesScreen.tsx +8 -16
- package/src/ui/screens/LegalDocumentsScreen.tsx +7 -22
- package/src/ui/screens/ManageAccountScreen.tsx +96 -165
- package/src/ui/screens/NotificationsScreen.tsx +7 -13
- package/src/ui/screens/PaymentGatewayScreen.tsx +3 -10
- package/src/ui/screens/PreferencesScreen.tsx +7 -13
- package/src/ui/screens/PremiumSubscriptionScreen.tsx +52 -90
- package/src/ui/screens/PrivacySettingsScreen.tsx +9 -21
- package/src/ui/screens/ProfileScreen.tsx +9 -11
- package/src/ui/screens/SavesCollectionsScreen.tsx +7 -13
- package/src/ui/screens/SearchSettingsScreen.tsx +9 -21
- package/src/ui/screens/UserLinksScreen.tsx +7 -14
- package/src/ui/screens/UserListScreen.tsx +2 -5
- package/src/ui/screens/fileManagement/PhotoPickerSection.tsx +1 -1
- package/src/ui/screens/fileManagement/hooks/useFileUploadState.ts +9 -7
- package/src/ui/screens/trust/TrustAboutScreen.tsx +10 -17
- package/src/ui/screens/trust/TrustCenterScreen.tsx +9 -28
- package/src/ui/screens/trust/TrustFAQScreen.tsx +15 -18
- package/src/ui/screens/trust/TrustLeaderboardScreen.tsx +3 -5
- package/src/ui/screens/trust/TrustRewardsScreen.tsx +11 -26
- package/src/ui/screens/trust/TrustRulesScreen.tsx +10 -13
- package/src/ui/types/navigation.ts +8 -0
- package/src/ui/types/surfaceScreen.ts +38 -0
- package/lib/commonjs/ui/components/BottomSheet.js +0 -49
- package/lib/commonjs/ui/components/BottomSheet.js.map +0 -1
- package/lib/commonjs/ui/components/BottomSheetRouter.js +0 -298
- package/lib/commonjs/ui/components/BottomSheetRouter.js.map +0 -1
- package/lib/commonjs/ui/components/Header.js +0 -305
- package/lib/commonjs/ui/components/Header.js.map +0 -1
- package/lib/commonjs/ui/components/OxyAccountDialog.js +0 -259
- package/lib/commonjs/ui/components/OxyAccountDialog.js.map +0 -1
- package/lib/module/ui/components/BottomSheet.js +0 -45
- package/lib/module/ui/components/BottomSheet.js.map +0 -1
- package/lib/module/ui/components/BottomSheetRouter.js +0 -292
- package/lib/module/ui/components/BottomSheetRouter.js.map +0 -1
- package/lib/module/ui/components/Header.js +0 -299
- package/lib/module/ui/components/Header.js.map +0 -1
- package/lib/module/ui/components/OxyAccountDialog.js +0 -254
- package/lib/module/ui/components/OxyAccountDialog.js.map +0 -1
- package/lib/typescript/commonjs/ui/components/BottomSheet.d.ts +0 -29
- package/lib/typescript/commonjs/ui/components/BottomSheet.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/components/BottomSheetRouter.d.ts +0 -9
- package/lib/typescript/commonjs/ui/components/BottomSheetRouter.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/components/Header.d.ts +0 -33
- package/lib/typescript/commonjs/ui/components/Header.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/components/OxyAccountDialog.d.ts +0 -37
- package/lib/typescript/commonjs/ui/components/OxyAccountDialog.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/BottomSheet.d.ts +0 -29
- package/lib/typescript/module/ui/components/BottomSheet.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/BottomSheetRouter.d.ts +0 -9
- package/lib/typescript/module/ui/components/BottomSheetRouter.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/Header.d.ts +0 -33
- package/lib/typescript/module/ui/components/Header.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/OxyAccountDialog.d.ts +0 -37
- package/lib/typescript/module/ui/components/OxyAccountDialog.d.ts.map +0 -1
- package/src/ui/components/BottomSheet.tsx +0 -48
- package/src/ui/components/BottomSheetRouter.tsx +0 -310
- package/src/ui/components/Header.tsx +0 -224
- package/src/ui/components/OxyAccountDialog.tsx +0 -243
- package/src/ui/navigation/__tests__/getSheetConfig.test.ts +0 -36
|
@@ -45,6 +45,7 @@ import { useDeviceManagement } from '../hooks/useDeviceManagement';
|
|
|
45
45
|
import { getStorageKeys, createPlatformStorage, type StorageInterface } from '../utils/storageHelpers';
|
|
46
46
|
import type { RouteName } from '../navigation/routes';
|
|
47
47
|
import { showBottomSheet as globalShowBottomSheet } from '../navigation/bottomSheetManager';
|
|
48
|
+
import { presentDetached, type SurfaceInstance } from '../navigation/surfaces';
|
|
48
49
|
import { useQueryClient, onlineManager } from '@tanstack/react-query';
|
|
49
50
|
import { clearQueryCache } from '../hooks/queryClient';
|
|
50
51
|
import { useAvatarPicker } from '../hooks/useAvatarPicker';
|
|
@@ -643,6 +644,14 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
643
644
|
const commitSwitchedSessionRef = useRef(commitSwitchedSession);
|
|
644
645
|
commitSwitchedSessionRef.current = commitSwitchedSession;
|
|
645
646
|
|
|
647
|
+
// The live AccountDialog surface (a stacked Bloom surface), while open — the
|
|
648
|
+
// SINGLE source of truth for "is the account dialog open". Held so
|
|
649
|
+
// `openAccountDialog` can no-op when already open and `closeAccountDialog` /
|
|
650
|
+
// `onSignedIn` can dismiss it. Its present→settle lifecycle is what drives the
|
|
651
|
+
// reactive `accountDialogOpen` mirror below: presenting flips it true, the
|
|
652
|
+
// surface settling (`result.finally`) flips it false — no other write site.
|
|
653
|
+
const accountDialogSurfaceRef = useRef<SurfaceInstance<'AccountDialog'> | null>(null);
|
|
654
|
+
|
|
646
655
|
const accountDialogControllerRef = useRef<AccountDialogController | null>(null);
|
|
647
656
|
if (!accountDialogControllerRef.current) {
|
|
648
657
|
accountDialogControllerRef.current = createAccountDialogController({
|
|
@@ -655,7 +664,13 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
655
664
|
socketFactory: io,
|
|
656
665
|
commitSession: (session) => handleWebSessionRef.current(session),
|
|
657
666
|
commitSwitchedSession: (session) => commitSwitchedSessionRef.current(session),
|
|
658
|
-
onSignedIn: () =>
|
|
667
|
+
onSignedIn: () => {
|
|
668
|
+
// Dismiss the surface; its settle (`result.finally` below) is what flips
|
|
669
|
+
// `accountDialogOpen` false. The surface's present→settle lifecycle is the
|
|
670
|
+
// SINGLE source of truth for "is the account dialog open" — never a manual
|
|
671
|
+
// flip here.
|
|
672
|
+
accountDialogSurfaceRef.current?.dismiss();
|
|
673
|
+
},
|
|
659
674
|
openUrl: (url) => {
|
|
660
675
|
if (isWebBrowser()) {
|
|
661
676
|
redirectToAuthorize(url);
|
|
@@ -680,12 +695,38 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
680
695
|
|
|
681
696
|
const openAccountDialog = useCallback((view?: AccountDialogView): void => {
|
|
682
697
|
accountDialogControllerRef.current?.setView(view ?? 'accounts');
|
|
698
|
+
// Present the AccountDialog surface on the shared Bloom stack the FIRST time
|
|
699
|
+
// (subsequent opens just re-point the controller's view above). `presentDetached`
|
|
700
|
+
// keeps it OUT of the `showBottomSheet` route-surface lineage, so closing the
|
|
701
|
+
// bottom-sheet session never touches the account dialog and vice-versa. When a
|
|
702
|
+
// route surface (e.g. ManageAccount) is already open, this stacks the dialog
|
|
703
|
+
// ABOVE it; dismissing the dialog unwinds back to that surface.
|
|
704
|
+
if (!accountDialogSurfaceRef.current) {
|
|
705
|
+
const instance = presentDetached(
|
|
706
|
+
'AccountDialog',
|
|
707
|
+
{ initialView: view ?? 'accounts' },
|
|
708
|
+
{ placement: { base: 'bottom', md: 'center' }, dismissOnBackdrop: false, maxWidth: 420 },
|
|
709
|
+
);
|
|
710
|
+
accountDialogSurfaceRef.current = instance;
|
|
711
|
+
// The surface settling is the ONE place `accountDialogOpen` flips false —
|
|
712
|
+
// covering every dismiss path (close button, `onSignedIn`, programmatic
|
|
713
|
+
// `closeAccountDialog`, host unmount). So the stack owns the open state.
|
|
714
|
+
instance.result.finally(() => {
|
|
715
|
+
if (accountDialogSurfaceRef.current === instance) {
|
|
716
|
+
accountDialogSurfaceRef.current = null;
|
|
717
|
+
setAccountDialogOpen(false);
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
}
|
|
683
721
|
setAccountDialogOpen(true);
|
|
684
722
|
}, []);
|
|
685
723
|
|
|
686
724
|
const closeAccountDialog = useCallback((): void => {
|
|
687
725
|
accountDialogControllerRef.current?.cancelSignIn();
|
|
688
|
-
|
|
726
|
+
// Dismiss the surface; its settle (`result.finally` above) flips
|
|
727
|
+
// `accountDialogOpen` false. Do NOT flip it here — the surface lifecycle is
|
|
728
|
+
// the single source of truth, so a manual write would be a second authority.
|
|
729
|
+
accountDialogSurfaceRef.current?.dismiss();
|
|
689
730
|
}, []);
|
|
690
731
|
|
|
691
732
|
// Start driving the dialog on mount; tear it down on unmount.
|
|
@@ -934,7 +975,6 @@ export const OxyProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
934
975
|
currentLanguage,
|
|
935
976
|
activeSessionId,
|
|
936
977
|
queryClient,
|
|
937
|
-
showBottomSheet: showBottomSheetForContext,
|
|
938
978
|
});
|
|
939
979
|
|
|
940
980
|
const { accounts, refreshAccounts, switchToAccount, createAccount: createAccountFn } = useOxyAccountGraph({
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Extracts avatar selection logic from OxyContext for better modularity.
|
|
5
5
|
*
|
|
6
|
-
* Flow:
|
|
7
|
-
* 1.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* Flow (typed promises over the shared surface stack — no callback props):
|
|
7
|
+
* 1. `surfaces.present('FileManagement', …)` opens the image-only picker and
|
|
8
|
+
* resolves with the picked file (or `undefined` if the user cancels).
|
|
9
|
+
* 2. Resolve a private-safe source URL, then `surfaces.present('AvatarCrop', …)`
|
|
10
|
+
* opens the square-crop editor and resolves with the cropped JPEG.
|
|
10
11
|
* 3. The cropped JPEG is uploaded as a NEW file via `oxyServices.assetUpload`
|
|
11
12
|
* and that file becomes the user's avatar.
|
|
12
13
|
*
|
|
@@ -15,12 +16,12 @@
|
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
import { useCallback } from 'react';
|
|
18
|
-
import type {
|
|
19
|
+
import type { OxyServices } from '@oxyhq/core';
|
|
19
20
|
import { translate, updateAvatarVisibility } from '@oxyhq/core';
|
|
20
21
|
import type { QueryClient } from '@tanstack/react-query';
|
|
21
22
|
import { toast } from '@oxyhq/bloom';
|
|
22
|
-
import type { RouteName } from '../navigation/routes';
|
|
23
23
|
import { updateProfileWithAvatar } from '../utils/avatarUtils';
|
|
24
|
+
import { surfaces } from '../navigation/surfaces';
|
|
24
25
|
import type { AvatarCropResult } from '../screens/AvatarCropScreen';
|
|
25
26
|
|
|
26
27
|
interface UseAvatarPickerOptions {
|
|
@@ -28,7 +29,6 @@ interface UseAvatarPickerOptions {
|
|
|
28
29
|
currentLanguage: string | null | undefined;
|
|
29
30
|
activeSessionId: string | null;
|
|
30
31
|
queryClient: QueryClient;
|
|
31
|
-
showBottomSheet: (config: { screen: RouteName; props?: Record<string, unknown> }) => void;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/** Upload result shape returned by oxyServices.assetUpload (single-file path). */
|
|
@@ -52,7 +52,6 @@ export function useAvatarPicker({
|
|
|
52
52
|
currentLanguage,
|
|
53
53
|
activeSessionId,
|
|
54
54
|
queryClient,
|
|
55
|
-
showBottomSheet,
|
|
56
55
|
}: UseAvatarPickerOptions) {
|
|
57
56
|
/**
|
|
58
57
|
* Final step: take the cropped JPEG, upload it as a new public file, then
|
|
@@ -99,68 +98,56 @@ export function useAvatarPicker({
|
|
|
99
98
|
[activeSessionId, currentLanguage, oxyServices, queryClient],
|
|
100
99
|
);
|
|
101
100
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
* failure surfaces a real user-facing error instead of a blank crop canvas.
|
|
112
|
-
* No variant is requested — cropping needs the original.
|
|
113
|
-
*/
|
|
114
|
-
const handleFilePicked = useCallback(
|
|
115
|
-
async (file: FileMetadata) => {
|
|
116
|
-
if (!file.contentType?.startsWith('image/')) {
|
|
117
|
-
toast.error(
|
|
118
|
-
translate(currentLanguage ?? undefined, 'editProfile.toasts.selectImage') ||
|
|
119
|
-
'Please select an image file',
|
|
120
|
-
);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
101
|
+
const openAvatarPicker = useCallback(async () => {
|
|
102
|
+
// 1. Present the image-only picker; it dismisses with the picked file when
|
|
103
|
+
// the user taps one, or `undefined` if they cancel.
|
|
104
|
+
const file = await surfaces.present('FileManagement', {
|
|
105
|
+
selectMode: true,
|
|
106
|
+
multiSelect: false,
|
|
107
|
+
disabledMimeTypes: ['video/', 'audio/', 'application/pdf'],
|
|
108
|
+
});
|
|
109
|
+
if (!file) return;
|
|
123
110
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
111
|
+
if (!file.contentType?.startsWith('image/')) {
|
|
112
|
+
toast.error(
|
|
113
|
+
translate(currentLanguage ?? undefined, 'editProfile.toasts.selectImage') ||
|
|
114
|
+
'Please select an image file',
|
|
115
|
+
);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// 2. Resolve a working source URL. The picked file is usually PRIVATE, so
|
|
120
|
+
// the synchronous `getFileDownloadUrl` (public CDN origin) would 404 and
|
|
121
|
+
// the crop screen's `Image.getSize` would fail silently. `assetGetUrl`
|
|
122
|
+
// throws on failure (unlike `getFileDownloadUrlAsync`, which swallows
|
|
123
|
+
// errors and falls back to the broken public URL), so a failure surfaces
|
|
124
|
+
// a real user-facing error instead of a blank crop canvas. No variant is
|
|
125
|
+
// requested — cropping needs the original.
|
|
126
|
+
let sourceUri: string;
|
|
127
|
+
try {
|
|
128
|
+
const resolved = await oxyServices.assetGetUrl(file.id);
|
|
129
|
+
if (!resolved?.url) {
|
|
130
|
+
throw new Error('No download URL returned for the selected image');
|
|
139
131
|
}
|
|
132
|
+
sourceUri = resolved.url;
|
|
133
|
+
} catch (e: unknown) {
|
|
134
|
+
const message = e instanceof Error ? e.message : undefined;
|
|
135
|
+
toast.error(
|
|
136
|
+
message ||
|
|
137
|
+
translate(currentLanguage ?? undefined, 'editProfile.toasts.cropMeasureFailed') ||
|
|
138
|
+
'Could not load the selected image',
|
|
139
|
+
);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
140
142
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
onConfirm: finalizeCroppedAvatar,
|
|
146
|
-
},
|
|
147
|
-
});
|
|
148
|
-
},
|
|
149
|
-
[currentLanguage, finalizeCroppedAvatar, oxyServices, showBottomSheet],
|
|
150
|
-
);
|
|
143
|
+
// 3. Present the square-crop editor in place of the picker; it dismisses
|
|
144
|
+
// with the cropped JPEG on confirm, or `undefined` if cancelled.
|
|
145
|
+
const cropped = await surfaces.present('AvatarCrop', { imageUri: sourceUri });
|
|
146
|
+
if (!cropped) return;
|
|
151
147
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
props: {
|
|
156
|
-
selectMode: true,
|
|
157
|
-
multiSelect: false,
|
|
158
|
-
disabledMimeTypes: ['video/', 'audio/', 'application/pdf'],
|
|
159
|
-
afterSelect: 'none',
|
|
160
|
-
onSelect: handleFilePicked,
|
|
161
|
-
},
|
|
162
|
-
});
|
|
163
|
-
}, [handleFilePicked, showBottomSheet]);
|
|
148
|
+
// 4. Upload + set as the user's avatar.
|
|
149
|
+
await finalizeCroppedAvatar(cropped);
|
|
150
|
+
}, [currentLanguage, finalizeCroppedAvatar, oxyServices]);
|
|
164
151
|
|
|
165
152
|
return { openAvatarPicker };
|
|
166
153
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createContext, useContext, useLayoutEffect } from 'react';
|
|
2
|
+
import type { DialogHeaderConfig } from '@oxyhq/bloom/dialog';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The header content a mounted surface screen contributes at runtime: its
|
|
6
|
+
* (translated) title/subtitle and optional slot nodes. Back/close affordances
|
|
7
|
+
* are owned by the surface host (`SurfaceScreen`) — a screen never wires them.
|
|
8
|
+
*
|
|
9
|
+
* A `right` slot is the canonical place for a screen-state action (e.g. a Save
|
|
10
|
+
* button whose disabled/loading state reflects the form). Slot nodes MUST be
|
|
11
|
+
* referentially stable (memoize them with `useMemo`) so the header does not
|
|
12
|
+
* thrash.
|
|
13
|
+
*/
|
|
14
|
+
export type SurfaceHeaderContent = Pick<
|
|
15
|
+
DialogHeaderConfig,
|
|
16
|
+
'title' | 'subtitle' | 'largeTitle' | 'left' | 'right' | 'onBack'
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
interface SurfaceHeaderContextValue {
|
|
20
|
+
setContent: (content: SurfaceHeaderContent | null) => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Provided by {@link ../components/SurfaceScreen}. Bridges a screen's runtime
|
|
25
|
+
* header contribution up to the host, which merges it with the back/close
|
|
26
|
+
* wiring and drives the Dialog's own nav header. `null` outside a surface (or in
|
|
27
|
+
* a headerless surface), so {@link useSurfaceHeader} is a safe no-op there.
|
|
28
|
+
*/
|
|
29
|
+
export const SurfaceHeaderContext = createContext<SurfaceHeaderContextValue | null>(null);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Declare the Dialog nav header's content from within a surface screen — its
|
|
33
|
+
* title/subtitle and any action slot. Merges over nothing (the host owns
|
|
34
|
+
* back/close), replaces on change, and clears on unmount. Call it unconditionally;
|
|
35
|
+
* it is a no-op outside a header-mode surface.
|
|
36
|
+
*/
|
|
37
|
+
export function useSurfaceHeader(content: SurfaceHeaderContent | null | undefined): void {
|
|
38
|
+
const ctx = useContext(SurfaceHeaderContext);
|
|
39
|
+
const set = ctx?.setContent;
|
|
40
|
+
// Set synchronously in the commit's layout phase so the bar/title fill in
|
|
41
|
+
// BEFORE the browser paints — no first-frame flash of an empty bar.
|
|
42
|
+
useLayoutEffect(() => {
|
|
43
|
+
if (!set) return;
|
|
44
|
+
set(content ?? null);
|
|
45
|
+
return () => set(null);
|
|
46
|
+
// Slot nodes (`left`/`right`) are compared by identity; callers memoize them.
|
|
47
|
+
}, [
|
|
48
|
+
set,
|
|
49
|
+
content?.title,
|
|
50
|
+
content?.subtitle,
|
|
51
|
+
content?.largeTitle,
|
|
52
|
+
content?.left,
|
|
53
|
+
content?.right,
|
|
54
|
+
content?.onBack,
|
|
55
|
+
]);
|
|
56
|
+
}
|
|
@@ -32,7 +32,7 @@ const EMPTY_SNAPSHOT: AccountDialogSnapshot = {
|
|
|
32
32
|
* real per-account name / email / avatar / color.
|
|
33
33
|
*
|
|
34
34
|
* This is a thin binding over the shared `AccountDialogController` in
|
|
35
|
-
* `@oxyhq/core` (the SAME headless source the {@link
|
|
35
|
+
* `@oxyhq/core` (the SAME headless source the {@link OxyAccountDialogScreen} renders),
|
|
36
36
|
* so there is ONE projection (`projectSwitchableAccounts`) and one switch path
|
|
37
37
|
* (`controller.switchTo`) across the whole SDK — the local duplicate projection
|
|
38
38
|
* this hook used to own has been removed. Every switch routes through
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { getSurfaceConfig, getSurfacePresentation } from '../surfaceRegistry';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `getSurfaceConfig` resolves which Bloom surface a route is presented in. The
|
|
5
|
+
* flagship image picker (FileManagement in image-only select mode) upgrades to a
|
|
6
|
+
* full-bleed `'fullScreen'` surface that owns its own scrolling; every other
|
|
7
|
+
* route stays on the responsive `'sheet'`. These guard the routing contract.
|
|
8
|
+
*/
|
|
9
|
+
describe('getSurfaceConfig presentation', () => {
|
|
10
|
+
const imageOnlyPickerProps = {
|
|
11
|
+
selectMode: true,
|
|
12
|
+
disabledMimeTypes: ['video/', 'audio/', 'application/pdf'],
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
it('defaults every route to the responsive sheet', () => {
|
|
16
|
+
expect(getSurfaceConfig('ManageAccount', {}).presentation).toBe('sheet');
|
|
17
|
+
expect(getSurfaceConfig('AvatarCrop', {}).presentation).toBe('sheet');
|
|
18
|
+
expect(getSurfacePresentation('ManageAccount', {})).toBe('sheet');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('routes the FileManagement image-only picker to a full-screen surface', () => {
|
|
22
|
+
const config = getSurfaceConfig('FileManagement', imageOnlyPickerProps);
|
|
23
|
+
expect(config.presentation).toBe('fullScreen');
|
|
24
|
+
// The full-bleed picker owns its own FlatList → the host must not wrap it.
|
|
25
|
+
expect(config.scrollable).toBe(false);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('keeps FileManagement on the sheet when it is not an image-only picker', () => {
|
|
29
|
+
// Browse mode (no selectMode) — the standard file manager.
|
|
30
|
+
expect(getSurfaceConfig('FileManagement', {}).presentation).toBe('sheet');
|
|
31
|
+
// Select mode that still allows non-image types is not the flagship picker.
|
|
32
|
+
expect(
|
|
33
|
+
getSurfaceConfig('FileManagement', {
|
|
34
|
+
selectMode: true,
|
|
35
|
+
disabledMimeTypes: ['video/'],
|
|
36
|
+
}).presentation,
|
|
37
|
+
).toBe('sheet');
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { createSurfaceNavStack } from '../surfaceNavStack';
|
|
2
|
+
import { __resetSurfaceBackBridgeForTests, pushSurfaceBackHandler, __invokeTopSurfaceBackForTests } from '../surfaceBackBridge';
|
|
3
|
+
|
|
4
|
+
describe('createSurfaceNavStack', () => {
|
|
5
|
+
it('starts with a single root frame', () => {
|
|
6
|
+
const stack = createSurfaceNavStack('ManageAccount', { foo: 1 });
|
|
7
|
+
expect(stack.getTop().route).toBe('ManageAccount');
|
|
8
|
+
expect(stack.getTop().props).toEqual({ foo: 1 });
|
|
9
|
+
expect(stack.canGoBack()).toBe(false);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('navigate pushes frames and goBack pops them', () => {
|
|
13
|
+
const stack = createSurfaceNavStack('ManageAccount');
|
|
14
|
+
stack.navigate('EditProfile', { userId: 'u1' });
|
|
15
|
+
expect(stack.getTop().route).toBe('EditProfile');
|
|
16
|
+
expect(stack.canGoBack()).toBe(true);
|
|
17
|
+
expect(stack.goBack()).toBe(true);
|
|
18
|
+
expect(stack.getTop().route).toBe('ManageAccount');
|
|
19
|
+
expect(stack.goBack()).toBe(false);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('replace swaps the top frame without growing history', () => {
|
|
23
|
+
const stack = createSurfaceNavStack('ManageAccount');
|
|
24
|
+
stack.navigate('EditProfile');
|
|
25
|
+
stack.replace('PrivacySettings');
|
|
26
|
+
expect(stack.getTop().route).toBe('PrivacySettings');
|
|
27
|
+
expect(stack.goBack()).toBe(true);
|
|
28
|
+
expect(stack.getTop().route).toBe('ManageAccount');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('tracks wizard steps on the current frame', () => {
|
|
32
|
+
const stack = createSurfaceNavStack('EditProfile', { initialStep: 2 });
|
|
33
|
+
expect(stack.getTop().step).toBe(2);
|
|
34
|
+
expect(stack.canGoBack()).toBe(true);
|
|
35
|
+
stack.setStep(1);
|
|
36
|
+
expect(stack.getTop().step).toBe(1);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('requestDismiss flips closing once', () => {
|
|
40
|
+
const stack = createSurfaceNavStack('ManageAccount');
|
|
41
|
+
stack.requestDismiss('done');
|
|
42
|
+
expect(stack.store.getState().closing).toBe(true);
|
|
43
|
+
expect(stack.store.getState().closeResult).toBe('done');
|
|
44
|
+
stack.requestDismiss('again');
|
|
45
|
+
expect(stack.store.getState().closeResult).toBe('done');
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
describe('pushSurfaceBackHandler', () => {
|
|
50
|
+
afterEach(() => {
|
|
51
|
+
__resetSurfaceBackBridgeForTests();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('delegates to the topmost handler', () => {
|
|
55
|
+
const calls: string[] = [];
|
|
56
|
+
pushSurfaceBackHandler(() => {
|
|
57
|
+
calls.push('bottom');
|
|
58
|
+
return true;
|
|
59
|
+
});
|
|
60
|
+
pushSurfaceBackHandler(() => {
|
|
61
|
+
calls.push('top');
|
|
62
|
+
return true;
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
expect(__invokeTopSurfaceBackForTests()).toBe(true);
|
|
66
|
+
expect(calls).toEqual(['top']);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Imperative
|
|
2
|
+
* Imperative, outside-React entry points for the unified `OxyAccountDialogScreen`.
|
|
3
|
+
*
|
|
4
|
+
* These delegate to the live handles the mounted `OxyProvider` registers via
|
|
5
|
+
* {@link registerAccountDialogControls}. Under the hood `open`/`close` present
|
|
6
|
+
* and dismiss the `AccountDialog` surface on the shared Bloom surface stack
|
|
7
|
+
* (`OxyContext.openAccountDialog` → `presentDetached('AccountDialog', …)`), so
|
|
8
|
+
* whether the dialog is open is owned by that stack — this module is only the
|
|
9
|
+
* thin bridge that reaches the provider's controller (which sets the dialog
|
|
10
|
+
* view) from a non-React call site.
|
|
3
11
|
*/
|
|
4
12
|
|
|
5
13
|
import type { AccountDialogView } from '@oxyhq/core';
|
|
6
14
|
|
|
7
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Live open/close handles registered by the mounted provider. `open` presents
|
|
17
|
+
* the `AccountDialog` surface (and points its view); `close` dismisses it. Both
|
|
18
|
+
* are stack operations — this interface never carries visibility state.
|
|
19
|
+
*/
|
|
8
20
|
export interface AccountDialogControls {
|
|
9
21
|
open: (view?: AccountDialogView) => void;
|
|
10
22
|
close: () => void;
|
|
@@ -1,88 +1,61 @@
|
|
|
1
1
|
import type { RouteName } from './routes';
|
|
2
2
|
import { isValidRoute } from './routes';
|
|
3
|
-
import {
|
|
3
|
+
import { getSurfacePresentation } from './surfaceRegistry';
|
|
4
|
+
import { closeAllRouteSurfaces, presentRoute, topRouteSurface } from './surfaces';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
|
-
* Bottom
|
|
7
|
+
* Bottom-sheet manager — the INTERNAL adapter that keeps the historical
|
|
8
|
+
* `showBottomSheet` / `closeBottomSheet` API working on top of the new Bloom
|
|
9
|
+
* surface stack (`navigation/surfaces.ts`). The public signatures are unchanged;
|
|
10
|
+
* this file just re-expresses them as thin calls into the typed surface layer.
|
|
11
|
+
*
|
|
12
|
+
* The old single-surface store is gone: `showBottomSheet` now open-or-navigates
|
|
13
|
+
* the "base" (top-most) route surface, and cross-presentation targets (the
|
|
14
|
+
* full-bleed image picker) stack a NEW surface on top — Bloom coordinates the
|
|
15
|
+
* z-order / backdrop / dismiss so nothing clashes.
|
|
7
16
|
*/
|
|
8
17
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
currentScreen: null,
|
|
20
|
-
screenProps: {},
|
|
21
|
-
currentStep: undefined,
|
|
22
|
-
history: [],
|
|
23
|
-
isOpen: false,
|
|
24
|
-
fullScreen: false,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const bottomSheetStore = createStore<BottomSheetState>(() => initialState);
|
|
28
|
-
|
|
29
|
-
export const getState = () => bottomSheetStore.getState();
|
|
30
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Open a bottom-sheet route. If the top-most active surface hosts the SAME
|
|
20
|
+
* presentation (the common all-sheets case) the route is drilled into it; a route
|
|
21
|
+
* with a different presentation (the image picker's full-bleed surface) is
|
|
22
|
+
* presented as a NEW surface on top. Opening with no active surface presents the
|
|
23
|
+
* first one.
|
|
24
|
+
*
|
|
25
|
+
* `fullScreen` is accepted for signature compatibility and ignored — a route's
|
|
26
|
+
* surface is now derived from its registry config, not a per-call flag.
|
|
27
|
+
*/
|
|
31
28
|
export const showBottomSheet = (
|
|
32
|
-
|
|
29
|
+
screenOrConfig:
|
|
30
|
+
| RouteName
|
|
31
|
+
| { screen: RouteName; props?: Record<string, unknown>; fullScreen?: boolean },
|
|
33
32
|
): void => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
history: [...state.history, {
|
|
49
|
-
screen: state.currentScreen,
|
|
50
|
-
props: state.screenProps,
|
|
51
|
-
step: state.currentStep,
|
|
52
|
-
}],
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
bottomSheetStore.setState({
|
|
57
|
-
currentScreen: screen,
|
|
58
|
-
screenProps: props,
|
|
59
|
-
currentStep: typeof props.initialStep === 'number' ? props.initialStep : undefined,
|
|
60
|
-
isOpen: true,
|
|
61
|
-
fullScreen,
|
|
62
|
-
});
|
|
33
|
+
const screen = typeof screenOrConfig === 'string' ? screenOrConfig : screenOrConfig.screen;
|
|
34
|
+
const props = typeof screenOrConfig === 'string' ? {} : screenOrConfig.props ?? {};
|
|
35
|
+
|
|
36
|
+
if (!isValidRoute(screen)) {
|
|
37
|
+
if (__DEV__) console.warn(`[BottomSheet] Invalid route: ${screen}`);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const top = topRouteSurface();
|
|
42
|
+
if (top && top.presentation === getSurfacePresentation(screen, props)) {
|
|
43
|
+
top.navigate(screen, props);
|
|
44
|
+
} else {
|
|
45
|
+
presentRoute(screen, props);
|
|
46
|
+
}
|
|
63
47
|
};
|
|
64
48
|
|
|
49
|
+
/** Dismiss the whole bottom-sheet session (every active route surface). */
|
|
65
50
|
export const closeBottomSheet = (): void => {
|
|
66
|
-
|
|
51
|
+
closeAllRouteSurfaces();
|
|
67
52
|
};
|
|
68
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Step back within the top-most surface's route history. Returns `true` when a
|
|
56
|
+
* frame was popped, `false` when the surface is already at its root frame.
|
|
57
|
+
*/
|
|
69
58
|
export const goBack = (): boolean => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (history.length > 0) {
|
|
73
|
-
const prev = history[history.length - 1];
|
|
74
|
-
bottomSheetStore.setState({
|
|
75
|
-
currentScreen: prev.screen,
|
|
76
|
-
screenProps: prev.props,
|
|
77
|
-
currentStep: prev.step,
|
|
78
|
-
history: history.slice(0, -1),
|
|
79
|
-
});
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return false;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export const updateState = (updates: Partial<BottomSheetState>) => {
|
|
87
|
-
bottomSheetStore.setState((state) => ({ ...state, ...updates }));
|
|
59
|
+
const top = topRouteSurface();
|
|
60
|
+
return top ? top.goBack() : false;
|
|
88
61
|
};
|