@onairos/react-native 3.7.2 → 3.7.3

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 +116 -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 +109 -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 +1,106 @@
1
- function _0x4671(){const _0x5e561c=['❌\x20[HOOK]\x20Error\x20fetching\x20connected\x20accounts:','🔍\x20No\x20user\x20available\x20for\x20fetching\x20connected\x20accounts','Quttp','🚀\x20[HOOK]\x20Starting\x20connected\x20accounts\x20fetch\x20with\x20new\x20smart\x20API...','🚀\x20[HOOK]\x20User\x20info\x20available:','xayAO','🔄\x20[HOOK]\x20Refreshing\x20connected\x20accounts...','WyXmS','sGkNj','HiOiv','ahApH','dNHvb','voCGu','ROQVu','nwZjG','MzEjS','bjPyW','MTToD','ZiRgL','log','iKqsR','email','length','\x20accounts','bcGkL','SdHFR','toLowerCase','map','error','hJOoK','jnPFu','zcdRv','dTEJJ','✅\x20[HOOK]\x20Account\x20added\x20locally:','URyfQ','VUUDe','piDnq','hGKTd','EjDHs','WUnri','TPxRo','AgBTI','some','platform','https://','.com/','bSGux','IwHMK','QJpek','WipDp','hambs','WhlMQ','gRzGY','RPVaL','BPKAD','filter','✅\x20[HOOK]\x20Account\x20removed\x20locally:'];_0x4671=function(){return _0x5e561c;};return _0x4671();}import{useState,useEffect,useCallback}from'react';import{getConnectedAccountsSmart}from'../services/connectedAccountsService';function _0x112b(_0x4671d7,_0x112b3c){_0x4671d7=_0x4671d7-0x0;const _0x48aaa8=_0x4671();let _0x4598e3=_0x48aaa8[_0x4671d7];return _0x4598e3;}import{useAuth}from'../context/AuthContext';export const useConnectedAccounts=()=>{const _0x4cff8e={'bjPyW':_0x112b(0x0),'voCGu':function(_0x40e6cb,_0x1aa44d){return _0x40e6cb(_0x1aa44d);},'MTToD':'Failed\x20to\x20load\x20connected\x20accounts','ROQVu':_0x112b(0x1),'hJOoK':function(_0x229460,_0x12ab97){return _0x229460(_0x12ab97);},'nwZjG':function(_0x18f043,_0x1c3a1d){return _0x18f043!==_0x1c3a1d;},'MzEjS':_0x112b(0x2),'BPKAD':function(_0x314cd4,_0x1f0a1){return _0x314cd4(_0x1f0a1);},'ZiRgL':_0x112b(0x3),'iKqsR':_0x112b(0x4),'bcGkL':function(_0x32a1bd,_0x17281b){return _0x32a1bd!==_0x17281b;},'SdHFR':_0x112b(0x5),'zcdRv':_0x112b(0x6),'dNHvb':function(_0x37cae7){return _0x37cae7();},'URyfQ':_0x112b(0x7),'VUUDe':'bqSvf','piDnq':_0x112b(0x8),'hGKTd':'QgCua','gHnuP':_0x112b(0x9),'EjDHs':function(_0x4a07bf,_0x320d5a){return _0x4a07bf===_0x320d5a;},'WUnri':_0x112b(0xa),'TPxRo':'fqiqa','OudHM':function(_0xd25bec,_0x405e9b){return _0xd25bec(_0x405e9b);},'RPVaL':'✅\x20[HOOK]\x20Account\x20added\x20locally:','dTEJJ':function(_0x4529d2,_0x2fd6c2,_0x14583d){return _0x4529d2(_0x2fd6c2,_0x14583d);},'jnPFu':function(_0x27da92,_0x3a835e,_0x39b48d){return _0x27da92(_0x3a835e,_0x39b48d);}},{user:_0x402efb}=_0x4cff8e[_0x112b(0xb)](useAuth),[_0x3eaa8a,_0x32f5ad]=useState([]),[_0x1b1aa5,_0x4c3663]=useState(!![]),[_0x5eb4f9,_0x432659]=_0x4cff8e[_0x112b(0xc)](useState,null),_0x51f162=_0x4cff8e['dTEJJ'](useCallback,async()=>{if(!_0x402efb){console['log'](_0x4cff8e[_0x112b(0xd)]),_0x4cff8e['hJOoK'](_0x4c3663,![]);return;}try{if(_0x4cff8e[_0x112b(0xe)](_0x4cff8e[_0x112b(0xf)],'Quttp'))_0x3b4a7e['error'](_0x4cff8e[_0x112b(0x10)],_0x538378),_0x4cff8e['voCGu'](_0x353ebc,_0x4cff8e[_0x112b(0x11)]);else{_0x4cff8e['BPKAD'](_0x4c3663,!![]),_0x432659(null),console['log'](_0x4cff8e[_0x112b(0x12)]),console[_0x112b(0x13)](_0x4cff8e[_0x112b(0x14)],{'email':_0x402efb[_0x112b(0x15)],'id':_0x402efb['id'],'name':_0x402efb['name']});const _0x6beda2=await getConnectedAccountsSmart(_0x402efb[_0x112b(0x15)],_0x402efb['id'],_0x402efb['name']);console[_0x112b(0x13)]('✅\x20[HOOK]\x20Connected\x20accounts\x20loaded\x20via\x20smart\x20API:\x20'+_0x6beda2[_0x112b(0x16)]+_0x112b(0x17)),_0x32f5ad(_0x6beda2);}}catch(_0x4e7730){if(_0x4cff8e[_0x112b(0x18)]('xayAO',_0x4cff8e[_0x112b(0x19)])){const _0x7d0a0b=_0x2fc5b5['some'](_0x4154c9=>_0x4154c9['platform'][_0x112b(0x1a)]()===_0x408f5b[_0x112b(0x1a)]());return _0x7d0a0b?_0x2913b1[_0x112b(0x1b)](_0x3f889d=>_0x3f889d['platform'][_0x112b(0x1a)]()===_0x15aedc[_0x112b(0x1a)]()?_0x49b376:_0x3f889d):[..._0x2b1af,_0x367d0b];}else console[_0x112b(0x1c)](_0x4cff8e['bjPyW'],_0x4e7730),_0x4cff8e['hJOoK'](_0x432659,_0x4cff8e['MTToD']);}finally{_0x4cff8e[_0x112b(0x1d)](_0x4c3663,![]);}},[_0x402efb]),_0x555829=_0x4cff8e[_0x112b(0x1e)](useCallback,async()=>{console['log'](_0x4cff8e[_0x112b(0x1f)]),await _0x4cff8e[_0x112b(0xb)](_0x51f162);},[_0x51f162]),_0x55279b=_0x4cff8e[_0x112b(0x20)](useCallback,(_0x32a533,_0x9b9448)=>{const _0x47e40d={'AgBTI':function(_0x2fc0b6,_0x2ffdb9){return _0x4cff8e[_0x112b(0xc)](_0x2fc0b6,_0x2ffdb9);},'fAXAO':_0x112b(0x21),'mlOIJ':function(_0x4c9aa5,_0x529da6){return _0x4c9aa5===_0x529da6;},'bSGux':_0x4cff8e[_0x112b(0x22)],'IwHMK':_0x4cff8e[_0x112b(0x23)],'QJpek':function(_0x28d2a0,_0x7ed632){return _0x28d2a0!==_0x7ed632;},'WipDp':_0x4cff8e[_0x112b(0x24)],'WhlMQ':_0x4cff8e[_0x112b(0x25)],'gRzGY':_0x4cff8e['gHnuP']};if(_0x4cff8e[_0x112b(0x26)](_0x4cff8e[_0x112b(0x27)],_0x4cff8e[_0x112b(0x28)])){const _0x1396e0='https://'+_0x375a0a['toLowerCase']()+'.com/'+_0x3cd93d,_0x5292b2={'platform':_0x5ec070,'username':_0x56d1dd,'url':_0x1396e0};_0x47e40d[_0x112b(0x29)](_0x12de6a,_0x35ca4e=>{const _0x1d8b14=_0x35ca4e[_0x112b(0x2a)](_0xd611de=>_0xd611de[_0x112b(0x2b)][_0x112b(0x1a)]()===_0x440ac0[_0x112b(0x1a)]());return _0x1d8b14?_0x35ca4e[_0x112b(0x1b)](_0x3a7fcb=>_0x3a7fcb[_0x112b(0x2b)][_0x112b(0x1a)]()===_0x592178['toLowerCase']()?_0x5292b2:_0x3a7fcb):[..._0x35ca4e,_0x5292b2];}),_0x268fd7[_0x112b(0x13)](_0x47e40d['fAXAO'],_0x5292b2);}else{const _0x4f3dc3=_0x112b(0x2c)+_0x32a533['toLowerCase']()+_0x112b(0x2d)+_0x9b9448,_0x3c13d9={'platform':_0x32a533,'username':_0x9b9448,'url':_0x4f3dc3};_0x4cff8e['OudHM'](_0x32f5ad,_0x2d1d4c=>{const _0x1756ca={'hambs':function(_0x52832a,_0x3ef98e){return _0x47e40d[_0x112b(0x29)](_0x52832a,_0x3ef98e);}};if(_0x47e40d['mlOIJ'](_0x47e40d[_0x112b(0x2e)],_0x47e40d[_0x112b(0x2f)]))return[..._0x19db76,_0x52f4ea];else{const _0xe3c7c6=_0x2d1d4c['some'](_0x1e6cf1=>_0x1e6cf1[_0x112b(0x2b)][_0x112b(0x1a)]()===_0x32a533['toLowerCase']());if(_0xe3c7c6){if(_0x47e40d[_0x112b(0x30)](_0x47e40d[_0x112b(0x31)],_0x112b(0x8)))_0x1756ca[_0x112b(0x32)](_0x408b3e,![]);else return _0x2d1d4c['map'](_0x25b78b=>_0x25b78b[_0x112b(0x2b)][_0x112b(0x1a)]()===_0x32a533[_0x112b(0x1a)]()?_0x3c13d9:_0x25b78b);}else return _0x47e40d['QJpek'](_0x47e40d[_0x112b(0x33)],_0x47e40d[_0x112b(0x34)])?[..._0x2d1d4c,_0x3c13d9]:_0x2c5907[_0x112b(0x1b)](_0x178187=>_0x178187[_0x112b(0x2b)]['toLowerCase']()===_0x3ac86d[_0x112b(0x1a)]()?_0x521635:_0x178187);}}),console[_0x112b(0x13)](_0x4cff8e[_0x112b(0x35)],_0x3c13d9);}},[]),_0x268634=useCallback(_0x674fa6=>{_0x4cff8e[_0x112b(0x36)](_0x32f5ad,_0x501483=>_0x501483[_0x112b(0x37)](_0xce976b=>_0xce976b[_0x112b(0x2b)][_0x112b(0x1a)]()!==_0x674fa6[_0x112b(0x1a)]())),console['log'](_0x112b(0x38),_0x674fa6);},[]);return useEffect(()=>{_0x4cff8e[_0x112b(0xb)](_0x51f162);},[_0x51f162]),{'connectedAccounts':_0x3eaa8a,'isLoading':_0x1b1aa5,'error':_0x5eb4f9,'refreshAccounts':_0x555829,'addAccount':_0x55279b,'removeAccount':_0x268634};};
1
+ import { useState, useEffect, useCallback } from 'react';
2
+ import { getConnectedAccountsSmart
3
+ // Keep legacy imports for any edge cases
4
+ } from '../services/connectedAccountsService';
5
+ import { useAuth } from '../context/AuthContext';
6
+ export const useConnectedAccounts = () => {
7
+ const {
8
+ user
9
+ } = useAuth();
10
+ const [connectedAccounts, setConnectedAccounts] = useState([]);
11
+ const [isLoading, setIsLoading] = useState(true);
12
+ const [error, setError] = useState(null);
13
+ const fetchConnectedAccounts = useCallback(async () => {
14
+ if (!user) {
15
+ console.log('🔍 No user available for fetching connected accounts');
16
+ setIsLoading(false);
17
+ return;
18
+ }
19
+ try {
20
+ setIsLoading(true);
21
+ setError(null);
22
+ console.log('🚀 [HOOK] Starting connected accounts fetch with new smart API...');
23
+ console.log('🚀 [HOOK] User info available:', {
24
+ email: user.email,
25
+ id: user.id,
26
+ name: user.name
27
+ });
28
+
29
+ // Use the new smart API function - makes only ONE request with intelligent fallbacks
30
+ const accounts = await getConnectedAccountsSmart(user.email,
31
+ // Primary identifier (email)
32
+ user.id,
33
+ // Secondary identifier (user ID)
34
+ user.name // Tertiary identifier (username)
35
+ );
36
+ console.log(`✅ [HOOK] Connected accounts loaded via smart API: ${accounts.length} accounts`);
37
+ setConnectedAccounts(accounts);
38
+ } catch (err) {
39
+ console.error('❌ [HOOK] Error fetching connected accounts:', err);
40
+ setError('Failed to load connected accounts');
41
+ } finally {
42
+ setIsLoading(false);
43
+ }
44
+ }, [user]);
45
+ const refreshAccounts = useCallback(async () => {
46
+ console.log('🔄 [HOOK] Refreshing connected accounts...');
47
+ await fetchConnectedAccounts();
48
+ }, [fetchConnectedAccounts]);
49
+ const addAccount = useCallback((platform, username) => {
50
+ // Create a temporary URL for the account
51
+ const tempUrl = `https://${platform.toLowerCase()}.com/${username}`;
52
+ const newAccount = {
53
+ platform,
54
+ username,
55
+ url: tempUrl
56
+ };
57
+ setConnectedAccounts(prev => {
58
+ // Check if account already exists
59
+ const exists = prev.some(acc => acc.platform.toLowerCase() === platform.toLowerCase());
60
+ if (exists) {
61
+ // Update existing account
62
+ return prev.map(acc => acc.platform.toLowerCase() === platform.toLowerCase() ? newAccount : acc);
63
+ } else {
64
+ // Add new account
65
+ return [...prev, newAccount];
66
+ }
67
+ });
68
+ console.log('✅ [HOOK] Account added locally:', newAccount);
69
+
70
+ // TODO: In a real implementation, you would also send this to your backend
71
+ // Example:
72
+ // try {
73
+ // await saveConnectedAccount(user.id, platform, username);
74
+ // } catch (error) {
75
+ // console.error('Failed to save account to backend:', error);
76
+ // // Optionally revert the local change
77
+ // }
78
+ }, []);
79
+ const removeAccount = useCallback(platform => {
80
+ setConnectedAccounts(prev => prev.filter(acc => acc.platform.toLowerCase() !== platform.toLowerCase()));
81
+ console.log('✅ [HOOK] Account removed locally:', platform);
82
+
83
+ // TODO: In a real implementation, you would also remove this from your backend
84
+ // Example:
85
+ // try {
86
+ // await removeConnectedAccount(user.id, platform);
87
+ // } catch (error) {
88
+ // console.error('Failed to remove account from backend:', error);
89
+ // // Optionally revert the local change
90
+ // }
91
+ }, []);
92
+
93
+ // Fetch accounts when component mounts or user changes
94
+ useEffect(() => {
95
+ fetchConnectedAccounts();
96
+ }, [fetchConnectedAccounts]);
97
+ return {
98
+ connectedAccounts,
99
+ isLoading,
100
+ error,
101
+ refreshAccounts,
102
+ addAccount,
103
+ removeAccount
104
+ };
105
+ };
106
+ //# sourceMappingURL=useConnectedAccounts.js.map
@@ -1 +1,95 @@
1
- import{useState,useCallback}from'react';function _0x3833(){const _0x52602d=['PzMjf','instagram','gJmux','fiYPp','aFPgy','hnxKv','PQxDz','fiAVS','Ytzop','PcHQS','log','✅\x20Platform\x20','\x20disconnected\x20locally','error','Error\x20disconnecting\x20platform\x20','PErPy','iKHTT','xeXEO','tftZM','zjMXz','kywLz','DBMCV','GPDjq','\x20connected\x20locally','oiRLY','Error\x20connecting\x20platform\x20','KPBLS','DdnEW','QTptZ','nqfeL','Jvywe','AjyTG','guIMJ'];_0x3833=function(){return _0x52602d;};return _0x3833();}import{initiateNativeAuth}from'../services/platformAuthService';function _0x27b4(_0x383370,_0x27b47d){_0x383370=_0x383370-0x0;const _0x29ec1b=_0x3833();let _0x60bf15=_0x29ec1b[_0x383370];return _0x60bf15;}export const useConnections=()=>{const _0x2faee0={'DSIaR':function(_0x7340ad,_0xc44aaf){return _0x7340ad(_0xc44aaf);},'oiRLY':'ℹ️\x20NOTE:\x20Backend\x20sync\x20removed\x20from\x20SDK\x20-\x20app\x20should\x20call\x20/enoch/users/update\x20if\x20needed','GPDjq':function(_0x54f9d8,_0x7cd523){return _0x54f9d8(_0x7cd523);},'fiAVS':function(_0x3a76db,_0x43c1f4){return _0x3a76db===_0x43c1f4;},'Ytzop':'HHcKg','PcHQS':_0x27b4(0x0),'xeXEO':'youtube','tftZM':_0x27b4(0x1),'zjMXz':function(_0x4c65b7,_0x3bc60b){return _0x4c65b7===_0x3bc60b;},'kywLz':_0x27b4(0x2),'DBMCV':function(_0x2ffb89,_0x4753b3,_0x4d3178){return _0x2ffb89(_0x4753b3,_0x4d3178);},'chcUr':function(_0x1a13a2,_0x122f7c){return _0x1a13a2(_0x122f7c);},'KPBLS':function(_0x25643c,_0x23a6be){return _0x25643c(_0x23a6be);},'DdnEW':function(_0x8b02ad,_0x32f793){return _0x8b02ad!==_0x32f793;},'QTptZ':_0x27b4(0x3),'nqfeL':_0x27b4(0x4),'AjyTG':function(_0x45a8f8,_0x5c6927){return _0x45a8f8(_0x5c6927);},'hnxKv':function(_0x17222c,_0x2746d9){return _0x17222c(_0x2746d9);},'PQxDz':function(_0x5623c3,_0x447a4f,_0x4fc73a){return _0x5623c3(_0x447a4f,_0x4fc73a);},'CZPtT':function(_0x50bee9,_0x30c570,_0x10ae5f){return _0x50bee9(_0x30c570,_0x10ae5f);}},[_0x5d8193,_0x5dd0e3]=_0x2faee0[_0x27b4(0x5)](useState,{}),[_0x1e2dc8,_0xc4e877]=useState(![]),_0x331cc9=_0x2faee0[_0x27b4(0x6)](useCallback,async(_0x288c37,_0x2e1f0c)=>{if(_0x2faee0[_0x27b4(0x7)](_0x2faee0[_0x27b4(0x8)],_0x2faee0[_0x27b4(0x9)]))try{return _0x2faee0['DSIaR'](_0x57c453,_0x4b07f6=>{const _0x35f804={..._0x4b07f6};return delete _0x35f804[_0x4cd1a4],_0x35f804;}),_0x22235f[_0x27b4(0xa)](_0x27b4(0xb)+_0x34f81b+_0x27b4(0xc)),_0x4d2a32[_0x27b4(0xa)](_0x2faee0['oiRLY']),!![];}catch(_0x500b02){return _0x262a6d[_0x27b4(0xd)](_0x27b4(0xe)+_0x31359f+':',_0x500b02),![];}else try{if(_0x27b4(0xf)===_0x27b4(0x10))return _0x10ebca['error'](_0x27b4(0xe)+_0x31d09e+':',_0x255e0f),![];else{_0xc4e877(!![]);const useNativeSDK=_0x2faee0[_0x27b4(0x7)](_0x288c37,_0x2faee0[_0x27b4(0x11)])||_0x288c37===_0x2faee0[_0x27b4(0x12)];let _0x4af502=![];useNativeSDK?_0x2faee0[_0x27b4(0x13)](_0x2faee0[_0x27b4(0x14)],_0x2faee0['kywLz'])?_0x4af502=await _0x2faee0[_0x27b4(0x15)](initiateNativeAuth,_0x288c37,_0x2e1f0c):_0x2faee0[_0x27b4(0x16)](_0x4ebd59,![]):(await new Promise(_0xf2b5aa=>setTimeout(()=>_0xf2b5aa(undefined),0x3e8)),_0x4af502=!![]);if(_0x4af502)return _0x2faee0['chcUr'](_0x5dd0e3,_0x280047=>({..._0x280047,[_0x288c37]:{'userName':_0x2e1f0c,'connected':!![]}})),console[_0x27b4(0xa)](_0x27b4(0xb)+_0x288c37+_0x27b4(0x17)),console[_0x27b4(0xa)](_0x2faee0[_0x27b4(0x18)]),!![];return![];}}catch(_0x59709f){return console[_0x27b4(0xd)](_0x27b4(0x19)+_0x288c37+':',_0x59709f),![];}finally{_0x2faee0[_0x27b4(0x1a)](_0xc4e877,![]);}},[]),_0x6daa71=_0x2faee0['CZPtT'](useCallback,async(_0x4cfc69,_0x23a9c2)=>{const _0x206969={'Jvywe':_0x2faee0['oiRLY'],'BRJlT':'guIMJ'};if(_0x2faee0[_0x27b4(0x1b)](_0x2faee0['QTptZ'],_0x2faee0[_0x27b4(0x1c)]))return _0x4f65b7;else try{return _0x2faee0['fiAVS'](_0x2faee0[_0x27b4(0x1d)],'KvyBE')?(_0x4f021e(_0x1e5bfd=>{const _0x5261f2={..._0x1e5bfd};return delete _0x5261f2[_0x362aef],_0x5261f2;}),_0x536ed8[_0x27b4(0xa)](_0x27b4(0xb)+_0x1413c9+_0x27b4(0xc)),_0x2b5014['log'](_0x206969[_0x27b4(0x1e)]),!![]):(_0x2faee0[_0x27b4(0x1f)](_0x5dd0e3,_0x4c32f8=>{if(_0x206969['BRJlT']!==_0x27b4(0x20)){const _0x52da8c={..._0x7c8d40};return delete _0x52da8c[_0x374c2c],_0x52da8c;}else{const _0x30af91={..._0x4c32f8};return delete _0x30af91[_0x4cfc69],_0x30af91;}}),console['log'](_0x27b4(0xb)+_0x4cfc69+'\x20disconnected\x20locally'),console[_0x27b4(0xa)](_0x2faee0[_0x27b4(0x18)]),!![]);}catch(_0x4ebdee){return console[_0x27b4(0xd)](_0x27b4(0xe)+_0x4cfc69+':',_0x4ebdee),![];}},[]),_0x29f846=_0x2faee0[_0x27b4(0x6)](useCallback,async()=>{return _0x5d8193;},[_0x5d8193]);return{'connections':_0x5d8193,'connectPlatform':_0x331cc9,'disconnectPlatform':_0x6daa71,'getConnectionStatus':_0x29f846,'isConnecting':_0x1e2dc8};};
1
+ import { useState, useCallback } from 'react';
2
+ import { initiateNativeAuth } from '../services/platformAuthService';
3
+ /**
4
+ * Hook for managing platform connections
5
+ * NOTE: This hook now only manages LOCAL state
6
+ * Consuming apps are responsible for syncing connection status to their backend
7
+ * (e.g., calling /enoch/users/update for Enoch apps)
8
+ */
9
+ export const useConnections = () => {
10
+ const [connections, setConnections] = useState({});
11
+ const [isConnecting, setIsConnecting] = useState(false);
12
+
13
+ /**
14
+ * Connect a platform using OAuth or native SDK
15
+ * NOTE: Only manages local state - backend sync removed from SDK
16
+ */
17
+ const connectPlatform = useCallback(async (platform, username) => {
18
+ try {
19
+ setIsConnecting(true);
20
+
21
+ // Determine if we should use native SDK or OAuth
22
+ const useNativeSDK = platform === 'youtube' || platform === 'instagram';
23
+ let success = false;
24
+ if (useNativeSDK) {
25
+ // Use native SDK
26
+ success = await initiateNativeAuth(platform, username);
27
+ } else {
28
+ // For demo purposes, we'll simulate a successful connection
29
+ await new Promise(resolve => setTimeout(() => resolve(undefined), 1000));
30
+ success = true;
31
+ }
32
+ if (success) {
33
+ // Update connections state locally only
34
+ // NOTE: Backend sync removed - consuming app should handle this
35
+ setConnections(prev => ({
36
+ ...prev,
37
+ [platform]: {
38
+ userName: username,
39
+ connected: true
40
+ }
41
+ }));
42
+ console.log(`✅ Platform ${platform} connected locally`);
43
+ console.log('ℹ️ NOTE: Backend sync removed from SDK - app should call /enoch/users/update if needed');
44
+ return true;
45
+ }
46
+ return false;
47
+ } catch (error) {
48
+ console.error(`Error connecting platform ${platform}:`, error);
49
+ return false;
50
+ } finally {
51
+ setIsConnecting(false);
52
+ }
53
+ }, []);
54
+
55
+ /**
56
+ * Disconnect a platform
57
+ * NOTE: Only manages local state - backend sync removed from SDK
58
+ */
59
+ const disconnectPlatform = useCallback(async (platform, _username) => {
60
+ try {
61
+ // Update local state only
62
+ // NOTE: Backend sync removed - consuming app should handle this
63
+ setConnections(prev => {
64
+ const newConnections = {
65
+ ...prev
66
+ };
67
+ delete newConnections[platform];
68
+ return newConnections;
69
+ });
70
+ console.log(`✅ Platform ${platform} disconnected locally`);
71
+ console.log('ℹ️ NOTE: Backend sync removed from SDK - app should call /enoch/users/update if needed');
72
+ return true;
73
+ } catch (error) {
74
+ console.error(`Error disconnecting platform ${platform}:`, error);
75
+ return false;
76
+ }
77
+ }, []);
78
+
79
+ /**
80
+ * Get current connection status
81
+ */
82
+ const getConnectionStatus = useCallback(async () => {
83
+ // Returns local connection state
84
+ // Consuming app can fetch from backend if needed
85
+ return connections;
86
+ }, [connections]);
87
+ return {
88
+ connections,
89
+ connectPlatform,
90
+ disconnectPlatform,
91
+ getConnectionStatus,
92
+ isConnecting
93
+ };
94
+ };
95
+ //# sourceMappingURL=useConnections.js.map
@@ -1,7 +1,172 @@
1
+ import { useCallback } from 'react';
2
+ import { STORAGE_KEYS } from '../constants';
3
+ import { API_CONFIG } from '../config/api';
1
4
 
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require('react-native-keychain')
5
- ];
6
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
7
- import{useCallback}from'react';function _0x4a9c(_0x503b4f,_0x4a9cf0){_0x503b4f=_0x503b4f-0x0;const _0x2a3e01=_0x503b();let _0x56a6cc=_0x2a3e01[_0x503b4f];return _0x56a6cc;}import{STORAGE_KEYS}from'../constants';import{API_CONFIG}from'../config/api';const mockCredentialStorage={};function _0x503b(){const _0x324102=['getGenericPassword','function','Error\x20checking\x20credentials:','VfVsZ','lGWoK','UQHRN','default','AMtDL','Keychain\x20access\x20failed,\x20using\x20mock\x20storage','kzXrN','aIKGt','SnmlB','papKe','ZjLyc','accessControl','PWboD','BIOMETRY_ANY','accessible','iUMFU','WHEN_UNLOCKED','ZopBv','lGbex','error','xHvBD','QEqkO','service','hhQcc','password','GlgoF','warn','igTCx','gQeLA','dhFyu','EpJtP','ZWhjn','setGenericPassword','RojLR','JAXEH','fAXir','HBOmQ','yVHdp','uYKhi','mCjHE','GtknA','bpWDd','Ybnys','resetGenericPassword','pPXDJ','DeiiM','DcmQq','qdhuM','MhKLm','OOOSX','MPYWx','Error\x20getting\x20credentials:','zjHNg','Error\x20validating\x20credentials:','AXElD','hHcRz','TWQVi','UuQRr','xEjbF','poRKl','credentials','DWqtA','nHVNc','swynV','LXTTZ','parse','KzUgM','oDxsI','ohFmI','ACCESSIBLE','qCLsh','stringify','Avvut','cTauc','QIIep','qBSdM','/validate','json','valid','jhOZb','xJEqX','wmGAf'];_0x503b=function(){return _0x324102;};return _0x503b();}let Keychain=null;try{Keychain=__ONAIROS_REQ_FUNC__(0x0);}catch(_0x3bb319){console['warn']('react-native-keychain module not available in useCredentials, using mock storage');}const isKeychainAvailable=()=>{const _0x1af079={'zzFZA':function(_0xf79bfe,_0x4c09b8){return _0xf79bfe===_0x4c09b8;}};try{return Keychain&&_0x1af079['zzFZA'](typeof Keychain[_0x4a9c(0x0)],_0x4a9c(0x1));}catch(_0x2833ef){return![];}},safeGetGenericPassword=async _0x5859a1=>{const _0x15668d={'PWboD':function(_0x347e67,_0x1e8f3e){return _0x347e67===_0x1e8f3e;},'ZopBv':function(_0x20fbab,_0x2f0fd8){return _0x20fbab===_0x2f0fd8;},'iUMFU':function(_0x33ba30,_0x515a16){return _0x33ba30===_0x515a16;},'xHvBD':_0x4a9c(0x2),'kzXrN':function(_0x3ca475,_0x3d6c6b){return _0x3ca475!==_0x3d6c6b;},'aIKGt':_0x4a9c(0x3),'papKe':function(_0x397ec8){return _0x397ec8();},'UppOk':_0x4a9c(0x4),'ZjLyc':'DkANk','anXBg':_0x4a9c(0x5),'lGbex':'GgQmX','QEqkO':function(_0x4b97c9,_0x141099){return _0x4b97c9===_0x141099;},'hhQcc':_0x4a9c(0x6),'GlgoF':_0x4a9c(0x7),'ikdaY':_0x4a9c(0x8),'igTCx':function(_0x35e66a,_0x1b78d5){return _0x35e66a===_0x1b78d5;},'gQeLA':function(_0xb3661f,_0x1823b5){return _0xb3661f===_0x1823b5;}};try{if(_0x15668d[_0x4a9c(0x9)](_0x15668d[_0x4a9c(0xa)],_0x4a9c(0xb))){if(_0x15668d[_0x4a9c(0xc)](isKeychainAvailable)){if(_0x15668d['UppOk']===_0x15668d[_0x4a9c(0xd)]){var _0x746da0,_0x46a27c;_0x3631ce[_0x4a9c(0xe)]=_0x15668d[_0x4a9c(0xf)](_0x746da0=Keychain['ACCESS_CONTROL'],null)||_0x746da0===void 0x0?void 0x0:_0x746da0[_0x4a9c(0x10)],_0x308049[_0x4a9c(0x11)]=_0x15668d['ZopBv'](_0x46a27c=Keychain['ACCESSIBLE'],null)||_0x15668d[_0x4a9c(0x12)](_0x46a27c,void 0x0)?void 0x0:_0x46a27c[_0x4a9c(0x13)];}else return await Keychain[_0x4a9c(0x0)](_0x5859a1);}else{if(_0x15668d[_0x4a9c(0x14)](_0x15668d['anXBg'],_0x15668d[_0x4a9c(0x15)]))return _0x3dd343[_0x4a9c(0x16)](_0x15668d[_0x4a9c(0x17)],_0x33c370),![];else{const _0x616cd6=(_0x15668d[_0x4a9c(0x18)](_0x5859a1,null)||_0x15668d[_0x4a9c(0x14)](_0x5859a1,void 0x0)?void 0x0:_0x5859a1[_0x4a9c(0x19)])||_0x15668d[_0x4a9c(0x1a)];return mockCredentialStorage[_0x616cd6]||null;}}}else return _0x5e42ae['parse'](_0x21782a[_0x4a9c(0x1b)]);}catch(_0x5337c8){if(_0x15668d[_0x4a9c(0x12)](_0x15668d['GlgoF'],_0x15668d[_0x4a9c(0x1c)])){console[_0x4a9c(0x1d)](_0x15668d['ikdaY'],_0x5337c8);const _0x2fa12c=(_0x15668d[_0x4a9c(0x1e)](_0x5859a1,null)||_0x15668d[_0x4a9c(0x1f)](_0x5859a1,void 0x0)?void 0x0:_0x5859a1['service'])||_0x15668d['hhQcc'];return mockCredentialStorage[_0x2fa12c]||null;}else return![];}},safeSetGenericPassword=async(_0x444b9d,_0x1d2881,_0x352206)=>{const _0x308b54={'HBOmQ':function(_0x5434a4,_0x25a57a){return _0x5434a4===_0x25a57a;},'yVHdp':_0x4a9c(0x1),'ZWhjn':function(_0x4e9369){return _0x4e9369();},'OYzfX':_0x4a9c(0x20),'RojLR':_0x4a9c(0x21),'JAXEH':function(_0x14d621,_0x3aff71){return _0x14d621===_0x3aff71;},'fAXir':'default','uYKhi':'Keychain\x20access\x20failed,\x20using\x20mock\x20storage'};try{if(_0x308b54[_0x4a9c(0x22)](isKeychainAvailable))return await Keychain[_0x4a9c(0x23)](_0x444b9d,_0x1d2881,_0x352206);else{if(_0x308b54['OYzfX']!==_0x308b54[_0x4a9c(0x24)]){const _0x4fec99=(_0x308b54[_0x4a9c(0x25)](_0x352206,null)||_0x352206===void 0x0?void 0x0:_0x352206[_0x4a9c(0x19)])||_0x308b54[_0x4a9c(0x26)];return mockCredentialStorage[_0x4fec99]={'username':_0x444b9d,'password':_0x1d2881},!![];}else try{return Keychain&&_0x308b54[_0x4a9c(0x27)](typeof Keychain['getGenericPassword'],_0x308b54[_0x4a9c(0x28)]);}catch(_0x2288db){return![];}}}catch(_0x260624){console['warn'](_0x308b54[_0x4a9c(0x29)],_0x260624);const _0x3994c9=(_0x352206===null||_0x308b54['JAXEH'](_0x352206,void 0x0)?void 0x0:_0x352206[_0x4a9c(0x19)])||_0x308b54['fAXir'];return mockCredentialStorage[_0x3994c9]={'username':_0x444b9d,'password':_0x1d2881},!![];}},safeResetGenericPassword=async _0x4ccf8c=>{const _0x29dedc={'pPXDJ':function(_0x1115f2,_0x4e139c){return _0x1115f2(_0x4e139c);},'GtknA':function(_0x69f780){return _0x69f780();},'Ybnys':_0x4a9c(0x2a),'DeiiM':function(_0x391bdb,_0x4724c3){return _0x391bdb===_0x4724c3;},'DcmQq':_0x4a9c(0x6),'qdhuM':_0x4a9c(0x8),'MhKLm':function(_0x5a3894,_0xc39f89){return _0x5a3894===_0xc39f89;},'OOOSX':function(_0x3412b4,_0x5dde6b){return _0x3412b4===_0x5dde6b;}};try{if(_0x29dedc[_0x4a9c(0x2b)](isKeychainAvailable)){if(_0x4a9c(0x2c)!==_0x29dedc[_0x4a9c(0x2d)])return await Keychain[_0x4a9c(0x2e)](_0x4ccf8c);else Keychain=_0x29dedc[_0x4a9c(0x2f)](_0xd9d917,0x0);}else{const _0xe574f7=(_0x29dedc['DeiiM'](_0x4ccf8c,null)||_0x29dedc[_0x4a9c(0x30)](_0x4ccf8c,void 0x0)?void 0x0:_0x4ccf8c['service'])||_0x29dedc[_0x4a9c(0x31)];return delete mockCredentialStorage[_0xe574f7],!![];}}catch(_0x1ad465){console['warn'](_0x29dedc[_0x4a9c(0x32)],_0x1ad465);const _0x14889c=(_0x29dedc[_0x4a9c(0x33)](_0x4ccf8c,null)||_0x29dedc[_0x4a9c(0x34)](_0x4ccf8c,void 0x0)?void 0x0:_0x4ccf8c[_0x4a9c(0x19)])||_0x4a9c(0x6);return delete mockCredentialStorage[_0x14889c],!![];}};export const useCredentials=()=>{const _0x272108={'xEjbF':function(_0x4ce14d,_0x6dd5d5){return _0x4ce14d===_0x6dd5d5;},'nOZWJ':_0x4a9c(0x35),'nHVNc':_0x4a9c(0x2),'KzUgM':_0x4a9c(0x36),'NsoRt':'Error\x20clearing\x20credentials:','oDxsI':_0x4a9c(0x37),'zkvRY':function(_0x45dcf9){return _0x45dcf9();},'ohFmI':function(_0x4e689e,_0x2d8e44){return _0x4e689e===_0x2d8e44;},'qCLsh':function(_0x540fc6,_0x476182,_0xf835db,_0x6b4dba){return _0x540fc6(_0x476182,_0xf835db,_0x6b4dba);},'Avvut':'Error\x20storing\x20credentials:','QIIep':function(_0x59274b,_0x3124dd){return _0x59274b(_0x3124dd);},'jhOZb':_0x4a9c(0x38),'qBSdM':function(_0x5d8bee,_0x5870eb){return _0x5d8bee!==_0x5870eb;},'lWuzR':_0x4a9c(0x39),'REDhL':_0x4a9c(0x3a),'xJEqX':_0x4a9c(0x3b),'rKgBw':'pymFj','UuQRr':function(_0x50b3a9,_0x27d827,_0xb535a0){return _0x50b3a9(_0x27d827,_0xb535a0);}},_0x449be3=_0x272108[_0x4a9c(0x3c)](useCallback,async()=>{const _0x4e4b26={'gCtPB':function(_0x4b1fa8,_0x47b33a){return _0x272108[_0x4a9c(0x3d)](_0x4b1fa8,_0x47b33a);},'DWqtA':_0x4a9c(0x6)};try{if(_0x4a9c(0x3e)!==_0x272108['nOZWJ']){const _0x54d00f=await safeGetGenericPassword({'service':STORAGE_KEYS[_0x4a9c(0x3f)]});return!!_0x54d00f;}else{const _0x37d2c3=(_0x4e4b26['gCtPB'](_0x13a88c,null)||_0x57899c===void 0x0?void 0x0:_0x176914[_0x4a9c(0x19)])||_0x4e4b26[_0x4a9c(0x40)];return _0x56036c[_0x37d2c3]={'username':_0xef5b20,'password':_0x2578e9},!![];}}catch(_0x361aaf){return console[_0x4a9c(0x16)](_0x272108[_0x4a9c(0x41)],_0x361aaf),![];}},[]),_0x21c7f9=_0x272108[_0x4a9c(0x3c)](useCallback,async()=>{try{if(_0x272108[_0x4a9c(0x3d)](_0x4a9c(0x42),_0x4a9c(0x43)))_0x38fa4c[_0x4a9c(0x1d)]('react-native-keychain module not available in useCredentials, using mock storage');else{const _0x4c40dc=await safeGetGenericPassword({'service':STORAGE_KEYS[_0x4a9c(0x3f)]});if(_0x4c40dc)return JSON[_0x4a9c(0x44)](_0x4c40dc[_0x4a9c(0x1b)]);return null;}}catch(_0x13ee45){return console[_0x4a9c(0x16)](_0x272108[_0x4a9c(0x45)],_0x13ee45),null;}},[]),_0x5c625d=useCallback(async(_0xbedbdb,_0x37ccb1,_0x1a3bc3)=>{if(_0x272108[_0x4a9c(0x3d)](_0x272108[_0x4a9c(0x46)],_0x4a9c(0x37)))try{const _0x4be31e={'service':STORAGE_KEYS[_0x4a9c(0x3f)]};if(_0x272108['zkvRY'](isKeychainAvailable)){var _0x5b8a23,_0x4bae56;_0x4be31e[_0x4a9c(0xe)]=_0x272108[_0x4a9c(0x47)](_0x5b8a23=Keychain['ACCESS_CONTROL'],null)||_0x272108[_0x4a9c(0x47)](_0x5b8a23,void 0x0)?void 0x0:_0x5b8a23[_0x4a9c(0x10)],_0x4be31e[_0x4a9c(0x11)]=(_0x4bae56=Keychain[_0x4a9c(0x48)])===null||_0x4bae56===void 0x0?void 0x0:_0x4bae56[_0x4a9c(0x13)];}return await _0x272108[_0x4a9c(0x49)](safeSetGenericPassword,_0xbedbdb,JSON[_0x4a9c(0x4a)]({'userPin':_0x37ccb1,'accessToken':_0x1a3bc3}),_0x4be31e),!![];}catch(_0x2b1c53){return console['error'](_0x272108[_0x4a9c(0x4b)],_0x2b1c53),![];}else _0x26ed38[_0x4a9c(0x16)](_0x272108['NsoRt'],_0x55c958);},[]),_0x533d70=_0x272108[_0x4a9c(0x3c)](useCallback,async()=>{try{if(_0x272108['xEjbF']('cTauc',_0x4a9c(0x4c)))await _0x272108[_0x4a9c(0x4d)](safeResetGenericPassword,{'service':STORAGE_KEYS['credentials']});else return Keychain&&typeof Keychain[_0x4a9c(0x0)]==='function';}catch(_0x39d178){console['error'](_0x272108['NsoRt'],_0x39d178);}},[]),_0x30c0b3=useCallback(async _0x422eed=>{const _0x16c2c6={'wmGAf':_0x272108[_0x4a9c(0x4b)]};try{if(_0x272108[_0x4a9c(0x4e)](_0x272108['lWuzR'],_0x272108['REDhL'])){const _0x4f4040=await fetch(API_CONFIG['BASE_URL']+_0x4a9c(0x4f),{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON[_0x4a9c(0x4a)]({'username':_0x422eed})}),_0x6275a5=await _0x4f4040[_0x4a9c(0x50)]();return{'success':!![],'isValid':_0x6275a5[_0x4a9c(0x51)],'credentials':_0x6275a5[_0x4a9c(0x3f)]};}else return _0x460483['error'](_0x272108[_0x4a9c(0x52)],_0x41f00c),{'success':![],'isValid':![]};}catch(_0x5538a1){return _0x272108[_0x4a9c(0x53)]!==_0x272108['rKgBw']?(console[_0x4a9c(0x16)]('Error\x20validating\x20credentials:',_0x5538a1),{'success':![],'isValid':![]}):(_0x37175c[_0x4a9c(0x16)](_0x16c2c6[_0x4a9c(0x54)],_0x3be318),![]);}},[]);return{'hasCredentials':_0x449be3,'getCredentials':_0x21c7f9,'storeCredentials':_0x5c625d,'clearCredentials':_0x533d70,'validateCredentials':_0x30c0b3};};
5
+ // Create a mock storage for environments without Keychain access
6
+ const mockCredentialStorage = {};
7
+
8
+ // Try to import Keychain, but provide fallbacks if not available
9
+ let Keychain = null;
10
+ try {
11
+ Keychain = require('react-native-keychain');
12
+ } catch (error) {
13
+ console.warn('react-native-keychain module not available in useCredentials, using mock storage');
14
+ }
15
+
16
+ // Check if Keychain is properly initialized and available
17
+ const isKeychainAvailable = () => {
18
+ try {
19
+ return Keychain && typeof Keychain.getGenericPassword === 'function';
20
+ } catch (e) {
21
+ return false;
22
+ }
23
+ };
24
+
25
+ // Safe wrapper for getGenericPassword
26
+ const safeGetGenericPassword = async options => {
27
+ try {
28
+ if (isKeychainAvailable()) {
29
+ return await Keychain.getGenericPassword(options);
30
+ } else {
31
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
32
+ return mockCredentialStorage[key] || null;
33
+ }
34
+ } catch (error) {
35
+ console.warn('Keychain access failed, using mock storage', error);
36
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
37
+ return mockCredentialStorage[key] || null;
38
+ }
39
+ };
40
+
41
+ // Safe wrapper for setGenericPassword
42
+ const safeSetGenericPassword = async (username, password, options) => {
43
+ try {
44
+ if (isKeychainAvailable()) {
45
+ return await Keychain.setGenericPassword(username, password, options);
46
+ } else {
47
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
48
+ mockCredentialStorage[key] = {
49
+ username,
50
+ password
51
+ };
52
+ return true;
53
+ }
54
+ } catch (error) {
55
+ console.warn('Keychain access failed, using mock storage', error);
56
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
57
+ mockCredentialStorage[key] = {
58
+ username,
59
+ password
60
+ };
61
+ return true;
62
+ }
63
+ };
64
+
65
+ // Safe wrapper for resetGenericPassword
66
+ const safeResetGenericPassword = async options => {
67
+ try {
68
+ if (isKeychainAvailable()) {
69
+ return await Keychain.resetGenericPassword(options);
70
+ } else {
71
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
72
+ delete mockCredentialStorage[key];
73
+ return true;
74
+ }
75
+ } catch (error) {
76
+ console.warn('Keychain access failed, using mock storage', error);
77
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
78
+ delete mockCredentialStorage[key];
79
+ return true;
80
+ }
81
+ };
82
+ export const useCredentials = () => {
83
+ const hasCredentials = useCallback(async () => {
84
+ try {
85
+ const credentials = await safeGetGenericPassword({
86
+ service: STORAGE_KEYS.credentials
87
+ });
88
+ return !!credentials;
89
+ } catch (error) {
90
+ console.error('Error checking credentials:', error);
91
+ return false;
92
+ }
93
+ }, []);
94
+ const getCredentials = useCallback(async () => {
95
+ try {
96
+ const credentials = await safeGetGenericPassword({
97
+ service: STORAGE_KEYS.credentials
98
+ });
99
+ if (credentials) {
100
+ return JSON.parse(credentials.password);
101
+ }
102
+ return null;
103
+ } catch (error) {
104
+ console.error('Error getting credentials:', error);
105
+ return null;
106
+ }
107
+ }, []);
108
+ const storeCredentials = useCallback(async (username, userPin, accessToken) => {
109
+ try {
110
+ const options = {
111
+ service: STORAGE_KEYS.credentials
112
+ };
113
+
114
+ // Only use secure storage options on real devices
115
+ if (isKeychainAvailable()) {
116
+ var _Keychain$ACCESS_CONT, _Keychain$ACCESSIBLE;
117
+ options.accessControl = (_Keychain$ACCESS_CONT = Keychain.ACCESS_CONTROL) === null || _Keychain$ACCESS_CONT === void 0 ? void 0 : _Keychain$ACCESS_CONT.BIOMETRY_ANY;
118
+ options.accessible = (_Keychain$ACCESSIBLE = Keychain.ACCESSIBLE) === null || _Keychain$ACCESSIBLE === void 0 ? void 0 : _Keychain$ACCESSIBLE.WHEN_UNLOCKED;
119
+ }
120
+ await safeSetGenericPassword(username, JSON.stringify({
121
+ userPin,
122
+ accessToken
123
+ }), options);
124
+ return true;
125
+ } catch (error) {
126
+ console.error('Error storing credentials:', error);
127
+ return false;
128
+ }
129
+ }, []);
130
+ const clearCredentials = useCallback(async () => {
131
+ try {
132
+ await safeResetGenericPassword({
133
+ service: STORAGE_KEYS.credentials
134
+ });
135
+ } catch (error) {
136
+ console.error('Error clearing credentials:', error);
137
+ }
138
+ }, []);
139
+ const validateCredentials = useCallback(async username => {
140
+ try {
141
+ const response = await fetch(`${API_CONFIG.BASE_URL}/validate`, {
142
+ method: 'POST',
143
+ headers: {
144
+ 'Content-Type': 'application/json'
145
+ },
146
+ body: JSON.stringify({
147
+ username
148
+ })
149
+ });
150
+ const data = await response.json();
151
+ return {
152
+ success: true,
153
+ isValid: data.valid,
154
+ credentials: data.credentials
155
+ };
156
+ } catch (error) {
157
+ console.error('Error validating credentials:', error);
158
+ return {
159
+ success: false,
160
+ isValid: false
161
+ };
162
+ }
163
+ }, []);
164
+ return {
165
+ hasCredentials,
166
+ getCredentials,
167
+ storeCredentials,
168
+ clearCredentials,
169
+ validateCredentials
170
+ };
171
+ };
172
+ //# sourceMappingURL=useCredentials.js.map
@@ -1 +1,140 @@
1
- function _0x3fb5(){const _0x2e4ad7=['Authentication\x20required\x20for\x20connections','⚠️\x20[CONNECTIONS\x20HOOK]\x20Skipping\x20API\x20call\x20to\x20prevent\x20unauthenticated\x20requests','❌\x20Error\x20fetching\x20connections\x20by\x20userId:','WTJHH','onairos_jwt_token','4|0|3|2|1','⚠️\x20[CONNECTIONS\x20HOOK]\x20No\x20authentication\x20token\x20available\x20for\x20connections\x20refresh','Qsjrm','Authentication\x20error','🔄\x20Loading\x20user\x20connections\x20with\x20authentication...','🔑\x20[CONNECTIONS\x20HOOK]\x20Using\x20auth\x20token:','✅\x20Connections\x20loaded:','❌\x20Error\x20loading\x20connections:','EWTxk','✅\x20[CONNECTIONS\x20HOOK]\x20Connections\x20refresh\x20completed','⚠️\x20[CONNECTIONS\x20HOOK]\x20No\x20authentication\x20token\x20available\x20for\x20username\x20connections','aAVxa','❌\x20Error\x20fetching\x20connections\x20by\x20username:','❌\x20Error\x20uploading\x20profile\x20picture:','EJRIM','iJRmc','🔍\x20Fetching\x20connections\x20by\x20userId:','🎯\x20[DEMO\x20MODE]\x20Reviewer\x20bypass\x20detected\x20-\x20skipping\x20API\x20call\x20for\x20demo','❌\x20[CONNECTIONS\x20HOOK]\x20Unexpected\x20null\x20token\x20after\x20validation','sqsaK','qBYyg','VKIdn','pXPGA','GvipX','0|4|2|3|1','GsKjr','sRtQI','dbral','hHzge','YfBAp','VQjRG','Wsedt','getItem','wDObp','oHxIv','cvDKR','warn','eFrpq','fahQw','leJWf','vGrvB','nJxbl','split','HfsyO','kRpgK','log','hmfRN','error','aZtir','yZoqg','substring','...','YyuKX','puVzW','length','message','TiNof','CfpsH','gctrz','LKyML','yYFkf','FrDzO','WvKvO','eADEI','Bmukd','DaMZQ','uRhhP','nMjRq','qvuHZ','sDzpL','yobec','cxNhu','🔍\x20Fetching\x20connections\x20by\x20username:','AXPPl','ZwIZm','XyfLE','EUGvl','pAoAG','rKPff','pQFhH','awpgE','fHIDN','JQjEy','WVZGa','RMlJh','sPHgf','jpg','UTjqh','GgmTb','ADZAf','ZoJGS','📷\x20Uploading\x20profile\x20picture\x20for\x20user:','success','sGVmL','YePWO','Pvprn','mcYEP','rdrwN','eRlVS'];_0x3fb5=function(){return _0x2e4ad7;};return _0x3fb5();}import{useState,useEffect,useCallback}from'react';function _0x3997(_0x3fb5c2,_0x399796){_0x3fb5c2=_0x3fb5c2-0x0;const _0x441ad4=_0x3fb5();let _0x17ce3a=_0x441ad4[_0x3fb5c2];return _0x17ce3a;}import{getUserConnections,getUserConnectionsByUsername,getUserConnectionsByUserId,uploadProfilePicture}from'../services/userConnectionsService';import{getAuthToken}from'../services/authService';import AsyncStorage from'@react-native-async-storage/async-storage';export const useUserConnections=()=>{const _0x58591b={'GsKjr':function(_0x1c5c3f,_0x3b589b){return _0x1c5c3f(_0x3b589b);},'sRtQI':_0x3997(0x0),'eFrpq':_0x3997(0x1),'dbral':_0x3997(0x2),'hHzge':_0x3997(0x3),'YfBAp':function(_0x337a67,_0x168922){return _0x337a67(_0x168922);},'VQjRG':function(_0x1b3bb8,_0x11c08c){return _0x1b3bb8(_0x11c08c);},'Wsedt':function(_0x714a4){return _0x714a4();},'wDObp':_0x3997(0x4),'oHxIv':function(_0xeb2d98,_0x45aded){return _0xeb2d98===_0x45aded;},'ahQdo':'reviewer-bypass-token','cvDKR':_0x3997(0x5),'nORdF':function(_0x50b703,_0x24f580){return _0x50b703(_0x24f580);},'fahQw':_0x3997(0x6),'leJWf':_0x3997(0x7),'hmfRN':function(_0x47d90e,_0x192d9b){return _0x47d90e(_0x192d9b);},'aZtir':function(_0x1f379b,_0x4a5249){return _0x1f379b(_0x4a5249);},'EGnBf':_0x3997(0x8),'yZoqg':_0x3997(0x9),'AXPPl':_0x3997(0xa),'YyuKX':function(_0x3633ef){return _0x3633ef();},'puVzW':_0x3997(0xb),'evCMq':function(_0xb9d7ca,_0x172a3f){return _0xb9d7ca instanceof _0x172a3f;},'Bmukd':'Failed\x20to\x20load\x20connections','TiNof':_0x3997(0xc),'LHKIM':_0x3997(0xd),'gctrz':function(_0x2d433d,_0x1cacfa){return _0x2d433d(_0x1cacfa);},'yYFkf':'🔄\x20[CONNECTIONS\x20HOOK]\x20Refreshing\x20connections...','FrDzO':function(_0x25a2fe){return _0x25a2fe();},'WvKvO':_0x3997(0xe),'eADEI':'⚠️\x20[CONNECTIONS\x20HOOK]\x20No\x20authentication\x20token\x20available\x20for\x20user\x20ID\x20connections','HAgfa':_0x3997(0xf),'DaMZQ':function(_0x540b1d,_0x529125){return _0x540b1d===_0x529125;},'Wirbk':'OwVAZ','uRhhP':function(_0x524f14,_0x1f1d24){return _0x524f14===_0x1f1d24;},'nMjRq':'FGfWa','qvuHZ':function(_0x3dcddc,_0x144780){return _0x3dcddc!==_0x144780;},'sDzpL':_0x3997(0x10),'XyfLE':_0x3997(0x11),'pXPGA':function(_0x584751,_0x483b55){return _0x584751(_0x483b55);},'YePWO':_0x3997(0x12),'sXtIw':function(_0x2cff0a,_0x53e1c9){return _0x2cff0a===_0x53e1c9;},'pQFhH':_0x3997(0x13),'KUpfX':function(_0x24ecae,_0x3f2b11){return _0x24ecae!==_0x3f2b11;},'awpgE':_0x3997(0x14),'fHIDN':function(_0xb08ef0){return _0xb08ef0();},'WVZGa':'JQjEy','RMlJh':_0x3997(0x15),'sPHgf':function(_0x43fba6,_0x4c2e36){return _0x43fba6(_0x4c2e36);},'ooKuG':_0x3997(0x16),'UTjqh':_0x3997(0x17),'GgmTb':_0x3997(0x18),'ADZAf':function(_0x3433d3,_0x5eb875){return _0x3433d3!==_0x5eb875;},'ZoJGS':_0x3997(0x19),'qnFCn':_0x3997(0x1a),'vQKNn':function(_0x2a3f77,_0x39ea2e){return _0x2a3f77(_0x39ea2e);},'GvipX':function(_0x3e7247,_0x471a15,_0x3fed28){return _0x3e7247(_0x471a15,_0x3fed28);}},[_0x5a154d,_0x157b91]=_0x58591b['vQKNn'](useState,[]),[_0x2bf2cb,_0x3052d2]=_0x58591b['pXPGA'](useState,!![]),[_0x423506,_0x337839]=_0x58591b[_0x3997(0x1b)](useState,null),_0x3ec753=_0x58591b[_0x3997(0x1c)](useCallback,async()=>{const _0x49d277={'nJxbl':_0x3997(0x1d),'KHgnU':function(_0x1f8b33,_0xc10013){return _0x58591b[_0x3997(0x1e)](_0x1f8b33,_0xc10013);},'HfsyO':_0x58591b[_0x3997(0x1f)],'kRpgK':_0x58591b['eFrpq'],'LKyML':_0x58591b[_0x3997(0x20)]};if(_0x58591b[_0x3997(0x21)]===_0x3997(0x3))try{_0x58591b[_0x3997(0x22)](_0x3052d2,!![]),_0x58591b[_0x3997(0x23)](_0x337839,null);const _0x4f7cdc=await _0x58591b[_0x3997(0x24)](getAuthToken),_0x5607fe=await AsyncStorage[_0x3997(0x25)](_0x58591b[_0x3997(0x26)]),_0x181e29=_0x58591b[_0x3997(0x27)](_0x5607fe,_0x58591b['ahQdo']);if(!_0x4f7cdc&&!_0x181e29){const _0x307d3a=_0x58591b[_0x3997(0x28)]['split']('|');let _0x7602f5=0x0;while(!![]){switch(_0x307d3a[_0x7602f5++]){case'0':console[_0x3997(0x29)](_0x58591b[_0x3997(0x2a)]);continue;case'1':return;case'2':_0x337839(_0x58591b[_0x3997(0x1f)]);continue;case'3':_0x58591b['nORdF'](_0x157b91,[]);continue;case'4':console[_0x3997(0x29)](_0x58591b[_0x3997(0x2b)]);continue;}break;}}if(_0x181e29){if(_0x58591b[_0x3997(0x2c)]===_0x3997(0x2d)){const _0x15f724=_0x49d277[_0x3997(0x2e)][_0x3997(0x2f)]('|');let _0x16b13f=0x0;while(!![]){switch(_0x15f724[_0x16b13f++]){case'0':_0x1cc906['warn'](_0x3997(0x6));continue;case'1':return;case'2':_0x1ea9c0([]);continue;case'3':_0x49d277['KHgnU'](_0x94f690,_0x49d277[_0x3997(0x30)]);continue;case'4':_0x593250[_0x3997(0x29)](_0x49d277[_0x3997(0x31)]);continue;}break;}}else{console[_0x3997(0x32)](_0x3997(0x16)),_0x58591b['GsKjr'](_0x157b91,[]),_0x58591b[_0x3997(0x33)](_0x337839,null);return;}}if(!_0x4f7cdc){console[_0x3997(0x34)]('❌\x20[CONNECTIONS\x20HOOK]\x20Unexpected\x20null\x20token\x20after\x20validation'),_0x58591b[_0x3997(0x23)](_0x157b91,[]),_0x58591b[_0x3997(0x35)](_0x337839,_0x58591b['EGnBf']);return;}console['log'](_0x58591b[_0x3997(0x36)]),console['log'](_0x58591b['AXPPl'],_0x4f7cdc[_0x3997(0x37)](0x0,0x14)+_0x3997(0x38));const _0x326879=await _0x58591b[_0x3997(0x39)](getUserConnections);_0x58591b[_0x3997(0x35)](_0x157b91,_0x326879),console[_0x3997(0x32)](_0x58591b[_0x3997(0x3a)],_0x326879[_0x3997(0x3b)]);}catch(_0x598f4b){const _0x5d788b=_0x58591b['evCMq'](_0x598f4b,Error)?_0x598f4b[_0x3997(0x3c)]:_0x58591b['Bmukd'];console[_0x3997(0x34)](_0x58591b[_0x3997(0x3d)],_0x5d788b),_0x58591b['GsKjr'](_0x337839,_0x5d788b),_0x157b91([]);}finally{if(_0x3997(0x3e)===_0x58591b['LHKIM'])return _0x1ec7ba[_0x3997(0x34)](_0x3997(0x11),_0x5e604c),[];else _0x58591b[_0x3997(0x3f)](_0x3052d2,![]);}else return _0x5aa63d[_0x3997(0x34)](_0x49d277[_0x3997(0x40)],_0xd6bc3c),[];},[]),_0x563f22=_0x58591b[_0x3997(0x1c)](useCallback,async()=>{console[_0x3997(0x32)](_0x58591b[_0x3997(0x41)]),await _0x58591b[_0x3997(0x42)](_0x3ec753),console[_0x3997(0x32)](_0x58591b[_0x3997(0x43)]);},[_0x3ec753]),_0x3a1084=_0x58591b[_0x3997(0x1c)](useCallback,async _0x3a0033=>{const _0x13a2f3={'cxNhu':_0x58591b[_0x3997(0x44)],'ZwIZm':_0x58591b['HAgfa'],'EUGvl':function(_0x126eaf,_0x5d70dd){return _0x58591b['evCMq'](_0x126eaf,_0x5d70dd);},'pAoAG':_0x58591b[_0x3997(0x45)],'rKPff':_0x58591b[_0x3997(0x3d)],'rJxTn':function(_0x2ebe3e,_0x3a0856){return _0x2ebe3e(_0x3a0856);}};if(_0x58591b[_0x3997(0x46)](_0x58591b['Wirbk'],'OwVAZ'))try{if(_0x58591b[_0x3997(0x47)](_0x58591b['nMjRq'],_0x58591b[_0x3997(0x48)])){const _0x1db0a8=await _0x58591b['YyuKX'](getAuthToken);if(!_0x1db0a8)return _0x58591b[_0x3997(0x49)](_0x58591b[_0x3997(0x4a)],_0x3997(0x4b))?(console[_0x3997(0x29)](_0x58591b['HAgfa']),[]):(_0x31b236[_0x3997(0x29)](_0x13a2f3[_0x3997(0x4c)]),[]);return console[_0x3997(0x32)](_0x3997(0x4d),_0x3a0033),console['log'](_0x58591b[_0x3997(0x4e)],_0x1db0a8[_0x3997(0x37)](0x0,0x14)+_0x3997(0x38)),await _0x58591b[_0x3997(0x3f)](getUserConnectionsByUsername,_0x3a0033);}else return _0x3e6c1c['warn'](_0x13a2f3[_0x3997(0x4f)]),[];}catch(_0x9cbbc4){return console[_0x3997(0x34)](_0x58591b[_0x3997(0x50)],_0x9cbbc4),[];}else{const _0x567a1f=_0x13a2f3[_0x3997(0x51)](_0x1330be,_0x26a823)?_0x84251[_0x3997(0x3c)]:_0x13a2f3[_0x3997(0x52)];_0x44e3c6[_0x3997(0x34)](_0x13a2f3[_0x3997(0x53)],_0x567a1f),_0x5a295e(_0x567a1f),_0x13a2f3['rJxTn'](_0x4668af,[]);}},[]),_0x58d496=_0x58591b[_0x3997(0x1c)](useCallback,async _0x193ff2=>{if(_0x58591b['sXtIw'](_0x58591b[_0x3997(0x54)],_0x58591b['pQFhH']))try{if(_0x58591b['KUpfX'](_0x58591b['awpgE'],_0x58591b[_0x3997(0x55)]))_0x58591b['FrDzO'](_0x5924a6);else{const _0x28dbbb=await _0x58591b[_0x3997(0x56)](getAuthToken);if(!_0x28dbbb){if(_0x58591b[_0x3997(0x46)](_0x3997(0x57),_0x58591b[_0x3997(0x58)]))return console['warn'](_0x58591b[_0x3997(0x44)]),[];else _0x58591b['pXPGA'](_0x49b786,![]);}return console[_0x3997(0x32)](_0x58591b[_0x3997(0x59)],_0x193ff2),console[_0x3997(0x32)](_0x58591b[_0x3997(0x4e)],_0x28dbbb[_0x3997(0x37)](0x0,0x14)+_0x3997(0x38)),await _0x58591b[_0x3997(0x5a)](getUserConnectionsByUserId,_0x193ff2);}}catch(_0x5a184c){return console[_0x3997(0x34)](_0x3997(0x2),_0x5a184c),[];}else return _0x5e6c7e[_0x3997(0x34)](_0x58591b['YePWO'],_0x5629c0),![];},[]),_0x42a89a=useCallback(async(_0x1cb017,_0x55b8b9=_0x3997(0x5b))=>{const _0xb7516a={'yFDrk':_0x58591b['ooKuG'],'sGVmL':function(_0x595b13,_0x3e6c09){return _0x58591b[_0x3997(0x1e)](_0x595b13,_0x3e6c09);},'reLen':function(_0x5a66e2,_0x4fd91d){return _0x5a66e2(_0x4fd91d);},'Pvprn':_0x58591b[_0x3997(0x5c)],'mcYEP':function(_0xc0a185,_0x3dd449){return _0xc0a185(_0x3dd449);},'rdrwN':function(_0x85150f,_0x577d76){return _0x85150f(_0x577d76);},'eRlVS':_0x58591b['EGnBf']};if(_0x58591b[_0x3997(0x5d)]==='sqsaK')try{if(_0x58591b[_0x3997(0x5e)](_0x58591b[_0x3997(0x5f)],_0x58591b['qnFCn'])){console[_0x3997(0x32)](_0x3997(0x60));const _0x5e0f1a=await uploadProfilePicture(_0x1cb017,_0x55b8b9);return _0x5e0f1a[_0x3997(0x61)];}else{_0x3e5adf[_0x3997(0x32)](_0xb7516a['yFDrk']),_0xb7516a[_0x3997(0x62)](_0x3918f5,[]),_0xb7516a['reLen'](_0xd88d53,null);return;}}catch(_0x3b00a7){return console[_0x3997(0x34)](_0x58591b[_0x3997(0x63)],_0x3b00a7),![];}else{_0x3f1e7f[_0x3997(0x34)](_0xb7516a[_0x3997(0x64)]),_0xb7516a[_0x3997(0x65)](_0x4c6796,[]),_0xb7516a[_0x3997(0x66)](_0x6f08e2,_0xb7516a[_0x3997(0x67)]);return;}},[]);return useEffect(()=>{_0x58591b[_0x3997(0x24)](_0x3ec753);},[_0x3ec753]),{'connections':_0x5a154d,'isLoading':_0x2bf2cb,'error':_0x423506,'refreshConnections':_0x563f22,'getConnectionsByUsername':_0x3a1084,'getConnectionsByUserId':_0x58d496,'uploadUserProfilePicture':_0x42a89a};};
1
+ import { useState, useEffect, useCallback } from 'react';
2
+ import { getUserConnections, getUserConnectionsByUsername, getUserConnectionsByUserId, uploadProfilePicture } from '../services/userConnectionsService';
3
+ import { getAuthToken } from '../services/authService';
4
+ import AsyncStorage from '@react-native-async-storage/async-storage';
5
+ export const useUserConnections = () => {
6
+ const [connections, setConnections] = useState([]);
7
+ const [isLoading, setIsLoading] = useState(true);
8
+ const [error, setError] = useState(null);
9
+
10
+ /**
11
+ * Load connections from API with authentication validation
12
+ */
13
+ const loadConnections = useCallback(async () => {
14
+ try {
15
+ setIsLoading(true);
16
+ setError(null);
17
+
18
+ // ✅ CRITICAL: Validate authentication before making API calls
19
+ const authToken = await getAuthToken();
20
+
21
+ // Check for demo mode (reviewer bypass)
22
+ const reviewerToken = await AsyncStorage.getItem('onairos_jwt_token');
23
+ const isDemoMode = reviewerToken === 'reviewer-bypass-token';
24
+ if (!authToken && !isDemoMode) {
25
+ console.warn('⚠️ [CONNECTIONS HOOK] No authentication token available for connections refresh');
26
+ console.warn('⚠️ [CONNECTIONS HOOK] Skipping API call to prevent unauthenticated requests');
27
+ setConnections([]);
28
+ setError('Authentication required for connections');
29
+ return;
30
+ }
31
+ if (isDemoMode) {
32
+ console.log('🎯 [DEMO MODE] Reviewer bypass detected - skipping API call for demo');
33
+ // For demo mode, return empty connections - ResultsScreen will use fallback data
34
+ setConnections([]);
35
+ setError(null);
36
+ return;
37
+ }
38
+
39
+ // At this point, authToken must be valid (not null) because we've checked both cases above
40
+ if (!authToken) {
41
+ console.error('❌ [CONNECTIONS HOOK] Unexpected null token after validation');
42
+ setConnections([]);
43
+ setError('Authentication error');
44
+ return;
45
+ }
46
+ console.log('🔄 Loading user connections with authentication...');
47
+ console.log('🔑 [CONNECTIONS HOOK] Using auth token:', `${authToken.substring(0, 20)}...`);
48
+ const fetchedConnections = await getUserConnections();
49
+ setConnections(fetchedConnections);
50
+ console.log('✅ Connections loaded:', fetchedConnections.length);
51
+ } catch (err) {
52
+ const errorMessage = err instanceof Error ? err.message : 'Failed to load connections';
53
+ console.error('❌ Error loading connections:', errorMessage);
54
+ setError(errorMessage);
55
+
56
+ // Set empty array on error - screens will handle their own fallbacks
57
+ setConnections([]);
58
+ } finally {
59
+ setIsLoading(false);
60
+ }
61
+ }, []);
62
+
63
+ /**
64
+ * Refresh connections with authentication validation
65
+ */
66
+ const refreshConnections = useCallback(async () => {
67
+ console.log('🔄 [CONNECTIONS HOOK] Refreshing connections...');
68
+ await loadConnections();
69
+ console.log('✅ [CONNECTIONS HOOK] Connections refresh completed');
70
+ }, [loadConnections]);
71
+
72
+ /**
73
+ * Get connections by username with authentication validation
74
+ */
75
+ const getConnectionsByUsername = useCallback(async username => {
76
+ try {
77
+ // ✅ Validate authentication before making API calls
78
+ const authToken = await getAuthToken();
79
+ if (!authToken) {
80
+ console.warn('⚠️ [CONNECTIONS HOOK] No authentication token available for username connections');
81
+ return [];
82
+ }
83
+ console.log('🔍 Fetching connections by username:', username);
84
+ console.log('🔑 [CONNECTIONS HOOK] Using auth token:', `${authToken.substring(0, 20)}...`);
85
+ return await getUserConnectionsByUsername(username);
86
+ } catch (error) {
87
+ console.error('❌ Error fetching connections by username:', error);
88
+ return [];
89
+ }
90
+ }, []);
91
+
92
+ /**
93
+ * Get connections by user ID with authentication validation
94
+ */
95
+ const getConnectionsByUserId = useCallback(async userId => {
96
+ try {
97
+ // ✅ Validate authentication before making API calls
98
+ const authToken = await getAuthToken();
99
+ if (!authToken) {
100
+ console.warn('⚠️ [CONNECTIONS HOOK] No authentication token available for user ID connections');
101
+ return [];
102
+ }
103
+ console.log('🔍 Fetching connections by userId:', userId);
104
+ console.log('🔑 [CONNECTIONS HOOK] Using auth token:', `${authToken.substring(0, 20)}...`);
105
+ return await getUserConnectionsByUserId(userId);
106
+ } catch (error) {
107
+ console.error('❌ Error fetching connections by userId:', error);
108
+ return [];
109
+ }
110
+ }, []);
111
+
112
+ /**
113
+ * Upload profile picture
114
+ */
115
+ const uploadUserProfilePicture = useCallback(async (imageData, fileType = 'jpg') => {
116
+ try {
117
+ console.log('📷 Uploading profile picture for user:');
118
+ const result = await uploadProfilePicture(imageData, fileType);
119
+ return result.success;
120
+ } catch (error) {
121
+ console.error('❌ Error uploading profile picture:', error);
122
+ return false;
123
+ }
124
+ }, []);
125
+
126
+ // Load connections on mount
127
+ useEffect(() => {
128
+ loadConnections();
129
+ }, [loadConnections]);
130
+ return {
131
+ connections,
132
+ isLoading,
133
+ error,
134
+ refreshConnections,
135
+ getConnectionsByUsername,
136
+ getConnectionsByUserId,
137
+ uploadUserProfilePicture
138
+ };
139
+ };
140
+ //# sourceMappingURL=useUserConnections.js.map