@onairos/react-native 3.7.2 → 3.7.4

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 (237) hide show
  1. package/lib/commonjs/api/index.js +219 -9
  2. package/lib/commonjs/components/BodyText.js +27 -9
  3. package/lib/commonjs/components/BrandMark.js +111 -10
  4. package/lib/commonjs/components/CodeInput.js +120 -9
  5. package/lib/commonjs/components/EmailInput.js +30 -8
  6. package/lib/commonjs/components/GoogleButton.js +56 -9
  7. package/lib/commonjs/components/HeadingGroup.js +43 -9
  8. package/lib/commonjs/components/LLMDataInputModal.js +664 -14
  9. package/lib/commonjs/components/ModalHeader.js +99 -9
  10. package/lib/commonjs/components/ModalSheet.js +47 -9
  11. package/lib/commonjs/components/Onairos.js +380 -14
  12. package/lib/commonjs/components/OnairosButton.js +313 -13
  13. package/lib/commonjs/components/OnairosSignInButton.js +130 -12
  14. package/lib/commonjs/components/Overlay.js +465 -13
  15. package/lib/commonjs/components/PersonaImage.js +137 -10
  16. package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
  17. package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
  18. package/lib/commonjs/components/PinCreationScreen.js +403 -12
  19. package/lib/commonjs/components/PinInput.js +464 -9
  20. package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
  21. package/lib/commonjs/components/PlatformList.js +137 -10
  22. package/lib/commonjs/components/PlatformToggle.js +180 -9
  23. package/lib/commonjs/components/PrimaryButton.js +180 -10
  24. package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
  25. package/lib/commonjs/components/SignInStep.js +345 -12
  26. package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
  27. package/lib/commonjs/components/VerificationStep.js +176 -11
  28. package/lib/commonjs/components/WelcomeScreen.js +461 -22
  29. package/lib/commonjs/components/icons/Basicproficon.js +37 -8
  30. package/lib/commonjs/components/icons/Basicprofile.js +21 -8
  31. package/lib/commonjs/components/icons/Checkbox.js +21 -8
  32. package/lib/commonjs/components/icons/Checkmark.js +27 -8
  33. package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
  34. package/lib/commonjs/components/icons/Contenticon.js +39 -8
  35. package/lib/commonjs/components/icons/EnochE.js +41 -8
  36. package/lib/commonjs/components/icons/Personalityicon.js +30 -8
  37. package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
  38. package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
  39. package/lib/commonjs/components/icons/Userpreferences.js +21 -8
  40. package/lib/commonjs/components/icons/index.js +84 -17
  41. package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
  42. package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
  43. package/lib/commonjs/components/onboarding/PinInput.js +283 -10
  44. package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
  45. package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
  46. package/lib/commonjs/config/api.js +56 -7
  47. package/lib/commonjs/constants/index.js +120 -7
  48. package/lib/commonjs/context/AuthContext.js +345 -10
  49. package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
  50. package/lib/commonjs/hooks/useConnections.js +102 -8
  51. package/lib/commonjs/hooks/useCredentials.js +178 -10
  52. package/lib/commonjs/hooks/useUserConnections.js +148 -10
  53. package/lib/commonjs/index.js +439 -34
  54. package/lib/commonjs/services/apiClient.js +298 -8
  55. package/lib/commonjs/services/biometricPinService.js +180 -8
  56. package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
  57. package/lib/commonjs/services/chatGPTConversationService.js +275 -9
  58. package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
  59. package/lib/commonjs/services/claudeConversationService.js +158 -9
  60. package/lib/commonjs/services/connectedAccountsService.js +310 -10
  61. package/lib/commonjs/services/googleAuthService.js +252 -11
  62. package/lib/commonjs/services/hingeDataExtractor.js +105 -8
  63. package/lib/commonjs/services/hingeDataService.js +150 -9
  64. package/lib/commonjs/services/imageCompressionService.js +260 -7
  65. package/lib/commonjs/services/instagramDataExtractor.js +126 -8
  66. package/lib/commonjs/services/instagramDataService.js +163 -9
  67. package/lib/commonjs/services/jwtStorageService.js +276 -7
  68. package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
  69. package/lib/commonjs/services/linkedinProfileService.js +222 -9
  70. package/lib/commonjs/services/linkedinScrapingService.js +230 -8
  71. package/lib/commonjs/services/llmDataStorage.js +294 -8
  72. package/lib/commonjs/services/mobileTrainingService.js +186 -8
  73. package/lib/commonjs/services/netflixDataExtractor.js +120 -8
  74. package/lib/commonjs/services/netflixDataService.js +198 -9
  75. package/lib/commonjs/services/pinEncryptionService.js +84 -8
  76. package/lib/commonjs/services/pinStorageUtils.js +105 -7
  77. package/lib/commonjs/services/platformAuthService.js +1484 -12
  78. package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
  79. package/lib/commonjs/services/sephoraDataService.js +200 -9
  80. package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
  81. package/lib/commonjs/services/spotifyDataService.js +241 -9
  82. package/lib/commonjs/services/storageService.js +404 -8
  83. package/lib/commonjs/services/telegramDataExtractor.js +115 -8
  84. package/lib/commonjs/services/telegramDataService.js +499 -9
  85. package/lib/commonjs/services/trainingApiHelpers.js +73 -7
  86. package/lib/commonjs/services/userConnectionsService.js +340 -10
  87. package/lib/commonjs/services/youtubeMigrationService.js +416 -10
  88. package/lib/commonjs/theme/index.js +250 -7
  89. package/lib/commonjs/types/ambient.d.js +2 -1
  90. package/lib/commonjs/types/declarations.d.js +2 -1
  91. package/lib/commonjs/types/index.js +6 -1
  92. package/lib/commonjs/types/node-fix.d.js +2 -1
  93. package/lib/commonjs/types/node-override.d.js +2 -1
  94. package/lib/commonjs/types/opacity.d.js +2 -1
  95. package/lib/commonjs/types.js +14 -1
  96. package/lib/commonjs/utils/Portal.js +98 -8
  97. package/lib/commonjs/utils/api.js +130 -9
  98. package/lib/commonjs/utils/assetRegistry.js +210 -35
  99. package/lib/commonjs/utils/auth.js +112 -9
  100. package/lib/commonjs/utils/connectorTests.js +613 -29
  101. package/lib/commonjs/utils/crypto.js +62 -8
  102. package/lib/commonjs/utils/debugHelper.js +64 -1
  103. package/lib/commonjs/utils/encryption.js +76 -7
  104. package/lib/commonjs/utils/eventUtils.js +288 -1
  105. package/lib/commonjs/utils/haptics.js +66 -9
  106. package/lib/commonjs/utils/imagePreloader.js +6 -1
  107. package/lib/commonjs/utils/networkDiagnostics.js +226 -8
  108. package/lib/commonjs/utils/onairosApi.js +350 -9
  109. package/lib/commonjs/utils/programmaticFlow.js +117 -9
  110. package/lib/commonjs/utils/retryHelper.js +220 -1
  111. package/lib/commonjs/utils/secureStorage.js +349 -10
  112. package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
  113. package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
  114. package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
  115. package/lib/commonjs/utils/webviewScripts/index.js +698 -15
  116. package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
  117. package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
  118. package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
  119. package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
  120. package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
  121. package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
  122. package/lib/module/api/index.js +211 -1
  123. package/lib/module/components/BodyText.js +20 -1
  124. package/lib/module/components/BrandMark.js +104 -1
  125. package/lib/module/components/CodeInput.js +113 -1
  126. package/lib/module/components/EmailInput.js +23 -1
  127. package/lib/module/components/GoogleButton.js +49 -1
  128. package/lib/module/components/HeadingGroup.js +36 -1
  129. package/lib/module/components/LLMDataInputModal.js +656 -7
  130. package/lib/module/components/ModalHeader.js +92 -1
  131. package/lib/module/components/ModalSheet.js +39 -1
  132. package/lib/module/components/Onairos.js +373 -1
  133. package/lib/module/components/OnairosButton.js +305 -1
  134. package/lib/module/components/OnairosSignInButton.js +121 -1
  135. package/lib/module/components/Overlay.js +456 -1
  136. package/lib/module/components/PersonaImage.js +129 -1
  137. package/lib/module/components/PersonaLoadingScreen.js +310 -1
  138. package/lib/module/components/PersonalizationConsentScreen.js +460 -1
  139. package/lib/module/components/PinCreationScreen.js +396 -1
  140. package/lib/module/components/PinInput.js +456 -1
  141. package/lib/module/components/PlatformConnectorsStep.js +1302 -6
  142. package/lib/module/components/PlatformList.js +129 -1
  143. package/lib/module/components/PlatformToggle.js +173 -1
  144. package/lib/module/components/PrimaryButton.js +172 -1
  145. package/lib/module/components/SignInMatchAnimation.js +189 -1
  146. package/lib/module/components/SignInStep.js +338 -1
  147. package/lib/module/components/UniversalOnboarding.js +2770 -1
  148. package/lib/module/components/VerificationStep.js +168 -1
  149. package/lib/module/components/WelcomeScreen.js +453 -1
  150. package/lib/module/components/icons/Basicproficon.js +30 -1
  151. package/lib/module/components/icons/Basicprofile.js +14 -1
  152. package/lib/module/components/icons/Checkbox.js +14 -1
  153. package/lib/module/components/icons/Checkmark.js +20 -1
  154. package/lib/module/components/icons/Contentanalysis.js +14 -1
  155. package/lib/module/components/icons/Contenticon.js +32 -1
  156. package/lib/module/components/icons/EnochE.js +34 -1
  157. package/lib/module/components/icons/Personalityicon.js +23 -1
  158. package/lib/module/components/icons/Personalityprofile.js +14 -1
  159. package/lib/module/components/icons/Personalitytraits.js +14 -1
  160. package/lib/module/components/icons/Userpreferences.js +14 -1
  161. package/lib/module/components/icons/index.js +13 -1
  162. package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
  163. package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
  164. package/lib/module/components/onboarding/PinInput.js +274 -1
  165. package/lib/module/components/onboarding/PlatformConnector.js +240 -1
  166. package/lib/module/config/PLATFORM_APIS.md +849 -0
  167. package/lib/module/config/api.js +47 -1
  168. package/lib/module/constants/index.js +114 -1
  169. package/lib/module/context/AuthContext.js +335 -1
  170. package/lib/module/hooks/useConnectedAccounts.js +106 -1
  171. package/lib/module/hooks/useConnections.js +95 -1
  172. package/lib/module/hooks/useCredentials.js +171 -6
  173. package/lib/module/hooks/useUserConnections.js +140 -1
  174. package/lib/module/index.js +172 -1
  175. package/lib/module/services/apiClient.js +295 -1
  176. package/lib/module/services/biometricPinService.js +169 -1
  177. package/lib/module/services/chatGPTConversationExtractor.js +149 -1
  178. package/lib/module/services/chatGPTConversationService.js +268 -1
  179. package/lib/module/services/claudeConversationExtractor.js +97 -1
  180. package/lib/module/services/claudeConversationService.js +151 -1
  181. package/lib/module/services/connectedAccountsService.js +293 -1
  182. package/lib/module/services/googleAuthService.js +241 -1
  183. package/lib/module/services/hingeDataExtractor.js +99 -1
  184. package/lib/module/services/hingeDataService.js +143 -1
  185. package/lib/module/services/imageCompressionService.js +250 -1
  186. package/lib/module/services/instagramDataExtractor.js +120 -1
  187. package/lib/module/services/instagramDataService.js +156 -1
  188. package/lib/module/services/jwtStorageService.js +257 -1
  189. package/lib/module/services/linkedinDOMExtractor.js +234 -1
  190. package/lib/module/services/linkedinProfileService.js +210 -1
  191. package/lib/module/services/linkedinScrapingService.js +219 -1
  192. package/lib/module/services/llmDataStorage.js +277 -1
  193. package/lib/module/services/mobileTrainingService.js +173 -1
  194. package/lib/module/services/netflixDataExtractor.js +114 -1
  195. package/lib/module/services/netflixDataService.js +191 -1
  196. package/lib/module/services/pinEncryptionService.js +74 -6
  197. package/lib/module/services/pinStorageUtils.js +93 -1
  198. package/lib/module/services/platformAuthService.js +1461 -1
  199. package/lib/module/services/sephoraDataExtractor.js +134 -1
  200. package/lib/module/services/sephoraDataService.js +193 -1
  201. package/lib/module/services/spotifyDataExtractor.js +142 -1
  202. package/lib/module/services/spotifyDataService.js +234 -1
  203. package/lib/module/services/storageService.js +383 -1
  204. package/lib/module/services/telegramDataExtractor.js +109 -1
  205. package/lib/module/services/telegramDataService.js +493 -1
  206. package/lib/module/services/trainingApiHelpers.js +67 -1
  207. package/lib/module/services/userConnectionsService.js +329 -1
  208. package/lib/module/services/youtubeMigrationService.js +405 -1
  209. package/lib/module/theme/index.js +245 -1
  210. package/lib/module/types.js +10 -1
  211. package/lib/module/utils/Portal.js +90 -1
  212. package/lib/module/utils/api.js +118 -1
  213. package/lib/module/utils/assetRegistry.js +200 -34
  214. package/lib/module/utils/auth.js +100 -1
  215. package/lib/module/utils/connectorTests.js +600 -27
  216. package/lib/module/utils/crypto.js +54 -1
  217. package/lib/module/utils/debugHelper.js +54 -1
  218. package/lib/module/utils/encryption.js +67 -1
  219. package/lib/module/utils/eventUtils.js +270 -1
  220. package/lib/module/utils/haptics.js +59 -8
  221. package/lib/module/utils/imagePreloader.js +3 -1
  222. package/lib/module/utils/networkDiagnostics.js +217 -1
  223. package/lib/module/utils/onairosApi.js +333 -1
  224. package/lib/module/utils/programmaticFlow.js +111 -1
  225. package/lib/module/utils/retryHelper.js +211 -1
  226. package/lib/module/utils/secureStorage.js +330 -6
  227. package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
  228. package/lib/module/utils/webviewScripts/claude.js +370 -1
  229. package/lib/module/utils/webviewScripts/hinge.js +405 -1
  230. package/lib/module/utils/webviewScripts/index.js +434 -1
  231. package/lib/module/utils/webviewScripts/instagram.js +448 -1
  232. package/lib/module/utils/webviewScripts/linkedin.js +874 -1
  233. package/lib/module/utils/webviewScripts/netflix.js +376 -1
  234. package/lib/module/utils/webviewScripts/sephora.js +510 -1
  235. package/lib/module/utils/webviewScripts/spotify.js +413 -1
  236. package/lib/module/utils/webviewScripts/telegram.js +672 -1
  237. package/package.json +2 -2
@@ -1,9 +1,111 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("react"),
5
- require("../services/connectedAccountsService"),
6
- require("../context/AuthContext")
7
- ];
8
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
9
- function _0x235b(){const _0x55f985=['defineProperty','__esModule','useConnectedAccounts','🔍\x20No\x20user\x20available\x20for\x20fetching\x20connected\x20accounts','Nvywx','🚀\x20[HOOK]\x20User\x20info\x20available:','GYtLn','❌\x20[HOOK]\x20Error\x20fetching\x20connected\x20accounts:','KFhKq','mkIub','nefUY','VKLXy','useState','kEofo','dxGXk','log','CaKeM','jgnGY','lXbnq','dfvDf','TMfey','jpOmp','email','name','\x20accounts','NnpLX','fmhNt','YsTbN','https://','toLowerCase','.com/','some','platform','map','error','xtPnZ','HPmGY','WQbFZ','KlltT','kiOmW','uICjW','JANAB','bURPa','AQVsH','useCallback','wfNYV','UfnZy','NOlNI','filter','AUqbl','mZkBI','useEffect','BiKGP','ingbd','upXnK'];_0x235b=function(){return _0x55f985;};return _0x235b();}function _0x38af(_0x235b7d,_0x38af2f){_0x235b7d=_0x235b7d-0x0;const _0x5e5f01=_0x235b();let _0x4cb9d0=_0x5e5f01[_0x235b7d];return _0x4cb9d0;}Object[_0x38af(0x0)](exports,_0x38af(0x1),{'value':!![]}),exports[_0x38af(0x2)]=void 0x0;var _react=__ONAIROS_REQ_FUNC__(0x0),_connectedAccountsService=__ONAIROS_REQ_FUNC__(0x1),_AuthContext=__ONAIROS_REQ_FUNC__(0x2);const useConnectedAccounts=()=>{const _0x309fa={'kEofo':_0x38af(0x3),'dxGXk':'✅\x20[HOOK]\x20Account\x20added\x20locally:','lXbnq':function(_0x51cef9,_0x490d9a){return _0x51cef9(_0x490d9a);},'CaKeM':_0x38af(0x4),'dfvDf':function(_0x330264,_0x22195e){return _0x330264(_0x22195e);},'TMfey':'🚀\x20[HOOK]\x20Starting\x20connected\x20accounts\x20fetch\x20with\x20new\x20smart\x20API...','jpOmp':_0x38af(0x5),'NnpLX':function(_0xf60a19,_0x5193d2){return _0xf60a19===_0x5193d2;},'fmhNt':_0x38af(0x6),'xtPnZ':_0x38af(0x7),'HPmGY':'Failed\x20to\x20load\x20connected\x20accounts','WQbFZ':function(_0x17b207,_0x31dd6a){return _0x17b207!==_0x31dd6a;},'KlltT':_0x38af(0x8),'KpLIQ':function(_0x2db5c3,_0x547374){return _0x2db5c3===_0x547374;},'uICjW':_0x38af(0x9),'JANAB':'🔄\x20[HOOK]\x20Refreshing\x20connected\x20accounts...','bURPa':function(_0x2d4133){return _0x2d4133();},'AQVsH':function(_0x5145c6,_0x56eb63){return _0x5145c6(_0x56eb63);},'wfNYV':function(_0x1ba4de,_0x1c1174){return _0x1ba4de(_0x1c1174);},'AEbMz':_0x38af(0xa),'UfnZy':'INwsr','NOlNI':function(_0x2e9a18,_0x3e590e){return _0x2e9a18(_0x3e590e);},'IKiKc':'✅\x20[HOOK]\x20Account\x20removed\x20locally:','BiKGP':function(_0x421de4){return _0x421de4();},'BCJrt':_0x38af(0xb),'ingbd':'QBgqB'},{user:_0x429b8b}=(0x0,_AuthContext['useAuth'])(),[_0x43b194,_0x5b9cd0]=(0x0,_react[_0x38af(0xc)])([]),[_0x5826d3,_0x444a71]=(0x0,_react[_0x38af(0xc)])(!![]),[_0x235321,_0x425685]=(0x0,_react[_0x38af(0xc)])(null),_0x444c53=(0x0,_react['useCallback'])(async()=>{const _0xbde4d2={'jgnGY':_0x309fa[_0x38af(0xd)],'dyQoZ':_0x309fa[_0x38af(0xe)]};if(!_0x429b8b){console[_0x38af(0xf)](_0x309fa['kEofo']),_0x309fa['lXbnq'](_0x444a71,![]);return;}try{if(_0x309fa[_0x38af(0x10)]!==_0x38af(0x4)){_0x1da8fc['log'](_0xbde4d2[_0x38af(0x11)]),_0x4d3c54(![]);return;}else{_0x309fa[_0x38af(0x12)](_0x444a71,!![]),_0x309fa[_0x38af(0x13)](_0x425685,null),console[_0x38af(0xf)](_0x309fa[_0x38af(0x14)]),console['log'](_0x309fa[_0x38af(0x15)],{'email':_0x429b8b[_0x38af(0x16)],'id':_0x429b8b['id'],'name':_0x429b8b[_0x38af(0x17)]});const _0xd19492=await(0x0,_connectedAccountsService['getConnectedAccountsSmart'])(_0x429b8b[_0x38af(0x16)],_0x429b8b['id'],_0x429b8b['name']);console['log']('✅\x20[HOOK]\x20Connected\x20accounts\x20loaded\x20via\x20smart\x20API:\x20'+_0xd19492['length']+_0x38af(0x18)),_0x309fa[_0x38af(0x12)](_0x5b9cd0,_0xd19492);}}catch(_0x4335eb){if(_0x309fa[_0x38af(0x19)](_0x309fa[_0x38af(0x1a)],_0x38af(0x1b))){const _0x34ccf7=_0x38af(0x1c)+_0x50f4e5[_0x38af(0x1d)]()+_0x38af(0x1e)+_0x3dcaa4,_0x5ebd1c={'platform':_0x49a794,'username':_0x5937eb,'url':_0x34ccf7};_0x124072(_0x5be939=>{const _0x5ce2dd=_0x5be939[_0x38af(0x1f)](_0x36ef10=>_0x36ef10[_0x38af(0x20)]['toLowerCase']()===_0x453ccf[_0x38af(0x1d)]());return _0x5ce2dd?_0x5be939[_0x38af(0x21)](_0x2d8d6f=>_0x2d8d6f['platform'][_0x38af(0x1d)]()===_0x56a032[_0x38af(0x1d)]()?_0x5ebd1c:_0x2d8d6f):[..._0x5be939,_0x5ebd1c];}),_0x34f282[_0x38af(0xf)](_0xbde4d2['dyQoZ'],_0x5ebd1c);}else console[_0x38af(0x22)](_0x309fa[_0x38af(0x23)],_0x4335eb),_0x309fa[_0x38af(0x12)](_0x425685,_0x309fa[_0x38af(0x24)]);}finally{if(_0x309fa[_0x38af(0x25)](_0x309fa[_0x38af(0x26)],_0x38af(0x27)))_0x309fa['dfvDf'](_0x444a71,![]);else return _0x2b67f5[_0x38af(0x21)](_0x359d77=>_0x359d77[_0x38af(0x20)][_0x38af(0x1d)]()===_0xc56240[_0x38af(0x1d)]()?_0x19fe83:_0x359d77);}},[_0x429b8b]),_0x559fc0=(0x0,_react['useCallback'])(async()=>{if(_0x309fa['KpLIQ'](_0x309fa[_0x38af(0x28)],_0x309fa[_0x38af(0x28)]))console[_0x38af(0xf)](_0x309fa[_0x38af(0x29)]),await _0x309fa[_0x38af(0x2a)](_0x444c53);else return[..._0x4d455f,_0x2dd030];},[_0x444c53]),_0x397489=(0x0,_react['useCallback'])((_0x11085d,_0x578a7c)=>{const _0x4dfad4=_0x38af(0x1c)+_0x11085d[_0x38af(0x1d)]()+_0x38af(0x1e)+_0x578a7c,_0x37c8fa={'platform':_0x11085d,'username':_0x578a7c,'url':_0x4dfad4};_0x309fa[_0x38af(0x2b)](_0x5b9cd0,_0x2ff403=>{const _0x225b64=_0x2ff403['some'](_0x4ee0fb=>_0x4ee0fb[_0x38af(0x20)][_0x38af(0x1d)]()===_0x11085d['toLowerCase']());return _0x225b64?_0x2ff403[_0x38af(0x21)](_0x5e9fbb=>_0x5e9fbb[_0x38af(0x20)][_0x38af(0x1d)]()===_0x11085d[_0x38af(0x1d)]()?_0x37c8fa:_0x5e9fbb):[..._0x2ff403,_0x37c8fa];}),console[_0x38af(0xf)](_0x309fa[_0x38af(0xe)],_0x37c8fa);},[]),_0x444b62=(0x0,_react[_0x38af(0x2c)])(_0x377dee=>{const _0x1a4e94={'AUqbl':_0x309fa['xtPnZ'],'mZkBI':function(_0xf2dd07,_0x3be4dc){return _0x309fa[_0x38af(0x2d)](_0xf2dd07,_0x3be4dc);}};_0x309fa[_0x38af(0x25)](_0x309fa['AEbMz'],_0x309fa[_0x38af(0x2e)])?(_0x309fa[_0x38af(0x2f)](_0x5b9cd0,_0x19b036=>_0x19b036[_0x38af(0x30)](_0x1e40b=>_0x1e40b[_0x38af(0x20)][_0x38af(0x1d)]()!==_0x377dee['toLowerCase']())),console[_0x38af(0xf)](_0x309fa['IKiKc'],_0x377dee)):(_0x38c757['error'](_0x1a4e94[_0x38af(0x31)],_0x751a6e),_0x1a4e94[_0x38af(0x32)](_0x49709d,'Failed\x20to\x20load\x20connected\x20accounts'));},[]);return(0x0,_react[_0x38af(0x33)])(()=>{const _0x2cffb1={'upXnK':function(_0x4875d5){return _0x309fa[_0x38af(0x34)](_0x4875d5);}};_0x309fa[_0x38af(0x25)](_0x309fa['BCJrt'],_0x309fa[_0x38af(0x35)])?_0x444c53():_0x2cffb1[_0x38af(0x36)](_0x29bd);},[_0x444c53]),{'connectedAccounts':_0x43b194,'isLoading':_0x5826d3,'error':_0x235321,'refreshAccounts':_0x559fc0,'addAccount':_0x397489,'removeAccount':_0x444b62};};exports[_0x38af(0x2)]=useConnectedAccounts;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useConnectedAccounts = void 0;
7
+ var _react = require("react");
8
+ var _connectedAccountsService = require("../services/connectedAccountsService");
9
+ var _AuthContext = require("../context/AuthContext");
10
+ const useConnectedAccounts = () => {
11
+ const {
12
+ user
13
+ } = (0, _AuthContext.useAuth)();
14
+ const [connectedAccounts, setConnectedAccounts] = (0, _react.useState)([]);
15
+ const [isLoading, setIsLoading] = (0, _react.useState)(true);
16
+ const [error, setError] = (0, _react.useState)(null);
17
+ const fetchConnectedAccounts = (0, _react.useCallback)(async () => {
18
+ if (!user) {
19
+ console.log('🔍 No user available for fetching connected accounts');
20
+ setIsLoading(false);
21
+ return;
22
+ }
23
+ try {
24
+ setIsLoading(true);
25
+ setError(null);
26
+ console.log('🚀 [HOOK] Starting connected accounts fetch with new smart API...');
27
+ console.log('🚀 [HOOK] User info available:', {
28
+ email: user.email,
29
+ id: user.id,
30
+ name: user.name
31
+ });
32
+
33
+ // Use the new smart API function - makes only ONE request with intelligent fallbacks
34
+ const accounts = await (0, _connectedAccountsService.getConnectedAccountsSmart)(user.email,
35
+ // Primary identifier (email)
36
+ user.id,
37
+ // Secondary identifier (user ID)
38
+ user.name // Tertiary identifier (username)
39
+ );
40
+ console.log(`✅ [HOOK] Connected accounts loaded via smart API: ${accounts.length} accounts`);
41
+ setConnectedAccounts(accounts);
42
+ } catch (err) {
43
+ console.error('❌ [HOOK] Error fetching connected accounts:', err);
44
+ setError('Failed to load connected accounts');
45
+ } finally {
46
+ setIsLoading(false);
47
+ }
48
+ }, [user]);
49
+ const refreshAccounts = (0, _react.useCallback)(async () => {
50
+ console.log('🔄 [HOOK] Refreshing connected accounts...');
51
+ await fetchConnectedAccounts();
52
+ }, [fetchConnectedAccounts]);
53
+ const addAccount = (0, _react.useCallback)((platform, username) => {
54
+ // Create a temporary URL for the account
55
+ const tempUrl = `https://${platform.toLowerCase()}.com/${username}`;
56
+ const newAccount = {
57
+ platform,
58
+ username,
59
+ url: tempUrl
60
+ };
61
+ setConnectedAccounts(prev => {
62
+ // Check if account already exists
63
+ const exists = prev.some(acc => acc.platform.toLowerCase() === platform.toLowerCase());
64
+ if (exists) {
65
+ // Update existing account
66
+ return prev.map(acc => acc.platform.toLowerCase() === platform.toLowerCase() ? newAccount : acc);
67
+ } else {
68
+ // Add new account
69
+ return [...prev, newAccount];
70
+ }
71
+ });
72
+ console.log('✅ [HOOK] Account added locally:', newAccount);
73
+
74
+ // TODO: In a real implementation, you would also send this to your backend
75
+ // Example:
76
+ // try {
77
+ // await saveConnectedAccount(user.id, platform, username);
78
+ // } catch (error) {
79
+ // console.error('Failed to save account to backend:', error);
80
+ // // Optionally revert the local change
81
+ // }
82
+ }, []);
83
+ const removeAccount = (0, _react.useCallback)(platform => {
84
+ setConnectedAccounts(prev => prev.filter(acc => acc.platform.toLowerCase() !== platform.toLowerCase()));
85
+ console.log('✅ [HOOK] Account removed locally:', platform);
86
+
87
+ // TODO: In a real implementation, you would also remove this from your backend
88
+ // Example:
89
+ // try {
90
+ // await removeConnectedAccount(user.id, platform);
91
+ // } catch (error) {
92
+ // console.error('Failed to remove account from backend:', error);
93
+ // // Optionally revert the local change
94
+ // }
95
+ }, []);
96
+
97
+ // Fetch accounts when component mounts or user changes
98
+ (0, _react.useEffect)(() => {
99
+ fetchConnectedAccounts();
100
+ }, [fetchConnectedAccounts]);
101
+ return {
102
+ connectedAccounts,
103
+ isLoading,
104
+ error,
105
+ refreshAccounts,
106
+ addAccount,
107
+ removeAccount
108
+ };
109
+ };
110
+ exports.useConnectedAccounts = useConnectedAccounts;
111
+ //# sourceMappingURL=useConnectedAccounts.js.map
@@ -1,8 +1,102 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("react"),
5
- require("../services/platformAuthService")
6
- ];
7
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
8
- function _0x5aaf(){const _0x46adb4=['defineProperty','ℹ️\x20NOTE:\x20Backend\x20sync\x20removed\x20from\x20SDK\x20-\x20app\x20should\x20call\x20/enoch/users/update\x20if\x20needed','youtube','instagram','GaUSa','oeaZf','GXVqA','ZXIvQ','ZtSoj','Vwgdz','useState','useCallback','yeFzR','mKkRi','ULpPG','JCydM','BhCsW','jknEK','YLNZK','yCDJq','mQSRx','initiateNativeAuth','Ilmca','nLASq','log','✅\x20Platform\x20','XrbGy','HdKNE','\x20connected\x20locally','BkIcf','\x20disconnected\x20locally','GDnNi','error','Error\x20disconnecting\x20platform\x20','mUjaM','nhZxo','yuwDi','MXVVz','tXjTG','tPwbu'];_0x5aaf=function(){return _0x46adb4;};return _0x5aaf();}function _0x5aea(_0x5aaf18,_0x5aea29){_0x5aaf18=_0x5aaf18-0x0;const _0x326abb=_0x5aaf();let _0x2d0088=_0x326abb[_0x5aaf18];return _0x2d0088;}Object[_0x5aea(0x0)](exports,'__esModule',{'value':!![]}),exports['useConnections']=void 0x0;var _react=__ONAIROS_REQ_FUNC__(0x0),_platformAuthService=__ONAIROS_REQ_FUNC__(0x1);const useConnections=()=>{const _0x18f585={'YLNZK':function(_0x1fd992,_0x2cfacd){return _0x1fd992(_0x2cfacd);},'mKkRi':_0x5aea(0x1),'yeFzR':function(_0x10cf23,_0x5cecb5){return _0x10cf23(_0x5cecb5);},'ULpPG':function(_0x15872d,_0x286c2d){return _0x15872d!==_0x286c2d;},'JCydM':'ILFUZ','BhCsW':function(_0x193a82,_0x28f205){return _0x193a82===_0x28f205;},'jknEK':'dQxgc','yCDJq':function(_0x173a29,_0x4bd59a){return _0x173a29===_0x4bd59a;},'ttQvM':_0x5aea(0x2),'mQSRx':_0x5aea(0x3),'nLASq':_0x5aea(0x4),'XrbGy':function(_0x144d55,_0x2d0571){return _0x144d55!==_0x2d0571;},'HdKNE':_0x5aea(0x5),'uKdjS':_0x5aea(0x6),'mUjaM':_0x5aea(0x7),'nCVLW':'swOIZ','nhZxo':'KMSYV','ATphV':_0x5aea(0x8),'yuwDi':function(_0x2ebbc0,_0x14a424){return _0x2ebbc0(_0x14a424);},'tXjTG':_0x5aea(0x9)},[_0x74bfa7,_0x5e9898]=(0x0,_react[_0x5aea(0xa)])({}),[_0x59dc13,_0x5555bb]=(0x0,_react['useState'])(![]),_0x22e8c9=(0x0,_react[_0x5aea(0xb)])(async(_0x5f036e,_0x4d92db)=>{const _0x6a7f6b={'BkIcf':function(_0x2b5f9c,_0x44b41a){return _0x18f585[_0x5aea(0xc)](_0x2b5f9c,_0x44b41a);},'GDnNi':_0x18f585[_0x5aea(0xd)]};if(_0x18f585[_0x5aea(0xe)](_0x18f585['JCydM'],_0x18f585[_0x5aea(0xf)]))return _0x1b4d6d;else try{if(_0x18f585[_0x5aea(0x10)](_0x18f585[_0x5aea(0x11)],_0x18f585['jknEK'])){_0x18f585[_0x5aea(0x12)](_0x5555bb,!![]);const useNativeSDK=_0x18f585[_0x5aea(0x13)](_0x5f036e,_0x18f585['ttQvM'])||_0x18f585[_0x5aea(0x13)](_0x5f036e,_0x18f585[_0x5aea(0x14)]);let _0x4c7e48=![];if(useNativeSDK)_0x4c7e48=await(0x0,_platformAuthService[_0x5aea(0x15)])(_0x5f036e,_0x4d92db);else{if(_0x5aea(0x16)!==_0x18f585[_0x5aea(0x17)])await new Promise(_0x30c824=>setTimeout(()=>_0x30c824(undefined),0x3e8)),_0x4c7e48=!![];else return _0x18f585[_0x5aea(0x12)](_0x42a4c9,_0x39f3db=>({..._0x39f3db,[_0x2b35e2]:{'userName':_0x311d13,'connected':!![]}})),_0x3e46a8[_0x5aea(0x18)](_0x5aea(0x19)+_0x5d410f+'\x20connected\x20locally'),_0x511936[_0x5aea(0x18)](_0x18f585[_0x5aea(0xd)]),!![];}if(_0x4c7e48)return _0x18f585[_0x5aea(0x1a)](_0x18f585[_0x5aea(0x1b)],_0x18f585['uKdjS'])?(_0x18f585['yeFzR'](_0x5e9898,_0x3b207c=>({..._0x3b207c,[_0x5f036e]:{'userName':_0x4d92db,'connected':!![]}})),console[_0x5aea(0x18)](_0x5aea(0x19)+_0x5f036e+_0x5aea(0x1c)),console['log'](_0x18f585[_0x5aea(0xd)]),!![]):(_0x6a7f6b[_0x5aea(0x1d)](_0x11c756,_0x46244f=>{const _0x525817={..._0x46244f};return delete _0x525817[_0x3de99f],_0x525817;}),_0x415a25['log'](_0x5aea(0x19)+_0x2e6078+_0x5aea(0x1e)),_0x4f82ee[_0x5aea(0x18)](_0x6a7f6b[_0x5aea(0x1f)]),!![]);return![];}else return _0x15b226[_0x5aea(0x20)](_0x5aea(0x21)+_0x255ed4+':',_0x309877),![];}catch(_0x4a4c92){if(_0x18f585[_0x5aea(0x13)]('ZXIvQ',_0x18f585[_0x5aea(0x22)]))return console[_0x5aea(0x20)]('Error\x20connecting\x20platform\x20'+_0x5f036e+':',_0x4a4c92),![];else{const _0x44bd6f={..._0xd8220f};return delete _0x44bd6f[_0x26fe28],_0x44bd6f;}}finally{_0x18f585[_0x5aea(0x12)](_0x5555bb,![]);}},[]),_0x5f08bd=(0x0,_react[_0x5aea(0xb)])(async(_0x540018,_0x1d6366)=>{const _0x7d690={'MXVVz':function(_0x1d8d5b,_0x3600f2){return _0x18f585[_0x5aea(0x13)](_0x1d8d5b,_0x3600f2);},'ARULl':_0x18f585['nCVLW'],'tPwbu':function(_0x303c41,_0x476983){return _0x18f585[_0x5aea(0xc)](_0x303c41,_0x476983);}};if(_0x18f585[_0x5aea(0x23)]!==_0x18f585['ATphV'])try{return _0x18f585[_0x5aea(0x24)](_0x5e9898,_0x58e312=>{if(_0x7d690[_0x5aea(0x25)](_0x7d690['ARULl'],_0x7d690['ARULl'])){const _0x572101={..._0x58e312};return delete _0x572101[_0x540018],_0x572101;}else return _0x1c2455[_0x5aea(0x20)]('Error\x20connecting\x20platform\x20'+_0x11418a+':',_0x294644),![];}),console[_0x5aea(0x18)](_0x5aea(0x19)+_0x540018+_0x5aea(0x1e)),console['log'](_0x18f585[_0x5aea(0xd)]),!![];}catch(_0x293f19){if(_0x18f585[_0x5aea(0x1a)](_0x18f585[_0x5aea(0x26)],_0x18f585['tXjTG']))_0x7d690[_0x5aea(0x27)](_0x215c2a,![]);else return console[_0x5aea(0x20)](_0x5aea(0x21)+_0x540018+':',_0x293f19),![];}else try{return _0x18f585['yeFzR'](_0x2c0a66,_0x5a1500=>{const _0x107ddc={..._0x5a1500};return delete _0x107ddc[_0x4c8d30],_0x107ddc;}),_0x5aa511[_0x5aea(0x18)]('✅\x20Platform\x20'+_0x2a151f+_0x5aea(0x1e)),_0xe20668['log']('ℹ️\x20NOTE:\x20Backend\x20sync\x20removed\x20from\x20SDK\x20-\x20app\x20should\x20call\x20/enoch/users/update\x20if\x20needed'),!![];}catch(_0x2d81cc){return _0x4e02de[_0x5aea(0x20)](_0x5aea(0x21)+_0x2e9618+':',_0x2d81cc),![];}},[]),_0x5509b8=(0x0,_react[_0x5aea(0xb)])(async()=>{return _0x74bfa7;},[_0x74bfa7]);return{'connections':_0x74bfa7,'connectPlatform':_0x22e8c9,'disconnectPlatform':_0x5f08bd,'getConnectionStatus':_0x5509b8,'isConnecting':_0x59dc13};};exports['useConnections']=useConnections;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useConnections = void 0;
7
+ var _react = require("react");
8
+ var _platformAuthService = require("../services/platformAuthService");
9
+ /**
10
+ * Hook for managing platform connections
11
+ * NOTE: This hook now only manages LOCAL state
12
+ * Consuming apps are responsible for syncing connection status to their backend
13
+ * (e.g., calling /enoch/users/update for Enoch apps)
14
+ */
15
+ const useConnections = () => {
16
+ const [connections, setConnections] = (0, _react.useState)({});
17
+ const [isConnecting, setIsConnecting] = (0, _react.useState)(false);
18
+
19
+ /**
20
+ * Connect a platform using OAuth or native SDK
21
+ * NOTE: Only manages local state - backend sync removed from SDK
22
+ */
23
+ const connectPlatform = (0, _react.useCallback)(async (platform, username) => {
24
+ try {
25
+ setIsConnecting(true);
26
+
27
+ // Determine if we should use native SDK or OAuth
28
+ const useNativeSDK = platform === 'youtube' || platform === 'instagram';
29
+ let success = false;
30
+ if (useNativeSDK) {
31
+ // Use native SDK
32
+ success = await (0, _platformAuthService.initiateNativeAuth)(platform, username);
33
+ } else {
34
+ // For demo purposes, we'll simulate a successful connection
35
+ await new Promise(resolve => setTimeout(() => resolve(undefined), 1000));
36
+ success = true;
37
+ }
38
+ if (success) {
39
+ // Update connections state locally only
40
+ // NOTE: Backend sync removed - consuming app should handle this
41
+ setConnections(prev => ({
42
+ ...prev,
43
+ [platform]: {
44
+ userName: username,
45
+ connected: true
46
+ }
47
+ }));
48
+ console.log(`✅ Platform ${platform} connected locally`);
49
+ console.log('ℹ️ NOTE: Backend sync removed from SDK - app should call /enoch/users/update if needed');
50
+ return true;
51
+ }
52
+ return false;
53
+ } catch (error) {
54
+ console.error(`Error connecting platform ${platform}:`, error);
55
+ return false;
56
+ } finally {
57
+ setIsConnecting(false);
58
+ }
59
+ }, []);
60
+
61
+ /**
62
+ * Disconnect a platform
63
+ * NOTE: Only manages local state - backend sync removed from SDK
64
+ */
65
+ const disconnectPlatform = (0, _react.useCallback)(async (platform, _username) => {
66
+ try {
67
+ // Update local state only
68
+ // NOTE: Backend sync removed - consuming app should handle this
69
+ setConnections(prev => {
70
+ const newConnections = {
71
+ ...prev
72
+ };
73
+ delete newConnections[platform];
74
+ return newConnections;
75
+ });
76
+ console.log(`✅ Platform ${platform} disconnected locally`);
77
+ console.log('ℹ️ NOTE: Backend sync removed from SDK - app should call /enoch/users/update if needed');
78
+ return true;
79
+ } catch (error) {
80
+ console.error(`Error disconnecting platform ${platform}:`, error);
81
+ return false;
82
+ }
83
+ }, []);
84
+
85
+ /**
86
+ * Get current connection status
87
+ */
88
+ const getConnectionStatus = (0, _react.useCallback)(async () => {
89
+ // Returns local connection state
90
+ // Consuming app can fetch from backend if needed
91
+ return connections;
92
+ }, [connections]);
93
+ return {
94
+ connections,
95
+ connectPlatform,
96
+ disconnectPlatform,
97
+ getConnectionStatus,
98
+ isConnecting
99
+ };
100
+ };
101
+ exports.useConnections = useConnections;
102
+ //# sourceMappingURL=useConnections.js.map
@@ -1,10 +1,178 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("react"),
5
- require("../constants"),
6
- require("../config/api"),
7
- require('react-native-keychain')
8
- ];
9
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
10
- function _0x3319(){const _0x18b449=['defineProperty','__esModule','useCredentials','warn','function','bXaAM','PNQpz','TiNSo','Error\x20storing\x20credentials:','default','tdDNv','sSGkA','PzoKy','viGbt','getGenericPassword','TlnKh','service','aVLLU','vLCkN','aGpBX','wqPBF','XmXlD','hEUuI','XqcpN','FVvIE','setGenericPassword','iuuGm','LEukI','pXyEG','DQDtm','GqCJu','Keychain\x20access\x20failed,\x20using\x20mock\x20storage','fJQnw','rCnRB','bzcYn','LIbCC','accessControl','BIOMETRY_ANY','accessible','oMTtR','MZXoS','GuebW','NPPtG','QivSV','UktfP','Error\x20clearing\x20credentials:','aPlyR','qwPrT','Error\x20validating\x20credentials:','useCallback','XTPPj','LlqRp','credentials','error','qBZpT','YFdGu','IontZ','mhUnq','STORAGE_KEYS','kWJMW','parse','password','NgTsA','Error\x20getting\x20credentials:','aOxUW','iEnXC','jGdqB','uueNY','stringify','XuYuz','xPfuI','UkShx','LbQUx','bDees','API_CONFIG','BASE_URL','/validate','json','valid','DifcW','btyad','eQjHN','YVMek','CpKiy'];_0x3319=function(){return _0x18b449;};return _0x3319();}function _0x53e2(_0x331957,_0x53e25b){_0x331957=_0x331957-0x0;const _0x1c6cca=_0x3319();let _0x1ddb17=_0x1c6cca[_0x331957];return _0x1ddb17;}Object[_0x53e2(0x0)](exports,_0x53e2(0x1),{'value':!![]}),exports[_0x53e2(0x2)]=void 0x0;var _react=__ONAIROS_REQ_FUNC__(0x0),_constants=__ONAIROS_REQ_FUNC__(0x1),_api=__ONAIROS_REQ_FUNC__(0x2);const mockCredentialStorage={};let Keychain=null;try{Keychain=__ONAIROS_REQ_FUNC__(0x3);}catch(_0x37f614){console[_0x53e2(0x3)]('react-native-keychain module not available in useCredentials, using mock storage');}const isKeychainAvailable=()=>{const _0xd0917={'bXaAM':function(_0x34873b,_0x5f1cf4){return _0x34873b===_0x5f1cf4;},'FPLMH':'kCFLX','PNQpz':function(_0x215465,_0x5641f3){return _0x215465===_0x5641f3;},'TiNSo':_0x53e2(0x4)};try{return _0xd0917[_0x53e2(0x5)](_0xd0917['FPLMH'],_0xd0917['FPLMH'])?Keychain&&_0xd0917[_0x53e2(0x6)](typeof Keychain['getGenericPassword'],_0xd0917[_0x53e2(0x7)]):Keychain&&typeof Keychain['getGenericPassword']===_0x53e2(0x4);}catch(_0x32313f){return![];}},safeGetGenericPassword=async _0x3a4024=>{const _0x426900={'defDI':_0x53e2(0x8),'vLCkN':function(_0x16056f,_0x4badd4){return _0x16056f===_0x4badd4;},'aVLLU':_0x53e2(0x9),'kajQt':function(_0x9a6c8f,_0x288d18){return _0x9a6c8f===_0x288d18;},'sSGkA':_0x53e2(0xa),'PzoKy':function(_0x344114){return _0x344114();},'prsYc':function(_0x1f6fda,_0x457a19){return _0x1f6fda===_0x457a19;},'TlnKh':function(_0x411725,_0x10c804){return _0x411725===_0x10c804;},'aGpBX':'Keychain\x20access\x20failed,\x20using\x20mock\x20storage','wqPBF':function(_0x297a15,_0x1138d3){return _0x297a15===_0x1138d3;},'vcegw':function(_0x167d47,_0x3cbf0c){return _0x167d47===_0x3cbf0c;}};try{if(_0x426900['kajQt'](_0x426900[_0x53e2(0xb)],_0x53e2(0xa))){if(_0x426900[_0x53e2(0xc)](isKeychainAvailable))return _0x53e2(0xd)!==_0x53e2(0xd)?(_0x4ebdc9['error'](_0x426900['defDI'],_0x33b159),![]):await Keychain[_0x53e2(0xe)](_0x3a4024);else{const _0x432b21=(_0x426900['prsYc'](_0x3a4024,null)||_0x426900[_0x53e2(0xf)](_0x3a4024,void 0x0)?void 0x0:_0x3a4024[_0x53e2(0x10)])||_0x426900[_0x53e2(0x11)];return mockCredentialStorage[_0x432b21]||null;}}else{const _0x59c835=(_0x426900[_0x53e2(0x12)](_0x1ca92e,null)||_0x426900['vLCkN'](_0x2e9d36,void 0x0)?void 0x0:_0x33668e[_0x53e2(0x10)])||_0x426900[_0x53e2(0x11)];return _0x283000[_0x59c835]={'username':_0x1121b5,'password':_0x8c340e},!![];}}catch(_0x586229){console[_0x53e2(0x3)](_0x426900[_0x53e2(0x13)],_0x586229);const _0x5d3736=(_0x426900[_0x53e2(0x14)](_0x3a4024,null)||_0x426900['vcegw'](_0x3a4024,void 0x0)?void 0x0:_0x3a4024[_0x53e2(0x10)])||_0x426900[_0x53e2(0x11)];return mockCredentialStorage[_0x5d3736]||null;}},safeSetGenericPassword=async(_0x35e915,_0x5a9727,_0xe8899f)=>{const _0x4efbac={'XqcpN':function(_0x4191bf){return _0x4191bf();},'LEukI':function(_0x412d51,_0x3411cb){return _0x412d51===_0x3411cb;},'lIWzz':_0x53e2(0x15),'FVvIE':_0x53e2(0x16),'iuuGm':function(_0x5f45b3,_0x292901){return _0x5f45b3===_0x292901;},'pXyEG':_0x53e2(0x9),'DQDtm':'Keychain\x20access\x20failed,\x20using\x20mock\x20storage','GqCJu':function(_0x1cbb80,_0x55436a){return _0x1cbb80===_0x55436a;}};try{if(_0x4efbac[_0x53e2(0x17)](isKeychainAvailable))return _0x4efbac['LEukI'](_0x4efbac['lIWzz'],_0x4efbac[_0x53e2(0x18)])?![]:await Keychain[_0x53e2(0x19)](_0x35e915,_0x5a9727,_0xe8899f);else{const _0x102939=(_0x4efbac[_0x53e2(0x1a)](_0xe8899f,null)||_0x4efbac[_0x53e2(0x1b)](_0xe8899f,void 0x0)?void 0x0:_0xe8899f[_0x53e2(0x10)])||_0x4efbac[_0x53e2(0x1c)];return mockCredentialStorage[_0x102939]={'username':_0x35e915,'password':_0x5a9727},!![];}}catch(_0x2c2bea){console[_0x53e2(0x3)](_0x4efbac[_0x53e2(0x1d)],_0x2c2bea);const _0x226196=(_0x4efbac[_0x53e2(0x1e)](_0xe8899f,null)||_0x4efbac[_0x53e2(0x1e)](_0xe8899f,void 0x0)?void 0x0:_0xe8899f['service'])||_0x4efbac[_0x53e2(0x1c)];return mockCredentialStorage[_0x226196]={'username':_0x35e915,'password':_0x5a9727},!![];}},safeResetGenericPassword=async _0x41a21b=>{const _0x1dbe8d={'rCnRB':function(_0x50e42b,_0x50f730){return _0x50e42b===_0x50f730;},'qklCR':'qRaih','fJQnw':function(_0x59727f){return _0x59727f();},'bzcYn':function(_0x1d8147,_0xf3d2d7){return _0x1d8147===_0xf3d2d7;},'LIbCC':_0x53e2(0x9),'oMTtR':_0x53e2(0x1f),'MZXoS':function(_0xfacda3,_0x5d864b){return _0xfacda3===_0x5d864b;}};try{if(_0x1dbe8d['qklCR']===_0x1dbe8d['qklCR']){if(_0x1dbe8d[_0x53e2(0x20)](isKeychainAvailable))return await Keychain['resetGenericPassword'](_0x41a21b);else{const _0x145140=(_0x1dbe8d[_0x53e2(0x21)](_0x41a21b,null)||_0x1dbe8d[_0x53e2(0x22)](_0x41a21b,void 0x0)?void 0x0:_0x41a21b['service'])||_0x1dbe8d[_0x53e2(0x23)];return delete mockCredentialStorage[_0x145140],!![];}}else{var _0x24f5c7,_0x4b82ba;_0x313494[_0x53e2(0x24)]=_0x1dbe8d[_0x53e2(0x21)](_0x24f5c7=Keychain['ACCESS_CONTROL'],null)||_0x1dbe8d[_0x53e2(0x21)](_0x24f5c7,void 0x0)?void 0x0:_0x24f5c7[_0x53e2(0x25)],_0x4fbe14[_0x53e2(0x26)]=(_0x4b82ba=Keychain['ACCESSIBLE'])===null||_0x1dbe8d[_0x53e2(0x21)](_0x4b82ba,void 0x0)?void 0x0:_0x4b82ba['WHEN_UNLOCKED'];}}catch(_0x42a52c){console[_0x53e2(0x3)](_0x1dbe8d[_0x53e2(0x27)],_0x42a52c);const _0x15fcaa=(_0x41a21b===null||_0x1dbe8d[_0x53e2(0x28)](_0x41a21b,void 0x0)?void 0x0:_0x41a21b[_0x53e2(0x10)])||_0x1dbe8d[_0x53e2(0x23)];return delete mockCredentialStorage[_0x15fcaa],!![];}},useCredentials=()=>{const _0x4d33eb={'XTPPj':_0x53e2(0x29),'mhUnq':function(_0x1e6362,_0x2027a9){return _0x1e6362(_0x2027a9);},'qBZpT':'Error\x20checking\x20credentials:','NgTsA':function(_0x4f1d72,_0x139311){return _0x4f1d72(_0x139311);},'YFdGu':function(_0x30cff6,_0x128f3f){return _0x30cff6===_0x128f3f;},'IontZ':_0x53e2(0x2a),'kWJMW':_0x53e2(0x2b),'aOxUW':function(_0x39da1){return _0x39da1();},'iEnXC':function(_0x3d7b63,_0x4556e7){return _0x3d7b63===_0x4556e7;},'jGdqB':function(_0x2e3462,_0x55c55c){return _0x2e3462===_0x55c55c;},'uueNY':function(_0x387f51,_0x4b8d27,_0x2f9c81,_0x4a1cd7){return _0x387f51(_0x4b8d27,_0x2f9c81,_0x4a1cd7);},'XuYuz':'Error\x20storing\x20credentials:','xPfuI':_0x53e2(0x2c),'ERANC':_0x53e2(0x2d),'qjPIl':function(_0xc5680a,_0x53ccb1){return _0xc5680a===_0x53ccb1;},'ughME':_0x53e2(0x9),'UkShx':function(_0x903a7f,_0x2b2253){return _0x903a7f===_0x2b2253;},'bDees':function(_0x10b132,_0x2b8d5a,_0x29226e){return _0x10b132(_0x2b8d5a,_0x29226e);},'DifcW':_0x53e2(0x2e),'btyad':_0x53e2(0x2f),'eQjHN':_0x53e2(0x30)},_0x492806=(0x0,_react[_0x53e2(0x31)])(async()=>{try{if(_0x4d33eb[_0x53e2(0x32)]!==_0x53e2(0x33)){const _0x13c7a2=await _0x4d33eb['mhUnq'](safeGetGenericPassword,{'service':_constants['STORAGE_KEYS'][_0x53e2(0x34)]});return!!_0x13c7a2;}else return _0x14753f[_0x53e2(0x35)]('Error\x20checking\x20credentials:',_0x590be1),![];}catch(_0xde1afd){return console[_0x53e2(0x35)](_0x4d33eb[_0x53e2(0x36)],_0xde1afd),![];}},[]),_0x4e2c1c=(0x0,_react[_0x53e2(0x31)])(async()=>{const _0x265628={'dIQSH':_0x53e2(0x30)};try{if(_0x4d33eb[_0x53e2(0x37)](_0x4d33eb[_0x53e2(0x38)],_0x53e2(0x2a))){const _0x1b0a0e=await _0x4d33eb[_0x53e2(0x39)](safeGetGenericPassword,{'service':_constants[_0x53e2(0x3a)][_0x53e2(0x34)]});if(_0x1b0a0e)return _0x4d33eb[_0x53e2(0x37)](_0x4d33eb[_0x53e2(0x3b)],_0x4d33eb[_0x53e2(0x3b)])?JSON[_0x53e2(0x3c)](_0x1b0a0e[_0x53e2(0x3d)]):(_0x16fa87[_0x53e2(0x35)](_0x265628['dIQSH'],_0x21039a),{'success':![],'isValid':![]});return null;}else Keychain=_0x4d33eb[_0x53e2(0x3e)](_0x1473b3,0x3);}catch(_0x46a955){return console[_0x53e2(0x35)](_0x53e2(0x3f),_0x46a955),null;}},[]),_0x508b1a=(0x0,_react[_0x53e2(0x31)])(async(_0x52481e,_0x24b7e8,_0x41597d)=>{try{const _0x455399={'service':_constants['STORAGE_KEYS'][_0x53e2(0x34)]};if(_0x4d33eb[_0x53e2(0x40)](isKeychainAvailable)){var _0x349174,_0xc0c003;_0x455399[_0x53e2(0x24)]=_0x4d33eb[_0x53e2(0x37)](_0x349174=Keychain['ACCESS_CONTROL'],null)||_0x4d33eb['YFdGu'](_0x349174,void 0x0)?void 0x0:_0x349174[_0x53e2(0x25)],_0x455399[_0x53e2(0x26)]=_0x4d33eb[_0x53e2(0x41)](_0xc0c003=Keychain['ACCESSIBLE'],null)||_0x4d33eb[_0x53e2(0x42)](_0xc0c003,void 0x0)?void 0x0:_0xc0c003['WHEN_UNLOCKED'];}return await _0x4d33eb[_0x53e2(0x43)](safeSetGenericPassword,_0x52481e,JSON[_0x53e2(0x44)]({'userPin':_0x24b7e8,'accessToken':_0x41597d}),_0x455399),!![];}catch(_0x1d07e5){return console[_0x53e2(0x35)](_0x4d33eb[_0x53e2(0x45)],_0x1d07e5),![];}},[]),_0x5a512f=(0x0,_react['useCallback'])(async()=>{try{await _0x4d33eb[_0x53e2(0x39)](safeResetGenericPassword,{'service':_constants['STORAGE_KEYS'][_0x53e2(0x34)]});}catch(_0xe90d1b){_0x4d33eb[_0x53e2(0x46)]!==_0x4d33eb[_0x53e2(0x46)]?_0x7f4102['warn']('react-native-keychain module not available in useCredentials, using mock storage'):console['error'](_0x4d33eb['ERANC'],_0xe90d1b);}},[]),_0x2120e6=(0x0,_react[_0x53e2(0x31)])(async _0x532fd4=>{const _0x1204a1={'YVMek':function(_0x55d704,_0x39a8f3){return _0x4d33eb['qjPIl'](_0x55d704,_0x39a8f3);},'CpKiy':_0x4d33eb['ughME']};try{if(_0x4d33eb[_0x53e2(0x47)](_0x53e2(0x48),_0x53e2(0x48))){const _0x31aab2=await _0x4d33eb[_0x53e2(0x49)](fetch,_api[_0x53e2(0x4a)][_0x53e2(0x4b)]+_0x53e2(0x4c),{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify']({'username':_0x532fd4})}),_0x597a39=await _0x31aab2[_0x53e2(0x4d)]();return{'success':!![],'isValid':_0x597a39[_0x53e2(0x4e)],'credentials':_0x597a39['credentials']};}else try{return Keychain&&typeof Keychain[_0x53e2(0xe)]===_0x53e2(0x4);}catch(_0x40e170){return![];}}catch(_0x444980){if(_0x4d33eb[_0x53e2(0x4f)]!==_0x4d33eb[_0x53e2(0x50)])return console[_0x53e2(0x35)](_0x4d33eb[_0x53e2(0x51)],_0x444980),{'success':![],'isValid':![]};else{const _0x5cbc60=(_0x1204a1[_0x53e2(0x52)](_0x3dbb05,null)||_0x3b8d12===void 0x0?void 0x0:_0x1e092a[_0x53e2(0x10)])||_0x1204a1[_0x53e2(0x53)];return _0x2ef49c[_0x5cbc60]||null;}}},[]);return{'hasCredentials':_0x492806,'getCredentials':_0x4e2c1c,'storeCredentials':_0x508b1a,'clearCredentials':_0x5a512f,'validateCredentials':_0x2120e6};};exports['useCredentials']=useCredentials;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useCredentials = void 0;
7
+ var _react = require("react");
8
+ var _constants = require("../constants");
9
+ var _api = require("../config/api");
10
+ // Create a mock storage for environments without Keychain access
11
+ const mockCredentialStorage = {};
12
+
13
+ // Try to import Keychain, but provide fallbacks if not available
14
+ let Keychain = null;
15
+ try {
16
+ Keychain = require('react-native-keychain');
17
+ } catch (error) {
18
+ console.warn('react-native-keychain module not available in useCredentials, using mock storage');
19
+ }
20
+
21
+ // Check if Keychain is properly initialized and available
22
+ const isKeychainAvailable = () => {
23
+ try {
24
+ return Keychain && typeof Keychain.getGenericPassword === 'function';
25
+ } catch (e) {
26
+ return false;
27
+ }
28
+ };
29
+
30
+ // Safe wrapper for getGenericPassword
31
+ const safeGetGenericPassword = async options => {
32
+ try {
33
+ if (isKeychainAvailable()) {
34
+ return await Keychain.getGenericPassword(options);
35
+ } else {
36
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
37
+ return mockCredentialStorage[key] || null;
38
+ }
39
+ } catch (error) {
40
+ console.warn('Keychain access failed, using mock storage', error);
41
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
42
+ return mockCredentialStorage[key] || null;
43
+ }
44
+ };
45
+
46
+ // Safe wrapper for setGenericPassword
47
+ const safeSetGenericPassword = async (username, password, options) => {
48
+ try {
49
+ if (isKeychainAvailable()) {
50
+ return await Keychain.setGenericPassword(username, password, options);
51
+ } else {
52
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
53
+ mockCredentialStorage[key] = {
54
+ username,
55
+ password
56
+ };
57
+ return true;
58
+ }
59
+ } catch (error) {
60
+ console.warn('Keychain access failed, using mock storage', error);
61
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
62
+ mockCredentialStorage[key] = {
63
+ username,
64
+ password
65
+ };
66
+ return true;
67
+ }
68
+ };
69
+
70
+ // Safe wrapper for resetGenericPassword
71
+ const safeResetGenericPassword = async options => {
72
+ try {
73
+ if (isKeychainAvailable()) {
74
+ return await Keychain.resetGenericPassword(options);
75
+ } else {
76
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
77
+ delete mockCredentialStorage[key];
78
+ return true;
79
+ }
80
+ } catch (error) {
81
+ console.warn('Keychain access failed, using mock storage', error);
82
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
83
+ delete mockCredentialStorage[key];
84
+ return true;
85
+ }
86
+ };
87
+ const useCredentials = () => {
88
+ const hasCredentials = (0, _react.useCallback)(async () => {
89
+ try {
90
+ const credentials = await safeGetGenericPassword({
91
+ service: _constants.STORAGE_KEYS.credentials
92
+ });
93
+ return !!credentials;
94
+ } catch (error) {
95
+ console.error('Error checking credentials:', error);
96
+ return false;
97
+ }
98
+ }, []);
99
+ const getCredentials = (0, _react.useCallback)(async () => {
100
+ try {
101
+ const credentials = await safeGetGenericPassword({
102
+ service: _constants.STORAGE_KEYS.credentials
103
+ });
104
+ if (credentials) {
105
+ return JSON.parse(credentials.password);
106
+ }
107
+ return null;
108
+ } catch (error) {
109
+ console.error('Error getting credentials:', error);
110
+ return null;
111
+ }
112
+ }, []);
113
+ const storeCredentials = (0, _react.useCallback)(async (username, userPin, accessToken) => {
114
+ try {
115
+ const options = {
116
+ service: _constants.STORAGE_KEYS.credentials
117
+ };
118
+
119
+ // Only use secure storage options on real devices
120
+ if (isKeychainAvailable()) {
121
+ var _Keychain$ACCESS_CONT, _Keychain$ACCESSIBLE;
122
+ options.accessControl = (_Keychain$ACCESS_CONT = Keychain.ACCESS_CONTROL) === null || _Keychain$ACCESS_CONT === void 0 ? void 0 : _Keychain$ACCESS_CONT.BIOMETRY_ANY;
123
+ options.accessible = (_Keychain$ACCESSIBLE = Keychain.ACCESSIBLE) === null || _Keychain$ACCESSIBLE === void 0 ? void 0 : _Keychain$ACCESSIBLE.WHEN_UNLOCKED;
124
+ }
125
+ await safeSetGenericPassword(username, JSON.stringify({
126
+ userPin,
127
+ accessToken
128
+ }), options);
129
+ return true;
130
+ } catch (error) {
131
+ console.error('Error storing credentials:', error);
132
+ return false;
133
+ }
134
+ }, []);
135
+ const clearCredentials = (0, _react.useCallback)(async () => {
136
+ try {
137
+ await safeResetGenericPassword({
138
+ service: _constants.STORAGE_KEYS.credentials
139
+ });
140
+ } catch (error) {
141
+ console.error('Error clearing credentials:', error);
142
+ }
143
+ }, []);
144
+ const validateCredentials = (0, _react.useCallback)(async username => {
145
+ try {
146
+ const response = await fetch(`${_api.API_CONFIG.BASE_URL}/validate`, {
147
+ method: 'POST',
148
+ headers: {
149
+ 'Content-Type': 'application/json'
150
+ },
151
+ body: JSON.stringify({
152
+ username
153
+ })
154
+ });
155
+ const data = await response.json();
156
+ return {
157
+ success: true,
158
+ isValid: data.valid,
159
+ credentials: data.credentials
160
+ };
161
+ } catch (error) {
162
+ console.error('Error validating credentials:', error);
163
+ return {
164
+ success: false,
165
+ isValid: false
166
+ };
167
+ }
168
+ }, []);
169
+ return {
170
+ hasCredentials,
171
+ getCredentials,
172
+ storeCredentials,
173
+ clearCredentials,
174
+ validateCredentials
175
+ };
176
+ };
177
+ exports.useCredentials = useCredentials;
178
+ //# sourceMappingURL=useCredentials.js.map
@@ -1,10 +1,148 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("react"),
5
- require("../services/userConnectionsService"),
6
- require("../services/authService"),
7
- require("@react-native-async-storage/async-storage")
8
- ];
9
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
10
- function _0x51ca(){const _0x23acf0=['defineProperty','__esModule','useUserConnections','reviewer-bypass-token','UPGmL','4|3|0|2|1','Authentication\x20required\x20for\x20connections','⚠️\x20[CONNECTIONS\x20HOOK]\x20Skipping\x20API\x20call\x20to\x20prevent\x20unauthenticated\x20requests','⚠️\x20[CONNECTIONS\x20HOOK]\x20No\x20authentication\x20token\x20available\x20for\x20connections\x20refresh','🎯\x20[DEMO\x20MODE]\x20Reviewer\x20bypass\x20detected\x20-\x20skipping\x20API\x20call\x20for\x20demo','❌\x20[CONNECTIONS\x20HOOK]\x20Unexpected\x20null\x20token\x20after\x20validation','Authentication\x20error','🔑\x20[CONNECTIONS\x20HOOK]\x20Using\x20auth\x20token:','✅\x20Connections\x20loaded:','🔄\x20[CONNECTIONS\x20HOOK]\x20Refreshing\x20connections...','✅\x20[CONNECTIONS\x20HOOK]\x20Connections\x20refresh\x20completed','❌\x20Error\x20loading\x20connections:','fUTLo','❌\x20Error\x20fetching\x20connections\x20by\x20username:','⚠️\x20[CONNECTIONS\x20HOOK]\x20No\x20authentication\x20token\x20available\x20for\x20username\x20connections','ILaNf','kJBYl','⚠️\x20[CONNECTIONS\x20HOOK]\x20No\x20authentication\x20token\x20available\x20for\x20user\x20ID\x20connections','🔍\x20Fetching\x20connections\x20by\x20userId:','useState','useCallback','SgfZW','getItem','cQyZM','ukxlU','SChTh','yUdOR','❌\x20Error\x20fetching\x20connections\x20by\x20userId:','nSXzy','split','lICPv','JEggZ','warn','jccla','TCLrb','log','FwgnE','error','gblxj','xASnL','oAjrU','🔄\x20Loading\x20user\x20connections\x20with\x20authentication...','Orqzi','substring','vfTAF','length','kZobd','message','mrlGD','MQpHa','WseAv','RaszT','Failed\x20to\x20load\x20connections','UxIys','ZniRK','yzmOy','mHWeI','PdtFv','UXXfy','AbbRX','🔍\x20Fetching\x20connections\x20by\x20username:','getUserConnectionsByUsername','YODtX','McIuI','3|4|0|2|1','wCzSl','CjpaU','getAuthToken','VeXqQ','yCcwZ','Vvgxj','zliWQ','eBZGa','CySwS','...','jpg','📷\x20Uploading\x20profile\x20picture\x20for\x20user:','success','❌\x20Error\x20uploading\x20profile\x20picture:','useEffect'];_0x51ca=function(){return _0x23acf0;};return _0x51ca();}Object[_0xf64e(0x0)](exports,_0xf64e(0x1),{'value':!![]}),exports[_0xf64e(0x2)]=void 0x0;var _react=__ONAIROS_REQ_FUNC__(0x0),_userConnectionsService=__ONAIROS_REQ_FUNC__(0x1),_authService=__ONAIROS_REQ_FUNC__(0x2),_asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x3));function _interopRequireDefault(_0x297f0a){return _0x297f0a&&_0x297f0a[_0xf64e(0x1)]?_0x297f0a:{'default':_0x297f0a};}const useUserConnections=()=>{const _0x5bdc83={'MQpHa':function(_0x588ece,_0x34f845){return _0x588ece(_0x34f845);},'SgfZW':function(_0x12a757,_0x178f06){return _0x12a757(_0x178f06);},'ZxfOY':'onairos_jwt_token','cQyZM':function(_0x293303,_0x2cc1ed){return _0x293303===_0x2cc1ed;},'ukxlU':_0xf64e(0x3),'SChTh':function(_0x178281,_0x35be5f){return _0x178281!==_0x35be5f;},'yUdOR':_0xf64e(0x4),'nSXzy':_0xf64e(0x5),'lICPv':function(_0x451edf,_0x2d4de6){return _0x451edf(_0x2d4de6);},'JEggZ':function(_0x1dc53d,_0x3cb3fe){return _0x1dc53d(_0x3cb3fe);},'JplNh':_0xf64e(0x6),'jccla':_0xf64e(0x7),'TCLrb':_0xf64e(0x8),'FwgnE':_0xf64e(0x9),'gblxj':_0xf64e(0xa),'xASnL':function(_0xdad6ac,_0x386453){return _0xdad6ac(_0x386453);},'oAjrU':_0xf64e(0xb),'Orqzi':_0xf64e(0xc),'vfTAF':_0xf64e(0xd),'kZobd':function(_0x1ec98b,_0x2a1af4){return _0x1ec98b instanceof _0x2a1af4;},'mrlGD':function(_0x265264,_0x3a3e81){return _0x265264(_0x3a3e81);},'oxppX':_0xf64e(0xe),'WseAv':function(_0x1f7350){return _0x1f7350();},'RaszT':_0xf64e(0xf),'UxIys':_0xf64e(0x10),'gHyMH':function(_0x53f382,_0x3eac80){return _0x53f382!==_0x3eac80;},'ZniRK':'krapA','yzmOy':function(_0x16c6b4,_0x21cc32){return _0x16c6b4!==_0x21cc32;},'mHWeI':_0xf64e(0x11),'YODtX':_0xf64e(0x12),'McIuI':_0xf64e(0x13),'wCzSl':_0xf64e(0x14),'dbbpr':'JvKAE','VeXqQ':_0xf64e(0x15),'cHniS':_0xf64e(0x16),'CySwS':_0xf64e(0x17)},[_0x376602,_0x1c94c5]=(0x0,_react[_0xf64e(0x18)])([]),[_0x5d86fa,_0x47982e]=(0x0,_react[_0xf64e(0x18)])(!![]),[_0x577662,_0x216f81]=(0x0,_react[_0xf64e(0x18)])(null),_0x40bb9a=(0x0,_react[_0xf64e(0x19)])(async()=>{try{_0x5bdc83['MQpHa'](_0x47982e,!![]),_0x5bdc83[_0xf64e(0x1a)](_0x216f81,null);const _0x38707d=await(0x0,_authService['getAuthToken'])(),_0x20f19a=await _asyncStorage['default'][_0xf64e(0x1b)](_0x5bdc83['ZxfOY']),_0x5d6c12=_0x5bdc83[_0xf64e(0x1c)](_0x20f19a,_0x5bdc83[_0xf64e(0x1d)]);if(!_0x38707d&&!_0x5d6c12){if(_0x5bdc83[_0xf64e(0x1e)](_0x5bdc83[_0xf64e(0x1f)],'UPGmL'))return _0x1da421['error'](_0xf64e(0x20),_0x1fb107),[];else{const _0x3aafb2=_0x5bdc83[_0xf64e(0x21)][_0xf64e(0x22)]('|');let _0xdb34da=0x0;while(!![]){switch(_0x3aafb2[_0xdb34da++]){case'0':_0x5bdc83[_0xf64e(0x23)](_0x1c94c5,[]);continue;case'1':return;case'2':_0x5bdc83[_0xf64e(0x24)](_0x216f81,_0x5bdc83['JplNh']);continue;case'3':console[_0xf64e(0x25)](_0x5bdc83[_0xf64e(0x26)]);continue;case'4':console[_0xf64e(0x25)](_0x5bdc83[_0xf64e(0x27)]);continue;}break;}}}if(_0x5d6c12){console[_0xf64e(0x28)](_0x5bdc83[_0xf64e(0x29)]),_0x5bdc83[_0xf64e(0x24)](_0x1c94c5,[]),_0x5bdc83['lICPv'](_0x216f81,null);return;}if(!_0x38707d){console[_0xf64e(0x2a)](_0x5bdc83[_0xf64e(0x2b)]),_0x5bdc83[_0xf64e(0x2c)](_0x1c94c5,[]),_0x5bdc83[_0xf64e(0x23)](_0x216f81,_0x5bdc83[_0xf64e(0x2d)]);return;}console['log'](_0xf64e(0x2e)),console[_0xf64e(0x28)](_0x5bdc83[_0xf64e(0x2f)],_0x38707d[_0xf64e(0x30)](0x0,0x14)+'...');const _0x2e970a=await(0x0,_userConnectionsService['getUserConnections'])();_0x5bdc83[_0xf64e(0x1a)](_0x1c94c5,_0x2e970a),console[_0xf64e(0x28)](_0x5bdc83[_0xf64e(0x31)],_0x2e970a[_0xf64e(0x32)]);}catch(_0x3aa3f2){const _0x29004d=_0x5bdc83[_0xf64e(0x33)](_0x3aa3f2,Error)?_0x3aa3f2[_0xf64e(0x34)]:'Failed\x20to\x20load\x20connections';console[_0xf64e(0x2a)](_0xf64e(0x10),_0x29004d),_0x5bdc83[_0xf64e(0x35)](_0x216f81,_0x29004d),_0x5bdc83[_0xf64e(0x36)](_0x1c94c5,[]);}finally{_0x47982e(![]);}},[]),_0x32fe75=(0x0,_react[_0xf64e(0x19)])(async()=>{console[_0xf64e(0x28)](_0x5bdc83['oxppX']),await _0x5bdc83[_0xf64e(0x37)](_0x40bb9a),console['log'](_0x5bdc83[_0xf64e(0x38)]);},[_0x40bb9a]),_0x3d669b=(0x0,_react['useCallback'])(async _0xef0ead=>{const _0x3a48b7={'PdtFv':_0xf64e(0x39),'UXXfy':_0x5bdc83[_0xf64e(0x3a)],'AbbRX':function(_0x234851,_0x763898){return _0x5bdc83[_0xf64e(0x2c)](_0x234851,_0x763898);}};try{if(_0x5bdc83['gHyMH'](_0x5bdc83[_0xf64e(0x3b)],_0x5bdc83[_0xf64e(0x3b)]))return _0x14fc39&&_0xa585f[_0xf64e(0x1)]?_0xf7da34:{'default':_0x24dcf6};else{const _0x52499f=await(0x0,_authService['getAuthToken'])();if(!_0x52499f){if(_0x5bdc83[_0xf64e(0x3c)](_0x5bdc83[_0xf64e(0x3d)],_0x5bdc83[_0xf64e(0x3d)])){const _0x2fa958=_0x50ffcc instanceof _0x575b7c?_0x588ac1['message']:_0x3a48b7[_0xf64e(0x3e)];_0x34ba4c[_0xf64e(0x2a)](_0x3a48b7[_0xf64e(0x3f)],_0x2fa958),_0x3a48b7['AbbRX'](_0x3cea61,_0x2fa958),_0x3a48b7[_0xf64e(0x40)](_0xa7569b,[]);}else return console[_0xf64e(0x25)]('⚠️\x20[CONNECTIONS\x20HOOK]\x20No\x20authentication\x20token\x20available\x20for\x20username\x20connections'),[];}return console[_0xf64e(0x28)](_0xf64e(0x41),_0xef0ead),console['log'](_0x5bdc83[_0xf64e(0x2f)],_0x52499f[_0xf64e(0x30)](0x0,0x14)+'...'),await(0x0,_userConnectionsService[_0xf64e(0x42)])(_0xef0ead);}}catch(_0x35ce54){return console[_0xf64e(0x2a)](_0x5bdc83[_0xf64e(0x43)],_0x35ce54),[];}},[]),_0x19678c=(0x0,_react[_0xf64e(0x19)])(async _0x4afbc3=>{const _0x5eb889={'CjpaU':_0x5bdc83[_0xf64e(0x44)],'LvQkt':_0xf64e(0x45),'yCcwZ':function(_0xb9cc7f,_0x156fbf){return _0xb9cc7f(_0x156fbf);},'Vvgxj':_0xf64e(0x6),'zliWQ':_0x5bdc83[_0xf64e(0x27)],'eBZGa':_0x5bdc83[_0xf64e(0x26)]};if(_0x5bdc83[_0xf64e(0x46)]===_0x5bdc83['dbbpr'])return _0x2f1692[_0xf64e(0x25)](_0x5eb889[_0xf64e(0x47)]),[];else try{const _0x477996=await(0x0,_authService[_0xf64e(0x48)])();if(!_0x477996){if(_0x5bdc83['yzmOy'](_0xf64e(0x15),_0x5bdc83[_0xf64e(0x49)])){const _0x4074f5=_0x5eb889['LvQkt'][_0xf64e(0x22)]('|');let _0x54573c=0x0;while(!![]){switch(_0x4074f5[_0x54573c++]){case'0':_0x5eb889[_0xf64e(0x4a)](_0x5c5304,[]);continue;case'1':return;case'2':_0x5eb889[_0xf64e(0x4a)](_0x255bce,_0x5eb889[_0xf64e(0x4b)]);continue;case'3':_0x386a02['warn'](_0x5eb889[_0xf64e(0x4c)]);continue;case'4':_0x2fac9e[_0xf64e(0x25)](_0x5eb889[_0xf64e(0x4d)]);continue;}break;}}else return console[_0xf64e(0x25)](_0x5bdc83['cHniS']),[];}return console['log'](_0x5bdc83[_0xf64e(0x4e)],_0x4afbc3),console[_0xf64e(0x28)](_0x5bdc83[_0xf64e(0x2f)],_0x477996[_0xf64e(0x30)](0x0,0x14)+_0xf64e(0x4f)),await(0x0,_userConnectionsService['getUserConnectionsByUserId'])(_0x4afbc3);}catch(_0x16c628){return console[_0xf64e(0x2a)](_0xf64e(0x20),_0x16c628),[];}},[]),_0x3c83f1=(0x0,_react[_0xf64e(0x19)])(async(_0x5f2347,_0x3582e5=_0xf64e(0x50))=>{try{console[_0xf64e(0x28)](_0xf64e(0x51));const _0x572740=await(0x0,_userConnectionsService['uploadProfilePicture'])(_0x5f2347,_0x3582e5);return _0x572740[_0xf64e(0x52)];}catch(_0x484fa1){return console[_0xf64e(0x2a)](_0xf64e(0x53),_0x484fa1),![];}},[]);return(0x0,_react[_0xf64e(0x54)])(()=>{_0x5bdc83[_0xf64e(0x37)](_0x40bb9a);},[_0x40bb9a]),{'connections':_0x376602,'isLoading':_0x5d86fa,'error':_0x577662,'refreshConnections':_0x32fe75,'getConnectionsByUsername':_0x3d669b,'getConnectionsByUserId':_0x19678c,'uploadUserProfilePicture':_0x3c83f1};};function _0xf64e(_0x51cab9,_0xf64ed4){_0x51cab9=_0x51cab9-0x0;const _0x21712c=_0x51ca();let _0x1f7c0d=_0x21712c[_0x51cab9];return _0x1f7c0d;}exports[_0xf64e(0x2)]=useUserConnections;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useUserConnections = void 0;
7
+ var _react = require("react");
8
+ var _userConnectionsService = require("../services/userConnectionsService");
9
+ var _authService = require("../services/authService");
10
+ var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ const useUserConnections = () => {
13
+ const [connections, setConnections] = (0, _react.useState)([]);
14
+ const [isLoading, setIsLoading] = (0, _react.useState)(true);
15
+ const [error, setError] = (0, _react.useState)(null);
16
+
17
+ /**
18
+ * Load connections from API with authentication validation
19
+ */
20
+ const loadConnections = (0, _react.useCallback)(async () => {
21
+ try {
22
+ setIsLoading(true);
23
+ setError(null);
24
+
25
+ // ✅ CRITICAL: Validate authentication before making API calls
26
+ const authToken = await (0, _authService.getAuthToken)();
27
+
28
+ // Check for demo mode (reviewer bypass)
29
+ const reviewerToken = await _asyncStorage.default.getItem('onairos_jwt_token');
30
+ const isDemoMode = reviewerToken === 'reviewer-bypass-token';
31
+ if (!authToken && !isDemoMode) {
32
+ console.warn('⚠️ [CONNECTIONS HOOK] No authentication token available for connections refresh');
33
+ console.warn('⚠️ [CONNECTIONS HOOK] Skipping API call to prevent unauthenticated requests');
34
+ setConnections([]);
35
+ setError('Authentication required for connections');
36
+ return;
37
+ }
38
+ if (isDemoMode) {
39
+ console.log('🎯 [DEMO MODE] Reviewer bypass detected - skipping API call for demo');
40
+ // For demo mode, return empty connections - ResultsScreen will use fallback data
41
+ setConnections([]);
42
+ setError(null);
43
+ return;
44
+ }
45
+
46
+ // At this point, authToken must be valid (not null) because we've checked both cases above
47
+ if (!authToken) {
48
+ console.error('❌ [CONNECTIONS HOOK] Unexpected null token after validation');
49
+ setConnections([]);
50
+ setError('Authentication error');
51
+ return;
52
+ }
53
+ console.log('🔄 Loading user connections with authentication...');
54
+ console.log('🔑 [CONNECTIONS HOOK] Using auth token:', `${authToken.substring(0, 20)}...`);
55
+ const fetchedConnections = await (0, _userConnectionsService.getUserConnections)();
56
+ setConnections(fetchedConnections);
57
+ console.log('✅ Connections loaded:', fetchedConnections.length);
58
+ } catch (err) {
59
+ const errorMessage = err instanceof Error ? err.message : 'Failed to load connections';
60
+ console.error('❌ Error loading connections:', errorMessage);
61
+ setError(errorMessage);
62
+
63
+ // Set empty array on error - screens will handle their own fallbacks
64
+ setConnections([]);
65
+ } finally {
66
+ setIsLoading(false);
67
+ }
68
+ }, []);
69
+
70
+ /**
71
+ * Refresh connections with authentication validation
72
+ */
73
+ const refreshConnections = (0, _react.useCallback)(async () => {
74
+ console.log('🔄 [CONNECTIONS HOOK] Refreshing connections...');
75
+ await loadConnections();
76
+ console.log('✅ [CONNECTIONS HOOK] Connections refresh completed');
77
+ }, [loadConnections]);
78
+
79
+ /**
80
+ * Get connections by username with authentication validation
81
+ */
82
+ const getConnectionsByUsername = (0, _react.useCallback)(async username => {
83
+ try {
84
+ // ✅ Validate authentication before making API calls
85
+ const authToken = await (0, _authService.getAuthToken)();
86
+ if (!authToken) {
87
+ console.warn('⚠️ [CONNECTIONS HOOK] No authentication token available for username connections');
88
+ return [];
89
+ }
90
+ console.log('🔍 Fetching connections by username:', username);
91
+ console.log('🔑 [CONNECTIONS HOOK] Using auth token:', `${authToken.substring(0, 20)}...`);
92
+ return await (0, _userConnectionsService.getUserConnectionsByUsername)(username);
93
+ } catch (error) {
94
+ console.error('❌ Error fetching connections by username:', error);
95
+ return [];
96
+ }
97
+ }, []);
98
+
99
+ /**
100
+ * Get connections by user ID with authentication validation
101
+ */
102
+ const getConnectionsByUserId = (0, _react.useCallback)(async userId => {
103
+ try {
104
+ // ✅ Validate authentication before making API calls
105
+ const authToken = await (0, _authService.getAuthToken)();
106
+ if (!authToken) {
107
+ console.warn('⚠️ [CONNECTIONS HOOK] No authentication token available for user ID connections');
108
+ return [];
109
+ }
110
+ console.log('🔍 Fetching connections by userId:', userId);
111
+ console.log('🔑 [CONNECTIONS HOOK] Using auth token:', `${authToken.substring(0, 20)}...`);
112
+ return await (0, _userConnectionsService.getUserConnectionsByUserId)(userId);
113
+ } catch (error) {
114
+ console.error('❌ Error fetching connections by userId:', error);
115
+ return [];
116
+ }
117
+ }, []);
118
+
119
+ /**
120
+ * Upload profile picture
121
+ */
122
+ const uploadUserProfilePicture = (0, _react.useCallback)(async (imageData, fileType = 'jpg') => {
123
+ try {
124
+ console.log('📷 Uploading profile picture for user:');
125
+ const result = await (0, _userConnectionsService.uploadProfilePicture)(imageData, fileType);
126
+ return result.success;
127
+ } catch (error) {
128
+ console.error('❌ Error uploading profile picture:', error);
129
+ return false;
130
+ }
131
+ }, []);
132
+
133
+ // Load connections on mount
134
+ (0, _react.useEffect)(() => {
135
+ loadConnections();
136
+ }, [loadConnections]);
137
+ return {
138
+ connections,
139
+ isLoading,
140
+ error,
141
+ refreshConnections,
142
+ getConnectionsByUsername,
143
+ getConnectionsByUserId,
144
+ uploadUserProfilePicture
145
+ };
146
+ };
147
+ exports.useUserConnections = useUserConnections;
148
+ //# sourceMappingURL=useUserConnections.js.map