From cef3a22bce6f05c59dd82efa03a066d0ce76119a Mon Sep 17 00:00:00 2001 From: hiteshkumar87 Date: Tue, 23 Jul 2024 17:51:29 +0530 Subject: [PATCH] CSR-2087 --- src/constants/query-strings.js | 2 +- src/constants/store-mutations.js | 2 +- src/layouts/quote/quote.spec.js | 2 +- src/layouts/quote/quote.vue | 6 ++-- .../service-package-question.vue | 8 ++--- src/router/index.js | 30 +++++++++++-------- src/store/index.js | 7 +++-- 7 files changed, 31 insertions(+), 26 deletions(-) diff --git a/src/constants/query-strings.js b/src/constants/query-strings.js index ca04c2937..a21d93200 100644 --- a/src/constants/query-strings.js +++ b/src/constants/query-strings.js @@ -34,7 +34,7 @@ const queryStrings = { EMAIL: "email", IS_INSURANCE: "isinsurance", VIN_SELECTION: "vinselection", - PACKAGE_SELECTION: "packageselection", + SERVICE_PACKAGE: "servicepackage", NUMBER_OF_CHIPS: "numberofchips", }; diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index d63d3369b..48700d530 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -101,7 +101,7 @@ const storeMutations = { UPDATE_LEAD_GEN_EMAIL_ADDRESS: "updateLeadGenEmailAddress", UPDATE_LEAD_GEN_IS_INSURANCE: "updateLeadGenIsInsurance", UPDATE_LEAD_GEN_VIN_SELECTION: "updateLeadGenVinSelection", - UPDATE_LEAD_GEN_PACKAGE_SELECTION: "updateLeadGenPackageSelection", + UPDATE_LEAD_GEN_SERVICE_PACKAGE: "updateLeadGenServicePackage", //RESET LEADGEN MUTATIONS RESET_LEADGEN_VEHICLE_STATE: "resetLeadGenVehicleState", diff --git a/src/layouts/quote/quote.spec.js b/src/layouts/quote/quote.spec.js index f6cb82858..a453b9c1a 100644 --- a/src/layouts/quote/quote.spec.js +++ b/src/layouts/quote/quote.spec.js @@ -674,7 +674,7 @@ describe("quote.vue", () => { isLeadGen: true, leadGenQuote: { isInsurance: true, - packageSelection: "glassonly", + servicePackage: "glassonly", }, payment: { isInsurance: true, diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index fbb924089..3eb513ba5 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -33,7 +33,7 @@ :isInsuranceSelected="isInsuranceSelected" @vapsItemsSelected="vapsItemsSelectedAction" @servicePackageDiscountSelected="servicePackageDiscountSelectedAction" - :packageSelection="packageSelection" + :servicePackage="servicePackage" :activePromos="lineItems.promos" v-on="{ 'buttonEvent.openModal': openModalAction }" validationRules="option-required" @@ -275,7 +275,7 @@ export default { if (store.getters.isLeadGen) { if (store.getters.leadGenQuote.isInsurance == true) { vm.isInsuranceSelected = true; - vm.packageSelection = store.getters.leadGenQuote.packageSelection; + vm.servicePackage = store.getters.leadGenQuote.servicePackage; await nextTick(); const isValid = await baseMixin.methods.isFormValid(vm.$refs.theForm); if (isValid) { @@ -300,7 +300,7 @@ export default { availableLineItems: null, lineItems: [], addableVaps: [], - packageSelection: null, + servicePackage: null, }; }, computed: { diff --git a/src/layouts/quote/service-package-question/service-package-question.vue b/src/layouts/quote/service-package-question/service-package-question.vue index e06733dd7..94cbb7685 100644 --- a/src/layouts/quote/service-package-question/service-package-question.vue +++ b/src/layouts/quote/service-package-question/service-package-question.vue @@ -48,7 +48,7 @@ export default { isInsuranceSelected: Boolean, availableLineItems: null, activePromos: null, - packageSelection: null, + servicePackage: null, }, data() { return { @@ -61,7 +61,7 @@ export default { if ( this.$store.getters.payment.isInsurance != null || getPromosWithAddableVaps(this.activePromos).length || - this.packageSelection != null + this.servicePackage != null ) { this.selectDefaultPackage(); } @@ -296,8 +296,8 @@ export default { return price; }, selectDefaultPackage() { - if (this.packageSelection != null) { - return (this.selectedPackageName = getPackageNameByType(this.packageSelection)); + if (this.servicePackage != null) { + return (this.selectedPackageName = getPackageNameByType(this.servicePackage)); } const promosWithAddableVaps = getPromosWithAddableVaps(this.activePromos); const vapsThatMatchPromos = getLineItemsThatMatchPromos( diff --git a/src/router/index.js b/src/router/index.js index e1546cbcc..94c3dbe9b 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -98,8 +98,8 @@ const routes = [ const leadGenVinSelection = getQuerystringParameter( queryStrings.VIN_SELECTION ); - const leadGenPackageSelection = getQuerystringParameter( - queryStrings.PACKAGE_SELECTION + const leadGenServicePackage = getQuerystringParameter( + queryStrings.SERVICE_PACKAGE ); const leadGenNumberOfChips = getQuerystringParameter( queryStrings.NUMBER_OF_CHIPS @@ -122,9 +122,11 @@ const routes = [ leadGenZipCode && leadGenEmail && leadGenIsInsurance && - leadGenVinSelection && - leadGenPackageSelection && - leadGenNumberOfChips + (leadGenDamage.toUpperCase() == "WINDSHIELDREPAIR" || + leadGenVinSelection?.length > 0) && + (leadGenIsInsurance == "false" || leadGenServicePackage?.length > 0) && + (leadGenDamage.toUpperCase() != "WINDSHIELDREPAIR" || + leadGenNumberOfChips?.length > 0) ) { if (!store.getters.applicationUser.triggeredSiteEntry) { store.commit(storeMutations.UPDATE_IS_LEAD_GEN, true); @@ -136,13 +138,13 @@ const routes = [ storeMutations.UPDATE_LEAD_GEN_DAMAGE_TYPE, leadGenDamage ); - if (leadGenDamage?.toUpperCase() == "WINDSHIELDREPLACE") { + if (leadGenDamage.toUpperCase() == "WINDSHIELDREPLACE") { store.commit(storeMutations.UPDATE_LEAD_GEN_IS_REPAIR, false); store.commit( storeMutations.UPDATE_LEAD_GEN_NUMBER_OF_CHIPS, null ); - } else if (leadGenDamage?.toUpperCase() == "WINDSHIELDREPAIR") { + } else if (leadGenDamage.toUpperCase() == "WINDSHIELDREPAIR") { store.commit(storeMutations.UPDATE_LEAD_GEN_IS_REPAIR, true); store.commit( storeMutations.UPDATE_LEAD_GEN_NUMBER_OF_CHIPS, @@ -160,14 +162,16 @@ const routes = [ if (leadGenIsInsurance == "true") { store.commit(storeMutations.UPDATE_LEAD_GEN_IS_INSURANCE, true); store.commit( - storeMutations.UPDATE_LEAD_GEN_PACKAGE_SELECTION, - leadGenPackageSelection + storeMutations.UPDATE_LEAD_GEN_SERVICE_PACKAGE, + leadGenServicePackage + ); + } + if (leadGenDamage.toUpperCase() != "WINDSHIELDREPAIR") { + store.commit( + storeMutations.UPDATE_LEAD_GEN_VIN_SELECTION, + leadGenVinSelection ); } - store.commit( - storeMutations.UPDATE_LEAD_GEN_VIN_SELECTION, - leadGenVinSelection - ); } } diff --git a/src/store/index.js b/src/store/index.js index fdfba35a1..486140a84 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -463,8 +463,8 @@ export const mutations = { leadGenState.estimate.vinSelection = vinSelection; setLeadGenState(leadGenState); }, - updateLeadGenPackageSelection(state, packageSelection) { - leadGenState.quote.packageSelection = packageSelection; + updateLeadGenServicePackage(state, servicePackage) { + leadGenState.quote.servicePackage = servicePackage; setLeadGenState(leadGenState); }, //RESET LEADGEN MUTATIONS @@ -493,6 +493,7 @@ export const mutations = { }, resetLeadGenQuoteState(state) { leadGenState.quote.isInsurance = null; + leadGenState.quote.servicePackage = null; setLeadGenState(leadGenState); }, resetIsLeadGen(state) { @@ -3322,7 +3323,7 @@ function createLeadGenDefaultState() { }, quote: { isInsurance: null, - packageSelection: null, + servicePackage: null, }, }; // set to session storage