@oxyhq/services 5.25.0 → 5.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (444) hide show
  1. package/README.md +60 -8
  2. package/lib/commonjs/core/AuthManager.js +405 -0
  3. package/lib/commonjs/core/AuthManager.js.map +1 -0
  4. package/lib/commonjs/core/HttpService.js +39 -1
  5. package/lib/commonjs/core/HttpService.js.map +1 -1
  6. package/lib/commonjs/core/index.js +16 -0
  7. package/lib/commonjs/core/index.js.map +1 -1
  8. package/lib/commonjs/core/mixins/OxyServices.fedcm.js +38 -44
  9. package/lib/commonjs/core/mixins/OxyServices.fedcm.js.map +1 -1
  10. package/lib/commonjs/core/mixins/OxyServices.popup.js +9 -7
  11. package/lib/commonjs/core/mixins/OxyServices.popup.js.map +1 -1
  12. package/lib/commonjs/index.js +321 -18
  13. package/lib/commonjs/index.js.map +1 -1
  14. package/lib/commonjs/shared/index.js +227 -0
  15. package/lib/commonjs/shared/index.js.map +1 -0
  16. package/lib/commonjs/shared/utils/colorUtils.js +161 -0
  17. package/lib/commonjs/shared/utils/colorUtils.js.map +1 -0
  18. package/lib/commonjs/shared/utils/debugUtils.js +84 -0
  19. package/lib/commonjs/shared/utils/debugUtils.js.map +1 -0
  20. package/lib/commonjs/shared/utils/errorUtils.js +190 -0
  21. package/lib/commonjs/shared/utils/errorUtils.js.map +1 -0
  22. package/lib/commonjs/shared/utils/index.js +196 -0
  23. package/lib/commonjs/shared/utils/index.js.map +1 -0
  24. package/lib/commonjs/shared/utils/networkUtils.js +213 -0
  25. package/lib/commonjs/shared/utils/networkUtils.js.map +1 -0
  26. package/lib/commonjs/shared/utils/themeUtils.js +118 -0
  27. package/lib/commonjs/shared/utils/themeUtils.js.map +1 -0
  28. package/lib/commonjs/ui/components/BottomSheetRouter.js +1 -1
  29. package/lib/commonjs/ui/components/FontLoader.js +1 -1
  30. package/lib/commonjs/ui/components/FontLoader.js.map +1 -1
  31. package/lib/commonjs/ui/components/GroupedItem.js +1 -1
  32. package/lib/commonjs/ui/components/Header.js +1 -1
  33. package/lib/commonjs/ui/components/OxyProvider.js +9 -1
  34. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  35. package/lib/commonjs/ui/components/OxySignInButton.js +19 -20
  36. package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
  37. package/lib/commonjs/ui/components/ProfileCard.js +1 -1
  38. package/lib/commonjs/ui/components/ProfileCard.js.map +1 -1
  39. package/lib/commonjs/ui/components/QuickActions.js +1 -1
  40. package/lib/commonjs/ui/components/QuickActions.js.map +1 -1
  41. package/lib/commonjs/ui/components/Section.js +1 -1
  42. package/lib/commonjs/ui/components/SectionTitle.js +1 -1
  43. package/lib/commonjs/ui/components/SignInModal.js +546 -0
  44. package/lib/commonjs/ui/components/SignInModal.js.map +1 -0
  45. package/lib/commonjs/ui/context/OxyContext.js +2 -1
  46. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  47. package/lib/commonjs/ui/hooks/{use-color-scheme.js → useColorScheme.js} +1 -1
  48. package/lib/commonjs/ui/hooks/useColorScheme.js.map +1 -0
  49. package/lib/commonjs/ui/hooks/useSessionSocket.js +6 -12
  50. package/lib/commonjs/ui/hooks/useSessionSocket.js.map +1 -1
  51. package/lib/commonjs/ui/hooks/useThemeColors.js +1 -1
  52. package/lib/commonjs/ui/hooks/useThemeStyles.js +1 -1
  53. package/lib/commonjs/ui/navigation/bottomSheetManager.js +5 -2
  54. package/lib/commonjs/ui/navigation/bottomSheetManager.js.map +1 -1
  55. package/lib/commonjs/ui/navigation/routes.js +7 -8
  56. package/lib/commonjs/ui/navigation/routes.js.map +1 -1
  57. package/lib/commonjs/ui/screens/AccountCenterScreen.js +7 -7
  58. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
  59. package/lib/commonjs/ui/screens/AccountOverviewScreen.js +6 -6
  60. package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
  61. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +2 -2
  62. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +4 -4
  63. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
  64. package/lib/commonjs/ui/screens/AppInfoScreen.js +1 -1
  65. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +1 -1
  66. package/lib/commonjs/ui/screens/FileManagementScreen.js +1 -1
  67. package/lib/commonjs/ui/screens/FollowersListScreen.js +18 -0
  68. package/lib/commonjs/ui/screens/FollowersListScreen.js.map +1 -0
  69. package/lib/commonjs/ui/screens/FollowingListScreen.js +18 -0
  70. package/lib/commonjs/ui/screens/FollowingListScreen.js.map +1 -0
  71. package/lib/commonjs/ui/screens/HelpSupportScreen.js +1 -1
  72. package/lib/commonjs/ui/screens/HelpSupportScreen.js.map +1 -1
  73. package/lib/commonjs/ui/screens/HistoryViewScreen.js +1 -1
  74. package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +1 -1
  75. package/lib/commonjs/ui/screens/LearnMoreUsernamesScreen.js +229 -0
  76. package/lib/commonjs/ui/screens/LearnMoreUsernamesScreen.js.map +1 -0
  77. package/lib/commonjs/ui/screens/LegalDocumentsScreen.js +1 -1
  78. package/lib/commonjs/ui/screens/LegalDocumentsScreen.js.map +1 -1
  79. package/lib/commonjs/ui/screens/OxyAuthScreen.js +9 -21
  80. package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
  81. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +1 -1
  82. package/lib/commonjs/ui/screens/ProfileScreen.js +1 -1
  83. package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
  84. package/lib/commonjs/ui/screens/SavesCollectionsScreen.js +1 -1
  85. package/lib/commonjs/ui/screens/UserListScreen.js +411 -0
  86. package/lib/commonjs/ui/screens/UserListScreen.js.map +1 -0
  87. package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js +1 -1
  88. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +1 -1
  89. package/lib/commonjs/ui/screens/karma/KarmaFAQScreen.js +1 -1
  90. package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
  91. package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js +1 -1
  92. package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js +1 -1
  93. package/lib/commonjs/ui/stores/authStore.js +4 -6
  94. package/lib/commonjs/ui/stores/authStore.js.map +1 -1
  95. package/lib/commonjs/ui/utils/colorUtils.js +43 -46
  96. package/lib/commonjs/ui/utils/colorUtils.js.map +1 -1
  97. package/lib/commonjs/ui/utils/themeUtils.js +29 -39
  98. package/lib/commonjs/ui/utils/themeUtils.js.map +1 -1
  99. package/lib/commonjs/ui/utils/{user-utils.js → userUtils.js} +1 -1
  100. package/lib/commonjs/ui/utils/userUtils.js.map +1 -0
  101. package/lib/commonjs/utils/errorUtils.js +0 -13
  102. package/lib/commonjs/utils/errorUtils.js.map +1 -1
  103. package/lib/commonjs/utils/hookUtils.js +8 -8
  104. package/lib/commonjs/utils/hookUtils.js.map +1 -1
  105. package/lib/commonjs/web/WebOxyContext.js +273 -41
  106. package/lib/commonjs/web/WebOxyContext.js.map +1 -1
  107. package/lib/commonjs/web/index.js +177 -4
  108. package/lib/commonjs/web/index.js.map +1 -1
  109. package/lib/commonjs/web.js +12 -12
  110. package/lib/commonjs/web.js.map +1 -1
  111. package/lib/module/core/AuthManager.js +399 -0
  112. package/lib/module/core/AuthManager.js.map +1 -0
  113. package/lib/module/core/HttpService.js +39 -1
  114. package/lib/module/core/HttpService.js.map +1 -1
  115. package/lib/module/core/index.js +2 -0
  116. package/lib/module/core/index.js.map +1 -1
  117. package/lib/module/core/mixins/OxyServices.fedcm.js +38 -44
  118. package/lib/module/core/mixins/OxyServices.fedcm.js.map +1 -1
  119. package/lib/module/core/mixins/OxyServices.popup.js +9 -7
  120. package/lib/module/core/mixins/OxyServices.popup.js.map +1 -1
  121. package/lib/module/index.js +27 -2
  122. package/lib/module/index.js.map +1 -1
  123. package/lib/module/shared/index.js +37 -0
  124. package/lib/module/shared/index.js.map +1 -0
  125. package/lib/module/shared/utils/colorUtils.js +150 -0
  126. package/lib/module/shared/utils/colorUtils.js.map +1 -0
  127. package/lib/module/shared/utils/debugUtils.js +75 -0
  128. package/lib/module/shared/utils/debugUtils.js.map +1 -0
  129. package/lib/module/shared/utils/errorUtils.js +176 -0
  130. package/lib/module/shared/utils/errorUtils.js.map +1 -0
  131. package/lib/module/shared/utils/index.js +21 -0
  132. package/lib/module/shared/utils/index.js.map +1 -0
  133. package/lib/module/shared/utils/networkUtils.js +202 -0
  134. package/lib/module/shared/utils/networkUtils.js.map +1 -0
  135. package/lib/module/shared/utils/themeUtils.js +109 -0
  136. package/lib/module/shared/utils/themeUtils.js.map +1 -0
  137. package/lib/module/ui/components/BottomSheetRouter.js +1 -1
  138. package/lib/module/ui/components/BottomSheetRouter.js.map +1 -1
  139. package/lib/module/ui/components/FontLoader.js +1 -1
  140. package/lib/module/ui/components/FontLoader.js.map +1 -1
  141. package/lib/module/ui/components/GroupedItem.js +1 -1
  142. package/lib/module/ui/components/GroupedItem.js.map +1 -1
  143. package/lib/module/ui/components/Header.js +1 -1
  144. package/lib/module/ui/components/Header.js.map +1 -1
  145. package/lib/module/ui/components/OxyProvider.js +9 -1
  146. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  147. package/lib/module/ui/components/OxySignInButton.js +20 -21
  148. package/lib/module/ui/components/OxySignInButton.js.map +1 -1
  149. package/lib/module/ui/components/ProfileCard.js +1 -1
  150. package/lib/module/ui/components/ProfileCard.js.map +1 -1
  151. package/lib/module/ui/components/QuickActions.js +1 -1
  152. package/lib/module/ui/components/QuickActions.js.map +1 -1
  153. package/lib/module/ui/components/Section.js +1 -1
  154. package/lib/module/ui/components/Section.js.map +1 -1
  155. package/lib/module/ui/components/SectionTitle.js +1 -1
  156. package/lib/module/ui/components/SectionTitle.js.map +1 -1
  157. package/lib/module/ui/components/SignInModal.js +536 -0
  158. package/lib/module/ui/components/SignInModal.js.map +1 -0
  159. package/lib/module/ui/context/OxyContext.js +1 -1
  160. package/lib/module/ui/context/OxyContext.js.map +1 -1
  161. package/lib/module/ui/hooks/{use-color-scheme.js → useColorScheme.js} +1 -1
  162. package/lib/module/ui/hooks/useColorScheme.js.map +1 -0
  163. package/lib/module/ui/hooks/useSessionSocket.js +6 -12
  164. package/lib/module/ui/hooks/useSessionSocket.js.map +1 -1
  165. package/lib/module/ui/hooks/useThemeColors.js +1 -1
  166. package/lib/module/ui/hooks/useThemeColors.js.map +1 -1
  167. package/lib/module/ui/hooks/useThemeStyles.js +1 -1
  168. package/lib/module/ui/hooks/useThemeStyles.js.map +1 -1
  169. package/lib/module/ui/navigation/bottomSheetManager.js +5 -2
  170. package/lib/module/ui/navigation/bottomSheetManager.js.map +1 -1
  171. package/lib/module/ui/navigation/routes.js +7 -8
  172. package/lib/module/ui/navigation/routes.js.map +1 -1
  173. package/lib/module/ui/screens/AccountCenterScreen.js +7 -7
  174. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
  175. package/lib/module/ui/screens/AccountOverviewScreen.js +6 -6
  176. package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
  177. package/lib/module/ui/screens/AccountSettingsScreen.js +2 -2
  178. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  179. package/lib/module/ui/screens/AccountSwitcherScreen.js +4 -4
  180. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  181. package/lib/module/ui/screens/AppInfoScreen.js +1 -1
  182. package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
  183. package/lib/module/ui/screens/EditProfileFieldScreen.js +1 -1
  184. package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
  185. package/lib/module/ui/screens/FileManagementScreen.js +1 -1
  186. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  187. package/lib/module/ui/screens/FollowersListScreen.js +13 -0
  188. package/lib/module/ui/screens/FollowersListScreen.js.map +1 -0
  189. package/lib/module/ui/screens/FollowingListScreen.js +13 -0
  190. package/lib/module/ui/screens/FollowingListScreen.js.map +1 -0
  191. package/lib/module/ui/screens/HelpSupportScreen.js +1 -1
  192. package/lib/module/ui/screens/HelpSupportScreen.js.map +1 -1
  193. package/lib/module/ui/screens/HistoryViewScreen.js +1 -1
  194. package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
  195. package/lib/module/ui/screens/LanguageSelectorScreen.js +1 -1
  196. package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -1
  197. package/lib/module/ui/screens/LearnMoreUsernamesScreen.js +224 -0
  198. package/lib/module/ui/screens/LearnMoreUsernamesScreen.js.map +1 -0
  199. package/lib/module/ui/screens/LegalDocumentsScreen.js +1 -1
  200. package/lib/module/ui/screens/LegalDocumentsScreen.js.map +1 -1
  201. package/lib/module/ui/screens/OxyAuthScreen.js +9 -21
  202. package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
  203. package/lib/module/ui/screens/PremiumSubscriptionScreen.js +1 -1
  204. package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  205. package/lib/module/ui/screens/ProfileScreen.js +1 -1
  206. package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
  207. package/lib/module/ui/screens/SavesCollectionsScreen.js +1 -1
  208. package/lib/module/ui/screens/SavesCollectionsScreen.js.map +1 -1
  209. package/lib/module/ui/screens/UserListScreen.js +405 -0
  210. package/lib/module/ui/screens/UserListScreen.js.map +1 -0
  211. package/lib/module/ui/screens/karma/KarmaAboutScreen.js +1 -1
  212. package/lib/module/ui/screens/karma/KarmaAboutScreen.js.map +1 -1
  213. package/lib/module/ui/screens/karma/KarmaCenterScreen.js +1 -1
  214. package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
  215. package/lib/module/ui/screens/karma/KarmaFAQScreen.js +1 -1
  216. package/lib/module/ui/screens/karma/KarmaFAQScreen.js.map +1 -1
  217. package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
  218. package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
  219. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js +1 -1
  220. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
  221. package/lib/module/ui/screens/karma/KarmaRulesScreen.js +1 -1
  222. package/lib/module/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
  223. package/lib/module/ui/stores/authStore.js +4 -6
  224. package/lib/module/ui/stores/authStore.js.map +1 -1
  225. package/lib/module/ui/utils/colorUtils.js +7 -40
  226. package/lib/module/ui/utils/colorUtils.js.map +1 -1
  227. package/lib/module/ui/utils/themeUtils.js +7 -35
  228. package/lib/module/ui/utils/themeUtils.js.map +1 -1
  229. package/lib/module/ui/utils/{user-utils.js → userUtils.js} +1 -1
  230. package/lib/module/ui/utils/userUtils.js.map +1 -0
  231. package/lib/module/utils/errorUtils.js +0 -7
  232. package/lib/module/utils/errorUtils.js.map +1 -1
  233. package/lib/module/utils/hookUtils.js +8 -8
  234. package/lib/module/utils/hookUtils.js.map +1 -1
  235. package/lib/module/web/WebOxyContext.js +272 -41
  236. package/lib/module/web/WebOxyContext.js.map +1 -1
  237. package/lib/module/web/index.js +26 -5
  238. package/lib/module/web/index.js.map +1 -1
  239. package/lib/module/web.js +2 -1
  240. package/lib/module/web.js.map +1 -1
  241. package/lib/typescript/commonjs/core/AuthManager.d.ts +144 -0
  242. package/lib/typescript/commonjs/core/AuthManager.d.ts.map +1 -0
  243. package/lib/typescript/commonjs/core/HttpService.d.ts.map +1 -1
  244. package/lib/typescript/commonjs/core/index.d.ts +2 -0
  245. package/lib/typescript/commonjs/core/index.d.ts.map +1 -1
  246. package/lib/typescript/commonjs/core/mixins/OxyServices.fedcm.d.ts.map +1 -1
  247. package/lib/typescript/commonjs/core/mixins/OxyServices.popup.d.ts.map +1 -1
  248. package/lib/typescript/commonjs/index.d.ts +16 -2
  249. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  250. package/lib/typescript/commonjs/models/session.d.ts +4 -0
  251. package/lib/typescript/commonjs/models/session.d.ts.map +1 -1
  252. package/lib/typescript/commonjs/shared/index.d.ts +29 -0
  253. package/lib/typescript/commonjs/shared/index.d.ts.map +1 -0
  254. package/lib/typescript/commonjs/shared/utils/colorUtils.d.ts +105 -0
  255. package/lib/typescript/commonjs/shared/utils/colorUtils.d.ts.map +1 -0
  256. package/lib/typescript/commonjs/shared/utils/debugUtils.d.ts +49 -0
  257. package/lib/typescript/commonjs/shared/utils/debugUtils.d.ts.map +1 -0
  258. package/lib/typescript/commonjs/shared/utils/errorUtils.d.ts +98 -0
  259. package/lib/typescript/commonjs/shared/utils/errorUtils.d.ts.map +1 -0
  260. package/lib/typescript/commonjs/shared/utils/index.d.ts +14 -0
  261. package/lib/typescript/commonjs/shared/utils/index.d.ts.map +1 -0
  262. package/lib/typescript/commonjs/shared/utils/networkUtils.d.ts +140 -0
  263. package/lib/typescript/commonjs/shared/utils/networkUtils.d.ts.map +1 -0
  264. package/lib/typescript/commonjs/shared/utils/themeUtils.d.ts +91 -0
  265. package/lib/typescript/commonjs/shared/utils/themeUtils.d.ts.map +1 -0
  266. package/lib/typescript/commonjs/ui/components/FontLoader.d.ts +1 -1
  267. package/lib/typescript/commonjs/ui/components/FontLoader.d.ts.map +1 -1
  268. package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
  269. package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts.map +1 -1
  270. package/lib/typescript/commonjs/ui/components/SignInModal.d.ts +18 -0
  271. package/lib/typescript/commonjs/ui/components/SignInModal.d.ts.map +1 -0
  272. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +1 -2
  273. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  274. package/lib/typescript/commonjs/ui/hooks/{use-color-scheme.d.ts → useColorScheme.d.ts} +1 -1
  275. package/lib/typescript/commonjs/ui/hooks/useColorScheme.d.ts.map +1 -0
  276. package/lib/typescript/commonjs/ui/hooks/useSessionSocket.d.ts.map +1 -1
  277. package/lib/typescript/commonjs/ui/navigation/bottomSheetManager.d.ts +2 -0
  278. package/lib/typescript/commonjs/ui/navigation/bottomSheetManager.d.ts.map +1 -1
  279. package/lib/typescript/commonjs/ui/navigation/routes.d.ts +1 -1
  280. package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
  281. package/lib/typescript/commonjs/ui/screens/FollowersListScreen.d.ts +9 -0
  282. package/lib/typescript/commonjs/ui/screens/FollowersListScreen.d.ts.map +1 -0
  283. package/lib/typescript/commonjs/ui/screens/FollowingListScreen.d.ts +9 -0
  284. package/lib/typescript/commonjs/ui/screens/FollowingListScreen.d.ts.map +1 -0
  285. package/lib/typescript/commonjs/ui/screens/LearnMoreUsernamesScreen.d.ts +5 -0
  286. package/lib/typescript/commonjs/ui/screens/LearnMoreUsernamesScreen.d.ts.map +1 -0
  287. package/lib/typescript/commonjs/ui/screens/OxyAuthScreen.d.ts.map +1 -1
  288. package/lib/typescript/commonjs/ui/screens/UserListScreen.d.ts +11 -0
  289. package/lib/typescript/commonjs/ui/screens/UserListScreen.d.ts.map +1 -0
  290. package/lib/typescript/commonjs/ui/stores/authStore.d.ts.map +1 -1
  291. package/lib/typescript/commonjs/ui/utils/colorUtils.d.ts +7 -11
  292. package/lib/typescript/commonjs/ui/utils/colorUtils.d.ts.map +1 -1
  293. package/lib/typescript/commonjs/ui/utils/themeUtils.d.ts +6 -19
  294. package/lib/typescript/commonjs/ui/utils/themeUtils.d.ts.map +1 -1
  295. package/lib/typescript/commonjs/ui/utils/{user-utils.d.ts → userUtils.d.ts} +1 -1
  296. package/lib/typescript/commonjs/ui/utils/userUtils.d.ts.map +1 -0
  297. package/lib/typescript/commonjs/utils/errorUtils.d.ts +0 -6
  298. package/lib/typescript/commonjs/utils/errorUtils.d.ts.map +1 -1
  299. package/lib/typescript/commonjs/web/WebOxyContext.d.ts +117 -9
  300. package/lib/typescript/commonjs/web/WebOxyContext.d.ts.map +1 -1
  301. package/lib/typescript/commonjs/web/index.d.ts +19 -8
  302. package/lib/typescript/commonjs/web/index.d.ts.map +1 -1
  303. package/lib/typescript/commonjs/web.d.ts +2 -1
  304. package/lib/typescript/commonjs/web.d.ts.map +1 -1
  305. package/lib/typescript/module/core/AuthManager.d.ts +144 -0
  306. package/lib/typescript/module/core/AuthManager.d.ts.map +1 -0
  307. package/lib/typescript/module/core/HttpService.d.ts.map +1 -1
  308. package/lib/typescript/module/core/index.d.ts +2 -0
  309. package/lib/typescript/module/core/index.d.ts.map +1 -1
  310. package/lib/typescript/module/core/mixins/OxyServices.fedcm.d.ts.map +1 -1
  311. package/lib/typescript/module/core/mixins/OxyServices.popup.d.ts.map +1 -1
  312. package/lib/typescript/module/index.d.ts +16 -2
  313. package/lib/typescript/module/index.d.ts.map +1 -1
  314. package/lib/typescript/module/models/session.d.ts +4 -0
  315. package/lib/typescript/module/models/session.d.ts.map +1 -1
  316. package/lib/typescript/module/shared/index.d.ts +29 -0
  317. package/lib/typescript/module/shared/index.d.ts.map +1 -0
  318. package/lib/typescript/module/shared/utils/colorUtils.d.ts +105 -0
  319. package/lib/typescript/module/shared/utils/colorUtils.d.ts.map +1 -0
  320. package/lib/typescript/module/shared/utils/debugUtils.d.ts +49 -0
  321. package/lib/typescript/module/shared/utils/debugUtils.d.ts.map +1 -0
  322. package/lib/typescript/module/shared/utils/errorUtils.d.ts +98 -0
  323. package/lib/typescript/module/shared/utils/errorUtils.d.ts.map +1 -0
  324. package/lib/typescript/module/shared/utils/index.d.ts +14 -0
  325. package/lib/typescript/module/shared/utils/index.d.ts.map +1 -0
  326. package/lib/typescript/module/shared/utils/networkUtils.d.ts +140 -0
  327. package/lib/typescript/module/shared/utils/networkUtils.d.ts.map +1 -0
  328. package/lib/typescript/module/shared/utils/themeUtils.d.ts +91 -0
  329. package/lib/typescript/module/shared/utils/themeUtils.d.ts.map +1 -0
  330. package/lib/typescript/module/ui/components/FontLoader.d.ts +1 -1
  331. package/lib/typescript/module/ui/components/FontLoader.d.ts.map +1 -1
  332. package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
  333. package/lib/typescript/module/ui/components/OxySignInButton.d.ts.map +1 -1
  334. package/lib/typescript/module/ui/components/SignInModal.d.ts +18 -0
  335. package/lib/typescript/module/ui/components/SignInModal.d.ts.map +1 -0
  336. package/lib/typescript/module/ui/context/OxyContext.d.ts +1 -2
  337. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  338. package/lib/typescript/module/ui/hooks/{use-color-scheme.d.ts → useColorScheme.d.ts} +1 -1
  339. package/lib/typescript/module/ui/hooks/useColorScheme.d.ts.map +1 -0
  340. package/lib/typescript/module/ui/hooks/useSessionSocket.d.ts.map +1 -1
  341. package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts +2 -0
  342. package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts.map +1 -1
  343. package/lib/typescript/module/ui/navigation/routes.d.ts +1 -1
  344. package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
  345. package/lib/typescript/module/ui/screens/FollowersListScreen.d.ts +9 -0
  346. package/lib/typescript/module/ui/screens/FollowersListScreen.d.ts.map +1 -0
  347. package/lib/typescript/module/ui/screens/FollowingListScreen.d.ts +9 -0
  348. package/lib/typescript/module/ui/screens/FollowingListScreen.d.ts.map +1 -0
  349. package/lib/typescript/module/ui/screens/LearnMoreUsernamesScreen.d.ts +5 -0
  350. package/lib/typescript/module/ui/screens/LearnMoreUsernamesScreen.d.ts.map +1 -0
  351. package/lib/typescript/module/ui/screens/OxyAuthScreen.d.ts.map +1 -1
  352. package/lib/typescript/module/ui/screens/UserListScreen.d.ts +11 -0
  353. package/lib/typescript/module/ui/screens/UserListScreen.d.ts.map +1 -0
  354. package/lib/typescript/module/ui/stores/authStore.d.ts.map +1 -1
  355. package/lib/typescript/module/ui/utils/colorUtils.d.ts +7 -11
  356. package/lib/typescript/module/ui/utils/colorUtils.d.ts.map +1 -1
  357. package/lib/typescript/module/ui/utils/themeUtils.d.ts +6 -19
  358. package/lib/typescript/module/ui/utils/themeUtils.d.ts.map +1 -1
  359. package/lib/typescript/module/ui/utils/{user-utils.d.ts → userUtils.d.ts} +1 -1
  360. package/lib/typescript/module/ui/utils/userUtils.d.ts.map +1 -0
  361. package/lib/typescript/module/utils/errorUtils.d.ts +0 -6
  362. package/lib/typescript/module/utils/errorUtils.d.ts.map +1 -1
  363. package/lib/typescript/module/web/WebOxyContext.d.ts +117 -9
  364. package/lib/typescript/module/web/WebOxyContext.d.ts.map +1 -1
  365. package/lib/typescript/module/web/index.d.ts +19 -8
  366. package/lib/typescript/module/web/index.d.ts.map +1 -1
  367. package/lib/typescript/module/web.d.ts +2 -1
  368. package/lib/typescript/module/web.d.ts.map +1 -1
  369. package/package.json +8 -2
  370. package/src/core/AuthManager.ts +436 -0
  371. package/src/core/HttpService.ts +43 -1
  372. package/src/core/index.ts +4 -0
  373. package/src/core/mixins/OxyServices.fedcm.ts +37 -42
  374. package/src/core/mixins/OxyServices.popup.ts +10 -7
  375. package/src/index.ts +76 -11
  376. package/src/models/session.ts +4 -0
  377. package/src/shared/index.ts +82 -0
  378. package/src/shared/utils/colorUtils.ts +155 -0
  379. package/src/shared/utils/debugUtils.ts +73 -0
  380. package/src/shared/utils/errorUtils.ts +181 -0
  381. package/src/shared/utils/index.ts +59 -0
  382. package/src/shared/utils/networkUtils.ts +248 -0
  383. package/src/shared/utils/themeUtils.ts +115 -0
  384. package/src/ui/components/BottomSheetRouter.tsx +1 -1
  385. package/src/ui/components/FontLoader.tsx +1 -2
  386. package/src/ui/components/GroupedItem.tsx +1 -1
  387. package/src/ui/components/Header.tsx +1 -1
  388. package/src/ui/components/OxyProvider.tsx +10 -0
  389. package/src/ui/components/OxySignInButton.tsx +20 -22
  390. package/src/ui/components/ProfileCard.tsx +1 -1
  391. package/src/ui/components/QuickActions.tsx +1 -1
  392. package/src/ui/components/Section.tsx +1 -1
  393. package/src/ui/components/SectionTitle.tsx +1 -1
  394. package/src/ui/components/SignInModal.tsx +534 -0
  395. package/src/ui/context/OxyContext.tsx +1 -2
  396. package/src/ui/hooks/queries/queryKeys.ts +2 -2
  397. package/src/ui/hooks/useSessionSocket.ts +12 -17
  398. package/src/ui/hooks/useThemeColors.ts +1 -1
  399. package/src/ui/hooks/useThemeStyles.ts +1 -1
  400. package/src/ui/navigation/bottomSheetManager.ts +5 -1
  401. package/src/ui/navigation/routes.ts +8 -9
  402. package/src/ui/screens/AccountCenterScreen.tsx +7 -7
  403. package/src/ui/screens/AccountOverviewScreen.tsx +6 -6
  404. package/src/ui/screens/AccountSettingsScreen.tsx +2 -2
  405. package/src/ui/screens/AccountSwitcherScreen.tsx +4 -4
  406. package/src/ui/screens/AppInfoScreen.tsx +1 -1
  407. package/src/ui/screens/EditProfileFieldScreen.tsx +1 -1
  408. package/src/ui/screens/FileManagementScreen.tsx +1 -1
  409. package/src/ui/screens/FollowersListScreen.tsx +14 -0
  410. package/src/ui/screens/FollowingListScreen.tsx +14 -0
  411. package/src/ui/screens/HelpSupportScreen.tsx +1 -1
  412. package/src/ui/screens/HistoryViewScreen.tsx +1 -1
  413. package/src/ui/screens/LanguageSelectorScreen.tsx +1 -1
  414. package/src/ui/screens/LearnMoreUsernamesScreen.tsx +231 -0
  415. package/src/ui/screens/LegalDocumentsScreen.tsx +1 -1
  416. package/src/ui/screens/OxyAuthScreen.tsx +10 -21
  417. package/src/ui/screens/PremiumSubscriptionScreen.tsx +1 -1
  418. package/src/ui/screens/ProfileScreen.tsx +1 -1
  419. package/src/ui/screens/SavesCollectionsScreen.tsx +1 -1
  420. package/src/ui/screens/UserListScreen.tsx +416 -0
  421. package/src/ui/screens/karma/KarmaAboutScreen.tsx +1 -1
  422. package/src/ui/screens/karma/KarmaCenterScreen.tsx +1 -1
  423. package/src/ui/screens/karma/KarmaFAQScreen.tsx +1 -1
  424. package/src/ui/screens/karma/KarmaLeaderboardScreen.tsx +1 -1
  425. package/src/ui/screens/karma/KarmaRewardsScreen.tsx +1 -1
  426. package/src/ui/screens/karma/KarmaRulesScreen.tsx +1 -1
  427. package/src/ui/stores/authStore.ts +5 -6
  428. package/src/ui/utils/colorUtils.ts +15 -43
  429. package/src/ui/utils/themeUtils.ts +14 -39
  430. package/src/utils/errorUtils.ts +1 -6
  431. package/src/utils/hookUtils.ts +8 -8
  432. package/src/web/WebOxyContext.tsx +331 -41
  433. package/src/web/index.ts +76 -6
  434. package/src/web.ts +1 -1
  435. package/lib/commonjs/ui/hooks/use-color-scheme.js.map +0 -1
  436. package/lib/commonjs/ui/utils/user-utils.js.map +0 -1
  437. package/lib/module/ui/hooks/use-color-scheme.js.map +0 -1
  438. package/lib/module/ui/utils/user-utils.js.map +0 -1
  439. package/lib/typescript/commonjs/ui/hooks/use-color-scheme.d.ts.map +0 -1
  440. package/lib/typescript/commonjs/ui/utils/user-utils.d.ts.map +0 -1
  441. package/lib/typescript/module/ui/hooks/use-color-scheme.d.ts.map +0 -1
  442. package/lib/typescript/module/ui/utils/user-utils.d.ts.map +0 -1
  443. /package/src/ui/hooks/{use-color-scheme.ts → useColorScheme.ts} +0 -0
  444. /package/src/ui/utils/{user-utils.ts → userUtils.ts} +0 -0
@@ -2,51 +2,156 @@
2
2
 
3
3
  /**
4
4
  * Web-Only Oxy Context
5
- * Clean implementation with ZERO React Native dependencies
6
- * Uses CrossDomainAuth for proper SSO flow
5
+ *
6
+ * Clean implementation with ZERO React Native dependencies.
7
+ * Provides FedCM, popup, and redirect authentication methods.
8
+ * Uses centralized AuthManager for token and session management.
9
+ *
10
+ * @module web/WebOxyContext
7
11
  */
8
12
 
9
- import { createContext, useCallback, useContext, useEffect, useState } from 'react';
10
- import { OxyServices, createCrossDomainAuth } from "../core/index.js";
13
+ import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
14
+ import { OxyServices } from "../core/OxyServices.js";
15
+ import { CrossDomainAuth } from "../core/CrossDomainAuth.js";
16
+ import { createAuthManager } from "../core/AuthManager.js";
11
17
  import { QueryClientProvider } from '@tanstack/react-query';
12
18
  import { createQueryClient } from "../ui/hooks/queryClient.js";
13
19
  import { jsx as _jsx } from "react/jsx-runtime";
14
20
  const WebOxyContext = /*#__PURE__*/createContext(null);
15
21
  /**
16
22
  * Web-only Oxy Provider
17
- * Uses CrossDomainAuth for automatic SSO with FedCM/Popup/Redirect fallback
23
+ *
24
+ * Provides authentication context for pure web applications (React, Next.js, Vite).
25
+ * Supports FedCM, popup, and redirect authentication methods.
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * import { WebOxyProvider, useAuth } from '@oxyhq/services/web';
30
+ *
31
+ * function App() {
32
+ * return (
33
+ * <WebOxyProvider baseURL="https://api.oxy.so">
34
+ * <YourApp />
35
+ * </WebOxyProvider>
36
+ * );
37
+ * }
38
+ *
39
+ * function LoginButton() {
40
+ * const { signIn, isLoading, isFedCMSupported } = useAuth();
41
+ * return (
42
+ * <button onClick={signIn} disabled={isLoading}>
43
+ * {isFedCMSupported() ? 'Sign in with Oxy' : 'Sign in'}
44
+ * </button>
45
+ * );
46
+ * }
47
+ * ```
18
48
  */
19
49
  export function WebOxyProvider({
20
50
  children,
21
51
  baseURL,
22
52
  authWebUrl,
23
- onAuthStateChange
53
+ onAuthStateChange,
54
+ onError,
55
+ preferredAuthMethod = 'auto',
56
+ skipAutoCheck = false
24
57
  }) {
58
+ // Initialize services with centralized AuthManager
25
59
  const [oxyServices] = useState(() => new OxyServices({
26
60
  baseURL,
27
61
  authWebUrl
28
62
  }));
29
- const [crossDomainAuth] = useState(() => createCrossDomainAuth(oxyServices));
63
+ const [crossDomainAuth] = useState(() => new CrossDomainAuth(oxyServices));
64
+ const [authManager] = useState(() => createAuthManager(oxyServices, {
65
+ autoRefresh: true
66
+ }));
67
+ const [queryClient] = useState(() => createQueryClient());
68
+
69
+ // Auth state
30
70
  const [user, setUser] = useState(null);
31
- const [isLoading, setIsLoading] = useState(true);
71
+ const [isLoading, setIsLoading] = useState(!skipAutoCheck);
32
72
  const [error, setError] = useState(null);
33
- const [queryClient] = useState(() => createQueryClient());
34
73
  const isAuthenticated = !!user;
35
74
 
36
- // Initialize - handle callbacks, restore session, try silent sign-in
75
+ /**
76
+ * Handles successful authentication via AuthManager
77
+ */
78
+ const handleAuthSuccess = useCallback(async (session, method = 'credentials') => {
79
+ // Use centralized AuthManager for token/session storage
80
+ await authManager.handleAuthSuccess(session, method);
81
+
82
+ // Fetch full user profile (session.user only contains MinimalUserData)
83
+ try {
84
+ const fullUser = await oxyServices.getCurrentUser();
85
+ if (fullUser) {
86
+ setUser(fullUser);
87
+ } else {
88
+ // Fallback to minimal data if full profile unavailable
89
+ setUser(session.user);
90
+ }
91
+ } catch {
92
+ // Fallback to minimal data on error
93
+ setUser(session.user);
94
+ }
95
+ setError(null);
96
+ setIsLoading(false);
97
+ }, [authManager, oxyServices]);
98
+
99
+ /**
100
+ * Handles authentication errors
101
+ */
102
+ const handleAuthError = useCallback(err => {
103
+ const errorMessage = err instanceof Error ? err.message : 'Authentication failed';
104
+ setError(errorMessage);
105
+ setIsLoading(false);
106
+ onError?.(err instanceof Error ? err : new Error(errorMessage));
107
+ }, [onError]);
108
+
109
+ // Initialize - check for existing session or redirect callback
37
110
  useEffect(() => {
111
+ if (skipAutoCheck) return;
38
112
  let mounted = true;
39
113
  const initAuth = async () => {
40
114
  try {
41
- // Complete initialization: handles callbacks, restores session, tries silent sign-in
42
- const session = await crossDomainAuth.initialize();
43
- if (mounted && session?.user) {
44
- setUser(session.user);
115
+ // 1. Check for redirect callback (user returning from auth.oxy.so)
116
+ const callbackSession = crossDomainAuth.handleRedirectCallback();
117
+ if (callbackSession && mounted) {
118
+ await handleAuthSuccess(callbackSession, 'redirect');
119
+ return;
120
+ }
121
+
122
+ // 2. Try to restore session from AuthManager (handles token refresh automatically)
123
+ const restoredUser = await authManager.initialize();
124
+ if (restoredUser && mounted) {
125
+ // Verify token is still valid by fetching current user
126
+ try {
127
+ const currentUser = await oxyServices.getCurrentUser();
128
+ if (mounted && currentUser) {
129
+ setUser(currentUser);
130
+ setIsLoading(false);
131
+ return;
132
+ }
133
+ } catch {
134
+ // Token invalid, AuthManager will handle clearing
135
+ await authManager.signOut();
136
+ }
137
+ }
138
+
139
+ // 3. Try silent sign-in (FedCM or iframe-based SSO)
140
+ try {
141
+ const session = await crossDomainAuth.silentSignIn();
142
+ if (mounted && session?.user) {
143
+ await handleAuthSuccess(session, 'fedcm');
144
+ return;
145
+ }
146
+ } catch {
147
+ // Silent sign-in failed, that's fine
148
+ }
149
+
150
+ // No session found
151
+ if (mounted) {
152
+ setIsLoading(false);
45
153
  }
46
154
  } catch (err) {
47
- // No active session - this is fine
48
- console.log('[WebOxy] No active session');
49
- } finally {
50
155
  if (mounted) {
51
156
  setIsLoading(false);
52
157
  }
@@ -56,57 +161,127 @@ export function WebOxyProvider({
56
161
  return () => {
57
162
  mounted = false;
58
163
  };
59
- }, [crossDomainAuth]);
164
+ }, [oxyServices, crossDomainAuth, authManager, skipAutoCheck, handleAuthSuccess]);
60
165
 
61
166
  // Notify parent of auth state changes
62
167
  useEffect(() => {
63
168
  onAuthStateChange?.(user);
64
169
  }, [user, onAuthStateChange]);
170
+
171
+ /**
172
+ * Sign in with automatic method selection
173
+ */
65
174
  const signIn = useCallback(async () => {
66
175
  setError(null);
67
176
  setIsLoading(true);
177
+ let selectedMethod = 'popup';
68
178
  try {
69
- // Sign in with automatic method selection (FedCM → Popup → Redirect)
70
179
  const session = await crossDomainAuth.signIn({
71
- method: 'auto',
72
- // Automatic fallback
180
+ method: preferredAuthMethod,
73
181
  onMethodSelected: method => {
74
- console.log('[WebOxy] Using auth method:', method);
182
+ selectedMethod = method;
75
183
  }
76
184
  });
77
- if (session?.user) {
78
- setUser(session.user);
185
+ if (session) {
186
+ await handleAuthSuccess(session, selectedMethod);
187
+ } else {
188
+ // Redirect method - page will reload
189
+ setIsLoading(false);
79
190
  }
80
191
  } catch (err) {
81
- console.error('[WebOxy] Sign in error:', err);
82
- setError(err instanceof Error ? err.message : 'Sign in failed');
83
- } finally {
84
- setIsLoading(false);
192
+ handleAuthError(err);
85
193
  }
194
+ }, [crossDomainAuth, preferredAuthMethod, handleAuthSuccess, handleAuthError]);
195
+
196
+ /**
197
+ * Sign in with FedCM specifically
198
+ */
199
+ const signInWithFedCM = useCallback(async () => {
200
+ setError(null);
201
+ setIsLoading(true);
202
+ try {
203
+ const session = await crossDomainAuth.signInWithFedCM();
204
+ await handleAuthSuccess(session, 'fedcm');
205
+ } catch (err) {
206
+ handleAuthError(err);
207
+ }
208
+ }, [crossDomainAuth, handleAuthSuccess, handleAuthError]);
209
+
210
+ /**
211
+ * Sign in with popup specifically
212
+ */
213
+ const signInWithPopup = useCallback(async () => {
214
+ setError(null);
215
+ setIsLoading(true);
216
+ try {
217
+ const session = await crossDomainAuth.signInWithPopup();
218
+ await handleAuthSuccess(session, 'popup');
219
+ } catch (err) {
220
+ handleAuthError(err);
221
+ }
222
+ }, [crossDomainAuth, handleAuthSuccess, handleAuthError]);
223
+
224
+ /**
225
+ * Sign in with redirect specifically
226
+ */
227
+ const signInWithRedirect = useCallback(() => {
228
+ setError(null);
229
+ crossDomainAuth.signInWithRedirect({
230
+ redirectUri: typeof window !== 'undefined' ? window.location.href : undefined
231
+ });
232
+ }, [crossDomainAuth]);
233
+
234
+ /**
235
+ * Check if FedCM is supported
236
+ */
237
+ const isFedCMSupported = useCallback(() => {
238
+ return crossDomainAuth.isFedCMSupported();
86
239
  }, [crossDomainAuth]);
240
+
241
+ /**
242
+ * Sign out via AuthManager (handles FedCM revocation and storage cleanup)
243
+ */
87
244
  const signOut = useCallback(async () => {
88
245
  setError(null);
89
246
  try {
90
- // Clear stored session
91
- if (typeof window !== 'undefined') {
92
- localStorage.removeItem('oxy-session');
93
- localStorage.removeItem('oxy-access-token');
94
- }
247
+ // Use centralized AuthManager for sign out (handles FedCM, storage cleanup)
248
+ await authManager.signOut();
249
+
250
+ // Clear user state
95
251
  setUser(null);
96
252
  } catch (err) {
97
- console.error('[WebOxy] Sign out error:', err);
98
- setError(err instanceof Error ? err.message : 'Sign out failed');
253
+ const errorMessage = err instanceof Error ? err.message : 'Sign out failed';
254
+ setError(errorMessage);
255
+ onError?.(err instanceof Error ? err : new Error(errorMessage));
99
256
  }
100
- }, []);
101
- const contextValue = {
257
+ }, [authManager, onError]);
258
+
259
+ // Cleanup on unmount
260
+ useEffect(() => {
261
+ return () => {
262
+ authManager.destroy();
263
+ };
264
+ }, [authManager]);
265
+
266
+ // Memoize context value to prevent unnecessary re-renders
267
+ const contextValue = useMemo(() => ({
268
+ // State
102
269
  user,
103
270
  isAuthenticated,
104
271
  isLoading,
105
272
  error,
273
+ // Services
274
+ oxyServices,
275
+ crossDomainAuth,
276
+ authManager,
277
+ // Actions
106
278
  signIn,
279
+ signInWithFedCM,
280
+ signInWithPopup,
281
+ signInWithRedirect,
107
282
  signOut,
108
- oxyServices
109
- };
283
+ isFedCMSupported
284
+ }), [user, isAuthenticated, isLoading, error, oxyServices, crossDomainAuth, authManager, signIn, signInWithFedCM, signInWithPopup, signInWithRedirect, signOut, isFedCMSupported]);
110
285
  return /*#__PURE__*/_jsx(QueryClientProvider, {
111
286
  client: queryClient,
112
287
  children: /*#__PURE__*/_jsx(WebOxyContext.Provider, {
@@ -115,6 +290,13 @@ export function WebOxyProvider({
115
290
  })
116
291
  });
117
292
  }
293
+
294
+ /**
295
+ * Hook to access the full Web Oxy context.
296
+ *
297
+ * @returns Full context value including oxyServices and crossDomainAuth
298
+ * @throws Error if used outside WebOxyProvider
299
+ */
118
300
  export function useWebOxy() {
119
301
  const context = useContext(WebOxyContext);
120
302
  if (!context) {
@@ -122,6 +304,39 @@ export function useWebOxy() {
122
304
  }
123
305
  return context;
124
306
  }
307
+
308
+ /**
309
+ * Hook for authentication in web apps.
310
+ *
311
+ * Provides a simplified interface for common auth operations.
312
+ *
313
+ * @returns Auth state and actions
314
+ * @throws Error if used outside WebOxyProvider
315
+ *
316
+ * @example
317
+ * ```tsx
318
+ * function LoginPage() {
319
+ * const { user, isAuthenticated, isLoading, signIn, signOut, isFedCMSupported } = useAuth();
320
+ *
321
+ * if (isLoading) return <Spinner />;
322
+ *
323
+ * if (isAuthenticated) {
324
+ * return (
325
+ * <div>
326
+ * <p>Welcome, {user.username}!</p>
327
+ * <button onClick={signOut}>Sign Out</button>
328
+ * </div>
329
+ * );
330
+ * }
331
+ *
332
+ * return (
333
+ * <button onClick={signIn}>
334
+ * {isFedCMSupported() ? 'Sign in with Oxy' : 'Sign in'}
335
+ * </button>
336
+ * );
337
+ * }
338
+ * ```
339
+ */
125
340
  export function useAuth() {
126
341
  const {
127
342
  user,
@@ -129,18 +344,34 @@ export function useAuth() {
129
344
  isLoading,
130
345
  error,
131
346
  signIn,
347
+ signInWithFedCM,
348
+ signInWithPopup,
349
+ signInWithRedirect,
132
350
  signOut,
133
- oxyServices
351
+ isFedCMSupported,
352
+ oxyServices,
353
+ authManager
134
354
  } = useWebOxy();
135
355
  return {
356
+ // State
136
357
  user,
137
358
  isAuthenticated,
138
359
  isLoading,
139
360
  isReady: !isLoading,
140
361
  error,
362
+ // Actions
141
363
  signIn,
364
+ signInWithFedCM,
365
+ signInWithPopup,
366
+ signInWithRedirect,
142
367
  signOut,
143
- oxyServices
368
+ // Utilities
369
+ isFedCMSupported,
370
+ oxyServices,
371
+ authManager
144
372
  };
145
373
  }
374
+
375
+ // Default export for convenience
376
+ export default WebOxyProvider;
146
377
  //# sourceMappingURL=WebOxyContext.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","useCallback","useContext","useEffect","useState","OxyServices","createCrossDomainAuth","QueryClientProvider","createQueryClient","jsx","_jsx","WebOxyContext","WebOxyProvider","children","baseURL","authWebUrl","onAuthStateChange","oxyServices","crossDomainAuth","user","setUser","isLoading","setIsLoading","error","setError","queryClient","isAuthenticated","mounted","initAuth","session","initialize","err","console","log","signIn","method","onMethodSelected","Error","message","signOut","window","localStorage","removeItem","contextValue","client","Provider","value","useWebOxy","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;IACJO,eAAe;IACfL,SAAS;IACT6B,OAAO,EAAE,CAAC7B,SAAS;IACnBE,KAAK;IACLW,MAAM;IACNK,OAAO;IACPtB;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["createContext","useCallback","useContext","useEffect","useMemo","useState","OxyServices","CrossDomainAuth","createAuthManager","QueryClientProvider","createQueryClient","jsx","_jsx","WebOxyContext","WebOxyProvider","children","baseURL","authWebUrl","onAuthStateChange","onError","preferredAuthMethod","skipAutoCheck","oxyServices","crossDomainAuth","authManager","autoRefresh","queryClient","user","setUser","isLoading","setIsLoading","error","setError","isAuthenticated","handleAuthSuccess","session","method","fullUser","getCurrentUser","handleAuthError","err","errorMessage","Error","message","mounted","initAuth","callbackSession","handleRedirectCallback","restoredUser","initialize","currentUser","signOut","silentSignIn","signIn","selectedMethod","onMethodSelected","signInWithFedCM","signInWithPopup","signInWithRedirect","redirectUri","window","location","href","undefined","isFedCMSupported","destroy","contextValue","client","Provider","value","useWebOxy","context","useAuth","isReady"],"sourceRoot":"../../../src","sources":["web/WebOxyContext.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,QAEH,OAAO;AACd,SAASC,WAAW,QAAQ,wBAAqB;AACjD,SAASC,eAAe,QAAQ,4BAAyB;AACzD,SAAsBC,iBAAiB,QAAQ,wBAAqB;AAGpE,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,iBAAiB,QAAQ,4BAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAgD5D,MAAMC,aAAa,gBAAGb,aAAa,CAA4B,IAAI,CAAC;AAkBpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO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X6B,MAAM,EACNG,eAAe,EACfC,eAAe,EACfC,kBAAkB,EAClBP,OAAO,EACPa,gBAAgB,CACjB,CAAC;EAEF,oBACEpD,IAAA,CAACH,mBAAmB;IAAC0D,MAAM,EAAEzC,WAAY;IAAAX,QAAA,eACvCH,IAAA,CAACC,aAAa,CAACuD,QAAQ;MAACC,KAAK,EAAEH,YAAa;MAAAnD,QAAA,EACzCA;IAAQ,CACa;EAAC,CACN,CAAC;AAE1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASuD,SAASA,CAAA,EAAuB;EAC9C,MAAMC,OAAO,GAAGrE,UAAU,CAACW,aAAa,CAAC;EACzC,IAAI,CAAC0D,OAAO,EAAE;IACZ,MAAM,IAAI7B,KAAK,CAAC,8CAA8C,CAAC;EACjE;EACA,OAAO6B,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAOA,CAAA,EAAG;EACxB,MAAM;IACJ7C,IAAI;IACJM,eAAe;IACfJ,SAAS;IACTE,KAAK;IACLsB,MAAM;IACNG,eAAe;IACfC,eAAe;IACfC,kBAAkB;IAClBP,OAAO;IACPa,gBAAgB;IAChB1C,WAAW;IACXE;EACF,CAAC,GAAG8C,SAAS,CAAC,CAAC;EAEf,OAAO;IACL;IACA3C,IAAI;IACJM,eAAe;IACfJ,SAAS;IACT4C,OAAO,EAAE,CAAC5C,SAAS;IACnBE,KAAK;IACL;IACAsB,MAAM;IACNG,eAAe;IACfC,eAAe;IACfC,kBAAkB;IAClBP,OAAO;IACP;IACAa,gBAAgB;IAChB1C,WAAW;IACXE;EACF,CAAC;AACH;;AAEA;AACA,eAAeV,cAAc","ignoreList":[]}
@@ -9,7 +9,7 @@
9
9
  * Features:
10
10
  * - WebOxyProvider for React context
11
11
  * - useAuth hook for authentication
12
- * - Cross-domain SSO via FedCM
12
+ * - Cross-domain SSO via FedCM, popup, or redirect
13
13
  * - Full TypeScript support
14
14
  * - Zero bundler configuration needed
15
15
  *
@@ -26,24 +26,45 @@
26
26
  * }
27
27
  *
28
28
  * function YourApp() {
29
- * const { user, isAuthenticated, signIn, signOut } = useAuth();
30
- * // ... your app logic
29
+ * const { user, isAuthenticated, signIn, signOut, isFedCMSupported } = useAuth();
30
+ *
31
+ * return (
32
+ * <button onClick={signIn}>
33
+ * {isFedCMSupported() ? 'Sign in with Oxy' : 'Sign in'}
34
+ * </button>
35
+ * );
31
36
  * }
32
37
  * ```
33
38
  */
34
39
 
35
40
  // ==================== Core API ====================
36
41
  // Re-export core services (zero React Native deps)
37
- export { OxyServices, OxyAuthenticationError, OxyAuthenticationTimeoutError, OXY_CLOUD_URL, oxyClient, CrossDomainAuth, createCrossDomainAuth, DeviceManager } from "../core/index.js";
42
+ export { OxyServices, OxyAuthenticationError, OxyAuthenticationTimeoutError, OXY_CLOUD_URL, oxyClient, CrossDomainAuth, createCrossDomainAuth, DeviceManager,
43
+ // Centralized auth management
44
+ AuthManager, createAuthManager } from "../core/index.js";
38
45
  // ==================== Web Components ====================
39
46
  export { WebOxyProvider, useWebOxy, useAuth } from "./WebOxyContext.js";
47
+ // ==================== Shared Utilities ====================
48
+ // Re-export shared utilities that work everywhere
49
+ export {
50
+ // Color utilities
51
+ darkenColor, lightenColor, hexToRgb, rgbToHex, withOpacity, isLightColor, getContrastTextColor } from "../shared/utils/colorUtils.js";
52
+ export {
53
+ // Theme utilities
54
+ normalizeTheme, normalizeColorScheme, getOppositeTheme, systemPrefersDarkMode, getSystemColorScheme } from "../shared/utils/themeUtils.js";
55
+ export {
56
+ // Error utilities
57
+ HttpStatus, getErrorStatus, getErrorMessage, isAlreadyRegisteredError, isUnauthorizedError, isForbiddenError, isNotFoundError, isRateLimitError, isServerError, isNetworkError, isRetryableError } from "../shared/utils/errorUtils.js";
58
+ export {
59
+ // Network utilities
60
+ delay, withRetry } from "../shared/utils/networkUtils.js";
40
61
 
41
62
  // ==================== Models & Types ====================
42
63
  // Re-export commonly used types
43
64
 
44
65
  // Re-export session types
45
66
 
46
- // ==================== Utilities ====================
67
+ // ==================== Language Utilities ====================
47
68
  export { SUPPORTED_LANGUAGES, getLanguageMetadata, getLanguageName, getNativeLanguageName, normalizeLanguageCode } from "../utils/languageUtils.js";
48
69
  // Default export for convenience
49
70
  import { WebOxyProvider } from "./WebOxyContext.js";
@@ -1 +1 @@
1
- {"version":3,"names":["OxyServices","OxyAuthenticationError","OxyAuthenticationTimeoutError","OXY_CLOUD_URL","oxyClient","CrossDomainAuth","createCrossDomainAuth","DeviceManager","WebOxyProvider","useWebOxy","useAuth","SUPPORTED_LANGUAGES","getLanguageMetadata","getLanguageName","getNativeLanguageName","normalizeLanguageCode"],"sourceRoot":"../../../src","sources":["web/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SACEA,WAAW,EACXC,sBAAsB,EACtBC,6BAA6B,EAC7BC,aAAa,EACbC,SAAS,EACTC,eAAe,EACfC,qBAAqB,EACrBC,aAAa,QACR,kBAAS;AAQhB;AACA,SAASC,cAAc,EAAEC,SAAS,EAAEC,OAAO,QAAQ,oBAAiB;;AAGpE;AACA;;AAcA;;AAGA;AACA,SACEC,mBAAmB,EACnBC,mBAAmB,EACnBC,eAAe,EACfC,qBAAqB,EACrBC,qBAAqB,QAChB,2BAAwB;AAI/B;AACA,SAASP,cAAc,QAAQ,oBAAiB;AAChD,eAAeA,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["OxyServices","OxyAuthenticationError","OxyAuthenticationTimeoutError","OXY_CLOUD_URL","oxyClient","CrossDomainAuth","createCrossDomainAuth","DeviceManager","AuthManager","createAuthManager","WebOxyProvider","useWebOxy","useAuth","darkenColor","lightenColor","hexToRgb","rgbToHex","withOpacity","isLightColor","getContrastTextColor","normalizeTheme","normalizeColorScheme","getOppositeTheme","systemPrefersDarkMode","getSystemColorScheme","HttpStatus","getErrorStatus","getErrorMessage","isAlreadyRegisteredError","isUnauthorizedError","isForbiddenError","isNotFoundError","isRateLimitError","isServerError","isNetworkError","isRetryableError","delay","withRetry","SUPPORTED_LANGUAGES","getLanguageMetadata","getLanguageName","getNativeLanguageName","normalizeLanguageCode"],"sourceRoot":"../../../src","sources":["web/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SACEA,WAAW,EACXC,sBAAsB,EACtBC,6BAA6B,EAC7BC,aAAa,EACbC,SAAS,EACTC,eAAe,EACfC,qBAAqB,EACrBC,aAAa;AACb;AACAC,WAAW,EACXC,iBAAiB,QACZ,kBAAS;AAahB;AACA,SACEC,cAAc,EACdC,SAAS,EACTC,OAAO,QACF,oBAAiB;AASxB;AACA;AACA;AACE;AACAC,WAAW,EACXC,YAAY,EACZC,QAAQ,EACRC,QAAQ,EACRC,WAAW,EACXC,YAAY,EACZC,oBAAoB,QACf,+BAA4B;AAEnC;AACE;AACAC,cAAc,EACdC,oBAAoB,EACpBC,gBAAgB,EAChBC,qBAAqB,EACrBC,oBAAoB,QACf,+BAA4B;AAGnC;AACE;AACAC,UAAU,EACVC,cAAc,EACdC,eAAe,EACfC,wBAAwB,EACxBC,mBAAmB,EACnBC,gBAAgB,EAChBC,eAAe,EACfC,gBAAgB,EAChBC,aAAa,EACbC,cAAc,EACdC,gBAAgB,QACX,+BAA4B;AAEnC;AACE;AACAC,KAAK,EACLC,SAAS,QACJ,iCAA8B;;AAErC;AACA;;AAiBA;;AAGA;AACA,SACEC,mBAAmB,EACnBC,mBAAmB,EACnBC,eAAe,EACfC,qBAAqB,EACrBC,qBAAqB,QAChB,2BAAwB;AAI/B;AACA,SAAShC,cAAc,QAAQ,oBAAiB;AAChD,eAAeA,cAAc","ignoreList":[]}
package/lib/module/web.js CHANGED
@@ -67,7 +67,8 @@ export { useFileFiltering } from "./ui/hooks/useFileFiltering.js";
67
67
 
68
68
  // Utilities
69
69
  export * from "./utils/apiUtils.js";
70
- export { ErrorCodes, createApiError, handleHttpError, validateRequiredFields, retryWithBackoff } from "./utils/errorUtils.js";
70
+ export { ErrorCodes, createApiError, handleHttpError, validateRequiredFields } from "./utils/errorUtils.js";
71
+ export { retryAsync } from "./utils/asyncUtils.js";
71
72
  export * from "./utils/validationUtils.js";
72
73
  export { logger, LogLevel, logAuth, logApi, logSession, logUser, logDevice, logPayment, logPerformance } from "./utils/loggerUtils.js";
73
74
  export * from "./utils/asyncUtils.js";
@@ -1 +1 @@
1
- {"version":3,"names":["OxyServices","OxyAuthenticationError","OxyAuthenticationTimeoutError","OXY_CLOUD_URL","oxyClient","CrossDomainAuth","createCrossDomainAuth","KeyManager","SignatureService","RecoveryPhraseService","useOxy","useAuth","default","WebOxyProvider","DeviceManager","SUPPORTED_LANGUAGES","getLanguageMetadata","getLanguageName","getNativeLanguageName","normalizeLanguageCode","SECURITY_EVENT_SEVERITY_MAP","useAuthStore","useAssetStore","useAssets","useAssetsStore","useAsset","useUploadProgress","useAssetLoading","useAssetErrors","useAssetsByApp","useAssetsByEntity","useAssetUsageCount","useIsAssetLinked","useSessionSocket","setOxyAssetInstance","useFileDownloadUrl","setOxyFileUrlInstance","useUserProfile","useUserProfiles","useCurrentUser","useUserById","useUserByUsername","useUsersBySessions","usePrivacySettings","useSessions","useSession","useDeviceSessions","useUserDevices","useSecurityInfo","useSecurityActivity","useRecentSecurityActivity","useUpdateProfile","useUploadAvatar","useUpdateAccountSettings","useUpdatePrivacySettings","useUploadFile","useSwitchSession","useLogoutSession","useLogoutAll","useUpdateDeviceName","useRemoveDevice","createProfileMutation","createGenericMutation","ensureValidToken","withAuthErrorHandling","authenticatedApiCall","isAuthenticationError","SessionSyncRequiredError","AuthenticationFailedError","useFileFiltering","ErrorCodes","createApiError","handleHttpError","validateRequiredFields","retryWithBackoff","logger","LogLevel","logAuth","logApi","logSession","logUser","logDevice","logPayment","logPerformance"],"sourceRoot":"../../src","sources":["web.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,OAAO,sBAAmB;;AAE1B;AACA,SAASA,WAAW,EAAEC,sBAAsB,EAAEC,6BAA6B,QAAQ,iBAAQ;AAC3F,SAASC,aAAa,EAAEC,SAAS,QAAQ,iBAAQ;;AAEjD;AACA,SAASC,eAAe,EAAEC,qBAAqB,QAAQ,iBAAQ;AAG/D;AACA,SACEC,UAAU,EACVC,gBAAgB,EAChBC,qBAAqB,QAChB,mBAAU;AAQjB;AACA,SAASC,MAAM,QAAQ,4BAAyB;AAChD,SAASC,OAAO,QAAQ,uBAAoB;AAG5C;AACA,SAASC,OAAO,IAAIC,cAAc,QAAQ,mCAAgC;;AAE1E;AACA,SAASC,aAAa,QAAQ,0BAAuB;AAGrD;AACA,SACEC,mBAAmB,EACnBC,mBAAmB,EACnBC,eAAe,EACfC,qBAAqB,EACrBC,qBAAqB,QAChB,0BAAuB;;AAG9B;;AAwDA,SAASC,2BAA2B,QAAQ,wBAAqB;AAQjE;AACA,SAASC,YAAY,QAAQ,0BAAuB;AACpD,SACEC,aAAa,EACbC,SAAS,IAAIC,cAAc,EAC3BC,QAAQ,EACRC,iBAAiB,EACjBC,eAAe,EACfC,cAAc,EACdC,cAAc,EACdC,iBAAiB,EACjBC,kBAAkB,EAClBC,gBAAgB,QACX,2BAAwB;;AAE/B;AACA,SAASC,gBAAgB,QAAQ,gCAA6B;AAC9D,SAASV,SAAS,EAAEW,mBAAmB,QAAQ,yBAAsB;AACrE,SAASC,kBAAkB,EAAEC,qBAAqB,QAAQ,kCAA+B;;AAEzF;AACA,SACEC,cAAc,EACdC,eAAe,EACfC,cAAc,EACdC,WAAW,EACXC,iBAAiB,EACjBC,kBAAkB,EAClBC,kBAAkB,EAClBC,WAAW,EACXC,UAAU,EACVC,iBAAiB,EACjBC,cAAc,EACdC,eAAe,EACfC,mBAAmB,EACnBC,yBAAyB,QACpB,6BAAoB;;AAE3B;AACA,SACEC,gBAAgB,EAChBC,eAAe,EACfC,wBAAwB,EACxBC,wBAAwB,EACxBC,aAAa,EACbC,gBAAgB,EAChBC,gBAAgB,EAChBC,YAAY,EACZC,mBAAmB,EACnBC,eAAe,QACV,+BAAsB;;AAE7B;AACA,SACEC,qBAAqB,EACrBC,qBAAqB,QAChB,yCAAsC;AAM7C;AACA,SACEC,gBAAgB,EAChBC,qBAAqB,EACrBC,oBAAoB,EACpBC,qBAAqB,EACrBC,wBAAwB,EACxBC,yBAAyB,QACpB,2BAAwB;AAG/B;AACA,SAASC,gBAAgB,QAAQ,gCAA6B;AAG9D;AACA;AACA;;AAEA;AACA,cAAc,qBAAkB;AAChC,SACEC,UAAU,EACVC,cAAc,EACdC,eAAe,EACfC,sBAAsB,EACtBC,gBAAgB,QACX,uBAAoB;AAC3B,cAAc,4BAAyB;AACvC,SACEC,MAAM,EACNC,QAAQ,EACRC,OAAO,EACPC,MAAM,EACNC,UAAU,EACVC,OAAO,EACPC,SAAS,EACTC,UAAU,EACVC,cAAc,QACT,wBAAqB;AAE5B,cAAc,uBAAoB;AAClC,cAAc,sBAAmB","ignoreList":[]}
1
+ {"version":3,"names":["OxyServices","OxyAuthenticationError","OxyAuthenticationTimeoutError","OXY_CLOUD_URL","oxyClient","CrossDomainAuth","createCrossDomainAuth","KeyManager","SignatureService","RecoveryPhraseService","useOxy","useAuth","default","WebOxyProvider","DeviceManager","SUPPORTED_LANGUAGES","getLanguageMetadata","getLanguageName","getNativeLanguageName","normalizeLanguageCode","SECURITY_EVENT_SEVERITY_MAP","useAuthStore","useAssetStore","useAssets","useAssetsStore","useAsset","useUploadProgress","useAssetLoading","useAssetErrors","useAssetsByApp","useAssetsByEntity","useAssetUsageCount","useIsAssetLinked","useSessionSocket","setOxyAssetInstance","useFileDownloadUrl","setOxyFileUrlInstance","useUserProfile","useUserProfiles","useCurrentUser","useUserById","useUserByUsername","useUsersBySessions","usePrivacySettings","useSessions","useSession","useDeviceSessions","useUserDevices","useSecurityInfo","useSecurityActivity","useRecentSecurityActivity","useUpdateProfile","useUploadAvatar","useUpdateAccountSettings","useUpdatePrivacySettings","useUploadFile","useSwitchSession","useLogoutSession","useLogoutAll","useUpdateDeviceName","useRemoveDevice","createProfileMutation","createGenericMutation","ensureValidToken","withAuthErrorHandling","authenticatedApiCall","isAuthenticationError","SessionSyncRequiredError","AuthenticationFailedError","useFileFiltering","ErrorCodes","createApiError","handleHttpError","validateRequiredFields","retryAsync","logger","LogLevel","logAuth","logApi","logSession","logUser","logDevice","logPayment","logPerformance"],"sourceRoot":"../../src","sources":["web.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,OAAO,sBAAmB;;AAE1B;AACA,SAASA,WAAW,EAAEC,sBAAsB,EAAEC,6BAA6B,QAAQ,iBAAQ;AAC3F,SAASC,aAAa,EAAEC,SAAS,QAAQ,iBAAQ;;AAEjD;AACA,SAASC,eAAe,EAAEC,qBAAqB,QAAQ,iBAAQ;AAG/D;AACA,SACEC,UAAU,EACVC,gBAAgB,EAChBC,qBAAqB,QAChB,mBAAU;AAQjB;AACA,SAASC,MAAM,QAAQ,4BAAyB;AAChD,SAASC,OAAO,QAAQ,uBAAoB;AAG5C;AACA,SAASC,OAAO,IAAIC,cAAc,QAAQ,mCAAgC;;AAE1E;AACA,SAASC,aAAa,QAAQ,0BAAuB;AAGrD;AACA,SACEC,mBAAmB,EACnBC,mBAAmB,EAC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