undefined : () => cardSelection(`${type_of_card}`)}
style={OneOrTwoCards ? { width: '32em' } : { width: '27.6em' }}
@@ -225,9 +225,9 @@ const JurisdictionCard = ({
};
const JurisdictionModalContent = ({
- jurisdiction_selected_shortcode,
+ jurisdiction_selected_card,
account_type,
- setJurisdictionSelectedShortcode,
+ setJurisdictionSelectedCard,
synthetic_available_accounts,
financial_available_accounts,
poa_status,
@@ -267,7 +267,7 @@ const JurisdictionModalContent = ({
const ModalFootNote = () => {
return (
<>
- {poa_none && poi_none && jurisdiction_selected_shortcode !== 'svg' && jurisdiction_selected_shortcode && (
+ {poa_none && poi_none && jurisdiction_selected_card !== 'svg' && jurisdiction_selected_card && (
)}
- {poi_failed &&
- !poa_failed &&
- jurisdiction_selected_shortcode &&
- jurisdiction_selected_shortcode !== 'svg' && (
-
-
-
- )}
- {poa_failed &&
- !poi_failed &&
- jurisdiction_selected_shortcode &&
- jurisdiction_selected_shortcode !== 'svg' && (
-
-
-
- )}
- {poa_failed &&
- poi_failed &&
- jurisdiction_selected_shortcode &&
- jurisdiction_selected_shortcode !== 'svg' && (
-
-
-
- )}
- {jurisdiction_selected_shortcode === 'svg' && (
+ {poi_failed && !poa_failed && jurisdiction_selected_card && jurisdiction_selected_card !== 'svg' && (
+
+
+
+ )}
+ {poa_failed && !poi_failed && jurisdiction_selected_card && jurisdiction_selected_card !== 'svg' && (
+
+
+
+ )}
+ {poa_failed && poi_failed && jurisdiction_selected_card && jurisdiction_selected_card !== 'svg' && (
+
+
+
+ )}
+ {jurisdiction_selected_card === 'svg' && (
)}
- {is_fully_authenticated && jurisdiction_selected_shortcode === 'bvi' && (
+ {is_fully_authenticated && jurisdiction_selected_card === 'bvi' && (
)}
- {is_fully_authenticated && jurisdiction_selected_shortcode === 'vanuatu' && (
+ {is_fully_authenticated && jurisdiction_selected_card === 'vanuatu' && (
)}
- {is_fully_authenticated && jurisdiction_selected_shortcode === 'labuan' && (
+ {is_fully_authenticated && jurisdiction_selected_card === 'labuan' && (
)}
- {is_pending_authentication &&
- jurisdiction_selected_shortcode !== 'svg' &&
- jurisdiction_selected_shortcode && (
-
-
-
-
-
- )}
+ {is_pending_authentication && jurisdiction_selected_card !== 'svg' && jurisdiction_selected_card && (
+
+
+
+
+
+ )}
>
);
};
@@ -386,7 +375,7 @@ const JurisdictionModalContent = ({
{cardsToBeShown('bvi') && (
@@ -422,7 +411,7 @@ const JurisdictionModalContent = ({
{cardsToBeShown('vanuatu') && (
{is_fully_authenticated &&
poi_poa_verified &&
- jurisdiction_selected_shortcode &&
- jurisdiction_selected_shortcode !== 'svg' && (
-
- )}
+ jurisdiction_selected_card &&
+ jurisdiction_selected_card !== 'svg' &&
}
>
);
};
diff --git a/packages/cfd/src/Containers/jurisdiction-modal.tsx b/packages/cfd/src/Containers/jurisdiction-modal.tsx
index adec2f4795e5..3b9cfdc058b3 100644
--- a/packages/cfd/src/Containers/jurisdiction-modal.tsx
+++ b/packages/cfd/src/Containers/jurisdiction-modal.tsx
@@ -6,7 +6,7 @@ import RootStore from 'Stores/index';
import { LandingCompany } from '@deriv/api-types';
import JurisdictionModalContent from './jurisdiction-modal-content';
-export type TTradingPlatformAvailableAccount = {
+type TTradingPlatformAvailableAccount = {
market_type: 'financial' | 'gaming';
name: string;
requirements: {
@@ -47,11 +47,11 @@ type TJurisdictionModalProps = TCompareAccountsReusedProps & {
disableApp: () => void;
enableApp: () => void;
has_real_mt5_non_svg_login: boolean;
+ is_authentication_needed: boolean;
is_jurisdiction_modal_visible: boolean;
is_loading: boolean;
is_eu: boolean;
is_eu_country: boolean;
- jurisdiction_selected_shortcode: string;
residence: string;
toggleCFDPersonalDetailsModal: () => void;
toggleJurisdictionModal: () => void;
@@ -59,7 +59,6 @@ type TJurisdictionModalProps = TCompareAccountsReusedProps & {
is_fully_authenticated: boolean;
is_pending_authentication: boolean;
openPasswordModal: (account_type: TOpenAccountTransferMeta) => void;
- setJurisdictionSelectedShortcode: (shortcode: string) => void;
toggleCFDVerificationModal: () => void;
};
@@ -69,18 +68,18 @@ const JurisdictionModal = ({
disableApp,
enableApp,
has_real_mt5_non_svg_login,
+ is_authentication_needed,
is_jurisdiction_modal_visible,
is_eu,
- jurisdiction_selected_shortcode,
toggleCFDPersonalDetailsModal,
toggleJurisdictionModal,
trading_platform_available_accounts,
is_fully_authenticated,
is_pending_authentication,
openPasswordModal,
- setJurisdictionSelectedShortcode,
toggleCFDVerificationModal,
}: TJurisdictionModalProps) => {
+ const [jurisdiction_selected_card, setJurisdictionSelectedCard] = React.useState('');
const [checked, setChecked] = React.useState(false);
const financial_available_accounts = trading_platform_available_accounts.filter(
@@ -106,9 +105,9 @@ const JurisdictionModal = ({
const poi_poa_not_submitted = poi_status === 'none' || poa_status === 'none';
const is_next_button_enabled =
- jurisdiction_selected_shortcode === 'svg' ||
- (jurisdiction_selected_shortcode &&
- jurisdiction_selected_shortcode !== 'svg' &&
+ jurisdiction_selected_card === 'svg' ||
+ (jurisdiction_selected_card &&
+ jurisdiction_selected_card !== 'svg' &&
(poi_poa_not_submitted || poi_poa_failed || (poi_poa_verified && checked)) &&
!is_pending_authentication);
@@ -122,10 +121,10 @@ const JurisdictionModal = ({
if (is_eu) {
if (poi_poa_verified) {
openPasswordModal(type_of_account);
- } else {
+ } else if (is_authentication_needed) {
toggleCFDVerificationModal();
}
- } else if (jurisdiction_selected_shortcode === 'svg') {
+ } else if (jurisdiction_selected_card === 'svg') {
if (account_type.type === 'financial' && poi_poa_verified && !has_real_mt5_non_svg_login) {
toggleCFDPersonalDetailsModal();
} else {
@@ -138,13 +137,16 @@ const JurisdictionModal = ({
} else {
openPasswordModal(type_of_account);
}
- } else {
+ } else if (is_authentication_needed) {
toggleCFDVerificationModal();
+ } else {
+ openPasswordModal(type_of_account);
}
+ setJurisdictionSelectedCard('');
};
const buttonText = () => {
- const selected_card = jurisdiction_selected_shortcode !== 'svg' && jurisdiction_selected_shortcode;
+ const selected_card = jurisdiction_selected_card !== 'svg' && jurisdiction_selected_card;
if (poa_failed && selected_card) {
return
;
} else if (poi_failed && selected_card) {
@@ -172,8 +174,8 @@ const JurisdictionModal = ({
>
{
toggleJurisdictionModal();
- setJurisdictionSelectedShortcode('');
+ setJurisdictionSelectedCard('');
}}
footer={