-
Notifications
You must be signed in to change notification settings - Fork 303
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
carol/ P2P: 2FA #6009
Merged
Merged
carol/ P2P: 2FA #6009
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1eba58b
Merge branch 'master' of github.com:binary-com/deriv-app
086058c
Merge branch 'master' of github.com:binary-com/deriv-app
ba5e87e
Merge branch 'master' of github.com:binary-com/deriv-app
95b8ec8
Merge branch 'master' of github.com:binary-com/deriv-app
a12090f
Merge branch 'master' of github.com:binary-com/deriv-app
d7d17cc
Merge branch 'master' of github.com:binary-com/deriv-app
be7c7bb
Merge branch 'master' of github.com:binary-com/deriv-app
f60d6c2
Merge branch 'master' of github.com:binary-com/deriv-app
f28f08d
Merge branch 'master' of github.com:binary-com/deriv-app
da2aaf6
Merge branch 'master' of github.com:binary-com/deriv-app
6d9113c
Merge branch 'master' of github.com:binary-com/deriv-app
4244c91
Merge branch 'master' of github.com:binary-com/deriv-app
b3f8906
Merge branch 'master' of github.com:binary-com/deriv-app
6f3aea9
Merge branch 'master' of github.com:binary-com/deriv-app
93882a4
add: icons
a5f98bc
add: one more icon
c7187ec
add email verification modal
4a32b6f
add invalid verification link modal
91c86c5
add email verified
c551d7f
add email blocked modal
368e044
add email blocked modal
5a4b734
use align prop instead
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
packages/components/src/components/icon/common/ic-email-sent-p2p.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
...es/components/src/components/icon/common/ic-email-verification-link-blocked.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
...es/components/src/components/icon/common/ic-email-verification-link-invalid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
...ages/components/src/components/icon/common/ic-email-verification-link-valid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
41 changes: 41 additions & 0 deletions
41
packages/p2p/src/components/email-link-blocked-modal/email-link-blocked-modal.jsx
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,41 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Icon, Modal, Text } from '@deriv/components'; | ||
import { Localize } from 'Components/i18next'; | ||
|
||
const EmailLinkBlockedModal = ({ | ||
blocked_for_minutes, | ||
is_email_link_blocked_modal_open, | ||
setIsEmailLinkBlockedModalOpen, | ||
}) => { | ||
return ( | ||
<Modal | ||
has_close_icon | ||
is_open={is_email_link_blocked_modal_open} | ||
title='' | ||
toggleModal={() => setIsEmailLinkBlockedModalOpen(false)} | ||
width='440px' | ||
> | ||
<Modal.Body className='email-link-blocked-modal'> | ||
<Icon icon='IcEmailVerificationLinkBlocked' size='128' /> | ||
<Text className='email-link-blocked-modal--text' color='prominent' size='s' weight='bold'> | ||
<Localize i18n_default_text='Too many failed attempts' /> | ||
</Text> | ||
<Text className='email-link-blocked-modal--blocked_text' color='prominent' size='s'> | ||
<Localize | ||
i18n_default_text='We have temporarily blocked your request after too many failed attempts. Please try again after {{blocked_for_minutes}} minutes.' | ||
values={{ blocked_for_minutes }} | ||
/> | ||
</Text> | ||
</Modal.Body> | ||
</Modal> | ||
); | ||
}; | ||
|
||
EmailLinkBlockedModal.propTypes = { | ||
blocked_for_minutes: PropTypes.number, | ||
is_email_link_blocked_modal_open: PropTypes.bool, | ||
setIsEmailLinkBlockedModalOpen: PropTypes.func, | ||
}; | ||
|
||
export default EmailLinkBlockedModal; |
13 changes: 13 additions & 0 deletions
13
packages/p2p/src/components/email-link-blocked-modal/email-link-blocked-modal.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 @@ | ||
.email-link-blocked-modal { | ||
align-items: center; | ||
display: flex; | ||
flex-direction: column; | ||
|
||
&--blocked_text { | ||
text-align: center; | ||
} | ||
|
||
&--text { | ||
margin: 2.4rem 0; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/p2p/src/components/email-link-blocked-modal/index.js
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 EmailLinkBlockedModal from './email-link-blocked-modal.jsx'; | ||
import './email-link-blocked-modal.scss'; | ||
|
||
export default EmailLinkBlockedModal; |
50 changes: 50 additions & 0 deletions
50
packages/p2p/src/components/email-link-verified-modal/email-link-verified-modal.jsx
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,50 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Button, Icon, Modal, Text } from '@deriv/components'; | ||
import { Localize } from 'Components/i18next'; | ||
|
||
const EmailLinkVerifiedModal = ({ | ||
amount, | ||
currency, | ||
is_email_verified_modal_open, | ||
onClickConfirm, | ||
setIsEmailLinkVerifiedModalOpen, | ||
}) => { | ||
return ( | ||
<Modal | ||
has_close_icon | ||
is_open={is_email_verified_modal_open} | ||
title='' | ||
toggleModal={() => setIsEmailLinkVerifiedModalOpen(false)} | ||
width='440px' | ||
> | ||
<Modal.Body className='email-verified-modal'> | ||
<Icon icon='IcEmailVerificationLinkValid' size='128' /> | ||
<Text className='email-verified-modal--text' color='prominent' size='s' weight='bold'> | ||
<Localize i18n_default_text="We've verified your order" /> | ||
</Text> | ||
<Text className='email-verified-modal--confirmation_text' color='prominent' size='s'> | ||
<Localize | ||
i18n_default_text="Please ensure you've received {{amount}} {{currency}} in your account and hit Confirm to complete the transaction." | ||
values={{ amount, currency }} | ||
/> | ||
</Text> | ||
</Modal.Body> | ||
<Modal.Footer className='email-verified-modal--footer'> | ||
<Button large primary onClick={onClickConfirm}> | ||
<Localize i18n_default_text='Confirm' /> | ||
</Button> | ||
</Modal.Footer> | ||
</Modal> | ||
); | ||
}; | ||
|
||
EmailLinkVerifiedModal.propTypes = { | ||
amount: PropTypes.number, | ||
currency: PropTypes.string, | ||
is_email_verified_modal_open: PropTypes.bool, | ||
onClickConfirm: PropTypes.func, | ||
setIsEmailLinkVerifiedModalOpen: PropTypes.func, | ||
}; | ||
|
||
export default EmailLinkVerifiedModal; |
17 changes: 17 additions & 0 deletions
17
packages/p2p/src/components/email-link-verified-modal/email-link-verified-modal.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,17 @@ | ||
.email-verified-modal { | ||
align-items: center; | ||
display: flex; | ||
flex-direction: column; | ||
|
||
&--confirmation_text { | ||
text-align: center; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we use |
||
|
||
&--footer { | ||
align-self: center; | ||
} | ||
|
||
&--text { | ||
margin: 2.4rem 0; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/p2p/src/components/email-link-verified-modal/index.js
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 EmailLinkVerifiedModal from './email-link-verified-modal.jsx'; | ||
import './email-link-verified-modal.scss'; | ||
|
||
export default EmailLinkVerifiedModal; |
109 changes: 109 additions & 0 deletions
109
packages/p2p/src/components/email-verification-modal/email-verification-modal.jsx
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,109 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Button, Icon, Loading, Modal, Text } from '@deriv/components'; | ||
import { Localize } from 'Components/i18next'; | ||
|
||
const EmailVerificationModal = ({ | ||
email_address, | ||
is_email_verification_modal_open, | ||
is_verifying = false, | ||
onClickResendEmailButton, | ||
remaining_time, | ||
setIsEmailVerificationModalOpen, | ||
should_show_resend_email_button = false, | ||
verification_link_expiry_time, | ||
}) => { | ||
const [should_show_reasons_if_no_email, setShouldShowReasonsIfNoEmail] = React.useState(false); | ||
|
||
if (is_verifying) { | ||
return ( | ||
<Modal has_close_icon={false} small width='440px'> | ||
<Loading is_fullscreen={false} /> | ||
</Modal> | ||
); | ||
} | ||
|
||
return ( | ||
<Modal | ||
has_close_icon | ||
is_open={is_email_verification_modal_open} | ||
title='' | ||
toggleModal={() => setIsEmailVerificationModalOpen(false)} | ||
width='440px' | ||
> | ||
<Modal.Body className='email-verification-modal'> | ||
<Icon icon='IcEmailSentP2p' size='128' /> | ||
<Text className='email-verification-modal--email_text' color='prominent' size='s' weight='bold'> | ||
<Localize | ||
i18n_default_text="We've sent you an email at {{email_address}}.<0 />Please click the verification link in the email to verify your order." | ||
components={[<br key={0} />]} | ||
values={{ email_address }} | ||
/> | ||
</Text> | ||
<Text color='prominent' size='s'> | ||
<Localize | ||
i18n_default_text='The verification link expires in {{verification_link_expiry_time}} minutes' | ||
values={{ verification_link_expiry_time }} | ||
/> | ||
</Text> | ||
<Text | ||
className='email-verification-modal--receive_email_text' | ||
color='loss-danger' | ||
onClick={() => setShouldShowReasonsIfNoEmail(true)} | ||
size='xs' | ||
weight='bold' | ||
> | ||
<Localize i18n_default_text="Didn't receive the email?" /> | ||
</Text> | ||
{should_show_reasons_if_no_email && ( | ||
<React.Fragment> | ||
<div className='email-verification-modal--reason'> | ||
<Icon icon='IcEmailSpam' size={36} /> | ||
<Text className='email-verification-modal--reason__text' color='prominent' size='xxs'> | ||
<Localize i18n_default_text='The email is in your spam folder (sometimes things get lost there).' /> | ||
</Text> | ||
</div> | ||
<div className='email-verification-modal--reason'> | ||
<Icon icon='IcEmail' size={36} /> | ||
<Text className='email-verification-modal--reason__text' color='prominent' size='xxs'> | ||
<Localize i18n_default_text='You accidentally gave us another email address (usually a work or a personal one instead of the one you meant).' /> | ||
</Text> | ||
</div> | ||
<div className='email-verification-modal--reason'> | ||
<Icon icon='IcEmailTypo' size={36} /> | ||
<Text className='email-verification-modal--reason__text' color='prominent' size='xxs'> | ||
<Localize i18n_default_text='The email address you entered had a mistake or typo (happens to the best of us).' /> | ||
</Text> | ||
</div> | ||
<div className='email-verification-modal--reason'> | ||
<Icon icon='IcEmailFirewall' size={36} /> | ||
<Text className='email-verification-modal--reason__text' color='prominent' size='xxs'> | ||
<Localize i18n_default_text='We can’t deliver the email to this address (usually because of firewalls or filtering).' /> | ||
</Text> | ||
</div> | ||
</React.Fragment> | ||
)} | ||
</Modal.Body> | ||
{should_show_resend_email_button && ( | ||
<Modal.Footer> | ||
<Button large primary onClick={onClickResendEmailButton}> | ||
<Localize i18n_default_text='Resend email {{remaining_time}}' values={{ remaining_time }} /> | ||
</Button> | ||
</Modal.Footer> | ||
)} | ||
</Modal> | ||
); | ||
}; | ||
|
||
EmailVerificationModal.propTypes = { | ||
email_address: PropTypes.string, | ||
is_email_verification_modal_open: PropTypes.bool, | ||
is_verifying: PropTypes.bool, | ||
onClickResendEmailButton: PropTypes.func, | ||
remaining_time: PropTypes.string, | ||
setIsEmailVerificationModalOpen: PropTypes.func, | ||
should_show_resend_email_button: PropTypes.bool, | ||
verification_link_expiry_time: PropTypes.number, | ||
}; | ||
|
||
export default EmailVerificationModal; |
26 changes: 26 additions & 0 deletions
26
packages/p2p/src/components/email-verification-modal/email-verification-modal.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,26 @@ | ||
.email-verification-modal { | ||
align-items: center; | ||
display: flex; | ||
flex-direction: column; | ||
|
||
&--email_text { | ||
margin: 2.4rem 0; | ||
text-align: center; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
} | ||
|
||
&--reason { | ||
display: flex; | ||
flex-direction: row; | ||
gap: 1.6rem; | ||
margin: 2.4rem 0; | ||
|
||
&__text { | ||
max-width: 34rem; | ||
} | ||
} | ||
|
||
&--receive_email_text { | ||
cursor: pointer; | ||
margin: 3rem 0 0.6rem; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/p2p/src/components/email-verification-modal/index.js
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 EmailVerificationModal from './email-verification-modal.jsx'; | ||
import './email-verification-modal.scss'; | ||
|
||
export default EmailVerificationModal; |
4 changes: 4 additions & 0 deletions
4
packages/p2p/src/components/invalid-verification-link-modal/index.js
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 InvalidVerificationLinkModal from './invalid-verification-link-modal.jsx'; | ||
import './invalid-verification-link-modal.scss'; | ||
|
||
export default InvalidVerificationLinkModal; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
can we use
align
prop inText
instead of creating a new class?