diff --git a/src/cfd/components/MT5PlatformsList/MT5PlatformsList.tsx b/src/cfd/components/MT5PlatformsList/MT5PlatformsList.tsx index 6d81278..b860a83 100644 --- a/src/cfd/components/MT5PlatformsList/MT5PlatformsList.tsx +++ b/src/cfd/components/MT5PlatformsList/MT5PlatformsList.tsx @@ -18,7 +18,7 @@ export const MT5PlatformsList = () => { return ( {!isAuthorized && } - {!isFetchedAfterMount && isAuthorized && ( + {!isFetchedAfterMount && (
diff --git a/src/cfd/flows/CTrader/AddedCTraderAccountsList/AddedCTraderAccountsList.tsx b/src/cfd/flows/CTrader/AddedCTraderAccountsList/AddedCTraderAccountsList.tsx index c27dce5..2522e4e 100644 --- a/src/cfd/flows/CTrader/AddedCTraderAccountsList/AddedCTraderAccountsList.tsx +++ b/src/cfd/flows/CTrader/AddedCTraderAccountsList/AddedCTraderAccountsList.tsx @@ -5,6 +5,7 @@ import { Button, Text } from '@deriv-com/ui'; import { URLUtils } from '@deriv-com/utils'; import { IconComponent, TradingAccountCard } from '@/components'; +import { derivUrls } from '@/helpers'; import { getCfdsAccountTitle } from '@/helpers/cfdsAccountHelpers'; import { useActiveDerivTradingAccount, useCtraderAccountsList, useQueryParams } from '@/hooks'; import { useCFDContext } from '@/providers'; @@ -43,7 +44,7 @@ export const AddedCTraderAccountsList = () => { openModal('TopUpModal'); } - // else transferModal; + window.location.href = `${derivUrls.DERIV_APP_PRODUCTION}/cashier/account-transfer`; }} variant='outlined' size='sm' diff --git a/src/cfd/flows/MT5/AddedMT5AccountsList/AddedMT5AccountsList.tsx b/src/cfd/flows/MT5/AddedMT5AccountsList/AddedMT5AccountsList.tsx index b68a16f..5bf6ca4 100644 --- a/src/cfd/flows/MT5/AddedMT5AccountsList/AddedMT5AccountsList.tsx +++ b/src/cfd/flows/MT5/AddedMT5AccountsList/AddedMT5AccountsList.tsx @@ -2,7 +2,7 @@ import { CFDPlatforms, MarketType, MarketTypeDetails } from '@cfd/constants'; import { Button, Text } from '@deriv-com/ui'; import { TradingAccountCard } from '@/components'; -import { getCfdsAccountTitle } from '@/helpers'; +import { derivUrls, getCfdsAccountTitle } from '@/helpers'; import { useActiveDerivTradingAccount, useQueryParams, useRegulationFlags } from '@/hooks'; import { useCFDContext } from '@/providers'; import { THooks } from '@/types'; @@ -35,7 +35,7 @@ export const AddedMT5AccountsList = ({ account }: { account: THooks.MT5AccountsL }); openModal('TopUpModal'); } - // else transferModal; + window.location.href = `${derivUrls.DERIV_APP_PRODUCTION}/cashier/account-transfer`; }} variant='outlined' size='sm' diff --git a/src/cfd/flows/OtherCFDs/Dxtrade/AddedDxtradeAccountsList/AddedDxtradeAccountsList.tsx b/src/cfd/flows/OtherCFDs/Dxtrade/AddedDxtradeAccountsList/AddedDxtradeAccountsList.tsx index 7e06b1c..415db22 100644 --- a/src/cfd/flows/OtherCFDs/Dxtrade/AddedDxtradeAccountsList/AddedDxtradeAccountsList.tsx +++ b/src/cfd/flows/OtherCFDs/Dxtrade/AddedDxtradeAccountsList/AddedDxtradeAccountsList.tsx @@ -5,6 +5,7 @@ import { Button, Text } from '@deriv-com/ui'; import { URLUtils } from '@deriv-com/utils'; import { IconComponent, TradingAccountCard } from '@/components'; +import { derivUrls } from '@/helpers'; import { getCfdsAccountTitle } from '@/helpers/cfdsAccountHelpers'; import { useActiveDerivTradingAccount, useDxtradeAccountsList, useQueryParams } from '@/hooks'; import { useCFDContext } from '@/providers'; @@ -42,7 +43,7 @@ export const AddedDxtradeAccountsList = () => { }); openModal('TopUpModal'); } - // else transferModal; + window.location.href = `${derivUrls.DERIV_APP_PRODUCTION}/cashier/account-transfer`; }} variant='outlined' size='sm' diff --git a/src/cfd/screens/CFDCompareAccounts/CompareAccountsButton.tsx b/src/cfd/screens/CFDCompareAccounts/CompareAccountsButton.tsx deleted file mode 100644 index 66e9023..0000000 --- a/src/cfd/screens/CFDCompareAccounts/CompareAccountsButton.tsx +++ /dev/null @@ -1,130 +0,0 @@ -import { useEffect, useMemo } from 'react'; - -import { Category, CFDPlatforms, MarketType } from '@cfd/constants'; -import { Button } from '@deriv-com/ui'; - -import { - useActiveDerivTradingAccount, - useAuthentication, - useCreateOtherCFDAccount, - useMT5AccountsList, - useQueryParams, - useSettings, -} from '@/hooks'; -import { THooks, TPlatforms } from '@/types'; - -import { - getAccountVerificationStatus, - shouldRestrictBviAccountCreation, - shouldRestrictVanuatuAccountCreation, -} from './CompareAccountsConfig'; - -type TCompareAccountButton = { - isAccountAdded: boolean; - platform: TPlatforms.All; - shortCode: THooks.AvailableMT5Accounts['shortcode']; -}; - -/* - * This is a button component for Compare Accounts that is used to add a CFD account. -@params {boolean} isAccountAdded - Whether the account is added or not. -@params {string} platform - The platform of the account. -@params {string} shortCode - The short code of the account. -@params {string} marketType - The market type of the account. //Removed for now as it is needed by Verification flow - */ -const CompareAccountsButton = ({ isAccountAdded, platform, shortCode }: TCompareAccountButton) => { - const { openModal } = useQueryParams(); - - const { data: accountSettings } = useSettings(); - const { data: authenticationInfo } = useAuthentication(); - const { - error: createAccountError, - isSuccess: isAccountCreated, - mutate: createAccount, - } = useCreateOtherCFDAccount(); - const { data: mt5Accounts } = useMT5AccountsList(); - const { data: activeTradingAccount } = useActiveDerivTradingAccount(); - - const { is_virtual: isDemo = false } = activeTradingAccount ?? {}; - - const { - account_opening_reason: accountOpeningReason, - citizen, - place_of_birth: placeOfBirth, - tax_identification_number: taxIdentificationNumber, - tax_residence: taxResidence, - } = accountSettings; - - const hasSubmittedPersonalDetails = !!( - citizen && - placeOfBirth && - taxResidence && - taxIdentificationNumber && - accountOpeningReason - ); - - const restrictBviAccountCreation = useMemo( - () => shouldRestrictBviAccountCreation(mt5Accounts ?? []), - [mt5Accounts] - ); - - const restrictVanuatuAccountCreation = useMemo( - () => shouldRestrictVanuatuAccountCreation(mt5Accounts ?? []), - [mt5Accounts] - ); - - const isAccountStatusVerified = getAccountVerificationStatus( - shortCode, - restrictBviAccountCreation, - restrictVanuatuAccountCreation, - hasSubmittedPersonalDetails, - authenticationInfo, - !!isDemo - ); - - useEffect(() => { - if (isAccountCreated) { - openModal('CTraderSuccessModal'); - } - if (createAccountError) { - // Error Component to be implemented - openModal('DummyComponentModal'); - } - }, [createAccountError, isAccountCreated, isDemo, openModal]); - - const onClickAdd = () => { - if (platform === CFDPlatforms.MT5) { - // Going to remove Placeholder once Verification flow is implemented - if (isAccountStatusVerified) return; - - if (isAccountStatusVerified) { - openModal('MT5PasswordModal'); - } else { - openModal('DummyComponentModal'); - } - } else if (platform === CFDPlatforms.DXTRADE) { - openModal('DxtradePasswordModal'); - } else { - createAccount({ - account_type: isDemo ? Category.DEMO : Category.REAL, - market_type: MarketType.ALL, - platform: CFDPlatforms.CTRADER, - }); - } - }; - return ( -
- -
- ); -}; - -export default CompareAccountsButton; diff --git a/src/cfd/screens/CFDCompareAccounts/CompareAccountsCard.tsx b/src/cfd/screens/CFDCompareAccounts/CompareAccountsCard.tsx index 343487e..ea4424f 100644 --- a/src/cfd/screens/CFDCompareAccounts/CompareAccountsCard.tsx +++ b/src/cfd/screens/CFDCompareAccounts/CompareAccountsCard.tsx @@ -5,7 +5,6 @@ import { THooks, TPlatforms } from '@/types'; import { CFDPlatforms } from '../../constants'; -import CompareAccountsButton from './CompareAccountsButton'; import CompareAccountsDescription from './CompareAccountsDescription'; import CompareAccountsPlatformLabel from './CompareAccountsPlatformLabel'; import CompareAccountsTitleIcon from './CompareAccountsTitleIcon'; @@ -18,7 +17,7 @@ type TCompareAccountsCard = { shortCode: THooks.AvailableMT5Accounts['shortcode']; }; -const CompareAccountsCard = ({ isAccountAdded, marketType, platform, shortCode }: TCompareAccountsCard) => { +const CompareAccountsCard = ({ marketType, platform, shortCode }: TCompareAccountsCard) => { const { regulationFlags } = useRegulationFlags(); const { isEU } = regulationFlags; @@ -43,13 +42,6 @@ const CompareAccountsCard = ({ isAccountAdded, marketType, platform, shortCode } )} - ); diff --git a/src/cfd/screens/CFDCompareAccounts/CompareAccountsDescription.tsx b/src/cfd/screens/CFDCompareAccounts/CompareAccountsDescription.tsx index cc838b4..ff7ade7 100644 --- a/src/cfd/screens/CFDCompareAccounts/CompareAccountsDescription.tsx +++ b/src/cfd/screens/CFDCompareAccounts/CompareAccountsDescription.tsx @@ -33,7 +33,7 @@ const CompareAccountsDescription = ({ marketType, shortCode }: TCompareAccountsD } = getJurisdictionDescription(marketTypeShortCode ?? ''); return ( -
+
{'Up to'} {leverage} diff --git a/src/cfd/screens/CFDCompareAccounts/CompareAccountsHeader.tsx b/src/cfd/screens/CFDCompareAccounts/CompareAccountsHeader.tsx index 311c711..a886a3f 100644 --- a/src/cfd/screens/CFDCompareAccounts/CompareAccountsHeader.tsx +++ b/src/cfd/screens/CFDCompareAccounts/CompareAccountsHeader.tsx @@ -1,4 +1,4 @@ -import { Link, useNavigate } from 'react-router-dom'; +import { useNavigate } from 'react-router-dom'; import { LabelPairedArrowLeftMdFillIcon, LabelPairedXmarkLgRegularIcon } from '@deriv/quill-icons'; import { Text } from '@deriv-com/ui'; @@ -18,17 +18,15 @@ const CompareAccountsHeader = () => { const headerTitle = isEU ? `Deriv MT5 CFDs ${accountType} account` : `Compare CFDs ${demoSuffix}accounts`; return ( -
+
-
+
navigate('/')}> - - Trader's Hub - + Trader's Hub
- + {headerTitle}
diff --git a/src/cfd/screens/CFDCompareAccounts/CompareAccountsScreen.tsx b/src/cfd/screens/CFDCompareAccounts/CompareAccountsScreen.tsx index 910fc33..c70eb53 100644 --- a/src/cfd/screens/CFDCompareAccounts/CompareAccountsScreen.tsx +++ b/src/cfd/screens/CFDCompareAccounts/CompareAccountsScreen.tsx @@ -13,7 +13,7 @@ const CompareAccountsScreen = () => { const { mt5Accounts } = compareAccounts; return ( -
+
diff --git a/src/cfd/screens/CFDCompareAccounts/InstrumentsLabelHighlighted.tsx b/src/cfd/screens/CFDCompareAccounts/InstrumentsLabelHighlighted.tsx index 7af1126..d065364 100644 --- a/src/cfd/screens/CFDCompareAccounts/InstrumentsLabelHighlighted.tsx +++ b/src/cfd/screens/CFDCompareAccounts/InstrumentsLabelHighlighted.tsx @@ -1,4 +1,4 @@ -import { useActiveDerivTradingAccount, useRegulationFlags } from '@/hooks'; +import { useRegulationFlags } from '@/hooks'; import { THooks, TPlatforms } from '@/types'; import { getHighlightedIconLabel } from './CompareAccountsConfig'; @@ -11,15 +11,13 @@ type TInstrumentsLabelHighlighted = { }; const InstrumentsLabelHighlighted = ({ marketType, platform, shortCode }: TInstrumentsLabelHighlighted) => { - const { data: activeDerivTrading } = useActiveDerivTradingAccount(); const { regulationFlags } = useRegulationFlags(); const { isEU: isEuRegion } = regulationFlags; - const isDemo = activeDerivTrading?.is_virtual; const iconData = [...getHighlightedIconLabel(platform, isEuRegion, marketType, shortCode)]; return (
{iconData.map(item => ( diff --git a/src/components/Clipboard/Clipboard.tsx b/src/components/Clipboard/Clipboard.tsx index 3f94e21..30ac396 100644 --- a/src/components/Clipboard/Clipboard.tsx +++ b/src/components/Clipboard/Clipboard.tsx @@ -47,13 +47,15 @@ export const Clipboard = ({ textCopy, tooltip }: TClipboardProps) => { return ( - +
+ +
); }; diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index 48b7470..a032987 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -2,6 +2,8 @@ import { useAuthData } from '@deriv-com/api-hooks'; import { Button } from '@deriv-com/ui'; import { URLUtils } from '@deriv-com/utils'; +import { derivUrls } from '@/helpers'; + import { IconComponent } from '..'; export const Header = () => { @@ -11,13 +13,15 @@ export const Header = () => { return (
- { - window.location.href = '/'; + window.location.href = derivUrls.DERIV_COM_PRODUCTION; }} - className='cursor-pointer' - /> + target='_blank' + rel='noopener noreferrer' + > + + {!(isAuthorized || activeLoginid) ? (