@onairos/react-native 3.7.1 → 3.7.3
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/lib/commonjs/api/index.js +219 -9
- package/lib/commonjs/assets/icons/spotify.png +0 -0
- package/lib/commonjs/assets/images/spotify.png +0 -0
- package/lib/commonjs/components/BodyText.js +27 -9
- package/lib/commonjs/components/BrandMark.js +111 -10
- package/lib/commonjs/components/CodeInput.js +116 -9
- package/lib/commonjs/components/EmailInput.js +30 -8
- package/lib/commonjs/components/GoogleButton.js +56 -9
- package/lib/commonjs/components/HeadingGroup.js +43 -9
- package/lib/commonjs/components/LLMDataInputModal.js +664 -14
- package/lib/commonjs/components/ModalHeader.js +99 -9
- package/lib/commonjs/components/ModalSheet.js +47 -9
- package/lib/commonjs/components/Onairos.js +380 -14
- package/lib/commonjs/components/OnairosButton.js +313 -13
- package/lib/commonjs/components/OnairosSignInButton.js +130 -12
- package/lib/commonjs/components/Overlay.js +465 -13
- package/lib/commonjs/components/PersonaImage.js +137 -10
- package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
- package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
- package/lib/commonjs/components/PinCreationScreen.js +403 -12
- package/lib/commonjs/components/PinInput.js +464 -9
- package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
- package/lib/commonjs/components/PlatformList.js +137 -10
- package/lib/commonjs/components/PlatformToggle.js +180 -9
- package/lib/commonjs/components/PrimaryButton.js +180 -10
- package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
- package/lib/commonjs/components/SignInStep.js +345 -12
- package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
- package/lib/commonjs/components/VerificationStep.js +176 -11
- package/lib/commonjs/components/WelcomeScreen.js +461 -22
- package/lib/commonjs/components/icons/Basicproficon.js +37 -8
- package/lib/commonjs/components/icons/Basicprofile.js +21 -8
- package/lib/commonjs/components/icons/Checkbox.js +21 -8
- package/lib/commonjs/components/icons/Checkmark.js +27 -8
- package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
- package/lib/commonjs/components/icons/Contenticon.js +39 -8
- package/lib/commonjs/components/icons/EnochE.js +41 -8
- package/lib/commonjs/components/icons/Personalityicon.js +30 -8
- package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
- package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
- package/lib/commonjs/components/icons/Userpreferences.js +21 -8
- package/lib/commonjs/components/icons/index.js +84 -17
- package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
- package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
- package/lib/commonjs/components/onboarding/PinInput.js +283 -10
- package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
- package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
- package/lib/commonjs/config/api.js +56 -7
- package/lib/commonjs/constants/index.js +120 -7
- package/lib/commonjs/context/AuthContext.js +345 -10
- package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
- package/lib/commonjs/hooks/useConnections.js +102 -8
- package/lib/commonjs/hooks/useCredentials.js +178 -10
- package/lib/commonjs/hooks/useUserConnections.js +148 -10
- package/lib/commonjs/index.js +439 -34
- package/lib/commonjs/services/apiClient.js +298 -8
- package/lib/commonjs/services/biometricPinService.js +180 -8
- package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
- package/lib/commonjs/services/chatGPTConversationService.js +275 -9
- package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
- package/lib/commonjs/services/claudeConversationService.js +158 -9
- package/lib/commonjs/services/connectedAccountsService.js +310 -10
- package/lib/commonjs/services/googleAuthService.js +252 -11
- package/lib/commonjs/services/hingeDataExtractor.js +105 -8
- package/lib/commonjs/services/hingeDataService.js +150 -9
- package/lib/commonjs/services/imageCompressionService.js +260 -7
- package/lib/commonjs/services/instagramDataExtractor.js +126 -8
- package/lib/commonjs/services/instagramDataService.js +163 -9
- package/lib/commonjs/services/jwtStorageService.js +276 -7
- package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
- package/lib/commonjs/services/linkedinProfileService.js +222 -9
- package/lib/commonjs/services/linkedinScrapingService.js +230 -8
- package/lib/commonjs/services/llmDataStorage.js +294 -8
- package/lib/commonjs/services/mobileTrainingService.js +186 -8
- package/lib/commonjs/services/netflixDataExtractor.js +120 -8
- package/lib/commonjs/services/netflixDataService.js +198 -9
- package/lib/commonjs/services/pinEncryptionService.js +84 -8
- package/lib/commonjs/services/pinStorageUtils.js +105 -7
- package/lib/commonjs/services/platformAuthService.js +1484 -12
- package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
- package/lib/commonjs/services/sephoraDataService.js +200 -9
- package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
- package/lib/commonjs/services/spotifyDataService.js +241 -9
- package/lib/commonjs/services/storageService.js +404 -8
- package/lib/commonjs/services/telegramDataExtractor.js +115 -8
- package/lib/commonjs/services/telegramDataService.js +499 -9
- package/lib/commonjs/services/trainingApiHelpers.js +73 -7
- package/lib/commonjs/services/userConnectionsService.js +340 -10
- package/lib/commonjs/services/youtubeMigrationService.js +416 -10
- package/lib/commonjs/theme/index.js +250 -7
- package/lib/commonjs/types/ambient.d.js +2 -1
- package/lib/commonjs/types/declarations.d.js +2 -1
- package/lib/commonjs/types/index.js +6 -1
- package/lib/commonjs/types/node-fix.d.js +2 -1
- package/lib/commonjs/types/node-override.d.js +2 -1
- package/lib/commonjs/types/opacity.d.js +2 -1
- package/lib/commonjs/types.js +14 -1
- package/lib/commonjs/utils/Portal.js +98 -8
- package/lib/commonjs/utils/api.js +130 -9
- package/lib/commonjs/utils/assetRegistry.js +210 -35
- package/lib/commonjs/utils/auth.js +112 -9
- package/lib/commonjs/utils/connectorTests.js +613 -29
- package/lib/commonjs/utils/crypto.js +62 -8
- package/lib/commonjs/utils/debugHelper.js +64 -1
- package/lib/commonjs/utils/encryption.js +76 -7
- package/lib/commonjs/utils/eventUtils.js +288 -1
- package/lib/commonjs/utils/haptics.js +66 -9
- package/lib/commonjs/utils/imagePreloader.js +6 -1
- package/lib/commonjs/utils/networkDiagnostics.js +226 -8
- package/lib/commonjs/utils/onairosApi.js +350 -9
- package/lib/commonjs/utils/programmaticFlow.js +117 -9
- package/lib/commonjs/utils/retryHelper.js +220 -1
- package/lib/commonjs/utils/secureStorage.js +349 -10
- package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
- package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
- package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
- package/lib/commonjs/utils/webviewScripts/index.js +698 -15
- package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
- package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
- package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
- package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
- package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
- package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
- package/lib/module/api/index.js +211 -1
- package/lib/module/assets/icons/spotify.png +0 -0
- package/lib/module/assets/images/spotify.png +0 -0
- package/lib/module/components/BodyText.js +20 -1
- package/lib/module/components/BrandMark.js +104 -1
- package/lib/module/components/CodeInput.js +109 -1
- package/lib/module/components/EmailInput.js +23 -1
- package/lib/module/components/GoogleButton.js +49 -1
- package/lib/module/components/HeadingGroup.js +36 -1
- package/lib/module/components/LLMDataInputModal.js +656 -7
- package/lib/module/components/ModalHeader.js +92 -1
- package/lib/module/components/ModalSheet.js +39 -1
- package/lib/module/components/Onairos.js +373 -1
- package/lib/module/components/OnairosButton.js +305 -1
- package/lib/module/components/OnairosSignInButton.js +121 -1
- package/lib/module/components/Overlay.js +456 -1
- package/lib/module/components/PersonaImage.js +129 -1
- package/lib/module/components/PersonaLoadingScreen.js +310 -1
- package/lib/module/components/PersonalizationConsentScreen.js +460 -1
- package/lib/module/components/PinCreationScreen.js +396 -1
- package/lib/module/components/PinInput.js +456 -1
- package/lib/module/components/PlatformConnectorsStep.js +1302 -6
- package/lib/module/components/PlatformList.js +129 -1
- package/lib/module/components/PlatformToggle.js +173 -1
- package/lib/module/components/PrimaryButton.js +172 -1
- package/lib/module/components/SignInMatchAnimation.js +189 -1
- package/lib/module/components/SignInStep.js +338 -1
- package/lib/module/components/UniversalOnboarding.js +2770 -1
- package/lib/module/components/VerificationStep.js +168 -1
- package/lib/module/components/WelcomeScreen.js +453 -1
- package/lib/module/components/icons/Basicproficon.js +30 -1
- package/lib/module/components/icons/Basicprofile.js +14 -1
- package/lib/module/components/icons/Checkbox.js +14 -1
- package/lib/module/components/icons/Checkmark.js +20 -1
- package/lib/module/components/icons/Contentanalysis.js +14 -1
- package/lib/module/components/icons/Contenticon.js +32 -1
- package/lib/module/components/icons/EnochE.js +34 -1
- package/lib/module/components/icons/Personalityicon.js +23 -1
- package/lib/module/components/icons/Personalityprofile.js +14 -1
- package/lib/module/components/icons/Personalitytraits.js +14 -1
- package/lib/module/components/icons/Userpreferences.js +14 -1
- package/lib/module/components/icons/index.js +13 -1
- package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
- package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
- package/lib/module/components/onboarding/PinInput.js +274 -1
- package/lib/module/components/onboarding/PlatformConnector.js +240 -1
- package/lib/module/config/PLATFORM_APIS.md +849 -0
- package/lib/module/config/api.js +47 -1
- package/lib/module/constants/index.js +114 -1
- package/lib/module/context/AuthContext.js +335 -1
- package/lib/module/hooks/useConnectedAccounts.js +106 -1
- package/lib/module/hooks/useConnections.js +95 -1
- package/lib/module/hooks/useCredentials.js +171 -6
- package/lib/module/hooks/useUserConnections.js +140 -1
- package/lib/module/index.js +172 -1
- package/lib/module/services/apiClient.js +295 -1
- package/lib/module/services/biometricPinService.js +169 -1
- package/lib/module/services/chatGPTConversationExtractor.js +149 -1
- package/lib/module/services/chatGPTConversationService.js +268 -1
- package/lib/module/services/claudeConversationExtractor.js +97 -1
- package/lib/module/services/claudeConversationService.js +151 -1
- package/lib/module/services/connectedAccountsService.js +293 -1
- package/lib/module/services/googleAuthService.js +241 -1
- package/lib/module/services/hingeDataExtractor.js +99 -1
- package/lib/module/services/hingeDataService.js +143 -1
- package/lib/module/services/imageCompressionService.js +250 -1
- package/lib/module/services/instagramDataExtractor.js +120 -1
- package/lib/module/services/instagramDataService.js +156 -1
- package/lib/module/services/jwtStorageService.js +257 -1
- package/lib/module/services/linkedinDOMExtractor.js +234 -1
- package/lib/module/services/linkedinProfileService.js +210 -1
- package/lib/module/services/linkedinScrapingService.js +219 -1
- package/lib/module/services/llmDataStorage.js +277 -1
- package/lib/module/services/mobileTrainingService.js +173 -1
- package/lib/module/services/netflixDataExtractor.js +114 -1
- package/lib/module/services/netflixDataService.js +191 -1
- package/lib/module/services/pinEncryptionService.js +74 -6
- package/lib/module/services/pinStorageUtils.js +93 -1
- package/lib/module/services/platformAuthService.js +1461 -1
- package/lib/module/services/sephoraDataExtractor.js +134 -1
- package/lib/module/services/sephoraDataService.js +193 -1
- package/lib/module/services/spotifyDataExtractor.js +142 -1
- package/lib/module/services/spotifyDataService.js +234 -1
- package/lib/module/services/storageService.js +383 -1
- package/lib/module/services/telegramDataExtractor.js +109 -1
- package/lib/module/services/telegramDataService.js +493 -1
- package/lib/module/services/trainingApiHelpers.js +67 -1
- package/lib/module/services/userConnectionsService.js +329 -1
- package/lib/module/services/youtubeMigrationService.js +405 -1
- package/lib/module/theme/index.js +245 -1
- package/lib/module/types.js +10 -1
- package/lib/module/utils/Portal.js +90 -1
- package/lib/module/utils/api.js +118 -1
- package/lib/module/utils/assetRegistry.js +200 -34
- package/lib/module/utils/auth.js +100 -1
- package/lib/module/utils/connectorTests.js +600 -27
- package/lib/module/utils/crypto.js +54 -1
- package/lib/module/utils/debugHelper.js +54 -1
- package/lib/module/utils/encryption.js +67 -1
- package/lib/module/utils/eventUtils.js +270 -1
- package/lib/module/utils/haptics.js +59 -8
- package/lib/module/utils/imagePreloader.js +3 -1
- package/lib/module/utils/networkDiagnostics.js +217 -1
- package/lib/module/utils/onairosApi.js +333 -1
- package/lib/module/utils/programmaticFlow.js +111 -1
- package/lib/module/utils/retryHelper.js +211 -1
- package/lib/module/utils/secureStorage.js +330 -6
- package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
- package/lib/module/utils/webviewScripts/claude.js +370 -1
- package/lib/module/utils/webviewScripts/hinge.js +405 -1
- package/lib/module/utils/webviewScripts/index.js +434 -1
- package/lib/module/utils/webviewScripts/instagram.js +448 -1
- package/lib/module/utils/webviewScripts/linkedin.js +874 -1
- package/lib/module/utils/webviewScripts/netflix.js +376 -1
- package/lib/module/utils/webviewScripts/sephora.js +510 -1
- package/lib/module/utils/webviewScripts/spotify.js +413 -1
- package/lib/module/utils/webviewScripts/telegram.js +672 -1
- package/package.json +2 -2
|
@@ -1 +1,456 @@
|
|
|
1
|
-
import React,{useState,useCallback}from'react';import{View,Text,StyleSheet,TextInput,TouchableOpacity,Dimensions,Keyboard,ActivityIndicator}from'react-native';import{biometricPinService}from'../services/biometricPinService';const {width}=Dimensions[_0x2072(0x0)](_0x2072(0x1));export const PinInput=({onSubmit:_0x52761e,minLength:minLength=0x8,requireSpecialChar:requireSpecialChar=!![],requireNumber:requireNumber=!![],onBack:_0x24e093,enableBiometricStorage:enableBiometricStorage=!![],onBackgroundTrainingStart:_0x3efd82,showBackgroundProgress:showBackgroundProgress=![],backgroundProgressText:backgroundProgressText='Training\x20is\x20starting\x20in\x20the\x20background...'})=>{const _0x25a7a1={'JUIUq':function(_0x164793,_0x1ca9f4){return _0x164793(_0x1ca9f4);},'sYfRs':function(_0x896e45,_0x4638b5){return _0x896e45(_0x4638b5);},'LEPCx':function(_0x25fd97){return _0x25fd97();},'twxQH':_0x2072(0x2),'CGBgH':_0x2072(0x3),'gOWOk':_0x2072(0x4),'lULiY':_0x2072(0x5),'dwJze':_0x2072(0x6),'jZssE':_0x2072(0x7),'qMcgi':_0x2072(0x8),'lLbGU':_0x2072(0x9),'brbMV':_0x2072(0xa),'qEkQw':_0x2072(0xb),'WBpfo':'info','ZEGax':function(_0x139b0d,_0x303274){return _0x139b0d<_0x303274;},'NKEXD':_0x2072(0xc),'JqAzG':function(_0x3f2a43,_0x14991e){return _0x3f2a43===_0x14991e;},'nNjuN':_0x2072(0xd),'bkkah':_0x2072(0xe),'fooZl':'PIN\x20must\x20include\x20a\x20number','fPTCz':function(_0xf222ed,_0x40285f){return _0xf222ed(_0x40285f);},'cIbeL':_0x2072(0xf),'psRqq':function(_0x35653f,_0x46498a){return _0x35653f(_0x46498a);},'LfNnP':function(_0x587f9f,_0x10a88d){return _0x587f9f(_0x10a88d);},'pvMXq':function(_0x244a20,_0xa8cec4){return _0x244a20(_0xa8cec4);},'nRpaq':function(_0x204259,_0x408fd3){return _0x204259(_0x408fd3);},'anpvU':function(_0x221ada,_0x33b824){return _0x221ada!==_0x33b824;},'NQKKn':_0x2072(0x10),'KCyuM':function(_0x26609e,_0x15045b){return _0x26609e(_0x15045b);},'gzSjr':function(_0x3e8c0a,_0x2b18d9){return _0x3e8c0a(_0x2b18d9);},'nsibH':function(_0x4340e5,_0x55f0b0){return _0x4340e5(_0x55f0b0);},'iexNF':_0x2072(0x11),'oLsie':_0x2072(0x12),'GJKBi':_0x2072(0x13),'lpgrv':function(_0x39387c,_0x2897b7){return _0x39387c(_0x2897b7);},'izJjp':function(_0xb5837d,_0x55d150){return _0xb5837d(_0x55d150);},'NDZKh':function(_0x2c5ad3,_0x37ad25){return _0x2c5ad3(_0x37ad25);},'gLdkA':_0x2072(0x14),'DSgXt':function(_0x223ff6,_0x4d015e){return _0x223ff6(_0x4d015e);},'wttXy':_0x2072(0x15),'YmGFC':function(_0x3fae82,_0x3ebf19){return _0x3fae82(_0x3ebf19);},'Wcyxr':function(_0x4f6965,_0x3b9297){return _0x4f6965!==_0x3b9297;},'xxkfD':'XAAkI','sInwC':function(_0x5e50c3){return _0x5e50c3();},'IHzvt':'Secure\x20PIN\x20Storage','OWfeY':function(_0x339833,_0x442669){return _0x339833(_0x442669);},'XsdLL':function(_0x1e5bb8,_0x1acd01){return _0x1e5bb8(_0x1acd01);},'IJSzJ':function(_0x31e300,_0x799d99){return _0x31e300(_0x799d99);},'Xcibz':function(_0x14ec65,_0x1c239f){return _0x14ec65(_0x1c239f);},'LoUEY':function(_0x5a6593,_0x11f62d,_0x3e5159){return _0x5a6593(_0x11f62d,_0x3e5159);},'HdDle':function(_0x35023a,_0x240033,_0x53c872){return _0x35023a(_0x240033,_0x53c872);},'HeMWt':function(_0xabb31){return _0xabb31();},'DBTtA':_0x2072(0x16),'qmCPU':function(_0x4a1883,_0x35f1a3){return _0x4a1883&&_0x35f1a3;},'xAQSL':_0x2072(0x17),'WvMHJ':_0x2072(0x18),'iwOhN':'none','dJgKu':_0x2072(0x19),'JQCGo':_0x2072(0x1a),'pRyrK':_0x2072(0x1b),'emTqu':function(_0x2316ed,_0x13266a){return _0x2316ed>=_0x13266a;},'sPvFL':_0x2072(0x1c),'zXuBx':'\x20characters','StITU':_0x2072(0x1d),'jsZoT':_0x2072(0x1e),'meHii':function(_0x3d402c,_0x35a808){return _0x3d402c===_0x35a808;},'hSdWQ':function(_0x5874c6,_0x4581ea){return _0x5874c6===_0x4581ea;},'rDkfd':'Try\x20Again','lhZUC':function(_0x508dda,_0x73c370){return _0x508dda||_0x73c370;},'sMFaR':function(_0x24a669,_0x4c35ef){return _0x24a669(_0x4c35ef);},'BfGpd':_0x2072(0x1f)},[_0x14b38c,_0x17f4cf]=_0x25a7a1['OWfeY'](useState,''),[_0x12d6b0,_0x323106]=_0x25a7a1[_0x2072(0x20)](useState,null),[_0x1e7ab6,_0x339c3c]=_0x25a7a1[_0x2072(0x21)](useState,![]),[_0x4f689b,_0xca3e8e]=_0x25a7a1[_0x2072(0x22)](useState,![]),[_0x5679e4,_0x19057b]=_0x25a7a1[_0x2072(0x23)](useState,_0x25a7a1['wttXy']),[_0x2d291e,_0x5810a1]=_0x25a7a1[_0x2072(0x24)](useState,![]);React[_0x2072(0x25)](()=>{_0x3efd82&&!_0x2d291e&&showBackgroundProgress&&(console[_0x2072(0x26)]('\uD83D\uDE80 [PIN INPUT] Background training explicitly requested...'),_0x25a7a1[_0x2072(0x22)](_0x5810a1,!![]),_0x25a7a1['LEPCx'](_0x3efd82)['catch'](_0x349c41=>{console[_0x2072(0x9)]('\u274C [PIN INPUT] Background training failed:',_0x349c41),_0x25a7a1[_0x2072(0x27)](_0x5810a1,![]);}));},[_0x3efd82,_0x2d291e,showBackgroundProgress]);const _0x1d6205=_0x25a7a1['LoUEY'](useCallback,_0x3d9495=>{if(_0x25a7a1[_0x2072(0x28)](_0x3d9495['length'],minLength))return _0x2072(0x29)+minLength+_0x2072(0x2a);if(requireSpecialChar&&!/[!@#$%^&*(),.?":{}|<>]/[_0x2072(0x2b)](_0x3d9495))return _0x25a7a1[_0x2072(0x2c)];if(requireNumber&&!/\d/[_0x2072(0x2b)](_0x3d9495)){if(_0x25a7a1[_0x2072(0x2d)](_0x25a7a1['nNjuN'],_0x25a7a1[_0x2072(0x2e)]))switch(_0x590315){case _0x2072(0xf):return{'title':_0x25a7a1[_0x2072(0x2f)],'message':_0x25a7a1['CGBgH'],'type':_0x25a7a1[_0x2072(0x30)],'showActions':!![]};case _0x25a7a1[_0x2072(0x31)]:return{'title':_0x2072(0x32),'message':_0x25a7a1[_0x2072(0x33)],'type':_0x25a7a1[_0x2072(0x30)],'showActions':!![]};case _0x2072(0x13):return{'title':_0x25a7a1[_0x2072(0x34)],'message':_0x25a7a1[_0x2072(0x35)],'type':_0x25a7a1[_0x2072(0x36)],'showActions':!![]};case _0x2072(0x37):return{'title':_0x25a7a1[_0x2072(0x38)],'message':_0x25a7a1[_0x2072(0x39)],'type':_0x25a7a1[_0x2072(0x3a)],'showActions':![]};default:return{'title':_0x2072(0x3b),'message':_0x2072(0x3c),'type':_0x2072(0x3d),'showActions':![]};}else return _0x25a7a1[_0x2072(0x3e)];}return null;},[minLength,requireSpecialChar,requireNumber]),_0x31ba94=_0x25a7a1[_0x2072(0x3f)](useCallback,async()=>{const _0x153256={'kbsIw':function(_0x4b0dce,_0x496a15){return _0x25a7a1[_0x2072(0x40)](_0x4b0dce,_0x496a15);}};console[_0x2072(0x26)]('\uD83D\uDD0D [PIN INPUT] handleSubmit called with PIN length:',_0x14b38c[_0x2072(0x41)]);const _0x4ab1e5=_0x25a7a1[_0x2072(0x42)](_0x1d6205,_0x14b38c);if(_0x4ab1e5){if(_0x25a7a1['anpvU'](_0x2072(0x43),_0x25a7a1[_0x2072(0x44)])){console[_0x2072(0x26)]('\u274C [PIN INPUT] Validation failed:',_0x4ab1e5),_0x25a7a1['KCyuM'](_0x323106,_0x4ab1e5);return;}else{_0xea572a['error']('\u274C [PIN INPUT] Face ID not available on this device'),_0x25a7a1[_0x2072(0x42)](_0x11abce,_0x25a7a1[_0x2072(0x45)]),_0x25a7a1[_0x2072(0x46)](_0x48ac12,![]);return;}}console[_0x2072(0x26)]('\u2705 [PIN INPUT] PIN validation passed');if(enableBiometricStorage){console[_0x2072(0x26)]('\uD83D\uDD10 [PIN INPUT] Biometric storage enabled, starting biometric flow...'),_0x25a7a1[_0x2072(0x47)](_0xca3e8e,!![]),_0x25a7a1[_0x2072(0x48)](_0x19057b,_0x2072(0x37));try{if(_0x25a7a1[_0x2072(0x2d)]('SgqNk',_0x25a7a1[_0x2072(0x49)]))_0x2c4ac6[_0x2072(0x26)]('\uD83D\uDD10 [PIN INPUT] Biometric storage disabled, proceeding normally'),_0x25a7a1[_0x2072(0x4a)](_0x43bf95,_0x2343c7);else{const _0x19a662=await biometricPinService[_0x2072(0x4b)]();console['log']('\uD83D\uDCF1 [PIN INPUT] Biometric available:',_0x19a662);if(!_0x19a662){if(_0x25a7a1[_0x2072(0x4c)](_0x25a7a1[_0x2072(0x4d)],_0x25a7a1['oLsie']))_0x2be5d1[_0x2072(0x26)]('\u2705 [PIN INPUT] PIN storage verified - proceeding with onboarding'),_0x25a7a1[_0x2072(0x4e)](_0x1f0331,_0x7b8009);else{console['error']('\u274C [PIN INPUT] Face ID not available on this device'),_0x19057b(_0x25a7a1['cIbeL']),_0x25a7a1['sYfRs'](_0xca3e8e,![]);return;}}console['log']('\uD83D\uDD10 [PIN INPUT] Triggering biometric authentication for PIN storage...');const _0x3b4122=await biometricPinService['storePinWithBiometric'](_0x14b38c);if(_0x3b4122){console[_0x2072(0x26)]('\u2705 [PIN INPUT] PIN stored successfully with biometric protection');const _0x3a6c24=await biometricPinService[_0x2072(0x4f)]();_0x3a6c24?_0x2072(0x50)!=='SiiIj'?(console['log']('\u2705 [PIN INPUT] PIN storage verified - proceeding with onboarding'),_0x52761e(_0x14b38c)):(_0x100b7e[_0x2072(0x51)]('\u26A0️ [PIN INPUT] User chose to continue without biometric security'),_0x153256[_0x2072(0x52)](_0x11f467,_0x1c6d01)):(console['error']('\u274C [PIN INPUT] PIN storage verification failed'),_0x25a7a1[_0x2072(0x4e)](_0x19057b,_0x25a7a1['GJKBi']),_0xca3e8e(![]));}else console['warn']('\u26A0️ [PIN INPUT] Biometric authentication failed or was cancelled'),_0x25a7a1[_0x2072(0x53)](_0x19057b,_0x25a7a1['lULiY']),_0xca3e8e(![]);}}catch(_0x314b61){console['error']('\u274C [PIN INPUT] Error handling biometric PIN storage:',_0x314b61),_0x19057b(_0x25a7a1[_0x2072(0x54)]),_0xca3e8e(![]);}}else console[_0x2072(0x26)]('\uD83D\uDD10 [PIN INPUT] Biometric storage disabled, proceeding normally'),_0x52761e(_0x14b38c);},[_0x14b38c,_0x1d6205,_0x52761e,enableBiometricStorage]),_0x153692=_0x25a7a1[_0x2072(0x3f)](useCallback,_0x497ddd=>{_0x25a7a1[_0x2072(0x55)]===_0x25a7a1[_0x2072(0x55)]?(_0x17f4cf(_0x497ddd),_0x25a7a1[_0x2072(0x56)](_0x323106,null),_0x25a7a1[_0x2072(0x47)](_0x19057b,_0x25a7a1[_0x2072(0x57)]),console[_0x2072(0x26)]('\uD83D\uDD0D [PIN INPUT] PIN changed:',{'length':_0x497ddd[_0x2072(0x41)],'hasSpecialChar':/[!@#$%^&*(),.?":{}|<>]/[_0x2072(0x2b)](_0x497ddd),'hasNumber':/\d/[_0x2072(0x2b)](_0x497ddd),'isValid':!_0x25a7a1[_0x2072(0x56)](_0x1d6205,_0x497ddd)})):(_0x31a8a2[_0x2072(0x9)]('\u274C [PIN INPUT] Error handling biometric PIN storage:',_0xa33305),_0x25a7a1['izJjp'](_0x14030e,_0x25a7a1[_0x2072(0x54)]),_0x25a7a1[_0x2072(0x20)](_0x4d7a1d,![]));},[_0x1d6205]),_0x2ff4db=_0x25a7a1[_0x2072(0x58)](useCallback,()=>{console[_0x2072(0x51)]('\u26A0️ [PIN INPUT] User chose to continue without biometric security'),_0x25a7a1[_0x2072(0x59)](_0x52761e,_0x14b38c);},[_0x14b38c,_0x52761e]),_0x169b7e=_0x25a7a1[_0x2072(0x3f)](useCallback,()=>{if(_0x25a7a1[_0x2072(0x5a)](_0x25a7a1[_0x2072(0x5b)],_0x25a7a1[_0x2072(0x5b)])){_0xa6cb75[_0x2072(0x26)]('\u274C [PIN INPUT] Validation failed:',_0x1f9a7c),_0x25a7a1[_0x2072(0x59)](_0x3460ae,_0x5b0f64);return;}else _0x25a7a1[_0x2072(0x27)](_0x19057b,_0x2072(0x15)),_0x25a7a1[_0x2072(0x5c)](_0x31ba94);},[_0x31ba94]),_0x47c107=()=>{switch(_0x5679e4){case _0x25a7a1[_0x2072(0x45)]:return{'title':_0x25a7a1['twxQH'],'message':_0x25a7a1['CGBgH'],'type':_0x25a7a1['gOWOk'],'showActions':!![]};case _0x2072(0x5):return{'title':_0x2072(0x32),'message':_0x25a7a1[_0x2072(0x33)],'type':_0x25a7a1[_0x2072(0x30)],'showActions':!![]};case'storage-error':return{'title':_0x25a7a1['jZssE'],'message':_0x25a7a1[_0x2072(0x35)],'type':_0x25a7a1['lLbGU'],'showActions':!![]};case _0x2072(0x37):return{'title':_0x25a7a1['brbMV'],'message':_0x25a7a1[_0x2072(0x39)],'type':_0x25a7a1[_0x2072(0x3a)],'showActions':![]};default:return{'title':_0x25a7a1[_0x2072(0x5d)],'message':'Your\x20PIN\x20will\x20be\x20securely\x20stored\x20locally\x20on\x20your\x20device\x20using\x20biometric\x20authentication\x20(Face\x20ID\x20or\x20Touch\x20ID)\x20for\x20enhanced\x20security.','type':_0x25a7a1[_0x2072(0x3a)],'showActions':![]};}},_0x5ce55b=_0x25a7a1[_0x2072(0x5e)](_0x47c107);return React[_0x2072(0x5f)](View,{'style':styles['container']},React[_0x2072(0x5f)](View,{'style':styles[_0x2072(0x60)]},React[_0x2072(0x5f)](View,{'style':styles[_0x2072(0x61)]},_0x24e093&&React[_0x2072(0x5f)](TouchableOpacity,{'style':styles[_0x2072(0x62)],'onPress':_0x24e093},React[_0x2072(0x5f)](Text,{'style':{'fontSize':0x18}},'←')),React[_0x2072(0x5f)](Text,{'style':styles[_0x2072(0x63)]},_0x2072(0x64))),React[_0x2072(0x5f)](Text,{'style':styles[_0x2072(0x65)]},_0x25a7a1[_0x2072(0x66)]),_0x25a7a1[_0x2072(0x67)](showBackgroundProgress,_0x2d291e)&&React['createElement'](View,{'style':styles['backgroundProgressContainer']},React['createElement'](Text,{'style':styles[_0x2072(0x68)]},backgroundProgressText),React[_0x2072(0x5f)](View,{'style':styles[_0x2072(0x69)]},React[_0x2072(0x5f)](ActivityIndicator,{'size':_0x25a7a1['xAQSL'],'color':_0x25a7a1[_0x2072(0x6a)]}))),React[_0x2072(0x5f)](View,{'style':styles['inputContainer']},React[_0x2072(0x5f)](TextInput,{'style':styles[_0x2072(0x6b)],'value':_0x14b38c,'onChangeText':_0x153692,'secureTextEntry':!_0x1e7ab6,'placeholder':'e.g.\x20MyPin123!','keyboardType':_0x25a7a1[_0x2072(0x57)],'maxLength':0x14,'autoCapitalize':_0x25a7a1[_0x2072(0x6c)],'autoCorrect':![],'returnKeyType':_0x25a7a1[_0x2072(0x6d)],'onSubmitEditing':()=>Keyboard[_0x2072(0x6e)]()}),React['createElement'](TouchableOpacity,{'style':styles[_0x2072(0x6f)],'onPress':()=>_0x339c3c(!_0x1e7ab6)},React['createElement'](Text,null,_0x1e7ab6?_0x25a7a1[_0x2072(0x70)]:_0x2072(0x71))))),_0x12d6b0&&React['createElement'](Text,{'style':styles['error']},_0x12d6b0),React[_0x2072(0x5f)](View,{'style':styles[_0x2072(0x72)]},React[_0x2072(0x5f)](Text,{'style':styles[_0x2072(0x73)]},_0x25a7a1[_0x2072(0x74)]),React[_0x2072(0x5f)](Text,{'style':[styles[_0x2072(0x75)],_0x25a7a1['emTqu'](_0x14b38c[_0x2072(0x41)],minLength)&&styles['requirementMet']]},_0x25a7a1[_0x2072(0x76)],minLength,_0x25a7a1[_0x2072(0x77)]),requireSpecialChar&&React[_0x2072(0x5f)](Text,{'style':[styles[_0x2072(0x75)],/[!@#$%^&*(),.?":{}|<>]/[_0x2072(0x2b)](_0x14b38c)&&styles[_0x2072(0x78)]]},_0x25a7a1['StITU']),requireNumber&&React[_0x2072(0x5f)](Text,{'style':[styles[_0x2072(0x75)],/\d/['test'](_0x14b38c)&&styles['requirementMet']]},_0x25a7a1['jsZoT'])),React[_0x2072(0x5f)](View,{'style':[styles[_0x2072(0x79)],_0x25a7a1[_0x2072(0x2d)](_0x5ce55b['type'],_0x2072(0x3d))&&styles['infoContainerInfo'],_0x5ce55b[_0x2072(0x7a)]===_0x25a7a1[_0x2072(0x30)]&&styles['infoContainerWarning'],_0x25a7a1['JqAzG'](_0x5ce55b[_0x2072(0x7a)],_0x25a7a1['lLbGU'])&&styles[_0x2072(0x7b)]]},React[_0x2072(0x5f)](Text,{'style':[styles['infoTitle'],_0x25a7a1[_0x2072(0x2d)](_0x5ce55b[_0x2072(0x7a)],_0x2072(0x3d))&&styles[_0x2072(0x7c)],_0x25a7a1['meHii'](_0x5ce55b[_0x2072(0x7a)],_0x25a7a1[_0x2072(0x30)])&&styles[_0x2072(0x7d)],_0x25a7a1[_0x2072(0x7e)](_0x5ce55b['type'],_0x25a7a1[_0x2072(0x36)])&&styles['infoTitleError']]},_0x5ce55b[_0x2072(0x63)]),React[_0x2072(0x5f)](Text,{'style':[styles[_0x2072(0x7f)],_0x5ce55b[_0x2072(0x7a)]==='info'&&styles['infoMessageInfo'],_0x25a7a1[_0x2072(0x80)](_0x5ce55b[_0x2072(0x7a)],_0x25a7a1[_0x2072(0x30)])&&styles[_0x2072(0x81)],_0x5ce55b[_0x2072(0x7a)]===_0x25a7a1[_0x2072(0x36)]&&styles[_0x2072(0x82)]]},_0x5ce55b[_0x2072(0x83)]),_0x5ce55b['showActions']&&React['createElement'](View,{'style':styles[_0x2072(0x84)]},React[_0x2072(0x5f)](TouchableOpacity,{'style':styles[_0x2072(0x85)],'onPress':_0x169b7e},React[_0x2072(0x5f)](Text,{'style':styles[_0x2072(0x86)]},_0x25a7a1[_0x2072(0x87)])),React['createElement'](TouchableOpacity,{'style':[styles[_0x2072(0x85)],styles[_0x2072(0x88)]],'onPress':_0x2ff4db},React[_0x2072(0x5f)](Text,{'style':[styles['infoActionButtonText'],styles[_0x2072(0x89)]]},_0x2072(0x8a))))),React[_0x2072(0x5f)](View,{'style':styles[_0x2072(0x8b)]},_0x24e093&&React[_0x2072(0x5f)](TouchableOpacity,{'style':styles[_0x2072(0x8c)],'onPress':_0x24e093},React[_0x2072(0x5f)](Text,{'style':styles['cancelButtonText']},'Back')),React[_0x2072(0x5f)](TouchableOpacity,{'style':[styles[_0x2072(0x8d)],(!_0x14b38c||_0x4f689b||_0x1d6205(_0x14b38c))&&styles['submitButtonDisabled']],'onPress':_0x31ba94,'disabled':_0x25a7a1[_0x2072(0x8e)](!_0x14b38c,_0x4f689b)||!!_0x25a7a1['sMFaR'](_0x1d6205,_0x14b38c)},React[_0x2072(0x5f)](Text,{'style':styles[_0x2072(0x8f)]},_0x4f689b?_0x25a7a1[_0x2072(0x38)]:_0x25a7a1[_0x2072(0x90)]))));};function _0x40d2(){const _0x3c537d=['get','window','Biometric\x20Authentication\x20Not\x20Available','This\x20device\x20does\x20not\x20support\x20Face\x20ID\x20or\x20Touch\x20ID.\x20Please\x20enable\x20biometric\x20authentication\x20in\x20your\x20device\x20settings\x20to\x20secure\x20your\x20PIN.','warning','biometric-failed','Biometric\x20authentication\x20was\x20cancelled\x20or\x20failed.\x20Your\x20PIN\x20needs\x20to\x20be\x20secured\x20with\x20biometric\x20authentication\x20to\x20proceed.','Storage\x20Error','An\x20error\x20occurred\x20while\x20securing\x20your\x20PIN.\x20Would\x20you\x20like\x20to\x20try\x20again?','error','Authenticating...','Please\x20complete\x20biometric\x20authentication\x20to\x20secure\x20your\x20PIN.','PIN\x20must\x20include\x20a\x20special\x20character','UrvQe','pgoNg','biometric-unavailable','wOFUc','VTlwU','gtfZI','storage-error','uBpwv','default','A\x20PIN\x20so\x20only\x20you\x20have\x20access\x20to\x20your\x20data','small','#007AFF','done','👁️','PIN\x20Requirements:','•\x20At\x20least\x20','•\x20Include\x20a\x20special\x20character','•\x20Include\x20a\x20number','Continue','NDZKh','XsdLL','sYfRs','IJSzJ','Xcibz','useEffect','log','JUIUq','ZEGax','PIN\x20must\x20be\x20at\x20least\x20','\x20characters','test','NKEXD','JqAzG','bkkah','twxQH','gOWOk','lULiY','Biometric\x20Authentication\x20Failed','dwJze','jZssE','qMcgi','lLbGU','authenticating','brbMV','qEkQw','WBpfo','Secure\x20PIN\x20Storage','Your\x20PIN\x20will\x20be\x20securely\x20stored\x20locally\x20on\x20your\x20device\x20using\x20biometric\x20authentication\x20(Face\x20ID\x20or\x20Touch\x20ID)\x20for\x20enhanced\x20security.','info','fooZl','LoUEY','nRpaq','length','fPTCz','fqqip','NQKKn','cIbeL','psRqq','gzSjr','nsibH','iexNF','LfNnP','isBiometricAvailable','anpvU','oLsie','pvMXq','isPinStored','hasOJ','warn','kbsIw','lpgrv','GJKBi','gLdkA','DSgXt','wttXy','HdDle','YmGFC','Wcyxr','xxkfD','sInwC','IHzvt','HeMWt','createElement','inputSection','header','backButton','title','Create\x20a\x20PIN','subtitle','DBTtA','qmCPU','backgroundProgressText','backgroundProgressIndicator','WvMHJ','input','iwOhN','dJgKu','dismiss','visibilityButton','JQCGo','👁️🗨️','requirements','requirementTitle','pRyrK','requirement','sPvFL','zXuBx','requirementMet','infoContainer','type','infoContainerError','infoTitleInfo','infoTitleWarning','meHii','infoMessage','hSdWQ','infoMessageWarning','infoMessageError','message','infoActions','infoActionButton','infoActionButtonText','rDkfd','infoActionButtonSecondary','infoActionButtonSecondaryText','Continue\x20Without\x20Biometric','footer','cancelButton','submitButton','lhZUC','submitButtonText','BfGpd','row','center','space-between','600','#333','#666','#CCCCCC','#FFEBEE','#F44336','#F57C00','#D32F2F','#1565C0','#C62828','#fff','#FF3B30','#eee'];_0x40d2=function(){return _0x3c537d;};return _0x40d2();}function _0x2072(_0x40d272,_0x2072f6){_0x40d272=_0x40d272-0x0;const _0x434219=_0x40d2();let _0x5f056a=_0x434219[_0x40d272];return _0x5f056a;}const styles=StyleSheet['create']({'container':{'flex':0x1,'padding':0x10,'width':width,'backgroundColor':'#fff','justifyContent':'flex-start'},'inputSection':{'width':'100%','marginTop':0x0,'paddingTop':0x0},'header':{'flexDirection':_0x2072(0x91),'alignItems':_0x2072(0x92),'justifyContent':_0x2072(0x93),'marginBottom':0x10,'paddingVertical':0x8},'backButton':{'padding':0x8},'title':{'fontSize':0x14,'fontWeight':_0x2072(0x94),'color':_0x2072(0x95),'textAlign':_0x2072(0x92),'flex':0x1,'marginBottom':0x8},'subtitle':{'fontSize':0xe,'color':_0x2072(0x96),'marginBottom':0x18,'textAlign':_0x2072(0x92)},'inputContainer':{'flexDirection':_0x2072(0x91),'alignItems':'center','borderWidth':0x1,'borderColor':_0x2072(0x97),'borderRadius':0x8,'marginBottom':0x10},'input':{'flex':0x1,'padding':0xc,'fontSize':0x10},'visibilityButton':{'padding':0xc},'infoContainer':{'padding':0x10,'borderRadius':0xc,'marginBottom':0x10,'borderWidth':0x1},'infoContainerInfo':{'backgroundColor':'#E3F2FD','borderColor':'#2196F3'},'infoContainerWarning':{'backgroundColor':'#FFF3E0','borderColor':'#FF9800'},'infoContainerError':{'backgroundColor':_0x2072(0x98),'borderColor':_0x2072(0x99)},'infoTitle':{'fontSize':0x10,'fontWeight':_0x2072(0x94),'marginBottom':0x8},'infoTitleInfo':{'color':'#1976D2'},'infoTitleWarning':{'color':_0x2072(0x9a)},'infoTitleError':{'color':_0x2072(0x9b)},'infoMessage':{'fontSize':0xe,'lineHeight':0x14,'marginBottom':0xc},'infoMessageInfo':{'color':_0x2072(0x9c)},'infoMessageWarning':{'color':'#E65100'},'infoMessageError':{'color':_0x2072(0x9d)},'infoActions':{'flexDirection':_0x2072(0x91),'justifyContent':_0x2072(0x93),'marginTop':0x8},'infoActionButton':{'flex':0x1,'paddingVertical':0xa,'paddingHorizontal':0x10,'borderRadius':0x8,'backgroundColor':_0x2072(0x18),'marginHorizontal':0x4,'alignItems':'center'},'infoActionButtonSecondary':{'backgroundColor':'transparent','borderWidth':0x1,'borderColor':_0x2072(0x18)},'infoActionButtonText':{'color':_0x2072(0x9e),'fontSize':0xe,'fontWeight':_0x2072(0x94)},'infoActionButtonSecondaryText':{'color':_0x2072(0x18)},'error':{'color':_0x2072(0x9f),'marginBottom':0x10},'requirements':{'marginBottom':0x18},'requirementTitle':{'fontSize':0xe,'fontWeight':_0x2072(0x94),'marginBottom':0x8,'color':'#333'},'requirement':{'fontSize':0xe,'color':'#666','marginBottom':0x4},'requirementMet':{'color':'#34C759'},'footer':{'flexDirection':_0x2072(0x91),'alignItems':_0x2072(0x92),'justifyContent':_0x2072(0x93),'marginTop':0x18,'borderTopWidth':0x1,'borderTopColor':_0x2072(0xa0),'paddingTop':0x10},'cancelButton':{'paddingVertical':0x8,'paddingHorizontal':0x10},'cancelButtonText':{'color':_0x2072(0x96),'fontSize':0x10},'submitButton':{'paddingVertical':0x10,'paddingHorizontal':0x20,'borderRadius':0x10,'backgroundColor':'#000000','alignItems':'center'},'submitButtonDisabled':{'opacity':0.5},'submitButtonText':{'color':'#fff','fontSize':0x10,'fontWeight':_0x2072(0x94)},'backgroundProgressContainer':{'flexDirection':_0x2072(0x91),'alignItems':_0x2072(0x92),'justifyContent':_0x2072(0x92),'marginBottom':0x10},'backgroundProgressText':{'fontSize':0xe,'color':_0x2072(0x96),'marginRight':0xa},'backgroundProgressIndicator':{'padding':0x5}});
|
|
1
|
+
import React, { useState, useCallback } from 'react';
|
|
2
|
+
import { View, Text, StyleSheet, TextInput, TouchableOpacity, Dimensions, Keyboard, ActivityIndicator } from 'react-native';
|
|
3
|
+
import { biometricPinService } from '../services/biometricPinService';
|
|
4
|
+
const {
|
|
5
|
+
width
|
|
6
|
+
} = Dimensions.get('window');
|
|
7
|
+
export const PinInput = ({
|
|
8
|
+
onSubmit,
|
|
9
|
+
minLength = 8,
|
|
10
|
+
requireSpecialChar = true,
|
|
11
|
+
requireNumber = true,
|
|
12
|
+
onBack,
|
|
13
|
+
enableBiometricStorage = true,
|
|
14
|
+
// ✅ NEW: Background training optimization props
|
|
15
|
+
onBackgroundTrainingStart,
|
|
16
|
+
showBackgroundProgress = false,
|
|
17
|
+
backgroundProgressText = "Training is starting in the background..."
|
|
18
|
+
}) => {
|
|
19
|
+
const [pin, setPin] = useState('');
|
|
20
|
+
const [error, setError] = useState(null);
|
|
21
|
+
const [showPin, setShowPin] = useState(false);
|
|
22
|
+
const [isStoringPin, setIsStoringPin] = useState(false);
|
|
23
|
+
const [infoStatus, setInfoStatus] = useState('default');
|
|
24
|
+
// ✅ NEW: Background training state
|
|
25
|
+
const [isBackgroundTrainingStarted, setIsBackgroundTrainingStarted] = useState(false);
|
|
26
|
+
|
|
27
|
+
// ✅ UPDATED: Make background training conditional, not automatic on mount
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
// Only start background training if explicitly requested and not already started
|
|
30
|
+
// This prevents automatic training on component mount
|
|
31
|
+
if (onBackgroundTrainingStart && !isBackgroundTrainingStarted && showBackgroundProgress) {
|
|
32
|
+
console.log('🚀 [PIN INPUT] Background training explicitly requested...');
|
|
33
|
+
setIsBackgroundTrainingStarted(true);
|
|
34
|
+
onBackgroundTrainingStart().catch(error => {
|
|
35
|
+
console.error('❌ [PIN INPUT] Background training failed:', error);
|
|
36
|
+
setIsBackgroundTrainingStarted(false);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}, [onBackgroundTrainingStart, isBackgroundTrainingStarted, showBackgroundProgress]);
|
|
40
|
+
const validatePin = useCallback(value => {
|
|
41
|
+
if (value.length < minLength) {
|
|
42
|
+
return `PIN must be at least ${minLength} characters`;
|
|
43
|
+
}
|
|
44
|
+
if (requireSpecialChar && !/[!@#$%^&*(),.?":{}|<>]/.test(value)) {
|
|
45
|
+
return 'PIN must include a special character';
|
|
46
|
+
}
|
|
47
|
+
if (requireNumber && !/\d/.test(value)) {
|
|
48
|
+
return 'PIN must include a number';
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}, [minLength, requireSpecialChar, requireNumber]);
|
|
52
|
+
const handleSubmit = useCallback(async () => {
|
|
53
|
+
console.log('🔍 [PIN INPUT] handleSubmit called with PIN length:', pin.length);
|
|
54
|
+
const validationError = validatePin(pin);
|
|
55
|
+
if (validationError) {
|
|
56
|
+
console.log('❌ [PIN INPUT] Validation failed:', validationError);
|
|
57
|
+
setError(validationError);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
console.log('✅ [PIN INPUT] PIN validation passed');
|
|
61
|
+
|
|
62
|
+
// If biometric storage is enabled, store PIN securely
|
|
63
|
+
if (enableBiometricStorage) {
|
|
64
|
+
console.log('🔐 [PIN INPUT] Biometric storage enabled, starting biometric flow...');
|
|
65
|
+
setIsStoringPin(true);
|
|
66
|
+
setInfoStatus('authenticating');
|
|
67
|
+
try {
|
|
68
|
+
// Check if biometric is available
|
|
69
|
+
const biometricAvailable = await biometricPinService.isBiometricAvailable();
|
|
70
|
+
console.log('📱 [PIN INPUT] Biometric available:', biometricAvailable);
|
|
71
|
+
if (!biometricAvailable) {
|
|
72
|
+
console.error('❌ [PIN INPUT] Face ID not available on this device');
|
|
73
|
+
setInfoStatus('biometric-unavailable');
|
|
74
|
+
setIsStoringPin(false);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Immediately attempt to store PIN with biometric authentication
|
|
79
|
+
console.log('🔐 [PIN INPUT] Triggering biometric authentication for PIN storage...');
|
|
80
|
+
const stored = await biometricPinService.storePinWithBiometric(pin);
|
|
81
|
+
if (stored) {
|
|
82
|
+
console.log('✅ [PIN INPUT] PIN stored successfully with biometric protection');
|
|
83
|
+
|
|
84
|
+
// Verify the PIN was actually stored by checking if it can be retrieved
|
|
85
|
+
const isStored = await biometricPinService.isPinStored();
|
|
86
|
+
if (isStored) {
|
|
87
|
+
console.log('✅ [PIN INPUT] PIN storage verified - proceeding with onboarding');
|
|
88
|
+
onSubmit(pin);
|
|
89
|
+
} else {
|
|
90
|
+
console.error('❌ [PIN INPUT] PIN storage verification failed');
|
|
91
|
+
setInfoStatus('storage-error');
|
|
92
|
+
setIsStoringPin(false);
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
// Biometric authentication was cancelled or failed
|
|
96
|
+
console.warn('⚠️ [PIN INPUT] Biometric authentication failed or was cancelled');
|
|
97
|
+
setInfoStatus('biometric-failed');
|
|
98
|
+
setIsStoringPin(false);
|
|
99
|
+
}
|
|
100
|
+
} catch (error) {
|
|
101
|
+
console.error('❌ [PIN INPUT] Error handling biometric PIN storage:', error);
|
|
102
|
+
setInfoStatus('storage-error');
|
|
103
|
+
setIsStoringPin(false);
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
// Biometric storage disabled, proceed normally
|
|
107
|
+
console.log('🔐 [PIN INPUT] Biometric storage disabled, proceeding normally');
|
|
108
|
+
onSubmit(pin);
|
|
109
|
+
}
|
|
110
|
+
}, [pin, validatePin, onSubmit, enableBiometricStorage]);
|
|
111
|
+
const handlePinChange = useCallback(value => {
|
|
112
|
+
setPin(value);
|
|
113
|
+
setError(null);
|
|
114
|
+
setInfoStatus('default');
|
|
115
|
+
|
|
116
|
+
// Debug logging to help troubleshoot
|
|
117
|
+
console.log('🔍 [PIN INPUT] PIN changed:', {
|
|
118
|
+
length: value.length,
|
|
119
|
+
hasSpecialChar: /[!@#$%^&*(),.?":{}|<>]/.test(value),
|
|
120
|
+
hasNumber: /\d/.test(value),
|
|
121
|
+
isValid: !validatePin(value)
|
|
122
|
+
});
|
|
123
|
+
}, [validatePin]);
|
|
124
|
+
const handleContinueWithoutBiometric = useCallback(() => {
|
|
125
|
+
console.warn('⚠️ [PIN INPUT] User chose to continue without biometric security');
|
|
126
|
+
onSubmit(pin);
|
|
127
|
+
}, [pin, onSubmit]);
|
|
128
|
+
const handleRetry = useCallback(() => {
|
|
129
|
+
setInfoStatus('default');
|
|
130
|
+
handleSubmit();
|
|
131
|
+
}, [handleSubmit]);
|
|
132
|
+
const getInfoMessage = () => {
|
|
133
|
+
switch (infoStatus) {
|
|
134
|
+
case 'biometric-unavailable':
|
|
135
|
+
return {
|
|
136
|
+
title: 'Biometric Authentication Not Available',
|
|
137
|
+
message: 'This device does not support Face ID or Touch ID. Please enable biometric authentication in your device settings to secure your PIN.',
|
|
138
|
+
type: 'warning',
|
|
139
|
+
showActions: true
|
|
140
|
+
};
|
|
141
|
+
case 'biometric-failed':
|
|
142
|
+
return {
|
|
143
|
+
title: 'Biometric Authentication Failed',
|
|
144
|
+
message: 'Biometric authentication was cancelled or failed. Your PIN needs to be secured with biometric authentication to proceed.',
|
|
145
|
+
type: 'warning',
|
|
146
|
+
showActions: true
|
|
147
|
+
};
|
|
148
|
+
case 'storage-error':
|
|
149
|
+
return {
|
|
150
|
+
title: 'Storage Error',
|
|
151
|
+
message: 'An error occurred while securing your PIN. Would you like to try again?',
|
|
152
|
+
type: 'error',
|
|
153
|
+
showActions: true
|
|
154
|
+
};
|
|
155
|
+
case 'authenticating':
|
|
156
|
+
return {
|
|
157
|
+
title: 'Authenticating...',
|
|
158
|
+
message: 'Please complete biometric authentication to secure your PIN.',
|
|
159
|
+
type: 'info',
|
|
160
|
+
showActions: false
|
|
161
|
+
};
|
|
162
|
+
default:
|
|
163
|
+
return {
|
|
164
|
+
title: 'Secure PIN Storage',
|
|
165
|
+
message: 'Your PIN will be securely stored locally on your device using biometric authentication (Face ID or Touch ID) for enhanced security.',
|
|
166
|
+
type: 'info',
|
|
167
|
+
showActions: false
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
const infoMessage = getInfoMessage();
|
|
172
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
173
|
+
style: styles.container
|
|
174
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
175
|
+
style: styles.inputSection
|
|
176
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
177
|
+
style: styles.header
|
|
178
|
+
}, onBack && /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
179
|
+
style: styles.backButton,
|
|
180
|
+
onPress: onBack
|
|
181
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
182
|
+
style: {
|
|
183
|
+
fontSize: 24
|
|
184
|
+
}
|
|
185
|
+
}, "\u2190")), /*#__PURE__*/React.createElement(Text, {
|
|
186
|
+
style: styles.title
|
|
187
|
+
}, "Create a PIN")), /*#__PURE__*/React.createElement(Text, {
|
|
188
|
+
style: styles.subtitle
|
|
189
|
+
}, "A PIN so only you have access to your data"), showBackgroundProgress && isBackgroundTrainingStarted && /*#__PURE__*/React.createElement(View, {
|
|
190
|
+
style: styles.backgroundProgressContainer
|
|
191
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
192
|
+
style: styles.backgroundProgressText
|
|
193
|
+
}, backgroundProgressText), /*#__PURE__*/React.createElement(View, {
|
|
194
|
+
style: styles.backgroundProgressIndicator
|
|
195
|
+
}, /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
196
|
+
size: "small",
|
|
197
|
+
color: "#007AFF"
|
|
198
|
+
}))), /*#__PURE__*/React.createElement(View, {
|
|
199
|
+
style: styles.inputContainer
|
|
200
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
201
|
+
style: styles.input,
|
|
202
|
+
value: pin,
|
|
203
|
+
onChangeText: handlePinChange,
|
|
204
|
+
secureTextEntry: !showPin,
|
|
205
|
+
placeholder: "e.g. MyPin123!",
|
|
206
|
+
keyboardType: "default",
|
|
207
|
+
maxLength: 20,
|
|
208
|
+
autoCapitalize: "none",
|
|
209
|
+
autoCorrect: false,
|
|
210
|
+
returnKeyType: "done",
|
|
211
|
+
onSubmitEditing: () => Keyboard.dismiss()
|
|
212
|
+
}), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
213
|
+
style: styles.visibilityButton,
|
|
214
|
+
onPress: () => setShowPin(!showPin)
|
|
215
|
+
}, /*#__PURE__*/React.createElement(Text, null, showPin ? '👁️' : '👁️🗨️')))), error && /*#__PURE__*/React.createElement(Text, {
|
|
216
|
+
style: styles.error
|
|
217
|
+
}, error), /*#__PURE__*/React.createElement(View, {
|
|
218
|
+
style: styles.requirements
|
|
219
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
220
|
+
style: styles.requirementTitle
|
|
221
|
+
}, "PIN Requirements:"), /*#__PURE__*/React.createElement(Text, {
|
|
222
|
+
style: [styles.requirement, pin.length >= minLength && styles.requirementMet]
|
|
223
|
+
}, "\u2022 At least ", minLength, " characters"), requireSpecialChar && /*#__PURE__*/React.createElement(Text, {
|
|
224
|
+
style: [styles.requirement, /[!@#$%^&*(),.?":{}|<>]/.test(pin) && styles.requirementMet]
|
|
225
|
+
}, "\u2022 Include a special character"), requireNumber && /*#__PURE__*/React.createElement(Text, {
|
|
226
|
+
style: [styles.requirement, /\d/.test(pin) && styles.requirementMet]
|
|
227
|
+
}, "\u2022 Include a number")), /*#__PURE__*/React.createElement(View, {
|
|
228
|
+
style: [styles.infoContainer, infoMessage.type === 'info' && styles.infoContainerInfo, infoMessage.type === 'warning' && styles.infoContainerWarning, infoMessage.type === 'error' && styles.infoContainerError]
|
|
229
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
230
|
+
style: [styles.infoTitle, infoMessage.type === 'info' && styles.infoTitleInfo, infoMessage.type === 'warning' && styles.infoTitleWarning, infoMessage.type === 'error' && styles.infoTitleError]
|
|
231
|
+
}, infoMessage.title), /*#__PURE__*/React.createElement(Text, {
|
|
232
|
+
style: [styles.infoMessage, infoMessage.type === 'info' && styles.infoMessageInfo, infoMessage.type === 'warning' && styles.infoMessageWarning, infoMessage.type === 'error' && styles.infoMessageError]
|
|
233
|
+
}, infoMessage.message), infoMessage.showActions && /*#__PURE__*/React.createElement(View, {
|
|
234
|
+
style: styles.infoActions
|
|
235
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
236
|
+
style: styles.infoActionButton,
|
|
237
|
+
onPress: handleRetry
|
|
238
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
239
|
+
style: styles.infoActionButtonText
|
|
240
|
+
}, "Try Again")), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
241
|
+
style: [styles.infoActionButton, styles.infoActionButtonSecondary],
|
|
242
|
+
onPress: handleContinueWithoutBiometric
|
|
243
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
244
|
+
style: [styles.infoActionButtonText, styles.infoActionButtonSecondaryText]
|
|
245
|
+
}, "Continue Without Biometric")))), /*#__PURE__*/React.createElement(View, {
|
|
246
|
+
style: styles.footer
|
|
247
|
+
}, onBack && /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
248
|
+
style: styles.cancelButton,
|
|
249
|
+
onPress: onBack
|
|
250
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
251
|
+
style: styles.cancelButtonText
|
|
252
|
+
}, "Back")), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
253
|
+
style: [styles.submitButton, (!pin || isStoringPin || validatePin(pin)) && styles.submitButtonDisabled],
|
|
254
|
+
onPress: handleSubmit,
|
|
255
|
+
disabled: !pin || isStoringPin || !!validatePin(pin)
|
|
256
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
257
|
+
style: styles.submitButtonText
|
|
258
|
+
}, isStoringPin ? 'Authenticating...' : 'Continue'))));
|
|
259
|
+
};
|
|
260
|
+
const styles = StyleSheet.create({
|
|
261
|
+
container: {
|
|
262
|
+
flex: 1,
|
|
263
|
+
padding: 16,
|
|
264
|
+
width: width,
|
|
265
|
+
backgroundColor: '#fff',
|
|
266
|
+
justifyContent: 'flex-start'
|
|
267
|
+
},
|
|
268
|
+
inputSection: {
|
|
269
|
+
width: '100%',
|
|
270
|
+
marginTop: 0,
|
|
271
|
+
paddingTop: 0
|
|
272
|
+
},
|
|
273
|
+
header: {
|
|
274
|
+
flexDirection: 'row',
|
|
275
|
+
alignItems: 'center',
|
|
276
|
+
justifyContent: 'space-between',
|
|
277
|
+
marginBottom: 16,
|
|
278
|
+
paddingVertical: 8
|
|
279
|
+
},
|
|
280
|
+
backButton: {
|
|
281
|
+
padding: 8
|
|
282
|
+
},
|
|
283
|
+
title: {
|
|
284
|
+
fontSize: 20,
|
|
285
|
+
fontWeight: '600',
|
|
286
|
+
color: '#333',
|
|
287
|
+
textAlign: 'center',
|
|
288
|
+
flex: 1,
|
|
289
|
+
marginBottom: 8
|
|
290
|
+
},
|
|
291
|
+
subtitle: {
|
|
292
|
+
fontSize: 14,
|
|
293
|
+
color: '#666',
|
|
294
|
+
marginBottom: 24,
|
|
295
|
+
textAlign: 'center'
|
|
296
|
+
},
|
|
297
|
+
inputContainer: {
|
|
298
|
+
flexDirection: 'row',
|
|
299
|
+
alignItems: 'center',
|
|
300
|
+
borderWidth: 1,
|
|
301
|
+
borderColor: '#CCCCCC',
|
|
302
|
+
borderRadius: 8,
|
|
303
|
+
marginBottom: 16
|
|
304
|
+
},
|
|
305
|
+
input: {
|
|
306
|
+
flex: 1,
|
|
307
|
+
padding: 12,
|
|
308
|
+
fontSize: 16
|
|
309
|
+
},
|
|
310
|
+
visibilityButton: {
|
|
311
|
+
padding: 12
|
|
312
|
+
},
|
|
313
|
+
// Info Container Styles
|
|
314
|
+
infoContainer: {
|
|
315
|
+
padding: 16,
|
|
316
|
+
borderRadius: 12,
|
|
317
|
+
marginBottom: 16,
|
|
318
|
+
borderWidth: 1
|
|
319
|
+
},
|
|
320
|
+
infoContainerInfo: {
|
|
321
|
+
backgroundColor: '#E3F2FD',
|
|
322
|
+
borderColor: '#2196F3'
|
|
323
|
+
},
|
|
324
|
+
infoContainerWarning: {
|
|
325
|
+
backgroundColor: '#FFF3E0',
|
|
326
|
+
borderColor: '#FF9800'
|
|
327
|
+
},
|
|
328
|
+
infoContainerError: {
|
|
329
|
+
backgroundColor: '#FFEBEE',
|
|
330
|
+
borderColor: '#F44336'
|
|
331
|
+
},
|
|
332
|
+
infoTitle: {
|
|
333
|
+
fontSize: 16,
|
|
334
|
+
fontWeight: '600',
|
|
335
|
+
marginBottom: 8
|
|
336
|
+
},
|
|
337
|
+
infoTitleInfo: {
|
|
338
|
+
color: '#1976D2'
|
|
339
|
+
},
|
|
340
|
+
infoTitleWarning: {
|
|
341
|
+
color: '#F57C00'
|
|
342
|
+
},
|
|
343
|
+
infoTitleError: {
|
|
344
|
+
color: '#D32F2F'
|
|
345
|
+
},
|
|
346
|
+
infoMessage: {
|
|
347
|
+
fontSize: 14,
|
|
348
|
+
lineHeight: 20,
|
|
349
|
+
marginBottom: 12
|
|
350
|
+
},
|
|
351
|
+
infoMessageInfo: {
|
|
352
|
+
color: '#1565C0'
|
|
353
|
+
},
|
|
354
|
+
infoMessageWarning: {
|
|
355
|
+
color: '#E65100'
|
|
356
|
+
},
|
|
357
|
+
infoMessageError: {
|
|
358
|
+
color: '#C62828'
|
|
359
|
+
},
|
|
360
|
+
infoActions: {
|
|
361
|
+
flexDirection: 'row',
|
|
362
|
+
justifyContent: 'space-between',
|
|
363
|
+
marginTop: 8
|
|
364
|
+
},
|
|
365
|
+
infoActionButton: {
|
|
366
|
+
flex: 1,
|
|
367
|
+
paddingVertical: 10,
|
|
368
|
+
paddingHorizontal: 16,
|
|
369
|
+
borderRadius: 8,
|
|
370
|
+
backgroundColor: '#007AFF',
|
|
371
|
+
marginHorizontal: 4,
|
|
372
|
+
alignItems: 'center'
|
|
373
|
+
},
|
|
374
|
+
infoActionButtonSecondary: {
|
|
375
|
+
backgroundColor: 'transparent',
|
|
376
|
+
borderWidth: 1,
|
|
377
|
+
borderColor: '#007AFF'
|
|
378
|
+
},
|
|
379
|
+
infoActionButtonText: {
|
|
380
|
+
color: '#fff',
|
|
381
|
+
fontSize: 14,
|
|
382
|
+
fontWeight: '600'
|
|
383
|
+
},
|
|
384
|
+
infoActionButtonSecondaryText: {
|
|
385
|
+
color: '#007AFF'
|
|
386
|
+
},
|
|
387
|
+
error: {
|
|
388
|
+
color: '#FF3B30',
|
|
389
|
+
marginBottom: 16
|
|
390
|
+
},
|
|
391
|
+
requirements: {
|
|
392
|
+
marginBottom: 24
|
|
393
|
+
},
|
|
394
|
+
requirementTitle: {
|
|
395
|
+
fontSize: 14,
|
|
396
|
+
fontWeight: '600',
|
|
397
|
+
marginBottom: 8,
|
|
398
|
+
color: '#333'
|
|
399
|
+
},
|
|
400
|
+
requirement: {
|
|
401
|
+
fontSize: 14,
|
|
402
|
+
color: '#666',
|
|
403
|
+
marginBottom: 4
|
|
404
|
+
},
|
|
405
|
+
requirementMet: {
|
|
406
|
+
color: '#34C759'
|
|
407
|
+
},
|
|
408
|
+
footer: {
|
|
409
|
+
flexDirection: 'row',
|
|
410
|
+
alignItems: 'center',
|
|
411
|
+
justifyContent: 'space-between',
|
|
412
|
+
marginTop: 24,
|
|
413
|
+
borderTopWidth: 1,
|
|
414
|
+
borderTopColor: '#eee',
|
|
415
|
+
paddingTop: 16
|
|
416
|
+
},
|
|
417
|
+
cancelButton: {
|
|
418
|
+
paddingVertical: 8,
|
|
419
|
+
paddingHorizontal: 16
|
|
420
|
+
},
|
|
421
|
+
cancelButtonText: {
|
|
422
|
+
color: '#666',
|
|
423
|
+
fontSize: 16
|
|
424
|
+
},
|
|
425
|
+
submitButton: {
|
|
426
|
+
paddingVertical: 16,
|
|
427
|
+
paddingHorizontal: 32,
|
|
428
|
+
borderRadius: 16,
|
|
429
|
+
backgroundColor: '#000000',
|
|
430
|
+
alignItems: 'center'
|
|
431
|
+
},
|
|
432
|
+
submitButtonDisabled: {
|
|
433
|
+
opacity: 0.5
|
|
434
|
+
},
|
|
435
|
+
submitButtonText: {
|
|
436
|
+
color: '#fff',
|
|
437
|
+
fontSize: 16,
|
|
438
|
+
fontWeight: '600'
|
|
439
|
+
},
|
|
440
|
+
// ✅ NEW: Background training progress styles
|
|
441
|
+
backgroundProgressContainer: {
|
|
442
|
+
flexDirection: 'row',
|
|
443
|
+
alignItems: 'center',
|
|
444
|
+
justifyContent: 'center',
|
|
445
|
+
marginBottom: 16
|
|
446
|
+
},
|
|
447
|
+
backgroundProgressText: {
|
|
448
|
+
fontSize: 14,
|
|
449
|
+
color: '#666',
|
|
450
|
+
marginRight: 10
|
|
451
|
+
},
|
|
452
|
+
backgroundProgressIndicator: {
|
|
453
|
+
padding: 5
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
//# sourceMappingURL=PinInput.js.map
|