-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: p2p structure, styles and components (#8696)
* refactor: refactor p2p styles * refactor: refactor styles * fix: classname typo * fix: fix broken style * refactor: update based on pr comments * fix: failed tests * fix: import error * refactor: rename datatest id * refactor: remove unused styles and refactor text components * refactor: restructure the p2p package * refactor: update translations imports * refactor: update modal-manager import * fix: pr review comments * fix: fix some broken styles * fix: review comments * chore: change in failed test file and remove change from unrelated file * fix: review comments * Henry/fix: navigate to accu trade type in reports page after purchasing a c… (#8684) * fix: navigate to accu trade type in reports page after purchasing a contract * fix: circle CI error * fix: codecov * fix: circle CI issue * refactor: refactor dpep-blocked components * fix: failed test * fix: review comments * refactor: test descriptions changes * refactor: import localize from p2p i18n instead of shared translations package * fix: review components * chore: refactored temporarily barred hint component * refactor: rearrange imports to follow guidelines * refactor: standardise react imports * chore: refactored p2p-empty component * chore: added default value for has_tabs * feat: unit test added for page return component * refactor: recommended-by component * fix: updated index file * chore: added test cases for star rating * chore: changed describe * refactor: add new test cases to increase coverage * refactor: add comment in empty arrow function * refactor: refactor trade-badge component * fix: review comments fixed * refactor: remove prop-types import * refactor: update react import * refactor: refactor form-submit-error-message, table-error * refactor: nickname form * refactor: review comments * fix: tests * chore: refactored user avatar component * refactor: refactor toggle-container component * chore: added suggestions * refactor: delete the type and use propswithchildren * chore: refactored FloatingRate component * refactor: refactor block-user-empty component * refactor: online status component refactoring * refactor: review comments * refactor: add margin-top * refactor: udpated test description * refactor: change test cases descriptions * refactor: review comment * refactor: refactored verification component * chore: refactored recommend user component * chore: removed fireEvent, used userEvent * refactor: updated tests * refactor: review comment fix * refactor: added type checking for modal manager in test case * translations: 📚 sync translations with crowdin (#8881) Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com> * thisyahlen/fix: change algo for realAccountSignup (#8656) * fix: change algo for realAccountSignup * fix: refactor * redeploy: vercel * translations: 📚 sync translations with crowdin (#8885) Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com> * translations: 📚 sync translations with crowdin (#8890) Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com> * likhith/fix: 🐛 resolved required field error (#8886) * fix: 🐛 resolved required field error * feat: fixed issue with Citizen field * refactor: removed unused code * refactor: updated test * fix: code smells * fix: tests * refactor: reduce code complexity to remove code smell * refactor: updated return * refactor: udpated test * refactor: delete text component and use default button text styles instead * fix: raised subtasks * fix: advertiser buy/sell row * fix: style fix in edit/add payment method form in my profile * fix: notification issue * fix: block banned user bug * fix: issue for popup not showing when rate updated before selecting form * fix: removed console * fix: added todo * fix: added undefined check * fix: subtasks raised * fix: daily limit notification * fix: tests failed * fix: notification popup issue not shown in responsive * fix: filter button spacing * fix: failing tests * fix: get server hits bump error when in advertiser page and block it from BO * fix: revert unwanted changes from master * fix: remove unnecessary changes * fix: remove unnecessary changes * fix: tests --------- Co-authored-by: Farhan Ahmad Nurzi <farhan.nurzi@regentmarkets.com> Co-authored-by: henry-deriv <118344354+henry-deriv@users.noreply.github.com> Co-authored-by: ameerul hady <ameerul@deriv.com> Co-authored-by: nada-deriv <nada.ajinas@deriv.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com> Co-authored-by: thisyahlen <104053934+thisyahlen-deriv@users.noreply.github.com> Co-authored-by: Likhith Kolayari <98398322+likhith-deriv@users.noreply.github.com>
- Loading branch information
1 parent
125fc0f
commit 32bc244
Showing
361 changed files
with
4,694 additions
and
3,657 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
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; | ||
}; | ||
}; | ||
} |
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
67 changes: 0 additions & 67 deletions
67
packages/p2p/src/components/buy-sell/currency-selector/currency-selector.scss
This file was deleted.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
packages/p2p/src/components/dp2p-blocked/__tests__/dp2p-blocked-description.spec.tsx
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,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); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
packages/p2p/src/components/dp2p-blocked/__tests__/dp2p-blocked.spec.tsx
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,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(); | ||
}); | ||
}); |
55 changes: 55 additions & 0 deletions
55
.../components/dp2p-blocked/dp2p-blocked-checklist/__tests__/dp2p-blocked-checklist.spec.tsx
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,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(); | ||
}); | ||
}); |
13 changes: 13 additions & 0 deletions
13
packages/p2p/src/components/dp2p-blocked/dp2p-blocked-checklist/dp2p-blocked-checklist.scss
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,13 @@ | ||
.dp2p-blocked-checklist { | ||
&__container { | ||
margin-top: 2.4rem; | ||
} | ||
|
||
.dc-checklist__item { | ||
width: 40rem; | ||
|
||
@include mobile { | ||
width: 100%; | ||
} | ||
} | ||
} |
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
4 changes: 4 additions & 0 deletions
4
packages/p2p/src/components/dp2p-blocked/dp2p-blocked-checklist/index.ts
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,4 @@ | ||
import Dp2pBlockedChecklist from './dp2p-blocked-checklist'; | ||
import './dp2p-blocked-checklist.scss'; | ||
|
||
export default Dp2pBlockedChecklist; |
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.
32bc244
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
deriv-app – ./
binary.sx
deriv-app-git-master.binary.sx
deriv-app.binary.sx
deriv-app.vercel.app