From c10780fc1019f00ab57861653572a44be98f5b9a Mon Sep 17 00:00:00 2001 From: CarlNation Date: Thu, 31 Oct 2024 08:31:08 -0400 Subject: [PATCH] CSR-2299 multiple leadgen CSR-2299 if a customer uses browser back buttons to restart their leadgen session from the content site, the load session would prevent us from persisting any new data they may have changed on the LeadGen content site. So moved the updateExternalParams to after the load and then cleared any items that may need reset. --- src/router/index.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 218e32d35..243442c6c 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -97,8 +97,6 @@ const routes = [ ); updateOrCreateFunnelCookie(); } - //Update external parameter state - updateExternalParameterState(); //Affiliate Cookies const affiliateCookies = getAffiliateCookies(); @@ -115,12 +113,14 @@ const routes = [ to.query.fmgPage ); + //Update external parameter state + updateExternalParameterState(); + // clear part related state because heritage selected a new vehicle if ( to.query.fmgPage === fmgPageValues.VEHICLE && eval(getFunnelCookie()?.HasDelayedClaimRegistration) ) { - console.log(new Date() + "Router: Policy Vehicle Changed"); store.commit(storeMutations.RESET_GLASS_PARTS_STATE); } @@ -634,6 +634,24 @@ function getRedirectedStartPage() { } function updateExternalParameterState() { + // if there is an existing external parameter state then they have already been through from an external source(LeadGen) and + // are returning. clear out prior related things that need to be selected again like parts and damage type. + if ( + store.getters.externalParameterState?.isExternalParameter == + externalParameterStatus.INACTIVE + ) { + store.commit(storeMutations.RESET_VEHICLE_STATE); + store.commit(storeMutations.UPDATE_SERVICE_ZIP, { + state: null, + zipCode: null, + zipCodeCtu: null, + }); + store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, null); + store.commit(storeMutations.UPDATE_NUMBER_OF_CHIPS, null); + store.commit(storeMutations.RESET_DAMAGE_STATE); + store.commit(storeMutations.RESET_GLASS_PARTS_STATE); + } + const externalParameterYear = getQuerystringParameter(queryStrings.VEHICLE_YEAR); const externalParameterMake = getQuerystringParameter(queryStrings.VEHICLE_MAKE); const externalParameterModel = getQuerystringParameter(queryStrings.VEHICLE_MODEL);