Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b3db4fc
Removing initial selfie related react code
Oct 7, 2022
a603b3c
Culling more tests and references to selfie on frontend
Oct 7, 2022
8b59f1f
More cleanup
Oct 7, 2022
14b6cf7
Remove liveness enabled block
kbighorse Oct 14, 2022
50ff5e4
Remove unused variables
kbighorse Oct 14, 2022
5ba0431
Remove more unused variables
kbighorse Oct 14, 2022
f8741e6
Remove skipped test and unused variables
kbighorse Oct 14, 2022
08911af
Remove unhandled submission failure test
kbighorse Oct 14, 2022
a2e56fd
Remove handled submission failure test
kbighorse Oct 14, 2022
6f7093c
Remove async upload pending progress test
kbighorse Oct 14, 2022
b92d896
Remove onStepChange callback test
kbighorse Oct 14, 2022
d5181c3
Delete use-focus-fallback-ref.js
kbighorse Oct 14, 2022
724a866
Delete use-focus-fallback-ref-spec.jsx
kbighorse Oct 14, 2022
f1096fa
Remove liveness checking enabled context
kbighorse Oct 14, 2022
d3210bb
Merge branch 'main' into eric-lg-7710-remove-react-selfie
kbighorse Oct 14, 2022
5a8ab2c
Remove unused translations
kbighorse Oct 14, 2022
8d6d63b
Remove capture prop
kbighorse Oct 14, 2022
6863c1d
Remove selfie-related code
kbighorse Oct 14, 2022
352972f
Remove capture prop from file input component
kbighorse Oct 14, 2022
e135c3c
Remove capture prop pass
kbighorse Oct 14, 2022
64a1d79
Remove unnecessary assignment
kbighorse Oct 14, 2022
af5a309
Remove capture prop and unnecessary test
kbighorse Oct 14, 2022
76a7cb3
Merge branch 'main' into eric-lg-7710-remove-react-selfie
kbighorse Oct 24, 2022
796a81a
Merge branch 'main' into eric-lg-7710-remove-react-selfie
kbighorse Oct 25, 2022
c688258
Merge branch 'main' into eric-lg-7710-remove-react-selfie
kbighorse Oct 25, 2022
707e15b
Restore document capture tests
kbighorse Oct 25, 2022
d177b08
@aduth changes
kbighorse Oct 26, 2022
01fbddc
Remove unused import
kbighorse Oct 26, 2022
296f7f0
Merge branch 'main' into eric-lg-7710-remove-react-selfie
kbighorse Oct 26, 2022
b636370
Merge branch 'main' into eric-lg-7710-remove-react-selfie
kbighorse Oct 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
useImperativeHandle,
} from 'react';
import { useI18n } from '@18f/identity-react-i18n';
import { useIfStillMounted, useDidUpdateEffect } from '@18f/identity-react-hooks';
import { useDidUpdateEffect } from '@18f/identity-react-hooks';
import { Button, FullScreen } from '@18f/identity-components';
import type { FullScreenRefHandle } from '@18f/identity-components';
import type { FocusTrap } from 'focus-trap';
Expand Down Expand Up @@ -95,12 +95,6 @@ interface AcuantCaptureProps {
* Camera permission declined callback
*/
onCameraAccessDeclined?: () => void;
/**
* Facing mode of caopture. If capture is not
* specified and a camera is supported, defaults
* to the Acuant environment camera capture.
*/
capture: 'user' | 'environment';
/**
* Optional additional class names
*/
Expand Down Expand Up @@ -261,7 +255,6 @@ function AcuantCapture(
value,
onChange = () => {},
onCameraAccessDeclined = () => {},
capture,
className,
allowUpload = true,
errorMessage,
Expand All @@ -272,7 +265,6 @@ function AcuantCapture(
const {
isReady,
isActive: isAcuantInstanceActive,
isAcuantLoaded,
isError,
isCameraSupported,
glareThreshold,
Expand All @@ -287,7 +279,6 @@ function AcuantCapture(
const [isCapturingEnvironment, setIsCapturingEnvironment] = useState(false);
const [ownErrorMessage, setOwnErrorMessage] = useState<string | null>(null);
const [hasStartedCropping, setHasStartedCropping] = useState(false);
const ifStillMounted = useIfStillMounted();
useMemo(() => setOwnErrorMessage(null), [value]);
const { isMobile } = useContext(DeviceContext);
const { t, formatHTML } = useI18n();
Expand Down Expand Up @@ -419,16 +410,10 @@ function AcuantCapture(
function startCaptureOrTriggerUpload(event: MouseEvent) {
if (event.target === inputRef.current) {
const isAcuantCaptureCapable = hasCapture && !acuantFailureCookie;
const isEnvironmentCapture = capture !== 'user';
const shouldStartSelfieCapture =
isAcuantLoaded && capture === 'user' && !isForceUploading.current;
let shouldStartAcuantCapture =
isAcuantCaptureCapable &&
capture !== 'user' &&
!isForceUploading.current &&
!forceNativeCamera;
isAcuantCaptureCapable && !isForceUploading.current && !forceNativeCamera;

if (isAcuantCaptureCapable && isEnvironmentCapture && forceNativeCamera) {
if (isAcuantCaptureCapable && forceNativeCamera) {
trackEvent('IdV: Native camera forced after failed attempts', {
field: name,
failed_capture_attempts: failedCaptureAttempts,
Expand All @@ -443,18 +428,11 @@ function AcuantCapture(
shouldStartAcuantCapture = !nativeCameraOnly;
}

if (!allowUpload || shouldStartSelfieCapture || shouldStartAcuantCapture) {
if (!allowUpload || shouldStartAcuantCapture) {
event.preventDefault();
}

if (shouldStartSelfieCapture) {
window.AcuantPassiveLiveness.startSelfieCapture(
ifStillMounted((nextImageData) => {
const dataURI = `data:image/jpeg;base64,${nextImageData}`;
onChangeAndResetError(dataURI);
}),
);
} else if (shouldStartAcuantCapture && !isAcuantInstanceActive) {
if (shouldStartAcuantCapture && !isAcuantInstanceActive) {
setIsCapturingEnvironment(true);
}

Expand Down Expand Up @@ -571,7 +549,6 @@ function AcuantCapture(
fileLoadingText={t('doc_auth.info.image_loading')}
fileLoadedText={t('doc_auth.info.image_loaded')}
accept={isMockClient ? undefined : ['image/jpeg', 'image/png']}
capture={capture}
value={value}
errorMessage={ownErrorMessage ?? errorMessage}
isValuePending={hasStartedCropping}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('DocumentCaptureTroubleshootingOptions', () => {
const serviceProviderContext: ServiceProviderContext = {
name: 'Example SP',
failureToProofURL: 'http://example.test/url/to/failure-to-proof',
isLivenessRequired: false,
getFailureToProofURL: () => '',
};
const wrappers: Record<string, ComponentType> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import { useDidUpdateEffect } from '@18f/identity-react-hooks';
import type { FormStep } from '@18f/identity-form-steps';
import { UploadFormEntriesError } from '../services/upload';
import DocumentsStep from './documents-step';
import SelfieStep from './selfie-step';
import InPersonPrepareStep from './in-person-prepare-step';
import InPersonLocationStep from './in-person-location-step';
import InPersonSwitchBackStep from './in-person-switch-back-step';
import ReviewIssuesStep from './review-issues-step';
import ServiceProviderContext from '../context/service-provider';
import UploadContext from '../context/upload';
import AnalyticsContext from '../context/analytics';
import Submission from './submission';
Expand Down Expand Up @@ -57,7 +55,6 @@ function DocumentCapture({ isAsyncForm = false, onStepChange = () => {} }: Docum
const [submissionError, setSubmissionError] = useState<Error | undefined>(undefined);
const [stepName, setStepName] = useState<string | undefined>(undefined);
const { t } = useI18n();
const serviceProvider = useContext(ServiceProviderContext);
const { flowPath } = useContext(UploadContext);
const { trackSubmitEvent, trackVisitEvent } = useContext(AnalyticsContext);
const { inPersonURL } = useContext(FlowContext);
Expand All @@ -81,7 +78,7 @@ function DocumentCapture({ isAsyncForm = false, onStepChange = () => {} }: Docum
const submissionFormValues = useMemo(
() =>
formValues && {
...(isAsyncForm ? except(formValues, 'front', 'back', 'selfie') : formValues),
...(isAsyncForm ? except(formValues, 'front', 'back') : formValues),
flow_path: flowPath,
},
[isAsyncForm, formValues, flowPath],
Expand Down Expand Up @@ -146,10 +143,6 @@ function DocumentCapture({ isAsyncForm = false, onStepChange = () => {} }: Docum
name: 'documents',
form: DocumentsStep,
},
serviceProvider.isLivenessRequired && {
name: 'selfie',
form: SelfieStep,
},
].filter(Boolean) as FormStep[]);

const stepIndicatorPath =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ function DocumentSideAcuantCapture({
errorMessage={error ? error.message : undefined}
name={side}
className={className}
capture="environment"
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import usePrevious from '../hooks/use-previous';
* @prop {string} fileLoadingText Status message text to show when file is pending.
* @prop {string} fileLoadedText Status message text to show once pending file is loaded.
* @prop {string[]=} accept Optional array of file input accept patterns.
* @prop {'user'|'environment'=} capture Optional facing mode if file input is used for capture.
* @prop {Blob|string|null|undefined} value Current value.
* @prop {ReactNode=} errorMessage Error to show.
* @prop {boolean=} isValuePending Whether to show the input in an indeterminate loading state,
Expand Down Expand Up @@ -115,7 +114,6 @@ function FileInput(props, ref) {
fileLoadingText,
fileLoadedText,
accept,
capture,
value,
errorMessage,
isValuePending,
Expand Down Expand Up @@ -325,7 +323,6 @@ function FileInput(props, ref) {
aria-label={getLabelFromValue(label, value)}
aria-busy={isValuePending}
onChange={onChangeIfValid}
capture={capture}
onClick={onClick}
onDrop={onDrop}
accept={accept ? accept.join() : undefined}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import { useContext, useEffect, useState } from 'react';
import { hasMediaAccess } from '@18f/identity-device';
import { useI18n } from '@18f/identity-react-i18n';
import { useDidUpdateEffect } from '@18f/identity-react-hooks';
import { FormStepsContext, FormStepsButton } from '@18f/identity-form-steps';
import { PageHeading } from '@18f/identity-components';
import { Cancel } from '@18f/identity-verify-flow';
import type { FormStepComponentProps } from '@18f/identity-form-steps';
import DeviceContext from '../context/device';
import DocumentSideAcuantCapture from './document-side-acuant-capture';
import AcuantCapture from './acuant-capture';
import SelfieCapture from './selfie-capture';
import ServiceProviderContext from '../context/service-provider';
import withBackgroundEncryptedUpload from '../higher-order/with-background-encrypted-upload';
import type { PII } from '../services/upload';
import DocumentCaptureTroubleshootingOptions from './document-capture-troubleshooting-options';
Expand All @@ -32,11 +27,6 @@ interface ReviewIssuesStepValue {
*/
back: Blob | string | null | undefined;

/**
* Back image value.
*/
selfie: Blob | string | null | undefined;

/**
* Front image metadata.
*/
Expand Down Expand Up @@ -78,10 +68,7 @@ function ReviewIssuesStep({
captureHints = false,
}: ReviewIssuesStepProps) {
const { t } = useI18n();
const { isMobile } = useContext(DeviceContext);
const serviceProvider = useContext(ServiceProviderContext);
const { trackEvent } = useContext(AnalyticsContext);
const selfieError = errors.find(({ field }) => field === 'selfie')?.error;
const [hasDismissed, setHasDismissed] = useState(remainingAttempts === Infinity);
const { onPageTransition, changeStepCanComplete } = useContext(FormStepsContext);
useDidUpdateEffect(onPageTransition, [hasDismissed]);
Expand Down Expand Up @@ -122,7 +109,7 @@ function ReviewIssuesStep({
>
{!!unknownFieldErrors &&
unknownFieldErrors
.filter((error) => !['front', 'back', 'selfie'].includes(error.field!))
.filter((error) => !['front', 'back'].includes(error.field!))
.map(({ error }) => <p key={error.message}>{error.message}</p>)}

{remainingAttempts <= DISPLAY_ATTEMPTS && (
Expand Down Expand Up @@ -166,45 +153,7 @@ function ReviewIssuesStep({
className="document-capture-review-issues-step__input"
/>
))}
{serviceProvider.isLivenessRequired && (
<>
<hr className="margin-y-4" />
<p className="margin-bottom-0">{t('doc_auth.tips.review_issues_selfie_header_text')}</p>
<ul>
<li>{t('doc_auth.tips.review_issues_selfie_text1')}</li>
<li>{t('doc_auth.tips.review_issues_selfie_text2')}</li>
<li>{t('doc_auth.tips.review_issues_selfie_text3')}</li>
<li>{t('doc_auth.tips.review_issues_selfie_text4')}</li>
</ul>
{isMobile || !hasMediaAccess() ? (
<AcuantCapture
ref={registerField('selfie', { isRequired: true })}
capture="user"
label={t('doc_auth.headings.document_capture_selfie')}
bannerText={t('doc_auth.headings.photo')}
value={value.selfie}
onChange={(nextSelfie) => onChange({ selfie: nextSelfie })}
allowUpload={false}
className="document-capture-review-issues-step__input"
errorMessage={selfieError?.message}
name="selfie"
/>
) : (
<SelfieCapture
ref={registerField('selfie', { isRequired: true })}
value={value.selfie}
onChange={(nextSelfie) => onChange({ selfie: nextSelfie })}
errorMessage={selfieError?.message}
className={[
'document-capture-review-issues-step__input',
!value.selfie && 'document-capture-review-issues-step__input--unconstrained-width',
]
.filter(Boolean)
.join(' ')}
/>
)}
</>
)}

<FormStepsButton.Submit />
<DocumentCaptureTroubleshootingOptions />
<Cancel />
Expand Down
Loading