From 25f44f98c4dc6338276f89a6abcf631cb6fd201e Mon Sep 17 00:00:00 2001 From: Agata Kosior Date: Fri, 28 Jun 2024 15:51:25 +0200 Subject: [PATCH 1/4] fix: show idology questions on failed KYC --- ios/Podfile.lock | 10 +++- src/components/SingleChoiceQuestion.tsx | 2 +- src/pages/EnablePayments/IdologyQuestions.tsx | 50 ++++++++++++------- .../PersonalInfo/PersonalInfo.tsx | 18 +++++-- 4 files changed, 54 insertions(+), 26 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 35dccc2de393..21cb4c952b0c 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1243,7 +1243,13 @@ PODS: - react-native-config (1.5.0): - react-native-config/App (= 1.5.0) - react-native-config/App (1.5.0): - - React-Core + - RCT-Folly + - RCTRequired + - RCTTypeSafety + - React + - React-Codegen + - React-RCTFabric + - ReactCommon/turbomodule/core - react-native-document-picker (9.1.1): - RCT-Folly - RCTRequired @@ -2552,7 +2558,7 @@ SPEC CHECKSUMS: react-native-airship: 38e2596999242b68c933959d6145512e77937ac0 react-native-blob-util: 1ddace5234c62e3e6e4e154d305ad07ef686599b react-native-cameraroll: f373bebbe9f6b7c3fd2a6f97c5171cda574cf957 - react-native-config: 5330c8258265c1e5fdb8c009d2cabd6badd96727 + react-native-config: 5ce986133b07fc258828b20b9506de0e683efc1c react-native-document-picker: 8532b8af7c2c930f9e202aac484ac785b0f4f809 react-native-geolocation: f9e92eb774cb30ac1e099f34b3a94f03b4db7eb3 react-native-image-picker: f8a13ff106bcc7eb00c71ce11fdc36aac2a44440 diff --git a/src/components/SingleChoiceQuestion.tsx b/src/components/SingleChoiceQuestion.tsx index c2dc72438e43..e52007850475 100644 --- a/src/components/SingleChoiceQuestion.tsx +++ b/src/components/SingleChoiceQuestion.tsx @@ -22,7 +22,7 @@ function SingleChoiceQuestion({prompt, errorText, possibleAnswers, currentQuesti <> {prompt} diff --git a/src/pages/EnablePayments/IdologyQuestions.tsx b/src/pages/EnablePayments/IdologyQuestions.tsx index 756965e961c8..b9b0ac4eca34 100644 --- a/src/pages/EnablePayments/IdologyQuestions.tsx +++ b/src/pages/EnablePayments/IdologyQuestions.tsx @@ -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'; @@ -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); @@ -103,13 +107,7 @@ function IdologyQuestions({questions, idNumber}: IdologyQuestionsProps) { return ( - {translate('additionalDetailsStep.helpTextIdologyQuestions')} - - {translate('additionalDetailsStep.helpLink')} - + {translate('additionalDetailsStep.helpTextIdologyQuestions')} - { - chooseAnswer(String(value)); - }} - onInputChange={() => {}} - /> + <> + { + chooseAnswer(String(value)); + }} + onInputChange={() => {}} + /> + + + + {translate('additionalDetailsStep.helpLink')} + + + ); diff --git a/src/pages/EnablePayments/PersonalInfo/PersonalInfo.tsx b/src/pages/EnablePayments/PersonalInfo/PersonalInfo.tsx index 0162fb311a19..de3e5f35093d 100644 --- a/src/pages/EnablePayments/PersonalInfo/PersonalInfo.tsx +++ b/src/pages/EnablePayments/PersonalInfo/PersonalInfo.tsx @@ -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'; @@ -102,11 +103,18 @@ function PersonalInfoPage({walletAdditionalDetails, walletAdditionalDetailsDraft stepNames={CONST.WALLET.STEP_NAMES} /> - + {walletAdditionalDetails?.questions && walletAdditionalDetails.questions.length > 0 ? ( + + ) : ( + + )} ); } From 423544d96694e9bff96f9f3266ccf0c5dd64e47e Mon Sep 17 00:00:00 2001 From: Agata Kosior Date: Fri, 28 Jun 2024 16:31:29 +0200 Subject: [PATCH 2/4] fix: go back to confirmation from idology questions --- src/pages/EnablePayments/EnablePayments.tsx | 2 +- .../PersonalInfo/PersonalInfo.tsx | 28 ++++++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/pages/EnablePayments/EnablePayments.tsx b/src/pages/EnablePayments/EnablePayments.tsx index 8bbf4d83726b..b8501551204a 100644 --- a/src/pages/EnablePayments/EnablePayments.tsx +++ b/src/pages/EnablePayments/EnablePayments.tsx @@ -40,7 +40,7 @@ function EnablePaymentsPage() { return ( <> Navigation.goBack(ROUTES.SETTINGS_WALLET)} /> diff --git a/src/pages/EnablePayments/PersonalInfo/PersonalInfo.tsx b/src/pages/EnablePayments/PersonalInfo/PersonalInfo.tsx index de3e5f35093d..8e684847ce39 100644 --- a/src/pages/EnablePayments/PersonalInfo/PersonalInfo.tsx +++ b/src/pages/EnablePayments/PersonalInfo/PersonalInfo.tsx @@ -1,4 +1,4 @@ -import React, {useMemo} from 'react'; +import React, {useEffect, useMemo, useState} from 'react'; import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; @@ -42,9 +42,25 @@ const bodyContent: Array> = [FullName, DateOfB function PersonalInfoPage({walletAdditionalDetails, walletAdditionalDetailsDraft}: PersonalInfoPageProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); + const [showIdologyQuestions, setShowIdologyQuestions] = useState(false); + + const hasIdologyQuestions = walletAdditionalDetails?.questions && walletAdditionalDetails?.questions.length > 0; + + useEffect(() => { + if (!hasIdologyQuestions) { + return; + } + if (hasIdologyQuestions) { + setShowIdologyQuestions(true); + } + }, [hasIdologyQuestions]); const values = useMemo(() => getSubstepValues(PERSONAL_INFO_STEP_KEYS, walletAdditionalDetailsDraft, walletAdditionalDetails), [walletAdditionalDetails, walletAdditionalDetailsDraft]); const submit = () => { + if (hasIdologyQuestions) { + setShowIdologyQuestions(true); + return; + } const personalDetails = { phoneNumber: (values.phoneNumber && parsePhoneNumber(values.phoneNumber, {regionCode: CONST.COUNTRY.US}).number?.significant) ?? '', legalFirstName: values?.[PERSONAL_INFO_STEP_KEYS.FIRST_NAME] ?? '', @@ -85,6 +101,10 @@ function PersonalInfoPage({walletAdditionalDetails, walletAdditionalDetailsDraft Wallet.updateCurrentStep(CONST.WALLET.STEP.ADD_BANK_ACCOUNT); return; } + if (showIdologyQuestions) { + setShowIdologyQuestions(false); + return; + } prevScreen(); }; @@ -103,10 +123,10 @@ function PersonalInfoPage({walletAdditionalDetails, walletAdditionalDetailsDraft stepNames={CONST.WALLET.STEP_NAMES} /> - {walletAdditionalDetails?.questions && walletAdditionalDetails.questions.length > 0 ? ( + {showIdologyQuestions && hasIdologyQuestions ? ( ) : ( Date: Fri, 28 Jun 2024 17:17:58 +0200 Subject: [PATCH 3/4] fix: questions flow fix --- .../PersonalInfo/PersonalInfo.tsx | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/pages/EnablePayments/PersonalInfo/PersonalInfo.tsx b/src/pages/EnablePayments/PersonalInfo/PersonalInfo.tsx index 8e684847ce39..55d369b4a2c5 100644 --- a/src/pages/EnablePayments/PersonalInfo/PersonalInfo.tsx +++ b/src/pages/EnablePayments/PersonalInfo/PersonalInfo.tsx @@ -1,4 +1,4 @@ -import React, {useEffect, useMemo, useState} from 'react'; +import React, {useMemo} from 'react'; import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; @@ -42,25 +42,10 @@ const bodyContent: Array> = [FullName, DateOfB function PersonalInfoPage({walletAdditionalDetails, walletAdditionalDetailsDraft}: PersonalInfoPageProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); - const [showIdologyQuestions, setShowIdologyQuestions] = useState(false); - - const hasIdologyQuestions = walletAdditionalDetails?.questions && walletAdditionalDetails?.questions.length > 0; - - useEffect(() => { - if (!hasIdologyQuestions) { - return; - } - if (hasIdologyQuestions) { - setShowIdologyQuestions(true); - } - }, [hasIdologyQuestions]); + const showIdologyQuestions = walletAdditionalDetails?.questions && walletAdditionalDetails?.questions.length > 0; const values = useMemo(() => getSubstepValues(PERSONAL_INFO_STEP_KEYS, walletAdditionalDetailsDraft, walletAdditionalDetails), [walletAdditionalDetails, walletAdditionalDetailsDraft]); const submit = () => { - if (hasIdologyQuestions) { - setShowIdologyQuestions(true); - return; - } const personalDetails = { phoneNumber: (values.phoneNumber && parsePhoneNumber(values.phoneNumber, {regionCode: CONST.COUNTRY.US}).number?.significant) ?? '', legalFirstName: values?.[PERSONAL_INFO_STEP_KEYS.FIRST_NAME] ?? '', @@ -102,7 +87,7 @@ function PersonalInfoPage({walletAdditionalDetails, walletAdditionalDetailsDraft return; } if (showIdologyQuestions) { - setShowIdologyQuestions(false); + Wallet.setAdditionalDetailsQuestions(null, ''); return; } prevScreen(); @@ -123,7 +108,7 @@ function PersonalInfoPage({walletAdditionalDetails, walletAdditionalDetailsDraft stepNames={CONST.WALLET.STEP_NAMES} /> - {showIdologyQuestions && hasIdologyQuestions ? ( + {showIdologyQuestions ? ( Date: Mon, 1 Jul 2024 07:58:57 +0200 Subject: [PATCH 4/4] fix: revert podfile changes --- ios/Podfile.lock | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 21cb4c952b0c..35dccc2de393 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1243,13 +1243,7 @@ PODS: - react-native-config (1.5.0): - react-native-config/App (= 1.5.0) - react-native-config/App (1.5.0): - - RCT-Folly - - RCTRequired - - RCTTypeSafety - - React - - React-Codegen - - React-RCTFabric - - ReactCommon/turbomodule/core + - React-Core - react-native-document-picker (9.1.1): - RCT-Folly - RCTRequired @@ -2558,7 +2552,7 @@ SPEC CHECKSUMS: react-native-airship: 38e2596999242b68c933959d6145512e77937ac0 react-native-blob-util: 1ddace5234c62e3e6e4e154d305ad07ef686599b react-native-cameraroll: f373bebbe9f6b7c3fd2a6f97c5171cda574cf957 - react-native-config: 5ce986133b07fc258828b20b9506de0e683efc1c + react-native-config: 5330c8258265c1e5fdb8c009d2cabd6badd96727 react-native-document-picker: 8532b8af7c2c930f9e202aac484ac785b0f4f809 react-native-geolocation: f9e92eb774cb30ac1e099f34b3a94f03b4db7eb3 react-native-image-picker: f8a13ff106bcc7eb00c71ce11fdc36aac2a44440