@onairos/react-native 3.6.8 → 3.6.9
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/README.md +423 -423
- package/lib/commonjs/api/index.js +1 -1
- package/lib/commonjs/assets/images/Checkbox.svg +3 -3
- package/lib/commonjs/assets/images/EnochE.svg +19 -19
- package/lib/commonjs/assets/images/Personalityprofile.svg +3 -3
- package/lib/commonjs/assets/images/Personalitytraits.svg +3 -3
- package/lib/commonjs/assets/images/Userpreferences.svg +3 -3
- package/lib/commonjs/assets/images/arrow.svg +20 -20
- package/lib/commonjs/assets/images/basicproficon.svg +43 -43
- package/lib/commonjs/assets/images/basicprofile.svg +3 -3
- package/lib/commonjs/assets/images/checkmark.svg +4 -4
- package/lib/commonjs/assets/images/contentanalysis.svg +3 -3
- package/lib/commonjs/assets/images/contenticon.svg +23 -23
- package/lib/commonjs/assets/images/personalityicon.svg +18 -18
- package/lib/commonjs/assets/images/x-close.svg +3 -3
- package/lib/commonjs/components/BodyText.js +1 -1
- package/lib/commonjs/components/BrandMark.js +1 -1
- package/lib/commonjs/components/CodeInput.js +1 -1
- package/lib/commonjs/components/EmailInput.js +1 -1
- package/lib/commonjs/components/GoogleButton.js +1 -1
- package/lib/commonjs/components/HeadingGroup.js +1 -1
- package/lib/commonjs/components/LLMDataInputModal.js +1 -1
- package/lib/commonjs/components/ModalHeader.js +1 -1
- package/lib/commonjs/components/ModalSheet.js +1 -1
- package/lib/commonjs/components/Onairos.js +1 -1
- package/lib/commonjs/components/OnairosButton.js +1 -1
- package/lib/commonjs/components/OnairosSignInButton.js +1 -1
- package/lib/commonjs/components/Overlay.js +1 -1
- package/lib/commonjs/components/PersonaImage.js +1 -1
- package/lib/commonjs/components/PersonaLoadingScreen.js +1 -1
- package/lib/commonjs/components/PersonalizationConsentScreen.js +1 -1
- package/lib/commonjs/components/PinCreationScreen.js +1 -1
- package/lib/commonjs/components/PinInput.js +1 -1
- package/lib/commonjs/components/PlatformConnectorsStep.js +1 -1
- package/lib/commonjs/components/PlatformList.js +1 -1
- package/lib/commonjs/components/PlatformToggle.js +1 -1
- package/lib/commonjs/components/PrimaryButton.js +1 -1
- package/lib/commonjs/components/SignInMatchAnimation.js +1 -1
- package/lib/commonjs/components/SignInStep.js +1 -1
- package/lib/commonjs/components/UniversalOnboarding.js +1 -1
- package/lib/commonjs/components/VerificationStep.js +1 -1
- package/lib/commonjs/components/WelcomeScreen.js +1 -1
- package/lib/commonjs/components/icons/Basicproficon.js +1 -1
- package/lib/commonjs/components/icons/Basicprofile.js +1 -1
- package/lib/commonjs/components/icons/Checkbox.js +1 -1
- package/lib/commonjs/components/icons/Checkmark.js +1 -1
- package/lib/commonjs/components/icons/Contentanalysis.js +1 -1
- package/lib/commonjs/components/icons/Contenticon.js +1 -1
- package/lib/commonjs/components/icons/EnochE.js +1 -1
- package/lib/commonjs/components/icons/Personalityicon.js +1 -1
- package/lib/commonjs/components/icons/Personalityprofile.js +1 -1
- package/lib/commonjs/components/icons/Personalitytraits.js +1 -1
- package/lib/commonjs/components/icons/Userpreferences.js +1 -1
- package/lib/commonjs/components/icons/index.js +1 -1
- package/lib/commonjs/components/onboarding/OAuthWebView.js +1 -1
- package/lib/commonjs/components/onboarding/OnboardingHeader.js +1 -1
- package/lib/commonjs/components/onboarding/PinInput.js +1 -1
- package/lib/commonjs/components/onboarding/PlatformConnector.js +1 -1
- package/lib/commonjs/config/PLATFORM_APIS.md +559 -0
- package/lib/commonjs/config/api.js +1 -1
- package/lib/commonjs/config/telegramConfig.js +8 -0
- package/lib/commonjs/config/webchangelog/md +607 -0
- package/lib/commonjs/constants/index.js +1 -1
- package/lib/commonjs/context/AuthContext.js +1 -1
- package/lib/commonjs/hooks/useConnectedAccounts.js +1 -1
- package/lib/commonjs/hooks/useConnections.js +1 -1
- package/lib/commonjs/hooks/useCredentials.js +1 -1
- package/lib/commonjs/hooks/useUserConnections.js +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/services/SDK_API_KEY_VALIDATION.md +421 -421
- package/lib/commonjs/services/apiClient.js +1 -1
- package/lib/commonjs/services/apiKeyService.js +99 -99
- package/lib/commonjs/services/authService.js +72 -72
- package/lib/commonjs/services/biometricPinService.js +1 -1
- package/lib/commonjs/services/chatGPTConversationExtractor.js +1 -1
- package/lib/commonjs/services/chatGPTConversationService.js +1 -1
- package/lib/commonjs/services/claudeConversationExtractor.js +1 -1
- package/lib/commonjs/services/claudeConversationService.js +1 -1
- package/lib/commonjs/services/connectedAccountsService.js +1 -1
- package/lib/commonjs/services/googleAuthService.js +1 -1
- package/lib/commonjs/services/hingeDataExtractor.js +1 -1
- package/lib/commonjs/services/hingeDataService.js +1 -1
- package/lib/commonjs/services/imageCompressionService.js +1 -1
- package/lib/commonjs/services/instagramDataExtractor.js +1 -1
- package/lib/commonjs/services/instagramDataService.js +1 -1
- package/lib/commonjs/services/jwtStorageService.js +1 -1
- package/lib/commonjs/services/linkedinDOMExtractor.js +1 -1
- package/lib/commonjs/services/linkedinProfileService.js +1 -1
- package/lib/commonjs/services/linkedinScrapingService.js +1 -1
- package/lib/commonjs/services/llmDataStorage.js +1 -1
- package/lib/commonjs/services/mobileTrainingService.js +1 -1
- package/lib/commonjs/services/oauthService.js +20 -20
- package/lib/commonjs/services/pinEncryptionService.js +1 -1
- package/lib/commonjs/services/pinStorageUtils.js +1 -1
- package/lib/commonjs/services/platformAuthService.js +1 -1
- package/lib/commonjs/services/sephoraDataExtractor.js +1 -1
- package/lib/commonjs/services/sephoraDataService.js +1 -1
- package/lib/commonjs/services/storageService.js +1 -1
- package/lib/commonjs/services/telegramDataExtractor.js +1 -1
- package/lib/commonjs/services/telegramDataService.js +1 -1
- package/lib/commonjs/services/trainingApiHelpers.js +1 -1
- package/lib/commonjs/services/userConnectionsService.js +1 -1
- package/lib/commonjs/services/youtubeMigrationService.js +1 -1
- package/lib/commonjs/theme/index.js +1 -1
- package/lib/commonjs/types/index.js +1 -1
- package/lib/commonjs/types.js +1 -1
- package/lib/commonjs/utils/Portal.js +1 -1
- package/lib/commonjs/utils/api.js +1 -1
- package/lib/commonjs/utils/assetRegistry.js +1 -1
- package/lib/commonjs/utils/auth.js +1 -1
- package/lib/commonjs/utils/connectorTests.js +1 -1
- package/lib/commonjs/utils/crypto.js +1 -1
- package/lib/commonjs/utils/debugHelper.js +1 -1
- package/lib/commonjs/utils/encryption.js +1 -1
- package/lib/commonjs/utils/eventUtils.js +1 -1
- package/lib/commonjs/utils/haptics.js +1 -1
- package/lib/commonjs/utils/imagePreloader.js +1 -1
- package/lib/commonjs/utils/networkDiagnostics.js +1 -1
- package/lib/commonjs/utils/onairosApi.js +1 -1
- package/lib/commonjs/utils/programmaticFlow.js +1 -1
- package/lib/commonjs/utils/retryHelper.js +1 -1
- package/lib/commonjs/utils/secureStorage.js +1 -1
- package/lib/commonjs/utils/webviewScripts/chatgpt.js +1 -1
- package/lib/commonjs/utils/webviewScripts/claude.js +1 -1
- package/lib/commonjs/utils/webviewScripts/hinge.js +1 -1
- package/lib/commonjs/utils/webviewScripts/index.js +1 -1
- package/lib/commonjs/utils/webviewScripts/instagram.js +1 -1
- package/lib/commonjs/utils/webviewScripts/linkedin.js +1 -1
- package/lib/commonjs/utils/webviewScripts/sephora.js +1 -1
- package/lib/commonjs/utils/webviewScripts/telegram.js +1 -1
- package/lib/module/api/index.js +1 -1
- package/lib/module/assets/images/Checkbox.svg +3 -3
- package/lib/module/assets/images/EnochE.svg +19 -19
- package/lib/module/assets/images/Personalityprofile.svg +3 -3
- package/lib/module/assets/images/Personalitytraits.svg +3 -3
- package/lib/module/assets/images/Userpreferences.svg +3 -3
- package/lib/module/assets/images/arrow.svg +20 -20
- package/lib/module/assets/images/basicproficon.svg +43 -43
- package/lib/module/assets/images/basicprofile.svg +3 -3
- package/lib/module/assets/images/checkmark.svg +4 -4
- package/lib/module/assets/images/contentanalysis.svg +3 -3
- package/lib/module/assets/images/contenticon.svg +23 -23
- package/lib/module/assets/images/personalityicon.svg +18 -18
- package/lib/module/assets/images/x-close.svg +3 -3
- package/lib/module/components/BodyText.js +1 -1
- package/lib/module/components/BrandMark.js +1 -1
- package/lib/module/components/CodeInput.js +1 -1
- package/lib/module/components/EmailInput.js +1 -1
- package/lib/module/components/GoogleButton.js +1 -1
- package/lib/module/components/HeadingGroup.js +1 -1
- package/lib/module/components/LLMDataInputModal.js +1 -1
- package/lib/module/components/ModalHeader.js +1 -1
- package/lib/module/components/ModalSheet.js +1 -1
- package/lib/module/components/Onairos.js +1 -1
- package/lib/module/components/OnairosButton.js +1 -1
- package/lib/module/components/OnairosSignInButton.js +1 -1
- package/lib/module/components/Overlay.js +1 -1
- package/lib/module/components/PersonaImage.js +1 -1
- package/lib/module/components/PersonaLoadingScreen.js +1 -1
- package/lib/module/components/PersonalizationConsentScreen.js +1 -1
- package/lib/module/components/PinCreationScreen.js +1 -1
- package/lib/module/components/PinInput.js +1 -1
- package/lib/module/components/PlatformConnectorsStep.js +1 -1
- package/lib/module/components/PlatformList.js +1 -1
- package/lib/module/components/PlatformToggle.js +1 -1
- package/lib/module/components/PrimaryButton.js +1 -1
- package/lib/module/components/SignInMatchAnimation.js +1 -1
- package/lib/module/components/SignInStep.js +1 -1
- package/lib/module/components/UniversalOnboarding.js +1 -1
- package/lib/module/components/VerificationStep.js +1 -1
- package/lib/module/components/WelcomeScreen.js +1 -1
- package/lib/module/components/icons/Basicproficon.js +1 -1
- package/lib/module/components/icons/Basicprofile.js +1 -1
- package/lib/module/components/icons/Checkbox.js +1 -1
- package/lib/module/components/icons/Checkmark.js +1 -1
- package/lib/module/components/icons/Contentanalysis.js +1 -1
- package/lib/module/components/icons/Contenticon.js +1 -1
- package/lib/module/components/icons/EnochE.js +1 -1
- package/lib/module/components/icons/Personalityicon.js +1 -1
- package/lib/module/components/icons/Personalityprofile.js +1 -1
- package/lib/module/components/icons/Personalitytraits.js +1 -1
- package/lib/module/components/icons/Userpreferences.js +1 -1
- package/lib/module/components/onboarding/OAuthWebView.js +1 -1
- package/lib/module/components/onboarding/OnboardingHeader.js +1 -1
- package/lib/module/components/onboarding/PinInput.js +1 -1
- package/lib/module/components/onboarding/PlatformConnector.js +1 -1
- package/lib/module/config/PLATFORM_APIS.md +559 -0
- package/lib/module/config/api.js +1 -1
- package/lib/module/config/telegramConfig.js +8 -0
- package/lib/module/config/webchangelog/md +607 -0
- package/lib/module/constants/index.js +1 -1
- package/lib/module/context/AuthContext.js +1 -1
- package/lib/module/hooks/useConnectedAccounts.js +1 -1
- package/lib/module/hooks/useConnections.js +1 -1
- package/lib/module/hooks/useCredentials.js +1 -1
- package/lib/module/hooks/useUserConnections.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/services/SDK_API_KEY_VALIDATION.md +421 -421
- package/lib/module/services/apiClient.js +1 -1
- package/lib/module/services/apiKeyService.js +99 -99
- package/lib/module/services/authService.js +72 -72
- package/lib/module/services/biometricPinService.js +1 -1
- package/lib/module/services/chatGPTConversationExtractor.js +1 -1
- package/lib/module/services/chatGPTConversationService.js +1 -1
- package/lib/module/services/claudeConversationExtractor.js +1 -1
- package/lib/module/services/claudeConversationService.js +1 -1
- package/lib/module/services/connectedAccountsService.js +1 -1
- package/lib/module/services/googleAuthService.js +1 -1
- package/lib/module/services/hingeDataExtractor.js +1 -1
- package/lib/module/services/hingeDataService.js +1 -1
- package/lib/module/services/imageCompressionService.js +1 -1
- package/lib/module/services/instagramDataExtractor.js +1 -1
- package/lib/module/services/instagramDataService.js +1 -1
- package/lib/module/services/jwtStorageService.js +1 -1
- package/lib/module/services/linkedinDOMExtractor.js +1 -1
- package/lib/module/services/linkedinProfileService.js +1 -1
- package/lib/module/services/linkedinScrapingService.js +1 -1
- package/lib/module/services/llmDataStorage.js +1 -1
- package/lib/module/services/mobileTrainingService.js +1 -1
- package/lib/module/services/oauthService.js +20 -20
- package/lib/module/services/pinEncryptionService.js +1 -1
- package/lib/module/services/pinStorageUtils.js +1 -1
- package/lib/module/services/platformAuthService.js +1 -1
- package/lib/module/services/sephoraDataExtractor.js +1 -1
- package/lib/module/services/sephoraDataService.js +1 -1
- package/lib/module/services/storageService.js +1 -1
- package/lib/module/services/telegramDataExtractor.js +1 -1
- package/lib/module/services/telegramDataService.js +1 -1
- package/lib/module/services/trainingApiHelpers.js +1 -1
- package/lib/module/services/userConnectionsService.js +1 -1
- package/lib/module/services/youtubeMigrationService.js +1 -1
- package/lib/module/theme/index.js +1 -1
- package/lib/module/types.js +1 -1
- package/lib/module/utils/Portal.js +1 -1
- package/lib/module/utils/api.js +1 -1
- package/lib/module/utils/assetRegistry.js +1 -1
- package/lib/module/utils/auth.js +1 -1
- package/lib/module/utils/connectorTests.js +1 -1
- package/lib/module/utils/crypto.js +1 -1
- package/lib/module/utils/debugHelper.js +1 -1
- package/lib/module/utils/encryption.js +1 -1
- package/lib/module/utils/eventUtils.js +1 -1
- package/lib/module/utils/haptics.js +1 -1
- package/lib/module/utils/networkDiagnostics.js +1 -1
- package/lib/module/utils/onairosApi.js +1 -1
- package/lib/module/utils/programmaticFlow.js +1 -1
- package/lib/module/utils/retryHelper.js +1 -1
- package/lib/module/utils/secureStorage.js +1 -1
- package/lib/module/utils/webviewScripts/chatgpt.js +1 -1
- package/lib/module/utils/webviewScripts/claude.js +1 -1
- package/lib/module/utils/webviewScripts/hinge.js +1 -1
- package/lib/module/utils/webviewScripts/index.js +1 -1
- package/lib/module/utils/webviewScripts/instagram.js +1 -1
- package/lib/module/utils/webviewScripts/linkedin.js +1 -1
- package/lib/module/utils/webviewScripts/sephora.js +1 -1
- package/lib/module/utils/webviewScripts/telegram.js +1 -1
- package/package.json +172 -172
|
@@ -1 +1 @@
|
|
|
1
|
-
function _0x2787(_0x3a5844,_0x278751){_0x3a5844=_0x3a5844-0x0;const _0x5d8e62=_0x3a58();let _0x522675=_0x5d8e62[_0x3a5844];return _0x522675;}import{getJWTForRoute,TokenType,getTokenTypeForRoute,clearJWT,getAllTokens,replaceJWTAfterVerification}from'./jwtStorageService';import{API_CONFIG}from'../config/api';let currentRequestId=0x0;const activeRequests=new Map();class ApiClient{constructor(_0x3e8c51=API_CONFIG[_0x2787(0x0)],_0x2ff39d={}){this[_0x2787(0x1)]=_0x3e8c51,this[_0x2787(0x2)]=_0x2ff39d;}async[_0x2787(0x3)](_0x46be72,_0x26f5d2={}){const _0x223445={'RuGwr':function(_0x2d11e8,_0x430d0d){return _0x2d11e8!==_0x430d0d;},'DjcLd':function(_0x564459,_0x17dd56){return _0x564459(_0x17dd56);},'Tvpnn':function(_0x1f036f,_0x14e21e){return _0x1f036f!==_0x14e21e;},'rMlAe':function(_0x48befc,_0x487828,_0x51ab07){return _0x48befc(_0x487828,_0x51ab07);},'AkOVX':function(_0x1c1e76,_0x54859c){return _0x1c1e76===_0x54859c;},'ozFAn':_0x2787(0x4),'sjedh':function(_0x589a4c,_0x278ab5){return _0x589a4c instanceof _0x278ab5;},'lmADp':'AbortError','ozFOD':_0x2787(0x5),'EYWGU':_0x2787(0x6)},_0x6fee73=++currentRequestId,_0xbd8dc5=new AbortController();activeRequests[_0x2787(0x7)](_0x6fee73,_0xbd8dc5);try{console['log'](_0x2787(0x8)+_0x6fee73+_0x2787(0x9)+_0x46be72);const _0x27dc73=_0x223445['DjcLd'](getTokenTypeForRoute,_0x46be72);console['log'](_0x2787(0xa)+_0x46be72+'\x20requires\x20'+_0x27dc73+_0x2787(0xb));const _0x3d10fa=await this['getRequestHeaders'](_0x46be72,_0x223445[_0x2787(0xc)](_0x26f5d2['requiresAuth'],![])),_0xacc01f={'method':_0x26f5d2[_0x2787(0xd)]||'GET','headers':{'Content-Type':'application/json','User-Agent':_0x2787(0xe),..._0x3d10fa,..._0x26f5d2[_0x2787(0xf)]},'body':_0x26f5d2[_0x2787(0x10)]?JSON[_0x2787(0x11)](_0x26f5d2[_0x2787(0x10)]):undefined,'signal':_0xbd8dc5[_0x2787(0x12)]};console[_0x2787(0x13)]('🔐\x20[API\x20Client]\x20Request\x20'+_0x6fee73+_0x2787(0x14)+_0x27dc73+_0x2787(0xb));const _0x2638ab=await _0x223445[_0x2787(0x15)](fetch,''+this[_0x2787(0x1)]+_0x46be72,_0xacc01f);console[_0x2787(0x13)]('📡\x20[API\x20Client]\x20Response\x20'+_0x6fee73+_0x2787(0x16),_0x2638ab[_0x2787(0x17)]);if(_0x223445['AkOVX'](_0x2638ab['status'],0x191))return await this[_0x2787(0x18)](_0x6fee73,_0x46be72,_0x27dc73,_0x26f5d2);const _0x4d1a9a=await _0x2638ab[_0x2787(0x19)]();activeRequests[_0x2787(0x1a)](_0x6fee73);if(!_0x2638ab['ok'])return{'success':![],'error':_0x4d1a9a['message']||_0x2787(0x1b)+_0x2638ab[_0x2787(0x17)],'status':_0x2638ab['status'],'tokenType':_0x27dc73};return{'success':!![],'data':_0x4d1a9a,'status':_0x2638ab['status'],'tokenType':_0x27dc73};}catch(_0x50dc68){if(_0x2787(0x4)!==_0x223445[_0x2787(0x1c)])_0x223445[_0x2787(0x1d)](_0xfab124,_0x3bd83a)&&(_0x45149d[_0x2787(0x1e)](),_0xb5b05e[_0x2787(0x1a)](_0x5e85be),_0x3325f5++);else{activeRequests[_0x2787(0x1a)](_0x6fee73);if(_0x223445[_0x2787(0x1f)](_0x50dc68,Error)&&_0x223445[_0x2787(0x20)](_0x50dc68['name'],_0x223445['lmADp']))return console[_0x2787(0x13)]('🚫\x20[API\x20Client]\x20Request\x20'+_0x6fee73+'\x20was\x20cancelled'),{'success':![],'error':_0x223445[_0x2787(0x21)],'status':0x0};return console[_0x2787(0x22)](_0x2787(0x23)+_0x6fee73+_0x2787(0x24),_0x50dc68),{'success':![],'error':_0x50dc68 instanceof Error?_0x50dc68[_0x2787(0x25)]:_0x223445[_0x2787(0x26)],'status':0x0};}}}async[_0x2787(0x27)](_0x3dc632,_0x326984){const _0x134c13={'Lbtjk':_0x2787(0x28),'Xnzkj':_0x2787(0x29),'uKFmF':function(_0x2dbb54,_0x2be718){return _0x2dbb54(_0x2be718);}};if(!_0x326984){if(_0x134c13[_0x2787(0x2a)]===_0x134c13[_0x2787(0x2a)])return{};else _0x4f794f['warn'](_0x134c13[_0x2787(0x2b)]);}const _0x3dad40=await _0x134c13['uKFmF'](getJWTForRoute,_0x3dc632);if(!_0x3dad40){const _0x3fa197=_0x134c13[_0x2787(0x2c)](getTokenTypeForRoute,_0x3dc632);throw new Error(_0x2787(0x2d)+_0x3fa197+_0x2787(0x2e)+_0x3dc632+_0x2787(0x2f));}return{'Authorization':_0x3dad40};}async[_0x2787(0x18)](_0x5d2a9b,_0x597769,_0x2017f6,_0x13a5d8){const _0x4d6bc7=_0x2787(0x30)[_0x2787(0x31)]('|');let _0x1f6ba1=0x0;while(!![]){switch(_0x4d6bc7[_0x1f6ba1++]){case'0':console[_0x2787(0x13)](_0x2787(0x32)+_0x2017f6+_0x2787(0x33));continue;case'1':this['cancelRequestsForTokenType'](_0x2017f6,_0x5d2a9b);continue;case'2':await this[_0x2787(0x34)](_0x2017f6,_0x597769);continue;case'3':return{'success':![],'error':_0x2017f6+_0x2787(0x35)+_0x597769+_0x2787(0x36),'status':0x191,'tokenType':_0x2017f6};case'4':console[_0x2787(0x22)]('🚫\x20[API\x20Client]\x20Request\x20'+_0x5d2a9b+'\x20received\x20401\x20for\x20'+_0x2017f6+'\x20token\x20on\x20route:\x20'+_0x597769);continue;case'5':console['log'](_0x2787(0x37)+_0x2017f6+'\x20token\x20due\x20to\x20401\x20error');continue;case'6':await clearJWT(_0x2017f6);continue;}break;}}async[_0x2787(0x34)](_0x45c71f,_0x504f61){const _0x5c634b={'hVHAI':function(_0x100cb8,_0x533eef){return _0x100cb8===_0x533eef;},'CIelZ':_0x2787(0x38),'ZJzqe':function(_0x279a39,_0x2a13d3){return _0x279a39 instanceof _0x2a13d3;},'KKFkq':_0x2787(0x6),'dtvbr':function(_0x400866,_0x5eb24e){return _0x400866!==_0x5eb24e;},'PKhvC':_0x2787(0x39),'NrcGL':_0x2787(0x3a),'iVDvJ':_0x2787(0x3b),'aopwp':_0x2787(0x3c),'lkYSs':_0x2787(0x3d),'cTIvq':'⚠️\x20[API\x20Client]\x20No\x20auth\x20token\x20refresh\x20trigger\x20configured','HLYYq':_0x2787(0x3e)};console[_0x2787(0x13)]('🔄\x20[API\x20Client]\x20Triggering\x20re-auth\x20for\x20'+_0x45c71f+'\x20token\x20(endpoint:\x20'+_0x504f61+')');try{if(_0x5c634b[_0x2787(0x3f)](_0x5c634b[_0x2787(0x40)],_0x5c634b[_0x2787(0x40)]))return this['request'](_0x5c646b,{..._0x7578a9,'method':'PUT','body':_0x156722});else switch(_0x45c71f){case TokenType[_0x2787(0x41)]:this['authTriggers'][_0x2787(0x42)]?(console[_0x2787(0x13)](_0x2787(0x43)),await this[_0x2787(0x2)][_0x2787(0x42)]()):console[_0x2787(0x44)](_0x5c634b[_0x2787(0x45)]);break;case TokenType[_0x2787(0x46)]:if(this['authTriggers'][_0x2787(0x47)]){if(_0x5c634b['hVHAI'](_0x5c634b[_0x2787(0x48)],_0x5c634b[_0x2787(0x49)])){_0x3455c8[_0x2787(0x1a)](_0x13cf7c);if(_0x3fafea instanceof _0xecf551&&_0x5c634b['hVHAI'](_0x11a6ec[_0x2787(0x4a)],_0x5c634b[_0x2787(0x4b)]))return _0xb14098[_0x2787(0x13)](_0x2787(0x4c)+_0x2c5f8d+_0x2787(0x4d)),{'success':![],'error':_0x2787(0x5),'status':0x0};return _0xb2aca6[_0x2787(0x22)](_0x2787(0x23)+_0x55eaa0+'\x20failed:',_0x2f8d55),{'success':![],'error':_0x5c634b['ZJzqe'](_0x38739c,_0x2b840f)?_0x15f10f[_0x2787(0x25)]:_0x5c634b[_0x2787(0x4e)],'status':0x0};}else console[_0x2787(0x13)](_0x5c634b[_0x2787(0x4f)]),await this[_0x2787(0x2)][_0x2787(0x47)]();}else console[_0x2787(0x44)](_0x2787(0x50));break;case TokenType[_0x2787(0x51)]:this[_0x2787(0x2)][_0x2787(0x52)]?(console[_0x2787(0x13)](_0x2787(0x53)),await this[_0x2787(0x2)][_0x2787(0x52)]()):console['warn'](_0x5c634b[_0x2787(0x54)]);break;}}catch(_0x333782){'OKhxr'!==_0x5c634b['HLYYq']?console['error'](_0x2787(0x55)+_0x45c71f+':',_0x333782):_0x1533b1[_0x2787(0x13)](_0x2787(0x56)+_0x192069+_0x2787(0x57));}}[_0x2787(0x58)](_0x217dca,_0x54e4e0){const _0x23e5ed={'fwxjJ':function(_0x21d97c,_0x2c68ae){return _0x21d97c>_0x2c68ae;},'VcdZb':function(_0x1fdb7a,_0x5ca771){return _0x1fdb7a===_0x5ca771;},'nukqp':_0x2787(0x59)};let _0x38d3de=0x0;for(const [_0x59a7a4,_0x5ff84d]of activeRequests[_0x2787(0x5a)]()){_0x59a7a4!==_0x54e4e0&&(_0x5ff84d[_0x2787(0x1e)](),activeRequests[_0x2787(0x1a)](_0x59a7a4),_0x38d3de++);}if(_0x23e5ed['fwxjJ'](_0x38d3de,0x0)){if(_0x23e5ed[_0x2787(0x5b)](_0x23e5ed[_0x2787(0x5c)],_0x23e5ed['nukqp']))console[_0x2787(0x13)](_0x2787(0x5d)+_0x38d3de+'\x20requests\x20due\x20to\x20'+_0x217dca+_0x2787(0x5e));else{const _0x5d197b=_0x1b6564(_0x28057e);throw new _0x331ea3(_0x2787(0x2d)+_0x5d197b+_0x2787(0x2e)+_0x3be87e+_0x2787(0x2f));}}}async['replaceTokenForType'](_0x1046a9,_0xdb0d03){console[_0x2787(0x13)](_0x2787(0x5f)+_0x1046a9+_0x2787(0xb)),this[_0x2787(0x58)](_0x1046a9);const _0xbcd0c5=await replaceJWTAfterVerification(_0x1046a9,_0xdb0d03);return _0xbcd0c5&&console[_0x2787(0x13)](_0x2787(0x60)+_0x1046a9+_0x2787(0x61)),_0xbcd0c5;}async[_0x2787(0x62)](){const _0x253173={'enzvg':_0x2787(0x63)};console[_0x2787(0x13)](_0x2787(0x64));const _0x11e017=await getAllTokens();for(const [_0x50fd41,_0x79d069]of Object[_0x2787(0x5a)](_0x11e017)){if(_0x253173[_0x2787(0x65)]===_0x253173[_0x2787(0x65)])_0x79d069?console['log'](_0x2787(0x66)+_0x50fd41+':\x20'+_0x79d069[_0x2787(0x67)](0x0,0x14)+_0x2787(0x68)+_0x79d069[_0x2787(0x69)]+')'):console[_0x2787(0x13)](_0x2787(0x56)+_0x50fd41+_0x2787(0x57));else return{};}return _0x11e017;}[_0x2787(0x6a)](_0x5be3bb){this['authTriggers']={...this[_0x2787(0x2)],..._0x5be3bb},console[_0x2787(0x13)]('🔧\x20[API\x20Client]\x20Authentication\x20triggers\x20updated');}async[_0x2787(0x6b)](_0x3a39bd,_0x4b300c={}){return this['request'](_0x3a39bd,{..._0x4b300c,'method':'GET'});}async[_0x2787(0x6c)](_0x59a35c,_0x3cf3c9,_0x16fcd2={}){return this[_0x2787(0x3)](_0x59a35c,{..._0x16fcd2,'method':'POST','body':_0x3cf3c9});}async[_0x2787(0x6d)](_0x5873e5,_0x2ae61c,_0x749179={}){return this[_0x2787(0x3)](_0x5873e5,{..._0x749179,'method':'PUT','body':_0x2ae61c});}async[_0x2787(0x1a)](_0x22c596,_0x24ac87={}){return this[_0x2787(0x3)](_0x22c596,{..._0x24ac87,'method':'DELETE'});}}export const apiClient=new ApiClient();export{ApiClient};function _0x3a58(){const _0x19790a=['BASE_URL','baseUrl','authTriggers','request','AvJqQ','Request\x20cancelled','Unknown\x20error','set','🔗\x20[API\x20Client]\x20Starting\x20request\x20','\x20to:\x20','🎯\x20[API\x20Client]\x20Route\x20','\x20token','Tvpnn','method','OnairosSDK/1.0.0','headers','body','stringify','signal','log','\x20using\x20','rMlAe','\x20status:','status','handle401Error','json','delete','Request\x20failed\x20with\x20status\x20','ozFAn','RuGwr','abort','sjedh','AkOVX','ozFOD','error','❌\x20[API\x20Client]\x20Request\x20','\x20failed:','message','EYWGU','getRequestHeaders','⚠️\x20[API\x20Client]\x20No\x20auth\x20token\x20refresh\x20trigger\x20configured','IMUsE','Xnzkj','Lbtjk','uKFmF','No\x20','\x20token\x20available\x20for\x20route\x20','.\x20Please\x20authenticate\x20first.','4|5|6|1|2|0|3','split','🔑\x20[API\x20Client]\x20','\x20token\x20cleared,\x20user\x20needs\x20to\x20re-authenticate','triggerReAuthForTokenType','\x20authentication\x20expired\x20for\x20','.\x20Please\x20re-authenticate.','🔄\x20[API\x20Client]\x20Clearing\x20','AbortError','mJjPx','⚠️\x20[API\x20Client]\x20No\x20Enoch\x20re-auth\x20trigger\x20configured','VeQSn','YmWju','🔑\x20[API\x20Client]\x20Triggering\x20Onairos\x20re-authentication','pbasr','dtvbr','PKhvC','ENOCH','triggerEnochReAuth','📧\x20[API\x20Client]\x20Triggering\x20Enoch\x20email\x20re-verification','warn','NrcGL','ONAIROS','triggerOnairosReAuth','iVDvJ','aopwp','name','CIelZ','🚫\x20[API\x20Client]\x20Request\x20','\x20was\x20cancelled','KKFkq','lkYSs','⚠️\x20[API\x20Client]\x20No\x20Onairos\x20re-auth\x20trigger\x20configured','AUTH','triggerAuthTokenRefresh','🔄\x20[API\x20Client]\x20Triggering\x20auth\x20token\x20refresh','cTIvq','❌\x20[API\x20Client]\x20Failed\x20to\x20trigger\x20re-auth\x20for\x20','📭\x20',':\x20null','cancelRequestsForTokenType','MhwmX','entries','VcdZb','nukqp','🚫\x20[API\x20Client]\x20Cancelled\x20','\x20token\x20failure','🔄\x20[API\x20Client]\x20Replacing\x20','✅\x20[API\x20Client]\x20','\x20token\x20replaced\x20and\x20related\x20requests\x20cancelled','debugTokens','ruTCb','🔍\x20[API\x20Client]\x20Debug:\x20Current\x20token\x20status','enzvg','🔐\x20','substring','...\x20(length:\x20','length','setAuthTriggers','get','post','put','bind'];_0x3a58=function(){return _0x19790a;};return _0x3a58();}export const authenticatedRequest=apiClient[_0x2787(0x3)][_0x2787(0x6e)](apiClient);export const apiGet=apiClient['get'][_0x2787(0x6e)](apiClient);export const apiPost=apiClient[_0x2787(0x6c)][_0x2787(0x6e)](apiClient);export const apiPut=apiClient[_0x2787(0x6d)][_0x2787(0x6e)](apiClient);export const apiDelete=apiClient[_0x2787(0x1a)]['bind'](apiClient);export default apiClient;
|
|
1
|
+
function _0xc426(_0x585fa8,_0xc426c9){_0x585fa8=_0x585fa8-0x0;const _0x56f6cc=_0x585f();let _0x50cc37=_0x56f6cc[_0x585fa8];return _0x50cc37;}import{getJWTForRoute,TokenType,getTokenTypeForRoute,clearJWT,getAllTokens,replaceJWTAfterVerification}from'./jwtStorageService';function _0x585f(){const _0x584063=['BASE_URL','baseUrl','authTriggers','request','Request\x20cancelled','Unknown\x20error','set','log','🔗\x20[API\x20Client]\x20Starting\x20request\x20','\x20to:\x20','Ggewl','🎯\x20[API\x20Client]\x20Route\x20','\x20token','getRequestHeaders','xINYd','requiresAuth','OnairosSDK/1.0.0','headers','body','signal','🔐\x20[API\x20Client]\x20Request\x20','\x20using\x20','\x20status:','status','FJpje','delete','JEgKT','OjaNP','dGFmc','✅\x20[API\x20Client]\x20','\x20token\x20replaced\x20and\x20related\x20requests\x20cancelled','message','qruls','name','AbortError','\x20was\x20cancelled','dLoWg','error','❌\x20[API\x20Client]\x20Request\x20','eexYw','No\x20','.\x20Please\x20authenticate\x20first.','handle401Error','3|5|2|0|4|1|6','HePEg','split','cancelRequestsForTokenType','🚫\x20[API\x20Client]\x20Request\x20','\x20received\x20401\x20for\x20','\x20token\x20on\x20route:\x20','🔄\x20[API\x20Client]\x20Clearing\x20','\x20token\x20due\x20to\x20401\x20error','\x20authentication\x20expired\x20for\x20','.\x20Please\x20re-authenticate.','triggerReAuthForTokenType','📧\x20[API\x20Client]\x20Triggering\x20Enoch\x20email\x20re-verification','PoYIC','🔄\x20[API\x20Client]\x20Triggering\x20auth\x20token\x20refresh','vueKw','yjdMi','🔄\x20[API\x20Client]\x20Triggering\x20re-auth\x20for\x20','triggerEnochReAuth','NORYr','warn','aklkJ','ONAIROS','MUIqo','⚠️\x20[API\x20Client]\x20No\x20Onairos\x20re-auth\x20trigger\x20configured','substring','length','AUTH','triggerAuthTokenRefresh','zsXCD','ENBBy','FvJYS','hYAmL','wPEUs','TWIZg','nnkir','MKSUL','⚠️\x20[API\x20Client]\x20No\x20auth\x20token\x20refresh\x20trigger\x20configured','yTLPy','YYNsI','❌\x20[API\x20Client]\x20Failed\x20to\x20trigger\x20re-auth\x20for\x20','🔧\x20[API\x20Client]\x20Authentication\x20triggers\x20updated','oiiNp','entries','dFXhh','pITDl','Request\x20failed\x20with\x20status\x20','ygMzo','frxct','🔄\x20[API\x20Client]\x20Replacing\x20','debugTokens','🔍\x20[API\x20Client]\x20Debug:\x20Current\x20token\x20status','ckNjX','ivUtF','rxxPB','uFnYY','LwsOd','VJlrH','🔐\x20','...\x20(length:\x20','📭\x20',':\x20null','nUxxv','ySMli','setAuthTriggers','VbCis','get','post','bind','put'];_0x585f=function(){return _0x584063;};return _0x585f();}import{API_CONFIG}from'../config/api';let currentRequestId=0x0;const activeRequests=new Map();class ApiClient{constructor(_0x57d577=API_CONFIG[_0xc426(0x0)],_0x11192e={}){this[_0xc426(0x1)]=_0x57d577,this[_0xc426(0x2)]=_0x11192e;}async[_0xc426(0x3)](_0x8d25fe,_0x8e16b1={}){const _0x6beb30={'Ggewl':function(_0x2be1e9,_0x4f83ad){return _0x2be1e9(_0x4f83ad);},'xINYd':function(_0x5ddd1f,_0x41421d){return _0x5ddd1f!==_0x41421d;},'HzqOt':function(_0x2ac7a5,_0x1698ec,_0x292e00){return _0x2ac7a5(_0x1698ec,_0x292e00);},'FJpje':function(_0x3eb414,_0x3e49d7){return _0x3eb414===_0x3e49d7;},'JEgKT':function(_0xafba79,_0x3266b7){return _0xafba79===_0x3266b7;},'qruls':function(_0x379d80,_0x581463){return _0x379d80 instanceof _0x581463;},'dLoWg':_0xc426(0x4),'eexYw':_0xc426(0x5)},_0x48cb94=++currentRequestId,_0x2fdb49=new AbortController();activeRequests[_0xc426(0x6)](_0x48cb94,_0x2fdb49);try{console[_0xc426(0x7)](_0xc426(0x8)+_0x48cb94+_0xc426(0x9)+_0x8d25fe);const _0x5dab15=_0x6beb30[_0xc426(0xa)](getTokenTypeForRoute,_0x8d25fe);console['log'](_0xc426(0xb)+_0x8d25fe+'\x20requires\x20'+_0x5dab15+_0xc426(0xc));const _0x12c957=await this[_0xc426(0xd)](_0x8d25fe,_0x6beb30[_0xc426(0xe)](_0x8e16b1[_0xc426(0xf)],![])),_0x17032c={'method':_0x8e16b1['method']||'GET','headers':{'Content-Type':'application/json','User-Agent':_0xc426(0x10),..._0x12c957,..._0x8e16b1[_0xc426(0x11)]},'body':_0x8e16b1['body']?JSON['stringify'](_0x8e16b1[_0xc426(0x12)]):undefined,'signal':_0x2fdb49[_0xc426(0x13)]};console[_0xc426(0x7)](_0xc426(0x14)+_0x48cb94+_0xc426(0x15)+_0x5dab15+_0xc426(0xc));const _0x1739ed=await _0x6beb30['HzqOt'](fetch,''+this[_0xc426(0x1)]+_0x8d25fe,_0x17032c);console[_0xc426(0x7)]('📡\x20[API\x20Client]\x20Response\x20'+_0x48cb94+_0xc426(0x16),_0x1739ed[_0xc426(0x17)]);if(_0x6beb30[_0xc426(0x18)](_0x1739ed[_0xc426(0x17)],0x191))return await this['handle401Error'](_0x48cb94,_0x8d25fe,_0x5dab15,_0x8e16b1);const _0x33d809=await _0x1739ed['json']();activeRequests[_0xc426(0x19)](_0x48cb94);if(!_0x1739ed['ok']){if(_0x6beb30[_0xc426(0x1a)](_0xc426(0x1b),_0xc426(0x1c)))_0x4b56e5[_0xc426(0x7)](_0xc426(0x1d)+_0x2065a8+_0xc426(0x1e));else return{'success':![],'error':_0x33d809[_0xc426(0x1f)]||'Request\x20failed\x20with\x20status\x20'+_0x1739ed[_0xc426(0x17)],'status':_0x1739ed[_0xc426(0x17)],'tokenType':_0x5dab15};}return{'success':!![],'data':_0x33d809,'status':_0x1739ed[_0xc426(0x17)],'tokenType':_0x5dab15};}catch(_0x315ae3){activeRequests[_0xc426(0x19)](_0x48cb94);if(_0x6beb30[_0xc426(0x20)](_0x315ae3,Error)&&_0x6beb30[_0xc426(0x1a)](_0x315ae3[_0xc426(0x21)],_0xc426(0x22)))return console[_0xc426(0x7)]('🚫\x20[API\x20Client]\x20Request\x20'+_0x48cb94+_0xc426(0x23)),{'success':![],'error':_0x6beb30[_0xc426(0x24)],'status':0x0};return console[_0xc426(0x25)](_0xc426(0x26)+_0x48cb94+'\x20failed:',_0x315ae3),{'success':![],'error':_0x6beb30[_0xc426(0x20)](_0x315ae3,Error)?_0x315ae3[_0xc426(0x1f)]:_0x6beb30[_0xc426(0x27)],'status':0x0};}}async['getRequestHeaders'](_0x4238c5,_0x1ab79f){const _0x12f24d={'bhsXl':function(_0x36858d,_0x136f52){return _0x36858d(_0x136f52);}};if(!_0x1ab79f)return{};const _0x335735=await _0x12f24d['bhsXl'](getJWTForRoute,_0x4238c5);if(!_0x335735){const _0x7e0e3d=getTokenTypeForRoute(_0x4238c5);throw new Error(_0xc426(0x28)+_0x7e0e3d+'\x20token\x20available\x20for\x20route\x20'+_0x4238c5+_0xc426(0x29));}return{'Authorization':_0x335735};}async[_0xc426(0x2a)](_0x5ae0d8,_0x4cf149,_0x5c68dc,_0x208cd8){const _0x1fd099={'HePEg':_0xc426(0x2b)},_0x9d0562=_0x1fd099[_0xc426(0x2c)][_0xc426(0x2d)]('|');let _0x24f625=0x0;while(!![]){switch(_0x9d0562[_0x24f625++]){case'0':this[_0xc426(0x2e)](_0x5c68dc,_0x5ae0d8);continue;case'1':console['log']('🔑\x20[API\x20Client]\x20'+_0x5c68dc+'\x20token\x20cleared,\x20user\x20needs\x20to\x20re-authenticate');continue;case'2':await clearJWT(_0x5c68dc);continue;case'3':console[_0xc426(0x25)](_0xc426(0x2f)+_0x5ae0d8+_0xc426(0x30)+_0x5c68dc+_0xc426(0x31)+_0x4cf149);continue;case'4':await this['triggerReAuthForTokenType'](_0x5c68dc,_0x4cf149);continue;case'5':console[_0xc426(0x7)](_0xc426(0x32)+_0x5c68dc+_0xc426(0x33));continue;case'6':return{'success':![],'error':_0x5c68dc+_0xc426(0x34)+_0x4cf149+_0xc426(0x35),'status':0x191,'tokenType':_0x5c68dc};}break;}}async[_0xc426(0x36)](_0x4b8cb7,_0x4860af){const _0x31a59b={'lSyPm':function(_0x1ada51,_0x58fbad){return _0x1ada51 instanceof _0x58fbad;},'FvJYS':function(_0x526634,_0xa5ae2c){return _0x526634===_0xa5ae2c;},'AyjwU':_0xc426(0x22),'hYAmL':'Request\x20cancelled','wPEUs':function(_0x2069ad,_0x350767){return _0x2069ad instanceof _0x350767;},'xyQvF':_0xc426(0x5),'NORYr':_0xc426(0x37),'aklkJ':'⚠️\x20[API\x20Client]\x20No\x20Enoch\x20re-auth\x20trigger\x20configured','nnkir':function(_0x77d390,_0x109e37){return _0x77d390===_0x109e37;},'MUIqo':_0xc426(0x38),'ENBBy':'TrCbH','TWIZg':_0xc426(0x39),'MKSUL':_0xc426(0x3a),'yTLPy':function(_0x1c77e8,_0x2a3c6a){return _0x1c77e8!==_0x2a3c6a;},'YYNsI':_0xc426(0x3b)};console[_0xc426(0x7)](_0xc426(0x3c)+_0x4b8cb7+'\x20token\x20(endpoint:\x20'+_0x4860af+')');try{switch(_0x4b8cb7){case TokenType['ENOCH']:this[_0xc426(0x2)][_0xc426(0x3d)]?(console[_0xc426(0x7)](_0x31a59b[_0xc426(0x3e)]),await this[_0xc426(0x2)]['triggerEnochReAuth']()):console[_0xc426(0x3f)](_0x31a59b[_0xc426(0x40)]);break;case TokenType[_0xc426(0x41)]:this[_0xc426(0x2)]['triggerOnairosReAuth']?(console['log']('🔑\x20[API\x20Client]\x20Triggering\x20Onairos\x20re-authentication'),await this[_0xc426(0x2)]['triggerOnairosReAuth']()):_0x31a59b['nnkir'](_0x31a59b['MUIqo'],_0x31a59b[_0xc426(0x42)])?console[_0xc426(0x3f)](_0xc426(0x43)):_0x29946d[_0xc426(0x7)]('🔐\x20'+_0x51770c+':\x20'+_0x317ee4[_0xc426(0x44)](0x0,0x14)+'...\x20(length:\x20'+_0x57b2bd[_0xc426(0x45)]+')');break;case TokenType[_0xc426(0x46)]:if(this[_0xc426(0x2)][_0xc426(0x47)]){if(_0x31a59b['nnkir'](_0xc426(0x48),_0x31a59b[_0xc426(0x49)])){_0x2e6462[_0xc426(0x19)](_0x3ba169);if(_0x31a59b['lSyPm'](_0x35356b,_0x35d0b4)&&_0x31a59b[_0xc426(0x4a)](_0x5706e5[_0xc426(0x21)],_0x31a59b['AyjwU']))return _0x14e437['log'](_0xc426(0x2f)+_0x36e47e+_0xc426(0x23)),{'success':![],'error':_0x31a59b[_0xc426(0x4b)],'status':0x0};return _0x1d7f5e[_0xc426(0x25)](_0xc426(0x26)+_0x4e3c13+'\x20failed:',_0x72ed60),{'success':![],'error':_0x31a59b[_0xc426(0x4c)](_0xbc4d4d,_0x366cb0)?_0xfa8ac8[_0xc426(0x1f)]:_0x31a59b['xyQvF'],'status':0x0};}else console[_0xc426(0x7)](_0x31a59b[_0xc426(0x4d)]),await this['authTriggers'][_0xc426(0x47)]();}else{if(_0x31a59b[_0xc426(0x4e)]('vueKw',_0x31a59b[_0xc426(0x4f)]))console[_0xc426(0x3f)](_0xc426(0x50));else return this[_0xc426(0x3)](_0x5be1eb,{..._0x1036aa,'method':'POST','body':_0x161810});}break;}}catch(_0x31c8a9){if(_0x31a59b[_0xc426(0x51)](_0x31a59b[_0xc426(0x52)],_0x31a59b[_0xc426(0x52)]))return _0xa5ca2b['log'](_0xc426(0x2f)+_0x2882ec+_0xc426(0x23)),{'success':![],'error':_0x31a59b[_0xc426(0x4b)],'status':0x0};else console[_0xc426(0x25)](_0xc426(0x53)+_0x4b8cb7+':',_0x31c8a9);}}[_0xc426(0x2e)](_0x52a60b,_0x24b218){const _0x29e6ed={'frxct':_0xc426(0x54),'dFXhh':function(_0x5ac541,_0x3da09e){return _0x5ac541!==_0x3da09e;},'pITDl':'QiwEk','ygMzo':_0xc426(0x55)};let _0xbd8488=0x0;for(const [_0x34990e,_0x3ea1a2]of activeRequests[_0xc426(0x56)]()){if(_0x29e6ed[_0xc426(0x57)]('JHJYc',_0x29e6ed[_0xc426(0x58)]))_0x34990e!==_0x24b218&&(_0x3ea1a2['abort'](),activeRequests[_0xc426(0x19)](_0x34990e),_0xbd8488++);else return{'success':![],'error':_0x5cf42e[_0xc426(0x1f)]||_0xc426(0x59)+_0x3756a0[_0xc426(0x17)],'status':_0x525c82[_0xc426(0x17)],'tokenType':_0x21ddea};}_0xbd8488>0x0&&(_0xc426(0x55)!==_0x29e6ed[_0xc426(0x5a)]?(this[_0xc426(0x2)]={...this[_0xc426(0x2)],..._0x4b4852},_0x74e7c3['log'](_0x29e6ed[_0xc426(0x5b)])):console['log']('🚫\x20[API\x20Client]\x20Cancelled\x20'+_0xbd8488+'\x20requests\x20due\x20to\x20'+_0x52a60b+'\x20token\x20failure'));}async['replaceTokenForType'](_0x2d43a2,_0x4a4b65){console['log'](_0xc426(0x5c)+_0x2d43a2+'\x20token'),this[_0xc426(0x2e)](_0x2d43a2);const _0x3f8495=await replaceJWTAfterVerification(_0x2d43a2,_0x4a4b65);return _0x3f8495&&console[_0xc426(0x7)](_0xc426(0x1d)+_0x2d43a2+'\x20token\x20replaced\x20and\x20related\x20requests\x20cancelled'),_0x3f8495;}async[_0xc426(0x5d)](){const _0x45ef6b={'ySMli':function(_0x328846,_0x10ab37){return _0x328846!==_0x10ab37;},'qKdVF':_0xc426(0x5e),'LwsOd':function(_0x4a078d,_0x2bb4b1){return _0x4a078d===_0x2bb4b1;},'YwvzX':_0xc426(0x5f),'VJlrH':_0xc426(0x60),'nUxxv':_0xc426(0x61),'KiFGY':_0xc426(0x62)};console['log'](_0x45ef6b['qKdVF']);const _0x4a420c=await getAllTokens();for(const [_0x3ddc1e,_0x546527]of Object['entries'](_0x4a420c)){_0x45ef6b[_0xc426(0x63)](_0x45ef6b['YwvzX'],_0x45ef6b[_0xc426(0x64)])?_0x767dd8?_0x1347a1[_0xc426(0x7)](_0xc426(0x65)+_0x4912ec+':\x20'+_0x4f77e0[_0xc426(0x44)](0x0,0x14)+_0xc426(0x66)+_0x4b7820[_0xc426(0x45)]+')'):_0x42d738[_0xc426(0x7)](_0xc426(0x67)+_0x17471b+_0xc426(0x68)):_0x546527?_0x45ef6b[_0xc426(0x69)]!==_0x45ef6b['KiFGY']?console[_0xc426(0x7)](_0xc426(0x65)+_0x3ddc1e+':\x20'+_0x546527['substring'](0x0,0x14)+_0xc426(0x66)+_0x546527[_0xc426(0x45)]+')'):_0x45ef6b[_0xc426(0x6a)](_0x10c6e3,_0x412e8f)&&(_0x450911['abort'](),_0x2c2a51['delete'](_0x2fbf23),_0xd4eaee++):console['log'](_0xc426(0x67)+_0x3ddc1e+_0xc426(0x68));}return _0x4a420c;}[_0xc426(0x6b)](_0x230b96){const _0xbc8fc4={'VbCis':_0xc426(0x54)};this[_0xc426(0x2)]={...this['authTriggers'],..._0x230b96},console[_0xc426(0x7)](_0xbc8fc4[_0xc426(0x6c)]);}async[_0xc426(0x6d)](_0x18ca57,_0x3befde={}){return this[_0xc426(0x3)](_0x18ca57,{..._0x3befde,'method':'GET'});}async[_0xc426(0x6e)](_0x15e9e8,_0x10baa0,_0x576113={}){return this['request'](_0x15e9e8,{..._0x576113,'method':'POST','body':_0x10baa0});}async['put'](_0x5041bc,_0xfd8d41,_0x39d269={}){return this[_0xc426(0x3)](_0x5041bc,{..._0x39d269,'method':'PUT','body':_0xfd8d41});}async[_0xc426(0x19)](_0x33fab6,_0x3fac9b={}){return this[_0xc426(0x3)](_0x33fab6,{..._0x3fac9b,'method':'DELETE'});}}export const apiClient=new ApiClient();export{ApiClient};export const authenticatedRequest=apiClient[_0xc426(0x3)][_0xc426(0x6f)](apiClient);export const apiGet=apiClient['get'][_0xc426(0x6f)](apiClient);export const apiPost=apiClient['post'][_0xc426(0x6f)](apiClient);export const apiPut=apiClient[_0xc426(0x70)][_0xc426(0x6f)](apiClient);export const apiDelete=apiClient[_0xc426(0x19)][_0xc426(0x6f)](apiClient);export default apiClient;
|
|
@@ -12,23 +12,23 @@ export let ApiKeyType = /*#__PURE__*/function (ApiKeyType) {
|
|
|
12
12
|
// JWT token storage key
|
|
13
13
|
const JWT_TOKEN_KEY = 'onairos_jwt_token';
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* Two-Tier Authentication Service for Onairos React Native SDK
|
|
17
|
-
*
|
|
18
|
-
* This service implements the two-tier authentication system:
|
|
19
|
-
* 1. Developer API Keys: For app-level operations (email verification, app registration)
|
|
20
|
-
* 2. JWT User Tokens: For user-level operations (PIN storage, user profile)
|
|
21
|
-
*
|
|
22
|
-
* How it works:
|
|
23
|
-
* 1. Initialize with developer API key
|
|
24
|
-
* 2. Use API key for email verification requests
|
|
25
|
-
* 3. Store JWT token from email verification response
|
|
26
|
-
* 4. Use JWT token for user-authenticated requests
|
|
27
|
-
* 5. Handle token expiration gracefully
|
|
28
|
-
*
|
|
29
|
-
* Backend Integration:
|
|
30
|
-
* - Developer routes: Authorization: Bearer ${API_KEY}
|
|
31
|
-
* - User routes: Authorization: Bearer ${JWT_TOKEN}
|
|
15
|
+
/**
|
|
16
|
+
* Two-Tier Authentication Service for Onairos React Native SDK
|
|
17
|
+
*
|
|
18
|
+
* This service implements the two-tier authentication system:
|
|
19
|
+
* 1. Developer API Keys: For app-level operations (email verification, app registration)
|
|
20
|
+
* 2. JWT User Tokens: For user-level operations (PIN storage, user profile)
|
|
21
|
+
*
|
|
22
|
+
* How it works:
|
|
23
|
+
* 1. Initialize with developer API key
|
|
24
|
+
* 2. Use API key for email verification requests
|
|
25
|
+
* 3. Store JWT token from email verification response
|
|
26
|
+
* 4. Use JWT token for user-authenticated requests
|
|
27
|
+
* 5. Handle token expiration gracefully
|
|
28
|
+
*
|
|
29
|
+
* Backend Integration:
|
|
30
|
+
* - Developer routes: Authorization: Bearer ${API_KEY}
|
|
31
|
+
* - User routes: Authorization: Bearer ${JWT_TOKEN}
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
// Global configuration state
|
|
@@ -40,9 +40,9 @@ let userToken = null;
|
|
|
40
40
|
// Cache duration (5 minutes)
|
|
41
41
|
const CACHE_DURATION = 5 * 60 * 1000;
|
|
42
42
|
|
|
43
|
-
/**
|
|
44
|
-
* Check network connectivity
|
|
45
|
-
* @returns Promise<boolean> - true if connected, false otherwise
|
|
43
|
+
/**
|
|
44
|
+
* Check network connectivity
|
|
45
|
+
* @returns Promise<boolean> - true if connected, false otherwise
|
|
46
46
|
*/
|
|
47
47
|
const checkNetworkConnectivity = async () => {
|
|
48
48
|
try {
|
|
@@ -63,9 +63,9 @@ const API_ENDPOINTS = {
|
|
|
63
63
|
development: `${API_CONFIG.BASE_URL}` // Fallback to production since dev-API server doesn't exist
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
/**
|
|
67
|
-
* Initialize the SDK with developer API key
|
|
68
|
-
* @param config API configuration including developer API key
|
|
66
|
+
/**
|
|
67
|
+
* Initialize the SDK with developer API key
|
|
68
|
+
* @param config API configuration including developer API key
|
|
69
69
|
*/
|
|
70
70
|
export const initializeApiKey = async config => {
|
|
71
71
|
try {
|
|
@@ -150,10 +150,10 @@ export const initializeApiKey = async config => {
|
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
152
|
|
|
153
|
-
/**
|
|
154
|
-
* Determine API key type
|
|
155
|
-
* @param apiKey The API key to check
|
|
156
|
-
* @returns The type of API key (only DEVELOPER or INVALID - admin keys not supported in client SDK)
|
|
153
|
+
/**
|
|
154
|
+
* Determine API key type
|
|
155
|
+
* @param apiKey The API key to check
|
|
156
|
+
* @returns The type of API key (only DEVELOPER or INVALID - admin keys not supported in client SDK)
|
|
157
157
|
*/
|
|
158
158
|
export const getApiKeyType = apiKey => {
|
|
159
159
|
// Developer keys must be at least 32 characters and start with specific prefix
|
|
@@ -163,11 +163,11 @@ export const getApiKeyType = apiKey => {
|
|
|
163
163
|
return ApiKeyType.INVALID;
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
-
/**
|
|
167
|
-
* Validate an API key with the Onairos backend
|
|
168
|
-
* All developer keys must be validated against the backend - no local bypass
|
|
169
|
-
* @param apiKey The API key to validate
|
|
170
|
-
* @returns Validation result with permissions and rate limits
|
|
166
|
+
/**
|
|
167
|
+
* Validate an API key with the Onairos backend
|
|
168
|
+
* All developer keys must be validated against the backend - no local bypass
|
|
169
|
+
* @param apiKey The API key to validate
|
|
170
|
+
* @returns Validation result with permissions and rate limits
|
|
171
171
|
*/
|
|
172
172
|
export const validateApiKey = async apiKey => {
|
|
173
173
|
try {
|
|
@@ -418,34 +418,34 @@ export const validateApiKey = async apiKey => {
|
|
|
418
418
|
}
|
|
419
419
|
};
|
|
420
420
|
|
|
421
|
-
/**
|
|
422
|
-
* Get the current API configuration
|
|
423
|
-
* @returns Current API configuration or null if not initialized
|
|
421
|
+
/**
|
|
422
|
+
* Get the current API configuration
|
|
423
|
+
* @returns Current API configuration or null if not initialized
|
|
424
424
|
*/
|
|
425
425
|
export const getApiConfig = () => {
|
|
426
426
|
return globalConfig;
|
|
427
427
|
};
|
|
428
428
|
|
|
429
|
-
/**
|
|
430
|
-
* Get the current API key
|
|
431
|
-
* @returns Current API key or null if not initialized
|
|
429
|
+
/**
|
|
430
|
+
* Get the current API key
|
|
431
|
+
* @returns Current API key or null if not initialized
|
|
432
432
|
*/
|
|
433
433
|
export const getApiKey = () => {
|
|
434
434
|
var _globalConfig9;
|
|
435
435
|
return ((_globalConfig9 = globalConfig) === null || _globalConfig9 === void 0 ? void 0 : _globalConfig9.apiKey) || null;
|
|
436
436
|
};
|
|
437
437
|
|
|
438
|
-
/**
|
|
439
|
-
* Check if the SDK is properly initialized
|
|
440
|
-
* @returns True if initialized with valid API key
|
|
438
|
+
/**
|
|
439
|
+
* Check if the SDK is properly initialized
|
|
440
|
+
* @returns True if initialized with valid API key
|
|
441
441
|
*/
|
|
442
442
|
export const isApiKeyInitialized = () => {
|
|
443
443
|
return isInitialized && globalConfig !== null;
|
|
444
444
|
};
|
|
445
445
|
|
|
446
|
-
/**
|
|
447
|
-
* Store JWT token securely after email verification
|
|
448
|
-
* @param token JWT token from email verification response
|
|
446
|
+
/**
|
|
447
|
+
* Store JWT token securely after email verification
|
|
448
|
+
* @param token JWT token from email verification response
|
|
449
449
|
*/
|
|
450
450
|
export const storeJWT = async token => {
|
|
451
451
|
try {
|
|
@@ -461,9 +461,9 @@ export const storeJWT = async token => {
|
|
|
461
461
|
}
|
|
462
462
|
};
|
|
463
463
|
|
|
464
|
-
/**
|
|
465
|
-
* Load JWT token from storage
|
|
466
|
-
* @returns JWT token or null if not found
|
|
464
|
+
/**
|
|
465
|
+
* Load JWT token from storage
|
|
466
|
+
* @returns JWT token or null if not found
|
|
467
467
|
*/
|
|
468
468
|
export const loadJWT = async () => {
|
|
469
469
|
try {
|
|
@@ -476,16 +476,16 @@ export const loadJWT = async () => {
|
|
|
476
476
|
}
|
|
477
477
|
};
|
|
478
478
|
|
|
479
|
-
/**
|
|
480
|
-
* Get current JWT token
|
|
481
|
-
* @returns JWT token or null if not available
|
|
479
|
+
/**
|
|
480
|
+
* Get current JWT token
|
|
481
|
+
* @returns JWT token or null if not available
|
|
482
482
|
*/
|
|
483
483
|
export const getJWT = () => {
|
|
484
484
|
return userToken;
|
|
485
485
|
};
|
|
486
486
|
|
|
487
|
-
/**
|
|
488
|
-
* Clear JWT token (on logout or token expiration)
|
|
487
|
+
/**
|
|
488
|
+
* Clear JWT token (on logout or token expiration)
|
|
489
489
|
*/
|
|
490
490
|
export const clearJWT = async () => {
|
|
491
491
|
try {
|
|
@@ -500,10 +500,10 @@ export const clearJWT = async () => {
|
|
|
500
500
|
}
|
|
501
501
|
};
|
|
502
502
|
|
|
503
|
-
/**
|
|
504
|
-
* React Native compatible base64 decoder
|
|
505
|
-
* @param str Base64 encoded string
|
|
506
|
-
* @returns Decoded string
|
|
503
|
+
/**
|
|
504
|
+
* React Native compatible base64 decoder
|
|
505
|
+
* @param str Base64 encoded string
|
|
506
|
+
* @returns Decoded string
|
|
507
507
|
*/
|
|
508
508
|
const base64Decode = str => {
|
|
509
509
|
// Simple base64 decoding for React Native
|
|
@@ -524,10 +524,10 @@ const base64Decode = str => {
|
|
|
524
524
|
return result;
|
|
525
525
|
};
|
|
526
526
|
|
|
527
|
-
/**
|
|
528
|
-
* Decode JWT token payload (React Native compatible)
|
|
529
|
-
* @param token JWT token string
|
|
530
|
-
* @returns Decoded payload or null if invalid
|
|
527
|
+
/**
|
|
528
|
+
* Decode JWT token payload (React Native compatible)
|
|
529
|
+
* @param token JWT token string
|
|
530
|
+
* @returns Decoded payload or null if invalid
|
|
531
531
|
*/
|
|
532
532
|
export const decodeJWTPayload = token => {
|
|
533
533
|
try {
|
|
@@ -554,10 +554,10 @@ export const decodeJWTPayload = token => {
|
|
|
554
554
|
}
|
|
555
555
|
};
|
|
556
556
|
|
|
557
|
-
/**
|
|
558
|
-
* Extract username from JWT token
|
|
559
|
-
* @param token JWT token (optional, uses stored token if not provided)
|
|
560
|
-
* @returns Username or null if not found
|
|
557
|
+
/**
|
|
558
|
+
* Extract username from JWT token
|
|
559
|
+
* @param token JWT token (optional, uses stored token if not provided)
|
|
560
|
+
* @returns Username or null if not found
|
|
561
561
|
*/
|
|
562
562
|
export const extractUsernameFromJWT = token => {
|
|
563
563
|
try {
|
|
@@ -584,10 +584,10 @@ export const extractUsernameFromJWT = token => {
|
|
|
584
584
|
}
|
|
585
585
|
};
|
|
586
586
|
|
|
587
|
-
/**
|
|
588
|
-
* Extract user data from JWT token
|
|
589
|
-
* @param token JWT token (optional, uses stored token if not provided)
|
|
590
|
-
* @returns User data object or null if not found
|
|
587
|
+
/**
|
|
588
|
+
* Extract user data from JWT token
|
|
589
|
+
* @param token JWT token (optional, uses stored token if not provided)
|
|
590
|
+
* @returns User data object or null if not found
|
|
591
591
|
*/
|
|
592
592
|
export const extractUserDataFromJWT = token => {
|
|
593
593
|
try {
|
|
@@ -620,17 +620,17 @@ export const extractUserDataFromJWT = token => {
|
|
|
620
620
|
}
|
|
621
621
|
};
|
|
622
622
|
|
|
623
|
-
/**
|
|
624
|
-
* Check if user is authenticated with JWT token
|
|
625
|
-
* @returns True if user has valid JWT token
|
|
623
|
+
/**
|
|
624
|
+
* Check if user is authenticated with JWT token
|
|
625
|
+
* @returns True if user has valid JWT token
|
|
626
626
|
*/
|
|
627
627
|
export const isUserAuthenticated = () => {
|
|
628
628
|
return !!userToken;
|
|
629
629
|
};
|
|
630
630
|
|
|
631
|
-
/**
|
|
632
|
-
* Get authenticated headers for API requests
|
|
633
|
-
* @returns Headers object with Authorization and other required headers
|
|
631
|
+
/**
|
|
632
|
+
* Get authenticated headers for API requests
|
|
633
|
+
* @returns Headers object with Authorization and other required headers
|
|
634
634
|
*/
|
|
635
635
|
export const getAuthHeaders = () => {
|
|
636
636
|
var _globalConfig12;
|
|
@@ -649,9 +649,9 @@ export const getAuthHeaders = () => {
|
|
|
649
649
|
};
|
|
650
650
|
};
|
|
651
651
|
|
|
652
|
-
/**
|
|
653
|
-
* Get authentication headers for developer API requests
|
|
654
|
-
* @returns Headers with developer API key
|
|
652
|
+
/**
|
|
653
|
+
* Get authentication headers for developer API requests
|
|
654
|
+
* @returns Headers with developer API key
|
|
655
655
|
*/
|
|
656
656
|
export const getDeveloperAuthHeaders = () => {
|
|
657
657
|
var _globalConfig13;
|
|
@@ -670,9 +670,9 @@ export const getDeveloperAuthHeaders = () => {
|
|
|
670
670
|
};
|
|
671
671
|
};
|
|
672
672
|
|
|
673
|
-
/**
|
|
674
|
-
* Get authentication headers for user JWT requests
|
|
675
|
-
* @returns Headers with user JWT token
|
|
673
|
+
/**
|
|
674
|
+
* Get authentication headers for user JWT requests
|
|
675
|
+
* @returns Headers with user JWT token
|
|
676
676
|
*/
|
|
677
677
|
export const getUserAuthHeaders = () => {
|
|
678
678
|
var _globalConfig14;
|
|
@@ -688,11 +688,11 @@ export const getUserAuthHeaders = () => {
|
|
|
688
688
|
};
|
|
689
689
|
};
|
|
690
690
|
|
|
691
|
-
/**
|
|
692
|
-
* Make an authenticated API request
|
|
693
|
-
* @param endpoint The API endpoint (relative to base URL)
|
|
694
|
-
* @param options Fetch options
|
|
695
|
-
* @returns Response promise
|
|
691
|
+
/**
|
|
692
|
+
* Make an authenticated API request
|
|
693
|
+
* @param endpoint The API endpoint (relative to base URL)
|
|
694
|
+
* @param options Fetch options
|
|
695
|
+
* @returns Response promise
|
|
696
696
|
*/
|
|
697
697
|
export const makeAuthenticatedRequest = async (endpoint, options = {}) => {
|
|
698
698
|
if (!isApiKeyInitialized()) {
|
|
@@ -749,11 +749,11 @@ export const makeAuthenticatedRequest = async (endpoint, options = {}) => {
|
|
|
749
749
|
}
|
|
750
750
|
};
|
|
751
751
|
|
|
752
|
-
/**
|
|
753
|
-
* Make authenticated request with developer API key
|
|
754
|
-
* @param endpoint The API endpoint
|
|
755
|
-
* @param options Fetch options
|
|
756
|
-
* @returns Response promise
|
|
752
|
+
/**
|
|
753
|
+
* Make authenticated request with developer API key
|
|
754
|
+
* @param endpoint The API endpoint
|
|
755
|
+
* @param options Fetch options
|
|
756
|
+
* @returns Response promise
|
|
757
757
|
*/
|
|
758
758
|
export const makeDeveloperRequest = async (endpoint, options = {}) => {
|
|
759
759
|
if (!isApiKeyInitialized()) {
|
|
@@ -810,11 +810,11 @@ export const makeDeveloperRequest = async (endpoint, options = {}) => {
|
|
|
810
810
|
}
|
|
811
811
|
};
|
|
812
812
|
|
|
813
|
-
/**
|
|
814
|
-
* Make authenticated request with user JWT token
|
|
815
|
-
* @param endpoint The API endpoint
|
|
816
|
-
* @param options Fetch options
|
|
817
|
-
* @returns Response promise
|
|
813
|
+
/**
|
|
814
|
+
* Make authenticated request with user JWT token
|
|
815
|
+
* @param endpoint The API endpoint
|
|
816
|
+
* @param options Fetch options
|
|
817
|
+
* @returns Response promise
|
|
818
818
|
*/
|
|
819
819
|
export const makeUserRequest = async (endpoint, options = {}) => {
|
|
820
820
|
if (!isUserAuthenticated()) {
|
|
@@ -875,8 +875,8 @@ export const makeUserRequest = async (endpoint, options = {}) => {
|
|
|
875
875
|
}
|
|
876
876
|
};
|
|
877
877
|
|
|
878
|
-
/**
|
|
879
|
-
* Clear the API key validation cache
|
|
878
|
+
/**
|
|
879
|
+
* Clear the API key validation cache
|
|
880
880
|
*/
|
|
881
881
|
export const clearValidationCache = () => {
|
|
882
882
|
var _globalConfig15;
|
|
@@ -886,8 +886,8 @@ export const clearValidationCache = () => {
|
|
|
886
886
|
}
|
|
887
887
|
};
|
|
888
888
|
|
|
889
|
-
/**
|
|
890
|
-
* Reset the SDK initialization state
|
|
889
|
+
/**
|
|
890
|
+
* Reset the SDK initialization state
|
|
891
891
|
*/
|
|
892
892
|
export const resetApiKeyService = () => {
|
|
893
893
|
globalConfig = null;
|