Skip to content

Commit 2896b6d

Browse files
Merge branch 'master' into arshad/COJ-481/AddressDetailsFields
2 parents 28a9a0f + 2a6447d commit 2896b6d

File tree

148 files changed

+3184
-1088
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+3184
-1088
lines changed

package-lock.json

+513-513
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/account-v2/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"start": "rimraf dist && npm run test && npm run serve"
1212
},
1313
"dependencies": {
14-
"@deriv-com/ui": "0.0.1-beta.5",
14+
"@deriv-com/ui": "0.0.1-beta.7",
1515
"@deriv/api": "^1.0.0",
1616
"@deriv/library": "^1.0.0",
1717
"@deriv/quill-design": "^1.3.2",

packages/api/src/hooks/p2p/entity/advertiser/p2p-advertiser/useAdvertiserInfo.ts

-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const useAdvertiserInfo = (id?: string) => {
2222
is_listed,
2323
is_online,
2424
show_name,
25-
created_time,
2625
} = advertiser_info;
2726

2827
return {
@@ -43,8 +42,6 @@ const useAdvertiserInfo = (id?: string) => {
4342
is_online: Boolean(is_online),
4443
/** When true, the advertiser's real name will be displayed on to other users on adverts and orders. */
4544
show_name: Boolean(show_name),
46-
/** The epoch time that the client became an advertiser. */
47-
created_time: new Date(created_time),
4845
};
4946
}, [data?.p2p_advertiser_info]);
5047

packages/bot-skeleton/src/services/api/ticks_service.js

+20-5
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,13 @@ export default class TicksService {
197197
observe() {
198198
if (api_base.api) {
199199
const subscription = api_base.api.onMessage().subscribe(({ data }) => {
200+
if (data.msg_type === 'history') {
201+
const {
202+
subscription: { id },
203+
} = data;
204+
this.subscriptions = this.subscriptions.set('history', id);
205+
}
206+
200207
if (data.msg_type === 'tick') {
201208
const { tick } = data;
202209
const { symbol, id } = tick;
@@ -304,11 +311,19 @@ export default class TicksService {
304311
const { stringified_options } = this.ticks_history_promise;
305312
const { symbol = '' } = JSON.parse(stringified_options);
306313
if (symbol) {
307-
this.forget(this.subscriptions.getIn(['tick', symbol]))
308-
.then(res => {
309-
resolve(res);
310-
})
311-
.catch(reject);
314+
if (!this.subscriptions.getIn(['tick', symbol])) {
315+
this.forget(this.subscriptions.get('history'))
316+
.then(res => {
317+
resolve(res);
318+
})
319+
.catch(reject);
320+
} else {
321+
this.forget(this.subscriptions.getIn(['tick', symbol]))
322+
.then(res => {
323+
resolve(res);
324+
})
325+
.catch(reject);
326+
}
312327
} else {
313328
resolve();
314329
}

packages/bot-web-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"@datadog/browser-logs": "^4.36.0",
7171
"@deriv/bot-skeleton": "^1.0.0",
7272
"@deriv/components": "^1.0.0",
73-
"@deriv/deriv-charts": "^2.0.1",
73+
"@deriv/deriv-charts": "^2.0.2",
7474
"@deriv/shared": "^1.0.0",
7575
"@deriv/stores": "^1.0.0",
7676
"@deriv/translations": "^1.0.0",

packages/bot-web-ui/src/stores/google-drive-store.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ export default class GoogleDriveStore {
5151
client_id: this.client_id,
5252
scope: this.scope,
5353
callback: response => {
54-
this.access_token = response.access_token;
55-
this.updateSigninStatus(true);
56-
localStorage.setItem('google_access_token', response.access_token);
54+
if (response?.access_token && !response?.error) {
55+
this.access_token = response.access_token;
56+
this.updateSigninStatus(true);
57+
localStorage.setItem('google_access_token', response.access_token);
58+
}
5759
},
5860
});
5961
};

packages/components/src/components/contract-card/contract-card-items/__tests__/accumulator-card-body.spec.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,16 @@ describe('<AccumulatorCardBody />', () => {
4949
expect(screen.getByText('Take profit:')).toBeInTheDocument();
5050
expect(screen.getByText('-')).toBeInTheDocument();
5151
});
52+
53+
it('should not render arrow indicator if the contract was sold (is_sold === true)', () => {
54+
render(<AccumulatorCardBody {...mock_props} />);
55+
56+
expect(screen.queryByTestId('dt_arrow_indicator')).not.toBeInTheDocument();
57+
});
58+
59+
it('should render arrow indicator if the contract is not sold (is_sold === false)', () => {
60+
render(<AccumulatorCardBody {...mock_props} is_sold={false} />);
61+
62+
expect(screen.getAllByTestId('dt_arrow_indicator')).not.toHaveLength(0);
63+
});
5264
});

packages/components/src/components/contract-card/contract-card-items/__tests__/multiplier-card-body.spec.tsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ describe('MultiplierCardBody', () => {
5858
expect(screen.getByText(getCardLabels().STOP_LOSS)).toBeInTheDocument();
5959
expect(screen.getByText(getCardLabels().TAKE_PROFIT)).toBeInTheDocument();
6060
expect(screen.getByText(getCardLabels().TOTAL_PROFIT_LOSS)).toBeInTheDocument();
61-
expect(screen.getByTestId('dt_arrow_indicator')).toBeInTheDocument();
6261
};
6362

6463
it('should render the correct content for a Cancelled contract with Deal cancel.fee and negative Total profit/loss', () => {
@@ -97,4 +96,16 @@ describe('MultiplierCardBody', () => {
9796
expect(screen.getByText(mock_props.getCardLabels().NOT_AVAILABLE)).toBeInTheDocument();
9897
expect(screen.getByText(progress_slider)).toBeInTheDocument();
9998
});
99+
100+
it('should not render arrow indicator if the contract was sold (is_sold === true)', () => {
101+
render(<MultiplierCardBody {...mock_props} />);
102+
103+
expect(screen.queryByTestId('dt_arrow_indicator')).not.toBeInTheDocument();
104+
});
105+
106+
it('should render arrow indicator if the contract is not sold (is_sold === false)', () => {
107+
render(<MultiplierCardBody {...mock_props} is_sold={false} />);
108+
109+
expect(screen.getAllByTestId('dt_arrow_indicator')).not.toHaveLength(0);
110+
});
100111
});

packages/components/src/components/contract-card/contract-card-items/__tests__/turbos-card-body.spec.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,16 @@ describe('TurbosCardBody', () => {
7979
expect(screen.getByText(getCardLabels().TOTAL_PROFIT_LOSS)).toBeInTheDocument();
8080
expect(screen.getByText('0.00')).toBeInTheDocument();
8181
});
82+
83+
it('should not render arrow indicator if the contract was sold (is_sold === true)', () => {
84+
render(<TurbosCardBody {...mock_props} is_sold />);
85+
86+
expect(screen.queryByTestId('dt_arrow_indicator')).not.toBeInTheDocument();
87+
});
88+
89+
it('should render arrow indicator if the contract is not sold (is_sold === false)', () => {
90+
render(<TurbosCardBody {...mock_props} />);
91+
92+
expect(screen.getAllByTestId('dt_arrow_indicator')).not.toHaveLength(0);
93+
});
8294
});

packages/components/src/components/contract-card/contract-card-items/__tests__/vanilla-options-card-body.spec.tsx

+12-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ describe('VanillaOptionsCardBody', () => {
3131
expect(screen.getByText(getCardLabels().STRIKE)).toBeInTheDocument();
3232
expect(screen.getByText('1,200.00')).toBeInTheDocument();
3333
expect(screen.getByText(getCardLabels().TOTAL_PROFIT_LOSS)).toBeInTheDocument();
34-
expect(screen.getByTestId('dt_arrow_indicator')).toBeInTheDocument();
3534
});
3635

3736
it('should render the correct content for an unsold contract', async () => {
@@ -50,6 +49,17 @@ describe('VanillaOptionsCardBody', () => {
5049
expect(screen.getByText(getCardLabels().PURCHASE_PRICE)).toBeInTheDocument();
5150
expect(screen.getByText(getCardLabels().STRIKE)).toBeInTheDocument();
5251
expect(screen.getByText(getCardLabels().TOTAL_PROFIT_LOSS)).toBeInTheDocument();
53-
expect(screen.getByTestId('dt_arrow_indicator')).toBeInTheDocument();
52+
});
53+
54+
it('should render arrow indicator if the contract is not sold (is_sold === false)', () => {
55+
render(<VanillaOptionsCardBody {...mock_props} />);
56+
57+
expect(screen.getAllByTestId('dt_arrow_indicator')).not.toHaveLength(0);
58+
});
59+
60+
it('should not render arrow indicator if the contract was sold (is_sold === true)', () => {
61+
render(<VanillaOptionsCardBody {...mock_props} is_sold />);
62+
63+
expect(screen.queryByTestId('dt_arrow_indicator')).not.toBeInTheDocument();
5464
});
5565
});

packages/components/src/components/contract-card/contract-card-items/accumulator-card-body.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,12 @@ const AccumulatorCardBody = ({
7272
>
7373
<Money amount={sell_price || indicative} currency={currency} />
7474
</div>
75-
<ArrowIndicator
76-
className='dc-contract-card__indicative--movement'
77-
value={sell_price || indicative}
78-
/>
75+
{!is_sold && (
76+
<ArrowIndicator
77+
className='dc-contract-card__indicative--movement'
78+
value={sell_price || indicative}
79+
/>
80+
)}
7981
</ContractCardItem>
8082
<ContractCardItem
8183
header={TOTAL_PROFIT_LOSS}
@@ -84,7 +86,7 @@ const AccumulatorCardBody = ({
8486
is_won={is_won}
8587
>
8688
<Money amount={profit} currency={currency} />
87-
<ArrowIndicator className='dc-contract-card__indicative--movement' value={profit} />
89+
{!is_sold && <ArrowIndicator className='dc-contract-card__indicative--movement' value={profit} />}
8890
</ContractCardItem>
8991
<ContractCardItem header={TAKE_PROFIT} className='dc-contract-card__take-profit'>
9092
{take_profit ? <Money amount={take_profit} currency={currency} /> : <strong>-</strong>}

packages/components/src/components/contract-card/contract-card-items/contract-card-body.tsx

+9-5
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,18 @@ const ContractCardBody = ({
141141
is_won={Number(profit) > 0}
142142
>
143143
<Money amount={profit} currency={currency} />
144-
<ArrowIndicator className='dc-contract-card__indicative--movement' value={profit} />
144+
{!is_sold && (
145+
<ArrowIndicator className='dc-contract-card__indicative--movement' value={profit} />
146+
)}
145147
</ContractCardItem>
146148
<ContractCardItem header={is_sold ? PAYOUT : INDICATIVE_PRICE}>
147149
<Money currency={currency} amount={Number(sell_price || indicative)} />
148-
<ArrowIndicator
149-
className='dc-contract-card__indicative--movement'
150-
value={Number(sell_price || indicative)}
151-
/>
150+
{!is_sold && (
151+
<ArrowIndicator
152+
className='dc-contract-card__indicative--movement'
153+
value={Number(sell_price || indicative)}
154+
/>
155+
)}
152156
</ContractCardItem>
153157
<ContractCardItem header={PURCHASE_PRICE}>
154158
<Money amount={buy_price} currency={currency} />

packages/components/src/components/contract-card/contract-card-items/contract-update-form.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const ContractUpdateForm = (props: TContractUpdateFormProps) => {
9595
contract_update_stop_loss,
9696
});
9797

98-
const { buy_price, currency = '', is_valid_to_cancel } = contract_info;
98+
const { buy_price, currency = '', is_valid_to_cancel, is_sold } = contract_info;
9999
const { stop_loss, take_profit } = getLimitOrderAmount(contract_info.limit_order);
100100
const { contract_update_stop_loss: stop_loss_error, contract_update_take_profit: take_profit_error } =
101101
validation_errors;
@@ -217,7 +217,9 @@ const ContractUpdateForm = (props: TContractUpdateFormProps) => {
217217
)}
218218
>
219219
<Money amount={total_profit} currency={currency} />
220-
<ArrowIndicator className='dc-contract-card__indicative--movement' value={total_profit} />
220+
{!is_sold && (
221+
<ArrowIndicator className='dc-contract-card__indicative--movement' value={total_profit} />
222+
)}
221223
</div>
222224
</div>
223225
</MobileWrapper>

packages/components/src/components/contract-card/contract-card-items/multiplier-card-body.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ const MultiplierCardBody = ({
130130
is_won={total_profit > 0}
131131
>
132132
<Money amount={Math.abs(total_profit)} currency={currency} />
133-
<ArrowIndicator className='dc-contract-card__indicative--movement' value={total_profit} />
133+
{!is_sold && <ArrowIndicator className='dc-contract-card__indicative--movement' value={total_profit} />}
134134
</ContractCardItem>
135135
</React.Fragment>
136136
);

packages/components/src/components/contract-card/contract-card-items/turbos-card-body.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const TurbosCardBody = ({
106106
is_won={Number(profit) > 0}
107107
>
108108
<Money amount={profit} currency={currency} />
109-
<ArrowIndicator className='dc-contract-card__indicative--movement' value={profit} />
109+
{!is_sold && <ArrowIndicator className='dc-contract-card__indicative--movement' value={profit} />}
110110
</ContractCardItem>
111111
</React.Fragment>
112112
);

packages/components/src/components/contract-card/contract-card-items/vanilla-options-card-body.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const VanillaOptionsCardBody: React.FC<TVanillaOptionsCardBodyProps> = ({
5555
is_won={Number(profit) > 0}
5656
>
5757
<Money amount={profit} currency={currency} />
58-
<ArrowIndicator className='dc-contract-card__indicative--movement' value={profit} />
58+
{!is_sold && <ArrowIndicator className='dc-contract-card__indicative--movement' value={profit} />}
5959
</ContractCardItem>
6060
</DesktopWrapper>
6161
<MobileWrapper>
@@ -94,7 +94,9 @@ const VanillaOptionsCardBody: React.FC<TVanillaOptionsCardBodyProps> = ({
9494
is_won={Number(profit) > 0}
9595
>
9696
<Money amount={profit} currency={currency} />
97-
<ArrowIndicator className='dc-contract-card__indicative--movement' value={profit} />
97+
{!is_sold && (
98+
<ArrowIndicator className='dc-contract-card__indicative--movement' value={profit} />
99+
)}
98100
</ContractCardItem>
99101
</div>
100102
</MobileWrapper>

packages/core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"@deriv/cfd": "^1.0.0",
102102
"@deriv/components": "^1.0.0",
103103
"@deriv/deriv-api": "^1.0.13",
104-
"@deriv/deriv-charts": "^2.0.1",
104+
"@deriv/deriv-charts": "^2.0.2",
105105
"@deriv/hooks": "^1.0.0",
106106
"@deriv/p2p": "^0.7.3",
107107
"@deriv/account-v2": "^1.0.0",

packages/core/src/App/Containers/Redirect/redirect.jsx

+13-5
Original file line numberDiff line numberDiff line change
@@ -95,27 +95,28 @@ const Redirect = observer(() => {
9595
if (redirect_to) {
9696
let pathname = '';
9797
let hash = '';
98+
const main_screen_route = is_next_wallet ? routes.wallets : routes.traders_hub;
9899
switch (redirect_to) {
99100
case '1':
100101
pathname = routes.traders_hub;
101102
break;
102103
case '10':
103-
pathname = routes.traders_hub;
104+
pathname = main_screen_route;
104105
hash = 'real';
105106
break;
106107
case '11':
107-
pathname = routes.traders_hub;
108+
pathname = main_screen_route;
108109
hash = 'demo';
109110
break;
110111
case '2':
111112
pathname = routes.traders_hub;
112113
break;
113114
case '20':
114-
pathname = routes.traders_hub;
115+
pathname = main_screen_route;
115116
hash = 'real';
116117
break;
117118
case '21':
118-
pathname = routes.traders_hub;
119+
pathname = main_screen_route;
119120
hash = 'demo';
120121
break;
121122
case '3':
@@ -191,7 +192,14 @@ const Redirect = observer(() => {
191192
case 'trading_platform_investor_password_reset': {
192193
localStorage.setItem('cfd_reset_password_code', code_param);
193194
const is_demo = localStorage.getItem('cfd_reset_password_intent')?.includes('demo');
194-
history.push(`${routes.traders_hub}#${is_demo ? 'demo' : 'real'}#reset-password`);
195+
if (is_next_wallet) {
196+
history.push({
197+
pathname: routes.wallets,
198+
search: url_query_string,
199+
});
200+
} else {
201+
history.push(`${routes.traders_hub}#${is_demo ? 'demo' : 'real'}#reset-password`);
202+
}
195203
redirected_to_route = true;
196204
break;
197205
}

packages/core/src/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@
245245
</div>
246246
<div id="wallets_modal_root" class="modal-root"></div>
247247
<div id="v2_modal_root" class="modal-root"></div>
248+
<div id="launch_modal_root" class="launch-modal-root"></div>
248249
<div id="modal_root" class="modal-root"></div>
249250
<div id="modal_root_absolute" class="modal-root modal-root--absolute"></div>
250251
<!-- modal_root has background color. So, it cannot be used for toast messages. For those cases popup_root is used -->

packages/core/src/sass/app/_common/layout/modal-root.scss

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
.modal-root {
1+
.modal-root,
2+
.launch-modal-root {
23
width: 100vw;
34
height: 100vh;
45
align-items: center;
@@ -22,3 +23,7 @@
2223
z-index: 9999;
2324
}
2425
}
26+
27+
.launch-modal-root:not(:empty) + .modal-root:not(:empty) {
28+
display: none;
29+
}

packages/p2p-v2/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"start": "rimraf dist && npm run test && npm run serve"
1313
},
1414
"dependencies": {
15+
"@deriv-com/ui": "0.0.1-beta.7",
1516
"@deriv/api": "^1.0.0",
1617
"@deriv/integration": "^1.0.0",
1718
"@deriv/react-joyride": "^2.6.2",
@@ -24,6 +25,7 @@
2425
"react-dom": "^17.0.2",
2526
"react-i18next": "^11.11.0",
2627
"react-router-dom": "^5.2.0",
28+
"react-simple-star-rating": "4.0.4",
2729
"usehooks-ts": "^2.7.0"
2830
},
2931
"devDependencies": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.p2p-v2-advertiser-name {
2+
display: grid;
3+
grid-gap: 1.6rem;
4+
grid-template-columns: min-content auto max-content;
5+
6+
&__details {
7+
display: flex;
8+
flex-direction: column;
9+
justify-content: center;
10+
gap: 0.4rem;
11+
}
12+
}

0 commit comments

Comments
 (0)