Skip to content

Commit

Permalink
refactor: used aliases and added new Helper Alias
Browse files Browse the repository at this point in the history
  • Loading branch information
hamza-deriv committed Nov 21, 2023
1 parent 3dee8e4 commit 579cd49
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { VerifyEmailResponse } from '@deriv/api-types';
import { getCFDPlatformLabel } from '@deriv/shared';
import { observer, useStore } from '@deriv/stores';
import { useVerifyEmail } from '@deriv/api';
import { TCFDPasswordManagerTabContentWrapper, TCFDPasswordManagerModal } from '../../../Containers/props.types';
import { QUERY_STATUS } from '../../../Helpers/cfd-config';
import { TCFDPasswordManagerTabContentWrapper, TCFDPasswordManagerModal } from 'Containers/props.types';
import { QUERY_STATUS } from 'Helpers/cfd-config';
import { CFDPasswordReset } from './cfd-password-reset';
import { CFDPasswordManagerTabContent } from './cfd-password-manager-tab-content';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ import { localize } from '@deriv/translations';
import { isMobile, validLength, validPassword, getErrorMessages, getCFDPlatformLabel } from '@deriv/shared';
import { useTradingPlatformInvestorPasswordChange, useTradingPlatformPasswordChange } from '@deriv/api';
import { FormikErrors } from 'formik';
import TradingPasswordManager from '../../../Containers/trading-password-manager';
import InvestorPasswordManager from '../../../Containers/investor-password-manager';
import {
TCFDPasswordManagerTabContent,
TFormValues,
TPasswordManagerModalFormValues,
} from '../../../Containers/props.types';
import { CFD_PLATFORMS, QUERY_STATUS, PASSWORD_TYPE } from '../../../Helpers/cfd-config';
import TradingPasswordManager from 'Containers/trading-password-manager';
import InvestorPasswordManager from 'Containers/investor-password-manager';
import { TCFDPasswordManagerTabContent, TFormValues, TPasswordManagerModalFormValues } from 'Containers/props.types';
import { CFD_PLATFORMS, QUERY_STATUS, PASSWORD_TYPE } from 'Helpers/cfd-config';
import { TStatus } from './cfd-password-manager-modal';

export const CFDPasswordManagerTabContent = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Icon, Button, Text } from '@deriv/components';
import { Localize } from '@deriv/translations';
import { TCFDPasswordReset } from '../../../Containers/props.types';
import { TCFDPasswordReset } from 'Containers/props.types';
import { CountdownComponent } from './countdown-component';

export const CFDPasswordReset = ({
Expand Down Expand Up @@ -39,13 +39,12 @@ export const CFDPasswordReset = ({
<Text as='p' size='xs' align='center'>
<Localize i18n_default_text='Please click on the link in the email to reset your password.' />
</Text>
{!is_resend_verification_requested && (
{!is_resend_verification_requested ? (
<Button className='cfd-verification-email-sent__resend-button' primary onClick={onClickVerification}>
<Localize i18n_default_text="Didn't receive the email?" />
</Button>
)}
{is_resend_verification_requested && (
<>
) : (
<React.Fragment>
<Text
as='p'
size='xs'
Expand Down Expand Up @@ -79,7 +78,7 @@ export const CFDPasswordReset = ({
/>
)}
</Button>
</>
</React.Fragment>
)}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { TCountdownComponent } from '../../../Containers/props.types';
import { TCountdownComponent } from 'Containers/props.types';

export const CountdownComponent = ({ count_from = 60, onTimeout }: TCountdownComponent) => {
const [count, setCount] = React.useState<number>(count_from);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { TCFDPasswordFormReusedProps, TCFDPasswordFormValues, TOnSubmitPassword } from './types';
import ChangePasswordConfirmation from '../../../Containers/cfd-change-password-confirmation';
import ChangePasswordConfirmation from 'Containers/cfd-change-password-confirmation';
import { CreatePassword } from './create-password';
import { CFD_PLATFORMS } from '../../../Helpers/cfd-config';
import { CFD_PLATFORMS } from 'Helpers/cfd-config';

import { FormikHelpers } from 'formik';
import { MultiStep } from '@deriv/components';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import { TCFDPasswordFormReusedProps, TCFDPasswordFormValues, TOnSubmitPassword } from './types';
import { localize, Localize } from '@deriv/translations';
import { Formik, FormikErrors } from 'formik';
import { localize, Localize } from '@deriv/translations';
import {
isDesktop,
isMobile,
Expand All @@ -11,8 +10,9 @@ import {
getLegalEntityName,
} from '@deriv/shared';
import { Text, FormSubmitButton, PasswordInput } from '@deriv/components';
import { TCFDPasswordFormReusedProps, TCFDPasswordFormValues, TOnSubmitPassword } from './types';
import { CFDCreatePasswordForm } from './cfd-create-password-form';
import { CFD_PLATFORMS } from '../../../Helpers/cfd-config';
import { CFD_PLATFORMS } from 'Helpers/cfd-config';

const getCancelButtonLabel = ({
should_set_trading_password,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,17 @@ import {
useTradingPlatformPasswordChange,
useVerifyEmail,
} from '@deriv/api';
import {
getDxCompanies,
getMtCompanies,
TMtCompanies,
TDxCompanies,
} from '../../../Stores/Modules/CFD/Helpers/cfd-config';
import SuccessDialog from '../../../Components/success-dialog.jsx';
import '../../../sass/cfd.scss';
import { getDxCompanies, getMtCompanies, TMtCompanies, TDxCompanies } from 'Stores/Modules/CFD/Helpers/cfd-config';
import SuccessDialog from 'Components/success-dialog.jsx';
import 'sass/cfd.scss';
import './cfd-password-modal.scss';
import { observer, useStore } from '@deriv/stores';
import { useCfdStore } from '../../../Stores/Modules/CFD/Helpers/useCfdStores';
import { useCfdStore } from 'Stores/Modules/CFD/Helpers/useCfdStores';
import { PasswordModalHeader } from './password-modal-header';
import { CFDPasswordForm } from './cfd-password-form';
import { IconType } from './icon-type';
import { TCFDPasswordFormValues, TOnSubmitPassword } from './types';
import { CFD_PLATFORMS, CATEGORY, JURISDICTION, MARKET_TYPE, QUERY_STATUS } from '../../../Helpers/cfd-config';
import { CFD_PLATFORMS, CATEGORY, JURISDICTION, MARKET_TYPE, QUERY_STATUS } from 'Helpers/cfd-config';

type TReviewMsgForMT5 = {
is_selected_mt5_verified: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Formik, FormikErrors } from 'formik';
import React from 'react';
import { TCFDPasswordFormReusedProps, TCFDPasswordFormValues, TOnSubmitPassword } from './types';
import { Text, Icon, PasswordMeter, PasswordInput, FormSubmitButton } from '@deriv/components';
import { localize, Localize } from '@deriv/translations';
import { getCFDPlatformLabel, getErrorMessages } from '@deriv/shared';
import { CFD_PLATFORMS } from '../../../Helpers/cfd-config';
import { TCFDPasswordFormReusedProps, TCFDPasswordFormValues, TOnSubmitPassword } from './types';
import { CFD_PLATFORMS } from 'Helpers/cfd-config';

type TCFDCreatePasswordProps = TCFDPasswordFormReusedProps & {
password: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import React from 'react';
import { Button, Icon, PasswordMeter, PasswordInput, FormSubmitButton, Loading, Modal, Text } from '@deriv/components';
import { validLength, validPassword, getErrorMessages, redirectToLogin } from '@deriv/shared';
import { localize, Localize, getLanguage } from '@deriv/translations';
import { getMtCompanies, TMtCompanies } from '../../Stores/Modules/CFD/Helpers/cfd-config';
import { TResetPasswordIntent, TCFDResetPasswordModal, TError } from '../../Containers/props.types';
import { observer, useStore } from '@deriv/stores';
import { useTradingPlatformInvestorPasswordReset } from '@deriv/api';
import { useCfdStore } from '../../Stores/Modules/CFD/Helpers/useCfdStores';
import { CFD_PLATFORMS, QUERY_STATUS } from '../../Helpers/cfd-config';
import { getMtCompanies, TMtCompanies } from 'Stores/Modules/CFD/Helpers/cfd-config';
import { useCfdStore } from 'Stores/Modules/CFD/Helpers/useCfdStores';
import { TResetPasswordIntent, TCFDResetPasswordModal, TError } from 'Containers/props.types';
import { CFD_PLATFORMS, QUERY_STATUS } from 'Helpers/cfd-config';

const ResetPasswordIntent = ({ current_list, children, is_eu, ...props }: TResetPasswordIntent) => {
const reset_password_intent = localStorage.getItem('cfd_reset_password_intent');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react';
import { Text, Button, Icon } from '@deriv/components';
import { Localize } from '@deriv/translations';
import { getCFDPlatformLabel } from '@deriv/shared';
import { TChangePassword } from '../../../Containers/props.types';
import { CFD_PLATFORMS } from '../../../Helpers/cfd-config';
import { TChangePassword } from 'Containers/props.types';
import { CFD_PLATFORMS } from 'Helpers/cfd-config';

export const ChangePassword = ({ platform, onConfirm }: TChangePassword) => (
<div className='cfd-change-password'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { SendEmailTemplate } from '@deriv/components';
import { localize, Localize } from '@deriv/translations';
import { getCFDPlatformLabel } from '@deriv/shared';
import { useVerifyEmail } from '@deriv/api';
import { TPasswordResetAndTradingPasswordManager } from '../../../Containers/props.types';
import { CATEGORY, CFD_PLATFORMS } from '../../../Helpers/cfd-config';
import { TPasswordResetAndTradingPasswordManager } from 'Containers/props.types';
import { CATEGORY, CFD_PLATFORMS } from 'Helpers/cfd-config';

export const PasswordReset = ({ email, platform, account_group }: TPasswordResetAndTradingPasswordManager) => {
const { mutate: verifyEmail } = useVerifyEmail();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { MultiStep } from '@deriv/components';
import { localize } from '@deriv/translations';
import ChangePasswordConfirmation from '../../../Containers/cfd-change-password-confirmation';
import { TPasswordResetAndTradingPasswordManager } from '../../../Containers/props.types';
import ChangePasswordConfirmation from 'Containers/cfd-change-password-confirmation';
import { TPasswordResetAndTradingPasswordManager } from 'Containers/props.types';
import { ChangePassword } from './change-password';
import { PasswordReset } from './password-reset';

Expand Down
1 change: 1 addition & 0 deletions packages/cfd/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"Constants/*": ["./src/Constants/*"],
"Components/*": ["./src/Components/*"],
"Containers/*": ["./src/Containers/*"],
"Helpers/*": ["./src/Helpers/*"],
"Modules/*": ["./src/Modules/*"],
"Sass/*": ["./src/sass/*"],
"Stores/*": ["./src/Stores/*"],
Expand Down

0 comments on commit 579cd49

Please sign in to comment.