Route quote to heritage when verified insurance

This commit is contained in:
Chloe Herd 2024-03-07 15:27:07 -05:00
parent 809d1838df
commit 020908f8e9
2 changed files with 23 additions and 8 deletions

View file

@ -29,13 +29,17 @@ export async function getPageToRouteExistingOrderTo(toRoute = {}) {
export async function getDirectNavigation(toRoute) {
const fmgPageValue = toRoute.query[queryStrings.FMG_PAGE];
// Override if Verified Insurance & Trying to go to vehicle
// so vehicle info cannot be overriden.
if (
store.getters.payment.insuranceCoverage.isVerified &&
fmgPageValue === fmgPageValues.VEHICLE
) {
return fmgPageValues.VEHICLE_DAMAGE;
// Verified insurance users need to be routed around some pages
// vehicle -> vehicle-damage
// quote -> heritage
if (store.getters.payment.insuranceCoverage.isVerified) {
if (fmgPageValue === fmgPageValues.VEHICLE) {
return fmgPageValues.VEHICLE_DAMAGE;
}
if (fmgPageValue === fmgPageValues.QUOTE) {
return fmgPageValues.HERITAGE;
}
}
// Otherwise, respect navigation from query string.
@ -62,7 +66,12 @@ export async function getImplicitNavigation(toRoute) {
const skipVin = await skipVinLookup();
if (quoteComponent.methods.arePagePrerequisitesValid()) {
return fmgPageValues.QUOTE;
// Do not send to quote if verified insurance user.
if (store.getters.payment.insuranceCoverage.isVerified) {
return fmgPageValues.HERITAGE;
} else {
return fmgPageValues.QUOTE;
}
} else if (capabilityQuestionsComponent.methods.arePagePrerequisitesValid()) {
return fmgPageValues.CAPABILITY_QUESTIONS;
} else if (moldingQuestionsComponent.methods.arePagePrerequisitesValid()) {

View file

@ -86,6 +86,12 @@ const routes = [
const pageToRedirectTo = await getPageToRouteExistingOrderTo(to);
// This logic may determine that the user should be sent to heritage -- if so, do that here.
if (pageToRedirectTo === fmgPageValues.HERITAGE) {
await navigateToHeritageFunnel({ shouldSaveSession: false });
return next(false);
}
// Assign our fmgPage so it will load normally like the other pages.
to.query.fmgPage = pageToRedirectTo;
}