-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/binary-com/deriv-app into…
… 72476_Account-switching-issue-when-using-P2P-with-crypto-account
- Loading branch information
Showing
249 changed files
with
46,740 additions
and
40,138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
packages/account/src/Components/file-uploader-container/upload-file.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import PropTypes from 'prop-types'; | ||
import DocumentUploader from '@binary-com/binary-document-uploader'; | ||
import { localize } from '@deriv/translations'; | ||
import { compressImageFiles, readFiles, DOCUMENT_TYPE, PAGE_TYPE } from '@deriv/shared'; | ||
|
||
const fileReadErrorMessage = filename => { | ||
return localize('Unable to read file {{name}}', { name: filename }); | ||
}; | ||
|
||
const uploadFile = (file, getSocket, settings) => | ||
new Promise((resolve, reject) => { | ||
if (!file) { | ||
reject(); | ||
} | ||
|
||
// File uploader instance connected to binary_socket | ||
const uploader = new DocumentUploader({ connection: getSocket() }); | ||
|
||
let is_file_error = false; | ||
|
||
compressImageFiles([file]).then(files_to_process => { | ||
readFiles(files_to_process, fileReadErrorMessage, settings).then(processed_files => { | ||
processed_files.forEach(item => { | ||
if (item.message) { | ||
is_file_error = true; | ||
reject(item); | ||
} | ||
}); | ||
const total_to_upload = processed_files.length; | ||
if (is_file_error || !total_to_upload) { | ||
return; // don't start submitting files until all front-end validation checks pass | ||
} | ||
|
||
// send files | ||
uploader.upload(processed_files[0]).then(resolve).catch(reject); | ||
}); | ||
}); | ||
}); | ||
|
||
uploadFile.propTypes = { | ||
file: PropTypes.element.isRequired, | ||
getSocket: PropTypes.func.isRequired, | ||
settings: PropTypes.shape({ | ||
documentType: PropTypes.oneOf(Object.values(DOCUMENT_TYPE)).isRequired, | ||
pageType: PropTypes.oneOf(Object.values(PAGE_TYPE)), | ||
expirationDate: PropTypes.string, | ||
documentId: PropTypes.string, | ||
lifetimeValid: PropTypes.bool, | ||
}), | ||
}; | ||
|
||
export default uploadFile; |
3 changes: 3 additions & 0 deletions
3
packages/account/src/Components/poi-unsupported-failed/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import UnsupportedFailed from './unsupported-failed.jsx'; | ||
|
||
export default UnsupportedFailed; |
20 changes: 20 additions & 0 deletions
20
packages/account/src/Components/poi-unsupported-failed/unsupported-failed.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Icon } from '@deriv/components'; | ||
import { localize } from '@deriv/translations'; | ||
import IconMessageContent from 'Components/icon-message-content'; | ||
|
||
const UnsupportedFailed = ({ error }) => ( | ||
<IconMessageContent | ||
message={localize('Proof of identity documents upload failed')} | ||
text={error} | ||
icon={<Icon icon='IcPoiFailed' size={128} />} | ||
className='account-management-dashboard' | ||
/> | ||
); | ||
|
||
UnsupportedFailed.propTypes = { | ||
error: PropTypes.string, | ||
}; | ||
|
||
export default UnsupportedFailed; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
packages/account/src/Components/poi/status/unsupported/__test__/unsupported.spec.js
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
packages/account/src/Components/poi/status/unsupported/card-details/card-details.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import DocumentsUpload from './documents-upload.jsx'; | ||
import SelfieUpload from './selfie-upload.jsx'; | ||
import { SELFIE_DOCUMENT } from '../constants'; | ||
import './card-details.scss'; | ||
|
||
const CardDetails = ({ data, goToCards, onComplete, is_from_external, setIsCfdPoiCompleted }) => { | ||
const [documents, setDocuments] = React.useState(); | ||
const [selfie, setSelfie] = React.useState(); | ||
const [is_selfie_upload, setIsSelfieUpload] = React.useState(false); | ||
|
||
const onSubmitDocuments = values => { | ||
setDocuments(values); | ||
setIsSelfieUpload(true); | ||
}; | ||
|
||
const onConfirmDocuments = values => { | ||
onComplete({ ...documents, ...values }); | ||
setIsCfdPoiCompleted(true); | ||
}; | ||
|
||
return ( | ||
<React.Fragment> | ||
{!is_selfie_upload ? ( | ||
<DocumentsUpload | ||
initial_values={documents} | ||
is_from_external={is_from_external} | ||
data={data} | ||
goToCards={goToCards} | ||
onSubmit={onSubmitDocuments} | ||
/> | ||
) : ( | ||
<SelfieUpload | ||
initial_values={selfie} | ||
goBack={() => setIsSelfieUpload(false)} | ||
onConfirm={onConfirmDocuments} | ||
onFileDrop={value => setSelfie({ [SELFIE_DOCUMENT.name]: value })} | ||
/> | ||
)} | ||
</React.Fragment> | ||
); | ||
}; | ||
|
||
export default CardDetails; |
Oops, something went wrong.