-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:binary-com/deriv-app into send-em…
…ail-logic
- Loading branch information
Showing
57 changed files
with
623 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { useStore } from '@deriv/stores'; | ||
import { useMT5AccountsList, useDxtradeAccountsList, useCtraderAccountsList } from '@deriv/api'; | ||
import { getAccountListKey, CFD_PLATFORMS, Jurisdiction } from '@deriv/shared'; | ||
|
||
type MT5AccountsList = NonNullable<ReturnType<typeof useMT5AccountsList>['data']>[number]; | ||
type DxtradeAccountsList = NonNullable<ReturnType<typeof useDxtradeAccountsList>['data']>[number]; | ||
type CtraderAccountsList = NonNullable<ReturnType<typeof useCtraderAccountsList>['data']>[number]; | ||
|
||
type TCurrentList = { | ||
[key: string]: MT5AccountsList | DxtradeAccountsList | CtraderAccountsList; | ||
}; | ||
|
||
/* | ||
This hook is used to get the existing_accounts_data | ||
*/ | ||
const useCurrentList = () => { | ||
const current_list: TCurrentList = {}; | ||
const { traders_hub } = useStore(); | ||
const { data: mt5_accounts } = useMT5AccountsList(); | ||
const { data: dxtrade_accounts } = useDxtradeAccountsList(); | ||
const { data: ctrader_accounts } = useCtraderAccountsList(); | ||
const show_eu_related_content = traders_hub.show_eu_related_content; | ||
|
||
mt5_accounts | ||
?.filter(acc => | ||
show_eu_related_content | ||
? acc.landing_company_short === Jurisdiction.MALTA_INVEST | ||
: acc.landing_company_short !== Jurisdiction.MALTA_INVEST | ||
) | ||
.forEach(account => { | ||
current_list[getAccountListKey(account, CFD_PLATFORMS.MT5, account.landing_company_short)] = { | ||
...account, | ||
}; | ||
}); | ||
|
||
dxtrade_accounts?.forEach(account => { | ||
current_list[getAccountListKey(account, CFD_PLATFORMS.DXTRADE, account.landing_company_short)] = { | ||
...account, | ||
}; | ||
}); | ||
|
||
ctrader_accounts?.forEach(account => { | ||
current_list[getAccountListKey(account, CFD_PLATFORMS.CTRADER, account.landing_company_short)] = { | ||
...account, | ||
}; | ||
}); | ||
|
||
return { current_list }; | ||
}; | ||
|
||
export default useCurrentList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.