Skip to content

Commit

Permalink
Amina/fix: next button enabled for svg account even after account add…
Browse files Browse the repository at this point in the history
…ed (#6157)

* fix: next button enabled for svg account even after account added

* fix:removed_extra check
  • Loading branch information
amina-deriv committed Aug 29, 2022
1 parent d7d5345 commit 529dd2e
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions packages/cfd/src/Containers/jurisdiction-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import { Button, Modal, DesktopWrapper, MobileDialog, MobileWrapper, UILoader }
import { localize, Localize } from '@deriv/translations';
import { connect } from 'Stores/connect';
import RootStore from 'Stores/index';
import { GetAccountSettingsResponse, GetSettings, LandingCompany, GetAccountStatus } from '@deriv/api-types';
import {
GetAccountSettingsResponse,
GetSettings,
LandingCompany,
GetAccountStatus,
DetailsOfEachMT5Loginid,
} from '@deriv/api-types';
import JurisdictionModalContent from './jurisdiction-modal-content';
import { WS, getIdentityStatusInfo } from '@deriv/shared';
import { TTradingPlatformAvailableAccount } from '../Components/props.types';
Expand Down Expand Up @@ -47,6 +53,7 @@ type TJurisdictionModalProps = TCompareAccountsReusedProps & {
setJurisdictionSelectedShortcode: (shortcode: string) => void;
toggleCFDVerificationModal: () => void;
account_status: GetAccountStatus;
mt5_login_list: DetailsOfEachMT5Loginid[];
};

const JurisdictionModal = ({
Expand All @@ -67,6 +74,7 @@ const JurisdictionModal = ({
setJurisdictionSelectedShortcode,
toggleCFDVerificationModal,
account_status,
mt5_login_list,
}: TJurisdictionModalProps) => {
const [checked, setChecked] = React.useState(false);
const [has_submitted_personal_details, setHasSubmittedPersonalDetails] = React.useState(false);
Expand All @@ -92,13 +100,26 @@ const JurisdictionModal = ({
const poa_failed = poa_status === 'suspected' || poa_status === 'rejected' || poa_status === 'expired';
const poi_poa_not_submitted = poi_status === 'none' || poa_status === 'none';

React.useEffect(() => {
if (is_jurisdiction_modal_visible) {
if ((poa_status === 'pending' || poi_status === 'pending') && !is_eu) {
const selectSVGJurisdiction = () => {
if (account_type.type && !is_eu) {
const created_svg_accounts = mt5_login_list.filter(
data =>
data.market_type === account_type.type &&
data.landing_company_short === 'svg' &&
data.account_type === 'real'
);
if (!created_svg_accounts.length && (poa_status === 'pending' || poi_status === 'pending')) {
setJurisdictionSelectedShortcode('svg');
} else {
setJurisdictionSelectedShortcode('');
}
} else {
setJurisdictionSelectedShortcode('');
}
};
React.useEffect(() => {
if (is_jurisdiction_modal_visible) {
selectSVGJurisdiction();
if (!has_submitted_personal_details) {
let get_settings_response: GetSettings = {};
if (!account_settings) {
Expand Down Expand Up @@ -347,4 +368,5 @@ export default connect(({ modules, ui, client }: RootStore) => ({
toggleCFDVerificationModal: modules.cfd.toggleCFDVerificationModal,
setJurisdictionSelectedShortcode: modules.cfd.setJurisdictionSelectedShortcode,
account_status: client.account_status,
mt5_login_list: client.mt5_login_list,
}))(JurisdictionModal);

1 comment on commit 529dd2e

@vercel
Copy link

@vercel vercel bot commented on 529dd2e Aug 29, 2022

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.binary.sx
deriv-app.vercel.app
binary.sx
deriv-app-git-master.binary.sx

Please sign in to comment.