Skip to content

Commit

Permalink
fix: conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
niloofar sadeghi committed Apr 29, 2023
2 parents adbe982 + 5a419a5 commit fac3825
Show file tree
Hide file tree
Showing 211 changed files with 3,482 additions and 1,913 deletions.
1,158 changes: 1,038 additions & 120 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/account/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = {
'^Constants/(.*)$': '<rootDir>/src/Constants/$1',
'^Configs/(.*)$': '<rootDir>/src/Configs/$1',
'^Duplicated/(.*)$': '<rootDir>/src/Duplicated/$1',
'^Helpers/(.*)$': '<rootDir>/src/Helpers/$1',
'^Services/(.*)$': '<rootDir>/src/Services/$1',
'^Stores/(.*)$': '<rootDir>/src/Stores/$1',
'^Sections/(.*)$': '<rootDir>/src/Sections/$1',
Expand Down
8 changes: 4 additions & 4 deletions packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,24 @@
"js-cookie": "^2.2.1",
"mobx": "^6.6.1",
"mobx-react": "^7.5.1",
"onfido-sdk-ui": "8.1.1",
"onfido-sdk-ui": "^11.0.0",
"prop-types": "^15.7.2",
"qrcode.react": "^1.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-i18next": "^11.11.0",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-i18next": "^11.11.0"
"react-router-dom": "^5.2.0"
},
"devDependencies": {
"@babel/eslint-parser": "^7.17.0",
"@babel/preset-react": "^7.16.7",
"@jest/globals": "^26.5.3",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.5.0",
"babel-eslint": "^10.1.0",
"@types/react": "^18.0.7",
"@types/react-dom": "^18.0.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"clean-webpack-plugin": "^3.0.0",
"css-loader": "^5.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/account/src/Assets/ic-brand-deriv-red.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Autocomplete, Button, DesktopWrapper, Input, MobileWrapper, Text, Selec
import { Formik, Field } from 'formik';
import { localize, Localize } from '@deriv/translations';
import { formatInput, WS } from '@deriv/shared';
import { generatePlaceholderText } from 'Helpers/utils';
import { documentAdditionalError, getDocumentData, getRegex, preventEmptyClipboardPaste } from './utils';
import FormFooter from 'Components/form-footer';
import BackButtonIcon from 'Assets/ic-poi-back-btn.svg';
Expand All @@ -14,7 +15,8 @@ const IdvDocumentSubmit = ({ handleBack, handleViewComplete, selected_country, i
const [document_list, setDocumentList] = React.useState([]);
const [document_image, setDocumentImage] = React.useState(null);
const [is_input_disable, setInputDisable] = React.useState(true);
const [is_doc_selected, setDocSelected] = React.useState(false);
const [selected_doc, setSelectedDoc] = React.useState(null);

const document_data = selected_country.identity.services.idv.documents_supported;

const {
Expand Down Expand Up @@ -205,11 +207,11 @@ const IdvDocumentSubmit = ({ handleBack, handleViewComplete, selected_country, i
onChange={handleChange}
onItemSelection={item => {
if (item.text === 'No results found' || !item.text) {
setDocSelected(false);
setSelectedDoc(null);
resetDocumentItemSelected(setFieldValue);
} else {
setFieldValue('document_type', item, true);
setDocSelected(true);
setSelectedDoc(item.id);
if (has_visual_sample) {
setDocumentImage(item.sample_image || '');
}
Expand All @@ -232,7 +234,7 @@ const IdvDocumentSubmit = ({ handleBack, handleViewComplete, selected_country, i
handleChange(e);
const selected_document = getDocument(e.target.value);
if (selected_document) {
setDocSelected(true);
setSelectedDoc(selected_document.id);
setFieldValue('document_type', selected_document, true);
if (has_visual_sample) {
setDocumentImage(selected_document.sample_image);
Expand Down Expand Up @@ -264,7 +266,7 @@ const IdvDocumentSubmit = ({ handleBack, handleViewComplete, selected_country, i
errors.error_message
}
autoComplete='off'
placeholder='Enter your document number'
placeholder={generatePlaceholderText(selected_doc)}
value={values.document_number}
onPaste={preventEmptyClipboardPaste}
onBlur={handleBlur}
Expand Down Expand Up @@ -322,7 +324,7 @@ const IdvDocumentSubmit = ({ handleBack, handleViewComplete, selected_country, i
</div>
)}
</div>
{is_doc_selected && (
{selected_doc && (
<Text
className={classNames('proof-of-identity__text btm-spacer', {
'top-spacer': is_from_external,
Expand Down
39 changes: 20 additions & 19 deletions packages/account/src/Components/poi/idv-document-submit/utils.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { getUrlBase } from '@deriv/shared';
import { localize } from '@deriv/translations';

export const documentAdditionalError = (document_additional, document_additional_format) => {
let error_message = null;
if (!document_additional) {
error_message = 'Please enter your document number. ';
error_message = localize('Please enter your document number. ');
} else {
const format_regex = getRegex(document_additional_format);
if (!format_regex.test(document_additional)) {
error_message = 'Please enter the correct format. ';
error_message = localize('Please enter the correct format. ');
}
}

Expand Down Expand Up @@ -71,24 +72,24 @@ const idv_document_data = {
},
za: {
national_id: {
new_display_name: 'National ID',
new_display_name: localize('National ID'),
example_format: '1234567890123',
sample_image: getImageLocation('za_national_identity_card.png'),
},
national_id_no_photo: {
new_display_name: 'National ID (No Photo)',
new_display_name: localize('National ID (No Photo)'),
example_format: '1234567890123',
sample_image: '',
},
},
ng: {
bvn: {
new_display_name: 'Bank Verification Number',
new_display_name: localize('Bank Verification Number'),
example_format: '12345678901',
sample_image: '',
},
cac: {
new_display_name: 'Corporate Affairs Commission',
new_display_name: localize('Corporate Affairs Commission'),
example_format: '12345678',
sample_image: '',
},
Expand All @@ -98,75 +99,75 @@ const idv_document_data = {
sample_image: getImageLocation('ng_drivers_license.png'),
},
nin: {
new_display_name: 'National Identity Number',
new_display_name: localize('National Identity Number'),
example_format: '12345678901',
sample_image: '',
},
nin_slip: {
new_display_name: 'National Identity Number Slip',
new_display_name: localize('National Identity Number Slip'),
example_format: '12345678901',
sample_image: getImageLocation('ng_nin_slip.png'),
},
tin: {
new_display_name: 'Taxpayer identification number',
new_display_name: localize('Taxpayer identification number'),
example_format: '12345678-1234',
sample_image: '',
},
voter_id: {
new_display_name: 'Voter ID',
new_display_name: localize('Voter ID'),
example_format: '1234567890123456789',
sample_image: getImageLocation('ng_voter_id.png'),
},
},
gh: {
drivers_license: {
new_display_name: '',
example_format: 'B1234567',
example_format: '12345678A1',
sample_image: '',
},
national_id: {
new_display_name: 'National ID',
new_display_name: localize('National ID'),
example_format: 'GHA-123456789-1',
sample_image: '',
},
passport: {
new_display_name: 'Passport',
new_display_name: localize('Passport'),
example_format: 'G1234567',
sample_image: '',
},
ssnit: {
new_display_name: 'Social Security and National Insurance Trust',
new_display_name: localize('Social Security and National Insurance Trust'),
example_format: 'C123456789012',
sample_image: '',
},
voter_id: {
new_display_name: 'Voter ID',
new_display_name: localize('Voter ID'),
example_format: '01234567890',
sample_image: '',
},
},
br: {
cpf: {
new_display_name: 'CPF',
new_display_name: localize('CPF'),
example_format: '123.456.789-12',
sample_image: '',
},
},
ug: {
national_id: {
new_display_name: 'National ID',
new_display_name: localize('National ID'),
example_format: 'CM12345678PE1D',
sample_image: getImageLocation('ug_national_identity_card.png'),
},
national_id_no_photo: {
new_display_name: 'National ID (No Photo)',
new_display_name: localize('National ID (No Photo)'),
example_format: 'CM12345678PE1D',
sample_image: '',
},
},
zw: {
national_id: {
new_display_name: 'National ID',
new_display_name: localize('National ID'),
example_format: '081234567F53',
sample_image: getImageLocation('zw_national_identity_card.png'),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
preventEmptyClipboardPaste,
} from '../../idv-document-submit/utils';
import DocumentSubmitLogo from 'Assets/ic-document-submit-icon.svg';
import { generatePlaceholderText } from 'Helpers/utils';

type TIdvDocSubmitOnSignup = {
citizen_data: FormikValues;
Expand All @@ -45,7 +46,7 @@ export const IdvDocSubmitOnSignup = ({
const [document_list, setDocumentList] = React.useState<any[]>([]);
const [document_image, setDocumentImage] = React.useState<string | null>(null);
const [is_input_disable, setInputDisable] = React.useState(true);
const [is_doc_selected, setDocSelected] = React.useState(false);
const [selected_doc, setSelectedDoc] = React.useState(null);

const document_data = citizen_data.identity.services.idv.documents_supported;
const {
Expand Down Expand Up @@ -218,7 +219,7 @@ export const IdvDocSubmitOnSignup = ({
<Text className='proof-of-identity__text btm-spacer' size='xs'>
{localize('Please select the document type and enter the ID number.')}
</Text>
{has_idv_error && !is_doc_selected && (
{has_idv_error && !selected_doc && (
<>
<Text
className='proof-of-identity'
Expand Down Expand Up @@ -284,7 +285,7 @@ export const IdvDocSubmitOnSignup = ({
'No results found' ||
!item.text
) {
setDocSelected(false);
setSelectedDoc(null);
resetDocumentItemSelected(
setFieldValue
);
Expand All @@ -294,7 +295,7 @@ export const IdvDocSubmitOnSignup = ({
item,
true
);
setDocSelected(true);
setSelectedDoc(item.id);
if (has_visual_sample) {
setDocumentImage(
item.sample_image || ''
Expand Down Expand Up @@ -325,7 +326,9 @@ export const IdvDocSubmitOnSignup = ({
e.target.value
);
if (selected_document) {
setDocSelected(true);
setSelectedDoc(
selected_document.id
);
setFieldValue(
'document_type',
selected_document,
Expand Down Expand Up @@ -367,7 +370,9 @@ export const IdvDocSubmitOnSignup = ({
errors.error_message
}
autoComplete='off'
placeholder='Enter your document number'
placeholder={generatePlaceholderText(
selected_doc
)}
value={values.document_number}
onPaste={preventEmptyClipboardPaste}
onBlur={handleBlur}
Expand Down Expand Up @@ -439,7 +444,7 @@ export const IdvDocSubmitOnSignup = ({
</div>
</div>
)}
{is_doc_selected && (
{selected_doc && (
<Text
className='proof-of-identity__text-spacer'
align='center'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('<SelfExclusionArticleContent />', () => {
};
const descr_text = 'About trading limits and self-exclusion';
const eu_item =
'When you set your limits or self-exclusion, they will be aggregated across all your account types in DTrader and DBot. For example, the losses made on both platforms will add up and be counted towards the loss limit you set.';
'When you set your limits or self-exclusion, they will be aggregated across all your account types in Deriv Trader and Deriv Bot. For example, the losses made on both platforms will add up and be counted towards the loss limit you set.';
const eu_uk_item =
'These trading limits are optional, and you can strengthen them at any time. If you don’t wish to set a specific limit, leave the field blank. If you live in the United Kingdom, Customer Support can only remove or weaken your trading limits after 24 hours of receiving the request. If you live in the Isle of Man, Customer Support can only remove or weaken your trading limits after your trading limit period has expired.';
const not_app_settings_eu_descr =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('<SelfExclusionArticle />', () => {
const eu_item =
/these trading limits and self-exclusion help you control the amount of money and time you spend on deriv.com and exercise/i;
const non_eu_item =
/these self-exclusion limits help you control the amount of money and time you spend trading on dtrader, dbot, smarttrader and binary bot on deriv. the limits you set here will help you exercise/i;
/these self-exclusion limits help you control the amount of money and time you spend trading on deriv trader, deriv bot, smarttrader and binary bot on deriv. the limits you set here will help you exercise/i;

beforeEach(() => {
mock_platform_context = {
Expand Down
Loading

0 comments on commit fac3825

Please sign in to comment.