@onairos/react-native 3.4.0 → 3.5.4
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 +62 -13
- 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/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 +22 -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 +29 -1702
- package/lib/commonjs/components/VerificationStep.js +11 -0
- package/lib/commonjs/components/WelcomeScreen.js +21 -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 +14 -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 +35 -106
- package/lib/commonjs/services/SDK_API_KEY_VALIDATION.md +31 -38
- package/lib/commonjs/services/apiClient.js +8 -0
- package/lib/commonjs/services/apiKeyService.js +9 -946
- 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/imageCompressionService.js +7 -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/storageService.js +8 -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/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/index.js +9 -0
- package/lib/commonjs/utils/webviewScripts/linkedin.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/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 +1 -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 +31 -38
- package/lib/module/services/apiClient.js +1 -0
- package/lib/module/services/apiKeyService.js +1 -919
- 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/imageCompressionService.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/storageService.js +1 -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/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/index.js +1 -0
- package/lib/module/utils/webviewScripts/linkedin.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 -428
- package/src/services/apiKeyService.ts +0 -979
- 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,946 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
// Admin key for backend validation
|
|
11
|
-
const ADMIN_API_KEY = exports.ADMIN_API_KEY = 'OnairosIsAUnicorn2025';
|
|
12
|
-
|
|
13
|
-
// API key types
|
|
14
|
-
let ApiKeyType = exports.ApiKeyType = /*#__PURE__*/function (ApiKeyType) {
|
|
15
|
-
ApiKeyType["DEVELOPER"] = "developer";
|
|
16
|
-
ApiKeyType["ADMIN"] = "admin";
|
|
17
|
-
ApiKeyType["INVALID"] = "invalid";
|
|
18
|
-
return ApiKeyType;
|
|
19
|
-
}({}); // JWT token storage key
|
|
20
|
-
const JWT_TOKEN_KEY = 'onairos_jwt_token';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Two-Tier Authentication Service for Onairos React Native SDK
|
|
24
|
-
*
|
|
25
|
-
* This service implements the two-tier authentication system:
|
|
26
|
-
* 1. Developer API Keys: For app-level operations (email verification, app registration)
|
|
27
|
-
* 2. JWT User Tokens: For user-level operations (PIN storage, user profile)
|
|
28
|
-
*
|
|
29
|
-
* How it works:
|
|
30
|
-
* 1. Initialize with developer API key
|
|
31
|
-
* 2. Use API key for email verification requests
|
|
32
|
-
* 3. Store JWT token from email verification response
|
|
33
|
-
* 4. Use JWT token for user-authenticated requests
|
|
34
|
-
* 5. Handle token expiration gracefully
|
|
35
|
-
*
|
|
36
|
-
* Backend Integration:
|
|
37
|
-
* - Developer routes: Authorization: Bearer ${API_KEY}
|
|
38
|
-
* - User routes: Authorization: Bearer ${JWT_TOKEN}
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
// Global configuration state
|
|
42
|
-
let globalConfig = null;
|
|
43
|
-
let validationCache = new Map();
|
|
44
|
-
let isInitialized = false;
|
|
45
|
-
let userToken = null;
|
|
46
|
-
|
|
47
|
-
// Cache duration (5 minutes)
|
|
48
|
-
const CACHE_DURATION = 5 * 60 * 1000;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Check network connectivity
|
|
52
|
-
* @returns Promise<boolean> - true if connected, false otherwise
|
|
53
|
-
*/
|
|
54
|
-
const checkNetworkConnectivity = async () => {
|
|
55
|
-
try {
|
|
56
|
-
const netInfo = await _netinfo.default.fetch();
|
|
57
|
-
return netInfo.isConnected === true && netInfo.isInternetReachable !== false;
|
|
58
|
-
} catch (error) {
|
|
59
|
-
console.warn('⚠️ Failed to check network connectivity:', error);
|
|
60
|
-
// If we can't check connectivity, assume we're connected and let the request fail naturally
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
// API endpoints for different environments (updated to handle non-existent dev endpoint)
|
|
66
|
-
const API_ENDPOINTS = {
|
|
67
|
-
production: 'https://api2.onairos.uk',
|
|
68
|
-
staging: 'https://api2.onairos.uk',
|
|
69
|
-
// Fallback to production for staging
|
|
70
|
-
development: 'https://api2.onairos.uk' // Fallback to production since dev-api2.onairos.uk doesn't exist
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Initialize the SDK with developer API key
|
|
75
|
-
* @param config API configuration including developer API key
|
|
76
|
-
*/
|
|
77
|
-
const initializeApiKey = async config => {
|
|
78
|
-
try {
|
|
79
|
-
console.log('🔑 Initializing Onairos SDK with developer API key...');
|
|
80
|
-
if (!config.apiKey) {
|
|
81
|
-
throw new Error('Developer API key is required for SDK initialization');
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Check if it's admin key first (admin key is shorter than 32 chars)
|
|
85
|
-
if (!isAdminKey(config.apiKey) && config.apiKey.length < 32) {
|
|
86
|
-
throw new Error('Invalid API key format. Developer keys must be at least 32 characters long.');
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Set global configuration
|
|
90
|
-
globalConfig = {
|
|
91
|
-
apiKey: config.apiKey,
|
|
92
|
-
environment: config.environment || 'production',
|
|
93
|
-
enableLogging: config.enableLogging !== false,
|
|
94
|
-
// Default to true
|
|
95
|
-
timeout: config.timeout || 30000,
|
|
96
|
-
retryAttempts: config.retryAttempts || 3
|
|
97
|
-
};
|
|
98
|
-
if (globalConfig.enableLogging) {
|
|
99
|
-
console.log('📝 SDK Configuration:', {
|
|
100
|
-
environment: globalConfig.environment,
|
|
101
|
-
timeout: globalConfig.timeout,
|
|
102
|
-
retryAttempts: globalConfig.retryAttempts,
|
|
103
|
-
apiKeyPrefix: config.apiKey.substring(0, 8) + '...',
|
|
104
|
-
enableLogging: globalConfig.enableLogging
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Validate the API key (handles both admin and developer keys)
|
|
109
|
-
const validation = await validateApiKey(config.apiKey);
|
|
110
|
-
if (!validation.isValid) {
|
|
111
|
-
// Use defensive coding to handle cases where validation.error might be undefined
|
|
112
|
-
const errorMessage = validation.error || '';
|
|
113
|
-
|
|
114
|
-
// Check if it's a network/connectivity issue (either from error message or the flag)
|
|
115
|
-
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');
|
|
116
|
-
if (isNetworkError) {
|
|
117
|
-
console.warn('⚠️ API key validation failed due to network/connectivity issues');
|
|
118
|
-
console.warn('🔄 Continuing in offline mode with basic validation');
|
|
119
|
-
console.warn('📝 SDK will function with limited validation. Network connectivity will be retried automatically.');
|
|
120
|
-
console.warn('🌐 Error details:', validation.error);
|
|
121
|
-
|
|
122
|
-
// Continue initialization in offline mode - don't throw error
|
|
123
|
-
console.log('📱 SDK initialized in offline mode - will retry validation when network is available');
|
|
124
|
-
} else {
|
|
125
|
-
// Only throw for actual API key validation errors (not network issues)
|
|
126
|
-
throw new Error(`API key validation failed: ${validation.error}`);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Try to load existing JWT token
|
|
131
|
-
await loadJWT();
|
|
132
|
-
isInitialized = true;
|
|
133
|
-
if (globalConfig.enableLogging) {
|
|
134
|
-
console.log('✅ Onairos SDK initialized successfully');
|
|
135
|
-
if (isAdminKey(config.apiKey)) {
|
|
136
|
-
console.log('🔑 Admin API key ready with full permissions');
|
|
137
|
-
} else {
|
|
138
|
-
console.log('🔑 Developer API key ready for app-level operations');
|
|
139
|
-
}
|
|
140
|
-
if (userToken) {
|
|
141
|
-
console.log('🎫 User JWT token loaded from storage');
|
|
142
|
-
}
|
|
143
|
-
if (validation.permissions) {
|
|
144
|
-
console.log('🔐 API Key Permissions:', validation.permissions);
|
|
145
|
-
}
|
|
146
|
-
if (validation.rateLimits) {
|
|
147
|
-
console.log('⏱️ Rate Limits:', validation.rateLimits);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
} catch (error) {
|
|
151
|
-
console.error('❌ Failed to initialize Onairos SDK:', error);
|
|
152
|
-
isInitialized = false;
|
|
153
|
-
throw error;
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Determine API key type
|
|
159
|
-
* @param apiKey The API key to check
|
|
160
|
-
* @returns The type of API key
|
|
161
|
-
*/
|
|
162
|
-
exports.initializeApiKey = initializeApiKey;
|
|
163
|
-
const getApiKeyType = apiKey => {
|
|
164
|
-
if (apiKey === ADMIN_API_KEY) {
|
|
165
|
-
return ApiKeyType.ADMIN;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// Developer keys should be at least 32 characters and start with specific prefix
|
|
169
|
-
if (apiKey.length >= 32 && (apiKey.startsWith('dev_') || apiKey.startsWith('pk_') || apiKey.startsWith('ona_'))) {
|
|
170
|
-
return ApiKeyType.DEVELOPER;
|
|
171
|
-
}
|
|
172
|
-
return ApiKeyType.INVALID;
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Check if API key is admin key
|
|
177
|
-
* @param apiKey The API key to check
|
|
178
|
-
* @returns True if admin key
|
|
179
|
-
*/
|
|
180
|
-
exports.getApiKeyType = getApiKeyType;
|
|
181
|
-
const isAdminKey = apiKey => {
|
|
182
|
-
return apiKey === ADMIN_API_KEY;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Validate an API key with the Onairos backend
|
|
187
|
-
* @param apiKey The API key to validate
|
|
188
|
-
* @returns Validation result with permissions and rate limits
|
|
189
|
-
*/
|
|
190
|
-
exports.isAdminKey = isAdminKey;
|
|
191
|
-
const validateApiKey = async apiKey => {
|
|
192
|
-
try {
|
|
193
|
-
var _globalConfig2, _globalConfig3, _globalConfig4;
|
|
194
|
-
console.log('🔍 Validating API key...');
|
|
195
|
-
|
|
196
|
-
// Check if it's an admin key
|
|
197
|
-
if (isAdminKey(apiKey)) {
|
|
198
|
-
console.log('🔑 Admin key detected - granting full permissions');
|
|
199
|
-
return {
|
|
200
|
-
isValid: true,
|
|
201
|
-
permissions: ['*'],
|
|
202
|
-
// Full permissions for admin
|
|
203
|
-
rateLimits: {
|
|
204
|
-
remaining: 999999,
|
|
205
|
-
resetTime: Date.now() + 24 * 60 * 60 * 1000 // 24 hours
|
|
206
|
-
},
|
|
207
|
-
keyType: ApiKeyType.ADMIN
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Check basic format for developer keys
|
|
212
|
-
const keyType = getApiKeyType(apiKey);
|
|
213
|
-
if (keyType === ApiKeyType.INVALID) {
|
|
214
|
-
return {
|
|
215
|
-
isValid: false,
|
|
216
|
-
error: 'Invalid API key format. Developer keys must be at least 32 characters and start with "dev_", "pk_", or "ona_"',
|
|
217
|
-
keyType: ApiKeyType.INVALID
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// Check cache first
|
|
222
|
-
const cached = validationCache.get(apiKey);
|
|
223
|
-
if (cached && Date.now() - cached.timestamp < CACHE_DURATION) {
|
|
224
|
-
var _globalConfig;
|
|
225
|
-
if ((_globalConfig = globalConfig) !== null && _globalConfig !== void 0 && _globalConfig.enableLogging) {
|
|
226
|
-
console.log('📋 Using cached API key validation result');
|
|
227
|
-
}
|
|
228
|
-
return cached.result;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// Check network connectivity before making API calls
|
|
232
|
-
const isConnected = await checkNetworkConnectivity();
|
|
233
|
-
if (!isConnected) {
|
|
234
|
-
console.warn('⚠️ No network connectivity detected');
|
|
235
|
-
return {
|
|
236
|
-
isValid: false,
|
|
237
|
-
error: 'No network connection available. Please check your internet connection and try again.',
|
|
238
|
-
keyType: keyType,
|
|
239
|
-
isNetworkError: true
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
const environment = ((_globalConfig2 = globalConfig) === null || _globalConfig2 === void 0 ? void 0 : _globalConfig2.environment) || 'production';
|
|
243
|
-
const baseUrl = API_ENDPOINTS[environment];
|
|
244
|
-
const timeout = ((_globalConfig3 = globalConfig) === null || _globalConfig3 === void 0 ? void 0 : _globalConfig3.timeout) || 30000;
|
|
245
|
-
const maxRetries = ((_globalConfig4 = globalConfig) === null || _globalConfig4 === void 0 ? void 0 : _globalConfig4.retryAttempts) || 3;
|
|
246
|
-
|
|
247
|
-
// Retry logic for network failures
|
|
248
|
-
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
249
|
-
// Create abort controller for timeout
|
|
250
|
-
const controller = new AbortController();
|
|
251
|
-
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
252
|
-
try {
|
|
253
|
-
var _globalConfig5;
|
|
254
|
-
if ((_globalConfig5 = globalConfig) !== null && _globalConfig5 !== void 0 && _globalConfig5.enableLogging && attempt > 1) {
|
|
255
|
-
console.log(`🔄 Retry attempt ${attempt}/${maxRetries} for API key validation`);
|
|
256
|
-
}
|
|
257
|
-
const response = await fetch(`${baseUrl}/dev/validate`, {
|
|
258
|
-
method: 'POST',
|
|
259
|
-
headers: {
|
|
260
|
-
'Content-Type': 'application/json',
|
|
261
|
-
'Authorization': `Bearer ${apiKey}`,
|
|
262
|
-
'User-Agent': 'OnairosReactNative/3.3.1',
|
|
263
|
-
'X-API-Key-Type': keyType,
|
|
264
|
-
'X-SDK-Platform': 'react-native',
|
|
265
|
-
'X-Retry-Attempt': attempt.toString()
|
|
266
|
-
},
|
|
267
|
-
body: JSON.stringify({
|
|
268
|
-
environment,
|
|
269
|
-
sdk_version: '3.3.1',
|
|
270
|
-
platform: 'react-native',
|
|
271
|
-
keyType,
|
|
272
|
-
timestamp: new Date().toISOString(),
|
|
273
|
-
attempt
|
|
274
|
-
}),
|
|
275
|
-
signal: controller.signal
|
|
276
|
-
});
|
|
277
|
-
clearTimeout(timeoutId);
|
|
278
|
-
|
|
279
|
-
// First check if we got a valid response
|
|
280
|
-
if (!response) {
|
|
281
|
-
throw new Error('No response received from server');
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// Handle common HTTP errors that indicate server issues
|
|
285
|
-
if (response.status === 502) {
|
|
286
|
-
throw new Error('Onairos API is temporarily unavailable (502 Bad Gateway). Please try again later.');
|
|
287
|
-
}
|
|
288
|
-
if (response.status === 503) {
|
|
289
|
-
throw new Error('Onairos API is under maintenance (503 Service Unavailable). Please try again later.');
|
|
290
|
-
}
|
|
291
|
-
if (response.status === 504) {
|
|
292
|
-
throw new Error('Onairos API request timed out (504 Gateway Timeout). Please try again.');
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// Check if response is actually JSON before trying to parse
|
|
296
|
-
const contentType = response.headers.get('content-type');
|
|
297
|
-
const isJsonResponse = contentType && contentType.includes('application/json');
|
|
298
|
-
if (!isJsonResponse) {
|
|
299
|
-
const textContent = await response.text();
|
|
300
|
-
const previewText = textContent.substring(0, 200);
|
|
301
|
-
console.error('❌ API endpoint returned non-JSON response:', {
|
|
302
|
-
status: response.status,
|
|
303
|
-
statusText: response.statusText,
|
|
304
|
-
contentType: contentType || 'unknown',
|
|
305
|
-
preview: previewText,
|
|
306
|
-
url: `${baseUrl}/dev/validate`,
|
|
307
|
-
attempt: attempt
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
// Handle specific error cases
|
|
311
|
-
if (response.status === 404) {
|
|
312
|
-
throw new Error(`API validation endpoint not found (404). The endpoint ${baseUrl}/dev/validate may not exist or be configured correctly.`);
|
|
313
|
-
} else if (response.status === 500) {
|
|
314
|
-
throw new Error(`Server error (500). The Onairos backend is experiencing issues.`);
|
|
315
|
-
} else if (response.status === 502 || response.status === 503) {
|
|
316
|
-
throw new Error(`Service unavailable (${response.status}). The Onairos backend may be temporarily down.`);
|
|
317
|
-
} else if (textContent.includes('<html') || textContent.includes('<!DOCTYPE')) {
|
|
318
|
-
throw new Error(`Server returned HTML page instead of JSON API response. This often indicates a routing issue or server misconfiguration.`);
|
|
319
|
-
} else {
|
|
320
|
-
throw new Error(`API validation endpoint returned ${response.status} - ${response.statusText}. Expected JSON but got ${contentType || 'unknown content type'}.`);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// Parse JSON response
|
|
325
|
-
let data;
|
|
326
|
-
try {
|
|
327
|
-
data = await response.json();
|
|
328
|
-
} catch (jsonError) {
|
|
329
|
-
console.error('❌ Failed to parse JSON response:', {
|
|
330
|
-
error: jsonError.message,
|
|
331
|
-
status: response.status,
|
|
332
|
-
contentType,
|
|
333
|
-
attempt: attempt
|
|
334
|
-
});
|
|
335
|
-
throw new Error(`Failed to parse server response as JSON: ${jsonError.message}`);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
// Handle successful response
|
|
339
|
-
if (response.ok && data.success) {
|
|
340
|
-
var _globalConfig6;
|
|
341
|
-
const result = {
|
|
342
|
-
isValid: true,
|
|
343
|
-
permissions: data.permissions || [],
|
|
344
|
-
rateLimits: data.rateLimits || null,
|
|
345
|
-
keyType: keyType
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
// Cache the successful result
|
|
349
|
-
validationCache.set(apiKey, {
|
|
350
|
-
result,
|
|
351
|
-
timestamp: Date.now()
|
|
352
|
-
});
|
|
353
|
-
if ((_globalConfig6 = globalConfig) !== null && _globalConfig6 !== void 0 && _globalConfig6.enableLogging) {
|
|
354
|
-
console.log('✅ API key validation successful');
|
|
355
|
-
}
|
|
356
|
-
return result;
|
|
357
|
-
} else {
|
|
358
|
-
// Handle API errors (invalid key, etc.)
|
|
359
|
-
const errorMessage = data.error || data.message || `HTTP ${response.status}: ${response.statusText}`;
|
|
360
|
-
const result = {
|
|
361
|
-
isValid: false,
|
|
362
|
-
error: errorMessage,
|
|
363
|
-
keyType: keyType
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
// For client errors (4xx), don't retry
|
|
367
|
-
if (response.status >= 400 && response.status < 500) {
|
|
368
|
-
var _globalConfig7;
|
|
369
|
-
if ((_globalConfig7 = globalConfig) !== null && _globalConfig7 !== void 0 && _globalConfig7.enableLogging) {
|
|
370
|
-
console.error('❌ API key validation failed (client error):', errorMessage);
|
|
371
|
-
}
|
|
372
|
-
return result;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
// For server errors (5xx), retry
|
|
376
|
-
throw new Error(errorMessage);
|
|
377
|
-
}
|
|
378
|
-
} catch (fetchError) {
|
|
379
|
-
var _globalConfig8;
|
|
380
|
-
clearTimeout(timeoutId);
|
|
381
|
-
if (fetchError.name === 'AbortError') {
|
|
382
|
-
const errorMessage = `API key validation timeout (${timeout}ms)`;
|
|
383
|
-
console.error('⏱️ API key validation timeout');
|
|
384
|
-
if (attempt === maxRetries) {
|
|
385
|
-
return {
|
|
386
|
-
isValid: false,
|
|
387
|
-
error: errorMessage,
|
|
388
|
-
keyType: keyType
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
continue; // Retry timeout errors
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
// Enhanced error message based on error type
|
|
395
|
-
let errorMessage = `Network error during API key validation: ${fetchError.message}`;
|
|
396
|
-
|
|
397
|
-
// Add specific guidance for common errors
|
|
398
|
-
if (fetchError.message.includes('JSON Parse error') || fetchError.message.includes('Unexpected character')) {
|
|
399
|
-
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}`;
|
|
400
|
-
} else if (fetchError.message.includes('Network request failed') || fetchError.message.includes('fetch')) {
|
|
401
|
-
errorMessage = `Network connectivity issue. Please check internet connection and verify the Onairos API is accessible. ${fetchError.message}`;
|
|
402
|
-
} else if (fetchError.message.includes('DNS') || fetchError.message.includes('ENOTFOUND')) {
|
|
403
|
-
errorMessage = `DNS resolution failed for ${baseUrl}. Please check network settings and domain accessibility. ${fetchError.message}`;
|
|
404
|
-
}
|
|
405
|
-
console.error('🌐 Network error during API key validation:', {
|
|
406
|
-
error: fetchError,
|
|
407
|
-
endpoint: `${baseUrl}/dev/validate`,
|
|
408
|
-
attempt: attempt,
|
|
409
|
-
maxRetries: maxRetries,
|
|
410
|
-
retryable: attempt < maxRetries
|
|
411
|
-
});
|
|
412
|
-
|
|
413
|
-
// If this is the last attempt, return the error
|
|
414
|
-
if (attempt === maxRetries) {
|
|
415
|
-
return {
|
|
416
|
-
isValid: false,
|
|
417
|
-
error: errorMessage,
|
|
418
|
-
keyType: keyType,
|
|
419
|
-
isNetworkError: true // Flag to indicate this is a network issue, not an API key issue
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
// Wait before retrying (exponential backoff)
|
|
424
|
-
const backoffDelay = Math.min(1000 * Math.pow(2, attempt - 1), 5000);
|
|
425
|
-
if ((_globalConfig8 = globalConfig) !== null && _globalConfig8 !== void 0 && _globalConfig8.enableLogging) {
|
|
426
|
-
console.log(`⏳ Waiting ${backoffDelay}ms before retry...`);
|
|
427
|
-
}
|
|
428
|
-
await new Promise(resolve => setTimeout(() => resolve(), backoffDelay));
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
// This should never be reached, but just in case
|
|
433
|
-
return {
|
|
434
|
-
isValid: false,
|
|
435
|
-
error: 'All retry attempts exhausted',
|
|
436
|
-
keyType: keyType
|
|
437
|
-
};
|
|
438
|
-
} catch (error) {
|
|
439
|
-
const errorMessage = `API key validation error: ${error.message}`;
|
|
440
|
-
console.error('❌ API key validation error:', error);
|
|
441
|
-
return {
|
|
442
|
-
isValid: false,
|
|
443
|
-
error: errorMessage,
|
|
444
|
-
keyType: ApiKeyType.INVALID
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* Get the current API configuration
|
|
451
|
-
* @returns Current API configuration or null if not initialized
|
|
452
|
-
*/
|
|
453
|
-
exports.validateApiKey = validateApiKey;
|
|
454
|
-
const getApiConfig = () => {
|
|
455
|
-
return globalConfig;
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
/**
|
|
459
|
-
* Get the current API key
|
|
460
|
-
* @returns Current API key or null if not initialized
|
|
461
|
-
*/
|
|
462
|
-
exports.getApiConfig = getApiConfig;
|
|
463
|
-
const getApiKey = () => {
|
|
464
|
-
var _globalConfig9;
|
|
465
|
-
return ((_globalConfig9 = globalConfig) === null || _globalConfig9 === void 0 ? void 0 : _globalConfig9.apiKey) || null;
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
/**
|
|
469
|
-
* Check if the SDK is properly initialized
|
|
470
|
-
* @returns True if initialized with valid API key
|
|
471
|
-
*/
|
|
472
|
-
exports.getApiKey = getApiKey;
|
|
473
|
-
const isApiKeyInitialized = () => {
|
|
474
|
-
return isInitialized && globalConfig !== null;
|
|
475
|
-
};
|
|
476
|
-
|
|
477
|
-
/**
|
|
478
|
-
* Store JWT token securely after email verification
|
|
479
|
-
* @param token JWT token from email verification response
|
|
480
|
-
*/
|
|
481
|
-
exports.isApiKeyInitialized = isApiKeyInitialized;
|
|
482
|
-
const storeJWT = async token => {
|
|
483
|
-
try {
|
|
484
|
-
var _globalConfig0;
|
|
485
|
-
await _asyncStorage.default.setItem(JWT_TOKEN_KEY, token);
|
|
486
|
-
userToken = token;
|
|
487
|
-
if ((_globalConfig0 = globalConfig) !== null && _globalConfig0 !== void 0 && _globalConfig0.enableLogging) {
|
|
488
|
-
console.log('🎫 JWT token stored successfully');
|
|
489
|
-
}
|
|
490
|
-
} catch (error) {
|
|
491
|
-
console.error('❌ Failed to store JWT token:', error);
|
|
492
|
-
throw error;
|
|
493
|
-
}
|
|
494
|
-
};
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* Load JWT token from storage
|
|
498
|
-
* @returns JWT token or null if not found
|
|
499
|
-
*/
|
|
500
|
-
exports.storeJWT = storeJWT;
|
|
501
|
-
const loadJWT = async () => {
|
|
502
|
-
try {
|
|
503
|
-
const token = await _asyncStorage.default.getItem(JWT_TOKEN_KEY);
|
|
504
|
-
userToken = token;
|
|
505
|
-
return token;
|
|
506
|
-
} catch (error) {
|
|
507
|
-
console.error('❌ Failed to load JWT token:', error);
|
|
508
|
-
return null;
|
|
509
|
-
}
|
|
510
|
-
};
|
|
511
|
-
|
|
512
|
-
/**
|
|
513
|
-
* Get current JWT token
|
|
514
|
-
* @returns JWT token or null if not available
|
|
515
|
-
*/
|
|
516
|
-
exports.loadJWT = loadJWT;
|
|
517
|
-
const getJWT = () => {
|
|
518
|
-
return userToken;
|
|
519
|
-
};
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* Clear JWT token (on logout or token expiration)
|
|
523
|
-
*/
|
|
524
|
-
exports.getJWT = getJWT;
|
|
525
|
-
const clearJWT = async () => {
|
|
526
|
-
try {
|
|
527
|
-
var _globalConfig1;
|
|
528
|
-
await _asyncStorage.default.removeItem(JWT_TOKEN_KEY);
|
|
529
|
-
userToken = null;
|
|
530
|
-
if ((_globalConfig1 = globalConfig) !== null && _globalConfig1 !== void 0 && _globalConfig1.enableLogging) {
|
|
531
|
-
console.log('🗑️ JWT token cleared');
|
|
532
|
-
}
|
|
533
|
-
} catch (error) {
|
|
534
|
-
console.error('❌ Failed to clear JWT token:', error);
|
|
535
|
-
}
|
|
536
|
-
};
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* React Native compatible base64 decoder
|
|
540
|
-
* @param str Base64 encoded string
|
|
541
|
-
* @returns Decoded string
|
|
542
|
-
*/
|
|
543
|
-
exports.clearJWT = clearJWT;
|
|
544
|
-
const base64Decode = str => {
|
|
545
|
-
// Simple base64 decoding for React Native
|
|
546
|
-
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
547
|
-
let result = '';
|
|
548
|
-
let i = 0;
|
|
549
|
-
str = str.replace(/[^A-Za-z0-9+/]/g, '');
|
|
550
|
-
while (i < str.length) {
|
|
551
|
-
const a = chars.indexOf(str.charAt(i++));
|
|
552
|
-
const b = chars.indexOf(str.charAt(i++));
|
|
553
|
-
const c = chars.indexOf(str.charAt(i++));
|
|
554
|
-
const d = chars.indexOf(str.charAt(i++));
|
|
555
|
-
const bitmap = a << 18 | b << 12 | c << 6 | d;
|
|
556
|
-
result += String.fromCharCode(bitmap >> 16 & 255);
|
|
557
|
-
if (c !== 64) result += String.fromCharCode(bitmap >> 8 & 255);
|
|
558
|
-
if (d !== 64) result += String.fromCharCode(bitmap & 255);
|
|
559
|
-
}
|
|
560
|
-
return result;
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* Decode JWT token payload (React Native compatible)
|
|
565
|
-
* @param token JWT token string
|
|
566
|
-
* @returns Decoded payload or null if invalid
|
|
567
|
-
*/
|
|
568
|
-
const decodeJWTPayload = token => {
|
|
569
|
-
try {
|
|
570
|
-
// Split JWT token (header.payload.signature)
|
|
571
|
-
const parts = token.split('.');
|
|
572
|
-
if (parts.length !== 3) {
|
|
573
|
-
console.error('❌ Invalid JWT token format');
|
|
574
|
-
return null;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
// Decode payload (base64url to base64)
|
|
578
|
-
const payload = parts[1];
|
|
579
|
-
const base64 = payload.replace(/-/g, '+').replace(/_/g, '/');
|
|
580
|
-
|
|
581
|
-
// Add padding if needed
|
|
582
|
-
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, '=');
|
|
583
|
-
|
|
584
|
-
// Decode base64 to JSON using React Native compatible decoder
|
|
585
|
-
const decoded = base64Decode(padded);
|
|
586
|
-
return JSON.parse(decoded);
|
|
587
|
-
} catch (error) {
|
|
588
|
-
console.error('❌ Failed to decode JWT token:', error);
|
|
589
|
-
return null;
|
|
590
|
-
}
|
|
591
|
-
};
|
|
592
|
-
|
|
593
|
-
/**
|
|
594
|
-
* Extract username from JWT token
|
|
595
|
-
* @param token JWT token (optional, uses stored token if not provided)
|
|
596
|
-
* @returns Username or null if not found
|
|
597
|
-
*/
|
|
598
|
-
exports.decodeJWTPayload = decodeJWTPayload;
|
|
599
|
-
const extractUsernameFromJWT = token => {
|
|
600
|
-
try {
|
|
601
|
-
var _globalConfig10;
|
|
602
|
-
const jwtToken = token || userToken;
|
|
603
|
-
if (!jwtToken) {
|
|
604
|
-
console.warn('⚠️ No JWT token available for username extraction');
|
|
605
|
-
return null;
|
|
606
|
-
}
|
|
607
|
-
const payload = decodeJWTPayload(jwtToken);
|
|
608
|
-
if (!payload) {
|
|
609
|
-
return null;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
// Try different possible username fields in order of preference
|
|
613
|
-
const username = payload.userName || payload.username || payload.userId || payload.email;
|
|
614
|
-
if ((_globalConfig10 = globalConfig) !== null && _globalConfig10 !== void 0 && _globalConfig10.enableLogging) {
|
|
615
|
-
console.log('👤 Extracted username from JWT:', username);
|
|
616
|
-
}
|
|
617
|
-
return username || null;
|
|
618
|
-
} catch (error) {
|
|
619
|
-
console.error('❌ Failed to extract username from JWT:', error);
|
|
620
|
-
return null;
|
|
621
|
-
}
|
|
622
|
-
};
|
|
623
|
-
|
|
624
|
-
/**
|
|
625
|
-
* Extract user data from JWT token
|
|
626
|
-
* @param token JWT token (optional, uses stored token if not provided)
|
|
627
|
-
* @returns User data object or null if not found
|
|
628
|
-
*/
|
|
629
|
-
exports.extractUsernameFromJWT = extractUsernameFromJWT;
|
|
630
|
-
const extractUserDataFromJWT = token => {
|
|
631
|
-
try {
|
|
632
|
-
var _globalConfig11;
|
|
633
|
-
const jwtToken = token || userToken;
|
|
634
|
-
if (!jwtToken) {
|
|
635
|
-
console.warn('⚠️ No JWT token available for user data extraction');
|
|
636
|
-
return null;
|
|
637
|
-
}
|
|
638
|
-
const payload = decodeJWTPayload(jwtToken);
|
|
639
|
-
if (!payload) {
|
|
640
|
-
return null;
|
|
641
|
-
}
|
|
642
|
-
const userData = {
|
|
643
|
-
id: payload.id,
|
|
644
|
-
email: payload.email,
|
|
645
|
-
userId: payload.userId,
|
|
646
|
-
userName: payload.userName || payload.username,
|
|
647
|
-
verified: payload.verified,
|
|
648
|
-
iat: payload.iat,
|
|
649
|
-
exp: payload.exp
|
|
650
|
-
};
|
|
651
|
-
if ((_globalConfig11 = globalConfig) !== null && _globalConfig11 !== void 0 && _globalConfig11.enableLogging) {
|
|
652
|
-
console.log('👤 Extracted user data from JWT:', userData);
|
|
653
|
-
}
|
|
654
|
-
return userData;
|
|
655
|
-
} catch (error) {
|
|
656
|
-
console.error('❌ Failed to extract user data from JWT:', error);
|
|
657
|
-
return null;
|
|
658
|
-
}
|
|
659
|
-
};
|
|
660
|
-
|
|
661
|
-
/**
|
|
662
|
-
* Check if user is authenticated with JWT token
|
|
663
|
-
* @returns True if user has valid JWT token
|
|
664
|
-
*/
|
|
665
|
-
exports.extractUserDataFromJWT = extractUserDataFromJWT;
|
|
666
|
-
const isUserAuthenticated = () => {
|
|
667
|
-
return !!userToken;
|
|
668
|
-
};
|
|
669
|
-
|
|
670
|
-
/**
|
|
671
|
-
* Get authenticated headers for API requests
|
|
672
|
-
* @returns Headers object with Authorization and other required headers
|
|
673
|
-
*/
|
|
674
|
-
exports.isUserAuthenticated = isUserAuthenticated;
|
|
675
|
-
const getAuthHeaders = () => {
|
|
676
|
-
var _globalConfig12;
|
|
677
|
-
if (!((_globalConfig12 = globalConfig) !== null && _globalConfig12 !== void 0 && _globalConfig12.apiKey)) {
|
|
678
|
-
throw new Error('SDK not initialized. Call initializeApiKey() first.');
|
|
679
|
-
}
|
|
680
|
-
const keyType = getApiKeyType(globalConfig.apiKey);
|
|
681
|
-
return {
|
|
682
|
-
'Content-Type': 'application/json',
|
|
683
|
-
'Authorization': `Bearer ${globalConfig.apiKey}`,
|
|
684
|
-
'User-Agent': 'OnairosReactNative/3.0.72',
|
|
685
|
-
'X-SDK-Version': '3.0.72',
|
|
686
|
-
'X-SDK-Environment': globalConfig.environment || 'production',
|
|
687
|
-
'X-API-Key-Type': keyType,
|
|
688
|
-
'X-Timestamp': new Date().toISOString()
|
|
689
|
-
};
|
|
690
|
-
};
|
|
691
|
-
|
|
692
|
-
/**
|
|
693
|
-
* Get authentication headers for developer API requests
|
|
694
|
-
* @returns Headers with developer API key
|
|
695
|
-
*/
|
|
696
|
-
exports.getAuthHeaders = getAuthHeaders;
|
|
697
|
-
const getDeveloperAuthHeaders = () => {
|
|
698
|
-
var _globalConfig13;
|
|
699
|
-
if (!((_globalConfig13 = globalConfig) !== null && _globalConfig13 !== void 0 && _globalConfig13.apiKey)) {
|
|
700
|
-
throw new Error('SDK not initialized. Call initializeApiKey() first.');
|
|
701
|
-
}
|
|
702
|
-
const keyType = getApiKeyType(globalConfig.apiKey);
|
|
703
|
-
return {
|
|
704
|
-
'Content-Type': 'application/json',
|
|
705
|
-
'Authorization': `Bearer ${globalConfig.apiKey}`,
|
|
706
|
-
'User-Agent': 'OnairosSDK/1.0.0',
|
|
707
|
-
'X-SDK-Version': '3.0.72',
|
|
708
|
-
'X-SDK-Environment': globalConfig.environment || 'production',
|
|
709
|
-
'X-API-Key-Type': keyType,
|
|
710
|
-
'X-Timestamp': new Date().toISOString()
|
|
711
|
-
};
|
|
712
|
-
};
|
|
713
|
-
|
|
714
|
-
/**
|
|
715
|
-
* Get authentication headers for user JWT requests
|
|
716
|
-
* @returns Headers with user JWT token
|
|
717
|
-
*/
|
|
718
|
-
exports.getDeveloperAuthHeaders = getDeveloperAuthHeaders;
|
|
719
|
-
const getUserAuthHeaders = () => {
|
|
720
|
-
var _globalConfig14;
|
|
721
|
-
if (!userToken) {
|
|
722
|
-
throw new Error('User not authenticated. Please verify email first.');
|
|
723
|
-
}
|
|
724
|
-
return {
|
|
725
|
-
'Content-Type': 'application/json',
|
|
726
|
-
'Authorization': `Bearer ${userToken}`,
|
|
727
|
-
'User-Agent': 'OnairosSDK/1.0.0',
|
|
728
|
-
'X-SDK-Version': '3.0.72',
|
|
729
|
-
'X-SDK-Environment': ((_globalConfig14 = globalConfig) === null || _globalConfig14 === void 0 ? void 0 : _globalConfig14.environment) || 'production'
|
|
730
|
-
};
|
|
731
|
-
};
|
|
732
|
-
|
|
733
|
-
/**
|
|
734
|
-
* Make an authenticated API request
|
|
735
|
-
* @param endpoint The API endpoint (relative to base URL)
|
|
736
|
-
* @param options Fetch options
|
|
737
|
-
* @returns Response promise
|
|
738
|
-
*/
|
|
739
|
-
exports.getUserAuthHeaders = getUserAuthHeaders;
|
|
740
|
-
const makeAuthenticatedRequest = async (endpoint, options = {}) => {
|
|
741
|
-
if (!isApiKeyInitialized()) {
|
|
742
|
-
throw new Error('SDK not initialized. Call initializeApiKey() first.');
|
|
743
|
-
}
|
|
744
|
-
const config = getApiConfig();
|
|
745
|
-
const baseUrl = API_ENDPOINTS[config.environment || 'production'];
|
|
746
|
-
const url = `${baseUrl}${endpoint.startsWith('/') ? '' : '/'}${endpoint}`;
|
|
747
|
-
|
|
748
|
-
// Merge authentication headers
|
|
749
|
-
const headers = {
|
|
750
|
-
...getAuthHeaders(),
|
|
751
|
-
...(options.headers || {})
|
|
752
|
-
};
|
|
753
|
-
|
|
754
|
-
// Add timeout
|
|
755
|
-
const controller = new AbortController();
|
|
756
|
-
const timeoutId = setTimeout(() => controller.abort(), config.timeout || 30000);
|
|
757
|
-
try {
|
|
758
|
-
if (config.enableLogging) {
|
|
759
|
-
console.log(`🌐 Making authenticated request to: ${endpoint}`);
|
|
760
|
-
}
|
|
761
|
-
const response = await fetch(url, {
|
|
762
|
-
...options,
|
|
763
|
-
headers,
|
|
764
|
-
signal: controller.signal
|
|
765
|
-
});
|
|
766
|
-
clearTimeout(timeoutId);
|
|
767
|
-
if (config.enableLogging) {
|
|
768
|
-
console.log(`📡 Response status: ${response.status} for ${endpoint}`);
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
// Handle API key errors
|
|
772
|
-
if (response.status === 401) {
|
|
773
|
-
console.error('❌ API key authentication failed. Please check your API key.');
|
|
774
|
-
throw new Error('Invalid or expired API key');
|
|
775
|
-
}
|
|
776
|
-
if (response.status === 403) {
|
|
777
|
-
console.error('❌ API key permissions insufficient for this operation.');
|
|
778
|
-
throw new Error('Insufficient API key permissions');
|
|
779
|
-
}
|
|
780
|
-
if (response.status === 429) {
|
|
781
|
-
console.error('❌ API rate limit exceeded. Please try again later.');
|
|
782
|
-
throw new Error('Rate limit exceeded');
|
|
783
|
-
}
|
|
784
|
-
return response;
|
|
785
|
-
} catch (error) {
|
|
786
|
-
clearTimeout(timeoutId);
|
|
787
|
-
if (error.name === 'AbortError') {
|
|
788
|
-
console.error('⏱️ Request timeout for:', endpoint);
|
|
789
|
-
throw new Error('Request timeout');
|
|
790
|
-
}
|
|
791
|
-
throw error;
|
|
792
|
-
}
|
|
793
|
-
};
|
|
794
|
-
|
|
795
|
-
/**
|
|
796
|
-
* Make authenticated request with developer API key
|
|
797
|
-
* @param endpoint The API endpoint
|
|
798
|
-
* @param options Fetch options
|
|
799
|
-
* @returns Response promise
|
|
800
|
-
*/
|
|
801
|
-
exports.makeAuthenticatedRequest = makeAuthenticatedRequest;
|
|
802
|
-
const makeDeveloperRequest = async (endpoint, options = {}) => {
|
|
803
|
-
if (!isApiKeyInitialized()) {
|
|
804
|
-
throw new Error('SDK not initialized. Call initializeApiKey() first.');
|
|
805
|
-
}
|
|
806
|
-
const config = getApiConfig();
|
|
807
|
-
const baseUrl = API_ENDPOINTS[config.environment || 'production'];
|
|
808
|
-
const url = `${baseUrl}${endpoint.startsWith('/') ? '' : '/'}${endpoint}`;
|
|
809
|
-
|
|
810
|
-
// Merge developer authentication headers
|
|
811
|
-
const headers = {
|
|
812
|
-
...getDeveloperAuthHeaders(),
|
|
813
|
-
...(options.headers || {})
|
|
814
|
-
};
|
|
815
|
-
|
|
816
|
-
// Add timeout
|
|
817
|
-
const controller = new AbortController();
|
|
818
|
-
const timeoutId = setTimeout(() => controller.abort(), config.timeout || 30000);
|
|
819
|
-
try {
|
|
820
|
-
if (config.enableLogging) {
|
|
821
|
-
console.log(`🌐 Making developer request to: ${endpoint}`);
|
|
822
|
-
}
|
|
823
|
-
const response = await fetch(url, {
|
|
824
|
-
...options,
|
|
825
|
-
headers,
|
|
826
|
-
signal: controller.signal
|
|
827
|
-
});
|
|
828
|
-
clearTimeout(timeoutId);
|
|
829
|
-
if (config.enableLogging) {
|
|
830
|
-
console.log(`📡 Developer request response: ${response.status} for ${endpoint}`);
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
// Handle API key errors
|
|
834
|
-
if (response.status === 401) {
|
|
835
|
-
console.error('❌ Developer API key authentication failed');
|
|
836
|
-
throw new Error('Invalid or expired API key');
|
|
837
|
-
}
|
|
838
|
-
if (response.status === 403) {
|
|
839
|
-
console.error('❌ Developer API key permissions insufficient');
|
|
840
|
-
throw new Error('Insufficient API key permissions');
|
|
841
|
-
}
|
|
842
|
-
if (response.status === 429) {
|
|
843
|
-
console.error('❌ API rate limit exceeded');
|
|
844
|
-
throw new Error('Rate limit exceeded');
|
|
845
|
-
}
|
|
846
|
-
return response;
|
|
847
|
-
} catch (error) {
|
|
848
|
-
clearTimeout(timeoutId);
|
|
849
|
-
if (error.name === 'AbortError') {
|
|
850
|
-
console.error('⏱️ Request timeout for:', endpoint);
|
|
851
|
-
throw new Error('Request timeout');
|
|
852
|
-
}
|
|
853
|
-
throw error;
|
|
854
|
-
}
|
|
855
|
-
};
|
|
856
|
-
|
|
857
|
-
/**
|
|
858
|
-
* Make authenticated request with user JWT token
|
|
859
|
-
* @param endpoint The API endpoint
|
|
860
|
-
* @param options Fetch options
|
|
861
|
-
* @returns Response promise
|
|
862
|
-
*/
|
|
863
|
-
exports.makeDeveloperRequest = makeDeveloperRequest;
|
|
864
|
-
const makeUserRequest = async (endpoint, options = {}) => {
|
|
865
|
-
if (!isUserAuthenticated()) {
|
|
866
|
-
await loadJWT(); // Try to load from storage
|
|
867
|
-
}
|
|
868
|
-
if (!isUserAuthenticated()) {
|
|
869
|
-
throw new Error('User not authenticated. Please verify email first.');
|
|
870
|
-
}
|
|
871
|
-
const config = getApiConfig() || {
|
|
872
|
-
environment: 'production',
|
|
873
|
-
timeout: 30000,
|
|
874
|
-
enableLogging: false
|
|
875
|
-
};
|
|
876
|
-
const baseUrl = API_ENDPOINTS[config.environment || 'production'];
|
|
877
|
-
const url = `${baseUrl}${endpoint.startsWith('/') ? '' : '/'}${endpoint}`;
|
|
878
|
-
|
|
879
|
-
// Merge user authentication headers
|
|
880
|
-
const headers = {
|
|
881
|
-
...getUserAuthHeaders(),
|
|
882
|
-
...(options.headers || {})
|
|
883
|
-
};
|
|
884
|
-
|
|
885
|
-
// Add timeout
|
|
886
|
-
const controller = new AbortController();
|
|
887
|
-
const timeoutId = setTimeout(() => controller.abort(), config.timeout || 30000);
|
|
888
|
-
try {
|
|
889
|
-
if (config.enableLogging) {
|
|
890
|
-
console.log(`🌐 Making user request to: ${endpoint}`);
|
|
891
|
-
}
|
|
892
|
-
const response = await fetch(url, {
|
|
893
|
-
...options,
|
|
894
|
-
headers,
|
|
895
|
-
signal: controller.signal
|
|
896
|
-
});
|
|
897
|
-
clearTimeout(timeoutId);
|
|
898
|
-
if (config.enableLogging) {
|
|
899
|
-
console.log(`📡 User request response: ${response.status} for ${endpoint}`);
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
// Handle JWT token errors
|
|
903
|
-
if (response.status === 401) {
|
|
904
|
-
console.error('❌ JWT token authentication failed - token may be expired');
|
|
905
|
-
await clearJWT(); // Clear expired token
|
|
906
|
-
throw new Error('Authentication expired. Please verify email again.');
|
|
907
|
-
}
|
|
908
|
-
if (response.status === 403) {
|
|
909
|
-
console.error('❌ JWT token permissions insufficient');
|
|
910
|
-
throw new Error('Insufficient permissions for this operation');
|
|
911
|
-
}
|
|
912
|
-
return response;
|
|
913
|
-
} catch (error) {
|
|
914
|
-
clearTimeout(timeoutId);
|
|
915
|
-
if (error.name === 'AbortError') {
|
|
916
|
-
console.error('⏱️ Request timeout for:', endpoint);
|
|
917
|
-
throw new Error('Request timeout');
|
|
918
|
-
}
|
|
919
|
-
throw error;
|
|
920
|
-
}
|
|
921
|
-
};
|
|
922
|
-
|
|
923
|
-
/**
|
|
924
|
-
* Clear the API key validation cache
|
|
925
|
-
*/
|
|
926
|
-
exports.makeUserRequest = makeUserRequest;
|
|
927
|
-
const clearValidationCache = () => {
|
|
928
|
-
var _globalConfig15;
|
|
929
|
-
validationCache.clear();
|
|
930
|
-
if ((_globalConfig15 = globalConfig) !== null && _globalConfig15 !== void 0 && _globalConfig15.enableLogging) {
|
|
931
|
-
console.log('🗑️ API key validation cache cleared');
|
|
932
|
-
}
|
|
933
|
-
};
|
|
934
|
-
|
|
935
|
-
/**
|
|
936
|
-
* Reset the SDK initialization state
|
|
937
|
-
*/
|
|
938
|
-
exports.clearValidationCache = clearValidationCache;
|
|
939
|
-
const resetApiKeyService = () => {
|
|
940
|
-
globalConfig = null;
|
|
941
|
-
isInitialized = false;
|
|
942
|
-
clearValidationCache();
|
|
943
|
-
console.log('🔄 API key service reset');
|
|
944
|
-
};
|
|
945
|
-
exports.resetApiKeyService = resetApiKeyService;
|
|
946
|
-
//# sourceMappingURL=apiKeyService.js.map
|
|
1
|
+
'use strict';
|
|
2
|
+
// Onairos SDK - Asset Registry (auto-generated)
|
|
3
|
+
var __ONAIROS_REQ_REGISTRY__ = [
|
|
4
|
+
require("@react-native-async-storage/async-storage"),
|
|
5
|
+
require("@react-native-community/netinfo"),
|
|
6
|
+
require("../config/api")
|
|
7
|
+
];
|
|
8
|
+
function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
|
|
9
|
+
Object['defineProperty'](exports,_0x46f3(0x0),{'value':!![]}),exports[_0x46f3(0x1)]=exports['storeJWT']=exports['resetApiKeyService']=exports[_0x46f3(0x2)]=exports[_0x46f3(0x3)]=exports['makeAuthenticatedRequest']=exports['loadJWT']=exports[_0x46f3(0x4)]=exports[_0x46f3(0x5)]=exports[_0x46f3(0x6)]=exports[_0x46f3(0x7)]=exports[_0x46f3(0x8)]=exports[_0x46f3(0x9)]=exports[_0x46f3(0xa)]=exports[_0x46f3(0xb)]=exports['getApiKey']=exports[_0x46f3(0xc)]=exports['extractUsernameFromJWT']=exports[_0x46f3(0xd)]=exports[_0x46f3(0xe)]=exports['clearValidationCache']=exports[_0x46f3(0xf)]=exports[_0x46f3(0x10)]=void 0x0;var _asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x0)),_netinfo=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x1)),_api=__ONAIROS_REQ_FUNC__(0x2);function _interopRequireDefault(_0x265164){return _0x265164&&_0x265164['__esModule']?_0x265164:{'default':_0x265164};}let ApiKeyType=exports[_0x46f3(0x10)]=function(_0x2c0927){const _0x15c92f={'HyxSv':_0x46f3(0x11),'vyavI':'INVALID','momCO':_0x46f3(0x12)};return _0x2c0927[_0x46f3(0x13)]=_0x15c92f['HyxSv'],_0x2c0927[_0x15c92f[_0x46f3(0x14)]]=_0x15c92f[_0x46f3(0x15)],_0x2c0927;}({});const JWT_TOKEN_KEY=_0x46f3(0x16);let globalConfig=null,validationCache=new Map(),isInitialized=![],userToken=null;const CACHE_DURATION=0x5*0x3c*0x3e8,checkNetworkConnectivity=async()=>{const _0x558347={'AiYdi':function(_0xd3e17c,_0x507ef2){return _0xd3e17c===_0x507ef2;}};try{const _0xbc2ac3=await _netinfo[_0x46f3(0x17)][_0x46f3(0x18)]();return _0x558347[_0x46f3(0x19)](_0xbc2ac3['isConnected'],!![])&&_0xbc2ac3[_0x46f3(0x1a)]!==![];}catch(_0x20fe92){return console[_0x46f3(0x1b)](_0x46f3(0x1c),_0x20fe92),!![];}},API_ENDPOINTS={'production':''+_api[_0x46f3(0x1d)][_0x46f3(0x1e)],'staging':''+_api[_0x46f3(0x1d)][_0x46f3(0x1e)],'development':''+_api[_0x46f3(0x1d)][_0x46f3(0x1e)]},initializeApiKey=async _0x23ab4a=>{const _0x4cbe8e={'hoCDp':'Onairos\x20API\x20is\x20temporarily\x20unavailable\x20(502\x20Bad\x20Gateway).\x20Please\x20try\x20again\x20later.','MSjgC':_0x46f3(0x1f),'ExKXq':_0x46f3(0x20),'hyQKD':function(_0x4cf16c,_0x10fee9){return _0x4cf16c===_0x10fee9;},'NULwU':function(_0x586311,_0x3c6800){return _0x586311===_0x3c6800;},'ntMbo':function(_0x52fa2b,_0x4da882){return _0x52fa2b===_0x4da882;},'aRhUG':function(_0x3d26c7,_0x449d38){return _0x3d26c7===_0x449d38;},'DmGKl':_0x46f3(0x21),'kNZYG':function(_0x511cbb,_0x1ec48b){return _0x511cbb!==_0x1ec48b;},'Topnt':_0x46f3(0x22),'TLEVP':_0x46f3(0x23),'CdXuP':_0x46f3(0x24),'KupwI':_0x46f3(0x25),'fFWUc':_0x46f3(0x26),'cESNu':_0x46f3(0x27),'cwRXJ':_0x46f3(0x28),'nNDVa':_0x46f3(0x29),'JcvNM':function(_0x5b8e27,_0x321d8f){return _0x5b8e27!==_0x321d8f;},'gWUor':function(_0xfffcc9,_0x4418b7){return _0xfffcc9===_0x4418b7;},'cgtky':_0x46f3(0x2a),'BonOI':_0x46f3(0x2b),'tgWBa':_0x46f3(0x2c),'MbBVl':function(_0x26028a,_0x3d886b){return _0x26028a+_0x3d886b;},'NqqOy':_0x46f3(0x2d),'QHzGY':function(_0x41450e,_0x3698b3){return _0x41450e(_0x3698b3);},'NymJL':_0x46f3(0x2e),'xrHLH':_0x46f3(0x2f),'oQOMV':_0x46f3(0x30),'BBrqg':'API\x20validation\x20endpoint\x20returned','TJkmd':_0x46f3(0x31),'koUiy':_0x46f3(0x18),'ftwiI':'No\x20network\x20connection','CABbX':'2|3|0|4|1','BKhMD':_0x46f3(0x32),'cEcCz':_0x46f3(0x33),'YUCpU':_0x46f3(0x34),'unyHH':_0x46f3(0x35),'Vzleg':_0x46f3(0x36),'PIupz':_0x46f3(0x37),'GCsiZ':function(_0x43a8b5){return _0x43a8b5();},'dZKOI':'3|1|2|4|0','uOZiM':'⏱️\x20Rate\x20Limits:','fHXbH':'🔑\x20Developer\x20API\x20key\x20ready\x20for\x20app-level\x20operations','kTFnv':'🎫\x20User\x20JWT\x20token\x20loaded\x20from\x20storage','Ntptt':_0x46f3(0x38),'kFseu':'YUBhD','rNRwP':'❌\x20Failed\x20to\x20initialize\x20Onairos\x20SDK:'};try{console[_0x46f3(0x39)](_0x4cbe8e[_0x46f3(0x3a)]);if(!_0x23ab4a['apiKey'])throw new Error(_0x46f3(0x3b));if(_0x23ab4a[_0x46f3(0x3c)]['length']<0x20){if(_0x4cbe8e['kNZYG'](_0x4cbe8e[_0x46f3(0x3d)],_0x46f3(0x22)))throw new _0xbfd5b4(_0x4cbe8e[_0x46f3(0x3e)]);else throw new Error(_0x4cbe8e[_0x46f3(0x3f)]);}const _0x366108=[_0x4cbe8e['CdXuP'],_0x4cbe8e[_0x46f3(0x40)],_0x4cbe8e['fFWUc']],_0x2c1e56=_0x366108[_0x46f3(0x41)](_0xfb7306=>_0x23ab4a[_0x46f3(0x3c)][_0x46f3(0x42)](_0xfb7306));if(!_0x2c1e56){if(_0x46f3(0x43)===_0x4cbe8e['cESNu'])_0x3198ac=_0x46f3(0x44)+_0x44d06c[_0x46f3(0x45)];else throw new Error(_0x4cbe8e[_0x46f3(0x46)]);}globalConfig={'apiKey':_0x23ab4a['apiKey'],'environment':_0x23ab4a[_0x46f3(0x47)]||_0x4cbe8e[_0x46f3(0x48)],'enableLogging':_0x4cbe8e[_0x46f3(0x49)](_0x23ab4a[_0x46f3(0x4a)],![]),'timeout':_0x23ab4a['timeout']||0x7530,'retryAttempts':_0x23ab4a[_0x46f3(0x4b)]||0x3};if(globalConfig['enableLogging']){if(_0x4cbe8e[_0x46f3(0x4c)](_0x4cbe8e[_0x46f3(0x4d)],_0x4cbe8e[_0x46f3(0x4e)])){_0x3a1126[_0x46f3(0x4f)](_0x4cbe8e[_0x46f3(0x50)],{'error':_0x670fae[_0x46f3(0x45)],'status':_0x8e8f92[_0x46f3(0x51)],'contentType':_0x4b200a,'attempt':_0x148099});throw new _0x146cc4(_0x46f3(0x52)+_0x5ebc42[_0x46f3(0x45)]);}else console[_0x46f3(0x39)](_0x4cbe8e[_0x46f3(0x53)],{'environment':globalConfig[_0x46f3(0x47)],'timeout':globalConfig[_0x46f3(0x54)],'retryAttempts':globalConfig['retryAttempts'],'apiKeyPrefix':_0x4cbe8e[_0x46f3(0x55)](_0x23ab4a['apiKey'][_0x46f3(0x56)](0x0,0x8),_0x4cbe8e[_0x46f3(0x57)]),'enableLogging':globalConfig[_0x46f3(0x4a)]});}const _0x5dae47=await _0x4cbe8e[_0x46f3(0x58)](validateApiKey,_0x23ab4a[_0x46f3(0x3c)]);if(!_0x5dae47[_0x46f3(0x59)]){const _0x45629f=_0x5dae47[_0x46f3(0x4f)]||'',_0x365dd4=_0x5dae47[_0x46f3(0x5a)]||_0x45629f[_0x46f3(0x5b)](_0x4cbe8e[_0x46f3(0x5c)])||_0x45629f['includes'](_0x4cbe8e[_0x46f3(0x5d)])||_0x45629f['includes'](_0x4cbe8e[_0x46f3(0x5e)])||_0x45629f[_0x46f3(0x5b)](_0x4cbe8e[_0x46f3(0x5f)])||_0x45629f[_0x46f3(0x5b)](_0x46f3(0x54))||_0x45629f[_0x46f3(0x5b)](_0x4cbe8e['TJkmd'])||_0x45629f[_0x46f3(0x5b)](_0x4cbe8e[_0x46f3(0x60)])||_0x45629f[_0x46f3(0x5b)](_0x4cbe8e['ftwiI']);if(_0x365dd4){const _0x519003=_0x4cbe8e['CABbX'][_0x46f3(0x61)]('|');let _0x1ceb9c=0x0;while(!![]){switch(_0x519003[_0x1ceb9c++]){case'0':console[_0x46f3(0x1b)](_0x4cbe8e[_0x46f3(0x62)]);continue;case'1':console[_0x46f3(0x39)](_0x4cbe8e[_0x46f3(0x63)]);continue;case'2':console[_0x46f3(0x1b)](_0x4cbe8e[_0x46f3(0x64)]);continue;case'3':console[_0x46f3(0x1b)]('🔄\x20Continuing\x20in\x20offline\x20mode\x20with\x20basic\x20validation');continue;case'4':console[_0x46f3(0x1b)](_0x4cbe8e['unyHH'],_0x5dae47[_0x46f3(0x4f)]);continue;}break;}}else{if(_0x4cbe8e[_0x46f3(0x65)]===_0x4cbe8e[_0x46f3(0x66)]){var _0x4d1790,_0x26fc84,_0x424953;_0x1c3b4f[_0x46f3(0x39)](_0x4cbe8e[_0x46f3(0x67)],{'apiKeyId':_0x4cbe8e[_0x46f3(0x68)](_0x4d1790=_0x5e430a[_0x46f3(0x3c)],null)||_0x4cbe8e[_0x46f3(0x68)](_0x4d1790,void 0x0)?void 0x0:_0x4d1790['id'],'appName':_0x4cbe8e[_0x46f3(0x68)](_0x26fc84=_0x1eebd6[_0x46f3(0x69)],null)||_0x4cbe8e['NULwU'](_0x26fc84,void 0x0)?void 0x0:_0x26fc84['name'],'usageCount':_0x4cbe8e[_0x46f3(0x6a)](_0x424953=_0x5bc653[_0x46f3(0x3c)],null)||_0x4cbe8e[_0x46f3(0x6b)](_0x424953,void 0x0)?void 0x0:_0x424953[_0x46f3(0x6c)]});}else throw new Error(_0x46f3(0x6d)+_0x5dae47[_0x46f3(0x4f)]);}}await _0x4cbe8e['GCsiZ'](loadJWT),isInitialized=!![];if(globalConfig[_0x46f3(0x4a)]){const _0x31f6e5=_0x4cbe8e[_0x46f3(0x6e)][_0x46f3(0x61)]('|');let _0x3944d9=0x0;while(!![]){switch(_0x31f6e5[_0x3944d9++]){case'0':_0x5dae47[_0x46f3(0x6f)]&&console[_0x46f3(0x39)](_0x4cbe8e[_0x46f3(0x70)],_0x5dae47[_0x46f3(0x6f)]);continue;case'1':console[_0x46f3(0x39)](_0x4cbe8e[_0x46f3(0x71)]);continue;case'2':userToken&&console['log'](_0x4cbe8e['kTFnv']);continue;case'3':console[_0x46f3(0x39)](_0x46f3(0x72));continue;case'4':_0x5dae47['permissions']&&console[_0x46f3(0x39)](_0x4cbe8e[_0x46f3(0x73)],_0x5dae47['permissions']);continue;}break;}}}catch(_0x25b52c){if(_0x4cbe8e[_0x46f3(0x49)](_0x4cbe8e[_0x46f3(0x74)],_0x4cbe8e[_0x46f3(0x74)]))_0x4fbe66['log'](_0x46f3(0x75)+_0x270efb[_0x46f3(0x51)]+'\x20for\x20'+_0x1a4c5c);else{console[_0x46f3(0x4f)](_0x4cbe8e[_0x46f3(0x76)],_0x25b52c),isInitialized=![];throw _0x25b52c;}}};exports[_0x46f3(0x6)]=initializeApiKey;function _0x46f3(_0x200664,_0x46f3a7){_0x200664=_0x200664-0x0;const _0x2684a9=_0x2006();let _0x96c3b7=_0x2684a9[_0x200664];return _0x96c3b7;}const getApiKeyType=_0x360410=>{const _0x1d7985={'hNHBC':'dev_','mGink':function(_0x2f1a5e,_0x2b87a6){return _0x2f1a5e===_0x2b87a6;},'QOXyO':'zAbeh'};if(_0x360410[_0x46f3(0x77)]>=0x20&&(_0x360410[_0x46f3(0x42)](_0x1d7985['hNHBC'])||_0x360410[_0x46f3(0x42)](_0x46f3(0x26))||_0x360410[_0x46f3(0x42)](_0x46f3(0x25)))){if(_0x1d7985[_0x46f3(0x78)](_0x46f3(0x79),_0x1d7985[_0x46f3(0x7a)]))return ApiKeyType[_0x46f3(0x13)];else _0x4a4c09[_0x46f3(0x39)](_0x46f3(0x7b)+_0x5e7af1[_0x46f3(0x51)]+_0x46f3(0x7c)+_0x447d3a);}return ApiKeyType[_0x46f3(0x7d)];};exports[_0x46f3(0xb)]=getApiKeyType;const validateApiKey=async _0x15ed2e=>{const _0x4266ff={'FkoXq':_0x46f3(0x7e),'DEbOe':_0x46f3(0x7f),'RWvIB':_0x46f3(0x80),'jPcJj':function(_0x9e175e,_0xc62039){return _0x9e175e===_0xc62039;},'zTORt':function(_0x3ab90c,_0x56aac8){return _0x3ab90c!==_0x56aac8;},'MbMsE':_0x46f3(0x81),'VCnTZ':'❌\x20Developer\x20API\x20key\x20authentication\x20failed','bwtxG':_0x46f3(0x82),'CfzYk':function(_0x287d1e,_0x3c0a1b){return _0x287d1e!==_0x3c0a1b;},'MpBHp':_0x46f3(0x83),'lgdmz':'Request\x20timeout','YWfhf':function(_0x31a236,_0x4c8d4e){return _0x31a236!==_0x4c8d4e;},'zyVZf':function(_0x553520,_0x33db26){return _0x553520*_0x33db26;},'EBPTv':function(_0x3caed1,_0x226fa8){return _0x3caed1/_0x226fa8;},'IkAoh':'❌\x20Failed\x20to\x20decode\x20JWT\x20token:','AwzQK':function(_0x19aa09,_0x1b2b54){return _0x19aa09===_0x1b2b54;},'izZNX':_0x46f3(0x84),'MSVzE':function(_0xcec585,_0xb7e5dc){return _0xcec585||_0xb7e5dc;},'RTrZd':_0x46f3(0x85),'dBMoM':function(_0x4a7cab,_0x3595ee){return _0x4a7cab(_0x3595ee);},'nshcp':'👤\x20Extracted\x20user\x20data\x20from\x20JWT:','wEEZT':_0x46f3(0x86),'hGFGU':_0x46f3(0x2e),'HQeeZ':_0x46f3(0x30),'wFeOw':_0x46f3(0x87),'fogvH':_0x46f3(0x54),'NoMWk':_0x46f3(0x31),'ZCCJW':_0x46f3(0x18),'eSUKy':_0x46f3(0x88),'xNRTn':_0x46f3(0x89),'zByUy':_0x46f3(0x35),'IBOdQ':_0x46f3(0x33),'vMyjA':_0x46f3(0x8a),'NnPIN':_0x46f3(0x8b),'cfWbp':'👤\x20Extracted\x20username\x20from\x20JWT:','xQTct':'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','jwDzs':function(_0x763a5a,_0x5b2e7c){return _0x763a5a<_0x5b2e7c;},'UpwTE':function(_0x3d93e,_0x3207dc){return _0x3d93e-_0x3207dc;},'qTbDv':_0x46f3(0x8c),'fJmsY':_0x46f3(0x8d),'sxbtc':_0x46f3(0x8e),'CwhVA':_0x46f3(0x8f),'KXslt':function(_0x3dc2bd,_0xb60c5d){return _0x3dc2bd===_0xb60c5d;},'EJLYe':_0x46f3(0x29),'KMBDs':function(_0x1315b0,_0x563f74){return _0x1315b0<=_0x563f74;},'ppFrQ':function(_0x36be4b,_0x1de259,_0x4cab75){return _0x36be4b(_0x1de259,_0x4cab75);},'reVWe':_0x46f3(0x90),'YQuQm':_0x46f3(0x91),'qoGwn':_0x46f3(0x92),'yZyVg':_0x46f3(0x93),'laish':_0x46f3(0x94),'wPiuP':_0x46f3(0x95),'lBHCS':_0x46f3(0x96),'tuOEp':_0x46f3(0x97),'swMNR':function(_0x38e96d,_0x13f8db){return _0x38e96d===_0x13f8db;},'TGqlk':_0x46f3(0x98),'sJlmw':_0x46f3(0x99),'yqsWs':_0x46f3(0x9a),'fExVv':_0x46f3(0x9b),'FEVqm':function(_0x5e6cd4,_0x2fccea){return _0x5e6cd4||_0x2fccea;},'vngzd':'unknown','IXUaV':'yOoYe','JBbXK':_0x46f3(0x9c),'eWVBh':_0x46f3(0x9d),'Fssnu':'<!DOCTYPE','vwytr':_0x46f3(0x9e),'OmqSX':'myBOY','HugPG':function(_0x9c9ae3,_0x3f1160){return _0x9c9ae3||_0x3f1160;},'IYYPo':_0x46f3(0x9f),'gbKsx':function(_0x27e2b6,_0x306f77){return _0x27e2b6===_0x306f77;},'BEmXE':_0x46f3(0xa0),'dmqUP':_0x46f3(0x1f),'nqHYX':'VEsAg','ZtQuW':function(_0x49cf4c,_0x4e39d2){return _0x49cf4c!==_0x4e39d2;},'ciZBX':_0x46f3(0x20),'SWQAZ':function(_0x2ae7d4,_0x103dbb){return _0x2ae7d4===_0x103dbb;},'tXCls':_0x46f3(0xa1),'hrBuP':function(_0x4f5e93,_0xc1a4ae){return _0x4f5e93>=_0xc1a4ae;},'eaozs':_0x46f3(0xa2),'WVjdD':'kuNKu','SIqsC':_0x46f3(0xa3),'bPljj':function(_0x36bb5c,_0xa55a1){return _0x36bb5c===_0xa55a1;},'faREn':function(_0x1b567d,_0x184a8b){return _0x1b567d!==_0x184a8b;},'alrLl':_0x46f3(0xa4),'oIYWI':'Exsdz','VFXoO':_0x46f3(0xa5),'pYDNG':_0x46f3(0xa6),'RlbBY':function(_0x3fc9ad,_0x170555){return _0x3fc9ad===_0x170555;},'rvCaN':function(_0x114098,_0x2791b2){return _0x114098!==_0x2791b2;},'paNBi':_0x46f3(0xa7),'ykLXK':function(_0x29e7c7,_0x5b83ff){return _0x29e7c7!==_0x5b83ff;},'iKYJD':'All\x20retry\x20attempts\x20exhausted','UgxiP':_0x46f3(0xa8),'maMaM':'❌\x20API\x20key\x20validation\x20error:'};try{var _0x4416f1,_0x5eeb37,_0xead59e;console[_0x46f3(0x39)](_0x46f3(0xa9));const _0x534f03=_0x4266ff[_0x46f3(0xaa)](getApiKeyType,_0x15ed2e);if(_0x534f03===ApiKeyType[_0x46f3(0x7d)])return{'isValid':![],'error':_0x4266ff[_0x46f3(0xab)],'keyType':ApiKeyType[_0x46f3(0x7d)]};const _0x594381=validationCache[_0x46f3(0xac)](_0x15ed2e);if(_0x594381&&_0x4266ff[_0x46f3(0xad)](_0x4266ff['UpwTE'](Date[_0x46f3(0xae)](),_0x594381['timestamp']),CACHE_DURATION)){if(_0x4266ff[_0x46f3(0xaf)]('bMpAL',_0x4266ff[_0x46f3(0xb0)])){var _0x4bc32b;if(!_0x56c31d)throw new _0x2c90ed(_0x4266ff[_0x46f3(0xb1)]);return{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x5c746d,'User-Agent':_0x4266ff[_0x46f3(0xb2)],'X-SDK-Version':_0x4266ff[_0x46f3(0xb3)],'X-SDK-Environment':((_0x4bc32b=_0x18373b)===null||_0x4266ff[_0x46f3(0xb4)](_0x4bc32b,void 0x0)?void 0x0:_0x4bc32b[_0x46f3(0x47)])||_0x46f3(0x29)};}else{var _0x1828e7;return _0x4266ff[_0x46f3(0xb5)](_0x1828e7=globalConfig,null)&&_0x1828e7!==void 0x0&&_0x1828e7[_0x46f3(0x4a)]&&console[_0x46f3(0x39)](_0x4266ff[_0x46f3(0xb6)]),_0x594381[_0x46f3(0xb7)];}}const _0x31d0a9=await checkNetworkConnectivity();if(!_0x31d0a9)return console[_0x46f3(0x1b)](_0x4266ff[_0x46f3(0xb8)]),{'isValid':![],'error':_0x4266ff['CwhVA'],'keyType':_0x534f03,'isNetworkError':!![]};const _0x182ca7=(_0x4266ff[_0x46f3(0xb9)](_0x4416f1=globalConfig,null)||_0x4266ff[_0x46f3(0xaf)](_0x4416f1,void 0x0)?void 0x0:_0x4416f1['environment'])||_0x4266ff['EJLYe'],_0x1897b7=API_ENDPOINTS[_0x182ca7],_0x4538fa=(_0x4266ff['jPcJj'](_0x5eeb37=globalConfig,null)||_0x4266ff['AwzQK'](_0x5eeb37,void 0x0)?void 0x0:_0x5eeb37[_0x46f3(0x54)])||0x7530,_0x1b1421=(_0x4266ff[_0x46f3(0xaf)](_0xead59e=globalConfig,null)||_0x4266ff[_0x46f3(0xb9)](_0xead59e,void 0x0)?void 0x0:_0xead59e[_0x46f3(0x4b)])||0x3;for(let _0x520435=0x1;_0x4266ff[_0x46f3(0xba)](_0x520435,_0x1b1421);_0x520435++){const _0xf0d5df=new AbortController(),_0x15f9d8=_0x4266ff['ppFrQ'](setTimeout,()=>_0xf0d5df[_0x46f3(0xbb)](),_0x4538fa);try{if(_0x4266ff[_0x46f3(0xb5)](_0x4266ff[_0x46f3(0xbc)],_0x4266ff[_0x46f3(0xbd)])){var _0x14c7c1;if(_0x4266ff[_0x46f3(0xbe)](_0x14c7c1=globalConfig,null)&&_0x14c7c1!==void 0x0&&_0x14c7c1[_0x46f3(0x4a)]&&_0x520435>0x1){if(_0x4266ff[_0x46f3(0xb9)](_0x4266ff['qoGwn'],_0x4266ff[_0x46f3(0xbf)]))console[_0x46f3(0x39)]('🔄\x20Retry\x20attempt\x20'+_0x520435+'/'+_0x1b1421+_0x46f3(0xc0));else return{'isValid':![],'error':_0x1ee268,'keyType':_0x38f89c,'isNetworkError':!![]};}const _0x253ca4=await _0x4266ff[_0x46f3(0xc1)](fetch,_0x1897b7+_0x46f3(0xc2),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x46f3(0xc3)+_0x15ed2e,'User-Agent':_0x4266ff[_0x46f3(0xc4)],'X-API-Key-Type':_0x534f03,'X-SDK-Platform':'react-native','X-Retry-Attempt':_0x520435[_0x46f3(0xc5)]()},'body':JSON[_0x46f3(0xc6)]({'environment':_0x182ca7,'sdk_version':_0x4266ff[_0x46f3(0xc7)],'platform':'react-native','keyType':_0x534f03,'timestamp':new Date()[_0x46f3(0xc8)](),'attempt':_0x520435}),'signal':_0xf0d5df['signal']});clearTimeout(_0x15f9d8);if(!_0x253ca4){if(_0x46f3(0xc9)!==_0x4266ff['wPiuP'])throw new Error(_0x46f3(0xca));else{var _0x5b49a9;_0x582be3['clear'](),_0x4266ff[_0x46f3(0xb5)](_0x5b49a9=_0x5c4a16,null)&&_0x4266ff[_0x46f3(0xb5)](_0x5b49a9,void 0x0)&&_0x5b49a9['enableLogging']&&_0x1e5c4b['log'](_0x4266ff[_0x46f3(0xcb)]);}}if(_0x253ca4[_0x46f3(0x51)]===0x1f6)throw new Error(_0x4266ff['lBHCS']);if(_0x253ca4[_0x46f3(0x51)]===0x1f7)throw new Error(_0x4266ff[_0x46f3(0xcc)]);if(_0x4266ff[_0x46f3(0xb9)](_0x253ca4['status'],0x1f8)){if(_0x4266ff[_0x46f3(0xcd)](_0x4266ff[_0x46f3(0xce)],_0x4266ff[_0x46f3(0xcf)])){_0x31be68['error'](_0x4266ff['VCnTZ']);throw new _0xc8c2f4(_0x4266ff[_0x46f3(0xd0)]);}else throw new Error('Onairos\x20API\x20request\x20timed\x20out\x20(504\x20Gateway\x20Timeout).\x20Please\x20try\x20again.');}const _0x34c078=_0x253ca4[_0x46f3(0xd1)]['get'](_0x46f3(0xd2)),_0x574c7d=_0x34c078&&_0x34c078[_0x46f3(0x5b)]('application/json');if(!_0x574c7d){if(_0x4266ff[_0x46f3(0xb4)](_0x4266ff['yqsWs'],_0x4266ff[_0x46f3(0xd3)])){const _0x263445=await _0x253ca4[_0x46f3(0xd4)](),_0x1e9c96=_0x263445[_0x46f3(0x56)](0x0,0xc8);console['error'](_0x4266ff[_0x46f3(0xd5)],{'status':_0x253ca4[_0x46f3(0x51)],'statusText':_0x253ca4[_0x46f3(0xd6)],'contentType':_0x4266ff[_0x46f3(0xd7)](_0x34c078,_0x4266ff[_0x46f3(0xd8)]),'preview':_0x1e9c96,'url':_0x1897b7+'/dev/validate-apikey','attempt':_0x520435});if(_0x253ca4['status']===0x194)throw new Error(_0x46f3(0xd9)+_0x1897b7+'/dev/validate-apikey\x20may\x20not\x20exist\x20or\x20be\x20configured\x20correctly.');else{if(_0x4266ff[_0x46f3(0xcd)](_0x253ca4[_0x46f3(0x51)],0x1f4)){if(_0x4266ff[_0x46f3(0xda)]!==_0x4266ff[_0x46f3(0xdb)])throw new Error(_0x46f3(0xdc));else{var _0x9665be;return _0x4266ff[_0x46f3(0xb5)](_0x9665be=_0x4557b3,null)&&_0x4266ff[_0x46f3(0xdd)](_0x9665be,void 0x0)&&_0x9665be['enableLogging']&&_0x116260[_0x46f3(0x4f)](_0x4266ff[_0x46f3(0xde)],_0x804dc1),_0x29fe19;}}else{if(_0x253ca4[_0x46f3(0x51)]===0x1f6||_0x253ca4['status']===0x1f7)throw new Error('Service\x20unavailable\x20('+_0x253ca4[_0x46f3(0x51)]+_0x46f3(0xdf));else{if(_0x263445['includes'](_0x4266ff[_0x46f3(0xe0)])||_0x263445['includes'](_0x4266ff[_0x46f3(0xe1)])){if(_0x4266ff[_0x46f3(0xaf)](_0x4266ff[_0x46f3(0xe2)],_0x46f3(0x9e)))throw new Error(_0x46f3(0xe3));else return _0x3b0490[_0x46f3(0x4f)](_0x46f3(0xe4),_0x437268),null;}else{if(_0x4266ff['CfzYk'](_0x46f3(0xe5),_0x4266ff[_0x46f3(0xe6)]))throw new _0x1625f6(_0x46f3(0xca));else throw new Error(_0x46f3(0xe7)+_0x253ca4[_0x46f3(0x51)]+'\x20-\x20'+_0x253ca4[_0x46f3(0xd6)]+_0x46f3(0xe8)+_0x4266ff[_0x46f3(0xe9)](_0x34c078,_0x4266ff[_0x46f3(0xea)])+'.');}}}}}else{_0x10018f[_0x46f3(0x4f)]('⏱️\x20Request\x20timeout\x20for:',_0x55a775);throw new _0x56bdeb(_0x4266ff[_0x46f3(0xeb)]);}}let _0x4cd112;try{_0x4cd112=await _0x253ca4[_0x46f3(0xec)]();}catch(_0x2211b6){if(_0x4266ff[_0x46f3(0xed)](_0x4266ff['BEmXE'],_0x4266ff['BEmXE'])){console[_0x46f3(0x4f)](_0x4266ff[_0x46f3(0xee)],{'error':_0x2211b6['message'],'status':_0x253ca4[_0x46f3(0x51)],'contentType':_0x34c078,'attempt':_0x520435});throw new Error(_0x46f3(0x52)+_0x2211b6['message']);}else try{const _0xbfcdc=_0x5354f5['split']('.');if(_0x4266ff['YWfhf'](_0xbfcdc[_0x46f3(0x77)],0x3))return _0x573949[_0x46f3(0x4f)]('❌\x20Invalid\x20JWT\x20token\x20format'),null;const _0x218ad7=_0xbfcdc[0x1],_0x492a5d=_0x218ad7[_0x46f3(0xef)](/-/g,'+')[_0x46f3(0xef)](/_/g,'/'),_0xe41df3=_0x492a5d['padEnd'](_0x4266ff[_0x46f3(0xf0)](_0x181440['ceil'](_0x4266ff['EBPTv'](_0x492a5d[_0x46f3(0x77)],0x4)),0x4),'='),_0x2d6089=_0x1f5775(_0xe41df3);return _0x2bb0a0['parse'](_0x2d6089);}catch(_0x1d42f9){return _0x353b2a['error'](_0x4266ff[_0x46f3(0xf1)],_0x1d42f9),null;}}if(_0x253ca4['ok']&&(_0x4cd112[_0x46f3(0xf2)]||_0x4cd112['valid'])){if(_0x4266ff[_0x46f3(0xcd)](_0x46f3(0xf3),_0x4266ff['nqHYX'])){var _0x407f82;const _0x2b4a3f={'isValid':!![],'permissions':_0x4cd112[_0x46f3(0xf4)]||[],'rateLimits':_0x4cd112['rateLimits']||null,'keyType':_0x534f03};validationCache[_0x46f3(0xf5)](_0x15ed2e,{'result':_0x2b4a3f,'timestamp':Date[_0x46f3(0xae)]()});if(_0x4266ff[_0x46f3(0xf6)](_0x407f82=globalConfig,null)&&_0x4266ff['CfzYk'](_0x407f82,void 0x0)&&_0x407f82[_0x46f3(0x4a)]){var _0x28a05a,_0x2049b4,_0x5928b8;console[_0x46f3(0x39)](_0x4266ff[_0x46f3(0xf7)],{'apiKeyId':(_0x28a05a=_0x4cd112[_0x46f3(0x3c)])===null||_0x4266ff[_0x46f3(0xb9)](_0x28a05a,void 0x0)?void 0x0:_0x28a05a['id'],'appName':_0x4266ff[_0x46f3(0xb4)](_0x2049b4=_0x4cd112['application'],null)||_0x4266ff[_0x46f3(0xf8)](_0x2049b4,void 0x0)?void 0x0:_0x2049b4[_0x46f3(0xf9)],'usageCount':_0x4266ff[_0x46f3(0xed)](_0x5928b8=_0x4cd112[_0x46f3(0x3c)],null)||_0x5928b8===void 0x0?void 0x0:_0x5928b8[_0x46f3(0x6c)]});}return _0x2b4a3f;}else{_0x4fc5ee(_0x162145);if(_0x4266ff[_0x46f3(0xaf)](_0x46cbe2[_0x46f3(0xf9)],_0x4266ff[_0x46f3(0xfa)])){_0x4fed66[_0x46f3(0x4f)](_0x46f3(0xfb),_0x1fd21);throw new _0x57ae73(_0x46f3(0xfc));}throw _0x45ec1f;}}else{if(_0x4266ff[_0x46f3(0xfd)]===_0x4266ff['tXCls']){const _0x1a3586=_0x4cd112[_0x46f3(0x4f)]||_0x4cd112['message']||_0x46f3(0xfe)+_0x253ca4[_0x46f3(0x51)]+':\x20'+_0x253ca4[_0x46f3(0xd6)],_0xf5f258={'isValid':![],'error':_0x1a3586,'keyType':_0x534f03};if(_0x4266ff[_0x46f3(0xff)](_0x253ca4[_0x46f3(0x51)],0x190)&&_0x4266ff[_0x46f3(0xad)](_0x253ca4['status'],0x1f4)){var _0x29565b;return(_0x29565b=globalConfig)!==null&&_0x4266ff[_0x46f3(0xb5)](_0x29565b,void 0x0)&&_0x29565b['enableLogging']&&console[_0x46f3(0x4f)](_0x4266ff[_0x46f3(0xde)],_0x1a3586),_0xf5f258;}throw new Error(_0x1a3586);}else{var _0x1673ea;const _0x4d16ed=_0x4266ff[_0x46f3(0x100)](_0x1906f3,_0x11ec4e);if(!_0x4d16ed)return _0x4bc26c[_0x46f3(0x1b)](_0x4266ff[_0x46f3(0x101)]),null;const _0x1c60f2=_0x4266ff[_0x46f3(0xaa)](_0x464cc8,_0x4d16ed);if(!_0x1c60f2)return null;const _0xdf5e7c={'id':_0x1c60f2['id'],'email':_0x1c60f2[_0x46f3(0x102)],'userId':_0x1c60f2['userId'],'userName':_0x1c60f2[_0x46f3(0x103)]||_0x1c60f2[_0x46f3(0x104)],'verified':_0x1c60f2[_0x46f3(0x105)],'iat':_0x1c60f2[_0x46f3(0x106)],'exp':_0x1c60f2['exp']};return(_0x1673ea=_0x523ae7)!==null&&_0x1673ea!==void 0x0&&_0x1673ea[_0x46f3(0x4a)]&&_0x5c5e5e[_0x46f3(0x39)](_0x4266ff[_0x46f3(0x107)],_0xdf5e7c),_0xdf5e7c;}}}else throw new _0x4200ff(_0x4266ff[_0x46f3(0x108)]);}catch(_0x5141f3){if(_0x4266ff[_0x46f3(0xf6)](_0x4266ff[_0x46f3(0x109)],_0x4266ff[_0x46f3(0x10a)])){var _0x5241b4;_0x4266ff['dBMoM'](clearTimeout,_0x15f9d8);if(_0x4266ff[_0x46f3(0xb9)](_0x5141f3[_0x46f3(0xf9)],_0x4266ff[_0x46f3(0xfa)])){if(_0x4266ff[_0x46f3(0xcd)](_0x4266ff[_0x46f3(0x10b)],_0x46f3(0x10c))){const _0x47f309=_0x4aacc5[_0x46f3(0x4f)]||'',_0x4f4eee=_0x2db26f[_0x46f3(0x5a)]||_0x47f309[_0x46f3(0x5b)](_0x4266ff[_0x46f3(0x10d)])||_0x47f309[_0x46f3(0x5b)](_0x46f3(0x2f))||_0x47f309['includes'](_0x4266ff[_0x46f3(0x10e)])||_0x47f309[_0x46f3(0x5b)](_0x4266ff[_0x46f3(0x10f)])||_0x47f309[_0x46f3(0x5b)](_0x4266ff['fogvH'])||_0x47f309[_0x46f3(0x5b)](_0x4266ff[_0x46f3(0x110)])||_0x47f309[_0x46f3(0x5b)](_0x4266ff[_0x46f3(0x111)])||_0x47f309['includes'](_0x4266ff[_0x46f3(0x112)]);if(_0x4f4eee)_0x8ce954[_0x46f3(0x1b)](_0x46f3(0x34)),_0x295084[_0x46f3(0x1b)](_0x4266ff[_0x46f3(0x113)]),_0x58a581[_0x46f3(0x1b)](_0x46f3(0x32)),_0x5774d3[_0x46f3(0x1b)](_0x4266ff['zByUy'],_0x176627['error']),_0x483a18[_0x46f3(0x39)](_0x4266ff[_0x46f3(0x114)]);else throw new _0x57b3e2(_0x46f3(0x6d)+_0x1d761e[_0x46f3(0x4f)]);}else{const _0x4ed349=_0x46f3(0x115)+_0x4538fa+_0x46f3(0x116);console[_0x46f3(0x4f)](_0x46f3(0x117));if(_0x4266ff[_0x46f3(0x118)](_0x520435,_0x1b1421))return _0x4266ff[_0x46f3(0x119)](_0x4266ff[_0x46f3(0x11a)],_0x4266ff[_0x46f3(0x11b)])?{'isValid':![],'error':_0x4ed349,'keyType':_0x534f03}:(_0x3f1022[_0x46f3(0x4f)](_0x4266ff[_0x46f3(0x11c)]),null);continue;}}let _0x21dbf0='Network\x20error\x20during\x20API\x20key\x20validation:\x20'+_0x5141f3['message'];if(_0x5141f3['message']['includes'](_0x4266ff[_0x46f3(0x10e)])||_0x5141f3[_0x46f3(0x45)][_0x46f3(0x5b)](_0x46f3(0x11d)))_0x21dbf0=_0x46f3(0x44)+_0x5141f3['message'];else{if(_0x5141f3['message'][_0x46f3(0x5b)](_0x4266ff[_0x46f3(0x10d)])||_0x5141f3[_0x46f3(0x45)][_0x46f3(0x5b)](_0x4266ff[_0x46f3(0x111)]))_0x21dbf0=_0x46f3(0x11e)+_0x5141f3[_0x46f3(0x45)];else(_0x5141f3['message'][_0x46f3(0x5b)](_0x4266ff[_0x46f3(0x11f)])||_0x5141f3[_0x46f3(0x45)]['includes'](_0x4266ff[_0x46f3(0x110)]))&&(_0x21dbf0='DNS\x20resolution\x20failed\x20for\x20'+_0x1897b7+'.\x20Please\x20check\x20network\x20settings\x20and\x20domain\x20accessibility.\x20'+_0x5141f3[_0x46f3(0x45)]);}console[_0x46f3(0x4f)](_0x4266ff[_0x46f3(0x120)],{'error':_0x5141f3,'endpoint':_0x1897b7+_0x46f3(0xc2),'attempt':_0x520435,'maxRetries':_0x1b1421,'retryable':_0x4266ff[_0x46f3(0xad)](_0x520435,_0x1b1421)});if(_0x4266ff[_0x46f3(0x121)](_0x520435,_0x1b1421)){if(_0x4266ff[_0x46f3(0x122)](_0x46f3(0xa7),_0x4266ff[_0x46f3(0x123)])){_0x1690e7['error'](_0x4266ff[_0x46f3(0x124)]);throw new _0xbca4c3('Rate\x20limit\x20exceeded');}else return{'isValid':![],'error':_0x21dbf0,'keyType':_0x534f03,'isNetworkError':!![]};}const _0x33e18f=Math[_0x46f3(0x125)](_0x4266ff[_0x46f3(0xf0)](0x3e8,Math[_0x46f3(0x126)](0x2,_0x4266ff['UpwTE'](_0x520435,0x1))),0x1388);(_0x5241b4=globalConfig)!==null&&_0x4266ff[_0x46f3(0x127)](_0x5241b4,void 0x0)&&_0x5241b4['enableLogging']&&console['log'](_0x46f3(0x128)+_0x33e18f+'ms\x20before\x20retry...'),await new Promise(_0x3c3260=>setTimeout(()=>_0x3c3260(),_0x33e18f));}else throw new _0x4f3164(_0x46f3(0xdc));}}return{'isValid':![],'error':_0x4266ff['iKYJD'],'keyType':_0x534f03};}catch(_0x23cf28){if(_0x4266ff[_0x46f3(0xdd)](_0x4266ff[_0x46f3(0x129)],_0x4266ff[_0x46f3(0x129)]))_0x197626[_0x46f3(0x39)](_0x4266ff['cfWbp'],_0x1535fb);else{const _0xae4262=_0x46f3(0x12a)+_0x23cf28['message'];return console['error'](_0x4266ff[_0x46f3(0x12b)],_0x23cf28),{'isValid':![],'error':_0xae4262,'keyType':ApiKeyType['INVALID']};}}};exports[_0x46f3(0x1)]=validateApiKey;const getApiConfig=()=>{return globalConfig;};exports[_0x46f3(0xc)]=getApiConfig;const getApiKey=()=>{const _0x3fceac={'tquvr':function(_0x5ace98,_0xa44da2){return _0x5ace98===_0xa44da2;},'knmsB':function(_0x4b4894,_0x430375){return _0x4b4894===_0x430375;}};var _0x5d4328;return(_0x3fceac['tquvr'](_0x5d4328=globalConfig,null)||_0x3fceac[_0x46f3(0x12c)](_0x5d4328,void 0x0)?void 0x0:_0x5d4328['apiKey'])||null;};exports[_0x46f3(0x12d)]=getApiKey;const isApiKeyInitialized=()=>{const _0x1a4f1c={'IwHCd':function(_0x27aa7c,_0x1e4799){return _0x27aa7c!==_0x1e4799;}};return isInitialized&&_0x1a4f1c[_0x46f3(0x12e)](globalConfig,null);};exports[_0x46f3(0x5)]=isApiKeyInitialized;const storeJWT=async _0x579fa7=>{const _0x5b518e={'WzSKm':function(_0x1a5ea7,_0x143811){return _0x1a5ea7!==_0x143811;},'GWSzx':function(_0x4b28e9,_0x4ebc93){return _0x4b28e9!==_0x4ebc93;},'IJOaD':_0x46f3(0x12f),'MXXIK':_0x46f3(0x130)};try{var _0xab56ea;await _asyncStorage[_0x46f3(0x17)]['setItem'](JWT_TOKEN_KEY,_0x579fa7),userToken=_0x579fa7,_0x5b518e[_0x46f3(0x131)](_0xab56ea=globalConfig,null)&&_0x5b518e[_0x46f3(0x132)](_0xab56ea,void 0x0)&&_0xab56ea[_0x46f3(0x4a)]&&console['log'](_0x5b518e[_0x46f3(0x133)]);}catch(_0x2767ad){console[_0x46f3(0x4f)](_0x5b518e['MXXIK'],_0x2767ad);throw _0x2767ad;}};exports[_0x46f3(0x134)]=storeJWT;const loadJWT=async()=>{const _0x5ddb4c={'fitpR':_0x46f3(0x135)};try{const _0xdcb562=await _asyncStorage[_0x46f3(0x17)][_0x46f3(0x136)](JWT_TOKEN_KEY);return userToken=_0xdcb562,_0xdcb562;}catch(_0x6442bb){return console[_0x46f3(0x4f)](_0x5ddb4c[_0x46f3(0x137)],_0x6442bb),null;}};exports['loadJWT']=loadJWT;const getJWT=()=>{return userToken;};exports[_0x46f3(0x8)]=getJWT;const clearJWT=async()=>{const _0x276aab={'VJDLe':_0x46f3(0x138),'CFLUH':function(_0x398993,_0x1dcce0){return _0x398993!==_0x1dcce0;},'gTIjj':function(_0x1f1146,_0x326d25){return _0x1f1146!==_0x326d25;},'KecFq':_0x46f3(0x139),'vCUnJ':function(_0x552216,_0x2c67d8){return _0x552216===_0x2c67d8;},'DmXrB':'oFYKY','EskqH':'❌\x20Failed\x20to\x20clear\x20JWT\x20token:'};try{if(_0x276aab[_0x46f3(0x13a)]!==_0x276aab[_0x46f3(0x13a)])return _0x56516d;else{var _0x1d7762;await _asyncStorage[_0x46f3(0x17)]['removeItem'](JWT_TOKEN_KEY),userToken=null,_0x276aab[_0x46f3(0x13b)](_0x1d7762=globalConfig,null)&&_0x276aab['gTIjj'](_0x1d7762,void 0x0)&&_0x1d7762[_0x46f3(0x4a)]&&console[_0x46f3(0x39)](_0x276aab[_0x46f3(0x13c)]);}}catch(_0x299924){if(_0x276aab[_0x46f3(0x13d)](_0x276aab[_0x46f3(0x13e)],'FMCyq'))throw new _0x3e6433(_0x46f3(0x86));else console[_0x46f3(0x4f)](_0x276aab[_0x46f3(0x13f)],_0x299924);}};exports[_0x46f3(0xf)]=clearJWT;const base64Decode=_0x50158c=>{const _0x674fcc={'VWDXI':function(_0x5451aa,_0x53023d){return _0x5451aa<_0x53023d;},'jDbib':function(_0x2c0e44,_0x45f9c4){return _0x2c0e44|_0x45f9c4;},'NxVwj':function(_0x1fdaae,_0x315947){return _0x1fdaae|_0x315947;},'agUbI':function(_0x2d8091,_0x3b9336){return _0x2d8091|_0x3b9336;},'hIJdU':function(_0x553e41,_0x202c58){return _0x553e41<<_0x202c58;},'OgqtV':function(_0x5895bf,_0x2adf91){return _0x5895bf&_0x2adf91;},'ysSdh':function(_0x1dcc1a,_0x96bd51){return _0x1dcc1a>>_0x96bd51;},'fGyjr':function(_0x4127f7,_0xe91143){return _0x4127f7&_0xe91143;},'IyHFD':function(_0x517d11,_0x340538){return _0x517d11>>_0x340538;}},_0x341eae=_0x46f3(0x140);let _0x3a835f='',_0x271c05=0x0;_0x50158c=_0x50158c[_0x46f3(0xef)](/[^A-Za-z0-9+/]/g,'');while(_0x674fcc[_0x46f3(0x141)](_0x271c05,_0x50158c['length'])){const _0x920d69=_0x341eae['indexOf'](_0x50158c['charAt'](_0x271c05++)),_0x21ccb8=_0x341eae[_0x46f3(0x142)](_0x50158c[_0x46f3(0x143)](_0x271c05++)),_0x4b4aa2=_0x341eae[_0x46f3(0x142)](_0x50158c['charAt'](_0x271c05++)),_0x2f35f6=_0x341eae[_0x46f3(0x142)](_0x50158c['charAt'](_0x271c05++)),_0x130a7b=_0x674fcc[_0x46f3(0x144)](_0x674fcc['NxVwj'](_0x674fcc[_0x46f3(0x145)](_0x674fcc[_0x46f3(0x146)](_0x920d69,0x12),_0x21ccb8<<0xc),_0x4b4aa2<<0x6),_0x2f35f6);_0x3a835f+=String[_0x46f3(0x147)](_0x674fcc[_0x46f3(0x148)](_0x674fcc['ysSdh'](_0x130a7b,0x10),0xff));if(_0x4b4aa2!==0x40)_0x3a835f+=String[_0x46f3(0x147)](_0x674fcc[_0x46f3(0x149)](_0x674fcc[_0x46f3(0x14a)](_0x130a7b,0x8),0xff));if(_0x2f35f6!==0x40)_0x3a835f+=String['fromCharCode'](_0x674fcc['OgqtV'](_0x130a7b,0xff));}return _0x3a835f;},decodeJWTPayload=_0x282363=>{const _0x100e31={'VYLqT':function(_0x1c45ec,_0x57ee35){return _0x1c45ec===_0x57ee35;},'RvPkG':_0x46f3(0x84),'ZkTYi':_0x46f3(0xfb),'bgVhW':_0x46f3(0xfc),'FdIJf':_0x46f3(0x14b),'qdJGK':'hMwGX','viRwB':function(_0x307cdb,_0x57f2a6){return _0x307cdb!==_0x57f2a6;},'BuwUe':'❌\x20Invalid\x20JWT\x20token\x20format','yaFBO':function(_0x1e1fd2,_0x45b809){return _0x1e1fd2*_0x45b809;},'FIJKr':function(_0x369cf0,_0x21fd10){return _0x369cf0/_0x21fd10;},'jAXNU':function(_0x47825a,_0x978623){return _0x47825a(_0x978623);},'jjvLf':'❌\x20Failed\x20to\x20decode\x20JWT\x20token:'};try{if(_0x100e31[_0x46f3(0x14c)](_0x100e31['FdIJf'],_0x100e31[_0x46f3(0x14d)])){_0xc57b34(_0x383349);if(_0x100e31[_0x46f3(0x14c)](_0x18ca35[_0x46f3(0xf9)],_0x100e31[_0x46f3(0x14e)])){_0x4f0bcc[_0x46f3(0x4f)](_0x100e31[_0x46f3(0x14f)],_0x47b00e);throw new _0x361f21(_0x100e31[_0x46f3(0x150)]);}throw _0x16b256;}else{const _0x51dbc2=_0x282363[_0x46f3(0x61)]('.');if(_0x100e31[_0x46f3(0x151)](_0x51dbc2[_0x46f3(0x77)],0x3))return console[_0x46f3(0x4f)](_0x100e31['BuwUe']),null;const _0x2bbba8=_0x51dbc2[0x1],_0x4f15d5=_0x2bbba8['replace'](/-/g,'+')[_0x46f3(0xef)](/_/g,'/'),_0x5bc42a=_0x4f15d5['padEnd'](_0x100e31[_0x46f3(0x152)](Math['ceil'](_0x100e31[_0x46f3(0x153)](_0x4f15d5[_0x46f3(0x77)],0x4)),0x4),'='),_0x5478aa=_0x100e31[_0x46f3(0x154)](base64Decode,_0x5bc42a);return JSON['parse'](_0x5478aa);}}catch(_0x57677f){return console[_0x46f3(0x4f)](_0x100e31[_0x46f3(0x155)],_0x57677f),null;}};exports[_0x46f3(0xe)]=decodeJWTPayload;const extractUsernameFromJWT=_0x10a13c=>{const _0x5020be={'hJsSM':function(_0x199cdb,_0x5acb18){return _0x199cdb!==_0x5acb18;},'weUad':'SDK\x20not\x20initialized.\x20Call\x20initializeApiKey()\x20first.','hzavM':'production','cpbpN':_0x46f3(0x13),'hfqaQ':'developer','NGsfz':'invalid','bNVQT':_0x46f3(0x156),'jiMUm':function(_0x2a2098,_0x42a78a){return _0x2a2098(_0x42a78a);},'giOzh':function(_0x383e30,_0x51a542){return _0x383e30===_0x51a542;},'iVYJE':_0x46f3(0x157),'JbaUp':function(_0x164bf4,_0x10afca){return _0x164bf4!==_0x10afca;},'AnrWI':_0x46f3(0x158),'Nyiit':_0x46f3(0x159),'gDbFs':function(_0x3bb59a,_0x2863ab){return _0x3bb59a||_0x2863ab;}};try{var _0x4e9591;const _0x256a65=_0x10a13c||userToken;if(!_0x256a65)return console[_0x46f3(0x1b)](_0x5020be[_0x46f3(0x15a)]),null;const _0x430f47=_0x5020be[_0x46f3(0x15b)](decodeJWTPayload,_0x256a65);if(!_0x430f47){if(_0x5020be[_0x46f3(0x15c)](_0x5020be[_0x46f3(0x15d)],_0x5020be[_0x46f3(0x15d)]))return null;else{var _0x583c22;if(!((_0x583c22=_0x4cc92b)!==null&&_0x5020be[_0x46f3(0x15e)](_0x583c22,void 0x0)&&_0x583c22['apiKey']))throw new _0x1c4405(_0x5020be['weUad']);const _0x157a82=_0x5747d3(_0xcf7476[_0x46f3(0x3c)]);return{'Content-Type':'application/json','Authorization':_0x46f3(0xc3)+_0x3e4f20[_0x46f3(0x3c)],'User-Agent':_0x46f3(0x15f),'X-SDK-Version':_0x46f3(0x80),'X-SDK-Environment':_0xd19625[_0x46f3(0x47)]||_0x5020be[_0x46f3(0x160)],'X-API-Key-Type':_0x157a82,'X-Timestamp':new _0x2c408d()['toISOString']()};}}const _0x3f53df=_0x430f47[_0x46f3(0x103)]||_0x430f47[_0x46f3(0x104)]||_0x430f47[_0x46f3(0x161)]||_0x430f47[_0x46f3(0x102)];if((_0x4e9591=globalConfig)!==null&&_0x4e9591!==void 0x0&&_0x4e9591[_0x46f3(0x4a)]){if(_0x5020be['JbaUp'](_0x5020be[_0x46f3(0x162)],_0x5020be[_0x46f3(0x162)]))return _0x18b89f[_0x5020be[_0x46f3(0x163)]]=_0x5020be[_0x46f3(0x164)],_0x253790['INVALID']=_0x5020be[_0x46f3(0x165)],_0x126177;else console[_0x46f3(0x39)](_0x5020be[_0x46f3(0x166)],_0x3f53df);}return _0x5020be[_0x46f3(0x167)](_0x3f53df,null);}catch(_0x69c595){return console[_0x46f3(0x4f)](_0x46f3(0x168),_0x69c595),null;}};exports['extractUsernameFromJWT']=extractUsernameFromJWT;const extractUserDataFromJWT=_0x496ad1=>{const _0x149485={'CeCyH':function(_0xae7af2,_0x13d398){return _0xae7af2|_0x13d398;},'hJpFt':function(_0x1a9111,_0x59e070){return _0x1a9111|_0x59e070;},'jzBaP':function(_0x1e956d,_0x3b16d9){return _0x1e956d<<_0x3b16d9;},'SvxnZ':function(_0x4ae034,_0x1b9252){return _0x4ae034<<_0x1b9252;},'lWODV':function(_0x585d92,_0xfa4f53){return _0x585d92<<_0xfa4f53;},'YExWG':function(_0x5f5df2,_0x48ff53){return _0x5f5df2&_0x48ff53;},'UOSCf':function(_0x4c6ad2,_0x34e6f8){return _0x4c6ad2>>_0x34e6f8;},'Fppcc':function(_0xc36d4b,_0x4b06af){return _0xc36d4b!==_0x4b06af;},'pdzFV':function(_0x3951f7,_0xdd7b50){return _0x3951f7(_0xdd7b50);},'tdfkY':function(_0x2c6f12,_0x522936){return _0x2c6f12===_0x522936;},'pMCUA':'wjsZY','Evfnl':_0x46f3(0x169),'bNAvP':function(_0x37f768,_0x5c19fe){return _0x37f768!==_0x5c19fe;},'BmNeu':function(_0x33691,_0x35196f){return _0x33691!==_0x35196f;},'VRNHF':_0x46f3(0x16a),'bxRSD':function(_0x5d7776,_0xb81aee){return _0x5d7776!==_0xb81aee;},'IyNJf':_0x46f3(0x16b),'klvuP':_0x46f3(0xe4)};try{var _0x26e92f;const _0x551d74=_0x496ad1||userToken;if(!_0x551d74)return console[_0x46f3(0x1b)](_0x46f3(0x85)),null;const _0x258248=_0x149485['pdzFV'](decodeJWTPayload,_0x551d74);if(!_0x258248){if(_0x149485['tdfkY'](_0x149485[_0x46f3(0x16c)],_0x149485[_0x46f3(0x16d)])){var _0x3bd494;return((_0x3bd494=_0x233e69)===null||_0x3bd494===void 0x0?void 0x0:_0x3bd494[_0x46f3(0x3c)])||null;}else return null;}const _0x539cda={'id':_0x258248['id'],'email':_0x258248[_0x46f3(0x102)],'userId':_0x258248[_0x46f3(0x161)],'userName':_0x258248[_0x46f3(0x103)]||_0x258248[_0x46f3(0x104)],'verified':_0x258248[_0x46f3(0x105)],'iat':_0x258248[_0x46f3(0x106)],'exp':_0x258248[_0x46f3(0x16e)]};if(_0x149485[_0x46f3(0x16f)](_0x26e92f=globalConfig,null)&&_0x149485[_0x46f3(0x170)](_0x26e92f,void 0x0)&&_0x26e92f[_0x46f3(0x4a)]){if(_0x149485[_0x46f3(0x171)](_0x46f3(0x172),_0x46f3(0x173)))throw new _0x18d79e(_0x46f3(0x6d)+_0x167da8[_0x46f3(0x4f)]);else console['log'](_0x149485['VRNHF'],_0x539cda);}return _0x539cda;}catch(_0x460373){if(_0x149485[_0x46f3(0x174)](_0x149485[_0x46f3(0x175)],_0x46f3(0x16b))){const _0x3e740c=_0x36f903[_0x46f3(0x142)](_0x320fdf[_0x46f3(0x143)](_0x4a7fa2++)),_0x2140c3=_0x4326d3[_0x46f3(0x142)](_0x97f71b['charAt'](_0x116113++)),_0x1a6e73=_0x3ce0e4[_0x46f3(0x142)](_0x19e8d7[_0x46f3(0x143)](_0x524fef++)),_0x4c05f3=_0x1ca5b6[_0x46f3(0x142)](_0x2f9d16[_0x46f3(0x143)](_0x1dd74e++)),_0x261bde=_0x149485[_0x46f3(0x176)](_0x149485[_0x46f3(0x176)](_0x149485[_0x46f3(0x177)](_0x149485[_0x46f3(0x178)](_0x3e740c,0x12),_0x149485['SvxnZ'](_0x2140c3,0xc)),_0x149485[_0x46f3(0x179)](_0x1a6e73,0x6)),_0x4c05f3);_0x2be60d+=_0x6bad29[_0x46f3(0x147)](_0x149485[_0x46f3(0x17a)](_0x149485[_0x46f3(0x17b)](_0x261bde,0x10),0xff));if(_0x1a6e73!==0x40)_0x4205e6+=_0x2bee9d[_0x46f3(0x147)](_0x261bde>>0x8&0xff);if(_0x149485[_0x46f3(0x17c)](_0x4c05f3,0x40))_0x2f413c+=_0x2b5aba[_0x46f3(0x147)](_0x261bde&0xff);}else return console['error'](_0x149485[_0x46f3(0x17d)],_0x460373),null;}};exports[_0x46f3(0xd)]=extractUserDataFromJWT;const isUserAuthenticated=()=>{return!!userToken;};function _0x2006(){const _0x24de2c=['__esModule','validateApiKey','makeUserRequest','makeDeveloperRequest','isUserAuthenticated','isApiKeyInitialized','initializeApiKey','getUserAuthHeaders','getJWT','getDeveloperAuthHeaders','getAuthHeaders','getApiKeyType','getApiConfig','extractUserDataFromJWT','decodeJWTPayload','clearJWT','ApiKeyType','developer','invalid','DEVELOPER','vyavI','momCO','onairos_jwt_token','default','fetch','AiYdi','isInternetReachable','warn','⚠️\x20Failed\x20to\x20check\x20network\x20connectivity:','API_CONFIG','BASE_URL','❌\x20Failed\x20to\x20parse\x20JSON\x20response:','✅\x20API\x20key\x20validation\x20successful','🔑\x20Initializing\x20Onairos\x20SDK\x20with\x20developer\x20API\x20key...','wCuWA','Invalid\x20API\x20key\x20format.\x20Developer\x20keys\x20must\x20be\x20at\x20least\x2032\x20characters\x20long.','dev_','ona_','pk_','Nmszz','Invalid\x20API\x20key\x20format.\x20Developer\x20keys\x20must\x20start\x20with\x20dev_,\x20ona_,\x20or\x20pk_','production','gLFPf','QBLTu','📝\x20SDK\x20Configuration:','...','Network\x20request\x20failed','Network\x20error','JSON\x20Parse\x20error','ENOTFOUND','📝\x20SDK\x20will\x20function\x20with\x20limited\x20validation.\x20Network\x20connectivity\x20will\x20be\x20retried\x20automatically.','📱\x20SDK\x20initialized\x20in\x20offline\x20mode\x20-\x20will\x20retry\x20validation\x20when\x20network\x20is\x20available','⚠️\x20API\x20key\x20validation\x20failed\x20due\x20to\x20network/connectivity\x20issues','🌐\x20Error\x20details:','mOBcn','GdWke','🔐\x20API\x20Key\x20Permissions:','log','DmGKl','Developer\x20API\x20key\x20is\x20required\x20for\x20SDK\x20initialization','apiKey','Topnt','hoCDp','TLEVP','KupwI','some','startsWith','yaUfX','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','message','cwRXJ','environment','nNDVa','JcvNM','enableLogging','retryAttempts','gWUor','cgtky','BonOI','error','MSjgC','status','Failed\x20to\x20parse\x20server\x20response\x20as\x20JSON:\x20','tgWBa','timeout','MbBVl','substring','NqqOy','QHzGY','isValid','isNetworkError','includes','NymJL','xrHLH','oQOMV','BBrqg','koUiy','split','BKhMD','cEcCz','YUCpU','Vzleg','PIupz','ExKXq','hyQKD','application','ntMbo','aRhUG','usageCount','API\x20key\x20validation\x20failed:\x20','dZKOI','rateLimits','uOZiM','fHXbH','✅\x20Onairos\x20SDK\x20initialized\x20successfully','Ntptt','kFseu','📡\x20User\x20request\x20response:\x20','rNRwP','length','mGink','zAbeh','QOXyO','📡\x20Developer\x20request\x20response:\x20','\x20for\x20','INVALID','User\x20not\x20authenticated.\x20Please\x20verify\x20email\x20first.','OnairosSDK/1.0.0','3.0.72','🗑️\x20API\x20key\x20validation\x20cache\x20cleared','Invalid\x20or\x20expired\x20API\x20key','❌\x20API\x20key\x20validation\x20failed\x20(client\x20error):','AbortError','⚠️\x20No\x20JWT\x20token\x20available\x20for\x20user\x20data\x20extraction','SDK\x20not\x20initialized.\x20Call\x20initializeApiKey()\x20first.','API\x20validation\x20endpoint\x20returned','No\x20network\x20connection','🔄\x20Continuing\x20in\x20offline\x20mode\x20with\x20basic\x20validation','❌\x20Invalid\x20JWT\x20token\x20format','❌\x20API\x20rate\x20limit\x20exceeded','eOzQR','📋\x20Using\x20cached\x20API\x20key\x20validation\x20result','⚠️\x20No\x20network\x20connectivity\x20detected','No\x20network\x20connection\x20available.\x20Please\x20check\x20your\x20internet\x20connection\x20and\x20try\x20again.','IOpTz','bJeCk','mYrEo','OnairosReactNative/3.3.1','3.3.1','GcOpP','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.','pXAVN','qZvRU','pRSZd','❌\x20API\x20endpoint\x20returned\x20non-JSON\x20response:','LdOqO','<html','wweNH','unknown\x20content\x20type','UImeM','RhRpH','nTxLv','DScTw','pIKdd','DNS','🌐\x20Network\x20error\x20during\x20API\x20key\x20validation:','IUVCw','cjUZN','🔍\x20Validating\x20developer\x20API\x20key\x20against\x20backend...','dBMoM','xQTct','get','jwDzs','now','AwzQK','qTbDv','FkoXq','DEbOe','RWvIB','jPcJj','zTORt','fJmsY','result','sxbtc','KXslt','KMBDs','abort','reVWe','YQuQm','YWfhf','qoGwn','\x20for\x20API\x20key\x20validation','ppFrQ','/dev/validate-apikey','Bearer\x20','yZyVg','toString','stringify','laish','toISOString','dNcVc','No\x20response\x20received\x20from\x20server','MbMsE','tuOEp','swMNR','TGqlk','sJlmw','bwtxG','headers','content-type','yqsWs','text','fExVv','statusText','FEVqm','vngzd','API\x20validation\x20endpoint\x20not\x20found\x20(404).\x20The\x20endpoint\x20','IXUaV','JBbXK','Server\x20error\x20(500).\x20The\x20Onairos\x20backend\x20is\x20experiencing\x20issues.','CfzYk','MpBHp',').\x20The\x20Onairos\x20backend\x20may\x20be\x20temporarily\x20down.','eWVBh','Fssnu','vwytr','Server\x20returned\x20HTML\x20page\x20instead\x20of\x20JSON\x20API\x20response.\x20This\x20often\x20indicates\x20a\x20routing\x20issue\x20or\x20server\x20misconfiguration.','❌\x20Failed\x20to\x20extract\x20user\x20data\x20from\x20JWT:','myBOY','OmqSX','API\x20validation\x20endpoint\x20returned\x20','.\x20Expected\x20JSON\x20but\x20got\x20','HugPG','IYYPo','lgdmz','json','gbKsx','dmqUP','replace','zyVZf','IkAoh','success','VEsAg','permissions','set','ZtQuW','ciZBX','SWQAZ','name','izZNX','⏱️\x20Request\x20timeout\x20for:','Request\x20timeout','tXCls','HTTP\x20','hrBuP','MSVzE','RTrZd','email','userName','username','verified','iat','nshcp','wEEZT','eaozs','WVjdD','SIqsC','bmbdc','hGFGU','HQeeZ','wFeOw','NoMWk','ZCCJW','eSUKy','xNRTn','IBOdQ','API\x20key\x20validation\x20timeout\x20(','ms)','⏱️\x20API\x20key\x20validation\x20timeout','bPljj','faREn','alrLl','oIYWI','vMyjA','Unexpected\x20character','Network\x20connectivity\x20issue.\x20Please\x20check\x20internet\x20connection\x20and\x20verify\x20the\x20Onairos\x20API\x20is\x20accessible.\x20','VFXoO','pYDNG','RlbBY','rvCaN','paNBi','NnPIN','min','pow','ykLXK','⏳\x20Waiting\x20','UgxiP','API\x20key\x20validation\x20error:\x20','maMaM','knmsB','getApiKey','IwHCd','🎫\x20JWT\x20token\x20stored\x20successfully','❌\x20Failed\x20to\x20store\x20JWT\x20token:','WzSKm','GWSzx','IJOaD','storeJWT','❌\x20Failed\x20to\x20load\x20JWT\x20token:','getItem','fitpR','ZVjmR','🗑️\x20JWT\x20token\x20cleared','VJDLe','CFLUH','KecFq','vCUnJ','DmXrB','EskqH','ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/','VWDXI','indexOf','charAt','jDbib','agUbI','hIJdU','fromCharCode','OgqtV','fGyjr','IyHFD','LmGtE','VYLqT','qdJGK','RvPkG','ZkTYi','bgVhW','viRwB','yaFBO','FIJKr','jAXNU','jjvLf','⚠️\x20No\x20JWT\x20token\x20available\x20for\x20username\x20extraction','QwOAH','ZpDyJ','👤\x20Extracted\x20username\x20from\x20JWT:','bNVQT','jiMUm','giOzh','iVYJE','hJsSM','OnairosReactNative/3.0.72','hzavM','userId','AnrWI','cpbpN','hfqaQ','NGsfz','Nyiit','gDbFs','❌\x20Failed\x20to\x20extract\x20username\x20from\x20JWT:','hgCoH','👤\x20Extracted\x20user\x20data\x20from\x20JWT:','DiGOu','pMCUA','Evfnl','exp','bNAvP','BmNeu','tdfkY','Tjdco','agYuR','bxRSD','IyNJf','CeCyH','hJpFt','jzBaP','lWODV','YExWG','UOSCf','Fppcc','klvuP','FTBrd','moREz','AxUgG','sCJKz','kBsVL','RusbP','CTFaW','qQoMp','oFDzQ','vmlNB','kOzyE','rdaVQ','TTlLN','XTxGF','Insufficient\x20API\x20key\x20permissions','aHdNz','GKCDx','❌\x20API\x20rate\x20limit\x20exceeded.\x20Please\x20try\x20again\x20later.','Rate\x20limit\x20exceeded','HWDvk','vcXZH','ShucF','evtzc','wnDyU','📡\x20Response\x20status:\x20','LIJPs','ncjbb','zJVdA','IxRMm','SWDHF','tYJNh','❌\x20Developer\x20API\x20key\x20permissions\x20insufficient','JTeUk','tBhdF','WVCzQ','makeAuthenticatedRequest','Onairos\x20API\x20request\x20timed\x20out\x20(504\x20Gateway\x20Timeout).\x20Please\x20try\x20again.','❌\x20Developer\x20API\x20key\x20authentication\x20failed','pFDEZ','UbDdU','erJvD','xbDog','sirQj','RuSGo','uggea','NaylW','WsvUX','KwuXc','signal','GECRS','FjuEZ','dPXqX','BbYWJ','PzxBx','wAGOC','rJhAb','yZwUc','yhsmy','luYlN','keSBg','ildgW','yZtZo','QMJpf','rehtP','cSnxz','qFtxn','❌\x20JWT\x20token\x20authentication\x20failed\x20-\x20token\x20may\x20be\x20expired','Authentication\x20expired.\x20Please\x20verify\x20email\x20again.','caTJt','❌\x20JWT\x20token\x20permissions\x20insufficient','Insufficient\x20permissions\x20for\x20this\x20operation','ZRSjw','RploD','cAEcO','QovAX','🌐\x20Making\x20user\x20request\x20to:\x20','IeNoe','tenmM','XByHE','tZbmC','ZggWe','MrtcW','HrzCb','ZbvJq','yUZDg','icklb','hbaea','xOGkA','ms\x20before\x20retry...','mTeAR','CcMXM','clear','GyNXA','CTOxw','XpauK','clearValidationCache','🔄\x20API\x20key\x20service\x20reset','NfevY','resetApiKeyService'];_0x2006=function(){return _0x24de2c;};return _0x2006();}exports[_0x46f3(0x4)]=isUserAuthenticated;const getAuthHeaders=()=>{const _0xa05778={'FTBrd':function(_0x18edcf,_0x4e8e40){return _0x18edcf!==_0x4e8e40;},'moREz':'SDK\x20not\x20initialized.\x20Call\x20initializeApiKey()\x20first.'};var _0x163c2a;if(!(_0xa05778['FTBrd'](_0x163c2a=globalConfig,null)&&_0xa05778[_0x46f3(0x17e)](_0x163c2a,void 0x0)&&_0x163c2a['apiKey']))throw new Error(_0xa05778[_0x46f3(0x17f)]);const _0x152d06=getApiKeyType(globalConfig[_0x46f3(0x3c)]);return{'Content-Type':'application/json','Authorization':'Bearer\x20'+globalConfig[_0x46f3(0x3c)],'User-Agent':_0x46f3(0x15f),'X-SDK-Version':_0x46f3(0x80),'X-SDK-Environment':globalConfig['environment']||'production','X-API-Key-Type':_0x152d06,'X-Timestamp':new Date()[_0x46f3(0xc8)]()};};exports[_0x46f3(0xa)]=getAuthHeaders;const getDeveloperAuthHeaders=()=>{const _0xf687ec={'AxUgG':function(_0x2b7ec6,_0x30e0f5){return _0x2b7ec6!==_0x30e0f5;},'CstQi':_0x46f3(0x86),'GwOib':_0x46f3(0x7f),'sCJKz':_0x46f3(0x80),'rLUrL':_0x46f3(0x29)};var _0xe34d08;if(!(_0xf687ec[_0x46f3(0x180)](_0xe34d08=globalConfig,null)&&_0xe34d08!==void 0x0&&_0xe34d08[_0x46f3(0x3c)]))throw new Error(_0xf687ec['CstQi']);const _0x132b6e=getApiKeyType(globalConfig[_0x46f3(0x3c)]);return{'Content-Type':'application/json','Authorization':'Bearer\x20'+globalConfig[_0x46f3(0x3c)],'User-Agent':_0xf687ec['GwOib'],'X-SDK-Version':_0xf687ec[_0x46f3(0x181)],'X-SDK-Environment':globalConfig['environment']||_0xf687ec['rLUrL'],'X-API-Key-Type':_0x132b6e,'X-Timestamp':new Date()[_0x46f3(0xc8)]()};};exports['getDeveloperAuthHeaders']=getDeveloperAuthHeaders;const getUserAuthHeaders=()=>{const _0x589a25={'kOzyE':function(_0x2a4779,_0x4edffd){return _0x2a4779||_0x4edffd;},'CTFaW':_0x46f3(0x156),'qQoMp':function(_0x48e141,_0x313bf5){return _0x48e141(_0x313bf5);},'oFDzQ':function(_0x22b782,_0x3e435d){return _0x22b782!==_0x3e435d;},'vmlNB':'👤\x20Extracted\x20username\x20from\x20JWT:','Gfzmr':function(_0x8b1a81,_0x5d8c8f){return _0x8b1a81===_0x5d8c8f;},'RusbP':_0x46f3(0x182),'IUWPe':_0x46f3(0x7e),'rdaVQ':_0x46f3(0x7f),'TTlLN':function(_0x1d2fbe,_0x3599c9){return _0x1d2fbe===_0x3599c9;},'XTxGF':_0x46f3(0x29)};var _0x22ebf3;if(!userToken){if(_0x589a25['Gfzmr'](_0x589a25[_0x46f3(0x183)],_0x46f3(0x182)))throw new Error(_0x589a25['IUWPe']);else{var _0x47c7ef;const _0x205630=_0x589a25['kOzyE'](_0x550ac5,_0x4931d8);if(!_0x205630)return _0x3ef4f8[_0x46f3(0x1b)](_0x589a25[_0x46f3(0x184)]),null;const _0x2e1856=_0x589a25[_0x46f3(0x185)](_0x3c1f6c,_0x205630);if(!_0x2e1856)return null;const _0x1ab694=_0x2e1856[_0x46f3(0x103)]||_0x2e1856[_0x46f3(0x104)]||_0x2e1856[_0x46f3(0x161)]||_0x2e1856['email'];return(_0x47c7ef=_0x28f0ec)!==null&&_0x589a25[_0x46f3(0x186)](_0x47c7ef,void 0x0)&&_0x47c7ef[_0x46f3(0x4a)]&&_0x35d8fe[_0x46f3(0x39)](_0x589a25[_0x46f3(0x187)],_0x1ab694),_0x589a25[_0x46f3(0x188)](_0x1ab694,null);}}return{'Content-Type':'application/json','Authorization':_0x46f3(0xc3)+userToken,'User-Agent':_0x589a25[_0x46f3(0x189)],'X-SDK-Version':'3.0.72','X-SDK-Environment':(_0x589a25['TTlLN'](_0x22ebf3=globalConfig,null)||_0x589a25[_0x46f3(0x18a)](_0x22ebf3,void 0x0)?void 0x0:_0x22ebf3['environment'])||_0x589a25[_0x46f3(0x18b)]};};exports[_0x46f3(0x7)]=getUserAuthHeaders;const makeAuthenticatedRequest=async(_0x25cdee,_0x3f9399={})=>{const _0xe9310a={'SWDHF':_0x46f3(0x18c),'HWDvk':'SDK\x20not\x20initialized.\x20Call\x20initializeApiKey()\x20first.','vcXZH':_0x46f3(0x29),'erRrj':function(_0x3b067a,_0x192e3b,_0x3f9768){return _0x3b067a(_0x192e3b,_0x3f9768);},'ShucF':function(_0x5af70d,_0x3e9fe5){return _0x5af70d!==_0x3e9fe5;},'GYfRP':_0x46f3(0x18d),'evtzc':_0x46f3(0x18e),'wnDyU':function(_0x121506,_0x3a8227){return _0x121506(_0x3a8227);},'zJVdA':function(_0x4aa1ed,_0x45149c){return _0x4aa1ed===_0x45149c;},'LIJPs':'❌\x20API\x20key\x20authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key.','ncjbb':_0x46f3(0x82),'IxRMm':'❌\x20API\x20key\x20permissions\x20insufficient\x20for\x20this\x20operation.','iNxDH':function(_0x122a48,_0x33615e){return _0x122a48===_0x33615e;},'kmTdE':_0x46f3(0x18f),'tYJNh':_0x46f3(0x190),'JTeUk':function(_0x4b1aac,_0x1fd36a){return _0x4b1aac===_0x1fd36a;},'tBhdF':'⏱️\x20Request\x20timeout\x20for:','WVCzQ':_0x46f3(0xfc)};if(!isApiKeyInitialized())throw new Error(_0xe9310a[_0x46f3(0x191)]);const _0xba03a8=getApiConfig(),_0x591996=API_ENDPOINTS[_0xba03a8[_0x46f3(0x47)]||_0xe9310a[_0x46f3(0x192)]],_0xd1a3dd=''+_0x591996+(_0x25cdee[_0x46f3(0x42)]('/')?'':'/')+_0x25cdee,_0x107622={...getAuthHeaders(),..._0x3f9399[_0x46f3(0xd1)]||{}},_0x26477e=new AbortController(),_0x5ca491=_0xe9310a['erRrj'](setTimeout,()=>_0x26477e['abort'](),_0xba03a8[_0x46f3(0x54)]||0x7530);try{if(_0xe9310a[_0x46f3(0x193)](_0xe9310a['GYfRP'],_0xe9310a[_0x46f3(0x194)])){_0xba03a8[_0x46f3(0x4a)]&&console[_0x46f3(0x39)]('🌐\x20Making\x20authenticated\x20request\x20to:\x20'+_0x25cdee);const _0x10a075=await fetch(_0xd1a3dd,{..._0x3f9399,'headers':_0x107622,'signal':_0x26477e['signal']});_0xe9310a[_0x46f3(0x195)](clearTimeout,_0x5ca491);_0xba03a8[_0x46f3(0x4a)]&&console[_0x46f3(0x39)](_0x46f3(0x196)+_0x10a075[_0x46f3(0x51)]+_0x46f3(0x7c)+_0x25cdee);if(_0xe9310a['zJVdA'](_0x10a075[_0x46f3(0x51)],0x191)){console['error'](_0xe9310a[_0x46f3(0x197)]);throw new Error(_0xe9310a[_0x46f3(0x198)]);}if(_0xe9310a[_0x46f3(0x199)](_0x10a075['status'],0x193)){console['error'](_0xe9310a[_0x46f3(0x19a)]);throw new Error(_0xe9310a[_0x46f3(0x19b)]);}if(_0xe9310a['iNxDH'](_0x10a075[_0x46f3(0x51)],0x1ad)){console['error'](_0xe9310a['kmTdE']);throw new Error(_0xe9310a[_0x46f3(0x19c)]);}return _0x10a075;}else{_0x5de5ce['error'](_0x46f3(0x19d));throw new _0x322fa1(_0xe9310a[_0x46f3(0x19b)]);}}catch(_0x51a7ba){_0xe9310a['wnDyU'](clearTimeout,_0x5ca491);if(_0xe9310a[_0x46f3(0x19e)](_0x51a7ba[_0x46f3(0xf9)],'AbortError')){console['error'](_0xe9310a[_0x46f3(0x19f)],_0x25cdee);throw new Error(_0xe9310a[_0x46f3(0x1a0)]);}throw _0x51a7ba;}};exports[_0x46f3(0x1a1)]=makeAuthenticatedRequest;const makeDeveloperRequest=async(_0x5f88ae,_0x33cb0f={})=>{const _0x20e454={'yZwUc':_0x46f3(0x1a2),'HcgXg':_0x46f3(0x8f),'erJvD':_0x46f3(0x86),'xbDog':function(_0x200845){return _0x200845();},'sirQj':function(_0x44ac9e){return _0x44ac9e();},'RuSGo':function(_0xb99e5e,_0x21c875,_0x373dc0){return _0xb99e5e(_0x21c875,_0x373dc0);},'uggea':function(_0x3c52ee,_0x551aa7){return _0x3c52ee===_0x551aa7;},'NaylW':'WsvUX','KwuXc':function(_0x2d3f8b,_0x2e808b,_0x386ee0){return _0x2d3f8b(_0x2e808b,_0x386ee0);},'GECRS':function(_0x2cfe4e,_0x3c7c28){return _0x2cfe4e(_0x3c7c28);},'BbYWJ':function(_0x50854b,_0x4eb557){return _0x50854b===_0x4eb557;},'FjuEZ':_0x46f3(0x1a3),'dPXqX':_0x46f3(0x82),'PzxBx':function(_0x4e21eb,_0x3ed773){return _0x4e21eb===_0x3ed773;},'wAGOC':_0x46f3(0x1a4),'rJhAb':'Insufficient\x20API\x20key\x20permissions','luYlN':_0x46f3(0x8b),'keSBg':_0x46f3(0x190),'yZtZo':function(_0x48a5ce,_0x580fe7){return _0x48a5ce(_0x580fe7);},'DmZIt':function(_0x537da2,_0x32597d){return _0x537da2===_0x32597d;},'QMJpf':_0x46f3(0x84),'rehtP':_0x46f3(0x1a5),'doldO':_0x46f3(0xfc)};if(!isApiKeyInitialized())throw new Error(_0x20e454[_0x46f3(0x1a6)]);const _0x4e1e20=_0x20e454[_0x46f3(0x1a7)](getApiConfig),_0x10a2f1=API_ENDPOINTS[_0x4e1e20['environment']||_0x46f3(0x29)],_0x4e7a7d=''+_0x10a2f1+(_0x5f88ae[_0x46f3(0x42)]('/')?'':'/')+_0x5f88ae,_0xc4c19={..._0x20e454[_0x46f3(0x1a8)](getDeveloperAuthHeaders),..._0x33cb0f['headers']||{}},_0x56bade=new AbortController(),_0x3e8830=_0x20e454[_0x46f3(0x1a9)](setTimeout,()=>_0x56bade[_0x46f3(0xbb)](),_0x4e1e20['timeout']||0x7530);try{if(_0x20e454[_0x46f3(0x1aa)](_0x20e454[_0x46f3(0x1ab)],_0x46f3(0x1ac))){_0x4e1e20['enableLogging']&&console[_0x46f3(0x39)]('🌐\x20Making\x20developer\x20request\x20to:\x20'+_0x5f88ae);const _0x459264=await _0x20e454[_0x46f3(0x1ad)](fetch,_0x4e7a7d,{..._0x33cb0f,'headers':_0xc4c19,'signal':_0x56bade[_0x46f3(0x1ae)]});_0x20e454[_0x46f3(0x1af)](clearTimeout,_0x3e8830);_0x4e1e20[_0x46f3(0x4a)]&&console[_0x46f3(0x39)](_0x46f3(0x7b)+_0x459264[_0x46f3(0x51)]+'\x20for\x20'+_0x5f88ae);if(_0x20e454['BbYWJ'](_0x459264['status'],0x191)){console[_0x46f3(0x4f)](_0x20e454[_0x46f3(0x1b0)]);throw new Error(_0x20e454[_0x46f3(0x1b1)]);}if(_0x20e454[_0x46f3(0x1b2)](_0x459264[_0x46f3(0x51)],0x193)){if(_0x20e454[_0x46f3(0x1b3)](_0x20e454[_0x46f3(0x1b4)],_0x20e454['wAGOC'])){console[_0x46f3(0x4f)](_0x46f3(0x19d));throw new Error(_0x20e454[_0x46f3(0x1b5)]);}else throw new _0x59e7c8(_0x20e454[_0x46f3(0x1b6)]);}if(_0x20e454[_0x46f3(0x1aa)](_0x459264[_0x46f3(0x51)],0x1ad)){if(_0x20e454[_0x46f3(0x1b3)](_0x46f3(0x1b7),_0x46f3(0x1b7))){console['error'](_0x20e454[_0x46f3(0x1b8)]);throw new Error(_0x20e454[_0x46f3(0x1b9)]);}else return _0x24aff7[_0x46f3(0x1b)]('⚠️\x20No\x20JWT\x20token\x20available\x20for\x20user\x20data\x20extraction'),null;}return _0x459264;}else return _0x19f5f2['warn'](_0x46f3(0x8e)),{'isValid':![],'error':_0x20e454['HcgXg'],'keyType':_0xcd4ec7,'isNetworkError':!![]};}catch(_0x138b39){if(_0x46f3(0x1ba)==='ildgW'){_0x20e454[_0x46f3(0x1bb)](clearTimeout,_0x3e8830);if(_0x20e454['DmZIt'](_0x138b39[_0x46f3(0xf9)],_0x20e454[_0x46f3(0x1bc)])){if(_0x20e454[_0x46f3(0x1bd)]!==_0x20e454[_0x46f3(0x1bd)])return!!_0x3d4f46;else{console['error'](_0x46f3(0xfb),_0x5f88ae);throw new Error(_0x20e454['doldO']);}}throw _0x138b39;}else return null;}};exports[_0x46f3(0x3)]=makeDeveloperRequest;const makeUserRequest=async(_0xa05d84,_0x238b81={})=>{const _0x135819={'PHSTf':_0x46f3(0x7e),'RploD':_0x46f3(0x29),'tZbmC':function(_0x4320af){return _0x4320af();},'nBBmL':function(_0x2f1b83,_0x44a82d,_0x391da0){return _0x2f1b83(_0x44a82d,_0x391da0);},'cAEcO':_0x46f3(0x1be),'QovAX':_0x46f3(0x1bf),'IeNoe':function(_0x3d5d95,_0x51b9fa,_0x38124a){return _0x3d5d95(_0x51b9fa,_0x38124a);},'tenmM':function(_0x39b14f,_0x246878){return _0x39b14f(_0x246878);},'XByHE':function(_0x44ffa3,_0xb5e72b){return _0x44ffa3===_0xb5e72b;},'xvEqf':_0x46f3(0x1c0),'ZggWe':_0x46f3(0x1c1),'MrtcW':'ntcwK','HrzCb':_0x46f3(0x1c2),'ZbvJq':_0x46f3(0x1c3),'yUZDg':_0x46f3(0x1c4),'icklb':_0x46f3(0x84),'xOGkA':_0x46f3(0x1c5),'mTeAR':'⏱️\x20Request\x20timeout\x20for:','CcMXM':_0x46f3(0xfc)};!isUserAuthenticated()&&await loadJWT();if(!isUserAuthenticated())throw new Error(_0x135819['PHSTf']);const _0x34928f=getApiConfig()||{'environment':_0x135819[_0x46f3(0x1c6)],'timeout':0x7530,'enableLogging':![]},_0x345da8=API_ENDPOINTS[_0x34928f[_0x46f3(0x47)]||_0x135819[_0x46f3(0x1c6)]],_0x89ece6=''+_0x345da8+(_0xa05d84[_0x46f3(0x42)]('/')?'':'/')+_0xa05d84,_0x407b1c={..._0x135819['tZbmC'](getUserAuthHeaders),..._0x238b81[_0x46f3(0xd1)]||{}},_0x19f5f9=new AbortController(),_0xea8b8b=_0x135819['nBBmL'](setTimeout,()=>_0x19f5f9[_0x46f3(0xbb)](),_0x34928f['timeout']||0x7530);try{if(_0x34928f[_0x46f3(0x4a)]){if(_0x135819[_0x46f3(0x1c7)]===_0x135819[_0x46f3(0x1c8)])return _0x5dc6ca&&_0x11d3a5[_0x46f3(0x0)]?_0x4e5490:{'default':_0xc44afc};else console[_0x46f3(0x39)](_0x46f3(0x1c9)+_0xa05d84);}const _0x2278b7=await _0x135819[_0x46f3(0x1ca)](fetch,_0x89ece6,{..._0x238b81,'headers':_0x407b1c,'signal':_0x19f5f9[_0x46f3(0x1ae)]});_0x135819[_0x46f3(0x1cb)](clearTimeout,_0xea8b8b);_0x34928f['enableLogging']&&console[_0x46f3(0x39)](_0x46f3(0x75)+_0x2278b7['status']+_0x46f3(0x7c)+_0xa05d84);if(_0x135819[_0x46f3(0x1cc)](_0x2278b7[_0x46f3(0x51)],0x191)){console[_0x46f3(0x4f)](_0x135819['xvEqf']),await _0x135819[_0x46f3(0x1cd)](clearJWT);throw new Error(_0x135819[_0x46f3(0x1ce)]);}if(_0x135819[_0x46f3(0x1cc)](_0x2278b7[_0x46f3(0x51)],0x193)){if(_0x135819[_0x46f3(0x1cc)](_0x135819[_0x46f3(0x1cf)],_0x135819[_0x46f3(0x1d0)]))throw new _0x496715(_0x46f3(0xe3));else{console[_0x46f3(0x4f)](_0x135819[_0x46f3(0x1d1)]);throw new Error(_0x135819[_0x46f3(0x1d2)]);}}return _0x2278b7;}catch(_0x5edc37){_0x135819[_0x46f3(0x1cb)](clearTimeout,_0xea8b8b);if(_0x135819[_0x46f3(0x1cc)](_0x5edc37[_0x46f3(0xf9)],_0x135819[_0x46f3(0x1d3)])){if(_0x135819[_0x46f3(0x1cc)](_0x46f3(0x1d4),_0x135819[_0x46f3(0x1d5)]))_0x2129c4[_0x46f3(0x39)](_0x46f3(0x128)+_0x5f3964+_0x46f3(0x1d6));else{console[_0x46f3(0x4f)](_0x135819[_0x46f3(0x1d7)],_0xa05d84);throw new Error(_0x135819[_0x46f3(0x1d8)]);}}throw _0x5edc37;}};exports['makeUserRequest']=makeUserRequest;const clearValidationCache=()=>{const _0x596fdb={'GyNXA':function(_0x4dd11e,_0x3a118a){return _0x4dd11e!==_0x3a118a;},'CTOxw':function(_0x1f3409,_0x375324){return _0x1f3409!==_0x375324;},'XpauK':'🗑️\x20API\x20key\x20validation\x20cache\x20cleared'};var _0x4fcb2a;validationCache[_0x46f3(0x1d9)](),_0x596fdb[_0x46f3(0x1da)](_0x4fcb2a=globalConfig,null)&&_0x596fdb[_0x46f3(0x1db)](_0x4fcb2a,void 0x0)&&_0x4fcb2a['enableLogging']&&console[_0x46f3(0x39)](_0x596fdb[_0x46f3(0x1dc)]);};exports[_0x46f3(0x1dd)]=clearValidationCache;const resetApiKeyService=()=>{const _0x539f01={'NfevY':function(_0x454540){return _0x454540();},'DKrdr':_0x46f3(0x1de)};globalConfig=null,isInitialized=![],_0x539f01[_0x46f3(0x1df)](clearValidationCache),console['log'](_0x539f01['DKrdr']);};exports[_0x46f3(0x1e0)]=resetApiKeyService;
|