diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 185d3d369..c9592c315 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -57,6 +57,7 @@ const storeActions = { GET_RECAL_PARTS_AND_SAVE_TO_LINE_ITEMS: "getRecalPartsAndSaveToLineItems", // DEPENDENCY MUTATIONS + RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleStateAndDependencies", RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies", RESET_REGISTRATION_STATE_AND_DEPENDENCIES: "resetRegistrationAndDependencies", RESET_PARTS_STATE_AND_DEPENDENCIES: "resetPartsAndDependencies", diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index f2799d7be..67bc9f961 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -110,7 +110,7 @@ {{ subtotalText }} {{ getLineItemAmount(subTotal, showCoverageAsPending) }} -
+
{{ salesTaxText }} {{ getLineItemAmount(salesTax) }}
@@ -318,6 +318,10 @@ export default { showCoverageAsVerified() { return this.showInsuranceCoverageAs === coverageStatus.VERIFIED; }, + showSalesTax() { + const tax = parseFloat(this.salesTax).toFixed(2); + return tax > 0; + }, currentDeductible() { const deductible = this.insuranceDeductible; if (!(deductible === 0 || deductible > 0)) { diff --git a/src/router/index.js b/src/router/index.js index 218e32d35..a3584b442 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,22 @@ 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.dispatch(storeActions.RESET_VEHICLE_STATE_AND_DEPENDENCIES); + store.dispatch(storeActions.SAVE_SERVICE_ZIP_CODE_INFO, { + state: null, + zipCode: null, + zipCodeCtu: null, + }); + store.dispatch(storeActions.SAVE_EMAIL, null); + store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); + } + const externalParameterYear = getQuerystringParameter(queryStrings.VEHICLE_YEAR); const externalParameterMake = getQuerystringParameter(queryStrings.VEHICLE_MAKE); const externalParameterModel = getQuerystringParameter(queryStrings.VEHICLE_MODEL); diff --git a/src/store/index.js b/src/store/index.js index ea025f1d4..ac69e4eb4 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1153,6 +1153,12 @@ export const actions = { }, // Dependency Actions + resetVehicleStateAndDependencies(context) { + context.commit(storeMutations.RESET_VEHICLE_STATE); + + context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); + }, + resetDamageAndDependencies(context) { context.commit(storeMutations.RESET_DAMAGE_STATE);