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

View file

@ -86,6 +86,12 @@ const routes = [
const pageToRedirectTo = await getPageToRouteExistingOrderTo(to); 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. // Assign our fmgPage so it will load normally like the other pages.
to.query.fmgPage = pageToRedirectTo; to.query.fmgPage = pageToRedirectTo;
} }