Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useContext } from 'react';
import { PageHeading } from '@18f/identity-components';
import { FormStepsButton } from '@18f/identity-form-steps';
import { Cancel } from '@18f/identity-verify-flow';
import { useI18n } from '@18f/identity-react-i18n';
import { useI18n, HtmlTextWithStrongNoWrap } from '@18f/identity-react-i18n';
import type { FormStepComponentProps } from '@18f/identity-form-steps';
import UnknownError from './unknown-error';
import TipList from './tip-list';
Expand Down Expand Up @@ -55,14 +55,18 @@ function DocumentCaptureReviewIssues({
)}
<UnknownError
unknownFieldErrors={unknownFieldErrors}
remainingSubmitAttempts={remainingSubmitAttempts}
isFailedDocType={isFailedDocType}
isFailedSelfie={isFailedSelfie}
isFailedSelfieLivenessOrQuality={isFailedSelfieLivenessOrQuality}
altIsFailedSelfieDontIncludeAttempts
altFailedDocTypeMsg={isFailedDocType ? t('doc_auth.errors.doc.wrong_id_type_html') : null}
hasDismissed={hasDismissed}
/>
<p>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always show on the re-upload page 👍

<HtmlTextWithStrongNoWrap
text={t('idv.failure.attempts_html', { count: remainingSubmitAttempts })}
/>
</p>
{!isFailedDocType && captureHints && (
<TipList
titleClassName="margin-bottom-0 margin-top-2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ interface DocumentCaptureWarningProps {
hasDismissed: boolean;
}

const DISPLAY_ATTEMPTS = 3;

type GetHeadingArguments = {
isResultCodeInvalid: boolean;
isFailedDocType: boolean;
Expand Down Expand Up @@ -53,18 +51,8 @@ function getHeading({
return t('errors.doc_auth.rate_limited_heading');
}

function getSubheading({
nonIppOrFailedResult,
isFailedDocType,
isFailedSelfieLivenessOrQuality,
isFailedSelfie,
t,
}) {
const showSubheading =
!nonIppOrFailedResult &&
!isFailedDocType &&
!isFailedSelfieLivenessOrQuality &&
!isFailedSelfie;
function getSubheading({ nonIppOrFailedResult, t }) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's nice how much simpler this is.

const showSubheading = !nonIppOrFailedResult;

if (showSubheading) {
return <h2>{t('errors.doc_auth.rate_limited_subheading')}</h2>;
Expand Down Expand Up @@ -101,9 +89,6 @@ function DocumentCaptureWarning({
: t('idv.failure.button.try_online');
const subheading = getSubheading({
nonIppOrFailedResult,
isFailedDocType,
isFailedSelfieLivenessOrQuality,
isFailedSelfie,
t,
});
const subheadingRef = useRef<HTMLDivElement>(null);
Expand Down Expand Up @@ -142,24 +127,17 @@ function DocumentCaptureWarning({
<div ref={errorMessageDisplayedRef}>
<UnknownError
unknownFieldErrors={unknownFieldErrors}
remainingSubmitAttempts={remainingSubmitAttempts}
isFailedDocType={isFailedDocType}
isFailedSelfie={isFailedSelfie}
isFailedSelfieLivenessOrQuality={isFailedSelfieLivenessOrQuality}
hasDismissed={hasDismissed}
/>
</div>

{!isFailedDocType &&
!isFailedSelfie &&
!isFailedSelfieLivenessOrQuality &&
remainingSubmitAttempts <= DISPLAY_ATTEMPTS && (
<p>
<HtmlTextWithStrongNoWrap
text={t('idv.failure.attempts_html', { count: remainingSubmitAttempts })}
/>
</p>
)}
<p>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always show on the interstitial page before going back to the reupload page 👍

<HtmlTextWithStrongNoWrap
text={t('idv.failure.attempts_html', { count: remainingSubmitAttempts })}
/>
</p>
</Warning>
{nonIppOrFailedResult && <Cancel />}
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ComponentProps } from 'react';
import { useContext } from 'react';
import { useI18n, HtmlTextWithStrongNoWrap } from '@18f/identity-react-i18n';
import { useI18n } from '@18f/identity-react-i18n';
import { FormStepError } from '@18f/identity-form-steps';
import { Link } from '@18f/identity-components';
import formatHTML from '@18f/identity-react-i18n/format-html';
Expand All @@ -11,7 +11,6 @@ interface UnknownErrorProps extends ComponentProps<'p'> {
isFailedDocType: boolean;
isFailedSelfie: boolean;
isFailedSelfieLivenessOrQuality: boolean;
remainingSubmitAttempts: number;
altFailedDocTypeMsg?: string | null;
altIsFailedSelfieDontIncludeAttempts?: boolean;
hasDismissed: boolean;
Expand Down Expand Up @@ -46,7 +45,6 @@ function UnknownError({
isFailedDocType = false,
isFailedSelfie = false,
isFailedSelfieLivenessOrQuality = false,
remainingSubmitAttempts,
altFailedDocTypeMsg = null,
altIsFailedSelfieDontIncludeAttempts = false,
hasDismissed,
Expand All @@ -73,14 +71,7 @@ function UnknownError({
);
}
if (isFailedDocType && err) {
return (
<p key={`${err.message}-${remainingSubmitAttempts}`}>
{err.message}{' '}
<HtmlTextWithStrongNoWrap
text={t('idv.warning.attempts_html', { count: remainingSubmitAttempts })}
/>
</p>
);
return <p key={err.message}>{err.message}</p>;
}
if ((isFailedSelfieLivenessOrQuality || isFailedSelfie) && err) {
let selfieHelpCenterLinkText = t('doc_auth.errors.general.selfie_failure_help_link_text');
Expand All @@ -90,23 +81,14 @@ function UnknownError({
selfieHelpCenterLinkText = t('doc_auth.errors.alerts.selfie_not_live_help_link_text');
}
return (
<>
<p>
{err.message}{' '}
{altIsFailedSelfieDontIncludeAttempts && (
<Link isExternal isNewTab href={helpCenterURL.toString()}>
{selfieHelpCenterLinkText}
</Link>
)}
</p>
<p>
{!altIsFailedSelfieDontIncludeAttempts && (
<HtmlTextWithStrongNoWrap
text={t('idv.warning.attempts_html', { count: remainingSubmitAttempts })}
/>
)}
</p>
</>
<p>
{err.message}{' '}
{altIsFailedSelfieDontIncludeAttempts && (
<Link isExternal isNewTab href={helpCenterURL.toString()}>
{selfieHelpCenterLinkText}
</Link>
)}
</p>
);
}
if (err && !hasDismissed) {
Expand Down
4 changes: 2 additions & 2 deletions app/services/doc_auth/error_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ def generate_doc_auth_errors(response_info)
unknown_error_handler.handle(response_info).to_h
end

def self.general_error(liveness_enabled)
liveness_enabled ? Errors::GENERAL_ERROR_LIVENESS : Errors::GENERAL_ERROR
def self.general_error(_liveness_enabled)
Errors::GENERAL_ERROR
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify, only use the GENERAL_ERROR now 👍

end

def self.wrapped_general_error(liveness_enabled)
Expand Down
3 changes: 0 additions & 3 deletions app/services/doc_auth/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ module Errors
EXPIRATION_CHECKS = 'expiration_checks' # expiration date valid, expiration crosscheck
FULL_NAME_CHECK = 'full_name_check'
GENERAL_ERROR = 'general_error'
GENERAL_ERROR_LIVENESS = 'general_error_liveness'
ID_NOT_RECOGNIZED = 'id_not_recognized'
ID_NOT_VERIFIED = 'id_not_verified'
ISSUE_DATE_CHECKS = 'issue_date_checks'
Expand Down Expand Up @@ -65,7 +64,6 @@ module Errors
EXPIRATION_CHECKS,
FULL_NAME_CHECK,
GENERAL_ERROR,
GENERAL_ERROR_LIVENESS,
ID_NOT_RECOGNIZED,
ID_NOT_VERIFIED,
ISSUE_DATE_CHECKS,
Expand Down Expand Up @@ -121,7 +119,6 @@ module Errors
MULTIPLE_BACK_ID_FAILURES => { long_msg: MULTIPLE_BACK_ID_FAILURES, field_msg: FALLBACK_FIELD_LEVEL, hints: true },
GENERAL_ERROR => { long_msg: GENERAL_ERROR, field_msg: FALLBACK_FIELD_LEVEL, hints: true },
# Selfie errors
GENERAL_ERROR_LIVENESS => { long_msg: GENERAL_ERROR_LIVENESS, field_msg: FALLBACK_FIELD_LEVEL, hints: false },
SELFIE_FAILURE => { long_msg: SELFIE_FAILURE, field_msg: SELFIE_FAILURE, hints: false },
SELFIE_NOT_LIVE_OR_POOR_QUALITY => { long_msg: SELFIE_NOT_LIVE_OR_POOR_QUALITY, field_msg: SELFIE_FAILURE, hints: false },
}.transform_values(&:freeze).freeze
Expand Down
3 changes: 0 additions & 3 deletions app/services/doc_auth_router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ module DocAuthRouter
# i18n-tasks-use t('doc_auth.errors.general.no_liveness')
DocAuth::Errors::GENERAL_ERROR =>
'doc_auth.errors.general.no_liveness',
# i18n-tasks-use t('doc_auth.errors.dpi.top_msg_plural')
DocAuth::Errors::GENERAL_ERROR_LIVENESS =>
'doc_auth.errors.dpi.top_msg_plural',
# i18n-tasks-use t('doc_auth.errors.alerts.id_not_recognized')
DocAuth::Errors::ID_NOT_RECOGNIZED =>
'doc_auth.errors.alerts.id_not_recognized',
Expand Down
2 changes: 1 addition & 1 deletion app/views/idv/session_errors/warning.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<% c.with_header { t('idv.warning.sessions.heading') } %>

<p><%= t('idv.failure.sessions.warning') %></p>
<p><%= t('idv.warning.attempts_html', count: @remaining_submit_attempts) %></p>
<p><%= t('idv.failure.attempts_html', count: @remaining_submit_attempts) %></p>

<% c.with_action_button(
url: @try_again_path,
Expand Down
2 changes: 0 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1134,8 +1134,6 @@ idv.unavailable.idv_explanation.without_sp: The agency that you are trying to ac
idv.unavailable.next_steps_html: '%{status_page_link_html} or exit %{app_name} and try again later.'
idv.unavailable.status_page_link: Get updates on our status page
idv.unavailable.technical_difficulties: Unfortunately, we are having technical difficulties and cannot verify your identity at this time.
idv.warning.attempts_html.one: For security reasons, you have <strong>one attempt</strong> remaining.
idv.warning.attempts_html.other: For security reasons, you have <strong>%{count} attempts</strong> remaining.
idv.warning.sessions.heading: We couldn’t find records matching your personal information
idv.warning.state_id.cancel_button: Exit %{app_name}
idv.warning.state_id.explanation: Unfortunately, we’re experiencing technical difficulties with IDs from your state and are currently unable to verify your information.
Expand Down
2 changes: 0 additions & 2 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1133,8 +1133,6 @@ idv.unavailable.idv_explanation.without_sp: La agencia a la que está intentando
idv.unavailable.next_steps_html: '%{status_page_link_html} o salga de %{app_name} y vuelva a intentarlo más tarde.'
idv.unavailable.status_page_link: Obtenga las actualizaciones en nuestra página de estado
idv.unavailable.technical_difficulties: Lamentablemente, tenemos problemas técnicos y no podemos verificar su identidad en este momento.
idv.warning.attempts_html.one: Por motivos de seguridad, le queda <strong>un intento</strong>.
idv.warning.attempts_html.other: Por motivos de seguridad, le quedan <strong>%{count} intentos</strong>.
idv.warning.sessions.heading: No encontramos registros que coincidan con sus datos personales
idv.warning.state_id.cancel_button: Salir de %{app_name}
idv.warning.state_id.explanation: Lamentablemente, tenemos problemas técnicos con las identificaciones de su estado y no podemos verificar su información en este momento.
Expand Down
2 changes: 0 additions & 2 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1134,8 +1134,6 @@ idv.unavailable.idv_explanation.without_sp: L’organisme auquel vous essayez d
idv.unavailable.next_steps_html: '%{status_page_link_html} ou quittez le site %{app_name} et réessayez plus tard.'
idv.unavailable.status_page_link: Obtenir les dernières informations sur notre page d’état des systèmes.
idv.unavailable.technical_difficulties: Malheureusement, nous rencontrons des difficultés techniques et ne pouvons pas vérifier votre identité pour le moment.
idv.warning.attempts_html.one: Pour des raisons de sécurité, il vous reste <strong>une tentative</strong>.
idv.warning.attempts_html.other: Pour des raisons de sécurité, il vous reste <strong>%{count} tentatives</strong>.
idv.warning.sessions.heading: Nous n’avons pas trouvé de dossiers correspondant à vos informations personnelles
idv.warning.state_id.cancel_button: Quitter %{app_name}
idv.warning.state_id.explanation: Malheureusement, nous rencontrons des difficultés techniques avec les pièces d’identité de votre État et ne sommes pas en mesure de vérifier vos informations pour le moment.
Expand Down
2 changes: 0 additions & 2 deletions config/locales/zh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1138,8 +1138,6 @@ idv.unavailable.idv_explanation.without_sp: 你试图访问的机构需要确保
idv.unavailable.next_steps_html: '%{status_page_link_html} 或者退出 %{app_name},稍后再试。'
idv.unavailable.status_page_link: 在我们的状态页面获得最新信息。
idv.unavailable.technical_difficulties: 很遗憾,我们这边现在遇到技术困难,目前无法验证你的身份。
idv.warning.attempts_html.one: 出于安全考虑,你只能再试<strong>一次</strong>了。
idv.warning.attempts_html.other: 出于安全考虑,你只能再试 <strong>%{count} 次 </strong>了 。
idv.warning.sessions.heading: 我们找不到与你个人信息匹配的记录
idv.warning.state_id.cancel_button: 退出 %{app_name}
idv.warning.state_id.explanation: 遗憾的是,处理来自你所在州的身份证件时我们遇到技术困难,目前无法验证你的信息。
Expand Down
Loading