Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/SingleChoiceQuestion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function SingleChoiceQuestion({prompt, errorText, possibleAnswers, currentQuesti
<>
<Text
ref={ref}
style={[styles.textStrong, styles.mb5]}
style={[styles.mt3]}
>
{prompt}
</Text>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/EnablePayments/EnablePayments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function EnablePaymentsPage() {
return (
<>
<HeaderWithBackButton
title={translate('additionalDetailsStep.headerTitle')}
title={translate('personalInfoStep.personalInfo')}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WALLET)}
/>
<FailedKYC />
Expand Down
50 changes: 32 additions & 18 deletions src/pages/EnablePayments/IdologyQuestions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import {View} from 'react-native';
import FormProvider from '@components/Form/FormProvider';
import InputWrapper from '@components/Form/InputWrapper';
import type {FormInputErrors, FormOnyxValues} from '@components/Form/types';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import type {Choice} from '@components/RadioButtons';
import SingleChoiceQuestion from '@components/SingleChoiceQuestion';
import Text from '@components/Text';
import TextLink from '@components/TextLink';
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import * as BankAccounts from '@userActions/BankAccounts';
import CONST from '@src/CONST';
Expand All @@ -34,6 +37,7 @@ type Answer = {

function IdologyQuestions({questions, idNumber}: IdologyQuestionsProps) {
const styles = useThemeStyles();
const theme = useTheme();
const {translate} = useLocalize();

const [currentQuestionIndex, setCurrentQuestionIndex] = useState(0);
Expand Down Expand Up @@ -103,13 +107,7 @@ function IdologyQuestions({questions, idNumber}: IdologyQuestionsProps) {
return (
<View style={styles.flex1}>
<View style={styles.ph5}>
<Text style={styles.mb3}>{translate('additionalDetailsStep.helpTextIdologyQuestions')}</Text>
<TextLink
style={styles.mb3}
href={CONST.HELP_LINK_URL}
>
{translate('additionalDetailsStep.helpLink')}
</TextLink>
<Text style={[styles.textHeadlineLineHeightXXL, styles.mb3]}>{translate('additionalDetailsStep.helpTextIdologyQuestions')}</Text>
</View>
<FormProvider
formID={ONYXKEYS.FORMS.WALLET_ADDITIONAL_DETAILS}
Expand All @@ -121,17 +119,33 @@ function IdologyQuestions({questions, idNumber}: IdologyQuestionsProps) {
submitButtonText={translate('common.saveAndContinue')}
shouldHideFixErrorsAlert
>
<InputWrapper
InputComponent={SingleChoiceQuestion}
inputID="answer"
prompt={currentQuestion.prompt}
possibleAnswers={possibleAnswers}
currentQuestionIndex={currentQuestionIndex}
onValueChange={(value) => {
chooseAnswer(String(value));
}}
onInputChange={() => {}}
/>
<>
<InputWrapper
InputComponent={SingleChoiceQuestion}
inputID="answer"
prompt={currentQuestion.prompt}
possibleAnswers={possibleAnswers}
currentQuestionIndex={currentQuestionIndex}
onValueChange={(value) => {
chooseAnswer(String(value));
}}
onInputChange={() => {}}
/>
<View style={[styles.flexRow, styles.alignItemsCenter, styles.mt6]}>
<Icon
src={Expensicons.QuestionMark}
width={12}
height={12}
fill={theme.icon}
/>
<TextLink
style={[styles.textMicro, styles.ml2]}
href={CONST.HELP_LINK_URL}
>
{translate('additionalDetailsStep.helpLink')}
</TextLink>
</View>
</>
</FormProvider>
</View>
);
Expand Down
23 changes: 18 additions & 5 deletions src/pages/EnablePayments/PersonalInfo/PersonalInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import useSubStep from '@hooks/useSubStep';
import type {SubStepProps} from '@hooks/useSubStep/types';
import useThemeStyles from '@hooks/useThemeStyles';
import {parsePhoneNumber} from '@libs/PhoneNumber';
import IdologyQuestions from '@pages/EnablePayments/IdologyQuestions';
import getInitialSubstepForPersonalInfo from '@pages/EnablePayments/utils/getInitialSubstepForPersonalInfo';
import getSubstepValues from '@pages/EnablePayments/utils/getSubstepValues';
import * as Wallet from '@userActions/Wallet';
Expand Down Expand Up @@ -41,6 +42,7 @@ const bodyContent: Array<React.ComponentType<SubStepProps>> = [FullName, DateOfB
function PersonalInfoPage({walletAdditionalDetails, walletAdditionalDetailsDraft}: PersonalInfoPageProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const showIdologyQuestions = walletAdditionalDetails?.questions && walletAdditionalDetails?.questions.length > 0;

const values = useMemo(() => getSubstepValues(PERSONAL_INFO_STEP_KEYS, walletAdditionalDetailsDraft, walletAdditionalDetails), [walletAdditionalDetails, walletAdditionalDetailsDraft]);
const submit = () => {
Expand Down Expand Up @@ -84,6 +86,10 @@ function PersonalInfoPage({walletAdditionalDetails, walletAdditionalDetailsDraft
Wallet.updateCurrentStep(CONST.WALLET.STEP.ADD_BANK_ACCOUNT);
return;
}
if (showIdologyQuestions) {
Wallet.setAdditionalDetailsQuestions(null, '');
return;
}
prevScreen();
};

Expand All @@ -102,11 +108,18 @@ function PersonalInfoPage({walletAdditionalDetails, walletAdditionalDetailsDraft
stepNames={CONST.WALLET.STEP_NAMES}
/>
</View>
<SubStep
isEditing={isEditing}
onNext={nextScreen}
onMove={moveTo}
/>
{showIdologyQuestions ? (
<IdologyQuestions
questions={walletAdditionalDetails?.questions ?? []}
idNumber={walletAdditionalDetails?.idNumber ?? ''}
/>
) : (
<SubStep
isEditing={isEditing}
onNext={nextScreen}
onMove={moveTo}
/>
)}
</ScreenWrapper>
);
}
Expand Down