Merge pull request #684 from Safelite/rlsmerge/develop-to-quote-page-mvp

Rlsmerge/develop to quote page mvp
This commit is contained in:
katieoh-safelite 2022-08-22 09:35:40 -04:00 committed by GitHub
commit 250b93bca9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 194 additions and 219 deletions

View file

@ -192,7 +192,7 @@ describe("address-lookup.vue", () => {
await wrapper.vm.backButtonAction();
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled();
});
@ -285,7 +285,7 @@ describe("address-lookup.vue", () => {
await wrapper.vm.forwardButtonAction();
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.CONTINUING_WITH_MULTIPLE_VEHICLES, undefined, {}, {}, carsFound);
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.CONTINUING_WITH_MULTIPLE_VEHICLES, undefined, {}, {}, carsFound);
});
test("if the car entered matches one of the vehicles found but the zip is NOT serviceable, do not navigate forward", async () => {
@ -365,7 +365,7 @@ describe("address-lookup.vue", () => {
await wrapper.vm.navigateForward(carsFound);
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, undefined, {}, { "displayVehicleChangeAlert": true });
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, undefined, {}, { "displayVehicleChangeAlert": true });
});
@ -626,7 +626,9 @@ function setupMocks({ isZipValid = true, isZipServiceable = true, lookupVinbyAdd
],
router: {
navigate: jest.fn(),
navigate: jest.fn()
navigate: jest.fn(),
navigateWithSaving: jest.fn(),
navigateWithoutSaving: jest.fn(),
},
store: {
getters: {

View file

@ -140,7 +140,7 @@ export default {
},
backButtonAction() {
// route to move backwards
this.$router.navigate(
this.$router.navigateWithoutSaving(
this.navigationScenarios.CLICKED_BACK,
this.$route
);
@ -309,11 +309,11 @@ export default {
// If a different vehicle is found than the one entered and the selected glass is not available for that vehicle then navigate back to "vehicle-damage"
// display vehicle changed alert on that page.
if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle && matchingCars.length === 1) {
this.$router.navigate(this.navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, this.$route, {}, {[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true});
this.$router.navigateWithSaving(this.navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, this.$route, {}, {[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true});
} else if (matchingCars.length === 1) {
await this.navigateForwardWithSingleCarMatch();
} else {
this.$router.navigate(this.navigationScenarios.CONTINUING_WITH_MULTIPLE_VEHICLES, this.$route, {}, {}, carsFound);
this.$router.navigateWithSaving(this.navigationScenarios.CONTINUING_WITH_MULTIPLE_VEHICLES, this.$route, {}, {}, carsFound);
}
},

View file

@ -53,7 +53,7 @@ describe("addressVehicles.vue", () => {
test("Should navigate to CLICKED_BACK if backButtonAction is run", async () => {
// Arrange
const { wrapper } = setupMocks({});
wrapper.vm.$router.navigate = jest.fn();
wrapper.vm.$router.navigateWithoutSaving = jest.fn();
// Act
await wrapper.setData({
@ -62,7 +62,7 @@ describe("addressVehicles.vue", () => {
wrapper.vm.backButtonAction();
//Assert
expect(wrapper.vm.$router.navigate).toBeCalled();
expect(wrapper.vm.$router.navigateWithoutSaving).toBeCalled();
wrapper.unmount();
});
@ -111,7 +111,7 @@ describe("addressVehicles.vue", () => {
wrapper.vm.$refs.funnelFooter.updateButtonText = jest.fn();
wrapper.vm.$refs.funnelFooter.removeLoader = jest.fn();
wrapper.vm.lookupVin = jest.fn(() => Promise.reject(lookupVinResponse));
wrapper.vm.$router.navigate = jest.fn();
wrapper.vm.$router.navigateWithSaving = jest.fn();
wrapper.vm.updateCustomerInfo = jest.fn().mockImplementation(()=> {});
// Act
@ -131,7 +131,7 @@ describe("addressVehicles.vue", () => {
// Arrange
const { wrapper } = setupMocks({});
wrapper.vm.$refs.funnelFooter.updateButtonText = jest.fn();
wrapper.vm.$router.navigate = jest.fn();
wrapper.vm.$router.navigateWithSaving = jest.fn();
// Act
await wrapper.setData({
@ -142,7 +142,7 @@ describe("addressVehicles.vue", () => {
await wrapper.vm.navigateForward();
//Assert
expect(wrapper.vm.$router.navigate).toBeCalledTimes(1);
expect(wrapper.vm.$router.navigateWithSaving).toBeCalledTimes(1);
wrapper.unmount();
});

View file

@ -162,7 +162,7 @@ export default {
return false;
},
backButtonAction() {
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
},
async forwardButtonAction() {
@ -184,7 +184,7 @@ export default {
},
async navigateForward() {
if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) {
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD,this.$route,{},{[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true },);
this.$router.navigateWithSaving(this.navigationScenarios.CLICKED_FORWARD,this.$route,{},{[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true },);
} else {
await this.navigateForwardWithSingleCarMatch();
}

View file

@ -76,7 +76,7 @@ describe("estimate.vue", () => {
expect(arePagePrerequisitesValid).toBe(false);
});
test("After selecting provide my home address on ForwardButtonAction triggers a router.navigate", async () => {
test("After selecting provide my home address on ForwardButtonAction triggers a router.navigateWithSaving", async () => {
//Arrange
const { wrapper } = setupMocks({});
@ -88,11 +88,11 @@ describe("estimate.vue", () => {
wrapper.vm.forwardButtonAction();
//Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
});
test("After selecting provide my manual vin on ForwardButtonAction triggers a router.navigate", async () => {
test("After selecting provide my manual vin on ForwardButtonAction triggers a router.navigateWithSaving", async () => {
//Arrange
const { wrapper } = setupMocks({});
@ -104,11 +104,11 @@ describe("estimate.vue", () => {
await wrapper.vm.forwardButtonAction();
//Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
});
test("BackButtonAction triggers a router.navigate change", async () => {
test("BackButtonAction triggers a router.navigateWithoutSaving change", async () => {
//Arrange
const { wrapper } = setupMocks({});
@ -124,10 +124,10 @@ describe("estimate.vue", () => {
wrapper.vm.backButtonAction();
//Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled();
});
test("Provide my license plate on ForwardButtonAction triggers a router.navigate", async () => {
test("Provide my license plate on ForwardButtonAction triggers a router.navigateWithSaving", async () => {
//Arrange
const { wrapper } = setupMocks({});
@ -139,7 +139,7 @@ describe("estimate.vue", () => {
wrapper.vm.forwardButtonAction();
//Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
});
@ -152,6 +152,8 @@ function setupMocks({
mountOptionsMockData = {
router: {
navigate: jest.fn(),
navigateWithSaving: jest.fn(),
navigateWithoutSaving: jest.fn(),
},
},
}) {

View file

@ -87,7 +87,7 @@ export default {
},
backButtonAction() {
// route to move backwards
this.$router.navigate(
this.$router.navigateWithoutSaving(
this.navigationScenarios.CLICKED_BACK,
this.$route
);
@ -95,19 +95,19 @@ export default {
async forwardButtonAction() {
if (this.selectedVinLookupMethod === vinLookupMethodSelections.MANUALVIN) {
await this.dispatchStoreAction(storeActions.CLEAR_VIN);
return this.$router.navigate(
return this.$router.navigateWithSaving(
this.navigationScenarios.SELECTED_MANUAL_VIN,
this.$route
);
}
if (this.selectedVinLookupMethod === vinLookupMethodSelections.LICENSEPLATE) {
return this.$router.navigate(
return this.$router.navigateWithSaving(
this.navigationScenarios.SELECTED_LICENSE_PLATE,
this.$route
);
}
if (this.selectedVinLookupMethod === vinLookupMethodSelections.HOMEADDRESS) {
return this.$router.navigate(
return this.$router.navigateWithSaving(
this.navigationScenarios.SELECTED_HOME_ADDRESS,
this.$route
);

View file

@ -87,7 +87,7 @@ describe("license-plate-lookup.vue", () => {
});
describe("navigation", () => {
test("BackButtonAction triggers a router.navigate change", async () => {
test("BackButtonAction triggers a router.navigateWithoutSaving change", async () => {
//Arrange
const { wrapper } = setupMocks({});
@ -103,7 +103,7 @@ describe("license-plate-lookup.vue", () => {
wrapper.vm.backButtonAction();
//Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled();
});
describe("on forwardButtonAction click", () => {
@ -212,7 +212,7 @@ describe("license-plate-lookup.vue", () => {
});
describe("navigateForward", () => {
test("navigate should be called if isCarIdDifferent is true and isSelectedGlassAvailableForVehicle is false when navigateForward is called", async () => {
test("navigateWithSaving should be called if isCarIdDifferent is true and isSelectedGlassAvailableForVehicle is false when navigateForward is called", async () => {
// Arrange
const { wrapper } = setupMocks({});
@ -232,7 +232,7 @@ describe("license-plate-lookup.vue", () => {
await wrapper.vm.navigateForward();
//Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
});
test("navigateForwardWithSingleCarMatch should be called if isCarIdDifferent is false or isSelectedGlassAvailableForVehicle is true when navigateForward is called", async () => {
@ -549,6 +549,8 @@ function setupMocks({
...mountOptionsMockData,
router: {
navigate: jest.fn(),
navigateWithoutSaving: jest.fn(),
navigateWithSaving: jest.fn()
},
store: {
getters: {

View file

@ -177,7 +177,7 @@ export default {
},
backButtonAction() {
// route to move backwards
this.$router.navigate(
this.$router.navigateWithoutSaving(
this.navigationScenarios.CLICKED_BACK,
this.$route
);
@ -298,7 +298,7 @@ export default {
},
async navigateForward() {
if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) {
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, { [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true });
this.$router.navigateWithSaving(this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, { [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true });
} else {
await this.navigateForwardWithSingleCarMatch();
}

View file

@ -125,7 +125,7 @@ export default {
},
backButtonAction() {
// route to move backwards
this.$router.navigate(
this.$router.navigateWithoutSaving(
this.navigationScenarios.CLICKED_BACK,
this.$route
);
@ -156,7 +156,7 @@ export default {
if (hasCapabilityQuestions) {
// if has capability questions
// go to capability-questions page
this.$router.navigate(this.navigationScenarios.HAS_CAPABILITY_QUESTIONS,this.$route,{},{},{partsOrQuestions: glassNameAndPartsForStore});
this.$router.navigateWithSaving(this.navigationScenarios.HAS_CAPABILITY_QUESTIONS,this.$route,{},{},{partsOrQuestions: glassNameAndPartsForStore});
} else {
// if single parts only
const collectedGlassParts = this.reducedGlassPartsArray(glassNameAndPartsForStore);

View file

@ -207,9 +207,7 @@ export default {
const thisAnsweredPartQuestion = glassPart.partQuestions[pqIndex];
// remove answerData from this glass part
// delete glassPart.answerData;
glassPart.answerData = null;
// delete glassPart.isSuppressedPart;
glassPart.isSuppressedPart = null;
// Update the key to re-render this part's question-chain component
@ -440,55 +438,6 @@ export default {
return part;
});
// this block is purely for handling duplicate questions
alreadyAnsweredQuestions?.forEach((savedPart, partIndex) => {
savedPart.answeredQuestions.forEach((aq) => {
if (aq.isDuplicateQuestion) {
// find this one in partsQuestionData
const dupedPartsQuestion = this.partsQuestionsData[partIndex].partQuestions[aq.questionNum - 1];
dupedPartsQuestion.suppressDuplicateQuestion = true;
const dupedPartsQuestionAnswer = dupedPartsQuestion.answers.filter((ans) => {
return ans.answerText.toUpperCase() === aq.selectedAnswerText.toUpperCase();
})[0];
let isDupedPartsQuestionFirst;
if (aq.questionNum === 1) { isDupedPartsQuestionFirst = true }
this.partsQuestionsData.forEach((glassPart, i) => {
// loop through this glass part's part questions, looking for a questionText match
glassPart.partQuestions.forEach((pq, pqIndex) => {
// if this dupedQ is the first in the array then
// suppress all questions for this part up until the answer's nextQuestionSequence
if (isDupedPartsQuestionFirst &&
dupedPartsQuestionAnswer.nextQuestionSequence &&
pq.questionSequence < dupedPartsQuestionAnswer.nextQuestionSequence) {
pq.suppressDuplicateQuestion = true;
}
pq.answers.forEach((thisAns) => {
if (thisAns.nextQuestionSequence === aq.questionNum) {
// update either the nextQuestionSequence or the answerResult
if (dupedPartsQuestionAnswer.nextQuestionSequence) {
thisAns.originalNextQuestionSequence = thisAns.nextQuestionSequence;
thisAns.nextQuestionSequence = dupedPartsQuestionAnswer.nextQuestionSequence;
// update this change to answerSelected
pq.answerSelected = `${pq.questionSequence}|nextQuestion|${thisAns.nextQuestionSequence}|${thisAns.answerText}`;
} else {
thisAns.originalNextQuestionSequence = thisAns.nextQuestionSequence;
thisAns.nextQuestionSequence = null;
thisAns.originalAnswerResult = thisAns.originalAnswerResult || thisAns.answerResult;
thisAns.answerResult = dupedPartsQuestionAnswer.answerResult;
}
}
})
});
});
}
})
});
},
},
components: {

View file

@ -40,7 +40,7 @@ export default {
methods: {
backButtonAction() {
// route to move backwards
this.$router.navigate(
this.$router.navigateWithoutSaving(
this.navigationScenarios.CLICKED_BACK,
this.$route
);

View file

@ -57,7 +57,7 @@ jest.mock("@/store", () => ({
describe("vehicle-damage.vue", () => {
describe("navigation", () => {
test("BackButtonAction triggers a router.navigate change", async () => {
test("BackButtonAction triggers a router.navigateWithoutSaving change", async () => {
//Arrange
const { wrapper } = setupMocks({});
@ -73,7 +73,7 @@ describe("vehicle-damage.vue", () => {
wrapper.vm.backButtonAction();
//Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled();
});
@ -118,7 +118,7 @@ describe("vehicle-damage.vue", () => {
const { wrapper } = setupMocks({
pageHeaderWidgetHeaderText: "",
mountOptionsMockData: {
router: { navigate: jest.fn(), },
router: { navigate: jest.fn(), navigateWithSaving: jest.fn(), },
actionList: [{ actionName: storeActions.GET_PARTS_OR_QUESTIONS, data: partsData, },],
store: {
getters: {
@ -158,7 +158,7 @@ describe("vehicle-damage.vue", () => {
await wrapper.vm.forwardButtonAction();
//Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith(storeActions.GET_DAMAGE_OPTIONS, {"carId": "C00000000"});
});
@ -217,7 +217,7 @@ describe("vehicle-damage.vue", () => {
const { wrapper } = setupMocks({
pageHeaderWidgetHeaderText: "",
mountOptionsMockData: {
router: { navigate: jest.fn(), },
router: { navigate: jest.fn(), navigateWithSaving: jest.fn(), },
actionList: [{ actionName: storeActions.GET_PARTS_OR_QUESTIONS, data: partsData, },],
store: {
getters: {
@ -248,7 +248,7 @@ describe("vehicle-damage.vue", () => {
await wrapper.vm.forwardButtonAction();
//Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
expect(baseMixin.methods.dispatchStoreAction).toBeCalledWith(storeActions.GET_DAMAGE_OPTIONS, {"carId": "C00000000"});
});
@ -690,6 +690,8 @@ function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCo
var mountOptionsMockDataDefault = {
router: {
navigate: jest.fn(),
navigateWithoutSaving: jest.fn(),
navigateWithSaving: jest.fn(),
},
route: {
params: {

View file

@ -170,7 +170,7 @@ export default {
backButtonAction() {
// route to move backwards
this.$router.navigate(
this.$router.navigateWithoutSaving(
this.navigationScenarios.CLICKED_BACK,
this.$route
);
@ -293,10 +293,10 @@ export default {
// If vin already exists, navigate directly to vin-lookup
if(store.getters.vehicle.vin) {
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_VIN, this.$route);
this.$router.navigateWithSaving(this.navigationScenarios.CLICKED_FORWARD_WITH_VIN, this.$route);
}
else {
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN, this.$route);
this.$router.navigateWithSaving(this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN, this.$route);
}
},

View file

@ -58,13 +58,14 @@ describe("vehicle-make.vue", () => {
});
describe("vehicle-make.vue", () => {
test("BackButtonAction triggers a router.navigate change", async (done) => {
test("BackButtonAction triggers a router.navigateWithoutSaving change", async (done) => {
//Arrange
const { wrapper, apiPromise } = setupMocks({
pageHeaderWidgetHeaderText: "Select a make to get started",
mountOptionsMockData: {
router: {
navigate: jest.fn(),
navigateWithoutSaving: jest.fn(),
},
},
});
@ -81,7 +82,7 @@ describe("vehicle-make.vue", () => {
//Assert
apiPromise.finally(() => {
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled();
done();
});
});

View file

@ -70,7 +70,7 @@ export default {
methods: {
backButtonAction() {
// route to move backwards
this.$router.navigate(
this.$router.navigateWithoutSaving(
this.navigationScenarios.CLICKED_BACK,
this.$route
);
@ -86,7 +86,7 @@ export default {
watch: {
selectedMake(make) {
this.dispatchStoreAction(storeActions.SAVE_VEHICLE_MAKE, make, false);
this.$router.navigate(
this.$router.navigateWithSaving(
this.navigationScenarios.SELECTED_MAKE,
this.$route
);

View file

@ -56,13 +56,14 @@ describe("vehicle-model.vue", () => {
});
describe("vehicle-model.vue", () => {
test("BackButtonAction triggers a router.navigate change", async (done) => {
test("BackButtonAction triggers a router.navigateWithoutSaving change", async (done) => {
//Arrange
const { wrapper, apiPromise } = setupMocks({
pageHeaderWidgetHeaderText: "Select a model to get started",
mountOptionsMockData: {
router: {
navigate: jest.fn(),
navigateWithoutSaving: jest.fn()
},
},
});
@ -77,7 +78,7 @@ describe("vehicle-model.vue", () => {
await nextTick();
//Assert
apiPromise.finally(() => {
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled();
done();
});
});

View file

@ -71,7 +71,7 @@ export default {
methods: {
backButtonAction() {
// route to move backwards
this.$router.navigate(
this.$router.navigateWithoutSaving(
this.navigationScenarios.CLICKED_BACK,
this.$route
);
@ -87,7 +87,7 @@ export default {
watch: {
selectedModel(model) {
this.dispatchStoreAction(storeActions.SAVE_VEHICLE_MODEL, model, false);
this.$router.navigate(
this.$router.navigateWithSaving(
this.navigationScenarios.SELECTED_MODEL,
this.$route
);

View file

@ -78,7 +78,9 @@ describe("vehicle-parts.vue", () => {
{
mountOptionsMockData: {
router: {
navigate: jest.fn()
navigate: jest.fn(),
navigateWithSaving: jest.fn(),
navigateWithoutSaving: jest.fn(),
},
route: {
query: {
@ -116,7 +118,9 @@ describe("vehicle-parts.vue", () => {
const { wrapper } = setupMocks({
mountOptionsMockData: {
router: {
navigate: jest.fn()
navigate: jest.fn(),
navigateWithSaving: jest.fn(),
navigateWithoutSaving: jest.fn(),
},
route: {
query: {
@ -153,7 +157,9 @@ describe("vehicle-parts.vue", () => {
const { wrapper } = setupMocks({
mountOptionsMockData: {
router: {
navigate: jest.fn()
navigate: jest.fn(),
navigateWithSaving: jest.fn(),
navigateWithoutSaving: jest.fn(),
},
route: {
query: {
@ -180,13 +186,15 @@ describe("vehicle-parts.vue", () => {
expect(wrapper.vm.glassParts).toEqual({ "Rear-Stationary": { "Rear": ['DB12209YPYNOEM'] } });
});
test("User had part questions > BackButtonAction triggers a router.navigate change with correct scenario", async () => {
test("User had part questions > BackButtonAction triggers a router.navigateWithoutSaving change with correct scenario", async () => {
//Arrange
const { wrapper } = setupMocks({
mountOptionsMockData: {
router: {
navigate: jest.fn(),
navigate: jest.fn()
navigate: jest.fn(),
navigateWithSaving: jest.fn(),
navigateWithoutSaving: jest.fn(),
},
route: {
query: {
@ -228,17 +236,19 @@ describe("vehicle-parts.vue", () => {
wrapper.vm.backButtonAction();
//Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_TO_GO_TO_PART_QUESTIONS, wrapper.vm.$route);
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_TO_GO_TO_PART_QUESTIONS, wrapper.vm.$route);
});
test("User did not have part questions > BackButtonAction triggers a router.navigate change with correct scenario", async () => {
test("User did not have part questions > BackButtonAction triggers a router.navigateWithoutSaving change with correct scenario", async () => {
//Arrange
const { wrapper } = setupMocks({
mountOptionsMockData: {
router: {
navigate: jest.fn(),
navigate: jest.fn()
navigate: jest.fn(),
navigateWithSaving: jest.fn(),
navigateWithoutSaving: jest.fn(),
},
route: {
query: {
@ -267,11 +277,11 @@ describe("vehicle-parts.vue", () => {
wrapper.vm.backButtonAction();
//Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_TO_GO_TO_VIN_LOOKUP, wrapper.vm.$route);
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_TO_GO_TO_VIN_LOOKUP, wrapper.vm.$route);
});
test("ForwardButtonAction triggers a router.navigate change if there are child part questions", async () => {
test("ForwardButtonAction triggers a router.navigateWithSaving change if there are child part questions", async () => {
//Arrange
store.getters.pageData.mockReturnValueOnce({
@ -317,7 +327,9 @@ describe("vehicle-parts.vue", () => {
const { wrapper } = setupMocks({
mountOptionsMockData: {
router: {
navigate: jest.fn()
navigate: jest.fn(),
navigateWithSaving: jest.fn(),
navigateWithoutSaving: jest.fn(),
},
route: {
query: {
@ -344,10 +356,10 @@ describe("vehicle-parts.vue", () => {
await wrapper.vm.forwardButtonAction();
//Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
});
test("ForwardButtonAction triggers a router.navigate change if there are capability questions", async () => {
test("ForwardButtonAction triggers a router.navigateWithSaving change if there are capability questions", async () => {
//Arrange
store.getters.pageData.mockReturnValueOnce({
@ -375,7 +387,9 @@ describe("vehicle-parts.vue", () => {
const { wrapper } = setupMocks({
mountOptionsMockData: {
router: {
navigate: jest.fn()
navigate: jest.fn(),
navigateWithSaving: jest.fn(),
navigateWithoutSaving: jest.fn(),
},
route: {
query: {
@ -408,7 +422,7 @@ describe("vehicle-parts.vue", () => {
await wrapper.vm.forwardButtonAction();
//Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
});
test("ForwardButtonAction saves selected parts to store if no molding or capability questions", async () => {
@ -421,7 +435,9 @@ describe("vehicle-parts.vue", () => {
const { wrapper } = setupMocks({
mountOptionsMockData: {
router: {
navigate: jest.fn()
navigate: jest.fn(),
navigateWithSaving: jest.fn(),
navigateWithoutSaving: jest.fn(),
},
route: {
query: {

View file

@ -66,13 +66,15 @@ describe("vehicle-style.vue", () => {
});
describe("vehicle-style.vue", () => {
test("BackButtonAction triggers a router.navigate change", async (done) => {
test("BackButtonAction triggers a router.navigateWithoutSaving change", async (done) => {
//Arrange
const { wrapper, apiPromise } = setupMocks({
pageHeaderWidgetHeaderText: "Select a style to get started",
mountOptionsMockData: {
router: {
navigate: jest.fn(),
navigateWithSaving: jest.fn(),
navigateWithoutSaving: jest.fn(),
},
},
});
@ -89,7 +91,7 @@ describe("vehicle-style.vue", () => {
//Assert
apiPromise.finally(() => {
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalled();
done();
});
});

View file

@ -87,7 +87,7 @@ export default {
});
//emulate selecting the vehicle style
router.overrideNavigation(navigationScenarios.SELECTED_STYLE, to, next);
router.overrideNavigation(navigationScenarios.SELECTED_STYLE, to, next, true);
} else{
next( (vm) => {
@ -100,7 +100,7 @@ export default {
methods: {
backButtonAction() {
// route to move backwards
this.$router.navigate(
this.$router.navigateWithoutSaving(
this.navigationScenarios.CLICKED_BACK,
this.$route
);
@ -128,7 +128,7 @@ export default {
selectedStyle(style) {
this.dispatchStoreAction(storeActions.SAVE_VEHICLE_STYLE, style, false);
this.setVehicle().then(() => {
this.$router.navigate(
this.$router.navigateWithSaving(
this.navigationScenarios.SELECTED_STYLE,
this.$route
);

View file

@ -90,7 +90,7 @@ export default {
selectedYear(year) {
const parsedYear = parseInt(year);
this.dispatchStoreAction(storeActions.SAVE_VEHICLE_YEAR, parsedYear);
this.$router.navigate(
this.$router.navigateWithSaving(
this.navigationScenarios.SELECTED_YEAR,
this.$route
);

View file

@ -155,7 +155,7 @@ describe("vin-lookup.vue", () => {
const { wrapper } = setupMocks({
customMountOptions: {
router: {
navigate: jest.fn()
navigateWithSaving: jest.fn()
}
}
});
@ -169,8 +169,8 @@ describe("vin-lookup.vue", () => {
await wrapper.vm.navigateForward();
//Assert
expect(wrapper.vm.$router.navigate).toBeCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, wrapper.vm.$route, expect.anything(), expect.anything());
expect(wrapper.vm.$router.navigateWithSaving).toBeCalledTimes(1);
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, wrapper.vm.$route, expect.anything(), expect.anything());
})
test("carId matches => navigateForwardWithSingleCarMatch", async () => {

View file

@ -211,10 +211,10 @@ export default {
},
backButtonAction() {
if (this.$store.getters.vehicle.vin) {
this.$router.navigate(this.navigationScenarios.CLICKED_BACK_WITH_VIN, this.$route);
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK_WITH_VIN, this.$route);
}
else {
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
}
},
@ -330,12 +330,11 @@ export default {
return this.$refs.funnelFooter.removeLoader();
},
async navigateForward(){
this.$router.navigate(this.navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, this.$route, {}, {});
if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) {
this.$router.navigate(this.navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, this.$route, {}, { [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true });
} else {
await this.navigateForwardWithSingleCarMatch();
}
if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) {
this.$router.navigateWithSaving(this.navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, this.$route, {}, { [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true });
} else {
await this.navigateForwardWithSingleCarMatch();
}
},
},
mounted() {

View file

@ -75,16 +75,16 @@ export default {
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
if (hasPartQuestions && this.currentPageComesBeforePage(currentPage, fmgPageValues.PART_QUESTIONS)) {
self.$router.navigate(self.navigationScenarios.HAS_PART_QUESTIONS, self.$route, {}, {}, {partsOrQuestions: partsOrQuestions});
self.$router.navigateWithSaving(self.navigationScenarios.HAS_PART_QUESTIONS, self.$route, {}, {}, {partsOrQuestions: partsOrQuestions});
}
else if (hasGlassLocationWithMultipleParts && this.currentPageComesBeforePage(currentPage, fmgPageValues.VEHICLE_PARTS)) {
// if multiple parts on any glass
// go to vehicle-parts page and pass the partsData
self.$router.navigate(self.navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE,self.$route,{},{},{partsOrQuestions: partsOrQuestions});
self.$router.navigateWithSaving(self.navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE,self.$route,{},{},{partsOrQuestions: partsOrQuestions});
} else if (hasChildPartQuestions && this.currentPageComesBeforePage(currentPage, fmgPageValues.MOLDING_QUESTIONS)) {
// if any childpart questions
// go to molding-questions page and pass the partsData
self.$router.navigate(self.navigationScenarios.HAS_MOLDING_QUESTIONS,self.$route,{},{},{partsOrQuestions: partsOrQuestions});
self.$router.navigateWithSaving(self.navigationScenarios.HAS_MOLDING_QUESTIONS,self.$route,{},{},{partsOrQuestions: partsOrQuestions});
} else if (hasCapabilityQuestions && this.currentPageComesBeforePage(currentPage, fmgPageValues.CAPABILITY_QUESTIONS)) {
// if has capability questions
// go to capability-questions page and pass the partsData
@ -103,7 +103,7 @@ export default {
})
});
self.$router.navigate(self.navigationScenarios.HAS_CAPABILITY_QUESTIONS, self.$route, {}, {}, { partsOrQuestions, capabilityQuestions });
self.$router.navigateWithSaving(self.navigationScenarios.HAS_CAPABILITY_QUESTIONS, self.$route, {}, {}, { partsOrQuestions, capabilityQuestions });
} else {
// if single parts only
const collectedGlassParts = this.reducedGlassPartsArray(partsOrQuestions);
@ -114,7 +114,7 @@ export default {
navigateToHeritageFunnel();
// For quote pages MVP release
// self.$router.navigate(self.navigationScenarios.ANSWERED_ALL_QUESTIONS, self.$route);
// self.$router.navigate(self.navigationScenarios.HAS_NO_MORE_QUESTIONS, self.$route);
}
},
backButtonAction() {
@ -139,7 +139,7 @@ export default {
backNavigationScenario = navigationScenarios.CLICKED_BACK_TO_GO_TO_PART_QUESTIONS;
}
this.$router.navigate(
this.$router.navigateWithoutSaving(
backNavigationScenario,
this.$route
);

View file

@ -192,8 +192,8 @@ describe("vehicle-questions-mixin", () => {
await wrapper.vm.navigateForward(partsOrQuestions);
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions });
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_PART_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions });
});
test("multiple glass locations have part questions => go to parts-questions", async () => {
@ -300,8 +300,8 @@ describe("vehicle-questions-mixin", () => {
await wrapper.vm.navigateForward(partsOrQuestions);
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions });
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_PART_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions });
});
test("multiple glass locations selected, one has part question => go to parts-questions", async () => {
@ -400,8 +400,8 @@ describe("vehicle-questions-mixin", () => {
await wrapper.vm.navigateForward(partsOrQuestions);
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions });
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_PART_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions });
});
test("a selected glass location has part questions and multiple parts => go to parts-questions", async () => {
@ -548,8 +548,8 @@ describe("vehicle-questions-mixin", () => {
await wrapper.vm.navigateForward(partsOrQuestions);
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions });
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_PART_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions });
});
});
@ -590,8 +590,8 @@ describe("vehicle-questions-mixin", () => {
await wrapper.vm.navigateForward(partsOrQuestions);
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS, wrapper.vm.$route, {}, {}, { partsOrQuestions });
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, wrapper.vm.$route, {}, {}, { partsOrQuestions });
});
test("multiple glass locations selected, one of them has multiple parts => go to vehicle parts", async () => {
@ -696,8 +696,8 @@ describe("vehicle-questions-mixin", () => {
await wrapper.vm.navigateForward(partsOrQuestions);
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS, wrapper.vm.$route, {}, {}, { partsOrQuestions });
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, wrapper.vm.$route, {}, {}, { partsOrQuestions });
});
test("multiple glass locations selected, multiple have multiple parts => go to vehicle-parts", async () => {
@ -868,8 +868,8 @@ describe("vehicle-questions-mixin", () => {
await wrapper.vm.navigateForward(partsOrQuestions);
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS, wrapper.vm.$route, {}, {}, { partsOrQuestions });
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, wrapper.vm.$route, {}, {}, { partsOrQuestions });
});
});
@ -921,8 +921,8 @@ describe("vehicle-questions-mixin", () => {
await wrapper.vm.navigateForward(partsOrQuestions);
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_WITH_MOLDING_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions });
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_MOLDING_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions });
});
});
@ -956,8 +956,8 @@ describe("vehicle-questions-mixin", () => {
await wrapper.vm.navigateForward(partsOrQuestions);
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(navigationScenarios.SELECTED_VIN_WITH_CAPABILITY_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions, capabilityQuestions: [] });
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(navigationScenarios.HAS_CAPABILITY_QUESTIONS, wrapper.vm.$route, {}, {}, { partsOrQuestions, capabilityQuestions: [] });
});
});
@ -1117,7 +1117,7 @@ function setupMocks({ fmgPage = fmgPageValues.VIN_LOOKUP }) {
const mocks = getMountOptions({
router: {
navigate: jest.fn()
navigate: jest.fn(), navigateWithSaving: jest.fn(), navigateWithSaving: jest.fn()
},
store: {
commit: jest.fn(),

View file

@ -41,7 +41,14 @@ function setupMocks({ partsOrQuestions = [] }) {
],
});
const mocks = getMountOptions({});
const mocks = getMountOptions({
router: {
navigate: jest.fn(), navigateWithSaving: jest.fn(), navigateWithoutSaving: jest.fn(),
},
store: {
commit: jest.fn()
}
});
const mockVinComponent = {
components: { loadingModal },

View file

@ -140,6 +140,13 @@ router.afterEach((to, from) => {
// Update lastPageVisited in the store
store.commit(storeMutations.UPDATE_LAST_PAGE_VISITED, to.name);
// If saving on navigation is requested, check for saved SessionId or EmailAddress to determine if saving is appropriate
if (eval(to.params.isSavingNavigation)) {
if (store.getters.applicationUser.savedSessionId || store.getters.order.customer?.emailAddress) {
saveOrder();
}
}
// Push page view to GA
analyticsMixin.methods.pushPageViewToGA();
@ -148,8 +155,12 @@ router.afterEach((to, from) => {
});
router.navigate = (scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData) => {
navigate(scenario, currentRoute, optionalQuery, optionalParams, optionalPageData);
router.navigateWithoutSaving = (scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData = {}) => {
navigate(scenario, currentRoute, false, optionalQuery, optionalParams, optionalPageData);
}
router.navigateWithSaving = (scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData = {}) => {
navigate(scenario, currentRoute, true, optionalQuery, optionalParams, optionalPageData);
}
router.navigateToExternalUrl = (url, optionalQuery = {}) => {
@ -157,15 +168,15 @@ router.navigateToExternalUrl = (url, optionalQuery = {}) => {
}
//Use this navigation when you need to call next() explicitly. beforeRouteEnter is a good example.
router.overrideNavigation = (scenario, currentRoute, next, optionalQuery = {}, optionalParams = {}, optionalPageData) => {
router.navigate(scenario, currentRoute, optionalQuery, optionalParams, optionalPageData);
router.overrideNavigation = (scenario, currentRoute, next, isSavingNavigation, optionalQuery = {}, optionalParams = {}, optionalPageData) => {
navigate(scenario, currentRoute, isSavingNavigation, optionalQuery, optionalParams, optionalPageData);
next();
}
// PRIVATE FUNCTIONS
// Navigate to the next route, depending on the scenario.
async function navigate(scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData) {
async function navigate(scenario, currentRoute, isSavingNavigation, optionalQuery = {}, optionalParams = {}, optionalPageData = {}) {
if (!scenario) {
console.error("No scenario provided. Please review the routing table.");
return;
@ -182,10 +193,7 @@ async function navigate(scenario, currentRoute, optionalQuery = {}, optionalPara
const existingPageDataForPage = store.getters.pageData(destinationFmgPageValue);
baseMixin.methods.savePageDataToStore(destinationFmgPageValue, optionalPageData ? optionalPageData : existingPageDataForPage ?? {});
// if cookie and referralNumber/Date exists OR an emailAddress has been saved
if ((getFunnelCookie()?.ReferralNumber && getFunnelCookie()?.ReferralDate) || store.getters.order.customer?.emailAddress) {
saveOrder();
}
optionalParams.isSavingNavigation = isSavingNavigation;
router.push({
name: "root",

View file

@ -1,34 +1,30 @@
const navigationScenarios = {
// General
CLICKED_BACK: "CLICKED_BACK",
CLICKED_FORWARD: "CLICKED_FORWARD",
// YMMS
SELECTED_YEAR: "SELECTED_YEAR",
SELECTED_MODEL: "SELECTED_MODEL",
SELECTED_MAKE: "SELECTED_MAKE",
SELECTED_STYLE: "SELECTED_STYLE",
CLICKED_BACK: "CLICKED_BACK",
// Vin pages
CLICKED_BACK_WITH_VIN: "CLICKED_BACK_WITH_VIN",
CLICKED_FORWARD: "CLICKED_FORWARD",
CLICKED_FORWARD_WITH_VIN: "CLICKED_FORWARD_WITH_VIN",
SELECTED_PARTS: "SELECTED_PARTS",
SELECTED_VIN_WITH_PART_QUESTIONS: "HAS_PART_QUESTIONS",
SELECTED_VIN_WITH_MULTIPLE_PARTS: "HAS_MULTIPLE_PARTS_TO_CHOOSE",
SELECTED_VIN_WITH_MOLDING_QUESTIONS: "HAS_MOLDING_QUESTIONS",
SELECTED_VIN_WITH_CAPABILITY_QUESTIONS: "HAS_CAPABILITY_QUESTIONS",
CONTINUING_WITH_SINGLE_PART: "CONTINUING_WITH_SINGLE_PART",
CLICKED_FORWARD_WITHOUT_VIN: "CLICKED_FORWARD_WITHOUT_VIN",
CONTINUING_WITH_MULTIPLE_VEHICLES: "CONTINUING_WITH_MULTIPLE_VEHICLES",
SELECTED_VIN_HAS_MISMATCHED_GLASS: "SELECTED_VIN_HAS_MISMATCHED_GLASS",
CLICKED_FORWARD_WITHOUT_VIN: "CLICKED_FORWARD_WITHOUT_VIN",
SELECTED_MANUAL_VIN: "SELECTED_MANUAL_VIN",
SELECTED_LICENSE_PLATE: "SELECTED_LICENSE_PLATE",
SELECTED_HOME_ADDRESS: "SELECTED_HOME_ADDRESS",
ANSWERED_QUESTIONS_WITH_SINGLE_PART: "ANSWERED_QUESTIONS_WITH_SINGLE_PART",
ANSWERED_QUESTIONS_WITH_MULTIPLE_PARTS: "ANSWERED_QUESTIONS_WITH_MULTIPLE_PARTS",
SELECTED_PROVIDE_VIN_DIFFERENT_WAY: "SELECTED_PROVIDE_VIN_DIFFERENT_WAY",
CLICKED_BACK_WITH_PART_QUESTION_ANSWERS: "CLICKED_BACK_WITH_PART_QUESTION_ANSWERS",
CLICKED_BACK_WITHOUT_PART_QUESTION_ANSWERS: "CLICKED_BACK_WITHOUT_PART_QUESTION_ANSWERS",
ANSWERED_ALL_QUESTIONS: "ANSWERED_ALL_QUESTIONS",
// Question pages
HAS_PART_QUESTIONS: "HAS_PART_QUESTIONS",
HAS_MULTIPLE_PARTS_TO_CHOOSE: "HAS_MULTIPLE_PARTS_TO_CHOOSE",
HAS_MOLDING_QUESTIONS: "HAS_MOLDING_QUESTIONS",
HAS_CAPABILITY_QUESTIONS: "HAS_CAPABILITY_QUESTIONS",
HAS_NO_MORE_QUESTIONS: "HAS_NO_MORE_QUESTIONS",
CLICKED_BACK_TO_GO_TO_VIN_LOOKUP: "CLICKED_BACK_TO_GO_TO_VIN_LOOKUP",
CLICKED_BACK_TO_GO_TO_PART_QUESTIONS: "CLICKED_BACK_TO_GO_TO_PART_QUESTIONS",
CLICKED_BACK_TO_GO_TO_VEHICLE_PARTS: "CLICKED_BACK_TO_GO_TO_VEHICLE_PARTS",

View file

@ -76,10 +76,6 @@ const routingTable = function(store) {
scenario: navigationScenarios.CLICKED_BACK,
destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE,
},
{
scenario: navigationScenarios.SELECTED_PARTS,
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
},
],
},
{
@ -98,19 +94,19 @@ const routingTable = function(store) {
destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE,
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS,
scenario: navigationScenarios.HAS_PART_QUESTIONS,
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS,
scenario: navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE,
destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_MOLDING_QUESTIONS,
scenario: navigationScenarios.HAS_MOLDING_QUESTIONS,
destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_CAPABILITY_QUESTIONS,
scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS,
destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS
}
],
@ -127,19 +123,19 @@ const routingTable = function(store) {
destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE,
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS,
scenario: navigationScenarios.HAS_PART_QUESTIONS,
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS,
scenario: navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE,
destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_MOLDING_QUESTIONS,
scenario: navigationScenarios.HAS_MOLDING_QUESTIONS,
destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_CAPABILITY_QUESTIONS,
scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS,
destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS
}
],
@ -160,19 +156,19 @@ const routingTable = function(store) {
destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE,
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS,
scenario: navigationScenarios.HAS_PART_QUESTIONS,
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS,
scenario: navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE,
destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_MOLDING_QUESTIONS,
scenario: navigationScenarios.HAS_MOLDING_QUESTIONS,
destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_CAPABILITY_QUESTIONS,
scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS,
destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS
}
],
@ -189,25 +185,21 @@ const routingTable = function(store) {
destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE,
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS,
scenario: navigationScenarios.HAS_PART_QUESTIONS,
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS,
scenario: navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE,
destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_MOLDING_QUESTIONS,
scenario: navigationScenarios.HAS_MOLDING_QUESTIONS,
destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_CAPABILITY_QUESTIONS,
scenario: navigationScenarios.HAS_CAPABILITY_QUESTIONS,
destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS
},
{
scenario: navigationScenarios.SELECTED_PROVIDE_VIN_DIFFERENT_WAY,
destinationFmgPageValue: fmgPageValues.ESTIMATE
}
],
},
{
@ -251,7 +243,7 @@ const routingTable = function(store) {
destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS,
},
{
scenario: navigationScenarios.ANSWERED_ALL_QUESTIONS,
scenario: navigationScenarios.HAS_NO_MORE_QUESTIONS,
destinationFmgPageValue: fmgPageValues.QUOTE,
},
]
@ -259,10 +251,6 @@ const routingTable = function(store) {
{
fmgPageValue: fmgPageValues.VEHICLE_PARTS,
maps: [
{
scenario: navigationScenarios.SELECTED_PARTS,
destinationFmgPageValue: fmgPageValues.QUOTE,
},
{
scenario: navigationScenarios.CLICKED_FORWARD,
destinationFmgPageValue: fmgPageValues.REVEAL,
@ -284,7 +272,7 @@ const routingTable = function(store) {
destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS,
},
{
scenario: navigationScenarios.ANSWERED_ALL_QUESTIONS,
scenario: navigationScenarios.HAS_NO_MORE_QUESTIONS,
destinationFmgPageValue: fmgPageValues.QUOTE,
},
],
@ -309,7 +297,7 @@ const routingTable = function(store) {
destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS,
},
{
scenario: navigationScenarios.ANSWERED_ALL_QUESTIONS,
scenario: navigationScenarios.HAS_NO_MORE_QUESTIONS,
destinationFmgPageValue: fmgPageValues.QUOTE,
}
]
@ -334,7 +322,7 @@ const routingTable = function(store) {
destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS
},
{
scenario: navigationScenarios.ANSWERED_ALL_QUESTIONS,
scenario: navigationScenarios.HAS_NO_MORE_QUESTIONS,
destinationFmgPageValue: fmgPageValues.QUOTE
},
]

View file

@ -997,7 +997,7 @@ export const actions = {
savePartQuestionAnswers(context, partQuestionAnswersArray) {
// if part question answers have changed, reset subsequent question answers
const previousResultsArray = context.getters.damage.partQuestionAnswers;
const havePartQuestionAnswersChanged = previousResultsArray.length !== partQuestionAnswersArray.length ||
const havePartQuestionAnswersChanged = previousResultsArray?.length !== partQuestionAnswersArray.length ||
!previousResultsArray.every((x, i) => x.result === partQuestionAnswersArray[i].result);
if (havePartQuestionAnswersChanged) {