analytica-frontend-lib 1.2.0 → 1.2.2

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.
@@ -2912,10 +2912,15 @@ var QuizAlternative = ({ paddingBottom }) => {
2912
2912
  const isSelected = currentQuestionResult?.selectedOptions.some(
2913
2913
  (selectedOption) => selectedOption.optionId === option.id
2914
2914
  );
2915
- if (isCorrectOption) {
2916
- status = "correct" /* CORRECT */;
2917
- } else if (isSelected && !isCorrectOption) {
2918
- status = "incorrect" /* INCORRECT */;
2915
+ const shouldShowCorrectAnswers = currentQuestionResult?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && currentQuestionResult?.answerStatus !== "NAO_RESPONDIDO" /* NAO_RESPONDIDO */;
2916
+ if (shouldShowCorrectAnswers) {
2917
+ if (isCorrectOption) {
2918
+ status = "correct" /* CORRECT */;
2919
+ } else if (isSelected && !isCorrectOption) {
2920
+ status = "incorrect" /* INCORRECT */;
2921
+ } else {
2922
+ status = "neutral" /* NEUTRAL */;
2923
+ }
2919
2924
  } else {
2920
2925
  status = "neutral" /* NEUTRAL */;
2921
2926
  }
@@ -3013,10 +3018,15 @@ var QuizMultipleChoice = ({ paddingBottom }) => {
3013
3018
  const isSelected = currentQuestionResult?.selectedOptions?.some(
3014
3019
  (op) => op.optionId === option.id
3015
3020
  );
3016
- if (isCorrectOption) {
3017
- status = "correct" /* CORRECT */;
3018
- } else if (isSelected && !isCorrectOption) {
3019
- status = "incorrect" /* INCORRECT */;
3021
+ const shouldShowCorrectAnswers = currentQuestionResult?.answerStatus !== "PENDENTE_AVALIACAO" /* PENDENTE_AVALIACAO */ && currentQuestionResult?.answerStatus !== "NAO_RESPONDIDO" /* NAO_RESPONDIDO */;
3022
+ if (shouldShowCorrectAnswers) {
3023
+ if (isCorrectOption) {
3024
+ status = "correct" /* CORRECT */;
3025
+ } else if (isSelected && !isCorrectOption) {
3026
+ status = "incorrect" /* INCORRECT */;
3027
+ } else {
3028
+ status = "neutral" /* NEUTRAL */;
3029
+ }
3020
3030
  } else {
3021
3031
  status = "neutral" /* NEUTRAL */;
3022
3032
  }
@@ -3119,8 +3129,8 @@ var QuizTrueOrFalse = ({ paddingBottom }) => {
3119
3129
  isCorrect: false
3120
3130
  }
3121
3131
  ];
3122
- const getLetterByIndex = (index) => String.fromCharCode(97 + index);
3123
- const isDefaultVariant = variant == "default";
3132
+ const getLetterByIndex = (index) => String.fromCodePoint(97 + index);
3133
+ const isDefaultVariant = variant === "default";
3124
3134
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
3125
3135
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(QuizSubTitle, { subTitle: "Alternativas" }),
3126
3136
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(QuizContainer, { className: cn("", paddingBottom), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-col gap-3.5", children: options.map((option, index) => {
@@ -3135,7 +3145,7 @@ var QuizTrueOrFalse = ({ paddingBottom }) => {
3135
3145
  {
3136
3146
  className: cn(
3137
3147
  "flex flex-row justify-between items-center gap-2 p-2 rounded-md",
3138
- !isDefaultVariant ? getStatusStyles(variantCorrect) : ""
3148
+ isDefaultVariant ? "" : getStatusStyles(variantCorrect)
3139
3149
  ),
3140
3150
  children: [
3141
3151
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-text-900 text-sm", children: getLetterByIndex(index).concat(") ").concat(option.label) }),
@@ -3236,7 +3246,7 @@ var QuizConnectDots = ({ paddingBottom }) => {
3236
3246
  return next;
3237
3247
  });
3238
3248
  };
3239
- const getLetterByIndex = (index) => String.fromCharCode(97 + index);
3249
+ const getLetterByIndex = (index) => String.fromCodePoint(97 + index);
3240
3250
  const isDefaultVariant = variant === "default";
3241
3251
  const assignedDots = new Set(
3242
3252
  userAnswers.map((a) => a.dotOption).filter(Boolean)
@@ -3252,7 +3262,7 @@ var QuizConnectDots = ({ paddingBottom }) => {
3252
3262
  {
3253
3263
  className: cn(
3254
3264
  "flex flex-row justify-between items-center gap-2 p-2 rounded-md",
3255
- !isDefaultVariant ? getStatusStyles(variantCorrect) : ""
3265
+ isDefaultVariant ? "" : getStatusStyles(variantCorrect)
3256
3266
  ),
3257
3267
  children: [
3258
3268
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-text-900 text-sm", children: getLetterByIndex(index) + ") " + option.label }),
@@ -3334,8 +3344,10 @@ var QuizFill = ({ paddingBottom }) => {
3334
3344
  const [answers, setAnswers] = (0, import_react11.useState)({});
3335
3345
  const baseId = (0, import_react11.useId)();
3336
3346
  const getAvailableOptionsForSelect = (selectId) => {
3337
- const usedOptions = Object.entries(answers).filter(([key]) => key !== selectId).map(([, value]) => value);
3338
- return options.filter((option) => !usedOptions.includes(option));
3347
+ const usedOptions = new Set(
3348
+ Object.entries(answers).filter(([key]) => key !== selectId).map(([, value]) => value)
3349
+ );
3350
+ return options.filter((option) => !usedOptions.has(option));
3339
3351
  };
3340
3352
  const handleSelectChange = (selectId, value) => {
3341
3353
  const newAnswers = { ...answers, [selectId]: value };