@oxyhq/services 6.10.8 → 8.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 +31 -13
  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,1003 +0,0 @@
1
- import type React from 'react';
2
- import { useState, useEffect, useMemo, useCallback } from 'react';
3
- import {
4
- View,
5
- Text,
6
- TouchableOpacity,
7
- StyleSheet,
8
- ActivityIndicator,
9
- ScrollView,
10
- Platform,
11
- Image,
12
- Dimensions,
13
- } from 'react-native';
14
- import type { BaseScreenProps } from '../types/navigation';
15
- import type { ClientSession } from '@oxyhq/core';
16
- import type { User } from '@oxyhq/core';
17
- import { getAccountDisplayName, getAccountFallbackHandle } from '@oxyhq/core';
18
- import { Dialog, toast, useDialogControl } from '@oxyhq/bloom';
19
- import OxyIcon from '../components/icon/OxyIcon';
20
- import { Ionicons } from '@expo/vector-icons';
21
- import Avatar from '../components/Avatar';
22
- import { Header, LoadingState } from '../components';
23
- import { SettingsListGroup, SettingsListItem } from '@oxyhq/bloom/settings-list';
24
- import { SettingsIcon } from '../components/SettingsIcon';
25
- import { useI18n } from '../hooks/useI18n';
26
- import { useTheme } from '@oxyhq/bloom/theme';
27
- import { useOxy } from '../context/OxyContext';
28
-
29
- interface SessionWithUser extends ClientSession {
30
- userProfile?: User;
31
- isLoadingProfile?: boolean;
32
- }
33
-
34
- interface DeviceSession {
35
- sessionId: string;
36
- deviceId: string;
37
- deviceName: string;
38
- isActive: boolean;
39
- lastActive: string;
40
- expiresAt: string;
41
- isCurrent: boolean;
42
- }
43
-
44
- const ModernAccountSwitcherScreen: React.FC<BaseScreenProps> = ({
45
- onClose,
46
- theme,
47
- navigate,
48
- goBack,
49
- }) => {
50
- const bloomTheme = useTheme();
51
- // Use useOxy() hook for OxyContext values
52
- const {
53
- oxyServices,
54
- user,
55
- sessions = [],
56
- activeSessionId = null,
57
- switchSession,
58
- removeSession,
59
- logoutAll,
60
- refreshSessions,
61
- isLoading = false,
62
- isAuthenticated = false,
63
- actingAs,
64
- managedAccounts,
65
- setActingAs,
66
- } = useOxy();
67
-
68
- const [sessionsWithUsers, setSessionsWithUsers] = useState<SessionWithUser[]>([]);
69
- const [switchingToUserId, setSwitchingToUserId] = useState<string | null>(null);
70
- const [removingUserId, setRemovingUserId] = useState<string | null>(null);
71
- const [switchingManagedId, setSwitchingManagedId] = useState<string | null>(null);
72
-
73
- // Device session management state
74
- const [showDeviceManagement, setShowDeviceManagement] = useState(false);
75
- const [deviceSessions, setDeviceSessions] = useState<DeviceSession[]>([]);
76
- const [loadingDeviceSessions, setLoadingDeviceSessions] = useState(false);
77
- const [remotingLogoutSessionId, setRemoteLogoutSessionId] = useState<string | null>(null);
78
- const [loggingOutAllDevices, setLoggingOutAllDevices] = useState(false);
79
-
80
- // Pending state for prompts
81
- const [pendingRemoveSession, setPendingRemoveSession] = useState<{ sessionId: string; displayName: string } | null>(null);
82
- const [pendingRemoteLogout, setPendingRemoteLogout] = useState<{ sessionId: string; deviceName: string } | null>(null);
83
-
84
- // Prompt controls
85
- const removeSessionDialog = useDialogControl();
86
- const logoutAllDialog = useDialogControl();
87
- const remoteLogoutDialog = useDialogControl();
88
- const logoutAllDevicesDialog = useDialogControl();
89
-
90
- const screenWidth = Dimensions.get('window').width;
91
- const { t, locale } = useI18n();
92
- const styles = useMemo(() => createStyles(bloomTheme.colors), [bloomTheme.colors]);
93
-
94
- // Refresh sessions when screen loads
95
- useEffect(() => {
96
- if (isAuthenticated && activeSessionId && refreshSessions) {
97
- refreshSessions();
98
- }
99
- }, [isAuthenticated, activeSessionId, refreshSessions]);
100
-
101
- // Memoize session IDs to prevent unnecessary re-renders
102
- const sessionIds = useMemo(() => sessions.map(s => s.sessionId).join(','), [sessions]);
103
-
104
- // Re-load the session profiles whenever the active user's identity
105
- // changes (e.g. the user just picked a username in the onboarding flow).
106
- // Without this, the cached batch result still has the pre-username state
107
- // and `@unknown` shows in the switcher even though the username is saved.
108
- const activeUserSignature = useMemo(() => {
109
- if (!user) return '';
110
- const username = typeof user.username === 'string' ? user.username : '';
111
- const avatar = typeof user.avatar === 'string' ? user.avatar : '';
112
- const displayName = typeof user.name === 'string'
113
- ? user.name
114
- : typeof user.name === 'object' && user.name !== null
115
- ? (user.name.full || user.name.first || '')
116
- : '';
117
- return `${username}|${avatar}|${displayName}`;
118
- }, [user]);
119
-
120
- // Load user profiles for sessions
121
- // Production-ready: Optimized with batching, memoization, and error handling
122
- useEffect(() => {
123
- let cancelled = false;
124
-
125
- const loadUserProfiles = async () => {
126
- if (!sessions.length || !oxyServices || cancelled) return;
127
-
128
- // Sessions are already deduplicated by userId at the core level (OxyContext)
129
- const uniqueSessions = sessions;
130
-
131
- // Initialize loading state
132
- setSessionsWithUsers(uniqueSessions.map(session => ({
133
- ...session,
134
- isLoadingProfile: true,
135
- })));
136
-
137
- // Batch load profiles for better performance using batch endpoint
138
- try {
139
- const sessionIds = uniqueSessions.map(s => s.sessionId);
140
- const batchResults = await oxyServices.getUsersBySessions(sessionIds);
141
-
142
- // Create a map for O(1) lookup
143
- const userProfileMap = new Map<string, User | null>();
144
- batchResults.forEach(({ sessionId, user }: { sessionId: string; user: User | null }) => {
145
- userProfileMap.set(sessionId, user);
146
- });
147
-
148
- if (cancelled) return;
149
-
150
- // Update sessions with loaded profiles - optimized with Map for O(1) lookup
151
- setSessionsWithUsers(prev => {
152
- return prev.map(session => {
153
- const userProfile = userProfileMap.get(session.sessionId);
154
- return {
155
- ...session,
156
- userProfile: userProfile || undefined,
157
- isLoadingProfile: false,
158
- };
159
- });
160
- });
161
- } catch (error) {
162
- if (!cancelled && __DEV__) {
163
- console.error('Failed to load user profiles:', error);
164
- }
165
- if (!cancelled) {
166
- setSessionsWithUsers(prev =>
167
- prev.map(s => ({ ...s, isLoadingProfile: false }))
168
- );
169
- }
170
- }
171
- };
172
-
173
- loadUserProfiles();
174
-
175
- return () => {
176
- cancelled = true;
177
- };
178
- }, [sessionIds, oxyServices, sessions, activeUserSignature]);
179
-
180
- const handleSwitchSession = useCallback(async (sessionId: string) => {
181
- if (sessionId === (activeSessionId ?? null)) return; // Already active session
182
- if (switchingToUserId) return; // Already switching
183
-
184
- setSwitchingToUserId(sessionId);
185
- try {
186
- await switchSession(sessionId);
187
- toast.success(t('accountSwitcher.toasts.switchSuccess') || 'Account switched successfully!');
188
- if (onClose) {
189
- onClose();
190
- }
191
- } catch (error) {
192
- if (__DEV__) {
193
- console.error('Switch session failed:', error);
194
- }
195
- toast.error(t('accountSwitcher.toasts.switchFailed') || 'There was a problem switching accounts. Please try again.');
196
- } finally {
197
- setSwitchingToUserId(null);
198
- }
199
- }, [activeSessionId, switchSession, onClose, t, switchingToUserId]);
200
-
201
- const confirmRemoveSession = useCallback((sessionId: string, displayName: string) => {
202
- if (removingUserId) return;
203
- setPendingRemoveSession({ sessionId, displayName });
204
- removeSessionDialog.open();
205
- }, [removingUserId, removeSessionDialog]);
206
-
207
- const handleRemoveSession = useCallback(async () => {
208
- if (!pendingRemoveSession) return;
209
- const { sessionId } = pendingRemoveSession;
210
- setRemovingUserId(sessionId);
211
- try {
212
- await removeSession(sessionId);
213
- toast.success(t('accountSwitcher.toasts.removeSuccess') || 'Account removed successfully!');
214
- } catch (error) {
215
- if (__DEV__) {
216
- console.error('Remove session failed:', error);
217
- }
218
- toast.error(t('accountSwitcher.toasts.removeFailed') || 'There was a problem removing the account. Please try again.');
219
- } finally {
220
- setRemovingUserId(null);
221
- setPendingRemoveSession(null);
222
- }
223
- }, [pendingRemoveSession, removeSession, t]);
224
-
225
- const confirmLogoutAll = useCallback(() => {
226
- logoutAllDialog.open();
227
- }, [logoutAllDialog]);
228
-
229
- const handleLogoutAll = useCallback(async () => {
230
- try {
231
- await logoutAll();
232
- toast.success(t('accountSwitcher.toasts.signOutAllSuccess') || 'All accounts signed out successfully!');
233
- if (onClose) {
234
- onClose();
235
- }
236
- } catch (error) {
237
- if (__DEV__) {
238
- console.error('Logout all failed:', error);
239
- }
240
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
241
- toast.error(t('accountSwitcher.toasts.signOutAllFailed', { error: errorMessage }) || `There was a problem signing out: ${errorMessage}`);
242
- }
243
- }, [logoutAll, onClose, t]);
244
-
245
- const handleSwitchToManagedAccount = useCallback(async (accountId: string) => {
246
- if (actingAs === accountId) return; // Already acting as this account
247
- if (switchingManagedId) return; // Already switching
248
-
249
- setSwitchingManagedId(accountId);
250
- try {
251
- setActingAs(accountId);
252
- toast.success(t('accountSwitcher.toasts.switchSuccess') || 'Switched identity successfully!');
253
- onClose?.();
254
- } catch (error) {
255
- if (__DEV__) {
256
- console.error('Switch managed account failed:', error);
257
- }
258
- toast.error('Failed to switch identity. Please try again.');
259
- } finally {
260
- setSwitchingManagedId(null);
261
- }
262
- }, [actingAs, switchingManagedId, setActingAs, t, onClose]);
263
-
264
- const handleSwitchBackToPrimary = useCallback(() => {
265
- setActingAs(null);
266
- toast.success('Switched back to primary account');
267
- }, [setActingAs]);
268
-
269
- // Device session management functions - optimized with useCallback
270
- const loadAllDeviceSessions = useCallback(async () => {
271
- const currentActiveSessionId = activeSessionId ?? null;
272
- if (!oxyServices || !currentActiveSessionId) return;
273
-
274
- setLoadingDeviceSessions(true);
275
- try {
276
- const allSessions = await oxyServices.getDeviceSessions(currentActiveSessionId);
277
- setDeviceSessions(allSessions || []);
278
- } catch (error) {
279
- if (__DEV__) {
280
- console.error('Failed to load device sessions:', error);
281
- }
282
- toast.error(t('accountSwitcher.toasts.deviceLoadFailed') || 'Failed to load device sessions. Please try again.');
283
- } finally {
284
- setLoadingDeviceSessions(false);
285
- }
286
- }, [oxyServices, activeSessionId, t]);
287
-
288
- const confirmRemoteSessionLogout = useCallback((sessionId: string, deviceName: string) => {
289
- if (remotingLogoutSessionId) return;
290
- setPendingRemoteLogout({ sessionId, deviceName });
291
- remoteLogoutDialog.open();
292
- }, [remotingLogoutSessionId, remoteLogoutDialog]);
293
-
294
- const handleRemoteSessionLogout = useCallback(async () => {
295
- if (!pendingRemoteLogout) return;
296
- const { sessionId } = pendingRemoteLogout;
297
- setRemoteLogoutSessionId(sessionId);
298
- try {
299
- await oxyServices?.logoutSession((activeSessionId ?? null) || '', sessionId);
300
- await loadAllDeviceSessions();
301
- toast.success(t('accountSwitcher.toasts.remoteSignOutSuccess', { deviceName: pendingRemoteLogout.deviceName }) || `Signed out from ${pendingRemoteLogout.deviceName} successfully!`);
302
- } catch (error) {
303
- if (__DEV__) {
304
- console.error('Remote logout failed:', error);
305
- }
306
- toast.error(t('accountSwitcher.toasts.remoteSignOutFailed') || 'There was a problem signing out from the device. Please try again.');
307
- } finally {
308
- setRemoteLogoutSessionId(null);
309
- setPendingRemoteLogout(null);
310
- }
311
- }, [pendingRemoteLogout, activeSessionId, oxyServices, loadAllDeviceSessions, t]);
312
-
313
- const confirmLogoutAllDevices = useCallback(() => {
314
- const otherDevicesCount = deviceSessions.filter(session => !session.isCurrent).length;
315
-
316
- if (otherDevicesCount === 0) {
317
- toast.info(t('accountSwitcher.toasts.noOtherDeviceSessions') || 'No other device sessions found to sign out from.');
318
- return;
319
- }
320
-
321
- if (loggingOutAllDevices) return;
322
- logoutAllDevicesDialog.open();
323
- }, [deviceSessions, loggingOutAllDevices, logoutAllDevicesDialog, t]);
324
-
325
- const handleLogoutAllDevices = useCallback(async () => {
326
- setLoggingOutAllDevices(true);
327
- try {
328
- await oxyServices?.logoutAllDeviceSessions((activeSessionId ?? null) || '');
329
- await loadAllDeviceSessions();
330
- toast.success(t('accountSwitcher.toasts.signOutOthersSuccess') || 'Signed out from all other devices successfully!');
331
- } catch (error) {
332
- if (__DEV__) {
333
- console.error('Logout all devices failed:', error);
334
- }
335
- toast.error(t('accountSwitcher.toasts.signOutOthersFailed') || 'There was a problem signing out from other devices. Please try again.');
336
- } finally {
337
- setLoggingOutAllDevices(false);
338
- }
339
- }, [activeSessionId, oxyServices, loadAllDeviceSessions, t]);
340
-
341
- // Memoize filtered sessions for performance
342
- const otherSessions = useMemo(
343
- () => sessionsWithUsers.filter(s => s.sessionId !== (activeSessionId ?? null)),
344
- [sessionsWithUsers, activeSessionId]
345
- );
346
-
347
- const otherDevicesCount = useMemo(
348
- () => deviceSessions.filter(session => !session.isCurrent).length,
349
- [deviceSessions]
350
- );
351
-
352
- return (
353
- <View style={[styles.container, { backgroundColor: bloomTheme.colors.background }]}>
354
- {/* Header */}
355
- <Header
356
- title={t('accountSwitcher.title') || 'Account Switcher'}
357
-
358
- onBack={goBack}
359
- onClose={onClose}
360
- showBackButton={true}
361
- showCloseButton={true}
362
- elevation="subtle"
363
- rightAction={{
364
- icon: "refresh",
365
- onPress: refreshSessions
366
- }}
367
- />
368
-
369
- <ScrollView style={styles.content}>
370
- {isLoading ? (
371
- <LoadingState
372
- message={t('accountSwitcher.loading') || 'Loading accounts...'}
373
- color={bloomTheme.colors.info}
374
- />
375
- ) : (
376
- <>
377
- {/* Current Account */}
378
- {isAuthenticated && user && (() => {
379
- const currentDisplayName = getAccountDisplayName(user, locale);
380
- const currentHandle = getAccountFallbackHandle(user);
381
- const avatarInitial = currentDisplayName.charAt(0).toUpperCase();
382
- return (
383
- <View style={styles.section}>
384
- <Text style={styles.sectionTitle}>{t('accountSwitcher.sections.current') || 'Current Account'}</Text>
385
-
386
- <View style={[styles.settingItem, styles.firstSettingItem, styles.lastSettingItem, styles.currentAccountCard]}>
387
- <View style={styles.userIcon}>
388
- {user.avatar ? (
389
- <Image source={{ uri: oxyServices.getFileDownloadUrl(user.avatar, 'thumb') }} style={styles.accountAvatarImage} />
390
- ) : (
391
- <View style={styles.accountAvatarFallback}>
392
- <Text style={styles.accountAvatarText}>{avatarInitial}</Text>
393
- </View>
394
- )}
395
- <View style={styles.activeBadge}>
396
- <OxyIcon name="checkmark" size={12} color={bloomTheme.colors.negativeForeground} />
397
- </View>
398
- </View>
399
- <View style={styles.settingInfo}>
400
- <View>
401
- <Text style={styles.settingLabel}>{currentDisplayName}</Text>
402
- {user.email || currentHandle ? (
403
- <Text style={styles.settingDescription}>
404
- {user.email || (currentHandle && user.username ? `@${currentHandle}` : currentHandle)}
405
- </Text>
406
- ) : null}
407
- </View>
408
- </View>
409
- <View style={styles.currentBadge}>
410
- <Text style={styles.currentBadgeText}>{t('accountSwitcher.currentBadge') || 'Current'}</Text>
411
- </View>
412
- </View>
413
- </View>
414
- );
415
- })()}
416
-
417
- {/* Other Accounts */}
418
- {otherSessions.length > 0 && (
419
- <View style={styles.section}>
420
- <Text style={styles.sectionTitle}>
421
- {t('accountSwitcher.sections.otherWithCount', { count: otherSessions.length }) || `Other Accounts (${otherSessions.length})`}
422
- </Text>
423
-
424
- {otherSessions.map((sessionWithUser, index, filteredArray) => {
425
- const isFirst = index === 0;
426
- const isLast = index === filteredArray.length - 1;
427
- const isSwitching = switchingToUserId === sessionWithUser.sessionId;
428
- const isRemoving = removingUserId === sessionWithUser.sessionId;
429
- const { userProfile, isLoadingProfile } = sessionWithUser;
430
-
431
- // Use the shared core helper so the fallback chain
432
- // (name → username → publicKey → translated "Unnamed")
433
- // is identical across every UI surface.
434
- const displayName = getAccountDisplayName(userProfile, locale);
435
- const fallbackHandle = getAccountFallbackHandle(userProfile);
436
-
437
- return (
438
- <View
439
- key={`session-${sessionWithUser.sessionId}-${index}`}
440
- style={[
441
- styles.settingItem,
442
- isFirst && styles.firstSettingItem,
443
- isLast && styles.lastSettingItem,
444
- ]}
445
- >
446
- <View style={styles.userIcon}>
447
- {isLoadingProfile ? (
448
- <View style={styles.accountAvatarFallback}>
449
- <ActivityIndicator size="small" color={bloomTheme.colors.info} />
450
- </View>
451
- ) : userProfile?.avatar ? (
452
- <Image source={{ uri: oxyServices.getFileDownloadUrl(userProfile.avatar, 'thumb') }} style={styles.accountAvatarImage} />
453
- ) : (
454
- <View style={styles.accountAvatarFallback}>
455
- <Text style={styles.accountAvatarText}>
456
- {displayName.charAt(0).toUpperCase()}
457
- </Text>
458
- </View>
459
- )}
460
- </View>
461
- <View style={styles.settingInfo}>
462
- <View>
463
- <Text style={styles.settingLabel}>{displayName}</Text>
464
- {fallbackHandle ? (
465
- <Text style={styles.settingDescription}>
466
- {userProfile?.username ? `@${fallbackHandle}` : fallbackHandle}
467
- </Text>
468
- ) : null}
469
- </View>
470
- </View>
471
- <View style={styles.accountActions}>
472
- <TouchableOpacity
473
- style={styles.switchButton}
474
- onPress={() => handleSwitchSession(sessionWithUser.sessionId)}
475
- disabled={isSwitching || isRemoving}
476
- >
477
- {isSwitching ? (
478
- <ActivityIndicator size="small" color={bloomTheme.colors.info} />
479
- ) : (
480
- <Text style={styles.switchButtonText}>Switch</Text>
481
- )}
482
- </TouchableOpacity>
483
- <TouchableOpacity
484
- style={styles.removeButton}
485
- onPress={() => confirmRemoveSession(sessionWithUser.sessionId, displayName)}
486
- disabled={isSwitching || isRemoving}
487
- >
488
- {isRemoving ? (
489
- <ActivityIndicator size="small" color={bloomTheme.colors.error} />
490
- ) : (
491
- <OxyIcon name="trash" size={16} color={bloomTheme.colors.error} />
492
- )}
493
- </TouchableOpacity>
494
- </View>
495
- </View>
496
- );
497
- })}
498
- </View>
499
- )}
500
-
501
- {/* Acting as banner - show switch-back when acting as a managed account */}
502
- {actingAs && (
503
- <View style={styles.section}>
504
- <TouchableOpacity
505
- style={[styles.settingItem, styles.firstSettingItem, styles.lastSettingItem, styles.actingAsBanner]}
506
- onPress={handleSwitchBackToPrimary}
507
- activeOpacity={0.7}
508
- >
509
- <View style={styles.settingInfo}>
510
- <Text style={styles.settingLabel}>Switch back to primary account</Text>
511
- <Text style={styles.settingDescription}>You are currently acting as another identity</Text>
512
- </View>
513
- <View style={styles.switchBackButton}>
514
- <Text style={styles.switchBackButtonText}>Switch Back</Text>
515
- </View>
516
- </TouchableOpacity>
517
- </View>
518
- )}
519
-
520
- {/* Managed Accounts */}
521
- {managedAccounts.length > 0 && (
522
- <View style={styles.section}>
523
- <Text style={styles.sectionTitle}>Managed Accounts</Text>
524
- <Text style={styles.sectionSubtitle}>Identities you manage</Text>
525
-
526
- {managedAccounts.map((managed, index) => {
527
- const account = managed.account;
528
- if (!account) return null;
529
-
530
- const isActive = actingAs === managed.accountId;
531
- const isSwitching = switchingManagedId === managed.accountId;
532
- const isFirst = index === 0;
533
- const isLast = index === managedAccounts.length - 1;
534
-
535
- const managedDisplayName = getAccountDisplayName(account, locale);
536
-
537
- // Determine the manager role for badge display
538
- const myRole = managed.managers?.find(
539
- (m) => m.userId === user?.id
540
- )?.role ?? 'owner';
541
-
542
- return (
543
- <TouchableOpacity
544
- key={`managed-${managed.accountId}`}
545
- style={[
546
- styles.settingItem,
547
- isFirst && styles.firstSettingItem,
548
- isLast && styles.lastSettingItem,
549
- isActive && styles.currentAccountCard,
550
- ]}
551
- onPress={() => handleSwitchToManagedAccount(managed.accountId)}
552
- disabled={isActive || isSwitching}
553
- activeOpacity={0.7}
554
- >
555
- <View style={styles.userIcon}>
556
- {account.avatar ? (
557
- <Image source={{ uri: oxyServices.getFileDownloadUrl(account.avatar, 'thumb') }} style={styles.accountAvatarImage} />
558
- ) : (
559
- <View style={[styles.accountAvatarFallback, styles.managedAvatarFallback]}>
560
- <Text style={styles.accountAvatarText}>
561
- {managedDisplayName.charAt(0).toUpperCase()}
562
- </Text>
563
- </View>
564
- )}
565
- {isActive && (
566
- <View style={styles.activeBadge}>
567
- <OxyIcon name="checkmark" size={12} color={bloomTheme.colors.negativeForeground} />
568
- </View>
569
- )}
570
- </View>
571
- <View style={styles.settingInfo}>
572
- <View>
573
- <Text style={styles.settingLabel}>{managedDisplayName}</Text>
574
- {(() => {
575
- const handle = getAccountFallbackHandle(account);
576
- return handle ? (
577
- <Text style={styles.settingDescription}>
578
- {account.username ? `@${handle}` : handle}
579
- </Text>
580
- ) : null;
581
- })()}
582
- </View>
583
- </View>
584
- <View style={styles.accountActions}>
585
- <View style={styles.roleBadge}>
586
- <Text style={styles.roleBadgeText}>{myRole}</Text>
587
- </View>
588
- {isActive ? (
589
- <View style={styles.currentBadge}>
590
- <Text style={styles.currentBadgeText}>Current</Text>
591
- </View>
592
- ) : (
593
- <TouchableOpacity
594
- style={styles.switchButton}
595
- onPress={() => handleSwitchToManagedAccount(managed.accountId)}
596
- disabled={isSwitching}
597
- >
598
- {isSwitching ? (
599
- <ActivityIndicator size="small" color={bloomTheme.colors.negativeForeground} />
600
- ) : (
601
- <Text style={styles.switchButtonText}>Act As</Text>
602
- )}
603
- </TouchableOpacity>
604
- )}
605
- </View>
606
- </TouchableOpacity>
607
- );
608
- })}
609
-
610
- {/* Create New Identity */}
611
- <TouchableOpacity
612
- style={[styles.settingItem, styles.firstSettingItem, styles.lastSettingItem, { marginTop: 8 }]}
613
- onPress={() => navigate?.('CreateManagedAccount')}
614
- activeOpacity={0.7}
615
- >
616
- <View style={styles.userIcon}>
617
- <View style={[styles.accountAvatarFallback, { backgroundColor: bloomTheme.colors.primarySubtle }]}>
618
- <OxyIcon name="add" size={20} color={bloomTheme.colors.info} />
619
- </View>
620
- </View>
621
- <View style={styles.settingInfo}>
622
- <Text style={[styles.settingLabel, { color: bloomTheme.colors.info }]}>Create New Identity</Text>
623
- <Text style={styles.settingDescription}>Add a managed sub-account</Text>
624
- </View>
625
- </TouchableOpacity>
626
- </View>
627
- )}
628
-
629
- {/* Create first managed account (when none exist yet) */}
630
- {managedAccounts.length === 0 && isAuthenticated && (
631
- <View style={styles.section}>
632
- <Text style={styles.sectionTitle}>Managed Accounts</Text>
633
- <TouchableOpacity
634
- style={[styles.settingItem, styles.firstSettingItem, styles.lastSettingItem]}
635
- onPress={() => navigate?.('CreateManagedAccount')}
636
- activeOpacity={0.7}
637
- >
638
- <View style={styles.userIcon}>
639
- <View style={[styles.accountAvatarFallback, { backgroundColor: bloomTheme.colors.primarySubtle }]}>
640
- <OxyIcon name="add" size={20} color={bloomTheme.colors.info} />
641
- </View>
642
- </View>
643
- <View style={styles.settingInfo}>
644
- <Text style={[styles.settingLabel, { color: bloomTheme.colors.info }]}>Create New Identity</Text>
645
- <Text style={styles.settingDescription}>Create a managed sub-account you control</Text>
646
- </View>
647
- </TouchableOpacity>
648
- </View>
649
- )}
650
-
651
- {/* Quick Actions */}
652
- <View style={styles.section}>
653
- <SettingsListGroup title="Quick Actions">
654
- <SettingsListItem
655
- icon={<SettingsIcon name="account-plus" color={bloomTheme.colors.info} />}
656
- title="Add Another Account"
657
- description="Sign in with a different account"
658
- onPress={() => navigate?.('OxyAuth')}
659
- />
660
- <SettingsListItem
661
- icon={<SettingsIcon name="cellphone" color={bloomTheme.colors.secondary} />}
662
- title={`${showDeviceManagement ? 'Hide' : 'Manage'} Device Sessions`}
663
- description="View and manage sessions on other devices"
664
- onPress={() => setShowDeviceManagement(!showDeviceManagement)}
665
- />
666
- <SettingsListItem
667
- icon={<SettingsIcon name="logout" color={bloomTheme.colors.error} />}
668
- title="Sign Out All Accounts"
669
- description="Remove all accounts from this device"
670
- onPress={confirmLogoutAll}
671
- disabled={sessionsWithUsers.length === 0}
672
- destructive={true}
673
- />
674
- </SettingsListGroup>
675
- </View>
676
-
677
- {/* Device Management Section */}
678
- {showDeviceManagement && (
679
- <View style={styles.section}>
680
- <Text style={styles.sectionTitle}>{t('accountSwitcher.sections.deviceSessions') || 'Device Sessions'}</Text>
681
-
682
- {loadingDeviceSessions ? (
683
- <SettingsListGroup>
684
- <SettingsListItem
685
- icon={<SettingsIcon name="sync" color={bloomTheme.colors.info} />}
686
- title={t('accountSwitcher.device.loadingTitle') || 'Loading device sessions...'}
687
- description={t('accountSwitcher.device.loadingSubtitle') || 'Please wait while we fetch your device sessions'}
688
- disabled={true}
689
- rightElement={<ActivityIndicator size="small" color={bloomTheme.colors.info} />}
690
- showChevron={false}
691
- />
692
- </SettingsListGroup>
693
- ) : deviceSessions.length === 0 ? (
694
- <SettingsListGroup>
695
- <SettingsListItem
696
- icon={<SettingsIcon name="cellphone" color={bloomTheme.colors.textTertiary} />}
697
- title={t('accountSwitcher.device.noneTitle') || 'No device sessions found'}
698
- description={t('accountSwitcher.device.noneSubtitle') || 'Device session management not available'}
699
- disabled={true}
700
- showChevron={false}
701
- />
702
- </SettingsListGroup>
703
- ) : (
704
- <SettingsListGroup>
705
- {deviceSessions.map((session) => (
706
- <SettingsListItem
707
- key={`device-session-${session.sessionId}`}
708
- icon={<SettingsIcon name={session.isCurrent ? 'cellphone' : 'cellphone-basic'} color={session.isCurrent ? bloomTheme.colors.success : bloomTheme.colors.textTertiary} />}
709
- title={`${session.deviceName} ${session.isCurrent ? `(${t('accountSwitcher.device.thisDevice') || 'This device'})` : ''}`}
710
- description={t('accountSwitcher.device.lastActive', { date: new Date(session.lastActive).toLocaleDateString() }) || `Last active: ${new Date(session.lastActive).toLocaleDateString()}`}
711
- onPress={session.isCurrent ? undefined : () => confirmRemoteSessionLogout(session.sessionId, session.deviceName)}
712
- disabled={session.isCurrent || remotingLogoutSessionId === session.sessionId}
713
- showChevron={false}
714
- rightElement={!session.isCurrent ? (
715
- <TouchableOpacity
716
- style={styles.removeButton}
717
- onPress={() => confirmRemoteSessionLogout(session.sessionId, session.deviceName)}
718
- disabled={remotingLogoutSessionId === session.sessionId}
719
- >
720
- {remotingLogoutSessionId === session.sessionId ? (
721
- <ActivityIndicator size="small" color={bloomTheme.colors.error} />
722
- ) : (
723
- <OxyIcon name="log-out" size={16} color={bloomTheme.colors.error} />
724
- )}
725
- </TouchableOpacity>
726
- ) : undefined}
727
- />
728
- ))}
729
- </SettingsListGroup>
730
- )}
731
- </View>
732
- )}
733
-
734
- {/* Empty State */}
735
- {sessionsWithUsers.length === 0 && (
736
- <View style={styles.section}>
737
- <SettingsListGroup>
738
- <SettingsListItem
739
- icon={<SettingsIcon name="account-outline" color={bloomTheme.colors.textTertiary} />}
740
- title={t('accountSwitcher.empty.title') || 'No saved accounts'}
741
- description={t('accountSwitcher.empty.subtitle') || 'Add another account to switch between them quickly'}
742
- onPress={() => navigate?.('OxyAuth')}
743
- rightElement={
744
- <View style={styles.emptyStateContainer}>
745
- <OxyIcon name="person-outline" size={48} color={bloomTheme.colors.textTertiary} />
746
- <Text style={styles.emptyStateTitle}>{t('accountSwitcher.empty.title') || 'No saved accounts'}</Text>
747
- <Text style={styles.emptyStateDescription}>
748
- {t('accountSwitcher.empty.subtitle') || 'Add another account to switch between them quickly'}
749
- </Text>
750
- <TouchableOpacity
751
- style={styles.addAccountButton}
752
- onPress={() => navigate?.('OxyAuth')}
753
- >
754
- <Text style={styles.addAccountButtonText}>{t('accountCenter.sections.addAccount') || 'Add Account'}</Text>
755
- </TouchableOpacity>
756
- </View>
757
- }
758
- showChevron={false}
759
- />
760
- </SettingsListGroup>
761
- </View>
762
- )}
763
- </>
764
- )}
765
- </ScrollView>
766
- <Dialog
767
- control={removeSessionDialog}
768
- title={t('accountSwitcher.confirms.removeTitle') || 'Remove Account'}
769
- description={pendingRemoveSession ? (t('accountSwitcher.confirms.remove', { displayName: pendingRemoveSession.displayName }) || `Are you sure you want to remove ${pendingRemoveSession.displayName} from this device? You'll need to sign in again to access this account.`) : ''}
770
- actions={[
771
- { label: t('common.remove') || 'Remove', color: 'destructive', onPress: handleRemoveSession },
772
- { label: t('common.cancel') || 'Cancel', color: 'cancel' },
773
- ]}
774
- />
775
- <Dialog
776
- control={logoutAllDialog}
777
- title={t('accountSwitcher.confirms.logoutAllTitle') || 'Sign Out All'}
778
- description={t('accountSwitcher.confirms.logoutAll') || 'Are you sure you want to sign out of all accounts? This will remove all saved accounts from this device.'}
779
- actions={[
780
- { label: t('common.signOutAll') || 'Sign Out All', color: 'destructive', onPress: handleLogoutAll },
781
- { label: t('common.cancel') || 'Cancel', color: 'cancel' },
782
- ]}
783
- />
784
- <Dialog
785
- control={remoteLogoutDialog}
786
- title={t('accountSwitcher.confirms.remoteLogoutTitle') || 'Remote Sign Out'}
787
- description={pendingRemoteLogout ? (t('accountSwitcher.confirms.remoteLogout', { deviceName: pendingRemoteLogout.deviceName }) || `Are you sure you want to sign out from "${pendingRemoteLogout.deviceName}"? This will end the session on that device.`) : ''}
788
- actions={[
789
- { label: t('common.signOut') || 'Sign Out', color: 'destructive', onPress: handleRemoteSessionLogout },
790
- { label: t('common.cancel') || 'Cancel', color: 'cancel' },
791
- ]}
792
- />
793
- <Dialog
794
- control={logoutAllDevicesDialog}
795
- title={t('accountSwitcher.confirms.logoutOthersTitle') || 'Sign Out Other Devices'}
796
- description={t('accountSwitcher.confirms.logoutOthers', { count: otherDevicesCount }) || `Are you sure you want to sign out from all ${otherDevicesCount} other device(s)? This will end sessions on all other devices except this one.`}
797
- actions={[
798
- { label: t('common.signOutAll') || 'Sign Out All', color: 'destructive', onPress: handleLogoutAllDevices },
799
- { label: t('common.cancel') || 'Cancel', color: 'cancel' },
800
- ]}
801
- />
802
- </View>
803
- );
804
- };
805
-
806
- const createStyles = (colors: ReturnType<typeof useTheme>['colors']) =>
807
- StyleSheet.create({
808
- container: {
809
- flex: 1,
810
- backgroundColor: colors.background,
811
- },
812
-
813
- content: {
814
- flex: 1,
815
- padding: 16,
816
- },
817
- section: {
818
- marginBottom: 24,
819
- },
820
- sectionTitle: {
821
- fontSize: 16,
822
- fontWeight: Platform.OS === 'web' ? '600' : undefined,
823
- color: colors.text,
824
- },
825
- settingItem: {
826
- backgroundColor: colors.card,
827
- padding: 16,
828
- flexDirection: 'row',
829
- alignItems: 'center',
830
- justifyContent: 'space-between',
831
- marginBottom: 2,
832
- },
833
- firstSettingItem: {
834
- borderTopLeftRadius: 24,
835
- borderTopRightRadius: 24,
836
- },
837
- lastSettingItem: {
838
- borderBottomLeftRadius: 24,
839
- borderBottomRightRadius: 24,
840
- marginBottom: 8,
841
- },
842
- currentAccountCard: {
843
- borderWidth: 2,
844
- borderColor: colors.info,
845
- backgroundColor: colors.primarySubtle,
846
- },
847
- settingInfo: {
848
- flexDirection: 'row',
849
- alignItems: 'center',
850
- flex: 1,
851
- },
852
- settingLabel: {
853
- fontSize: 16,
854
- fontWeight: '500',
855
- color: colors.text,
856
- marginBottom: 2,
857
- },
858
- settingDescription: {
859
- fontSize: 14,
860
- color: colors.textSecondary,
861
- },
862
- userIcon: {
863
- marginRight: 12,
864
- position: 'relative',
865
- },
866
- accountAvatarImage: {
867
- width: 40,
868
- height: 40,
869
- borderRadius: 20,
870
- },
871
- accountAvatarFallback: {
872
- width: 40,
873
- height: 40,
874
- borderRadius: 20,
875
- backgroundColor: colors.primary,
876
- alignItems: 'center',
877
- justifyContent: 'center',
878
- },
879
- accountAvatarText: {
880
- color: colors.negativeForeground,
881
- fontSize: 18,
882
- fontWeight: 'bold',
883
- },
884
- activeBadge: {
885
- position: 'absolute',
886
- top: -2,
887
- right: -2,
888
- width: 16,
889
- height: 16,
890
- borderRadius: 8,
891
- backgroundColor: colors.success,
892
- alignItems: 'center',
893
- justifyContent: 'center',
894
- borderWidth: 2,
895
- borderColor: colors.card,
896
- },
897
- currentBadge: {
898
- backgroundColor: colors.info,
899
- paddingHorizontal: 8,
900
- paddingVertical: 4,
901
- borderRadius: 12,
902
- },
903
- currentBadgeText: {
904
- color: colors.negativeForeground,
905
- fontSize: 12,
906
- fontWeight: '600',
907
- },
908
- accountActions: {
909
- flexDirection: 'row',
910
- alignItems: 'center',
911
- gap: 8,
912
- },
913
- switchButton: {
914
- backgroundColor: colors.info,
915
- paddingHorizontal: 16,
916
- paddingVertical: 8,
917
- borderRadius: 16,
918
- minWidth: 60,
919
- alignItems: 'center',
920
- },
921
- switchButtonText: {
922
- color: colors.negativeForeground,
923
- fontSize: 14,
924
- fontWeight: '500',
925
- },
926
- removeButton: {
927
- padding: 8,
928
- borderRadius: 16,
929
- backgroundColor: colors.card,
930
- borderWidth: 1,
931
- borderColor: colors.error,
932
- alignItems: 'center',
933
- justifyContent: 'center',
934
- },
935
- emptyStateContainer: {
936
- alignItems: 'center',
937
- paddingVertical: 32,
938
- paddingHorizontal: 20,
939
- },
940
- emptyStateTitle: {
941
- fontSize: 18,
942
- fontWeight: '600',
943
- color: colors.text,
944
- marginTop: 16,
945
- marginBottom: 8,
946
- },
947
- emptyStateDescription: {
948
- fontSize: 14,
949
- color: colors.textSecondary,
950
- textAlign: 'center',
951
- marginBottom: 24,
952
- lineHeight: 20,
953
- },
954
- addAccountButton: {
955
- backgroundColor: colors.info,
956
- paddingHorizontal: 24,
957
- paddingVertical: 12,
958
- borderRadius: 20,
959
- },
960
- addAccountButtonText: {
961
- color: colors.negativeForeground,
962
- fontSize: 16,
963
- fontWeight: '600',
964
- },
965
- sectionSubtitle: {
966
- fontSize: 13,
967
- color: colors.textTertiary,
968
- marginBottom: 12,
969
- },
970
- managedAvatarFallback: {
971
- backgroundColor: colors.secondary,
972
- },
973
- roleBadge: {
974
- backgroundColor: colors.backgroundSecondary,
975
- paddingHorizontal: 8,
976
- paddingVertical: 3,
977
- borderRadius: 8,
978
- },
979
- roleBadgeText: {
980
- color: colors.textSecondary,
981
- fontSize: 11,
982
- fontWeight: '500',
983
- textTransform: 'capitalize',
984
- },
985
- actingAsBanner: {
986
- borderWidth: 2,
987
- borderColor: colors.warning,
988
- backgroundColor: colors.primarySubtle,
989
- },
990
- switchBackButton: {
991
- backgroundColor: colors.warning,
992
- paddingHorizontal: 14,
993
- paddingVertical: 8,
994
- borderRadius: 16,
995
- },
996
- switchBackButtonText: {
997
- color: colors.negativeForeground,
998
- fontSize: 13,
999
- fontWeight: '600',
1000
- },
1001
- });
1002
-
1003
- export default ModernAccountSwitcherScreen;