@onairos/react-native 3.1.18 โ 3.2.1
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 +374 -403
- package/lib/commonjs/api/index.js +1 -75
- package/lib/commonjs/api/index.js.map +1 -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.map +1 -1
- package/lib/commonjs/components/DataRequestScreen.js.map +1 -1
- package/lib/commonjs/components/EmailVerificationModal.js.map +1 -1
- package/lib/commonjs/components/Onairos.js +3 -1
- package/lib/commonjs/components/Onairos.js.map +1 -1
- package/lib/commonjs/components/OnairosButton.js +190 -171
- package/lib/commonjs/components/OnairosButton.js.map +1 -1
- package/lib/commonjs/components/Overlay.js +5 -5
- package/lib/commonjs/components/Overlay.js.map +1 -1
- package/lib/commonjs/components/PinInput.js +120 -282
- package/lib/commonjs/components/PinInput.js.map +1 -1
- package/lib/commonjs/components/PlatformList.js.map +1 -1
- package/lib/commonjs/components/TrainingModal.js +563 -808
- package/lib/commonjs/components/TrainingModal.js.map +1 -1
- package/lib/commonjs/components/UniversalOnboarding.js +1296 -2302
- package/lib/commonjs/components/UniversalOnboarding.js.map +1 -1
- package/lib/commonjs/components/UniversalOnboarding.tsx.new +455 -0
- package/lib/commonjs/components/onboarding/OAuthWebView.js +743 -134
- package/lib/commonjs/components/onboarding/OAuthWebView.js.map +1 -1
- package/lib/commonjs/components/onboarding/OnboardingHeader.js.map +1 -1
- package/lib/commonjs/components/onboarding/PinInput.js.map +1 -1
- package/lib/commonjs/components/onboarding/PlatformConnector.js.map +1 -1
- package/lib/commonjs/components/screens/ConnectorScreen.js.map +1 -1
- package/lib/commonjs/components/screens/LoadingScreen.js.map +1 -1
- package/lib/commonjs/components/screens/PinCreationScreen.js.map +1 -1
- package/lib/commonjs/constants/index.js.map +1 -1
- package/lib/commonjs/hooks/useConnections.js +125 -120
- package/lib/commonjs/hooks/useConnections.js.map +1 -1
- package/lib/commonjs/hooks/useCredentials.js.map +1 -1
- package/lib/commonjs/index.js +27 -157
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/services/SDK_API_KEY_VALIDATION.md +428 -0
- package/lib/commonjs/services/apiKeyService.js +106 -105
- package/lib/commonjs/services/apiKeyService.js.map +1 -1
- package/lib/commonjs/services/oauthService.js.map +1 -1
- package/lib/commonjs/services/platformAuthService.js +722 -956
- package/lib/commonjs/services/platformAuthService.js.map +1 -1
- package/lib/commonjs/types/ambient.d.js.map +1 -1
- package/lib/commonjs/types/declarations.d.js.map +1 -1
- package/lib/commonjs/types/index.d.js.map +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/node-fix.d.js.map +1 -1
- package/lib/commonjs/types/node-override.d.js.map +1 -1
- package/lib/commonjs/types/opacity.d.js.map +1 -1
- package/lib/commonjs/types/types.d.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/Portal.js +4 -4
- package/lib/commonjs/utils/Portal.js.map +1 -1
- package/lib/commonjs/utils/api.js +24 -24
- package/lib/commonjs/utils/api.js.map +1 -1
- package/lib/commonjs/utils/auth.js +18 -18
- package/lib/commonjs/utils/auth.js.map +1 -1
- package/lib/commonjs/utils/crypto.js +13 -13
- package/lib/commonjs/utils/crypto.js.map +1 -1
- package/lib/commonjs/utils/debugHelper.js.map +1 -1
- package/lib/commonjs/utils/encryption.js +12 -12
- package/lib/commonjs/utils/encryption.js.map +1 -1
- package/lib/commonjs/utils/onairosApi.js.map +1 -1
- package/lib/commonjs/utils/programmaticFlow.js +16 -16
- package/lib/commonjs/utils/programmaticFlow.js.map +1 -1
- package/lib/commonjs/utils/retryHelper.js +27 -27
- package/lib/commonjs/utils/retryHelper.js.map +1 -1
- package/lib/commonjs/utils/secureStorage.js.map +1 -1
- package/lib/module/api/index.js +0 -72
- package/lib/module/api/index.js.map +1 -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.map +1 -1
- package/lib/module/components/DataRequestScreen.js.map +1 -1
- package/lib/module/components/EmailVerificationModal.js.map +1 -1
- package/lib/module/components/Onairos.js +3 -1
- package/lib/module/components/Onairos.js.map +1 -1
- package/lib/module/components/OnairosButton.js +192 -172
- package/lib/module/components/OnairosButton.js.map +1 -1
- package/lib/module/components/Overlay.js +5 -5
- package/lib/module/components/Overlay.js.map +1 -1
- package/lib/module/components/PinInput.js +120 -283
- package/lib/module/components/PinInput.js.map +1 -1
- package/lib/module/components/PlatformList.js.map +1 -1
- package/lib/module/components/TrainingModal.js +565 -809
- package/lib/module/components/TrainingModal.js.map +1 -1
- package/lib/module/components/UniversalOnboarding.js +1297 -2305
- package/lib/module/components/UniversalOnboarding.js.map +1 -1
- package/lib/module/components/UniversalOnboarding.tsx.new +455 -0
- package/lib/module/components/onboarding/OAuthWebView.js +744 -136
- package/lib/module/components/onboarding/OAuthWebView.js.map +1 -1
- package/lib/module/components/onboarding/OnboardingHeader.js.map +1 -1
- package/lib/module/components/onboarding/PinInput.js.map +1 -1
- package/lib/module/components/onboarding/PlatformConnector.js.map +1 -1
- package/lib/module/components/screens/ConnectorScreen.js.map +1 -1
- package/lib/module/components/screens/LoadingScreen.js.map +1 -1
- package/lib/module/components/screens/PinCreationScreen.js.map +1 -1
- package/lib/module/constants/index.js.map +1 -1
- package/lib/module/hooks/useConnections.js +125 -119
- package/lib/module/hooks/useConnections.js.map +1 -1
- package/lib/module/hooks/useCredentials.js.map +1 -1
- package/lib/module/index.js +17 -55
- package/lib/module/index.js.map +1 -1
- package/lib/module/services/SDK_API_KEY_VALIDATION.md +428 -0
- package/lib/module/services/apiKeyService.js +106 -105
- package/lib/module/services/apiKeyService.js.map +1 -1
- package/lib/module/services/oauthService.js.map +1 -1
- package/lib/module/services/platformAuthService.js +704 -943
- package/lib/module/services/platformAuthService.js.map +1 -1
- package/lib/module/types/ambient.d.js.map +1 -1
- package/lib/module/types/declarations.d.js.map +1 -1
- package/lib/module/types/index.d.js.map +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/node-fix.d.js.map +1 -1
- package/lib/module/types/node-override.d.js.map +1 -1
- package/lib/module/types/opacity.d.js.map +1 -1
- package/lib/module/types/types.d.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/Portal.js +4 -4
- package/lib/module/utils/Portal.js.map +1 -1
- package/lib/module/utils/api.js +24 -24
- package/lib/module/utils/api.js.map +1 -1
- package/lib/module/utils/auth.js +18 -18
- package/lib/module/utils/auth.js.map +1 -1
- package/lib/module/utils/crypto.js +13 -13
- package/lib/module/utils/crypto.js.map +1 -1
- package/lib/module/utils/debugHelper.js.map +1 -1
- package/lib/module/utils/encryption.js +12 -12
- package/lib/module/utils/encryption.js.map +1 -1
- package/lib/module/utils/onairosApi.js.map +1 -1
- package/lib/module/utils/programmaticFlow.js +16 -16
- package/lib/module/utils/programmaticFlow.js.map +1 -1
- package/lib/module/utils/retryHelper.js +27 -27
- package/lib/module/utils/retryHelper.js.map +1 -1
- package/lib/module/utils/secureStorage.js.map +1 -1
- package/lib/typescript/api/index.d.ts +7 -15
- package/lib/typescript/api/index.d.ts.map +1 -1
- package/lib/typescript/components/DataRequestModal.d.ts +10 -10
- package/lib/typescript/components/DataRequestScreen.d.ts +10 -10
- package/lib/typescript/components/EmailVerificationModal.d.ts +10 -10
- package/lib/typescript/components/Onairos.d.ts +3 -3
- package/lib/typescript/components/Onairos.d.ts.map +1 -1
- package/lib/typescript/components/OnairosButton.d.ts +11 -36
- package/lib/typescript/components/OnairosButton.d.ts.map +1 -1
- package/lib/typescript/components/Overlay.d.ts +3 -3
- package/lib/typescript/components/PinInput.d.ts +3 -13
- package/lib/typescript/components/PinInput.d.ts.map +1 -1
- package/lib/typescript/components/PlatformList.d.ts +3 -3
- package/lib/typescript/components/TrainingModal.d.ts +3 -14
- package/lib/typescript/components/TrainingModal.d.ts.map +1 -1
- package/lib/typescript/components/UniversalOnboarding.d.ts +3 -16
- package/lib/typescript/components/UniversalOnboarding.d.ts.map +1 -1
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts +9 -9
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts.map +1 -1
- package/lib/typescript/components/onboarding/OnboardingHeader.d.ts +10 -10
- package/lib/typescript/components/onboarding/PinInput.d.ts +3 -3
- package/lib/typescript/components/onboarding/PlatformConnector.d.ts +12 -12
- package/lib/typescript/components/screens/ConnectorScreen.d.ts +8 -8
- package/lib/typescript/components/screens/LoadingScreen.d.ts +8 -8
- package/lib/typescript/components/screens/PinCreationScreen.d.ts +9 -9
- package/lib/typescript/constants/index.d.ts +52 -52
- package/lib/typescript/hooks/useConnections.d.ts +8 -13
- package/lib/typescript/hooks/useConnections.d.ts.map +1 -1
- package/lib/typescript/hooks/useCredentials.d.ts +8 -8
- package/lib/typescript/index.d.ts +17 -38
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/services/apiKeyService.d.ts +131 -131
- package/lib/typescript/services/apiKeyService.d.ts.map +1 -1
- package/lib/typescript/services/oauthService.d.ts +49 -49
- package/lib/typescript/services/platformAuthService.d.ts +143 -68
- package/lib/typescript/services/platformAuthService.d.ts.map +1 -1
- package/lib/typescript/types/index.d.ts +228 -264
- package/lib/typescript/types/index.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +268 -266
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils/Portal.d.ts +13 -13
- package/lib/typescript/utils/api.d.ts +5 -5
- package/lib/typescript/utils/auth.d.ts +5 -5
- package/lib/typescript/utils/crypto.d.ts +3 -3
- package/lib/typescript/utils/debugHelper.d.ts +28 -28
- package/lib/typescript/utils/encryption.d.ts +18 -18
- package/lib/typescript/utils/onairosApi.d.ts +86 -86
- package/lib/typescript/utils/programmaticFlow.d.ts +22 -22
- package/lib/typescript/utils/retryHelper.d.ts +68 -68
- package/lib/typescript/utils/secureStorage.d.ts +93 -93
- package/package.json +149 -145
- package/src/api/index.ts +110 -151
- 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/DataRequestScreen.tsx +355 -355
- package/src/components/EmailVerificationModal.tsx +363 -363
- package/src/components/Onairos.tsx +424 -422
- package/src/components/OnairosButton.tsx +359 -339
- package/src/components/Overlay.tsx +506 -506
- package/src/components/PinInput.tsx +343 -555
- package/src/components/PlatformList.tsx +144 -144
- package/src/components/TrainingModal.tsx +737 -1047
- package/src/components/UniversalOnboarding.tsx +1839 -2888
- package/src/components/UniversalOnboarding.tsx.new +455 -0
- package/src/components/onboarding/OAuthWebView.tsx +838 -232
- package/src/hooks/useConnections.ts +163 -161
- package/src/hooks/useCredentials.ts +174 -174
- package/src/index.js +14 -14
- package/src/index.ts +49 -99
- package/src/services/SDK_API_KEY_VALIDATION.md +428 -0
- package/src/services/apiKeyService.ts +921 -919
- package/src/services/platformAuthService.ts +1113 -1346
- package/src/types/ambient.d.ts +28 -28
- package/src/types/index.ts +241 -265
- package/src/types/node-fix.d.ts +18 -18
- package/src/types/node-override.d.ts +23 -23
- package/src/types/opacity.d.ts +15 -15
- package/src/types/types.d.ts +17 -17
- package/src/types.ts +6 -4
- package/src/utils/Portal.tsx +82 -82
- package/src/utils/api.js +111 -111
- package/src/utils/auth.js +103 -103
- package/src/utils/crypto.js +59 -59
- package/src/utils/encryption.ts +68 -68
- package/src/utils/programmaticFlow.ts +112 -112
- package/src/utils/retryHelper.ts +274 -274
- package/types/index.d.ts +213 -213
- package/types/node-env.d.ts +14 -14
- 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 +0 -3
- package/lib/commonjs/assets/images/EnochE.svg +0 -19
- 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 +0 -3
- package/lib/commonjs/assets/images/Personalitytraits.svg +0 -3
- package/lib/commonjs/assets/images/Redditicon.png +0 -0
- package/lib/commonjs/assets/images/Userpreferences.svg +0 -3
- package/lib/commonjs/assets/images/YouTubeicon3.png +0 -0
- package/lib/commonjs/assets/images/arrow.svg +0 -20
- package/lib/commonjs/assets/images/basicproficon.svg +0 -43
- package/lib/commonjs/assets/images/basicprofile.svg +0 -3
- package/lib/commonjs/assets/images/checkmark.svg +0 -4
- package/lib/commonjs/assets/images/contentanalysis.svg +0 -3
- package/lib/commonjs/assets/images/contenticon.svg +0 -23
- 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 +0 -18
- package/lib/commonjs/assets/images/x-close.svg +0 -3
- package/lib/commonjs/components/BodyText.js +0 -27
- package/lib/commonjs/components/BodyText.js.map +0 -1
- package/lib/commonjs/components/BrandMark.js +0 -44
- package/lib/commonjs/components/BrandMark.js.map +0 -1
- package/lib/commonjs/components/CodeInput.js +0 -30
- package/lib/commonjs/components/CodeInput.js.map +0 -1
- package/lib/commonjs/components/EmailInput.js +0 -30
- package/lib/commonjs/components/EmailInput.js.map +0 -1
- package/lib/commonjs/components/ExistingUserDataConfirmation.js +0 -474
- package/lib/commonjs/components/ExistingUserDataConfirmation.js.map +0 -1
- package/lib/commonjs/components/GoogleButton.js +0 -55
- package/lib/commonjs/components/GoogleButton.js.map +0 -1
- package/lib/commonjs/components/HeadingGroup.js +0 -43
- package/lib/commonjs/components/HeadingGroup.js.map +0 -1
- package/lib/commonjs/components/ModalHeader.js +0 -99
- package/lib/commonjs/components/ModalHeader.js.map +0 -1
- package/lib/commonjs/components/ModalSheet.js +0 -47
- package/lib/commonjs/components/ModalSheet.js.map +0 -1
- package/lib/commonjs/components/OnairosSignInButton.js +0 -129
- package/lib/commonjs/components/OnairosSignInButton.js.map +0 -1
- package/lib/commonjs/components/PersonaImage.js +0 -60
- package/lib/commonjs/components/PersonaImage.js.map +0 -1
- package/lib/commonjs/components/PersonaLoadingScreen.js +0 -156
- package/lib/commonjs/components/PersonaLoadingScreen.js.map +0 -1
- package/lib/commonjs/components/PersonalizationConsentScreen.js +0 -316
- package/lib/commonjs/components/PersonalizationConsentScreen.js.map +0 -1
- package/lib/commonjs/components/PinCreationScreen.js +0 -393
- package/lib/commonjs/components/PinCreationScreen.js.map +0 -1
- package/lib/commonjs/components/PlatformConnectorsStep.js +0 -828
- package/lib/commonjs/components/PlatformConnectorsStep.js.map +0 -1
- package/lib/commonjs/components/PlatformToggle.js +0 -180
- package/lib/commonjs/components/PlatformToggle.js.map +0 -1
- package/lib/commonjs/components/PrimaryButton.js +0 -180
- package/lib/commonjs/components/PrimaryButton.js.map +0 -1
- package/lib/commonjs/components/SignInMatchAnimation.js +0 -197
- package/lib/commonjs/components/SignInMatchAnimation.js.map +0 -1
- package/lib/commonjs/components/SignInStep.js +0 -179
- package/lib/commonjs/components/SignInStep.js.map +0 -1
- package/lib/commonjs/components/VerificationStep.js +0 -154
- package/lib/commonjs/components/VerificationStep.js.map +0 -1
- package/lib/commonjs/components/WelcomeScreen.js +0 -401
- package/lib/commonjs/components/WelcomeScreen.js.map +0 -1
- package/lib/commonjs/components/icons/Basicproficon.js +0 -37
- package/lib/commonjs/components/icons/Basicproficon.js.map +0 -1
- package/lib/commonjs/components/icons/Basicprofile.js +0 -21
- package/lib/commonjs/components/icons/Basicprofile.js.map +0 -1
- package/lib/commonjs/components/icons/Checkbox.js +0 -21
- package/lib/commonjs/components/icons/Checkbox.js.map +0 -1
- package/lib/commonjs/components/icons/Checkmark.js +0 -27
- package/lib/commonjs/components/icons/Checkmark.js.map +0 -1
- package/lib/commonjs/components/icons/Contentanalysis.js +0 -21
- package/lib/commonjs/components/icons/Contentanalysis.js.map +0 -1
- package/lib/commonjs/components/icons/Contenticon.js +0 -39
- package/lib/commonjs/components/icons/Contenticon.js.map +0 -1
- package/lib/commonjs/components/icons/EnochE.js +0 -41
- package/lib/commonjs/components/icons/EnochE.js.map +0 -1
- package/lib/commonjs/components/icons/Personalityicon.js +0 -30
- package/lib/commonjs/components/icons/Personalityicon.js.map +0 -1
- package/lib/commonjs/components/icons/Personalityprofile.js +0 -21
- package/lib/commonjs/components/icons/Personalityprofile.js.map +0 -1
- package/lib/commonjs/components/icons/Personalitytraits.js +0 -21
- package/lib/commonjs/components/icons/Personalitytraits.js.map +0 -1
- package/lib/commonjs/components/icons/Userpreferences.js +0 -21
- package/lib/commonjs/components/icons/Userpreferences.js.map +0 -1
- package/lib/commonjs/components/icons/index.js +0 -84
- package/lib/commonjs/components/icons/index.js.map +0 -1
- package/lib/commonjs/config/api.js +0 -34
- package/lib/commonjs/config/api.js.map +0 -1
- package/lib/commonjs/context/AuthContext.js +0 -345
- package/lib/commonjs/context/AuthContext.js.map +0 -1
- package/lib/commonjs/hooks/useConnectedAccounts.js +0 -111
- package/lib/commonjs/hooks/useConnectedAccounts.js.map +0 -1
- package/lib/commonjs/hooks/useUserConnections.js +0 -148
- package/lib/commonjs/hooks/useUserConnections.js.map +0 -1
- package/lib/commonjs/services/apiClient.js +0 -302
- package/lib/commonjs/services/apiClient.js.map +0 -1
- package/lib/commonjs/services/authService.js +0 -935
- package/lib/commonjs/services/authService.js.map +0 -1
- package/lib/commonjs/services/biometricPinService.js +0 -184
- package/lib/commonjs/services/biometricPinService.js.map +0 -1
- package/lib/commonjs/services/connectedAccountsService.js +0 -268
- package/lib/commonjs/services/connectedAccountsService.js.map +0 -1
- package/lib/commonjs/services/googleAuthService.js +0 -268
- package/lib/commonjs/services/googleAuthService.js.map +0 -1
- package/lib/commonjs/services/imageCompressionService.js +0 -260
- package/lib/commonjs/services/imageCompressionService.js.map +0 -1
- package/lib/commonjs/services/jwtStorageService.js +0 -256
- package/lib/commonjs/services/jwtStorageService.js.map +0 -1
- package/lib/commonjs/services/mobileTrainingService.js +0 -185
- package/lib/commonjs/services/mobileTrainingService.js.map +0 -1
- package/lib/commonjs/services/pinEncryptionService.js +0 -84
- package/lib/commonjs/services/pinEncryptionService.js.map +0 -1
- package/lib/commonjs/services/pinStorageUtils.js +0 -105
- package/lib/commonjs/services/pinStorageUtils.js.map +0 -1
- package/lib/commonjs/services/storageService.js +0 -404
- package/lib/commonjs/services/storageService.js.map +0 -1
- package/lib/commonjs/services/trainingApiHelpers.js +0 -73
- package/lib/commonjs/services/trainingApiHelpers.js.map +0 -1
- package/lib/commonjs/services/userConnectionsService.js +0 -486
- package/lib/commonjs/services/userConnectionsService.js.map +0 -1
- package/lib/commonjs/services/youtubeMigrationService.js +0 -415
- package/lib/commonjs/services/youtubeMigrationService.js.map +0 -1
- package/lib/commonjs/theme/index.js +0 -249
- package/lib/commonjs/theme/index.js.map +0 -1
- package/lib/commonjs/utils/eventUtils.js +0 -288
- package/lib/commonjs/utils/eventUtils.js.map +0 -1
- package/lib/commonjs/utils/haptics.js +0 -66
- package/lib/commonjs/utils/haptics.js.map +0 -1
- package/lib/commonjs/utils/imagePreloader.js +0 -6
- package/lib/commonjs/utils/imagePreloader.js.map +0 -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 +0 -3
- package/lib/module/assets/images/EnochE.svg +0 -19
- 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 +0 -3
- package/lib/module/assets/images/Personalitytraits.svg +0 -3
- package/lib/module/assets/images/Redditicon.png +0 -0
- package/lib/module/assets/images/Userpreferences.svg +0 -3
- package/lib/module/assets/images/YouTubeicon3.png +0 -0
- package/lib/module/assets/images/arrow.svg +0 -20
- package/lib/module/assets/images/basicproficon.svg +0 -43
- package/lib/module/assets/images/basicprofile.svg +0 -3
- package/lib/module/assets/images/checkmark.svg +0 -4
- package/lib/module/assets/images/contentanalysis.svg +0 -3
- package/lib/module/assets/images/contenticon.svg +0 -23
- 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 +0 -18
- package/lib/module/assets/images/x-close.svg +0 -3
- package/lib/module/components/BodyText.js +0 -20
- package/lib/module/components/BodyText.js.map +0 -1
- package/lib/module/components/BrandMark.js +0 -37
- package/lib/module/components/BrandMark.js.map +0 -1
- package/lib/module/components/CodeInput.js +0 -23
- package/lib/module/components/CodeInput.js.map +0 -1
- package/lib/module/components/EmailInput.js +0 -23
- package/lib/module/components/EmailInput.js.map +0 -1
- package/lib/module/components/ExistingUserDataConfirmation.js +0 -465
- package/lib/module/components/ExistingUserDataConfirmation.js.map +0 -1
- package/lib/module/components/GoogleButton.js +0 -48
- package/lib/module/components/GoogleButton.js.map +0 -1
- package/lib/module/components/HeadingGroup.js +0 -36
- package/lib/module/components/HeadingGroup.js.map +0 -1
- package/lib/module/components/ModalHeader.js +0 -92
- package/lib/module/components/ModalHeader.js.map +0 -1
- package/lib/module/components/ModalSheet.js +0 -39
- package/lib/module/components/ModalSheet.js.map +0 -1
- package/lib/module/components/OnairosSignInButton.js +0 -120
- package/lib/module/components/OnairosSignInButton.js.map +0 -1
- package/lib/module/components/PersonaImage.js +0 -53
- package/lib/module/components/PersonaImage.js.map +0 -1
- package/lib/module/components/PersonaLoadingScreen.js +0 -148
- package/lib/module/components/PersonaLoadingScreen.js.map +0 -1
- package/lib/module/components/PersonalizationConsentScreen.js +0 -309
- package/lib/module/components/PersonalizationConsentScreen.js.map +0 -1
- package/lib/module/components/PinCreationScreen.js +0 -386
- package/lib/module/components/PinCreationScreen.js.map +0 -1
- package/lib/module/components/PlatformConnectorsStep.js +0 -820
- package/lib/module/components/PlatformConnectorsStep.js.map +0 -1
- package/lib/module/components/PlatformToggle.js +0 -173
- package/lib/module/components/PlatformToggle.js.map +0 -1
- package/lib/module/components/PrimaryButton.js +0 -172
- package/lib/module/components/PrimaryButton.js.map +0 -1
- package/lib/module/components/SignInMatchAnimation.js +0 -189
- package/lib/module/components/SignInMatchAnimation.js.map +0 -1
- package/lib/module/components/SignInStep.js +0 -171
- package/lib/module/components/SignInStep.js.map +0 -1
- package/lib/module/components/VerificationStep.js +0 -146
- package/lib/module/components/VerificationStep.js.map +0 -1
- package/lib/module/components/WelcomeScreen.js +0 -393
- package/lib/module/components/WelcomeScreen.js.map +0 -1
- package/lib/module/components/icons/Basicproficon.js +0 -30
- package/lib/module/components/icons/Basicproficon.js.map +0 -1
- package/lib/module/components/icons/Basicprofile.js +0 -14
- package/lib/module/components/icons/Basicprofile.js.map +0 -1
- package/lib/module/components/icons/Checkbox.js +0 -14
- package/lib/module/components/icons/Checkbox.js.map +0 -1
- package/lib/module/components/icons/Checkmark.js +0 -20
- package/lib/module/components/icons/Checkmark.js.map +0 -1
- package/lib/module/components/icons/Contentanalysis.js +0 -14
- package/lib/module/components/icons/Contentanalysis.js.map +0 -1
- package/lib/module/components/icons/Contenticon.js +0 -32
- package/lib/module/components/icons/Contenticon.js.map +0 -1
- package/lib/module/components/icons/EnochE.js +0 -34
- package/lib/module/components/icons/EnochE.js.map +0 -1
- package/lib/module/components/icons/Personalityicon.js +0 -23
- package/lib/module/components/icons/Personalityicon.js.map +0 -1
- package/lib/module/components/icons/Personalityprofile.js +0 -14
- package/lib/module/components/icons/Personalityprofile.js.map +0 -1
- package/lib/module/components/icons/Personalitytraits.js +0 -14
- package/lib/module/components/icons/Personalitytraits.js.map +0 -1
- package/lib/module/components/icons/Userpreferences.js +0 -14
- package/lib/module/components/icons/Userpreferences.js.map +0 -1
- package/lib/module/components/icons/index.js +0 -13
- package/lib/module/components/icons/index.js.map +0 -1
- package/lib/module/config/api.js +0 -26
- package/lib/module/config/api.js.map +0 -1
- package/lib/module/context/AuthContext.js +0 -335
- package/lib/module/context/AuthContext.js.map +0 -1
- package/lib/module/hooks/useConnectedAccounts.js +0 -106
- package/lib/module/hooks/useConnectedAccounts.js.map +0 -1
- package/lib/module/hooks/useUserConnections.js +0 -140
- package/lib/module/hooks/useUserConnections.js.map +0 -1
- package/lib/module/services/apiClient.js +0 -298
- package/lib/module/services/apiClient.js.map +0 -1
- package/lib/module/services/authService.js +0 -905
- package/lib/module/services/authService.js.map +0 -1
- package/lib/module/services/biometricPinService.js +0 -173
- package/lib/module/services/biometricPinService.js.map +0 -1
- package/lib/module/services/connectedAccountsService.js +0 -255
- package/lib/module/services/connectedAccountsService.js.map +0 -1
- package/lib/module/services/googleAuthService.js +0 -258
- package/lib/module/services/googleAuthService.js.map +0 -1
- package/lib/module/services/imageCompressionService.js +0 -250
- package/lib/module/services/imageCompressionService.js.map +0 -1
- package/lib/module/services/jwtStorageService.js +0 -239
- package/lib/module/services/jwtStorageService.js.map +0 -1
- package/lib/module/services/mobileTrainingService.js +0 -172
- package/lib/module/services/mobileTrainingService.js.map +0 -1
- package/lib/module/services/pinEncryptionService.js +0 -75
- package/lib/module/services/pinEncryptionService.js.map +0 -1
- package/lib/module/services/pinStorageUtils.js +0 -93
- package/lib/module/services/pinStorageUtils.js.map +0 -1
- package/lib/module/services/storageService.js +0 -383
- package/lib/module/services/storageService.js.map +0 -1
- package/lib/module/services/trainingApiHelpers.js +0 -67
- package/lib/module/services/trainingApiHelpers.js.map +0 -1
- package/lib/module/services/userConnectionsService.js +0 -476
- package/lib/module/services/userConnectionsService.js.map +0 -1
- package/lib/module/services/youtubeMigrationService.js +0 -404
- package/lib/module/services/youtubeMigrationService.js.map +0 -1
- package/lib/module/theme/index.js +0 -244
- package/lib/module/theme/index.js.map +0 -1
- package/lib/module/utils/eventUtils.js +0 -270
- package/lib/module/utils/eventUtils.js.map +0 -1
- package/lib/module/utils/haptics.js +0 -59
- package/lib/module/utils/haptics.js.map +0 -1
- package/lib/module/utils/imagePreloader.js +0 -3
- package/lib/module/utils/imagePreloader.js.map +0 -1
- package/lib/typescript/components/BodyText.d.ts +0 -10
- package/lib/typescript/components/BodyText.d.ts.map +0 -1
- package/lib/typescript/components/BrandMark.d.ts +0 -11
- package/lib/typescript/components/BrandMark.d.ts.map +0 -1
- package/lib/typescript/components/CodeInput.d.ts +0 -10
- package/lib/typescript/components/CodeInput.d.ts.map +0 -1
- package/lib/typescript/components/EmailInput.d.ts +0 -8
- package/lib/typescript/components/EmailInput.d.ts.map +0 -1
- package/lib/typescript/components/ExistingUserDataConfirmation.d.ts +0 -12
- package/lib/typescript/components/ExistingUserDataConfirmation.d.ts.map +0 -1
- package/lib/typescript/components/GoogleButton.d.ts +0 -11
- package/lib/typescript/components/GoogleButton.d.ts.map +0 -1
- package/lib/typescript/components/HeadingGroup.d.ts +0 -11
- package/lib/typescript/components/HeadingGroup.d.ts.map +0 -1
- package/lib/typescript/components/ModalHeader.d.ts +0 -11
- package/lib/typescript/components/ModalHeader.d.ts.map +0 -1
- package/lib/typescript/components/ModalSheet.d.ts +0 -13
- package/lib/typescript/components/ModalSheet.d.ts.map +0 -1
- package/lib/typescript/components/OnairosSignInButton.d.ts +0 -13
- package/lib/typescript/components/OnairosSignInButton.d.ts.map +0 -1
- package/lib/typescript/components/PersonaImage.d.ts +0 -8
- package/lib/typescript/components/PersonaImage.d.ts.map +0 -1
- package/lib/typescript/components/PersonaLoadingScreen.d.ts +0 -10
- package/lib/typescript/components/PersonaLoadingScreen.d.ts.map +0 -1
- package/lib/typescript/components/PersonalizationConsentScreen.d.ts +0 -10
- package/lib/typescript/components/PersonalizationConsentScreen.d.ts.map +0 -1
- package/lib/typescript/components/PinCreationScreen.d.ts +0 -10
- package/lib/typescript/components/PinCreationScreen.d.ts.map +0 -1
- package/lib/typescript/components/PlatformConnectorsStep.d.ts +0 -11
- package/lib/typescript/components/PlatformConnectorsStep.d.ts.map +0 -1
- package/lib/typescript/components/PlatformToggle.d.ts +0 -20
- package/lib/typescript/components/PlatformToggle.d.ts.map +0 -1
- package/lib/typescript/components/PrimaryButton.d.ts +0 -22
- package/lib/typescript/components/PrimaryButton.d.ts.map +0 -1
- package/lib/typescript/components/SignInMatchAnimation.d.ts +0 -9
- package/lib/typescript/components/SignInMatchAnimation.d.ts.map +0 -1
- package/lib/typescript/components/SignInStep.d.ts +0 -12
- package/lib/typescript/components/SignInStep.d.ts.map +0 -1
- package/lib/typescript/components/VerificationStep.d.ts +0 -13
- package/lib/typescript/components/VerificationStep.d.ts.map +0 -1
- package/lib/typescript/components/WelcomeScreen.d.ts +0 -9
- package/lib/typescript/components/WelcomeScreen.d.ts.map +0 -1
- package/lib/typescript/components/icons/Basicproficon.d.ts +0 -5
- package/lib/typescript/components/icons/Basicproficon.d.ts.map +0 -1
- package/lib/typescript/components/icons/Basicprofile.d.ts +0 -5
- package/lib/typescript/components/icons/Basicprofile.d.ts.map +0 -1
- package/lib/typescript/components/icons/Checkbox.d.ts +0 -5
- package/lib/typescript/components/icons/Checkbox.d.ts.map +0 -1
- package/lib/typescript/components/icons/Checkmark.d.ts +0 -5
- package/lib/typescript/components/icons/Checkmark.d.ts.map +0 -1
- package/lib/typescript/components/icons/Contentanalysis.d.ts +0 -5
- package/lib/typescript/components/icons/Contentanalysis.d.ts.map +0 -1
- package/lib/typescript/components/icons/Contenticon.d.ts +0 -5
- package/lib/typescript/components/icons/Contenticon.d.ts.map +0 -1
- package/lib/typescript/components/icons/EnochE.d.ts +0 -5
- package/lib/typescript/components/icons/EnochE.d.ts.map +0 -1
- package/lib/typescript/components/icons/Personalityicon.d.ts +0 -5
- package/lib/typescript/components/icons/Personalityicon.d.ts.map +0 -1
- package/lib/typescript/components/icons/Personalityprofile.d.ts +0 -5
- package/lib/typescript/components/icons/Personalityprofile.d.ts.map +0 -1
- package/lib/typescript/components/icons/Personalitytraits.d.ts +0 -5
- package/lib/typescript/components/icons/Personalitytraits.d.ts.map +0 -1
- package/lib/typescript/components/icons/Userpreferences.d.ts +0 -5
- package/lib/typescript/components/icons/Userpreferences.d.ts.map +0 -1
- package/lib/typescript/components/icons/index.d.ts +0 -12
- package/lib/typescript/components/icons/index.d.ts.map +0 -1
- package/lib/typescript/config/api.d.ts +0 -24
- package/lib/typescript/config/api.d.ts.map +0 -1
- package/lib/typescript/context/AuthContext.d.ts +0 -34
- package/lib/typescript/context/AuthContext.d.ts.map +0 -1
- package/lib/typescript/hooks/useConnectedAccounts.d.ts +0 -11
- package/lib/typescript/hooks/useConnectedAccounts.d.ts.map +0 -1
- package/lib/typescript/hooks/useUserConnections.d.ts +0 -12
- package/lib/typescript/hooks/useUserConnections.d.ts.map +0 -1
- package/lib/typescript/services/apiClient.d.ts +0 -91
- package/lib/typescript/services/apiClient.d.ts.map +0 -1
- package/lib/typescript/services/authService.d.ts +0 -216
- package/lib/typescript/services/authService.d.ts.map +0 -1
- package/lib/typescript/services/biometricPinService.d.ts +0 -29
- package/lib/typescript/services/biometricPinService.d.ts.map +0 -1
- package/lib/typescript/services/connectedAccountsService.d.ts +0 -56
- package/lib/typescript/services/connectedAccountsService.d.ts.map +0 -1
- package/lib/typescript/services/googleAuthService.d.ts +0 -63
- package/lib/typescript/services/googleAuthService.d.ts.map +0 -1
- package/lib/typescript/services/imageCompressionService.d.ts +0 -37
- package/lib/typescript/services/imageCompressionService.d.ts.map +0 -1
- package/lib/typescript/services/jwtStorageService.d.ts +0 -86
- package/lib/typescript/services/jwtStorageService.d.ts.map +0 -1
- package/lib/typescript/services/mobileTrainingService.d.ts +0 -45
- package/lib/typescript/services/mobileTrainingService.d.ts.map +0 -1
- package/lib/typescript/services/pinEncryptionService.d.ts +0 -17
- package/lib/typescript/services/pinEncryptionService.d.ts.map +0 -1
- package/lib/typescript/services/pinStorageUtils.d.ts +0 -25
- package/lib/typescript/services/pinStorageUtils.d.ts.map +0 -1
- package/lib/typescript/services/storageService.d.ts +0 -128
- package/lib/typescript/services/storageService.d.ts.map +0 -1
- package/lib/typescript/services/trainingApiHelpers.d.ts +0 -38
- package/lib/typescript/services/trainingApiHelpers.d.ts.map +0 -1
- package/lib/typescript/services/userConnectionsService.d.ts +0 -90
- package/lib/typescript/services/userConnectionsService.d.ts.map +0 -1
- package/lib/typescript/services/youtubeMigrationService.d.ts +0 -12
- package/lib/typescript/services/youtubeMigrationService.d.ts.map +0 -1
- package/lib/typescript/theme/index.d.ts +0 -416
- package/lib/typescript/theme/index.d.ts.map +0 -1
- package/lib/typescript/utils/eventUtils.d.ts +0 -108
- package/lib/typescript/utils/eventUtils.d.ts.map +0 -1
- package/lib/typescript/utils/haptics.d.ts +0 -11
- package/lib/typescript/utils/haptics.d.ts.map +0 -1
- package/lib/typescript/utils/imagePreloader.d.ts +0 -2
- package/lib/typescript/utils/imagePreloader.d.ts.map +0 -1
- 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 +0 -3
- package/src/assets/images/EnochE.svg +0 -19
- 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 +0 -3
- package/src/assets/images/Personalitytraits.svg +0 -3
- package/src/assets/images/Redditicon.png +0 -0
- package/src/assets/images/Userpreferences.svg +0 -3
- package/src/assets/images/YouTubeicon3.png +0 -0
- package/src/assets/images/arrow.svg +0 -20
- package/src/assets/images/basicproficon.svg +0 -43
- package/src/assets/images/basicprofile.svg +0 -3
- package/src/assets/images/checkmark.svg +0 -4
- package/src/assets/images/contentanalysis.svg +0 -3
- package/src/assets/images/contenticon.svg +0 -23
- 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 +0 -18
- package/src/assets/images/x-close.svg +0 -3
- package/src/components/BodyText.tsx +0 -33
- package/src/components/BrandMark.tsx +0 -62
- package/src/components/CodeInput.tsx +0 -32
- package/src/components/EmailInput.tsx +0 -31
- package/src/components/ExistingUserDataConfirmation.tsx +0 -507
- package/src/components/GoogleButton.tsx +0 -55
- package/src/components/HeadingGroup.tsx +0 -49
- package/src/components/ModalHeader.tsx +0 -125
- package/src/components/ModalSheet.tsx +0 -59
- package/src/components/OnairosSignInButton.tsx +0 -132
- package/src/components/PersonaImage.tsx +0 -79
- package/src/components/PersonaLoadingScreen.tsx +0 -201
- package/src/components/PersonalizationConsentScreen.tsx +0 -410
- package/src/components/PinCreationScreen.tsx +0 -492
- package/src/components/PlatformConnectorsStep.tsx +0 -892
- package/src/components/PlatformToggle.tsx +0 -226
- package/src/components/PrimaryButton.tsx +0 -214
- package/src/components/SignInMatchAnimation.tsx +0 -225
- package/src/components/SignInStep.tsx +0 -217
- package/src/components/VerificationStep.tsx +0 -198
- package/src/components/WelcomeScreen.tsx +0 -490
- package/src/components/icons/Basicproficon.tsx +0 -30
- package/src/components/icons/Basicprofile.tsx +0 -17
- package/src/components/icons/Checkbox.tsx +0 -17
- package/src/components/icons/Checkmark.tsx +0 -24
- package/src/components/icons/Contentanalysis.tsx +0 -17
- package/src/components/icons/Contenticon.tsx +0 -30
- package/src/components/icons/EnochE.tsx +0 -39
- package/src/components/icons/Personalityicon.tsx +0 -22
- package/src/components/icons/Personalityprofile.tsx +0 -17
- package/src/components/icons/Personalitytraits.tsx +0 -17
- package/src/components/icons/Userpreferences.tsx +0 -17
- package/src/components/icons/index.ts +0 -12
- package/src/config/api.ts +0 -25
- package/src/context/AuthContext.tsx +0 -393
- package/src/hooks/useConnectedAccounts.ts +0 -139
- package/src/hooks/useUserConnections.ts +0 -166
- package/src/services/apiClient.ts +0 -337
- package/src/services/authService.ts +0 -1008
- package/src/services/biometricPinService.ts +0 -193
- package/src/services/connectedAccountsService.ts +0 -290
- package/src/services/googleAuthService.ts +0 -279
- package/src/services/imageCompressionService.ts +0 -303
- package/src/services/jwtStorageService.ts +0 -257
- package/src/services/mobileTrainingService.ts +0 -204
- package/src/services/pinEncryptionService.ts +0 -76
- package/src/services/pinStorageUtils.ts +0 -97
- package/src/services/storageService.ts +0 -452
- package/src/services/trainingApiHelpers.ts +0 -67
- package/src/services/userConnectionsService.ts +0 -557
- package/src/services/youtubeMigrationService.ts +0 -454
- package/src/theme/index.ts +0 -239
- package/src/utils/eventUtils.ts +0 -303
- package/src/utils/haptics.ts +0 -59
- package/src/utils/imagePreloader.ts +0 -2
|
@@ -1,1346 +1,1113 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
hasNativeSDK: true //
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
clientId: '
|
|
47
|
-
redirectUri: 'onairosevents://auth/callback',
|
|
48
|
-
scope: '
|
|
49
|
-
responseType: 'code',
|
|
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
|
-
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
console.log('
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
//
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
console.log('
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
console.
|
|
478
|
-
console.
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
console.
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
//
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
// Get stored auth token
|
|
1116
|
-
const authToken = await AsyncStorage.getItem('onairos_jwt_token') ||
|
|
1117
|
-
await AsyncStorage.getItem('enoch_token') ||
|
|
1118
|
-
await AsyncStorage.getItem('auth_token');
|
|
1119
|
-
|
|
1120
|
-
if (!authToken) {
|
|
1121
|
-
console.error('โ No auth token found for YouTube refresh');
|
|
1122
|
-
return false;
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
// Send refreshed tokens to backend
|
|
1126
|
-
const refreshResponse = await fetch('https://api2.onairos.uk/youtube/refresh-token', {
|
|
1127
|
-
method: 'POST',
|
|
1128
|
-
headers: {
|
|
1129
|
-
'Content-Type': 'application/json',
|
|
1130
|
-
'Authorization': authToken
|
|
1131
|
-
},
|
|
1132
|
-
body: JSON.stringify({
|
|
1133
|
-
accessToken: freshTokens.accessToken,
|
|
1134
|
-
idToken: freshTokens.idToken,
|
|
1135
|
-
refreshToken: currentUser.serverAuthCode,
|
|
1136
|
-
userEmail: currentUser.user?.email,
|
|
1137
|
-
tokenExpiry: new Date(Date.now() + 3600 * 1000).toISOString(), // 1 hour from now
|
|
1138
|
-
timestamp: new Date().toISOString()
|
|
1139
|
-
})
|
|
1140
|
-
});
|
|
1141
|
-
|
|
1142
|
-
if (refreshResponse.ok) {
|
|
1143
|
-
const responseData = await refreshResponse.json();
|
|
1144
|
-
console.log('โ
YouTube tokens refreshed successfully:', responseData);
|
|
1145
|
-
return true;
|
|
1146
|
-
} else {
|
|
1147
|
-
const errorData = await refreshResponse.text();
|
|
1148
|
-
console.error('โ YouTube token refresh failed:', refreshResponse.status, errorData);
|
|
1149
|
-
return false;
|
|
1150
|
-
}
|
|
1151
|
-
} catch (error) {
|
|
1152
|
-
console.error('โ Error refreshing YouTube tokens:', error);
|
|
1153
|
-
return false;
|
|
1154
|
-
}
|
|
1155
|
-
};
|
|
1156
|
-
|
|
1157
|
-
/**
|
|
1158
|
-
* Trigger training restart after YouTube re-authentication
|
|
1159
|
-
* This signals the backend to restart training with the new refresh token
|
|
1160
|
-
*/
|
|
1161
|
-
const triggerTrainingRestart = async (username: string, authToken: string): Promise<void> => {
|
|
1162
|
-
try {
|
|
1163
|
-
console.log('๐ [TRAINING RESTART] Triggering training restart for user:', username);
|
|
1164
|
-
|
|
1165
|
-
const response = await fetch('https://api2.onairos.uk/mobile-training/restart', {
|
|
1166
|
-
method: 'POST',
|
|
1167
|
-
headers: {
|
|
1168
|
-
'Content-Type': 'application/json',
|
|
1169
|
-
'Authorization': authToken
|
|
1170
|
-
},
|
|
1171
|
-
body: JSON.stringify({
|
|
1172
|
-
username: username,
|
|
1173
|
-
reason: 'youtube_reauth',
|
|
1174
|
-
platform: 'youtube',
|
|
1175
|
-
timestamp: new Date().toISOString(),
|
|
1176
|
-
requestNewTraining: true
|
|
1177
|
-
})
|
|
1178
|
-
});
|
|
1179
|
-
|
|
1180
|
-
if (response.ok) {
|
|
1181
|
-
const responseData = await response.json();
|
|
1182
|
-
console.log('โ
[TRAINING RESTART] Training restart successful:', responseData);
|
|
1183
|
-
} else {
|
|
1184
|
-
const errorData = await response.text();
|
|
1185
|
-
console.error('โ [TRAINING RESTART] Training restart failed:', response.status, errorData);
|
|
1186
|
-
throw new Error(`Training restart failed: ${response.status}`);
|
|
1187
|
-
}
|
|
1188
|
-
} catch (error) {
|
|
1189
|
-
console.error('โ [TRAINING RESTART] Error triggering training restart:', error);
|
|
1190
|
-
throw error;
|
|
1191
|
-
}
|
|
1192
|
-
};
|
|
1193
|
-
|
|
1194
|
-
/**
|
|
1195
|
-
* Test function to verify YouTube refresh token functionality
|
|
1196
|
-
* Call this in your app to test the YouTube connection
|
|
1197
|
-
*/
|
|
1198
|
-
export const testYouTubeRefreshToken = async (username: string): Promise<void> => {
|
|
1199
|
-
console.log('๐งช Testing YouTube refresh token functionality...');
|
|
1200
|
-
console.log('๐ค User:', username);
|
|
1201
|
-
|
|
1202
|
-
try {
|
|
1203
|
-
// Test the debug function first
|
|
1204
|
-
const debugInfo = await debugYouTubeTokens();
|
|
1205
|
-
console.log('๐ Current token status:', debugInfo);
|
|
1206
|
-
|
|
1207
|
-
if (!debugInfo.hasRefreshToken) {
|
|
1208
|
-
console.log('โ ๏ธ No refresh token found - attempting to fix...');
|
|
1209
|
-
const success = await fixUserYouTubeConnection(username);
|
|
1210
|
-
|
|
1211
|
-
if (success) {
|
|
1212
|
-
console.log('โ
YouTube connection fixed! Testing again...');
|
|
1213
|
-
const newDebugInfo = await debugYouTubeTokens();
|
|
1214
|
-
console.log('๐ New token status:', newDebugInfo);
|
|
1215
|
-
} else {
|
|
1216
|
-
console.error('โ Failed to fix YouTube connection');
|
|
1217
|
-
}
|
|
1218
|
-
} else {
|
|
1219
|
-
console.log('โ
Refresh token already available');
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
} catch (error) {
|
|
1223
|
-
console.error('โ Error testing YouTube refresh token:', error);
|
|
1224
|
-
}
|
|
1225
|
-
};
|
|
1226
|
-
|
|
1227
|
-
/**
|
|
1228
|
-
* Request email verification code
|
|
1229
|
-
*/
|
|
1230
|
-
export const requestEmailVerification = async (email: string, testMode: boolean = false): Promise<any> => {
|
|
1231
|
-
try {
|
|
1232
|
-
console.log('๐ง Requesting email verification for:', email);
|
|
1233
|
-
|
|
1234
|
-
const response = await fetch(`${API_CONFIG.BASE_URL}/email/verification`, {
|
|
1235
|
-
method: 'POST',
|
|
1236
|
-
headers: getApiHeaders(),
|
|
1237
|
-
body: JSON.stringify({
|
|
1238
|
-
email,
|
|
1239
|
-
action: 'request',
|
|
1240
|
-
testMode
|
|
1241
|
-
}),
|
|
1242
|
-
});
|
|
1243
|
-
|
|
1244
|
-
const result = await response.json();
|
|
1245
|
-
|
|
1246
|
-
if (response.ok) {
|
|
1247
|
-
return {
|
|
1248
|
-
success: true,
|
|
1249
|
-
message: result.message || 'Verification code sent to your email'
|
|
1250
|
-
};
|
|
1251
|
-
} else {
|
|
1252
|
-
return {
|
|
1253
|
-
success: false,
|
|
1254
|
-
error: result.message || 'Failed to send verification code'
|
|
1255
|
-
};
|
|
1256
|
-
}
|
|
1257
|
-
} catch (error) {
|
|
1258
|
-
console.error('โ Error requesting email verification:', error);
|
|
1259
|
-
return {
|
|
1260
|
-
success: false,
|
|
1261
|
-
error: 'Network error. Please check your connection and try again.'
|
|
1262
|
-
};
|
|
1263
|
-
}
|
|
1264
|
-
};
|
|
1265
|
-
|
|
1266
|
-
/**
|
|
1267
|
-
* Verify email code
|
|
1268
|
-
*/
|
|
1269
|
-
export const verifyEmailCode = async (email: string, code: string, testMode: boolean = false): Promise<any> => {
|
|
1270
|
-
try {
|
|
1271
|
-
console.log('๐ Verifying email code for:', email);
|
|
1272
|
-
|
|
1273
|
-
const response = await fetch(`${API_CONFIG.BASE_URL}/email/verification`, {
|
|
1274
|
-
method: 'POST',
|
|
1275
|
-
headers: getApiHeaders(),
|
|
1276
|
-
body: JSON.stringify({
|
|
1277
|
-
email,
|
|
1278
|
-
code,
|
|
1279
|
-
action: 'verify',
|
|
1280
|
-
testMode
|
|
1281
|
-
}),
|
|
1282
|
-
});
|
|
1283
|
-
|
|
1284
|
-
const result = await response.json();
|
|
1285
|
-
|
|
1286
|
-
if (response.ok) {
|
|
1287
|
-
return {
|
|
1288
|
-
success: true,
|
|
1289
|
-
message: result.message || 'Email verified successfully',
|
|
1290
|
-
existingUser: result.existingUser || false,
|
|
1291
|
-
token: result.token
|
|
1292
|
-
};
|
|
1293
|
-
} else {
|
|
1294
|
-
return {
|
|
1295
|
-
success: false,
|
|
1296
|
-
error: result.message || 'Invalid verification code'
|
|
1297
|
-
};
|
|
1298
|
-
}
|
|
1299
|
-
} catch (error) {
|
|
1300
|
-
console.error('โ Error verifying email code:', error);
|
|
1301
|
-
return {
|
|
1302
|
-
success: false,
|
|
1303
|
-
error: 'Network error. Please check your connection and try again.'
|
|
1304
|
-
};
|
|
1305
|
-
}
|
|
1306
|
-
};
|
|
1307
|
-
|
|
1308
|
-
/**
|
|
1309
|
-
* Check email verification status
|
|
1310
|
-
*/
|
|
1311
|
-
export const checkEmailVerificationStatus = async (email: string, testMode: boolean = false): Promise<any> => {
|
|
1312
|
-
try {
|
|
1313
|
-
const response = await fetch(`${API_CONFIG.BASE_URL}/email/verification/status`, {
|
|
1314
|
-
method: 'POST',
|
|
1315
|
-
headers: getApiHeaders(),
|
|
1316
|
-
body: JSON.stringify({
|
|
1317
|
-
email,
|
|
1318
|
-
testMode
|
|
1319
|
-
}),
|
|
1320
|
-
});
|
|
1321
|
-
|
|
1322
|
-
const result = await response.json();
|
|
1323
|
-
|
|
1324
|
-
return {
|
|
1325
|
-
success: response.ok,
|
|
1326
|
-
isPending: result.isPending || false,
|
|
1327
|
-
message: result.message
|
|
1328
|
-
};
|
|
1329
|
-
} catch (error) {
|
|
1330
|
-
console.error('โ Error checking email verification status:', error);
|
|
1331
|
-
return {
|
|
1332
|
-
success: false,
|
|
1333
|
-
isPending: false,
|
|
1334
|
-
error: 'Network error'
|
|
1335
|
-
};
|
|
1336
|
-
}
|
|
1337
|
-
};
|
|
1338
|
-
|
|
1339
|
-
/**
|
|
1340
|
-
* Initialize platform auth service
|
|
1341
|
-
*/
|
|
1342
|
-
export const initializePlatformAuthService = () => {
|
|
1343
|
-
console.log('๐ง Platform auth service initialized');
|
|
1344
|
-
// Initialize Google Sign-In
|
|
1345
|
-
initializeGoogleSignIn();
|
|
1346
|
-
};
|
|
1
|
+
import { Platform, Linking } from 'react-native';
|
|
2
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
3
|
+
import type { PlatformAuthConfig } from '../types';
|
|
4
|
+
import { makeDeveloperRequest, getApiConfig, storeJWT, extractUsernameFromJWT } from './apiKeyService';
|
|
5
|
+
|
|
6
|
+
// ๐ CRITICAL: Use two-tier authentication system
|
|
7
|
+
// - Developer API key for email verification requests
|
|
8
|
+
// - JWT tokens for user-authenticated requests after email verification
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Initialize the platform auth service
|
|
12
|
+
* This service now uses the two-tier authentication system
|
|
13
|
+
*/
|
|
14
|
+
export const initializePlatformAuthService = async (): Promise<void> => {
|
|
15
|
+
try {
|
|
16
|
+
// Check if app is already initialized with API key
|
|
17
|
+
const existingConfig = getApiConfig();
|
|
18
|
+
|
|
19
|
+
if (existingConfig && existingConfig.apiKey) {
|
|
20
|
+
console.log('๐ Platform auth service using existing app configuration');
|
|
21
|
+
console.log(`โ
Environment: ${existingConfig.environment}`);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// If no app initialization, we can't proceed
|
|
26
|
+
console.error('โ Platform auth service requires app-level API key initialization');
|
|
27
|
+
throw new Error('Platform auth service requires app-level API key initialization. Please call initializeApiKey() first.');
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.error('โ Failed to initialize platform auth service:', error);
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Configuration for each platform's authentication
|
|
35
|
+
let PLATFORM_AUTH_CONFIG: Record<string, PlatformAuthConfig> = {
|
|
36
|
+
instagram: {
|
|
37
|
+
hasNativeSDK: false, // Instagram uses OAuth WebView flow
|
|
38
|
+
authEndpoint: '/instagram/authorize',
|
|
39
|
+
color: '#E1306C',
|
|
40
|
+
},
|
|
41
|
+
youtube: {
|
|
42
|
+
hasNativeSDK: true, // Native Google Sign-In SDK enabled
|
|
43
|
+
nativeSDKPackage: '@react-native-google-signin/google-signin',
|
|
44
|
+
authEndpoint: '/youtube/authorize',
|
|
45
|
+
color: '#FF0000',
|
|
46
|
+
clientId: '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com',
|
|
47
|
+
redirectUri: 'onairosevents://auth/callback',
|
|
48
|
+
scope: 'https://www.googleapis.com/auth/youtube.readonly',
|
|
49
|
+
responseType: 'code',
|
|
50
|
+
},
|
|
51
|
+
reddit: {
|
|
52
|
+
hasNativeSDK: false,
|
|
53
|
+
authEndpoint: '/reddit/authorize',
|
|
54
|
+
color: '#FF4500',
|
|
55
|
+
},
|
|
56
|
+
pinterest: {
|
|
57
|
+
hasNativeSDK: false,
|
|
58
|
+
authEndpoint: '/pinterest/authorize',
|
|
59
|
+
color: '#E60023',
|
|
60
|
+
},
|
|
61
|
+
email: {
|
|
62
|
+
hasNativeSDK: false,
|
|
63
|
+
authEndpoint: '/gmail/authorize',
|
|
64
|
+
color: '#4285F4',
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Checks if a native SDK is available for the given platform
|
|
70
|
+
*/
|
|
71
|
+
export const hasNativeSDK = (platform: string): boolean => {
|
|
72
|
+
const config = PLATFORM_AUTH_CONFIG[platform];
|
|
73
|
+
return config?.hasNativeSDK || false;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Gets the auth endpoint URL for a platform
|
|
78
|
+
*/
|
|
79
|
+
export const getAuthEndpoint = (platform: string): string => {
|
|
80
|
+
const config = PLATFORM_AUTH_CONFIG[platform];
|
|
81
|
+
return config?.authEndpoint || '';
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Gets the color associated with a platform
|
|
86
|
+
*/
|
|
87
|
+
export const getPlatformColor = (platform: string): string => {
|
|
88
|
+
const config = PLATFORM_AUTH_CONFIG[platform];
|
|
89
|
+
return config?.color || '#000000';
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Initiates the OAuth flow for a platform
|
|
94
|
+
* @param platform The platform to authenticate with
|
|
95
|
+
* @param username The username to associate with the authentication
|
|
96
|
+
* @param appName The app name to use for the OAuth session (optional)
|
|
97
|
+
* @returns A Promise that resolves to the OAuth URL to open in a WebView or null if using native SDK
|
|
98
|
+
*/
|
|
99
|
+
export const initiateOAuth = async (platform: string, username: string, appName?: string): Promise<string | null> => {
|
|
100
|
+
try {
|
|
101
|
+
console.log('๐ Initiating OAuth for platform:', platform);
|
|
102
|
+
console.log('๐ค Username:', username);
|
|
103
|
+
console.log('๐ฑ App name:', appName);
|
|
104
|
+
|
|
105
|
+
// Check if the platform is supported
|
|
106
|
+
if (!PLATFORM_AUTH_CONFIG[platform]) {
|
|
107
|
+
console.error('โ Unsupported platform:', platform);
|
|
108
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Check if platform has a native SDK
|
|
112
|
+
if (PLATFORM_AUTH_CONFIG[platform].hasNativeSDK) {
|
|
113
|
+
console.log('๐ฑ Platform uses native SDK, returning null');
|
|
114
|
+
// Return null to indicate that we should use the native SDK
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
console.log('๐ Platform uses OAuth WebView flow');
|
|
119
|
+
console.log('๐ Auth endpoint:', PLATFORM_AUTH_CONFIG[platform].authEndpoint);
|
|
120
|
+
|
|
121
|
+
// Pre-flight connectivity check
|
|
122
|
+
console.log('๐ Performing pre-flight connectivity check...');
|
|
123
|
+
const connectivityResult = await testApiConnectivity();
|
|
124
|
+
|
|
125
|
+
if (!connectivityResult.success) {
|
|
126
|
+
console.error('โ Pre-flight connectivity check failed:', connectivityResult.error);
|
|
127
|
+
throw new Error(`Cannot reach authentication server: ${connectivityResult.error}`);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
console.log('โ
Pre-flight connectivity check passed');
|
|
131
|
+
|
|
132
|
+
// Handle Instagram with specific API format
|
|
133
|
+
if (platform === 'instagram') {
|
|
134
|
+
const state = 'djksbfds';
|
|
135
|
+
const jsonData = {
|
|
136
|
+
session: {
|
|
137
|
+
oauthState: state,
|
|
138
|
+
username: username || 'Avatar',
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
console.log('๐ค Sending Instagram OAuth request:', jsonData);
|
|
143
|
+
|
|
144
|
+
const response = await makeDeveloperRequest(PLATFORM_AUTH_CONFIG[platform].authEndpoint, {
|
|
145
|
+
method: 'POST',
|
|
146
|
+
body: JSON.stringify(jsonData),
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
console.log('๐ก Instagram OAuth response status:', response.status);
|
|
150
|
+
|
|
151
|
+
if (!response.ok) {
|
|
152
|
+
const errorText = await response.text();
|
|
153
|
+
console.error('โ Instagram OAuth API error:', errorText);
|
|
154
|
+
throw new Error(`Instagram OAuth API error: ${response.status} - ${errorText}`);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const responseData = await response.json();
|
|
158
|
+
console.log('๐ฅ Instagram OAuth response data:', responseData);
|
|
159
|
+
|
|
160
|
+
if (responseData.instagramURL) {
|
|
161
|
+
console.log('โ
Instagram OAuth URL received:', responseData.instagramURL);
|
|
162
|
+
|
|
163
|
+
// Validate the URL before returning
|
|
164
|
+
if (await validateOAuthUrl(responseData.instagramURL)) {
|
|
165
|
+
return responseData.instagramURL;
|
|
166
|
+
} else {
|
|
167
|
+
throw new Error('Received invalid Instagram OAuth URL');
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
console.error('โ No Instagram URL found in response');
|
|
172
|
+
throw new Error('No Instagram URL found in response');
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Prepare the request body for other platforms
|
|
176
|
+
const jsonData = {
|
|
177
|
+
session: {
|
|
178
|
+
oauthState: 'djksbfds', // Use same state for all platforms
|
|
179
|
+
username: username || 'Avatar',
|
|
180
|
+
appName: appName || 'DefaultApp',
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
console.log(`๐ค Sending ${platform} OAuth request:`, jsonData);
|
|
185
|
+
|
|
186
|
+
// Make the authenticated request to get the OAuth URL
|
|
187
|
+
const response = await makeDeveloperRequest(PLATFORM_AUTH_CONFIG[platform].authEndpoint, {
|
|
188
|
+
method: 'POST',
|
|
189
|
+
body: JSON.stringify(jsonData),
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
console.log(`๐ก ${platform} OAuth response status:`, response.status);
|
|
193
|
+
|
|
194
|
+
if (!response.ok) {
|
|
195
|
+
const errorText = await response.text();
|
|
196
|
+
console.error(`โ ${platform} OAuth API error:`, errorText);
|
|
197
|
+
throw new Error(`${platform} OAuth API error: ${response.status} - ${errorText}`);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Parse the response
|
|
201
|
+
const data = await response.json();
|
|
202
|
+
console.log(`๐ฅ ${platform} OAuth response data:`, data);
|
|
203
|
+
|
|
204
|
+
// Extra logging for Gmail to help debug
|
|
205
|
+
if (platform === 'email') {
|
|
206
|
+
console.log('๐ Gmail OAuth response keys:', Object.keys(data));
|
|
207
|
+
console.log('๐ Gmail OAuth full response:', JSON.stringify(data, null, 2));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Check if the response contains the OAuth URL based on platform
|
|
211
|
+
let oauthUrl: string | null = null;
|
|
212
|
+
|
|
213
|
+
switch (platform) {
|
|
214
|
+
case 'reddit':
|
|
215
|
+
oauthUrl = data.redditURL;
|
|
216
|
+
break;
|
|
217
|
+
case 'pinterest':
|
|
218
|
+
oauthUrl = data.pinterestURL;
|
|
219
|
+
break;
|
|
220
|
+
case 'youtube':
|
|
221
|
+
oauthUrl = data.youtubeURL;
|
|
222
|
+
break;
|
|
223
|
+
case 'email':
|
|
224
|
+
// Gmail might return under different field names
|
|
225
|
+
oauthUrl = data.emailURL || data.gmailURL || data.authUrl || data.url;
|
|
226
|
+
break;
|
|
227
|
+
default:
|
|
228
|
+
oauthUrl = data.url;
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (!oauthUrl) {
|
|
233
|
+
console.error(`โ No OAuth URL found in response for ${platform}. Response:`, data);
|
|
234
|
+
throw new Error(`No OAuth URL found in response for ${platform}`);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
console.log(`โ
${platform} OAuth URL received:`, oauthUrl);
|
|
238
|
+
|
|
239
|
+
// Validate the URL before returning
|
|
240
|
+
if (await validateOAuthUrl(oauthUrl)) {
|
|
241
|
+
return oauthUrl;
|
|
242
|
+
} else {
|
|
243
|
+
throw new Error(`Received invalid ${platform} OAuth URL`);
|
|
244
|
+
}
|
|
245
|
+
} catch (error) {
|
|
246
|
+
console.error(`Error initiating OAuth for ${platform}:`, error);
|
|
247
|
+
throw error;
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Validates an OAuth URL to ensure it's reachable
|
|
253
|
+
* @param url The OAuth URL to validate
|
|
254
|
+
* @returns Promise<boolean> indicating if the URL is valid and reachable
|
|
255
|
+
*/
|
|
256
|
+
const validateOAuthUrl = async (url: string): Promise<boolean> => {
|
|
257
|
+
try {
|
|
258
|
+
console.log('๐ Validating OAuth URL:', url);
|
|
259
|
+
|
|
260
|
+
// Basic URL format validation
|
|
261
|
+
if (!url || typeof url !== 'string') {
|
|
262
|
+
console.error('โ Invalid URL format:', url);
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Check if URL starts with https
|
|
267
|
+
if (!url.startsWith('https://')) {
|
|
268
|
+
console.error('โ URL must use HTTPS:', url);
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Try to parse the URL
|
|
273
|
+
try {
|
|
274
|
+
new URL(url);
|
|
275
|
+
} catch (parseError) {
|
|
276
|
+
console.error('โ URL parsing failed:', parseError);
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Make a HEAD request to check if the URL is reachable
|
|
281
|
+
const controller = new AbortController();
|
|
282
|
+
const timeoutId = setTimeout(() => controller.abort(), 10000); // 10 second timeout
|
|
283
|
+
|
|
284
|
+
try {
|
|
285
|
+
const response = await fetch(url, {
|
|
286
|
+
method: 'HEAD',
|
|
287
|
+
signal: controller.signal,
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
clearTimeout(timeoutId);
|
|
291
|
+
|
|
292
|
+
// Accept any response that's not a network error
|
|
293
|
+
// OAuth pages might return various status codes
|
|
294
|
+
console.log('โ
OAuth URL validation successful, status:', response.status);
|
|
295
|
+
return true;
|
|
296
|
+
} catch (fetchError) {
|
|
297
|
+
clearTimeout(timeoutId);
|
|
298
|
+
|
|
299
|
+
if (fetchError.name === 'AbortError') {
|
|
300
|
+
console.warn('โ ๏ธ OAuth URL validation timeout, but proceeding anyway');
|
|
301
|
+
return true; // Allow timeout as URLs might be slow to respond
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
console.warn('โ ๏ธ OAuth URL validation failed, but proceeding anyway:', fetchError.message);
|
|
305
|
+
return true; // Allow network errors as they might be temporary
|
|
306
|
+
}
|
|
307
|
+
} catch (error) {
|
|
308
|
+
console.warn('โ ๏ธ OAuth URL validation error, but proceeding anyway:', error);
|
|
309
|
+
return true; // Allow validation errors to not block the flow
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Initiates the native SDK authentication flow for a platform
|
|
315
|
+
* @param platform The platform to authenticate with
|
|
316
|
+
* @returns A Promise that resolves to the authentication result
|
|
317
|
+
*/
|
|
318
|
+
export const initiateNativeAuth = async (platform: string, username?: string): Promise<boolean> => {
|
|
319
|
+
if (platform === 'youtube') {
|
|
320
|
+
console.log('๐ Initiating native Google Sign-In for YouTube');
|
|
321
|
+
try {
|
|
322
|
+
// Check if Google Sign-In package is available
|
|
323
|
+
let GoogleSignin, statusCodes;
|
|
324
|
+
try {
|
|
325
|
+
const googleSignInModule = require('@react-native-google-signin/google-signin');
|
|
326
|
+
GoogleSignin = googleSignInModule.GoogleSignin;
|
|
327
|
+
statusCodes = googleSignInModule.statusCodes;
|
|
328
|
+
} catch (importError) {
|
|
329
|
+
console.error('โ Google Sign-In package not available:', importError);
|
|
330
|
+
throw new Error('Google Sign-In SDK not installed. Please install @react-native-google-signin/google-signin');
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Configure Google Sign-In with better error handling
|
|
334
|
+
try {
|
|
335
|
+
const youtubeConfig = PLATFORM_AUTH_CONFIG.youtube;
|
|
336
|
+
const webClientId = youtubeConfig.clientId || '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com';
|
|
337
|
+
const iosClientId = youtubeConfig.iosClientId || webClientId;
|
|
338
|
+
|
|
339
|
+
await GoogleSignin.configure({
|
|
340
|
+
webClientId: webClientId,
|
|
341
|
+
iosClientId: iosClientId,
|
|
342
|
+
scopes: ['https://www.googleapis.com/auth/youtube.readonly'],
|
|
343
|
+
offlineAccess: true,
|
|
344
|
+
hostedDomain: '',
|
|
345
|
+
forceCodeForRefreshToken: true,
|
|
346
|
+
accountName: '',
|
|
347
|
+
});
|
|
348
|
+
console.log('โ
Google Sign-In configured successfully with client ID:', webClientId.substring(0, 20) + '...');
|
|
349
|
+
} catch (configError) {
|
|
350
|
+
console.error('โ Google Sign-In configuration failed:', configError);
|
|
351
|
+
throw new Error(`Google Sign-In configuration failed: ${configError.message || configError}`);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// Check if Google Play Services are available (Android only)
|
|
355
|
+
try {
|
|
356
|
+
await GoogleSignin.hasPlayServices({ showPlayServicesUpdateDialog: true });
|
|
357
|
+
console.log('โ
Google Play Services available');
|
|
358
|
+
} catch (playServicesError) {
|
|
359
|
+
console.error('โ Google Play Services error:', playServicesError);
|
|
360
|
+
throw new Error(`Google Play Services not available: ${playServicesError.message || playServicesError}`);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// Sign in with Google
|
|
364
|
+
let userInfo;
|
|
365
|
+
try {
|
|
366
|
+
userInfo = await GoogleSignin.signIn();
|
|
367
|
+
console.log('โ
Google Sign-In successful:', userInfo.user?.email);
|
|
368
|
+
} catch (signInError) {
|
|
369
|
+
console.error('โ Google Sign-In failed:', signInError);
|
|
370
|
+
|
|
371
|
+
// Handle specific error codes
|
|
372
|
+
if (signInError.code === statusCodes.SIGN_IN_CANCELLED) {
|
|
373
|
+
throw new Error('Google Sign-In was cancelled by user');
|
|
374
|
+
} else if (signInError.code === statusCodes.IN_PROGRESS) {
|
|
375
|
+
throw new Error('Google Sign-In already in progress');
|
|
376
|
+
} else if (signInError.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
|
|
377
|
+
throw new Error('Google Play Services not available or outdated');
|
|
378
|
+
} else {
|
|
379
|
+
throw new Error(`Google Sign-In failed: ${signInError.message || signInError}`);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// Get access token for API calls
|
|
384
|
+
const tokens = await GoogleSignin.getTokens();
|
|
385
|
+
console.log('๐ Got Google tokens');
|
|
386
|
+
|
|
387
|
+
// Get current user info with refresh token
|
|
388
|
+
const currentUser = await GoogleSignin.getCurrentUser();
|
|
389
|
+
console.log('๐ค Current user info:', currentUser?.user?.email);
|
|
390
|
+
|
|
391
|
+
// Extract refresh token from server auth code
|
|
392
|
+
let refreshToken = null;
|
|
393
|
+
if (currentUser?.serverAuthCode) {
|
|
394
|
+
console.log('๐ Server auth code available for refresh token');
|
|
395
|
+
refreshToken = currentUser.serverAuthCode;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if (!refreshToken) {
|
|
399
|
+
console.warn('โ ๏ธ No refresh token available - token refresh may fail later');
|
|
400
|
+
} else {
|
|
401
|
+
console.log('โ
Refresh token available for YouTube connection');
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// Fetch YouTube channel information
|
|
405
|
+
let channelName = 'Unknown Channel';
|
|
406
|
+
let channelId = null;
|
|
407
|
+
try {
|
|
408
|
+
console.log('๐บ Fetching YouTube channel information...');
|
|
409
|
+
const channelResponse = await fetch('https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true', {
|
|
410
|
+
headers: {
|
|
411
|
+
'Authorization': `Bearer ${tokens.accessToken}`,
|
|
412
|
+
'Accept': 'application/json'
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
if (channelResponse.ok) {
|
|
417
|
+
const channelData = await channelResponse.json();
|
|
418
|
+
if (channelData.items && channelData.items.length > 0) {
|
|
419
|
+
channelName = channelData.items[0].snippet.title;
|
|
420
|
+
channelId = channelData.items[0].id;
|
|
421
|
+
console.log('โ
YouTube channel found:', channelName);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
} catch (channelError) {
|
|
425
|
+
console.log('โ ๏ธ Error fetching YouTube channel info:', channelError);
|
|
426
|
+
channelName = userInfo.user?.name || userInfo.user?.email || 'Unknown Channel';
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// Get authentication info
|
|
430
|
+
let authToken = await AsyncStorage.getItem('onairos_jwt_token') ||
|
|
431
|
+
await AsyncStorage.getItem('enoch_token') ||
|
|
432
|
+
await AsyncStorage.getItem('auth_token');
|
|
433
|
+
const storedUsername = await AsyncStorage.getItem('onairos_username');
|
|
434
|
+
const finalUsername = storedUsername || username || userInfo.user?.email || 'youtube_user';
|
|
435
|
+
|
|
436
|
+
// Create auth token if needed
|
|
437
|
+
if (!authToken || authToken.trim().length < 20) {
|
|
438
|
+
console.log('๐ Creating authentication token for YouTube...');
|
|
439
|
+
|
|
440
|
+
try {
|
|
441
|
+
const fallbackEmail = userInfo.user?.email || `${finalUsername}@youtube.temp`;
|
|
442
|
+
|
|
443
|
+
// Create user accounts and get JWT token
|
|
444
|
+
const onairosSignupResponse = await fetch('https://api2.onairos.uk/register/enoch', {
|
|
445
|
+
method: 'POST',
|
|
446
|
+
headers: {
|
|
447
|
+
'Content-Type': 'application/json'
|
|
448
|
+
},
|
|
449
|
+
body: JSON.stringify({
|
|
450
|
+
email: fallbackEmail,
|
|
451
|
+
username: finalUsername,
|
|
452
|
+
name: finalUsername
|
|
453
|
+
})
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
if (onairosSignupResponse.ok) {
|
|
457
|
+
const onairosResponseData = await onairosSignupResponse.json();
|
|
458
|
+
|
|
459
|
+
// Extract token from response
|
|
460
|
+
authToken = onairosResponseData.token || onairosResponseData.data?.token || onairosResponseData.jwt;
|
|
461
|
+
|
|
462
|
+
if (authToken) {
|
|
463
|
+
// Store tokens
|
|
464
|
+
await AsyncStorage.setItem('onairos_jwt_token', authToken);
|
|
465
|
+
await AsyncStorage.setItem('enoch_token', authToken);
|
|
466
|
+
await AsyncStorage.setItem('auth_token', authToken);
|
|
467
|
+
await AsyncStorage.setItem('onairos_username', onairosResponseData.username || finalUsername);
|
|
468
|
+
|
|
469
|
+
console.log('โ
Successfully created and stored authentication token');
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
} catch (tokenError) {
|
|
473
|
+
console.warn('โ ๏ธ Error creating auth token:', tokenError);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
console.log('๐ Linking YouTube data to user:', finalUsername);
|
|
478
|
+
console.log('๐บ YouTube channel name:', channelName);
|
|
479
|
+
|
|
480
|
+
// Send tokens to backend for YouTube data processing
|
|
481
|
+
const backendResponse = await fetch('https://api2.onairos.uk/youtube/native-auth', {
|
|
482
|
+
method: 'POST',
|
|
483
|
+
headers: {
|
|
484
|
+
'Content-Type': 'application/json',
|
|
485
|
+
...(authToken && { 'Authorization': `Bearer ${authToken}` })
|
|
486
|
+
},
|
|
487
|
+
body: JSON.stringify({
|
|
488
|
+
session: {
|
|
489
|
+
username: finalUsername,
|
|
490
|
+
platform: 'youtube',
|
|
491
|
+
timestamp: new Date().toISOString(),
|
|
492
|
+
channelName: channelName,
|
|
493
|
+
channelId: channelId
|
|
494
|
+
},
|
|
495
|
+
googleUser: userInfo.user,
|
|
496
|
+
accessToken: tokens.accessToken,
|
|
497
|
+
idToken: tokens.idToken,
|
|
498
|
+
refreshToken: refreshToken, // CRITICAL: Include refresh token
|
|
499
|
+
serverAuthCode: currentUser?.serverAuthCode,
|
|
500
|
+
userAccountInfo: {
|
|
501
|
+
username: finalUsername,
|
|
502
|
+
email: userInfo.user?.email,
|
|
503
|
+
authToken: authToken,
|
|
504
|
+
channelName: channelName,
|
|
505
|
+
channelId: channelId,
|
|
506
|
+
userIdentifier: authToken ? `user-${authToken.substring(0, 10)}` : `youtube-${userInfo.user?.email}`,
|
|
507
|
+
googleId: userInfo.user?.id,
|
|
508
|
+
},
|
|
509
|
+
tokenExpiry: new Date(Date.now() + 3600 * 1000).toISOString(), // 1 hour from now
|
|
510
|
+
requestRefreshToken: true
|
|
511
|
+
})
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
if (backendResponse.ok) {
|
|
515
|
+
const responseData = await backendResponse.json();
|
|
516
|
+
console.log('โ
YouTube connection processed by backend:', responseData);
|
|
517
|
+
return true;
|
|
518
|
+
} else {
|
|
519
|
+
const errorData = await backendResponse.text();
|
|
520
|
+
console.error('โ Backend processing failed:', backendResponse.status, errorData);
|
|
521
|
+
return false;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
} catch (error: any) {
|
|
525
|
+
console.error('โ Google Sign-In error:', error);
|
|
526
|
+
|
|
527
|
+
const { statusCodes: StatusCodes } = require('@react-native-google-signin/google-signin');
|
|
528
|
+
|
|
529
|
+
if (error.code === StatusCodes.SIGN_IN_CANCELLED) {
|
|
530
|
+
console.log('User cancelled Google Sign-In');
|
|
531
|
+
} else if (error.code === StatusCodes.IN_PROGRESS) {
|
|
532
|
+
console.log('Google Sign-In already in progress');
|
|
533
|
+
} else if (error.code === StatusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
|
|
534
|
+
console.log('Google Play Services not available');
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
return false;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
return false;
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Handles the OAuth callback
|
|
546
|
+
* @param url The callback URL
|
|
547
|
+
* @returns The authorization code extracted from the URL
|
|
548
|
+
*/
|
|
549
|
+
export const handleOAuthCallback = (url: string): string | null => {
|
|
550
|
+
try {
|
|
551
|
+
// Parse the URL
|
|
552
|
+
const parsedUrl = new URL(url);
|
|
553
|
+
|
|
554
|
+
// Extract the authorization code
|
|
555
|
+
return parsedUrl.searchParams.get('code');
|
|
556
|
+
} catch (error) {
|
|
557
|
+
console.error('Error handling OAuth callback:', error);
|
|
558
|
+
return null;
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Checks if a URL is an OAuth callback
|
|
564
|
+
* @param url The URL to check
|
|
565
|
+
* @returns True if the URL is an OAuth callback
|
|
566
|
+
*/
|
|
567
|
+
export const isOAuthCallback = (url: string): boolean => {
|
|
568
|
+
// Check if the URL starts with our redirect URI
|
|
569
|
+
return url.startsWith('onairosanime://auth/');
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Test connectivity to the Onairos API server
|
|
574
|
+
*/
|
|
575
|
+
export const testApiConnectivity = async (): Promise<{ success: boolean; error?: string }> => {
|
|
576
|
+
try {
|
|
577
|
+
console.log('๐ Testing connectivity to Onairos API...');
|
|
578
|
+
|
|
579
|
+
// Test multiple endpoints for better reliability
|
|
580
|
+
const testEndpoints = [
|
|
581
|
+
'https://api2.onairos.uk/health',
|
|
582
|
+
'https://api2.onairos.uk', // Base URL
|
|
583
|
+
];
|
|
584
|
+
|
|
585
|
+
let lastError: string | null = null;
|
|
586
|
+
|
|
587
|
+
for (const endpoint of testEndpoints) {
|
|
588
|
+
try {
|
|
589
|
+
console.log(`๐ Testing endpoint: ${endpoint}`);
|
|
590
|
+
|
|
591
|
+
const controller = new AbortController();
|
|
592
|
+
const timeoutId = setTimeout(() => controller.abort(), 10000); // 10 second timeout
|
|
593
|
+
|
|
594
|
+
const response = await fetch(endpoint, {
|
|
595
|
+
method: 'GET',
|
|
596
|
+
headers: {
|
|
597
|
+
'Content-Type': 'application/json',
|
|
598
|
+
'User-Agent': 'OnairosReactNative/1.0',
|
|
599
|
+
},
|
|
600
|
+
signal: controller.signal,
|
|
601
|
+
});
|
|
602
|
+
|
|
603
|
+
clearTimeout(timeoutId);
|
|
604
|
+
|
|
605
|
+
console.log(`๐ API connectivity test response for ${endpoint}:`, response.status);
|
|
606
|
+
|
|
607
|
+
if (response.ok || response.status === 404) {
|
|
608
|
+
// Accept 404 as it means the server is reachable
|
|
609
|
+
console.log('โ
API server is reachable');
|
|
610
|
+
return { success: true };
|
|
611
|
+
} else {
|
|
612
|
+
console.log(`โ ๏ธ API server responded with status ${response.status} for ${endpoint}`);
|
|
613
|
+
lastError = `API server error: ${response.status}`;
|
|
614
|
+
// Continue to next endpoint
|
|
615
|
+
}
|
|
616
|
+
} catch (fetchError) {
|
|
617
|
+
console.log(`โ Failed to reach ${endpoint}:`, fetchError);
|
|
618
|
+
|
|
619
|
+
if (fetchError.name === 'AbortError') {
|
|
620
|
+
lastError = 'Connection timeout - API server took too long to respond';
|
|
621
|
+
} else if (fetchError.message.includes('Network request failed')) {
|
|
622
|
+
lastError = 'Network error - check your internet connection';
|
|
623
|
+
} else if (fetchError.message.includes('not connected to the internet')) {
|
|
624
|
+
lastError = 'No internet connection';
|
|
625
|
+
} else {
|
|
626
|
+
lastError = `Network error: ${fetchError.message}`;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
// Continue to next endpoint
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
console.error('โ All API connectivity tests failed');
|
|
634
|
+
return { success: false, error: lastError || 'Cannot reach API server' };
|
|
635
|
+
} catch (error) {
|
|
636
|
+
console.error('โ API connectivity test failed:', error);
|
|
637
|
+
return { success: false, error: error instanceof Error ? error.message : 'Unknown error' };
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* ๐ REFRESH GOOGLE TOKENS
|
|
643
|
+
*/
|
|
644
|
+
export const refreshGoogleTokens = async (): Promise<{ accessToken: string; idToken?: string } | null> => {
|
|
645
|
+
try {
|
|
646
|
+
console.log('๐ Attempting to refresh Google tokens...');
|
|
647
|
+
|
|
648
|
+
const { GoogleSignin } = require('@react-native-google-signin/google-signin');
|
|
649
|
+
|
|
650
|
+
const currentUser = await GoogleSignin.getCurrentUser();
|
|
651
|
+
if (!currentUser) {
|
|
652
|
+
console.log('โ User not signed in to Google, cannot refresh tokens');
|
|
653
|
+
return null;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
const tokens = await GoogleSignin.getTokens();
|
|
657
|
+
console.log('โ
Successfully refreshed Google tokens');
|
|
658
|
+
|
|
659
|
+
return {
|
|
660
|
+
accessToken: tokens.accessToken,
|
|
661
|
+
idToken: tokens.idToken
|
|
662
|
+
};
|
|
663
|
+
} catch (error) {
|
|
664
|
+
console.error('โ Failed to refresh Google tokens:', error);
|
|
665
|
+
|
|
666
|
+
// If refresh fails, try to sign in again
|
|
667
|
+
try {
|
|
668
|
+
console.log('๐ Refresh failed, attempting re-authentication...');
|
|
669
|
+
const { GoogleSignin } = require('@react-native-google-signin/google-signin');
|
|
670
|
+
const userInfo = await GoogleSignin.signIn();
|
|
671
|
+
const tokens = await GoogleSignin.getTokens();
|
|
672
|
+
|
|
673
|
+
console.log('โ
Re-authentication successful');
|
|
674
|
+
return {
|
|
675
|
+
accessToken: tokens.accessToken,
|
|
676
|
+
idToken: tokens.idToken
|
|
677
|
+
};
|
|
678
|
+
} catch (signInError) {
|
|
679
|
+
console.error('โ Re-authentication also failed:', signInError);
|
|
680
|
+
return null;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* ๐ REFRESH YOUTUBE TOKENS
|
|
687
|
+
*/
|
|
688
|
+
export const refreshYouTubeTokens = async (): Promise<boolean> => {
|
|
689
|
+
try {
|
|
690
|
+
console.log('๐ Refreshing YouTube tokens...');
|
|
691
|
+
|
|
692
|
+
// Get fresh tokens from Google SDK
|
|
693
|
+
const freshTokens = await refreshGoogleTokens();
|
|
694
|
+
if (!freshTokens) {
|
|
695
|
+
console.error('โ Failed to get fresh tokens from Google SDK');
|
|
696
|
+
return false;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// Get current user info
|
|
700
|
+
const { GoogleSignin } = require('@react-native-google-signin/google-signin');
|
|
701
|
+
const currentUser = await GoogleSignin.getCurrentUser();
|
|
702
|
+
if (!currentUser) {
|
|
703
|
+
console.error('โ No current Google user found');
|
|
704
|
+
return false;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
// Get stored auth token
|
|
708
|
+
const authToken = await AsyncStorage.getItem('onairos_jwt_token') ||
|
|
709
|
+
await AsyncStorage.getItem('enoch_token') ||
|
|
710
|
+
await AsyncStorage.getItem('auth_token');
|
|
711
|
+
|
|
712
|
+
if (!authToken) {
|
|
713
|
+
console.error('โ No auth token found for YouTube refresh');
|
|
714
|
+
return false;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
// Send refreshed tokens to backend
|
|
718
|
+
const refreshResponse = await fetch('https://api2.onairos.uk/youtube/refresh-token', {
|
|
719
|
+
method: 'POST',
|
|
720
|
+
headers: {
|
|
721
|
+
'Content-Type': 'application/json',
|
|
722
|
+
'Authorization': `Bearer ${authToken}`
|
|
723
|
+
},
|
|
724
|
+
body: JSON.stringify({
|
|
725
|
+
accessToken: freshTokens.accessToken,
|
|
726
|
+
idToken: freshTokens.idToken,
|
|
727
|
+
refreshToken: currentUser.serverAuthCode,
|
|
728
|
+
userEmail: currentUser.user?.email,
|
|
729
|
+
tokenExpiry: new Date(Date.now() + 3600 * 1000).toISOString(),
|
|
730
|
+
timestamp: new Date().toISOString()
|
|
731
|
+
})
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
if (refreshResponse.ok) {
|
|
735
|
+
const responseData = await refreshResponse.json();
|
|
736
|
+
console.log('โ
YouTube tokens refreshed successfully:', responseData);
|
|
737
|
+
return true;
|
|
738
|
+
} else {
|
|
739
|
+
const errorData = await refreshResponse.text();
|
|
740
|
+
console.error('โ YouTube token refresh failed:', refreshResponse.status, errorData);
|
|
741
|
+
return false;
|
|
742
|
+
}
|
|
743
|
+
} catch (error) {
|
|
744
|
+
console.error('โ Error refreshing YouTube tokens:', error);
|
|
745
|
+
return false;
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* ๐ฏ ENHANCED OAUTH CALLBACK HANDLER
|
|
751
|
+
*/
|
|
752
|
+
export const handleOAuthCallbackUrl = (url: string): { platform?: string; code?: string; success: boolean } => {
|
|
753
|
+
try {
|
|
754
|
+
console.log('๐ Processing OAuth callback URL:', url);
|
|
755
|
+
|
|
756
|
+
// Parse the URL
|
|
757
|
+
const parsedUrl = new URL(url);
|
|
758
|
+
|
|
759
|
+
// Extract platform and code
|
|
760
|
+
const platform = parsedUrl.searchParams.get('platform') ||
|
|
761
|
+
parsedUrl.pathname.split('/').find(segment =>
|
|
762
|
+
['instagram', 'youtube', 'reddit', 'pinterest', 'email'].includes(segment)
|
|
763
|
+
);
|
|
764
|
+
|
|
765
|
+
const code = parsedUrl.searchParams.get('code');
|
|
766
|
+
const error = parsedUrl.searchParams.get('error');
|
|
767
|
+
|
|
768
|
+
if (error) {
|
|
769
|
+
console.error('โ OAuth error in callback:', error);
|
|
770
|
+
return { success: false };
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
if (code && platform) {
|
|
774
|
+
console.log(`โ
OAuth callback processed: ${platform} with code: ${code.substring(0, 10)}...`);
|
|
775
|
+
return { platform, code, success: true };
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
console.warn('โ ๏ธ OAuth callback missing platform or code');
|
|
779
|
+
return { success: false };
|
|
780
|
+
} catch (error) {
|
|
781
|
+
console.error('โ Error processing OAuth callback:', error);
|
|
782
|
+
return { success: false };
|
|
783
|
+
}
|
|
784
|
+
};
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* ๐ง UPDATE GOOGLE CLIENT IDS
|
|
788
|
+
* Allows apps to configure their own Google client IDs
|
|
789
|
+
*/
|
|
790
|
+
export const updateGoogleClientIds = (config: {
|
|
791
|
+
webClientId?: string;
|
|
792
|
+
iosClientId?: string;
|
|
793
|
+
}) => {
|
|
794
|
+
console.log('๐ง Updating Google client IDs configuration');
|
|
795
|
+
|
|
796
|
+
if (config.webClientId || config.iosClientId) {
|
|
797
|
+
// Update the YouTube configuration
|
|
798
|
+
PLATFORM_AUTH_CONFIG.youtube = {
|
|
799
|
+
...PLATFORM_AUTH_CONFIG.youtube,
|
|
800
|
+
clientId: config.webClientId || PLATFORM_AUTH_CONFIG.youtube.clientId,
|
|
801
|
+
iosClientId: config.iosClientId || PLATFORM_AUTH_CONFIG.youtube.iosClientId,
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
console.log('โ
Google client IDs updated successfully');
|
|
805
|
+
console.log(' - Web Client ID:', config.webClientId ? config.webClientId.substring(0, 20) + '...' : 'not provided');
|
|
806
|
+
console.log(' - iOS Client ID:', config.iosClientId ? config.iosClientId.substring(0, 20) + '...' : 'not provided');
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Request email verification using developer API key
|
|
812
|
+
* @param email Email address to verify
|
|
813
|
+
* @param testMode Whether to use test mode
|
|
814
|
+
* @returns Promise with verification result
|
|
815
|
+
*/
|
|
816
|
+
export const requestEmailVerification = async (
|
|
817
|
+
email: string,
|
|
818
|
+
testMode: boolean = false
|
|
819
|
+
): Promise<{ success: boolean; message?: string; error?: string }> => {
|
|
820
|
+
try {
|
|
821
|
+
console.log('๐ง Requesting email verification for:', email);
|
|
822
|
+
|
|
823
|
+
const response = await makeDeveloperRequest('/email/verification', {
|
|
824
|
+
method: 'POST',
|
|
825
|
+
body: JSON.stringify({
|
|
826
|
+
email,
|
|
827
|
+
action: 'request',
|
|
828
|
+
testMode
|
|
829
|
+
})
|
|
830
|
+
});
|
|
831
|
+
|
|
832
|
+
const data = await response.json();
|
|
833
|
+
|
|
834
|
+
if (response.ok && data.success) {
|
|
835
|
+
console.log('โ
Email verification requested successfully');
|
|
836
|
+
return {
|
|
837
|
+
success: true,
|
|
838
|
+
message: data.message || 'Verification code sent to your email'
|
|
839
|
+
};
|
|
840
|
+
} else {
|
|
841
|
+
console.error('โ Email verification request failed:', data.error);
|
|
842
|
+
return {
|
|
843
|
+
success: false,
|
|
844
|
+
error: data.error || 'Failed to send verification code'
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
} catch (error) {
|
|
848
|
+
console.error('โ Error requesting email verification:', error);
|
|
849
|
+
return {
|
|
850
|
+
success: false,
|
|
851
|
+
error: error instanceof Error ? error.message : 'Network error'
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
};
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Verify email code and store JWT token
|
|
858
|
+
* @param email Email address
|
|
859
|
+
* @param code Verification code
|
|
860
|
+
* @param testMode Whether to use test mode
|
|
861
|
+
* @returns Promise with verification result and JWT token
|
|
862
|
+
*/
|
|
863
|
+
export const verifyEmailCode = async (
|
|
864
|
+
email: string,
|
|
865
|
+
code: string,
|
|
866
|
+
testMode: boolean = false
|
|
867
|
+
): Promise<{ success: boolean; message?: string; error?: string; existingUser?: boolean; token?: string }> => {
|
|
868
|
+
try {
|
|
869
|
+
console.log('๐ Verifying email code for:', email);
|
|
870
|
+
|
|
871
|
+
const response = await makeDeveloperRequest('/email/verification', {
|
|
872
|
+
method: 'POST',
|
|
873
|
+
body: JSON.stringify({
|
|
874
|
+
email,
|
|
875
|
+
action: 'verify',
|
|
876
|
+
code,
|
|
877
|
+
testMode
|
|
878
|
+
})
|
|
879
|
+
});
|
|
880
|
+
|
|
881
|
+
const data = await response.json();
|
|
882
|
+
|
|
883
|
+
if (response.ok && data.success) {
|
|
884
|
+
console.log('โ
Email verification successful');
|
|
885
|
+
|
|
886
|
+
// Store JWT token if received
|
|
887
|
+
if (data.token || data.jwtToken) {
|
|
888
|
+
const jwtToken = data.token || data.jwtToken;
|
|
889
|
+
await storeJWT(jwtToken);
|
|
890
|
+
console.log('๐ซ JWT token stored successfully');
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
return {
|
|
894
|
+
success: true,
|
|
895
|
+
message: data.message || 'Email verified successfully',
|
|
896
|
+
existingUser: data.existingUser || false,
|
|
897
|
+
token: data.token || data.jwtToken
|
|
898
|
+
};
|
|
899
|
+
} else {
|
|
900
|
+
console.error('โ Email verification failed:', data.error);
|
|
901
|
+
return {
|
|
902
|
+
success: false,
|
|
903
|
+
error: data.error || 'Invalid verification code'
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
} catch (error) {
|
|
907
|
+
console.error('โ Error verifying email code:', error);
|
|
908
|
+
return {
|
|
909
|
+
success: false,
|
|
910
|
+
error: error instanceof Error ? error.message : 'Network error'
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* Check email verification status
|
|
917
|
+
* @param email Email address
|
|
918
|
+
* @param testMode Whether to use test mode
|
|
919
|
+
* @returns Promise with status result
|
|
920
|
+
*/
|
|
921
|
+
export const checkEmailVerificationStatus = async (
|
|
922
|
+
email: string,
|
|
923
|
+
testMode: boolean = false
|
|
924
|
+
): Promise<{ success: boolean; isPending?: boolean; error?: string }> => {
|
|
925
|
+
try {
|
|
926
|
+
console.log('๐ Checking email verification status for:', email);
|
|
927
|
+
|
|
928
|
+
const response = await makeDeveloperRequest('/email/verification/status', {
|
|
929
|
+
method: 'POST',
|
|
930
|
+
body: JSON.stringify({
|
|
931
|
+
email,
|
|
932
|
+
testMode
|
|
933
|
+
})
|
|
934
|
+
});
|
|
935
|
+
|
|
936
|
+
const data = await response.json();
|
|
937
|
+
|
|
938
|
+
if (response.ok && data.success) {
|
|
939
|
+
return {
|
|
940
|
+
success: true,
|
|
941
|
+
isPending: data.isPending || false
|
|
942
|
+
};
|
|
943
|
+
} else {
|
|
944
|
+
return {
|
|
945
|
+
success: false,
|
|
946
|
+
error: data.error || 'Failed to check verification status'
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
} catch (error) {
|
|
950
|
+
console.error('โ Error checking email verification status:', error);
|
|
951
|
+
return {
|
|
952
|
+
success: false,
|
|
953
|
+
error: error instanceof Error ? error.message : 'Network error'
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
};
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* Disconnect a platform (uses developer API key)
|
|
960
|
+
* @param platform Platform to disconnect
|
|
961
|
+
* @param username Username associated with the platform
|
|
962
|
+
* @returns Promise with disconnect result
|
|
963
|
+
*/
|
|
964
|
+
export const disconnectPlatform = async (platform: string, username: string): Promise<{ success: boolean; error?: string }> => {
|
|
965
|
+
try {
|
|
966
|
+
console.log('๐ Disconnecting platform:', platform, 'for user:', username);
|
|
967
|
+
|
|
968
|
+
// Make authenticated API call to disconnect platform
|
|
969
|
+
const response = await makeDeveloperRequest('/revoke', {
|
|
970
|
+
method: 'POST',
|
|
971
|
+
body: JSON.stringify({
|
|
972
|
+
platform,
|
|
973
|
+
username
|
|
974
|
+
})
|
|
975
|
+
});
|
|
976
|
+
|
|
977
|
+
const data = await response.json();
|
|
978
|
+
|
|
979
|
+
if (response.ok && data.success) {
|
|
980
|
+
console.log(`โ
${platform} disconnected successfully`);
|
|
981
|
+
return { success: true };
|
|
982
|
+
} else {
|
|
983
|
+
console.error(`โ Failed to disconnect ${platform}:`, data.error);
|
|
984
|
+
return {
|
|
985
|
+
success: false,
|
|
986
|
+
error: data.error || 'Failed to disconnect platform'
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
} catch (error) {
|
|
990
|
+
console.error(`โ Error disconnecting ${platform}:`, error);
|
|
991
|
+
return {
|
|
992
|
+
success: false,
|
|
993
|
+
error: error instanceof Error ? error.message : 'Network error'
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* Store PIN for user (uses JWT authentication and extracts username from JWT)
|
|
1000
|
+
* @param pin User PIN
|
|
1001
|
+
* @param username Optional username (if not provided, extracts from JWT)
|
|
1002
|
+
* @returns Promise with result
|
|
1003
|
+
*/
|
|
1004
|
+
export const storePIN = async (pin: string, username?: string): Promise<{ success: boolean; error?: string }> => {
|
|
1005
|
+
try {
|
|
1006
|
+
// Extract username from JWT if not provided
|
|
1007
|
+
const userToStore = username || extractUsernameFromJWT();
|
|
1008
|
+
|
|
1009
|
+
if (!userToStore) {
|
|
1010
|
+
console.error('โ No username available - either provide username or ensure JWT token is valid');
|
|
1011
|
+
return {
|
|
1012
|
+
success: false,
|
|
1013
|
+
error: 'No username available for PIN storage'
|
|
1014
|
+
};
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
console.log('๐ Storing PIN for user:', userToStore);
|
|
1018
|
+
|
|
1019
|
+
// Make authenticated request to store PIN (using developer API key for now)
|
|
1020
|
+
const response = await makeDeveloperRequest('/store-pin/web', {
|
|
1021
|
+
method: 'POST',
|
|
1022
|
+
headers: {
|
|
1023
|
+
'Content-Type': 'application/json',
|
|
1024
|
+
},
|
|
1025
|
+
body: JSON.stringify({
|
|
1026
|
+
username: userToStore,
|
|
1027
|
+
pin
|
|
1028
|
+
})
|
|
1029
|
+
});
|
|
1030
|
+
|
|
1031
|
+
const data = await response.json();
|
|
1032
|
+
|
|
1033
|
+
if (response.ok && data.success) {
|
|
1034
|
+
console.log('โ
PIN stored successfully for user:', userToStore);
|
|
1035
|
+
return { success: true };
|
|
1036
|
+
} else {
|
|
1037
|
+
console.error('โ Failed to store PIN:', data.error);
|
|
1038
|
+
return {
|
|
1039
|
+
success: false,
|
|
1040
|
+
error: data.error || 'Failed to store PIN'
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
} catch (error) {
|
|
1044
|
+
console.error('โ Error storing PIN:', error);
|
|
1045
|
+
return {
|
|
1046
|
+
success: false,
|
|
1047
|
+
error: error instanceof Error ? error.message : 'Network error'
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* ๐ซ GET STORED JWT TOKEN
|
|
1054
|
+
* Helper function to retrieve stored JWT token from email verification or other sources
|
|
1055
|
+
*/
|
|
1056
|
+
export const getStoredJwtToken = async (): Promise<string | null> => {
|
|
1057
|
+
try {
|
|
1058
|
+
console.log('๐ซ Retrieving stored JWT token...');
|
|
1059
|
+
|
|
1060
|
+
// Try different storage keys in order of preference
|
|
1061
|
+
const tokenSources = [
|
|
1062
|
+
'email_verification_token',
|
|
1063
|
+
'onairos_jwt_token',
|
|
1064
|
+
'enoch_token',
|
|
1065
|
+
'auth_token',
|
|
1066
|
+
];
|
|
1067
|
+
|
|
1068
|
+
for (const source of tokenSources) {
|
|
1069
|
+
const token = await AsyncStorage.getItem(source);
|
|
1070
|
+
if (token && token.length > 20) {
|
|
1071
|
+
console.log(`โ
JWT token found in ${source}:`, token.substring(0, 20) + '...');
|
|
1072
|
+
return token;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
console.warn('โ ๏ธ No JWT token found in storage');
|
|
1077
|
+
return null;
|
|
1078
|
+
} catch (error) {
|
|
1079
|
+
console.error('โ Error retrieving JWT token:', error);
|
|
1080
|
+
return null;
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* ๐ซ CLEAR STORED TOKENS
|
|
1086
|
+
* Helper function to clear all stored tokens (useful for logout)
|
|
1087
|
+
*/
|
|
1088
|
+
export const clearStoredTokens = async (): Promise<void> => {
|
|
1089
|
+
try {
|
|
1090
|
+
console.log('๐งน Clearing all stored tokens...');
|
|
1091
|
+
|
|
1092
|
+
const tokenKeys = [
|
|
1093
|
+
'email_verification_token',
|
|
1094
|
+
'onairos_jwt_token',
|
|
1095
|
+
'enoch_token',
|
|
1096
|
+
'auth_token',
|
|
1097
|
+
'email_verification_email',
|
|
1098
|
+
'email_verification_request_id',
|
|
1099
|
+
'email_verification_request_email',
|
|
1100
|
+
'token_timestamp',
|
|
1101
|
+
'user_pin_stored',
|
|
1102
|
+
'pin_storage_timestamp',
|
|
1103
|
+
];
|
|
1104
|
+
|
|
1105
|
+
await Promise.all(
|
|
1106
|
+
tokenKeys.map(key => AsyncStorage.removeItem(key))
|
|
1107
|
+
);
|
|
1108
|
+
|
|
1109
|
+
console.log('โ
All tokens cleared successfully');
|
|
1110
|
+
} catch (error) {
|
|
1111
|
+
console.error('โ Error clearing tokens:', error);
|
|
1112
|
+
}
|
|
1113
|
+
};
|