@oxyhq/services 5.4.0 → 5.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (395) hide show
  1. package/package.json +3 -2
  2. package/src/__tests__/ui/screens/AccountSettingsScreen.test.tsx +8 -8
  3. package/src/core/index.ts +103 -0
  4. package/src/lib/sonner.ts +9 -4
  5. package/src/ui/components/OxyProvider.tsx +5 -5
  6. package/src/ui/context/OxyContext.tsx +61 -41
  7. package/src/ui/screens/AccountManagementDemo.tsx +1 -1
  8. package/src/ui/screens/AccountOverviewScreen.tsx +44 -26
  9. package/src/ui/screens/AccountSettingsScreen.tsx +25 -19
  10. package/src/ui/screens/AppInfoScreen.tsx +5 -5
  11. package/src/ui/screens/FileManagementScreen.tsx +246 -211
  12. package/src/ui/screens/SignInScreen.tsx +382 -326
  13. package/src/ui/screens/SignUpScreen.tsx +443 -273
  14. package/src/ui/screens/karma/KarmaFAQScreen.tsx +50 -29
  15. package/lib/commonjs/assets/OxyLogo.svg +0 -1
  16. package/lib/commonjs/assets/assets/OxyLogo.svg +0 -1
  17. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  18. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  19. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  20. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  21. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  22. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  23. package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  24. package/lib/commonjs/assets/assets/icons/OxyServices.tsx +0 -67
  25. package/lib/commonjs/assets/assets/icons/logo_OxyServices.svg +0 -1
  26. package/lib/commonjs/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  27. package/lib/commonjs/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  28. package/lib/commonjs/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  29. package/lib/commonjs/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  30. package/lib/commonjs/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  31. package/lib/commonjs/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  32. package/lib/commonjs/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  33. package/lib/commonjs/assets/icons/OxyServices.js +0 -53
  34. package/lib/commonjs/assets/icons/OxyServices.js.map +0 -1
  35. package/lib/commonjs/assets/icons/logo_OxyServices.svg +0 -1
  36. package/lib/commonjs/constants/version.js +0 -28
  37. package/lib/commonjs/constants/version.js.map +0 -1
  38. package/lib/commonjs/core/index.js +0 -1543
  39. package/lib/commonjs/core/index.js.map +0 -1
  40. package/lib/commonjs/index.js +0 -160
  41. package/lib/commonjs/index.js.map +0 -1
  42. package/lib/commonjs/lib/react-native-polyfills.js +0 -181
  43. package/lib/commonjs/lib/react-native-polyfills.js.map +0 -1
  44. package/lib/commonjs/lib/sonner-safe.js +0 -41
  45. package/lib/commonjs/lib/sonner-safe.js.map +0 -1
  46. package/lib/commonjs/lib/sonner.js +0 -18
  47. package/lib/commonjs/lib/sonner.js.map +0 -1
  48. package/lib/commonjs/lib/sonner.web.js +0 -17
  49. package/lib/commonjs/lib/sonner.web.js.map +0 -1
  50. package/lib/commonjs/models/interfaces.js +0 -2
  51. package/lib/commonjs/models/interfaces.js.map +0 -1
  52. package/lib/commonjs/models/secureSession.js +0 -2
  53. package/lib/commonjs/models/secureSession.js.map +0 -1
  54. package/lib/commonjs/node/index.js +0 -54
  55. package/lib/commonjs/node/index.js.map +0 -1
  56. package/lib/commonjs/package.json +0 -1
  57. package/lib/commonjs/ui/components/Avatar.js +0 -98
  58. package/lib/commonjs/ui/components/Avatar.js.map +0 -1
  59. package/lib/commonjs/ui/components/FollowButton.js +0 -246
  60. package/lib/commonjs/ui/components/FollowButton.js.map +0 -1
  61. package/lib/commonjs/ui/components/FontLoader.js +0 -181
  62. package/lib/commonjs/ui/components/FontLoader.js.map +0 -1
  63. package/lib/commonjs/ui/components/GroupedItem.js +0 -109
  64. package/lib/commonjs/ui/components/GroupedItem.js.map +0 -1
  65. package/lib/commonjs/ui/components/GroupedSection.js +0 -33
  66. package/lib/commonjs/ui/components/GroupedSection.js.map +0 -1
  67. package/lib/commonjs/ui/components/OxyLogo.js +0 -56
  68. package/lib/commonjs/ui/components/OxyLogo.js.map +0 -1
  69. package/lib/commonjs/ui/components/OxyProvider.js +0 -517
  70. package/lib/commonjs/ui/components/OxyProvider.js.map +0 -1
  71. package/lib/commonjs/ui/components/OxySignInButton.js +0 -178
  72. package/lib/commonjs/ui/components/OxySignInButton.js.map +0 -1
  73. package/lib/commonjs/ui/components/ProfileCard.js +0 -124
  74. package/lib/commonjs/ui/components/ProfileCard.js.map +0 -1
  75. package/lib/commonjs/ui/components/QuickActions.js +0 -87
  76. package/lib/commonjs/ui/components/QuickActions.js.map +0 -1
  77. package/lib/commonjs/ui/components/Section.js +0 -36
  78. package/lib/commonjs/ui/components/Section.js.map +0 -1
  79. package/lib/commonjs/ui/components/SectionTitle.js +0 -35
  80. package/lib/commonjs/ui/components/SectionTitle.js.map +0 -1
  81. package/lib/commonjs/ui/components/bottomSheet/index.js +0 -37
  82. package/lib/commonjs/ui/components/bottomSheet/index.js.map +0 -1
  83. package/lib/commonjs/ui/components/icon/OxyIcon.js +0 -27
  84. package/lib/commonjs/ui/components/icon/OxyIcon.js.map +0 -1
  85. package/lib/commonjs/ui/components/icon/index.js +0 -14
  86. package/lib/commonjs/ui/components/icon/index.js.map +0 -1
  87. package/lib/commonjs/ui/components/index.js +0 -97
  88. package/lib/commonjs/ui/components/index.js.map +0 -1
  89. package/lib/commonjs/ui/context/OxyContext.js +0 -568
  90. package/lib/commonjs/ui/context/OxyContext.js.map +0 -1
  91. package/lib/commonjs/ui/index.js +0 -128
  92. package/lib/commonjs/ui/index.js.map +0 -1
  93. package/lib/commonjs/ui/navigation/OxyRouter.js +0 -264
  94. package/lib/commonjs/ui/navigation/OxyRouter.js.map +0 -1
  95. package/lib/commonjs/ui/navigation/types.js +0 -6
  96. package/lib/commonjs/ui/navigation/types.js.map +0 -1
  97. package/lib/commonjs/ui/screens/AccountCenterScreen.js +0 -313
  98. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +0 -1
  99. package/lib/commonjs/ui/screens/AccountManagementDemo.js +0 -299
  100. package/lib/commonjs/ui/screens/AccountManagementDemo.js.map +0 -1
  101. package/lib/commonjs/ui/screens/AccountOverviewScreen.js +0 -837
  102. package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +0 -1
  103. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +0 -836
  104. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +0 -1
  105. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +0 -788
  106. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +0 -1
  107. package/lib/commonjs/ui/screens/AppInfoScreen.js +0 -664
  108. package/lib/commonjs/ui/screens/AppInfoScreen.js.map +0 -1
  109. package/lib/commonjs/ui/screens/BillingManagementScreen.js +0 -636
  110. package/lib/commonjs/ui/screens/BillingManagementScreen.js.map +0 -1
  111. package/lib/commonjs/ui/screens/FileManagementScreen.js +0 -2497
  112. package/lib/commonjs/ui/screens/FileManagementScreen.js.map +0 -1
  113. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +0 -1620
  114. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +0 -1
  115. package/lib/commonjs/ui/screens/ProfileScreen.js +0 -450
  116. package/lib/commonjs/ui/screens/ProfileScreen.js.map +0 -1
  117. package/lib/commonjs/ui/screens/SessionManagementScreen.js +0 -449
  118. package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +0 -1
  119. package/lib/commonjs/ui/screens/SignInScreen.js +0 -956
  120. package/lib/commonjs/ui/screens/SignInScreen.js.map +0 -1
  121. package/lib/commonjs/ui/screens/SignUpScreen.js +0 -762
  122. package/lib/commonjs/ui/screens/SignUpScreen.js.map +0 -1
  123. package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js +0 -88
  124. package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js.map +0 -1
  125. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +0 -364
  126. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +0 -1
  127. package/lib/commonjs/ui/screens/karma/KarmaFAQScreen.js +0 -202
  128. package/lib/commonjs/ui/screens/karma/KarmaFAQScreen.js.map +0 -1
  129. package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js +0 -148
  130. package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js.map +0 -1
  131. package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js +0 -127
  132. package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js.map +0 -1
  133. package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js +0 -105
  134. package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js.map +0 -1
  135. package/lib/commonjs/ui/styles/FONTS.md +0 -126
  136. package/lib/commonjs/ui/styles/fonts.js +0 -84
  137. package/lib/commonjs/ui/styles/fonts.js.map +0 -1
  138. package/lib/commonjs/ui/styles/index.js +0 -28
  139. package/lib/commonjs/ui/styles/index.js.map +0 -1
  140. package/lib/commonjs/ui/styles/theme.js +0 -121
  141. package/lib/commonjs/ui/styles/theme.js.map +0 -1
  142. package/lib/commonjs/utils/deviceManager.js +0 -173
  143. package/lib/commonjs/utils/deviceManager.js.map +0 -1
  144. package/lib/commonjs/utils/index.js +0 -13
  145. package/lib/commonjs/utils/index.js.map +0 -1
  146. package/lib/commonjs/utils/polyfills.js +0 -42
  147. package/lib/commonjs/utils/polyfills.js.map +0 -1
  148. package/lib/module/assets/OxyLogo.svg +0 -1
  149. package/lib/module/assets/assets/OxyLogo.svg +0 -1
  150. package/lib/module/assets/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  151. package/lib/module/assets/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  152. package/lib/module/assets/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  153. package/lib/module/assets/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  154. package/lib/module/assets/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  155. package/lib/module/assets/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  156. package/lib/module/assets/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  157. package/lib/module/assets/assets/icons/OxyServices.tsx +0 -67
  158. package/lib/module/assets/assets/icons/logo_OxyServices.svg +0 -1
  159. package/lib/module/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
  160. package/lib/module/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
  161. package/lib/module/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
  162. package/lib/module/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
  163. package/lib/module/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
  164. package/lib/module/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
  165. package/lib/module/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
  166. package/lib/module/assets/icons/OxyServices.js +0 -46
  167. package/lib/module/assets/icons/OxyServices.js.map +0 -1
  168. package/lib/module/assets/icons/logo_OxyServices.svg +0 -1
  169. package/lib/module/constants/version.js +0 -21
  170. package/lib/module/constants/version.js.map +0 -1
  171. package/lib/module/core/index.js +0 -1517
  172. package/lib/module/core/index.js.map +0 -1
  173. package/lib/module/index.js +0 -48
  174. package/lib/module/index.js.map +0 -1
  175. package/lib/module/lib/react-native-polyfills.js +0 -179
  176. package/lib/module/lib/react-native-polyfills.js.map +0 -1
  177. package/lib/module/lib/sonner-safe.js +0 -37
  178. package/lib/module/lib/sonner-safe.js.map +0 -1
  179. package/lib/module/lib/sonner.js +0 -8
  180. package/lib/module/lib/sonner.js.map +0 -1
  181. package/lib/module/lib/sonner.web.js +0 -4
  182. package/lib/module/lib/sonner.web.js.map +0 -1
  183. package/lib/module/models/interfaces.js +0 -2
  184. package/lib/module/models/interfaces.js.map +0 -1
  185. package/lib/module/models/secureSession.js +0 -2
  186. package/lib/module/models/secureSession.js.map +0 -1
  187. package/lib/module/node/index.js +0 -23
  188. package/lib/module/node/index.js.map +0 -1
  189. package/lib/module/package.json +0 -1
  190. package/lib/module/ui/components/Avatar.js +0 -93
  191. package/lib/module/ui/components/Avatar.js.map +0 -1
  192. package/lib/module/ui/components/FollowButton.js +0 -241
  193. package/lib/module/ui/components/FollowButton.js.map +0 -1
  194. package/lib/module/ui/components/FontLoader.js +0 -176
  195. package/lib/module/ui/components/FontLoader.js.map +0 -1
  196. package/lib/module/ui/components/GroupedItem.js +0 -104
  197. package/lib/module/ui/components/GroupedItem.js.map +0 -1
  198. package/lib/module/ui/components/GroupedSection.js +0 -28
  199. package/lib/module/ui/components/GroupedSection.js.map +0 -1
  200. package/lib/module/ui/components/OxyLogo.js +0 -49
  201. package/lib/module/ui/components/OxyLogo.js.map +0 -1
  202. package/lib/module/ui/components/OxyProvider.js +0 -511
  203. package/lib/module/ui/components/OxyProvider.js.map +0 -1
  204. package/lib/module/ui/components/OxySignInButton.js +0 -172
  205. package/lib/module/ui/components/OxySignInButton.js.map +0 -1
  206. package/lib/module/ui/components/ProfileCard.js +0 -119
  207. package/lib/module/ui/components/ProfileCard.js.map +0 -1
  208. package/lib/module/ui/components/QuickActions.js +0 -82
  209. package/lib/module/ui/components/QuickActions.js.map +0 -1
  210. package/lib/module/ui/components/Section.js +0 -31
  211. package/lib/module/ui/components/Section.js.map +0 -1
  212. package/lib/module/ui/components/SectionTitle.js +0 -30
  213. package/lib/module/ui/components/SectionTitle.js.map +0 -1
  214. package/lib/module/ui/components/bottomSheet/index.js +0 -5
  215. package/lib/module/ui/components/bottomSheet/index.js.map +0 -1
  216. package/lib/module/ui/components/icon/OxyIcon.js +0 -22
  217. package/lib/module/ui/components/icon/OxyIcon.js.map +0 -1
  218. package/lib/module/ui/components/icon/index.js +0 -4
  219. package/lib/module/ui/components/icon/index.js.map +0 -1
  220. package/lib/module/ui/components/index.js +0 -18
  221. package/lib/module/ui/components/index.js.map +0 -1
  222. package/lib/module/ui/context/OxyContext.js +0 -563
  223. package/lib/module/ui/context/OxyContext.js.map +0 -1
  224. package/lib/module/ui/index.js +0 -24
  225. package/lib/module/ui/index.js.map +0 -1
  226. package/lib/module/ui/navigation/OxyRouter.js +0 -257
  227. package/lib/module/ui/navigation/OxyRouter.js.map +0 -1
  228. package/lib/module/ui/navigation/types.js +0 -4
  229. package/lib/module/ui/navigation/types.js.map +0 -1
  230. package/lib/module/ui/screens/AccountCenterScreen.js +0 -308
  231. package/lib/module/ui/screens/AccountCenterScreen.js.map +0 -1
  232. package/lib/module/ui/screens/AccountManagementDemo.js +0 -296
  233. package/lib/module/ui/screens/AccountManagementDemo.js.map +0 -1
  234. package/lib/module/ui/screens/AccountOverviewScreen.js +0 -831
  235. package/lib/module/ui/screens/AccountOverviewScreen.js.map +0 -1
  236. package/lib/module/ui/screens/AccountSettingsScreen.js +0 -830
  237. package/lib/module/ui/screens/AccountSettingsScreen.js.map +0 -1
  238. package/lib/module/ui/screens/AccountSwitcherScreen.js +0 -782
  239. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +0 -1
  240. package/lib/module/ui/screens/AppInfoScreen.js +0 -658
  241. package/lib/module/ui/screens/AppInfoScreen.js.map +0 -1
  242. package/lib/module/ui/screens/BillingManagementScreen.js +0 -631
  243. package/lib/module/ui/screens/BillingManagementScreen.js.map +0 -1
  244. package/lib/module/ui/screens/FileManagementScreen.js +0 -2492
  245. package/lib/module/ui/screens/FileManagementScreen.js.map +0 -1
  246. package/lib/module/ui/screens/PremiumSubscriptionScreen.js +0 -1615
  247. package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +0 -1
  248. package/lib/module/ui/screens/ProfileScreen.js +0 -444
  249. package/lib/module/ui/screens/ProfileScreen.js.map +0 -1
  250. package/lib/module/ui/screens/SessionManagementScreen.js +0 -444
  251. package/lib/module/ui/screens/SessionManagementScreen.js.map +0 -1
  252. package/lib/module/ui/screens/SignInScreen.js +0 -950
  253. package/lib/module/ui/screens/SignInScreen.js.map +0 -1
  254. package/lib/module/ui/screens/SignUpScreen.js +0 -755
  255. package/lib/module/ui/screens/SignUpScreen.js.map +0 -1
  256. package/lib/module/ui/screens/karma/KarmaAboutScreen.js +0 -83
  257. package/lib/module/ui/screens/karma/KarmaAboutScreen.js.map +0 -1
  258. package/lib/module/ui/screens/karma/KarmaCenterScreen.js +0 -358
  259. package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +0 -1
  260. package/lib/module/ui/screens/karma/KarmaFAQScreen.js +0 -197
  261. package/lib/module/ui/screens/karma/KarmaFAQScreen.js.map +0 -1
  262. package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js +0 -142
  263. package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js.map +0 -1
  264. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js +0 -122
  265. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js.map +0 -1
  266. package/lib/module/ui/screens/karma/KarmaRulesScreen.js +0 -100
  267. package/lib/module/ui/screens/karma/KarmaRulesScreen.js.map +0 -1
  268. package/lib/module/ui/styles/FONTS.md +0 -126
  269. package/lib/module/ui/styles/fonts.js +0 -81
  270. package/lib/module/ui/styles/fonts.js.map +0 -1
  271. package/lib/module/ui/styles/index.js +0 -5
  272. package/lib/module/ui/styles/index.js.map +0 -1
  273. package/lib/module/ui/styles/theme.js +0 -114
  274. package/lib/module/ui/styles/theme.js.map +0 -1
  275. package/lib/module/utils/deviceManager.js +0 -167
  276. package/lib/module/utils/deviceManager.js.map +0 -1
  277. package/lib/module/utils/index.js +0 -4
  278. package/lib/module/utils/index.js.map +0 -1
  279. package/lib/module/utils/polyfills.js +0 -36
  280. package/lib/module/utils/polyfills.js.map +0 -1
  281. package/lib/typescript/assets/icons/OxyServices.d.ts +0 -29
  282. package/lib/typescript/assets/icons/OxyServices.d.ts.map +0 -1
  283. package/lib/typescript/constants/version.d.ts +0 -14
  284. package/lib/typescript/constants/version.d.ts.map +0 -1
  285. package/lib/typescript/core/index.d.ts +0 -563
  286. package/lib/typescript/core/index.d.ts.map +0 -1
  287. package/lib/typescript/index.d.ts +0 -20
  288. package/lib/typescript/index.d.ts.map +0 -1
  289. package/lib/typescript/lib/react-native-polyfills.d.ts +0 -8
  290. package/lib/typescript/lib/react-native-polyfills.d.ts.map +0 -1
  291. package/lib/typescript/lib/sonner-safe.d.ts +0 -11
  292. package/lib/typescript/lib/sonner-safe.d.ts.map +0 -1
  293. package/lib/typescript/lib/sonner.d.ts +0 -3
  294. package/lib/typescript/lib/sonner.d.ts.map +0 -1
  295. package/lib/typescript/lib/sonner.web.d.ts +0 -2
  296. package/lib/typescript/lib/sonner.web.d.ts.map +0 -1
  297. package/lib/typescript/models/interfaces.d.ts +0 -179
  298. package/lib/typescript/models/interfaces.d.ts.map +0 -1
  299. package/lib/typescript/models/secureSession.d.ts +0 -27
  300. package/lib/typescript/models/secureSession.d.ts.map +0 -1
  301. package/lib/typescript/node/index.d.ts +0 -11
  302. package/lib/typescript/node/index.d.ts.map +0 -1
  303. package/lib/typescript/ui/components/Avatar.d.ts +0 -62
  304. package/lib/typescript/ui/components/Avatar.d.ts.map +0 -1
  305. package/lib/typescript/ui/components/FollowButton.d.ts +0 -92
  306. package/lib/typescript/ui/components/FollowButton.d.ts.map +0 -1
  307. package/lib/typescript/ui/components/FontLoader.d.ts +0 -15
  308. package/lib/typescript/ui/components/FontLoader.d.ts.map +0 -1
  309. package/lib/typescript/ui/components/GroupedItem.d.ts +0 -17
  310. package/lib/typescript/ui/components/GroupedItem.d.ts.map +0 -1
  311. package/lib/typescript/ui/components/GroupedSection.d.ts +0 -19
  312. package/lib/typescript/ui/components/GroupedSection.d.ts.map +0 -1
  313. package/lib/typescript/ui/components/OxyLogo.d.ts +0 -29
  314. package/lib/typescript/ui/components/OxyLogo.d.ts.map +0 -1
  315. package/lib/typescript/ui/components/OxyProvider.d.ts +0 -12
  316. package/lib/typescript/ui/components/OxyProvider.d.ts.map +0 -1
  317. package/lib/typescript/ui/components/OxySignInButton.d.ts +0 -70
  318. package/lib/typescript/ui/components/OxySignInButton.d.ts.map +0 -1
  319. package/lib/typescript/ui/components/ProfileCard.d.ts +0 -20
  320. package/lib/typescript/ui/components/ProfileCard.d.ts.map +0 -1
  321. package/lib/typescript/ui/components/QuickActions.d.ts +0 -15
  322. package/lib/typescript/ui/components/QuickActions.d.ts.map +0 -1
  323. package/lib/typescript/ui/components/Section.d.ts +0 -11
  324. package/lib/typescript/ui/components/Section.d.ts.map +0 -1
  325. package/lib/typescript/ui/components/SectionTitle.d.ts +0 -9
  326. package/lib/typescript/ui/components/SectionTitle.d.ts.map +0 -1
  327. package/lib/typescript/ui/components/bottomSheet/index.d.ts +0 -4
  328. package/lib/typescript/ui/components/bottomSheet/index.d.ts.map +0 -1
  329. package/lib/typescript/ui/components/icon/OxyIcon.d.ts +0 -10
  330. package/lib/typescript/ui/components/icon/OxyIcon.d.ts.map +0 -1
  331. package/lib/typescript/ui/components/icon/index.d.ts +0 -3
  332. package/lib/typescript/ui/components/icon/index.d.ts.map +0 -1
  333. package/lib/typescript/ui/components/index.d.ts +0 -13
  334. package/lib/typescript/ui/components/index.d.ts.map +0 -1
  335. package/lib/typescript/ui/context/OxyContext.d.ts +0 -42
  336. package/lib/typescript/ui/context/OxyContext.d.ts.map +0 -1
  337. package/lib/typescript/ui/index.d.ts +0 -15
  338. package/lib/typescript/ui/index.d.ts.map +0 -1
  339. package/lib/typescript/ui/navigation/OxyRouter.d.ts +0 -5
  340. package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +0 -1
  341. package/lib/typescript/ui/navigation/types.d.ts +0 -116
  342. package/lib/typescript/ui/navigation/types.d.ts.map +0 -1
  343. package/lib/typescript/ui/screens/AccountCenterScreen.d.ts +0 -5
  344. package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +0 -1
  345. package/lib/typescript/ui/screens/AccountManagementDemo.d.ts +0 -8
  346. package/lib/typescript/ui/screens/AccountManagementDemo.d.ts.map +0 -1
  347. package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts +0 -5
  348. package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +0 -1
  349. package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts +0 -5
  350. package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +0 -1
  351. package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts +0 -5
  352. package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts.map +0 -1
  353. package/lib/typescript/ui/screens/AppInfoScreen.d.ts +0 -5
  354. package/lib/typescript/ui/screens/AppInfoScreen.d.ts.map +0 -1
  355. package/lib/typescript/ui/screens/BillingManagementScreen.d.ts +0 -5
  356. package/lib/typescript/ui/screens/BillingManagementScreen.d.ts.map +0 -1
  357. package/lib/typescript/ui/screens/FileManagementScreen.d.ts +0 -8
  358. package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +0 -1
  359. package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts +0 -5
  360. package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts.map +0 -1
  361. package/lib/typescript/ui/screens/ProfileScreen.d.ts +0 -9
  362. package/lib/typescript/ui/screens/ProfileScreen.d.ts.map +0 -1
  363. package/lib/typescript/ui/screens/SessionManagementScreen.d.ts +0 -5
  364. package/lib/typescript/ui/screens/SessionManagementScreen.d.ts.map +0 -1
  365. package/lib/typescript/ui/screens/SignInScreen.d.ts +0 -5
  366. package/lib/typescript/ui/screens/SignInScreen.d.ts.map +0 -1
  367. package/lib/typescript/ui/screens/SignUpScreen.d.ts +0 -5
  368. package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +0 -1
  369. package/lib/typescript/ui/screens/karma/KarmaAboutScreen.d.ts +0 -5
  370. package/lib/typescript/ui/screens/karma/KarmaAboutScreen.d.ts.map +0 -1
  371. package/lib/typescript/ui/screens/karma/KarmaCenterScreen.d.ts +0 -5
  372. package/lib/typescript/ui/screens/karma/KarmaCenterScreen.d.ts.map +0 -1
  373. package/lib/typescript/ui/screens/karma/KarmaFAQScreen.d.ts +0 -5
  374. package/lib/typescript/ui/screens/karma/KarmaFAQScreen.d.ts.map +0 -1
  375. package/lib/typescript/ui/screens/karma/KarmaLeaderboardScreen.d.ts +0 -5
  376. package/lib/typescript/ui/screens/karma/KarmaLeaderboardScreen.d.ts.map +0 -1
  377. package/lib/typescript/ui/screens/karma/KarmaRewardsScreen.d.ts +0 -5
  378. package/lib/typescript/ui/screens/karma/KarmaRewardsScreen.d.ts.map +0 -1
  379. package/lib/typescript/ui/screens/karma/KarmaRulesScreen.d.ts +0 -5
  380. package/lib/typescript/ui/screens/karma/KarmaRulesScreen.d.ts.map +0 -1
  381. package/lib/typescript/ui/styles/fonts.d.ts +0 -21
  382. package/lib/typescript/ui/styles/fonts.d.ts.map +0 -1
  383. package/lib/typescript/ui/styles/index.d.ts +0 -3
  384. package/lib/typescript/ui/styles/index.d.ts.map +0 -1
  385. package/lib/typescript/ui/styles/theme.d.ts +0 -68
  386. package/lib/typescript/ui/styles/theme.d.ts.map +0 -1
  387. package/lib/typescript/utils/deviceManager.d.ts +0 -66
  388. package/lib/typescript/utils/deviceManager.d.ts.map +0 -1
  389. package/lib/typescript/utils/index.d.ts +0 -3
  390. package/lib/typescript/utils/index.d.ts.map +0 -1
  391. package/lib/typescript/utils/polyfills.d.ts +0 -6
  392. package/lib/typescript/utils/polyfills.d.ts.map +0 -1
  393. package/src/lib/react-native-polyfills.ts +0 -219
  394. package/src/lib/sonner-safe.ts +0 -37
  395. package/src/lib/sonner.web.ts +0 -1
@@ -1,97 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Avatar", {
7
- enumerable: true,
8
- get: function () {
9
- return _Avatar.default;
10
- }
11
- });
12
- Object.defineProperty(exports, "FollowButton", {
13
- enumerable: true,
14
- get: function () {
15
- return _FollowButton.default;
16
- }
17
- });
18
- Object.defineProperty(exports, "FontLoader", {
19
- enumerable: true,
20
- get: function () {
21
- return _FontLoader.FontLoader;
22
- }
23
- });
24
- Object.defineProperty(exports, "GroupedItem", {
25
- enumerable: true,
26
- get: function () {
27
- return _GroupedItem.default;
28
- }
29
- });
30
- Object.defineProperty(exports, "GroupedSection", {
31
- enumerable: true,
32
- get: function () {
33
- return _GroupedSection.default;
34
- }
35
- });
36
- Object.defineProperty(exports, "OxyLogo", {
37
- enumerable: true,
38
- get: function () {
39
- return _OxyLogo.default;
40
- }
41
- });
42
- Object.defineProperty(exports, "OxyProvider", {
43
- enumerable: true,
44
- get: function () {
45
- return _OxyProvider.default;
46
- }
47
- });
48
- Object.defineProperty(exports, "OxySignInButton", {
49
- enumerable: true,
50
- get: function () {
51
- return _OxySignInButton.default;
52
- }
53
- });
54
- Object.defineProperty(exports, "ProfileCard", {
55
- enumerable: true,
56
- get: function () {
57
- return _ProfileCard.default;
58
- }
59
- });
60
- Object.defineProperty(exports, "QuickActions", {
61
- enumerable: true,
62
- get: function () {
63
- return _QuickActions.default;
64
- }
65
- });
66
- Object.defineProperty(exports, "Section", {
67
- enumerable: true,
68
- get: function () {
69
- return _Section.default;
70
- }
71
- });
72
- Object.defineProperty(exports, "SectionTitle", {
73
- enumerable: true,
74
- get: function () {
75
- return _SectionTitle.default;
76
- }
77
- });
78
- Object.defineProperty(exports, "setupFonts", {
79
- enumerable: true,
80
- get: function () {
81
- return _FontLoader.setupFonts;
82
- }
83
- });
84
- var _ProfileCard = _interopRequireDefault(require("./ProfileCard"));
85
- var _Section = _interopRequireDefault(require("./Section"));
86
- var _SectionTitle = _interopRequireDefault(require("./SectionTitle"));
87
- var _GroupedItem = _interopRequireDefault(require("./GroupedItem"));
88
- var _GroupedSection = _interopRequireDefault(require("./GroupedSection"));
89
- var _QuickActions = _interopRequireDefault(require("./QuickActions"));
90
- var _Avatar = _interopRequireDefault(require("./Avatar"));
91
- var _FollowButton = _interopRequireDefault(require("./FollowButton"));
92
- var _FontLoader = require("./FontLoader");
93
- var _OxyLogo = _interopRequireDefault(require("./OxyLogo"));
94
- var _OxyProvider = _interopRequireDefault(require("./OxyProvider"));
95
- var _OxySignInButton = _interopRequireDefault(require("./OxySignInButton"));
96
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
97
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_ProfileCard","_interopRequireDefault","require","_Section","_SectionTitle","_GroupedItem","_GroupedSection","_QuickActions","_Avatar","_FollowButton","_FontLoader","_OxyLogo","_OxyProvider","_OxySignInButton","e","__esModule","default"],"sourceRoot":"../../../../src","sources":["ui/components/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,YAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,aAAA,GAAAN,sBAAA,CAAAC,OAAA;AAGA,IAAAM,OAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,aAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,YAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,gBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AAA+D,SAAAD,uBAAAa,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
@@ -1,568 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useOxy = exports.default = exports.OxyContextProvider = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _deviceManager = require("../../utils/deviceManager");
9
- var _jsxRuntime = require("react/jsx-runtime");
10
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } // Define the context shape
11
- // Create the context with default values
12
- const OxyContext = /*#__PURE__*/(0, _react.createContext)(null);
13
-
14
- // Props for the OxyContextProvider
15
-
16
- // Platform storage implementation
17
-
18
- // Web localStorage implementation
19
- class WebStorage {
20
- async getItem(key) {
21
- return localStorage.getItem(key);
22
- }
23
- async setItem(key, value) {
24
- localStorage.setItem(key, value);
25
- }
26
- async removeItem(key) {
27
- localStorage.removeItem(key);
28
- }
29
- async clear() {
30
- localStorage.clear();
31
- }
32
- }
33
-
34
- // React Native AsyncStorage implementation
35
- let AsyncStorage;
36
-
37
- // Determine the platform and set up storage
38
- const isReactNative = () => {
39
- return typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
40
- };
41
-
42
- // Get appropriate storage for the platform
43
- const getStorage = async () => {
44
- if (isReactNative()) {
45
- if (!AsyncStorage) {
46
- try {
47
- const asyncStorageModule = await Promise.resolve().then(() => _interopRequireWildcard(require('@react-native-async-storage/async-storage')));
48
- AsyncStorage = asyncStorageModule.default;
49
- } catch (error) {
50
- console.error('Failed to import AsyncStorage:', error);
51
- throw new Error('AsyncStorage is required in React Native environment');
52
- }
53
- }
54
- return AsyncStorage;
55
- }
56
- return new WebStorage();
57
- };
58
-
59
- // Storage keys for secure sessions
60
- const getSecureStorageKeys = (prefix = 'oxy_secure') => ({
61
- sessions: `${prefix}_sessions`,
62
- // Array of SecureClientSession objects
63
- activeSessionId: `${prefix}_active_session_id` // ID of currently active session
64
- });
65
- const OxyContextProvider = ({
66
- children,
67
- oxyServices,
68
- storageKeyPrefix = 'oxy_secure',
69
- onAuthStateChange,
70
- bottomSheetRef
71
- }) => {
72
- // Authentication state
73
- const [user, setUser] = (0, _react.useState)(null);
74
- const [minimalUser, setMinimalUser] = (0, _react.useState)(null);
75
- const [sessions, setSessions] = (0, _react.useState)([]);
76
- const [activeSessionId, setActiveSessionId] = (0, _react.useState)(null);
77
- const [isLoading, setIsLoading] = (0, _react.useState)(true);
78
- const [error, setError] = (0, _react.useState)(null);
79
- const [storage, setStorage] = (0, _react.useState)(null);
80
-
81
- // Storage keys (memoized to prevent infinite loops)
82
- const keys = (0, _react.useMemo)(() => getSecureStorageKeys(storageKeyPrefix), [storageKeyPrefix]);
83
-
84
- // Initialize storage
85
- (0, _react.useEffect)(() => {
86
- const initStorage = async () => {
87
- try {
88
- const platformStorage = await getStorage();
89
- setStorage(platformStorage);
90
- } catch (error) {
91
- console.error('Failed to initialize storage:', error);
92
- setError('Failed to initialize storage');
93
- }
94
- };
95
- initStorage();
96
- }, []);
97
-
98
- // Effect to initialize authentication state
99
- (0, _react.useEffect)(() => {
100
- const initAuth = async () => {
101
- if (!storage) return;
102
- setIsLoading(true);
103
- try {
104
- // Load stored sessions
105
- const sessionsData = await storage.getItem(keys.sessions);
106
- const storedActiveSessionId = await storage.getItem(keys.activeSessionId);
107
- console.log('SecureAuth - sessionsData:', sessionsData);
108
- console.log('SecureAuth - activeSessionId:', storedActiveSessionId);
109
- if (sessionsData) {
110
- const parsedSessions = JSON.parse(sessionsData);
111
-
112
- // Migrate old session format to include user info
113
- const migratedSessions = [];
114
- let shouldUpdateStorage = false;
115
- for (const session of parsedSessions) {
116
- if (!session.userId || !session.username) {
117
- // Session is missing user info, try to fetch it
118
- try {
119
- const sessionUser = await oxyServices.getUserBySession(session.sessionId);
120
- migratedSessions.push({
121
- ...session,
122
- userId: sessionUser.id,
123
- username: sessionUser.username
124
- });
125
- shouldUpdateStorage = true;
126
- console.log(`Migrated session ${session.sessionId} for user ${sessionUser.username}`);
127
- } catch (error) {
128
- // Session might be invalid, skip it
129
- console.log(`Removing invalid session ${session.sessionId}:`, error);
130
- shouldUpdateStorage = true;
131
- }
132
- } else {
133
- // Session already has user info
134
- migratedSessions.push(session);
135
- }
136
- }
137
-
138
- // Update storage if we made changes
139
- if (shouldUpdateStorage) {
140
- await saveSessionsToStorage(migratedSessions);
141
- }
142
- setSessions(migratedSessions);
143
- if (storedActiveSessionId && migratedSessions.length > 0) {
144
- const activeSession = migratedSessions.find(s => s.sessionId === storedActiveSessionId);
145
- if (activeSession) {
146
- console.log('SecureAuth - activeSession found:', activeSession);
147
-
148
- // Validate session
149
- try {
150
- const validation = await oxyServices.validateSession(activeSession.sessionId);
151
- if (validation.valid) {
152
- console.log('SecureAuth - session validated successfully');
153
- setActiveSessionId(activeSession.sessionId);
154
-
155
- // Get access token for API calls
156
- await oxyServices.getTokenBySession(activeSession.sessionId);
157
-
158
- // Load full user data
159
- const fullUser = await oxyServices.getUserBySession(activeSession.sessionId);
160
- setUser(fullUser);
161
- setMinimalUser({
162
- id: fullUser.id,
163
- username: fullUser.username,
164
- avatar: fullUser.avatar
165
- });
166
- if (onAuthStateChange) {
167
- onAuthStateChange(fullUser);
168
- }
169
- } else {
170
- console.log('SecureAuth - session invalid, removing');
171
- await removeInvalidSession(activeSession.sessionId);
172
- }
173
- } catch (error) {
174
- console.error('SecureAuth - session validation error:', error);
175
- await removeInvalidSession(activeSession.sessionId);
176
- }
177
- }
178
- }
179
- }
180
- } catch (err) {
181
- console.error('Secure auth initialization error:', err);
182
- await clearAllStorage();
183
- } finally {
184
- setIsLoading(false);
185
- }
186
- };
187
- if (storage) {
188
- initAuth();
189
- }
190
- }, [storage, oxyServices, keys, onAuthStateChange]);
191
-
192
- // Remove invalid session
193
- const removeInvalidSession = (0, _react.useCallback)(async sessionId => {
194
- const filteredSessions = sessions.filter(s => s.sessionId !== sessionId);
195
- setSessions(filteredSessions);
196
- await saveSessionsToStorage(filteredSessions);
197
-
198
- // If there are other sessions, switch to the first one
199
- if (filteredSessions.length > 0) {
200
- await switchToSession(filteredSessions[0].sessionId);
201
- } else {
202
- // No valid sessions left
203
- setActiveSessionId(null);
204
- setUser(null);
205
- setMinimalUser(null);
206
- await storage?.removeItem(keys.activeSessionId);
207
- if (onAuthStateChange) {
208
- onAuthStateChange(null);
209
- }
210
- }
211
- }, [sessions, storage, keys, onAuthStateChange]);
212
-
213
- // Save sessions to storage
214
- const saveSessionsToStorage = (0, _react.useCallback)(async sessionsList => {
215
- if (!storage) return;
216
- await storage.setItem(keys.sessions, JSON.stringify(sessionsList));
217
- }, [storage, keys.sessions]);
218
-
219
- // Save active session ID to storage
220
- const saveActiveSessionId = (0, _react.useCallback)(async sessionId => {
221
- if (!storage) return;
222
- await storage.setItem(keys.activeSessionId, sessionId);
223
- }, [storage, keys.activeSessionId]);
224
-
225
- // Clear all storage
226
- const clearAllStorage = (0, _react.useCallback)(async () => {
227
- if (!storage) return;
228
- try {
229
- await storage.removeItem(keys.sessions);
230
- await storage.removeItem(keys.activeSessionId);
231
- } catch (err) {
232
- console.error('Clear secure storage error:', err);
233
- }
234
- }, [storage, keys]);
235
-
236
- // Switch to a different session
237
- const switchToSession = (0, _react.useCallback)(async sessionId => {
238
- try {
239
- setIsLoading(true);
240
-
241
- // Get access token for this session
242
- await oxyServices.getTokenBySession(sessionId);
243
-
244
- // Load full user data
245
- const fullUser = await oxyServices.getUserBySession(sessionId);
246
- setActiveSessionId(sessionId);
247
- setUser(fullUser);
248
- setMinimalUser({
249
- id: fullUser.id,
250
- username: fullUser.username,
251
- avatar: fullUser.avatar
252
- });
253
- await saveActiveSessionId(sessionId);
254
- if (onAuthStateChange) {
255
- onAuthStateChange(fullUser);
256
- }
257
- } catch (error) {
258
- console.error('Switch session error:', error);
259
- setError('Failed to switch session');
260
- } finally {
261
- setIsLoading(false);
262
- }
263
- }, [oxyServices, onAuthStateChange, saveActiveSessionId]);
264
-
265
- // Secure login method
266
- const login = async (username, password, deviceName) => {
267
- if (!storage) throw new Error('Storage not initialized');
268
- setIsLoading(true);
269
- setError(null);
270
- try {
271
- // Get device fingerprint for enhanced device identification
272
- const deviceFingerprint = _deviceManager.DeviceManager.getDeviceFingerprint();
273
-
274
- // Get or generate persistent device info
275
- const deviceInfo = await _deviceManager.DeviceManager.getDeviceInfo();
276
- console.log('SecureAuth - Using device fingerprint:', deviceFingerprint);
277
- console.log('SecureAuth - Using device ID:', deviceInfo.deviceId);
278
- const response = await oxyServices.secureLogin(username, password, deviceName || deviceInfo.deviceName || _deviceManager.DeviceManager.getDefaultDeviceName(), deviceFingerprint);
279
-
280
- // Create client session object with user info for duplicate detection
281
- const clientSession = {
282
- sessionId: response.sessionId,
283
- deviceId: response.deviceId,
284
- expiresAt: response.expiresAt,
285
- lastActive: new Date().toISOString(),
286
- userId: response.user.id,
287
- username: response.user.username
288
- };
289
-
290
- // Check if this user already has a session (prevent duplicate accounts)
291
- const existingUserSessionIndex = sessions.findIndex(s => s.userId === response.user.id || s.username === response.user.username);
292
- let updatedSessions;
293
- if (existingUserSessionIndex !== -1) {
294
- // User already has a session - replace it with the new one (reused session scenario)
295
- const existingSession = sessions[existingUserSessionIndex];
296
- updatedSessions = [...sessions];
297
- updatedSessions[existingUserSessionIndex] = clientSession;
298
- console.log(`Reusing/updating existing session for user ${response.user.username}. Previous session: ${existingSession.sessionId}, New session: ${response.sessionId}`);
299
-
300
- // If the replaced session was the active one, update active session
301
- if (activeSessionId === existingSession.sessionId) {
302
- setActiveSessionId(response.sessionId);
303
- await saveActiveSessionId(response.sessionId);
304
- }
305
- } else {
306
- // Add new session for new user
307
- updatedSessions = [...sessions, clientSession];
308
- console.log(`Added new session for user ${response.user.username} on device ${response.deviceId}`);
309
- }
310
- setSessions(updatedSessions);
311
- await saveSessionsToStorage(updatedSessions);
312
-
313
- // Set as active session
314
- setActiveSessionId(response.sessionId);
315
- await saveActiveSessionId(response.sessionId);
316
-
317
- // Get access token for API calls
318
- await oxyServices.getTokenBySession(response.sessionId);
319
-
320
- // Load full user data
321
- const fullUser = await oxyServices.getUserBySession(response.sessionId);
322
- setUser(fullUser);
323
- setMinimalUser(response.user);
324
- if (onAuthStateChange) {
325
- onAuthStateChange(fullUser);
326
- }
327
- return fullUser;
328
- } catch (error) {
329
- setError(error.message || 'Login failed');
330
- throw error;
331
- } finally {
332
- setIsLoading(false);
333
- }
334
- };
335
-
336
- // Logout method
337
- const logout = async targetSessionId => {
338
- if (!activeSessionId) return;
339
- try {
340
- const sessionToLogout = targetSessionId || activeSessionId;
341
- await oxyServices.logoutSecureSession(activeSessionId, sessionToLogout);
342
-
343
- // Remove session from local storage
344
- const filteredSessions = sessions.filter(s => s.sessionId !== sessionToLogout);
345
- setSessions(filteredSessions);
346
- await saveSessionsToStorage(filteredSessions);
347
-
348
- // If logging out active session
349
- if (sessionToLogout === activeSessionId) {
350
- if (filteredSessions.length > 0) {
351
- // Switch to another session
352
- await switchToSession(filteredSessions[0].sessionId);
353
- } else {
354
- // No sessions left
355
- setActiveSessionId(null);
356
- setUser(null);
357
- setMinimalUser(null);
358
- await storage?.removeItem(keys.activeSessionId);
359
- if (onAuthStateChange) {
360
- onAuthStateChange(null);
361
- }
362
- }
363
- }
364
- } catch (error) {
365
- console.error('Logout error:', error);
366
- setError('Logout failed');
367
- }
368
- };
369
-
370
- // Logout all sessions
371
- const logoutAll = async () => {
372
- console.log('logoutAll called with activeSessionId:', activeSessionId);
373
- if (!activeSessionId) {
374
- console.error('No active session ID found, cannot logout all');
375
- setError('No active session found');
376
- throw new Error('No active session found');
377
- }
378
- if (!oxyServices) {
379
- console.error('OxyServices not initialized');
380
- setError('Service not available');
381
- throw new Error('Service not available');
382
- }
383
- try {
384
- console.log('Calling oxyServices.logoutAllSecureSessions with sessionId:', activeSessionId);
385
- await oxyServices.logoutAllSecureSessions(activeSessionId);
386
- console.log('logoutAllSecureSessions completed successfully');
387
-
388
- // Clear all local data
389
- setSessions([]);
390
- setActiveSessionId(null);
391
- setUser(null);
392
- setMinimalUser(null);
393
- await clearAllStorage();
394
- console.log('Local storage cleared');
395
- if (onAuthStateChange) {
396
- onAuthStateChange(null);
397
- console.log('Auth state change callback called');
398
- }
399
- } catch (error) {
400
- console.error('Logout all error:', error);
401
- setError(`Logout all failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
402
- throw error;
403
- }
404
- };
405
-
406
- // Sign up method (placeholder - you can implement based on your needs)
407
- const signUp = async (username, email, password) => {
408
- // Implement sign up logic similar to secureLogin
409
- throw new Error('Sign up not implemented yet');
410
- };
411
-
412
- // Switch session method
413
- const switchSession = async sessionId => {
414
- await switchToSession(sessionId);
415
- };
416
-
417
- // Remove session method
418
- const removeSession = async sessionId => {
419
- await logout(sessionId);
420
- };
421
-
422
- // Refresh sessions method
423
- const refreshSessions = async () => {
424
- if (!activeSessionId) return;
425
- try {
426
- const serverSessions = await oxyServices.getSessionsBySessionId(activeSessionId);
427
-
428
- // Update local sessions with server data
429
- const updatedSessions = serverSessions.map(serverSession => ({
430
- sessionId: serverSession.sessionId,
431
- deviceId: serverSession.deviceId,
432
- expiresAt: new Date().toISOString(),
433
- // You might want to get this from server
434
- lastActive: new Date().toISOString()
435
- }));
436
- setSessions(updatedSessions);
437
- await saveSessionsToStorage(updatedSessions);
438
- } catch (error) {
439
- console.error('Refresh sessions error:', error);
440
- }
441
- };
442
-
443
- // Device management methods
444
- const getDeviceSessions = async () => {
445
- if (!activeSessionId) throw new Error('No active session');
446
- try {
447
- return await oxyServices.getDeviceSessions(activeSessionId);
448
- } catch (error) {
449
- console.error('Get device sessions error:', error);
450
- throw error;
451
- }
452
- };
453
- const logoutAllDeviceSessions = async () => {
454
- if (!activeSessionId) throw new Error('No active session');
455
- try {
456
- await oxyServices.logoutAllDeviceSessions(activeSessionId);
457
-
458
- // Clear all local sessions since we logged out from all devices
459
- setSessions([]);
460
- setActiveSessionId(null);
461
- setUser(null);
462
- setMinimalUser(null);
463
- await clearAllStorage();
464
- if (onAuthStateChange) {
465
- onAuthStateChange(null);
466
- }
467
- } catch (error) {
468
- console.error('Logout all device sessions error:', error);
469
- throw error;
470
- }
471
- };
472
- const updateDeviceName = async deviceName => {
473
- if (!activeSessionId) throw new Error('No active session');
474
- try {
475
- await oxyServices.updateDeviceName(activeSessionId, deviceName);
476
-
477
- // Update local device info
478
- await _deviceManager.DeviceManager.updateDeviceName(deviceName);
479
- } catch (error) {
480
- console.error('Update device name error:', error);
481
- throw error;
482
- }
483
- };
484
-
485
- // Bottom sheet control methods
486
- const showBottomSheet = (0, _react.useCallback)(screenOrConfig => {
487
- console.log('showBottomSheet called with:', screenOrConfig);
488
- if (bottomSheetRef?.current) {
489
- console.log('bottomSheetRef is available');
490
-
491
- // First, show the bottom sheet
492
- if (bottomSheetRef.current.expand) {
493
- console.log('Expanding bottom sheet');
494
- bottomSheetRef.current.expand();
495
- } else if (bottomSheetRef.current.present) {
496
- console.log('Presenting bottom sheet');
497
- bottomSheetRef.current.present();
498
- } else {
499
- console.warn('No expand or present method available on bottomSheetRef');
500
- }
501
-
502
- // Then navigate to the specified screen if provided
503
- if (screenOrConfig) {
504
- // Add a small delay to ensure the bottom sheet is opened first
505
- setTimeout(() => {
506
- if (typeof screenOrConfig === 'string') {
507
- // Simple screen name
508
- console.log('Navigating to screen:', screenOrConfig);
509
- bottomSheetRef.current?._navigateToScreen?.(screenOrConfig);
510
- } else {
511
- // Screen with props
512
- console.log('Navigating to screen with props:', screenOrConfig.screen, screenOrConfig.props);
513
- bottomSheetRef.current?._navigateToScreen?.(screenOrConfig.screen, screenOrConfig.props);
514
- }
515
- }, 100);
516
- }
517
- } else {
518
- console.warn('bottomSheetRef is not available');
519
- }
520
- }, [bottomSheetRef]);
521
- const hideBottomSheet = (0, _react.useCallback)(() => {
522
- if (bottomSheetRef?.current) {
523
- bottomSheetRef.current.dismiss?.();
524
- }
525
- }, [bottomSheetRef]);
526
-
527
- // Context value
528
- const contextValue = {
529
- user,
530
- minimalUser,
531
- sessions,
532
- activeSessionId,
533
- isAuthenticated: !!user,
534
- isLoading,
535
- error,
536
- login,
537
- logout,
538
- logoutAll,
539
- signUp,
540
- switchSession,
541
- removeSession,
542
- refreshSessions,
543
- getDeviceSessions,
544
- logoutAllDeviceSessions,
545
- updateDeviceName,
546
- oxyServices,
547
- bottomSheetRef,
548
- showBottomSheet,
549
- hideBottomSheet
550
- };
551
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(OxyContext.Provider, {
552
- value: contextValue,
553
- children: children
554
- });
555
- };
556
-
557
- // Hook to use the context
558
- exports.OxyContextProvider = OxyContextProvider;
559
- const useOxy = () => {
560
- const context = (0, _react.useContext)(OxyContext);
561
- if (!context) {
562
- throw new Error('useOxy must be used within an OxyContextProvider');
563
- }
564
- return context;
565
- };
566
- exports.useOxy = useOxy;
567
- var _default = exports.default = OxyContext;
568
- //# sourceMappingURL=OxyContext.js.map