analytica-frontend-lib 1.1.9 → 1.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6957,11 +6957,11 @@ var VideoPlayer = ({
6957
6957
  setShowSpeedMenu(!showSpeedMenu);
6958
6958
  }, [showSpeedMenu]);
6959
6959
  const toggleCaptions = (0, import_react22.useCallback)(() => {
6960
- if (!trackRef.current?.track) return;
6960
+ if (!trackRef.current?.track || !subtitles) return;
6961
6961
  const newShowCaptions = !showCaptions;
6962
6962
  setShowCaptions(newShowCaptions);
6963
- trackRef.current.track.mode = newShowCaptions ? "showing" : "hidden";
6964
- }, [showCaptions]);
6963
+ trackRef.current.track.mode = newShowCaptions && subtitles ? "showing" : "hidden";
6964
+ }, [showCaptions, subtitles]);
6965
6965
  const handleTimeUpdate = (0, import_react22.useCallback)(() => {
6966
6966
  if (videoRef.current) {
6967
6967
  const current = videoRef.current.currentTime;
@@ -6990,6 +6990,11 @@ var VideoPlayer = ({
6990
6990
  setDuration(videoRef.current.duration);
6991
6991
  }
6992
6992
  }, []);
6993
+ (0, import_react22.useEffect)(() => {
6994
+ if (trackRef.current?.track) {
6995
+ trackRef.current.track.mode = showCaptions && subtitles ? "showing" : "hidden";
6996
+ }
6997
+ }, [subtitles, showCaptions]);
6993
6998
  (0, import_react22.useEffect)(() => {
6994
6999
  const handleVisibilityChange = () => {
6995
7000
  if (document.hidden && isPlaying && videoRef.current) {
@@ -7095,9 +7100,9 @@ var VideoPlayer = ({
7095
7100
  {
7096
7101
  ref: trackRef,
7097
7102
  kind: "captions",
7098
- src: subtitles || "data:text/vtt;charset=utf-8,WEBVTT%0A%0ANOTE%20No%20captions%20available",
7099
- srcLang: "en",
7100
- label: subtitles ? "Subtitles" : "No captions available",
7103
+ src: subtitles || "data:text/vtt;charset=utf-8,WEBVTT",
7104
+ srcLang: "pt-br",
7105
+ label: subtitles ? "Legendas em Portugu\xEAs" : "Sem legendas dispon\xEDveis",
7101
7106
  default: false
7102
7107
  }
7103
7108
  )
@@ -7717,6 +7722,8 @@ var useQuizStore = (0, import_zustand7.create)()(
7717
7722
  isFinished: false,
7718
7723
  userId: "",
7719
7724
  variant: "default",
7725
+ questionsResult: null,
7726
+ currentQuestionResult: null,
7720
7727
  // Setters
7721
7728
  setBySimulated: (simulado) => set({ bySimulated: simulado }),
7722
7729
  setByActivity: (atividade) => set({ byActivity: atividade }),
@@ -7725,6 +7732,7 @@ var useQuizStore = (0, import_zustand7.create)()(
7725
7732
  setUserAnswers: (userAnswers) => set({ userAnswers }),
7726
7733
  getUserId: () => get().userId,
7727
7734
  setVariant: (variant) => set({ variant }),
7735
+ setQuestionResult: (questionsResult) => set({ questionsResult }),
7728
7736
  // Navigation
7729
7737
  goToNextQuestion: () => {
7730
7738
  const { currentQuestionIndex, getTotalQuestions } = get();
@@ -7777,9 +7785,9 @@ var useQuizStore = (0, import_zustand7.create)()(
7777
7785
  questionId,
7778
7786
  activityId,
7779
7787
  userId,
7780
- answer: question.type === "DISSERTATIVA" /* DISSERTATIVA */ ? answerId : null,
7781
- optionId: question.type === "DISSERTATIVA" /* DISSERTATIVA */ ? null : answerId,
7782
- questionType: question.type,
7788
+ answer: question.questionType === "DISSERTATIVA" /* DISSERTATIVA */ ? answerId : null,
7789
+ optionId: question.questionType === "DISSERTATIVA" /* DISSERTATIVA */ ? null : answerId,
7790
+ questionType: question.questionType,
7783
7791
  answerStatus: "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */
7784
7792
  };
7785
7793
  let updatedUserAnswers;
@@ -7819,7 +7827,7 @@ var useQuizStore = (0, import_zustand7.create)()(
7819
7827
  // selectMultipleAnswer is for non-dissertative questions
7820
7828
  optionId: answerId,
7821
7829
  // selectMultipleAnswer should only set optionId
7822
- questionType: question.type,
7830
+ questionType: question.questionType,
7823
7831
  answerStatus: "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */
7824
7832
  })
7825
7833
  );
@@ -7846,7 +7854,7 @@ var useQuizStore = (0, import_zustand7.create)()(
7846
7854
  const question = activeQuiz.quiz.questions.find(
7847
7855
  (q) => q.id === questionId
7848
7856
  );
7849
- if (!question || question.type !== "DISSERTATIVA" /* DISSERTATIVA */) {
7857
+ if (!question || question.questionType !== "DISSERTATIVA" /* DISSERTATIVA */) {
7850
7858
  console.warn(
7851
7859
  "selectDissertativeAnswer called for non-dissertative question"
7852
7860
  );
@@ -7896,7 +7904,7 @@ var useQuizStore = (0, import_zustand7.create)()(
7896
7904
  userId,
7897
7905
  answer: null,
7898
7906
  optionId: null,
7899
- questionType: currentQuestion.type,
7907
+ questionType: currentQuestion.questionType,
7900
7908
  answerStatus: "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */
7901
7909
  };
7902
7910
  let updatedUserAnswers;
@@ -7932,9 +7940,9 @@ var useQuizStore = (0, import_zustand7.create)()(
7932
7940
  questionId,
7933
7941
  activityId,
7934
7942
  userId,
7935
- answer: question.type === "DISSERTATIVA" /* DISSERTATIVA */ ? answerId || null : null,
7936
- optionId: question.type !== "DISSERTATIVA" /* DISSERTATIVA */ ? answerId || null : null,
7937
- questionType: question.type,
7943
+ answer: question.questionType === "DISSERTATIVA" /* DISSERTATIVA */ ? answerId || null : null,
7944
+ optionId: question.questionType !== "DISSERTATIVA" /* DISSERTATIVA */ ? answerId || null : null,
7945
+ questionType: question.questionType,
7938
7946
  answerStatus: "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */
7939
7947
  };
7940
7948
  if (existingAnswerIndex !== -1) {
@@ -7962,7 +7970,10 @@ var useQuizStore = (0, import_zustand7.create)()(
7962
7970
  timeElapsed: 0,
7963
7971
  isStarted: false,
7964
7972
  isFinished: false,
7965
- userId: ""
7973
+ userId: "",
7974
+ variant: "default",
7975
+ questionsResult: null,
7976
+ currentQuestionResult: null
7966
7977
  });
7967
7978
  },
7968
7979
  // Timer
@@ -8164,6 +8175,31 @@ var useQuizStore = (0, import_zustand7.create)()(
8164
8175
  (q) => q.id === questionId
8165
8176
  );
8166
8177
  return questionIndex + 1;
8178
+ },
8179
+ // Question Result
8180
+ getQuestionResultByQuestionId: (questionId) => {
8181
+ const { questionsResult } = get();
8182
+ return questionsResult?.answers.find(
8183
+ (answer) => answer.questionId === questionId
8184
+ ) || null;
8185
+ },
8186
+ getQuestionResultStatistics: () => {
8187
+ const { questionsResult } = get();
8188
+ return questionsResult?.statistics || null;
8189
+ },
8190
+ getQuestionResult: () => {
8191
+ const { questionsResult } = get();
8192
+ return questionsResult;
8193
+ },
8194
+ setQuestionsResult: (questionsResult) => {
8195
+ set({ questionsResult });
8196
+ },
8197
+ setCurrentQuestionResult: (currentQuestionResult) => {
8198
+ set({ currentQuestionResult });
8199
+ },
8200
+ getCurrentQuestionResult: () => {
8201
+ const { currentQuestionResult } = get();
8202
+ return currentQuestionResult;
8167
8203
  }
8168
8204
  };
8169
8205
  },
@@ -8219,18 +8255,21 @@ var Quiz = (0, import_react27.forwardRef)(({ children, className, variant = "def
8219
8255
  });
8220
8256
  var QuizHeaderResult = (0, import_react27.forwardRef)(
8221
8257
  ({ className, ...props }, ref) => {
8222
- const { getAllCurrentAnswer } = useQuizStore();
8223
- const usersAnswer = getAllCurrentAnswer();
8258
+ const { getQuestionResultByQuestionId, getCurrentQuestion } = useQuizStore();
8224
8259
  const [isCorrect, setIsCorrect] = (0, import_react27.useState)(false);
8225
8260
  (0, import_react27.useEffect)(() => {
8226
- if (usersAnswer) {
8227
- setIsCorrect(
8228
- usersAnswer.length > 0 ? usersAnswer.map(
8229
- (answer) => answer.answerStatus === "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */
8230
- ).every(Boolean) : false
8231
- );
8261
+ const cq = getCurrentQuestion();
8262
+ if (!cq) {
8263
+ setIsCorrect(false);
8264
+ return;
8232
8265
  }
8233
- }, [usersAnswer]);
8266
+ const qr = getQuestionResultByQuestionId(cq.id);
8267
+ setIsCorrect(qr?.answerStatus === "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */);
8268
+ }, [
8269
+ getCurrentQuestion,
8270
+ getQuestionResultByQuestionId,
8271
+ getCurrentQuestion()?.id
8272
+ ]);
8234
8273
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
8235
8274
  "div",
8236
8275
  {
@@ -8313,7 +8352,7 @@ var QuizContainer = (0, import_react27.forwardRef)(({ children, className, ...pr
8313
8352
  );
8314
8353
  });
8315
8354
  var QuizContent = (0, import_react27.forwardRef)(({ paddingBottom }) => {
8316
- const { getCurrentQuestion, variant } = useQuizStore();
8355
+ const { getCurrentQuestion } = useQuizStore();
8317
8356
  const currentQuestion = getCurrentQuestion();
8318
8357
  const questionComponents = {
8319
8358
  ["ALTERNATIVA" /* ALTERNATIVA */]: QuizAlternative,
@@ -8324,26 +8363,35 @@ var QuizContent = (0, import_react27.forwardRef)(({ paddingBottom }) => {
8324
8363
  ["PREENCHER" /* PREENCHER */]: QuizFill,
8325
8364
  ["IMAGEM" /* IMAGEM */]: QuizImageQuestion
8326
8365
  };
8327
- const QuestionComponent = currentQuestion ? questionComponents[currentQuestion.type] : null;
8328
- return QuestionComponent ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(QuestionComponent, { variant, paddingBottom }) : null;
8366
+ const QuestionComponent = currentQuestion ? questionComponents[currentQuestion.questionType] : null;
8367
+ return QuestionComponent ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(QuestionComponent, { paddingBottom }) : null;
8329
8368
  });
8330
- var QuizAlternative = ({
8331
- variant = "default",
8332
- paddingBottom
8333
- }) => {
8334
- const { getCurrentQuestion, selectAnswer, getCurrentAnswer } = useQuizStore();
8369
+ var QuizAlternative = ({ paddingBottom }) => {
8370
+ const {
8371
+ getCurrentQuestion,
8372
+ selectAnswer,
8373
+ getQuestionResultByQuestionId,
8374
+ getCurrentAnswer,
8375
+ variant
8376
+ } = useQuizStore();
8335
8377
  const currentQuestion = getCurrentQuestion();
8378
+ const currentQuestionResult = getQuestionResultByQuestionId(
8379
+ currentQuestion?.id || ""
8380
+ );
8336
8381
  const currentAnswer = getCurrentAnswer();
8337
8382
  const alternatives = currentQuestion?.options?.map((option) => {
8338
8383
  let status = "neutral" /* NEUTRAL */;
8339
8384
  if (variant === "result") {
8340
- const isCorrectOption = currentQuestion.options.find(
8341
- (op) => op.isCorrect
8385
+ const isCorrectOption = currentQuestion.correctOptionIds?.includes(
8386
+ option.id
8342
8387
  );
8343
- if (isCorrectOption?.id === option.id) {
8388
+ const isSelected = currentQuestionResult?.optionId === option.id;
8389
+ if (isCorrectOption) {
8344
8390
  status = "correct" /* CORRECT */;
8345
- } else if (currentAnswer?.optionId === option.id && option.id !== isCorrectOption?.id) {
8391
+ } else if (isSelected && !isCorrectOption) {
8346
8392
  status = "incorrect" /* INCORRECT */;
8393
+ } else {
8394
+ status = "neutral" /* NEUTRAL */;
8347
8395
  }
8348
8396
  }
8349
8397
  return {
@@ -8363,8 +8411,8 @@ var QuizAlternative = ({
8363
8411
  name: `question-${currentQuestion?.id || "1"}`,
8364
8412
  layout: "compact",
8365
8413
  alternatives,
8366
- value: currentAnswer?.optionId || "",
8367
- selectedValue: currentAnswer?.optionId || "",
8414
+ value: variant === "result" ? currentQuestionResult?.optionId || "" : currentAnswer?.optionId || "",
8415
+ selectedValue: variant === "result" ? currentQuestionResult?.optionId || "" : currentAnswer?.optionId || "",
8368
8416
  onValueChange: (value) => {
8369
8417
  if (currentQuestion) {
8370
8418
  selectAnswer(currentQuestion.id, value);
@@ -8375,13 +8423,19 @@ var QuizAlternative = ({
8375
8423
  ) }) })
8376
8424
  ] });
8377
8425
  };
8378
- var QuizMultipleChoice = ({
8379
- variant = "default",
8380
- paddingBottom
8381
- }) => {
8382
- const { getCurrentQuestion, selectMultipleAnswer, getAllCurrentAnswer } = useQuizStore();
8426
+ var QuizMultipleChoice = ({ paddingBottom }) => {
8427
+ const {
8428
+ getCurrentQuestion,
8429
+ selectMultipleAnswer,
8430
+ getAllCurrentAnswer,
8431
+ getQuestionResultByQuestionId,
8432
+ variant
8433
+ } = useQuizStore();
8383
8434
  const currentQuestion = getCurrentQuestion();
8384
8435
  const allCurrentAnswers = getAllCurrentAnswer();
8436
+ const currentQuestionResult = getQuestionResultByQuestionId(
8437
+ currentQuestion?.id || ""
8438
+ );
8385
8439
  const prevSelectedValuesRef = (0, import_react27.useRef)([]);
8386
8440
  const prevQuestionIdRef = (0, import_react27.useRef)("");
8387
8441
  const allCurrentAnswerIds = (0, import_react27.useMemo)(() => {
@@ -8403,8 +8457,16 @@ var QuizMultipleChoice = ({
8403
8457
  prevSelectedValuesRef.current = selectedValues;
8404
8458
  return selectedValues;
8405
8459
  }
8460
+ if (variant == "result" && currentQuestionResult?.options.length && currentQuestionResult?.options.length > 0) {
8461
+ return currentQuestionResult?.options.map((op) => op.id) || [];
8462
+ }
8406
8463
  return prevSelectedValuesRef.current;
8407
- }, [selectedValues, currentQuestion?.id]);
8464
+ }, [
8465
+ selectedValues,
8466
+ currentQuestion?.id,
8467
+ variant,
8468
+ currentQuestionResult?.optionId
8469
+ ]);
8408
8470
  const handleSelectedValues = (0, import_react27.useCallback)(
8409
8471
  (values) => {
8410
8472
  if (currentQuestion) {
@@ -8420,11 +8482,18 @@ var QuizMultipleChoice = ({
8420
8482
  const choices = currentQuestion?.options?.map((option) => {
8421
8483
  let status = "neutral" /* NEUTRAL */;
8422
8484
  if (variant === "result") {
8423
- const isAllCorrectOptionId = currentQuestion.options.filter((op) => op.isCorrect).map((op) => op.id);
8424
- if (isAllCorrectOptionId.includes(option.id)) {
8485
+ const isCorrectOption = currentQuestion.correctOptionIds?.includes(
8486
+ option.id
8487
+ );
8488
+ const isSelected = currentQuestionResult?.options.find(
8489
+ (op) => op.id === option.id
8490
+ );
8491
+ if (isCorrectOption) {
8425
8492
  status = "correct" /* CORRECT */;
8426
- } else if (allCurrentAnswerIds?.includes(option.id) && !isAllCorrectOptionId.includes(option.id)) {
8493
+ } else if (isSelected && !isCorrectOption) {
8427
8494
  status = "incorrect" /* INCORRECT */;
8495
+ } else {
8496
+ status = "neutral" /* NEUTRAL */;
8428
8497
  }
8429
8498
  }
8430
8499
  return {
@@ -8450,12 +8519,18 @@ var QuizMultipleChoice = ({
8450
8519
  ) }) })
8451
8520
  ] });
8452
8521
  };
8453
- var QuizDissertative = ({
8454
- variant = "default",
8455
- paddingBottom
8456
- }) => {
8457
- const { getCurrentQuestion, getCurrentAnswer, selectDissertativeAnswer } = useQuizStore();
8522
+ var QuizDissertative = ({ paddingBottom }) => {
8523
+ const {
8524
+ getCurrentQuestion,
8525
+ getCurrentAnswer,
8526
+ selectDissertativeAnswer,
8527
+ getQuestionResultByQuestionId,
8528
+ variant
8529
+ } = useQuizStore();
8458
8530
  const currentQuestion = getCurrentQuestion();
8531
+ const currentQuestionResult = getQuestionResultByQuestionId(
8532
+ currentQuestion?.id || ""
8533
+ );
8459
8534
  const currentAnswer = getCurrentAnswer();
8460
8535
  const textareaRef = (0, import_react27.useRef)(null);
8461
8536
  const handleAnswerChange = (value) => {
@@ -8479,6 +8554,7 @@ var QuizDissertative = ({
8479
8554
  if (!currentQuestion) {
8480
8555
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-text-600 text-md", children: "Nenhuma quest\xE3o dispon\xEDvel" }) });
8481
8556
  }
8557
+ const localAnswer = (variant == "result" ? currentQuestionResult?.answer : currentAnswer?.answer) || "";
8482
8558
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
8483
8559
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(QuizSubTitle, { subTitle: "Resposta" }),
8484
8560
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(QuizContainer, { className: cn(variant != "result" && paddingBottom), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "space-y-4 max-h-[600px] overflow-y-auto", children: variant === "default" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
@@ -8486,22 +8562,20 @@ var QuizDissertative = ({
8486
8562
  {
8487
8563
  ref: textareaRef,
8488
8564
  placeholder: "Escreva sua resposta",
8489
- value: currentAnswer?.answer || "",
8565
+ value: localAnswer,
8490
8566
  onChange: (e) => handleAnswerChange(e.target.value),
8491
8567
  rows: 4,
8492
8568
  className: "min-h-[120px] max-h-[400px] resize-none overflow-y-auto"
8493
8569
  }
8494
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-text-600 text-md whitespace-pre-wrap", children: currentAnswer?.answer || "Nenhuma resposta fornecida" }) }) }) }),
8495
- variant === "result" && currentAnswer?.answerStatus == "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */ && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
8570
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-text-600 text-md whitespace-pre-wrap", children: localAnswer || "Nenhuma resposta fornecida" }) }) }) }),
8571
+ variant === "result" && currentQuestionResult?.answerStatus == "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */ && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
8496
8572
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(QuizSubTitle, { subTitle: "Observa\xE7\xE3o do professor" }),
8497
8573
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(QuizContainer, { className: cn("", paddingBottom), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-text-600 text-md whitespace-pre-wrap", children: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Integer euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Nullam ac urna eu felis dapibus condimentum sit amet a augue. Sed non neque elit. Sed ut imperdiet nisi. Proin condimentum fermentum nunc. Etiam pharetra, erat sed fermentum feugiat, velit mauris egestas quam, ut aliquam massa nisl quis neque. Suspendisse in orci enim. Mauris euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Integer euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Nullam ac urna eu felis dapibus condimentum sit amet a augue. Sed non neque elit. Sed ut imperdiet nisi. Proin condimentum fermentum nunc. Etiam pharetra, erat sed fermentum feugiat, velit mauris egestas quam, ut aliquam massa nisl quis neque. Suspendisse in orci enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Integer euismod, urna eu tincidunt consectetur, nisi nisl aliquam nunc, eget aliquam massa nisl quis neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse potenti. Nullam ac urna eu felis dapibus condimentum sit amet a augue. Sed non neque elit. Sed ut imperdiet nisi. Proin condimentum fermentum nunc. Etiam pharetra, erat sed fermentum feugiat, velit mauris egestas quam, ut aliquam massa nisl quis neque. Suspendisse in orci enim." }) })
8498
8574
  ] })
8499
8575
  ] });
8500
8576
  };
8501
- var QuizTrueOrFalse = ({
8502
- variant = "default",
8503
- paddingBottom
8504
- }) => {
8577
+ var QuizTrueOrFalse = ({ paddingBottom }) => {
8578
+ const { variant } = useQuizStore();
8505
8579
  const options = [
8506
8580
  {
8507
8581
  label: "25 metros",
@@ -8561,10 +8635,8 @@ var QuizTrueOrFalse = ({
8561
8635
  }) }) })
8562
8636
  ] });
8563
8637
  };
8564
- var QuizConnectDots = ({
8565
- variant = "default",
8566
- paddingBottom
8567
- }) => {
8638
+ var QuizConnectDots = ({ paddingBottom }) => {
8639
+ const { variant } = useQuizStore();
8568
8640
  const dotsOptions = [
8569
8641
  { label: "Ra\xE7\xE3o" },
8570
8642
  { label: "Rato" },
@@ -8690,10 +8762,8 @@ var QuizConnectDots = ({
8690
8762
  }) }) })
8691
8763
  ] });
8692
8764
  };
8693
- var QuizFill = ({
8694
- variant = "default",
8695
- paddingBottom = "pb-[80px]"
8696
- }) => {
8765
+ var QuizFill = ({ paddingBottom = "pb-[80px]" }) => {
8766
+ const { variant } = useQuizStore();
8697
8767
  const options = [
8698
8768
  "ci\xEAncia",
8699
8769
  "disciplina",
@@ -8862,10 +8932,8 @@ var QuizFill = ({
8862
8932
  ] })
8863
8933
  ] });
8864
8934
  };
8865
- var QuizImageQuestion = ({
8866
- variant = "default",
8867
- paddingBottom
8868
- }) => {
8935
+ var QuizImageQuestion = ({ paddingBottom }) => {
8936
+ const { variant } = useQuizStore();
8869
8937
  const correctPositionRelative = { x: 0.48, y: 0.45 };
8870
8938
  const calculateCorrectRadiusRelative = () => {
8871
8939
  const circleWidthRelative = 0.15;
@@ -9083,7 +9151,6 @@ var QuizFooter = (0, import_react27.forwardRef)(
9083
9151
  }, ref) => {
9084
9152
  const {
9085
9153
  currentQuestionIndex,
9086
- getUserAnswers,
9087
9154
  getTotalQuestions,
9088
9155
  goToNextQuestion,
9089
9156
  goToPreviousQuestion,
@@ -9093,7 +9160,7 @@ var QuizFooter = (0, import_react27.forwardRef)(
9093
9160
  getCurrentQuestion,
9094
9161
  getQuestionStatusFromUserAnswers,
9095
9162
  variant,
9096
- getActiveQuiz
9163
+ getQuestionResultStatistics
9097
9164
  } = useQuizStore();
9098
9165
  const totalQuestions = getTotalQuestions();
9099
9166
  const isFirstQuestion = currentQuestionIndex === 0;
@@ -9107,7 +9174,6 @@ var QuizFooter = (0, import_react27.forwardRef)(
9107
9174
  const [modalResolutionOpen, setModalResolutionOpen] = (0, import_react27.useState)(false);
9108
9175
  const [filterType, setFilterType] = (0, import_react27.useState)("all");
9109
9176
  const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
9110
- const userAnswers = getUserAnswers();
9111
9177
  const allQuestions = getTotalQuestions();
9112
9178
  const handleFinishQuiz = async () => {
9113
9179
  if (unansweredQuestions.length > 0) {
@@ -9267,21 +9333,9 @@ var QuizFooter = (0, import_react27.forwardRef)(
9267
9333
  /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("p", { className: "text-text-500 font-sm", children: [
9268
9334
  "Voc\xEA acertou",
9269
9335
  " ",
9270
- (() => {
9271
- const activeQuiz = getActiveQuiz();
9272
- if (!activeQuiz) return 0;
9273
- return userAnswers.filter((answer) => {
9274
- const question = activeQuiz.quiz.questions.find(
9275
- (q) => q.id === answer.questionId
9276
- );
9277
- const isCorrectOption = question?.options.find(
9278
- (op) => op.isCorrect
9279
- );
9280
- return question && answer.optionId === isCorrectOption?.id;
9281
- }).length;
9282
- })(),
9336
+ getQuestionResultStatistics()?.correctAnswers ?? "--",
9337
+ " de",
9283
9338
  " ",
9284
- "de ",
9285
9339
  allQuestions,
9286
9340
  " quest\xF5es."
9287
9341
  ] })
@@ -9338,7 +9392,7 @@ var QuizFooter = (0, import_react27.forwardRef)(
9338
9392
  onClose: () => setModalResolutionOpen(false),
9339
9393
  title: "Resolu\xE7\xE3o",
9340
9394
  size: "lg",
9341
- children: currentQuestion?.answerKey
9395
+ children: currentQuestion?.solutionExplanation
9342
9396
  }
9343
9397
  )
9344
9398
  ] });
@@ -9354,7 +9408,7 @@ var QuizResultHeaderTitle = (0, import_react27.forwardRef)(({ className, ...prop
9354
9408
  ...props,
9355
9409
  children: [
9356
9410
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
9357
- bySimulated && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge_default, { variant: "solid", action: "info", children: bySimulated.category })
9411
+ bySimulated && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge_default, { variant: "solid", action: "info", children: bySimulated.type })
9358
9412
  ]
9359
9413
  }
9360
9414
  );
@@ -9378,13 +9432,11 @@ var QuizResultPerformance = (0, import_react27.forwardRef)(
9378
9432
  getTotalQuestions,
9379
9433
  timeElapsed,
9380
9434
  formatTime: formatTime2,
9381
- bySimulated,
9382
- byActivity,
9383
- byQuestionary,
9384
- getUserAnswerByQuestionId
9435
+ getQuestionResultStatistics,
9436
+ getQuestionResult
9385
9437
  } = useQuizStore();
9386
9438
  const totalQuestions = getTotalQuestions();
9387
- const quiz = bySimulated || byActivity || byQuestionary;
9439
+ const questionResult = getQuestionResult();
9388
9440
  let correctAnswers = 0;
9389
9441
  let correctEasyAnswers = 0;
9390
9442
  let correctMediumAnswers = 0;
@@ -9392,24 +9444,23 @@ var QuizResultPerformance = (0, import_react27.forwardRef)(
9392
9444
  let totalEasyQuestions = 0;
9393
9445
  let totalMediumQuestions = 0;
9394
9446
  let totalDifficultQuestions = 0;
9395
- if (quiz) {
9396
- quiz.questions.forEach((question) => {
9397
- const userAnswerItem = getUserAnswerByQuestionId(question.id);
9398
- const isCorrect = userAnswerItem?.answerStatus == "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */;
9447
+ if (questionResult) {
9448
+ questionResult.answers.forEach((answer) => {
9449
+ const isCorrect = answer.answerStatus == "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */;
9399
9450
  if (isCorrect) {
9400
9451
  correctAnswers++;
9401
9452
  }
9402
- if (question.difficulty === "FACIL" /* FACIL */) {
9453
+ if (answer.difficultyLevel === "FACIL" /* FACIL */) {
9403
9454
  totalEasyQuestions++;
9404
9455
  if (isCorrect) {
9405
9456
  correctEasyAnswers++;
9406
9457
  }
9407
- } else if (question.difficulty === "MEDIO" /* MEDIO */) {
9458
+ } else if (answer.difficultyLevel === "MEDIO" /* MEDIO */) {
9408
9459
  totalMediumQuestions++;
9409
9460
  if (isCorrect) {
9410
9461
  correctMediumAnswers++;
9411
9462
  }
9412
- } else if (question.difficulty === "DIFICIL" /* DIFICIL */) {
9463
+ } else if (answer.difficultyLevel === "DIFICIL" /* DIFICIL */) {
9413
9464
  totalDifficultQuestions++;
9414
9465
  if (isCorrect) {
9415
9466
  correctDifficultAnswers++;
@@ -9442,8 +9493,9 @@ var QuizResultPerformance = (0, import_react27.forwardRef)(
9442
9493
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "text-2xs font-medium text-text-800", children: formatTime2(timeElapsed) })
9443
9494
  ] }),
9444
9495
  /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "text-2xl font-medium text-text-800 leading-7", children: [
9445
- correctAnswers,
9446
- " de ",
9496
+ getQuestionResultStatistics()?.correctAnswers ?? "--",
9497
+ " de",
9498
+ " ",
9447
9499
  totalQuestions
9448
9500
  ] }),
9449
9501
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "text-2xs font-medium text-text-600 mt-1", children: "Corretas" })