Skip to content

Commit

Permalink
chore: updated with latest master
Browse files Browse the repository at this point in the history
  • Loading branch information
nada-deriv committed Jul 26, 2024
2 parents 3b535db + a1b3680 commit d1f0d36
Show file tree
Hide file tree
Showing 874 changed files with 26,944 additions and 20,147 deletions.
17 changes: 10 additions & 7 deletions .github/actions/analyze/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,6 @@ runs:
run: |
node .github/actions/analyze/compareReports.js --format=console
- name: Validate size changes
if: ${{ steps.diff.outputs.above_threshold == 'true' }}
uses: actions/github-script@v5
with:
script: |
core.setFailed('Size changes exceed the defined threshold. Check above logs for details.');
- name: Zip all treemaps and reports
shell: bash
run: |
Expand All @@ -182,6 +175,7 @@ runs:
name: analyse
path: analyse.zip
retention-days: 20
overwrite: true

- name: Set sanitized branch name
id: sanitize
Expand All @@ -197,3 +191,12 @@ runs:
name: analyse-${{ env.SANITIZED_REF_NAME }}
path: analyse.zip
retention-days: 5
overwrite: true

- name: Validate size changes
if: ${{ steps.diff.outputs.above_threshold == 'true' && github.ref != 'refs/heads/master' }}
uses: actions/github-script@v5
with:
script: |
core.setFailed('Size changes exceed the defined threshold. Check above logs for details.');
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ jobs:
run: npx tsc --project packages/stores/tsconfig.json -noEmit
- name: Check TypeScript for @deriv/wallets
run: npx tsc --project packages/wallets/tsconfig.json -noEmit
- name: Check TypeScript for @deriv/cashier-v2
run: npx tsc --project packages/cashier-v2/tsconfig.json -noEmit
- name: Check ESLint for @deriv/wallets
run: npx eslint --fix --ignore-path packages/wallets/.eslintignore --config packages/wallets/.eslintrc.js packages/wallets
- name: Check ESLint for @deriv/cashier-v2
Expand Down
2 changes: 1 addition & 1 deletion .stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = {
'shorthand-property-no-redundant-values': true,
'string-no-newline': true,
'time-min-milliseconds': 100,
'unit-allowed-list': ['fr', 'px', 'em', 'rem', '%', 'svh', 'svw', 'vw', 'vh', 'deg', 'ms', 's', 'dpcm'],
'unit-allowed-list': ['fr', 'px', 'em', 'rem', '%', 'svh', 'svw', 'vw', 'vh', 'dvh', 'deg', 'ms', 's', 'dpcm'],
'value-keyword-case': 'lower',
},
extends: [
Expand Down
3,369 changes: 1,004 additions & 2,365 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
},
"dependencies": {
"@babel/preset-typescript": "^7.16.5",
"@deriv-com/analytics": "1.5.9",
"@deriv-com/analytics": "1.10.0",
"@sendbird/chat": "^4.9.7",
"@types/react-transition-group": "^4.4.4",
"babel-jest": "^27.3.1",
Expand Down
9 changes: 5 additions & 4 deletions packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@
},
"dependencies": {
"@binary-com/binary-document-uploader": "^2.4.8",
"@deriv-com/analytics": "1.5.9",
"@deriv-com/translations": "^1.3.3",
"@deriv-com/analytics": "1.10.0",
"@deriv-com/translations": "1.3.4",
"@deriv-com/utils": "^0.0.25",
"@deriv-com/ui": "^1.28.3",
"@deriv-com/ui": "1.29.9",
"@deriv/api": "^1.0.0",
"@deriv-com/quill-ui": "1.13.22",
"@deriv/components": "^1.0.0",
"@deriv/hooks": "^1.0.0",
"@deriv/integration": "1.0.0",
"@deriv/quill-icons": "^1.22.12",
"@deriv/quill-icons": "1.23.3",
"@deriv/shared": "^1.0.0",
"@deriv/stores": "^1.0.0",
"@deriv/translations": "^1.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Localize } from '@deriv/translations';
import AccountArticle from 'Components/article';
import AccountArticle from '../article';

const ApiTokenArticle = () => (
<AccountArticle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { useIsMounted } from '@deriv/shared';
import { Button, Icon, Modal, Text, Popover, useCopyToClipboard } from '@deriv/components';
import { Localize } from '@deriv/translations';
import { TPopoverAlignment } from 'Types';
import { TPopoverAlignment } from '../../Types';

type TApiTokenClipboard = {
scopes?: string[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { TApiContext } from 'Types';
import { TApiContext } from '../../Types';

const ApiTokenContext = React.createContext<TApiContext>({
api_tokens: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Button, Icon, Modal, Text, Popover } from '@deriv/components';
import { useIsMounted } from '@deriv/shared';
import { Localize } from '@deriv/translations';
import ApiTokenContext from './api-token-context';
import { TPopoverAlignment, TFormattedToken, TApiContext } from 'Types';
import { TPopoverAlignment, TFormattedToken, TApiContext } from '../../Types';
import { useDevice } from '@deriv-com/ui';

type TApiTokenDeleteButton = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import ApiTokenDeleteButton from './api-token-delete-button';
import ApiTokenTableRowCell from './api-token-table-row-cell';
import ApiTokenTableRowScopesCell from './api-token-table-row-scopes-cell';
import ApiTokenTableRowTokenCell from './api-token-table-row-token-cell';
import { TFormattedToken } from 'Types';
import { TFormattedToken } from '../../Types';

type TApiTokenTableRow = {
token: TFormattedToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ApiTokenTableRow from './api-token-table-row';
import ApiTokenTableRowHeader from './api-token-table-row-header';
import ApiTokenTableRowScopesCell from './api-token-table-row-scopes-cell';
import ApiTokenTableRowTokenCell from './api-token-table-row-token-cell';
import { TApiContext, TToken } from 'Types';
import { TApiContext, TToken } from '../../Types';

const ApiTokenTable = () => {
const { api_tokens } = React.useContext<TApiContext>(ApiTokenContext);
Expand Down
2 changes: 1 addition & 1 deletion packages/account/src/Components/form-body/form-body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const FormBody = ({ children, scroll_offset, className, isFullHeight }: P
) : (
<Div100vhContainer
className={clsx('account__scrollbars_container--grid-layout', className)}
height_offset={scroll_offset || '200px'}
height_offset={scroll_offset || '100%'}
>
{children}
</Div100vhContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { DateOfBirthField, FormInputField } from './form-fields';
import FormSubHeader from '../form-sub-header';
import InlineNoteWithIcon from '../inline-note-with-icon';
import { useDevice } from '@deriv-com/ui';
import { OECD_TIN_FORMAT_URL } from '../../Constants/external-urls';

const PersonalDetailsForm = props => {
const { isDesktop } = useDevice();
Expand Down Expand Up @@ -792,7 +793,7 @@ const TaxIdentificationNumberField = ({
className='link link--red'
rel='noopener noreferrer'
target='_blank'
href='https://www.oecd.org/tax/automatic-exchange/crs-implementation-and-assistance/tax-identification-numbers/'
href={OECD_TIN_FORMAT_URL}
/>,
]}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ChangeEventHandler } from 'react';
import { Text, Icon } from '@deriv/components';
import { Text } from '@deriv/components';
import clsx from 'clsx';
import { TranslationFlag } from '@deriv/shared';

Expand Down Expand Up @@ -29,13 +29,7 @@ const LanguageRadioButton = ({ is_current_language, id, language_text, name, onC
className='settings-language__language--radio-button'
/>
<label htmlFor={id} className='settings-language__language--center-label'>
<div>
{TranslationFlag[id] ? (
TranslationFlag[id](36, 24)
) : (
<Icon icon={`IcFlag${id}`} className='settings-language__language-flag' />
)}
</div>
<div>{TranslationFlag[id](36, 24)}</div>
<div>
<Text
size='xs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ const PoiPoaDocsSubmitted = ({
openPasswordModal,
}: TPoiPoaDocsSubmitted) => {
const [is_loading, setIsLoading] = React.useState(false);

React.useEffect(() => {
const fetchAccountStatus = async () => {
await updateAccountStatus();
setIsLoading(false);
};
setIsLoading(true);
updateAccountStatus()
.then(() => {
setIsLoading(false);
})
.finally(() => setIsLoading(false));
//eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
fetchAccountStatus();

return () => setIsLoading(false);
}, [updateAccountStatus]);

const onSubmit = () => {
onClickOK();
Expand All @@ -53,6 +55,7 @@ const PoiPoaDocsSubmitted = ({
}
return localize('We’ll review your documents and notify you of its status within 5 minutes.');
};

return is_loading ? (
<Loading is_fullscreen={false} />
) : (
Expand All @@ -66,4 +69,5 @@ const PoiPoaDocsSubmitted = ({
</IconMessageContent>
);
};

export default PoiPoaDocsSubmitted;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { StaticUrl } from '@deriv/components';
import { Localize, localize } from '@deriv/translations';
import { getBrandWebsiteName, getPlatformSettings } from '@deriv/shared';
import AccountArticle from 'Components/article';
import AccountArticle from '../article';
import SelfExclusionContext from './self-exclusion-context';
import { observer } from '@deriv/stores';

Expand Down
32 changes: 26 additions & 6 deletions packages/account/src/Constants/routes-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@ import { localize } from '@deriv/translations';
import {
Passkeys,
PersonalDetails,
TradingAssessment,
FinancialAssessment,
ProofOfIdentity,
ProofOfAddress,
ProofOfOwnership,
ApiToken,
TwoFactorAuthentication,
SelfExclusion,
Account,
ClosingAccount,
DeactivateAccount,
ProofOfIncome,
} from '../Sections';
Expand Down Expand Up @@ -57,6 +51,32 @@ const ConnectedApps = makeLazyLoader(
() => moduleLoader(() => import('../Sections/Security/ConnectedApps')),
() => <Loading />
)();
const FinancialAssessment = makeLazyLoader(
() => moduleLoader(() => import('../Sections/Assessment/FinancialAssessment')),
() => <Loading />
)();
const TradingAssessment = makeLazyLoader(
() => moduleLoader(() => import('../Sections/Assessment/TradingAssessment')),
() => <Loading />
)();

const ApiToken = makeLazyLoader(
() => moduleLoader(() => import('../Sections/Security/ApiToken')),
() => <Loading />
)();

const TwoFactorAuthentication = makeLazyLoader(
() => moduleLoader(() => import('../Sections/Security/TwoFactorAuthentication')),
() => <Loading />
)();
const SelfExclusion = makeLazyLoader(
() => moduleLoader(() => import('../Sections/Security/SelfExclusion')),
() => <Loading />
)();
const ClosingAccount = makeLazyLoader(
() => moduleLoader(() => import('../Sections/Security/ClosingAccount')),
() => <Loading />
)();

export type TPage404 = typeof Page404;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('LanguageSettings', () => {

renderLanguageSettings();

expect(screen.queryByText('Select Language')).not.toBeInTheDocument();
expect(screen.queryByText('Select language')).not.toBeInTheDocument();
expect(screen.getByText('Redirect')).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ import { observer, useStore } from '@deriv/stores';
import { useTranslations, getAllowedLanguages } from '@deriv-com/translations';
import FormSubHeader from '../../../Components/form-sub-header';
import LanguageRadioButton from '../../../Components/language-settings';
import { useEffect } from 'react';
import { useDevice } from '@deriv-com/ui';

const LanguageSettings = observer(() => {
const { client, common } = useStore();
const { switchLanguage, currentLang, localize } = useTranslations();
const { has_wallet } = client;
// [TODO]: Remove changeSelectedLanguage() when whole app starts to use @deriv-com/translations
const { changeSelectedLanguage, current_language } = common;
const { changeSelectedLanguage } = common;
const { isDesktop } = useDevice();

// [TODO]: Remove useEffect() when whole app starts to use @deriv-com/translations
// This is required to sync language state b/w footer language icon and Language settings
useEffect(() => {
switchLanguage(current_language);
}, [current_language, switchLanguage]);

if (!isDesktop || has_wallet) {
return <Redirect to={routes.traders_hub} />;
}

const handleLanguageChange = async (language_key: string) => {
// [TODO]: Remove changeSelectedLanguage() when whole app starts to use @deriv-com/translations
// This function also helps in informing language change to BE
await changeSelectedLanguage(language_key);
switchLanguage(language_key);
};

const allowed_languages: Record<string, string> = getAllowedLanguages(UNSUPPORTED_LANGUAGES);
return (
<div className='settings-language'>
Expand All @@ -39,10 +39,7 @@ const LanguageSettings = observer(() => {
is_current_language={currentLang === language_key}
name='language-radio-group'
onChange={async () => {
// [TODO]: Remove changeSelectedLanguage() when whole app starts to use @deriv-com/translations
// This function also helps in informing language change to BE
await changeSelectedLanguage(language_key);
switchLanguage(language_key);
await handleLanguageChange(language_key);
}}
/>
);
Expand Down
12 changes: 6 additions & 6 deletions packages/account/src/Sections/Security/ApiToken/api-token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { useDevice } from '@deriv-com/ui';
import { getPropertyValue, WS } from '@deriv/shared';
import { observer, useStore } from '@deriv/stores';
import { Localize, localize } from '@deriv/translations';
import { TToken } from 'Types';
import { ApiTokenContext, ApiTokenArticle, ApiTokenCard, ApiTokenTable } from 'Components/api-token';
import InlineNoteWithIcon from 'Components/inline-note-with-icon';
import LoadErrorMessage from 'Components/load-error-message';
import { API_TOKEN_CARD_DETAILS, TOKEN_LIMITS, TOKEN_NAME_REGEX } from 'Constants/api-token-card-details';
import { TToken } from '../../../Types';
import { ApiTokenContext, ApiTokenArticle, ApiTokenCard, ApiTokenTable } from '../../../Components/api-token';
import InlineNoteWithIcon from '../../../Components/inline-note-with-icon';
import LoadErrorMessage from '../../../Components/load-error-message';
import { API_TOKEN_CARD_DETAILS, TOKEN_LIMITS, TOKEN_NAME_REGEX } from '../../../Constants/api-token-card-details';
import './api-token.scss';

type AptTokenState = {
Expand Down Expand Up @@ -248,7 +248,7 @@ const ApiToken = observer(() => {
className='da-api-token__input dc-input__input-group'
label={localize('Token name')}
value={values.token_name}
onChange={e => {
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
setFieldTouched('token_name', true);
handleChange(e);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
TDetailsOfDerivXAccount,
TDetailsOfMT5Account,
TDetailsOfCtraderAccount,
} from 'Types';
} from '../../../../Types';
import ClosingAccountPendingContent from './closing-account-pending-content';
import ClosingAccountPendingWrapper from './closing-account-pending-wrapper';
import ClosingAccountPendingBalance from './closing-account-pending-balance';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@deriv/shared';
import { observer, useStore } from '@deriv/stores';
import { Localize } from '@deriv/translations';
import { TCFDPlatform, TDetailsOfDerivXAccount, TDetailsOfMT5Account } from 'Types';
import { TCFDPlatform, TDetailsOfDerivXAccount, TDetailsOfMT5Account } from '../../../../Types';
import ClosingAccountPendingWrapper from './closing-account-pending-wrapper';
import ClosingAccountPendingContent from './closing-account-pending-content';

Expand All @@ -19,7 +19,7 @@ type TClosingAccountPendingBalanceProps = {
account_balance: TDetailsOfMT5Account[] | TDetailsOfDerivXAccount[];
};

type TShortcode = Parameters<typeof getCFDAccountDisplay>[0]['shortcode'];
type TShortcode = Exclude<TDetailsOfMT5Account['landing_company_short'], 'seychelles'>;

const ClosingAccountPendingBalance = observer(({ platform, account_balance }: TClosingAccountPendingBalanceProps) => {
const { traders_hub } = useStore();
Expand Down
Loading

0 comments on commit d1f0d36

Please sign in to comment.