@onairos/react-native 3.1.15 → 3.1.17
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 +404 -0
- package/lib/commonjs/assets/images/Checkbox.svg +3 -3
- package/lib/commonjs/assets/images/EnochE.svg +19 -19
- package/lib/commonjs/assets/images/Personalityprofile.svg +3 -3
- package/lib/commonjs/assets/images/Personalitytraits.svg +3 -3
- package/lib/commonjs/assets/images/Userpreferences.svg +3 -3
- package/lib/commonjs/assets/images/arrow.svg +20 -20
- package/lib/commonjs/assets/images/basicproficon.svg +43 -43
- package/lib/commonjs/assets/images/basicprofile.svg +3 -3
- package/lib/commonjs/assets/images/checkmark.svg +4 -4
- package/lib/commonjs/assets/images/contentanalysis.svg +3 -3
- package/lib/commonjs/assets/images/contenticon.svg +23 -23
- package/lib/commonjs/assets/images/personalityicon.svg +18 -18
- package/lib/commonjs/assets/images/x-close.svg +3 -3
- package/lib/commonjs/components/OnairosSignInButton.js +32 -74
- package/lib/commonjs/components/OnairosSignInButton.js.map +1 -1
- package/lib/commonjs/components/UniversalOnboarding.js +4 -4
- package/lib/commonjs/config/api.js +2 -2
- package/lib/commonjs/hooks/useConnections.js +6 -6
- package/lib/commonjs/hooks/useUserConnections.js +10 -10
- package/lib/commonjs/index.js +5 -12
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/services/apiClient.js +35 -35
- package/lib/commonjs/services/apiKeyService.js +99 -99
- package/lib/commonjs/services/authService.js +82 -82
- package/lib/commonjs/services/biometricPinService.js +10 -10
- package/lib/commonjs/services/connectedAccountsService.js +32 -32
- package/lib/commonjs/services/googleAuthService.js +15 -15
- package/lib/commonjs/services/imageCompressionService.js +15 -15
- package/lib/commonjs/services/jwtStorageService.js +59 -59
- package/lib/commonjs/services/mobileTrainingService.js +14 -14
- package/lib/commonjs/services/pinEncryptionService.js +10 -10
- package/lib/commonjs/services/pinStorageUtils.js +15 -15
- package/lib/commonjs/services/platformAuthService.js +47 -47
- package/lib/commonjs/services/storageService.js +31 -31
- package/lib/commonjs/services/trainingApiHelpers.js +33 -33
- package/lib/commonjs/services/userConnectionsService.js +24 -24
- package/lib/commonjs/utils/Portal.js +4 -4
- package/lib/commonjs/utils/api.js +24 -24
- package/lib/commonjs/utils/auth.js +18 -18
- package/lib/commonjs/utils/crypto.js +13 -13
- package/lib/commonjs/utils/encryption.js +12 -12
- package/lib/commonjs/utils/eventUtils.js +52 -52
- package/lib/commonjs/utils/programmaticFlow.js +16 -16
- package/lib/commonjs/utils/retryHelper.js +27 -27
- package/lib/module/assets/images/Checkbox.svg +3 -3
- package/lib/module/assets/images/EnochE.svg +19 -19
- package/lib/module/assets/images/Personalityprofile.svg +3 -3
- package/lib/module/assets/images/Personalitytraits.svg +3 -3
- package/lib/module/assets/images/Userpreferences.svg +3 -3
- package/lib/module/assets/images/arrow.svg +20 -20
- package/lib/module/assets/images/basicproficon.svg +43 -43
- package/lib/module/assets/images/basicprofile.svg +3 -3
- package/lib/module/assets/images/checkmark.svg +4 -4
- package/lib/module/assets/images/contentanalysis.svg +3 -3
- package/lib/module/assets/images/contenticon.svg +23 -23
- package/lib/module/assets/images/personalityicon.svg +18 -18
- package/lib/module/assets/images/x-close.svg +3 -3
- package/lib/module/components/OnairosSignInButton.js +32 -74
- package/lib/module/components/OnairosSignInButton.js.map +1 -1
- package/lib/module/components/UniversalOnboarding.js +4 -4
- package/lib/module/config/api.js +2 -2
- package/lib/module/hooks/useConnections.js +6 -6
- package/lib/module/hooks/useUserConnections.js +10 -10
- package/lib/module/index.js +5 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/services/apiClient.js +35 -35
- package/lib/module/services/apiKeyService.js +99 -99
- package/lib/module/services/authService.js +82 -82
- package/lib/module/services/biometricPinService.js +10 -10
- package/lib/module/services/connectedAccountsService.js +32 -32
- package/lib/module/services/googleAuthService.js +15 -15
- package/lib/module/services/imageCompressionService.js +15 -15
- package/lib/module/services/jwtStorageService.js +59 -59
- package/lib/module/services/mobileTrainingService.js +14 -14
- package/lib/module/services/pinEncryptionService.js +10 -10
- package/lib/module/services/pinStorageUtils.js +15 -15
- package/lib/module/services/platformAuthService.js +47 -47
- package/lib/module/services/storageService.js +31 -31
- package/lib/module/services/trainingApiHelpers.js +33 -33
- package/lib/module/services/userConnectionsService.js +24 -24
- package/lib/module/utils/Portal.js +4 -4
- package/lib/module/utils/api.js +24 -24
- package/lib/module/utils/auth.js +18 -18
- package/lib/module/utils/crypto.js +13 -13
- package/lib/module/utils/encryption.js +12 -12
- package/lib/module/utils/eventUtils.js +52 -52
- package/lib/module/utils/programmaticFlow.js +16 -16
- package/lib/module/utils/retryHelper.js +27 -27
- package/lib/typescript/components/OnairosSignInButton.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +0 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +163 -163
- package/src/api/index.ts +151 -151
- package/src/assets/images/Checkbox.svg +3 -3
- package/src/assets/images/EnochE.svg +19 -19
- package/src/assets/images/Personalityprofile.svg +3 -3
- package/src/assets/images/Personalitytraits.svg +3 -3
- package/src/assets/images/Userpreferences.svg +3 -3
- package/src/assets/images/arrow.svg +20 -20
- package/src/assets/images/basicproficon.svg +43 -43
- package/src/assets/images/basicprofile.svg +3 -3
- package/src/assets/images/checkmark.svg +4 -4
- package/src/assets/images/contentanalysis.svg +3 -3
- package/src/assets/images/contenticon.svg +23 -23
- package/src/assets/images/personalityicon.svg +18 -18
- package/src/assets/images/x-close.svg +3 -3
- package/src/components/BodyText.tsx +33 -33
- package/src/components/BrandMark.tsx +62 -62
- package/src/components/CodeInput.tsx +32 -32
- package/src/components/DataRequestScreen.tsx +355 -355
- package/src/components/EmailInput.tsx +31 -31
- package/src/components/EmailVerificationModal.tsx +363 -363
- package/src/components/ExistingUserDataConfirmation.tsx +506 -506
- package/src/components/GoogleButton.tsx +55 -55
- package/src/components/HeadingGroup.tsx +49 -49
- package/src/components/ModalHeader.tsx +125 -125
- package/src/components/ModalSheet.tsx +57 -57
- package/src/components/Onairos.tsx +422 -422
- package/src/components/OnairosButton.tsx +339 -339
- package/src/components/OnairosSignInButton.tsx +130 -166
- package/src/components/Overlay.tsx +506 -506
- package/src/components/PersonaImage.tsx +79 -79
- package/src/components/PersonaLoadingScreen.tsx +201 -201
- package/src/components/PersonalizationConsentScreen.tsx +410 -410
- package/src/components/PinCreationScreen.tsx +492 -492
- package/src/components/PinInput.tsx +555 -555
- package/src/components/PlatformConnectorsStep.tsx +891 -891
- package/src/components/PlatformList.tsx +144 -144
- package/src/components/PlatformToggle.tsx +226 -226
- package/src/components/PrimaryButton.tsx +213 -213
- package/src/components/SignInMatchAnimation.tsx +225 -225
- package/src/components/SignInStep.tsx +217 -217
- package/src/components/TrainingModal.tsx +1047 -1047
- package/src/components/UniversalOnboarding.tsx +2887 -2887
- package/src/components/VerificationStep.tsx +198 -198
- package/src/components/WelcomeScreen.tsx +473 -473
- package/src/components/icons/Basicproficon.tsx +30 -30
- package/src/components/icons/Basicprofile.tsx +17 -17
- package/src/components/icons/Checkbox.tsx +17 -17
- package/src/components/icons/Checkmark.tsx +24 -24
- package/src/components/icons/Contentanalysis.tsx +17 -17
- package/src/components/icons/Contenticon.tsx +30 -30
- package/src/components/icons/EnochE.tsx +39 -39
- package/src/components/icons/Personalityicon.tsx +22 -22
- package/src/components/icons/Personalityprofile.tsx +17 -17
- package/src/components/icons/Personalitytraits.tsx +17 -17
- package/src/components/icons/Userpreferences.tsx +17 -17
- package/src/components/icons/index.ts +12 -12
- package/src/components/onboarding/OAuthWebView.tsx +232 -232
- package/src/config/api.ts +25 -25
- package/src/context/AuthContext.tsx +393 -393
- package/src/hooks/useConnectedAccounts.ts +138 -138
- package/src/hooks/useConnections.ts +161 -161
- package/src/hooks/useCredentials.ts +174 -174
- package/src/hooks/useUserConnections.ts +165 -165
- package/src/index.js +14 -14
- package/src/index.ts +94 -95
- package/src/services/apiClient.ts +336 -336
- package/src/services/apiKeyService.ts +919 -919
- package/src/services/authService.ts +1008 -1008
- package/src/services/biometricPinService.ts +192 -192
- package/src/services/connectedAccountsService.ts +289 -289
- package/src/services/googleAuthService.ts +279 -279
- package/src/services/imageCompressionService.ts +302 -302
- package/src/services/jwtStorageService.ts +256 -256
- package/src/services/mobileTrainingService.ts +203 -203
- package/src/services/pinEncryptionService.ts +75 -75
- package/src/services/pinStorageUtils.ts +96 -96
- package/src/services/platformAuthService.ts +1346 -1346
- package/src/services/storageService.ts +451 -451
- package/src/services/trainingApiHelpers.ts +66 -66
- package/src/services/userConnectionsService.ts +556 -556
- package/src/services/youtubeMigrationService.ts +453 -453
- package/src/theme/index.ts +239 -239
- package/src/types/ambient.d.ts +28 -28
- package/src/types/index.ts +265 -265
- package/src/types/node-fix.d.ts +18 -18
- package/src/types/node-override.d.ts +23 -23
- package/src/types/opacity.d.ts +15 -15
- package/src/types/types.d.ts +17 -17
- package/src/utils/Portal.tsx +82 -82
- package/src/utils/api.js +111 -111
- package/src/utils/auth.js +103 -103
- package/src/utils/crypto.js +59 -59
- package/src/utils/encryption.ts +68 -68
- package/src/utils/eventUtils.ts +302 -302
- package/src/utils/haptics.ts +58 -58
- package/src/utils/imagePreloader.ts +2 -2
- package/src/utils/programmaticFlow.ts +112 -112
- package/src/utils/retryHelper.ts +274 -274
|
@@ -1,473 +1,473 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
StyleSheet,
|
|
5
|
-
Modal,
|
|
6
|
-
TouchableWithoutFeedback,
|
|
7
|
-
Animated,
|
|
8
|
-
Easing,
|
|
9
|
-
StatusBar,
|
|
10
|
-
} from 'react-native';
|
|
11
|
-
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
12
|
-
import { triggerHaptic, HapticType } from '../utils/haptics';
|
|
13
|
-
import { sendEmailVerificationCode, confirmEmailVerificationCode } from '../api';
|
|
14
|
-
import { signInWithGoogle } from '../services/googleAuthService';
|
|
15
|
-
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
16
|
-
|
|
17
|
-
// Import our new components
|
|
18
|
-
import ModalSheet from './ModalSheet';
|
|
19
|
-
import ModalHeader from './ModalHeader';
|
|
20
|
-
import BrandMark from './BrandMark';
|
|
21
|
-
import HeadingGroup from './HeadingGroup';
|
|
22
|
-
import BodyText from './BodyText';
|
|
23
|
-
import PrimaryButton from './PrimaryButton';
|
|
24
|
-
import SignInStep from './SignInStep';
|
|
25
|
-
import VerificationStep from './VerificationStep';
|
|
26
|
-
import PlatformConnectorsStep from './PlatformConnectorsStep';
|
|
27
|
-
|
|
28
|
-
// Type definitions for navigation
|
|
29
|
-
export interface WelcomeScreenProps {
|
|
30
|
-
visible: boolean;
|
|
31
|
-
onClose: () => void;
|
|
32
|
-
onComplete?: (token: string, email?: string) => void;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
type ModalStep = 'welcome' | 'signin' | 'verification' | 'platforms';
|
|
36
|
-
|
|
37
|
-
const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
|
|
38
|
-
visible,
|
|
39
|
-
onClose,
|
|
40
|
-
onComplete,
|
|
41
|
-
}) => {
|
|
42
|
-
const [currentStep, setCurrentStep] = useState<ModalStep>('welcome');
|
|
43
|
-
const [userEmail, setUserEmail] = useState<string>('');
|
|
44
|
-
const [loading, setLoading] = useState<boolean>(false);
|
|
45
|
-
const [error, setError] = useState<string>('');
|
|
46
|
-
|
|
47
|
-
// Animation values
|
|
48
|
-
const slideAnim = useRef(new Animated.Value(1)).current; // Start from bottom
|
|
49
|
-
const fadeAnim = useRef(new Animated.Value(0)).current;
|
|
50
|
-
|
|
51
|
-
// Animate in when visible (matching existing modal style)
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
if (visible) {
|
|
54
|
-
Animated.parallel([
|
|
55
|
-
Animated.timing(slideAnim, {
|
|
56
|
-
toValue: 0,
|
|
57
|
-
duration: 400,
|
|
58
|
-
easing: Easing.out(Easing.cubic),
|
|
59
|
-
useNativeDriver: true,
|
|
60
|
-
}),
|
|
61
|
-
Animated.timing(fadeAnim, {
|
|
62
|
-
toValue: 1,
|
|
63
|
-
duration: 300,
|
|
64
|
-
useNativeDriver: true,
|
|
65
|
-
}),
|
|
66
|
-
]).start();
|
|
67
|
-
} else {
|
|
68
|
-
slideAnim.setValue(1);
|
|
69
|
-
fadeAnim.setValue(0);
|
|
70
|
-
}
|
|
71
|
-
}, [visible]);
|
|
72
|
-
|
|
73
|
-
const handleClose = () => {
|
|
74
|
-
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
75
|
-
|
|
76
|
-
// Reset to welcome step
|
|
77
|
-
setCurrentStep('welcome');
|
|
78
|
-
|
|
79
|
-
Animated.parallel([
|
|
80
|
-
Animated.timing(slideAnim, {
|
|
81
|
-
toValue: 1,
|
|
82
|
-
duration: 300,
|
|
83
|
-
easing: Easing.in(Easing.cubic),
|
|
84
|
-
useNativeDriver: true,
|
|
85
|
-
}),
|
|
86
|
-
Animated.timing(fadeAnim, {
|
|
87
|
-
toValue: 0,
|
|
88
|
-
duration: 250,
|
|
89
|
-
useNativeDriver: true,
|
|
90
|
-
}),
|
|
91
|
-
]).start(() => {
|
|
92
|
-
onClose();
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
const handleGetStarted = () => {
|
|
97
|
-
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
98
|
-
// Move to sign-in step instead of closing modal
|
|
99
|
-
setCurrentStep('signin');
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const handleEmailSubmit = async (email: string) => {
|
|
103
|
-
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
104
|
-
setLoading(true);
|
|
105
|
-
setError('');
|
|
106
|
-
|
|
107
|
-
try {
|
|
108
|
-
// Check for reviewer bypass
|
|
109
|
-
if (email === 'reviewer@bypass.com') {
|
|
110
|
-
console.log('🔍 Reviewer bypass detected in WelcomeScreen');
|
|
111
|
-
|
|
112
|
-
try {
|
|
113
|
-
// Store the same markers as the old UI
|
|
114
|
-
await AsyncStorage.setItem('onairos_user', 'true');
|
|
115
|
-
await AsyncStorage.setItem('onairos_jwt_token', 'reviewer-bypass-token');
|
|
116
|
-
console.log('✅ Stored reviewer bypass markers for email bypass');
|
|
117
|
-
|
|
118
|
-
// Store the reviewer email and skip directly to platforms
|
|
119
|
-
setUserEmail(email);
|
|
120
|
-
setCurrentStep('platforms');
|
|
121
|
-
} catch (error) {
|
|
122
|
-
console.error('❌ Failed to store reviewer bypass markers:', error);
|
|
123
|
-
// Continue to platforms even if storage fails
|
|
124
|
-
setUserEmail(email);
|
|
125
|
-
setCurrentStep('platforms');
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
setLoading(false);
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
console.log('📧 Sending verification code to:', email);
|
|
133
|
-
|
|
134
|
-
// Send verification code using the existing API
|
|
135
|
-
const result = await sendEmailVerificationCode(email);
|
|
136
|
-
|
|
137
|
-
if (result.success) {
|
|
138
|
-
console.log('✅ Verification code sent successfully');
|
|
139
|
-
// Store the email and move to verification
|
|
140
|
-
setUserEmail(email);
|
|
141
|
-
setCurrentStep('verification');
|
|
142
|
-
} else {
|
|
143
|
-
console.log('❌ Failed to send verification code:', result.message);
|
|
144
|
-
setError(result.message || 'Failed to send verification code. Please try again.');
|
|
145
|
-
}
|
|
146
|
-
} catch (error) {
|
|
147
|
-
console.error('❌ Error sending verification code:', error);
|
|
148
|
-
setError('Network error. Please check your connection and try again.');
|
|
149
|
-
} finally {
|
|
150
|
-
setLoading(false);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const handleGoogleSignIn = async () => {
|
|
155
|
-
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
156
|
-
setLoading(true);
|
|
157
|
-
setError('');
|
|
158
|
-
|
|
159
|
-
try {
|
|
160
|
-
console.log('🔗 Initiating Google Sign-In');
|
|
161
|
-
|
|
162
|
-
const result = await signInWithGoogle();
|
|
163
|
-
|
|
164
|
-
if (result.success && result.user) {
|
|
165
|
-
console.log('✅ Google Sign-In successful:', result.user.email);
|
|
166
|
-
|
|
167
|
-
// Store user information
|
|
168
|
-
setUserEmail(result.user.email);
|
|
169
|
-
|
|
170
|
-
// Skip to platform connectors (user is already authenticated)
|
|
171
|
-
setCurrentStep('platforms');
|
|
172
|
-
} else if (result.cancelled) {
|
|
173
|
-
console.log('ℹ️ Google Sign-In cancelled by user');
|
|
174
|
-
// Don't show error for cancellation, just reset loading
|
|
175
|
-
} else {
|
|
176
|
-
console.log('❌ Google Sign-In failed:', result.message);
|
|
177
|
-
setError(result.message || 'Google Sign-In failed. Please try again.');
|
|
178
|
-
}
|
|
179
|
-
} catch (error) {
|
|
180
|
-
console.error('❌ Unexpected Google Sign-In error:', error);
|
|
181
|
-
setError('Google Sign-In failed. Please try again.');
|
|
182
|
-
} finally {
|
|
183
|
-
setLoading(false);
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
const handleContinue = () => {
|
|
188
|
-
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
189
|
-
// Move to verification step
|
|
190
|
-
setCurrentStep('verification');
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
const handleCodeSubmit = async (code: string) => {
|
|
194
|
-
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
195
|
-
setLoading(true);
|
|
196
|
-
setError('');
|
|
197
|
-
|
|
198
|
-
try {
|
|
199
|
-
console.log('🔍 Verifying email code:', userEmail, code);
|
|
200
|
-
|
|
201
|
-
// Verify the email code using the existing API
|
|
202
|
-
const result = await confirmEmailVerificationCode(userEmail, code);
|
|
203
|
-
|
|
204
|
-
if (result.success) {
|
|
205
|
-
console.log('✅ Email verification successful');
|
|
206
|
-
// Move to platform connectors step
|
|
207
|
-
setCurrentStep('platforms');
|
|
208
|
-
} else {
|
|
209
|
-
console.log('❌ Email verification failed:', result.message);
|
|
210
|
-
setError(result.message || 'Invalid verification code. Please try again.');
|
|
211
|
-
}
|
|
212
|
-
} catch (error) {
|
|
213
|
-
console.error('❌ Error verifying email code:', error);
|
|
214
|
-
setError('Verification failed. Please try again.');
|
|
215
|
-
} finally {
|
|
216
|
-
setLoading(false);
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
const handleBackToSignIn = () => {
|
|
221
|
-
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
222
|
-
setError(''); // Clear any errors when going back
|
|
223
|
-
setCurrentStep('signin');
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
const handleBackToVerification = () => {
|
|
227
|
-
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
228
|
-
setCurrentStep('verification');
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
const handleResendCode = async () => {
|
|
232
|
-
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
233
|
-
setLoading(true);
|
|
234
|
-
setError('');
|
|
235
|
-
|
|
236
|
-
try {
|
|
237
|
-
console.log('🔄 Resending verification code to:', userEmail);
|
|
238
|
-
|
|
239
|
-
// Resend verification code using the existing API
|
|
240
|
-
const result = await sendEmailVerificationCode(userEmail);
|
|
241
|
-
|
|
242
|
-
if (result.success) {
|
|
243
|
-
console.log('✅ Verification code resent successfully');
|
|
244
|
-
// Could show a success message here if needed
|
|
245
|
-
} else {
|
|
246
|
-
console.log('❌ Failed to resend verification code:', result.message);
|
|
247
|
-
setError(result.message || 'Failed to resend verification code. Please try again.');
|
|
248
|
-
}
|
|
249
|
-
} catch (error) {
|
|
250
|
-
console.error('❌ Error resending verification code:', error);
|
|
251
|
-
setError('Network error. Please check your connection and try again.');
|
|
252
|
-
} finally {
|
|
253
|
-
setLoading(false);
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
const handlePlatformUpdate = (connectedPlatforms: string[]) => {
|
|
258
|
-
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
259
|
-
console.log('Connected platforms:', connectedPlatforms);
|
|
260
|
-
|
|
261
|
-
// Complete the onboarding flow
|
|
262
|
-
if (onComplete) {
|
|
263
|
-
// Return the stored token and email
|
|
264
|
-
AsyncStorage.getItem('onairos_jwt_token').then(token => {
|
|
265
|
-
onComplete(token || 'onboarding-complete-token', userEmail);
|
|
266
|
-
});
|
|
267
|
-
} else {
|
|
268
|
-
onClose();
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
const handlePlatformSkip = () => {
|
|
273
|
-
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
274
|
-
// Skip platform connections and complete onboarding
|
|
275
|
-
if (onComplete) {
|
|
276
|
-
// Return a skip token
|
|
277
|
-
onComplete('onboarding-skipped-token', userEmail);
|
|
278
|
-
} else {
|
|
279
|
-
onClose();
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
const handleReviewerBypass = async () => {
|
|
284
|
-
console.log('🔍 Reviewer bypass triggered from platforms screen');
|
|
285
|
-
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
286
|
-
|
|
287
|
-
try {
|
|
288
|
-
// Store the same markers as the old UI
|
|
289
|
-
await AsyncStorage.setItem('onairos_user', 'true');
|
|
290
|
-
await AsyncStorage.setItem('onairos_jwt_token', 'reviewer-bypass-token');
|
|
291
|
-
console.log('✅ Stored reviewer bypass markers for new UI');
|
|
292
|
-
|
|
293
|
-
// Complete the onboarding with bypass token
|
|
294
|
-
if (onComplete) {
|
|
295
|
-
onComplete('reviewer-bypass-token', 'reviewer@apple.com');
|
|
296
|
-
} else {
|
|
297
|
-
onClose();
|
|
298
|
-
}
|
|
299
|
-
} catch (error) {
|
|
300
|
-
console.error('❌ Failed to store reviewer bypass markers:', error);
|
|
301
|
-
// Still complete the onboarding even if storage fails
|
|
302
|
-
if (onComplete) {
|
|
303
|
-
onComplete('reviewer-bypass-token', 'reviewer@apple.com');
|
|
304
|
-
} else {
|
|
305
|
-
onClose();
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
const handleBackdropPress = () => {
|
|
311
|
-
// Optional: allow closing by tapping backdrop
|
|
312
|
-
handleClose();
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
if (!visible) {
|
|
316
|
-
return null;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
return (
|
|
320
|
-
<Modal
|
|
321
|
-
visible={visible}
|
|
322
|
-
transparent
|
|
323
|
-
animationType="slide" // Use built-in slide animation like existing modal
|
|
324
|
-
onRequestClose={handleClose}
|
|
325
|
-
statusBarTranslucent
|
|
326
|
-
>
|
|
327
|
-
<StatusBar backgroundColor="rgba(0,0,0,0.5)" barStyle="light-content" />
|
|
328
|
-
|
|
329
|
-
{/* Backdrop */}
|
|
330
|
-
<Animated.View style={[styles.backdrop, { opacity: fadeAnim }]}>
|
|
331
|
-
<TouchableWithoutFeedback onPress={handleBackdropPress}>
|
|
332
|
-
<View style={styles.backdropTouchable} />
|
|
333
|
-
</TouchableWithoutFeedback>
|
|
334
|
-
</Animated.View>
|
|
335
|
-
|
|
336
|
-
{/* Modal Content */}
|
|
337
|
-
<Animated.View
|
|
338
|
-
style={[
|
|
339
|
-
styles.modalContainer,
|
|
340
|
-
{
|
|
341
|
-
transform: [{
|
|
342
|
-
translateY: slideAnim.interpolate({
|
|
343
|
-
inputRange: [0, 1],
|
|
344
|
-
outputRange: [0, 600], // Slide from bottom
|
|
345
|
-
})
|
|
346
|
-
}]
|
|
347
|
-
}
|
|
348
|
-
]}
|
|
349
|
-
>
|
|
350
|
-
<SafeAreaProvider>
|
|
351
|
-
<ModalSheet topPadding={0}>
|
|
352
|
-
<ModalHeader
|
|
353
|
-
onClose={handleClose}
|
|
354
|
-
onBack={currentStep === 'verification' ? handleBackToSignIn : handleBackToVerification}
|
|
355
|
-
showBackButton={currentStep === 'verification' || currentStep === 'platforms'}
|
|
356
|
-
/>
|
|
357
|
-
|
|
358
|
-
{currentStep === 'welcome' && (
|
|
359
|
-
<View style={styles.content}>
|
|
360
|
-
{/* Brand Mark */}
|
|
361
|
-
<View style={styles.brandMarkContainer}>
|
|
362
|
-
<BrandMark />
|
|
363
|
-
</View>
|
|
364
|
-
|
|
365
|
-
{/* Heading Group */}
|
|
366
|
-
<View style={styles.headingContainer}>
|
|
367
|
-
<HeadingGroup />
|
|
368
|
-
</View>
|
|
369
|
-
|
|
370
|
-
{/* Body Text */}
|
|
371
|
-
<View style={styles.bodyContainer}>
|
|
372
|
-
<BodyText />
|
|
373
|
-
</View>
|
|
374
|
-
|
|
375
|
-
{/* Flexible Spacer */}
|
|
376
|
-
<View style={styles.spacer} />
|
|
377
|
-
|
|
378
|
-
{/* Primary Button */}
|
|
379
|
-
<View style={styles.buttonContainer}>
|
|
380
|
-
<PrimaryButton
|
|
381
|
-
label="Get Started"
|
|
382
|
-
onPress={handleGetStarted}
|
|
383
|
-
testID="welcome-get-started-button"
|
|
384
|
-
/>
|
|
385
|
-
</View>
|
|
386
|
-
</View>
|
|
387
|
-
)}
|
|
388
|
-
|
|
389
|
-
{currentStep === 'signin' && (
|
|
390
|
-
<SignInStep
|
|
391
|
-
onEmailSubmit={handleEmailSubmit}
|
|
392
|
-
onGoogleSignIn={handleGoogleSignIn}
|
|
393
|
-
onContinue={handleContinue}
|
|
394
|
-
loading={loading}
|
|
395
|
-
error={error}
|
|
396
|
-
/>
|
|
397
|
-
)}
|
|
398
|
-
|
|
399
|
-
{currentStep === 'verification' && (
|
|
400
|
-
<VerificationStep
|
|
401
|
-
email={userEmail}
|
|
402
|
-
onCodeSubmit={handleCodeSubmit}
|
|
403
|
-
onBack={handleBackToSignIn}
|
|
404
|
-
loading={loading}
|
|
405
|
-
error={error}
|
|
406
|
-
onResendCode={handleResendCode}
|
|
407
|
-
/>
|
|
408
|
-
)}
|
|
409
|
-
|
|
410
|
-
{currentStep === 'platforms' && (
|
|
411
|
-
<PlatformConnectorsStep
|
|
412
|
-
onUpdate={handlePlatformUpdate}
|
|
413
|
-
onSkip={handlePlatformSkip}
|
|
414
|
-
onReviewerBypass={handleReviewerBypass}
|
|
415
|
-
/>
|
|
416
|
-
)}
|
|
417
|
-
</ModalSheet>
|
|
418
|
-
</SafeAreaProvider>
|
|
419
|
-
</Animated.View>
|
|
420
|
-
</Modal>
|
|
421
|
-
);
|
|
422
|
-
};
|
|
423
|
-
|
|
424
|
-
const styles = StyleSheet.create({
|
|
425
|
-
backdrop: {
|
|
426
|
-
...StyleSheet.absoluteFillObject,
|
|
427
|
-
backgroundColor: 'transparent', // Remove grey overlay
|
|
428
|
-
},
|
|
429
|
-
|
|
430
|
-
backdropTouchable: {
|
|
431
|
-
flex: 1,
|
|
432
|
-
},
|
|
433
|
-
|
|
434
|
-
modalContainer: {
|
|
435
|
-
position: 'absolute',
|
|
436
|
-
bottom: 0,
|
|
437
|
-
left: 0,
|
|
438
|
-
right: 0,
|
|
439
|
-
height: '85%', // Take most of the screen
|
|
440
|
-
},
|
|
441
|
-
|
|
442
|
-
content: {
|
|
443
|
-
flex: 1,
|
|
444
|
-
alignItems: 'center',
|
|
445
|
-
paddingTop: 20,
|
|
446
|
-
},
|
|
447
|
-
|
|
448
|
-
brandMarkContainer: {
|
|
449
|
-
marginBottom: 32,
|
|
450
|
-
},
|
|
451
|
-
|
|
452
|
-
headingContainer: {
|
|
453
|
-
marginBottom: 24,
|
|
454
|
-
},
|
|
455
|
-
|
|
456
|
-
bodyContainer: {
|
|
457
|
-
marginBottom: 32,
|
|
458
|
-
width: '100%',
|
|
459
|
-
},
|
|
460
|
-
|
|
461
|
-
spacer: {
|
|
462
|
-
flex: 1,
|
|
463
|
-
minHeight: 20, // Ensure some minimum space
|
|
464
|
-
},
|
|
465
|
-
|
|
466
|
-
buttonContainer: {
|
|
467
|
-
width: '100%',
|
|
468
|
-
paddingHorizontal: 24,
|
|
469
|
-
paddingBottom: 20,
|
|
470
|
-
},
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
export default WelcomeScreen;
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
Modal,
|
|
6
|
+
TouchableWithoutFeedback,
|
|
7
|
+
Animated,
|
|
8
|
+
Easing,
|
|
9
|
+
StatusBar,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
12
|
+
import { triggerHaptic, HapticType } from '../utils/haptics';
|
|
13
|
+
import { sendEmailVerificationCode, confirmEmailVerificationCode } from '../api';
|
|
14
|
+
import { signInWithGoogle } from '../services/googleAuthService';
|
|
15
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
16
|
+
|
|
17
|
+
// Import our new components
|
|
18
|
+
import ModalSheet from './ModalSheet';
|
|
19
|
+
import ModalHeader from './ModalHeader';
|
|
20
|
+
import BrandMark from './BrandMark';
|
|
21
|
+
import HeadingGroup from './HeadingGroup';
|
|
22
|
+
import BodyText from './BodyText';
|
|
23
|
+
import PrimaryButton from './PrimaryButton';
|
|
24
|
+
import SignInStep from './SignInStep';
|
|
25
|
+
import VerificationStep from './VerificationStep';
|
|
26
|
+
import PlatformConnectorsStep from './PlatformConnectorsStep';
|
|
27
|
+
|
|
28
|
+
// Type definitions for navigation
|
|
29
|
+
export interface WelcomeScreenProps {
|
|
30
|
+
visible: boolean;
|
|
31
|
+
onClose: () => void;
|
|
32
|
+
onComplete?: (token: string, email?: string) => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type ModalStep = 'welcome' | 'signin' | 'verification' | 'platforms';
|
|
36
|
+
|
|
37
|
+
const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
|
|
38
|
+
visible,
|
|
39
|
+
onClose,
|
|
40
|
+
onComplete,
|
|
41
|
+
}) => {
|
|
42
|
+
const [currentStep, setCurrentStep] = useState<ModalStep>('welcome');
|
|
43
|
+
const [userEmail, setUserEmail] = useState<string>('');
|
|
44
|
+
const [loading, setLoading] = useState<boolean>(false);
|
|
45
|
+
const [error, setError] = useState<string>('');
|
|
46
|
+
|
|
47
|
+
// Animation values
|
|
48
|
+
const slideAnim = useRef(new Animated.Value(1)).current; // Start from bottom
|
|
49
|
+
const fadeAnim = useRef(new Animated.Value(0)).current;
|
|
50
|
+
|
|
51
|
+
// Animate in when visible (matching existing modal style)
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (visible) {
|
|
54
|
+
Animated.parallel([
|
|
55
|
+
Animated.timing(slideAnim, {
|
|
56
|
+
toValue: 0,
|
|
57
|
+
duration: 400,
|
|
58
|
+
easing: Easing.out(Easing.cubic),
|
|
59
|
+
useNativeDriver: true,
|
|
60
|
+
}),
|
|
61
|
+
Animated.timing(fadeAnim, {
|
|
62
|
+
toValue: 1,
|
|
63
|
+
duration: 300,
|
|
64
|
+
useNativeDriver: true,
|
|
65
|
+
}),
|
|
66
|
+
]).start();
|
|
67
|
+
} else {
|
|
68
|
+
slideAnim.setValue(1);
|
|
69
|
+
fadeAnim.setValue(0);
|
|
70
|
+
}
|
|
71
|
+
}, [visible]);
|
|
72
|
+
|
|
73
|
+
const handleClose = () => {
|
|
74
|
+
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
75
|
+
|
|
76
|
+
// Reset to welcome step
|
|
77
|
+
setCurrentStep('welcome');
|
|
78
|
+
|
|
79
|
+
Animated.parallel([
|
|
80
|
+
Animated.timing(slideAnim, {
|
|
81
|
+
toValue: 1,
|
|
82
|
+
duration: 300,
|
|
83
|
+
easing: Easing.in(Easing.cubic),
|
|
84
|
+
useNativeDriver: true,
|
|
85
|
+
}),
|
|
86
|
+
Animated.timing(fadeAnim, {
|
|
87
|
+
toValue: 0,
|
|
88
|
+
duration: 250,
|
|
89
|
+
useNativeDriver: true,
|
|
90
|
+
}),
|
|
91
|
+
]).start(() => {
|
|
92
|
+
onClose();
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const handleGetStarted = () => {
|
|
97
|
+
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
98
|
+
// Move to sign-in step instead of closing modal
|
|
99
|
+
setCurrentStep('signin');
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const handleEmailSubmit = async (email: string) => {
|
|
103
|
+
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
104
|
+
setLoading(true);
|
|
105
|
+
setError('');
|
|
106
|
+
|
|
107
|
+
try {
|
|
108
|
+
// Check for reviewer bypass
|
|
109
|
+
if (email === 'reviewer@bypass.com') {
|
|
110
|
+
console.log('🔍 Reviewer bypass detected in WelcomeScreen');
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
// Store the same markers as the old UI
|
|
114
|
+
await AsyncStorage.setItem('onairos_user', 'true');
|
|
115
|
+
await AsyncStorage.setItem('onairos_jwt_token', 'reviewer-bypass-token');
|
|
116
|
+
console.log('✅ Stored reviewer bypass markers for email bypass');
|
|
117
|
+
|
|
118
|
+
// Store the reviewer email and skip directly to platforms
|
|
119
|
+
setUserEmail(email);
|
|
120
|
+
setCurrentStep('platforms');
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.error('❌ Failed to store reviewer bypass markers:', error);
|
|
123
|
+
// Continue to platforms even if storage fails
|
|
124
|
+
setUserEmail(email);
|
|
125
|
+
setCurrentStep('platforms');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
setLoading(false);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
console.log('📧 Sending verification code to:', email);
|
|
133
|
+
|
|
134
|
+
// Send verification code using the existing API
|
|
135
|
+
const result = await sendEmailVerificationCode(email);
|
|
136
|
+
|
|
137
|
+
if (result.success) {
|
|
138
|
+
console.log('✅ Verification code sent successfully');
|
|
139
|
+
// Store the email and move to verification
|
|
140
|
+
setUserEmail(email);
|
|
141
|
+
setCurrentStep('verification');
|
|
142
|
+
} else {
|
|
143
|
+
console.log('❌ Failed to send verification code:', result.message);
|
|
144
|
+
setError(result.message || 'Failed to send verification code. Please try again.');
|
|
145
|
+
}
|
|
146
|
+
} catch (error) {
|
|
147
|
+
console.error('❌ Error sending verification code:', error);
|
|
148
|
+
setError('Network error. Please check your connection and try again.');
|
|
149
|
+
} finally {
|
|
150
|
+
setLoading(false);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const handleGoogleSignIn = async () => {
|
|
155
|
+
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
156
|
+
setLoading(true);
|
|
157
|
+
setError('');
|
|
158
|
+
|
|
159
|
+
try {
|
|
160
|
+
console.log('🔗 Initiating Google Sign-In');
|
|
161
|
+
|
|
162
|
+
const result = await signInWithGoogle();
|
|
163
|
+
|
|
164
|
+
if (result.success && result.user) {
|
|
165
|
+
console.log('✅ Google Sign-In successful:', result.user.email);
|
|
166
|
+
|
|
167
|
+
// Store user information
|
|
168
|
+
setUserEmail(result.user.email);
|
|
169
|
+
|
|
170
|
+
// Skip to platform connectors (user is already authenticated)
|
|
171
|
+
setCurrentStep('platforms');
|
|
172
|
+
} else if (result.cancelled) {
|
|
173
|
+
console.log('ℹ️ Google Sign-In cancelled by user');
|
|
174
|
+
// Don't show error for cancellation, just reset loading
|
|
175
|
+
} else {
|
|
176
|
+
console.log('❌ Google Sign-In failed:', result.message);
|
|
177
|
+
setError(result.message || 'Google Sign-In failed. Please try again.');
|
|
178
|
+
}
|
|
179
|
+
} catch (error) {
|
|
180
|
+
console.error('❌ Unexpected Google Sign-In error:', error);
|
|
181
|
+
setError('Google Sign-In failed. Please try again.');
|
|
182
|
+
} finally {
|
|
183
|
+
setLoading(false);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const handleContinue = () => {
|
|
188
|
+
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
189
|
+
// Move to verification step
|
|
190
|
+
setCurrentStep('verification');
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const handleCodeSubmit = async (code: string) => {
|
|
194
|
+
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
195
|
+
setLoading(true);
|
|
196
|
+
setError('');
|
|
197
|
+
|
|
198
|
+
try {
|
|
199
|
+
console.log('🔍 Verifying email code:', userEmail, code);
|
|
200
|
+
|
|
201
|
+
// Verify the email code using the existing API
|
|
202
|
+
const result = await confirmEmailVerificationCode(userEmail, code);
|
|
203
|
+
|
|
204
|
+
if (result.success) {
|
|
205
|
+
console.log('✅ Email verification successful');
|
|
206
|
+
// Move to platform connectors step
|
|
207
|
+
setCurrentStep('platforms');
|
|
208
|
+
} else {
|
|
209
|
+
console.log('❌ Email verification failed:', result.message);
|
|
210
|
+
setError(result.message || 'Invalid verification code. Please try again.');
|
|
211
|
+
}
|
|
212
|
+
} catch (error) {
|
|
213
|
+
console.error('❌ Error verifying email code:', error);
|
|
214
|
+
setError('Verification failed. Please try again.');
|
|
215
|
+
} finally {
|
|
216
|
+
setLoading(false);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
const handleBackToSignIn = () => {
|
|
221
|
+
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
222
|
+
setError(''); // Clear any errors when going back
|
|
223
|
+
setCurrentStep('signin');
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const handleBackToVerification = () => {
|
|
227
|
+
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
228
|
+
setCurrentStep('verification');
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
const handleResendCode = async () => {
|
|
232
|
+
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
233
|
+
setLoading(true);
|
|
234
|
+
setError('');
|
|
235
|
+
|
|
236
|
+
try {
|
|
237
|
+
console.log('🔄 Resending verification code to:', userEmail);
|
|
238
|
+
|
|
239
|
+
// Resend verification code using the existing API
|
|
240
|
+
const result = await sendEmailVerificationCode(userEmail);
|
|
241
|
+
|
|
242
|
+
if (result.success) {
|
|
243
|
+
console.log('✅ Verification code resent successfully');
|
|
244
|
+
// Could show a success message here if needed
|
|
245
|
+
} else {
|
|
246
|
+
console.log('❌ Failed to resend verification code:', result.message);
|
|
247
|
+
setError(result.message || 'Failed to resend verification code. Please try again.');
|
|
248
|
+
}
|
|
249
|
+
} catch (error) {
|
|
250
|
+
console.error('❌ Error resending verification code:', error);
|
|
251
|
+
setError('Network error. Please check your connection and try again.');
|
|
252
|
+
} finally {
|
|
253
|
+
setLoading(false);
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
const handlePlatformUpdate = (connectedPlatforms: string[]) => {
|
|
258
|
+
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
259
|
+
console.log('Connected platforms:', connectedPlatforms);
|
|
260
|
+
|
|
261
|
+
// Complete the onboarding flow
|
|
262
|
+
if (onComplete) {
|
|
263
|
+
// Return the stored token and email
|
|
264
|
+
AsyncStorage.getItem('onairos_jwt_token').then(token => {
|
|
265
|
+
onComplete(token || 'onboarding-complete-token', userEmail);
|
|
266
|
+
});
|
|
267
|
+
} else {
|
|
268
|
+
onClose();
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
const handlePlatformSkip = () => {
|
|
273
|
+
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
274
|
+
// Skip platform connections and complete onboarding
|
|
275
|
+
if (onComplete) {
|
|
276
|
+
// Return a skip token
|
|
277
|
+
onComplete('onboarding-skipped-token', userEmail);
|
|
278
|
+
} else {
|
|
279
|
+
onClose();
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const handleReviewerBypass = async () => {
|
|
284
|
+
console.log('🔍 Reviewer bypass triggered from platforms screen');
|
|
285
|
+
triggerHaptic(HapticType.BUTTON_PRESS);
|
|
286
|
+
|
|
287
|
+
try {
|
|
288
|
+
// Store the same markers as the old UI
|
|
289
|
+
await AsyncStorage.setItem('onairos_user', 'true');
|
|
290
|
+
await AsyncStorage.setItem('onairos_jwt_token', 'reviewer-bypass-token');
|
|
291
|
+
console.log('✅ Stored reviewer bypass markers for new UI');
|
|
292
|
+
|
|
293
|
+
// Complete the onboarding with bypass token
|
|
294
|
+
if (onComplete) {
|
|
295
|
+
onComplete('reviewer-bypass-token', 'reviewer@apple.com');
|
|
296
|
+
} else {
|
|
297
|
+
onClose();
|
|
298
|
+
}
|
|
299
|
+
} catch (error) {
|
|
300
|
+
console.error('❌ Failed to store reviewer bypass markers:', error);
|
|
301
|
+
// Still complete the onboarding even if storage fails
|
|
302
|
+
if (onComplete) {
|
|
303
|
+
onComplete('reviewer-bypass-token', 'reviewer@apple.com');
|
|
304
|
+
} else {
|
|
305
|
+
onClose();
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
const handleBackdropPress = () => {
|
|
311
|
+
// Optional: allow closing by tapping backdrop
|
|
312
|
+
handleClose();
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
if (!visible) {
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return (
|
|
320
|
+
<Modal
|
|
321
|
+
visible={visible}
|
|
322
|
+
transparent
|
|
323
|
+
animationType="slide" // Use built-in slide animation like existing modal
|
|
324
|
+
onRequestClose={handleClose}
|
|
325
|
+
statusBarTranslucent
|
|
326
|
+
>
|
|
327
|
+
<StatusBar backgroundColor="rgba(0,0,0,0.5)" barStyle="light-content" />
|
|
328
|
+
|
|
329
|
+
{/* Backdrop */}
|
|
330
|
+
<Animated.View style={[styles.backdrop, { opacity: fadeAnim }]}>
|
|
331
|
+
<TouchableWithoutFeedback onPress={handleBackdropPress}>
|
|
332
|
+
<View style={styles.backdropTouchable} />
|
|
333
|
+
</TouchableWithoutFeedback>
|
|
334
|
+
</Animated.View>
|
|
335
|
+
|
|
336
|
+
{/* Modal Content */}
|
|
337
|
+
<Animated.View
|
|
338
|
+
style={[
|
|
339
|
+
styles.modalContainer,
|
|
340
|
+
{
|
|
341
|
+
transform: [{
|
|
342
|
+
translateY: slideAnim.interpolate({
|
|
343
|
+
inputRange: [0, 1],
|
|
344
|
+
outputRange: [0, 600], // Slide from bottom
|
|
345
|
+
})
|
|
346
|
+
}]
|
|
347
|
+
}
|
|
348
|
+
]}
|
|
349
|
+
>
|
|
350
|
+
<SafeAreaProvider>
|
|
351
|
+
<ModalSheet topPadding={0}>
|
|
352
|
+
<ModalHeader
|
|
353
|
+
onClose={handleClose}
|
|
354
|
+
onBack={currentStep === 'verification' ? handleBackToSignIn : handleBackToVerification}
|
|
355
|
+
showBackButton={currentStep === 'verification' || currentStep === 'platforms'}
|
|
356
|
+
/>
|
|
357
|
+
|
|
358
|
+
{currentStep === 'welcome' && (
|
|
359
|
+
<View style={styles.content}>
|
|
360
|
+
{/* Brand Mark */}
|
|
361
|
+
<View style={styles.brandMarkContainer}>
|
|
362
|
+
<BrandMark />
|
|
363
|
+
</View>
|
|
364
|
+
|
|
365
|
+
{/* Heading Group */}
|
|
366
|
+
<View style={styles.headingContainer}>
|
|
367
|
+
<HeadingGroup />
|
|
368
|
+
</View>
|
|
369
|
+
|
|
370
|
+
{/* Body Text */}
|
|
371
|
+
<View style={styles.bodyContainer}>
|
|
372
|
+
<BodyText />
|
|
373
|
+
</View>
|
|
374
|
+
|
|
375
|
+
{/* Flexible Spacer */}
|
|
376
|
+
<View style={styles.spacer} />
|
|
377
|
+
|
|
378
|
+
{/* Primary Button */}
|
|
379
|
+
<View style={styles.buttonContainer}>
|
|
380
|
+
<PrimaryButton
|
|
381
|
+
label="Get Started"
|
|
382
|
+
onPress={handleGetStarted}
|
|
383
|
+
testID="welcome-get-started-button"
|
|
384
|
+
/>
|
|
385
|
+
</View>
|
|
386
|
+
</View>
|
|
387
|
+
)}
|
|
388
|
+
|
|
389
|
+
{currentStep === 'signin' && (
|
|
390
|
+
<SignInStep
|
|
391
|
+
onEmailSubmit={handleEmailSubmit}
|
|
392
|
+
onGoogleSignIn={handleGoogleSignIn}
|
|
393
|
+
onContinue={handleContinue}
|
|
394
|
+
loading={loading}
|
|
395
|
+
error={error}
|
|
396
|
+
/>
|
|
397
|
+
)}
|
|
398
|
+
|
|
399
|
+
{currentStep === 'verification' && (
|
|
400
|
+
<VerificationStep
|
|
401
|
+
email={userEmail}
|
|
402
|
+
onCodeSubmit={handleCodeSubmit}
|
|
403
|
+
onBack={handleBackToSignIn}
|
|
404
|
+
loading={loading}
|
|
405
|
+
error={error}
|
|
406
|
+
onResendCode={handleResendCode}
|
|
407
|
+
/>
|
|
408
|
+
)}
|
|
409
|
+
|
|
410
|
+
{currentStep === 'platforms' && (
|
|
411
|
+
<PlatformConnectorsStep
|
|
412
|
+
onUpdate={handlePlatformUpdate}
|
|
413
|
+
onSkip={handlePlatformSkip}
|
|
414
|
+
onReviewerBypass={handleReviewerBypass}
|
|
415
|
+
/>
|
|
416
|
+
)}
|
|
417
|
+
</ModalSheet>
|
|
418
|
+
</SafeAreaProvider>
|
|
419
|
+
</Animated.View>
|
|
420
|
+
</Modal>
|
|
421
|
+
);
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
const styles = StyleSheet.create({
|
|
425
|
+
backdrop: {
|
|
426
|
+
...StyleSheet.absoluteFillObject,
|
|
427
|
+
backgroundColor: 'transparent', // Remove grey overlay
|
|
428
|
+
},
|
|
429
|
+
|
|
430
|
+
backdropTouchable: {
|
|
431
|
+
flex: 1,
|
|
432
|
+
},
|
|
433
|
+
|
|
434
|
+
modalContainer: {
|
|
435
|
+
position: 'absolute',
|
|
436
|
+
bottom: 0,
|
|
437
|
+
left: 0,
|
|
438
|
+
right: 0,
|
|
439
|
+
height: '85%', // Take most of the screen
|
|
440
|
+
},
|
|
441
|
+
|
|
442
|
+
content: {
|
|
443
|
+
flex: 1,
|
|
444
|
+
alignItems: 'center',
|
|
445
|
+
paddingTop: 20,
|
|
446
|
+
},
|
|
447
|
+
|
|
448
|
+
brandMarkContainer: {
|
|
449
|
+
marginBottom: 32,
|
|
450
|
+
},
|
|
451
|
+
|
|
452
|
+
headingContainer: {
|
|
453
|
+
marginBottom: 24,
|
|
454
|
+
},
|
|
455
|
+
|
|
456
|
+
bodyContainer: {
|
|
457
|
+
marginBottom: 32,
|
|
458
|
+
width: '100%',
|
|
459
|
+
},
|
|
460
|
+
|
|
461
|
+
spacer: {
|
|
462
|
+
flex: 1,
|
|
463
|
+
minHeight: 20, // Ensure some minimum space
|
|
464
|
+
},
|
|
465
|
+
|
|
466
|
+
buttonContainer: {
|
|
467
|
+
width: '100%',
|
|
468
|
+
paddingHorizontal: 24,
|
|
469
|
+
paddingBottom: 20,
|
|
470
|
+
},
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
export default WelcomeScreen;
|