diff --git a/packages/account/src/Components/Routes/binary-routes.tsx b/packages/account/src/Components/Routes/binary-routes.tsx index 9e1539613a27..4a3c5ae1ad64 100644 --- a/packages/account/src/Components/Routes/binary-routes.tsx +++ b/packages/account/src/Components/Routes/binary-routes.tsx @@ -7,7 +7,6 @@ import { TBinaryRoutes, TPlatformContext, TRoute } from 'Types'; import RouteWithSubRoutes from './route-with-sub-routes'; const BinaryRoutes = (props: TBinaryRoutes) => { - const { is_pre_appstore } = props; const { is_appstore } = React.useContext(PlatformContext); return ( @@ -19,7 +18,7 @@ const BinaryRoutes = (props: TBinaryRoutes) => { } > - {getRoutesConfig({ is_appstore, is_pre_appstore }).map((route: TRoute, idx: number) => ( + {getRoutesConfig({ is_appstore }).map((route: TRoute, idx: number) => ( ))} diff --git a/packages/account/src/Containers/account.jsx b/packages/account/src/Containers/account.jsx index b051ba7025a5..35229f566c25 100644 --- a/packages/account/src/Containers/account.jsx +++ b/packages/account/src/Containers/account.jsx @@ -2,7 +2,6 @@ import 'Styles/account.scss'; import { FadeWrapper, Icon, Loading, PageOverlay, Text, VerticalTab } from '@deriv/components'; import { PlatformContext, getSelectedRoute, isMobile, matchRoute, routes as shared_routes } from '@deriv/shared'; - import AccountLimitInfo from '../Sections/Security/AccountLimits/account-limits-info.jsx'; import PropTypes from 'prop-types'; import React from 'react'; @@ -53,7 +52,6 @@ const TradingHubLogout = ({ logout }) => { const PageOverlayWrapper = ({ is_from_derivgo, is_appstore, - is_pre_appstore, list_groups, logout, onClickClose, @@ -61,7 +59,7 @@ const PageOverlayWrapper = ({ subroutes, history, }) => { - const routeToPrevious = () => (is_pre_appstore ? history.push(shared_routes.traders_hub) : onClickClose()); + const routeToPrevious = () => history.push(shared_routes.traders_hub); if (isMobile() && selected_route) { return ( @@ -105,7 +103,7 @@ const PageOverlayWrapper = ({ is_full_width list={subroutes} list_groups={list_groups} - extra_content={is_pre_appstore && } + extra_content={} /> ); @@ -118,7 +116,6 @@ const Account = ({ is_from_derivgo, is_logged_in, is_logging_in, - is_pre_appstore, is_virtual, is_visible, location, @@ -146,10 +143,6 @@ const Account = ({ routes.forEach(menu_item => { menu_item.subroutes.forEach(route => { - if (route.path === shared_routes.languages) { - route.is_hidden = !is_pre_appstore; - } - if (route.path === shared_routes.financial_assessment) { route.is_disabled = is_virtual; } @@ -205,7 +198,6 @@ const Account = ({ ({ is_from_derivgo: common.is_from_derivgo, is_logged_in: client.is_logged_in, is_logging_in: client.is_logging_in, - is_pre_appstore: client.is_pre_appstore, is_virtual: client.is_virtual, is_visible: ui.is_account_settings_visible, logout: client.logout, diff --git a/packages/account/src/Types/common-prop.type.ts b/packages/account/src/Types/common-prop.type.ts index 01e0f3475323..9bf2066e33e3 100644 --- a/packages/account/src/Types/common-prop.type.ts +++ b/packages/account/src/Types/common-prop.type.ts @@ -94,7 +94,6 @@ export type TRouteConfig = TRoute & { }; export type TBinaryRoutes = { - is_pre_appstore: boolean; is_logged_in: boolean; is_logging_in: boolean; }; diff --git a/packages/appstore/src/modules/onboarding/onboarding.tsx b/packages/appstore/src/modules/onboarding/onboarding.tsx index a4bee3633611..fcd47c002fe0 100644 --- a/packages/appstore/src/modules/onboarding/onboarding.tsx +++ b/packages/appstore/src/modules/onboarding/onboarding.tsx @@ -29,14 +29,7 @@ const Onboarding = ({ contents = getTradingHubContents() }: TOnboardingProps) => const number_of_steps = Object.keys(contents); const { traders_hub, client } = useStores(); const { toggleIsTourOpen, selectAccountType, is_demo_low_risk, content_flag } = traders_hub; - const { - is_eu_country, - is_logged_in, - setIsPreAppStore, - is_landing_company_loaded, - prev_account_type, - setPrevAccountType, - } = client; + const { is_eu_country, is_logged_in, is_landing_company_loaded, prev_account_type, setPrevAccountType } = client; const [step, setStep] = React.useState(1); const prevStep = () => { @@ -46,7 +39,6 @@ const Onboarding = ({ contents = getTradingHubContents() }: TOnboardingProps) => const nextStep = () => { if (step < number_of_steps.length) setStep(step + 1); if (step === number_of_steps.length) { - setIsPreAppStore(true); toggleIsTourOpen(true); history.push(routes.traders_hub); if (is_demo_low_risk) { @@ -60,7 +52,6 @@ const Onboarding = ({ contents = getTradingHubContents() }: TOnboardingProps) => toggleIsTourOpen(false); history.push(routes.traders_hub); await selectAccountType(prev_account_type); - setIsPreAppStore(true); }; const eu_user = diff --git a/packages/cashier/src/components/account-platform-icon/account-platform-icon.tsx b/packages/cashier/src/components/account-platform-icon/account-platform-icon.tsx index 86a586ac2a69..a2fc8e3bca62 100644 --- a/packages/cashier/src/components/account-platform-icon/account-platform-icon.tsx +++ b/packages/cashier/src/components/account-platform-icon/account-platform-icon.tsx @@ -6,7 +6,6 @@ import { TAccountsList } from 'Types'; type TAccountPlatformIcon = { size: number; account: TAccountsList['account']; - is_pre_appstore: boolean; icon_class_name?: string; appstore_icon_class_name?: string; appstoreIconOnClickHandler?: () => void; @@ -14,13 +13,12 @@ type TAccountPlatformIcon = { const AccountPlatformIcon = ({ account, - is_pre_appstore, size, icon_class_name, appstore_icon_class_name, appstoreIconOnClickHandler, }: TAccountPlatformIcon) => { - return is_pre_appstore && account.is_mt && account.platform_icon ? ( + return account.is_mt && account.platform_icon ? ( ', () => { beforeEach(() => { mockRootStore = { ui: { is_dark_mode_on: true, toggleAccountsDialog: jest.fn() }, - client: { is_pre_appstore: true }, }; }); diff --git a/packages/cashier/src/components/cashier-container/virtual/virtual.tsx b/packages/cashier/src/components/cashier-container/virtual/virtual.tsx index 4b68dc40b7fa..73c395505059 100644 --- a/packages/cashier/src/components/cashier-container/virtual/virtual.tsx +++ b/packages/cashier/src/components/cashier-container/virtual/virtual.tsx @@ -1,8 +1,8 @@ import classNames from 'classnames'; import React from 'react'; -import { withRouter, useHistory } from 'react-router-dom'; +import { withRouter } from 'react-router-dom'; import { Text } from '@deriv/components'; -import { isMobile, routes } from '@deriv/shared'; +import { isMobile } from '@deriv/shared'; import { Localize } from '@deriv/translations'; import { useStore, observer } from '@deriv/stores'; import './virtual.scss'; @@ -10,9 +10,7 @@ import './virtual.scss'; const Virtual = observer(() => { const { ui: { is_dark_mode_on, toggleAccountsDialog }, - client: { is_pre_appstore }, } = useStore(); - const history = useHistory(); return (
@@ -46,12 +44,7 @@ const Virtual = observer(() => { key={1} className='virtual__account-switch-text' onClick={() => { - if (is_pre_appstore) { - history.push(routes.trade); - toggleAccountsDialog(); - } else { - toggleAccountsDialog(); - } + toggleAccountsDialog(); }} />, ]} diff --git a/packages/cashier/src/containers/cashier/cashier.tsx b/packages/cashier/src/containers/cashier/cashier.tsx index 8e40d99c17b6..f9b6e4ff02af 100644 --- a/packages/cashier/src/containers/cashier/cashier.tsx +++ b/packages/cashier/src/containers/cashier/cashier.tsx @@ -30,7 +30,6 @@ type TCashierProps = RouteComponentProps & { routeBackInApp: TRootStore['common']['routeBackInApp']; toggleCashier: TRootStore['ui']['toggleCashier']; resetLastLocation: () => void; - is_pre_appstore: boolean; }; type TCashierOptions = { @@ -68,9 +67,9 @@ const Cashier = observer(({ history, location, routes: routes_config }: TCashier const { is_payment_agent_transfer_visible } = payment_agent_transfer; const { is_payment_agent_visible } = payment_agent; const { resetLastLocation } = account_prompt_dialog; - const { routeBackInApp, is_from_derivgo } = common; + const { is_from_derivgo } = common; const { is_cashier_visible: is_visible, toggleCashier } = ui; - const { is_account_setting_loaded, is_logged_in, is_logging_in, is_pre_appstore } = client; + const { is_account_setting_loaded, is_logged_in, is_logging_in } = client; const is_account_transfer_visible = useAccountTransferVisible(); const is_onramp_visible = useOnrampVisible(); const switchToReal = useSwitchToRealAccount(); @@ -99,7 +98,7 @@ const Cashier = observer(({ history, location, routes: routes_config }: TCashier })(); }, [is_logged_in, onMount, setAccountSwitchListener]); - const onClickClose = () => (is_pre_appstore ? history.push(routes.traders_hub) : routeBackInApp(history)); + const onClickClose = () => history.push(routes.traders_hub); const getMenuOptions = () => { const options: TCashierOptions[] = []; routes_config.forEach(route => { diff --git a/packages/cashier/src/pages/account-transfer/__tests__/account-transfer.spec.tsx b/packages/cashier/src/pages/account-transfer/__tests__/account-transfer.spec.tsx index 44c3a91251b1..c4cd71236515 100644 --- a/packages/cashier/src/pages/account-transfer/__tests__/account-transfer.spec.tsx +++ b/packages/cashier/src/pages/account-transfer/__tests__/account-transfer.spec.tsx @@ -182,12 +182,4 @@ describe('', () => { expect(await screen.findByText('mockedAccountTransferReceipt')).toBeInTheDocument(); }); - - it('should show the crypto transactions if triggered from recent transactions', async () => { - mockRootStore.modules.cashier.transaction_history.is_crypto_transactions_visible = true; - - renderAccountTransfer(); - - expect(await screen.findByText('mockedCryptoTransactionsHistory')).toBeInTheDocument(); - }); }); diff --git a/packages/cashier/src/pages/account-transfer/account-transfer-form/__tests__/account-transfer-form.spec.tsx b/packages/cashier/src/pages/account-transfer/account-transfer-form/__tests__/account-transfer-form.spec.tsx index 2824ee5e1865..e003a17b2738 100644 --- a/packages/cashier/src/pages/account-transfer/account-transfer-form/__tests__/account-transfer-form.spec.tsx +++ b/packages/cashier/src/pages/account-transfer/account-transfer-form/__tests__/account-transfer-form.spec.tsx @@ -120,7 +120,7 @@ describe('', () => { renderAccountTransferForm(); expect(screen.getByTestId('dt_account_transfer_form_wrapper')).toBeInTheDocument(); - expect(screen.getByText('Transfer between your accounts in Deriv')).toBeInTheDocument(); + expect(screen.getByText('Cashier Error')).toBeInTheDocument(); }); it('should show loader if account_list.length === 0', () => { @@ -218,19 +218,6 @@ describe('', () => { expect(screen.getByText('Cashier Error')).toBeInTheDocument(); }); - it('should show component', () => { - (isMobile as jest.Mock).mockReturnValue(true); - - renderAccountTransferForm(); - - expect(screen.getByText('Transfer limits may vary depending on the exchange rates.')).toBeInTheDocument(); - expect( - screen.getByText( - 'Transfers may be unavailable due to high volatility or technical issues and when the exchange markets are closed.' - ) - ).toBeInTheDocument(); - }); - it('should show proper hint about mt5 remained transfers', () => { (isMobile as jest.Mock).mockReturnValue(true); mockRootStore.client.account_limits = { @@ -288,58 +275,4 @@ describe('', () => { expect(screen.getByText('You have 1 transfer remaining for today.')).toBeInTheDocument(); }); - - it('should show proper note if transfer fee is 2% and is_crypto_to_crypto_transfer', () => { - (isMobile as jest.Mock).mockReturnValue(true); - mockRootStore.modules.cashier.account_transfer.selected_from.is_crypto = true; - mockRootStore.modules.cashier.account_transfer.selected_from.currency = 'BTC'; - mockRootStore.modules.cashier.account_transfer.selected_to.is_crypto = true; - mockRootStore.modules.cashier.account_transfer.selected_to.currency = 'BTC'; - mockRootStore.modules.cashier.account_transfer.transfer_fee = 2; - - renderAccountTransferForm(); - - expect( - screen.getByText( - 'We’ll charge a 2% transfer fee or 0 BTC, whichever is higher, for transfers between your Deriv cryptocurrency accounts. Please bear in mind that some transfers may not be possible.' - ) - ).toBeInTheDocument(); - }); - - it('should show proper note if transfer fee is 2%, is_mt_transfer, and is_dxtrade_allowed is false', () => { - (isMobile as jest.Mock).mockReturnValue(true); - mockRootStore.modules.cashier.account_transfer.selected_from.is_mt = true; - mockRootStore.modules.cashier.account_transfer.selected_to.is_mt = true; - mockRootStore.modules.cashier.account_transfer.transfer_fee = 2; - - renderAccountTransferForm(); - - expect( - screen.getByText( - 'We’ll charge a 2% transfer fee or 0 USD, whichever is higher, for transfers between your Deriv cryptocurrency and Deriv MT5 accounts. Please bear in mind that some transfers may not be possible.' - ) - ).toBeInTheDocument(); - }); - - it('should show proper note if transfer fee is 2% and is_mt_transfer is false', () => { - (isMobile as jest.Mock).mockReturnValue(true); - mockRootStore.modules.cashier.account_transfer.transfer_fee = 2; - - renderAccountTransferForm(); - - expect( - screen.getByText( - 'We’ll charge a 2% transfer fee or 0 USD, whichever is higher, for transfers between your Deriv fiat and Deriv cryptocurrency accounts. Please bear in mind that some transfers may not be possible.' - ) - ).toBeInTheDocument(); - }); - - it('should show proper note if transfer fee is null', () => { - (isMobile as jest.Mock).mockReturnValue(true); - mockRootStore.modules.cashier.account_transfer.transfer_fee = null; - - renderAccountTransferForm(); - - expect(screen.getByText('Please bear in mind that some transfers may not be possible.')).toBeInTheDocument(); - }); }); diff --git a/packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.tsx b/packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.tsx index a18b466d18e4..8ebb3a33a37b 100644 --- a/packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.tsx +++ b/packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.tsx @@ -31,21 +31,17 @@ type TAccountTransferFormProps = { setSideNotes?: (notes: TSideNotesProps) => void; }; -const AccountOption = ({ account, idx, is_pre_appstore }: TAccountsList) => { +const AccountOption = ({ account, idx }: TAccountsList) => { return ( {(account.currency || account.platform_icon) && (
- +
)}
- + {account.is_dxtrade || account.is_mt || account.is_derivez ? account.text : getCurrencyName(account.currency)} @@ -86,13 +82,7 @@ const AccountTransferForm = observer( common: { is_from_derivgo }, } = useStore(); - const { - account_limits, - authentication_status, - is_dxtrade_allowed, - is_pre_appstore, - getLimits: onMount, - } = client; + const { account_limits, authentication_status, is_dxtrade_allowed, getLimits: onMount } = client; const { account_transfer, crypto_fiat_converter, transaction_history, general_store } = useCashierStore(); const { @@ -128,7 +118,8 @@ const AccountTransferForm = observer( const [to_accounts, setToAccounts] = React.useState({}); const [transfer_to_hint, setTransferToHint] = React.useState(); - const is_from_pre_appstore = is_pre_appstore && !location.pathname.startsWith(routes.cashier); + const is_from_outside_cashier = !location.pathname.startsWith(routes.cashier); + const { daily_transfers } = account_limits; const mt5_remaining_transfers = daily_transfers?.mt5; const dxtrade_remaining_transfers = daily_transfers?.dxtrade; @@ -199,7 +190,7 @@ const AccountTransferForm = observer( derivez_accounts_to = []; accounts_list.forEach((account, idx) => { - const text = ; + const text = ; const value = account.value; const is_cfd_account = account.is_mt || account.is_dxtrade || account.is_derivez; @@ -369,7 +360,7 @@ const AccountTransferForm = observer( className='cashier__wrapper account-transfer-form__wrapper' data-testid='dt_account_transfer_form_wrapper' > - {!is_from_pre_appstore && ( + {!is_from_outside_cashier && ( - {is_from_pre_appstore && } - {is_pre_appstore && ( - - )} + {is_from_outside_cashier && } + +
- {!is_from_pre_appstore && ( + {!is_from_outside_cashier && ( } is_mobile> {is_crypto && crypto_transactions?.length ? : null} ', () => { expect(screen.getByText('Please create another Deriv or Deriv MT5 account.')).toBeInTheDocument(); expect(screen.getByText('Create account')).toBeInTheDocument(); }); - - it('should trigger onClick callback, when the "Create account" button was clicked', () => { - mockRootStore.client.is_dxtrade_allowed = true; - - renderAccountTransferNoAccount(); - - const create_acc_btn = screen.getByText('Create account'); - fireEvent.click(create_acc_btn); - - expect(mockRootStore.ui.toggleAccountsDialog).toHaveBeenCalledTimes(1); - }); }); diff --git a/packages/cashier/src/pages/account-transfer/account-transfer-no-account/account-transfer-no-account.tsx b/packages/cashier/src/pages/account-transfer/account-transfer-no-account/account-transfer-no-account.tsx index e9e3d5f35e65..4f96c9297452 100644 --- a/packages/cashier/src/pages/account-transfer/account-transfer-no-account/account-transfer-no-account.tsx +++ b/packages/cashier/src/pages/account-transfer/account-transfer-no-account/account-transfer-no-account.tsx @@ -11,8 +11,7 @@ type TAccountTransferNoAccount = { const AccountTransferNoAccount = observer(({ openAccountSwitcherModal }: TAccountTransferNoAccount) => { const { - client: { is_dxtrade_allowed, is_pre_appstore }, - ui: { toggleAccountsDialog }, + client: { is_dxtrade_allowed }, traders_hub: { openModal, closeModal }, } = useStore(); @@ -48,11 +47,7 @@ const AccountTransferNoAccount = observer(({ openAccountSwitcherModal }: TAccoun primary large onClick={() => - openAccountSwitcherModal - ? openAccountSwitcherModal() - : is_pre_appstore - ? openModal('currency_selection') - : toggleAccountsDialog() + openAccountSwitcherModal ? openAccountSwitcherModal() : openModal('currency_selection') } > diff --git a/packages/cashier/src/pages/account-transfer/account-transfer-receipt/__tests__/account-transfer-receipt.spec.tsx b/packages/cashier/src/pages/account-transfer/account-transfer-receipt/__tests__/account-transfer-receipt.spec.tsx index b3f12a88e7fa..f7310e493100 100644 --- a/packages/cashier/src/pages/account-transfer/account-transfer-receipt/__tests__/account-transfer-receipt.spec.tsx +++ b/packages/cashier/src/pages/account-transfer/account-transfer-receipt/__tests__/account-transfer-receipt.spec.tsx @@ -62,12 +62,11 @@ describe('', () => { ), }); - it('should show "Your funds have been transferred" message, "View transaction details" and "Make a new transfer" buttons', () => { + it('should show "Your funds have been transferred" message and "View transaction details" buttons', () => { renderAccountTransferReceipt(); expect(screen.getByText('Your funds have been transferred')).toBeInTheDocument(); expect(screen.getByText('View transaction details')).toBeInTheDocument(); - expect(screen.getByText('Make a new transfer')).toBeInTheDocument(); }); it('should redirect to "/reports/statement", when the "View transaction details" button was clicked', () => { @@ -79,15 +78,6 @@ describe('', () => { expect(history.location.pathname).toBe(routes.statement); }); - it('should reset account transfer, when the "Make a new transfer" button was clicked', () => { - renderAccountTransferReceipt(); - - const make_a_new_transfer_btn = screen.getByText('Make a new transfer'); - fireEvent.click(make_a_new_transfer_btn); - - expect(mockRootStore.modules.cashier.account_transfer.resetAccountTransfer).toHaveBeenCalledTimes(1); - }); - it('should not show "We’re switching over to your {{currency}} account to view the transaction." message, when the "Cancel" button was clicked', async () => { const modal_root_el = document.createElement('div'); modal_root_el.setAttribute('id', 'modal_root'); @@ -111,7 +101,7 @@ describe('', () => { }); }); - it('should redirect to "/reports/statement", when the "Switch to {currency} account" button was clicked', () => { + it('should redirect to "/reports/statement", when the "Switch to {currency} account" button was clicked', async () => { const modal_root_el = document.createElement('div'); modal_root_el.setAttribute('id', 'modal_root'); document.body.appendChild(modal_root_el); @@ -124,6 +114,8 @@ describe('', () => { const switch_to_currency_acc = screen.getByText('Switch to BTC account'); fireEvent.click(switch_to_currency_acc); - expect(history.location.pathname).toBe(routes.statement); + await waitFor(() => { + expect(history.location.pathname).toBe(routes.statement); + }); }); }); diff --git a/packages/cashier/src/pages/account-transfer/account-transfer-receipt/account-transfer-receipt.tsx b/packages/cashier/src/pages/account-transfer/account-transfer-receipt/account-transfer-receipt.tsx index 4727a96b7563..e52895902421 100644 --- a/packages/cashier/src/pages/account-transfer/account-transfer-receipt/account-transfer-receipt.tsx +++ b/packages/cashier/src/pages/account-transfer/account-transfer-receipt/account-transfer-receipt.tsx @@ -24,10 +24,10 @@ const AccountTransferReceipt = observer(({ onClose, history }: TAccountTransferR const { account_transfer } = useCashierStore(); const { disableApp, enableApp } = ui; const { is_from_derivgo } = common; - const { is_pre_appstore, loginid, switchAccount } = client; + const { loginid, switchAccount } = client; const { receipt, resetAccountTransfer, selected_from, selected_to, setShouldSwitchAccount } = account_transfer; - const is_from_pre_appstore = is_pre_appstore && !location.pathname.startsWith(routes.cashier); + const is_from_outside_cashier = !location.pathname.startsWith(routes.cashier); const [is_switch_visible, setIsSwitchVisible] = React.useState(false); const [switch_to, setSwitchTo] = React.useState({}); @@ -70,14 +70,14 @@ const AccountTransferReceipt = observer(({ onClose, history }: TAccountTransferR } // close modal only when the user try to transfer money from traders-hub, not from cashier // because in cashier this component is not a modal - if (is_from_pre_appstore) onClose?.(); + if (is_from_outside_cashier) onClose?.(); }; return (
@@ -97,7 +97,7 @@ const AccountTransferReceipt = observer(({ onClose, history }: TAccountTransferR
- + @@ -111,7 +111,7 @@ const AccountTransferReceipt = observer(({ onClose, history }: TAccountTransferR
- + @@ -137,8 +137,8 @@ const AccountTransferReceipt = observer(({ onClose, history }: TAccountTransferR - - ) : ( - - - - )} - -
- {is_logged_in && !is_trading_hub_category && ( - - - - )} - {is_logged_in && ( - - - - )} - {is_logged_in && !is_trading_hub_category && ( - - - - )} - {primary_routes_config.map((route_config, idx) => - getRoutesWithSubMenu(route_config, idx) - )} - { - e.preventDefault(); - toggleTheme(!is_dark_mode); - }} - > -
- - - {localize('Dark theme')} - - toggleTheme(!is_dark_mode)} - is_enabled={is_dark_mode} - /> -
-
- {is_logged_in && ( - - {HelpCentreRoute()} - - - - - - - {is_eu && show_eu_related_content && !is_virtual && ( - - - - )} - - - - {liveChat.isReady && ( - - - - {localize('WhatsApp')} - - - )} - - {is_appstore ? null : } - - { - logoutClient(); - toggleDrawer(); - }} - className='dc-mobile-drawer__item' - > - - - - - - - - )} - - {is_language_changing && } - - )} - - {!is_appstore && !is_pre_appstore && ( - + + {!is_trading_hub_category && ( { toggleDrawer={toggleDrawer} /> - -
- - + )} + +
+ {is_logged_in && ( + + + )} + {!is_trading_hub_category && ( { onClickLink={toggleDrawer} /> - {primary_routes_config.map((route_config, idx) => - getRoutesWithSubMenu(route_config, idx) - )} - {getLanguageRoutes()} - { - - { - e.preventDefault(); - toggleTheme(!is_dark_mode); - }} - > -
- - - {localize('Dark theme')} - - toggleTheme(!is_dark_mode)} - is_enabled={is_dark_mode} - /> -
+ )} + {!is_logged_in && getLanguageRoutes()} + + {primary_routes_config.map((route_config, idx) => + getRoutesWithSubMenu(route_config, idx) + )} + { + e.preventDefault(); + toggleTheme(!is_dark_mode); + }} + > +
+ + {localize('Dark theme')} + toggleTheme(!is_dark_mode)} + is_enabled={is_dark_mode} + /> +
+
+ + {HelpCentreRoute()} + {is_logged_in && ( + + + + + + + + {is_eu && show_eu_related_content && !is_virtual && ( + + - {HelpCentreRoute(true)} - - } - {liveChat.isReady && ( - - - - {localize('WhatsApp')} - + )} + + - )} - - {is_appstore ? null : } - - {secondary_routes_config.map(route_config => getRoutesWithSubMenu(route_config))} - {is_logged_in && ( - { - logoutClient(); - toggleDrawer(); - }} +
+ )} + {liveChat.isReady && ( + + + - - - )} - - - )} + {localize('WhatsApp')} + + + )} + + {is_appstore ? null : } + + {is_logged_in && ( + { + logoutClient(); + toggleDrawer(); + }} + className='dc-mobile-drawer__item' + > + + + )} + + + + + + {is_language_changing && } +
- {!is_pre_appstore && ( - - - - - )} diff --git a/packages/core/src/App/Components/Routes/binary-routes.jsx b/packages/core/src/App/Components/Routes/binary-routes.jsx index e05b0d3088d2..ffd1e965b421 100644 --- a/packages/core/src/App/Components/Routes/binary-routes.jsx +++ b/packages/core/src/App/Components/Routes/binary-routes.jsx @@ -8,7 +8,6 @@ import RouteWithSubRoutes from './route-with-sub-routes.jsx'; const BinaryRoutes = props => { const location = useLocation(); - const { is_pre_appstore } = props; const { is_appstore } = React.useContext(PlatformContext); React.useEffect(() => { props.pushDataLayer({ event: 'page_load' }); @@ -21,7 +20,7 @@ const BinaryRoutes = props => { }> - {getRoutesConfig({ is_appstore, is_pre_appstore, is_eu_country }).map((route, idx) => ( + {getRoutesConfig({ is_appstore, is_eu_country }).map((route, idx) => ( ))} @@ -34,5 +33,4 @@ export default connect(({ ui, gtm, client }) => ({ promptFn: ui.promptFn, pushDataLayer: gtm.pushDataLayer, isEuropeCountry: client.isEuropeCountry, - is_pre_appstore: client.is_pre_appstore, }))(BinaryRoutes); diff --git a/packages/core/src/App/Constants/platform-config.js b/packages/core/src/App/Constants/platform-config.js index 969130ff7899..80e8391ca34f 100644 --- a/packages/core/src/App/Constants/platform-config.js +++ b/packages/core/src/App/Constants/platform-config.js @@ -17,20 +17,6 @@ const platform_config = [ description: () => localize('Automated trading at your fingertips. No coding needed.'), link_to: routes.bot, }, - { - icon: getPlatformSettings('mt5').icon, - title: () => getPlatformSettings('mt5').name, - name: getPlatformSettings('mt5').name, - description: () => localize('Trade on Deriv MT5, the all-in-one FX and CFD trading platform.'), - link_to: routes.mt5, - }, - { - icon: getPlatformSettings('dxtrade').icon, - title: () => getPlatformSettings('dxtrade').name, - name: getPlatformSettings('dxtrade').name, - description: () => localize('Trade CFDs on a customizable, easy-to-use trading platform.'), - link_to: routes.dxtrade, - }, { icon: getPlatformSettings('smarttrader').icon, title: () => getPlatformSettings('smarttrader').name, diff --git a/packages/core/src/App/Containers/AccountSwitcher/account-switcher.jsx b/packages/core/src/App/Containers/AccountSwitcher/account-switcher.jsx index 1cc402d48cae..1c23674364b9 100644 --- a/packages/core/src/App/Containers/AccountSwitcher/account-switcher.jsx +++ b/packages/core/src/App/Containers/AccountSwitcher/account-switcher.jsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; import PropTypes from 'prop-types'; import React from 'react'; -import { withRouter, useHistory } from 'react-router'; +import { withRouter } from 'react-router'; import { Button, DesktopWrapper, @@ -14,121 +14,76 @@ import { Text, useOnClickOutside, } from '@deriv/components'; -import { - routes, - formatMoney, - getCFDAccount, - getAccountTypeFields, - getPlatformSettings, - CFD_PLATFORMS, - ContentFlag, -} from '@deriv/shared'; +import { routes, formatMoney, ContentFlag } from '@deriv/shared'; import { localize, Localize } from '@deriv/translations'; import { getAccountTitle } from 'App/Containers/RealAccountSignup/helpers/constants'; import { connect } from 'Stores/connect'; -import { AccountsItemLoader } from 'App/Components/Layout/Header/Components/Preloader'; import AccountList from './account-switcher-account-list.jsx'; import AccountWrapper from './account-switcher-account-wrapper.jsx'; -import { getSortedAccountList, getSortedCFDList, isDemo, getCFDConfig } from './helpers'; +import { getSortedAccountList, getSortedCFDList, isDemo } from './helpers'; import { BinaryLink } from 'App/Components/Routes'; -const AccountSwitcher = props => { - const [active_tab_index, setActiveTabIndex] = React.useState( - !props.is_virtual || props.should_show_real_accounts_list ? 0 : 1 - ); +const AccountSwitcher = ({ + available_crypto_currencies, + account_list, + account_loginid, + accounts, + account_type, + client_residence, + country_standpoint, + has_active_real_account, + has_any_real_account, + has_fiat, + history, + is_dark_mode_on, + is_eu, + is_low_risk, + is_high_risk, + is_logged_in, + is_mobile, + is_positions_drawer_on, + is_virtual, + is_visible, + landing_company_shortcode, + logoutClient, + mt5_login_list, + obj_total_balance, + openRealAccountSignup, + routeBackInApp, + should_show_real_accounts_list, + show_eu_related_content, + switchAccount, + resetVirtualBalance, + toggleAccountsDialog, + togglePositionsDrawer, + toggleSetCurrencyModal, + upgradeable_landing_companies, + real_account_creation_unlock_date, + setShouldShowCooldownModal, + content_flag, + virtual_account_loginid, + setTogglePlatformType, +}) => { + const [active_tab_index, setActiveTabIndex] = React.useState(!is_virtual || should_show_real_accounts_list ? 0 : 1); const [is_deriv_demo_visible, setDerivDemoVisible] = React.useState(true); const [is_deriv_real_visible, setDerivRealVisible] = React.useState(true); - const [is_dmt5_demo_visible, setDmt5DemoVisible] = React.useState(true); - const [is_dmt5_real_visible, setDmt5RealVisible] = React.useState(true); - const [is_dxtrade_demo_visible, setDxtradeDemoVisible] = React.useState(true); - const [is_dxtrade_real_visible, setDxtradeRealVisible] = React.useState(true); - const [exchanged_rate_cfd_real, setExchangedRateCfdReal] = React.useState(1); - const [exchanged_rate_cfd_demo, setExchangedRateCfdDemo] = React.useState(1); const [is_non_eu_regulator_visible, setNonEuRegulatorVisible] = React.useState(true); const [is_eu_regulator_visible, setEuRegulatorVisible] = React.useState(true); - const [filtered_real_accounts, setFilteredRealAccounts] = React.useState([]); - const [filtered_remaining_real_accounts, setFilteredRemainingRealAccounts] = React.useState([]); const wrapper_ref = React.useRef(); const scroll_ref = React.useRef(null); - const platform_name_dxtrade = getPlatformSettings('dxtrade').name; - const platform_name_mt5 = getPlatformSettings('mt5').name; - - const account_total_balance_currency = props.obj_total_balance.currency; - const cfd_real_currency = - props.mt5_login_list.find(account => !isDemo(account))?.currency || - props.dxtrade_accounts_list.find(account => !isDemo(account))?.currency; + const account_total_balance_currency = obj_total_balance.currency; - const vrtc_loginid = props.account_list.find(account => account.is_virtual)?.loginid; - const vrtc_currency = props.accounts[vrtc_loginid] ? props.accounts[vrtc_loginid].currency : 'USD'; - const cfd_demo_currency = - props.mt5_login_list.find(account => isDemo(account))?.currency || - props.dxtrade_accounts_list.find(account => isDemo(account))?.currency; - - const history = useHistory(); - - React.useEffect(() => { - if (getMaxAccountsDisplayed()) { - setDmt5RealVisible(false); - } - }, [getMaxAccountsDisplayed]); - - React.useEffect(() => { - const getCurrentExchangeRate = (currency, setExchangeRate, base_currency = account_total_balance_currency) => { - if (currency) { - props.getExchangeRate(currency, base_currency).then(res => { - setExchangeRate(res); - }); - } - }; - if (cfd_real_currency !== account_total_balance_currency) { - getCurrentExchangeRate(cfd_real_currency, setExchangedRateCfdReal); - } - if (cfd_demo_currency !== vrtc_currency) { - getCurrentExchangeRate(cfd_demo_currency, setExchangedRateCfdDemo, vrtc_currency); - } - if (props.is_low_risk || props.is_high_risk) { - const real_accounts = getSortedAccountList(props.account_list, props.accounts).filter( - account => !account.is_virtual && account.loginid.startsWith('CR') - ); - setFilteredRealAccounts(real_accounts); - const remaining_real_accounts = getRemainingRealAccounts().filter(account => account === 'svg'); - setFilteredRemainingRealAccounts(remaining_real_accounts); - } else if (props.is_eu) { - const real_accounts = getSortedAccountList(props.account_list, props.accounts).filter( - account => !account.is_virtual && account.loginid.startsWith('MF') - ); - setFilteredRealAccounts(real_accounts); - const remaining_real_accounts = getRemainingRealAccounts().filter(account => account === 'maltainvest'); - setFilteredRemainingRealAccounts(remaining_real_accounts); - } - }, []); - - React.useEffect(() => { - if (scroll_ref.current && (is_dmt5_real_visible || is_dxtrade_real_visible)) { - scroll_ref.current.scrollIntoView({ - behavior: 'smooth', - block: getMaxAccountsDisplayed() ? 'end' : 'start', - inline: 'nearest', - }); - } - }, [getMaxAccountsDisplayed, is_dmt5_real_visible, is_dxtrade_real_visible]); + const vrtc_loginid = account_list.find(account => account.is_virtual)?.loginid; + const vrtc_currency = accounts[vrtc_loginid] ? accounts[vrtc_loginid].currency : 'USD'; const toggleVisibility = section => { switch (section) { case 'demo_deriv': return setDerivDemoVisible(!is_deriv_demo_visible); - case 'demo_dmt5': - return setDmt5DemoVisible(!is_dmt5_demo_visible); - case 'demo_dxtrade': - return setDxtradeDemoVisible(!is_dxtrade_demo_visible); case 'real_deriv': return setDerivRealVisible(!is_deriv_real_visible); - case 'real_dmt5': - return setDmt5RealVisible(!is_dmt5_real_visible); - case 'real_dxtrade': - return setDxtradeRealVisible(!is_dxtrade_real_visible); case 'non-eu-regulator': return setNonEuRegulatorVisible(!is_non_eu_regulator_visible); case 'eu-regulator': @@ -138,418 +93,93 @@ const AccountSwitcher = props => { } }; - const getMaxAccountsDisplayed = React.useCallback(() => { - return props?.account_list?.length > 4; - }, [props?.account_list?.length]); - const handleLogout = async () => { closeAccountsDialog(); - if (props.is_positions_drawer_on) { - props.togglePositionsDrawer(); // TODO: hide drawer inside logout, once it is a mobx action + if (is_positions_drawer_on) { + togglePositionsDrawer(); // TODO: hide drawer inside logout, once it is a mobx action } - props.routeBackInApp(props.history); - await props.logoutClient(); + routeBackInApp(history); + await logoutClient(); }; const closeAccountsDialog = () => { - props.toggleAccountsDialog(false); + toggleAccountsDialog(false); }; - const validateClickOutside = event => props.is_visible && !event.target.classList.contains('acc-info'); + const validateClickOutside = event => is_visible && !event.target.classList.contains('acc-info'); useOnClickOutside(wrapper_ref, closeAccountsDialog, validateClickOutside); - const redirectToMt5 = async account_type => { - closeAccountsDialog(); - await props.history.push(routes.mt5); - window.location.hash = account_type; - }; - - const redirectToDXTrade = async account_type => { - closeAccountsDialog(); - await props.history.push(routes.dxtrade); - window.location.hash = account_type; - }; - - const hasRequiredCredentials = () => { - // for MT5 Real Financial STP, if true, users can instantly create a new account by setting password - if (!props.account_settings) return false; - const { citizen, tax_identification_number, tax_residence } = props.account_settings; - return !!(citizen && tax_identification_number && tax_residence); - }; - - const should_redirect_fstp_password = props.is_fully_authenticated && hasRequiredCredentials(); - - const openMt5RealAccount = account_type => { - const has_required_account = - account_type === 'synthetic' ? props.has_malta_account : props.has_maltainvest_account; - - if (props.show_eu_related_content && !has_required_account) { - closeAccountsDialog(); - props.openDerivRealAccountNeededModal(); - } else { - if (should_redirect_fstp_password) - sessionStorage.setItem( - 'open_cfd_account_type', - `real.${CFD_PLATFORMS.MT5}.${account_type}.set_password` - ); - else sessionStorage.setItem('open_cfd_account_type', `real.${CFD_PLATFORMS.MT5}.${account_type}`); - redirectToMt5Real(); - } - }; - - const redirectToMt5Real = (market_type, server) => { - const synthetic_server_region = server ? server.server_info?.geolocation.region : ''; - const synthetic_server_environment = server ? (server.server_info?.environment).toLowerCase() : ''; - - const serverElementName = () => { - let filter_server_number = ''; - let synthetic_region_string = ''; - if (market_type === 'synthetic') { - filter_server_number = synthetic_server_environment.split('server')[1]; - synthetic_region_string = `-${synthetic_server_region.toLowerCase()}`; - } - return `-${market_type}${synthetic_region_string}${filter_server_number}`; - }; - - redirectToMt5(`real${market_type ? serverElementName() : ''}`); - }; - - const redirectToDXTradeReal = () => { - redirectToDXTrade('real'); - }; - - const openMt5DemoAccount = account_type => { - if (props.show_eu_related_content && !props.has_maltainvest_account && props.standpoint.iom) { - closeAccountsDialog(); - props.openAccountNeededModal('maltainvest', localize('Deriv Multipliers'), localize('demo CFDs')); - return; - } - sessionStorage.setItem('open_cfd_account_type', `demo.${CFD_PLATFORMS.MT5}.${account_type}`); - redirectToMt5Demo(); - }; - - const openDXTradeDemoAccount = account_type => { - sessionStorage.setItem( - 'open_cfd_account_type', - `demo.${CFD_PLATFORMS.DXTRADE}.${account_type === 'dxtrade' ? 'all' : account_type}` - ); - redirectToDXTradeDemo(); - }; - - const openDXTradeRealAccount = account_type => { - sessionStorage.setItem('open_cfd_account_type', `real.${CFD_PLATFORMS.DXTRADE}.${account_type}`); - redirectToDXTradeReal(); - }; - - const redirectToMt5Demo = market_type => { - const hash_id = market_type ? `-${market_type}` : ''; - redirectToMt5(`demo${hash_id}`); - }; - - const redirectToDXTradeDemo = market_type => { - const hash_id = market_type ? `-${market_type}` : ''; - redirectToDXTrade(`demo${hash_id}`); - }; - const setAccountCurrency = () => { closeAccountsDialog(); - props.toggleSetCurrencyModal(); - }; - - // TODO: Remove this and all usage after real release (74063) - const hasUnmergedAccounts = accounts => { - return Object.keys(accounts).some( - key => accounts[key].market_type === 'synthetic' || accounts[key].market_type === 'financial' - ); - }; - - // * mt5_login_list returns these: - // landing_company_short: "svg" | "malta" | "maltainvest" | "vanuatu" | "labuan" | "bvi" - // account_type: "real" | "demo" - // market_type: "financial" | "gaming" - // sub_account_type: "financial" | "financial_stp" | "swap_free" - // - // (all market type gaming are synthetic accounts and can only have financial or swap_free sub account) - // - // * we should map them to landing_company: - // mt_financial_company: { financial: {}, financial_stp: {}, swap_free: {} } - // mt_gaming_company: { financial: {}, swap_free: {} } - const getRemainingAccounts = (existing_cfd_accounts, platform, is_eu, is_demo, getIsEligibleForMoreAccounts) => { - const all_config = getCFDConfig( - 'all', - props.landing_companies?.dxtrade_all_company, - existing_cfd_accounts, - props.mt5_trading_servers, - platform, - is_eu, - props.trading_platform_available_accounts, - getIsEligibleForMoreAccounts - ); - const gaming_config = getCFDConfig( - 'gaming', - platform === CFD_PLATFORMS.MT5 - ? props.landing_companies?.mt_gaming_company - : props.landing_companies?.dxtrade_gaming_company, - existing_cfd_accounts, - props.mt5_trading_servers, - platform, - is_eu, - props.trading_platform_available_accounts, - getIsEligibleForMoreAccounts - ); - const financial_config = getCFDConfig( - 'financial', - platform === CFD_PLATFORMS.MT5 - ? props.landing_companies?.mt_financial_company - : props.landing_companies?.dxtrade_financial_company, - existing_cfd_accounts, - props.mt5_trading_servers, - platform, - is_eu, - props.trading_platform_available_accounts, - getIsEligibleForMoreAccounts - ); - // Handling CFD for EU - // TODO: Move this logic inside getCFDConfig when CFD added to landing_companies API - if (is_eu) { - return [...financial_config]; - } - - // TODO: change this condition before real release - if (is_demo && platform === CFD_PLATFORMS.DXTRADE) { - return [...all_config]; - } - - if (!is_demo && platform === CFD_PLATFORMS.DXTRADE) { - return hasUnmergedAccounts(existing_cfd_accounts) - ? [...gaming_config, ...financial_config] - : [...all_config]; - } - - return [...gaming_config, ...financial_config]; + toggleSetCurrencyModal(); }; const doSwitch = async loginid => { closeAccountsDialog(); - if (props.account_loginid === loginid) return; - await props.switchAccount(loginid); + if (account_loginid === loginid) return; + await switchAccount(loginid); }; const resetBalance = async () => { closeAccountsDialog(); - props.resetVirtualBalance(); + resetVirtualBalance(); }; // Real accounts is always the first tab index based on design const isRealAccountTab = active_tab_index === 0; const isDemoAccountTab = active_tab_index === 1; - const getDemoMT5 = () => { - return getSortedCFDList(props.mt5_login_list).filter(isDemo); - }; - - const getDemoDXTrade = () => { - return getSortedCFDList(props.dxtrade_accounts_list).filter( - account => isDemo(account) && account.enabled === 1 - ); - }; - - const getRemainingDemoMT5 = () => { - return getRemainingAccounts( - getDemoMT5(), - CFD_PLATFORMS.MT5, - props.show_eu_related_content, - true, - props.isEligibleForMoreDemoMt5Svg - ); - }; - - const getRemainingDemoDXTrade = () => { - return getRemainingAccounts(getDemoDXTrade(), CFD_PLATFORMS.DXTRADE, props.show_eu_related_content, true); - }; - const getRealMT5 = () => { - const low_risk_non_eu = props.content_flag === ContentFlag.LOW_RISK_CR_NON_EU; + const low_risk_non_eu = content_flag === ContentFlag.LOW_RISK_CR_NON_EU; if (low_risk_non_eu) { - return getSortedCFDList(props.mt5_login_list).filter( + return getSortedCFDList(mt5_login_list).filter( account => !isDemo(account) && account.landing_company_short !== 'maltainvest' ); } - return getSortedCFDList(props.mt5_login_list).filter(account => !isDemo(account)); - }; - - const getRealDXTrade = () => { - return getSortedCFDList(props.dxtrade_accounts_list).filter(account => - hasUnmergedAccounts(props.dxtrade_accounts_list) - ? !isDemo(account) && account.enabled === 1 && account.market_type !== 'all' - : !isDemo(account) && account.enabled === 1 && account.market_type === 'all' - ); - }; - - const findServerForAccount = acc => { - const server_name = acc.error ? acc.error.details.server : acc.server; - return props.mt5_login_list.length >= 1 - ? props.mt5_login_list.filter(account => !isDemo(account)).find(server => server.server === server_name) - : null; - }; - - const getRemainingRealMT5 = () => { - return getRemainingAccounts( - getRealMT5(), - CFD_PLATFORMS.MT5, - props.show_eu_related_content, - false, - props.isEligibleForMoreRealMt5 - ); - }; - - const getRemainingRealDXTrade = () => { - return getRemainingAccounts(getRealDXTrade(), CFD_PLATFORMS.DXTRADE, props.show_eu_related_content); + return getSortedCFDList(mt5_login_list).filter(account => !isDemo(account)); }; const canOpenMulti = () => { - if (props.available_crypto_currencies.length < 1 && !props.has_fiat) return true; - return !props.is_virtual; + if (available_crypto_currencies.length < 1 && !has_fiat) return true; + return !is_virtual; }; const is_regulated_able_to_change_currency = - props.show_eu_related_content && - (props.landing_company_shortcode === 'malta' || - (props.landing_company_shortcode === 'iom' && props.upgradeable_landing_companies.length !== 0)); + show_eu_related_content && + (landing_company_shortcode === 'malta' || + (landing_company_shortcode === 'iom' && upgradeable_landing_companies.length !== 0)); // SVG clients can't upgrade. const getRemainingRealAccounts = () => { if ( - props.show_eu_related_content || - props.is_virtual || + show_eu_related_content || + is_virtual || !canOpenMulti() || - props.is_pre_appstore || - is_regulated_able_to_change_currency + is_regulated_able_to_change_currency || + is_low_risk ) { - return props.upgradeable_landing_companies; + return upgradeable_landing_companies; } return []; }; const hasSetCurrency = () => { - return props.account_list.filter(account => !account.is_virtual).some(account => account.title !== 'Real'); - }; - - const canUpgrade = () => { - return !!(props.is_virtual && props.can_upgrade_to); - }; - - const getTotalBalanceCfd = (accounts, is_demo, exchange_rate) => { - return accounts - .filter(account => (is_demo ? isDemo(account) : !isDemo(account))) - .reduce( - (total, account) => { - total.balance += account.balance * exchange_rate; - return total; - }, - { balance: 0 } - ); + return account_list.filter(account => !account.is_virtual).some(account => account.title !== 'Real'); }; const getTotalDemoAssets = () => { - const vrtc_balance = props.accounts[vrtc_loginid] ? props.accounts[vrtc_loginid].balance : 0; - const mt5_demo_total = getTotalBalanceCfd(props.mt5_login_list, true, exchanged_rate_cfd_demo); - const dxtrade_demo_total = getTotalBalanceCfd(props.dxtrade_accounts_list, true, exchanged_rate_cfd_demo); - - const total = vrtc_balance + mt5_demo_total.balance + dxtrade_demo_total.balance; + const vrtc_balance = accounts[vrtc_loginid] ? accounts[vrtc_loginid].balance : 0; - return props.is_pre_appstore ? vrtc_balance : total; + return vrtc_balance; }; const getTotalRealAssets = () => { - // props.obj_total_balance.amount_mt5 is returning 0 regarding performance issues so we have to calculate - // the total MT5 accounts balance from props.mt5_login_list. - // You can remove this part if WS sends obj_total_balance.amount_mt5 correctly. - const mt5_total = getTotalBalanceCfd(props.mt5_login_list, false, exchanged_rate_cfd_real); - const dxtrade_total = getTotalBalanceCfd(props.dxtrade_accounts_list, false, exchanged_rate_cfd_real); - - let total = props.obj_total_balance.amount_real; - - const traders_hub_total = props.obj_total_balance.amount_real; - - total += props.obj_total_balance.amount_mt5 > 0 ? props.obj_total_balance.amount_mt5 : mt5_total.balance; - total += - props.obj_total_balance.amount_dxtrade > 0 ? props.obj_total_balance.amount_dxtrade : dxtrade_total.balance; - - return props.is_pre_appstore ? traders_hub_total : total; - }; - - const isRealMT5AddDisabled = sub_account_type => { - // disabling synthetic account creation for MLT/MF users - if (props.standpoint.malta && sub_account_type === 'synthetic') return true; - if (props.show_eu_related_content) { - const account = getAccountTypeFields({ category: 'real', type: sub_account_type }); - return props.isAccountOfTypeDisabled(account?.account_type); - } - - return !props.has_active_real_account; - }; - - const isRealDXTradeAddDisabled = sub_account_type => { - if (props.show_eu_related_content) { - const account = getAccountTypeFields({ category: 'real', type: sub_account_type }); - return props.isAccountOfTypeDisabled(account?.account_type); - } - - return !props.has_active_real_account; - }; - - if (!props.is_logged_in) return false; - - const total_assets_message_demo = () => { - if (props.is_mt5_allowed && props.is_dxtrade_allowed) { - return localize( - 'Total assets in your Deriv, {{platform_name_mt5}} and {{platform_name_dxtrade}} demo accounts.', - { platform_name_dxtrade, platform_name_mt5 } - ); - } else if (props.is_mt5_allowed && !props.is_dxtrade_allowed) { - return localize('Total assets in your Deriv and {{platform_name_mt5}} demo accounts.', { - platform_name_mt5, - }); - } else if (!props.is_mt5_allowed && props.is_dxtrade_allowed) { - return localize('Total assets in your Deriv and {{platform_name_dxtrade}} demo accounts.', { - platform_name_dxtrade, - }); - } - return localize('Total assets in your Deriv demo accounts.'); - }; - - const total_assets_message_real = () => { - if (props.is_mt5_allowed && props.is_dxtrade_allowed) { - return localize( - 'Total assets in your Deriv, {{platform_name_mt5}} and {{platform_name_dxtrade}} real accounts.', - { platform_name_dxtrade, platform_name_mt5 } - ); - } else if (props.is_mt5_allowed && !props.is_dxtrade_allowed) { - return localize('Total assets in your Deriv and {{platform_name_mt5}} real accounts.', { - platform_name_mt5, - }); - } else if (!props.is_mt5_allowed && props.is_dxtrade_allowed) { - return localize('Total assets in your Deriv and {{platform_name_dxtrade}} real accounts.', { - platform_name_dxtrade, - }); - } - return localize('Total assets in your Deriv real accounts.'); + const traders_hub_total = obj_total_balance.amount_real; + return traders_hub_total; }; - const isMT5Allowed = account_type => { - if (!props.is_mt5_allowed) return false; - - if (account_type === 'demo') { - return !!getDemoMT5().length || !!getRemainingDemoMT5().length; - } - return !!getRealMT5().length || !!getRemainingRealMT5().length; - }; - - const isDxtradeAllowed = () => { - return props.is_dxtrade_allowed; - }; + if (!is_logged_in) return false; const canResetBalance = account => { const account_init_balance = 10000; @@ -573,35 +203,15 @@ const AccountSwitcher = props => { return all_svg_acc.length > 1; }; - const traders_hub_total_assets_message = localize('Total assets in your Deriv accounts.'); - - const default_total_assets_message = isRealAccountTab ? total_assets_message_real() : total_assets_message_demo(); - - const total_assets_message = props.is_pre_appstore - ? traders_hub_total_assets_message - : default_total_assets_message; - - const can_manage_account = - !props.show_eu_related_content || (props.show_eu_related_content && props.can_change_fiat_currency); - const can_manage_account_virtual = props.is_virtual && can_manage_account && props.has_active_real_account; - const can_manage_account_multi = !canUpgrade() && canOpenMulti() && can_manage_account; - const have_more_accounts = type => - getSortedAccountList(props.account_list, props.accounts).filter( + getSortedAccountList(account_list, accounts).filter( account => !account.is_virtual && account.loginid.startsWith(type) ).length > 1; // all: 1 in mt5_status response means that server is suspended - const getIsSuspendedMt5Server = type_server => type_server?.map(item => item.all).some(item => item === 1); - - const is_suspended_mt5_demo_server = getIsSuspendedMt5Server(props.mt5_status_server?.demo); - const is_suspended_mt5_real_server = getIsSuspendedMt5Server(props.mt5_status_server?.real); - const is_suspended_dxtrade_demo_server = !!props.dxtrade_status_server?.demo; - const is_suspended_dxtrade_real_server = !!props.dxtrade_status_server?.real; - const has_cr_account = props.account_list.find(acc => acc.loginid?.startsWith('CR'))?.loginid; - const is_user_exception = props.account_settings.dxtrade_user_exception; + const has_cr_account = account_list.find(acc => acc.loginid?.startsWith('CR'))?.loginid; - const default_demo_accounts = ( + const demo_account = (
{vrtc_loginid && ( { }} >
- {getSortedAccountList(props.account_list, props.accounts) + {getSortedAccountList(account_list, accounts) .filter(account => account.is_virtual) .map(account => ( doSwitch(account.loginid)} onClickResetVirtualBalance={resetBalance} - selected_loginid={props.account_loginid} - /> - ))} -
-
- )} - {isMT5Allowed('demo') && ( - - {vrtc_loginid &&
} - { - toggleVisibility('demo_dmt5'); - }} - > - {props.is_loading_mt5 ? ( -
- -
- ) : ( - - {!!getDemoMT5().length && ( -
- {getDemoMT5().map(account => ( - redirectToMt5Demo(account.market_type)} - platform={CFD_PLATFORMS.MT5} - shortcode={ - account.market_type === 'financial' && - account.landing_company_short === 'labuan' && - account.landing_company_short - } - /> - ))} -
- )} - {getRemainingDemoMT5().map(account => ( -
- - - {account.title} - - -
- ))} -
- )} -
- - )} - {isDxtradeAllowed() && ( - <> -
- { - toggleVisibility('demo_dxtrade'); - }} - > - - {!!getDemoDXTrade().length && ( -
- {getDemoDXTrade().map(account => ( - redirectToDXTradeDemo(account.market_type)} - platform={CFD_PLATFORMS.DXTRADE} - /> - ))} -
- )} - {getRemainingDemoDXTrade().map(account => ( -
- - - {account.title} - - -
- ))} -
-
- - )} -
- ); - - const traders_hub_demo_account = ( -
- {vrtc_loginid && ( - { - toggleVisibility('demo_deriv'); - }} - > -
- {getSortedAccountList(props.account_list, props.accounts) - .filter(account => account.is_virtual) - .map(account => ( - doSwitch(account.loginid)} - onClickResetVirtualBalance={resetBalance} - selected_loginid={props.account_loginid} + selected_loginid={account_loginid} /> ))}
@@ -812,274 +249,15 @@ const AccountSwitcher = props => {
); - const default_real_accounts = ( + const real_accounts = (
- 1 ? 'accounts' : 'account'}`)} - is_visible={is_deriv_real_visible} - toggleVisibility={() => { - toggleVisibility('real_deriv'); - }} - > -
- {filtered_real_accounts.map(account => { - return ( - doSwitch(account.loginid)} - selected_loginid={props.account_loginid} - should_show_server_name={checkMultipleSvgAcc()} - /> - ); - })} -
- {!has_cr_account && - filtered_remaining_real_accounts.map((account, index) => ( -
- - - {getAccountTitle( - account, - { account_residence: props.client_residence }, - props.country_standpoint - )} - - -
- ))} - {(can_manage_account_multi || - (!props.has_active_real_account && filtered_remaining_real_accounts?.length === 0)) && ( - - )} -
-
- {isMT5Allowed('real') && ( - -
- { - toggleVisibility('real_dmt5'); - }} - > - {props.is_loading_mt5 ? ( -
- -
- ) : ( - - {!!getRealMT5().length && ( -
- {getRealMT5().map(account => ( - { - redirectToMt5Real( - account.market_type, - findServerForAccount(account) - ); - }} - server={findServerForAccount(account)} - platform={CFD_PLATFORMS.MT5} - shortcode={account.landing_company_short} - should_show_server_name={checkMultipleSvgAcc()} - /> - ))} -
- )} - {getRemainingRealMT5().map(account => ( -
- - - {account.title} - - -
- ))} -
- )} -
- - )} - {isDxtradeAllowed() && ( - -
- { - toggleVisibility('real_dxtrade'); - }} - > - {props.is_loading_dxtrade ? ( -
- -
- ) : ( - - {!!getRealDXTrade().length && ( -
- {getRealDXTrade().map(account => ( - redirectToDXTradeReal(account.market_type)} - platform={CFD_PLATFORMS.DXTRADE} - /> - ))} -
- )} - {getRemainingRealDXTrade().map(account => ( -
- - - {/* TODO: Remove the below condition once Deriv X update is released */} - {account.title === localize('Derived') - ? localize('Synthetic') - : account.title} - - -
- ))} -
- )} -
- - )} -
- ); - - const traders_hub_real_accounts = ( -
- - {!props.is_eu || props.is_low_risk ? ( + {!is_eu || is_low_risk ? ( { }} >
- {getSortedAccountList(props.account_list, props.accounts) + {getSortedAccountList(account_list, accounts) .filter(account => !account.is_virtual && account.loginid.startsWith('CR')) .map(account => { return ( doSwitch(account.loginid) } - selected_loginid={props.account_loginid} + selected_loginid={account_loginid} should_show_server_name={checkMultipleSvgAcc()} /> ); @@ -1125,17 +303,17 @@ const AccountSwitcher = props => { {getAccountTitle( account, - { account_residence: props.client_residence }, - props.country_standpoint + { account_residence: client_residence }, + country_standpoint )}
); - const real_account = props.is_pre_appstore ? traders_hub_real_accounts : default_real_accounts; - - const demo_accounts = props.is_pre_appstore ? traders_hub_demo_account : default_demo_accounts; - - const first_real_login_id = props.account_list?.find(account => /^(CR|MF)/.test(account.loginid))?.loginid; + const first_real_login_id = account_list?.find(account => /^(CR|MF)/.test(account.loginid))?.loginid; const TradersHubRedirect = () => { const TradersHubLink = () => { const handleRedirect = async () => { - if (!props.is_virtual && isDemoAccountTab) { - await props.switchAccount(props.virtual_account_loginid); - } else if (props.is_virtual && isRealAccountTab) { - await props.switchAccount(first_real_login_id); + if (!is_virtual && isDemoAccountTab) { + await switchAccount(virtual_account_loginid); + } else if (is_virtual && isRealAccountTab) { + await switchAccount(first_real_login_id); } - props.toggleAccountsDialog(false); + toggleAccountsDialog(false); history.push(routes.traders_hub); - props.setTogglePlatformType('cfd'); + setTogglePlatformType('cfd'); }; return ( @@ -1260,11 +434,10 @@ const AccountSwitcher = props => { ); }; - if (props.is_pre_appstore) { - if ((isRealAccountTab && props.has_any_real_account) || isDemoAccountTab) { - return ; - } + if ((isRealAccountTab && has_any_real_account) || isDemoAccountTab) { + return ; } + return null; }; @@ -1280,28 +453,28 @@ const AccountSwitcher = props => { into a single reusable AccountListItem component */}
- {real_account} + {real_accounts} - {real_account} + {real_accounts}
- {demo_accounts} + {demo_account} - {demo_accounts} + {demo_account}
@@ -1322,27 +495,21 @@ const AccountSwitcher = props => {
- {total_assets_message} + {localize('Total assets in your Deriv accounts.')}
-
- {props.is_pre_appstore && isRealAccountTab && props.has_active_real_account && !props.is_virtual && ( +
+ {isRealAccountTab && has_active_real_account && !is_virtual && (
@@ -128,7 +122,6 @@ Footer.propTypes = { disableApp: PropTypes.func, enableApp: PropTypes.func, footer_extensions: PropTypes.array, - is_pre_appstore: PropTypes.bool, show_eu_related_content: PropTypes.bool, }; @@ -150,7 +143,6 @@ export default withRouter( disableApp: ui.disableApp, toggleSettingsModal: ui.toggleSettingsModal, toggleLanguageSettingsModal: ui.toggleLanguageSettingsModal, - is_pre_appstore: client.is_pre_appstore, show_eu_related_content: traders_hub.show_eu_related_content, }))(Footer) ); diff --git a/packages/core/src/App/Containers/Layout/footer.jsx b/packages/core/src/App/Containers/Layout/footer.jsx index 2792780f1167..e07e21109507 100644 --- a/packages/core/src/App/Containers/Layout/footer.jsx +++ b/packages/core/src/App/Containers/Layout/footer.jsx @@ -1,13 +1,12 @@ import React from 'react'; -import { connect } from 'Stores/connect'; import { routes } from '@deriv/shared'; import DefaultFooter from './default-footer'; import TradingHubFooter from './trading-hub-footer'; import { useLocation } from 'react-router-dom'; -const Footer = ({ is_pre_appstore }) => { +const Footer = () => { const { pathname } = useLocation(); - if (is_pre_appstore && pathname !== routes.onboarding) { + if (pathname !== routes.onboarding) { return ; } else if (pathname === routes.onboarding) { return null; @@ -15,6 +14,4 @@ const Footer = ({ is_pre_appstore }) => { return ; }; -export default connect(({ client }) => ({ - is_pre_appstore: client.is_pre_appstore, -}))(Footer); +export default Footer; diff --git a/packages/core/src/App/Containers/Layout/header/default-header.jsx b/packages/core/src/App/Containers/Layout/header/default-header.jsx index 9847a92a2587..4b00bf43ecb6 100644 --- a/packages/core/src/App/Containers/Layout/header/default-header.jsx +++ b/packages/core/src/App/Containers/Layout/header/default-header.jsx @@ -1,12 +1,10 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import { DesktopWrapper, MobileWrapper, Text, Icon } from '@deriv/components'; +import { DesktopWrapper, MobileWrapper } from '@deriv/components'; import { AccountActions, MenuLinks, PlatformSwitcher } from 'App/Components/Layout/Header'; import { getDecimalPlaces, isMobile, platforms, routes } from '@deriv/shared'; import { AccountsInfoLoader } from 'App/Components/Layout/Header/Components/Preloader'; -import { BinaryLink } from 'App/Components/Routes'; -import { Localize } from '@deriv/translations'; import NewVersionNotification from 'App/Containers/new-version-notification.jsx'; import RealAccountSignup from 'App/Containers/RealAccountSignup'; import SetAccountCurrencyModal from 'App/Containers/SetAccountCurrencyModal'; @@ -45,7 +43,6 @@ const DefaultHeader = ({ openRealAccountSignup, platform, removeNotificationMessage, - setIsPreAppStore, toggleAccountsDialog, toggleNotifications, is_landing_company_loaded, @@ -82,34 +79,6 @@ const DefaultHeader = ({ return true; }); - const Divider = () => { - return
; - }; - - const ExploreTradingHub = () => { - const enablePreAppstore = () => setIsPreAppStore(true); - - return ( -
- - - - - - - -
- ); - }; - return (
- {is_logging_in - ? null - : is_logged_in && ( - - - - - )}
({ toggleNotifications: notifications.toggleNotificationsModal, is_trading_assessment_for_existing_user_enabled: ui.is_trading_assessment_for_existing_user_enabled, is_landing_company_loaded: client.is_landing_company_loaded, - setIsPreAppStore: client.setIsPreAppStore, is_switching: client.is_switching, }))(withRouter(DefaultHeader)); diff --git a/packages/core/src/App/Containers/Layout/header/dtrader-header.jsx b/packages/core/src/App/Containers/Layout/header/dtrader-header.jsx index 9ddc624fe8d9..ed9eab7b20cd 100644 --- a/packages/core/src/App/Containers/Layout/header/dtrader-header.jsx +++ b/packages/core/src/App/Containers/Layout/header/dtrader-header.jsx @@ -40,7 +40,6 @@ const DTraderHeader = ({ is_logging_in, is_mt5_allowed, is_notifications_visible, - is_pre_appstore, is_route_modal_on, is_virtual, notifications_count, @@ -103,7 +102,6 @@ const DTraderHeader = ({ @@ -203,7 +201,6 @@ DTraderHeader.propTypes = { toggleNotifications: PropTypes.func, country_standpoint: PropTypes.object, history: PropTypes.object, - is_pre_appstore: PropTypes.bool, is_switching: PropTypes.bool, toggleReadyToDepositModal: PropTypes.func, has_any_real_account: PropTypes.bool, @@ -240,7 +237,6 @@ export default connect(({ client, common, ui, notifications }) => ({ removeNotificationMessage: notifications.removeNotificationMessage, toggleAccountsDialog: ui.toggleAccountsDialog, toggleNotifications: notifications.toggleNotificationsModal, - is_pre_appstore: client.is_pre_appstore, is_switching: client.is_switching, toggleReadyToDepositModal: ui.toggleReadyToDepositModal, has_any_real_account: client.has_any_real_account, diff --git a/packages/core/src/App/Containers/Layout/header/header.jsx b/packages/core/src/App/Containers/Layout/header/header.jsx index 35046467a124..f786dd8ed9a4 100644 --- a/packages/core/src/App/Containers/Layout/header/header.jsx +++ b/packages/core/src/App/Containers/Layout/header/header.jsx @@ -7,7 +7,7 @@ import DTraderHeader from './dtrader-header.jsx'; import { connect } from 'Stores/connect'; import { useLocation } from 'react-router-dom'; -const Header = ({ is_logged_in, is_pre_appstore }) => { +const Header = ({ is_logged_in }) => { const { is_appstore } = React.useContext(PlatformContext); const { pathname } = useLocation(); const trading_hub_routes = @@ -15,7 +15,7 @@ const Header = ({ is_logged_in, is_pre_appstore }) => { if (is_appstore) { return ; - } else if (is_logged_in && is_pre_appstore) { + } else if (is_logged_in) { let result; if (trading_hub_routes) { result = ; @@ -28,11 +28,9 @@ const Header = ({ is_logged_in, is_pre_appstore }) => { } else if (pathname === routes.onboarding) { return null; } - return ; }; export default connect(({ client }) => ({ is_logged_in: client.is_logged_in, - is_pre_appstore: client.is_pre_appstore, }))(Header); diff --git a/packages/core/src/App/Containers/Layout/header/trading-hub-header.jsx b/packages/core/src/App/Containers/Layout/header/trading-hub-header.jsx index 796bc45c7d78..58af88a63f94 100644 --- a/packages/core/src/App/Containers/Layout/header/trading-hub-header.jsx +++ b/packages/core/src/App/Containers/Layout/header/trading-hub-header.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import classNames from 'classnames'; import { useHistory, withRouter } from 'react-router-dom'; import { DesktopWrapper, Icon, MobileWrapper, Popover, Text, Button } from '@deriv/components'; -import { routes, ContentFlag, platforms } from '@deriv/shared'; +import { routes, platforms } from '@deriv/shared'; import { Localize } from '@deriv/translations'; import { ToggleNotifications, MenuLinks } from 'App/Components/Layout/Header'; import platform_config from 'App/Constants/platform-config'; @@ -43,38 +43,6 @@ export const TradersHubHomeButton = ({ is_dark_mode }) => { ); }; -const RedirectToOldInterface = ({ - setIsPreAppStore, - should_show_exit_traders_modal, - toggleExitTradersHubModal, - content_flag, - switchToCRAccount, -}) => { - const history = useHistory(); - const disablePreAppstore = async () => { - if (should_show_exit_traders_modal) { - toggleExitTradersHubModal(); - } else { - if (content_flag === ContentFlag.LOW_RISK_CR_EU) { - await switchToCRAccount(); - } - setIsPreAppStore(false); - history.push(routes.root); - } - }; - return ( -
-
- - - - - -
-
- ); -}; - const TradingHubOnboarding = ({ is_dark_mode, setIsOnboardingVisited }) => { const history = useHistory(); return ( @@ -115,7 +83,6 @@ const ShowNotifications = ({ is_notifications_visible, notifications_count, togg }; const TradingHubHeader = ({ - content_flag, header_extension, is_app_disabled, is_dark_mode, @@ -130,14 +97,11 @@ const TradingHubHeader = ({ notifications_count, platform, setIsOnboardingVisited, - setIsPreAppStore, - should_show_exit_traders_modal, toggleIsTourOpen, toggleNotifications, - toggleExitTradersHubModal, - switchToCRAccount, }) => { const is_mf = loginid?.startsWith('MF'); + const filterPlatformsForClients = payload => payload.filter(config => { if (config.link_to === routes.mt5) { @@ -173,13 +137,6 @@ const TradingHubHeader = ({
-
@@ -271,12 +228,10 @@ TradingHubHeader.propTypes = { modal_data: PropTypes.object, notifications_count: PropTypes.number, platform: PropTypes.string, - setIsPreAppStore: PropTypes.func, setIsOnboardingVisited: PropTypes.func, settings_extension: PropTypes.array, should_show_exit_traders_modal: PropTypes.bool, switchToCRAccount: PropTypes.func, - toggleExitTradersHubModal: PropTypes.func, toggleIsTourOpen: PropTypes.func, toggleNotifications: PropTypes.func, }; @@ -297,9 +252,8 @@ export default connect(({ client, common, notifications, ui, traders_hub }) => ( loginid: client.loginid, platform: common.platform, setIsOnboardingVisited: traders_hub.setIsOnboardingVisited, - setIsPreAppStore: client.setIsPreAppStore, should_show_exit_traders_modal: traders_hub.should_show_exit_traders_modal, - switchToCRAccount: traders_hub.switchToCRAccount, - toggleExitTradersHubModal: ui.toggleExitTradersHubModal, toggleIsTourOpen: traders_hub.toggleIsTourOpen, + content_flag: traders_hub.content_flag, + switchToCRAccount: traders_hub.switchToCRAccount, }))(withRouter(TradingHubHeader)); diff --git a/packages/core/src/App/Containers/Layout/trading-hub-footer.jsx b/packages/core/src/App/Containers/Layout/trading-hub-footer.jsx index e3db5e1cc2e7..41dff2ebfab7 100644 --- a/packages/core/src/App/Containers/Layout/trading-hub-footer.jsx +++ b/packages/core/src/App/Containers/Layout/trading-hub-footer.jsx @@ -53,7 +53,6 @@ const TradingHubFooter = ({ settings_extension, setDarkMode, is_dark_mode, - is_pre_appstore, show_eu_related_content, }) => { let footer_extensions_left = []; @@ -117,13 +116,11 @@ const TradingHubFooter = ({ disableApp={disableApp} enableApp={enableApp} settings_extension={settings_extension} - is_pre_appstore={is_pre_appstore} /> )} @@ -150,7 +147,6 @@ TradingHubFooter.propTypes = { footer_extensions: PropTypes.array, is_dark_mode: PropTypes.bool, setDarkMode: PropTypes.func, - is_pre_appstore: PropTypes.bool, show_eu_related_content: PropTypes.bool, }; @@ -174,7 +170,6 @@ export default withRouter( toggleLanguageSettingsModal: ui.toggleLanguageSettingsModal, is_dark_mode: ui.is_dark_mode_on, setDarkMode: ui.setDarkMode, - is_pre_appstore: client.is_pre_appstore, show_eu_related_content: traders_hub.show_eu_related_content, }))(TradingHubFooter) ); diff --git a/packages/core/src/App/Containers/Modals/app-modals.jsx b/packages/core/src/App/Containers/Modals/app-modals.jsx index 1eaec82e874e..e0ac919804a9 100644 --- a/packages/core/src/App/Containers/Modals/app-modals.jsx +++ b/packages/core/src/App/Containers/Modals/app-modals.jsx @@ -8,7 +8,6 @@ import CooldownWarningModal from './cooldown-warning-modal.jsx'; import TradingAssessmentExistingUser from './trading-assessment-existing-user.jsx'; import CompletedAssessmentModal from './completed-assessment-modal.jsx'; import DerivRealAccountRequiredModal from 'App/Components/Elements/Modals/deriv-real-account-required-modal.jsx'; -import ExitTradersHubModal from './exit-traders-hub-modal'; import ReadyToDepositModal from './ready-to-deposit-modal'; import RiskAcceptTestWarningModal from './risk-accept-test-warning-modal'; @@ -76,7 +75,6 @@ const AppModals = ({ active_account_landing_company, is_deriv_account_needed_modal_visible, is_warning_scam_message_modal_visible, - is_exit_traders_hub_modal_visible, is_ready_to_deposit_modal_visible, is_trading_experience_incomplete, should_show_risk_accept_modal, @@ -152,12 +150,9 @@ const AppModals = ({ ComponentToLoad = ; } else if (is_deriv_account_needed_modal_visible) { ComponentToLoad = ; - } else if (is_exit_traders_hub_modal_visible) { - ComponentToLoad = ; } else if (should_show_risk_accept_modal) { ComponentToLoad = ; } - if (is_ready_to_deposit_modal_visible) { ComponentToLoad = ; } @@ -191,7 +186,6 @@ export default connect(({ client, ui, traders_hub }) => ({ active_account_landing_company: client.landing_company_shortcode, is_deriv_account_needed_modal_visible: ui.is_deriv_account_needed_modal_visible, is_warning_scam_message_modal_visible: ui.is_warning_scam_message_modal_visible, - is_exit_traders_hub_modal_visible: ui.is_exit_traders_hub_modal_visible, is_ready_to_deposit_modal_visible: ui.is_ready_to_deposit_modal_visible, content_flag: traders_hub.content_flag, is_trading_experience_incomplete: client.is_trading_experience_incomplete, diff --git a/packages/core/src/App/Containers/Modals/exit-traders-hub-modal/exit-traders-hub-modal.jsx b/packages/core/src/App/Containers/Modals/exit-traders-hub-modal/exit-traders-hub-modal.jsx deleted file mode 100644 index f5e42ce4125b..000000000000 --- a/packages/core/src/App/Containers/Modals/exit-traders-hub-modal/exit-traders-hub-modal.jsx +++ /dev/null @@ -1,108 +0,0 @@ -import React from 'react'; -import { useHistory } from 'react-router'; -import { connect } from 'Stores/connect'; -import { Button, DesktopWrapper, MobileDialog, MobileWrapper, Modal, Text, UILoader } from '@deriv/components'; -import { isMobile, routes, ContentFlag } from '@deriv/shared'; -import { localize } from '@deriv/translations'; - -const ExitTradersHubModal = ({ - disableApp, - enableApp, - is_exit_traders_hub_modal_visible, - toggleExitTradersHubModal, - setIsPreAppStore, - content_flag, - switchAccount, - account_list, - active_accounts, - setIsLoggingIn, -}) => { - const history = useHistory(); - - const exit_traders_hub_modal_content = ( - - {localize( - "You won't be able to see your EU account in the traditional view. The open positions in your EU account will remain open. You can switch back to this view at any time." - )} - - ); - - const ModalContent = () => { - return ( - - {exit_traders_hub_modal_content} - -