@oxyhq/services 5.10.15 → 5.11.1

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 (471) hide show
  1. package/README.md +604 -127
  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 +244 -26
  9. package/lib/commonjs/core/OxyServices.js.map +1 -1
  10. package/lib/commonjs/core/index.js +7 -0
  11. package/lib/commonjs/core/index.js.map +1 -1
  12. package/lib/commonjs/index.js +93 -0
  13. package/lib/commonjs/index.js.map +1 -1
  14. package/lib/commonjs/lib/sonner-safe.js +2 -0
  15. package/lib/commonjs/lib/sonner-safe.js.map +1 -1
  16. package/lib/commonjs/lib/sonner.js +2 -0
  17. package/lib/commonjs/lib/sonner.js.map +1 -1
  18. package/lib/commonjs/node/index.js +7 -0
  19. package/lib/commonjs/node/index.js.map +1 -1
  20. package/lib/commonjs/ui/components/Avatar.js +0 -2
  21. package/lib/commonjs/ui/components/Avatar.js.map +1 -1
  22. package/lib/commonjs/ui/components/FollowButton.js +4 -4
  23. package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
  24. package/lib/commonjs/ui/components/FontLoader.js +3 -2
  25. package/lib/commonjs/ui/components/FontLoader.js.map +1 -1
  26. package/lib/commonjs/ui/components/GroupedItem.js +7 -4
  27. package/lib/commonjs/ui/components/GroupedItem.js.map +1 -1
  28. package/lib/commonjs/ui/components/GroupedSection.js +1 -1
  29. package/lib/commonjs/ui/components/GroupedSection.js.map +1 -1
  30. package/lib/commonjs/ui/components/Header.js +0 -1
  31. package/lib/commonjs/ui/components/Header.js.map +1 -1
  32. package/lib/commonjs/ui/components/OxyLogo.js +0 -2
  33. package/lib/commonjs/ui/components/OxyLogo.js.map +1 -1
  34. package/lib/commonjs/ui/components/OxyPayButton.js +4 -5
  35. package/lib/commonjs/ui/components/OxyPayButton.js.map +1 -1
  36. package/lib/commonjs/ui/components/OxyProvider.js +4 -3
  37. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  38. package/lib/commonjs/ui/components/OxySignInButton.js +0 -1
  39. package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
  40. package/lib/commonjs/ui/components/ProfileCard.js +0 -1
  41. package/lib/commonjs/ui/components/ProfileCard.js.map +1 -1
  42. package/lib/commonjs/ui/components/QuickActions.js +0 -2
  43. package/lib/commonjs/ui/components/QuickActions.js.map +1 -1
  44. package/lib/commonjs/ui/components/Section.js +0 -1
  45. package/lib/commonjs/ui/components/Section.js.map +1 -1
  46. package/lib/commonjs/ui/components/SectionTitle.js +0 -2
  47. package/lib/commonjs/ui/components/SectionTitle.js.map +1 -1
  48. package/lib/commonjs/ui/components/icon/FAIRWalletIcon.js +0 -2
  49. package/lib/commonjs/ui/components/icon/FAIRWalletIcon.js.map +1 -1
  50. package/lib/commonjs/ui/components/icon/OxyIcon.js +0 -2
  51. package/lib/commonjs/ui/components/icon/OxyIcon.js.map +1 -1
  52. package/lib/commonjs/ui/components/internal/GroupedPillButtons.js +0 -2
  53. package/lib/commonjs/ui/components/internal/GroupedPillButtons.js.map +1 -1
  54. package/lib/commonjs/ui/components/internal/PinInput.js +4 -3
  55. package/lib/commonjs/ui/components/internal/PinInput.js.map +1 -1
  56. package/lib/commonjs/ui/components/internal/TextField.js +3 -3
  57. package/lib/commonjs/ui/components/internal/TextField.js.map +1 -1
  58. package/lib/commonjs/ui/hooks/useAssets.js +263 -0
  59. package/lib/commonjs/ui/hooks/useAssets.js.map +1 -0
  60. package/lib/commonjs/ui/navigation/OxyRouter.js +1 -2
  61. package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -1
  62. package/lib/commonjs/ui/screens/AccountCenterScreen.js +0 -2
  63. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
  64. package/lib/commonjs/ui/screens/AccountManagementDemo.js +0 -1
  65. package/lib/commonjs/ui/screens/AccountManagementDemo.js.map +1 -1
  66. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +2 -2
  67. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  68. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +5 -6
  69. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
  70. package/lib/commonjs/ui/screens/AppInfoScreen.js +1 -2
  71. package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
  72. package/lib/commonjs/ui/screens/FileManagementScreen.js +631 -430
  73. package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
  74. package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +2 -2
  75. package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -1
  76. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +1 -2
  77. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  78. package/lib/commonjs/ui/screens/ProfileScreen.js +1 -2
  79. package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
  80. package/lib/commonjs/ui/screens/RecoverAccountScreen.js +1 -2
  81. package/lib/commonjs/ui/screens/RecoverAccountScreen.js.map +1 -1
  82. package/lib/commonjs/ui/screens/SessionManagementScreen.js +1 -2
  83. package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
  84. package/lib/commonjs/ui/screens/SignInScreen.js +1 -2
  85. package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
  86. package/lib/commonjs/ui/screens/UserLinksScreen.js +0 -2
  87. package/lib/commonjs/ui/screens/UserLinksScreen.js.map +1 -1
  88. package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js +1 -2
  89. package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js.map +1 -1
  90. package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js +1 -2
  91. package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js.map +1 -1
  92. package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js +1 -2
  93. package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js.map +1 -1
  94. package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js +1 -2
  95. package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js.map +1 -1
  96. package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js +0 -1
  97. package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js.map +1 -1
  98. package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js +0 -1
  99. package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js.map +1 -1
  100. package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js +0 -2
  101. package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js.map +1 -1
  102. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +1 -2
  103. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
  104. package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js +1 -2
  105. package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
  106. package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js +0 -2
  107. package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
  108. package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js +1 -2
  109. package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
  110. package/lib/commonjs/ui/stores/assetStore.js +225 -0
  111. package/lib/commonjs/ui/stores/assetStore.js.map +1 -0
  112. package/lib/commonjs/ui/stores/authStore.js +1 -1
  113. package/lib/commonjs/ui/stores/authStore.js.map +1 -1
  114. package/lib/commonjs/ui/stores/fileStore.js +153 -0
  115. package/lib/commonjs/ui/stores/fileStore.js.map +1 -0
  116. package/lib/commonjs/ui/stores/followStore.js +2 -2
  117. package/lib/commonjs/ui/stores/followStore.js.map +1 -1
  118. package/lib/commonjs/utils/asyncUtils.js +1 -1
  119. package/lib/commonjs/utils/asyncUtils.js.map +1 -1
  120. package/lib/commonjs/utils/errorUtils.js +19 -11
  121. package/lib/commonjs/utils/errorUtils.js.map +1 -1
  122. package/lib/commonjs/utils/hookUtils.js +1 -1
  123. package/lib/commonjs/utils/hookUtils.js.map +1 -1
  124. package/lib/commonjs/utils/loggerUtils.js.map +1 -1
  125. package/lib/commonjs/utils/validationUtils.js +2 -2
  126. package/lib/commonjs/utils/validationUtils.js.map +1 -1
  127. package/lib/module/assets/assets/icons/OxyServices.tsx +2 -2
  128. package/lib/module/assets/assets/illustrations/HighFive.tsx +1 -1
  129. package/lib/module/assets/icons/OxyServices.js +0 -1
  130. package/lib/module/assets/icons/OxyServices.js.map +1 -1
  131. package/lib/module/assets/illustrations/HighFive.js +0 -1
  132. package/lib/module/assets/illustrations/HighFive.js.map +1 -1
  133. package/lib/module/core/OxyServices.js +243 -25
  134. package/lib/module/core/OxyServices.js.map +1 -1
  135. package/lib/module/core/index.js +1 -1
  136. package/lib/module/core/index.js.map +1 -1
  137. package/lib/module/index.js +3 -1
  138. package/lib/module/index.js.map +1 -1
  139. package/lib/module/lib/sonner-safe.js +2 -0
  140. package/lib/module/lib/sonner-safe.js.map +1 -1
  141. package/lib/module/lib/sonner.js +3 -0
  142. package/lib/module/lib/sonner.js.map +1 -1
  143. package/lib/module/node/index.js +2 -2
  144. package/lib/module/node/index.js.map +1 -1
  145. package/lib/module/ui/components/Avatar.js +0 -1
  146. package/lib/module/ui/components/Avatar.js.map +1 -1
  147. package/lib/module/ui/components/FollowButton.js +4 -3
  148. package/lib/module/ui/components/FollowButton.js.map +1 -1
  149. package/lib/module/ui/components/FontLoader.js +3 -2
  150. package/lib/module/ui/components/FontLoader.js.map +1 -1
  151. package/lib/module/ui/components/GroupedItem.js +7 -3
  152. package/lib/module/ui/components/GroupedItem.js.map +1 -1
  153. package/lib/module/ui/components/GroupedSection.js +1 -1
  154. package/lib/module/ui/components/GroupedSection.js.map +1 -1
  155. package/lib/module/ui/components/Header.js +0 -1
  156. package/lib/module/ui/components/Header.js.map +1 -1
  157. package/lib/module/ui/components/OxyLogo.js +0 -1
  158. package/lib/module/ui/components/OxyLogo.js.map +1 -1
  159. package/lib/module/ui/components/OxyPayButton.js +4 -4
  160. package/lib/module/ui/components/OxyPayButton.js.map +1 -1
  161. package/lib/module/ui/components/OxyProvider.js +4 -2
  162. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  163. package/lib/module/ui/components/OxySignInButton.js +0 -1
  164. package/lib/module/ui/components/OxySignInButton.js.map +1 -1
  165. package/lib/module/ui/components/ProfileCard.js +0 -1
  166. package/lib/module/ui/components/ProfileCard.js.map +1 -1
  167. package/lib/module/ui/components/QuickActions.js +0 -1
  168. package/lib/module/ui/components/QuickActions.js.map +1 -1
  169. package/lib/module/ui/components/Section.js +0 -1
  170. package/lib/module/ui/components/Section.js.map +1 -1
  171. package/lib/module/ui/components/SectionTitle.js +0 -1
  172. package/lib/module/ui/components/SectionTitle.js.map +1 -1
  173. package/lib/module/ui/components/icon/FAIRWalletIcon.js +0 -1
  174. package/lib/module/ui/components/icon/FAIRWalletIcon.js.map +1 -1
  175. package/lib/module/ui/components/icon/OxyIcon.js +0 -1
  176. package/lib/module/ui/components/icon/OxyIcon.js.map +1 -1
  177. package/lib/module/ui/components/internal/GroupedPillButtons.js +0 -1
  178. package/lib/module/ui/components/internal/GroupedPillButtons.js.map +1 -1
  179. package/lib/module/ui/components/internal/PinInput.js +4 -2
  180. package/lib/module/ui/components/internal/PinInput.js.map +1 -1
  181. package/lib/module/ui/components/internal/TextField.js +3 -3
  182. package/lib/module/ui/components/internal/TextField.js.map +1 -1
  183. package/lib/module/ui/context/OxyContext.js.map +1 -1
  184. package/lib/module/ui/hooks/useAssets.js +257 -0
  185. package/lib/module/ui/hooks/useAssets.js.map +1 -0
  186. package/lib/module/ui/navigation/OxyRouter.js +1 -1
  187. package/lib/module/ui/navigation/OxyRouter.js.map +1 -1
  188. package/lib/module/ui/screens/AccountCenterScreen.js +0 -1
  189. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
  190. package/lib/module/ui/screens/AccountManagementDemo.js +0 -1
  191. package/lib/module/ui/screens/AccountManagementDemo.js.map +1 -1
  192. package/lib/module/ui/screens/AccountSettingsScreen.js +2 -2
  193. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  194. package/lib/module/ui/screens/AccountSwitcherScreen.js +5 -5
  195. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  196. package/lib/module/ui/screens/AppInfoScreen.js +1 -1
  197. package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
  198. package/lib/module/ui/screens/FileManagementScreen.js +633 -432
  199. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  200. package/lib/module/ui/screens/PaymentGatewayScreen.js +1 -1
  201. package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -1
  202. package/lib/module/ui/screens/PremiumSubscriptionScreen.js +1 -1
  203. package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  204. package/lib/module/ui/screens/ProfileScreen.js +1 -1
  205. package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
  206. package/lib/module/ui/screens/RecoverAccountScreen.js +1 -1
  207. package/lib/module/ui/screens/RecoverAccountScreen.js.map +1 -1
  208. package/lib/module/ui/screens/SessionManagementScreen.js +1 -1
  209. package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
  210. package/lib/module/ui/screens/SignInScreen.js +1 -1
  211. package/lib/module/ui/screens/SignInScreen.js.map +1 -1
  212. package/lib/module/ui/screens/UserLinksScreen.js +0 -1
  213. package/lib/module/ui/screens/UserLinksScreen.js.map +1 -1
  214. package/lib/module/ui/screens/internal/SignInPasswordStep.js +1 -1
  215. package/lib/module/ui/screens/internal/SignInPasswordStep.js.map +1 -1
  216. package/lib/module/ui/screens/internal/SignInUsernameStep.js +1 -1
  217. package/lib/module/ui/screens/internal/SignInUsernameStep.js.map +1 -1
  218. package/lib/module/ui/screens/internal/SignUpIdentityStep.js +1 -1
  219. package/lib/module/ui/screens/internal/SignUpIdentityStep.js.map +1 -1
  220. package/lib/module/ui/screens/internal/SignUpSecurityStep.js +1 -1
  221. package/lib/module/ui/screens/internal/SignUpSecurityStep.js.map +1 -1
  222. package/lib/module/ui/screens/internal/SignUpSummaryStep.js +0 -1
  223. package/lib/module/ui/screens/internal/SignUpSummaryStep.js.map +1 -1
  224. package/lib/module/ui/screens/internal/SignUpWelcomeStep.js +0 -1
  225. package/lib/module/ui/screens/internal/SignUpWelcomeStep.js.map +1 -1
  226. package/lib/module/ui/screens/karma/KarmaAboutScreen.js +0 -1
  227. package/lib/module/ui/screens/karma/KarmaAboutScreen.js.map +1 -1
  228. package/lib/module/ui/screens/karma/KarmaCenterScreen.js +1 -1
  229. package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
  230. package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
  231. package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
  232. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js +0 -1
  233. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
  234. package/lib/module/ui/screens/karma/KarmaRulesScreen.js +1 -1
  235. package/lib/module/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
  236. package/lib/module/ui/stores/assetStore.js +212 -0
  237. package/lib/module/ui/stores/assetStore.js.map +1 -0
  238. package/lib/module/ui/stores/authStore.js +1 -1
  239. package/lib/module/ui/stores/authStore.js.map +1 -1
  240. package/lib/module/ui/stores/fileStore.js +145 -0
  241. package/lib/module/ui/stores/fileStore.js.map +1 -0
  242. package/lib/module/ui/stores/followStore.js +2 -2
  243. package/lib/module/ui/stores/followStore.js.map +1 -1
  244. package/lib/module/ui/styles/fonts.js.map +1 -1
  245. package/lib/module/ui/styles/theme.js.map +1 -1
  246. package/lib/module/utils/asyncUtils.js +1 -1
  247. package/lib/module/utils/asyncUtils.js.map +1 -1
  248. package/lib/module/utils/errorUtils.js +19 -11
  249. package/lib/module/utils/errorUtils.js.map +1 -1
  250. package/lib/module/utils/hookUtils.js +1 -1
  251. package/lib/module/utils/hookUtils.js.map +1 -1
  252. package/lib/module/utils/loggerUtils.js.map +1 -1
  253. package/lib/module/utils/validationUtils.js +2 -2
  254. package/lib/module/utils/validationUtils.js.map +1 -1
  255. package/lib/typescript/assets/icons/OxyServices.d.ts +2 -2
  256. package/lib/typescript/assets/icons/OxyServices.d.ts.map +1 -1
  257. package/lib/typescript/assets/illustrations/HighFive.d.ts +1 -1
  258. package/lib/typescript/assets/illustrations/HighFive.d.ts.map +1 -1
  259. package/lib/typescript/core/OxyServices.d.ts +69 -12
  260. package/lib/typescript/core/OxyServices.d.ts.map +1 -1
  261. package/lib/typescript/core/index.d.ts +1 -1
  262. package/lib/typescript/core/index.d.ts.map +1 -1
  263. package/lib/typescript/index.d.ts +4 -2
  264. package/lib/typescript/index.d.ts.map +1 -1
  265. package/lib/typescript/lib/sonner-safe.d.ts +2 -1
  266. package/lib/typescript/lib/sonner-safe.d.ts.map +1 -1
  267. package/lib/typescript/lib/sonner.d.ts +11 -3
  268. package/lib/typescript/lib/sonner.d.ts.map +1 -1
  269. package/lib/typescript/models/interfaces.d.ts +105 -6
  270. package/lib/typescript/models/interfaces.d.ts.map +1 -1
  271. package/lib/typescript/node/index.d.ts +2 -2
  272. package/lib/typescript/node/index.d.ts.map +1 -1
  273. package/lib/typescript/types/expo-vector-icons.d.ts +8 -1
  274. package/lib/typescript/types/express.d.ts +22 -3
  275. package/lib/typescript/ui/components/Avatar.d.ts +2 -2
  276. package/lib/typescript/ui/components/Avatar.d.ts.map +1 -1
  277. package/lib/typescript/ui/components/FollowButton.d.ts +2 -2
  278. package/lib/typescript/ui/components/FollowButton.d.ts.map +1 -1
  279. package/lib/typescript/ui/components/FontLoader.d.ts +1 -1
  280. package/lib/typescript/ui/components/FontLoader.d.ts.map +1 -1
  281. package/lib/typescript/ui/components/GroupedItem.d.ts +2 -1
  282. package/lib/typescript/ui/components/GroupedItem.d.ts.map +1 -1
  283. package/lib/typescript/ui/components/GroupedSection.d.ts +2 -1
  284. package/lib/typescript/ui/components/GroupedSection.d.ts.map +1 -1
  285. package/lib/typescript/ui/components/Header.d.ts +1 -1
  286. package/lib/typescript/ui/components/Header.d.ts.map +1 -1
  287. package/lib/typescript/ui/components/OxyLogo.d.ts +2 -2
  288. package/lib/typescript/ui/components/OxyLogo.d.ts.map +1 -1
  289. package/lib/typescript/ui/components/OxyPayButton.d.ts +2 -2
  290. package/lib/typescript/ui/components/OxyPayButton.d.ts.map +1 -1
  291. package/lib/typescript/ui/components/OxyProvider.d.ts +2 -2
  292. package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
  293. package/lib/typescript/ui/components/OxySignInButton.d.ts +2 -2
  294. package/lib/typescript/ui/components/OxySignInButton.d.ts.map +1 -1
  295. package/lib/typescript/ui/components/ProfileCard.d.ts +1 -1
  296. package/lib/typescript/ui/components/ProfileCard.d.ts.map +1 -1
  297. package/lib/typescript/ui/components/QuickActions.d.ts +1 -1
  298. package/lib/typescript/ui/components/QuickActions.d.ts.map +1 -1
  299. package/lib/typescript/ui/components/Section.d.ts +1 -1
  300. package/lib/typescript/ui/components/Section.d.ts.map +1 -1
  301. package/lib/typescript/ui/components/SectionTitle.d.ts +1 -1
  302. package/lib/typescript/ui/components/SectionTitle.d.ts.map +1 -1
  303. package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts +1 -1
  304. package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts.map +1 -1
  305. package/lib/typescript/ui/components/icon/OxyIcon.d.ts +1 -1
  306. package/lib/typescript/ui/components/icon/OxyIcon.d.ts.map +1 -1
  307. package/lib/typescript/ui/components/internal/GroupedPillButtons.d.ts +1 -1
  308. package/lib/typescript/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
  309. package/lib/typescript/ui/components/internal/PinInput.d.ts +1 -1
  310. package/lib/typescript/ui/components/internal/PinInput.d.ts.map +1 -1
  311. package/lib/typescript/ui/components/internal/TextField.d.ts +1 -1
  312. package/lib/typescript/ui/components/internal/TextField.d.ts.map +1 -1
  313. package/lib/typescript/ui/context/OxyContext.d.ts +3 -3
  314. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
  315. package/lib/typescript/ui/hooks/useAssets.d.ts +35 -0
  316. package/lib/typescript/ui/hooks/useAssets.d.ts.map +1 -0
  317. package/lib/typescript/ui/navigation/OxyRouter.d.ts +2 -2
  318. package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -1
  319. package/lib/typescript/ui/navigation/types.d.ts +7 -7
  320. package/lib/typescript/ui/navigation/types.d.ts.map +1 -1
  321. package/lib/typescript/ui/screens/AccountCenterScreen.d.ts +2 -2
  322. package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -1
  323. package/lib/typescript/ui/screens/AccountManagementDemo.d.ts +1 -1
  324. package/lib/typescript/ui/screens/AccountManagementDemo.d.ts.map +1 -1
  325. package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts +1 -1
  326. package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
  327. package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts +1 -1
  328. package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  329. package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts +2 -2
  330. package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
  331. package/lib/typescript/ui/screens/AppInfoScreen.d.ts +2 -2
  332. package/lib/typescript/ui/screens/AppInfoScreen.d.ts.map +1 -1
  333. package/lib/typescript/ui/screens/FeedbackScreen.d.ts +1 -1
  334. package/lib/typescript/ui/screens/FeedbackScreen.d.ts.map +1 -1
  335. package/lib/typescript/ui/screens/FileManagementScreen.d.ts +1 -1
  336. package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +1 -1
  337. package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts +2 -2
  338. package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
  339. package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts +2 -2
  340. package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
  341. package/lib/typescript/ui/screens/ProfileScreen.d.ts +2 -2
  342. package/lib/typescript/ui/screens/ProfileScreen.d.ts.map +1 -1
  343. package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts +1 -1
  344. package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts.map +1 -1
  345. package/lib/typescript/ui/screens/SessionManagementScreen.d.ts +2 -2
  346. package/lib/typescript/ui/screens/SessionManagementScreen.d.ts.map +1 -1
  347. package/lib/typescript/ui/screens/SignInScreen.d.ts +2 -2
  348. package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
  349. package/lib/typescript/ui/screens/SignUpScreen.d.ts +1 -1
  350. package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +1 -1
  351. package/lib/typescript/ui/screens/UserLinksScreen.d.ts +2 -2
  352. package/lib/typescript/ui/screens/UserLinksScreen.d.ts.map +1 -1
  353. package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts +1 -1
  354. package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts.map +1 -1
  355. package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts +1 -1
  356. package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts.map +1 -1
  357. package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts +1 -1
  358. package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts.map +1 -1
  359. package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts +1 -1
  360. package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts.map +1 -1
  361. package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts +1 -1
  362. package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts.map +1 -1
  363. package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts +1 -1
  364. package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts.map +1 -1
  365. package/lib/typescript/ui/screens/karma/KarmaAboutScreen.d.ts +2 -2
  366. package/lib/typescript/ui/screens/karma/KarmaAboutScreen.d.ts.map +1 -1
  367. package/lib/typescript/ui/screens/karma/KarmaCenterScreen.d.ts +2 -2
  368. package/lib/typescript/ui/screens/karma/KarmaCenterScreen.d.ts.map +1 -1
  369. package/lib/typescript/ui/screens/karma/KarmaFAQScreen.d.ts +1 -1
  370. package/lib/typescript/ui/screens/karma/KarmaFAQScreen.d.ts.map +1 -1
  371. package/lib/typescript/ui/screens/karma/KarmaLeaderboardScreen.d.ts +2 -2
  372. package/lib/typescript/ui/screens/karma/KarmaLeaderboardScreen.d.ts.map +1 -1
  373. package/lib/typescript/ui/screens/karma/KarmaRewardsScreen.d.ts +2 -2
  374. package/lib/typescript/ui/screens/karma/KarmaRewardsScreen.d.ts.map +1 -1
  375. package/lib/typescript/ui/screens/karma/KarmaRulesScreen.d.ts +2 -2
  376. package/lib/typescript/ui/screens/karma/KarmaRulesScreen.d.ts.map +1 -1
  377. package/lib/typescript/ui/stores/assetStore.d.ts +54 -0
  378. package/lib/typescript/ui/stores/assetStore.d.ts.map +1 -0
  379. package/lib/typescript/ui/stores/fileStore.d.ts +31 -0
  380. package/lib/typescript/ui/stores/fileStore.d.ts.map +1 -0
  381. package/lib/typescript/ui/stores/followStore.d.ts +1 -1
  382. package/lib/typescript/ui/stores/followStore.d.ts.map +1 -1
  383. package/lib/typescript/ui/styles/fonts.d.ts +1 -1
  384. package/lib/typescript/ui/styles/fonts.d.ts.map +1 -1
  385. package/lib/typescript/ui/styles/theme.d.ts +1 -1
  386. package/lib/typescript/ui/styles/theme.d.ts.map +1 -1
  387. package/lib/typescript/utils/asyncUtils.d.ts.map +1 -1
  388. package/lib/typescript/utils/errorUtils.d.ts +5 -5
  389. package/lib/typescript/utils/errorUtils.d.ts.map +1 -1
  390. package/lib/typescript/utils/hookUtils.d.ts +4 -4
  391. package/lib/typescript/utils/hookUtils.d.ts.map +1 -1
  392. package/lib/typescript/utils/loggerUtils.d.ts +18 -18
  393. package/lib/typescript/utils/loggerUtils.d.ts.map +1 -1
  394. package/lib/typescript/utils/validationUtils.d.ts +6 -6
  395. package/lib/typescript/utils/validationUtils.d.ts.map +1 -1
  396. package/package.json +149 -143
  397. package/src/assets/icons/OxyServices.tsx +2 -2
  398. package/src/assets/illustrations/HighFive.tsx +1 -1
  399. package/src/core/OxyServices.ts +268 -41
  400. package/src/core/__tests__/OxyServices.test.ts +180 -0
  401. package/src/core/index.ts +1 -1
  402. package/src/index.ts +16 -2
  403. package/src/lib/sonner-safe.ts +4 -1
  404. package/src/lib/sonner.ts +19 -2
  405. package/src/models/interfaces.ts +117 -6
  406. package/src/node/index.ts +2 -2
  407. package/src/types/expo-vector-icons.d.ts +8 -1
  408. package/src/types/express.d.ts +22 -3
  409. package/src/ui/components/Avatar.tsx +2 -2
  410. package/src/ui/components/FollowButton.tsx +10 -8
  411. package/src/ui/components/FontLoader.tsx +5 -3
  412. package/src/ui/components/GroupedItem.tsx +12 -2
  413. package/src/ui/components/GroupedSection.tsx +3 -1
  414. package/src/ui/components/Header.tsx +1 -1
  415. package/src/ui/components/OxyLogo.tsx +2 -2
  416. package/src/ui/components/OxyPayButton.tsx +6 -5
  417. package/src/ui/components/OxyProvider.tsx +7 -4
  418. package/src/ui/components/OxySignInButton.tsx +2 -2
  419. package/src/ui/components/ProfileCard.tsx +1 -1
  420. package/src/ui/components/QuickActions.tsx +1 -1
  421. package/src/ui/components/Section.tsx +1 -1
  422. package/src/ui/components/SectionTitle.tsx +1 -1
  423. package/src/ui/components/icon/FAIRWalletIcon.tsx +1 -1
  424. package/src/ui/components/icon/OxyIcon.tsx +1 -1
  425. package/src/ui/components/internal/GroupedPillButtons.tsx +1 -1
  426. package/src/ui/components/internal/PinInput.tsx +3 -2
  427. package/src/ui/components/internal/TextField.tsx +9 -11
  428. package/src/ui/context/OxyContext.tsx +3 -3
  429. package/src/ui/hooks/useAssets.ts +306 -0
  430. package/src/ui/navigation/OxyRouter.tsx +3 -2
  431. package/src/ui/navigation/types.ts +8 -8
  432. package/src/ui/screens/AccountCenterScreen.tsx +2 -2
  433. package/src/ui/screens/AccountManagementDemo.tsx +1 -1
  434. package/src/ui/screens/AccountOverviewScreen.tsx +1 -1
  435. package/src/ui/screens/AccountSettingsScreen.tsx +3 -3
  436. package/src/ui/screens/AccountSwitcherScreen.tsx +9 -8
  437. package/src/ui/screens/AppInfoScreen.tsx +3 -2
  438. package/src/ui/screens/FeedbackScreen.tsx +1 -1
  439. package/src/ui/screens/FileManagementScreen.tsx +619 -494
  440. package/src/ui/screens/PaymentGatewayScreen.tsx +3 -2
  441. package/src/ui/screens/PremiumSubscriptionScreen.tsx +3 -2
  442. package/src/ui/screens/ProfileScreen.tsx +3 -2
  443. package/src/ui/screens/RecoverAccountScreen.tsx +3 -2
  444. package/src/ui/screens/SessionManagementScreen.tsx +4 -3
  445. package/src/ui/screens/SignInScreen.tsx +3 -2
  446. package/src/ui/screens/SignUpScreen.tsx +1 -1
  447. package/src/ui/screens/UserLinksScreen.tsx +2 -2
  448. package/src/ui/screens/internal/SignInPasswordStep.tsx +3 -2
  449. package/src/ui/screens/internal/SignInUsernameStep.tsx +3 -2
  450. package/src/ui/screens/internal/SignUpIdentityStep.tsx +3 -2
  451. package/src/ui/screens/internal/SignUpSecurityStep.tsx +3 -2
  452. package/src/ui/screens/internal/SignUpSummaryStep.tsx +1 -1
  453. package/src/ui/screens/internal/SignUpWelcomeStep.tsx +1 -1
  454. package/src/ui/screens/karma/KarmaAboutScreen.tsx +2 -2
  455. package/src/ui/screens/karma/KarmaCenterScreen.tsx +3 -2
  456. package/src/ui/screens/karma/KarmaFAQScreen.tsx +1 -1
  457. package/src/ui/screens/karma/KarmaLeaderboardScreen.tsx +3 -2
  458. package/src/ui/screens/karma/KarmaRewardsScreen.tsx +2 -2
  459. package/src/ui/screens/karma/KarmaRulesScreen.tsx +3 -2
  460. package/src/ui/stores/assetStore.ts +281 -0
  461. package/src/ui/stores/authStore.ts +1 -1
  462. package/src/ui/stores/fileStore.ts +118 -0
  463. package/src/ui/stores/followStore.ts +4 -4
  464. package/src/ui/styles/fonts.ts +1 -1
  465. package/src/ui/styles/theme.ts +1 -1
  466. package/src/utils/__tests__/validationUtils.test.ts +236 -0
  467. package/src/utils/asyncUtils.ts +4 -4
  468. package/src/utils/errorUtils.ts +35 -23
  469. package/src/utils/hookUtils.ts +7 -7
  470. package/src/utils/loggerUtils.ts +18 -18
  471. package/src/utils/validationUtils.ts +8 -8
@@ -1,9 +1,17 @@
1
- import axios, { AxiosInstance, InternalAxiosRequestConfig } from 'axios';
1
+ import axios, { type AxiosInstance, type InternalAxiosRequestConfig } from 'axios';
2
2
  import { jwtDecode } from 'jwt-decode';
3
- import { OxyConfig, ApiError, User, Notification } from '../models/interfaces';
4
- import { SessionLoginResponse } from '../models/session';
3
+ import type {
4
+ OxyConfig,
5
+ ApiError,
6
+ User,
7
+ Notification,
8
+ AssetInitResponse,
9
+ AssetUrlResponse,
10
+ AssetVariant
11
+ } from '../models/interfaces';
12
+ import type { SessionLoginResponse } from '../models/session';
5
13
  import { handleHttpError } from '../utils/errorUtils';
6
- import { buildSearchParams, buildPaginationParams, PaginationParams } from '../utils/apiUtils';
14
+ import { buildSearchParams, buildPaginationParams, type PaginationParams } from '../utils/apiUtils';
7
15
 
8
16
  interface JwtPayload {
9
17
  exp?: number;
@@ -20,7 +28,7 @@ export class OxyAuthenticationError extends Error {
20
28
  public readonly code: string;
21
29
  public readonly status: number;
22
30
 
23
- constructor(message: string, code: string = 'AUTH_ERROR', status: number = 401) {
31
+ constructor(message: string, code = 'AUTH_ERROR', status = 401) {
24
32
  super(message);
25
33
  this.name = 'OxyAuthenticationError';
26
34
  this.code = code;
@@ -60,7 +68,7 @@ class TokenStore {
60
68
  return TokenStore.instance;
61
69
  }
62
70
 
63
- setTokens(accessToken: string, refreshToken: string = ''): void {
71
+ setTokens(accessToken: string, refreshToken = ''): void {
64
72
  this.accessToken = accessToken;
65
73
  this.refreshToken = refreshToken;
66
74
  }
@@ -194,7 +202,7 @@ export class OxyServices {
194
202
  /**
195
203
  * Set authentication tokens
196
204
  */
197
- public setTokens(accessToken: string, refreshToken: string = ''): void {
205
+ public setTokens(accessToken: string, refreshToken = ''): void {
198
206
  this.tokenStore.setTokens(accessToken, refreshToken);
199
207
  }
200
208
 
@@ -236,18 +244,25 @@ export class OxyServices {
236
244
  return this.tokenStore.hasAccessToken();
237
245
  }
238
246
 
247
+ /**
248
+ * Get the raw access token (for constructing anchor URLs when needed)
249
+ */
250
+ public getAccessToken(): string | null {
251
+ return this.tokenStore.getAccessToken();
252
+ }
253
+
239
254
  /**
240
255
  * Wait for authentication to be ready (public method)
241
256
  * Useful for apps that want to ensure authentication is complete before proceeding
242
257
  */
243
- public async waitForAuth(timeoutMs: number = 5000): Promise<boolean> {
258
+ public async waitForAuth(timeoutMs = 5000): Promise<boolean> {
244
259
  return this.waitForAuthentication(timeoutMs);
245
260
  }
246
261
 
247
262
  /**
248
263
  * Wait for authentication to be ready with timeout
249
264
  */
250
- private async waitForAuthentication(timeoutMs: number = 5000): Promise<boolean> {
265
+ private async waitForAuthentication(timeoutMs = 5000): Promise<boolean> {
251
266
  const startTime = Date.now();
252
267
  const checkInterval = 100; // Check every 100ms
253
268
 
@@ -940,7 +955,8 @@ export class OxyServices {
940
955
  */
941
956
  async deleteFile(fileId: string): Promise<any> {
942
957
  try {
943
- const res = await this.client.delete(`/api/files/${fileId}`);
958
+ // Central Asset Service delete with force=true behavior controlled by caller via assetDelete
959
+ const res = await this.client.delete(`/api/assets/${encodeURIComponent(fileId)}`);
944
960
  return res.data;
945
961
  } catch (error) {
946
962
  throw this.handleError(error);
@@ -950,8 +966,16 @@ export class OxyServices {
950
966
  /**
951
967
  * Get file download URL
952
968
  */
953
- getFileDownloadUrl(fileId: string): string {
954
- return `${OXY_CLOUD_URL}/files/${fileId}/download`;
969
+ getFileDownloadUrl(fileId: string, variant?: string, expiresIn?: number): string {
970
+ // Default to streaming proxy to avoid ORB; attach token via query for <img src>
971
+ const base = this.getBaseURL();
972
+ const params = new URLSearchParams();
973
+ if (variant) params.set('variant', variant);
974
+ // Request a visible server-side placeholder if object is missing
975
+ params.set('fallback', 'placeholderVisible');
976
+ const token = this.tokenStore.getAccessToken();
977
+ if (token) params.set('token', token);
978
+ return `${base}/api/assets/${encodeURIComponent(fileId)}/stream${params.size ? `?${params.toString()}` : ''}`;
955
979
  }
956
980
 
957
981
  /**
@@ -964,37 +988,181 @@ export class OxyServices {
964
988
  /**
965
989
  * List user files
966
990
  */
967
- async listUserFiles(
968
- userId: string,
969
- limit?: number,
970
- offset?: number,
971
- filters?: Record<string, any>
972
- ): Promise<any> {
991
+ async listUserFiles(limit?: number, offset?: number): Promise<{ files: any[]; total: number; hasMore: boolean }> {
973
992
  try {
974
993
  const params = new URLSearchParams();
975
- if (limit) params.append('limit', limit.toString());
976
- if (offset) params.append('offset', offset.toString());
994
+ if (limit) params.append('limit', String(limit));
995
+ if (offset) params.append('offset', String(offset));
996
+ const res = await this.client.get(`/api/assets${params.size ? `?${params.toString()}` : ''}`);
997
+ return res.data;
998
+ } catch (error) {
999
+ throw this.handleError(error);
1000
+ }
1001
+ }
1002
+
1003
+ // (removed legacy downloadFileContent; use getFileContentAsBlob/Text which resolve CAS URL first)
1004
+
1005
+ /**
1006
+ * Get file content as text
1007
+ */
1008
+ async getFileContentAsText(fileId: string, variant?: string): Promise<string> {
1009
+ try {
1010
+ const urlRes = await this.client.get(`/api/assets/${encodeURIComponent(fileId)}/url${variant ? `?variant=${encodeURIComponent(variant)}` : ''}`);
1011
+ const downloadUrl = urlRes.data?.url;
1012
+ const response = await fetch(downloadUrl);
1013
+ return await response.text();
1014
+ } catch (error) {
1015
+ throw this.handleError(error);
1016
+ }
1017
+ }
1018
+
1019
+ /**
1020
+ * Get file content as blob
1021
+ */
1022
+ async getFileContentAsBlob(fileId: string, variant?: string): Promise<Blob> {
1023
+ try {
1024
+ const urlRes = await this.client.get(`/api/assets/${encodeURIComponent(fileId)}/url${variant ? `?variant=${encodeURIComponent(variant)}` : ''}`);
1025
+ const downloadUrl = urlRes.data?.url;
1026
+ const response = await fetch(downloadUrl);
1027
+ return await response.blob();
1028
+ } catch (error) {
1029
+ throw this.handleError(error);
1030
+ }
1031
+ }
1032
+
1033
+ /**
1034
+ * Upload raw file data
1035
+ */
1036
+ async uploadRawFile(file: File | Blob, metadata?: Record<string, any>): Promise<any> {
1037
+ // Switch to Central Asset Service upload flow
1038
+ return this.assetUpload(file as File, metadata);
1039
+ }
1040
+
1041
+ // ============================================================================
1042
+ // CENTRAL ASSET SERVICE METHODS
1043
+ // ============================================================================
1044
+
1045
+ /**
1046
+ * Calculate SHA256 hash of file content
1047
+ */
1048
+ async calculateSHA256(file: File | Blob): Promise<string> {
1049
+ const buffer = await file.arrayBuffer();
1050
+ const hashBuffer = await crypto.subtle.digest('SHA-256', buffer);
1051
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
1052
+ return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
1053
+ }
1054
+
1055
+ /**
1056
+ * Initialize asset upload - returns pre-signed URL and file ID
1057
+ */
1058
+ async assetInit(sha256: string, size: number, mime: string): Promise<AssetInitResponse> {
1059
+ try {
1060
+ const res = await this.client.post('/api/assets/init', {
1061
+ sha256,
1062
+ size,
1063
+ mime
1064
+ });
1065
+ return res.data;
1066
+ } catch (error) {
1067
+ throw this.handleError(error);
1068
+ }
1069
+ }
1070
+
1071
+ /**
1072
+ * Complete asset upload - commit metadata and trigger variant generation
1073
+ */
1074
+ async assetComplete(fileId: string, originalName: string, size: number, mime: string, metadata?: Record<string, any>): Promise<any> {
1075
+ try {
1076
+ const res = await this.client.post('/api/assets/complete', {
1077
+ fileId,
1078
+ originalName,
1079
+ size,
1080
+ mime,
1081
+ metadata
1082
+ });
1083
+ return res.data;
1084
+ } catch (error) {
1085
+ throw this.handleError(error);
1086
+ }
1087
+ }
1088
+
1089
+ /**
1090
+ * Upload file using Central Asset Service
1091
+ */
1092
+ async assetUpload(file: File, metadata?: Record<string, any>, onProgress?: (progress: number) => void): Promise<any> {
1093
+ try {
1094
+ // Calculate SHA256
1095
+ const sha256 = await this.calculateSHA256(file);
977
1096
 
978
- if (filters) {
979
- Object.entries(filters).forEach(([key, value]) => {
980
- params.append(key, value.toString());
1097
+ // Initialize upload
1098
+ const initResponse = await this.assetInit(sha256, file.size, file.type);
1099
+
1100
+ // Try presigned URL first
1101
+ try {
1102
+ await this.uploadToPresignedUrl(initResponse.uploadUrl, file, onProgress);
1103
+ } catch (e) {
1104
+ // Fallback: direct upload via API to avoid CORS issues
1105
+ const fd = new FormData();
1106
+ fd.append('file', file);
1107
+ await this.client.post(`/api/assets/${encodeURIComponent(initResponse.fileId)}/upload-direct`, fd, {
1108
+ headers: { 'Content-Type': 'multipart/form-data' }
981
1109
  });
982
1110
  }
983
-
984
- const res = await this.client.get(`/api/files/list/${userId}?${params.toString()}`);
985
- return res.data;
1111
+
1112
+ // Complete upload
1113
+ return await this.assetComplete(
1114
+ initResponse.fileId,
1115
+ file.name,
1116
+ file.size,
1117
+ file.type,
1118
+ metadata
1119
+ );
986
1120
  } catch (error) {
987
1121
  throw this.handleError(error);
988
1122
  }
989
1123
  }
990
1124
 
991
1125
  /**
992
- * Download file content
1126
+ * Upload file to pre-signed URL
1127
+ */
1128
+ private async uploadToPresignedUrl(url: string, file: File, onProgress?: (progress: number) => void): Promise<void> {
1129
+ return new Promise((resolve, reject) => {
1130
+ const xhr = new XMLHttpRequest();
1131
+
1132
+ xhr.upload.addEventListener('progress', (event) => {
1133
+ if (event.lengthComputable && onProgress) {
1134
+ const progress = (event.loaded / event.total) * 100;
1135
+ onProgress(progress);
1136
+ }
1137
+ });
1138
+
1139
+ xhr.addEventListener('load', () => {
1140
+ if (xhr.status >= 200 && xhr.status < 300) {
1141
+ resolve();
1142
+ } else {
1143
+ reject(new Error(`Upload failed with status ${xhr.status}`));
1144
+ }
1145
+ });
1146
+
1147
+ xhr.addEventListener('error', () => {
1148
+ reject(new Error('Upload failed'));
1149
+ });
1150
+
1151
+ xhr.open('PUT', url);
1152
+ xhr.setRequestHeader('Content-Type', file.type);
1153
+ xhr.send(file);
1154
+ });
1155
+ }
1156
+
1157
+ /**
1158
+ * Link asset to an entity
993
1159
  */
994
- async downloadFileContent(fileId: string): Promise<Response> {
1160
+ async assetLink(fileId: string, app: string, entityType: string, entityId: string): Promise<any> {
995
1161
  try {
996
- const res = await this.client.get(`/api/files/${fileId}`, {
997
- responseType: 'blob'
1162
+ const res = await this.client.post(`/api/assets/${fileId}/links`, {
1163
+ app,
1164
+ entityType,
1165
+ entityId
998
1166
  });
999
1167
  return res.data;
1000
1168
  } catch (error) {
@@ -1003,13 +1171,15 @@ export class OxyServices {
1003
1171
  }
1004
1172
 
1005
1173
  /**
1006
- * Get file content as text
1174
+ * Unlink asset from an entity
1007
1175
  */
1008
- async getFileContentAsText(fileId: string): Promise<string> {
1176
+ async assetUnlink(fileId: string, app: string, entityType: string, entityId: string): Promise<any> {
1009
1177
  try {
1010
- const res = await this.client.get(`/api/files/${fileId}`, {
1011
- headers: {
1012
- 'Accept': 'text/plain'
1178
+ const res = await this.client.delete(`/api/assets/${fileId}/links`, {
1179
+ data: {
1180
+ app,
1181
+ entityType,
1182
+ entityId
1013
1183
  }
1014
1184
  });
1015
1185
  return res.data;
@@ -1019,19 +1189,73 @@ export class OxyServices {
1019
1189
  }
1020
1190
 
1021
1191
  /**
1022
- * Get file content as blob
1192
+ * Get asset metadata
1023
1193
  */
1024
- async getFileContentAsBlob(fileId: string): Promise<Blob> {
1194
+ async assetGet(fileId: string): Promise<any> {
1025
1195
  try {
1026
- const res = await this.client.get(`/api/files/${fileId}`, {
1027
- responseType: 'blob'
1028
- });
1196
+ const res = await this.client.get(`/api/assets/${fileId}`);
1197
+ return res.data;
1198
+ } catch (error) {
1199
+ throw this.handleError(error);
1200
+ }
1201
+ }
1202
+
1203
+ /**
1204
+ * Get asset URL (CDN or signed URL)
1205
+ */
1206
+ async assetGetUrl(fileId: string, variant?: string, expiresIn?: number): Promise<AssetUrlResponse> {
1207
+ try {
1208
+ const params = new URLSearchParams();
1209
+ if (variant) params.set('variant', variant);
1210
+ if (expiresIn) params.set('expiresIn', expiresIn.toString());
1211
+
1212
+ const queryString = params.toString();
1213
+ const url = `/api/assets/${fileId}/url${queryString ? `?${queryString}` : ''}`;
1214
+
1215
+ const res = await this.client.get(url);
1216
+ return res.data;
1217
+ } catch (error) {
1218
+ throw this.handleError(error);
1219
+ }
1220
+ }
1221
+
1222
+ /**
1223
+ * Restore asset from trash
1224
+ */
1225
+ async assetRestore(fileId: string): Promise<any> {
1226
+ try {
1227
+ const res = await this.client.post(`/api/assets/${fileId}/restore`);
1228
+ return res.data;
1229
+ } catch (error) {
1230
+ throw this.handleError(error);
1231
+ }
1232
+ }
1233
+
1234
+ /**
1235
+ * Delete asset with optional force
1236
+ */
1237
+ async assetDelete(fileId: string, force: boolean = false): Promise<any> {
1238
+ try {
1239
+ const params = force ? '?force=true' : '';
1240
+ const res = await this.client.delete(`/api/assets/${fileId}${params}`);
1029
1241
  return res.data;
1030
1242
  } catch (error) {
1031
1243
  throw this.handleError(error);
1032
1244
  }
1033
1245
  }
1034
1246
 
1247
+ /**
1248
+ * Get list of available variants for an asset
1249
+ */
1250
+ async assetGetVariants(fileId: string): Promise<AssetVariant[]> {
1251
+ try {
1252
+ const assetData = await this.assetGet(fileId);
1253
+ return assetData.file?.variants || [];
1254
+ } catch (error) {
1255
+ throw this.handleError(error);
1256
+ }
1257
+ }
1258
+
1035
1259
  // ============================================================================
1036
1260
  // LOCATION METHODS
1037
1261
  // ============================================================================
@@ -1337,4 +1561,7 @@ export class OxyServices {
1337
1561
  }
1338
1562
 
1339
1563
  // Export the cloud URL constant
1340
- export const OXY_CLOUD_URL = 'https://cloud.oxyhq.com';
1564
+ export const OXY_CLOUD_URL = 'https://cloud.oxyhq.com';
1565
+
1566
+ // Pre-configured client instance for easy import
1567
+ export const oxyClient = new OxyServices({ baseURL: OXY_CLOUD_URL });
@@ -0,0 +1,180 @@
1
+ import { OxyServices, OxyAuthenticationError, OxyAuthenticationTimeoutError } from '../OxyServices';
2
+ import { OXY_CLOUD_URL } from '../index';
3
+
4
+ // Mock axios for testing
5
+ jest.mock('axios');
6
+
7
+ describe('OxyServices', () => {
8
+ let oxyServices: OxyServices;
9
+
10
+ beforeEach(() => {
11
+ // Create a fresh instance for each test
12
+ oxyServices = new OxyServices({ baseURL: 'https://test.example.com' });
13
+ jest.clearAllMocks();
14
+ });
15
+
16
+ describe('Constructor and Configuration', () => {
17
+ it('should create an instance with the provided baseURL', () => {
18
+ const customURL = 'https://custom.example.com';
19
+ const service = new OxyServices({ baseURL: customURL });
20
+ expect(service.getBaseURL()).toBe(customURL);
21
+ });
22
+
23
+ it('should have a default cloud URL constant', () => {
24
+ expect(OXY_CLOUD_URL).toBe('https://cloud.oxyhq.com');
25
+ });
26
+ });
27
+
28
+ describe('Token Management', () => {
29
+ it('should set and retrieve tokens', () => {
30
+ const accessToken = 'test-access-token';
31
+ const refreshToken = 'test-refresh-token';
32
+
33
+ oxyServices.setTokens(accessToken, refreshToken);
34
+ expect(oxyServices.hasValidToken()).toBe(true);
35
+ });
36
+
37
+ it('should clear tokens', () => {
38
+ oxyServices.setTokens('test-token', 'refresh-token');
39
+ expect(oxyServices.hasValidToken()).toBe(true);
40
+
41
+ oxyServices.clearTokens();
42
+ expect(oxyServices.hasValidToken()).toBe(false);
43
+ });
44
+
45
+ it('should return null for user ID when no token is set', () => {
46
+ expect(oxyServices.getCurrentUserId()).toBeNull();
47
+ });
48
+ });
49
+
50
+ describe('Authentication Methods', () => {
51
+ it('should call signUp endpoint with correct parameters', async () => {
52
+ const mockAxios = require('axios');
53
+ const mockResponse = { data: { message: 'Success', token: 'test-token', user: { id: '1', username: 'test' } } };
54
+ mockAxios.create().post.mockResolvedValue(mockResponse);
55
+
56
+ const result = await oxyServices.signUp('testuser', 'test@example.com', 'password');
57
+
58
+ expect(mockAxios.create().post).toHaveBeenCalledWith('/api/auth/signup', {
59
+ username: 'testuser',
60
+ email: 'test@example.com',
61
+ password: 'password'
62
+ });
63
+ expect(result).toEqual(mockResponse.data);
64
+ });
65
+
66
+ it('should call signIn endpoint with correct parameters', async () => {
67
+ const mockAxios = require('axios');
68
+ const mockResponse = { data: { accessToken: 'test-token', user: { id: '1', username: 'test' } } };
69
+ mockAxios.create().post.mockResolvedValue(mockResponse);
70
+
71
+ const result = await oxyServices.signIn('testuser', 'password');
72
+
73
+ expect(mockAxios.create().post).toHaveBeenCalledWith('/api/auth/login', {
74
+ username: 'testuser',
75
+ password: 'password',
76
+ deviceName: undefined,
77
+ deviceFingerprint: undefined
78
+ });
79
+ expect(result).toEqual(mockResponse.data);
80
+ });
81
+ });
82
+
83
+ describe('Session Management', () => {
84
+ it('should get user by session ID', async () => {
85
+ const mockAxios = require('axios');
86
+ const mockUser = { id: '1', username: 'testuser' };
87
+ mockAxios.create().get.mockResolvedValue({ data: mockUser });
88
+
89
+ const result = await oxyServices.getUserBySession('test-session-id');
90
+
91
+ expect(mockAxios.create().get).toHaveBeenCalledWith('/api/session/user/test-session-id');
92
+ expect(result).toEqual(mockUser);
93
+ });
94
+
95
+ it('should get token by session ID and set it', async () => {
96
+ const mockAxios = require('axios');
97
+ const mockResponse = { data: { accessToken: 'new-token', expiresAt: '2024-01-01' } };
98
+ mockAxios.create().get.mockResolvedValue(mockResponse);
99
+
100
+ const result = await oxyServices.getTokenBySession('test-session-id');
101
+
102
+ expect(mockAxios.create().get).toHaveBeenCalledWith('/api/session/token/test-session-id');
103
+ expect(result).toEqual(mockResponse.data);
104
+ expect(oxyServices.hasValidToken()).toBe(true);
105
+ });
106
+ });
107
+
108
+ describe('Error Handling', () => {
109
+ it('should handle API errors correctly', async () => {
110
+ const mockAxios = require('axios');
111
+ const mockError = new Error('API Error');
112
+ mockAxios.create().post.mockRejectedValue(mockError);
113
+
114
+ await expect(oxyServices.signUp('test', 'test@example.com', 'pass')).rejects.toThrow();
115
+ });
116
+ });
117
+
118
+ describe('Custom Error Types', () => {
119
+ it('should create OxyAuthenticationError with correct properties', () => {
120
+ const error = new OxyAuthenticationError('Test error', 'TEST_CODE', 401);
121
+ expect(error.message).toBe('Test error');
122
+ expect(error.code).toBe('TEST_CODE');
123
+ expect(error.status).toBe(401);
124
+ expect(error.name).toBe('OxyAuthenticationError');
125
+ });
126
+
127
+ it('should create OxyAuthenticationTimeoutError with correct properties', () => {
128
+ const error = new OxyAuthenticationTimeoutError('testOperation', 5000);
129
+ expect(error.message).toContain('testOperation');
130
+ expect(error.message).toContain('5000ms');
131
+ expect(error.code).toBe('AUTH_TIMEOUT');
132
+ expect(error.status).toBe(408);
133
+ expect(error.name).toBe('OxyAuthenticationTimeoutError');
134
+ });
135
+ });
136
+
137
+ describe('Health Check', () => {
138
+ it('should call health check endpoint', async () => {
139
+ const mockAxios = require('axios');
140
+ const mockResponse = { data: { status: 'ok', timestamp: '2024-01-01' } };
141
+ mockAxios.create().get.mockResolvedValue(mockResponse);
142
+
143
+ const result = await oxyServices.healthCheck();
144
+
145
+ expect(mockAxios.create().get).toHaveBeenCalledWith('/health');
146
+ expect(result).toEqual(mockResponse.data);
147
+ });
148
+ });
149
+
150
+ describe('Validation Methods', () => {
151
+ it('should return false when no token is available for validation', async () => {
152
+ const result = await oxyServices.validate();
153
+ expect(result).toBe(false);
154
+ });
155
+
156
+ it('should validate token with server when token exists', async () => {
157
+ const mockAxios = require('axios');
158
+ oxyServices.setTokens('test-token');
159
+ mockAxios.create().get.mockResolvedValue({ data: { valid: true } });
160
+
161
+ const result = await oxyServices.validate();
162
+
163
+ expect(mockAxios.create().get).toHaveBeenCalledWith('/api/auth/validate');
164
+ expect(result).toBe(true);
165
+ });
166
+ });
167
+
168
+ describe('Wait for Authentication', () => {
169
+ it('should resolve immediately if token is already available', async () => {
170
+ oxyServices.setTokens('test-token');
171
+ const result = await oxyServices.waitForAuth(1000);
172
+ expect(result).toBe(true);
173
+ });
174
+
175
+ it('should timeout if no token becomes available', async () => {
176
+ const result = await oxyServices.waitForAuth(100);
177
+ expect(result).toBe(false);
178
+ });
179
+ });
180
+ });
package/src/core/index.ts CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  // Main OxyServices class (unified)
9
9
  export { OxyServices, OxyAuthenticationError, OxyAuthenticationTimeoutError } from './OxyServices';
10
- export { OXY_CLOUD_URL } from './OxyServices';
10
+ export { OXY_CLOUD_URL, oxyClient } from './OxyServices';
11
11
 
12
12
  // Re-export all models and types for convenience
13
13
  export * from '../models/interfaces';
package/src/index.ts CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  // Core exports
10
10
  export { OxyServices, OxyAuthenticationError, OxyAuthenticationTimeoutError } from './core';
11
- export { OXY_CLOUD_URL } from './core';
11
+ export { OXY_CLOUD_URL, oxyClient } from './core';
12
12
 
13
13
  // React context
14
14
  export {
@@ -54,7 +54,19 @@ export type {
54
54
  DeviceSession,
55
55
  DeviceSessionsResponse,
56
56
  DeviceSessionLogoutResponse,
57
- UpdateDeviceNameResponse
57
+ UpdateDeviceNameResponse,
58
+ // Central Asset Service types
59
+ AssetLink,
60
+ AssetVariant,
61
+ Asset,
62
+ AssetInitRequest,
63
+ AssetInitResponse,
64
+ AssetCompleteRequest,
65
+ AssetLinkRequest,
66
+ AssetUnlinkRequest,
67
+ AssetUrlResponse,
68
+ AssetDeleteSummary,
69
+ AssetUploadProgress
58
70
  } from './models/interfaces';
59
71
 
60
72
  export type {
@@ -65,7 +77,9 @@ export type {
65
77
 
66
78
  // UI components and hooks
67
79
  export { useAuthStore } from './ui/stores/authStore';
80
+ export { useAssetStore, useAssets as useAssetsStore, useAsset, useUploadProgress, useAssetLoading, useAssetErrors, useAssetsByApp, useAssetsByEntity, useAssetUsageCount, useIsAssetLinked } from './ui/stores/assetStore';
68
81
  export { useSessionSocket } from './ui/hooks/useSessionSocket';
82
+ export { useAssets, setOxyAssetInstance } from './ui/hooks/useAssets';
69
83
 
70
84
  // UI components
71
85
  export { OxySignInButton } from './ui/components/OxySignInButton';
@@ -4,7 +4,10 @@
4
4
  * In backend: exports a no-op function
5
5
  */
6
6
 
7
- let toast: any;
7
+ // Define a type for the toast function
8
+ type ToastFunction = (message: string, options?: Record<string, unknown>) => void;
9
+
10
+ let toast: ToastFunction;
8
11
 
9
12
  // Environment detection
10
13
  const isFrontend = typeof window !== 'undefined' ||
package/src/lib/sonner.ts CHANGED
@@ -2,8 +2,25 @@ import { Platform } from 'react-native';
2
2
  import * as WebSonner from 'sonner';
3
3
  import * as NativeSonner from 'sonner-native';
4
4
 
5
- const { toast: webToast, Toaster: WebToaster } = WebSonner as any;
6
- const { toast: nativeToast, Toaster: NativeToaster } = NativeSonner as any;
5
+ // Define proper types for the toast components
6
+ interface ToastFunction {
7
+ (message: string, options?: Record<string, unknown>): void;
8
+ success: (message: string, options?: Record<string, unknown>) => void;
9
+ error: (message: string, options?: Record<string, unknown>) => void;
10
+ info: (message: string, options?: Record<string, unknown>) => void;
11
+ warning: (message: string, options?: Record<string, unknown>) => void;
12
+ }
13
+
14
+ type ToasterComponent = (props?: Record<string, unknown>) => React.ReactElement | null;
15
+
16
+ const { toast: webToast, Toaster: WebToaster } = WebSonner as {
17
+ toast: ToastFunction;
18
+ Toaster: ToasterComponent;
19
+ };
20
+ const { toast: nativeToast, Toaster: NativeToaster } = NativeSonner as {
21
+ toast: ToastFunction;
22
+ Toaster: ToasterComponent;
23
+ };
7
24
 
8
25
  export const toast = Platform.OS === 'web' ? webToast : nativeToast;
9
26
  export const Toaster = Platform.OS === 'web' ? WebToaster : NativeToaster;