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.
This commit is contained in:
CarlNation 2024-10-31 08:31:08 -04:00
parent 9a3038c66c
commit c10780fc10

View file

@ -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);