diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index 3e84b7678..99362c8fa 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -170,7 +170,6 @@ export default { this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); }, async forwardButtonAction() { - console.log("forwardButtonAction") if (this.isRepair) { console.log("REPAIRRR") const zipCodeData = await this.getZipCodeData(this.serviceZipCode); diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 63b87fbe7..00e7f4e87 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -56,6 +56,7 @@ import servicePackageQuestion from "./service-package-question/service-package-q import textBlock from "@/common-components/text-block/text-block"; import modal from "@/common-components/modal/modal"; import baseMixin from "@/mixins/base-mixin.js"; +import vehicleQuestionsMixin from "../../mixins/vehicle-questions-mixin"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { Form } from "vee-validate"; @@ -155,6 +156,9 @@ export default { : null; } }, + backButtonAction() { + vehicleQuestionsMixin.methods.backButtonAction(this); + } }, components: { funnelHeader, diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index 5574699bd..92821da96 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -243,22 +243,31 @@ export default { // save to store lineItems.glassParts self.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts); - self.$router.navigateWithSaving(self.navigationScenarios.HAS_NO_MORE_QUESTIONS, self.$route); + self.$router.navigateWithSaving( + self.navigationScenarios.HAS_NO_MORE_QUESTIONS, + self.$route + ); } }, - backButtonAction() { + // Can't use `this` because navigateForward is also called from quote + backButtonAction(vm) { + const self = vm ?? this; const partsOrQuestions = ( - this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS) ?? - this.$store.getters.pageData(fmgPageValues.VEHICLE_PARTS) + self.$store.getters.pageData(fmgPageValues.PART_QUESTIONS) ?? + self.$store.getters.pageData(fmgPageValues.VEHICLE_PARTS) ?? + self.$store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS) ?? + self.$store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS) )?.partsOrQuestions; const hasPartQuestions = this.hasPartQuestions(partsOrQuestions); const hasGlassLocationWithMultipleParts = this.hasGlassLocationWithMultipleParts(partsOrQuestions); const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions); const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions); - let backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS; + let backNavigationScenario = self.$store.getters.vehicle.vin + ? navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS + : navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS; - const currentPage = this.$route.query.fmgPage; + const currentPage = self.$route.query.fmgPage; if ( hasCapabilityQuestions && this.currentPageComesAfterPage(currentPage, fmgPageValues.CAPABILITY_QUESTIONS) @@ -282,7 +291,9 @@ export default { backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS; } - this.$router.navigateWithoutSaving(backNavigationScenario, this.$route); + console.log({ backNavigationScenario }); + + self.$router.navigateWithoutSaving(backNavigationScenario, self.$route); }, }, }; diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js index 47a8681fc..809d74c9b 100644 --- a/src/router/router-constants/navigation-scenarios.js +++ b/src/router/router-constants/navigation-scenarios.js @@ -26,10 +26,14 @@ const navigationScenarios = { HAS_MOLDING_QUESTIONS: "HAS_MOLDING_QUESTIONS", HAS_CAPABILITY_QUESTIONS: "HAS_CAPABILITY_QUESTIONS", HAS_NO_MORE_QUESTIONS: "HAS_NO_MORE_QUESTIONS", - CLICKED_BACK_WITH_NO_QUESTIONS: "CLICKED_BACK_WITH_NO_QUESTIONS", CLICKED_BACK_WITH_PART_QUESTIONS: "CLICKED_BACK_WITH_PART_QUESTIONS", CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE: "CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE", CLICKED_BACK_WITH_MOLDING_QUESTIONS: "CLICKED_BACK_WITH_MOLDING_QUESTIONS", + CLICKED_BACK_WITH_CAPABILITY_QUESTIONS: "CLICKED_BACK_WITH_CAPABILITY_QUESTIONS", + + // Quote + CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS: "CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS", + CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS: "CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS" }; export { navigationScenarios }; diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 8dc65c3b9..5c76ef5e1 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -247,9 +247,13 @@ const routingTable = function (store) { fmgPageValue: fmgPageValues.PART_QUESTIONS, maps: [ { - scenario: navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS, + scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS, destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, }, + { + scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS, + destinationFmgPageValue: fmgPageValues.ESTIMATE, + }, { scenario: navigationScenarios.HAS_MULTIPLE_PARTS_TO_CHOOSE, destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS, @@ -280,9 +284,13 @@ const routingTable = function (store) { destinationFmgPageValue: fmgPageValues.PART_QUESTIONS, }, { - scenario: navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS, + scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS, destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, }, + { + scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS, + destinationFmgPageValue: fmgPageValues.ESTIMATE, + }, { scenario: navigationScenarios.HAS_MOLDING_QUESTIONS, destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS, @@ -301,9 +309,13 @@ const routingTable = function (store) { fmgPageValue: fmgPageValues.MOLDING_QUESTIONS, maps: [ { - scenario: navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS, + scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS, destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, }, + { + scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS, + destinationFmgPageValue: fmgPageValues.ESTIMATE, + }, { scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS, destinationFmgPageValue: fmgPageValues.PART_QUESTIONS, @@ -326,9 +338,13 @@ const routingTable = function (store) { fmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS, maps: [ { - scenario: navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS, + scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS, destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, }, + { + scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS, + destinationFmgPageValue: fmgPageValues.ESTIMATE, + }, { scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS, destinationFmgPageValue: fmgPageValues.PART_QUESTIONS, @@ -347,6 +363,35 @@ const routingTable = function (store) { }, ], }, + { + fmgPageValue: fmgPageValues.QUOTE, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS, + destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, + }, + { + scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS, + destinationFmgPageValue: fmgPageValues.ESTIMATE, + }, + { + scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS, + destinationFmgPageValue: fmgPageValues.PART_QUESTIONS, + }, + { + scenario: navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE, + destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS, + }, + { + scenario: navigationScenarios.CLICKED_BACK_WITH_MOLDING_QUESTIONS, + destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS, + }, + { + scenario: navigationScenarios.CLICKED_BACK_WITH_CAPABILITY_QUESTIONS, + destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS, + }, + ], + }, ]; }; diff --git a/src/store/index.js b/src/store/index.js index 34ec8a8a9..d7b13415f 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -362,21 +362,6 @@ export const mutations = { updateTriggeredSiteEntry(state, wasSiteEntryTriggered) { state.applicationUser.triggeredSiteEntry = wasSiteEntryTriggered; }, - // START GA click event mutations - // updateCurrentlySelectedValues(state, groupName, value) { - // state.gaClickInformation.currentlySelectedValues[groupName] = value; - // }, - // updateFiredGaClickEventValues(state, groupName, value) { - // state.gaClickInformation.firedGaClickEventValues[groupName] = value; - // }, - // updateLastFocusedInputGroup(state, groupName) { - // state.gaClickInformation.lastFocusedInputGroup = groupName; - // }, - // updateWasLastFocusedInputMultiselect(state, wasLastFocusedInputMultiselect) { - // state.gaClickInformation.wasLastFocusedInputMultiselect = - // wasLastFocusedInputMultiselect; - // }, - // END GA click event mutations }; // Export Getters @@ -393,10 +378,10 @@ export const getters = { eventBus: (state) => state.applicationUser.eventBus, damage: (state) => state.order.damage, hasAnyNonWindshieldGlassParts: (state) => { - const nonWindshieldItems = state.order.damage.glassToReplace.filter( + const nonWindshieldItems = state.order.damage.glassToReplace?.filter( (glassToReplace) => glassToReplace.glassLocation != "Windshield" ); - return !!nonWindshieldItems.length; + return !!nonWindshieldItems?.length; }, lineItems: (state) => state.order.lineItems, pageData: (state) => (page) => { @@ -465,7 +450,6 @@ export const getters = { state.applicationUser.experiments .map((x) => x.settings) .reduce((r, c) => Object.assign(r, c), {}) ?? {}, - // gaClickInformation: (state) => state.gaClickInformation, }; function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) {