@oxyhq/services 6.10.8 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (450) hide show
  1. package/lib/commonjs/index.js +211 -49
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/ui/client.js +25 -4
  4. package/lib/commonjs/ui/client.js.map +1 -1
  5. package/lib/commonjs/ui/components/AccountMenu.js +485 -0
  6. package/lib/commonjs/ui/components/AccountMenu.js.map +1 -0
  7. package/lib/commonjs/ui/components/AccountMenuButton.js +120 -0
  8. package/lib/commonjs/ui/components/AccountMenuButton.js.map +1 -0
  9. package/lib/commonjs/ui/components/ActingAsBanner.js +2 -2
  10. package/lib/commonjs/ui/components/ActingAsBanner.js.map +1 -1
  11. package/lib/commonjs/ui/components/ProfileCard.js +2 -2
  12. package/lib/commonjs/ui/components/ProfileCard.js.map +1 -1
  13. package/lib/commonjs/ui/components/StepBasedScreen.js +2 -2
  14. package/lib/commonjs/ui/components/StepBasedScreen.js.map +1 -1
  15. package/lib/commonjs/ui/components/accountMenuRows.js +45 -0
  16. package/lib/commonjs/ui/components/accountMenuRows.js.map +1 -0
  17. package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js +5 -5
  18. package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js.map +1 -1
  19. package/lib/commonjs/ui/components/payment/PaymentMethodStep.js +3 -2
  20. package/lib/commonjs/ui/components/payment/PaymentMethodStep.js.map +1 -1
  21. package/lib/commonjs/ui/components/theming.js +2 -2
  22. package/lib/commonjs/ui/components/theming.js.map +1 -1
  23. package/lib/commonjs/ui/context/OxyContext.js +59 -131
  24. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  25. package/lib/commonjs/ui/context/hooks/useAuthOperations.js +36 -2
  26. package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
  27. package/lib/commonjs/ui/hooks/mutations/mutationKeys.js +6 -0
  28. package/lib/commonjs/ui/hooks/mutations/mutationKeys.js.map +1 -1
  29. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +138 -1
  30. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  31. package/lib/commonjs/ui/hooks/queries/queryKeys.js +67 -2
  32. package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
  33. package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +27 -2
  34. package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
  35. package/lib/commonjs/ui/hooks/useAuth.js +13 -2
  36. package/lib/commonjs/ui/hooks/useAuth.js.map +1 -1
  37. package/lib/commonjs/ui/hooks/useSessionManagement.js +30 -0
  38. package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -1
  39. package/lib/commonjs/ui/index.js +132 -85
  40. package/lib/commonjs/ui/index.js.map +1 -1
  41. package/lib/commonjs/ui/navigation/routes.js +6 -7
  42. package/lib/commonjs/ui/navigation/routes.js.map +1 -1
  43. package/lib/commonjs/ui/screens/AccountVerificationScreen.js +3 -2
  44. package/lib/commonjs/ui/screens/AccountVerificationScreen.js.map +1 -1
  45. package/lib/commonjs/ui/screens/ConnectedAppsScreen.js +202 -0
  46. package/lib/commonjs/ui/screens/ConnectedAppsScreen.js.map +1 -0
  47. package/lib/commonjs/ui/screens/CreateManagedAccountScreen.js +3 -2
  48. package/lib/commonjs/ui/screens/CreateManagedAccountScreen.js.map +1 -1
  49. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +3 -2
  50. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
  51. package/lib/commonjs/ui/screens/FAQScreen.js +7 -4
  52. package/lib/commonjs/ui/screens/FAQScreen.js.map +1 -1
  53. package/lib/commonjs/ui/screens/FeedbackScreen.js +21 -16
  54. package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
  55. package/lib/commonjs/ui/screens/HelpSupportScreen.js +3 -2
  56. package/lib/commonjs/ui/screens/HelpSupportScreen.js.map +1 -1
  57. package/lib/commonjs/ui/screens/HistoryViewScreen.js +7 -4
  58. package/lib/commonjs/ui/screens/HistoryViewScreen.js.map +1 -1
  59. package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +3 -2
  60. package/lib/commonjs/ui/screens/LanguageSelectorScreen.js.map +1 -1
  61. package/lib/commonjs/ui/screens/LegalDocumentsScreen.js +6 -4
  62. package/lib/commonjs/ui/screens/LegalDocumentsScreen.js.map +1 -1
  63. package/lib/commonjs/ui/screens/ManageAccountScreen.js +780 -0
  64. package/lib/commonjs/ui/screens/ManageAccountScreen.js.map +1 -0
  65. package/lib/commonjs/ui/screens/NotificationsScreen.js +175 -0
  66. package/lib/commonjs/ui/screens/NotificationsScreen.js.map +1 -0
  67. package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +18 -12
  68. package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -1
  69. package/lib/commonjs/ui/screens/PreferencesScreen.js +220 -0
  70. package/lib/commonjs/ui/screens/PreferencesScreen.js.map +1 -0
  71. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +14 -10
  72. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
  73. package/lib/commonjs/ui/screens/ProfileScreen.js +3 -3
  74. package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
  75. package/lib/commonjs/ui/screens/SavesCollectionsScreen.js +8 -5
  76. package/lib/commonjs/ui/screens/SavesCollectionsScreen.js.map +1 -1
  77. package/lib/commonjs/ui/screens/SearchSettingsScreen.js +6 -4
  78. package/lib/commonjs/ui/screens/SearchSettingsScreen.js.map +1 -1
  79. package/lib/commonjs/ui/screens/UserLinksScreen.js +3 -2
  80. package/lib/commonjs/ui/screens/UserLinksScreen.js.map +1 -1
  81. package/lib/commonjs/ui/screens/UserListScreen.js +2 -2
  82. package/lib/commonjs/ui/screens/UserListScreen.js.map +1 -1
  83. package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js +3 -2
  84. package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js.map +1 -1
  85. package/lib/commonjs/ui/screens/karma/KarmaFAQScreen.js +3 -2
  86. package/lib/commonjs/ui/screens/karma/KarmaFAQScreen.js.map +1 -1
  87. package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js +2 -2
  88. package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
  89. package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js +4 -3
  90. package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
  91. package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js +3 -2
  92. package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
  93. package/lib/commonjs/ui/utils/activeAuthuser.js +85 -0
  94. package/lib/commonjs/ui/utils/activeAuthuser.js.map +1 -0
  95. package/lib/module/index.js +58 -16
  96. package/lib/module/index.js.map +1 -1
  97. package/lib/module/ui/client.js +5 -3
  98. package/lib/module/ui/client.js.map +1 -1
  99. package/lib/module/ui/components/AccountMenu.js +480 -0
  100. package/lib/module/ui/components/AccountMenu.js.map +1 -0
  101. package/lib/module/ui/components/AccountMenuButton.js +115 -0
  102. package/lib/module/ui/components/AccountMenuButton.js.map +1 -0
  103. package/lib/module/ui/components/ActingAsBanner.js +2 -2
  104. package/lib/module/ui/components/ActingAsBanner.js.map +1 -1
  105. package/lib/module/ui/components/ProfileCard.js +1 -1
  106. package/lib/module/ui/components/ProfileCard.js.map +1 -1
  107. package/lib/module/ui/components/StepBasedScreen.js +1 -1
  108. package/lib/module/ui/components/StepBasedScreen.js.map +1 -1
  109. package/lib/module/ui/components/accountMenuRows.js +41 -0
  110. package/lib/module/ui/components/accountMenuRows.js.map +1 -0
  111. package/lib/module/ui/components/payment/PaymentDetailsStep.js +1 -1
  112. package/lib/module/ui/components/payment/PaymentDetailsStep.js.map +1 -1
  113. package/lib/module/ui/components/payment/PaymentMethodStep.js +1 -1
  114. package/lib/module/ui/components/payment/PaymentMethodStep.js.map +1 -1
  115. package/lib/module/ui/components/theming.js +1 -1
  116. package/lib/module/ui/components/theming.js.map +1 -1
  117. package/lib/module/ui/context/OxyContext.js +59 -131
  118. package/lib/module/ui/context/OxyContext.js.map +1 -1
  119. package/lib/module/ui/context/hooks/useAuthOperations.js +36 -2
  120. package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
  121. package/lib/module/ui/hooks/mutations/mutationKeys.js +6 -0
  122. package/lib/module/ui/hooks/mutations/mutationKeys.js.map +1 -1
  123. package/lib/module/ui/hooks/mutations/useAccountMutations.js +135 -1
  124. package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  125. package/lib/module/ui/hooks/queries/queryKeys.js +60 -1
  126. package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
  127. package/lib/module/ui/hooks/queries/useAccountQueries.js +24 -0
  128. package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
  129. package/lib/module/ui/hooks/useAuth.js +13 -2
  130. package/lib/module/ui/hooks/useAuth.js.map +1 -1
  131. package/lib/module/ui/hooks/useSessionManagement.js +30 -0
  132. package/lib/module/ui/hooks/useSessionManagement.js.map +1 -1
  133. package/lib/module/ui/index.js +34 -78
  134. package/lib/module/ui/index.js.map +1 -1
  135. package/lib/module/ui/navigation/routes.js +6 -7
  136. package/lib/module/ui/navigation/routes.js.map +1 -1
  137. package/lib/module/ui/screens/AccountVerificationScreen.js +1 -1
  138. package/lib/module/ui/screens/AccountVerificationScreen.js.map +1 -1
  139. package/lib/module/ui/screens/ConnectedAppsScreen.js +198 -0
  140. package/lib/module/ui/screens/ConnectedAppsScreen.js.map +1 -0
  141. package/lib/module/ui/screens/CreateManagedAccountScreen.js +1 -1
  142. package/lib/module/ui/screens/CreateManagedAccountScreen.js.map +1 -1
  143. package/lib/module/ui/screens/EditProfileFieldScreen.js +1 -1
  144. package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
  145. package/lib/module/ui/screens/FAQScreen.js +3 -1
  146. package/lib/module/ui/screens/FAQScreen.js.map +1 -1
  147. package/lib/module/ui/screens/FeedbackScreen.js +6 -2
  148. package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
  149. package/lib/module/ui/screens/HelpSupportScreen.js +1 -1
  150. package/lib/module/ui/screens/HelpSupportScreen.js.map +1 -1
  151. package/lib/module/ui/screens/HistoryViewScreen.js +3 -1
  152. package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
  153. package/lib/module/ui/screens/LanguageSelectorScreen.js +1 -1
  154. package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -1
  155. package/lib/module/ui/screens/LegalDocumentsScreen.js +2 -1
  156. package/lib/module/ui/screens/LegalDocumentsScreen.js.map +1 -1
  157. package/lib/module/ui/screens/ManageAccountScreen.js +775 -0
  158. package/lib/module/ui/screens/ManageAccountScreen.js.map +1 -0
  159. package/lib/module/ui/screens/NotificationsScreen.js +169 -0
  160. package/lib/module/ui/screens/NotificationsScreen.js.map +1 -0
  161. package/lib/module/ui/screens/PaymentGatewayScreen.js +9 -3
  162. package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -1
  163. package/lib/module/ui/screens/PreferencesScreen.js +214 -0
  164. package/lib/module/ui/screens/PreferencesScreen.js.map +1 -0
  165. package/lib/module/ui/screens/PrivacySettingsScreen.js +4 -1
  166. package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
  167. package/lib/module/ui/screens/ProfileScreen.js +2 -2
  168. package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
  169. package/lib/module/ui/screens/SavesCollectionsScreen.js +3 -1
  170. package/lib/module/ui/screens/SavesCollectionsScreen.js.map +1 -1
  171. package/lib/module/ui/screens/SearchSettingsScreen.js +2 -1
  172. package/lib/module/ui/screens/SearchSettingsScreen.js.map +1 -1
  173. package/lib/module/ui/screens/UserLinksScreen.js +1 -1
  174. package/lib/module/ui/screens/UserLinksScreen.js.map +1 -1
  175. package/lib/module/ui/screens/UserListScreen.js +1 -1
  176. package/lib/module/ui/screens/UserListScreen.js.map +1 -1
  177. package/lib/module/ui/screens/karma/KarmaAboutScreen.js +1 -1
  178. package/lib/module/ui/screens/karma/KarmaAboutScreen.js.map +1 -1
  179. package/lib/module/ui/screens/karma/KarmaFAQScreen.js +1 -1
  180. package/lib/module/ui/screens/karma/KarmaFAQScreen.js.map +1 -1
  181. package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
  182. package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
  183. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js +1 -1
  184. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
  185. package/lib/module/ui/screens/karma/KarmaRulesScreen.js +1 -1
  186. package/lib/module/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
  187. package/lib/module/ui/utils/activeAuthuser.js +79 -0
  188. package/lib/module/ui/utils/activeAuthuser.js.map +1 -0
  189. package/lib/typescript/commonjs/index.d.ts +23 -6
  190. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  191. package/lib/typescript/commonjs/ui/client.d.ts +7 -2
  192. package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
  193. package/lib/typescript/commonjs/ui/components/AccountMenu.d.ts +23 -0
  194. package/lib/typescript/commonjs/ui/components/AccountMenu.d.ts.map +1 -0
  195. package/lib/typescript/commonjs/ui/components/AccountMenuButton.d.ts +19 -0
  196. package/lib/typescript/commonjs/ui/components/AccountMenuButton.d.ts.map +1 -0
  197. package/lib/typescript/commonjs/ui/components/accountMenuRows.d.ts +27 -0
  198. package/lib/typescript/commonjs/ui/components/accountMenuRows.d.ts.map +1 -0
  199. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  200. package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  201. package/lib/typescript/commonjs/ui/hooks/mutations/mutationKeys.d.ts +5 -0
  202. package/lib/typescript/commonjs/ui/hooks/mutations/mutationKeys.d.ts.map +1 -1
  203. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +26 -1
  204. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  205. package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts +32 -3
  206. package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts.map +1 -1
  207. package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts +10 -1
  208. package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
  209. package/lib/typescript/commonjs/ui/hooks/useAuth.d.ts +8 -2
  210. package/lib/typescript/commonjs/ui/hooks/useAuth.d.ts.map +1 -1
  211. package/lib/typescript/commonjs/ui/hooks/useSessionManagement.d.ts.map +1 -1
  212. package/lib/typescript/commonjs/ui/index.d.ts +32 -18
  213. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  214. package/lib/typescript/commonjs/ui/navigation/routes.d.ts +1 -1
  215. package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
  216. package/lib/typescript/{module/ui/screens/AccountOverviewScreen.d.ts → commonjs/ui/screens/ConnectedAppsScreen.d.ts} +1 -1
  217. package/lib/typescript/commonjs/ui/screens/ConnectedAppsScreen.d.ts.map +1 -0
  218. package/lib/typescript/commonjs/ui/screens/FAQScreen.d.ts.map +1 -1
  219. package/lib/typescript/commonjs/ui/screens/FeedbackScreen.d.ts.map +1 -1
  220. package/lib/typescript/commonjs/ui/screens/HistoryViewScreen.d.ts.map +1 -1
  221. package/lib/typescript/commonjs/ui/screens/LegalDocumentsScreen.d.ts.map +1 -1
  222. package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts +13 -0
  223. package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts.map +1 -0
  224. package/lib/typescript/commonjs/ui/screens/{AccountOverviewScreen.d.ts → NotificationsScreen.d.ts} +1 -1
  225. package/lib/typescript/commonjs/ui/screens/NotificationsScreen.d.ts.map +1 -0
  226. package/lib/typescript/commonjs/ui/screens/PaymentGatewayScreen.d.ts +1 -1
  227. package/lib/typescript/commonjs/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
  228. package/lib/typescript/commonjs/ui/screens/{AccountSettingsScreen.d.ts → PreferencesScreen.d.ts} +2 -5
  229. package/lib/typescript/commonjs/ui/screens/PreferencesScreen.d.ts.map +1 -0
  230. package/lib/typescript/commonjs/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
  231. package/lib/typescript/commonjs/ui/screens/SavesCollectionsScreen.d.ts.map +1 -1
  232. package/lib/typescript/commonjs/ui/screens/SearchSettingsScreen.d.ts.map +1 -1
  233. package/lib/typescript/commonjs/ui/utils/activeAuthuser.d.ts +42 -0
  234. package/lib/typescript/commonjs/ui/utils/activeAuthuser.d.ts.map +1 -0
  235. package/lib/typescript/module/index.d.ts +23 -6
  236. package/lib/typescript/module/index.d.ts.map +1 -1
  237. package/lib/typescript/module/ui/client.d.ts +7 -2
  238. package/lib/typescript/module/ui/client.d.ts.map +1 -1
  239. package/lib/typescript/module/ui/components/AccountMenu.d.ts +23 -0
  240. package/lib/typescript/module/ui/components/AccountMenu.d.ts.map +1 -0
  241. package/lib/typescript/module/ui/components/AccountMenuButton.d.ts +19 -0
  242. package/lib/typescript/module/ui/components/AccountMenuButton.d.ts.map +1 -0
  243. package/lib/typescript/module/ui/components/accountMenuRows.d.ts +27 -0
  244. package/lib/typescript/module/ui/components/accountMenuRows.d.ts.map +1 -0
  245. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  246. package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  247. package/lib/typescript/module/ui/hooks/mutations/mutationKeys.d.ts +5 -0
  248. package/lib/typescript/module/ui/hooks/mutations/mutationKeys.d.ts.map +1 -1
  249. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +26 -1
  250. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  251. package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts +32 -3
  252. package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts.map +1 -1
  253. package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts +10 -1
  254. package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
  255. package/lib/typescript/module/ui/hooks/useAuth.d.ts +8 -2
  256. package/lib/typescript/module/ui/hooks/useAuth.d.ts.map +1 -1
  257. package/lib/typescript/module/ui/hooks/useSessionManagement.d.ts.map +1 -1
  258. package/lib/typescript/module/ui/index.d.ts +32 -18
  259. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  260. package/lib/typescript/module/ui/navigation/routes.d.ts +1 -1
  261. package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
  262. package/lib/typescript/module/ui/screens/{AccountSettingsScreen.d.ts → ConnectedAppsScreen.d.ts} +2 -5
  263. package/lib/typescript/module/ui/screens/ConnectedAppsScreen.d.ts.map +1 -0
  264. package/lib/typescript/module/ui/screens/FAQScreen.d.ts.map +1 -1
  265. package/lib/typescript/module/ui/screens/FeedbackScreen.d.ts.map +1 -1
  266. package/lib/typescript/module/ui/screens/HistoryViewScreen.d.ts.map +1 -1
  267. package/lib/typescript/module/ui/screens/LegalDocumentsScreen.d.ts.map +1 -1
  268. package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts +13 -0
  269. package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts.map +1 -0
  270. package/lib/typescript/module/ui/screens/NotificationsScreen.d.ts +5 -0
  271. package/lib/typescript/module/ui/screens/NotificationsScreen.d.ts.map +1 -0
  272. package/lib/typescript/module/ui/screens/PaymentGatewayScreen.d.ts +1 -1
  273. package/lib/typescript/module/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
  274. package/lib/typescript/module/ui/screens/PreferencesScreen.d.ts +5 -0
  275. package/lib/typescript/module/ui/screens/PreferencesScreen.d.ts.map +1 -0
  276. package/lib/typescript/module/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
  277. package/lib/typescript/module/ui/screens/SavesCollectionsScreen.d.ts.map +1 -1
  278. package/lib/typescript/module/ui/screens/SearchSettingsScreen.d.ts.map +1 -1
  279. package/lib/typescript/module/ui/utils/activeAuthuser.d.ts +42 -0
  280. package/lib/typescript/module/ui/utils/activeAuthuser.d.ts.map +1 -0
  281. package/package.json +20 -9
  282. package/src/index.ts +141 -47
  283. package/src/ui/client.ts +7 -2
  284. package/src/ui/components/AccountMenu.tsx +534 -0
  285. package/src/ui/components/AccountMenuButton.tsx +113 -0
  286. package/src/ui/components/ActingAsBanner.tsx +2 -2
  287. package/src/ui/components/ProfileCard.tsx +1 -1
  288. package/src/ui/components/StepBasedScreen.tsx +1 -1
  289. package/src/ui/components/accountMenuRows.ts +60 -0
  290. package/src/ui/components/payment/PaymentDetailsStep.tsx +1 -1
  291. package/src/ui/components/payment/PaymentMethodStep.tsx +1 -1
  292. package/src/ui/components/theming.tsx +1 -1
  293. package/src/ui/context/OxyContext.tsx +61 -145
  294. package/src/ui/context/hooks/useAuthOperations.ts +36 -2
  295. package/src/ui/hooks/mutations/mutationKeys.ts +11 -0
  296. package/src/ui/hooks/mutations/useAccountMutations.ts +154 -2
  297. package/src/ui/hooks/queries/queryKeys.ts +54 -4
  298. package/src/ui/hooks/queries/useAccountQueries.ts +25 -1
  299. package/src/ui/hooks/useAuth.ts +23 -4
  300. package/src/ui/hooks/useSessionManagement.ts +29 -0
  301. package/src/ui/index.ts +37 -98
  302. package/src/ui/navigation/routes.ts +9 -11
  303. package/src/ui/screens/AccountVerificationScreen.tsx +1 -1
  304. package/src/ui/screens/ConnectedAppsScreen.tsx +225 -0
  305. package/src/ui/screens/CreateManagedAccountScreen.tsx +1 -1
  306. package/src/ui/screens/EditProfileFieldScreen.tsx +1 -1
  307. package/src/ui/screens/FAQScreen.tsx +3 -1
  308. package/src/ui/screens/FeedbackScreen.tsx +6 -10
  309. package/src/ui/screens/HelpSupportScreen.tsx +1 -1
  310. package/src/ui/screens/HistoryViewScreen.tsx +3 -1
  311. package/src/ui/screens/LanguageSelectorScreen.tsx +1 -1
  312. package/src/ui/screens/LegalDocumentsScreen.tsx +2 -1
  313. package/src/ui/screens/ManageAccountScreen.tsx +1102 -0
  314. package/src/ui/screens/NotificationsScreen.tsx +189 -0
  315. package/src/ui/screens/PaymentGatewayScreen.tsx +10 -12
  316. package/src/ui/screens/PreferencesScreen.tsx +263 -0
  317. package/src/ui/screens/PrivacySettingsScreen.tsx +4 -1
  318. package/src/ui/screens/ProfileScreen.tsx +2 -2
  319. package/src/ui/screens/SavesCollectionsScreen.tsx +3 -1
  320. package/src/ui/screens/SearchSettingsScreen.tsx +2 -1
  321. package/src/ui/screens/UserLinksScreen.tsx +1 -1
  322. package/src/ui/screens/UserListScreen.tsx +1 -1
  323. package/src/ui/screens/karma/KarmaAboutScreen.tsx +1 -1
  324. package/src/ui/screens/karma/KarmaFAQScreen.tsx +1 -1
  325. package/src/ui/screens/karma/KarmaLeaderboardScreen.tsx +1 -1
  326. package/src/ui/screens/karma/KarmaRewardsScreen.tsx +1 -1
  327. package/src/ui/screens/karma/KarmaRulesScreen.tsx +1 -1
  328. package/src/ui/utils/activeAuthuser.ts +78 -0
  329. package/lib/commonjs/ui/components/feedback/index.js +0 -54
  330. package/lib/commonjs/ui/components/feedback/index.js.map +0 -1
  331. package/lib/commonjs/ui/components/icon/index.js +0 -21
  332. package/lib/commonjs/ui/components/icon/index.js.map +0 -1
  333. package/lib/commonjs/ui/components/index.js +0 -104
  334. package/lib/commonjs/ui/components/index.js.map +0 -1
  335. package/lib/commonjs/ui/components/modals/index.js +0 -14
  336. package/lib/commonjs/ui/components/modals/index.js.map +0 -1
  337. package/lib/commonjs/ui/components/payment/index.js +0 -80
  338. package/lib/commonjs/ui/components/payment/index.js.map +0 -1
  339. package/lib/commonjs/ui/hooks/index.js +0 -92
  340. package/lib/commonjs/ui/hooks/index.js.map +0 -1
  341. package/lib/commonjs/ui/hooks/mutations/index.js +0 -68
  342. package/lib/commonjs/ui/hooks/mutations/index.js.map +0 -1
  343. package/lib/commonjs/ui/hooks/queries/index.js +0 -155
  344. package/lib/commonjs/ui/hooks/queries/index.js.map +0 -1
  345. package/lib/commonjs/ui/screens/AccountCenterScreen.js +0 -344
  346. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +0 -1
  347. package/lib/commonjs/ui/screens/AccountOverviewScreen.js +0 -724
  348. package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +0 -1
  349. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +0 -643
  350. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +0 -1
  351. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +0 -1029
  352. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +0 -1
  353. package/lib/commonjs/ui/screens/SessionManagementScreen.js +0 -512
  354. package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +0 -1
  355. package/lib/commonjs/ui/styles/index.js +0 -39
  356. package/lib/commonjs/ui/styles/index.js.map +0 -1
  357. package/lib/module/ui/components/feedback/index.js +0 -8
  358. package/lib/module/ui/components/feedback/index.js.map +0 -1
  359. package/lib/module/ui/components/icon/index.js +0 -5
  360. package/lib/module/ui/components/icon/index.js.map +0 -1
  361. package/lib/module/ui/components/index.js +0 -18
  362. package/lib/module/ui/components/index.js.map +0 -1
  363. package/lib/module/ui/components/modals/index.js +0 -4
  364. package/lib/module/ui/components/modals/index.js.map +0 -1
  365. package/lib/module/ui/components/payment/index.js +0 -10
  366. package/lib/module/ui/components/payment/index.js.map +0 -1
  367. package/lib/module/ui/hooks/index.js +0 -11
  368. package/lib/module/ui/hooks/index.js.map +0 -1
  369. package/lib/module/ui/hooks/mutations/index.js +0 -15
  370. package/lib/module/ui/hooks/mutations/index.js.map +0 -1
  371. package/lib/module/ui/hooks/queries/index.js +0 -26
  372. package/lib/module/ui/hooks/queries/index.js.map +0 -1
  373. package/lib/module/ui/screens/AccountCenterScreen.js +0 -339
  374. package/lib/module/ui/screens/AccountCenterScreen.js.map +0 -1
  375. package/lib/module/ui/screens/AccountOverviewScreen.js +0 -719
  376. package/lib/module/ui/screens/AccountOverviewScreen.js.map +0 -1
  377. package/lib/module/ui/screens/AccountSettingsScreen.js +0 -638
  378. package/lib/module/ui/screens/AccountSettingsScreen.js.map +0 -1
  379. package/lib/module/ui/screens/AccountSwitcherScreen.js +0 -1024
  380. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +0 -1
  381. package/lib/module/ui/screens/SessionManagementScreen.js +0 -508
  382. package/lib/module/ui/screens/SessionManagementScreen.js.map +0 -1
  383. package/lib/module/ui/styles/index.js +0 -6
  384. package/lib/module/ui/styles/index.js.map +0 -1
  385. package/lib/typescript/commonjs/ui/components/feedback/index.d.ts +0 -7
  386. package/lib/typescript/commonjs/ui/components/feedback/index.d.ts.map +0 -1
  387. package/lib/typescript/commonjs/ui/components/icon/index.d.ts +0 -4
  388. package/lib/typescript/commonjs/ui/components/icon/index.d.ts.map +0 -1
  389. package/lib/typescript/commonjs/ui/components/index.d.ts +0 -13
  390. package/lib/typescript/commonjs/ui/components/index.d.ts.map +0 -1
  391. package/lib/typescript/commonjs/ui/components/modals/index.d.ts +0 -2
  392. package/lib/typescript/commonjs/ui/components/modals/index.d.ts.map +0 -1
  393. package/lib/typescript/commonjs/ui/components/payment/index.d.ts +0 -9
  394. package/lib/typescript/commonjs/ui/components/payment/index.d.ts.map +0 -1
  395. package/lib/typescript/commonjs/ui/hooks/index.d.ts +0 -9
  396. package/lib/typescript/commonjs/ui/hooks/index.d.ts.map +0 -1
  397. package/lib/typescript/commonjs/ui/hooks/mutations/index.d.ts +0 -9
  398. package/lib/typescript/commonjs/ui/hooks/mutations/index.d.ts.map +0 -1
  399. package/lib/typescript/commonjs/ui/hooks/queries/index.d.ts +0 -13
  400. package/lib/typescript/commonjs/ui/hooks/queries/index.d.ts.map +0 -1
  401. package/lib/typescript/commonjs/ui/screens/AccountCenterScreen.d.ts +0 -5
  402. package/lib/typescript/commonjs/ui/screens/AccountCenterScreen.d.ts.map +0 -1
  403. package/lib/typescript/commonjs/ui/screens/AccountOverviewScreen.d.ts.map +0 -1
  404. package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +0 -1
  405. package/lib/typescript/commonjs/ui/screens/AccountSwitcherScreen.d.ts +0 -5
  406. package/lib/typescript/commonjs/ui/screens/AccountSwitcherScreen.d.ts.map +0 -1
  407. package/lib/typescript/commonjs/ui/screens/SessionManagementScreen.d.ts +0 -5
  408. package/lib/typescript/commonjs/ui/screens/SessionManagementScreen.d.ts.map +0 -1
  409. package/lib/typescript/commonjs/ui/styles/index.d.ts +0 -4
  410. package/lib/typescript/commonjs/ui/styles/index.d.ts.map +0 -1
  411. package/lib/typescript/module/ui/components/feedback/index.d.ts +0 -7
  412. package/lib/typescript/module/ui/components/feedback/index.d.ts.map +0 -1
  413. package/lib/typescript/module/ui/components/icon/index.d.ts +0 -4
  414. package/lib/typescript/module/ui/components/icon/index.d.ts.map +0 -1
  415. package/lib/typescript/module/ui/components/index.d.ts +0 -13
  416. package/lib/typescript/module/ui/components/index.d.ts.map +0 -1
  417. package/lib/typescript/module/ui/components/modals/index.d.ts +0 -2
  418. package/lib/typescript/module/ui/components/modals/index.d.ts.map +0 -1
  419. package/lib/typescript/module/ui/components/payment/index.d.ts +0 -9
  420. package/lib/typescript/module/ui/components/payment/index.d.ts.map +0 -1
  421. package/lib/typescript/module/ui/hooks/index.d.ts +0 -9
  422. package/lib/typescript/module/ui/hooks/index.d.ts.map +0 -1
  423. package/lib/typescript/module/ui/hooks/mutations/index.d.ts +0 -9
  424. package/lib/typescript/module/ui/hooks/mutations/index.d.ts.map +0 -1
  425. package/lib/typescript/module/ui/hooks/queries/index.d.ts +0 -13
  426. package/lib/typescript/module/ui/hooks/queries/index.d.ts.map +0 -1
  427. package/lib/typescript/module/ui/screens/AccountCenterScreen.d.ts +0 -5
  428. package/lib/typescript/module/ui/screens/AccountCenterScreen.d.ts.map +0 -1
  429. package/lib/typescript/module/ui/screens/AccountOverviewScreen.d.ts.map +0 -1
  430. package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +0 -1
  431. package/lib/typescript/module/ui/screens/AccountSwitcherScreen.d.ts +0 -5
  432. package/lib/typescript/module/ui/screens/AccountSwitcherScreen.d.ts.map +0 -1
  433. package/lib/typescript/module/ui/screens/SessionManagementScreen.d.ts +0 -5
  434. package/lib/typescript/module/ui/screens/SessionManagementScreen.d.ts.map +0 -1
  435. package/lib/typescript/module/ui/styles/index.d.ts +0 -4
  436. package/lib/typescript/module/ui/styles/index.d.ts.map +0 -1
  437. package/src/ui/components/feedback/index.ts +0 -6
  438. package/src/ui/components/icon/index.ts +0 -3
  439. package/src/ui/components/index.ts +0 -15
  440. package/src/ui/components/modals/index.ts +0 -1
  441. package/src/ui/components/payment/index.ts +0 -9
  442. package/src/ui/hooks/index.ts +0 -13
  443. package/src/ui/hooks/mutations/index.ts +0 -25
  444. package/src/ui/hooks/queries/index.ts +0 -61
  445. package/src/ui/screens/AccountCenterScreen.tsx +0 -182
  446. package/src/ui/screens/AccountOverviewScreen.tsx +0 -696
  447. package/src/ui/screens/AccountSettingsScreen.tsx +0 -620
  448. package/src/ui/screens/AccountSwitcherScreen.tsx +0 -1003
  449. package/src/ui/screens/SessionManagementScreen.tsx +0 -477
  450. package/src/ui/styles/index.ts +0 -3
@@ -0,0 +1,534 @@
1
+ import type React from 'react';
2
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
+ import {
4
+ View,
5
+ Text,
6
+ TouchableOpacity,
7
+ StyleSheet,
8
+ ScrollView,
9
+ Modal,
10
+ Pressable,
11
+ Platform,
12
+ ActivityIndicator,
13
+ type ViewStyle,
14
+ } from 'react-native';
15
+ import { Ionicons } from '@expo/vector-icons';
16
+ import { toast, useDialogControl, Dialog } from '@oxyhq/bloom';
17
+ import { useTheme } from '@oxyhq/bloom/theme';
18
+ import Avatar from './Avatar';
19
+ import { useOxy } from '../context/OxyContext';
20
+ import { useI18n } from '../hooks/useI18n';
21
+ import { logger as loggerUtil } from '@oxyhq/core';
22
+ import { buildAccountRows, type AccountRow } from './accountMenuRows';
23
+
24
+ export interface AccountMenuProps {
25
+ open: boolean;
26
+ onClose: () => void;
27
+ onNavigateManage: () => void;
28
+ onAddAccount: () => void;
29
+ /** Optional anchor coords (web only). Native ignores this and uses bottom-sheet style. */
30
+ anchor?: { top: number; right: number } | null;
31
+ }
32
+
33
+ const isWeb = Platform.OS === 'web';
34
+
35
+ /**
36
+ * Reusable account menu modeled after the Google account chooser. Opens from
37
+ * the avatar entry point (`AccountMenuButton`) or any other trigger.
38
+ *
39
+ * Reads everything it needs from `useOxy()` — never receive a session via
40
+ * props. Renders as a popover anchored to the trigger on web, and as a
41
+ * full-width bottom-sheet style modal on native.
42
+ */
43
+ const AccountMenu: React.FC<AccountMenuProps> = ({
44
+ open,
45
+ onClose,
46
+ onNavigateManage,
47
+ onAddAccount,
48
+ anchor,
49
+ }) => {
50
+ const {
51
+ user,
52
+ sessions,
53
+ activeSessionId,
54
+ switchSession,
55
+ logout,
56
+ logoutAll,
57
+ oxyServices,
58
+ } = useOxy();
59
+ const { t, locale } = useI18n();
60
+ const bloomTheme = useTheme();
61
+
62
+ const [busySessionId, setBusySessionId] = useState<string | null>(null);
63
+ const [signingOut, setSigningOut] = useState(false);
64
+ const [signingOutAll, setSigningOutAll] = useState(false);
65
+
66
+ const signOutDialog = useDialogControl();
67
+ const signOutAllDialog = useDialogControl();
68
+
69
+ const containerRef = useRef<View | null>(null);
70
+ const firstActionRef = useRef<View | null>(null);
71
+
72
+ const rows = useMemo<AccountRow[]>(() => buildAccountRows({
73
+ sessions,
74
+ activeSessionId,
75
+ user,
76
+ locale,
77
+ getAvatarUrl: (avatarId) => oxyServices.getFileDownloadUrl(avatarId, 'thumb'),
78
+ }), [sessions, activeSessionId, user, locale, oxyServices]);
79
+
80
+ const activeRow = useMemo<AccountRow | null>(() => {
81
+ return rows.find((r) => r.isActive) ?? null;
82
+ }, [rows]);
83
+
84
+ const inactiveRows = useMemo<AccountRow[]>(() => {
85
+ return rows.filter((r) => !r.isActive);
86
+ }, [rows]);
87
+
88
+ const handleSwitch = useCallback(async (sessionId: string) => {
89
+ if (sessionId === activeSessionId || busySessionId) {
90
+ return;
91
+ }
92
+ setBusySessionId(sessionId);
93
+ try {
94
+ await switchSession(sessionId);
95
+ toast.success(t('accountSwitcher.toasts.switchSuccess') || 'Switched account');
96
+ onClose();
97
+ } catch (error) {
98
+ if (!__DEV__) {
99
+ loggerUtil.warn('Switch account failed', { component: 'AccountMenu' }, error as unknown);
100
+ }
101
+ toast.error(t('accountSwitcher.toasts.switchFailed') || 'Failed to switch account');
102
+ } finally {
103
+ setBusySessionId(null);
104
+ }
105
+ }, [activeSessionId, busySessionId, switchSession, t, onClose]);
106
+
107
+ const performSignOut = useCallback(async () => {
108
+ if (signingOut) {
109
+ return;
110
+ }
111
+ setSigningOut(true);
112
+ try {
113
+ await logout();
114
+ toast.success(t('common.actions.signedOut') || 'Signed out');
115
+ onClose();
116
+ } catch (error) {
117
+ loggerUtil.warn('Sign out failed', { component: 'AccountMenu' }, error as unknown);
118
+ toast.error(t('common.errors.signOutFailed') || 'Failed to sign out');
119
+ } finally {
120
+ setSigningOut(false);
121
+ }
122
+ }, [signingOut, logout, t, onClose]);
123
+
124
+ const performSignOutAll = useCallback(async () => {
125
+ if (signingOutAll) {
126
+ return;
127
+ }
128
+ setSigningOutAll(true);
129
+ try {
130
+ await logoutAll();
131
+ toast.success(t('accountSwitcher.toasts.signOutAllSuccess') || 'Signed out of all accounts');
132
+ onClose();
133
+ } catch (error) {
134
+ loggerUtil.warn('Sign out all failed', { component: 'AccountMenu' }, error as unknown);
135
+ toast.error(t('common.errors.signOutAllFailed') || 'Failed to sign out of all accounts');
136
+ } finally {
137
+ setSigningOutAll(false);
138
+ }
139
+ }, [signingOutAll, logoutAll, t, onClose]);
140
+
141
+ // Escape-to-close + focus management (web only).
142
+ useEffect(() => {
143
+ if (!open || !isWeb || typeof document === 'undefined') {
144
+ return undefined;
145
+ }
146
+ const onKey = (event: KeyboardEvent) => {
147
+ if (event.key === 'Escape') {
148
+ event.stopPropagation();
149
+ onClose();
150
+ }
151
+ };
152
+ document.addEventListener('keydown', onKey, true);
153
+ return () => document.removeEventListener('keydown', onKey, true);
154
+ }, [open, onClose]);
155
+
156
+ if (!open) {
157
+ return null;
158
+ }
159
+
160
+ const overlayStyles: ViewStyle = isWeb
161
+ ? styles.webOverlay
162
+ : styles.nativeOverlay;
163
+
164
+ const panelStyles: ViewStyle[] = isWeb
165
+ ? [
166
+ styles.panelBase,
167
+ styles.panelWeb,
168
+ anchor
169
+ ? { top: anchor.top, right: anchor.right }
170
+ : { top: 64, right: 16 },
171
+ { backgroundColor: bloomTheme.colors.background, borderColor: bloomTheme.colors.border },
172
+ ]
173
+ : [
174
+ styles.panelBase,
175
+ styles.panelNative,
176
+ { backgroundColor: bloomTheme.colors.background },
177
+ ];
178
+
179
+ const content = (
180
+ <View
181
+ ref={containerRef}
182
+ style={panelStyles}
183
+ accessibilityRole="menu"
184
+ accessibilityLabel={t('accountMenu.label') || 'Account menu'}
185
+ >
186
+ {/* 1) Header */}
187
+ {activeRow ? (
188
+ <View style={styles.header}>
189
+ <Avatar
190
+ uri={activeRow.avatarUri}
191
+ name={activeRow.displayName}
192
+ size={64}
193
+ />
194
+ <Text
195
+ style={[styles.headerName, { color: bloomTheme.colors.text }]}
196
+ numberOfLines={1}
197
+ >
198
+ {activeRow.displayName}
199
+ </Text>
200
+ {activeRow.secondary ? (
201
+ <Text
202
+ style={[styles.headerSecondary, { color: bloomTheme.colors.textSecondary }]}
203
+ numberOfLines={1}
204
+ >
205
+ {activeRow.secondary}
206
+ </Text>
207
+ ) : null}
208
+ </View>
209
+ ) : (
210
+ <View style={styles.header}>
211
+ <Text style={[styles.headerName, { color: bloomTheme.colors.text }]}>
212
+ {t('common.status.notSignedIn') || 'Not signed in'}
213
+ </Text>
214
+ </View>
215
+ )}
216
+
217
+ {/* 2) Manage account */}
218
+ <TouchableOpacity
219
+ ref={firstActionRef as React.RefObject<View>}
220
+ accessibilityRole="menuitem"
221
+ accessibilityLabel={t('accountMenu.manage') || 'Manage your Oxy Account'}
222
+ style={[styles.primaryButton, { borderColor: bloomTheme.colors.border }]}
223
+ onPress={() => {
224
+ onClose();
225
+ onNavigateManage();
226
+ }}
227
+ >
228
+ <Text style={[styles.primaryButtonText, { color: bloomTheme.colors.primary }]}>
229
+ {t('accountMenu.manage') || 'Manage your Oxy Account'}
230
+ </Text>
231
+ </TouchableOpacity>
232
+
233
+ {/* 3) Account list */}
234
+ {rows.length > 0 ? (
235
+ <ScrollView
236
+ style={styles.list}
237
+ contentContainerStyle={styles.listContent}
238
+ showsVerticalScrollIndicator={false}
239
+ >
240
+ {rows.map((row) => {
241
+ const isBusy = busySessionId === row.sessionId;
242
+ return (
243
+ <TouchableOpacity
244
+ key={`account-${row.sessionId}`}
245
+ accessibilityRole="menuitem"
246
+ accessibilityLabel={row.displayName}
247
+ accessibilityState={{ selected: row.isActive }}
248
+ onPress={() => handleSwitch(row.sessionId)}
249
+ disabled={row.isActive || isBusy}
250
+ style={[
251
+ styles.row,
252
+ row.isActive && {
253
+ backgroundColor: bloomTheme.colors.primarySubtle,
254
+ },
255
+ ]}
256
+ >
257
+ <Avatar
258
+ uri={row.avatarUri}
259
+ name={row.displayName}
260
+ size={36}
261
+ />
262
+ <View style={styles.rowInfo}>
263
+ <Text
264
+ style={[styles.rowName, { color: bloomTheme.colors.text }]}
265
+ numberOfLines={1}
266
+ >
267
+ {row.displayName}
268
+ </Text>
269
+ {row.secondary ? (
270
+ <Text
271
+ style={[styles.rowSecondary, { color: bloomTheme.colors.textSecondary }]}
272
+ numberOfLines={1}
273
+ >
274
+ {row.secondary}
275
+ </Text>
276
+ ) : null}
277
+ </View>
278
+ {isBusy ? (
279
+ <ActivityIndicator color={bloomTheme.colors.primary} size="small" />
280
+ ) : row.isActive ? (
281
+ <Ionicons
282
+ name="checkmark-circle"
283
+ size={20}
284
+ color={bloomTheme.colors.primary}
285
+ />
286
+ ) : null}
287
+ </TouchableOpacity>
288
+ );
289
+ })}
290
+ </ScrollView>
291
+ ) : null}
292
+
293
+ {/* 4) Add another account */}
294
+ <TouchableOpacity
295
+ accessibilityRole="menuitem"
296
+ accessibilityLabel={t('accountMenu.addAnother') || 'Add another account'}
297
+ onPress={() => {
298
+ onClose();
299
+ onAddAccount();
300
+ }}
301
+ style={[styles.row, styles.actionRow]}
302
+ >
303
+ <View
304
+ style={[
305
+ styles.actionIcon,
306
+ { backgroundColor: bloomTheme.colors.primarySubtle },
307
+ ]}
308
+ >
309
+ <Ionicons
310
+ name="person-add-outline"
311
+ size={18}
312
+ color={bloomTheme.colors.primary}
313
+ />
314
+ </View>
315
+ <View style={styles.rowInfo}>
316
+ <Text style={[styles.rowName, { color: bloomTheme.colors.text }]}>
317
+ {t('accountMenu.addAnother') || 'Add another account'}
318
+ </Text>
319
+ </View>
320
+ </TouchableOpacity>
321
+
322
+ {/* 5) Sign out + sign out of all */}
323
+ <View style={[styles.footer, { borderTopColor: bloomTheme.colors.border }]}>
324
+ <TouchableOpacity
325
+ accessibilityRole="menuitem"
326
+ accessibilityLabel={t('common.actions.signOut') || 'Sign out'}
327
+ onPress={() => signOutDialog.open()}
328
+ disabled={signingOut || signingOutAll}
329
+ style={styles.footerButton}
330
+ >
331
+ {signingOut ? (
332
+ <ActivityIndicator color={bloomTheme.colors.error} size="small" />
333
+ ) : (
334
+ <Text style={[styles.footerButtonText, { color: bloomTheme.colors.error }]}>
335
+ {t('common.actions.signOut') || 'Sign out'}
336
+ </Text>
337
+ )}
338
+ </TouchableOpacity>
339
+ {rows.length > 1 ? (
340
+ <TouchableOpacity
341
+ accessibilityRole="menuitem"
342
+ accessibilityLabel={t('accountMenu.signOutAll') || 'Sign out of all accounts'}
343
+ onPress={() => signOutAllDialog.open()}
344
+ disabled={signingOut || signingOutAll}
345
+ style={styles.footerButton}
346
+ >
347
+ {signingOutAll ? (
348
+ <ActivityIndicator color={bloomTheme.colors.error} size="small" />
349
+ ) : (
350
+ <Text style={[styles.footerButtonText, { color: bloomTheme.colors.error }]}>
351
+ {t('accountMenu.signOutAll') || 'Sign out of all accounts'}
352
+ </Text>
353
+ )}
354
+ </TouchableOpacity>
355
+ ) : null}
356
+ </View>
357
+ </View>
358
+ );
359
+
360
+ return (
361
+ <Modal
362
+ visible={open}
363
+ transparent
364
+ animationType={isWeb ? 'fade' : 'slide'}
365
+ onRequestClose={onClose}
366
+ >
367
+ <Pressable
368
+ accessibilityRole="button"
369
+ accessibilityLabel={t('common.actions.close') || 'Close'}
370
+ onPress={onClose}
371
+ style={overlayStyles}
372
+ >
373
+ {/* Stop propagation: tapping the panel must not close it. */}
374
+ <Pressable onPress={() => undefined} style={styles.panelTouchable}>
375
+ {content}
376
+ </Pressable>
377
+ </Pressable>
378
+
379
+ <Dialog
380
+ control={signOutDialog}
381
+ title={t('common.actions.signOut') || 'Sign out'}
382
+ description={t('common.confirms.signOut') || 'Are you sure you want to sign out?'}
383
+ actions={[
384
+ {
385
+ label: t('common.actions.signOut') || 'Sign out',
386
+ color: 'destructive',
387
+ onPress: performSignOut,
388
+ },
389
+ { label: t('common.cancel') || 'Cancel', color: 'cancel' },
390
+ ]}
391
+ />
392
+ <Dialog
393
+ control={signOutAllDialog}
394
+ title={t('accountMenu.signOutAll') || 'Sign out of all accounts'}
395
+ description={t('common.confirms.signOutAll') || 'Are you sure you want to sign out of all accounts?'}
396
+ actions={[
397
+ {
398
+ label: t('accountMenu.signOutAll') || 'Sign out of all accounts',
399
+ color: 'destructive',
400
+ onPress: performSignOutAll,
401
+ },
402
+ { label: t('common.cancel') || 'Cancel', color: 'cancel' },
403
+ ]}
404
+ />
405
+ </Modal>
406
+ );
407
+ };
408
+
409
+ const styles = StyleSheet.create({
410
+ webOverlay: {
411
+ flex: 1,
412
+ backgroundColor: 'transparent',
413
+ },
414
+ nativeOverlay: {
415
+ flex: 1,
416
+ backgroundColor: 'rgba(0,0,0,0.32)',
417
+ justifyContent: 'flex-end',
418
+ },
419
+ panelTouchable: {
420
+ // Pressable wrapper that owns no styling — just absorbs taps.
421
+ },
422
+ panelBase: {
423
+ borderRadius: 24,
424
+ paddingVertical: 12,
425
+ shadowColor: '#000',
426
+ shadowOpacity: 0.18,
427
+ shadowRadius: 24,
428
+ shadowOffset: { width: 0, height: 8 },
429
+ elevation: 12,
430
+ overflow: 'hidden',
431
+ },
432
+ panelWeb: {
433
+ position: 'absolute',
434
+ width: 360,
435
+ maxHeight: '85%',
436
+ borderWidth: 1,
437
+ },
438
+ panelNative: {
439
+ marginHorizontal: 0,
440
+ borderTopLeftRadius: 28,
441
+ borderTopRightRadius: 28,
442
+ borderBottomLeftRadius: 0,
443
+ borderBottomRightRadius: 0,
444
+ paddingTop: 20,
445
+ paddingBottom: 24,
446
+ maxHeight: '85%',
447
+ },
448
+ header: {
449
+ alignItems: 'center',
450
+ paddingHorizontal: 20,
451
+ paddingVertical: 16,
452
+ },
453
+ headerName: {
454
+ fontSize: 18,
455
+ fontWeight: '600',
456
+ marginTop: 12,
457
+ textAlign: 'center',
458
+ },
459
+ headerSecondary: {
460
+ fontSize: 14,
461
+ marginTop: 4,
462
+ textAlign: 'center',
463
+ },
464
+ primaryButton: {
465
+ marginHorizontal: 20,
466
+ marginBottom: 12,
467
+ paddingVertical: 12,
468
+ paddingHorizontal: 16,
469
+ borderRadius: 999,
470
+ borderWidth: 1,
471
+ alignItems: 'center',
472
+ },
473
+ primaryButtonText: {
474
+ fontSize: 14,
475
+ fontWeight: '600',
476
+ },
477
+ list: {
478
+ maxHeight: 280,
479
+ },
480
+ listContent: {
481
+ paddingHorizontal: 12,
482
+ paddingBottom: 4,
483
+ },
484
+ row: {
485
+ flexDirection: 'row',
486
+ alignItems: 'center',
487
+ paddingVertical: 10,
488
+ paddingHorizontal: 12,
489
+ borderRadius: 16,
490
+ marginVertical: 2,
491
+ },
492
+ actionRow: {
493
+ marginHorizontal: 12,
494
+ marginTop: 4,
495
+ },
496
+ actionIcon: {
497
+ width: 36,
498
+ height: 36,
499
+ borderRadius: 18,
500
+ alignItems: 'center',
501
+ justifyContent: 'center',
502
+ },
503
+ rowInfo: {
504
+ flex: 1,
505
+ marginLeft: 12,
506
+ },
507
+ rowName: {
508
+ fontSize: 15,
509
+ fontWeight: '500',
510
+ },
511
+ rowSecondary: {
512
+ fontSize: 13,
513
+ marginTop: 2,
514
+ },
515
+ footer: {
516
+ marginTop: 12,
517
+ paddingTop: 8,
518
+ paddingHorizontal: 12,
519
+ borderTopWidth: StyleSheet.hairlineWidth,
520
+ flexDirection: 'row',
521
+ flexWrap: 'wrap',
522
+ justifyContent: 'space-around',
523
+ },
524
+ footerButton: {
525
+ paddingVertical: 10,
526
+ paddingHorizontal: 12,
527
+ },
528
+ footerButtonText: {
529
+ fontSize: 14,
530
+ fontWeight: '600',
531
+ },
532
+ });
533
+
534
+ export default AccountMenu;
@@ -0,0 +1,113 @@
1
+ import type React from 'react';
2
+ import { useCallback, useRef, useState } from 'react';
3
+ import { TouchableOpacity, StyleSheet, Platform, type LayoutChangeEvent } from 'react-native';
4
+ import { getAccountDisplayName } from '@oxyhq/core';
5
+ import Avatar from './Avatar';
6
+ import AccountMenu from './AccountMenu';
7
+ import { useOxy } from '../context/OxyContext';
8
+ import { useI18n } from '../hooks/useI18n';
9
+
10
+ export interface AccountMenuButtonProps {
11
+ /** Avatar size (px). Defaults to 36 (Google account chip size). */
12
+ size?: number;
13
+ /** Called when the user picks "Manage your Oxy Account". */
14
+ onNavigateManage: () => void;
15
+ /** Called when the user picks "Add another account". */
16
+ onAddAccount: () => void;
17
+ }
18
+
19
+ const isWeb = Platform.OS === 'web';
20
+
21
+ /**
22
+ * Avatar entry-point that opens the unified {@link AccountMenu}. Reads the
23
+ * active account from `useOxy()` — never receive user data via props.
24
+ *
25
+ * Renders a small avatar chip (top-right friendly). Click → opens AccountMenu.
26
+ * Pure component: owns only the open-state and the trigger's measured anchor.
27
+ */
28
+ const AccountMenuButton: React.FC<AccountMenuButtonProps> = ({
29
+ size = 36,
30
+ onNavigateManage,
31
+ onAddAccount,
32
+ }) => {
33
+ const { user, oxyServices, isAuthenticated } = useOxy();
34
+ const { t, locale } = useI18n();
35
+ const [open, setOpen] = useState(false);
36
+ const [anchor, setAnchor] = useState<{ top: number; right: number } | null>(null);
37
+ const triggerRef = useRef<React.ComponentRef<typeof TouchableOpacity>>(null);
38
+
39
+ const measureAnchor = useCallback(() => {
40
+ if (!isWeb || !triggerRef.current) {
41
+ return;
42
+ }
43
+ // RN-Web exposes measure() on host views; use the native API.
44
+ triggerRef.current.measure?.((_x, _y, _w, h, pageX, pageY) => {
45
+ if (typeof window === 'undefined' || typeof pageX !== 'number') {
46
+ return;
47
+ }
48
+ const right = Math.max(8, window.innerWidth - pageX - (_w ?? 0));
49
+ const top = pageY + h + 8;
50
+ setAnchor({ top, right });
51
+ });
52
+ }, []);
53
+
54
+ const handleOpen = useCallback(() => {
55
+ measureAnchor();
56
+ setOpen(true);
57
+ }, [measureAnchor]);
58
+
59
+ const handleClose = useCallback(() => setOpen(false), []);
60
+
61
+ const handleLayout = useCallback((_event: LayoutChangeEvent) => {
62
+ // Re-measure on layout changes so the popover doesn't drift after
63
+ // window resize / sticky-header relayout.
64
+ if (open) {
65
+ measureAnchor();
66
+ }
67
+ }, [measureAnchor, open]);
68
+
69
+ const displayName = getAccountDisplayName(user, locale);
70
+ const avatarUri = user?.avatar
71
+ ? oxyServices.getFileDownloadUrl(user.avatar, 'thumb')
72
+ : undefined;
73
+
74
+ const accessibilityLabel = isAuthenticated
75
+ ? (t('accountMenu.openWithUser', { name: displayName })
76
+ || `Account menu for ${displayName}`)
77
+ : (t('accountMenu.open') || 'Account menu');
78
+
79
+ return (
80
+ <>
81
+ <TouchableOpacity
82
+ ref={triggerRef}
83
+ onPress={handleOpen}
84
+ onLayout={handleLayout}
85
+ accessibilityRole="button"
86
+ accessibilityLabel={accessibilityLabel}
87
+ accessibilityHint={t('accountMenu.openHint') || 'Opens the account menu'}
88
+ accessibilityState={{ expanded: open }}
89
+ style={[styles.trigger, { width: size, height: size, borderRadius: size / 2 }]}
90
+ hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
91
+ >
92
+ <Avatar uri={avatarUri} name={displayName} size={size} />
93
+ </TouchableOpacity>
94
+ <AccountMenu
95
+ open={open}
96
+ onClose={handleClose}
97
+ onNavigateManage={onNavigateManage}
98
+ onAddAccount={onAddAccount}
99
+ anchor={anchor}
100
+ />
101
+ </>
102
+ );
103
+ };
104
+
105
+ const styles = StyleSheet.create({
106
+ trigger: {
107
+ overflow: 'hidden',
108
+ alignItems: 'center',
109
+ justifyContent: 'center',
110
+ },
111
+ });
112
+
113
+ export default AccountMenuButton;
@@ -13,7 +13,7 @@ import { useOxy } from '../context/OxyContext';
13
13
  /**
14
14
  * ActingAsBanner - Shows a subtle banner when the user is acting as a managed account.
15
15
  *
16
- * - Tap to open the AccountSwitcher screen.
16
+ * - Tap to open the ManageAccount screen (account switcher lives in AccountMenu).
17
17
  * - Long-press to switch back to the primary account immediately.
18
18
  *
19
19
  * Place this component in your app's layout where you want the banner to appear
@@ -39,7 +39,7 @@ const ActingAsBanner: React.FC = () => {
39
39
  : activeAccount.name || activeAccount.username;
40
40
 
41
41
  const handlePress = () => {
42
- showBottomSheet?.('AccountSwitcher');
42
+ showBottomSheet?.('ManageAccount');
43
43
  };
44
44
 
45
45
  const handleLongPress = () => {
@@ -5,7 +5,7 @@ import { useTheme } from '@oxyhq/bloom/theme';
5
5
  import { useI18n } from '../hooks/useI18n';
6
6
  import Avatar from './Avatar';
7
7
  import { useOxy } from '../context/OxyContext';
8
- import { useFileDownloadUrl } from '../hooks';
8
+ import { useFileDownloadUrl } from '../hooks/useFileDownloadUrl';
9
9
  import { getAccountDisplayName, getAccountFallbackHandle } from '@oxyhq/core';
10
10
 
11
11
  interface ProfileCardProps {
@@ -13,7 +13,7 @@ import Animated, {
13
13
  } from 'react-native-reanimated';
14
14
  import { useTheme } from '@oxyhq/bloom/theme';
15
15
  import type { ThemeColors } from '@oxyhq/bloom/theme';
16
- import { createAuthStyles } from '../styles';
16
+ import { createAuthStyles } from '../styles/authStyles';
17
17
  import type { BaseScreenProps, StepController } from '../types/navigation';
18
18
  import type { RouteName } from '../types/navigation';
19
19
  import { screenContentStyle } from '../constants/spacing';