@oxyhq/services 5.11.9 → 5.11.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/ui/components/AnimationExample.js +213 -0
- package/lib/commonjs/ui/components/AnimationExample.js.map +1 -0
- package/lib/commonjs/ui/components/FollowButton.js +58 -47
- package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
- package/lib/commonjs/ui/components/GroupedItem.js +2 -1
- package/lib/commonjs/ui/components/GroupedItem.js.map +1 -1
- package/lib/commonjs/ui/components/GroupedSection.js +3 -0
- package/lib/commonjs/ui/components/GroupedSection.js.map +1 -1
- package/lib/commonjs/ui/components/Header.js +26 -12
- package/lib/commonjs/ui/components/Header.js.map +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +69 -33
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/ProfileCard.js +5 -1
- package/lib/commonjs/ui/components/ProfileCard.js.map +1 -1
- package/lib/commonjs/ui/components/StepBasedScreen.README.md +337 -0
- package/lib/commonjs/ui/components/StepBasedScreen.js +361 -0
- package/lib/commonjs/ui/components/StepBasedScreen.js.map +1 -0
- package/lib/commonjs/ui/components/icon/OxyIcon.js +3 -3
- package/lib/commonjs/ui/components/icon/OxyIcon.js.map +1 -1
- package/lib/commonjs/ui/components/index.js +0 -7
- package/lib/commonjs/ui/components/index.js.map +1 -1
- package/lib/commonjs/ui/components/internal/PinInput.js +1 -1
- package/lib/commonjs/ui/components/internal/PinInput.js.map +1 -1
- package/lib/commonjs/ui/components/internal/TextField.js +8 -4
- package/lib/commonjs/ui/components/internal/TextField.js.map +1 -1
- package/lib/commonjs/ui/components/photogrid/JustifiedPhotoGrid.js +161 -0
- package/lib/commonjs/ui/components/photogrid/JustifiedPhotoGrid.js.map +1 -0
- package/lib/commonjs/ui/context/OxyContext.js +103 -44
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/hooks/useFollow.types.js +2 -0
- package/lib/commonjs/ui/hooks/useFollow.types.js.map +1 -0
- package/lib/commonjs/ui/navigation/OxyRouter.js +10 -0
- package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +26 -14
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +3 -3
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +64 -15
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +4 -4
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FeedbackScreen.js +72 -75
- package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +286 -126
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +322 -0
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/ProfileScreen.js +56 -56
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/RecoverAccountScreen.js +87 -219
- package/lib/commonjs/ui/screens/RecoverAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SessionManagementScreen.js +176 -174
- package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignInScreen.js +138 -244
- package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SignUpScreen.js +143 -744
- package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js +386 -0
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js +25 -15
- package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js.map +1 -1
- package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js +16 -9
- package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js.map +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +1 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/steps/RecoverRequestStep.js +110 -0
- package/lib/commonjs/ui/screens/steps/RecoverRequestStep.js.map +1 -0
- package/lib/commonjs/ui/screens/steps/RecoverSuccessStep.js +138 -0
- package/lib/commonjs/ui/screens/steps/RecoverSuccessStep.js.map +1 -0
- package/lib/commonjs/ui/screens/steps/RecoverVerifyStep.js +141 -0
- package/lib/commonjs/ui/screens/steps/RecoverVerifyStep.js.map +1 -0
- package/lib/commonjs/ui/screens/steps/SignInPasswordStep.js +165 -0
- package/lib/commonjs/ui/screens/steps/SignInPasswordStep.js.map +1 -0
- package/lib/commonjs/ui/screens/steps/SignInUsernameStep.js +150 -0
- package/lib/commonjs/ui/screens/steps/SignInUsernameStep.js.map +1 -0
- package/lib/commonjs/ui/screens/steps/SignUpIdentityStep.js +171 -0
- package/lib/commonjs/ui/screens/steps/SignUpIdentityStep.js.map +1 -0
- package/lib/commonjs/ui/screens/steps/SignUpSecurityStep.js +163 -0
- package/lib/commonjs/ui/screens/steps/SignUpSecurityStep.js.map +1 -0
- package/lib/commonjs/ui/screens/steps/SignUpSummaryStep.js +170 -0
- package/lib/commonjs/ui/screens/steps/SignUpSummaryStep.js.map +1 -0
- package/lib/commonjs/ui/screens/steps/SignUpWelcomeStep.js +72 -0
- package/lib/commonjs/ui/screens/steps/SignUpWelcomeStep.js.map +1 -0
- package/lib/commonjs/ui/styles/authStyles.js +1 -1
- package/lib/commonjs/ui/styles/authStyles.js.map +1 -1
- package/lib/module/ui/components/AnimationExample.js +209 -0
- package/lib/module/ui/components/AnimationExample.js.map +1 -0
- package/lib/module/ui/components/FollowButton.js +58 -47
- package/lib/module/ui/components/FollowButton.js.map +1 -1
- package/lib/module/ui/components/GroupedItem.js +2 -1
- package/lib/module/ui/components/GroupedItem.js.map +1 -1
- package/lib/module/ui/components/GroupedSection.js +3 -0
- package/lib/module/ui/components/GroupedSection.js.map +1 -1
- package/lib/module/ui/components/Header.js +26 -12
- package/lib/module/ui/components/Header.js.map +1 -1
- package/lib/module/ui/components/OxyProvider.js +70 -34
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/ProfileCard.js +5 -1
- package/lib/module/ui/components/ProfileCard.js.map +1 -1
- package/lib/module/ui/components/Section.js.map +1 -1
- package/lib/module/ui/components/SectionTitle.js.map +1 -1
- package/lib/module/ui/components/StepBasedScreen.README.md +337 -0
- package/lib/module/ui/components/StepBasedScreen.js +356 -0
- package/lib/module/ui/components/StepBasedScreen.js.map +1 -0
- package/lib/module/ui/components/icon/FAIRWalletIcon.js.map +1 -1
- package/lib/module/ui/components/icon/OxyIcon.js +3 -3
- package/lib/module/ui/components/icon/OxyIcon.js.map +1 -1
- package/lib/module/ui/components/index.js +0 -1
- package/lib/module/ui/components/index.js.map +1 -1
- package/lib/module/ui/components/internal/PinInput.js +1 -1
- package/lib/module/ui/components/internal/PinInput.js.map +1 -1
- package/lib/module/ui/components/internal/TextField.js +8 -4
- package/lib/module/ui/components/internal/TextField.js.map +1 -1
- package/lib/module/ui/components/photogrid/JustifiedPhotoGrid.js +156 -0
- package/lib/module/ui/components/photogrid/JustifiedPhotoGrid.js.map +1 -0
- package/lib/module/ui/context/OxyContext.js +103 -45
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/hooks/useFollow.types.js +2 -0
- package/lib/module/ui/hooks/useFollow.types.js.map +1 -0
- package/lib/module/ui/navigation/OxyRouter.js +10 -0
- package/lib/module/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +12 -1
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js +3 -3
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +64 -15
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +4 -4
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
- package/lib/module/ui/screens/FeedbackScreen.js +72 -75
- package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +285 -125
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/LanguageSelectorScreen.js +319 -0
- package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -0
- package/lib/module/ui/screens/ProfileScreen.js +56 -56
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/RecoverAccountScreen.js +91 -222
- package/lib/module/ui/screens/RecoverAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/SessionManagementScreen.js +177 -175
- package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/SignInScreen.js +140 -246
- package/lib/module/ui/screens/SignInScreen.js.map +1 -1
- package/lib/module/ui/screens/SignUpScreen.js +145 -745
- package/lib/module/ui/screens/SignUpScreen.js.map +1 -1
- package/lib/module/ui/screens/WelcomeNewUserScreen.js +382 -0
- package/lib/module/ui/screens/WelcomeNewUserScreen.js.map +1 -0
- package/lib/module/ui/screens/internal/SignInPasswordStep.js +23 -14
- package/lib/module/ui/screens/internal/SignInPasswordStep.js.map +1 -1
- package/lib/module/ui/screens/internal/SignInUsernameStep.js +15 -9
- package/lib/module/ui/screens/internal/SignInUsernameStep.js.map +1 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js +1 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/steps/RecoverRequestStep.js +105 -0
- package/lib/module/ui/screens/steps/RecoverRequestStep.js.map +1 -0
- package/lib/module/ui/screens/steps/RecoverSuccessStep.js +133 -0
- package/lib/module/ui/screens/steps/RecoverSuccessStep.js.map +1 -0
- package/lib/module/ui/screens/steps/RecoverVerifyStep.js +136 -0
- package/lib/module/ui/screens/steps/RecoverVerifyStep.js.map +1 -0
- package/lib/module/ui/screens/steps/SignInPasswordStep.js +160 -0
- package/lib/module/ui/screens/steps/SignInPasswordStep.js.map +1 -0
- package/lib/module/ui/screens/steps/SignInUsernameStep.js +145 -0
- package/lib/module/ui/screens/steps/SignInUsernameStep.js.map +1 -0
- package/lib/module/ui/screens/steps/SignUpIdentityStep.js +166 -0
- package/lib/module/ui/screens/steps/SignUpIdentityStep.js.map +1 -0
- package/lib/module/ui/screens/steps/SignUpSecurityStep.js +158 -0
- package/lib/module/ui/screens/steps/SignUpSecurityStep.js.map +1 -0
- package/lib/module/ui/screens/steps/SignUpSummaryStep.js +165 -0
- package/lib/module/ui/screens/steps/SignUpSummaryStep.js.map +1 -0
- package/lib/module/ui/screens/steps/SignUpWelcomeStep.js +67 -0
- package/lib/module/ui/screens/steps/SignUpWelcomeStep.js.map +1 -0
- package/lib/module/ui/styles/authStyles.js +1 -1
- package/lib/module/ui/styles/authStyles.js.map +1 -1
- package/lib/typescript/models/interfaces.d.ts +5 -8
- package/lib/typescript/models/interfaces.d.ts.map +1 -1
- package/lib/typescript/models/session.d.ts +1 -4
- package/lib/typescript/models/session.d.ts.map +1 -1
- package/lib/typescript/ui/components/AnimationExample.d.ts +4 -0
- package/lib/typescript/ui/components/AnimationExample.d.ts.map +1 -0
- package/lib/typescript/ui/components/FollowButton.d.ts.map +1 -1
- package/lib/typescript/ui/components/GroupedItem.d.ts.map +1 -1
- package/lib/typescript/ui/components/Header.d.ts +9 -0
- package/lib/typescript/ui/components/Header.d.ts.map +1 -1
- package/lib/typescript/ui/components/OxyPayButton.d.ts +2 -2
- package/lib/typescript/ui/components/OxyPayButton.d.ts.map +1 -1
- package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/ui/components/ProfileCard.d.ts +1 -3
- package/lib/typescript/ui/components/ProfileCard.d.ts.map +1 -1
- package/lib/typescript/ui/components/Section.d.ts +2 -1
- package/lib/typescript/ui/components/Section.d.ts.map +1 -1
- package/lib/typescript/ui/components/SectionTitle.d.ts +2 -1
- package/lib/typescript/ui/components/SectionTitle.d.ts.map +1 -1
- package/lib/typescript/ui/components/StepBasedScreen.d.ts +24 -0
- package/lib/typescript/ui/components/StepBasedScreen.d.ts.map +1 -0
- package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts +2 -1
- package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts.map +1 -1
- package/lib/typescript/ui/components/icon/OxyIcon.d.ts +1 -1
- package/lib/typescript/ui/components/icon/OxyIcon.d.ts.map +1 -1
- package/lib/typescript/ui/components/index.d.ts +0 -1
- package/lib/typescript/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/ui/components/internal/PinInput.d.ts +9 -1
- package/lib/typescript/ui/components/internal/PinInput.d.ts.map +1 -1
- package/lib/typescript/ui/components/internal/TextField.d.ts.map +1 -1
- package/lib/typescript/ui/components/photogrid/JustifiedPhotoGrid.d.ts +27 -0
- package/lib/typescript/ui/components/photogrid/JustifiedPhotoGrid.d.ts.map +1 -0
- package/lib/typescript/ui/context/OxyContext.d.ts +8 -3
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useFollow.types.d.ts +33 -0
- package/lib/typescript/ui/hooks/useFollow.types.d.ts.map +1 -0
- package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -1
- package/lib/typescript/ui/navigation/types.d.ts +5 -0
- package/lib/typescript/ui/navigation/types.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/FileManagementScreen.d.ts +18 -1
- package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/LanguageSelectorScreen.d.ts +7 -0
- package/lib/typescript/ui/screens/LanguageSelectorScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts +2 -2
- package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/ProfileScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts +2 -9
- package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SessionManagementScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/SignUpScreen.d.ts +1 -1
- package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/WelcomeNewUserScreen.d.ts +13 -0
- package/lib/typescript/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -0
- package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts +5 -5
- package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts +4 -4
- package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts.map +1 -1
- package/lib/typescript/ui/screens/steps/RecoverRequestStep.d.ts +21 -0
- package/lib/typescript/ui/screens/steps/RecoverRequestStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/steps/RecoverSuccessStep.d.ts +18 -0
- package/lib/typescript/ui/screens/steps/RecoverSuccessStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/steps/RecoverVerifyStep.d.ts +24 -0
- package/lib/typescript/ui/screens/steps/RecoverVerifyStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/steps/SignInPasswordStep.d.ts +27 -0
- package/lib/typescript/ui/screens/steps/SignInPasswordStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/steps/SignInUsernameStep.d.ts +27 -0
- package/lib/typescript/ui/screens/steps/SignInUsernameStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/steps/SignUpIdentityStep.d.ts +25 -0
- package/lib/typescript/ui/screens/steps/SignUpIdentityStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/steps/SignUpSecurityStep.d.ts +26 -0
- package/lib/typescript/ui/screens/steps/SignUpSecurityStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/steps/SignUpSummaryStep.d.ts +16 -0
- package/lib/typescript/ui/screens/steps/SignUpSummaryStep.d.ts.map +1 -0
- package/lib/typescript/ui/screens/steps/SignUpWelcomeStep.d.ts +13 -0
- package/lib/typescript/ui/screens/steps/SignUpWelcomeStep.d.ts.map +1 -0
- package/lib/typescript/ui/styles/authStyles.d.ts +1 -1
- package/package.json +10 -3
- package/src/models/interfaces.ts +7 -8
- package/src/models/session.ts +1 -4
- package/src/ui/components/AnimationExample.tsx +195 -0
- package/src/ui/components/FollowButton.tsx +65 -45
- package/src/ui/components/GroupedItem.tsx +1 -0
- package/src/ui/components/GroupedSection.tsx +1 -1
- package/src/ui/components/Header.tsx +37 -13
- package/src/ui/components/OxyPayButton.tsx +2 -2
- package/src/ui/components/OxyProvider.tsx +67 -33
- package/src/ui/components/ProfileCard.tsx +6 -8
- package/src/ui/components/Section.tsx +7 -7
- package/src/ui/components/SectionTitle.tsx +2 -2
- package/src/ui/components/StepBasedScreen.README.md +337 -0
- package/src/ui/components/StepBasedScreen.tsx +417 -0
- package/src/ui/components/icon/FAIRWalletIcon.tsx +2 -2
- package/src/ui/components/icon/OxyIcon.tsx +10 -11
- package/src/ui/components/index.ts +0 -1
- package/src/ui/components/internal/PinInput.tsx +13 -4
- package/src/ui/components/internal/TextField.tsx +12 -6
- package/src/ui/components/photogrid/JustifiedPhotoGrid.tsx +158 -0
- package/src/ui/context/OxyContext.tsx +90 -59
- package/src/ui/hooks/useFollow.types.ts +33 -0
- package/src/ui/navigation/OxyRouter.tsx +10 -0
- package/src/ui/navigation/types.ts +6 -0
- package/src/ui/screens/AccountCenterScreen.tsx +13 -7
- package/src/ui/screens/AccountOverviewScreen.tsx +3 -3
- package/src/ui/screens/AccountSettingsScreen.tsx +65 -13
- package/src/ui/screens/AccountSwitcherScreen.tsx +4 -4
- package/src/ui/screens/FeedbackScreen.tsx +57 -80
- package/src/ui/screens/FileManagementScreen.tsx +278 -175
- package/src/ui/screens/LanguageSelectorScreen.tsx +322 -0
- package/src/ui/screens/PaymentGatewayScreen.tsx +2 -2
- package/src/ui/screens/ProfileScreen.tsx +60 -55
- package/src/ui/screens/RecoverAccountScreen.tsx +98 -211
- package/src/ui/screens/SessionManagementScreen.tsx +148 -151
- package/src/ui/screens/SignInScreen.tsx +148 -290
- package/src/ui/screens/SignUpScreen.tsx +147 -751
- package/src/ui/screens/WelcomeNewUserScreen.tsx +272 -0
- package/src/ui/screens/internal/SignInPasswordStep.tsx +28 -13
- package/src/ui/screens/internal/SignInUsernameStep.tsx +21 -11
- package/src/ui/screens/karma/KarmaCenterScreen.tsx +1 -1
- package/src/ui/screens/steps/RecoverRequestStep.tsx +130 -0
- package/src/ui/screens/steps/RecoverSuccessStep.tsx +131 -0
- package/src/ui/screens/steps/RecoverVerifyStep.tsx +153 -0
- package/src/ui/screens/steps/SignInPasswordStep.tsx +172 -0
- package/src/ui/screens/steps/SignInUsernameStep.tsx +176 -0
- package/src/ui/screens/steps/SignUpIdentityStep.tsx +204 -0
- package/src/ui/screens/steps/SignUpSecurityStep.tsx +191 -0
- package/src/ui/screens/steps/SignUpSummaryStep.tsx +130 -0
- package/src/ui/screens/steps/SignUpWelcomeStep.tsx +65 -0
- package/src/ui/styles/authStyles.ts +1 -1
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { View, Text } from 'react-native';
|
|
3
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
4
|
+
import GroupedPillButtons from '../../components/internal/GroupedPillButtons';
|
|
5
|
+
import PinInput from '../../components/internal/PinInput';
|
|
6
|
+
|
|
7
|
+
interface RecoverVerifyStepProps {
|
|
8
|
+
// Common props from StepBasedScreen
|
|
9
|
+
colors: any;
|
|
10
|
+
styles: any;
|
|
11
|
+
theme: string;
|
|
12
|
+
navigate: (screen: string, props?: Record<string, any>) => void;
|
|
13
|
+
|
|
14
|
+
// Step navigation
|
|
15
|
+
nextStep: () => void;
|
|
16
|
+
prevStep: () => void;
|
|
17
|
+
currentStep: number;
|
|
18
|
+
totalSteps: number;
|
|
19
|
+
|
|
20
|
+
// Data management
|
|
21
|
+
stepData?: any;
|
|
22
|
+
updateStepData: (data: any) => void;
|
|
23
|
+
|
|
24
|
+
// Form state
|
|
25
|
+
verificationCode: string;
|
|
26
|
+
setVerificationCode: (code: string) => void;
|
|
27
|
+
errorMessage: string;
|
|
28
|
+
setErrorMessage: (message: string) => void;
|
|
29
|
+
successMessage: string;
|
|
30
|
+
setSuccessMessage: (message: string) => void;
|
|
31
|
+
isLoading: boolean;
|
|
32
|
+
setIsLoading: (loading: boolean) => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const RecoverVerifyStep: React.FC<RecoverVerifyStepProps> = ({
|
|
36
|
+
colors,
|
|
37
|
+
styles,
|
|
38
|
+
nextStep,
|
|
39
|
+
prevStep,
|
|
40
|
+
verificationCode,
|
|
41
|
+
setVerificationCode,
|
|
42
|
+
errorMessage,
|
|
43
|
+
setErrorMessage,
|
|
44
|
+
successMessage,
|
|
45
|
+
setSuccessMessage,
|
|
46
|
+
isLoading,
|
|
47
|
+
setIsLoading,
|
|
48
|
+
}) => {
|
|
49
|
+
const handleVerifyCode = () => {
|
|
50
|
+
setErrorMessage('');
|
|
51
|
+
setSuccessMessage('');
|
|
52
|
+
|
|
53
|
+
if (verificationCode.length !== 6) {
|
|
54
|
+
setErrorMessage('Please enter the 6-digit code.');
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
setIsLoading(true);
|
|
59
|
+
|
|
60
|
+
// Simulate verification
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
setIsLoading(false);
|
|
63
|
+
if (verificationCode === '123456') { // Simulate correct code
|
|
64
|
+
setSuccessMessage('Your account has been verified! You can now reset your password.');
|
|
65
|
+
nextStep(); // Move to success step
|
|
66
|
+
} else {
|
|
67
|
+
setErrorMessage('Invalid code. Please try again.');
|
|
68
|
+
}
|
|
69
|
+
}, 1200);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<>
|
|
74
|
+
<View style={styles.modernHeader}>
|
|
75
|
+
<Text style={[styles.modernTitle, { color: colors.text }]}>
|
|
76
|
+
Verify Code
|
|
77
|
+
</Text>
|
|
78
|
+
<Text style={[styles.modernSubtitle, { color: colors.secondaryText }]}>
|
|
79
|
+
Enter the 6-digit code sent to your email or phone.
|
|
80
|
+
</Text>
|
|
81
|
+
</View>
|
|
82
|
+
|
|
83
|
+
<View style={styles.modernInputContainer}>
|
|
84
|
+
<PinInput
|
|
85
|
+
value={verificationCode}
|
|
86
|
+
onChange={setVerificationCode}
|
|
87
|
+
length={6}
|
|
88
|
+
disabled={isLoading}
|
|
89
|
+
autoFocus
|
|
90
|
+
colors={colors}
|
|
91
|
+
/>
|
|
92
|
+
|
|
93
|
+
{successMessage && (
|
|
94
|
+
<View style={{
|
|
95
|
+
flexDirection: 'row',
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
marginTop: 16,
|
|
98
|
+
padding: 12,
|
|
99
|
+
backgroundColor: colors.success + '10',
|
|
100
|
+
borderRadius: 8,
|
|
101
|
+
borderWidth: 1,
|
|
102
|
+
borderColor: colors.success + '30',
|
|
103
|
+
}}>
|
|
104
|
+
<Ionicons name="checkmark-circle" size={20} color={colors.success} style={{ marginRight: 8 }} />
|
|
105
|
+
<Text style={[styles.footerText, { color: colors.success, fontSize: 14 }]}>
|
|
106
|
+
{successMessage}
|
|
107
|
+
</Text>
|
|
108
|
+
</View>
|
|
109
|
+
)}
|
|
110
|
+
|
|
111
|
+
{errorMessage && (
|
|
112
|
+
<View style={{
|
|
113
|
+
flexDirection: 'row',
|
|
114
|
+
alignItems: 'center',
|
|
115
|
+
marginTop: 16,
|
|
116
|
+
padding: 12,
|
|
117
|
+
backgroundColor: colors.error + '10',
|
|
118
|
+
borderRadius: 8,
|
|
119
|
+
borderWidth: 1,
|
|
120
|
+
borderColor: colors.error + '30',
|
|
121
|
+
}}>
|
|
122
|
+
<Ionicons name="alert-circle" size={20} color={colors.error} style={{ marginRight: 8 }} />
|
|
123
|
+
<Text style={[styles.footerText, { color: colors.error, fontSize: 14 }]}>
|
|
124
|
+
{errorMessage}
|
|
125
|
+
</Text>
|
|
126
|
+
</View>
|
|
127
|
+
)}
|
|
128
|
+
</View>
|
|
129
|
+
|
|
130
|
+
<GroupedPillButtons
|
|
131
|
+
buttons={[
|
|
132
|
+
{
|
|
133
|
+
text: 'Back',
|
|
134
|
+
onPress: prevStep,
|
|
135
|
+
icon: 'arrow-back',
|
|
136
|
+
variant: 'transparent',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
text: 'Verify Code',
|
|
140
|
+
onPress: handleVerifyCode,
|
|
141
|
+
icon: 'checkmark-circle-outline',
|
|
142
|
+
variant: 'primary',
|
|
143
|
+
loading: isLoading,
|
|
144
|
+
disabled: isLoading || verificationCode.length !== 6,
|
|
145
|
+
},
|
|
146
|
+
]}
|
|
147
|
+
colors={colors}
|
|
148
|
+
/>
|
|
149
|
+
</>
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export default RecoverVerifyStep;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { useRef, useEffect } from 'react';
|
|
3
|
+
import { View, Text, TouchableOpacity } from 'react-native';
|
|
4
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
5
|
+
import Avatar from '../../components/Avatar';
|
|
6
|
+
import GroupedPillButtons from '../../components/internal/GroupedPillButtons';
|
|
7
|
+
import TextField from '../../components/internal/TextField';
|
|
8
|
+
|
|
9
|
+
interface SignInPasswordStepProps {
|
|
10
|
+
// Common props from StepBasedScreen
|
|
11
|
+
colors: any;
|
|
12
|
+
styles: any;
|
|
13
|
+
theme: string;
|
|
14
|
+
navigate: (screen: string, props?: Record<string, any>) => void;
|
|
15
|
+
|
|
16
|
+
// Step navigation
|
|
17
|
+
nextStep: () => void;
|
|
18
|
+
prevStep: () => void;
|
|
19
|
+
currentStep: number;
|
|
20
|
+
totalSteps: number;
|
|
21
|
+
|
|
22
|
+
// Data management
|
|
23
|
+
stepData?: any;
|
|
24
|
+
updateStepData: (data: any) => void;
|
|
25
|
+
allStepData: any[];
|
|
26
|
+
|
|
27
|
+
// Form state
|
|
28
|
+
password: string;
|
|
29
|
+
setPassword: (password: string) => void;
|
|
30
|
+
showPassword: boolean;
|
|
31
|
+
setShowPassword: (show: boolean) => void;
|
|
32
|
+
errorMessage: string;
|
|
33
|
+
setErrorMessage: (message: string) => void;
|
|
34
|
+
isLoading: boolean;
|
|
35
|
+
|
|
36
|
+
// User profile
|
|
37
|
+
userProfile: any;
|
|
38
|
+
username: string;
|
|
39
|
+
|
|
40
|
+
// Sign-in function
|
|
41
|
+
handleSignIn: () => Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const SignInPasswordStep: React.FC<SignInPasswordStepProps> = ({
|
|
45
|
+
colors,
|
|
46
|
+
styles,
|
|
47
|
+
theme,
|
|
48
|
+
navigate,
|
|
49
|
+
prevStep,
|
|
50
|
+
password,
|
|
51
|
+
setPassword,
|
|
52
|
+
showPassword,
|
|
53
|
+
setShowPassword,
|
|
54
|
+
errorMessage,
|
|
55
|
+
setErrorMessage,
|
|
56
|
+
isLoading,
|
|
57
|
+
userProfile,
|
|
58
|
+
username,
|
|
59
|
+
handleSignIn,
|
|
60
|
+
}) => {
|
|
61
|
+
const inputRef = useRef<any>(null);
|
|
62
|
+
|
|
63
|
+
const handlePasswordChange = (text: string) => {
|
|
64
|
+
setPassword(text);
|
|
65
|
+
if (errorMessage) setErrorMessage('');
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const handleSignInSubmit = async () => {
|
|
69
|
+
if (!password) {
|
|
70
|
+
setErrorMessage('Please enter your password.');
|
|
71
|
+
setTimeout(() => inputRef.current?.focus(), 0);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Call the actual sign-in function passed from props
|
|
76
|
+
await handleSignIn();
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const togglePasswordVisibility = () => {
|
|
80
|
+
setShowPassword(!showPassword);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// Focus password input on error
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (errorMessage) {
|
|
86
|
+
setTimeout(() => {
|
|
87
|
+
inputRef.current?.focus();
|
|
88
|
+
}, 0);
|
|
89
|
+
}
|
|
90
|
+
}, [errorMessage]);
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<>
|
|
94
|
+
<View style={styles.modernUserProfileContainer}>
|
|
95
|
+
<View style={styles.avatarContainer}>
|
|
96
|
+
<Avatar
|
|
97
|
+
name={userProfile?.displayName || userProfile?.name || username}
|
|
98
|
+
size={100}
|
|
99
|
+
theme={theme as 'light' | 'dark'}
|
|
100
|
+
style={styles.modernUserAvatar}
|
|
101
|
+
backgroundColor={colors.primary + '20'}
|
|
102
|
+
/>
|
|
103
|
+
<View style={[styles.statusIndicator, { backgroundColor: colors.primary }]} />
|
|
104
|
+
</View>
|
|
105
|
+
<Text style={[styles.modernUserDisplayName, { color: colors.text }]}>
|
|
106
|
+
{userProfile?.displayName || userProfile?.name || username}
|
|
107
|
+
</Text>
|
|
108
|
+
<Text style={[styles.modernUsernameSubtext, { color: colors.secondaryText }]}>
|
|
109
|
+
@{username}
|
|
110
|
+
</Text>
|
|
111
|
+
</View>
|
|
112
|
+
|
|
113
|
+
<View style={styles.modernInputContainer}>
|
|
114
|
+
<TextField
|
|
115
|
+
ref={inputRef}
|
|
116
|
+
label="Password"
|
|
117
|
+
leading={<Ionicons name="lock-closed-outline" size={24} color={colors.secondaryText} />}
|
|
118
|
+
value={password}
|
|
119
|
+
onChangeText={handlePasswordChange}
|
|
120
|
+
secureTextEntry={!showPassword}
|
|
121
|
+
autoCapitalize="none"
|
|
122
|
+
autoCorrect={false}
|
|
123
|
+
testID="password-input"
|
|
124
|
+
variant="filled"
|
|
125
|
+
error={errorMessage || undefined}
|
|
126
|
+
onSubmitEditing={handleSignInSubmit}
|
|
127
|
+
autoFocus
|
|
128
|
+
/>
|
|
129
|
+
|
|
130
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 16 }}>
|
|
131
|
+
<Text style={[styles.footerText, { color: colors.text }]}>Forgot your password? </Text>
|
|
132
|
+
<TouchableOpacity onPress={() => navigate('RecoverAccount', {
|
|
133
|
+
returnTo: 'SignIn',
|
|
134
|
+
returnStep: 1,
|
|
135
|
+
returnData: { username, userProfile }
|
|
136
|
+
})}>
|
|
137
|
+
<Text style={[styles.modernLinkText, { color: colors.primary }]}>Recover your account</Text>
|
|
138
|
+
</TouchableOpacity>
|
|
139
|
+
</View>
|
|
140
|
+
</View>
|
|
141
|
+
|
|
142
|
+
<GroupedPillButtons
|
|
143
|
+
buttons={[
|
|
144
|
+
{
|
|
145
|
+
text: 'Back',
|
|
146
|
+
onPress: prevStep,
|
|
147
|
+
icon: 'arrow-back',
|
|
148
|
+
variant: 'transparent',
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
text: 'Sign In',
|
|
152
|
+
onPress: handleSignInSubmit,
|
|
153
|
+
icon: 'log-in',
|
|
154
|
+
variant: 'primary',
|
|
155
|
+
loading: isLoading,
|
|
156
|
+
testID: 'login-button',
|
|
157
|
+
},
|
|
158
|
+
]}
|
|
159
|
+
colors={colors}
|
|
160
|
+
/>
|
|
161
|
+
|
|
162
|
+
<View style={styles.securityNotice}>
|
|
163
|
+
<Ionicons name="shield-checkmark" size={14} color={colors.secondaryText} />
|
|
164
|
+
<Text style={[styles.securityText, { color: colors.secondaryText }]}>
|
|
165
|
+
Your data is encrypted and secure
|
|
166
|
+
</Text>
|
|
167
|
+
</View>
|
|
168
|
+
</>
|
|
169
|
+
);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export default SignInPasswordStep;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { useRef, useEffect } from 'react';
|
|
3
|
+
import { View, Text } from 'react-native';
|
|
4
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
5
|
+
import HighFive from '../../../assets/illustrations/HighFive';
|
|
6
|
+
import GroupedPillButtons from '../../components/internal/GroupedPillButtons';
|
|
7
|
+
import TextField from '../../components/internal/TextField';
|
|
8
|
+
|
|
9
|
+
interface SignInUsernameStepProps {
|
|
10
|
+
// Common props from StepBasedScreen
|
|
11
|
+
colors: any;
|
|
12
|
+
styles: any;
|
|
13
|
+
theme: string;
|
|
14
|
+
navigate: (screen: string, props?: Record<string, any>) => void;
|
|
15
|
+
|
|
16
|
+
// Step navigation
|
|
17
|
+
nextStep: () => void;
|
|
18
|
+
prevStep: () => void;
|
|
19
|
+
currentStep: number;
|
|
20
|
+
totalSteps: number;
|
|
21
|
+
|
|
22
|
+
// Data management
|
|
23
|
+
stepData?: any;
|
|
24
|
+
updateStepData: (data: any) => void;
|
|
25
|
+
allStepData: any[];
|
|
26
|
+
|
|
27
|
+
// Form state
|
|
28
|
+
username: string;
|
|
29
|
+
setUsername: (username: string) => void;
|
|
30
|
+
errorMessage: string;
|
|
31
|
+
setErrorMessage: (message: string) => void;
|
|
32
|
+
validationStatus: 'idle' | 'validating' | 'valid' | 'invalid';
|
|
33
|
+
userProfile: any;
|
|
34
|
+
isValidating: boolean;
|
|
35
|
+
|
|
36
|
+
// Add account mode
|
|
37
|
+
isAddAccountMode?: boolean;
|
|
38
|
+
user?: any;
|
|
39
|
+
|
|
40
|
+
// Validation function
|
|
41
|
+
validateUsername: (username: string) => Promise<boolean>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const SignInUsernameStep: React.FC<SignInUsernameStepProps> = ({
|
|
45
|
+
colors,
|
|
46
|
+
styles,
|
|
47
|
+
navigate,
|
|
48
|
+
nextStep,
|
|
49
|
+
username,
|
|
50
|
+
setUsername,
|
|
51
|
+
errorMessage,
|
|
52
|
+
setErrorMessage,
|
|
53
|
+
validationStatus,
|
|
54
|
+
userProfile,
|
|
55
|
+
isValidating,
|
|
56
|
+
isAddAccountMode,
|
|
57
|
+
user,
|
|
58
|
+
validateUsername,
|
|
59
|
+
}) => {
|
|
60
|
+
const inputRef = useRef<any>(null);
|
|
61
|
+
|
|
62
|
+
// Monitor username prop changes
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
console.log('👀 SignInUsernameStep username prop changed:', username);
|
|
65
|
+
}, [username]);
|
|
66
|
+
|
|
67
|
+
const handleUsernameChange = (text: string) => {
|
|
68
|
+
console.log('📝 Username input changed:', text);
|
|
69
|
+
setUsername(text);
|
|
70
|
+
if (errorMessage) setErrorMessage('');
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const handleContinue = async () => {
|
|
74
|
+
console.log('🚀 Continue button pressed, username:', username);
|
|
75
|
+
|
|
76
|
+
const trimmedUsername = username?.trim() || '';
|
|
77
|
+
|
|
78
|
+
if (!trimmedUsername) {
|
|
79
|
+
console.log('❌ Username is empty');
|
|
80
|
+
setErrorMessage('Please enter your username.');
|
|
81
|
+
setTimeout(() => inputRef.current?.focus(), 0);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (trimmedUsername.length < 2) {
|
|
86
|
+
console.log('❌ Username too short');
|
|
87
|
+
setErrorMessage('Username must be at least 3 characters.');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
console.log('🔍 Starting username validation...');
|
|
92
|
+
try {
|
|
93
|
+
// Validate the username before proceeding
|
|
94
|
+
const isValid = await validateUsername(trimmedUsername);
|
|
95
|
+
console.log('📊 Validation result:', isValid);
|
|
96
|
+
|
|
97
|
+
if (isValid) {
|
|
98
|
+
console.log('✅ Validation passed, proceeding to next step');
|
|
99
|
+
nextStep();
|
|
100
|
+
} else {
|
|
101
|
+
console.log('❌ Validation failed, staying on current step');
|
|
102
|
+
}
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.error('🚨 Error during validation:', error);
|
|
105
|
+
setErrorMessage('Unable to validate username. Please try again.');
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<>
|
|
111
|
+
<HighFive width={100} height={100} />
|
|
112
|
+
<View style={styles.modernHeader}>
|
|
113
|
+
<Text style={[styles.modernTitle, { color: colors.text }]}>
|
|
114
|
+
{isAddAccountMode ? 'Add Another Account' : 'Sign In'}
|
|
115
|
+
</Text>
|
|
116
|
+
<Text style={[styles.modernSubtitle, { color: colors.secondaryText }]}>
|
|
117
|
+
{isAddAccountMode
|
|
118
|
+
? 'Sign in with another account'
|
|
119
|
+
: 'Sign in to continue your journey'
|
|
120
|
+
}
|
|
121
|
+
</Text>
|
|
122
|
+
</View>
|
|
123
|
+
|
|
124
|
+
{isAddAccountMode && user && (
|
|
125
|
+
<View style={[styles.modernInfoCard, { backgroundColor: colors.inputBackground }]}>
|
|
126
|
+
<Ionicons name="information-circle" size={20} color={colors.primary} />
|
|
127
|
+
<Text style={[styles.modernInfoText, { color: colors.text }]}>
|
|
128
|
+
Currently signed in as <Text style={{ fontWeight: 'bold' }}>{user.username}</Text>
|
|
129
|
+
</Text>
|
|
130
|
+
</View>
|
|
131
|
+
)}
|
|
132
|
+
|
|
133
|
+
<View style={styles.modernInputContainer}>
|
|
134
|
+
<TextField
|
|
135
|
+
ref={inputRef}
|
|
136
|
+
label="Username"
|
|
137
|
+
leading={<Ionicons name="person-outline" size={24} color={colors.secondaryText} />}
|
|
138
|
+
value={username}
|
|
139
|
+
onChangeText={handleUsernameChange}
|
|
140
|
+
autoCapitalize="none"
|
|
141
|
+
autoCorrect={false}
|
|
142
|
+
testID="username-input"
|
|
143
|
+
variant="filled"
|
|
144
|
+
error={validationStatus === 'invalid' ? errorMessage : undefined}
|
|
145
|
+
loading={validationStatus === 'validating'}
|
|
146
|
+
success={validationStatus === 'valid'}
|
|
147
|
+
onSubmitEditing={() => handleContinue()}
|
|
148
|
+
autoFocus
|
|
149
|
+
/>
|
|
150
|
+
</View>
|
|
151
|
+
|
|
152
|
+
<GroupedPillButtons
|
|
153
|
+
buttons={[
|
|
154
|
+
{
|
|
155
|
+
text: 'Sign Up',
|
|
156
|
+
onPress: () => navigate('SignUp'),
|
|
157
|
+
icon: 'person-add',
|
|
158
|
+
variant: 'transparent',
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
text: 'Continue',
|
|
162
|
+
onPress: handleContinue,
|
|
163
|
+
icon: 'arrow-forward',
|
|
164
|
+
variant: 'primary',
|
|
165
|
+
loading: isValidating,
|
|
166
|
+
disabled: !username || username.trim().length < 2 || isValidating,
|
|
167
|
+
testID: 'username-next-button',
|
|
168
|
+
},
|
|
169
|
+
]}
|
|
170
|
+
colors={colors}
|
|
171
|
+
/>
|
|
172
|
+
</>
|
|
173
|
+
);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export default SignInUsernameStep;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { useRef, useState, useEffect, useCallback } from 'react';
|
|
3
|
+
import { View, Text } from 'react-native';
|
|
4
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
5
|
+
import GroupedPillButtons from '../../components/internal/GroupedPillButtons';
|
|
6
|
+
import TextField from '../../components/internal/TextField';
|
|
7
|
+
|
|
8
|
+
interface SignUpIdentityStepProps {
|
|
9
|
+
// Common props from StepBasedScreen
|
|
10
|
+
colors: any;
|
|
11
|
+
styles: any;
|
|
12
|
+
theme: string;
|
|
13
|
+
navigate: (screen: string, props?: Record<string, any>) => void;
|
|
14
|
+
|
|
15
|
+
// Step navigation
|
|
16
|
+
nextStep: () => void;
|
|
17
|
+
prevStep: () => void;
|
|
18
|
+
currentStep: number;
|
|
19
|
+
totalSteps: number;
|
|
20
|
+
|
|
21
|
+
// Data management
|
|
22
|
+
stepData?: any;
|
|
23
|
+
updateStepData: (data: any) => void;
|
|
24
|
+
|
|
25
|
+
// Form state
|
|
26
|
+
username: string;
|
|
27
|
+
email: string;
|
|
28
|
+
setUsername: (username: string) => void;
|
|
29
|
+
setEmail: (email: string) => void;
|
|
30
|
+
validationState: any;
|
|
31
|
+
setValidationState: (state: any) => void;
|
|
32
|
+
setErrorMessage: (message: string) => void;
|
|
33
|
+
|
|
34
|
+
// Validation
|
|
35
|
+
validateEmail: (email: string) => boolean;
|
|
36
|
+
validateUsername: (username: string) => Promise<boolean>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const SignUpIdentityStep: React.FC<SignUpIdentityStepProps> = ({
|
|
40
|
+
colors,
|
|
41
|
+
styles,
|
|
42
|
+
navigate,
|
|
43
|
+
nextStep,
|
|
44
|
+
prevStep,
|
|
45
|
+
username,
|
|
46
|
+
email,
|
|
47
|
+
setUsername,
|
|
48
|
+
setEmail,
|
|
49
|
+
validationState,
|
|
50
|
+
setValidationState,
|
|
51
|
+
setErrorMessage,
|
|
52
|
+
validateEmail,
|
|
53
|
+
validateUsername,
|
|
54
|
+
}) => {
|
|
55
|
+
const usernameRef = useRef<any>(null);
|
|
56
|
+
const validationTimeoutRef = useRef<NodeJS.Timeout | null>(null);
|
|
57
|
+
|
|
58
|
+
// Debounced username validation
|
|
59
|
+
const debouncedValidateUsername = useCallback((usernameToValidate: string) => {
|
|
60
|
+
if (validationTimeoutRef.current) {
|
|
61
|
+
clearTimeout(validationTimeoutRef.current);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
validationTimeoutRef.current = setTimeout(async () => {
|
|
65
|
+
if (usernameToValidate.trim().length >= 3) {
|
|
66
|
+
await validateUsername(usernameToValidate.trim());
|
|
67
|
+
}
|
|
68
|
+
}, 500);
|
|
69
|
+
}, [validateUsername]);
|
|
70
|
+
|
|
71
|
+
// Cleanup timeout on unmount
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
return () => {
|
|
74
|
+
if (validationTimeoutRef.current) {
|
|
75
|
+
clearTimeout(validationTimeoutRef.current);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}, []);
|
|
79
|
+
|
|
80
|
+
const handleUsernameChange = (text: string) => {
|
|
81
|
+
setUsername(text);
|
|
82
|
+
setErrorMessage('');
|
|
83
|
+
// Reset validation state when user types
|
|
84
|
+
if (validationState.status !== 'idle') {
|
|
85
|
+
setValidationState({ status: 'idle', message: '' });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Trigger debounced validation
|
|
89
|
+
debouncedValidateUsername(text);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const handleEmailChange = (text: string) => {
|
|
93
|
+
setEmail(text);
|
|
94
|
+
setErrorMessage('');
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const handleNext = async () => {
|
|
98
|
+
if (!username.trim()) {
|
|
99
|
+
setErrorMessage('Please enter a username');
|
|
100
|
+
setTimeout(() => usernameRef.current?.focus(), 0);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (username.trim().length < 3) {
|
|
105
|
+
setErrorMessage('Username must be at least 3 characters');
|
|
106
|
+
setTimeout(() => usernameRef.current?.focus(), 0);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (!email.trim()) {
|
|
111
|
+
setErrorMessage('Please enter an email address');
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (!validateEmail(email)) {
|
|
116
|
+
setErrorMessage('Please enter a valid email address');
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Validate username availability
|
|
121
|
+
const isUsernameValid = await validateUsername(username.trim());
|
|
122
|
+
if (!isUsernameValid) {
|
|
123
|
+
setTimeout(() => usernameRef.current?.focus(), 0);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
nextStep();
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const emailError = email && !validateEmail(email) ? 'Please enter a valid email address' : undefined;
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<>
|
|
134
|
+
<View style={styles.modernHeader}>
|
|
135
|
+
<Text style={[styles.modernTitle, { color: colors.text }]}>
|
|
136
|
+
Who are you?
|
|
137
|
+
</Text>
|
|
138
|
+
<Text style={[styles.modernSubtitle, { color: colors.secondaryText }]}>
|
|
139
|
+
Choose your username and enter your email
|
|
140
|
+
</Text>
|
|
141
|
+
</View>
|
|
142
|
+
|
|
143
|
+
<View style={styles.modernInputContainer}>
|
|
144
|
+
<TextField
|
|
145
|
+
ref={usernameRef}
|
|
146
|
+
label="Username"
|
|
147
|
+
leading={<Ionicons name="person-outline" size={24} color={colors.secondaryText} />}
|
|
148
|
+
value={username}
|
|
149
|
+
onChangeText={handleUsernameChange}
|
|
150
|
+
autoCapitalize="none"
|
|
151
|
+
autoCorrect={false}
|
|
152
|
+
testID="signup-username-input"
|
|
153
|
+
variant="filled"
|
|
154
|
+
error={validationState.status === 'invalid' ? validationState.message : undefined}
|
|
155
|
+
loading={validationState.status === 'validating'}
|
|
156
|
+
success={validationState.status === 'valid'}
|
|
157
|
+
onSubmitEditing={handleNext}
|
|
158
|
+
autoFocus
|
|
159
|
+
/>
|
|
160
|
+
|
|
161
|
+
<TextField
|
|
162
|
+
label="Email"
|
|
163
|
+
leading={<Ionicons name="mail-outline" size={24} color={colors.secondaryText} />}
|
|
164
|
+
value={email}
|
|
165
|
+
onChangeText={handleEmailChange}
|
|
166
|
+
keyboardType="email-address"
|
|
167
|
+
autoCapitalize="none"
|
|
168
|
+
autoCorrect={false}
|
|
169
|
+
testID="signup-email-input"
|
|
170
|
+
variant="filled"
|
|
171
|
+
error={emailError}
|
|
172
|
+
onSubmitEditing={handleNext}
|
|
173
|
+
/>
|
|
174
|
+
</View>
|
|
175
|
+
|
|
176
|
+
<GroupedPillButtons
|
|
177
|
+
buttons={[
|
|
178
|
+
{
|
|
179
|
+
text: 'Back',
|
|
180
|
+
onPress: prevStep,
|
|
181
|
+
icon: 'arrow-back',
|
|
182
|
+
variant: 'transparent',
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
text: 'Next',
|
|
186
|
+
onPress: handleNext,
|
|
187
|
+
icon: 'arrow-forward',
|
|
188
|
+
variant: 'primary',
|
|
189
|
+
loading: validationState.status === 'validating',
|
|
190
|
+
disabled: !username.trim() ||
|
|
191
|
+
username.trim().length < 3 ||
|
|
192
|
+
!email.trim() ||
|
|
193
|
+
!validateEmail(email) ||
|
|
194
|
+
validationState.status === 'validating' ||
|
|
195
|
+
validationState.status === 'invalid',
|
|
196
|
+
},
|
|
197
|
+
]}
|
|
198
|
+
colors={colors}
|
|
199
|
+
/>
|
|
200
|
+
</>
|
|
201
|
+
);
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export default SignUpIdentityStep;
|