@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,919 +1 @@
|
|
|
1
|
-
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
2
|
-
import NetInfo from '@react-native-community/netinfo';
|
|
3
|
-
|
|
4
|
-
// Admin key for backend validation
|
|
5
|
-
export const ADMIN_API_KEY = 'OnairosIsAUnicorn2025';
|
|
6
|
-
|
|
7
|
-
// API key types
|
|
8
|
-
export let ApiKeyType = /*#__PURE__*/function (ApiKeyType) {
|
|
9
|
-
ApiKeyType["DEVELOPER"] = "developer";
|
|
10
|
-
ApiKeyType["ADMIN"] = "admin";
|
|
11
|
-
ApiKeyType["INVALID"] = "invalid";
|
|
12
|
-
return ApiKeyType;
|
|
13
|
-
}({});
|
|
14
|
-
|
|
15
|
-
// JWT token storage key
|
|
16
|
-
const JWT_TOKEN_KEY = 'onairos_jwt_token';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Two-Tier Authentication Service for Onairos React Native SDK
|
|
20
|
-
*
|
|
21
|
-
* This service implements the two-tier authentication system:
|
|
22
|
-
* 1. Developer API Keys: For app-level operations (email verification, app registration)
|
|
23
|
-
* 2. JWT User Tokens: For user-level operations (PIN storage, user profile)
|
|
24
|
-
*
|
|
25
|
-
* How it works:
|
|
26
|
-
* 1. Initialize with developer API key
|
|
27
|
-
* 2. Use API key for email verification requests
|
|
28
|
-
* 3. Store JWT token from email verification response
|
|
29
|
-
* 4. Use JWT token for user-authenticated requests
|
|
30
|
-
* 5. Handle token expiration gracefully
|
|
31
|
-
*
|
|
32
|
-
* Backend Integration:
|
|
33
|
-
* - Developer routes: Authorization: Bearer ${API_KEY}
|
|
34
|
-
* - User routes: Authorization: Bearer ${JWT_TOKEN}
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
// Global configuration state
|
|
38
|
-
let globalConfig = null;
|
|
39
|
-
let validationCache = new Map();
|
|
40
|
-
let isInitialized = false;
|
|
41
|
-
let userToken = null;
|
|
42
|
-
|
|
43
|
-
// Cache duration (5 minutes)
|
|
44
|
-
const CACHE_DURATION = 5 * 60 * 1000;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Check network connectivity
|
|
48
|
-
* @returns Promise<boolean> - true if connected, false otherwise
|
|
49
|
-
*/
|
|
50
|
-
const checkNetworkConnectivity = async () => {
|
|
51
|
-
try {
|
|
52
|
-
const netInfo = await NetInfo.fetch();
|
|
53
|
-
return netInfo.isConnected === true && netInfo.isInternetReachable !== false;
|
|
54
|
-
} catch (error) {
|
|
55
|
-
console.warn('⚠️ Failed to check network connectivity:', error);
|
|
56
|
-
// If we can't check connectivity, assume we're connected and let the request fail naturally
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
// API endpoints for different environments (updated to handle non-existent dev endpoint)
|
|
62
|
-
const API_ENDPOINTS = {
|
|
63
|
-
production: 'https://api2.onairos.uk',
|
|
64
|
-
staging: 'https://api2.onairos.uk',
|
|
65
|
-
// Fallback to production for staging
|
|
66
|
-
development: 'https://api2.onairos.uk' // Fallback to production since dev-api2.onairos.uk doesn't exist
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Initialize the SDK with developer API key
|
|
71
|
-
* @param config API configuration including developer API key
|
|
72
|
-
*/
|
|
73
|
-
export const initializeApiKey = async config => {
|
|
74
|
-
try {
|
|
75
|
-
console.log('🔑 Initializing Onairos SDK with developer API key...');
|
|
76
|
-
if (!config.apiKey) {
|
|
77
|
-
throw new Error('Developer API key is required for SDK initialization');
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Check if it's admin key first (admin key is shorter than 32 chars)
|
|
81
|
-
if (!isAdminKey(config.apiKey) && config.apiKey.length < 32) {
|
|
82
|
-
throw new Error('Invalid API key format. Developer keys must be at least 32 characters long.');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Set global configuration
|
|
86
|
-
globalConfig = {
|
|
87
|
-
apiKey: config.apiKey,
|
|
88
|
-
environment: config.environment || 'production',
|
|
89
|
-
enableLogging: config.enableLogging !== false,
|
|
90
|
-
// Default to true
|
|
91
|
-
timeout: config.timeout || 30000,
|
|
92
|
-
retryAttempts: config.retryAttempts || 3
|
|
93
|
-
};
|
|
94
|
-
if (globalConfig.enableLogging) {
|
|
95
|
-
console.log('📝 SDK Configuration:', {
|
|
96
|
-
environment: globalConfig.environment,
|
|
97
|
-
timeout: globalConfig.timeout,
|
|
98
|
-
retryAttempts: globalConfig.retryAttempts,
|
|
99
|
-
apiKeyPrefix: config.apiKey.substring(0, 8) + '...',
|
|
100
|
-
enableLogging: globalConfig.enableLogging
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Validate the API key (handles both admin and developer keys)
|
|
105
|
-
const validation = await validateApiKey(config.apiKey);
|
|
106
|
-
if (!validation.isValid) {
|
|
107
|
-
// Use defensive coding to handle cases where validation.error might be undefined
|
|
108
|
-
const errorMessage = validation.error || '';
|
|
109
|
-
|
|
110
|
-
// Check if it's a network/connectivity issue (either from error message or the flag)
|
|
111
|
-
const isNetworkError = validation.isNetworkError || errorMessage.includes('Network request failed') || errorMessage.includes('Network error') || errorMessage.includes('JSON Parse error') || errorMessage.includes('API validation endpoint returned') || errorMessage.includes('timeout') || errorMessage.includes('ENOTFOUND') || errorMessage.includes('fetch') || errorMessage.includes('No network connection');
|
|
112
|
-
if (isNetworkError) {
|
|
113
|
-
console.warn('⚠️ API key validation failed due to network/connectivity issues');
|
|
114
|
-
console.warn('🔄 Continuing in offline mode with basic validation');
|
|
115
|
-
console.warn('📝 SDK will function with limited validation. Network connectivity will be retried automatically.');
|
|
116
|
-
console.warn('🌐 Error details:', validation.error);
|
|
117
|
-
|
|
118
|
-
// Continue initialization in offline mode - don't throw error
|
|
119
|
-
console.log('📱 SDK initialized in offline mode - will retry validation when network is available');
|
|
120
|
-
} else {
|
|
121
|
-
// Only throw for actual API key validation errors (not network issues)
|
|
122
|
-
throw new Error(`API key validation failed: ${validation.error}`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Try to load existing JWT token
|
|
127
|
-
await loadJWT();
|
|
128
|
-
isInitialized = true;
|
|
129
|
-
if (globalConfig.enableLogging) {
|
|
130
|
-
console.log('✅ Onairos SDK initialized successfully');
|
|
131
|
-
if (isAdminKey(config.apiKey)) {
|
|
132
|
-
console.log('🔑 Admin API key ready with full permissions');
|
|
133
|
-
} else {
|
|
134
|
-
console.log('🔑 Developer API key ready for app-level operations');
|
|
135
|
-
}
|
|
136
|
-
if (userToken) {
|
|
137
|
-
console.log('🎫 User JWT token loaded from storage');
|
|
138
|
-
}
|
|
139
|
-
if (validation.permissions) {
|
|
140
|
-
console.log('🔐 API Key Permissions:', validation.permissions);
|
|
141
|
-
}
|
|
142
|
-
if (validation.rateLimits) {
|
|
143
|
-
console.log('⏱️ Rate Limits:', validation.rateLimits);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
} catch (error) {
|
|
147
|
-
console.error('❌ Failed to initialize Onairos SDK:', error);
|
|
148
|
-
isInitialized = false;
|
|
149
|
-
throw error;
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Determine API key type
|
|
155
|
-
* @param apiKey The API key to check
|
|
156
|
-
* @returns The type of API key
|
|
157
|
-
*/
|
|
158
|
-
export const getApiKeyType = apiKey => {
|
|
159
|
-
if (apiKey === ADMIN_API_KEY) {
|
|
160
|
-
return ApiKeyType.ADMIN;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Developer keys should be at least 32 characters and start with specific prefix
|
|
164
|
-
if (apiKey.length >= 32 && (apiKey.startsWith('dev_') || apiKey.startsWith('pk_') || apiKey.startsWith('ona_'))) {
|
|
165
|
-
return ApiKeyType.DEVELOPER;
|
|
166
|
-
}
|
|
167
|
-
return ApiKeyType.INVALID;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Check if API key is admin key
|
|
172
|
-
* @param apiKey The API key to check
|
|
173
|
-
* @returns True if admin key
|
|
174
|
-
*/
|
|
175
|
-
export const isAdminKey = apiKey => {
|
|
176
|
-
return apiKey === ADMIN_API_KEY;
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Validate an API key with the Onairos backend
|
|
181
|
-
* @param apiKey The API key to validate
|
|
182
|
-
* @returns Validation result with permissions and rate limits
|
|
183
|
-
*/
|
|
184
|
-
export const validateApiKey = async apiKey => {
|
|
185
|
-
try {
|
|
186
|
-
var _globalConfig2, _globalConfig3, _globalConfig4;
|
|
187
|
-
console.log('🔍 Validating API key...');
|
|
188
|
-
|
|
189
|
-
// Check if it's an admin key
|
|
190
|
-
if (isAdminKey(apiKey)) {
|
|
191
|
-
console.log('🔑 Admin key detected - granting full permissions');
|
|
192
|
-
return {
|
|
193
|
-
isValid: true,
|
|
194
|
-
permissions: ['*'],
|
|
195
|
-
// Full permissions for admin
|
|
196
|
-
rateLimits: {
|
|
197
|
-
remaining: 999999,
|
|
198
|
-
resetTime: Date.now() + 24 * 60 * 60 * 1000 // 24 hours
|
|
199
|
-
},
|
|
200
|
-
keyType: ApiKeyType.ADMIN
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Check basic format for developer keys
|
|
205
|
-
const keyType = getApiKeyType(apiKey);
|
|
206
|
-
if (keyType === ApiKeyType.INVALID) {
|
|
207
|
-
return {
|
|
208
|
-
isValid: false,
|
|
209
|
-
error: 'Invalid API key format. Developer keys must be at least 32 characters and start with "dev_", "pk_", or "ona_"',
|
|
210
|
-
keyType: ApiKeyType.INVALID
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// Check cache first
|
|
215
|
-
const cached = validationCache.get(apiKey);
|
|
216
|
-
if (cached && Date.now() - cached.timestamp < CACHE_DURATION) {
|
|
217
|
-
var _globalConfig;
|
|
218
|
-
if ((_globalConfig = globalConfig) !== null && _globalConfig !== void 0 && _globalConfig.enableLogging) {
|
|
219
|
-
console.log('📋 Using cached API key validation result');
|
|
220
|
-
}
|
|
221
|
-
return cached.result;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Check network connectivity before making API calls
|
|
225
|
-
const isConnected = await checkNetworkConnectivity();
|
|
226
|
-
if (!isConnected) {
|
|
227
|
-
console.warn('⚠️ No network connectivity detected');
|
|
228
|
-
return {
|
|
229
|
-
isValid: false,
|
|
230
|
-
error: 'No network connection available. Please check your internet connection and try again.',
|
|
231
|
-
keyType: keyType,
|
|
232
|
-
isNetworkError: true
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
const environment = ((_globalConfig2 = globalConfig) === null || _globalConfig2 === void 0 ? void 0 : _globalConfig2.environment) || 'production';
|
|
236
|
-
const baseUrl = API_ENDPOINTS[environment];
|
|
237
|
-
const timeout = ((_globalConfig3 = globalConfig) === null || _globalConfig3 === void 0 ? void 0 : _globalConfig3.timeout) || 30000;
|
|
238
|
-
const maxRetries = ((_globalConfig4 = globalConfig) === null || _globalConfig4 === void 0 ? void 0 : _globalConfig4.retryAttempts) || 3;
|
|
239
|
-
|
|
240
|
-
// Retry logic for network failures
|
|
241
|
-
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
242
|
-
// Create abort controller for timeout
|
|
243
|
-
const controller = new AbortController();
|
|
244
|
-
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
245
|
-
try {
|
|
246
|
-
var _globalConfig5;
|
|
247
|
-
if ((_globalConfig5 = globalConfig) !== null && _globalConfig5 !== void 0 && _globalConfig5.enableLogging && attempt > 1) {
|
|
248
|
-
console.log(`🔄 Retry attempt ${attempt}/${maxRetries} for API key validation`);
|
|
249
|
-
}
|
|
250
|
-
const response = await fetch(`${baseUrl}/dev/validate`, {
|
|
251
|
-
method: 'POST',
|
|
252
|
-
headers: {
|
|
253
|
-
'Content-Type': 'application/json',
|
|
254
|
-
'Authorization': `Bearer ${apiKey}`,
|
|
255
|
-
'User-Agent': 'OnairosReactNative/3.3.1',
|
|
256
|
-
'X-API-Key-Type': keyType,
|
|
257
|
-
'X-SDK-Platform': 'react-native',
|
|
258
|
-
'X-Retry-Attempt': attempt.toString()
|
|
259
|
-
},
|
|
260
|
-
body: JSON.stringify({
|
|
261
|
-
environment,
|
|
262
|
-
sdk_version: '3.3.1',
|
|
263
|
-
platform: 'react-native',
|
|
264
|
-
keyType,
|
|
265
|
-
timestamp: new Date().toISOString(),
|
|
266
|
-
attempt
|
|
267
|
-
}),
|
|
268
|
-
signal: controller.signal
|
|
269
|
-
});
|
|
270
|
-
clearTimeout(timeoutId);
|
|
271
|
-
|
|
272
|
-
// First check if we got a valid response
|
|
273
|
-
if (!response) {
|
|
274
|
-
throw new Error('No response received from server');
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// Handle common HTTP errors that indicate server issues
|
|
278
|
-
if (response.status === 502) {
|
|
279
|
-
throw new Error('Onairos API is temporarily unavailable (502 Bad Gateway). Please try again later.');
|
|
280
|
-
}
|
|
281
|
-
if (response.status === 503) {
|
|
282
|
-
throw new Error('Onairos API is under maintenance (503 Service Unavailable). Please try again later.');
|
|
283
|
-
}
|
|
284
|
-
if (response.status === 504) {
|
|
285
|
-
throw new Error('Onairos API request timed out (504 Gateway Timeout). Please try again.');
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// Check if response is actually JSON before trying to parse
|
|
289
|
-
const contentType = response.headers.get('content-type');
|
|
290
|
-
const isJsonResponse = contentType && contentType.includes('application/json');
|
|
291
|
-
if (!isJsonResponse) {
|
|
292
|
-
const textContent = await response.text();
|
|
293
|
-
const previewText = textContent.substring(0, 200);
|
|
294
|
-
console.error('❌ API endpoint returned non-JSON response:', {
|
|
295
|
-
status: response.status,
|
|
296
|
-
statusText: response.statusText,
|
|
297
|
-
contentType: contentType || 'unknown',
|
|
298
|
-
preview: previewText,
|
|
299
|
-
url: `${baseUrl}/dev/validate`,
|
|
300
|
-
attempt: attempt
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
// Handle specific error cases
|
|
304
|
-
if (response.status === 404) {
|
|
305
|
-
throw new Error(`API validation endpoint not found (404). The endpoint ${baseUrl}/dev/validate may not exist or be configured correctly.`);
|
|
306
|
-
} else if (response.status === 500) {
|
|
307
|
-
throw new Error(`Server error (500). The Onairos backend is experiencing issues.`);
|
|
308
|
-
} else if (response.status === 502 || response.status === 503) {
|
|
309
|
-
throw new Error(`Service unavailable (${response.status}). The Onairos backend may be temporarily down.`);
|
|
310
|
-
} else if (textContent.includes('<html') || textContent.includes('<!DOCTYPE')) {
|
|
311
|
-
throw new Error(`Server returned HTML page instead of JSON API response. This often indicates a routing issue or server misconfiguration.`);
|
|
312
|
-
} else {
|
|
313
|
-
throw new Error(`API validation endpoint returned ${response.status} - ${response.statusText}. Expected JSON but got ${contentType || 'unknown content type'}.`);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
// Parse JSON response
|
|
318
|
-
let data;
|
|
319
|
-
try {
|
|
320
|
-
data = await response.json();
|
|
321
|
-
} catch (jsonError) {
|
|
322
|
-
console.error('❌ Failed to parse JSON response:', {
|
|
323
|
-
error: jsonError.message,
|
|
324
|
-
status: response.status,
|
|
325
|
-
contentType,
|
|
326
|
-
attempt: attempt
|
|
327
|
-
});
|
|
328
|
-
throw new Error(`Failed to parse server response as JSON: ${jsonError.message}`);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
// Handle successful response
|
|
332
|
-
if (response.ok && data.success) {
|
|
333
|
-
var _globalConfig6;
|
|
334
|
-
const result = {
|
|
335
|
-
isValid: true,
|
|
336
|
-
permissions: data.permissions || [],
|
|
337
|
-
rateLimits: data.rateLimits || null,
|
|
338
|
-
keyType: keyType
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
// Cache the successful result
|
|
342
|
-
validationCache.set(apiKey, {
|
|
343
|
-
result,
|
|
344
|
-
timestamp: Date.now()
|
|
345
|
-
});
|
|
346
|
-
if ((_globalConfig6 = globalConfig) !== null && _globalConfig6 !== void 0 && _globalConfig6.enableLogging) {
|
|
347
|
-
console.log('✅ API key validation successful');
|
|
348
|
-
}
|
|
349
|
-
return result;
|
|
350
|
-
} else {
|
|
351
|
-
// Handle API errors (invalid key, etc.)
|
|
352
|
-
const errorMessage = data.error || data.message || `HTTP ${response.status}: ${response.statusText}`;
|
|
353
|
-
const result = {
|
|
354
|
-
isValid: false,
|
|
355
|
-
error: errorMessage,
|
|
356
|
-
keyType: keyType
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
// For client errors (4xx), don't retry
|
|
360
|
-
if (response.status >= 400 && response.status < 500) {
|
|
361
|
-
var _globalConfig7;
|
|
362
|
-
if ((_globalConfig7 = globalConfig) !== null && _globalConfig7 !== void 0 && _globalConfig7.enableLogging) {
|
|
363
|
-
console.error('❌ API key validation failed (client error):', errorMessage);
|
|
364
|
-
}
|
|
365
|
-
return result;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
// For server errors (5xx), retry
|
|
369
|
-
throw new Error(errorMessage);
|
|
370
|
-
}
|
|
371
|
-
} catch (fetchError) {
|
|
372
|
-
var _globalConfig8;
|
|
373
|
-
clearTimeout(timeoutId);
|
|
374
|
-
if (fetchError.name === 'AbortError') {
|
|
375
|
-
const errorMessage = `API key validation timeout (${timeout}ms)`;
|
|
376
|
-
console.error('⏱️ API key validation timeout');
|
|
377
|
-
if (attempt === maxRetries) {
|
|
378
|
-
return {
|
|
379
|
-
isValid: false,
|
|
380
|
-
error: errorMessage,
|
|
381
|
-
keyType: keyType
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
continue; // Retry timeout errors
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
// Enhanced error message based on error type
|
|
388
|
-
let errorMessage = `Network error during API key validation: ${fetchError.message}`;
|
|
389
|
-
|
|
390
|
-
// Add specific guidance for common errors
|
|
391
|
-
if (fetchError.message.includes('JSON Parse error') || fetchError.message.includes('Unexpected character')) {
|
|
392
|
-
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}`;
|
|
393
|
-
} else if (fetchError.message.includes('Network request failed') || fetchError.message.includes('fetch')) {
|
|
394
|
-
errorMessage = `Network connectivity issue. Please check internet connection and verify the Onairos API is accessible. ${fetchError.message}`;
|
|
395
|
-
} else if (fetchError.message.includes('DNS') || fetchError.message.includes('ENOTFOUND')) {
|
|
396
|
-
errorMessage = `DNS resolution failed for ${baseUrl}. Please check network settings and domain accessibility. ${fetchError.message}`;
|
|
397
|
-
}
|
|
398
|
-
console.error('🌐 Network error during API key validation:', {
|
|
399
|
-
error: fetchError,
|
|
400
|
-
endpoint: `${baseUrl}/dev/validate`,
|
|
401
|
-
attempt: attempt,
|
|
402
|
-
maxRetries: maxRetries,
|
|
403
|
-
retryable: attempt < maxRetries
|
|
404
|
-
});
|
|
405
|
-
|
|
406
|
-
// If this is the last attempt, return the error
|
|
407
|
-
if (attempt === maxRetries) {
|
|
408
|
-
return {
|
|
409
|
-
isValid: false,
|
|
410
|
-
error: errorMessage,
|
|
411
|
-
keyType: keyType,
|
|
412
|
-
isNetworkError: true // Flag to indicate this is a network issue, not an API key issue
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
// Wait before retrying (exponential backoff)
|
|
417
|
-
const backoffDelay = Math.min(1000 * Math.pow(2, attempt - 1), 5000);
|
|
418
|
-
if ((_globalConfig8 = globalConfig) !== null && _globalConfig8 !== void 0 && _globalConfig8.enableLogging) {
|
|
419
|
-
console.log(`⏳ Waiting ${backoffDelay}ms before retry...`);
|
|
420
|
-
}
|
|
421
|
-
await new Promise(resolve => setTimeout(() => resolve(), backoffDelay));
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
// This should never be reached, but just in case
|
|
426
|
-
return {
|
|
427
|
-
isValid: false,
|
|
428
|
-
error: 'All retry attempts exhausted',
|
|
429
|
-
keyType: keyType
|
|
430
|
-
};
|
|
431
|
-
} catch (error) {
|
|
432
|
-
const errorMessage = `API key validation error: ${error.message}`;
|
|
433
|
-
console.error('❌ API key validation error:', error);
|
|
434
|
-
return {
|
|
435
|
-
isValid: false,
|
|
436
|
-
error: errorMessage,
|
|
437
|
-
keyType: ApiKeyType.INVALID
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
};
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Get the current API configuration
|
|
444
|
-
* @returns Current API configuration or null if not initialized
|
|
445
|
-
*/
|
|
446
|
-
export const getApiConfig = () => {
|
|
447
|
-
return globalConfig;
|
|
448
|
-
};
|
|
449
|
-
|
|
450
|
-
/**
|
|
451
|
-
* Get the current API key
|
|
452
|
-
* @returns Current API key or null if not initialized
|
|
453
|
-
*/
|
|
454
|
-
export const getApiKey = () => {
|
|
455
|
-
var _globalConfig9;
|
|
456
|
-
return ((_globalConfig9 = globalConfig) === null || _globalConfig9 === void 0 ? void 0 : _globalConfig9.apiKey) || null;
|
|
457
|
-
};
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* Check if the SDK is properly initialized
|
|
461
|
-
* @returns True if initialized with valid API key
|
|
462
|
-
*/
|
|
463
|
-
export const isApiKeyInitialized = () => {
|
|
464
|
-
return isInitialized && globalConfig !== null;
|
|
465
|
-
};
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
* Store JWT token securely after email verification
|
|
469
|
-
* @param token JWT token from email verification response
|
|
470
|
-
*/
|
|
471
|
-
export const storeJWT = async token => {
|
|
472
|
-
try {
|
|
473
|
-
var _globalConfig0;
|
|
474
|
-
await AsyncStorage.setItem(JWT_TOKEN_KEY, token);
|
|
475
|
-
userToken = token;
|
|
476
|
-
if ((_globalConfig0 = globalConfig) !== null && _globalConfig0 !== void 0 && _globalConfig0.enableLogging) {
|
|
477
|
-
console.log('🎫 JWT token stored successfully');
|
|
478
|
-
}
|
|
479
|
-
} catch (error) {
|
|
480
|
-
console.error('❌ Failed to store JWT token:', error);
|
|
481
|
-
throw error;
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* Load JWT token from storage
|
|
487
|
-
* @returns JWT token or null if not found
|
|
488
|
-
*/
|
|
489
|
-
export const loadJWT = async () => {
|
|
490
|
-
try {
|
|
491
|
-
const token = await AsyncStorage.getItem(JWT_TOKEN_KEY);
|
|
492
|
-
userToken = token;
|
|
493
|
-
return token;
|
|
494
|
-
} catch (error) {
|
|
495
|
-
console.error('❌ Failed to load JWT token:', error);
|
|
496
|
-
return null;
|
|
497
|
-
}
|
|
498
|
-
};
|
|
499
|
-
|
|
500
|
-
/**
|
|
501
|
-
* Get current JWT token
|
|
502
|
-
* @returns JWT token or null if not available
|
|
503
|
-
*/
|
|
504
|
-
export const getJWT = () => {
|
|
505
|
-
return userToken;
|
|
506
|
-
};
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* Clear JWT token (on logout or token expiration)
|
|
510
|
-
*/
|
|
511
|
-
export const clearJWT = async () => {
|
|
512
|
-
try {
|
|
513
|
-
var _globalConfig1;
|
|
514
|
-
await AsyncStorage.removeItem(JWT_TOKEN_KEY);
|
|
515
|
-
userToken = null;
|
|
516
|
-
if ((_globalConfig1 = globalConfig) !== null && _globalConfig1 !== void 0 && _globalConfig1.enableLogging) {
|
|
517
|
-
console.log('🗑️ JWT token cleared');
|
|
518
|
-
}
|
|
519
|
-
} catch (error) {
|
|
520
|
-
console.error('❌ Failed to clear JWT token:', error);
|
|
521
|
-
}
|
|
522
|
-
};
|
|
523
|
-
|
|
524
|
-
/**
|
|
525
|
-
* React Native compatible base64 decoder
|
|
526
|
-
* @param str Base64 encoded string
|
|
527
|
-
* @returns Decoded string
|
|
528
|
-
*/
|
|
529
|
-
const base64Decode = str => {
|
|
530
|
-
// Simple base64 decoding for React Native
|
|
531
|
-
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
532
|
-
let result = '';
|
|
533
|
-
let i = 0;
|
|
534
|
-
str = str.replace(/[^A-Za-z0-9+/]/g, '');
|
|
535
|
-
while (i < str.length) {
|
|
536
|
-
const a = chars.indexOf(str.charAt(i++));
|
|
537
|
-
const b = chars.indexOf(str.charAt(i++));
|
|
538
|
-
const c = chars.indexOf(str.charAt(i++));
|
|
539
|
-
const d = chars.indexOf(str.charAt(i++));
|
|
540
|
-
const bitmap = a << 18 | b << 12 | c << 6 | d;
|
|
541
|
-
result += String.fromCharCode(bitmap >> 16 & 255);
|
|
542
|
-
if (c !== 64) result += String.fromCharCode(bitmap >> 8 & 255);
|
|
543
|
-
if (d !== 64) result += String.fromCharCode(bitmap & 255);
|
|
544
|
-
}
|
|
545
|
-
return result;
|
|
546
|
-
};
|
|
547
|
-
|
|
548
|
-
/**
|
|
549
|
-
* Decode JWT token payload (React Native compatible)
|
|
550
|
-
* @param token JWT token string
|
|
551
|
-
* @returns Decoded payload or null if invalid
|
|
552
|
-
*/
|
|
553
|
-
export const decodeJWTPayload = token => {
|
|
554
|
-
try {
|
|
555
|
-
// Split JWT token (header.payload.signature)
|
|
556
|
-
const parts = token.split('.');
|
|
557
|
-
if (parts.length !== 3) {
|
|
558
|
-
console.error('❌ Invalid JWT token format');
|
|
559
|
-
return null;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
// Decode payload (base64url to base64)
|
|
563
|
-
const payload = parts[1];
|
|
564
|
-
const base64 = payload.replace(/-/g, '+').replace(/_/g, '/');
|
|
565
|
-
|
|
566
|
-
// Add padding if needed
|
|
567
|
-
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, '=');
|
|
568
|
-
|
|
569
|
-
// Decode base64 to JSON using React Native compatible decoder
|
|
570
|
-
const decoded = base64Decode(padded);
|
|
571
|
-
return JSON.parse(decoded);
|
|
572
|
-
} catch (error) {
|
|
573
|
-
console.error('❌ Failed to decode JWT token:', error);
|
|
574
|
-
return null;
|
|
575
|
-
}
|
|
576
|
-
};
|
|
577
|
-
|
|
578
|
-
/**
|
|
579
|
-
* Extract username from JWT token
|
|
580
|
-
* @param token JWT token (optional, uses stored token if not provided)
|
|
581
|
-
* @returns Username or null if not found
|
|
582
|
-
*/
|
|
583
|
-
export const extractUsernameFromJWT = token => {
|
|
584
|
-
try {
|
|
585
|
-
var _globalConfig10;
|
|
586
|
-
const jwtToken = token || userToken;
|
|
587
|
-
if (!jwtToken) {
|
|
588
|
-
console.warn('⚠️ No JWT token available for username extraction');
|
|
589
|
-
return null;
|
|
590
|
-
}
|
|
591
|
-
const payload = decodeJWTPayload(jwtToken);
|
|
592
|
-
if (!payload) {
|
|
593
|
-
return null;
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
// Try different possible username fields in order of preference
|
|
597
|
-
const username = payload.userName || payload.username || payload.userId || payload.email;
|
|
598
|
-
if ((_globalConfig10 = globalConfig) !== null && _globalConfig10 !== void 0 && _globalConfig10.enableLogging) {
|
|
599
|
-
console.log('👤 Extracted username from JWT:', username);
|
|
600
|
-
}
|
|
601
|
-
return username || null;
|
|
602
|
-
} catch (error) {
|
|
603
|
-
console.error('❌ Failed to extract username from JWT:', error);
|
|
604
|
-
return null;
|
|
605
|
-
}
|
|
606
|
-
};
|
|
607
|
-
|
|
608
|
-
/**
|
|
609
|
-
* Extract user data from JWT token
|
|
610
|
-
* @param token JWT token (optional, uses stored token if not provided)
|
|
611
|
-
* @returns User data object or null if not found
|
|
612
|
-
*/
|
|
613
|
-
export const extractUserDataFromJWT = token => {
|
|
614
|
-
try {
|
|
615
|
-
var _globalConfig11;
|
|
616
|
-
const jwtToken = token || userToken;
|
|
617
|
-
if (!jwtToken) {
|
|
618
|
-
console.warn('⚠️ No JWT token available for user data extraction');
|
|
619
|
-
return null;
|
|
620
|
-
}
|
|
621
|
-
const payload = decodeJWTPayload(jwtToken);
|
|
622
|
-
if (!payload) {
|
|
623
|
-
return null;
|
|
624
|
-
}
|
|
625
|
-
const userData = {
|
|
626
|
-
id: payload.id,
|
|
627
|
-
email: payload.email,
|
|
628
|
-
userId: payload.userId,
|
|
629
|
-
userName: payload.userName || payload.username,
|
|
630
|
-
verified: payload.verified,
|
|
631
|
-
iat: payload.iat,
|
|
632
|
-
exp: payload.exp
|
|
633
|
-
};
|
|
634
|
-
if ((_globalConfig11 = globalConfig) !== null && _globalConfig11 !== void 0 && _globalConfig11.enableLogging) {
|
|
635
|
-
console.log('👤 Extracted user data from JWT:', userData);
|
|
636
|
-
}
|
|
637
|
-
return userData;
|
|
638
|
-
} catch (error) {
|
|
639
|
-
console.error('❌ Failed to extract user data from JWT:', error);
|
|
640
|
-
return null;
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* Check if user is authenticated with JWT token
|
|
646
|
-
* @returns True if user has valid JWT token
|
|
647
|
-
*/
|
|
648
|
-
export const isUserAuthenticated = () => {
|
|
649
|
-
return !!userToken;
|
|
650
|
-
};
|
|
651
|
-
|
|
652
|
-
/**
|
|
653
|
-
* Get authenticated headers for API requests
|
|
654
|
-
* @returns Headers object with Authorization and other required headers
|
|
655
|
-
*/
|
|
656
|
-
export const getAuthHeaders = () => {
|
|
657
|
-
var _globalConfig12;
|
|
658
|
-
if (!((_globalConfig12 = globalConfig) !== null && _globalConfig12 !== void 0 && _globalConfig12.apiKey)) {
|
|
659
|
-
throw new Error('SDK not initialized. Call initializeApiKey() first.');
|
|
660
|
-
}
|
|
661
|
-
const keyType = getApiKeyType(globalConfig.apiKey);
|
|
662
|
-
return {
|
|
663
|
-
'Content-Type': 'application/json',
|
|
664
|
-
'Authorization': `Bearer ${globalConfig.apiKey}`,
|
|
665
|
-
'User-Agent': 'OnairosReactNative/3.0.72',
|
|
666
|
-
'X-SDK-Version': '3.0.72',
|
|
667
|
-
'X-SDK-Environment': globalConfig.environment || 'production',
|
|
668
|
-
'X-API-Key-Type': keyType,
|
|
669
|
-
'X-Timestamp': new Date().toISOString()
|
|
670
|
-
};
|
|
671
|
-
};
|
|
672
|
-
|
|
673
|
-
/**
|
|
674
|
-
* Get authentication headers for developer API requests
|
|
675
|
-
* @returns Headers with developer API key
|
|
676
|
-
*/
|
|
677
|
-
export const getDeveloperAuthHeaders = () => {
|
|
678
|
-
var _globalConfig13;
|
|
679
|
-
if (!((_globalConfig13 = globalConfig) !== null && _globalConfig13 !== void 0 && _globalConfig13.apiKey)) {
|
|
680
|
-
throw new Error('SDK not initialized. Call initializeApiKey() first.');
|
|
681
|
-
}
|
|
682
|
-
const keyType = getApiKeyType(globalConfig.apiKey);
|
|
683
|
-
return {
|
|
684
|
-
'Content-Type': 'application/json',
|
|
685
|
-
'Authorization': `Bearer ${globalConfig.apiKey}`,
|
|
686
|
-
'User-Agent': 'OnairosSDK/1.0.0',
|
|
687
|
-
'X-SDK-Version': '3.0.72',
|
|
688
|
-
'X-SDK-Environment': globalConfig.environment || 'production',
|
|
689
|
-
'X-API-Key-Type': keyType,
|
|
690
|
-
'X-Timestamp': new Date().toISOString()
|
|
691
|
-
};
|
|
692
|
-
};
|
|
693
|
-
|
|
694
|
-
/**
|
|
695
|
-
* Get authentication headers for user JWT requests
|
|
696
|
-
* @returns Headers with user JWT token
|
|
697
|
-
*/
|
|
698
|
-
export const getUserAuthHeaders = () => {
|
|
699
|
-
var _globalConfig14;
|
|
700
|
-
if (!userToken) {
|
|
701
|
-
throw new Error('User not authenticated. Please verify email first.');
|
|
702
|
-
}
|
|
703
|
-
return {
|
|
704
|
-
'Content-Type': 'application/json',
|
|
705
|
-
'Authorization': `Bearer ${userToken}`,
|
|
706
|
-
'User-Agent': 'OnairosSDK/1.0.0',
|
|
707
|
-
'X-SDK-Version': '3.0.72',
|
|
708
|
-
'X-SDK-Environment': ((_globalConfig14 = globalConfig) === null || _globalConfig14 === void 0 ? void 0 : _globalConfig14.environment) || 'production'
|
|
709
|
-
};
|
|
710
|
-
};
|
|
711
|
-
|
|
712
|
-
/**
|
|
713
|
-
* Make an authenticated API request
|
|
714
|
-
* @param endpoint The API endpoint (relative to base URL)
|
|
715
|
-
* @param options Fetch options
|
|
716
|
-
* @returns Response promise
|
|
717
|
-
*/
|
|
718
|
-
export const makeAuthenticatedRequest = async (endpoint, options = {}) => {
|
|
719
|
-
if (!isApiKeyInitialized()) {
|
|
720
|
-
throw new Error('SDK not initialized. Call initializeApiKey() first.');
|
|
721
|
-
}
|
|
722
|
-
const config = getApiConfig();
|
|
723
|
-
const baseUrl = API_ENDPOINTS[config.environment || 'production'];
|
|
724
|
-
const url = `${baseUrl}${endpoint.startsWith('/') ? '' : '/'}${endpoint}`;
|
|
725
|
-
|
|
726
|
-
// Merge authentication headers
|
|
727
|
-
const headers = {
|
|
728
|
-
...getAuthHeaders(),
|
|
729
|
-
...(options.headers || {})
|
|
730
|
-
};
|
|
731
|
-
|
|
732
|
-
// Add timeout
|
|
733
|
-
const controller = new AbortController();
|
|
734
|
-
const timeoutId = setTimeout(() => controller.abort(), config.timeout || 30000);
|
|
735
|
-
try {
|
|
736
|
-
if (config.enableLogging) {
|
|
737
|
-
console.log(`🌐 Making authenticated request to: ${endpoint}`);
|
|
738
|
-
}
|
|
739
|
-
const response = await fetch(url, {
|
|
740
|
-
...options,
|
|
741
|
-
headers,
|
|
742
|
-
signal: controller.signal
|
|
743
|
-
});
|
|
744
|
-
clearTimeout(timeoutId);
|
|
745
|
-
if (config.enableLogging) {
|
|
746
|
-
console.log(`📡 Response status: ${response.status} for ${endpoint}`);
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
// Handle API key errors
|
|
750
|
-
if (response.status === 401) {
|
|
751
|
-
console.error('❌ API key authentication failed. Please check your API key.');
|
|
752
|
-
throw new Error('Invalid or expired API key');
|
|
753
|
-
}
|
|
754
|
-
if (response.status === 403) {
|
|
755
|
-
console.error('❌ API key permissions insufficient for this operation.');
|
|
756
|
-
throw new Error('Insufficient API key permissions');
|
|
757
|
-
}
|
|
758
|
-
if (response.status === 429) {
|
|
759
|
-
console.error('❌ API rate limit exceeded. Please try again later.');
|
|
760
|
-
throw new Error('Rate limit exceeded');
|
|
761
|
-
}
|
|
762
|
-
return response;
|
|
763
|
-
} catch (error) {
|
|
764
|
-
clearTimeout(timeoutId);
|
|
765
|
-
if (error.name === 'AbortError') {
|
|
766
|
-
console.error('⏱️ Request timeout for:', endpoint);
|
|
767
|
-
throw new Error('Request timeout');
|
|
768
|
-
}
|
|
769
|
-
throw error;
|
|
770
|
-
}
|
|
771
|
-
};
|
|
772
|
-
|
|
773
|
-
/**
|
|
774
|
-
* Make authenticated request with developer API key
|
|
775
|
-
* @param endpoint The API endpoint
|
|
776
|
-
* @param options Fetch options
|
|
777
|
-
* @returns Response promise
|
|
778
|
-
*/
|
|
779
|
-
export const makeDeveloperRequest = async (endpoint, options = {}) => {
|
|
780
|
-
if (!isApiKeyInitialized()) {
|
|
781
|
-
throw new Error('SDK not initialized. Call initializeApiKey() first.');
|
|
782
|
-
}
|
|
783
|
-
const config = getApiConfig();
|
|
784
|
-
const baseUrl = API_ENDPOINTS[config.environment || 'production'];
|
|
785
|
-
const url = `${baseUrl}${endpoint.startsWith('/') ? '' : '/'}${endpoint}`;
|
|
786
|
-
|
|
787
|
-
// Merge developer authentication headers
|
|
788
|
-
const headers = {
|
|
789
|
-
...getDeveloperAuthHeaders(),
|
|
790
|
-
...(options.headers || {})
|
|
791
|
-
};
|
|
792
|
-
|
|
793
|
-
// Add timeout
|
|
794
|
-
const controller = new AbortController();
|
|
795
|
-
const timeoutId = setTimeout(() => controller.abort(), config.timeout || 30000);
|
|
796
|
-
try {
|
|
797
|
-
if (config.enableLogging) {
|
|
798
|
-
console.log(`🌐 Making developer request to: ${endpoint}`);
|
|
799
|
-
}
|
|
800
|
-
const response = await fetch(url, {
|
|
801
|
-
...options,
|
|
802
|
-
headers,
|
|
803
|
-
signal: controller.signal
|
|
804
|
-
});
|
|
805
|
-
clearTimeout(timeoutId);
|
|
806
|
-
if (config.enableLogging) {
|
|
807
|
-
console.log(`📡 Developer request response: ${response.status} for ${endpoint}`);
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
// Handle API key errors
|
|
811
|
-
if (response.status === 401) {
|
|
812
|
-
console.error('❌ Developer API key authentication failed');
|
|
813
|
-
throw new Error('Invalid or expired API key');
|
|
814
|
-
}
|
|
815
|
-
if (response.status === 403) {
|
|
816
|
-
console.error('❌ Developer API key permissions insufficient');
|
|
817
|
-
throw new Error('Insufficient API key permissions');
|
|
818
|
-
}
|
|
819
|
-
if (response.status === 429) {
|
|
820
|
-
console.error('❌ API rate limit exceeded');
|
|
821
|
-
throw new Error('Rate limit exceeded');
|
|
822
|
-
}
|
|
823
|
-
return response;
|
|
824
|
-
} catch (error) {
|
|
825
|
-
clearTimeout(timeoutId);
|
|
826
|
-
if (error.name === 'AbortError') {
|
|
827
|
-
console.error('⏱️ Request timeout for:', endpoint);
|
|
828
|
-
throw new Error('Request timeout');
|
|
829
|
-
}
|
|
830
|
-
throw error;
|
|
831
|
-
}
|
|
832
|
-
};
|
|
833
|
-
|
|
834
|
-
/**
|
|
835
|
-
* Make authenticated request with user JWT token
|
|
836
|
-
* @param endpoint The API endpoint
|
|
837
|
-
* @param options Fetch options
|
|
838
|
-
* @returns Response promise
|
|
839
|
-
*/
|
|
840
|
-
export const makeUserRequest = async (endpoint, options = {}) => {
|
|
841
|
-
if (!isUserAuthenticated()) {
|
|
842
|
-
await loadJWT(); // Try to load from storage
|
|
843
|
-
}
|
|
844
|
-
if (!isUserAuthenticated()) {
|
|
845
|
-
throw new Error('User not authenticated. Please verify email first.');
|
|
846
|
-
}
|
|
847
|
-
const config = getApiConfig() || {
|
|
848
|
-
environment: 'production',
|
|
849
|
-
timeout: 30000,
|
|
850
|
-
enableLogging: false
|
|
851
|
-
};
|
|
852
|
-
const baseUrl = API_ENDPOINTS[config.environment || 'production'];
|
|
853
|
-
const url = `${baseUrl}${endpoint.startsWith('/') ? '' : '/'}${endpoint}`;
|
|
854
|
-
|
|
855
|
-
// Merge user authentication headers
|
|
856
|
-
const headers = {
|
|
857
|
-
...getUserAuthHeaders(),
|
|
858
|
-
...(options.headers || {})
|
|
859
|
-
};
|
|
860
|
-
|
|
861
|
-
// Add timeout
|
|
862
|
-
const controller = new AbortController();
|
|
863
|
-
const timeoutId = setTimeout(() => controller.abort(), config.timeout || 30000);
|
|
864
|
-
try {
|
|
865
|
-
if (config.enableLogging) {
|
|
866
|
-
console.log(`🌐 Making user request to: ${endpoint}`);
|
|
867
|
-
}
|
|
868
|
-
const response = await fetch(url, {
|
|
869
|
-
...options,
|
|
870
|
-
headers,
|
|
871
|
-
signal: controller.signal
|
|
872
|
-
});
|
|
873
|
-
clearTimeout(timeoutId);
|
|
874
|
-
if (config.enableLogging) {
|
|
875
|
-
console.log(`📡 User request response: ${response.status} for ${endpoint}`);
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
// Handle JWT token errors
|
|
879
|
-
if (response.status === 401) {
|
|
880
|
-
console.error('❌ JWT token authentication failed - token may be expired');
|
|
881
|
-
await clearJWT(); // Clear expired token
|
|
882
|
-
throw new Error('Authentication expired. Please verify email again.');
|
|
883
|
-
}
|
|
884
|
-
if (response.status === 403) {
|
|
885
|
-
console.error('❌ JWT token permissions insufficient');
|
|
886
|
-
throw new Error('Insufficient permissions for this operation');
|
|
887
|
-
}
|
|
888
|
-
return response;
|
|
889
|
-
} catch (error) {
|
|
890
|
-
clearTimeout(timeoutId);
|
|
891
|
-
if (error.name === 'AbortError') {
|
|
892
|
-
console.error('⏱️ Request timeout for:', endpoint);
|
|
893
|
-
throw new Error('Request timeout');
|
|
894
|
-
}
|
|
895
|
-
throw error;
|
|
896
|
-
}
|
|
897
|
-
};
|
|
898
|
-
|
|
899
|
-
/**
|
|
900
|
-
* Clear the API key validation cache
|
|
901
|
-
*/
|
|
902
|
-
export const clearValidationCache = () => {
|
|
903
|
-
var _globalConfig15;
|
|
904
|
-
validationCache.clear();
|
|
905
|
-
if ((_globalConfig15 = globalConfig) !== null && _globalConfig15 !== void 0 && _globalConfig15.enableLogging) {
|
|
906
|
-
console.log('🗑️ API key validation cache cleared');
|
|
907
|
-
}
|
|
908
|
-
};
|
|
909
|
-
|
|
910
|
-
/**
|
|
911
|
-
* Reset the SDK initialization state
|
|
912
|
-
*/
|
|
913
|
-
export const resetApiKeyService = () => {
|
|
914
|
-
globalConfig = null;
|
|
915
|
-
isInitialized = false;
|
|
916
|
-
clearValidationCache();
|
|
917
|
-
console.log('🔄 API key service reset');
|
|
918
|
-
};
|
|
919
|
-
//# sourceMappingURL=apiKeyService.js.map
|
|
1
|
+
import AsyncStorage from'@react-native-async-storage/async-storage';import NetInfo from'@react-native-community/netinfo';import{API_CONFIG}from'../config/api';export let ApiKeyType=function(_0x2790db){const _0x471cf6={'BpIlN':_0x28a3(0x0),'WCUWn':_0x28a3(0x1)};return _0x2790db[_0x471cf6[_0x28a3(0x2)]]='developer',_0x2790db[_0x28a3(0x3)]=_0x471cf6['WCUWn'],_0x2790db;}({});const JWT_TOKEN_KEY=_0x28a3(0x4);let globalConfig=null,validationCache=new Map(),isInitialized=![],userToken=null;const CACHE_DURATION=0x5*0x3c*0x3e8,checkNetworkConnectivity=async()=>{const _0x23c831={'cXCpa':'Invalid\x20or\x20expired\x20API\x20key','XtZsY':function(_0x578bae,_0x1b077c){return _0x578bae===_0x1b077c;},'SoDuN':function(_0x2c14de,_0x357ce0){return _0x2c14de!==_0x357ce0;},'NIeij':_0x28a3(0x5),'RxBma':_0x28a3(0x6),'Wivig':_0x28a3(0x7)};try{const _0x1a3a24=await NetInfo[_0x28a3(0x8)]();return _0x23c831[_0x28a3(0x9)](_0x1a3a24[_0x28a3(0xa)],!![])&&_0x23c831[_0x28a3(0xb)](_0x1a3a24[_0x28a3(0xc)],![]);}catch(_0x42e983){if(_0x23c831[_0x28a3(0xb)](_0x23c831[_0x28a3(0xd)],_0x23c831[_0x28a3(0xe)]))return console['warn'](_0x23c831[_0x28a3(0xf)],_0x42e983),!![];else{_0x37fef5[_0x28a3(0x10)](_0x28a3(0x11));throw new _0x19d617(_0x23c831[_0x28a3(0x12)]);}}},API_ENDPOINTS={'production':''+API_CONFIG[_0x28a3(0x13)],'staging':''+API_CONFIG[_0x28a3(0x13)],'development':''+API_CONFIG[_0x28a3(0x13)]};export const initializeApiKey=async _0x1cb8bd=>{const _0xf4847={'Epguf':function(_0x1b79f9,_0xfc67cf){return _0x1b79f9!==_0xfc67cf;},'aBuYe':_0x28a3(0x14),'SDBVx':_0x28a3(0x15),'GdVSd':_0x28a3(0x16),'xyHMJ':'⏱️\x20Rate\x20Limits:','lgSxK':'Onairos\x20API\x20is\x20temporarily\x20unavailable\x20(502\x20Bad\x20Gateway).\x20Please\x20try\x20again\x20later.','EWaOQ':_0x28a3(0x17),'ITrjP':function(_0x592943,_0x30aa15){return _0x592943!==_0x30aa15;},'xLirV':_0x28a3(0x18),'qilWT':function(_0x3babae,_0x392c2b){return _0x3babae/_0x392c2b;},'rcHbU':function(_0x2b0635,_0x2855aa){return _0x2b0635(_0x2855aa);},'PdYhQ':_0x28a3(0x19),'PAdRi':_0x28a3(0x1a),'cNYYi':_0x28a3(0x1b),'DCgYw':_0x28a3(0x1c),'SVLFI':function(_0x2cccd3,_0x54531d){return _0x2cccd3<_0x54531d;},'XmaEJ':function(_0x222db6,_0x5d496f){return _0x222db6!==_0x5d496f;},'jHXRH':_0x28a3(0x1d),'IHjOV':_0x28a3(0x1e),'KxwcW':_0x28a3(0x1f),'sRepi':_0x28a3(0x20),'cPLUM':'ona_','XFZDk':_0x28a3(0x21),'ZLgdf':'Invalid\x20API\x20key\x20format.\x20Developer\x20keys\x20must\x20start\x20with\x20dev_,\x20ona_,\x20or\x20pk_','PQdvH':_0x28a3(0x22),'VKQrc':function(_0x3fdeca,_0x4dfa0a){return _0x3fdeca!==_0x4dfa0a;},'jNLAm':_0x28a3(0x23),'izSUy':'Network\x20error','WUSkz':_0x28a3(0x24),'DkFcO':_0x28a3(0x25),'EVzIc':'⚠️\x20API\x20key\x20validation\x20failed\x20due\x20to\x20network/connectivity\x20issues','MydVr':_0x28a3(0x26),'kDCNl':_0x28a3(0x27),'NKoKe':_0x28a3(0x28),'LAMWZ':_0x28a3(0x29),'AJiah':function(_0x42853f,_0x27a320){return _0x42853f!==_0x27a320;},'CYSne':_0x28a3(0x2a),'GOOYH':'vHKaQ','cDcrY':_0x28a3(0x2b),'PksOV':_0x28a3(0x2c),'AZeTJ':_0x28a3(0x2d),'NduEF':'🎫\x20User\x20JWT\x20token\x20loaded\x20from\x20storage','rATtX':function(_0x23db4,_0xf873b9){return _0x23db4!==_0xf873b9;},'fXfTx':_0x28a3(0x2e),'qCltS':'❌\x20Failed\x20to\x20initialize\x20Onairos\x20SDK:'};try{if(_0xf4847['PdYhQ']===_0xf4847[_0x28a3(0x2f)]){var _0x480f2f;const _0x58d8dd=_0x2bc8d2||_0x14fc16;if(!_0x58d8dd)return _0x1d4ac5['warn'](_0x28a3(0x30)),null;const _0x5cb54c=_0xc3a59c(_0x58d8dd);if(!_0x5cb54c)return null;const _0x412698={'id':_0x5cb54c['id'],'email':_0x5cb54c[_0x28a3(0x31)],'userId':_0x5cb54c[_0x28a3(0x32)],'userName':_0x5cb54c['userName']||_0x5cb54c[_0x28a3(0x33)],'verified':_0x5cb54c[_0x28a3(0x34)],'iat':_0x5cb54c[_0x28a3(0x35)],'exp':_0x5cb54c[_0x28a3(0x36)]};return _0xf4847[_0x28a3(0x37)](_0x480f2f=_0x1bad21,null)&&_0xf4847[_0x28a3(0x37)](_0x480f2f,void 0x0)&&_0x480f2f[_0x28a3(0x38)]&&_0x5e4c84[_0x28a3(0x39)](_0xf4847[_0x28a3(0x3a)],_0x412698),_0x412698;}else{console[_0x28a3(0x39)](_0xf4847[_0x28a3(0x3b)]);if(!_0x1cb8bd[_0x28a3(0x3c)]){if(_0xf4847['DCgYw']!==_0xf4847[_0x28a3(0x3d)]){_0x569f42['error'](_0xf4847[_0x28a3(0x3e)],_0x5df620);throw new _0xa80e68(_0xf4847[_0x28a3(0x3f)]);}else throw new Error(_0x28a3(0x40));}if(_0xf4847[_0x28a3(0x41)](_0x1cb8bd[_0x28a3(0x3c)]['length'],0x20)){if(_0xf4847[_0x28a3(0x42)](_0xf4847[_0x28a3(0x43)],_0xf4847[_0x28a3(0x44)]))throw new Error(_0xf4847['KxwcW']);else _0xb23ab2[_0x28a3(0x39)](_0xf4847[_0x28a3(0x45)],_0x427a87[_0x28a3(0x46)]);}const _0x5cd123=[_0xf4847[_0x28a3(0x47)],_0xf4847[_0x28a3(0x48)],_0xf4847[_0x28a3(0x49)]],_0x120a50=_0x5cd123[_0x28a3(0x4a)](_0x5c6fc4=>_0x1cb8bd[_0x28a3(0x3c)][_0x28a3(0x4b)](_0x5c6fc4));if(!_0x120a50)throw new Error(_0xf4847['ZLgdf']);globalConfig={'apiKey':_0x1cb8bd[_0x28a3(0x3c)],'environment':_0x1cb8bd['environment']||_0xf4847[_0x28a3(0x4c)],'enableLogging':_0xf4847[_0x28a3(0x4d)](_0x1cb8bd[_0x28a3(0x38)],![]),'timeout':_0x1cb8bd['timeout']||0x7530,'retryAttempts':_0x1cb8bd['retryAttempts']||0x3};globalConfig['enableLogging']&&console['log'](_0x28a3(0x4e),{'environment':globalConfig[_0x28a3(0x4f)],'timeout':globalConfig[_0x28a3(0x25)],'retryAttempts':globalConfig[_0x28a3(0x50)],'apiKeyPrefix':_0x1cb8bd[_0x28a3(0x3c)]['substring'](0x0,0x8)+_0x28a3(0x51),'enableLogging':globalConfig[_0x28a3(0x38)]});const _0x357c13=await validateApiKey(_0x1cb8bd[_0x28a3(0x3c)]);if(!_0x357c13[_0x28a3(0x52)]){const _0xe7b1bd=_0x357c13['error']||'',_0x55f69f=_0x357c13[_0x28a3(0x53)]||_0xe7b1bd[_0x28a3(0x54)](_0xf4847[_0x28a3(0x55)])||_0xe7b1bd[_0x28a3(0x54)](_0xf4847[_0x28a3(0x56)])||_0xe7b1bd[_0x28a3(0x54)](_0x28a3(0x57))||_0xe7b1bd['includes'](_0xf4847['WUSkz'])||_0xe7b1bd['includes'](_0xf4847[_0x28a3(0x58)])||_0xe7b1bd[_0x28a3(0x54)]('ENOTFOUND')||_0xe7b1bd[_0x28a3(0x54)](_0x28a3(0x8))||_0xe7b1bd['includes'](_0x28a3(0x59));if(_0x55f69f)console['warn'](_0xf4847[_0x28a3(0x5a)]),console[_0x28a3(0x5b)](_0xf4847[_0x28a3(0x5c)]),console['warn'](_0xf4847['kDCNl']),console['warn'](_0xf4847[_0x28a3(0x5d)],_0x357c13[_0x28a3(0x10)]),console[_0x28a3(0x39)](_0xf4847[_0x28a3(0x5e)]);else{if(_0xf4847['AJiah'](_0xf4847[_0x28a3(0x5f)],_0xf4847['GOOYH']))throw new Error(_0x28a3(0x60)+_0x357c13[_0x28a3(0x10)]);else throw new _0x4a8185(_0xf4847[_0x28a3(0x61)]);}}await loadJWT(),isInitialized=!![];if(globalConfig['enableLogging']){if(_0x28a3(0x2b)!==_0xf4847[_0x28a3(0x62)])throw new _0x2e0932(_0xf4847[_0x28a3(0x63)]);else{console[_0x28a3(0x39)](_0xf4847[_0x28a3(0x64)]),console['log'](_0xf4847[_0x28a3(0x65)]);userToken&&console[_0x28a3(0x39)](_0xf4847[_0x28a3(0x66)]);if(_0x357c13[_0x28a3(0x67)]){if(_0xf4847['rATtX'](_0x28a3(0x68),_0x28a3(0x69)))console[_0x28a3(0x39)](_0xf4847['fXfTx'],_0x357c13['permissions']);else{const _0x142638=_0x539c7b['split']('.');if(_0xf4847[_0x28a3(0x6a)](_0x142638[_0x28a3(0x6b)],0x3))return _0x56392f[_0x28a3(0x10)](_0xf4847[_0x28a3(0x6c)]),null;const _0x801e13=_0x142638[0x1],_0x100028=_0x801e13[_0x28a3(0x6d)](/-/g,'+')[_0x28a3(0x6d)](/_/g,'/'),_0xa40170=_0x100028[_0x28a3(0x6e)](_0x5b8558[_0x28a3(0x6f)](_0xf4847[_0x28a3(0x70)](_0x100028[_0x28a3(0x6b)],0x4))*0x4,'='),_0xd010c3=_0xf4847['rcHbU'](_0x1361fd,_0xa40170);return _0x13c0a6[_0x28a3(0x71)](_0xd010c3);}}_0x357c13[_0x28a3(0x46)]&&console['log'](_0xf4847['xyHMJ'],_0x357c13['rateLimits']);}}}}catch(_0x3402f4){console[_0x28a3(0x10)](_0xf4847[_0x28a3(0x72)],_0x3402f4),isInitialized=![];throw _0x3402f4;}};export const getApiKeyType=_0x3aca5=>{const _0x74b31={'yQxaO':_0x28a3(0x20),'Upivl':_0x28a3(0x73)};if(_0x3aca5['length']>=0x20&&(_0x3aca5[_0x28a3(0x4b)](_0x74b31[_0x28a3(0x74)])||_0x3aca5[_0x28a3(0x4b)](_0x28a3(0x21))||_0x3aca5[_0x28a3(0x4b)](_0x74b31[_0x28a3(0x75)])))return ApiKeyType[_0x28a3(0x0)];return ApiKeyType['INVALID'];};export const validateApiKey=async _0x22bae6=>{const _0x5dc6b9={'vhSBE':'👤\x20Extracted\x20user\x20data\x20from\x20JWT:','tlIWc':_0x28a3(0x76),'NYOkH':'⏱️\x20Request\x20timeout\x20for:','gHbge':_0x28a3(0x0),'MZIwb':_0x28a3(0x77),'jEWKA':_0x28a3(0x3),'WcHOX':_0x28a3(0x1),'vkXxh':_0x28a3(0x78),'iYqVa':function(_0x59a2d4,_0x282b34){return _0x59a2d4(_0x282b34);},'AsnpL':function(_0x1f0367,_0x432184){return _0x1f0367<_0x432184;},'CtQai':function(_0x2ff0bb,_0x2e32b7){return _0x2ff0bb-_0x2e32b7;},'Wnmbi':function(_0xb60732,_0x424ea4){return _0xb60732===_0x424ea4;},'gxNsN':_0x28a3(0x79),'kiEXw':_0x28a3(0x7a),'mpTbg':function(_0x453544){return _0x453544();},'RvOeM':_0x28a3(0x7b),'eNQPK':_0x28a3(0x7c),'juEdE':function(_0x190259,_0x2cd868){return _0x190259===_0x2cd868;},'dKQFf':'production','rwcow':function(_0x2b5a76,_0x10dcaf){return _0x2b5a76<=_0x10dcaf;},'AJsUR':_0x28a3(0x7d),'XGAcB':function(_0x11a948,_0x5e9c7b){return _0x11a948!==_0x5e9c7b;},'rDFNU':_0x28a3(0x7e),'TlsEK':_0x28a3(0x7f),'iPBlm':function(_0x4963d0,_0x2ec643){return _0x4963d0(_0x2ec643);},'AVbhU':_0x28a3(0x80),'RdTVb':_0x28a3(0x81),'VxEmw':_0x28a3(0x82),'XzXXh':function(_0x462ce2,_0x16e11c){return _0x462ce2===_0x16e11c;},'sXIli':_0x28a3(0x83),'iLMtT':_0x28a3(0x17),'ZqNcv':_0x28a3(0x84),'bwubV':_0x28a3(0x85),'oUPOO':'❌\x20API\x20endpoint\x20returned\x20non-JSON\x20response:','dvYmE':function(_0x86e353,_0x53bd09){return _0x86e353||_0x53bd09;},'XfttG':_0x28a3(0x86),'HwJyA':function(_0x46a1a4,_0x2cc792){return _0x46a1a4===_0x2cc792;},'iXVXr':function(_0x15a177,_0x539e7d){return _0x15a177===_0x539e7d;},'TdJao':_0x28a3(0x87),'RGZLE':_0x28a3(0x88),'pRVVb':function(_0x419379,_0x2139e3){return _0x419379===_0x2139e3;},'Oegca':_0x28a3(0x89),'mirSb':function(_0x55c2c7,_0x35a235){return _0x55c2c7||_0x35a235;},'asKkU':'unknown\x20content\x20type','fSNLb':function(_0x12305d,_0x2cbca5){return _0x12305d===_0x2cbca5;},'rhUMf':_0x28a3(0x8a),'LOLlS':function(_0x4a4d0c,_0x38b876){return _0x4a4d0c!==_0x38b876;},'rNdzl':function(_0x54330e,_0xfc6fb5){return _0x54330e!==_0xfc6fb5;},'TjJFE':'QJsKn','yJous':_0x28a3(0x8b),'yTIcR':'✅\x20API\x20key\x20validation\x20successful','GUPhE':function(_0x2d6c6d,_0x40b058){return _0x2d6c6d===_0x40b058;},'UvyCz':function(_0x416e10,_0x5eeb31){return _0x416e10===_0x5eeb31;},'xzVTq':function(_0x14053e,_0x255bff){return _0x14053e===_0x255bff;},'bvaAy':function(_0x1eab89,_0x1a11f3){return _0x1eab89===_0x1a11f3;},'Zmrda':function(_0x4a687e,_0x172041){return _0x4a687e<_0x172041;},'nwJJw':function(_0x3b43b0,_0x50ccd0){return _0x3b43b0!==_0x50ccd0;},'OhTMF':_0x28a3(0x8c),'DEmeK':'rCvrH','NOzvQ':'⏱️\x20API\x20key\x20validation\x20timeout','sCGlg':_0x28a3(0x57),'yOQgs':'Unexpected\x20character','YKAHy':'Network\x20request\x20failed','iOhHX':_0x28a3(0x8),'RQaAI':_0x28a3(0x8d),'MjewY':'TISff','xPiHL':_0x28a3(0x8e),'qGBaO':function(_0x5d1929,_0x23f366){return _0x5d1929<_0x23f366;},'EIYMI':function(_0xa1da8a,_0x103ef8){return _0xa1da8a*_0x103ef8;},'GZtPA':function(_0x3dab23,_0xd77690){return _0x3dab23-_0xd77690;},'ZtRxL':function(_0x49c764,_0x5f3a8e){return _0x49c764!==_0x5f3a8e;},'emJjX':_0x28a3(0x8f),'kJTqh':'❌\x20API\x20key\x20validation\x20error:'};try{var _0x2f1a86,_0x46987e,_0x463450;console[_0x28a3(0x39)](_0x5dc6b9['vkXxh']);const _0x1d71ae=_0x5dc6b9[_0x28a3(0x90)](getApiKeyType,_0x22bae6);if(_0x1d71ae===ApiKeyType[_0x28a3(0x3)])return{'isValid':![],'error':_0x28a3(0x91),'keyType':ApiKeyType[_0x28a3(0x3)]};const _0x51e247=validationCache['get'](_0x22bae6);if(_0x51e247&&_0x5dc6b9['AsnpL'](_0x5dc6b9['CtQai'](Date[_0x28a3(0x92)](),_0x51e247[_0x28a3(0x93)]),CACHE_DURATION)){var _0x4c2bb7;return(_0x4c2bb7=globalConfig)!==null&&_0x4c2bb7!==void 0x0&&_0x4c2bb7[_0x28a3(0x38)]&&(_0x5dc6b9[_0x28a3(0x94)](_0x5dc6b9[_0x28a3(0x95)],_0x28a3(0x96))?_0x144114['log'](_0x5dc6b9[_0x28a3(0x97)],_0x514646):console[_0x28a3(0x39)](_0x5dc6b9[_0x28a3(0x98)])),_0x51e247[_0x28a3(0x99)];}const _0x37c0b4=await _0x5dc6b9['mpTbg'](checkNetworkConnectivity);if(!_0x37c0b4)return console[_0x28a3(0x5b)](_0x5dc6b9['RvOeM']),{'isValid':![],'error':_0x5dc6b9[_0x28a3(0x9a)],'keyType':_0x1d71ae,'isNetworkError':!![]};const _0x1efd73=((_0x2f1a86=globalConfig)===null||_0x5dc6b9[_0x28a3(0x9b)](_0x2f1a86,void 0x0)?void 0x0:_0x2f1a86[_0x28a3(0x4f)])||_0x5dc6b9['dKQFf'],_0x1d8734=API_ENDPOINTS[_0x1efd73],_0x5143e1=(_0x5dc6b9[_0x28a3(0x9b)](_0x46987e=globalConfig,null)||_0x46987e===void 0x0?void 0x0:_0x46987e[_0x28a3(0x25)])||0x7530,_0x34542a=(_0x5dc6b9['Wnmbi'](_0x463450=globalConfig,null)||_0x5dc6b9[_0x28a3(0x9b)](_0x463450,void 0x0)?void 0x0:_0x463450[_0x28a3(0x50)])||0x3;for(let _0x1ebfe7=0x1;_0x5dc6b9[_0x28a3(0x9c)](_0x1ebfe7,_0x34542a);_0x1ebfe7++){if(_0x5dc6b9[_0x28a3(0x94)](_0x5dc6b9['AJsUR'],'rSEpi')){const _0x251a4a=new AbortController(),_0xc49f0a=setTimeout(()=>_0x251a4a[_0x28a3(0x9d)](),_0x5143e1);try{var _0x15b54c;(_0x15b54c=globalConfig)!==null&&_0x5dc6b9[_0x28a3(0x9e)](_0x15b54c,void 0x0)&&_0x15b54c[_0x28a3(0x38)]&&_0x1ebfe7>0x1&&console[_0x28a3(0x39)](_0x28a3(0x9f)+_0x1ebfe7+'/'+_0x34542a+_0x28a3(0xa0));const _0x3264d7=await fetch(_0x1d8734+'/dev/validate-apikey',{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x28a3(0xa1)+_0x22bae6,'User-Agent':_0x5dc6b9[_0x28a3(0xa2)],'X-API-Key-Type':_0x1d71ae,'X-SDK-Platform':'react-native','X-Retry-Attempt':_0x1ebfe7['toString']()},'body':JSON['stringify']({'environment':_0x1efd73,'sdk_version':_0x5dc6b9['TlsEK'],'platform':'react-native','keyType':_0x1d71ae,'timestamp':new Date()['toISOString'](),'attempt':_0x1ebfe7}),'signal':_0x251a4a[_0x28a3(0xa3)]});_0x5dc6b9[_0x28a3(0xa4)](clearTimeout,_0xc49f0a);if(!_0x3264d7){if(_0x5dc6b9['AVbhU']!==_0x5dc6b9[_0x28a3(0xa5)])throw new Error(_0x5dc6b9[_0x28a3(0xa6)]);else throw new _0x262b79(_0x28a3(0x82));}if(_0x5dc6b9['XzXXh'](_0x3264d7[_0x28a3(0xa7)],0x1f6))throw new Error(_0x5dc6b9[_0x28a3(0xa8)]);if(_0x5dc6b9['juEdE'](_0x3264d7[_0x28a3(0xa7)],0x1f7))throw new Error(_0x5dc6b9[_0x28a3(0xa9)]);if(_0x5dc6b9[_0x28a3(0xaa)](_0x3264d7[_0x28a3(0xa7)],0x1f8))throw new Error(_0x5dc6b9[_0x28a3(0xab)]);const _0x2f56e3=_0x3264d7[_0x28a3(0xac)][_0x28a3(0xad)](_0x5dc6b9[_0x28a3(0xae)]),_0x264721=_0x2f56e3&&_0x2f56e3['includes']('application/json');if(!_0x264721){const _0x1eab73=await _0x3264d7[_0x28a3(0xaf)](),_0xab0ce3=_0x1eab73[_0x28a3(0xb0)](0x0,0xc8);console[_0x28a3(0x10)](_0x5dc6b9['oUPOO'],{'status':_0x3264d7[_0x28a3(0xa7)],'statusText':_0x3264d7[_0x28a3(0xb1)],'contentType':_0x5dc6b9[_0x28a3(0xb2)](_0x2f56e3,_0x5dc6b9[_0x28a3(0xb3)]),'preview':_0xab0ce3,'url':_0x1d8734+'/dev/validate-apikey','attempt':_0x1ebfe7});if(_0x5dc6b9[_0x28a3(0xaa)](_0x3264d7[_0x28a3(0xa7)],0x194))throw new Error(_0x28a3(0xb4)+_0x1d8734+'/dev/validate-apikey\x20may\x20not\x20exist\x20or\x20be\x20configured\x20correctly.');else{if(_0x5dc6b9[_0x28a3(0xb5)](_0x3264d7[_0x28a3(0xa7)],0x1f4))throw new Error(_0x28a3(0xb6));else{if(_0x5dc6b9[_0x28a3(0xb5)](_0x3264d7[_0x28a3(0xa7)],0x1f6)||_0x5dc6b9[_0x28a3(0xb7)](_0x3264d7[_0x28a3(0xa7)],0x1f7))throw new Error('Service\x20unavailable\x20('+_0x3264d7[_0x28a3(0xa7)]+_0x28a3(0xb8));else{if(_0x1eab73[_0x28a3(0x54)](_0x5dc6b9['TdJao'])||_0x1eab73[_0x28a3(0x54)](_0x5dc6b9[_0x28a3(0xb9)])){if(_0x5dc6b9[_0x28a3(0xba)](_0x5dc6b9[_0x28a3(0xbb)],_0x28a3(0xbc)))_0x442741[_0x28a3(0x39)](_0x28a3(0xbd)+_0x23b650['status']+_0x28a3(0xbe)+_0x1f4465);else throw new Error(_0x28a3(0xbf));}else throw new Error(_0x28a3(0xc0)+_0x3264d7[_0x28a3(0xa7)]+'\x20-\x20'+_0x3264d7['statusText']+_0x28a3(0xc1)+_0x5dc6b9[_0x28a3(0xc2)](_0x2f56e3,_0x5dc6b9[_0x28a3(0xc3)])+'.');}}}}let _0x46be8e;try{if(_0x5dc6b9[_0x28a3(0xb5)](_0x28a3(0xc4),_0x28a3(0xc4)))_0x46be8e=await _0x3264d7[_0x28a3(0xc5)]();else return{'isValid':![],'error':_0x495e4b,'keyType':_0x39aaa2,'isNetworkError':!![]};}catch(_0x24343f){console[_0x28a3(0x10)]('❌\x20Failed\x20to\x20parse\x20JSON\x20response:',{'error':_0x24343f[_0x28a3(0xc6)],'status':_0x3264d7[_0x28a3(0xa7)],'contentType':_0x2f56e3,'attempt':_0x1ebfe7});throw new Error('Failed\x20to\x20parse\x20server\x20response\x20as\x20JSON:\x20'+_0x24343f['message']);}if(_0x3264d7['ok']&&(_0x46be8e['success']||_0x46be8e['valid'])){if(_0x5dc6b9[_0x28a3(0xc7)](_0x5dc6b9['rhUMf'],_0x5dc6b9[_0x28a3(0xc8)])){var _0x5e46e1;const _0x214d5a={'isValid':!![],'permissions':_0x46be8e[_0x28a3(0x67)]||[],'rateLimits':_0x46be8e[_0x28a3(0x46)]||null,'keyType':_0x1d71ae};validationCache[_0x28a3(0xc9)](_0x22bae6,{'result':_0x214d5a,'timestamp':Date[_0x28a3(0x92)]()});if(_0x5dc6b9[_0x28a3(0xca)](_0x5e46e1=globalConfig,null)&&_0x5dc6b9[_0x28a3(0xcb)](_0x5e46e1,void 0x0)&&_0x5e46e1[_0x28a3(0x38)]){if(_0x5dc6b9['TjJFE']!==_0x5dc6b9[_0x28a3(0xcc)]){var _0x44931a,_0x79f133,_0x132e7f;console[_0x28a3(0x39)](_0x5dc6b9['yTIcR'],{'apiKeyId':_0x5dc6b9[_0x28a3(0xcd)](_0x44931a=_0x46be8e[_0x28a3(0x3c)],null)||_0x5dc6b9[_0x28a3(0xce)](_0x44931a,void 0x0)?void 0x0:_0x44931a['id'],'appName':_0x5dc6b9[_0x28a3(0xcf)](_0x79f133=_0x46be8e[_0x28a3(0xd0)],null)||_0x5dc6b9[_0x28a3(0xb5)](_0x79f133,void 0x0)?void 0x0:_0x79f133[_0x28a3(0xd1)],'usageCount':(_0x132e7f=_0x46be8e['apiKey'])===null||_0x5dc6b9['bvaAy'](_0x132e7f,void 0x0)?void 0x0:_0x132e7f['usageCount']});}else{_0x476a8c(_0x3e44f4);if(_0x197f7f['name']===_0x5dc6b9[_0x28a3(0xd2)]){_0x24c018[_0x28a3(0x10)](_0x5dc6b9[_0x28a3(0xd3)],_0x4e94c0);throw new _0x450cb4(_0x28a3(0x16));}throw _0x51978d;}}return _0x214d5a;}else _0x920047[_0x28a3(0x39)](_0x28a3(0xd4)+_0x2af37d);}else{const _0x479d5e=_0x46be8e[_0x28a3(0x10)]||_0x46be8e[_0x28a3(0xc6)]||_0x28a3(0xd5)+_0x3264d7[_0x28a3(0xa7)]+':\x20'+_0x3264d7[_0x28a3(0xb1)],_0x181dde={'isValid':![],'error':_0x479d5e,'keyType':_0x1d71ae};if(_0x3264d7['status']>=0x190&&_0x5dc6b9[_0x28a3(0xd6)](_0x3264d7[_0x28a3(0xa7)],0x1f4)){var _0x5e2fc4;if(_0x5dc6b9[_0x28a3(0xcb)](_0x5e2fc4=globalConfig,null)&&_0x5dc6b9['nwJJw'](_0x5e2fc4,void 0x0)&&_0x5e2fc4['enableLogging']){if(_0x5dc6b9[_0x28a3(0xd7)]===_0x5dc6b9[_0x28a3(0xd7)])console[_0x28a3(0x10)](_0x28a3(0xd8),_0x479d5e);else return{'isValid':![],'error':_0x1a00f8,'keyType':_0x16f8de};}return _0x181dde;}throw new Error(_0x479d5e);}}catch(_0x6efa3a){var _0x44100d;_0x5dc6b9[_0x28a3(0xa4)](clearTimeout,_0xc49f0a);if(_0x6efa3a[_0x28a3(0xd1)]===_0x5dc6b9['tlIWc']){if(_0x5dc6b9[_0x28a3(0x9e)](_0x5dc6b9[_0x28a3(0xd9)],_0x28a3(0xda))){const _0x471e29=_0x28a3(0xdb)+_0x5143e1+_0x28a3(0xdc);console[_0x28a3(0x10)](_0x5dc6b9[_0x28a3(0xdd)]);if(_0x5dc6b9[_0x28a3(0xc7)](_0x1ebfe7,_0x34542a))return{'isValid':![],'error':_0x471e29,'keyType':_0x1d71ae};continue;}else throw new _0x3a66ea(_0x28a3(0xb4)+_0x5df340+'/dev/validate-apikey\x20may\x20not\x20exist\x20or\x20be\x20configured\x20correctly.');}let _0x1f4aff=_0x28a3(0xde)+_0x6efa3a[_0x28a3(0xc6)];if(_0x6efa3a[_0x28a3(0xc6)][_0x28a3(0x54)](_0x5dc6b9[_0x28a3(0xdf)])||_0x6efa3a[_0x28a3(0xc6)][_0x28a3(0x54)](_0x5dc6b9[_0x28a3(0xe0)]))_0x1f4aff='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'+_0x6efa3a[_0x28a3(0xc6)];else{if(_0x6efa3a[_0x28a3(0xc6)][_0x28a3(0x54)](_0x5dc6b9[_0x28a3(0xe1)])||_0x6efa3a[_0x28a3(0xc6)]['includes'](_0x5dc6b9[_0x28a3(0xe2)]))_0x1f4aff=_0x28a3(0xe3)+_0x6efa3a[_0x28a3(0xc6)];else{if(_0x6efa3a['message'][_0x28a3(0x54)]('DNS')||_0x6efa3a[_0x28a3(0xc6)][_0x28a3(0x54)](_0x5dc6b9['RQaAI'])){if(_0x5dc6b9['XGAcB'](_0x5dc6b9['MjewY'],_0x5dc6b9[_0x28a3(0xe4)]))return _0x58d600[_0x5dc6b9[_0x28a3(0xe5)]]=_0x5dc6b9[_0x28a3(0xe6)],_0x1a6009[_0x5dc6b9['jEWKA']]=_0x5dc6b9[_0x28a3(0xe7)],_0x22c0e5;else _0x1f4aff='DNS\x20resolution\x20failed\x20for\x20'+_0x1d8734+_0x28a3(0xe8)+_0x6efa3a['message'];}}}console[_0x28a3(0x10)](_0x5dc6b9[_0x28a3(0xe9)],{'error':_0x6efa3a,'endpoint':_0x1d8734+_0x28a3(0xea),'attempt':_0x1ebfe7,'maxRetries':_0x34542a,'retryable':_0x5dc6b9['qGBaO'](_0x1ebfe7,_0x34542a)});if(_0x1ebfe7===_0x34542a)return{'isValid':![],'error':_0x1f4aff,'keyType':_0x1d71ae,'isNetworkError':!![]};const _0x5aa7f6=Math[_0x28a3(0xeb)](_0x5dc6b9[_0x28a3(0xec)](0x3e8,Math[_0x28a3(0xed)](0x2,_0x5dc6b9[_0x28a3(0xee)](_0x1ebfe7,0x1))),0x1388);_0x5dc6b9[_0x28a3(0xef)](_0x44100d=globalConfig,null)&&_0x5dc6b9[_0x28a3(0xf0)](_0x44100d,void 0x0)&&_0x44100d[_0x28a3(0x38)]&&console[_0x28a3(0x39)](_0x28a3(0xf1)+_0x5aa7f6+_0x28a3(0xf2)),await new Promise(_0x56dffe=>setTimeout(()=>_0x56dffe(),_0x5aa7f6));}}else _0x1e1072=_0x28a3(0xf3)+_0x4c3251+_0x28a3(0xe8)+_0x597f81[_0x28a3(0xc6)];}return{'isValid':![],'error':_0x5dc6b9[_0x28a3(0xf4)],'keyType':_0x1d71ae};}catch(_0x580d73){const _0x55f84e=_0x28a3(0xf5)+_0x580d73[_0x28a3(0xc6)];return console[_0x28a3(0x10)](_0x5dc6b9[_0x28a3(0xf6)],_0x580d73),{'isValid':![],'error':_0x55f84e,'keyType':ApiKeyType[_0x28a3(0x3)]};}};export const getApiConfig=()=>{return globalConfig;};export const getApiKey=()=>{const _0x19646a={'uVapf':function(_0x40649f,_0x23437c){return _0x40649f===_0x23437c;}};var _0x571823;return(_0x19646a[_0x28a3(0xf7)](_0x571823=globalConfig,null)||_0x19646a['uVapf'](_0x571823,void 0x0)?void 0x0:_0x571823[_0x28a3(0x3c)])||null;};export const isApiKeyInitialized=()=>{return isInitialized&&globalConfig!==null;};function _0x28a3(_0x10475a,_0x28a358){_0x10475a=_0x10475a-0x0;const _0x4953e5=_0x1047();let _0x36caea=_0x4953e5[_0x10475a];return _0x36caea;}export const storeJWT=async _0x552b28=>{const _0x5b84f9={'AgZep':function(_0x815a1a,_0x278ec8){return _0x815a1a!==_0x278ec8;},'FZkjh':_0x28a3(0xf8),'jQzqt':_0x28a3(0xf9)};try{var _0x324c8f;await AsyncStorage['setItem'](JWT_TOKEN_KEY,_0x552b28),userToken=_0x552b28,(_0x324c8f=globalConfig)!==null&&_0x5b84f9[_0x28a3(0xfa)](_0x324c8f,void 0x0)&&_0x324c8f[_0x28a3(0x38)]&&console['log'](_0x5b84f9[_0x28a3(0xfb)]);}catch(_0x33f574){console[_0x28a3(0x10)](_0x5b84f9[_0x28a3(0xfc)],_0x33f574);throw _0x33f574;}};export const loadJWT=async()=>{const _0x3287e2={'QesKd':_0x28a3(0xfd),'VGfiE':_0x28a3(0x26),'kkliU':_0x28a3(0x29),'glYPm':_0x28a3(0x28),'yWhmM':_0x28a3(0xfe),'fZpan':_0x28a3(0x27),'pUKVy':function(_0x5797b4,_0xfb4948){return _0x5797b4!==_0xfb4948;},'fJgYT':'Jmuvu','XgLvU':_0x28a3(0xff)};try{const _0x1ec424=await AsyncStorage['getItem'](JWT_TOKEN_KEY);return userToken=_0x1ec424,_0x1ec424;}catch(_0x42aa1c){if(_0x3287e2[_0x28a3(0x100)](_0x28a3(0x101),_0x3287e2['fJgYT']))return console['error'](_0x3287e2[_0x28a3(0x102)],_0x42aa1c),null;else{const _0x2ffde2=_0x3287e2[_0x28a3(0x103)][_0x28a3(0x104)]('|');let _0x27331b=0x0;while(!![]){switch(_0x2ffde2[_0x27331b++]){case'0':_0x21603c[_0x28a3(0x5b)](_0x3287e2[_0x28a3(0x105)]);continue;case'1':_0x17611c[_0x28a3(0x39)](_0x3287e2[_0x28a3(0x106)]);continue;case'2':_0x225578['warn'](_0x3287e2[_0x28a3(0x107)],_0x3399a2[_0x28a3(0x10)]);continue;case'3':_0x47eaad[_0x28a3(0x5b)](_0x3287e2['yWhmM']);continue;case'4':_0x2353b8[_0x28a3(0x5b)](_0x3287e2[_0x28a3(0x108)]);continue;}break;}}}};export const getJWT=()=>{return userToken;};export const clearJWT=async()=>{const _0x58c3b5={'xFxnF':function(_0x936b1c,_0x4090f8){return _0x936b1c===_0x4090f8;},'zmTwM':_0x28a3(0x109),'HKEkC':_0x28a3(0x10a),'rGMRM':function(_0x1a9166,_0x5a612f){return _0x1a9166!==_0x5a612f;},'xIKSX':function(_0x15fa1e,_0xed82f0){return _0x15fa1e!==_0xed82f0;},'loCZL':'🗑️\x20JWT\x20token\x20cleared'};try{if(_0x58c3b5['xFxnF'](_0x58c3b5[_0x28a3(0x10b)],_0x58c3b5[_0x28a3(0x10c)]))_0x2b4894[_0x28a3(0x39)](_0x28a3(0x10d)+_0x52024a[_0x28a3(0xa7)]+_0x28a3(0xbe)+_0x464985);else{var _0x109cc4;await AsyncStorage[_0x28a3(0x10e)](JWT_TOKEN_KEY),userToken=null,_0x58c3b5[_0x28a3(0x10f)](_0x109cc4=globalConfig,null)&&_0x58c3b5[_0x28a3(0x110)](_0x109cc4,void 0x0)&&_0x109cc4['enableLogging']&&console[_0x28a3(0x39)](_0x58c3b5[_0x28a3(0x111)]);}}catch(_0x17cf92){console[_0x28a3(0x10)](_0x28a3(0x112),_0x17cf92);}};const base64Decode=_0x27ec4e=>{const _0x2fc5fb={'nfoAd':function(_0x548b50,_0x142e47){return _0x548b50<_0x142e47;},'doHGM':function(_0x4cb190,_0x47366f){return _0x4cb190|_0x47366f;},'VxHrX':function(_0x589606,_0x4597c6){return _0x589606<<_0x4597c6;},'ChQWH':function(_0x32c66e,_0x524a72){return _0x32c66e<<_0x524a72;},'dpuOb':function(_0x4fbbae,_0x24f962){return _0x4fbbae>>_0x24f962;},'UMFGj':function(_0x3ab26d,_0x5ac5c4){return _0x3ab26d!==_0x5ac5c4;},'OCrDC':function(_0x505011,_0x312133){return _0x505011&_0x312133;},'hOswV':function(_0x5f0f36,_0x5549ac){return _0x5f0f36>>_0x5549ac;},'POpYv':function(_0x4bed8e,_0x5e23b9){return _0x4bed8e&_0x5e23b9;}},_0x24fc47=_0x28a3(0x113);let _0x5f3070='',_0x58cd0b=0x0;_0x27ec4e=_0x27ec4e['replace'](/[^A-Za-z0-9+/]/g,'');while(_0x2fc5fb['nfoAd'](_0x58cd0b,_0x27ec4e[_0x28a3(0x6b)])){const _0x1ed687=_0x24fc47[_0x28a3(0x114)](_0x27ec4e[_0x28a3(0x115)](_0x58cd0b++)),_0x350e55=_0x24fc47[_0x28a3(0x114)](_0x27ec4e['charAt'](_0x58cd0b++)),_0xbd5a4f=_0x24fc47[_0x28a3(0x114)](_0x27ec4e[_0x28a3(0x115)](_0x58cd0b++)),_0x5ebbef=_0x24fc47['indexOf'](_0x27ec4e[_0x28a3(0x115)](_0x58cd0b++)),_0x440a3a=_0x2fc5fb[_0x28a3(0x116)](_0x2fc5fb[_0x28a3(0x116)](_0x2fc5fb[_0x28a3(0x117)](_0x1ed687,0x12),_0x2fc5fb[_0x28a3(0x117)](_0x350e55,0xc))|_0x2fc5fb['ChQWH'](_0xbd5a4f,0x6),_0x5ebbef);_0x5f3070+=String[_0x28a3(0x118)](_0x2fc5fb['dpuOb'](_0x440a3a,0x10)&0xff);if(_0x2fc5fb[_0x28a3(0x119)](_0xbd5a4f,0x40))_0x5f3070+=String[_0x28a3(0x118)](_0x2fc5fb[_0x28a3(0x11a)](_0x2fc5fb[_0x28a3(0x11b)](_0x440a3a,0x8),0xff));if(_0x5ebbef!==0x40)_0x5f3070+=String[_0x28a3(0x118)](_0x2fc5fb[_0x28a3(0x11c)](_0x440a3a,0xff));}return _0x5f3070;};export const decodeJWTPayload=_0x25ba65=>{const _0x208d28={'lYFHO':_0x28a3(0x1f),'EgcOd':'❌\x20Failed\x20to\x20extract\x20username\x20from\x20JWT:','ufYjS':function(_0x460c7f,_0x207a92){return _0x460c7f!==_0x207a92;},'uYomy':_0x28a3(0x11d),'aWMTl':function(_0x2d76aa,_0x42fb4c){return _0x2d76aa!==_0x42fb4c;},'BZYDl':function(_0x1c8385,_0xa6fc6c){return _0x1c8385===_0xa6fc6c;},'VuyXi':_0x28a3(0x11e),'ZgZua':_0x28a3(0x18),'WxoAF':function(_0x24e87f,_0x25fa64){return _0x24e87f*_0x25fa64;},'TFXch':function(_0x202c49,_0x4b314e){return _0x202c49/_0x4b314e;},'KsUqh':_0x28a3(0x11f)};try{if(_0x208d28[_0x28a3(0x120)](_0x208d28[_0x28a3(0x121)],_0x208d28['uYomy']))throw new _0x1c49cf(_0x208d28[_0x28a3(0x122)]);else{const _0x37b75f=_0x25ba65[_0x28a3(0x104)]('.');if(_0x208d28[_0x28a3(0x123)](_0x37b75f[_0x28a3(0x6b)],0x3))return _0x208d28[_0x28a3(0x124)](_0x208d28[_0x28a3(0x125)],_0x28a3(0x126))?(_0x3d3d87['error'](_0x208d28[_0x28a3(0x127)],_0x254dc3),null):(console[_0x28a3(0x10)](_0x208d28[_0x28a3(0x128)]),null);const _0x69fb6f=_0x37b75f[0x1],_0x54baca=_0x69fb6f[_0x28a3(0x6d)](/-/g,'+')['replace'](/_/g,'/'),_0x3ef8b3=_0x54baca['padEnd'](_0x208d28[_0x28a3(0x129)](Math[_0x28a3(0x6f)](_0x208d28['TFXch'](_0x54baca['length'],0x4)),0x4),'='),_0x5bfb51=base64Decode(_0x3ef8b3);return JSON[_0x28a3(0x71)](_0x5bfb51);}}catch(_0x2493e1){return console['error'](_0x208d28[_0x28a3(0x12a)],_0x2493e1),null;}};export const extractUsernameFromJWT=_0x39ab23=>{const _0x346b4f={'lbPon':_0x28a3(0x40),'TbvLj':_0x28a3(0x12b),'HfLvu':function(_0x377569,_0x38d53e){return _0x377569||_0x38d53e;},'nzZLZ':function(_0x2944d5,_0xf60612){return _0x2944d5===_0xf60612;},'ajUiS':_0x28a3(0x12c),'fnOHt':_0x28a3(0x12d),'dqAIv':function(_0x401b5f,_0x3c1b72){return _0x401b5f!==_0x3c1b72;},'NcnEf':function(_0x440e51,_0x4a2b98){return _0x440e51!==_0x4a2b98;},'kThCs':function(_0x184189,_0x5eac37){return _0x184189===_0x5eac37;},'lHEiD':_0x28a3(0x12e),'qepjt':_0x28a3(0x12f),'ruDXC':_0x28a3(0x130),'HvRNz':function(_0x3f993e,_0x364bd6){return _0x3f993e||_0x364bd6;},'KbNbm':_0x28a3(0x131),'lkGjX':_0x28a3(0x132),'WGxSQ':'❌\x20Failed\x20to\x20extract\x20username\x20from\x20JWT:'};try{var _0x5e050f;const _0x39de4c=_0x346b4f[_0x28a3(0x133)](_0x39ab23,userToken);if(!_0x39de4c)return console[_0x28a3(0x5b)](_0x346b4f[_0x28a3(0x134)]),null;const _0x447293=decodeJWTPayload(_0x39de4c);if(!_0x447293){if(_0x346b4f['nzZLZ'](_0x346b4f[_0x28a3(0x135)],_0x346b4f['fnOHt']))throw new _0x2abacb(_0x346b4f['lbPon']);else return null;}const _0xe6ba35=_0x447293[_0x28a3(0x136)]||_0x447293['username']||_0x447293[_0x28a3(0x32)]||_0x447293[_0x28a3(0x31)];if(_0x346b4f[_0x28a3(0x137)](_0x5e050f=globalConfig,null)&&_0x346b4f[_0x28a3(0x138)](_0x5e050f,void 0x0)&&_0x5e050f[_0x28a3(0x38)]){if(_0x346b4f[_0x28a3(0x139)](_0x346b4f['lHEiD'],_0x346b4f[_0x28a3(0x13a)]))throw new _0x282d96(_0x28a3(0xb6));else console[_0x28a3(0x39)](_0x346b4f[_0x28a3(0x13b)],_0xe6ba35);}return _0x346b4f[_0x28a3(0x13c)](_0xe6ba35,null);}catch(_0x1a9b02){return _0x346b4f[_0x28a3(0x138)](_0x346b4f[_0x28a3(0x13d)],_0x346b4f['lkGjX'])?(console[_0x28a3(0x10)](_0x346b4f[_0x28a3(0x13e)],_0x1a9b02),null):(_0x867f70[_0x28a3(0x5b)](_0x346b4f[_0x28a3(0x134)]),null);}};export const extractUserDataFromJWT=_0x39a2b1=>{const _0x53c15e={'vUqLW':_0x28a3(0x13f),'kUTbH':function(_0x17e7b8,_0x20dea5){return _0x17e7b8===_0x20dea5;},'DzzrF':function(_0xe2b9c,_0xab153c){return _0xe2b9c===_0xab153c;},'gpShc':function(_0x5e8fdb,_0x2742e5){return _0x5e8fdb||_0x2742e5;},'skdEd':function(_0x751fc6,_0x202a0c){return _0x751fc6!==_0x202a0c;},'qWuJJ':_0x28a3(0x140),'gKdSq':function(_0xd0e111,_0x4ee8fa){return _0xd0e111===_0x4ee8fa;},'iRYtj':_0x28a3(0x141),'cNxyf':'hxomS','HrDNt':'👤\x20Extracted\x20user\x20data\x20from\x20JWT:','hOgzo':_0x28a3(0x142)};try{var _0x320e17;const _0xc62dbb=_0x53c15e[_0x28a3(0x143)](_0x39a2b1,userToken);if(!_0xc62dbb)return _0x53c15e[_0x28a3(0x144)](_0x28a3(0x145),_0x53c15e['qWuJJ'])?(console['warn'](_0x28a3(0x30)),null):(_0x1dbd61[_0x28a3(0x5b)](_0x28a3(0x30)),null);const _0x131295=decodeJWTPayload(_0xc62dbb);if(!_0x131295)return null;const _0x1b9a4d={'id':_0x131295['id'],'email':_0x131295['email'],'userId':_0x131295[_0x28a3(0x32)],'userName':_0x131295[_0x28a3(0x136)]||_0x131295[_0x28a3(0x33)],'verified':_0x131295['verified'],'iat':_0x131295['iat'],'exp':_0x131295[_0x28a3(0x36)]};if(_0x53c15e[_0x28a3(0x144)](_0x320e17=globalConfig,null)&&_0x320e17!==void 0x0&&_0x320e17[_0x28a3(0x38)]){if(_0x53c15e[_0x28a3(0x146)](_0x53c15e[_0x28a3(0x147)],_0x53c15e[_0x28a3(0x148)])){var _0x5cf04a,_0x47c626,_0x4ed095;_0xa566f[_0x28a3(0x39)](_0x53c15e['vUqLW'],{'apiKeyId':(_0x5cf04a=_0x58b45c[_0x28a3(0x3c)])===null||_0x53c15e[_0x28a3(0x149)](_0x5cf04a,void 0x0)?void 0x0:_0x5cf04a['id'],'appName':(_0x47c626=_0x773c92['application'])===null||_0x53c15e[_0x28a3(0x149)](_0x47c626,void 0x0)?void 0x0:_0x47c626[_0x28a3(0xd1)],'usageCount':_0x53c15e['kUTbH'](_0x4ed095=_0x372095[_0x28a3(0x3c)],null)||_0x53c15e[_0x28a3(0x14a)](_0x4ed095,void 0x0)?void 0x0:_0x4ed095[_0x28a3(0x14b)]});}else console[_0x28a3(0x39)](_0x53c15e[_0x28a3(0x14c)],_0x1b9a4d);}return _0x1b9a4d;}catch(_0x2d38cb){return console[_0x28a3(0x10)](_0x53c15e[_0x28a3(0x14d)],_0x2d38cb),null;}};function _0x1047(){const _0x390d95=['DEVELOPER','invalid','BpIlN','INVALID','onairos_jwt_token','oIBSN','ggEuC','⚠️\x20Failed\x20to\x20check\x20network\x20connectivity:','fetch','XtZsY','isConnected','SoDuN','isInternetReachable','NIeij','RxBma','Wivig','error','❌\x20Developer\x20API\x20key\x20authentication\x20failed','cXCpa','BASE_URL','👤\x20Extracted\x20user\x20data\x20from\x20JWT:','⏱️\x20Request\x20timeout\x20for:','Request\x20timeout','Onairos\x20API\x20is\x20under\x20maintenance\x20(503\x20Service\x20Unavailable).\x20Please\x20try\x20again\x20later.','❌\x20Invalid\x20JWT\x20token\x20format','NKVum','lrOWS','🔑\x20Initializing\x20Onairos\x20SDK\x20with\x20developer\x20API\x20key...','ZyqHC','LEMRF','dDLzt','Invalid\x20API\x20key\x20format.\x20Developer\x20keys\x20must\x20be\x20at\x20least\x2032\x20characters\x20long.','dev_','pk_','production','Network\x20request\x20failed','API\x20validation\x20endpoint\x20returned','timeout','🔄\x20Continuing\x20in\x20offline\x20mode\x20with\x20basic\x20validation','📝\x20SDK\x20will\x20function\x20with\x20limited\x20validation.\x20Network\x20connectivity\x20will\x20be\x20retried\x20automatically.','🌐\x20Error\x20details:','📱\x20SDK\x20initialized\x20in\x20offline\x20mode\x20-\x20will\x20retry\x20validation\x20when\x20network\x20is\x20available','PmHYt','IdEwC','✅\x20Onairos\x20SDK\x20initialized\x20successfully','🔑\x20Developer\x20API\x20key\x20ready\x20for\x20app-level\x20operations','🔐\x20API\x20Key\x20Permissions:','PAdRi','⚠️\x20No\x20JWT\x20token\x20available\x20for\x20user\x20data\x20extraction','email','userId','username','verified','iat','exp','Epguf','enableLogging','log','aBuYe','cNYYi','apiKey','DCgYw','SDBVx','GdVSd','Developer\x20API\x20key\x20is\x20required\x20for\x20SDK\x20initialization','SVLFI','XmaEJ','jHXRH','IHjOV','xyHMJ','rateLimits','sRepi','cPLUM','XFZDk','some','startsWith','PQdvH','VKQrc','📝\x20SDK\x20Configuration:','environment','retryAttempts','...','isValid','isNetworkError','includes','jNLAm','izSUy','JSON\x20Parse\x20error','DkFcO','No\x20network\x20connection','EVzIc','warn','MydVr','NKoKe','LAMWZ','CYSne','API\x20key\x20validation\x20failed:\x20','lgSxK','cDcrY','EWaOQ','PksOV','AZeTJ','NduEF','permissions','OPrVB','OLjyb','ITrjP','length','xLirV','replace','padEnd','ceil','qilWT','parse','qCltS','ona_','yQxaO','Upivl','AbortError','developer','🔍\x20Validating\x20developer\x20API\x20key\x20against\x20backend...','pvGjs','📋\x20Using\x20cached\x20API\x20key\x20validation\x20result','⚠️\x20No\x20network\x20connectivity\x20detected','No\x20network\x20connection\x20available.\x20Please\x20check\x20your\x20internet\x20connection\x20and\x20try\x20again.','rSEpi','OnairosReactNative/3.3.1','3.3.1','uhMFh','mNwDq','No\x20response\x20received\x20from\x20server','Onairos\x20API\x20is\x20temporarily\x20unavailable\x20(502\x20Bad\x20Gateway).\x20Please\x20try\x20again\x20later.','Onairos\x20API\x20request\x20timed\x20out\x20(504\x20Gateway\x20Timeout).\x20Please\x20try\x20again.','content-type','unknown','<html','<!DOCTYPE','PxouK','aerNR','JZvWj','iwTxm','ENOTFOUND','🌐\x20Network\x20error\x20during\x20API\x20key\x20validation:','All\x20retry\x20attempts\x20exhausted','iYqVa','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','now','timestamp','Wnmbi','gxNsN','wRYWK','vhSBE','kiEXw','result','eNQPK','juEdE','rwcow','abort','XGAcB','🔄\x20Retry\x20attempt\x20','\x20for\x20API\x20key\x20validation','Bearer\x20','rDFNU','signal','iPBlm','RdTVb','VxEmw','status','sXIli','iLMtT','XzXXh','ZqNcv','headers','get','bwubV','text','substring','statusText','dvYmE','XfttG','API\x20validation\x20endpoint\x20not\x20found\x20(404).\x20The\x20endpoint\x20','HwJyA','Server\x20error\x20(500).\x20The\x20Onairos\x20backend\x20is\x20experiencing\x20issues.','iXVXr',').\x20The\x20Onairos\x20backend\x20may\x20be\x20temporarily\x20down.','RGZLE','pRVVb','Oegca','lLaqa','📡\x20Developer\x20request\x20response:\x20','\x20for\x20','Server\x20returned\x20HTML\x20page\x20instead\x20of\x20JSON\x20API\x20response.\x20This\x20often\x20indicates\x20a\x20routing\x20issue\x20or\x20server\x20misconfiguration.','API\x20validation\x20endpoint\x20returned\x20','.\x20Expected\x20JSON\x20but\x20got\x20','mirSb','asKkU','Ehape','json','message','fSNLb','rhUMf','set','LOLlS','rNdzl','yJous','GUPhE','UvyCz','xzVTq','application','name','tlIWc','NYOkH','🌐\x20Making\x20developer\x20request\x20to:\x20','HTTP\x20','Zmrda','OhTMF','❌\x20API\x20key\x20validation\x20failed\x20(client\x20error):','DEmeK','rmSQF','API\x20key\x20validation\x20timeout\x20(','ms)','NOzvQ','Network\x20error\x20during\x20API\x20key\x20validation:\x20','sCGlg','yOQgs','YKAHy','iOhHX','Network\x20connectivity\x20issue.\x20Please\x20check\x20internet\x20connection\x20and\x20verify\x20the\x20Onairos\x20API\x20is\x20accessible.\x20','MjewY','gHbge','MZIwb','WcHOX','.\x20Please\x20check\x20network\x20settings\x20and\x20domain\x20accessibility.\x20','xPiHL','/dev/validate-apikey','min','EIYMI','pow','GZtPA','ZtRxL','nwJJw','⏳\x20Waiting\x20','ms\x20before\x20retry...','DNS\x20resolution\x20failed\x20for\x20','emJjX','API\x20key\x20validation\x20error:\x20','kJTqh','uVapf','🎫\x20JWT\x20token\x20stored\x20successfully','❌\x20Failed\x20to\x20store\x20JWT\x20token:','AgZep','FZkjh','jQzqt','3|0|4|2|1','⚠️\x20API\x20key\x20validation\x20failed\x20due\x20to\x20network/connectivity\x20issues','❌\x20Failed\x20to\x20load\x20JWT\x20token:','pUKVy','XNszX','XgLvU','QesKd','split','VGfiE','kkliU','glYPm','fZpan','MbXic','oJhXO','zmTwM','HKEkC','📡\x20User\x20request\x20response:\x20','removeItem','rGMRM','xIKSX','loCZL','❌\x20Failed\x20to\x20clear\x20JWT\x20token:','ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/','indexOf','charAt','doHGM','VxHrX','fromCharCode','UMFGj','OCrDC','hOswV','POpYv','mwwOV','tjkrr','❌\x20Failed\x20to\x20decode\x20JWT\x20token:','ufYjS','uYomy','lYFHO','aWMTl','BZYDl','VuyXi','OiWZb','EgcOd','ZgZua','WxoAF','KsUqh','⚠️\x20No\x20JWT\x20token\x20available\x20for\x20username\x20extraction','yTSAr','gzkja','LRfFB','paSwi','👤\x20Extracted\x20username\x20from\x20JWT:','oGJsl','yBfFy','HfLvu','TbvLj','ajUiS','userName','dqAIv','NcnEf','kThCs','qepjt','ruDXC','HvRNz','KbNbm','WGxSQ','✅\x20API\x20key\x20validation\x20successful','cwDUG','gJoJC','❌\x20Failed\x20to\x20extract\x20user\x20data\x20from\x20JWT:','gpShc','skdEd','coFFb','gKdSq','iRYtj','cNxyf','kUTbH','DzzrF','usageCount','HrDNt','hOgzo','OnairosReactNative/3.0.72','sGkPD','SDK\x20not\x20initialized.\x20Call\x20initializeApiKey()\x20first.','MTvrl','wEzEP','fZPPA','rsNHL','unknown\x20content\x20type','VEgGN','OnairosSDK/1.0.0','3.0.72','avSzU','BpUAr','\x20-\x20','AxCrV','grzKc','fuqjc','rABwi','cOsRs','UzrsL','iKcfC','EFSNY','Service\x20unavailable\x20(','User\x20not\x20authenticated.\x20Please\x20verify\x20email\x20first.','IhilX','hAkvl','❌\x20Developer\x20API\x20key\x20permissions\x20insufficient','Insufficient\x20API\x20key\x20permissions','hAxWR','dJRMO','❌\x20API\x20rate\x20limit\x20exceeded.\x20Please\x20try\x20again\x20later.','nJBpG','IXmHw','ziyzF','LZzIS','IRpwB','UAxAS','FoCDe','uDdhw','ffVtD','aOWav','kngNI','mhRtQ','🌐\x20Making\x20authenticated\x20request\x20to:\x20','IUEcU','📡\x20Response\x20status:\x20','WimjL','jXYeO','WkvbP','DPODc','oOGEG','Rate\x20limit\x20exceeded','AZjrC','TBlWR','sVciL','BNINM','gHPXB','🗑️\x20JWT\x20token\x20cleared','❌\x20Failed\x20to\x20parse\x20JSON\x20response:','XpIat','wHjCD','puHOa','VqrGk','Invalid\x20or\x20expired\x20API\x20key','ivpNg','DXtpC','tuTCc','xuEdO','jbCKn','EcNQR','Qbkkp','pnxJl','YTxBi','MIBGb','FJkHU','xIzLb','NLrmJ','nNAJO','tunEj','fCZVB','xfygb','FjNjb','rmwkW','hqbPL','DmfXb','GZxvq','kutLm','zXiGr','TtGNB','Xupwz','kIuLX','WrgGw','❌\x20API\x20rate\x20limit\x20exceeded','RYsPa','oQEMA','TEWla','PPDja','nfAgo','sJmyN','gRAWL','❌\x20Failed\x20to\x20initialize\x20Onairos\x20SDK:','❌\x20JWT\x20token\x20authentication\x20failed\x20-\x20token\x20may\x20be\x20expired','Authentication\x20expired.\x20Please\x20verify\x20email\x20again.','Insufficient\x20permissions\x20for\x20this\x20operation','drZSo','nXTdg','yiKfO','BDGxs','UEdJE','Ogtds','IeQeO','🌐\x20Making\x20user\x20request\x20to:\x20','nYusP','MIVLD','lsHaD','uowSp','swYnM','❌\x20JWT\x20token\x20permissions\x20insufficient','rWTyC','REZVd','IvSKD','JKCQy','🗑️\x20API\x20key\x20validation\x20cache\x20cleared','clear','wqshZ','🔄\x20API\x20key\x20service\x20reset','GEXNY','VotDD'];_0x1047=function(){return _0x390d95;};return _0x1047();}export const isUserAuthenticated=()=>{return!!userToken;};export const getAuthHeaders=()=>{const _0x58be06={'sGkPD':function(_0x6c6068,_0x507f38){return _0x6c6068!==_0x507f38;},'MTvrl':function(_0x3a87ac,_0x321ff8){return _0x3a87ac(_0x321ff8);},'wEzEP':_0x28a3(0x14e),'fZPPA':'3.0.72','rsNHL':_0x28a3(0x22)};var _0x2e3b78;if(!(_0x58be06[_0x28a3(0x14f)](_0x2e3b78=globalConfig,null)&&_0x2e3b78!==void 0x0&&_0x2e3b78['apiKey']))throw new Error(_0x28a3(0x150));const _0x4d96b9=_0x58be06[_0x28a3(0x151)](getApiKeyType,globalConfig[_0x28a3(0x3c)]);return{'Content-Type':'application/json','Authorization':_0x28a3(0xa1)+globalConfig['apiKey'],'User-Agent':_0x58be06[_0x28a3(0x152)],'X-SDK-Version':_0x58be06[_0x28a3(0x153)],'X-SDK-Environment':globalConfig[_0x28a3(0x4f)]||_0x58be06[_0x28a3(0x154)],'X-API-Key-Type':_0x4d96b9,'X-Timestamp':new Date()['toISOString']()};};export const getDeveloperAuthHeaders=()=>{const _0x48b439={'hOhDs':function(_0x4aa71f,_0x3a4374){return _0x4aa71f||_0x3a4374;},'AxCrV':_0x28a3(0x155),'avSzU':function(_0x383f9b,_0x4ed4dd){return _0x383f9b!==_0x4ed4dd;},'BpUAr':_0x28a3(0x156),'grzKc':'SDK\x20not\x20initialized.\x20Call\x20initializeApiKey()\x20first.','fuqjc':function(_0x5ce3eb,_0x55c23f){return _0x5ce3eb(_0x55c23f);},'rABwi':_0x28a3(0x157),'mTMrS':_0x28a3(0x158),'cOsRs':_0x28a3(0x22)};var _0x3f88ad;if(!(_0x48b439[_0x28a3(0x159)](_0x3f88ad=globalConfig,null)&&_0x48b439[_0x28a3(0x159)](_0x3f88ad,void 0x0)&&_0x3f88ad['apiKey'])){if(_0x48b439[_0x28a3(0x159)](_0x28a3(0x156),_0x48b439[_0x28a3(0x15a)]))throw new _0xa87822(_0x28a3(0xc0)+_0x4840ec[_0x28a3(0xa7)]+_0x28a3(0x15b)+_0x2c0d74[_0x28a3(0xb1)]+'.\x20Expected\x20JSON\x20but\x20got\x20'+_0x48b439['hOhDs'](_0x1baed8,_0x48b439[_0x28a3(0x15c)])+'.');else throw new Error(_0x48b439[_0x28a3(0x15d)]);}const _0x1f9351=_0x48b439[_0x28a3(0x15e)](getApiKeyType,globalConfig[_0x28a3(0x3c)]);return{'Content-Type':'application/json','Authorization':'Bearer\x20'+globalConfig[_0x28a3(0x3c)],'User-Agent':_0x48b439[_0x28a3(0x15f)],'X-SDK-Version':_0x48b439['mTMrS'],'X-SDK-Environment':globalConfig[_0x28a3(0x4f)]||_0x48b439[_0x28a3(0x160)],'X-API-Key-Type':_0x1f9351,'X-Timestamp':new Date()['toISOString']()};};export const getUserAuthHeaders=()=>{const _0xe66bf1={'iKcfC':function(_0x40235b,_0x5f3a73){return _0x40235b!==_0x5f3a73;},'EFSNY':_0x28a3(0x161),'IhilX':'OnairosSDK/1.0.0','mAtjx':_0x28a3(0x158),'hAkvl':function(_0x19f097,_0x1aaa52){return _0x19f097===_0x1aaa52;},'SVWlT':_0x28a3(0x22)};var _0x4f5086;if(!userToken){if(_0xe66bf1[_0x28a3(0x162)]('UzrsL',_0xe66bf1[_0x28a3(0x163)]))throw new _0x170b28(_0x28a3(0x164)+_0x16c855[_0x28a3(0xa7)]+_0x28a3(0xb8));else throw new Error(_0x28a3(0x165));}return{'Content-Type':'application/json','Authorization':'Bearer\x20'+userToken,'User-Agent':_0xe66bf1[_0x28a3(0x166)],'X-SDK-Version':_0xe66bf1['mAtjx'],'X-SDK-Environment':((_0x4f5086=globalConfig)===null||_0xe66bf1[_0x28a3(0x167)](_0x4f5086,void 0x0)?void 0x0:_0x4f5086['environment'])||_0xe66bf1['SVWlT']};};export const makeAuthenticatedRequest=async(_0x2f56a1,_0x59f84b={})=>{const _0x282b73={'IRpwB':_0x28a3(0x168),'UAxAS':_0x28a3(0x169),'kngNI':'❌\x20API\x20key\x20authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key.','mhRtQ':'Invalid\x20or\x20expired\x20API\x20key','sVciL':function(_0x3853b4,_0x3de247){return _0x3853b4>=_0x3de247;},'IXmHw':function(_0x5be389){return _0x5be389();},'ziyzF':function(_0x212301,_0x5a51d4){return _0x212301!==_0x5a51d4;},'LZzIS':_0x28a3(0x16a),'FoCDe':'SDK\x20not\x20initialized.\x20Call\x20initializeApiKey()\x20first.','uDdhw':'production','ffVtD':function(_0x577246,_0x119027,_0x2ed7c3){return _0x577246(_0x119027,_0x2ed7c3);},'aOWav':_0x28a3(0x16b),'IUEcU':function(_0x449a43,_0x58ff9d){return _0x449a43(_0x58ff9d);},'WimjL':function(_0x309918,_0x4a64c7){return _0x309918===_0x4a64c7;},'jXYeO':function(_0x4d06f4,_0x55f758){return _0x4d06f4===_0x55f758;},'WkvbP':'FFhmp','DPODc':function(_0x55e436,_0x53d1ef){return _0x55e436===_0x53d1ef;},'oOGEG':_0x28a3(0x16c),'AZjrC':function(_0x598a3e,_0x97c12e){return _0x598a3e(_0x97c12e);},'TBlWR':_0x28a3(0x76),'BzLin':_0x28a3(0x16d),'BNINM':_0x28a3(0x15),'gHPXB':_0x28a3(0x16)};if(!_0x282b73[_0x28a3(0x16e)](isApiKeyInitialized)){if(_0x282b73[_0x28a3(0x16f)](_0x28a3(0x16a),_0x282b73[_0x28a3(0x170)])){_0x489d6c[_0x28a3(0x10)](_0x282b73[_0x28a3(0x171)]);throw new _0x2ddd02(_0x282b73[_0x28a3(0x172)]);}else throw new Error(_0x282b73[_0x28a3(0x173)]);}const _0x537078=_0x282b73[_0x28a3(0x16e)](getApiConfig),_0xacb84a=API_ENDPOINTS[_0x537078[_0x28a3(0x4f)]||_0x282b73[_0x28a3(0x174)]],_0x5b2442=''+_0xacb84a+(_0x2f56a1[_0x28a3(0x4b)]('/')?'':'/')+_0x2f56a1,_0x46f863={...getAuthHeaders(),..._0x59f84b[_0x28a3(0xac)]||{}},_0x12d771=new AbortController(),_0x50d03e=_0x282b73[_0x28a3(0x175)](setTimeout,()=>_0x12d771[_0x28a3(0x9d)](),_0x537078[_0x28a3(0x25)]||0x7530);try{if(_0x282b73[_0x28a3(0x16f)](_0x282b73['aOWav'],_0x282b73[_0x28a3(0x176)])){_0x4fc0ce[_0x28a3(0x10)](_0x282b73[_0x28a3(0x177)]);throw new _0x29bc50(_0x282b73[_0x28a3(0x178)]);}else{_0x537078[_0x28a3(0x38)]&&console[_0x28a3(0x39)](_0x28a3(0x179)+_0x2f56a1);const _0x56891a=await fetch(_0x5b2442,{..._0x59f84b,'headers':_0x46f863,'signal':_0x12d771[_0x28a3(0xa3)]});_0x282b73[_0x28a3(0x17a)](clearTimeout,_0x50d03e);_0x537078[_0x28a3(0x38)]&&console['log'](_0x28a3(0x17b)+_0x56891a[_0x28a3(0xa7)]+_0x28a3(0xbe)+_0x2f56a1);if(_0x282b73[_0x28a3(0x17c)](_0x56891a[_0x28a3(0xa7)],0x191)){if(_0x282b73[_0x28a3(0x17d)](_0x282b73[_0x28a3(0x17e)],_0x282b73['WkvbP'])){console['error'](_0x282b73['kngNI']);throw new Error(_0x282b73[_0x28a3(0x178)]);}else throw new _0x579071('User\x20not\x20authenticated.\x20Please\x20verify\x20email\x20first.');}if(_0x282b73[_0x28a3(0x17f)](_0x56891a[_0x28a3(0xa7)],0x193)){console['error']('❌\x20API\x20key\x20permissions\x20insufficient\x20for\x20this\x20operation.');throw new Error(_0x282b73[_0x28a3(0x172)]);}if(_0x56891a[_0x28a3(0xa7)]===0x1ad){console[_0x28a3(0x10)](_0x282b73[_0x28a3(0x180)]);throw new Error(_0x28a3(0x181));}return _0x56891a;}}catch(_0x370442){_0x282b73[_0x28a3(0x182)](clearTimeout,_0x50d03e);if(_0x370442[_0x28a3(0xd1)]===_0x282b73[_0x28a3(0x183)]){if(_0x28a3(0x16d)!==_0x282b73['BzLin']){if(_0x282b73[_0x28a3(0x184)](_0x46473c['length'],0x20)&&(_0x230639[_0x28a3(0x4b)]('dev_')||_0x5a7491[_0x28a3(0x4b)]('pk_')||_0x5c5a1e[_0x28a3(0x4b)](_0x28a3(0x73))))return _0x38dfef[_0x28a3(0x0)];return _0x365e55['INVALID'];}else{console[_0x28a3(0x10)](_0x282b73[_0x28a3(0x185)],_0x2f56a1);throw new Error(_0x282b73[_0x28a3(0x186)]);}}throw _0x370442;}};export const makeDeveloperRequest=async(_0x3426de,_0x122504={})=>{const _0x302a34={'xIzLb':_0x28a3(0x187),'rmwkW':_0x28a3(0x188),'GZxvq':function(_0x135ae6,_0x7eb4c){return _0x135ae6!==_0x7eb4c;},'kutLm':function(_0x3c932d,_0x4d8d7e){return _0x3c932d!==_0x4d8d7e;},'jbCKn':_0x28a3(0x150),'zXiGr':function(_0x4a1c76,_0x5a0ffe){return _0x4a1c76(_0x5a0ffe);},'TtGNB':_0x28a3(0x14e),'Qbkkp':_0x28a3(0x22),'oQEMA':_0x28a3(0x130),'xuEdO':function(_0x5c5b16){return _0x5c5b16();},'EcNQR':function(_0x1331dc){return _0x1331dc();},'WEAkv':function(_0x29666f){return _0x29666f();},'pnxJl':function(_0x3b436a,_0x51afd0,_0x1ab7f2){return _0x3b436a(_0x51afd0,_0x1ab7f2);},'YTxBi':function(_0x34d6d0,_0x19f4ec){return _0x34d6d0===_0x19f4ec;},'MIBGb':_0x28a3(0x189),'FJkHU':'PXLHh','NLrmJ':function(_0x115507,_0x30780c){return _0x115507(_0x30780c);},'nNAJO':_0x28a3(0x18a),'tunEj':_0x28a3(0x18b),'fCZVB':function(_0x45b98b,_0xb93d1c){return _0x45b98b===_0xb93d1c;},'xfygb':_0x28a3(0x18c),'hqbPL':_0x28a3(0x18d),'vcniP':function(_0x3ec44a,_0xf6884c){return _0x3ec44a!==_0xf6884c;},'DmfXb':_0x28a3(0x18e),'Xupwz':'❌\x20Developer\x20API\x20key\x20permissions\x20insufficient','kIuLX':_0x28a3(0x169),'TEWla':function(_0x2dfe49,_0x4f7edf){return _0x2dfe49===_0x4f7edf;},'WrgGw':function(_0x4c4757,_0x22d8ee){return _0x4c4757===_0x22d8ee;},'saoDv':_0x28a3(0x18f),'RYsPa':_0x28a3(0x181),'PPDja':_0x28a3(0x190),'nfAgo':function(_0x2290bf,_0x3e9b55){return _0x2290bf(_0x3e9b55);},'sJmyN':_0x28a3(0x76),'gRAWL':_0x28a3(0x15)};if(!_0x302a34[_0x28a3(0x191)](isApiKeyInitialized))throw new Error(_0x302a34[_0x28a3(0x192)]);const _0x46dd36=_0x302a34[_0x28a3(0x193)](getApiConfig),_0xb34b4e=API_ENDPOINTS[_0x46dd36[_0x28a3(0x4f)]||_0x302a34[_0x28a3(0x194)]],_0x609361=''+_0xb34b4e+(_0x3426de[_0x28a3(0x4b)]('/')?'':'/')+_0x3426de,_0x47849e={..._0x302a34['WEAkv'](getDeveloperAuthHeaders),..._0x122504['headers']||{}},_0x197eef=new AbortController(),_0x10486b=_0x302a34[_0x28a3(0x195)](setTimeout,()=>_0x197eef[_0x28a3(0x9d)](),_0x46dd36[_0x28a3(0x25)]||0x7530);try{if(_0x302a34[_0x28a3(0x196)](_0x302a34[_0x28a3(0x197)],_0x302a34[_0x28a3(0x198)]))_0x13d8f0['log'](_0x302a34[_0x28a3(0x199)]);else{_0x46dd36[_0x28a3(0x38)]&&console['log'](_0x28a3(0xd4)+_0x3426de);const _0x37907e=await fetch(_0x609361,{..._0x122504,'headers':_0x47849e,'signal':_0x197eef[_0x28a3(0xa3)]});_0x302a34[_0x28a3(0x19a)](clearTimeout,_0x10486b);if(_0x46dd36[_0x28a3(0x38)]){if(_0x302a34[_0x28a3(0x196)](_0x302a34[_0x28a3(0x19b)],_0x302a34[_0x28a3(0x19c)]))return null;else console[_0x28a3(0x39)]('📡\x20Developer\x20request\x20response:\x20'+_0x37907e['status']+_0x28a3(0xbe)+_0x3426de);}if(_0x302a34[_0x28a3(0x19d)](_0x37907e[_0x28a3(0xa7)],0x191)){if(_0x302a34[_0x28a3(0x196)](_0x302a34[_0x28a3(0x19e)],_0x28a3(0x19f))){_0x44e3b1[_0x28a3(0x10)](_0x302a34[_0x28a3(0x1a0)],{'error':_0x4f3490['message'],'status':_0x4bf08c[_0x28a3(0xa7)],'contentType':_0xaa86fd,'attempt':_0x4dbf41});throw new _0x14e61f('Failed\x20to\x20parse\x20server\x20response\x20as\x20JSON:\x20'+_0x973ea1[_0x28a3(0xc6)]);}else{console[_0x28a3(0x10)](_0x28a3(0x11));throw new Error(_0x302a34[_0x28a3(0x1a1)]);}}if(_0x302a34[_0x28a3(0x19d)](_0x37907e['status'],0x193)){if(_0x302a34['vcniP'](_0x302a34[_0x28a3(0x1a2)],_0x28a3(0x18e))){var _0x13c284;if(!(_0x302a34[_0x28a3(0x1a3)](_0x13c284=_0x14d4a1,null)&&_0x302a34[_0x28a3(0x1a4)](_0x13c284,void 0x0)&&_0x13c284[_0x28a3(0x3c)]))throw new _0x33f676(_0x302a34['jbCKn']);const _0x1a3e71=_0x302a34[_0x28a3(0x1a5)](_0x5377ee,_0x47edd3['apiKey']);return{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0x204b5e['apiKey'],'User-Agent':_0x302a34[_0x28a3(0x1a6)],'X-SDK-Version':_0x28a3(0x158),'X-SDK-Environment':_0x381b0e[_0x28a3(0x4f)]||_0x302a34[_0x28a3(0x194)],'X-API-Key-Type':_0x1a3e71,'X-Timestamp':new _0xc00fa0()['toISOString']()};}else{console[_0x28a3(0x10)](_0x302a34[_0x28a3(0x1a7)]);throw new Error(_0x302a34[_0x28a3(0x1a8)]);}}if(_0x302a34['TEWla'](_0x37907e['status'],0x1ad)){if(_0x302a34[_0x28a3(0x1a9)](_0x302a34['saoDv'],_0x28a3(0x18f))){console[_0x28a3(0x10)](_0x28a3(0x1aa));throw new Error(_0x302a34[_0x28a3(0x1ab)]);}else _0xc5142e['log'](_0x302a34[_0x28a3(0x1ac)],_0x5d598b);}return _0x37907e;}}catch(_0x2efc87){if(_0x302a34[_0x28a3(0x1ad)](_0x302a34[_0x28a3(0x1ae)],_0x302a34[_0x28a3(0x1ae)])){_0x302a34[_0x28a3(0x1af)](clearTimeout,_0x10486b);if(_0x302a34[_0x28a3(0x1ad)](_0x2efc87[_0x28a3(0xd1)],_0x302a34[_0x28a3(0x1b0)])){console[_0x28a3(0x10)](_0x302a34[_0x28a3(0x1b1)],_0x3426de);throw new Error(_0x28a3(0x16));}throw _0x2efc87;}else _0x2eb0c8[_0x28a3(0x39)](_0x28a3(0x9f)+_0x25111a+'/'+_0x4a11c9+'\x20for\x20API\x20key\x20validation');}};export const makeUserRequest=async(_0x35e79d,_0x58968d={})=>{const _0x2ca228={'OQUZg':_0x28a3(0x1b2),'nXTdg':function(_0x2e8c02){return _0x2e8c02();},'yiKfO':function(_0x59d57c,_0x414995){return _0x59d57c===_0x414995;},'UEdJE':function(_0x5d31e9){return _0x5d31e9();},'Ogtds':'production','IeQeO':function(_0x5c3454,_0xdf2f13,_0x1e5077){return _0x5c3454(_0xdf2f13,_0x1e5077);},'nYusP':function(_0x288103,_0xb839e7){return _0x288103(_0xb839e7);},'MIVLD':function(_0x473838,_0x1347da){return _0x473838===_0x1347da;},'lsHaD':_0x28a3(0x1b3),'uowSp':function(_0x57e375){return _0x57e375();},'swYnM':_0x28a3(0x1b4),'sKQfh':function(_0x372b8b,_0x327eda){return _0x372b8b===_0x327eda;},'rWTyC':_0x28a3(0x1b5),'REZVd':function(_0x42e122,_0xb49d82){return _0x42e122!==_0xb49d82;},'tlEJt':_0x28a3(0x1b6),'IvSKD':_0x28a3(0x15),'JKCQy':_0x28a3(0x16)};if(!_0x2ca228[_0x28a3(0x1b7)](isUserAuthenticated)){if(_0x2ca228[_0x28a3(0x1b8)]('BDGxs',_0x28a3(0x1b9)))await _0x2ca228[_0x28a3(0x1ba)](loadJWT);else{_0x144798[_0x28a3(0x10)](_0x2ca228['OQUZg'],_0x522e7d),_0x6cfbb3=![];throw _0x76d1fb;}}if(!_0x2ca228[_0x28a3(0x1ba)](isUserAuthenticated))throw new Error(_0x28a3(0x165));const _0x3563cd=getApiConfig()||{'environment':_0x2ca228[_0x28a3(0x1bb)],'timeout':0x7530,'enableLogging':![]},_0x3e22a4=API_ENDPOINTS[_0x3563cd[_0x28a3(0x4f)]||_0x2ca228[_0x28a3(0x1bb)]],_0x5f2271=''+_0x3e22a4+(_0x35e79d['startsWith']('/')?'':'/')+_0x35e79d,_0x33b7d9={..._0x2ca228[_0x28a3(0x1b7)](getUserAuthHeaders),..._0x58968d[_0x28a3(0xac)]||{}},_0xc8e7a8=new AbortController(),_0x44cd07=_0x2ca228[_0x28a3(0x1bc)](setTimeout,()=>_0xc8e7a8['abort'](),_0x3563cd[_0x28a3(0x25)]||0x7530);try{_0x3563cd['enableLogging']&&console[_0x28a3(0x39)](_0x28a3(0x1bd)+_0x35e79d);const _0x804a9c=await _0x2ca228[_0x28a3(0x1bc)](fetch,_0x5f2271,{..._0x58968d,'headers':_0x33b7d9,'signal':_0xc8e7a8[_0x28a3(0xa3)]});_0x2ca228[_0x28a3(0x1be)](clearTimeout,_0x44cd07);_0x3563cd['enableLogging']&&console[_0x28a3(0x39)](_0x28a3(0x10d)+_0x804a9c[_0x28a3(0xa7)]+_0x28a3(0xbe)+_0x35e79d);if(_0x2ca228[_0x28a3(0x1bf)](_0x804a9c[_0x28a3(0xa7)],0x191)){console[_0x28a3(0x10)](_0x2ca228[_0x28a3(0x1c0)]),await _0x2ca228[_0x28a3(0x1c1)](clearJWT);throw new Error(_0x2ca228[_0x28a3(0x1c2)]);}if(_0x2ca228['sKQfh'](_0x804a9c[_0x28a3(0xa7)],0x193)){console[_0x28a3(0x10)](_0x28a3(0x1c3));throw new Error(_0x2ca228[_0x28a3(0x1c4)]);}return _0x804a9c;}catch(_0x530458){_0x2ca228[_0x28a3(0x1be)](clearTimeout,_0x44cd07);if(_0x2ca228['MIVLD'](_0x530458['name'],_0x28a3(0x76))){if(_0x2ca228[_0x28a3(0x1c5)](_0x2ca228['tlEJt'],'drZSo'))_0x24f4af[_0x28a3(0x39)](_0x28a3(0x1bd)+_0x8bf6ac);else{console[_0x28a3(0x10)](_0x2ca228[_0x28a3(0x1c6)],_0x35e79d);throw new Error(_0x2ca228[_0x28a3(0x1c7)]);}}throw _0x530458;}};export const clearValidationCache=()=>{const _0x3f170={'wQWVH':function(_0x40cebb,_0x2aad70){return _0x40cebb!==_0x2aad70;},'wqshZ':function(_0xaadd57,_0x138d68){return _0xaadd57!==_0x138d68;},'wUPVG':_0x28a3(0x1c8)};var _0x58852f;validationCache[_0x28a3(0x1c9)](),_0x3f170['wQWVH'](_0x58852f=globalConfig,null)&&_0x3f170[_0x28a3(0x1ca)](_0x58852f,void 0x0)&&_0x58852f[_0x28a3(0x38)]&&console[_0x28a3(0x39)](_0x3f170['wUPVG']);};export const resetApiKeyService=()=>{const _0x5189e7={'GEXNY':function(_0x14b66d){return _0x14b66d();},'VotDD':_0x28a3(0x1cb)};globalConfig=null,isInitialized=![],_0x5189e7[_0x28a3(0x1cc)](clearValidationCache),console['log'](_0x5189e7[_0x28a3(0x1cd)]);};
|