@oxyhq/services 13.0.2 → 13.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (403) hide show
  1. package/lib/commonjs/index.js +18 -11
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/ui/components/AccountMenuButton.js +8 -10
  4. package/lib/commonjs/ui/components/AccountMenuButton.js.map +1 -1
  5. package/lib/commonjs/ui/components/AccountSwitcher.js +65 -35
  6. package/lib/commonjs/ui/components/AccountSwitcher.js.map +1 -1
  7. package/lib/commonjs/ui/components/ProfileButton.js +233 -0
  8. package/lib/commonjs/ui/components/ProfileButton.js.map +1 -0
  9. package/lib/commonjs/ui/components/ProfileMenu.js +374 -0
  10. package/lib/commonjs/ui/components/ProfileMenu.js.map +1 -0
  11. package/lib/commonjs/ui/context/OxyContext.js +213 -101
  12. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  13. package/lib/commonjs/ui/context/hooks/useAuthOperations.js +28 -1
  14. package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
  15. package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +2 -2
  16. package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
  17. package/lib/commonjs/ui/hooks/queries/usePaymentQueries.js +12 -12
  18. package/lib/commonjs/ui/hooks/queries/usePaymentQueries.js.map +1 -1
  19. package/lib/commonjs/ui/hooks/queries/useServicesQueries.js +8 -7
  20. package/lib/commonjs/ui/hooks/queries/useServicesQueries.js.map +1 -1
  21. package/lib/commonjs/ui/index.js +14 -0
  22. package/lib/commonjs/ui/index.js.map +1 -1
  23. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +11 -6
  24. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  25. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +3 -3
  26. package/lib/commonjs/ui/screens/CreateAccountScreen.js +6 -4
  27. package/lib/commonjs/ui/screens/CreateAccountScreen.js.map +1 -1
  28. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +8 -7
  29. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
  30. package/lib/commonjs/ui/screens/FileManagementScreen.js +13 -13
  31. package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
  32. package/lib/commonjs/ui/screens/HistoryViewScreen.js +7 -7
  33. package/lib/commonjs/ui/screens/HistoryViewScreen.js.map +1 -1
  34. package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +5 -5
  35. package/lib/commonjs/ui/screens/LanguageSelectorScreen.js.map +1 -1
  36. package/lib/commonjs/ui/screens/ManageAccountScreen.js +17 -18
  37. package/lib/commonjs/ui/screens/ManageAccountScreen.js.map +1 -1
  38. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +3 -3
  39. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  40. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +9 -9
  41. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
  42. package/lib/commonjs/ui/screens/ProfileScreen.js +1 -1
  43. package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
  44. package/lib/commonjs/ui/screens/SavesCollectionsScreen.js +4 -4
  45. package/lib/commonjs/ui/screens/SavesCollectionsScreen.js.map +1 -1
  46. package/lib/commonjs/ui/screens/SearchSettingsScreen.js +6 -6
  47. package/lib/commonjs/ui/screens/SearchSettingsScreen.js.map +1 -1
  48. package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js +6 -6
  49. package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js.map +1 -1
  50. package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js +4 -4
  51. package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js.map +1 -1
  52. package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js +4 -4
  53. package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js.map +1 -1
  54. package/lib/commonjs/ui/utils/activeAuthuser.js +76 -8
  55. package/lib/commonjs/ui/utils/activeAuthuser.js.map +1 -1
  56. package/lib/module/index.js +5 -5
  57. package/lib/module/index.js.map +1 -1
  58. package/lib/module/ui/components/AccountMenuButton.js +8 -10
  59. package/lib/module/ui/components/AccountMenuButton.js.map +1 -1
  60. package/lib/module/ui/components/AccountSwitcher.js +65 -35
  61. package/lib/module/ui/components/AccountSwitcher.js.map +1 -1
  62. package/lib/module/ui/components/ProfileButton.js +228 -0
  63. package/lib/module/ui/components/ProfileButton.js.map +1 -0
  64. package/lib/module/ui/components/ProfileMenu.js +370 -0
  65. package/lib/module/ui/components/ProfileMenu.js.map +1 -0
  66. package/lib/module/ui/context/OxyContext.js +214 -102
  67. package/lib/module/ui/context/OxyContext.js.map +1 -1
  68. package/lib/module/ui/context/hooks/useAuthOperations.js +29 -2
  69. package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
  70. package/lib/module/ui/hooks/queries/useAccountQueries.js +2 -2
  71. package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
  72. package/lib/module/ui/hooks/queries/usePaymentQueries.js +12 -12
  73. package/lib/module/ui/hooks/queries/usePaymentQueries.js.map +1 -1
  74. package/lib/module/ui/hooks/queries/useServicesQueries.js +9 -7
  75. package/lib/module/ui/hooks/queries/useServicesQueries.js.map +1 -1
  76. package/lib/module/ui/index.js +2 -0
  77. package/lib/module/ui/index.js.map +1 -1
  78. package/lib/module/ui/screens/AccountSettingsScreen.js +11 -6
  79. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  80. package/lib/module/ui/screens/AccountSwitcherScreen.js +3 -3
  81. package/lib/module/ui/screens/CreateAccountScreen.js +6 -4
  82. package/lib/module/ui/screens/CreateAccountScreen.js.map +1 -1
  83. package/lib/module/ui/screens/EditProfileFieldScreen.js +8 -7
  84. package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
  85. package/lib/module/ui/screens/FileManagementScreen.js +13 -13
  86. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  87. package/lib/module/ui/screens/HistoryViewScreen.js +7 -7
  88. package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
  89. package/lib/module/ui/screens/LanguageSelectorScreen.js +5 -5
  90. package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -1
  91. package/lib/module/ui/screens/ManageAccountScreen.js +17 -18
  92. package/lib/module/ui/screens/ManageAccountScreen.js.map +1 -1
  93. package/lib/module/ui/screens/PremiumSubscriptionScreen.js +3 -3
  94. package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  95. package/lib/module/ui/screens/PrivacySettingsScreen.js +9 -9
  96. package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
  97. package/lib/module/ui/screens/ProfileScreen.js +1 -1
  98. package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
  99. package/lib/module/ui/screens/SavesCollectionsScreen.js +4 -4
  100. package/lib/module/ui/screens/SavesCollectionsScreen.js.map +1 -1
  101. package/lib/module/ui/screens/SearchSettingsScreen.js +6 -6
  102. package/lib/module/ui/screens/SearchSettingsScreen.js.map +1 -1
  103. package/lib/module/ui/screens/WelcomeNewUserScreen.js +6 -6
  104. package/lib/module/ui/screens/WelcomeNewUserScreen.js.map +1 -1
  105. package/lib/module/ui/screens/trust/TrustCenterScreen.js +4 -4
  106. package/lib/module/ui/screens/trust/TrustCenterScreen.js.map +1 -1
  107. package/lib/module/ui/screens/trust/TrustRewardsScreen.js +4 -4
  108. package/lib/module/ui/screens/trust/TrustRewardsScreen.js.map +1 -1
  109. package/lib/module/ui/utils/activeAuthuser.js +74 -9
  110. package/lib/module/ui/utils/activeAuthuser.js.map +1 -1
  111. package/lib/typescript/commonjs/index.d.ts +4 -1
  112. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  113. package/lib/typescript/commonjs/ui/components/AccountMenuButton.d.ts +5 -7
  114. package/lib/typescript/commonjs/ui/components/AccountMenuButton.d.ts.map +1 -1
  115. package/lib/typescript/commonjs/ui/components/AccountSwitcher.d.ts.map +1 -1
  116. package/lib/typescript/commonjs/ui/components/ActivityIndicator.d.ts +1 -1
  117. package/lib/typescript/commonjs/ui/components/ActivityIndicator.d.ts.map +1 -1
  118. package/lib/typescript/commonjs/ui/components/CrossFadeIcon.d.ts +2 -1
  119. package/lib/typescript/commonjs/ui/components/CrossFadeIcon.d.ts.map +1 -1
  120. package/lib/typescript/commonjs/ui/components/FontLoader.d.ts +1 -1
  121. package/lib/typescript/commonjs/ui/components/FontLoader.d.ts.map +1 -1
  122. package/lib/typescript/commonjs/ui/components/HelperText.d.ts +1 -1
  123. package/lib/typescript/commonjs/ui/components/HelperText.d.ts.map +1 -1
  124. package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts +46 -0
  125. package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts.map +1 -0
  126. package/lib/typescript/commonjs/ui/components/ProfileMenu.d.ts +39 -0
  127. package/lib/typescript/commonjs/ui/components/ProfileMenu.d.ts.map +1 -0
  128. package/lib/typescript/commonjs/ui/components/TextField/Addons/Outline.d.ts +2 -1
  129. package/lib/typescript/commonjs/ui/components/TextField/Addons/Outline.d.ts.map +1 -1
  130. package/lib/typescript/commonjs/ui/components/TextField/Addons/Underline.d.ts +2 -1
  131. package/lib/typescript/commonjs/ui/components/TextField/Addons/Underline.d.ts.map +1 -1
  132. package/lib/typescript/commonjs/ui/components/TextField/Adornment/TextFieldAffix.d.ts +1 -1
  133. package/lib/typescript/commonjs/ui/components/TextField/Adornment/TextFieldIcon.d.ts +1 -1
  134. package/lib/typescript/commonjs/ui/components/TextField/Label/InputLabel.d.ts +1 -1
  135. package/lib/typescript/commonjs/ui/components/TextField/Label/LabelBackground.d.ts +2 -1
  136. package/lib/typescript/commonjs/ui/components/TextField/Label/LabelBackground.d.ts.map +1 -1
  137. package/lib/typescript/commonjs/ui/components/TextField/TextFieldFlat.d.ts +2 -1
  138. package/lib/typescript/commonjs/ui/components/TextField/TextFieldFlat.d.ts.map +1 -1
  139. package/lib/typescript/commonjs/ui/components/TextField/TextFieldOutlined.d.ts +2 -1
  140. package/lib/typescript/commonjs/ui/components/TextField/TextFieldOutlined.d.ts.map +1 -1
  141. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +11 -26
  142. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  143. package/lib/typescript/commonjs/ui/context/ThemeContext.d.ts +1 -1
  144. package/lib/typescript/commonjs/ui/context/ThemeContext.d.ts.map +1 -1
  145. package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  146. package/lib/typescript/commonjs/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
  147. package/lib/typescript/commonjs/ui/index.d.ts +2 -0
  148. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  149. package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  150. package/lib/typescript/commonjs/ui/screens/AccountSwitcherScreen.d.ts +3 -3
  151. package/lib/typescript/commonjs/ui/screens/CreateAccountScreen.d.ts.map +1 -1
  152. package/lib/typescript/commonjs/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
  153. package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts.map +1 -1
  154. package/lib/typescript/commonjs/ui/utils/activeAuthuser.d.ts +24 -0
  155. package/lib/typescript/commonjs/ui/utils/activeAuthuser.d.ts.map +1 -1
  156. package/lib/typescript/module/index.d.ts +64 -61
  157. package/lib/typescript/module/index.d.ts.map +1 -1
  158. package/lib/typescript/module/ui/client.d.ts +26 -26
  159. package/lib/typescript/module/ui/client.d.ts.map +1 -1
  160. package/lib/typescript/module/ui/components/AccountMenuButton.d.ts +5 -7
  161. package/lib/typescript/module/ui/components/AccountMenuButton.d.ts.map +1 -1
  162. package/lib/typescript/module/ui/components/AccountSwitcher.d.ts +1 -1
  163. package/lib/typescript/module/ui/components/AccountSwitcher.d.ts.map +1 -1
  164. package/lib/typescript/module/ui/components/ActivityIndicator.d.ts +2 -2
  165. package/lib/typescript/module/ui/components/ActivityIndicator.d.ts.map +1 -1
  166. package/lib/typescript/module/ui/components/BottomSheetRouter.d.ts +1 -1
  167. package/lib/typescript/module/ui/components/BottomSheetRouter.d.ts.map +1 -1
  168. package/lib/typescript/module/ui/components/CrossFadeIcon.d.ts +4 -3
  169. package/lib/typescript/module/ui/components/CrossFadeIcon.d.ts.map +1 -1
  170. package/lib/typescript/module/ui/components/FontLoader.d.ts +1 -1
  171. package/lib/typescript/module/ui/components/FontLoader.d.ts.map +1 -1
  172. package/lib/typescript/module/ui/components/HelperText.d.ts +1 -1
  173. package/lib/typescript/module/ui/components/HelperText.d.ts.map +1 -1
  174. package/lib/typescript/module/ui/components/Icon.d.ts +1 -1
  175. package/lib/typescript/module/ui/components/Icon.d.ts.map +1 -1
  176. package/lib/typescript/module/ui/components/IconButton/IconButton.d.ts +3 -3
  177. package/lib/typescript/module/ui/components/IconButton/IconButton.d.ts.map +1 -1
  178. package/lib/typescript/module/ui/components/IconButton/utils.d.ts +1 -1
  179. package/lib/typescript/module/ui/components/IconButton/utils.d.ts.map +1 -1
  180. package/lib/typescript/module/ui/components/OxyPayButton.d.ts +1 -1
  181. package/lib/typescript/module/ui/components/OxyPayButton.d.ts.map +1 -1
  182. package/lib/typescript/module/ui/components/OxyProvider.d.ts +1 -1
  183. package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
  184. package/lib/typescript/module/ui/components/ProfileButton.d.ts +46 -0
  185. package/lib/typescript/module/ui/components/ProfileButton.d.ts.map +1 -0
  186. package/lib/typescript/module/ui/components/ProfileMenu.d.ts +39 -0
  187. package/lib/typescript/module/ui/components/ProfileMenu.d.ts.map +1 -0
  188. package/lib/typescript/module/ui/components/StepBasedScreen.d.ts +2 -2
  189. package/lib/typescript/module/ui/components/StepBasedScreen.d.ts.map +1 -1
  190. package/lib/typescript/module/ui/components/Surface.d.ts +2 -2
  191. package/lib/typescript/module/ui/components/Surface.d.ts.map +1 -1
  192. package/lib/typescript/module/ui/components/TextField/Addons/Outline.d.ts +3 -2
  193. package/lib/typescript/module/ui/components/TextField/Addons/Outline.d.ts.map +1 -1
  194. package/lib/typescript/module/ui/components/TextField/Addons/Underline.d.ts +3 -2
  195. package/lib/typescript/module/ui/components/TextField/Addons/Underline.d.ts.map +1 -1
  196. package/lib/typescript/module/ui/components/TextField/Adornment/TextFieldAdornment.d.ts +3 -3
  197. package/lib/typescript/module/ui/components/TextField/Adornment/TextFieldAdornment.d.ts.map +1 -1
  198. package/lib/typescript/module/ui/components/TextField/Adornment/TextFieldAffix.d.ts +3 -3
  199. package/lib/typescript/module/ui/components/TextField/Adornment/TextFieldAffix.d.ts.map +1 -1
  200. package/lib/typescript/module/ui/components/TextField/Adornment/TextFieldIcon.d.ts +4 -4
  201. package/lib/typescript/module/ui/components/TextField/Adornment/TextFieldIcon.d.ts.map +1 -1
  202. package/lib/typescript/module/ui/components/TextField/Adornment/types.d.ts +1 -1
  203. package/lib/typescript/module/ui/components/TextField/Adornment/types.d.ts.map +1 -1
  204. package/lib/typescript/module/ui/components/TextField/Adornment/utils.d.ts +1 -1
  205. package/lib/typescript/module/ui/components/TextField/Adornment/utils.d.ts.map +1 -1
  206. package/lib/typescript/module/ui/components/TextField/Label/InputLabel.d.ts +2 -2
  207. package/lib/typescript/module/ui/components/TextField/Label/InputLabel.d.ts.map +1 -1
  208. package/lib/typescript/module/ui/components/TextField/Label/LabelBackground.d.ts +3 -2
  209. package/lib/typescript/module/ui/components/TextField/Label/LabelBackground.d.ts.map +1 -1
  210. package/lib/typescript/module/ui/components/TextField/TextFieldFlat.d.ts +3 -2
  211. package/lib/typescript/module/ui/components/TextField/TextFieldFlat.d.ts.map +1 -1
  212. package/lib/typescript/module/ui/components/TextField/TextFieldOutlined.d.ts +3 -2
  213. package/lib/typescript/module/ui/components/TextField/TextFieldOutlined.d.ts.map +1 -1
  214. package/lib/typescript/module/ui/components/TextField/helpers.d.ts +3 -3
  215. package/lib/typescript/module/ui/components/TextField/helpers.d.ts.map +1 -1
  216. package/lib/typescript/module/ui/components/TextField/types.d.ts +1 -1
  217. package/lib/typescript/module/ui/components/TextField/types.d.ts.map +1 -1
  218. package/lib/typescript/module/ui/components/TextField.d.ts +4 -4
  219. package/lib/typescript/module/ui/components/TextField.d.ts.map +1 -1
  220. package/lib/typescript/module/ui/components/TouchableRipple/TouchableRipple.d.ts +3 -3
  221. package/lib/typescript/module/ui/components/TouchableRipple/TouchableRipple.d.ts.map +1 -1
  222. package/lib/typescript/module/ui/components/TouchableRipple/TouchableRipple.native.d.ts +3 -3
  223. package/lib/typescript/module/ui/components/TouchableRipple/TouchableRipple.native.d.ts.map +1 -1
  224. package/lib/typescript/module/ui/components/TouchableRipple/utils.d.ts +1 -1
  225. package/lib/typescript/module/ui/components/TouchableRipple/utils.d.ts.map +1 -1
  226. package/lib/typescript/module/ui/components/Typography/AnimatedText.d.ts +3 -3
  227. package/lib/typescript/module/ui/components/Typography/AnimatedText.d.ts.map +1 -1
  228. package/lib/typescript/module/ui/components/accountMenuRows.d.ts +1 -1
  229. package/lib/typescript/module/ui/components/accountMenuRows.d.ts.map +1 -1
  230. package/lib/typescript/module/ui/components/feedback/ProgressIndicator.d.ts +1 -1
  231. package/lib/typescript/module/ui/components/feedback/ProgressIndicator.d.ts.map +1 -1
  232. package/lib/typescript/module/ui/components/feedback/constants.d.ts +1 -1
  233. package/lib/typescript/module/ui/components/feedback/constants.d.ts.map +1 -1
  234. package/lib/typescript/module/ui/components/feedback/useFeedbackForm.d.ts +1 -1
  235. package/lib/typescript/module/ui/components/feedback/useFeedbackForm.d.ts.map +1 -1
  236. package/lib/typescript/module/ui/components/payment/PaymentDetailsStep.d.ts +1 -1
  237. package/lib/typescript/module/ui/components/payment/PaymentDetailsStep.d.ts.map +1 -1
  238. package/lib/typescript/module/ui/components/payment/PaymentMethodStep.d.ts +1 -1
  239. package/lib/typescript/module/ui/components/payment/PaymentMethodStep.d.ts.map +1 -1
  240. package/lib/typescript/module/ui/components/payment/PaymentReviewStep.d.ts +1 -1
  241. package/lib/typescript/module/ui/components/payment/PaymentReviewStep.d.ts.map +1 -1
  242. package/lib/typescript/module/ui/components/payment/PaymentSuccessStep.d.ts +1 -1
  243. package/lib/typescript/module/ui/components/payment/PaymentSuccessStep.d.ts.map +1 -1
  244. package/lib/typescript/module/ui/components/payment/PaymentSummaryStep.d.ts +1 -1
  245. package/lib/typescript/module/ui/components/payment/PaymentSummaryStep.d.ts.map +1 -1
  246. package/lib/typescript/module/ui/components/payment/constants.d.ts +1 -1
  247. package/lib/typescript/module/ui/components/payment/constants.d.ts.map +1 -1
  248. package/lib/typescript/module/ui/components/payment/paymentStyles.d.ts +1 -1
  249. package/lib/typescript/module/ui/components/payment/paymentStyles.d.ts.map +1 -1
  250. package/lib/typescript/module/ui/components/theming.d.ts +1 -1
  251. package/lib/typescript/module/ui/components/theming.d.ts.map +1 -1
  252. package/lib/typescript/module/ui/context/OxyContext.d.ts +14 -29
  253. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  254. package/lib/typescript/module/ui/context/ThemeContext.d.ts +1 -1
  255. package/lib/typescript/module/ui/context/ThemeContext.d.ts.map +1 -1
  256. package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts +2 -2
  257. package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  258. package/lib/typescript/module/ui/hooks/queries/usePaymentQueries.d.ts +1 -1
  259. package/lib/typescript/module/ui/hooks/queries/usePaymentQueries.d.ts.map +1 -1
  260. package/lib/typescript/module/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
  261. package/lib/typescript/module/ui/hooks/queryClient.d.ts +1 -1
  262. package/lib/typescript/module/ui/hooks/queryClient.d.ts.map +1 -1
  263. package/lib/typescript/module/ui/hooks/useAuth.d.ts +1 -1
  264. package/lib/typescript/module/ui/hooks/useAuth.d.ts.map +1 -1
  265. package/lib/typescript/module/ui/hooks/useAvatarPicker.d.ts +1 -1
  266. package/lib/typescript/module/ui/hooks/useAvatarPicker.d.ts.map +1 -1
  267. package/lib/typescript/module/ui/hooks/useLanguageManagement.d.ts +1 -1
  268. package/lib/typescript/module/ui/hooks/useLanguageManagement.d.ts.map +1 -1
  269. package/lib/typescript/module/ui/hooks/useSessionManagement.d.ts +1 -1
  270. package/lib/typescript/module/ui/hooks/useSessionManagement.d.ts.map +1 -1
  271. package/lib/typescript/module/ui/hooks/useStorage.d.ts +1 -1
  272. package/lib/typescript/module/ui/hooks/useStorage.d.ts.map +1 -1
  273. package/lib/typescript/module/ui/index.d.ts +30 -28
  274. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  275. package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts +1 -1
  276. package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts.map +1 -1
  277. package/lib/typescript/module/ui/navigation/routes.d.ts +1 -1
  278. package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
  279. package/lib/typescript/module/ui/screens/AccountMembersScreen.d.ts +1 -1
  280. package/lib/typescript/module/ui/screens/AccountMembersScreen.d.ts.map +1 -1
  281. package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts +1 -1
  282. package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  283. package/lib/typescript/module/ui/screens/AccountSwitcherScreen.d.ts +4 -4
  284. package/lib/typescript/module/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
  285. package/lib/typescript/module/ui/screens/AccountVerificationScreen.d.ts +1 -1
  286. package/lib/typescript/module/ui/screens/AccountVerificationScreen.d.ts.map +1 -1
  287. package/lib/typescript/module/ui/screens/AppInfoScreen.d.ts +1 -1
  288. package/lib/typescript/module/ui/screens/AppInfoScreen.d.ts.map +1 -1
  289. package/lib/typescript/module/ui/screens/AvatarCropScreen.d.ts +1 -1
  290. package/lib/typescript/module/ui/screens/AvatarCropScreen.d.ts.map +1 -1
  291. package/lib/typescript/module/ui/screens/ConnectedAppsScreen.d.ts +1 -1
  292. package/lib/typescript/module/ui/screens/ConnectedAppsScreen.d.ts.map +1 -1
  293. package/lib/typescript/module/ui/screens/CreateAccountScreen.d.ts +1 -1
  294. package/lib/typescript/module/ui/screens/CreateAccountScreen.d.ts.map +1 -1
  295. package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts +1 -1
  296. package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
  297. package/lib/typescript/module/ui/screens/FAQScreen.d.ts +1 -1
  298. package/lib/typescript/module/ui/screens/FAQScreen.d.ts.map +1 -1
  299. package/lib/typescript/module/ui/screens/FeedbackScreen.d.ts +1 -1
  300. package/lib/typescript/module/ui/screens/FeedbackScreen.d.ts.map +1 -1
  301. package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts +1 -1
  302. package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts.map +1 -1
  303. package/lib/typescript/module/ui/screens/FollowersListScreen.d.ts +1 -1
  304. package/lib/typescript/module/ui/screens/FollowersListScreen.d.ts.map +1 -1
  305. package/lib/typescript/module/ui/screens/FollowingListScreen.d.ts +1 -1
  306. package/lib/typescript/module/ui/screens/FollowingListScreen.d.ts.map +1 -1
  307. package/lib/typescript/module/ui/screens/HelpSupportScreen.d.ts +1 -1
  308. package/lib/typescript/module/ui/screens/HelpSupportScreen.d.ts.map +1 -1
  309. package/lib/typescript/module/ui/screens/HistoryViewScreen.d.ts +1 -1
  310. package/lib/typescript/module/ui/screens/HistoryViewScreen.d.ts.map +1 -1
  311. package/lib/typescript/module/ui/screens/LanguageSelectorScreen.d.ts +1 -1
  312. package/lib/typescript/module/ui/screens/LanguageSelectorScreen.d.ts.map +1 -1
  313. package/lib/typescript/module/ui/screens/LearnMoreUsernamesScreen.d.ts +1 -1
  314. package/lib/typescript/module/ui/screens/LearnMoreUsernamesScreen.d.ts.map +1 -1
  315. package/lib/typescript/module/ui/screens/LegalDocumentsScreen.d.ts +1 -1
  316. package/lib/typescript/module/ui/screens/LegalDocumentsScreen.d.ts.map +1 -1
  317. package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts +1 -1
  318. package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts.map +1 -1
  319. package/lib/typescript/module/ui/screens/NotificationsScreen.d.ts +1 -1
  320. package/lib/typescript/module/ui/screens/NotificationsScreen.d.ts.map +1 -1
  321. package/lib/typescript/module/ui/screens/OxyAuthScreen.d.ts +1 -1
  322. package/lib/typescript/module/ui/screens/OxyAuthScreen.d.ts.map +1 -1
  323. package/lib/typescript/module/ui/screens/PaymentGatewayScreen.d.ts +2 -2
  324. package/lib/typescript/module/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
  325. package/lib/typescript/module/ui/screens/PreferencesScreen.d.ts +1 -1
  326. package/lib/typescript/module/ui/screens/PreferencesScreen.d.ts.map +1 -1
  327. package/lib/typescript/module/ui/screens/PremiumSubscriptionScreen.d.ts +1 -1
  328. package/lib/typescript/module/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
  329. package/lib/typescript/module/ui/screens/PrivacySettingsScreen.d.ts +1 -1
  330. package/lib/typescript/module/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
  331. package/lib/typescript/module/ui/screens/ProfileScreen.d.ts +1 -1
  332. package/lib/typescript/module/ui/screens/ProfileScreen.d.ts.map +1 -1
  333. package/lib/typescript/module/ui/screens/SavesCollectionsScreen.d.ts +1 -1
  334. package/lib/typescript/module/ui/screens/SavesCollectionsScreen.d.ts.map +1 -1
  335. package/lib/typescript/module/ui/screens/SearchSettingsScreen.d.ts +1 -1
  336. package/lib/typescript/module/ui/screens/SearchSettingsScreen.d.ts.map +1 -1
  337. package/lib/typescript/module/ui/screens/UserLinksScreen.d.ts +1 -1
  338. package/lib/typescript/module/ui/screens/UserLinksScreen.d.ts.map +1 -1
  339. package/lib/typescript/module/ui/screens/UserListScreen.d.ts +1 -1
  340. package/lib/typescript/module/ui/screens/UserListScreen.d.ts.map +1 -1
  341. package/lib/typescript/module/ui/screens/WelcomeNewUserScreen.d.ts +1 -1
  342. package/lib/typescript/module/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -1
  343. package/lib/typescript/module/ui/screens/trust/TrustAboutScreen.d.ts +1 -1
  344. package/lib/typescript/module/ui/screens/trust/TrustAboutScreen.d.ts.map +1 -1
  345. package/lib/typescript/module/ui/screens/trust/TrustCenterScreen.d.ts +1 -1
  346. package/lib/typescript/module/ui/screens/trust/TrustCenterScreen.d.ts.map +1 -1
  347. package/lib/typescript/module/ui/screens/trust/TrustFAQScreen.d.ts +1 -1
  348. package/lib/typescript/module/ui/screens/trust/TrustFAQScreen.d.ts.map +1 -1
  349. package/lib/typescript/module/ui/screens/trust/TrustLeaderboardScreen.d.ts +1 -1
  350. package/lib/typescript/module/ui/screens/trust/TrustLeaderboardScreen.d.ts.map +1 -1
  351. package/lib/typescript/module/ui/screens/trust/TrustRewardsScreen.d.ts +1 -1
  352. package/lib/typescript/module/ui/screens/trust/TrustRewardsScreen.d.ts.map +1 -1
  353. package/lib/typescript/module/ui/screens/trust/TrustRulesScreen.d.ts +1 -1
  354. package/lib/typescript/module/ui/screens/trust/TrustRulesScreen.d.ts.map +1 -1
  355. package/lib/typescript/module/ui/server.d.ts +2 -2
  356. package/lib/typescript/module/ui/server.d.ts.map +1 -1
  357. package/lib/typescript/module/ui/types/fileManagement.d.ts +1 -1
  358. package/lib/typescript/module/ui/types/fileManagement.d.ts.map +1 -1
  359. package/lib/typescript/module/ui/types/navigation.d.ts +1 -1
  360. package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
  361. package/lib/typescript/module/ui/utils/activeAuthuser.d.ts +24 -0
  362. package/lib/typescript/module/ui/utils/activeAuthuser.d.ts.map +1 -1
  363. package/lib/typescript/module/ui/utils/fileManagement.d.ts +1 -1
  364. package/lib/typescript/module/ui/utils/fileManagement.d.ts.map +1 -1
  365. package/package.json +21 -20
  366. package/src/index.ts +8 -5
  367. package/src/ui/components/AccountMenuButton.tsx +9 -11
  368. package/src/ui/components/AccountSwitcher.tsx +71 -37
  369. package/src/ui/components/ProfileButton.tsx +270 -0
  370. package/src/ui/components/ProfileMenu.tsx +416 -0
  371. package/src/ui/context/OxyContext.tsx +217 -130
  372. package/src/ui/context/hooks/useAuthOperations.ts +35 -2
  373. package/src/ui/hooks/queries/useAccountQueries.ts +2 -2
  374. package/src/ui/hooks/queries/usePaymentQueries.ts +12 -12
  375. package/src/ui/hooks/queries/useServicesQueries.ts +9 -6
  376. package/src/ui/index.ts +2 -0
  377. package/src/ui/screens/AccountSettingsScreen.tsx +9 -5
  378. package/src/ui/screens/AccountSwitcherScreen.tsx +3 -3
  379. package/src/ui/screens/CreateAccountScreen.tsx +6 -4
  380. package/src/ui/screens/EditProfileFieldScreen.tsx +8 -7
  381. package/src/ui/screens/FileManagementScreen.tsx +13 -13
  382. package/src/ui/screens/HistoryViewScreen.tsx +7 -7
  383. package/src/ui/screens/LanguageSelectorScreen.tsx +5 -5
  384. package/src/ui/screens/ManageAccountScreen.tsx +17 -18
  385. package/src/ui/screens/PremiumSubscriptionScreen.tsx +3 -3
  386. package/src/ui/screens/PrivacySettingsScreen.tsx +9 -9
  387. package/src/ui/screens/ProfileScreen.tsx +1 -1
  388. package/src/ui/screens/SavesCollectionsScreen.tsx +5 -5
  389. package/src/ui/screens/SearchSettingsScreen.tsx +6 -6
  390. package/src/ui/screens/WelcomeNewUserScreen.tsx +6 -6
  391. package/src/ui/screens/trust/TrustCenterScreen.tsx +5 -5
  392. package/src/ui/screens/trust/TrustRewardsScreen.tsx +4 -4
  393. package/src/ui/utils/__tests__/activeAuthuser.test.ts +75 -0
  394. package/src/ui/utils/activeAuthuser.ts +74 -8
  395. package/lib/commonjs/ui/components/ActiveAccountBanner.js +0 -144
  396. package/lib/commonjs/ui/components/ActiveAccountBanner.js.map +0 -1
  397. package/lib/module/ui/components/ActiveAccountBanner.js +0 -141
  398. package/lib/module/ui/components/ActiveAccountBanner.js.map +0 -1
  399. package/lib/typescript/commonjs/ui/components/ActiveAccountBanner.d.ts +0 -4
  400. package/lib/typescript/commonjs/ui/components/ActiveAccountBanner.d.ts.map +0 -1
  401. package/lib/typescript/module/ui/components/ActiveAccountBanner.d.ts +0 -4
  402. package/lib/typescript/module/ui/components/ActiveAccountBanner.d.ts.map +0 -1
  403. package/src/ui/components/ActiveAccountBanner.tsx +0 -130
@@ -1092,6 +1092,54 @@ const OxyProvider = ({
1092
1092
  }, priorSessionReadError);
1093
1093
  }
1094
1094
  }
1095
+
1096
+ // LAST-ACTIVE-ACCOUNT priority (web multi-account). When the user has an
1097
+ // explicit persisted active slot (`oxy_active_authuser`, written on every
1098
+ // device sign-in / account SWITCH / cookie restore), the multi-account
1099
+ // refresh-cookie restore is the ONLY cold-boot step that honors WHICH slot
1100
+ // was last active — `restoreViaRefreshCookie` selects it via
1101
+ // `selectActiveRefreshAccount(accounts, readActiveAuthuser())`. The
1102
+ // `fedcm-silent` and per-apex `silent-iframe` steps only ever recover the
1103
+ // PRIMARY central IdP session, so if either ran first they would clobber a
1104
+ // switched (managed/org) account back to the primary on reload — the exact
1105
+ // "switch is lost on reload" regression. So when a slot selection exists we
1106
+ // run cookie-restore BEFORE those probes (and disable the later duplicate).
1107
+ //
1108
+ // Read ONCE here (synchronously usable by the step `enabled` gates below).
1109
+ // It is non-null ONLY on first-party web apps that persist the slot. Both the
1110
+ // device sign-in/switch paths AND `handleWebSSOSession` (FedCM/SSO/credentials
1111
+ // commit funnel) now persist it — but only when the session genuinely joined
1112
+ // the device set: `establishDeviceRefreshSlot` returns an `authuser` ONLY on
1113
+ // first-party web (same registrable apex as the API), so a cross-apex RP never
1114
+ // writes a phantom slot and native has no localStorage. Both therefore keep
1115
+ // their existing order untouched. The earlier `stored-session` step still runs
1116
+ // first (FIX-A latency), and when a slot exists but its cookies have all
1117
+ // lapsed, cookie-restore simply returns no accounts and the chain falls through
1118
+ // to the cross-domain fallbacks exactly as before.
1119
+ const prioritizeMultiAccount = (0, _useWebSSO.isWebBrowser)() && (0, _activeAuthuser.readActiveAuthuser)() !== null;
1120
+
1121
+ // DELIBERATELY-SIGNED-OUT gate (web): when the user pressed "Sign out", any
1122
+ // credential that can silently re-mint a session may still be live on the
1123
+ // next reload — the central IdP session (FedCM credential association /
1124
+ // per-apex `fedcm_session` cookie) AND the device refresh cookies. Since
1125
+ // PR #455 the PRIMARY web session also joins the `oxy_rt_<authuser>` device
1126
+ // set, so the un-gated cookie-restore steps would `refresh-all` that still-
1127
+ // present cookie and sign the user back in without intent — exactly the
1128
+ // "sign-out is silently undone" regression. So this flag gates EVERY
1129
+ // AUTOMATIC silent-restore cold-boot step: `stored-session`,
1130
+ // `cookie-restore-active`, `fedcm-silent`, `silent-iframe`, and
1131
+ // `cookie-restore`. The gate — not a cookie wipe — is the authority: the
1132
+ // account may stay "known" for a fast deliberate re-sign-in, but no step
1133
+ // restores it silently while the flag is set. Read the durable flag ONCE here
1134
+ // (synchronously usable by every step `enabled` gate). Any deliberate sign-in
1135
+ // (password, FedCM, account switch, device claim) clears it, so there is no
1136
+ // "stuck signed out" state. The `sso-bounce` step needs no extra gate: it is
1137
+ // already self-suppressed after sign-out (its `hasPriorSession` hint is
1138
+ // cleared). `sso-return` is NOT gated — it commits the result of a deliberate
1139
+ // top-level `/sso` bounce the user just initiated. `shared-key-signin` is
1140
+ // native-only and the flag never sets on native (`markSignedOut` no-ops
1141
+ // off-web), so its gate would be moot; it is left untouched.
1142
+ const silentRestoreBlocked = (0, _activeAuthuser.isSilentRestoreSuppressed)();
1095
1143
  try {
1096
1144
  const outcome = await (0, _core.runColdBoot)({
1097
1145
  steps: [{
@@ -1112,12 +1160,17 @@ const OxyProvider = ({
1112
1160
  };
1113
1161
  }
1114
1162
  }, {
1115
- // 2) Stored-session bearer restore. NO `enabled` gate runs on ALL
1116
- // platforms. This is native's ONLY restore path (every web-only step
1117
- // is disabled off-browser, so native reaches exactly this) AND the
1118
- // common WEB reload winner.
1163
+ // 2) Stored-session bearer restore. Runs on ALL platforms EXCEPT when
1164
+ // the deliberately-signed-out flag is set (web only it never sets on
1165
+ // native, so native still always reaches exactly this step, its ONLY
1166
+ // restore path). This is also the common WEB reload winner.
1167
+ //
1168
+ // SIGNED-OUT GATE: after a deliberate full sign-out the stored session
1169
+ // state is cleared, so this would normally skip anyway — but the gate
1170
+ // makes that authoritative rather than incidental, so no residual
1171
+ // stored token can silently restore while the user is signed out.
1119
1172
  //
1120
- // ORDERING (FIX A): this step now runs BEFORE the slow web-only
1173
+ // ORDERING (FIX A): this step runs BEFORE the slow web-only
1121
1174
  // probes (`fedcm-silent`, `silent-iframe`, `cookie-restore`). On a
1122
1175
  // normal reload the local bearer validates in one round-trip and
1123
1176
  // wins; `runColdBoot` then short-circuits and never even evaluates
@@ -1128,6 +1181,7 @@ const OxyProvider = ({
1128
1181
  // local session this step skips and the cross-domain fallback chain
1129
1182
  // (fedcm → iframe → cookie → sso-bounce) runs exactly as before.
1130
1183
  id: 'stored-session',
1184
+ enabled: () => !silentRestoreBlocked,
1131
1185
  run: async () => {
1132
1186
  const restored = await restoreStoredSession();
1133
1187
  if (restored) {
@@ -1196,6 +1250,38 @@ const OxyProvider = ({
1196
1250
  session: true
1197
1251
  };
1198
1252
  }
1253
+ }, {
1254
+ // 2.75) LAST-ACTIVE multi-account restore (WEB, prioritized). Runs
1255
+ // ONLY when an explicit persisted slot selection exists
1256
+ // (`prioritizeMultiAccount`) — i.e. the user previously signed in or
1257
+ // SWITCHED accounts on this first-party app. It runs BEFORE the
1258
+ // `fedcm-silent` / `silent-iframe` probes (which only ever recover the
1259
+ // PRIMARY central session) so a switched managed/org account survives
1260
+ // reload instead of being clobbered back to the primary. The restore
1261
+ // itself is the SAME `restoreViaRefreshCookie` as the terminal-tier
1262
+ // step below: it rotates every device-local `oxy_rt_<authuser>` cookie
1263
+ // and picks the persisted slot via `selectActiveRefreshAccount`,
1264
+ // committing it (token + state + durable persistence + `markAuthResolved`).
1265
+ // When no slot is persisted this is disabled and the original order is
1266
+ // unchanged; when the slot's cookies have lapsed it returns no accounts
1267
+ // and the chain falls through to the cross-domain fallbacks below.
1268
+ //
1269
+ // SIGNED-OUT GATE: since PR #455 the primary's `oxy_rt` slot survives a
1270
+ // deliberate sign-out, so without this gate `refresh-all` would re-mint
1271
+ // and silently re-log-in the user on reload. The flag is cleared by any
1272
+ // deliberate sign-in (including an account SWITCH, which also writes the
1273
+ // new active slot), so the switch-survives-reload path is unaffected.
1274
+ id: 'cookie-restore-active',
1275
+ enabled: () => prioritizeMultiAccount && !silentRestoreBlocked,
1276
+ run: async () => {
1277
+ const restored = await restoreViaRefreshCookie();
1278
+ return restored ? {
1279
+ kind: 'session',
1280
+ session: true
1281
+ } : {
1282
+ kind: 'skip'
1283
+ };
1284
+ }
1199
1285
  }, {
1200
1286
  // 3) FedCM silent reauthn (Chrome) against the CENTRAL IdP
1201
1287
  // (auth.oxy.so). `silentSignInWithFedCM` plants the access token
@@ -1208,7 +1294,7 @@ const OxyProvider = ({
1208
1294
  // already recovered a local session — the probe cannot improve on a
1209
1295
  // valid local bearer, and skipping it avoids the silent round-trip.
1210
1296
  id: 'fedcm-silent',
1211
- enabled: () => !storedSessionRestored && fedcmSupported && !servicesSilentAttempted.has(silentKey),
1297
+ enabled: () => !storedSessionRestored && !silentRestoreBlocked && fedcmSupported && !servicesSilentAttempted.has(silentKey),
1212
1298
  run: async () => {
1213
1299
  servicesSilentAttempted.add(silentKey);
1214
1300
  const session = await oxyServices.silentSignInWithFedCM?.();
@@ -1247,7 +1333,7 @@ const OxyProvider = ({
1247
1333
  // FIX-D: bounded by `SILENT_IFRAME_TIMEOUT` (plus `iframe.onerror`
1248
1334
  // fail-fast in core) so a no-message iframe cannot stall cold boot.
1249
1335
  id: 'silent-iframe',
1250
- enabled: () => !storedSessionRestored && (0, _useWebSSO.isWebBrowser)(),
1336
+ enabled: () => !storedSessionRestored && !silentRestoreBlocked && (0, _useWebSSO.isWebBrowser)(),
1251
1337
  run: async () => {
1252
1338
  if (!commitWebSession) {
1253
1339
  return {
@@ -1279,8 +1365,20 @@ const OxyProvider = ({
1279
1365
  // is correct; cross-domain restore is handled by the SSO bounce.
1280
1366
  // FIX-D: `restoreViaRefreshCookie` bounds the request with
1281
1367
  // `COOKIE_RESTORE_TIMEOUT` so a cross-domain stall cannot hang here.
1368
+ //
1369
+ // Disabled when `prioritizeMultiAccount` already ran the
1370
+ // `cookie-restore-active` step above (an explicit persisted slot) — that
1371
+ // earlier step is the identical restore, so this terminal-tier copy
1372
+ // would be a redundant second `refreshAllSessions`. It still runs in the
1373
+ // common no-persisted-slot case (e.g. first visit to a first-party app
1374
+ // whose central refresh cookies already exist).
1375
+ //
1376
+ // SIGNED-OUT GATE (same rationale as `cookie-restore-active`): the
1377
+ // primary's `oxy_rt` slot survives a deliberate sign-out (PR #455), so
1378
+ // this must be skipped while the signed-out flag is set or it would
1379
+ // silently re-restore the primary on reload.
1282
1380
  id: 'cookie-restore',
1283
- enabled: () => (0, _useWebSSO.isWebBrowser)(),
1381
+ enabled: () => (0, _useWebSSO.isWebBrowser)() && !prioritizeMultiAccount && !silentRestoreBlocked,
1284
1382
  run: async () => {
1285
1383
  const restored = await restoreViaRefreshCookie();
1286
1384
  return restored ? {
@@ -1520,13 +1618,48 @@ const OxyProvider = ({
1520
1618
  throw new Error('Session response did not include an access token');
1521
1619
  }
1522
1620
  oxyServices.httpService.setTokens(session.accessToken);
1621
+
1622
+ // A committed web session re-enables automatic silent restore: clear the
1623
+ // durable "deliberately signed out" flag. This funnel is reached by deliberate
1624
+ // sign-ins (password, interactive FedCM, `/sso` return) AND by the silent
1625
+ // cold-boot steps — but those are GATED on the flag, so when it is set they
1626
+ // never run and never reach here; clearing is therefore only hit on a genuine
1627
+ // (re-)sign-in or when restore was already permitted, both correct.
1628
+ (0, _activeAuthuser.clearSignedOut)();
1629
+
1630
+ // Register this primary session in the device's first-party multi-account
1631
+ // refresh-cookie set (web only). Every web primary-session restore funnels
1632
+ // through here — FedCM silent (`/fedcm/exchange`), per-apex `/auth/silent`
1633
+ // iframe, central `/sso` return, and keyless password sign-in. Of those, only
1634
+ // a same-apex `/fedcm/exchange` plants an `oxy_rt_<authuser>` slot as a side
1635
+ // effect; the cross-origin/credential-less restores (`/sso/exchange`,
1636
+ // `/auth/silent` postMessage) cannot set an `api.oxy.so` cookie at all. So
1637
+ // WITHOUT this call a web primary never joins the device set: `refresh-all`
1638
+ // returns zero accounts, and account-switch persistence + the
1639
+ // `cookie-restore-active` cold-boot step have no foundation. Calling the shared
1640
+ // `POST /auth/session` primitive here makes EVERY primary participate in the
1641
+ // set, re-plants the rotated token, and records the active `authuser` so the
1642
+ // next cold boot's `cookie-restore-active` reconciles the persisted active
1643
+ // (possibly switched) account instead of `fedcm-silent` clobbering it back to
1644
+ // the primary. Best-effort: a `null` result (native / transient failure)
1645
+ // leaves the in-session token untouched.
1646
+ const primaryAuthuser = await oxyServices.establishDeviceRefreshSlot();
1647
+ // A non-null slot is returned ONLY on first-party web (the helper gates on
1648
+ // platform + same registrable apex), so recording the active slot here is safe
1649
+ // and never writes a phantom authuser for a cross-apex RP or native.
1650
+ if (typeof primaryAuthuser === 'number') {
1651
+ (0, _activeAuthuser.writeActiveAuthuser)(primaryAuthuser);
1652
+ }
1523
1653
  const clientSession = {
1524
1654
  sessionId: session.sessionId,
1525
1655
  deviceId: session.deviceId || '',
1526
1656
  expiresAt: session.expiresAt || new Date(Date.now() + DEFAULT_SESSION_VALIDITY_MS).toISOString(),
1527
1657
  lastActive: new Date().toISOString(),
1528
1658
  userId: session.user.id?.toString() ?? '',
1529
- isCurrent: true
1659
+ isCurrent: true,
1660
+ ...(typeof primaryAuthuser === 'number' ? {
1661
+ authuser: primaryAuthuser
1662
+ } : null)
1530
1663
  };
1531
1664
  updateSessions([clientSession], {
1532
1665
  merge: true
@@ -1761,42 +1894,8 @@ const OxyProvider = ({
1761
1894
  });
1762
1895
 
1763
1896
  // --- Account graph state ---
1764
- const [actingAs, setActingAsState] = (0, _react.useState)(null);
1765
1897
  const [accounts, setAccounts] = (0, _react.useState)([]);
1766
1898
 
1767
- // Latest `actingAs`, mirrored into a ref so `refreshAccounts` can reconcile a
1768
- // stale switch without taking `actingAs` as a dependency (which would re-run
1769
- // the account load on every switch). See the reconciliation block below.
1770
- const actingAsRef = (0, _react.useRef)(actingAs);
1771
- actingAsRef.current = actingAs;
1772
- // `setActingAs` is declared after `refreshAccounts`; route the reconciliation
1773
- // clear through a ref so the load callback can call the latest implementation.
1774
- const setActingAsRef = (0, _react.useRef)(null);
1775
-
1776
- // Restore actingAs from storage on startup
1777
- (0, _react.useEffect)(() => {
1778
- if (!storage || !initialized) return;
1779
- let mounted = true;
1780
- (async () => {
1781
- try {
1782
- const stored = await storage.getItem(`${storageKeyPrefix}_acting_as`);
1783
- if (mounted && stored) {
1784
- setActingAsState(stored);
1785
- oxyServices.setActingAs(stored);
1786
- }
1787
- } catch (err) {
1788
- if (__DEV__) {
1789
- _core.logger.debug('Failed to restore actingAs from storage', {
1790
- component: 'OxyContext'
1791
- }, err);
1792
- }
1793
- }
1794
- })();
1795
- return () => {
1796
- mounted = false;
1797
- };
1798
- }, [storage, initialized, storageKeyPrefix, oxyServices]);
1799
-
1800
1899
  // Load the unified account graph when authenticated
1801
1900
  const refreshAccounts = (0, _react.useCallback)(async () => {
1802
1901
  if (!isAuthenticated || !tokenReady || !oxyServices.getAccessToken()) {
@@ -1806,15 +1905,6 @@ const OxyProvider = ({
1806
1905
  try {
1807
1906
  const list = await oxyServices.listAccounts();
1808
1907
  setAccounts(list);
1809
- // Reconcile a stale switch: if the active account was switched INTO an id
1810
- // that is no longer accessible (account removed/archived, or it belonged
1811
- // to a now-inactive sign-in), drop back to the personal account so the
1812
- // app never keeps sending a dead `X-Acting-As` header. `list` is the
1813
- // authoritative accessible set on a successful fetch.
1814
- const current = actingAsRef.current;
1815
- if (current && !list.some(node => node.accountId === current)) {
1816
- setActingAsRef.current?.(null);
1817
- }
1818
1908
  } catch (err) {
1819
1909
  if (isUnauthorizedStatus(err)) {
1820
1910
  setAccounts([]);
@@ -1833,48 +1923,76 @@ const OxyProvider = ({
1833
1923
  refreshAccounts();
1834
1924
  }
1835
1925
  }, [isAuthenticated, initialized, tokenReady, refreshAccounts]);
1836
- const setActingAs = (0, _react.useCallback)(accountId => {
1837
- oxyServices.setActingAs(accountId);
1838
- setActingAsState(accountId);
1839
- // Switching the acting-as identity changes every server response, but React
1840
- // Query keys are not namespaced by the acting-as target, so the cache would
1841
- // otherwise keep serving the previous account's data. Invalidate everything
1842
- // so each query refetches under the new identity (the next request carries
1843
- // the updated `X-Acting-As` header). `invalidateQueries` (not `clear`) keeps
1844
- // the account list/switcher populated mid-switch instead of blanking out.
1845
- queryClient.invalidateQueries();
1846
- // Persist to storage
1847
- if (storage) {
1848
- if (accountId) {
1849
- storage.setItem(`${storageKeyPrefix}_acting_as`, accountId).catch(persistError => {
1850
- _core.logger.debug('Failed to persist acting-as account', {
1851
- component: 'OxyContext'
1852
- }, persistError);
1853
- });
1854
- } else {
1855
- storage.removeItem(`${storageKeyPrefix}_acting_as`).catch(persistError => {
1856
- _core.logger.debug('Failed to clear acting-as account', {
1857
- component: 'OxyContext'
1858
- }, persistError);
1859
- });
1926
+
1927
+ // Switch the active session INTO an account from the unified graph. In the
1928
+ // REAL-SESSION model this is identical to switching device sign-ins: mint a
1929
+ // real session for the target and make the whole app that account. The removed
1930
+ // `X-Acting-As` delegation header is gone `oxyServices.switchToAccount`
1931
+ // plants the minted access token (the refresh token is the server-set httpOnly
1932
+ // `oxy_rt_<authuser>` cookie, so the session joins the device multi-account set
1933
+ // and survives reload / `refresh-all`). We then commit the session into context
1934
+ // state the SAME way sign-in / `switchSession` do, refresh the account graph,
1935
+ // and invalidate every query so all data reloads as the new account.
1936
+ const switchToAccount = (0, _react.useCallback)(async accountId => {
1937
+ const result = await oxyServices.switchToAccount(accountId);
1938
+ if (!result?.user || !result?.sessionId) {
1939
+ throw new Error('Account switch did not return a valid session');
1940
+ }
1941
+
1942
+ // A switch is a deliberate sign-in into an account: re-enable automatic silent
1943
+ // restore by clearing any prior "deliberately signed out" flag.
1944
+ (0, _activeAuthuser.clearSignedOut)();
1945
+
1946
+ // `oxyServices.switchToAccount` already planted `result.accessToken` as the
1947
+ // active token; mirror the minted session into the multi-account store and
1948
+ // mark it current, recording the device `authuser` slot so web silent-switch
1949
+ // and the device account chooser can address it.
1950
+ const now = new Date();
1951
+ const clientSession = {
1952
+ sessionId: result.sessionId,
1953
+ deviceId: result.deviceId || '',
1954
+ expiresAt: result.expiresAt || new Date(now.getTime() + DEFAULT_SESSION_VALIDITY_MS).toISOString(),
1955
+ lastActive: now.toISOString(),
1956
+ userId: result.user.id?.toString() ?? '',
1957
+ isCurrent: true,
1958
+ ...(typeof result.authuser === 'number' ? {
1959
+ authuser: result.authuser
1960
+ } : null)
1961
+ };
1962
+ updateSessions([clientSession], {
1963
+ merge: true
1964
+ });
1965
+ setActiveSessionId(result.sessionId);
1966
+ if ((0, _useWebSSO.isWebBrowser)() && typeof result.authuser === 'number') {
1967
+ (0, _activeAuthuser.writeActiveAuthuser)(result.authuser);
1968
+ }
1969
+ await persistSessionDurably(result.sessionId);
1970
+
1971
+ // Fetch the canonical User for the new account (the switch result carries
1972
+ // only MinimalUserData); fall back to that minimal shape if the profile
1973
+ // fetch fails so the app still reflects the switched identity.
1974
+ let fullUser;
1975
+ try {
1976
+ fullUser = await oxyServices.getCurrentUser();
1977
+ } catch (profileError) {
1978
+ if (__DEV__) {
1979
+ _core.logger.debug('Failed to fetch full user after account switch; using switch result user', {
1980
+ component: 'OxyContext',
1981
+ method: 'switchToAccount'
1982
+ }, profileError);
1860
1983
  }
1984
+ fullUser = result.user;
1861
1985
  }
1862
- }, [oxyServices, storage, storageKeyPrefix, queryClient]);
1863
- setActingAsRef.current = setActingAs;
1864
-
1865
- // The account switched into, resolved from the loaded graph.
1866
- const actingAsAccount = (0, _react.useMemo)(() => {
1867
- if (!actingAs) return null;
1868
- return accounts.find(node => node.accountId === actingAs) ?? null;
1869
- }, [actingAs, accounts]);
1870
-
1871
- // The effective ACTIVE account presented across the app: the switched-into
1872
- // account's user when a switch is set and resolved, otherwise the signed-in
1873
- // user's own personal account. Derived (no effect) so identity surfaces always
1874
- // render the current account without separate syncing. Falls back to `user`
1875
- // while a just-set switch has not yet resolved in `accounts`, so the header
1876
- // never flashes empty mid-switch.
1877
- const activeAccount = (0, _react.useMemo)(() => actingAs && actingAsAccount ? actingAsAccount.account : user, [actingAs, actingAsAccount, user]);
1986
+ loginSuccess(fullUser);
1987
+ onAuthStateChange?.(fullUser);
1988
+
1989
+ // Reload the switchable account graph (the new active account's relationships
1990
+ // differ) and invalidate every query so all data refetches as the new
1991
+ // account the deviceAccounts probe re-enumerates the multi-account set so
1992
+ // the switched account now appears as a device session.
1993
+ await refreshAccounts();
1994
+ queryClient.invalidateQueries();
1995
+ }, [oxyServices, updateSessions, setActiveSessionId, persistSessionDurably, loginSuccess, onAuthStateChange, refreshAccounts, queryClient]);
1878
1996
  const createAccountFn = (0, _react.useCallback)(async data => {
1879
1997
  const account = await oxyServices.createAccount(data);
1880
1998
  await refreshAccounts();
@@ -1921,14 +2039,11 @@ const OxyProvider = ({
1921
2039
  useFollow: useFollowHook,
1922
2040
  showBottomSheet: showBottomSheetForContext,
1923
2041
  openAvatarPicker,
1924
- actingAs,
1925
2042
  accounts,
1926
- actingAsAccount,
1927
- activeAccount,
1928
- setActingAs,
2043
+ switchToAccount,
1929
2044
  refreshAccounts,
1930
2045
  createAccount: createAccountFn
1931
- }), [activeSessionId, signIn, signInWithPassword, handleWebSSOSession, currentLanguage, currentLanguageMetadata, currentLanguageName, currentNativeLanguageName, error, getDeviceSessions, hasAccessToken, canUsePrivateApi, isPrivateApiPending, getPublicKey, hasIdentity, isAuthenticated, isLoading, logout, logoutAll, logoutAllDeviceSessions, oxyServices, storageKeyPrefix, clientId, refreshSessionsWithUser, sessions, setLanguage, storage, switchSessionForContext, tokenReady, hasAccessToken, canUsePrivateApi, isPrivateApiPending, authResolved, updateDeviceName, clearAllAccountData, useFollowHook, user, showBottomSheetForContext, openAvatarPicker, actingAs, accounts, actingAsAccount, activeAccount, setActingAs, refreshAccounts, createAccountFn]);
2046
+ }), [activeSessionId, signIn, signInWithPassword, handleWebSSOSession, currentLanguage, currentLanguageMetadata, currentLanguageName, currentNativeLanguageName, error, getDeviceSessions, hasAccessToken, canUsePrivateApi, isPrivateApiPending, getPublicKey, hasIdentity, isAuthenticated, isLoading, logout, logoutAll, logoutAllDeviceSessions, oxyServices, storageKeyPrefix, clientId, refreshSessionsWithUser, sessions, setLanguage, storage, switchSessionForContext, tokenReady, hasAccessToken, canUsePrivateApi, isPrivateApiPending, authResolved, updateDeviceName, clearAllAccountData, useFollowHook, user, showBottomSheetForContext, openAvatarPicker, accounts, switchToAccount, refreshAccounts, createAccountFn]);
1932
2047
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(OxyContext.Provider, {
1933
2048
  value: contextValue,
1934
2049
  children: ssoCallbackIntercepting ? null : children
@@ -1988,11 +2103,8 @@ const LOADING_STATE = {
1988
2103
  clientId: null,
1989
2104
  oxyServices: LOADING_STATE_OXY_SERVICES,
1990
2105
  openAvatarPicker: () => {},
1991
- actingAs: null,
1992
2106
  accounts: [],
1993
- actingAsAccount: null,
1994
- activeAccount: null,
1995
- setActingAs: () => {},
2107
+ switchToAccount: () => rejectMissingProvider(),
1996
2108
  refreshAccounts: () => rejectMissingProvider(),
1997
2109
  createAccount: () => rejectMissingProvider()
1998
2110
  };