@onairos/react-native 3.1.12 → 3.1.14
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 +403 -374
- package/lib/commonjs/api/index.js +75 -1
- package/lib/commonjs/api/index.js.map +1 -1
- 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/farcaster.png +0 -0
- package/lib/commonjs/assets/icons/instagram.png +0 -0
- package/lib/commonjs/assets/icons/pinterest.png +0 -0
- package/lib/commonjs/assets/icons/swerv_logo.png +0 -0
- package/lib/commonjs/assets/icons/twitter.jpg +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/checkmark.svg +4 -0
- package/lib/commonjs/assets/images/contentanalysis.svg +3 -0
- package/lib/commonjs/assets/images/contenticon.svg +23 -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 +27 -0
- package/lib/commonjs/components/BodyText.js.map +1 -0
- package/lib/commonjs/components/BrandMark.js +44 -0
- package/lib/commonjs/components/BrandMark.js.map +1 -0
- package/lib/commonjs/components/CodeInput.js +30 -0
- package/lib/commonjs/components/CodeInput.js.map +1 -0
- package/lib/commonjs/components/EmailInput.js +30 -0
- package/lib/commonjs/components/EmailInput.js.map +1 -0
- package/lib/commonjs/components/ExistingUserDataConfirmation.js +474 -0
- package/lib/commonjs/components/ExistingUserDataConfirmation.js.map +1 -0
- package/lib/commonjs/components/GoogleButton.js +55 -0
- package/lib/commonjs/components/GoogleButton.js.map +1 -0
- package/lib/commonjs/components/HeadingGroup.js +43 -0
- package/lib/commonjs/components/HeadingGroup.js.map +1 -0
- package/lib/commonjs/components/ModalHeader.js +99 -0
- package/lib/commonjs/components/ModalHeader.js.map +1 -0
- package/lib/commonjs/components/ModalSheet.js +41 -0
- package/lib/commonjs/components/ModalSheet.js.map +1 -0
- package/lib/commonjs/components/Onairos.js +1 -3
- package/lib/commonjs/components/Onairos.js.map +1 -1
- package/lib/commonjs/components/OnairosButton.js +171 -190
- package/lib/commonjs/components/OnairosButton.js.map +1 -1
- package/lib/commonjs/components/OnairosSignInButton.js +169 -0
- package/lib/commonjs/components/OnairosSignInButton.js.map +1 -0
- package/lib/commonjs/components/Overlay.js +5 -5
- package/lib/commonjs/components/Overlay.js.map +1 -1
- package/lib/commonjs/components/PersonaImage.js +60 -0
- package/lib/commonjs/components/PersonaImage.js.map +1 -0
- package/lib/commonjs/components/PersonaLoadingScreen.js +156 -0
- package/lib/commonjs/components/PersonaLoadingScreen.js.map +1 -0
- package/lib/commonjs/components/PersonalizationConsentScreen.js +316 -0
- package/lib/commonjs/components/PersonalizationConsentScreen.js.map +1 -0
- package/lib/commonjs/components/PinCreationScreen.js +393 -0
- package/lib/commonjs/components/PinCreationScreen.js.map +1 -0
- package/lib/commonjs/components/PinInput.js +282 -120
- package/lib/commonjs/components/PinInput.js.map +1 -1
- package/lib/commonjs/components/PlatformConnectorsStep.js +828 -0
- package/lib/commonjs/components/PlatformConnectorsStep.js.map +1 -0
- package/lib/commonjs/components/PlatformToggle.js +180 -0
- package/lib/commonjs/components/PlatformToggle.js.map +1 -0
- package/lib/commonjs/components/PrimaryButton.js +180 -0
- package/lib/commonjs/components/PrimaryButton.js.map +1 -0
- package/lib/commonjs/components/SignInMatchAnimation.js +197 -0
- package/lib/commonjs/components/SignInMatchAnimation.js.map +1 -0
- package/lib/commonjs/components/SignInStep.js +179 -0
- package/lib/commonjs/components/SignInStep.js.map +1 -0
- package/lib/commonjs/components/TrainingModal.js +808 -563
- package/lib/commonjs/components/TrainingModal.js.map +1 -1
- package/lib/commonjs/components/UniversalOnboarding.js +2304 -1283
- package/lib/commonjs/components/UniversalOnboarding.js.map +1 -1
- package/lib/commonjs/components/VerificationStep.js +154 -0
- package/lib/commonjs/components/VerificationStep.js.map +1 -0
- package/lib/commonjs/components/WelcomeScreen.js +385 -0
- package/lib/commonjs/components/WelcomeScreen.js.map +1 -0
- package/lib/commonjs/components/icons/Basicproficon.js +37 -0
- package/lib/commonjs/components/icons/Basicproficon.js.map +1 -0
- package/lib/commonjs/components/icons/Basicprofile.js +21 -0
- package/lib/commonjs/components/icons/Basicprofile.js.map +1 -0
- package/lib/commonjs/components/icons/Checkbox.js +21 -0
- package/lib/commonjs/components/icons/Checkbox.js.map +1 -0
- package/lib/commonjs/components/icons/Checkmark.js +27 -0
- package/lib/commonjs/components/icons/Checkmark.js.map +1 -0
- package/lib/commonjs/components/icons/Contentanalysis.js +21 -0
- package/lib/commonjs/components/icons/Contentanalysis.js.map +1 -0
- package/lib/commonjs/components/icons/Contenticon.js +39 -0
- package/lib/commonjs/components/icons/Contenticon.js.map +1 -0
- package/lib/commonjs/components/icons/EnochE.js +41 -0
- package/lib/commonjs/components/icons/EnochE.js.map +1 -0
- package/lib/commonjs/components/icons/Personalityicon.js +30 -0
- package/lib/commonjs/components/icons/Personalityicon.js.map +1 -0
- package/lib/commonjs/components/icons/Personalityprofile.js +21 -0
- package/lib/commonjs/components/icons/Personalityprofile.js.map +1 -0
- package/lib/commonjs/components/icons/Personalitytraits.js +21 -0
- package/lib/commonjs/components/icons/Personalitytraits.js.map +1 -0
- package/lib/commonjs/components/icons/Userpreferences.js +21 -0
- package/lib/commonjs/components/icons/Userpreferences.js.map +1 -0
- package/lib/commonjs/components/icons/index.js +84 -0
- package/lib/commonjs/components/icons/index.js.map +1 -0
- package/lib/commonjs/components/onboarding/OAuthWebView.js +134 -743
- package/lib/commonjs/components/onboarding/OAuthWebView.js.map +1 -1
- package/lib/commonjs/config/api.js +34 -0
- package/lib/commonjs/config/api.js.map +1 -0
- package/lib/commonjs/context/AuthContext.js +345 -0
- package/lib/commonjs/context/AuthContext.js.map +1 -0
- package/lib/commonjs/hooks/useConnectedAccounts.js +111 -0
- package/lib/commonjs/hooks/useConnectedAccounts.js.map +1 -0
- package/lib/commonjs/hooks/useConnections.js +120 -125
- package/lib/commonjs/hooks/useConnections.js.map +1 -1
- package/lib/commonjs/hooks/useUserConnections.js +148 -0
- package/lib/commonjs/hooks/useUserConnections.js.map +1 -0
- package/lib/commonjs/index.js +12 -100
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/services/apiClient.js +302 -0
- package/lib/commonjs/services/apiClient.js.map +1 -0
- package/lib/commonjs/services/apiKeyService.js +8 -9
- package/lib/commonjs/services/apiKeyService.js.map +1 -1
- package/lib/commonjs/services/authService.js +935 -0
- package/lib/commonjs/services/authService.js.map +1 -0
- package/lib/commonjs/services/biometricPinService.js +184 -0
- package/lib/commonjs/services/biometricPinService.js.map +1 -0
- package/lib/commonjs/services/connectedAccountsService.js +268 -0
- package/lib/commonjs/services/connectedAccountsService.js.map +1 -0
- package/lib/commonjs/services/googleAuthService.js +268 -0
- package/lib/commonjs/services/googleAuthService.js.map +1 -0
- package/lib/commonjs/services/imageCompressionService.js +260 -0
- package/lib/commonjs/services/imageCompressionService.js.map +1 -0
- package/lib/commonjs/services/jwtStorageService.js +256 -0
- package/lib/commonjs/services/jwtStorageService.js.map +1 -0
- package/lib/commonjs/services/mobileTrainingService.js +185 -0
- package/lib/commonjs/services/mobileTrainingService.js.map +1 -0
- package/lib/commonjs/services/pinEncryptionService.js +84 -0
- package/lib/commonjs/services/pinEncryptionService.js.map +1 -0
- package/lib/commonjs/services/pinStorageUtils.js +105 -0
- package/lib/commonjs/services/pinStorageUtils.js.map +1 -0
- package/lib/commonjs/services/platformAuthService.js +956 -722
- package/lib/commonjs/services/platformAuthService.js.map +1 -1
- package/lib/commonjs/services/storageService.js +404 -0
- package/lib/commonjs/services/storageService.js.map +1 -0
- package/lib/commonjs/services/trainingApiHelpers.js +73 -0
- package/lib/commonjs/services/trainingApiHelpers.js.map +1 -0
- package/lib/commonjs/services/userConnectionsService.js +486 -0
- package/lib/commonjs/services/userConnectionsService.js.map +1 -0
- package/lib/commonjs/services/youtubeMigrationService.js +415 -0
- package/lib/commonjs/services/youtubeMigrationService.js.map +1 -0
- package/lib/commonjs/theme/index.js +249 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/utils/eventUtils.js +288 -0
- package/lib/commonjs/utils/eventUtils.js.map +1 -0
- package/lib/commonjs/utils/haptics.js +66 -0
- package/lib/commonjs/utils/haptics.js.map +1 -0
- package/lib/commonjs/utils/imagePreloader.js +6 -0
- package/lib/commonjs/utils/imagePreloader.js.map +1 -0
- package/lib/module/api/index.js +72 -0
- package/lib/module/api/index.js.map +1 -1
- 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/farcaster.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/checkmark.svg +4 -0
- package/lib/module/assets/images/contentanalysis.svg +3 -0
- package/lib/module/assets/images/contenticon.svg +23 -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 +20 -0
- package/lib/module/components/BodyText.js.map +1 -0
- package/lib/module/components/BrandMark.js +37 -0
- package/lib/module/components/BrandMark.js.map +1 -0
- package/lib/module/components/CodeInput.js +23 -0
- package/lib/module/components/CodeInput.js.map +1 -0
- package/lib/module/components/EmailInput.js +23 -0
- package/lib/module/components/EmailInput.js.map +1 -0
- package/lib/module/components/ExistingUserDataConfirmation.js +465 -0
- package/lib/module/components/ExistingUserDataConfirmation.js.map +1 -0
- package/lib/module/components/GoogleButton.js +48 -0
- package/lib/module/components/GoogleButton.js.map +1 -0
- package/lib/module/components/HeadingGroup.js +36 -0
- package/lib/module/components/HeadingGroup.js.map +1 -0
- package/lib/module/components/ModalHeader.js +92 -0
- package/lib/module/components/ModalHeader.js.map +1 -0
- package/lib/module/components/ModalSheet.js +34 -0
- package/lib/module/components/ModalSheet.js.map +1 -0
- package/lib/module/components/Onairos.js +1 -3
- package/lib/module/components/Onairos.js.map +1 -1
- package/lib/module/components/OnairosButton.js +172 -192
- package/lib/module/components/OnairosButton.js.map +1 -1
- package/lib/module/components/OnairosSignInButton.js +160 -0
- package/lib/module/components/OnairosSignInButton.js.map +1 -0
- package/lib/module/components/Overlay.js +5 -5
- package/lib/module/components/Overlay.js.map +1 -1
- package/lib/module/components/PersonaImage.js +53 -0
- package/lib/module/components/PersonaImage.js.map +1 -0
- package/lib/module/components/PersonaLoadingScreen.js +148 -0
- package/lib/module/components/PersonaLoadingScreen.js.map +1 -0
- package/lib/module/components/PersonalizationConsentScreen.js +309 -0
- package/lib/module/components/PersonalizationConsentScreen.js.map +1 -0
- package/lib/module/components/PinCreationScreen.js +386 -0
- package/lib/module/components/PinCreationScreen.js.map +1 -0
- package/lib/module/components/PinInput.js +283 -120
- package/lib/module/components/PinInput.js.map +1 -1
- package/lib/module/components/PlatformConnectorsStep.js +820 -0
- package/lib/module/components/PlatformConnectorsStep.js.map +1 -0
- package/lib/module/components/PlatformToggle.js +173 -0
- package/lib/module/components/PlatformToggle.js.map +1 -0
- package/lib/module/components/PrimaryButton.js +172 -0
- package/lib/module/components/PrimaryButton.js.map +1 -0
- package/lib/module/components/SignInMatchAnimation.js +189 -0
- package/lib/module/components/SignInMatchAnimation.js.map +1 -0
- package/lib/module/components/SignInStep.js +171 -0
- package/lib/module/components/SignInStep.js.map +1 -0
- package/lib/module/components/TrainingModal.js +809 -565
- package/lib/module/components/TrainingModal.js.map +1 -1
- package/lib/module/components/UniversalOnboarding.js +2307 -1284
- package/lib/module/components/UniversalOnboarding.js.map +1 -1
- package/lib/module/components/VerificationStep.js +146 -0
- package/lib/module/components/VerificationStep.js.map +1 -0
- package/lib/module/components/WelcomeScreen.js +378 -0
- package/lib/module/components/WelcomeScreen.js.map +1 -0
- package/lib/module/components/icons/Basicproficon.js +30 -0
- package/lib/module/components/icons/Basicproficon.js.map +1 -0
- package/lib/module/components/icons/Basicprofile.js +14 -0
- package/lib/module/components/icons/Basicprofile.js.map +1 -0
- package/lib/module/components/icons/Checkbox.js +14 -0
- package/lib/module/components/icons/Checkbox.js.map +1 -0
- package/lib/module/components/icons/Checkmark.js +20 -0
- package/lib/module/components/icons/Checkmark.js.map +1 -0
- package/lib/module/components/icons/Contentanalysis.js +14 -0
- package/lib/module/components/icons/Contentanalysis.js.map +1 -0
- package/lib/module/components/icons/Contenticon.js +32 -0
- package/lib/module/components/icons/Contenticon.js.map +1 -0
- package/lib/module/components/icons/EnochE.js +34 -0
- package/lib/module/components/icons/EnochE.js.map +1 -0
- package/lib/module/components/icons/Personalityicon.js +23 -0
- package/lib/module/components/icons/Personalityicon.js.map +1 -0
- package/lib/module/components/icons/Personalityprofile.js +14 -0
- package/lib/module/components/icons/Personalityprofile.js.map +1 -0
- package/lib/module/components/icons/Personalitytraits.js +14 -0
- package/lib/module/components/icons/Personalitytraits.js.map +1 -0
- package/lib/module/components/icons/Userpreferences.js +14 -0
- package/lib/module/components/icons/Userpreferences.js.map +1 -0
- package/lib/module/components/icons/index.js +13 -0
- package/lib/module/components/icons/index.js.map +1 -0
- package/lib/module/components/onboarding/OAuthWebView.js +136 -744
- package/lib/module/components/onboarding/OAuthWebView.js.map +1 -1
- package/lib/module/config/api.js +26 -0
- package/lib/module/config/api.js.map +1 -0
- package/lib/module/context/AuthContext.js +335 -0
- package/lib/module/context/AuthContext.js.map +1 -0
- package/lib/module/hooks/useConnectedAccounts.js +106 -0
- package/lib/module/hooks/useConnectedAccounts.js.map +1 -0
- package/lib/module/hooks/useConnections.js +119 -125
- package/lib/module/hooks/useConnections.js.map +1 -1
- package/lib/module/hooks/useUserConnections.js +140 -0
- package/lib/module/hooks/useUserConnections.js.map +1 -0
- package/lib/module/index.js +51 -15
- package/lib/module/index.js.map +1 -1
- package/lib/module/services/apiClient.js +298 -0
- package/lib/module/services/apiClient.js.map +1 -0
- package/lib/module/services/apiKeyService.js +8 -9
- package/lib/module/services/apiKeyService.js.map +1 -1
- package/lib/module/services/authService.js +905 -0
- package/lib/module/services/authService.js.map +1 -0
- package/lib/module/services/biometricPinService.js +173 -0
- package/lib/module/services/biometricPinService.js.map +1 -0
- package/lib/module/services/connectedAccountsService.js +255 -0
- package/lib/module/services/connectedAccountsService.js.map +1 -0
- package/lib/module/services/googleAuthService.js +258 -0
- package/lib/module/services/googleAuthService.js.map +1 -0
- package/lib/module/services/imageCompressionService.js +250 -0
- package/lib/module/services/imageCompressionService.js.map +1 -0
- package/lib/module/services/jwtStorageService.js +239 -0
- package/lib/module/services/jwtStorageService.js.map +1 -0
- package/lib/module/services/mobileTrainingService.js +172 -0
- package/lib/module/services/mobileTrainingService.js.map +1 -0
- package/lib/module/services/pinEncryptionService.js +75 -0
- package/lib/module/services/pinEncryptionService.js.map +1 -0
- package/lib/module/services/pinStorageUtils.js +93 -0
- package/lib/module/services/pinStorageUtils.js.map +1 -0
- package/lib/module/services/platformAuthService.js +943 -704
- package/lib/module/services/platformAuthService.js.map +1 -1
- package/lib/module/services/storageService.js +383 -0
- package/lib/module/services/storageService.js.map +1 -0
- package/lib/module/services/trainingApiHelpers.js +67 -0
- package/lib/module/services/trainingApiHelpers.js.map +1 -0
- package/lib/module/services/userConnectionsService.js +476 -0
- package/lib/module/services/userConnectionsService.js.map +1 -0
- package/lib/module/services/youtubeMigrationService.js +404 -0
- package/lib/module/services/youtubeMigrationService.js.map +1 -0
- package/lib/module/theme/index.js +244 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/utils/eventUtils.js +270 -0
- package/lib/module/utils/eventUtils.js.map +1 -0
- package/lib/module/utils/haptics.js +59 -0
- package/lib/module/utils/haptics.js.map +1 -0
- package/lib/module/utils/imagePreloader.js +3 -0
- package/lib/module/utils/imagePreloader.js.map +1 -0
- package/lib/typescript/api/index.d.ts +8 -0
- package/lib/typescript/api/index.d.ts.map +1 -1
- package/lib/typescript/components/BodyText.d.ts +10 -0
- package/lib/typescript/components/BodyText.d.ts.map +1 -0
- package/lib/typescript/components/BrandMark.d.ts +11 -0
- package/lib/typescript/components/BrandMark.d.ts.map +1 -0
- package/lib/typescript/components/CodeInput.d.ts +10 -0
- package/lib/typescript/components/CodeInput.d.ts.map +1 -0
- package/lib/typescript/components/EmailInput.d.ts +8 -0
- package/lib/typescript/components/EmailInput.d.ts.map +1 -0
- package/lib/typescript/components/ExistingUserDataConfirmation.d.ts +12 -0
- package/lib/typescript/components/ExistingUserDataConfirmation.d.ts.map +1 -0
- package/lib/typescript/components/GoogleButton.d.ts +11 -0
- package/lib/typescript/components/GoogleButton.d.ts.map +1 -0
- package/lib/typescript/components/HeadingGroup.d.ts +11 -0
- package/lib/typescript/components/HeadingGroup.d.ts.map +1 -0
- package/lib/typescript/components/ModalHeader.d.ts +11 -0
- package/lib/typescript/components/ModalHeader.d.ts.map +1 -0
- package/lib/typescript/components/ModalSheet.d.ts +13 -0
- package/lib/typescript/components/ModalSheet.d.ts.map +1 -0
- package/lib/typescript/components/Onairos.d.ts.map +1 -1
- package/lib/typescript/components/OnairosButton.d.ts +29 -4
- package/lib/typescript/components/OnairosButton.d.ts.map +1 -1
- package/lib/typescript/components/OnairosSignInButton.d.ts +14 -0
- package/lib/typescript/components/OnairosSignInButton.d.ts.map +1 -0
- package/lib/typescript/components/PersonaImage.d.ts +8 -0
- package/lib/typescript/components/PersonaImage.d.ts.map +1 -0
- package/lib/typescript/components/PersonaLoadingScreen.d.ts +10 -0
- package/lib/typescript/components/PersonaLoadingScreen.d.ts.map +1 -0
- package/lib/typescript/components/PersonalizationConsentScreen.d.ts +10 -0
- package/lib/typescript/components/PersonalizationConsentScreen.d.ts.map +1 -0
- package/lib/typescript/components/PinCreationScreen.d.ts +10 -0
- package/lib/typescript/components/PinCreationScreen.d.ts.map +1 -0
- package/lib/typescript/components/PinInput.d.ts +11 -1
- package/lib/typescript/components/PinInput.d.ts.map +1 -1
- package/lib/typescript/components/PlatformConnectorsStep.d.ts +11 -0
- package/lib/typescript/components/PlatformConnectorsStep.d.ts.map +1 -0
- package/lib/typescript/components/PlatformToggle.d.ts +20 -0
- package/lib/typescript/components/PlatformToggle.d.ts.map +1 -0
- package/lib/typescript/components/PrimaryButton.d.ts +22 -0
- package/lib/typescript/components/PrimaryButton.d.ts.map +1 -0
- package/lib/typescript/components/SignInMatchAnimation.d.ts +9 -0
- package/lib/typescript/components/SignInMatchAnimation.d.ts.map +1 -0
- package/lib/typescript/components/SignInStep.d.ts +12 -0
- package/lib/typescript/components/SignInStep.d.ts.map +1 -0
- package/lib/typescript/components/TrainingModal.d.ts +12 -1
- package/lib/typescript/components/TrainingModal.d.ts.map +1 -1
- package/lib/typescript/components/UniversalOnboarding.d.ts +14 -1
- package/lib/typescript/components/UniversalOnboarding.d.ts.map +1 -1
- package/lib/typescript/components/VerificationStep.d.ts +13 -0
- package/lib/typescript/components/VerificationStep.d.ts.map +1 -0
- package/lib/typescript/components/WelcomeScreen.d.ts +9 -0
- package/lib/typescript/components/WelcomeScreen.d.ts.map +1 -0
- package/lib/typescript/components/icons/Basicproficon.d.ts +5 -0
- package/lib/typescript/components/icons/Basicproficon.d.ts.map +1 -0
- package/lib/typescript/components/icons/Basicprofile.d.ts +5 -0
- package/lib/typescript/components/icons/Basicprofile.d.ts.map +1 -0
- package/lib/typescript/components/icons/Checkbox.d.ts +5 -0
- package/lib/typescript/components/icons/Checkbox.d.ts.map +1 -0
- package/lib/typescript/components/icons/Checkmark.d.ts +5 -0
- package/lib/typescript/components/icons/Checkmark.d.ts.map +1 -0
- package/lib/typescript/components/icons/Contentanalysis.d.ts +5 -0
- package/lib/typescript/components/icons/Contentanalysis.d.ts.map +1 -0
- package/lib/typescript/components/icons/Contenticon.d.ts +5 -0
- package/lib/typescript/components/icons/Contenticon.d.ts.map +1 -0
- package/lib/typescript/components/icons/EnochE.d.ts +5 -0
- package/lib/typescript/components/icons/EnochE.d.ts.map +1 -0
- package/lib/typescript/components/icons/Personalityicon.d.ts +5 -0
- package/lib/typescript/components/icons/Personalityicon.d.ts.map +1 -0
- package/lib/typescript/components/icons/Personalityprofile.d.ts +5 -0
- package/lib/typescript/components/icons/Personalityprofile.d.ts.map +1 -0
- package/lib/typescript/components/icons/Personalitytraits.d.ts +5 -0
- package/lib/typescript/components/icons/Personalitytraits.d.ts.map +1 -0
- package/lib/typescript/components/icons/Userpreferences.d.ts +5 -0
- package/lib/typescript/components/icons/Userpreferences.d.ts.map +1 -0
- package/lib/typescript/components/icons/index.d.ts +12 -0
- package/lib/typescript/components/icons/index.d.ts.map +1 -0
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts.map +1 -1
- package/lib/typescript/config/api.d.ts +24 -0
- package/lib/typescript/config/api.d.ts.map +1 -0
- package/lib/typescript/context/AuthContext.d.ts +34 -0
- package/lib/typescript/context/AuthContext.d.ts.map +1 -0
- package/lib/typescript/hooks/useConnectedAccounts.d.ts +11 -0
- package/lib/typescript/hooks/useConnectedAccounts.d.ts.map +1 -0
- package/lib/typescript/hooks/useConnections.d.ts +10 -5
- package/lib/typescript/hooks/useConnections.d.ts.map +1 -1
- package/lib/typescript/hooks/useUserConnections.d.ts +12 -0
- package/lib/typescript/hooks/useUserConnections.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +24 -6
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/services/apiClient.d.ts +91 -0
- package/lib/typescript/services/apiClient.d.ts.map +1 -0
- package/lib/typescript/services/apiKeyService.d.ts.map +1 -1
- package/lib/typescript/services/authService.d.ts +216 -0
- package/lib/typescript/services/authService.d.ts.map +1 -0
- package/lib/typescript/services/biometricPinService.d.ts +29 -0
- package/lib/typescript/services/biometricPinService.d.ts.map +1 -0
- package/lib/typescript/services/connectedAccountsService.d.ts +56 -0
- package/lib/typescript/services/connectedAccountsService.d.ts.map +1 -0
- package/lib/typescript/services/googleAuthService.d.ts +63 -0
- package/lib/typescript/services/googleAuthService.d.ts.map +1 -0
- package/lib/typescript/services/imageCompressionService.d.ts +37 -0
- package/lib/typescript/services/imageCompressionService.d.ts.map +1 -0
- package/lib/typescript/services/jwtStorageService.d.ts +86 -0
- package/lib/typescript/services/jwtStorageService.d.ts.map +1 -0
- package/lib/typescript/services/mobileTrainingService.d.ts +45 -0
- package/lib/typescript/services/mobileTrainingService.d.ts.map +1 -0
- package/lib/typescript/services/pinEncryptionService.d.ts +17 -0
- package/lib/typescript/services/pinEncryptionService.d.ts.map +1 -0
- package/lib/typescript/services/pinStorageUtils.d.ts +25 -0
- package/lib/typescript/services/pinStorageUtils.d.ts.map +1 -0
- package/lib/typescript/services/platformAuthService.d.ts +34 -109
- package/lib/typescript/services/platformAuthService.d.ts.map +1 -1
- package/lib/typescript/services/storageService.d.ts +128 -0
- package/lib/typescript/services/storageService.d.ts.map +1 -0
- package/lib/typescript/services/trainingApiHelpers.d.ts +38 -0
- package/lib/typescript/services/trainingApiHelpers.d.ts.map +1 -0
- package/lib/typescript/services/userConnectionsService.d.ts +90 -0
- package/lib/typescript/services/userConnectionsService.d.ts.map +1 -0
- package/lib/typescript/services/youtubeMigrationService.d.ts +12 -0
- package/lib/typescript/services/youtubeMigrationService.d.ts.map +1 -0
- package/lib/typescript/theme/index.d.ts +416 -0
- package/lib/typescript/theme/index.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +39 -0
- package/lib/typescript/types/index.d.ts.map +1 -1
- package/lib/typescript/utils/eventUtils.d.ts +108 -0
- package/lib/typescript/utils/eventUtils.d.ts.map +1 -0
- package/lib/typescript/utils/haptics.d.ts +11 -0
- package/lib/typescript/utils/haptics.d.ts.map +1 -0
- package/lib/typescript/utils/imagePreloader.d.ts +2 -0
- package/lib/typescript/utils/imagePreloader.d.ts.map +1 -0
- package/package.json +163 -145
- package/src/api/index.ts +41 -0
- package/src/assets/fonts/EBGaramond-VariableFont_wght.ttf +0 -0
- package/src/assets/fonts/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
- package/src/assets/icons/Facebookicon.png +0 -0
- package/src/assets/icons/Gmail.png +0 -0
- package/src/assets/icons/Linkedinicon.png +0 -0
- package/src/assets/icons/Redditicon.png +0 -0
- package/src/assets/icons/YouTubeicon2.png +0 -0
- package/src/assets/icons/YouTubeicon3.png +0 -0
- package/src/assets/icons/farcaster.png +0 -0
- package/src/assets/icons/instagram.png +0 -0
- package/src/assets/icons/pinterest.png +0 -0
- package/src/assets/icons/swerv_logo.png +0 -0
- package/src/assets/icons/twitter.jpg +0 -0
- package/src/assets/images/Checkbox.svg +3 -0
- package/src/assets/images/EnochE.svg +19 -0
- package/src/assets/images/Enochicon1.png +0 -0
- package/src/assets/images/Face_ID_logo.png +0 -0
- package/src/assets/images/Facebookicon.png +0 -0
- package/src/assets/images/Gmail.png +0 -0
- package/src/assets/images/Googlelogo.png +0 -0
- package/src/assets/images/Linkedinicon.png +0 -0
- package/src/assets/images/Onairoslogo.png +0 -0
- package/src/assets/images/Personalityprofile.svg +3 -0
- package/src/assets/images/Personalitytraits.svg +3 -0
- package/src/assets/images/Redditicon.png +0 -0
- package/src/assets/images/Userpreferences.svg +3 -0
- package/src/assets/images/YouTubeicon3.png +0 -0
- package/src/assets/images/arrow.svg +20 -0
- package/src/assets/images/basicproficon.svg +43 -0
- package/src/assets/images/basicprofile.svg +3 -0
- package/src/assets/images/checkmark.svg +4 -0
- package/src/assets/images/contentanalysis.svg +3 -0
- package/src/assets/images/contenticon.svg +23 -0
- package/src/assets/images/persona1.png +0 -0
- package/src/assets/images/persona2.png +0 -0
- package/src/assets/images/persona3.png +0 -0
- package/src/assets/images/persona4.png +0 -0
- package/src/assets/images/persona5.png +0 -0
- package/src/assets/images/personalityicon.svg +18 -0
- package/src/assets/images/x-close.svg +3 -0
- package/src/components/BodyText.tsx +33 -0
- package/src/components/BrandMark.tsx +62 -0
- package/src/components/CodeInput.tsx +32 -0
- package/src/components/EmailInput.tsx +31 -0
- package/src/components/ExistingUserDataConfirmation.tsx +507 -0
- package/src/components/GoogleButton.tsx +55 -0
- package/src/components/HeadingGroup.tsx +49 -0
- package/src/components/ModalHeader.tsx +125 -0
- package/src/components/ModalSheet.tsx +57 -0
- package/src/components/Onairos.tsx +422 -424
- package/src/components/OnairosButton.tsx +339 -359
- package/src/components/OnairosSignInButton.tsx +166 -0
- package/src/components/Overlay.tsx +506 -506
- package/src/components/PersonaImage.tsx +79 -0
- package/src/components/PersonaLoadingScreen.tsx +201 -0
- package/src/components/PersonalizationConsentScreen.tsx +410 -0
- package/src/components/PinCreationScreen.tsx +492 -0
- package/src/components/PinInput.tsx +555 -343
- package/src/components/PlatformConnectorsStep.tsx +892 -0
- package/src/components/PlatformToggle.tsx +226 -0
- package/src/components/PrimaryButton.tsx +214 -0
- package/src/components/SignInMatchAnimation.tsx +225 -0
- package/src/components/SignInStep.tsx +217 -0
- package/src/components/TrainingModal.tsx +1047 -737
- package/src/components/UniversalOnboarding.tsx +2888 -1820
- package/src/components/VerificationStep.tsx +198 -0
- package/src/components/WelcomeScreen.tsx +473 -0
- package/src/components/icons/Basicproficon.tsx +30 -0
- package/src/components/icons/Basicprofile.tsx +17 -0
- package/src/components/icons/Checkbox.tsx +17 -0
- package/src/components/icons/Checkmark.tsx +24 -0
- package/src/components/icons/Contentanalysis.tsx +17 -0
- package/src/components/icons/Contenticon.tsx +30 -0
- package/src/components/icons/EnochE.tsx +39 -0
- package/src/components/icons/Personalityicon.tsx +22 -0
- package/src/components/icons/Personalityprofile.tsx +17 -0
- package/src/components/icons/Personalitytraits.tsx +17 -0
- package/src/components/icons/Userpreferences.tsx +17 -0
- package/src/components/icons/index.ts +12 -0
- package/src/components/onboarding/OAuthWebView.tsx +232 -838
- package/src/config/api.ts +25 -0
- package/src/context/AuthContext.tsx +393 -0
- package/src/hooks/useConnectedAccounts.ts +139 -0
- package/src/hooks/useConnections.ts +129 -131
- package/src/hooks/useUserConnections.ts +166 -0
- package/src/index.ts +94 -49
- package/src/services/apiClient.ts +337 -0
- package/src/services/apiKeyService.ts +9 -11
- package/src/services/authService.ts +1008 -0
- package/src/services/biometricPinService.ts +193 -0
- package/src/services/connectedAccountsService.ts +290 -0
- package/src/services/googleAuthService.ts +279 -0
- package/src/services/imageCompressionService.ts +303 -0
- package/src/services/jwtStorageService.ts +257 -0
- package/src/services/mobileTrainingService.ts +204 -0
- package/src/services/pinEncryptionService.ts +76 -0
- package/src/services/pinStorageUtils.ts +97 -0
- package/src/services/platformAuthService.ts +1346 -1113
- package/src/services/storageService.ts +452 -0
- package/src/services/trainingApiHelpers.ts +67 -0
- package/src/services/userConnectionsService.ts +557 -0
- package/src/services/youtubeMigrationService.ts +454 -0
- package/src/theme/index.ts +239 -0
- package/src/types/index.ts +265 -238
- package/src/utils/eventUtils.ts +303 -0
- package/src/utils/haptics.ts +59 -0
- package/src/utils/imagePreloader.ts +2 -0
- 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/UniversalOnboarding.tsx.new +0 -455
- 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/UniversalOnboarding.tsx.new +0 -455
- package/src/assets/images/email.png +0 -0
- package/src/assets/images/linkedin.png +0 -0
- package/src/assets/images/reddit.png +0 -0
- package/src/assets/images/youtube.png +0 -0
- package/src/components/UniversalOnboarding.tsx.new +0 -455
|
@@ -1,838 +1,232 @@
|
|
|
1
|
-
import React, { useState
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Text,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
TouchableOpacity,
|
|
7
|
-
ActivityIndicator,
|
|
8
|
-
SafeAreaView,
|
|
9
|
-
Dimensions,
|
|
10
|
-
|
|
11
|
-
} from 'react-native';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
url
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (nativeEvent.domain === 'NSURLErrorDomain') {
|
|
234
|
-
switch (nativeEvent.code) {
|
|
235
|
-
case -1009: // NSURLErrorNotConnectedToInternet
|
|
236
|
-
errorMessage = 'No internet connection. Please check your network and try again.';
|
|
237
|
-
isRetryable = true;
|
|
238
|
-
break;
|
|
239
|
-
case -1003: // NSURLErrorCannotFindHost
|
|
240
|
-
errorMessage = 'Cannot reach authentication server. Please check your internet connection.';
|
|
241
|
-
isRetryable = true;
|
|
242
|
-
break;
|
|
243
|
-
case -1001: // NSURLErrorTimedOut
|
|
244
|
-
errorMessage = 'Connection timed out. Please try again.';
|
|
245
|
-
isRetryable = true;
|
|
246
|
-
break;
|
|
247
|
-
case -1200: // NSURLErrorSecureConnectionFailed
|
|
248
|
-
errorMessage = 'Secure connection failed. Please try again.';
|
|
249
|
-
isRetryable = true;
|
|
250
|
-
break;
|
|
251
|
-
case -1022: // NSURLErrorAppTransportSecurityRequiresSecureConnection
|
|
252
|
-
errorMessage = 'App Transport Security error. Connection must be secure.';
|
|
253
|
-
isRetryable = false;
|
|
254
|
-
break;
|
|
255
|
-
case -1004: // NSURLErrorCannotConnectToHost
|
|
256
|
-
errorMessage = 'Cannot connect to authentication server. Please try again later.';
|
|
257
|
-
isRetryable = true;
|
|
258
|
-
break;
|
|
259
|
-
case -1005: // NSURLErrorNetworkConnectionLost
|
|
260
|
-
errorMessage = 'Network connection lost. Please check your connection and try again.';
|
|
261
|
-
isRetryable = true;
|
|
262
|
-
break;
|
|
263
|
-
case -1020: // NSURLErrorDataNotAllowed
|
|
264
|
-
errorMessage = 'Data not allowed. Please check your cellular data settings.';
|
|
265
|
-
isRetryable = true;
|
|
266
|
-
break;
|
|
267
|
-
default:
|
|
268
|
-
errorMessage = `Network error (${nativeEvent.code}): ${nativeEvent.description || 'Please check your connection and try again.'}`;
|
|
269
|
-
isRetryable = true;
|
|
270
|
-
}
|
|
271
|
-
} else if (nativeEvent.domain === 'WebKitErrorDomain') {
|
|
272
|
-
switch (nativeEvent.code) {
|
|
273
|
-
case 102: // WebKitErrorFrameLoadInterruptedByPolicyChange
|
|
274
|
-
errorMessage = 'Page load was interrupted. Please try again.';
|
|
275
|
-
isRetryable = true;
|
|
276
|
-
break;
|
|
277
|
-
case 204: // WebKitErrorPlugInLoadFailed
|
|
278
|
-
errorMessage = 'Plugin failed to load. Please try again.';
|
|
279
|
-
isRetryable = true;
|
|
280
|
-
break;
|
|
281
|
-
default:
|
|
282
|
-
errorMessage = `WebKit error (${nativeEvent.code}): ${nativeEvent.description || 'Please try again.'}`;
|
|
283
|
-
isRetryable = true;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
console.error('🔴 OAuth WebView Error:', errorMessage);
|
|
288
|
-
|
|
289
|
-
// Implement smart retry logic
|
|
290
|
-
if (isRetryable && retryCount < 3) {
|
|
291
|
-
console.log(`🔄 Auto-retrying OAuth load (attempt ${retryCount + 1}/3) in 3 seconds...`);
|
|
292
|
-
setRetryCount(prev => prev + 1);
|
|
293
|
-
setIsLoading(true);
|
|
294
|
-
setError(null);
|
|
295
|
-
|
|
296
|
-
// Retry after a delay with exponential backoff
|
|
297
|
-
const retryDelay = 3000 * Math.pow(2, retryCount); // 3s, 6s, 12s
|
|
298
|
-
setTimeout(() => {
|
|
299
|
-
if (webViewRef.current) {
|
|
300
|
-
console.log(`🔄 Attempting retry ${retryCount + 1}...`);
|
|
301
|
-
webViewRef.current.reload();
|
|
302
|
-
}
|
|
303
|
-
}, retryDelay);
|
|
304
|
-
} else {
|
|
305
|
-
setError(errorMessage);
|
|
306
|
-
setIsLoading(false);
|
|
307
|
-
|
|
308
|
-
// Show additional help for persistent errors
|
|
309
|
-
if (retryCount >= 3) {
|
|
310
|
-
console.log('❌ Maximum retries reached, showing error to user');
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
const handleOpenInBrowser = () => {
|
|
316
|
-
console.log('Opening OAuth URL in external browser:', url);
|
|
317
|
-
Linking.openURL(url).catch(err => {
|
|
318
|
-
console.error('Failed to open URL in browser:', err);
|
|
319
|
-
setError('Unable to open browser. Please check your device settings.');
|
|
320
|
-
});
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
const handleRetry = () => {
|
|
324
|
-
console.log('Manual retry requested');
|
|
325
|
-
setError(null);
|
|
326
|
-
setErrorMessage('');
|
|
327
|
-
setIsRetryable(true);
|
|
328
|
-
setIsLoading(true);
|
|
329
|
-
setRetryCount(0);
|
|
330
|
-
|
|
331
|
-
if (webViewRef.current) {
|
|
332
|
-
webViewRef.current.reload();
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Get platform-specific icon
|
|
338
|
-
*/
|
|
339
|
-
const getPlatformIcon = (platform: string): string => {
|
|
340
|
-
switch (platform) {
|
|
341
|
-
case 'instagram':
|
|
342
|
-
return 'photo-camera';
|
|
343
|
-
case 'youtube':
|
|
344
|
-
return 'smart-display';
|
|
345
|
-
case 'pinterest':
|
|
346
|
-
return 'push-pin';
|
|
347
|
-
case 'reddit':
|
|
348
|
-
return 'forum';
|
|
349
|
-
case 'email':
|
|
350
|
-
return 'email';
|
|
351
|
-
default:
|
|
352
|
-
return 'link';
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Get platform-specific color
|
|
358
|
-
*/
|
|
359
|
-
const getPlatformColor = (platform: string): string => {
|
|
360
|
-
switch (platform) {
|
|
361
|
-
case 'instagram':
|
|
362
|
-
return '#E1306C';
|
|
363
|
-
case 'youtube':
|
|
364
|
-
return '#FF0000';
|
|
365
|
-
case 'pinterest':
|
|
366
|
-
return '#E60023';
|
|
367
|
-
case 'reddit':
|
|
368
|
-
return '#FF4500';
|
|
369
|
-
case 'email':
|
|
370
|
-
return '#4285F4';
|
|
371
|
-
default:
|
|
372
|
-
return COLORS.primary;
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
// Check if URL indicates OAuth completion
|
|
377
|
-
const isOAuthComplete = (url: string): boolean => {
|
|
378
|
-
// Gmail OAuth completion patterns
|
|
379
|
-
const gmailSuccessPatterns = [
|
|
380
|
-
'https://onairos.uk/Home',
|
|
381
|
-
'https://onairos.uk/home',
|
|
382
|
-
'onairos.uk/Home',
|
|
383
|
-
'onairos.uk/home',
|
|
384
|
-
process.env.APP_HOME_URL,
|
|
385
|
-
].filter(Boolean);
|
|
386
|
-
|
|
387
|
-
// Check for success redirect patterns
|
|
388
|
-
for (const pattern of gmailSuccessPatterns) {
|
|
389
|
-
if (url.includes(pattern)) {
|
|
390
|
-
console.log('✅ OAuth success detected via redirect to:', pattern);
|
|
391
|
-
return true;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
// Check for traditional OAuth callback patterns (more specific)
|
|
396
|
-
// Only match actual query parameters, not just any occurrence in the URL
|
|
397
|
-
const callbackPatterns = [
|
|
398
|
-
'code=',
|
|
399
|
-
'access_token=',
|
|
400
|
-
'oauth_token=',
|
|
401
|
-
'authorization_code=',
|
|
402
|
-
'auth_code=',
|
|
403
|
-
'token=',
|
|
404
|
-
];
|
|
405
|
-
|
|
406
|
-
for (const pattern of callbackPatterns) {
|
|
407
|
-
if (url.includes(pattern)) {
|
|
408
|
-
console.log('✅ OAuth success detected via callback parameter:', pattern);
|
|
409
|
-
return true;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
// Check for specific callback URLs (more targeted than generic words)
|
|
414
|
-
const callbackUrlPatterns = [
|
|
415
|
-
'/callback',
|
|
416
|
-
'/oauth/callback',
|
|
417
|
-
'/auth/callback',
|
|
418
|
-
'redirect_uri',
|
|
419
|
-
'onairos.uk/callback',
|
|
420
|
-
'onairos.uk/oauth',
|
|
421
|
-
];
|
|
422
|
-
|
|
423
|
-
for (const pattern of callbackUrlPatterns) {
|
|
424
|
-
if (url.includes(pattern)) {
|
|
425
|
-
console.log('✅ OAuth success detected via callback URL pattern:', pattern);
|
|
426
|
-
return true;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
// Check for error patterns
|
|
431
|
-
const errorPatterns = [
|
|
432
|
-
'error=',
|
|
433
|
-
'error_description=',
|
|
434
|
-
'oauth_error=',
|
|
435
|
-
'auth_error=',
|
|
436
|
-
'access_denied',
|
|
437
|
-
'user_cancelled',
|
|
438
|
-
'cancelled',
|
|
439
|
-
'denied',
|
|
440
|
-
];
|
|
441
|
-
|
|
442
|
-
for (const pattern of errorPatterns) {
|
|
443
|
-
if (url.includes(pattern)) {
|
|
444
|
-
console.log('❌ OAuth error detected via pattern:', pattern);
|
|
445
|
-
return false;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
return false;
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
// Extract OAuth result from URL
|
|
453
|
-
const extractOAuthResult = (url: string): { success: boolean; code?: string; error?: string } => {
|
|
454
|
-
try {
|
|
455
|
-
const urlObj = new URL(url);
|
|
456
|
-
const params = new URLSearchParams(urlObj.search);
|
|
457
|
-
|
|
458
|
-
// Check for error first
|
|
459
|
-
const error = params.get('error') || params.get('error_description') || params.get('oauth_error');
|
|
460
|
-
if (error) {
|
|
461
|
-
return { success: false, error };
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
// Check for success indicators
|
|
465
|
-
const code = params.get('code') || params.get('authorization_code') || params.get('auth_code');
|
|
466
|
-
const accessToken = params.get('access_token') || params.get('oauth_token') || params.get('token');
|
|
467
|
-
|
|
468
|
-
if (code || accessToken) {
|
|
469
|
-
return { success: true, code: code || accessToken };
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
// Check for success redirect to home page (Gmail pattern)
|
|
473
|
-
const gmailSuccessPatterns = [
|
|
474
|
-
'https://onairos.uk/Home',
|
|
475
|
-
'https://onairos.uk/home',
|
|
476
|
-
'onairos.uk/Home',
|
|
477
|
-
'onairos.uk/home',
|
|
478
|
-
];
|
|
479
|
-
|
|
480
|
-
for (const pattern of gmailSuccessPatterns) {
|
|
481
|
-
if (url.includes(pattern)) {
|
|
482
|
-
console.log('✅ Gmail OAuth success detected via home page redirect');
|
|
483
|
-
return { success: true, code: 'gmail_home_redirect' };
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
// If we reached here and isOAuthComplete returned true, assume success
|
|
488
|
-
if (isOAuthComplete(url)) {
|
|
489
|
-
return { success: true, code: 'oauth_complete' };
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
return { success: false, error: 'OAuth completion not detected' };
|
|
493
|
-
} catch (error) {
|
|
494
|
-
console.error('Error parsing OAuth URL:', error);
|
|
495
|
-
return { success: false, error: 'Invalid OAuth callback URL' };
|
|
496
|
-
}
|
|
497
|
-
};
|
|
498
|
-
|
|
499
|
-
if (error) {
|
|
500
|
-
return (
|
|
501
|
-
<SafeAreaView style={styles.container}>
|
|
502
|
-
<View style={styles.header}>
|
|
503
|
-
<TouchableOpacity onPress={onClose} style={styles.closeButton}>
|
|
504
|
-
<Icon name="close" size={24} color="#000" />
|
|
505
|
-
</TouchableOpacity>
|
|
506
|
-
<View style={styles.titleContainer}>
|
|
507
|
-
<Icon
|
|
508
|
-
name={getPlatformIcon(platform)}
|
|
509
|
-
size={20}
|
|
510
|
-
color={getPlatformColor(platform)}
|
|
511
|
-
/>
|
|
512
|
-
<Text style={styles.titleText}>{platform.charAt(0).toUpperCase() + platform.slice(1)} OAuth</Text>
|
|
513
|
-
</View>
|
|
514
|
-
</View>
|
|
515
|
-
|
|
516
|
-
<View style={styles.errorContainer}>
|
|
517
|
-
<Icon name="error-outline" size={48} color="#FF6B6B" />
|
|
518
|
-
<Text style={styles.errorTitle}>Connection Error</Text>
|
|
519
|
-
<Text style={styles.errorMessage}>{errorMessage || error}</Text>
|
|
520
|
-
|
|
521
|
-
{/* Help text based on error type */}
|
|
522
|
-
{error.includes('internet') || error.includes('network') ? (
|
|
523
|
-
<View style={styles.helpContainer}>
|
|
524
|
-
<Text style={styles.helpTitle}>💡 Troubleshooting Steps:</Text>
|
|
525
|
-
<Text style={styles.helpText}>• Check your Wi-Fi or cellular connection</Text>
|
|
526
|
-
<Text style={styles.helpText}>• Try switching between Wi-Fi and cellular</Text>
|
|
527
|
-
<Text style={styles.helpText}>• Ensure you're not using a VPN that blocks OAuth</Text>
|
|
528
|
-
<Text style={styles.helpText}>• Close other apps that might be using bandwidth</Text>
|
|
529
|
-
</View>
|
|
530
|
-
) : error.includes('timeout') ? (
|
|
531
|
-
<View style={styles.helpContainer}>
|
|
532
|
-
<Text style={styles.helpTitle}>⏱️ Connection Timeout:</Text>
|
|
533
|
-
<Text style={styles.helpText}>• Your connection might be slow</Text>
|
|
534
|
-
<Text style={styles.helpText}>• Try again when you have a stronger signal</Text>
|
|
535
|
-
<Text style={styles.helpText}>• Use "Open in Browser" for better reliability</Text>
|
|
536
|
-
</View>
|
|
537
|
-
) : error.includes('secure') || error.includes('SSL') ? (
|
|
538
|
-
<View style={styles.helpContainer}>
|
|
539
|
-
<Text style={styles.helpTitle}>🔒 Security Error:</Text>
|
|
540
|
-
<Text style={styles.helpText}>• Check your device's date and time settings</Text>
|
|
541
|
-
<Text style={styles.helpText}>• Update your device's operating system</Text>
|
|
542
|
-
<Text style={styles.helpText}>• Try "Open in Browser" as an alternative</Text>
|
|
543
|
-
</View>
|
|
544
|
-
) : (
|
|
545
|
-
<View style={styles.helpContainer}>
|
|
546
|
-
<Text style={styles.helpTitle}>🔧 General Solutions:</Text>
|
|
547
|
-
<Text style={styles.helpText}>• Close and reopen the app</Text>
|
|
548
|
-
<Text style={styles.helpText}>• Check your internet connection</Text>
|
|
549
|
-
<Text style={styles.helpText}>• Use "Open in Browser" for better reliability</Text>
|
|
550
|
-
</View>
|
|
551
|
-
)}
|
|
552
|
-
|
|
553
|
-
<View style={styles.buttonContainer}>
|
|
554
|
-
{isRetryable && (
|
|
555
|
-
<TouchableOpacity style={styles.retryButton} onPress={handleRetry}>
|
|
556
|
-
<Icon name="refresh" size={20} color="#fff" style={styles.buttonIcon} />
|
|
557
|
-
<Text style={styles.retryButtonText}>Retry</Text>
|
|
558
|
-
</TouchableOpacity>
|
|
559
|
-
)}
|
|
560
|
-
<TouchableOpacity style={styles.browserButton} onPress={handleOpenInBrowser}>
|
|
561
|
-
<Icon name="open-in-browser" size={20} color="#666" style={styles.buttonIcon} />
|
|
562
|
-
<Text style={styles.browserButtonText}>Open in Browser</Text>
|
|
563
|
-
</TouchableOpacity>
|
|
564
|
-
</View>
|
|
565
|
-
|
|
566
|
-
{retryCount >= 3 && (
|
|
567
|
-
<View style={styles.persistentErrorContainer}>
|
|
568
|
-
<Text style={styles.persistentErrorText}>
|
|
569
|
-
Still having trouble? Try these steps:
|
|
570
|
-
</Text>
|
|
571
|
-
<Text style={styles.persistentErrorStep}>
|
|
572
|
-
1. Use "Open in Browser" for more reliable authentication
|
|
573
|
-
</Text>
|
|
574
|
-
<Text style={styles.persistentErrorStep}>
|
|
575
|
-
2. Check if other apps can access the internet
|
|
576
|
-
</Text>
|
|
577
|
-
<Text style={styles.persistentErrorStep}>
|
|
578
|
-
3. Restart your device if the problem persists
|
|
579
|
-
</Text>
|
|
580
|
-
</View>
|
|
581
|
-
)}
|
|
582
|
-
</View>
|
|
583
|
-
</SafeAreaView>
|
|
584
|
-
);
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
return (
|
|
588
|
-
<SafeAreaView style={styles.container}>
|
|
589
|
-
<View style={styles.header}>
|
|
590
|
-
<TouchableOpacity onPress={onClose} style={styles.closeButton}>
|
|
591
|
-
<Icon name="close" size={24} color="#000" />
|
|
592
|
-
</TouchableOpacity>
|
|
593
|
-
<View style={styles.titleContainer}>
|
|
594
|
-
<Icon
|
|
595
|
-
name={getPlatformIcon(platform)}
|
|
596
|
-
size={20}
|
|
597
|
-
color={getPlatformColor(platform)}
|
|
598
|
-
/>
|
|
599
|
-
<Text style={styles.titleText}>{platform.charAt(0).toUpperCase() + platform.slice(1)} OAuth</Text>
|
|
600
|
-
</View>
|
|
601
|
-
<TouchableOpacity onPress={handleOpenInBrowser} style={styles.browserButton}>
|
|
602
|
-
<Icon name="open-in-browser" size={20} color="#666" />
|
|
603
|
-
</TouchableOpacity>
|
|
604
|
-
</View>
|
|
605
|
-
|
|
606
|
-
<WebView
|
|
607
|
-
ref={webViewRef}
|
|
608
|
-
source={{ uri: url }}
|
|
609
|
-
onNavigationStateChange={onNavigationStateChange}
|
|
610
|
-
onLoadEnd={handleLoadEnd}
|
|
611
|
-
onError={handleError}
|
|
612
|
-
onHttpError={(syntheticEvent) => {
|
|
613
|
-
const { nativeEvent } = syntheticEvent;
|
|
614
|
-
console.error('WebView HTTP error:', nativeEvent);
|
|
615
|
-
setError('Failed to load OAuth page. Please check your internet connection.');
|
|
616
|
-
setIsLoading(false);
|
|
617
|
-
}}
|
|
618
|
-
style={styles.webView}
|
|
619
|
-
javaScriptEnabled={true}
|
|
620
|
-
domStorageEnabled={true}
|
|
621
|
-
startInLoadingState={true}
|
|
622
|
-
scalesPageToFit={true}
|
|
623
|
-
allowsInlineMediaPlayback={true}
|
|
624
|
-
mediaPlaybackRequiresUserAction={false}
|
|
625
|
-
mixedContentMode="compatibility"
|
|
626
|
-
thirdPartyCookiesEnabled={true}
|
|
627
|
-
sharedCookiesEnabled={true}
|
|
628
|
-
cacheEnabled={true}
|
|
629
|
-
allowsBackForwardNavigationGestures={true}
|
|
630
|
-
allowsLinkPreview={false}
|
|
631
|
-
userAgent="Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1"
|
|
632
|
-
onShouldStartLoadWithRequest={(request) => {
|
|
633
|
-
console.log('WebView attempting to load:', request.url);
|
|
634
|
-
|
|
635
|
-
// Block about:srcdoc and other problematic URLs
|
|
636
|
-
if (request.url.startsWith('about:') ||
|
|
637
|
-
request.url.startsWith('data:') ||
|
|
638
|
-
request.url === 'about:blank') {
|
|
639
|
-
console.log('Blocking problematic URL:', request.url);
|
|
640
|
-
return false;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
// Allow all other requests
|
|
644
|
-
return true;
|
|
645
|
-
}}
|
|
646
|
-
onLoadStart={(syntheticEvent) => {
|
|
647
|
-
const { nativeEvent } = syntheticEvent;
|
|
648
|
-
console.log('WebView load started:', nativeEvent.url);
|
|
649
|
-
setIsLoading(true);
|
|
650
|
-
}}
|
|
651
|
-
onLoadProgress={(syntheticEvent) => {
|
|
652
|
-
const { nativeEvent } = syntheticEvent;
|
|
653
|
-
console.log('WebView load progress:', nativeEvent.progress);
|
|
654
|
-
}}
|
|
655
|
-
renderError={(errorName) => (
|
|
656
|
-
<View style={styles.errorContainer}>
|
|
657
|
-
<Icon name="error-outline" size={48} color="#FF6B6B" />
|
|
658
|
-
<Text style={styles.errorTitle}>WebView Error</Text>
|
|
659
|
-
<Text style={styles.errorMessage}>
|
|
660
|
-
Failed to load the authentication page. Error: {errorName}
|
|
661
|
-
</Text>
|
|
662
|
-
<TouchableOpacity style={styles.retryButton} onPress={handleRetry}>
|
|
663
|
-
<Text style={styles.retryButtonText}>Retry</Text>
|
|
664
|
-
</TouchableOpacity>
|
|
665
|
-
</View>
|
|
666
|
-
)}
|
|
667
|
-
renderLoading={() => (
|
|
668
|
-
<View style={styles.loadingContainer}>
|
|
669
|
-
<ActivityIndicator size="large" color={COLORS.primary} />
|
|
670
|
-
<Text style={styles.loadingText}>Loading {platform}...</Text>
|
|
671
|
-
</View>
|
|
672
|
-
)}
|
|
673
|
-
injectedJavaScript={`
|
|
674
|
-
// Prevent white screen issues
|
|
675
|
-
window.addEventListener('error', function(e) {
|
|
676
|
-
console.log('JavaScript error:', e.message);
|
|
677
|
-
});
|
|
678
|
-
|
|
679
|
-
// Handle OAuth redirects
|
|
680
|
-
window.addEventListener('beforeunload', function(e) {
|
|
681
|
-
console.log('Page unloading:', window.location.href);
|
|
682
|
-
});
|
|
683
|
-
|
|
684
|
-
// Monitor for OAuth completion
|
|
685
|
-
setInterval(function() {
|
|
686
|
-
if (window.location.href.includes('code=') ||
|
|
687
|
-
window.location.href.includes('access_token=') ||
|
|
688
|
-
window.location.href.includes('oauth_token=') ||
|
|
689
|
-
window.location.href.includes('api2.onairos.uk')) {
|
|
690
|
-
console.log('OAuth completion detected:', window.location.href);
|
|
691
|
-
}
|
|
692
|
-
}, 1000);
|
|
693
|
-
|
|
694
|
-
true; // Required for injected JavaScript
|
|
695
|
-
`}
|
|
696
|
-
/>
|
|
697
|
-
</SafeAreaView>
|
|
698
|
-
);
|
|
699
|
-
};
|
|
700
|
-
|
|
701
|
-
const styles = StyleSheet.create({
|
|
702
|
-
container: {
|
|
703
|
-
flex: 1,
|
|
704
|
-
backgroundColor: '#fff',
|
|
705
|
-
},
|
|
706
|
-
header: {
|
|
707
|
-
flexDirection: 'row',
|
|
708
|
-
alignItems: 'center',
|
|
709
|
-
height: 56,
|
|
710
|
-
backgroundColor: '#f8f8f8',
|
|
711
|
-
borderBottomWidth: 1,
|
|
712
|
-
borderBottomColor: '#e0e0e0',
|
|
713
|
-
paddingHorizontal: 16,
|
|
714
|
-
},
|
|
715
|
-
titleContainer: {
|
|
716
|
-
flex: 1,
|
|
717
|
-
flexDirection: 'row',
|
|
718
|
-
alignItems: 'center',
|
|
719
|
-
justifyContent: 'center',
|
|
720
|
-
},
|
|
721
|
-
titleText: {
|
|
722
|
-
marginLeft: 8,
|
|
723
|
-
fontSize: 16,
|
|
724
|
-
fontWeight: '500',
|
|
725
|
-
color: '#000',
|
|
726
|
-
},
|
|
727
|
-
closeButton: {
|
|
728
|
-
padding: 8,
|
|
729
|
-
position: 'absolute',
|
|
730
|
-
left: 16,
|
|
731
|
-
zIndex: 10,
|
|
732
|
-
},
|
|
733
|
-
browserButton: {
|
|
734
|
-
backgroundColor: 'transparent',
|
|
735
|
-
borderWidth: 1,
|
|
736
|
-
borderColor: '#666',
|
|
737
|
-
paddingHorizontal: 24,
|
|
738
|
-
paddingVertical: 12,
|
|
739
|
-
borderRadius: 8,
|
|
740
|
-
flexDirection: 'row',
|
|
741
|
-
alignItems: 'center',
|
|
742
|
-
justifyContent: 'center',
|
|
743
|
-
},
|
|
744
|
-
webView: {
|
|
745
|
-
flex: 1,
|
|
746
|
-
},
|
|
747
|
-
loadingContainer: {
|
|
748
|
-
...StyleSheet.absoluteFillObject,
|
|
749
|
-
backgroundColor: 'rgba(255, 255, 255, 0.8)',
|
|
750
|
-
alignItems: 'center',
|
|
751
|
-
justifyContent: 'center',
|
|
752
|
-
},
|
|
753
|
-
loadingText: {
|
|
754
|
-
marginTop: 10,
|
|
755
|
-
fontSize: 16,
|
|
756
|
-
color: '#666',
|
|
757
|
-
},
|
|
758
|
-
errorContainer: {
|
|
759
|
-
flex: 1,
|
|
760
|
-
alignItems: 'center',
|
|
761
|
-
justifyContent: 'center',
|
|
762
|
-
padding: 20,
|
|
763
|
-
},
|
|
764
|
-
errorTitle: {
|
|
765
|
-
fontSize: 18,
|
|
766
|
-
fontWeight: '600',
|
|
767
|
-
color: '#333',
|
|
768
|
-
marginTop: 16,
|
|
769
|
-
marginBottom: 8,
|
|
770
|
-
},
|
|
771
|
-
errorMessage: {
|
|
772
|
-
fontSize: 14,
|
|
773
|
-
color: '#666',
|
|
774
|
-
textAlign: 'center',
|
|
775
|
-
marginBottom: 20,
|
|
776
|
-
},
|
|
777
|
-
retryButton: {
|
|
778
|
-
backgroundColor: COLORS.primary,
|
|
779
|
-
paddingHorizontal: 24,
|
|
780
|
-
paddingVertical: 12,
|
|
781
|
-
borderRadius: 8,
|
|
782
|
-
marginRight: 10,
|
|
783
|
-
flexDirection: 'row',
|
|
784
|
-
alignItems: 'center',
|
|
785
|
-
justifyContent: 'center',
|
|
786
|
-
},
|
|
787
|
-
retryButtonText: {
|
|
788
|
-
color: '#fff',
|
|
789
|
-
fontSize: 16,
|
|
790
|
-
fontWeight: '600',
|
|
791
|
-
},
|
|
792
|
-
buttonContainer: {
|
|
793
|
-
flexDirection: 'row',
|
|
794
|
-
justifyContent: 'center',
|
|
795
|
-
alignItems: 'center',
|
|
796
|
-
marginTop: 10,
|
|
797
|
-
},
|
|
798
|
-
browserButtonText: {
|
|
799
|
-
color: '#666',
|
|
800
|
-
fontSize: 16,
|
|
801
|
-
fontWeight: '600',
|
|
802
|
-
},
|
|
803
|
-
helpContainer: {
|
|
804
|
-
marginBottom: 20,
|
|
805
|
-
},
|
|
806
|
-
helpTitle: {
|
|
807
|
-
fontSize: 18,
|
|
808
|
-
fontWeight: '600',
|
|
809
|
-
color: '#333',
|
|
810
|
-
marginBottom: 8,
|
|
811
|
-
},
|
|
812
|
-
helpText: {
|
|
813
|
-
fontSize: 14,
|
|
814
|
-
color: '#666',
|
|
815
|
-
textAlign: 'center',
|
|
816
|
-
},
|
|
817
|
-
buttonIcon: {
|
|
818
|
-
marginRight: 10,
|
|
819
|
-
},
|
|
820
|
-
persistentErrorContainer: {
|
|
821
|
-
marginTop: 20,
|
|
822
|
-
padding: 20,
|
|
823
|
-
backgroundColor: '#f8f8f8',
|
|
824
|
-
borderRadius: 8,
|
|
825
|
-
},
|
|
826
|
-
persistentErrorText: {
|
|
827
|
-
fontSize: 16,
|
|
828
|
-
fontWeight: '600',
|
|
829
|
-
color: '#333',
|
|
830
|
-
marginBottom: 10,
|
|
831
|
-
},
|
|
832
|
-
persistentErrorStep: {
|
|
833
|
-
fontSize: 14,
|
|
834
|
-
color: '#666',
|
|
835
|
-
textAlign: 'center',
|
|
836
|
-
marginBottom: 5,
|
|
837
|
-
},
|
|
838
|
-
});
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
ActivityIndicator,
|
|
8
|
+
SafeAreaView,
|
|
9
|
+
Dimensions,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import { WebView } from 'react-native-webview';
|
|
12
|
+
|
|
13
|
+
const { width, height } = Dimensions.get('window');
|
|
14
|
+
|
|
15
|
+
export interface OAuthWebViewProps {
|
|
16
|
+
url: string;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
onSuccess: (code: string) => void;
|
|
19
|
+
platform?: string;
|
|
20
|
+
onComplete?: () => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const OAuthWebView: React.FC<OAuthWebViewProps> = ({
|
|
24
|
+
url,
|
|
25
|
+
onClose,
|
|
26
|
+
onSuccess,
|
|
27
|
+
platform = 'platform',
|
|
28
|
+
onComplete,
|
|
29
|
+
}) => {
|
|
30
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
31
|
+
const [timeoutReached, setTimeoutReached] = useState(false);
|
|
32
|
+
|
|
33
|
+
console.log('Opening OAuth WebView with URL:', url);
|
|
34
|
+
|
|
35
|
+
// Set up a timeout to prevent infinite waiting
|
|
36
|
+
React.useEffect(() => {
|
|
37
|
+
const timeout = setTimeout(() => {
|
|
38
|
+
console.log(`⏰ OAuth timeout reached for ${platform} after 1 minutes`);
|
|
39
|
+
setTimeoutReached(true);
|
|
40
|
+
}, 60000); // 1 minutes timeout
|
|
41
|
+
|
|
42
|
+
return () => clearTimeout(timeout);
|
|
43
|
+
}, [platform]);
|
|
44
|
+
|
|
45
|
+
const handleNavigationStateChange = (navState: any) => {
|
|
46
|
+
console.log(`Navigation state changed for ${platform}:`, navState.url);
|
|
47
|
+
|
|
48
|
+
// Check for the final redirect to onairos.uk domain (this means backend callback completed)
|
|
49
|
+
const isFinalRedirect = (
|
|
50
|
+
navState.url.includes('onairos.uk/Home') ||
|
|
51
|
+
navState.url.includes('onairos.uk/home') ||
|
|
52
|
+
navState.url.includes('onairos.uk/success') ||
|
|
53
|
+
navState.url.startsWith('https://onairos.uk/Home') ||
|
|
54
|
+
navState.url.startsWith('https://onairos.uk/home')
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
// For all platforms, we need to wait for the backend callback to complete
|
|
58
|
+
// The backend processes the OAuth callback and then redirects to onairos.uk/Home
|
|
59
|
+
if (isFinalRedirect) {
|
|
60
|
+
console.log(`${platform} OAuth completed - backend callback finished and redirected to Home`);
|
|
61
|
+
onSuccess('success');
|
|
62
|
+
|
|
63
|
+
// Close the OAuth window after a small delay to ensure redirect is processed
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
if (onComplete) {
|
|
66
|
+
console.log(`Closing ${platform} OAuth window after callback completion`);
|
|
67
|
+
onComplete();
|
|
68
|
+
}
|
|
69
|
+
}, 1000); // Increased delay to ensure backend processing completes
|
|
70
|
+
return; // Exit early to avoid other triggers
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Log intermediate callback URLs for debugging but don't close yet
|
|
74
|
+
const isIntermediateCallback = (
|
|
75
|
+
navState.url.includes('/callback') ||
|
|
76
|
+
navState.url.includes('code=') ||
|
|
77
|
+
navState.url.includes('token=') ||
|
|
78
|
+
navState.url.includes('access_token=')
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
if (isIntermediateCallback && !isFinalRedirect) {
|
|
82
|
+
console.log(`Detected intermediate callback URL for ${platform}:`, navState.url);
|
|
83
|
+
console.log('Waiting for backend processing to complete and final redirect...');
|
|
84
|
+
|
|
85
|
+
// Extract authorization code for logging purposes
|
|
86
|
+
const codeMatch = navState.url.match(/code=([^&]+)/);
|
|
87
|
+
if (codeMatch && codeMatch[1]) {
|
|
88
|
+
console.log('OAuth code detected:', codeMatch[1]);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Don't close yet - wait for the backend to process and redirect
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<View style={styles.modalContainer}>
|
|
98
|
+
<SafeAreaView style={styles.container}>
|
|
99
|
+
<View style={styles.header}>
|
|
100
|
+
<Text style={styles.title}>Connect {platform.charAt(0).toUpperCase() + platform.slice(1)}</Text>
|
|
101
|
+
{timeoutReached && (
|
|
102
|
+
<Text style={styles.timeoutText}>Taking longer than expected...</Text>
|
|
103
|
+
)}
|
|
104
|
+
<TouchableOpacity onPress={onClose} style={styles.closeButton}>
|
|
105
|
+
<Text style={styles.closeButtonText}>✕</Text>
|
|
106
|
+
</TouchableOpacity>
|
|
107
|
+
</View>
|
|
108
|
+
|
|
109
|
+
<View style={styles.webViewContainer}>
|
|
110
|
+
{isLoading && (
|
|
111
|
+
<View style={styles.loadingContainer}>
|
|
112
|
+
<ActivityIndicator size="large" color="#1BA9D4" />
|
|
113
|
+
<Text style={styles.loadingText}>Loading...</Text>
|
|
114
|
+
</View>
|
|
115
|
+
)}
|
|
116
|
+
|
|
117
|
+
<WebView
|
|
118
|
+
source={{ uri: url }}
|
|
119
|
+
onNavigationStateChange={handleNavigationStateChange}
|
|
120
|
+
onLoadStart={() => setIsLoading(true)}
|
|
121
|
+
onLoadEnd={() => setIsLoading(false)}
|
|
122
|
+
style={styles.webView}
|
|
123
|
+
javaScriptEnabled={true}
|
|
124
|
+
domStorageEnabled={true}
|
|
125
|
+
cacheEnabled={true} // Enable cache to remember previous logins
|
|
126
|
+
incognito={false} // Disable incognito mode to remember previous logins
|
|
127
|
+
thirdPartyCookiesEnabled={true}
|
|
128
|
+
sharedCookiesEnabled={true} // Enable shared cookies for Google sign-in
|
|
129
|
+
userAgent="Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1"
|
|
130
|
+
onError={(syntheticEvent) => {
|
|
131
|
+
const { nativeEvent } = syntheticEvent;
|
|
132
|
+
console.error(`WebView error for ${platform}:`, nativeEvent);
|
|
133
|
+
// Don't automatically close on error - let user retry or manually close
|
|
134
|
+
}}
|
|
135
|
+
onHttpError={(syntheticEvent) => {
|
|
136
|
+
const { nativeEvent } = syntheticEvent;
|
|
137
|
+
console.error(`WebView HTTP error for ${platform}: ${nativeEvent.statusCode}`, nativeEvent.url);
|
|
138
|
+
|
|
139
|
+
// If we get a 404 or similar error on the final redirect, it might still be successful
|
|
140
|
+
if (nativeEvent.url && nativeEvent.url.includes('onairos.uk')) {
|
|
141
|
+
console.log('HTTP error on onairos.uk domain - treating as potential success');
|
|
142
|
+
onSuccess('success');
|
|
143
|
+
if (onComplete) {
|
|
144
|
+
setTimeout(() => onComplete(), 1000);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}}
|
|
148
|
+
/>
|
|
149
|
+
</View>
|
|
150
|
+
</SafeAreaView>
|
|
151
|
+
</View>
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const styles = StyleSheet.create({
|
|
156
|
+
modalContainer: {
|
|
157
|
+
position: 'absolute',
|
|
158
|
+
top: 0,
|
|
159
|
+
left: 0,
|
|
160
|
+
right: 0,
|
|
161
|
+
bottom: 0,
|
|
162
|
+
width: width,
|
|
163
|
+
height: height,
|
|
164
|
+
backgroundColor: '#fff',
|
|
165
|
+
zIndex: 9999,
|
|
166
|
+
},
|
|
167
|
+
container: {
|
|
168
|
+
flex: 1,
|
|
169
|
+
backgroundColor: '#fff',
|
|
170
|
+
width: width,
|
|
171
|
+
height: height,
|
|
172
|
+
position: 'absolute',
|
|
173
|
+
top: 0,
|
|
174
|
+
left: 0,
|
|
175
|
+
right: 0,
|
|
176
|
+
bottom: 0,
|
|
177
|
+
zIndex: 999,
|
|
178
|
+
},
|
|
179
|
+
header: {
|
|
180
|
+
flexDirection: 'row',
|
|
181
|
+
alignItems: 'center',
|
|
182
|
+
justifyContent: 'space-between',
|
|
183
|
+
paddingHorizontal: 16,
|
|
184
|
+
paddingVertical: 12,
|
|
185
|
+
borderBottomWidth: 1,
|
|
186
|
+
borderBottomColor: '#E5E5E5',
|
|
187
|
+
backgroundColor: '#fff',
|
|
188
|
+
zIndex: 1000,
|
|
189
|
+
},
|
|
190
|
+
title: {
|
|
191
|
+
fontSize: 18,
|
|
192
|
+
fontWeight: '600',
|
|
193
|
+
color: '#333',
|
|
194
|
+
flex: 1,
|
|
195
|
+
textAlign: 'center',
|
|
196
|
+
},
|
|
197
|
+
closeButton: {
|
|
198
|
+
padding: 8,
|
|
199
|
+
},
|
|
200
|
+
closeButtonText: {
|
|
201
|
+
fontSize: 20,
|
|
202
|
+
color: '#666',
|
|
203
|
+
},
|
|
204
|
+
webViewContainer: {
|
|
205
|
+
flex: 1,
|
|
206
|
+
width: width,
|
|
207
|
+
height: height - 60, // Adjust for header height
|
|
208
|
+
},
|
|
209
|
+
webView: {
|
|
210
|
+
flex: 1,
|
|
211
|
+
width: '100%',
|
|
212
|
+
height: '100%',
|
|
213
|
+
},
|
|
214
|
+
loadingContainer: {
|
|
215
|
+
...StyleSheet.absoluteFillObject,
|
|
216
|
+
alignItems: 'center',
|
|
217
|
+
justifyContent: 'center',
|
|
218
|
+
backgroundColor: 'rgba(255, 255, 255, 0.9)',
|
|
219
|
+
zIndex: 1,
|
|
220
|
+
},
|
|
221
|
+
loadingText: {
|
|
222
|
+
marginTop: 12,
|
|
223
|
+
fontSize: 16,
|
|
224
|
+
color: '#666',
|
|
225
|
+
},
|
|
226
|
+
timeoutText: {
|
|
227
|
+
fontSize: 12,
|
|
228
|
+
color: '#FF6B6B',
|
|
229
|
+
textAlign: 'center',
|
|
230
|
+
marginTop: 4,
|
|
231
|
+
},
|
|
232
|
+
});
|