Skip to content

Commit

Permalink
Merge branch master of github.com:binary-com/deriv-app into maryia/87…
Browse files Browse the repository at this point in the history
…354/task-add-turbos
  • Loading branch information
maryia-deriv committed Aug 1, 2023
2 parents acfa962 + a69c685 commit 0e7727b
Show file tree
Hide file tree
Showing 174 changed files with 4,977 additions and 4,722 deletions.
2,713 changes: 1,176 additions & 1,537 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
},
"dependencies": {
"@babel/preset-typescript": "^7.16.5",
"@sendbird/chat": "^4.9.3",
"@types/react-transition-group": "^4.4.4",
"babel-jest": "^27.3.1",
"dotenv": "^8.2.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
"deploy:production": "echo \"No deploy:production specified\""
},
"dependencies": {
"@binary-com/binary-document-uploader": "^2.4.7",
"@binary-com/binary-document-uploader": "^2.4.8",
"@deriv/api-types": "^1.0.94",
"@deriv/components": "^1.0.0",
"@deriv/hooks": "^1.0.0",
"@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
Expand Up @@ -30,6 +30,7 @@ describe('<FileUploaderContainer />', () => {
getSocket: jest.fn(),
onFileDrop: jest.fn(),
onRef: jest.fn(),
settings: {},
};

const file_size_msg = /less than 8mb/i;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import { compressImageFiles, isMobile, isDesktop, readFiles } from '@deriv/shared';
import { compressImageFiles, isMobile, isDesktop, readFiles, TSettings } from '@deriv/shared';
import FileUploader from '../file-uploader';

jest.mock('@deriv/shared', () => ({
Expand All @@ -24,10 +24,12 @@ describe('<FileUploader />', () => {
onFileDrop: (file: File | undefined) => void;
getSocket: () => WebSocket;
ref: React.RefObject<HTMLElement>;
settings: TSettings;
} = {
onFileDrop: jest.fn(),
getSocket: jest.fn(),
ref: React.createRef<HTMLElement>(),
settings: {},
};

const large_file_error_msg = /file size should be 8mb or less/i;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import classNames from 'classnames';
import { Icon, Text } from '@deriv/components';
import { PlatformContext, isDesktop, WS } from '@deriv/shared';
import { PlatformContext, isDesktop, WS, TSettings } from '@deriv/shared';
import { Localize, localize } from '@deriv/translations';
import FileUploader from './file-uploader';
import { TFile, TPlatformContext } from 'Types';
Expand All @@ -11,6 +11,7 @@ export type TFileUploaderContainer = {
getSocket: () => WebSocket;
onFileDrop: (file: TFile | undefined) => void;
onRef: (ref: React.RefObject<unknown> | undefined) => void;
settings: TSettings;
};

const FileProperties = () => {
Expand Down Expand Up @@ -49,6 +50,7 @@ const FileUploaderContainer = ({
getSocket,
onFileDrop,
onRef,
settings,
}: TFileUploaderContainer) => {
const { is_appstore } = React.useContext<Partial<TPlatformContext>>(PlatformContext);
const ref = React.useRef();
Expand All @@ -67,7 +69,7 @@ const FileUploaderContainer = ({
<div className='account-poa__upload-file account-poa__upload-file-dashboard'>
<FileProperties />
<div className='account-poa__upload-file-zone'>
<FileUploader getSocket={getSocketFunc} ref={ref} onFileDrop={onFileDrop} />
<FileUploader getSocket={getSocketFunc} ref={ref} onFileDrop={onFileDrop} settings={settings} />
</div>
</div>
</div>
Expand Down Expand Up @@ -130,7 +132,7 @@ const FileUploaderContainer = ({
'account-poa__upload-file--dashboard': isDesktop() && is_appstore,
})}
>
<FileUploader getSocket={getSocketFunc} ref={ref} onFileDrop={onFileDrop} />
<FileUploader getSocket={getSocketFunc} ref={ref} onFileDrop={onFileDrop} settings={settings} />
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
getSupportedFiles,
max_document_size,
supported_filetypes,
TSettings,
} from '@deriv/shared';
import { TFile } from 'Types';

Expand All @@ -34,8 +35,8 @@ const fileReadErrorMessage = (filename: string) => {

const FileUploader = React.forwardRef<
HTMLElement,
{ onFileDrop: (file: TFile | undefined) => void; getSocket: () => WebSocket }
>(({ onFileDrop, getSocket }, ref) => {
{ onFileDrop: (file: TFile | undefined) => void; getSocket: () => WebSocket; settings: TSettings }
>(({ onFileDrop, getSocket, settings = {} }, ref) => {
const [document_file, setDocumentFile] = useStateCallback({ files: [], error_message: null });

const handleAcceptedFiles = (files: TFileObject[]) => {
Expand Down Expand Up @@ -72,7 +73,7 @@ const FileUploader = React.forwardRef<
return new Promise((resolve, reject) => {
compressImageFiles(document_file.files)
.then(files_to_process => {
readFiles(files_to_process, fileReadErrorMessage)
readFiles(files_to_process, fileReadErrorMessage, settings)
.then(processed_files => {
processed_files.forEach(file => {
if (file.message) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type TPoaStatusCodes = Readonly<Record<'none' | 'pending' | 'rejected' | 'verified' | 'expired' | 'suspected', string>>;
import { TVerificationStatus } from 'Types';

export const poa_status_codes: TPoaStatusCodes = {
export const poa_status_codes: TVerificationStatus = {
none: 'none',
pending: 'pending',
rejected: 'rejected',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ const PoiPoaDocsSubmitted = ({
};

const getDescription = () => {
const { manual_status, poi_verified_for_vanuatu_maltainvest, poi_verified_for_bvi_labuan, poa_pending } =
const { manual_status, poi_verified_for_maltainvest, poi_verified_for_bvi_labuan_vanuatu, poa_pending } =
getAuthenticationStatusInfo(account_status);
const is_vanuatu_or_maltainvest_selected = [Jurisdiction.VANUATU, Jurisdiction.MALTA_INVEST].includes(
jurisdiction_selected_shortcode
);
const is_maltainvest_selected = jurisdiction_selected_shortcode === Jurisdiction.MALTA_INVEST;
if (
(is_vanuatu_or_maltainvest_selected && poi_verified_for_vanuatu_maltainvest && poa_pending) ||
(!is_vanuatu_or_maltainvest_selected && poi_verified_for_bvi_labuan && poa_pending) ||
(is_maltainvest_selected && poi_verified_for_maltainvest && poa_pending) ||
(!is_maltainvest_selected && poi_verified_for_bvi_labuan_vanuatu && poa_pending) ||
manual_status === 'pending'
) {
return localize('We’ll review your documents and notify you of its status within 1 - 3 working days.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const DetailComponent = ({
expirationDate: expiration_date,
documentId: data.document_id || '',
lifetimeValid: +(lifetime_valid && !expiration_date),
document_issuing_country: country_code_key,
})
.then(response => {
file_to_upload_index += 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ const ProofOfIdentityContainerForMt5 = ({
onStateChange,
refreshNotifications,
citizen_data,
jurisdiction_selected_shortcode,
updateAccountStatus,
is_eu_user,
}) => {
const [api_error, setAPIError] = React.useState();
const [residence_list, setResidenceList] = React.useState();
Expand Down Expand Up @@ -88,9 +87,8 @@ const ProofOfIdentityContainerForMt5 = ({
residence_list={residence_list}
citizen_data={citizen_data}
has_idv_error={has_idv_error}
jurisdiction_selected_shortcode={jurisdiction_selected_shortcode}
getChangeableFields={getChangeableFields}
updateAccountStatus={updateAccountStatus}
is_eu_user={is_eu_user}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react-hooks/exhaustive-deps */
import React from 'react';
import { WS, Jurisdiction, IDV_NOT_APPLICABLE_OPTION } from '@deriv/shared';
import { WS, isVerificationServiceSupported, IDV_NOT_APPLICABLE_OPTION } from '@deriv/shared';
import Unsupported from 'Components/poi/status/unsupported';
import OnfidoUpload from './onfido-sdk-view-container';
import { identity_status_codes, submission_status_code, service_code } from './proof-of-identity-utils';
Expand All @@ -18,22 +18,18 @@ const POISubmissionForMT5 = ({
refreshNotifications,
citizen_data,
has_idv_error,
jurisdiction_selected_shortcode,
residence_list,
is_eu_user,
}) => {
const [submission_status, setSubmissionStatus] = React.useState(); // submitting
const [submission_service, setSubmissionService] = React.useState();
React.useEffect(() => {
if (citizen_data) {
const { submissions_left: idv_submissions_left } = idv;
const { submissions_left: onfido_submissions_left } = onfido;
const is_idv_supported = citizen_data.identity.services.idv.is_country_supported;
const is_onfido_supported = citizen_data.identity.services.onfido.is_country_supported;
if (
is_idv_supported &&
Number(idv_submissions_left) > 0 &&
!is_idv_disallowed &&
jurisdiction_selected_shortcode !== Jurisdiction.VANUATU
) {
const is_idv_supported = isVerificationServiceSupported(residence_list, account_settings, 'idv');
const is_onfido_supported = isVerificationServiceSupported(residence_list, account_settings, 'onfido');
if (is_idv_supported && Number(idv_submissions_left) > 0 && !is_idv_disallowed && !is_eu_user) {
setSubmissionService(service_code.idv);
} else if (onfido_submissions_left > 0 && is_onfido_supported) {
setSubmissionService(service_code.onfido);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe('proof-of-ownership-form.jsx', () => {
refreshNotifications={jest.fn()}
is_dark_mode={false}
client_email={'test@testing.com'}
citizen='id'
/>
);
const cardItems = screen.getAllByRole('card-item');
Expand All @@ -25,6 +26,7 @@ describe('proof-of-ownership-form.jsx', () => {
refreshNotifications={jest.fn()}
is_dark_mode={false}
client_email={'test@testing.com'}
citizen='id'
/>
);
const cardItems = screen.getAllByRole('card-item');
Expand All @@ -38,6 +40,7 @@ describe('proof-of-ownership-form.jsx', () => {
refreshNotifications={jest.fn()}
is_dark_mode={false}
client_email={'test@testing.com'}
citizen='id'
/>
);
const poo_dropdown_button = await screen.findByTestId('dt_proof-of-ownership-button');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ describe('proof-of-ownership.jsx', () => {
ownership: { requests: [], status: 'none' },
},
},
account_settings: {
citizen: 'id',
},
},
});
render(<ProofOfOwnershipScreen />);
Expand All @@ -40,6 +43,9 @@ describe('proof-of-ownership.jsx', () => {
ownership: { requests: [], status: 'verified' },
},
},
account_settings: {
citizen: 'id',
},
},
});
render(<ProofOfOwnershipScreen />);
Expand All @@ -55,6 +61,9 @@ describe('proof-of-ownership.jsx', () => {
ownership: { requests: [], status: 'pending' },
},
},
account_settings: {
citizen: 'id',
},
},
});
render(<ProofOfOwnershipScreen />);
Expand All @@ -70,6 +79,9 @@ describe('proof-of-ownership.jsx', () => {
ownership: { requests: [], status: 'rejected' },
},
},
account_settings: {
citizen: 'id',
},
},
});
render(<ProofOfOwnershipScreen />);
Expand All @@ -86,6 +98,9 @@ describe('proof-of-ownership.jsx', () => {
needs_verification: ['ownership'],
},
},
account_settings: {
citizen: 'id',
},
},
});
render(<ProofOfOwnershipScreen />);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ ProofOfOwnershipForm.propTypes = {
grouped_payment_method_data: PropTypes.object,
refreshNotifications: PropTypes.func,
updateAccountStatus: PropTypes.func,
citizen: PropTypes.string,
};

export default ProofOfOwnershipForm;
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export const ProofOfOwnership = observer(() => {
const { is_dark_mode_on: is_dark_mode } = ui;
const cards = account_status?.authentication?.ownership?.requests;
const [status, setStatus] = useState(POO_STATUSES.none);
const citizen = client?.account_settings?.citizen || client?.account_settings?.country_code;

const grouped_payment_method_data = React.useMemo(() => {
const groups = {};
const payment_methods_config = getPaymentMethodsConfig();
Expand Down Expand Up @@ -50,6 +52,7 @@ export const ProofOfOwnership = observer(() => {
updateAccountStatus={updateAccountStatus}
refreshNotifications={refreshNotifications}
client_email={client_email}
citizen={citizen}
/>
); // Proof of ownership is required.
}
Expand Down
4 changes: 4 additions & 0 deletions packages/account/src/Types/common-prop.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,7 @@ export type TPersonalDetailsForm = {
} & FormikProps<FormikValues>;

export type TInputFieldValues = Record<string, string>;

export type TVerificationStatus = Readonly<
Record<'none' | 'pending' | 'rejected' | 'verified' | 'expired' | 'suspected', string>
>;
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
display: flex;
flex-direction: column;
@include desktop {
overflow: scroll;
overflow: auto;
}
}
&__scrollable-content {
@include desktop {
overflow: scroll;
overflow: auto;
}
}
&__footer-content {
Expand Down Expand Up @@ -449,6 +449,9 @@
&__spec-text {
font-family: 'Courier', monospace;
overflow: hidden;
&-broker {
text-align: right;
}
}
&__download-center {
border-top: 2px solid var(--general-section-1);
Expand Down
Loading

0 comments on commit 0e7727b

Please sign in to comment.