@onairos/react-native 3.4.1 → 3.6.0
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 -374
- package/lib/commonjs/api/index.js +9 -145
- package/lib/commonjs/assets/animations/loaderani.json +1 -0
- package/lib/commonjs/assets/animations/persona-animation.json +1 -0
- package/lib/commonjs/assets/fonts/EBGaramond-VariableFont_wght.ttf +0 -0
- package/lib/commonjs/assets/fonts/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
- package/lib/commonjs/assets/icons/Facebookicon.png +0 -0
- package/lib/commonjs/assets/icons/Gmail.png +0 -0
- package/lib/commonjs/assets/icons/Linkedinicon.png +0 -0
- package/lib/commonjs/assets/icons/Redditicon.png +0 -0
- package/lib/commonjs/assets/icons/YouTubeicon2.png +0 -0
- package/lib/commonjs/assets/icons/YouTubeicon3.png +0 -0
- package/lib/commonjs/assets/icons/chatgpt.png +0 -0
- package/lib/commonjs/assets/icons/claude.png +0 -0
- package/lib/commonjs/assets/icons/gemini.png +0 -0
- package/lib/commonjs/assets/icons/grok.png +0 -0
- package/lib/commonjs/assets/images/Checkbox.svg +3 -0
- package/lib/commonjs/assets/images/EnochE.svg +19 -0
- package/lib/commonjs/assets/images/Enochicon1.png +0 -0
- package/lib/commonjs/assets/images/Face_ID_logo.png +0 -0
- package/lib/commonjs/assets/images/Facebookicon.png +0 -0
- package/lib/commonjs/assets/images/Gmail.png +0 -0
- package/lib/commonjs/assets/images/Googlelogo.png +0 -0
- package/lib/commonjs/assets/images/Linkedinicon.png +0 -0
- package/lib/commonjs/assets/images/OnairosNewLogo.png +0 -0
- package/lib/commonjs/assets/images/Onairoslogo.png +0 -0
- package/lib/commonjs/assets/images/Personalityprofile.svg +3 -0
- package/lib/commonjs/assets/images/Personalitytraits.svg +3 -0
- package/lib/commonjs/assets/images/Redditicon.png +0 -0
- package/lib/commonjs/assets/images/Userpreferences.svg +3 -0
- package/lib/commonjs/assets/images/YouTubeicon3.png +0 -0
- package/lib/commonjs/assets/images/arrow.svg +20 -0
- package/lib/commonjs/assets/images/basicproficon.svg +43 -0
- package/lib/commonjs/assets/images/basicprofile.svg +3 -0
- package/lib/commonjs/assets/images/chatgpt.png +0 -0
- package/lib/commonjs/assets/images/checkmark.svg +4 -0
- package/lib/commonjs/assets/images/claude.png +0 -0
- package/lib/commonjs/assets/images/contentanalysis.svg +3 -0
- package/lib/commonjs/assets/images/contenticon.svg +23 -0
- package/lib/commonjs/assets/images/gemini.png +0 -0
- package/lib/commonjs/assets/images/grok.png +0 -0
- package/lib/commonjs/assets/images/persona1.png +0 -0
- package/lib/commonjs/assets/images/persona2.png +0 -0
- package/lib/commonjs/assets/images/persona3.png +0 -0
- package/lib/commonjs/assets/images/persona4.png +0 -0
- package/lib/commonjs/assets/images/persona5.png +0 -0
- package/lib/commonjs/assets/images/personalityicon.svg +18 -0
- package/lib/commonjs/assets/images/x-close.svg +3 -0
- package/lib/commonjs/components/BodyText.js +9 -0
- package/lib/commonjs/components/BrandMark.js +10 -0
- package/lib/commonjs/components/CodeInput.js +9 -0
- package/lib/commonjs/components/EmailInput.js +8 -0
- package/lib/commonjs/components/GoogleButton.js +9 -0
- package/lib/commonjs/components/HeadingGroup.js +9 -0
- package/lib/commonjs/components/LLMDataInputModal.js +14 -0
- package/lib/commonjs/components/ModalHeader.js +9 -0
- package/lib/commonjs/components/ModalSheet.js +9 -0
- package/lib/commonjs/components/Onairos.js +14 -374
- package/lib/commonjs/components/OnairosButton.js +13 -309
- package/lib/commonjs/components/OnairosSignInButton.js +12 -0
- package/lib/commonjs/components/Overlay.js +13 -483
- package/lib/commonjs/components/PersonaImage.js +10 -0
- package/lib/commonjs/components/PersonaLoadingScreen.js +12 -0
- package/lib/commonjs/components/PersonalizationConsentScreen.js +13 -0
- package/lib/commonjs/components/PinCreationScreen.js +12 -0
- package/lib/commonjs/components/PinInput.js +9 -302
- package/lib/commonjs/components/PlatformConnectorsStep.js +23 -0
- package/lib/commonjs/components/PlatformList.js +10 -137
- package/lib/commonjs/components/PlatformToggle.js +9 -0
- package/lib/commonjs/components/PrimaryButton.js +10 -0
- package/lib/commonjs/components/SignInMatchAnimation.js +9 -0
- package/lib/commonjs/components/SignInStep.js +12 -0
- package/lib/commonjs/components/UniversalOnboarding.js +30 -1702
- package/lib/commonjs/components/VerificationStep.js +11 -0
- package/lib/commonjs/components/WelcomeScreen.js +22 -0
- package/lib/commonjs/components/icons/Basicproficon.js +8 -0
- package/lib/commonjs/components/icons/Basicprofile.js +8 -0
- package/lib/commonjs/components/icons/Checkbox.js +8 -0
- package/lib/commonjs/components/icons/Checkmark.js +8 -0
- package/lib/commonjs/components/icons/Contentanalysis.js +8 -0
- package/lib/commonjs/components/icons/Contenticon.js +8 -0
- package/lib/commonjs/components/icons/EnochE.js +8 -0
- package/lib/commonjs/components/icons/Personalityicon.js +8 -0
- package/lib/commonjs/components/icons/Personalityprofile.js +8 -0
- package/lib/commonjs/components/icons/Personalitytraits.js +8 -0
- package/lib/commonjs/components/icons/Userpreferences.js +8 -0
- package/lib/commonjs/components/icons/index.js +17 -0
- package/lib/commonjs/components/onboarding/OAuthWebView.js +18 -827
- package/lib/commonjs/components/onboarding/OnboardingHeader.js +10 -74
- package/lib/commonjs/components/onboarding/PinInput.js +10 -283
- package/lib/commonjs/components/onboarding/PlatformConnector.js +11 -249
- package/lib/commonjs/config/api.js +7 -0
- package/lib/commonjs/constants/index.js +7 -83
- package/lib/commonjs/context/AuthContext.js +10 -0
- package/lib/commonjs/hooks/useConnectedAccounts.js +9 -0
- package/lib/commonjs/hooks/useConnections.js +8 -159
- package/lib/commonjs/hooks/useCredentials.js +10 -177
- package/lib/commonjs/hooks/useUserConnections.js +10 -0
- package/lib/commonjs/index.js +34 -106
- package/lib/commonjs/services/SDK_API_KEY_VALIDATION.md +421 -421
- package/lib/commonjs/services/apiClient.js +8 -0
- package/lib/commonjs/services/apiKeyService.js +9 -952
- package/lib/commonjs/services/authService.js +10 -0
- package/lib/commonjs/services/biometricPinService.js +8 -0
- package/lib/commonjs/services/chatGPTConversationExtractor.js +8 -0
- package/lib/commonjs/services/chatGPTConversationService.js +9 -0
- package/lib/commonjs/services/claudeConversationExtractor.js +8 -0
- package/lib/commonjs/services/claudeConversationService.js +9 -0
- package/lib/commonjs/services/connectedAccountsService.js +10 -0
- package/lib/commonjs/services/googleAuthService.js +11 -0
- package/lib/commonjs/services/hingeDataExtractor.js +8 -0
- package/lib/commonjs/services/hingeDataService.js +9 -0
- package/lib/commonjs/services/imageCompressionService.js +7 -0
- package/lib/commonjs/services/instagramDataExtractor.js +8 -0
- package/lib/commonjs/services/instagramDataService.js +9 -0
- package/lib/commonjs/services/jwtStorageService.js +7 -0
- package/lib/commonjs/services/linkedinDOMExtractor.js +7 -0
- package/lib/commonjs/services/linkedinProfileService.js +9 -0
- package/lib/commonjs/services/linkedinScrapingService.js +8 -0
- package/lib/commonjs/services/llmDataStorage.js +8 -0
- package/lib/commonjs/services/mobileTrainingService.js +8 -0
- package/lib/commonjs/services/oauthService.js +11 -390
- package/lib/commonjs/services/pinEncryptionService.js +8 -0
- package/lib/commonjs/services/pinStorageUtils.js +7 -0
- package/lib/commonjs/services/platformAuthService.js +12 -1067
- package/lib/commonjs/services/sephoraDataExtractor.js +8 -0
- package/lib/commonjs/services/sephoraDataService.js +9 -0
- package/lib/commonjs/services/storageService.js +8 -0
- package/lib/commonjs/services/telegramDataExtractor.js +8 -0
- package/lib/commonjs/services/telegramDataService.js +11 -0
- package/lib/commonjs/services/trainingApiHelpers.js +7 -0
- package/lib/commonjs/services/userConnectionsService.js +10 -0
- package/lib/commonjs/services/youtubeMigrationService.js +10 -0
- package/lib/commonjs/theme/index.js +7 -0
- package/lib/commonjs/types/ambient.d.js +1 -2
- package/lib/commonjs/types/declarations.d.js +1 -2
- package/lib/commonjs/types/index.js +1 -6
- package/lib/commonjs/types/node-fix.d.js +1 -2
- package/lib/commonjs/types/node-override.d.js +1 -2
- package/lib/commonjs/types/opacity.d.js +1 -2
- package/lib/commonjs/types.js +1 -14
- package/lib/commonjs/utils/Portal.js +8 -98
- package/lib/commonjs/utils/api.js +9 -129
- package/lib/commonjs/utils/assetRegistry.js +33 -0
- package/lib/commonjs/utils/auth.js +9 -111
- package/lib/commonjs/utils/connectorTests.js +29 -0
- package/lib/commonjs/utils/crypto.js +8 -62
- package/lib/commonjs/utils/debugHelper.js +1 -64
- package/lib/commonjs/utils/encryption.js +7 -76
- package/lib/commonjs/utils/eventUtils.js +1 -0
- package/lib/commonjs/utils/haptics.js +9 -0
- package/lib/commonjs/utils/imagePreloader.js +1 -0
- package/lib/commonjs/utils/networkDiagnostics.js +8 -0
- package/lib/commonjs/utils/onairosApi.js +9 -350
- package/lib/commonjs/utils/programmaticFlow.js +9 -117
- package/lib/commonjs/utils/retryHelper.js +1 -220
- package/lib/commonjs/utils/secureStorage.js +10 -349
- package/lib/commonjs/utils/webviewScripts/chatgpt.js +1 -0
- package/lib/commonjs/utils/webviewScripts/claude.js +1 -0
- package/lib/commonjs/utils/webviewScripts/hinge.js +1 -0
- package/lib/commonjs/utils/webviewScripts/index.js +13 -0
- package/lib/commonjs/utils/webviewScripts/instagram.js +1 -0
- package/lib/commonjs/utils/webviewScripts/linkedin.js +1 -0
- package/lib/commonjs/utils/webviewScripts/sephora.js +1 -0
- package/lib/commonjs/utils/webviewScripts/telegram.js +1 -0
- package/lib/module/api/index.js +1 -139
- package/lib/module/assets/animations/loaderani.json +1 -0
- package/lib/module/assets/animations/persona-animation.json +1 -0
- package/lib/module/assets/fonts/EBGaramond-VariableFont_wght.ttf +0 -0
- package/lib/module/assets/fonts/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
- package/lib/module/assets/icons/Facebookicon.png +0 -0
- package/lib/module/assets/icons/Gmail.png +0 -0
- package/lib/module/assets/icons/Linkedinicon.png +0 -0
- package/lib/module/assets/icons/Redditicon.png +0 -0
- package/lib/module/assets/icons/YouTubeicon2.png +0 -0
- package/lib/module/assets/icons/YouTubeicon3.png +0 -0
- package/lib/module/assets/icons/chatgpt.png +0 -0
- package/lib/module/assets/icons/claude.png +0 -0
- package/lib/module/assets/icons/farcaster.png +0 -0
- package/lib/module/assets/icons/gemini.png +0 -0
- package/lib/module/assets/icons/grok.png +0 -0
- package/lib/module/assets/icons/instagram.png +0 -0
- package/lib/module/assets/icons/pinterest.png +0 -0
- package/lib/module/assets/icons/swerv_logo.png +0 -0
- package/lib/module/assets/icons/twitter.jpg +0 -0
- package/lib/module/assets/images/Checkbox.svg +3 -0
- package/lib/module/assets/images/EnochE.svg +19 -0
- package/lib/module/assets/images/Enochicon1.png +0 -0
- package/lib/module/assets/images/Face_ID_logo.png +0 -0
- package/lib/module/assets/images/Facebookicon.png +0 -0
- package/lib/module/assets/images/Gmail.png +0 -0
- package/lib/module/assets/images/Googlelogo.png +0 -0
- package/lib/module/assets/images/Linkedinicon.png +0 -0
- package/lib/module/assets/images/OnairosNewLogo.png +0 -0
- package/lib/module/assets/images/Onairoslogo.png +0 -0
- package/lib/module/assets/images/Personalityprofile.svg +3 -0
- package/lib/module/assets/images/Personalitytraits.svg +3 -0
- package/lib/module/assets/images/Redditicon.png +0 -0
- package/lib/module/assets/images/Userpreferences.svg +3 -0
- package/lib/module/assets/images/YouTubeicon3.png +0 -0
- package/lib/module/assets/images/arrow.svg +20 -0
- package/lib/module/assets/images/basicproficon.svg +43 -0
- package/lib/module/assets/images/basicprofile.svg +3 -0
- package/lib/module/assets/images/chatgpt.png +0 -0
- package/lib/module/assets/images/checkmark.svg +4 -0
- package/lib/module/assets/images/claude.png +0 -0
- package/lib/module/assets/images/contentanalysis.svg +3 -0
- package/lib/module/assets/images/contenticon.svg +23 -0
- package/lib/module/assets/images/gemini.png +0 -0
- package/lib/module/assets/images/grok.png +0 -0
- package/lib/module/assets/images/persona1.png +0 -0
- package/lib/module/assets/images/persona2.png +0 -0
- package/lib/module/assets/images/persona3.png +0 -0
- package/lib/module/assets/images/persona4.png +0 -0
- package/lib/module/assets/images/persona5.png +0 -0
- package/lib/module/assets/images/personalityicon.svg +18 -0
- package/lib/module/assets/images/x-close.svg +3 -0
- package/lib/module/components/BodyText.js +1 -0
- package/lib/module/components/BrandMark.js +1 -0
- package/lib/module/components/CodeInput.js +1 -0
- package/lib/module/components/EmailInput.js +1 -0
- package/lib/module/components/GoogleButton.js +1 -0
- package/lib/module/components/HeadingGroup.js +1 -0
- package/lib/module/components/LLMDataInputModal.js +8 -0
- package/lib/module/components/ModalHeader.js +1 -0
- package/lib/module/components/ModalSheet.js +1 -0
- package/lib/module/components/Onairos.js +1 -367
- package/lib/module/components/OnairosButton.js +1 -302
- package/lib/module/components/OnairosSignInButton.js +1 -0
- package/lib/module/components/Overlay.js +1 -474
- package/lib/module/components/PersonaImage.js +1 -0
- package/lib/module/components/PersonaLoadingScreen.js +1 -0
- package/lib/module/components/PersonalizationConsentScreen.js +1 -0
- package/lib/module/components/PinCreationScreen.js +1 -0
- package/lib/module/components/PinInput.js +1 -293
- package/lib/module/components/PlatformConnectorsStep.js +7 -0
- package/lib/module/components/PlatformList.js +1 -129
- package/lib/module/components/PlatformToggle.js +1 -0
- package/lib/module/components/PrimaryButton.js +1 -0
- package/lib/module/components/SignInMatchAnimation.js +1 -0
- package/lib/module/components/SignInStep.js +1 -0
- package/lib/module/components/UniversalOnboarding.js +1 -1693
- package/lib/module/components/VerificationStep.js +1 -0
- package/lib/module/components/WelcomeScreen.js +1 -0
- package/lib/module/components/icons/Basicproficon.js +1 -0
- package/lib/module/components/icons/Basicprofile.js +1 -0
- package/lib/module/components/icons/Checkbox.js +1 -0
- package/lib/module/components/icons/Checkmark.js +1 -0
- package/lib/module/components/icons/Contentanalysis.js +1 -0
- package/lib/module/components/icons/Contenticon.js +1 -0
- package/lib/module/components/icons/EnochE.js +1 -0
- package/lib/module/components/icons/Personalityicon.js +1 -0
- package/lib/module/components/icons/Personalityprofile.js +1 -0
- package/lib/module/components/icons/Personalitytraits.js +1 -0
- package/lib/module/components/icons/Userpreferences.js +1 -0
- package/lib/module/components/icons/index.js +1 -0
- package/lib/module/components/onboarding/OAuthWebView.js +1 -818
- package/lib/module/components/onboarding/OnboardingHeader.js +1 -66
- package/lib/module/components/onboarding/PinInput.js +1 -274
- package/lib/module/components/onboarding/PlatformConnector.js +1 -240
- package/lib/module/config/api.js +1 -0
- package/lib/module/constants/index.js +1 -77
- package/lib/module/context/AuthContext.js +1 -0
- package/lib/module/hooks/useConnectedAccounts.js +1 -0
- package/lib/module/hooks/useConnections.js +1 -152
- package/lib/module/hooks/useCredentials.js +6 -169
- package/lib/module/hooks/useUserConnections.js +1 -0
- package/lib/module/index.js +1 -32
- package/lib/module/services/SDK_API_KEY_VALIDATION.md +421 -421
- package/lib/module/services/apiClient.js +1 -0
- package/lib/module/services/apiKeyService.js +1 -925
- package/lib/module/services/authService.js +1 -0
- package/lib/module/services/biometricPinService.js +1 -0
- package/lib/module/services/chatGPTConversationExtractor.js +1 -0
- package/lib/module/services/chatGPTConversationService.js +1 -0
- package/lib/module/services/claudeConversationExtractor.js +1 -0
- package/lib/module/services/claudeConversationService.js +1 -0
- package/lib/module/services/connectedAccountsService.js +1 -0
- package/lib/module/services/googleAuthService.js +1 -0
- package/lib/module/services/hingeDataExtractor.js +1 -0
- package/lib/module/services/hingeDataService.js +1 -0
- package/lib/module/services/imageCompressionService.js +1 -0
- package/lib/module/services/instagramDataExtractor.js +1 -0
- package/lib/module/services/instagramDataService.js +1 -0
- package/lib/module/services/jwtStorageService.js +1 -0
- package/lib/module/services/linkedinDOMExtractor.js +1 -0
- package/lib/module/services/linkedinProfileService.js +1 -0
- package/lib/module/services/linkedinScrapingService.js +1 -0
- package/lib/module/services/llmDataStorage.js +1 -0
- package/lib/module/services/mobileTrainingService.js +1 -0
- package/lib/module/services/oauthService.js +1 -380
- package/lib/module/services/pinEncryptionService.js +7 -0
- package/lib/module/services/pinStorageUtils.js +1 -0
- package/lib/module/services/platformAuthService.js +1 -1041
- package/lib/module/services/sephoraDataExtractor.js +1 -0
- package/lib/module/services/sephoraDataService.js +1 -0
- package/lib/module/services/storageService.js +1 -0
- package/lib/module/services/telegramDataExtractor.js +1 -0
- package/lib/module/services/telegramDataService.js +8 -0
- package/lib/module/services/trainingApiHelpers.js +1 -0
- package/lib/module/services/userConnectionsService.js +1 -0
- package/lib/module/services/youtubeMigrationService.js +1 -0
- package/lib/module/theme/index.js +1 -0
- package/lib/module/types.js +1 -10
- package/lib/module/utils/Portal.js +1 -90
- package/lib/module/utils/api.js +1 -117
- package/lib/module/utils/assetRegistry.js +33 -0
- package/lib/module/utils/auth.js +1 -99
- package/lib/module/utils/connectorTests.js +28 -0
- package/lib/module/utils/crypto.js +1 -54
- package/lib/module/utils/debugHelper.js +1 -54
- package/lib/module/utils/encryption.js +1 -67
- package/lib/module/utils/eventUtils.js +1 -0
- package/lib/module/utils/haptics.js +8 -0
- package/lib/module/utils/imagePreloader.js +1 -0
- package/lib/module/utils/networkDiagnostics.js +1 -0
- package/lib/module/utils/onairosApi.js +1 -333
- package/lib/module/utils/programmaticFlow.js +1 -111
- package/lib/module/utils/retryHelper.js +1 -211
- package/lib/module/utils/secureStorage.js +6 -330
- package/lib/module/utils/webviewScripts/chatgpt.js +1 -0
- package/lib/module/utils/webviewScripts/claude.js +1 -0
- package/lib/module/utils/webviewScripts/hinge.js +1 -0
- package/lib/module/utils/webviewScripts/index.js +1 -0
- package/lib/module/utils/webviewScripts/instagram.js +1 -0
- package/lib/module/utils/webviewScripts/linkedin.js +1 -0
- package/lib/module/utils/webviewScripts/sephora.js +1 -0
- package/lib/module/utils/webviewScripts/telegram.js +1 -0
- package/package.json +62 -39
- package/lib/commonjs/api/index.js.map +0 -1
- package/lib/commonjs/assets/images/email.png +0 -0
- package/lib/commonjs/assets/images/linkedin.png +0 -0
- package/lib/commonjs/assets/images/reddit.png +0 -0
- package/lib/commonjs/assets/images/youtube.png +0 -0
- package/lib/commonjs/components/DataRequestModal.js +0 -228
- package/lib/commonjs/components/DataRequestModal.js.map +0 -1
- package/lib/commonjs/components/DataRequestScreen.js +0 -329
- package/lib/commonjs/components/DataRequestScreen.js.map +0 -1
- package/lib/commonjs/components/EmailVerificationModal.js +0 -320
- package/lib/commonjs/components/EmailVerificationModal.js.map +0 -1
- package/lib/commonjs/components/Onairos.js.map +0 -1
- package/lib/commonjs/components/OnairosButton.js.map +0 -1
- package/lib/commonjs/components/Overlay.js.map +0 -1
- package/lib/commonjs/components/PinInput.js.map +0 -1
- package/lib/commonjs/components/PlatformList.js.map +0 -1
- package/lib/commonjs/components/TrainingModal.js +0 -717
- package/lib/commonjs/components/TrainingModal.js.map +0 -1
- package/lib/commonjs/components/UniversalOnboarding.js.map +0 -1
- package/lib/commonjs/components/UniversalOnboarding.tsx.new +0 -455
- package/lib/commonjs/components/onboarding/OAuthWebView.js.map +0 -1
- package/lib/commonjs/components/onboarding/OnboardingHeader.js.map +0 -1
- package/lib/commonjs/components/onboarding/PinInput.js.map +0 -1
- package/lib/commonjs/components/onboarding/PlatformConnector.js.map +0 -1
- package/lib/commonjs/components/screens/ConnectorScreen.js +0 -146
- package/lib/commonjs/components/screens/ConnectorScreen.js.map +0 -1
- package/lib/commonjs/components/screens/LoadingScreen.js +0 -91
- package/lib/commonjs/components/screens/LoadingScreen.js.map +0 -1
- package/lib/commonjs/components/screens/PinCreationScreen.js +0 -61
- package/lib/commonjs/components/screens/PinCreationScreen.js.map +0 -1
- package/lib/commonjs/constants/index.js.map +0 -1
- package/lib/commonjs/hooks/useConnections.js.map +0 -1
- package/lib/commonjs/hooks/useCredentials.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/services/apiKeyService.js.map +0 -1
- package/lib/commonjs/services/oauthService.js.map +0 -1
- package/lib/commonjs/services/platformAuthService.js.map +0 -1
- package/lib/commonjs/types/ambient.d.js.map +0 -1
- package/lib/commonjs/types/declarations.d.js.map +0 -1
- package/lib/commonjs/types/index.d.js.map +0 -1
- package/lib/commonjs/types/index.js.map +0 -1
- package/lib/commonjs/types/node-fix.d.js.map +0 -1
- package/lib/commonjs/types/node-override.d.js.map +0 -1
- package/lib/commonjs/types/opacity.d.js.map +0 -1
- package/lib/commonjs/types/types.d.js.map +0 -1
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/utils/Portal.js.map +0 -1
- package/lib/commonjs/utils/api.js.map +0 -1
- package/lib/commonjs/utils/auth.js.map +0 -1
- package/lib/commonjs/utils/crypto.js.map +0 -1
- package/lib/commonjs/utils/debugHelper.js.map +0 -1
- package/lib/commonjs/utils/encryption.js.map +0 -1
- package/lib/commonjs/utils/onairosApi.js.map +0 -1
- package/lib/commonjs/utils/programmaticFlow.js.map +0 -1
- package/lib/commonjs/utils/retryHelper.js.map +0 -1
- package/lib/commonjs/utils/secureStorage.js.map +0 -1
- package/lib/module/api/index.js.map +0 -1
- package/lib/module/assets/images/email.png +0 -0
- package/lib/module/assets/images/linkedin.png +0 -0
- package/lib/module/assets/images/reddit.png +0 -0
- package/lib/module/assets/images/youtube.png +0 -0
- package/lib/module/components/DataRequestModal.js +0 -220
- package/lib/module/components/DataRequestModal.js.map +0 -1
- package/lib/module/components/DataRequestScreen.js +0 -321
- package/lib/module/components/DataRequestScreen.js.map +0 -1
- package/lib/module/components/EmailVerificationModal.js +0 -311
- package/lib/module/components/EmailVerificationModal.js.map +0 -1
- package/lib/module/components/Onairos.js.map +0 -1
- package/lib/module/components/OnairosButton.js.map +0 -1
- package/lib/module/components/Overlay.js.map +0 -1
- package/lib/module/components/PinInput.js.map +0 -1
- package/lib/module/components/PlatformList.js.map +0 -1
- package/lib/module/components/TrainingModal.js +0 -708
- package/lib/module/components/TrainingModal.js.map +0 -1
- package/lib/module/components/UniversalOnboarding.js.map +0 -1
- package/lib/module/components/UniversalOnboarding.tsx.new +0 -455
- package/lib/module/components/onboarding/OAuthWebView.js.map +0 -1
- package/lib/module/components/onboarding/OnboardingHeader.js.map +0 -1
- package/lib/module/components/onboarding/PinInput.js.map +0 -1
- package/lib/module/components/onboarding/PlatformConnector.js.map +0 -1
- package/lib/module/components/screens/ConnectorScreen.js +0 -138
- package/lib/module/components/screens/ConnectorScreen.js.map +0 -1
- package/lib/module/components/screens/LoadingScreen.js +0 -83
- package/lib/module/components/screens/LoadingScreen.js.map +0 -1
- package/lib/module/components/screens/PinCreationScreen.js +0 -53
- package/lib/module/components/screens/PinCreationScreen.js.map +0 -1
- package/lib/module/constants/index.js.map +0 -1
- package/lib/module/hooks/useConnections.js.map +0 -1
- package/lib/module/hooks/useCredentials.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/services/apiKeyService.js.map +0 -1
- package/lib/module/services/oauthService.js.map +0 -1
- package/lib/module/services/platformAuthService.js.map +0 -1
- package/lib/module/types/ambient.d.js.map +0 -1
- package/lib/module/types/declarations.d.js.map +0 -1
- package/lib/module/types/index.d.js.map +0 -1
- package/lib/module/types/index.js.map +0 -1
- package/lib/module/types/node-fix.d.js.map +0 -1
- package/lib/module/types/node-override.d.js.map +0 -1
- package/lib/module/types/opacity.d.js.map +0 -1
- package/lib/module/types/types.d.js.map +0 -1
- package/lib/module/types.js.map +0 -1
- package/lib/module/utils/Portal.js.map +0 -1
- package/lib/module/utils/api.js.map +0 -1
- package/lib/module/utils/auth.js.map +0 -1
- package/lib/module/utils/crypto.js.map +0 -1
- package/lib/module/utils/debugHelper.js.map +0 -1
- package/lib/module/utils/encryption.js.map +0 -1
- package/lib/module/utils/onairosApi.js.map +0 -1
- package/lib/module/utils/programmaticFlow.js.map +0 -1
- package/lib/module/utils/retryHelper.js.map +0 -1
- package/lib/module/utils/secureStorage.js.map +0 -1
- package/lib/typescript/api/index.d.ts +0 -8
- package/lib/typescript/api/index.d.ts.map +0 -1
- package/lib/typescript/components/DataRequestModal.d.ts +0 -11
- package/lib/typescript/components/DataRequestModal.d.ts.map +0 -1
- package/lib/typescript/components/DataRequestScreen.d.ts +0 -11
- package/lib/typescript/components/DataRequestScreen.d.ts.map +0 -1
- package/lib/typescript/components/EmailVerificationModal.d.ts +0 -11
- package/lib/typescript/components/EmailVerificationModal.d.ts.map +0 -1
- package/lib/typescript/components/Onairos.d.ts +0 -4
- package/lib/typescript/components/Onairos.d.ts.map +0 -1
- package/lib/typescript/components/OnairosButton.d.ts +0 -12
- package/lib/typescript/components/OnairosButton.d.ts.map +0 -1
- package/lib/typescript/components/Overlay.d.ts +0 -4
- package/lib/typescript/components/Overlay.d.ts.map +0 -1
- package/lib/typescript/components/PinInput.d.ts +0 -4
- package/lib/typescript/components/PinInput.d.ts.map +0 -1
- package/lib/typescript/components/PlatformList.d.ts +0 -4
- package/lib/typescript/components/PlatformList.d.ts.map +0 -1
- package/lib/typescript/components/TrainingModal.d.ts +0 -4
- package/lib/typescript/components/TrainingModal.d.ts.map +0 -1
- package/lib/typescript/components/UniversalOnboarding.d.ts +0 -4
- package/lib/typescript/components/UniversalOnboarding.d.ts.map +0 -1
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts +0 -10
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts.map +0 -1
- package/lib/typescript/components/onboarding/OnboardingHeader.d.ts +0 -11
- package/lib/typescript/components/onboarding/OnboardingHeader.d.ts.map +0 -1
- package/lib/typescript/components/onboarding/PinInput.d.ts +0 -4
- package/lib/typescript/components/onboarding/PinInput.d.ts.map +0 -1
- package/lib/typescript/components/onboarding/PlatformConnector.d.ts +0 -13
- package/lib/typescript/components/onboarding/PlatformConnector.d.ts.map +0 -1
- package/lib/typescript/components/screens/ConnectorScreen.d.ts +0 -9
- package/lib/typescript/components/screens/ConnectorScreen.d.ts.map +0 -1
- package/lib/typescript/components/screens/LoadingScreen.d.ts +0 -9
- package/lib/typescript/components/screens/LoadingScreen.d.ts.map +0 -1
- package/lib/typescript/components/screens/PinCreationScreen.d.ts +0 -10
- package/lib/typescript/components/screens/PinCreationScreen.d.ts.map +0 -1
- package/lib/typescript/constants/index.d.ts +0 -53
- package/lib/typescript/constants/index.d.ts.map +0 -1
- package/lib/typescript/hooks/useConnections.d.ts +0 -9
- package/lib/typescript/hooks/useConnections.d.ts.map +0 -1
- package/lib/typescript/hooks/useCredentials.d.ts +0 -9
- package/lib/typescript/hooks/useCredentials.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -18
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/services/apiKeyService.d.ts +0 -132
- package/lib/typescript/services/apiKeyService.d.ts.map +0 -1
- package/lib/typescript/services/oauthService.d.ts +0 -50
- package/lib/typescript/services/oauthService.d.ts.map +0 -1
- package/lib/typescript/services/platformAuthService.d.ts +0 -144
- package/lib/typescript/services/platformAuthService.d.ts.map +0 -1
- package/lib/typescript/types/index.d.ts +0 -231
- package/lib/typescript/types/index.d.ts.map +0 -1
- package/lib/typescript/types.d.ts +0 -270
- package/lib/typescript/types.d.ts.map +0 -1
- package/lib/typescript/utils/Portal.d.ts +0 -14
- package/lib/typescript/utils/Portal.d.ts.map +0 -1
- package/lib/typescript/utils/api.d.ts +0 -6
- package/lib/typescript/utils/api.d.ts.map +0 -1
- package/lib/typescript/utils/auth.d.ts +0 -6
- package/lib/typescript/utils/auth.d.ts.map +0 -1
- package/lib/typescript/utils/crypto.d.ts +0 -4
- package/lib/typescript/utils/crypto.d.ts.map +0 -1
- package/lib/typescript/utils/debugHelper.d.ts +0 -29
- package/lib/typescript/utils/debugHelper.d.ts.map +0 -1
- package/lib/typescript/utils/encryption.d.ts +0 -19
- package/lib/typescript/utils/encryption.d.ts.map +0 -1
- package/lib/typescript/utils/onairosApi.d.ts +0 -87
- package/lib/typescript/utils/onairosApi.d.ts.map +0 -1
- package/lib/typescript/utils/programmaticFlow.d.ts +0 -23
- package/lib/typescript/utils/programmaticFlow.d.ts.map +0 -1
- package/lib/typescript/utils/retryHelper.d.ts +0 -69
- package/lib/typescript/utils/retryHelper.d.ts.map +0 -1
- package/lib/typescript/utils/secureStorage.d.ts +0 -94
- package/lib/typescript/utils/secureStorage.d.ts.map +0 -1
- package/src/api/index.ts +0 -111
- package/src/assets/images/email.png +0 -0
- package/src/assets/images/linkedin.png +0 -0
- package/src/assets/images/onairos_logo.png +0 -0
- package/src/assets/images/reddit.png +0 -0
- package/src/assets/images/youtube.png +0 -0
- package/src/components/DataRequestModal.tsx +0 -227
- package/src/components/DataRequestScreen.tsx +0 -356
- package/src/components/EmailVerificationModal.tsx +0 -364
- package/src/components/Onairos.tsx +0 -425
- package/src/components/OnairosButton.tsx +0 -359
- package/src/components/Overlay.tsx +0 -506
- package/src/components/PinInput.tsx +0 -343
- package/src/components/PlatformList.tsx +0 -145
- package/src/components/TrainingModal.tsx +0 -737
- package/src/components/UniversalOnboarding.tsx +0 -1839
- package/src/components/UniversalOnboarding.tsx.new +0 -455
- package/src/components/onboarding/OAuthWebView.tsx +0 -838
- package/src/components/onboarding/OnboardingHeader.tsx +0 -70
- package/src/components/onboarding/PinInput.tsx +0 -356
- package/src/components/onboarding/PlatformConnector.tsx +0 -302
- package/src/components/screens/ConnectorScreen.tsx +0 -153
- package/src/components/screens/LoadingScreen.tsx +0 -100
- package/src/components/screens/PinCreationScreen.tsx +0 -67
- package/src/constants/index.ts +0 -83
- package/src/hooks/useConnections.ts +0 -163
- package/src/hooks/useCredentials.ts +0 -175
- package/src/index.js +0 -14
- package/src/index.ts +0 -50
- package/src/services/SDK_API_KEY_VALIDATION.md +0 -421
- package/src/services/apiKeyService.ts +0 -984
- package/src/services/oauthService.ts +0 -412
- package/src/services/platformAuthService.ts +0 -1113
- package/src/types/ambient.d.ts +0 -29
- package/src/types/declarations.d.ts +0 -26
- package/src/types/index.d.ts +0 -274
- package/src/types/index.ts +0 -244
- package/src/types/node-fix.d.ts +0 -19
- package/src/types/node-override.d.ts +0 -24
- package/src/types/opacity.d.ts +0 -16
- package/src/types/types.d.ts +0 -18
- package/src/types.ts +0 -298
- package/src/utils/Portal.tsx +0 -83
- package/src/utils/api.js +0 -112
- package/src/utils/auth.js +0 -104
- package/src/utils/crypto.js +0 -60
- package/src/utils/debugHelper.ts +0 -53
- package/src/utils/encryption.ts +0 -69
- package/src/utils/onairosApi.ts +0 -391
- package/src/utils/programmaticFlow.ts +0 -113
- package/src/utils/retryHelper.ts +0 -275
- package/src/utils/secureStorage.ts +0 -361
- package/types/index.d.ts +0 -218
- package/types/node-env.d.ts +0 -15
- /package/{src/assets/images → lib/commonjs/assets/icons}/farcaster.png +0 -0
- /package/{src/assets/images → lib/commonjs/assets/icons}/instagram.png +0 -0
- /package/{src/assets/images → lib/commonjs/assets/icons}/pinterest.png +0 -0
- /package/{src/assets/images → lib/commonjs/assets/icons}/swerv_logo.png +0 -0
- /package/{src/assets/images → lib/commonjs/assets/icons}/twitter.jpg +0 -0
|
@@ -1,925 +1 @@
|
|
|
1
|
-
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
2
|
-
import NetInfo from '@react-native-community/netinfo';
|
|
3
|
-
|
|
4
|
-
// Admin key for backend validation
|
|
5
|
-
export const ADMIN_API_KEY = 'OnairosIsAUnicorn2025';
|
|
6
|
-
|
|
7
|
-
// API key types
|
|
8
|
-
export let ApiKeyType = /*#__PURE__*/function (ApiKeyType) {
|
|
9
|
-
ApiKeyType["DEVELOPER"] = "developer";
|
|
10
|
-
ApiKeyType["ADMIN"] = "admin";
|
|
11
|
-
ApiKeyType["INVALID"] = "invalid";
|
|
12
|
-
return ApiKeyType;
|
|
13
|
-
}({});
|
|
14
|
-
|
|
15
|
-
// JWT token storage key
|
|
16
|
-
const JWT_TOKEN_KEY = 'onairos_jwt_token';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Two-Tier Authentication Service for Onairos React Native SDK
|
|
20
|
-
*
|
|
21
|
-
* This service implements the two-tier authentication system:
|
|
22
|
-
* 1. Developer API Keys: For app-level operations (email verification, app registration)
|
|
23
|
-
* 2. JWT User Tokens: For user-level operations (PIN storage, user profile)
|
|
24
|
-
*
|
|
25
|
-
* How it works:
|
|
26
|
-
* 1. Initialize with developer API key
|
|
27
|
-
* 2. Use API key for email verification requests
|
|
28
|
-
* 3. Store JWT token from email verification response
|
|
29
|
-
* 4. Use JWT token for user-authenticated requests
|
|
30
|
-
* 5. Handle token expiration gracefully
|
|
31
|
-
*
|
|
32
|
-
* Backend Integration:
|
|
33
|
-
* - Developer routes: Authorization: Bearer ${API_KEY}
|
|
34
|
-
* - User routes: Authorization: Bearer ${JWT_TOKEN}
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
// Global configuration state
|
|
38
|
-
let globalConfig = null;
|
|
39
|
-
let validationCache = new Map();
|
|
40
|
-
let isInitialized = false;
|
|
41
|
-
let userToken = null;
|
|
42
|
-
|
|
43
|
-
// Cache duration (5 minutes)
|
|
44
|
-
const CACHE_DURATION = 5 * 60 * 1000;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Check network connectivity
|
|
48
|
-
* @returns Promise<boolean> - true if connected, false otherwise
|
|
49
|
-
*/
|
|
50
|
-
const checkNetworkConnectivity = async () => {
|
|
51
|
-
try {
|
|
52
|
-
const netInfo = await NetInfo.fetch();
|
|
53
|
-
return netInfo.isConnected === true && netInfo.isInternetReachable !== false;
|
|
54
|
-
} catch (error) {
|
|
55
|
-
console.warn('⚠️ Failed to check network connectivity:', error);
|
|
56
|
-
// If we can't check connectivity, assume we're connected and let the request fail naturally
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
// API endpoints for different environments (updated to handle non-existent dev endpoint)
|
|
62
|
-
const API_ENDPOINTS = {
|
|
63
|
-
production: 'https://api2.onairos.uk',
|
|
64
|
-
staging: 'https://api2.onairos.uk',
|
|
65
|
-
// Fallback to production for staging
|
|
66
|
-
development: 'https://api2.onairos.uk' // Fallback to production since dev-api2.onairos.uk doesn't exist
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Initialize the SDK with developer API key
|
|
71
|
-
* @param config API configuration including developer API key
|
|
72
|
-
*/
|
|
73
|
-
export const initializeApiKey = async config => {
|
|
74
|
-
try {
|
|
75
|
-
console.log('🔑 Initializing Onairos SDK with developer API key...');
|
|
76
|
-
if (!config.apiKey) {
|
|
77
|
-
throw new Error('Developer API key is required for SDK initialization');
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Check if it's admin key first (admin key is shorter than 32 chars)
|
|
81
|
-
if (!isAdminKey(config.apiKey) && config.apiKey.length < 32) {
|
|
82
|
-
throw new Error('Invalid API key format. Developer keys must be at least 32 characters long.');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Set global configuration
|
|
86
|
-
globalConfig = {
|
|
87
|
-
apiKey: config.apiKey,
|
|
88
|
-
environment: config.environment || 'production',
|
|
89
|
-
enableLogging: config.enableLogging !== false,
|
|
90
|
-
// Default to true
|
|
91
|
-
timeout: config.timeout || 30000,
|
|
92
|
-
retryAttempts: config.retryAttempts || 3
|
|
93
|
-
};
|
|
94
|
-
if (globalConfig.enableLogging) {
|
|
95
|
-
console.log('📝 SDK Configuration:', {
|
|
96
|
-
environment: globalConfig.environment,
|
|
97
|
-
timeout: globalConfig.timeout,
|
|
98
|
-
retryAttempts: globalConfig.retryAttempts,
|
|
99
|
-
apiKeyPrefix: config.apiKey.substring(0, 8) + '...',
|
|
100
|
-
enableLogging: globalConfig.enableLogging
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Validate the API key (handles both admin and developer keys)
|
|
105
|
-
const validation = await validateApiKey(config.apiKey);
|
|
106
|
-
if (!validation.isValid) {
|
|
107
|
-
// Use defensive coding to handle cases where validation.error might be undefined
|
|
108
|
-
const errorMessage = validation.error || '';
|
|
109
|
-
|
|
110
|
-
// Check if it's a network/connectivity issue (either from error message or the flag)
|
|
111
|
-
const isNetworkError = validation.isNetworkError || errorMessage.includes('Network request failed') || errorMessage.includes('Network error') || errorMessage.includes('JSON Parse error') || errorMessage.includes('API validation endpoint returned') || errorMessage.includes('timeout') || errorMessage.includes('ENOTFOUND') || errorMessage.includes('fetch') || errorMessage.includes('No network connection');
|
|
112
|
-
if (isNetworkError) {
|
|
113
|
-
console.warn('⚠️ API key validation failed due to network/connectivity issues');
|
|
114
|
-
console.warn('🔄 Continuing in offline mode with basic validation');
|
|
115
|
-
console.warn('📝 SDK will function with limited validation. Network connectivity will be retried automatically.');
|
|
116
|
-
console.warn('🌐 Error details:', validation.error);
|
|
117
|
-
|
|
118
|
-
// Continue initialization in offline mode - don't throw error
|
|
119
|
-
console.log('📱 SDK initialized in offline mode - will retry validation when network is available');
|
|
120
|
-
} else {
|
|
121
|
-
// Only throw for actual API key validation errors (not network issues)
|
|
122
|
-
throw new Error(`API key validation failed: ${validation.error}`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Try to load existing JWT token
|
|
127
|
-
await loadJWT();
|
|
128
|
-
isInitialized = true;
|
|
129
|
-
if (globalConfig.enableLogging) {
|
|
130
|
-
console.log('✅ Onairos SDK initialized successfully');
|
|
131
|
-
if (isAdminKey(config.apiKey)) {
|
|
132
|
-
console.log('🔑 Admin API key ready with full permissions');
|
|
133
|
-
} else {
|
|
134
|
-
console.log('🔑 Developer API key ready for app-level operations');
|
|
135
|
-
}
|
|
136
|
-
if (userToken) {
|
|
137
|
-
console.log('🎫 User JWT token loaded from storage');
|
|
138
|
-
}
|
|
139
|
-
if (validation.permissions) {
|
|
140
|
-
console.log('🔐 API Key Permissions:', validation.permissions);
|
|
141
|
-
}
|
|
142
|
-
if (validation.rateLimits) {
|
|
143
|
-
console.log('⏱️ Rate Limits:', validation.rateLimits);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
} catch (error) {
|
|
147
|
-
console.error('❌ Failed to initialize Onairos SDK:', error);
|
|
148
|
-
isInitialized = false;
|
|
149
|
-
throw error;
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Determine API key type
|
|
155
|
-
* @param apiKey The API key to check
|
|
156
|
-
* @returns The type of API key
|
|
157
|
-
*/
|
|
158
|
-
export const getApiKeyType = apiKey => {
|
|
159
|
-
if (apiKey === ADMIN_API_KEY) {
|
|
160
|
-
return ApiKeyType.ADMIN;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Developer keys should be at least 32 characters and start with specific prefix
|
|
164
|
-
if (apiKey.length >= 32 && (apiKey.startsWith('dev_') || apiKey.startsWith('pk_') || apiKey.startsWith('ona_'))) {
|
|
165
|
-
return ApiKeyType.DEVELOPER;
|
|
166
|
-
}
|
|
167
|
-
return ApiKeyType.INVALID;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Check if API key is admin key
|
|
172
|
-
* @param apiKey The API key to check
|
|
173
|
-
* @returns True if admin key
|
|
174
|
-
*/
|
|
175
|
-
export const isAdminKey = apiKey => {
|
|
176
|
-
return apiKey === ADMIN_API_KEY;
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Validate an API key with the Onairos backend
|
|
181
|
-
* @param apiKey The API key to validate
|
|
182
|
-
* @returns Validation result with permissions and rate limits
|
|
183
|
-
*/
|
|
184
|
-
export const validateApiKey = async apiKey => {
|
|
185
|
-
try {
|
|
186
|
-
var _globalConfig2, _globalConfig3, _globalConfig4;
|
|
187
|
-
console.log('🔍 Validating API key...');
|
|
188
|
-
|
|
189
|
-
// Check if it's an admin key
|
|
190
|
-
if (isAdminKey(apiKey)) {
|
|
191
|
-
console.log('🔑 Admin key detected - granting full permissions');
|
|
192
|
-
return {
|
|
193
|
-
isValid: true,
|
|
194
|
-
permissions: ['*'],
|
|
195
|
-
// Full permissions for admin
|
|
196
|
-
rateLimits: {
|
|
197
|
-
remaining: 999999,
|
|
198
|
-
resetTime: Date.now() + 24 * 60 * 60 * 1000 // 24 hours
|
|
199
|
-
},
|
|
200
|
-
keyType: ApiKeyType.ADMIN
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Check basic format for developer keys
|
|
205
|
-
const keyType = getApiKeyType(apiKey);
|
|
206
|
-
if (keyType === ApiKeyType.INVALID) {
|
|
207
|
-
return {
|
|
208
|
-
isValid: false,
|
|
209
|
-
error: 'Invalid API key format. Developer keys must be at least 32 characters and start with "dev_", "pk_", or "ona_"',
|
|
210
|
-
keyType: ApiKeyType.INVALID
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// Check cache first
|
|
215
|
-
const cached = validationCache.get(apiKey);
|
|
216
|
-
if (cached && Date.now() - cached.timestamp < CACHE_DURATION) {
|
|
217
|
-
var _globalConfig;
|
|
218
|
-
if ((_globalConfig = globalConfig) !== null && _globalConfig !== void 0 && _globalConfig.enableLogging) {
|
|
219
|
-
console.log('📋 Using cached API key validation result');
|
|
220
|
-
}
|
|
221
|
-
return cached.result;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Check network connectivity before making API calls
|
|
225
|
-
const isConnected = await checkNetworkConnectivity();
|
|
226
|
-
if (!isConnected) {
|
|
227
|
-
console.warn('⚠️ No network connectivity detected');
|
|
228
|
-
return {
|
|
229
|
-
isValid: false,
|
|
230
|
-
error: 'No network connection available. Please check your internet connection and try again.',
|
|
231
|
-
keyType: keyType,
|
|
232
|
-
isNetworkError: true
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
const environment = ((_globalConfig2 = globalConfig) === null || _globalConfig2 === void 0 ? void 0 : _globalConfig2.environment) || 'production';
|
|
236
|
-
const baseUrl = API_ENDPOINTS[environment];
|
|
237
|
-
const timeout = ((_globalConfig3 = globalConfig) === null || _globalConfig3 === void 0 ? void 0 : _globalConfig3.timeout) || 30000;
|
|
238
|
-
const maxRetries = ((_globalConfig4 = globalConfig) === null || _globalConfig4 === void 0 ? void 0 : _globalConfig4.retryAttempts) || 3;
|
|
239
|
-
|
|
240
|
-
// Retry logic for network failures
|
|
241
|
-
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
242
|
-
// Create abort controller for timeout
|
|
243
|
-
const controller = new AbortController();
|
|
244
|
-
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
245
|
-
try {
|
|
246
|
-
var _globalConfig5;
|
|
247
|
-
if ((_globalConfig5 = globalConfig) !== null && _globalConfig5 !== void 0 && _globalConfig5.enableLogging && attempt > 1) {
|
|
248
|
-
console.log(`🔄 Retry attempt ${attempt}/${maxRetries} for API key validation`);
|
|
249
|
-
}
|
|
250
|
-
const response = await fetch(`${baseUrl}/dev/validate`, {
|
|
251
|
-
method: 'POST',
|
|
252
|
-
headers: {
|
|
253
|
-
'Content-Type': 'application/json',
|
|
254
|
-
'Authorization': `Bearer ${apiKey}`,
|
|
255
|
-
'User-Agent': 'OnairosReactNative/3.3.1',
|
|
256
|
-
'X-API-Key-Type': keyType,
|
|
257
|
-
'X-SDK-Platform': 'react-native',
|
|
258
|
-
'X-Retry-Attempt': attempt.toString()
|
|
259
|
-
},
|
|
260
|
-
body: JSON.stringify({
|
|
261
|
-
environment,
|
|
262
|
-
sdk_version: '3.3.1',
|
|
263
|
-
platform: 'react-native',
|
|
264
|
-
keyType,
|
|
265
|
-
timestamp: new Date().toISOString(),
|
|
266
|
-
attempt
|
|
267
|
-
}),
|
|
268
|
-
signal: controller.signal
|
|
269
|
-
});
|
|
270
|
-
clearTimeout(timeoutId);
|
|
271
|
-
|
|
272
|
-
// First check if we got a valid response
|
|
273
|
-
if (!response) {
|
|
274
|
-
throw new Error('No response received from server');
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// Handle common HTTP errors that indicate server issues
|
|
278
|
-
if (response.status === 502) {
|
|
279
|
-
throw new Error('Onairos API is temporarily unavailable (502 Bad Gateway). Please try again later.');
|
|
280
|
-
}
|
|
281
|
-
if (response.status === 503) {
|
|
282
|
-
throw new Error('Onairos API is under maintenance (503 Service Unavailable). Please try again later.');
|
|
283
|
-
}
|
|
284
|
-
if (response.status === 504) {
|
|
285
|
-
throw new Error('Onairos API request timed out (504 Gateway Timeout). Please try again.');
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// Check if response is actually JSON before trying to parse
|
|
289
|
-
const contentType = response.headers.get('content-type');
|
|
290
|
-
const isJsonResponse = contentType && contentType.includes('application/json');
|
|
291
|
-
if (!isJsonResponse) {
|
|
292
|
-
const textContent = await response.text();
|
|
293
|
-
const previewText = textContent.substring(0, 200);
|
|
294
|
-
console.error('❌ API endpoint returned non-JSON response:', {
|
|
295
|
-
status: response.status,
|
|
296
|
-
statusText: response.statusText,
|
|
297
|
-
contentType: contentType || 'unknown',
|
|
298
|
-
preview: previewText,
|
|
299
|
-
url: `${baseUrl}/dev/validate`,
|
|
300
|
-
attempt: attempt
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
// Handle specific error cases
|
|
304
|
-
if (response.status === 404) {
|
|
305
|
-
throw new Error(`API validation endpoint not found (404). The endpoint ${baseUrl}/dev/validate may not exist or be configured correctly.`);
|
|
306
|
-
} else if (response.status === 500) {
|
|
307
|
-
throw new Error(`Server error (500). The Onairos backend is experiencing issues.`);
|
|
308
|
-
} else if (response.status === 502 || response.status === 503) {
|
|
309
|
-
throw new Error(`Service unavailable (${response.status}). The Onairos backend may be temporarily down.`);
|
|
310
|
-
} else if (textContent.includes('<html') || textContent.includes('<!DOCTYPE')) {
|
|
311
|
-
throw new Error(`Server returned HTML page instead of JSON API response. This often indicates a routing issue or server misconfiguration.`);
|
|
312
|
-
} else {
|
|
313
|
-
throw new Error(`API validation endpoint returned ${response.status} - ${response.statusText}. Expected JSON but got ${contentType || 'unknown content type'}.`);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
// Parse JSON response
|
|
318
|
-
let data;
|
|
319
|
-
try {
|
|
320
|
-
data = await response.json();
|
|
321
|
-
} catch (jsonError) {
|
|
322
|
-
console.error('❌ Failed to parse JSON response:', {
|
|
323
|
-
error: jsonError.message,
|
|
324
|
-
status: response.status,
|
|
325
|
-
contentType,
|
|
326
|
-
attempt: attempt
|
|
327
|
-
});
|
|
328
|
-
throw new Error(`Failed to parse server response as JSON: ${jsonError.message}`);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
// Handle successful response
|
|
332
|
-
// Backend returns either {success: true} or {valid: true}
|
|
333
|
-
if (response.ok && (data.success || data.valid)) {
|
|
334
|
-
var _globalConfig6;
|
|
335
|
-
const result = {
|
|
336
|
-
isValid: true,
|
|
337
|
-
permissions: data.permissions || [],
|
|
338
|
-
rateLimits: data.rateLimits || null,
|
|
339
|
-
keyType: keyType
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
// Cache the successful result
|
|
343
|
-
validationCache.set(apiKey, {
|
|
344
|
-
result,
|
|
345
|
-
timestamp: Date.now()
|
|
346
|
-
});
|
|
347
|
-
if ((_globalConfig6 = globalConfig) !== null && _globalConfig6 !== void 0 && _globalConfig6.enableLogging) {
|
|
348
|
-
var _data$apiKey, _data$application, _data$apiKey2;
|
|
349
|
-
console.log('✅ API key validation successful', {
|
|
350
|
-
apiKeyId: (_data$apiKey = data.apiKey) === null || _data$apiKey === void 0 ? void 0 : _data$apiKey.id,
|
|
351
|
-
appName: (_data$application = data.application) === null || _data$application === void 0 ? void 0 : _data$application.name,
|
|
352
|
-
usageCount: (_data$apiKey2 = data.apiKey) === null || _data$apiKey2 === void 0 ? void 0 : _data$apiKey2.usageCount
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
return result;
|
|
356
|
-
} else {
|
|
357
|
-
// Handle API errors (invalid key, etc.)
|
|
358
|
-
const errorMessage = data.error || data.message || `HTTP ${response.status}: ${response.statusText}`;
|
|
359
|
-
const result = {
|
|
360
|
-
isValid: false,
|
|
361
|
-
error: errorMessage,
|
|
362
|
-
keyType: keyType
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
// For client errors (4xx), don't retry
|
|
366
|
-
if (response.status >= 400 && response.status < 500) {
|
|
367
|
-
var _globalConfig7;
|
|
368
|
-
if ((_globalConfig7 = globalConfig) !== null && _globalConfig7 !== void 0 && _globalConfig7.enableLogging) {
|
|
369
|
-
console.error('❌ API key validation failed (client error):', errorMessage);
|
|
370
|
-
}
|
|
371
|
-
return result;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
// For server errors (5xx), retry
|
|
375
|
-
throw new Error(errorMessage);
|
|
376
|
-
}
|
|
377
|
-
} catch (fetchError) {
|
|
378
|
-
var _globalConfig8;
|
|
379
|
-
clearTimeout(timeoutId);
|
|
380
|
-
if (fetchError.name === 'AbortError') {
|
|
381
|
-
const errorMessage = `API key validation timeout (${timeout}ms)`;
|
|
382
|
-
console.error('⏱️ API key validation timeout');
|
|
383
|
-
if (attempt === maxRetries) {
|
|
384
|
-
return {
|
|
385
|
-
isValid: false,
|
|
386
|
-
error: errorMessage,
|
|
387
|
-
keyType: keyType
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
continue; // Retry timeout errors
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
// Enhanced error message based on error type
|
|
394
|
-
let errorMessage = `Network error during API key validation: ${fetchError.message}`;
|
|
395
|
-
|
|
396
|
-
// Add specific guidance for common errors
|
|
397
|
-
if (fetchError.message.includes('JSON Parse error') || fetchError.message.includes('Unexpected character')) {
|
|
398
|
-
errorMessage = `Server returned invalid JSON response. This usually indicates the API endpoint returned HTML instead of JSON (often a 404 or server error page). ${fetchError.message}`;
|
|
399
|
-
} else if (fetchError.message.includes('Network request failed') || fetchError.message.includes('fetch')) {
|
|
400
|
-
errorMessage = `Network connectivity issue. Please check internet connection and verify the Onairos API is accessible. ${fetchError.message}`;
|
|
401
|
-
} else if (fetchError.message.includes('DNS') || fetchError.message.includes('ENOTFOUND')) {
|
|
402
|
-
errorMessage = `DNS resolution failed for ${baseUrl}. Please check network settings and domain accessibility. ${fetchError.message}`;
|
|
403
|
-
}
|
|
404
|
-
console.error('🌐 Network error during API key validation:', {
|
|
405
|
-
error: fetchError,
|
|
406
|
-
endpoint: `${baseUrl}/dev/validate`,
|
|
407
|
-
attempt: attempt,
|
|
408
|
-
maxRetries: maxRetries,
|
|
409
|
-
retryable: attempt < maxRetries
|
|
410
|
-
});
|
|
411
|
-
|
|
412
|
-
// If this is the last attempt, return the error
|
|
413
|
-
if (attempt === maxRetries) {
|
|
414
|
-
return {
|
|
415
|
-
isValid: false,
|
|
416
|
-
error: errorMessage,
|
|
417
|
-
keyType: keyType,
|
|
418
|
-
isNetworkError: true // Flag to indicate this is a network issue, not an API key issue
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
// Wait before retrying (exponential backoff)
|
|
423
|
-
const backoffDelay = Math.min(1000 * Math.pow(2, attempt - 1), 5000);
|
|
424
|
-
if ((_globalConfig8 = globalConfig) !== null && _globalConfig8 !== void 0 && _globalConfig8.enableLogging) {
|
|
425
|
-
console.log(`⏳ Waiting ${backoffDelay}ms before retry...`);
|
|
426
|
-
}
|
|
427
|
-
await new Promise(resolve => setTimeout(() => resolve(), backoffDelay));
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
// This should never be reached, but just in case
|
|
432
|
-
return {
|
|
433
|
-
isValid: false,
|
|
434
|
-
error: 'All retry attempts exhausted',
|
|
435
|
-
keyType: keyType
|
|
436
|
-
};
|
|
437
|
-
} catch (error) {
|
|
438
|
-
const errorMessage = `API key validation error: ${error.message}`;
|
|
439
|
-
console.error('❌ API key validation error:', error);
|
|
440
|
-
return {
|
|
441
|
-
isValid: false,
|
|
442
|
-
error: errorMessage,
|
|
443
|
-
keyType: ApiKeyType.INVALID
|
|
444
|
-
};
|
|
445
|
-
}
|
|
446
|
-
};
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
* Get the current API configuration
|
|
450
|
-
* @returns Current API configuration or null if not initialized
|
|
451
|
-
*/
|
|
452
|
-
export const getApiConfig = () => {
|
|
453
|
-
return globalConfig;
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Get the current API key
|
|
458
|
-
* @returns Current API key or null if not initialized
|
|
459
|
-
*/
|
|
460
|
-
export const getApiKey = () => {
|
|
461
|
-
var _globalConfig9;
|
|
462
|
-
return ((_globalConfig9 = globalConfig) === null || _globalConfig9 === void 0 ? void 0 : _globalConfig9.apiKey) || null;
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* Check if the SDK is properly initialized
|
|
467
|
-
* @returns True if initialized with valid API key
|
|
468
|
-
*/
|
|
469
|
-
export const isApiKeyInitialized = () => {
|
|
470
|
-
return isInitialized && globalConfig !== null;
|
|
471
|
-
};
|
|
472
|
-
|
|
473
|
-
/**
|
|
474
|
-
* Store JWT token securely after email verification
|
|
475
|
-
* @param token JWT token from email verification response
|
|
476
|
-
*/
|
|
477
|
-
export const storeJWT = async token => {
|
|
478
|
-
try {
|
|
479
|
-
var _globalConfig0;
|
|
480
|
-
await AsyncStorage.setItem(JWT_TOKEN_KEY, token);
|
|
481
|
-
userToken = token;
|
|
482
|
-
if ((_globalConfig0 = globalConfig) !== null && _globalConfig0 !== void 0 && _globalConfig0.enableLogging) {
|
|
483
|
-
console.log('🎫 JWT token stored successfully');
|
|
484
|
-
}
|
|
485
|
-
} catch (error) {
|
|
486
|
-
console.error('❌ Failed to store JWT token:', error);
|
|
487
|
-
throw error;
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
/**
|
|
492
|
-
* Load JWT token from storage
|
|
493
|
-
* @returns JWT token or null if not found
|
|
494
|
-
*/
|
|
495
|
-
export const loadJWT = async () => {
|
|
496
|
-
try {
|
|
497
|
-
const token = await AsyncStorage.getItem(JWT_TOKEN_KEY);
|
|
498
|
-
userToken = token;
|
|
499
|
-
return token;
|
|
500
|
-
} catch (error) {
|
|
501
|
-
console.error('❌ Failed to load JWT token:', error);
|
|
502
|
-
return null;
|
|
503
|
-
}
|
|
504
|
-
};
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
* Get current JWT token
|
|
508
|
-
* @returns JWT token or null if not available
|
|
509
|
-
*/
|
|
510
|
-
export const getJWT = () => {
|
|
511
|
-
return userToken;
|
|
512
|
-
};
|
|
513
|
-
|
|
514
|
-
/**
|
|
515
|
-
* Clear JWT token (on logout or token expiration)
|
|
516
|
-
*/
|
|
517
|
-
export const clearJWT = async () => {
|
|
518
|
-
try {
|
|
519
|
-
var _globalConfig1;
|
|
520
|
-
await AsyncStorage.removeItem(JWT_TOKEN_KEY);
|
|
521
|
-
userToken = null;
|
|
522
|
-
if ((_globalConfig1 = globalConfig) !== null && _globalConfig1 !== void 0 && _globalConfig1.enableLogging) {
|
|
523
|
-
console.log('🗑️ JWT token cleared');
|
|
524
|
-
}
|
|
525
|
-
} catch (error) {
|
|
526
|
-
console.error('❌ Failed to clear JWT token:', error);
|
|
527
|
-
}
|
|
528
|
-
};
|
|
529
|
-
|
|
530
|
-
/**
|
|
531
|
-
* React Native compatible base64 decoder
|
|
532
|
-
* @param str Base64 encoded string
|
|
533
|
-
* @returns Decoded string
|
|
534
|
-
*/
|
|
535
|
-
const base64Decode = str => {
|
|
536
|
-
// Simple base64 decoding for React Native
|
|
537
|
-
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
538
|
-
let result = '';
|
|
539
|
-
let i = 0;
|
|
540
|
-
str = str.replace(/[^A-Za-z0-9+/]/g, '');
|
|
541
|
-
while (i < str.length) {
|
|
542
|
-
const a = chars.indexOf(str.charAt(i++));
|
|
543
|
-
const b = chars.indexOf(str.charAt(i++));
|
|
544
|
-
const c = chars.indexOf(str.charAt(i++));
|
|
545
|
-
const d = chars.indexOf(str.charAt(i++));
|
|
546
|
-
const bitmap = a << 18 | b << 12 | c << 6 | d;
|
|
547
|
-
result += String.fromCharCode(bitmap >> 16 & 255);
|
|
548
|
-
if (c !== 64) result += String.fromCharCode(bitmap >> 8 & 255);
|
|
549
|
-
if (d !== 64) result += String.fromCharCode(bitmap & 255);
|
|
550
|
-
}
|
|
551
|
-
return result;
|
|
552
|
-
};
|
|
553
|
-
|
|
554
|
-
/**
|
|
555
|
-
* Decode JWT token payload (React Native compatible)
|
|
556
|
-
* @param token JWT token string
|
|
557
|
-
* @returns Decoded payload or null if invalid
|
|
558
|
-
*/
|
|
559
|
-
export const decodeJWTPayload = token => {
|
|
560
|
-
try {
|
|
561
|
-
// Split JWT token (header.payload.signature)
|
|
562
|
-
const parts = token.split('.');
|
|
563
|
-
if (parts.length !== 3) {
|
|
564
|
-
console.error('❌ Invalid JWT token format');
|
|
565
|
-
return null;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
// Decode payload (base64url to base64)
|
|
569
|
-
const payload = parts[1];
|
|
570
|
-
const base64 = payload.replace(/-/g, '+').replace(/_/g, '/');
|
|
571
|
-
|
|
572
|
-
// Add padding if needed
|
|
573
|
-
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, '=');
|
|
574
|
-
|
|
575
|
-
// Decode base64 to JSON using React Native compatible decoder
|
|
576
|
-
const decoded = base64Decode(padded);
|
|
577
|
-
return JSON.parse(decoded);
|
|
578
|
-
} catch (error) {
|
|
579
|
-
console.error('❌ Failed to decode JWT token:', error);
|
|
580
|
-
return null;
|
|
581
|
-
}
|
|
582
|
-
};
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
* Extract username from JWT token
|
|
586
|
-
* @param token JWT token (optional, uses stored token if not provided)
|
|
587
|
-
* @returns Username or null if not found
|
|
588
|
-
*/
|
|
589
|
-
export const extractUsernameFromJWT = token => {
|
|
590
|
-
try {
|
|
591
|
-
var _globalConfig10;
|
|
592
|
-
const jwtToken = token || userToken;
|
|
593
|
-
if (!jwtToken) {
|
|
594
|
-
console.warn('⚠️ No JWT token available for username extraction');
|
|
595
|
-
return null;
|
|
596
|
-
}
|
|
597
|
-
const payload = decodeJWTPayload(jwtToken);
|
|
598
|
-
if (!payload) {
|
|
599
|
-
return null;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
// Try different possible username fields in order of preference
|
|
603
|
-
const username = payload.userName || payload.username || payload.userId || payload.email;
|
|
604
|
-
if ((_globalConfig10 = globalConfig) !== null && _globalConfig10 !== void 0 && _globalConfig10.enableLogging) {
|
|
605
|
-
console.log('👤 Extracted username from JWT:', username);
|
|
606
|
-
}
|
|
607
|
-
return username || null;
|
|
608
|
-
} catch (error) {
|
|
609
|
-
console.error('❌ Failed to extract username from JWT:', error);
|
|
610
|
-
return null;
|
|
611
|
-
}
|
|
612
|
-
};
|
|
613
|
-
|
|
614
|
-
/**
|
|
615
|
-
* Extract user data from JWT token
|
|
616
|
-
* @param token JWT token (optional, uses stored token if not provided)
|
|
617
|
-
* @returns User data object or null if not found
|
|
618
|
-
*/
|
|
619
|
-
export const extractUserDataFromJWT = token => {
|
|
620
|
-
try {
|
|
621
|
-
var _globalConfig11;
|
|
622
|
-
const jwtToken = token || userToken;
|
|
623
|
-
if (!jwtToken) {
|
|
624
|
-
console.warn('⚠️ No JWT token available for user data extraction');
|
|
625
|
-
return null;
|
|
626
|
-
}
|
|
627
|
-
const payload = decodeJWTPayload(jwtToken);
|
|
628
|
-
if (!payload) {
|
|
629
|
-
return null;
|
|
630
|
-
}
|
|
631
|
-
const userData = {
|
|
632
|
-
id: payload.id,
|
|
633
|
-
email: payload.email,
|
|
634
|
-
userId: payload.userId,
|
|
635
|
-
userName: payload.userName || payload.username,
|
|
636
|
-
verified: payload.verified,
|
|
637
|
-
iat: payload.iat,
|
|
638
|
-
exp: payload.exp
|
|
639
|
-
};
|
|
640
|
-
if ((_globalConfig11 = globalConfig) !== null && _globalConfig11 !== void 0 && _globalConfig11.enableLogging) {
|
|
641
|
-
console.log('👤 Extracted user data from JWT:', userData);
|
|
642
|
-
}
|
|
643
|
-
return userData;
|
|
644
|
-
} catch (error) {
|
|
645
|
-
console.error('❌ Failed to extract user data from JWT:', error);
|
|
646
|
-
return null;
|
|
647
|
-
}
|
|
648
|
-
};
|
|
649
|
-
|
|
650
|
-
/**
|
|
651
|
-
* Check if user is authenticated with JWT token
|
|
652
|
-
* @returns True if user has valid JWT token
|
|
653
|
-
*/
|
|
654
|
-
export const isUserAuthenticated = () => {
|
|
655
|
-
return !!userToken;
|
|
656
|
-
};
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
* Get authenticated headers for API requests
|
|
660
|
-
* @returns Headers object with Authorization and other required headers
|
|
661
|
-
*/
|
|
662
|
-
export const getAuthHeaders = () => {
|
|
663
|
-
var _globalConfig12;
|
|
664
|
-
if (!((_globalConfig12 = globalConfig) !== null && _globalConfig12 !== void 0 && _globalConfig12.apiKey)) {
|
|
665
|
-
throw new Error('SDK not initialized. Call initializeApiKey() first.');
|
|
666
|
-
}
|
|
667
|
-
const keyType = getApiKeyType(globalConfig.apiKey);
|
|
668
|
-
return {
|
|
669
|
-
'Content-Type': 'application/json',
|
|
670
|
-
'Authorization': `Bearer ${globalConfig.apiKey}`,
|
|
671
|
-
'User-Agent': 'OnairosReactNative/3.0.72',
|
|
672
|
-
'X-SDK-Version': '3.0.72',
|
|
673
|
-
'X-SDK-Environment': globalConfig.environment || 'production',
|
|
674
|
-
'X-API-Key-Type': keyType,
|
|
675
|
-
'X-Timestamp': new Date().toISOString()
|
|
676
|
-
};
|
|
677
|
-
};
|
|
678
|
-
|
|
679
|
-
/**
|
|
680
|
-
* Get authentication headers for developer API requests
|
|
681
|
-
* @returns Headers with developer API key
|
|
682
|
-
*/
|
|
683
|
-
export const getDeveloperAuthHeaders = () => {
|
|
684
|
-
var _globalConfig13;
|
|
685
|
-
if (!((_globalConfig13 = globalConfig) !== null && _globalConfig13 !== void 0 && _globalConfig13.apiKey)) {
|
|
686
|
-
throw new Error('SDK not initialized. Call initializeApiKey() first.');
|
|
687
|
-
}
|
|
688
|
-
const keyType = getApiKeyType(globalConfig.apiKey);
|
|
689
|
-
return {
|
|
690
|
-
'Content-Type': 'application/json',
|
|
691
|
-
'Authorization': `Bearer ${globalConfig.apiKey}`,
|
|
692
|
-
'User-Agent': 'OnairosSDK/1.0.0',
|
|
693
|
-
'X-SDK-Version': '3.0.72',
|
|
694
|
-
'X-SDK-Environment': globalConfig.environment || 'production',
|
|
695
|
-
'X-API-Key-Type': keyType,
|
|
696
|
-
'X-Timestamp': new Date().toISOString()
|
|
697
|
-
};
|
|
698
|
-
};
|
|
699
|
-
|
|
700
|
-
/**
|
|
701
|
-
* Get authentication headers for user JWT requests
|
|
702
|
-
* @returns Headers with user JWT token
|
|
703
|
-
*/
|
|
704
|
-
export const getUserAuthHeaders = () => {
|
|
705
|
-
var _globalConfig14;
|
|
706
|
-
if (!userToken) {
|
|
707
|
-
throw new Error('User not authenticated. Please verify email first.');
|
|
708
|
-
}
|
|
709
|
-
return {
|
|
710
|
-
'Content-Type': 'application/json',
|
|
711
|
-
'Authorization': `Bearer ${userToken}`,
|
|
712
|
-
'User-Agent': 'OnairosSDK/1.0.0',
|
|
713
|
-
'X-SDK-Version': '3.0.72',
|
|
714
|
-
'X-SDK-Environment': ((_globalConfig14 = globalConfig) === null || _globalConfig14 === void 0 ? void 0 : _globalConfig14.environment) || 'production'
|
|
715
|
-
};
|
|
716
|
-
};
|
|
717
|
-
|
|
718
|
-
/**
|
|
719
|
-
* Make an authenticated API request
|
|
720
|
-
* @param endpoint The API endpoint (relative to base URL)
|
|
721
|
-
* @param options Fetch options
|
|
722
|
-
* @returns Response promise
|
|
723
|
-
*/
|
|
724
|
-
export const makeAuthenticatedRequest = async (endpoint, options = {}) => {
|
|
725
|
-
if (!isApiKeyInitialized()) {
|
|
726
|
-
throw new Error('SDK not initialized. Call initializeApiKey() first.');
|
|
727
|
-
}
|
|
728
|
-
const config = getApiConfig();
|
|
729
|
-
const baseUrl = API_ENDPOINTS[config.environment || 'production'];
|
|
730
|
-
const url = `${baseUrl}${endpoint.startsWith('/') ? '' : '/'}${endpoint}`;
|
|
731
|
-
|
|
732
|
-
// Merge authentication headers
|
|
733
|
-
const headers = {
|
|
734
|
-
...getAuthHeaders(),
|
|
735
|
-
...(options.headers || {})
|
|
736
|
-
};
|
|
737
|
-
|
|
738
|
-
// Add timeout
|
|
739
|
-
const controller = new AbortController();
|
|
740
|
-
const timeoutId = setTimeout(() => controller.abort(), config.timeout || 30000);
|
|
741
|
-
try {
|
|
742
|
-
if (config.enableLogging) {
|
|
743
|
-
console.log(`🌐 Making authenticated request to: ${endpoint}`);
|
|
744
|
-
}
|
|
745
|
-
const response = await fetch(url, {
|
|
746
|
-
...options,
|
|
747
|
-
headers,
|
|
748
|
-
signal: controller.signal
|
|
749
|
-
});
|
|
750
|
-
clearTimeout(timeoutId);
|
|
751
|
-
if (config.enableLogging) {
|
|
752
|
-
console.log(`📡 Response status: ${response.status} for ${endpoint}`);
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
// Handle API key errors
|
|
756
|
-
if (response.status === 401) {
|
|
757
|
-
console.error('❌ API key authentication failed. Please check your API key.');
|
|
758
|
-
throw new Error('Invalid or expired API key');
|
|
759
|
-
}
|
|
760
|
-
if (response.status === 403) {
|
|
761
|
-
console.error('❌ API key permissions insufficient for this operation.');
|
|
762
|
-
throw new Error('Insufficient API key permissions');
|
|
763
|
-
}
|
|
764
|
-
if (response.status === 429) {
|
|
765
|
-
console.error('❌ API rate limit exceeded. Please try again later.');
|
|
766
|
-
throw new Error('Rate limit exceeded');
|
|
767
|
-
}
|
|
768
|
-
return response;
|
|
769
|
-
} catch (error) {
|
|
770
|
-
clearTimeout(timeoutId);
|
|
771
|
-
if (error.name === 'AbortError') {
|
|
772
|
-
console.error('⏱️ Request timeout for:', endpoint);
|
|
773
|
-
throw new Error('Request timeout');
|
|
774
|
-
}
|
|
775
|
-
throw error;
|
|
776
|
-
}
|
|
777
|
-
};
|
|
778
|
-
|
|
779
|
-
/**
|
|
780
|
-
* Make authenticated request with developer API key
|
|
781
|
-
* @param endpoint The API endpoint
|
|
782
|
-
* @param options Fetch options
|
|
783
|
-
* @returns Response promise
|
|
784
|
-
*/
|
|
785
|
-
export const makeDeveloperRequest = async (endpoint, options = {}) => {
|
|
786
|
-
if (!isApiKeyInitialized()) {
|
|
787
|
-
throw new Error('SDK not initialized. Call initializeApiKey() first.');
|
|
788
|
-
}
|
|
789
|
-
const config = getApiConfig();
|
|
790
|
-
const baseUrl = API_ENDPOINTS[config.environment || 'production'];
|
|
791
|
-
const url = `${baseUrl}${endpoint.startsWith('/') ? '' : '/'}${endpoint}`;
|
|
792
|
-
|
|
793
|
-
// Merge developer authentication headers
|
|
794
|
-
const headers = {
|
|
795
|
-
...getDeveloperAuthHeaders(),
|
|
796
|
-
...(options.headers || {})
|
|
797
|
-
};
|
|
798
|
-
|
|
799
|
-
// Add timeout
|
|
800
|
-
const controller = new AbortController();
|
|
801
|
-
const timeoutId = setTimeout(() => controller.abort(), config.timeout || 30000);
|
|
802
|
-
try {
|
|
803
|
-
if (config.enableLogging) {
|
|
804
|
-
console.log(`🌐 Making developer request to: ${endpoint}`);
|
|
805
|
-
}
|
|
806
|
-
const response = await fetch(url, {
|
|
807
|
-
...options,
|
|
808
|
-
headers,
|
|
809
|
-
signal: controller.signal
|
|
810
|
-
});
|
|
811
|
-
clearTimeout(timeoutId);
|
|
812
|
-
if (config.enableLogging) {
|
|
813
|
-
console.log(`📡 Developer request response: ${response.status} for ${endpoint}`);
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
// Handle API key errors
|
|
817
|
-
if (response.status === 401) {
|
|
818
|
-
console.error('❌ Developer API key authentication failed');
|
|
819
|
-
throw new Error('Invalid or expired API key');
|
|
820
|
-
}
|
|
821
|
-
if (response.status === 403) {
|
|
822
|
-
console.error('❌ Developer API key permissions insufficient');
|
|
823
|
-
throw new Error('Insufficient API key permissions');
|
|
824
|
-
}
|
|
825
|
-
if (response.status === 429) {
|
|
826
|
-
console.error('❌ API rate limit exceeded');
|
|
827
|
-
throw new Error('Rate limit exceeded');
|
|
828
|
-
}
|
|
829
|
-
return response;
|
|
830
|
-
} catch (error) {
|
|
831
|
-
clearTimeout(timeoutId);
|
|
832
|
-
if (error.name === 'AbortError') {
|
|
833
|
-
console.error('⏱️ Request timeout for:', endpoint);
|
|
834
|
-
throw new Error('Request timeout');
|
|
835
|
-
}
|
|
836
|
-
throw error;
|
|
837
|
-
}
|
|
838
|
-
};
|
|
839
|
-
|
|
840
|
-
/**
|
|
841
|
-
* Make authenticated request with user JWT token
|
|
842
|
-
* @param endpoint The API endpoint
|
|
843
|
-
* @param options Fetch options
|
|
844
|
-
* @returns Response promise
|
|
845
|
-
*/
|
|
846
|
-
export const makeUserRequest = async (endpoint, options = {}) => {
|
|
847
|
-
if (!isUserAuthenticated()) {
|
|
848
|
-
await loadJWT(); // Try to load from storage
|
|
849
|
-
}
|
|
850
|
-
if (!isUserAuthenticated()) {
|
|
851
|
-
throw new Error('User not authenticated. Please verify email first.');
|
|
852
|
-
}
|
|
853
|
-
const config = getApiConfig() || {
|
|
854
|
-
environment: 'production',
|
|
855
|
-
timeout: 30000,
|
|
856
|
-
enableLogging: false
|
|
857
|
-
};
|
|
858
|
-
const baseUrl = API_ENDPOINTS[config.environment || 'production'];
|
|
859
|
-
const url = `${baseUrl}${endpoint.startsWith('/') ? '' : '/'}${endpoint}`;
|
|
860
|
-
|
|
861
|
-
// Merge user authentication headers
|
|
862
|
-
const headers = {
|
|
863
|
-
...getUserAuthHeaders(),
|
|
864
|
-
...(options.headers || {})
|
|
865
|
-
};
|
|
866
|
-
|
|
867
|
-
// Add timeout
|
|
868
|
-
const controller = new AbortController();
|
|
869
|
-
const timeoutId = setTimeout(() => controller.abort(), config.timeout || 30000);
|
|
870
|
-
try {
|
|
871
|
-
if (config.enableLogging) {
|
|
872
|
-
console.log(`🌐 Making user request to: ${endpoint}`);
|
|
873
|
-
}
|
|
874
|
-
const response = await fetch(url, {
|
|
875
|
-
...options,
|
|
876
|
-
headers,
|
|
877
|
-
signal: controller.signal
|
|
878
|
-
});
|
|
879
|
-
clearTimeout(timeoutId);
|
|
880
|
-
if (config.enableLogging) {
|
|
881
|
-
console.log(`📡 User request response: ${response.status} for ${endpoint}`);
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
// Handle JWT token errors
|
|
885
|
-
if (response.status === 401) {
|
|
886
|
-
console.error('❌ JWT token authentication failed - token may be expired');
|
|
887
|
-
await clearJWT(); // Clear expired token
|
|
888
|
-
throw new Error('Authentication expired. Please verify email again.');
|
|
889
|
-
}
|
|
890
|
-
if (response.status === 403) {
|
|
891
|
-
console.error('❌ JWT token permissions insufficient');
|
|
892
|
-
throw new Error('Insufficient permissions for this operation');
|
|
893
|
-
}
|
|
894
|
-
return response;
|
|
895
|
-
} catch (error) {
|
|
896
|
-
clearTimeout(timeoutId);
|
|
897
|
-
if (error.name === 'AbortError') {
|
|
898
|
-
console.error('⏱️ Request timeout for:', endpoint);
|
|
899
|
-
throw new Error('Request timeout');
|
|
900
|
-
}
|
|
901
|
-
throw error;
|
|
902
|
-
}
|
|
903
|
-
};
|
|
904
|
-
|
|
905
|
-
/**
|
|
906
|
-
* Clear the API key validation cache
|
|
907
|
-
*/
|
|
908
|
-
export const clearValidationCache = () => {
|
|
909
|
-
var _globalConfig15;
|
|
910
|
-
validationCache.clear();
|
|
911
|
-
if ((_globalConfig15 = globalConfig) !== null && _globalConfig15 !== void 0 && _globalConfig15.enableLogging) {
|
|
912
|
-
console.log('🗑️ API key validation cache cleared');
|
|
913
|
-
}
|
|
914
|
-
};
|
|
915
|
-
|
|
916
|
-
/**
|
|
917
|
-
* Reset the SDK initialization state
|
|
918
|
-
*/
|
|
919
|
-
export const resetApiKeyService = () => {
|
|
920
|
-
globalConfig = null;
|
|
921
|
-
isInitialized = false;
|
|
922
|
-
clearValidationCache();
|
|
923
|
-
console.log('🔄 API key service reset');
|
|
924
|
-
};
|
|
925
|
-
//# sourceMappingURL=apiKeyService.js.map
|
|
1
|
+
import AsyncStorage from'@react-native-async-storage/async-storage';import NetInfo from'@react-native-community/netinfo';import{API_CONFIG}from'../config/api';export let ApiKeyType=function(_0x272e89){const _0x591e6c={'qukwe':'DEVELOPER','WIMPX':_0x2ff6(0x0),'BTKNU':'INVALID','mQWeq':_0x2ff6(0x1)};return _0x272e89[_0x591e6c['qukwe']]=_0x591e6c['WIMPX'],_0x272e89[_0x591e6c[_0x2ff6(0x2)]]=_0x591e6c[_0x2ff6(0x3)],_0x272e89;}({});const JWT_TOKEN_KEY=_0x2ff6(0x4);let globalConfig=null,validationCache=new Map(),isInitialized=![],userToken=null;const CACHE_DURATION=0x5*0x3c*0x3e8,checkNetworkConnectivity=async()=>{const _0x1c25ed={'OsIjP':function(_0x2d46f7,_0x5503b4){return _0x2d46f7!==_0x5503b4;},'HactT':_0x2ff6(0x5),'cfCfk':_0x2ff6(0x6),'OhjXp':function(_0x3bf11e,_0x179a86){return _0x3bf11e===_0x179a86;}};try{if(_0x1c25ed[_0x2ff6(0x7)](_0x1c25ed[_0x2ff6(0x8)],_0x1c25ed[_0x2ff6(0x9)])){const _0x320cbc=await NetInfo['fetch']();return _0x1c25ed['OhjXp'](_0x320cbc[_0x2ff6(0xa)],!![])&&_0x320cbc[_0x2ff6(0xb)]!==![];}else return{'isValid':![],'error':_0x8b475,'keyType':_0x21d3e8,'isNetworkError':!![]};}catch(_0x36bb6e){return console[_0x2ff6(0xc)](_0x2ff6(0xd),_0x36bb6e),!![];}},API_ENDPOINTS={'production':''+API_CONFIG[_0x2ff6(0xe)],'staging':''+API_CONFIG[_0x2ff6(0xe)],'development':''+API_CONFIG[_0x2ff6(0xe)]};export const initializeApiKey=async _0x1e5d43=>{const _0x1f6210={'aUmZn':_0x2ff6(0xf),'kmRzc':'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/','BfPCr':function(_0x3b11a6,_0x178508){return _0x3b11a6<_0x178508;},'ZiQDO':function(_0x5d0036,_0x4e311b){return _0x5d0036|_0x4e311b;},'LzMSJ':function(_0x2618e6,_0x3c925c){return _0x2618e6<<_0x3c925c;},'vwbwn':function(_0x3869cf,_0x4e6918){return _0x3869cf&_0x4e6918;},'CTmWa':function(_0x35c1a7,_0x1e03fc){return _0x35c1a7>>_0x1e03fc;},'PTUts':function(_0x4c7196,_0x4fe241){return _0x4c7196!==_0x4fe241;},'mFxmf':function(_0x5af383,_0x17f0b5){return _0x5af383!==_0x17f0b5;},'rjbbh':function(_0x486dbb,_0x220aa8){return _0x486dbb&_0x220aa8;},'rkiPB':_0x2ff6(0x10),'ZcwzJ':_0x2ff6(0x11),'ZfAtW':_0x2ff6(0x12),'xhSZQ':function(_0x100eb2,_0x4ce92e){return _0x100eb2<_0x4ce92e;},'Lpgzs':_0x2ff6(0x13),'fBDyw':'Invalid\x20API\x20key\x20format.\x20Developer\x20keys\x20must\x20be\x20at\x20least\x2032\x20characters\x20long.','qbRDn':_0x2ff6(0x14),'YHrHz':_0x2ff6(0x15),'pYjPi':'Invalid\x20API\x20key\x20format.\x20Developer\x20keys\x20must\x20start\x20with\x20dev_,\x20ona_,\x20or\x20pk_','DYNue':function(_0x53e799,_0x31b048){return _0x53e799!==_0x31b048;},'PPLtG':function(_0x3534ef,_0x5137b1){return _0x3534ef===_0x5137b1;},'uVepW':_0x2ff6(0x16),'CQfAR':_0x2ff6(0x17),'DZLtn':'📝\x20SDK\x20Configuration:','DKyCM':function(_0x1d532b,_0x5d52f3){return _0x1d532b+_0x5d52f3;},'NvIui':'Network\x20request\x20failed','amXzW':_0x2ff6(0x18),'tRfuU':_0x2ff6(0x19),'bpPng':_0x2ff6(0x1a),'IoiHr':_0x2ff6(0x1b),'MMOtJ':'No\x20network\x20connection','kCjfF':'1|2|0|4|3','TRcDy':'🔄\x20Continuing\x20in\x20offline\x20mode\x20with\x20basic\x20validation','gxSgU':_0x2ff6(0x1c),'tyHSs':'🌐\x20Error\x20details:','rjbdZ':function(_0x4c9306,_0x303133){return _0x4c9306!==_0x303133;},'MVcKQ':_0x2ff6(0x1d),'sUlji':function(_0x4ed95b,_0x81efa8){return _0x4ed95b!==_0x81efa8;},'NKEmd':'lLyIn','uNFoo':_0x2ff6(0x1e),'KUstr':_0x2ff6(0x1f),'vXFaj':function(_0x1bf77e,_0x30c817){return _0x1bf77e!==_0x30c817;},'swSHV':_0x2ff6(0x20),'kPPFM':_0x2ff6(0x21)};try{console[_0x2ff6(0x22)](_0x2ff6(0x23));if(!_0x1e5d43[_0x2ff6(0x24)])throw new Error(_0x1f6210['ZfAtW']);if(_0x1f6210['xhSZQ'](_0x1e5d43[_0x2ff6(0x24)][_0x2ff6(0x25)],0x20)){if('RmOoO'===_0x1f6210['Lpgzs'])throw new Error(_0x1f6210['fBDyw']);else{const _0xae5fa6='API\x20key\x20validation\x20error:\x20'+_0x5d3a33[_0x2ff6(0x26)];return _0xf035ad[_0x2ff6(0x27)](_0x1f6210[_0x2ff6(0x28)],_0x375d03),{'isValid':![],'error':_0xae5fa6,'keyType':_0x3c8d77['INVALID']};}}const _0x5b2a39=[_0x2ff6(0x29),_0x1f6210[_0x2ff6(0x2a)],_0x1f6210[_0x2ff6(0x2b)]],_0x839228=_0x5b2a39[_0x2ff6(0x2c)](_0x183538=>_0x1e5d43['apiKey']['startsWith'](_0x183538));if(!_0x839228)throw new Error(_0x1f6210[_0x2ff6(0x2d)]);globalConfig={'apiKey':_0x1e5d43[_0x2ff6(0x24)],'environment':_0x1e5d43['environment']||'production','enableLogging':_0x1f6210[_0x2ff6(0x2e)](_0x1e5d43[_0x2ff6(0x2f)],![]),'timeout':_0x1e5d43[_0x2ff6(0x1a)]||0x7530,'retryAttempts':_0x1e5d43[_0x2ff6(0x30)]||0x3};if(globalConfig[_0x2ff6(0x2f)]){if(_0x1f6210['PPLtG'](_0x1f6210['uVepW'],_0x1f6210[_0x2ff6(0x31)]))return _0x157fc7;else console['log'](_0x1f6210[_0x2ff6(0x32)],{'environment':globalConfig[_0x2ff6(0x33)],'timeout':globalConfig['timeout'],'retryAttempts':globalConfig[_0x2ff6(0x30)],'apiKeyPrefix':_0x1f6210['DKyCM'](_0x1e5d43[_0x2ff6(0x24)]['substring'](0x0,0x8),'...'),'enableLogging':globalConfig[_0x2ff6(0x2f)]});}const _0x5e8114=await validateApiKey(_0x1e5d43[_0x2ff6(0x24)]);if(!_0x5e8114[_0x2ff6(0x34)]){const _0x37278f=_0x5e8114[_0x2ff6(0x27)]||'',_0x1619ac=_0x5e8114[_0x2ff6(0x35)]||_0x37278f[_0x2ff6(0x36)](_0x1f6210[_0x2ff6(0x37)])||_0x37278f[_0x2ff6(0x36)](_0x1f6210[_0x2ff6(0x38)])||_0x37278f[_0x2ff6(0x36)]('JSON\x20Parse\x20error')||_0x37278f['includes'](_0x1f6210[_0x2ff6(0x39)])||_0x37278f[_0x2ff6(0x36)](_0x1f6210[_0x2ff6(0x3a)])||_0x37278f[_0x2ff6(0x36)]('ENOTFOUND')||_0x37278f[_0x2ff6(0x36)](_0x1f6210[_0x2ff6(0x3b)])||_0x37278f[_0x2ff6(0x36)](_0x1f6210[_0x2ff6(0x3c)]);if(_0x1619ac){const _0x22bbab=_0x1f6210[_0x2ff6(0x3d)][_0x2ff6(0x3e)]('|');let _0x247cbd=0x0;while(!![]){switch(_0x22bbab[_0x247cbd++]){case'0':console[_0x2ff6(0xc)]('📝\x20SDK\x20will\x20function\x20with\x20limited\x20validation.\x20Network\x20connectivity\x20will\x20be\x20retried\x20automatically.');continue;case'1':console[_0x2ff6(0xc)](_0x2ff6(0x3f));continue;case'2':console[_0x2ff6(0xc)](_0x1f6210['TRcDy']);continue;case'3':console[_0x2ff6(0x22)](_0x1f6210[_0x2ff6(0x40)]);continue;case'4':console['warn'](_0x1f6210[_0x2ff6(0x41)],_0x5e8114[_0x2ff6(0x27)]);continue;}break;}}else{if(_0x1f6210['rjbdZ'](_0x1f6210[_0x2ff6(0x42)],_0x1f6210['MVcKQ'])){const _0x170291=_0x1f6210[_0x2ff6(0x43)];let _0x1af9fa='',_0x2057da=0x0;_0x452deb=_0x5b3a6d[_0x2ff6(0x44)](/[^A-Za-z0-9+/]/g,'');while(_0x1f6210['BfPCr'](_0x2057da,_0x493029[_0x2ff6(0x25)])){const _0x5d11b7=_0x170291[_0x2ff6(0x45)](_0x2cf8ed[_0x2ff6(0x46)](_0x2057da++)),_0x9261fe=_0x170291['indexOf'](_0x5630f9[_0x2ff6(0x46)](_0x2057da++)),_0x2a8511=_0x170291[_0x2ff6(0x45)](_0x1823c3[_0x2ff6(0x46)](_0x2057da++)),_0x3bc284=_0x170291['indexOf'](_0x20fdde[_0x2ff6(0x46)](_0x2057da++)),_0x37d31b=_0x1f6210['ZiQDO'](_0x1f6210[_0x2ff6(0x47)](_0x5d11b7<<0x12,_0x9261fe<<0xc)|_0x1f6210[_0x2ff6(0x48)](_0x2a8511,0x6),_0x3bc284);_0x1af9fa+=_0xdfc6b4[_0x2ff6(0x49)](_0x1f6210[_0x2ff6(0x4a)](_0x1f6210[_0x2ff6(0x4b)](_0x37d31b,0x10),0xff));if(_0x1f6210[_0x2ff6(0x4c)](_0x2a8511,0x40))_0x1af9fa+=_0x1eb770[_0x2ff6(0x49)](_0x37d31b>>0x8&0xff);if(_0x1f6210[_0x2ff6(0x4d)](_0x3bc284,0x40))_0x1af9fa+=_0x1f8d8d[_0x2ff6(0x49)](_0x1f6210[_0x2ff6(0x4e)](_0x37d31b,0xff));}return _0x1af9fa;}else throw new Error(_0x2ff6(0x4f)+_0x5e8114['error']);}}await loadJWT(),isInitialized=!![];if(globalConfig['enableLogging']){if(_0x1f6210[_0x2ff6(0x50)](_0x1f6210[_0x2ff6(0x51)],_0x1f6210['NKEmd'])){_0xe74b9['error'](_0x1f6210['rkiPB'],_0x25656e),_0x54d21f=![];throw _0x1eadbb;}else{console[_0x2ff6(0x22)](_0x1f6210[_0x2ff6(0x52)]),console['log'](_0x1f6210[_0x2ff6(0x53)]);userToken&&console[_0x2ff6(0x22)](_0x2ff6(0x54));if(_0x5e8114['permissions']){if(_0x1f6210['vXFaj'](_0x1f6210[_0x2ff6(0x55)],_0x1f6210[_0x2ff6(0x56)]))console['log'](_0x2ff6(0x57),_0x5e8114[_0x2ff6(0x58)]);else return _0x393e89;}if(_0x5e8114[_0x2ff6(0x59)]){if(_0x1f6210[_0x2ff6(0x5a)](_0x2ff6(0x5b),_0x2ff6(0x5b)))console['log'](_0x2ff6(0x5c),_0x5e8114[_0x2ff6(0x59)]);else return _0x45b164[_0x2ff6(0x27)](_0x1f6210[_0x2ff6(0x5d)],_0x1a457a),null;}}}}catch(_0x555cc8){console['error'](_0x1f6210[_0x2ff6(0x5e)],_0x555cc8),isInitialized=![];throw _0x555cc8;}};export const getApiKeyType=_0x646467=>{const _0x2dd41b={'nXBwn':function(_0x1506bc,_0x342bde){return _0x1506bc>=_0x342bde;},'XzByH':_0x2ff6(0x15)};if(_0x2dd41b['nXBwn'](_0x646467[_0x2ff6(0x25)],0x20)&&(_0x646467[_0x2ff6(0x5f)]('dev_')||_0x646467[_0x2ff6(0x5f)](_0x2dd41b['XzByH'])||_0x646467[_0x2ff6(0x5f)]('ona_')))return ApiKeyType['DEVELOPER'];return ApiKeyType[_0x2ff6(0x60)];};export const validateApiKey=async _0x510db3=>{const _0x1ad44d={'UTwmu':function(_0x4cd5c3,_0x3b086e){return _0x4cd5c3!==_0x3b086e;},'gcdWa':function(_0x46d960,_0x39d5e0){return _0x46d960!==_0x39d5e0;},'YbQAu':_0x2ff6(0x61),'SKiHL':'User\x20not\x20authenticated.\x20Please\x20verify\x20email\x20first.','nUwnP':_0x2ff6(0x62),'uRdVX':function(_0x2d52f5,_0x1a0323){return _0x2d52f5!==_0x1a0323;},'ekBIL':function(_0x35390d,_0x1f91f9){return _0x35390d*_0x1f91f9;},'fdbSf':function(_0x556541,_0x484173){return _0x556541/_0x484173;},'ZyAmb':function(_0x67223b,_0x3dc928){return _0x67223b(_0x3dc928);},'xdpsc':function(_0x1f0e26,_0x309054){return _0x1f0e26===_0x309054;},'bPKlC':function(_0xcbe6f,_0x1ca9c8){return _0xcbe6f===_0x1ca9c8;},'UaMpf':'JSON\x20Parse\x20error','xWhtM':_0x2ff6(0x1b),'WLDAw':_0x2ff6(0x3f),'Xdyaz':_0x2ff6(0x63),'noYRr':_0x2ff6(0x1c),'NcAcp':'✅\x20API\x20key\x20validation\x20successful','wxXCd':function(_0x2d54ff,_0x45680a){return _0x2d54ff===_0x45680a;},'SVBRC':function(_0x6f9db9,_0x239aef){return _0x6f9db9===_0x239aef;},'fHNig':_0x2ff6(0x64),'tvyGJ':_0x2ff6(0x65),'GUMcT':_0x2ff6(0x66),'LbBzW':'⏱️\x20Rate\x20Limits:','RsGqs':_0x2ff6(0x57),'YILgp':'🔑\x20Developer\x20API\x20key\x20ready\x20for\x20app-level\x20operations','ywpMf':_0x2ff6(0x67),'dNOUn':function(_0x348f17,_0x10e2ce){return _0x348f17!==_0x10e2ce;},'VYLue':_0x2ff6(0x68),'mAqbo':_0x2ff6(0x69),'nbaOu':function(_0x3cb148,_0x59478f){return _0x3cb148-_0x59478f;},'TSSUy':function(_0x30dc72){return _0x30dc72();},'Zejmb':'production','zpKvQ':function(_0x6c3288,_0xf969df){return _0x6c3288===_0xf969df;},'BfsIl':function(_0x23d5ed,_0x5891fd){return _0x23d5ed===_0x5891fd;},'WRVdI':function(_0x49e5ff,_0x1e3d3b){return _0x49e5ff<=_0x1e3d3b;},'lCnMS':function(_0x180603,_0x45a175,_0x3969e3){return _0x180603(_0x45a175,_0x3969e3);},'OpOkU':_0x2ff6(0x6a),'AqkVT':_0x2ff6(0x6b),'jExAI':function(_0x5de75e,_0xfb5fdb){return _0x5de75e!==_0xfb5fdb;},'XYgYY':function(_0x582d5d,_0x54b2ea){return _0x582d5d!==_0x54b2ea;},'YTTYX':function(_0x4d8ada,_0x5d4519){return _0x4d8ada>_0x5d4519;},'ZExxT':function(_0x2f65a1,_0x346790,_0x2e1648){return _0x2f65a1(_0x346790,_0x2e1648);},'oKehE':_0x2ff6(0x6c),'ogagQ':function(_0x1dfab8,_0x551b59){return _0x1dfab8===_0x551b59;},'uJwgT':'bWqVW','bfxTO':_0x2ff6(0x6d),'OipXH':'No\x20response\x20received\x20from\x20server','uaVDS':function(_0x6776e6,_0x2841b3){return _0x6776e6===_0x2841b3;},'JETXP':'rJQpZ','DQZxK':_0x2ff6(0x6e),'Auirb':function(_0x3a1e1d,_0x1c546a){return _0x3a1e1d===_0x1c546a;},'OTUBW':_0x2ff6(0x6f),'GYzUD':function(_0x156a87,_0x18ec2f){return _0x156a87===_0x18ec2f;},'bSONx':_0x2ff6(0x70),'SKeFq':'Onairos\x20API\x20request\x20timed\x20out\x20(504\x20Gateway\x20Timeout).\x20Please\x20try\x20again.','ZzXJx':_0x2ff6(0x71),'tyGbP':_0x2ff6(0x72),'bdUyD':_0x2ff6(0x73),'zLivj':_0x2ff6(0x74),'GpjUL':function(_0x32eb03,_0xa0216){return _0x32eb03||_0xa0216;},'sawHU':_0x2ff6(0x75),'FRMJg':function(_0x96b4f4,_0x5c98f0){return _0x96b4f4===_0x5c98f0;},'EIehq':function(_0x4ba391,_0xca9595){return _0x4ba391!==_0xca9595;},'GcLph':_0x2ff6(0x76),'mnzza':function(_0x559f2e,_0x380905){return _0x559f2e===_0x380905;},'LbBbl':'fKKEr','LXzsB':function(_0xb3653,_0x443f36){return _0xb3653===_0x443f36;},'WZymC':function(_0x42cca3,_0x16e3e8){return _0x42cca3!==_0x16e3e8;},'NwcbC':_0x2ff6(0x77),'Vzgta':_0x2ff6(0x78),'DiSGf':_0x2ff6(0x79),'xOwUY':_0x2ff6(0x7a),'AuPpY':function(_0x34e114,_0xf8c096){return _0x34e114||_0xf8c096;},'xtxAr':_0x2ff6(0x7b),'eTPbg':_0x2ff6(0x7c),'zrpES':function(_0x61c5f3,_0x4f23a7){return _0x61c5f3===_0x4f23a7;},'johXq':function(_0x3c4f02,_0x1ed7db){return _0x3c4f02===_0x1ed7db;},'Btctu':function(_0x2786f1,_0x472220){return _0x2786f1!==_0x472220;},'KRefv':_0x2ff6(0x7d),'EoTKM':function(_0xaf2f89,_0x2b8093){return _0xaf2f89!==_0x2b8093;},'tcgms':function(_0x505255,_0x34d623){return _0x505255!==_0x34d623;},'ZzaFG':function(_0xe74859,_0x12b15d){return _0xe74859(_0x12b15d);},'jFdxh':_0x2ff6(0x7e),'xwlpZ':_0x2ff6(0x7f),'WGJxX':function(_0x3b6a6d,_0x763126){return _0x3b6a6d===_0x763126;},'YTffl':function(_0x8a98c9,_0x24379d){return _0x8a98c9!==_0x24379d;},'ByFZC':_0x2ff6(0x80),'AibSw':_0x2ff6(0x81),'nuJJn':_0x2ff6(0x82),'dYjeJ':_0x2ff6(0x83),'rIrOo':function(_0x1d435d,_0x2a4649){return _0x1d435d===_0x2a4649;},'jKDOU':function(_0x523be9,_0x38cdc9){return _0x523be9===_0x38cdc9;},'BPpHk':function(_0x578945,_0x3c6ea2){return _0x578945*_0x3c6ea2;},'nEGWV':function(_0x16c68a,_0x2d6e4b){return _0x16c68a!==_0x2d6e4b;},'hsEwr':_0x2ff6(0x84),'efPcG':function(_0x4332dd,_0x1d906d){return _0x4332dd!==_0x1d906d;},'NyscW':'OlwXm','nUQdp':_0x2ff6(0xf)};try{var _0x3e543d,_0x4e4367,_0x533e83;console[_0x2ff6(0x22)](_0x1ad44d['ywpMf']);const _0x42246f=_0x1ad44d[_0x2ff6(0x85)](getApiKeyType,_0x510db3);if(_0x42246f===ApiKeyType[_0x2ff6(0x60)]){if(_0x1ad44d[_0x2ff6(0x86)](_0x1ad44d['VYLue'],'ncmKe'))return{'isValid':![],'error':_0x1ad44d[_0x2ff6(0x87)],'keyType':ApiKeyType[_0x2ff6(0x60)]};else{var _0x5061ed;return _0x1ad44d[_0x2ff6(0x88)](_0x5061ed=_0x777ed7,null)&&_0x1ad44d[_0x2ff6(0x89)](_0x5061ed,void 0x0)&&_0x5061ed[_0x2ff6(0x2f)]&&_0x2dd890['error'](_0x1ad44d[_0x2ff6(0x8a)],_0xe1d30f),_0x21d344;}}const _0x2a37e7=validationCache[_0x2ff6(0x8b)](_0x510db3);if(_0x2a37e7&&_0x1ad44d['nbaOu'](Date[_0x2ff6(0x8c)](),_0x2a37e7['timestamp'])<CACHE_DURATION){var _0x2b0446;return(_0x2b0446=globalConfig)!==null&&_0x2b0446!==void 0x0&&_0x2b0446[_0x2ff6(0x2f)]&&console[_0x2ff6(0x22)]('📋\x20Using\x20cached\x20API\x20key\x20validation\x20result'),_0x2a37e7[_0x2ff6(0x8d)];}const _0x4d20a7=await _0x1ad44d[_0x2ff6(0x8e)](checkNetworkConnectivity);if(!_0x4d20a7)return console[_0x2ff6(0xc)](_0x2ff6(0x64)),{'isValid':![],'error':_0x2ff6(0x65),'keyType':_0x42246f,'isNetworkError':!![]};const _0x16be82=(_0x1ad44d[_0x2ff6(0x8f)](_0x3e543d=globalConfig,null)||_0x1ad44d[_0x2ff6(0x8f)](_0x3e543d,void 0x0)?void 0x0:_0x3e543d[_0x2ff6(0x33)])||_0x1ad44d['Zejmb'],_0x3b2fc1=API_ENDPOINTS[_0x16be82],_0xe0af13=((_0x4e4367=globalConfig)===null||_0x1ad44d[_0x2ff6(0x90)](_0x4e4367,void 0x0)?void 0x0:_0x4e4367[_0x2ff6(0x1a)])||0x7530,_0x4b90e6=(_0x1ad44d[_0x2ff6(0x91)](_0x533e83=globalConfig,null)||_0x1ad44d[_0x2ff6(0x92)](_0x533e83,void 0x0)?void 0x0:_0x533e83['retryAttempts'])||0x3;for(let _0x135605=0x1;_0x1ad44d[_0x2ff6(0x93)](_0x135605,_0x4b90e6);_0x135605++){const _0x248284=new AbortController(),_0x98a1bd=_0x1ad44d[_0x2ff6(0x94)](setTimeout,()=>_0x248284[_0x2ff6(0x95)](),_0xe0af13);try{if(_0x1ad44d['OpOkU']===_0x1ad44d[_0x2ff6(0x96)])throw new _0x34df80(_0x1ad44d[_0x2ff6(0x97)]);else{var _0x4cca76;_0x1ad44d['jExAI'](_0x4cca76=globalConfig,null)&&_0x1ad44d['XYgYY'](_0x4cca76,void 0x0)&&_0x4cca76[_0x2ff6(0x2f)]&&_0x1ad44d['YTTYX'](_0x135605,0x1)&&console['log'](_0x2ff6(0x98)+_0x135605+'/'+_0x4b90e6+_0x2ff6(0x99));const _0xbfd965=await _0x1ad44d[_0x2ff6(0x9a)](fetch,_0x3b2fc1+_0x2ff6(0x9b),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x510db3,'User-Agent':_0x2ff6(0x9c),'X-API-Key-Type':_0x42246f,'X-SDK-Platform':'react-native','X-Retry-Attempt':_0x135605[_0x2ff6(0x9d)]()},'body':JSON[_0x2ff6(0x9e)]({'environment':_0x16be82,'sdk_version':_0x1ad44d[_0x2ff6(0x9f)],'platform':'react-native','keyType':_0x42246f,'timestamp':new Date()['toISOString'](),'attempt':_0x135605}),'signal':_0x248284[_0x2ff6(0xa0)]});_0x1ad44d['ZyAmb'](clearTimeout,_0x98a1bd);if(!_0xbfd965){if(_0x1ad44d['ogagQ'](_0x1ad44d['uJwgT'],_0x1ad44d[_0x2ff6(0xa1)]))_0x50e1bc[_0x2ff6(0x22)](_0x2ff6(0xa2)+_0x4cac03+_0x2ff6(0xa3));else throw new Error(_0x1ad44d['OipXH']);}if(_0xbfd965[_0x2ff6(0xa4)]===0x1f6){if(_0x1ad44d['uaVDS'](_0x1ad44d[_0x2ff6(0xa5)],_0x1ad44d[_0x2ff6(0xa5)]))throw new Error(_0x1ad44d['DQZxK']);else _0x2ec18c['log']('🔐\x20API\x20Key\x20Permissions:',_0x8d235e[_0x2ff6(0x58)]);}if(_0x1ad44d['Auirb'](_0xbfd965['status'],0x1f7))throw new Error(_0x1ad44d[_0x2ff6(0xa6)]);if(_0x1ad44d[_0x2ff6(0xa7)](_0xbfd965[_0x2ff6(0xa4)],0x1f8)){if(_0x2ff6(0x70)===_0x1ad44d[_0x2ff6(0xa8)])throw new Error(_0x1ad44d[_0x2ff6(0xa9)]);else{_0xf00910[_0x2ff6(0x27)]('❌\x20Failed\x20to\x20parse\x20JSON\x20response:',{'error':_0x485446[_0x2ff6(0x26)],'status':_0x5e5bf2[_0x2ff6(0xa4)],'contentType':_0x230502,'attempt':_0x20fc23});throw new _0x32109d(_0x2ff6(0xaa)+_0x3d9ffc['message']);}}const _0x2ef96a=_0xbfd965['headers'][_0x2ff6(0x8b)](_0x1ad44d[_0x2ff6(0xab)]),_0x44f906=_0x2ef96a&&_0x2ef96a[_0x2ff6(0x36)]('application/json');if(!_0x44f906){if(_0x1ad44d[_0x2ff6(0xac)]!==_0x1ad44d[_0x2ff6(0xad)]){const _0x2d3d20=await _0xbfd965[_0x2ff6(0xae)](),_0x2eec18=_0x2d3d20[_0x2ff6(0xaf)](0x0,0xc8);console['error'](_0x1ad44d[_0x2ff6(0xb0)],{'status':_0xbfd965[_0x2ff6(0xa4)],'statusText':_0xbfd965[_0x2ff6(0xb1)],'contentType':_0x1ad44d[_0x2ff6(0xb2)](_0x2ef96a,_0x1ad44d[_0x2ff6(0xb3)]),'preview':_0x2eec18,'url':_0x3b2fc1+_0x2ff6(0x9b),'attempt':_0x135605});if(_0x1ad44d['FRMJg'](_0xbfd965['status'],0x194)){if(_0x1ad44d[_0x2ff6(0xb4)](_0x1ad44d[_0x2ff6(0xb5)],_0x1ad44d['GcLph'])){_0x326b0d[_0x2ff6(0x27)](_0x2ff6(0xb6));throw new _0x217fd3(_0x2ff6(0xb7));}else throw new Error(_0x2ff6(0xb8)+_0x3b2fc1+_0x2ff6(0xb9));}else{if(_0x1ad44d[_0x2ff6(0xba)](_0xbfd965['status'],0x1f4)){if(_0x1ad44d[_0x2ff6(0xbb)](_0x2ff6(0xbc),_0x1ad44d[_0x2ff6(0xbd)]))throw new Error(_0x2ff6(0xbe));else return _0x5fbecc['error'](_0x1ad44d[_0x2ff6(0xbf)],_0x2207b9),null;}else{if(_0xbfd965[_0x2ff6(0xa4)]===0x1f6||_0x1ad44d[_0x2ff6(0xc0)](_0xbfd965[_0x2ff6(0xa4)],0x1f7)){if(_0x1ad44d[_0x2ff6(0xc1)](_0x1ad44d[_0x2ff6(0xc2)],_0x1ad44d[_0x2ff6(0xc2)]))return _0x28f236&&_0x1ad44d[_0x2ff6(0xc3)](_0x492c47,null);else throw new Error(_0x2ff6(0xc4)+_0xbfd965[_0x2ff6(0xa4)]+_0x2ff6(0xc5));}else{if(_0x2d3d20[_0x2ff6(0x36)](_0x1ad44d[_0x2ff6(0xc6)])||_0x2d3d20[_0x2ff6(0x36)](_0x2ff6(0xc7)))throw new Error(_0x2ff6(0xc8));else{if(_0x1ad44d[_0x2ff6(0xc9)](_0x1ad44d[_0x2ff6(0xca)],_0x1ad44d[_0x2ff6(0xcb)]))throw new Error(_0x2ff6(0xcc)+_0xbfd965[_0x2ff6(0xa4)]+_0x2ff6(0xcd)+_0xbfd965[_0x2ff6(0xb1)]+_0x2ff6(0xce)+_0x1ad44d[_0x2ff6(0xcf)](_0x2ef96a,_0x2ff6(0xd0))+'.');else throw new _0x1f3548(_0x2ff6(0xd1));}}}}}else{const _0x56c443=_0x400912[_0x2ff6(0x3e)]('.');if(_0x1ad44d[_0x2ff6(0x89)](_0x56c443['length'],0x3))return _0x315e95[_0x2ff6(0x27)](_0x2ff6(0xd2)),null;const _0x34eeac=_0x56c443[0x1],_0x54bd76=_0x34eeac[_0x2ff6(0x44)](/-/g,'+')[_0x2ff6(0x44)](/_/g,'/'),_0x4d943e=_0x54bd76['padEnd'](_0x1ad44d[_0x2ff6(0xd3)](_0x57ffdb[_0x2ff6(0xd4)](_0x1ad44d[_0x2ff6(0xd5)](_0x54bd76[_0x2ff6(0x25)],0x4)),0x4),'='),_0x2efa44=_0x1ad44d[_0x2ff6(0x85)](_0x1cc5fa,_0x4d943e);return _0x4b65b9['parse'](_0x2efa44);}}let _0x1d51a2;try{if(_0x1ad44d['EIehq'](_0x2ff6(0x7b),_0x1ad44d[_0x2ff6(0xd6)])){var _0x3e1034;return(_0x1ad44d['xdpsc'](_0x3e1034=_0x883e92,null)||_0x1ad44d[_0x2ff6(0x92)](_0x3e1034,void 0x0)?void 0x0:_0x3e1034['apiKey'])||null;}else _0x1d51a2=await _0xbfd965['json']();}catch(_0x5502e2){console[_0x2ff6(0x27)](_0x1ad44d[_0x2ff6(0xd7)],{'error':_0x5502e2[_0x2ff6(0x26)],'status':_0xbfd965[_0x2ff6(0xa4)],'contentType':_0x2ef96a,'attempt':_0x135605});throw new Error(_0x2ff6(0xaa)+_0x5502e2[_0x2ff6(0x26)]);}if(_0xbfd965['ok']&&(_0x1d51a2[_0x2ff6(0xd8)]||_0x1d51a2[_0x2ff6(0xd9)])){var _0x34d1f5;const _0x38eef7={'isValid':!![],'permissions':_0x1d51a2[_0x2ff6(0x58)]||[],'rateLimits':_0x1d51a2[_0x2ff6(0x59)]||null,'keyType':_0x42246f};validationCache[_0x2ff6(0xda)](_0x510db3,{'result':_0x38eef7,'timestamp':Date[_0x2ff6(0x8c)]()});if(_0x1ad44d[_0x2ff6(0x89)](_0x34d1f5=globalConfig,null)&&_0x34d1f5!==void 0x0&&_0x34d1f5[_0x2ff6(0x2f)]){var _0x3c3639,_0x3d6366,_0x3ec6ed;console[_0x2ff6(0x22)](_0x1ad44d[_0x2ff6(0xdb)],{'apiKeyId':(_0x3c3639=_0x1d51a2[_0x2ff6(0x24)])===null||_0x1ad44d[_0x2ff6(0xdc)](_0x3c3639,void 0x0)?void 0x0:_0x3c3639['id'],'appName':_0x1ad44d[_0x2ff6(0xdd)](_0x3d6366=_0x1d51a2[_0x2ff6(0xde)],null)||_0x1ad44d[_0x2ff6(0xdf)](_0x3d6366,void 0x0)?void 0x0:_0x3d6366[_0x2ff6(0xe0)],'usageCount':_0x1ad44d[_0x2ff6(0xe1)](_0x3ec6ed=_0x1d51a2['apiKey'],null)||_0x1ad44d[_0x2ff6(0xe2)](_0x3ec6ed,void 0x0)?void 0x0:_0x3ec6ed[_0x2ff6(0xe3)]});}return _0x38eef7;}else{const _0x2007df=_0x1d51a2[_0x2ff6(0x27)]||_0x1d51a2[_0x2ff6(0x26)]||_0x2ff6(0xe4)+_0xbfd965[_0x2ff6(0xa4)]+':\x20'+_0xbfd965[_0x2ff6(0xb1)],_0x1ff656={'isValid':![],'error':_0x2007df,'keyType':_0x42246f};if(_0xbfd965[_0x2ff6(0xa4)]>=0x190&&_0xbfd965[_0x2ff6(0xa4)]<0x1f4){if(_0x1ad44d[_0x2ff6(0xe5)](_0x1ad44d[_0x2ff6(0xe6)],_0x2ff6(0xe7))){var _0x4045a8;return _0x1ad44d[_0x2ff6(0xe8)](_0x4045a8=globalConfig,null)&&_0x1ad44d[_0x2ff6(0xe9)](_0x4045a8,void 0x0)&&_0x4045a8[_0x2ff6(0x2f)]&&console['error'](_0x1ad44d[_0x2ff6(0x8a)],_0x2007df),_0x1ff656;}else{const _0x1c4681=_0x220f07[_0x2ff6(0x27)]||'',_0x403079=_0xea6c8a[_0x2ff6(0x35)]||_0x1c4681[_0x2ff6(0x36)](_0x2ff6(0xea))||_0x1c4681[_0x2ff6(0x36)](_0x2ff6(0x18))||_0x1c4681[_0x2ff6(0x36)](_0x1ad44d['UaMpf'])||_0x1c4681[_0x2ff6(0x36)]('API\x20validation\x20endpoint\x20returned')||_0x1c4681[_0x2ff6(0x36)](_0x2ff6(0x1a))||_0x1c4681[_0x2ff6(0x36)](_0x2ff6(0x83))||_0x1c4681[_0x2ff6(0x36)](_0x1ad44d[_0x2ff6(0xeb)])||_0x1c4681['includes']('No\x20network\x20connection');if(_0x403079){const _0x5816d9=_0x2ff6(0xec)[_0x2ff6(0x3e)]('|');let _0x4303c6=0x0;while(!![]){switch(_0x5816d9[_0x4303c6++]){case'0':_0x297e59[_0x2ff6(0xc)](_0x1ad44d['WLDAw']);continue;case'1':_0x447137[_0x2ff6(0xc)](_0x1ad44d[_0x2ff6(0xed)]);continue;case'2':_0x49bd16[_0x2ff6(0xc)](_0x2ff6(0xee));continue;case'3':_0x517401[_0x2ff6(0xc)](_0x2ff6(0xef),_0x5f3b02[_0x2ff6(0x27)]);continue;case'4':_0x47f88d[_0x2ff6(0x22)](_0x1ad44d['noYRr']);continue;}break;}}else throw new _0x1fd89e(_0x2ff6(0x4f)+_0x1c881a[_0x2ff6(0x27)]);}}throw new Error(_0x2007df);}}}catch(_0x545b89){var _0x3ed601;_0x1ad44d[_0x2ff6(0xf0)](clearTimeout,_0x98a1bd);if(_0x1ad44d['LXzsB'](_0x545b89[_0x2ff6(0xe0)],_0x1ad44d[_0x2ff6(0xf1)])){const _0x303b7c=_0x2ff6(0xf2)+_0xe0af13+_0x2ff6(0xf3);console[_0x2ff6(0x27)](_0x1ad44d[_0x2ff6(0xf4)]);if(_0x1ad44d[_0x2ff6(0xf5)](_0x135605,_0x4b90e6)){if(_0x1ad44d['YTffl'](_0x1ad44d[_0x2ff6(0xf6)],_0x1ad44d[_0x2ff6(0xf6)])){var _0x28057b,_0x79bf1,_0x27e151;_0xd52be3[_0x2ff6(0x22)](_0x1ad44d[_0x2ff6(0xdb)],{'apiKeyId':_0x1ad44d[_0x2ff6(0x92)](_0x28057b=_0xb4ef0e[_0x2ff6(0x24)],null)||_0x1ad44d['wxXCd'](_0x28057b,void 0x0)?void 0x0:_0x28057b['id'],'appName':_0x1ad44d[_0x2ff6(0xf7)](_0x79bf1=_0x5ca1e7[_0x2ff6(0xde)],null)||_0x1ad44d[_0x2ff6(0x92)](_0x79bf1,void 0x0)?void 0x0:_0x79bf1[_0x2ff6(0xe0)],'usageCount':_0x1ad44d['xdpsc'](_0x27e151=_0x486cc7['apiKey'],null)||_0x1ad44d[_0x2ff6(0xf7)](_0x27e151,void 0x0)?void 0x0:_0x27e151[_0x2ff6(0xe3)]});}else return{'isValid':![],'error':_0x303b7c,'keyType':_0x42246f};}continue;}let _0x25fb13=_0x2ff6(0xf8)+_0x545b89[_0x2ff6(0x26)];if(_0x545b89[_0x2ff6(0x26)]['includes'](_0x1ad44d['UaMpf'])||_0x545b89['message'][_0x2ff6(0x36)](_0x1ad44d['AibSw']))_0x25fb13=_0x2ff6(0xf9)+_0x545b89[_0x2ff6(0x26)];else{if(_0x545b89[_0x2ff6(0x26)][_0x2ff6(0x36)](_0x2ff6(0xea))||_0x545b89[_0x2ff6(0x26)][_0x2ff6(0x36)](_0x1ad44d['xWhtM']))_0x25fb13=_0x2ff6(0xfa)+_0x545b89[_0x2ff6(0x26)];else{if(_0x545b89[_0x2ff6(0x26)][_0x2ff6(0x36)](_0x1ad44d[_0x2ff6(0xfb)])||_0x545b89['message'][_0x2ff6(0x36)](_0x1ad44d[_0x2ff6(0xfc)])){if(_0x1ad44d[_0x2ff6(0xfd)](_0x2ff6(0xfe),_0x2ff6(0xfe)))_0x25fb13=_0x2ff6(0xff)+_0x3b2fc1+_0x2ff6(0x100)+_0x545b89[_0x2ff6(0x26)];else return _0x1149e6[_0x2ff6(0xc)](_0x1ad44d['fHNig']),{'isValid':![],'error':_0x1ad44d[_0x2ff6(0x101)],'keyType':_0x3a4390,'isNetworkError':!![]};}}}console['error'](_0x2ff6(0x102),{'error':_0x545b89,'endpoint':_0x3b2fc1+'/dev/validate-apikey','attempt':_0x135605,'maxRetries':_0x4b90e6,'retryable':_0x135605<_0x4b90e6});if(_0x1ad44d[_0x2ff6(0x103)](_0x135605,_0x4b90e6))return{'isValid':![],'error':_0x25fb13,'keyType':_0x42246f,'isNetworkError':!![]};const _0x18b6c3=Math[_0x2ff6(0x104)](_0x1ad44d[_0x2ff6(0x105)](0x3e8,Math[_0x2ff6(0x106)](0x2,_0x1ad44d[_0x2ff6(0x107)](_0x135605,0x1))),0x1388);if(_0x1ad44d[_0x2ff6(0x108)](_0x3ed601=globalConfig,null)&&_0x1ad44d['YTffl'](_0x3ed601,void 0x0)&&_0x3ed601[_0x2ff6(0x2f)]){if(_0x1ad44d[_0x2ff6(0xc1)](_0x1ad44d[_0x2ff6(0x109)],_0x2ff6(0x84))){const _0xc0e865=_0x1ad44d[_0x2ff6(0x10a)]['split']('|');let _0x6d8178=0x0;while(!![]){switch(_0xc0e865[_0x6d8178++]){case'0':_0x25cb46[_0x2ff6(0x22)]('✅\x20Onairos\x20SDK\x20initialized\x20successfully');continue;case'1':_0x5ee943[_0x2ff6(0x59)]&&_0x2563da['log'](_0x1ad44d[_0x2ff6(0x10b)],_0x158617[_0x2ff6(0x59)]);continue;case'2':_0x372bcd['permissions']&&_0x9c2a40[_0x2ff6(0x22)](_0x1ad44d['RsGqs'],_0x3c4b5b['permissions']);continue;case'3':_0x2bc55b[_0x2ff6(0x22)](_0x1ad44d[_0x2ff6(0x10c)]);continue;case'4':_0x4ae1d4&&_0x50a539[_0x2ff6(0x22)](_0x2ff6(0x54));continue;}break;}}else console[_0x2ff6(0x22)]('⏳\x20Waiting\x20'+_0x18b6c3+_0x2ff6(0xa3));}await new Promise(_0x80fb05=>setTimeout(()=>_0x80fb05(),_0x18b6c3));}}return{'isValid':![],'error':_0x2ff6(0x10d),'keyType':_0x42246f};}catch(_0xebb55){if(_0x1ad44d[_0x2ff6(0x10e)](_0x1ad44d[_0x2ff6(0x10f)],_0x2ff6(0x110)))_0x3ae52d['log'](_0x2ff6(0x54));else{const _0x2689c6=_0x2ff6(0x111)+_0xebb55[_0x2ff6(0x26)];return console['error'](_0x1ad44d[_0x2ff6(0x112)],_0xebb55),{'isValid':![],'error':_0x2689c6,'keyType':ApiKeyType['INVALID']};}}};export const getApiConfig=()=>{return globalConfig;};export const getApiKey=()=>{var _0x232079;return((_0x232079=globalConfig)===null||_0x232079===void 0x0?void 0x0:_0x232079[_0x2ff6(0x24)])||null;};export const isApiKeyInitialized=()=>{const _0x37b8fe={'xBvXG':function(_0x262e75,_0x3efdc8){return _0x262e75!==_0x3efdc8;}};return isInitialized&&_0x37b8fe['xBvXG'](globalConfig,null);};export const storeJWT=async _0x35b10c=>{const _0x13a750={'KLRCl':_0x2ff6(0x113),'uOAbC':_0x2ff6(0x114),'GxTBE':_0x2ff6(0x115)};try{if(_0x13a750['uOAbC']===_0x13a750['uOAbC']){var _0x538c8d;await AsyncStorage['setItem'](JWT_TOKEN_KEY,_0x35b10c),userToken=_0x35b10c,(_0x538c8d=globalConfig)!==null&&_0x538c8d!==void 0x0&&_0x538c8d[_0x2ff6(0x2f)]&&console[_0x2ff6(0x22)](_0x13a750[_0x2ff6(0x116)]);}else{_0xe5ae02[_0x2ff6(0x27)](_0x2ff6(0x117));throw new _0x26c78b(_0x13a750['KLRCl']);}}catch(_0x3391fd){console['error']('❌\x20Failed\x20to\x20store\x20JWT\x20token:',_0x3391fd);throw _0x3391fd;}};function _0x2e30(){const _0x8028d=['developer','invalid','BTKNU','mQWeq','onairos_jwt_token','mhMqg','UufFK','OsIjP','HactT','cfCfk','isConnected','isInternetReachable','warn','⚠️\x20Failed\x20to\x20check\x20network\x20connectivity:','BASE_URL','❌\x20API\x20key\x20validation\x20error:','❌\x20Failed\x20to\x20initialize\x20Onairos\x20SDK:','❌\x20Failed\x20to\x20load\x20JWT\x20token:','Developer\x20API\x20key\x20is\x20required\x20for\x20SDK\x20initialization','RmOoO','ona_','pk_','WzZBg','nRxkn','Network\x20error','API\x20validation\x20endpoint\x20returned','timeout','fetch','📱\x20SDK\x20initialized\x20in\x20offline\x20mode\x20-\x20will\x20retry\x20validation\x20when\x20network\x20is\x20available','cqzAu','✅\x20Onairos\x20SDK\x20initialized\x20successfully','🔑\x20Developer\x20API\x20key\x20ready\x20for\x20app-level\x20operations','XUvTU','tcypT','log','🔑\x20Initializing\x20Onairos\x20SDK\x20with\x20developer\x20API\x20key...','apiKey','length','message','error','aUmZn','dev_','qbRDn','YHrHz','some','pYjPi','DYNue','enableLogging','retryAttempts','CQfAR','DZLtn','environment','isValid','isNetworkError','includes','NvIui','amXzW','tRfuU','bpPng','IoiHr','MMOtJ','kCjfF','split','⚠️\x20API\x20key\x20validation\x20failed\x20due\x20to\x20network/connectivity\x20issues','gxSgU','tyHSs','MVcKQ','kmRzc','replace','indexOf','charAt','ZiQDO','LzMSJ','fromCharCode','vwbwn','CTmWa','PTUts','mFxmf','rjbbh','API\x20key\x20validation\x20failed:\x20','sUlji','NKEmd','uNFoo','KUstr','🎫\x20User\x20JWT\x20token\x20loaded\x20from\x20storage','swSHV','kPPFM','🔐\x20API\x20Key\x20Permissions:','permissions','rateLimits','PPLtG','rRIbS','⏱️\x20Rate\x20Limits:','ZcwzJ','rkiPB','startsWith','INVALID','❌\x20API\x20key\x20validation\x20failed\x20(client\x20error):','❌\x20Failed\x20to\x20extract\x20user\x20data\x20from\x20JWT:','📝\x20SDK\x20will\x20function\x20with\x20limited\x20validation.\x20Network\x20connectivity\x20will\x20be\x20retried\x20automatically.','⚠️\x20No\x20network\x20connectivity\x20detected','No\x20network\x20connection\x20available.\x20Please\x20check\x20your\x20internet\x20connection\x20and\x20try\x20again.','0|3|4|2|1','🔍\x20Validating\x20developer\x20API\x20key\x20against\x20backend...','zXVfj','Invalid\x20API\x20key\x20format.\x20Developer\x20keys\x20must\x20be\x20at\x20least\x2032\x20characters\x20and\x20start\x20with\x20\x22dev_\x22,\x20\x22pk_\x22,\x20or\x20\x22ona_\x22','DjUXp','gCkHb','3.3.1','OTvNT','Onairos\x20API\x20is\x20temporarily\x20unavailable\x20(502\x20Bad\x20Gateway).\x20Please\x20try\x20again\x20later.','Onairos\x20API\x20is\x20under\x20maintenance\x20(503\x20Service\x20Unavailable).\x20Please\x20try\x20again\x20later.','ymXop','content-type','xbfMy','PvdHA','❌\x20API\x20endpoint\x20returned\x20non-JSON\x20response:','unknown','ccbaK','UDzHh','<html','EYzGF','TjekB','igkjT','❌\x20Failed\x20to\x20parse\x20JSON\x20response:','egCmN','AbortError','⏱️\x20API\x20key\x20validation\x20timeout','mldtE','Unexpected\x20character','DNS','ENOTFOUND','mdgHm','ZyAmb','dNOUn','mAqbo','UTwmu','gcdWa','YbQAu','get','now','result','TSSUy','xdpsc','zpKvQ','BfsIl','bPKlC','WRVdI','lCnMS','abort','AqkVT','SKiHL','🔄\x20Retry\x20attempt\x20','\x20for\x20API\x20key\x20validation','ZExxT','/dev/validate-apikey','OnairosReactNative/3.3.1','toString','stringify','oKehE','signal','bfxTO','⏳\x20Waiting\x20','ms\x20before\x20retry...','status','JETXP','OTUBW','GYzUD','bSONx','SKeFq','Failed\x20to\x20parse\x20server\x20response\x20as\x20JSON:\x20','ZzXJx','tyGbP','bdUyD','text','substring','zLivj','statusText','GpjUL','sawHU','EIehq','GcLph','❌\x20API\x20key\x20permissions\x20insufficient\x20for\x20this\x20operation.','Insufficient\x20API\x20key\x20permissions','API\x20validation\x20endpoint\x20not\x20found\x20(404).\x20The\x20endpoint\x20','/dev/validate-apikey\x20may\x20not\x20exist\x20or\x20be\x20configured\x20correctly.','mnzza','XYgYY','TglsJ','LbBbl','Server\x20error\x20(500).\x20The\x20Onairos\x20backend\x20is\x20experiencing\x20issues.','nUwnP','LXzsB','WZymC','NwcbC','uRdVX','Service\x20unavailable\x20(',').\x20The\x20Onairos\x20backend\x20may\x20be\x20temporarily\x20down.','Vzgta','<!DOCTYPE','Server\x20returned\x20HTML\x20page\x20instead\x20of\x20JSON\x20API\x20response.\x20This\x20often\x20indicates\x20a\x20routing\x20issue\x20or\x20server\x20misconfiguration.','jExAI','DiSGf','xOwUY','API\x20validation\x20endpoint\x20returned\x20','\x20-\x20','.\x20Expected\x20JSON\x20but\x20got\x20','AuPpY','unknown\x20content\x20type','SDK\x20not\x20initialized.\x20Call\x20initializeApiKey()\x20first.','❌\x20Invalid\x20JWT\x20token\x20format','ekBIL','ceil','fdbSf','xtxAr','eTPbg','success','valid','set','NcAcp','Auirb','zrpES','application','uaVDS','name','FRMJg','johXq','usageCount','HTTP\x20','Btctu','KRefv','wVPnC','EoTKM','tcgms','Network\x20request\x20failed','xWhtM','0|2|1|3|4','Xdyaz','🔄\x20Continuing\x20in\x20offline\x20mode\x20with\x20basic\x20validation','🌐\x20Error\x20details:','ZzaFG','jFdxh','API\x20key\x20validation\x20timeout\x20(','ms)','xwlpZ','WGJxX','ByFZC','SVBRC','Network\x20error\x20during\x20API\x20key\x20validation:\x20','Server\x20returned\x20invalid\x20JSON\x20response.\x20This\x20usually\x20indicates\x20the\x20API\x20endpoint\x20returned\x20HTML\x20instead\x20of\x20JSON\x20(often\x20a\x20404\x20or\x20server\x20error\x20page).\x20','Network\x20connectivity\x20issue.\x20Please\x20check\x20internet\x20connection\x20and\x20verify\x20the\x20Onairos\x20API\x20is\x20accessible.\x20','nuJJn','dYjeJ','rIrOo','oyoVU','DNS\x20resolution\x20failed\x20for\x20','.\x20Please\x20check\x20network\x20settings\x20and\x20domain\x20accessibility.\x20','tvyGJ','🌐\x20Network\x20error\x20during\x20API\x20key\x20validation:','jKDOU','min','BPpHk','pow','nbaOu','nEGWV','hsEwr','GUMcT','LbBzW','YILgp','All\x20retry\x20attempts\x20exhausted','efPcG','NyscW','OlwXm','API\x20key\x20validation\x20error:\x20','nUQdp','Rate\x20limit\x20exceeded','YISfd','🎫\x20JWT\x20token\x20stored\x20successfully','GxTBE','❌\x20API\x20rate\x20limit\x20exceeded','XgPdH','❌\x20Failed\x20to\x20store\x20JWT\x20token:','kJaRL','🗑️\x20JWT\x20token\x20cleared','❌\x20Failed\x20to\x20clear\x20JWT\x20token:','removeItem','KjmdW','OBakq','RpLFT','MBtgP','iShel','HKAXq','ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/','VdZvc','jqTax','xnEJr','jyquI','NVbvR','BSxnK','JxzqD','PrSfk','❌\x20Failed\x20to\x20decode\x20JWT\x20token:','rWFrW','padEnd','LXgYx','parse','DQIiB','3.0.72','production','⏱️\x20Request\x20timeout\x20for:','Request\x20timeout','XwMcS','IGeqe','👤\x20Extracted\x20username\x20from\x20JWT:','IRHtk','xgSuR','❌\x20Failed\x20to\x20extract\x20username\x20from\x20JWT:','tkqqj','uyOlz','tTWqp','khjIK','⚠️\x20No\x20JWT\x20token\x20available\x20for\x20username\x20extraction','yZjGt','TKqAj','qKgCj','Bearer\x20','NKemC','toISOString','WnXly','userName','username','userId','LSpdH','PzNpW','GKwYW','iHSSG','VQTAy','tnatA','TWewV','SVqXw','kKTOg','CTKSY','⚠️\x20No\x20JWT\x20token\x20available\x20for\x20user\x20data\x20extraction','WiGdX','👤\x20Extracted\x20user\x20data\x20from\x20JWT:','cCWxi','VFfix','DXkaA','email','verified','iat','exp','RlhFm','jlhVE','📡\x20Response\x20status:\x20','\x20for\x20','LmDob','ITAKi','gbJGf','LmbRF','xZIjv','clear','RAJut','nRKPE','fcHHo','DjUhM','liZkw','YAHzH','YLTJm','RLDsd','mfooi','ptoWI','KCWAj','LExvw','Insufficient\x20permissions\x20for\x20this\x20operation','User\x20not\x20authenticated.\x20Please\x20verify\x20email\x20first.','vwFxS','UfYNH','❌\x20API\x20key\x20authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key.','votiD','mIqAM','❌\x20API\x20rate\x20limit\x20exceeded.\x20Please\x20try\x20again\x20later.','Sdafu','FApuD','NvCNA','ylcCS','VzntC','kXBqc','pFLqH','goKev','hcDTl','🌐\x20Making\x20authenticated\x20request\x20to:\x20','QgZdu','QFcXv','YXGLG','lAlOL','BiFgk','XPxJx','pLHyS','rcTrr','gXTuU','mBHSY','ERxoS','eEBva','aYyLb','CcHjy','efdIp','ZvTPc','mTGCm','EYILm','xbkun','seWDj','vbxMq','hRlDO','OuSJw','❌\x20Developer\x20API\x20key\x20permissions\x20insufficient','ObSAr','OmNhw','gKaWk','DFnIs','wXWte','qWGpT','headers','IiEwS','LzraM','NdYNC','BsTmR','MaHBf','gxArg','OnairosSDK/1.0.0','pjeGu','poxat','🌐\x20Making\x20developer\x20request\x20to:\x20','GTbwv','XmcRX','📡\x20Developer\x20request\x20response:\x20','TaJgO','kyzYJ','❌\x20Developer\x20API\x20key\x20authentication\x20failed','Invalid\x20or\x20expired\x20API\x20key','UdIEU','aRwWT','mgrBl','BITGR','IknfF','sKZQL','DlsUh','kvAJD','EcbUC','EdXpo','iKHqF','DEVELOPER','GTFhZ','yQWWp','❌\x20JWT\x20token\x20authentication\x20failed\x20-\x20token\x20may\x20be\x20expired','Authentication\x20expired.\x20Please\x20verify\x20email\x20again.','AbYHT','UqWZb','SNdIY','ojOQh','nVcte','MIQvB','🌐\x20Making\x20user\x20request\x20to:\x20','zzMmc','xzTjv','jdWwn','📡\x20User\x20request\x20response:\x20','uDxQR','YOXTh','CQfuh','uULGM','toEil','JCHDt','wFHbP','KcEIP','EdQUm','ivicO','xDgjM','❌\x20JWT\x20token\x20permissions\x20insufficient','Lzugq','cnOpw','uYEpp','kOYcb','QIwsH','eNvCn','🗑️\x20API\x20key\x20validation\x20cache\x20cleared'];_0x2e30=function(){return _0x8028d;};return _0x2e30();}export const loadJWT=async()=>{const _0x3dddfe={'XgPdH':_0x2ff6(0x11)};try{const _0x4d0c6f=await AsyncStorage['getItem'](JWT_TOKEN_KEY);return userToken=_0x4d0c6f,_0x4d0c6f;}catch(_0x3ecb60){return console['error'](_0x3dddfe[_0x2ff6(0x118)],_0x3ecb60),null;}};export const getJWT=()=>{return userToken;};export const clearJWT=async()=>{const _0x9d6783={'iShel':_0x2ff6(0x119),'KjmdW':function(_0x486952,_0x4919a3){return _0x486952!==_0x4919a3;},'OBakq':function(_0x1ecbbe,_0x16e26f){return _0x1ecbbe===_0x16e26f;},'MBtgP':_0x2ff6(0x11a),'unPkY':_0x2ff6(0x11b),'HKAXq':_0x2ff6(0x11c)};try{var _0x4ea4cc;await AsyncStorage[_0x2ff6(0x11d)](JWT_TOKEN_KEY),userToken=null;if(_0x9d6783[_0x2ff6(0x11e)](_0x4ea4cc=globalConfig,null)&&_0x9d6783[_0x2ff6(0x11e)](_0x4ea4cc,void 0x0)&&_0x4ea4cc[_0x2ff6(0x2f)]){if(_0x9d6783[_0x2ff6(0x11f)](_0x2ff6(0x120),_0x9d6783[_0x2ff6(0x121)])){_0xde384[_0x2ff6(0x27)](_0x9d6783[_0x2ff6(0x122)],_0x3acf78);throw _0x24ac89;}else console['log'](_0x9d6783['unPkY']);}}catch(_0x23d80d){console[_0x2ff6(0x27)](_0x9d6783[_0x2ff6(0x123)],_0x23d80d);}};const base64Decode=_0x422e2f=>{const _0x43f687={'VdZvc':_0x2ff6(0x124),'jqTax':function(_0x39f61b,_0x287443){return _0x39f61b<_0x287443;},'xnEJr':function(_0x4fb000,_0x34a278){return _0x4fb000|_0x34a278;},'jyquI':function(_0x5ba6d2,_0x4eee47){return _0x5ba6d2|_0x4eee47;},'WpKVk':function(_0x4dcdd9,_0x7606b2){return _0x4dcdd9<<_0x7606b2;},'NVbvR':function(_0x21d48a,_0x439ae9){return _0x21d48a<<_0x439ae9;},'BSxnK':function(_0x2ca594,_0x29ab0d){return _0x2ca594!==_0x29ab0d;},'JxzqD':function(_0x35ac26,_0xd2adcc){return _0x35ac26>>_0xd2adcc;},'PrSfk':function(_0x104237,_0x4a5c14){return _0x104237&_0x4a5c14;}},_0x2e1cdb=_0x43f687[_0x2ff6(0x125)];let _0x43e28b='',_0x2940f0=0x0;_0x422e2f=_0x422e2f['replace'](/[^A-Za-z0-9+/]/g,'');while(_0x43f687[_0x2ff6(0x126)](_0x2940f0,_0x422e2f['length'])){const _0x436324=_0x2e1cdb[_0x2ff6(0x45)](_0x422e2f[_0x2ff6(0x46)](_0x2940f0++)),_0x2c1408=_0x2e1cdb[_0x2ff6(0x45)](_0x422e2f[_0x2ff6(0x46)](_0x2940f0++)),_0x3e832b=_0x2e1cdb[_0x2ff6(0x45)](_0x422e2f[_0x2ff6(0x46)](_0x2940f0++)),_0x5773c6=_0x2e1cdb[_0x2ff6(0x45)](_0x422e2f[_0x2ff6(0x46)](_0x2940f0++)),_0x190b38=_0x43f687[_0x2ff6(0x127)](_0x43f687[_0x2ff6(0x128)](_0x43f687['WpKVk'](_0x436324,0x12),_0x43f687[_0x2ff6(0x129)](_0x2c1408,0xc))|_0x3e832b<<0x6,_0x5773c6);_0x43e28b+=String[_0x2ff6(0x49)](_0x190b38>>0x10&0xff);if(_0x43f687[_0x2ff6(0x12a)](_0x3e832b,0x40))_0x43e28b+=String[_0x2ff6(0x49)](_0x43f687[_0x2ff6(0x12b)](_0x190b38,0x8)&0xff);if(_0x5773c6!==0x40)_0x43e28b+=String[_0x2ff6(0x49)](_0x43f687[_0x2ff6(0x12c)](_0x190b38,0xff));}return _0x43e28b;};export const decodeJWTPayload=_0x129b01=>{const _0x41bf45={'rWFrW':function(_0x548815,_0x55a5c8){return _0x548815!==_0x55a5c8;},'pSPIV':function(_0x34afb4,_0x46dd45){return _0x34afb4*_0x46dd45;},'oCFaA':function(_0xfc7fc1,_0x576e64){return _0xfc7fc1/_0x576e64;},'LXgYx':function(_0x41de4e,_0x1f8732){return _0x41de4e(_0x1f8732);},'DQIiB':_0x2ff6(0x12d)};try{const _0x4f2cd9=_0x129b01['split']('.');if(_0x41bf45[_0x2ff6(0x12e)](_0x4f2cd9[_0x2ff6(0x25)],0x3))return console[_0x2ff6(0x27)]('❌\x20Invalid\x20JWT\x20token\x20format'),null;const _0x1e61f4=_0x4f2cd9[0x1],_0x3550bc=_0x1e61f4['replace'](/-/g,'+')[_0x2ff6(0x44)](/_/g,'/'),_0x15b729=_0x3550bc[_0x2ff6(0x12f)](_0x41bf45['pSPIV'](Math[_0x2ff6(0xd4)](_0x41bf45['oCFaA'](_0x3550bc[_0x2ff6(0x25)],0x4)),0x4),'='),_0xaa06cc=_0x41bf45[_0x2ff6(0x130)](base64Decode,_0x15b729);return JSON[_0x2ff6(0x131)](_0xaa06cc);}catch(_0x33f4b5){return console[_0x2ff6(0x27)](_0x41bf45[_0x2ff6(0x132)],_0x33f4b5),null;}};export const extractUsernameFromJWT=_0x579f43=>{const _0x42440a={'tkqqj':function(_0x10d2c6,_0x1790e7){return _0x10d2c6!==_0x1790e7;},'yZjGt':function(_0x1c7526,_0x51a07a){return _0x1c7526!==_0x51a07a;},'TKqAj':'SDK\x20not\x20initialized.\x20Call\x20initializeApiKey()\x20first.','qKgCj':function(_0x43f152,_0x1bc89a){return _0x43f152(_0x1bc89a);},'NKemC':'OnairosReactNative/3.0.72','pvela':_0x2ff6(0x133),'tZvfy':_0x2ff6(0x134),'GKwYW':'❌\x20API\x20rate\x20limit\x20exceeded.\x20Please\x20try\x20again\x20later.','iHSSG':_0x2ff6(0x113),'kKTOg':_0x2ff6(0x135),'CTKSY':_0x2ff6(0x136),'uyOlz':_0x2ff6(0x137),'tTWqp':function(_0x7af43e,_0x228b79){return _0x7af43e===_0x228b79;},'khjIK':_0x2ff6(0x138),'WnXly':function(_0x322fc4,_0x2ce0c7){return _0x322fc4(_0x2ce0c7);},'LSpdH':function(_0x29b146,_0x5d49c3){return _0x29b146!==_0x5d49c3;},'PzNpW':_0x2ff6(0x139),'VQTAy':function(_0x40cd68,_0x167d5b){return _0x40cd68!==_0x167d5b;},'tnatA':_0x2ff6(0x13a),'TWewV':_0x2ff6(0x13b),'SVqXw':_0x2ff6(0x13c)};try{if(_0x42440a[_0x2ff6(0x13d)]('Diwqo',_0x42440a[_0x2ff6(0x13e)])){var _0x38412d;const _0x5f1918=_0x579f43||userToken;if(!_0x5f1918){if(_0x42440a[_0x2ff6(0x13f)](_0x42440a[_0x2ff6(0x140)],_0x42440a[_0x2ff6(0x140)]))return console[_0x2ff6(0xc)](_0x2ff6(0x141)),null;else{var _0x23a974;if(!(_0x42440a[_0x2ff6(0x13d)](_0x23a974=_0x4ab92c,null)&&_0x42440a[_0x2ff6(0x142)](_0x23a974,void 0x0)&&_0x23a974[_0x2ff6(0x24)]))throw new _0x49e18a(_0x42440a[_0x2ff6(0x143)]);const _0x2ee677=_0x42440a[_0x2ff6(0x144)](_0x1dd6f8,_0x14652e[_0x2ff6(0x24)]);return{'Content-Type':'application/json','Authorization':_0x2ff6(0x145)+_0x52fa1c[_0x2ff6(0x24)],'User-Agent':_0x42440a[_0x2ff6(0x146)],'X-SDK-Version':_0x42440a['pvela'],'X-SDK-Environment':_0x47e83b[_0x2ff6(0x33)]||_0x42440a['tZvfy'],'X-API-Key-Type':_0x2ee677,'X-Timestamp':new _0x4469e2()[_0x2ff6(0x147)]()};}}const _0x2c5b38=_0x42440a[_0x2ff6(0x148)](decodeJWTPayload,_0x5f1918);if(!_0x2c5b38)return null;const _0x4efb6e=_0x2c5b38[_0x2ff6(0x149)]||_0x2c5b38[_0x2ff6(0x14a)]||_0x2c5b38[_0x2ff6(0x14b)]||_0x2c5b38['email'];return _0x42440a['tkqqj'](_0x38412d=globalConfig,null)&&_0x42440a[_0x2ff6(0x14c)](_0x38412d,void 0x0)&&_0x38412d[_0x2ff6(0x2f)]&&console[_0x2ff6(0x22)](_0x42440a[_0x2ff6(0x14d)],_0x4efb6e),_0x4efb6e||null;}else{_0xb1c8d4[_0x2ff6(0x27)](_0x42440a[_0x2ff6(0x14e)]);throw new _0x1c69d3(_0x42440a[_0x2ff6(0x14f)]);}}catch(_0x13d0fa){if(_0x42440a[_0x2ff6(0x150)](_0x42440a[_0x2ff6(0x151)],_0x42440a[_0x2ff6(0x152)]))return console[_0x2ff6(0x27)](_0x42440a[_0x2ff6(0x153)],_0x13d0fa),null;else{_0x38de76[_0x2ff6(0x27)](_0x42440a[_0x2ff6(0x154)],_0x46c50c);throw new _0x7e28a2(_0x42440a[_0x2ff6(0x155)]);}}};export const extractUserDataFromJWT=_0x52797a=>{const _0x63dddc={'cCWxi':function(_0x4c1670,_0x2d4839){return _0x4c1670||_0x2d4839;},'VFfix':_0x2ff6(0x156),'DXkaA':function(_0x1f919f,_0x165962){return _0x1f919f(_0x165962);},'kiKwB':function(_0x5a7fdc,_0x2f6518){return _0x5a7fdc!==_0x2f6518;},'yeyzz':_0x2ff6(0x157),'jlhVE':_0x2ff6(0x158)};try{var _0x54b44e;const _0x1844e8=_0x63dddc[_0x2ff6(0x159)](_0x52797a,userToken);if(!_0x1844e8)return console[_0x2ff6(0xc)](_0x63dddc[_0x2ff6(0x15a)]),null;const _0x3beee5=_0x63dddc[_0x2ff6(0x15b)](decodeJWTPayload,_0x1844e8);if(!_0x3beee5)return null;const _0x23c97f={'id':_0x3beee5['id'],'email':_0x3beee5[_0x2ff6(0x15c)],'userId':_0x3beee5[_0x2ff6(0x14b)],'userName':_0x3beee5['userName']||_0x3beee5[_0x2ff6(0x14a)],'verified':_0x3beee5[_0x2ff6(0x15d)],'iat':_0x3beee5[_0x2ff6(0x15e)],'exp':_0x3beee5[_0x2ff6(0x15f)]};return _0x63dddc['kiKwB'](_0x54b44e=globalConfig,null)&&_0x54b44e!==void 0x0&&_0x54b44e[_0x2ff6(0x2f)]&&(_0x63dddc['yeyzz']!==_0x2ff6(0x160)?console[_0x2ff6(0x22)](_0x63dddc[_0x2ff6(0x161)],_0x23c97f):_0x40c632[_0x2ff6(0x22)](_0x2ff6(0x162)+_0x39cfd8[_0x2ff6(0xa4)]+_0x2ff6(0x163)+_0x1717d3)),_0x23c97f;}catch(_0x47bb7f){return console[_0x2ff6(0x27)](_0x2ff6(0x62),_0x47bb7f),null;}};export const isUserAuthenticated=()=>{return!!userToken;};function _0x2ff6(_0x2e306d,_0x2ff65b){_0x2e306d=_0x2e306d-0x0;const _0x12f0af=_0x2e30();let _0x56ec0a=_0x12f0af[_0x2e306d];return _0x56ec0a;}export const getAuthHeaders=()=>{const _0x42e7c0={'gbJGf':function(_0x3ae66e,_0x5c6222){return _0x3ae66e!==_0x5c6222;},'RAJut':'🗑️\x20API\x20key\x20validation\x20cache\x20cleared','ITAKi':function(_0x55bc5a,_0x5c3b88){return _0x55bc5a!==_0x5c3b88;},'beQLO':function(_0x497350,_0x336310){return _0x497350===_0x336310;},'LmbRF':_0x2ff6(0x164),'xZIjv':_0x2ff6(0xd1),'nRKPE':function(_0x5777b3,_0x42f652){return _0x5777b3(_0x42f652);},'fcHHo':'OnairosReactNative/3.0.72','vMcBZ':_0x2ff6(0x133),'DjUhM':'production'};var _0x5bf8ab;if(!(_0x42e7c0[_0x2ff6(0x165)](_0x5bf8ab=globalConfig,null)&&_0x42e7c0[_0x2ff6(0x166)](_0x5bf8ab,void 0x0)&&_0x5bf8ab[_0x2ff6(0x24)])){if(_0x42e7c0['beQLO'](_0x42e7c0[_0x2ff6(0x167)],_0x42e7c0[_0x2ff6(0x167)]))throw new Error(_0x42e7c0[_0x2ff6(0x168)]);else{var _0x2222dc;_0x5685ed[_0x2ff6(0x169)](),(_0x2222dc=_0x57c999)!==null&&_0x42e7c0[_0x2ff6(0x166)](_0x2222dc,void 0x0)&&_0x2222dc['enableLogging']&&_0xcc0af5[_0x2ff6(0x22)](_0x42e7c0[_0x2ff6(0x16a)]);}}const _0x437da0=_0x42e7c0[_0x2ff6(0x16b)](getApiKeyType,globalConfig['apiKey']);return{'Content-Type':'application/json','Authorization':'Bearer\x20'+globalConfig['apiKey'],'User-Agent':_0x42e7c0[_0x2ff6(0x16c)],'X-SDK-Version':_0x42e7c0['vMcBZ'],'X-SDK-Environment':globalConfig['environment']||_0x42e7c0[_0x2ff6(0x16d)],'X-API-Key-Type':_0x437da0,'X-Timestamp':new Date()['toISOString']()};};export const getDeveloperAuthHeaders=()=>{const _0x49f7d3={'liZkw':function(_0x15e873,_0x1d9195){return _0x15e873!==_0x1d9195;},'YAHzH':function(_0x23fdbd,_0x177fb2){return _0x23fdbd===_0x177fb2;},'RLDsd':'yQbAo','mfooi':'SDK\x20not\x20initialized.\x20Call\x20initializeApiKey()\x20first.','ptoWI':function(_0x31ee68,_0x131d52){return _0x31ee68(_0x131d52);},'KCWAj':_0x2ff6(0x133),'gcjKw':'production'};var _0x1bcc2a;if(!(_0x49f7d3[_0x2ff6(0x16e)](_0x1bcc2a=globalConfig,null)&&_0x49f7d3[_0x2ff6(0x16e)](_0x1bcc2a,void 0x0)&&_0x1bcc2a[_0x2ff6(0x24)])){if(_0x49f7d3[_0x2ff6(0x16f)](_0x2ff6(0x170),_0x49f7d3[_0x2ff6(0x171)]))return!!_0x338a8c;else throw new Error(_0x49f7d3[_0x2ff6(0x172)]);}const _0x292b8a=_0x49f7d3[_0x2ff6(0x173)](getApiKeyType,globalConfig[_0x2ff6(0x24)]);return{'Content-Type':'application/json','Authorization':_0x2ff6(0x145)+globalConfig['apiKey'],'User-Agent':'OnairosSDK/1.0.0','X-SDK-Version':_0x49f7d3[_0x2ff6(0x174)],'X-SDK-Environment':globalConfig[_0x2ff6(0x33)]||_0x49f7d3['gcjKw'],'X-API-Key-Type':_0x292b8a,'X-Timestamp':new Date()[_0x2ff6(0x147)]()};};export const getUserAuthHeaders=()=>{const _0x42244e={'LExvw':'3.0.72'};var _0x5271f6;if(!userToken)throw new Error('User\x20not\x20authenticated.\x20Please\x20verify\x20email\x20first.');return{'Content-Type':'application/json','Authorization':_0x2ff6(0x145)+userToken,'User-Agent':'OnairosSDK/1.0.0','X-SDK-Version':_0x42244e[_0x2ff6(0x175)],'X-SDK-Environment':((_0x5271f6=globalConfig)===null||_0x5271f6===void 0x0?void 0x0:_0x5271f6[_0x2ff6(0x33)])||_0x2ff6(0x134)};};export const makeAuthenticatedRequest=async(_0x522ce4,_0x2c3db1={})=>{const _0x415408={'VzntC':_0x2ff6(0xd),'BiFgk':_0x2ff6(0xd1),'mBHSY':_0x2ff6(0x176),'aYyLb':_0x2ff6(0x177),'kXBqc':function(_0x401cd4){return _0x401cd4();},'ylcCS':_0x2ff6(0x178),'RQLEY':_0x2ff6(0x134),'pFLqH':function(_0x5eaebb){return _0x5eaebb();},'nNKDn':function(_0x307682,_0x3359f1){return _0x307682!==_0x3359f1;},'goKev':'lWeLm','hcDTl':_0x2ff6(0x179),'QgZdu':function(_0x4448aa,_0x525b95,_0x26f0ea){return _0x4448aa(_0x525b95,_0x26f0ea);},'QFcXv':function(_0x11bf24,_0x4579f5){return _0x11bf24===_0x4579f5;},'YXGLG':_0x2ff6(0x17a),'XIceE':_0x2ff6(0x17b),'lAlOL':_0x2ff6(0x17c),'XPxJx':_0x2ff6(0x17d),'pLHyS':_0x2ff6(0x113),'rcTrr':_0x2ff6(0x17e),'ERxoS':function(_0x55282e,_0x4696e2){return _0x55282e(_0x4696e2);},'eEBva':_0x2ff6(0x7e),'UOwiu':_0x2ff6(0x17f),'mjaDs':_0x2ff6(0x180),'CcHjy':'⏱️\x20Request\x20timeout\x20for:','efdIp':_0x2ff6(0x136)};if(!_0x415408['kXBqc'](isApiKeyInitialized)){if('vwFxS'!==_0x415408[_0x2ff6(0x181)])return _0x13958a[_0x2ff6(0xc)](_0x415408[_0x2ff6(0x182)],_0x24ac25),!![];else throw new Error(_0x2ff6(0xd1));}const _0xae11d1=_0x415408[_0x2ff6(0x183)](getApiConfig),_0x499205=API_ENDPOINTS[_0xae11d1[_0x2ff6(0x33)]||_0x415408['RQLEY']],_0x3a4eb2=''+_0x499205+(_0x522ce4['startsWith']('/')?'':'/')+_0x522ce4,_0x3c573d={..._0x415408[_0x2ff6(0x184)](getAuthHeaders),..._0x2c3db1['headers']||{}},_0x9afd1=new AbortController(),_0x50261f=setTimeout(()=>_0x9afd1['abort'](),_0xae11d1[_0x2ff6(0x1a)]||0x7530);try{if(_0xae11d1['enableLogging']){if(_0x415408['nNKDn'](_0x415408[_0x2ff6(0x185)],_0x415408[_0x2ff6(0x186)]))console['log'](_0x2ff6(0x187)+_0x522ce4);else throw new _0x80c8f6('Onairos\x20API\x20is\x20temporarily\x20unavailable\x20(502\x20Bad\x20Gateway).\x20Please\x20try\x20again\x20later.');}const _0x45f483=await _0x415408[_0x2ff6(0x188)](fetch,_0x3a4eb2,{..._0x2c3db1,'headers':_0x3c573d,'signal':_0x9afd1[_0x2ff6(0xa0)]});clearTimeout(_0x50261f);_0xae11d1[_0x2ff6(0x2f)]&&console['log'](_0x2ff6(0x162)+_0x45f483[_0x2ff6(0xa4)]+_0x2ff6(0x163)+_0x522ce4);if(_0x415408[_0x2ff6(0x189)](_0x45f483[_0x2ff6(0xa4)],0x191)){console[_0x2ff6(0x27)](_0x415408[_0x2ff6(0x18a)]);throw new Error('Invalid\x20or\x20expired\x20API\x20key');}if(_0x415408[_0x2ff6(0x189)](_0x45f483[_0x2ff6(0xa4)],0x193)){console[_0x2ff6(0x27)](_0x2ff6(0xb6));throw new Error('Insufficient\x20API\x20key\x20permissions');}if(_0x415408[_0x2ff6(0x189)](_0x45f483[_0x2ff6(0xa4)],0x1ad)){if(_0x415408['XIceE']===_0x415408[_0x2ff6(0x18b)])throw new _0x53ea01(_0x415408[_0x2ff6(0x18c)]);else{console[_0x2ff6(0x27)](_0x415408[_0x2ff6(0x18d)]);throw new Error(_0x415408[_0x2ff6(0x18e)]);}}return _0x45f483;}catch(_0x20c1de){if(_0x415408[_0x2ff6(0x18f)]===_0x2ff6(0x190)){_0x4a51b1['error']('❌\x20JWT\x20token\x20permissions\x20insufficient');throw new _0xa96974(_0x415408[_0x2ff6(0x191)]);}else{_0x415408[_0x2ff6(0x192)](clearTimeout,_0x50261f);if(_0x415408[_0x2ff6(0x189)](_0x20c1de[_0x2ff6(0xe0)],_0x415408[_0x2ff6(0x193)])){if(_0x415408['QFcXv'](_0x415408['UOwiu'],_0x415408['mjaDs']))throw new _0x3e38c2(_0x415408[_0x2ff6(0x194)]);else{console[_0x2ff6(0x27)](_0x415408[_0x2ff6(0x195)],_0x522ce4);throw new Error(_0x415408[_0x2ff6(0x196)]);}}throw _0x20c1de;}}};export const makeDeveloperRequest=async(_0xfb824a,_0x24bb85={})=>{const _0x5b8127={'LAEqo':_0x2ff6(0x61),'pjeGu':_0x2ff6(0x133),'poxat':_0x2ff6(0x134),'OmNhw':function(_0x3958cd){return _0x3958cd();},'gKaWk':function(_0x1b879b,_0x1fb194){return _0x1b879b!==_0x1fb194;},'DFnIs':_0x2ff6(0x197),'qWGpT':_0x2ff6(0xd1),'IiEwS':function(_0x3ed566,_0xffc960){return _0x3ed566===_0xffc960;},'LzraM':_0x2ff6(0x198),'NdYNC':_0x2ff6(0x199),'BsTmR':function(_0x211971,_0x2a077d){return _0x211971===_0x2a077d;},'MaHBf':_0x2ff6(0x19a),'gxArg':_0x2ff6(0x19b),'GTbwv':function(_0x396331,_0x4d8069,_0x1cc648){return _0x396331(_0x4d8069,_0x1cc648);},'XmcRX':function(_0x290461,_0x4883f1){return _0x290461(_0x4883f1);},'TaJgO':_0x2ff6(0x19c),'kyzYJ':_0x2ff6(0x19d),'UdIEU':'whrqs','QSHDr':_0x2ff6(0x19e),'aRwWT':_0x2ff6(0x19f),'mgrBl':'Insufficient\x20API\x20key\x20permissions','BITGR':function(_0x45b965,_0x2bb7ff){return _0x45b965===_0x2bb7ff;},'IknfF':function(_0x4521c2,_0x13fe54){return _0x4521c2!==_0x13fe54;},'sKZQL':_0x2ff6(0x1a0),'DlsUh':_0x2ff6(0x113),'kvAJD':function(_0x1b2abd,_0x568e61){return _0x1b2abd===_0x568e61;},'EcbUC':_0x2ff6(0x7e),'EdXpo':_0x2ff6(0x135),'iKHqF':_0x2ff6(0x136)};if(!_0x5b8127[_0x2ff6(0x1a1)](isApiKeyInitialized)){if(_0x5b8127[_0x2ff6(0x1a2)](_0x5b8127[_0x2ff6(0x1a3)],_0x2ff6(0x1a4)))throw new Error(_0x5b8127[_0x2ff6(0x1a5)]);else _0x644f5c[_0x2ff6(0x22)](_0x2ff6(0x98)+_0x2880e2+'/'+_0x2c42a1+_0x2ff6(0x99));}const _0x45dc95=_0x5b8127[_0x2ff6(0x1a1)](getApiConfig),_0x2bdb03=API_ENDPOINTS[_0x45dc95['environment']||_0x5b8127['poxat']],_0xf3ee18=''+_0x2bdb03+(_0xfb824a[_0x2ff6(0x5f)]('/')?'':'/')+_0xfb824a,_0x39cd25={...getDeveloperAuthHeaders(),..._0x24bb85[_0x2ff6(0x1a6)]||{}},_0x53fdd7=new AbortController(),_0x565a21=setTimeout(()=>_0x53fdd7[_0x2ff6(0x95)](),_0x45dc95[_0x2ff6(0x1a)]||0x7530);try{if(_0x5b8127[_0x2ff6(0x1a7)](_0x5b8127[_0x2ff6(0x1a8)],_0x5b8127[_0x2ff6(0x1a9)]))_0x2f7f13[_0x2ff6(0x27)](_0x5b8127['LAEqo'],_0x2fcb00);else{if(_0x45dc95['enableLogging']){if(_0x5b8127[_0x2ff6(0x1aa)](_0x5b8127[_0x2ff6(0x1ab)],_0x5b8127[_0x2ff6(0x1ac)])){var _0x2f7e40;if(!_0x59f9b4)throw new _0x48f3ce('User\x20not\x20authenticated.\x20Please\x20verify\x20email\x20first.');return{'Content-Type':'application/json','Authorization':_0x2ff6(0x145)+_0x4d2373,'User-Agent':_0x2ff6(0x1ad),'X-SDK-Version':_0x5b8127[_0x2ff6(0x1ae)],'X-SDK-Environment':((_0x2f7e40=_0x4abdfc)===null||_0x2f7e40===void 0x0?void 0x0:_0x2f7e40[_0x2ff6(0x33)])||_0x5b8127[_0x2ff6(0x1af)]};}else console['log'](_0x2ff6(0x1b0)+_0xfb824a);}const _0x39d354=await _0x5b8127[_0x2ff6(0x1b1)](fetch,_0xf3ee18,{..._0x24bb85,'headers':_0x39cd25,'signal':_0x53fdd7[_0x2ff6(0xa0)]});_0x5b8127[_0x2ff6(0x1b2)](clearTimeout,_0x565a21);_0x45dc95['enableLogging']&&console['log'](_0x2ff6(0x1b3)+_0x39d354[_0x2ff6(0xa4)]+'\x20for\x20'+_0xfb824a);if(_0x5b8127[_0x2ff6(0x1a7)](_0x39d354['status'],0x191)){if(_0x5b8127[_0x2ff6(0x1b4)]!==_0x5b8127[_0x2ff6(0x1b5)]){console[_0x2ff6(0x27)](_0x2ff6(0x1b6));throw new Error(_0x2ff6(0x1b7));}else return null;}if(_0x39d354[_0x2ff6(0xa4)]===0x193){if(_0x5b8127[_0x2ff6(0x1b8)]===_0x5b8127['QSHDr'])throw new _0x3105aa('Server\x20error\x20(500).\x20The\x20Onairos\x20backend\x20is\x20experiencing\x20issues.');else{console[_0x2ff6(0x27)](_0x5b8127[_0x2ff6(0x1b9)]);throw new Error(_0x5b8127[_0x2ff6(0x1ba)]);}}if(_0x5b8127[_0x2ff6(0x1bb)](_0x39d354[_0x2ff6(0xa4)],0x1ad)){if(_0x5b8127[_0x2ff6(0x1bc)]('qzxDw',_0x5b8127[_0x2ff6(0x1bd)])){console[_0x2ff6(0x27)](_0x2ff6(0x117));throw new Error(_0x5b8127[_0x2ff6(0x1be)]);}else throw new _0xac77a0(_0x2ff6(0xcc)+_0x463507['status']+_0x2ff6(0xcd)+_0x31d0e5[_0x2ff6(0xb1)]+_0x2ff6(0xce)+(_0x2ed090||_0x2ff6(0xd0))+'.');}return _0x39d354;}}catch(_0x496816){_0x5b8127[_0x2ff6(0x1b2)](clearTimeout,_0x565a21);if(_0x5b8127[_0x2ff6(0x1bf)](_0x496816[_0x2ff6(0xe0)],_0x5b8127[_0x2ff6(0x1c0)])){console['error'](_0x5b8127[_0x2ff6(0x1c1)],_0xfb824a);throw new Error(_0x5b8127[_0x2ff6(0x1c2)]);}throw _0x496816;}};export const makeUserRequest=async(_0x389f76,_0x68d2f7={})=>{const _0x49959b={'uDxQR':function(_0xb70e3,_0x2575b2){return _0xb70e3!==_0x2575b2;},'YOXTh':'✅\x20API\x20key\x20validation\x20successful','ZVlVF':function(_0x41e9dc,_0x15f29c){return _0x41e9dc===_0x15f29c;},'uULGM':function(_0x2186ff,_0x539126){return _0x2186ff===_0x539126;},'TeEUY':function(_0x18c846,_0x5238cd){return _0x18c846===_0x5238cd;},'CQfuh':function(_0x20d056,_0x344240){return _0x20d056===_0x344240;},'KcEIP':_0x2ff6(0x1c3),'juZpN':_0x2ff6(0x0),'EdQUm':_0x2ff6(0x60),'ivicO':_0x2ff6(0x1),'QIwsH':_0x2ff6(0x156),'ojOQh':function(_0x41694e){return _0x41694e();},'nVcte':_0x2ff6(0x177),'MIQvB':_0x2ff6(0x134),'zzMmc':function(_0x4742d7,_0x304561,_0x3f423d){return _0x4742d7(_0x304561,_0x3f423d);},'xzTjv':function(_0xda3a09,_0x6b4f50){return _0xda3a09===_0x6b4f50;},'jdWwn':_0x2ff6(0x1c4),'toEil':_0x2ff6(0x1c5),'gKVfh':_0x2ff6(0x1c6),'JCHDt':function(_0x3bcffa){return _0x3bcffa();},'wFHbP':_0x2ff6(0x1c7),'xDgjM':function(_0x5e147a,_0x5359ab){return _0x5e147a===_0x5359ab;},'PPtNn':_0x2ff6(0x1c8),'EmRQO':_0x2ff6(0x1c9),'Lzugq':'Insufficient\x20permissions\x20for\x20this\x20operation','cnOpw':function(_0x5376ad,_0x3449c8){return _0x5376ad(_0x3449c8);},'DmlNj':_0x2ff6(0x1ca),'cPLNc':_0x2ff6(0x135),'kOYcb':_0x2ff6(0x136)};!isUserAuthenticated()&&await _0x49959b['ojOQh'](loadJWT);if(!_0x49959b[_0x2ff6(0x1cb)](isUserAuthenticated))throw new Error(_0x49959b[_0x2ff6(0x1cc)]);const _0xe34751=_0x49959b['ojOQh'](getApiConfig)||{'environment':_0x2ff6(0x134),'timeout':0x7530,'enableLogging':![]},_0x2020b1=API_ENDPOINTS[_0xe34751['environment']||_0x49959b[_0x2ff6(0x1cd)]],_0x269fbd=''+_0x2020b1+(_0x389f76['startsWith']('/')?'':'/')+_0x389f76,_0x7195b9={..._0x49959b['ojOQh'](getUserAuthHeaders),..._0x68d2f7[_0x2ff6(0x1a6)]||{}},_0x42b948=new AbortController(),_0x237349=setTimeout(()=>_0x42b948[_0x2ff6(0x95)](),_0xe34751[_0x2ff6(0x1a)]||0x7530);try{_0xe34751[_0x2ff6(0x2f)]&&console[_0x2ff6(0x22)](_0x2ff6(0x1ce)+_0x389f76);const _0x198602=await _0x49959b[_0x2ff6(0x1cf)](fetch,_0x269fbd,{..._0x68d2f7,'headers':_0x7195b9,'signal':_0x42b948[_0x2ff6(0xa0)]});clearTimeout(_0x237349);if(_0xe34751['enableLogging']){if(_0x49959b[_0x2ff6(0x1d0)](_0x49959b['jdWwn'],_0x49959b[_0x2ff6(0x1d1)]))console[_0x2ff6(0x22)](_0x2ff6(0x1d2)+_0x198602['status']+'\x20for\x20'+_0x389f76);else{var _0x5a30b4;const _0x45cd98={'isValid':!![],'permissions':_0x5e672a[_0x2ff6(0x58)]||[],'rateLimits':_0xedaab0[_0x2ff6(0x59)]||null,'keyType':_0x551daf};_0x1ae199[_0x2ff6(0xda)](_0x16f305,{'result':_0x45cd98,'timestamp':_0x322563[_0x2ff6(0x8c)]()});if(_0x49959b[_0x2ff6(0x1d3)](_0x5a30b4=_0x51c27d,null)&&_0x49959b[_0x2ff6(0x1d3)](_0x5a30b4,void 0x0)&&_0x5a30b4[_0x2ff6(0x2f)]){var _0x617899,_0x4a926e,_0x12ae79;_0x4e0dad[_0x2ff6(0x22)](_0x49959b[_0x2ff6(0x1d4)],{'apiKeyId':_0x49959b['ZVlVF'](_0x617899=_0x341bec[_0x2ff6(0x24)],null)||_0x617899===void 0x0?void 0x0:_0x617899['id'],'appName':_0x49959b['ZVlVF'](_0x4a926e=_0x310321[_0x2ff6(0xde)],null)||_0x49959b['uULGM'](_0x4a926e,void 0x0)?void 0x0:_0x4a926e['name'],'usageCount':_0x49959b['TeEUY'](_0x12ae79=_0x2217d8[_0x2ff6(0x24)],null)||_0x49959b[_0x2ff6(0x1d5)](_0x12ae79,void 0x0)?void 0x0:_0x12ae79[_0x2ff6(0xe3)]});}return _0x45cd98;}}if(_0x49959b[_0x2ff6(0x1d6)](_0x198602[_0x2ff6(0xa4)],0x191)){if(_0x49959b[_0x2ff6(0x1d5)](_0x49959b[_0x2ff6(0x1d7)],_0x49959b[_0x2ff6(0x1d7)])){console[_0x2ff6(0x27)](_0x49959b['gKVfh']),await _0x49959b[_0x2ff6(0x1d8)](clearJWT);throw new Error(_0x49959b[_0x2ff6(0x1d9)]);}else return _0xbdec0[_0x49959b[_0x2ff6(0x1da)]]=_0x49959b['juZpN'],_0x239631[_0x49959b[_0x2ff6(0x1db)]]=_0x49959b[_0x2ff6(0x1dc)],_0x4ea5a1;}if(_0x49959b[_0x2ff6(0x1dd)](_0x198602[_0x2ff6(0xa4)],0x193)){if(_0x49959b[_0x2ff6(0x1dd)](_0x49959b['PPtNn'],_0x49959b['EmRQO']))_0x6c98c7[_0x2ff6(0x22)]('🌐\x20Making\x20authenticated\x20request\x20to:\x20'+_0x3bdec4);else{console[_0x2ff6(0x27)](_0x2ff6(0x1de));throw new Error(_0x49959b[_0x2ff6(0x1df)]);}}return _0x198602;}catch(_0x285c44){_0x49959b[_0x2ff6(0x1e0)](clearTimeout,_0x237349);if(_0x285c44['name']===_0x2ff6(0x7e)){if(_0x49959b[_0x2ff6(0x1d3)](_0x49959b['DmlNj'],_0x2ff6(0x1e1))){console[_0x2ff6(0x27)](_0x49959b['cPLNc'],_0x389f76);throw new Error(_0x49959b[_0x2ff6(0x1e2)]);}else return _0x59bcd6[_0x2ff6(0xc)](_0x49959b[_0x2ff6(0x1e3)]),null;}throw _0x285c44;}};export const clearValidationCache=()=>{const _0x350ff1={'BndId':function(_0x51fd5b,_0x18a31f){return _0x51fd5b!==_0x18a31f;},'eNvCn':function(_0x36077b,_0x40b01f){return _0x36077b!==_0x40b01f;}};var _0x393e7b;validationCache[_0x2ff6(0x169)](),_0x350ff1['BndId'](_0x393e7b=globalConfig,null)&&_0x350ff1[_0x2ff6(0x1e4)](_0x393e7b,void 0x0)&&_0x393e7b[_0x2ff6(0x2f)]&&console['log'](_0x2ff6(0x1e5));};export const resetApiKeyService=()=>{const _0x39d980={'sOFGq':function(_0x209348){return _0x209348();},'Vifla':'🔄\x20API\x20key\x20service\x20reset'};globalConfig=null,isInitialized=![],_0x39d980['sOFGq'](clearValidationCache),console['log'](_0x39d980['Vifla']);};
|