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