@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,66 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
|
+
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
4
|
+
import { COLORS } from '../../constants';
|
|
5
|
+
export const OnboardingHeader = ({
|
|
6
|
+
title,
|
|
7
|
+
subtitle,
|
|
8
|
+
showBackButton = false,
|
|
9
|
+
onBack,
|
|
10
|
+
onClose
|
|
11
|
+
}) => {
|
|
12
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
13
|
+
style: styles.header
|
|
14
|
+
}, showBackButton && /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
15
|
+
style: styles.backButton,
|
|
16
|
+
onPress: onBack
|
|
17
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
18
|
+
name: "arrow-back",
|
|
19
|
+
size: 24,
|
|
20
|
+
color: "#000"
|
|
21
|
+
})), /*#__PURE__*/React.createElement(View, {
|
|
22
|
+
style: styles.titleContainer
|
|
23
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
24
|
+
style: styles.title
|
|
25
|
+
}, title), subtitle && /*#__PURE__*/React.createElement(Text, {
|
|
26
|
+
style: styles.subtitle
|
|
27
|
+
}, subtitle)), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
28
|
+
style: styles.closeButton,
|
|
29
|
+
onPress: onClose
|
|
30
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
31
|
+
name: "close",
|
|
32
|
+
size: 24,
|
|
33
|
+
color: "#000"
|
|
34
|
+
})));
|
|
35
|
+
};
|
|
36
|
+
const styles = StyleSheet.create({
|
|
37
|
+
header: {
|
|
38
|
+
flexDirection: 'row',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
padding: 16,
|
|
41
|
+
backgroundColor: COLORS.headerBg,
|
|
42
|
+
borderTopLeftRadius: 16,
|
|
43
|
+
borderTopRightRadius: 16
|
|
44
|
+
},
|
|
45
|
+
backButton: {
|
|
46
|
+
padding: 8,
|
|
47
|
+
marginRight: 8
|
|
48
|
+
},
|
|
49
|
+
titleContainer: {
|
|
50
|
+
flex: 1
|
|
51
|
+
},
|
|
52
|
+
title: {
|
|
53
|
+
fontSize: 18,
|
|
54
|
+
fontWeight: '600',
|
|
55
|
+
color: '#000'
|
|
56
|
+
},
|
|
57
|
+
subtitle: {
|
|
58
|
+
fontSize: 14,
|
|
59
|
+
color: '#666',
|
|
60
|
+
marginTop: 4
|
|
61
|
+
},
|
|
62
|
+
closeButton: {
|
|
63
|
+
padding: 8
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=OnboardingHeader.js.map
|
|
@@ -1 +1,274 @@
|
|
|
1
|
-
import React,{useState,useCallback,useEffect}from'react';import{View,Text,StyleSheet,TextInput,TouchableOpacity,Keyboard,KeyboardAvoidingView,Platform}from'react-native';function _0xc9fd(_0xabfc7b,_0xc9fd43){_0xabfc7b=_0xabfc7b-0x0;const _0x6ab69f=_0xabfc();let _0x2551a0=_0x6ab69f[_0xabfc7b];return _0x2551a0;}import _0x44da30 from'react-native-vector-icons/MaterialIcons';import{COLORS}from'../../constants';export const PinInput=({onSubmit:_0x43e917,minLength:minLength=0x6,requireSpecialChar:requireSpecialChar=!![],requireNumber:requireNumber=!![]})=>{const _0x53c23f={'ECoZU':'create','dOFBP':function(_0x25e324,_0x1b9cd8){return _0x25e324(_0x1b9cd8);},'KdzRt':function(_0x22f717,_0x20b51c){return _0x22f717<_0x20b51c;},'VtQcU':_0xc9fd(0x0),'bIDFE':function(_0xd59167,_0x5531ef){return _0xd59167===_0x5531ef;},'Pxtxe':function(_0x5b82b0,_0x12919d){return _0x5b82b0!==_0x12919d;},'mKxbS':'GKaiB','HVtpe':function(_0x1172c1,_0x4c3885){return _0x1172c1!==_0x4c3885;},'Pwqcx':'ZYWVp','BmaKN':_0xc9fd(0x1),'cXEUm':function(_0x5bfdec,_0x4e94e1){return _0x5bfdec===_0x4e94e1;},'LDiNl':_0xc9fd(0x2),'qMAlx':_0xc9fd(0x3),'flJHE':function(_0x516f12,_0x2969ea){return _0x516f12===_0x2969ea;},'BVlyx':function(_0xfe8b86,_0xdb9c09){return _0xfe8b86(_0xdb9c09);},'rORBS':_0xc9fd(0x4),'fbQnf':function(_0x1bc7b0,_0x3be95f){return _0x1bc7b0(_0x3be95f);},'nEVyQ':function(_0x359f53,_0x352fae){return _0x359f53(_0x352fae);},'DditF':function(_0xc6331b,_0x4d8acf){return _0xc6331b(_0x4d8acf);},'Ztpas':function(_0x47ca3d,_0x3635ef){return _0x47ca3d===_0x3635ef;},'wxbXF':_0xc9fd(0x5),'LsepE':_0xc9fd(0x6),'mYAFu':function(_0x266538,_0xcc3568){return _0x266538(_0xcc3568);},'CMtos':function(_0x435570,_0x17dc24){return _0x435570(_0x17dc24);},'WyRdz':function(_0x2117dd,_0x2c79bc,_0x5152dd){return _0x2117dd(_0x2c79bc,_0x5152dd);},'NlrWj':function(_0x4ef4bd,_0x1b8a67){return _0x4ef4bd===_0x1b8a67;},'NcSlr':_0xc9fd(0x7),'FdtTR':_0xc9fd(0x8),'jvNSU':function(_0x1ffae7,_0x827095){return _0x1ffae7===_0x827095;},'yFnAb':'Create\x20a\x20PIN','LXcNn':_0xc9fd(0x9),'bplTs':function(_0x206fb9,_0x4342e5){return _0x206fb9===_0x4342e5;},'CJkIe':_0xc9fd(0xa),'OlTKZ':_0xc9fd(0xb),'IBVaU':_0xc9fd(0xc),'wKPXk':'done','QKJIE':_0xc9fd(0xd),'eEZbQ':_0xc9fd(0xe),'MCFlc':function(_0x113ab3,_0xc52de5){return _0x113ab3>_0xc52de5;},'eVkvN':function(_0x5d6110,_0x14b0de){return _0x5d6110===_0x14b0de;},'FdCqh':_0xc9fd(0xf),'amKIO':function(_0x3f96b0,_0x521cf0){return _0x3f96b0>=_0x521cf0;},'WcFEL':_0xc9fd(0x10),'qAndC':function(_0x877417,_0x490253){return _0x877417>=_0x490253;},'msQKc':_0xc9fd(0x11),'yjnnf':function(_0x76aee3,_0x52975c){return _0x76aee3>=_0x52975c;},'AXkyi':_0xc9fd(0x12),'DEmJe':'Include\x20at\x20least\x20one\x20number','aQcwk':_0xc9fd(0x13),'tgLli':function(_0x426451,_0x5b2a9b){return _0x426451===_0x5b2a9b;},'JCXVq':_0xc9fd(0x14),'VIBzR':'Back','KsaMV':function(_0x4ad9bf,_0xff307c){return _0x4ad9bf>_0xff307c;},'YlkEp':function(_0x2695ff,_0x334dfa){return _0x2695ff===_0x334dfa;},'DwXFK':function(_0x2ccbb7,_0x199f71){return _0x2ccbb7===_0x199f71;},'lWRMt':'arrow-forward','gQOVT':'#fff'},[_0x965de5,_0x2c653a]=useState(''),[_0x4beaf7,_0xa8ad0d]=_0x53c23f[_0xc9fd(0x15)](useState,''),[_0x2fac32,_0x1c7085]=_0x53c23f[_0xc9fd(0x15)](useState,![]),[_0x103bde,_0x22b077]=_0x53c23f[_0xc9fd(0x16)](useState,[]),[_0x49be8a,_0x20c47f]=_0x53c23f[_0xc9fd(0x17)](useState,_0xc9fd(0x18));useEffect(()=>{_0x49be8a===_0x53c23f[_0xc9fd(0x19)]&&_0x53c23f[_0xc9fd(0x1a)](_0x3a8390,_0x965de5);},[_0x965de5,_0x49be8a]);const _0x3a8390=useCallback(_0x243793=>{const _0x23015c=[];return _0x53c23f[_0xc9fd(0x1b)](_0x243793[_0xc9fd(0x1c)],minLength)&&_0x23015c[_0xc9fd(0x1d)](_0xc9fd(0x1e)+minLength+_0xc9fd(0x1f)),requireNumber&&!/\d/['test'](_0x243793)&&_0x23015c[_0xc9fd(0x1d)](_0x53c23f[_0xc9fd(0x20)]),requireSpecialChar&&!/[!@#$%^&*(),.?":{}|<>]/[_0xc9fd(0x21)](_0x243793)&&_0x23015c[_0xc9fd(0x1d)]('PIN\x20must\x20include\x20at\x20least\x20one\x20special\x20character'),_0x53c23f[_0xc9fd(0x1a)](_0x22b077,_0x23015c),_0x53c23f['bIDFE'](_0x23015c[_0xc9fd(0x1c)],0x0);},[minLength,requireNumber,requireSpecialChar]),_0x3a735a=useCallback(()=>{_0x53c23f[_0xc9fd(0x22)]('GKaiB',_0x53c23f['mKxbS'])?_0x13bf2b['push'](_0xc9fd(0x1e)+_0x5561a6+_0xc9fd(0x1f)):_0x49be8a===_0x53c23f[_0xc9fd(0x19)]?_0x53c23f[_0xc9fd(0x23)](_0xc9fd(0x24),_0x53c23f['Pwqcx'])?_0x53c23f[_0xc9fd(0x1a)](_0x3a8390,_0x965de5)&&_0x53c23f['dOFBP'](_0x20c47f,_0x53c23f[_0xc9fd(0x25)]):(_0x552db3(_0x53c23f[_0xc9fd(0x19)]),_0x53c23f[_0xc9fd(0x1a)](_0x43d626,''),_0x53c23f[_0xc9fd(0x1a)](_0x2ef0e4,[])):_0x53c23f[_0xc9fd(0x26)](_0x53c23f[_0xc9fd(0x27)],_0x53c23f[_0xc9fd(0x28)])?_0x4de6fd===_0x53c23f['ECoZU']&&_0x56e21e(_0x1e576f):_0x53c23f['flJHE'](_0x965de5,_0x4beaf7)?(Keyboard[_0xc9fd(0x29)](),_0x53c23f['BVlyx'](_0x43e917,_0x965de5)):_0xc9fd(0x2a)!==_0xc9fd(0x2b)?(_0x22b077([_0x53c23f[_0xc9fd(0x2c)]]),_0x53c23f[_0xc9fd(0x2d)](_0xa8ad0d,'')):_0x566f36[_0xc9fd(0x1d)](_0x53c23f['VtQcU']);},[_0x965de5,_0x4beaf7,_0x49be8a,_0x3a8390,_0x43e917]),_0x3fcfbb=useCallback(()=>{_0x53c23f['nEVyQ'](_0x20c47f,_0x53c23f[_0xc9fd(0x19)]),_0xa8ad0d(''),_0x22b077([]);},[]),_0x45c380=_0x53c23f[_0xc9fd(0x2e)](useCallback,()=>{const _0x18dbd2={'QKEoK':function(_0x2e4230,_0xc6aff6){return _0x53c23f['DditF'](_0x2e4230,_0xc6aff6);}};_0x53c23f[_0xc9fd(0x2f)](_0x53c23f['wxbXF'],_0x53c23f[_0xc9fd(0x30)])?(_0x18dbd2['QKEoK'](_0x1346b3,[_0xc9fd(0x4)]),_0x18dbd2['QKEoK'](_0x53defb,'')):_0x53c23f[_0xc9fd(0x2d)](_0x1c7085,!_0x2fac32);},[_0x2fac32]);return React[_0xc9fd(0x31)](KeyboardAvoidingView,{'behavior':_0x53c23f['NlrWj'](Platform['OS'],_0xc9fd(0x32))?_0x53c23f[_0xc9fd(0x33)]:_0x53c23f['FdtTR'],'style':styles[_0xc9fd(0x34)]},React[_0xc9fd(0x31)](View,{'style':styles[_0xc9fd(0x35)]},React[_0xc9fd(0x31)](Text,{'style':styles['title']},_0x53c23f[_0xc9fd(0x36)](_0x49be8a,_0x53c23f['ECoZU'])?_0x53c23f[_0xc9fd(0x37)]:_0x53c23f['LXcNn']),React[_0xc9fd(0x31)](Text,{'style':styles[_0xc9fd(0x38)]},_0x53c23f[_0xc9fd(0x39)](_0x49be8a,_0x53c23f[_0xc9fd(0x19)])?_0xc9fd(0x3a):'Please\x20re-enter\x20your\x20PIN\x20to\x20confirm'),React['createElement'](View,{'style':styles[_0xc9fd(0x3b)]},React[_0xc9fd(0x31)](TextInput,{'style':styles['input'],'value':_0x53c23f[_0xc9fd(0x36)](_0x49be8a,_0x53c23f[_0xc9fd(0x19)])?_0x965de5:_0x4beaf7,'onChangeText':_0x53c23f[_0xc9fd(0x26)](_0x49be8a,_0x53c23f[_0xc9fd(0x19)])?_0x2c653a:_0xa8ad0d,'secureTextEntry':!_0x2fac32,'keyboardType':_0x53c23f[_0xc9fd(0x3c)],'autoCapitalize':'none','autoCorrect':![],'placeholder':_0x53c23f[_0xc9fd(0x3d)](_0x49be8a,_0xc9fd(0x18))?_0x53c23f[_0xc9fd(0x3e)]:_0x53c23f[_0xc9fd(0x3f)],'placeholderTextColor':_0xc9fd(0xe),'returnKeyType':_0x53c23f[_0xc9fd(0x40)],'onSubmitEditing':_0x3a735a}),React['createElement'](TouchableOpacity,{'style':styles[_0xc9fd(0x41)],'onPress':_0x45c380},React[_0xc9fd(0x31)](_0x44da30,{'name':_0x2fac32?_0xc9fd(0x42):_0x53c23f['QKJIE'],'size':0x18,'color':_0x53c23f[_0xc9fd(0x43)]}))),_0x53c23f['MCFlc'](_0x103bde[_0xc9fd(0x1c)],0x0)&&React[_0xc9fd(0x31)](View,{'style':styles[_0xc9fd(0x44)]},_0x103bde[_0xc9fd(0x45)]((_0x12337a,_0xfe5a16)=>React[_0xc9fd(0x31)](View,{'key':_0xfe5a16,'style':styles[_0xc9fd(0x46)]},React['createElement'](_0x44da30,{'name':_0xc9fd(0x47),'size':0x10,'color':_0xc9fd(0x48)}),React[_0xc9fd(0x31)](Text,{'style':styles['errorText']},_0x12337a)))),_0x53c23f[_0xc9fd(0x49)](_0x49be8a,_0x53c23f[_0xc9fd(0x19)])&&React['createElement'](View,{'style':styles[_0xc9fd(0x4a)]},React[_0xc9fd(0x31)](Text,{'style':styles[_0xc9fd(0x4b)]},_0x53c23f[_0xc9fd(0x4c)]),React[_0xc9fd(0x31)](View,{'style':styles[_0xc9fd(0x4d)]},React[_0xc9fd(0x31)](_0x44da30,{'name':_0x53c23f['amKIO'](_0x965de5[_0xc9fd(0x1c)],minLength)?_0x53c23f[_0xc9fd(0x4e)]:_0xc9fd(0x12),'size':0x10,'color':_0x53c23f[_0xc9fd(0x4f)](_0x965de5[_0xc9fd(0x1c)],minLength)?_0x53c23f[_0xc9fd(0x50)]:_0xc9fd(0xe)}),React[_0xc9fd(0x31)](Text,{'style':[styles[_0xc9fd(0x51)],{'color':_0x53c23f[_0xc9fd(0x52)](_0x965de5[_0xc9fd(0x1c)],minLength)?_0x53c23f[_0xc9fd(0x50)]:_0x53c23f['eEZbQ']}]},'At\x20least\x20',minLength,_0xc9fd(0x1f))),requireNumber&&React[_0xc9fd(0x31)](View,{'style':styles[_0xc9fd(0x4d)]},React[_0xc9fd(0x31)](_0x44da30,{'name':/\d/[_0xc9fd(0x21)](_0x965de5)?_0x53c23f['WcFEL']:_0x53c23f[_0xc9fd(0x53)],'size':0x10,'color':/\d/['test'](_0x965de5)?_0x53c23f[_0xc9fd(0x50)]:'#999'}),React[_0xc9fd(0x31)](Text,{'style':[styles[_0xc9fd(0x51)],{'color':/\d/[_0xc9fd(0x21)](_0x965de5)?_0x53c23f[_0xc9fd(0x50)]:_0x53c23f[_0xc9fd(0x43)]}]},_0x53c23f[_0xc9fd(0x54)])),requireSpecialChar&&React['createElement'](View,{'style':styles[_0xc9fd(0x4d)]},React['createElement'](_0x44da30,{'name':/[!@#$%^&*(),.?":{}|<>]/[_0xc9fd(0x21)](_0x965de5)?_0x53c23f['WcFEL']:_0x53c23f[_0xc9fd(0x53)],'size':0x10,'color':/[!@#$%^&*(),.?":{}|<>]/[_0xc9fd(0x21)](_0x965de5)?_0x53c23f[_0xc9fd(0x50)]:_0x53c23f[_0xc9fd(0x43)]}),React[_0xc9fd(0x31)](Text,{'style':[styles[_0xc9fd(0x51)],{'color':/[!@#$%^&*(),.?":{}|<>]/[_0xc9fd(0x21)](_0x965de5)?_0xc9fd(0x11):_0xc9fd(0xe)}]},_0x53c23f[_0xc9fd(0x55)]))),React['createElement'](View,{'style':styles['buttonContainer']},_0x53c23f[_0xc9fd(0x56)](_0x49be8a,_0x53c23f[_0xc9fd(0x25)])&&React[_0xc9fd(0x31)](TouchableOpacity,{'style':[styles['button'],styles[_0xc9fd(0x57)]],'onPress':_0x3fcfbb},React[_0xc9fd(0x31)](_0x44da30,{'name':_0x53c23f[_0xc9fd(0x58)],'size':0x14,'color':COLORS['primary']}),React[_0xc9fd(0x31)](Text,{'style':[styles[_0xc9fd(0x59)],styles['backButtonText']]},_0x53c23f[_0xc9fd(0x5a)])),React[_0xc9fd(0x31)](TouchableOpacity,{'style':[styles[_0xc9fd(0x5b)],styles[_0xc9fd(0x5c)],_0x49be8a===_0xc9fd(0x18)&&_0x53c23f['KsaMV'](_0x103bde[_0xc9fd(0x1c)],0x0)||_0x53c23f[_0xc9fd(0x5d)](_0x49be8a,_0xc9fd(0x1))&&!_0x4beaf7?styles[_0xc9fd(0x5e)]:null],'onPress':_0x3a735a,'disabled':_0x53c23f['eVkvN'](_0x49be8a,'create')&&_0x103bde['length']>0x0||_0x53c23f[_0xc9fd(0x26)](_0x49be8a,_0x53c23f[_0xc9fd(0x25)])&&!_0x4beaf7},React['createElement'](Text,{'style':[styles['buttonText'],styles[_0xc9fd(0x5f)]]},_0x53c23f[_0xc9fd(0x60)](_0x49be8a,_0x53c23f[_0xc9fd(0x19)])?'Next':_0xc9fd(0x61)),React[_0xc9fd(0x31)](_0x44da30,{'name':_0x53c23f[_0xc9fd(0x62)],'size':0x14,'color':_0x53c23f[_0xc9fd(0x63)]})))));};const styles=StyleSheet['create']({'container':{'flex':0x1},'content':{'padding':0x18},'title':{'fontSize':0x18,'fontWeight':_0xc9fd(0x64),'marginBottom':0x8,'color':_0xc9fd(0x65)},'subtitle':{'fontSize':0x10,'color':_0xc9fd(0x66),'marginBottom':0x18},'inputContainer':{'flexDirection':_0xc9fd(0x67),'alignItems':_0xc9fd(0x68),'borderWidth':0x1,'borderColor':_0xc9fd(0x69),'borderRadius':0x8,'backgroundColor':_0xc9fd(0x6a),'marginBottom':0x10},'input':{'flex':0x1,'paddingHorizontal':0x10,'paddingVertical':0xc,'fontSize':0x10,'color':_0xc9fd(0x65)},'visibilityToggle':{'padding':0xc},'errorContainer':{'marginBottom':0x10},'errorItem':{'flexDirection':_0xc9fd(0x67),'alignItems':'center','marginBottom':0x4},'errorText':{'color':_0xc9fd(0x48),'marginLeft':0x6},'requirementsContainer':{'backgroundColor':_0xc9fd(0x6b),'padding':0x10,'borderRadius':0x8,'marginBottom':0x18},'requirementsTitle':{'fontSize':0xe,'fontWeight':_0xc9fd(0x6c),'marginBottom':0x8,'color':'#000'},'requirement':{'flexDirection':_0xc9fd(0x67),'alignItems':'center','marginBottom':0x8},'requirementText':{'marginLeft':0x8,'fontSize':0xe},'buttonContainer':{'flexDirection':_0xc9fd(0x67),'justifyContent':_0xc9fd(0x6d)},'button':{'flexDirection':_0xc9fd(0x67),'alignItems':_0xc9fd(0x68),'paddingVertical':0xc,'paddingHorizontal':0x14,'borderRadius':0x19},'backButton':{'backgroundColor':'transparent','borderWidth':0x1,'borderColor':COLORS['primary']},'nextButton':{'backgroundColor':COLORS[_0xc9fd(0x6e)],'minWidth':0x78,'justifyContent':'center'},'disabledButton':{'backgroundColor':_0xc9fd(0x6f)},'buttonText':{'fontSize':0x10,'fontWeight':_0xc9fd(0x6c)},'backButtonText':{'color':COLORS[_0xc9fd(0x6e)],'marginLeft':0x8},'nextButtonText':{'color':_0xc9fd(0x70),'marginRight':0x8}});function _0xabfc(){const _0x48c581=['PIN\x20must\x20include\x20at\x20least\x20one\x20number','confirm','kYslO','bKyjf','PINs\x20do\x20not\x20match','HMNus','TZlUO','padding','height','Confirm\x20your\x20PIN','default','Enter\x20PIN','Confirm\x20PIN','visibility','#999','PIN\x20Requirements:','check-circle','#4caf50','radio-button-unchecked','Include\x20at\x20least\x20one\x20special\x20character','arrow-back','mYAFu','nEVyQ','CMtos','create','ECoZU','dOFBP','KdzRt','length','push','PIN\x20must\x20be\x20at\x20least\x20','\x20characters','VtQcU','test','Pxtxe','HVtpe','MrZnb','BmaKN','cXEUm','LDiNl','qMAlx','dismiss','wNbId','CPnxb','rORBS','fbQnf','WyRdz','Ztpas','LsepE','createElement','ios','NcSlr','container','content','jvNSU','yFnAb','subtitle','bplTs','This\x20PIN\x20will\x20protect\x20your\x20Onairos\x20account','inputContainer','CJkIe','bIDFE','OlTKZ','IBVaU','wKPXk','visibilityToggle','visibility-off','eEZbQ','errorContainer','map','errorItem','error-outline','#f44336','eVkvN','requirementsContainer','requirementsTitle','FdCqh','requirement','WcFEL','qAndC','msQKc','requirementText','yjnnf','AXkyi','DEmJe','aQcwk','tgLli','backButton','JCXVq','buttonText','VIBzR','button','nextButton','YlkEp','disabledButton','nextButtonText','DwXFK','Submit','lWRMt','gQOVT','bold','#000','#666','row','center','#ddd','#f9f9f9','#f5f5f5','600','space-between','primary','#ccc','#fff'];_0xabfc=function(){return _0x48c581;};return _0xabfc();}
|
|
1
|
+
import React, { useState, useCallback, useEffect } from 'react';
|
|
2
|
+
import { View, Text, StyleSheet, TextInput, TouchableOpacity, Keyboard, KeyboardAvoidingView, Platform } from 'react-native';
|
|
3
|
+
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
4
|
+
import { COLORS } from '../../constants';
|
|
5
|
+
export const PinInput = ({
|
|
6
|
+
onSubmit,
|
|
7
|
+
minLength = 6,
|
|
8
|
+
requireSpecialChar = true,
|
|
9
|
+
requireNumber = true
|
|
10
|
+
}) => {
|
|
11
|
+
const [pin, setPin] = useState('');
|
|
12
|
+
const [confirmPin, setConfirmPin] = useState('');
|
|
13
|
+
const [showPin, setShowPin] = useState(false);
|
|
14
|
+
const [errors, setErrors] = useState([]);
|
|
15
|
+
const [step, setStep] = useState('create');
|
|
16
|
+
|
|
17
|
+
// Validate pin whenever it changes
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (step === 'create') {
|
|
20
|
+
validatePin(pin);
|
|
21
|
+
}
|
|
22
|
+
}, [pin, step]);
|
|
23
|
+
|
|
24
|
+
// Validate PIN strength and requirements
|
|
25
|
+
const validatePin = useCallback(value => {
|
|
26
|
+
const newErrors = [];
|
|
27
|
+
if (value.length < minLength) {
|
|
28
|
+
newErrors.push(`PIN must be at least ${minLength} characters`);
|
|
29
|
+
}
|
|
30
|
+
if (requireNumber && !/\d/.test(value)) {
|
|
31
|
+
newErrors.push('PIN must include at least one number');
|
|
32
|
+
}
|
|
33
|
+
if (requireSpecialChar && !/[!@#$%^&*(),.?":{}|<>]/.test(value)) {
|
|
34
|
+
newErrors.push('PIN must include at least one special character');
|
|
35
|
+
}
|
|
36
|
+
setErrors(newErrors);
|
|
37
|
+
return newErrors.length === 0;
|
|
38
|
+
}, [minLength, requireNumber, requireSpecialChar]);
|
|
39
|
+
|
|
40
|
+
// Handle PIN submission
|
|
41
|
+
const handleSubmit = useCallback(() => {
|
|
42
|
+
if (step === 'create') {
|
|
43
|
+
if (validatePin(pin)) {
|
|
44
|
+
setStep('confirm');
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
// Confirm PIN
|
|
48
|
+
if (pin === confirmPin) {
|
|
49
|
+
Keyboard.dismiss();
|
|
50
|
+
onSubmit(pin);
|
|
51
|
+
} else {
|
|
52
|
+
setErrors(['PINs do not match']);
|
|
53
|
+
setConfirmPin('');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, [pin, confirmPin, step, validatePin, onSubmit]);
|
|
57
|
+
|
|
58
|
+
// Go back to PIN creation step
|
|
59
|
+
const handleBack = useCallback(() => {
|
|
60
|
+
setStep('create');
|
|
61
|
+
setConfirmPin('');
|
|
62
|
+
setErrors([]);
|
|
63
|
+
}, []);
|
|
64
|
+
|
|
65
|
+
// Toggle PIN visibility
|
|
66
|
+
const togglePinVisibility = useCallback(() => {
|
|
67
|
+
setShowPin(!showPin);
|
|
68
|
+
}, [showPin]);
|
|
69
|
+
return /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
|
|
70
|
+
behavior: Platform.OS === 'ios' ? 'padding' : 'height',
|
|
71
|
+
style: styles.container
|
|
72
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
73
|
+
style: styles.content
|
|
74
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
75
|
+
style: styles.title
|
|
76
|
+
}, step === 'create' ? 'Create a PIN' : 'Confirm your PIN'), /*#__PURE__*/React.createElement(Text, {
|
|
77
|
+
style: styles.subtitle
|
|
78
|
+
}, step === 'create' ? 'This PIN will protect your Onairos account' : 'Please re-enter your PIN to confirm'), /*#__PURE__*/React.createElement(View, {
|
|
79
|
+
style: styles.inputContainer
|
|
80
|
+
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
81
|
+
style: styles.input,
|
|
82
|
+
value: step === 'create' ? pin : confirmPin,
|
|
83
|
+
onChangeText: step === 'create' ? setPin : setConfirmPin,
|
|
84
|
+
secureTextEntry: !showPin,
|
|
85
|
+
keyboardType: "default",
|
|
86
|
+
autoCapitalize: "none",
|
|
87
|
+
autoCorrect: false,
|
|
88
|
+
placeholder: step === 'create' ? 'Enter PIN' : 'Confirm PIN',
|
|
89
|
+
placeholderTextColor: "#999",
|
|
90
|
+
returnKeyType: "done",
|
|
91
|
+
onSubmitEditing: handleSubmit
|
|
92
|
+
}), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
93
|
+
style: styles.visibilityToggle,
|
|
94
|
+
onPress: togglePinVisibility
|
|
95
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
96
|
+
name: showPin ? 'visibility-off' : 'visibility',
|
|
97
|
+
size: 24,
|
|
98
|
+
color: "#999"
|
|
99
|
+
}))), errors.length > 0 && /*#__PURE__*/React.createElement(View, {
|
|
100
|
+
style: styles.errorContainer
|
|
101
|
+
}, errors.map((error, index) => /*#__PURE__*/React.createElement(View, {
|
|
102
|
+
key: index,
|
|
103
|
+
style: styles.errorItem
|
|
104
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
105
|
+
name: "error-outline",
|
|
106
|
+
size: 16,
|
|
107
|
+
color: "#f44336"
|
|
108
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
109
|
+
style: styles.errorText
|
|
110
|
+
}, error)))), step === 'create' && /*#__PURE__*/React.createElement(View, {
|
|
111
|
+
style: styles.requirementsContainer
|
|
112
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
113
|
+
style: styles.requirementsTitle
|
|
114
|
+
}, "PIN Requirements:"), /*#__PURE__*/React.createElement(View, {
|
|
115
|
+
style: styles.requirement
|
|
116
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
117
|
+
name: pin.length >= minLength ? 'check-circle' : 'radio-button-unchecked',
|
|
118
|
+
size: 16,
|
|
119
|
+
color: pin.length >= minLength ? '#4caf50' : '#999'
|
|
120
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
121
|
+
style: [styles.requirementText, {
|
|
122
|
+
color: pin.length >= minLength ? '#4caf50' : '#999'
|
|
123
|
+
}]
|
|
124
|
+
}, "At least ", minLength, " characters")), requireNumber && /*#__PURE__*/React.createElement(View, {
|
|
125
|
+
style: styles.requirement
|
|
126
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
127
|
+
name: /\d/.test(pin) ? 'check-circle' : 'radio-button-unchecked',
|
|
128
|
+
size: 16,
|
|
129
|
+
color: /\d/.test(pin) ? '#4caf50' : '#999'
|
|
130
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
131
|
+
style: [styles.requirementText, {
|
|
132
|
+
color: /\d/.test(pin) ? '#4caf50' : '#999'
|
|
133
|
+
}]
|
|
134
|
+
}, "Include at least one number")), requireSpecialChar && /*#__PURE__*/React.createElement(View, {
|
|
135
|
+
style: styles.requirement
|
|
136
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
137
|
+
name: /[!@#$%^&*(),.?":{}|<>]/.test(pin) ? 'check-circle' : 'radio-button-unchecked',
|
|
138
|
+
size: 16,
|
|
139
|
+
color: /[!@#$%^&*(),.?":{}|<>]/.test(pin) ? '#4caf50' : '#999'
|
|
140
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
141
|
+
style: [styles.requirementText, {
|
|
142
|
+
color: /[!@#$%^&*(),.?":{}|<>]/.test(pin) ? '#4caf50' : '#999'
|
|
143
|
+
}]
|
|
144
|
+
}, "Include at least one special character"))), /*#__PURE__*/React.createElement(View, {
|
|
145
|
+
style: styles.buttonContainer
|
|
146
|
+
}, step === 'confirm' && /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
147
|
+
style: [styles.button, styles.backButton],
|
|
148
|
+
onPress: handleBack
|
|
149
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
150
|
+
name: "arrow-back",
|
|
151
|
+
size: 20,
|
|
152
|
+
color: COLORS.primary
|
|
153
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
154
|
+
style: [styles.buttonText, styles.backButtonText]
|
|
155
|
+
}, "Back")), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
156
|
+
style: [styles.button, styles.nextButton, step === 'create' && errors.length > 0 || step === 'confirm' && !confirmPin ? styles.disabledButton : null],
|
|
157
|
+
onPress: handleSubmit,
|
|
158
|
+
disabled: step === 'create' && errors.length > 0 || step === 'confirm' && !confirmPin
|
|
159
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
160
|
+
style: [styles.buttonText, styles.nextButtonText]
|
|
161
|
+
}, step === 'create' ? 'Next' : 'Submit'), /*#__PURE__*/React.createElement(Icon, {
|
|
162
|
+
name: "arrow-forward",
|
|
163
|
+
size: 20,
|
|
164
|
+
color: "#fff"
|
|
165
|
+
})))));
|
|
166
|
+
};
|
|
167
|
+
const styles = StyleSheet.create({
|
|
168
|
+
container: {
|
|
169
|
+
flex: 1
|
|
170
|
+
},
|
|
171
|
+
content: {
|
|
172
|
+
padding: 24
|
|
173
|
+
},
|
|
174
|
+
title: {
|
|
175
|
+
fontSize: 24,
|
|
176
|
+
fontWeight: 'bold',
|
|
177
|
+
marginBottom: 8,
|
|
178
|
+
color: '#000'
|
|
179
|
+
},
|
|
180
|
+
subtitle: {
|
|
181
|
+
fontSize: 16,
|
|
182
|
+
color: '#666',
|
|
183
|
+
marginBottom: 24
|
|
184
|
+
},
|
|
185
|
+
inputContainer: {
|
|
186
|
+
flexDirection: 'row',
|
|
187
|
+
alignItems: 'center',
|
|
188
|
+
borderWidth: 1,
|
|
189
|
+
borderColor: '#ddd',
|
|
190
|
+
borderRadius: 8,
|
|
191
|
+
backgroundColor: '#f9f9f9',
|
|
192
|
+
marginBottom: 16
|
|
193
|
+
},
|
|
194
|
+
input: {
|
|
195
|
+
flex: 1,
|
|
196
|
+
paddingHorizontal: 16,
|
|
197
|
+
paddingVertical: 12,
|
|
198
|
+
fontSize: 16,
|
|
199
|
+
color: '#000'
|
|
200
|
+
},
|
|
201
|
+
visibilityToggle: {
|
|
202
|
+
padding: 12
|
|
203
|
+
},
|
|
204
|
+
errorContainer: {
|
|
205
|
+
marginBottom: 16
|
|
206
|
+
},
|
|
207
|
+
errorItem: {
|
|
208
|
+
flexDirection: 'row',
|
|
209
|
+
alignItems: 'center',
|
|
210
|
+
marginBottom: 4
|
|
211
|
+
},
|
|
212
|
+
errorText: {
|
|
213
|
+
color: '#f44336',
|
|
214
|
+
marginLeft: 6
|
|
215
|
+
},
|
|
216
|
+
requirementsContainer: {
|
|
217
|
+
backgroundColor: '#f5f5f5',
|
|
218
|
+
padding: 16,
|
|
219
|
+
borderRadius: 8,
|
|
220
|
+
marginBottom: 24
|
|
221
|
+
},
|
|
222
|
+
requirementsTitle: {
|
|
223
|
+
fontSize: 14,
|
|
224
|
+
fontWeight: '600',
|
|
225
|
+
marginBottom: 8,
|
|
226
|
+
color: '#000'
|
|
227
|
+
},
|
|
228
|
+
requirement: {
|
|
229
|
+
flexDirection: 'row',
|
|
230
|
+
alignItems: 'center',
|
|
231
|
+
marginBottom: 8
|
|
232
|
+
},
|
|
233
|
+
requirementText: {
|
|
234
|
+
marginLeft: 8,
|
|
235
|
+
fontSize: 14
|
|
236
|
+
},
|
|
237
|
+
buttonContainer: {
|
|
238
|
+
flexDirection: 'row',
|
|
239
|
+
justifyContent: 'space-between'
|
|
240
|
+
},
|
|
241
|
+
button: {
|
|
242
|
+
flexDirection: 'row',
|
|
243
|
+
alignItems: 'center',
|
|
244
|
+
paddingVertical: 12,
|
|
245
|
+
paddingHorizontal: 20,
|
|
246
|
+
borderRadius: 25
|
|
247
|
+
},
|
|
248
|
+
backButton: {
|
|
249
|
+
backgroundColor: 'transparent',
|
|
250
|
+
borderWidth: 1,
|
|
251
|
+
borderColor: COLORS.primary
|
|
252
|
+
},
|
|
253
|
+
nextButton: {
|
|
254
|
+
backgroundColor: COLORS.primary,
|
|
255
|
+
minWidth: 120,
|
|
256
|
+
justifyContent: 'center'
|
|
257
|
+
},
|
|
258
|
+
disabledButton: {
|
|
259
|
+
backgroundColor: '#ccc'
|
|
260
|
+
},
|
|
261
|
+
buttonText: {
|
|
262
|
+
fontSize: 16,
|
|
263
|
+
fontWeight: '600'
|
|
264
|
+
},
|
|
265
|
+
backButtonText: {
|
|
266
|
+
color: COLORS.primary,
|
|
267
|
+
marginLeft: 8
|
|
268
|
+
},
|
|
269
|
+
nextButtonText: {
|
|
270
|
+
color: '#fff',
|
|
271
|
+
marginRight: 8
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
//# sourceMappingURL=PinInput.js.map
|
|
@@ -1 +1,240 @@
|
|
|
1
|
-
import React,
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View, Text, StyleSheet, TouchableOpacity, ActivityIndicator, ScrollView } from 'react-native';
|
|
3
|
+
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
4
|
+
import { COLORS } from '../../constants';
|
|
5
|
+
import { OAuthWebView } from './OAuthWebView';
|
|
6
|
+
// Platform definitions
|
|
7
|
+
const PLATFORMS = {
|
|
8
|
+
instagram: {
|
|
9
|
+
name: 'Instagram',
|
|
10
|
+
icon: 'photo-camera',
|
|
11
|
+
color: '#E1306C',
|
|
12
|
+
description: 'Connect to share and analyze your Instagram content'
|
|
13
|
+
},
|
|
14
|
+
youtube: {
|
|
15
|
+
name: 'YouTube',
|
|
16
|
+
icon: 'smart-display',
|
|
17
|
+
color: '#FF0000',
|
|
18
|
+
description: 'Connect for YouTube video recommendations and analysis'
|
|
19
|
+
},
|
|
20
|
+
pinterest: {
|
|
21
|
+
name: 'Pinterest',
|
|
22
|
+
icon: 'push-pin',
|
|
23
|
+
color: '#E60023',
|
|
24
|
+
description: 'Connect to enhance Pinterest board recommendations'
|
|
25
|
+
},
|
|
26
|
+
reddit: {
|
|
27
|
+
name: 'Reddit',
|
|
28
|
+
icon: 'forum',
|
|
29
|
+
color: '#FF4500',
|
|
30
|
+
description: 'Connect to personalize Reddit content insights'
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export const PlatformConnector = ({
|
|
34
|
+
connections,
|
|
35
|
+
onConnect,
|
|
36
|
+
onDisconnect,
|
|
37
|
+
isLoading,
|
|
38
|
+
canProceed,
|
|
39
|
+
onProceed
|
|
40
|
+
}) => {
|
|
41
|
+
const [activeWebview, setActiveWebview] = useState(null);
|
|
42
|
+
const handleConnectPress = async platform => {
|
|
43
|
+
setActiveWebview(platform);
|
|
44
|
+
};
|
|
45
|
+
const handleWebViewComplete = () => {
|
|
46
|
+
setActiveWebview(null);
|
|
47
|
+
};
|
|
48
|
+
const handleWebViewClose = () => {
|
|
49
|
+
setActiveWebview(null);
|
|
50
|
+
};
|
|
51
|
+
const handleDisconnectPress = async platform => {
|
|
52
|
+
await onDisconnect(platform);
|
|
53
|
+
};
|
|
54
|
+
const getPlatformStatus = platform => {
|
|
55
|
+
const platformKey = platform;
|
|
56
|
+
return connections[platformKey] ? true : false;
|
|
57
|
+
};
|
|
58
|
+
const getConnectedCount = () => {
|
|
59
|
+
return Object.values(connections).filter(Boolean).length;
|
|
60
|
+
};
|
|
61
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
62
|
+
style: styles.container
|
|
63
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
64
|
+
style: styles.title
|
|
65
|
+
}, "Connect Your Platforms"), /*#__PURE__*/React.createElement(Text, {
|
|
66
|
+
style: styles.subtitle
|
|
67
|
+
}, "Connect at least 2 platforms to create your Onairos account"), /*#__PURE__*/React.createElement(ScrollView, {
|
|
68
|
+
style: styles.platformList
|
|
69
|
+
}, Object.keys(PLATFORMS).map(platform => {
|
|
70
|
+
var _connections;
|
|
71
|
+
const platformInfo = PLATFORMS[platform];
|
|
72
|
+
const isConnected = getPlatformStatus(platform);
|
|
73
|
+
const userName = isConnected ? (_connections = connections[platform]) === null || _connections === void 0 ? void 0 : _connections.userName : null;
|
|
74
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
75
|
+
key: platform,
|
|
76
|
+
style: styles.platformItem
|
|
77
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
78
|
+
style: styles.platformInfo
|
|
79
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
80
|
+
style: [styles.platformIcon, {
|
|
81
|
+
backgroundColor: platformInfo.color
|
|
82
|
+
}]
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
84
|
+
name: platformInfo.icon,
|
|
85
|
+
size: 24,
|
|
86
|
+
color: "#fff"
|
|
87
|
+
})), /*#__PURE__*/React.createElement(View, {
|
|
88
|
+
style: styles.platformText
|
|
89
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
90
|
+
style: styles.platformName
|
|
91
|
+
}, platformInfo.name), /*#__PURE__*/React.createElement(Text, {
|
|
92
|
+
style: styles.platformDescription
|
|
93
|
+
}, isConnected ? `Connected as ${userName}` : platformInfo.description))), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
94
|
+
style: [styles.platformButton, isConnected ? styles.disconnectButton : styles.connectButton],
|
|
95
|
+
onPress: () => isConnected ? handleDisconnectPress(platform) : handleConnectPress(platform),
|
|
96
|
+
disabled: isLoading
|
|
97
|
+
}, isLoading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
98
|
+
size: "small",
|
|
99
|
+
color: "#fff"
|
|
100
|
+
}) : /*#__PURE__*/React.createElement(Text, {
|
|
101
|
+
style: styles.buttonText
|
|
102
|
+
}, isConnected ? 'Disconnect' : 'Connect')));
|
|
103
|
+
})), /*#__PURE__*/React.createElement(View, {
|
|
104
|
+
style: styles.footer
|
|
105
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
106
|
+
style: styles.connectionStatus
|
|
107
|
+
}, getConnectedCount(), " of ", Object.keys(PLATFORMS).length, " platforms connected"), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
108
|
+
style: [styles.proceedButton, canProceed ? styles.proceedActive : styles.proceedInactive],
|
|
109
|
+
onPress: onProceed,
|
|
110
|
+
disabled: !canProceed
|
|
111
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
112
|
+
style: [styles.proceedText, canProceed ? styles.proceedTextActive : styles.proceedTextInactive]
|
|
113
|
+
}, "Continue"), /*#__PURE__*/React.createElement(Icon, {
|
|
114
|
+
name: "arrow-forward",
|
|
115
|
+
size: 20,
|
|
116
|
+
color: canProceed ? '#fff' : '#999'
|
|
117
|
+
}))), activeWebview && /*#__PURE__*/React.createElement(OAuthWebView, {
|
|
118
|
+
url: `https://oauth.example.com/${activeWebview}` // This would be replaced with actual OAuth URL
|
|
119
|
+
,
|
|
120
|
+
platform: activeWebview,
|
|
121
|
+
onComplete: handleWebViewComplete,
|
|
122
|
+
onClose: handleWebViewClose,
|
|
123
|
+
onSuccess: code => {
|
|
124
|
+
console.log(`Received authorization code for ${activeWebview}: ${code}`);
|
|
125
|
+
// In a real implementation, we'd pass this code to our API service
|
|
126
|
+
handleWebViewComplete();
|
|
127
|
+
}
|
|
128
|
+
}));
|
|
129
|
+
};
|
|
130
|
+
const styles = StyleSheet.create({
|
|
131
|
+
container: {
|
|
132
|
+
flex: 1,
|
|
133
|
+
padding: 16
|
|
134
|
+
},
|
|
135
|
+
title: {
|
|
136
|
+
fontSize: 24,
|
|
137
|
+
fontWeight: 'bold',
|
|
138
|
+
marginBottom: 8,
|
|
139
|
+
color: '#000'
|
|
140
|
+
},
|
|
141
|
+
subtitle: {
|
|
142
|
+
fontSize: 16,
|
|
143
|
+
color: '#666',
|
|
144
|
+
marginBottom: 24
|
|
145
|
+
},
|
|
146
|
+
platformList: {
|
|
147
|
+
flex: 1
|
|
148
|
+
},
|
|
149
|
+
platformItem: {
|
|
150
|
+
flexDirection: 'row',
|
|
151
|
+
alignItems: 'center',
|
|
152
|
+
marginBottom: 16,
|
|
153
|
+
padding: 12,
|
|
154
|
+
backgroundColor: '#f8f8f8',
|
|
155
|
+
borderRadius: 12,
|
|
156
|
+
borderWidth: 1,
|
|
157
|
+
borderColor: '#eee'
|
|
158
|
+
},
|
|
159
|
+
platformInfo: {
|
|
160
|
+
flex: 1,
|
|
161
|
+
flexDirection: 'row',
|
|
162
|
+
alignItems: 'center'
|
|
163
|
+
},
|
|
164
|
+
platformIcon: {
|
|
165
|
+
width: 40,
|
|
166
|
+
height: 40,
|
|
167
|
+
borderRadius: 20,
|
|
168
|
+
justifyContent: 'center',
|
|
169
|
+
alignItems: 'center',
|
|
170
|
+
marginRight: 12
|
|
171
|
+
},
|
|
172
|
+
platformText: {
|
|
173
|
+
flex: 1
|
|
174
|
+
},
|
|
175
|
+
platformName: {
|
|
176
|
+
fontSize: 16,
|
|
177
|
+
fontWeight: '600',
|
|
178
|
+
marginBottom: 4,
|
|
179
|
+
color: '#000'
|
|
180
|
+
},
|
|
181
|
+
platformDescription: {
|
|
182
|
+
fontSize: 14,
|
|
183
|
+
color: '#666'
|
|
184
|
+
},
|
|
185
|
+
platformButton: {
|
|
186
|
+
paddingHorizontal: 16,
|
|
187
|
+
paddingVertical: 8,
|
|
188
|
+
borderRadius: 20,
|
|
189
|
+
justifyContent: 'center',
|
|
190
|
+
alignItems: 'center',
|
|
191
|
+
minWidth: 100
|
|
192
|
+
},
|
|
193
|
+
connectButton: {
|
|
194
|
+
backgroundColor: COLORS.primary
|
|
195
|
+
},
|
|
196
|
+
disconnectButton: {
|
|
197
|
+
backgroundColor: '#f44336'
|
|
198
|
+
},
|
|
199
|
+
buttonText: {
|
|
200
|
+
color: '#fff',
|
|
201
|
+
fontWeight: '600'
|
|
202
|
+
},
|
|
203
|
+
footer: {
|
|
204
|
+
flexDirection: 'row',
|
|
205
|
+
alignItems: 'center',
|
|
206
|
+
justifyContent: 'space-between',
|
|
207
|
+
paddingTop: 16,
|
|
208
|
+
borderTopWidth: 1,
|
|
209
|
+
borderTopColor: '#eee',
|
|
210
|
+
marginTop: 16
|
|
211
|
+
},
|
|
212
|
+
connectionStatus: {
|
|
213
|
+
fontSize: 14,
|
|
214
|
+
color: '#666'
|
|
215
|
+
},
|
|
216
|
+
proceedButton: {
|
|
217
|
+
flexDirection: 'row',
|
|
218
|
+
alignItems: 'center',
|
|
219
|
+
paddingHorizontal: 16,
|
|
220
|
+
paddingVertical: 10,
|
|
221
|
+
borderRadius: 24
|
|
222
|
+
},
|
|
223
|
+
proceedActive: {
|
|
224
|
+
backgroundColor: COLORS.primary
|
|
225
|
+
},
|
|
226
|
+
proceedInactive: {
|
|
227
|
+
backgroundColor: '#eee'
|
|
228
|
+
},
|
|
229
|
+
proceedText: {
|
|
230
|
+
fontWeight: '600',
|
|
231
|
+
marginRight: 8
|
|
232
|
+
},
|
|
233
|
+
proceedTextActive: {
|
|
234
|
+
color: '#fff'
|
|
235
|
+
},
|
|
236
|
+
proceedTextInactive: {
|
|
237
|
+
color: '#999'
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
//# sourceMappingURL=PlatformConnector.js.map
|