@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,620 +0,0 @@
1
- import React, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
2
- import {
3
- View,
4
- Text,
5
- StyleSheet,
6
- ActivityIndicator,
7
- ScrollView,
8
- Animated,
9
- Platform,
10
- Image,
11
- } from 'react-native';
12
- import { MaterialCommunityIcons } from '@expo/vector-icons';
13
- import type { BaseScreenProps } from '../types/navigation';
14
- import { Dialog, toast, useDialogControl } from '@oxyhq/bloom';
15
- import { useAuthStore } from '../stores/authStore';
16
- import { SettingsListGroup, SettingsListItem } from '@oxyhq/bloom/settings-list';
17
- import { useI18n } from '../hooks/useI18n';
18
- import { useTheme } from '@oxyhq/bloom/theme';
19
- import { useColorScheme } from '../hooks/useColorScheme';
20
- import { Colors } from '../constants/theme';
21
- import { normalizeColorScheme } from '../utils/themeUtils';
22
- import type { ProfileFieldType } from './EditProfileFieldScreen';
23
- import { getDisplayName } from '../utils/userUtils';
24
- import { useOxy } from '../context/OxyContext';
25
- import { useCurrentUser } from '../hooks/queries/useAccountQueries';
26
- import { useUploadAvatar } from '../hooks/mutations/useAccountMutations';
27
- import {
28
- SECTION_GAP_LARGE,
29
- COMPONENT_GAP,
30
- HEADER_PADDING_TOP_SETTINGS,
31
- createScreenContentStyle,
32
- } from '../constants/spacing';
33
-
34
-
35
-
36
- const AccountSettingsScreen: React.FC<BaseScreenProps & { initialField?: string; initialSection?: string }> = ({
37
- onClose,
38
- theme,
39
- goBack,
40
- navigate,
41
- initialField,
42
- initialSection,
43
- scrollTo,
44
- }) => {
45
- // Use useOxy() hook for OxyContext values
46
- const {
47
- oxyServices,
48
- isAuthenticated,
49
- } = useOxy();
50
- const { t } = useI18n();
51
-
52
- // Use TanStack Query for user data
53
- const { data: user, isLoading: userLoading } = useCurrentUser({ enabled: isAuthenticated });
54
- const uploadAvatarMutation = useUploadAvatar();
55
-
56
- // Dialog controls
57
- const removeAvatarDialog = useDialogControl();
58
-
59
- // Fall back to the auth store while the query is loading so the screen
60
- // can render immediately with cached profile data on subsequent visits.
61
- const userFromStore = useAuthStore((state) => state.user);
62
- const finalUser = user || userFromStore;
63
- const isUpdatingAvatar = uploadAvatarMutation.isPending;
64
- const [optimisticAvatarId, setOptimisticAvatarId] = useState<string | null>(null);
65
- const scrollViewRef = useRef<ScrollView>(null);
66
- const avatarSectionRef = useRef<View>(null);
67
-
68
- // Section refs for navigation
69
- const profilePictureSectionRef = useRef<View>(null);
70
- const basicInfoSectionRef = useRef<View>(null);
71
- const aboutSectionRef = useRef<View>(null);
72
- const quickActionsSectionRef = useRef<View>(null);
73
- const securitySectionRef = useRef<View>(null);
74
-
75
- // Section Y positions for scrolling
76
- const [profilePictureSectionY, setProfilePictureSectionY] = useState<number | null>(null);
77
- const [basicInfoSectionY, setBasicInfoSectionY] = useState<number | null>(null);
78
- const [aboutSectionY, setAboutSectionY] = useState<number | null>(null);
79
- const [quickActionsSectionY, setQuickActionsSectionY] = useState<number | null>(null);
80
- const [securitySectionY, setSecuritySectionY] = useState<number | null>(null);
81
-
82
-
83
-
84
- // Form state
85
- const [displayName, setDisplayName] = useState('');
86
- const [lastName, setLastName] = useState('');
87
- const [username, setUsername] = useState('');
88
- const [email, setEmail] = useState('');
89
- const [bio, setBio] = useState('');
90
- const [location, setLocation] = useState('');
91
- const [links, setLinks] = useState<string[]>([]);
92
- const [avatarFileId, setAvatarFileId] = useState('');
93
-
94
- // Navigation helper for editing fields
95
- const navigateToEditField = useCallback((fieldType: ProfileFieldType) => {
96
- navigate?.('EditProfileField', { fieldType });
97
- }, [navigate]);
98
-
99
- // Location and links state (for display only - modals handle editing)
100
- const [locations, setLocations] = useState<Array<{
101
- id: string;
102
- name: string;
103
- label?: string;
104
- coordinates?: { lat: number; lon: number };
105
- }>>([]);
106
- const [linksMetadata, setLinksMetadata] = useState<Array<{
107
- url: string;
108
- title?: string;
109
- description?: string;
110
- image?: string;
111
- id: string;
112
- }>>([]);
113
-
114
-
115
- // Get theme colors
116
- const bloomTheme = useTheme();
117
- const colorScheme = useColorScheme();
118
-
119
- // Extract colors for convenience
120
- const colors = Colors[normalizeColorScheme(colorScheme, theme || 'light')];
121
-
122
-
123
- // Track initialization to prevent unnecessary resets
124
- const isInitializedRef = useRef(false);
125
- const previousUserIdRef = useRef<string | null>(null);
126
- const previousAvatarRef = useRef<string | null>(null);
127
-
128
- // Load user data - only reset fields when user actually changes (not just avatar)
129
- useEffect(() => {
130
- if (finalUser) {
131
- const currentUserId = finalUser.id;
132
- const currentAvatar = finalUser.avatar ?? '';
133
- const isNewUser = previousUserIdRef.current !== currentUserId;
134
- const isAvatarOnlyUpdate = !isNewUser && previousUserIdRef.current === currentUserId &&
135
- previousAvatarRef.current !== currentAvatar &&
136
- previousAvatarRef.current !== null;
137
- const shouldInitialize = !isInitializedRef.current || isNewUser;
138
-
139
- // Only reset all fields if it's a new user or first load
140
- // Skip reset if it's just an avatar update
141
- if (shouldInitialize && !isAvatarOnlyUpdate) {
142
- const userDisplayName = typeof finalUser.name === 'string'
143
- ? finalUser.name
144
- : finalUser.name?.first || finalUser.name?.full || '';
145
- const userLastName = typeof finalUser.name === 'object' ? finalUser.name?.last || '' : '';
146
- setDisplayName(userDisplayName);
147
- setLastName(userLastName);
148
- setUsername(finalUser.username || '');
149
- setEmail(finalUser.email || '');
150
- setBio(finalUser.bio || '');
151
- setLocation(finalUser.location || '');
152
-
153
- // Handle locations - convert single location to array format
154
- if (finalUser.locations && Array.isArray(finalUser.locations)) {
155
- setLocations(finalUser.locations.map((loc: any, index: number) => ({
156
- id: loc.id || `existing-${index}`,
157
- name: loc.name,
158
- label: loc.label,
159
- coordinates: loc.coordinates
160
- })));
161
- } else if (finalUser.location) {
162
- // Convert single location string to array format
163
- setLocations([{
164
- id: 'existing-0',
165
- name: finalUser.location,
166
- label: 'Location'
167
- }]);
168
- } else {
169
- setLocations([]);
170
- }
171
-
172
- // Handle links - simple and direct like other fields
173
- if (finalUser.linksMetadata && Array.isArray(finalUser.linksMetadata)) {
174
- const urls = finalUser.linksMetadata.map((l: any) => l.url);
175
- setLinks(urls);
176
- const metadataWithIds = finalUser.linksMetadata.map((link: any, index: number) => ({
177
- ...link,
178
- id: link.id || `existing-${index}`
179
- }));
180
- setLinksMetadata(metadataWithIds);
181
- } else if (Array.isArray(finalUser.links)) {
182
- const simpleLinks = finalUser.links.map((l: any) => typeof l === 'string' ? l : l.link).filter(Boolean);
183
- setLinks(simpleLinks);
184
- const linksWithMetadata = simpleLinks.map((url: string, index: number) => ({
185
- url,
186
- title: url.replace(/^https?:\/\//, '').replace(/\/$/, ''),
187
- description: `Link to ${url}`,
188
- image: undefined,
189
- id: `existing-${index}`
190
- }));
191
- setLinksMetadata(linksWithMetadata);
192
- } else if (finalUser.website) {
193
- setLinks([finalUser.website]);
194
- setLinksMetadata([{
195
- url: finalUser.website,
196
- title: finalUser.website.replace(/^https?:\/\//, '').replace(/\/$/, ''),
197
- description: `Link to ${finalUser.website}`,
198
- image: undefined,
199
- id: 'existing-0'
200
- }]);
201
- } else {
202
- setLinks([]);
203
- setLinksMetadata([]);
204
- }
205
- isInitializedRef.current = true;
206
- }
207
-
208
- // Update avatar only if it changed and we're not in optimistic/updating state
209
- // This allows the server response to update the avatar without resetting other fields
210
- // But don't override if we have a pending optimistic update
211
- if (currentAvatar !== avatarFileId && !isUpdatingAvatar && !optimisticAvatarId) {
212
- setAvatarFileId(currentAvatar);
213
- }
214
-
215
- // If we just finished updating and the server avatar matches our optimistic one, clear optimistic state
216
- // Also clear if the server avatar matches our current avatarFileId (update completed)
217
- if (isUpdatingAvatar === false && optimisticAvatarId) {
218
- if (currentAvatar === optimisticAvatarId || currentAvatar === avatarFileId) {
219
- setOptimisticAvatarId(null);
220
- }
221
- }
222
-
223
- previousUserIdRef.current = currentUserId;
224
- previousAvatarRef.current = currentAvatar;
225
- }
226
- }, [finalUser, avatarFileId, isUpdatingAvatar, optimisticAvatarId]);
227
-
228
- // Set initial editing field if provided via props (e.g., from navigation)
229
- // Handle initialSection prop to scroll to specific section
230
- const hasScrolledToSectionRef = useRef(false);
231
- const previousInitialSectionRef = useRef<string | undefined>(undefined);
232
- const SCROLL_OFFSET = 100; // Offset to show section near top of viewport
233
-
234
- // Map section names to their Y positions
235
- const sectionYPositions = useMemo(() => ({
236
- profilePicture: profilePictureSectionY,
237
- basicInfo: basicInfoSectionY,
238
- about: aboutSectionY,
239
- quickActions: quickActionsSectionY,
240
- security: securitySectionY,
241
- }), [profilePictureSectionY, basicInfoSectionY, aboutSectionY, quickActionsSectionY, securitySectionY]);
242
-
243
- useEffect(() => {
244
- // If initialSection changed, reset the flag
245
- if (previousInitialSectionRef.current !== initialSection) {
246
- hasScrolledToSectionRef.current = false;
247
- previousInitialSectionRef.current = initialSection;
248
- }
249
-
250
- // Scroll to the specified section if initialSection is provided and we haven't scrolled yet
251
- if (initialSection && !hasScrolledToSectionRef.current) {
252
- const sectionY = sectionYPositions[initialSection as keyof typeof sectionYPositions];
253
-
254
- if (sectionY !== null && sectionY !== undefined && scrollTo) {
255
- requestAnimationFrame(() => {
256
- requestAnimationFrame(() => {
257
- scrollTo(Math.max(0, sectionY - SCROLL_OFFSET), true);
258
- hasScrolledToSectionRef.current = true;
259
- });
260
- });
261
- }
262
- }
263
- }, [initialSection, sectionYPositions]);
264
-
265
- const handleAvatarRemoveConfirmed = useCallback(() => {
266
- setAvatarFileId('');
267
- toast.success(t('editProfile.toasts.avatarRemoved') || 'Avatar removed');
268
- }, [t]);
269
-
270
- const handleAvatarRemove = useCallback(() => {
271
- removeAvatarDialog.open();
272
- }, [removeAvatarDialog]);
273
-
274
- const { openAvatarPicker } = useOxy();
275
-
276
- // Handlers to navigate to edit screens
277
- const handleOpenDisplayNameModal = useCallback(() => navigateToEditField('displayName'), [navigateToEditField]);
278
- const handleOpenUsernameModal = useCallback(() => navigateToEditField('username'), [navigateToEditField]);
279
- const handleOpenEmailModal = useCallback(() => navigateToEditField('email'), [navigateToEditField]);
280
- const handleOpenBioModal = useCallback(() => navigateToEditField('bio'), [navigateToEditField]);
281
- const handleOpenLocationModal = useCallback(() => navigateToEditField('locations'), [navigateToEditField]);
282
- const handleOpenLinksModal = useCallback(() => navigateToEditField('links'), [navigateToEditField]);
283
-
284
- // Handle initialField prop - navigate to appropriate edit screen
285
- useEffect(() => {
286
- if (initialField) {
287
- // Special handling for avatar - open avatar picker directly
288
- if (initialField === 'avatar') {
289
- setTimeout(() => {
290
- openAvatarPicker();
291
- }, 300);
292
- } else {
293
- // Navigate to edit screen
294
- setTimeout(() => {
295
- const fieldTypeMap: Record<string, ProfileFieldType> = {
296
- displayName: 'displayName',
297
- username: 'username',
298
- email: 'email',
299
- bio: 'bio',
300
- location: 'locations',
301
- locations: 'locations',
302
- links: 'links',
303
- };
304
- const fieldType = fieldTypeMap[initialField];
305
- if (fieldType) {
306
- navigateToEditField(fieldType);
307
- }
308
- }, 300);
309
- }
310
- }
311
- }, [initialField, openAvatarPicker, navigateToEditField]);
312
-
313
-
314
-
315
-
316
- // Memoize display name for avatar
317
- const displayNameForAvatar = useMemo(() => getDisplayName(finalUser), [finalUser]);
318
-
319
-
320
-
321
-
322
- if (userLoading || !isAuthenticated) {
323
- return (
324
- <View style={[styles.container, { justifyContent: 'center', backgroundColor: bloomTheme.colors.background }]}>
325
- <ActivityIndicator size="large" color={bloomTheme.colors.primary} />
326
- </View>
327
- );
328
- }
329
-
330
- return (
331
- <View style={[styles.container, { backgroundColor: bloomTheme.colors.background }]}>
332
- <ScrollView
333
- ref={scrollViewRef}
334
- style={styles.content}
335
- contentContainerStyle={styles.scrollContent}
336
- showsVerticalScrollIndicator={false}
337
- >
338
- {/* Title and Subtitle Header */}
339
- <View style={[styles.headerContainer, styles.headerSection]}>
340
- <Text style={[styles.modernTitle, { marginBottom: 0, marginTop: 0 }]} className="text-foreground">
341
- {t('accountOverview.items.editProfile.title') || t('editProfile.title') || 'Edit Profile'}
342
- </Text>
343
- <Text style={[styles.modernSubtitle, { marginBottom: 0, marginTop: 0 }]} className="text-muted-foreground">
344
- {t('accountOverview.items.editProfile.subtitle') || t('editProfile.subtitle') || 'Manage your profile and preferences'}
345
- </Text>
346
- </View>
347
-
348
- {/* Profile Picture Section */}
349
- <View
350
- ref={(ref) => {
351
- avatarSectionRef.current = ref;
352
- profilePictureSectionRef.current = ref;
353
- }}
354
- style={styles.section}
355
- onLayout={(event) => {
356
- const { y } = event.nativeEvent.layout;
357
- setProfilePictureSectionY(y);
358
- }}
359
- >
360
- <Text style={styles.sectionTitle} className="text-muted-foreground">
361
- {t('editProfile.sections.profilePicture') || 'PROFILE PICTURE'}
362
- </Text>
363
- <View style={styles.groupedSectionWrapper}>
364
- <SettingsListGroup>
365
- <SettingsListItem
366
- icon={(optimisticAvatarId || avatarFileId) ? (
367
- isUpdatingAvatar ? (
368
- <Animated.View style={{ position: 'relative', width: 36, height: 36 }}>
369
- <Animated.Image
370
- source={{ uri: oxyServices.getFileDownloadUrl(optimisticAvatarId || avatarFileId, 'thumb') }}
371
- style={{
372
- width: 36,
373
- height: 36,
374
- borderRadius: 18,
375
- opacity: 0.6
376
- }}
377
- />
378
- <View style={{
379
- position: 'absolute',
380
- top: 0,
381
- left: 0,
382
- right: 0,
383
- bottom: 0,
384
- justifyContent: 'center',
385
- alignItems: 'center',
386
- backgroundColor: bloomTheme.colors.overlay,
387
- borderRadius: 18,
388
- }}>
389
- <ActivityIndicator size="small" color={colors.tint} />
390
- </View>
391
- </Animated.View>
392
- ) : (
393
- <Image
394
- source={{ uri: oxyServices.getFileDownloadUrl(optimisticAvatarId || avatarFileId, 'thumb') }}
395
- style={{ width: 36, height: 36, borderRadius: 18 }}
396
- />
397
- )
398
- ) : (
399
- <MaterialCommunityIcons name="account-outline" size={20} color={colors.sidebarIconPersonalInfo} />
400
- )}
401
- title="Profile Photo"
402
- description={isUpdatingAvatar
403
- ? 'Updating profile picture...'
404
- : (avatarFileId ? 'Tap to change your profile picture' : 'Tap to add a profile picture')}
405
- onPress={isUpdatingAvatar ? undefined : openAvatarPicker}
406
- disabled={isUpdatingAvatar}
407
- />
408
- {avatarFileId && !isUpdatingAvatar ? (
409
- <SettingsListItem
410
- icon={<MaterialCommunityIcons name="delete-outline" size={20} color={colors.sidebarIconSharing} />}
411
- title="Remove Photo"
412
- description="Delete current profile picture"
413
- onPress={handleAvatarRemove}
414
- />
415
- ) : null}
416
- </SettingsListGroup>
417
- </View>
418
- </View>
419
-
420
- {/* Basic Information */}
421
- <View
422
- ref={basicInfoSectionRef}
423
- style={styles.section}
424
- onLayout={(event) => {
425
- const { y } = event.nativeEvent.layout;
426
- setBasicInfoSectionY(y);
427
- }}
428
- >
429
- <Text style={styles.sectionTitle} className="text-muted-foreground">
430
- {t('editProfile.sections.basicInfo') || 'BASIC INFORMATION'}
431
- </Text>
432
- <View style={styles.groupedSectionWrapper}>
433
- <SettingsListGroup>
434
- <SettingsListItem
435
- icon={<MaterialCommunityIcons name="account-outline" size={20} color={colors.sidebarIconPersonalInfo} />}
436
- title={t('editProfile.items.displayName.title') || 'Display Name'}
437
- description={[displayName, lastName].filter(Boolean).join(' ') || (t('editProfile.items.displayName.add') || 'Add your display name')}
438
- onPress={handleOpenDisplayNameModal}
439
- />
440
- <SettingsListItem
441
- icon={<MaterialCommunityIcons name="at" size={20} color={colors.sidebarIconData} />}
442
- title={t('editProfile.items.username.title') || 'Username'}
443
- description={username || (t('editProfile.items.username.choose') || 'Choose a username')}
444
- onPress={handleOpenUsernameModal}
445
- />
446
- <SettingsListItem
447
- icon={<MaterialCommunityIcons name="email-outline" size={20} color={colors.sidebarIconSecurity} />}
448
- title={t('editProfile.items.email.title') || 'Email'}
449
- description={email || (t('editProfile.items.email.add') || 'Add your email address')}
450
- onPress={handleOpenEmailModal}
451
- />
452
- </SettingsListGroup>
453
- </View>
454
- </View>
455
-
456
- {/* About You */}
457
- <View
458
- ref={aboutSectionRef}
459
- style={styles.section}
460
- onLayout={(event) => {
461
- const { y } = event.nativeEvent.layout;
462
- setAboutSectionY(y);
463
- }}
464
- >
465
- <Text style={styles.sectionTitle} className="text-muted-foreground">
466
- {t('editProfile.sections.about') || 'ABOUT YOU'}
467
- </Text>
468
- <View style={styles.groupedSectionWrapper}>
469
- <SettingsListGroup>
470
- <SettingsListItem
471
- icon={<MaterialCommunityIcons name="text-box-outline" size={20} color={colors.sidebarIconPersonalInfo} />}
472
- title={t('editProfile.items.bio.title') || 'Bio'}
473
- description={bio || (t('editProfile.items.bio.placeholder') || 'Tell people about yourself')}
474
- onPress={handleOpenBioModal}
475
- />
476
- <SettingsListItem
477
- icon={<MaterialCommunityIcons name="map-marker-outline" size={20} color={colors.sidebarIconSharing} />}
478
- title={t('editProfile.items.locations.title') || 'Locations'}
479
- description={locations.length > 0
480
- ? (locations.length === 1
481
- ? (t('editProfile.items.locations.count', { count: locations.length }) || `${locations.length} location added`)
482
- : (t('editProfile.items.locations.count_plural', { count: locations.length }) || `${locations.length} locations added`))
483
- : (t('editProfile.items.locations.add') || 'Add your locations')}
484
- onPress={handleOpenLocationModal}
485
- />
486
- <SettingsListItem
487
- icon={<MaterialCommunityIcons name="link-variant" size={20} color={colors.sidebarIconSharing} />}
488
- title={t('editProfile.items.links.title') || 'Links'}
489
- description={linksMetadata.length > 0
490
- ? (linksMetadata.length === 1
491
- ? (t('editProfile.items.links.count', { count: linksMetadata.length }) || `${linksMetadata.length} link added`)
492
- : (t('editProfile.items.links.count_plural', { count: linksMetadata.length }) || `${linksMetadata.length} links added`))
493
- : (t('editProfile.items.links.add') || 'Add your links')}
494
- onPress={handleOpenLinksModal}
495
- />
496
- </SettingsListGroup>
497
- </View>
498
- </View>
499
-
500
- {/* Quick Actions */}
501
- <View
502
- ref={quickActionsSectionRef}
503
- style={styles.section}
504
- onLayout={(event) => {
505
- const { y } = event.nativeEvent.layout;
506
- setQuickActionsSectionY(y);
507
- }}
508
- >
509
- <Text style={styles.sectionTitle} className="text-muted-foreground">
510
- {t('editProfile.sections.quickActions') || 'QUICK ACTIONS'}
511
- </Text>
512
- <View style={styles.groupedSectionWrapper}>
513
- <SettingsListGroup>
514
- <SettingsListItem
515
- icon={<MaterialCommunityIcons name="eye" size={20} color={colors.sidebarIconHome} />}
516
- title={t('editProfile.items.previewProfile.title') || 'Preview Profile'}
517
- description={t('editProfile.items.previewProfile.subtitle') || 'See how your profile looks to others'}
518
- onPress={() => navigate?.('Profile', { userId: finalUser?.id })}
519
- />
520
- <SettingsListItem
521
- icon={<MaterialCommunityIcons name="shield-check" size={20} color={colors.sidebarIconSecurity} />}
522
- title={t('editProfile.items.privacySettings.title') || 'Privacy Settings'}
523
- description={t('editProfile.items.privacySettings.subtitle') || 'Control who can see your profile'}
524
- onPress={() => navigate?.('PrivacySettings')}
525
- />
526
- <SettingsListItem
527
- icon={<MaterialCommunityIcons name="check-circle" size={20} color={colors.sidebarIconPersonalInfo} />}
528
- title={t('editProfile.items.verifyAccount.title') || 'Verify Account'}
529
- description={t('editProfile.items.verifyAccount.subtitle') || 'Get a verified badge'}
530
- onPress={() => navigate?.('AccountVerification')}
531
- />
532
- </SettingsListGroup>
533
- </View>
534
- </View>
535
-
536
- {/* Security */}
537
- <View
538
- ref={securitySectionRef}
539
- style={styles.section}
540
- onLayout={(event) => {
541
- const { y } = event.nativeEvent.layout;
542
- setSecuritySectionY(y);
543
- }}
544
- >
545
- <Text style={styles.sectionTitle} className="text-muted-foreground">
546
- {t('editProfile.sections.security') || 'SECURITY'}
547
- </Text>
548
- <View style={styles.groupedSectionWrapper}>
549
- </View>
550
- </View>
551
- </ScrollView>
552
- <Dialog
553
- control={removeAvatarDialog}
554
- title={t('editProfile.confirms.removeAvatarTitle') || 'Remove Avatar'}
555
- description={t('editProfile.confirms.removeAvatar') || 'Remove your profile picture?'}
556
- actions={[
557
- {
558
- label: t('common.remove') || 'Remove',
559
- color: 'destructive',
560
- onPress: handleAvatarRemoveConfirmed,
561
- },
562
- { label: t('common.cancel') || 'Cancel', color: 'cancel' },
563
- ]}
564
- />
565
- </View>
566
- );
567
- };
568
-
569
- const styles = StyleSheet.create({
570
- container: {
571
- flexShrink: 1,
572
- width: '100%',
573
- },
574
- content: {
575
- flexShrink: 1,
576
- },
577
- scrollContent: createScreenContentStyle(HEADER_PADDING_TOP_SETTINGS),
578
- headerContainer: {
579
- width: '100%',
580
- maxWidth: 420,
581
- alignSelf: 'center',
582
- marginBottom: SECTION_GAP_LARGE,
583
- },
584
- headerSection: {
585
- alignItems: 'flex-start',
586
- width: '100%',
587
- gap: COMPONENT_GAP,
588
- },
589
- modernTitle: {
590
- fontWeight: Platform.OS === 'web' ? 'bold' : undefined,
591
- fontSize: 42,
592
- lineHeight: 50.4, // 42 * 1.2
593
- textAlign: 'left',
594
- letterSpacing: -0.5,
595
- },
596
- modernSubtitle: {
597
- fontSize: 18,
598
- lineHeight: 24,
599
- textAlign: 'left',
600
- maxWidth: 320,
601
- alignSelf: 'flex-start',
602
- opacity: 0.8,
603
- },
604
- section: {
605
- marginBottom: SECTION_GAP_LARGE,
606
- },
607
- sectionTitle: {
608
- fontSize: 13,
609
- fontWeight: '600',
610
- marginBottom: 8,
611
- marginTop: 4,
612
- textTransform: 'uppercase',
613
- letterSpacing: 0.5,
614
- },
615
- groupedSectionWrapper: {
616
- backgroundColor: 'transparent',
617
- },
618
- });
619
-
620
- export default React.memo(AccountSettingsScreen);