@oxyhq/services 5.25.0 → 5.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (532) 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/crypto/keyManager.js +16 -21
  13. package/lib/commonjs/crypto/keyManager.js.map +1 -1
  14. package/lib/commonjs/index.js +386 -18
  15. package/lib/commonjs/index.js.map +1 -1
  16. package/lib/commonjs/lib/sonner.js +13 -17
  17. package/lib/commonjs/lib/sonner.js.map +1 -1
  18. package/lib/commonjs/lib/sonner.native.js +24 -0
  19. package/lib/commonjs/lib/sonner.native.js.map +1 -0
  20. package/lib/commonjs/lib/sonner.web.js +24 -0
  21. package/lib/commonjs/lib/sonner.web.js.map +1 -0
  22. package/lib/commonjs/shared/index.js +227 -0
  23. package/lib/commonjs/shared/index.js.map +1 -0
  24. package/lib/commonjs/shared/utils/colorUtils.js +161 -0
  25. package/lib/commonjs/shared/utils/colorUtils.js.map +1 -0
  26. package/lib/commonjs/shared/utils/debugUtils.js +84 -0
  27. package/lib/commonjs/shared/utils/debugUtils.js.map +1 -0
  28. package/lib/commonjs/shared/utils/errorUtils.js +190 -0
  29. package/lib/commonjs/shared/utils/errorUtils.js.map +1 -0
  30. package/lib/commonjs/shared/utils/index.js +196 -0
  31. package/lib/commonjs/shared/utils/index.js.map +1 -0
  32. package/lib/commonjs/shared/utils/networkUtils.js +213 -0
  33. package/lib/commonjs/shared/utils/networkUtils.js.map +1 -0
  34. package/lib/commonjs/shared/utils/themeUtils.js +118 -0
  35. package/lib/commonjs/shared/utils/themeUtils.js.map +1 -0
  36. package/lib/commonjs/ui/client.js +1 -1
  37. package/lib/commonjs/ui/components/BottomSheetRouter.js +1 -1
  38. package/lib/commonjs/ui/components/FollowButton.js +1 -1
  39. package/lib/commonjs/ui/components/FontLoader.js +1 -1
  40. package/lib/commonjs/ui/components/FontLoader.js.map +1 -1
  41. package/lib/commonjs/ui/components/GroupedItem.js +1 -1
  42. package/lib/commonjs/ui/components/Header.js +1 -1
  43. package/lib/commonjs/ui/components/OxyProvider.js +10 -2
  44. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  45. package/lib/commonjs/ui/components/OxySignInButton.js +19 -20
  46. package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
  47. package/lib/commonjs/ui/components/ProfileCard.js +1 -1
  48. package/lib/commonjs/ui/components/ProfileCard.js.map +1 -1
  49. package/lib/commonjs/ui/components/QuickActions.js +1 -1
  50. package/lib/commonjs/ui/components/QuickActions.js.map +1 -1
  51. package/lib/commonjs/ui/components/Section.js +1 -1
  52. package/lib/commonjs/ui/components/SectionTitle.js +1 -1
  53. package/lib/commonjs/ui/components/SignInModal.js +546 -0
  54. package/lib/commonjs/ui/components/SignInModal.js.map +1 -0
  55. package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js +1 -1
  56. package/lib/commonjs/ui/context/OxyContext.js +3 -2
  57. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  58. package/lib/commonjs/ui/hooks/mutations/mutationFactory.js +1 -1
  59. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +1 -1
  60. package/lib/commonjs/ui/hooks/mutations/useServicesMutations.js +1 -1
  61. package/lib/commonjs/ui/hooks/useAsyncAction.js +1 -1
  62. package/lib/commonjs/ui/hooks/{use-color-scheme.js → useColorScheme.js} +1 -1
  63. package/lib/commonjs/ui/hooks/useColorScheme.js.map +1 -0
  64. package/lib/commonjs/ui/hooks/useSessionSocket.js +7 -13
  65. package/lib/commonjs/ui/hooks/useSessionSocket.js.map +1 -1
  66. package/lib/commonjs/ui/hooks/useSettingToggle.js +1 -1
  67. package/lib/commonjs/ui/hooks/useThemeColors.js +1 -1
  68. package/lib/commonjs/ui/hooks/useThemeStyles.js +1 -1
  69. package/lib/commonjs/ui/navigation/bottomSheetManager.js +5 -2
  70. package/lib/commonjs/ui/navigation/bottomSheetManager.js.map +1 -1
  71. package/lib/commonjs/ui/navigation/routes.js +7 -8
  72. package/lib/commonjs/ui/navigation/routes.js.map +1 -1
  73. package/lib/commonjs/ui/screens/AccountCenterScreen.js +8 -8
  74. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
  75. package/lib/commonjs/ui/screens/AccountOverviewScreen.js +7 -7
  76. package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
  77. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +3 -3
  78. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +5 -5
  79. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
  80. package/lib/commonjs/ui/screens/AccountVerificationScreen.js +1 -1
  81. package/lib/commonjs/ui/screens/AppInfoScreen.js +2 -2
  82. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +2 -2
  83. package/lib/commonjs/ui/screens/FAQScreen.js +1 -1
  84. package/lib/commonjs/ui/screens/FeedbackScreen.js +1 -1
  85. package/lib/commonjs/ui/screens/FileManagementScreen.js +2 -2
  86. package/lib/commonjs/ui/screens/FollowersListScreen.js +18 -0
  87. package/lib/commonjs/ui/screens/FollowersListScreen.js.map +1 -0
  88. package/lib/commonjs/ui/screens/FollowingListScreen.js +18 -0
  89. package/lib/commonjs/ui/screens/FollowingListScreen.js.map +1 -0
  90. package/lib/commonjs/ui/screens/HelpSupportScreen.js +2 -2
  91. package/lib/commonjs/ui/screens/HelpSupportScreen.js.map +1 -1
  92. package/lib/commonjs/ui/screens/HistoryViewScreen.js +2 -2
  93. package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +2 -2
  94. package/lib/commonjs/ui/screens/LearnMoreUsernamesScreen.js +229 -0
  95. package/lib/commonjs/ui/screens/LearnMoreUsernamesScreen.js.map +1 -0
  96. package/lib/commonjs/ui/screens/LegalDocumentsScreen.js +2 -2
  97. package/lib/commonjs/ui/screens/LegalDocumentsScreen.js.map +1 -1
  98. package/lib/commonjs/ui/screens/OxyAuthScreen.js +9 -21
  99. package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
  100. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +2 -2
  101. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +1 -1
  102. package/lib/commonjs/ui/screens/ProfileScreen.js +1 -1
  103. package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
  104. package/lib/commonjs/ui/screens/SavesCollectionsScreen.js +2 -2
  105. package/lib/commonjs/ui/screens/SessionManagementScreen.js +1 -1
  106. package/lib/commonjs/ui/screens/UserListScreen.js +411 -0
  107. package/lib/commonjs/ui/screens/UserListScreen.js.map +1 -0
  108. package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js +1 -1
  109. package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js +1 -1
  110. package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +1 -1
  111. package/lib/commonjs/ui/screens/karma/KarmaFAQScreen.js +1 -1
  112. package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
  113. package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js +1 -1
  114. package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js +1 -1
  115. package/lib/commonjs/ui/stores/authStore.js +4 -6
  116. package/lib/commonjs/ui/stores/authStore.js.map +1 -1
  117. package/lib/commonjs/ui/utils/colorUtils.js +43 -46
  118. package/lib/commonjs/ui/utils/colorUtils.js.map +1 -1
  119. package/lib/commonjs/ui/utils/fileManagement.js +1 -1
  120. package/lib/commonjs/ui/utils/themeUtils.js +29 -39
  121. package/lib/commonjs/ui/utils/themeUtils.js.map +1 -1
  122. package/lib/commonjs/ui/utils/{user-utils.js → userUtils.js} +1 -1
  123. package/lib/commonjs/ui/utils/userUtils.js.map +1 -0
  124. package/lib/commonjs/utils/errorUtils.js +0 -13
  125. package/lib/commonjs/utils/errorUtils.js.map +1 -1
  126. package/lib/commonjs/utils/hookUtils.js +8 -8
  127. package/lib/commonjs/utils/hookUtils.js.map +1 -1
  128. package/lib/commonjs/utils/platform.js +129 -0
  129. package/lib/commonjs/utils/platform.js.map +1 -0
  130. package/lib/commonjs/web/WebOxyContext.js +273 -41
  131. package/lib/commonjs/web/WebOxyContext.js.map +1 -1
  132. package/lib/commonjs/web/index.js +177 -4
  133. package/lib/commonjs/web/index.js.map +1 -1
  134. package/lib/commonjs/web.js +12 -12
  135. package/lib/commonjs/web.js.map +1 -1
  136. package/lib/module/core/AuthManager.js +399 -0
  137. package/lib/module/core/AuthManager.js.map +1 -0
  138. package/lib/module/core/HttpService.js +39 -1
  139. package/lib/module/core/HttpService.js.map +1 -1
  140. package/lib/module/core/index.js +2 -0
  141. package/lib/module/core/index.js.map +1 -1
  142. package/lib/module/core/mixins/OxyServices.fedcm.js +38 -44
  143. package/lib/module/core/mixins/OxyServices.fedcm.js.map +1 -1
  144. package/lib/module/core/mixins/OxyServices.popup.js +9 -7
  145. package/lib/module/core/mixins/OxyServices.popup.js.map +1 -1
  146. package/lib/module/crypto/keyManager.js +16 -21
  147. package/lib/module/crypto/keyManager.js.map +1 -1
  148. package/lib/module/index.js +34 -3
  149. package/lib/module/index.js.map +1 -1
  150. package/lib/module/lib/sonner.js +11 -16
  151. package/lib/module/lib/sonner.js.map +1 -1
  152. package/lib/module/lib/sonner.native.js +19 -0
  153. package/lib/module/lib/sonner.native.js.map +1 -0
  154. package/lib/module/lib/sonner.web.js +19 -0
  155. package/lib/module/lib/sonner.web.js.map +1 -0
  156. package/lib/module/shared/index.js +37 -0
  157. package/lib/module/shared/index.js.map +1 -0
  158. package/lib/module/shared/utils/colorUtils.js +150 -0
  159. package/lib/module/shared/utils/colorUtils.js.map +1 -0
  160. package/lib/module/shared/utils/debugUtils.js +75 -0
  161. package/lib/module/shared/utils/debugUtils.js.map +1 -0
  162. package/lib/module/shared/utils/errorUtils.js +176 -0
  163. package/lib/module/shared/utils/errorUtils.js.map +1 -0
  164. package/lib/module/shared/utils/index.js +21 -0
  165. package/lib/module/shared/utils/index.js.map +1 -0
  166. package/lib/module/shared/utils/networkUtils.js +202 -0
  167. package/lib/module/shared/utils/networkUtils.js.map +1 -0
  168. package/lib/module/shared/utils/themeUtils.js +109 -0
  169. package/lib/module/shared/utils/themeUtils.js.map +1 -0
  170. package/lib/module/ui/client.js +1 -1
  171. package/lib/module/ui/client.js.map +1 -1
  172. package/lib/module/ui/components/BottomSheetRouter.js +1 -1
  173. package/lib/module/ui/components/BottomSheetRouter.js.map +1 -1
  174. package/lib/module/ui/components/FollowButton.js +1 -1
  175. package/lib/module/ui/components/FollowButton.js.map +1 -1
  176. package/lib/module/ui/components/FontLoader.js +1 -1
  177. package/lib/module/ui/components/FontLoader.js.map +1 -1
  178. package/lib/module/ui/components/GroupedItem.js +1 -1
  179. package/lib/module/ui/components/GroupedItem.js.map +1 -1
  180. package/lib/module/ui/components/Header.js +1 -1
  181. package/lib/module/ui/components/Header.js.map +1 -1
  182. package/lib/module/ui/components/OxyProvider.js +10 -2
  183. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  184. package/lib/module/ui/components/OxySignInButton.js +20 -21
  185. package/lib/module/ui/components/OxySignInButton.js.map +1 -1
  186. package/lib/module/ui/components/ProfileCard.js +1 -1
  187. package/lib/module/ui/components/ProfileCard.js.map +1 -1
  188. package/lib/module/ui/components/QuickActions.js +1 -1
  189. package/lib/module/ui/components/QuickActions.js.map +1 -1
  190. package/lib/module/ui/components/Section.js +1 -1
  191. package/lib/module/ui/components/Section.js.map +1 -1
  192. package/lib/module/ui/components/SectionTitle.js +1 -1
  193. package/lib/module/ui/components/SectionTitle.js.map +1 -1
  194. package/lib/module/ui/components/SignInModal.js +536 -0
  195. package/lib/module/ui/components/SignInModal.js.map +1 -0
  196. package/lib/module/ui/components/payment/PaymentDetailsStep.js +1 -1
  197. package/lib/module/ui/components/payment/PaymentDetailsStep.js.map +1 -1
  198. package/lib/module/ui/context/OxyContext.js +2 -2
  199. package/lib/module/ui/context/OxyContext.js.map +1 -1
  200. package/lib/module/ui/hooks/mutations/mutationFactory.js +1 -1
  201. package/lib/module/ui/hooks/mutations/mutationFactory.js.map +1 -1
  202. package/lib/module/ui/hooks/mutations/useAccountMutations.js +1 -1
  203. package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  204. package/lib/module/ui/hooks/mutations/useServicesMutations.js +1 -1
  205. package/lib/module/ui/hooks/mutations/useServicesMutations.js.map +1 -1
  206. package/lib/module/ui/hooks/useAsyncAction.js +1 -1
  207. package/lib/module/ui/hooks/useAsyncAction.js.map +1 -1
  208. package/lib/module/ui/hooks/{use-color-scheme.js → useColorScheme.js} +1 -1
  209. package/lib/module/ui/hooks/useColorScheme.js.map +1 -0
  210. package/lib/module/ui/hooks/useSessionSocket.js +7 -13
  211. package/lib/module/ui/hooks/useSessionSocket.js.map +1 -1
  212. package/lib/module/ui/hooks/useSettingToggle.js +1 -1
  213. package/lib/module/ui/hooks/useSettingToggle.js.map +1 -1
  214. package/lib/module/ui/hooks/useThemeColors.js +1 -1
  215. package/lib/module/ui/hooks/useThemeColors.js.map +1 -1
  216. package/lib/module/ui/hooks/useThemeStyles.js +1 -1
  217. package/lib/module/ui/hooks/useThemeStyles.js.map +1 -1
  218. package/lib/module/ui/navigation/bottomSheetManager.js +5 -2
  219. package/lib/module/ui/navigation/bottomSheetManager.js.map +1 -1
  220. package/lib/module/ui/navigation/routes.js +7 -8
  221. package/lib/module/ui/navigation/routes.js.map +1 -1
  222. package/lib/module/ui/screens/AccountCenterScreen.js +8 -8
  223. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
  224. package/lib/module/ui/screens/AccountOverviewScreen.js +7 -7
  225. package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
  226. package/lib/module/ui/screens/AccountSettingsScreen.js +3 -3
  227. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  228. package/lib/module/ui/screens/AccountSwitcherScreen.js +5 -5
  229. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  230. package/lib/module/ui/screens/AccountVerificationScreen.js +1 -1
  231. package/lib/module/ui/screens/AccountVerificationScreen.js.map +1 -1
  232. package/lib/module/ui/screens/AppInfoScreen.js +2 -2
  233. package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
  234. package/lib/module/ui/screens/EditProfileFieldScreen.js +2 -2
  235. package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
  236. package/lib/module/ui/screens/FAQScreen.js +1 -1
  237. package/lib/module/ui/screens/FAQScreen.js.map +1 -1
  238. package/lib/module/ui/screens/FeedbackScreen.js +1 -1
  239. package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
  240. package/lib/module/ui/screens/FileManagementScreen.js +2 -2
  241. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  242. package/lib/module/ui/screens/FollowersListScreen.js +13 -0
  243. package/lib/module/ui/screens/FollowersListScreen.js.map +1 -0
  244. package/lib/module/ui/screens/FollowingListScreen.js +13 -0
  245. package/lib/module/ui/screens/FollowingListScreen.js.map +1 -0
  246. package/lib/module/ui/screens/HelpSupportScreen.js +2 -2
  247. package/lib/module/ui/screens/HelpSupportScreen.js.map +1 -1
  248. package/lib/module/ui/screens/HistoryViewScreen.js +2 -2
  249. package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
  250. package/lib/module/ui/screens/LanguageSelectorScreen.js +2 -2
  251. package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -1
  252. package/lib/module/ui/screens/LearnMoreUsernamesScreen.js +224 -0
  253. package/lib/module/ui/screens/LearnMoreUsernamesScreen.js.map +1 -0
  254. package/lib/module/ui/screens/LegalDocumentsScreen.js +2 -2
  255. package/lib/module/ui/screens/LegalDocumentsScreen.js.map +1 -1
  256. package/lib/module/ui/screens/OxyAuthScreen.js +9 -21
  257. package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
  258. package/lib/module/ui/screens/PremiumSubscriptionScreen.js +2 -2
  259. package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  260. package/lib/module/ui/screens/PrivacySettingsScreen.js +1 -1
  261. package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
  262. package/lib/module/ui/screens/ProfileScreen.js +1 -1
  263. package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
  264. package/lib/module/ui/screens/SavesCollectionsScreen.js +2 -2
  265. package/lib/module/ui/screens/SavesCollectionsScreen.js.map +1 -1
  266. package/lib/module/ui/screens/SessionManagementScreen.js +1 -1
  267. package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
  268. package/lib/module/ui/screens/UserListScreen.js +405 -0
  269. package/lib/module/ui/screens/UserListScreen.js.map +1 -0
  270. package/lib/module/ui/screens/WelcomeNewUserScreen.js +1 -1
  271. package/lib/module/ui/screens/WelcomeNewUserScreen.js.map +1 -1
  272. package/lib/module/ui/screens/karma/KarmaAboutScreen.js +1 -1
  273. package/lib/module/ui/screens/karma/KarmaAboutScreen.js.map +1 -1
  274. package/lib/module/ui/screens/karma/KarmaCenterScreen.js +1 -1
  275. package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
  276. package/lib/module/ui/screens/karma/KarmaFAQScreen.js +1 -1
  277. package/lib/module/ui/screens/karma/KarmaFAQScreen.js.map +1 -1
  278. package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js +1 -1
  279. package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js.map +1 -1
  280. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js +1 -1
  281. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
  282. package/lib/module/ui/screens/karma/KarmaRulesScreen.js +1 -1
  283. package/lib/module/ui/screens/karma/KarmaRulesScreen.js.map +1 -1
  284. package/lib/module/ui/stores/authStore.js +4 -6
  285. package/lib/module/ui/stores/authStore.js.map +1 -1
  286. package/lib/module/ui/utils/colorUtils.js +7 -40
  287. package/lib/module/ui/utils/colorUtils.js.map +1 -1
  288. package/lib/module/ui/utils/fileManagement.js +1 -1
  289. package/lib/module/ui/utils/fileManagement.js.map +1 -1
  290. package/lib/module/ui/utils/themeUtils.js +7 -35
  291. package/lib/module/ui/utils/themeUtils.js.map +1 -1
  292. package/lib/module/ui/utils/{user-utils.js → userUtils.js} +1 -1
  293. package/lib/module/ui/utils/userUtils.js.map +1 -0
  294. package/lib/module/utils/errorUtils.js +0 -7
  295. package/lib/module/utils/errorUtils.js.map +1 -1
  296. package/lib/module/utils/hookUtils.js +8 -8
  297. package/lib/module/utils/hookUtils.js.map +1 -1
  298. package/lib/module/utils/platform.js +118 -0
  299. package/lib/module/utils/platform.js.map +1 -0
  300. package/lib/module/web/WebOxyContext.js +272 -41
  301. package/lib/module/web/WebOxyContext.js.map +1 -1
  302. package/lib/module/web/index.js +26 -5
  303. package/lib/module/web/index.js.map +1 -1
  304. package/lib/module/web.js +2 -1
  305. package/lib/module/web.js.map +1 -1
  306. package/lib/typescript/commonjs/core/AuthManager.d.ts +144 -0
  307. package/lib/typescript/commonjs/core/AuthManager.d.ts.map +1 -0
  308. package/lib/typescript/commonjs/core/HttpService.d.ts.map +1 -1
  309. package/lib/typescript/commonjs/core/index.d.ts +2 -0
  310. package/lib/typescript/commonjs/core/index.d.ts.map +1 -1
  311. package/lib/typescript/commonjs/core/mixins/OxyServices.fedcm.d.ts.map +1 -1
  312. package/lib/typescript/commonjs/core/mixins/OxyServices.popup.d.ts.map +1 -1
  313. package/lib/typescript/commonjs/crypto/keyManager.d.ts.map +1 -1
  314. package/lib/typescript/commonjs/index.d.ts +16 -2
  315. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  316. package/lib/typescript/commonjs/lib/sonner.d.ts +11 -14
  317. package/lib/typescript/commonjs/lib/sonner.d.ts.map +1 -1
  318. package/lib/typescript/commonjs/lib/sonner.native.d.ts +15 -0
  319. package/lib/typescript/commonjs/lib/sonner.native.d.ts.map +1 -0
  320. package/lib/typescript/commonjs/lib/sonner.web.d.ts +15 -0
  321. package/lib/typescript/commonjs/lib/sonner.web.d.ts.map +1 -0
  322. package/lib/typescript/commonjs/models/session.d.ts +4 -0
  323. package/lib/typescript/commonjs/models/session.d.ts.map +1 -1
  324. package/lib/typescript/commonjs/shared/index.d.ts +29 -0
  325. package/lib/typescript/commonjs/shared/index.d.ts.map +1 -0
  326. package/lib/typescript/commonjs/shared/utils/colorUtils.d.ts +105 -0
  327. package/lib/typescript/commonjs/shared/utils/colorUtils.d.ts.map +1 -0
  328. package/lib/typescript/commonjs/shared/utils/debugUtils.d.ts +49 -0
  329. package/lib/typescript/commonjs/shared/utils/debugUtils.d.ts.map +1 -0
  330. package/lib/typescript/commonjs/shared/utils/errorUtils.d.ts +98 -0
  331. package/lib/typescript/commonjs/shared/utils/errorUtils.d.ts.map +1 -0
  332. package/lib/typescript/commonjs/shared/utils/index.d.ts +14 -0
  333. package/lib/typescript/commonjs/shared/utils/index.d.ts.map +1 -0
  334. package/lib/typescript/commonjs/shared/utils/networkUtils.d.ts +140 -0
  335. package/lib/typescript/commonjs/shared/utils/networkUtils.d.ts.map +1 -0
  336. package/lib/typescript/commonjs/shared/utils/themeUtils.d.ts +91 -0
  337. package/lib/typescript/commonjs/shared/utils/themeUtils.d.ts.map +1 -0
  338. package/lib/typescript/commonjs/ui/components/FontLoader.d.ts +1 -1
  339. package/lib/typescript/commonjs/ui/components/FontLoader.d.ts.map +1 -1
  340. package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
  341. package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts.map +1 -1
  342. package/lib/typescript/commonjs/ui/components/SignInModal.d.ts +18 -0
  343. package/lib/typescript/commonjs/ui/components/SignInModal.d.ts.map +1 -0
  344. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +1 -2
  345. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  346. package/lib/typescript/commonjs/ui/hooks/{use-color-scheme.d.ts → useColorScheme.d.ts} +1 -1
  347. package/lib/typescript/commonjs/ui/hooks/useColorScheme.d.ts.map +1 -0
  348. package/lib/typescript/commonjs/ui/hooks/useSessionSocket.d.ts.map +1 -1
  349. package/lib/typescript/commonjs/ui/navigation/bottomSheetManager.d.ts +2 -0
  350. package/lib/typescript/commonjs/ui/navigation/bottomSheetManager.d.ts.map +1 -1
  351. package/lib/typescript/commonjs/ui/navigation/routes.d.ts +1 -1
  352. package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
  353. package/lib/typescript/commonjs/ui/screens/FollowersListScreen.d.ts +9 -0
  354. package/lib/typescript/commonjs/ui/screens/FollowersListScreen.d.ts.map +1 -0
  355. package/lib/typescript/commonjs/ui/screens/FollowingListScreen.d.ts +9 -0
  356. package/lib/typescript/commonjs/ui/screens/FollowingListScreen.d.ts.map +1 -0
  357. package/lib/typescript/commonjs/ui/screens/LearnMoreUsernamesScreen.d.ts +5 -0
  358. package/lib/typescript/commonjs/ui/screens/LearnMoreUsernamesScreen.d.ts.map +1 -0
  359. package/lib/typescript/commonjs/ui/screens/OxyAuthScreen.d.ts.map +1 -1
  360. package/lib/typescript/commonjs/ui/screens/UserListScreen.d.ts +11 -0
  361. package/lib/typescript/commonjs/ui/screens/UserListScreen.d.ts.map +1 -0
  362. package/lib/typescript/commonjs/ui/stores/authStore.d.ts.map +1 -1
  363. package/lib/typescript/commonjs/ui/utils/colorUtils.d.ts +7 -11
  364. package/lib/typescript/commonjs/ui/utils/colorUtils.d.ts.map +1 -1
  365. package/lib/typescript/commonjs/ui/utils/themeUtils.d.ts +6 -19
  366. package/lib/typescript/commonjs/ui/utils/themeUtils.d.ts.map +1 -1
  367. package/lib/typescript/commonjs/ui/utils/{user-utils.d.ts → userUtils.d.ts} +1 -1
  368. package/lib/typescript/commonjs/ui/utils/userUtils.d.ts.map +1 -0
  369. package/lib/typescript/commonjs/utils/errorUtils.d.ts +0 -6
  370. package/lib/typescript/commonjs/utils/errorUtils.d.ts.map +1 -1
  371. package/lib/typescript/commonjs/utils/platform.d.ts +41 -0
  372. package/lib/typescript/commonjs/utils/platform.d.ts.map +1 -0
  373. package/lib/typescript/commonjs/web/WebOxyContext.d.ts +117 -9
  374. package/lib/typescript/commonjs/web/WebOxyContext.d.ts.map +1 -1
  375. package/lib/typescript/commonjs/web/index.d.ts +19 -8
  376. package/lib/typescript/commonjs/web/index.d.ts.map +1 -1
  377. package/lib/typescript/commonjs/web.d.ts +2 -1
  378. package/lib/typescript/commonjs/web.d.ts.map +1 -1
  379. package/lib/typescript/module/core/AuthManager.d.ts +144 -0
  380. package/lib/typescript/module/core/AuthManager.d.ts.map +1 -0
  381. package/lib/typescript/module/core/HttpService.d.ts.map +1 -1
  382. package/lib/typescript/module/core/index.d.ts +2 -0
  383. package/lib/typescript/module/core/index.d.ts.map +1 -1
  384. package/lib/typescript/module/core/mixins/OxyServices.fedcm.d.ts.map +1 -1
  385. package/lib/typescript/module/core/mixins/OxyServices.popup.d.ts.map +1 -1
  386. package/lib/typescript/module/crypto/keyManager.d.ts.map +1 -1
  387. package/lib/typescript/module/index.d.ts +16 -2
  388. package/lib/typescript/module/index.d.ts.map +1 -1
  389. package/lib/typescript/module/lib/sonner.d.ts +11 -14
  390. package/lib/typescript/module/lib/sonner.d.ts.map +1 -1
  391. package/lib/typescript/module/lib/sonner.native.d.ts +15 -0
  392. package/lib/typescript/module/lib/sonner.native.d.ts.map +1 -0
  393. package/lib/typescript/module/lib/sonner.web.d.ts +15 -0
  394. package/lib/typescript/module/lib/sonner.web.d.ts.map +1 -0
  395. package/lib/typescript/module/models/session.d.ts +4 -0
  396. package/lib/typescript/module/models/session.d.ts.map +1 -1
  397. package/lib/typescript/module/shared/index.d.ts +29 -0
  398. package/lib/typescript/module/shared/index.d.ts.map +1 -0
  399. package/lib/typescript/module/shared/utils/colorUtils.d.ts +105 -0
  400. package/lib/typescript/module/shared/utils/colorUtils.d.ts.map +1 -0
  401. package/lib/typescript/module/shared/utils/debugUtils.d.ts +49 -0
  402. package/lib/typescript/module/shared/utils/debugUtils.d.ts.map +1 -0
  403. package/lib/typescript/module/shared/utils/errorUtils.d.ts +98 -0
  404. package/lib/typescript/module/shared/utils/errorUtils.d.ts.map +1 -0
  405. package/lib/typescript/module/shared/utils/index.d.ts +14 -0
  406. package/lib/typescript/module/shared/utils/index.d.ts.map +1 -0
  407. package/lib/typescript/module/shared/utils/networkUtils.d.ts +140 -0
  408. package/lib/typescript/module/shared/utils/networkUtils.d.ts.map +1 -0
  409. package/lib/typescript/module/shared/utils/themeUtils.d.ts +91 -0
  410. package/lib/typescript/module/shared/utils/themeUtils.d.ts.map +1 -0
  411. package/lib/typescript/module/ui/components/FontLoader.d.ts +1 -1
  412. package/lib/typescript/module/ui/components/FontLoader.d.ts.map +1 -1
  413. package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
  414. package/lib/typescript/module/ui/components/OxySignInButton.d.ts.map +1 -1
  415. package/lib/typescript/module/ui/components/SignInModal.d.ts +18 -0
  416. package/lib/typescript/module/ui/components/SignInModal.d.ts.map +1 -0
  417. package/lib/typescript/module/ui/context/OxyContext.d.ts +1 -2
  418. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  419. package/lib/typescript/module/ui/hooks/{use-color-scheme.d.ts → useColorScheme.d.ts} +1 -1
  420. package/lib/typescript/module/ui/hooks/useColorScheme.d.ts.map +1 -0
  421. package/lib/typescript/module/ui/hooks/useSessionSocket.d.ts.map +1 -1
  422. package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts +2 -0
  423. package/lib/typescript/module/ui/navigation/bottomSheetManager.d.ts.map +1 -1
  424. package/lib/typescript/module/ui/navigation/routes.d.ts +1 -1
  425. package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
  426. package/lib/typescript/module/ui/screens/FollowersListScreen.d.ts +9 -0
  427. package/lib/typescript/module/ui/screens/FollowersListScreen.d.ts.map +1 -0
  428. package/lib/typescript/module/ui/screens/FollowingListScreen.d.ts +9 -0
  429. package/lib/typescript/module/ui/screens/FollowingListScreen.d.ts.map +1 -0
  430. package/lib/typescript/module/ui/screens/LearnMoreUsernamesScreen.d.ts +5 -0
  431. package/lib/typescript/module/ui/screens/LearnMoreUsernamesScreen.d.ts.map +1 -0
  432. package/lib/typescript/module/ui/screens/OxyAuthScreen.d.ts.map +1 -1
  433. package/lib/typescript/module/ui/screens/UserListScreen.d.ts +11 -0
  434. package/lib/typescript/module/ui/screens/UserListScreen.d.ts.map +1 -0
  435. package/lib/typescript/module/ui/stores/authStore.d.ts.map +1 -1
  436. package/lib/typescript/module/ui/utils/colorUtils.d.ts +7 -11
  437. package/lib/typescript/module/ui/utils/colorUtils.d.ts.map +1 -1
  438. package/lib/typescript/module/ui/utils/themeUtils.d.ts +6 -19
  439. package/lib/typescript/module/ui/utils/themeUtils.d.ts.map +1 -1
  440. package/lib/typescript/module/ui/utils/{user-utils.d.ts → userUtils.d.ts} +1 -1
  441. package/lib/typescript/module/ui/utils/userUtils.d.ts.map +1 -0
  442. package/lib/typescript/module/utils/errorUtils.d.ts +0 -6
  443. package/lib/typescript/module/utils/errorUtils.d.ts.map +1 -1
  444. package/lib/typescript/module/utils/platform.d.ts +41 -0
  445. package/lib/typescript/module/utils/platform.d.ts.map +1 -0
  446. package/lib/typescript/module/web/WebOxyContext.d.ts +117 -9
  447. package/lib/typescript/module/web/WebOxyContext.d.ts.map +1 -1
  448. package/lib/typescript/module/web/index.d.ts +19 -8
  449. package/lib/typescript/module/web/index.d.ts.map +1 -1
  450. package/lib/typescript/module/web.d.ts +2 -1
  451. package/lib/typescript/module/web.d.ts.map +1 -1
  452. package/package.json +8 -2
  453. package/src/core/AuthManager.ts +436 -0
  454. package/src/core/HttpService.ts +43 -1
  455. package/src/core/index.ts +4 -0
  456. package/src/core/mixins/OxyServices.fedcm.ts +37 -42
  457. package/src/core/mixins/OxyServices.popup.ts +10 -7
  458. package/src/crypto/keyManager.ts +16 -21
  459. package/src/index.ts +83 -12
  460. package/src/lib/sonner.native.ts +28 -0
  461. package/src/lib/sonner.ts +11 -28
  462. package/src/lib/sonner.web.ts +28 -0
  463. package/src/models/session.ts +4 -0
  464. package/src/shared/index.ts +82 -0
  465. package/src/shared/utils/colorUtils.ts +155 -0
  466. package/src/shared/utils/debugUtils.ts +73 -0
  467. package/src/shared/utils/errorUtils.ts +181 -0
  468. package/src/shared/utils/index.ts +59 -0
  469. package/src/shared/utils/networkUtils.ts +248 -0
  470. package/src/shared/utils/themeUtils.ts +115 -0
  471. package/src/ui/components/BottomSheetRouter.tsx +1 -1
  472. package/src/ui/components/FontLoader.tsx +1 -2
  473. package/src/ui/components/GroupedItem.tsx +1 -1
  474. package/src/ui/components/Header.tsx +1 -1
  475. package/src/ui/components/OxyProvider.tsx +10 -0
  476. package/src/ui/components/OxySignInButton.tsx +20 -22
  477. package/src/ui/components/ProfileCard.tsx +1 -1
  478. package/src/ui/components/QuickActions.tsx +1 -1
  479. package/src/ui/components/Section.tsx +1 -1
  480. package/src/ui/components/SectionTitle.tsx +1 -1
  481. package/src/ui/components/SignInModal.tsx +534 -0
  482. package/src/ui/context/OxyContext.tsx +1 -2
  483. package/src/ui/hooks/queries/queryKeys.ts +2 -2
  484. package/src/ui/hooks/useSessionSocket.ts +12 -17
  485. package/src/ui/hooks/useThemeColors.ts +1 -1
  486. package/src/ui/hooks/useThemeStyles.ts +1 -1
  487. package/src/ui/navigation/bottomSheetManager.ts +5 -1
  488. package/src/ui/navigation/routes.ts +8 -9
  489. package/src/ui/screens/AccountCenterScreen.tsx +7 -7
  490. package/src/ui/screens/AccountOverviewScreen.tsx +6 -6
  491. package/src/ui/screens/AccountSettingsScreen.tsx +2 -2
  492. package/src/ui/screens/AccountSwitcherScreen.tsx +4 -4
  493. package/src/ui/screens/AppInfoScreen.tsx +1 -1
  494. package/src/ui/screens/EditProfileFieldScreen.tsx +1 -1
  495. package/src/ui/screens/FileManagementScreen.tsx +1 -1
  496. package/src/ui/screens/FollowersListScreen.tsx +14 -0
  497. package/src/ui/screens/FollowingListScreen.tsx +14 -0
  498. package/src/ui/screens/HelpSupportScreen.tsx +1 -1
  499. package/src/ui/screens/HistoryViewScreen.tsx +1 -1
  500. package/src/ui/screens/LanguageSelectorScreen.tsx +1 -1
  501. package/src/ui/screens/LearnMoreUsernamesScreen.tsx +231 -0
  502. package/src/ui/screens/LegalDocumentsScreen.tsx +1 -1
  503. package/src/ui/screens/OxyAuthScreen.tsx +10 -21
  504. package/src/ui/screens/PremiumSubscriptionScreen.tsx +1 -1
  505. package/src/ui/screens/ProfileScreen.tsx +1 -1
  506. package/src/ui/screens/SavesCollectionsScreen.tsx +1 -1
  507. package/src/ui/screens/UserListScreen.tsx +416 -0
  508. package/src/ui/screens/karma/KarmaAboutScreen.tsx +1 -1
  509. package/src/ui/screens/karma/KarmaCenterScreen.tsx +1 -1
  510. package/src/ui/screens/karma/KarmaFAQScreen.tsx +1 -1
  511. package/src/ui/screens/karma/KarmaLeaderboardScreen.tsx +1 -1
  512. package/src/ui/screens/karma/KarmaRewardsScreen.tsx +1 -1
  513. package/src/ui/screens/karma/KarmaRulesScreen.tsx +1 -1
  514. package/src/ui/stores/authStore.ts +5 -6
  515. package/src/ui/utils/colorUtils.ts +15 -43
  516. package/src/ui/utils/themeUtils.ts +14 -39
  517. package/src/utils/errorUtils.ts +1 -6
  518. package/src/utils/hookUtils.ts +8 -8
  519. package/src/utils/platform.ts +117 -0
  520. package/src/web/WebOxyContext.tsx +331 -41
  521. package/src/web/index.ts +76 -6
  522. package/src/web.ts +1 -1
  523. package/lib/commonjs/ui/hooks/use-color-scheme.js.map +0 -1
  524. package/lib/commonjs/ui/utils/user-utils.js.map +0 -1
  525. package/lib/module/ui/hooks/use-color-scheme.js.map +0 -1
  526. package/lib/module/ui/utils/user-utils.js.map +0 -1
  527. package/lib/typescript/commonjs/ui/hooks/use-color-scheme.d.ts.map +0 -1
  528. package/lib/typescript/commonjs/ui/utils/user-utils.d.ts.map +0 -1
  529. package/lib/typescript/module/ui/hooks/use-color-scheme.d.ts.map +0 -1
  530. package/lib/typescript/module/ui/utils/user-utils.d.ts.map +0 -1
  531. /package/src/ui/hooks/{use-color-scheme.ts → useColorScheme.ts} +0 -0
  532. /package/src/ui/utils/{user-utils.ts → userUtils.ts} +0 -0
@@ -1,6 +1,9 @@
1
1
  import type { OxyServicesBase } from '../OxyServices.base';
2
2
  import { OxyAuthenticationError } from '../OxyServices.errors';
3
3
  import type { SessionLoginResponse } from '../../models/session';
4
+ import { createDebugLogger } from '../../shared/utils/debugUtils';
5
+
6
+ const debug = createDebugLogger('FedCM');
4
7
 
5
8
  export interface FedCMAuthOptions {
6
9
  nonce?: string;
@@ -99,9 +102,7 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
99
102
  const nonce = options.nonce || this.generateNonce();
100
103
  const clientId = this.getClientId();
101
104
 
102
- if (typeof __DEV__ !== 'undefined' && __DEV__) {
103
- console.log('[FedCM] Interactive sign-in: Requesting credential for', clientId);
104
- }
105
+ debug.log('Interactive sign-in: Requesting credential for', clientId);
105
106
 
106
107
  // Request credential from browser's native identity flow
107
108
  const credential = await this.requestIdentityCredential({
@@ -115,9 +116,7 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
115
116
  throw new OxyAuthenticationError('No credential received from browser');
116
117
  }
117
118
 
118
- if (typeof __DEV__ !== 'undefined' && __DEV__) {
119
- console.log('[FedCM] Interactive sign-in: Got credential, exchanging for session');
120
- }
119
+ debug.log('Interactive sign-in: Got credential, exchanging for session');
121
120
 
122
121
  // Exchange FedCM ID token for Oxy session
123
122
  const session = await this.exchangeIdTokenForSession(credential.token);
@@ -127,15 +126,11 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
127
126
  this.httpService.setTokens((session as any).accessToken);
128
127
  }
129
128
 
130
- if (typeof __DEV__ !== 'undefined' && __DEV__) {
131
- console.log('[FedCM] Interactive sign-in: Success!', { userId: (session as any)?.user?.id });
132
- }
129
+ debug.log('Interactive sign-in: Success!', { userId: (session as any)?.user?.id });
133
130
 
134
131
  return session;
135
132
  } catch (error) {
136
- if (typeof __DEV__ !== 'undefined' && __DEV__) {
137
- console.log('[FedCM] Interactive sign-in failed:', error);
138
- }
133
+ debug.log('Interactive sign-in failed:', error);
139
134
  if ((error as any).name === 'AbortError') {
140
135
  throw new OxyAuthenticationError('Sign-in was cancelled by user');
141
136
  }
@@ -178,19 +173,19 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
178
173
  */
179
174
  async silentSignInWithFedCM(): Promise<SessionLoginResponse | null> {
180
175
  if (!this.isFedCMSupported()) {
181
- console.log('[FedCM] Silent SSO: FedCM not supported in this browser');
176
+ debug.log('Silent SSO: FedCM not supported in this browser');
182
177
  return null;
183
178
  }
184
179
 
185
180
  const clientId = this.getClientId();
186
- console.log('[FedCM] Silent SSO: Starting for', clientId);
181
+ debug.log('Silent SSO: Starting for', clientId);
187
182
 
188
183
  // First try silent mediation (no UI) - works if user previously consented
189
184
  let credential: { token: string } | null = null;
190
185
 
191
186
  try {
192
187
  const nonce = this.generateNonce();
193
- console.log('[FedCM] Silent SSO: Attempting silent mediation...');
188
+ debug.log('Silent SSO: Attempting silent mediation...');
194
189
 
195
190
  credential = await this.requestIdentityCredential({
196
191
  configURL: (this.constructor as any).DEFAULT_CONFIG_URL,
@@ -199,19 +194,19 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
199
194
  mediation: 'silent',
200
195
  });
201
196
 
202
- console.log('[FedCM] Silent SSO: Silent mediation result:', { hasCredential: !!credential, hasToken: !!credential?.token });
197
+ debug.log('Silent SSO: Silent mediation result:', { hasCredential: !!credential, hasToken: !!credential?.token });
203
198
  } catch (silentError) {
204
199
  // Silent mediation failed - this is expected if user hasn't consented before or is in quiet period
205
200
  const errorName = silentError instanceof Error ? silentError.name : 'Unknown';
206
201
  const errorMessage = silentError instanceof Error ? silentError.message : String(silentError);
207
- console.log('[FedCM] Silent SSO: Silent mediation error (will try optional):', { name: errorName, message: errorMessage });
202
+ debug.log('Silent SSO: Silent mediation error (will try optional):', { name: errorName, message: errorMessage });
208
203
  }
209
204
 
210
205
  // If silent failed, try optional mediation which shows browser UI if needed
211
206
  if (!credential || !credential.token) {
212
207
  try {
213
208
  const nonce = this.generateNonce();
214
- console.log('[FedCM] Silent SSO: Trying optional mediation (may show browser UI)...');
209
+ debug.log('Silent SSO: Trying optional mediation (may show browser UI)...');
215
210
 
216
211
  credential = await this.requestIdentityCredential({
217
212
  configURL: (this.constructor as any).DEFAULT_CONFIG_URL,
@@ -220,55 +215,55 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
220
215
  mediation: 'optional',
221
216
  });
222
217
 
223
- console.log('[FedCM] Silent SSO: Optional mediation result:', { hasCredential: !!credential, hasToken: !!credential?.token });
218
+ debug.log('Silent SSO: Optional mediation result:', { hasCredential: !!credential, hasToken: !!credential?.token });
224
219
  } catch (optionalError) {
225
220
  const errorName = optionalError instanceof Error ? optionalError.name : 'Unknown';
226
221
  const errorMessage = optionalError instanceof Error ? optionalError.message : String(optionalError);
227
- console.log('[FedCM] Silent SSO: Optional mediation also failed:', { name: errorName, message: errorMessage });
222
+ debug.log('Silent SSO: Optional mediation also failed:', { name: errorName, message: errorMessage });
228
223
  return null;
229
224
  }
230
225
  }
231
226
 
232
227
  if (!credential || !credential.token) {
233
- console.log('[FedCM] Silent SSO: No credential returned (user may have dismissed prompt or is not logged in at IdP)');
228
+ debug.log('Silent SSO: No credential returned (user may have dismissed prompt or is not logged in at IdP)');
234
229
  return null;
235
230
  }
236
231
 
237
- console.log('[FedCM] Silent SSO: Got credential, exchanging for session...');
232
+ debug.log('Silent SSO: Got credential, exchanging for session...');
238
233
 
239
234
  let session: SessionLoginResponse;
240
235
  try {
241
236
  session = await this.exchangeIdTokenForSession(credential.token);
242
237
  } catch (exchangeError) {
243
- console.error('[FedCM] Silent SSO: Token exchange failed:', exchangeError);
238
+ debug.error('Silent SSO: Token exchange failed:', exchangeError);
244
239
  return null;
245
240
  }
246
241
 
247
242
  // Validate session response has required fields
248
243
  if (!session) {
249
- console.error('[FedCM] Silent SSO: Exchange returned null session');
244
+ debug.error('Silent SSO: Exchange returned null session');
250
245
  return null;
251
246
  }
252
247
 
253
248
  if (!session.sessionId) {
254
- console.error('[FedCM] Silent SSO: Exchange returned session without sessionId:', session);
249
+ debug.error('Silent SSO: Exchange returned session without sessionId:', session);
255
250
  return null;
256
251
  }
257
252
 
258
253
  if (!session.user) {
259
- console.error('[FedCM] Silent SSO: Exchange returned session without user:', session);
254
+ debug.error('Silent SSO: Exchange returned session without user:', session);
260
255
  return null;
261
256
  }
262
257
 
263
258
  // Set the access token
264
259
  if ((session as any).accessToken) {
265
260
  this.httpService.setTokens((session as any).accessToken);
266
- console.log('[FedCM] Silent SSO: Access token set');
261
+ debug.log('Silent SSO: Access token set');
267
262
  } else {
268
- console.warn('[FedCM] Silent SSO: No accessToken in session response');
263
+ debug.warn('Silent SSO: No accessToken in session response');
269
264
  }
270
265
 
271
- console.log('[FedCM] Silent SSO: Success!', {
266
+ debug.log('Silent SSO: Success!', {
272
267
  sessionId: session.sessionId?.substring(0, 8) + '...',
273
268
  userId: session.user?.id
274
269
  });
@@ -296,7 +291,7 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
296
291
  const requestedMediation = options.mediation || 'optional';
297
292
  const isInteractive = requestedMediation !== 'silent';
298
293
 
299
- console.log('[FedCM] requestIdentityCredential called:', {
294
+ debug.log('requestIdentityCredential called:', {
300
295
  mediation: requestedMediation,
301
296
  clientId: options.clientId,
302
297
  inProgress: fedCMRequestInProgress,
@@ -304,7 +299,7 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
304
299
 
305
300
  // If a request is already in progress...
306
301
  if (fedCMRequestInProgress && fedCMRequestPromise) {
307
- console.log('[FedCM] Request already in progress, waiting...');
302
+ debug.log('Request already in progress, waiting...');
308
303
  // If current request is silent and new request is interactive,
309
304
  // wait for silent to finish, then make the interactive request
310
305
  if (currentMediationMode === 'silent' && isInteractive) {
@@ -332,13 +327,13 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
332
327
  ? (this.constructor as any).FEDCM_SILENT_TIMEOUT
333
328
  : (this.constructor as any).FEDCM_TIMEOUT;
334
329
  const timeout = setTimeout(() => {
335
- console.log('[FedCM] Request timed out after', timeoutMs, 'ms (mediation:', requestedMediation + ')');
330
+ debug.log('Request timed out after', timeoutMs, 'ms (mediation:', requestedMediation + ')');
336
331
  controller.abort();
337
332
  }, timeoutMs);
338
333
 
339
334
  fedCMRequestPromise = (async () => {
340
335
  try {
341
- console.log('[FedCM] Calling navigator.credentials.get with mediation:', requestedMediation);
336
+ debug.log('Calling navigator.credentials.get with mediation:', requestedMediation);
342
337
  // Type assertion needed as FedCM types may not be in all TypeScript versions
343
338
  const credential = (await (navigator.credentials as any).get({
344
339
  identity: {
@@ -359,23 +354,23 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
359
354
  signal: controller.signal,
360
355
  })) as any;
361
356
 
362
- console.log('[FedCM] navigator.credentials.get returned:', {
357
+ debug.log('navigator.credentials.get returned:', {
363
358
  hasCredential: !!credential,
364
359
  type: credential?.type,
365
360
  hasToken: !!credential?.token,
366
361
  });
367
362
 
368
363
  if (!credential || credential.type !== 'identity') {
369
- console.log('[FedCM] No valid identity credential returned');
364
+ debug.log('No valid identity credential returned');
370
365
  return null;
371
366
  }
372
367
 
373
- console.log('[FedCM] Got valid identity credential with token');
368
+ debug.log('Got valid identity credential with token');
374
369
  return { token: credential.token };
375
370
  } catch (error) {
376
371
  const errorName = error instanceof Error ? error.name : 'Unknown';
377
372
  const errorMessage = error instanceof Error ? error.message : String(error);
378
- console.log('[FedCM] navigator.credentials.get error:', { name: errorName, message: errorMessage });
373
+ debug.log('navigator.credentials.get error:', { name: errorName, message: errorMessage });
379
374
  throw error;
380
375
  } finally {
381
376
  clearTimeout(timeout);
@@ -397,9 +392,9 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
397
392
  * @private
398
393
  */
399
394
  public async exchangeIdTokenForSession(idToken: string): Promise<SessionLoginResponse> {
400
- console.log('[FedCM] exchangeIdTokenForSession: Starting exchange...');
401
- console.log('[FedCM] exchangeIdTokenForSession: Token length:', idToken?.length);
402
- console.log('[FedCM] exchangeIdTokenForSession: Token preview:', idToken?.substring(0, 50) + '...');
395
+ debug.log('exchangeIdTokenForSession: Starting exchange...');
396
+ debug.log('exchangeIdTokenForSession: Token length:', idToken?.length);
397
+ debug.log('exchangeIdTokenForSession: Token preview:', idToken?.substring(0, 50) + '...');
403
398
 
404
399
  try {
405
400
  const response = await this.makeRequest<SessionLoginResponse>(
@@ -409,7 +404,7 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
409
404
  { cache: false }
410
405
  );
411
406
 
412
- console.log('[FedCM] exchangeIdTokenForSession: Response received:', {
407
+ debug.log('exchangeIdTokenForSession: Response received:', {
413
408
  hasResponse: !!response,
414
409
  hasSessionId: !!(response as any)?.sessionId,
415
410
  hasUser: !!(response as any)?.user,
@@ -421,7 +416,7 @@ export function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T)
421
416
 
422
417
  return response;
423
418
  } catch (error) {
424
- console.error('[FedCM] exchangeIdTokenForSession: Error:', {
419
+ debug.error('exchangeIdTokenForSession: Error:', {
425
420
  name: error instanceof Error ? error.name : 'Unknown',
426
421
  message: error instanceof Error ? error.message : String(error),
427
422
  stack: error instanceof Error ? error.stack : undefined,
@@ -1,6 +1,9 @@
1
1
  import type { OxyServicesBase } from '../OxyServices.base';
2
2
  import { OxyAuthenticationError } from '../OxyServices.errors';
3
3
  import type { SessionLoginResponse } from '../../models/session';
4
+ import { createDebugLogger } from '../../shared/utils/debugUtils';
5
+
6
+ const debug = createDebugLogger('PopupAuth');
4
7
 
5
8
  export interface PopupAuthOptions {
6
9
  width?: number;
@@ -125,7 +128,7 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
125
128
  (session as any).user = userData;
126
129
  }
127
130
  } catch (userError) {
128
- console.warn('[PopupAuth] Failed to fetch user data:', userError);
131
+ debug.warn('Failed to fetch user data:', userError);
129
132
  // Continue without user data - caller can fetch separately
130
133
  }
131
134
  }
@@ -261,7 +264,7 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
261
264
 
262
265
  // Log all messages for debugging
263
266
  if (event.data && typeof event.data === 'object' && event.data.type) {
264
- console.log('[PopupAuth] Message received:', {
267
+ debug.log('Message received:', {
265
268
  origin: event.origin,
266
269
  expectedOrigin: authUrl,
267
270
  type: event.data.type,
@@ -281,12 +284,12 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
281
284
  return;
282
285
  }
283
286
 
284
- console.log('[PopupAuth] Valid auth response:', { state, expectedState, hasSession: !!session, error });
287
+ debug.log('Valid auth response:', { state, expectedState, hasSession: !!session, error });
285
288
 
286
289
  // Verify state parameter to prevent CSRF attacks
287
290
  if (state !== expectedState) {
288
291
  cleanup();
289
- console.error('[PopupAuth] State mismatch');
292
+ debug.error('State mismatch');
290
293
  reject(new OxyAuthenticationError('Invalid state parameter. Possible CSRF attack.'));
291
294
  return;
292
295
  }
@@ -294,13 +297,13 @@ export function OxyServicesPopupAuthMixin<T extends typeof OxyServicesBase>(Base
294
297
  cleanup();
295
298
 
296
299
  if (error) {
297
- console.error('[PopupAuth] Auth error:', error);
300
+ debug.error('Auth error:', error);
298
301
  reject(new OxyAuthenticationError(error));
299
302
  } else if (session) {
300
- console.log('[PopupAuth] Session received successfully');
303
+ debug.log('Session received successfully');
301
304
  resolve(session);
302
305
  } else {
303
- console.error('[PopupAuth] No session in response');
306
+ debug.error('No session in response');
304
307
  reject(new OxyAuthenticationError('No session received from authentication server'));
305
308
  }
306
309
  };
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { ec as EC } from 'elliptic';
9
9
  import type { ECKeyPair } from 'elliptic';
10
- import { Platform } from 'react-native';
10
+ import { isWeb, isIOS, isAndroid } from '../utils/platform';
11
11
  import { logger } from '../utils/loggerUtils';
12
12
 
13
13
  // Lazy imports for React Native specific modules
@@ -80,12 +80,7 @@ function isNodeJS(): boolean {
80
80
  * Identity storage is only available on native platforms (iOS/Android)
81
81
  */
82
82
  function isWebPlatform(): boolean {
83
- try {
84
- return Platform.OS === 'web';
85
- } catch {
86
- // Fallback if Platform is not available
87
- return typeof window !== 'undefined' && typeof navigator !== 'undefined' && navigator.product !== 'ReactNative';
88
- }
83
+ return isWeb();
89
84
  }
90
85
 
91
86
  async function initExpoCrypto(): Promise<typeof import('expo-crypto')> {
@@ -212,7 +207,7 @@ export class KeyManager {
212
207
  const store = await initSecureStore();
213
208
  const { privateKey, publicKey } = await KeyManager.generateKeyPair();
214
209
 
215
- if (Platform.OS === 'ios') {
210
+ if (isIOS()) {
216
211
  // iOS: Store in shared keychain group
217
212
  // Note: keychainAccessGroup requires Keychain Sharing capability in Xcode
218
213
  try {
@@ -229,7 +224,7 @@ export class KeyManager {
229
224
  `Failed to create shared identity on iOS. Ensure your app has the Keychain Sharing capability enabled with access group "${IOS_KEYCHAIN_GROUP}". Error: ${error}`
230
225
  );
231
226
  }
232
- } else if (Platform.OS === 'android') {
227
+ } else if (isAndroid()) {
233
228
  // Android: Store in secure store (accessible via sharedUserId)
234
229
  // Note: All Oxy apps must have the same sharedUserId in AndroidManifest.xml
235
230
  await store.setItemAsync(STORAGE_KEYS.SHARED_PRIVATE_KEY, privateKey, {
@@ -269,11 +264,11 @@ export class KeyManager {
269
264
  const store = await initSecureStore();
270
265
  let publicKey: string | null = null;
271
266
 
272
- if (Platform.OS === 'ios') {
267
+ if (isIOS()) {
273
268
  publicKey = await store.getItemAsync(STORAGE_KEYS.SHARED_PUBLIC_KEY, {
274
269
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
275
270
  } as any);
276
- } else if (Platform.OS === 'android') {
271
+ } else if (isAndroid()) {
277
272
  publicKey = await store.getItemAsync(STORAGE_KEYS.SHARED_PUBLIC_KEY);
278
273
  }
279
274
 
@@ -307,11 +302,11 @@ export class KeyManager {
307
302
  const store = await initSecureStore();
308
303
  let privateKey: string | null = null;
309
304
 
310
- if (Platform.OS === 'ios') {
305
+ if (isIOS()) {
311
306
  privateKey = await store.getItemAsync(STORAGE_KEYS.SHARED_PRIVATE_KEY, {
312
307
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
313
308
  } as any);
314
- } else if (Platform.OS === 'android') {
309
+ } else if (isAndroid()) {
315
310
  privateKey = await store.getItemAsync(STORAGE_KEYS.SHARED_PRIVATE_KEY);
316
311
  }
317
312
 
@@ -376,7 +371,7 @@ export class KeyManager {
376
371
  const keyPair = ec.keyFromPrivate(privateKey);
377
372
  const publicKey = keyPair.getPublic('hex');
378
373
 
379
- if (Platform.OS === 'ios') {
374
+ if (isIOS()) {
380
375
  await store.setItemAsync(STORAGE_KEYS.SHARED_PRIVATE_KEY, privateKey, {
381
376
  keychainAccessible: store.WHEN_UNLOCKED_THIS_DEVICE_ONLY,
382
377
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
@@ -385,7 +380,7 @@ export class KeyManager {
385
380
  await store.setItemAsync(STORAGE_KEYS.SHARED_PUBLIC_KEY, publicKey, {
386
381
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
387
382
  } as any);
388
- } else if (Platform.OS === 'android') {
383
+ } else if (isAndroid()) {
389
384
  await store.setItemAsync(STORAGE_KEYS.SHARED_PRIVATE_KEY, privateKey, {
390
385
  keychainAccessible: store.WHEN_UNLOCKED_THIS_DEVICE_ONLY,
391
386
  });
@@ -422,7 +417,7 @@ export class KeyManager {
422
417
  try {
423
418
  const store = await initSecureStore();
424
419
 
425
- if (Platform.OS === 'ios') {
420
+ if (isIOS()) {
426
421
  await store.setItemAsync(STORAGE_KEYS.SHARED_SESSION_ID, sessionId, {
427
422
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
428
423
  } as any);
@@ -431,7 +426,7 @@ export class KeyManager {
431
426
  keychainAccessible: store.WHEN_UNLOCKED,
432
427
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
433
428
  } as any);
434
- } else if (Platform.OS === 'android') {
429
+ } else if (isAndroid()) {
435
430
  await store.setItemAsync(STORAGE_KEYS.SHARED_SESSION_ID, sessionId);
436
431
  await store.setItemAsync(STORAGE_KEYS.SHARED_SESSION_TOKEN, accessToken);
437
432
  }
@@ -465,7 +460,7 @@ export class KeyManager {
465
460
  let sessionId: string | null = null;
466
461
  let accessToken: string | null = null;
467
462
 
468
- if (Platform.OS === 'ios') {
463
+ if (isIOS()) {
469
464
  sessionId = await store.getItemAsync(STORAGE_KEYS.SHARED_SESSION_ID, {
470
465
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
471
466
  } as any);
@@ -473,7 +468,7 @@ export class KeyManager {
473
468
  accessToken = await store.getItemAsync(STORAGE_KEYS.SHARED_SESSION_TOKEN, {
474
469
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
475
470
  } as any);
476
- } else if (Platform.OS === 'android') {
471
+ } else if (isAndroid()) {
477
472
  sessionId = await store.getItemAsync(STORAGE_KEYS.SHARED_SESSION_ID);
478
473
  accessToken = await store.getItemAsync(STORAGE_KEYS.SHARED_SESSION_TOKEN);
479
474
  }
@@ -505,14 +500,14 @@ export class KeyManager {
505
500
  try {
506
501
  const store = await initSecureStore();
507
502
 
508
- if (Platform.OS === 'ios') {
503
+ if (isIOS()) {
509
504
  await store.deleteItemAsync(STORAGE_KEYS.SHARED_SESSION_ID, {
510
505
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
511
506
  } as any);
512
507
  await store.deleteItemAsync(STORAGE_KEYS.SHARED_SESSION_TOKEN, {
513
508
  keychainAccessGroup: IOS_KEYCHAIN_GROUP,
514
509
  } as any);
515
- } else if (Platform.OS === 'android') {
510
+ } else if (isAndroid()) {
516
511
  await store.deleteItemAsync(STORAGE_KEYS.SHARED_SESSION_ID);
517
512
  await store.deleteItemAsync(STORAGE_KEYS.SHARED_SESSION_TOKEN);
518
513
  }
package/src/index.ts CHANGED
@@ -1,11 +1,17 @@
1
1
  /**
2
2
  * OxyHQServices Main Export File - Universal (Frontend + Backend)
3
- *
3
+ *
4
4
  * This exports everything but uses environment detection to avoid crashes.
5
5
  * - Frontend: Full UI + Core functionality
6
6
  * - Backend: Core functionality only (UI components are no-ops)
7
7
  */
8
8
 
9
+ // IMPORTANT: Initialize platform detection first (before any other imports that may use it)
10
+ // This allows core modules to detect the platform without importing react-native directly
11
+ import { setPlatformOS, type PlatformOS } from './utils/platform';
12
+ import { Platform } from 'react-native';
13
+ setPlatformOS(Platform.OS as PlatformOS);
14
+
9
15
  // IMPORTANT: Import crypto module first to ensure polyfills are loaded
10
16
  // before any other code that might use Buffer or other polyfilled APIs
11
17
  import './crypto/polyfill';
@@ -39,6 +45,9 @@ export type { AuthState, AuthActions, UseAuthReturn } from './ui/hooks/useAuth';
39
45
  // Streamlined provider with built-in bottom sheet
40
46
  export { default as OxyProvider } from './ui/components/OxyProvider';
41
47
 
48
+ // Font loading utility
49
+ export { FontLoader } from './ui/components/FontLoader';
50
+
42
51
  // Web-only provider (no React Native dependencies)
43
52
  export { default as WebOxyProvider } from './ui/components/WebOxyProvider';
44
53
 
@@ -114,7 +123,7 @@ export type {
114
123
  SecurityEventType,
115
124
  SecurityEventSeverity,
116
125
  SecurityActivity,
117
- SecurityActivityResponse
126
+ SecurityActivityResponse,
118
127
  } from './models/interfaces';
119
128
 
120
129
  // Export security constants
@@ -145,6 +154,7 @@ export {
145
154
  export { useSessionSocket } from './ui/hooks/useSessionSocket';
146
155
  export { useAssets, setOxyAssetInstance } from './ui/hooks/useAssets';
147
156
  export { useFileDownloadUrl, setOxyFileUrlInstance } from './ui/hooks/useFileDownloadUrl';
157
+ export { useFollow, useFollowerCounts } from './ui/hooks/useFollow';
148
158
 
149
159
  // UI hooks - Query hooks (TanStack Query)
150
160
  export {
@@ -204,6 +214,10 @@ export {
204
214
  } from './ui/utils/authHelpers';
205
215
  export type { HandleApiErrorOptions } from './ui/utils/authHelpers';
206
216
 
217
+ // Error handlers
218
+ export { handleAuthError, isInvalidSessionError, isTimeoutOrNetworkError, extractErrorMessage } from './ui/utils/errorHandlers';
219
+ export type { HandleAuthErrorOptions } from './ui/utils/errorHandlers';
220
+
207
221
  // File filtering hook
208
222
  export { useFileFiltering } from './ui/hooks/useFileFiltering';
209
223
  export type { ViewMode, SortBy, SortOrder } from './ui/hooks/useFileFiltering';
@@ -212,19 +226,69 @@ export type { ViewMode, SortBy, SortOrder } from './ui/hooks/useFileFiltering';
212
226
  export { OxySignInButton } from './ui/components/OxySignInButton';
213
227
  export { OxyLogo, FollowButton } from './ui';
214
228
 
215
- // New consolidated utilities
229
+ // Shared utilities (platform-agnostic)
230
+ export {
231
+ // Color utilities
232
+ darkenColor,
233
+ lightenColor,
234
+ hexToRgb,
235
+ rgbToHex,
236
+ withOpacity,
237
+ isLightColor,
238
+ getContrastTextColor,
239
+ } from './shared/utils/colorUtils';
240
+
241
+ export {
242
+ // Theme utilities
243
+ normalizeTheme,
244
+ normalizeColorScheme,
245
+ getOppositeTheme,
246
+ systemPrefersDarkMode,
247
+ getSystemColorScheme,
248
+ } from './shared/utils/themeUtils';
249
+ export type { ThemeValue } from './shared/utils/themeUtils';
250
+
251
+ export {
252
+ // Error utilities
253
+ HttpStatus,
254
+ getErrorStatus,
255
+ getErrorMessage,
256
+ isAlreadyRegisteredError,
257
+ isUnauthorizedError,
258
+ isForbiddenError,
259
+ isNotFoundError,
260
+ isRateLimitError,
261
+ isServerError,
262
+ isNetworkError,
263
+ isRetryableError,
264
+ } from './shared/utils/errorUtils';
265
+
266
+ export {
267
+ // Network utilities
268
+ DEFAULT_CIRCUIT_BREAKER_CONFIG,
269
+ createCircuitBreakerState,
270
+ calculateBackoffInterval,
271
+ recordFailure,
272
+ recordSuccess,
273
+ shouldAllowRequest,
274
+ delay,
275
+ withRetry,
276
+ } from './shared/utils/networkUtils';
277
+ export type { CircuitBreakerState, CircuitBreakerConfig } from './shared/utils/networkUtils';
278
+
279
+ // Other utilities
216
280
  export * from './utils/apiUtils';
217
- export {
218
- ErrorCodes,
219
- createApiError,
220
- handleHttpError,
281
+ export {
282
+ ErrorCodes,
283
+ createApiError,
284
+ handleHttpError,
221
285
  validateRequiredFields,
222
- retryWithBackoff
223
286
  } from './utils/errorUtils';
287
+ export { retryAsync } from './utils/asyncUtils';
224
288
  export * from './utils/validationUtils';
225
- export {
226
- logger,
227
- LogLevel,
289
+ export {
290
+ logger,
291
+ LogLevel,
228
292
  LogContext,
229
293
  logAuth,
230
294
  logApi,
@@ -235,4 +299,11 @@ export {
235
299
  logPerformance
236
300
  } from './utils/loggerUtils';
237
301
  export * from './utils/asyncUtils';
238
- export * from './utils/hookUtils';
302
+ export * from './utils/hookUtils';
303
+
304
+ // Bottom sheet navigation
305
+ export { showBottomSheet, closeBottomSheet } from './ui/navigation/bottomSheetManager';
306
+ export type { RouteName } from './ui/navigation/routes';
307
+
308
+ // Sign-in modal
309
+ export { showSignInModal, hideSignInModal } from './ui/components/SignInModal';
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Sonner Toast - Native Implementation
3
+ *
4
+ * This file is resolved by React Native bundlers (Metro)
5
+ * Only imports 'sonner-native', not 'sonner'
6
+ */
7
+ import * as NativeSonner from 'sonner-native';
8
+
9
+ // Define proper types for the toast components
10
+ interface ToastFunction {
11
+ (message: string, options?: Record<string, unknown>): void;
12
+ success: (message: string, options?: Record<string, unknown>) => void;
13
+ error: (message: string, options?: Record<string, unknown>) => void;
14
+ info: (message: string, options?: Record<string, unknown>) => void;
15
+ warning: (message: string, options?: Record<string, unknown>) => void;
16
+ loading: (message: string, options?: Record<string, unknown>) => void;
17
+ }
18
+
19
+ type ToasterComponent = (props?: Record<string, unknown>) => React.ReactElement | null;
20
+
21
+ const { toast: nativeToast, Toaster: NativeToaster } = NativeSonner as {
22
+ toast: ToastFunction;
23
+ Toaster: ToasterComponent;
24
+ };
25
+
26
+ export const toast = nativeToast;
27
+ export const Toaster = NativeToaster;
28
+ export type ToastT = typeof nativeToast;
package/src/lib/sonner.ts CHANGED
@@ -1,28 +1,11 @@
1
- import { Platform } from 'react-native';
2
- import * as WebSonner from 'sonner';
3
- import * as NativeSonner from 'sonner-native';
4
-
5
- // Define proper types for the toast components
6
- interface ToastFunction {
7
- (message: string, options?: Record<string, unknown>): void;
8
- success: (message: string, options?: Record<string, unknown>) => void;
9
- error: (message: string, options?: Record<string, unknown>) => void;
10
- info: (message: string, options?: Record<string, unknown>) => void;
11
- warning: (message: string, options?: Record<string, unknown>) => void;
12
- loading: (message: string, options?: Record<string, unknown>) => void;
13
- }
14
-
15
- type ToasterComponent = (props?: Record<string, unknown>) => React.ReactElement | null;
16
-
17
- const { toast: webToast, Toaster: WebToaster } = WebSonner as {
18
- toast: ToastFunction;
19
- Toaster: ToasterComponent;
20
- };
21
- const { toast: nativeToast, Toaster: NativeToaster } = NativeSonner as {
22
- toast: ToastFunction;
23
- Toaster: ToasterComponent;
24
- };
25
-
26
- export const toast = Platform.OS === 'web' ? webToast : nativeToast;
27
- export const Toaster = Platform.OS === 'web' ? WebToaster : NativeToaster;
28
- export type ToastT = typeof webToast;
1
+ /**
2
+ * Sonner Toast - Platform-Agnostic Entry Point
3
+ *
4
+ * Bundlers resolve platform-specific implementations:
5
+ * - Metro (React Native): resolves to sonner.native.ts
6
+ * - Vite/Webpack (Web): resolves to sonner.web.ts
7
+ * - Node.js/SSR: uses this file (web fallback)
8
+ *
9
+ * This file exports web as the default for /core and /web entry points.
10
+ */
11
+ export { toast, Toaster, type ToastT } from './sonner.web';