@onairos/react-native 3.7.2 → 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/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/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,92 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, StyleSheet, TouchableOpacity, Text } from 'react-native';
|
|
3
|
+
import { COLORS, SPACING } from '../theme';
|
|
4
|
+
const ModalHeader = ({
|
|
5
|
+
onClose,
|
|
6
|
+
onBack,
|
|
7
|
+
showGrabber = true,
|
|
8
|
+
showBackButton = false
|
|
9
|
+
}) => {
|
|
10
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, showGrabber && /*#__PURE__*/React.createElement(View, {
|
|
11
|
+
style: styles.grabberContainer
|
|
12
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
13
|
+
style: styles.grabber
|
|
14
|
+
})), /*#__PURE__*/React.createElement(View, {
|
|
15
|
+
style: styles.container
|
|
16
|
+
}, showBackButton ? /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
17
|
+
style: styles.closeButton,
|
|
18
|
+
onPress: onBack,
|
|
19
|
+
activeOpacity: 0.7,
|
|
20
|
+
accessibilityLabel: "Go back",
|
|
21
|
+
accessibilityRole: "button"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
23
|
+
style: styles.backText
|
|
24
|
+
}, "\u2190")) : /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
25
|
+
style: styles.closeButton,
|
|
26
|
+
onPress: onClose,
|
|
27
|
+
activeOpacity: 0.7,
|
|
28
|
+
accessibilityLabel: "Close",
|
|
29
|
+
accessibilityRole: "button"
|
|
30
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
31
|
+
style: styles.closeText
|
|
32
|
+
}, "\u2715")), /*#__PURE__*/React.createElement(View, {
|
|
33
|
+
style: styles.centerSpacer
|
|
34
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
35
|
+
style: styles.spacer
|
|
36
|
+
})));
|
|
37
|
+
};
|
|
38
|
+
const styles = StyleSheet.create({
|
|
39
|
+
grabberContainer: {
|
|
40
|
+
width: '100%',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
paddingTop: 12,
|
|
43
|
+
paddingBottom: 4
|
|
44
|
+
},
|
|
45
|
+
grabber: {
|
|
46
|
+
width: 100,
|
|
47
|
+
// Made even longer (was 80)
|
|
48
|
+
height: 6,
|
|
49
|
+
backgroundColor: '#D0D0D0',
|
|
50
|
+
borderRadius: 3
|
|
51
|
+
},
|
|
52
|
+
container: {
|
|
53
|
+
flexDirection: 'row',
|
|
54
|
+
alignItems: 'flex-start',
|
|
55
|
+
justifyContent: 'flex-start',
|
|
56
|
+
height: 44,
|
|
57
|
+
paddingTop: 0,
|
|
58
|
+
// Keep X button high
|
|
59
|
+
paddingLeft: 4,
|
|
60
|
+
// Move X button even further left
|
|
61
|
+
marginBottom: SPACING.md
|
|
62
|
+
},
|
|
63
|
+
closeButton: {
|
|
64
|
+
width: 36,
|
|
65
|
+
// Slightly larger for better touch
|
|
66
|
+
height: 36,
|
|
67
|
+
justifyContent: 'center',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
marginTop: 0 // Remove top margin to move X higher
|
|
70
|
+
// Remove background and border radius
|
|
71
|
+
},
|
|
72
|
+
closeText: {
|
|
73
|
+
fontSize: 20,
|
|
74
|
+
color: COLORS.grey800,
|
|
75
|
+
fontWeight: '500'
|
|
76
|
+
},
|
|
77
|
+
backText: {
|
|
78
|
+
fontSize: 24,
|
|
79
|
+
color: COLORS.grey800,
|
|
80
|
+
fontWeight: '500'
|
|
81
|
+
},
|
|
82
|
+
centerSpacer: {
|
|
83
|
+
flex: 1
|
|
84
|
+
},
|
|
85
|
+
spacer: {
|
|
86
|
+
width: 44,
|
|
87
|
+
height: 44
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
export { ModalHeader };
|
|
91
|
+
export default ModalHeader;
|
|
92
|
+
//# sourceMappingURL=ModalHeader.js.map
|
|
@@ -1 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, StyleSheet } from 'react-native';
|
|
3
|
+
// Temporarily remove safe area hook to fix RCTEventEmitter error
|
|
4
|
+
// import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
|
+
import { COLORS, BORDER_RADIUS, SPACING } from '../theme';
|
|
6
|
+
const ModalSheet = ({
|
|
7
|
+
children,
|
|
8
|
+
topPadding = SPACING.modalTopPadding,
|
|
9
|
+
onClose,
|
|
10
|
+
showGrabber = true,
|
|
11
|
+
style
|
|
12
|
+
}) => {
|
|
13
|
+
// Use fallback values instead of safe area hook to avoid RCTEventEmitter error
|
|
14
|
+
const insets = {
|
|
15
|
+
bottom: 20
|
|
16
|
+
}; // Fallback safe area
|
|
17
|
+
|
|
18
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
19
|
+
style: [styles.container, {
|
|
20
|
+
paddingTop: topPadding,
|
|
21
|
+
paddingBottom: insets.bottom || SPACING.lg
|
|
22
|
+
}, style]
|
|
23
|
+
}, children);
|
|
24
|
+
};
|
|
25
|
+
const styles = StyleSheet.create({
|
|
26
|
+
container: {
|
|
27
|
+
backgroundColor: COLORS.surface,
|
|
28
|
+
borderTopLeftRadius: BORDER_RADIUS.modalTop,
|
|
29
|
+
borderTopRightRadius: BORDER_RADIUS.modalTop,
|
|
30
|
+
borderBottomLeftRadius: 0,
|
|
31
|
+
borderBottomRightRadius: 0,
|
|
32
|
+
paddingHorizontal: SPACING.modalHorizontal,
|
|
33
|
+
flex: 1,
|
|
34
|
+
minHeight: '80%' // Ensure modal takes substantial screen space
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export { ModalSheet };
|
|
38
|
+
export default ModalSheet;
|
|
39
|
+
//# sourceMappingURL=ModalSheet.js.map
|
|
@@ -1 +1,373 @@
|
|
|
1
|
-
import React,{forwardRef,useImperativeHandle,useState,useCallback,useEffect}from'react';function _0x185b(_0xb404ae,_0x185b0c){_0xb404ae=_0xb404ae-0x0;const _0x104309=_0xb404();let _0x49a8e1=_0x104309[_0xb404ae];return _0x49a8e1;}import{StyleSheet,View,TouchableOpacity,Text,Image,Alert}from'react-native';import{UniversalOnboarding}from'./UniversalOnboarding';import{COLORS}from'../constants';import{hasCredentials,getCredentials}from'../utils/secureStorage';function _0xb404(){const _0x5d0286=['FwBuS','hPFgN','API\x20key\x20is\x20required.\x20Please\x20provide\x20a\x20valid\x20API\x20key\x20from\x20your\x20Onairos\x20dashboard.','✅\x20Onairos\x20SDK:\x20API\x20key\x20initialization\x20completed\x20successfully','6|1|0|2|3|4|5','3.\x20Ensure\x20your\x20environment\x20setting\x20matches\x20your\x20API\x20key','4.\x20Check\x20your\x20internet\x20connection','VIZQO','✅\x20Onairos\x20component:\x20SDK\x20already\x20initialized,\x20syncing\x20state','🔘\x20Button\x20pressed!\x20isInitialized:','isInitializing:','showOverlay:','YrnCl','yeCAk','SDK\x20not\x20initialized.\x20Please\x20check\x20your\x20API\x20key.','❌\x20Cannot\x20open\x20overlay:\x20SDK\x20not\x20initialized','UOQyJ','SDK\x20Error','🔍\x20Running\x20pre-check\x20validation...','tuZIi','rPmBT','🔍\x20Checking\x20for\x20existing\x20credentials...','gGvIq','EevbB','✅\x20Resolving\x20with\x20existing\x20credentials','⚠️\x20Failed\x20to\x20retrieve\x20existing\x20credentials:','🎨\x20Opening\x20Onairos\x20overlay...','❌\x20Error\x20opening\x20overlay:','🔽\x20showOverlay\x20set\x20to\x20false','❌\x20Overlay\x20rejected:','FqLPl','ypWdI','pill','row','#fff','5.\x20Visit\x20https://dashboard.onairos.uk\x20to\x20manage\x20your\x20API\x20keys','kypYA','connect','Connect\x20with\x20Onairos','Continue\x20with\x20Onairos','normal','production','LiYpA','#FF6B6B','⚠️\x20SDK\x20Error','EJmFd','#999','🔄\x20Initializing...','#000','KGPKX','default','primary','JBUal','GXOjM','SAEUa','qFHUn','eQyFP','PrLTA','NTCkk','CkKCg','createElement','errorContainer','alert','\x0a\x0aPlease\x20check\x20your\x20API\x20key\x20and\x20try\x20again.','errorButtonText','CjfSG','GGlJG','log','pYwVw','kmxfn','length','message','OKGkK','error','❌\x20Onairos\x20SDK:\x20API\x20key\x20initialization\x20failed:','KPNfw','IhfLE','CMeyI','split','nQmgO','gjoVb','KMxMW','oaCWr','groupEnd','group','dcMBd','eCalj','hiOSR','VYSCV','apiKey','EpauT','OvarW','2|6|0|3|1|5|4','2.\x20Verify\x20you\x20have\x20the\x20right\x20permissions\x20for\x20your\x20use\x20case','tACGd','SDK\x20initialization\x20failed:\x20','TMCOg','jxSWy','TiFKU','Tonqa','fuIlD','jxKZm','WkiJk','kYtPu','BoGdy','fdbFm','SJXIm','AvnmU','XYAoy','qgREA','LHsxt','EookV','ueAfH','tQxua','ZsCAw','Pre-check\x20failed:\x20','KjTud','fIkMq','VjCdx','BASE_URL','/user/data','existing_user_token','dyoMZ','Mthze','warn','vxvom','rwVdY','XkWNN','TDpPx','Failed\x20to\x20open\x20overlay:\x20','KiJLF','KyrMT','ODlpW','RlAuF','ARBnG','token','userData','hgjEb','rBJCY','errorButton','XKNbZ','tqrgj','jvLwG','Onairos\x20SDK\x20initialization\x20failed:\x0a\x0a','QeisG','GOCrh','loadingContainer','loadingButton','AAFqp','NJWJA','XPEYZ','EzTOX','zNIgo','pNtBv','dFgQK','borderWidth','borderColor','3|1|2|6|0|5|4','JDfFw','SyGQG','DTWJa','zuidY','CrJEo','wxjmM','UOedJ','EIvAG','🔧\x20API\x20Key\x20Troubleshooting\x20Guide','TqlFf','SCuyY','Fragment','logo','contain','buttonText','piBzd','enhZk','hrdKK','create','center','600'];_0xb404=function(){return _0x5d0286;};return _0xb404();}import{initializeApiKey,isApiKeyInitialized,getApiConfig}from'../services/apiKeyService';import{API_CONFIG}from'../config/api';import{BRAND_IMAGES}from'../utils/assetRegistry';export const Onairos=forwardRef((_0x3085fb,_0x584b1a)=>{const _0x4d5731={'pYwVw':function(_0x5da2a4,_0x51a700){return _0x5da2a4===_0x51a700;},'NTCkk':_0x185b(0x0),'CkKCg':_0x185b(0x1),'CjfSG':function(_0x1fea14,_0x117497){return _0x1fea14(_0x117497);},'GGlJG':function(_0x2ae838,_0x2435bd){return _0x2ae838(_0x2435bd);},'PxJjb':'qXgGg','kmxfn':_0x185b(0x2),'UadLZ':_0x185b(0x3),'LHsxt':'📊\x20Configuration:','OKGkK':'Unknown\x20initialization\x20error','KPNfw':function(_0x7a4ada,_0x4713a6){return _0x7a4ada(_0x4713a6);},'IhfLE':function(_0x106c5f,_0x326df2){return _0x106c5f(_0x326df2);},'CMeyI':_0x185b(0x4),'nQmgO':'2.\x20Verify\x20you\x20have\x20the\x20right\x20permissions\x20for\x20your\x20use\x20case','gjoVb':'1.\x20Check\x20that\x20your\x20API\x20key\x20is\x20correct\x20and\x20not\x20expired','KMxMW':_0x185b(0x5),'oaCWr':_0x185b(0x6),'tACGd':'🔧\x20API\x20Key\x20Troubleshooting\x20Guide','dcMBd':function(_0x2e461e,_0x52dd54){return _0x2e461e===_0x52dd54;},'eCalj':'MBcry','jxSWy':function(_0x1052ab,_0x45cc61){return _0x1052ab(_0x45cc61);},'eQyFP':function(_0x16dcaf,_0x67c2af){return _0x16dcaf===_0x67c2af;},'PrLTA':_0x185b(0x7),'Jwvjo':function(_0x3d495d){return _0x3d495d();},'hiOSR':function(_0xe151fc,_0x73a4a3){return _0xe151fc!==_0x73a4a3;},'KcaAD':function(_0x388ea8){return _0x388ea8();},'VYSCV':function(_0x4bcda8,_0x1e5ccd){return _0x4bcda8===_0x1e5ccd;},'EpauT':function(_0x5cd802){return _0x5cd802();},'SAEUa':function(_0x78289d,_0x129571){return _0x78289d(_0x129571);},'OvarW':_0x185b(0x8),'qgREA':function(_0x297c97,_0x3c58bc){return _0x297c97(_0x3c58bc);},'tQxua':function(_0x4e53bc,_0x42b1df){return _0x4e53bc(_0x42b1df);},'TDpPx':function(_0x38aa66,_0x54088c){return _0x38aa66(_0x54088c);},'TiFKU':_0x185b(0x9),'Tonqa':_0x185b(0xa),'fuIlD':_0x185b(0xb),'gSQDN':_0x185b(0xc),'HQKRz':_0x185b(0xd),'QeisG':function(_0x12775b,_0x2296db){return _0x12775b||_0x2296db;},'jxKZm':_0x185b(0xe),'vBIrP':_0x185b(0xf),'WkiJk':_0x185b(0x10),'kYtPu':'aOnnU','BoGdy':function(_0x1d4a65,_0x2f371d){return _0x1d4a65(_0x2f371d);},'fdbFm':_0x185b(0x11),'SJXIm':_0x185b(0x12),'AvnmU':function(_0x1e51bd,_0x5a5a07){return _0x1e51bd===_0x5a5a07;},'XYAoy':_0x185b(0x13),'EookV':_0x185b(0x14),'ueAfH':'✅\x20Pre-check\x20passed','ZsCAw':'❌\x20Pre-check\x20error:','KjTud':_0x185b(0x15),'fIkMq':function(_0x36da62){return _0x36da62();},'VjCdx':_0x185b(0x16),'dyoMZ':_0x185b(0x17),'Mthze':_0x185b(0x18),'vxvom':_0x185b(0x19),'rwVdY':_0x185b(0x1a),'XkWNN':function(_0xdada40,_0x4507ca){return _0xdada40(_0x4507ca);},'KiJLF':_0x185b(0x1b),'ODlpW':_0x185b(0x1c),'RlAuF':function(_0x484009,_0x31262f){return _0x484009&&_0x31262f;},'ARBnG':function(_0x4f3250,_0x259c26,_0x2f185a,_0x468d77){return _0x4f3250(_0x259c26,_0x2f185a,_0x468d77);},'qemgZ':function(_0x4ef656,_0x211a07){return _0x4ef656(_0x211a07);},'YieZQ':_0x185b(0x1d),'tqrgj':_0x185b(0x1e),'jvLwG':_0x185b(0x1f),'GOCrh':function(_0x2fa188,_0x4ebb4a){return _0x2fa188(_0x4ebb4a);},'XPEYZ':function(_0x2ea3e1,_0x245088){return _0x2ea3e1===_0x245088;},'EzTOX':_0x185b(0x20),'zNIgo':function(_0x5b54cd,_0x30af40){return _0x5b54cd/_0x30af40;},'pNtBv':'center','dFgQK':_0x185b(0x21),'enhZk':_0x185b(0x22),'UccXL':_0x185b(0x23),'JDfFw':function(_0x448bee,_0x1a2b88){return _0x448bee!==_0x1a2b88;},'WaXpB':_0x185b(0x24),'SyGQG':'tbTtz','DTWJa':_0x185b(0x25),'zuidY':_0x185b(0x26),'CrJEo':_0x185b(0x27),'KGPKX':_0x185b(0x28),'JBUal':_0x185b(0x29),'GXOjM':function(_0x2c31ef,_0x1bb510){return _0x2c31ef(_0x1bb510);},'qFHUn':function(_0x55e053,_0x3550df){return _0x55e053(_0x3550df);},'TMCOg':function(_0x36d740,_0x27c9bf,_0x326c64){return _0x36d740(_0x27c9bf,_0x326c64);},'KyrMT':function(_0x43589c,_0x5c42b1,_0x34bddd){return _0x43589c(_0x5c42b1,_0x34bddd);},'hgjEb':function(_0x176035,_0x2f10ea){return _0x176035===_0x2f10ea;},'rBJCY':_0x185b(0x2a),'XKNbZ':_0x185b(0x2b),'kQYwU':_0x185b(0x2c),'smRjr':function(_0x1217c1,_0x4f762a){return _0x1217c1!==_0x4f762a;},'KuuMj':_0x185b(0x2d),'AAFqp':_0x185b(0x2e),'NJWJA':_0x185b(0x2f),'piBzd':_0x185b(0x30),'hrdKK':function(_0x5246b0,_0x2b644c){return _0x5246b0||_0x2b644c;}},{returnLink:_0x598260,prefillUrl:_0x49397e,AppName:_0x1c3cec,buttonType:buttonType=_0x4d5731[_0x185b(0x31)],requestData:_0x5d7e8a,buttonWidth:buttonWidth=0xc8,buttonHeight:buttonHeight=0x30,hasStroke:hasStroke=![],enabled:enabled=!![],buttonForm:buttonForm=_0x185b(0x32),onRejection:_0x35c5d4,onResolved:_0xcaff2d,preCheck:_0x10023b,color:color=COLORS[_0x185b(0x33)],debug:debug=![],darkMode:darkMode=![],preferredPlatform:_0x2a1e94,testMode:testMode=![],apiKey:_0x42834b,environment:environment=_0x4d5731[_0x185b(0x34)],enableLogging:enableLogging=!![],timeout:timeout=0x7530,retryAttempts:retryAttempts=0x3}=_0x3085fb,[_0x159ee9,_0x3071e1]=useState(![]),[_0xa7538f,_0x14676e]=_0x4d5731[_0x185b(0x35)](useState,![]),[_0x4f5c2a,_0x113f9f]=_0x4d5731[_0x185b(0x36)](useState,null),[_0x2db48d,_0x596e09]=_0x4d5731[_0x185b(0x37)](useState,![]);_0x4d5731['TMCOg'](useEffect,()=>{if(_0x4d5731[_0x185b(0x38)](_0x4d5731[_0x185b(0x39)],_0x4d5731['PrLTA'])){var _0x251a41;let _0x4cb813=!![];const _0x388f2e=async()=>{if(_0x4d5731['pYwVw'](_0x4d5731[_0x185b(0x3a)],_0x4d5731[_0x185b(0x3b)]))return React[_0x185b(0x3c)](View,{'style':_0x4dfa48[_0x185b(0x3d)]},React[_0x185b(0x3c)](TouchableOpacity,{'style':[_0x4b1bc7['errorButton'],{'backgroundColor':_0x185b(0x2b)}],'onPress':()=>{Alert[_0x185b(0x3e)](_0x185b(0x11),'Onairos\x20SDK\x20initialization\x20failed:\x0a\x0a'+_0x40c4f3+_0x185b(0x3f),[{'text':'OK'}]);}},React[_0x185b(0x3c)](Text,{'style':_0x6b65b7[_0x185b(0x40)]},_0x185b(0x2c))));else{if(_0x2db48d)return;_0x4d5731[_0x185b(0x41)](_0x596e09,!![]),_0x4d5731[_0x185b(0x42)](_0x113f9f,null);try{console[_0x185b(0x43)]('🚀\x20Onairos\x20SDK:\x20Starting\x20API\x20key\x20initialization...');if(!_0x42834b){if(_0x4d5731[_0x185b(0x44)](_0x4d5731['PxJjb'],_0x4d5731['PxJjb']))throw new Error(_0x4d5731[_0x185b(0x45)]);else _0x32c2e9[_0x185b(0x43)]('✅\x20Resolving\x20with\x20existing\x20credentials');}const _0x59be8b={'apiKey':_0x42834b,'environment':environment,'enableLogging':enableLogging,'timeout':timeout,'retryAttempts':retryAttempts};await _0x4d5731['GGlJG'](initializeApiKey,_0x59be8b),_0x4cb813&&(_0x14676e(!![]),_0x4d5731[_0x185b(0x42)](_0x113f9f,null),enableLogging&&(console['log'](_0x4d5731['UadLZ']),console[_0x185b(0x43)](_0x4d5731['LHsxt'],{'environment':environment,'enableLogging':enableLogging,'timeout':timeout,'retryAttempts':retryAttempts,'apiKeyLength':_0x42834b[_0x185b(0x46)]})));}catch(_0x4a98dd){const _0x5e1528=_0x4a98dd instanceof Error?_0x4a98dd[_0x185b(0x47)]:_0x4d5731[_0x185b(0x48)];console[_0x185b(0x49)](_0x185b(0x4a),_0x5e1528);if(_0x4cb813){_0x4d5731[_0x185b(0x4b)](_0x14676e,![]),_0x4d5731[_0x185b(0x4c)](_0x113f9f,_0x5e1528);if(enableLogging){const _0x20f4d2=_0x4d5731[_0x185b(0x4d)][_0x185b(0x4e)]('|');let _0x3f811a=0x0;while(!![]){switch(_0x20f4d2[_0x3f811a++]){case'0':console[_0x185b(0x43)](_0x4d5731[_0x185b(0x4f)]);continue;case'1':console[_0x185b(0x43)](_0x4d5731[_0x185b(0x50)]);continue;case'2':console[_0x185b(0x43)](_0x4d5731[_0x185b(0x51)]);continue;case'3':console[_0x185b(0x43)](_0x4d5731[_0x185b(0x52)]);continue;case'4':console[_0x185b(0x43)]('5.\x20Visit\x20https://dashboard.onairos.uk\x20to\x20manage\x20your\x20API\x20keys');continue;case'5':console[_0x185b(0x53)]();continue;case'6':console[_0x185b(0x54)](_0x4d5731['tACGd']);continue;}break;}}_0x35c5d4&&(_0x4d5731[_0x185b(0x55)](_0x4d5731[_0x185b(0x56)],_0x4d5731[_0x185b(0x56)])?_0x35c5d4('SDK\x20initialization\x20failed:\x20'+_0x5e1528):_0x6ed638[_0x185b(0x43)](_0x185b(0x8)));}}finally{_0x4cb813&&_0x596e09(![]);}}};if(_0x42834b&&(!_0x4d5731['Jwvjo'](isApiKeyInitialized)||_0x4d5731[_0x185b(0x57)](_0x4d5731[_0x185b(0x38)](_0x251a41=_0x4d5731['KcaAD'](getApiConfig),null)||_0x4d5731[_0x185b(0x58)](_0x251a41,void 0x0)?void 0x0:_0x251a41[_0x185b(0x59)],_0x42834b)))_0x4d5731[_0x185b(0x5a)](_0x388f2e);else isApiKeyInitialized()&&(_0x4d5731[_0x185b(0x36)](_0x14676e,!![]),_0x596e09(![]),enableLogging&&console['log'](_0x4d5731[_0x185b(0x5b)]));return()=>{_0x4cb813=![];};}else{_0x5ea92b(![]),_0x5ce4dc(_0x44daac);if(_0x46c8fa){const _0x15ec65=_0x185b(0x5c)[_0x185b(0x4e)]('|');let _0xcb18d9=0x0;while(!![]){switch(_0x15ec65[_0xcb18d9++]){case'0':_0x1e0e53[_0x185b(0x43)](_0x185b(0x5d));continue;case'1':_0x4b9fb7[_0x185b(0x43)](_0x4d5731[_0x185b(0x52)]);continue;case'2':_0x1dddbd[_0x185b(0x54)](_0x4d5731[_0x185b(0x5e)]);continue;case'3':_0xdd3bd0[_0x185b(0x43)](_0x4d5731[_0x185b(0x51)]);continue;case'4':_0x52311f[_0x185b(0x53)]();continue;case'5':_0x55c141[_0x185b(0x43)]('5.\x20Visit\x20https://dashboard.onairos.uk\x20to\x20manage\x20your\x20API\x20keys');continue;case'6':_0x36a9b5['log'](_0x4d5731[_0x185b(0x50)]);continue;}break;}}_0x2e3536&&_0x4d5731['jxSWy'](_0x284820,_0x185b(0x5f)+_0x17b950);}},[_0x42834b,environment,enableLogging,timeout,retryAttempts,_0x35c5d4]),_0x4d5731[_0x185b(0x60)](useImperativeHandle,_0x584b1a,()=>({'openOverlay':_0x5a799f,'closeOverlay':_0xefe680,'isInitialized':()=>_0xa7538f,'getApiConfig':()=>getApiConfig()}));const _0x5a799f=useCallback(async()=>{const _0x4bc3a9={'XbBYY':function(_0x10a08e,_0x353ebf){return _0x4d5731[_0x185b(0x61)](_0x10a08e,_0x353ebf);}};console[_0x185b(0x43)](_0x4d5731[_0x185b(0x62)],_0xa7538f,_0x4d5731[_0x185b(0x63)],_0x2db48d,_0x4d5731[_0x185b(0x64)],_0x159ee9);try{if(_0x4d5731[_0x185b(0x57)](_0x4d5731['gSQDN'],_0x4d5731['HQKRz'])){if(!_0xa7538f){const _0x5a01b3=_0x4d5731['QeisG'](_0x4f5c2a,_0x4d5731[_0x185b(0x65)]);console[_0x185b(0x49)](_0x4d5731['vBIrP']);_0x35c5d4?_0x4d5731[_0x185b(0x66)]!==_0x4d5731[_0x185b(0x67)]?_0x4d5731[_0x185b(0x68)](_0x35c5d4,_0x5a01b3):_0x16dc8a=![]:Alert[_0x185b(0x3e)](_0x4d5731[_0x185b(0x69)],_0x5a01b3,[{'text':'OK'}]);return;}if(_0x10023b){enableLogging&&console[_0x185b(0x43)](_0x4d5731[_0x185b(0x6a)]);try{if(_0x4d5731[_0x185b(0x6b)](_0x4d5731[_0x185b(0x6c)],'DjJWz'))_0x4d5731[_0x185b(0x61)](_0x49a108,!![]),_0x4d5731[_0x185b(0x6d)](_0x85c68a,null),_0x2e6fdf&&(_0x38cc2c['log'](_0x185b(0x3)),_0x5cc346[_0x185b(0x43)](_0x4d5731[_0x185b(0x6e)],{'environment':_0x3f1019,'enableLogging':_0x3bcea6,'timeout':_0x4f82ca,'retryAttempts':_0x391154,'apiKeyLength':_0x5602fb[_0x185b(0x46)]}));else{const _0x547bac=await _0x10023b();if(!_0x547bac){enableLogging&&console[_0x185b(0x43)]('⛔\x20Pre-check\x20failed,\x20aborting\x20overlay');return;}enableLogging&&(_0x4d5731[_0x185b(0x44)](_0x4d5731[_0x185b(0x6f)],_0x4d5731[_0x185b(0x6f)])?console[_0x185b(0x43)](_0x4d5731[_0x185b(0x70)]):_0x4d5731[_0x185b(0x71)](_0x16fb4a,_0x579099));}}catch(_0x2c86cd){console[_0x185b(0x49)](_0x4d5731[_0x185b(0x72)],_0x2c86cd);_0x35c5d4&&_0x4d5731['tQxua'](_0x35c5d4,_0x185b(0x73)+_0x2c86cd[_0x185b(0x47)]);return;}}enableLogging&&console['log'](_0x4d5731[_0x185b(0x74)]);const _0x513cf0=await _0x4d5731[_0x185b(0x75)](hasCredentials);if(_0x513cf0){enableLogging&&console['log']('🔑\x20Existing\x20credentials\x20found,\x20attempting\x20automatic\x20resolution...');try{const _0x9e227c=await _0x4d5731['KcaAD'](getCredentials);if(_0x9e227c&&_0xcaff2d){if(_0x4d5731['hiOSR'](_0x185b(0x16),_0x4d5731[_0x185b(0x76)]))throw new _0x7e990e('API\x20key\x20is\x20required.\x20Please\x20provide\x20a\x20valid\x20API\x20key\x20from\x20your\x20Onairos\x20dashboard.');else{const _0x268068=API_CONFIG[_0x185b(0x77)]+_0x185b(0x78),_0x55f9a6=_0x185b(0x79);enableLogging&&(_0x4d5731[_0x185b(0x7a)]===_0x4d5731['dyoMZ']?console[_0x185b(0x43)](_0x4d5731[_0x185b(0x7b)]):_0x4bc3a9['XbBYY'](_0x25f536,_0x5248be));_0xcaff2d(_0x268068,_0x55f9a6,_0x9e227c);return;}}}catch(_0x336bbf){console[_0x185b(0x7c)](_0x4d5731[_0x185b(0x7d)],_0x336bbf);}}enableLogging&&console[_0x185b(0x43)](_0x4d5731[_0x185b(0x7e)]),_0x4d5731[_0x185b(0x7f)](_0x3071e1,!![]);}else _0x4d5731[_0x185b(0x80)](_0x5b3264,_0x185b(0x81)+_0x49a2c0[_0x185b(0x47)]);}catch(_0x2066fc){console['error'](_0x4d5731[_0x185b(0x82)],_0x2066fc),_0x35c5d4&&_0x4d5731[_0x185b(0x4b)](_0x35c5d4,_0x185b(0x81)+_0x2066fc[_0x185b(0x47)]);}},[_0xa7538f,_0x4f5c2a,_0x10023b,enableLogging,_0x35c5d4,_0xcaff2d]),_0xefe680=_0x4d5731[_0x185b(0x83)](useCallback,_0x45902f=>{console['log']('🔽\x20Closing\x20Onairos\x20overlay,\x20result:',_0x45902f),_0x4d5731[_0x185b(0x41)](_0x3071e1,![]),console['log'](_0x4d5731[_0x185b(0x84)]),_0x4d5731[_0x185b(0x85)](_0x45902f,_0xcaff2d)&&_0x4d5731[_0x185b(0x86)](_0xcaff2d,_0x45902f['apiUrl'],_0x45902f[_0x185b(0x87)],_0x45902f[_0x185b(0x88)]);},[enableLogging,_0xcaff2d]),_0x4105af=_0x4d5731[_0x185b(0x83)](useCallback,_0x53f253=>{enableLogging&&console[_0x185b(0x43)](_0x185b(0x1d),_0x53f253),_0x4d5731['qgREA'](_0x3071e1,![]),_0x35c5d4&&_0x4d5731['qemgZ'](_0x35c5d4,_0x53f253);},[enableLogging,_0x35c5d4]);if(_0x4f5c2a&&!_0x2db48d){if(_0x4d5731[_0x185b(0x89)](_0x4d5731['rBJCY'],_0x4d5731[_0x185b(0x8a)]))return React[_0x185b(0x3c)](View,{'style':styles['errorContainer']},React['createElement'](TouchableOpacity,{'style':[styles[_0x185b(0x8b)],{'backgroundColor':_0x4d5731[_0x185b(0x8c)]}],'onPress':()=>{_0x4d5731[_0x185b(0x57)](_0x4d5731[_0x185b(0x8d)],_0x4d5731[_0x185b(0x8e)])?Alert['alert'](_0x4d5731[_0x185b(0x69)],_0x185b(0x8f)+_0x4f5c2a+_0x185b(0x3f),[{'text':'OK'}]):(_0x797795&&_0x5f05b5[_0x185b(0x43)](_0x4d5731['YieZQ'],_0x4e2744),_0x4d5731[_0x185b(0x42)](_0x404c0f,![]),_0x590006&&_0x4d5731['GGlJG'](_0xb1d97d,_0x2da588));}},React[_0x185b(0x3c)](Text,{'style':styles[_0x185b(0x40)]},_0x4d5731['kQYwU'])));else _0x440082(_0x185b(0x5f)+_0x156c42);}if(_0x4d5731[_0x185b(0x90)](_0x2db48d,!_0xa7538f)){if(_0x4d5731['smRjr'](_0x4d5731['KuuMj'],_0x4d5731['KuuMj']))_0x380377&&_0x4d5731[_0x185b(0x91)](_0x359414,![]);else return React[_0x185b(0x3c)](View,{'style':styles[_0x185b(0x92)]},React[_0x185b(0x3c)](TouchableOpacity,{'style':[styles[_0x185b(0x93)],{'backgroundColor':_0x4d5731[_0x185b(0x94)]}],'disabled':!![]},React[_0x185b(0x3c)](Text,{'style':styles['loadingButtonText']},_0x4d5731[_0x185b(0x95)])));}const _0x2e6f10=()=>{const _0x123be1={'width':buttonWidth,'height':buttonHeight,'backgroundColor':color,'borderRadius':_0x4d5731[_0x185b(0x96)](buttonType,_0x4d5731[_0x185b(0x97)])?_0x4d5731[_0x185b(0x98)](buttonHeight,0x2):0x8,'alignItems':_0x4d5731['pNtBv'],'justifyContent':_0x4d5731[_0x185b(0x99)],'flexDirection':_0x4d5731[_0x185b(0x9a)],'opacity':enabled?0x1:0.6};return hasStroke&&(_0x123be1[_0x185b(0x9b)]=0x2,_0x123be1[_0x185b(0x9c)]=darkMode?_0x4d5731['enhZk']:'#000'),_0x123be1;},_0x5d5c99=()=>{const _0x62e6b2={'wxjmM':_0x185b(0x9d),'UOedJ':_0x4d5731[_0x185b(0x52)],'EIvAG':_0x4d5731[_0x185b(0x4f)],'TqlFf':_0x4d5731['UccXL'],'SCuyY':_0x185b(0x5)};if(_0x4d5731[_0x185b(0x9e)](_0x4d5731['WaXpB'],_0x4d5731[_0x185b(0x9f)]))switch(buttonForm){case _0x4d5731[_0x185b(0xa0)]:return _0x4d5731[_0x185b(0xa1)];default:return _0x4d5731[_0x185b(0xa2)];}else{const _0x42d743=_0x62e6b2[_0x185b(0xa3)]['split']('|');let _0x1bd525=0x0;while(!![]){switch(_0x42d743[_0x1bd525++]){case'0':_0x45db9b[_0x185b(0x43)](_0x62e6b2[_0x185b(0xa4)]);continue;case'1':_0x4710c3['log']('1.\x20Check\x20that\x20your\x20API\x20key\x20is\x20correct\x20and\x20not\x20expired');continue;case'2':_0x2d05a0[_0x185b(0x43)](_0x62e6b2[_0x185b(0xa5)]);continue;case'3':_0x2a5a0d[_0x185b(0x54)](_0x185b(0xa6));continue;case'4':_0x9931c6[_0x185b(0x53)]();continue;case'5':_0x3145c7[_0x185b(0x43)](_0x62e6b2[_0x185b(0xa7)]);continue;case'6':_0x2a124d[_0x185b(0x43)](_0x62e6b2[_0x185b(0xa8)]);continue;}break;}}};return React['createElement'](React[_0x185b(0xa9)],null,React[_0x185b(0x3c)](TouchableOpacity,{'style':_0x4d5731[_0x185b(0x5a)](_0x2e6f10),'onPress':_0x5a799f,'disabled':_0x4d5731[_0x185b(0x90)](!enabled,_0x2db48d)||!_0xa7538f,'activeOpacity':0.8},React[_0x185b(0x3c)](Image,{'source':BRAND_IMAGES['onairosLogoAlt'],'style':styles[_0x185b(0xaa)],'resizeMode':_0x185b(0xab)}),React['createElement'](Text,{'style':[styles[_0x185b(0xac)],{'color':darkMode?_0x4d5731[_0x185b(0xad)]:_0x4d5731[_0x185b(0xae)]}]},_0x4d5731[_0x185b(0x75)](_0x5d5c99))),React[_0x185b(0x3c)](UniversalOnboarding,{'visible':_0x159ee9,'onClose':_0xefe680,'AppName':_0x1c3cec,'requestData':_0x4d5731[_0x185b(0xaf)](_0x5d7e8a,{}),'returnLink':_0x598260,'onComplete':_0xefe680,'embedd':![],'debug':debug,'testMode':testMode,'preferredPlatform':_0x2a1e94}));});const styles=StyleSheet[_0x185b(0xb0)]({'button':{'flexDirection':_0x185b(0x21),'alignItems':_0x185b(0xb1),'justifyContent':_0x185b(0xb1),'paddingVertical':0xc,'paddingHorizontal':0x10,'shadowColor':_0x185b(0x30),'shadowOffset':{'width':0x0,'height':0x2},'shadowOpacity':0.1,'shadowRadius':0x4,'elevation':0x2},'buttonContent':{'flexDirection':'row','alignItems':_0x185b(0xb1),'justifyContent':'center'},'logo':{'width':0x18,'height':0x18,'marginRight':0x8},'buttonText':{'fontSize':0x10,'fontWeight':_0x185b(0xb2),'textAlign':_0x185b(0xb1)},'errorContainer':{'flex':0x1,'justifyContent':_0x185b(0xb1),'alignItems':_0x185b(0xb1)},'errorButton':{'padding':0x10,'borderRadius':0x8},'errorButtonText':{'fontSize':0x10,'fontWeight':_0x185b(0xb2),'color':_0x185b(0x22)},'loadingContainer':{'flex':0x1,'justifyContent':_0x185b(0xb1),'alignItems':_0x185b(0xb1)},'loadingButton':{'padding':0x10,'borderRadius':0x8},'loadingButtonText':{'fontSize':0x10,'fontWeight':_0x185b(0xb2),'color':_0x185b(0x22)}});
|
|
1
|
+
import React, { forwardRef, useImperativeHandle, useState, useCallback, useEffect } from 'react';
|
|
2
|
+
import { StyleSheet, View, TouchableOpacity, Text, Image, Alert } from 'react-native';
|
|
3
|
+
import { UniversalOnboarding } from './UniversalOnboarding';
|
|
4
|
+
import { COLORS } from '../constants';
|
|
5
|
+
import { hasCredentials, getCredentials } from '../utils/secureStorage';
|
|
6
|
+
import { initializeApiKey, isApiKeyInitialized, getApiConfig } from '../services/apiKeyService';
|
|
7
|
+
import { API_CONFIG } from '../config/api';
|
|
8
|
+
import { BRAND_IMAGES } from '../utils/assetRegistry';
|
|
9
|
+
export const Onairos = /*#__PURE__*/forwardRef((props, ref) => {
|
|
10
|
+
const {
|
|
11
|
+
returnLink,
|
|
12
|
+
prefillUrl,
|
|
13
|
+
AppName,
|
|
14
|
+
buttonType = 'normal',
|
|
15
|
+
requestData,
|
|
16
|
+
buttonWidth = 200,
|
|
17
|
+
buttonHeight = 48,
|
|
18
|
+
hasStroke = false,
|
|
19
|
+
enabled = true,
|
|
20
|
+
buttonForm = 'default',
|
|
21
|
+
onRejection,
|
|
22
|
+
onResolved,
|
|
23
|
+
preCheck,
|
|
24
|
+
color = COLORS.primary,
|
|
25
|
+
debug = false,
|
|
26
|
+
darkMode = false,
|
|
27
|
+
preferredPlatform,
|
|
28
|
+
testMode = false,
|
|
29
|
+
// API Key props
|
|
30
|
+
apiKey,
|
|
31
|
+
environment = 'production',
|
|
32
|
+
enableLogging = true,
|
|
33
|
+
timeout = 30000,
|
|
34
|
+
retryAttempts = 3
|
|
35
|
+
} = props;
|
|
36
|
+
const [showOverlay, setShowOverlay] = useState(false);
|
|
37
|
+
const [isInitialized, setIsInitialized] = useState(false);
|
|
38
|
+
const [initializationError, setInitializationError] = useState(null);
|
|
39
|
+
const [isInitializing, setIsInitializing] = useState(false);
|
|
40
|
+
|
|
41
|
+
// Initialize API key when component mounts or API key changes
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
var _getApiConfig;
|
|
44
|
+
let isMounted = true;
|
|
45
|
+
const initializeApi = async () => {
|
|
46
|
+
// Skip if already initializing
|
|
47
|
+
if (isInitializing) return;
|
|
48
|
+
setIsInitializing(true);
|
|
49
|
+
setInitializationError(null);
|
|
50
|
+
try {
|
|
51
|
+
console.log('🚀 Onairos SDK: Starting API key initialization...');
|
|
52
|
+
if (!apiKey) {
|
|
53
|
+
throw new Error('API key is required. Please provide a valid API key from your Onairos dashboard.');
|
|
54
|
+
}
|
|
55
|
+
const config = {
|
|
56
|
+
apiKey,
|
|
57
|
+
environment,
|
|
58
|
+
enableLogging,
|
|
59
|
+
timeout,
|
|
60
|
+
retryAttempts
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// Initialize the API key service
|
|
64
|
+
await initializeApiKey(config);
|
|
65
|
+
if (isMounted) {
|
|
66
|
+
setIsInitialized(true);
|
|
67
|
+
setInitializationError(null);
|
|
68
|
+
if (enableLogging) {
|
|
69
|
+
console.log('✅ Onairos SDK: API key initialization completed successfully');
|
|
70
|
+
console.log('📊 Configuration:', {
|
|
71
|
+
environment,
|
|
72
|
+
enableLogging,
|
|
73
|
+
timeout,
|
|
74
|
+
retryAttempts,
|
|
75
|
+
apiKeyLength: apiKey.length
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
} catch (error) {
|
|
80
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown initialization error';
|
|
81
|
+
console.error('❌ Onairos SDK: API key initialization failed:', errorMessage);
|
|
82
|
+
if (isMounted) {
|
|
83
|
+
setIsInitialized(false);
|
|
84
|
+
setInitializationError(errorMessage);
|
|
85
|
+
|
|
86
|
+
// Show developer-friendly error
|
|
87
|
+
if (enableLogging) {
|
|
88
|
+
console.group('🔧 API Key Troubleshooting Guide');
|
|
89
|
+
console.log('1. Check that your API key is correct and not expired');
|
|
90
|
+
console.log('2. Verify you have the right permissions for your use case');
|
|
91
|
+
console.log('3. Ensure your environment setting matches your API key');
|
|
92
|
+
console.log('4. Check your internet connection');
|
|
93
|
+
console.log('5. Visit https://dashboard.onairos.uk to manage your API keys');
|
|
94
|
+
console.groupEnd();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Call rejection callback if provided
|
|
98
|
+
if (onRejection) {
|
|
99
|
+
onRejection(`SDK initialization failed: ${errorMessage}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
} finally {
|
|
103
|
+
if (isMounted) {
|
|
104
|
+
setIsInitializing(false);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// Only initialize if we have an API key and aren't already initialized correctly
|
|
110
|
+
if (apiKey && (!isApiKeyInitialized() || ((_getApiConfig = getApiConfig()) === null || _getApiConfig === void 0 ? void 0 : _getApiConfig.apiKey) !== apiKey)) {
|
|
111
|
+
initializeApi();
|
|
112
|
+
} else if (isApiKeyInitialized()) {
|
|
113
|
+
// SDK already initialized (e.g., from App.tsx), sync internal state
|
|
114
|
+
setIsInitialized(true);
|
|
115
|
+
setIsInitializing(false);
|
|
116
|
+
if (enableLogging) {
|
|
117
|
+
console.log('✅ Onairos component: SDK already initialized, syncing state');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return () => {
|
|
121
|
+
isMounted = false;
|
|
122
|
+
};
|
|
123
|
+
}, [apiKey, environment, enableLogging, timeout, retryAttempts, onRejection]);
|
|
124
|
+
|
|
125
|
+
// Imperative methods
|
|
126
|
+
useImperativeHandle(ref, () => ({
|
|
127
|
+
openOverlay: handleShowOverlay,
|
|
128
|
+
closeOverlay: handleCloseOverlay,
|
|
129
|
+
isInitialized: () => isInitialized,
|
|
130
|
+
getApiConfig: () => getApiConfig()
|
|
131
|
+
}));
|
|
132
|
+
const handleShowOverlay = useCallback(async () => {
|
|
133
|
+
console.log('🔘 Button pressed! isInitialized:', isInitialized, 'isInitializing:', isInitializing, 'showOverlay:', showOverlay);
|
|
134
|
+
try {
|
|
135
|
+
// Check if SDK is initialized
|
|
136
|
+
if (!isInitialized) {
|
|
137
|
+
const errorMessage = initializationError || 'SDK not initialized. Please check your API key.';
|
|
138
|
+
console.error('❌ Cannot open overlay: SDK not initialized');
|
|
139
|
+
if (onRejection) {
|
|
140
|
+
onRejection(errorMessage);
|
|
141
|
+
} else {
|
|
142
|
+
Alert.alert('SDK Error', errorMessage, [{
|
|
143
|
+
text: 'OK'
|
|
144
|
+
}]);
|
|
145
|
+
}
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Run pre-check if provided
|
|
150
|
+
if (preCheck) {
|
|
151
|
+
if (enableLogging) {
|
|
152
|
+
console.log('🔍 Running pre-check validation...');
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
const preCheckPassed = await preCheck();
|
|
156
|
+
if (!preCheckPassed) {
|
|
157
|
+
if (enableLogging) {
|
|
158
|
+
console.log('⛔ Pre-check failed, aborting overlay');
|
|
159
|
+
}
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (enableLogging) {
|
|
163
|
+
console.log('✅ Pre-check passed');
|
|
164
|
+
}
|
|
165
|
+
} catch (preCheckError) {
|
|
166
|
+
console.error('❌ Pre-check error:', preCheckError);
|
|
167
|
+
if (onRejection) {
|
|
168
|
+
onRejection(`Pre-check failed: ${preCheckError.message}`);
|
|
169
|
+
}
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Check for existing credentials
|
|
175
|
+
if (enableLogging) {
|
|
176
|
+
console.log('🔍 Checking for existing credentials...');
|
|
177
|
+
}
|
|
178
|
+
const hasExistingCredentials = await hasCredentials();
|
|
179
|
+
if (hasExistingCredentials) {
|
|
180
|
+
if (enableLogging) {
|
|
181
|
+
console.log('🔑 Existing credentials found, attempting automatic resolution...');
|
|
182
|
+
}
|
|
183
|
+
try {
|
|
184
|
+
const credentials = await getCredentials();
|
|
185
|
+
if (credentials && onResolved) {
|
|
186
|
+
// For existing users, we can resolve immediately with cached data
|
|
187
|
+
const mockApiUrl = `${API_CONFIG.BASE_URL}/user/data`;
|
|
188
|
+
const mockToken = 'existing_user_token';
|
|
189
|
+
if (enableLogging) {
|
|
190
|
+
console.log('✅ Resolving with existing credentials');
|
|
191
|
+
}
|
|
192
|
+
onResolved(mockApiUrl, mockToken, credentials);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
} catch (credentialsError) {
|
|
196
|
+
console.warn('⚠️ Failed to retrieve existing credentials:', credentialsError);
|
|
197
|
+
// Continue with normal flow
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (enableLogging) {
|
|
201
|
+
console.log('🎨 Opening Onairos overlay...');
|
|
202
|
+
}
|
|
203
|
+
setShowOverlay(true);
|
|
204
|
+
} catch (error) {
|
|
205
|
+
console.error('❌ Error opening overlay:', error);
|
|
206
|
+
if (onRejection) {
|
|
207
|
+
onRejection(`Failed to open overlay: ${error.message}`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}, [isInitialized, initializationError, preCheck, enableLogging, onRejection, onResolved]);
|
|
211
|
+
const handleCloseOverlay = useCallback(result => {
|
|
212
|
+
console.log('🔽 Closing Onairos overlay, result:', result);
|
|
213
|
+
setShowOverlay(false);
|
|
214
|
+
console.log('🔽 showOverlay set to false');
|
|
215
|
+
if (result && onResolved) {
|
|
216
|
+
onResolved(result.apiUrl, result.token, result.userData);
|
|
217
|
+
}
|
|
218
|
+
}, [enableLogging, onResolved]);
|
|
219
|
+
const handleOverlayRejection = useCallback(error => {
|
|
220
|
+
if (enableLogging) {
|
|
221
|
+
console.log('❌ Overlay rejected:', error);
|
|
222
|
+
}
|
|
223
|
+
setShowOverlay(false);
|
|
224
|
+
if (onRejection) {
|
|
225
|
+
onRejection(error);
|
|
226
|
+
}
|
|
227
|
+
}, [enableLogging, onRejection]);
|
|
228
|
+
|
|
229
|
+
// Show error state if initialization failed
|
|
230
|
+
if (initializationError && !isInitializing) {
|
|
231
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
232
|
+
style: styles.errorContainer
|
|
233
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
234
|
+
style: [styles.errorButton, {
|
|
235
|
+
backgroundColor: '#FF6B6B'
|
|
236
|
+
}],
|
|
237
|
+
onPress: () => {
|
|
238
|
+
Alert.alert('SDK Error', `Onairos SDK initialization failed:\n\n${initializationError}\n\nPlease check your API key and try again.`, [{
|
|
239
|
+
text: 'OK'
|
|
240
|
+
}]);
|
|
241
|
+
}
|
|
242
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
243
|
+
style: styles.errorButtonText
|
|
244
|
+
}, "\u26A0\uFE0F SDK Error")));
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Show loading state while initializing
|
|
248
|
+
if (isInitializing || !isInitialized) {
|
|
249
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
250
|
+
style: styles.loadingContainer
|
|
251
|
+
}, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
252
|
+
style: [styles.loadingButton, {
|
|
253
|
+
backgroundColor: '#999'
|
|
254
|
+
}],
|
|
255
|
+
disabled: true
|
|
256
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
257
|
+
style: styles.loadingButtonText
|
|
258
|
+
}, "\uD83D\uDD04 Initializing...")));
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Get button style based on type
|
|
262
|
+
const getButtonStyle = () => {
|
|
263
|
+
const baseStyle = {
|
|
264
|
+
width: buttonWidth,
|
|
265
|
+
height: buttonHeight,
|
|
266
|
+
backgroundColor: color,
|
|
267
|
+
borderRadius: buttonType === 'pill' ? buttonHeight / 2 : 8,
|
|
268
|
+
alignItems: 'center',
|
|
269
|
+
justifyContent: 'center',
|
|
270
|
+
flexDirection: 'row',
|
|
271
|
+
opacity: enabled ? 1 : 0.6
|
|
272
|
+
};
|
|
273
|
+
if (hasStroke) {
|
|
274
|
+
baseStyle.borderWidth = 2;
|
|
275
|
+
baseStyle.borderColor = darkMode ? '#fff' : '#000';
|
|
276
|
+
}
|
|
277
|
+
return baseStyle;
|
|
278
|
+
};
|
|
279
|
+
const getButtonText = () => {
|
|
280
|
+
switch (buttonForm) {
|
|
281
|
+
case 'connect':
|
|
282
|
+
return 'Connect with Onairos';
|
|
283
|
+
default:
|
|
284
|
+
return 'Continue with Onairos';
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
288
|
+
style: getButtonStyle(),
|
|
289
|
+
onPress: handleShowOverlay,
|
|
290
|
+
disabled: !enabled || isInitializing || !isInitialized,
|
|
291
|
+
activeOpacity: 0.8
|
|
292
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
293
|
+
source: BRAND_IMAGES.onairosLogoAlt,
|
|
294
|
+
style: styles.logo,
|
|
295
|
+
resizeMode: "contain"
|
|
296
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
297
|
+
style: [styles.buttonText, {
|
|
298
|
+
color: darkMode ? '#000' : '#fff'
|
|
299
|
+
}]
|
|
300
|
+
}, getButtonText())), /*#__PURE__*/React.createElement(UniversalOnboarding, {
|
|
301
|
+
visible: showOverlay,
|
|
302
|
+
onClose: handleCloseOverlay,
|
|
303
|
+
AppName: AppName,
|
|
304
|
+
requestData: requestData || {},
|
|
305
|
+
returnLink: returnLink,
|
|
306
|
+
onComplete: handleCloseOverlay,
|
|
307
|
+
embedd: false,
|
|
308
|
+
debug: debug,
|
|
309
|
+
testMode: testMode,
|
|
310
|
+
preferredPlatform: preferredPlatform
|
|
311
|
+
}));
|
|
312
|
+
});
|
|
313
|
+
const styles = StyleSheet.create({
|
|
314
|
+
button: {
|
|
315
|
+
flexDirection: 'row',
|
|
316
|
+
alignItems: 'center',
|
|
317
|
+
justifyContent: 'center',
|
|
318
|
+
paddingVertical: 12,
|
|
319
|
+
paddingHorizontal: 16,
|
|
320
|
+
shadowColor: '#000',
|
|
321
|
+
shadowOffset: {
|
|
322
|
+
width: 0,
|
|
323
|
+
height: 2
|
|
324
|
+
},
|
|
325
|
+
shadowOpacity: 0.1,
|
|
326
|
+
shadowRadius: 4,
|
|
327
|
+
elevation: 2
|
|
328
|
+
},
|
|
329
|
+
buttonContent: {
|
|
330
|
+
flexDirection: 'row',
|
|
331
|
+
alignItems: 'center',
|
|
332
|
+
justifyContent: 'center'
|
|
333
|
+
},
|
|
334
|
+
logo: {
|
|
335
|
+
width: 24,
|
|
336
|
+
height: 24,
|
|
337
|
+
marginRight: 8
|
|
338
|
+
},
|
|
339
|
+
buttonText: {
|
|
340
|
+
fontSize: 16,
|
|
341
|
+
fontWeight: '600',
|
|
342
|
+
textAlign: 'center'
|
|
343
|
+
},
|
|
344
|
+
errorContainer: {
|
|
345
|
+
flex: 1,
|
|
346
|
+
justifyContent: 'center',
|
|
347
|
+
alignItems: 'center'
|
|
348
|
+
},
|
|
349
|
+
errorButton: {
|
|
350
|
+
padding: 16,
|
|
351
|
+
borderRadius: 8
|
|
352
|
+
},
|
|
353
|
+
errorButtonText: {
|
|
354
|
+
fontSize: 16,
|
|
355
|
+
fontWeight: '600',
|
|
356
|
+
color: '#fff'
|
|
357
|
+
},
|
|
358
|
+
loadingContainer: {
|
|
359
|
+
flex: 1,
|
|
360
|
+
justifyContent: 'center',
|
|
361
|
+
alignItems: 'center'
|
|
362
|
+
},
|
|
363
|
+
loadingButton: {
|
|
364
|
+
padding: 16,
|
|
365
|
+
borderRadius: 8
|
|
366
|
+
},
|
|
367
|
+
loadingButtonText: {
|
|
368
|
+
fontSize: 16,
|
|
369
|
+
fontWeight: '600',
|
|
370
|
+
color: '#fff'
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
//# sourceMappingURL=Onairos.js.map
|