Change location of checks + exact check for "verified" navigation

This commit is contained in:
Chloe Herd 2024-05-09 13:07:34 -04:00
parent 3333d8bf6c
commit de4dd9bada
8 changed files with 43 additions and 6 deletions

View file

@ -30,7 +30,7 @@ export async function getDirectNavigation(toRoute) {
// vehicle -> vehicle-damage // vehicle -> vehicle-damage
// quote -> vin-lookup/estimate // quote -> vin-lookup/estimate
// insurance-company -> vin-lookup/estimate // insurance-company -> vin-lookup/estimate
if (store.getters.payment.insuranceCoverage.isVerified) { if (store.getters.requiresVerifiedRedirecting) {
if (fmgPageValue === fmgPageValues.VEHICLE) { if (fmgPageValue === fmgPageValues.VEHICLE) {
return fmgPageValues.VEHICLE_DAMAGE; return fmgPageValues.VEHICLE_DAMAGE;
} }
@ -74,7 +74,7 @@ export async function getImplicitNavigation(toRoute) {
if (quoteComponent.methods.arePagePrerequisitesValid()) { if (quoteComponent.methods.arePagePrerequisitesValid()) {
// Do not send to quote if verified insurance user. // Do not send to quote if verified insurance user.
if (store.getters.payment.insuranceCoverage.isVerified) { if (store.getters.requiresVerifiedRedirecting) {
return fmgPageValues.HERITAGE; return fmgPageValues.HERITAGE;
} else { } else {
return fmgPageValues.QUOTE; return fmgPageValues.QUOTE;

View file

@ -361,6 +361,7 @@ describe("getPageToRouteExistingOrderTo", () => {
}; };
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true); store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "666666");
// Act // Act
const result = await getPageToRouteExistingOrderTo(toRoute); const result = await getPageToRouteExistingOrderTo(toRoute);
@ -379,6 +380,7 @@ describe("getPageToRouteExistingOrderTo", () => {
}; };
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true); store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "666666");
store.commit(storeMutations.UPDATE_IS_REPAIR, true); store.commit(storeMutations.UPDATE_IS_REPAIR, true);
store.commit(storeMutations.UPDATE_MAKE, "acura"); store.commit(storeMutations.UPDATE_MAKE, "acura");
@ -398,6 +400,7 @@ describe("getPageToRouteExistingOrderTo", () => {
}; };
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true); store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "666666");
store.commit(storeMutations.UPDATE_IS_REPAIR, true); store.commit(storeMutations.UPDATE_IS_REPAIR, true);
store.commit(storeMutations.UPDATE_MAKE, "acura"); store.commit(storeMutations.UPDATE_MAKE, "acura");
@ -419,6 +422,7 @@ describe("getPageToRouteExistingOrderTo", () => {
}; };
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true); store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "666666");
store.commit(storeMutations.UPDATE_IS_REPAIR, false); store.commit(storeMutations.UPDATE_IS_REPAIR, false);
store.commit(storeMutations.UPDATE_MAKE, "acura"); store.commit(storeMutations.UPDATE_MAKE, "acura");
store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, [ store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, [
@ -441,6 +445,7 @@ describe("getPageToRouteExistingOrderTo", () => {
}; };
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true); store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "666666");
store.commit(storeMutations.UPDATE_IS_REPAIR, false); store.commit(storeMutations.UPDATE_IS_REPAIR, false);
store.commit(storeMutations.UPDATE_MAKE, "acura"); store.commit(storeMutations.UPDATE_MAKE, "acura");
store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, [ store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, [
@ -466,6 +471,7 @@ describe("getPageToRouteExistingOrderTo", () => {
}; };
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, false); store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, false);
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "55555");
// Act // Act
const result = await getPageToRouteExistingOrderTo(toRoute); const result = await getPageToRouteExistingOrderTo(toRoute);
@ -483,6 +489,7 @@ describe("getPageToRouteExistingOrderTo", () => {
}; };
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, false); store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, false);
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "55555");
// Act // Act
const result = await getPageToRouteExistingOrderTo(toRoute); const result = await getPageToRouteExistingOrderTo(toRoute);
@ -500,6 +507,7 @@ describe("getPageToRouteExistingOrderTo", () => {
}; };
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, false); store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, false);
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "55555");
// Act // Act
const result = await getPageToRouteExistingOrderTo(toRoute); const result = await getPageToRouteExistingOrderTo(toRoute);

View file

@ -728,6 +728,7 @@ describe("vehicle-damage.vue", () => {
getters: { getters: {
vehicle: {}, vehicle: {},
payment: { insuranceCoverage: { isVerified: true } }, payment: { insuranceCoverage: { isVerified: true } },
requiresVerifiedRedirecting: true,
}, },
}, },
}, },

View file

@ -541,7 +541,7 @@ export default {
return this.$route.params[this.routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]; return this.$route.params[this.routerParams.DISPLAY_VEHICLE_CHANGE_ALERT];
}, },
shouldHideBackButton() { shouldHideBackButton() {
return this.$store.getters.payment.insuranceCoverage.isVerified; return this.$store.getters.requiresVerifiedRedirecting;
}, },
}, },

View file

@ -348,7 +348,7 @@ export default {
isDisabled(options) { isDisabled(options) {
if ( if (
!options.length || !options.length ||
store.getters.payment?.insuranceCoverage?.isVerified || store.getters.requiresVerifiedRedirecting ||
getFunnelCookie()?.HasDelayedClaimRegistration getFunnelCookie()?.HasDelayedClaimRegistration
) { ) {
return true; return true;

View file

@ -22,6 +22,7 @@ jest.mock("@/store", () => ({
customer: { customer: {
emailAddress: "builddigitaltest@safelite.com", emailAddress: "builddigitaltest@safelite.com",
}, },
referralNumber: "666666",
}, },
payment: { payment: {
insuranceCoverage: { insuranceCoverage: {

View file

@ -116,6 +116,22 @@ const routes = [
} }
} }
// Reroute around pages that should not be available.
// Exception 1: Integrated Users should not see vehicle or quote pages.
if (store.getters.requiresVerifiedRedirecting) {
if (to.query.fmgPage === fmgPageValues.VEHICLE) {
to.query.fmgPage = fmgPageValues.VEHICLE_DAMAGE;
} else if (
to.query.fmgPage === fmgPageValues.QUOTE ||
to.query.fmgPage === fmgPageValues.INSURANCE_COMPANY
) {
// Push to heritage if going to quote & integrated.
await navigateToHeritageFunnel({ shouldSaveSession: false });
return next(false);
}
}
await runExperiments(to.query.fmgPage); await runExperiments(to.query.fmgPage);
// Process funnel cookie. // Process funnel cookie.
@ -228,7 +244,7 @@ router.beforeEach(async (to, from, next) => {
// Refresh page if navigating to self to prevent locking. // Refresh page if navigating to self to prevent locking.
// For now only carved out for vehicle; all modals are opened through anchor tags at the moment, // For now only carved out for vehicle; all modals are opened through anchor tags at the moment,
// which also self navigate, but relied on the page remaining the same on self-navigation. // which also self navigate, but relied on the page remaining the same on self-navigation.
} else if (toQueryPage === fromQueryPage && toQueryPage === funnelStartPageName) { } else if (toQueryPage === fromQueryPage && toQueryPage === getRedirectedStartPage()) {
router.go(0); router.go(0);
} else { } else {
next(); next();
@ -477,7 +493,7 @@ async function DisplayPageError() {
// we use the pageError querystring as a counter to how many times a user has experienced an error and been routed here. // we use the pageError querystring as a counter to how many times a user has experienced an error and been routed here.
// once they receive more than 1 pageerrors, we'll reset their state to hopefully correct any issues they may be having. // once they receive more than 1 pageerrors, we'll reset their state to hopefully correct any issues they may be having.
var navPage = fmgPageValues.VEHICLE; var navPage = fmgPageValues.VEHICLE;
if (store.getters.payment.insuranceCoverage.isVerified) { if (store.getters.requiresVerifiedRedirecting) {
navPage = fmgPageValues.VEHICLE_DAMAGE; navPage = fmgPageValues.VEHICLE_DAMAGE;
} }
@ -542,4 +558,12 @@ async function runExperiments(nextPage) {
); );
} }
function getRedirectedStartPage() {
if (store.getters.requiresVerifiedRedirect) {
return fmgPageValues.VEHICLE_DAMAGE;
} else {
return funnelStartPageName;
}
}
export default router; export default router;

View file

@ -776,6 +776,9 @@ export const getters = {
} }
return false; return false;
}, },
requiresVerifiedRedirecting: (state) => {
return state.order?.referralNumber?.length === 6;
},
}; };
function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) { function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) {