Skip to content

Commit

Permalink
chore: resolved conflicts and updated with master
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Fasih Ali Naqvi authored and Muhammad Fasih Ali Naqvi committed May 7, 2024
2 parents 32e415b + 6270454 commit 5af959a
Show file tree
Hide file tree
Showing 193 changed files with 4,056 additions and 3,472 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ import React from 'react';
import { Button, Text } from '@deriv/components';
import { localize } from '@deriv/translations';
import IdvDocumentRejected from '../../../../Assets/ic-idv-document-rejected.svg';
import { POIContext } from '@deriv/shared';
import { submission_status_code } from '../../../../Sections/Verification/ProofOfIdentity/proof-of-identity-utils';

type TIdvLimited = {
handleRequireSubmission: () => void;
};

const IdvLimited = ({ handleRequireSubmission }: TIdvLimited) => {
const { setSubmissionStatus } = React.useContext(POIContext);

return (
<div className='proof-of-identity__container'>
<IdvDocumentRejected className='icon' />
Expand All @@ -21,7 +25,10 @@ const IdvLimited = ({ handleRequireSubmission }: TIdvLimited) => {
<Button
type='button'
className='account-management__continue'
onClick={handleRequireSubmission}
onClick={() => {
handleRequireSubmission();
setSubmissionStatus(submission_status_code.selecting);
}}
large
text={localize('Upload identity document')}
primary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import { getStaticUrl } from '@deriv/shared';
import { Localize, localize } from '@deriv/translations';
import { Button, Icon, Popup, Text } from '@deriv/components';
import { Button, Icon, OpenLiveChatLink, Popup, Text } from '@deriv/components';
import SelfExclusionContext from './self-exclusion-context';

type TSelfExclusionArticleItems = Record<'is_eu' | 'is_uk' | 'is_app_settings', boolean | undefined>;
Expand Down Expand Up @@ -104,15 +104,7 @@ export const selfExclusionArticleItems = ({ is_eu, is_app_settings }: TSelfExclu
component: (
<Localize
i18n_default_text='If you want to adjust your self-exclusion limits, <0>contact us via live chat.</0>'
components={[
<a
key={0}
className='link'
rel='noopener noreferrer'
target='_blank'
href={getStaticUrl('/contact_us')}
/>,
]}
components={[<OpenLiveChatLink key={0} text_size='xxs' />]}
/>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
SelectNative,
Text,
} from '@deriv/components';
import { routes, platforms, WS, EMPLOYMENT_VALUES, shouldHideOccupationField } from '@deriv/shared';
import { routes, platforms, WS, shouldHideOccupationField } from '@deriv/shared';
import { observer, useStore } from '@deriv/stores';
import { localize, Localize } from '@deriv/translations';
import LeaveConfirm from 'Components/leave-confirm';
Expand Down
46 changes: 46 additions & 0 deletions packages/account/src/hooks/__test__/useKycAuthStatus.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from 'react';
import { renderHook } from '@testing-library/react-hooks';
import { useKycAuthStatus } from '../useKycAuthStatus';
import { useQuery } from '@deriv/api';
import { StoreProvider, mockStore } from '@deriv/stores';

jest.mock('@deriv/api', () => ({
...jest.requireActual('@deriv/api'),
useQuery: jest.fn(),
}));

describe('useKycAuthStatus', () => {
afterEach(() => {
jest.clearAllMocks();
});

it('should return kyc_auth_status', () => {
const mock_response = {
data: {
kyc_auth_status: {
identity: {
status: 'none',
},
document: {
status: 'none',
},
},
},
};

const mock = mockStore({
client: {
is_authorize: true,
},
});

(useQuery as jest.Mock).mockReturnValue(mock_response);

const wrapper = ({ children }: { children: JSX.Element }) => (
<StoreProvider store={mock}>{children}</StoreProvider>
);

const { result } = renderHook(() => useKycAuthStatus({ country: 'in' }), { wrapper });
expect(result.current.kyc_auth_status).toEqual(mock_response.data.kyc_auth_status);
});
});
1 change: 1 addition & 0 deletions packages/account/src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useKycAuthStatus } from './useKycAuthStatus';
21 changes: 21 additions & 0 deletions packages/account/src/hooks/useKycAuthStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { useQuery } from '@deriv/api';
import { TSocketRequestPayload } from '@deriv/api/types';
import { useStore } from '@deriv/stores';

type TKycAuthStatusPayload = TSocketRequestPayload<'kyc_auth_status'>['payload'];

/** Custom hook that returns Proof of Identity (POI) and Proof of Address (POA) authentication status details. */
export const useKycAuthStatus = (payload?: TKycAuthStatusPayload) => {
const { client } = useStore();

const { is_authorize } = client;
const { data, ...kyc_auth_status_rest } = useQuery('kyc_auth_status', {
payload,
options: { enabled: is_authorize },
});
return {
/** The KYC auth status */
kyc_auth_status: data?.kyc_auth_status,
...kyc_auth_status_rest,
};
};
4 changes: 4 additions & 0 deletions packages/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ type KycAuthStatus = {
* Reason(s) for the rejected POI attempt.
*/
rejected_reasons?: string[];
/**
* Indicate if the verification report was returned by the provider (IDV only).
*/
report_available?: 0 | 1;
};
/**
* Service used for the current POI status.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { Localize, localize } from '@deriv/translations';
import './add-options-account.scss';
import { useStore, observer } from '@deriv/stores';
import { isMobile, ContentFlag } from '@deriv/shared';
import { Analytics } from '@deriv-com/analytics';

const AddOptions = observer(() => {
const { client, traders_hub, ui } = useStore();
const { is_real, content_flag } = traders_hub;
const { is_real, content_flag, selected_account_type } = traders_hub;
const { setShouldShowCooldownModal, openRealAccountSignup } = ui;
const { real_account_creation_unlock_date } = client;

Expand All @@ -29,6 +30,12 @@ const AddOptions = observer(() => {
type='submit'
has_effect
onClick={() => {
Analytics.trackEvent('ce_tradershub_dashboard_form', {
action: 'account_get',
form_name: 'traders_hub_default',
account_mode: selected_account_type,
account_name: 'cfd_banner',
});
if (is_real && eu_user) {
if (real_account_creation_unlock_date) {
setShouldShowCooldownModal(true);
Expand Down
14 changes: 12 additions & 2 deletions packages/appstore/src/components/app-content.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
import React from 'react';
import React, { useEffect } from 'react';
import { routes } from '@deriv/shared';
import { observer, useStore } from '@deriv/stores';
import { Analytics } from '@deriv-com/analytics';
import Routes from 'Components/routes/routes';
import classNames from 'classnames';
import './app.scss';

const AppContent: React.FC = observer(() => {
const { ui } = useStore();
const { ui, traders_hub } = useStore();
const { is_dark_mode_on } = ui;
const { selected_account_type } = traders_hub;

useEffect(() => {
Analytics.trackEvent('ce_tradershub_dashboard_form', {
action: 'open',
form_name: 'traders_hub_default',
account_mode: selected_account_type,
});
}, []);

return (
<main
Expand Down
Loading

0 comments on commit 5af959a

Please sign in to comment.