@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
@@ -1,12 +1,14 @@
1
1
  /**
2
2
  * Centralized query keys for TanStack Query
3
- *
3
+ *
4
4
  * Following best practices:
5
5
  * - Use arrays for hierarchical keys
6
6
  * - Include all parameters in the key
7
7
  * - Use consistent naming conventions
8
8
  */
9
9
 
10
+ import type { QueryClient } from '@tanstack/react-query';
11
+
10
12
  export const queryKeys = {
11
13
  // Account queries
12
14
  accounts: {
@@ -72,6 +74,12 @@ export const queryKeys = {
72
74
  usage: () => [...queryKeys.storage.all, 'usage'] as const,
73
75
  },
74
76
 
77
+ // Connected apps (FedCM grants the user has authorized)
78
+ connectedApps: {
79
+ all: ['connectedApps'] as const,
80
+ list: () => [...queryKeys.connectedApps.all, 'list'] as const,
81
+ },
82
+
75
83
  // Payment / wallet / subscription queries
76
84
  payments: {
77
85
  all: ['payments'] as const,
@@ -96,21 +104,63 @@ export const queryKeys = {
96
104
  /**
97
105
  * Helper to invalidate all account-related queries
98
106
  */
99
- export const invalidateAccountQueries = (queryClient: any) => {
107
+ export const invalidateAccountQueries = (queryClient: QueryClient): void => {
100
108
  queryClient.invalidateQueries({ queryKey: queryKeys.accounts.all });
101
109
  };
102
110
 
103
111
  /**
104
112
  * Helper to invalidate all user-related queries
105
113
  */
106
- export const invalidateUserQueries = (queryClient: any) => {
114
+ export const invalidateUserQueries = (queryClient: QueryClient): void => {
107
115
  queryClient.invalidateQueries({ queryKey: queryKeys.users.all });
108
116
  };
109
117
 
110
118
  /**
111
119
  * Helper to invalidate all session-related queries
112
120
  */
113
- export const invalidateSessionQueries = (queryClient: any) => {
121
+ export const invalidateSessionQueries = (queryClient: QueryClient): void => {
114
122
  queryClient.invalidateQueries({ queryKey: queryKeys.sessions.all });
115
123
  };
116
124
 
125
+ /**
126
+ * Helper to invalidate all device-related queries
127
+ */
128
+ export const invalidateDeviceQueries = (queryClient: QueryClient): void => {
129
+ queryClient.invalidateQueries({ queryKey: queryKeys.devices.all });
130
+ };
131
+
132
+ /**
133
+ * Helper to invalidate all privacy-settings queries
134
+ */
135
+ export const invalidatePrivacyQueries = (queryClient: QueryClient): void => {
136
+ queryClient.invalidateQueries({ queryKey: queryKeys.privacy.all });
137
+ };
138
+
139
+ /**
140
+ * Helper to invalidate all security-activity queries
141
+ */
142
+ export const invalidateSecurityQueries = (queryClient: QueryClient): void => {
143
+ queryClient.invalidateQueries({ queryKey: queryKeys.security.all });
144
+ };
145
+
146
+ /**
147
+ * Helper to invalidate all storage-usage queries
148
+ */
149
+ export const invalidateStorageQueries = (queryClient: QueryClient): void => {
150
+ queryClient.invalidateQueries({ queryKey: queryKeys.storage.all });
151
+ };
152
+
153
+ /**
154
+ * Helper to invalidate all payments / wallet / subscription queries
155
+ */
156
+ export const invalidatePaymentsQueries = (queryClient: QueryClient): void => {
157
+ queryClient.invalidateQueries({ queryKey: queryKeys.payments.all });
158
+ };
159
+
160
+ /**
161
+ * Helper to invalidate the user's connected-apps list
162
+ */
163
+ export const invalidateConnectedAppsQueries = (queryClient: QueryClient): void => {
164
+ queryClient.invalidateQueries({ queryKey: queryKeys.connectedApps.all });
165
+ };
166
+
@@ -1,7 +1,7 @@
1
1
  import { useEffect } from 'react';
2
2
  import { useQuery, useQueries, useQueryClient } from '@tanstack/react-query';
3
3
  import { authenticatedApiCall } from '@oxyhq/core';
4
- import type { User } from '@oxyhq/core';
4
+ import type { AuthorizedApp, User } from '@oxyhq/core';
5
5
  import { queryKeys } from './queryKeys';
6
6
  import { mutationKeys } from '../mutations/mutationKeys';
7
7
  import { useOxy } from '../../context/OxyContext';
@@ -204,6 +204,30 @@ export const useUsersBySessions = (sessionIds: string[], options?: { enabled?: b
204
204
  });
205
205
  };
206
206
 
207
+ /**
208
+ * List the authenticated user's authorized RP apps (FedCM grants).
209
+ *
210
+ * Returns the intersection of the user's grants with the currently-approved
211
+ * RP catalog. Drives the "Connected apps" management screen.
212
+ */
213
+ export const useAuthorizedApps = (options?: { enabled?: boolean }) => {
214
+ const { oxyServices, activeSessionId, isAuthenticated } = useOxy();
215
+
216
+ return useQuery<AuthorizedApp[]>({
217
+ queryKey: queryKeys.connectedApps.list(),
218
+ queryFn: async () => {
219
+ return authenticatedApiCall<AuthorizedApp[]>(
220
+ oxyServices,
221
+ activeSessionId,
222
+ () => oxyServices.listAuthorizedApps()
223
+ );
224
+ },
225
+ enabled: (options?.enabled !== false) && isAuthenticated,
226
+ staleTime: 30 * 1000, // 30 seconds — short, drives a management UI
227
+ gcTime: 5 * 60 * 1000,
228
+ });
229
+ };
230
+
207
231
  /**
208
232
  * Get privacy settings for a user
209
233
  */
@@ -50,8 +50,14 @@ export interface AuthActions {
50
50
  * Sign in
51
51
  * - Web: Opens popup to auth.oxy.so (no public key needed)
52
52
  * - Native: Uses cryptographic identity from keychain
53
+ *
54
+ * @param publicKey - Native: identity public key. Ignored on web.
55
+ * @param preOpenedPopup - Web only: a popup the caller already opened
56
+ * SYNCHRONOUSLY on the raw click via `oxyServices.openBlankPopup()`. This
57
+ * keeps Chrome's user-activation alive across any prior `await` and is
58
+ * the only reliable way to avoid the popup blocker on cross-domain flows.
53
59
  */
54
- signIn: (publicKey?: string) => Promise<User>;
60
+ signIn: (publicKey?: string, preOpenedPopup?: Window | null) => Promise<User>;
55
61
 
56
62
  /**
57
63
  * Sign out current session
@@ -72,7 +78,7 @@ export interface AuthActions {
72
78
  export interface UseAuthReturn extends AuthState, AuthActions {
73
79
  /** Access to full OxyServices instance for advanced usage */
74
80
  oxyServices: ReturnType<typeof useOxy>['oxyServices'];
75
- /** Open a bottom sheet screen (e.g. 'AccountSettings', 'FileManagement') */
81
+ /** Open a bottom sheet screen (e.g. 'ManageAccount', 'FileManagement') */
76
82
  showBottomSheet: ReturnType<typeof useOxy>['showBottomSheet'];
77
83
  /** Open the avatar picker bottom sheet */
78
84
  openAvatarPicker: ReturnType<typeof useOxy>['openAvatarPicker'];
@@ -106,7 +112,7 @@ export function useAuth(): UseAuthReturn {
106
112
  openAvatarPicker,
107
113
  } = useOxy();
108
114
 
109
- const signIn = useCallback(async (publicKey?: string): Promise<User> => {
115
+ const signIn = useCallback(async (publicKey?: string, preOpenedPopup?: Window | null): Promise<User> => {
110
116
  // Check if we're on the identity provider itself
111
117
  // Only the IdP has local login forms - other apps are client apps
112
118
  const authWebUrl = oxyServices.config?.authWebUrl;
@@ -122,8 +128,18 @@ export function useAuth(): UseAuthReturn {
122
128
  // FedCM silent SSO already runs on page load via useWebSSO
123
129
  // If user is clicking "Sign In", they need interactive auth NOW
124
130
  if (isWebBrowser() && !publicKey && !isIdentityProvider) {
131
+ // Open the popup SYNCHRONOUSLY before any `await` runs so Chrome's
132
+ // transient user-activation is preserved across the async chain
133
+ // (React state updates + the `await` into `signInWithPopup`). If the
134
+ // caller already pre-opened one (e.g. they did so to be extra safe
135
+ // ahead of their own awaits), reuse it.
136
+ const popup: Window | null = preOpenedPopup
137
+ ?? oxyServices.openBlankPopup?.()
138
+ ?? null;
125
139
  try {
126
- const popupSession = await oxyServices.signInWithPopup?.();
140
+ const popupSession = await oxyServices.signInWithPopup?.({
141
+ popup,
142
+ });
127
143
  if (popupSession?.user) {
128
144
  // The popup auth flow fetches full user data, so the session user
129
145
  // contains full User fields even though the base type is MinimalUserData.
@@ -137,6 +153,9 @@ export function useAuth(): UseAuthReturn {
137
153
  }
138
154
  throw new Error('Sign-in failed. Please try again.');
139
155
  } catch (popupError) {
156
+ if (popup && !popup.closed) {
157
+ popup.close();
158
+ }
140
159
  if (popupError instanceof Error && popupError.message.includes('blocked')) {
141
160
  throw new Error('Popup blocked. Please allow popups for this site.');
142
161
  }
@@ -8,6 +8,8 @@ import { handleAuthError, isInvalidSessionError } from '../utils/errorHandlers';
8
8
  import type { OxyServices } from '@oxyhq/core';
9
9
  import type { QueryClient } from '@tanstack/react-query';
10
10
  import { clearQueryCache } from './queryClient';
11
+ import { isWebBrowser } from './useWebSSO';
12
+ import { writeActiveAuthuser } from '../utils/activeAuthuser';
11
13
 
12
14
  export interface UseSessionManagementOptions {
13
15
  oxyServices: OxyServices;
@@ -265,6 +267,33 @@ export const useSessionManagement = ({
265
267
  const switchSession = useCallback(
266
268
  async (sessionId: string): Promise<User> => {
267
269
  try {
270
+ // Web multi-account: when the target session was sourced from
271
+ // `refreshAllSessions` it carries its `authuser` slot index. We
272
+ // proactively plant that slot's access token via the httpOnly
273
+ // refresh cookie BEFORE validating, so the bearer-protected
274
+ // validate/getCurrentUser calls don't need a token that was never
275
+ // in memory (cold reload / different browser tab). The native path
276
+ // has no per-session cookies and continues to rely on
277
+ // `validateSession` + `getTokenBySession` directly.
278
+ if (isWebBrowser()) {
279
+ const targetSession = sessionsRef.current.find((s) => s.sessionId === sessionId);
280
+ const targetAuthuser = targetSession?.authuser;
281
+ if (typeof targetAuthuser === 'number') {
282
+ const refreshed = await oxyServices.refreshTokenViaCookie({ authuser: targetAuthuser });
283
+ if (refreshed === null) {
284
+ // Slot's refresh cookie is missing / expired / reused. Fall
285
+ // through to the invalid-session branch below by throwing the
286
+ // canonical invalid-session error.
287
+ throw new Error('Session is invalid or expired');
288
+ }
289
+ // Plant the slot's fresh access token; subsequent bearer calls
290
+ // (`validateSession`, `getCurrentUser`) will use it. The server
291
+ // also rotated the cookie at this point.
292
+ oxyServices.httpService.setTokens(refreshed.accessToken);
293
+ writeActiveAuthuser(targetAuthuser);
294
+ }
295
+ }
296
+
268
297
  const validation = await oxyServices.validateSession(sessionId, { useHeaderValidation: true });
269
298
  if (!validation?.valid) {
270
299
  throw new Error('Session is invalid or expired');
package/src/ui/index.ts CHANGED
@@ -1,110 +1,49 @@
1
1
  /**
2
- * UI Component exports - Frontend Only (with backend-safe fallbacks)
2
+ * @oxyhq/services/ui public subpath
3
3
  *
4
- * This module exports all React/React Native UI components and hooks.
5
- * In backend, all exports are no-ops or empty objects.
4
+ * Tree-shakeable static re-exports of the most common UI surface. Backend
5
+ * environments (SSR) should import `@oxyhq/services/ui/server` instead;
6
+ * client-only callers can use `@oxyhq/services/ui/client` for a slightly
7
+ * narrower bundle.
6
8
  *
7
- * NOTE: This entry point uses runtime detection which prevents tree-shaking.
8
- * For better bundle optimization, use:
9
- * - '@oxyhq/services/ui/client' for client bundles (tree-shakeable)
10
- * - '@oxyhq/services/ui/server' for SSR environments (all noops)
11
- *
12
- * @example
13
- * // Client bundle (tree-shakeable)
14
- * import { OxyProvider, useOxy } from '@oxyhq/services/ui/client';
15
- *
16
- * // SSR (noops)
17
- * import { OxyProvider, useOxy } from '@oxyhq/services/ui/server';
9
+ * Static `export ... from` only — no runtime `require()`, no platform
10
+ * conditionals. The previous `if (isFrontend) require(...)` pattern was
11
+ * removed because it (a) violated the dual CJS/ESM build rule (ESM bundles
12
+ * cannot contain `require()` per CLAUDE.md) and (b) defeated tree-shaking.
18
13
  */
19
- import isFrontend from './isFrontend';
20
14
 
21
- // UI exports
22
- let OxyProvider;
23
- let OxySignInButton;
24
- let OxyLogo;
25
- let Avatar;
26
- let FollowButton;
27
- let OxyPayButton;
28
- let FontLoader;
29
- let setupFonts;
30
- let OxyIcon;
31
- let useOxy;
32
- let useAuth;
33
- let useFollow;
34
- let ProfileScreen;
35
- let useAuthStore;
36
- let useAccountStore;
37
- let useStorage;
15
+ // Components
16
+ export { default as OxyProvider } from './components/OxyProvider';
17
+ export { default as OxySignInButton } from './components/OxySignInButton';
18
+ export { default as OxyLogo } from './components/OxyLogo';
19
+ export { default as Avatar } from './components/Avatar';
20
+ export { default as FollowButton } from './components/FollowButton';
21
+ export { default as OxyPayButton } from './components/OxyPayButton';
22
+ export { FontLoader, setupFonts } from './components/FontLoader';
23
+ export { default as OxyIcon } from './components/icon/OxyIcon';
24
+ export { default as AccountMenu } from './components/AccountMenu';
25
+ export { default as AccountMenuButton } from './components/AccountMenuButton';
38
26
 
39
- if (isFrontend) {
40
- OxyProvider = require('./components/OxyProvider').default;
41
- OxySignInButton = require('./components/OxySignInButton').default;
42
- OxyLogo = require('./components/OxyLogo').default;
43
- Avatar = require('./components/Avatar').default;
44
- FollowButton = require('./components/FollowButton').default;
45
- OxyPayButton = require('./components/OxyPayButton').default;
46
- FontLoader = require('./components/FontLoader').FontLoader;
47
- setupFonts = require('./components/FontLoader').setupFonts;
48
- OxyIcon = require('./components/icon').OxyIcon;
49
- useOxy = require('./context/OxyContext').useOxy;
50
- useAuth = require('./hooks/useAuth').useAuth;
51
- useFollow = require('./hooks').useFollow;
52
- ProfileScreen = require('./screens/ProfileScreen').default;
53
- useAuthStore = require('./stores/authStore').useAuthStore;
54
- useAccountStore = require('./stores/accountStore').useAccountStore;
55
- useStorage = require('./hooks/useStorage').useStorage;
56
- } else {
57
- // Backend: no-op fallbacks
58
- const noopComponent = () => null;
59
- const noopHook = () => ({});
60
- const noopStorageResult = { storage: null, isReady: false };
27
+ // Context + hooks
28
+ export { useOxy } from './context/OxyContext';
29
+ export { useAuth } from './hooks/useAuth';
30
+ export { useFollow } from './hooks/useFollow';
31
+ export { useStorage } from './hooks/useStorage';
32
+ export type { UseStorageOptions, UseStorageResult } from './hooks/useStorage';
61
33
 
62
- OxyProvider = noopComponent;
63
- OxySignInButton = noopComponent;
64
- OxyLogo = noopComponent;
65
- Avatar = noopComponent;
66
- FollowButton = noopComponent;
67
- OxyPayButton = noopComponent;
68
- FontLoader = noopComponent;
69
- setupFonts = () => {};
70
- OxyIcon = noopComponent;
71
- useOxy = noopHook;
72
- useAuth = noopHook;
73
- useFollow = noopHook;
74
- ProfileScreen = noopComponent;
75
- useAuthStore = noopHook;
76
- useAccountStore = noopHook;
77
- useStorage = () => noopStorageResult;
78
- }
34
+ // Screens
35
+ export { default as ProfileScreen } from './screens/ProfileScreen';
36
+ export { default as ManageAccountScreen } from './screens/ManageAccountScreen';
79
37
 
80
- export {
81
- OxyProvider,
82
- OxySignInButton,
83
- OxyLogo,
84
- Avatar,
85
- FollowButton,
86
- OxyPayButton,
87
- FontLoader,
88
- setupFonts,
89
- OxyIcon,
90
- useOxy,
91
- useAuth,
92
- useFollow,
93
- ProfileScreen,
94
- useAuthStore,
95
- useAccountStore,
96
- useStorage,
97
- };
38
+ // Stores
39
+ export { useAuthStore } from './stores/authStore';
40
+ export { useAccountStore } from './stores/accountStore';
98
41
 
99
-
100
- // Export error handler utilities (pure functions, no conditional needed)
42
+ // Error handlers (pure functions)
101
43
  export {
102
- handleAuthError,
103
- isInvalidSessionError,
104
- isTimeoutOrNetworkError,
105
- extractErrorMessage,
44
+ handleAuthError,
45
+ isInvalidSessionError,
46
+ isTimeoutOrNetworkError,
47
+ extractErrorMessage,
106
48
  } from './utils/errorHandlers';
107
49
  export type { HandleAuthErrorOptions } from './utils/errorHandlers';
108
-
109
- // Export useStorage hook and types (kept for external consumers)
110
- export type { UseStorageOptions, UseStorageResult } from './hooks/useStorage';
@@ -8,12 +8,8 @@ import type { BaseScreenProps } from '../types/navigation';
8
8
  // Define all available route names
9
9
  export type RouteName =
10
10
  | 'OxyAuth' // Sign in with Oxy (QR code / deep link to Accounts app)
11
- | 'AccountOverview'
12
- | 'AccountSettings'
13
- | 'AccountCenter'
14
- | 'AccountSwitcher'
11
+ | 'ManageAccount' // Unified "Manage your Oxy Account" surface
15
12
  | 'AccountVerification'
16
- | 'SessionManagement'
17
13
  | 'PaymentGateway'
18
14
  | 'Profile'
19
15
  | 'LanguageSelector'
@@ -41,18 +37,17 @@ export type RouteName =
41
37
  | 'FollowersList' // List of user's followers
42
38
  | 'FollowingList' // List of users being followed
43
39
  | 'CreateManagedAccount' // Create a new managed sub-account
44
- | 'AvatarCrop'; // Square-crop editor presented before avatar upload
40
+ | 'AvatarCrop' // Square-crop editor presented before avatar upload
41
+ | 'Notifications' // Per-channel notification preferences
42
+ | 'ConnectedApps' // FedCM-authorized RP apps the user can revoke
43
+ | 'Preferences'; // General user preferences (theme, reduce-motion, etc.)
45
44
 
46
45
  // Lazy screen loaders - functions that return screen components on-demand
47
46
  // This breaks the require cycle by deferring imports until screens are actually needed
48
47
  const screenLoaders: Record<RouteName, () => ComponentType<BaseScreenProps>> = {
49
48
  OxyAuth: () => require('../screens/OxyAuthScreen').default,
50
- AccountOverview: () => require('../screens/AccountOverviewScreen').default,
51
- AccountSettings: () => require('../screens/AccountSettingsScreen').default,
52
- AccountCenter: () => require('../screens/AccountCenterScreen').default,
53
- AccountSwitcher: () => require('../screens/AccountSwitcherScreen').default,
49
+ ManageAccount: () => require('../screens/ManageAccountScreen').default,
54
50
  AccountVerification: () => require('../screens/AccountVerificationScreen').default,
55
- SessionManagement: () => require('../screens/SessionManagementScreen').default,
56
51
  PaymentGateway: () => require('../screens/PaymentGatewayScreen').default,
57
52
  Profile: () => require('../screens/ProfileScreen').default,
58
53
  LanguageSelector: () => require('../screens/LanguageSelectorScreen').default,
@@ -84,6 +79,9 @@ const screenLoaders: Record<RouteName, () => ComponentType<BaseScreenProps>> = {
84
79
  FollowingList: () => require('../screens/FollowingListScreen').default,
85
80
  CreateManagedAccount: () => require('../screens/CreateManagedAccountScreen').default,
86
81
  AvatarCrop: () => require('../screens/AvatarCropScreen').default,
82
+ Notifications: () => require('../screens/NotificationsScreen').default,
83
+ ConnectedApps: () => require('../screens/ConnectedAppsScreen').default,
84
+ Preferences: () => require('../screens/PreferencesScreen').default,
87
85
  };
88
86
 
89
87
  // Cache loaded components to avoid re-requiring
@@ -10,7 +10,7 @@ import {
10
10
  } from 'react-native';
11
11
  import type { BaseScreenProps } from '../types/navigation';
12
12
  import { Dialog, toast, useDialogControl } from '@oxyhq/bloom';
13
- import { Header } from '../components';
13
+ import Header from '../components/Header';
14
14
  import { SettingsListGroup } from '@oxyhq/bloom/settings-list';
15
15
  import { useI18n } from '../hooks/useI18n';
16
16
  import { useTheme } from '@oxyhq/bloom/theme';
@@ -0,0 +1,225 @@
1
+ import React, { useCallback, useMemo, useState } from 'react';
2
+ import { ActivityIndicator, FlatList, RefreshControl, StyleSheet, View } from 'react-native';
3
+ import { Dialog, toast, useDialogControl } from '@oxyhq/bloom';
4
+ import { useTheme } from '@oxyhq/bloom/theme';
5
+ import { SettingsListGroup, SettingsListItem } from '@oxyhq/bloom/settings-list';
6
+ import type { AuthorizedApp } from '@oxyhq/core';
7
+ import { logger as loggerUtil } from '@oxyhq/core';
8
+ import type { BaseScreenProps } from '../types/navigation';
9
+ import Header from '../components/Header';
10
+ import EmptyState from '../components/EmptyState';
11
+ import { SettingsIcon } from '../components/SettingsIcon';
12
+ import { useI18n } from '../hooks/useI18n';
13
+ import { useOxy } from '../context/OxyContext';
14
+ import { useAuthorizedApps } from '../hooks/queries/useAccountQueries';
15
+ import { useRevokeAuthorizedApp } from '../hooks/mutations/useAccountMutations';
16
+ import { useColorScheme } from '../hooks/useColorScheme';
17
+ import { Colors } from '../constants/theme';
18
+ import { normalizeColorScheme, normalizeTheme } from '../utils/themeUtils';
19
+
20
+ /**
21
+ * Format an ISO-8601 timestamp as a human-readable relative time. Mirrors the
22
+ * formatter used in ManageAccountScreen — kept local to avoid pulling a new
23
+ * shared module into the package public surface for one consumer.
24
+ */
25
+ const formatRelative = (iso: string): string => {
26
+ const date = new Date(iso);
27
+ if (Number.isNaN(date.getTime())) {
28
+ return '—';
29
+ }
30
+ const diffMs = Date.now() - date.getTime();
31
+ const absMin = Math.abs(diffMs) / 60000;
32
+ if (absMin < 1) return 'just now';
33
+ if (absMin < 60) return `${Math.floor(absMin)}m ago`;
34
+ const hrs = absMin / 60;
35
+ if (hrs < 24) return `${Math.floor(hrs)}h ago`;
36
+ const days = hrs / 24;
37
+ if (days < 7) return `${Math.floor(days)}d ago`;
38
+ return date.toLocaleDateString();
39
+ };
40
+
41
+ /**
42
+ * ConnectedAppsScreen — list and revoke FedCM-authorized RP applications.
43
+ *
44
+ * Fetches via `useAuthorizedApps` (drives `GET /fedcm/me/authorized-apps`)
45
+ * and exposes a "Revoke" action that hits `DELETE /fedcm/me/authorized-apps/
46
+ * :origin`. Each revoke invalidates the connected-apps query so the list
47
+ * refreshes immediately.
48
+ */
49
+ const ConnectedAppsScreen: React.FC<BaseScreenProps> = ({ onClose, theme, goBack }) => {
50
+ const bloomTheme = useTheme();
51
+ const { t } = useI18n();
52
+ const colorScheme = useColorScheme();
53
+ const palette = useMemo(
54
+ () => Colors[normalizeColorScheme(colorScheme, normalizeTheme(theme))],
55
+ [colorScheme, theme],
56
+ );
57
+ const { isAuthenticated } = useOxy();
58
+ const {
59
+ data: apps,
60
+ isLoading,
61
+ refetch,
62
+ isRefetching,
63
+ } = useAuthorizedApps({ enabled: isAuthenticated });
64
+ const revokeMutation = useRevokeAuthorizedApp();
65
+ const revokeDialog = useDialogControl();
66
+ const [pendingRevoke, setPendingRevoke] = useState<AuthorizedApp | null>(null);
67
+ const [revokingOrigin, setRevokingOrigin] = useState<string | null>(null);
68
+
69
+ const confirmRevoke = useCallback(
70
+ (app: AuthorizedApp) => {
71
+ setPendingRevoke(app);
72
+ revokeDialog.open();
73
+ },
74
+ [revokeDialog],
75
+ );
76
+
77
+ const handleRevoke = useCallback(async () => {
78
+ if (!pendingRevoke) {
79
+ return;
80
+ }
81
+ const target = pendingRevoke;
82
+ setRevokingOrigin(target.origin);
83
+ try {
84
+ await revokeMutation.mutateAsync(target.origin);
85
+ toast.success(
86
+ t('connectedApps.toasts.revoked', { name: target.name })
87
+ || `Revoked access for ${target.name}`,
88
+ );
89
+ } catch (error) {
90
+ loggerUtil.warn(
91
+ 'Revoke authorized app failed',
92
+ { component: 'ConnectedAppsScreen' },
93
+ error,
94
+ );
95
+ toast.error(
96
+ t('connectedApps.toasts.revokeFailed')
97
+ || 'Failed to revoke access',
98
+ );
99
+ } finally {
100
+ setRevokingOrigin(null);
101
+ setPendingRevoke(null);
102
+ }
103
+ }, [pendingRevoke, revokeMutation, t]);
104
+
105
+ const renderEmpty = useCallback(
106
+ () => (
107
+ <View style={styles.emptyContainer}>
108
+ <EmptyState
109
+ message={
110
+ t('connectedApps.empty.subtitle')
111
+ || 'Apps you authorize to sign in with your Oxy account will appear here'
112
+ }
113
+ textColor={bloomTheme.colors.textSecondary}
114
+ />
115
+ </View>
116
+ ),
117
+ [t, bloomTheme.colors.textSecondary],
118
+ );
119
+
120
+ const renderItem = useCallback(
121
+ ({ item }: { item: AuthorizedApp }) => {
122
+ const isRevoking = revokingOrigin === item.origin;
123
+ return (
124
+ <SettingsListGroup>
125
+ <SettingsListItem
126
+ icon={<SettingsIcon name="apps" color={palette.iconData} />}
127
+ title={item.name}
128
+ description={
129
+ t('connectedApps.item.lastUsed', {
130
+ relative: formatRelative(item.lastUsedAt),
131
+ })
132
+ || `Last used ${formatRelative(item.lastUsedAt)}`
133
+ }
134
+ onPress={isRevoking ? undefined : () => confirmRevoke(item)}
135
+ disabled={isRevoking}
136
+ destructive
137
+ showChevron={false}
138
+ rightElement={
139
+ isRevoking ? (
140
+ <ActivityIndicator
141
+ color={bloomTheme.colors.error}
142
+ size="small"
143
+ />
144
+ ) : undefined
145
+ }
146
+ />
147
+ </SettingsListGroup>
148
+ );
149
+ },
150
+ [bloomTheme.colors.error, confirmRevoke, palette.iconData, revokingOrigin, t],
151
+ );
152
+
153
+ return (
154
+ <View style={[styles.container, { backgroundColor: bloomTheme.colors.background }]}>
155
+ <Header
156
+ title={t('connectedApps.title') || 'Connected apps'}
157
+ onBack={goBack || onClose}
158
+ variant="minimal"
159
+ elevation="subtle"
160
+ />
161
+ {isLoading && !apps ? (
162
+ <View style={styles.center}>
163
+ <ActivityIndicator color={bloomTheme.colors.primary} size="large" />
164
+ </View>
165
+ ) : (
166
+ <FlatList
167
+ data={apps ?? []}
168
+ keyExtractor={(item) => item.origin}
169
+ renderItem={renderItem}
170
+ contentContainerStyle={styles.listContent}
171
+ ListEmptyComponent={renderEmpty}
172
+ refreshControl={
173
+ <RefreshControl
174
+ refreshing={isRefetching}
175
+ onRefresh={refetch}
176
+ tintColor={bloomTheme.colors.primary}
177
+ />
178
+ }
179
+ />
180
+ )}
181
+ <Dialog
182
+ control={revokeDialog}
183
+ title={t('connectedApps.confirm.title') || 'Revoke access'}
184
+ description={
185
+ pendingRevoke
186
+ ? (t('connectedApps.confirm.message', { name: pendingRevoke.name })
187
+ || `Revoke ${pendingRevoke.name}'s access to your Oxy account?`)
188
+ : ''
189
+ }
190
+ actions={[
191
+ {
192
+ label: t('common.revoke') || 'Revoke',
193
+ color: 'destructive',
194
+ onPress: handleRevoke,
195
+ },
196
+ { label: t('common.cancel') || 'Cancel', color: 'cancel' },
197
+ ]}
198
+ />
199
+ </View>
200
+ );
201
+ };
202
+
203
+ const styles = StyleSheet.create({
204
+ container: {
205
+ flex: 1,
206
+ },
207
+ center: {
208
+ flex: 1,
209
+ alignItems: 'center',
210
+ justifyContent: 'center',
211
+ },
212
+ listContent: {
213
+ paddingHorizontal: 16,
214
+ paddingVertical: 16,
215
+ flexGrow: 1,
216
+ },
217
+ emptyContainer: {
218
+ flex: 1,
219
+ justifyContent: 'center',
220
+ alignItems: 'center',
221
+ paddingVertical: 48,
222
+ },
223
+ });
224
+
225
+ export default React.memo(ConnectedAppsScreen);