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

Amina/feature/90115/update jurisdiction #12

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
6d7afcc
chore: test case for jurisdiction content
suisin-deriv Mar 29, 2023
004c25e
chore: edited mock values for modal-content test case
suisin-deriv Mar 30, 2023
2053456
Merge branch 'amina/feature/90115/update_jurisdiction' of github.com:…
suisin-deriv Apr 14, 2023
6ef14bd
chore: update Test Case for Jurisdiction modal content
suisin-deriv Apr 14, 2023
fde6d0e
chore: test case for jurisdiction modal content
suisin-deriv Apr 17, 2023
d6536d0
chore: update jurisdiction_selected_shortcode for foot note
suisin-deriv Apr 17, 2023
6c3f5c9
chore: update import to follow document
suisin-deriv Apr 17, 2023
ae3e07d
chore: remove hard coded parts
suisin-deriv Apr 17, 2023
92b77f6
chore: move the imports variable according to documentation
suisin-deriv Apr 17, 2023
8f38263
chore: included checks for MF clients and high risk clients
suisin-deriv Apr 17, 2023
a6a5236
chore: updated test case based on comments
suisin-deriv Apr 17, 2023
d4c8658
chore: updated logic for test cases
suisin-deriv Apr 17, 2023
07611c4
chore: update test case in footnote
suisin-deriv Apr 17, 2023
e0deb12
Shaheer/89647/2 fa changes (#8011)
shaheer-deriv Apr 18, 2023
e316a16
Merge branch 'binary-com:master' into amina/feature/90115/update_juri…
shaheer-deriv Apr 18, 2023
678b7ef
Suisin/chore: solve tradershub dropdown translation issue (#8250)
suisin-deriv Apr 18, 2023
acba460
Merge pull request #53 from suisin-deriv/suisin/92035/test_case_for_j…
amina-deriv Apr 18, 2023
4350d5b
Merge branch 'binary-com:master' into amina/feature/90115/update_juri…
shaheer-deriv Apr 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import React from 'react';
import classNames from 'classnames';
import { Formik, Form, Field } from 'formik';
import { Input, Button } from '@deriv/components';
import { localize, getLanguage } from '@deriv/translations';
import { getPropertyValue, WS, redirectToLogin } from '@deriv/shared';
import { localize } from '@deriv/translations';
import { getPropertyValue, WS } from '@deriv/shared';

const DigitForm = ({ is_enabled, setTwoFAStatus, logoutClient }) => {
const DigitForm = ({ is_enabled, setTwoFAStatus, setTwoFAChangedStatus }) => {
const [is_success, setSuccess] = React.useState(false);
const button_text = is_enabled ? localize('Disable 2FA') : localize('Enable');
const button_text = is_enabled ? localize('Disable') : localize('Enable');

const initial_form = {
digit_code: '',
Expand Down Expand Up @@ -50,7 +50,7 @@ const DigitForm = ({ is_enabled, setTwoFAStatus, logoutClient }) => {
setSuccess(true);
resetForm();
setTwoFAStatus(is_enabled_response);
logoutClient().then(() => redirectToLogin(false, getLanguage()));
setTwoFAChangedStatus(true);
}
};

Expand All @@ -66,12 +66,14 @@ const DigitForm = ({ is_enabled, setTwoFAStatus, logoutClient }) => {
data-lpignore='true'
type='text'
className='two-factor__input'
label={localize('6 digit code')}
label={localize('Authentication code')}
value={values.digit_code}
onChange={handleChange}
onBlur={handleBlur}
required
error={touched.digit_code && errors.digit_code}
maxLength='6'
autoComplete='off'
/>
)}
</Field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ import TwoFactorAuthenticationArticle from './two-factor-authentication-article.
const TwoFactorAuthentication = ({
email_address,
is_switching,
logoutClient,
setTwoFAStatus,
getTwoFAStatus,
has_enabled_two_fa,
Notifications,
setTwoFAChangedStatus,
}) => {
const [is_loading, setLoading] = React.useState(true);
const [is_qr_loading, setQrLoading] = React.useState(false);
Expand All @@ -36,7 +37,7 @@ const TwoFactorAuthentication = ({

React.useEffect(() => {
getDigitStatus();
}, [getDigitStatus]);
}, [getDigitStatus, has_enabled_two_fa]);

const generateQrCode = React.useCallback(async () => {
setQrLoading(true);
Expand Down Expand Up @@ -91,7 +92,7 @@ const TwoFactorAuthentication = ({
<DigitForm
is_enabled={has_enabled_two_fa}
setTwoFAStatus={setTwoFAStatus}
logoutClient={logoutClient}
setTwoFAChangedStatus={setTwoFAChangedStatus}
/>
</div>
</ThemedScrollbars>
Expand Down Expand Up @@ -140,26 +141,37 @@ const TwoFactorAuthentication = ({
{is_qr_loading ? (
<Loading is_fullscreen={false} />
) : (
<>
<div className='two-factor__qr--wrapper'>
<QRCode value={qr_secret_key} />
</div>
<React.Fragment>
{qr_secret_key && (
<div className='two-factor__qr--wrapper'>
<QRCode value={qr_secret_key} />
</div>
)}

<Text as='h4' size='xs' align='center' className='two-factor__qr--message'>
{localize(
'If you are unable to scan the QR code, you can manually enter this code instead:'
)}
</Text>
<div className='two-factor__qr--code'>
<Text size='xs'>{secret_key}</Text>
<Clipboard
text_copy={secret_key}
info_message={localize('Click here to copy key')}
success_message={localize('Key copied!')}
className='two-factor__qr--clipboard'
/>
</div>
</>
{secret_key && (
<React.Fragment>
<Text
as='h4'
size='xs'
align='center'
className='two-factor__qr--message'
>
{localize(
'If you are unable to scan the QR code, you can manually enter this code instead:'
)}
</Text>
<div className='two-factor__qr--code'>
<Text size='xs'>{secret_key}</Text>
<Clipboard
text_copy={secret_key}
info_message={localize('Click here to copy key')}
success_message={localize('Key copied!')}
className='two-factor__qr--clipboard'
/>
</div>
</React.Fragment>
)}
</React.Fragment>
)}
</div>
</Timeline.Item>
Expand All @@ -169,7 +181,7 @@ const TwoFactorAuthentication = ({
<DigitForm
is_enabled={has_enabled_two_fa}
setTwoFAStatus={setTwoFAStatus}
logoutClient={logoutClient}
setTwoFAChangedStatus={setTwoFAChangedStatus}
/>
</Timeline.Item>
</Timeline>
Expand All @@ -188,6 +200,7 @@ const TwoFactorAuthentication = ({
'two-factor__wrapper-dashboard': is_appstore,
})}
>
{Notifications && <Notifications />}
{has_enabled_two_fa ? TwoFactorEnabled : TwoFactorDisabled}
</div>
</section>
Expand All @@ -197,17 +210,19 @@ const TwoFactorAuthentication = ({
TwoFactorAuthentication.propTypes = {
email_address: PropTypes.string,
is_switching: PropTypes.bool,
logoutClient: PropTypes.func,
setTwoFAStatus: PropTypes.func,
getTwoFAStatus: PropTypes.func,
has_enabled_two_fa: PropTypes.bool,
Notifications: PropTypes.node,
setTwoFAChangedStatus: PropTypes.func,
};

export default connect(({ client }) => ({
export default connect(({ client, ui }) => ({
email_address: client.email_address,
is_switching: client.is_switching,
logoutClient: client.logout,
setTwoFAStatus: client.setTwoFAStatus,
getTwoFAStatus: client.getTwoFAStatus,
has_enabled_two_fa: client.has_enabled_two_fa,
Notifications: ui.notification_messages_ui,
setTwoFAChangedStatus: client.setTwoFAChangedStatus,
}))(TwoFactorAuthentication);
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
border: none;
& > div.dc-dropdown {
&-container {
min-width: 8.2rem;
width: 8.2rem;
min-width: 7.1rem;
width: auto;
}
}

Expand All @@ -32,14 +32,17 @@
line-height: 20px;
letter-spacing: 0em;
text-align: left;
padding-left: 0.6em;
padding-left: 0.4em;
}
& > .dc-dropdown__display-text {
padding-right: 2.3em;
}
}
&--real,
&--real:focus,
&--real:hover {
border: 1px solid var(--status-info);
width: 87%;
min-width: 87%;
& > .dc-text {
color: var(--status-info);
}
Expand All @@ -52,7 +55,7 @@
width: 90%;
& > .dc-text {
color: var(--status-success);
padding-left: 0.8em;
padding-left: 0.65em;
}
}
&__icon {
Expand All @@ -62,11 +65,11 @@
}
&--real {
--fill-color1: var(--status-info) !important;
right: 1.8rem;
right: 0.7rem;
}
&--demo {
--fill-color1: var(--status-success) !important;
right: 1.5rem;
right: 1.4rem;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import React from 'react';
import classNames from 'classnames';
import { observer } from 'mobx-react-lite';
import { Dropdown } from '@deriv/components';
import { account_types } from 'Constants/platform-config';
import { getAccountTypes } from 'Constants/platform-config';
import { useStores } from 'Stores';
import './account-type-dropdown.scss';

const AccountTypeDropdown = () => {
const { traders_hub, client } = useStores();
const { traders_hub, client, common } = useStores();
const { selected_account_type, selectAccountType } = traders_hub;
const { setPrevAccountType } = client;
const { current_language } = common;

return (
<div className={classNames('account-type-dropdown--parent')}>
Expand All @@ -20,7 +21,8 @@ const AccountTypeDropdown = () => {
'account-type-dropdown',
`account-type-dropdown--${selected_account_type}`
)}
list={account_types}
list={getAccountTypes()}
key={`account-type-dropdown__icon--key-${current_language}`}
onChange={async (e: React.ChangeEvent<HTMLInputElement>) => {
await selectAccountType(e.target.value);
await setPrevAccountType(e.target.value);
Expand Down
6 changes: 3 additions & 3 deletions packages/appstore/src/constants/platform-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { TAccountCategory, TRegionAvailability } from 'Types';

export type AccountType = { text: 'Real' | 'Demo'; value: TAccountCategory };
export type RegionAvailability = 'Non-EU' | 'EU' | 'All';
export const account_types: AccountType[] = [
{ text: 'Demo', value: 'demo' },
{ text: 'Real', value: 'real' },
export const getAccountTypes = (): AccountType[] => [
{ text: localize('Demo'), value: 'demo' },
{ text: localize('Real'), value: 'real' },
];
export const region_availability: RegionAvailability[] = ['Non-EU', 'EU'];

Expand Down
Loading