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
Binary file removed app/assets/images/idv/phone.png
Binary file not shown.
9 changes: 8 additions & 1 deletion app/controllers/idv/in_person/ready_to_verify_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ReadyToVerifyController < ApplicationController
before_action :confirm_in_person_session

def show
analytics.idv_in_person_ready_to_verify_visit
analytics.idv_in_person_ready_to_verify_visit(**extra_analytics_attributes)
@presenter = ReadyToVerifyPresenter.new(enrollment: enrollment)
end

Expand All @@ -23,6 +23,13 @@ def confirm_in_person_session
def enrollment
current_user.pending_in_person_enrollment
end

def extra_analytics_attributes
extra = {}
bucket = session[:in_person_cta_variant]
extra[:in_person_cta_variant] = bucket if bucket
extra
end
end
end
end
2 changes: 1 addition & 1 deletion app/controllers/sign_up/completions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def show

def update
track_completion_event('agency-page')
irs_attempts_api_tracker.idv_reproof if current_user.profiles&.last&.has_proofed_before?
update_verified_attributes
send_in_person_completion_survey
if decider.go_back_to_mobile_app?
Expand Down Expand Up @@ -83,7 +84,6 @@ def analytics_attributes(page_occurence)
end

def track_completion_event(last_page)
irs_attempts_api_tracker.idv_reproof if current_user.profiles&.last&.has_proofed_before?
analytics.user_registration_complete(**analytics_attributes(last_page))
end

Expand Down
13 changes: 4 additions & 9 deletions app/controllers/users/webauthn_setup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,12 @@ def process_invalid_webauthn(form)
else
flash.now[:error] = t('errors.webauthn_setup.unique_name')
end

render :new
elsif form.platform_authenticator?
flash[:error] = t('errors.webauthn_platform_setup.general_error')
else
if form.platform_authenticator?
flash[:error] = t('errors.webauthn_platform_setup.general_error')
else
flash[:error] = t('errors.webauthn_setup.general_error')
end

redirect_to account_two_factor_authentication_path
flash[:error] = t('errors.webauthn_setup.general_error')
end
render :new
end

def mark_user_as_fully_authenticated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Button } from '@18f/identity-components';
import { useInstanceId } from '@18f/identity-react-hooks';
import { t } from '@18f/identity-i18n';
import AnalyticsContext from '../context/analytics';
import { InPersonContext } from '../context';

interface InPersonCallToActionProps {
altHeading?: string;
Expand All @@ -13,6 +14,7 @@ interface InPersonCallToActionProps {
function InPersonCallToAction({ altHeading, altPrompt, altButtonText }: InPersonCallToActionProps) {
const instanceId = useInstanceId();
const { trackEvent } = useContext(AnalyticsContext);
const { inPersonCtaVariantActive } = useContext(InPersonContext);

return (
<section
Expand All @@ -30,7 +32,11 @@ function InPersonCallToAction({ altHeading, altPrompt, altButtonText }: InPerson
isWide
href="#location"
className="margin-top-3 margin-bottom-1"
onClick={() => trackEvent('IdV: verify in person troubleshooting option clicked')}
onClick={() =>
trackEvent('IdV: verify in person troubleshooting option clicked', {
in_person_cta_variant: inPersonCtaVariantActive,
})
}
>
{altButtonText || t('in_person_proofing.body.cta.button')}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import AddressSearch, {
LOCATIONS_URL,
} from './address-search';
import InPersonLocations, { FormattedLocation } from './in-person-locations';
import { InPersonContext } from '../context';

function InPersonLocationPostOfficeSearchStep({ onChange, toPreviousStep, registerField }) {
const { inPersonCtaVariantActive } = useContext(InPersonContext);
const { t } = useI18n();
const [inProgress, setInProgress] = useState<boolean>(false);
const [isLoadingLocations, setLoadingLocations] = useState<boolean>(false);
Expand Down Expand Up @@ -41,7 +43,10 @@ function InPersonLocationPostOfficeSearchStep({ onChange, toPreviousStep, regist
const selectedLocation = locationResults![id]!;
const { streetAddress, formattedCityStateZip } = selectedLocation;
const selectedLocationAddress = `${streetAddress}, ${formattedCityStateZip}`;
setSubmitEventMetadata({ selected_location: selectedLocationAddress });
setSubmitEventMetadata({
selected_location: selectedLocationAddress,
in_person_cta_variant: inPersonCtaVariantActive,
});
onChange({ selectedLocationAddress });
if (autoSubmit) {
setDisabledAddressSearch(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ describe('InPersonLocationStep', () => {

await userEvent.click(button);

await findByText('{"selected_location":"Baltimore"}');
await findByText('{"selected_location":"Baltimore","in_person_cta_variant":""}');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import BackButton from './back-button';
import LocationCollection from './location-collection';
import LocationCollectionItem from './location-collection-item';
import AnalyticsContext from '../context/analytics';
import { InPersonContext } from '../context';

interface PostOffice {
address: string;
Expand Down Expand Up @@ -79,6 +80,7 @@ const prepToSend = (location: object) => {
};

function InPersonLocationStep({ onChange, toPreviousStep }) {
const { inPersonCtaVariantActive } = useContext(InPersonContext);
const { t } = useI18n();
const [locationData, setLocationData] = useState([] as FormattedLocation[]);
const [foundAddress] = useState({} as LocationQuery);
Expand All @@ -102,7 +104,10 @@ function InPersonLocationStep({ onChange, toPreviousStep }) {
async (e: any, id: number) => {
const selectedLocation = locationData[id];
const { name: selectedLocationName } = selectedLocation;
setSubmitEventMetadata({ selected_location: selectedLocationName });
setSubmitEventMetadata({
selected_location: selectedLocationName,
in_person_cta_variant: inPersonCtaVariantActive,
});
onChange({ selectedLocationName });
if (autoSubmit) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ function ReviewIssuesStep({
setHasDismissed(true);
}
function onInPersonSelected() {
trackEvent('IdV: verify in person troubleshooting option clicked');
trackEvent('IdV: verify in person troubleshooting option clicked', {
in_person_cta_variant: inPersonCtaVariantActive,
});
}

// let FormSteps know, via FormStepsContext, whether this page
Expand All @@ -102,13 +104,9 @@ function ReviewIssuesStep({
if (!inPersonURL || isFailedResult) {
return;
}
if (inPersonCtaVariantActive === 'in_person_variant_a') {
trackEvent('IdV: IPP CTA Variant A');
} else if (inPersonCtaVariantActive === 'in_person_variant_b') {
trackEvent('IdV: IPP CTA Variant B');
} else if (inPersonCtaVariantActive === 'in_person_variant_c') {
trackEvent('IdV: IPP CTA Variant C');
}
trackEvent('IdV: IPP CTA Variant Displayed', {
in_person_cta_variant: inPersonCtaVariantActive,
});
}, []);

if (!hasDismissed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ describe('AnalyticsContextProvider', () => {

result.current.trackVisitEvent(stepName);

expect(trackEvent).to.have.been.calledWith(`IdV: ${stepName} visited`);
expect(trackEvent).to.have.been.calledWith(`IdV: ${stepName} visited`, {
in_person_cta_variant: '',
});
});

it('calls trackEvent with submit event', () => {
Expand Down
14 changes: 12 additions & 2 deletions app/javascript/packages/document-capture/context/analytics.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createContext, useState } from 'react';
import { createContext, useContext, useState } from 'react';
import type { ReactNode } from 'react';
import type { trackEvent } from '@18f/identity-analytics';
import InPersonContext from './in-person';

type EventMetadata = Record<string, any>;

Expand Down Expand Up @@ -66,9 +67,18 @@ export function AnalyticsContextProvider({ children, trackEvent }: AnalyticsCont

setSubmitEventMetadataState(DEFAULT_EVENT_METADATA);
};
const { inPersonCtaVariantActive } = useContext(InPersonContext);

const extraAnalyticsAttributes = (stepName) => {
const extra: EventMetadata = { ...DEFAULT_EVENT_METADATA };
if (stepName === 'location') {
extra.in_person_cta_variant = inPersonCtaVariantActive;
}
return extra;
};
const trackVisitEvent: TrackVisitEvent = (stepName) => {
if (LOGGED_STEPS.includes(stepName)) {
trackEvent(`IdV: ${stepName} visited`);
trackEvent(`IdV: ${stepName} visited`, extraAnalyticsAttributes(stepName));
}
};

Expand Down
22 changes: 11 additions & 11 deletions app/javascript/packs/document-capture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,17 @@ const trackEvent: typeof baseTrackEvent = (event, payload) => {
const App = composeComponents(
[MarketingSiteContextProvider, { helpCenterRedirectURL, securityAndPrivacyHowItWorksURL }],
[DeviceContext.Provider, { value: device }],
[
InPersonContext.Provider,
{
value: {
arcgisSearchEnabled: arcgisSearchEnabled === 'true',
inPersonCtaVariantTestingEnabled: inPersonCtaVariantTestingEnabled === true,
inPersonCtaVariantActive,
inPersonURL,
},
},
],
[AnalyticsContextProvider, { trackEvent }],
[
AcuantContextProvider,
Expand Down Expand Up @@ -172,17 +183,6 @@ const trackEvent: typeof baseTrackEvent = (event, payload) => {
maxSubmissionAttemptsBeforeNativeCamera: Number(maxSubmissionAttemptsBeforeNativeCamera),
},
],
[
InPersonContext.Provider,
{
value: {
arcgisSearchEnabled: arcgisSearchEnabled === 'true',
inPersonCtaVariantTestingEnabled: inPersonCtaVariantTestingEnabled === true,
inPersonCtaVariantActive,
inPersonURL,
},
},
],
[DocumentCapture, { isAsyncForm, onStepChange: keepAlive }],
);

Expand Down
18 changes: 3 additions & 15 deletions app/javascript/packs/webauthn-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ function webauthn() {
if (!isWebAuthnEnabled()) {
reloadWithError('NotSupportedError');
}
const continueButton = document.getElementById('continue-button')!;
continueButton.addEventListener('click', () => {
const form = document.getElementById('webauthn_form') as HTMLFormElement;
form.addEventListener('submit', (event) => {
event.preventDefault();
document.getElementById('spinner')!.classList.remove('display-none');
document.getElementById('continue-button')!.className = 'display-none';

Expand All @@ -47,19 +48,6 @@ function webauthn() {
})
.catch((err) => reloadWithError(err.name, { force: true }));
});
const input = document.getElementById('nickname') as HTMLInputElement;
input.addEventListener('keypress', function (event) {
if (event.keyCode === 13) {
// prevent form submit
event.preventDefault();
}
});
input.addEventListener('keyup', function (event) {
event.preventDefault();
if (event.keyCode === 13 && input.value) {
continueButton.click();
}
});
}

if (process.env.NODE_ENV !== 'test') {
Expand Down
Loading