@@ -63,7 +64,6 @@ 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));
@@ -92,89 +92,391 @@ export default {
},
data() {
return {
- selectedModel: [],
- partsQuestionsData: this.$store.getters.pageData(fmgPageValues.MOLDING_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,
+ moldingQuestionsData: store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS).partsOrQuestions,
+ selectedAnswers: {},
+ currentGlassIndex: 0,
+ foundDuplicateQuestions: [],
};
},
computed: {
AlertFewMoreQuestionsHeader() {
- return this.getCmsContent("AlertPartsQuestions", "HeadlineText");
+ return this.getCmsContent("AdditionalPartsQuestionsAlert", "HeadlineText");
},
AlertFewMoreQuestionsCopy() {
- return this.getCmsContent("AlertPartsQuestions", "BodyText");
+ return this.getCmsContent("AdditionalPartsQuestionsAlert", "BodyText");
},
+ pageData() {
+ return this.$store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS);
+ }
+ },
+ mounted() {
+ this.LoadInitialData();
},
methods: {
arePagePrerequisitesValid() {
- return false; // TODO - DO TRUE TEST OF PAGEDATA
- // return Object.keys(store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS)).length > 0;
+ const moldingQuestionsFromPageData = store.getters.pageData(fmgPageValues.MOLDING_QUESTIONS);
+ return moldingQuestionsFromPageData && Object.keys(moldingQuestionsFromPageData).length > 0;
},
- showThisPartQuestionChain(part, i) {
- if (part.partQuestions?.length < 1) { return false; } // return false if only one partQuestion
- if (this.currentPartNum === i || part.answerData?.answerResult.length > 0) { return true; }
- return false;
- },
- backButtonAction() {
- // route to move backwards
- this.$router.navigateWithoutSaving(
- this.navigationScenarios.CLICKED_BACK,
- this.$route
- );
+ showThisQuestionChain(glass, i) {
+ if (!glass.questions || glass.questions?.length < 1 || glass.isSuppressedPart) { return false; } // return false if no questions or if suppressed
+ return this.currentGlassIndex === i || glass.answerData?.answerResult?.length > 0;
},
async forwardButtonAction() {
- const partQuestionAnswersArray = this.partsQuestionsData.map((item) => {
+ const questionAnswersArray = this.moldingQuestionsData.map((glass) => {
return {
- glassLocation: item.glassLocation,
- glassName: item.glassName,
- result: item.answerData.answerResult,
- answeredQuestions: item.answerData.answeredQuestions,
+ glassLocation: glass.glassLocation,
+ glassName: glass.glassName,
+ partNum: glass.answerData.answerResult,
+ answeredQuestions: glass.answerData.answeredQuestions,
+ isSuppressedPart: glass.isSuppressedPart,
};
});
- // save to vuex store as order.damage.partQuestionAnswers (array)
- await this.dispatchStoreAction(this.storeActions.SAVE_PART_QUESTION_ANSWERS, partQuestionAnswersArray, false);
+ // clear out answerData for future page loads; must occur prior to store save
+ this.moldingQuestionsData.forEach((glass) => {
+ glass.answerData = {};
+ });
+
+ // save to vuex store as order.damage.moldingQuestionArrays (array)
+ await this.dispatchStoreAction(this.storeActions.SAVE_MOLDING_QUESTION_ANSWERS, questionAnswersArray, false);
+
+ // get parts from the questionAnswers
+ let partsOrQuestions = this.pageData.partsOrQuestions;
+ for (let answer of questionAnswersArray) {
+ partsOrQuestions.find(partOrQuestion => {
+ return partOrQuestion.glassLocation === answer.glassLocation && partOrQuestion.glassName === answer.glassName;
+ }).parts[0].childParts = [
+ {
+ partNumber: answer.partNum
+ }
+ ];
+ }
+
+ this.navigateForward(partsOrQuestions);
+ },
+ handleAnswerUpdates(key, answer) {
+ // only runs when all questions in a question-chain have been answered
+ // when selectedAnswers updates, user has completed this part's question chain and has a final answer
+ // (does not get run for each invididual question's answer, only when
+ // all relevent questions for the current part have been answered)
+
+ /*
+ answer example format:
+ {
+ "answerResult": "DD11132",
+ "answeredQuestions": [
+ {
+ "questionText": "Is your Grand Cherokee the Laredo model?",
+ "selectedAnswerText": "Yes",
+ "questionNum": 1,
+ }
+ ],
+ "glassIndex": 0
+ }
+ */
+
+ // collect a list of the answered questions' numbers, needed later below
+ const answeredQuestionIndexes = [];
+
+ // if user has answered a question differently than anything that was preloaded,
+ // we need to clear out any preloaded answers
+ this.selectedAnswers = {};
+
+ // loop through every answered question on the currently answered glass part
+ answer.answeredQuestions?.forEach((aq) => {
+
+ // keep track of this question number
+ answeredQuestionIndexes.push(aq.questionNum);
+
+ const answeredQuestionText = aq.questionText.toUpperCase();
+ const answeredQuestionAnswer = aq.selectedAnswerText.toUpperCase();
+
+ // HANDLE DUPLICATE QUESTIONS
+
+ // loop through all glass parts data
+ this.moldingQuestionsData.forEach((glass, gpIndex) => {
+
+ // only look for duplicates forward... to parts that follow after the currently being answered part
+ if (gpIndex > answer.glassIndex) {
+
+ let suppressUntil;
+ // reset this glass part, in case user is changing their previous answers
+ glass.answerData = null;
+ glass.isSuppressedPart = null;
+
+ // loop through this glass part's part questions, looking for a questionText match
+ glass.questions.forEach((pq, pqIndex) => {
+
+ // clear out any previously set answers
+ pq.answerSelected = null;
+
+ // clear or set suppressQuestion property for each question
+ if (suppressUntil) {
+ // if suppressUntil has been set, then suppress this question if before it
+ if (pqIndex + 1 < suppressUntil) {
+ pq.suppressQuestion = true;
+ } else {
+ pq.suppressQuestion = null;
+ }
+ } else {
+ pq.suppressQuestion = null;
+ }
+
+ // if these match then we have a duplicate question
+ if (pq.questionText.toUpperCase() === answeredQuestionText) {
+
+ const thisAnsweredPartQuestion = glass.questions[pqIndex];
+ let matchedAnswer;
+ let rejectedAnswers = []; // set as an array, in case we ever have questions with more than 2 answers...
+
+ // which one of this questions' answers matches our answer?
+ pq.answers.forEach((ans) => {
+ if (ans.answerText.toUpperCase() === answeredQuestionAnswer) {
+ matchedAnswer = ans;
+ ans.selected = true;
+ } else {
+ rejectedAnswers.push(ans);
+ ans.selected = null;
+ }
+ });
+
+ // Update the key to re-render this part's question-chain component
+ this.moldingQuestionsData[gpIndex].key = this.moldingQuestionsData[gpIndex].glassLocation + this.moldingQuestionsData[gpIndex].glassName + Date.now().toString();
+
+ // handle suppressing downstream in this question chain
+
+ if (matchedAnswer.nextQuestionSequence) {
+ // ensure that the question that the accepted answer has set to be next is NOT suppressed
+ glass.questions[matchedAnswer.nextQuestionSequence - 1].suppressQuestion = null;
+ // if the duplicate is the 1ST question, then set suppressUntil var to lowest nextQuestion number
+ if (pqIndex === 0) {
+ if (!suppressUntil) { suppressUntil = matchedAnswer.nextQuestionSequence }
+ if (matchedAnswer.nextQuestionSequence < suppressUntil) { suppressUntil = matchedAnswer.nextQuestionSequence}
+ }
+ }
+
+ // handle suppressing upstream in this question chain
+ glass.questions.forEach((q) => {
+ q.answers.forEach((thisAns) => {
+ // restore any of the answers that formerly led to the duplicated question
+ if (thisAns.originalNextQuestionSequence === pq.questionSequence) {
+ // restore original nextQuestionSequence
+ thisAns.nextQuestionSequence = thisAns.originalNextQuestionSequence;
+ this.originalNextQuestionSequence = null;
+ // restore original answerResult
+ if (thisAns.originalAnswerResult) {
+ thisAns.answerResult = thisAns.originalAnswerResult;
+ thisAns.originalAnswerResult = null;
+ }
+ }
+ // search for any answers that lead to the duplicated question
+ if (thisAns.nextQuestionSequence === pq.questionSequence) {
+ // update either the nextQuestionSequence or the answerResult
+ if (matchedAnswer.nextQuestionSequence) {
+ thisAns.originalNextQuestionSequence = thisAns.nextQuestionSequence;
+ thisAns.nextQuestionSequence = matchedAnswer.nextQuestionSequence;
+ } else {
+ thisAns.originalNextQuestionSequence = thisAns.nextQuestionSequence;
+ thisAns.nextQuestionSequence = null;
+ thisAns.originalAnswerResult = thisAns.originalAnswerResult || thisAns.answerResult;
+ thisAns.answerResult = matchedAnswer.answerResult;
+ }
+ }
+ });
+ });
+
+ // suppress current question
+ thisAnsweredPartQuestion.suppressQuestion = true;
+
+ const thisGlassPart = "glass" + gpIndex;
+ if (this.foundDuplicateQuestions[thisGlassPart]) {
+ if (!this.foundDuplicateQuestions[thisGlassPart].includes(thisAnsweredPartQuestion.questionSequence)) {
+ this.foundDuplicateQuestions[thisGlassPart].push(thisAnsweredPartQuestion.questionSequence);
+ }
+ } else {
+ this.foundDuplicateQuestions[thisGlassPart] = [thisAnsweredPartQuestion.questionSequence];
+ }
+
+ // are there any questions left that are not suppressed?
+ const remainingQuestions = glass.questions.filter((q) => {
+ return !q.suppressQuestion;
+ });
+
+ if (remainingQuestions.length < 1) {
+ // this is the final answer for this glass part
+
+ // mark this part as completely answered by adding answerData
+ const answeredQuestionObj = {
+ questionText: pq.questionText,
+ selectedAnswerText: matchedAnswer.answerText,
+ questionNum: pq.questionSequence,
+ suppressQuestion: pq.suppressQuestion,
+ };
+ // set the answerData as 'already answered'
+ glass.answerData = {
+ answerResult: matchedAnswer.nextQuestionSequence ? matchedAnswer.nextQuestionSequence : matchedAnswer.answerResult,
+ answeredQuestions: [answeredQuestionObj],
+ };
+
+ // suppress this glass because it has an answer
+ glass.isSuppressedPart = true;
+ }
+
+ }
+
+ });
+
+ // Update the key to re-render this part's question-chain component
+ this.moldingQuestionsData[gpIndex].key = this.moldingQuestionsData[gpIndex].glassLocation + this.moldingQuestionsData[gpIndex].glassName + Date.now().toString();
+
+ }
- // call API parts method
- const partsLookup = await this.dispatchStoreAction(storeActions.GET_PARTS)
- .catch(() => {
- return this.$refs.funnelFooter.removeLoader();
});
- const glassNameAndPartsForStore = partsLookup.data.glassNameAndPartsForStore;
+ });
- const hasCapabilityQuestions = this.hasCapabilityQuestions(glassNameAndPartsForStore);
+ // DETERMINE ANSWERED QUESTIONS LIST FOR THIS GLASS PART
- if (hasCapabilityQuestions) {
- // if has capability questions
- // go to capability-questions page
- this.$router.navigateWithSaving(this.navigationScenarios.HAS_CAPABILITY_QUESTIONS,this.$route,{},{},{partsOrQuestions: glassNameAndPartsForStore});
- } else {
- // if single parts only
- 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();
+ // look through all (this part's) part questions for any duplicates that were suppressed;
+ // add them to the list of answered questions if found
+
+ // EX answeredQuestionIndexes: [1,5,11,13]
+
+ // EX this.foundDuplicateQuestions = {
+ // "glassPart1": [1],
+ // "glassPart2": [7, 10]
+ // };
+
+ const thisPartsDupes = this.foundDuplicateQuestions["glass" + answer.glassIndex];
+ const completeAnsweredQuestions = answer.answeredQuestions ? [...answer.answeredQuestions] : [];
+ const glassPartAnswered = this.moldingQuestionsData[answer.glassIndex];
+
+ thisPartsDupes?.forEach((dupe) => {
+ // dupe is a single integer
+ const dupeQuestion = glassPartAnswered.questions[dupe - 1];
+ const dupeQuestionAnswer = dupeQuestion.answers.find((q) => q.selected === true);
+
+ glassPartAnswered.questions.forEach((q) => {
+ let includeThisDupeInAnsweredQuestions = false;
+
+ // did one of the answers of this question point to the duplicated question?
+ q.answers.forEach((a) => {
+ if ((dupe === a.originalNextQuestionSequence) &&
+ (answeredQuestionIndexes.includes(q.questionSequence)) &&
+ (a.answerText.toUpperCase() === dupeQuestionAnswer.answerText.toUpperCase())) {
+ includeThisDupeInAnsweredQuestions = true;
+ }
+ });
+
+ // is this q.questionSequence listed as the duplicated question's nextQuestionSequence?
+ if ((q.questionSequence === dupeQuestionAnswer.nextQuestionSequence) && (answeredQuestionIndexes.includes(q.questionSequence))) {
+ includeThisDupeInAnsweredQuestions = true;
+ }
+
+ if (includeThisDupeInAnsweredQuestions) {
+ completeAnsweredQuestions.push({
+ questionNum: dupeQuestion.questionSequence,
+ questionText: dupeQuestion.questionText,
+ selectedAnswerText: dupeQuestionAnswer.answerText,
+ suppressQuestion: dupeQuestion.suppressQuestion,
+ });
+ }
+ });
+ });
+
+ // make sure there are no duplicated dupes in the list...
+ const foundInCompleteAnsweredQuestions = new Set();
+ let filteredCompleteAnsweredQuestions = completeAnsweredQuestions.filter(el => {
+ const duplicate = foundInCompleteAnsweredQuestions.has(el.questionText);
+ foundInCompleteAnsweredQuestions.add(el.questionText);
+ return !duplicate;
+ });
+ filteredCompleteAnsweredQuestions = filteredCompleteAnsweredQuestions.sort((a,b) => a.questionNum - b.questionNum);
+
+ // set final answer data for the current answered glass part
+ glassPartAnswered.answerData = {
+ answerResult: answer.answerResult,
+ answeredQuestions: filteredCompleteAnsweredQuestions,
}
+
+ // this part has been fully answered, so advance to next molding question chain
+ for (let i = answer.glassIndex + 1; i < this.moldingQuestionsData.length; i++) {
+ // if this part has not yet been fully answered, then make it the current part
+ if (!this.moldingQuestionsData[i].answerData?.answerResult) {
+ this.currentGlassIndex = i;
+ break;
+ }
+ }
+
},
- },
- watch: {
- selectedModel(model) {
- this.moldingQuestionsData[model.partIndex].answerData = {
- answerResult: model.answerResult,
- answeredQuestions: model.answeredQuestions,
- }
- this.currentPartNum = model.partIndex + 1;
+ LoadInitialData() {
+
+ // are there alreadyAnsweredQuestions?
+ const alreadyAnsweredQuestions = store.getters.damage.moldingQuestionAnswers;
+
+ this.moldingQuestionsData = this.pageData.partsOrQuestions.filter(x => x.parts[0].childPartQuestions.length).map((glass, i) => {
+ glass.key = glass.glassLocation + "-" + glass.glassName;
+ // NOTE: property "questions" can differ between layouts
+ glass.questions = glass.parts[0].childPartQuestions;
+
+ this.selectedAnswers[glass.key] = [];
+ if (!alreadyAnsweredQuestions) {
+ glass.answerData = null;
+ }
+
+ alreadyAnsweredQuestions?.forEach((savedPart) => {
+
+ if (!savedPart.glassLocation || !savedPart.glassName || !savedPart.answeredQuestions || !savedPart.partNum) {
+ return;
+ }
+ if (glass.glassLocation === savedPart.glassLocation && glass.glassName === savedPart.glassName) {
+ let answerString = "";
+
+ // matches; loop through answeredQuestions for matches
+ savedPart.answeredQuestions.forEach((aq) => {
+ if (!aq.questionNum || !aq.selectedAnswerText) {
+ return;
+ }
+ // determine which answer was previously chosen
+ const theAns = glass.questions[aq.questionNum-1].answers.find((a) => {
+ return a.answerText.toUpperCase() === aq.selectedAnswerText.toUpperCase();
+ });
+ if (theAns.nextQuestionSequence) {
+ answerString = `${aq.questionNum}|nextQuestion|${theAns.nextQuestionSequence}|${theAns.answerText}`
+ } else {
+ answerString = `${aq.questionNum}|answer|${theAns.answerResult}|${theAns.answerText}`
+ }
+
+ // mark this partQuestion as answered (question-chain will read this)
+ glass.questions[aq.questionNum-1].answerSelected = answerString;
+ // mark this partQuestion as duplicate if it is (question-chain will read this)
+ if (aq.suppressQuestion) {
+ glass.questions[aq.questionNum-1].suppressQuestion = true;
+ }
+ });
+
+ // advance the currentGlassIndex
+ this.currentGlassIndex = i;
+
+ // add answerData to current glass
+ glass.answerData = {
+ answerResult: savedPart.partNum,
+ answeredQuestions: savedPart.answeredQuestions
+ }
+ }
+
+ });
+
+ // Set up watch for each set of glass questions, which gets updated when all questions for a glass have been answered
+ this.$watch("selectedAnswers." + glass.key, (newValue) => {
+ if (newValue) {
+ this.handleAnswerUpdates(glass.key, newValue);
+ }
+ }, {deep: true})
+
+ return glass;
+ });
+
},
},
components: {
diff --git a/src/layouts/part-questions/part-questions.vue b/src/layouts/part-questions/part-questions.vue
index 7de6eb5a2..9b3e8d144 100644
--- a/src/layouts/part-questions/part-questions.vue
+++ b/src/layouts/part-questions/part-questions.vue
@@ -20,14 +20,14 @@
:manualCopy="AlertFewMoreQuestionsCopy"
v-bind:isDismissible="false"
/>
-
+
@@ -91,13 +91,9 @@ export default {
},
data() {
return {
- partsQuestionsFromApi: this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS)?.partsOrQuestions.filter((p) => {
- return Array.isArray(p.partQuestions) && p.partQuestions.length > 0;
- }),
+ partsQuestionsData: store.getters.pageData(fmgPageValues.PART_QUESTIONS).partsOrQuestions,
selectedAnswers: {},
- currentPartNum: 0,
- newAnswersArray: [],
- partsQuestionsData: [],
+ currentGlassIndex: 0,
foundDuplicateQuestions: [],
};
},
@@ -108,35 +104,41 @@ export default {
AlertFewMoreQuestionsCopy() {
return this.getCmsContent("AlertPartsQuestions", "BodyText");
},
+ pageData() {
+ return this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS);
+ }
},
mixins: [vehicleQuestionsMixin],
mounted() {
- this.LoadInitialPartsData();
+ this.LoadInitialData();
},
methods: {
- showThisPartQuestionChain(part, i) {
- if (part.partQuestions?.length < 1 || part.isSuppressedPart) { return false; } // return false if no partQuestions or if suppressed
- if (this.currentPartNum === i || part.answerData?.answerResult?.length > 0) { return true; }
- return false;
+ arePagePrerequisitesValid() {
+ const partQuestionsFromPageData = store.getters.pageData(fmgPageValues.PART_QUESTIONS);
+ return partQuestionsFromPageData && Object.keys(partQuestionsFromPageData).length > 0;
+ },
+ showThisQuestionChain(glass, i) {
+ if (!glass.questions || glass.questions?.length < 1 || glass.isSuppressedPart) { return false; } // return false if no questions or if suppressed
+ return this.currentGlassIndex === i || glass.answerData?.answerResult?.length > 0;
},
async forwardButtonAction() {
- const partQuestionAnswersArray = this.partsQuestionsData.map((item) => {
+ const questionAnswersArray = this.partsQuestionsData.map((glass) => {
return {
- glassLocation: item.glassLocation,
- glassName: item.glassName,
- result: item.answerData.answerResult,
- answeredQuestions: item.answerData.answeredQuestions,
- isSuppressedPart: item.isSuppressedPart,
+ glassLocation: glass.glassLocation,
+ glassName: glass.glassName,
+ result: glass.answerData.answerResult,
+ answeredQuestions: glass.answerData.answeredQuestions,
+ isSuppressedPart: glass.isSuppressedPart,
};
});
// clear out answerData for future page loads; must occur prior to store save
- this.partsQuestionsData.forEach((part) => {
- part.answerData = {};
+ this.partsQuestionsData.forEach((glass) => {
+ glass.answerData = {};
});
// save to vuex store as order.damage.partQuestionAnswers (array)
- await this.dispatchStoreAction(this.storeActions.SAVE_PART_QUESTION_ANSWERS, partQuestionAnswersArray, false);
+ await this.dispatchStoreAction(this.storeActions.SAVE_PART_QUESTION_ANSWERS, questionAnswersArray, false);
// call API parts method
const partsLookup = await this.dispatchStoreAction(storeActions.GET_PARTS)
@@ -145,12 +147,9 @@ export default {
});
const glassNameAndPartsForStore = partsLookup.data.glassNameAndParts;
+
this.navigateForward(glassNameAndPartsForStore);
},
- arePagePrerequisitesValid() {
- const partQuestionsFromPageData = store.getters.pageData(fmgPageValues.PART_QUESTIONS);
- return partQuestionsFromPageData && Object.keys(partQuestionsFromPageData).length > 0;
- },
handleAnswerUpdates(key, answer) {
// only runs when all questions in a question-chain have been answered
// when selectedAnswers updates, user has completed this part's question chain and has a final answer
@@ -166,16 +165,9 @@ export default {
"questionText": "Is your Grand Cherokee the Laredo model?",
"selectedAnswerText": "Yes",
"questionNum": 1,
- "extra": {
- "Text": "Yes",
- "nextQuestionSequence": null,
- "answerResult": "DD11132",
- "questionSequence": 1,
- "questionType": "answer"
- }
}
],
- "partIndex": 0
+ "glassIndex": 0
}
*/
@@ -198,18 +190,18 @@ export default {
// HANDLE DUPLICATE QUESTIONS
// loop through all glass parts data
- this.partsQuestionsData.forEach((glassPart, gpIndex) => {
+ this.partsQuestionsData.forEach((glass, gpIndex) => {
// only look for duplicates forward... to parts that follow after the currently being answered part
- if (gpIndex > answer.partIndex) {
+ if (gpIndex > answer.glassIndex) {
let suppressUntil;
// reset this glass part, in case user is changing their previous answers
- glassPart.answerData = null;
- glassPart.isSuppressedPart = null;
+ glass.answerData = null;
+ glass.isSuppressedPart = null;
- // loop through this glass part's part questions, looking for a questionText match
- glassPart.partQuestions.forEach((pq, pqIndex) => {
+ // loop through this glass part's questions, looking for a questionText match
+ glass.questions.forEach((pq, pqIndex) => {
// clear out any previously set answers
pq.answerSelected = null;
@@ -229,11 +221,11 @@ export default {
// if these match then we have a duplicate question
if (pq.questionText.toUpperCase() === answeredQuestionText) {
- const thisAnsweredPartQuestion = glassPart.partQuestions[pqIndex];
+ const thisAnsweredQuestion = glass.questions[pqIndex];
let matchedAnswer;
let rejectedAnswers = []; // set as an array, in case we ever have questions with more than 2 answers...
- // which one of this partQuestions' answers matches our answer?
+ // which one of this questions' answers matches our answer?
pq.answers.forEach((ans) => {
if (ans.answerText.toUpperCase() === answeredQuestionAnswer) {
matchedAnswer = ans;
@@ -251,7 +243,7 @@ export default {
if (matchedAnswer.nextQuestionSequence) {
// ensure that the question that the accepted answer has set to be next is NOT suppressed
- glassPart.partQuestions[matchedAnswer.nextQuestionSequence - 1].suppressQuestion = null;
+ glass.questions[matchedAnswer.nextQuestionSequence - 1].suppressQuestion = null;
// if the duplicate is the 1ST question, then set suppressUntil var to lowest nextQuestion number
if (pqIndex === 0) {
if (!suppressUntil) { suppressUntil = matchedAnswer.nextQuestionSequence }
@@ -260,7 +252,7 @@ export default {
}
// handle suppressing upstream in this question chain
- glassPart.partQuestions.forEach((q) => {
+ glass.questions.forEach((q) => {
q.answers.forEach((thisAns) => {
// restore any of the answers that formerly led to the duplicated question
if (thisAns.originalNextQuestionSequence === pq.questionSequence) {
@@ -290,19 +282,19 @@ export default {
});
// suppress current question
- thisAnsweredPartQuestion.suppressQuestion = true;
+ thisAnsweredQuestion.suppressQuestion = true;
- const thisGlassPart = "glassPart" + gpIndex;
+ const thisGlassPart = "glass" + gpIndex;
if (this.foundDuplicateQuestions[thisGlassPart]) {
- if (!this.foundDuplicateQuestions[thisGlassPart].includes(thisAnsweredPartQuestion.questionSequence)) {
- this.foundDuplicateQuestions[thisGlassPart].push(thisAnsweredPartQuestion.questionSequence);
+ if (!this.foundDuplicateQuestions[thisGlassPart].includes(thisAnsweredQuestion.questionSequence)) {
+ this.foundDuplicateQuestions[thisGlassPart].push(thisAnsweredQuestion.questionSequence);
}
} else {
- this.foundDuplicateQuestions[thisGlassPart] = [thisAnsweredPartQuestion.questionSequence];
+ this.foundDuplicateQuestions[thisGlassPart] = [thisAnsweredQuestion.questionSequence];
}
// are there any questions left that are not suppressed?
- const remainingQuestions = glassPart.partQuestions.filter((q) => {
+ const remainingQuestions = glass.questions.filter((q) => {
return !q.suppressQuestion;
});
@@ -317,13 +309,13 @@ export default {
suppressQuestion: pq.suppressQuestion,
};
// set the answerData as 'already answered'
- glassPart.answerData = {
+ glass.answerData = {
answerResult: matchedAnswer.nextQuestionSequence ? matchedAnswer.nextQuestionSequence : matchedAnswer.answerResult,
answeredQuestions: [answeredQuestionObj],
};
- // suppress this glassPart because it has an answer
- glassPart.isSuppressedPart = true;
+ // suppress this glass because it has an answer
+ glass.isSuppressedPart = true;
}
}
@@ -351,16 +343,16 @@ export default {
// "glassPart2": [7, 10]
// };
- const thisPartsDupes = this.foundDuplicateQuestions["glassPart" + answer.partIndex];
+ const thisPartsDupes = this.foundDuplicateQuestions["glass" + answer.glassIndex];
const completeAnsweredQuestions = answer.answeredQuestions ? [...answer.answeredQuestions] : [];
- const glassPartAnswered = this.partsQuestionsData[answer.partIndex];
+ const glassPartAnswered = this.partsQuestionsData[answer.glassIndex];
thisPartsDupes?.forEach((dupe) => {
// dupe is a single integer
- const dupeQuestion = glassPartAnswered.partQuestions[dupe - 1];
+ const dupeQuestion = glassPartAnswered.questions[dupe - 1];
const dupeQuestionAnswer = dupeQuestion.answers.find((q) => q.selected === true);
- glassPartAnswered.partQuestions.forEach((q) => {
+ glassPartAnswered.questions.forEach((q) => {
let includeThisDupeInAnsweredQuestions = false;
// did one of the answers of this question point to the duplicated question?
@@ -404,25 +396,28 @@ export default {
}
// this part has been fully answered, so advance to next part's question chain
- for (let i = answer.partIndex + 1; i < this.partsQuestionsData.length; i++) {
+ for (let i = answer.glassIndex + 1; i < this.partsQuestionsData.length; i++) {
// if this part has not yet been fully answered, then make it the current part
if (!this.partsQuestionsData[i].answerData?.answerResult) {
- this.currentPartNum = i;
+ this.currentGlassIndex = i;
break;
}
}
},
- LoadInitialPartsData() {
+ LoadInitialData() {
// are there alreadyAnsweredQuestions?
const alreadyAnsweredQuestions = store.getters.damage.partQuestionAnswers;
-
- this.partsQuestionsData = this.partsQuestionsFromApi.map((part, i) => {
- part.key = part.glassLocation + "-" + part.glassName;
- this.selectedAnswers[part.key] = [];
+
+ this.partsQuestionsData = this.pageData.partsOrQuestions.filter(x => x.partQuestions).map((glass, i) => {
+ glass.key = glass.glassLocation + "-" + glass.glassName;
+ // NOTE: property "questions" can differ between layouts
+ glass.questions = glass.partQuestions;
+
+ this.selectedAnswers[glass.key] = [];
if (!alreadyAnsweredQuestions) {
- part.answerData = null;
+ glass.answerData = null;
}
alreadyAnsweredQuestions?.forEach((savedPart) => {
@@ -430,7 +425,7 @@ export default {
if (!savedPart.glassLocation || !savedPart.glassName || !savedPart.answeredQuestions || !savedPart.result) {
return;
}
- if (part.glassLocation === savedPart.glassLocation && part.glassName === savedPart.glassName) {
+ if (glass.glassLocation === savedPart.glassLocation && glass.glassName === savedPart.glassName) {
let answerString = "";
// matches; loop through answeredQuestions for matches
@@ -439,7 +434,7 @@ export default {
return;
}
// determine which answer was previously chosen
- const theAns = part.partQuestions[aq.questionNum-1].answers.find((a) => {
+ const theAns = glass.questions[aq.questionNum-1].answers.find((a) => {
return a.answerText.toUpperCase() === aq.selectedAnswerText.toUpperCase();
});
if (theAns.nextQuestionSequence) {
@@ -448,19 +443,19 @@ export default {
answerString = `${aq.questionNum}|answer|${theAns.answerResult}|${theAns.answerText}`
}
- // mark this partQuestion as answered (question-chain will read this)
- part.partQuestions[aq.questionNum-1].answerSelected = answerString;
- // mark this partQuestion as duplicate if it is (question-chain will read this)
+ // mark this question as answered (question-chain will read this)
+ glass.questions[aq.questionNum-1].answerSelected = answerString;
+ // mark this question as duplicate if it is (question-chain will read this)
if (aq.suppressQuestion) {
- part.partQuestions[aq.questionNum-1].suppressQuestion = true;
+ glass.questions[aq.questionNum-1].suppressQuestion = true;
}
});
- // advance the currentPartNum
- this.currentPartNum = i;
+ // advance the currentGlassIndex
+ this.currentGlassIndex = i;
- // add answerData to current part
- part.answerData = {
+ // add answerData to current glass
+ glass.answerData = {
answerResult: savedPart.result,
answeredQuestions: savedPart.answeredQuestions
}
@@ -468,14 +463,14 @@ export default {
});
- // Set up watch for each set of part questions, which gets updated when all questions for a part have been answered
- this.$watch("selectedAnswers." + part.key, (newValue) => {
+ // Set up watch for each set of glass questions, which gets updated when all questions for a glass have been answered
+ this.$watch("selectedAnswers." + glass.key, (newValue) => {
if (newValue) {
- this.handleAnswerUpdates(part.key, newValue);
+ this.handleAnswerUpdates(glass.key, newValue);
}
}, {deep: true})
- return part;
+ return glass;
});
},
diff --git a/src/layouts/vehicle-make/vehicle-make.vue b/src/layouts/vehicle-make/vehicle-make.vue
index 3b3121dad..f5a42eefe 100644
--- a/src/layouts/vehicle-make/vehicle-make.vue
+++ b/src/layouts/vehicle-make/vehicle-make.vue
@@ -66,7 +66,6 @@ export default {
);
});
},
-
methods: {
backButtonAction() {
// route to move backwards
diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue
index a276ef132..6f81b0003 100644
--- a/src/layouts/vehicle-parts/vehicle-parts.vue
+++ b/src/layouts/vehicle-parts/vehicle-parts.vue
@@ -188,6 +188,8 @@ export default {
throw new Error("Could not match any parts to the selected parts");
}
+ await this.dispatchStoreAction(this.storeActions.RESET_MOLDING_AND_CAPABILITY_QUESTIONS_IF_NEEDED, matchedParts, false);
+
// Navigate to the next page
this.navigateForward(matchedParts);
},
diff --git a/src/mixins/experiment-mixin.js b/src/mixins/experiment-mixin.js
index 8816b1f0b..2a6b10f34 100644
--- a/src/mixins/experiment-mixin.js
+++ b/src/mixins/experiment-mixin.js
@@ -3,10 +3,10 @@ import store from "@/store";
export default {
methods: {
hasSettingEqualTo(settingName, settingValue) {
- return store.getters.experimentSettings[settingName] === settingValue;
+ return store.getters.experimentSettings[settingName] == settingValue;
},
hasSetting(settingName) {
- return store.getters.experimentSettings.hasOwnProperty(settingName);
+ return Object.hasOwn(store.getters.experimentSettings, settingName);
},
getSettingValue(settingName) {
return this.hasSetting(settingName) ? store.getters.experimentSettings[settingName] : null;
diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js
index 06776174f..616c1fb5e 100644
--- a/src/mixins/vehicle-questions-mixin.js
+++ b/src/mixins/vehicle-questions-mixin.js
@@ -122,7 +122,7 @@ export default {
}
},
backButtonAction() {
- const partsOrQuestions = this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS)?.partsOrQuestions;
+ const partsOrQuestions = (this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS) ?? this.$store.getters.pageData(fmgPageValues.VEHICLE_PARTS))?.partsOrQuestions;
const hasPartQuestions = this.hasPartQuestions(partsOrQuestions);
const hasGlassLocationWithMultipleParts = this.hasGlassLocationWithMultipleParts(partsOrQuestions);
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
diff --git a/src/store/index.js b/src/store/index.js
index 9c81b88e0..0a57a82a3 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -49,6 +49,7 @@ const getDefaultState = () => {
numberOfChips: null,
glassToReplace: null,
partQuestionAnswers: null,
+ moldingQuestionAnswers: null,
capabilityQuestionAnswers: null
},
lineItems: {
@@ -127,6 +128,9 @@ export const mutations = {
updatePartQuestionAnswers(state, answersArray) {
state.order.damage.partQuestionAnswers = answersArray;
},
+ updateMoldingQuestionAnswers(state, answersArray) {
+ state.order.damage.moldingQuestionAnswers = answersArray;
+ },
updateCapabilityQuestionAnswers(state, answersArray) {
state.order.damage.capabilityQuestionAnswers = answersArray;
},
@@ -221,7 +225,7 @@ export const mutations = {
},
// applicationUser MUTATIONS
- updateSaveOrderPromise(state, saveOrderPromise){
+ updateSaveOrderPromise(state, saveOrderPromise) {
state.applicationUser.saveOrderPromise = saveOrderPromise;
},
updateSavedSessionId(state, savedSessionId) {
@@ -281,6 +285,7 @@ export const mutations = {
resetGlassPartsState(state) {
state.order.lineItems.glassParts = null;
state.order.damage.partQuestionAnswers = null;
+ state.order.damage.moldingQuestionAnswers = null;
state.order.damage.capabilityQuestionAnswers = null;
state.applicationUser.pageData[fmgPageValues.PART_QUESTIONS] = null;
state.applicationUser.pageData[fmgPageValues.VEHICLE_PARTS] = null;
@@ -374,29 +379,31 @@ export const getters = {
payment: (state) => state.order.payment,
experimentOrder: (state) => {
return {
- vehicleYear: state.order.vehicle.year,
- vehicleMake: state.order.vehicle.make,
- vehicleModel: state.order.vehicle.model,
- vehicleStyle: state.order.vehicle.style,
- isRepair: state.order.damage.isRepair,
- numberOfChips: state.order.damage.numberOfChips,
- carId: state.order.vehicle.carId,
- serviceCity: state.order.serviceLocation.city,
- serviceState: state.order.serviceLocation.state,
- serviceZipCode: state.order.serviceLocation.zipCode,
- parentAccountNumber: state.order.accountNumber,
- isCoverageVerified: state.order.payment.insuranceCoverage.isVerified,
- orderPartNumbers: [...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "partNumber"), ...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts, "partNumber")],
- orderPartTypes: [...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "recalibrationType"), ...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts, "recalibrationType")],
- hasRecalibrationPart: getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "requiresRecalibration")?.length > 0,
- selectedMultiGlass: state.order.damage.glassToReplace?.length > 1,
- selectedWindshieldGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.WINDSHIELD),
- selectedBackGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.REAR),
- selectedDriverSideGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.DRIVER),
- selectedPassengerSideGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.PASSENGER)
+ funnelVehicleYear: state.order.vehicle.year,
+ funnelVehicleMake: state.order.vehicle.make,
+ funnelVehicleModel: state.order.vehicle.model,
+ funnelVehicleStyle: state.order.vehicle.style,
+ funnelIsRepair: state.order.damage.isRepair,
+ funnelNumberOfChips: state.order.damage.numberOfChips,
+ funnelCarId: state.order.vehicle.carId,
+ funnelServiceCity: state.order.serviceLocation.city,
+ funnelServiceState: state.order.serviceLocation.state,
+ funnelServiceZipCode: state.order.serviceLocation.zipCode,
+ funnelParentAccountNumber: state.order.accountNumber,
+ funnelIsCoverageVerified: state.order.payment.insuranceCoverage.isVerified,
+ funnelHasRecalibrationPart: getHasRecalibrationPart(state),
+ funnelSelectedMultiGlass: state.order.damage.glassToReplace?.length > 1,
+ funnelSelectedWindshieldGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.WINDSHIELD),
+ funnelSelectedBackGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.REAR),
+ funnelSelectedDriverSideGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.DRIVER),
+ funnelSelectedPassengerSideGlass: getAllValuesOfPropertyInArrayOfObjects(state.order.damage.glassToReplace, "glassLocation").includes(damageLocationsSelected.PASSENGER),
+
+ funnelOrderPartNumbers: [...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "partNumber"), ...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts, "partNumber")],
+
+ funnelOrderPartTypes: [...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "recalibrationType"), ...getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.otherParts, "recalibrationType")],
}
},
- experimentSettings: (state) => state.applicationUser.experiments.map(x => x.settings).reduce((r, c) => Object.assign(r, c), {})
+ experimentSettings: (state) => state.applicationUser.experiments.map(x => x.settings).reduce((r, c) => Object.assign(r, c), {}) ?? {}
}
function getAllValuesOfPropertyInArrayOfObjects(array, propertyName) {
@@ -755,7 +762,7 @@ export const actions = {
const part = pageData.partsOrQuestions.find(x => x.glassLocation === glassLocation).parts[0];
const capabilityQuestionAnswers = context.getters.damage.capabilityQuestionAnswers;
const capabilityQuestionAnswersForPart = capabilityQuestionAnswers.find(x => x.glassLocation === glassLocation);
-
+
return globalMethods.callHttpClient({
method: endpoints.GetPartFromCapabilityAnswer.method,
endpoint: endpoints.GetPartFromCapabilityAnswer.url,
@@ -1002,13 +1009,63 @@ export const actions = {
!previousResultsArray.every((x, i) => x.result === partQuestionAnswersArray[i].result);
if (havePartQuestionAnswersChanged) {
+ context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
+ context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
+ context.commit(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.VEHICLE_PARTS, data: null });
+ context.commit(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.MOLDING_QUESTIONS, data: null });
+ context.commit(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.CAPABILITY_QUESTIONS, data: null });
}
//Save new values
context.commit(storeMutations.UPDATE_PART_QUESTION_ANSWERS, partQuestionAnswersArray);
},
+ resetMoldingAndCapabilityQuestionAnswersIfNeeded(context, matchedParts) {
+ const previousResultsArray = [{ parts: context.getters.lineItems.glassParts }];
+ const partsOrQuestionsDataToCompareWith = context.getters.pageData(fmgPageValues.MOLDING_QUESTIONS)?.partsOrQuestions ?? context.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS)?.partsOrQuestions ?? [];
+
+ function getAllPartNumbers(partsOrQuestions) {
+ return partsOrQuestions[0]?.parts
+ ? [...partsOrQuestions].map(glass => glass.parts).flat().map(part => part.partNumber).filter(partNumber => !partNumber.toUpperCase().includes("FEE")).sort().join(",")
+ : []
+ }
+
+ const previouslySelectedPartNumbers = getAllPartNumbers(partsOrQuestionsDataToCompareWith);
+ const currentlySelectedPartNumbers = getAllPartNumbers(matchedParts);
+
+ const haveSelectedVehiclePartsChanged = previouslySelectedPartNumbers !== currentlySelectedPartNumbers;
+
+ if (haveSelectedVehiclePartsChanged) {
+ context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
+ context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
+ context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
+ context.commit(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.MOLDING_QUESTIONS, data: null });
+ context.commit(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.CAPABILITY_QUESTIONS, data: null });
+ }
+ },
+ saveMoldingQuestionAnswers(context, moldingQuestionAnswers) {
+ const previousResultsArray = context.getters.damage.moldingQuestionAnswers;
+ const haveMoldingQuestionAnswersChanged = previousResultsArray?.length !== moldingQuestionAnswers.length ||
+ !previousResultsArray.every((x, i) => x.partNum === moldingQuestionAnswers[i].partNum);
+
+ if (haveMoldingQuestionAnswersChanged) {
+ context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
+ context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
+ context.commit(storeMutations.UPDATE_PAGE_DATA, { page: fmgPageValues.CAPABILITY_QUESTIONS, data: null });
+ }
+
+ //Save new values
+ context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, moldingQuestionAnswers);
+ },
saveCapabilityQuestionAnswers(context, capabilityQuestionAnswers) {
+ const previousResultsArray = context.getters.damage.capabilityQuestionAnswers;
+ const haveCapabilityQuestionAnswersChanged = previousResultsArray?.length !== capabilityQuestionAnswers.length ||
+ !previousResultsArray.every((x, i) => x.result === capabilityQuestionAnswers[i].result);
+
+ if (haveCapabilityQuestionAnswersChanged) {
+ context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
+ }
+
//Save new values
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, capabilityQuestionAnswers);
},
@@ -1055,3 +1112,18 @@ export default createStore({
// Private Functions
+function getHasRecalibrationPart(state) {
+ var hasRequiresRecalibration = getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "requiresRecalibration")?.length > 0;
+ var hasRecalibrationType = getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "recalibrationType")?.length > 0;
+
+ if (hasRequiresRecalibration) {
+ if (hasRecalibrationType) { // Has both 'requiresRecalibration' and 'recalibrationType' and 'recalibrationType'
+ return getAllValuesOfPropertyInArrayOfObjects(state.order.lineItems.glassParts, "recalibrationType")[0].toLowerCase() != "unknown";
+ } else { // Has 'requiresRecalibration' but no 'recalibrationType' at all
+ return true;
+ }
+ } else { // Does not have 'requiresRecalibration'
+ return false;
+ }
+
+}
\ No newline at end of file
diff --git a/src/store/store.spec.js b/src/store/store.spec.js
index a69be855b..8a710fe99 100644
--- a/src/store/store.spec.js
+++ b/src/store/store.spec.js
@@ -1154,6 +1154,49 @@ describe("Actions", () => {
]);
});
})
+
+ describe("savePartQuestionAnswers", () => {
+ test.todo("saves partQuestionAnswers")
+
+ test.todo("there are no previous answers => resets necessary fields")
+
+ // mix up the order to make sure sort is working
+ test.todo("previous answers match current answers => does not reset fields")
+
+ test.todo("previous answers does not match current answers => resets necessary fields")
+ })
+
+ describe("resetMoldingAndCapabilityQuestionAnswersIfNeeded", () => {
+ test.todo("there are no saved parts => resets necessary fields")
+
+ // make sure you check the different variations where molding-questions and capability-questions do or don't have pageData
+ // mix up the order to make sure sort is working
+ test.todo("previously saved parts match selected parts => does not reset fields")
+
+ test.todo("previously saved parts do not match selected parts => resets necessary fields")
+ })
+
+ describe("saveMoldingQuestionAnswers", () => {
+ test.todo("saves moldingQuestionAnswers")
+
+ test.todo("there are no previous answers => resets necessary fields")
+
+ // mix up the order to make sure sort is working
+ test.todo("previous answers match current answers => does not reset fields")
+
+ test.todo("previous answers does not match current answers => resets necessary fields")
+ })
+
+ describe("saveCapabilityQuestionAnswers", () => {
+ test.todo("saves capabilityQuestionAnswers")
+
+ test.todo("there are no previous answers => resets necessary fields")
+
+ // mix up the order to make sure sort is working
+ test.todo("previous answers match current answers => does not reset fields")
+
+ test.todo("previous answers does not match current answers => resets necessary fields")
+ })
});
@@ -1256,64 +1299,64 @@ describe("Getters", () => {
// Arrange
const storeState = state;
const mockStateValues = {
- vehicleYear: 1000,
- vehicleMake: "CarMake",
- vehicleModel: "CarModel",
- vehicleStyle: "SuperCoolStyle",
- isRepair: true,
- numberOfChips: 9999999,
- carId: "Gibberish",
- serviceCity: "Columbus",
- serviceState: "OH-IO",
- serviceZipCode: 43215,
- parentAccountNumber: "999999",
- isCoverageVerified: true,
- glassParts: null,
- otherParts: null,
- glassToReplace: null
+ funnelVehicleYear: 1000,
+ funnelVehicleMake: "CarMake",
+ funnelVehicleModel: "CarModel",
+ funnelVehicleStyle: "SuperCoolStyle",
+ funnelIsRepair: true,
+ funnelNumberOfChips: 9999999,
+ funnelCarId: "Gibberish",
+ funnelServiceCity: "Columbus",
+ funnelServiceState: "OH-IO",
+ funnelServiceZipCode: 43215,
+ funnelParentAccountNumber: "999999",
+ funnelIsCoverageVerified: true,
+ funnelGlassParts: null,
+ funnelOtherParts: null,
+ funnelGlassToReplace: null
}
//Act
- mutations.updateYear(storeState, mockStateValues.vehicleYear);
- mutations.updateMake(storeState, mockStateValues.vehicleMake);
- mutations.updateModel(storeState, mockStateValues.vehicleModel);
- mutations.updateStyle(storeState, mockStateValues.vehicleStyle);
- mutations.updateIsRepair(storeState, mockStateValues.isRepair);
- mutations.updateNumberOfChips(storeState, mockStateValues.numberOfChips);
- mutations.updateCarId(storeState, mockStateValues.carId);
+ mutations.updateYear(storeState, mockStateValues.funnelVehicleYear);
+ mutations.updateMake(storeState, mockStateValues.funnelVehicleMake);
+ mutations.updateModel(storeState, mockStateValues.funnelVehicleModel);
+ mutations.updateStyle(storeState, mockStateValues.funnelVehicleStyle);
+ mutations.updateIsRepair(storeState, mockStateValues.funnelIsRepair);
+ mutations.updateNumberOfChips(storeState, mockStateValues.funnelNumberOfChips);
+ mutations.updateCarId(storeState, mockStateValues.funnelCarId);
mutations.updateServiceLocation(storeState, {
- city: mockStateValues.serviceCity,
- state: mockStateValues.serviceState,
- zipCode: mockStateValues.serviceZipCode
+ city: mockStateValues.funnelServiceCity,
+ state: mockStateValues.funnelServiceState,
+ zipCode: mockStateValues.funnelServiceZipCode
});
- mutations.updateParentAcctNumber(storeState, mockStateValues.parentAccountNumber);
- mutations.updateInsuranceVerifiedStatus(storeState, mockStateValues.isCoverageVerified);
- mutations.updateGlassParts(storeState, mockStateValues.glassParts);
- mutations.updateOtherParts(storeState, mockStateValues.otherParts);
- mutations.updateGlassToReplace(storeState, mockStateValues.glassToReplace);
+ mutations.updateParentAcctNumber(storeState, mockStateValues.funnelParentAccountNumber);
+ mutations.updateInsuranceVerifiedStatus(storeState, mockStateValues.funnelIsCoverageVerified);
+ mutations.updateGlassParts(storeState, mockStateValues.funnelGlassParts);
+ mutations.updateOtherParts(storeState, mockStateValues.funnelOtherParts);
+ mutations.updateGlassToReplace(storeState, mockStateValues.funnelGlassToReplace);
//Assert
expect(getters.experimentOrder(storeState)).toEqual({
- vehicleYear: mockStateValues.vehicleYear,
- vehicleMake: mockStateValues.vehicleMake,
- vehicleModel: mockStateValues.vehicleModel,
- vehicleStyle: mockStateValues.vehicleStyle,
- isRepair: mockStateValues.isRepair,
- numberOfChips: mockStateValues.numberOfChips,
- carId: mockStateValues.carId,
- serviceCity: mockStateValues.serviceCity,
- serviceState: mockStateValues.serviceState,
- serviceZipCode: mockStateValues.serviceZipCode,
- parentAccountNumber: mockStateValues.parentAccountNumber,
- isCoverageVerified: mockStateValues.isCoverageVerified,
- orderPartNumbers: [],
- orderPartTypes: [],
- hasRecalibrationPart: false,
- selectedMultiGlass: false,
- selectedWindshieldGlass: false,
- selectedBackGlass: false,
- selectedDriverSideGlass: false,
- selectedPassengerSideGlass: false
+ funnelVehicleYear: mockStateValues.funnelVehicleYear,
+ funnelVehicleMake: mockStateValues.funnelVehicleMake,
+ funnelVehicleModel: mockStateValues.funnelVehicleModel,
+ funnelVehicleStyle: mockStateValues.funnelVehicleStyle,
+ funnelIsRepair: mockStateValues.funnelIsRepair,
+ funnelNumberOfChips: mockStateValues.funnelNumberOfChips,
+ funnelCarId: mockStateValues.funnelCarId,
+ funnelServiceCity: mockStateValues.funnelServiceCity,
+ funnelServiceState: mockStateValues.funnelServiceState,
+ funnelServiceZipCode: mockStateValues.funnelServiceZipCode,
+ funnelParentAccountNumber: mockStateValues.funnelParentAccountNumber,
+ funnelIsCoverageVerified: mockStateValues.funnelIsCoverageVerified,
+ funnelOrderPartNumbers: [],
+ funnelOrderPartTypes: [],
+ funnelHasRecalibrationPart: false,
+ funnelSelectedMultiGlass: false,
+ funnelSelectedWindshieldGlass: false,
+ funnelSelectedBackGlass: false,
+ funnelSelectedDriverSideGlass: false,
+ funnelSelectedPassengerSideGlass: false
});
});
@@ -1321,64 +1364,64 @@ describe("Getters", () => {
// Arrange
const storeState = state;
const mockStateValues = {
- vehicleYear: 1000,
- vehicleMake: "CarMake",
- vehicleModel: "CarModel",
- vehicleStyle: "SuperCoolStyle",
- isRepair: true,
- numberOfChips: 9999999,
- carId: "Gibberish",
- serviceCity: "Columbus",
- serviceState: "OH-IO",
- serviceZipCode: 43215,
- parentAccountNumber: "999999",
- isCoverageVerified: true,
- glassParts: [],
- otherParts: [],
- glassToReplace: []
+ funnelVehicleYear: 1000,
+ funnelVehicleMake: "CarMake",
+ funnelVehicleModel: "CarModel",
+ funnelVehicleStyle: "SuperCoolStyle",
+ funnelIsRepair: true,
+ funnelNumberOfChips: 9999999,
+ funnelCarId: "Gibberish",
+ funnelServiceCity: "Columbus",
+ funnelServiceState: "OH-IO",
+ funnelServiceZipCode: 43215,
+ funnelParentAccountNumber: "999999",
+ funnelIsCoverageVerified: true,
+ funnelGlassParts: [],
+ funnelOtherParts: [],
+ funnelGlassToReplace: []
}
//Act
- mutations.updateYear(storeState, mockStateValues.vehicleYear);
- mutations.updateMake(storeState, mockStateValues.vehicleMake);
- mutations.updateModel(storeState, mockStateValues.vehicleModel);
- mutations.updateStyle(storeState, mockStateValues.vehicleStyle);
- mutations.updateIsRepair(storeState, mockStateValues.isRepair);
- mutations.updateNumberOfChips(storeState, mockStateValues.numberOfChips);
- mutations.updateCarId(storeState, mockStateValues.carId);
+ mutations.updateYear(storeState, mockStateValues.funnelVehicleYear);
+ mutations.updateMake(storeState, mockStateValues.funnelVehicleMake);
+ mutations.updateModel(storeState, mockStateValues.funnelVehicleModel);
+ mutations.updateStyle(storeState, mockStateValues.funnelVehicleStyle);
+ mutations.updateIsRepair(storeState, mockStateValues.funnelIsRepair);
+ mutations.updateNumberOfChips(storeState, mockStateValues.funnelNumberOfChips);
+ mutations.updateCarId(storeState, mockStateValues.funnelCarId);
mutations.updateServiceLocation(storeState, {
- city: mockStateValues.serviceCity,
- state: mockStateValues.serviceState,
- zipCode: mockStateValues.serviceZipCode
+ city: mockStateValues.funnelServiceCity,
+ state: mockStateValues.funnelServiceState,
+ zipCode: mockStateValues.funnelServiceZipCode
});
- mutations.updateParentAcctNumber(storeState, mockStateValues.parentAccountNumber);
- mutations.updateInsuranceVerifiedStatus(storeState, mockStateValues.isCoverageVerified);
- mutations.updateGlassParts(storeState, mockStateValues.glassParts);
- mutations.updateOtherParts(storeState, mockStateValues.otherParts);
- mutations.updateGlassToReplace(storeState, mockStateValues.glassToReplace);
+ mutations.updateParentAcctNumber(storeState, mockStateValues.funnelParentAccountNumber);
+ mutations.updateInsuranceVerifiedStatus(storeState, mockStateValues.funnelIsCoverageVerified);
+ mutations.updateGlassParts(storeState, mockStateValues.funnelGlassParts);
+ mutations.updateOtherParts(storeState, mockStateValues.funnelOtherParts);
+ mutations.updateGlassToReplace(storeState, mockStateValues.funnelGlassToReplace);
//Assert
expect(getters.experimentOrder(storeState)).toEqual({
- vehicleYear: mockStateValues.vehicleYear,
- vehicleMake: mockStateValues.vehicleMake,
- vehicleModel: mockStateValues.vehicleModel,
- vehicleStyle: mockStateValues.vehicleStyle,
- isRepair: mockStateValues.isRepair,
- numberOfChips: mockStateValues.numberOfChips,
- carId: mockStateValues.carId,
- serviceCity: mockStateValues.serviceCity,
- serviceState: mockStateValues.serviceState,
- serviceZipCode: mockStateValues.serviceZipCode,
- parentAccountNumber: mockStateValues.parentAccountNumber,
- isCoverageVerified: mockStateValues.isCoverageVerified,
- orderPartNumbers: [],
- orderPartTypes: [],
- hasRecalibrationPart: false,
- selectedMultiGlass: false,
- selectedWindshieldGlass: false,
- selectedBackGlass: false,
- selectedDriverSideGlass: false,
- selectedPassengerSideGlass: false
+ funnelVehicleYear: mockStateValues.funnelVehicleYear,
+ funnelVehicleMake: mockStateValues.funnelVehicleMake,
+ funnelVehicleModel: mockStateValues.funnelVehicleModel,
+ funnelVehicleStyle: mockStateValues.funnelVehicleStyle,
+ funnelIsRepair: mockStateValues.funnelIsRepair,
+ funnelNumberOfChips: mockStateValues.funnelNumberOfChips,
+ funnelCarId: mockStateValues.funnelCarId,
+ funnelServiceCity: mockStateValues.funnelServiceCity,
+ funnelServiceState: mockStateValues.funnelServiceState,
+ funnelServiceZipCode: mockStateValues.funnelServiceZipCode,
+ funnelParentAccountNumber: mockStateValues.funnelParentAccountNumber,
+ funnelIsCoverageVerified: mockStateValues.funnelIsCoverageVerified,
+ funnelOrderPartNumbers: [],
+ funnelOrderPartTypes: [],
+ funnelHasRecalibrationPart: false,
+ funnelSelectedMultiGlass: false,
+ funnelSelectedWindshieldGlass: false,
+ funnelSelectedBackGlass: false,
+ funnelSelectedDriverSideGlass: false,
+ funnelSelectedPassengerSideGlass: false
});
});
@@ -1439,26 +1482,26 @@ describe("Getters", () => {
//Assert
expect(getters.experimentOrder(storeState)).toEqual({
- vehicleYear: mockStateValues.vehicleYear,
- vehicleMake: mockStateValues.vehicleMake,
- vehicleModel: mockStateValues.vehicleModel,
- vehicleStyle: mockStateValues.vehicleStyle,
- isRepair: mockStateValues.isRepair,
- numberOfChips: mockStateValues.numberOfChips,
- carId: mockStateValues.carId,
- serviceCity: mockStateValues.serviceCity,
- serviceState: mockStateValues.serviceState,
- serviceZipCode: mockStateValues.serviceZipCode,
- parentAccountNumber: mockStateValues.parentAccountNumber,
- isCoverageVerified: mockStateValues.isCoverageVerified,
- orderPartNumbers: ["WINDSHIELDPARTNUMBER"],
- orderPartTypes: ["ADAS, maybe"],
- hasRecalibrationPart: true,
- selectedMultiGlass: false,
- selectedWindshieldGlass: true,
- selectedBackGlass: false,
- selectedDriverSideGlass: false,
- selectedPassengerSideGlass: false
+ funnelVehicleYear: mockStateValues.vehicleYear,
+ funnelVehicleMake: mockStateValues.vehicleMake,
+ funnelVehicleModel: mockStateValues.vehicleModel,
+ funnelVehicleStyle: mockStateValues.vehicleStyle,
+ funnelIsRepair: mockStateValues.isRepair,
+ funnelNumberOfChips: mockStateValues.numberOfChips,
+ funnelCarId: mockStateValues.carId,
+ funnelServiceCity: mockStateValues.serviceCity,
+ funnelServiceState: mockStateValues.serviceState,
+ funnelServiceZipCode: mockStateValues.serviceZipCode,
+ funnelParentAccountNumber: mockStateValues.parentAccountNumber,
+ funnelIsCoverageVerified: mockStateValues.isCoverageVerified,
+ funnelOrderPartNumbers: ["WINDSHIELDPARTNUMBER"],
+ funnelOrderPartTypes: ["ADAS, maybe"],
+ funnelHasRecalibrationPart: true,
+ funnelSelectedMultiGlass: false,
+ funnelSelectedWindshieldGlass: true,
+ funnelSelectedBackGlass: false,
+ funnelSelectedDriverSideGlass: false,
+ funnelSelectedPassengerSideGlass: false
});
});
@@ -1545,26 +1588,26 @@ describe("Getters", () => {
//Assert
expect(getters.experimentOrder(storeState)).toEqual({
- vehicleYear: mockStateValues.vehicleYear,
- vehicleMake: mockStateValues.vehicleMake,
- vehicleModel: mockStateValues.vehicleModel,
- vehicleStyle: mockStateValues.vehicleStyle,
- isRepair: mockStateValues.isRepair,
- numberOfChips: mockStateValues.numberOfChips,
- carId: mockStateValues.carId,
- serviceCity: mockStateValues.serviceCity,
- serviceState: mockStateValues.serviceState,
- serviceZipCode: mockStateValues.serviceZipCode,
- parentAccountNumber: mockStateValues.parentAccountNumber,
- isCoverageVerified: mockStateValues.isCoverageVerified,
- orderPartNumbers: ["BACKGLASS_PN", "DRIVERGLASS_PN", "PASSENGERGLASS_PN"],
- orderPartTypes: [],
- hasRecalibrationPart: false,
- selectedMultiGlass: true,
- selectedWindshieldGlass: false,
- selectedBackGlass: true,
- selectedDriverSideGlass: true,
- selectedPassengerSideGlass: true
+ funnelVehicleYear: mockStateValues.vehicleYear,
+ funnelVehicleMake: mockStateValues.vehicleMake,
+ funnelVehicleModel: mockStateValues.vehicleModel,
+ funnelVehicleStyle: mockStateValues.vehicleStyle,
+ funnelIsRepair: mockStateValues.isRepair,
+ funnelNumberOfChips: mockStateValues.numberOfChips,
+ funnelCarId: mockStateValues.carId,
+ funnelServiceCity: mockStateValues.serviceCity,
+ funnelServiceState: mockStateValues.serviceState,
+ funnelServiceZipCode: mockStateValues.serviceZipCode,
+ funnelParentAccountNumber: mockStateValues.parentAccountNumber,
+ funnelIsCoverageVerified: mockStateValues.isCoverageVerified,
+ funnelOrderPartNumbers: ["BACKGLASS_PN", "DRIVERGLASS_PN", "PASSENGERGLASS_PN"],
+ funnelOrderPartTypes: [],
+ funnelHasRecalibrationPart: false,
+ funnelSelectedMultiGlass: true,
+ funnelSelectedWindshieldGlass: false,
+ funnelSelectedBackGlass: true,
+ funnelSelectedDriverSideGlass: true,
+ funnelSelectedPassengerSideGlass: true
});
});
})
diff --git a/src/styles/common-typography-styles.scss b/src/styles/common-typography-styles.scss
index 8d011e61e..9ee9aa286 100644
--- a/src/styles/common-typography-styles.scss
+++ b/src/styles/common-typography-styles.scss
@@ -64,4 +64,4 @@ caption,
font-size: 1rem !important;
line-height: 1.4;
font-weight: 500;
-}
+}
\ No newline at end of file