From d83ea542723ab0993c7e54eddc424ae04a926bc6 Mon Sep 17 00:00:00 2001 From: Bianca Severino Date: Mon, 10 Aug 2020 13:46:57 -0400 Subject: [PATCH] Add i18n and UX improvements to IDV --- src/id-verification/Camera.jsx | 6 +- src/id-verification/ExistingRequest.jsx | 21 ++- .../IdVerification.messages.js | 57 +++++-- src/id-verification/_id-verification.scss | 8 + src/id-verification/panels/GetNameIdPanel.jsx | 140 ++++++++++-------- .../panels/RequestCameraAccessPanel.jsx | 11 +- .../panels/ReviewRequirementsPanel.jsx | 10 +- src/id-verification/panels/SummaryPanel.jsx | 4 +- .../panels/TakeIdPhotoPanel.jsx | 2 +- .../panels/TakePortraitPhotoPanel.jsx | 2 +- .../tests/panels/GetNameIdPanel.test.jsx | 12 +- 11 files changed, 178 insertions(+), 95 deletions(-) diff --git a/src/id-verification/Camera.jsx b/src/id-verification/Camera.jsx index 0bd741a..40a5631 100644 --- a/src/id-verification/Camera.jsx +++ b/src/id-verification/Camera.jsx @@ -67,7 +67,11 @@ class Camera extends React.Component { /> - )} - - - + + {props.intl.formatMessage(messages['id.verification.account.name.error'])} + + +
- - {isEditing ? props.intl.formatMessage(messages['id.verification.account.name.save']) : props.intl.formatMessage(messages['id.verification.next'])} + + { + !nameMatches ? + props.intl.formatMessage(messages['id.verification.account.name.save']) + : props.intl.formatMessage(messages['id.verification.next']) + }
diff --git a/src/id-verification/panels/RequestCameraAccessPanel.jsx b/src/id-verification/panels/RequestCameraAccessPanel.jsx index 65c8a5f..753d047 100644 --- a/src/id-verification/panels/RequestCameraAccessPanel.jsx +++ b/src/id-verification/panels/RequestCameraAccessPanel.jsx @@ -41,10 +41,19 @@ function RequestCameraAccessPanel(props) { } }, []); + const getTitle = () => { + if (mediaAccess === MEDIA_ACCESS.GRANTED) { + return props.intl.formatMessage(messages['id.verification.camera.access.title.success']); + } else if ([MEDIA_ACCESS.UNSUPPORTED, MEDIA_ACCESS.DENIED].includes(mediaAccess)) { + return props.intl.formatMessage(messages['id.verification.camera.access.title.failed']); + } + return props.intl.formatMessage(messages['id.verification.camera.access.title']); + }; + return ( {mediaAccess === MEDIA_ACCESS.PENDING && (
diff --git a/src/id-verification/panels/ReviewRequirementsPanel.jsx b/src/id-verification/panels/ReviewRequirementsPanel.jsx index 1a64c94..1893975 100644 --- a/src/id-verification/panels/ReviewRequirementsPanel.jsx +++ b/src/id-verification/panels/ReviewRequirementsPanel.jsx @@ -32,7 +32,7 @@ function ReviewRequirementsPanel(props) {

-
+
{props.intl.formatMessage(messages['id.verification.requirements.card.device.title'])}

@@ -49,7 +49,7 @@ function ReviewRequirementsPanel(props) {

-
+
{props.intl.formatMessage(messages['id.verification.requirements.card.id.title'])}

@@ -57,16 +57,16 @@ function ReviewRequirementsPanel(props) {

-

+

{props.intl.formatMessage(messages['id.verification.privacy.title'])}

-
+
{props.intl.formatMessage(messages['id.verification.privacy.need.photo.question'])}

{props.intl.formatMessage(messages['id.verification.privacy.need.photo.answer'])}

-
+
{props.intl.formatMessage(messages['id.verification.privacy.do.with.photo.question'])}

diff --git a/src/id-verification/panels/SummaryPanel.jsx b/src/id-verification/panels/SummaryPanel.jsx index ac0b506..aaa18b5 100644 --- a/src/id-verification/panels/SummaryPanel.jsx +++ b/src/id-verification/panels/SummaryPanel.jsx @@ -70,7 +70,7 @@ function SummaryPanel(props) { alt={props.intl.formatMessage(messages['id.verification.review.portrait.alt'])} /> )}

+ {shouldUseCamera && }
{props.intl.formatMessage(messages['id.verification.next'])}
- {shouldUseCamera && } ); } diff --git a/src/id-verification/panels/TakePortraitPhotoPanel.jsx b/src/id-verification/panels/TakePortraitPhotoPanel.jsx index f042a87..7d7e68b 100644 --- a/src/id-verification/panels/TakePortraitPhotoPanel.jsx +++ b/src/id-verification/panels/TakePortraitPhotoPanel.jsx @@ -44,12 +44,12 @@ function TakePortraitPhotoPanel(props) {
)} + {shouldUseCamera && }
{props.intl.formatMessage(messages['id.verification.next'])}
- {shouldUseCamera && }
); } diff --git a/src/id-verification/tests/panels/GetNameIdPanel.test.jsx b/src/id-verification/tests/panels/GetNameIdPanel.test.jsx index 10e41b7..0d458b5 100644 --- a/src/id-verification/tests/panels/GetNameIdPanel.test.jsx +++ b/src/id-verification/tests/panels/GetNameIdPanel.test.jsx @@ -43,13 +43,17 @@ describe('GetNameIdPanel', () => { ))); - const button = await screen.findByTestId('edit-button'); + const yesButton = await screen.findByTestId('name-matches-yes'); + const noButton = await screen.findByTestId('name-matches-no'); const input = await screen.findByTestId('name-input'); - expect(input).toHaveProperty('disabled', true); - fireEvent.click(button); - expect(input).toHaveProperty('disabled', false); + expect(input).toHaveProperty('readOnly', true); + fireEvent.click(noButton); + expect(input).toHaveProperty('readOnly', false); fireEvent.change(input, { target: { value: 'test change' } }); expect(contextValue.setIdPhotoName).toHaveBeenCalled(); + fireEvent.click(yesButton); + expect(input).toHaveProperty('readOnly', true); + expect(contextValue.setIdPhotoName).toHaveBeenCalled(); }); it('routes to SummaryPanel', async () => {