@onairos/react-native 3.4.1 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +423 -374
- package/lib/commonjs/api/index.js +9 -145
- package/lib/commonjs/assets/animations/loaderani.json +1 -0
- package/lib/commonjs/assets/animations/persona-animation.json +1 -0
- package/lib/commonjs/assets/fonts/EBGaramond-VariableFont_wght.ttf +0 -0
- package/lib/commonjs/assets/fonts/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
- package/lib/commonjs/assets/icons/Facebookicon.png +0 -0
- package/lib/commonjs/assets/icons/Gmail.png +0 -0
- package/lib/commonjs/assets/icons/Linkedinicon.png +0 -0
- package/lib/commonjs/assets/icons/Redditicon.png +0 -0
- package/lib/commonjs/assets/icons/YouTubeicon2.png +0 -0
- package/lib/commonjs/assets/icons/YouTubeicon3.png +0 -0
- package/lib/commonjs/assets/icons/chatgpt.png +0 -0
- package/lib/commonjs/assets/icons/claude.png +0 -0
- package/lib/commonjs/assets/icons/gemini.png +0 -0
- package/lib/commonjs/assets/icons/grok.png +0 -0
- package/lib/commonjs/assets/images/Checkbox.svg +3 -0
- package/lib/commonjs/assets/images/EnochE.svg +19 -0
- package/lib/commonjs/assets/images/Enochicon1.png +0 -0
- package/lib/commonjs/assets/images/Face_ID_logo.png +0 -0
- package/lib/commonjs/assets/images/Facebookicon.png +0 -0
- package/lib/commonjs/assets/images/Gmail.png +0 -0
- package/lib/commonjs/assets/images/Googlelogo.png +0 -0
- package/lib/commonjs/assets/images/Linkedinicon.png +0 -0
- package/lib/commonjs/assets/images/OnairosNewLogo.png +0 -0
- package/lib/commonjs/assets/images/Onairoslogo.png +0 -0
- package/lib/commonjs/assets/images/Personalityprofile.svg +3 -0
- package/lib/commonjs/assets/images/Personalitytraits.svg +3 -0
- package/lib/commonjs/assets/images/Redditicon.png +0 -0
- package/lib/commonjs/assets/images/Userpreferences.svg +3 -0
- package/lib/commonjs/assets/images/YouTubeicon3.png +0 -0
- package/lib/commonjs/assets/images/arrow.svg +20 -0
- package/lib/commonjs/assets/images/basicproficon.svg +43 -0
- package/lib/commonjs/assets/images/basicprofile.svg +3 -0
- package/lib/commonjs/assets/images/chatgpt.png +0 -0
- package/lib/commonjs/assets/images/checkmark.svg +4 -0
- package/lib/commonjs/assets/images/claude.png +0 -0
- package/lib/commonjs/assets/images/contentanalysis.svg +3 -0
- package/lib/commonjs/assets/images/contenticon.svg +23 -0
- package/lib/commonjs/assets/images/gemini.png +0 -0
- package/lib/commonjs/assets/images/grok.png +0 -0
- package/lib/commonjs/assets/images/persona1.png +0 -0
- package/lib/commonjs/assets/images/persona2.png +0 -0
- package/lib/commonjs/assets/images/persona3.png +0 -0
- package/lib/commonjs/assets/images/persona4.png +0 -0
- package/lib/commonjs/assets/images/persona5.png +0 -0
- package/lib/commonjs/assets/images/personalityicon.svg +18 -0
- package/lib/commonjs/assets/images/x-close.svg +3 -0
- package/lib/commonjs/components/BodyText.js +9 -0
- package/lib/commonjs/components/BrandMark.js +10 -0
- package/lib/commonjs/components/CodeInput.js +9 -0
- package/lib/commonjs/components/EmailInput.js +8 -0
- package/lib/commonjs/components/GoogleButton.js +9 -0
- package/lib/commonjs/components/HeadingGroup.js +9 -0
- package/lib/commonjs/components/LLMDataInputModal.js +14 -0
- package/lib/commonjs/components/ModalHeader.js +9 -0
- package/lib/commonjs/components/ModalSheet.js +9 -0
- package/lib/commonjs/components/Onairos.js +14 -374
- package/lib/commonjs/components/OnairosButton.js +13 -309
- package/lib/commonjs/components/OnairosSignInButton.js +12 -0
- package/lib/commonjs/components/Overlay.js +13 -483
- package/lib/commonjs/components/PersonaImage.js +10 -0
- package/lib/commonjs/components/PersonaLoadingScreen.js +12 -0
- package/lib/commonjs/components/PersonalizationConsentScreen.js +13 -0
- package/lib/commonjs/components/PinCreationScreen.js +12 -0
- package/lib/commonjs/components/PinInput.js +9 -302
- package/lib/commonjs/components/PlatformConnectorsStep.js +23 -0
- package/lib/commonjs/components/PlatformList.js +10 -137
- package/lib/commonjs/components/PlatformToggle.js +9 -0
- package/lib/commonjs/components/PrimaryButton.js +10 -0
- package/lib/commonjs/components/SignInMatchAnimation.js +9 -0
- package/lib/commonjs/components/SignInStep.js +12 -0
- package/lib/commonjs/components/UniversalOnboarding.js +30 -1702
- package/lib/commonjs/components/VerificationStep.js +11 -0
- package/lib/commonjs/components/WelcomeScreen.js +22 -0
- package/lib/commonjs/components/icons/Basicproficon.js +8 -0
- package/lib/commonjs/components/icons/Basicprofile.js +8 -0
- package/lib/commonjs/components/icons/Checkbox.js +8 -0
- package/lib/commonjs/components/icons/Checkmark.js +8 -0
- package/lib/commonjs/components/icons/Contentanalysis.js +8 -0
- package/lib/commonjs/components/icons/Contenticon.js +8 -0
- package/lib/commonjs/components/icons/EnochE.js +8 -0
- package/lib/commonjs/components/icons/Personalityicon.js +8 -0
- package/lib/commonjs/components/icons/Personalityprofile.js +8 -0
- package/lib/commonjs/components/icons/Personalitytraits.js +8 -0
- package/lib/commonjs/components/icons/Userpreferences.js +8 -0
- package/lib/commonjs/components/icons/index.js +17 -0
- package/lib/commonjs/components/onboarding/OAuthWebView.js +18 -827
- package/lib/commonjs/components/onboarding/OnboardingHeader.js +10 -74
- package/lib/commonjs/components/onboarding/PinInput.js +10 -283
- package/lib/commonjs/components/onboarding/PlatformConnector.js +11 -249
- package/lib/commonjs/config/api.js +7 -0
- package/lib/commonjs/constants/index.js +7 -83
- package/lib/commonjs/context/AuthContext.js +10 -0
- package/lib/commonjs/hooks/useConnectedAccounts.js +9 -0
- package/lib/commonjs/hooks/useConnections.js +8 -159
- package/lib/commonjs/hooks/useCredentials.js +10 -177
- package/lib/commonjs/hooks/useUserConnections.js +10 -0
- package/lib/commonjs/index.js +34 -106
- package/lib/commonjs/services/SDK_API_KEY_VALIDATION.md +421 -421
- package/lib/commonjs/services/apiClient.js +8 -0
- package/lib/commonjs/services/apiKeyService.js +9 -952
- package/lib/commonjs/services/authService.js +10 -0
- package/lib/commonjs/services/biometricPinService.js +8 -0
- package/lib/commonjs/services/chatGPTConversationExtractor.js +8 -0
- package/lib/commonjs/services/chatGPTConversationService.js +9 -0
- package/lib/commonjs/services/claudeConversationExtractor.js +8 -0
- package/lib/commonjs/services/claudeConversationService.js +9 -0
- package/lib/commonjs/services/connectedAccountsService.js +10 -0
- package/lib/commonjs/services/googleAuthService.js +11 -0
- package/lib/commonjs/services/hingeDataExtractor.js +8 -0
- package/lib/commonjs/services/hingeDataService.js +9 -0
- package/lib/commonjs/services/imageCompressionService.js +7 -0
- package/lib/commonjs/services/instagramDataExtractor.js +8 -0
- package/lib/commonjs/services/instagramDataService.js +9 -0
- package/lib/commonjs/services/jwtStorageService.js +7 -0
- package/lib/commonjs/services/linkedinDOMExtractor.js +7 -0
- package/lib/commonjs/services/linkedinProfileService.js +9 -0
- package/lib/commonjs/services/linkedinScrapingService.js +8 -0
- package/lib/commonjs/services/llmDataStorage.js +8 -0
- package/lib/commonjs/services/mobileTrainingService.js +8 -0
- package/lib/commonjs/services/oauthService.js +11 -390
- package/lib/commonjs/services/pinEncryptionService.js +8 -0
- package/lib/commonjs/services/pinStorageUtils.js +7 -0
- package/lib/commonjs/services/platformAuthService.js +12 -1067
- package/lib/commonjs/services/sephoraDataExtractor.js +8 -0
- package/lib/commonjs/services/sephoraDataService.js +9 -0
- package/lib/commonjs/services/storageService.js +8 -0
- package/lib/commonjs/services/telegramDataExtractor.js +8 -0
- package/lib/commonjs/services/telegramDataService.js +11 -0
- package/lib/commonjs/services/trainingApiHelpers.js +7 -0
- package/lib/commonjs/services/userConnectionsService.js +10 -0
- package/lib/commonjs/services/youtubeMigrationService.js +10 -0
- package/lib/commonjs/theme/index.js +7 -0
- package/lib/commonjs/types/ambient.d.js +1 -2
- package/lib/commonjs/types/declarations.d.js +1 -2
- package/lib/commonjs/types/index.js +1 -6
- package/lib/commonjs/types/node-fix.d.js +1 -2
- package/lib/commonjs/types/node-override.d.js +1 -2
- package/lib/commonjs/types/opacity.d.js +1 -2
- package/lib/commonjs/types.js +1 -14
- package/lib/commonjs/utils/Portal.js +8 -98
- package/lib/commonjs/utils/api.js +9 -129
- package/lib/commonjs/utils/assetRegistry.js +33 -0
- package/lib/commonjs/utils/auth.js +9 -111
- package/lib/commonjs/utils/connectorTests.js +29 -0
- package/lib/commonjs/utils/crypto.js +8 -62
- package/lib/commonjs/utils/debugHelper.js +1 -64
- package/lib/commonjs/utils/encryption.js +7 -76
- package/lib/commonjs/utils/eventUtils.js +1 -0
- package/lib/commonjs/utils/haptics.js +9 -0
- package/lib/commonjs/utils/imagePreloader.js +1 -0
- package/lib/commonjs/utils/networkDiagnostics.js +8 -0
- package/lib/commonjs/utils/onairosApi.js +9 -350
- package/lib/commonjs/utils/programmaticFlow.js +9 -117
- package/lib/commonjs/utils/retryHelper.js +1 -220
- package/lib/commonjs/utils/secureStorage.js +10 -349
- package/lib/commonjs/utils/webviewScripts/chatgpt.js +1 -0
- package/lib/commonjs/utils/webviewScripts/claude.js +1 -0
- package/lib/commonjs/utils/webviewScripts/hinge.js +1 -0
- package/lib/commonjs/utils/webviewScripts/index.js +13 -0
- package/lib/commonjs/utils/webviewScripts/instagram.js +1 -0
- package/lib/commonjs/utils/webviewScripts/linkedin.js +1 -0
- package/lib/commonjs/utils/webviewScripts/sephora.js +1 -0
- package/lib/commonjs/utils/webviewScripts/telegram.js +1 -0
- package/lib/module/api/index.js +1 -139
- package/lib/module/assets/animations/loaderani.json +1 -0
- package/lib/module/assets/animations/persona-animation.json +1 -0
- package/lib/module/assets/fonts/EBGaramond-VariableFont_wght.ttf +0 -0
- package/lib/module/assets/fonts/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
- package/lib/module/assets/icons/Facebookicon.png +0 -0
- package/lib/module/assets/icons/Gmail.png +0 -0
- package/lib/module/assets/icons/Linkedinicon.png +0 -0
- package/lib/module/assets/icons/Redditicon.png +0 -0
- package/lib/module/assets/icons/YouTubeicon2.png +0 -0
- package/lib/module/assets/icons/YouTubeicon3.png +0 -0
- package/lib/module/assets/icons/chatgpt.png +0 -0
- package/lib/module/assets/icons/claude.png +0 -0
- package/lib/module/assets/icons/farcaster.png +0 -0
- package/lib/module/assets/icons/gemini.png +0 -0
- package/lib/module/assets/icons/grok.png +0 -0
- package/lib/module/assets/icons/instagram.png +0 -0
- package/lib/module/assets/icons/pinterest.png +0 -0
- package/lib/module/assets/icons/swerv_logo.png +0 -0
- package/lib/module/assets/icons/twitter.jpg +0 -0
- package/lib/module/assets/images/Checkbox.svg +3 -0
- package/lib/module/assets/images/EnochE.svg +19 -0
- package/lib/module/assets/images/Enochicon1.png +0 -0
- package/lib/module/assets/images/Face_ID_logo.png +0 -0
- package/lib/module/assets/images/Facebookicon.png +0 -0
- package/lib/module/assets/images/Gmail.png +0 -0
- package/lib/module/assets/images/Googlelogo.png +0 -0
- package/lib/module/assets/images/Linkedinicon.png +0 -0
- package/lib/module/assets/images/OnairosNewLogo.png +0 -0
- package/lib/module/assets/images/Onairoslogo.png +0 -0
- package/lib/module/assets/images/Personalityprofile.svg +3 -0
- package/lib/module/assets/images/Personalitytraits.svg +3 -0
- package/lib/module/assets/images/Redditicon.png +0 -0
- package/lib/module/assets/images/Userpreferences.svg +3 -0
- package/lib/module/assets/images/YouTubeicon3.png +0 -0
- package/lib/module/assets/images/arrow.svg +20 -0
- package/lib/module/assets/images/basicproficon.svg +43 -0
- package/lib/module/assets/images/basicprofile.svg +3 -0
- package/lib/module/assets/images/chatgpt.png +0 -0
- package/lib/module/assets/images/checkmark.svg +4 -0
- package/lib/module/assets/images/claude.png +0 -0
- package/lib/module/assets/images/contentanalysis.svg +3 -0
- package/lib/module/assets/images/contenticon.svg +23 -0
- package/lib/module/assets/images/gemini.png +0 -0
- package/lib/module/assets/images/grok.png +0 -0
- package/lib/module/assets/images/persona1.png +0 -0
- package/lib/module/assets/images/persona2.png +0 -0
- package/lib/module/assets/images/persona3.png +0 -0
- package/lib/module/assets/images/persona4.png +0 -0
- package/lib/module/assets/images/persona5.png +0 -0
- package/lib/module/assets/images/personalityicon.svg +18 -0
- package/lib/module/assets/images/x-close.svg +3 -0
- package/lib/module/components/BodyText.js +1 -0
- package/lib/module/components/BrandMark.js +1 -0
- package/lib/module/components/CodeInput.js +1 -0
- package/lib/module/components/EmailInput.js +1 -0
- package/lib/module/components/GoogleButton.js +1 -0
- package/lib/module/components/HeadingGroup.js +1 -0
- package/lib/module/components/LLMDataInputModal.js +8 -0
- package/lib/module/components/ModalHeader.js +1 -0
- package/lib/module/components/ModalSheet.js +1 -0
- package/lib/module/components/Onairos.js +1 -367
- package/lib/module/components/OnairosButton.js +1 -302
- package/lib/module/components/OnairosSignInButton.js +1 -0
- package/lib/module/components/Overlay.js +1 -474
- package/lib/module/components/PersonaImage.js +1 -0
- package/lib/module/components/PersonaLoadingScreen.js +1 -0
- package/lib/module/components/PersonalizationConsentScreen.js +1 -0
- package/lib/module/components/PinCreationScreen.js +1 -0
- package/lib/module/components/PinInput.js +1 -293
- package/lib/module/components/PlatformConnectorsStep.js +7 -0
- package/lib/module/components/PlatformList.js +1 -129
- package/lib/module/components/PlatformToggle.js +1 -0
- package/lib/module/components/PrimaryButton.js +1 -0
- package/lib/module/components/SignInMatchAnimation.js +1 -0
- package/lib/module/components/SignInStep.js +1 -0
- package/lib/module/components/UniversalOnboarding.js +1 -1693
- package/lib/module/components/VerificationStep.js +1 -0
- package/lib/module/components/WelcomeScreen.js +1 -0
- package/lib/module/components/icons/Basicproficon.js +1 -0
- package/lib/module/components/icons/Basicprofile.js +1 -0
- package/lib/module/components/icons/Checkbox.js +1 -0
- package/lib/module/components/icons/Checkmark.js +1 -0
- package/lib/module/components/icons/Contentanalysis.js +1 -0
- package/lib/module/components/icons/Contenticon.js +1 -0
- package/lib/module/components/icons/EnochE.js +1 -0
- package/lib/module/components/icons/Personalityicon.js +1 -0
- package/lib/module/components/icons/Personalityprofile.js +1 -0
- package/lib/module/components/icons/Personalitytraits.js +1 -0
- package/lib/module/components/icons/Userpreferences.js +1 -0
- package/lib/module/components/icons/index.js +1 -0
- package/lib/module/components/onboarding/OAuthWebView.js +1 -818
- package/lib/module/components/onboarding/OnboardingHeader.js +1 -66
- package/lib/module/components/onboarding/PinInput.js +1 -274
- package/lib/module/components/onboarding/PlatformConnector.js +1 -240
- package/lib/module/config/api.js +1 -0
- package/lib/module/constants/index.js +1 -77
- package/lib/module/context/AuthContext.js +1 -0
- package/lib/module/hooks/useConnectedAccounts.js +1 -0
- package/lib/module/hooks/useConnections.js +1 -152
- package/lib/module/hooks/useCredentials.js +6 -169
- package/lib/module/hooks/useUserConnections.js +1 -0
- package/lib/module/index.js +1 -32
- package/lib/module/services/SDK_API_KEY_VALIDATION.md +421 -421
- package/lib/module/services/apiClient.js +1 -0
- package/lib/module/services/apiKeyService.js +1 -925
- package/lib/module/services/authService.js +1 -0
- package/lib/module/services/biometricPinService.js +1 -0
- package/lib/module/services/chatGPTConversationExtractor.js +1 -0
- package/lib/module/services/chatGPTConversationService.js +1 -0
- package/lib/module/services/claudeConversationExtractor.js +1 -0
- package/lib/module/services/claudeConversationService.js +1 -0
- package/lib/module/services/connectedAccountsService.js +1 -0
- package/lib/module/services/googleAuthService.js +1 -0
- package/lib/module/services/hingeDataExtractor.js +1 -0
- package/lib/module/services/hingeDataService.js +1 -0
- package/lib/module/services/imageCompressionService.js +1 -0
- package/lib/module/services/instagramDataExtractor.js +1 -0
- package/lib/module/services/instagramDataService.js +1 -0
- package/lib/module/services/jwtStorageService.js +1 -0
- package/lib/module/services/linkedinDOMExtractor.js +1 -0
- package/lib/module/services/linkedinProfileService.js +1 -0
- package/lib/module/services/linkedinScrapingService.js +1 -0
- package/lib/module/services/llmDataStorage.js +1 -0
- package/lib/module/services/mobileTrainingService.js +1 -0
- package/lib/module/services/oauthService.js +1 -380
- package/lib/module/services/pinEncryptionService.js +7 -0
- package/lib/module/services/pinStorageUtils.js +1 -0
- package/lib/module/services/platformAuthService.js +1 -1041
- package/lib/module/services/sephoraDataExtractor.js +1 -0
- package/lib/module/services/sephoraDataService.js +1 -0
- package/lib/module/services/storageService.js +1 -0
- package/lib/module/services/telegramDataExtractor.js +1 -0
- package/lib/module/services/telegramDataService.js +8 -0
- package/lib/module/services/trainingApiHelpers.js +1 -0
- package/lib/module/services/userConnectionsService.js +1 -0
- package/lib/module/services/youtubeMigrationService.js +1 -0
- package/lib/module/theme/index.js +1 -0
- package/lib/module/types.js +1 -10
- package/lib/module/utils/Portal.js +1 -90
- package/lib/module/utils/api.js +1 -117
- package/lib/module/utils/assetRegistry.js +33 -0
- package/lib/module/utils/auth.js +1 -99
- package/lib/module/utils/connectorTests.js +28 -0
- package/lib/module/utils/crypto.js +1 -54
- package/lib/module/utils/debugHelper.js +1 -54
- package/lib/module/utils/encryption.js +1 -67
- package/lib/module/utils/eventUtils.js +1 -0
- package/lib/module/utils/haptics.js +8 -0
- package/lib/module/utils/imagePreloader.js +1 -0
- package/lib/module/utils/networkDiagnostics.js +1 -0
- package/lib/module/utils/onairosApi.js +1 -333
- package/lib/module/utils/programmaticFlow.js +1 -111
- package/lib/module/utils/retryHelper.js +1 -211
- package/lib/module/utils/secureStorage.js +6 -330
- package/lib/module/utils/webviewScripts/chatgpt.js +1 -0
- package/lib/module/utils/webviewScripts/claude.js +1 -0
- package/lib/module/utils/webviewScripts/hinge.js +1 -0
- package/lib/module/utils/webviewScripts/index.js +1 -0
- package/lib/module/utils/webviewScripts/instagram.js +1 -0
- package/lib/module/utils/webviewScripts/linkedin.js +1 -0
- package/lib/module/utils/webviewScripts/sephora.js +1 -0
- package/lib/module/utils/webviewScripts/telegram.js +1 -0
- package/package.json +62 -39
- package/lib/commonjs/api/index.js.map +0 -1
- package/lib/commonjs/assets/images/email.png +0 -0
- package/lib/commonjs/assets/images/linkedin.png +0 -0
- package/lib/commonjs/assets/images/reddit.png +0 -0
- package/lib/commonjs/assets/images/youtube.png +0 -0
- package/lib/commonjs/components/DataRequestModal.js +0 -228
- package/lib/commonjs/components/DataRequestModal.js.map +0 -1
- package/lib/commonjs/components/DataRequestScreen.js +0 -329
- package/lib/commonjs/components/DataRequestScreen.js.map +0 -1
- package/lib/commonjs/components/EmailVerificationModal.js +0 -320
- package/lib/commonjs/components/EmailVerificationModal.js.map +0 -1
- package/lib/commonjs/components/Onairos.js.map +0 -1
- package/lib/commonjs/components/OnairosButton.js.map +0 -1
- package/lib/commonjs/components/Overlay.js.map +0 -1
- package/lib/commonjs/components/PinInput.js.map +0 -1
- package/lib/commonjs/components/PlatformList.js.map +0 -1
- package/lib/commonjs/components/TrainingModal.js +0 -717
- package/lib/commonjs/components/TrainingModal.js.map +0 -1
- package/lib/commonjs/components/UniversalOnboarding.js.map +0 -1
- package/lib/commonjs/components/UniversalOnboarding.tsx.new +0 -455
- package/lib/commonjs/components/onboarding/OAuthWebView.js.map +0 -1
- package/lib/commonjs/components/onboarding/OnboardingHeader.js.map +0 -1
- package/lib/commonjs/components/onboarding/PinInput.js.map +0 -1
- package/lib/commonjs/components/onboarding/PlatformConnector.js.map +0 -1
- package/lib/commonjs/components/screens/ConnectorScreen.js +0 -146
- package/lib/commonjs/components/screens/ConnectorScreen.js.map +0 -1
- package/lib/commonjs/components/screens/LoadingScreen.js +0 -91
- package/lib/commonjs/components/screens/LoadingScreen.js.map +0 -1
- package/lib/commonjs/components/screens/PinCreationScreen.js +0 -61
- package/lib/commonjs/components/screens/PinCreationScreen.js.map +0 -1
- package/lib/commonjs/constants/index.js.map +0 -1
- package/lib/commonjs/hooks/useConnections.js.map +0 -1
- package/lib/commonjs/hooks/useCredentials.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/services/apiKeyService.js.map +0 -1
- package/lib/commonjs/services/oauthService.js.map +0 -1
- package/lib/commonjs/services/platformAuthService.js.map +0 -1
- package/lib/commonjs/types/ambient.d.js.map +0 -1
- package/lib/commonjs/types/declarations.d.js.map +0 -1
- package/lib/commonjs/types/index.d.js.map +0 -1
- package/lib/commonjs/types/index.js.map +0 -1
- package/lib/commonjs/types/node-fix.d.js.map +0 -1
- package/lib/commonjs/types/node-override.d.js.map +0 -1
- package/lib/commonjs/types/opacity.d.js.map +0 -1
- package/lib/commonjs/types/types.d.js.map +0 -1
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/utils/Portal.js.map +0 -1
- package/lib/commonjs/utils/api.js.map +0 -1
- package/lib/commonjs/utils/auth.js.map +0 -1
- package/lib/commonjs/utils/crypto.js.map +0 -1
- package/lib/commonjs/utils/debugHelper.js.map +0 -1
- package/lib/commonjs/utils/encryption.js.map +0 -1
- package/lib/commonjs/utils/onairosApi.js.map +0 -1
- package/lib/commonjs/utils/programmaticFlow.js.map +0 -1
- package/lib/commonjs/utils/retryHelper.js.map +0 -1
- package/lib/commonjs/utils/secureStorage.js.map +0 -1
- package/lib/module/api/index.js.map +0 -1
- package/lib/module/assets/images/email.png +0 -0
- package/lib/module/assets/images/linkedin.png +0 -0
- package/lib/module/assets/images/reddit.png +0 -0
- package/lib/module/assets/images/youtube.png +0 -0
- package/lib/module/components/DataRequestModal.js +0 -220
- package/lib/module/components/DataRequestModal.js.map +0 -1
- package/lib/module/components/DataRequestScreen.js +0 -321
- package/lib/module/components/DataRequestScreen.js.map +0 -1
- package/lib/module/components/EmailVerificationModal.js +0 -311
- package/lib/module/components/EmailVerificationModal.js.map +0 -1
- package/lib/module/components/Onairos.js.map +0 -1
- package/lib/module/components/OnairosButton.js.map +0 -1
- package/lib/module/components/Overlay.js.map +0 -1
- package/lib/module/components/PinInput.js.map +0 -1
- package/lib/module/components/PlatformList.js.map +0 -1
- package/lib/module/components/TrainingModal.js +0 -708
- package/lib/module/components/TrainingModal.js.map +0 -1
- package/lib/module/components/UniversalOnboarding.js.map +0 -1
- package/lib/module/components/UniversalOnboarding.tsx.new +0 -455
- package/lib/module/components/onboarding/OAuthWebView.js.map +0 -1
- package/lib/module/components/onboarding/OnboardingHeader.js.map +0 -1
- package/lib/module/components/onboarding/PinInput.js.map +0 -1
- package/lib/module/components/onboarding/PlatformConnector.js.map +0 -1
- package/lib/module/components/screens/ConnectorScreen.js +0 -138
- package/lib/module/components/screens/ConnectorScreen.js.map +0 -1
- package/lib/module/components/screens/LoadingScreen.js +0 -83
- package/lib/module/components/screens/LoadingScreen.js.map +0 -1
- package/lib/module/components/screens/PinCreationScreen.js +0 -53
- package/lib/module/components/screens/PinCreationScreen.js.map +0 -1
- package/lib/module/constants/index.js.map +0 -1
- package/lib/module/hooks/useConnections.js.map +0 -1
- package/lib/module/hooks/useCredentials.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/services/apiKeyService.js.map +0 -1
- package/lib/module/services/oauthService.js.map +0 -1
- package/lib/module/services/platformAuthService.js.map +0 -1
- package/lib/module/types/ambient.d.js.map +0 -1
- package/lib/module/types/declarations.d.js.map +0 -1
- package/lib/module/types/index.d.js.map +0 -1
- package/lib/module/types/index.js.map +0 -1
- package/lib/module/types/node-fix.d.js.map +0 -1
- package/lib/module/types/node-override.d.js.map +0 -1
- package/lib/module/types/opacity.d.js.map +0 -1
- package/lib/module/types/types.d.js.map +0 -1
- package/lib/module/types.js.map +0 -1
- package/lib/module/utils/Portal.js.map +0 -1
- package/lib/module/utils/api.js.map +0 -1
- package/lib/module/utils/auth.js.map +0 -1
- package/lib/module/utils/crypto.js.map +0 -1
- package/lib/module/utils/debugHelper.js.map +0 -1
- package/lib/module/utils/encryption.js.map +0 -1
- package/lib/module/utils/onairosApi.js.map +0 -1
- package/lib/module/utils/programmaticFlow.js.map +0 -1
- package/lib/module/utils/retryHelper.js.map +0 -1
- package/lib/module/utils/secureStorage.js.map +0 -1
- package/lib/typescript/api/index.d.ts +0 -8
- package/lib/typescript/api/index.d.ts.map +0 -1
- package/lib/typescript/components/DataRequestModal.d.ts +0 -11
- package/lib/typescript/components/DataRequestModal.d.ts.map +0 -1
- package/lib/typescript/components/DataRequestScreen.d.ts +0 -11
- package/lib/typescript/components/DataRequestScreen.d.ts.map +0 -1
- package/lib/typescript/components/EmailVerificationModal.d.ts +0 -11
- package/lib/typescript/components/EmailVerificationModal.d.ts.map +0 -1
- package/lib/typescript/components/Onairos.d.ts +0 -4
- package/lib/typescript/components/Onairos.d.ts.map +0 -1
- package/lib/typescript/components/OnairosButton.d.ts +0 -12
- package/lib/typescript/components/OnairosButton.d.ts.map +0 -1
- package/lib/typescript/components/Overlay.d.ts +0 -4
- package/lib/typescript/components/Overlay.d.ts.map +0 -1
- package/lib/typescript/components/PinInput.d.ts +0 -4
- package/lib/typescript/components/PinInput.d.ts.map +0 -1
- package/lib/typescript/components/PlatformList.d.ts +0 -4
- package/lib/typescript/components/PlatformList.d.ts.map +0 -1
- package/lib/typescript/components/TrainingModal.d.ts +0 -4
- package/lib/typescript/components/TrainingModal.d.ts.map +0 -1
- package/lib/typescript/components/UniversalOnboarding.d.ts +0 -4
- package/lib/typescript/components/UniversalOnboarding.d.ts.map +0 -1
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts +0 -10
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts.map +0 -1
- package/lib/typescript/components/onboarding/OnboardingHeader.d.ts +0 -11
- package/lib/typescript/components/onboarding/OnboardingHeader.d.ts.map +0 -1
- package/lib/typescript/components/onboarding/PinInput.d.ts +0 -4
- package/lib/typescript/components/onboarding/PinInput.d.ts.map +0 -1
- package/lib/typescript/components/onboarding/PlatformConnector.d.ts +0 -13
- package/lib/typescript/components/onboarding/PlatformConnector.d.ts.map +0 -1
- package/lib/typescript/components/screens/ConnectorScreen.d.ts +0 -9
- package/lib/typescript/components/screens/ConnectorScreen.d.ts.map +0 -1
- package/lib/typescript/components/screens/LoadingScreen.d.ts +0 -9
- package/lib/typescript/components/screens/LoadingScreen.d.ts.map +0 -1
- package/lib/typescript/components/screens/PinCreationScreen.d.ts +0 -10
- package/lib/typescript/components/screens/PinCreationScreen.d.ts.map +0 -1
- package/lib/typescript/constants/index.d.ts +0 -53
- package/lib/typescript/constants/index.d.ts.map +0 -1
- package/lib/typescript/hooks/useConnections.d.ts +0 -9
- package/lib/typescript/hooks/useConnections.d.ts.map +0 -1
- package/lib/typescript/hooks/useCredentials.d.ts +0 -9
- package/lib/typescript/hooks/useCredentials.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -18
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/services/apiKeyService.d.ts +0 -132
- package/lib/typescript/services/apiKeyService.d.ts.map +0 -1
- package/lib/typescript/services/oauthService.d.ts +0 -50
- package/lib/typescript/services/oauthService.d.ts.map +0 -1
- package/lib/typescript/services/platformAuthService.d.ts +0 -144
- package/lib/typescript/services/platformAuthService.d.ts.map +0 -1
- package/lib/typescript/types/index.d.ts +0 -231
- package/lib/typescript/types/index.d.ts.map +0 -1
- package/lib/typescript/types.d.ts +0 -270
- package/lib/typescript/types.d.ts.map +0 -1
- package/lib/typescript/utils/Portal.d.ts +0 -14
- package/lib/typescript/utils/Portal.d.ts.map +0 -1
- package/lib/typescript/utils/api.d.ts +0 -6
- package/lib/typescript/utils/api.d.ts.map +0 -1
- package/lib/typescript/utils/auth.d.ts +0 -6
- package/lib/typescript/utils/auth.d.ts.map +0 -1
- package/lib/typescript/utils/crypto.d.ts +0 -4
- package/lib/typescript/utils/crypto.d.ts.map +0 -1
- package/lib/typescript/utils/debugHelper.d.ts +0 -29
- package/lib/typescript/utils/debugHelper.d.ts.map +0 -1
- package/lib/typescript/utils/encryption.d.ts +0 -19
- package/lib/typescript/utils/encryption.d.ts.map +0 -1
- package/lib/typescript/utils/onairosApi.d.ts +0 -87
- package/lib/typescript/utils/onairosApi.d.ts.map +0 -1
- package/lib/typescript/utils/programmaticFlow.d.ts +0 -23
- package/lib/typescript/utils/programmaticFlow.d.ts.map +0 -1
- package/lib/typescript/utils/retryHelper.d.ts +0 -69
- package/lib/typescript/utils/retryHelper.d.ts.map +0 -1
- package/lib/typescript/utils/secureStorage.d.ts +0 -94
- package/lib/typescript/utils/secureStorage.d.ts.map +0 -1
- package/src/api/index.ts +0 -111
- package/src/assets/images/email.png +0 -0
- package/src/assets/images/linkedin.png +0 -0
- package/src/assets/images/onairos_logo.png +0 -0
- package/src/assets/images/reddit.png +0 -0
- package/src/assets/images/youtube.png +0 -0
- package/src/components/DataRequestModal.tsx +0 -227
- package/src/components/DataRequestScreen.tsx +0 -356
- package/src/components/EmailVerificationModal.tsx +0 -364
- package/src/components/Onairos.tsx +0 -425
- package/src/components/OnairosButton.tsx +0 -359
- package/src/components/Overlay.tsx +0 -506
- package/src/components/PinInput.tsx +0 -343
- package/src/components/PlatformList.tsx +0 -145
- package/src/components/TrainingModal.tsx +0 -737
- package/src/components/UniversalOnboarding.tsx +0 -1839
- package/src/components/UniversalOnboarding.tsx.new +0 -455
- package/src/components/onboarding/OAuthWebView.tsx +0 -838
- package/src/components/onboarding/OnboardingHeader.tsx +0 -70
- package/src/components/onboarding/PinInput.tsx +0 -356
- package/src/components/onboarding/PlatformConnector.tsx +0 -302
- package/src/components/screens/ConnectorScreen.tsx +0 -153
- package/src/components/screens/LoadingScreen.tsx +0 -100
- package/src/components/screens/PinCreationScreen.tsx +0 -67
- package/src/constants/index.ts +0 -83
- package/src/hooks/useConnections.ts +0 -163
- package/src/hooks/useCredentials.ts +0 -175
- package/src/index.js +0 -14
- package/src/index.ts +0 -50
- package/src/services/SDK_API_KEY_VALIDATION.md +0 -421
- package/src/services/apiKeyService.ts +0 -984
- package/src/services/oauthService.ts +0 -412
- package/src/services/platformAuthService.ts +0 -1113
- package/src/types/ambient.d.ts +0 -29
- package/src/types/declarations.d.ts +0 -26
- package/src/types/index.d.ts +0 -274
- package/src/types/index.ts +0 -244
- package/src/types/node-fix.d.ts +0 -19
- package/src/types/node-override.d.ts +0 -24
- package/src/types/opacity.d.ts +0 -16
- package/src/types/types.d.ts +0 -18
- package/src/types.ts +0 -298
- package/src/utils/Portal.tsx +0 -83
- package/src/utils/api.js +0 -112
- package/src/utils/auth.js +0 -104
- package/src/utils/crypto.js +0 -60
- package/src/utils/debugHelper.ts +0 -53
- package/src/utils/encryption.ts +0 -69
- package/src/utils/onairosApi.ts +0 -391
- package/src/utils/programmaticFlow.ts +0 -113
- package/src/utils/retryHelper.ts +0 -275
- package/src/utils/secureStorage.ts +0 -361
- package/types/index.d.ts +0 -218
- package/types/node-env.d.ts +0 -15
- /package/{src/assets/images → lib/commonjs/assets/icons}/farcaster.png +0 -0
- /package/{src/assets/images → lib/commonjs/assets/icons}/instagram.png +0 -0
- /package/{src/assets/images → lib/commonjs/assets/icons}/pinterest.png +0 -0
- /package/{src/assets/images → lib/commonjs/assets/icons}/swerv_logo.png +0 -0
- /package/{src/assets/images → lib/commonjs/assets/icons}/twitter.jpg +0 -0
|
@@ -1,333 +1 @@
|
|
|
1
|
-
import NetInfo from '@react-native-community/netinfo';
|
|
2
|
-
import { logDebug } from './debugHelper';
|
|
3
|
-
import { getJWT, makeUserRequest, makeDeveloperRequest, isUserAuthenticated, extractUsernameFromJWT } from '../services/apiKeyService';
|
|
4
|
-
|
|
5
|
-
// API response types
|
|
6
|
-
|
|
7
|
-
// Error types
|
|
8
|
-
|
|
9
|
-
// API error structure
|
|
10
|
-
export class ApiError extends Error {
|
|
11
|
-
constructor(message, type, code, details) {
|
|
12
|
-
super(message);
|
|
13
|
-
this.type = type;
|
|
14
|
-
this.code = code;
|
|
15
|
-
this.details = details;
|
|
16
|
-
this.name = 'ApiError';
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Check if the device has an active network connection
|
|
22
|
-
*/
|
|
23
|
-
const checkNetworkConnection = async () => {
|
|
24
|
-
const networkState = await NetInfo.fetch();
|
|
25
|
-
return networkState.isConnected === true;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Make user-authenticated API request using JWT token
|
|
30
|
-
*/
|
|
31
|
-
const makeUserApiRequest = async (endpoint, method, options = {}) => {
|
|
32
|
-
const {
|
|
33
|
-
data,
|
|
34
|
-
headers = {},
|
|
35
|
-
debug = false
|
|
36
|
-
} = options;
|
|
37
|
-
try {
|
|
38
|
-
// Check for network connectivity
|
|
39
|
-
const isConnected = await checkNetworkConnection();
|
|
40
|
-
if (!isConnected) {
|
|
41
|
-
throw new ApiError('No network connection available', 'network_error');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Check if user is authenticated
|
|
45
|
-
if (!isUserAuthenticated()) {
|
|
46
|
-
throw new ApiError('User not authenticated. Please verify email first.', 'auth_error');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Log request information if debug mode is enabled
|
|
50
|
-
if (debug) {
|
|
51
|
-
logDebug('User API Request', {
|
|
52
|
-
endpoint,
|
|
53
|
-
method,
|
|
54
|
-
headers: {
|
|
55
|
-
...headers,
|
|
56
|
-
Authorization: '[REDACTED]'
|
|
57
|
-
},
|
|
58
|
-
data: data || null
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Make authenticated request using JWT token
|
|
63
|
-
const response = await makeUserRequest(endpoint, {
|
|
64
|
-
method,
|
|
65
|
-
headers,
|
|
66
|
-
...(data ? {
|
|
67
|
-
body: JSON.stringify(data)
|
|
68
|
-
} : {})
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
// Parse response as JSON
|
|
72
|
-
const responseData = await response.json();
|
|
73
|
-
|
|
74
|
-
// Log response if debug mode is enabled
|
|
75
|
-
if (debug) {
|
|
76
|
-
logDebug('User API Response', {
|
|
77
|
-
status: response.status,
|
|
78
|
-
data: responseData
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Handle API error responses
|
|
83
|
-
if (!response.ok) {
|
|
84
|
-
var _responseData$error, _responseData$error2, _responseData$error3;
|
|
85
|
-
const errorType = response.status === 401 || response.status === 403 ? 'auth_error' : response.status === 400 ? 'validation_error' : response.status >= 500 ? 'server_error' : 'unknown_error';
|
|
86
|
-
throw new ApiError(((_responseData$error = responseData.error) === null || _responseData$error === void 0 ? void 0 : _responseData$error.message) || 'API request failed', errorType, (_responseData$error2 = responseData.error) === null || _responseData$error2 === void 0 ? void 0 : _responseData$error2.code, (_responseData$error3 = responseData.error) === null || _responseData$error3 === void 0 ? void 0 : _responseData$error3.details);
|
|
87
|
-
}
|
|
88
|
-
return responseData;
|
|
89
|
-
} catch (error) {
|
|
90
|
-
// Handle specific error types
|
|
91
|
-
if (error instanceof ApiError) {
|
|
92
|
-
throw error;
|
|
93
|
-
}
|
|
94
|
-
if (error.name === 'AbortError') {
|
|
95
|
-
throw new ApiError('Request timed out', 'timeout_error');
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Log error if debug mode is enabled
|
|
99
|
-
if (debug) {
|
|
100
|
-
logDebug('User API Error', {
|
|
101
|
-
endpoint,
|
|
102
|
-
method,
|
|
103
|
-
error: error.message || 'Unknown error'
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Return a generic error for all other cases
|
|
108
|
-
throw new ApiError(error.message || 'An unexpected error occurred', 'unknown_error');
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Make developer-authenticated API request using API key
|
|
114
|
-
*/
|
|
115
|
-
const makeDeveloperApiRequest = async (endpoint, method, options = {}) => {
|
|
116
|
-
const {
|
|
117
|
-
data,
|
|
118
|
-
headers = {},
|
|
119
|
-
debug = false
|
|
120
|
-
} = options;
|
|
121
|
-
try {
|
|
122
|
-
// Check for network connectivity
|
|
123
|
-
const isConnected = await checkNetworkConnection();
|
|
124
|
-
if (!isConnected) {
|
|
125
|
-
throw new ApiError('No network connection available', 'network_error');
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Log request information if debug mode is enabled
|
|
129
|
-
if (debug) {
|
|
130
|
-
logDebug('Developer API Request', {
|
|
131
|
-
endpoint,
|
|
132
|
-
method,
|
|
133
|
-
headers: {
|
|
134
|
-
...headers,
|
|
135
|
-
Authorization: '[REDACTED]'
|
|
136
|
-
},
|
|
137
|
-
data: data || null
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// Make authenticated request using developer API key
|
|
142
|
-
const response = await makeDeveloperRequest(endpoint, {
|
|
143
|
-
method,
|
|
144
|
-
headers,
|
|
145
|
-
...(data ? {
|
|
146
|
-
body: JSON.stringify(data)
|
|
147
|
-
} : {})
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
// Parse response as JSON
|
|
151
|
-
const responseData = await response.json();
|
|
152
|
-
|
|
153
|
-
// Log response if debug mode is enabled
|
|
154
|
-
if (debug) {
|
|
155
|
-
logDebug('Developer API Response', {
|
|
156
|
-
status: response.status,
|
|
157
|
-
data: responseData
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// Handle API error responses
|
|
162
|
-
if (!response.ok) {
|
|
163
|
-
var _responseData$error4, _responseData$error5, _responseData$error6;
|
|
164
|
-
const errorType = response.status === 401 || response.status === 403 ? 'auth_error' : response.status === 400 ? 'validation_error' : response.status >= 500 ? 'server_error' : 'unknown_error';
|
|
165
|
-
throw new ApiError(((_responseData$error4 = responseData.error) === null || _responseData$error4 === void 0 ? void 0 : _responseData$error4.message) || 'API request failed', errorType, (_responseData$error5 = responseData.error) === null || _responseData$error5 === void 0 ? void 0 : _responseData$error5.code, (_responseData$error6 = responseData.error) === null || _responseData$error6 === void 0 ? void 0 : _responseData$error6.details);
|
|
166
|
-
}
|
|
167
|
-
return responseData;
|
|
168
|
-
} catch (error) {
|
|
169
|
-
// Handle specific error types
|
|
170
|
-
if (error instanceof ApiError) {
|
|
171
|
-
throw error;
|
|
172
|
-
}
|
|
173
|
-
if (error.name === 'AbortError') {
|
|
174
|
-
throw new ApiError('Request timed out', 'timeout_error');
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// Log error if debug mode is enabled
|
|
178
|
-
if (debug) {
|
|
179
|
-
logDebug('Developer API Error', {
|
|
180
|
-
endpoint,
|
|
181
|
-
method,
|
|
182
|
-
error: error.message || 'Unknown error'
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// Return a generic error for all other cases
|
|
187
|
-
throw new ApiError(error.message || 'An unexpected error occurred', 'unknown_error');
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Validate user credentials with the API (uses JWT)
|
|
193
|
-
*/
|
|
194
|
-
export const validateCredentials = async (username, options = {
|
|
195
|
-
debug: false
|
|
196
|
-
}) => {
|
|
197
|
-
try {
|
|
198
|
-
var _response$data, _response$error;
|
|
199
|
-
const response = await makeUserApiRequest('auth/validate', 'POST', {
|
|
200
|
-
data: {
|
|
201
|
-
username
|
|
202
|
-
},
|
|
203
|
-
debug: options.debug
|
|
204
|
-
});
|
|
205
|
-
return {
|
|
206
|
-
isValid: response.success && ((_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.isValid) === true,
|
|
207
|
-
message: (_response$error = response.error) === null || _response$error === void 0 ? void 0 : _response$error.message
|
|
208
|
-
};
|
|
209
|
-
} catch (error) {
|
|
210
|
-
return {
|
|
211
|
-
isValid: false,
|
|
212
|
-
message: error.message
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Create a new user account (uses developer API key)
|
|
219
|
-
*/
|
|
220
|
-
export const createAccount = async (credentials, options = {
|
|
221
|
-
debug: false
|
|
222
|
-
}) => {
|
|
223
|
-
return makeDeveloperApiRequest('auth/register', 'POST', {
|
|
224
|
-
data: {
|
|
225
|
-
username: credentials.username,
|
|
226
|
-
platforms: credentials.platforms
|
|
227
|
-
},
|
|
228
|
-
debug: options.debug
|
|
229
|
-
});
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Authenticate with the API using credentials (uses JWT)
|
|
234
|
-
*/
|
|
235
|
-
export const authenticate = async (credentials, options = {
|
|
236
|
-
debug: false
|
|
237
|
-
}) => {
|
|
238
|
-
return makeUserApiRequest('auth/login', 'POST', {
|
|
239
|
-
data: {
|
|
240
|
-
username: credentials.username,
|
|
241
|
-
pin: credentials.userPin
|
|
242
|
-
},
|
|
243
|
-
debug: options.debug
|
|
244
|
-
});
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Refresh authentication token (uses JWT)
|
|
249
|
-
*/
|
|
250
|
-
export const refreshToken = async (refreshToken, options = {
|
|
251
|
-
debug: false
|
|
252
|
-
}) => {
|
|
253
|
-
return makeUserApiRequest('auth/refresh', 'POST', {
|
|
254
|
-
data: {
|
|
255
|
-
refreshToken
|
|
256
|
-
},
|
|
257
|
-
debug: options.debug
|
|
258
|
-
});
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Get user's connected platform data (uses JWT)
|
|
263
|
-
*/
|
|
264
|
-
export const getPlatformData = async (platform, options = {
|
|
265
|
-
debug: false
|
|
266
|
-
}) => {
|
|
267
|
-
return makeUserApiRequest(`platforms/${platform}/data`, 'GET', {
|
|
268
|
-
debug: options.debug
|
|
269
|
-
});
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Get user profile information (uses JWT)
|
|
274
|
-
*/
|
|
275
|
-
export const getUserProfile = async (options = {
|
|
276
|
-
debug: false
|
|
277
|
-
}) => {
|
|
278
|
-
return makeUserApiRequest('user/profile', 'GET', {
|
|
279
|
-
debug: options.debug
|
|
280
|
-
});
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Update user platform connections (uses JWT)
|
|
285
|
-
*/
|
|
286
|
-
export const updatePlatformConnections = async (platforms, options = {
|
|
287
|
-
debug: false
|
|
288
|
-
}) => {
|
|
289
|
-
return makeUserApiRequest('user/platforms', 'PUT', {
|
|
290
|
-
data: {
|
|
291
|
-
platforms
|
|
292
|
-
},
|
|
293
|
-
debug: options.debug
|
|
294
|
-
});
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Store user PIN (uses JWT and extracts username from JWT)
|
|
299
|
-
*/
|
|
300
|
-
export const storePIN = async (pin, options = {}) => {
|
|
301
|
-
const {
|
|
302
|
-
debug = false,
|
|
303
|
-
username
|
|
304
|
-
} = options;
|
|
305
|
-
|
|
306
|
-
// Extract username from JWT if not provided
|
|
307
|
-
const userToStore = username || extractUsernameFromJWT();
|
|
308
|
-
if (!userToStore) {
|
|
309
|
-
throw new ApiError('No username available - either provide username or ensure JWT token is valid', 'auth_error');
|
|
310
|
-
}
|
|
311
|
-
return makeUserApiRequest('store-pin/mobile', 'POST', {
|
|
312
|
-
data: {
|
|
313
|
-
username: userToStore,
|
|
314
|
-
pin
|
|
315
|
-
},
|
|
316
|
-
debug
|
|
317
|
-
});
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Get current JWT token
|
|
322
|
-
*/
|
|
323
|
-
export const getCurrentUserToken = async () => {
|
|
324
|
-
return await getJWT();
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* Check if user is authenticated with JWT
|
|
329
|
-
*/
|
|
330
|
-
export const isCurrentUserAuthenticated = () => {
|
|
331
|
-
return isUserAuthenticated();
|
|
332
|
-
};
|
|
333
|
-
//# sourceMappingURL=onairosApi.js.map
|
|
1
|
+
import NetInfo from'@react-native-community/netinfo';function _0xe7fd(){const _0x28deb2=['0|3|2|1|4','isbwV','details','type','name','ApiError','fetch','tgJHS','No\x20username\x20available\x20-\x20either\x20provide\x20username\x20or\x20ensure\x20JWT\x20token\x20is\x20valid','store-pin/mobile','KHooQ','network_error','auth_error','gVdLs','User\x20API\x20Request','[REDACTED]','User\x20API\x20Response','validation_error','unknown_error','API\x20request\x20failed','AbortError','Request\x20timed\x20out','timeout_error','User\x20API\x20Error','Unknown\x20error','FGBxR','PlhBp','KFriW','ztxix','WFnaW','No\x20network\x20connection\x20available','zcVPE','EPEFc','IbNqC','message','MRUNU','NegIJ','nTYvR','json','status','KTMlc','jTOms','viFFW','lRRvm','error','GIkak','NRQzn','DCOlu','Fldaf','RwmrW','IxCBF','user/platforms','debug','tKfwf','hEHRb','BrcPT','user/profile','llNLD','foPGn','EhXJy','OCjPA','YtSBX','CXCjj','tNYjt','Developer\x20API\x20Request','YaSjD','GwAnS','qOPqw','Developer\x20API\x20Response','DNeoj','An\x20unexpected\x20error\x20occurred','tCTeS','vtDPu','wrMjt','bltzZ','kpezr','VFPvQ','NFWzq','cVJpx','BAZLf','Hdhxp','vVkuh','eMgSu','stringify','enhTL','XwgXh','WlAFR','xxrDK','jWNIB','rADyK','frChP','vgjcQ','LeLqv','pnOHn','code','mAMyI','FlCmm','DXVlz','vSZWl','DvySH','Developer\x20API\x20Error','dqRZR','auth/validate','jVcoZ','LGlsu','data','qhuNE','BVtSl','auth/register','pSXZs','username','platforms','auth/login','TqOvh','userPin','lgnXu','BXuda','platforms/','/data','ICJDW','uWhhc','uGqcr','zaRgU','qnvHp','odktG','lbOEb','lMUJw','FyniF','GQgPl'];_0xe7fd=function(){return _0x28deb2;};return _0xe7fd();}import{logDebug}from'./debugHelper';import{getJWT,makeUserRequest,makeDeveloperRequest,isUserAuthenticated,extractUsernameFromJWT}from'../services/apiKeyService';export class ApiError extends Error{constructor(_0xacbe58,_0x3220ab,_0xbf331a,_0xa3189f){const _0x42912c={'isbwV':_0x3d6a(0x0)},_0x413c00=_0x42912c[_0x3d6a(0x1)]['split']('|');let _0x4f7d4c=0x0;while(!![]){switch(_0x413c00[_0x4f7d4c++]){case'0':super(_0xacbe58);continue;case'1':this[_0x3d6a(0x2)]=_0xa3189f;continue;case'2':this['code']=_0xbf331a;continue;case'3':this[_0x3d6a(0x3)]=_0x3220ab;continue;case'4':this[_0x3d6a(0x4)]=_0x3d6a(0x5);continue;}break;}}}const checkNetworkConnection=async()=>{const _0x5ba963={'tgJHS':function(_0x3f7113,_0x495945){return _0x3f7113===_0x495945;}},_0x6d60f0=await NetInfo[_0x3d6a(0x6)]();return _0x5ba963[_0x3d6a(0x7)](_0x6d60f0['isConnected'],!![]);},makeUserApiRequest=async(_0xe2a7b9,_0x31917a,_0x312769={})=>{const _0x3cda87={'FGBxR':function(_0x5f0f17){return _0x5f0f17();},'ztxix':_0x3d6a(0x8),'WFnaW':_0x3d6a(0x9),'IxCBF':function(_0x480487,_0x5cfafb,_0x303ee0,_0x359f2f){return _0x480487(_0x5cfafb,_0x303ee0,_0x359f2f);},'BrcPT':function(_0x352f0c,_0x45525a,_0x4de318,_0x1df936){return _0x352f0c(_0x45525a,_0x4de318,_0x1df936);},'PlhBp':function(_0x998d6c,_0x34e21f){return _0x998d6c!==_0x34e21f;},'KFriW':_0x3d6a(0xa),'kBwOQ':_0x3d6a(0xb),'zcVPE':function(_0x17e034){return _0x17e034();},'EPEFc':'User\x20not\x20authenticated.\x20Please\x20verify\x20email\x20first.','KTMlc':_0x3d6a(0xc),'IbNqC':_0x3d6a(0xd),'nTYvR':function(_0x2e0ab3,_0x3d0dba,_0x397569){return _0x2e0ab3(_0x3d0dba,_0x397569);},'MRUNU':_0x3d6a(0xe),'NegIJ':_0x3d6a(0xf),'YtSBX':function(_0x43391e,_0x560f8c,_0x117489){return _0x43391e(_0x560f8c,_0x117489);},'iLmVk':_0x3d6a(0x10),'nXFxi':function(_0x395ce9,_0x5ecae6){return _0x395ce9===_0x5ecae6;},'jTOms':_0x3d6a(0x11),'viFFW':function(_0x513834,_0x46064f){return _0x513834>=_0x46064f;},'lRRvm':'server_error','tNYjt':_0x3d6a(0x12),'GIkak':function(_0x4e31ad,_0x16b1f1){return _0x4e31ad===_0x16b1f1;},'jCMQv':_0x3d6a(0x13),'NRQzn':function(_0x370a0f,_0x37688e){return _0x370a0f===_0x37688e;},'DCOlu':function(_0x29115e,_0x44c22f){return _0x29115e===_0x44c22f;},'Fldaf':function(_0x3363bb,_0xb84880){return _0x3363bb!==_0xb84880;},'RwmrW':'Wyhra','WyBqZ':function(_0x370c8a,_0xbc162c){return _0x370c8a instanceof _0xbc162c;},'tKfwf':function(_0x3460fe,_0x599e4a){return _0x3460fe===_0x599e4a;},'llNLD':function(_0xab0402,_0x310e19){return _0xab0402===_0x310e19;},'foPGn':_0x3d6a(0x14),'EhXJy':_0x3d6a(0x15),'OCjPA':_0x3d6a(0x16),'vFYKJ':_0x3d6a(0x17),'CXCjj':_0x3d6a(0x18)},{data:_0x1e8ac6,headers:headers={},debug:debug=![]}=_0x312769;try{const _0x5c9b8a=await _0x3cda87[_0x3d6a(0x19)](checkNetworkConnection);if(!_0x5c9b8a){if(_0x3cda87[_0x3d6a(0x1a)](_0x3cda87[_0x3d6a(0x1b)],_0x3cda87[_0x3d6a(0x1b)])){const {debug:debug=![],username:_0x52226e}=_0x17a942,_0x516598=_0x52226e||_0x3cda87[_0x3d6a(0x19)](_0x1d21e0);if(!_0x516598)throw new _0x450939(_0x3cda87[_0x3d6a(0x1c)],_0x3d6a(0xc));return _0x26d562(_0x3cda87[_0x3d6a(0x1d)],'POST',{'data':{'username':_0x516598,'pin':_0x2bad2d},'debug':debug});}else throw new ApiError(_0x3d6a(0x1e),_0x3cda87['kBwOQ']);}if(!_0x3cda87[_0x3d6a(0x1f)](isUserAuthenticated))throw new ApiError(_0x3cda87[_0x3d6a(0x20)],_0x3cda87['KTMlc']);if(debug){if(_0x3cda87['PlhBp'](_0x3cda87[_0x3d6a(0x21)],'gVdLs'))return{'isValid':![],'message':_0x27b3b1[_0x3d6a(0x22)]};else _0x3cda87['nTYvR'](logDebug,_0x3cda87[_0x3d6a(0x23)],{'endpoint':_0xe2a7b9,'method':_0x31917a,'headers':{...headers,'Authorization':_0x3cda87[_0x3d6a(0x24)]},'data':_0x1e8ac6||null});}const _0x14cb4d=await _0x3cda87[_0x3d6a(0x25)](makeUserRequest,_0xe2a7b9,{'method':_0x31917a,'headers':headers,..._0x1e8ac6?{'body':JSON['stringify'](_0x1e8ac6)}:{}}),_0x5ed5ef=await _0x14cb4d[_0x3d6a(0x26)]();debug&&_0x3cda87['YtSBX'](logDebug,_0x3cda87['iLmVk'],{'status':_0x14cb4d['status'],'data':_0x5ed5ef});if(!_0x14cb4d['ok']){var _0x30d37d,_0x235f63,_0x1d91bb;const _0x36ee0a=_0x14cb4d['status']===0x191||_0x3cda87['nXFxi'](_0x14cb4d[_0x3d6a(0x27)],0x193)?_0x3cda87[_0x3d6a(0x28)]:_0x14cb4d[_0x3d6a(0x27)]===0x190?_0x3cda87[_0x3d6a(0x29)]:_0x3cda87[_0x3d6a(0x2a)](_0x14cb4d['status'],0x1f4)?_0x3cda87[_0x3d6a(0x2b)]:_0x3cda87['tNYjt'];throw new ApiError(((_0x30d37d=_0x5ed5ef[_0x3d6a(0x2c)])===null||_0x3cda87[_0x3d6a(0x2d)](_0x30d37d,void 0x0)?void 0x0:_0x30d37d[_0x3d6a(0x22)])||_0x3cda87['jCMQv'],_0x36ee0a,_0x3cda87[_0x3d6a(0x2e)](_0x235f63=_0x5ed5ef[_0x3d6a(0x2c)],null)||_0x3cda87[_0x3d6a(0x2e)](_0x235f63,void 0x0)?void 0x0:_0x235f63['code'],_0x3cda87[_0x3d6a(0x2f)](_0x1d91bb=_0x5ed5ef['error'],null)||_0x3cda87['GIkak'](_0x1d91bb,void 0x0)?void 0x0:_0x1d91bb['details']);}return _0x5ed5ef;}catch(_0x300249){if(_0x3cda87[_0x3d6a(0x30)](_0x3cda87[_0x3d6a(0x31)],_0x3cda87['RwmrW']))return _0x3cda87[_0x3d6a(0x32)](_0x25734e,_0x3d6a(0x33),'PUT',{'data':{'platforms':_0xddcd75},'debug':_0x19d614[_0x3d6a(0x34)]});else{if(_0x3cda87['WyBqZ'](_0x300249,ApiError)){if(_0x3cda87[_0x3d6a(0x35)]('hEHRb',_0x3d6a(0x36)))throw _0x300249;else return _0x3cda87[_0x3d6a(0x37)](_0x5bb905,_0x3d6a(0x38),'GET',{'debug':_0x24728c[_0x3d6a(0x34)]});}if(_0x3cda87[_0x3d6a(0x39)](_0x300249['name'],_0x3cda87[_0x3d6a(0x3a)]))throw new ApiError(_0x3cda87[_0x3d6a(0x3b)],_0x3cda87[_0x3d6a(0x3c)]);debug&&_0x3cda87[_0x3d6a(0x3d)](logDebug,_0x3cda87['vFYKJ'],{'endpoint':_0xe2a7b9,'method':_0x31917a,'error':_0x300249['message']||_0x3cda87[_0x3d6a(0x3e)]});throw new ApiError(_0x300249[_0x3d6a(0x22)]||'An\x20unexpected\x20error\x20occurred',_0x3cda87[_0x3d6a(0x3f)]);}}},makeDeveloperApiRequest=async(_0x1c78b5,_0x782ae1,_0x1acb23={})=>{const _0x146723={'vVkuh':_0x3d6a(0x15),'eMgSu':_0x3d6a(0x16),'XwgXh':function(_0x5b3ef3,_0xa78f6e,_0x5244e6){return _0x5b3ef3(_0xa78f6e,_0x5244e6);},'BAZLf':_0x3d6a(0x40),'Hdhxp':_0x3d6a(0xf),'kpezr':_0x3d6a(0xb),'tCTeS':function(_0x31e283){return _0x31e283();},'vtDPu':function(_0xcd5df,_0x2c9662){return _0xcd5df===_0x2c9662;},'wrMjt':_0x3d6a(0x41),'bltzZ':_0x3d6a(0x1e),'VFPvQ':function(_0x435d16,_0x25b9f2){return _0x435d16!==_0x25b9f2;},'adbQh':'SqScq','NFWzq':_0x3d6a(0x42),'cVJpx':function(_0xadf951,_0x2bc3ec,_0x3c7c70){return _0xadf951(_0x2bc3ec,_0x3c7c70);},'enhTL':_0x3d6a(0x43),'WlAFR':_0x3d6a(0x44),'xxrDK':function(_0x2a6655,_0x85dbbb){return _0x2a6655===_0x85dbbb;},'jWNIB':_0x3d6a(0xc),'rADyK':'validation_error','frChP':'server_error','vgjcQ':_0x3d6a(0x12),'LeLqv':'API\x20request\x20failed','pnOHn':function(_0x2b31ba,_0x3fb162){return _0x2b31ba===_0x3fb162;},'oFLMu':function(_0x1c0cf8,_0x232789){return _0x1c0cf8===_0x232789;},'mAMyI':function(_0x5014e2,_0x95a8aa){return _0x5014e2 instanceof _0x95a8aa;},'FlCmm':function(_0x48d29a,_0x23acc8){return _0x48d29a===_0x23acc8;},'Yidhe':_0x3d6a(0x14),'DXVlz':_0x3d6a(0x45),'waPTM':_0x3d6a(0x46)},{data:_0x12f176,headers:headers={},debug:debug=![]}=_0x1acb23;try{const _0x33944c=await _0x146723[_0x3d6a(0x47)](checkNetworkConnection);if(!_0x33944c){if(_0x146723[_0x3d6a(0x48)](_0x146723[_0x3d6a(0x49)],_0x146723[_0x3d6a(0x49)]))throw new ApiError(_0x146723[_0x3d6a(0x4a)],_0x146723[_0x3d6a(0x4b)]);else throw _0x65ac04;}if(debug){if(_0x146723[_0x3d6a(0x4c)](_0x146723['adbQh'],_0x146723[_0x3d6a(0x4d)]))_0x146723[_0x3d6a(0x4e)](logDebug,_0x146723[_0x3d6a(0x4f)],{'endpoint':_0x1c78b5,'method':_0x782ae1,'headers':{...headers,'Authorization':_0x146723[_0x3d6a(0x50)]},'data':_0x12f176||null});else throw new _0x2439a3(_0x146723[_0x3d6a(0x51)],_0x146723[_0x3d6a(0x52)]);}const _0x19218a=await _0x146723['XwgXh'](makeDeveloperRequest,_0x1c78b5,{'method':_0x782ae1,'headers':headers,..._0x12f176?{'body':JSON[_0x3d6a(0x53)](_0x12f176)}:{}}),_0x47f983=await _0x19218a[_0x3d6a(0x26)]();debug&&(_0x146723[_0x3d6a(0x4c)](_0x146723['enhTL'],_0x146723[_0x3d6a(0x54)])?_0x146723[_0x3d6a(0x55)](_0x21bad4,_0x146723[_0x3d6a(0x4f)],{'endpoint':_0x259876,'method':_0x4ec1a2,'headers':{..._0x11a7a6,'Authorization':_0x146723[_0x3d6a(0x50)]},'data':_0x5488b4||null}):_0x146723['cVJpx'](logDebug,_0x146723[_0x3d6a(0x56)],{'status':_0x19218a[_0x3d6a(0x27)],'data':_0x47f983}));if(!_0x19218a['ok']){var _0x4cd4a6,_0x118c5b,_0x4aadfa;const _0x5e66bf=_0x146723[_0x3d6a(0x48)](_0x19218a[_0x3d6a(0x27)],0x191)||_0x146723[_0x3d6a(0x57)](_0x19218a[_0x3d6a(0x27)],0x193)?_0x146723[_0x3d6a(0x58)]:_0x19218a[_0x3d6a(0x27)]===0x190?_0x146723[_0x3d6a(0x59)]:_0x19218a[_0x3d6a(0x27)]>=0x1f4?_0x146723[_0x3d6a(0x5a)]:_0x146723[_0x3d6a(0x5b)];throw new ApiError(((_0x4cd4a6=_0x47f983[_0x3d6a(0x2c)])===null||_0x146723[_0x3d6a(0x48)](_0x4cd4a6,void 0x0)?void 0x0:_0x4cd4a6[_0x3d6a(0x22)])||_0x146723[_0x3d6a(0x5c)],_0x5e66bf,_0x146723[_0x3d6a(0x5d)](_0x118c5b=_0x47f983['error'],null)||_0x146723[_0x3d6a(0x57)](_0x118c5b,void 0x0)?void 0x0:_0x118c5b[_0x3d6a(0x5e)],_0x146723[_0x3d6a(0x5d)](_0x4aadfa=_0x47f983['error'],null)||_0x146723['oFLMu'](_0x4aadfa,void 0x0)?void 0x0:_0x4aadfa[_0x3d6a(0x2)]);}return _0x47f983;}catch(_0x400077){if(_0x146723[_0x3d6a(0x5f)](_0x400077,ApiError))throw _0x400077;if(_0x146723[_0x3d6a(0x60)](_0x400077['name'],_0x146723['Yidhe'])){if(_0x146723[_0x3d6a(0x5d)](_0x146723[_0x3d6a(0x61)],_0x146723['DXVlz']))throw new ApiError(_0x146723[_0x3d6a(0x51)],_0x3d6a(0x16));else throw _0x1a5d02;}if(debug){if(_0x146723[_0x3d6a(0x57)](_0x3d6a(0x62),_0x3d6a(0x63)))throw new _0x256ae5('No\x20network\x20connection\x20available',_0x146723[_0x3d6a(0x4b)]);else _0x146723[_0x3d6a(0x4e)](logDebug,_0x3d6a(0x64),{'endpoint':_0x1c78b5,'method':_0x782ae1,'error':_0x400077['message']||_0x3d6a(0x18)});}throw new ApiError(_0x400077[_0x3d6a(0x22)]||_0x146723['waPTM'],_0x146723[_0x3d6a(0x5b)]);}};export const validateCredentials=async(_0xadc51d,_0x366cb7={'debug':![]})=>{const _0x81976b={'dqRZR':function(_0x2bf36b,_0x257996,_0x5f52ba,_0x132c9a){return _0x2bf36b(_0x257996,_0x5f52ba,_0x132c9a);},'jVcoZ':function(_0x4ddf42,_0x55d5a0){return _0x4ddf42===_0x55d5a0;},'LGlsu':function(_0x2e31cc,_0x665dba){return _0x2e31cc===_0x665dba;},'qhuNE':function(_0x109630,_0xc7b5aa){return _0x109630===_0xc7b5aa;},'BVtSl':function(_0x462ad1,_0x3921bb){return _0x462ad1===_0x3921bb;}};try{var _0x2609d7,_0x5a8664;const _0x1d234b=await _0x81976b[_0x3d6a(0x65)](makeUserApiRequest,_0x3d6a(0x66),'POST',{'data':{'username':_0xadc51d},'debug':_0x366cb7[_0x3d6a(0x34)]});return{'isValid':_0x1d234b['success']&&_0x81976b[_0x3d6a(0x67)](_0x81976b[_0x3d6a(0x68)](_0x2609d7=_0x1d234b[_0x3d6a(0x69)],null)||_0x81976b[_0x3d6a(0x6a)](_0x2609d7,void 0x0)?void 0x0:_0x2609d7['isValid'],!![]),'message':_0x81976b['BVtSl'](_0x5a8664=_0x1d234b[_0x3d6a(0x2c)],null)||_0x81976b[_0x3d6a(0x6b)](_0x5a8664,void 0x0)?void 0x0:_0x5a8664[_0x3d6a(0x22)]};}catch(_0x442793){return{'isValid':![],'message':_0x442793['message']};}};function _0x3d6a(_0xe7fd20,_0x3d6a70){_0xe7fd20=_0xe7fd20-0x0;const _0x37b73a=_0xe7fd();let _0x53dd81=_0x37b73a[_0xe7fd20];return _0x53dd81;}export const createAccount=async(_0xfaf599,_0x23b99f={'debug':![]})=>{const _0x2adc0c={'DZMHR':function(_0x5f3cf8,_0x3b1eb5,_0x212eee,_0x6a17eb){return _0x5f3cf8(_0x3b1eb5,_0x212eee,_0x6a17eb);},'pSXZs':_0x3d6a(0x6c)};return _0x2adc0c['DZMHR'](makeDeveloperApiRequest,_0x2adc0c[_0x3d6a(0x6d)],'POST',{'data':{'username':_0xfaf599[_0x3d6a(0x6e)],'platforms':_0xfaf599[_0x3d6a(0x6f)]},'debug':_0x23b99f[_0x3d6a(0x34)]});};export const authenticate=async(_0x40be55,_0x153bc8={'debug':![]})=>{const _0x33feb5={'TqOvh':_0x3d6a(0x70)};return makeUserApiRequest(_0x33feb5[_0x3d6a(0x71)],'POST',{'data':{'username':_0x40be55[_0x3d6a(0x6e)],'pin':_0x40be55[_0x3d6a(0x72)]},'debug':_0x153bc8['debug']});};export const refreshToken=async(_0x26b5db,_0x3b47a7={'debug':![]})=>{const _0x8d74d8={'lgnXu':function(_0x315317,_0x2dc446,_0x33892b,_0x54a660){return _0x315317(_0x2dc446,_0x33892b,_0x54a660);},'BXuda':'auth/refresh'};return _0x8d74d8[_0x3d6a(0x73)](makeUserApiRequest,_0x8d74d8[_0x3d6a(0x74)],'POST',{'data':{'refreshToken':_0x26b5db},'debug':_0x3b47a7[_0x3d6a(0x34)]});};export const getPlatformData=async(_0x5c8337,_0xe9fb1={'debug':![]})=>{const _0x31967b={'nFuas':function(_0x3c1f2f,_0x4c7356,_0x28c393,_0x588b9a){return _0x3c1f2f(_0x4c7356,_0x28c393,_0x588b9a);}};return _0x31967b['nFuas'](makeUserApiRequest,_0x3d6a(0x75)+_0x5c8337+_0x3d6a(0x76),'GET',{'debug':_0xe9fb1[_0x3d6a(0x34)]});};export const getUserProfile=async(_0x3dd7e5={'debug':![]})=>{return makeUserApiRequest(_0x3d6a(0x38),'GET',{'debug':_0x3dd7e5[_0x3d6a(0x34)]});};export const updatePlatformConnections=async(_0x3ec8d7,_0x39d349={'debug':![]})=>{const _0x480157={'ICJDW':function(_0x152949,_0x31865b,_0x4232d5,_0x2132e5){return _0x152949(_0x31865b,_0x4232d5,_0x2132e5);},'NSZle':_0x3d6a(0x33)};return _0x480157[_0x3d6a(0x77)](makeUserApiRequest,_0x480157['NSZle'],'PUT',{'data':{'platforms':_0x3ec8d7},'debug':_0x39d349['debug']});};export const storePIN=async(_0x32372a,_0x4377c2={})=>{const _0x242ed0={'qnvHp':'User\x20API\x20Request','xPUza':function(_0x4dc3f5,_0x41996f){return _0x4dc3f5||_0x41996f;},'uGqcr':function(_0xcce942){return _0xcce942();},'zauqH':_0x3d6a(0x78),'odktG':_0x3d6a(0x8),'lbOEb':_0x3d6a(0xc),'lMUJw':function(_0x213ad9,_0x15106d,_0x2857d4,_0x4996a4){return _0x213ad9(_0x15106d,_0x2857d4,_0x4996a4);},'FyniF':'store-pin/mobile'},{debug:debug=![],username:_0x5d2707}=_0x4377c2,_0x28cce5=_0x5d2707||_0x242ed0[_0x3d6a(0x79)](extractUsernameFromJWT);if(!_0x28cce5){if(_0x242ed0['zauqH']===_0x3d6a(0x7a))_0xafd7c4(_0x242ed0[_0x3d6a(0x7b)],{'endpoint':_0x490e1f,'method':_0x237c18,'headers':{..._0x272037,'Authorization':'[REDACTED]'},'data':_0x242ed0['xPUza'](_0x3c34d8,null)});else throw new ApiError(_0x242ed0[_0x3d6a(0x7c)],_0x242ed0[_0x3d6a(0x7d)]);}return _0x242ed0[_0x3d6a(0x7e)](makeUserApiRequest,_0x242ed0[_0x3d6a(0x7f)],'POST',{'data':{'username':_0x28cce5,'pin':_0x32372a},'debug':debug});};export const getCurrentUserToken=async()=>{const _0x5e48d8={'GQgPl':function(_0x524d1d){return _0x524d1d();}};return await _0x5e48d8[_0x3d6a(0x80)](getJWT);};export const isCurrentUserAuthenticated=()=>{return isUserAuthenticated();};
|
|
@@ -1,111 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Programmatic Onairos Flow
|
|
3
|
-
*
|
|
4
|
-
* This function executes the complete Onairos authentication and onboarding flow
|
|
5
|
-
* that can be attached to custom buttons or called programmatically.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { initializePlatformAuthService } from '../services/platformAuthService';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Execute the complete Onairos flow programmatically
|
|
12
|
-
* This is the same logic that the OnairosButton uses internally
|
|
13
|
-
*
|
|
14
|
-
* @param options Configuration options for the flow
|
|
15
|
-
* @returns Promise that resolves when flow is complete
|
|
16
|
-
*/
|
|
17
|
-
export const executeOnairosFlow = async options => {
|
|
18
|
-
try {
|
|
19
|
-
console.log('🚀 Starting Onairos flow programmatically...');
|
|
20
|
-
|
|
21
|
-
// Initialize API key service if not already initialized
|
|
22
|
-
await initializePlatformAuthService();
|
|
23
|
-
|
|
24
|
-
// Import components dynamically to avoid circular dependencies
|
|
25
|
-
const {
|
|
26
|
-
UniversalOnboarding
|
|
27
|
-
} = await import('../components/UniversalOnboarding');
|
|
28
|
-
const React = await import('react');
|
|
29
|
-
|
|
30
|
-
// Create a promise that resolves when the flow is complete
|
|
31
|
-
return new Promise((resolve, reject) => {
|
|
32
|
-
let modalRef = null;
|
|
33
|
-
const handleComplete = (apiUrl, token, userData) => {
|
|
34
|
-
console.log('✅ Onairos flow completed successfully');
|
|
35
|
-
|
|
36
|
-
// Clean up modal
|
|
37
|
-
if (modalRef && modalRef.close) {
|
|
38
|
-
modalRef.close();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Call user's onResolved callback
|
|
42
|
-
if (options.onResolved) {
|
|
43
|
-
options.onResolved(apiUrl, token, userData);
|
|
44
|
-
}
|
|
45
|
-
resolve();
|
|
46
|
-
};
|
|
47
|
-
const handleRejection = error => {
|
|
48
|
-
console.log('❌ Onairos flow rejected:', error);
|
|
49
|
-
|
|
50
|
-
// Clean up modal
|
|
51
|
-
if (modalRef && modalRef.close) {
|
|
52
|
-
modalRef.close();
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Call user's onRejection callback
|
|
56
|
-
if (options.onRejection) {
|
|
57
|
-
options.onRejection(error);
|
|
58
|
-
}
|
|
59
|
-
reject(new Error(error || 'Onairos flow was rejected'));
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// Create and show the Universal Onboarding modal
|
|
63
|
-
const modalElement = React.createElement(UniversalOnboarding, {
|
|
64
|
-
visible: true,
|
|
65
|
-
onClose: () => handleRejection('User closed the modal'),
|
|
66
|
-
AppName: options.AppName,
|
|
67
|
-
requestData: options.requestData,
|
|
68
|
-
returnLink: options.returnLink,
|
|
69
|
-
onComplete: handleComplete,
|
|
70
|
-
preferredPlatform: options.preferredPlatform,
|
|
71
|
-
debug: options.debug,
|
|
72
|
-
testMode: options.testMode
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// Store modal reference for cleanup
|
|
76
|
-
modalRef = modalElement;
|
|
77
|
-
|
|
78
|
-
// Note: In a real implementation, you'd need to render this modal
|
|
79
|
-
// This is a simplified version - the actual implementation would
|
|
80
|
-
// need to handle React rendering in the current app context
|
|
81
|
-
console.log('📱 Onairos modal should be displayed');
|
|
82
|
-
});
|
|
83
|
-
} catch (error) {
|
|
84
|
-
console.error('❌ Failed to execute Onairos flow:', error);
|
|
85
|
-
throw error;
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Simple wrapper function that matches the OnairosButton click behavior
|
|
91
|
-
*
|
|
92
|
-
* @param options Configuration options for the flow
|
|
93
|
-
* @returns Promise that resolves when flow is complete
|
|
94
|
-
*/
|
|
95
|
-
export const startOnairosFlow = async options => {
|
|
96
|
-
// Pre-check if provided
|
|
97
|
-
if (options.preCheck) {
|
|
98
|
-
const canProceed = await options.preCheck();
|
|
99
|
-
if (!canProceed) {
|
|
100
|
-
console.log('❌ Pre-check failed, not starting Onairos flow');
|
|
101
|
-
if (options.onRejection) {
|
|
102
|
-
options.onRejection('Pre-check failed');
|
|
103
|
-
}
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Execute the flow
|
|
109
|
-
return executeOnairosFlow(options);
|
|
110
|
-
};
|
|
111
|
-
//# sourceMappingURL=programmaticFlow.js.map
|
|
1
|
+
function _0x40f6(){const _0x57fb0d=['eLoFG','✅\x20Onairos\x20flow\x20completed\x20successfully','fHXrq','VGZEo','twfHC','MyNsE','❌\x20Onairos\x20flow\x20rejected:','📱\x20Onairos\x20modal\x20should\x20be\x20displayed','Onairos\x20flow\x20was\x20rejected','JDyzG','❌\x20Failed\x20to\x20execute\x20Onairos\x20flow:','log','🚀\x20Starting\x20Onairos\x20flow\x20programmatically...','UEadq','../components/UniversalOnboarding','jVFlt','FtuFT','tDVaR','LeMHQ','LHVnw','close','onResolved','OfXtG','onRejection','QslDf','IUaIh','MYGbX','YXqIc','createElement','User\x20closed\x20the\x20modal','AppName','requestData','returnLink','testMode','MkOyl','LLOOh','hzcce','error','iuSFF','QzLnU','Pre-check\x20failed','preCheck','agJCP','bsBeB','nScYs','vFckm'];_0x40f6=function(){return _0x57fb0d;};return _0x40f6();}import{initializePlatformAuthService}from'../services/platformAuthService';export const executeOnairosFlow=async _0xd8295c=>{const _0x2817e2={'LeMHQ':function(_0x1aa5de,_0x415344){return _0x1aa5de===_0x415344;},'LHVnw':_0x243d(0x0),'McaNE':_0x243d(0x1),'OfXtG':_0x243d(0x2),'ImfMl':_0x243d(0x3),'jVFlt':_0x243d(0x4),'FtuFT':_0x243d(0x5),'jDaSo':_0x243d(0x6),'tDVaR':function(_0xf9fb65,_0xdd4971){return _0xf9fb65||_0xdd4971;},'MkOyl':_0x243d(0x7),'QLvuh':function(_0x387aa5,_0x50ddc2){return _0x387aa5||_0x50ddc2;},'hzcce':_0x243d(0x8),'UEadq':function(_0x4f577f){return _0x4f577f();},'dmBVi':_0x243d(0x9),'iuSFF':_0x243d(0xa)};try{console[_0x243d(0xb)](_0x243d(0xc)),await _0x2817e2[_0x243d(0xd)](initializePlatformAuthService);const {UniversalOnboarding:_0x406dc4}=await import(_0x243d(0xe)),React=await import('react');return new Promise((_0x393576,_0x37778e)=>{const _0x2d4456={'IUaIh':'❌\x20Pre-check\x20failed,\x20not\x20starting\x20Onairos\x20flow','QslDf':_0x2817e2[_0x243d(0xf)],'mxonK':_0x2817e2[_0x243d(0x10)],'VhrIe':_0x2817e2['jDaSo'],'MYGbX':function(_0x2878b1,_0x17e390){return _0x2878b1(_0x17e390);},'YXqIc':function(_0x110328,_0x3b4e09){return _0x2817e2[_0x243d(0x11)](_0x110328,_0x3b4e09);},'BENwZ':_0x243d(0x8)};let _0x58a455=null;const _0x168cfa=(_0x24be6e,_0x55b55c,_0x417dbc)=>{_0x2817e2[_0x243d(0x12)](_0x2817e2[_0x243d(0x13)],_0x243d(0x0))?(console[_0x243d(0xb)](_0x2817e2['McaNE']),_0x58a455&&_0x58a455[_0x243d(0x14)]&&_0x58a455[_0x243d(0x14)](),_0xd8295c[_0x243d(0x15)]&&(_0x2817e2[_0x243d(0x16)]===_0x2817e2['ImfMl']?_0x5a2496[_0x243d(0x14)]():_0xd8295c[_0x243d(0x15)](_0x24be6e,_0x55b55c,_0x417dbc)),_0x393576()):_0x2f5bc5[_0x243d(0x17)](_0x54b55a);},_0x32d1be=_0x837e48=>{if(_0x2d4456[_0x243d(0x18)]===_0x2d4456['mxonK']){_0x390b91[_0x243d(0xb)](_0x2d4456[_0x243d(0x19)]);_0x2d527a[_0x243d(0x17)]&&_0xdaa98e['onRejection']('Pre-check\x20failed');return;}else console[_0x243d(0xb)](_0x2d4456['VhrIe'],_0x837e48),_0x58a455&&_0x58a455[_0x243d(0x14)]&&_0x58a455['close'](),_0xd8295c['onRejection']&&_0xd8295c['onRejection'](_0x837e48),_0x2d4456[_0x243d(0x1a)](_0x37778e,new Error(_0x2d4456[_0x243d(0x1b)](_0x837e48,_0x2d4456['BENwZ'])));},_0x1e33fb=React[_0x243d(0x1c)](_0x406dc4,{'visible':!![],'onClose':()=>_0x32d1be(_0x243d(0x1d)),'AppName':_0xd8295c[_0x243d(0x1e)],'requestData':_0xd8295c[_0x243d(0x1f)],'returnLink':_0xd8295c[_0x243d(0x20)],'onComplete':_0x168cfa,'preferredPlatform':_0xd8295c['preferredPlatform'],'debug':_0xd8295c['debug'],'testMode':_0xd8295c[_0x243d(0x21)]});_0x58a455=_0x1e33fb,console[_0x243d(0xb)](_0x2817e2[_0x243d(0x22)]);});}catch(_0x42e706){if(_0x2817e2[_0x243d(0x12)](_0x2817e2['dmBVi'],_0x243d(0x23)))_0x325dbb[_0x243d(0xb)](_0x243d(0x6),_0xfa3399),_0x48e65c&&_0x1b3aec['close']&&_0x1d895e['close'](),_0x57c0b5[_0x243d(0x17)]&&_0x2e636b[_0x243d(0x17)](_0x16e165),_0x30af26(new _0x211858(_0x2817e2['QLvuh'](_0x4f5bda,_0x2817e2[_0x243d(0x24)])));else{console[_0x243d(0x25)](_0x2817e2[_0x243d(0x26)],_0x42e706);throw _0x42e706;}}};function _0x243d(_0x40f69e,_0x243d71){_0x40f69e=_0x40f69e-0x0;const _0x4b9847=_0x40f6();let _0x4fe31b=_0x4b9847[_0x40f69e];return _0x4fe31b;}export const startOnairosFlow=async _0x530c3c=>{const _0x4080c6={'vabJQ':function(_0x11b2d5,_0x1f5da5){return _0x11b2d5===_0x1f5da5;},'agJCP':_0x243d(0x27),'bsBeB':'❌\x20Pre-check\x20failed,\x20not\x20starting\x20Onairos\x20flow','nScYs':_0x243d(0x28),'vFckm':function(_0x303376,_0x5e74be){return _0x303376(_0x5e74be);}};if(_0x530c3c[_0x243d(0x29)]){const _0x2cd50f=await _0x530c3c[_0x243d(0x29)]();if(!_0x2cd50f){if(_0x4080c6['vabJQ'](_0x4080c6[_0x243d(0x2a)],_0x4080c6[_0x243d(0x2a)])){console[_0x243d(0xb)](_0x4080c6[_0x243d(0x2b)]);_0x530c3c[_0x243d(0x17)]&&_0x530c3c[_0x243d(0x17)](_0x4080c6[_0x243d(0x2c)]);return;}else _0x49c555[_0x243d(0x15)](_0x4323c7,_0x322030,_0x2478a0);}}return _0x4080c6[_0x243d(0x2d)](executeOnairosFlow,_0x530c3c);};
|