@oxyhq/services 5.5.9 → 5.6.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 (396) hide show
  1. package/README.md +16 -2
  2. package/lib/commonjs/core/index.js +69 -82
  3. package/lib/commonjs/core/index.js.map +1 -1
  4. package/lib/commonjs/index.js +24 -183
  5. package/lib/commonjs/index.js.map +1 -1
  6. package/lib/commonjs/node/index.js +0 -2
  7. package/lib/commonjs/node/index.js.map +1 -1
  8. package/lib/commonjs/ui/components/FollowButton.js +100 -229
  9. package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
  10. package/lib/commonjs/ui/components/OxyPayButton.js +131 -0
  11. package/lib/commonjs/ui/components/OxyPayButton.js.map +1 -0
  12. package/lib/commonjs/ui/components/OxyProvider.js +41 -198
  13. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  14. package/lib/commonjs/ui/components/OxySignInButton.js +15 -2
  15. package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
  16. package/lib/commonjs/ui/components/icon/FAIRWalletIcon.js +66 -0
  17. package/lib/commonjs/ui/components/icon/FAIRWalletIcon.js.map +1 -0
  18. package/lib/commonjs/ui/components/icon/index.js +7 -0
  19. package/lib/commonjs/ui/components/icon/index.js.map +1 -1
  20. package/lib/commonjs/ui/components/index.js +7 -0
  21. package/lib/commonjs/ui/components/index.js.map +1 -1
  22. package/lib/commonjs/ui/components/internal/GroupedPillButtons.js +14 -7
  23. package/lib/commonjs/ui/components/internal/GroupedPillButtons.js.map +1 -1
  24. package/lib/commonjs/ui/components/internal/PinInput.js +108 -0
  25. package/lib/commonjs/ui/components/internal/PinInput.js.map +1 -0
  26. package/lib/commonjs/ui/components/internal/TextField.js +20 -0
  27. package/lib/commonjs/ui/components/internal/TextField.js.map +1 -1
  28. package/lib/commonjs/ui/context/OxyContext.js +116 -84
  29. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  30. package/lib/commonjs/ui/hooks/index.js +2 -15
  31. package/lib/commonjs/ui/hooks/index.js.map +1 -1
  32. package/lib/commonjs/ui/hooks/useFollow.js +52 -136
  33. package/lib/commonjs/ui/hooks/useFollow.js.map +1 -1
  34. package/lib/commonjs/ui/hooks/useSessionSocket.js +52 -0
  35. package/lib/commonjs/ui/hooks/useSessionSocket.js.map +1 -0
  36. package/lib/commonjs/ui/index.js +8 -191
  37. package/lib/commonjs/ui/index.js.map +1 -1
  38. package/lib/commonjs/ui/navigation/OxyRouter.js +52 -60
  39. package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -1
  40. package/lib/commonjs/ui/screens/AccountCenterScreen.js +18 -30
  41. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
  42. package/lib/commonjs/ui/screens/AccountOverviewScreen.js +4 -22
  43. package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
  44. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +90 -39
  45. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  46. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +37 -66
  47. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
  48. package/lib/commonjs/ui/screens/AppInfoScreen.js +21 -44
  49. package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
  50. package/lib/commonjs/ui/screens/FeedbackScreen.js +44 -23
  51. package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
  52. package/lib/commonjs/ui/screens/FileManagementScreen.js +59 -78
  53. package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
  54. package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +1588 -0
  55. package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -0
  56. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +22 -36
  57. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  58. package/lib/commonjs/ui/screens/RecoverAccountScreen.js +269 -0
  59. package/lib/commonjs/ui/screens/RecoverAccountScreen.js.map +1 -0
  60. package/lib/commonjs/ui/screens/SessionManagementScreen.js +47 -69
  61. package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
  62. package/lib/commonjs/ui/screens/SignInScreen.js +99 -333
  63. package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
  64. package/lib/commonjs/ui/screens/SignUpScreen.js +136 -340
  65. package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -1
  66. package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js +192 -0
  67. package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js.map +1 -0
  68. package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js +135 -0
  69. package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js.map +1 -0
  70. package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js +108 -0
  71. package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js.map +1 -0
  72. package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js +126 -0
  73. package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js.map +1 -0
  74. package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js +84 -0
  75. package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js.map +1 -0
  76. package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js +59 -0
  77. package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js.map +1 -0
  78. package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js +15 -2
  79. package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
  80. package/lib/commonjs/ui/stores/authStore.js +66 -0
  81. package/lib/commonjs/ui/stores/authStore.js.map +1 -0
  82. package/lib/commonjs/ui/stores/followStore.js +124 -0
  83. package/lib/commonjs/ui/stores/followStore.js.map +1 -0
  84. package/lib/commonjs/ui/styles/index.js +0 -11
  85. package/lib/commonjs/ui/styles/index.js.map +1 -1
  86. package/lib/commonjs/ui/utils/confirmAction.js +28 -0
  87. package/lib/commonjs/ui/utils/confirmAction.js.map +1 -0
  88. package/lib/module/core/index.js +69 -81
  89. package/lib/module/core/index.js.map +1 -1
  90. package/lib/module/index.js +14 -17
  91. package/lib/module/index.js.map +1 -1
  92. package/lib/module/node/index.js +0 -3
  93. package/lib/module/node/index.js.map +1 -1
  94. package/lib/module/ui/components/FollowButton.js +100 -229
  95. package/lib/module/ui/components/FollowButton.js.map +1 -1
  96. package/lib/module/ui/components/OxyPayButton.js +125 -0
  97. package/lib/module/ui/components/OxyPayButton.js.map +1 -0
  98. package/lib/module/ui/components/OxyProvider.js +42 -199
  99. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  100. package/lib/module/ui/components/OxySignInButton.js +15 -2
  101. package/lib/module/ui/components/OxySignInButton.js.map +1 -1
  102. package/lib/module/ui/components/icon/FAIRWalletIcon.js +60 -0
  103. package/lib/module/ui/components/icon/FAIRWalletIcon.js.map +1 -0
  104. package/lib/module/ui/components/icon/index.js +1 -0
  105. package/lib/module/ui/components/icon/index.js.map +1 -1
  106. package/lib/module/ui/components/index.js +1 -0
  107. package/lib/module/ui/components/index.js.map +1 -1
  108. package/lib/module/ui/components/internal/GroupedPillButtons.js +15 -8
  109. package/lib/module/ui/components/internal/GroupedPillButtons.js.map +1 -1
  110. package/lib/module/ui/components/internal/PinInput.js +103 -0
  111. package/lib/module/ui/components/internal/PinInput.js.map +1 -0
  112. package/lib/module/ui/components/internal/TextField.js +20 -0
  113. package/lib/module/ui/components/internal/TextField.js.map +1 -1
  114. package/lib/module/ui/context/OxyContext.js +117 -85
  115. package/lib/module/ui/context/OxyContext.js.map +1 -1
  116. package/lib/module/ui/hooks/index.js +1 -2
  117. package/lib/module/ui/hooks/index.js.map +1 -1
  118. package/lib/module/ui/hooks/useFollow.js +52 -137
  119. package/lib/module/ui/hooks/useFollow.js.map +1 -1
  120. package/lib/module/ui/hooks/useSessionSocket.js +47 -0
  121. package/lib/module/ui/hooks/useSessionSocket.js.map +1 -0
  122. package/lib/module/ui/index.js +2 -13
  123. package/lib/module/ui/index.js.map +1 -1
  124. package/lib/module/ui/navigation/OxyRouter.js +53 -61
  125. package/lib/module/ui/navigation/OxyRouter.js.map +1 -1
  126. package/lib/module/ui/screens/AccountCenterScreen.js +6 -18
  127. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
  128. package/lib/module/ui/screens/AccountOverviewScreen.js +5 -23
  129. package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
  130. package/lib/module/ui/screens/AccountSettingsScreen.js +91 -40
  131. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  132. package/lib/module/ui/screens/AccountSwitcherScreen.js +38 -67
  133. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  134. package/lib/module/ui/screens/AppInfoScreen.js +22 -45
  135. package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
  136. package/lib/module/ui/screens/FeedbackScreen.js +44 -23
  137. package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
  138. package/lib/module/ui/screens/FileManagementScreen.js +59 -78
  139. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  140. package/lib/module/ui/screens/PaymentGatewayScreen.js +1583 -0
  141. package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -0
  142. package/lib/module/ui/screens/PremiumSubscriptionScreen.js +23 -37
  143. package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  144. package/lib/module/ui/screens/RecoverAccountScreen.js +263 -0
  145. package/lib/module/ui/screens/RecoverAccountScreen.js.map +1 -0
  146. package/lib/module/ui/screens/SessionManagementScreen.js +47 -69
  147. package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
  148. package/lib/module/ui/screens/SignInScreen.js +100 -334
  149. package/lib/module/ui/screens/SignInScreen.js.map +1 -1
  150. package/lib/module/ui/screens/SignUpScreen.js +137 -341
  151. package/lib/module/ui/screens/SignUpScreen.js.map +1 -1
  152. package/lib/module/ui/screens/internal/SignInPasswordStep.js +186 -0
  153. package/lib/module/ui/screens/internal/SignInPasswordStep.js.map +1 -0
  154. package/lib/module/ui/screens/internal/SignInUsernameStep.js +129 -0
  155. package/lib/module/ui/screens/internal/SignInUsernameStep.js.map +1 -0
  156. package/lib/module/ui/screens/internal/SignUpIdentityStep.js +102 -0
  157. package/lib/module/ui/screens/internal/SignUpIdentityStep.js.map +1 -0
  158. package/lib/module/ui/screens/internal/SignUpSecurityStep.js +120 -0
  159. package/lib/module/ui/screens/internal/SignUpSecurityStep.js.map +1 -0
  160. package/lib/module/ui/screens/internal/SignUpSummaryStep.js +79 -0
  161. package/lib/module/ui/screens/internal/SignUpSummaryStep.js.map +1 -0
  162. package/lib/module/ui/screens/internal/SignUpWelcomeStep.js +54 -0
  163. package/lib/module/ui/screens/internal/SignUpWelcomeStep.js.map +1 -0
  164. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js +16 -3
  165. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
  166. package/lib/module/ui/stores/authStore.js +62 -0
  167. package/lib/module/ui/stores/authStore.js.map +1 -0
  168. package/lib/module/ui/stores/followStore.js +120 -0
  169. package/lib/module/ui/stores/followStore.js.map +1 -0
  170. package/lib/module/ui/styles/index.js +0 -1
  171. package/lib/module/ui/styles/index.js.map +1 -1
  172. package/lib/module/ui/utils/confirmAction.js +25 -0
  173. package/lib/module/ui/utils/confirmAction.js.map +1 -0
  174. package/lib/typescript/core/index.d.ts +28 -10
  175. package/lib/typescript/core/index.d.ts.map +1 -1
  176. package/lib/typescript/index.d.ts +5 -4
  177. package/lib/typescript/index.d.ts.map +1 -1
  178. package/lib/typescript/models/interfaces.d.ts +6 -0
  179. package/lib/typescript/models/interfaces.d.ts.map +1 -1
  180. package/lib/typescript/models/secureSession.d.ts +0 -1
  181. package/lib/typescript/models/secureSession.d.ts.map +1 -1
  182. package/lib/typescript/node/index.d.ts +0 -1
  183. package/lib/typescript/node/index.d.ts.map +1 -1
  184. package/lib/typescript/ui/components/FollowButton.d.ts +1 -77
  185. package/lib/typescript/ui/components/FollowButton.d.ts.map +1 -1
  186. package/lib/typescript/ui/components/OxyPayButton.d.ts +29 -0
  187. package/lib/typescript/ui/components/OxyPayButton.d.ts.map +1 -0
  188. package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
  189. package/lib/typescript/ui/components/OxySignInButton.d.ts.map +1 -1
  190. package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts +8 -0
  191. package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts.map +1 -0
  192. package/lib/typescript/ui/components/icon/index.d.ts +1 -0
  193. package/lib/typescript/ui/components/icon/index.d.ts.map +1 -1
  194. package/lib/typescript/ui/components/index.d.ts +1 -0
  195. package/lib/typescript/ui/components/index.d.ts.map +1 -1
  196. package/lib/typescript/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
  197. package/lib/typescript/ui/components/internal/PinInput.d.ts +12 -0
  198. package/lib/typescript/ui/components/internal/PinInput.d.ts.map +1 -0
  199. package/lib/typescript/ui/components/internal/TextField.d.ts +1 -0
  200. package/lib/typescript/ui/components/internal/TextField.d.ts.map +1 -1
  201. package/lib/typescript/ui/context/OxyContext.d.ts +0 -2
  202. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
  203. package/lib/typescript/ui/hooks/index.d.ts +1 -2
  204. package/lib/typescript/ui/hooks/index.d.ts.map +1 -1
  205. package/lib/typescript/ui/hooks/useFollow.d.ts +14 -15
  206. package/lib/typescript/ui/hooks/useFollow.d.ts.map +1 -1
  207. package/lib/typescript/ui/hooks/useSessionSocket.d.ts +11 -0
  208. package/lib/typescript/ui/hooks/useSessionSocket.d.ts.map +1 -0
  209. package/lib/typescript/ui/index.d.ts +2 -5
  210. package/lib/typescript/ui/index.d.ts.map +1 -1
  211. package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -1
  212. package/lib/typescript/ui/navigation/types.d.ts +5 -23
  213. package/lib/typescript/ui/navigation/types.d.ts.map +1 -1
  214. package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -1
  215. package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
  216. package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  217. package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
  218. package/lib/typescript/ui/screens/AppInfoScreen.d.ts.map +1 -1
  219. package/lib/typescript/ui/screens/FeedbackScreen.d.ts.map +1 -1
  220. package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +1 -1
  221. package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts +27 -0
  222. package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts.map +1 -0
  223. package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
  224. package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts +8 -0
  225. package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts.map +1 -0
  226. package/lib/typescript/ui/screens/SessionManagementScreen.d.ts.map +1 -1
  227. package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
  228. package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +1 -1
  229. package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts +27 -0
  230. package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts.map +1 -0
  231. package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts +26 -0
  232. package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts.map +1 -0
  233. package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts +20 -0
  234. package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts.map +1 -0
  235. package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts +24 -0
  236. package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts.map +1 -0
  237. package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts +15 -0
  238. package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts.map +1 -0
  239. package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts +13 -0
  240. package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts.map +1 -0
  241. package/lib/typescript/ui/screens/karma/KarmaRewardsScreen.d.ts.map +1 -1
  242. package/lib/typescript/ui/stores/authStore.d.ts +16 -0
  243. package/lib/typescript/ui/stores/authStore.d.ts.map +1 -0
  244. package/lib/typescript/ui/stores/followStore.d.ts +15 -0
  245. package/lib/typescript/ui/stores/followStore.d.ts.map +1 -0
  246. package/lib/typescript/ui/styles/index.d.ts +0 -1
  247. package/lib/typescript/ui/styles/index.d.ts.map +1 -1
  248. package/lib/typescript/ui/utils/confirmAction.d.ts +7 -0
  249. package/lib/typescript/ui/utils/confirmAction.d.ts.map +1 -0
  250. package/package.json +12 -7
  251. package/src/core/index.ts +78 -88
  252. package/src/index.ts +8 -45
  253. package/src/models/interfaces.ts +7 -1
  254. package/src/models/secureSession.ts +1 -2
  255. package/src/node/index.ts +0 -3
  256. package/src/ui/components/FollowButton.tsx +100 -322
  257. package/src/ui/components/OxyPayButton.tsx +133 -0
  258. package/src/ui/components/OxyProvider.tsx +39 -201
  259. package/src/ui/components/OxySignInButton.tsx +13 -2
  260. package/src/ui/components/icon/FAIRWalletIcon.tsx +49 -0
  261. package/src/ui/components/icon/index.ts +1 -0
  262. package/src/ui/components/index.ts +1 -0
  263. package/src/ui/components/internal/GroupedPillButtons.tsx +12 -8
  264. package/src/ui/components/internal/PinInput.tsx +102 -0
  265. package/src/ui/components/internal/TextField.tsx +9 -0
  266. package/src/ui/context/OxyContext.tsx +74 -91
  267. package/src/ui/hooks/index.ts +1 -2
  268. package/src/ui/hooks/useFollow.ts +58 -129
  269. package/src/ui/hooks/useSessionSocket.ts +50 -0
  270. package/src/ui/index.ts +2 -37
  271. package/src/ui/navigation/OxyRouter.tsx +47 -63
  272. package/src/ui/navigation/types.ts +5 -26
  273. package/src/ui/screens/AccountCenterScreen.tsx +12 -21
  274. package/src/ui/screens/AccountOverviewScreen.tsx +6 -30
  275. package/src/ui/screens/AccountSettingsScreen.tsx +75 -46
  276. package/src/ui/screens/AccountSwitcherScreen.tsx +46 -88
  277. package/src/ui/screens/AppInfoScreen.tsx +27 -47
  278. package/src/ui/screens/FeedbackScreen.tsx +34 -19
  279. package/src/ui/screens/FileManagementScreen.tsx +293 -321
  280. package/src/ui/screens/PaymentGatewayScreen.tsx +1315 -0
  281. package/src/ui/screens/PremiumSubscriptionScreen.tsx +109 -124
  282. package/src/ui/screens/RecoverAccountScreen.tsx +260 -0
  283. package/src/ui/screens/SessionManagementScreen.tsx +65 -137
  284. package/src/ui/screens/SignInScreen.tsx +89 -283
  285. package/src/ui/screens/SignUpScreen.tsx +138 -291
  286. package/src/ui/screens/internal/SignInPasswordStep.tsx +179 -0
  287. package/src/ui/screens/internal/SignInUsernameStep.tsx +139 -0
  288. package/src/ui/screens/internal/SignUpIdentityStep.tsx +114 -0
  289. package/src/ui/screens/internal/SignUpSecurityStep.tsx +132 -0
  290. package/src/ui/screens/internal/SignUpSummaryStep.tsx +66 -0
  291. package/src/ui/screens/internal/SignUpWelcomeStep.tsx +52 -0
  292. package/src/ui/screens/karma/KarmaRewardsScreen.tsx +13 -3
  293. package/src/ui/stores/authStore.ts +45 -0
  294. package/src/ui/stores/followStore.ts +80 -0
  295. package/src/ui/styles/index.ts +0 -1
  296. package/src/ui/utils/confirmAction.ts +23 -0
  297. package/lib/commonjs/ui/components/bottomSheet/index.js +0 -37
  298. package/lib/commonjs/ui/components/bottomSheet/index.js.map +0 -1
  299. package/lib/commonjs/ui/hooks/useAuthFetch.js +0 -217
  300. package/lib/commonjs/ui/hooks/useAuthFetch.js.map +0 -1
  301. package/lib/commonjs/ui/hooks/useOxyFollow.js +0 -190
  302. package/lib/commonjs/ui/hooks/useOxyFollow.js.map +0 -1
  303. package/lib/commonjs/ui/screens/BillingManagementScreen.js +0 -636
  304. package/lib/commonjs/ui/screens/BillingManagementScreen.js.map +0 -1
  305. package/lib/commonjs/ui/store/index.js +0 -67
  306. package/lib/commonjs/ui/store/index.js.map +0 -1
  307. package/lib/commonjs/ui/store/setupOxyStore.js +0 -63
  308. package/lib/commonjs/ui/store/setupOxyStore.js.map +0 -1
  309. package/lib/commonjs/ui/store/slices/authSlice.js +0 -56
  310. package/lib/commonjs/ui/store/slices/authSlice.js.map +0 -1
  311. package/lib/commonjs/ui/store/slices/followSlice.js +0 -238
  312. package/lib/commonjs/ui/store/slices/followSlice.js.map +0 -1
  313. package/lib/commonjs/ui/store/slices/index.js +0 -129
  314. package/lib/commonjs/ui/store/slices/index.js.map +0 -1
  315. package/lib/commonjs/ui/store/slices/types.js +0 -19
  316. package/lib/commonjs/ui/store/slices/types.js.map +0 -1
  317. package/lib/commonjs/ui/styles/shadows.js +0 -123
  318. package/lib/commonjs/ui/styles/shadows.js.map +0 -1
  319. package/lib/commonjs/utils/polyfills.js +0 -42
  320. package/lib/commonjs/utils/polyfills.js.map +0 -1
  321. package/lib/module/ui/components/bottomSheet/index.js +0 -5
  322. package/lib/module/ui/components/bottomSheet/index.js.map +0 -1
  323. package/lib/module/ui/hooks/useAuthFetch.js +0 -212
  324. package/lib/module/ui/hooks/useAuthFetch.js.map +0 -1
  325. package/lib/module/ui/hooks/useOxyFollow.js +0 -186
  326. package/lib/module/ui/hooks/useOxyFollow.js.map +0 -1
  327. package/lib/module/ui/screens/BillingManagementScreen.js +0 -631
  328. package/lib/module/ui/screens/BillingManagementScreen.js.map +0 -1
  329. package/lib/module/ui/store/index.js +0 -33
  330. package/lib/module/ui/store/index.js.map +0 -1
  331. package/lib/module/ui/store/setupOxyStore.js +0 -59
  332. package/lib/module/ui/store/setupOxyStore.js.map +0 -1
  333. package/lib/module/ui/store/slices/authSlice.js +0 -48
  334. package/lib/module/ui/store/slices/authSlice.js.map +0 -1
  335. package/lib/module/ui/store/slices/followSlice.js +0 -232
  336. package/lib/module/ui/store/slices/followSlice.js.map +0 -1
  337. package/lib/module/ui/store/slices/index.js +0 -11
  338. package/lib/module/ui/store/slices/index.js.map +0 -1
  339. package/lib/module/ui/store/slices/types.js +0 -15
  340. package/lib/module/ui/store/slices/types.js.map +0 -1
  341. package/lib/module/ui/styles/shadows.js +0 -119
  342. package/lib/module/ui/styles/shadows.js.map +0 -1
  343. package/lib/module/utils/polyfills.js +0 -36
  344. package/lib/module/utils/polyfills.js.map +0 -1
  345. package/lib/typescript/types/react-redux.d.ts +0 -5
  346. package/lib/typescript/ui/components/bottomSheet/index.d.ts +0 -4
  347. package/lib/typescript/ui/components/bottomSheet/index.d.ts.map +0 -1
  348. package/lib/typescript/ui/hooks/useAuthFetch.d.ts +0 -34
  349. package/lib/typescript/ui/hooks/useAuthFetch.d.ts.map +0 -1
  350. package/lib/typescript/ui/hooks/useOxyFollow.d.ts +0 -81
  351. package/lib/typescript/ui/hooks/useOxyFollow.d.ts.map +0 -1
  352. package/lib/typescript/ui/screens/BillingManagementScreen.d.ts +0 -5
  353. package/lib/typescript/ui/screens/BillingManagementScreen.d.ts.map +0 -1
  354. package/lib/typescript/ui/store/index.d.ts +0 -27
  355. package/lib/typescript/ui/store/index.d.ts.map +0 -1
  356. package/lib/typescript/ui/store/setupOxyStore.d.ts +0 -29
  357. package/lib/typescript/ui/store/setupOxyStore.d.ts.map +0 -1
  358. package/lib/typescript/ui/store/slices/authSlice.d.ts +0 -32
  359. package/lib/typescript/ui/store/slices/authSlice.d.ts.map +0 -1
  360. package/lib/typescript/ui/store/slices/followSlice.d.ts +0 -120
  361. package/lib/typescript/ui/store/slices/followSlice.d.ts.map +0 -1
  362. package/lib/typescript/ui/store/slices/index.d.ts +0 -9
  363. package/lib/typescript/ui/store/slices/index.d.ts.map +0 -1
  364. package/lib/typescript/ui/store/slices/types.d.ts +0 -16
  365. package/lib/typescript/ui/store/slices/types.d.ts.map +0 -1
  366. package/lib/typescript/ui/styles/shadows.d.ts +0 -233
  367. package/lib/typescript/ui/styles/shadows.d.ts.map +0 -1
  368. package/lib/typescript/utils/polyfills.d.ts +0 -6
  369. package/lib/typescript/utils/polyfills.d.ts.map +0 -1
  370. package/src/__tests__/backend-middleware.test.ts +0 -209
  371. package/src/__tests__/polyfills.test.ts +0 -30
  372. package/src/__tests__/setup.ts +0 -43
  373. package/src/__tests__/ui/hooks/authfetch-integration.test.ts +0 -197
  374. package/src/__tests__/ui/hooks/backward-compatibility.test.ts +0 -159
  375. package/src/__tests__/ui/hooks/real-world-scenarios.test.ts +0 -224
  376. package/src/__tests__/ui/hooks/url-resolution.test.ts +0 -129
  377. package/src/__tests__/ui/hooks/useAuthFetch-separation.test.ts +0 -69
  378. package/src/__tests__/ui/hooks/useAuthFetch.test.ts +0 -70
  379. package/src/__tests__/ui/hooks/useOxyFollow.test.tsx +0 -92
  380. package/src/__tests__/ui/screens/AccountSettingsScreen.test.tsx +0 -112
  381. package/src/__tests__/ui/store/setupOxyStore.test.ts +0 -50
  382. package/src/__tests__/validate-structure.js +0 -91
  383. package/src/__tests__/validation.js +0 -42
  384. package/src/types/react-redux.d.ts +0 -5
  385. package/src/ui/components/bottomSheet/index.tsx +0 -14
  386. package/src/ui/hooks/useAuthFetch.ts +0 -238
  387. package/src/ui/hooks/useOxyFollow.ts +0 -188
  388. package/src/ui/screens/BillingManagementScreen.tsx +0 -589
  389. package/src/ui/store/index.ts +0 -36
  390. package/src/ui/store/setupOxyStore.ts +0 -58
  391. package/src/ui/store/slices/authSlice.ts +0 -43
  392. package/src/ui/store/slices/followSlice.ts +0 -207
  393. package/src/ui/store/slices/index.ts +0 -31
  394. package/src/ui/store/slices/types.ts +0 -33
  395. package/src/ui/styles/shadows.ts +0 -112
  396. package/src/utils/polyfills.ts +0 -34
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { View, TouchableOpacity, Text, ActivityIndicator, StyleSheet } from 'react-native';
2
+ import { View, TouchableOpacity, Text, ActivityIndicator, StyleSheet, Platform } from 'react-native';
3
3
  import { Ionicons } from '@expo/vector-icons';
4
4
 
5
5
  interface ButtonConfig {
@@ -32,13 +32,17 @@ const GroupedPillButtons: React.FC<GroupedPillButtonsProps> = ({
32
32
  gap: 6,
33
33
  minWidth: 70,
34
34
  borderWidth: 1,
35
- shadowOffset: {
36
- width: 0,
37
- height: 2,
38
- },
39
- shadowOpacity: 0.1,
40
- shadowRadius: 4,
41
- elevation: 2,
35
+ ...Platform.select({
36
+ web: {
37
+ boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
38
+ },
39
+ default: {
40
+ shadowOffset: { width: 0, height: 2 },
41
+ shadowOpacity: 0.1,
42
+ shadowRadius: 4,
43
+ elevation: 2,
44
+ }
45
+ }),
42
46
  };
43
47
 
44
48
  // Determine border radius based on position
@@ -0,0 +1,102 @@
1
+ import React, { useRef } from 'react';
2
+ import { View, TextInput, StyleSheet, Platform } from 'react-native';
3
+
4
+ interface PinInputProps {
5
+ value: string;
6
+ onChange: (val: string) => void;
7
+ length?: number;
8
+ disabled?: boolean;
9
+ autoFocus?: boolean;
10
+ colors: any;
11
+ }
12
+
13
+ const PinInput: React.FC<PinInputProps> = ({ value, onChange, length = 6, disabled, autoFocus, colors }) => {
14
+ const inputs = useRef<Array<TextInput | null>>([]);
15
+
16
+ const handleChange = (text: string, idx: number) => {
17
+ if (!/^[0-9]*$/.test(text)) return;
18
+ let newValue = value.split('');
19
+ if (text.length > 1) {
20
+ // Paste or autofill
21
+ newValue = text.split('').slice(0, length);
22
+ onChange(newValue.join(''));
23
+ if (newValue.length < length) {
24
+ inputs.current[newValue.length]?.focus();
25
+ }
26
+ return;
27
+ }
28
+ newValue[idx] = text;
29
+ const joined = newValue.join('').slice(0, length);
30
+ onChange(joined);
31
+ if (text && idx < length - 1) {
32
+ inputs.current[idx + 1]?.focus();
33
+ }
34
+ };
35
+
36
+ const handleKeyPress = (e: any, idx: number) => {
37
+ if (e.nativeEvent.key === 'Backspace' && !value[idx] && idx > 0) {
38
+ inputs.current[idx - 1]?.focus();
39
+ }
40
+ };
41
+
42
+ return (
43
+ <View style={styles.pinContainer}>
44
+ {Array.from({ length }).map((_, idx) => (
45
+ <TextInput
46
+ key={idx}
47
+ ref={ref => (inputs.current[idx] = ref)}
48
+ style={[
49
+ styles.pinInput,
50
+ { borderColor: colors.primary, color: colors.text, backgroundColor: colors.inputBackground },
51
+ value[idx] ? { borderWidth: 2 } : { borderWidth: 1 },
52
+ ]}
53
+ value={value[idx] || ''}
54
+ onChangeText={text => handleChange(text, idx)}
55
+ onKeyPress={e => handleKeyPress(e, idx)}
56
+ keyboardType={Platform.OS === 'ios' ? 'number-pad' : 'numeric'}
57
+ maxLength={1}
58
+ editable={!disabled}
59
+ autoFocus={autoFocus && idx === 0}
60
+ textAlign="center"
61
+ selectionColor={colors.primary}
62
+ returnKeyType="done"
63
+ />
64
+ ))}
65
+ </View>
66
+ );
67
+ };
68
+
69
+ const styles = StyleSheet.create({
70
+ pinContainer: {
71
+ flexDirection: 'row',
72
+ justifyContent: 'center',
73
+ gap: 12,
74
+ marginBottom: 24,
75
+ marginTop: 8,
76
+ },
77
+ pinInput: {
78
+ width: 44,
79
+ height: 54,
80
+ borderRadius: 12,
81
+ borderWidth: 1,
82
+ fontSize: 28,
83
+ fontWeight: '600',
84
+ backgroundColor: '#F5F5F5',
85
+ textAlign: 'center',
86
+ marginHorizontal: 2,
87
+ ...Platform.select({
88
+ web: {
89
+ boxShadow: '0 1px 4px rgba(0,0,0,0.04)',
90
+ },
91
+ default: {
92
+ shadowColor: '#000',
93
+ shadowOpacity: 0.04,
94
+ shadowOffset: { width: 0, height: 1 },
95
+ shadowRadius: 4,
96
+ elevation: 1,
97
+ }
98
+ }),
99
+ },
100
+ });
101
+
102
+ export default PinInput;
@@ -34,6 +34,7 @@ export interface TextFieldProps extends Omit<TextInputProps, 'style'> {
34
34
  onBlur?: () => void;
35
35
  onChangeText?: (text: string) => void;
36
36
  testID?: string;
37
+ validMessage?: string;
37
38
  }
38
39
 
39
40
  const TextField = forwardRef<TextInput, TextFieldProps>(({
@@ -57,6 +58,7 @@ const TextField = forwardRef<TextInput, TextFieldProps>(({
57
58
  testID,
58
59
  secureTextEntry,
59
60
  value = '',
61
+ validMessage,
60
62
  ...textInputProps
61
63
  }, ref) => {
62
64
  const [isFocused, setIsFocused] = useState(false);
@@ -556,6 +558,13 @@ const TextField = forwardRef<TextInput, TextFieldProps>(({
556
558
  </Text>
557
559
  </View>
558
560
  )}
561
+ {/* Valid Message */}
562
+ {!error && validMessage && (
563
+ <View style={{ flexDirection: 'row', alignItems: 'center', marginTop: 4, gap: 6 }}>
564
+ <Ionicons name="checkmark-circle" size={16} color={colors?.success || '#2E7D32'} />
565
+ <Text style={{ fontSize: 13, fontWeight: '500', color: colors?.success || '#2E7D32' }}>{validMessage}</Text>
566
+ </View>
567
+ )}
559
568
  </View>
560
569
  );
561
570
  });
@@ -1,8 +1,11 @@
1
- import React, { createContext, useContext, useState, useEffect, useCallback, ReactNode, useMemo } from 'react';
1
+ import React, { createContext, useContext, useEffect, useCallback, ReactNode, useMemo } from 'react';
2
2
  import { OxyServices } from '../../core';
3
3
  import { User } from '../../models/interfaces';
4
4
  import { SecureLoginResponse, SecureClientSession, MinimalUserData } from '../../models/secureSession';
5
5
  import { DeviceManager } from '../../utils/deviceManager';
6
+ import { useSessionSocket } from '../hooks/useSessionSocket';
7
+ import { toast } from '../../lib/sonner';
8
+ import { useAuthStore } from '../stores/authStore';
6
9
 
7
10
  // Define the context shape
8
11
  export interface OxyContextState {
@@ -35,10 +38,6 @@ export interface OxyContextState {
35
38
  oxyServices: OxyServices;
36
39
  bottomSheetRef?: React.RefObject<any>;
37
40
 
38
- // API configuration
39
- setApiUrl: (url: string) => void;
40
- getAppBaseURL: () => string;
41
-
42
41
  // Methods to directly control the bottom sheet
43
42
  showBottomSheet?: (screenOrConfig?: string | { screen: string; props?: Record<string, any> }) => void;
44
43
  hideBottomSheet?: () => void;
@@ -122,15 +121,20 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
122
121
  onAuthStateChange,
123
122
  bottomSheetRef,
124
123
  }) => {
125
- // Authentication state
126
- const [user, setUser] = useState<User | null>(null);
127
- const [minimalUser, setMinimalUser] = useState<MinimalUserData | null>(null);
128
- const [sessions, setSessions] = useState<SecureClientSession[]>([]);
129
- const [activeSessionId, setActiveSessionId] = useState<string | null>(null);
130
- const [isLoading, setIsLoading] = useState(true);
131
- const [error, setError] = useState<string | null>(null);
132
- const [storage, setStorage] = useState<StorageInterface | null>(null);
133
- const [appBaseURL, setAppBaseURL] = useState<string>(oxyServices.getBaseURL());
124
+ // Zustand state
125
+ const user = useAuthStore((state) => state.user);
126
+ const isAuthenticated = useAuthStore((state) => state.isAuthenticated);
127
+ const isLoading = useAuthStore((state) => state.isLoading);
128
+ const error = useAuthStore((state) => state.error);
129
+ const loginSuccess = useAuthStore((state) => state.loginSuccess);
130
+ const loginFailure = useAuthStore((state) => state.loginFailure);
131
+ const logoutStore = useAuthStore((state) => state.logout);
132
+
133
+ // Local state for non-auth fields
134
+ const [minimalUser, setMinimalUser] = React.useState<MinimalUserData | null>(null);
135
+ const [sessions, setSessions] = React.useState<SecureClientSession[]>([]);
136
+ const [activeSessionId, setActiveSessionId] = React.useState<string | null>(null);
137
+ const [storage, setStorage] = React.useState<StorageInterface | null>(null);
134
138
 
135
139
  // Storage keys (memoized to prevent infinite loops)
136
140
  const keys = useMemo(() => getSecureStorageKeys(storageKeyPrefix), [storageKeyPrefix]);
@@ -143,7 +147,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
143
147
  setStorage(platformStorage);
144
148
  } catch (error) {
145
149
  console.error('Failed to initialize storage:', error);
146
- setError('Failed to initialize storage');
150
+ useAuthStore.setState({ error: 'Failed to initialize storage' });
147
151
  }
148
152
  };
149
153
 
@@ -155,7 +159,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
155
159
  const initAuth = async () => {
156
160
  if (!storage) return;
157
161
 
158
- setIsLoading(true);
162
+ useAuthStore.setState({ isLoading: true });
159
163
  try {
160
164
  // Load stored sessions
161
165
  const sessionsData = await storage.getItem(keys.sessions);
@@ -172,17 +176,16 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
172
176
  let shouldUpdateStorage = false;
173
177
 
174
178
  for (const session of parsedSessions) {
175
- if (!session.userId || !session.username) {
179
+ if (!session.userId) {
176
180
  // Session is missing user info, try to fetch it
177
181
  try {
178
182
  const sessionUser = await oxyServices.getUserBySession(session.sessionId);
179
183
  migratedSessions.push({
180
184
  ...session,
181
- userId: sessionUser.id,
182
- username: sessionUser.username
185
+ userId: sessionUser.id
183
186
  });
184
187
  shouldUpdateStorage = true;
185
- console.log(`Migrated session ${session.sessionId} for user ${sessionUser.username}`);
188
+ console.log(`Migrated session ${session.sessionId} for user ${sessionUser.id}`);
186
189
  } catch (error) {
187
190
  // Session might be invalid, skip it
188
191
  console.log(`Removing invalid session ${session.sessionId}:`, error);
@@ -220,7 +223,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
220
223
 
221
224
  // Load full user data
222
225
  const fullUser = await oxyServices.getUserBySession(activeSession.sessionId);
223
- setUser(fullUser);
226
+ loginSuccess(fullUser);
224
227
  setMinimalUser({
225
228
  id: fullUser.id,
226
229
  username: fullUser.username,
@@ -245,7 +248,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
245
248
  console.error('Secure auth initialization error:', err);
246
249
  await clearAllStorage();
247
250
  } finally {
248
- setIsLoading(false);
251
+ useAuthStore.setState({ isLoading: false });
249
252
  }
250
253
  };
251
254
 
@@ -266,7 +269,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
266
269
  } else {
267
270
  // No valid sessions left
268
271
  setActiveSessionId(null);
269
- setUser(null);
272
+ logoutStore();
270
273
  setMinimalUser(null);
271
274
  await storage?.removeItem(keys.activeSessionId);
272
275
 
@@ -274,7 +277,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
274
277
  onAuthStateChange(null);
275
278
  }
276
279
  }
277
- }, [sessions, storage, keys, onAuthStateChange]);
280
+ }, [sessions, storage, keys, onAuthStateChange, logoutStore]);
278
281
 
279
282
  // Save sessions to storage
280
283
  const saveSessionsToStorage = useCallback(async (sessionsList: SecureClientSession[]): Promise<void> => {
@@ -302,7 +305,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
302
305
  // Switch to a different session
303
306
  const switchToSession = useCallback(async (sessionId: string): Promise<void> => {
304
307
  try {
305
- setIsLoading(true);
308
+ useAuthStore.setState({ isLoading: true });
306
309
 
307
310
  // Get access token for this session
308
311
  await oxyServices.getTokenBySession(sessionId);
@@ -311,7 +314,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
311
314
  const fullUser = await oxyServices.getUserBySession(sessionId);
312
315
 
313
316
  setActiveSessionId(sessionId);
314
- setUser(fullUser);
317
+ loginSuccess(fullUser);
315
318
  setMinimalUser({
316
319
  id: fullUser.id,
317
320
  username: fullUser.username,
@@ -325,18 +328,16 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
325
328
  }
326
329
  } catch (error) {
327
330
  console.error('Switch session error:', error);
328
- setError('Failed to switch session');
331
+ useAuthStore.setState({ error: 'Failed to switch session' });
329
332
  } finally {
330
- setIsLoading(false);
333
+ useAuthStore.setState({ isLoading: false });
331
334
  }
332
- }, [oxyServices, onAuthStateChange, saveActiveSessionId]);
335
+ }, [oxyServices, onAuthStateChange, loginSuccess, saveActiveSessionId]);
333
336
 
334
337
  // Secure login method
335
338
  const login = async (username: string, password: string, deviceName?: string): Promise<User> => {
336
339
  if (!storage) throw new Error('Storage not initialized');
337
-
338
- setIsLoading(true);
339
- setError(null);
340
+ useAuthStore.setState({ isLoading: true, error: null });
340
341
 
341
342
  try {
342
343
  // Get device fingerprint for enhanced device identification
@@ -361,13 +362,12 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
361
362
  deviceId: response.deviceId,
362
363
  expiresAt: response.expiresAt,
363
364
  lastActive: new Date().toISOString(),
364
- userId: response.user.id,
365
- username: response.user.username
365
+ userId: response.user.id
366
366
  };
367
367
 
368
368
  // Check if this user already has a session (prevent duplicate accounts)
369
369
  const existingUserSessionIndex = sessions.findIndex(s =>
370
- s.userId === response.user.id || s.username === response.user.username
370
+ s.userId === response.user.id
371
371
  );
372
372
 
373
373
  let updatedSessions: SecureClientSession[];
@@ -378,7 +378,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
378
378
  updatedSessions = [...sessions];
379
379
  updatedSessions[existingUserSessionIndex] = clientSession;
380
380
 
381
- console.log(`Reusing/updating existing session for user ${response.user.username}. Previous session: ${existingSession.sessionId}, New session: ${response.sessionId}`);
381
+ console.log(`Reusing/updating existing session for user ${response.user.id}. Previous session: ${existingSession.sessionId}, New session: ${response.sessionId}`);
382
382
 
383
383
  // If the replaced session was the active one, update active session
384
384
  if (activeSessionId === existingSession.sessionId) {
@@ -388,7 +388,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
388
388
  } else {
389
389
  // Add new session for new user
390
390
  updatedSessions = [...sessions, clientSession];
391
- console.log(`Added new session for user ${response.user.username} on device ${response.deviceId}`);
391
+ console.log(`Added new session for user ${response.user.id} on device ${response.deviceId}`);
392
392
  }
393
393
 
394
394
  setSessions(updatedSessions);
@@ -403,7 +403,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
403
403
 
404
404
  // Load full user data
405
405
  const fullUser = await oxyServices.getUserBySession(response.sessionId);
406
- setUser(fullUser);
406
+ loginSuccess(fullUser);
407
407
  setMinimalUser(response.user);
408
408
 
409
409
  if (onAuthStateChange) {
@@ -412,10 +412,10 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
412
412
 
413
413
  return fullUser;
414
414
  } catch (error: any) {
415
- setError(error.message || 'Login failed');
415
+ loginFailure(error.message || 'Login failed');
416
416
  throw error;
417
417
  } finally {
418
- setIsLoading(false);
418
+ useAuthStore.setState({ isLoading: false });
419
419
  }
420
420
  };
421
421
 
@@ -440,7 +440,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
440
440
  } else {
441
441
  // No sessions left
442
442
  setActiveSessionId(null);
443
- setUser(null);
443
+ logoutStore();
444
444
  setMinimalUser(null);
445
445
  await storage?.removeItem(keys.activeSessionId);
446
446
 
@@ -451,7 +451,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
451
451
  }
452
452
  } catch (error) {
453
453
  console.error('Logout error:', error);
454
- setError('Logout failed');
454
+ useAuthStore.setState({ error: 'Logout failed' });
455
455
  }
456
456
  };
457
457
 
@@ -461,13 +461,13 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
461
461
 
462
462
  if (!activeSessionId) {
463
463
  console.error('No active session ID found, cannot logout all');
464
- setError('No active session found');
464
+ useAuthStore.setState({ error: 'No active session found' });
465
465
  throw new Error('No active session found');
466
466
  }
467
467
 
468
468
  if (!oxyServices) {
469
469
  console.error('OxyServices not initialized');
470
- setError('Service not available');
470
+ useAuthStore.setState({ error: 'Service not available' });
471
471
  throw new Error('Service not available');
472
472
  }
473
473
 
@@ -479,7 +479,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
479
479
  // Clear all local data
480
480
  setSessions([]);
481
481
  setActiveSessionId(null);
482
- setUser(null);
482
+ logoutStore();
483
483
  setMinimalUser(null);
484
484
  await clearAllStorage();
485
485
  console.log('Local storage cleared');
@@ -490,7 +490,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
490
490
  }
491
491
  } catch (error) {
492
492
  console.error('Logout all error:', error);
493
- setError(`Logout all failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
493
+ useAuthStore.setState({ error: `Logout all failed: ${error instanceof Error ? error.message : 'Unknown error'}` });
494
494
  throw error;
495
495
  }
496
496
  };
@@ -499,8 +499,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
499
499
  const signUp = async (username: string, email: string, password: string): Promise<User> => {
500
500
  if (!storage) throw new Error('Storage not initialized');
501
501
 
502
- setIsLoading(true);
503
- setError(null);
502
+ useAuthStore.setState({ isLoading: true, error: null });
504
503
 
505
504
  try {
506
505
  // Create new account using the OxyServices signUp method
@@ -514,10 +513,10 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
514
513
 
515
514
  return user;
516
515
  } catch (error: any) {
517
- setError(error.message || 'Sign up failed');
516
+ loginFailure(error.message || 'Sign up failed');
518
517
  throw error;
519
518
  } finally {
520
- setIsLoading(false);
519
+ useAuthStore.setState({ isLoading: false });
521
520
  }
522
521
  };
523
522
 
@@ -574,7 +573,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
574
573
  // Clear all local sessions since we logged out from all devices
575
574
  setSessions([]);
576
575
  setActiveSessionId(null);
577
- setUser(null);
576
+ logoutStore();
578
577
  setMinimalUser(null);
579
578
  await clearAllStorage();
580
579
 
@@ -645,36 +644,19 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
645
644
  }
646
645
  }, [bottomSheetRef]);
647
646
 
648
- // API URL configuration
649
- const setApiUrl = useCallback((url: string) => {
650
- try {
651
- // Validate URL
652
- if (!url) {
653
- throw new Error('Base URL cannot be empty');
654
- }
655
- // Only update the app-specific base URL, not the OxyServices base URL
656
- // This ensures internal module calls to Oxy API remain unaffected
657
- setAppBaseURL(url);
658
- } catch (error) {
659
- console.error('Failed to update API URL:', error);
660
- setError(`Failed to update API URL: ${error instanceof Error ? error.message : 'Unknown error'}`);
661
- }
662
- }, []);
663
-
664
- // Get current app base URL
665
- const getAppBaseURL = useCallback(() => {
666
- return appBaseURL;
667
- }, [appBaseURL]);
668
-
669
- // Compute comprehensive authentication status
670
- // This is the single source of truth for authentication across the entire app
671
- const isAuthenticated = useMemo(() => {
672
- // User is authenticated if:
673
- // 1. We have a full user object loaded, OR
674
- // 2. We have an active session (token will be fetched on-demand)
675
- // This covers both the loaded state and the loading-but-authenticated state
676
- return !!user || !!activeSessionId;
677
- }, [user, activeSessionId]);
647
+ // Integrate socket for real-time session updates
648
+ console.log('OxyContextProvider: userId', user?.id, 'baseURL', oxyServices.getBaseURL());
649
+ useSessionSocket({
650
+ userId: user?.id,
651
+ activeSessionId,
652
+ refreshSessions,
653
+ logout: () => logout(),
654
+ baseURL: oxyServices.getBaseURL(),
655
+ onRemoteSignOut: () => {
656
+ toast.info('You have been signed out remotely.');
657
+ logout();
658
+ },
659
+ });
678
660
 
679
661
  // Context value
680
662
  const contextValue: OxyContextState = {
@@ -687,17 +669,18 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
687
669
  error,
688
670
  login,
689
671
  logout,
690
- logoutAll,
691
- signUp,
692
- switchSession,
693
- removeSession,
694
- refreshSessions,
695
- getDeviceSessions,
696
- logoutAllDeviceSessions,
697
- updateDeviceName,
672
+ logoutAll: async () => { await logout(); },
673
+ signUp: async (username, email, password) => {
674
+ await signUp(username, email, password);
675
+ return user as User; // Return the latest user from Zustand
676
+ },
677
+ switchSession: async (sessionId) => { await switchToSession(sessionId); },
678
+ removeSession: async (sessionId) => { await removeSession(sessionId); },
679
+ refreshSessions: async () => { await refreshSessions(); },
680
+ getDeviceSessions: async () => { return await getDeviceSessions(); },
681
+ logoutAllDeviceSessions: async () => { await logoutAllDeviceSessions(); },
682
+ updateDeviceName: async (deviceName) => { await updateDeviceName(deviceName); },
698
683
  oxyServices,
699
- setApiUrl,
700
- getAppBaseURL,
701
684
  bottomSheetRef,
702
685
  showBottomSheet,
703
686
  hideBottomSheet,
@@ -1,2 +1 @@
1
- export { useOxyFollow, useFollow } from './useOxyFollow';
2
- export { useAuthFetch } from './useAuthFetch';
1
+ export { useFollow } from './useFollow';