Change location of checks + exact check for "verified" navigation
This commit is contained in:
parent
3333d8bf6c
commit
de4dd9bada
8 changed files with 43 additions and 6 deletions
|
|
@ -30,7 +30,7 @@ export async function getDirectNavigation(toRoute) {
|
|||
// vehicle -> vehicle-damage
|
||||
// quote -> vin-lookup/estimate
|
||||
// insurance-company -> vin-lookup/estimate
|
||||
if (store.getters.payment.insuranceCoverage.isVerified) {
|
||||
if (store.getters.requiresVerifiedRedirecting) {
|
||||
if (fmgPageValue === fmgPageValues.VEHICLE) {
|
||||
return fmgPageValues.VEHICLE_DAMAGE;
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ export async function getImplicitNavigation(toRoute) {
|
|||
|
||||
if (quoteComponent.methods.arePagePrerequisitesValid()) {
|
||||
// Do not send to quote if verified insurance user.
|
||||
if (store.getters.payment.insuranceCoverage.isVerified) {
|
||||
if (store.getters.requiresVerifiedRedirecting) {
|
||||
return fmgPageValues.HERITAGE;
|
||||
} else {
|
||||
return fmgPageValues.QUOTE;
|
||||
|
|
|
|||
|
|
@ -361,6 +361,7 @@ describe("getPageToRouteExistingOrderTo", () => {
|
|||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
|
||||
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "666666");
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
|
@ -379,6 +380,7 @@ describe("getPageToRouteExistingOrderTo", () => {
|
|||
};
|
||||
|
||||
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_MAKE, "acura");
|
||||
|
||||
|
|
@ -398,6 +400,7 @@ describe("getPageToRouteExistingOrderTo", () => {
|
|||
};
|
||||
|
||||
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_MAKE, "acura");
|
||||
|
||||
|
|
@ -419,6 +422,7 @@ describe("getPageToRouteExistingOrderTo", () => {
|
|||
};
|
||||
|
||||
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_MAKE, "acura");
|
||||
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_REFERRAL_NUMBER, "666666");
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
||||
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_REFERRAL_NUMBER, "55555");
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
|
@ -483,6 +489,7 @@ describe("getPageToRouteExistingOrderTo", () => {
|
|||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, false);
|
||||
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "55555");
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
|
@ -500,6 +507,7 @@ describe("getPageToRouteExistingOrderTo", () => {
|
|||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, false);
|
||||
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "55555");
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
|
|
|||
|
|
@ -728,6 +728,7 @@ describe("vehicle-damage.vue", () => {
|
|||
getters: {
|
||||
vehicle: {},
|
||||
payment: { insuranceCoverage: { isVerified: true } },
|
||||
requiresVerifiedRedirecting: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -541,7 +541,7 @@ export default {
|
|||
return this.$route.params[this.routerParams.DISPLAY_VEHICLE_CHANGE_ALERT];
|
||||
},
|
||||
shouldHideBackButton() {
|
||||
return this.$store.getters.payment.insuranceCoverage.isVerified;
|
||||
return this.$store.getters.requiresVerifiedRedirecting;
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ export default {
|
|||
isDisabled(options) {
|
||||
if (
|
||||
!options.length ||
|
||||
store.getters.payment?.insuranceCoverage?.isVerified ||
|
||||
store.getters.requiresVerifiedRedirecting ||
|
||||
getFunnelCookie()?.HasDelayedClaimRegistration
|
||||
) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ jest.mock("@/store", () => ({
|
|||
customer: {
|
||||
emailAddress: "builddigitaltest@safelite.com",
|
||||
},
|
||||
referralNumber: "666666",
|
||||
},
|
||||
payment: {
|
||||
insuranceCoverage: {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
// Process funnel cookie.
|
||||
|
|
@ -228,7 +244,7 @@ router.beforeEach(async (to, from, next) => {
|
|||
// 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,
|
||||
// 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);
|
||||
} else {
|
||||
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.
|
||||
// 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;
|
||||
if (store.getters.payment.insuranceCoverage.isVerified) {
|
||||
if (store.getters.requiresVerifiedRedirecting) {
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -776,6 +776,9 @@ export const getters = {
|
|||
}
|
||||
return false;
|
||||
},
|
||||
requiresVerifiedRedirecting: (state) => {
|
||||
return state.order?.referralNumber?.length === 6;
|
||||
},
|
||||
};
|
||||
|
||||
function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue