Skip to content

Commit

Permalink
chore: resolved conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeep-deriv committed Jan 12, 2023
2 parents 82cc57d + 5a902f7 commit 981c218
Show file tree
Hide file tree
Showing 70 changed files with 1,646 additions and 2,719 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const AddressDetails = ({
validate,
onSubmit,
is_svg,
is_mf,
is_gb_residence,
onSubmitEnabledChange,
selected_step_ref,
Expand Down Expand Up @@ -149,9 +150,9 @@ const AddressDetails = ({
<div className='details-form__elements'>
<InputField
name='address_line_1'
required={is_svg || is_appstore}
required={is_svg || is_appstore || is_mf}
label={
is_svg || is_appstore
is_svg || is_appstore || is_mf
? localize('First line of address*')
: localize('First line of address')
}
Expand All @@ -171,9 +172,11 @@ const AddressDetails = ({
/>
<InputField
name='address_city'
required={is_svg || is_appstore}
required={is_svg || is_appstore || is_mf}
label={
is_svg || is_appstore ? localize('Town/City*') : localize('Town/City')
is_svg || is_appstore || is_mf
? localize('Town/City*')
: localize('Town/City')
}
placeholder={localize('Town/City')}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ describe('<Submitted />', () => {

it('should render the Submitted component', () => {
renderWithRouter(<Submitted needs_poi />);
expect(screen.getByText('Your proof of address was submitted successfully')).toBeInTheDocument();
expect(screen.getByText('Your documents were submitted successfully')).toBeInTheDocument();
});

it('should show submit_poi message if needs_poi is true', () => {
renderWithRouter(<Submitted needs_poi />);
expect(screen.getByText('You must also submit a proof of identity.')).toBeInTheDocument();
});

it('should show review message if needs_poi is false', () => {
it('should show review message if needs_poi is true', () => {
renderWithRouter(<Submitted needs_poi />);
expect(screen.getByText('Your document is being reviewed, please check back in 1-3 days.')).toBeInTheDocument();
expect(
screen.getByText('We’ll review your documents and notify you of its status within 1 to 3 days.')
).toBeInTheDocument();
});

it('should show ContinueTradingButton if needs_poi is false and is_description_enabled is false', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import IconMessageContent from 'Components/icon-message-content';

export const Submitted = ({ needs_poi, is_description_enabled = true }: TPoaStatusProps) => {
const { is_appstore }: TPlatformContext = React.useContext(PlatformContext);
const message = localize('Your proof of address was submitted successfully');
const message = localize('Your documents were submitted successfully');
if (needs_poi) {
return (
<div
Expand All @@ -25,7 +25,7 @@ export const Submitted = ({ needs_poi, is_description_enabled = true }: TPoaStat
>
<div className='account-management__text-container'>
<Text align='center' size='xs' as='p'>
{localize('Your document is being reviewed, please check back in 1-3 days.')}
{localize('We’ll review your documents and notify you of its status within 1 to 3 days.')}
</Text>
<Text align='center' size='xs' as='p'>
{localize('You must also submit a proof of identity.')}
Expand All @@ -44,7 +44,7 @@ export const Submitted = ({ needs_poi, is_description_enabled = true }: TPoaStat
>
<IconMessageContent
message={message}
text={localize('Your document is being reviewed, please check back in 1-3 days.')}
text={localize('We’ll review your documents and notify you of its status within 1 to 3 days.')}
icon={<Icon icon='IcPoaVerified' size={128} />}
full_width={is_appstore}
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,59 @@
import React from 'react';
import { Button, Icon } from '@deriv/components';
import { Button, Icon, Loading } from '@deriv/components';
import { localize } from '@deriv/translations';
import { getAuthenticationStatusInfo } from '@deriv/shared';

import IconMessageContent from 'Components/icon-message-content';

const PoiPoaDocsSubmitted = ({ account_status, is_vanuatu_selected, onClickOK, updateAccountStatus }) => {
const PoiPoaDocsSubmitted = ({
account_status,
jurisdiction_selected_shortcode,
onClickOK,
updateAccountStatus,
has_created_account_for_selected_jurisdiction,
openPasswordModal,
}) => {
const [is_loading, setIsLoading] = React.useState(false);
React.useEffect(() => {
updateAccountStatus();
setIsLoading(true);
updateAccountStatus()
.then(() => {
setIsLoading(false);
})
.finally(() => setIsLoading(false));
//eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const message = localize('Your documents were submitted successfully');
const onSubmit = () => {
onClickOK();
if (!has_created_account_for_selected_jurisdiction) {
openPasswordModal();
}
};

const getDescription = () => {
const { manual_status, poi_verified_for_vanuatu, poi_verified_for_bvi_labuan_maltainvest, poa_pending } =
const { manual_status, poi_verified_for_vanuatu_maltainvest, poi_verified_for_bvi_labuan, poa_pending } =
getAuthenticationStatusInfo(account_status);

const is_vanuatu_or_maltainvest_selected =
jurisdiction_selected_shortcode === 'vanuatu' || jurisdiction_selected_shortcode === 'maltainvest';
if (
(is_vanuatu_selected && poi_verified_for_vanuatu && poa_pending) ||
(!is_vanuatu_selected && poi_verified_for_bvi_labuan_maltainvest && poa_pending) ||
(is_vanuatu_or_maltainvest_selected && poi_verified_for_vanuatu_maltainvest && poa_pending) ||
(!is_vanuatu_or_maltainvest_selected && poi_verified_for_bvi_labuan && poa_pending) ||
manual_status === 'pending'
) {
return localize('We’ll review your documents and notify you of its status within 1 - 3 working days.');
}
return localize('We’ll review your documents and notify you of its status within 5 minutes.');
};

return (
return is_loading ? (
<Loading is_fullscreen={false} />
) : (
<IconMessageContent
message={message}
message={localize('Your documents were submitted successfully')}
text={getDescription()}
icon={<Icon icon='IcDocsSubmit' size={128} />}
className='poi-poa-submitted'
>
<Button has_effect text={localize('OK')} onClick={onClickOK} primary />
<Button has_effect text={localize('Ok')} onClick={onSubmit} primary />
</IconMessageContent>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ describe('<IdvSubmitComplete/>', () => {

const commonRenderCheck = () => {
expect(screen.getByText('IdvDocumentPending')).toBeInTheDocument();
expect(screen.getByText('Your ID number was submitted successfully')).toBeInTheDocument();
expect(screen.getByText('Your documents were submitted successfully')).toBeInTheDocument();
expect(
screen.getByText("We'll process your details within a few minutes and notify its status via email.")
screen.getByText('We’ll review your documents and notify you of its status within 5 minutes.')
).toBeInTheDocument();
};
it('should render IdvSubmitComplete component not external, no needs_poa', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const IdvSubmitComplete = ({ needs_poa, is_from_external }) => {
<div className='proof-of-identity__container'>
<IdvDocumentPending className='icon' />
<Text className='proof-of-identity__text btm-spacer' align='center' weight='bold'>
{localize('Your ID number was submitted successfully')}
{localize('Your documents were submitted successfully')}
</Text>
<Text className='proof-of-identity__text text' size='xs' align='center'>
{localize("We'll process your details within a few minutes and notify its status via email.")}
{localize('We’ll review your documents and notify you of its status within 5 minutes.')}
</Text>
{!!needs_poa && (
<React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const Uploader = ({ data, value, is_full, onChange, has_frame }) => {

const ValidationErrorMessage = open => (
<div className={`${ROOT_CLASS}__uploader-details`}>
{image.errors.map((error, index) => (
{image.errors?.map((error, index) => (
<Text key={index} as='p' size='xs' color='secondary' align='center'>
{error}
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const DetailComponent = ({
case STATUS.IS_UPLOADING:
return <Loading is_fullscreen={false} is_slow_loading status={[localize('Uploading documents')]} />;
case STATUS.IS_COMPLETED:
return <UploadComplete is_from_external={true} needs_poa={false} />;
return <UploadComplete is_from_external={true} needs_poa={false} is_manual_upload />;
case STATUS.IS_FAILED:
return <PoiUnsupportedFailed error={response_error} />;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Unsupported = ({ country_code, handlePOIforMT5Complete, ...props }) => {
country_code,
});

if (props?.manual?.status === identity_status_codes.pending) return <UploadComplete />;
if (props?.manual?.status === identity_status_codes.pending) return <UploadComplete is_manual_upload />;

if (detail !== null) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ jest.mock('@deriv/components', () => {
});

describe('<UploadComplete />', () => {
const successful_upload_message = /your proof of identity was submitted successfully/i;
const poi_under_review_message = /We’ll review your document and notify you of its status within 1-3 days./i;
const successful_upload_message = /your documents were submitted successfully/i;
const poi_under_review_message = /We’ll review your documents and notify you of its status within 5 minutes./i;
const poi_under_review_message_for_manual =
/We’ll review your documents and notify you of its status within 1 - 3 working days./i;
const redirect_button = <Button>Lorem Ipsom</Button>;
const poa_under_review_message = /your document is being reviewed, please check back in 1-3 days./i;
const needs_poa_extra_submit_message = /you must also submit a proof of address./i;

const renderWithRouter = (component, is_appstore) =>
Expand All @@ -35,11 +36,19 @@ describe('<UploadComplete />', () => {
expect(screen.getByTestId(/dt_mocked_icon/)).toBeInTheDocument();
});

it('should render <UploadComplete /> component and is_appstore is true', () => {
renderWithRouter(<UploadComplete />, true);
it('should render <UploadComplete /> component for manual upload', () => {
renderWithRouter(<UploadComplete is_manual_upload />, true);

expect(screen.getByText(successful_upload_message)).toBeInTheDocument();
expect(screen.getByText(poi_under_review_message)).toBeInTheDocument();
expect(screen.getByText(poi_under_review_message_for_manual)).toBeInTheDocument();
expect(screen.getByTestId(/dt_mocked_icon/i)).toBeInTheDocument();
expect(screen.queryByRole('button')).not.toBeInTheDocument();
});
it('should render <UploadComplete /> component for manual upload', () => {
renderWithRouter(<UploadComplete is_manual_upload />, true);

expect(screen.getByText(successful_upload_message)).toBeInTheDocument();
expect(screen.getByText(poi_under_review_message_for_manual)).toBeInTheDocument();
expect(screen.getByTestId(/dt_mocked_icon/i)).toBeInTheDocument();
expect(screen.queryByRole('button')).not.toBeInTheDocument();
});
Expand All @@ -60,7 +69,7 @@ describe('<UploadComplete />', () => {
renderWithRouter(<UploadComplete needs_poa redirect_button={redirect_button} />, true);

expect(screen.getByTestId('dt_poa_button')).toBeInTheDocument();
expect(screen.getByText(poa_under_review_message)).toBeInTheDocument();
expect(screen.getByText(poi_under_review_message)).toBeInTheDocument();
expect(screen.getByText(needs_poa_extra_submit_message)).toBeInTheDocument();
expect(screen.getByRole('button')).toBeInTheDocument();
});
Expand All @@ -69,7 +78,7 @@ describe('<UploadComplete />', () => {
renderWithRouter(<UploadComplete needs_poa is_from_external redirect_button={redirect_button} />, true);

expect(screen.getByTestId('dt_poa_button')).toBeInTheDocument();
expect(screen.getByText(poa_under_review_message)).toBeInTheDocument();
expect(screen.getByText(poi_under_review_message)).toBeInTheDocument();
expect(screen.getByText(needs_poa_extra_submit_message)).toBeInTheDocument();
expect(screen.queryByRole('button')).not.toBeInTheDocument();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ import PoaButton from 'Components/poa/poa-button';
import { ContinueTradingButton } from 'Components/poa/continue-trading-button/continue-trading-button';
import IconMessageContent from 'Components/icon-message-content';

export const UploadComplete = ({ needs_poa, redirect_button, is_from_external }) => {
export const UploadComplete = ({ needs_poa, redirect_button, is_from_external, is_manual_upload = false }) => {
const { is_appstore } = React.useContext(PlatformContext);
const message = localize('Your proof of identity was submitted successfully');
const message = localize('Your documents were submitted successfully');
const description = is_manual_upload
? localize('We’ll review your documents and notify you of its status within 1 - 3 working days.')
: localize('We’ll review your documents and notify you of its status within 5 minutes.');

if (!needs_poa) {
return (
<IconMessageContent
message={message}
text={localize('We’ll review your document and notify you of its status within 1-3 days.')}
text={description}
icon={
is_appstore ? (
<Icon icon='IcPoiVerifiedDashboard' width={273} height={128} />
Expand Down Expand Up @@ -43,7 +47,7 @@ export const UploadComplete = ({ needs_poa, redirect_button, is_from_external })
<React.Fragment>
<div className='account-management__text-container'>
<Text align='center' size='xs' as={is_appstore ? 'span' : 'p'}>
{localize('Your document is being reviewed, please check back in 1-3 days.')}
{description}
</Text>
<Text align='center' size='xs' as={is_appstore ? 'span' : 'p'}>
{localize('You must also submit a proof of address.')}
Expand Down
3 changes: 3 additions & 0 deletions packages/account/src/Configs/address-details-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ const addressDetailsConfig = (
) => {
const is_svg = upgrade_info?.can_upgrade_to === 'svg';
const config = address_details_config({ account_settings, is_svg });
const is_mf = real_account_signup_target === 'maltainvest';

return {
header: {
active_title: is_appstore ? localize('Where do you live?') : localize('Complete your address details'),
Expand All @@ -150,6 +152,7 @@ const addressDetailsConfig = (
transformConfig(transformForResidence(config, residence), real_account_signup_target)
),
is_svg,
is_mf,
},
passthrough: ['residence_list', 'is_fully_authenticated'],
icon: 'IcDashboardAddress',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
import React from 'react';
import { Icon, Loading, Text } from '@deriv/components';
import { WS, isMobile } from '@deriv/shared';
import { Loading } from '@deriv/components';
import { WS } from '@deriv/shared';
import { localize } from '@deriv/translations';
import ErrorMessage from 'Components/error-component';
import IconWithMessage from 'Components/icon-with-message';
import POISubmissionForMT5 from './proof-of-identity-submission-for-mt5.jsx';
import { service_code } from './proof-of-identity-utils';
import { populateVerificationStatus } from '../Helpers/verification';

const ShowDemoMessage = () => (
<div className='da-icon-with-message'>
<Icon icon={'IcPoaLock'} size={128} />
<Text
className='da-icon-with-message__text'
as='p'
color='general'
size={isMobile ? 'xs' : 's'}
line_height='m'
weight='bold'
>
{localize('Switch to your real account to create a Deriv MT5 account')}
</Text>
</div>
);
const ProofOfIdentityContainerForMt5 = ({
account_status,
fetchResidenceList,
Expand Down Expand Up @@ -62,7 +48,13 @@ const ProofOfIdentityContainerForMt5 = ({
if (is_status_loading || is_switching) {
return <Loading is_fullscreen={false} />;
} else if (is_virtual) {
return <ShowDemoMessage />;
return (
<IconWithMessage
icon='IcPoaVerified'
message={localize('Switch to your real account to submit your documents')}
has_button
/>
);
} else if (api_error) {
return <ErrorMessage error_message={api_error?.message || api_error} />;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ const ProofOfIdentityContainer = ({
is_from_external={!!is_from_external}
needs_poa={needs_poa}
redirect_button={redirect_button}
is_manual_upload={manual?.status === 'pending'}
/>
);
case identity_status_codes.verified:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ const POISubmission = ({
);
// This will be replaced in the next Manual Upload Project
case service_code.manual:
return (
<UploadComplete
is_from_external={is_from_external}
needs_poa={needs_poa}
redirect_button={redirect_button}
is_manual_upload
/>
);
case service_code.onfido:
return (
<UploadComplete
Expand Down
Loading

0 comments on commit 981c218

Please sign in to comment.