@oxyhq/services 6.10.8 → 7.0.0

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