diff --git a/packages/appstore/src/components/cfds-listing/index.tsx b/packages/appstore/src/components/cfds-listing/index.tsx index 5524ecef07f8..96c8563ffdd1 100644 --- a/packages/appstore/src/components/cfds-listing/index.tsx +++ b/packages/appstore/src/components/cfds-listing/index.tsx @@ -190,9 +190,11 @@ const CFDsListing = observer(() => { updateMT5AccountDetails(); }, [is_landing_company_loaded, is_populating_mt5_account_list]); - const is_mt5_list_loading = !is_landing_company_loaded || is_populating_mt5_account_list || is_switching; const is_cfd_accounts_supported = combined_cfd_mt5_accounts.length || available_dxtrade_accounts.length || available_ctrader_accounts.length; + + const is_mt5_list_loading = !is_landing_company_loaded || is_populating_mt5_account_list || is_switching; + return is_cfd_accounts_supported ? ( { {has_svg_accounts_to_migrate && is_landing_company_loaded && } - {!is_mt5_list_loading ? ( + {!is_mt5_list_loading && combined_cfd_mt5_accounts.length ? ( {/* MT5 */} {combined_cfd_mt5_accounts.map((existing_account, index: number) => { diff --git a/packages/appstore/src/modules/traders-hub/index.tsx b/packages/appstore/src/modules/traders-hub/index.tsx index 372ca27a8891..da84cfc37332 100644 --- a/packages/appstore/src/modules/traders-hub/index.tsx +++ b/packages/appstore/src/modules/traders-hub/index.tsx @@ -57,7 +57,14 @@ const TradersHub = observer(() => { } = client; const { is_eu_demo, is_eu_real } = useContentFlag(); - const { selected_platform_type, setTogglePlatformType, is_eu_user } = traders_hub; + const { + selected_platform_type, + setTogglePlatformType, + is_eu_user, + combined_cfd_mt5_accounts, + available_ctrader_accounts, + available_dxtrade_accounts, + } = traders_hub; const traders_hub_ref = React.useRef(null); const can_show_notify = @@ -95,9 +102,12 @@ const TradersHub = observer(() => { setTogglePlatformType(event.target.value); }; if (!is_logged_in) return null; + const is_cfd_accounts_supported = + combined_cfd_mt5_accounts.length || available_dxtrade_accounts.length || available_ctrader_accounts.length; + const should_show_cfd_section = !!(is_mt5_allowed && is_cfd_accounts_supported); const getOrderedPlatformSections = () => { - if (is_mt5_allowed) { + if (should_show_cfd_section) { return ( { const desktopContent = !is_landing_company_loaded ? ( ) : ( - + ); const mobileTabletContent = ( {is_landing_company_loaded ? ( - is_mt5_allowed && ( + should_show_cfd_section && ( { ) : ( )} - {is_landing_company_loaded && !is_mt5_allowed && ( + {is_landing_company_loaded && !should_show_cfd_section && (
@@ -151,8 +161,8 @@ const TradersHub = observer(() => {
diff --git a/packages/core/src/Stores/traders-hub-store.js b/packages/core/src/Stores/traders-hub-store.js index 1063303ac825..ff0212f4ab5e 100644 --- a/packages/core/src/Stores/traders-hub-store.js +++ b/packages/core/src/Stores/traders-hub-store.js @@ -491,12 +491,21 @@ export default class TradersHubStore extends BaseStore { return acc; }, {}); - const getFilteredAccounts = () => - this.root_store.client.is_logged_in - ? getMT5Accounts.filter(account => - Object.prototype.hasOwnProperty.call(groupedByProduct, account.product) - ) - : getMT5Accounts; + const getFilteredAccounts = () => { + if (this.is_low_risk_cr_eu_real) { + const existing_account = this.root_store.client.mt5_login_list.filter( + account => account.landing_company_short === this.root_store.client.landing_company_shortcode + ); + return existing_account.length + ? getMT5Accounts.filter(account => account.product === existing_account[0].product) + : []; + } else if (this.root_store.client.is_logged_in) { + return getMT5Accounts.filter(account => + Object.prototype.hasOwnProperty.call(groupedByProduct, account.product) + ); + } + return getMT5Accounts; + }; const all_available_accounts = [...getCFDAvailableAccount(), ...getFilteredAccounts()]; this.available_cfd_accounts = all_available_accounts.map(account => { @@ -902,14 +911,20 @@ export default class TradersHubStore extends BaseStore { ); const { mt5_login_list } = await WS.authorized.mt5LoginList(); const current_account = mt5_login_list?.filter( - account => account.landing_company_short === jurisdiction_selected_shortcode && account.product === product + account => + account.landing_company_short === jurisdiction_selected_shortcode && + account.product === product && + account.account_type === this.selected_account_type ); if (current_account.length) { this.setSelectedJurisdictionKYCStatus(current_account[0]?.client_kyc_status ?? {}); } else { const selected_mt5_account = trading_platform_available_accounts?.filter( - account => account.shortcode === jurisdiction_selected_shortcode && account.product === product + account => + account.shortcode === jurisdiction_selected_shortcode && + account.product === product && + account.is_default_jurisdiction === 'true' ); if (selected_mt5_account.length) { this.setSelectedJurisdictionKYCStatus(selected_mt5_account[0]?.client_kyc_status ?? {});