@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,8 +1,155 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("./chatGPTConversationService"),
5
- require("react-native")
6
- ];
7
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
8
- function _0x4071(){const _0x1d0efc=['useChatGPTConversationExtractor','GAhRY','ℹ️\x20[CHATGPT_EXTRACTOR]\x20No\x20conversations\x20to\x20export\x20-\x20treating\x20as\x20success\x20(connected)','Username\x20is\x20required\x20to\x20export\x20ChatGPT\x20conversations.','⚠️\x20[CHATGPT_EXTRACTOR]\x20No\x20memories\x20data\x20provided','tqpUG','cajDa','👤\x20[CHATGPT_EXTRACTOR]\x20Username:','📊\x20[CHATGPT_EXTRACTOR]\x20Conversations\x20to\x20send:','Error','default','GBsWc','❌\x20[CHATGPT_EXTRACTOR]\x20No\x20valid\x20conversations\x20after\x20filtering','Data\x20Error','JMGhJ','📡\x20[CHATGPT_EXTRACTOR]\x20Sending\x20to\x20backend...','📊\x20[CHATGPT_EXTRACTOR]\x20Backend\x20response:','Export\x20Failed','Export\x20Error','Failed\x20to\x20connect\x20to\x20the\x20conversation\x20storage\x20service.\x20Please\x20check\x20your\x20network\x20connection.','✅\x20[CHATGPT_EXTRACTOR]\x20Export\x20completed\x20successfully','lJNTL','🧠\x20[CHATGPT_EXTRACTOR]\x20Storing\x20ChatGPT\x20memories...','ℹ️\x20[CHATGPT_EXTRACTOR]\x20No\x20memories\x20to\x20store\x20-\x20treating\x20as\x20success','📡\x20[CHATGPT_EXTRACTOR]\x20Sending\x20memories\x20to\x20backend...','HjCtB','❌\x20[CHATGPT_EXTRACTOR]\x20Memories\x20storage\x20failed:','❌\x20[CHATGPT_EXTRACTOR]\x20Unexpected\x20error\x20storing\x20memories:','duyuH','iUJzJ','OCyBN','HbRFQ','EClNL','qExcR','log','fDcpd','edhlu','length','error','❌\x20[CHATGPT_EXTRACTOR]\x20Username\x20is\x20required','Alert','alert','nTXqY','zvgsE','NYexe','rexsk','conversation_id','title','isArray','YWhwR','user_messages','mwxCw','warn','ywVKE','AyaAr','dosBr','LHYMV','NDYyD','DxvcV','TThpf','⚠️\x20[CHATGPT_EXTRACTOR]\x20Filtered\x20out\x20','iGJap','\x20invalid\x20conversations','oDUFq','oURAT','storeChatGPTConversations','success','TLTtZ','data','DGXJM','WxaVx','tyziH','SjjFC','JraMo','HWciu','YyBfd','WEmVl','xapuK','memoriesCount','📋\x20[CHATGPT_EXTRACTOR]\x20Backend\x20stored\x20','\x20memories','lsAtT','vKYZj','zCRUW','vuYbp','memories','FmiFU','📋\x20[CHATGPT_EXTRACTOR]\x20Found\x20','\x20memory\x20items,\x20','\x20memory\x20entries,\x20','gDTTw','UfdaP','GGOdu','KNhir','storeChatGPTMemories','HaVmp','mPqWP','BhGaw','gPnWc','uEKUE','OBKLM','wPekI','gESMr'];_0x4071=function(){return _0x1d0efc;};return _0x4071();}function _0x4bcc(_0x40713e,_0x4bccd4){_0x40713e=_0x40713e-0x0;const _0x4cd017=_0x4071();let _0x573b5b=_0x4cd017[_0x40713e];return _0x573b5b;}Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports[_0x4bcc(0x0)]=void 0x0;var _chatGPTConversationService=__ONAIROS_REQ_FUNC__(0x0),_reactNative=__ONAIROS_REQ_FUNC__(0x1);const useChatGPTConversationExtractor=()=>{const _0x134127={'rexsk':'wbGMd','YWhwR':function(_0x59a4ab,_0x36e33f){return _0x59a4ab>_0x36e33f;},'mwxCw':_0x4bcc(0x1),'ywVKE':'⚠️\x20[CHATGPT_EXTRACTOR]\x20Invalid\x20conversation:','zvgsE':_0x4bcc(0x2),'duyuH':'❌\x20[CHATGPT_EXTRACTOR]\x20Username\x20is\x20required','iUJzJ':_0x4bcc(0x3),'OCyBN':_0x4bcc(0x4),'HbRFQ':function(_0x39e052,_0x56a5e7){return _0x39e052===_0x56a5e7;},'EClNL':_0x4bcc(0x5),'qExcR':_0x4bcc(0x6),'EoTyT':'🚀\x20[CHATGPT_EXTRACTOR]\x20Initiating\x20conversation\x20export','edhlu':_0x4bcc(0x7),'zsuJG':_0x4bcc(0x8),'nTXqY':_0x4bcc(0x9),'DxvcV':_0x4bcc(0xa),'ZunOb':_0x4bcc(0xb),'HJWdF':_0x4bcc(0xc),'NDYyD':_0x4bcc(0xd),'TThpf':function(_0x2c6b8c,_0x35608b){return _0x2c6b8c<_0x35608b;},'iGJap':function(_0x11a3a3,_0x4f3e4b){return _0x11a3a3-_0x4f3e4b;},'oDUFq':function(_0x28fd95,_0xf9f7ef){return _0x28fd95!==_0xf9f7ef;},'oURAT':_0x4bcc(0xe),'SKLTy':_0x4bcc(0xf),'TLTtZ':_0x4bcc(0x10),'DGXJM':'UbryO','GSIDh':'❌\x20[CHATGPT_EXTRACTOR]\x20Backend\x20storage\x20failed:','WxaVx':_0x4bcc(0x11),'tyziH':'An\x20unknown\x20error\x20occurred\x20during\x20conversation\x20storage.','SjjFC':'❌\x20[CHATGPT_EXTRACTOR]\x20Unexpected\x20error\x20during\x20export:','JraMo':_0x4bcc(0x12),'HWciu':_0x4bcc(0x13),'gPnWc':'✅\x20[CHATGPT_EXTRACTOR]\x20Memories\x20stored\x20successfully','YyBfd':_0x4bcc(0x14),'WEmVl':function(_0x404bf5,_0x30817f){return _0x404bf5!==_0x30817f;},'xapuK':_0x4bcc(0x15),'lsAtT':_0x4bcc(0x16),'vKYZj':function(_0x2260cd,_0x249a1b){return _0x2260cd===_0x249a1b;},'fsGVC':function(_0x4d7b2e,_0x38c29e){return _0x4d7b2e===_0x38c29e;},'zCRUW':function(_0xd1cd1,_0x4a1ce0){return _0xd1cd1===_0x4a1ce0;},'vuYbp':function(_0x1ef690,_0x45e029){return _0x1ef690===_0x45e029;},'FmiFU':function(_0x1cc633,_0x23205b){return _0x1cc633===_0x23205b;},'gDTTw':function(_0x447754,_0xda9f7){return _0x447754===_0xda9f7;},'UfdaP':function(_0x456b6c,_0x852972){return _0x456b6c===_0x852972;},'GGOdu':_0x4bcc(0x17),'KNhir':'dGjRw','OZuse':_0x4bcc(0x18),'HaVmp':function(_0xacd16a,_0x28b58b){return _0xacd16a!==_0x28b58b;},'BhGaw':_0x4bcc(0x19),'uEKUE':'rxtoN','wPekI':_0x4bcc(0x1a),'gESMr':_0x4bcc(0x1b)},_0x52a60c=async(_0x531dc6,_0xc1ec57)=>{const _0x4d65e7={'fDcpd':_0x134127['zvgsE'],'NYexe':_0x4bcc(0x17),'AyaAr':_0x134127[_0x4bcc(0x1c)],'dosBr':_0x4bcc(0x9),'LHYMV':_0x134127[_0x4bcc(0x1d)],'JtVkD':_0x134127[_0x4bcc(0x1e)]};if(_0x134127[_0x4bcc(0x1f)](_0x134127[_0x4bcc(0x20)],_0x134127[_0x4bcc(0x21)]))return _0x565430[_0x4bcc(0x22)](_0x4d65e7[_0x4bcc(0x23)]),!![];else{console['log'](_0x134127['EoTyT']),console[_0x4bcc(0x22)](_0x134127[_0x4bcc(0x24)],_0x531dc6),console['log'](_0x134127['zsuJG'],_0xc1ec57[_0x4bcc(0x25)]);if(!_0x531dc6)return console[_0x4bcc(0x26)](_0x4bcc(0x27)),_reactNative[_0x4bcc(0x28)][_0x4bcc(0x29)](_0x134127[_0x4bcc(0x2a)],_0x134127['iUJzJ'],[{'text':'OK','style':_0x134127['DxvcV']}]),![];if(!_0xc1ec57||_0x134127[_0x4bcc(0x1f)](_0xc1ec57[_0x4bcc(0x25)],0x0))return _0x134127[_0x4bcc(0x1f)](_0x134127['ZunOb'],_0x4bcc(0xb))?(console[_0x4bcc(0x22)](_0x134127[_0x4bcc(0x2b)]),!![]):(_0x1a468d[_0x4bcc(0x22)](_0x4d65e7[_0x4bcc(0x2c)]),!![]);const _0x597ab2=_0xc1ec57['filter'](_0x357d3a=>{if(_0x134127[_0x4bcc(0x2d)]===_0x134127[_0x4bcc(0x2d)]){const _0x72659f=_0x357d3a[_0x4bcc(0x2e)]&&_0x357d3a[_0x4bcc(0x2f)]&&Array[_0x4bcc(0x30)](_0x357d3a['user_messages'])&&_0x134127[_0x4bcc(0x31)](_0x357d3a[_0x4bcc(0x32)][_0x4bcc(0x25)],0x0);if(!_0x72659f){if(_0x134127[_0x4bcc(0x33)]!=='ImtnS')console[_0x4bcc(0x34)](_0x134127[_0x4bcc(0x35)],_0x357d3a);else return _0x219074[_0x4bcc(0x26)]('❌\x20[CHATGPT_EXTRACTOR]\x20Memories\x20storage\x20failed:',_0x2fc4a4['error']),![];}return _0x72659f;}else return _0x4f1706['error'](_0x4d65e7[_0x4bcc(0x36)]),_0x2caf5c[_0x4bcc(0x28)]['alert'](_0x4d65e7[_0x4bcc(0x37)],_0x4d65e7[_0x4bcc(0x38)],[{'text':'OK','style':_0x4bcc(0xa)}]),![];});if(_0x134127[_0x4bcc(0x1f)](_0x597ab2[_0x4bcc(0x25)],0x0))return console[_0x4bcc(0x26)](_0x134127['HJWdF']),_reactNative['Alert'][_0x4bcc(0x29)](_0x134127[_0x4bcc(0x39)],'No\x20valid\x20conversations\x20found\x20to\x20export.',[{'text':'OK','style':_0x134127[_0x4bcc(0x3a)]}]),![];_0x134127[_0x4bcc(0x3b)](_0x597ab2[_0x4bcc(0x25)],_0xc1ec57[_0x4bcc(0x25)])&&console[_0x4bcc(0x34)](_0x4bcc(0x3c)+_0x134127[_0x4bcc(0x3d)](_0xc1ec57[_0x4bcc(0x25)],_0x597ab2[_0x4bcc(0x25)])+_0x4bcc(0x3e));try{if(_0x134127[_0x4bcc(0x3f)](_0x134127[_0x4bcc(0x40)],_0x134127['oURAT']))return _0x1d0238[_0x4bcc(0x34)](_0x4d65e7['JtVkD']),![];else{console[_0x4bcc(0x22)](_0x134127['SKLTy']);const _0x16792c=await(0x0,_chatGPTConversationService[_0x4bcc(0x41)])(_0x531dc6,_0x597ab2);return _0x16792c[_0x4bcc(0x42)]?(console[_0x4bcc(0x22)](_0x4bcc(0x14)),console[_0x4bcc(0x22)](_0x134127[_0x4bcc(0x43)],_0x16792c[_0x4bcc(0x44)]),!![]):_0x134127['oDUFq'](_0x134127['DGXJM'],_0x134127[_0x4bcc(0x45)])?(_0xeaf32a['error']('❌\x20[CHATGPT_EXTRACTOR]\x20Unexpected\x20error\x20storing\x20memories:',_0x39c228),![]):(console[_0x4bcc(0x26)](_0x134127['GSIDh'],_0x16792c[_0x4bcc(0x26)]),_reactNative[_0x4bcc(0x28)]['alert'](_0x134127[_0x4bcc(0x46)],_0x16792c[_0x4bcc(0x26)]||_0x134127[_0x4bcc(0x47)],[{'text':'OK','style':_0x134127[_0x4bcc(0x3a)]}]),![]);}}catch(_0x90c6d3){return console[_0x4bcc(0x26)](_0x134127[_0x4bcc(0x48)],_0x90c6d3),_reactNative[_0x4bcc(0x28)][_0x4bcc(0x29)](_0x134127[_0x4bcc(0x49)],_0x134127[_0x4bcc(0x4a)],[{'text':'OK','style':_0x4bcc(0xa)}]),![];}}},_0x2c46ef=async _0x4a2a3b=>{const _0x5b2770={'UHpXl':_0x134127[_0x4bcc(0x4b)],'OBKLM':'📊\x20[CHATGPT_EXTRACTOR]\x20Backend\x20response:'};if(_0x134127[_0x4bcc(0x4c)](_0x134127[_0x4bcc(0x4d)],_0x134127[_0x4bcc(0x4d)])){var _0x188194;return _0x4b3a34[_0x4bcc(0x22)](_0x134127['gPnWc']),_0x134127[_0x4bcc(0x3f)](_0x188194=_0x55181e['data'],null)&&_0x188194!==void 0x0&&_0x188194[_0x4bcc(0x4e)]&&_0x167ee5[_0x4bcc(0x22)](_0x4bcc(0x4f)+_0x45fc16[_0x4bcc(0x44)][_0x4bcc(0x4e)]+_0x4bcc(0x50)),!![];}else{var _0x469609,_0x24c487,_0x3d2a48;console[_0x4bcc(0x22)](_0x134127[_0x4bcc(0x51)]);if(!_0x4a2a3b)return console['warn'](_0x4bcc(0x4)),![];const _0x2d6c3a=(_0x134127[_0x4bcc(0x1f)](_0x4a2a3b,null)||_0x134127[_0x4bcc(0x1f)](_0x4a2a3b,void 0x0)||_0x134127[_0x4bcc(0x1f)](_0x469609=_0x4a2a3b['items'],null)||_0x134127['vKYZj'](_0x469609,void 0x0)?void 0x0:_0x469609[_0x4bcc(0x25)])||0x0,_0x36f808=(_0x4a2a3b===null||_0x4a2a3b===void 0x0||_0x134127['fsGVC'](_0x24c487=_0x4a2a3b['memory_entries'],null)||_0x134127[_0x4bcc(0x52)](_0x24c487,void 0x0)?void 0x0:_0x24c487[_0x4bcc(0x25)])||0x0,_0x28344f=(_0x134127[_0x4bcc(0x53)](_0x4a2a3b,null)||_0x134127[_0x4bcc(0x54)](_0x4a2a3b,void 0x0)||(_0x3d2a48=_0x4a2a3b[_0x4bcc(0x55)])===null||_0x134127[_0x4bcc(0x56)](_0x3d2a48,void 0x0)?void 0x0:_0x3d2a48['length'])||0x0;console[_0x4bcc(0x22)](_0x4bcc(0x57)+_0x2d6c3a+_0x4bcc(0x58)+_0x36f808+_0x4bcc(0x59)+_0x28344f+_0x4bcc(0x50));if(_0x134127[_0x4bcc(0x5a)](_0x2d6c3a,0x0)&&_0x134127[_0x4bcc(0x5b)](_0x36f808,0x0)&&_0x134127[_0x4bcc(0x1f)](_0x28344f,0x0))return console['log'](_0x134127[_0x4bcc(0x5c)]),!![];try{if(_0x134127[_0x4bcc(0x5d)]===_0x134127['KNhir']){console[_0x4bcc(0x22)](_0x134127['OZuse']);const _0x273083=await(0x0,_chatGPTConversationService[_0x4bcc(0x5e)])(_0x4a2a3b);if(_0x273083['success']){if(_0x134127[_0x4bcc(0x5f)](_0x4bcc(0x60),_0x134127[_0x4bcc(0x61)])){var _0x1575ba;console[_0x4bcc(0x22)](_0x134127[_0x4bcc(0x62)]);if(_0x134127[_0x4bcc(0x5f)](_0x1575ba=_0x273083[_0x4bcc(0x44)],null)&&_0x1575ba!==void 0x0&&_0x1575ba[_0x4bcc(0x4e)]){if(_0x134127['fsGVC'](_0x134127[_0x4bcc(0x63)],_0x134127[_0x4bcc(0x63)]))console[_0x4bcc(0x22)]('📋\x20[CHATGPT_EXTRACTOR]\x20Backend\x20stored\x20'+_0x273083[_0x4bcc(0x44)]['memoriesCount']+'\x20memories');else return _0x295c38['log'](_0x5b2770['UHpXl']),_0x43937['log'](_0x5b2770[_0x4bcc(0x64)],_0x4c9c41[_0x4bcc(0x44)]),!![];}return!![];}else _0x30ff54[_0x4bcc(0x22)](_0x4bcc(0x4f)+_0x24c1e2[_0x4bcc(0x44)][_0x4bcc(0x4e)]+'\x20memories');}else return console[_0x4bcc(0x26)](_0x134127[_0x4bcc(0x65)],_0x273083[_0x4bcc(0x26)]),![];}else _0x4b826e[_0x4bcc(0x34)]('⚠️\x20[CHATGPT_EXTRACTOR]\x20Invalid\x20conversation:',_0x2d8447);}catch(_0x6e61dd){return console[_0x4bcc(0x26)](_0x134127[_0x4bcc(0x66)],_0x6e61dd),![];}}};return{'initiateConversationExport':_0x52a60c,'storeMemories':_0x2c46ef};};exports[_0x4bcc(0x0)]=useChatGPTConversationExtractor;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useChatGPTConversationExtractor = void 0;
7
+ var _chatGPTConversationService = require("./chatGPTConversationService");
8
+ var _reactNative = require("react-native");
9
+ /**
10
+ * ChatGPT Conversation Extractor
11
+ *
12
+ * Orchestrates the ChatGPT conversation export flow:
13
+ * 1. Receives extracted conversations from WebView
14
+ * 2. Validates and formats data
15
+ * 3. Sends to backend via chatGPTConversationService
16
+ * 4. Also handles ChatGPT memories export
17
+ *
18
+ * This acts as the bridge between OAuthWebView and the backend API.
19
+ *
20
+ * @reference iOS implementation: onairos-flutter/ios/Classes/OnairosChatGPTConnectorPlugin.swift
21
+ */
22
+
23
+ /**
24
+ * Hook for ChatGPT conversation extraction operations
25
+ */
26
+ const useChatGPTConversationExtractor = () => {
27
+ /**
28
+ * Initiate conversation export to backend
29
+ *
30
+ * @param username - User identifier
31
+ * @param conversations - Array of conversations with user messages
32
+ * @returns true if successful, false otherwise
33
+ */
34
+ const initiateConversationExport = async (username, conversations) => {
35
+ console.log('🚀 [CHATGPT_EXTRACTOR] Initiating conversation export');
36
+ console.log('👤 [CHATGPT_EXTRACTOR] Username:', username);
37
+ console.log('📊 [CHATGPT_EXTRACTOR] Conversations to send:', conversations.length);
38
+
39
+ // Validation
40
+ if (!username) {
41
+ console.error('❌ [CHATGPT_EXTRACTOR] Username is required');
42
+ _reactNative.Alert.alert('Error', 'Username is required to export ChatGPT conversations.', [{
43
+ text: 'OK',
44
+ style: 'default'
45
+ }]);
46
+ return false;
47
+ }
48
+
49
+ // Handle 0 conversations as success - user might be new or have cleared history
50
+ // This matches iOS behavior where empty conversations still counts as successful connection
51
+ if (!conversations || conversations.length === 0) {
52
+ console.log('ℹ️ [CHATGPT_EXTRACTOR] No conversations to export - treating as success (connected)');
53
+ return true;
54
+ }
55
+
56
+ // Validate conversation structure
57
+ const validConversations = conversations.filter(conv => {
58
+ const isValid = conv.conversation_id && conv.title && Array.isArray(conv.user_messages) && conv.user_messages.length > 0;
59
+ if (!isValid) {
60
+ console.warn('⚠️ [CHATGPT_EXTRACTOR] Invalid conversation:', conv);
61
+ }
62
+ return isValid;
63
+ });
64
+ if (validConversations.length === 0) {
65
+ console.error('❌ [CHATGPT_EXTRACTOR] No valid conversations after filtering');
66
+ _reactNative.Alert.alert('Data Error', 'No valid conversations found to export.', [{
67
+ text: 'OK',
68
+ style: 'default'
69
+ }]);
70
+ return false;
71
+ }
72
+ if (validConversations.length < conversations.length) {
73
+ console.warn(`⚠️ [CHATGPT_EXTRACTOR] Filtered out ${conversations.length - validConversations.length} invalid conversations`);
74
+ }
75
+ try {
76
+ console.log('📡 [CHATGPT_EXTRACTOR] Sending to backend...');
77
+ const result = await (0, _chatGPTConversationService.storeChatGPTConversations)(username, validConversations);
78
+ if (result.success) {
79
+ console.log('✅ [CHATGPT_EXTRACTOR] Export completed successfully');
80
+ console.log('📊 [CHATGPT_EXTRACTOR] Backend response:', result.data);
81
+ return true;
82
+ } else {
83
+ console.error('❌ [CHATGPT_EXTRACTOR] Backend storage failed:', result.error);
84
+ _reactNative.Alert.alert('Export Failed', result.error || 'An unknown error occurred during conversation storage.', [{
85
+ text: 'OK',
86
+ style: 'default'
87
+ }]);
88
+ return false;
89
+ }
90
+ } catch (error) {
91
+ console.error('❌ [CHATGPT_EXTRACTOR] Unexpected error during export:', error);
92
+ _reactNative.Alert.alert('Export Error', 'Failed to connect to the conversation storage service. Please check your network connection.', [{
93
+ text: 'OK',
94
+ style: 'default'
95
+ }]);
96
+ return false;
97
+ }
98
+ };
99
+
100
+ /**
101
+ * Store ChatGPT memories on backend
102
+ * MATCHES iOS: OnairosChatGPTConnectorPlugin.swift saveMemories() + sendMemoriesToBackend()
103
+ *
104
+ * @param memoriesData - Raw ChatGPT memories JSON from WebView
105
+ * @returns true if successful, false otherwise
106
+ */
107
+ const storeMemories = async memoriesData => {
108
+ var _memoriesData$items, _memoriesData$memory_, _memoriesData$memorie;
109
+ console.log('🧠 [CHATGPT_EXTRACTOR] Storing ChatGPT memories...');
110
+
111
+ // Validation
112
+ if (!memoriesData) {
113
+ console.warn('⚠️ [CHATGPT_EXTRACTOR] No memories data provided');
114
+ return false;
115
+ }
116
+
117
+ // Count items (matches iOS logging)
118
+ const itemsCount = (memoriesData === null || memoriesData === void 0 || (_memoriesData$items = memoriesData.items) === null || _memoriesData$items === void 0 ? void 0 : _memoriesData$items.length) || 0;
119
+ const entriesCount = (memoriesData === null || memoriesData === void 0 || (_memoriesData$memory_ = memoriesData.memory_entries) === null || _memoriesData$memory_ === void 0 ? void 0 : _memoriesData$memory_.length) || 0;
120
+ const memoriesCount = (memoriesData === null || memoriesData === void 0 || (_memoriesData$memorie = memoriesData.memories) === null || _memoriesData$memorie === void 0 ? void 0 : _memoriesData$memorie.length) || 0;
121
+ console.log(`📋 [CHATGPT_EXTRACTOR] Found ${itemsCount} memory items, ${entriesCount} memory entries, ${memoriesCount} memories`);
122
+
123
+ // If no memories, still treat as success (user might not have any memories)
124
+ if (itemsCount === 0 && entriesCount === 0 && memoriesCount === 0) {
125
+ console.log('ℹ️ [CHATGPT_EXTRACTOR] No memories to store - treating as success');
126
+ return true;
127
+ }
128
+ try {
129
+ console.log('📡 [CHATGPT_EXTRACTOR] Sending memories to backend...');
130
+ const result = await (0, _chatGPTConversationService.storeChatGPTMemories)(memoriesData);
131
+ if (result.success) {
132
+ var _result$data;
133
+ console.log('✅ [CHATGPT_EXTRACTOR] Memories stored successfully');
134
+ if ((_result$data = result.data) !== null && _result$data !== void 0 && _result$data.memoriesCount) {
135
+ console.log(`📋 [CHATGPT_EXTRACTOR] Backend stored ${result.data.memoriesCount} memories`);
136
+ }
137
+ return true;
138
+ } else {
139
+ console.error('❌ [CHATGPT_EXTRACTOR] Memories storage failed:', result.error);
140
+ // Don't show alert for memories failure - it's secondary data
141
+ // The main conversation export is what matters
142
+ return false;
143
+ }
144
+ } catch (error) {
145
+ console.error('❌ [CHATGPT_EXTRACTOR] Unexpected error storing memories:', error);
146
+ return false;
147
+ }
148
+ };
149
+ return {
150
+ initiateConversationExport,
151
+ storeMemories
152
+ };
153
+ };
154
+ exports.useChatGPTConversationExtractor = useChatGPTConversationExtractor;
155
+ //# sourceMappingURL=chatGPTConversationExtractor.js.map
@@ -1,9 +1,275 @@
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 _0x4208(_0x2b8c99,_0x4208ed){_0x2b8c99=_0x2b8c99-0x0;const _0x5b956a=_0x2b8c();let _0x446b9a=_0x5b956a[_0x2b8c99];return _0x446b9a;}Object['defineProperty'](exports,_0x4208(0x0),{'value':!![]}),exports[_0x4208(0x1)]=exports[_0x4208(0x2)]=void 0x0;var _api=__ONAIROS_REQ_FUNC__(0x0),_asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x1)),_reactNative=__ONAIROS_REQ_FUNC__(0x2);function _interopRequireDefault(_0x4158e6){return _0x4158e6&&_0x4158e6[_0x4208(0x0)]?_0x4158e6:{'default':_0x4158e6};}const storeChatGPTConversations=async(_0x45da42,_0x41399b)=>{const _0x37130c={'Xurld':'Unknown\x20error','coZeO':_0x4208(0x3),'CMVxZ':function(_0x4e7874,_0x3f8a5){return _0x4e7874||_0x3f8a5;},'XYGeX':function(_0x3a061c,_0x3c004a){return _0x3a061c===_0x3c004a;},'mxBpj':_0x4208(0x4),'zNBQW':_0x4208(0x5),'qLAic':_0x4208(0x6),'codMJ':_0x4208(0x7),'CNBeF':function(_0x5a4060,_0x3b9085){return _0x5a4060!==_0x3b9085;},'JAQkH':_0x4208(0x8),'lDVbA':_0x4208(0x9),'AbSaG':_0x4208(0xa),'JIBXP':'🔑\x20[CHATGPT_SERVICE]\x20Auth\x20token\x20found\x20for\x20conversations','FBDNG':_0x4208(0xb),'ifFTZ':function(_0x15f815,_0x337242){return _0x15f815===_0x337242;},'tjacX':'ios','OVTrY':_0x4208(0xc),'bjffb':function(_0x475a7e,_0x282be7){return _0x475a7e===_0x282be7;},'YjoqX':_0x4208(0xd),'FABOk':_0x4208(0xe),'qBMGT':function(_0x592643,_0x191602){return _0x592643<_0x191602;},'zERLS':function(_0x25a545,_0x2f6132){return _0x25a545/_0x2f6132;},'HYZlj':'mobile-chatgpt','CdbPh':_0x4208(0xf),'VjVAl':function(_0x2f4546,_0x2858c9){return _0x2f4546+_0x2858c9;},'kKQcV':function(_0x2b8cdd,_0x182e8b,_0x5e5547){return _0x2b8cdd(_0x182e8b,_0x5e5547);},'FxRLT':function(_0x275e55,_0x4a4848){return _0x275e55<_0x4a4848;},'GmljP':'ydPTp','TPAWu':function(_0x290d7e,_0x3842fc){return _0x290d7e>_0x3842fc;},'xsVtd':'pgiET','WLYoi':_0x4208(0x10),'gTFdr':_0x4208(0x11),'Dtara':_0x4208(0x12),'CKqmb':'Network\x20error.\x20Please\x20check\x20your\x20connection.'};console['log'](_0x4208(0x13),_0x45da42),console['log'](_0x37130c[_0x4208(0x14)],_0x41399b[_0x4208(0x15)]),console[_0x4208(0x16)](_0x4208(0x17),_0x41399b[_0x4208(0x18)]((_0x253553,_0x4ad87e)=>_0x253553+_0x4ad87e[_0x4208(0x19)]['length'],0x0));if(_0x37130c[_0x4208(0x1a)](!_0x45da42,!_0x41399b)||_0x37130c[_0x4208(0x1b)](_0x41399b[_0x4208(0x15)],0x0))return console[_0x4208(0x1c)](_0x4208(0x1d)),{'success':![],'error':_0x37130c[_0x4208(0x1e)]};try{const _0x108f14=await _asyncStorage[_0x4208(0x1f)][_0x4208(0x20)](_0x37130c['zNBQW'])||await _asyncStorage[_0x4208(0x1f)][_0x4208(0x20)](_0x37130c['qLAic'])||await _asyncStorage[_0x4208(0x1f)]['getItem'](_0x37130c['codMJ']);if(!_0x108f14)return _0x37130c[_0x4208(0x21)](_0x37130c[_0x4208(0x22)],_0x37130c[_0x4208(0x23)])?(console[_0x4208(0x1c)](_0x37130c['AbSaG']),{'success':![],'error':_0x4208(0x24)}):(_0x47987e[_0x4208(0x25)]('⚠️\x20[CHATGPT_SERVICE]\x20Memories\x20backend\x20returned\x20status:\x20'+_0x358260[_0x4208(0x26)]),_0x5d5dec['warn'](_0x4208(0x27)+(_0x235267[_0x4208(0x1c)]||_0x37130c[_0x4208(0x28)])),{'success':![],'error':_0x914d22[_0x4208(0x1c)]||_0x4208(0x29)+_0x1e4fc9[_0x4208(0x26)]});console[_0x4208(0x16)](_0x37130c['JIBXP']);const _0x56d976={'platform':_reactNative[_0x4208(0x2a)]['OS'],'appVersion':_0x37130c[_0x4208(0x2b)],'osVersion':_0x37130c[_0x4208(0x2c)](_reactNative[_0x4208(0x2a)]['OS'],_0x37130c[_0x4208(0x2d)])?_0x37130c['OVTrY']:_reactNative[_0x4208(0x2a)]['OS'],'deviceModel':_0x37130c[_0x4208(0x2e)](_reactNative[_0x4208(0x2a)]['OS'],_0x4208(0x2f))?_0x37130c[_0x4208(0x30)]:_0x37130c['FABOk'],'isOfflineSync':![]};let _0x5be6f6=0x0,_0x55c0cd=0x0;for(let _0x2f3139=0x0;_0x37130c[_0x4208(0x31)](_0x2f3139,_0x41399b[_0x4208(0x15)]);_0x2f3139++){const _0x23ff57=_0x41399b[_0x2f3139],_0x591799=Date[_0x4208(0x32)](),_0x55a569=_0x23ff57[_0x4208(0x19)]['map']((_0x434f39,_0x20b51f)=>({'id':_0x23ff57[_0x4208(0x33)]+_0x4208(0x34)+_0x20b51f,'role':_0x4208(0x35),'content':_0x434f39,'timestamp':new Date(_0x591799-(_0x23ff57[_0x4208(0x19)][_0x4208(0x15)]-_0x20b51f)*0x3e8)['toISOString'](),'metadata':{}})),_0x3e9bc4={'conversationId':_0x23ff57[_0x4208(0x33)],'messages':_0x55a569,'context':{'title':_0x23ff57[_0x4208(0x36)],'create_time':Math[_0x4208(0x37)](_0x591799/0x3e8),'update_time':Math['floor'](_0x37130c[_0x4208(0x38)](_0x591799,0x3e8))},'mobileMetadata':_0x56d976},_0x23e9d0={'platform':_0x37130c[_0x4208(0x39)],'conversationData':_0x3e9bc4,'memoryType':_0x37130c[_0x4208(0x3a)]};console[_0x4208(0x16)]('📡\x20[CHATGPT_SERVICE]\x20Sending\x20conversation\x20'+_0x37130c[_0x4208(0x3b)](_0x2f3139,0x1)+'/'+_0x41399b[_0x4208(0x15)]+':\x20'+_0x23ff57[_0x4208(0x36)]);try{const _0x5b1316=await _0x37130c[_0x4208(0x3c)](fetch,_api[_0x4208(0x3d)]['BASE_URL']+_0x4208(0x3e),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x4208(0x3f)+_0x108f14,'User-Agent':_0x4208(0x40)+_reactNative[_0x4208(0x2a)]['OS']+')'},'body':JSON[_0x4208(0x41)](_0x23e9d0)}),_0x145005=await _0x5b1316['json']();_0x5b1316['ok']?(console[_0x4208(0x16)](_0x4208(0x42)+_0x37130c[_0x4208(0x3b)](_0x2f3139,0x1)+'/'+_0x41399b['length']),_0x5be6f6++):(console[_0x4208(0x25)](_0x4208(0x43)+_0x37130c[_0x4208(0x3b)](_0x2f3139,0x1)+'/'+_0x41399b[_0x4208(0x15)]+':',_0x145005['error']||_0x5b1316[_0x4208(0x26)]),_0x55c0cd++);}catch(_0x536795){console[_0x4208(0x25)](_0x4208(0x44)+(_0x2f3139+0x1)+':',_0x536795),_0x55c0cd++;}if(_0x37130c[_0x4208(0x45)](_0x2f3139,_0x41399b[_0x4208(0x15)]-0x1)){if(_0x37130c[_0x4208(0x2e)](_0x4208(0x46),_0x37130c[_0x4208(0x47)]))return{'success':![],'error':_0x4208(0x48)+_0x5f346c+_0x4208(0x49)};else await new Promise(_0x333314=>setTimeout(_0x333314,0x12c));}}console[_0x4208(0x16)](_0x4208(0x4a)+_0x5be6f6+_0x4208(0x4b)+_0x55c0cd+_0x4208(0x4c));if(_0x37130c[_0x4208(0x4d)](_0x5be6f6,0x0)){if(_0x37130c['ifFTZ'](_0x37130c[_0x4208(0x4e)],_0x4208(0x4f)))return{'success':!![],'message':_0x4208(0x50)+_0x5be6f6+_0x4208(0x51)+_0x41399b[_0x4208(0x15)]+_0x4208(0x52)};else _0x346e8e[_0x4208(0x16)](_0x4208(0x53)+_0x1dbb78[_0x4208(0x54)]);}else{if(_0x37130c['WLYoi']===_0x37130c[_0x4208(0x55)])_0x2f2602[_0x4208(0x16)](_0x4208(0x56)+_0x4aee61['data']['memoriesCount']+_0x4208(0x57));else return{'success':![],'error':_0x4208(0x48)+_0x55c0cd+_0x4208(0x49)};}}catch(_0x516ce1){return console[_0x4208(0x1c)](_0x37130c[_0x4208(0x58)],_0x516ce1),{'success':![],'error':_0x516ce1[_0x4208(0x54)]||_0x37130c[_0x4208(0x59)]};}};exports[_0x4208(0x2)]=storeChatGPTConversations;const storeChatGPTMemories=async _0x1cc4e2=>{const _0x2cd69d={'rVABH':_0x4208(0xa),'gSfFN':_0x4208(0x24),'ewGqK':function(_0xdc3350,_0x10c376){return _0xdc3350+_0x10c376;},'svioI':_0x4208(0x5a),'JwjWj':function(_0x527d24,_0xb12fd4){return _0x527d24===_0xb12fd4;},'gADcw':function(_0x23bd2d,_0x486958){return _0x23bd2d===_0x486958;},'vOQMd':function(_0x5c007d,_0x4db52c){return _0x5c007d===_0x4db52c;},'qIyxI':function(_0x499a14,_0x9b9931){return _0x499a14===_0x9b9931;},'kGalT':function(_0x4b7e55,_0x21fa37){return _0x4b7e55===_0x21fa37;},'NeBsk':function(_0xdda0c4,_0x3fca34){return _0xdda0c4+_0x3fca34;},'IUVBO':_0x4208(0x5b),'ALybP':'enoch_token','AXGMS':_0x4208(0x7),'XjaUB':_0x4208(0x5c),'nlEty':_0x4208(0xb),'hNcrA':'mobile-chatgpt','JmJui':function(_0x6e02c2,_0x5f9aa4,_0x14c274){return _0x6e02c2(_0x5f9aa4,_0x14c274);},'HcqGG':function(_0x9473b1,_0x542b64){return _0x9473b1===_0x542b64;},'wBetG':_0x4208(0x5d),'DUXrp':_0x4208(0x5e),'YoORq':function(_0x2afc5d,_0x1010a9){return _0x2afc5d!==_0x1010a9;},'wZnov':_0x4208(0x5f),'ovlMw':_0x4208(0x60),'JwDAa':_0x4208(0x61),'ybBXH':_0x4208(0x62)};var _0x3a8483,_0x19717f,_0x171a68;console['log'](_0x2cd69d[_0x4208(0x63)]);const _0x5908c5=(_0x2cd69d[_0x4208(0x64)](_0x1cc4e2,null)||_0x2cd69d[_0x4208(0x64)](_0x1cc4e2,void 0x0)||_0x2cd69d['gADcw'](_0x3a8483=_0x1cc4e2[_0x4208(0x65)],null)||_0x2cd69d[_0x4208(0x66)](_0x3a8483,void 0x0)?void 0x0:_0x3a8483['length'])||0x0,_0x30ca41=(_0x2cd69d[_0x4208(0x67)](_0x1cc4e2,null)||_0x2cd69d[_0x4208(0x67)](_0x1cc4e2,void 0x0)||_0x2cd69d[_0x4208(0x68)](_0x19717f=_0x1cc4e2[_0x4208(0x69)],null)||_0x19717f===void 0x0?void 0x0:_0x19717f['length'])||0x0,_0x301429=(_0x2cd69d['kGalT'](_0x1cc4e2,null)||_0x2cd69d[_0x4208(0x67)](_0x1cc4e2,void 0x0)||_0x2cd69d[_0x4208(0x64)](_0x171a68=_0x1cc4e2['memories'],null)||_0x2cd69d[_0x4208(0x66)](_0x171a68,void 0x0)?void 0x0:_0x171a68['length'])||0x0,_0x357ed2=_0x2cd69d[_0x4208(0x6a)](_0x2cd69d[_0x4208(0x6b)](_0x5908c5,_0x30ca41),_0x301429);console[_0x4208(0x16)](_0x4208(0x6c)+_0x5908c5+_0x4208(0x6d)+_0x30ca41+_0x4208(0x6e)+_0x301429+_0x4208(0x6f)+_0x357ed2+')');if(!_0x1cc4e2)return _0x2cd69d[_0x4208(0x64)](_0x2cd69d[_0x4208(0x70)],_0x2cd69d[_0x4208(0x70)])?(console[_0x4208(0x1c)](_0x4208(0x71)),{'success':![],'error':'Invalid\x20input:\x20memoriesData\x20missing.'}):(_0x39a80d['error'](_0x2cd69d[_0x4208(0x72)]),{'success':![],'error':_0x2cd69d['gSfFN']});try{const _0x4aefb9=await _asyncStorage[_0x4208(0x1f)][_0x4208(0x20)]('onairos_jwt_token')||await _asyncStorage[_0x4208(0x1f)]['getItem'](_0x2cd69d[_0x4208(0x73)])||await _asyncStorage[_0x4208(0x1f)][_0x4208(0x20)](_0x2cd69d[_0x4208(0x74)]);if(!_0x4aefb9)return console['error'](_0x2cd69d[_0x4208(0x72)]),{'success':![],'error':_0x2cd69d['gSfFN']};console[_0x4208(0x16)](_0x2cd69d[_0x4208(0x75)]);const _0x159440=_0x2cd69d[_0x4208(0x76)],_0x23a406={'platform':_0x2cd69d['hNcrA'],'memoriesData':_0x1cc4e2,'metadata':{'source':'react-native-sdk','appVersion':_0x159440,'fetchedAt':new Date()[_0x4208(0x77)]()}},_0x508810=Object['keys'](_0x1cc4e2||{});console[_0x4208(0x16)](_0x4208(0x78)),console[_0x4208(0x16)]('📍\x20[CHATGPT_SERVICE]\x20URL:\x20'+_api[_0x4208(0x3d)][_0x4208(0x79)]+_0x4208(0x7a)),console[_0x4208(0x16)](_0x4208(0x7b)+_0x508810[_0x4208(0x7c)](',\x20')),console[_0x4208(0x16)](_0x4208(0x7d));const _0xcda38=await _0x2cd69d[_0x4208(0x7e)](fetch,_api[_0x4208(0x3d)][_0x4208(0x79)]+'/llm-data/store-memories',{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x4aefb9,'User-Agent':_0x4208(0x7f)+_0x159440+'\x20('+_reactNative[_0x4208(0x2a)]['OS']+')'},'body':JSON[_0x4208(0x41)](_0x23a406)}),_0x41c698=await _0xcda38[_0x4208(0x80)]();if(_0xcda38['ok']){var _0x4d9140;console[_0x4208(0x16)](_0x4208(0x81));_0x41c698[_0x4208(0x54)]&&(_0x2cd69d[_0x4208(0x82)](_0x2cd69d[_0x4208(0x83)],_0x2cd69d[_0x4208(0x84)])?(_0x465a7e[_0x4208(0x25)](_0x4208(0x43)+_0x2cd69d[_0x4208(0x6a)](_0x57f12a,0x1)+'/'+_0x2bc0f7['length']+':',_0x3946ed[_0x4208(0x1c)]||_0x289ca3['status']),_0x1b0409++):console[_0x4208(0x16)](_0x4208(0x53)+_0x41c698[_0x4208(0x54)]));if(_0x2cd69d[_0x4208(0x85)](_0x4d9140=_0x41c698['data'],null)&&_0x4d9140!==void 0x0&&_0x4d9140['memoriesCount']){if(_0x2cd69d[_0x4208(0x86)]===_0x4208(0x87))return _0x211e9c[_0x4208(0x1c)](_0x2cd69d['rVABH']),{'success':![],'error':_0x2cd69d[_0x4208(0x88)]};else console[_0x4208(0x16)](_0x4208(0x56)+_0x41c698[_0x4208(0x89)][_0x4208(0x8a)]+_0x4208(0x57));}return{'success':!![],'message':_0x41c698[_0x4208(0x54)]||_0x2cd69d[_0x4208(0x8b)],'data':_0x41c698[_0x4208(0x89)]};}else return console[_0x4208(0x25)](_0x4208(0x8c)+_0xcda38[_0x4208(0x26)]),console['warn'](_0x4208(0x27)+(_0x41c698[_0x4208(0x1c)]||_0x2cd69d[_0x4208(0x8d)])),{'success':![],'error':_0x41c698['error']||_0x4208(0x29)+_0xcda38[_0x4208(0x26)]};}catch(_0xe0fdef){return console[_0x4208(0x1c)](_0x2cd69d[_0x4208(0x8e)],_0xe0fdef),{'success':![],'error':_0xe0fdef['message']||_0x4208(0x8f)};}};exports[_0x4208(0x1)]=storeChatGPTMemories;function _0x2b8c(){const _0x28dc2d=['__esModule','storeChatGPTMemories','storeChatGPTConversations','📊\x20[CHATGPT_SERVICE]\x20Number\x20of\x20conversations:','Invalid\x20input:\x20userId\x20or\x20conversations\x20missing.','onairos_jwt_token','enoch_token','auth_token','nTfPy','iBBEV','❌\x20[CHATGPT_SERVICE]\x20No\x20auth\x20token\x20found\x20in\x20any\x20storage\x20key','1.0.0','17.0','iPhone','Android','conversation','uxlte','kcVMJ','❌\x20[CHATGPT_SERVICE]\x20Network\x20error:','🚀\x20[CHATGPT_SERVICE]\x20Storing\x20ChatGPT\x20conversations\x20for:','coZeO','length','log','📊\x20[CHATGPT_SERVICE]\x20Total\x20messages:','reduce','user_messages','CMVxZ','XYGeX','error','❌\x20[CHATGPT_SERVICE]\x20Invalid\x20input','mxBpj','default','getItem','CNBeF','JAQkH','lDVbA','Authentication\x20token\x20not\x20found.\x20Please\x20log\x20in\x20again.','warn','status','⚠️\x20[CHATGPT_SERVICE]\x20Error:\x20','Xurld','HTTP\x20','Platform','FBDNG','ifFTZ','tjacX','bjffb','ios','YjoqX','qBMGT','now','conversation_id','-msg-','user','title','floor','zERLS','HYZlj','CdbPh','VjVAl','kKQcV','API_CONFIG','/llm-data/store','Bearer\x20','OnairosSDK/1.0.0\x20(','stringify','✅\x20[CHATGPT_SERVICE]\x20Sent\x20conversation\x20','⚠️\x20[CHATGPT_SERVICE]\x20Failed\x20conversation\x20','⚠️\x20[CHATGPT_SERVICE]\x20Network\x20error\x20for\x20conversation\x20','FxRLT','mqjxS','GmljP','Failed\x20to\x20store\x20conversations\x20(','\x20errors)','📊\x20[CHATGPT_SERVICE]\x20Complete:\x20','\x20success,\x20','\x20failed','TPAWu','xsVtd','pgiET','Stored\x20','\x20of\x20','\x20conversations','📝\x20[CHATGPT_SERVICE]\x20Backend\x20response:\x20','message','gTFdr','📋\x20[CHATGPT_SERVICE]\x20Stored\x20','\x20memory\x20items\x20in\x20database','Dtara','CKqmb','🧠\x20[CHATGPT_SERVICE]\x20Storing\x20ChatGPT\x20memories...','zNtGZ','🔑\x20[CHATGPT_SERVICE]\x20Auth\x20token\x20found\x20for\x20memories','cVLYO','mbhdE','Hixrx','Memories\x20stored\x20successfully','Unknown\x20error','❌\x20[CHATGPT_SERVICE]\x20Memories\x20network\x20error:','svioI','JwjWj','items','vOQMd','qIyxI','gADcw','memory_entries','ewGqK','NeBsk','📋\x20[CHATGPT_SERVICE]\x20Found\x20','\x20items,\x20','\x20entries,\x20','\x20memories\x20(total:\x20','IUVBO','❌\x20[CHATGPT_SERVICE]\x20Invalid\x20input:\x20memoriesData\x20missing','rVABH','ALybP','AXGMS','XjaUB','nlEty','toISOString','📡\x20[CHATGPT_SERVICE]\x20Sending\x20memories\x20to\x20backend...','BASE_URL','/llm-data/store-memories','📦\x20[CHATGPT_SERVICE]\x20Raw\x20memoriesData\x20keys:\x20','join','📦\x20[CHATGPT_SERVICE]\x20Raw\x20response\x20sent\x20as-is\x20(no\x20transformation)','JmJui','OnairosSDK/','json','✅\x20[CHATGPT_SERVICE]\x20Successfully\x20sent\x20memories\x20to\x20backend','HcqGG','wBetG','DUXrp','YoORq','wZnov','fBNKo','gSfFN','data','memoriesCount','ovlMw','⚠️\x20[CHATGPT_SERVICE]\x20Memories\x20backend\x20returned\x20status:\x20','JwDAa','ybBXH','Network\x20error.\x20Please\x20check\x20your\x20connection.'];_0x2b8c=function(){return _0x28dc2d;};return _0x2b8c();}
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.storeChatGPTMemories = exports.storeChatGPTConversations = 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
+ * ChatGPT Conversation Service
13
+ *
14
+ * API layer for storing ChatGPT conversation data on backend.
15
+ * Sends extracted user messages to /llm-data/store endpoint.
16
+ * Also handles ChatGPT memories via /llm-data/store-memories endpoint.
17
+ *
18
+ * MATCHES iOS: onairos-flutter/ios/Classes/OnairosChatGPTConnectorPlugin.swift
19
+ * - Sends ONE request per conversation (not all at once)
20
+ * - Uses format: { conversationId, messages[], context }
21
+ * - Platform: "mobile-chatgpt"
22
+ * - Memories sent to /llm-data/store-memories
23
+ */
24
+
25
+ /**
26
+ * Structure of conversation messages extracted from ChatGPT
27
+ */
28
+
29
+ /**
30
+ * Response from backend /llm-data/store endpoint
31
+ */
32
+
33
+ /**
34
+ * Store ChatGPT conversations on backend
35
+ * MATCHES iOS: Sends one request per conversation
36
+ *
37
+ * @param userId - Username or identifier
38
+ * @param conversations - Array of conversations with user messages
39
+ * @returns Response indicating success/failure with metadata
40
+ */
41
+ const storeChatGPTConversations = async (userId, conversations) => {
42
+ console.log('🚀 [CHATGPT_SERVICE] Storing ChatGPT conversations for:', userId);
43
+ console.log('📊 [CHATGPT_SERVICE] Number of conversations:', conversations.length);
44
+ console.log('📊 [CHATGPT_SERVICE] Total messages:', conversations.reduce((sum, c) => sum + c.user_messages.length, 0));
45
+
46
+ // Input validation
47
+ if (!userId || !conversations || conversations.length === 0) {
48
+ console.error('❌ [CHATGPT_SERVICE] Invalid input');
49
+ return {
50
+ success: false,
51
+ error: 'Invalid input: userId or conversations missing.'
52
+ };
53
+ }
54
+ try {
55
+ // Get auth token - check all possible storage keys (matches rest of codebase)
56
+ const authToken = (await _asyncStorage.default.getItem('onairos_jwt_token')) || (await _asyncStorage.default.getItem('enoch_token')) || (await _asyncStorage.default.getItem('auth_token'));
57
+ if (!authToken) {
58
+ console.error('❌ [CHATGPT_SERVICE] No auth token found in any storage key');
59
+ return {
60
+ success: false,
61
+ error: 'Authentication token not found. Please log in again.'
62
+ };
63
+ }
64
+ console.log('🔑 [CHATGPT_SERVICE] Auth token found for conversations');
65
+
66
+ // Mobile metadata (matches iOS mobileMetadata)
67
+ const mobileMetadata = {
68
+ platform: _reactNative.Platform.OS,
69
+ appVersion: '1.0.0',
70
+ osVersion: _reactNative.Platform.OS === 'ios' ? '17.0' : _reactNative.Platform.OS,
71
+ deviceModel: _reactNative.Platform.OS === 'ios' ? 'iPhone' : 'Android',
72
+ isOfflineSync: false
73
+ };
74
+ let successCount = 0;
75
+ let failCount = 0;
76
+
77
+ // MATCH iOS: Send ONE request per conversation
78
+ for (let i = 0; i < conversations.length; i++) {
79
+ const conv = conversations[i];
80
+ const now = Date.now();
81
+
82
+ // Build messages array matching iOS format
83
+ // iOS extracts: { id, role, content, timestamp, metadata }
84
+ const messages = conv.user_messages.map((content, msgIndex) => ({
85
+ id: `${conv.conversation_id}-msg-${msgIndex}`,
86
+ role: 'user',
87
+ content: content,
88
+ timestamp: new Date(now - (conv.user_messages.length - msgIndex) * 1000).toISOString(),
89
+ metadata: {}
90
+ }));
91
+
92
+ // Build conversationData matching iOS format exactly
93
+ // From AppDelegate.swift lines 1397-1405
94
+ const conversationData = {
95
+ conversationId: conv.conversation_id,
96
+ // iOS uses camelCase
97
+ messages: messages,
98
+ context: {
99
+ title: conv.title,
100
+ create_time: Math.floor(now / 1000),
101
+ update_time: Math.floor(now / 1000)
102
+ },
103
+ mobileMetadata: mobileMetadata
104
+ };
105
+
106
+ // Request body matching iOS sendToBackend format
107
+ // From AppDelegate.swift lines 376-380
108
+ const requestBody = {
109
+ platform: 'mobile-chatgpt',
110
+ // iOS uses "mobile-chatgpt"
111
+ conversationData: conversationData,
112
+ memoryType: 'conversation'
113
+ };
114
+ console.log(`📡 [CHATGPT_SERVICE] Sending conversation ${i + 1}/${conversations.length}: ${conv.title}`);
115
+ try {
116
+ const response = await fetch(`${_api.API_CONFIG.BASE_URL}/llm-data/store`, {
117
+ method: 'POST',
118
+ headers: {
119
+ 'Content-Type': 'application/json',
120
+ 'Authorization': `Bearer ${authToken}`,
121
+ 'User-Agent': `OnairosSDK/1.0.0 (${_reactNative.Platform.OS})`
122
+ },
123
+ body: JSON.stringify(requestBody)
124
+ });
125
+ const responseData = await response.json();
126
+ if (response.ok) {
127
+ console.log(`✅ [CHATGPT_SERVICE] Sent conversation ${i + 1}/${conversations.length}`);
128
+ successCount++;
129
+ } else {
130
+ console.warn(`⚠️ [CHATGPT_SERVICE] Failed conversation ${i + 1}/${conversations.length}:`, responseData.error || response.status);
131
+ failCount++;
132
+ }
133
+ } catch (convError) {
134
+ console.warn(`⚠️ [CHATGPT_SERVICE] Network error for conversation ${i + 1}:`, convError);
135
+ failCount++;
136
+ }
137
+
138
+ // Small delay between requests (iOS uses 0.3s)
139
+ if (i < conversations.length - 1) {
140
+ await new Promise(resolve => setTimeout(resolve, 300));
141
+ }
142
+ }
143
+ console.log(`📊 [CHATGPT_SERVICE] Complete: ${successCount} success, ${failCount} failed`);
144
+ if (successCount > 0) {
145
+ return {
146
+ success: true,
147
+ message: `Stored ${successCount} of ${conversations.length} conversations`
148
+ };
149
+ } else {
150
+ return {
151
+ success: false,
152
+ error: `Failed to store conversations (${failCount} errors)`
153
+ };
154
+ }
155
+ } catch (error) {
156
+ console.error('❌ [CHATGPT_SERVICE] Network error:', error);
157
+ return {
158
+ success: false,
159
+ error: error.message || 'Network error. Please check your connection.'
160
+ };
161
+ }
162
+ };
163
+
164
+ /**
165
+ * ChatGPT Memories Data structure (from ChatGPT API)
166
+ */
167
+
168
+ /**
169
+ * Response from backend /llm-data/store-memories endpoint
170
+ */
171
+ exports.storeChatGPTConversations = storeChatGPTConversations;
172
+ /**
173
+ * Store ChatGPT memories on backend
174
+ * MATCHES iOS: OnairosChatGPTConnectorPlugin.swift sendMemoriesToBackend()
175
+ *
176
+ * @param memoriesData - Raw ChatGPT memories JSON
177
+ * @returns Response indicating success/failure with metadata
178
+ */
179
+ const storeChatGPTMemories = async memoriesData => {
180
+ var _memoriesData$items, _memoriesData$memory_, _memoriesData$memorie;
181
+ console.log('🧠 [CHATGPT_SERVICE] Storing ChatGPT memories...');
182
+
183
+ // Count memory items for logging (matches iOS and WebView script)
184
+ const itemsCount = (memoriesData === null || memoriesData === void 0 || (_memoriesData$items = memoriesData.items) === null || _memoriesData$items === void 0 ? void 0 : _memoriesData$items.length) || 0;
185
+ const entriesCount = (memoriesData === null || memoriesData === void 0 || (_memoriesData$memory_ = memoriesData.memory_entries) === null || _memoriesData$memory_ === void 0 ? void 0 : _memoriesData$memory_.length) || 0;
186
+ const memoriesCount = (memoriesData === null || memoriesData === void 0 || (_memoriesData$memorie = memoriesData.memories) === null || _memoriesData$memorie === void 0 ? void 0 : _memoriesData$memorie.length) || 0;
187
+ const totalCount = itemsCount + entriesCount + memoriesCount;
188
+ console.log(`📋 [CHATGPT_SERVICE] Found ${itemsCount} items, ${entriesCount} entries, ${memoriesCount} memories (total: ${totalCount})`);
189
+
190
+ // Input validation
191
+ if (!memoriesData) {
192
+ console.error('❌ [CHATGPT_SERVICE] Invalid input: memoriesData missing');
193
+ return {
194
+ success: false,
195
+ error: 'Invalid input: memoriesData missing.'
196
+ };
197
+ }
198
+ try {
199
+ // Get auth token - check all possible storage keys (matches rest of codebase)
200
+ const authToken = (await _asyncStorage.default.getItem('onairos_jwt_token')) || (await _asyncStorage.default.getItem('enoch_token')) || (await _asyncStorage.default.getItem('auth_token'));
201
+ if (!authToken) {
202
+ console.error('❌ [CHATGPT_SERVICE] No auth token found in any storage key');
203
+ return {
204
+ success: false,
205
+ error: 'Authentication token not found. Please log in again.'
206
+ };
207
+ }
208
+ console.log('🔑 [CHATGPT_SERVICE] Auth token found for memories');
209
+
210
+ // Get app version
211
+ const appVersion = '1.0.0';
212
+
213
+ // Build request body matching iOS format exactly
214
+ // From OnairosChatGPTConnectorPlugin.swift lines 486-494
215
+ // CRITICAL: Send raw ChatGPT API response as-is (no transformation)
216
+ // Backend expects: { platform, memoriesData: { items, memory_entries, ... }, metadata }
217
+ const requestBody = {
218
+ platform: 'mobile-chatgpt',
219
+ memoriesData: memoriesData,
220
+ // Raw ChatGPT API response - sent as-is
221
+ metadata: {
222
+ source: 'react-native-sdk',
223
+ appVersion: appVersion,
224
+ fetchedAt: new Date().toISOString()
225
+ }
226
+ };
227
+
228
+ // Log the structure being sent (for debugging)
229
+ const memoriesDataKeys = Object.keys(memoriesData || {});
230
+ console.log(`📡 [CHATGPT_SERVICE] Sending memories to backend...`);
231
+ console.log(`📍 [CHATGPT_SERVICE] URL: ${_api.API_CONFIG.BASE_URL}/llm-data/store-memories`);
232
+ console.log(`📦 [CHATGPT_SERVICE] Raw memoriesData keys: ${memoriesDataKeys.join(', ')}`);
233
+ console.log(`📦 [CHATGPT_SERVICE] Raw response sent as-is (no transformation)`);
234
+ const response = await fetch(`${_api.API_CONFIG.BASE_URL}/llm-data/store-memories`, {
235
+ method: 'POST',
236
+ headers: {
237
+ 'Content-Type': 'application/json',
238
+ 'Authorization': `Bearer ${authToken}`,
239
+ 'User-Agent': `OnairosSDK/${appVersion} (${_reactNative.Platform.OS})`
240
+ },
241
+ body: JSON.stringify(requestBody)
242
+ });
243
+ const responseData = await response.json();
244
+ if (response.ok) {
245
+ var _responseData$data;
246
+ console.log('✅ [CHATGPT_SERVICE] Successfully sent memories to backend');
247
+ if (responseData.message) {
248
+ console.log(`📝 [CHATGPT_SERVICE] Backend response: ${responseData.message}`);
249
+ }
250
+ if ((_responseData$data = responseData.data) !== null && _responseData$data !== void 0 && _responseData$data.memoriesCount) {
251
+ console.log(`📋 [CHATGPT_SERVICE] Stored ${responseData.data.memoriesCount} memory items in database`);
252
+ }
253
+ return {
254
+ success: true,
255
+ message: responseData.message || 'Memories stored successfully',
256
+ data: responseData.data
257
+ };
258
+ } else {
259
+ console.warn(`⚠️ [CHATGPT_SERVICE] Memories backend returned status: ${response.status}`);
260
+ console.warn(`⚠️ [CHATGPT_SERVICE] Error: ${responseData.error || 'Unknown error'}`);
261
+ return {
262
+ success: false,
263
+ error: responseData.error || `HTTP ${response.status}`
264
+ };
265
+ }
266
+ } catch (error) {
267
+ console.error('❌ [CHATGPT_SERVICE] Memories network error:', error);
268
+ return {
269
+ success: false,
270
+ error: error.message || 'Network error. Please check your connection.'
271
+ };
272
+ }
273
+ };
274
+ exports.storeChatGPTMemories = storeChatGPTMemories;
275
+ //# sourceMappingURL=chatGPTConversationService.js.map
@@ -1,8 +1,103 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("./claudeConversationService"),
5
- require("react-native")
6
- ];
7
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
8
- function _0x2917(_0x2e260d,_0x2917a9){_0x2e260d=_0x2e260d-0x0;const _0x2b03e9=_0x2e26();let _0x5e74d0=_0x2b03e9[_0x2e260d];return _0x5e74d0;}function _0x2e26(){const _0x3471ec=['defineProperty','__esModule','useClaudeConversationExtractor','❌\x20[CLAUDE_EXTRACTOR]\x20Backend\x20storage\x20failed:','Export\x20Failed','An\x20unknown\x20error\x20occurred\x20during\x20conversation\x20storage.','⚠️\x20[CLAUDE_EXTRACTOR]\x20Invalid\x20conversation:','👤\x20[CLAUDE_EXTRACTOR]\x20Username:','📊\x20[CLAUDE_EXTRACTOR]\x20Conversations\x20to\x20send:','❌\x20[CLAUDE_EXTRACTOR]\x20Username\x20is\x20required','Error','Username\x20is\x20required\x20to\x20export\x20Claude\x20conversations.','ℹ️\x20[CLAUDE_EXTRACTOR]\x20No\x20conversations\x20to\x20export\x20-\x20treating\x20as\x20success\x20(connected)','BftGY','❌\x20[CLAUDE_EXTRACTOR]\x20No\x20valid\x20conversations\x20after\x20filtering','Data\x20Error','📡\x20[CLAUDE_EXTRACTOR]\x20Sending\x20to\x20backend...','📊\x20[CLAUDE_EXTRACTOR]\x20Backend\x20response:','❌\x20[CLAUDE_EXTRACTOR]\x20Unexpected\x20error\x20during\x20export:','mdZhd','IECNo','log','WhLcG','MAmji','length','error','FZjPD','Alert','alert','QoqTW','PEEma','EotYU','filter','conversation_id','title','isArray','user_messages','warn','hFlCe','fBxLO','WmNdZ','PiIqh','WydXd','OOkrK','No\x20valid\x20conversations\x20found\x20to\x20export.','default','QgLxX','⚠️\x20[CLAUDE_EXTRACTOR]\x20Filtered\x20out\x20','\x20invalid\x20conversations','AfCsE','success','data','HsVYM'];_0x2e26=function(){return _0x3471ec;};return _0x2e26();}Object[_0x2917(0x0)](exports,_0x2917(0x1),{'value':!![]}),exports[_0x2917(0x2)]=void 0x0;var _claudeConversationService=__ONAIROS_REQ_FUNC__(0x0),_reactNative=__ONAIROS_REQ_FUNC__(0x1);const useClaudeConversationExtractor=()=>{const _0xb569dd={'HsVYM':_0x2917(0x3),'WmNdZ':_0x2917(0x4),'PiIqh':_0x2917(0x5),'QoqTW':'default','mdZhd':function(_0x36377c,_0x495318){return _0x36377c>_0x495318;},'IECNo':_0x2917(0x6),'KsgWB':'🚀\x20[CLAUDE_EXTRACTOR]\x20Initiating\x20conversation\x20export','WhLcG':_0x2917(0x7),'MAmji':_0x2917(0x8),'FZjPD':_0x2917(0x9),'nnOnM':_0x2917(0xa),'fKJKI':_0x2917(0xb),'PEEma':function(_0x3fe9dd,_0x3cfa38){return _0x3fe9dd===_0x3cfa38;},'EotYU':_0x2917(0xc),'fBxLO':_0x2917(0xd),'WydXd':_0x2917(0xe),'OOkrK':_0x2917(0xf),'QgLxX':function(_0x3d3497,_0x2c73ca){return _0x3d3497<_0x2c73ca;},'eBiAf':function(_0x10c620,_0x477b51){return _0x10c620-_0x477b51;},'AfCsE':_0x2917(0x10),'MpXRw':_0x2917(0x11),'nIHbI':_0x2917(0x12)},_0x5cb682=async(_0x710f7d,_0x47e0d8)=>{const _0x2a6a9b={'hXpyd':function(_0x3b7cae,_0x46289a){return _0xb569dd[_0x2917(0x13)](_0x3b7cae,_0x46289a);},'hFlCe':_0xb569dd[_0x2917(0x14)]};console[_0x2917(0x15)](_0xb569dd['KsgWB']),console['log'](_0xb569dd[_0x2917(0x16)],_0x710f7d),console[_0x2917(0x15)](_0xb569dd[_0x2917(0x17)],_0x47e0d8[_0x2917(0x18)]);if(!_0x710f7d)return console[_0x2917(0x19)](_0xb569dd[_0x2917(0x1a)]),_reactNative[_0x2917(0x1b)][_0x2917(0x1c)](_0xb569dd['nnOnM'],_0xb569dd['fKJKI'],[{'text':'OK','style':_0xb569dd[_0x2917(0x1d)]}]),![];if(!_0x47e0d8||_0xb569dd[_0x2917(0x1e)](_0x47e0d8[_0x2917(0x18)],0x0))return console[_0x2917(0x15)](_0xb569dd[_0x2917(0x1f)]),!![];const _0x533b59=_0x47e0d8[_0x2917(0x20)](_0x33fdb5=>{const _0x17dc61=_0x33fdb5[_0x2917(0x21)]&&_0x33fdb5[_0x2917(0x22)]&&Array[_0x2917(0x23)](_0x33fdb5[_0x2917(0x24)])&&_0x2a6a9b['hXpyd'](_0x33fdb5[_0x2917(0x24)][_0x2917(0x18)],0x0);return!_0x17dc61&&console[_0x2917(0x25)](_0x2a6a9b[_0x2917(0x26)],_0x33fdb5),_0x17dc61;});if(_0xb569dd[_0x2917(0x1e)](_0x533b59[_0x2917(0x18)],0x0))return'Kqgqg'===_0xb569dd[_0x2917(0x27)]?(_0x10fb0d['error'](_0xb569dd['HsVYM'],_0x12977a[_0x2917(0x19)]),_0x192223['Alert'][_0x2917(0x1c)](_0xb569dd[_0x2917(0x28)],_0xc6c81a['error']||_0xb569dd[_0x2917(0x29)],[{'text':'OK','style':_0xb569dd[_0x2917(0x1d)]}]),![]):(console['error'](_0xb569dd[_0x2917(0x2a)]),_reactNative[_0x2917(0x1b)]['alert'](_0xb569dd[_0x2917(0x2b)],_0x2917(0x2c),[{'text':'OK','style':_0x2917(0x2d)}]),![]);_0xb569dd[_0x2917(0x2e)](_0x533b59[_0x2917(0x18)],_0x47e0d8['length'])&&console['warn'](_0x2917(0x2f)+_0xb569dd['eBiAf'](_0x47e0d8[_0x2917(0x18)],_0x533b59[_0x2917(0x18)])+_0x2917(0x30));try{console[_0x2917(0x15)](_0xb569dd[_0x2917(0x31)]);const _0x53b200=await(0x0,_claudeConversationService['storeClaudeConversations'])(_0x710f7d,_0x533b59);return _0x53b200[_0x2917(0x32)]?(console['log']('✅\x20[CLAUDE_EXTRACTOR]\x20Export\x20completed\x20successfully'),console['log'](_0xb569dd['MpXRw'],_0x53b200[_0x2917(0x33)]),!![]):(console[_0x2917(0x19)](_0xb569dd[_0x2917(0x34)],_0x53b200[_0x2917(0x19)]),_reactNative[_0x2917(0x1b)][_0x2917(0x1c)](_0xb569dd[_0x2917(0x28)],_0x53b200[_0x2917(0x19)]||_0xb569dd[_0x2917(0x29)],[{'text':'OK','style':_0xb569dd[_0x2917(0x1d)]}]),![]);}catch(_0x279074){return console[_0x2917(0x19)](_0xb569dd['nIHbI'],_0x279074),_reactNative['Alert'][_0x2917(0x1c)]('Export\x20Error','Failed\x20to\x20connect\x20to\x20the\x20conversation\x20storage\x20service.\x20Please\x20check\x20your\x20network\x20connection.',[{'text':'OK','style':'default'}]),![];}};return{'initiateConversationExport':_0x5cb682};};exports[_0x2917(0x2)]=useClaudeConversationExtractor;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useClaudeConversationExtractor = void 0;
7
+ var _claudeConversationService = require("./claudeConversationService");
8
+ var _reactNative = require("react-native");
9
+ /**
10
+ * Claude Conversation Extractor
11
+ *
12
+ * Orchestrates the Claude conversation export flow:
13
+ * 1. Receives extracted conversations from WebView
14
+ * 2. Validates and formats data
15
+ * 3. Sends to backend via claudeConversationService
16
+ *
17
+ * This acts as the bridge between OAuthWebView and the backend API.
18
+ *
19
+ * @reference Enoch implementation: src/services/claudeConversationExtractor.ts
20
+ */
21
+
22
+ /**
23
+ * Hook for Claude conversation extraction operations
24
+ */
25
+ const useClaudeConversationExtractor = () => {
26
+ /**
27
+ * Initiate conversation export to backend
28
+ *
29
+ * @param username - User identifier
30
+ * @param conversations - Array of conversations with user messages
31
+ * @returns true if successful, false otherwise
32
+ */
33
+ const initiateConversationExport = async (username, conversations) => {
34
+ console.log('🚀 [CLAUDE_EXTRACTOR] Initiating conversation export');
35
+ console.log('👤 [CLAUDE_EXTRACTOR] Username:', username);
36
+ console.log('📊 [CLAUDE_EXTRACTOR] Conversations to send:', conversations.length);
37
+
38
+ // Validation
39
+ if (!username) {
40
+ console.error('❌ [CLAUDE_EXTRACTOR] Username is required');
41
+ _reactNative.Alert.alert('Error', 'Username is required to export Claude conversations.', [{
42
+ text: 'OK',
43
+ style: 'default'
44
+ }]);
45
+ return false;
46
+ }
47
+
48
+ // Handle 0 conversations as success - user might be new or have cleared history
49
+ // This matches iOS behavior where empty conversations still counts as successful connection
50
+ if (!conversations || conversations.length === 0) {
51
+ console.log('ℹ️ [CLAUDE_EXTRACTOR] No conversations to export - treating as success (connected)');
52
+ return true;
53
+ }
54
+
55
+ // Validate conversation structure
56
+ const validConversations = conversations.filter(conv => {
57
+ const isValid = conv.conversation_id && conv.title && Array.isArray(conv.user_messages) && conv.user_messages.length > 0;
58
+ if (!isValid) {
59
+ console.warn('⚠️ [CLAUDE_EXTRACTOR] Invalid conversation:', conv);
60
+ }
61
+ return isValid;
62
+ });
63
+ if (validConversations.length === 0) {
64
+ console.error('❌ [CLAUDE_EXTRACTOR] No valid conversations after filtering');
65
+ _reactNative.Alert.alert('Data Error', 'No valid conversations found to export.', [{
66
+ text: 'OK',
67
+ style: 'default'
68
+ }]);
69
+ return false;
70
+ }
71
+ if (validConversations.length < conversations.length) {
72
+ console.warn(`⚠️ [CLAUDE_EXTRACTOR] Filtered out ${conversations.length - validConversations.length} invalid conversations`);
73
+ }
74
+ try {
75
+ console.log('📡 [CLAUDE_EXTRACTOR] Sending to backend...');
76
+ const result = await (0, _claudeConversationService.storeClaudeConversations)(username, validConversations);
77
+ if (result.success) {
78
+ console.log('✅ [CLAUDE_EXTRACTOR] Export completed successfully');
79
+ console.log('📊 [CLAUDE_EXTRACTOR] Backend response:', result.data);
80
+ return true;
81
+ } else {
82
+ console.error('❌ [CLAUDE_EXTRACTOR] Backend storage failed:', result.error);
83
+ _reactNative.Alert.alert('Export Failed', result.error || 'An unknown error occurred during conversation storage.', [{
84
+ text: 'OK',
85
+ style: 'default'
86
+ }]);
87
+ return false;
88
+ }
89
+ } catch (error) {
90
+ console.error('❌ [CLAUDE_EXTRACTOR] Unexpected error during export:', error);
91
+ _reactNative.Alert.alert('Export Error', 'Failed to connect to the conversation storage service. Please check your network connection.', [{
92
+ text: 'OK',
93
+ style: 'default'
94
+ }]);
95
+ return false;
96
+ }
97
+ };
98
+ return {
99
+ initiateConversationExport
100
+ };
101
+ };
102
+ exports.useClaudeConversationExtractor = useClaudeConversationExtractor;
103
+ //# sourceMappingURL=claudeConversationExtractor.js.map