Skip to content

Commit

Permalink
Merge branch 'master' of github.com:binary-com/deriv-app into send-em…
Browse files Browse the repository at this point in the history
…ail-logic
  • Loading branch information
adrienne-deriv committed Nov 17, 2023
2 parents 243bca3 + 479ce80 commit e9975eb
Show file tree
Hide file tree
Showing 57 changed files with 623 additions and 296 deletions.
6 changes: 0 additions & 6 deletions .github/actions/build_and_push_docker_image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ runs:
- name: Build docker image 🐳
run: docker build -t ${DOCKERHUB_ORGANISATION}/${APP_NAME}:${APP_VERSION} -t ${DOCKERHUB_ORGANISATION}/${APP_NAME}:${{ github.ref_name }} .
shell: bash
- name: Verify nginx image
run: |
set -e
docker run --rm ${DOCKERHUB_ORGANISATION}/${APP_NAME}:${{ github.ref_name }} nginx -t
echo "docker image validated successfully"
shell: bash
- name: Pushing Image to docker hub 🐳
run: |
echo ${{ inputs.DOCKERHUB_PASSWORD }}| docker login -u ${{ inputs.DOCKERHUB_USERNAME }} --password-stdin
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ jobs:
- name: Build Docker image and push to Docker hub and K8S
uses: "./.github/actions/build_and_push_docker_image"
with:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }}
K8S_NAMESPACE: ${{ secrets.K8S_NAMESPACE }}
KUBE_SERVER: ${{ secrets.KUBE_SERVER }}
Expand Down
10 changes: 6 additions & 4 deletions packages/cfd/src/Components/props.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export type TCFDPlatform = 'dxtrade' | 'mt5' | 'ctrader' | 'derivez';

export type TCFDsPlatformType = 'dxtrade' | 'derivez' | 'mt5' | 'ctrader' | '';

export type TShortcode = DetailsOfEachMT5Loginid['landing_company_short'];

export type TCFDAccountCopy = {
text: string | undefined;
className: string;
Expand Down Expand Up @@ -87,10 +89,10 @@ export type TTradingPlatformAvailableAccount = {
};
signup: string[];
};
shortcode: 'bvi' | 'labuan' | 'maltainvest' | 'svg' | 'vanuatu';
shortcode?: TShortcode;
sub_account_type: string;
account_type?: 'real' | 'demo';
landing_company_short?: 'bvi' | 'labuan' | 'svg' | 'vanuatu';
landing_company_short?: TShortcode;
};

export type TModifiedTradingPlatformAvailableAccount = Omit<TTradingPlatformAvailableAccount, 'market_type'> & {
Expand Down Expand Up @@ -235,7 +237,7 @@ export type TTradingPlatformAccounts = {
/**
* Landing company shortcode of the DXTrade account.
*/
landing_company_short?: 'bvi' | 'labuan' | 'malta' | 'maltainvest' | 'svg' | 'vanuatu';
landing_company_short?: DetailsOfEachMT5Loginid['landing_company_short'];
/**
* Login of DXTrade account.
*/
Expand Down Expand Up @@ -279,7 +281,7 @@ export type TJurisdictionData = {

export type TDetailsOfEachMT5Loginid = DetailsOfEachMT5Loginid & {
display_login?: string;
landing_company_short?: string;
landing_company_short?: TShortcode;
short_code_and_region?: string;
mt5_acc_auth_status?: string | null;
selected_mt5_jurisdiction?: TOpenAccountTransferMeta &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const CFDCompareAccountsButton = observer(({ trading_platforms, is_demo }: TComp
const history = useHistory();

const market_type = getMarketType(trading_platforms);
const market_type_shortcode = market_type.concat('_', trading_platforms.shortcode);
const market_type_shortcode = market_type.concat('_', trading_platforms.shortcode ?? '');
const {
modules: { cfd },
common,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { REGION } from '../../Helpers/cfd-config';

const CFDCompareAccountsDescription = ({ trading_platforms, is_demo }: TCompareAccountsCard) => {
const market_type = getMarketType(trading_platforms);
const market_type_shortcode = market_type.concat('_', trading_platforms.shortcode);
const market_type_shortcode = market_type.concat('_', trading_platforms.shortcode ?? '');
const juridisction_data = getJuridisctionDescription(market_type_shortcode);
const { traders_hub } = useStore();
const { selected_region } = traders_hub;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { CFD_PLATFORMS, MARKET_TYPE_SHORTCODE } from '../../Helpers/cfd-config';

const CFDCompareAccountsTitleIcon = ({ trading_platforms, is_eu_user, is_demo }: TCompareAccountsCard) => {
const market_type = !is_eu_user ? getMarketType(trading_platforms) : 'CFDs';
const market_type_shortcode = market_type.concat('_', trading_platforms.shortcode);
const market_type_shortcode = market_type.concat('_', trading_platforms.shortcode ?? '');
const jurisdiction_card_icon =
trading_platforms.platform === CFD_PLATFORMS.DXTRADE || trading_platforms.platform === CFD_PLATFORMS.CTRADER
? getAccountIcon(trading_platforms.platform)
Expand Down
2 changes: 1 addition & 1 deletion packages/cfd/src/Containers/props.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type TCFDPersonalDetailsContainerProps = {
onSubmit: (index: number, value: { [key: string]: string }) => void;
};

type CFD_Platform = 'dxtrade' | 'mt5' | 'derivez' | 'ctrader';
export type CFD_Platform = 'dxtrade' | 'mt5' | 'derivez' | 'ctrader';

export type TCFDChangePasswordConfirmationProps = {
confirm_label?: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/cfd/src/Helpers/compare-accounts-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const getHighlightedIconLabel = (
is_demo?: boolean
): TInstrumentsIcon[] => {
const market_type = getMarketType(trading_platforms);
const market_type_shortcode = market_type.concat('_', trading_platforms.shortcode);
const market_type_shortcode = market_type.concat('_', trading_platforms.shortcode ?? '');
// Forex for these: MT5 Financial Vanuatu, MT5 Financial Labuan
const forex_label =
market_type_shortcode === MARKET_TYPE_SHORTCODE.FINANCIAL_LABUAN ||
Expand Down
51 changes: 51 additions & 0 deletions packages/cfd/src/features/hooks/useCurrentList.ts
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;
14 changes: 14 additions & 0 deletions packages/shared/src/utils/contract/contract.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,17 @@ export const getLocalizedTurbosSubtype = (contract_type = '') => {
<Localize i18n_default_text='Short' />
);
};

export const clickAndKeyEventHandler = (
callback: () => void,
e?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>
) => {
if (e) {
e.preventDefault();
if (e.type !== 'keydown' || (e.type === 'keydown' && (e as React.KeyboardEvent).key === 'Enter')) {
callback();
}
} else {
callback();
}
};
4 changes: 2 additions & 2 deletions packages/stores/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ type TTradingPlatformAvailableAccount = {
};
signup: string[];
};
shortcode: 'bvi' | 'labuan' | 'svg' | 'vanuatu' | 'maltainvest';
shortcode?: DetailsOfEachMT5Loginid['landing_company_short'];
sub_account_type: string;
};

Expand Down Expand Up @@ -884,7 +884,7 @@ type TTradersHubStore = {
action_type: 'get' | 'none' | 'trade' | 'dxtrade' | 'multi-action';
key: string;
name: string;
landing_company_short?: 'bvi' | 'labuan' | 'svg' | 'vanuatu' | 'maltainvest';
landing_company_short?: DetailsOfEachMT5Loginid['landing_company_short'];
platform?: TPlatform;
availability?: TRegionAvailability;
description?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,58 @@ import React from 'react';
import { Localize } from '@deriv/translations';
import { Text } from '@deriv/components';

const AccumulatorTradeDescription = ({ onClick }: { onClick: React.MouseEventHandler<HTMLSpanElement> }) => {
const AccumulatorTradeDescription = ({
onClick,
}: {
onClick: (e?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;
}) => {
const content = [
<Localize
i18n_default_text='Accumulators allow you to express a view on the range of movement of an index and grow your stake exponentially at a fixed <0>growth rate</0>.'
components={[<span className='contract-type-info__content-definition' onClick={onClick} key={0} />]}
components={[
<span
className='contract-type-info__content-definition'
onClick={onClick}
onKeyDown={onClick}
key={0}
/>,
]}
key='1'
/>,
<Localize
i18n_default_text='Your <0>payout</0> is the sum of your initial stake and profit.'
components={[<span className='contract-type-info__content-definition' onClick={onClick} key={0} />]}
components={[
<span
className='contract-type-info__content-definition'
onClick={onClick}
onKeyDown={onClick}
key={0}
/>,
]}
key='2'
/>,
<Localize
i18n_default_text='Your stake will continue to grow as long as the current spot price remains within a specified <0>range</0> from the <0>previous spot price</0>. Otherwise, you lose your stake and the trade is terminated.'
components={[<span className='contract-type-info__content-definition' onClick={onClick} key={0} />]}
components={[
<span
className='contract-type-info__content-definition'
onClick={onClick}
onKeyDown={onClick}
key={0}
/>,
]}
key='3'
/>,
<Localize
i18n_default_text='You can close your trade anytime. However, be aware of <0>slippage risk</0>.'
components={[<span className='contract-type-info__content-definition' onClick={onClick} key={0} />]}
components={[
<span
className='contract-type-info__content-definition'
onClick={onClick}
onKeyDown={onClick}
key={0}
/>,
]}
key='4'
/>,
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const MultiplierTradeDescription = ({
onClick,
}: {
is_multiplier_fx?: boolean;
onClick: React.MouseEventHandler<HTMLSpanElement>;
onClick: (e?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;
}) => {
const content = [
<Localize
Expand All @@ -26,27 +26,55 @@ const MultiplierTradeDescription = ({
/>,
<Localize
i18n_default_text='Your contract will be closed when the <0>stop out</0> level is reached.'
components={[<span className='contract-type-info__content-definition' onClick={onClick} key={0} />]}
components={[
<span
className='contract-type-info__content-definition'
onClick={onClick}
onKeyDown={onClick}
key={0}
/>,
]}
key='4'
/>,
{
content: is_multiplier_fx ? (
<Localize
i18n_default_text='Additional features are available to manage your positions: “<0>Take profit</0>” and “<0>Stop loss</0>” allow you to adjust your level of risk aversion.'
components={[<span className='contract-type-info__content-definition' onClick={onClick} key={0} />]}
components={[
<span
className='contract-type-info__content-definition'
onClick={onClick}
onKeyDown={onClick}
key={0}
/>,
]}
key='5'
/>
) : (
<Localize
i18n_default_text='Additional features are available to manage your positions: “<0>Take profit</0>”, “<0>Stop loss</0>” and “<0>Deal cancellation</0>” allow you to adjust your level of risk aversion.'
components={[<span className='contract-type-info__content-definition' onClick={onClick} key={0} />]}
components={[
<span
className='contract-type-info__content-definition'
onClick={onClick}
onKeyDown={onClick}
key={0}
/>,
]}
key='5'
/>
),
},
<Localize
i18n_default_text='You can close your trade anytime. However, be aware of <0>slippage risk</0>.'
components={[<span className='contract-type-info__content-definition' onClick={onClick} key={0} />]}
components={[
<span
className='contract-type-info__content-definition'
onClick={onClick}
onKeyDown={onClick}
key={0}
/>,
]}
key='6'
/>,
] as Array<JSX.Element & { content: JSX.Element }>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import React from 'react';
import { Localize } from '@deriv/translations';
import { Text } from '@deriv/components';

const TurbosTradeDescription = ({ onClick }: { onClick: React.MouseEventHandler<HTMLSpanElement> }) => {
const TurbosTradeDescription = ({
onClick,
}: {
onClick: (e?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;
}) => {
const content = [
{
text: (
Expand All @@ -13,7 +17,14 @@ const TurbosTradeDescription = ({ onClick }: { onClick: React.MouseEventHandler<
text: (
<Localize
i18n_default_text='You receive a <0>payout</0> at <0>expiry</0> if the spot price never touches or breaches the <0>barrier</0> during the contract period. If it does, your contract will be terminated early.'
components={[<span className='contract-type-info__content-definition' onClick={onClick} key={0} />]}
components={[
<span
className='contract-type-info__content-definition'
onClick={onClick}
onKeyDown={onClick}
key={0}
/>,
]}
/>
),
},
Expand All @@ -29,15 +40,29 @@ const TurbosTradeDescription = ({ onClick }: { onClick: React.MouseEventHandler<
text: (
<Localize
i18n_default_text='Your payout is equal to the <0>payout per point</0> multiplied by the difference between the <0>final price</0> and the barrier. You will only earn a profit if your payout is higher than your initial stake.'
components={[<span className='contract-type-info__content-definition' onClick={onClick} key={0} />]}
components={[
<span
className='contract-type-info__content-definition'
onClick={onClick}
onKeyDown={onClick}
key={0}
/>,
]}
/>
),
},
{
text: (
<Localize
i18n_default_text='You may sell the contract up to 15 seconds before expiry. If you do, we’ll pay you the <0>contract value</0>.'
components={[<span className='contract-type-info__content-definition' onClick={onClick} key={0} />]}
components={[
<span
className='contract-type-info__content-definition'
onClick={onClick}
onKeyDown={onClick}
key={0}
/>,
]}
/>
),
},
Expand Down
Loading

0 comments on commit e9975eb

Please sign in to comment.