@onairos/react-native 3.0.22 → 3.0.25

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 (39) hide show
  1. package/lib/commonjs/components/OnairosButton.js +2 -3
  2. package/lib/commonjs/components/OnairosButton.js.map +1 -1
  3. package/lib/commonjs/components/TrainingModal.js +120 -16
  4. package/lib/commonjs/components/TrainingModal.js.map +1 -1
  5. package/lib/commonjs/components/UniversalOnboarding.js +242 -39
  6. package/lib/commonjs/components/UniversalOnboarding.js.map +1 -1
  7. package/lib/commonjs/components/onboarding/OAuthWebView.js +138 -27
  8. package/lib/commonjs/components/onboarding/OAuthWebView.js.map +1 -1
  9. package/lib/commonjs/constants/index.js +3 -2
  10. package/lib/commonjs/constants/index.js.map +1 -1
  11. package/lib/commonjs/services/platformAuthService.js +227 -0
  12. package/lib/commonjs/services/platformAuthService.js.map +1 -0
  13. package/lib/module/components/OnairosButton.js +2 -3
  14. package/lib/module/components/OnairosButton.js.map +1 -1
  15. package/lib/module/components/TrainingModal.js +120 -17
  16. package/lib/module/components/TrainingModal.js.map +1 -1
  17. package/lib/module/components/UniversalOnboarding.js +243 -40
  18. package/lib/module/components/UniversalOnboarding.js.map +1 -1
  19. package/lib/module/components/onboarding/OAuthWebView.js +139 -28
  20. package/lib/module/components/onboarding/OAuthWebView.js.map +1 -1
  21. package/lib/module/constants/index.js +3 -2
  22. package/lib/module/constants/index.js.map +1 -1
  23. package/lib/module/services/platformAuthService.js +213 -0
  24. package/lib/module/services/platformAuthService.js.map +1 -0
  25. package/lib/typescript/components/OnairosButton.d.ts.map +1 -1
  26. package/lib/typescript/components/TrainingModal.d.ts.map +1 -1
  27. package/lib/typescript/components/UniversalOnboarding.d.ts.map +1 -1
  28. package/lib/typescript/components/onboarding/OAuthWebView.d.ts.map +1 -1
  29. package/lib/typescript/constants/index.d.ts +1 -0
  30. package/lib/typescript/constants/index.d.ts.map +1 -1
  31. package/lib/typescript/services/platformAuthService.d.ts +45 -0
  32. package/lib/typescript/services/platformAuthService.d.ts.map +1 -0
  33. package/package.json +2 -1
  34. package/src/components/OnairosButton.tsx +1 -4
  35. package/src/components/TrainingModal.tsx +202 -61
  36. package/src/components/UniversalOnboarding.tsx +232 -35
  37. package/src/components/onboarding/OAuthWebView.tsx +135 -25
  38. package/src/constants/index.ts +3 -2
  39. package/src/services/platformAuthService.ts +241 -0
@@ -1,11 +1,14 @@
1
- import React from 'react';
2
- import { View, Text, StyleSheet, TouchableOpacity, ActivityIndicator, Dimensions, Modal, TouchableWithoutFeedback, SafeAreaView } from 'react-native';
1
+ import React, { useState, useEffect } from 'react';
2
+ import { View, Text, StyleSheet, TouchableOpacity, ActivityIndicator, Dimensions, Modal, Animated, TouchableWithoutFeedback, SafeAreaView, TextInput, KeyboardAvoidingView, Platform } from 'react-native';
3
3
  import Icon from 'react-native-vector-icons/MaterialIcons';
4
4
  import { COLORS } from '../constants';
5
5
  const {
6
6
  width,
7
7
  height
8
8
  } = Dimensions.get('window');
9
+
10
+ // Dynamic training messages that appear during the process
11
+ const TRAINING_MESSAGES = ["Loading your data...", "Analyzing your digital footprint...", "Your mind is very unique...", "Creating your AI persona...", "Building neural pathways...", "Finalizing your digital twin...", "Almost ready...", "Training complete!"];
9
12
  export const TrainingModal = ({
10
13
  visible,
11
14
  progress,
@@ -15,13 +18,48 @@ export const TrainingModal = ({
15
18
  modelKey,
16
19
  username
17
20
  }) => {
21
+ const [email, setEmail] = useState('');
22
+ const [showEmailInput, setShowEmailInput] = useState(false);
23
+ const [currentMessage, setCurrentMessage] = useState(TRAINING_MESSAGES[0]);
24
+ const [messageIndex, setMessageIndex] = useState(0);
18
25
  const progressPercentage = Math.round(progress * 100);
26
+
27
+ // Update training message based on progress
28
+ useEffect(() => {
29
+ if (progress > 0) {
30
+ const newIndex = Math.min(Math.floor(progress * TRAINING_MESSAGES.length), TRAINING_MESSAGES.length - 1);
31
+ if (newIndex !== messageIndex) {
32
+ setMessageIndex(newIndex);
33
+ setCurrentMessage(TRAINING_MESSAGES[newIndex]);
34
+ }
35
+ }
36
+ }, [progress, messageIndex]);
37
+
38
+ // Show email input when training is complete
39
+ useEffect(() => {
40
+ if (progress >= 1 && !showEmailInput) {
41
+ setShowEmailInput(true);
42
+ }
43
+ }, [progress, showEmailInput]);
44
+ const handleEmailSubmit = () => {
45
+ if (email.trim() && onComplete) {
46
+ // Pass email data to the completion handler
47
+ onComplete();
48
+ }
49
+ };
50
+ const isValidEmail = email => {
51
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
52
+ return emailRegex.test(email);
53
+ };
19
54
  return /*#__PURE__*/React.createElement(Modal, {
20
55
  visible: visible,
21
56
  transparent: true,
22
57
  animationType: "none",
23
58
  statusBarTranslucent: true,
24
59
  onRequestClose: onCancel
60
+ }, /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
61
+ style: styles.modalOverlay,
62
+ behavior: Platform.OS === 'ios' ? 'padding' : 'height'
25
63
  }, /*#__PURE__*/React.createElement(TouchableWithoutFeedback, null, /*#__PURE__*/React.createElement(View, {
26
64
  style: styles.modalOverlay
27
65
  }, /*#__PURE__*/React.createElement(TouchableWithoutFeedback, null, /*#__PURE__*/React.createElement(View, {
@@ -34,7 +72,7 @@ export const TrainingModal = ({
34
72
  style: styles.container
35
73
  }, /*#__PURE__*/React.createElement(View, {
36
74
  style: styles.content
37
- }, /*#__PURE__*/React.createElement(Icon, {
75
+ }, !showEmailInput ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, {
38
76
  name: "auto_awesome",
39
77
  size: 48,
40
78
  color: COLORS.primary
@@ -46,7 +84,7 @@ export const TrainingModal = ({
46
84
  style: styles.progressContainer
47
85
  }, /*#__PURE__*/React.createElement(View, {
48
86
  style: styles.progressBar
49
- }, /*#__PURE__*/React.createElement(View, {
87
+ }, /*#__PURE__*/React.createElement(Animated.View, {
50
88
  style: [styles.progressFill, {
51
89
  width: `${progressPercentage}%`
52
90
  }]
@@ -61,19 +99,51 @@ export const TrainingModal = ({
61
99
  color: COLORS.primary
62
100
  }), /*#__PURE__*/React.createElement(Text, {
63
101
  style: styles.loadingText
64
- }, "Processing your data...")), /*#__PURE__*/React.createElement(View, {
102
+ }, currentMessage)), /*#__PURE__*/React.createElement(View, {
103
+ style: styles.footer
104
+ }, /*#__PURE__*/React.createElement(TouchableOpacity, {
105
+ style: styles.cancelButton,
106
+ onPress: onCancel
107
+ }, /*#__PURE__*/React.createElement(Text, {
108
+ style: styles.cancelButtonText
109
+ }, "Cancel")))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, {
110
+ name: "check_circle",
111
+ size: 48,
112
+ color: "#4CAF50"
113
+ }), /*#__PURE__*/React.createElement(Text, {
114
+ style: styles.title
115
+ }, "Training Complete!"), /*#__PURE__*/React.createElement(Text, {
116
+ style: styles.subtitle
117
+ }, "Your AI model is ready. Enter your email to receive your account details and access your digital twin."), /*#__PURE__*/React.createElement(View, {
118
+ style: styles.emailContainer
119
+ }, /*#__PURE__*/React.createElement(Text, {
120
+ style: styles.emailLabel
121
+ }, "Email Address"), /*#__PURE__*/React.createElement(TextInput, {
122
+ style: styles.emailInput,
123
+ placeholder: "Enter your email address",
124
+ placeholderTextColor: "#999",
125
+ value: email,
126
+ onChangeText: setEmail,
127
+ keyboardType: "email-address",
128
+ autoCapitalize: "none",
129
+ autoCorrect: false,
130
+ autoComplete: "email"
131
+ }), /*#__PURE__*/React.createElement(Text, {
132
+ style: styles.emailHint
133
+ }, "We'll send you login credentials and access to your AI persona")), /*#__PURE__*/React.createElement(View, {
65
134
  style: styles.footer
66
135
  }, /*#__PURE__*/React.createElement(TouchableOpacity, {
67
136
  style: styles.cancelButton,
68
137
  onPress: onCancel
69
138
  }, /*#__PURE__*/React.createElement(Text, {
70
139
  style: styles.cancelButtonText
71
- }, "Cancel")), progress >= 1 && /*#__PURE__*/React.createElement(TouchableOpacity, {
72
- style: styles.completeButton,
73
- onPress: onComplete
140
+ }, "Cancel")), /*#__PURE__*/React.createElement(TouchableOpacity, {
141
+ style: [styles.completeButton, !isValidEmail(email) && styles.completeButtonDisabled],
142
+ onPress: handleEmailSubmit,
143
+ disabled: !isValidEmail(email)
74
144
  }, /*#__PURE__*/React.createElement(Text, {
75
- style: styles.completeButtonText
76
- }, "Complete"))))))))));
145
+ style: [styles.completeButtonText, !isValidEmail(email) && styles.completeButtonTextDisabled]
146
+ }, "Complete Setup"))))))))))));
77
147
  };
78
148
  const styles = StyleSheet.create({
79
149
  modalOverlay: {
@@ -85,7 +155,7 @@ const styles = StyleSheet.create({
85
155
  bottomSheet: {
86
156
  backgroundColor: '#fff',
87
157
  width: width,
88
- height: height * 0.6,
158
+ height: height * 0.7,
89
159
  borderTopLeftRadius: 24,
90
160
  borderTopRightRadius: 24,
91
161
  overflow: 'hidden'
@@ -125,7 +195,8 @@ const styles = StyleSheet.create({
125
195
  fontSize: 16,
126
196
  color: COLORS.text.secondary,
127
197
  textAlign: 'center',
128
- marginBottom: 32
198
+ marginBottom: 32,
199
+ lineHeight: 22
129
200
  },
130
201
  progressContainer: {
131
202
  width: '100%',
@@ -159,9 +230,37 @@ const styles = StyleSheet.create({
159
230
  marginBottom: 32
160
231
  },
161
232
  loadingText: {
233
+ fontSize: 16,
234
+ color: COLORS.text.primary,
235
+ marginLeft: 12,
236
+ fontWeight: '500'
237
+ },
238
+ emailContainer: {
239
+ width: '100%',
240
+ marginBottom: 32
241
+ },
242
+ emailLabel: {
243
+ fontSize: 16,
244
+ fontWeight: '600',
245
+ color: COLORS.text.primary,
246
+ marginBottom: 8
247
+ },
248
+ emailInput: {
249
+ width: '100%',
250
+ height: 48,
251
+ borderWidth: 1,
252
+ borderColor: '#E0E0E0',
253
+ borderRadius: 12,
254
+ paddingHorizontal: 16,
255
+ fontSize: 16,
256
+ color: COLORS.text.primary,
257
+ backgroundColor: '#F8F8F8'
258
+ },
259
+ emailHint: {
162
260
  fontSize: 14,
163
261
  color: COLORS.text.secondary,
164
- marginLeft: 8
262
+ marginTop: 8,
263
+ textAlign: 'center'
165
264
  },
166
265
  footer: {
167
266
  flexDirection: 'row',
@@ -186,14 +285,18 @@ const styles = StyleSheet.create({
186
285
  paddingVertical: 16,
187
286
  paddingHorizontal: 32,
188
287
  borderRadius: 16,
189
- backgroundColor: '#fff',
190
- borderWidth: 1,
191
- borderColor: '#000'
288
+ backgroundColor: '#000'
289
+ },
290
+ completeButtonDisabled: {
291
+ backgroundColor: '#E0E0E0'
192
292
  },
193
293
  completeButtonText: {
194
294
  fontSize: 16,
195
295
  fontWeight: '600',
196
- color: '#000'
296
+ color: '#fff'
297
+ },
298
+ completeButtonTextDisabled: {
299
+ color: '#999'
197
300
  }
198
301
  });
199
302
  //# sourceMappingURL=TrainingModal.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","Text","StyleSheet","TouchableOpacity","ActivityIndicator","Dimensions","Modal","TouchableWithoutFeedback","SafeAreaView","Icon","COLORS","width","height","get","TrainingModal","visible","progress","eta","onCancel","onComplete","modelKey","username","progressPercentage","Math","round","createElement","transparent","animationType","statusBarTranslucent","onRequestClose","style","styles","modalOverlay","bottomSheet","handleContainer","handle","container","content","name","size","color","primary","title","subtitle","progressContainer","progressBar","progressFill","progressText","etaText","loadingContainer","loadingText","footer","cancelButton","onPress","cancelButtonText","completeButton","completeButtonText","create","flex","backgroundColor","justifyContent","alignItems","borderTopLeftRadius","borderTopRightRadius","overflow","paddingTop","paddingBottom","borderRadius","padding","fontSize","fontWeight","marginTop","marginBottom","text","textAlign","secondary","border","flexDirection","marginLeft","borderTopWidth","borderTopColor","paddingHorizontal","paddingVertical","borderWidth","borderColor"],"sourceRoot":"..\\..\\..\\src","sources":["components/TrainingModal.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,gBAAgB,EAChBC,iBAAiB,EACjBC,UAAU,EACVC,KAAK,EAELC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aAAa,EAAE,KAAK;IACpBhB,UAAU,EAAE,QAAQ;IACpBW,YAAY,EAAE;EAChB,CAAC;EACDtB,WAAW,EAAE;IACXmB,QAAQ,EAAE,EAAE;IACZ7B,KAAK,EAAE9B,MAAM,CAAC+D,IAAI,CAACE,SAAS;IAC5BG,UAAU,EAAE;EACd,CAAC;EACD3B,MAAM,EAAE;IACN0B,aAAa,EAAE,KAAK;IACpBhB,UAAU,EAAE,QAAQ;IACpBD,cAAc,EAAE,eAAe;IAC/BjD,KAAK,EAAE,MAAM;IACboE,cAAc,EAAE,CAAC;IACjBC,cAAc,EAAE,MAAM;IACtBf,UAAU,EAAE,EAAE;IACdgB,iBAAiB,EAAE,EAAE;IACrBf,aAAa,EAAE;EACjB,CAAC;EACDd,YAAY,EAAE;IACZ8B,eAAe,EAAE,CAAC;IAClBD,iBAAiB,EAAE;EACrB,CAAC;EACD3B,gBAAgB,EAAE;IAChBe,QAAQ,EAAE,EAAE;IACZ7B,KAAK,EAAE;EACT,CAAC;EACDe,cAAc,EAAE;IACd2B,eAAe,EAAE,EAAE;IACnBD,iBAAiB,EAAE,EAAE;IACrBd,YAAY,EAAE,EAAE;IAChBR,eAAe,EAAE,MAAM;IACvBwB,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE;EACf,CAAC;EACD5B,kBAAkB,EAAE;IAClBa,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjB9B,KAAK,EAAE;EACT;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useState","useEffect","View","Text","StyleSheet","TouchableOpacity","ActivityIndicator","Dimensions","Modal","Animated","TouchableWithoutFeedback","SafeAreaView","TextInput","KeyboardAvoidingView","Platform","Icon","COLORS","width","height","get","TRAINING_MESSAGES","TrainingModal","visible","progress","eta","onCancel","onComplete","modelKey","username","email","setEmail","showEmailInput","setShowEmailInput","currentMessage","setCurrentMessage","messageIndex","setMessageIndex","progressPercentage","Math","round","newIndex","min","floor","length","handleEmailSubmit","trim","isValidEmail","emailRegex","test","createElement","transparent","animationType","statusBarTranslucent","onRequestClose","style","styles","modalOverlay","behavior","OS","bottomSheet","handleContainer","handle","container","content","Fragment","name","size","color","primary","title","subtitle","progressContainer","progressBar","progressFill","progressText","etaText","loadingContainer","loadingText","footer","cancelButton","onPress","cancelButtonText","emailContainer","emailLabel","emailInput","placeholder","placeholderTextColor","value","onChangeText","keyboardType","autoCapitalize","autoCorrect","autoComplete","emailHint","completeButton","completeButtonDisabled","disabled","completeButtonText","completeButtonTextDisabled","create","flex","backgroundColor","justifyContent","alignItems","borderTopLeftRadius","borderTopRightRadius","overflow","paddingTop","paddingBottom","borderRadius","padding","fontSize","fontWeight","marginTop","marginBottom","text","textAlign","secondary","lineHeight","border","flexDirection","marginLeft","borderWidth","borderColor","paddingHorizontal","borderTopWidth","borderTopColor","paddingVertical"],"sourceRoot":"..\\..\\..\\src","sources":["components/TrainingModal.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,SACEC,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,gBAAgB,EAChBC,iBAAiB,EACjBC,UAAU,EACVC,KAAK,EACLC,QAAQ,EACRC,wBAAwB,EACxBC,YAAY,EACZC,SAAS,EACTC,oBAAoB,EACpBC,QAAQ,QACH,cAAc;AACrB,OAAOC,IAAI,MAAM,yCAAyC;AAC1D,SAASC,MAAM,QAAQ,cAAc;AAGrC,MAAM;EAAEC,KAAK;EAAEC;AAAO,CAAC,GAAGX,UAAU,CAACY,GAAG,CAAC,QAAQ,CAAC;;AAElD;AACA,MAAMC,iBAAiB,GAAG,CACxB,sBAAsB,EACtB,qCAAqC,EACrC,6BAA6B,EAC7B,6BAA6B,EAC7B,6BAA6B,EAC7B,iCAAiC,EACjC,iBAAiB,EACjB,oBAAoB,CACrB;AAED,OAAO,MAAMC,aAA2C,GAAGA,CAAC;EAC1DC,OAAO;EACPC,QAAQ;EACRC,GAAG;E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AE;EACb,CAAC;EACDtC,MAAM,EAAE;IACN0C,aAAa,EAAE,KAAK;IACpBjB,UAAU,EAAE,QAAQ;IACpBD,cAAc,EAAE,eAAe;IAC/BrF,KAAK,EAAE,MAAM;IACb4G,cAAc,EAAE,CAAC;IACjBC,cAAc,EAAE,MAAM;IACtBnB,UAAU,EAAE,EAAE;IACdiB,iBAAiB,EAAE,EAAE;IACrBhB,aAAa,EAAE;EACjB,CAAC;EACD7B,YAAY,EAAE;IACZgD,eAAe,EAAE,CAAC;IAClBH,iBAAiB,EAAE;EACrB,CAAC;EACD3C,gBAAgB,EAAE;IAChB8B,QAAQ,EAAE,EAAE;IACZ5C,KAAK,EAAE;EACT,CAAC;EACD2B,cAAc,EAAE;IACdiC,eAAe,EAAE,EAAE;IACnBH,iBAAiB,EAAE,EAAE;IACrBf,YAAY,EAAE,EAAE;IAChBR,eAAe,EAAE;EACnB,CAAC;EACDN,sBAAsB,EAAE;IACtBM,eAAe,EAAE;EACnB,CAAC;EACDJ,kBAAkB,EAAE;IAClBc,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjB7C,KAAK,EAAE;EACT,CAAC;EACD+B,0BAA0B,EAAE;IAC1B/B,KAAK,EAAE;EACT;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,9 +1,12 @@
1
1
  import React, { useCallback, useEffect, useState } from 'react';
2
- import { View, Text, StyleSheet, TouchableOpacity, Dimensions, Platform, Modal, Animated, SafeAreaView, TouchableWithoutFeedback, ScrollView, Image, Switch } from 'react-native';
2
+ import { View, Text, StyleSheet, TouchableOpacity, ActivityIndicator, Dimensions, Platform, Modal, Animated, SafeAreaView, TouchableWithoutFeedback, ScrollView, Image, Switch, Linking } from 'react-native';
3
3
  import Icon from 'react-native-vector-icons/MaterialIcons';
4
4
  import { PinInput } from './PinInput';
5
5
  import { TrainingModal } from './TrainingModal';
6
+ import { OAuthWebView } from './onboarding/OAuthWebView';
6
7
  import { useConnections } from '../hooks/useConnections';
8
+ import { COLORS } from '../constants';
9
+ import { initiateOAuth, initiateNativeAuth, hasNativeSDK, isOAuthCallback } from '../services/platformAuthService';
7
10
  const {
8
11
  height,
9
12
  width
@@ -30,6 +33,11 @@ export const UniversalOnboarding = ({
30
33
  });
31
34
  const [slideAnim] = useState(new Animated.Value(height));
32
35
  const [platformToggles, setPlatformToggles] = useState({});
36
+ const [oauthUrl, setOauthUrl] = useState('');
37
+ const [currentPlatform, setCurrentPlatform] = useState('');
38
+ const [userEmail, setUserEmail] = useState('user@example.com'); // Use proper email instead of random username
39
+ const [isConnectingPlatform, setIsConnectingPlatform] = useState(false);
40
+ const [connectingPlatform, setConnectingPlatform] = useState(null);
33
41
  const platforms = [{
34
42
  id: 'instagram',
35
43
  name: 'Instagram',
@@ -67,6 +75,29 @@ export const UniversalOnboarding = ({
67
75
  bounciness: 0
68
76
  }).start();
69
77
 
78
+ // Set up deep link listener for OAuth callbacks
79
+ // Using the subscription pattern for React Native's Linking API
80
+ const subscription = Linking.addListener('url', ({
81
+ url
82
+ }) => {
83
+ if (isOAuthCallback(url)) {
84
+ handleOAuthCallback(url);
85
+ }
86
+ });
87
+
88
+ // Check for initial URL (app was opened via deep link)
89
+ Linking.getInitialURL().then(initialUrl => {
90
+ if (initialUrl && isOAuthCallback(initialUrl)) {
91
+ handleOAuthCallback(initialUrl);
92
+ }
93
+ });
94
+
95
+ // Return cleanup function
96
+ return () => {
97
+ // Remove event listener using the subscription
98
+ subscription.remove();
99
+ };
100
+
70
101
  // Initialize platform toggles
71
102
  const initialToggles = {};
72
103
  platforms.forEach(platform => {
@@ -127,34 +158,165 @@ export const UniversalOnboarding = ({
127
158
  const status = await getConnectionStatus();
128
159
  setConnections(status);
129
160
  }, [getConnectionStatus]);
130
- const togglePlatform = useCallback(platformId => {
131
- setPlatformToggles(prev => ({
132
- ...prev,
133
- [platformId]: !prev[platformId]
134
- }));
135
- }, []);
161
+ const togglePlatform = useCallback(async platformId => {
162
+ if (!platformToggles[platformId]) {
163
+ // Attempt to connect platform
164
+ try {
165
+ setIsConnectingPlatform(true);
166
+ setConnectingPlatform(platformId);
167
+ console.log(`Initiating connection for ${platformId}`);
168
+
169
+ // Check if platform has a native SDK
170
+ if (hasNativeSDK(platformId)) {
171
+ console.log(`Using native SDK for ${platformId}`);
172
+ // Use native SDK for authentication
173
+ const success = await initiateNativeAuth(platformId);
174
+ if (success) {
175
+ console.log(`Native authentication successful for ${platformId}`);
176
+ // Update platform toggle state
177
+ setPlatformToggles(prev => ({
178
+ ...prev,
179
+ [platformId]: true
180
+ }));
181
+
182
+ // Update connections state
183
+ setConnections(prev => ({
184
+ ...prev,
185
+ [platformId]: {
186
+ userName: userEmail,
187
+ connected: true
188
+ }
189
+ }));
190
+ }
191
+ } else {
192
+ console.log(`Initiating OAuth flow for ${platformId}`);
193
+ // Use OAuth flow through proxy server
194
+ const oauthUrl = await initiateOAuth(platformId, userEmail);
195
+ if (oauthUrl) {
196
+ console.log(`Received OAuth URL for ${platformId}: ${oauthUrl}`);
197
+ setCurrentPlatform(platformId);
198
+ setOauthUrl(oauthUrl);
199
+ setStep('oauth');
200
+ } else {
201
+ console.error(`No OAuth URL returned for ${platformId}`);
202
+ }
203
+ }
204
+ } catch (error) {
205
+ console.error(`Error connecting ${platformId}:`, error);
206
+ // Reset toggle state on error
207
+ setPlatformToggles(prev => ({
208
+ ...prev,
209
+ [platformId]: false
210
+ }));
211
+ } finally {
212
+ setIsConnectingPlatform(false);
213
+ setConnectingPlatform(null);
214
+ }
215
+ } else {
216
+ // Disconnect platform
217
+ console.log(`Disconnecting ${platformId}`);
218
+ setPlatformToggles(prev => ({
219
+ ...prev,
220
+ [platformId]: false
221
+ }));
222
+
223
+ // Update connections state
224
+ setConnections(prev => {
225
+ const newConnections = {
226
+ ...prev
227
+ };
228
+ delete newConnections[platformId];
229
+ return newConnections;
230
+ });
231
+ }
232
+ }, [platformToggles, userEmail]);
233
+
234
+ /**
235
+ * Handles OAuth callback URLs
236
+ */
237
+ const handleOAuthCallback = useCallback(url => {
238
+ try {
239
+ // Extract the authorization code from the URL
240
+ const parsedUrl = new URL(url);
241
+ const code = parsedUrl.searchParams.get('code');
242
+ const platform = parsedUrl.searchParams.get('platform') || currentPlatform;
243
+ if (code && platform) {
244
+ // Update connections state
245
+ setConnections(prev => ({
246
+ ...prev,
247
+ [platform]: {
248
+ userName: userEmail,
249
+ connected: true
250
+ }
251
+ }));
252
+
253
+ // Update platform toggles
254
+ setPlatformToggles(prev => ({
255
+ ...prev,
256
+ [platform]: true
257
+ }));
258
+
259
+ // Return to the connect step
260
+ setStep('connect');
261
+ }
262
+ } catch (error) {
263
+ console.error('Error handling OAuth callback:', error);
264
+ }
265
+ }, [currentPlatform, userEmail]);
266
+
267
+ /**
268
+ * Handles completion of the OAuth flow
269
+ */
270
+ const handleOAuthSuccess = useCallback(code => {
271
+ console.log(`OAuth success for ${currentPlatform} with code: ${code}`);
272
+
273
+ // Update connections for the current platform
274
+ if (currentPlatform) {
275
+ // Update connections state
276
+ setConnections(prev => ({
277
+ ...prev,
278
+ [currentPlatform]: {
279
+ userName: userEmail,
280
+ connected: true
281
+ }
282
+ }));
283
+
284
+ // Update platform toggles
285
+ setPlatformToggles(prev => ({
286
+ ...prev,
287
+ [currentPlatform]: true
288
+ }));
289
+
290
+ // In a real implementation, we would send the code to our server
291
+ // to exchange it for an access token and store it securely
292
+ console.log(`Simulating token exchange for ${currentPlatform}`);
293
+
294
+ // For demo purposes, we'll just simulate a successful token exchange
295
+ if (debug || test) {
296
+ console.log('Debug mode: Simulating successful token exchange');
297
+ }
298
+ }
299
+
300
+ // Close OAuth window and return to connect step
301
+ setOauthUrl('');
302
+ setStep('connect');
303
+ }, [currentPlatform, userEmail, debug, test]);
136
304
  const handlePinSubmit = useCallback(async userPin => {
137
305
  setPin(userPin);
138
306
  setStep('training');
139
- // Simulate training progress
307
+ // Simulate training progress over 10 seconds
140
308
  let progress = 0;
141
309
  const interval = setInterval(() => {
142
- progress += 0.1;
310
+ progress += 1; // 10% progress every second for 1 seconds total
143
311
  setTraining({
144
312
  progress,
145
- eta: `${Math.round((1 - progress) * 100)} seconds remaining`
313
+ eta: `${Math.round((1 - progress) * 10)} seconds remaining`
146
314
  });
147
315
  if (progress >= 1) {
148
316
  clearInterval(interval);
149
- onComplete('https://api2.onairos.uk', 'dummy-token', {
150
- pin: userPin,
151
- connections,
152
- platformToggles,
153
- selectedTier,
154
- tierData: requestData === null || requestData === void 0 ? void 0 : requestData[selectedTier]
155
- });
317
+ // Training complete - TrainingModal will handle email input and final completion
156
318
  }
157
- }, 1000);
319
+ }, 1000); // 1 second intervals for 10 total seconds
158
320
  }, [connections, onComplete, selectedTier, requestData, platformToggles]);
159
321
  const canProceedToPin = useCallback(() => {
160
322
  // Check if at least one platform is toggled on
@@ -216,26 +378,39 @@ export const UniversalOnboarding = ({
216
378
  style: styles.privacyMessage
217
379
  }, "None of your app data is shared with ANYONE")), /*#__PURE__*/React.createElement(View, {
218
380
  style: styles.platformsContainer
219
- }, platforms.map(platform => /*#__PURE__*/React.createElement(View, {
220
- key: platform.id,
221
- style: styles.platformItem
222
- }, /*#__PURE__*/React.createElement(View, {
223
- style: styles.platformInfo
224
- }, /*#__PURE__*/React.createElement(Image, {
225
- source: platform.icon,
226
- style: styles.platformIcon,
227
- resizeMode: "contain"
228
- }), /*#__PURE__*/React.createElement(Text, {
229
- style: styles.platformName
230
- }, platform.name)), /*#__PURE__*/React.createElement(Switch, {
231
- value: platformToggles[platform.id],
232
- onValueChange: () => togglePlatform(platform.id),
233
- trackColor: {
234
- false: '#767577',
235
- true: '#81b0ff'
236
- },
237
- thumbColor: platformToggles[platform.id] ? '#2196F3' : '#f4f3f4'
238
- }))))), /*#__PURE__*/React.createElement(View, {
381
+ }, platforms.map(platform => {
382
+ var _connections$platform, _connections$platform2, _connections$platform3, _connections$platform4;
383
+ return /*#__PURE__*/React.createElement(View, {
384
+ key: platform.id,
385
+ style: [styles.platformItem, ((_connections$platform = connections[platform.id]) === null || _connections$platform === void 0 ? void 0 : _connections$platform.connected) && styles.platformItemConnected]
386
+ }, /*#__PURE__*/React.createElement(View, {
387
+ style: styles.platformInfo
388
+ }, /*#__PURE__*/React.createElement(Image, {
389
+ source: platform.icon,
390
+ style: styles.platformIcon,
391
+ resizeMode: "contain"
392
+ }), /*#__PURE__*/React.createElement(View, {
393
+ style: styles.platformTextContainer
394
+ }, /*#__PURE__*/React.createElement(Text, {
395
+ style: styles.platformName
396
+ }, platform.name), ((_connections$platform2 = connections[platform.id]) === null || _connections$platform2 === void 0 ? void 0 : _connections$platform2.connected) && /*#__PURE__*/React.createElement(Text, {
397
+ style: styles.connectedText
398
+ }, "Connected"))), /*#__PURE__*/React.createElement(View, {
399
+ style: styles.platformActions
400
+ }, connectingPlatform === platform.id ? /*#__PURE__*/React.createElement(ActivityIndicator, {
401
+ size: "small",
402
+ color: COLORS.primary
403
+ }) : /*#__PURE__*/React.createElement(Switch, {
404
+ value: platformToggles[platform.id] || ((_connections$platform3 = connections[platform.id]) === null || _connections$platform3 === void 0 ? void 0 : _connections$platform3.connected) || false,
405
+ onValueChange: () => togglePlatform(platform.id),
406
+ trackColor: {
407
+ false: '#767577',
408
+ true: '#81b0ff'
409
+ },
410
+ thumbColor: platformToggles[platform.id] || (_connections$platform4 = connections[platform.id]) !== null && _connections$platform4 !== void 0 && _connections$platform4.connected ? '#2196F3' : '#f4f3f4',
411
+ disabled: connectingPlatform !== null
412
+ })));
413
+ }))), /*#__PURE__*/React.createElement(View, {
239
414
  style: styles.footer
240
415
  }, /*#__PURE__*/React.createElement(TouchableOpacity, {
241
416
  style: styles.footerButtonCancel,
@@ -265,11 +440,21 @@ export const UniversalOnboarding = ({
265
440
  connections,
266
441
  platformToggles,
267
442
  selectedTier,
268
- tierData: requestData === null || requestData === void 0 ? void 0 : requestData[selectedTier]
443
+ tierData: requestData === null || requestData === void 0 ? void 0 : requestData[selectedTier],
444
+ userEmail
269
445
  });
270
446
  },
271
447
  modelKey: "onairosTrainingModel",
272
- username: "demo_user"
448
+ username: userEmail
449
+ }), step === 'oauth' && oauthUrl && /*#__PURE__*/React.createElement(OAuthWebView, {
450
+ url: oauthUrl,
451
+ platform: currentPlatform,
452
+ onClose: () => {
453
+ setStep('connect');
454
+ setOauthUrl('');
455
+ },
456
+ onSuccess: handleOAuthSuccess,
457
+ onComplete: () => setStep('connect')
273
458
  })))))));
274
459
  };
275
460
  const styles = StyleSheet.create({
@@ -388,6 +573,24 @@ const styles = StyleSheet.create({
388
573
  fontWeight: '500',
389
574
  color: '#000'
390
575
  },
576
+ platformTextContainer: {
577
+ flex: 1
578
+ },
579
+ connectedText: {
580
+ fontSize: 12,
581
+ color: '#4CAF50',
582
+ fontWeight: '500',
583
+ marginTop: 2
584
+ },
585
+ platformActions: {
586
+ alignItems: 'center',
587
+ justifyContent: 'center'
588
+ },
589
+ platformItemConnected: {
590
+ backgroundColor: '#F8F9FA',
591
+ borderColor: '#4CAF50',
592
+ borderWidth: 1
593
+ },
391
594
  footer: {
392
595
  flexDirection: 'row',
393
596
  alignItems: 'center',