diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 79ba0fce7..7b0dec762 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -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()) { diff --git a/src/router/index.js b/src/router/index.js index 63904343b..c5484be14 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -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; }