Leadgen widget have different case style value so need to parse with NextGen
This commit is contained in:
hiteshkumar87 2024-07-29 16:39:17 +05:30
parent 5cc484bacd
commit 5b79d9ed28
3 changed files with 36 additions and 0 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

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