Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed redirection back to dp2p #7609

Merged
merged 21 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from 14 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
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import IdvDocumentPending from 'Assets/ic-idv-document-pending.svg';
type TIdvSubmitComplete = {
needs_poa: boolean;
is_from_external: boolean;
redirect_button: React.ReactElement;
};

const IdvSubmitComplete = ({ needs_poa, is_from_external }: TIdvSubmitComplete) => {
const IdvSubmitComplete = ({ needs_poa, is_from_external, redirect_button }: TIdvSubmitComplete) => {
const poa_button = !is_from_external && <PoaButton custom_text={localize('Submit proof of address')} />;

return (
Expand All @@ -21,13 +22,15 @@ const IdvSubmitComplete = ({ needs_poa, is_from_external }: TIdvSubmitComplete)
<Text className='proof-of-identity__text text' size='xs' align='center'>
{localize('We’ll review your documents and notify you of its status within 5 minutes.')}
</Text>
{!!needs_poa && (
{needs_poa ? (
<React.Fragment>
<Text className='text' size='xs' align='center'>
{localize("Next, we'll need your proof of address.")}
</Text>
{poa_button}
</React.Fragment>
) : (
<div className='proof-of-identity__redirection'>{redirect_button}</div>
)}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ const Idv = ({ handleRequireSubmission, idv, is_from_external, needs_poa, redire

switch (status) {
case identity_status_codes.pending:
return <IdvSubmitComplete is_from_external={is_from_external} needs_poa={needs_poa} />;
return (
<IdvSubmitComplete
is_from_external={is_from_external}
needs_poa={needs_poa}
redirect_button={redirect_button}
/>
);
case identity_status_codes.rejected:
case identity_status_codes.suspected:
if (Number(submissions_left) < 1)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Button, Loading } from '@deriv/components';
import { getPlatformRedirect, WS } from '@deriv/shared';
import { getPlatformRedirect, platforms, WS } from '@deriv/shared';
import { Localize } from '@deriv/translations';
import { useHistory } from 'react-router';
import DemoMessage from 'Components/demo-message';
Expand Down Expand Up @@ -96,8 +96,18 @@ const ProofOfIdentityContainer = ({
return <NotRequired />;
}

const onClickRedirectButton = () => {
const platform = platforms[from_platform.name?.toLowerCase()];
const { is_hard_redirect = false, url = '' } = platform ?? {};
if (is_hard_redirect) {
window.location.href = url;
} else {
routeBackTo(from_platform.route);
}
};

const redirect_button = should_show_redirect_btn && (
<Button primary className='proof-of-identity__redirect' onClick={() => routeBackTo(from_platform.route)}>
<Button primary className='proof-of-identity__redirect' onClick={onClickRedirectButton}>
<Localize i18n_default_text='Back to {{platform_name}}' values={{ platform_name: from_platform.name }} />
</Button>
);
Expand Down
14 changes: 13 additions & 1 deletion packages/account/src/Styles/account.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2279,6 +2279,19 @@ $MIN_HEIGHT_FLOATING: calc(
}
}

&__redirection {
.dc-btn {
margin-top: 3.2rem;
height: 4rem;

@include mobile {
margin: 1.6rem 0;
padding: 1.6rem;
width: 100%;
}
}
}

&__country-text {
margin-bottom: 1.6rem;
}
Expand All @@ -2287,7 +2300,6 @@ $MIN_HEIGHT_FLOATING: calc(
@include mobile {
width: 94%;
text-align: center;
margin-bottom: 9rem;
}
}

Expand Down