Skip to content

Commit 70e0ffe

Browse files
committed
Merge remote-tracking branch 'upstream/master' into p2p-refactor
2 parents 48de879 + 3fe4a5c commit 70e0ffe

File tree

180 files changed

+2886
-1335
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+2886
-1335
lines changed

package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/account/src/Components/forms/idv-form.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ import { Field, FieldProps } from 'formik';
44
import { localize } from '@deriv/translations';
55
import { formatInput, getIDVNotApplicableOption } from '@deriv/shared';
66
import { Autocomplete, DesktopWrapper, Input, MobileWrapper, SelectNative, Text } from '@deriv/components';
7-
import { getDocumentData, preventEmptyClipboardPaste, generatePlaceholderText, getExampleFormat } from 'Helpers/utils';
8-
import { TDocumentList, TIDVForm } from 'Types';
7+
import {
8+
getDocumentData,
9+
preventEmptyClipboardPaste,
10+
generatePlaceholderText,
11+
getExampleFormat,
12+
} from '../../Helpers/utils';
13+
import { TDocument, TIDVForm } from 'Types';
914

1015
const IDVForm = ({
1116
errors,
@@ -19,7 +24,7 @@ const IDVForm = ({
1924
hide_hint,
2025
can_skip_document_verification = false,
2126
}: TIDVForm) => {
22-
const [document_list, setDocumentList] = React.useState<TDocumentList[]>([]);
27+
const [document_list, setDocumentList] = React.useState<TDocument[]>([]);
2328
const [document_image, setDocumentImage] = React.useState<string | null>(null);
2429
const [selected_doc, setSelectedDoc] = React.useState('');
2530

@@ -45,10 +50,8 @@ const IDVForm = ({
4550

4651
const new_document_list = filtered_documents.map(key => {
4752
const { display_name, format } = document_data[key];
48-
const { new_display_name, example_format, sample_image } = getDocumentData(
49-
selected_country.value ?? '',
50-
key
51-
);
53+
const { new_display_name, example_format, sample_image, additional_document_example_format } =
54+
getDocumentData(selected_country.value ?? '', key);
5255
const needs_additional_document = !!document_data[key].additional;
5356

5457
if (needs_additional_document) {
@@ -58,6 +61,7 @@ const IDVForm = ({
5861
additional: {
5962
display_name: document_data[key].additional?.display_name,
6063
format: document_data[key].additional?.format,
64+
example_format: additional_document_example_format,
6165
},
6266
value: format,
6367
sample_image,
@@ -98,7 +102,7 @@ const IDVForm = ({
98102
setFieldValue(document_name, current_input, true);
99103
};
100104

101-
const bindDocumentData = (item: TDocumentList) => {
105+
const bindDocumentData = (item: TDocument) => {
102106
setFieldValue('document_type', item, true);
103107
setSelectedDoc(item?.id);
104108
if (item?.id === IDV_NOT_APPLICABLE_OPTION.id) {
@@ -221,6 +225,7 @@ const IDVForm = ({
221225
onKeyUp={(e: { target: HTMLInputElement }) =>
222226
onKeyUp(e, 'document_number')
223227
}
228+
className='additional-field'
224229
required
225230
label={generatePlaceholderText(selected_doc)}
226231
/>

packages/account/src/Components/forms/personal-details-form.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
2-
import { Link } from 'react-router-dom';
32
import classNames from 'classnames';
43
import { Field, useFormikContext } from 'formik';
4+
import { Link } from 'react-router-dom';
55
import {
66
Autocomplete,
77
Checkbox,
@@ -15,13 +15,13 @@ import {
1515
} from '@deriv/components';
1616
import { getLegalEntityName, isDesktop, isMobile, routes, validPhone } from '@deriv/shared';
1717
import { Localize, localize } from '@deriv/translations';
18-
import InlineNoteWithIcon from '../inline-note-with-icon';
19-
import { DateOfBirthField, FormInputField } from './form-fields.jsx';
20-
import FormBodySection from '../form-body-section';
2118
import FormSubHeader from '../form-sub-header';
2219
import PoiNameDobExample from '../../Assets/ic-poi-name-dob-example.svg';
23-
import { isFieldImmutable } from '../../Helpers/utils';
20+
import InlineNoteWithIcon from '../inline-note-with-icon';
21+
import FormBodySection from '../form-body-section';
22+
import { DateOfBirthField, FormInputField } from './form-fields.jsx';
2423
import { getEmploymentStatusList } from '../../Sections/Assessment/FinancialAssessment/financial-information-list';
24+
import { isFieldImmutable } from '../../Helpers/utils';
2525

2626
const PersonalDetailsForm = props => {
2727
const {

packages/account/src/Components/poa/poa-button/__tests__/poa-button.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createBrowserHistory } from 'history';
33
import { Router } from 'react-router';
44
import { fireEvent, render, screen } from '@testing-library/react';
55
import { routes } from '@deriv/shared';
6-
import { PoaButton } from '../poa-button';
6+
import PoaButton from '../poa-button';
77

88
describe('<PoaButton/>', () => {
99
const history = createBrowserHistory();
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import { PoaButton } from './poa-button';
1+
import PoaButton from './poa-button';
22

33
export default PoaButton;

packages/account/src/Components/poa/poa-button/poa-button.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ type TPoaButton = {
77
custom_text?: string;
88
};
99

10-
export const PoaButton = ({ custom_text = localize('Submit proof of address') }: TPoaButton) => (
10+
const PoaButton = ({ custom_text = localize('Submit proof of address') }: TPoaButton) => (
1111
<ButtonLink className='account-management__button' to={routes.proof_of_address}>
1212
<Text className='dc-btn__text' as='p' weight='bold' data-testid='poa_button_text'>
1313
{custom_text}
1414
</Text>
1515
</ButtonLink>
1616
);
17+
18+
export default PoaButton;

packages/account/src/Components/poi-unsupported-failed/unsupported-failed.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { Icon } from '@deriv/components';
33
import { localize } from '@deriv/translations';
4-
import IconMessageContent from 'Components/icon-message-content';
4+
import IconMessageContent from '../icon-message-content';
55

66
type TUnsupportedFailed = {
77
error?: string;

packages/account/src/Components/poi/idv-document-submit/idv-document-submit.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,21 @@ import {
1212
removeEmptyPropertiesFromObject,
1313
formatIDVFormValues,
1414
} from '@deriv/shared';
15-
import { documentAdditionalError, getRegex, validate, makeSettingsRequest, validateName } from 'Helpers/utils';
15+
import {
16+
documentAdditionalError,
17+
getRegex,
18+
validate,
19+
makeSettingsRequest,
20+
validateName,
21+
getExampleFormat,
22+
} from 'Helpers/utils';
1623
import FormFooter from 'Components/form-footer';
1724
import BackButtonIcon from 'Assets/ic-poi-back-btn.svg';
1825
import IDVForm from 'Components/forms/idv-form';
1926
import PersonalDetailsForm from 'Components/forms/personal-details-form';
2027
import FormSubHeader from 'Components/form-sub-header';
21-
import { GetSettings, IdentityVerificationAddDocumentResponse, ResidenceList } from '@deriv/api-types';
22-
import { TIDVFormValues, TInputFieldValues, TDocumentList } from 'Types';
28+
import { GetSettings, ResidenceList, IdentityVerificationAddDocumentResponse } from '@deriv/api-types';
29+
import { TDocument, TInputFieldValues, TIDVFormValues } from 'Types';
2330

2431
type TIDVDocumentSubmitProps = {
2532
account_settings: GetSettings;
@@ -58,29 +65,26 @@ const IdvDocumentSubmit = ({
5865
...form_initial_values,
5966
};
6067

61-
const getExampleFormat = (example_format: string) => {
62-
return example_format ? localize('Example: ') + example_format : '';
63-
};
6468
const IDV_NOT_APPLICABLE_OPTION = React.useMemo(() => getIDVNotApplicableOption(), []);
6569

6670
const shouldHideHelperImage = (document_id: string) => document_id === IDV_NOT_APPLICABLE_OPTION.id;
6771

68-
const isDocumentTypeValid = (document_type: TDocumentList) => {
72+
const isDocumentTypeValid = (document_type: TDocument) => {
6973
if (!document_type?.text) {
7074
return localize('Please select a document type.');
7175
}
7276
return undefined;
7377
};
7478

75-
const isAdditionalDocumentValid = (document_type: TDocumentList, document_additional: string) => {
79+
const isAdditionalDocumentValid = (document_type: TDocument, document_additional: string) => {
7680
const error_message = documentAdditionalError(document_additional, document_type.additional?.format);
7781
if (error_message) {
7882
return localize(error_message) + getExampleFormat(document_type.additional?.example_format);
7983
}
8084
return undefined;
8185
};
8286

83-
const isDocumentNumberValid = (document_number: string, document_type: Required<TDocumentList>) => {
87+
const isDocumentNumberValid = (document_number: string, document_type: Required<TDocument>) => {
8488
const is_document_number_invalid = document_number === document_type.example_format;
8589
if (!document_number) {
8690
return localize('Please enter your document number. ') + getExampleFormat(document_type.example_format);

packages/account/src/Components/poi/idv-status/idv-submit-complete/__tests__/idv-submit-complete.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { BrowserRouter } from 'react-router-dom';
33
import { render, screen } from '@testing-library/react';
44
import IdvSubmitComplete from '../idv-submit-complete';
55

6-
jest.mock('Assets/ic-idv-document-pending.svg', () => jest.fn(() => 'IdvDocumentPending'));
6+
jest.mock('../../../../../Assets/ic-idv-document-pending.svg', () => jest.fn(() => 'IdvDocumentPending'));
77

88
describe('<IdvSubmitComplete/>', () => {
99
const mock_props = {

packages/account/src/Components/poi/idv-status/idv-submit-complete/idv-submit-complete.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import IdvDocumentPending from 'Assets/ic-idv-document-pending.svg';
2-
import PoaButton from 'Components/poa/poa-button';
1+
import IdvDocumentPending from '../../../../Assets/ic-idv-document-pending.svg';
2+
import PoaButton from '../../../poa/poa-button/poa-button';
33
import React from 'react';
44
import { Text } from '@deriv/components';
55
import { localize } from '@deriv/translations';

0 commit comments

Comments
 (0)