@oxyhq/services 5.21.6 → 5.22.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 (478) hide show
  1. package/README.md +201 -2
  2. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
  3. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
  4. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
  5. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
  6. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
  7. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
  8. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
  9. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
  10. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
  11. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
  12. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
  13. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
  14. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
  15. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
  16. package/lib/commonjs/core/HttpService.js +87 -2
  17. package/lib/commonjs/core/HttpService.js.map +1 -1
  18. package/lib/commonjs/core/mixins/OxyServices.assets.js +3 -1
  19. package/lib/commonjs/core/mixins/OxyServices.assets.js.map +1 -1
  20. package/lib/commonjs/crypto/keyManager.js +67 -22
  21. package/lib/commonjs/crypto/keyManager.js.map +1 -1
  22. package/lib/commonjs/i18n/locales/en-US.json +3 -3
  23. package/lib/commonjs/i18n/locales/es-ES.json +240 -19
  24. package/lib/commonjs/index.js +66 -0
  25. package/lib/commonjs/index.js.map +1 -1
  26. package/lib/commonjs/ui/components/Avatar.js +1 -1
  27. package/lib/commonjs/ui/components/Avatar.js.map +1 -1
  28. package/lib/commonjs/ui/components/FollowButton.js +1 -1
  29. package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
  30. package/lib/commonjs/ui/components/FontLoader.js +34 -34
  31. package/lib/commonjs/ui/components/FontLoader.js.map +1 -1
  32. package/lib/commonjs/ui/components/Header.js +4 -4
  33. package/lib/commonjs/ui/components/Header.js.map +1 -1
  34. package/lib/commonjs/ui/components/OxyPayButton.js +1 -1
  35. package/lib/commonjs/ui/components/OxyPayButton.js.map +1 -1
  36. package/lib/commonjs/ui/components/OxySignInButton.js +2 -1
  37. package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
  38. package/lib/commonjs/ui/components/ProfileCard.js +1 -1
  39. package/lib/commonjs/ui/components/ProfileCard.js.map +1 -1
  40. package/lib/commonjs/ui/components/SectionTitle.js +1 -1
  41. package/lib/commonjs/ui/components/SectionTitle.js.map +1 -1
  42. package/lib/commonjs/ui/components/StepBasedScreen.js +2 -1
  43. package/lib/commonjs/ui/components/StepBasedScreen.js.map +1 -1
  44. package/lib/commonjs/ui/components/feedback/feedbackStyles.js +2 -1
  45. package/lib/commonjs/ui/components/feedback/feedbackStyles.js.map +1 -1
  46. package/lib/commonjs/ui/components/fileManagement/AnimatedButton.js +57 -0
  47. package/lib/commonjs/ui/components/fileManagement/AnimatedButton.js.map +1 -0
  48. package/lib/commonjs/ui/components/fileManagement/styles.js +17 -17
  49. package/lib/commonjs/ui/components/fileManagement/styles.js.map +1 -1
  50. package/lib/commonjs/ui/components/payment/paymentStyles.js +7 -7
  51. package/lib/commonjs/ui/components/payment/paymentStyles.js.map +1 -1
  52. package/lib/commonjs/ui/hooks/mutations/mutationFactory.js +177 -0
  53. package/lib/commonjs/ui/hooks/mutations/mutationFactory.js.map +1 -0
  54. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +10 -123
  55. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  56. package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +2 -32
  57. package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
  58. package/lib/commonjs/ui/hooks/queries/useServicesQueries.js +2 -31
  59. package/lib/commonjs/ui/hooks/queries/useServicesQueries.js.map +1 -1
  60. package/lib/commonjs/ui/hooks/useFileFiltering.js +76 -0
  61. package/lib/commonjs/ui/hooks/useFileFiltering.js.map +1 -0
  62. package/lib/commonjs/ui/navigation/routes.js +2 -0
  63. package/lib/commonjs/ui/navigation/routes.js.map +1 -1
  64. package/lib/commonjs/ui/screens/AccountCenterScreen.js +4 -2
  65. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
  66. package/lib/commonjs/ui/screens/AccountOverviewScreen.js +13 -5
  67. package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
  68. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +273 -1820
  69. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  70. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +1 -1
  71. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
  72. package/lib/commonjs/ui/screens/AccountVerificationScreen.js +3 -1
  73. package/lib/commonjs/ui/screens/AccountVerificationScreen.js.map +1 -1
  74. package/lib/commonjs/ui/screens/AppInfoScreen.js +2 -2
  75. package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
  76. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +640 -0
  77. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -0
  78. package/lib/commonjs/ui/screens/FileManagementScreen.js +41 -23
  79. package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
  80. package/lib/commonjs/ui/screens/HistoryViewScreen.js +9 -3
  81. package/lib/commonjs/ui/screens/HistoryViewScreen.js.map +1 -1
  82. package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +4 -2
  83. package/lib/commonjs/ui/screens/LanguageSelectorScreen.js.map +1 -1
  84. package/lib/commonjs/ui/screens/LegalDocumentsScreen.js +3 -1
  85. package/lib/commonjs/ui/screens/LegalDocumentsScreen.js.map +1 -1
  86. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +11 -12
  87. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  88. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +12 -4
  89. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
  90. package/lib/commonjs/ui/screens/SearchSettingsScreen.js +3 -1
  91. package/lib/commonjs/ui/screens/SearchSettingsScreen.js.map +1 -1
  92. package/lib/commonjs/ui/screens/SessionManagementScreen.js +15 -5
  93. package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
  94. package/lib/commonjs/ui/screens/UserLinksScreen.js +3 -1
  95. package/lib/commonjs/ui/screens/UserLinksScreen.js.map +1 -1
  96. package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js +2 -1
  97. package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js.map +1 -1
  98. package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js +2 -4
  99. package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js.map +1 -1
  100. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +3 -3
  101. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
  102. package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js +3 -3
  103. package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
  104. package/lib/commonjs/ui/styles/authStyles.js +5 -4
  105. package/lib/commonjs/ui/styles/authStyles.js.map +1 -1
  106. package/lib/commonjs/ui/styles/fonts.js +27 -27
  107. package/lib/commonjs/ui/styles/fonts.js.map +1 -1
  108. package/lib/commonjs/ui/styles/theme.js +3 -3
  109. package/lib/commonjs/ui/styles/theme.js.map +1 -1
  110. package/lib/commonjs/ui/utils/authHelpers.js +164 -0
  111. package/lib/commonjs/ui/utils/authHelpers.js.map +1 -0
  112. package/lib/commonjs/ui/utils/avatarUtils.js +18 -61
  113. package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
  114. package/lib/commonjs/web.js +682 -0
  115. package/lib/commonjs/web.js.map +1 -0
  116. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
  117. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
  118. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
  119. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
  120. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
  121. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
  122. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
  123. package/lib/module/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
  124. package/lib/module/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
  125. package/lib/module/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
  126. package/lib/module/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
  127. package/lib/module/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
  128. package/lib/module/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
  129. package/lib/module/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
  130. package/lib/module/core/HttpService.js +87 -2
  131. package/lib/module/core/HttpService.js.map +1 -1
  132. package/lib/module/core/mixins/OxyServices.assets.js +3 -1
  133. package/lib/module/core/mixins/OxyServices.assets.js.map +1 -1
  134. package/lib/module/crypto/keyManager.js +67 -22
  135. package/lib/module/crypto/keyManager.js.map +1 -1
  136. package/lib/module/i18n/locales/en-US.json +3 -3
  137. package/lib/module/i18n/locales/es-ES.json +240 -19
  138. package/lib/module/index.js +6 -0
  139. package/lib/module/index.js.map +1 -1
  140. package/lib/module/ui/components/Avatar.js +1 -1
  141. package/lib/module/ui/components/Avatar.js.map +1 -1
  142. package/lib/module/ui/components/FollowButton.js +1 -1
  143. package/lib/module/ui/components/FollowButton.js.map +1 -1
  144. package/lib/module/ui/components/FontLoader.js +34 -34
  145. package/lib/module/ui/components/FontLoader.js.map +1 -1
  146. package/lib/module/ui/components/Header.js +4 -4
  147. package/lib/module/ui/components/Header.js.map +1 -1
  148. package/lib/module/ui/components/OxyPayButton.js +1 -1
  149. package/lib/module/ui/components/OxyPayButton.js.map +1 -1
  150. package/lib/module/ui/components/OxySignInButton.js +2 -1
  151. package/lib/module/ui/components/OxySignInButton.js.map +1 -1
  152. package/lib/module/ui/components/ProfileCard.js +1 -1
  153. package/lib/module/ui/components/ProfileCard.js.map +1 -1
  154. package/lib/module/ui/components/SectionTitle.js +1 -1
  155. package/lib/module/ui/components/SectionTitle.js.map +1 -1
  156. package/lib/module/ui/components/StepBasedScreen.js +2 -1
  157. package/lib/module/ui/components/StepBasedScreen.js.map +1 -1
  158. package/lib/module/ui/components/feedback/feedbackStyles.js +2 -1
  159. package/lib/module/ui/components/feedback/feedbackStyles.js.map +1 -1
  160. package/lib/module/ui/components/fileManagement/AnimatedButton.js +50 -0
  161. package/lib/module/ui/components/fileManagement/AnimatedButton.js.map +1 -0
  162. package/lib/module/ui/components/fileManagement/styles.js +17 -17
  163. package/lib/module/ui/components/fileManagement/styles.js.map +1 -1
  164. package/lib/module/ui/components/payment/paymentStyles.js +7 -7
  165. package/lib/module/ui/components/payment/paymentStyles.js.map +1 -1
  166. package/lib/module/ui/hooks/mutations/mutationFactory.js +173 -0
  167. package/lib/module/ui/hooks/mutations/mutationFactory.js.map +1 -0
  168. package/lib/module/ui/hooks/mutations/useAccountMutations.js +10 -122
  169. package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  170. package/lib/module/ui/hooks/queries/useAccountQueries.js +2 -32
  171. package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
  172. package/lib/module/ui/hooks/queries/useServicesQueries.js +2 -31
  173. package/lib/module/ui/hooks/queries/useServicesQueries.js.map +1 -1
  174. package/lib/module/ui/hooks/useFileFiltering.js +72 -0
  175. package/lib/module/ui/hooks/useFileFiltering.js.map +1 -0
  176. package/lib/module/ui/navigation/routes.js +2 -0
  177. package/lib/module/ui/navigation/routes.js.map +1 -1
  178. package/lib/module/ui/screens/AccountCenterScreen.js +4 -2
  179. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
  180. package/lib/module/ui/screens/AccountOverviewScreen.js +13 -5
  181. package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
  182. package/lib/module/ui/screens/AccountSettingsScreen.js +277 -1824
  183. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  184. package/lib/module/ui/screens/AccountSwitcherScreen.js +1 -1
  185. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  186. package/lib/module/ui/screens/AccountVerificationScreen.js +3 -1
  187. package/lib/module/ui/screens/AccountVerificationScreen.js.map +1 -1
  188. package/lib/module/ui/screens/AppInfoScreen.js +2 -2
  189. package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
  190. package/lib/module/ui/screens/EditProfileFieldScreen.js +635 -0
  191. package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -0
  192. package/lib/module/ui/screens/FileManagementScreen.js +41 -23
  193. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  194. package/lib/module/ui/screens/HistoryViewScreen.js +9 -3
  195. package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
  196. package/lib/module/ui/screens/LanguageSelectorScreen.js +4 -2
  197. package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -1
  198. package/lib/module/ui/screens/LegalDocumentsScreen.js +3 -1
  199. package/lib/module/ui/screens/LegalDocumentsScreen.js.map +1 -1
  200. package/lib/module/ui/screens/PremiumSubscriptionScreen.js +11 -12
  201. package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  202. package/lib/module/ui/screens/PrivacySettingsScreen.js +12 -4
  203. package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
  204. package/lib/module/ui/screens/SearchSettingsScreen.js +3 -1
  205. package/lib/module/ui/screens/SearchSettingsScreen.js.map +1 -1
  206. package/lib/module/ui/screens/SessionManagementScreen.js +15 -5
  207. package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
  208. package/lib/module/ui/screens/UserLinksScreen.js +3 -1
  209. package/lib/module/ui/screens/UserLinksScreen.js.map +1 -1
  210. package/lib/module/ui/screens/WelcomeNewUserScreen.js +2 -1
  211. package/lib/module/ui/screens/WelcomeNewUserScreen.js.map +1 -1
  212. package/lib/module/ui/screens/karma/KarmaAboutScreen.js +2 -4
  213. package/lib/module/ui/screens/karma/KarmaAboutScreen.js.map +1 -1
  214. package/lib/module/ui/screens/karma/KarmaCenterScreen.js +3 -3
  215. package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
  216. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js +3 -3
  217. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
  218. package/lib/module/ui/styles/authStyles.js +5 -4
  219. package/lib/module/ui/styles/authStyles.js.map +1 -1
  220. package/lib/module/ui/styles/fonts.js +27 -27
  221. package/lib/module/ui/styles/fonts.js.map +1 -1
  222. package/lib/module/ui/styles/theme.js +3 -3
  223. package/lib/module/ui/styles/theme.js.map +1 -1
  224. package/lib/module/ui/utils/authHelpers.js +154 -0
  225. package/lib/module/ui/utils/authHelpers.js.map +1 -0
  226. package/lib/module/ui/utils/avatarUtils.js +18 -61
  227. package/lib/module/ui/utils/avatarUtils.js.map +1 -1
  228. package/lib/module/web.js +75 -0
  229. package/lib/module/web.js.map +1 -0
  230. package/lib/typescript/commonjs/core/HttpService.d.ts +5 -0
  231. package/lib/typescript/commonjs/core/HttpService.d.ts.map +1 -1
  232. package/lib/typescript/commonjs/crypto/keyManager.d.ts.map +1 -1
  233. package/lib/typescript/commonjs/index.d.ts +6 -0
  234. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  235. package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts.map +1 -1
  236. package/lib/typescript/commonjs/ui/components/StepBasedScreen.d.ts.map +1 -1
  237. package/lib/typescript/commonjs/ui/components/feedback/feedbackStyles.d.ts.map +1 -1
  238. package/lib/typescript/commonjs/ui/components/fileManagement/AnimatedButton.d.ts +16 -0
  239. package/lib/typescript/commonjs/ui/components/fileManagement/AnimatedButton.d.ts.map +1 -0
  240. package/lib/typescript/commonjs/ui/hooks/mutations/mutationFactory.d.ts +76 -0
  241. package/lib/typescript/commonjs/ui/hooks/mutations/mutationFactory.d.ts.map +1 -0
  242. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +29 -4
  243. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  244. package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts +1 -1
  245. package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
  246. package/lib/typescript/commonjs/ui/hooks/queries/useServicesQueries.d.ts +1 -1
  247. package/lib/typescript/commonjs/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
  248. package/lib/typescript/commonjs/ui/hooks/useFileFiltering.d.ts +29 -0
  249. package/lib/typescript/commonjs/ui/hooks/useFileFiltering.d.ts.map +1 -0
  250. package/lib/typescript/commonjs/ui/navigation/routes.d.ts +1 -1
  251. package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
  252. package/lib/typescript/commonjs/ui/screens/AccountCenterScreen.d.ts.map +1 -1
  253. package/lib/typescript/commonjs/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
  254. package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  255. package/lib/typescript/commonjs/ui/screens/AccountVerificationScreen.d.ts.map +1 -1
  256. package/lib/typescript/commonjs/ui/screens/EditProfileFieldScreen.d.ts +13 -0
  257. package/lib/typescript/commonjs/ui/screens/EditProfileFieldScreen.d.ts.map +1 -0
  258. package/lib/typescript/commonjs/ui/screens/FileManagementScreen.d.ts.map +1 -1
  259. package/lib/typescript/commonjs/ui/screens/HistoryViewScreen.d.ts.map +1 -1
  260. package/lib/typescript/commonjs/ui/screens/LanguageSelectorScreen.d.ts.map +1 -1
  261. package/lib/typescript/commonjs/ui/screens/LegalDocumentsScreen.d.ts.map +1 -1
  262. package/lib/typescript/commonjs/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
  263. package/lib/typescript/commonjs/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
  264. package/lib/typescript/commonjs/ui/screens/SearchSettingsScreen.d.ts.map +1 -1
  265. package/lib/typescript/commonjs/ui/screens/SessionManagementScreen.d.ts.map +1 -1
  266. package/lib/typescript/commonjs/ui/screens/UserLinksScreen.d.ts.map +1 -1
  267. package/lib/typescript/commonjs/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -1
  268. package/lib/typescript/commonjs/ui/screens/karma/KarmaAboutScreen.d.ts.map +1 -1
  269. package/lib/typescript/commonjs/ui/styles/fonts.d.ts +7 -7
  270. package/lib/typescript/commonjs/ui/styles/theme.d.ts.map +1 -1
  271. package/lib/typescript/commonjs/ui/utils/authHelpers.d.ts +99 -0
  272. package/lib/typescript/commonjs/ui/utils/authHelpers.d.ts.map +1 -0
  273. package/lib/typescript/commonjs/ui/utils/avatarUtils.d.ts.map +1 -1
  274. package/lib/typescript/commonjs/web.d.ts +54 -0
  275. package/lib/typescript/commonjs/web.d.ts.map +1 -0
  276. package/lib/typescript/module/core/HttpService.d.ts +5 -0
  277. package/lib/typescript/module/core/HttpService.d.ts.map +1 -1
  278. package/lib/typescript/module/crypto/keyManager.d.ts.map +1 -1
  279. package/lib/typescript/module/index.d.ts +6 -0
  280. package/lib/typescript/module/index.d.ts.map +1 -1
  281. package/lib/typescript/module/ui/components/OxySignInButton.d.ts.map +1 -1
  282. package/lib/typescript/module/ui/components/StepBasedScreen.d.ts.map +1 -1
  283. package/lib/typescript/module/ui/components/feedback/feedbackStyles.d.ts.map +1 -1
  284. package/lib/typescript/module/ui/components/fileManagement/AnimatedButton.d.ts +16 -0
  285. package/lib/typescript/module/ui/components/fileManagement/AnimatedButton.d.ts.map +1 -0
  286. package/lib/typescript/module/ui/hooks/mutations/mutationFactory.d.ts +76 -0
  287. package/lib/typescript/module/ui/hooks/mutations/mutationFactory.d.ts.map +1 -0
  288. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +29 -4
  289. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  290. package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts +1 -1
  291. package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
  292. package/lib/typescript/module/ui/hooks/queries/useServicesQueries.d.ts +1 -1
  293. package/lib/typescript/module/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
  294. package/lib/typescript/module/ui/hooks/useFileFiltering.d.ts +29 -0
  295. package/lib/typescript/module/ui/hooks/useFileFiltering.d.ts.map +1 -0
  296. package/lib/typescript/module/ui/navigation/routes.d.ts +1 -1
  297. package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
  298. package/lib/typescript/module/ui/screens/AccountCenterScreen.d.ts.map +1 -1
  299. package/lib/typescript/module/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
  300. package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  301. package/lib/typescript/module/ui/screens/AccountVerificationScreen.d.ts.map +1 -1
  302. package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts +13 -0
  303. package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts.map +1 -0
  304. package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts.map +1 -1
  305. package/lib/typescript/module/ui/screens/HistoryViewScreen.d.ts.map +1 -1
  306. package/lib/typescript/module/ui/screens/LanguageSelectorScreen.d.ts.map +1 -1
  307. package/lib/typescript/module/ui/screens/LegalDocumentsScreen.d.ts.map +1 -1
  308. package/lib/typescript/module/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
  309. package/lib/typescript/module/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
  310. package/lib/typescript/module/ui/screens/SearchSettingsScreen.d.ts.map +1 -1
  311. package/lib/typescript/module/ui/screens/SessionManagementScreen.d.ts.map +1 -1
  312. package/lib/typescript/module/ui/screens/UserLinksScreen.d.ts.map +1 -1
  313. package/lib/typescript/module/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -1
  314. package/lib/typescript/module/ui/screens/karma/KarmaAboutScreen.d.ts.map +1 -1
  315. package/lib/typescript/module/ui/styles/fonts.d.ts +7 -7
  316. package/lib/typescript/module/ui/styles/theme.d.ts.map +1 -1
  317. package/lib/typescript/module/ui/utils/authHelpers.d.ts +99 -0
  318. package/lib/typescript/module/ui/utils/authHelpers.d.ts.map +1 -0
  319. package/lib/typescript/module/ui/utils/avatarUtils.d.ts.map +1 -1
  320. package/lib/typescript/module/web.d.ts +54 -0
  321. package/lib/typescript/module/web.d.ts.map +1 -0
  322. package/package.json +27 -41
  323. package/src/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
  324. package/src/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
  325. package/src/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
  326. package/src/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
  327. package/src/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
  328. package/src/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
  329. package/src/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
  330. package/src/core/HttpService.ts +91 -0
  331. package/src/core/mixins/OxyServices.assets.ts +1 -1
  332. package/src/crypto/keyManager.ts +23 -22
  333. package/src/i18n/locales/en-US.json +3 -3
  334. package/src/i18n/locales/es-ES.json +240 -19
  335. package/src/index.ts +25 -0
  336. package/src/ui/components/Avatar.tsx +1 -1
  337. package/src/ui/components/FollowButton.tsx +1 -1
  338. package/src/ui/components/FontLoader.tsx +34 -34
  339. package/src/ui/components/Header.tsx +4 -4
  340. package/src/ui/components/OxyPayButton.tsx +1 -1
  341. package/src/ui/components/OxySignInButton.tsx +2 -1
  342. package/src/ui/components/ProfileCard.tsx +1 -1
  343. package/src/ui/components/SectionTitle.tsx +1 -1
  344. package/src/ui/components/StepBasedScreen.tsx +2 -1
  345. package/src/ui/components/feedback/feedbackStyles.ts +2 -1
  346. package/src/ui/components/fileManagement/AnimatedButton.tsx +56 -0
  347. package/src/ui/components/fileManagement/styles.ts +17 -17
  348. package/src/ui/components/payment/paymentStyles.ts +7 -7
  349. package/src/ui/hooks/mutations/mutationFactory.ts +215 -0
  350. package/src/ui/hooks/mutations/useAccountMutations.ts +48 -136
  351. package/src/ui/hooks/queries/useAccountQueries.ts +6 -33
  352. package/src/ui/hooks/queries/useServicesQueries.ts +6 -32
  353. package/src/ui/hooks/useFileFiltering.ts +115 -0
  354. package/src/ui/navigation/routes.ts +3 -0
  355. package/src/ui/screens/AccountCenterScreen.tsx +4 -2
  356. package/src/ui/screens/AccountOverviewScreen.tsx +13 -5
  357. package/src/ui/screens/AccountSettingsScreen.tsx +35 -1511
  358. package/src/ui/screens/AccountSwitcherScreen.tsx +1 -1
  359. package/src/ui/screens/AccountVerificationScreen.tsx +3 -1
  360. package/src/ui/screens/AppInfoScreen.tsx +2 -2
  361. package/src/ui/screens/EditProfileFieldScreen.tsx +685 -0
  362. package/src/ui/screens/FileManagementScreen.tsx +35 -17
  363. package/src/ui/screens/HistoryViewScreen.tsx +9 -3
  364. package/src/ui/screens/LanguageSelectorScreen.tsx +4 -2
  365. package/src/ui/screens/LegalDocumentsScreen.tsx +3 -1
  366. package/src/ui/screens/PremiumSubscriptionScreen.tsx +11 -13
  367. package/src/ui/screens/PrivacySettingsScreen.tsx +12 -4
  368. package/src/ui/screens/SearchSettingsScreen.tsx +3 -1
  369. package/src/ui/screens/SessionManagementScreen.tsx +15 -5
  370. package/src/ui/screens/UserLinksScreen.tsx +3 -1
  371. package/src/ui/screens/WelcomeNewUserScreen.tsx +2 -1
  372. package/src/ui/screens/karma/KarmaAboutScreen.tsx +6 -8
  373. package/src/ui/screens/karma/KarmaCenterScreen.tsx +3 -3
  374. package/src/ui/screens/karma/KarmaRewardsScreen.tsx +3 -3
  375. package/src/ui/styles/authStyles.ts +4 -4
  376. package/src/ui/styles/fonts.ts +26 -26
  377. package/src/ui/styles/theme.ts +3 -5
  378. package/src/ui/utils/authHelpers.ts +183 -0
  379. package/src/ui/utils/avatarUtils.ts +25 -65
  380. package/src/web.ts +230 -0
  381. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  382. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  383. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  384. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  385. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  386. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  387. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  388. package/lib/commonjs/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  389. package/lib/commonjs/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  390. package/lib/commonjs/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  391. package/lib/commonjs/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  392. package/lib/commonjs/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  393. package/lib/commonjs/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  394. package/lib/commonjs/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  395. package/lib/commonjs/ui/components/profile/EditBioModal.js +0 -181
  396. package/lib/commonjs/ui/components/profile/EditBioModal.js.map +0 -1
  397. package/lib/commonjs/ui/components/profile/EditDisplayNameModal.js +0 -204
  398. package/lib/commonjs/ui/components/profile/EditDisplayNameModal.js.map +0 -1
  399. package/lib/commonjs/ui/components/profile/EditEmailModal.js +0 -184
  400. package/lib/commonjs/ui/components/profile/EditEmailModal.js.map +0 -1
  401. package/lib/commonjs/ui/components/profile/EditFieldModal.js +0 -412
  402. package/lib/commonjs/ui/components/profile/EditFieldModal.js.map +0 -1
  403. package/lib/commonjs/ui/components/profile/EditLinksModal.js +0 -315
  404. package/lib/commonjs/ui/components/profile/EditLinksModal.js.map +0 -1
  405. package/lib/commonjs/ui/components/profile/EditLocationModal.js +0 -273
  406. package/lib/commonjs/ui/components/profile/EditLocationModal.js.map +0 -1
  407. package/lib/commonjs/ui/components/profile/EditUsernameModal.js +0 -180
  408. package/lib/commonjs/ui/components/profile/EditUsernameModal.js.map +0 -1
  409. package/lib/module/assets/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  410. package/lib/module/assets/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  411. package/lib/module/assets/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  412. package/lib/module/assets/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  413. package/lib/module/assets/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  414. package/lib/module/assets/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  415. package/lib/module/assets/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  416. package/lib/module/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  417. package/lib/module/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  418. package/lib/module/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  419. package/lib/module/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  420. package/lib/module/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  421. package/lib/module/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  422. package/lib/module/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  423. package/lib/module/ui/components/profile/EditBioModal.js +0 -175
  424. package/lib/module/ui/components/profile/EditBioModal.js.map +0 -1
  425. package/lib/module/ui/components/profile/EditDisplayNameModal.js +0 -198
  426. package/lib/module/ui/components/profile/EditDisplayNameModal.js.map +0 -1
  427. package/lib/module/ui/components/profile/EditEmailModal.js +0 -178
  428. package/lib/module/ui/components/profile/EditEmailModal.js.map +0 -1
  429. package/lib/module/ui/components/profile/EditFieldModal.js +0 -406
  430. package/lib/module/ui/components/profile/EditFieldModal.js.map +0 -1
  431. package/lib/module/ui/components/profile/EditLinksModal.js +0 -309
  432. package/lib/module/ui/components/profile/EditLinksModal.js.map +0 -1
  433. package/lib/module/ui/components/profile/EditLocationModal.js +0 -267
  434. package/lib/module/ui/components/profile/EditLocationModal.js.map +0 -1
  435. package/lib/module/ui/components/profile/EditUsernameModal.js +0 -174
  436. package/lib/module/ui/components/profile/EditUsernameModal.js.map +0 -1
  437. package/lib/typescript/commonjs/ui/components/profile/EditBioModal.d.ts +0 -11
  438. package/lib/typescript/commonjs/ui/components/profile/EditBioModal.d.ts.map +0 -1
  439. package/lib/typescript/commonjs/ui/components/profile/EditDisplayNameModal.d.ts +0 -12
  440. package/lib/typescript/commonjs/ui/components/profile/EditDisplayNameModal.d.ts.map +0 -1
  441. package/lib/typescript/commonjs/ui/components/profile/EditEmailModal.d.ts +0 -11
  442. package/lib/typescript/commonjs/ui/components/profile/EditEmailModal.d.ts.map +0 -1
  443. package/lib/typescript/commonjs/ui/components/profile/EditFieldModal.d.ts +0 -110
  444. package/lib/typescript/commonjs/ui/components/profile/EditFieldModal.d.ts.map +0 -1
  445. package/lib/typescript/commonjs/ui/components/profile/EditLinksModal.d.ts +0 -18
  446. package/lib/typescript/commonjs/ui/components/profile/EditLinksModal.d.ts.map +0 -1
  447. package/lib/typescript/commonjs/ui/components/profile/EditLocationModal.d.ts +0 -20
  448. package/lib/typescript/commonjs/ui/components/profile/EditLocationModal.d.ts.map +0 -1
  449. package/lib/typescript/commonjs/ui/components/profile/EditUsernameModal.d.ts +0 -11
  450. package/lib/typescript/commonjs/ui/components/profile/EditUsernameModal.d.ts.map +0 -1
  451. package/lib/typescript/module/ui/components/profile/EditBioModal.d.ts +0 -11
  452. package/lib/typescript/module/ui/components/profile/EditBioModal.d.ts.map +0 -1
  453. package/lib/typescript/module/ui/components/profile/EditDisplayNameModal.d.ts +0 -12
  454. package/lib/typescript/module/ui/components/profile/EditDisplayNameModal.d.ts.map +0 -1
  455. package/lib/typescript/module/ui/components/profile/EditEmailModal.d.ts +0 -11
  456. package/lib/typescript/module/ui/components/profile/EditEmailModal.d.ts.map +0 -1
  457. package/lib/typescript/module/ui/components/profile/EditFieldModal.d.ts +0 -110
  458. package/lib/typescript/module/ui/components/profile/EditFieldModal.d.ts.map +0 -1
  459. package/lib/typescript/module/ui/components/profile/EditLinksModal.d.ts +0 -18
  460. package/lib/typescript/module/ui/components/profile/EditLinksModal.d.ts.map +0 -1
  461. package/lib/typescript/module/ui/components/profile/EditLocationModal.d.ts +0 -20
  462. package/lib/typescript/module/ui/components/profile/EditLocationModal.d.ts.map +0 -1
  463. package/lib/typescript/module/ui/components/profile/EditUsernameModal.d.ts +0 -11
  464. package/lib/typescript/module/ui/components/profile/EditUsernameModal.d.ts.map +0 -1
  465. package/src/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  466. package/src/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  467. package/src/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  468. package/src/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  469. package/src/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  470. package/src/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  471. package/src/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  472. package/src/ui/components/profile/EditBioModal.tsx +0 -184
  473. package/src/ui/components/profile/EditDisplayNameModal.tsx +0 -203
  474. package/src/ui/components/profile/EditEmailModal.tsx +0 -188
  475. package/src/ui/components/profile/EditFieldModal.tsx +0 -465
  476. package/src/ui/components/profile/EditLinksModal.tsx +0 -316
  477. package/src/ui/components/profile/EditLocationModal.tsx +0 -278
  478. package/src/ui/components/profile/EditUsernameModal.tsx +0 -183
@@ -0,0 +1,215 @@
1
+ /**
2
+ * Mutation Factory - Creates standardized mutations with optimistic updates
3
+ *
4
+ * This factory reduces boilerplate code for mutations that follow the common pattern:
5
+ * 1. Cancel outgoing queries
6
+ * 2. Snapshot previous data
7
+ * 3. Apply optimistic update
8
+ * 4. On error: rollback and show toast
9
+ * 5. On success: update cache, stores, and invalidate queries
10
+ */
11
+
12
+ import { QueryClient, UseMutationOptions } from '@tanstack/react-query';
13
+ import type { User } from '../../../models/interfaces';
14
+ import { queryKeys, invalidateAccountQueries, invalidateUserQueries } from '../queries/queryKeys';
15
+ import { toast } from '../../../lib/sonner';
16
+ import { useAuthStore } from '../../stores/authStore';
17
+
18
+ /**
19
+ * Configuration for creating a standard profile mutation
20
+ */
21
+ export interface ProfileMutationConfig<TData, TVariables> {
22
+ /** The mutation function that makes the API call */
23
+ mutationFn: (variables: TVariables) => Promise<TData>;
24
+ /** Query keys to cancel before mutation */
25
+ cancelQueryKeys?: unknown[][];
26
+ /** Function to apply optimistic update to the user data */
27
+ optimisticUpdate?: (previousUser: User, variables: TVariables) => Partial<User>;
28
+ /** Error message to show on failure */
29
+ errorMessage?: string | ((error: Error) => string);
30
+ /** Success message to show (optional) */
31
+ successMessage?: string;
32
+ /** Whether to update authStore on success (default: true) */
33
+ updateAuthStore?: boolean;
34
+ /** Whether to invalidate user queries on success (default: true) */
35
+ invalidateUserQueries?: boolean;
36
+ /** Whether to invalidate account queries on success (default: true) */
37
+ invalidateAccountQueries?: boolean;
38
+ /** Custom onSuccess handler */
39
+ onSuccess?: (data: TData, variables: TVariables, queryClient: QueryClient) => void;
40
+ }
41
+
42
+ /**
43
+ * Creates a standard profile mutation with optimistic updates
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * const updateProfile = createProfileMutation({
48
+ * mutationFn: (updates) => oxyServices.updateProfile(updates),
49
+ * optimisticUpdate: (user, updates) => updates,
50
+ * errorMessage: 'Failed to update profile',
51
+ * });
52
+ * ```
53
+ */
54
+ export function createProfileMutation<TVariables>(
55
+ config: ProfileMutationConfig<User, TVariables>,
56
+ queryClient: QueryClient,
57
+ activeSessionId: string | null
58
+ ): UseMutationOptions<User, Error, TVariables, { previousUser?: User }> {
59
+ const {
60
+ mutationFn,
61
+ cancelQueryKeys = [],
62
+ optimisticUpdate,
63
+ errorMessage = 'Operation failed',
64
+ successMessage,
65
+ updateAuthStore = true,
66
+ invalidateUserQueries: shouldInvalidateUserQueries = true,
67
+ invalidateAccountQueries: shouldInvalidateAccountQueries = true,
68
+ onSuccess: customOnSuccess,
69
+ } = config;
70
+
71
+ return {
72
+ mutationFn,
73
+
74
+ onMutate: async (variables) => {
75
+ // Cancel queries that might conflict
76
+ await queryClient.cancelQueries({ queryKey: queryKeys.accounts.current() });
77
+ for (const key of cancelQueryKeys) {
78
+ await queryClient.cancelQueries({ queryKey: key });
79
+ }
80
+
81
+ // Snapshot previous user data
82
+ const previousUser = queryClient.getQueryData<User>(queryKeys.accounts.current());
83
+
84
+ // Apply optimistic update if provided
85
+ if (previousUser && optimisticUpdate) {
86
+ const updates = optimisticUpdate(previousUser, variables);
87
+ const optimisticUser = { ...previousUser, ...updates };
88
+
89
+ queryClient.setQueryData<User>(queryKeys.accounts.current(), optimisticUser);
90
+
91
+ if (activeSessionId) {
92
+ queryClient.setQueryData<User>(queryKeys.users.profile(activeSessionId), optimisticUser);
93
+ }
94
+ }
95
+
96
+ return { previousUser };
97
+ },
98
+
99
+ onError: (error, _variables, context) => {
100
+ // Rollback optimistic update
101
+ if (context?.previousUser) {
102
+ queryClient.setQueryData(queryKeys.accounts.current(), context.previousUser);
103
+ if (activeSessionId) {
104
+ queryClient.setQueryData(queryKeys.users.profile(activeSessionId), context.previousUser);
105
+ }
106
+ }
107
+
108
+ // Show error toast
109
+ const message = typeof errorMessage === 'function'
110
+ ? errorMessage(error)
111
+ : (error instanceof Error ? error.message : errorMessage);
112
+ toast.error(message);
113
+ },
114
+
115
+ onSuccess: (data, variables) => {
116
+ // Update cache with server response
117
+ queryClient.setQueryData(queryKeys.accounts.current(), data);
118
+ if (activeSessionId) {
119
+ queryClient.setQueryData(queryKeys.users.profile(activeSessionId), data);
120
+ }
121
+
122
+ // Update authStore for immediate UI updates
123
+ if (updateAuthStore) {
124
+ useAuthStore.getState().setUser(data);
125
+ }
126
+
127
+ // Invalidate related queries
128
+ if (shouldInvalidateUserQueries) {
129
+ invalidateUserQueries(queryClient);
130
+ }
131
+ if (shouldInvalidateAccountQueries) {
132
+ invalidateAccountQueries(queryClient);
133
+ }
134
+
135
+ // Show success toast if configured
136
+ if (successMessage) {
137
+ toast.success(successMessage);
138
+ }
139
+
140
+ // Call custom onSuccess handler
141
+ if (customOnSuccess) {
142
+ customOnSuccess(data, variables, queryClient);
143
+ }
144
+ },
145
+ };
146
+ }
147
+
148
+ /**
149
+ * Configuration for creating a generic mutation (non-profile)
150
+ */
151
+ export interface GenericMutationConfig<TData, TVariables, TContext> {
152
+ /** The mutation function */
153
+ mutationFn: (variables: TVariables) => Promise<TData>;
154
+ /** Query key for optimistic data */
155
+ queryKey: unknown[];
156
+ /** Function to create optimistic data */
157
+ optimisticData?: (previous: TData | undefined, variables: TVariables) => TData;
158
+ /** Error message */
159
+ errorMessage?: string;
160
+ /** Success message */
161
+ successMessage?: string;
162
+ /** Additional queries to invalidate on success */
163
+ invalidateQueries?: unknown[][];
164
+ }
165
+
166
+ /**
167
+ * Creates a generic mutation with optimistic updates
168
+ */
169
+ export function createGenericMutation<TData, TVariables>(
170
+ config: GenericMutationConfig<TData, TVariables, { previous?: TData }>,
171
+ queryClient: QueryClient
172
+ ): UseMutationOptions<TData, Error, TVariables, { previous?: TData }> {
173
+ const {
174
+ mutationFn,
175
+ queryKey,
176
+ optimisticData,
177
+ errorMessage = 'Operation failed',
178
+ successMessage,
179
+ invalidateQueries = [],
180
+ } = config;
181
+
182
+ return {
183
+ mutationFn,
184
+
185
+ onMutate: async (variables) => {
186
+ await queryClient.cancelQueries({ queryKey });
187
+ const previous = queryClient.getQueryData<TData>(queryKey);
188
+
189
+ if (optimisticData) {
190
+ queryClient.setQueryData<TData>(queryKey, optimisticData(previous, variables));
191
+ }
192
+
193
+ return { previous };
194
+ },
195
+
196
+ onError: (error, _variables, context) => {
197
+ if (context?.previous !== undefined) {
198
+ queryClient.setQueryData(queryKey, context.previous);
199
+ }
200
+ toast.error(error instanceof Error ? error.message : errorMessage);
201
+ },
202
+
203
+ onSuccess: (data) => {
204
+ queryClient.setQueryData(queryKey, data);
205
+
206
+ for (const key of invalidateQueries) {
207
+ queryClient.invalidateQueries({ queryKey: key });
208
+ }
209
+
210
+ if (successMessage) {
211
+ toast.success(successMessage);
212
+ }
213
+ },
214
+ };
215
+ }
@@ -5,6 +5,7 @@ import { useOxy } from '../../context/OxyContext';
5
5
  import { toast } from '../../../lib/sonner';
6
6
  import { refreshAvatarInStore } from '../../utils/avatarUtils';
7
7
  import { useAuthStore } from '../../stores/authStore';
8
+ import { authenticatedApiCall } from '../../utils/authHelpers';
8
9
 
9
10
  /**
10
11
  * Update user profile with optimistic updates and offline queue support
@@ -15,38 +16,11 @@ export const useUpdateProfile = () => {
15
16
 
16
17
  return useMutation({
17
18
  mutationFn: async (updates: Partial<User>) => {
18
- // Ensure we have a valid token before making the request
19
- if (!oxyServices.hasValidToken() && activeSessionId) {
20
- try {
21
- // Try to get token for the session
22
- await oxyServices.getTokenBySession(activeSessionId);
23
- } catch (tokenError) {
24
- // If getting token fails, might be an offline session - try syncing
25
- const errorMessage = tokenError instanceof Error ? tokenError.message : String(tokenError);
26
- if (errorMessage.includes('AUTH_REQUIRED_OFFLINE_SESSION') || errorMessage.includes('offline')) {
27
- // Session sync should be handled by the app layer
28
- throw new Error('Session needs to be synced. Please try again.');
29
- } else {
30
- throw tokenError;
31
- }
32
- }
33
- }
34
-
35
- try {
36
- return await oxyServices.updateProfile(updates);
37
- } catch (error: any) {
38
- const errorMessage = error?.message || '';
39
- const status = error?.status || error?.response?.status;
40
-
41
- // Handle authentication errors
42
- if (status === 401 || errorMessage.includes('Authentication required') || errorMessage.includes('Invalid or missing authorization header')) {
43
- // Session sync should be handled by the app layer
44
- throw new Error('Authentication failed. Please sign in again.');
45
- }
46
-
47
- // TanStack Query will automatically retry on network errors
48
- throw error;
49
- }
19
+ return authenticatedApiCall<User>(
20
+ oxyServices,
21
+ activeSessionId,
22
+ () => oxyServices.updateProfile(updates)
23
+ );
50
24
  },
51
25
  // Optimistic update
52
26
  onMutate: async (updates) => {
@@ -116,22 +90,7 @@ export const useUploadAvatar = () => {
116
90
 
117
91
  return useMutation({
118
92
  mutationFn: async (file: { uri: string; type?: string; name?: string; size?: number }) => {
119
- // Ensure we have a valid token before making the request
120
- if (!oxyServices.hasValidToken() && activeSessionId) {
121
- try {
122
- await oxyServices.getTokenBySession(activeSessionId);
123
- } catch (tokenError) {
124
- const errorMessage = tokenError instanceof Error ? tokenError.message : String(tokenError);
125
- if (errorMessage.includes('AUTH_REQUIRED_OFFLINE_SESSION') || errorMessage.includes('offline')) {
126
- // Session sync should be handled by the app layer
127
- throw new Error('Session needs to be synced. Please try again.');
128
- } else {
129
- throw tokenError;
130
- }
131
- }
132
- }
133
-
134
- try {
93
+ return authenticatedApiCall<User>(oxyServices, activeSessionId, async () => {
135
94
  // Upload file first
136
95
  const uploadResult = await oxyServices.assetUpload(file as any, 'public');
137
96
  const fileId = uploadResult?.file?.id || uploadResult?.id || uploadResult;
@@ -142,19 +101,7 @@ export const useUploadAvatar = () => {
142
101
 
143
102
  // Update profile with file ID
144
103
  return await oxyServices.updateProfile({ avatar: fileId });
145
- } catch (error: any) {
146
- const errorMessage = error?.message || '';
147
- const status = error?.status || error?.response?.status;
148
-
149
- // Handle authentication errors
150
- if (status === 401 || errorMessage.includes('Authentication required') || errorMessage.includes('Invalid or missing authorization header')) {
151
- // Session sync should be handled by the app layer
152
- throw new Error('Authentication failed. Please sign in again.');
153
- }
154
-
155
- // TanStack Query will automatically retry on network errors
156
- throw error;
157
- }
104
+ });
158
105
  },
159
106
  onMutate: async (file) => {
160
107
  await queryClient.cancelQueries({ queryKey: queryKeys.accounts.current() });
@@ -267,38 +214,11 @@ export const useUpdatePrivacySettings = () => {
267
214
  throw new Error('User ID is required');
268
215
  }
269
216
 
270
- // Ensure we have a valid token before making the request
271
- if (!oxyServices.hasValidToken() && activeSessionId) {
272
- try {
273
- // Try to get token for the session
274
- await oxyServices.getTokenBySession(activeSessionId);
275
- } catch (tokenError) {
276
- // If getting token fails, might be an offline session - try syncing
277
- const errorMessage = tokenError instanceof Error ? tokenError.message : String(tokenError);
278
- if (errorMessage.includes('AUTH_REQUIRED_OFFLINE_SESSION') || errorMessage.includes('offline')) {
279
- // Session sync should be handled by the app layer
280
- throw new Error('Session needs to be synced. Please try again.');
281
- } else {
282
- throw tokenError;
283
- }
284
- }
285
- }
286
-
287
- try {
288
- return await oxyServices.updatePrivacySettings(settings, targetUserId);
289
- } catch (error: any) {
290
- const errorMessage = error?.message || '';
291
- const status = error?.status || error?.response?.status;
292
-
293
- // Handle authentication errors
294
- if (status === 401 || errorMessage.includes('Authentication required') || errorMessage.includes('Invalid or missing authorization header')) {
295
- // Session sync should be handled by the app layer
296
- throw new Error('Authentication failed. Please sign in again.');
297
- }
298
-
299
- // TanStack Query will automatically retry on network errors
300
- throw error;
301
- }
217
+ return authenticatedApiCall<Record<string, unknown>>(
218
+ oxyServices,
219
+ activeSessionId,
220
+ () => oxyServices.updatePrivacySettings(settings, targetUserId)
221
+ );
302
222
  },
303
223
  // Optimistic update
304
224
  onMutate: async ({ settings, userId }) => {
@@ -354,12 +274,12 @@ export const useUpdatePrivacySettings = () => {
354
274
  // Also update account query if it contains privacy settings
355
275
  const currentUser = queryClient.getQueryData<User>(queryKeys.accounts.current());
356
276
  if (currentUser) {
357
- const updatedUser = {
277
+ const updatedUser: User = {
358
278
  ...currentUser,
359
- privacySettings: data,
279
+ privacySettings: data as { [key: string]: unknown },
360
280
  };
361
281
  queryClient.setQueryData<User>(queryKeys.accounts.current(), updatedUser);
362
-
282
+
363
283
  // Update authStore so frontend components see the changes immediately
364
284
  useAuthStore.getState().setUser(updatedUser);
365
285
  }
@@ -376,6 +296,25 @@ export const useUpdatePrivacySettings = () => {
376
296
  });
377
297
  };
378
298
 
299
+ /** Uploaded file data structure from API */
300
+ interface UploadedFile {
301
+ id: string;
302
+ originalName?: string;
303
+ sha256?: string;
304
+ mime?: string;
305
+ size?: number;
306
+ createdAt?: string;
307
+ metadata?: Record<string, unknown>;
308
+ variants?: Array<{ type: string; key: string; width?: number; height?: number; readyAt?: string; metadata?: Record<string, unknown> }>;
309
+ }
310
+
311
+ /** Upload result type that supports both single file and batch responses */
312
+ interface UploadResult {
313
+ file?: UploadedFile;
314
+ files?: UploadedFile[];
315
+ id?: string;
316
+ }
317
+
379
318
  /**
380
319
  * Upload file with authentication handling and progress tracking
381
320
  */
@@ -383,49 +322,22 @@ export const useUploadFile = () => {
383
322
  const { oxyServices, activeSessionId } = useOxy();
384
323
 
385
324
  return useMutation({
386
- mutationFn: async ({
387
- file,
388
- visibility,
389
- metadata,
390
- onProgress
391
- }: {
392
- file: File;
393
- visibility?: 'private' | 'public' | 'unlisted';
325
+ mutationFn: async ({
326
+ file,
327
+ visibility,
328
+ metadata,
329
+ onProgress
330
+ }: {
331
+ file: File;
332
+ visibility?: 'private' | 'public' | 'unlisted';
394
333
  metadata?: Record<string, any>;
395
334
  onProgress?: (progress: number) => void;
396
335
  }) => {
397
- // Ensure we have a valid token before making the request
398
- if (!oxyServices.hasValidToken() && activeSessionId) {
399
- try {
400
- // Try to get token for the session
401
- await oxyServices.getTokenBySession(activeSessionId);
402
- } catch (tokenError) {
403
- // If getting token fails, might be an offline session - try syncing
404
- const errorMessage = tokenError instanceof Error ? tokenError.message : String(tokenError);
405
- if (errorMessage.includes('AUTH_REQUIRED_OFFLINE_SESSION') || errorMessage.includes('offline')) {
406
- // Session sync should be handled by the app layer
407
- throw new Error('Session needs to be synced. Please try again.');
408
- } else {
409
- throw tokenError;
410
- }
411
- }
412
- }
413
-
414
- try {
415
- return await oxyServices.assetUpload(file as any, visibility, metadata, onProgress);
416
- } catch (error: any) {
417
- const errorMessage = error?.message || '';
418
- const status = error?.status || error?.response?.status;
419
-
420
- // Handle authentication errors
421
- if (status === 401 || errorMessage.includes('Authentication required') || errorMessage.includes('Invalid or missing authorization header')) {
422
- // Session sync should be handled by the app layer
423
- throw new Error('Authentication failed. Please sign in again.');
424
- }
425
-
426
- // TanStack Query will automatically retry on network errors
427
- throw error;
428
- }
336
+ return authenticatedApiCall<UploadResult>(
337
+ oxyServices,
338
+ activeSessionId,
339
+ () => oxyServices.assetUpload(file as any, visibility, metadata, onProgress)
340
+ );
429
341
  },
430
342
  });
431
343
  };
@@ -1,8 +1,8 @@
1
1
  import { useQuery, useQueries } from '@tanstack/react-query';
2
2
  import type { User } from '../../../models/interfaces';
3
- import type { OxyServices } from '../../../core';
4
3
  import { queryKeys } from './queryKeys';
5
4
  import { useOxy } from '../../context/OxyContext';
5
+ import { authenticatedApiCall } from '../../utils/authHelpers';
6
6
 
7
7
  /**
8
8
  * Get user profile by session ID
@@ -138,38 +138,11 @@ export const usePrivacySettings = (userId?: string, options?: { enabled?: boolea
138
138
  throw new Error('User ID is required');
139
139
  }
140
140
 
141
- // Ensure we have a valid token before making the request
142
- if (!oxyServices.hasValidToken() && activeSessionId) {
143
- try {
144
- // Try to get token for the session
145
- await oxyServices.getTokenBySession(activeSessionId);
146
- } catch (tokenError) {
147
- // If getting token fails, might be an offline session - try syncing
148
- const errorMessage = tokenError instanceof Error ? tokenError.message : String(tokenError);
149
- if (errorMessage.includes('AUTH_REQUIRED_OFFLINE_SESSION') || errorMessage.includes('offline')) {
150
- // Session sync should be handled by the app layer (e.g., accounts app's useIdentity hook)
151
- throw new Error('Session needs to be synced. Please try again.');
152
- } else {
153
- throw tokenError;
154
- }
155
- }
156
- }
157
-
158
- try {
159
- return await oxyServices.getPrivacySettings(targetUserId);
160
- } catch (error: any) {
161
- const errorMessage = error?.message || '';
162
- const status = error?.status || error?.response?.status;
163
-
164
- // Handle authentication errors
165
- if (status === 401 || errorMessage.includes('Authentication required') || errorMessage.includes('Invalid or missing authorization header')) {
166
- // Session sync should be handled by the app layer
167
- throw new Error('Authentication failed. Please sign in again.');
168
- }
169
-
170
- // TanStack Query will automatically retry on network errors
171
- throw error;
172
- }
141
+ return authenticatedApiCall(
142
+ oxyServices,
143
+ activeSessionId,
144
+ () => oxyServices.getPrivacySettings(targetUserId)
145
+ );
173
146
  },
174
147
  enabled: (options?.enabled !== false) && !!targetUserId,
175
148
  staleTime: 2 * 60 * 1000, // 2 minutes
@@ -3,6 +3,7 @@ import type { ClientSession } from '../../../models/session';
3
3
  import { queryKeys } from './queryKeys';
4
4
  import { useOxy } from '../../context/OxyContext';
5
5
  import { fetchSessionsWithFallback, mapSessionsToClient } from '../../utils/sessionHelpers';
6
+ import { authenticatedApiCall } from '../../utils/authHelpers';
6
7
 
7
8
  /**
8
9
  * Get all active sessions for the current user
@@ -94,38 +95,11 @@ export const useUserDevices = (options?: { enabled?: boolean }) => {
94
95
  return useQuery({
95
96
  queryKey: queryKeys.devices.list(),
96
97
  queryFn: async () => {
97
- // Ensure we have a valid token before making the request
98
- if (!oxyServices.hasValidToken() && activeSessionId) {
99
- try {
100
- // Try to get token for the session
101
- await oxyServices.getTokenBySession(activeSessionId);
102
- } catch (tokenError) {
103
- // If getting token fails, might be an offline session - try syncing
104
- const errorMessage = tokenError instanceof Error ? tokenError.message : String(tokenError);
105
- if (errorMessage.includes('AUTH_REQUIRED_OFFLINE_SESSION') || errorMessage.includes('offline')) {
106
- // Session sync should be handled by the app layer
107
- throw new Error('Session needs to be synced. Please try again.');
108
- } else {
109
- throw tokenError;
110
- }
111
- }
112
- }
113
-
114
- try {
115
- return await oxyServices.getUserDevices();
116
- } catch (error: any) {
117
- const errorMessage = error?.message || '';
118
- const status = error?.status || error?.response?.status;
119
-
120
- // Handle authentication errors
121
- if (status === 401 || errorMessage.includes('Authentication required') || errorMessage.includes('Invalid or missing authorization header')) {
122
- // Session sync should be handled by the app layer
123
- throw new Error('Authentication failed. Please sign in again.');
124
- }
125
-
126
- // TanStack Query will automatically retry on network errors
127
- throw error;
128
- }
98
+ return authenticatedApiCall(
99
+ oxyServices,
100
+ activeSessionId,
101
+ () => oxyServices.getUserDevices()
102
+ );
129
103
  },
130
104
  enabled: (options?.enabled !== false) && isAuthenticated,
131
105
  staleTime: 5 * 60 * 1000,
@@ -0,0 +1,115 @@
1
+ import { useMemo, useState, useCallback } from 'react';
2
+ import type { FileMetadata } from '../../models/interfaces';
3
+
4
+ export type ViewMode = 'all' | 'photos' | 'videos' | 'documents' | 'audio';
5
+ export type SortBy = 'date' | 'size' | 'name' | 'type';
6
+ export type SortOrder = 'asc' | 'desc';
7
+
8
+ interface UseFileFilteringOptions {
9
+ files: FileMetadata[];
10
+ initialViewMode?: ViewMode;
11
+ initialSortBy?: SortBy;
12
+ initialSortOrder?: SortOrder;
13
+ }
14
+
15
+ interface UseFileFilteringReturn {
16
+ filteredFiles: FileMetadata[];
17
+ viewMode: ViewMode;
18
+ setViewMode: (mode: ViewMode) => void;
19
+ searchQuery: string;
20
+ setSearchQuery: (query: string) => void;
21
+ sortBy: SortBy;
22
+ setSortBy: (sort: SortBy) => void;
23
+ sortOrder: SortOrder;
24
+ setSortOrder: (order: SortOrder) => void;
25
+ toggleSortOrder: () => void;
26
+ }
27
+
28
+ /**
29
+ * Hook for file filtering, sorting, and search functionality
30
+ * Extracts common file management logic for reuse across components
31
+ */
32
+ export function useFileFiltering({
33
+ files,
34
+ initialViewMode = 'all',
35
+ initialSortBy = 'date',
36
+ initialSortOrder = 'desc',
37
+ }: UseFileFilteringOptions): UseFileFilteringReturn {
38
+ const [viewMode, setViewMode] = useState<ViewMode>(initialViewMode);
39
+ const [searchQuery, setSearchQuery] = useState('');
40
+ const [sortBy, setSortBy] = useState<SortBy>(initialSortBy);
41
+ const [sortOrder, setSortOrder] = useState<SortOrder>(initialSortOrder);
42
+
43
+ const toggleSortOrder = useCallback(() => {
44
+ setSortOrder((prev) => (prev === 'asc' ? 'desc' : 'asc'));
45
+ }, []);
46
+
47
+ const filteredFiles = useMemo(() => {
48
+ // Filter by view mode
49
+ let filteredByMode = files;
50
+ if (viewMode === 'photos') {
51
+ filteredByMode = files.filter((file) => file.contentType.startsWith('image/'));
52
+ } else if (viewMode === 'videos') {
53
+ filteredByMode = files.filter((file) => file.contentType.startsWith('video/'));
54
+ } else if (viewMode === 'documents') {
55
+ filteredByMode = files.filter(
56
+ (file) =>
57
+ file.contentType.includes('pdf') ||
58
+ file.contentType.includes('document') ||
59
+ file.contentType.includes('text') ||
60
+ file.contentType.includes('msword') ||
61
+ file.contentType.includes('excel') ||
62
+ file.contentType.includes('spreadsheet') ||
63
+ file.contentType.includes('presentation') ||
64
+ file.contentType.includes('powerpoint')
65
+ );
66
+ } else if (viewMode === 'audio') {
67
+ filteredByMode = files.filter((file) => file.contentType.startsWith('audio/'));
68
+ }
69
+
70
+ // Filter by search query
71
+ let filtered = filteredByMode;
72
+ if (searchQuery.trim()) {
73
+ const query = searchQuery.toLowerCase();
74
+ filtered = filteredByMode.filter(
75
+ (file) =>
76
+ file.filename.toLowerCase().includes(query) ||
77
+ file.contentType.toLowerCase().includes(query) ||
78
+ (file.metadata?.description &&
79
+ file.metadata.description.toLowerCase().includes(query))
80
+ );
81
+ }
82
+
83
+ // Sort files
84
+ const sorted = [...filtered].sort((a, b) => {
85
+ let comparison = 0;
86
+ if (sortBy === 'date') {
87
+ const dateA = new Date(a.uploadDate || 0).getTime();
88
+ const dateB = new Date(b.uploadDate || 0).getTime();
89
+ comparison = dateA - dateB;
90
+ } else if (sortBy === 'size') {
91
+ comparison = (a.length || 0) - (b.length || 0);
92
+ } else if (sortBy === 'name') {
93
+ comparison = (a.filename || '').localeCompare(b.filename || '');
94
+ } else if (sortBy === 'type') {
95
+ comparison = (a.contentType || '').localeCompare(b.contentType || '');
96
+ }
97
+ return sortOrder === 'asc' ? comparison : -comparison;
98
+ });
99
+
100
+ return sorted;
101
+ }, [files, searchQuery, viewMode, sortBy, sortOrder]);
102
+
103
+ return {
104
+ filteredFiles,
105
+ viewMode,
106
+ setViewMode,
107
+ searchQuery,
108
+ setSearchQuery,
109
+ sortBy,
110
+ setSortBy,
111
+ sortOrder,
112
+ setSortOrder,
113
+ toggleSortOrder,
114
+ };
115
+ }