Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -14,7 +14,6 @@ describe('DocumentCaptureTroubleshootingOptions', () => {
const serviceProviderContext: ServiceProviderContextType = {
name: 'Example SP',
failureToProofURL: 'http://example.test/url/to/failure-to-proof',
getFailureToProofURL: () => '',
};
const wrappers: Record<string, ComponentType> = {
MarketingSiteContext: ({ children }: { children?: ReactNode }) => (
Expand Down Expand Up @@ -55,62 +54,6 @@ describe('DocumentCaptureTroubleshootingOptions', () => {
expect(links[1].target).to.equal('_blank');
});

context('with associated service provider', () => {
it('renders troubleshooting options', () => {
const { getAllByRole } = render(<DocumentCaptureTroubleshootingOptions />, {
wrapper: wrappers.helpCenterAndServiceProviderContext,
});

const links = getAllByRole('link') as HTMLAnchorElement[];

expect(links).to.have.lengthOf(3);
expect(links[0].textContent).to.equal(
'idv.troubleshooting.options.doc_capture_tipslinks.new_tab',
);
expect(links[0].getAttribute('href')).to.equal(
'https://example.com/redirect/?category=verify-your-identity&article=how-to-add-images-of-your-state-issued-id&location=document_capture_troubleshooting_options',
);
expect(links[0].target).to.equal('_blank');
expect(links[1].textContent).to.equal(
'idv.troubleshooting.options.supported_documentslinks.new_tab',
);
expect(links[1].getAttribute('href')).to.equal(
'https://example.com/redirect/?category=verify-your-identity&article=accepted-state-issued-identification&location=document_capture_troubleshooting_options',
);
expect(links[1].target).to.equal('_blank');
expect(links[2].textContent).to.equal(
'idv.troubleshooting.options.get_help_at_splinks.new_tab',
);
expect(links[2].href).to.equal(
'http://example.test/url/to/failure-to-proof?location=document_capture_troubleshooting_options',
);
expect(links[2].target).to.equal('_blank');
});

context('with location prop', () => {
it('appends location to links', () => {
const { getAllByRole } = render(
<DocumentCaptureTroubleshootingOptions location="custom" />,
{
wrapper: wrappers.helpCenterAndServiceProviderContext,
},
);

const links = getAllByRole('link') as HTMLAnchorElement[];

expect(links[0].href).to.equal(
'https://example.com/redirect/?category=verify-your-identity&article=how-to-add-images-of-your-state-issued-id&location=custom',
);
expect(links[1].href).to.equal(
'https://example.com/redirect/?category=verify-your-identity&article=accepted-state-issued-identification&location=custom',
);
expect(links[2].href).to.equal(
'http://example.test/url/to/failure-to-proof?location=custom',
);
});
});
});

context('with heading prop', () => {
it('shows heading text', () => {
const { getByRole } = render(
Expand Down Expand Up @@ -174,20 +117,6 @@ describe('DocumentCaptureTroubleshootingOptions', () => {
});
});

context('with sp option turned off', () => {
it('does not display the SP troubleshooting option', () => {
const { queryByRole } = render(
<DocumentCaptureTroubleshootingOptions showSPOption={false} />,
);

expect(
queryByRole('link', {
name: 'idv.troubleshooting.options.get_help_at_sp links.new_tab',
}),
).to.not.exist();
});
});

context('with document tips hidden', () => {
it('renders nothing', () => {
const { container } = render(
Expand All @@ -196,23 +125,5 @@ describe('DocumentCaptureTroubleshootingOptions', () => {

expect(container.innerHTML).to.be.empty();
});

context('with associated service provider', () => {
it('renders troubleshooting options', () => {
const { getAllByRole } = render(
<DocumentCaptureTroubleshootingOptions showDocumentTips={false} />,
{
wrapper: wrappers.helpCenterAndServiceProviderContext,
},
);

const links = getAllByRole('link') as HTMLAnchorElement[];

expect(links).to.have.lengthOf(1);
expect(links[0].getAttribute('href')).to.equal(
'http://example.test/url/to/failure-to-proof?location=document_capture_troubleshooting_options',
);
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useContext } from 'react';
import { TroubleshootingOptions } from '@18f/identity-components';
import { useI18n } from '@18f/identity-react-i18n';
import type { TroubleshootingOption } from '@18f/identity-components/troubleshooting-options';
import ServiceProviderContext from '../context/service-provider';
import MarketingSiteContext from '../context/marketing-site';
import InPersonCallToAction from './in-person-call-to-action';
import { InPersonContext } from '../context';
Expand All @@ -27,25 +26,17 @@ interface DocumentCaptureTroubleshootingOptionsProps {
* Whether to display alternative options for verifying.
*/
showAlternativeProofingOptions?: boolean;

/**
* Whether or not to display option for getting
* help at SP
*/
showSPOption?: boolean;
}

function DocumentCaptureTroubleshootingOptions({
heading,
location = 'document_capture_troubleshooting_options',
showDocumentTips = true,
showAlternativeProofingOptions,
showSPOption = true,
}: DocumentCaptureTroubleshootingOptionsProps) {
const { t } = useI18n();
const { inPersonURL } = useContext(InPersonContext);
const { getHelpCenterURL } = useContext(MarketingSiteContext);
const { name: spName, getFailureToProofURL } = useContext(ServiceProviderContext);

return (
<>
Expand All @@ -72,12 +63,6 @@ function DocumentCaptureTroubleshootingOptions({
text: t('idv.troubleshooting.options.supported_documents'),
isExternal: true,
},
spName &&
showSPOption && {
url: getFailureToProofURL(location),
text: t('idv.troubleshooting.options.get_help_at_sp', { sp_name: spName }),
isExternal: true,
},
].filter(Boolean) as TroubleshootingOption[]
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ function DocumentCaptureWarning({
<DocumentCaptureTroubleshootingOptions
location="post_submission_warning"
showAlternativeProofingOptions={!isFailedResult}
showSPOption={!nonIppOrFailedResult}
heading={t('components.troubleshooting_options.ipp_heading')}
/>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ describe('HybridDocCaptureWarning', () => {
describe('basic rendering', () => {
it('renders a warning alert', () => {
const { getByRole } = render(
<ServiceProviderContextProvider
value={{ name: null, failureToProofURL: '', getFailureToProofURL: () => '' }}
>
<ServiceProviderContextProvider value={{ name: null, failureToProofURL: '' }}>
<HybridDocCaptureWarning />
</ServiceProviderContextProvider>,
);
Expand All @@ -34,9 +32,7 @@ describe('HybridDocCaptureWarning', () => {
describe('without SP', () => {
it('renders correct warning title', () => {
const { getByRole } = render(
<ServiceProviderContextProvider
value={{ name: null, failureToProofURL: '', getFailureToProofURL: () => '' }}
>
<ServiceProviderContextProvider value={{ name: null, failureToProofURL: '' }}>
<HybridDocCaptureWarning />
</ServiceProviderContextProvider>,
);
Expand All @@ -49,9 +45,7 @@ describe('HybridDocCaptureWarning', () => {

it('does not render a third list item pertaining to SP services', () => {
const { getByRole } = render(
<ServiceProviderContextProvider
value={{ name: null, failureToProofURL: '', getFailureToProofURL: () => '' }}
>
<ServiceProviderContextProvider value={{ name: null, failureToProofURL: '' }}>
<HybridDocCaptureWarning />
</ServiceProviderContextProvider>,
);
Expand All @@ -67,9 +61,7 @@ describe('HybridDocCaptureWarning', () => {
describe('with SP', () => {
it('renders the correct warning title', () => {
const { getByRole } = render(
<ServiceProviderContextProvider
value={{ name: SP_NAME, failureToProofURL: '', getFailureToProofURL: () => '' }}
>
<ServiceProviderContextProvider value={{ name: SP_NAME, failureToProofURL: '' }}>
<HybridDocCaptureWarning />
</ServiceProviderContextProvider>,
);
Expand All @@ -83,9 +75,7 @@ describe('HybridDocCaptureWarning', () => {
});
it('renders a third list item pertaining to SP services', () => {
const { getByRole } = render(
<ServiceProviderContextProvider
value={{ name: SP_NAME, failureToProofURL: '', getFailureToProofURL: () => '' }}
>
<ServiceProviderContextProvider value={{ name: SP_NAME, failureToProofURL: '' }}>
<HybridDocCaptureWarning />
</ServiceProviderContextProvider>,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useContext } from 'react';
import { TroubleshootingOptions } from '@18f/identity-components';
import { useI18n } from '@18f/identity-react-i18n';
import type { TroubleshootingOption } from '@18f/identity-components/troubleshooting-options';
import ServiceProviderContext from '../context/service-provider';
import MarketingSiteContext from '../context/marketing-site';

interface InPersonTroubleshootingOptionsProps {
Expand All @@ -23,7 +22,6 @@ function InPersonTroubleshootingOptions({
}: InPersonTroubleshootingOptionsProps) {
const { t } = useI18n();
const { getHelpCenterURL } = useContext(MarketingSiteContext);
const { name: spName, getFailureToProofURL } = useContext(ServiceProviderContext);

return (
<TroubleshootingOptions
Expand All @@ -48,11 +46,6 @@ function InPersonTroubleshootingOptions({
text: t('idv.troubleshooting.options.learn_more_verify_by_phone_in_person'),
isExternal: true,
},
spName && {
url: getFailureToProofURL(location),
text: t('idv.troubleshooting.options.get_help_at_sp', { sp_name: spName }),
isExternal: true,
},
].filter(Boolean) as TroubleshootingOption[]
}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createContext, useMemo } from 'react';
import { addSearchParams } from '@18f/identity-url';
import type { ReactNode } from 'react';

export interface ServiceProviderContextType {
Expand All @@ -11,17 +10,11 @@ export interface ServiceProviderContextType {
* URL to redirect user on failure to proof.
*/
failureToProofURL: string;
/**
* Returns failure to proof URL for a
* specific location within the step.
*/
getFailureToProofURL: (location: string) => string;
}

const ServiceProviderContext = createContext<ServiceProviderContextType>({
name: null,
failureToProofURL: '',
getFailureToProofURL: () => '',
});

ServiceProviderContext.displayName = 'ServiceProviderContext';
Expand All @@ -35,8 +28,6 @@ function ServiceProviderContextProvider({ value, children }: ServiceProviderCont
const mergedValue = useMemo(
() => ({
...value,
getFailureToProofURL: (location: string) =>
addSearchParams(value.failureToProofURL, { location }),
}),
[value],
);
Expand Down
8 changes: 0 additions & 8 deletions app/views/idv/phone_errors/_warning.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,5 @@ locals:
text: t('idv.troubleshooting.options.verify_by_mail'),
url: idv_request_letter_path,
},
decorated_sp_session.sp_name && {
url: return_to_sp_failure_to_proof_path(
step: 'phone',
location: local_assigns.fetch(:name, 'warning'),
),
text: t('idv.troubleshooting.options.get_help_at_sp', sp_name: decorated_sp_session.sp_name),
new_tab: true,
},
].select(&:present?),
) { yield } %>
10 changes: 1 addition & 9 deletions app/views/idv/session_errors/exception.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@
text: t('idv.troubleshooting.options.contact_support', app_name: APP_NAME),
new_tab: true,
},
decorated_sp_session.sp_name && {
url: return_to_sp_failure_to_proof_path(
step: 'verify_info',
location: request.params[:action],
),
text: t('idv.troubleshooting.options.get_help_at_sp', sp_name: decorated_sp_session.sp_name),
new_tab: true,
},
].compact,
],
) do %>
<p>
<%= t(
Expand Down
1 change: 0 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,6 @@ idv.titles.unavailable: We are working to resolve an error
idv.troubleshooting.headings.need_assistance: 'Need immediate assistance? Here’s how to get help:'
idv.troubleshooting.options.contact_support: Contact %{app_name} Support
idv.troubleshooting.options.doc_capture_tips: Tips for taking clear photos of your ID
idv.troubleshooting.options.get_help_at_sp: Get help at %{sp_name}
idv.troubleshooting.options.learn_more_verify_by_mail: Learn more about verifying your address by mail
idv.troubleshooting.options.learn_more_verify_by_phone: Learn more about what phone number to use
idv.troubleshooting.options.learn_more_verify_by_phone_in_person: Learn more about verifying your phone number
Expand Down
1 change: 0 additions & 1 deletion config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,6 @@ idv.titles.unavailable: Estamos trabajando para corregir un error
idv.troubleshooting.headings.need_assistance: '¿Necesita ayuda inmediata? Así es como puede obtener ayuda:'
idv.troubleshooting.options.contact_support: Contacte con el servicio de asistencia de %{app_name}
idv.troubleshooting.options.doc_capture_tips: Consejos para tomar fotos nítidas de su identificación
idv.troubleshooting.options.get_help_at_sp: Obtenga ayuda en %{sp_name}
idv.troubleshooting.options.learn_more_verify_by_mail: Obtenga más información sobre la verificación de su dirección por correo
idv.troubleshooting.options.learn_more_verify_by_phone: Obtenga más información sobre el número de teléfono que debe usar
idv.troubleshooting.options.learn_more_verify_by_phone_in_person: Obtenga más información sobre la verificación de su número de teléfono
Expand Down
1 change: 0 additions & 1 deletion config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,6 @@ idv.titles.unavailable: Nous travaillons à la résolution d’une erreur
idv.troubleshooting.headings.need_assistance: 'Vous avez besoin d’une assistance immédiate ? Voici comment obtenir de l’aide :'
idv.troubleshooting.options.contact_support: Contacter le service d’assistance de %{app_name}
idv.troubleshooting.options.doc_capture_tips: Conseils pour prendre des photos nettes de votre pièce d’identité
idv.troubleshooting.options.get_help_at_sp: Obtenir de l’aide sur %{sp_name}
idv.troubleshooting.options.learn_more_verify_by_mail: En savoir plus sur la vérification de votre adresse par courrier
idv.troubleshooting.options.learn_more_verify_by_phone: En savoir plus sur quel numéro de téléphone utiliser
idv.troubleshooting.options.learn_more_verify_by_phone_in_person: En savoir plus sur la vérification de votre numéro de téléphone
Expand Down
1 change: 0 additions & 1 deletion config/locales/zh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,6 @@ idv.titles.unavailable: 我们正在争取解决错误。
idv.troubleshooting.headings.need_assistance: 需要立即帮助?以下是如何得到帮助的步骤:
idv.troubleshooting.options.contact_support: 联系 %{app_name} 支持
idv.troubleshooting.options.doc_capture_tips: 拍出你身份证件清晰照片的提示。
idv.troubleshooting.options.get_help_at_sp: 在 %{sp_name}得到帮助
idv.troubleshooting.options.learn_more_verify_by_mail: 对通过邮件验证你地址获得更多了解
idv.troubleshooting.options.learn_more_verify_by_phone: 了解有关使用什么号码的更多信息
idv.troubleshooting.options.learn_more_verify_by_phone_in_person: 对验证你的电话号码获得更多了解
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,44 +223,6 @@ describe('document-capture/components/review-issues-step', () => {
});
});

it('does not render sp help troubleshooting option for errored review', () => {
const { queryByRole } = render(
<InPersonContext.Provider value={{ inPersonURL: null }}>
<ServiceProviderContextProvider
value={{
name: 'Example App',
failureToProofURL: 'https://example.com/?step=document_capture',
}}
>
<ReviewIssuesStep {...DEFAULT_PROPS} />
</ServiceProviderContextProvider>
</InPersonContext.Provider>,
);

expect(
queryByRole('link', { name: 'idv.troubleshooting.options.get_help_at_sp links.new_tab' }),
).to.not.exist();
});

it('does render sp help troubleshooting option for errored review if in person url present', () => {
const { getByRole } = render(
<InPersonContext.Provider value={{ inPersonURL: 'http://example.com' }}>
<ServiceProviderContextProvider
value={{
name: 'Example App',
failureToProofURL: 'https://example.com/?step=document_capture',
}}
>
<ReviewIssuesStep {...DEFAULT_PROPS} />
</ServiceProviderContextProvider>
</InPersonContext.Provider>,
);

expect(
getByRole('link', { name: 'idv.troubleshooting.options.get_help_at_sp links.new_tab' }).href,
).to.equal('https://example.com/?step=document_capture&location=post_submission_warning');
});

it('renders alternative error messages with in person and doc type is not supported', async () => {
const { getByRole, getByText, getByLabelText } = render(
<InPersonContext.Provider value={{ inPersonURL: 'http://example.com' }}>
Expand Down
Loading