From 0411e3cd1f9306f07d7189e4f1dcfd87a9deff49 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 28 Jul 2023 13:26:20 -0400 Subject: [PATCH] CSR-1582 concept save quote links do not load --- .../heritage-integration/navigation-helper.js | 2 +- src/router/index.js | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 913fbcb1b..d90562791 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -98,7 +98,7 @@ export async function skipVinLookupNotRepair() { /* Logic for getting the last "valid" page a user visited. */ -async function getLatestPageForRedirection() { +export async function getLatestPageForRedirection() { // If this is a non-CTA navigation, determine where to send the user based on page prerequisites. // This also works if a user has a 'fmg' start_type query string but no current order. // That shouldn't happen, but it's possible. diff --git a/src/router/index.js b/src/router/index.js index 11efa6080..2f28e06d5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -19,6 +19,7 @@ import { loadSessionIfPresent, saveSession } from "@/helpers/heritage-integratio import { getPageToRouteExistingOrderTo, navigateToHeritageFunnel, + getLatestPageForRedirection, } from "@/helpers/heritage-integration/navigation-helper"; import baseMixin from "@/mixins/base-mixin"; @@ -124,8 +125,21 @@ const routes = [ .filter((x) => x.name === routeData[0].name)[0] .components.default(); + // The save quote link via heritage default.aspx... will land here. + // Heritage will attempt to send the customer to the lastest page in NextGen possible. + // If the link was created prior to reaching the end of NextGen, the save quote link + // was going to GoToFunnelStartOn404. This will send as deep into NextGen as possible. if (!arePagePrerequisitesValid(nextComponent)) { - await GoToFunnelStartOn404(next); + var pageToRedirectTo = await getLatestPageForRedirection(); + if (pageToRedirectTo) { + return next({ + path: "/", + query: { fmgPage: pageToRedirectTo }, + params: to.params, + }); + } else { + await GoToFunnelStartOn404(next); + } } // Assign current query string parameters, as well as our fmgPage one.