@onairos/react-native 3.0.1 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -3
- package/lib/commonjs/api/index.js +109 -86
- package/lib/commonjs/api/index.js.map +1 -1
- package/lib/commonjs/components/OnairosButton.js +20 -13
- package/lib/commonjs/components/OnairosButton.js.map +1 -1
- package/lib/commonjs/components/Overlay.js +260 -108
- package/lib/commonjs/components/Overlay.js.map +1 -1
- package/lib/commonjs/components/UniversalOnboarding.js +30 -0
- package/lib/commonjs/components/UniversalOnboarding.js.map +1 -1
- package/lib/commonjs/components/onboarding/OAuthWebView.js +28 -9
- package/lib/commonjs/components/onboarding/OAuthWebView.js.map +1 -1
- package/lib/commonjs/components/onboarding/PlatformConnector.js +6 -1
- package/lib/commonjs/components/onboarding/PlatformConnector.js.map +1 -1
- package/lib/commonjs/components/screens/ConnectorScreen.js +3 -2
- package/lib/commonjs/components/screens/ConnectorScreen.js.map +1 -1
- package/lib/commonjs/constants/index.js +1 -1
- package/lib/commonjs/hooks/useConnections.js +77 -15
- package/lib/commonjs/hooks/useConnections.js.map +1 -1
- package/lib/commonjs/hooks/useCredentials.js +2 -0
- package/lib/commonjs/hooks/useCredentials.js.map +1 -1
- package/lib/commonjs/index.js +38 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/services/oauthService.js +26 -51
- package/lib/commonjs/services/oauthService.js.map +1 -1
- package/lib/commonjs/types/ambient.d.js +2 -0
- package/lib/commonjs/types/ambient.d.js.map +1 -0
- package/lib/commonjs/types/node-fix.d.js +2 -0
- package/lib/commonjs/types/node-fix.d.js.map +1 -0
- package/lib/commonjs/types/node-override.d.js +2 -0
- package/lib/commonjs/types/node-override.d.js.map +1 -0
- package/lib/commonjs/types/types.d.js +2 -0
- package/lib/commonjs/types/types.d.js.map +1 -0
- package/lib/commonjs/utils/encryption.js +8 -2
- package/lib/commonjs/utils/encryption.js.map +1 -1
- package/lib/commonjs/utils/secureStorage.js +148 -42
- package/lib/commonjs/utils/secureStorage.js.map +1 -1
- package/lib/module/api/index.js +109 -86
- package/lib/module/api/index.js.map +1 -1
- package/lib/module/components/OnairosButton.js +21 -14
- package/lib/module/components/OnairosButton.js.map +1 -1
- package/lib/module/components/Overlay.js +260 -110
- package/lib/module/components/Overlay.js.map +1 -1
- package/lib/module/components/UniversalOnboarding.js +31 -1
- package/lib/module/components/UniversalOnboarding.js.map +1 -1
- package/lib/module/components/onboarding/OAuthWebView.js +28 -9
- package/lib/module/components/onboarding/OAuthWebView.js.map +1 -1
- package/lib/module/components/onboarding/PlatformConnector.js +6 -1
- package/lib/module/components/onboarding/PlatformConnector.js.map +1 -1
- package/lib/module/components/screens/ConnectorScreen.js +3 -2
- package/lib/module/components/screens/ConnectorScreen.js.map +1 -1
- package/lib/module/constants/index.js +1 -1
- package/lib/module/hooks/useConnections.js +77 -14
- package/lib/module/hooks/useConnections.js.map +1 -1
- package/lib/module/hooks/useCredentials.js +2 -0
- package/lib/module/hooks/useCredentials.js.map +1 -1
- package/lib/module/index.js +27 -9
- package/lib/module/index.js.map +1 -1
- package/lib/module/services/oauthService.js +26 -33
- package/lib/module/services/oauthService.js.map +1 -1
- package/lib/module/types/ambient.d.js +2 -0
- package/lib/module/types/ambient.d.js.map +1 -0
- package/lib/module/types/node-fix.d.js +2 -0
- package/lib/module/types/node-fix.d.js.map +1 -0
- package/lib/module/types/node-override.d.js +2 -0
- package/lib/module/types/node-override.d.js.map +1 -0
- package/lib/module/types/types.d.js +2 -0
- package/lib/module/types/types.d.js.map +1 -0
- package/lib/module/utils/encryption.js +8 -2
- package/lib/module/utils/encryption.js.map +1 -1
- package/lib/module/utils/secureStorage.js +149 -42
- package/lib/module/utils/secureStorage.js.map +1 -1
- package/lib/typescript/api/index.d.ts +8 -0
- package/lib/typescript/api/index.d.ts.map +1 -0
- package/lib/typescript/components/DataRequestModal.d.ts +11 -0
- package/lib/typescript/components/DataRequestModal.d.ts.map +1 -0
- package/lib/typescript/components/Onairos.d.ts +29 -0
- package/lib/typescript/components/Onairos.d.ts.map +1 -0
- package/lib/typescript/components/OnairosButton.d.ts +7 -0
- package/lib/typescript/components/OnairosButton.d.ts.map +1 -0
- package/lib/typescript/components/Overlay.d.ts +18 -0
- package/lib/typescript/components/Overlay.d.ts.map +1 -0
- package/lib/typescript/components/PinInput.d.ts +4 -0
- package/lib/typescript/components/PinInput.d.ts.map +1 -0
- package/lib/typescript/components/PlatformList.d.ts +4 -0
- package/lib/typescript/components/PlatformList.d.ts.map +1 -0
- package/lib/typescript/components/TrainingModal.d.ts +4 -0
- package/lib/typescript/components/TrainingModal.d.ts.map +1 -0
- package/lib/typescript/components/UniversalOnboarding.d.ts +4 -0
- package/lib/typescript/components/UniversalOnboarding.d.ts.map +1 -0
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts +4 -0
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts.map +1 -0
- package/lib/typescript/components/onboarding/OnboardingHeader.d.ts +11 -0
- package/lib/typescript/components/onboarding/OnboardingHeader.d.ts.map +1 -0
- package/lib/typescript/components/onboarding/PinInput.d.ts +4 -0
- package/lib/typescript/components/onboarding/PinInput.d.ts.map +1 -0
- package/lib/typescript/components/onboarding/PlatformConnector.d.ts +13 -0
- package/lib/typescript/components/onboarding/PlatformConnector.d.ts.map +1 -0
- package/lib/typescript/components/screens/ConnectorScreen.d.ts +9 -0
- package/lib/typescript/components/screens/ConnectorScreen.d.ts.map +1 -0
- package/lib/typescript/components/screens/LoadingScreen.d.ts +9 -0
- package/lib/typescript/components/screens/LoadingScreen.d.ts.map +1 -0
- package/lib/typescript/components/screens/PinCreationScreen.d.ts +10 -0
- package/lib/typescript/components/screens/PinCreationScreen.d.ts.map +1 -0
- package/lib/typescript/constants/index.d.ts +52 -0
- package/lib/typescript/constants/index.d.ts.map +1 -0
- package/lib/typescript/hooks/useConnections.d.ts +9 -0
- package/lib/typescript/hooks/useConnections.d.ts.map +1 -0
- package/lib/typescript/hooks/useCredentials.d.ts +9 -0
- package/lib/typescript/hooks/useCredentials.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +45 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/services/oauthService.d.ts +50 -0
- package/lib/typescript/services/oauthService.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +145 -0
- package/lib/typescript/types/index.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +135 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/utils/api.d.ts +6 -0
- package/lib/typescript/utils/api.d.ts.map +1 -0
- package/lib/typescript/utils/auth.d.ts +6 -0
- package/lib/typescript/utils/auth.d.ts.map +1 -0
- package/lib/typescript/utils/crypto.d.ts +4 -0
- package/lib/typescript/utils/crypto.d.ts.map +1 -0
- package/lib/typescript/utils/debugHelper.d.ts +29 -0
- package/lib/typescript/utils/debugHelper.d.ts.map +1 -0
- package/lib/typescript/utils/encryption.d.ts +19 -0
- package/lib/typescript/utils/encryption.d.ts.map +1 -0
- package/lib/typescript/utils/onairosApi.d.ts +72 -0
- package/lib/typescript/utils/onairosApi.d.ts.map +1 -0
- package/lib/typescript/utils/secureStorage.d.ts +63 -0
- package/lib/typescript/utils/secureStorage.d.ts.map +1 -0
- package/package.json +16 -4
- package/src/api/index.ts +86 -101
- package/src/components/OnairosButton.tsx +22 -14
- package/src/components/Overlay.tsx +303 -138
- package/src/components/UniversalOnboarding.tsx +25 -0
- package/src/components/onboarding/OAuthWebView.tsx +27 -7
- package/src/components/onboarding/PlatformConnector.tsx +5 -0
- package/src/components/screens/ConnectorScreen.tsx +3 -2
- package/src/constants/index.ts +81 -81
- package/src/hooks/useConnections.ts +76 -16
- package/src/hooks/useCredentials.ts +5 -1
- package/src/index.ts +30 -3
- package/src/services/oauthService.ts +412 -419
- package/src/types/ambient.d.ts +29 -0
- package/src/types/index.d.ts +48 -8
- package/src/types/index.ts +21 -15
- package/src/types/node-fix.d.ts +19 -0
- package/src/types/node-override.d.ts +24 -0
- package/src/types/types.d.ts +18 -0
- package/src/types.ts +121 -1
- package/src/utils/encryption.ts +7 -2
- package/src/utils/secureStorage.ts +155 -56
- package/types/index.d.ts +210 -0
- package/types/node-env.d.ts +15 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect, useRef } from 'react';
|
|
1
|
+
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
Text,
|
|
@@ -8,8 +8,9 @@ import {
|
|
|
8
8
|
Alert,
|
|
9
9
|
Platform,
|
|
10
10
|
Dimensions,
|
|
11
|
+
Modal,
|
|
11
12
|
} from 'react-native';
|
|
12
|
-
import
|
|
13
|
+
import BottomSheet from '@gorhom/bottom-sheet';
|
|
13
14
|
// import DeviceInfo from 'react-native-device-info'; // Comment out device info import
|
|
14
15
|
import { COLORS } from '../constants';
|
|
15
16
|
import { onairosApi } from '../api';
|
|
@@ -26,6 +27,8 @@ interface OverlayProps {
|
|
|
26
27
|
username: string;
|
|
27
28
|
modelKey: string;
|
|
28
29
|
onResolved: (apiUrl: string, accessToken: string, loginDetails: any) => void;
|
|
30
|
+
appName?: string;
|
|
31
|
+
darkMode?: boolean;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
export const Overlay: React.FC<OverlayProps> = ({
|
|
@@ -33,11 +36,14 @@ export const Overlay: React.FC<OverlayProps> = ({
|
|
|
33
36
|
username,
|
|
34
37
|
modelKey,
|
|
35
38
|
onResolved,
|
|
39
|
+
appName = 'Your App',
|
|
40
|
+
darkMode = false,
|
|
36
41
|
}) => {
|
|
37
42
|
const [selections, setSelections] = useState<{ [key: string]: boolean }>({});
|
|
38
43
|
const [details, setDetails] = useState<string>('');
|
|
39
|
-
const
|
|
40
|
-
const
|
|
44
|
+
const [visible, setVisible] = useState(true);
|
|
45
|
+
const bottomSheetRef = useRef<BottomSheet>(null);
|
|
46
|
+
const snapPoints = useRef(['80%']);
|
|
41
47
|
|
|
42
48
|
useEffect(() => {
|
|
43
49
|
// Initialize selection state
|
|
@@ -47,31 +53,41 @@ export const Overlay: React.FC<OverlayProps> = ({
|
|
|
47
53
|
});
|
|
48
54
|
setSelections(initialSelections);
|
|
49
55
|
getDetails();
|
|
50
|
-
|
|
51
|
-
// Present the bottom sheet when component mounts
|
|
52
|
-
setTimeout(() => {
|
|
53
|
-
bottomSheetRef.current?.present();
|
|
54
|
-
}, 100);
|
|
55
56
|
}, []);
|
|
56
57
|
|
|
57
58
|
const getDetails = async () => {
|
|
58
59
|
try {
|
|
60
|
+
// In Expo or development, use mock data
|
|
61
|
+
if (__DEV__) {
|
|
62
|
+
setDetails('Development mode - mock account info');
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
59
66
|
const response = await onairosApi.post('getAccountInfo', {
|
|
60
67
|
Info: {
|
|
61
68
|
username: username,
|
|
62
69
|
},
|
|
63
70
|
});
|
|
64
|
-
|
|
71
|
+
// Handle response data properly based on API structure
|
|
72
|
+
if (response && response.data) {
|
|
73
|
+
const accountInfo = typeof response.data === 'object' && response.data.AccountInfo
|
|
74
|
+
? response.data.AccountInfo
|
|
75
|
+
: `User: ${username}`;
|
|
76
|
+
setDetails(accountInfo);
|
|
77
|
+
} else {
|
|
78
|
+
setDetails(`User: ${username}`);
|
|
79
|
+
}
|
|
65
80
|
} catch (e) {
|
|
66
81
|
console.error('Error getting account info:', e);
|
|
82
|
+
setDetails(`User: ${username}`);
|
|
67
83
|
}
|
|
68
84
|
};
|
|
69
85
|
|
|
70
|
-
const closeOverlay = () => {
|
|
71
|
-
|
|
72
|
-
};
|
|
86
|
+
const closeOverlay = useCallback(() => {
|
|
87
|
+
setVisible(false);
|
|
88
|
+
}, []);
|
|
73
89
|
|
|
74
|
-
const confirmSelection = async () => {
|
|
90
|
+
const confirmSelection = useCallback(async () => {
|
|
75
91
|
try {
|
|
76
92
|
// Mock app identifier
|
|
77
93
|
const appId = Platform.select({
|
|
@@ -80,8 +96,36 @@ export const Overlay: React.FC<OverlayProps> = ({
|
|
|
80
96
|
default: 'unknown'
|
|
81
97
|
});
|
|
82
98
|
|
|
83
|
-
|
|
84
|
-
|
|
99
|
+
// In development mode, use mock data
|
|
100
|
+
if (__DEV__) {
|
|
101
|
+
onResolved('https://api2.onairos.uk', 'mock-token', {
|
|
102
|
+
username,
|
|
103
|
+
selections
|
|
104
|
+
});
|
|
105
|
+
closeOverlay();
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Get server public key for encryption
|
|
110
|
+
let serverPublicKey = 'mock-key';
|
|
111
|
+
try {
|
|
112
|
+
const keyResponse = await onairosApi.get('public/key');
|
|
113
|
+
if (keyResponse && keyResponse.data && typeof keyResponse.data === 'object') {
|
|
114
|
+
serverPublicKey = keyResponse.data.publicKey || 'mock-key';
|
|
115
|
+
}
|
|
116
|
+
} catch (e) {
|
|
117
|
+
console.error('Error getting server public key:', e);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Encrypt the model key - only if the function exists and server key is valid
|
|
121
|
+
let encryptedModelKey = modelKey;
|
|
122
|
+
if (typeof encryptModelKey === 'function' && serverPublicKey) {
|
|
123
|
+
try {
|
|
124
|
+
encryptedModelKey = encryptModelKey(serverPublicKey, modelKey);
|
|
125
|
+
} catch (e) {
|
|
126
|
+
console.error('Error encrypting model key:', e);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
85
129
|
|
|
86
130
|
const response = await onairosApi.post('getAPIUrlMobile', {
|
|
87
131
|
Info: {
|
|
@@ -95,15 +139,35 @@ export const Overlay: React.FC<OverlayProps> = ({
|
|
|
95
139
|
},
|
|
96
140
|
});
|
|
97
141
|
|
|
98
|
-
if (response.apiUrl && response.token) {
|
|
99
|
-
onResolved(response.apiUrl, response.token, {
|
|
142
|
+
if (response.data?.apiUrl && response.data?.token) {
|
|
143
|
+
onResolved(response.data.apiUrl, response.data.token, {
|
|
144
|
+
username,
|
|
145
|
+
selections
|
|
146
|
+
});
|
|
147
|
+
closeOverlay();
|
|
148
|
+
} else {
|
|
149
|
+
// If response doesn't have expected format, use fallbacks
|
|
150
|
+
onResolved('https://api2.onairos.uk', 'fallback-token', {
|
|
151
|
+
username,
|
|
152
|
+
selections
|
|
153
|
+
});
|
|
100
154
|
closeOverlay();
|
|
101
155
|
}
|
|
102
156
|
} catch (e) {
|
|
103
157
|
console.error('Error confirming selection:', e);
|
|
104
|
-
|
|
158
|
+
// In case of error, provide fallback (development mode)
|
|
159
|
+
if (__DEV__) {
|
|
160
|
+
onResolved('https://api2.onairos.uk', 'error-fallback-token', {
|
|
161
|
+
username,
|
|
162
|
+
selections,
|
|
163
|
+
error: true
|
|
164
|
+
});
|
|
165
|
+
closeOverlay();
|
|
166
|
+
} else {
|
|
167
|
+
showErrorModal('Failed to confirm selection. Please try again.');
|
|
168
|
+
}
|
|
105
169
|
}
|
|
106
|
-
};
|
|
170
|
+
}, [selections, username, modelKey, onResolved]);
|
|
107
171
|
|
|
108
172
|
const showErrorModal = (errorMessage: string) => {
|
|
109
173
|
Alert.alert('Notice', errorMessage, [{ text: 'OK' }]);
|
|
@@ -111,191 +175,292 @@ export const Overlay: React.FC<OverlayProps> = ({
|
|
|
111
175
|
|
|
112
176
|
const selectedCount = Object.values(selections).filter(Boolean).length;
|
|
113
177
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
)}
|
|
127
|
-
enablePanDownToClose={true}
|
|
128
|
-
keyboardBehavior="interactive"
|
|
129
|
-
keyboardBlurBehavior="restore"
|
|
130
|
-
>
|
|
131
|
-
<View style={styles.container}>
|
|
132
|
-
<View style={styles.header}>
|
|
133
|
-
<Text style={styles.headerTitle}>Onairos</Text>
|
|
134
|
-
<TouchableOpacity onPress={closeOverlay}>
|
|
135
|
-
<Text style={styles.closeButton}>×</Text>
|
|
136
|
-
</TouchableOpacity>
|
|
137
|
-
<Text style={styles.username}>{username}</Text>
|
|
178
|
+
// Render content of the bottom sheet
|
|
179
|
+
const renderContent = () => (
|
|
180
|
+
<View style={[styles.container, darkMode && styles.darkContainer]}>
|
|
181
|
+
<View style={[styles.header, darkMode && styles.darkHeader]}>
|
|
182
|
+
<View style={styles.headerContent}>
|
|
183
|
+
<View style={[styles.appIcon, darkMode && styles.darkAppIcon]}>
|
|
184
|
+
<Text style={[styles.appIconText, darkMode && styles.darkText]}>A</Text>
|
|
185
|
+
</View>
|
|
186
|
+
<Text style={[styles.arrow, darkMode && styles.darkArrow]}>→</Text>
|
|
187
|
+
<View style={[styles.onairosIcon, darkMode && styles.darkAppIcon]}>
|
|
188
|
+
<Text style={[styles.onairosIconText, darkMode && styles.darkText]}>O</Text>
|
|
189
|
+
</View>
|
|
138
190
|
</View>
|
|
191
|
+
<Text style={[styles.appName, darkMode && styles.darkSubText]}>{appName}</Text>
|
|
192
|
+
</View>
|
|
139
193
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
194
|
+
<Text style={[styles.privacyMessage, darkMode && styles.darkSubText]}>
|
|
195
|
+
No one will ever see your raw app data
|
|
196
|
+
</Text>
|
|
197
|
+
|
|
198
|
+
<ScrollView style={styles.content}>
|
|
199
|
+
{Object.entries(data).map(([key, value]) => (
|
|
200
|
+
<View key={key} style={[styles.card, darkMode && styles.darkCard]}>
|
|
201
|
+
<TouchableOpacity
|
|
202
|
+
style={styles.checkboxContainer}
|
|
203
|
+
onPress={() =>
|
|
204
|
+
setSelections((prev) => ({
|
|
205
|
+
...prev,
|
|
206
|
+
[key]: !prev[key],
|
|
207
|
+
}))
|
|
208
|
+
}
|
|
209
|
+
>
|
|
210
|
+
<View
|
|
211
|
+
style={[
|
|
212
|
+
styles.checkbox,
|
|
213
|
+
selections[key] && styles.checkboxSelected,
|
|
214
|
+
darkMode && styles.darkCheckbox,
|
|
215
|
+
]}
|
|
216
|
+
/>
|
|
217
|
+
<View style={styles.cardContent}>
|
|
218
|
+
<Text style={[styles.cardTitle, darkMode && styles.darkText]}>
|
|
219
|
+
{value.type} Insight
|
|
220
|
+
</Text>
|
|
221
|
+
<Text style={[styles.cardDescription, darkMode && styles.darkSubText]}>
|
|
222
|
+
{value.descriptions}
|
|
223
|
+
</Text>
|
|
224
|
+
{value.reward && (
|
|
225
|
+
<Text style={[styles.cardReward, darkMode && styles.darkReward]}>
|
|
226
|
+
Reward: {value.reward}
|
|
162
227
|
</Text>
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
</TouchableOpacity>
|
|
170
|
-
</View>
|
|
171
|
-
))}
|
|
172
|
-
</ScrollView>
|
|
228
|
+
)}
|
|
229
|
+
</View>
|
|
230
|
+
</TouchableOpacity>
|
|
231
|
+
</View>
|
|
232
|
+
))}
|
|
233
|
+
</ScrollView>
|
|
173
234
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
235
|
+
<View style={[styles.footer, darkMode && styles.darkFooter]}>
|
|
236
|
+
<TouchableOpacity
|
|
237
|
+
style={[styles.footerButtonCancel, darkMode && styles.darkFooterButton]}
|
|
238
|
+
onPress={closeOverlay}
|
|
239
|
+
>
|
|
240
|
+
<Text style={[styles.footerButtonText, darkMode && styles.darkSubText]}>Cancel</Text>
|
|
241
|
+
</TouchableOpacity>
|
|
242
|
+
<Text style={[styles.selectedCount, darkMode && styles.darkSubText]}>
|
|
243
|
+
Selected: {selectedCount}
|
|
244
|
+
</Text>
|
|
245
|
+
<TouchableOpacity
|
|
246
|
+
style={[styles.footerButtonConfirm, darkMode && styles.darkFooterButtonConfirm]}
|
|
247
|
+
onPress={confirmSelection}
|
|
248
|
+
>
|
|
249
|
+
<Text style={[styles.footerButtonTextConfirm, darkMode && styles.darkText]}>
|
|
250
|
+
Confirm
|
|
251
|
+
</Text>
|
|
252
|
+
</TouchableOpacity>
|
|
189
253
|
</View>
|
|
190
|
-
</
|
|
254
|
+
</View>
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
// Main component rendering
|
|
258
|
+
return (
|
|
259
|
+
<BottomSheet
|
|
260
|
+
ref={bottomSheetRef}
|
|
261
|
+
snapPoints={snapPoints.current}
|
|
262
|
+
enablePanDownToClose
|
|
263
|
+
onClose={closeOverlay}
|
|
264
|
+
backgroundStyle={darkMode ? styles.darkBackground : styles.lightBackground}
|
|
265
|
+
handleIndicatorStyle={darkMode ? styles.darkHandle : styles.lightHandle}
|
|
266
|
+
>
|
|
267
|
+
{renderContent()}
|
|
268
|
+
</BottomSheet>
|
|
191
269
|
);
|
|
192
270
|
};
|
|
193
271
|
|
|
194
|
-
const { width: SCREEN_WIDTH } = Dimensions.get('window');
|
|
272
|
+
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('window');
|
|
195
273
|
|
|
196
274
|
const styles = StyleSheet.create({
|
|
197
275
|
container: {
|
|
198
276
|
flex: 1,
|
|
199
|
-
backgroundColor:
|
|
200
|
-
width: SCREEN_WIDTH,
|
|
277
|
+
backgroundColor: '#fff',
|
|
201
278
|
},
|
|
202
|
-
|
|
203
|
-
backgroundColor: '#
|
|
204
|
-
width: 40,
|
|
205
|
-
height: 5,
|
|
279
|
+
darkContainer: {
|
|
280
|
+
backgroundColor: '#1A1A1A',
|
|
206
281
|
},
|
|
207
282
|
header: {
|
|
283
|
+
padding: 24,
|
|
284
|
+
alignItems: 'center',
|
|
285
|
+
},
|
|
286
|
+
darkHeader: {
|
|
287
|
+
backgroundColor: '#1A1A1A',
|
|
288
|
+
},
|
|
289
|
+
headerContent: {
|
|
208
290
|
flexDirection: 'row',
|
|
209
291
|
alignItems: 'center',
|
|
210
|
-
justifyContent: '
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
292
|
+
justifyContent: 'center',
|
|
293
|
+
marginBottom: 16,
|
|
294
|
+
},
|
|
295
|
+
appIcon: {
|
|
296
|
+
width: 48,
|
|
297
|
+
height: 48,
|
|
298
|
+
borderRadius: 16,
|
|
299
|
+
backgroundColor: '#F5F5F5',
|
|
300
|
+
alignItems: 'center',
|
|
301
|
+
justifyContent: 'center',
|
|
215
302
|
},
|
|
216
|
-
|
|
303
|
+
darkAppIcon: {
|
|
304
|
+
backgroundColor: '#2A2A2A',
|
|
305
|
+
},
|
|
306
|
+
appIconText: {
|
|
307
|
+
fontSize: 24,
|
|
308
|
+
color: '#000',
|
|
309
|
+
},
|
|
310
|
+
darkText: {
|
|
311
|
+
color: '#fff',
|
|
312
|
+
},
|
|
313
|
+
arrow: {
|
|
217
314
|
fontSize: 24,
|
|
218
|
-
|
|
219
|
-
|
|
315
|
+
marginHorizontal: 16,
|
|
316
|
+
color: '#666',
|
|
220
317
|
},
|
|
221
|
-
|
|
318
|
+
darkArrow: {
|
|
319
|
+
color: '#999',
|
|
320
|
+
},
|
|
321
|
+
onairosIcon: {
|
|
322
|
+
width: 48,
|
|
323
|
+
height: 48,
|
|
324
|
+
borderRadius: 16,
|
|
325
|
+
backgroundColor: '#F5F5F5',
|
|
326
|
+
alignItems: 'center',
|
|
327
|
+
justifyContent: 'center',
|
|
328
|
+
},
|
|
329
|
+
onairosIconText: {
|
|
222
330
|
fontSize: 24,
|
|
223
|
-
color:
|
|
224
|
-
|
|
331
|
+
color: '#000',
|
|
332
|
+
},
|
|
333
|
+
appName: {
|
|
334
|
+
fontSize: 16,
|
|
335
|
+
color: '#666',
|
|
336
|
+
},
|
|
337
|
+
darkSubText: {
|
|
338
|
+
color: '#999',
|
|
225
339
|
},
|
|
226
|
-
|
|
227
|
-
fontSize:
|
|
228
|
-
color:
|
|
340
|
+
privacyMessage: {
|
|
341
|
+
fontSize: 14,
|
|
342
|
+
color: '#666',
|
|
343
|
+
textAlign: 'center',
|
|
344
|
+
fontStyle: 'italic',
|
|
345
|
+
marginBottom: 16,
|
|
229
346
|
},
|
|
230
347
|
content: {
|
|
231
348
|
flex: 1,
|
|
232
|
-
padding:
|
|
349
|
+
padding: 24,
|
|
233
350
|
},
|
|
234
351
|
card: {
|
|
235
|
-
backgroundColor:
|
|
236
|
-
borderRadius:
|
|
237
|
-
marginBottom:
|
|
238
|
-
|
|
352
|
+
backgroundColor: '#fff',
|
|
353
|
+
borderRadius: 20,
|
|
354
|
+
marginBottom: 16,
|
|
355
|
+
borderWidth: 1,
|
|
356
|
+
borderColor: '#eee',
|
|
357
|
+
shadowColor: '#000',
|
|
239
358
|
shadowOffset: { width: 0, height: 2 },
|
|
240
|
-
shadowOpacity: 0.
|
|
241
|
-
shadowRadius:
|
|
242
|
-
elevation:
|
|
359
|
+
shadowOpacity: 0.05,
|
|
360
|
+
shadowRadius: 8,
|
|
361
|
+
elevation: 2,
|
|
362
|
+
},
|
|
363
|
+
darkCard: {
|
|
364
|
+
backgroundColor: '#2A2A2A',
|
|
365
|
+
borderColor: '#333',
|
|
243
366
|
},
|
|
244
367
|
checkboxContainer: {
|
|
245
368
|
flexDirection: 'row',
|
|
246
369
|
padding: 16,
|
|
247
|
-
alignItems: '
|
|
370
|
+
alignItems: 'flex-start',
|
|
248
371
|
},
|
|
249
372
|
checkbox: {
|
|
250
373
|
width: 24,
|
|
251
374
|
height: 24,
|
|
252
375
|
borderRadius: 4,
|
|
253
376
|
borderWidth: 2,
|
|
254
|
-
borderColor:
|
|
377
|
+
borderColor: '#2196F3',
|
|
255
378
|
marginRight: 12,
|
|
379
|
+
marginTop: 2,
|
|
380
|
+
},
|
|
381
|
+
darkCheckbox: {
|
|
382
|
+
borderColor: '#2196F3',
|
|
256
383
|
},
|
|
257
384
|
checkboxSelected: {
|
|
258
|
-
backgroundColor:
|
|
385
|
+
backgroundColor: '#2196F3',
|
|
259
386
|
},
|
|
260
387
|
cardContent: {
|
|
261
388
|
flex: 1,
|
|
262
389
|
},
|
|
263
390
|
cardTitle: {
|
|
264
|
-
fontSize:
|
|
265
|
-
fontWeight: '
|
|
391
|
+
fontSize: 16,
|
|
392
|
+
fontWeight: '600',
|
|
266
393
|
marginBottom: 4,
|
|
394
|
+
color: '#333',
|
|
267
395
|
},
|
|
268
396
|
cardDescription: {
|
|
269
397
|
fontSize: 14,
|
|
270
|
-
color:
|
|
271
|
-
marginBottom:
|
|
398
|
+
color: '#666',
|
|
399
|
+
marginBottom: 6,
|
|
272
400
|
},
|
|
273
401
|
cardReward: {
|
|
274
402
|
fontSize: 14,
|
|
275
|
-
color:
|
|
276
|
-
fontWeight: '
|
|
403
|
+
color: '#4CAF50',
|
|
404
|
+
fontWeight: '500',
|
|
405
|
+
},
|
|
406
|
+
darkReward: {
|
|
407
|
+
color: '#81C784',
|
|
277
408
|
},
|
|
278
409
|
footer: {
|
|
279
410
|
flexDirection: 'row',
|
|
280
|
-
justifyContent: 'space-between',
|
|
281
411
|
alignItems: 'center',
|
|
282
|
-
|
|
412
|
+
justifyContent: 'space-between',
|
|
413
|
+
padding: 24,
|
|
283
414
|
borderTopWidth: 1,
|
|
284
|
-
borderTopColor:
|
|
415
|
+
borderTopColor: '#eee',
|
|
416
|
+
backgroundColor: '#fff',
|
|
285
417
|
},
|
|
286
|
-
|
|
418
|
+
darkFooter: {
|
|
419
|
+
backgroundColor: '#2A2A2A',
|
|
420
|
+
borderTopColor: '#333',
|
|
421
|
+
},
|
|
422
|
+
footerButtonCancel: {
|
|
287
423
|
paddingVertical: 8,
|
|
288
424
|
paddingHorizontal: 16,
|
|
289
|
-
|
|
290
|
-
|
|
425
|
+
},
|
|
426
|
+
darkFooterButton: {
|
|
427
|
+
backgroundColor: 'transparent',
|
|
428
|
+
},
|
|
429
|
+
footerButtonConfirm: {
|
|
430
|
+
paddingVertical: 16,
|
|
431
|
+
paddingHorizontal: 32,
|
|
432
|
+
borderRadius: 16,
|
|
433
|
+
backgroundColor: '#fff',
|
|
434
|
+
borderWidth: 1,
|
|
435
|
+
borderColor: '#000',
|
|
436
|
+
},
|
|
437
|
+
darkFooterButtonConfirm: {
|
|
438
|
+
backgroundColor: '#fff',
|
|
439
|
+
borderColor: '#fff',
|
|
291
440
|
},
|
|
292
441
|
footerButtonText: {
|
|
293
|
-
color:
|
|
442
|
+
color: '#666',
|
|
443
|
+
fontSize: 16,
|
|
444
|
+
},
|
|
445
|
+
footerButtonTextConfirm: {
|
|
446
|
+
color: '#000',
|
|
294
447
|
fontSize: 16,
|
|
295
448
|
fontWeight: '600',
|
|
296
449
|
},
|
|
297
450
|
selectedCount: {
|
|
298
451
|
fontSize: 16,
|
|
299
|
-
color:
|
|
452
|
+
color: '#666',
|
|
453
|
+
},
|
|
454
|
+
lightBackground: {
|
|
455
|
+
backgroundColor: '#fff',
|
|
456
|
+
},
|
|
457
|
+
darkBackground: {
|
|
458
|
+
backgroundColor: '#1A1A1A',
|
|
459
|
+
},
|
|
460
|
+
lightHandle: {
|
|
461
|
+
backgroundColor: '#ccc',
|
|
462
|
+
},
|
|
463
|
+
darkHandle: {
|
|
464
|
+
backgroundColor: '#666',
|
|
300
465
|
},
|
|
301
466
|
});
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
TouchableOpacity,
|
|
7
7
|
ActivityIndicator,
|
|
8
8
|
Dimensions,
|
|
9
|
+
Platform,
|
|
9
10
|
} from 'react-native';
|
|
10
11
|
import BottomSheet from '@gorhom/bottom-sheet';
|
|
11
12
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
|
@@ -52,6 +53,18 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
|
|
|
52
53
|
if (visible) {
|
|
53
54
|
bottomSheetRef.current?.expand();
|
|
54
55
|
loadInitialStatus();
|
|
56
|
+
|
|
57
|
+
// Debug mode for Expo Go
|
|
58
|
+
if (debug || Platform.OS === 'web') {
|
|
59
|
+
console.log('Debug mode enabled - Using mock data for onboarding');
|
|
60
|
+
// Pre-populate with mock connections in debug mode
|
|
61
|
+
if (test || Platform.OS === 'web') {
|
|
62
|
+
setConnections({
|
|
63
|
+
instagram: { userName: 'instagram_user', connected: true },
|
|
64
|
+
youtube: { userName: 'youtube_user', connected: true },
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
55
68
|
} else {
|
|
56
69
|
bottomSheetRef.current?.close();
|
|
57
70
|
}
|
|
@@ -137,6 +150,18 @@ export const UniversalOnboarding: React.FC<UniversalOnboardingProps> = ({
|
|
|
137
150
|
case 'training':
|
|
138
151
|
return (
|
|
139
152
|
<TrainingModal
|
|
153
|
+
visible={step === 'training'}
|
|
154
|
+
onClose={onClose}
|
|
155
|
+
onComplete={() => {
|
|
156
|
+
onComplete('https://api2.onairos.uk', 'dummy-token', {
|
|
157
|
+
pin,
|
|
158
|
+
connections,
|
|
159
|
+
selectedTier,
|
|
160
|
+
tierData: requestData?.[selectedTier],
|
|
161
|
+
});
|
|
162
|
+
}}
|
|
163
|
+
modelKey="onairosTrainingModel"
|
|
164
|
+
username="demo_user"
|
|
140
165
|
progress={training.progress}
|
|
141
166
|
eta={training.eta}
|
|
142
167
|
onCancel={onClose}
|