@oxyhq/services 22.9.0 → 22.11.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.
Files changed (584) hide show
  1. package/lib/commonjs/index.js +24 -5
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/ui/components/AvatarCameraBadge.js +42 -0
  4. package/lib/commonjs/ui/components/AvatarCameraBadge.js.map +1 -0
  5. package/lib/commonjs/ui/components/{OxyAccountDialog.js → OxyAccountDialogScreen.js} +55 -133
  6. package/lib/commonjs/ui/components/OxyAccountDialogScreen.js.map +1 -0
  7. package/lib/commonjs/ui/components/OxyAuthChooser.js +657 -88
  8. package/lib/commonjs/ui/components/OxyAuthChooser.js.map +1 -1
  9. package/lib/commonjs/ui/components/OxyConsentScreen.js +1 -1
  10. package/lib/commonjs/ui/components/ProfileButton.js +15 -1
  11. package/lib/commonjs/ui/components/ProfileButton.js.map +1 -1
  12. package/lib/commonjs/ui/components/ProfileSummaryCard.js +3 -23
  13. package/lib/commonjs/ui/components/ProfileSummaryCard.js.map +1 -1
  14. package/lib/commonjs/ui/components/RequireOxyAuth.js +1 -1
  15. package/lib/commonjs/ui/components/SurfaceHeaderAction.js +63 -0
  16. package/lib/commonjs/ui/components/SurfaceHeaderAction.js.map +1 -0
  17. package/lib/commonjs/ui/components/SurfaceScreen.js +91 -8
  18. package/lib/commonjs/ui/components/SurfaceScreen.js.map +1 -1
  19. package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js +46 -29
  20. package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
  21. package/lib/commonjs/ui/components/modals/DeleteAccountModal.js +47 -23
  22. package/lib/commonjs/ui/components/modals/DeleteAccountModal.js.map +1 -1
  23. package/lib/commonjs/ui/components/oxyAuthChooserStyles.js +81 -19
  24. package/lib/commonjs/ui/components/oxyAuthChooserStyles.js.map +1 -1
  25. package/lib/commonjs/ui/components/photogrid/JustifiedPhotoGrid.js +83 -23
  26. package/lib/commonjs/ui/components/photogrid/JustifiedPhotoGrid.js.map +1 -1
  27. package/lib/commonjs/ui/components/surfaces/ActionSheetSurface.js +83 -0
  28. package/lib/commonjs/ui/components/surfaces/ActionSheetSurface.js.map +1 -0
  29. package/lib/commonjs/ui/context/OxyContext.js +79 -29
  30. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  31. package/lib/commonjs/ui/hooks/queries/queryKeys.js +18 -1
  32. package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
  33. package/lib/commonjs/ui/hooks/queries/useFileQueries.js +129 -0
  34. package/lib/commonjs/ui/hooks/queries/useFileQueries.js.map +1 -0
  35. package/lib/commonjs/ui/hooks/useAvatarPicker.js +38 -55
  36. package/lib/commonjs/ui/hooks/useAvatarPicker.js.map +1 -1
  37. package/lib/commonjs/ui/hooks/useReduceMotion.js +57 -0
  38. package/lib/commonjs/ui/hooks/useReduceMotion.js.map +1 -0
  39. package/lib/commonjs/ui/hooks/useSurfaceHeader.js +46 -0
  40. package/lib/commonjs/ui/hooks/useSurfaceHeader.js.map +1 -0
  41. package/lib/commonjs/ui/hooks/useSwitchableAccounts.js +1 -1
  42. package/lib/commonjs/ui/navigation/accountDialogManager.js +36 -2
  43. package/lib/commonjs/ui/navigation/accountDialogManager.js.map +1 -1
  44. package/lib/commonjs/ui/navigation/bottomSheetManager.js +5 -6
  45. package/lib/commonjs/ui/navigation/bottomSheetManager.js.map +1 -1
  46. package/lib/commonjs/ui/navigation/routes.js +4 -3
  47. package/lib/commonjs/ui/navigation/routes.js.map +1 -1
  48. package/lib/commonjs/ui/navigation/surfaceBackBridge.js +68 -0
  49. package/lib/commonjs/ui/navigation/surfaceBackBridge.js.map +1 -0
  50. package/lib/commonjs/ui/navigation/surfaceNavStack.js +62 -15
  51. package/lib/commonjs/ui/navigation/surfaceNavStack.js.map +1 -1
  52. package/lib/commonjs/ui/navigation/surfaceRegistry.js +84 -19
  53. package/lib/commonjs/ui/navigation/surfaceRegistry.js.map +1 -1
  54. package/lib/commonjs/ui/navigation/surfaces.js +139 -25
  55. package/lib/commonjs/ui/navigation/surfaces.js.map +1 -1
  56. package/lib/commonjs/ui/screens/AccountMembersScreen.js +214 -283
  57. package/lib/commonjs/ui/screens/AccountMembersScreen.js.map +1 -1
  58. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +88 -118
  59. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  60. package/lib/commonjs/ui/screens/AccountVerificationScreen.js +22 -36
  61. package/lib/commonjs/ui/screens/AccountVerificationScreen.js.map +1 -1
  62. package/lib/commonjs/ui/screens/AppInfoScreen.js +219 -226
  63. package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
  64. package/lib/commonjs/ui/screens/AvatarCropScreen.js +287 -289
  65. package/lib/commonjs/ui/screens/AvatarCropScreen.js.map +1 -1
  66. package/lib/commonjs/ui/screens/ChangeAvatarScreen.js +301 -0
  67. package/lib/commonjs/ui/screens/ChangeAvatarScreen.js.map +1 -0
  68. package/lib/commonjs/ui/screens/ConnectedAppsScreen.js +24 -39
  69. package/lib/commonjs/ui/screens/ConnectedAppsScreen.js.map +1 -1
  70. package/lib/commonjs/ui/screens/CreateAccountScreen.js +136 -158
  71. package/lib/commonjs/ui/screens/CreateAccountScreen.js.map +1 -1
  72. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +29 -36
  73. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
  74. package/lib/commonjs/ui/screens/EditProfileScreen.js +101 -109
  75. package/lib/commonjs/ui/screens/EditProfileScreen.js.map +1 -1
  76. package/lib/commonjs/ui/screens/FAQScreen.js +10 -15
  77. package/lib/commonjs/ui/screens/FAQScreen.js.map +1 -1
  78. package/lib/commonjs/ui/screens/FeedbackScreen.js +8 -16
  79. package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
  80. package/lib/commonjs/ui/screens/FileManagementScreen.js +403 -627
  81. package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
  82. package/lib/commonjs/ui/screens/HelpSupportScreen.js +62 -69
  83. package/lib/commonjs/ui/screens/HelpSupportScreen.js.map +1 -1
  84. package/lib/commonjs/ui/screens/HistoryViewScreen.js +63 -79
  85. package/lib/commonjs/ui/screens/HistoryViewScreen.js.map +1 -1
  86. package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +69 -98
  87. package/lib/commonjs/ui/screens/LanguageSelectorScreen.js.map +1 -1
  88. package/lib/commonjs/ui/screens/LearnMoreUsernamesScreen.js +8 -14
  89. package/lib/commonjs/ui/screens/LearnMoreUsernamesScreen.js.map +1 -1
  90. package/lib/commonjs/ui/screens/LegalDocumentsScreen.js +77 -94
  91. package/lib/commonjs/ui/screens/LegalDocumentsScreen.js.map +1 -1
  92. package/lib/commonjs/ui/screens/ManageAccountScreen.js +99 -134
  93. package/lib/commonjs/ui/screens/ManageAccountScreen.js.map +1 -1
  94. package/lib/commonjs/ui/screens/NotificationsScreen.js +69 -76
  95. package/lib/commonjs/ui/screens/NotificationsScreen.js.map +1 -1
  96. package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +3 -8
  97. package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -1
  98. package/lib/commonjs/ui/screens/PreferencesScreen.js +67 -74
  99. package/lib/commonjs/ui/screens/PreferencesScreen.js.map +1 -1
  100. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +55 -91
  101. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  102. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +291 -304
  103. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
  104. package/lib/commonjs/ui/screens/ProfileScreen.js +100 -114
  105. package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
  106. package/lib/commonjs/ui/screens/SavesCollectionsScreen.js +38 -45
  107. package/lib/commonjs/ui/screens/SavesCollectionsScreen.js.map +1 -1
  108. package/lib/commonjs/ui/screens/SearchSettingsScreen.js +44 -57
  109. package/lib/commonjs/ui/screens/SearchSettingsScreen.js.map +1 -1
  110. package/lib/commonjs/ui/screens/UserLinksScreen.js +24 -31
  111. package/lib/commonjs/ui/screens/UserLinksScreen.js.map +1 -1
  112. package/lib/commonjs/ui/screens/UserListScreen.js +14 -24
  113. package/lib/commonjs/ui/screens/UserListScreen.js.map +1 -1
  114. package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js +16 -48
  115. package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js.map +1 -1
  116. package/lib/commonjs/ui/screens/fileManagement/FileLibraryError.js +63 -0
  117. package/lib/commonjs/ui/screens/fileManagement/FileLibraryError.js.map +1 -0
  118. package/lib/commonjs/ui/screens/fileManagement/PhotoPickerSection.js +54 -41
  119. package/lib/commonjs/ui/screens/fileManagement/PhotoPickerSection.js.map +1 -1
  120. package/lib/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.js +44 -81
  121. package/lib/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.js.map +1 -1
  122. package/lib/commonjs/ui/screens/trust/TrustAboutScreen.js +66 -75
  123. package/lib/commonjs/ui/screens/trust/TrustAboutScreen.js.map +1 -1
  124. package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js +111 -139
  125. package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js.map +1 -1
  126. package/lib/commonjs/ui/screens/trust/TrustFAQScreen.js +13 -20
  127. package/lib/commonjs/ui/screens/trust/TrustFAQScreen.js.map +1 -1
  128. package/lib/commonjs/ui/screens/trust/TrustLeaderboardScreen.js +14 -27
  129. package/lib/commonjs/ui/screens/trust/TrustLeaderboardScreen.js.map +1 -1
  130. package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js +68 -85
  131. package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js.map +1 -1
  132. package/lib/commonjs/ui/screens/trust/TrustRulesScreen.js +28 -36
  133. package/lib/commonjs/ui/screens/trust/TrustRulesScreen.js.map +1 -1
  134. package/lib/commonjs/ui/stores/resetSessionScopedStores.js +8 -3
  135. package/lib/commonjs/ui/stores/resetSessionScopedStores.js.map +1 -1
  136. package/lib/commonjs/ui/utils/avatarUtils.js +11 -2
  137. package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
  138. package/lib/commonjs/ui/utils/fileManagement.js +0 -79
  139. package/lib/commonjs/ui/utils/fileManagement.js.map +1 -1
  140. package/lib/module/index.js +12 -5
  141. package/lib/module/index.js.map +1 -1
  142. package/lib/module/ui/components/AvatarCameraBadge.js +40 -0
  143. package/lib/module/ui/components/AvatarCameraBadge.js.map +1 -0
  144. package/lib/module/ui/components/{OxyAccountDialog.js → OxyAccountDialogScreen.js} +57 -135
  145. package/lib/module/ui/components/OxyAccountDialogScreen.js.map +1 -0
  146. package/lib/module/ui/components/OxyAuthChooser.js +659 -91
  147. package/lib/module/ui/components/OxyAuthChooser.js.map +1 -1
  148. package/lib/module/ui/components/OxyConsentScreen.js +1 -1
  149. package/lib/module/ui/components/ProfileButton.js +16 -2
  150. package/lib/module/ui/components/ProfileButton.js.map +1 -1
  151. package/lib/module/ui/components/ProfileSummaryCard.js +2 -23
  152. package/lib/module/ui/components/ProfileSummaryCard.js.map +1 -1
  153. package/lib/module/ui/components/RequireOxyAuth.js +1 -1
  154. package/lib/module/ui/components/SurfaceHeaderAction.js +58 -0
  155. package/lib/module/ui/components/SurfaceHeaderAction.js.map +1 -0
  156. package/lib/module/ui/components/SurfaceScreen.js +93 -10
  157. package/lib/module/ui/components/SurfaceScreen.js.map +1 -1
  158. package/lib/module/ui/components/fileManagement/FileDetailsModal.js +46 -29
  159. package/lib/module/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
  160. package/lib/module/ui/components/modals/DeleteAccountModal.js +46 -23
  161. package/lib/module/ui/components/modals/DeleteAccountModal.js.map +1 -1
  162. package/lib/module/ui/components/oxyAuthChooserStyles.js +81 -19
  163. package/lib/module/ui/components/oxyAuthChooserStyles.js.map +1 -1
  164. package/lib/module/ui/components/photogrid/JustifiedPhotoGrid.js +83 -25
  165. package/lib/module/ui/components/photogrid/JustifiedPhotoGrid.js.map +1 -1
  166. package/lib/module/ui/components/surfaces/ActionSheetSurface.js +78 -0
  167. package/lib/module/ui/components/surfaces/ActionSheetSurface.js.map +1 -0
  168. package/lib/module/ui/context/OxyContext.js +80 -30
  169. package/lib/module/ui/context/OxyContext.js.map +1 -1
  170. package/lib/module/ui/hooks/queries/queryKeys.js +16 -0
  171. package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
  172. package/lib/module/ui/hooks/queries/useFileQueries.js +120 -0
  173. package/lib/module/ui/hooks/queries/useFileQueries.js.map +1 -0
  174. package/lib/module/ui/hooks/useAvatarPicker.js +38 -55
  175. package/lib/module/ui/hooks/useAvatarPicker.js.map +1 -1
  176. package/lib/module/ui/hooks/useReduceMotion.js +53 -0
  177. package/lib/module/ui/hooks/useReduceMotion.js.map +1 -0
  178. package/lib/module/ui/hooks/useSurfaceHeader.js +42 -0
  179. package/lib/module/ui/hooks/useSurfaceHeader.js.map +1 -0
  180. package/lib/module/ui/hooks/useSwitchableAccounts.js +1 -1
  181. package/lib/module/ui/navigation/accountDialogManager.js +34 -2
  182. package/lib/module/ui/navigation/accountDialogManager.js.map +1 -1
  183. package/lib/module/ui/navigation/bottomSheetManager.js +6 -7
  184. package/lib/module/ui/navigation/bottomSheetManager.js.map +1 -1
  185. package/lib/module/ui/navigation/routes.js +4 -3
  186. package/lib/module/ui/navigation/routes.js.map +1 -1
  187. package/lib/module/ui/navigation/surfaceBackBridge.js +63 -0
  188. package/lib/module/ui/navigation/surfaceBackBridge.js.map +1 -0
  189. package/lib/module/ui/navigation/surfaceNavStack.js +62 -15
  190. package/lib/module/ui/navigation/surfaceNavStack.js.map +1 -1
  191. package/lib/module/ui/navigation/surfaceRegistry.js +84 -19
  192. package/lib/module/ui/navigation/surfaceRegistry.js.map +1 -1
  193. package/lib/module/ui/navigation/surfaces.js +138 -26
  194. package/lib/module/ui/navigation/surfaces.js.map +1 -1
  195. package/lib/module/ui/screens/AccountMembersScreen.js +218 -286
  196. package/lib/module/ui/screens/AccountMembersScreen.js.map +1 -1
  197. package/lib/module/ui/screens/AccountSettingsScreen.js +92 -121
  198. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  199. package/lib/module/ui/screens/AccountVerificationScreen.js +25 -38
  200. package/lib/module/ui/screens/AccountVerificationScreen.js.map +1 -1
  201. package/lib/module/ui/screens/AppInfoScreen.js +220 -227
  202. package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
  203. package/lib/module/ui/screens/AvatarCropScreen.js +289 -291
  204. package/lib/module/ui/screens/AvatarCropScreen.js.map +1 -1
  205. package/lib/module/ui/screens/ChangeAvatarScreen.js +298 -0
  206. package/lib/module/ui/screens/ChangeAvatarScreen.js.map +1 -0
  207. package/lib/module/ui/screens/ConnectedAppsScreen.js +26 -40
  208. package/lib/module/ui/screens/ConnectedAppsScreen.js.map +1 -1
  209. package/lib/module/ui/screens/CreateAccountScreen.js +139 -160
  210. package/lib/module/ui/screens/CreateAccountScreen.js.map +1 -1
  211. package/lib/module/ui/screens/EditProfileFieldScreen.js +32 -38
  212. package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
  213. package/lib/module/ui/screens/EditProfileScreen.js +102 -110
  214. package/lib/module/ui/screens/EditProfileScreen.js.map +1 -1
  215. package/lib/module/ui/screens/FAQScreen.js +11 -15
  216. package/lib/module/ui/screens/FAQScreen.js.map +1 -1
  217. package/lib/module/ui/screens/FeedbackScreen.js +10 -17
  218. package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
  219. package/lib/module/ui/screens/FileManagementScreen.js +408 -631
  220. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  221. package/lib/module/ui/screens/HelpSupportScreen.js +64 -70
  222. package/lib/module/ui/screens/HelpSupportScreen.js.map +1 -1
  223. package/lib/module/ui/screens/HistoryViewScreen.js +65 -81
  224. package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
  225. package/lib/module/ui/screens/LanguageSelectorScreen.js +71 -99
  226. package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -1
  227. package/lib/module/ui/screens/LearnMoreUsernamesScreen.js +10 -15
  228. package/lib/module/ui/screens/LearnMoreUsernamesScreen.js.map +1 -1
  229. package/lib/module/ui/screens/LegalDocumentsScreen.js +78 -94
  230. package/lib/module/ui/screens/LegalDocumentsScreen.js.map +1 -1
  231. package/lib/module/ui/screens/ManageAccountScreen.js +102 -137
  232. package/lib/module/ui/screens/ManageAccountScreen.js.map +1 -1
  233. package/lib/module/ui/screens/NotificationsScreen.js +71 -77
  234. package/lib/module/ui/screens/NotificationsScreen.js.map +1 -1
  235. package/lib/module/ui/screens/PaymentGatewayScreen.js +4 -9
  236. package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -1
  237. package/lib/module/ui/screens/PreferencesScreen.js +69 -75
  238. package/lib/module/ui/screens/PreferencesScreen.js.map +1 -1
  239. package/lib/module/ui/screens/PremiumSubscriptionScreen.js +58 -93
  240. package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  241. package/lib/module/ui/screens/PrivacySettingsScreen.js +293 -305
  242. package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
  243. package/lib/module/ui/screens/ProfileScreen.js +102 -116
  244. package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
  245. package/lib/module/ui/screens/SavesCollectionsScreen.js +40 -46
  246. package/lib/module/ui/screens/SavesCollectionsScreen.js.map +1 -1
  247. package/lib/module/ui/screens/SearchSettingsScreen.js +46 -58
  248. package/lib/module/ui/screens/SearchSettingsScreen.js.map +1 -1
  249. package/lib/module/ui/screens/UserLinksScreen.js +26 -32
  250. package/lib/module/ui/screens/UserLinksScreen.js.map +1 -1
  251. package/lib/module/ui/screens/UserListScreen.js +14 -24
  252. package/lib/module/ui/screens/UserListScreen.js.map +1 -1
  253. package/lib/module/ui/screens/WelcomeNewUserScreen.js +17 -49
  254. package/lib/module/ui/screens/WelcomeNewUserScreen.js.map +1 -1
  255. package/lib/module/ui/screens/fileManagement/FileLibraryError.js +59 -0
  256. package/lib/module/ui/screens/fileManagement/FileLibraryError.js.map +1 -0
  257. package/lib/module/ui/screens/fileManagement/PhotoPickerSection.js +54 -42
  258. package/lib/module/ui/screens/fileManagement/PhotoPickerSection.js.map +1 -1
  259. package/lib/module/ui/screens/fileManagement/hooks/useFileUploadState.js +45 -81
  260. package/lib/module/ui/screens/fileManagement/hooks/useFileUploadState.js.map +1 -1
  261. package/lib/module/ui/screens/trust/TrustAboutScreen.js +67 -75
  262. package/lib/module/ui/screens/trust/TrustAboutScreen.js.map +1 -1
  263. package/lib/module/ui/screens/trust/TrustCenterScreen.js +112 -139
  264. package/lib/module/ui/screens/trust/TrustCenterScreen.js.map +1 -1
  265. package/lib/module/ui/screens/trust/TrustFAQScreen.js +15 -21
  266. package/lib/module/ui/screens/trust/TrustFAQScreen.js.map +1 -1
  267. package/lib/module/ui/screens/trust/TrustLeaderboardScreen.js +14 -26
  268. package/lib/module/ui/screens/trust/TrustLeaderboardScreen.js.map +1 -1
  269. package/lib/module/ui/screens/trust/TrustRewardsScreen.js +69 -85
  270. package/lib/module/ui/screens/trust/TrustRewardsScreen.js.map +1 -1
  271. package/lib/module/ui/screens/trust/TrustRulesScreen.js +30 -37
  272. package/lib/module/ui/screens/trust/TrustRulesScreen.js.map +1 -1
  273. package/lib/module/ui/stores/resetSessionScopedStores.js +8 -3
  274. package/lib/module/ui/stores/resetSessionScopedStores.js.map +1 -1
  275. package/lib/module/ui/utils/avatarUtils.js +11 -2
  276. package/lib/module/ui/utils/avatarUtils.js.map +1 -1
  277. package/lib/module/ui/utils/fileManagement.js +0 -78
  278. package/lib/module/ui/utils/fileManagement.js.map +1 -1
  279. package/lib/typescript/commonjs/index.d.ts +2 -0
  280. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  281. package/lib/typescript/commonjs/ui/components/AvatarCameraBadge.d.ts +4 -0
  282. package/lib/typescript/commonjs/ui/components/AvatarCameraBadge.d.ts.map +1 -0
  283. package/lib/typescript/{module/ui/components/OxyAccountDialog.d.ts → commonjs/ui/components/OxyAccountDialogScreen.d.ts} +5 -4
  284. package/lib/typescript/commonjs/ui/components/OxyAccountDialogScreen.d.ts.map +1 -0
  285. package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts +3 -3
  286. package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts.map +1 -1
  287. package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts +2 -2
  288. package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts.map +1 -1
  289. package/lib/typescript/commonjs/ui/components/ProfileSummaryCard.d.ts.map +1 -1
  290. package/lib/typescript/commonjs/ui/components/RequireOxyAuth.d.ts +1 -1
  291. package/lib/typescript/commonjs/ui/components/SurfaceHeaderAction.d.ts +16 -0
  292. package/lib/typescript/commonjs/ui/components/SurfaceHeaderAction.d.ts.map +1 -0
  293. package/lib/typescript/commonjs/ui/components/SurfaceScreen.d.ts +3 -4
  294. package/lib/typescript/commonjs/ui/components/SurfaceScreen.d.ts.map +1 -1
  295. package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts +14 -4
  296. package/lib/typescript/commonjs/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
  297. package/lib/typescript/commonjs/ui/components/modals/DeleteAccountModal.d.ts +17 -2
  298. package/lib/typescript/commonjs/ui/components/modals/DeleteAccountModal.d.ts.map +1 -1
  299. package/lib/typescript/commonjs/ui/components/oxyAuthChooserStyles.d.ts +75 -13
  300. package/lib/typescript/commonjs/ui/components/oxyAuthChooserStyles.d.ts.map +1 -1
  301. package/lib/typescript/commonjs/ui/components/photogrid/JustifiedPhotoGrid.d.ts +10 -8
  302. package/lib/typescript/commonjs/ui/components/photogrid/JustifiedPhotoGrid.d.ts.map +1 -1
  303. package/lib/typescript/commonjs/ui/components/surfaces/ActionSheetSurface.d.ts +38 -0
  304. package/lib/typescript/commonjs/ui/components/surfaces/ActionSheetSurface.d.ts.map +1 -0
  305. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  306. package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts +9 -0
  307. package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts.map +1 -1
  308. package/lib/typescript/commonjs/ui/hooks/queries/useFileQueries.d.ts +50 -0
  309. package/lib/typescript/commonjs/ui/hooks/queries/useFileQueries.d.ts.map +1 -0
  310. package/lib/typescript/commonjs/ui/hooks/useAvatarPicker.d.ts +17 -16
  311. package/lib/typescript/commonjs/ui/hooks/useAvatarPicker.d.ts.map +1 -1
  312. package/lib/typescript/commonjs/ui/hooks/useReduceMotion.d.ts +14 -0
  313. package/lib/typescript/commonjs/ui/hooks/useReduceMotion.d.ts.map +1 -0
  314. package/lib/typescript/commonjs/ui/hooks/useSurfaceHeader.d.ts +31 -0
  315. package/lib/typescript/commonjs/ui/hooks/useSurfaceHeader.d.ts.map +1 -0
  316. package/lib/typescript/commonjs/ui/hooks/useSwitchableAccounts.d.ts +1 -1
  317. package/lib/typescript/commonjs/ui/navigation/accountDialogManager.d.ts +27 -2
  318. package/lib/typescript/commonjs/ui/navigation/accountDialogManager.d.ts.map +1 -1
  319. package/lib/typescript/commonjs/ui/navigation/bottomSheetManager.d.ts +4 -5
  320. package/lib/typescript/commonjs/ui/navigation/bottomSheetManager.d.ts.map +1 -1
  321. package/lib/typescript/commonjs/ui/navigation/routes.d.ts +1 -1
  322. package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
  323. package/lib/typescript/commonjs/ui/navigation/surfaceBackBridge.d.ts +16 -0
  324. package/lib/typescript/commonjs/ui/navigation/surfaceBackBridge.d.ts.map +1 -0
  325. package/lib/typescript/commonjs/ui/navigation/surfaceNavStack.d.ts +21 -0
  326. package/lib/typescript/commonjs/ui/navigation/surfaceNavStack.d.ts.map +1 -1
  327. package/lib/typescript/commonjs/ui/navigation/surfaceRegistry.d.ts +101 -23
  328. package/lib/typescript/commonjs/ui/navigation/surfaceRegistry.d.ts.map +1 -1
  329. package/lib/typescript/commonjs/ui/navigation/surfaces.d.ts +42 -11
  330. package/lib/typescript/commonjs/ui/navigation/surfaces.d.ts.map +1 -1
  331. package/lib/typescript/commonjs/ui/screens/AccountMembersScreen.d.ts.map +1 -1
  332. package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  333. package/lib/typescript/commonjs/ui/screens/AccountVerificationScreen.d.ts.map +1 -1
  334. package/lib/typescript/commonjs/ui/screens/AppInfoScreen.d.ts.map +1 -1
  335. package/lib/typescript/commonjs/ui/screens/AvatarCropScreen.d.ts +18 -9
  336. package/lib/typescript/commonjs/ui/screens/AvatarCropScreen.d.ts.map +1 -1
  337. package/lib/typescript/commonjs/ui/screens/ChangeAvatarScreen.d.ts +34 -0
  338. package/lib/typescript/commonjs/ui/screens/ChangeAvatarScreen.d.ts.map +1 -0
  339. package/lib/typescript/commonjs/ui/screens/ConnectedAppsScreen.d.ts.map +1 -1
  340. package/lib/typescript/commonjs/ui/screens/CreateAccountScreen.d.ts.map +1 -1
  341. package/lib/typescript/commonjs/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
  342. package/lib/typescript/commonjs/ui/screens/EditProfileScreen.d.ts.map +1 -1
  343. package/lib/typescript/commonjs/ui/screens/FAQScreen.d.ts.map +1 -1
  344. package/lib/typescript/commonjs/ui/screens/FeedbackScreen.d.ts.map +1 -1
  345. package/lib/typescript/commonjs/ui/screens/FileManagementScreen.d.ts.map +1 -1
  346. package/lib/typescript/commonjs/ui/screens/HelpSupportScreen.d.ts.map +1 -1
  347. package/lib/typescript/commonjs/ui/screens/HistoryViewScreen.d.ts.map +1 -1
  348. package/lib/typescript/commonjs/ui/screens/LanguageSelectorScreen.d.ts.map +1 -1
  349. package/lib/typescript/commonjs/ui/screens/LearnMoreUsernamesScreen.d.ts.map +1 -1
  350. package/lib/typescript/commonjs/ui/screens/LegalDocumentsScreen.d.ts.map +1 -1
  351. package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts +1 -1
  352. package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts.map +1 -1
  353. package/lib/typescript/commonjs/ui/screens/NotificationsScreen.d.ts.map +1 -1
  354. package/lib/typescript/commonjs/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
  355. package/lib/typescript/commonjs/ui/screens/PreferencesScreen.d.ts.map +1 -1
  356. package/lib/typescript/commonjs/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
  357. package/lib/typescript/commonjs/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
  358. package/lib/typescript/commonjs/ui/screens/ProfileScreen.d.ts.map +1 -1
  359. package/lib/typescript/commonjs/ui/screens/SavesCollectionsScreen.d.ts.map +1 -1
  360. package/lib/typescript/commonjs/ui/screens/SearchSettingsScreen.d.ts.map +1 -1
  361. package/lib/typescript/commonjs/ui/screens/UserLinksScreen.d.ts.map +1 -1
  362. package/lib/typescript/commonjs/ui/screens/UserListScreen.d.ts.map +1 -1
  363. package/lib/typescript/commonjs/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -1
  364. package/lib/typescript/commonjs/ui/screens/fileManagement/FileLibraryError.d.ts +23 -0
  365. package/lib/typescript/commonjs/ui/screens/fileManagement/FileLibraryError.d.ts.map +1 -0
  366. package/lib/typescript/commonjs/ui/screens/fileManagement/PhotoPickerSection.d.ts +4 -0
  367. package/lib/typescript/commonjs/ui/screens/fileManagement/PhotoPickerSection.d.ts.map +1 -1
  368. package/lib/typescript/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.d.ts +10 -2
  369. package/lib/typescript/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.d.ts.map +1 -1
  370. package/lib/typescript/commonjs/ui/screens/trust/TrustAboutScreen.d.ts.map +1 -1
  371. package/lib/typescript/commonjs/ui/screens/trust/TrustCenterScreen.d.ts.map +1 -1
  372. package/lib/typescript/commonjs/ui/screens/trust/TrustFAQScreen.d.ts.map +1 -1
  373. package/lib/typescript/commonjs/ui/screens/trust/TrustLeaderboardScreen.d.ts.map +1 -1
  374. package/lib/typescript/commonjs/ui/screens/trust/TrustRewardsScreen.d.ts.map +1 -1
  375. package/lib/typescript/commonjs/ui/screens/trust/TrustRulesScreen.d.ts.map +1 -1
  376. package/lib/typescript/commonjs/ui/stores/resetSessionScopedStores.d.ts +8 -1
  377. package/lib/typescript/commonjs/ui/stores/resetSessionScopedStores.d.ts.map +1 -1
  378. package/lib/typescript/commonjs/ui/types/navigation.d.ts +10 -0
  379. package/lib/typescript/commonjs/ui/types/navigation.d.ts.map +1 -1
  380. package/lib/typescript/commonjs/ui/utils/avatarUtils.d.ts.map +1 -1
  381. package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts +0 -48
  382. package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts.map +1 -1
  383. package/lib/typescript/module/index.d.ts +2 -0
  384. package/lib/typescript/module/index.d.ts.map +1 -1
  385. package/lib/typescript/module/ui/components/AvatarCameraBadge.d.ts +4 -0
  386. package/lib/typescript/module/ui/components/AvatarCameraBadge.d.ts.map +1 -0
  387. package/lib/typescript/{commonjs/ui/components/OxyAccountDialog.d.ts → module/ui/components/OxyAccountDialogScreen.d.ts} +5 -4
  388. package/lib/typescript/module/ui/components/OxyAccountDialogScreen.d.ts.map +1 -0
  389. package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts +3 -3
  390. package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts.map +1 -1
  391. package/lib/typescript/module/ui/components/ProfileButton.d.ts +2 -2
  392. package/lib/typescript/module/ui/components/ProfileButton.d.ts.map +1 -1
  393. package/lib/typescript/module/ui/components/ProfileSummaryCard.d.ts.map +1 -1
  394. package/lib/typescript/module/ui/components/RequireOxyAuth.d.ts +1 -1
  395. package/lib/typescript/module/ui/components/SurfaceHeaderAction.d.ts +16 -0
  396. package/lib/typescript/module/ui/components/SurfaceHeaderAction.d.ts.map +1 -0
  397. package/lib/typescript/module/ui/components/SurfaceScreen.d.ts +3 -4
  398. package/lib/typescript/module/ui/components/SurfaceScreen.d.ts.map +1 -1
  399. package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts +14 -4
  400. package/lib/typescript/module/ui/components/fileManagement/FileDetailsModal.d.ts.map +1 -1
  401. package/lib/typescript/module/ui/components/modals/DeleteAccountModal.d.ts +17 -2
  402. package/lib/typescript/module/ui/components/modals/DeleteAccountModal.d.ts.map +1 -1
  403. package/lib/typescript/module/ui/components/oxyAuthChooserStyles.d.ts +75 -13
  404. package/lib/typescript/module/ui/components/oxyAuthChooserStyles.d.ts.map +1 -1
  405. package/lib/typescript/module/ui/components/photogrid/JustifiedPhotoGrid.d.ts +10 -8
  406. package/lib/typescript/module/ui/components/photogrid/JustifiedPhotoGrid.d.ts.map +1 -1
  407. package/lib/typescript/module/ui/components/surfaces/ActionSheetSurface.d.ts +38 -0
  408. package/lib/typescript/module/ui/components/surfaces/ActionSheetSurface.d.ts.map +1 -0
  409. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  410. package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts +9 -0
  411. package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts.map +1 -1
  412. package/lib/typescript/module/ui/hooks/queries/useFileQueries.d.ts +50 -0
  413. package/lib/typescript/module/ui/hooks/queries/useFileQueries.d.ts.map +1 -0
  414. package/lib/typescript/module/ui/hooks/useAvatarPicker.d.ts +17 -16
  415. package/lib/typescript/module/ui/hooks/useAvatarPicker.d.ts.map +1 -1
  416. package/lib/typescript/module/ui/hooks/useReduceMotion.d.ts +14 -0
  417. package/lib/typescript/module/ui/hooks/useReduceMotion.d.ts.map +1 -0
  418. package/lib/typescript/module/ui/hooks/useSurfaceHeader.d.ts +31 -0
  419. package/lib/typescript/module/ui/hooks/useSurfaceHeader.d.ts.map +1 -0
  420. package/lib/typescript/module/ui/hooks/useSwitchableAccounts.d.ts +1 -1
  421. package/lib/typescript/module/ui/navigation/accountDialogManager.d.ts +27 -2
  422. package/lib/typescript/module/ui/navigation/accountDialogManager.d.ts.map +1 -1
  423. package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts +4 -5
  424. package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts.map +1 -1
  425. package/lib/typescript/module/ui/navigation/routes.d.ts +1 -1
  426. package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
  427. package/lib/typescript/module/ui/navigation/surfaceBackBridge.d.ts +16 -0
  428. package/lib/typescript/module/ui/navigation/surfaceBackBridge.d.ts.map +1 -0
  429. package/lib/typescript/module/ui/navigation/surfaceNavStack.d.ts +21 -0
  430. package/lib/typescript/module/ui/navigation/surfaceNavStack.d.ts.map +1 -1
  431. package/lib/typescript/module/ui/navigation/surfaceRegistry.d.ts +101 -23
  432. package/lib/typescript/module/ui/navigation/surfaceRegistry.d.ts.map +1 -1
  433. package/lib/typescript/module/ui/navigation/surfaces.d.ts +42 -11
  434. package/lib/typescript/module/ui/navigation/surfaces.d.ts.map +1 -1
  435. package/lib/typescript/module/ui/screens/AccountMembersScreen.d.ts.map +1 -1
  436. package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  437. package/lib/typescript/module/ui/screens/AccountVerificationScreen.d.ts.map +1 -1
  438. package/lib/typescript/module/ui/screens/AppInfoScreen.d.ts.map +1 -1
  439. package/lib/typescript/module/ui/screens/AvatarCropScreen.d.ts +18 -9
  440. package/lib/typescript/module/ui/screens/AvatarCropScreen.d.ts.map +1 -1
  441. package/lib/typescript/module/ui/screens/ChangeAvatarScreen.d.ts +34 -0
  442. package/lib/typescript/module/ui/screens/ChangeAvatarScreen.d.ts.map +1 -0
  443. package/lib/typescript/module/ui/screens/ConnectedAppsScreen.d.ts.map +1 -1
  444. package/lib/typescript/module/ui/screens/CreateAccountScreen.d.ts.map +1 -1
  445. package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
  446. package/lib/typescript/module/ui/screens/EditProfileScreen.d.ts.map +1 -1
  447. package/lib/typescript/module/ui/screens/FAQScreen.d.ts.map +1 -1
  448. package/lib/typescript/module/ui/screens/FeedbackScreen.d.ts.map +1 -1
  449. package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts.map +1 -1
  450. package/lib/typescript/module/ui/screens/HelpSupportScreen.d.ts.map +1 -1
  451. package/lib/typescript/module/ui/screens/HistoryViewScreen.d.ts.map +1 -1
  452. package/lib/typescript/module/ui/screens/LanguageSelectorScreen.d.ts.map +1 -1
  453. package/lib/typescript/module/ui/screens/LearnMoreUsernamesScreen.d.ts.map +1 -1
  454. package/lib/typescript/module/ui/screens/LegalDocumentsScreen.d.ts.map +1 -1
  455. package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts +1 -1
  456. package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts.map +1 -1
  457. package/lib/typescript/module/ui/screens/NotificationsScreen.d.ts.map +1 -1
  458. package/lib/typescript/module/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
  459. package/lib/typescript/module/ui/screens/PreferencesScreen.d.ts.map +1 -1
  460. package/lib/typescript/module/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
  461. package/lib/typescript/module/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
  462. package/lib/typescript/module/ui/screens/ProfileScreen.d.ts.map +1 -1
  463. package/lib/typescript/module/ui/screens/SavesCollectionsScreen.d.ts.map +1 -1
  464. package/lib/typescript/module/ui/screens/SearchSettingsScreen.d.ts.map +1 -1
  465. package/lib/typescript/module/ui/screens/UserLinksScreen.d.ts.map +1 -1
  466. package/lib/typescript/module/ui/screens/UserListScreen.d.ts.map +1 -1
  467. package/lib/typescript/module/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -1
  468. package/lib/typescript/module/ui/screens/fileManagement/FileLibraryError.d.ts +23 -0
  469. package/lib/typescript/module/ui/screens/fileManagement/FileLibraryError.d.ts.map +1 -0
  470. package/lib/typescript/module/ui/screens/fileManagement/PhotoPickerSection.d.ts +4 -0
  471. package/lib/typescript/module/ui/screens/fileManagement/PhotoPickerSection.d.ts.map +1 -1
  472. package/lib/typescript/module/ui/screens/fileManagement/hooks/useFileUploadState.d.ts +10 -2
  473. package/lib/typescript/module/ui/screens/fileManagement/hooks/useFileUploadState.d.ts.map +1 -1
  474. package/lib/typescript/module/ui/screens/trust/TrustAboutScreen.d.ts.map +1 -1
  475. package/lib/typescript/module/ui/screens/trust/TrustCenterScreen.d.ts.map +1 -1
  476. package/lib/typescript/module/ui/screens/trust/TrustFAQScreen.d.ts.map +1 -1
  477. package/lib/typescript/module/ui/screens/trust/TrustLeaderboardScreen.d.ts.map +1 -1
  478. package/lib/typescript/module/ui/screens/trust/TrustRewardsScreen.d.ts.map +1 -1
  479. package/lib/typescript/module/ui/screens/trust/TrustRulesScreen.d.ts.map +1 -1
  480. package/lib/typescript/module/ui/stores/resetSessionScopedStores.d.ts +8 -1
  481. package/lib/typescript/module/ui/stores/resetSessionScopedStores.d.ts.map +1 -1
  482. package/lib/typescript/module/ui/types/navigation.d.ts +10 -0
  483. package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
  484. package/lib/typescript/module/ui/utils/avatarUtils.d.ts.map +1 -1
  485. package/lib/typescript/module/ui/utils/fileManagement.d.ts +0 -48
  486. package/lib/typescript/module/ui/utils/fileManagement.d.ts.map +1 -1
  487. package/package.json +9 -5
  488. package/src/index.ts +12 -5
  489. package/src/ui/components/AvatarCameraBadge.tsx +35 -0
  490. package/src/ui/components/{OxyAccountDialog.tsx → OxyAccountDialogScreen.tsx} +50 -116
  491. package/src/ui/components/OxyAuthChooser.tsx +743 -86
  492. package/src/ui/components/OxyConsentScreen.tsx +1 -1
  493. package/src/ui/components/ProfileButton.tsx +18 -3
  494. package/src/ui/components/ProfileSummaryCard.tsx +2 -25
  495. package/src/ui/components/RequireOxyAuth.tsx +1 -1
  496. package/src/ui/components/SurfaceHeaderAction.tsx +60 -0
  497. package/src/ui/components/SurfaceScreen.tsx +108 -14
  498. package/src/ui/components/fileManagement/FileDetailsModal.tsx +50 -36
  499. package/src/ui/components/modals/DeleteAccountModal.tsx +47 -26
  500. package/src/ui/components/oxyAuthChooserStyles.ts +78 -16
  501. package/src/ui/components/photogrid/JustifiedPhotoGrid.tsx +158 -84
  502. package/src/ui/components/photogrid/__tests__/chunkPhotos.test.ts +51 -0
  503. package/src/ui/components/surfaces/ActionSheetSurface.tsx +98 -0
  504. package/src/ui/context/OxyContext.tsx +79 -25
  505. package/src/ui/hooks/queries/queryKeys.ts +15 -0
  506. package/src/ui/hooks/queries/useFileQueries.ts +162 -0
  507. package/src/ui/hooks/useAvatarPicker.ts +46 -74
  508. package/src/ui/hooks/useReduceMotion.ts +58 -0
  509. package/src/ui/hooks/useSurfaceHeader.ts +57 -0
  510. package/src/ui/hooks/useSwitchableAccounts.ts +1 -1
  511. package/src/ui/navigation/__tests__/getSurfaceConfig.test.ts +55 -7
  512. package/src/ui/navigation/__tests__/surfaceNavStack.test.ts +149 -0
  513. package/src/ui/navigation/accountDialogManager.ts +42 -2
  514. package/src/ui/navigation/bottomSheetManager.ts +6 -7
  515. package/src/ui/navigation/routes.ts +6 -4
  516. package/src/ui/navigation/surfaceBackBridge.ts +69 -0
  517. package/src/ui/navigation/surfaceNavStack.ts +72 -9
  518. package/src/ui/navigation/surfaceRegistry.ts +164 -24
  519. package/src/ui/navigation/surfaces.ts +137 -30
  520. package/src/ui/screens/AccountMembersScreen.tsx +39 -100
  521. package/src/ui/screens/AccountSettingsScreen.tsx +32 -54
  522. package/src/ui/screens/AccountVerificationScreen.tsx +23 -51
  523. package/src/ui/screens/AppInfoScreen.tsx +6 -13
  524. package/src/ui/screens/AvatarCropScreen.tsx +340 -311
  525. package/src/ui/screens/ChangeAvatarScreen.tsx +359 -0
  526. package/src/ui/screens/ConnectedAppsScreen.tsx +39 -60
  527. package/src/ui/screens/CreateAccountScreen.tsx +13 -39
  528. package/src/ui/screens/EditProfileFieldScreen.tsx +30 -48
  529. package/src/ui/screens/EditProfileScreen.tsx +7 -16
  530. package/src/ui/screens/FAQScreen.tsx +9 -13
  531. package/src/ui/screens/FeedbackScreen.tsx +8 -22
  532. package/src/ui/screens/FileManagementScreen.tsx +370 -610
  533. package/src/ui/screens/HelpSupportScreen.tsx +7 -13
  534. package/src/ui/screens/HistoryViewScreen.tsx +26 -31
  535. package/src/ui/screens/LanguageSelectorScreen.tsx +12 -46
  536. package/src/ui/screens/LearnMoreUsernamesScreen.tsx +8 -16
  537. package/src/ui/screens/LegalDocumentsScreen.tsx +7 -22
  538. package/src/ui/screens/ManageAccountScreen.tsx +96 -165
  539. package/src/ui/screens/NotificationsScreen.tsx +7 -13
  540. package/src/ui/screens/PaymentGatewayScreen.tsx +3 -10
  541. package/src/ui/screens/PreferencesScreen.tsx +7 -13
  542. package/src/ui/screens/PremiumSubscriptionScreen.tsx +52 -90
  543. package/src/ui/screens/PrivacySettingsScreen.tsx +9 -21
  544. package/src/ui/screens/ProfileScreen.tsx +9 -11
  545. package/src/ui/screens/SavesCollectionsScreen.tsx +7 -13
  546. package/src/ui/screens/SearchSettingsScreen.tsx +9 -21
  547. package/src/ui/screens/UserLinksScreen.tsx +7 -14
  548. package/src/ui/screens/UserListScreen.tsx +2 -5
  549. package/src/ui/screens/WelcomeNewUserScreen.tsx +18 -48
  550. package/src/ui/screens/fileManagement/FileLibraryError.tsx +56 -0
  551. package/src/ui/screens/fileManagement/PhotoPickerSection.tsx +56 -46
  552. package/src/ui/screens/fileManagement/hooks/useFileUploadState.ts +55 -71
  553. package/src/ui/screens/trust/TrustAboutScreen.tsx +10 -17
  554. package/src/ui/screens/trust/TrustCenterScreen.tsx +9 -28
  555. package/src/ui/screens/trust/TrustFAQScreen.tsx +15 -18
  556. package/src/ui/screens/trust/TrustLeaderboardScreen.tsx +3 -5
  557. package/src/ui/screens/trust/TrustRewardsScreen.tsx +11 -26
  558. package/src/ui/screens/trust/TrustRulesScreen.tsx +10 -13
  559. package/src/ui/stores/resetSessionScopedStores.ts +8 -3
  560. package/src/ui/types/navigation.ts +10 -0
  561. package/src/ui/utils/avatarUtils.ts +11 -2
  562. package/src/ui/utils/fileManagement.ts +1 -101
  563. package/lib/commonjs/ui/components/Header.js +0 -305
  564. package/lib/commonjs/ui/components/Header.js.map +0 -1
  565. package/lib/commonjs/ui/components/OxyAccountDialog.js.map +0 -1
  566. package/lib/commonjs/ui/stores/fileStore.js +0 -153
  567. package/lib/commonjs/ui/stores/fileStore.js.map +0 -1
  568. package/lib/module/ui/components/Header.js +0 -299
  569. package/lib/module/ui/components/Header.js.map +0 -1
  570. package/lib/module/ui/components/OxyAccountDialog.js.map +0 -1
  571. package/lib/module/ui/stores/fileStore.js +0 -145
  572. package/lib/module/ui/stores/fileStore.js.map +0 -1
  573. package/lib/typescript/commonjs/ui/components/Header.d.ts +0 -33
  574. package/lib/typescript/commonjs/ui/components/Header.d.ts.map +0 -1
  575. package/lib/typescript/commonjs/ui/components/OxyAccountDialog.d.ts.map +0 -1
  576. package/lib/typescript/commonjs/ui/stores/fileStore.d.ts +0 -31
  577. package/lib/typescript/commonjs/ui/stores/fileStore.d.ts.map +0 -1
  578. package/lib/typescript/module/ui/components/Header.d.ts +0 -33
  579. package/lib/typescript/module/ui/components/Header.d.ts.map +0 -1
  580. package/lib/typescript/module/ui/components/OxyAccountDialog.d.ts.map +0 -1
  581. package/lib/typescript/module/ui/stores/fileStore.d.ts +0 -31
  582. package/lib/typescript/module/ui/stores/fileStore.d.ts.map +0 -1
  583. package/src/ui/components/Header.tsx +0 -224
  584. package/src/ui/stores/fileStore.ts +0 -118
@@ -1,10 +1,10 @@
1
1
  import { getSurfaceConfig, getSurfacePresentation } from '../surfaceRegistry';
2
2
 
3
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.
4
+ * `getSurfaceConfig` resolves how a route renders. EVERY route is a responsive
5
+ * `'sheet'` that MORPHS in place; NO route stacks (genuine overlays are Bloom-raw
6
+ * calls outside this registry). The flagship image picker is a sheet that owns its
7
+ * own scrolling + chrome. These guard the routing contract.
8
8
  */
9
9
  describe('getSurfaceConfig presentation', () => {
10
10
  const imageOnlyPickerProps = {
@@ -18,11 +18,59 @@ describe('getSurfaceConfig presentation', () => {
18
18
  expect(getSurfacePresentation('ManageAccount', {})).toBe('sheet');
19
19
  });
20
20
 
21
- it('routes the FileManagement image-only picker to a full-screen surface', () => {
21
+ it('renders the FileManagement image-only picker as a morphing own-scroller sheet', () => {
22
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.
23
+ // It morphs in place like every screen — a sheet, not a stacked full-bleed.
24
+ expect(config.presentation).toBe('sheet');
25
+ expect(config.stacks).toBe(false);
26
+ // PhotoPickerView owns its own FlatList → the host must not wrap it in a
27
+ // ScrollView; and its own translucent bar → no Dialog nav header.
25
28
  expect(config.scrollable).toBe(false);
29
+ expect(config.header).toBe(false);
30
+ });
31
+
32
+ it('morphs the surface for every route, the picker included', () => {
33
+ // NAV-WITHIN: drilling into these swaps the content inside ONE surface,
34
+ // which reshapes the panel instead of hard-cutting.
35
+ expect(getSurfaceConfig('ManageAccount', {}).morph).toBe(true);
36
+ expect(getSurfaceConfig('FAQ', {}).morph).toBe(true);
37
+ expect(getSurfaceConfig('FollowersList', {}).morph).toBe(true);
38
+ expect(getSurfaceConfig('FileManagement', imageOnlyPickerProps).morph).toBe(true);
39
+ });
40
+
41
+ it('never stacks any route — every screen morphs in place', () => {
42
+ // `stacks` is the DECLARATIVE morph-vs-stack signal, and it is FALSE for
43
+ // every route: overlays (action sheets / confirm / prompt) are Bloom-raw
44
+ // `surfaces.present`/`confirm` calls outside this registry.
45
+ expect(getSurfaceConfig('ManageAccount', {}).stacks).toBe(false);
46
+ expect(getSurfaceConfig('AvatarCrop', {}).stacks).toBe(false);
47
+ expect(getSurfaceConfig('ChangeAvatar', {}).stacks).toBe(false);
48
+ expect(getSurfaceConfig('AccountDialog', {}).stacks).toBe(false);
49
+ expect(getSurfaceConfig('FileManagement', imageOnlyPickerProps).stacks).toBe(false);
50
+ expect(getSurfaceConfig('FileManagement', {}).stacks).toBe(false);
51
+ });
52
+
53
+ it('lets the avatar flow morph list → crop inside ONE surface', () => {
54
+ // ChangeAvatar navigates WITHIN its surface to AvatarCrop, so both frames
55
+ // must share a presentation (else the crop would open on top instead of
56
+ // morphing) and both must opt IN to the morph.
57
+ const list = getSurfaceConfig('ChangeAvatar', {});
58
+ const crop = getSurfaceConfig('AvatarCrop', {});
59
+ expect(crop.presentation).toBe(list.presentation);
60
+ expect(list.morph).toBe(true);
61
+ expect(crop.morph).toBe(true);
62
+ // The morph can only RESIZE the panel when the Dialog owns the scroll
63
+ // container — an own-scroller surface cross-fades but never reshapes.
64
+ expect(list.scrollable).toBe(true);
65
+ expect(crop.scrollable).toBe(true);
66
+ });
67
+
68
+ it('gives the avatar flow the Dialog nav header on both frames', () => {
69
+ // The Dialog's `header` is fixed for a surface's whole life, so a
70
+ // headerless crop frame inside a header-mode surface would stack two
71
+ // bars. Both frames declare their chrome through `useSurfaceHeader`.
72
+ expect(getSurfaceConfig('ChangeAvatar', {}).header).toBe(true);
73
+ expect(getSurfaceConfig('AvatarCrop', {}).header).toBe(true);
26
74
  });
27
75
 
28
76
  it('keeps FileManagement on the sheet when it is not an image-only picker', () => {
@@ -0,0 +1,149 @@
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
+ describe('result-bearing sub-flow (morphed-in avatar picker)', () => {
49
+ it('resolves with the descendant dismiss result and pops back to the caller frame', async () => {
50
+ const stack = createSurfaceNavStack('EditProfile');
51
+ const flow = stack.beginFlow('ChangeAvatar');
52
+ expect(stack.getTop().route).toBe('ChangeAvatar');
53
+ // Drill into the crop editor within the flow, then confirm.
54
+ stack.navigate('AvatarCrop', { imageUri: 'file:///x.jpg' });
55
+ stack.resolveFlowOrDismiss({ uri: 'file:///cropped.jpg' });
56
+ await expect(flow).resolves.toEqual({ uri: 'file:///cropped.jpg' });
57
+ // Popped back to the frame that started the flow — surface NOT dismissed.
58
+ expect(stack.getTop().route).toBe('EditProfile');
59
+ expect(stack.store.getState().closing).toBe(false);
60
+ });
61
+
62
+ it('resolves undefined when the flow entry frame is backed out of', async () => {
63
+ const stack = createSurfaceNavStack('EditProfile');
64
+ const flow = stack.beginFlow('ChangeAvatar');
65
+ stack.navigate('AvatarCrop');
66
+ expect(stack.goBack()).toBe(true); // crop -> list (still in flow)
67
+ expect(stack.goBack()).toBe(true); // list -> EditProfile (cancels flow)
68
+ await expect(flow).resolves.toBeUndefined();
69
+ expect(stack.getTop().route).toBe('EditProfile');
70
+ expect(stack.store.getState().closing).toBe(false);
71
+ });
72
+
73
+ it('resolveFlowOrDismiss with NO active flow dismisses the surface (cold present)', () => {
74
+ const stack = createSurfaceNavStack('ChangeAvatar');
75
+ stack.resolveFlowOrDismiss({ removed: true });
76
+ expect(stack.store.getState().closing).toBe(true);
77
+ expect(stack.store.getState().closeResult).toEqual({ removed: true });
78
+ });
79
+
80
+ it('abandons a pending flow (undefined) when the surface is torn down', async () => {
81
+ const stack = createSurfaceNavStack('EditProfile');
82
+ const flow = stack.beginFlow('ChangeAvatar');
83
+ stack.abandonActiveFlow();
84
+ await expect(flow).resolves.toBeUndefined();
85
+ });
86
+
87
+ it('NESTS flows: the inner selector resolves first, then the outer avatar flow', async () => {
88
+ // ChangeAvatar (outer) → "My Oxy files" FileManagement (inner) → back → crop.
89
+ const stack = createSurfaceNavStack('EditProfile');
90
+ const avatarFlow = stack.beginFlow('ChangeAvatar');
91
+ const fileFlow = stack.beginFlow('FileManagement');
92
+ expect(stack.getTop().route).toBe('FileManagement');
93
+ // Pick a file → inner flow resolves, pops back to ChangeAvatar (outer still open).
94
+ stack.resolveFlowOrDismiss({ id: 'file-1' });
95
+ await expect(fileFlow).resolves.toEqual({ id: 'file-1' });
96
+ expect(stack.getTop().route).toBe('ChangeAvatar');
97
+ expect(stack.store.getState().closing).toBe(false);
98
+ // Now drill to crop and confirm → outer flow resolves, pops to EditProfile.
99
+ stack.navigate('AvatarCrop');
100
+ stack.resolveFlowOrDismiss({ uri: 'file:///c.jpg' });
101
+ await expect(avatarFlow).resolves.toEqual({ uri: 'file:///c.jpg' });
102
+ expect(stack.getTop().route).toBe('EditProfile');
103
+ });
104
+
105
+ it('cancelling the inner selector returns to the outer flow, leaving it open', async () => {
106
+ const stack = createSurfaceNavStack('EditProfile');
107
+ const avatarFlow = stack.beginFlow('ChangeAvatar');
108
+ const fileFlow = stack.beginFlow('FileManagement');
109
+ expect(stack.goBack()).toBe(true); // FileManagement -> ChangeAvatar (cancels inner)
110
+ await expect(fileFlow).resolves.toBeUndefined();
111
+ expect(stack.getTop().route).toBe('ChangeAvatar');
112
+ // The outer avatar flow is still pending.
113
+ let outerSettled = false;
114
+ void avatarFlow.then(() => { outerSettled = true; });
115
+ await Promise.resolve();
116
+ expect(outerSettled).toBe(false);
117
+ });
118
+
119
+ it('tearing down the surface abandons ALL nested flows (undefined)', async () => {
120
+ const stack = createSurfaceNavStack('EditProfile');
121
+ const outer = stack.beginFlow('ChangeAvatar');
122
+ const inner = stack.beginFlow('FileManagement');
123
+ stack.abandonActiveFlow();
124
+ await expect(inner).resolves.toBeUndefined();
125
+ await expect(outer).resolves.toBeUndefined();
126
+ });
127
+ });
128
+ });
129
+
130
+ describe('pushSurfaceBackHandler', () => {
131
+ afterEach(() => {
132
+ __resetSurfaceBackBridgeForTests();
133
+ });
134
+
135
+ it('delegates to the topmost handler', () => {
136
+ const calls: string[] = [];
137
+ pushSurfaceBackHandler(() => {
138
+ calls.push('bottom');
139
+ return true;
140
+ });
141
+ pushSurfaceBackHandler(() => {
142
+ calls.push('top');
143
+ return true;
144
+ });
145
+
146
+ expect(__invokeTopSurfaceBackForTests()).toBe(true);
147
+ expect(calls).toEqual(['top']);
148
+ });
149
+ });
@@ -1,16 +1,40 @@
1
1
  /**
2
- * Imperative controls for the unified {@link OxyAccountDialog}.
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
- /** Live open/close handles registered by the mounted provider. */
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;
11
23
  }
12
24
 
25
+ /**
26
+ * Optional consumer overrides for account-dialog actions. `ProfileButton` (and
27
+ * similar hosts) register these while mounted so inbox/accounts can route
28
+ * "Manage" / "Add account" to app-local navigation instead of the SDK default.
29
+ */
30
+ export interface AccountDialogConsumerHooks {
31
+ onNavigateManage?: () => void;
32
+ onAddAccount?: () => void;
33
+ onNavigateProfile?: () => void;
34
+ }
35
+
13
36
  let controls: AccountDialogControls | null = null;
37
+ let consumerHooks: AccountDialogConsumerHooks | null = null;
14
38
  const visibilityListeners = new Set<(visible: boolean) => void>();
15
39
 
16
40
  export function registerAccountDialogControls(next: AccountDialogControls): () => void {
@@ -22,6 +46,22 @@ export function registerAccountDialogControls(next: AccountDialogControls): () =
22
46
  };
23
47
  }
24
48
 
49
+ /** Register app-local manage/add/profile handlers for the account dialog. */
50
+ export function registerAccountDialogConsumerHooks(
51
+ next: AccountDialogConsumerHooks | null,
52
+ ): () => void {
53
+ consumerHooks = next;
54
+ return () => {
55
+ if (consumerHooks === next) {
56
+ consumerHooks = null;
57
+ }
58
+ };
59
+ }
60
+
61
+ export function getAccountDialogConsumerHooks(): AccountDialogConsumerHooks | null {
62
+ return consumerHooks;
63
+ }
64
+
25
65
  /** Open the account dialog on `view` (default `accounts`). No-op before mount. */
26
66
  export function openAccountDialog(view?: AccountDialogView): void {
27
67
  controls?.open(view);
@@ -1,6 +1,6 @@
1
1
  import type { RouteName } from './routes';
2
2
  import { isValidRoute } from './routes';
3
- import { getSurfacePresentation } from './surfaceRegistry';
3
+ import { getSurfaceConfig } from './surfaceRegistry';
4
4
  import { closeAllRouteSurfaces, presentRoute, topRouteSurface } from './surfaces';
5
5
 
6
6
  /**
@@ -16,11 +16,10 @@ import { closeAllRouteSurfaces, presentRoute, topRouteSurface } from './surfaces
16
16
  */
17
17
 
18
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.
19
+ * Open a bottom-sheet route. By DEFAULT it drills into the top-most active
20
+ * surface morphing it in place (every screen morphs). A NEW surface is stacked
21
+ * on top only when the target route declares `stacks` (reserved for genuine
22
+ * overlays none today). Opening with no active surface presents the first one.
24
23
  *
25
24
  * `fullScreen` is accepted for signature compatibility and ignored — a route's
26
25
  * surface is now derived from its registry config, not a per-call flag.
@@ -39,7 +38,7 @@ export const showBottomSheet = (
39
38
  }
40
39
 
41
40
  const top = topRouteSurface();
42
- if (top && top.presentation === getSurfacePresentation(screen, props)) {
41
+ if (top && !getSurfaceConfig(screen, props).stacks) {
43
42
  top.navigate(screen, props);
44
43
  } else {
45
44
  presentRoute(screen, props);
@@ -39,11 +39,12 @@ export type RouteName =
39
39
  | 'CreateAccount' // Create a new account (organization / project / bot)
40
40
  | 'AccountMembers' // Manage an account's members (invite / roles / transfer)
41
41
  | 'AccountSettings' // Per-account profile edit + members + danger zone
42
- | 'AvatarCrop' // Square-crop editor presented before avatar upload
42
+ | 'ChangeAvatar' // Profile-picture source list the ONE entry into changing an avatar
43
+ | 'AvatarCrop' // Square-crop editor, reached by navigating within the ChangeAvatar surface
43
44
  | 'Notifications' // Per-channel notification preferences
44
45
  | 'ConnectedApps' // OAuth-authorized third-party apps the user can revoke
45
46
  | 'Preferences' // General user preferences (theme, reduce-motion, etc.)
46
- | 'AccountDialog'; // Unified account switcher + sign-in surface (folded OxyAccountDialog body)
47
+ | 'AccountDialog'; // Unified account switcher + sign-in surface (OxyAccountDialogScreen body)
47
48
 
48
49
  // Lazy screen loaders - functions that return screen components on-demand
49
50
  // This breaks the require cycle by deferring imports until screens are actually needed
@@ -83,14 +84,15 @@ const screenLoaders: Record<RouteName, () => ComponentType<BaseScreenProps>> = {
83
84
  CreateAccount: () => require('../screens/CreateAccountScreen').default,
84
85
  AccountMembers: () => require('../screens/AccountMembersScreen').default,
85
86
  AccountSettings: () => require('../screens/AccountSettingsScreen').default,
87
+ ChangeAvatar: () => require('../screens/ChangeAvatarScreen').default,
86
88
  AvatarCrop: () => require('../screens/AvatarCropScreen').default,
87
89
  Notifications: () => require('../screens/NotificationsScreen').default,
88
90
  ConnectedApps: () => require('../screens/ConnectedAppsScreen').default,
89
91
  Preferences: () => require('../screens/PreferencesScreen').default,
90
92
  // Unified account switcher + sign-in surface. Its body lives in the
91
- // `OxyAccountDialog` component (folded from the standalone dialog); the
93
+ // `OxyAccountDialogScreen` component (folded from the standalone dialog); the
92
94
  // surface stack provides the Dialog chrome around it.
93
- AccountDialog: () => require('../components/OxyAccountDialog').default,
95
+ AccountDialog: () => require('../components/OxyAccountDialogScreen').default,
94
96
  };
95
97
 
96
98
  // Cache loaded components to avoid re-requiring
@@ -0,0 +1,69 @@
1
+ import { BackHandler, Platform } from 'react-native';
2
+
3
+ /**
4
+ * Per-surface system-back handlers (Android hardware back + web Escape).
5
+ *
6
+ * Bloom's `SurfaceHost` dismisses the whole top surface on back/Escape. The SDK
7
+ * needs the old `BottomSheetRouter` semantics first: pop nav history, step a
8
+ * wizard back, then dismiss. A single global listener delegates to the topmost
9
+ * registered handler so stacked surfaces route correctly.
10
+ */
11
+
12
+ export type SurfaceBackHandler = () => boolean;
13
+
14
+ const handlerStack: SurfaceBackHandler[] = [];
15
+ let androidInstalled = false;
16
+ let escapeInstalled = false;
17
+
18
+ function invokeTopHandler(): boolean {
19
+ const handler = handlerStack[handlerStack.length - 1];
20
+ return handler ? handler() : false;
21
+ }
22
+
23
+ function installAndroidHandler(): void {
24
+ if (androidInstalled || Platform.OS !== 'android') return;
25
+ androidInstalled = true;
26
+ BackHandler.addEventListener('hardwareBackPress', () => {
27
+ if (handlerStack.length === 0) return false;
28
+ return invokeTopHandler();
29
+ });
30
+ }
31
+
32
+ function installEscapeHandler(): void {
33
+ if (escapeInstalled || Platform.OS !== 'web') return;
34
+ if (typeof window === 'undefined') return;
35
+ escapeInstalled = true;
36
+ window.addEventListener(
37
+ 'keydown',
38
+ (event) => {
39
+ if (event.key !== 'Escape' || handlerStack.length === 0) return;
40
+ invokeTopHandler();
41
+ event.stopImmediatePropagation();
42
+ event.preventDefault();
43
+ },
44
+ true,
45
+ );
46
+ }
47
+
48
+ /** Register before Bloom's `SurfaceHost` mounts so Escape capture runs first. */
49
+ installEscapeHandler();
50
+
51
+ /** Push a handler for one live surface; returns unregister. */
52
+ export function pushSurfaceBackHandler(handler: SurfaceBackHandler): () => void {
53
+ handlerStack.push(handler);
54
+ installAndroidHandler();
55
+ return () => {
56
+ const index = handlerStack.lastIndexOf(handler);
57
+ if (index >= 0) handlerStack.splice(index, 1);
58
+ };
59
+ }
60
+
61
+ /** Test-only: invoke the top handler. */
62
+ export function __invokeTopSurfaceBackForTests(): boolean {
63
+ return invokeTopHandler();
64
+ }
65
+
66
+ /** Test-only reset. */
67
+ export function __resetSurfaceBackBridgeForTests(): void {
68
+ handlerStack.length = 0;
69
+ }
@@ -48,6 +48,27 @@ export interface SurfaceNavStack {
48
48
  setStep(step: number): void;
49
49
  /** Request dismissal of the whole surface, resolving its promise with `result`. */
50
50
  requestDismiss(result?: unknown): void;
51
+ /**
52
+ * Begin a result-bearing SUB-FLOW inside this surface: push `route` as a frame
53
+ * and return a promise that settles when the flow finishes — a descendant's
54
+ * `dismiss(result)` resolves it with `result`, backing out of the flow's entry
55
+ * frame resolves it with `undefined` (cancelled) — popping the surface back to
56
+ * the frame that started the flow WITHOUT dismissing it. This is how a screen
57
+ * already living inside a surface (EditProfile, ManageAccount, ChangeAvatar)
58
+ * opens the avatar picker / media selector as a MORPH instead of a stacked
59
+ * surface while still awaiting its result. Flows NEST (ChangeAvatar → the "My
60
+ * Oxy files" selector → back), maintained as a stack.
61
+ */
62
+ beginFlow(route: RouteName, props?: Record<string, unknown>): Promise<unknown>;
63
+ /**
64
+ * Resolve the INNERMOST active sub-flow with `result` and pop back to its entry
65
+ * (the frame that called {@link beginFlow}), leaving the surface open. With NO
66
+ * active flow this falls back to {@link requestDismiss} — so a screen presented
67
+ * as its OWN surface still dismisses it. Wired to every screen's `dismiss` prop.
68
+ */
69
+ resolveFlowOrDismiss(result?: unknown): void;
70
+ /** Settle EVERY still-pending sub-flow with `undefined` (the surface is going away). */
71
+ abandonActiveFlow(): void;
51
72
  /** The current (top) frame. */
52
73
  getTop(): NavFrame;
53
74
  }
@@ -73,9 +94,41 @@ export function createSurfaceNavStack(
73
94
  return frames[frames.length - 1];
74
95
  };
75
96
 
97
+ // Result-bearing sub-flows currently running in this surface (the morphed-in
98
+ // avatar picker, and — NESTED within it — the "My Oxy files" media selector).
99
+ // A STACK: flows nest (ChangeAvatar → FileManagement → back to ChangeAvatar).
100
+ // Held OUTSIDE the store (resolvers are functions; flow presence must not
101
+ // re-render frames). Each flow's `returnLength` is the frame count BEFORE its
102
+ // entry frame was pushed, so settling pops back to exactly the frame that
103
+ // started it. `flowStack` is ordered outer → inner; the top is the innermost.
104
+ const flowStack: { returnLength: number; resolve: (result: unknown) => void }[] = [];
105
+
106
+ const requestDismiss = (result?: unknown): void => {
107
+ // Dismissing the whole surface abandons EVERY pending sub-flow — settle each
108
+ // promise so an awaiting caller (the avatar picker) never hangs.
109
+ while (flowStack.length) flowStack.pop()?.resolve(undefined);
110
+ if (store.getState().closing) return;
111
+ store.setState({ closing: true, closeResult: result });
112
+ };
113
+
114
+ const goBack = (): boolean => {
115
+ const { frames } = store.getState();
116
+ if (frames.length <= 1) return false;
117
+ const nextLength = frames.length - 1;
118
+ store.setState({ frames: frames.slice(0, -1) });
119
+ // Backing out past a sub-flow's entry frame cancels it (resolve undefined).
120
+ // A single pop crosses at most one boundary, but loop for safety.
121
+ while (flowStack.length && nextLength <= flowStack[flowStack.length - 1].returnLength) {
122
+ flowStack.pop()?.resolve(undefined);
123
+ }
124
+ return true;
125
+ };
126
+
76
127
  return {
77
128
  store,
78
129
  getTop,
130
+ requestDismiss,
131
+ goBack,
79
132
  navigate(nextRoute, nextProps) {
80
133
  store.setState((state) => ({ frames: [...state.frames, makeFrame(nextRoute, nextProps)] }));
81
134
  },
@@ -84,12 +137,6 @@ export function createSurfaceNavStack(
84
137
  frames: [...state.frames.slice(0, -1), makeFrame(nextRoute, nextProps)],
85
138
  }));
86
139
  },
87
- goBack() {
88
- const { frames } = store.getState();
89
- if (frames.length <= 1) return false;
90
- store.setState({ frames: frames.slice(0, -1) });
91
- return true;
92
- },
93
140
  canGoBack() {
94
141
  const { frames } = store.getState();
95
142
  return frames.length > 1 || (frames[frames.length - 1]?.step ?? 0) > 0;
@@ -102,9 +149,25 @@ export function createSurfaceNavStack(
102
149
  return { frames };
103
150
  });
104
151
  },
105
- requestDismiss(result) {
106
- if (store.getState().closing) return;
107
- store.setState({ closing: true, closeResult: result });
152
+ beginFlow(nextRoute, nextProps) {
153
+ const returnLength = store.getState().frames.length;
154
+ store.setState((state) => ({ frames: [...state.frames, makeFrame(nextRoute, nextProps)] }));
155
+ return new Promise<unknown>((resolve) => {
156
+ flowStack.push({ returnLength, resolve });
157
+ });
158
+ },
159
+ resolveFlowOrDismiss(result) {
160
+ const flow = flowStack.pop();
161
+ if (!flow) {
162
+ // No flow → this screen owns its surface; dismiss it as before.
163
+ requestDismiss(result);
164
+ return;
165
+ }
166
+ store.setState((state) => ({ frames: state.frames.slice(0, flow.returnLength) }));
167
+ flow.resolve(result);
168
+ },
169
+ abandonActiveFlow() {
170
+ while (flowStack.length) flowStack.pop()?.resolve(undefined);
108
171
  },
109
172
  };
110
173
  }