Merge pull request #1923 from Safelite/feature/Digital/CSR-2087

CSR-2087
This commit is contained in:
hiteshkumar87 2024-07-29 17:01:42 +05:30 committed by GitHub
commit e4a3d40e60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 63 additions and 38 deletions

View file

@ -98,6 +98,7 @@ const storeActions = {
RESET_SUBMITTED_ORDER: "resetSubmittedOrder",
RESET_LEADGEN_STATE: "resetLeadGenState",
CREATE_LEADGEN_STATE: "createLeadGenState",
UPDATE_LEADGEN_MMS: "updateLeadGenMMS",
};
export { storeActions };

View file

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

View file

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

View file

@ -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({