diff --git a/jest.config.js b/jest.config.js index 0a063507d..a2522e0ac 100644 --- a/jest.config.js +++ b/jest.config.js @@ -12,6 +12,8 @@ module.exports = { "!src/router/**/*.js", "!src/helpers/unit-test-helper.js", "!src/layouts/vehicle-damage/windshield-options/windshield-options.vue", + "!src/layouts/molding-questions/**/*.vue", + "!src/layouts/capability-questions/**/*.vue", "!src/layouts/part-questions/**/*.vue", "!src/layouts/reveal/**/*.vue", "!src/ux-components/text-link/**/*.vue", diff --git a/src/common-components/button-question/button-question.vue b/src/common-components/button-question/button-question.vue index ee9ecdbad..a4ee6b330 100644 --- a/src/common-components/button-question/button-question.vue +++ b/src/common-components/button-question/button-question.vue @@ -7,6 +7,7 @@
+ {{ questionText }} {{(isMultiSelect && answers && answers.length > 1) ? 'Select one or more options below.' : 'Select an option below.' }}
@@ -35,8 +36,9 @@ data-test="button" :validationRules="validationRules" :class="[suppressError ? 'alertError' : '']" + :valueToLogType="valueToLogType" /> - +
@@ -89,7 +91,8 @@ export default { modelValue: [Array, String], validationRules: String, suppressError: Boolean, - useTextForValue: Boolean + useTextForValue: Boolean, + valueToLogType: String, }, computed: { formattedGroupName() { diff --git a/src/common-components/funnel-header/menu-modal/menu-modal.vue b/src/common-components/funnel-header/menu-modal/menu-modal.vue index e275cc65a..c329f057d 100644 --- a/src/common-components/funnel-header/menu-modal/menu-modal.vue +++ b/src/common-components/funnel-header/menu-modal/menu-modal.vue @@ -1,6 +1,6 @@ + + + + diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js index 2e83c3103..7bfc02eba 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.spec.js +++ b/src/layouts/license-plate-lookup/license-plate-lookup.spec.js @@ -235,7 +235,7 @@ describe("license-plate-lookup.vue", () => { expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); }); - test("navigateToHeritageFunnel should be called if isCarIdDifferent is false or isSelectedGlassAvailableForVehicle is true when navigateForward is called", async () => { + test("navigateForwardWithSingleCarMatch should be called if isCarIdDifferent is false or isSelectedGlassAvailableForVehicle is true when navigateForward is called", async () => { // Arrange const { wrapper } = setupMocks({}); @@ -247,11 +247,11 @@ describe("license-plate-lookup.vue", () => { wrapper.vm.getCmsContent = jest.fn().mockImplementation(() => { return ''; }); - navigateToHeritage.navigateToHeritageFunnel = jest.fn(); + wrapper.vm.navigateForwardWithSingleCarMatch = jest.fn(); await wrapper.vm.navigateForward(); //Assert - expect(navigateToHeritage.navigateToHeritageFunnel).toHaveBeenCalled(); + expect(wrapper.vm.navigateForwardWithSingleCarMatch).toHaveBeenCalled(); }); test("carId matches returned vehicle => navigateForwardWithSingleCarMatch", async () => { diff --git a/src/layouts/molding-questions/molding-questions.vue b/src/layouts/molding-questions/molding-questions.vue new file mode 100644 index 000000000..d2b469a36 --- /dev/null +++ b/src/layouts/molding-questions/molding-questions.vue @@ -0,0 +1,202 @@ + + + + + diff --git a/src/layouts/part-questions/part-questions.vue b/src/layouts/part-questions/part-questions.vue index 54c1e22ce..db237ce2b 100644 --- a/src/layouts/part-questions/part-questions.vue +++ b/src/layouts/part-questions/part-questions.vue @@ -6,12 +6,14 @@ v-slot="{ meta }" >
+
@@ -48,6 +50,7 @@ import alert from "@/ux-components/alert/alert"; import questionChain from "@/common-components/question-chain/question-chain"; import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header"; import funnelFooter from "@/common-components/funnel-footer/funnel-footer"; +import loadingModal from '@/common-components/loading-modal/loading-modal.vue'; // Supporting Files import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; @@ -59,6 +62,8 @@ import { fmgPageValues } from "@/router/router-constants/fmgPage-values"; import { Form, defineRule } from "vee-validate"; import { required } from "@/helpers/validation-rules"; import { errorMessages } from "@/constants/error-messages"; +import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin"; +import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; // DEFINE VALIDATION RULES defineRule("questions-required", required(errorMessages.OPTION_REQUIRED)); @@ -87,11 +92,16 @@ export default { data() { return { selectedModel: [], - partsQuestionsData: [], - waitingForLoad: true, + partsQuestionsData: this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS)?.partsOrQuestions.filter((p) => { + if (Array.isArray(p.partQuestions) && p.partQuestions.length > 0) { + return { + glassName: p.glassName, + glassLocation: p.glassLocation, + partQuestions: p.partQuestions, + }; + } + }), currentPartNum: 0, - glassNameAndParts: [], - hasMultipleParts: false, }; }, computed: { @@ -102,22 +112,7 @@ export default { return this.getCmsContent("AlertPartsQuestions", "BodyText"); }, }, - async mounted() { - const questionData = await this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS); - - // Map API result data, to part-questions data structure - this.partsQuestionsData = questionData.partsOrQuestions.filter((p) => { - if (Array.isArray(p.partQuestions) && p.partQuestions.length > 0) { - return { - glassName: p.glassName, - glassLocation: p.glassLocation, - partQuestions: p.partQuestions, - }; - } - }); - - this.waitingForLoad = false; - }, + mixins: [vehicleQuestionsMixin], methods: { showThisPartQuestionChain(part, i) { if (part.partQuestions?.length < 1) { return false; } // return false if only one partQuestion @@ -147,43 +142,36 @@ export default { // call API parts method const partsLookup = await this.dispatchStoreAction(storeActions.GET_PARTS) .catch(() => { - this.$refs.funnelFooter.removeLoader(); + return this.$refs.funnelFooter.removeLoader(); }); - if (!partsLookup) { return } + const glassNameAndPartsForStore = partsLookup.data.glassNameAndParts; - this.glassNameAndParts = partsLookup.data.glassNameAndParts; + const hasGlassLocationWithMultipleParts = this.hasGlassLocationWithMultipleParts(glassNameAndPartsForStore); + const hasChildPartQuestions = this.hasChildPartQuestions(glassNameAndPartsForStore); + const hasCapabilityQuestions = this.hasCapabilityQuestions(glassNameAndPartsForStore); - // test response data for multiple parts - this.hasMultipleParts = this.glassNameAndParts.some((glass) => glass.parts?.length > 1); - - // loop through all glass items - const collectedGlassParts = []; - this.glassNameAndParts.forEach((glass) => { - if (Array.isArray(glass.parts) && glass.parts.length === 1) { - const singlePart = glass.parts[0]; - collectedGlassParts.push({ - "partNumber": singlePart.partNumber, - "description": singlePart.description, - "color": singlePart.color, - "requiresRecalibration": singlePart.requiresRecalibration, - "childParts": singlePart.childParts, - "price": singlePart.price, - }) - } - }); - store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts); - this.navigateForward(); - }, - async navigateForward() { - if (this.hasMultipleParts) { + // NAVIGATE FORWARD + if (hasGlassLocationWithMultipleParts) { // if multiple parts on any glass // go to vehicle-parts page and pass the partsData - this.$router.navigate(this.navigationScenarios.ANSWERED_QUESTIONS_WITH_MULTIPLE_PARTS,this.$route,{},{},{partsOrQuestions: this.glassNameAndParts}); + this.$router.navigate(this.navigationScenarios.ANSWERED_QUESTIONS_WITH_MULTIPLE_PARTS,this.$route,{},{},{partsOrQuestions: glassNameAndPartsForStore}); + } else if (hasChildPartQuestions) { + // if any childpart questions + // go to molding-questions page and pass the partsData + this.$router.navigate(this.navigationScenarios.HAS_MOLDING_QUESTIONS,this.$route,{},{},{partsOrQuestions: glassNameAndPartsForStore}); + } else if (hasCapabilityQuestions) { + // if has capability questions + // go to capability-questions page and pass the partsData + this.$router.navigate(this.navigationScenarios.HAS_CAPABILITY_QUESTIONS,this.$route,{},{},{partsOrQuestions: glassNameAndPartsForStore}); } else { // if single parts only - // go to quote page - this.$router.navigate(this.navigationScenarios.ANSWERED_QUESTIONS_WITH_SINGLE_PART,this.$route); + const collectedGlassParts = this.reducedGlassPartsArray(glassNameAndPartsForStore); + // save to store lineItems.glassParts + this.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts); + // go to heritage quote page + this.$refs.loadingModal.showModal(); + navigateToHeritageFunnel(); } }, arePagePrerequisitesValid() { @@ -206,18 +194,19 @@ export default { questionChain, funnelSubHeader, funnelFooter, + loadingModal, Form, }, }; diff --git a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue index 53ef1e2fa..bb164f1bc 100644 --- a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue +++ b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue @@ -1,6 +1,6 @@