{getContractTypeDisplay(type, is_high_low) || ''}
{displayed_trade_param && (
{displayed_trade_param}
diff --git a/packages/components/src/components/contract-card/contract-card.scss b/packages/components/src/components/contract-card/contract-card.scss
index e4f823fa739b..cd0835ccdeca 100644
--- a/packages/components/src/components/contract-card/contract-card.scss
+++ b/packages/components/src/components/contract-card/contract-card.scss
@@ -228,6 +228,12 @@
}
&__symbol {
margin-left: 0.4rem;
+ &--ups-downs {
+ width: 7rem;
+ @include mobile {
+ width: initial;
+ }
+ }
}
&__header {
display: flex;
@@ -570,6 +576,10 @@
line-height: 1.5;
text-align: left;
+ &--ups-downs {
+ width: 7rem;
+ }
+
&-trade-param {
font-size: 1rem;
line-height: 1rem;
diff --git a/packages/components/src/components/positions-drawer-card/positions-drawer-card.tsx b/packages/components/src/components/positions-drawer-card/positions-drawer-card.tsx
index 0a5d122c999c..c68fd8834018 100644
--- a/packages/components/src/components/positions-drawer-card/positions-drawer-card.tsx
+++ b/packages/components/src/components/positions-drawer-card/positions-drawer-card.tsx
@@ -93,8 +93,8 @@ const PositionsDrawerCard = ({
const has_ended = !!getEndTime(contract_info);
const is_mobile = isMobile();
const contract_card_classname = classNames('dc-contract-card', {
- 'dc-contract-card--green': !is_accumulator && !is_multiplier && profit_loss > 0 && !result,
- 'dc-contract-card--red': !is_accumulator && !is_multiplier && profit_loss < 0 && !result,
+ 'dc-contract-card--green': profit_loss > 0 && !result,
+ 'dc-contract-card--red': profit_loss < 0 && !result,
});
const loader_el = (
diff --git a/packages/components/stories/contract-card/statics/contract.js b/packages/components/stories/contract-card/statics/contract.js
index f30a52cf9415..cdd2501ea056 100644
--- a/packages/components/stories/contract-card/statics/contract.js
+++ b/packages/components/stories/contract-card/statics/contract.js
@@ -171,14 +171,6 @@ export const getUnsupportedContracts = () => ({
name: 'Spread Down',
position: 'bottom',
},
- RUNHIGH: {
- name: 'Only Ups',
- position: 'top',
- },
- RUNLOW: {
- name: 'Only Downs',
- position: 'bottom',
- },
});
export const getSupportedContracts = is_high_low => ({
@@ -243,6 +235,14 @@ export const getSupportedContracts = is_high_low => ({
name: 'Down',
position: 'bottom',
},
+ RUNHIGH: {
+ name: 'Only Ups',
+ position: 'top',
+ },
+ RUNLOW: {
+ name: 'Only Downs',
+ position: 'bottom',
+ },
});
export const getContractConfig = is_high_low => ({
diff --git a/packages/core/src/Constants/contract.js b/packages/core/src/Constants/contract.js
index 578efc82df9e..f5873f7c3a9d 100644
--- a/packages/core/src/Constants/contract.js
+++ b/packages/core/src/Constants/contract.js
@@ -158,14 +158,6 @@ export const getUnsupportedContracts = () => ({
name: localize('Put Spread'),
position: 'bottom',
},
- RUNHIGH: {
- name: localize('Only Ups'),
- position: 'top',
- },
- RUNLOW: {
- name: localize('Only Downs'),
- position: 'bottom',
- },
});
export const getSupportedContracts = is_high_low => ({
@@ -222,6 +214,14 @@ export const getSupportedContracts = is_high_low => ({
name: localize('No Touch'),
position: 'bottom',
},
+ RUNHIGH: {
+ name: localize('Only Ups'),
+ position: 'top',
+ },
+ RUNLOW: {
+ name: localize('Only Downs'),
+ position: 'bottom',
+ },
});
export const getContractConfig = is_high_low => ({
diff --git a/packages/core/src/Stores/Helpers/chart-marker-helpers.js b/packages/core/src/Stores/Helpers/chart-marker-helpers.js
index 86f17feeb097..3b3ce5483645 100644
--- a/packages/core/src/Stores/Helpers/chart-marker-helpers.js
+++ b/packages/core/src/Stores/Helpers/chart-marker-helpers.js
@@ -3,6 +3,7 @@ import {
formatMoney,
getEndTime,
isAccumulatorContract,
+ isOnlyUpsDownsContract,
isDesktop,
isDigitContract,
isMobile,
@@ -24,7 +25,8 @@ const createMarkerConfig = (marker_type, x, y, content_config) =>
export const getSpotCount = (contract_info, spot_count) => {
if (isDigitContract(contract_info.contract_type)) return spot_count + 1;
- if (isAccumulatorContract(contract_info.contract_type)) return null;
+ if (isAccumulatorContract(contract_info.contract_type) || isOnlyUpsDownsContract(contract_info.contract_type))
+ return null;
return spot_count;
};
diff --git a/packages/core/src/Stores/Helpers/chart-markers.js b/packages/core/src/Stores/Helpers/chart-markers.js
index 128d2799271d..5f42bfaa3f5e 100644
--- a/packages/core/src/Stores/Helpers/chart-markers.js
+++ b/packages/core/src/Stores/Helpers/chart-markers.js
@@ -7,7 +7,14 @@ import {
createMarkerSpotMiddle,
getSpotCount,
} from './chart-marker-helpers';
-import { getEndTime, isAccumulatorContract, isAccumulatorContractOpen, isOpen, unique } from '@deriv/shared';
+import {
+ getEndTime,
+ isAccumulatorContract,
+ isAccumulatorContractOpen,
+ isOnlyUpsDownsContract,
+ isOpen,
+ unique,
+} from '@deriv/shared';
import { MARKER_TYPES_CONFIG } from '../Constants/markers';
import { getChartType } from './logic';
@@ -67,6 +74,7 @@ const addLabelAlignment = (tick, idx, arr) => {
export const createTickMarkers = (contract_info, is_delayed_markers_update) => {
const is_accumulator = isAccumulatorContract(contract_info.contract_type);
+ const is_only_ups_downs = isOnlyUpsDownsContract(contract_info.contract_type);
const is_accu_contract_closed = is_accumulator && !isOpen(contract_info);
const available_ticks = (is_accumulator && contract_info.audit_details?.all_ticks) || contract_info.tick_stream;
const tick_stream = unique(available_ticks, 'epoch').map(addLabelAlignment);
@@ -93,8 +101,9 @@ export const createTickMarkers = (contract_info, is_delayed_markers_update) => {
+_tick.epoch === +contract_info.exit_tick_time ||
getSpotCount(contract_info, _idx) === contract_info.tick_count;
const is_exit_spot = isExitSpot(tick, idx);
+ const is_current_last_spot = idx === tick_stream.length - 1;
const exit_spot_index = tick_stream.findIndex(isExitSpot);
- const is_accu_current_last_spot = is_accumulator && !is_exit_spot && idx === tick_stream.length - 1;
+ const is_accu_current_last_spot = is_accumulator && !is_exit_spot && is_current_last_spot;
const is_accu_preexit_spot =
is_accumulator && (is_accu_contract_closed ? idx === exit_spot_index - 1 : idx === tick_stream.length - 2);
@@ -107,6 +116,13 @@ export const createTickMarkers = (contract_info, is_delayed_markers_update) => {
tick.align_label = 'top'; // force exit spot label to be 'top' to avoid overlapping
marker_config = createMarkerSpotExit(contract_info, tick, idx);
}
+ if (is_only_ups_downs && is_middle_spot) {
+ const spot_className = marker_config.content_config.spot_className;
+ marker_config.content_config.spot_className = `${spot_className} ${spot_className}--only-ups-downs-middle`;
+ if (!is_current_last_spot) {
+ marker_config.content_config.is_value_hidden = true;
+ }
+ }
if (is_accumulator) {
if ((is_accu_current_last_spot || is_exit_spot) && !is_accu_contract_closed) return;
if (marker_config && (is_middle_spot || is_exit_spot)) {
diff --git a/packages/reports/src/sass/app/modules/smart-chart.scss b/packages/reports/src/sass/app/modules/smart-chart.scss
index f31c236932e1..fcc182c30979 100644
--- a/packages/reports/src/sass/app/modules/smart-chart.scss
+++ b/packages/reports/src/sass/app/modules/smart-chart.scss
@@ -56,7 +56,8 @@
width: 16px;
height: 16px;
}
- &--accumulator {
+ &--accumulator,
+ &--only-ups-downs {
&-middle,
&-middle--preexit {
width: 6px;
diff --git a/packages/shared/src/utils/constants/contract.tsx b/packages/shared/src/utils/constants/contract.tsx
index f8bd4a8b309b..1ad120d30033 100644
--- a/packages/shared/src/utils/constants/contract.tsx
+++ b/packages/shared/src/utils/constants/contract.tsx
@@ -379,14 +379,6 @@ export const getUnsupportedContracts = () => ({
name: localize('Spread Down'),
position: 'bottom',
},
- RUNHIGH: {
- name: localize('Only Ups'),
- position: 'top',
- },
- RUNLOW: {
- name: localize('Only Downs'),
- position: 'bottom',
- },
});
export const getSupportedContracts = (is_high_low?: boolean) => ({
@@ -459,6 +451,14 @@ export const getSupportedContracts = (is_high_low?: boolean) => ({
name:
,
position: 'bottom',
},
+ RUNHIGH: {
+ name: localize('Only Ups'),
+ position: 'top',
+ },
+ RUNLOW: {
+ name: localize('Only Downs'),
+ position: 'bottom',
+ },
});
export const getContractConfig = (is_high_low?: boolean) => ({
diff --git a/packages/shared/src/utils/contract/contract.ts b/packages/shared/src/utils/contract/contract.ts
index 9d4298f7b778..9617f4b02466 100644
--- a/packages/shared/src/utils/contract/contract.ts
+++ b/packages/shared/src/utils/contract/contract.ts
@@ -57,11 +57,13 @@ export const isAccumulatorContractOpen = (contract_info: TContractInfo = {}) =>
return isAccumulatorContract(contract_info.contract_type) && getContractStatus(contract_info) === 'open';
};
-export const isMultiplierContract = (contract_type: string) => /MULT/i.test(contract_type);
+export const isMultiplierContract = (contract_type = '') => /MULT/i.test(contract_type);
-export const isVanillaContract = (contract_type: string) => /VANILLA/i.test(contract_type);
+export const isVanillaContract = (contract_type = '') => /VANILLA/i.test(contract_type);
-export const isCryptoContract = (underlying: string) => /^cry/.test(underlying);
+export const isOnlyUpsDownsContract = (contract_type = '') => /RUN/i.test(contract_type);
+
+export const isCryptoContract = (underlying = '') => underlying.startsWith('cry');
export const getAccuBarriersDefaultTimeout = (symbol: string) => {
return symbols_2s.includes(symbol) ? DELAY_TIME_1S_SYMBOL * 2 : DELAY_TIME_1S_SYMBOL;
@@ -192,6 +194,6 @@ export const getContractUpdateConfig = ({ contract_update, limit_order }: TContr
};
};
-export const shouldShowExpiration = (symbol: string) => /^cry/.test(symbol);
+export const shouldShowExpiration = (symbol = '') => symbol.startsWith('cry');
export const shouldShowCancellation = (symbol = '') => !/^(cry|CRASH|BOOM|stpRNG|WLD|JD)/.test(symbol);
diff --git a/packages/trader/src/App/Components/Elements/ContractAudit/contract-audit.jsx b/packages/trader/src/App/Components/Elements/ContractAudit/contract-audit.jsx
index 8d0698f60150..42c4dd8538d8 100644
--- a/packages/trader/src/App/Components/Elements/ContractAudit/contract-audit.jsx
+++ b/packages/trader/src/App/Components/Elements/ContractAudit/contract-audit.jsx
@@ -11,6 +11,7 @@ const ContractAudit = ({
has_result,
is_accumulator,
is_multiplier,
+ is_only_ups_downs,
toggleHistoryTab,
...props
}) => {
@@ -62,6 +63,7 @@ ContractAudit.propTypes = {
has_result: PropTypes.bool,
is_accumulator: PropTypes.bool,
is_multiplier: PropTypes.bool,
+ is_only_ups_downs: PropTypes.bool,
toggleHistoryTab: PropTypes.func,
};
diff --git a/packages/trader/src/App/Components/Elements/ContractAudit/contract-details.jsx b/packages/trader/src/App/Components/Elements/ContractAudit/contract-details.jsx
index d13461c7c3e4..23a98fb901b7 100644
--- a/packages/trader/src/App/Components/Elements/ContractAudit/contract-details.jsx
+++ b/packages/trader/src/App/Components/Elements/ContractAudit/contract-details.jsx
@@ -4,15 +4,16 @@ import { Money, Icon, ThemedScrollbars } from '@deriv/components';
import { localize } from '@deriv/translations';
import {
epochToMoment,
- toGMTFormat,
getCancellationPrice,
- isAccumulatorContract,
getCurrencyDisplayCode,
+ isAccumulatorContract,
isMobile,
isMultiplierContract,
+ isOnlyUpsDownsContract,
isUserSold,
isEndedBeforeCancellationExpired,
isUserCancelled,
+ toGMTFormat,
} from '@deriv/shared';
import {
addCommaToNumber,
@@ -107,20 +108,22 @@ const ContractDetails = ({ contract_end_time, contract_info, duration, duration_
/>
)}
- {!isAccumulatorContract(contract_type) && !is_vanilla && (
-
- ) : (
-
- )
- }
- label={getBarrierLabel(contract_info)}
- value={getBarrierValue(contract_info) || ' - '}
- />
- )}
+ {!isAccumulatorContract(contract_type) &&
+ !is_vanilla &&
+ !isOnlyUpsDownsContract(contract_type) && (
+
+ ) : (
+
+ )
+ }
+ label={getBarrierLabel(contract_info)}
+ value={getBarrierValue(contract_info) || ' - '}
+ />
+ )}
)}
0 && !result,
- 'dc-contract-card--red': is_mobile && !is_multiplier && profit < 0 && !result,
+ 'dc-contract-card--green': profit > 0 && !result,
+ 'dc-contract-card--red': profit < 0 && !result,
'contract-card__market-closed--disabled': is_market_closed && should_hide_closed_overlay,
})}
ref={hover_ref}
diff --git a/packages/trader/src/App/Components/Elements/ContractDrawer/contract-drawer.jsx b/packages/trader/src/App/Components/Elements/ContractDrawer/contract-drawer.jsx
index daaad6f0f55e..f618d3f48677 100644
--- a/packages/trader/src/App/Components/Elements/ContractDrawer/contract-drawer.jsx
+++ b/packages/trader/src/App/Components/Elements/ContractDrawer/contract-drawer.jsx
@@ -29,6 +29,7 @@ const ContractDrawer = observer(
is_market_closed,
is_multiplier,
is_vanilla,
+ is_only_ups_downs,
onClickCancel,
onClickSell,
status,
@@ -54,11 +55,12 @@ const ContractDrawer = observer(
is_accumulator={is_accumulator}
is_dark_theme={is_dark_theme}
is_multiplier={is_multiplier}
+ is_only_ups_downs={is_only_ups_downs}
is_open
duration={getDurationTime(contract_info)}
duration_unit={getDurationUnitText(getDurationPeriod(contract_info))}
exit_spot={exit_spot}
- has_result={!!is_sold || is_multiplier || is_vanilla || is_accumulator}
+ has_result={!!is_sold || is_multiplier || is_vanilla || is_accumulator || is_only_ups_downs}
toggleHistoryTab={toggleHistoryTab}
is_vanilla={is_vanilla}
/>
@@ -106,11 +108,12 @@ const ContractDrawer = observer(
is_accumulator={is_accumulator}
is_dark_theme={is_dark_theme}
is_multiplier={is_multiplier}
+ is_only_ups_downs={is_only_ups_downs}
is_open
duration={getDurationTime(contract_info)}
duration_unit={getDurationUnitText(getDurationPeriod(contract_info))}
exit_spot={exit_spot}
- has_result={!!is_sold || is_multiplier || is_vanilla || is_accumulator}
+ has_result={!!is_sold || is_multiplier || is_vanilla || is_accumulator || is_only_ups_downs}
toggleHistoryTab={toggleHistoryTab}
is_vanilla={is_vanilla}
/>
@@ -183,6 +186,7 @@ ContractDrawer.propTypes = {
is_accumulator: PropTypes.bool,
is_multiplier: PropTypes.bool,
is_vanilla: PropTypes.bool,
+ is_only_ups_downs: PropTypes.bool,
toggleHistoryTab: PropTypes.func,
};
diff --git a/packages/trader/src/App/Components/Elements/PositionsDrawer/positions-modal-card.jsx b/packages/trader/src/App/Components/Elements/PositionsDrawer/positions-modal-card.jsx
index 29e1edb72785..5fefa49c8de1 100644
--- a/packages/trader/src/App/Components/Elements/PositionsDrawer/positions-modal-card.jsx
+++ b/packages/trader/src/App/Components/Elements/PositionsDrawer/positions-modal-card.jsx
@@ -219,8 +219,8 @@ const PositionsModalCard = observer(
0 && !result,
- 'dc-contract-card--red': !is_multiplier && profit_loss < 0 && !result,
+ 'dc-contract-card--green': profit_loss > 0 && !result,
+ 'dc-contract-card--red': profit_loss < 0 && !result,
})}
to={{
pathname: `/contract/${contract_info.contract_id}`,
diff --git a/packages/trader/src/Constants/contract.js b/packages/trader/src/Constants/contract.js
index 64debe49ba5e..1bffd31f4f48 100644
--- a/packages/trader/src/Constants/contract.js
+++ b/packages/trader/src/Constants/contract.js
@@ -197,14 +197,6 @@ export const getUnsupportedContracts = () => ({
name: ,
position: 'bottom',
},
- RUNHIGH: {
- name: ,
- position: 'top',
- },
- RUNLOW: {
- name: ,
- position: 'bottom',
- },
});
// Config to display trade button and their position
@@ -278,6 +270,14 @@ export const getSupportedContracts = is_high_low => ({
name: ,
position: 'bottom',
},
+ RUNHIGH: {
+ name: ,
+ position: 'top',
+ },
+ RUNLOW: {
+ name: ,
+ position: 'bottom',
+ },
});
export const getContractConfig = is_high_low => ({
diff --git a/packages/trader/src/Modules/Contract/Containers/contract-replay.jsx b/packages/trader/src/Modules/Contract/Containers/contract-replay.jsx
index e16951054df5..3f7dbca23bf1 100644
--- a/packages/trader/src/Modules/Contract/Containers/contract-replay.jsx
+++ b/packages/trader/src/Modules/Contract/Containers/contract-replay.jsx
@@ -21,6 +21,7 @@ import {
isMobile,
isMultiplierContract,
isVanillaContract,
+ isOnlyUpsDownsContract,
urlFor,
} from '@deriv/shared';
import { localize } from '@deriv/translations';
@@ -80,6 +81,7 @@ const ContractReplay = observer(({ contract_id }) => {
const is_accumulator = isAccumulatorContract(contract_info.contract_type);
const is_multiplier = isMultiplierContract(contract_info.contract_type);
const is_vanilla = isVanillaContract(contract_info.contract_type);
+ const is_only_ups_downs = isOnlyUpsDownsContract(contract_info.contract_type);
const contract_drawer_el = (
{
is_sell_requested={is_sell_requested}
is_valid_to_cancel={is_valid_to_cancel}
is_vanilla={is_vanilla}
+ is_only_ups_downs={is_only_ups_downs}
onClickCancel={onClickCancel}
onClickSell={onClickSell}
status={indicative_status}
diff --git a/packages/trader/src/sass/app/modules/smart-chart.scss b/packages/trader/src/sass/app/modules/smart-chart.scss
index f31c236932e1..fcc182c30979 100644
--- a/packages/trader/src/sass/app/modules/smart-chart.scss
+++ b/packages/trader/src/sass/app/modules/smart-chart.scss
@@ -56,7 +56,8 @@
width: 16px;
height: 16px;
}
- &--accumulator {
+ &--accumulator,
+ &--only-ups-downs {
&-middle,
&-middle--preexit {
width: 6px;
From 36f15104d50ab1eda5b94ccc6b4965dcb3a88630 Mon Sep 17 00:00:00 2001
From: Sui Sin <103026762+suisin-deriv@users.noreply.github.com>
Date: Fri, 21 Jul 2023 17:07:44 +0800
Subject: [PATCH 30/38] fix: token leakage to third party api (#9000)
Co-authored-by: Ali(Ako) Hosseini
---
.../core/src/App/Components/Elements/LiveChat/use-livechat.ts | 1 +
packages/core/src/index.html | 1 +
types/global.d.ts | 1 +
3 files changed, 3 insertions(+)
diff --git a/packages/core/src/App/Components/Elements/LiveChat/use-livechat.ts b/packages/core/src/App/Components/Elements/LiveChat/use-livechat.ts
index 7e5c9bf7e796..d42f3db7488a 100644
--- a/packages/core/src/App/Components/Elements/LiveChat/use-livechat.ts
+++ b/packages/core/src/App/Components/Elements/LiveChat/use-livechat.ts
@@ -39,6 +39,7 @@ const useLiveChat = (has_cookie_account = false, active_loginid?: string) => {
}, []);
const liveChatSetup = (is_logged_in: boolean) => {
+ window.LiveChatWidget.init();
window.LiveChatWidget?.on('ready', () => {
let client_first_name = '';
let client_last_name = '';
diff --git a/packages/core/src/index.html b/packages/core/src/index.html
index 33b8b2d72958..99cbc7010d2d 100644
--- a/packages/core/src/index.html
+++ b/packages/core/src/index.html
@@ -296,6 +296,7 @@