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
6 changes: 0 additions & 6 deletions app/components/troubleshooting_options_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<%= tag.section(**tag_options, class: css_class) do %>
<% if new_features? %>
<span class="usa-tag bg-accent-cool-darker text-uppercase display-inline-block">
<%= t('components.troubleshooting_options.new_feature') %>
</span>
<% end %>

<%= header %>
<ul class="troubleshooting-options__options">
<% options.each do |option| %>
Expand Down
7 changes: 1 addition & 6 deletions app/components/troubleshooting_options_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@ class TroubleshootingOptionsComponent < BaseComponent

attr_reader :tag_options

def initialize(new_features: false, **tag_options)
@new_features = new_features
def initialize(**tag_options)
@tag_options = tag_options.dup
end

def render?
options?
end

def new_features?
@new_features
end

def css_class
[
'troubleshooting-options',
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/idv/session_errors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,15 @@ def confirm_idv_session_step_needed
end

def set_try_again_path
if params[:from]&.starts_with? idv_in_person_path
if in_person_flow?
@try_again_path = idv_in_person_path
else
@try_again_path = idv_doc_auth_path
end
end

def in_person_flow?
params[:flow] == 'in_person'
end
end
end
5 changes: 0 additions & 5 deletions app/controllers/verify_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def app_data
{
base_path: idv_app_path,
cancel_url: idv_cancel_path,
in_person_url: in_person_url,
initial_values: initial_values,
reset_password_url: forgot_password_url,
enabled_step_names: IdentityConfig.store.idv_api_enabled_steps,
Expand All @@ -47,10 +46,6 @@ def enabled_steps
IdentityConfig.store.idv_api_enabled_steps
end

def in_person_url
idv_in_person_url if Idv::InPersonConfig.enabled_for_issuer?(current_sp&.issuer)
end

def step_enabled?(step)
enabled_steps.include?(step)
end
Expand Down
1 change: 0 additions & 1 deletion app/javascript/packages/verify-flow/cancel.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('Cancel', () => {
cancelURL: 'http://example.test/cancel',
currentStep: 'one',
basePath: '',
inPersonURL: null,
onComplete() {},
}}
>
Expand Down
3 changes: 1 addition & 2 deletions app/javascript/packages/verify-flow/context/flow-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface FlowContextValue {
/**
* URL to in-person proofing alternative flow, if enabled.
*/
inPersonURL: string | null;
inPersonURL?: string;

/**
* Current step name.
Expand All @@ -29,7 +29,6 @@ export interface FlowContextValue {

const FlowContext = createContext<FlowContextValue>({
cancelURL: '',
inPersonURL: null,
currentStep: '',
basePath: '',
onComplete() {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { render } from '@testing-library/react';
import type { ComponentType } from 'react';
import FlowContext, { FlowContextValue } from './context/flow-context';
import VerifyFlowTroubleshootingOptions from './verify-flow-troubleshooting-options';

describe('VerifyFlowTroubleshootingOptions', () => {
Expand All @@ -18,37 +16,4 @@ describe('VerifyFlowTroubleshootingOptions', () => {
'idv.troubleshooting.options.contact_support links.new_window',
);
});

context('with in-person proofing option', () => {
const inPersonURL = 'http://example.com';
const wrapper: ComponentType = ({ children }) => (
<FlowContext.Provider value={{ inPersonURL } as FlowContextValue}>
{children}
</FlowContext.Provider>
);

it('renders additional troubleshooting options', () => {
it('renders troubleshooting options', () => {
const { getAllByRole } = render(<VerifyFlowTroubleshootingOptions />, { wrapper });

const headings = getAllByRole('heading');
const options = getAllByRole('link');

expect(headings).to.have.lengthOf(2);
expect(headings[0].textContent).to.equal(
'components.troubleshooting_options.default_heading',
);
expect(headings[0].textContent).to.equal('idv.troubleshooting.headings.are_you_near');
expect(options).to.have.lengthOf(2);
expect(options[0].getAttribute('href')).to.equal('https://login.gov/contact/');
expect(options[0].getAttribute('target')).to.equal('_blank');
expect(options[0].textContent).to.equal(
'idv.troubleshooting.options.contact_support links.new_window',
);
expect(options[1].getAttribute('href')).to.equal(inPersonURL);
expect(options[1].getAttribute('target')).to.equal('');
expect(options[1].textContent).to.equal('idv.troubleshooting.options.verify_in_person');
});
});
});
});
Original file line number Diff line number Diff line change
@@ -1,39 +1,21 @@
import { useContext } from 'react';
import { TroubleshootingOptions } from '@18f/identity-components';
import { getConfigValue } from '@18f/identity-config';
import { t } from '@18f/identity-i18n';
import FlowContext from './context/flow-context';

function VerifyFlowTroubleshootingOptions() {
const { inPersonURL } = useContext(FlowContext);

return (
<>
<TroubleshootingOptions
heading={t('components.troubleshooting_options.default_heading')}
options={[
{
url: 'https://login.gov/contact/',
text: t('idv.troubleshooting.options.contact_support', {
app_name: getConfigValue('appName'),
}),
isExternal: true,
},
]}
/>
{inPersonURL && (
<TroubleshootingOptions
isNewFeatures
heading={t('idv.troubleshooting.headings.are_you_near')}
options={[
{
url: inPersonURL,
text: t('idv.troubleshooting.options.verify_in_person'),
},
]}
/>
)}
</>
<TroubleshootingOptions
heading={t('components.troubleshooting_options.default_heading')}
options={[
{
url: 'https://login.gov/contact/',
text: t('idv.troubleshooting.options.contact_support', {
app_name: getConfigValue('appName'),
}),
isExternal: true,
},
]}
/>
);
}

Expand Down
7 changes: 0 additions & 7 deletions app/javascript/packages/verify-flow/verify-flow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ export interface VerifyFlowProps {
*/
cancelURL?: string;

/**
* URL to in-person proofing alternative flow, if enabled.
*/
inPersonURL?: string | null;

/**
* Initial value for address verification method.
*/
Expand Down Expand Up @@ -109,7 +104,6 @@ function VerifyFlow({
enabledStepNames,
basePath,
cancelURL = '',
inPersonURL = null,
initialAddressVerificationMethod,
onComplete,
}: VerifyFlowProps) {
Expand All @@ -123,7 +117,6 @@ function VerifyFlow({
const [initialStep, setCompletedStep] = useInitialStepValidation(basePath, steps);
const context = useObjectMemo({
cancelURL,
inPersonURL,
currentStep,
basePath,
onComplete,
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/packs/document-capture.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function addPageAction(event, payload) {
appName,
flowPath,
cancelUrl: cancelURL,
idvInPersonUrl: inPersonURL = null,
idvInPersonUrl: inPersonURL,
} = /** @type {AppRootData} */ (appRoot.dataset);

const App = composeComponents(
Expand Down
17 changes: 2 additions & 15 deletions app/javascript/packs/verify-flow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import {
decodeUserBundle,
AddressVerificationMethod,
ErrorStatusPage,
FlowContext,
} from '@18f/identity-verify-flow';
import { trackError } from '@18f/identity-analytics';
import SecretSessionStorage, { s2ab } from '@18f/identity-secret-session-storage';
import type { SecretValues, VerifyFlowValues, FlowContextValue } from '@18f/identity-verify-flow';
import type { SecretValues, VerifyFlowValues } from '@18f/identity-verify-flow';

interface AppRootValues {
/**
Expand All @@ -32,11 +31,6 @@ interface AppRootValues {
*/
cancelUrl: string;

/**
* URL to in-person proofing alternative flow, if enabled.
*/
inPersonUrl: string | null;

/**
* Base64-encoded encryption key for secret session store.
*/
Expand All @@ -61,7 +55,6 @@ export async function initialize() {
enabledStepNames: enabledStepNamesJSON,
basePath,
cancelUrl: cancelURL,
inPersonUrl: inPersonURL,
storeKey: storeKeyBase64,
} = appRoot.dataset;
const initialValues: Partial<VerifyFlowValues> = JSON.parse(initialValuesJSON);
Expand All @@ -88,12 +81,7 @@ export async function initialize() {
}
} catch (error) {
trackError(error);
render(
<FlowContext.Provider value={{ inPersonURL } as FlowContextValue}>
<ErrorStatusPage />
</FlowContext.Provider>,
appRoot,
);
render(<ErrorStatusPage />, appRoot);
return tearDown;
}

Expand All @@ -112,7 +100,6 @@ export async function initialize() {
initialValues={initialValues}
enabledStepNames={enabledStepNames}
cancelURL={cancelURL}
inPersonURL={inPersonURL}
basePath={basePath}
onComplete={onComplete}
initialAddressVerificationMethod={initialAddressVerificationMethod}
Expand Down
2 changes: 1 addition & 1 deletion app/services/idv/actions/verify_document_status_action.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Idv
module Actions
class VerifyDocumentStatusAction < Idv::Steps::VerifyBaseStep
class VerifyDocumentStatusAction < Idv::Steps::DocAuthBaseStep
def call
process_async_state(async_state)
end
Expand Down
35 changes: 0 additions & 35 deletions app/services/idv/steps/doc_auth_base_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,6 @@ def initialize(flow)

private

def throttle
@throttle ||= Throttle.new(
user: current_user,
throttle_type: :idv_resolution,
)
end

def idv_failure(result)
throttle.increment! if result.extra.dig(:proofing_results, :exception).blank?
if throttle.throttled?
@flow.analytics.throttler_rate_limit_triggered(
throttle_type: :idv_resolution,
step_name: self.class.name,
)
redirect_to idv_session_errors_failure_url
elsif result.extra.dig(:proofing_results, :exception).present?
@flow.analytics.idv_doc_auth_exception_visited(
step_name: self.class.name,
remaining_attempts: throttle.remaining_count,
)
redirect_to idv_session_errors_exception_url(
from: request.path,
)
else
@flow.analytics.idv_doc_auth_warning_visited(
step_name: self.class.name,
remaining_attempts: throttle.remaining_count,
)
redirect_to idv_session_errors_warning_url(
from: request.path,
)
end
result
end

def save_proofing_components
return unless current_user

Expand Down
10 changes: 10 additions & 0 deletions app/services/idv/steps/ipp/verify_wait_step_show.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ def call

process_async_state(async_state)
end

private

def exception_url
idv_session_errors_exception_url(flow: :in_person)
end

def warning_url
idv_session_errors_warning_url(flow: :in_person)
end
end
end
end
Expand Down
39 changes: 39 additions & 0 deletions app/services/idv/steps/verify_base_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,45 @@ def delete_pii
flow_session.delete(:pii_from_user)
end

def throttle
@throttle ||= Throttle.new(
user: current_user,
throttle_type: :idv_resolution,
)
end

def idv_failure(result)
throttle.increment! if result.extra.dig(:proofing_results, :exception).blank?
if throttle.throttled?
@flow.analytics.throttler_rate_limit_triggered(
throttle_type: :idv_resolution,
step_name: self.class.name,
)
redirect_to idv_session_errors_failure_url
elsif result.extra.dig(:proofing_results, :exception).present?
@flow.analytics.idv_doc_auth_exception_visited(
step_name: self.class.name,
remaining_attempts: throttle.remaining_count,
)
redirect_to exception_url
else
@flow.analytics.idv_doc_auth_warning_visited(
step_name: self.class.name,
remaining_attempts: throttle.remaining_count,
)
redirect_to warning_url
end
result
end

def exception_url
idv_session_errors_exception_url
end

def warning_url
idv_session_errors_warning_url
end

def idv_success(idv_result)
idv_result[:success]
end
Expand Down
Loading