@oxyhq/services 5.10.16 → 5.11.2

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 (460) hide show
  1. package/README.md +78 -14
  2. package/lib/commonjs/assets/assets/icons/OxyServices.tsx +2 -2
  3. package/lib/commonjs/assets/assets/illustrations/HighFive.tsx +1 -1
  4. package/lib/commonjs/assets/icons/OxyServices.js +0 -2
  5. package/lib/commonjs/assets/icons/OxyServices.js.map +1 -1
  6. package/lib/commonjs/assets/illustrations/HighFive.js +0 -2
  7. package/lib/commonjs/assets/illustrations/HighFive.js.map +1 -1
  8. package/lib/commonjs/core/OxyServices.js +238 -25
  9. package/lib/commonjs/core/OxyServices.js.map +1 -1
  10. package/lib/commonjs/index.js +86 -0
  11. package/lib/commonjs/index.js.map +1 -1
  12. package/lib/commonjs/lib/sonner-safe.js +2 -0
  13. package/lib/commonjs/lib/sonner-safe.js.map +1 -1
  14. package/lib/commonjs/lib/sonner.js +2 -0
  15. package/lib/commonjs/lib/sonner.js.map +1 -1
  16. package/lib/commonjs/ui/components/Avatar.js +0 -2
  17. package/lib/commonjs/ui/components/Avatar.js.map +1 -1
  18. package/lib/commonjs/ui/components/FollowButton.js +4 -4
  19. package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
  20. package/lib/commonjs/ui/components/FontLoader.js +3 -2
  21. package/lib/commonjs/ui/components/FontLoader.js.map +1 -1
  22. package/lib/commonjs/ui/components/GroupedItem.js +7 -4
  23. package/lib/commonjs/ui/components/GroupedItem.js.map +1 -1
  24. package/lib/commonjs/ui/components/GroupedSection.js +1 -1
  25. package/lib/commonjs/ui/components/GroupedSection.js.map +1 -1
  26. package/lib/commonjs/ui/components/Header.js +0 -1
  27. package/lib/commonjs/ui/components/Header.js.map +1 -1
  28. package/lib/commonjs/ui/components/OxyLogo.js +0 -2
  29. package/lib/commonjs/ui/components/OxyLogo.js.map +1 -1
  30. package/lib/commonjs/ui/components/OxyPayButton.js +4 -5
  31. package/lib/commonjs/ui/components/OxyPayButton.js.map +1 -1
  32. package/lib/commonjs/ui/components/OxyProvider.js +4 -3
  33. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  34. package/lib/commonjs/ui/components/OxySignInButton.js +0 -1
  35. package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
  36. package/lib/commonjs/ui/components/ProfileCard.js +0 -1
  37. package/lib/commonjs/ui/components/ProfileCard.js.map +1 -1
  38. package/lib/commonjs/ui/components/QuickActions.js +0 -2
  39. package/lib/commonjs/ui/components/QuickActions.js.map +1 -1
  40. package/lib/commonjs/ui/components/Section.js +0 -1
  41. package/lib/commonjs/ui/components/Section.js.map +1 -1
  42. package/lib/commonjs/ui/components/SectionTitle.js +0 -2
  43. package/lib/commonjs/ui/components/SectionTitle.js.map +1 -1
  44. package/lib/commonjs/ui/components/icon/FAIRWalletIcon.js +0 -2
  45. package/lib/commonjs/ui/components/icon/FAIRWalletIcon.js.map +1 -1
  46. package/lib/commonjs/ui/components/icon/OxyIcon.js +0 -2
  47. package/lib/commonjs/ui/components/icon/OxyIcon.js.map +1 -1
  48. package/lib/commonjs/ui/components/internal/GroupedPillButtons.js +0 -2
  49. package/lib/commonjs/ui/components/internal/GroupedPillButtons.js.map +1 -1
  50. package/lib/commonjs/ui/components/internal/PinInput.js +4 -3
  51. package/lib/commonjs/ui/components/internal/PinInput.js.map +1 -1
  52. package/lib/commonjs/ui/components/internal/TextField.js +3 -3
  53. package/lib/commonjs/ui/components/internal/TextField.js.map +1 -1
  54. package/lib/commonjs/ui/context/OxyContext.js +3 -1
  55. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  56. package/lib/commonjs/ui/hooks/useAssets.js +263 -0
  57. package/lib/commonjs/ui/hooks/useAssets.js.map +1 -0
  58. package/lib/commonjs/ui/navigation/OxyRouter.js +1 -2
  59. package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -1
  60. package/lib/commonjs/ui/screens/AccountCenterScreen.js +0 -2
  61. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
  62. package/lib/commonjs/ui/screens/AccountManagementDemo.js +0 -1
  63. package/lib/commonjs/ui/screens/AccountManagementDemo.js.map +1 -1
  64. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +2 -2
  65. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  66. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +5 -6
  67. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
  68. package/lib/commonjs/ui/screens/AppInfoScreen.js +1 -2
  69. package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
  70. package/lib/commonjs/ui/screens/FileManagementScreen.js +631 -430
  71. package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
  72. package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +2 -2
  73. package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -1
  74. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +1 -2
  75. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  76. package/lib/commonjs/ui/screens/ProfileScreen.js +1 -2
  77. package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
  78. package/lib/commonjs/ui/screens/RecoverAccountScreen.js +1 -2
  79. package/lib/commonjs/ui/screens/RecoverAccountScreen.js.map +1 -1
  80. package/lib/commonjs/ui/screens/SessionManagementScreen.js +1 -2
  81. package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
  82. package/lib/commonjs/ui/screens/SignInScreen.js +1 -2
  83. package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
  84. package/lib/commonjs/ui/screens/UserLinksScreen.js +0 -2
  85. package/lib/commonjs/ui/screens/UserLinksScreen.js.map +1 -1
  86. package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js +1 -2
  87. package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js.map +1 -1
  88. package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js +1 -2
  89. package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js.map +1 -1
  90. package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js +1 -2
  91. package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js.map +1 -1
  92. package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js +1 -2
  93. package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js.map +1 -1
  94. package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js +0 -1
  95. package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js.map +1 -1
  96. package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js +0 -1
  97. package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js.map +1 -1
  98. package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js +0 -2
  99. package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js.map +1 -1
  100. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +1 -2
  101. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
  102. package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js +1 -2
  103. package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
  104. package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js +0 -2
  105. package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
  106. package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js +1 -2
  107. package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
  108. package/lib/commonjs/ui/stores/assetStore.js +225 -0
  109. package/lib/commonjs/ui/stores/assetStore.js.map +1 -0
  110. package/lib/commonjs/ui/stores/authStore.js +1 -1
  111. package/lib/commonjs/ui/stores/authStore.js.map +1 -1
  112. package/lib/commonjs/ui/stores/fileStore.js +153 -0
  113. package/lib/commonjs/ui/stores/fileStore.js.map +1 -0
  114. package/lib/commonjs/ui/stores/followStore.js +2 -2
  115. package/lib/commonjs/ui/stores/followStore.js.map +1 -1
  116. package/lib/commonjs/utils/asyncUtils.js +1 -1
  117. package/lib/commonjs/utils/asyncUtils.js.map +1 -1
  118. package/lib/commonjs/utils/errorUtils.js +19 -11
  119. package/lib/commonjs/utils/errorUtils.js.map +1 -1
  120. package/lib/commonjs/utils/hookUtils.js +1 -1
  121. package/lib/commonjs/utils/hookUtils.js.map +1 -1
  122. package/lib/commonjs/utils/loggerUtils.js.map +1 -1
  123. package/lib/commonjs/utils/validationUtils.js +2 -2
  124. package/lib/commonjs/utils/validationUtils.js.map +1 -1
  125. package/lib/module/assets/assets/icons/OxyServices.tsx +2 -2
  126. package/lib/module/assets/assets/illustrations/HighFive.tsx +1 -1
  127. package/lib/module/assets/icons/OxyServices.js +0 -1
  128. package/lib/module/assets/icons/OxyServices.js.map +1 -1
  129. package/lib/module/assets/illustrations/HighFive.js +0 -1
  130. package/lib/module/assets/illustrations/HighFive.js.map +1 -1
  131. package/lib/module/core/OxyServices.js +238 -25
  132. package/lib/module/core/OxyServices.js.map +1 -1
  133. package/lib/module/index.js +2 -0
  134. package/lib/module/index.js.map +1 -1
  135. package/lib/module/lib/sonner-safe.js +2 -0
  136. package/lib/module/lib/sonner-safe.js.map +1 -1
  137. package/lib/module/lib/sonner.js +3 -0
  138. package/lib/module/lib/sonner.js.map +1 -1
  139. package/lib/module/ui/components/Avatar.js +0 -1
  140. package/lib/module/ui/components/Avatar.js.map +1 -1
  141. package/lib/module/ui/components/FollowButton.js +4 -3
  142. package/lib/module/ui/components/FollowButton.js.map +1 -1
  143. package/lib/module/ui/components/FontLoader.js +3 -2
  144. package/lib/module/ui/components/FontLoader.js.map +1 -1
  145. package/lib/module/ui/components/GroupedItem.js +7 -3
  146. package/lib/module/ui/components/GroupedItem.js.map +1 -1
  147. package/lib/module/ui/components/GroupedSection.js +1 -1
  148. package/lib/module/ui/components/GroupedSection.js.map +1 -1
  149. package/lib/module/ui/components/Header.js +0 -1
  150. package/lib/module/ui/components/Header.js.map +1 -1
  151. package/lib/module/ui/components/OxyLogo.js +0 -1
  152. package/lib/module/ui/components/OxyLogo.js.map +1 -1
  153. package/lib/module/ui/components/OxyPayButton.js +4 -4
  154. package/lib/module/ui/components/OxyPayButton.js.map +1 -1
  155. package/lib/module/ui/components/OxyProvider.js +4 -2
  156. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  157. package/lib/module/ui/components/OxySignInButton.js +0 -1
  158. package/lib/module/ui/components/OxySignInButton.js.map +1 -1
  159. package/lib/module/ui/components/ProfileCard.js +0 -1
  160. package/lib/module/ui/components/ProfileCard.js.map +1 -1
  161. package/lib/module/ui/components/QuickActions.js +0 -1
  162. package/lib/module/ui/components/QuickActions.js.map +1 -1
  163. package/lib/module/ui/components/Section.js +0 -1
  164. package/lib/module/ui/components/Section.js.map +1 -1
  165. package/lib/module/ui/components/SectionTitle.js +0 -1
  166. package/lib/module/ui/components/SectionTitle.js.map +1 -1
  167. package/lib/module/ui/components/icon/FAIRWalletIcon.js +0 -1
  168. package/lib/module/ui/components/icon/FAIRWalletIcon.js.map +1 -1
  169. package/lib/module/ui/components/icon/OxyIcon.js +0 -1
  170. package/lib/module/ui/components/icon/OxyIcon.js.map +1 -1
  171. package/lib/module/ui/components/internal/GroupedPillButtons.js +0 -1
  172. package/lib/module/ui/components/internal/GroupedPillButtons.js.map +1 -1
  173. package/lib/module/ui/components/internal/PinInput.js +4 -2
  174. package/lib/module/ui/components/internal/PinInput.js.map +1 -1
  175. package/lib/module/ui/components/internal/TextField.js +3 -3
  176. package/lib/module/ui/components/internal/TextField.js.map +1 -1
  177. package/lib/module/ui/context/OxyContext.js +3 -1
  178. package/lib/module/ui/context/OxyContext.js.map +1 -1
  179. package/lib/module/ui/hooks/useAssets.js +257 -0
  180. package/lib/module/ui/hooks/useAssets.js.map +1 -0
  181. package/lib/module/ui/navigation/OxyRouter.js +1 -1
  182. package/lib/module/ui/navigation/OxyRouter.js.map +1 -1
  183. package/lib/module/ui/screens/AccountCenterScreen.js +0 -1
  184. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
  185. package/lib/module/ui/screens/AccountManagementDemo.js +0 -1
  186. package/lib/module/ui/screens/AccountManagementDemo.js.map +1 -1
  187. package/lib/module/ui/screens/AccountSettingsScreen.js +2 -2
  188. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  189. package/lib/module/ui/screens/AccountSwitcherScreen.js +5 -5
  190. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  191. package/lib/module/ui/screens/AppInfoScreen.js +1 -1
  192. package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
  193. package/lib/module/ui/screens/FileManagementScreen.js +633 -432
  194. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  195. package/lib/module/ui/screens/PaymentGatewayScreen.js +1 -1
  196. package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -1
  197. package/lib/module/ui/screens/PremiumSubscriptionScreen.js +1 -1
  198. package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  199. package/lib/module/ui/screens/ProfileScreen.js +1 -1
  200. package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
  201. package/lib/module/ui/screens/RecoverAccountScreen.js +1 -1
  202. package/lib/module/ui/screens/RecoverAccountScreen.js.map +1 -1
  203. package/lib/module/ui/screens/SessionManagementScreen.js +1 -1
  204. package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
  205. package/lib/module/ui/screens/SignInScreen.js +1 -1
  206. package/lib/module/ui/screens/SignInScreen.js.map +1 -1
  207. package/lib/module/ui/screens/UserLinksScreen.js +0 -1
  208. package/lib/module/ui/screens/UserLinksScreen.js.map +1 -1
  209. package/lib/module/ui/screens/internal/SignInPasswordStep.js +1 -1
  210. package/lib/module/ui/screens/internal/SignInPasswordStep.js.map +1 -1
  211. package/lib/module/ui/screens/internal/SignInUsernameStep.js +1 -1
  212. package/lib/module/ui/screens/internal/SignInUsernameStep.js.map +1 -1
  213. package/lib/module/ui/screens/internal/SignUpIdentityStep.js +1 -1
  214. package/lib/module/ui/screens/internal/SignUpIdentityStep.js.map +1 -1
  215. package/lib/module/ui/screens/internal/SignUpSecurityStep.js +1 -1
  216. package/lib/module/ui/screens/internal/SignUpSecurityStep.js.map +1 -1
  217. package/lib/module/ui/screens/internal/SignUpSummaryStep.js +0 -1
  218. package/lib/module/ui/screens/internal/SignUpSummaryStep.js.map +1 -1
  219. package/lib/module/ui/screens/internal/SignUpWelcomeStep.js +0 -1
  220. package/lib/module/ui/screens/internal/SignUpWelcomeStep.js.map +1 -1
  221. package/lib/module/ui/screens/karma/KarmaAboutScreen.js +0 -1
  222. package/lib/module/ui/screens/karma/KarmaAboutScreen.js.map +1 -1
  223. package/lib/module/ui/screens/karma/KarmaCenterScreen.js +1 -1
  224. package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
  225. package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
  226. package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
  227. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js +0 -1
  228. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
  229. package/lib/module/ui/screens/karma/KarmaRulesScreen.js +1 -1
  230. package/lib/module/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
  231. package/lib/module/ui/stores/assetStore.js +212 -0
  232. package/lib/module/ui/stores/assetStore.js.map +1 -0
  233. package/lib/module/ui/stores/authStore.js +1 -1
  234. package/lib/module/ui/stores/authStore.js.map +1 -1
  235. package/lib/module/ui/stores/fileStore.js +145 -0
  236. package/lib/module/ui/stores/fileStore.js.map +1 -0
  237. package/lib/module/ui/stores/followStore.js +2 -2
  238. package/lib/module/ui/stores/followStore.js.map +1 -1
  239. package/lib/module/ui/styles/fonts.js.map +1 -1
  240. package/lib/module/ui/styles/theme.js.map +1 -1
  241. package/lib/module/utils/asyncUtils.js +1 -1
  242. package/lib/module/utils/asyncUtils.js.map +1 -1
  243. package/lib/module/utils/errorUtils.js +19 -11
  244. package/lib/module/utils/errorUtils.js.map +1 -1
  245. package/lib/module/utils/hookUtils.js +1 -1
  246. package/lib/module/utils/hookUtils.js.map +1 -1
  247. package/lib/module/utils/loggerUtils.js.map +1 -1
  248. package/lib/module/utils/validationUtils.js +2 -2
  249. package/lib/module/utils/validationUtils.js.map +1 -1
  250. package/lib/typescript/assets/icons/OxyServices.d.ts +2 -2
  251. package/lib/typescript/assets/icons/OxyServices.d.ts.map +1 -1
  252. package/lib/typescript/assets/illustrations/HighFive.d.ts +1 -1
  253. package/lib/typescript/assets/illustrations/HighFive.d.ts.map +1 -1
  254. package/lib/typescript/core/OxyServices.d.ts +68 -12
  255. package/lib/typescript/core/OxyServices.d.ts.map +1 -1
  256. package/lib/typescript/index.d.ts +3 -1
  257. package/lib/typescript/index.d.ts.map +1 -1
  258. package/lib/typescript/lib/sonner-safe.d.ts +2 -1
  259. package/lib/typescript/lib/sonner-safe.d.ts.map +1 -1
  260. package/lib/typescript/lib/sonner.d.ts +11 -3
  261. package/lib/typescript/lib/sonner.d.ts.map +1 -1
  262. package/lib/typescript/models/interfaces.d.ts +105 -6
  263. package/lib/typescript/models/interfaces.d.ts.map +1 -1
  264. package/lib/typescript/types/expo-vector-icons.d.ts +8 -1
  265. package/lib/typescript/types/express.d.ts +22 -3
  266. package/lib/typescript/ui/components/Avatar.d.ts +2 -2
  267. package/lib/typescript/ui/components/Avatar.d.ts.map +1 -1
  268. package/lib/typescript/ui/components/FollowButton.d.ts +2 -2
  269. package/lib/typescript/ui/components/FollowButton.d.ts.map +1 -1
  270. package/lib/typescript/ui/components/FontLoader.d.ts +1 -1
  271. package/lib/typescript/ui/components/FontLoader.d.ts.map +1 -1
  272. package/lib/typescript/ui/components/GroupedItem.d.ts +2 -1
  273. package/lib/typescript/ui/components/GroupedItem.d.ts.map +1 -1
  274. package/lib/typescript/ui/components/GroupedSection.d.ts +2 -1
  275. package/lib/typescript/ui/components/GroupedSection.d.ts.map +1 -1
  276. package/lib/typescript/ui/components/Header.d.ts +1 -1
  277. package/lib/typescript/ui/components/Header.d.ts.map +1 -1
  278. package/lib/typescript/ui/components/OxyLogo.d.ts +2 -2
  279. package/lib/typescript/ui/components/OxyLogo.d.ts.map +1 -1
  280. package/lib/typescript/ui/components/OxyPayButton.d.ts +2 -2
  281. package/lib/typescript/ui/components/OxyPayButton.d.ts.map +1 -1
  282. package/lib/typescript/ui/components/OxyProvider.d.ts +2 -2
  283. package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
  284. package/lib/typescript/ui/components/OxySignInButton.d.ts +2 -2
  285. package/lib/typescript/ui/components/OxySignInButton.d.ts.map +1 -1
  286. package/lib/typescript/ui/components/ProfileCard.d.ts +1 -1
  287. package/lib/typescript/ui/components/ProfileCard.d.ts.map +1 -1
  288. package/lib/typescript/ui/components/QuickActions.d.ts +1 -1
  289. package/lib/typescript/ui/components/QuickActions.d.ts.map +1 -1
  290. package/lib/typescript/ui/components/Section.d.ts +1 -1
  291. package/lib/typescript/ui/components/Section.d.ts.map +1 -1
  292. package/lib/typescript/ui/components/SectionTitle.d.ts +1 -1
  293. package/lib/typescript/ui/components/SectionTitle.d.ts.map +1 -1
  294. package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts +1 -1
  295. package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts.map +1 -1
  296. package/lib/typescript/ui/components/icon/OxyIcon.d.ts +1 -1
  297. package/lib/typescript/ui/components/icon/OxyIcon.d.ts.map +1 -1
  298. package/lib/typescript/ui/components/internal/GroupedPillButtons.d.ts +1 -1
  299. package/lib/typescript/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
  300. package/lib/typescript/ui/components/internal/PinInput.d.ts +1 -1
  301. package/lib/typescript/ui/components/internal/PinInput.d.ts.map +1 -1
  302. package/lib/typescript/ui/components/internal/TextField.d.ts +1 -1
  303. package/lib/typescript/ui/components/internal/TextField.d.ts.map +1 -1
  304. package/lib/typescript/ui/context/OxyContext.d.ts +8 -3
  305. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
  306. package/lib/typescript/ui/hooks/useAssets.d.ts +35 -0
  307. package/lib/typescript/ui/hooks/useAssets.d.ts.map +1 -0
  308. package/lib/typescript/ui/navigation/OxyRouter.d.ts +2 -2
  309. package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -1
  310. package/lib/typescript/ui/navigation/types.d.ts +7 -7
  311. package/lib/typescript/ui/navigation/types.d.ts.map +1 -1
  312. package/lib/typescript/ui/screens/AccountCenterScreen.d.ts +2 -2
  313. package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -1
  314. package/lib/typescript/ui/screens/AccountManagementDemo.d.ts +1 -1
  315. package/lib/typescript/ui/screens/AccountManagementDemo.d.ts.map +1 -1
  316. package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts +1 -1
  317. package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
  318. package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts +1 -1
  319. package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  320. package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts +2 -2
  321. package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
  322. package/lib/typescript/ui/screens/AppInfoScreen.d.ts +2 -2
  323. package/lib/typescript/ui/screens/AppInfoScreen.d.ts.map +1 -1
  324. package/lib/typescript/ui/screens/FeedbackScreen.d.ts +1 -1
  325. package/lib/typescript/ui/screens/FeedbackScreen.d.ts.map +1 -1
  326. package/lib/typescript/ui/screens/FileManagementScreen.d.ts +1 -1
  327. package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +1 -1
  328. package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts +2 -2
  329. package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
  330. package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts +2 -2
  331. package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
  332. package/lib/typescript/ui/screens/ProfileScreen.d.ts +2 -2
  333. package/lib/typescript/ui/screens/ProfileScreen.d.ts.map +1 -1
  334. package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts +1 -1
  335. package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts.map +1 -1
  336. package/lib/typescript/ui/screens/SessionManagementScreen.d.ts +2 -2
  337. package/lib/typescript/ui/screens/SessionManagementScreen.d.ts.map +1 -1
  338. package/lib/typescript/ui/screens/SignInScreen.d.ts +2 -2
  339. package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
  340. package/lib/typescript/ui/screens/SignUpScreen.d.ts +1 -1
  341. package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +1 -1
  342. package/lib/typescript/ui/screens/UserLinksScreen.d.ts +2 -2
  343. package/lib/typescript/ui/screens/UserLinksScreen.d.ts.map +1 -1
  344. package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts +1 -1
  345. package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts.map +1 -1
  346. package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts +1 -1
  347. package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts.map +1 -1
  348. package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts +1 -1
  349. package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts.map +1 -1
  350. package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts +1 -1
  351. package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts.map +1 -1
  352. package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts +1 -1
  353. package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts.map +1 -1
  354. package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts +1 -1
  355. package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts.map +1 -1
  356. package/lib/typescript/ui/screens/karma/KarmaAboutScreen.d.ts +2 -2
  357. package/lib/typescript/ui/screens/karma/KarmaAboutScreen.d.ts.map +1 -1
  358. package/lib/typescript/ui/screens/karma/KarmaCenterScreen.d.ts +2 -2
  359. package/lib/typescript/ui/screens/karma/KarmaCenterScreen.d.ts.map +1 -1
  360. package/lib/typescript/ui/screens/karma/KarmaFAQScreen.d.ts +1 -1
  361. package/lib/typescript/ui/screens/karma/KarmaFAQScreen.d.ts.map +1 -1
  362. package/lib/typescript/ui/screens/karma/KarmaLeaderboardScreen.d.ts +2 -2
  363. package/lib/typescript/ui/screens/karma/KarmaLeaderboardScreen.d.ts.map +1 -1
  364. package/lib/typescript/ui/screens/karma/KarmaRewardsScreen.d.ts +2 -2
  365. package/lib/typescript/ui/screens/karma/KarmaRewardsScreen.d.ts.map +1 -1
  366. package/lib/typescript/ui/screens/karma/KarmaRulesScreen.d.ts +2 -2
  367. package/lib/typescript/ui/screens/karma/KarmaRulesScreen.d.ts.map +1 -1
  368. package/lib/typescript/ui/stores/assetStore.d.ts +54 -0
  369. package/lib/typescript/ui/stores/assetStore.d.ts.map +1 -0
  370. package/lib/typescript/ui/stores/fileStore.d.ts +31 -0
  371. package/lib/typescript/ui/stores/fileStore.d.ts.map +1 -0
  372. package/lib/typescript/ui/stores/followStore.d.ts +1 -1
  373. package/lib/typescript/ui/stores/followStore.d.ts.map +1 -1
  374. package/lib/typescript/ui/styles/fonts.d.ts +1 -1
  375. package/lib/typescript/ui/styles/fonts.d.ts.map +1 -1
  376. package/lib/typescript/ui/styles/theme.d.ts +1 -1
  377. package/lib/typescript/ui/styles/theme.d.ts.map +1 -1
  378. package/lib/typescript/utils/asyncUtils.d.ts.map +1 -1
  379. package/lib/typescript/utils/errorUtils.d.ts +5 -5
  380. package/lib/typescript/utils/errorUtils.d.ts.map +1 -1
  381. package/lib/typescript/utils/hookUtils.d.ts +4 -4
  382. package/lib/typescript/utils/hookUtils.d.ts.map +1 -1
  383. package/lib/typescript/utils/loggerUtils.d.ts +18 -18
  384. package/lib/typescript/utils/loggerUtils.d.ts.map +1 -1
  385. package/lib/typescript/utils/validationUtils.d.ts +6 -6
  386. package/lib/typescript/utils/validationUtils.d.ts.map +1 -1
  387. package/package.json +149 -143
  388. package/src/assets/icons/OxyServices.tsx +2 -2
  389. package/src/assets/illustrations/HighFive.tsx +1 -1
  390. package/src/core/OxyServices.ts +264 -40
  391. package/src/core/__tests__/OxyServices.test.ts +180 -0
  392. package/src/index.ts +15 -1
  393. package/src/lib/sonner-safe.ts +4 -1
  394. package/src/lib/sonner.ts +19 -2
  395. package/src/models/interfaces.ts +117 -6
  396. package/src/types/expo-vector-icons.d.ts +8 -1
  397. package/src/types/express.d.ts +22 -3
  398. package/src/ui/components/Avatar.tsx +2 -2
  399. package/src/ui/components/FollowButton.tsx +10 -8
  400. package/src/ui/components/FontLoader.tsx +5 -3
  401. package/src/ui/components/GroupedItem.tsx +12 -2
  402. package/src/ui/components/GroupedSection.tsx +3 -1
  403. package/src/ui/components/Header.tsx +1 -1
  404. package/src/ui/components/OxyLogo.tsx +2 -2
  405. package/src/ui/components/OxyPayButton.tsx +6 -5
  406. package/src/ui/components/OxyProvider.tsx +7 -4
  407. package/src/ui/components/OxySignInButton.tsx +2 -2
  408. package/src/ui/components/ProfileCard.tsx +1 -1
  409. package/src/ui/components/QuickActions.tsx +1 -1
  410. package/src/ui/components/Section.tsx +1 -1
  411. package/src/ui/components/SectionTitle.tsx +1 -1
  412. package/src/ui/components/icon/FAIRWalletIcon.tsx +1 -1
  413. package/src/ui/components/icon/OxyIcon.tsx +1 -1
  414. package/src/ui/components/internal/GroupedPillButtons.tsx +1 -1
  415. package/src/ui/components/internal/PinInput.tsx +3 -2
  416. package/src/ui/components/internal/TextField.tsx +9 -11
  417. package/src/ui/context/OxyContext.tsx +11 -3
  418. package/src/ui/hooks/useAssets.ts +306 -0
  419. package/src/ui/navigation/OxyRouter.tsx +3 -2
  420. package/src/ui/navigation/types.ts +8 -8
  421. package/src/ui/screens/AccountCenterScreen.tsx +2 -2
  422. package/src/ui/screens/AccountManagementDemo.tsx +1 -1
  423. package/src/ui/screens/AccountOverviewScreen.tsx +1 -1
  424. package/src/ui/screens/AccountSettingsScreen.tsx +3 -3
  425. package/src/ui/screens/AccountSwitcherScreen.tsx +9 -8
  426. package/src/ui/screens/AppInfoScreen.tsx +3 -2
  427. package/src/ui/screens/FeedbackScreen.tsx +1 -1
  428. package/src/ui/screens/FileManagementScreen.tsx +619 -494
  429. package/src/ui/screens/PaymentGatewayScreen.tsx +3 -2
  430. package/src/ui/screens/PremiumSubscriptionScreen.tsx +3 -2
  431. package/src/ui/screens/ProfileScreen.tsx +3 -2
  432. package/src/ui/screens/RecoverAccountScreen.tsx +3 -2
  433. package/src/ui/screens/SessionManagementScreen.tsx +4 -3
  434. package/src/ui/screens/SignInScreen.tsx +3 -2
  435. package/src/ui/screens/SignUpScreen.tsx +1 -1
  436. package/src/ui/screens/UserLinksScreen.tsx +2 -2
  437. package/src/ui/screens/internal/SignInPasswordStep.tsx +3 -2
  438. package/src/ui/screens/internal/SignInUsernameStep.tsx +3 -2
  439. package/src/ui/screens/internal/SignUpIdentityStep.tsx +3 -2
  440. package/src/ui/screens/internal/SignUpSecurityStep.tsx +3 -2
  441. package/src/ui/screens/internal/SignUpSummaryStep.tsx +1 -1
  442. package/src/ui/screens/internal/SignUpWelcomeStep.tsx +1 -1
  443. package/src/ui/screens/karma/KarmaAboutScreen.tsx +2 -2
  444. package/src/ui/screens/karma/KarmaCenterScreen.tsx +3 -2
  445. package/src/ui/screens/karma/KarmaFAQScreen.tsx +1 -1
  446. package/src/ui/screens/karma/KarmaLeaderboardScreen.tsx +3 -2
  447. package/src/ui/screens/karma/KarmaRewardsScreen.tsx +2 -2
  448. package/src/ui/screens/karma/KarmaRulesScreen.tsx +3 -2
  449. package/src/ui/stores/assetStore.ts +281 -0
  450. package/src/ui/stores/authStore.ts +1 -1
  451. package/src/ui/stores/fileStore.ts +118 -0
  452. package/src/ui/stores/followStore.ts +4 -4
  453. package/src/ui/styles/fonts.ts +1 -1
  454. package/src/ui/styles/theme.ts +1 -1
  455. package/src/utils/__tests__/validationUtils.test.ts +236 -0
  456. package/src/utils/asyncUtils.ts +4 -4
  457. package/src/utils/errorUtils.ts +35 -23
  458. package/src/utils/hookUtils.ts +7 -7
  459. package/src/utils/loggerUtils.ts +18 -18
  460. package/src/utils/validationUtils.ts +8 -8
@@ -1,5 +1,5 @@
1
1
  import { create } from 'zustand';
2
- import { OxyServices } from '../../core';
2
+ import type { OxyServices } from '../../core';
3
3
 
4
4
  interface FollowState {
5
5
  followingUsers: Record<string, boolean>;
@@ -163,16 +163,16 @@ export const useFollowStore = create<FollowState>((set: any, get: any) => ({
163
163
  set((state: FollowState) => ({
164
164
  followerCounts: {
165
165
  ...state.followerCounts,
166
- [userId]: user._count.followers || 0
166
+ [userId]: user._count?.followers || 0
167
167
  },
168
168
  followingCounts: {
169
169
  ...state.followingCounts,
170
- [userId]: user._count.following || 0
170
+ [userId]: user._count?.following || 0
171
171
  },
172
172
  loadingCounts: { ...state.loadingCounts, [userId]: false },
173
173
  }));
174
174
  }
175
- } catch (error: any) {
175
+ } catch (error: unknown) {
176
176
  set((state: FollowState) => ({
177
177
  loadingCounts: { ...state.loadingCounts, [userId]: false },
178
178
  }));
@@ -1,4 +1,4 @@
1
- import { Platform, TextStyle } from 'react-native';
1
+ import { Platform, type TextStyle } from 'react-native';
2
2
 
3
3
  /**
4
4
  * Font family names for use across the app
@@ -1,4 +1,4 @@
1
- import { Platform, StyleSheet, TextStyle } from 'react-native';
1
+ import { Platform, StyleSheet, type TextStyle } from 'react-native';
2
2
  import { fontFamilies } from './fonts';
3
3
 
4
4
  export interface ThemeColors {
@@ -0,0 +1,236 @@
1
+ import {
2
+ isRequiredString,
3
+ isRequiredNumber,
4
+ isRequiredBoolean,
5
+ isValidArray,
6
+ isValidObject,
7
+ isValidEmail,
8
+ isValidUsername,
9
+ isValidPassword,
10
+ isValidUUID,
11
+ isValidDate,
12
+ isValidFileSize,
13
+ isValidFileType,
14
+ sanitizeString,
15
+ sanitizeHTML,
16
+ validateAndSanitizeUserInput
17
+ } from '../validationUtils';
18
+
19
+ describe('Validation Utils', () => {
20
+ describe('isRequiredString', () => {
21
+ it('should return true for valid non-empty strings', () => {
22
+ expect(isRequiredString('hello')).toBe(true);
23
+ expect(isRequiredString(' hello ')).toBe(true); // trims whitespace
24
+ });
25
+
26
+ it('should return false for invalid or empty strings', () => {
27
+ expect(isRequiredString('')).toBe(false);
28
+ expect(isRequiredString(' ')).toBe(false); // only whitespace
29
+ expect(isRequiredString(null)).toBe(false);
30
+ expect(isRequiredString(undefined)).toBe(false);
31
+ expect(isRequiredString(123)).toBe(false);
32
+ });
33
+ });
34
+
35
+ describe('isRequiredNumber', () => {
36
+ it('should return true for valid numbers', () => {
37
+ expect(isRequiredNumber(123)).toBe(true);
38
+ expect(isRequiredNumber(0)).toBe(true);
39
+ expect(isRequiredNumber(-456)).toBe(true);
40
+ expect(isRequiredNumber(3.14)).toBe(true);
41
+ });
42
+
43
+ it('should return false for invalid numbers', () => {
44
+ expect(isRequiredNumber(Number.NaN)).toBe(false);
45
+ expect(isRequiredNumber('123')).toBe(false);
46
+ expect(isRequiredNumber(null)).toBe(false);
47
+ expect(isRequiredNumber(undefined)).toBe(false);
48
+ });
49
+ });
50
+
51
+ describe('isRequiredBoolean', () => {
52
+ it('should return true for boolean values', () => {
53
+ expect(isRequiredBoolean(true)).toBe(true);
54
+ expect(isRequiredBoolean(false)).toBe(true);
55
+ });
56
+
57
+ it('should return false for non-boolean values', () => {
58
+ expect(isRequiredBoolean('true')).toBe(false);
59
+ expect(isRequiredBoolean(1)).toBe(false);
60
+ expect(isRequiredBoolean(0)).toBe(false);
61
+ expect(isRequiredBoolean(null)).toBe(false);
62
+ expect(isRequiredBoolean(undefined)).toBe(false);
63
+ });
64
+ });
65
+
66
+ describe('isValidArray', () => {
67
+ it('should return true for arrays', () => {
68
+ expect(isValidArray([])).toBe(true);
69
+ expect(isValidArray([1, 2, 3])).toBe(true);
70
+ expect(isValidArray(['a', 'b'])).toBe(true);
71
+ });
72
+
73
+ it('should return false for non-arrays', () => {
74
+ expect(isValidArray({})).toBe(false);
75
+ expect(isValidArray('[]')).toBe(false);
76
+ expect(isValidArray(null)).toBe(false);
77
+ expect(isValidArray(undefined)).toBe(false);
78
+ });
79
+ });
80
+
81
+ describe('isValidObject', () => {
82
+ it('should return true for plain objects', () => {
83
+ expect(isValidObject({})).toBe(true);
84
+ expect(isValidObject({ key: 'value' })).toBe(true);
85
+ });
86
+
87
+ it('should return false for non-objects', () => {
88
+ expect(isValidObject([])).toBe(false);
89
+ expect(isValidObject(null)).toBe(false);
90
+ expect(isValidObject(undefined)).toBe(false);
91
+ expect(isValidObject('object')).toBe(false);
92
+ expect(isValidObject(123)).toBe(false);
93
+ });
94
+ });
95
+
96
+ describe('isValidEmail', () => {
97
+ it('should return true for valid email addresses', () => {
98
+ expect(isValidEmail('test@example.com')).toBe(true);
99
+ expect(isValidEmail('user.name+tag@domain.co.uk')).toBe(true);
100
+ expect(isValidEmail('simple@test.io')).toBe(true);
101
+ });
102
+
103
+ it('should return false for invalid email addresses', () => {
104
+ expect(isValidEmail('invalid-email')).toBe(false);
105
+ expect(isValidEmail('test@')).toBe(false);
106
+ expect(isValidEmail('@domain.com')).toBe(false);
107
+ expect(isValidEmail('test.domain.com')).toBe(false);
108
+ expect(isValidEmail('')).toBe(false);
109
+ });
110
+ });
111
+
112
+ describe('isValidUsername', () => {
113
+ it('should return true for valid usernames', () => {
114
+ expect(isValidUsername('user123')).toBe(true);
115
+ expect(isValidUsername('test_user')).toBe(true);
116
+ expect(isValidUsername('john-doe')).toBe(true);
117
+ });
118
+
119
+ it('should return false for invalid usernames', () => {
120
+ expect(isValidUsername('')).toBe(false);
121
+ expect(isValidUsername('a')).toBe(false); // too short
122
+ expect(isValidUsername('ab')).toBe(false); // too short
123
+ expect(isValidUsername('user@domain')).toBe(false); // invalid characters
124
+ expect(isValidUsername('user with spaces')).toBe(false); // spaces
125
+ });
126
+ });
127
+
128
+ describe('isValidPassword', () => {
129
+ it('should return true for valid passwords', () => {
130
+ expect(isValidPassword('password123')).toBe(true);
131
+ expect(isValidPassword('mySecurePass')).toBe(true);
132
+ expect(isValidPassword('12345678')).toBe(true);
133
+ });
134
+
135
+ it('should return false for invalid passwords', () => {
136
+ expect(isValidPassword('')).toBe(false);
137
+ expect(isValidPassword('short')).toBe(false); // too short
138
+ expect(isValidPassword('1234567')).toBe(false); // too short
139
+ });
140
+ });
141
+
142
+ describe('isValidUUID', () => {
143
+ it('should return true for valid UUIDs', () => {
144
+ expect(isValidUUID('123e4567-e89b-12d3-a456-426614174000')).toBe(true);
145
+ expect(isValidUUID('550e8400-e29b-41d4-a716-446655440000')).toBe(true);
146
+ });
147
+
148
+ it('should return false for invalid UUIDs', () => {
149
+ expect(isValidUUID('invalid-uuid')).toBe(false);
150
+ expect(isValidUUID('123-456-789')).toBe(false);
151
+ expect(isValidUUID('')).toBe(false);
152
+ });
153
+ });
154
+
155
+ describe('isValidDate', () => {
156
+ it('should return true for valid date strings', () => {
157
+ expect(isValidDate('2024-01-01')).toBe(true);
158
+ expect(isValidDate('2024-12-31T23:59:59.999Z')).toBe(true);
159
+ expect(isValidDate('January 1, 2024')).toBe(true);
160
+ });
161
+
162
+ it('should return false for invalid date strings', () => {
163
+ expect(isValidDate('invalid-date')).toBe(false);
164
+ expect(isValidDate('2024-13-01')).toBe(false); // invalid month
165
+ expect(isValidDate('')).toBe(false);
166
+ });
167
+ });
168
+
169
+ describe('isValidFileSize', () => {
170
+ const maxSize = 1024 * 1024; // 1MB
171
+
172
+ it('should return true for valid file sizes', () => {
173
+ expect(isValidFileSize(1024, maxSize)).toBe(true);
174
+ expect(isValidFileSize(maxSize, maxSize)).toBe(true);
175
+ expect(isValidFileSize(1, maxSize)).toBe(true);
176
+ });
177
+
178
+ it('should return false for invalid file sizes', () => {
179
+ expect(isValidFileSize(0, maxSize)).toBe(false);
180
+ expect(isValidFileSize(-1, maxSize)).toBe(false);
181
+ expect(isValidFileSize(maxSize + 1, maxSize)).toBe(false);
182
+ });
183
+ });
184
+
185
+ describe('isValidFileType', () => {
186
+ const allowedTypes = ['jpg', 'png', 'gif', 'pdf'];
187
+
188
+ it('should return true for allowed file types', () => {
189
+ expect(isValidFileType('image.jpg', allowedTypes)).toBe(true);
190
+ expect(isValidFileType('document.PDF', allowedTypes)).toBe(true); // case insensitive
191
+ expect(isValidFileType('photo.png', allowedTypes)).toBe(true);
192
+ });
193
+
194
+ it('should return false for disallowed file types', () => {
195
+ expect(isValidFileType('script.js', allowedTypes)).toBe(false);
196
+ expect(isValidFileType('data.txt', allowedTypes)).toBe(false);
197
+ expect(isValidFileType('noextension', allowedTypes)).toBe(false);
198
+ });
199
+ });
200
+
201
+ describe('sanitizeString', () => {
202
+ it('should trim whitespace and remove dangerous characters', () => {
203
+ expect(sanitizeString(' hello ')).toBe('hello');
204
+ expect(sanitizeString('hello<script>alert("xss")</script>world')).toBe('helloalert("xss")world');
205
+ expect(sanitizeString('normal text')).toBe('normal text');
206
+ });
207
+ });
208
+
209
+ describe('sanitizeHTML', () => {
210
+ it('should escape HTML characters', () => {
211
+ expect(sanitizeHTML('<script>alert("xss")</script>')).toBe('&lt;script&gt;alert(&quot;xss&quot;)&lt;/script&gt;');
212
+ expect(sanitizeHTML('Hello & Goodbye')).toBe('Hello &amp; Goodbye');
213
+ expect(sanitizeHTML("It's a test")).toBe('It&#x27;s a test');
214
+ });
215
+ });
216
+
217
+ describe('validateAndSanitizeUserInput', () => {
218
+ it('should validate and sanitize email input', () => {
219
+ expect(validateAndSanitizeUserInput(' test@example.com ', 'email')).toBe('test@example.com');
220
+ expect(validateAndSanitizeUserInput('invalid-email', 'email')).toBeNull();
221
+ expect(validateAndSanitizeUserInput(123, 'email')).toBeNull();
222
+ });
223
+
224
+ it('should validate and sanitize username input', () => {
225
+ expect(validateAndSanitizeUserInput(' testuser ', 'username')).toBe('testuser');
226
+ expect(validateAndSanitizeUserInput('ab', 'username')).toBeNull(); // too short
227
+ expect(validateAndSanitizeUserInput(123, 'username')).toBeNull();
228
+ });
229
+
230
+ it('should validate and sanitize string input', () => {
231
+ expect(validateAndSanitizeUserInput(' hello world ', 'string')).toBe('hello world');
232
+ expect(validateAndSanitizeUserInput('', 'string')).toBeNull();
233
+ expect(validateAndSanitizeUserInput(123, 'string')).toBeNull();
234
+ });
235
+ });
236
+ });
@@ -45,8 +45,8 @@ export async function parallelWithErrorHandling<T>(
45
45
  */
46
46
  export async function retryAsync<T>(
47
47
  operation: () => Promise<T>,
48
- maxRetries: number = 3,
49
- baseDelay: number = 1000,
48
+ maxRetries = 3,
49
+ baseDelay = 1000,
50
50
  shouldRetry?: (error: any) => boolean
51
51
  ): Promise<T> {
52
52
  let lastError: any;
@@ -81,7 +81,7 @@ export function debounceAsync<T extends (...args: any[]) => Promise<any>>(
81
81
  delay: number
82
82
  ): (...args: Parameters<T>) => Promise<ReturnType<T>> {
83
83
  let timeoutId: NodeJS.Timeout;
84
- let lastPromise: Promise<ReturnType<T>> | null = null;
84
+ const lastPromise: Promise<ReturnType<T>> | null = null;
85
85
 
86
86
  return (...args: Parameters<T>): Promise<ReturnType<T>> => {
87
87
  return new Promise((resolve, reject) => {
@@ -256,7 +256,7 @@ export const delay = (ms: number): Promise<void> =>
256
256
  export async function retryOnError<T>(
257
257
  operation: () => Promise<T>,
258
258
  retryableErrors: (string | number)[],
259
- maxRetries: number = 3
259
+ maxRetries = 3
260
260
  ): Promise<T> {
261
261
  return retryAsync(operation, maxRetries, 1000, (error) => {
262
262
  const errorCode = error?.code || error?.status || error?.message;
@@ -1,4 +1,4 @@
1
- import { ApiError } from '../models/interfaces';
1
+ import type { ApiError } from '../models/interfaces';
2
2
 
3
3
  /**
4
4
  * Error handling utilities for consistent error processing
@@ -40,8 +40,8 @@ export const ErrorCodes = {
40
40
  export function createApiError(
41
41
  message: string,
42
42
  code: string = ErrorCodes.INTERNAL_ERROR,
43
- status: number = 500,
44
- details?: any
43
+ status = 500,
44
+ details?: Record<string, unknown>
45
45
  ): ApiError {
46
46
  return {
47
47
  message,
@@ -54,26 +54,29 @@ export function createApiError(
54
54
  /**
55
55
  * Handle common HTTP errors and convert to ApiError
56
56
  */
57
- export function handleHttpError(error: any): ApiError {
57
+ export function handleHttpError(error: unknown): ApiError {
58
58
  // If it's already an ApiError, return it
59
59
  if (error && typeof error === 'object' && 'code' in error && 'status' in error) {
60
60
  return error as ApiError;
61
61
  }
62
62
 
63
- // Handle axios errors
64
- if (error?.response) {
65
- const { status, data } = error.response;
66
-
67
- return createApiError(
68
- data?.message || `HTTP ${status} error`,
69
- data?.code || getErrorCodeFromStatus(status),
70
- status,
71
- data
72
- );
63
+ // Handle axios errors - check if it looks like an axios error
64
+ if (error && typeof error === 'object' && 'response' in error) {
65
+ const axiosError = error as { response?: { status: number; data?: { message?: string; code?: string } } };
66
+ if (axiosError.response) {
67
+ const { status, data } = axiosError.response;
68
+
69
+ return createApiError(
70
+ data?.message || `HTTP ${status} error`,
71
+ data?.code || getErrorCodeFromStatus(status),
72
+ status,
73
+ data
74
+ );
75
+ }
73
76
  }
74
77
 
75
- // Handle network errors
76
- if (error?.request) {
78
+ // Handle network errors - check if it looks like a network error
79
+ if (error && typeof error === 'object' && 'request' in error) {
77
80
  return createApiError(
78
81
  'Network error - no response received',
79
82
  ErrorCodes.NETWORK_ERROR,
@@ -81,9 +84,18 @@ export function handleHttpError(error: any): ApiError {
81
84
  );
82
85
  }
83
86
 
87
+ // Handle standard errors
88
+ if (error instanceof Error) {
89
+ return createApiError(
90
+ error.message || 'Unknown error occurred',
91
+ ErrorCodes.INTERNAL_ERROR,
92
+ 500
93
+ );
94
+ }
95
+
84
96
  // Handle other errors
85
97
  return createApiError(
86
- error?.message || 'Unknown error occurred',
98
+ String(error) || 'Unknown error occurred',
87
99
  ErrorCodes.INTERNAL_ERROR,
88
100
  500
89
101
  );
@@ -118,7 +130,7 @@ function getErrorCodeFromStatus(status: number): string {
118
130
  /**
119
131
  * Validate required fields and throw error if missing
120
132
  */
121
- export function validateRequiredFields(data: Record<string, any>, fields: string[]): void {
133
+ export function validateRequiredFields(data: Record<string, unknown>, fields: string[]): void {
122
134
  const missing = fields.filter(field => !data[field]);
123
135
 
124
136
  if (missing.length > 0) {
@@ -133,7 +145,7 @@ export function validateRequiredFields(data: Record<string, any>, fields: string
133
145
  /**
134
146
  * Safe error logging with context
135
147
  */
136
- export function logError(error: any, context?: string): void {
148
+ export function logError(error: unknown, context?: string): void {
137
149
  const prefix = context ? `[${context}]` : '[Error]';
138
150
 
139
151
  if (error instanceof Error) {
@@ -148,10 +160,10 @@ export function logError(error: any, context?: string): void {
148
160
  */
149
161
  export async function retryWithBackoff<T>(
150
162
  fn: () => Promise<T>,
151
- maxRetries: number = 3,
152
- baseDelay: number = 1000
163
+ maxRetries = 3,
164
+ baseDelay = 1000
153
165
  ): Promise<T> {
154
- let lastError: any;
166
+ let lastError: unknown;
155
167
 
156
168
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
157
169
  try {
@@ -163,7 +175,7 @@ export async function retryWithBackoff<T>(
163
175
  break;
164
176
  }
165
177
 
166
- const delay = baseDelay * Math.pow(2, attempt);
178
+ const delay = baseDelay * 2 ** attempt;
167
179
  await new Promise(resolve => setTimeout(resolve, delay));
168
180
  }
169
181
  }
@@ -9,7 +9,7 @@ import { useState, useEffect, useCallback, useRef, useMemo } from 'react';
9
9
  */
10
10
  export function useAsync<T>(
11
11
  asyncFn: () => Promise<T>,
12
- deps: any[] = []
12
+ deps: React.DependencyList = []
13
13
  ) {
14
14
  const [data, setData] = useState<T | null>(null);
15
15
  const [loading, setLoading] = useState(false);
@@ -40,7 +40,7 @@ export function useAsync<T>(
40
40
  */
41
41
  export function useAsyncEffect<T>(
42
42
  asyncFn: () => Promise<T>,
43
- deps: any[] = []
43
+ deps: React.DependencyList = []
44
44
  ) {
45
45
  const [data, setData] = useState<T | null>(null);
46
46
  const [loading, setLoading] = useState(true);
@@ -121,7 +121,7 @@ export function useThrottle<T>(value: T, delay: number): T {
121
121
  * Hook for previous value
122
122
  */
123
123
  export function usePrevious<T>(value: T): T | undefined {
124
- const ref = useRef<T>();
124
+ const ref = useRef<T | undefined>(undefined);
125
125
 
126
126
  useEffect(() => {
127
127
  ref.current = value;
@@ -133,7 +133,7 @@ export function usePrevious<T>(value: T): T | undefined {
133
133
  /**
134
134
  * Hook for boolean state with toggle
135
135
  */
136
- export function useToggle(initialValue: boolean = false) {
136
+ export function useToggle(initialValue = false) {
137
137
  const [value, setValue] = useState(initialValue);
138
138
 
139
139
  const toggle = useCallback(() => setValue(v => !v), []);
@@ -146,7 +146,7 @@ export function useToggle(initialValue: boolean = false) {
146
146
  /**
147
147
  * Hook for counter state
148
148
  */
149
- export function useCounter(initialValue: number = 0) {
149
+ export function useCounter(initialValue = 0) {
150
150
  const [count, setCount] = useState(initialValue);
151
151
 
152
152
  const increment = useCallback(() => setCount(c => c + 1), []);
@@ -352,7 +352,7 @@ export function useClickOutside(ref: React.RefObject<HTMLElement>, handler: () =
352
352
  /**
353
353
  * Hook for form validation
354
354
  */
355
- export function useFormValidation<T extends Record<string, any>>(
355
+ export function useFormValidation<T extends Record<string, unknown>>(
356
356
  initialValues: T,
357
357
  validationSchema: (values: T) => Partial<Record<keyof T, string>>
358
358
  ) {
@@ -364,7 +364,7 @@ export function useFormValidation<T extends Record<string, any>>(
364
364
  return validationSchema(valuesToValidate);
365
365
  }, [validationSchema]);
366
366
 
367
- const setValue = useCallback((field: keyof T, value: any) => {
367
+ const setValue = useCallback((field: keyof T, value: T[keyof T]) => {
368
368
  setValues(prev => ({ ...prev, [field]: value }));
369
369
  if (touched[field]) {
370
370
  const newErrors = validate({ ...values, [field]: value });
@@ -16,7 +16,7 @@ export interface LogContext {
16
16
  userId?: string;
17
17
  sessionId?: string;
18
18
  requestId?: string;
19
- [key: string]: any;
19
+ [key: string]: unknown;
20
20
  }
21
21
 
22
22
  class Logger {
@@ -37,7 +37,7 @@ class Logger {
37
37
  return `[${timestamp}] ${level}${contextStr}: ${message}`;
38
38
  }
39
39
 
40
- debug(message: string, context?: LogContext, ...args: any[]): void {
40
+ debug(message: string, context?: LogContext, ...args: unknown[]): void {
41
41
  if (this.shouldLog(LogLevel.DEBUG)) {
42
42
  const formattedMessage = this.formatMessage('DEBUG', message, context);
43
43
  if (this.isDevelopment) {
@@ -46,21 +46,21 @@ class Logger {
46
46
  }
47
47
  }
48
48
 
49
- info(message: string, context?: LogContext, ...args: any[]): void {
49
+ info(message: string, context?: LogContext, ...args: unknown[]): void {
50
50
  if (this.shouldLog(LogLevel.INFO)) {
51
51
  const formattedMessage = this.formatMessage('INFO', message, context);
52
52
  console.log(formattedMessage, ...args);
53
53
  }
54
54
  }
55
55
 
56
- warn(message: string, context?: LogContext, ...args: any[]): void {
56
+ warn(message: string, context?: LogContext, ...args: unknown[]): void {
57
57
  if (this.shouldLog(LogLevel.WARN)) {
58
58
  const formattedMessage = this.formatMessage('WARN', message, context);
59
59
  console.warn(formattedMessage, ...args);
60
60
  }
61
61
  }
62
62
 
63
- error(message: string, error?: any, context?: LogContext, ...args: any[]): void {
63
+ error(message: string, error?: Error | unknown, context?: LogContext, ...args: unknown[]): void {
64
64
  if (this.shouldLog(LogLevel.ERROR)) {
65
65
  const formattedMessage = this.formatMessage('ERROR', message, context);
66
66
  if (error) {
@@ -72,27 +72,27 @@ class Logger {
72
72
  }
73
73
 
74
74
  // Specialized logging methods for common patterns
75
- auth(message: string, context?: LogContext, ...args: any[]): void {
75
+ auth(message: string, context?: LogContext, ...args: unknown[]): void {
76
76
  this.info(`🔐 ${message}`, { ...context, category: 'auth' }, ...args);
77
77
  }
78
78
 
79
- api(message: string, context?: LogContext, ...args: any[]): void {
79
+ api(message: string, context?: LogContext, ...args: unknown[]): void {
80
80
  this.info(`🌐 ${message}`, { ...context, category: 'api' }, ...args);
81
81
  }
82
82
 
83
- session(message: string, context?: LogContext, ...args: any[]): void {
83
+ session(message: string, context?: LogContext, ...args: unknown[]): void {
84
84
  this.info(`📱 ${message}`, { ...context, category: 'session' }, ...args);
85
85
  }
86
86
 
87
- user(message: string, context?: LogContext, ...args: any[]): void {
87
+ user(message: string, context?: LogContext, ...args: unknown[]): void {
88
88
  this.info(`👤 ${message}`, { ...context, category: 'user' }, ...args);
89
89
  }
90
90
 
91
- device(message: string, context?: LogContext, ...args: any[]): void {
91
+ device(message: string, context?: LogContext, ...args: unknown[]): void {
92
92
  this.info(`📱 ${message}`, { ...context, category: 'device' }, ...args);
93
93
  }
94
94
 
95
- payment(message: string, context?: LogContext, ...args: any[]): void {
95
+ payment(message: string, context?: LogContext, ...args: unknown[]): void {
96
96
  this.info(`💳 ${message}`, { ...context, category: 'payment' }, ...args);
97
97
  }
98
98
 
@@ -128,25 +128,25 @@ class Logger {
128
128
  export const logger = new Logger();
129
129
 
130
130
  // Convenience functions for common logging patterns
131
- export const logAuth = (message: string, context?: LogContext, ...args: any[]) =>
131
+ export const logAuth = (message: string, context?: LogContext, ...args: unknown[]) =>
132
132
  logger.auth(message, context, ...args);
133
133
 
134
- export const logApi = (message: string, context?: LogContext, ...args: any[]) =>
134
+ export const logApi = (message: string, context?: LogContext, ...args: unknown[]) =>
135
135
  logger.api(message, context, ...args);
136
136
 
137
- export const logSession = (message: string, context?: LogContext, ...args: any[]) =>
137
+ export const logSession = (message: string, context?: LogContext, ...args: unknown[]) =>
138
138
  logger.session(message, context, ...args);
139
139
 
140
- export const logUser = (message: string, context?: LogContext, ...args: any[]) =>
140
+ export const logUser = (message: string, context?: LogContext, ...args: unknown[]) =>
141
141
  logger.user(message, context, ...args);
142
142
 
143
- export const logDevice = (message: string, context?: LogContext, ...args: any[]) =>
143
+ export const logDevice = (message: string, context?: LogContext, ...args: unknown[]) =>
144
144
  logger.device(message, context, ...args);
145
145
 
146
- export const logPayment = (message: string, context?: LogContext, ...args: any[]) =>
146
+ export const logPayment = (message: string, context?: LogContext, ...args: unknown[]) =>
147
147
  logger.payment(message, context, ...args);
148
148
 
149
- export const logError = (message: string, error?: any, context?: LogContext, ...args: any[]) =>
149
+ export const logError = (message: string, error?: Error | unknown, context?: LogContext, ...args: unknown[]) =>
150
150
  logger.error(message, error, context, ...args);
151
151
 
152
152
  export const logPerformance = (operation: string, duration: number, context?: LogContext) =>
@@ -41,35 +41,35 @@ export function isValidPassword(password: string): boolean {
41
41
  /**
42
42
  * Validate required string
43
43
  */
44
- export function isRequiredString(value: any): boolean {
44
+ export function isRequiredString(value: unknown): boolean {
45
45
  return typeof value === 'string' && value.trim().length > 0;
46
46
  }
47
47
 
48
48
  /**
49
49
  * Validate required number
50
50
  */
51
- export function isRequiredNumber(value: any): boolean {
52
- return typeof value === 'number' && !isNaN(value);
51
+ export function isRequiredNumber(value: unknown): boolean {
52
+ return typeof value === 'number' && !Number.isNaN(value);
53
53
  }
54
54
 
55
55
  /**
56
56
  * Validate required boolean
57
57
  */
58
- export function isRequiredBoolean(value: any): boolean {
58
+ export function isRequiredBoolean(value: unknown): boolean {
59
59
  return typeof value === 'boolean';
60
60
  }
61
61
 
62
62
  /**
63
63
  * Validate array
64
64
  */
65
- export function isValidArray(value: any): boolean {
65
+ export function isValidArray(value: unknown): boolean {
66
66
  return Array.isArray(value);
67
67
  }
68
68
 
69
69
  /**
70
70
  * Validate object
71
71
  */
72
- export function isValidObject(value: any): boolean {
72
+ export function isValidObject(value: unknown): boolean {
73
73
  return typeof value === 'object' && value !== null && !Array.isArray(value);
74
74
  }
75
75
 
@@ -98,7 +98,7 @@ export function isValidURL(url: string): boolean {
98
98
  */
99
99
  export function isValidDate(dateString: string): boolean {
100
100
  const date = new Date(dateString);
101
- return !isNaN(date.getTime());
101
+ return !Number.isNaN(date.getTime());
102
102
  }
103
103
 
104
104
  /**
@@ -138,7 +138,7 @@ export function sanitizeHTML(input: string): string {
138
138
  /**
139
139
  * Validate and sanitize user input
140
140
  */
141
- export function validateAndSanitizeUserInput(input: any, type: 'string' | 'email' | 'username'): string | null {
141
+ export function validateAndSanitizeUserInput(input: unknown, type: 'string' | 'email' | 'username'): string | null {
142
142
  if (typeof input !== 'string') {
143
143
  return null;
144
144
  }