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personality/Answer.vue?ae6f","webpack://beliefnet-frontend/./src/components/quiz/personality/Answer.vue"],"sourcesContent":["import { defineStore } from 'pinia';\n\nexport const usePersonalityQuizStore = defineStore('PersonalityQuiz', {\n state: () => {\n return {\n correctAnswer: [] as number[],\n weight: [] as number[],\n answerTypeQuiz: false\n };\n },\n getters: {\n total: (state) => state.weight.reduce((a, b) => a + b),\n getNumberOfCorrectAnswers(state) {\n let count = 0;\n\n // count the number of correct answers\n state.weight.forEach((answer, index) => {\n if (index + 1 <= state.correctAnswer.length) {\n if (answer == state.correctAnswer[index]) {\n count++;\n }\n }\n });\n\n return count;\n },\n isAnswerTypeQuiz: (state) => state.answerTypeQuiz,\n canShowUserResult(state) {\n // only show if there aren't any -1s in the user answer array\n return state.weight.filter((val) => val === -1).length === 0;\n },\n numberOfQuestions: (state) => state.weight.length,\n nextQuestion() {\n return (currentQuestion: number) => {\n const nextQuestion = ++currentQuestion;\n if (nextQuestion < this.numberOfQuestions) {\n return nextQuestion;\n }\n\n return -1;\n };\n }\n },\n actions: {\n reset(numberOfQuestions: number) {\n this.weight = Array(numberOfQuestions).fill(-1);\n this.correctAnswer = Array(numberOfQuestions).fill(-1);\n this.answerTypeQuiz = false;\n },\n setAnswerTypeQuiz() {\n this.answerTypeQuiz = true;\n },\n setCorrectAnswer(question: number, answer: number) {\n this.correctAnswer[question] = answer;\n },\n setUserAnswer(question: number, answer: number) {\n this.weight[question] = answer;\n }\n }\n});\n","import { defineComponent as _defineComponent } from 'vue'\nimport { unref as _unref, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot } from \"vue\"\n\nconst _hoisted_1 = { key: 0 }\nconst _hoisted_2 = [\"value\"]\nconst _hoisted_3 = { class: \"explaination\" }\nconst _hoisted_4 = { class: \"result-icon\" }\nconst _hoisted_5 = { key: 1 }\nconst _hoisted_6 = [\"value\"]\n\nimport { toRefs } from 'vue';\nimport { useLogger } from 'vue-logger-plugin';\nimport { usePersonalityQuizStore } from '../../../stores/PersonalityQuiz';\n\n// Incoming props\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'Answer',\n props: {\n totalAnswers: Number,\n questionNumber: Number,\n answerNumber: Number,\n quizType: String,\n isCorrect: Boolean,\n weight: Number,\n title: String,\n answerMessage: String\n},\n setup(__props) {\n\nconst props = __props;\n\n\n\n// get back prop values\nconst { totalAnswers, questionNumber, answerNumber, quizType, isCorrect, weight, title, answerMessage } = toRefs(props);\n\n// user logger\nconst logger = useLogger();\n\n// get the trivia quiz store\nconst personalityStore = usePersonalityQuizStore();\n\nconst questionName = 'question' + questionNumber?.value;\nconst answerDivIdName = 'question' + questionNumber?.value + 'answer' + answerNumber?.value;\nconst explanationIdName = 'question' + questionNumber?.value + 'answer' + answerNumber?.value + 'explanation';\nconst correctDivName = isCorrect?.value == true ? 'correct' : 'incorrect';\nconst correctText = isCorrect?.value == true ? 'correct!' : 'incorrect';\nconst iconClass = isCorrect?.value == true ? 'glyphicon-ok-sign' : 'glyphicon-remove-sign';\n\nconst getOffset = (el) => {\n const rect = el.getBoundingClientRect();\n return {\n left: rect.left + window.scrollX,\n top: rect.top + window.scrollY\n };\n};\n\nconst scroll = (id: string, removeHide: boolean, offset: number) => {\n let element = document.getElementById(id);\n if (element == null) {\n return;\n }\n\n if (removeHide) {\n element.classList.remove('hide');\n }\n\n let elementPosition = getOffset(element).top - offset;\n window.scrollTo({ top: elementPosition, behavior: 'smooth' });\n};\n\n// user clicked an answer so determine if correct or show the right answer\nconst userClickAnswer = () => {\n if (questionNumber?.value >= 0) {\n logger.debug('Clicked answer for question', questionNumber.value, weight.value, answerNumber.value);\n\n if (quizType?.value?.toLowerCase() == 'personality') {\n logger.debug('Setting weighted answer');\n let weightedAnswer = weight?.value;\n if (weightedAnswer < 0) {\n weightedAnswer = 0;\n }\n\n personalityStore.setUserAnswer(questionNumber.value, weightedAnswer);\n } else {\n logger.debug('Setting correct answer');\n personalityStore.setAnswerTypeQuiz();\n personalityStore.setUserAnswer(questionNumber.value, answerNumber.value);\n }\n\n // if this is the correct answer show any explanation text that may be included\n if (isCorrect.value == true) {\n const explanationItem = document.getElementById('question' + questionNumber.value + 'answer' + answerNumber.value + 'explanation') as HTMLElement;\n if (explanationItem?.classList?.contains('hide')) {\n explanationItem.classList.remove('hide');\n }\n }\n\n // disable each of the question's radio group\n for (let answer = 0; answer < totalAnswers?.value; answer++) {\n logger.debug('Disable answers for question', questionNumber.value, answer);\n const elementItem = document.getElementById('question' + questionNumber.value + 'answer' + answer);\n elementItem?.setAttribute('disabled', 'disabled');\n\n // show the correct answer\n if (isCorrect.value == false && elementItem?.getAttribute('value') == '1') {\n logger.debug('Showing correct answer for question', questionNumber.value, answer);\n elementItem?.parentElement?.classList.add('class', 'show-correct');\n\n // this means we didn't click the correct answer but we want to show any explanation that comes with this answer's correct answer\n const explanationItem = document.getElementById('question' + questionNumber.value + 'answer' + answer + 'explanation') as HTMLElement;\n if (explanationItem?.classList?.contains('hide')) {\n explanationItem.classList.remove('hide');\n }\n }\n }\n }\n\n // determine how we could scroll to the next question or the next result\n var timeToScroll = 0e3;\n if (personalityStore.canShowUserResult) {\n const toTimer = setTimeout(() => {\n scroll('results', true, 50);\n }, timeToScroll);\n\n //detect if user scrolled and remove setTimeout\n window.onscroll = () => {\n clearTimeout(toTimer);\n };\n } else {\n const nextQuestion = 'question' + personalityStore.nextQuestion(questionNumber?.value);\n logger.debug('going to next question from current question', nextQuestion, questionNumber?.value);\n const toTimer = setTimeout(() => {\n scroll(nextQuestion, true, 50);\n }, timeToScroll);\n\n //detect if user scrolled and remove setTimeout\n window.onscroll = () => {\n clearTimeout(toTimer);\n };\n }\n};\n\nreturn (_ctx: any,_cache: any) => {\n return (_unref(quizType) == 'Default')\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n _createElementVNode(\"div\", {\n class: _normalizeClass(_unref(correctDivName))\n }, [\n _createElementVNode(\"input\", {\n class: \"questionClass\",\n name: questionName,\n id: answerDivIdName,\n type: \"radio\",\n value: _unref(isCorrect) == true ? '1' : '0',\n onClick: userClickAnswer\n }, null, 8, _hoisted_2),\n _createElementVNode(\"label\", { for: answerDivIdName }, [\n _createElementVNode(\"span\", null, [\n _createElementVNode(\"div\", _hoisted_3, [\n _createElementVNode(\"div\", _hoisted_4, [\n _createTextVNode(_toDisplayString(_unref(correctText)) + \"Â \", 1),\n _createElementVNode(\"span\", {\n class: _normalizeClass([\"glyphicon\", _unref(iconClass)]),\n \"aria-hidden\": \"true\"\n }, null, 2)\n ])\n ]),\n _createElementVNode(\"span\", null, _toDisplayString(_unref(title)), 1),\n _createElementVNode(\"div\", {\n class: \"explaination explaination-text hide\",\n id: explanationIdName\n }, _toDisplayString(decodeURIComponent(_unref(answerMessage))), 1)\n ])\n ])\n ], 2)\n ]))\n : (_openBlock(), _createElementBlock(\"div\", _hoisted_5, [\n _createElementVNode(\"div\", null, [\n _createElementVNode(\"input\", {\n class: \"questionClass\",\n name: questionName,\n id: answerDivIdName,\n type: \"radio\",\n value: _unref(weight),\n onClick: userClickAnswer\n }, null, 8, _hoisted_6),\n _createElementVNode(\"label\", { for: answerDivIdName }, [\n _createElementVNode(\"span\", null, [\n _createElementVNode(\"span\", null, _toDisplayString(_unref(title)), 1)\n ]),\n _renderSlot(_ctx.$slots, \"default\")\n ])\n ])\n ]))\n}\n}\n\n})","import script from \"./Answer.vue?vue&type=script&setup=true&lang=ts\"\nexport * from \"./Answer.vue?vue&type=script&setup=true&lang=ts\"\n\nconst __exports__ = script;\n\nexport default __exports__"],"names":["usePersonalityQuizStore","defineStore","state","correctAnswer","weight","answerTypeQuiz","getters","total","reduce","a","b","getNumberOfCorrectAnswers","count","forEach","answer","index","length","isAnswerTypeQuiz","canShowUserResult","filter","val","numberOfQuestions","nextQuestion","currentQuestion","this","actions","reset","Array","fill","setAnswerTypeQuiz","setCorrectAnswer","question","setUserAnswer","_hoisted_1","key","_hoisted_2","_hoisted_3","class","_hoisted_4","_hoisted_5","_hoisted_6","_defineComponent","__name","props","totalAnswers","Number","questionNumber","answerNumber","quizType","String","isCorrect","Boolean","title","answerMessage","setup","__props","toRefs","logger","useLogger","personalityStore","questionName","value","answerDivIdName","explanationIdName","correctDivName","correctText","iconClass","getOffset","el","rect","getBoundingClientRect","left","window","scrollX","top","scrollY","scroll","id","removeHide","offset","element","document","getElementById","classList","remove","elementPosition","scrollTo","behavior","userClickAnswer","debug","_a","toLowerCase","weightedAnswer","explanationItem","_b","contains","elementItem","setAttribute","getAttribute","_c","parentElement","add","_d","timeToScroll","toTimer","setTimeout","onscroll","clearTimeout","_ctx","_cache","_unref","_openBlock","_createElementBlock","_createElementVNode","_normalizeClass","name","type","onClick","for","_createTextVNode","_toDisplayString","decodeURIComponent","_renderSlot","$slots","__exports__"],"sourceRoot":""}