@onairos/react-native 3.4.1 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +423 -374
- package/lib/commonjs/api/index.js +9 -145
- package/lib/commonjs/assets/animations/loaderani.json +1 -0
- package/lib/commonjs/assets/animations/persona-animation.json +1 -0
- package/lib/commonjs/assets/fonts/EBGaramond-VariableFont_wght.ttf +0 -0
- package/lib/commonjs/assets/fonts/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
- package/lib/commonjs/assets/icons/Facebookicon.png +0 -0
- package/lib/commonjs/assets/icons/Gmail.png +0 -0
- package/lib/commonjs/assets/icons/Linkedinicon.png +0 -0
- package/lib/commonjs/assets/icons/Redditicon.png +0 -0
- package/lib/commonjs/assets/icons/YouTubeicon2.png +0 -0
- package/lib/commonjs/assets/icons/YouTubeicon3.png +0 -0
- package/lib/commonjs/assets/icons/chatgpt.png +0 -0
- package/lib/commonjs/assets/icons/claude.png +0 -0
- package/lib/commonjs/assets/icons/gemini.png +0 -0
- package/lib/commonjs/assets/icons/grok.png +0 -0
- package/lib/commonjs/assets/images/Checkbox.svg +3 -0
- package/lib/commonjs/assets/images/EnochE.svg +19 -0
- package/lib/commonjs/assets/images/Enochicon1.png +0 -0
- package/lib/commonjs/assets/images/Face_ID_logo.png +0 -0
- package/lib/commonjs/assets/images/Facebookicon.png +0 -0
- package/lib/commonjs/assets/images/Gmail.png +0 -0
- package/lib/commonjs/assets/images/Googlelogo.png +0 -0
- package/lib/commonjs/assets/images/Linkedinicon.png +0 -0
- package/lib/commonjs/assets/images/OnairosNewLogo.png +0 -0
- package/lib/commonjs/assets/images/Onairoslogo.png +0 -0
- package/lib/commonjs/assets/images/Personalityprofile.svg +3 -0
- package/lib/commonjs/assets/images/Personalitytraits.svg +3 -0
- package/lib/commonjs/assets/images/Redditicon.png +0 -0
- package/lib/commonjs/assets/images/Userpreferences.svg +3 -0
- package/lib/commonjs/assets/images/YouTubeicon3.png +0 -0
- package/lib/commonjs/assets/images/arrow.svg +20 -0
- package/lib/commonjs/assets/images/basicproficon.svg +43 -0
- package/lib/commonjs/assets/images/basicprofile.svg +3 -0
- package/lib/commonjs/assets/images/chatgpt.png +0 -0
- package/lib/commonjs/assets/images/checkmark.svg +4 -0
- package/lib/commonjs/assets/images/claude.png +0 -0
- package/lib/commonjs/assets/images/contentanalysis.svg +3 -0
- package/lib/commonjs/assets/images/contenticon.svg +23 -0
- package/lib/commonjs/assets/images/gemini.png +0 -0
- package/lib/commonjs/assets/images/grok.png +0 -0
- package/lib/commonjs/assets/images/persona1.png +0 -0
- package/lib/commonjs/assets/images/persona2.png +0 -0
- package/lib/commonjs/assets/images/persona3.png +0 -0
- package/lib/commonjs/assets/images/persona4.png +0 -0
- package/lib/commonjs/assets/images/persona5.png +0 -0
- package/lib/commonjs/assets/images/personalityicon.svg +18 -0
- package/lib/commonjs/assets/images/x-close.svg +3 -0
- package/lib/commonjs/components/BodyText.js +9 -0
- package/lib/commonjs/components/BrandMark.js +10 -0
- package/lib/commonjs/components/CodeInput.js +9 -0
- package/lib/commonjs/components/EmailInput.js +8 -0
- package/lib/commonjs/components/GoogleButton.js +9 -0
- package/lib/commonjs/components/HeadingGroup.js +9 -0
- package/lib/commonjs/components/LLMDataInputModal.js +14 -0
- package/lib/commonjs/components/ModalHeader.js +9 -0
- package/lib/commonjs/components/ModalSheet.js +9 -0
- package/lib/commonjs/components/Onairos.js +14 -374
- package/lib/commonjs/components/OnairosButton.js +13 -309
- package/lib/commonjs/components/OnairosSignInButton.js +12 -0
- package/lib/commonjs/components/Overlay.js +13 -483
- package/lib/commonjs/components/PersonaImage.js +10 -0
- package/lib/commonjs/components/PersonaLoadingScreen.js +12 -0
- package/lib/commonjs/components/PersonalizationConsentScreen.js +13 -0
- package/lib/commonjs/components/PinCreationScreen.js +12 -0
- package/lib/commonjs/components/PinInput.js +9 -302
- package/lib/commonjs/components/PlatformConnectorsStep.js +23 -0
- package/lib/commonjs/components/PlatformList.js +10 -137
- package/lib/commonjs/components/PlatformToggle.js +9 -0
- package/lib/commonjs/components/PrimaryButton.js +10 -0
- package/lib/commonjs/components/SignInMatchAnimation.js +9 -0
- package/lib/commonjs/components/SignInStep.js +12 -0
- package/lib/commonjs/components/UniversalOnboarding.js +30 -1702
- package/lib/commonjs/components/VerificationStep.js +11 -0
- package/lib/commonjs/components/WelcomeScreen.js +22 -0
- package/lib/commonjs/components/icons/Basicproficon.js +8 -0
- package/lib/commonjs/components/icons/Basicprofile.js +8 -0
- package/lib/commonjs/components/icons/Checkbox.js +8 -0
- package/lib/commonjs/components/icons/Checkmark.js +8 -0
- package/lib/commonjs/components/icons/Contentanalysis.js +8 -0
- package/lib/commonjs/components/icons/Contenticon.js +8 -0
- package/lib/commonjs/components/icons/EnochE.js +8 -0
- package/lib/commonjs/components/icons/Personalityicon.js +8 -0
- package/lib/commonjs/components/icons/Personalityprofile.js +8 -0
- package/lib/commonjs/components/icons/Personalitytraits.js +8 -0
- package/lib/commonjs/components/icons/Userpreferences.js +8 -0
- package/lib/commonjs/components/icons/index.js +17 -0
- package/lib/commonjs/components/onboarding/OAuthWebView.js +18 -827
- package/lib/commonjs/components/onboarding/OnboardingHeader.js +10 -74
- package/lib/commonjs/components/onboarding/PinInput.js +10 -283
- package/lib/commonjs/components/onboarding/PlatformConnector.js +11 -249
- package/lib/commonjs/config/api.js +7 -0
- package/lib/commonjs/constants/index.js +7 -83
- package/lib/commonjs/context/AuthContext.js +10 -0
- package/lib/commonjs/hooks/useConnectedAccounts.js +9 -0
- package/lib/commonjs/hooks/useConnections.js +8 -159
- package/lib/commonjs/hooks/useCredentials.js +10 -177
- package/lib/commonjs/hooks/useUserConnections.js +10 -0
- package/lib/commonjs/index.js +34 -106
- package/lib/commonjs/services/SDK_API_KEY_VALIDATION.md +421 -421
- package/lib/commonjs/services/apiClient.js +8 -0
- package/lib/commonjs/services/apiKeyService.js +9 -952
- package/lib/commonjs/services/authService.js +10 -0
- package/lib/commonjs/services/biometricPinService.js +8 -0
- package/lib/commonjs/services/chatGPTConversationExtractor.js +8 -0
- package/lib/commonjs/services/chatGPTConversationService.js +9 -0
- package/lib/commonjs/services/claudeConversationExtractor.js +8 -0
- package/lib/commonjs/services/claudeConversationService.js +9 -0
- package/lib/commonjs/services/connectedAccountsService.js +10 -0
- package/lib/commonjs/services/googleAuthService.js +11 -0
- package/lib/commonjs/services/hingeDataExtractor.js +8 -0
- package/lib/commonjs/services/hingeDataService.js +9 -0
- package/lib/commonjs/services/imageCompressionService.js +7 -0
- package/lib/commonjs/services/instagramDataExtractor.js +8 -0
- package/lib/commonjs/services/instagramDataService.js +9 -0
- package/lib/commonjs/services/jwtStorageService.js +7 -0
- package/lib/commonjs/services/linkedinDOMExtractor.js +7 -0
- package/lib/commonjs/services/linkedinProfileService.js +9 -0
- package/lib/commonjs/services/linkedinScrapingService.js +8 -0
- package/lib/commonjs/services/llmDataStorage.js +8 -0
- package/lib/commonjs/services/mobileTrainingService.js +8 -0
- package/lib/commonjs/services/oauthService.js +11 -390
- package/lib/commonjs/services/pinEncryptionService.js +8 -0
- package/lib/commonjs/services/pinStorageUtils.js +7 -0
- package/lib/commonjs/services/platformAuthService.js +12 -1067
- package/lib/commonjs/services/sephoraDataExtractor.js +8 -0
- package/lib/commonjs/services/sephoraDataService.js +9 -0
- package/lib/commonjs/services/storageService.js +8 -0
- package/lib/commonjs/services/telegramDataExtractor.js +8 -0
- package/lib/commonjs/services/telegramDataService.js +11 -0
- package/lib/commonjs/services/trainingApiHelpers.js +7 -0
- package/lib/commonjs/services/userConnectionsService.js +10 -0
- package/lib/commonjs/services/youtubeMigrationService.js +10 -0
- package/lib/commonjs/theme/index.js +7 -0
- package/lib/commonjs/types/ambient.d.js +1 -2
- package/lib/commonjs/types/declarations.d.js +1 -2
- package/lib/commonjs/types/index.js +1 -6
- package/lib/commonjs/types/node-fix.d.js +1 -2
- package/lib/commonjs/types/node-override.d.js +1 -2
- package/lib/commonjs/types/opacity.d.js +1 -2
- package/lib/commonjs/types.js +1 -14
- package/lib/commonjs/utils/Portal.js +8 -98
- package/lib/commonjs/utils/api.js +9 -129
- package/lib/commonjs/utils/assetRegistry.js +33 -0
- package/lib/commonjs/utils/auth.js +9 -111
- package/lib/commonjs/utils/connectorTests.js +29 -0
- package/lib/commonjs/utils/crypto.js +8 -62
- package/lib/commonjs/utils/debugHelper.js +1 -64
- package/lib/commonjs/utils/encryption.js +7 -76
- package/lib/commonjs/utils/eventUtils.js +1 -0
- package/lib/commonjs/utils/haptics.js +9 -0
- package/lib/commonjs/utils/imagePreloader.js +1 -0
- package/lib/commonjs/utils/networkDiagnostics.js +8 -0
- package/lib/commonjs/utils/onairosApi.js +9 -350
- package/lib/commonjs/utils/programmaticFlow.js +9 -117
- package/lib/commonjs/utils/retryHelper.js +1 -220
- package/lib/commonjs/utils/secureStorage.js +10 -349
- package/lib/commonjs/utils/webviewScripts/chatgpt.js +1 -0
- package/lib/commonjs/utils/webviewScripts/claude.js +1 -0
- package/lib/commonjs/utils/webviewScripts/hinge.js +1 -0
- package/lib/commonjs/utils/webviewScripts/index.js +13 -0
- package/lib/commonjs/utils/webviewScripts/instagram.js +1 -0
- package/lib/commonjs/utils/webviewScripts/linkedin.js +1 -0
- package/lib/commonjs/utils/webviewScripts/sephora.js +1 -0
- package/lib/commonjs/utils/webviewScripts/telegram.js +1 -0
- package/lib/module/api/index.js +1 -139
- package/lib/module/assets/animations/loaderani.json +1 -0
- package/lib/module/assets/animations/persona-animation.json +1 -0
- package/lib/module/assets/fonts/EBGaramond-VariableFont_wght.ttf +0 -0
- package/lib/module/assets/fonts/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
- package/lib/module/assets/icons/Facebookicon.png +0 -0
- package/lib/module/assets/icons/Gmail.png +0 -0
- package/lib/module/assets/icons/Linkedinicon.png +0 -0
- package/lib/module/assets/icons/Redditicon.png +0 -0
- package/lib/module/assets/icons/YouTubeicon2.png +0 -0
- package/lib/module/assets/icons/YouTubeicon3.png +0 -0
- package/lib/module/assets/icons/chatgpt.png +0 -0
- package/lib/module/assets/icons/claude.png +0 -0
- package/lib/module/assets/icons/farcaster.png +0 -0
- package/lib/module/assets/icons/gemini.png +0 -0
- package/lib/module/assets/icons/grok.png +0 -0
- package/lib/module/assets/icons/instagram.png +0 -0
- package/lib/module/assets/icons/pinterest.png +0 -0
- package/lib/module/assets/icons/swerv_logo.png +0 -0
- package/lib/module/assets/icons/twitter.jpg +0 -0
- package/lib/module/assets/images/Checkbox.svg +3 -0
- package/lib/module/assets/images/EnochE.svg +19 -0
- package/lib/module/assets/images/Enochicon1.png +0 -0
- package/lib/module/assets/images/Face_ID_logo.png +0 -0
- package/lib/module/assets/images/Facebookicon.png +0 -0
- package/lib/module/assets/images/Gmail.png +0 -0
- package/lib/module/assets/images/Googlelogo.png +0 -0
- package/lib/module/assets/images/Linkedinicon.png +0 -0
- package/lib/module/assets/images/OnairosNewLogo.png +0 -0
- package/lib/module/assets/images/Onairoslogo.png +0 -0
- package/lib/module/assets/images/Personalityprofile.svg +3 -0
- package/lib/module/assets/images/Personalitytraits.svg +3 -0
- package/lib/module/assets/images/Redditicon.png +0 -0
- package/lib/module/assets/images/Userpreferences.svg +3 -0
- package/lib/module/assets/images/YouTubeicon3.png +0 -0
- package/lib/module/assets/images/arrow.svg +20 -0
- package/lib/module/assets/images/basicproficon.svg +43 -0
- package/lib/module/assets/images/basicprofile.svg +3 -0
- package/lib/module/assets/images/chatgpt.png +0 -0
- package/lib/module/assets/images/checkmark.svg +4 -0
- package/lib/module/assets/images/claude.png +0 -0
- package/lib/module/assets/images/contentanalysis.svg +3 -0
- package/lib/module/assets/images/contenticon.svg +23 -0
- package/lib/module/assets/images/gemini.png +0 -0
- package/lib/module/assets/images/grok.png +0 -0
- package/lib/module/assets/images/persona1.png +0 -0
- package/lib/module/assets/images/persona2.png +0 -0
- package/lib/module/assets/images/persona3.png +0 -0
- package/lib/module/assets/images/persona4.png +0 -0
- package/lib/module/assets/images/persona5.png +0 -0
- package/lib/module/assets/images/personalityicon.svg +18 -0
- package/lib/module/assets/images/x-close.svg +3 -0
- package/lib/module/components/BodyText.js +1 -0
- package/lib/module/components/BrandMark.js +1 -0
- package/lib/module/components/CodeInput.js +1 -0
- package/lib/module/components/EmailInput.js +1 -0
- package/lib/module/components/GoogleButton.js +1 -0
- package/lib/module/components/HeadingGroup.js +1 -0
- package/lib/module/components/LLMDataInputModal.js +8 -0
- package/lib/module/components/ModalHeader.js +1 -0
- package/lib/module/components/ModalSheet.js +1 -0
- package/lib/module/components/Onairos.js +1 -367
- package/lib/module/components/OnairosButton.js +1 -302
- package/lib/module/components/OnairosSignInButton.js +1 -0
- package/lib/module/components/Overlay.js +1 -474
- package/lib/module/components/PersonaImage.js +1 -0
- package/lib/module/components/PersonaLoadingScreen.js +1 -0
- package/lib/module/components/PersonalizationConsentScreen.js +1 -0
- package/lib/module/components/PinCreationScreen.js +1 -0
- package/lib/module/components/PinInput.js +1 -293
- package/lib/module/components/PlatformConnectorsStep.js +7 -0
- package/lib/module/components/PlatformList.js +1 -129
- package/lib/module/components/PlatformToggle.js +1 -0
- package/lib/module/components/PrimaryButton.js +1 -0
- package/lib/module/components/SignInMatchAnimation.js +1 -0
- package/lib/module/components/SignInStep.js +1 -0
- package/lib/module/components/UniversalOnboarding.js +1 -1693
- package/lib/module/components/VerificationStep.js +1 -0
- package/lib/module/components/WelcomeScreen.js +1 -0
- package/lib/module/components/icons/Basicproficon.js +1 -0
- package/lib/module/components/icons/Basicprofile.js +1 -0
- package/lib/module/components/icons/Checkbox.js +1 -0
- package/lib/module/components/icons/Checkmark.js +1 -0
- package/lib/module/components/icons/Contentanalysis.js +1 -0
- package/lib/module/components/icons/Contenticon.js +1 -0
- package/lib/module/components/icons/EnochE.js +1 -0
- package/lib/module/components/icons/Personalityicon.js +1 -0
- package/lib/module/components/icons/Personalityprofile.js +1 -0
- package/lib/module/components/icons/Personalitytraits.js +1 -0
- package/lib/module/components/icons/Userpreferences.js +1 -0
- package/lib/module/components/icons/index.js +1 -0
- package/lib/module/components/onboarding/OAuthWebView.js +1 -818
- package/lib/module/components/onboarding/OnboardingHeader.js +1 -66
- package/lib/module/components/onboarding/PinInput.js +1 -274
- package/lib/module/components/onboarding/PlatformConnector.js +1 -240
- package/lib/module/config/api.js +1 -0
- package/lib/module/constants/index.js +1 -77
- package/lib/module/context/AuthContext.js +1 -0
- package/lib/module/hooks/useConnectedAccounts.js +1 -0
- package/lib/module/hooks/useConnections.js +1 -152
- package/lib/module/hooks/useCredentials.js +6 -169
- package/lib/module/hooks/useUserConnections.js +1 -0
- package/lib/module/index.js +1 -32
- package/lib/module/services/SDK_API_KEY_VALIDATION.md +421 -421
- package/lib/module/services/apiClient.js +1 -0
- package/lib/module/services/apiKeyService.js +1 -925
- package/lib/module/services/authService.js +1 -0
- package/lib/module/services/biometricPinService.js +1 -0
- package/lib/module/services/chatGPTConversationExtractor.js +1 -0
- package/lib/module/services/chatGPTConversationService.js +1 -0
- package/lib/module/services/claudeConversationExtractor.js +1 -0
- package/lib/module/services/claudeConversationService.js +1 -0
- package/lib/module/services/connectedAccountsService.js +1 -0
- package/lib/module/services/googleAuthService.js +1 -0
- package/lib/module/services/hingeDataExtractor.js +1 -0
- package/lib/module/services/hingeDataService.js +1 -0
- package/lib/module/services/imageCompressionService.js +1 -0
- package/lib/module/services/instagramDataExtractor.js +1 -0
- package/lib/module/services/instagramDataService.js +1 -0
- package/lib/module/services/jwtStorageService.js +1 -0
- package/lib/module/services/linkedinDOMExtractor.js +1 -0
- package/lib/module/services/linkedinProfileService.js +1 -0
- package/lib/module/services/linkedinScrapingService.js +1 -0
- package/lib/module/services/llmDataStorage.js +1 -0
- package/lib/module/services/mobileTrainingService.js +1 -0
- package/lib/module/services/oauthService.js +1 -380
- package/lib/module/services/pinEncryptionService.js +7 -0
- package/lib/module/services/pinStorageUtils.js +1 -0
- package/lib/module/services/platformAuthService.js +1 -1041
- package/lib/module/services/sephoraDataExtractor.js +1 -0
- package/lib/module/services/sephoraDataService.js +1 -0
- package/lib/module/services/storageService.js +1 -0
- package/lib/module/services/telegramDataExtractor.js +1 -0
- package/lib/module/services/telegramDataService.js +8 -0
- package/lib/module/services/trainingApiHelpers.js +1 -0
- package/lib/module/services/userConnectionsService.js +1 -0
- package/lib/module/services/youtubeMigrationService.js +1 -0
- package/lib/module/theme/index.js +1 -0
- package/lib/module/types.js +1 -10
- package/lib/module/utils/Portal.js +1 -90
- package/lib/module/utils/api.js +1 -117
- package/lib/module/utils/assetRegistry.js +33 -0
- package/lib/module/utils/auth.js +1 -99
- package/lib/module/utils/connectorTests.js +28 -0
- package/lib/module/utils/crypto.js +1 -54
- package/lib/module/utils/debugHelper.js +1 -54
- package/lib/module/utils/encryption.js +1 -67
- package/lib/module/utils/eventUtils.js +1 -0
- package/lib/module/utils/haptics.js +8 -0
- package/lib/module/utils/imagePreloader.js +1 -0
- package/lib/module/utils/networkDiagnostics.js +1 -0
- package/lib/module/utils/onairosApi.js +1 -333
- package/lib/module/utils/programmaticFlow.js +1 -111
- package/lib/module/utils/retryHelper.js +1 -211
- package/lib/module/utils/secureStorage.js +6 -330
- package/lib/module/utils/webviewScripts/chatgpt.js +1 -0
- package/lib/module/utils/webviewScripts/claude.js +1 -0
- package/lib/module/utils/webviewScripts/hinge.js +1 -0
- package/lib/module/utils/webviewScripts/index.js +1 -0
- package/lib/module/utils/webviewScripts/instagram.js +1 -0
- package/lib/module/utils/webviewScripts/linkedin.js +1 -0
- package/lib/module/utils/webviewScripts/sephora.js +1 -0
- package/lib/module/utils/webviewScripts/telegram.js +1 -0
- package/package.json +62 -39
- package/lib/commonjs/api/index.js.map +0 -1
- package/lib/commonjs/assets/images/email.png +0 -0
- package/lib/commonjs/assets/images/linkedin.png +0 -0
- package/lib/commonjs/assets/images/reddit.png +0 -0
- package/lib/commonjs/assets/images/youtube.png +0 -0
- package/lib/commonjs/components/DataRequestModal.js +0 -228
- package/lib/commonjs/components/DataRequestModal.js.map +0 -1
- package/lib/commonjs/components/DataRequestScreen.js +0 -329
- package/lib/commonjs/components/DataRequestScreen.js.map +0 -1
- package/lib/commonjs/components/EmailVerificationModal.js +0 -320
- package/lib/commonjs/components/EmailVerificationModal.js.map +0 -1
- package/lib/commonjs/components/Onairos.js.map +0 -1
- package/lib/commonjs/components/OnairosButton.js.map +0 -1
- package/lib/commonjs/components/Overlay.js.map +0 -1
- package/lib/commonjs/components/PinInput.js.map +0 -1
- package/lib/commonjs/components/PlatformList.js.map +0 -1
- package/lib/commonjs/components/TrainingModal.js +0 -717
- package/lib/commonjs/components/TrainingModal.js.map +0 -1
- package/lib/commonjs/components/UniversalOnboarding.js.map +0 -1
- package/lib/commonjs/components/UniversalOnboarding.tsx.new +0 -455
- package/lib/commonjs/components/onboarding/OAuthWebView.js.map +0 -1
- package/lib/commonjs/components/onboarding/OnboardingHeader.js.map +0 -1
- package/lib/commonjs/components/onboarding/PinInput.js.map +0 -1
- package/lib/commonjs/components/onboarding/PlatformConnector.js.map +0 -1
- package/lib/commonjs/components/screens/ConnectorScreen.js +0 -146
- package/lib/commonjs/components/screens/ConnectorScreen.js.map +0 -1
- package/lib/commonjs/components/screens/LoadingScreen.js +0 -91
- package/lib/commonjs/components/screens/LoadingScreen.js.map +0 -1
- package/lib/commonjs/components/screens/PinCreationScreen.js +0 -61
- package/lib/commonjs/components/screens/PinCreationScreen.js.map +0 -1
- package/lib/commonjs/constants/index.js.map +0 -1
- package/lib/commonjs/hooks/useConnections.js.map +0 -1
- package/lib/commonjs/hooks/useCredentials.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/services/apiKeyService.js.map +0 -1
- package/lib/commonjs/services/oauthService.js.map +0 -1
- package/lib/commonjs/services/platformAuthService.js.map +0 -1
- package/lib/commonjs/types/ambient.d.js.map +0 -1
- package/lib/commonjs/types/declarations.d.js.map +0 -1
- package/lib/commonjs/types/index.d.js.map +0 -1
- package/lib/commonjs/types/index.js.map +0 -1
- package/lib/commonjs/types/node-fix.d.js.map +0 -1
- package/lib/commonjs/types/node-override.d.js.map +0 -1
- package/lib/commonjs/types/opacity.d.js.map +0 -1
- package/lib/commonjs/types/types.d.js.map +0 -1
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/utils/Portal.js.map +0 -1
- package/lib/commonjs/utils/api.js.map +0 -1
- package/lib/commonjs/utils/auth.js.map +0 -1
- package/lib/commonjs/utils/crypto.js.map +0 -1
- package/lib/commonjs/utils/debugHelper.js.map +0 -1
- package/lib/commonjs/utils/encryption.js.map +0 -1
- package/lib/commonjs/utils/onairosApi.js.map +0 -1
- package/lib/commonjs/utils/programmaticFlow.js.map +0 -1
- package/lib/commonjs/utils/retryHelper.js.map +0 -1
- package/lib/commonjs/utils/secureStorage.js.map +0 -1
- package/lib/module/api/index.js.map +0 -1
- package/lib/module/assets/images/email.png +0 -0
- package/lib/module/assets/images/linkedin.png +0 -0
- package/lib/module/assets/images/reddit.png +0 -0
- package/lib/module/assets/images/youtube.png +0 -0
- package/lib/module/components/DataRequestModal.js +0 -220
- package/lib/module/components/DataRequestModal.js.map +0 -1
- package/lib/module/components/DataRequestScreen.js +0 -321
- package/lib/module/components/DataRequestScreen.js.map +0 -1
- package/lib/module/components/EmailVerificationModal.js +0 -311
- package/lib/module/components/EmailVerificationModal.js.map +0 -1
- package/lib/module/components/Onairos.js.map +0 -1
- package/lib/module/components/OnairosButton.js.map +0 -1
- package/lib/module/components/Overlay.js.map +0 -1
- package/lib/module/components/PinInput.js.map +0 -1
- package/lib/module/components/PlatformList.js.map +0 -1
- package/lib/module/components/TrainingModal.js +0 -708
- package/lib/module/components/TrainingModal.js.map +0 -1
- package/lib/module/components/UniversalOnboarding.js.map +0 -1
- package/lib/module/components/UniversalOnboarding.tsx.new +0 -455
- package/lib/module/components/onboarding/OAuthWebView.js.map +0 -1
- package/lib/module/components/onboarding/OnboardingHeader.js.map +0 -1
- package/lib/module/components/onboarding/PinInput.js.map +0 -1
- package/lib/module/components/onboarding/PlatformConnector.js.map +0 -1
- package/lib/module/components/screens/ConnectorScreen.js +0 -138
- package/lib/module/components/screens/ConnectorScreen.js.map +0 -1
- package/lib/module/components/screens/LoadingScreen.js +0 -83
- package/lib/module/components/screens/LoadingScreen.js.map +0 -1
- package/lib/module/components/screens/PinCreationScreen.js +0 -53
- package/lib/module/components/screens/PinCreationScreen.js.map +0 -1
- package/lib/module/constants/index.js.map +0 -1
- package/lib/module/hooks/useConnections.js.map +0 -1
- package/lib/module/hooks/useCredentials.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/services/apiKeyService.js.map +0 -1
- package/lib/module/services/oauthService.js.map +0 -1
- package/lib/module/services/platformAuthService.js.map +0 -1
- package/lib/module/types/ambient.d.js.map +0 -1
- package/lib/module/types/declarations.d.js.map +0 -1
- package/lib/module/types/index.d.js.map +0 -1
- package/lib/module/types/index.js.map +0 -1
- package/lib/module/types/node-fix.d.js.map +0 -1
- package/lib/module/types/node-override.d.js.map +0 -1
- package/lib/module/types/opacity.d.js.map +0 -1
- package/lib/module/types/types.d.js.map +0 -1
- package/lib/module/types.js.map +0 -1
- package/lib/module/utils/Portal.js.map +0 -1
- package/lib/module/utils/api.js.map +0 -1
- package/lib/module/utils/auth.js.map +0 -1
- package/lib/module/utils/crypto.js.map +0 -1
- package/lib/module/utils/debugHelper.js.map +0 -1
- package/lib/module/utils/encryption.js.map +0 -1
- package/lib/module/utils/onairosApi.js.map +0 -1
- package/lib/module/utils/programmaticFlow.js.map +0 -1
- package/lib/module/utils/retryHelper.js.map +0 -1
- package/lib/module/utils/secureStorage.js.map +0 -1
- package/lib/typescript/api/index.d.ts +0 -8
- package/lib/typescript/api/index.d.ts.map +0 -1
- package/lib/typescript/components/DataRequestModal.d.ts +0 -11
- package/lib/typescript/components/DataRequestModal.d.ts.map +0 -1
- package/lib/typescript/components/DataRequestScreen.d.ts +0 -11
- package/lib/typescript/components/DataRequestScreen.d.ts.map +0 -1
- package/lib/typescript/components/EmailVerificationModal.d.ts +0 -11
- package/lib/typescript/components/EmailVerificationModal.d.ts.map +0 -1
- package/lib/typescript/components/Onairos.d.ts +0 -4
- package/lib/typescript/components/Onairos.d.ts.map +0 -1
- package/lib/typescript/components/OnairosButton.d.ts +0 -12
- package/lib/typescript/components/OnairosButton.d.ts.map +0 -1
- package/lib/typescript/components/Overlay.d.ts +0 -4
- package/lib/typescript/components/Overlay.d.ts.map +0 -1
- package/lib/typescript/components/PinInput.d.ts +0 -4
- package/lib/typescript/components/PinInput.d.ts.map +0 -1
- package/lib/typescript/components/PlatformList.d.ts +0 -4
- package/lib/typescript/components/PlatformList.d.ts.map +0 -1
- package/lib/typescript/components/TrainingModal.d.ts +0 -4
- package/lib/typescript/components/TrainingModal.d.ts.map +0 -1
- package/lib/typescript/components/UniversalOnboarding.d.ts +0 -4
- package/lib/typescript/components/UniversalOnboarding.d.ts.map +0 -1
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts +0 -10
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts.map +0 -1
- package/lib/typescript/components/onboarding/OnboardingHeader.d.ts +0 -11
- package/lib/typescript/components/onboarding/OnboardingHeader.d.ts.map +0 -1
- package/lib/typescript/components/onboarding/PinInput.d.ts +0 -4
- package/lib/typescript/components/onboarding/PinInput.d.ts.map +0 -1
- package/lib/typescript/components/onboarding/PlatformConnector.d.ts +0 -13
- package/lib/typescript/components/onboarding/PlatformConnector.d.ts.map +0 -1
- package/lib/typescript/components/screens/ConnectorScreen.d.ts +0 -9
- package/lib/typescript/components/screens/ConnectorScreen.d.ts.map +0 -1
- package/lib/typescript/components/screens/LoadingScreen.d.ts +0 -9
- package/lib/typescript/components/screens/LoadingScreen.d.ts.map +0 -1
- package/lib/typescript/components/screens/PinCreationScreen.d.ts +0 -10
- package/lib/typescript/components/screens/PinCreationScreen.d.ts.map +0 -1
- package/lib/typescript/constants/index.d.ts +0 -53
- package/lib/typescript/constants/index.d.ts.map +0 -1
- package/lib/typescript/hooks/useConnections.d.ts +0 -9
- package/lib/typescript/hooks/useConnections.d.ts.map +0 -1
- package/lib/typescript/hooks/useCredentials.d.ts +0 -9
- package/lib/typescript/hooks/useCredentials.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -18
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/services/apiKeyService.d.ts +0 -132
- package/lib/typescript/services/apiKeyService.d.ts.map +0 -1
- package/lib/typescript/services/oauthService.d.ts +0 -50
- package/lib/typescript/services/oauthService.d.ts.map +0 -1
- package/lib/typescript/services/platformAuthService.d.ts +0 -144
- package/lib/typescript/services/platformAuthService.d.ts.map +0 -1
- package/lib/typescript/types/index.d.ts +0 -231
- package/lib/typescript/types/index.d.ts.map +0 -1
- package/lib/typescript/types.d.ts +0 -270
- package/lib/typescript/types.d.ts.map +0 -1
- package/lib/typescript/utils/Portal.d.ts +0 -14
- package/lib/typescript/utils/Portal.d.ts.map +0 -1
- package/lib/typescript/utils/api.d.ts +0 -6
- package/lib/typescript/utils/api.d.ts.map +0 -1
- package/lib/typescript/utils/auth.d.ts +0 -6
- package/lib/typescript/utils/auth.d.ts.map +0 -1
- package/lib/typescript/utils/crypto.d.ts +0 -4
- package/lib/typescript/utils/crypto.d.ts.map +0 -1
- package/lib/typescript/utils/debugHelper.d.ts +0 -29
- package/lib/typescript/utils/debugHelper.d.ts.map +0 -1
- package/lib/typescript/utils/encryption.d.ts +0 -19
- package/lib/typescript/utils/encryption.d.ts.map +0 -1
- package/lib/typescript/utils/onairosApi.d.ts +0 -87
- package/lib/typescript/utils/onairosApi.d.ts.map +0 -1
- package/lib/typescript/utils/programmaticFlow.d.ts +0 -23
- package/lib/typescript/utils/programmaticFlow.d.ts.map +0 -1
- package/lib/typescript/utils/retryHelper.d.ts +0 -69
- package/lib/typescript/utils/retryHelper.d.ts.map +0 -1
- package/lib/typescript/utils/secureStorage.d.ts +0 -94
- package/lib/typescript/utils/secureStorage.d.ts.map +0 -1
- package/src/api/index.ts +0 -111
- package/src/assets/images/email.png +0 -0
- package/src/assets/images/linkedin.png +0 -0
- package/src/assets/images/onairos_logo.png +0 -0
- package/src/assets/images/reddit.png +0 -0
- package/src/assets/images/youtube.png +0 -0
- package/src/components/DataRequestModal.tsx +0 -227
- package/src/components/DataRequestScreen.tsx +0 -356
- package/src/components/EmailVerificationModal.tsx +0 -364
- package/src/components/Onairos.tsx +0 -425
- package/src/components/OnairosButton.tsx +0 -359
- package/src/components/Overlay.tsx +0 -506
- package/src/components/PinInput.tsx +0 -343
- package/src/components/PlatformList.tsx +0 -145
- package/src/components/TrainingModal.tsx +0 -737
- package/src/components/UniversalOnboarding.tsx +0 -1839
- package/src/components/UniversalOnboarding.tsx.new +0 -455
- package/src/components/onboarding/OAuthWebView.tsx +0 -838
- package/src/components/onboarding/OnboardingHeader.tsx +0 -70
- package/src/components/onboarding/PinInput.tsx +0 -356
- package/src/components/onboarding/PlatformConnector.tsx +0 -302
- package/src/components/screens/ConnectorScreen.tsx +0 -153
- package/src/components/screens/LoadingScreen.tsx +0 -100
- package/src/components/screens/PinCreationScreen.tsx +0 -67
- package/src/constants/index.ts +0 -83
- package/src/hooks/useConnections.ts +0 -163
- package/src/hooks/useCredentials.ts +0 -175
- package/src/index.js +0 -14
- package/src/index.ts +0 -50
- package/src/services/SDK_API_KEY_VALIDATION.md +0 -421
- package/src/services/apiKeyService.ts +0 -984
- package/src/services/oauthService.ts +0 -412
- package/src/services/platformAuthService.ts +0 -1113
- package/src/types/ambient.d.ts +0 -29
- package/src/types/declarations.d.ts +0 -26
- package/src/types/index.d.ts +0 -274
- package/src/types/index.ts +0 -244
- package/src/types/node-fix.d.ts +0 -19
- package/src/types/node-override.d.ts +0 -24
- package/src/types/opacity.d.ts +0 -16
- package/src/types/types.d.ts +0 -18
- package/src/types.ts +0 -298
- package/src/utils/Portal.tsx +0 -83
- package/src/utils/api.js +0 -112
- package/src/utils/auth.js +0 -104
- package/src/utils/crypto.js +0 -60
- package/src/utils/debugHelper.ts +0 -53
- package/src/utils/encryption.ts +0 -69
- package/src/utils/onairosApi.ts +0 -391
- package/src/utils/programmaticFlow.ts +0 -113
- package/src/utils/retryHelper.ts +0 -275
- package/src/utils/secureStorage.ts +0 -361
- package/types/index.d.ts +0 -218
- package/types/node-env.d.ts +0 -15
- /package/{src/assets/images → lib/commonjs/assets/icons}/farcaster.png +0 -0
- /package/{src/assets/images → lib/commonjs/assets/icons}/instagram.png +0 -0
- /package/{src/assets/images → lib/commonjs/assets/icons}/pinterest.png +0 -0
- /package/{src/assets/images → lib/commonjs/assets/icons}/swerv_logo.png +0 -0
- /package/{src/assets/images → lib/commonjs/assets/icons}/twitter.jpg +0 -0
|
@@ -1,737 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Text,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
TouchableOpacity,
|
|
7
|
-
ActivityIndicator,
|
|
8
|
-
Dimensions,
|
|
9
|
-
Modal,
|
|
10
|
-
Animated,
|
|
11
|
-
TouchableWithoutFeedback,
|
|
12
|
-
SafeAreaView,
|
|
13
|
-
Image,
|
|
14
|
-
Alert,
|
|
15
|
-
} from 'react-native';
|
|
16
|
-
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
17
|
-
import { io, Socket } from 'socket.io-client';
|
|
18
|
-
import { COLORS } from '../constants';
|
|
19
|
-
import type { TrainingModalProps } from '../types';
|
|
20
|
-
|
|
21
|
-
const { width, height } = Dimensions.get('window');
|
|
22
|
-
|
|
23
|
-
export const TrainingModal: React.FC<TrainingModalProps> = ({
|
|
24
|
-
visible,
|
|
25
|
-
progress,
|
|
26
|
-
eta,
|
|
27
|
-
onCancel,
|
|
28
|
-
onComplete,
|
|
29
|
-
modelKey,
|
|
30
|
-
username,
|
|
31
|
-
test = false,
|
|
32
|
-
}) => {
|
|
33
|
-
// Socket and training state
|
|
34
|
-
const socketRef = useRef<Socket | null>(null);
|
|
35
|
-
const [socketConnected, setSocketConnected] = useState(false);
|
|
36
|
-
const [trainingStatus, setTrainingStatus] = useState('Initializing...');
|
|
37
|
-
const [hasError, setHasError] = useState(false);
|
|
38
|
-
const [errorCode, setErrorCode] = useState<string | null>(null);
|
|
39
|
-
const [isTrainingComplete, setIsTrainingComplete] = useState(false);
|
|
40
|
-
const [userTraits, setUserTraits] = useState<any>(null);
|
|
41
|
-
const [inferenceResults, setInferenceResults] = useState<any>(null);
|
|
42
|
-
const [internalProgress, setInternalProgress] = useState(0);
|
|
43
|
-
const [isEnochSDK, setIsEnochSDK] = useState(false); // Determine if using Enoch SDK
|
|
44
|
-
const [trainingResults, setTrainingResults] = useState<any>(null);
|
|
45
|
-
|
|
46
|
-
// Use internal progress if available, otherwise fall back to prop progress
|
|
47
|
-
const currentProgress = internalProgress > 0 ? internalProgress / 100 : progress;
|
|
48
|
-
const progressPercentage = Math.round(currentProgress * 100);
|
|
49
|
-
|
|
50
|
-
// Mock user data for now - in real implementation this would come from props
|
|
51
|
-
const userToken = 'mock-token'; // TODO: Get from actual auth
|
|
52
|
-
const userInfo = {
|
|
53
|
-
username: username || 'mobile_user',
|
|
54
|
-
email: null,
|
|
55
|
-
id: null,
|
|
56
|
-
name: username || 'mobile_user'
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
// Check if we should use Enoch SDK (based on modelKey or other criteria)
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
// For now, default to clean training unless specified
|
|
62
|
-
// In real implementation, this would be determined by SDK type
|
|
63
|
-
setIsEnochSDK(modelKey?.includes('enoch') || false);
|
|
64
|
-
}, [modelKey]);
|
|
65
|
-
|
|
66
|
-
// Start training with new API schema
|
|
67
|
-
const startTraining = async (socketId: string) => {
|
|
68
|
-
try {
|
|
69
|
-
setTrainingStatus('Starting training...');
|
|
70
|
-
setInternalProgress(10);
|
|
71
|
-
setHasError(false);
|
|
72
|
-
setErrorCode(null);
|
|
73
|
-
|
|
74
|
-
if (!userToken) {
|
|
75
|
-
throw new Error('No authentication token available');
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Determine endpoint based on SDK type
|
|
79
|
-
const endpoint = isEnochSDK ? '/mobile-training/enoch' : '/mobile-training/clean';
|
|
80
|
-
|
|
81
|
-
console.log(`🚀 Starting training with endpoint: ${endpoint}`);
|
|
82
|
-
console.log('🔍 Production mode: Using new training API schema');
|
|
83
|
-
|
|
84
|
-
// Prepare training data in new format
|
|
85
|
-
const trainingData = {
|
|
86
|
-
Info: {
|
|
87
|
-
username: userInfo?.username || userInfo?.name || username || 'mobile_user',
|
|
88
|
-
// Mock connected platforms - in real implementation this would come from props
|
|
89
|
-
connectedPlatforms: ['youtube', 'instagram', 'reddit'] // TODO: Get from actual connections
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
console.log('📤 Sending training data:', trainingData);
|
|
94
|
-
|
|
95
|
-
// Call the new training API
|
|
96
|
-
const response = await fetch(`https://api2.onairos.uk${endpoint}`, {
|
|
97
|
-
method: 'POST',
|
|
98
|
-
headers: {
|
|
99
|
-
'Content-Type': 'application/json',
|
|
100
|
-
'Authorization': `Bearer ${userToken}` // JWT token authentication
|
|
101
|
-
},
|
|
102
|
-
body: JSON.stringify(trainingData)
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
const result = await response.json();
|
|
106
|
-
|
|
107
|
-
if (result.success) {
|
|
108
|
-
console.log('🚀 Training Started:', result.message);
|
|
109
|
-
setTrainingStatus('Training initiated...');
|
|
110
|
-
setInternalProgress(20);
|
|
111
|
-
} else {
|
|
112
|
-
console.error('Training start failed:', result.error);
|
|
113
|
-
|
|
114
|
-
// Handle specific error codes from new schema
|
|
115
|
-
if (result.code) {
|
|
116
|
-
setErrorCode(result.code);
|
|
117
|
-
handleTrainingError(result.code, result.error);
|
|
118
|
-
} else {
|
|
119
|
-
setTrainingStatus(`Error: ${result.error}`);
|
|
120
|
-
setHasError(true);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
} catch (error) {
|
|
125
|
-
console.error('Training start error:', error);
|
|
126
|
-
setTrainingStatus(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
127
|
-
setHasError(true);
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
// Handle training errors with specific error codes
|
|
132
|
-
const handleTrainingError = (code: string, message: string) => {
|
|
133
|
-
console.error(`Training Error [${code}]:`, message);
|
|
134
|
-
setHasError(true);
|
|
135
|
-
|
|
136
|
-
switch (code) {
|
|
137
|
-
case 'PIN_REQUIRED':
|
|
138
|
-
setTrainingStatus('PIN setup required');
|
|
139
|
-
Alert.alert(
|
|
140
|
-
'PIN Required',
|
|
141
|
-
'Please set up your PIN first before training.',
|
|
142
|
-
[
|
|
143
|
-
{ text: 'Cancel', style: 'cancel' },
|
|
144
|
-
{ text: 'Set PIN', onPress: () => {
|
|
145
|
-
// TODO: Navigate to PIN setup
|
|
146
|
-
console.log('Navigate to PIN setup');
|
|
147
|
-
}}
|
|
148
|
-
]
|
|
149
|
-
);
|
|
150
|
-
break;
|
|
151
|
-
|
|
152
|
-
case 'CONNECTIONS_REQUIRED':
|
|
153
|
-
setTrainingStatus('No connected accounts');
|
|
154
|
-
Alert.alert(
|
|
155
|
-
'Connections Required',
|
|
156
|
-
'Please connect at least one social media account before training.',
|
|
157
|
-
[
|
|
158
|
-
{ text: 'Cancel', style: 'cancel' },
|
|
159
|
-
{ text: 'Connect', onPress: () => {
|
|
160
|
-
// TODO: Navigate to connections
|
|
161
|
-
console.log('Navigate to connections');
|
|
162
|
-
}}
|
|
163
|
-
]
|
|
164
|
-
);
|
|
165
|
-
break;
|
|
166
|
-
|
|
167
|
-
case 'INSUFFICIENT_DATA':
|
|
168
|
-
setTrainingStatus('Insufficient data for training');
|
|
169
|
-
Alert.alert(
|
|
170
|
-
'Insufficient Data',
|
|
171
|
-
'We need more interaction data to train your model effectively. Please use your connected platforms more and try again.',
|
|
172
|
-
[{ text: 'OK', style: 'default' }]
|
|
173
|
-
);
|
|
174
|
-
break;
|
|
175
|
-
|
|
176
|
-
case 'ENCRYPTION_REQUIRED':
|
|
177
|
-
setTrainingStatus('Model encryption failed');
|
|
178
|
-
Alert.alert(
|
|
179
|
-
'Encryption Error',
|
|
180
|
-
'Failed to encrypt your model. Please try again.',
|
|
181
|
-
[{ text: 'OK', style: 'default' }]
|
|
182
|
-
);
|
|
183
|
-
break;
|
|
184
|
-
|
|
185
|
-
default:
|
|
186
|
-
setTrainingStatus(`Error: ${message}`);
|
|
187
|
-
Alert.alert(
|
|
188
|
-
'Training Error',
|
|
189
|
-
message || 'An unexpected error occurred during training.',
|
|
190
|
-
[{ text: 'OK', style: 'default' }]
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
// Simulate training progress for test mode
|
|
196
|
-
const simulateTraining = () => {
|
|
197
|
-
console.log('🧪 Starting simulated training with new schema phases...');
|
|
198
|
-
setTrainingStatus('Validating Requirements');
|
|
199
|
-
setInternalProgress(5);
|
|
200
|
-
|
|
201
|
-
// Simulate all phases from the new schema
|
|
202
|
-
const phases = [
|
|
203
|
-
{ progress: 10, status: 'Validating Requirements', delay: 1000 },
|
|
204
|
-
{ progress: 25, status: 'Training Model', delay: 2000 },
|
|
205
|
-
{ progress: 50, status: 'Training Model', delay: 2000 },
|
|
206
|
-
{ progress: 65, status: 'Model Trained - Running Test Inference', delay: 1500 },
|
|
207
|
-
{ progress: 80, status: 'Encrypting and Compressing Model', delay: 1000 },
|
|
208
|
-
{ progress: 95, status: 'Uploading Encrypted Model to ARDrive', delay: 1500 },
|
|
209
|
-
{ progress: 100, status: 'Complete!', delay: 500 },
|
|
210
|
-
];
|
|
211
|
-
|
|
212
|
-
let currentPhase = 0;
|
|
213
|
-
|
|
214
|
-
const progressInterval = setInterval(() => {
|
|
215
|
-
if (currentPhase < phases.length) {
|
|
216
|
-
const phase = phases[currentPhase];
|
|
217
|
-
setInternalProgress(phase.progress);
|
|
218
|
-
setTrainingStatus(phase.status);
|
|
219
|
-
|
|
220
|
-
if (phase.progress === 100) {
|
|
221
|
-
setIsTrainingComplete(true);
|
|
222
|
-
clearInterval(progressInterval);
|
|
223
|
-
|
|
224
|
-
// Mock completion results
|
|
225
|
-
const mockResults = {
|
|
226
|
-
completed: true,
|
|
227
|
-
message: "Model trained, encrypted, and stored successfully",
|
|
228
|
-
storage: "ARDrive",
|
|
229
|
-
encryption: true,
|
|
230
|
-
inference: isEnochSDK, // Only Enoch SDK runs inference
|
|
231
|
-
modelUrl: `https://arweave.net/mock_tx_${Date.now()}`
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
setTrainingResults(mockResults);
|
|
235
|
-
|
|
236
|
-
// Auto-complete after a short delay
|
|
237
|
-
setTimeout(() => {
|
|
238
|
-
onComplete && onComplete();
|
|
239
|
-
}, 1000);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
currentPhase++;
|
|
243
|
-
}
|
|
244
|
-
}, phases[currentPhase]?.delay || 1000);
|
|
245
|
-
|
|
246
|
-
// Cleanup interval on unmount
|
|
247
|
-
return () => clearInterval(progressInterval);
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
// Setup socket connection and training
|
|
251
|
-
useEffect(() => {
|
|
252
|
-
if (!visible || !userInfo) return;
|
|
253
|
-
|
|
254
|
-
console.log('Setting up socket connection for training...');
|
|
255
|
-
console.log('🧑💻 User info available:', userInfo);
|
|
256
|
-
console.log('🧪 Test mode:', test);
|
|
257
|
-
console.log('🔧 Using Enoch SDK:', isEnochSDK);
|
|
258
|
-
|
|
259
|
-
// If test mode is enabled, use simulation instead of real API
|
|
260
|
-
if (test) {
|
|
261
|
-
console.log('🧪 Test mode enabled - Using simulated training with new schema');
|
|
262
|
-
setSocketConnected(true);
|
|
263
|
-
simulateTraining();
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
// Initialize real socket connection
|
|
268
|
-
try {
|
|
269
|
-
console.log('🔌 Production mode: Initializing real socket connection');
|
|
270
|
-
|
|
271
|
-
// Initialize socket connection
|
|
272
|
-
socketRef.current = io('https://api2.onairos.uk', {
|
|
273
|
-
transports: ['websocket'],
|
|
274
|
-
autoConnect: false
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
// Socket event listeners for new schema
|
|
278
|
-
socketRef.current.on('connect', () => {
|
|
279
|
-
console.log('✅ Socket connected for training');
|
|
280
|
-
setSocketConnected(true);
|
|
281
|
-
const socketId = socketRef.current?.id;
|
|
282
|
-
if (socketId) {
|
|
283
|
-
startTraining(socketId);
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
socketRef.current.on('disconnect', () => {
|
|
288
|
-
console.log('❌ Socket disconnected');
|
|
289
|
-
setSocketConnected(false);
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
socketRef.current.on('connect_error', (error) => {
|
|
293
|
-
console.error('❌ Socket connection error:', error);
|
|
294
|
-
setTrainingStatus('Connection failed');
|
|
295
|
-
setHasError(true);
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
// Handle training updates with new schema phases
|
|
299
|
-
socketRef.current.on('trainingUpdate', (data) => {
|
|
300
|
-
console.log('📡 Training update received:', data);
|
|
301
|
-
|
|
302
|
-
if (data.error) {
|
|
303
|
-
if (data.code) {
|
|
304
|
-
setErrorCode(data.code);
|
|
305
|
-
handleTrainingError(data.code, data.error);
|
|
306
|
-
} else {
|
|
307
|
-
console.error('Training update error:', data.error);
|
|
308
|
-
setTrainingStatus(`Error: ${data.error}`);
|
|
309
|
-
setHasError(true);
|
|
310
|
-
}
|
|
311
|
-
} else {
|
|
312
|
-
// Handle different status phases
|
|
313
|
-
if (data.status) {
|
|
314
|
-
setTrainingStatus(data.status);
|
|
315
|
-
|
|
316
|
-
// Update progress based on phase
|
|
317
|
-
switch (data.status) {
|
|
318
|
-
case 'Validating Requirements':
|
|
319
|
-
setInternalProgress(10);
|
|
320
|
-
break;
|
|
321
|
-
case 'Training Model':
|
|
322
|
-
setInternalProgress(data.percent || 40);
|
|
323
|
-
break;
|
|
324
|
-
case 'Model Trained - Running Test Inference':
|
|
325
|
-
setInternalProgress(65);
|
|
326
|
-
break;
|
|
327
|
-
case 'Encrypting and Compressing Model':
|
|
328
|
-
setInternalProgress(80);
|
|
329
|
-
break;
|
|
330
|
-
case 'Uploading Encrypted Model to ARDrive':
|
|
331
|
-
setInternalProgress(90);
|
|
332
|
-
break;
|
|
333
|
-
default:
|
|
334
|
-
if (data.percent) {
|
|
335
|
-
setInternalProgress(data.percent);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
if (data.progress) {
|
|
341
|
-
setInternalProgress(data.progress);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
// Handle training completion with new schema
|
|
347
|
-
socketRef.current.on('trainingCompleted', (data) => {
|
|
348
|
-
console.log('✅ Training Complete:', data);
|
|
349
|
-
|
|
350
|
-
if (data.completed && data.storage === 'ARDrive' && data.encryption === true) {
|
|
351
|
-
setTrainingStatus('Training completed successfully!');
|
|
352
|
-
setIsTrainingComplete(true);
|
|
353
|
-
setInternalProgress(100);
|
|
354
|
-
setTrainingResults(data);
|
|
355
|
-
|
|
356
|
-
// Display results
|
|
357
|
-
console.log('✅ Model URL:', data.modelUrl);
|
|
358
|
-
console.log('✅ Storage:', data.storage);
|
|
359
|
-
console.log('✅ Encrypted:', data.encryption);
|
|
360
|
-
console.log('✅ Inference:', data.inference);
|
|
361
|
-
|
|
362
|
-
// Auto-complete after a short delay
|
|
363
|
-
setTimeout(() => {
|
|
364
|
-
onComplete && onComplete();
|
|
365
|
-
}, 1500);
|
|
366
|
-
} else {
|
|
367
|
-
console.error('Training completion missing required fields:', data);
|
|
368
|
-
setTrainingStatus('Training completed with warnings');
|
|
369
|
-
setHasError(true);
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
// Legacy handlers for backward compatibility
|
|
374
|
-
socketRef.current.on('inferenceCompleted', (data) => {
|
|
375
|
-
console.log('🧠 Inference Complete:', data);
|
|
376
|
-
setUserTraits(data.traits);
|
|
377
|
-
setInferenceResults(data.inferenceResults);
|
|
378
|
-
});
|
|
379
|
-
|
|
380
|
-
socketRef.current.on('modelStandby', (data) => {
|
|
381
|
-
console.log('🎉 Model Ready:', data);
|
|
382
|
-
// This is handled by trainingCompleted now
|
|
383
|
-
});
|
|
384
|
-
|
|
385
|
-
// Connect to socket
|
|
386
|
-
socketRef.current.connect();
|
|
387
|
-
|
|
388
|
-
} catch (socketError) {
|
|
389
|
-
console.error('🚨 Production mode: Socket connection failed:', socketError);
|
|
390
|
-
setTrainingStatus('Failed to connect to training service');
|
|
391
|
-
setHasError(true);
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
// Cleanup function
|
|
395
|
-
return () => {
|
|
396
|
-
if (socketRef.current) {
|
|
397
|
-
console.log('🔌 Disconnecting training socket...');
|
|
398
|
-
socketRef.current.disconnect();
|
|
399
|
-
socketRef.current = null;
|
|
400
|
-
}
|
|
401
|
-
};
|
|
402
|
-
}, [visible, userInfo, test, isEnochSDK]);
|
|
403
|
-
|
|
404
|
-
// Render error details for specific error codes
|
|
405
|
-
const renderErrorDetails = () => {
|
|
406
|
-
if (!hasError || !errorCode) return null;
|
|
407
|
-
|
|
408
|
-
const errorDetails = {
|
|
409
|
-
'PIN_REQUIRED': {
|
|
410
|
-
icon: 'lock',
|
|
411
|
-
title: 'PIN Setup Required',
|
|
412
|
-
description: 'Set up your PIN to secure your AI model'
|
|
413
|
-
},
|
|
414
|
-
'CONNECTIONS_REQUIRED': {
|
|
415
|
-
icon: 'link',
|
|
416
|
-
title: 'Connect Accounts',
|
|
417
|
-
description: 'Connect at least one social media account'
|
|
418
|
-
},
|
|
419
|
-
'INSUFFICIENT_DATA': {
|
|
420
|
-
icon: 'data-usage',
|
|
421
|
-
title: 'More Data Needed',
|
|
422
|
-
description: 'We need more interaction data to train effectively'
|
|
423
|
-
},
|
|
424
|
-
'ENCRYPTION_REQUIRED': {
|
|
425
|
-
icon: 'security',
|
|
426
|
-
title: 'Encryption Failed',
|
|
427
|
-
description: 'Failed to encrypt your model securely'
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
const details = errorDetails[errorCode];
|
|
432
|
-
if (!details) return null;
|
|
433
|
-
|
|
434
|
-
return (
|
|
435
|
-
<View style={styles.errorDetailsContainer}>
|
|
436
|
-
<Icon name={details.icon} size={32} color="#FF6B6B" />
|
|
437
|
-
<Text style={styles.errorTitle}>{details.title}</Text>
|
|
438
|
-
<Text style={styles.errorDescription}>{details.description}</Text>
|
|
439
|
-
</View>
|
|
440
|
-
);
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
return (
|
|
444
|
-
<Modal
|
|
445
|
-
visible={visible}
|
|
446
|
-
transparent
|
|
447
|
-
animationType="none"
|
|
448
|
-
statusBarTranslucent
|
|
449
|
-
onRequestClose={onCancel}
|
|
450
|
-
>
|
|
451
|
-
<TouchableWithoutFeedback>
|
|
452
|
-
<View style={styles.modalOverlay}>
|
|
453
|
-
<TouchableWithoutFeedback>
|
|
454
|
-
<View style={styles.bottomSheet}>
|
|
455
|
-
<View style={styles.handleContainer}>
|
|
456
|
-
<View style={styles.handle} />
|
|
457
|
-
</View>
|
|
458
|
-
|
|
459
|
-
<SafeAreaView style={styles.container}>
|
|
460
|
-
<View style={styles.content}>
|
|
461
|
-
<Image
|
|
462
|
-
source={require('../assets/images/onairos_logo.png')}
|
|
463
|
-
style={styles.onairosLogo}
|
|
464
|
-
resizeMode="contain"
|
|
465
|
-
/>
|
|
466
|
-
|
|
467
|
-
<Text style={styles.title}>
|
|
468
|
-
{isEnochSDK ? 'Training AI with Inference' : 'Training Your AI'}
|
|
469
|
-
</Text>
|
|
470
|
-
|
|
471
|
-
<View style={styles.progressContainer}>
|
|
472
|
-
<View style={styles.progressBar}>
|
|
473
|
-
<View
|
|
474
|
-
style={[
|
|
475
|
-
styles.progressFill,
|
|
476
|
-
{ width: `${progressPercentage}%` },
|
|
477
|
-
]}
|
|
478
|
-
/>
|
|
479
|
-
</View>
|
|
480
|
-
<Text style={styles.progressText}>{progressPercentage}%</Text>
|
|
481
|
-
</View>
|
|
482
|
-
|
|
483
|
-
<Text style={styles.statusText}>
|
|
484
|
-
{trainingStatus}
|
|
485
|
-
</Text>
|
|
486
|
-
|
|
487
|
-
{hasError && (
|
|
488
|
-
<View style={styles.errorContainer}>
|
|
489
|
-
<Icon name="error-outline" size={24} color="#FF6B6B" />
|
|
490
|
-
<Text style={styles.errorText}>Training encountered an error</Text>
|
|
491
|
-
</View>
|
|
492
|
-
)}
|
|
493
|
-
|
|
494
|
-
{renderErrorDetails()}
|
|
495
|
-
|
|
496
|
-
{isTrainingComplete && trainingResults && (
|
|
497
|
-
<View style={styles.resultsContainer}>
|
|
498
|
-
<Icon name="check-circle" size={32} color="#4CAF50" />
|
|
499
|
-
<Text style={styles.resultsTitle}>Training Complete!</Text>
|
|
500
|
-
<View style={styles.resultsDetails}>
|
|
501
|
-
<View style={styles.resultItem}>
|
|
502
|
-
<Icon name="cloud-done" size={16} color="#666" />
|
|
503
|
-
<Text style={styles.resultText}>Storage: {trainingResults.storage}</Text>
|
|
504
|
-
</View>
|
|
505
|
-
<View style={styles.resultItem}>
|
|
506
|
-
<Icon name="security" size={16} color="#666" />
|
|
507
|
-
<Text style={styles.resultText}>Encrypted: {trainingResults.encryption ? 'Yes' : 'No'}</Text>
|
|
508
|
-
</View>
|
|
509
|
-
{trainingResults.inference && (
|
|
510
|
-
<View style={styles.resultItem}>
|
|
511
|
-
<Icon name="psychology" size={16} color="#666" />
|
|
512
|
-
<Text style={styles.resultText}>Inference: Completed</Text>
|
|
513
|
-
</View>
|
|
514
|
-
)}
|
|
515
|
-
</View>
|
|
516
|
-
</View>
|
|
517
|
-
)}
|
|
518
|
-
|
|
519
|
-
<View style={styles.footer}>
|
|
520
|
-
<TouchableOpacity
|
|
521
|
-
style={styles.cancelButton}
|
|
522
|
-
onPress={onCancel}
|
|
523
|
-
>
|
|
524
|
-
<Text style={styles.cancelButtonText}>Cancel</Text>
|
|
525
|
-
</TouchableOpacity>
|
|
526
|
-
|
|
527
|
-
{(currentProgress >= 1 || isTrainingComplete) && (
|
|
528
|
-
<TouchableOpacity
|
|
529
|
-
style={styles.completeButton}
|
|
530
|
-
onPress={onComplete}
|
|
531
|
-
>
|
|
532
|
-
<Text style={styles.completeButtonText}>Complete</Text>
|
|
533
|
-
</TouchableOpacity>
|
|
534
|
-
)}
|
|
535
|
-
</View>
|
|
536
|
-
</View>
|
|
537
|
-
</SafeAreaView>
|
|
538
|
-
</View>
|
|
539
|
-
</TouchableWithoutFeedback>
|
|
540
|
-
</View>
|
|
541
|
-
</TouchableWithoutFeedback>
|
|
542
|
-
</Modal>
|
|
543
|
-
);
|
|
544
|
-
};
|
|
545
|
-
|
|
546
|
-
const styles = StyleSheet.create({
|
|
547
|
-
modalOverlay: {
|
|
548
|
-
flex: 1,
|
|
549
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
550
|
-
justifyContent: 'flex-end',
|
|
551
|
-
alignItems: 'center',
|
|
552
|
-
},
|
|
553
|
-
bottomSheet: {
|
|
554
|
-
backgroundColor: '#fff',
|
|
555
|
-
width: width,
|
|
556
|
-
height: height * 0.8,
|
|
557
|
-
borderTopLeftRadius: 24,
|
|
558
|
-
borderTopRightRadius: 24,
|
|
559
|
-
overflow: 'hidden',
|
|
560
|
-
},
|
|
561
|
-
handleContainer: {
|
|
562
|
-
width: '100%',
|
|
563
|
-
alignItems: 'center',
|
|
564
|
-
paddingTop: 12,
|
|
565
|
-
paddingBottom: 8,
|
|
566
|
-
},
|
|
567
|
-
handle: {
|
|
568
|
-
width: 40,
|
|
569
|
-
height: 5,
|
|
570
|
-
borderRadius: 3,
|
|
571
|
-
backgroundColor: '#E0E0E0',
|
|
572
|
-
},
|
|
573
|
-
container: {
|
|
574
|
-
flex: 1,
|
|
575
|
-
backgroundColor: '#fff',
|
|
576
|
-
},
|
|
577
|
-
content: {
|
|
578
|
-
flex: 1,
|
|
579
|
-
width: '100%',
|
|
580
|
-
alignItems: 'center',
|
|
581
|
-
justifyContent: 'center',
|
|
582
|
-
padding: 24,
|
|
583
|
-
},
|
|
584
|
-
title: {
|
|
585
|
-
fontSize: 24,
|
|
586
|
-
fontWeight: '600',
|
|
587
|
-
marginTop: 24,
|
|
588
|
-
marginBottom: 8,
|
|
589
|
-
color: COLORS.text.primary,
|
|
590
|
-
textAlign: 'center',
|
|
591
|
-
},
|
|
592
|
-
subtitle: {
|
|
593
|
-
fontSize: 16,
|
|
594
|
-
color: COLORS.text.secondary,
|
|
595
|
-
textAlign: 'center',
|
|
596
|
-
marginBottom: 32,
|
|
597
|
-
},
|
|
598
|
-
statusText: {
|
|
599
|
-
fontSize: 14,
|
|
600
|
-
color: COLORS.text.secondary,
|
|
601
|
-
marginBottom: 24,
|
|
602
|
-
textAlign: 'center',
|
|
603
|
-
},
|
|
604
|
-
progressContainer: {
|
|
605
|
-
width: '100%',
|
|
606
|
-
marginBottom: 16,
|
|
607
|
-
},
|
|
608
|
-
progressBar: {
|
|
609
|
-
height: 8,
|
|
610
|
-
backgroundColor: COLORS.border,
|
|
611
|
-
borderRadius: 4,
|
|
612
|
-
overflow: 'hidden',
|
|
613
|
-
},
|
|
614
|
-
progressFill: {
|
|
615
|
-
height: '100%',
|
|
616
|
-
backgroundColor: COLORS.primary,
|
|
617
|
-
borderRadius: 4,
|
|
618
|
-
},
|
|
619
|
-
progressText: {
|
|
620
|
-
fontSize: 14,
|
|
621
|
-
color: COLORS.text.secondary,
|
|
622
|
-
textAlign: 'center',
|
|
623
|
-
marginTop: 8,
|
|
624
|
-
},
|
|
625
|
-
etaText: {
|
|
626
|
-
fontSize: 14,
|
|
627
|
-
color: COLORS.text.secondary,
|
|
628
|
-
marginBottom: 24,
|
|
629
|
-
},
|
|
630
|
-
loadingContainer: {
|
|
631
|
-
flexDirection: 'row',
|
|
632
|
-
alignItems: 'center',
|
|
633
|
-
marginBottom: 32,
|
|
634
|
-
},
|
|
635
|
-
loadingText: {
|
|
636
|
-
fontSize: 14,
|
|
637
|
-
color: COLORS.text.secondary,
|
|
638
|
-
marginLeft: 8,
|
|
639
|
-
},
|
|
640
|
-
footer: {
|
|
641
|
-
flexDirection: 'row',
|
|
642
|
-
alignItems: 'center',
|
|
643
|
-
justifyContent: 'space-between',
|
|
644
|
-
width: '100%',
|
|
645
|
-
borderTopWidth: 1,
|
|
646
|
-
borderTopColor: '#eee',
|
|
647
|
-
paddingTop: 16,
|
|
648
|
-
paddingHorizontal: 24,
|
|
649
|
-
paddingBottom: 24,
|
|
650
|
-
},
|
|
651
|
-
cancelButton: {
|
|
652
|
-
paddingVertical: 8,
|
|
653
|
-
paddingHorizontal: 16,
|
|
654
|
-
},
|
|
655
|
-
cancelButtonText: {
|
|
656
|
-
fontSize: 16,
|
|
657
|
-
color: '#666',
|
|
658
|
-
},
|
|
659
|
-
completeButton: {
|
|
660
|
-
paddingVertical: 16,
|
|
661
|
-
paddingHorizontal: 32,
|
|
662
|
-
borderRadius: 16,
|
|
663
|
-
backgroundColor: '#fff',
|
|
664
|
-
borderWidth: 1,
|
|
665
|
-
borderColor: '#000',
|
|
666
|
-
},
|
|
667
|
-
completeButtonText: {
|
|
668
|
-
fontSize: 16,
|
|
669
|
-
fontWeight: '600',
|
|
670
|
-
color: '#000',
|
|
671
|
-
},
|
|
672
|
-
onairosLogo: {
|
|
673
|
-
width: 48,
|
|
674
|
-
height: 48,
|
|
675
|
-
},
|
|
676
|
-
errorContainer: {
|
|
677
|
-
flexDirection: 'row',
|
|
678
|
-
alignItems: 'center',
|
|
679
|
-
marginBottom: 16,
|
|
680
|
-
},
|
|
681
|
-
errorText: {
|
|
682
|
-
fontSize: 14,
|
|
683
|
-
color: '#FF6B6B',
|
|
684
|
-
marginLeft: 8,
|
|
685
|
-
},
|
|
686
|
-
errorDetailsContainer: {
|
|
687
|
-
alignItems: 'center',
|
|
688
|
-
marginBottom: 24,
|
|
689
|
-
padding: 16,
|
|
690
|
-
backgroundColor: '#FFF5F5',
|
|
691
|
-
borderRadius: 12,
|
|
692
|
-
borderWidth: 1,
|
|
693
|
-
borderColor: '#FFEBEE',
|
|
694
|
-
},
|
|
695
|
-
errorTitle: {
|
|
696
|
-
fontSize: 16,
|
|
697
|
-
fontWeight: '600',
|
|
698
|
-
color: '#FF6B6B',
|
|
699
|
-
marginTop: 8,
|
|
700
|
-
marginBottom: 4,
|
|
701
|
-
},
|
|
702
|
-
errorDescription: {
|
|
703
|
-
fontSize: 14,
|
|
704
|
-
color: '#666',
|
|
705
|
-
textAlign: 'center',
|
|
706
|
-
},
|
|
707
|
-
resultsContainer: {
|
|
708
|
-
alignItems: 'center',
|
|
709
|
-
marginBottom: 24,
|
|
710
|
-
padding: 16,
|
|
711
|
-
backgroundColor: '#F5F5F5',
|
|
712
|
-
borderRadius: 12,
|
|
713
|
-
borderWidth: 1,
|
|
714
|
-
borderColor: '#E0E0E0',
|
|
715
|
-
},
|
|
716
|
-
resultsTitle: {
|
|
717
|
-
fontSize: 16,
|
|
718
|
-
fontWeight: '600',
|
|
719
|
-
color: '#4CAF50',
|
|
720
|
-
marginTop: 8,
|
|
721
|
-
marginBottom: 12,
|
|
722
|
-
},
|
|
723
|
-
resultsDetails: {
|
|
724
|
-
alignItems: 'flex-start',
|
|
725
|
-
width: '100%',
|
|
726
|
-
},
|
|
727
|
-
resultItem: {
|
|
728
|
-
flexDirection: 'row',
|
|
729
|
-
alignItems: 'center',
|
|
730
|
-
marginBottom: 4,
|
|
731
|
-
},
|
|
732
|
-
resultText: {
|
|
733
|
-
fontSize: 14,
|
|
734
|
-
color: '#666',
|
|
735
|
-
marginLeft: 8,
|
|
736
|
-
},
|
|
737
|
-
});
|