@onairos/react-native 3.7.1 → 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 (241) hide show
  1. package/lib/commonjs/api/index.js +219 -9
  2. package/lib/commonjs/assets/icons/spotify.png +0 -0
  3. package/lib/commonjs/assets/images/spotify.png +0 -0
  4. package/lib/commonjs/components/BodyText.js +27 -9
  5. package/lib/commonjs/components/BrandMark.js +111 -10
  6. package/lib/commonjs/components/CodeInput.js +116 -9
  7. package/lib/commonjs/components/EmailInput.js +30 -8
  8. package/lib/commonjs/components/GoogleButton.js +56 -9
  9. package/lib/commonjs/components/HeadingGroup.js +43 -9
  10. package/lib/commonjs/components/LLMDataInputModal.js +664 -14
  11. package/lib/commonjs/components/ModalHeader.js +99 -9
  12. package/lib/commonjs/components/ModalSheet.js +47 -9
  13. package/lib/commonjs/components/Onairos.js +380 -14
  14. package/lib/commonjs/components/OnairosButton.js +313 -13
  15. package/lib/commonjs/components/OnairosSignInButton.js +130 -12
  16. package/lib/commonjs/components/Overlay.js +465 -13
  17. package/lib/commonjs/components/PersonaImage.js +137 -10
  18. package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
  19. package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
  20. package/lib/commonjs/components/PinCreationScreen.js +403 -12
  21. package/lib/commonjs/components/PinInput.js +464 -9
  22. package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
  23. package/lib/commonjs/components/PlatformList.js +137 -10
  24. package/lib/commonjs/components/PlatformToggle.js +180 -9
  25. package/lib/commonjs/components/PrimaryButton.js +180 -10
  26. package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
  27. package/lib/commonjs/components/SignInStep.js +345 -12
  28. package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
  29. package/lib/commonjs/components/VerificationStep.js +176 -11
  30. package/lib/commonjs/components/WelcomeScreen.js +461 -22
  31. package/lib/commonjs/components/icons/Basicproficon.js +37 -8
  32. package/lib/commonjs/components/icons/Basicprofile.js +21 -8
  33. package/lib/commonjs/components/icons/Checkbox.js +21 -8
  34. package/lib/commonjs/components/icons/Checkmark.js +27 -8
  35. package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
  36. package/lib/commonjs/components/icons/Contenticon.js +39 -8
  37. package/lib/commonjs/components/icons/EnochE.js +41 -8
  38. package/lib/commonjs/components/icons/Personalityicon.js +30 -8
  39. package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
  40. package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
  41. package/lib/commonjs/components/icons/Userpreferences.js +21 -8
  42. package/lib/commonjs/components/icons/index.js +84 -17
  43. package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
  44. package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
  45. package/lib/commonjs/components/onboarding/PinInput.js +283 -10
  46. package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
  47. package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
  48. package/lib/commonjs/config/api.js +56 -7
  49. package/lib/commonjs/constants/index.js +120 -7
  50. package/lib/commonjs/context/AuthContext.js +345 -10
  51. package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
  52. package/lib/commonjs/hooks/useConnections.js +102 -8
  53. package/lib/commonjs/hooks/useCredentials.js +178 -10
  54. package/lib/commonjs/hooks/useUserConnections.js +148 -10
  55. package/lib/commonjs/index.js +439 -34
  56. package/lib/commonjs/services/apiClient.js +298 -8
  57. package/lib/commonjs/services/biometricPinService.js +180 -8
  58. package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
  59. package/lib/commonjs/services/chatGPTConversationService.js +275 -9
  60. package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
  61. package/lib/commonjs/services/claudeConversationService.js +158 -9
  62. package/lib/commonjs/services/connectedAccountsService.js +310 -10
  63. package/lib/commonjs/services/googleAuthService.js +252 -11
  64. package/lib/commonjs/services/hingeDataExtractor.js +105 -8
  65. package/lib/commonjs/services/hingeDataService.js +150 -9
  66. package/lib/commonjs/services/imageCompressionService.js +260 -7
  67. package/lib/commonjs/services/instagramDataExtractor.js +126 -8
  68. package/lib/commonjs/services/instagramDataService.js +163 -9
  69. package/lib/commonjs/services/jwtStorageService.js +276 -7
  70. package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
  71. package/lib/commonjs/services/linkedinProfileService.js +222 -9
  72. package/lib/commonjs/services/linkedinScrapingService.js +230 -8
  73. package/lib/commonjs/services/llmDataStorage.js +294 -8
  74. package/lib/commonjs/services/mobileTrainingService.js +186 -8
  75. package/lib/commonjs/services/netflixDataExtractor.js +120 -8
  76. package/lib/commonjs/services/netflixDataService.js +198 -9
  77. package/lib/commonjs/services/pinEncryptionService.js +84 -8
  78. package/lib/commonjs/services/pinStorageUtils.js +105 -7
  79. package/lib/commonjs/services/platformAuthService.js +1484 -12
  80. package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
  81. package/lib/commonjs/services/sephoraDataService.js +200 -9
  82. package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
  83. package/lib/commonjs/services/spotifyDataService.js +241 -9
  84. package/lib/commonjs/services/storageService.js +404 -8
  85. package/lib/commonjs/services/telegramDataExtractor.js +115 -8
  86. package/lib/commonjs/services/telegramDataService.js +499 -9
  87. package/lib/commonjs/services/trainingApiHelpers.js +73 -7
  88. package/lib/commonjs/services/userConnectionsService.js +340 -10
  89. package/lib/commonjs/services/youtubeMigrationService.js +416 -10
  90. package/lib/commonjs/theme/index.js +250 -7
  91. package/lib/commonjs/types/ambient.d.js +2 -1
  92. package/lib/commonjs/types/declarations.d.js +2 -1
  93. package/lib/commonjs/types/index.js +6 -1
  94. package/lib/commonjs/types/node-fix.d.js +2 -1
  95. package/lib/commonjs/types/node-override.d.js +2 -1
  96. package/lib/commonjs/types/opacity.d.js +2 -1
  97. package/lib/commonjs/types.js +14 -1
  98. package/lib/commonjs/utils/Portal.js +98 -8
  99. package/lib/commonjs/utils/api.js +130 -9
  100. package/lib/commonjs/utils/assetRegistry.js +210 -35
  101. package/lib/commonjs/utils/auth.js +112 -9
  102. package/lib/commonjs/utils/connectorTests.js +613 -29
  103. package/lib/commonjs/utils/crypto.js +62 -8
  104. package/lib/commonjs/utils/debugHelper.js +64 -1
  105. package/lib/commonjs/utils/encryption.js +76 -7
  106. package/lib/commonjs/utils/eventUtils.js +288 -1
  107. package/lib/commonjs/utils/haptics.js +66 -9
  108. package/lib/commonjs/utils/imagePreloader.js +6 -1
  109. package/lib/commonjs/utils/networkDiagnostics.js +226 -8
  110. package/lib/commonjs/utils/onairosApi.js +350 -9
  111. package/lib/commonjs/utils/programmaticFlow.js +117 -9
  112. package/lib/commonjs/utils/retryHelper.js +220 -1
  113. package/lib/commonjs/utils/secureStorage.js +349 -10
  114. package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
  115. package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
  116. package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
  117. package/lib/commonjs/utils/webviewScripts/index.js +698 -15
  118. package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
  119. package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
  120. package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
  121. package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
  122. package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
  123. package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
  124. package/lib/module/api/index.js +211 -1
  125. package/lib/module/assets/icons/spotify.png +0 -0
  126. package/lib/module/assets/images/spotify.png +0 -0
  127. package/lib/module/components/BodyText.js +20 -1
  128. package/lib/module/components/BrandMark.js +104 -1
  129. package/lib/module/components/CodeInput.js +109 -1
  130. package/lib/module/components/EmailInput.js +23 -1
  131. package/lib/module/components/GoogleButton.js +49 -1
  132. package/lib/module/components/HeadingGroup.js +36 -1
  133. package/lib/module/components/LLMDataInputModal.js +656 -7
  134. package/lib/module/components/ModalHeader.js +92 -1
  135. package/lib/module/components/ModalSheet.js +39 -1
  136. package/lib/module/components/Onairos.js +373 -1
  137. package/lib/module/components/OnairosButton.js +305 -1
  138. package/lib/module/components/OnairosSignInButton.js +121 -1
  139. package/lib/module/components/Overlay.js +456 -1
  140. package/lib/module/components/PersonaImage.js +129 -1
  141. package/lib/module/components/PersonaLoadingScreen.js +310 -1
  142. package/lib/module/components/PersonalizationConsentScreen.js +460 -1
  143. package/lib/module/components/PinCreationScreen.js +396 -1
  144. package/lib/module/components/PinInput.js +456 -1
  145. package/lib/module/components/PlatformConnectorsStep.js +1302 -6
  146. package/lib/module/components/PlatformList.js +129 -1
  147. package/lib/module/components/PlatformToggle.js +173 -1
  148. package/lib/module/components/PrimaryButton.js +172 -1
  149. package/lib/module/components/SignInMatchAnimation.js +189 -1
  150. package/lib/module/components/SignInStep.js +338 -1
  151. package/lib/module/components/UniversalOnboarding.js +2770 -1
  152. package/lib/module/components/VerificationStep.js +168 -1
  153. package/lib/module/components/WelcomeScreen.js +453 -1
  154. package/lib/module/components/icons/Basicproficon.js +30 -1
  155. package/lib/module/components/icons/Basicprofile.js +14 -1
  156. package/lib/module/components/icons/Checkbox.js +14 -1
  157. package/lib/module/components/icons/Checkmark.js +20 -1
  158. package/lib/module/components/icons/Contentanalysis.js +14 -1
  159. package/lib/module/components/icons/Contenticon.js +32 -1
  160. package/lib/module/components/icons/EnochE.js +34 -1
  161. package/lib/module/components/icons/Personalityicon.js +23 -1
  162. package/lib/module/components/icons/Personalityprofile.js +14 -1
  163. package/lib/module/components/icons/Personalitytraits.js +14 -1
  164. package/lib/module/components/icons/Userpreferences.js +14 -1
  165. package/lib/module/components/icons/index.js +13 -1
  166. package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
  167. package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
  168. package/lib/module/components/onboarding/PinInput.js +274 -1
  169. package/lib/module/components/onboarding/PlatformConnector.js +240 -1
  170. package/lib/module/config/PLATFORM_APIS.md +849 -0
  171. package/lib/module/config/api.js +47 -1
  172. package/lib/module/constants/index.js +114 -1
  173. package/lib/module/context/AuthContext.js +335 -1
  174. package/lib/module/hooks/useConnectedAccounts.js +106 -1
  175. package/lib/module/hooks/useConnections.js +95 -1
  176. package/lib/module/hooks/useCredentials.js +171 -6
  177. package/lib/module/hooks/useUserConnections.js +140 -1
  178. package/lib/module/index.js +172 -1
  179. package/lib/module/services/apiClient.js +295 -1
  180. package/lib/module/services/biometricPinService.js +169 -1
  181. package/lib/module/services/chatGPTConversationExtractor.js +149 -1
  182. package/lib/module/services/chatGPTConversationService.js +268 -1
  183. package/lib/module/services/claudeConversationExtractor.js +97 -1
  184. package/lib/module/services/claudeConversationService.js +151 -1
  185. package/lib/module/services/connectedAccountsService.js +293 -1
  186. package/lib/module/services/googleAuthService.js +241 -1
  187. package/lib/module/services/hingeDataExtractor.js +99 -1
  188. package/lib/module/services/hingeDataService.js +143 -1
  189. package/lib/module/services/imageCompressionService.js +250 -1
  190. package/lib/module/services/instagramDataExtractor.js +120 -1
  191. package/lib/module/services/instagramDataService.js +156 -1
  192. package/lib/module/services/jwtStorageService.js +257 -1
  193. package/lib/module/services/linkedinDOMExtractor.js +234 -1
  194. package/lib/module/services/linkedinProfileService.js +210 -1
  195. package/lib/module/services/linkedinScrapingService.js +219 -1
  196. package/lib/module/services/llmDataStorage.js +277 -1
  197. package/lib/module/services/mobileTrainingService.js +173 -1
  198. package/lib/module/services/netflixDataExtractor.js +114 -1
  199. package/lib/module/services/netflixDataService.js +191 -1
  200. package/lib/module/services/pinEncryptionService.js +74 -6
  201. package/lib/module/services/pinStorageUtils.js +93 -1
  202. package/lib/module/services/platformAuthService.js +1461 -1
  203. package/lib/module/services/sephoraDataExtractor.js +134 -1
  204. package/lib/module/services/sephoraDataService.js +193 -1
  205. package/lib/module/services/spotifyDataExtractor.js +142 -1
  206. package/lib/module/services/spotifyDataService.js +234 -1
  207. package/lib/module/services/storageService.js +383 -1
  208. package/lib/module/services/telegramDataExtractor.js +109 -1
  209. package/lib/module/services/telegramDataService.js +493 -1
  210. package/lib/module/services/trainingApiHelpers.js +67 -1
  211. package/lib/module/services/userConnectionsService.js +329 -1
  212. package/lib/module/services/youtubeMigrationService.js +405 -1
  213. package/lib/module/theme/index.js +245 -1
  214. package/lib/module/types.js +10 -1
  215. package/lib/module/utils/Portal.js +90 -1
  216. package/lib/module/utils/api.js +118 -1
  217. package/lib/module/utils/assetRegistry.js +200 -34
  218. package/lib/module/utils/auth.js +100 -1
  219. package/lib/module/utils/connectorTests.js +600 -27
  220. package/lib/module/utils/crypto.js +54 -1
  221. package/lib/module/utils/debugHelper.js +54 -1
  222. package/lib/module/utils/encryption.js +67 -1
  223. package/lib/module/utils/eventUtils.js +270 -1
  224. package/lib/module/utils/haptics.js +59 -8
  225. package/lib/module/utils/imagePreloader.js +3 -1
  226. package/lib/module/utils/networkDiagnostics.js +217 -1
  227. package/lib/module/utils/onairosApi.js +333 -1
  228. package/lib/module/utils/programmaticFlow.js +111 -1
  229. package/lib/module/utils/retryHelper.js +211 -1
  230. package/lib/module/utils/secureStorage.js +330 -6
  231. package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
  232. package/lib/module/utils/webviewScripts/claude.js +370 -1
  233. package/lib/module/utils/webviewScripts/hinge.js +405 -1
  234. package/lib/module/utils/webviewScripts/index.js +434 -1
  235. package/lib/module/utils/webviewScripts/instagram.js +448 -1
  236. package/lib/module/utils/webviewScripts/linkedin.js +874 -1
  237. package/lib/module/utils/webviewScripts/netflix.js +376 -1
  238. package/lib/module/utils/webviewScripts/sephora.js +510 -1
  239. package/lib/module/utils/webviewScripts/spotify.js +413 -1
  240. package/lib/module/utils/webviewScripts/telegram.js +672 -1
  241. package/package.json +2 -2
@@ -1,9 +1,158 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("../config/api"),
5
- require("@react-native-async-storage/async-storage"),
6
- require("react-native")
7
- ];
8
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
9
- function _0x90ce(_0x5e2228,_0x90cea){_0x5e2228=_0x5e2228-0x0;const _0x10af67=_0x5e22();let _0x377e62=_0x10af67[_0x5e2228];return _0x377e62;}Object['defineProperty'](exports,_0x90ce(0x0),{'value':!![]}),exports['storeClaudeConversations']=void 0x0;var _api=__ONAIROS_REQ_FUNC__(0x0),_asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x1)),_reactNative=__ONAIROS_REQ_FUNC__(0x2);function _interopRequireDefault(_0x16ff32){return _0x16ff32&&_0x16ff32[_0x90ce(0x0)]?_0x16ff32:{'default':_0x16ff32};}function _0x5e22(){const _0x5347b1=['__esModule','📊\x20[CLAUDE_SERVICE]\x20Number\x20of\x20conversations:','❌\x20[CLAUDE_SERVICE]\x20Invalid\x20input','RZdnm','onairos_jwt_token','enoch_token','auth_token','❌\x20[CLAUDE_SERVICE]\x20No\x20auth\x20token\x20found\x20in\x20any\x20storage\x20key','Authentication\x20token\x20not\x20found.\x20Please\x20log\x20in\x20again.','1.0.0','17.0','iPhone','Android','xqrsf','mobile-claude','conversation','YGGTC','❌\x20[CLAUDE_SERVICE]\x20Network\x20error:','Network\x20error.\x20Please\x20check\x20your\x20connection.','log','🚀\x20[CLAUDE_SERVICE]\x20Storing\x20Claude\x20conversations\x20for:','CPBlj','length','umhtG','user_messages','IvGzh','error','BSREf','SvqkN','⚠️\x20[CLAUDE_SERVICE]\x20Failed\x20conversation\x20','status','default','getItem','HjFSa','FWlvH','VPHhj','XrfbJ','jbxqt','Platform','WtKWY','BVNzB','vwBax','SEAuf','wcKCC','dMWaI','GNHHq','now','map','conversation_id','toISOString','floor','srUWD','BWHVf','EJcQh','📡\x20[CLAUDE_SERVICE]\x20Sending\x20conversation\x20','title','API_CONFIG','BASE_URL','/llm-data/store','OnairosSDK/1.0.0\x20(','json','✅\x20[CLAUDE_SERVICE]\x20Sent\x20conversation\x20','MQksY','aMjul','Yssut','\x20of\x20','\x20conversations','📊\x20[CLAUDE_SERVICE]\x20Complete:\x20','\x20failed','yaghV','rEwKe','Stored\x20','Failed\x20to\x20store\x20conversations\x20(','\x20errors)','vXbVe','message','storeClaudeConversations'];_0x5e22=function(){return _0x5347b1;};return _0x5e22();}const storeClaudeConversations=async(_0x4d29c4,_0x92c0bb)=>{const _0x507d3b={'CPBlj':_0x90ce(0x1),'umhtG':'📊\x20[CLAUDE_SERVICE]\x20Total\x20messages:','IvGzh':function(_0x245fc4,_0xb7ab21){return _0x245fc4||_0xb7ab21;},'ZDXot':_0x90ce(0x2),'BSREf':'Invalid\x20input:\x20userId\x20or\x20conversations\x20missing.','SvqkN':_0x90ce(0x3),'HjFSa':_0x90ce(0x4),'FWlvH':_0x90ce(0x5),'VPHhj':_0x90ce(0x6),'byexi':_0x90ce(0x7),'XrfbJ':_0x90ce(0x8),'jbxqt':'🔑\x20[CLAUDE_SERVICE]\x20Auth\x20token\x20found','WtKWY':_0x90ce(0x9),'BVNzB':function(_0x4eeff0,_0x16d120){return _0x4eeff0===_0x16d120;},'vwBax':'ios','SEAuf':_0x90ce(0xa),'wcKCC':_0x90ce(0xb),'wdZiV':_0x90ce(0xc),'dMWaI':function(_0x3c233e,_0x4c28ec){return _0x3c233e<_0x4c28ec;},'GNHHq':_0x90ce(0xd),'srUWD':function(_0x4e9e17,_0x14cc94){return _0x4e9e17/_0x14cc94;},'BWHVf':function(_0x2c49fa,_0x1d0819){return _0x2c49fa/_0x1d0819;},'OcYZZ':_0x90ce(0xe),'EJcQh':_0x90ce(0xf),'MQksY':function(_0x18ca42,_0x460480){return _0x18ca42+_0x460480;},'aMjul':function(_0x63799e,_0x18bbcb){return _0x63799e+_0x18bbcb;},'Yssut':function(_0x5eab2e,_0x5f471d){return _0x5eab2e-_0x5f471d;},'KwVbJ':function(_0x38d28f,_0x207bf9){return _0x38d28f>_0x207bf9;},'yaghV':_0x90ce(0x10),'vXbVe':_0x90ce(0x11),'sogdr':_0x90ce(0x12)};console[_0x90ce(0x13)](_0x90ce(0x14),_0x4d29c4),console[_0x90ce(0x13)](_0x507d3b[_0x90ce(0x15)],_0x92c0bb[_0x90ce(0x16)]),console[_0x90ce(0x13)](_0x507d3b[_0x90ce(0x17)],_0x92c0bb['reduce']((_0x31d986,_0x33ecc8)=>_0x31d986+_0x33ecc8[_0x90ce(0x18)]['length'],0x0));if(_0x507d3b[_0x90ce(0x19)](!_0x4d29c4,!_0x92c0bb)||_0x92c0bb[_0x90ce(0x16)]===0x0)return console[_0x90ce(0x1a)](_0x507d3b['ZDXot']),{'success':![],'error':_0x507d3b[_0x90ce(0x1b)]};try{if(_0x507d3b[_0x90ce(0x1c)]!==_0x90ce(0x3))_0x4b8365['warn'](_0x90ce(0x1d)+(_0x5c3fb4+0x1)+'/'+_0x4881ff[_0x90ce(0x16)]+':',_0x46f967[_0x90ce(0x1a)]||_0xb40577[_0x90ce(0x1e)]),_0x3b1b2d++;else{const _0x2132dc=await _asyncStorage[_0x90ce(0x1f)][_0x90ce(0x20)](_0x507d3b[_0x90ce(0x21)])||await _asyncStorage[_0x90ce(0x1f)][_0x90ce(0x20)](_0x507d3b[_0x90ce(0x22)])||await _asyncStorage[_0x90ce(0x1f)][_0x90ce(0x20)](_0x507d3b[_0x90ce(0x23)]);if(!_0x2132dc)return console[_0x90ce(0x1a)](_0x507d3b['byexi']),{'success':![],'error':_0x507d3b[_0x90ce(0x24)]};console['log'](_0x507d3b[_0x90ce(0x25)]);const _0x226cca={'platform':_reactNative[_0x90ce(0x26)]['OS'],'appVersion':_0x507d3b[_0x90ce(0x27)],'osVersion':_0x507d3b[_0x90ce(0x28)](_reactNative[_0x90ce(0x26)]['OS'],_0x507d3b[_0x90ce(0x29)])?_0x507d3b[_0x90ce(0x2a)]:_reactNative[_0x90ce(0x26)]['OS'],'deviceModel':_reactNative['Platform']['OS']===_0x507d3b[_0x90ce(0x29)]?_0x507d3b[_0x90ce(0x2b)]:_0x507d3b['wdZiV'],'isOfflineSync':![]};let _0x2cae1b=0x0,_0x3a426a=0x0;for(let _0x51b960=0x0;_0x507d3b[_0x90ce(0x2c)](_0x51b960,_0x92c0bb['length']);_0x51b960++){if(_0x507d3b[_0x90ce(0x28)](_0x507d3b['GNHHq'],_0x507d3b[_0x90ce(0x2d)])){const _0x1d156a=_0x92c0bb[_0x51b960],_0x4cf8b8=Date[_0x90ce(0x2e)](),_0x549179=_0x1d156a[_0x90ce(0x18)][_0x90ce(0x2f)]((_0x23d0b1,_0x592271)=>({'id':_0x1d156a[_0x90ce(0x30)]+'-msg-'+_0x592271,'role':'user','content':_0x23d0b1,'timestamp':new Date(_0x4cf8b8-(_0x1d156a[_0x90ce(0x18)][_0x90ce(0x16)]-_0x592271)*0x3e8)[_0x90ce(0x31)](),'metadata':{}})),_0x5a8007={'conversationId':_0x1d156a['conversation_id'],'messages':_0x549179,'context':{'title':_0x1d156a['title'],'create_time':Math[_0x90ce(0x32)](_0x507d3b[_0x90ce(0x33)](_0x4cf8b8,0x3e8)),'update_time':Math[_0x90ce(0x32)](_0x507d3b[_0x90ce(0x34)](_0x4cf8b8,0x3e8))},'mobileMetadata':_0x226cca},_0x4bc95b={'platform':_0x507d3b['OcYZZ'],'conversationData':_0x5a8007,'memoryType':_0x507d3b[_0x90ce(0x35)]};console['log'](_0x90ce(0x36)+(_0x51b960+0x1)+'/'+_0x92c0bb['length']+':\x20'+_0x1d156a[_0x90ce(0x37)]);try{const _0x589fc6=await fetch(_api[_0x90ce(0x38)][_0x90ce(0x39)]+_0x90ce(0x3a),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x2132dc,'User-Agent':_0x90ce(0x3b)+_reactNative['Platform']['OS']+')'},'body':JSON['stringify'](_0x4bc95b)}),_0x7eb3fb=await _0x589fc6[_0x90ce(0x3c)]();_0x589fc6['ok']?(console['log'](_0x90ce(0x3d)+_0x507d3b[_0x90ce(0x3e)](_0x51b960,0x1)+'/'+_0x92c0bb[_0x90ce(0x16)]),_0x2cae1b++):(console['warn'](_0x90ce(0x1d)+_0x507d3b[_0x90ce(0x3f)](_0x51b960,0x1)+'/'+_0x92c0bb[_0x90ce(0x16)]+':',_0x7eb3fb[_0x90ce(0x1a)]||_0x589fc6['status']),_0x3a426a++);}catch(_0x51b747){console['warn']('⚠️\x20[CLAUDE_SERVICE]\x20Network\x20error\x20for\x20conversation\x20'+(_0x51b960+0x1)+':',_0x51b747),_0x3a426a++;}_0x51b960<_0x507d3b[_0x90ce(0x40)](_0x92c0bb['length'],0x1)&&await new Promise(_0xe93f6a=>setTimeout(_0xe93f6a,0x12c));}else return{'success':!![],'message':'Stored\x20'+_0xe469de+_0x90ce(0x41)+_0x4b35e9[_0x90ce(0x16)]+_0x90ce(0x42)};}return console['log'](_0x90ce(0x43)+_0x2cae1b+'\x20success,\x20'+_0x3a426a+_0x90ce(0x44)),_0x507d3b['KwVbJ'](_0x2cae1b,0x0)?_0x507d3b[_0x90ce(0x45)]!==_0x90ce(0x46)?{'success':!![],'message':_0x90ce(0x47)+_0x2cae1b+'\x20of\x20'+_0x92c0bb['length']+_0x90ce(0x42)}:_0x603ffc&&_0x4db6bf[_0x90ce(0x0)]?_0x420985:{'default':_0x38d725}:{'success':![],'error':_0x90ce(0x48)+_0x3a426a+_0x90ce(0x49)};}}catch(_0x4bc3c3){return console['error'](_0x507d3b[_0x90ce(0x4a)],_0x4bc3c3),{'success':![],'error':_0x4bc3c3[_0x90ce(0x4b)]||_0x507d3b['sogdr']};}};exports[_0x90ce(0x4c)]=storeClaudeConversations;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.storeClaudeConversations = void 0;
7
+ var _api = require("../config/api");
8
+ var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
9
+ var _reactNative = require("react-native");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ /**
12
+ * Claude Conversation Service
13
+ *
14
+ * API layer for storing Claude conversation data on backend.
15
+ * Sends extracted user messages to /llm-data/store endpoint.
16
+ *
17
+ * MATCHES Enoch implementation pattern
18
+ * - Sends ONE request per conversation (not all at once)
19
+ * - Uses format: { conversationId, messages[], context }
20
+ * - Platform: "mobile-claude"
21
+ */
22
+
23
+ /**
24
+ * Structure of conversation messages extracted from Claude
25
+ */
26
+
27
+ /**
28
+ * Response from backend /llm-data/store endpoint
29
+ */
30
+
31
+ /**
32
+ * Store Claude conversations on backend
33
+ * Sends one request per conversation (matches ChatGPT pattern)
34
+ *
35
+ * @param userId - Username or identifier
36
+ * @param conversations - Array of conversations with user messages
37
+ * @returns Response indicating success/failure with metadata
38
+ */
39
+ const storeClaudeConversations = async (userId, conversations) => {
40
+ console.log('🚀 [CLAUDE_SERVICE] Storing Claude conversations for:', userId);
41
+ console.log('📊 [CLAUDE_SERVICE] Number of conversations:', conversations.length);
42
+ console.log('📊 [CLAUDE_SERVICE] Total messages:', conversations.reduce((sum, c) => sum + c.user_messages.length, 0));
43
+
44
+ // Input validation
45
+ if (!userId || !conversations || conversations.length === 0) {
46
+ console.error('❌ [CLAUDE_SERVICE] Invalid input');
47
+ return {
48
+ success: false,
49
+ error: 'Invalid input: userId or conversations missing.'
50
+ };
51
+ }
52
+ try {
53
+ // Get auth token - check all possible storage keys (matches rest of codebase)
54
+ const authToken = (await _asyncStorage.default.getItem('onairos_jwt_token')) || (await _asyncStorage.default.getItem('enoch_token')) || (await _asyncStorage.default.getItem('auth_token'));
55
+ if (!authToken) {
56
+ console.error('❌ [CLAUDE_SERVICE] No auth token found in any storage key');
57
+ return {
58
+ success: false,
59
+ error: 'Authentication token not found. Please log in again.'
60
+ };
61
+ }
62
+ console.log('🔑 [CLAUDE_SERVICE] Auth token found');
63
+
64
+ // Mobile metadata
65
+ const mobileMetadata = {
66
+ platform: _reactNative.Platform.OS,
67
+ appVersion: '1.0.0',
68
+ osVersion: _reactNative.Platform.OS === 'ios' ? '17.0' : _reactNative.Platform.OS,
69
+ deviceModel: _reactNative.Platform.OS === 'ios' ? 'iPhone' : 'Android',
70
+ isOfflineSync: false
71
+ };
72
+ let successCount = 0;
73
+ let failCount = 0;
74
+
75
+ // Send ONE request per conversation (matches ChatGPT pattern)
76
+ for (let i = 0; i < conversations.length; i++) {
77
+ const conv = conversations[i];
78
+ const now = Date.now();
79
+
80
+ // Build messages array matching format
81
+ const messages = conv.user_messages.map((content, msgIndex) => ({
82
+ id: `${conv.conversation_id}-msg-${msgIndex}`,
83
+ role: 'user',
84
+ content: content,
85
+ timestamp: new Date(now - (conv.user_messages.length - msgIndex) * 1000).toISOString(),
86
+ metadata: {}
87
+ }));
88
+
89
+ // Build conversationData
90
+ const conversationData = {
91
+ conversationId: conv.conversation_id,
92
+ messages: messages,
93
+ context: {
94
+ title: conv.title,
95
+ create_time: Math.floor(now / 1000),
96
+ update_time: Math.floor(now / 1000)
97
+ },
98
+ mobileMetadata: mobileMetadata
99
+ };
100
+
101
+ // Request body
102
+ const requestBody = {
103
+ platform: 'mobile-claude',
104
+ // Claude platform identifier
105
+ conversationData: conversationData,
106
+ memoryType: 'conversation'
107
+ };
108
+ console.log(`📡 [CLAUDE_SERVICE] Sending conversation ${i + 1}/${conversations.length}: ${conv.title}`);
109
+ try {
110
+ const response = await fetch(`${_api.API_CONFIG.BASE_URL}/llm-data/store`, {
111
+ method: 'POST',
112
+ headers: {
113
+ 'Content-Type': 'application/json',
114
+ 'Authorization': `Bearer ${authToken}`,
115
+ 'User-Agent': `OnairosSDK/1.0.0 (${_reactNative.Platform.OS})`
116
+ },
117
+ body: JSON.stringify(requestBody)
118
+ });
119
+ const responseData = await response.json();
120
+ if (response.ok) {
121
+ console.log(`✅ [CLAUDE_SERVICE] Sent conversation ${i + 1}/${conversations.length}`);
122
+ successCount++;
123
+ } else {
124
+ console.warn(`⚠️ [CLAUDE_SERVICE] Failed conversation ${i + 1}/${conversations.length}:`, responseData.error || response.status);
125
+ failCount++;
126
+ }
127
+ } catch (convError) {
128
+ console.warn(`⚠️ [CLAUDE_SERVICE] Network error for conversation ${i + 1}:`, convError);
129
+ failCount++;
130
+ }
131
+
132
+ // Small delay between requests (0.3s like ChatGPT)
133
+ if (i < conversations.length - 1) {
134
+ await new Promise(resolve => setTimeout(resolve, 300));
135
+ }
136
+ }
137
+ console.log(`📊 [CLAUDE_SERVICE] Complete: ${successCount} success, ${failCount} failed`);
138
+ if (successCount > 0) {
139
+ return {
140
+ success: true,
141
+ message: `Stored ${successCount} of ${conversations.length} conversations`
142
+ };
143
+ } else {
144
+ return {
145
+ success: false,
146
+ error: `Failed to store conversations (${failCount} errors)`
147
+ };
148
+ }
149
+ } catch (error) {
150
+ console.error('❌ [CLAUDE_SERVICE] Network error:', error);
151
+ return {
152
+ success: false,
153
+ error: error.message || 'Network error. Please check your connection.'
154
+ };
155
+ }
156
+ };
157
+ exports.storeClaudeConversations = storeClaudeConversations;
158
+ //# sourceMappingURL=claudeConversationService.js.map
@@ -1,10 +1,310 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("./authService"),
5
- require("../config/api"),
6
- require("./apiKeyService"),
7
- require("../utils/assetRegistry")
8
- ];
9
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
10
- Object['defineProperty'](exports,_0x542f(0x0),{'value':!![]}),exports[_0x542f(0x1)]=exports[_0x542f(0x2)]=exports[_0x542f(0x3)]=exports['getConnectedAccountsByUsername']=exports['getConnectedAccountsByUserId']=exports[_0x542f(0x4)]=void 0x0,Object[_0x542f(0x5)](exports,_0x542f(0x6),{'enumerable':!![],'get':function(){return _assetRegistry[_0x542f(0x7)];}});var _authService=__ONAIROS_REQ_FUNC__(0x0),_api=__ONAIROS_REQ_FUNC__(0x1),_apiKeyService=__ONAIROS_REQ_FUNC__(0x2),_assetRegistry=__ONAIROS_REQ_FUNC__(0x3);const API_BASE_URL=_api[_0x542f(0x8)][_0x542f(0x9)],getDeveloperAuthHeaders=()=>{const _0x5a1a07={'nwcgo':_0x542f(0xa),'gbfWX':'MyaoJ','cXrHk':_0x542f(0xb),'gCFYS':function(_0x521138,_0x6bba8f){return _0x521138!==_0x6bba8f;},'WpJsL':'veShK','LhTcx':_0x542f(0xc)};if(!(0x0,_apiKeyService[_0x542f(0xd)])())return _0x5a1a07[_0x542f(0xe)]!=='MyaoJ'?(_0x1f91b1[_0x542f(0xf)](_0x5a1a07['nwcgo']),[]):(console['warn'](_0x5a1a07['cXrHk']),(0x0,_api[_0x542f(0x10)])());const _0x11d3f0=(0x0,_apiKeyService[_0x542f(0x11)])();if(!(_0x5a1a07[_0x542f(0x12)](_0x11d3f0,null)&&_0x5a1a07[_0x542f(0x12)](_0x11d3f0,void 0x0)&&_0x11d3f0[_0x542f(0x13)]))return _0x5a1a07['WpJsL']===_0x5a1a07[_0x542f(0x14)]?(0x0,_api['getApiHeaders'])():(0x0,_0x24c715[_0x542f(0x10)])();return{...(0x0,_api[_0x542f(0x10)])(),'Authorization':'Bearer\x20'+_0x11d3f0[_0x542f(0x13)],'X-SDK-Version':_0x5a1a07[_0x542f(0x15)],'X-SDK-Platform':'react-native'};},getConnectedAccountsLookup=async _0x584607=>{const _0xd669c5={'FxKCD':_0x542f(0x16),'qxkBt':function(_0x5c0235,_0x795b48){return _0x5c0235===_0x795b48;},'sTaas':_0x542f(0x17),'ayNpU':_0x542f(0x18),'zUSbQ':_0x542f(0x19),'hvQUx':function(_0x3adff8,_0x487a0e){return _0x3adff8(_0x487a0e);},'PtILn':function(_0x3d4e1b){return _0x3d4e1b();},'XLCCE':_0x542f(0x1a),'KfRWn':function(_0x41df6d,_0x1ae6f4){return _0x41df6d>_0x1ae6f4;},'AJuvC':'ℹ️\x20[NEW\x20API]\x20No\x20connected\x20accounts\x20found\x20for\x20user','JzAdh':'❌\x20[NEW\x20API]\x20Error\x20fetching\x20connected\x20accounts\x20via\x20lookup:'};try{if(_0xd669c5['qxkBt'](_0xd669c5[_0x542f(0x1b)],_0xd669c5['ayNpU']))return _0x4fd889[_0x542f(0xf)](_0xd669c5[_0x542f(0x1c)]),_0x128ca5;else{console[_0x542f(0xf)](_0xd669c5[_0x542f(0x1d)],_0x584607);const _0x2d5496=await(0x0,_authService[_0x542f(0x1e)])(),_0x315e2f=await fetch(API_BASE_URL+_0x542f(0x1f)+_0xd669c5[_0x542f(0x20)](encodeURIComponent,_0x584607),{'method':'GET','headers':_0x2d5496?(0x0,_api[_0x542f(0x21)])(_0x2d5496):_0xd669c5[_0x542f(0x22)](getDeveloperAuthHeaders)});if(_0x315e2f['ok']){const _0x48aebb=await _0x315e2f[_0x542f(0x23)]();return console['log'](_0xd669c5[_0x542f(0x24)],_0x48aebb),_0x48aebb[_0x542f(0x25)]&&_0x48aebb[_0x542f(0x26)]&&_0xd669c5[_0x542f(0x27)](_0x48aebb['connectedAccounts']['length'],0x0)?(console['log']('✅\x20[NEW\x20API]\x20Found\x20'+_0x48aebb[_0x542f(0x26)][_0x542f(0x28)]+_0x542f(0x29)),_0x48aebb[_0x542f(0x26)]):(console[_0x542f(0xf)](_0xd669c5[_0x542f(0x2a)]),[]);}else return console[_0x542f(0xf)](_0x542f(0x2b)+_0x315e2f[_0x542f(0x2c)]+'\x20'+_0x315e2f['statusText']),[];}}catch(_0x1c8673){return console['log'](_0xd669c5[_0x542f(0x2d)],_0x1c8673),[];}};exports[_0x542f(0x3)]=getConnectedAccountsLookup;const getConnectedAccountsSmart=async(_0x3536cf,_0x25e346,_0x2a0086)=>{const _0x2a67cc={'pJkah':_0x542f(0x2e),'yvlzb':'⚠️\x20[SMART\x20API]\x20No\x20connected\x20accounts\x20found\x20with\x20any\x20method','LoNnx':_0x542f(0x2f),'HQiwE':'🧠\x20[SMART\x20API]\x20Starting\x20smart\x20connected\x20accounts\x20fetch...','qEfpV':_0x542f(0x30),'CSANW':function(_0x12169e,_0x610094){return _0x12169e===_0x610094;},'nkNYZ':_0x542f(0x31),'xsGIU':function(_0x42373f,_0x13b272){return _0x42373f(_0x13b272);},'qaIzq':function(_0x318ef7,_0x3975aa){return _0x318ef7>_0x3975aa;},'xqevg':_0x542f(0x16),'VSBIc':_0x542f(0x32),'cgiRl':'FMVEN','XzoId':function(_0x403051,_0x3ba363){return _0x403051(_0x3ba363);},'ELlnx':function(_0x5efd3a,_0x8082c2){return _0x5efd3a!==_0x8082c2;},'rsRUD':_0x542f(0x33),'EvsLa':_0x542f(0x34),'gQqVH':_0x542f(0x35),'jxoFj':function(_0xac7af3,_0x341fe3){return _0xac7af3(_0x341fe3);},'wbSqu':function(_0x35a19f,_0x271d82){return _0x35a19f===_0x271d82;},'uVTmo':_0x542f(0x36),'uqYNo':'PVZzf','IJmvh':_0x542f(0x37),'ouLEo':function(_0x3b79d9,_0x126092){return _0x3b79d9(_0x126092);},'cWoap':_0x542f(0x38)};console['log'](_0x2a67cc['HQiwE']),console[_0x542f(0xf)](_0x2a67cc[_0x542f(0x39)],{'userEmail':_0x3536cf,'userId':_0x25e346,'username':_0x2a0086});if(_0x3536cf){if(_0x2a67cc[_0x542f(0x3a)](_0x2a67cc['nkNYZ'],_0x2a67cc[_0x542f(0x3b)])){console['log']('🧠\x20[SMART\x20API]\x20Trying\x20new\x20unified\x20lookup\x20with\x20email:',_0x3536cf);const _0x1a01b1=await _0x2a67cc[_0x542f(0x3c)](getConnectedAccountsLookup,_0x3536cf);if(_0x2a67cc[_0x542f(0x3d)](_0x1a01b1[_0x542f(0x28)],0x0))return console[_0x542f(0xf)](_0x2a67cc[_0x542f(0x3e)]),_0x1a01b1;console[_0x542f(0xf)](_0x542f(0x3f));}else return _0x1df977[_0x542f(0x26)];}console['log'](_0x542f(0x40));let _0x5470f1=[];if(_0x3536cf&&_0x2a67cc[_0x542f(0x3a)](_0x5470f1[_0x542f(0x28)],0x0)){if(_0x2a67cc[_0x542f(0x3a)](_0x2a67cc[_0x542f(0x41)],_0x2a67cc['cgiRl']))return _0x6e9842[_0x542f(0x26)];else console['log'](_0x542f(0x42),_0x3536cf),_0x5470f1=await _0x2a67cc['XzoId'](getConnectedAccountsByEmail,_0x3536cf);}if(_0x2a67cc[_0x542f(0x3a)](_0x5470f1[_0x542f(0x28)],0x0)&&_0x25e346){if(_0x2a67cc[_0x542f(0x43)](_0x2a67cc[_0x542f(0x44)],_0x2a67cc[_0x542f(0x45)]))console['log'](_0x2a67cc[_0x542f(0x46)],_0x25e346),_0x5470f1=await _0x2a67cc[_0x542f(0x47)](getConnectedAccountsByUserId,_0x25e346);else return _0x3ae693[_0x542f(0xf)](_0x2a67cc[_0x542f(0x48)],_0xe45510),[];}_0x2a67cc[_0x542f(0x49)](_0x5470f1[_0x542f(0x28)],0x0)&&_0x2a0086&&(_0x2a67cc[_0x542f(0x4a)]!==_0x2a67cc[_0x542f(0x4b)]?(console[_0x542f(0xf)](_0x2a67cc[_0x542f(0x4c)],_0x2a0086),_0x5470f1=await _0x2a67cc[_0x542f(0x4d)](getConnectedAccountsByUsername,_0x2a0086)):_0x2402d5[_0x542f(0xf)](_0x2a67cc['yvlzb']));if(_0x2a67cc[_0x542f(0x3d)](_0x5470f1['length'],0x0))console[_0x542f(0xf)](_0x542f(0x4e)+_0x5470f1[_0x542f(0x28)]+_0x542f(0x4f));else{if(_0x2a67cc['CSANW'](_0x542f(0x50),_0x2a67cc['cWoap']))return _0x51f21d[_0x542f(0xf)](_0x2a67cc[_0x542f(0x51)],_0x25786e),[];else console[_0x542f(0xf)](_0x542f(0x52));}return _0x5470f1;};exports[_0x542f(0x2)]=getConnectedAccountsSmart;function _0x542f(_0x4adaa3,_0x542f36){_0x4adaa3=_0x4adaa3-0x0;const _0x37cf09=_0x4ada();let _0x1216a4=_0x37cf09[_0x4adaa3];return _0x1216a4;}const getConnectedAccountsByUsername=async _0x1e3ec2=>{const _0x2cfc95={'IYJGf':'OMMqe','FDKBj':_0x542f(0x53),'vXepW':function(_0x4c70c6,_0x416178,_0x2fb95c){return _0x4c70c6(_0x416178,_0x2fb95c);},'OJRSj':function(_0x2665d9,_0x479c93){return _0x2665d9(_0x479c93);},'RMFuk':_0x542f(0x54),'JJXtH':_0x542f(0x55),'rTsmO':function(_0x5332b0,_0x5bf618){return _0x5332b0===_0x5bf618;},'SMCkR':_0x542f(0x56)};try{if('OMMqe'!==_0x2cfc95[_0x542f(0x57)])return _0x3877cf[_0x542f(0x7)];else{console[_0x542f(0xf)](_0x2cfc95[_0x542f(0x58)],_0x1e3ec2);const _0x488923=await(0x0,_authService['getAuthToken'])(),_0x41f6cb=await _0x2cfc95['vXepW'](fetch,API_BASE_URL+_0x542f(0x59)+_0x2cfc95[_0x542f(0x5a)](encodeURIComponent,_0x1e3ec2),{'method':'GET','headers':_0x488923?(0x0,_api[_0x542f(0x21)])(_0x488923):getDeveloperAuthHeaders()});if(_0x41f6cb['ok']){const _0x240b1a=await _0x41f6cb[_0x542f(0x23)]();console[_0x542f(0xf)](_0x2cfc95[_0x542f(0x5b)],_0x240b1a);if(_0x240b1a[_0x542f(0x25)]&&_0x240b1a[_0x542f(0x26)]&&_0x240b1a[_0x542f(0x26)][_0x542f(0x28)]>0x0)return _0x240b1a[_0x542f(0x26)];}return console[_0x542f(0xf)](_0x2cfc95[_0x542f(0x5c)]),[];}}catch(_0x56a656){return _0x2cfc95[_0x542f(0x5d)](_0x2cfc95[_0x542f(0x5e)],_0x542f(0x56))?(console[_0x542f(0xf)](_0x542f(0x2e),_0x56a656),[]):(_0x2e6271[_0x542f(0xf)](_0x542f(0x2b)+_0x25623b[_0x542f(0x2c)]+'\x20'+_0x333d73[_0x542f(0x5f)]),[]);}};exports['getConnectedAccountsByUsername']=getConnectedAccountsByUsername;const getConnectedAccountsByEmail=async _0x4b846f=>{const _0x14559c={'GjNpK':_0x542f(0xb),'uHjBo':function(_0x1e46b7,_0x2a137a){return _0x1e46b7!==_0x2a137a;},'GtLrV':function(_0x3868e3,_0x283847){return _0x3868e3!==_0x283847;},'ZencR':_0x542f(0xc),'LNDcR':'youtube','ayKdn':_0x542f(0x60),'AUGZc':_0x542f(0x61),'RvoxL':'linkedin','XUnmQ':'instagram','BhdTv':_0x542f(0x62),'nvOFq':'facebook','BzqnA':_0x542f(0x63),'ekdIv':_0x542f(0x64),'OKhag':_0x542f(0x65),'JeASp':_0x542f(0x66),'aGRKr':_0x542f(0x67),'aWRMp':_0x542f(0x68),'ZwrPl':_0x542f(0x69),'IRTxF':_0x542f(0x6a),'dcJkM':_0x542f(0x6b),'cOEjw':_0x542f(0x6c),'yZeFY':'anthropic','GeZNW':_0x542f(0x6d),'dmVtP':_0x542f(0x6e),'flkqs':_0x542f(0x6f),'qyXFm':_0x542f(0x70),'SzsfF':_0x542f(0x71),'qsEiT':_0x542f(0x72),'wcRQD':_0x542f(0x73),'oXlea':_0x542f(0x74),'XzvOu':_0x542f(0x75),'aEXYZ':_0x542f(0x76),'qvGwc':'#666666','WJxNx':'FaNzX','EGWZd':function(_0x340ecb,_0x4d8a76,_0x69918a){return _0x340ecb(_0x4d8a76,_0x69918a);},'rAvmB':function(_0x9f6694){return _0x9f6694();},'OXTrj':'YLMMV','bsDyH':_0x542f(0x54),'fNcJO':'⚠️\x20[LEGACY]\x20API\x20response\x20not\x20successful\x20or\x20empty','tOtZe':_0x542f(0x2f)};try{if(_0x14559c['WJxNx']===_0x542f(0x77)){if(!(0x0,_0x3d124f['isApiKeyInitialized'])())return _0x4e8fca[_0x542f(0x78)](_0x14559c[_0x542f(0x79)]),(0x0,_0x5e2374[_0x542f(0x10)])();const _0x204734=(0x0,_0xf65a1e['getApiConfig'])();if(!(_0x14559c[_0x542f(0x7a)](_0x204734,null)&&_0x14559c[_0x542f(0x7b)](_0x204734,void 0x0)&&_0x204734['apiKey']))return(0x0,_0x13f99b[_0x542f(0x10)])();return{...(0x0,_0x16344a[_0x542f(0x10)])(),'Authorization':'Bearer\x20'+_0x204734[_0x542f(0x13)],'X-SDK-Version':_0x14559c['ZencR'],'X-SDK-Platform':'react-native'};}else{console[_0x542f(0xf)](_0x542f(0x7c),_0x4b846f);const _0x3022d8=await(0x0,_authService[_0x542f(0x1e)])(),_0x5ed2d3=await _0x14559c[_0x542f(0x7d)](fetch,API_BASE_URL+_0x542f(0x7e)+encodeURIComponent(_0x4b846f),{'method':'GET','headers':_0x3022d8?(0x0,_api[_0x542f(0x21)])(_0x3022d8):_0x14559c['rAvmB'](getDeveloperAuthHeaders)});if(_0x5ed2d3['ok']){if(_0x14559c[_0x542f(0x7f)]===_0x14559c['OXTrj']){const _0x4c6378=await _0x5ed2d3[_0x542f(0x23)]();console[_0x542f(0xf)](_0x14559c[_0x542f(0x80)],_0x4c6378);if(_0x4c6378[_0x542f(0x25)]&&_0x4c6378[_0x542f(0x26)]&&_0x4c6378[_0x542f(0x26)][_0x542f(0x28)]>0x0)return _0x4c6378[_0x542f(0x26)];}else{const _0x16348d=_0x471f9a[_0x542f(0x81)]();switch(_0x16348d){case _0x14559c[_0x542f(0x82)]:return _0x14559c[_0x542f(0x83)];case _0x14559c[_0x542f(0x84)]:return'#FF4500';case _0x14559c[_0x542f(0x85)]:return'#0077B5';case _0x14559c['XUnmQ']:return _0x14559c['BhdTv'];case _0x14559c[_0x542f(0x86)]:return _0x14559c[_0x542f(0x87)];case _0x14559c['ekdIv']:return _0x542f(0x88);case _0x14559c[_0x542f(0x89)]:case _0x542f(0x8a):return _0x14559c[_0x542f(0x8b)];case _0x14559c[_0x542f(0x8c)]:case'x':return _0x14559c['aWRMp'];case _0x14559c[_0x542f(0x8d)]:return _0x542f(0x8e);case _0x542f(0x8f):case _0x14559c['IRTxF']:return _0x14559c[_0x542f(0x90)];case _0x14559c[_0x542f(0x91)]:case _0x14559c[_0x542f(0x92)]:return _0x542f(0x93);case _0x542f(0x94):return _0x14559c[_0x542f(0x95)];case'gemini':case _0x14559c[_0x542f(0x96)]:return _0x14559c['flkqs'];case _0x14559c[_0x542f(0x97)]:return _0x542f(0x98);case _0x14559c[_0x542f(0x99)]:return _0x14559c['BhdTv'];case _0x14559c[_0x542f(0x9a)]:return _0x14559c[_0x542f(0x95)];case _0x14559c[_0x542f(0x9b)]:return _0x14559c['wcRQD'];case _0x14559c['oXlea']:return _0x14559c[_0x542f(0x9c)];case _0x14559c['aEXYZ']:return'#1DB954';default:return _0x14559c[_0x542f(0x9d)];}}}return console[_0x542f(0xf)](_0x14559c['fNcJO']),[];}}catch(_0x142f96){return console['log'](_0x14559c[_0x542f(0x9e)],_0x142f96),[];}};exports[_0x542f(0x4)]=getConnectedAccountsByEmail;const getConnectedAccountsByUserId=async _0xe7e808=>{const _0x1030fb={'Dkpem':'⚠️\x20SDK\x20not\x20initialized\x20-\x20using\x20basic\x20headers','fUMns':_0x542f(0x9f),'Fuixr':function(_0x56975b,_0x288c5f,_0x58c90e){return _0x56975b(_0x288c5f,_0x58c90e);},'rBBgS':function(_0x16bf06,_0x252af1){return _0x16bf06(_0x252af1);},'avKTm':function(_0x1cc3a4){return _0x1cc3a4();},'kVbDy':'✅\x20[LEGACY]\x20Connected\x20accounts\x20fetched:','IweBa':function(_0x378f17,_0xf75fd3){return _0x378f17>_0xf75fd3;},'HTVBE':'⚠️\x20[LEGACY]\x20API\x20response\x20not\x20successful\x20or\x20empty','CeBZB':_0x542f(0xa0),'JSnEY':_0x542f(0xa1)};try{console[_0x542f(0xf)](_0x1030fb['fUMns'],_0xe7e808);const _0x1e9e5d=await(0x0,_authService[_0x542f(0x1e)])(),_0x24c490=await _0x1030fb[_0x542f(0xa2)](fetch,API_BASE_URL+_0x542f(0xa3)+_0x1030fb[_0x542f(0xa4)](encodeURIComponent,_0xe7e808),{'method':'GET','headers':_0x1e9e5d?(0x0,_api[_0x542f(0x21)])(_0x1e9e5d):_0x1030fb['avKTm'](getDeveloperAuthHeaders)});if(_0x24c490['ok']){const _0xaaa87c=await _0x24c490[_0x542f(0x23)]();console[_0x542f(0xf)](_0x1030fb['kVbDy'],_0xaaa87c);if(_0xaaa87c[_0x542f(0x25)]&&_0xaaa87c[_0x542f(0x26)]&&_0x1030fb['IweBa'](_0xaaa87c[_0x542f(0x26)]['length'],0x0))return _0xaaa87c[_0x542f(0x26)];}return console['log'](_0x1030fb[_0x542f(0xa5)]),[];}catch(_0x3cf357){return _0x1030fb[_0x542f(0xa6)]!=='lWBXl'?(_0x2ce188[_0x542f(0x78)](_0x1030fb[_0x542f(0xa7)]),(0x0,_0x2ee0af[_0x542f(0x10)])()):(console['log'](_0x1030fb[_0x542f(0xa8)],_0x3cf357),[]);}};exports[_0x542f(0xa9)]=getConnectedAccountsByUserId;const getPlatformColor=_0x57a9b9=>{const _0x245cb7={'NHnyk':_0x542f(0x61),'IirOx':_0x542f(0xaa),'MpFqW':'linkedin','yrDpz':'#E1306C','nFmVi':_0x542f(0xab),'erILs':_0x542f(0x63),'hBPPN':'pinterest','ItiwK':_0x542f(0x65),'qJWqi':_0x542f(0x8a),'canNu':_0x542f(0x66),'kbfNH':_0x542f(0x67),'OZgYJ':_0x542f(0x68),'REdWf':_0x542f(0x69),'lljOz':_0x542f(0x8e),'YJKyK':'chatgpt','OByFV':_0x542f(0x6a),'RUCGi':_0x542f(0x6b),'ONCOE':_0x542f(0x6c),'mzGYt':_0x542f(0xac),'kpwdC':_0x542f(0x94),'IINdG':_0x542f(0xad),'CpIEL':_0x542f(0x6f),'AwflS':_0x542f(0x70),'Pycny':_0x542f(0x98),'RTpkG':'instagram','nzDdI':'telegram','PMQmC':_0x542f(0x73),'VRmbf':_0x542f(0x74),'OThEF':'spotify','wGRZJ':_0x542f(0xae)},_0x24ecac=_0x57a9b9[_0x542f(0x81)]();switch(_0x24ecac){case _0x542f(0xaf):return'#FF0000';case _0x245cb7['NHnyk']:return _0x245cb7['IirOx'];case _0x245cb7['MpFqW']:return _0x542f(0xb0);case _0x542f(0xb1):return _0x245cb7['yrDpz'];case _0x245cb7['nFmVi']:return _0x245cb7[_0x542f(0xb2)];case _0x245cb7[_0x542f(0xb3)]:return _0x542f(0x88);case _0x245cb7[_0x542f(0xb4)]:case _0x245cb7[_0x542f(0xb5)]:return _0x245cb7[_0x542f(0xb6)];case _0x245cb7[_0x542f(0xb7)]:case'x':return _0x245cb7[_0x542f(0xb8)];case _0x245cb7[_0x542f(0xb9)]:return _0x245cb7[_0x542f(0xba)];case _0x245cb7[_0x542f(0xbb)]:case _0x245cb7['OByFV']:return _0x245cb7[_0x542f(0xbc)];case _0x245cb7[_0x542f(0xbd)]:case _0x245cb7[_0x542f(0xbe)]:return _0x542f(0x93);case _0x245cb7[_0x542f(0xbf)]:return _0x542f(0x6d);case _0x245cb7[_0x542f(0xc0)]:case'google_ai':return _0x245cb7['CpIEL'];case _0x245cb7[_0x542f(0xc1)]:return _0x245cb7['Pycny'];case _0x245cb7['RTpkG']:return _0x245cb7[_0x542f(0xc2)];case'sephora':return _0x542f(0x6d);case _0x245cb7[_0x542f(0xc3)]:return _0x245cb7[_0x542f(0xc4)];case _0x245cb7[_0x542f(0xc5)]:return _0x542f(0x75);case _0x245cb7[_0x542f(0xc6)]:return _0x542f(0xc7);default:return _0x245cb7[_0x542f(0xc8)];}};exports[_0x542f(0x1)]=getPlatformColor;function _0x4ada(){const _0x13e2f3=['__esModule','getPlatformColor','getConnectedAccountsSmart','getConnectedAccountsLookup','getConnectedAccountsByEmail','defineProperty','getPlatformIcon','getPlatformIconFromRegistry','API_CONFIG','BASE_URL','ℹ️\x20[NEW\x20API]\x20No\x20connected\x20accounts\x20found\x20for\x20user','⚠️\x20SDK\x20not\x20initialized\x20-\x20using\x20basic\x20headers','3.0.72','isApiKeyInitialized','gbfWX','log','getApiHeaders','getApiConfig','gCFYS','apiKey','WpJsL','LhTcx','✅\x20[SMART\x20API]\x20Success\x20with\x20new\x20unified\x20lookup\x20via\x20email','yFnZM','CFqBe','🔍\x20[NEW\x20API]\x20Fetching\x20connected\x20accounts\x20via\x20unified\x20lookup\x20for:','✅\x20[NEW\x20API]\x20Connected\x20accounts\x20fetched\x20successfully:','sTaas','FxKCD','zUSbQ','getAuthToken','/connectedAccounts/lookup/','hvQUx','getAuthHeaders','PtILn','json','XLCCE','success','connectedAccounts','KfRWn','length','\x20connected\x20accounts','AJuvC','⚠️\x20[NEW\x20API]\x20Response\x20not\x20OK:\x20','status','JzAdh','❌\x20[LEGACY]\x20Error\x20fetching\x20connected\x20accounts\x20by\x20username:','❌\x20[LEGACY]\x20Error\x20fetching\x20connected\x20accounts\x20by\x20email:','🧠\x20[SMART\x20API]\x20Available\x20identifiers:','OVJcJ','fhZOi','gJpUF','kfqRQ','🔄\x20[SMART\x20API]\x20Trying\x20old\x20API\x20with\x20userId:','VjSrz','🔄\x20[SMART\x20API]\x20Trying\x20old\x20API\x20with\x20username:','LJiVl','qEfpV','CSANW','nkNYZ','xsGIU','qaIzq','xqevg','🔄\x20[SMART\x20API]\x20New\x20API\x20returned\x20no\x20results,\x20trying\x20fallbacks...','🔄\x20[SMART\x20API]\x20Falling\x20back\x20to\x20old\x20API\x20methods...','VSBIc','🔄\x20[SMART\x20API]\x20Trying\x20old\x20API\x20with\x20email:','ELlnx','rsRUD','EvsLa','gQqVH','jxoFj','pJkah','wbSqu','uVTmo','uqYNo','IJmvh','ouLEo','✅\x20[SMART\x20API]\x20Success\x20with\x20old\x20API\x20fallback:\x20','\x20accounts','EFzPr','LoNnx','⚠️\x20[SMART\x20API]\x20No\x20connected\x20accounts\x20found\x20with\x20any\x20method','🔍\x20[LEGACY]\x20Fetching\x20connected\x20accounts\x20for\x20username:','✅\x20[LEGACY]\x20Connected\x20accounts\x20fetched:','⚠️\x20[LEGACY]\x20API\x20response\x20not\x20successful\x20or\x20empty','YoQVG','IYJGf','FDKBj','/connectedAccounts?username=','OJRSj','RMFuk','JJXtH','rTsmO','SMCkR','statusText','#FF0000','reddit','#E1306C','#1877F2','pinterest','gmail','#EA4335','twitter','#1DA1F2','farcaster','openai','#10A37F','claude','#000000','google_ai','#4285F4','hinge','sephora','telegram','#0088CC','netflix','#E50914','spotify','fZroX','warn','GjNpK','uHjBo','GtLrV','🔍\x20[LEGACY]\x20Fetching\x20connected\x20accounts\x20for\x20email:','EGWZd','/connectedAccounts?email=','OXTrj','bsDyH','toLowerCase','LNDcR','ayKdn','AUGZc','RvoxL','nvOFq','BzqnA','#E60023','OKhag','email','JeASp','aGRKr','ZwrPl','#8A63D2','chatgpt','dcJkM','cOEjw','yZeFY','#D4A574','grok','GeZNW','dmVtP','qyXFm','#7C3AED','XUnmQ','SzsfF','qsEiT','XzvOu','qvGwc','tOtZe','🔍\x20[LEGACY]\x20Fetching\x20connected\x20accounts\x20for\x20userId:','lWBXl','❌\x20[LEGACY]\x20Error\x20fetching\x20connected\x20accounts\x20by\x20userId:','Fuixr','/connectedAccounts?userId=','rBBgS','HTVBE','CeBZB','Dkpem','JSnEY','getConnectedAccountsByUserId','#FF4500','facebook','anthropic','gemini','#666666','youtube','#0077B5','instagram','erILs','hBPPN','ItiwK','qJWqi','canNu','kbfNH','OZgYJ','REdWf','lljOz','YJKyK','RUCGi','ONCOE','mzGYt','kpwdC','IINdG','AwflS','yrDpz','nzDdI','PMQmC','VRmbf','OThEF','#1DB954','wGRZJ'];_0x4ada=function(){return _0x13e2f3;};return _0x4ada();}
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPlatformColor = exports.getConnectedAccountsSmart = exports.getConnectedAccountsLookup = exports.getConnectedAccountsByUsername = exports.getConnectedAccountsByUserId = exports.getConnectedAccountsByEmail = void 0;
7
+ Object.defineProperty(exports, "getPlatformIcon", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _assetRegistry.getPlatformIconFromRegistry;
11
+ }
12
+ });
13
+ var _authService = require("./authService");
14
+ var _api = require("../config/api");
15
+ var _apiKeyService = require("./apiKeyService");
16
+ var _assetRegistry = require("../utils/assetRegistry");
17
+ const API_BASE_URL = _api.API_CONFIG.BASE_URL;
18
+
19
+ /**
20
+ * Get developer API key authorization headers
21
+ * Falls back when no user JWT token is available
22
+ */
23
+ const getDeveloperAuthHeaders = () => {
24
+ if (!(0, _apiKeyService.isApiKeyInitialized)()) {
25
+ console.warn('⚠️ SDK not initialized - using basic headers');
26
+ return (0, _api.getApiHeaders)();
27
+ }
28
+ const config = (0, _apiKeyService.getApiConfig)();
29
+ if (!(config !== null && config !== void 0 && config.apiKey)) {
30
+ return (0, _api.getApiHeaders)();
31
+ }
32
+ return {
33
+ ...(0, _api.getApiHeaders)(),
34
+ 'Authorization': `Bearer ${config.apiKey}`,
35
+ 'X-SDK-Version': '3.0.72',
36
+ 'X-SDK-Platform': 'react-native'
37
+ };
38
+ };
39
+
40
+ // Interface for connected account from API
41
+
42
+ // Interface for API response
43
+
44
+ /**
45
+ * NEW UNIFIED LOOKUP - Get connected accounts using the simplified lookup endpoint
46
+ * This is the preferred method that makes only ONE request to the backend
47
+ * @param userIdentifier - Can be email, username, userId, or any user identifier
48
+ * @returns Promise<ConnectedAccount[]>
49
+ */
50
+ const getConnectedAccountsLookup = async userIdentifier => {
51
+ try {
52
+ console.log('🔍 [NEW API] Fetching connected accounts via unified lookup for:', userIdentifier);
53
+ const token = await (0, _authService.getAuthToken)();
54
+
55
+ // Use the new simplified endpoint format
56
+ // 🔒 Use user JWT if available, otherwise use developer API key
57
+ const response = await fetch(`${API_BASE_URL}/connectedAccounts/lookup/${encodeURIComponent(userIdentifier)}`, {
58
+ method: 'GET',
59
+ headers: token ? (0, _api.getAuthHeaders)(token) : getDeveloperAuthHeaders()
60
+ });
61
+ if (response.ok) {
62
+ const data = await response.json();
63
+ console.log('✅ [NEW API] Connected accounts fetched successfully:', data);
64
+ if (data.success && data.connectedAccounts && data.connectedAccounts.length > 0) {
65
+ console.log(`✅ [NEW API] Found ${data.connectedAccounts.length} connected accounts`);
66
+ return data.connectedAccounts;
67
+ } else {
68
+ console.log('ℹ️ [NEW API] No connected accounts found for user');
69
+ return [];
70
+ }
71
+ } else {
72
+ console.log(`⚠️ [NEW API] Response not OK: ${response.status} ${response.statusText}`);
73
+ return [];
74
+ }
75
+ } catch (error) {
76
+ console.log('❌ [NEW API] Error fetching connected accounts via lookup:', error);
77
+ return [];
78
+ }
79
+ };
80
+
81
+ /**
82
+ * SMART CONNECTED ACCOUNTS FETCHER - Uses new API with old API fallback
83
+ * This function tries the new unified lookup first, then falls back to old methods if needed
84
+ * @param userEmail - User's email (primary identifier)
85
+ * @param userId - User's ID (fallback)
86
+ * @param username - User's username (fallback)
87
+ * @returns Promise<ConnectedAccount[]>
88
+ */
89
+ exports.getConnectedAccountsLookup = getConnectedAccountsLookup;
90
+ const getConnectedAccountsSmart = async (userEmail, userId, username) => {
91
+ console.log('🧠 [SMART API] Starting smart connected accounts fetch...');
92
+ console.log('🧠 [SMART API] Available identifiers:', {
93
+ userEmail,
94
+ userId,
95
+ username
96
+ });
97
+
98
+ // Try the new unified lookup API first (preferred method)
99
+ if (userEmail) {
100
+ console.log('🧠 [SMART API] Trying new unified lookup with email:', userEmail);
101
+ const accounts = await getConnectedAccountsLookup(userEmail);
102
+ if (accounts.length > 0) {
103
+ console.log('✅ [SMART API] Success with new unified lookup via email');
104
+ return accounts;
105
+ }
106
+ console.log('🔄 [SMART API] New API returned no results, trying fallbacks...');
107
+ }
108
+
109
+ // If new API didn't work or no email, try fallbacks
110
+ console.log('🔄 [SMART API] Falling back to old API methods...');
111
+
112
+ // Try old API methods as fallback
113
+ let accounts = [];
114
+
115
+ // Prioritize email for profile views
116
+ if (userEmail && accounts.length === 0) {
117
+ console.log('🔄 [SMART API] Trying old API with email:', userEmail);
118
+ accounts = await getConnectedAccountsByEmail(userEmail);
119
+ }
120
+ if (accounts.length === 0 && userId) {
121
+ console.log('🔄 [SMART API] Trying old API with userId:', userId);
122
+ accounts = await getConnectedAccountsByUserId(userId);
123
+ }
124
+ if (accounts.length === 0 && username) {
125
+ console.log('🔄 [SMART API] Trying old API with username:', username);
126
+ accounts = await getConnectedAccountsByUsername(username);
127
+ }
128
+ if (accounts.length > 0) {
129
+ console.log(`✅ [SMART API] Success with old API fallback: ${accounts.length} accounts`);
130
+ } else {
131
+ console.log('⚠️ [SMART API] No connected accounts found with any method');
132
+ }
133
+ return accounts;
134
+ };
135
+
136
+ // =============================================================================
137
+ // LEGACY API FUNCTIONS - Keep for backward compatibility and fallback
138
+ // These will be used as fallbacks if the new unified lookup fails
139
+ // =============================================================================
140
+
141
+ /**
142
+ * Get connected accounts by username
143
+ * @param username - Username to fetch connected accounts for
144
+ * @returns Promise<ConnectedAccount[]>
145
+ */
146
+ exports.getConnectedAccountsSmart = getConnectedAccountsSmart;
147
+ const getConnectedAccountsByUsername = async username => {
148
+ try {
149
+ console.log('🔍 [LEGACY] Fetching connected accounts for username:', username);
150
+ const token = await (0, _authService.getAuthToken)();
151
+
152
+ // 🔒 Use user JWT if available, otherwise use developer API key
153
+ const response = await fetch(`${API_BASE_URL}/connectedAccounts?username=${encodeURIComponent(username)}`, {
154
+ method: 'GET',
155
+ headers: token ? (0, _api.getAuthHeaders)(token) : getDeveloperAuthHeaders()
156
+ });
157
+ if (response.ok) {
158
+ const data = await response.json();
159
+ console.log('✅ [LEGACY] Connected accounts fetched:', data);
160
+ if (data.success && data.connectedAccounts && data.connectedAccounts.length > 0) {
161
+ return data.connectedAccounts;
162
+ }
163
+ }
164
+ console.log('⚠️ [LEGACY] API response not successful or empty');
165
+ return [];
166
+ } catch (error) {
167
+ console.log('❌ [LEGACY] Error fetching connected accounts by username:', error);
168
+ return [];
169
+ }
170
+ };
171
+
172
+ /**
173
+ * Get connected accounts by email
174
+ * @param email - Email to fetch connected accounts for
175
+ * @returns Promise<ConnectedAccount[]>
176
+ */
177
+ exports.getConnectedAccountsByUsername = getConnectedAccountsByUsername;
178
+ const getConnectedAccountsByEmail = async email => {
179
+ try {
180
+ console.log('🔍 [LEGACY] Fetching connected accounts for email:', email);
181
+ const token = await (0, _authService.getAuthToken)();
182
+
183
+ // 🔒 Use user JWT if available, otherwise use developer API key
184
+ const response = await fetch(`${API_BASE_URL}/connectedAccounts?email=${encodeURIComponent(email)}`, {
185
+ method: 'GET',
186
+ headers: token ? (0, _api.getAuthHeaders)(token) : getDeveloperAuthHeaders()
187
+ });
188
+ if (response.ok) {
189
+ const data = await response.json();
190
+ console.log('✅ [LEGACY] Connected accounts fetched:', data);
191
+ if (data.success && data.connectedAccounts && data.connectedAccounts.length > 0) {
192
+ return data.connectedAccounts;
193
+ }
194
+ }
195
+ console.log('⚠️ [LEGACY] API response not successful or empty');
196
+ return [];
197
+ } catch (error) {
198
+ console.log('❌ [LEGACY] Error fetching connected accounts by email:', error);
199
+ return [];
200
+ }
201
+ };
202
+
203
+ /**
204
+ * Get connected accounts by user ID
205
+ * @param userId - User ID to fetch connected accounts for
206
+ * @returns Promise<ConnectedAccount[]>
207
+ */
208
+ exports.getConnectedAccountsByEmail = getConnectedAccountsByEmail;
209
+ const getConnectedAccountsByUserId = async userId => {
210
+ try {
211
+ console.log('🔍 [LEGACY] Fetching connected accounts for userId:', userId);
212
+ const token = await (0, _authService.getAuthToken)();
213
+
214
+ // 🔒 Use user JWT if available, otherwise use developer API key
215
+ const response = await fetch(`${API_BASE_URL}/connectedAccounts?userId=${encodeURIComponent(userId)}`, {
216
+ method: 'GET',
217
+ headers: token ? (0, _api.getAuthHeaders)(token) : getDeveloperAuthHeaders()
218
+ });
219
+ if (response.ok) {
220
+ const data = await response.json();
221
+ console.log('✅ [LEGACY] Connected accounts fetched:', data);
222
+ if (data.success && data.connectedAccounts && data.connectedAccounts.length > 0) {
223
+ return data.connectedAccounts;
224
+ }
225
+ }
226
+ console.log('⚠️ [LEGACY] API response not successful or empty');
227
+ return [];
228
+ } catch (error) {
229
+ console.log('❌ [LEGACY] Error fetching connected accounts by userId:', error);
230
+ return [];
231
+ }
232
+ };
233
+
234
+ /**
235
+ * Get platform icon based on platform name
236
+ * @param platform - Platform name (case insensitive)
237
+ * @returns Image source for the platform icon
238
+ */
239
+ exports.getConnectedAccountsByUserId = getConnectedAccountsByUserId;
240
+ /**
241
+ * Get platform color based on platform name
242
+ * @param platform - Platform name (case insensitive)
243
+ * @returns Hex color code for the platform
244
+ */
245
+ const getPlatformColor = platform => {
246
+ const platformLower = platform.toLowerCase();
247
+ switch (platformLower) {
248
+ case 'youtube':
249
+ return '#FF0000';
250
+ case 'reddit':
251
+ return '#FF4500';
252
+ case 'linkedin':
253
+ return '#0077B5';
254
+ case 'instagram':
255
+ return '#E1306C';
256
+ case 'facebook':
257
+ return '#1877F2';
258
+ case 'pinterest':
259
+ return '#E60023';
260
+ case 'gmail':
261
+ case 'email':
262
+ return '#EA4335';
263
+ case 'twitter':
264
+ case 'x':
265
+ return '#1DA1F2';
266
+ case 'farcaster':
267
+ return '#8A63D2';
268
+ // LLM Platforms
269
+ case 'chatgpt':
270
+ case 'openai':
271
+ return '#10A37F';
272
+ // OpenAI green
273
+ case 'claude':
274
+ case 'anthropic':
275
+ return '#D4A574';
276
+ // Claude tan/orange
277
+ case 'grok':
278
+ return '#000000';
279
+ // X/Grok black
280
+ case 'gemini':
281
+ case 'google_ai':
282
+ return '#4285F4';
283
+ // Google blue
284
+ // New platforms
285
+ case 'hinge':
286
+ return '#7C3AED';
287
+ // Hinge Purple
288
+ case 'instagram':
289
+ return '#E1306C';
290
+ // Instagram Pink/Magenta
291
+ case 'sephora':
292
+ return '#000000';
293
+ // Sephora Black
294
+ case 'telegram':
295
+ return '#0088CC';
296
+ // Telegram Blue
297
+ // Streaming Platforms
298
+ case 'netflix':
299
+ return '#E50914';
300
+ // Netflix Red
301
+ case 'spotify':
302
+ return '#1DB954';
303
+ // Spotify Green
304
+ default:
305
+ return '#666666';
306
+ // Default gray
307
+ }
308
+ };
309
+ exports.getPlatformColor = getPlatformColor;
310
+ //# sourceMappingURL=connectedAccountsService.js.map