Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: p2p structure, styles and components #8696

Merged
merged 173 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
173 commits
Select commit Hold shift + click to select a range
98293e4
refactor: refactor p2p styles
Farhan-slurrp May 2, 2023
2e7bd78
chore: merge master branch
Farhan-slurrp May 5, 2023
1dcca0e
refactor: refactor styles
Farhan-slurrp May 5, 2023
b7e4a1e
fix: classname typo
Farhan-slurrp May 5, 2023
d59559a
chore: merge branch 'master' and refactor remaining styles
Farhan-slurrp May 8, 2023
6fa29db
Merge branch 'master' of https://github.com/binary-com/deriv-app into…
Farhan-slurrp May 8, 2023
880dca8
fix: fix broken style
Farhan-slurrp May 8, 2023
ea42792
refactor: update based on pr comments
Farhan-slurrp May 8, 2023
2453363
fix: failed tests
Farhan-slurrp May 8, 2023
7647427
fix: import error
Farhan-slurrp May 8, 2023
c8f0e53
refactor: rename datatest id
Farhan-slurrp May 8, 2023
b09c32f
Merge branch 'master' of https://github.com/binary-com/deriv-app into…
Farhan-slurrp May 12, 2023
775afdd
refactor: remove unused styles and refactor text components
Farhan-slurrp May 12, 2023
346dc14
Merge branch 'master' of https://github.com/binary-com/deriv-app into…
Farhan-slurrp May 12, 2023
e66c15f
Merge branch 'master' of https://github.com/binary-com/deriv-app into…
Farhan-slurrp May 12, 2023
75a809e
refactor: restructure the p2p package
Farhan-slurrp May 16, 2023
83263f9
Merge branch 'master' of https://github.com/binary-com/deriv-app into…
Farhan-slurrp May 16, 2023
e1e3802
refactor: update translations imports
Farhan-slurrp May 16, 2023
664a817
refactor: update modal-manager import
Farhan-slurrp May 16, 2023
681c876
Merge branch 'P2PS-269/refactor-styles' of https://github.com/farhan-…
Farhan-slurrp May 19, 2023
8471983
Merge branch 'P2PS-354/restructure-p2p-package' of https://github.com…
Farhan-slurrp May 19, 2023
bbd56ec
Merge branch 'master' of https://github.com/binary-com/deriv-app into…
Farhan-slurrp May 19, 2023
e5556f1
fix: pr review comments
Farhan-slurrp May 19, 2023
7a1f493
fix: fix some broken styles
Farhan-slurrp May 19, 2023
61423c0
fix: review comments
Farhan-slurrp May 19, 2023
bd5a705
chore: change in failed test file and remove change from unrelated file
Farhan-slurrp May 19, 2023
d830b61
fix: review comments
Farhan-slurrp May 22, 2023
ade671b
Merge pull request #2 from farhan-nurzi-deriv/p2p-restructure-and-sty…
farrah-deriv May 22, 2023
44c9480
Henry/fix: navigate to accu trade type in reports page after purchasi…
henry-deriv May 22, 2023
8786ba1
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv May 22, 2023
55c59c6
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv May 23, 2023
cdf1ebc
refactor: refactor dpep-blocked components
Farhan-slurrp May 24, 2023
e086743
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv May 24, 2023
a9f540d
fix: failed test
Farhan-slurrp May 24, 2023
378ba7e
fix: review comments
Farhan-slurrp May 24, 2023
f76c0df
refactor: test descriptions changes
Farhan-slurrp May 24, 2023
3a7920d
refactor: import localize from p2p i18n instead of shared translation…
Farhan-slurrp May 24, 2023
91e0626
fix: review components
Farhan-slurrp May 24, 2023
c1212ba
chore: refactored temporarily barred hint component
ameerul-deriv May 25, 2023
94fa09f
refactor: rearrange imports to follow guidelines
Farhan-slurrp May 25, 2023
6dd2193
refactor: standardise react imports
Farhan-slurrp May 25, 2023
f54d081
chore: refactored p2p-empty component
ameerul-deriv May 25, 2023
11c1bb7
chore: added default value for has_tabs
ameerul-deriv May 25, 2023
611f81f
feat: unit test added for page return component
nada-deriv May 25, 2023
8921a6c
refactor: recommended-by component
Farhan-slurrp May 25, 2023
33880ff
fix: updated index file
nada-deriv May 25, 2023
75158ef
Merge pull request #3 from farhan-nurzi-deriv/P2PS-723/refactor-dp2pb…
farrah-deriv May 25, 2023
9af9c45
chore: added test cases for star rating
ameerul-deriv May 25, 2023
e67cb08
chore: changed describe
ameerul-deriv May 25, 2023
975aaf6
Merge branch 'p2p-refactor' of https://github.com/farrah-deriv/deriv-…
Farhan-slurrp May 25, 2023
345fc75
Merge pull request #4 from ameerul-deriv/refactor-temporarily-barred-…
farrah-deriv May 25, 2023
f72af2f
Merge pull request #5 from ameerul-deriv/refactor-empty
farrah-deriv May 25, 2023
fdfa5e7
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv May 25, 2023
c692ef2
Merge branch 'p2p-refactor' of https://github.com/farrah-deriv/deriv-…
Farhan-slurrp May 25, 2023
96d4082
refactor: add new test cases to increase coverage
Farhan-slurrp May 25, 2023
78ffca0
refactor: add comment in empty arrow function
Farhan-slurrp May 26, 2023
07543d2
refactor: refactor trade-badge component
Farhan-slurrp May 26, 2023
b26c664
fix: review comments fixed
nada-deriv May 26, 2023
bddb750
refactor: remove prop-types import
Farhan-slurrp May 26, 2023
64d991b
refactor: update react import
Farhan-slurrp May 26, 2023
9c7afa5
refactor: refactor form-submit-error-message, table-error
nada-deriv May 26, 2023
c663f7f
refactor: resolved merge conflicts
nada-deriv May 26, 2023
532482b
refactor: nickname form
farrah-deriv May 26, 2023
1e9b226
Merge pull request #6 from nada-deriv/nada/P2PS-727/page-return-refactor
farrah-deriv May 29, 2023
b178a7c
Merge pull request #9 from farhan-nurzi-deriv/P2PS-732/refactor-trade…
farrah-deriv May 29, 2023
fd83e98
refactor: review comments
nada-deriv May 29, 2023
1714014
Merge pull request #10 from nada-deriv/nada/P2PS-725/refactor-form-su…
farrah-deriv May 29, 2023
3cb5ba4
fix: tests
farrah-deriv May 29, 2023
55f3385
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv May 29, 2023
d0cd72f
chore: refactored user avatar component
ameerul-deriv May 30, 2023
cf28c64
refactor: refactor toggle-container component
Farhan-slurrp May 30, 2023
e08fda7
chore: added suggestions
ameerul-deriv May 30, 2023
2af57dc
refactor: delete the type and use propswithchildren
Farhan-slurrp May 30, 2023
b5f7c37
Merge pull request #13 from farhan-nurzi-deriv/P2PS-755/refactor-togg…
farrah-deriv May 30, 2023
743acc5
chore: refactored FloatingRate component
ameerul-deriv May 31, 2023
6075e39
refactor: refactor block-user-empty component
Farhan-slurrp May 31, 2023
e25c575
refactor: online status component refactoring
nada-deriv May 31, 2023
bed24bc
refactor: review comments
Farhan-slurrp May 31, 2023
0eaf29c
refactor: add margin-top
Farhan-slurrp May 31, 2023
df83f0e
refactor: udpated test description
nada-deriv May 31, 2023
e5ff702
refactor: change test cases descriptions
Farhan-slurrp May 31, 2023
79f7df6
refactor: review comment
nada-deriv May 31, 2023
7c4b3ed
Merge pull request #11 from farrah-deriv/P2PS-726/refactor-nickname-form
farrah-deriv May 31, 2023
db40c91
Merge pull request #8 from ameerul-deriv/refactor-star-rating
farrah-deriv May 31, 2023
84a310e
Merge pull request #12 from ameerul-deriv/refactor-user-avatar
farrah-deriv May 31, 2023
ac3a6f0
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv May 31, 2023
b403ed5
refactor: refactored verification component
nada-deriv May 31, 2023
691b598
chore: refactored recommend user component
ameerul-deriv Jun 1, 2023
212b066
chore: removed fireEvent, used userEvent
ameerul-deriv Jun 1, 2023
2305682
refactor: updated tests
nada-deriv Jun 1, 2023
98b6e4b
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Jun 1, 2023
6ded315
refactor: review comment fix
nada-deriv Jun 1, 2023
733feb8
Merge pull request #16 from farhan-nurzi-deriv/P2PS-742/refactor-bloc…
farrah-deriv Jun 1, 2023
964f93d
refactor: added type checking for modal manager in test case
nada-deriv Jun 1, 2023
9616908
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Jun 1, 2023
a4cccef
Merge pull request #7 from farhan-nurzi-deriv/P2PS-728/refactor-recom…
farrah-deriv Jun 5, 2023
0ae461a
translations: 📚 sync translations with crowdin (#8881)
github-actions[bot] Jun 1, 2023
02fdaa8
thisyahlen/fix: change algo for realAccountSignup (#8656)
thisyahlen-deriv Jun 2, 2023
bf596c6
translations: 📚 sync translations with crowdin (#8885)
github-actions[bot] Jun 2, 2023
4bd5eae
translations: 📚 sync translations with crowdin (#8890)
github-actions[bot] Jun 2, 2023
9385de8
likhith/fix: :bug: resolved required field error (#8886)
likhith-deriv Jun 2, 2023
ab569d6
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Jun 5, 2023
09b10fe
Merge pull request #18 from ameerul-deriv/refactor-recommend-user
farrah-deriv Jun 5, 2023
6f6ad4c
Merge pull request #15 from ameerul-deriv/refactor-floating-rate
farrah-deriv Jun 5, 2023
0355c03
refactor: removed unused code
nada-deriv Jun 5, 2023
fc7f880
refactor: updated test
nada-deriv Jun 5, 2023
93b7efa
Merge pull request #19 from nada-deriv/nada/P2PS-734/verification-ref…
farrah-deriv Jun 5, 2023
227ddef
fix: code smells
farrah-deriv Jun 5, 2023
979d8ce
Merge pull request #17 from nada-deriv/nada/P2PS-820/online-status-re…
farrah-deriv Jun 5, 2023
10637c9
Merge pull request #20 from farrah-deriv/fix-code-smells
farrah-deriv Jun 5, 2023
1ef746e
fix: tests
farrah-deriv Jun 6, 2023
52194e9
refactor: reduce code complexity to remove code smell
nada-deriv Jun 6, 2023
be89e7a
refactor: updated return
nada-deriv Jun 6, 2023
dc04bef
refactor: udpated test
nada-deriv Jun 6, 2023
70ccac0
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Jun 6, 2023
ca36b7b
Merge pull request #21 from nada-deriv/code-smell
farrah-deriv Jun 6, 2023
5fb65f5
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Jun 12, 2023
8d83b4f
Merge branch 'master' into p2p-refactor
farrah-deriv Jun 19, 2023
dc0e2dc
refactor: delete text component and use default button text styles in…
Farhan-slurrp Jun 21, 2023
1cca12a
Merge pull request #23 from farhan-nurzi-deriv/p2p-refactor
farrah-deriv Jun 21, 2023
d2307e6
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Jun 21, 2023
8781e14
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Jun 23, 2023
1dc14bd
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Jul 3, 2023
65cfd8f
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Jul 5, 2023
93e9c5b
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Jul 7, 2023
78df963
fix: raised subtasks
farrah-deriv Jul 7, 2023
3cb1940
fix: advertiser buy/sell row
farrah-deriv Jul 7, 2023
bf90ddc
Merge branch 'master' into p2p-refactor
farrah-deriv Jul 13, 2023
023eae5
Merge branch 'master' into p2p-refactor
farrah-deriv Jul 20, 2023
d7cc92e
fix: style fix in edit/add payment method form in my profile
nada-deriv Jul 24, 2023
e875f8a
fix: notification issue
nada-deriv Jul 25, 2023
ebc1394
fix: block banned user bug
Farhan-slurrp Jul 26, 2023
a70d15a
fix: issue for popup not showing when rate updated before selecting form
nada-deriv Jul 26, 2023
2cd544d
Merge pull request #41 from nada-deriv/nada/P2PS-1292/payment-section…
farrah-deriv Jul 27, 2023
ab9555d
Merge pull request #42 from farhan-nurzi-deriv/P2PS-1309/block-banned…
farrah-deriv Jul 27, 2023
cf66797
fix: removed console
nada-deriv Jul 27, 2023
5fbcfad
fix: added todo
nada-deriv Jul 27, 2023
cbfd1ff
fix: added undefined check
nada-deriv Jul 27, 2023
bf8c5e6
fix: subtasks raised
farrah-deriv Jul 18, 2023
48baba9
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Aug 2, 2023
bcc823c
Merge pull request #43 from nada-deriv/nada/P2PS-1308/notification-issue
farrah-deriv Aug 2, 2023
2d6cac0
fix: daily limit notification
Farhan-slurrp Aug 7, 2023
f5c4853
Merge branch 'p2p-refactor' of https://github.com/farrah-deriv/deriv-…
Farhan-slurrp Aug 7, 2023
0b5e5d6
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Aug 8, 2023
8dfef7d
fix: tests failed
Farhan-slurrp Aug 8, 2023
9e7f107
Merge pull request #51 from farhan-nurzi-deriv/P2PS-1323/daily-limit-…
farrah-deriv Aug 8, 2023
0b7b73e
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Aug 14, 2023
ccde227
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Aug 16, 2023
8312814
fix: notification popup issue not shown in responsive
nada-deriv Aug 16, 2023
4b39751
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Aug 17, 2023
6157fae
fix: filter button spacing
farrah-deriv Aug 17, 2023
daad255
fix: failing tests
farrah-deriv Aug 17, 2023
6d6f6a9
Merge pull request #55 from nada-deriv/nada/P2PS-1308/notification-re…
farrah-deriv Aug 17, 2023
45c1c9c
fix: get server hits bump error when in advertiser page and block it …
Farhan-slurrp Aug 21, 2023
5ff0142
Merge pull request #61 from farhan-nurzi-deriv/P2PS-1309/block-banned…
farrah-deriv Aug 21, 2023
3410890
fix: revert unwanted changes from master
nada-deriv Aug 29, 2023
5f0b833
Merge pull request #63 from nada-deriv/revert-chanegs
farrah-deriv Aug 29, 2023
a0a16c2
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Aug 30, 2023
8e869e9
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Aug 31, 2023
793d60f
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Sep 11, 2023
a6f8627
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Sep 12, 2023
62a7a20
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Sep 13, 2023
eac7c69
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Sep 14, 2023
8c6c448
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Sep 14, 2023
deacf97
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Sep 15, 2023
1aecf58
fix: remove unnecessary changes
farrah-deriv Sep 15, 2023
48de879
fix: remove unnecessary changes
farrah-deriv Sep 15, 2023
70e0ffe
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Sep 15, 2023
114dd12
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Sep 18, 2023
33c116c
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Sep 18, 2023
aa730a5
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Sep 18, 2023
273b12c
fix: tests
farrah-deriv Sep 18, 2023
5451a14
Merge remote-tracking branch 'upstream/master' into p2p-refactor
farrah-deriv Sep 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion packages/core/src/Stores/notification-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,6 @@ export default class NotificationStore extends BaseStore {
/>
),
platform: 'P2P',
should_show_again: false,
type: 'announce',
};
},
Expand Down
10 changes: 10 additions & 0 deletions packages/p2p/@deriv-stores.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { TCoreStores } from '@deriv/stores/types';
import type P2PStore from './src/stores';

declare module '@deriv/stores' {
export function useStore(): TCoreStores & {
modules: {
p2p: P2PStore;
};
};
}
1 change: 1 addition & 0 deletions packages/p2p/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = {
'^Assets/(.*)$': '<rootDir>/src/assets/$1',
'^Components/(.*)$': '<rootDir>/src/components/$1',
'^Constants/(.*)$': '<rootDir>/src/constants/$1',
'^Pages/(.*)$': '<rootDir>/src/pages/$1',
'^Stores/(.*)$': '<rootDir>/src/stores/$1',
'^Stores$': '<rootDir>/src/stores/index',
'^Translations/(.*)$': '<rootDir>/src/translations/$1',
Expand Down
1 change: 1 addition & 0 deletions packages/p2p/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@deriv/translations": "^1.0.0",
"@deriv/api-types": "^1.0.118",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.5.0",
"classnames": "^2.2.6",
"commander": "^3.0.2",
"crc-32": "^1.2.0",
Expand Down
36 changes: 9 additions & 27 deletions packages/p2p/src/components/__tests__/app-content.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,18 @@ jest.mock('@deriv/components', () => ({
Loading: () => <div>Loading</div>,
}));

jest.mock('@deriv/shared', () => ({
...jest.requireActual('@deriv/shared'),
isMobile: jest.fn(() => false),
}));

// jest.mock('Components/dp2p-blocked', () => jest.fn(() => 'Dp2pBlocked'));
jest.mock('Components/nickname-form', () => jest.fn(() => 'NicknameForm'));
jest.mock('Components/verification/verification', () => jest.fn(() => 'Verification'));
jest.mock('Components/my-ads/my-ads', () => jest.fn(() => 'MyAds'));
jest.mock('Components/orders/orders', () => jest.fn(() => 'Orders'));
jest.mock('Components/buy-sell/buy-sell', () => jest.fn(() => 'BuySell'));
jest.mock('Components/my-profile', () => jest.fn(() => 'MyProfile'));

jest.mock('@sendbird/chat', () => ({
SendbirdChat: jest.fn().mockReturnValue({}),
}));

jest.mock('@sendbird/chat/groupChannel', () => ({
SendbirdChat: jest.fn().mockReturnValue({}),
}));

jest.mock('@sendbird/chat/message', () => ({
SendbirdChat: jest.fn().mockReturnValue({}),
}));
jest.mock('Pages/my-ads/my-ads', () => jest.fn(() => 'MyAds'));
jest.mock('Pages/orders/orders', () => jest.fn(() => 'Orders'));
jest.mock('Pages/buy-sell/buy-sell', () => jest.fn(() => 'BuySell'));
jest.mock('Pages/my-profile', () => jest.fn(() => 'MyProfile'));

describe('<AppContent/>', () => {
const mocked_store_values = {
Expand Down Expand Up @@ -93,17 +86,6 @@ describe('<AppContent/>', () => {
// expect(screen.getByText('Dp2pBlocked')).toBeInTheDocument();
// });

it('should render the nick-name form component when should_show_popup state is true', () => {
useStores.mockImplementation(() => ({
general_store: { ...mocked_store_values, should_show_popup: true },
}));
render(<AppContent />, {
wrapper: ({ children }) => <StoreProvider store={mockStore({})}>{children}</StoreProvider>,
});

expect(screen.getByText('NicknameForm')).toBeInTheDocument();
});

// it('should render only the first notification component when multiple error status is set', () => {
// useStores.mockImplementation(() => ({
// general_store: { ...mocked_store_values, should_show_popup: true, should_show_dp2p_blocked: true },
Expand Down
24 changes: 10 additions & 14 deletions packages/p2p/src/components/app-content.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import classNames from 'classnames';
import React from 'react';
import { isAction, reaction } from 'mobx';
import { useHistory } from 'react-router-dom';
import { useStores } from 'Stores';
import { isMobile } from '@deriv/shared';
import { isAction, reaction } from 'mobx';
import { observer } from 'mobx-react-lite';
import { Loading, Tabs } from '@deriv/components';
import { useStore, observer } from '@deriv/stores';
import classNames from 'classnames';
import { localize } from './i18next';
import NicknameForm from './nickname-form';
import TemporarilyBarredHint from './temporarily-barred-hint';
import { useModalManagerContext } from 'Components/modal-manager/modal-manager-context';
import { useP2PNotificationCount } from '@deriv/hooks';
import { isMobile } from '@deriv/shared';
import { useStore } from '@deriv/stores';
import TemporarilyBarredHint from 'Components/temporarily-barred-hint';
import { useModalManagerContext } from 'Components/modal-manager/modal-manager-context';
import { useStores } from 'Stores';
import { localize } from './i18next';

const AppContent = ({ order_id }) => {
const { buy_sell_store, general_store } = useStores();
Expand Down Expand Up @@ -47,10 +47,6 @@ const AppContent = ({ order_id }) => {
return <Loading is_fullscreen={false} />;
}

if (general_store.should_show_popup) {
return <NicknameForm />;
}

// return empty or else the tabs will be shown above when displaying the advertiser page
if (
(buy_sell_store?.show_advertiser_page && !buy_sell_store.should_show_verification) ||
Expand All @@ -62,7 +58,7 @@ const AppContent = ({ order_id }) => {
return (
<Tabs
active_index={general_store.active_index}
className={classNames({ 'p2p-cashier__tabs': general_store.active_index === 0 && isMobile() })}
className={classNames({ p2p__tabs: general_store.active_index === 0 && isMobile() })}
header_fit_content={!isMobile()}
is_100vw={isMobile()}
is_scrollable
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { useStores } from 'Stores/index';
import Dp2pBlockedDescription from '../dp2p-blocked-description';

jest.mock('Stores', () => ({
...jest.requireActual('Stores'),
useStores: jest.fn(),
}));

describe('<Dp2pBlockedDescription />', () => {
it('it should return `P2P transactions are locked. This feature is not available for payment agents.`', () => {
(useStores as jest.Mock).mockReturnValue({
general_store: {
is_p2p_blocked_for_pa: true,
is_high_risk: true,
is_blocked: false,
},
});
render(<Dp2pBlockedDescription />);
expect(
screen.getByText('P2P transactions are locked. This feature is not available for payment agents.')
).toBeInTheDocument();
});

it('it should return `To enable this feature you must complete the following:`', () => {
(useStores as jest.Mock).mockReturnValue({
general_store: {
is_p2p_blocked_for_pa: false,
is_high_risk: true,
is_blocked: false,
},
});
render(<Dp2pBlockedDescription />);
expect(screen.getByText('To enable this feature you must complete the following:')).toBeInTheDocument();
});

it('it should return `Please use live chat to contact our Customer Support team for help.` and open live chat when clicking on the `live chat`', () => {
(useStores as jest.Mock).mockReturnValue({
general_store: {
is_p2p_blocked_for_pa: false,
is_high_risk: false,
is_blocked: false,
},
});

window.LC_API = {
open_chat_window: jest.fn(),
on_chat_ended: jest.fn(),
};

render(<Dp2pBlockedDescription />);
expect(screen.getByText(/to contact our Customer Support team for help./)).toBeInTheDocument();

const live_chat_text = screen.getByText(/live chat/i);
expect(live_chat_text).toBeInTheDocument();

userEvent.click(live_chat_text);
expect(window.LC_API.open_chat_window).toHaveBeenCalledTimes(1);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import Dp2pBlocked from '../dp2p-blocked';

describe('<Dp2pBlocked />', () => {
it('it should render <Dp2pBlocked /> component', () => {
render(<Dp2pBlocked />);
expect(screen.getByText('Your Deriv P2P cashier is blocked')).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { useStores } from 'Stores/index';
import Dp2pBlockedChecklist from '..';

const mockHistoryPush = jest.fn();

jest.mock('Stores', () => ({
...jest.requireActual('Stores'),
useStores: jest.fn(),
}));

jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useHistory: () => ({
push: mockHistoryPush,
}),
}));

describe('<Dp2pBlockedChecklist />', () => {
it('it should render <Dp2pBlockedChecklist /> component if client is high risk and not blocked', () => {
(useStores as jest.Mock).mockReturnValue({
general_store: {
is_high_risk: true,
is_blocked: false,
},
});
render(<Dp2pBlockedChecklist />);
expect(screen.getByText('Complete the financial assessment form')).toBeInTheDocument();
});

it('it should redirect to `/account/financial-assessment` while clicking on checklist button if client is high risk and not blocked', () => {
(useStores as jest.Mock).mockReturnValue({
general_store: {
is_high_risk: true,
is_blocked: false,
},
});
render(<Dp2pBlockedChecklist />);
userEvent.click(screen.getByTestId('dt_checklist_item_status_action'));
expect(mockHistoryPush).toHaveBeenCalledWith({ pathname: '/account/financial-assessment' });
});

it('it should return null when client is not high risk', () => {
(useStores as jest.Mock).mockReturnValue({
general_store: {
is_high_risk: false,
is_blocked: false,
},
});
const { container } = render(<Dp2pBlockedChecklist />);
expect(container).toBeEmptyDOMElement();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.dp2p-blocked-checklist {
&__container {
margin-top: 2.4rem;
}

.dc-checklist__item {
width: 40rem;

@include mobile {
width: 100%;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react';
import React from 'react';
import { useHistory } from 'react-router-dom';
import { observer } from 'mobx-react-lite';
import { Checklist } from '@deriv/components';
import { routes } from '@deriv/shared';
import { observer } from 'mobx-react-lite';
import { useStores } from 'Stores';
import { localize } from '../i18next';
import { localize } from 'Components/i18next';
import { useStores } from 'Stores/index'; // remove index when store migration to ts is done

const Dp2pBlockedChecklist = () => {
const { general_store } = useStores();
Expand All @@ -23,8 +23,8 @@ const Dp2pBlockedChecklist = () => {
];

return (
<div className='dp2p-blocked__checklist-container'>
<Checklist className='dp2p-blocked__checklist' items={checklist_items} />
<div className='dp2p-blocked-checklist__container'>
<Checklist className='dp2p-blocked-checklist' items={checklist_items} />
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Dp2pBlockedChecklist from './dp2p-blocked-checklist';
import './dp2p-blocked-checklist.scss';

export default Dp2pBlockedChecklist;
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { Text } from '@deriv/components';
import React from 'react';
import { observer } from 'mobx-react-lite';
import { useStores } from 'Stores';
import { Localize } from '../i18next';
import { Text } from '@deriv/components';
import { Localize } from 'Components/i18next';
import { useStores } from 'Stores/index'; //remove index when store migration to ts is done

const Dp2pBlockedDescription = () => {
const { general_store } = useStores();
Expand All @@ -26,7 +26,7 @@ const Dp2pBlockedDescription = () => {
};

return (
<Text className='dp2p-blocked__description' align='center' color='prominent' line_height='m' size='xs'>
<Text align='center' color='prominent' size='xs'>
{getBlockedDescription()}
</Text>
);
Expand Down
Loading