diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index acb06c41d..6249db5e7 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -98,6 +98,7 @@ const storeActions = { RESET_SUBMITTED_ORDER: "resetSubmittedOrder", RESET_LEADGEN_STATE: "resetLeadGenState", CREATE_LEADGEN_STATE: "createLeadGenState", + UPDATE_LEADGEN_MMS: "updateLeadGenMMS", }; export { storeActions }; diff --git a/src/layouts/vehicle/vehicle.vue b/src/layouts/vehicle/vehicle.vue index f88caad42..b61aff026 100644 --- a/src/layouts/vehicle/vehicle.vue +++ b/src/layouts/vehicle/vehicle.vue @@ -217,6 +217,36 @@ export default { let resultMap = await settleAllPromises(promiseResultMap); + //Leadgen widget have different case style value so need to parse with NextGen + if (store.getters.isLeadGen) { + if ( + makeQuestionInitialDataPromise && + modelQuestionInitialDataPromise && + styleQuestionInitialDataPromise + ) { + const matchingMake = resultMap.makeQuestionInitialData?.filter( + (item) => item.toLowerCase() === store.getters.leadGenVehicle.make.toLowerCase() + ); + const matchingModel = resultMap.modelQuestionInitialData?.filter( + (item) => + item.toLowerCase() === store.getters.leadGenVehicle.model.toLowerCase() + ); + const matchingStyle = resultMap.styleQuestionInitialData?.filter( + (item) => + item.toLowerCase() === store.getters.leadGenVehicle.style.toLowerCase() + ); + baseMixin.methods.dispatchStoreAction( + storeActions.UPDATE_LEADGEN_MMS, + { + leadGenMake: matchingMake[0], + leadGenModel: matchingModel[0], + leadGenStyle: matchingStyle[0], + }, + false + ); + } + } + // Call the "next" function to complete the transition to this page. next(async (vm) => { vm.setCmsContent(resultMap.cmsContent); diff --git a/src/router/index.js b/src/router/index.js index 94c3dbe9b..f93b08ee6 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -128,50 +128,39 @@ const routes = [ (leadGenDamage.toUpperCase() != "WINDSHIELDREPAIR" || leadGenNumberOfChips?.length > 0) ) { - if (!store.getters.applicationUser.triggeredSiteEntry) { - store.commit(storeMutations.UPDATE_IS_LEAD_GEN, true); - store.commit(storeMutations.UPDATE_LEAD_GEN_YEAR, leadGenYear); - store.commit(storeMutations.UPDATE_LEAD_GEN_MAKE, leadGenMake); - store.commit(storeMutations.UPDATE_LEAD_GEN_MODEL, leadGenModel); - store.commit(storeMutations.UPDATE_LEAD_GEN_STYLE, leadGenStyle); + store.commit(storeMutations.UPDATE_IS_LEAD_GEN, true); + store.commit(storeMutations.UPDATE_LEAD_GEN_YEAR, leadGenYear); + store.commit(storeMutations.UPDATE_LEAD_GEN_MAKE, leadGenMake); + store.commit(storeMutations.UPDATE_LEAD_GEN_MODEL, leadGenModel); + store.commit(storeMutations.UPDATE_LEAD_GEN_STYLE, leadGenStyle); + store.commit(storeMutations.UPDATE_LEAD_GEN_DAMAGE_TYPE, leadGenDamage); + 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") { + store.commit(storeMutations.UPDATE_LEAD_GEN_IS_REPAIR, true); store.commit( - storeMutations.UPDATE_LEAD_GEN_DAMAGE_TYPE, - leadGenDamage + storeMutations.UPDATE_LEAD_GEN_NUMBER_OF_CHIPS, + leadGenNumberOfChips ); - 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") { - store.commit(storeMutations.UPDATE_LEAD_GEN_IS_REPAIR, true); - store.commit( - storeMutations.UPDATE_LEAD_GEN_NUMBER_OF_CHIPS, - leadGenNumberOfChips - ); - } + } + store.commit(storeMutations.UPDATE_LEAD_GEN_ZIP_CODE, leadGenZipCode); + store.commit( + storeMutations.UPDATE_LEAD_GEN_EMAIL_ADDRESS, + leadGenEmail + ); + if (leadGenIsInsurance == "true") { + store.commit(storeMutations.UPDATE_LEAD_GEN_IS_INSURANCE, true); store.commit( - storeMutations.UPDATE_LEAD_GEN_ZIP_CODE, - leadGenZipCode + storeMutations.UPDATE_LEAD_GEN_SERVICE_PACKAGE, + leadGenServicePackage ); + } + if (leadGenDamage.toUpperCase() != "WINDSHIELDREPAIR") { store.commit( - storeMutations.UPDATE_LEAD_GEN_EMAIL_ADDRESS, - leadGenEmail + storeMutations.UPDATE_LEAD_GEN_VIN_SELECTION, + leadGenVinSelection ); - if (leadGenIsInsurance == "true") { - store.commit(storeMutations.UPDATE_LEAD_GEN_IS_INSURANCE, true); - store.commit( - storeMutations.UPDATE_LEAD_GEN_SERVICE_PACKAGE, - leadGenServicePackage - ); - } - if (leadGenDamage.toUpperCase() != "WINDSHIELDREPAIR") { - store.commit( - storeMutations.UPDATE_LEAD_GEN_VIN_SELECTION, - leadGenVinSelection - ); - } } } diff --git a/src/store/index.js b/src/store/index.js index ecea6eed3..88c0eaa29 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -2812,6 +2812,11 @@ export const actions = { createLeadGenState(context) { createLeadGenDefaultState(); }, + updateLeadGenMMS(context, leadGenMMS) { + context.commit(storeMutations.UPDATE_LEAD_GEN_MAKE, leadGenMMS.leadGenMake); + context.commit(storeMutations.UPDATE_LEAD_GEN_MODEL, leadGenMMS.leadGenModel); + context.commit(storeMutations.UPDATE_LEAD_GEN_STYLE, leadGenMMS.leadGenStyle); + }, }; export default createStore({