Skip to content

Commit

Permalink
Revert "yauheni/likhith/Combined/wall 400/idv error message handled" (#…
Browse files Browse the repository at this point in the history
…10497)

* Revert "yauheni/likhith/Combined/wall 400/idv error message handled (#8884)"

This reverts commit 164c4c7.

* Update common.type.ts

---------

Co-authored-by: vinu-deriv <100689171+vinu-deriv@users.noreply.github.com>
  • Loading branch information
sandeep-deriv and vinu-deriv committed Oct 5, 2023
1 parent 077cb5a commit 34d6a25
Show file tree
Hide file tree
Showing 55 changed files with 1,770 additions and 2,742 deletions.
1 change: 0 additions & 1 deletion packages/account/src/Assets/ic-poi-dob-example.svg

This file was deleted.

1 change: 0 additions & 1 deletion packages/account/src/Assets/ic-poi-name-example.svg

This file was deleted.

11 changes: 3 additions & 8 deletions packages/account/src/Components/form-body/form-body.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
import React from 'react';
import { ScrollbarsContainer } from '../scrollbars-container/scrollbars-container';
import { Div100vhContainer, DesktopWrapper, MobileWrapper } from '@deriv/components';
import classNames from 'classnames';

type TFormBody = {
scroll_offset?: string;
className?: string;
};

export const FormBody = ({ children, scroll_offset, className }: React.PropsWithChildren<TFormBody>) => (
export const FormBody = ({ children, scroll_offset }: React.PropsWithChildren<TFormBody>) => (
<React.Fragment>
<DesktopWrapper>
<ScrollbarsContainer
className={classNames('account__scrollbars_container--grid-layout', className)}
scroll_offset={scroll_offset}
>
<ScrollbarsContainer className='account__scrollbars_container--grid-layout' scroll_offset={scroll_offset}>
{children}
</ScrollbarsContainer>
</DesktopWrapper>
<MobileWrapper>
<Div100vhContainer
className={classNames('account__scrollbars_container--grid-layout', className)}
className='account__scrollbars_container--grid-layout'
height_offset={scroll_offset || '200px'}
>
{children}
Expand Down
120 changes: 0 additions & 120 deletions packages/account/src/Components/forms/__tests__/idv-form.spec.tsx

This file was deleted.

96 changes: 48 additions & 48 deletions packages/account/src/Components/forms/idv-form.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,35 @@
import React from 'react';
import classNames from 'classnames';
import { Field, FormikProps, FieldProps, useFormikContext } from 'formik';
import { ResidenceList } from '@deriv/api-types';
import { Autocomplete, DesktopWrapper, Input, MobileWrapper, SelectNative, Text } from '@deriv/components';
import { formatInput, getIDVNotApplicableOption } from '@deriv/shared';
import { Field, FieldProps } from 'formik';
import { localize } from '@deriv/translations';
import { formatInput, getIDVNotApplicableOption } from '@deriv/shared';
import { Autocomplete, DesktopWrapper, Input, MobileWrapper, SelectNative, Text } from '@deriv/components';
import {
getDocumentData,
preventEmptyClipboardPaste,
generatePlaceholderText,
getExampleFormat,
} from '../../Helpers/utils';
import { TDocument, TIDVFormValues } from '../../Types';

type TIDVFormProps = {
selected_country: ResidenceList[0];
hide_hint?: boolean;
class_name?: string;
can_skip_document_verification?: boolean;
};
import { TDocument, TIDVForm } from 'Types';

const IDVForm = ({
errors,
touched,
values,
handleBlur,
handleChange,
setFieldValue,
class_name,
selected_country,
hide_hint,
can_skip_document_verification = false,
}: TIDVFormProps) => {
const [document_list, setDocumentList] = React.useState<Array<TDocument>>([]);
}: TIDVForm) => {
const [document_list, setDocumentList] = React.useState<TDocument[]>([]);
const [document_image, setDocumentImage] = React.useState<string | null>(null);
const [selected_doc, setSelectedDoc] = React.useState('');

const { documents_supported: document_data, has_visual_sample } = selected_country?.identity?.services?.idv ?? {};

const { errors, touched, values, handleBlur, handleChange, setFieldValue }: FormikProps<TIDVFormValues> =
useFormikContext();
const default_document = {
id: '',
text: '',
Expand Down Expand Up @@ -97,12 +93,10 @@ const IDVForm = ({
};

const onKeyUp = (e: { target: HTMLInputElement }, document_name: string) => {
const example_format =
document_name === 'document_number'
? values?.document_type?.example_format
: values?.document_type?.additional?.example_format;
const { example_format } =
document_name === 'document_number' ? values.document_type : values.document_type.additional;
let current_input: string | null = null;
current_input = example_format?.includes('-')
current_input = example_format.includes('-')
? formatInput(example_format, current_input ?? e.target.value, '-')
: e.target.value;
setFieldValue(document_name, current_input, true);
Expand Down Expand Up @@ -141,32 +135,38 @@ const IDVForm = ({
{({ field }: FieldProps) => (
<React.Fragment>
<DesktopWrapper>
<Autocomplete
{...field}
data-lpignore='true'
error={touched.document_type && errors.document_type}
autoComplete='off'
type='text'
label={localize('Choose the document type')}
list_items={document_list}
value={values.document_type.text}
onBlur={(e: { target: HTMLInputElement }) => {
handleBlur(e);
if (!getDocument(e.target.value)) {
resetDocumentItemSelected();
}
}}
onChange={handleChange}
onItemSelection={(item: TDocument) => {
if (item.text === 'No results found' || !item.text) {
setSelectedDoc('');
resetDocumentItemSelected();
} else {
bindDocumentData(item);
}
}}
required
/>
<div className='document-dropdown'>
<Autocomplete
{...field}
name='document_type'
data-lpignore='true'
error={touched.document_type && errors.document_type}
autoComplete='off'
type='text'
label={localize('Choose the document type')}
list_items={document_list}
value={values.document_type.text}
onBlur={(e: { target: HTMLInputElement }) => {
handleBlur(e);
if (!getDocument(e.target.value)) {
resetDocumentItemSelected();
}
}}
onChange={handleChange}
onItemSelection={(item: TDocument) => {
if (
item.text === 'No results found' ||
!item.text
) {
setSelectedDoc('');
resetDocumentItemSelected();
} else {
bindDocumentData(item);
}
}}
required
/>
</div>
</DesktopWrapper>
<MobileWrapper>
<SelectNative
Expand All @@ -193,7 +193,7 @@ const IDVForm = ({
)}
</Field>
</fieldset>
{values?.document_type?.id !== IDV_NOT_APPLICABLE_OPTION.id && (
{values.document_type.id !== IDV_NOT_APPLICABLE_OPTION.id && (
<fieldset
className={classNames({
'proof-of-identity__fieldset-input': !hide_hint,
Expand Down
Loading

1 comment on commit 34d6a25

@vercel
Copy link

@vercel vercel bot commented on 34d6a25 Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

deriv-app – ./

deriv-app.vercel.app
binary.sx
deriv-app.binary.sx
deriv-app-git-master.binary.sx

Please sign in to comment.