@onairos/react-native 3.7.2 → 3.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/api/index.js +219 -9
- package/lib/commonjs/components/BodyText.js +27 -9
- package/lib/commonjs/components/BrandMark.js +111 -10
- package/lib/commonjs/components/CodeInput.js +116 -9
- package/lib/commonjs/components/EmailInput.js +30 -8
- package/lib/commonjs/components/GoogleButton.js +56 -9
- package/lib/commonjs/components/HeadingGroup.js +43 -9
- package/lib/commonjs/components/LLMDataInputModal.js +664 -14
- package/lib/commonjs/components/ModalHeader.js +99 -9
- package/lib/commonjs/components/ModalSheet.js +47 -9
- package/lib/commonjs/components/Onairos.js +380 -14
- package/lib/commonjs/components/OnairosButton.js +313 -13
- package/lib/commonjs/components/OnairosSignInButton.js +130 -12
- package/lib/commonjs/components/Overlay.js +465 -13
- package/lib/commonjs/components/PersonaImage.js +137 -10
- package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
- package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
- package/lib/commonjs/components/PinCreationScreen.js +403 -12
- package/lib/commonjs/components/PinInput.js +464 -9
- package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
- package/lib/commonjs/components/PlatformList.js +137 -10
- package/lib/commonjs/components/PlatformToggle.js +180 -9
- package/lib/commonjs/components/PrimaryButton.js +180 -10
- package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
- package/lib/commonjs/components/SignInStep.js +345 -12
- package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
- package/lib/commonjs/components/VerificationStep.js +176 -11
- package/lib/commonjs/components/WelcomeScreen.js +461 -22
- package/lib/commonjs/components/icons/Basicproficon.js +37 -8
- package/lib/commonjs/components/icons/Basicprofile.js +21 -8
- package/lib/commonjs/components/icons/Checkbox.js +21 -8
- package/lib/commonjs/components/icons/Checkmark.js +27 -8
- package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
- package/lib/commonjs/components/icons/Contenticon.js +39 -8
- package/lib/commonjs/components/icons/EnochE.js +41 -8
- package/lib/commonjs/components/icons/Personalityicon.js +30 -8
- package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
- package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
- package/lib/commonjs/components/icons/Userpreferences.js +21 -8
- package/lib/commonjs/components/icons/index.js +84 -17
- package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
- package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
- package/lib/commonjs/components/onboarding/PinInput.js +283 -10
- package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
- package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
- package/lib/commonjs/config/api.js +56 -7
- package/lib/commonjs/constants/index.js +120 -7
- package/lib/commonjs/context/AuthContext.js +345 -10
- package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
- package/lib/commonjs/hooks/useConnections.js +102 -8
- package/lib/commonjs/hooks/useCredentials.js +178 -10
- package/lib/commonjs/hooks/useUserConnections.js +148 -10
- package/lib/commonjs/index.js +439 -34
- package/lib/commonjs/services/apiClient.js +298 -8
- package/lib/commonjs/services/biometricPinService.js +180 -8
- package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
- package/lib/commonjs/services/chatGPTConversationService.js +275 -9
- package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
- package/lib/commonjs/services/claudeConversationService.js +158 -9
- package/lib/commonjs/services/connectedAccountsService.js +310 -10
- package/lib/commonjs/services/googleAuthService.js +252 -11
- package/lib/commonjs/services/hingeDataExtractor.js +105 -8
- package/lib/commonjs/services/hingeDataService.js +150 -9
- package/lib/commonjs/services/imageCompressionService.js +260 -7
- package/lib/commonjs/services/instagramDataExtractor.js +126 -8
- package/lib/commonjs/services/instagramDataService.js +163 -9
- package/lib/commonjs/services/jwtStorageService.js +276 -7
- package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
- package/lib/commonjs/services/linkedinProfileService.js +222 -9
- package/lib/commonjs/services/linkedinScrapingService.js +230 -8
- package/lib/commonjs/services/llmDataStorage.js +294 -8
- package/lib/commonjs/services/mobileTrainingService.js +186 -8
- package/lib/commonjs/services/netflixDataExtractor.js +120 -8
- package/lib/commonjs/services/netflixDataService.js +198 -9
- package/lib/commonjs/services/pinEncryptionService.js +84 -8
- package/lib/commonjs/services/pinStorageUtils.js +105 -7
- package/lib/commonjs/services/platformAuthService.js +1484 -12
- package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
- package/lib/commonjs/services/sephoraDataService.js +200 -9
- package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
- package/lib/commonjs/services/spotifyDataService.js +241 -9
- package/lib/commonjs/services/storageService.js +404 -8
- package/lib/commonjs/services/telegramDataExtractor.js +115 -8
- package/lib/commonjs/services/telegramDataService.js +499 -9
- package/lib/commonjs/services/trainingApiHelpers.js +73 -7
- package/lib/commonjs/services/userConnectionsService.js +340 -10
- package/lib/commonjs/services/youtubeMigrationService.js +416 -10
- package/lib/commonjs/theme/index.js +250 -7
- package/lib/commonjs/types/ambient.d.js +2 -1
- package/lib/commonjs/types/declarations.d.js +2 -1
- package/lib/commonjs/types/index.js +6 -1
- package/lib/commonjs/types/node-fix.d.js +2 -1
- package/lib/commonjs/types/node-override.d.js +2 -1
- package/lib/commonjs/types/opacity.d.js +2 -1
- package/lib/commonjs/types.js +14 -1
- package/lib/commonjs/utils/Portal.js +98 -8
- package/lib/commonjs/utils/api.js +130 -9
- package/lib/commonjs/utils/assetRegistry.js +210 -35
- package/lib/commonjs/utils/auth.js +112 -9
- package/lib/commonjs/utils/connectorTests.js +613 -29
- package/lib/commonjs/utils/crypto.js +62 -8
- package/lib/commonjs/utils/debugHelper.js +64 -1
- package/lib/commonjs/utils/encryption.js +76 -7
- package/lib/commonjs/utils/eventUtils.js +288 -1
- package/lib/commonjs/utils/haptics.js +66 -9
- package/lib/commonjs/utils/imagePreloader.js +6 -1
- package/lib/commonjs/utils/networkDiagnostics.js +226 -8
- package/lib/commonjs/utils/onairosApi.js +350 -9
- package/lib/commonjs/utils/programmaticFlow.js +117 -9
- package/lib/commonjs/utils/retryHelper.js +220 -1
- package/lib/commonjs/utils/secureStorage.js +349 -10
- package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
- package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
- package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
- package/lib/commonjs/utils/webviewScripts/index.js +698 -15
- package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
- package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
- package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
- package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
- package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
- package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
- package/lib/module/api/index.js +211 -1
- package/lib/module/components/BodyText.js +20 -1
- package/lib/module/components/BrandMark.js +104 -1
- package/lib/module/components/CodeInput.js +109 -1
- package/lib/module/components/EmailInput.js +23 -1
- package/lib/module/components/GoogleButton.js +49 -1
- package/lib/module/components/HeadingGroup.js +36 -1
- package/lib/module/components/LLMDataInputModal.js +656 -7
- package/lib/module/components/ModalHeader.js +92 -1
- package/lib/module/components/ModalSheet.js +39 -1
- package/lib/module/components/Onairos.js +373 -1
- package/lib/module/components/OnairosButton.js +305 -1
- package/lib/module/components/OnairosSignInButton.js +121 -1
- package/lib/module/components/Overlay.js +456 -1
- package/lib/module/components/PersonaImage.js +129 -1
- package/lib/module/components/PersonaLoadingScreen.js +310 -1
- package/lib/module/components/PersonalizationConsentScreen.js +460 -1
- package/lib/module/components/PinCreationScreen.js +396 -1
- package/lib/module/components/PinInput.js +456 -1
- package/lib/module/components/PlatformConnectorsStep.js +1302 -6
- package/lib/module/components/PlatformList.js +129 -1
- package/lib/module/components/PlatformToggle.js +173 -1
- package/lib/module/components/PrimaryButton.js +172 -1
- package/lib/module/components/SignInMatchAnimation.js +189 -1
- package/lib/module/components/SignInStep.js +338 -1
- package/lib/module/components/UniversalOnboarding.js +2770 -1
- package/lib/module/components/VerificationStep.js +168 -1
- package/lib/module/components/WelcomeScreen.js +453 -1
- package/lib/module/components/icons/Basicproficon.js +30 -1
- package/lib/module/components/icons/Basicprofile.js +14 -1
- package/lib/module/components/icons/Checkbox.js +14 -1
- package/lib/module/components/icons/Checkmark.js +20 -1
- package/lib/module/components/icons/Contentanalysis.js +14 -1
- package/lib/module/components/icons/Contenticon.js +32 -1
- package/lib/module/components/icons/EnochE.js +34 -1
- package/lib/module/components/icons/Personalityicon.js +23 -1
- package/lib/module/components/icons/Personalityprofile.js +14 -1
- package/lib/module/components/icons/Personalitytraits.js +14 -1
- package/lib/module/components/icons/Userpreferences.js +14 -1
- package/lib/module/components/icons/index.js +13 -1
- package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
- package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
- package/lib/module/components/onboarding/PinInput.js +274 -1
- package/lib/module/components/onboarding/PlatformConnector.js +240 -1
- package/lib/module/config/PLATFORM_APIS.md +849 -0
- package/lib/module/config/api.js +47 -1
- package/lib/module/constants/index.js +114 -1
- package/lib/module/context/AuthContext.js +335 -1
- package/lib/module/hooks/useConnectedAccounts.js +106 -1
- package/lib/module/hooks/useConnections.js +95 -1
- package/lib/module/hooks/useCredentials.js +171 -6
- package/lib/module/hooks/useUserConnections.js +140 -1
- package/lib/module/index.js +172 -1
- package/lib/module/services/apiClient.js +295 -1
- package/lib/module/services/biometricPinService.js +169 -1
- package/lib/module/services/chatGPTConversationExtractor.js +149 -1
- package/lib/module/services/chatGPTConversationService.js +268 -1
- package/lib/module/services/claudeConversationExtractor.js +97 -1
- package/lib/module/services/claudeConversationService.js +151 -1
- package/lib/module/services/connectedAccountsService.js +293 -1
- package/lib/module/services/googleAuthService.js +241 -1
- package/lib/module/services/hingeDataExtractor.js +99 -1
- package/lib/module/services/hingeDataService.js +143 -1
- package/lib/module/services/imageCompressionService.js +250 -1
- package/lib/module/services/instagramDataExtractor.js +120 -1
- package/lib/module/services/instagramDataService.js +156 -1
- package/lib/module/services/jwtStorageService.js +257 -1
- package/lib/module/services/linkedinDOMExtractor.js +234 -1
- package/lib/module/services/linkedinProfileService.js +210 -1
- package/lib/module/services/linkedinScrapingService.js +219 -1
- package/lib/module/services/llmDataStorage.js +277 -1
- package/lib/module/services/mobileTrainingService.js +173 -1
- package/lib/module/services/netflixDataExtractor.js +114 -1
- package/lib/module/services/netflixDataService.js +191 -1
- package/lib/module/services/pinEncryptionService.js +74 -6
- package/lib/module/services/pinStorageUtils.js +93 -1
- package/lib/module/services/platformAuthService.js +1461 -1
- package/lib/module/services/sephoraDataExtractor.js +134 -1
- package/lib/module/services/sephoraDataService.js +193 -1
- package/lib/module/services/spotifyDataExtractor.js +142 -1
- package/lib/module/services/spotifyDataService.js +234 -1
- package/lib/module/services/storageService.js +383 -1
- package/lib/module/services/telegramDataExtractor.js +109 -1
- package/lib/module/services/telegramDataService.js +493 -1
- package/lib/module/services/trainingApiHelpers.js +67 -1
- package/lib/module/services/userConnectionsService.js +329 -1
- package/lib/module/services/youtubeMigrationService.js +405 -1
- package/lib/module/theme/index.js +245 -1
- package/lib/module/types.js +10 -1
- package/lib/module/utils/Portal.js +90 -1
- package/lib/module/utils/api.js +118 -1
- package/lib/module/utils/assetRegistry.js +200 -34
- package/lib/module/utils/auth.js +100 -1
- package/lib/module/utils/connectorTests.js +600 -27
- package/lib/module/utils/crypto.js +54 -1
- package/lib/module/utils/debugHelper.js +54 -1
- package/lib/module/utils/encryption.js +67 -1
- package/lib/module/utils/eventUtils.js +270 -1
- package/lib/module/utils/haptics.js +59 -8
- package/lib/module/utils/imagePreloader.js +3 -1
- package/lib/module/utils/networkDiagnostics.js +217 -1
- package/lib/module/utils/onairosApi.js +333 -1
- package/lib/module/utils/programmaticFlow.js +111 -1
- package/lib/module/utils/retryHelper.js +211 -1
- package/lib/module/utils/secureStorage.js +330 -6
- package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
- package/lib/module/utils/webviewScripts/claude.js +370 -1
- package/lib/module/utils/webviewScripts/hinge.js +405 -1
- package/lib/module/utils/webviewScripts/index.js +434 -1
- package/lib/module/utils/webviewScripts/instagram.js +448 -1
- package/lib/module/utils/webviewScripts/linkedin.js +874 -1
- package/lib/module/utils/webviewScripts/netflix.js +376 -1
- package/lib/module/utils/webviewScripts/sephora.js +510 -1
- package/lib/module/utils/webviewScripts/spotify.js +413 -1
- package/lib/module/utils/webviewScripts/telegram.js +672 -1
- package/package.json +2 -2
|
@@ -1,8 +1,294 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function _0x5a44(_0x403d84,_0x5a44e3){_0x403d84=_0x403d84-0x0;const _0x5128cd=_0x403d();let _0xb80215=_0x5128cd[_0x403d84];return _0xb80215;}Object[_0x5a44(0x0)](exports,_0x5a44(0x1),{'value':!![]}),exports['updateLLMStatus']=exports['storeLLMData']=exports[_0x5a44(0x2)]=exports[_0x5a44(0x3)]=exports[_0x5a44(0x4)]=exports[_0x5a44(0x5)]=exports[_0x5a44(0x6)]=exports[_0x5a44(0x7)]=exports[_0x5a44(0x8)]=exports[_0x5a44(0x9)]=void 0x0;var _asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x0)),_api=__ONAIROS_REQ_FUNC__(0x1);function _interopRequireDefault(_0x10b503){return _0x10b503&&_0x10b503['__esModule']?_0x10b503:{'default':_0x10b503};}const LLM_DATA_STORAGE_KEY='@onairos:llm_data',LLM_METADATA_STORAGE_KEY='@onairos:llm_metadata',storeLLMData=async _0x1db9c9=>{const _0x34b1ba={'oHzGo':_0x5a44(0xa),'vFsrl':'connected','CoYbT':_0x5a44(0xb),'ZVQeW':_0x5a44(0xc)};try{console[_0x5a44(0xd)](_0x34b1ba[_0x5a44(0xe)]),await _asyncStorage[_0x5a44(0xf)][_0x5a44(0x10)](LLM_DATA_STORAGE_KEY+':'+_0x1db9c9[_0x5a44(0x11)],JSON[_0x5a44(0x12)](_0x1db9c9));const _0x571336={'userId':_0x1db9c9['userId'],'email':_0x1db9c9[_0x5a44(0x13)],'appName':_0x1db9c9['appName'],'timestamp':_0x1db9c9['timestamp'],'hasData':!![],'dataSize':JSON[_0x5a44(0x12)](_0x1db9c9[_0x5a44(0x14)])[_0x5a44(0x15)],'connectionStatus':_0x34b1ba[_0x5a44(0x16)]};return await _asyncStorage[_0x5a44(0xf)][_0x5a44(0x10)](LLM_METADATA_STORAGE_KEY+':'+_0x1db9c9[_0x5a44(0x11)],JSON[_0x5a44(0x12)](_0x571336)),console[_0x5a44(0xd)](_0x34b1ba[_0x5a44(0x17)]),console[_0x5a44(0xd)](_0x5a44(0x18)+_0x571336[_0x5a44(0x19)]+_0x5a44(0x1a)),!![];}catch(_0x4044f7){return console[_0x5a44(0x1b)](_0x34b1ba[_0x5a44(0x1c)],_0x4044f7),![];}};exports[_0x5a44(0x1d)]=storeLLMData;const getLLMData=async _0x1c8a5d=>{const _0x2d80fb={'fikld':_0x5a44(0x1e),'qPtgM':_0x5a44(0x1f),'zaDRc':'❌\x20Failed\x20to\x20retrieve\x20LLM\x20data:'};try{const _0x1d5b1a=await _asyncStorage['default'][_0x5a44(0x20)](LLM_DATA_STORAGE_KEY+':'+_0x1c8a5d);if(!_0x1d5b1a)return console[_0x5a44(0xd)](_0x2d80fb[_0x5a44(0x21)],_0x1c8a5d),null;const _0x36c6c6=JSON['parse'](_0x1d5b1a);return console[_0x5a44(0xd)](_0x2d80fb[_0x5a44(0x22)],_0x1c8a5d),_0x36c6c6;}catch(_0x26167e){return console[_0x5a44(0x1b)](_0x2d80fb['zaDRc'],_0x26167e),null;}};exports['getLLMData']=getLLMData;const getLLMMetadata=async _0x41223c=>{const _0x32dc3f={'PQfIz':function(_0x517a3c,_0x43abf5){return _0x517a3c===_0x43abf5;},'GTuYL':_0x5a44(0x23),'ptUpX':function(_0x37f7ec,_0x259140){return _0x37f7ec!==_0x259140;},'YBqbd':'wqEdC','BfPwg':_0x5a44(0x24),'keYgw':'❌\x20Failed\x20to\x20retrieve\x20LLM\x20metadata:'};try{if(_0x32dc3f['PQfIz'](_0x32dc3f[_0x5a44(0x25)],_0x32dc3f[_0x5a44(0x25)])){const _0x46f623=await _asyncStorage[_0x5a44(0xf)][_0x5a44(0x20)](LLM_METADATA_STORAGE_KEY+':'+_0x41223c);if(!_0x46f623)return _0x32dc3f['ptUpX'](_0x32dc3f[_0x5a44(0x26)],_0x32dc3f[_0x5a44(0x26)])?null:null;return JSON[_0x5a44(0x27)](_0x46f623);}else return _0xcc6a08['error'](_0x5a44(0x28),_0x36950f),[];}catch(_0x21b2f1){return _0x32dc3f[_0x5a44(0x29)]!==_0x32dc3f[_0x5a44(0x29)]?(_0x4fdd31[_0x5a44(0x1b)](_0x5a44(0x2a),_0x34760c),null):(console['error'](_0x32dc3f[_0x5a44(0x2b)],_0x21b2f1),null);}};exports[_0x5a44(0x5)]=getLLMMetadata;const updateLLMStatus=async(_0x1f76e0,_0x65cb93)=>{const _0x20a006={'fFpeD':function(_0x270ce5,_0x2c04ae){return _0x270ce5(_0x2c04ae);},'iAKfQ':'⚠️\x20No\x20LLM\x20metadata\x20found\x20for\x20user:'};try{const _0x4bd1be=await _0x20a006[_0x5a44(0x2c)](getLLMMetadata,_0x1f76e0);if(!_0x4bd1be)return console[_0x5a44(0x2d)](_0x20a006[_0x5a44(0x2e)],_0x1f76e0),![];return _0x4bd1be[_0x5a44(0x2f)]=_0x65cb93,await _asyncStorage[_0x5a44(0xf)][_0x5a44(0x10)](LLM_METADATA_STORAGE_KEY+':'+_0x1f76e0,JSON[_0x5a44(0x12)](_0x4bd1be)),console[_0x5a44(0xd)](_0x5a44(0x30)+_0x65cb93),!![];}catch(_0x394c12){return console[_0x5a44(0x1b)]('❌\x20Failed\x20to\x20update\x20LLM\x20status:',_0x394c12),![];}};exports[_0x5a44(0x31)]=updateLLMStatus;const clearLLMData=async _0x253e34=>{const _0x23d4d7={'Ezjht':_0x5a44(0x32)};try{return await _asyncStorage[_0x5a44(0xf)][_0x5a44(0x33)](LLM_DATA_STORAGE_KEY+':'+_0x253e34),await _asyncStorage[_0x5a44(0xf)][_0x5a44(0x33)](LLM_METADATA_STORAGE_KEY+':'+_0x253e34),console[_0x5a44(0xd)](_0x23d4d7[_0x5a44(0x34)],_0x253e34),!![];}catch(_0x49adb4){return console[_0x5a44(0x1b)](_0x5a44(0x35),_0x49adb4),![];}};exports[_0x5a44(0x9)]=clearLLMData;const hasOnlyLLMConnection=_0x21174e=>{const _0x25292e={'wpUMO':'llm','aLdcY':_0x5a44(0x36),'MvohX':function(_0x5ec6e9,_0x264109){return _0x5ec6e9===_0x264109;},'lslNd':'🔍\x20Platform\x20connection\x20check:'},_0x3495ee=Object[_0x5a44(0x37)](_0x21174e)[_0x5a44(0x38)](([_0xb0f8d0,_0x15189e])=>_0x15189e)['map'](([_0x3ebf09,_0x1fca08])=>_0x3ebf09),_0x1675fc=_0x3495ee[_0x5a44(0x39)](_0x25292e[_0x5a44(0x3a)])||_0x3495ee[_0x5a44(0x39)](_0x25292e[_0x5a44(0x3b)]),_0x1bfcd1=_0x25292e['MvohX'](_0x3495ee['length'],0x1)&&_0x1675fc;return console['log'](_0x25292e[_0x5a44(0x3c)],{'connectedPlatforms':_0x3495ee,'hasLLM':_0x1675fc,'onlyLLM':_0x1bfcd1}),_0x1bfcd1;};exports[_0x5a44(0x4)]=hasOnlyLLMConnection;const formatLLMDataForDeveloper=_0x2c7658=>{const _0x39b71f={'ZoWfF':'llm','hbeeL':_0x5a44(0x36)};return{'platform':_0x39b71f[_0x5a44(0x3d)],'userId':_0x2c7658[_0x5a44(0x11)],'email':_0x2c7658[_0x5a44(0x13)],'timestamp':_0x2c7658[_0x5a44(0x3e)],'data':{'type':_0x39b71f[_0x5a44(0x3f)],'conversations':_0x2c7658['data'][_0x5a44(0x40)]||[],'chatHistory':_0x2c7658['data'][_0x5a44(0x41)]||[],'preferences':_0x2c7658[_0x5a44(0x14)]['preferences']||{},'customData':_0x2c7658[_0x5a44(0x14)][_0x5a44(0x42)]||{}},'metadata':{'appName':_0x2c7658[_0x5a44(0x43)],'collectedAt':new Date(_0x2c7658[_0x5a44(0x3e)])[_0x5a44(0x44)](),'dataVersion':_0x5a44(0x45)}};};function _0x403d(){const _0x2ab728=['defineProperty','__esModule','sendLLMDataToBackend','requestLLMDataForDeveloper','hasOnlyLLMConnection','getLLMMetadata','getLLMData','getAllLLMDataKeys','formatLLMDataForDeveloper','clearLLMData','💾\x20Storing\x20LLM\x20data\x20locally\x20(temporary)...','✅\x20LLM\x20data\x20stored\x20locally\x20successfully','❌\x20Failed\x20to\x20store\x20LLM\x20data:','log','oHzGo','default','setItem','userId','stringify','email','data','length','vFsrl','CoYbT','📊\x20Data\x20size:\x20','dataSize','\x20bytes','error','ZVQeW','storeLLMData','ℹ️\x20No\x20LLM\x20data\x20found\x20for\x20user:','✅\x20Retrieved\x20LLM\x20data\x20for\x20user:','getItem','fikld','qPtgM','Bglzi','sgJFc','GTuYL','YBqbd','parse','❌\x20Failed\x20to\x20get\x20LLM\x20data\x20keys:','BfPwg','❌\x20Failed\x20to\x20retrieve\x20LLM\x20metadata:','keYgw','fFpeD','warn','iAKfQ','connectionStatus','✅\x20Updated\x20LLM\x20status\x20to:\x20','updateLLMStatus','✅\x20LLM\x20data\x20cleared\x20for\x20user:','removeItem','Ezjht','❌\x20Failed\x20to\x20clear\x20LLM\x20data:','chatgpt','entries','filter','includes','wpUMO','aLdcY','lslNd','ZoWfF','timestamp','hbeeL','conversations','chatHistory','customData','appName','toISOString','1.0','📡\x20Sending\x20LLM\x20data\x20to\x20backend\x20for\x20processing...','llm','xtSCy','Unknown\x20error','cMiqG','API_CONFIG','BASE_URL','/llmdata','QNzei','Bearer\x20','fIcGW','VejVl','refreshToken','tokenExpiry','fDRZc','json','connectionId','text','hGQkO','Backend\x20error:\x20','status','BgBaO','message','JtkUk','ESCVM','GGEMF','hJWCF','📤\x20Requesting\x20backend\x20to\x20send\x20LLM\x20data\x20to\x20developer...','LVquC','✅\x20Backend\x20processing\x20LLM\x20data\x20request:','❌\x20Failed\x20to\x20request\x20LLM\x20data:','fWAMR','pxiwF','maIAe','dgDaO','/llmdata/request','nYmxl','VNtEj','token','WSvKC','❌\x20Failed\x20to\x20request\x20LLM\x20data\x20from\x20backend:','ArYvm','Qppjc','❌\x20Failed\x20to\x20send\x20data\x20to\x20backend:','getAllKeys','startsWith','NPkSk','tLsUG','gCYLq','ACaHo'];_0x403d=function(){return _0x2ab728;};return _0x403d();}exports[_0x5a44(0x8)]=formatLLMDataForDeveloper;const sendLLMDataToBackend=async(_0x312909,_0x23120e)=>{const _0x53e140={'ESCVM':_0x5a44(0xc),'cMiqG':_0x5a44(0x46),'QNzei':function(_0x1ab1ea,_0x17c16f){return _0x1ab1ea&&_0x17c16f;},'fIcGW':_0x5a44(0x47),'VejVl':_0x5a44(0x36),'fDRZc':_0x5a44(0x45),'QVher':'✅\x20Backend\x20received\x20and\x20stored\x20LLM\x20data:','hGQkO':'❌\x20Backend\x20data\x20ingestion\x20failed:','BgBaO':_0x5a44(0x48),'kQWFO':'❌\x20Failed\x20to\x20send\x20data\x20to\x20backend:','DLbsS':function(_0x412de8,_0x484495){return _0x412de8 instanceof _0x484495;},'JtkUk':_0x5a44(0x49)};try{console['log'](_0x53e140[_0x5a44(0x4a)]);const _0x394fbd=await fetch(_api[_0x5a44(0x4b)][_0x5a44(0x4c)]+_0x5a44(0x4d),{'method':'POST','headers':{'Content-Type':'application/json',..._0x53e140[_0x5a44(0x4e)](_0x23120e,{'Authorization':_0x5a44(0x4f)+_0x23120e})},'body':JSON[_0x5a44(0x12)]({'userId':_0x312909[_0x5a44(0x11)],'email':_0x312909[_0x5a44(0x13)],'appName':_0x312909[_0x5a44(0x43)],'platform':_0x53e140[_0x5a44(0x50)],'connectionType':_0x53e140[_0x5a44(0x51)],'timestamp':new Date()['toISOString'](),'data':_0x312909['data'],'accessToken':_0x312909['accessToken'],'refreshToken':_0x312909[_0x5a44(0x52)],'tokenExpiry':_0x312909[_0x5a44(0x53)],'metadata':{'collectedAt':new Date(_0x312909[_0x5a44(0x3e)])['toISOString'](),'dataVersion':_0x53e140[_0x5a44(0x54)]}})});if(_0x394fbd['ok']){const _0x50d802=await _0x394fbd[_0x5a44(0x55)]();return console[_0x5a44(0xd)](_0x53e140['QVher'],_0x50d802),{'success':!![],'message':_0x50d802['message'],'connectionId':_0x50d802[_0x5a44(0x56)]};}else{const _0x3a58d2=await _0x394fbd[_0x5a44(0x57)]();return console[_0x5a44(0x1b)](_0x53e140[_0x5a44(0x58)],_0x394fbd['status'],_0x3a58d2),{'success':![],'message':_0x5a44(0x59)+_0x394fbd[_0x5a44(0x5a)]};}}catch(_0x369f99){return _0x53e140[_0x5a44(0x5b)]===_0x53e140[_0x5a44(0x5b)]?(console[_0x5a44(0x1b)](_0x53e140['kQWFO'],_0x369f99),{'success':![],'message':_0x53e140['DLbsS'](_0x369f99,Error)?_0x369f99[_0x5a44(0x5c)]:_0x53e140[_0x5a44(0x5d)]}):(_0x285bd3[_0x5a44(0x1b)](_0x53e140[_0x5a44(0x5e)],_0x437fd5),![]);}};exports[_0x5a44(0x2)]=sendLLMDataToBackend;const requestLLMDataForDeveloper=async(_0x4eb620,_0x354e7b,_0x2a6110,_0x5a0e7d,_0x39a55f)=>{const _0x375458={'fWAMR':function(_0x357ceb,_0x4671af){return _0x357ceb===_0x4671af;},'pxiwF':_0x5a44(0x5f),'dVrvs':_0x5a44(0x60),'maIAe':_0x5a44(0x61),'dgDaO':function(_0x49914e,_0x532473,_0x56dead){return _0x49914e(_0x532473,_0x56dead);},'aOpIb':function(_0x4e14c3,_0x390d2f){return _0x4e14c3===_0x390d2f;},'nYmxl':_0x5a44(0x62),'VNtEj':_0x5a44(0x63),'WSvKC':_0x5a44(0x64),'ArYvm':function(_0x372f98,_0x5006ad){return _0x372f98 instanceof _0x5006ad;},'Qppjc':_0x5a44(0x49)};try{if(_0x375458[_0x5a44(0x65)](_0x375458[_0x5a44(0x66)],_0x375458['dVrvs']))return _0x392ce2['error']('❌\x20Failed\x20to\x20retrieve\x20LLM\x20data:',_0x49f6f2),null;else{console['log'](_0x375458[_0x5a44(0x67)]);const _0x4c269a=await _0x375458[_0x5a44(0x68)](fetch,_api[_0x5a44(0x4b)]['BASE_URL']+_0x5a44(0x69),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x5a44(0x4f)+_0x39a55f},'body':JSON[_0x5a44(0x12)]({'userId':_0x4eb620,'email':_0x354e7b,'appName':_0x2a6110,'requestedData':_0x5a0e7d,'timestamp':new Date()[_0x5a44(0x44)]()})});if(_0x4c269a['ok']){if(_0x375458['aOpIb'](_0x375458[_0x5a44(0x6a)],_0x375458['nYmxl'])){const _0x3d94f8=await _0x4c269a[_0x5a44(0x55)]();return console[_0x5a44(0xd)](_0x375458[_0x5a44(0x6b)],_0x3d94f8),{'success':!![],'message':_0x3d94f8[_0x5a44(0x5c)],'apiUrl':_0x3d94f8['apiUrl'],'token':_0x3d94f8[_0x5a44(0x6c)]};}else return _0x35a3ea['log']('ℹ️\x20No\x20LLM\x20data\x20found\x20for\x20user:',_0x5985ab),null;}else{const _0x17e05b=await _0x4c269a[_0x5a44(0x57)]();return console[_0x5a44(0x1b)](_0x375458[_0x5a44(0x6d)],_0x4c269a['status'],_0x17e05b),{'success':![],'message':_0x5a44(0x59)+_0x4c269a[_0x5a44(0x5a)]};}}}catch(_0x52de81){return console[_0x5a44(0x1b)](_0x5a44(0x6e),_0x52de81),{'success':![],'message':_0x375458[_0x5a44(0x6f)](_0x52de81,Error)?_0x52de81['message']:_0x375458[_0x5a44(0x70)]};}};exports['requestLLMDataForDeveloper']=requestLLMDataForDeveloper;const getAllLLMDataKeys=async()=>{const _0x4b3fc0={'kdSTe':_0x5a44(0x71),'ACaHo':function(_0x5a9b88,_0x44e5f4){return _0x5a9b88 instanceof _0x44e5f4;},'tLsUG':'vmuoW','gCYLq':_0x5a44(0x28)};try{const _0x2311a=await _asyncStorage[_0x5a44(0xf)][_0x5a44(0x72)](),_0x3c0add=_0x2311a[_0x5a44(0x38)](_0x56f342=>_0x56f342[_0x5a44(0x73)](LLM_DATA_STORAGE_KEY)||_0x56f342['startsWith'](LLM_METADATA_STORAGE_KEY));return _0x3c0add;}catch(_0x16b6ca){return _0x5a44(0x74)!==_0x4b3fc0[_0x5a44(0x75)]?(console[_0x5a44(0x1b)](_0x4b3fc0[_0x5a44(0x76)],_0x16b6ca),[]):(_0x4fc0bf['error'](_0x4b3fc0['kdSTe'],_0x4f62f6),{'success':![],'message':_0x4b3fc0[_0x5a44(0x77)](_0xb64276,_0x17de3d)?_0x22b6b8[_0x5a44(0x5c)]:'Unknown\x20error'});}};exports[_0x5a44(0x7)]=getAllLLMDataKeys;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.updateLLMStatus = exports.storeLLMData = exports.sendLLMDataToBackend = exports.requestLLMDataForDeveloper = exports.hasOnlyLLMConnection = exports.getLLMMetadata = exports.getLLMData = exports.getAllLLMDataKeys = exports.formatLLMDataForDeveloper = exports.clearLLMData = void 0;
|
|
7
|
+
var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
|
|
8
|
+
var _api = require("../config/api");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
/**
|
|
11
|
+
* LLM Data Storage Service
|
|
12
|
+
*
|
|
13
|
+
* Temporary storage solution for LLM (ChatGPT) data until full backend processing is implemented.
|
|
14
|
+
*
|
|
15
|
+
* Flow:
|
|
16
|
+
* 1. When user connects ONLY LLM data → Store data locally, send metadata to backend
|
|
17
|
+
* 2. When user accepts data request → Send stored LLM data directly to developer
|
|
18
|
+
*
|
|
19
|
+
* This is a TEMPORARY feature until full LLM data processing is available.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const LLM_DATA_STORAGE_KEY = '@onairos:llm_data';
|
|
23
|
+
const LLM_METADATA_STORAGE_KEY = '@onairos:llm_metadata';
|
|
24
|
+
/**
|
|
25
|
+
* Store LLM data locally (temporary storage)
|
|
26
|
+
*/
|
|
27
|
+
const storeLLMData = async payload => {
|
|
28
|
+
try {
|
|
29
|
+
console.log('💾 Storing LLM data locally (temporary)...');
|
|
30
|
+
|
|
31
|
+
// Store the full data payload
|
|
32
|
+
await _asyncStorage.default.setItem(`${LLM_DATA_STORAGE_KEY}:${payload.userId}`, JSON.stringify(payload));
|
|
33
|
+
|
|
34
|
+
// Store metadata separately for quick access
|
|
35
|
+
const metadata = {
|
|
36
|
+
userId: payload.userId,
|
|
37
|
+
email: payload.email,
|
|
38
|
+
appName: payload.appName,
|
|
39
|
+
timestamp: payload.timestamp,
|
|
40
|
+
hasData: true,
|
|
41
|
+
dataSize: JSON.stringify(payload.data).length,
|
|
42
|
+
connectionStatus: 'connected'
|
|
43
|
+
};
|
|
44
|
+
await _asyncStorage.default.setItem(`${LLM_METADATA_STORAGE_KEY}:${payload.userId}`, JSON.stringify(metadata));
|
|
45
|
+
console.log('✅ LLM data stored locally successfully');
|
|
46
|
+
console.log(`📊 Data size: ${metadata.dataSize} bytes`);
|
|
47
|
+
return true;
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error('❌ Failed to store LLM data:', error);
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Retrieve stored LLM data
|
|
56
|
+
*/
|
|
57
|
+
exports.storeLLMData = storeLLMData;
|
|
58
|
+
const getLLMData = async userId => {
|
|
59
|
+
try {
|
|
60
|
+
const storedData = await _asyncStorage.default.getItem(`${LLM_DATA_STORAGE_KEY}:${userId}`);
|
|
61
|
+
if (!storedData) {
|
|
62
|
+
console.log('ℹ️ No LLM data found for user:', userId);
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const payload = JSON.parse(storedData);
|
|
66
|
+
console.log('✅ Retrieved LLM data for user:', userId);
|
|
67
|
+
return payload;
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.error('❌ Failed to retrieve LLM data:', error);
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Get LLM metadata (quick check without loading full data)
|
|
76
|
+
*/
|
|
77
|
+
exports.getLLMData = getLLMData;
|
|
78
|
+
const getLLMMetadata = async userId => {
|
|
79
|
+
try {
|
|
80
|
+
const storedMetadata = await _asyncStorage.default.getItem(`${LLM_METADATA_STORAGE_KEY}:${userId}`);
|
|
81
|
+
if (!storedMetadata) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
return JSON.parse(storedMetadata);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error('❌ Failed to retrieve LLM metadata:', error);
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Update LLM connection status
|
|
93
|
+
*/
|
|
94
|
+
exports.getLLMMetadata = getLLMMetadata;
|
|
95
|
+
const updateLLMStatus = async (userId, status) => {
|
|
96
|
+
try {
|
|
97
|
+
const metadata = await getLLMMetadata(userId);
|
|
98
|
+
if (!metadata) {
|
|
99
|
+
console.warn('⚠️ No LLM metadata found for user:', userId);
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
metadata.connectionStatus = status;
|
|
103
|
+
await _asyncStorage.default.setItem(`${LLM_METADATA_STORAGE_KEY}:${userId}`, JSON.stringify(metadata));
|
|
104
|
+
console.log(`✅ Updated LLM status to: ${status}`);
|
|
105
|
+
return true;
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error('❌ Failed to update LLM status:', error);
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Clear stored LLM data after successful transmission
|
|
114
|
+
*/
|
|
115
|
+
exports.updateLLMStatus = updateLLMStatus;
|
|
116
|
+
const clearLLMData = async userId => {
|
|
117
|
+
try {
|
|
118
|
+
await _asyncStorage.default.removeItem(`${LLM_DATA_STORAGE_KEY}:${userId}`);
|
|
119
|
+
await _asyncStorage.default.removeItem(`${LLM_METADATA_STORAGE_KEY}:${userId}`);
|
|
120
|
+
console.log('✅ LLM data cleared for user:', userId);
|
|
121
|
+
return true;
|
|
122
|
+
} catch (error) {
|
|
123
|
+
console.error('❌ Failed to clear LLM data:', error);
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Check if user has ONLY LLM data connected (no other platforms)
|
|
130
|
+
*/
|
|
131
|
+
exports.clearLLMData = clearLLMData;
|
|
132
|
+
const hasOnlyLLMConnection = platformToggles => {
|
|
133
|
+
const connectedPlatforms = Object.entries(platformToggles).filter(([_, connected]) => connected).map(([platform, _]) => platform);
|
|
134
|
+
|
|
135
|
+
// Check if ONLY 'llm' or 'chatgpt' is connected
|
|
136
|
+
const hasLLM = connectedPlatforms.includes('llm') || connectedPlatforms.includes('chatgpt');
|
|
137
|
+
const onlyLLM = connectedPlatforms.length === 1 && hasLLM;
|
|
138
|
+
console.log('🔍 Platform connection check:', {
|
|
139
|
+
connectedPlatforms,
|
|
140
|
+
hasLLM,
|
|
141
|
+
onlyLLM
|
|
142
|
+
});
|
|
143
|
+
return onlyLLM;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Format LLM data for developer API
|
|
148
|
+
*/
|
|
149
|
+
exports.hasOnlyLLMConnection = hasOnlyLLMConnection;
|
|
150
|
+
const formatLLMDataForDeveloper = payload => {
|
|
151
|
+
return {
|
|
152
|
+
platform: 'llm',
|
|
153
|
+
userId: payload.userId,
|
|
154
|
+
email: payload.email,
|
|
155
|
+
timestamp: payload.timestamp,
|
|
156
|
+
data: {
|
|
157
|
+
type: 'chatgpt',
|
|
158
|
+
conversations: payload.data.conversations || [],
|
|
159
|
+
chatHistory: payload.data.chatHistory || [],
|
|
160
|
+
preferences: payload.data.preferences || {},
|
|
161
|
+
customData: payload.data.customData || {}
|
|
162
|
+
},
|
|
163
|
+
metadata: {
|
|
164
|
+
appName: payload.appName,
|
|
165
|
+
collectedAt: new Date(payload.timestamp).toISOString(),
|
|
166
|
+
dataVersion: '1.0'
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Send LLM data directly to backend for processing and storage
|
|
173
|
+
* FULL BACKEND IMPLEMENTATION - Backend handles all data processing
|
|
174
|
+
*/
|
|
175
|
+
exports.formatLLMDataForDeveloper = formatLLMDataForDeveloper;
|
|
176
|
+
const sendLLMDataToBackend = async (payload, authToken) => {
|
|
177
|
+
try {
|
|
178
|
+
console.log('📡 Sending LLM data to backend for processing...');
|
|
179
|
+
const response = await fetch(`${_api.API_CONFIG.BASE_URL}/llmdata`, {
|
|
180
|
+
method: 'POST',
|
|
181
|
+
headers: {
|
|
182
|
+
'Content-Type': 'application/json',
|
|
183
|
+
...(authToken && {
|
|
184
|
+
'Authorization': `Bearer ${authToken}`
|
|
185
|
+
})
|
|
186
|
+
},
|
|
187
|
+
body: JSON.stringify({
|
|
188
|
+
userId: payload.userId,
|
|
189
|
+
email: payload.email,
|
|
190
|
+
appName: payload.appName,
|
|
191
|
+
platform: 'llm',
|
|
192
|
+
connectionType: 'chatgpt',
|
|
193
|
+
timestamp: new Date().toISOString(),
|
|
194
|
+
data: payload.data,
|
|
195
|
+
accessToken: payload.accessToken,
|
|
196
|
+
refreshToken: payload.refreshToken,
|
|
197
|
+
tokenExpiry: payload.tokenExpiry,
|
|
198
|
+
metadata: {
|
|
199
|
+
collectedAt: new Date(payload.timestamp).toISOString(),
|
|
200
|
+
dataVersion: '1.0'
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
});
|
|
204
|
+
if (response.ok) {
|
|
205
|
+
const result = await response.json();
|
|
206
|
+
console.log('✅ Backend received and stored LLM data:', result);
|
|
207
|
+
return {
|
|
208
|
+
success: true,
|
|
209
|
+
message: result.message,
|
|
210
|
+
connectionId: result.connectionId
|
|
211
|
+
};
|
|
212
|
+
} else {
|
|
213
|
+
const errorText = await response.text();
|
|
214
|
+
console.error('❌ Backend data ingestion failed:', response.status, errorText);
|
|
215
|
+
return {
|
|
216
|
+
success: false,
|
|
217
|
+
message: `Backend error: ${response.status}`
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
} catch (error) {
|
|
221
|
+
console.error('❌ Failed to send data to backend:', error);
|
|
222
|
+
return {
|
|
223
|
+
success: false,
|
|
224
|
+
message: error instanceof Error ? error.message : 'Unknown error'
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Request LLM data from backend to be sent to developer
|
|
231
|
+
* FULL BACKEND IMPLEMENTATION - Backend retrieves stored data and forwards to developer
|
|
232
|
+
*/
|
|
233
|
+
exports.sendLLMDataToBackend = sendLLMDataToBackend;
|
|
234
|
+
const requestLLMDataForDeveloper = async (userId, email, appName, requestedData, authToken) => {
|
|
235
|
+
try {
|
|
236
|
+
console.log('📤 Requesting backend to send LLM data to developer...');
|
|
237
|
+
|
|
238
|
+
// Request backend to process and forward LLM data to developer
|
|
239
|
+
const response = await fetch(`${_api.API_CONFIG.BASE_URL}/llmdata/request`, {
|
|
240
|
+
method: 'POST',
|
|
241
|
+
headers: {
|
|
242
|
+
'Content-Type': 'application/json',
|
|
243
|
+
'Authorization': `Bearer ${authToken}`
|
|
244
|
+
},
|
|
245
|
+
body: JSON.stringify({
|
|
246
|
+
userId,
|
|
247
|
+
email,
|
|
248
|
+
appName,
|
|
249
|
+
requestedData,
|
|
250
|
+
timestamp: new Date().toISOString()
|
|
251
|
+
})
|
|
252
|
+
});
|
|
253
|
+
if (response.ok) {
|
|
254
|
+
const result = await response.json();
|
|
255
|
+
console.log('✅ Backend processing LLM data request:', result);
|
|
256
|
+
return {
|
|
257
|
+
success: true,
|
|
258
|
+
message: result.message,
|
|
259
|
+
apiUrl: result.apiUrl,
|
|
260
|
+
token: result.token
|
|
261
|
+
};
|
|
262
|
+
} else {
|
|
263
|
+
const errorText = await response.text();
|
|
264
|
+
console.error('❌ Failed to request LLM data:', response.status, errorText);
|
|
265
|
+
return {
|
|
266
|
+
success: false,
|
|
267
|
+
message: `Backend error: ${response.status}`
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
} catch (error) {
|
|
271
|
+
console.error('❌ Failed to request LLM data from backend:', error);
|
|
272
|
+
return {
|
|
273
|
+
success: false,
|
|
274
|
+
message: error instanceof Error ? error.message : 'Unknown error'
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Get all stored LLM data keys (for debugging/admin purposes)
|
|
281
|
+
*/
|
|
282
|
+
exports.requestLLMDataForDeveloper = requestLLMDataForDeveloper;
|
|
283
|
+
const getAllLLMDataKeys = async () => {
|
|
284
|
+
try {
|
|
285
|
+
const allKeys = await _asyncStorage.default.getAllKeys();
|
|
286
|
+
const llmKeys = allKeys.filter(key => key.startsWith(LLM_DATA_STORAGE_KEY) || key.startsWith(LLM_METADATA_STORAGE_KEY));
|
|
287
|
+
return llmKeys;
|
|
288
|
+
} catch (error) {
|
|
289
|
+
console.error('❌ Failed to get LLM data keys:', error);
|
|
290
|
+
return [];
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
exports.getAllLLMDataKeys = getAllLLMDataKeys;
|
|
294
|
+
//# sourceMappingURL=llmDataStorage.js.map
|
|
@@ -1,8 +1,186 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.startEnochTrainingWithYouTubeCheck = exports.startEnochTraining = exports.isTrainingInProgress = exports.getTrainingStatus = exports.getTrainingFeatures = exports.getModelInfo = exports.getHealthCheck = void 0;
|
|
7
|
+
var _authService = require("./authService");
|
|
8
|
+
var _api = require("../config/api");
|
|
9
|
+
// Migration functions no longer needed - backend handles all YouTube cases automatically
|
|
10
|
+
// import { checkAndFixYouTubeConnection, getYouTubeConnectionStatus, shouldShowYouTubeMigrationWarning } from './youtubeMigrationService';
|
|
11
|
+
|
|
12
|
+
const API_BASE_URL = `${_api.API_CONFIG.BASE_URL}`;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Mobile Training API Service
|
|
16
|
+
* Implements the updated training spec routes
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// Training Status Route
|
|
20
|
+
const getTrainingStatus = async username => {
|
|
21
|
+
try {
|
|
22
|
+
const authToken = await (0, _authService.getAuthToken)();
|
|
23
|
+
if (!authToken) {
|
|
24
|
+
throw new Error('No authentication token available');
|
|
25
|
+
}
|
|
26
|
+
const response = await fetch(`${API_BASE_URL}/mobile-training/status/${username}`, {
|
|
27
|
+
method: 'GET',
|
|
28
|
+
headers: {
|
|
29
|
+
'Authorization': authToken,
|
|
30
|
+
'Content-Type': 'application/json'
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
const errorData = await response.json();
|
|
35
|
+
throw new Error(errorData.error || `HTTP ${response.status}`);
|
|
36
|
+
}
|
|
37
|
+
return await response.json();
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error('❌ Failed to get training status:', error);
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Model Info Route
|
|
45
|
+
exports.getTrainingStatus = getTrainingStatus;
|
|
46
|
+
const getModelInfo = async () => {
|
|
47
|
+
try {
|
|
48
|
+
const authToken = await (0, _authService.getAuthToken)();
|
|
49
|
+
if (!authToken) {
|
|
50
|
+
throw new Error('No authentication token available');
|
|
51
|
+
}
|
|
52
|
+
const response = await fetch(`${API_BASE_URL}/mobile-training/model-info`, {
|
|
53
|
+
method: 'GET',
|
|
54
|
+
headers: {
|
|
55
|
+
'Authorization': authToken,
|
|
56
|
+
'Content-Type': 'application/json'
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
if (!response.ok) {
|
|
60
|
+
const errorData = await response.json();
|
|
61
|
+
throw new Error(errorData.error || `HTTP ${response.status}`);
|
|
62
|
+
}
|
|
63
|
+
return await response.json();
|
|
64
|
+
} catch (error) {
|
|
65
|
+
console.error('❌ Failed to get model info:', error);
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// Health Check Route
|
|
71
|
+
exports.getModelInfo = getModelInfo;
|
|
72
|
+
const getHealthCheck = async () => {
|
|
73
|
+
try {
|
|
74
|
+
const response = await fetch(`${API_BASE_URL}/mobile-training/health`, {
|
|
75
|
+
method: 'GET',
|
|
76
|
+
headers: {
|
|
77
|
+
'Content-Type': 'application/json'
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
if (!response.ok) {
|
|
81
|
+
const errorData = await response.json();
|
|
82
|
+
throw new Error(errorData.error || `HTTP ${response.status}`);
|
|
83
|
+
}
|
|
84
|
+
return await response.json();
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error('❌ Failed to get health check:', error);
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Start Enoch Training - Simplified Version
|
|
93
|
+
* Backend now handles all YouTube connection cases automatically (temporary mode, refresh tokens, etc.)
|
|
94
|
+
* No frontend migration checks needed anymore
|
|
95
|
+
*/
|
|
96
|
+
exports.getHealthCheck = getHealthCheck;
|
|
97
|
+
const startEnochTrainingWithYouTubeCheck = async trainingData => {
|
|
98
|
+
try {
|
|
99
|
+
console.log('🚀 Starting Enoch training for user:', trainingData.username, '(backend auto-handles YouTube)');
|
|
100
|
+
|
|
101
|
+
// ✅ SIMPLIFIED: Backend handles all YouTube connection cases automatically
|
|
102
|
+
console.log('🚀 [TRAINING] Starting training - backend handles all YouTube cases automatically');
|
|
103
|
+
console.log('ℹ️ [TRAINING] No migration checks needed:');
|
|
104
|
+
console.log(' - Temporary mode connections: Work automatically ✅');
|
|
105
|
+
console.log(' - Full refresh tokens: Auto-refresh when expired ✅');
|
|
106
|
+
console.log(' - Backend validation: Handles all edge cases ✅');
|
|
107
|
+
|
|
108
|
+
// ✅ Proceed with training - backend handles YouTube automatically
|
|
109
|
+
return await startEnochTraining(trainingData);
|
|
110
|
+
} catch (error) {
|
|
111
|
+
console.error('❌ Training error:', error);
|
|
112
|
+
throw error;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Start Enoch Training
|
|
118
|
+
* Updated to use the new /mobile-training/enoch endpoint with proper error handling
|
|
119
|
+
*/
|
|
120
|
+
exports.startEnochTrainingWithYouTubeCheck = startEnochTrainingWithYouTubeCheck;
|
|
121
|
+
const startEnochTraining = async trainingData => {
|
|
122
|
+
try {
|
|
123
|
+
const authToken = await (0, _authService.getAuthToken)();
|
|
124
|
+
if (!authToken) {
|
|
125
|
+
throw new Error('No authentication token available');
|
|
126
|
+
}
|
|
127
|
+
console.log('📤 Sending training data to /mobile-training/enoch:', trainingData);
|
|
128
|
+
const response = await fetch(`${API_BASE_URL}/mobile-training/enoch`, {
|
|
129
|
+
method: 'POST',
|
|
130
|
+
headers: {
|
|
131
|
+
'Content-Type': 'application/json',
|
|
132
|
+
'Authorization': authToken
|
|
133
|
+
},
|
|
134
|
+
body: JSON.stringify(trainingData)
|
|
135
|
+
});
|
|
136
|
+
console.log('📡 Training API response status:', response.status);
|
|
137
|
+
if (!response.ok) {
|
|
138
|
+
const errorText = await response.text();
|
|
139
|
+
console.error('❌ Training API failed with status:', response.status, 'Error:', errorText);
|
|
140
|
+
|
|
141
|
+
// Try to parse error response
|
|
142
|
+
try {
|
|
143
|
+
const errorData = JSON.parse(errorText);
|
|
144
|
+
throw new Error(errorData.error || `HTTP ${response.status}`);
|
|
145
|
+
} catch (parseError) {
|
|
146
|
+
throw new Error(`Training API failed: ${response.status} - ${errorText}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const result = await response.json();
|
|
150
|
+
console.log('📡 Training API response:', result);
|
|
151
|
+
return result;
|
|
152
|
+
} catch (error) {
|
|
153
|
+
console.error('❌ Training start error:', error);
|
|
154
|
+
throw error;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Helper function to check if training is in progress
|
|
160
|
+
*/
|
|
161
|
+
exports.startEnochTraining = startEnochTraining;
|
|
162
|
+
const isTrainingInProgress = async username => {
|
|
163
|
+
try {
|
|
164
|
+
const status = await getTrainingStatus(username);
|
|
165
|
+
return status.success && status.isTraining;
|
|
166
|
+
} catch (error) {
|
|
167
|
+
console.warn('⚠️ Could not check training status:', error);
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Helper function to get training features info
|
|
174
|
+
*/
|
|
175
|
+
exports.isTrainingInProgress = isTrainingInProgress;
|
|
176
|
+
const getTrainingFeatures = async () => {
|
|
177
|
+
try {
|
|
178
|
+
const health = await getHealthCheck();
|
|
179
|
+
return health.features;
|
|
180
|
+
} catch (error) {
|
|
181
|
+
console.warn('⚠️ Could not get training features:', error);
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
exports.getTrainingFeatures = getTrainingFeatures;
|
|
186
|
+
//# sourceMappingURL=mobileTrainingService.js.map
|