@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.
Files changed (155) hide show
  1. package/README.md +23 -3
  2. package/lib/commonjs/api/index.js +109 -86
  3. package/lib/commonjs/api/index.js.map +1 -1
  4. package/lib/commonjs/components/OnairosButton.js +20 -13
  5. package/lib/commonjs/components/OnairosButton.js.map +1 -1
  6. package/lib/commonjs/components/Overlay.js +260 -108
  7. package/lib/commonjs/components/Overlay.js.map +1 -1
  8. package/lib/commonjs/components/UniversalOnboarding.js +30 -0
  9. package/lib/commonjs/components/UniversalOnboarding.js.map +1 -1
  10. package/lib/commonjs/components/onboarding/OAuthWebView.js +28 -9
  11. package/lib/commonjs/components/onboarding/OAuthWebView.js.map +1 -1
  12. package/lib/commonjs/components/onboarding/PlatformConnector.js +6 -1
  13. package/lib/commonjs/components/onboarding/PlatformConnector.js.map +1 -1
  14. package/lib/commonjs/components/screens/ConnectorScreen.js +3 -2
  15. package/lib/commonjs/components/screens/ConnectorScreen.js.map +1 -1
  16. package/lib/commonjs/constants/index.js +1 -1
  17. package/lib/commonjs/hooks/useConnections.js +77 -15
  18. package/lib/commonjs/hooks/useConnections.js.map +1 -1
  19. package/lib/commonjs/hooks/useCredentials.js +2 -0
  20. package/lib/commonjs/hooks/useCredentials.js.map +1 -1
  21. package/lib/commonjs/index.js +38 -0
  22. package/lib/commonjs/index.js.map +1 -1
  23. package/lib/commonjs/services/oauthService.js +26 -51
  24. package/lib/commonjs/services/oauthService.js.map +1 -1
  25. package/lib/commonjs/types/ambient.d.js +2 -0
  26. package/lib/commonjs/types/ambient.d.js.map +1 -0
  27. package/lib/commonjs/types/node-fix.d.js +2 -0
  28. package/lib/commonjs/types/node-fix.d.js.map +1 -0
  29. package/lib/commonjs/types/node-override.d.js +2 -0
  30. package/lib/commonjs/types/node-override.d.js.map +1 -0
  31. package/lib/commonjs/types/types.d.js +2 -0
  32. package/lib/commonjs/types/types.d.js.map +1 -0
  33. package/lib/commonjs/utils/encryption.js +8 -2
  34. package/lib/commonjs/utils/encryption.js.map +1 -1
  35. package/lib/commonjs/utils/secureStorage.js +148 -42
  36. package/lib/commonjs/utils/secureStorage.js.map +1 -1
  37. package/lib/module/api/index.js +109 -86
  38. package/lib/module/api/index.js.map +1 -1
  39. package/lib/module/components/OnairosButton.js +21 -14
  40. package/lib/module/components/OnairosButton.js.map +1 -1
  41. package/lib/module/components/Overlay.js +260 -110
  42. package/lib/module/components/Overlay.js.map +1 -1
  43. package/lib/module/components/UniversalOnboarding.js +31 -1
  44. package/lib/module/components/UniversalOnboarding.js.map +1 -1
  45. package/lib/module/components/onboarding/OAuthWebView.js +28 -9
  46. package/lib/module/components/onboarding/OAuthWebView.js.map +1 -1
  47. package/lib/module/components/onboarding/PlatformConnector.js +6 -1
  48. package/lib/module/components/onboarding/PlatformConnector.js.map +1 -1
  49. package/lib/module/components/screens/ConnectorScreen.js +3 -2
  50. package/lib/module/components/screens/ConnectorScreen.js.map +1 -1
  51. package/lib/module/constants/index.js +1 -1
  52. package/lib/module/hooks/useConnections.js +77 -14
  53. package/lib/module/hooks/useConnections.js.map +1 -1
  54. package/lib/module/hooks/useCredentials.js +2 -0
  55. package/lib/module/hooks/useCredentials.js.map +1 -1
  56. package/lib/module/index.js +27 -9
  57. package/lib/module/index.js.map +1 -1
  58. package/lib/module/services/oauthService.js +26 -33
  59. package/lib/module/services/oauthService.js.map +1 -1
  60. package/lib/module/types/ambient.d.js +2 -0
  61. package/lib/module/types/ambient.d.js.map +1 -0
  62. package/lib/module/types/node-fix.d.js +2 -0
  63. package/lib/module/types/node-fix.d.js.map +1 -0
  64. package/lib/module/types/node-override.d.js +2 -0
  65. package/lib/module/types/node-override.d.js.map +1 -0
  66. package/lib/module/types/types.d.js +2 -0
  67. package/lib/module/types/types.d.js.map +1 -0
  68. package/lib/module/utils/encryption.js +8 -2
  69. package/lib/module/utils/encryption.js.map +1 -1
  70. package/lib/module/utils/secureStorage.js +149 -42
  71. package/lib/module/utils/secureStorage.js.map +1 -1
  72. package/lib/typescript/api/index.d.ts +8 -0
  73. package/lib/typescript/api/index.d.ts.map +1 -0
  74. package/lib/typescript/components/DataRequestModal.d.ts +11 -0
  75. package/lib/typescript/components/DataRequestModal.d.ts.map +1 -0
  76. package/lib/typescript/components/Onairos.d.ts +29 -0
  77. package/lib/typescript/components/Onairos.d.ts.map +1 -0
  78. package/lib/typescript/components/OnairosButton.d.ts +7 -0
  79. package/lib/typescript/components/OnairosButton.d.ts.map +1 -0
  80. package/lib/typescript/components/Overlay.d.ts +18 -0
  81. package/lib/typescript/components/Overlay.d.ts.map +1 -0
  82. package/lib/typescript/components/PinInput.d.ts +4 -0
  83. package/lib/typescript/components/PinInput.d.ts.map +1 -0
  84. package/lib/typescript/components/PlatformList.d.ts +4 -0
  85. package/lib/typescript/components/PlatformList.d.ts.map +1 -0
  86. package/lib/typescript/components/TrainingModal.d.ts +4 -0
  87. package/lib/typescript/components/TrainingModal.d.ts.map +1 -0
  88. package/lib/typescript/components/UniversalOnboarding.d.ts +4 -0
  89. package/lib/typescript/components/UniversalOnboarding.d.ts.map +1 -0
  90. package/lib/typescript/components/onboarding/OAuthWebView.d.ts +4 -0
  91. package/lib/typescript/components/onboarding/OAuthWebView.d.ts.map +1 -0
  92. package/lib/typescript/components/onboarding/OnboardingHeader.d.ts +11 -0
  93. package/lib/typescript/components/onboarding/OnboardingHeader.d.ts.map +1 -0
  94. package/lib/typescript/components/onboarding/PinInput.d.ts +4 -0
  95. package/lib/typescript/components/onboarding/PinInput.d.ts.map +1 -0
  96. package/lib/typescript/components/onboarding/PlatformConnector.d.ts +13 -0
  97. package/lib/typescript/components/onboarding/PlatformConnector.d.ts.map +1 -0
  98. package/lib/typescript/components/screens/ConnectorScreen.d.ts +9 -0
  99. package/lib/typescript/components/screens/ConnectorScreen.d.ts.map +1 -0
  100. package/lib/typescript/components/screens/LoadingScreen.d.ts +9 -0
  101. package/lib/typescript/components/screens/LoadingScreen.d.ts.map +1 -0
  102. package/lib/typescript/components/screens/PinCreationScreen.d.ts +10 -0
  103. package/lib/typescript/components/screens/PinCreationScreen.d.ts.map +1 -0
  104. package/lib/typescript/constants/index.d.ts +52 -0
  105. package/lib/typescript/constants/index.d.ts.map +1 -0
  106. package/lib/typescript/hooks/useConnections.d.ts +9 -0
  107. package/lib/typescript/hooks/useConnections.d.ts.map +1 -0
  108. package/lib/typescript/hooks/useCredentials.d.ts +9 -0
  109. package/lib/typescript/hooks/useCredentials.d.ts.map +1 -0
  110. package/lib/typescript/index.d.ts +45 -0
  111. package/lib/typescript/index.d.ts.map +1 -0
  112. package/lib/typescript/services/oauthService.d.ts +50 -0
  113. package/lib/typescript/services/oauthService.d.ts.map +1 -0
  114. package/lib/typescript/types/index.d.ts +145 -0
  115. package/lib/typescript/types/index.d.ts.map +1 -0
  116. package/lib/typescript/types.d.ts +135 -0
  117. package/lib/typescript/types.d.ts.map +1 -0
  118. package/lib/typescript/utils/api.d.ts +6 -0
  119. package/lib/typescript/utils/api.d.ts.map +1 -0
  120. package/lib/typescript/utils/auth.d.ts +6 -0
  121. package/lib/typescript/utils/auth.d.ts.map +1 -0
  122. package/lib/typescript/utils/crypto.d.ts +4 -0
  123. package/lib/typescript/utils/crypto.d.ts.map +1 -0
  124. package/lib/typescript/utils/debugHelper.d.ts +29 -0
  125. package/lib/typescript/utils/debugHelper.d.ts.map +1 -0
  126. package/lib/typescript/utils/encryption.d.ts +19 -0
  127. package/lib/typescript/utils/encryption.d.ts.map +1 -0
  128. package/lib/typescript/utils/onairosApi.d.ts +72 -0
  129. package/lib/typescript/utils/onairosApi.d.ts.map +1 -0
  130. package/lib/typescript/utils/secureStorage.d.ts +63 -0
  131. package/lib/typescript/utils/secureStorage.d.ts.map +1 -0
  132. package/package.json +16 -4
  133. package/src/api/index.ts +86 -101
  134. package/src/components/OnairosButton.tsx +22 -14
  135. package/src/components/Overlay.tsx +303 -138
  136. package/src/components/UniversalOnboarding.tsx +25 -0
  137. package/src/components/onboarding/OAuthWebView.tsx +27 -7
  138. package/src/components/onboarding/PlatformConnector.tsx +5 -0
  139. package/src/components/screens/ConnectorScreen.tsx +3 -2
  140. package/src/constants/index.ts +81 -81
  141. package/src/hooks/useConnections.ts +76 -16
  142. package/src/hooks/useCredentials.ts +5 -1
  143. package/src/index.ts +30 -3
  144. package/src/services/oauthService.ts +412 -419
  145. package/src/types/ambient.d.ts +29 -0
  146. package/src/types/index.d.ts +48 -8
  147. package/src/types/index.ts +21 -15
  148. package/src/types/node-fix.d.ts +19 -0
  149. package/src/types/node-override.d.ts +24 -0
  150. package/src/types/types.d.ts +18 -0
  151. package/src/types.ts +121 -1
  152. package/src/utils/encryption.ts +7 -2
  153. package/src/utils/secureStorage.ts +155 -56
  154. package/types/index.d.ts +210 -0
  155. 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 { BottomSheetModal, BottomSheetBackdrop } from '@gorhom/bottom-sheet';
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 bottomSheetRef = useRef<BottomSheetModal>(null);
40
- const snapPoints = ['60%']; // Set to 60% of screen height
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
- setDetails(response.AccountInfo);
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
- bottomSheetRef.current?.dismiss();
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
- const serverPublicKey = await getServerPublicKey();
84
- const encryptedModelKey = encryptModelKey(serverPublicKey, modelKey);
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, { username });
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
- showErrorModal('Failed to confirm selection. Please try again.');
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
- return (
115
- <BottomSheetModal
116
- ref={bottomSheetRef}
117
- snapPoints={snapPoints}
118
- handleIndicatorStyle={styles.handleIndicator}
119
- backdropComponent={(props) => (
120
- <BottomSheetBackdrop
121
- {...props}
122
- appearsOnIndex={0}
123
- disappearsOnIndex={-1}
124
- opacity={0.7}
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
- <ScrollView style={styles.content}>
141
- {Object.entries(data).map(([key, value]) => (
142
- <View key={key} style={styles.card}>
143
- <TouchableOpacity
144
- style={styles.checkboxContainer}
145
- onPress={() =>
146
- setSelections((prev) => ({
147
- ...prev,
148
- [key]: !prev[key],
149
- }))
150
- }
151
- >
152
- <View
153
- style={[
154
- styles.checkbox,
155
- selections[key] && styles.checkboxSelected,
156
- ]}
157
- />
158
- <View style={styles.cardContent}>
159
- <Text style={styles.cardTitle}>{value.type} Insight</Text>
160
- <Text style={styles.cardDescription}>
161
- Description: {value.descriptions}
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
- {value.reward && (
164
- <Text style={styles.cardReward}>
165
- Reward: {value.reward}
166
- </Text>
167
- )}
168
- </View>
169
- </TouchableOpacity>
170
- </View>
171
- ))}
172
- </ScrollView>
228
+ )}
229
+ </View>
230
+ </TouchableOpacity>
231
+ </View>
232
+ ))}
233
+ </ScrollView>
173
234
 
174
- <View style={styles.footer}>
175
- <TouchableOpacity
176
- style={styles.footerButton}
177
- onPress={closeOverlay}
178
- >
179
- <Text style={styles.footerButtonText}>Cancel</Text>
180
- </TouchableOpacity>
181
- <Text style={styles.selectedCount}>Selected: {selectedCount}</Text>
182
- <TouchableOpacity
183
- style={styles.footerButton}
184
- onPress={confirmSelection}
185
- >
186
- <Text style={styles.footerButtonText}>Confirm</Text>
187
- </TouchableOpacity>
188
- </View>
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
- </BottomSheetModal>
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: COLORS.white,
200
- width: SCREEN_WIDTH,
277
+ backgroundColor: '#fff',
201
278
  },
202
- handleIndicator: {
203
- backgroundColor: '#999',
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: 'space-between',
211
- padding: 16,
212
- backgroundColor: COLORS.primary,
213
- borderTopLeftRadius: 10,
214
- borderTopRightRadius: 10,
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
- headerTitle: {
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
- color: COLORS.white,
219
- fontWeight: 'bold',
315
+ marginHorizontal: 16,
316
+ color: '#666',
220
317
  },
221
- closeButton: {
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: COLORS.white,
224
- padding: 8,
331
+ color: '#000',
332
+ },
333
+ appName: {
334
+ fontSize: 16,
335
+ color: '#666',
336
+ },
337
+ darkSubText: {
338
+ color: '#999',
225
339
  },
226
- username: {
227
- fontSize: 18,
228
- color: COLORS.white,
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: 16,
349
+ padding: 24,
233
350
  },
234
351
  card: {
235
- backgroundColor: COLORS.white,
236
- borderRadius: 8,
237
- marginBottom: 12,
238
- shadowColor: COLORS.black,
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.1,
241
- shadowRadius: 4,
242
- elevation: 3,
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: 'center',
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: COLORS.primary,
377
+ borderColor: '#2196F3',
255
378
  marginRight: 12,
379
+ marginTop: 2,
380
+ },
381
+ darkCheckbox: {
382
+ borderColor: '#2196F3',
256
383
  },
257
384
  checkboxSelected: {
258
- backgroundColor: COLORS.primary,
385
+ backgroundColor: '#2196F3',
259
386
  },
260
387
  cardContent: {
261
388
  flex: 1,
262
389
  },
263
390
  cardTitle: {
264
- fontSize: 18,
265
- fontWeight: 'bold',
391
+ fontSize: 16,
392
+ fontWeight: '600',
266
393
  marginBottom: 4,
394
+ color: '#333',
267
395
  },
268
396
  cardDescription: {
269
397
  fontSize: 14,
270
- color: COLORS.gray,
271
- marginBottom: 4,
398
+ color: '#666',
399
+ marginBottom: 6,
272
400
  },
273
401
  cardReward: {
274
402
  fontSize: 14,
275
- color: COLORS.success,
276
- fontWeight: 'bold',
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
- padding: 16,
412
+ justifyContent: 'space-between',
413
+ padding: 24,
283
414
  borderTopWidth: 1,
284
- borderTopColor: COLORS.lightGray,
415
+ borderTopColor: '#eee',
416
+ backgroundColor: '#fff',
285
417
  },
286
- footerButton: {
418
+ darkFooter: {
419
+ backgroundColor: '#2A2A2A',
420
+ borderTopColor: '#333',
421
+ },
422
+ footerButtonCancel: {
287
423
  paddingVertical: 8,
288
424
  paddingHorizontal: 16,
289
- borderRadius: 8,
290
- backgroundColor: COLORS.primary,
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: COLORS.white,
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: COLORS.gray,
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}