analytica-frontend-lib 1.1.1 → 1.1.3
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/Auth/useUrlAuthentication/index.d.mts +8 -3
- package/dist/Auth/useUrlAuthentication/index.d.ts +8 -3
- package/dist/Auth/useUrlAuthentication/index.js +21 -0
- package/dist/Auth/useUrlAuthentication/index.js.map +1 -1
- package/dist/Auth/useUrlAuthentication/index.mjs +21 -0
- package/dist/Auth/useUrlAuthentication/index.mjs.map +1 -1
- package/dist/MultipleChoice/index.js.map +1 -1
- package/dist/MultipleChoice/index.mjs.map +1 -1
- package/dist/Quiz/index.js +37 -30
- package/dist/Quiz/index.js.map +1 -1
- package/dist/Quiz/index.mjs +37 -30
- package/dist/Quiz/index.mjs.map +1 -1
- package/dist/Quiz/useQuizStore/index.d.mts +1 -0
- package/dist/Quiz/useQuizStore/index.d.ts +1 -0
- package/dist/Quiz/useQuizStore/index.js +9 -0
- package/dist/Quiz/useQuizStore/index.js.map +1 -1
- package/dist/Quiz/useQuizStore/index.mjs +9 -0
- package/dist/Quiz/useQuizStore/index.mjs.map +1 -1
- package/dist/index.js +58 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -30
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7050,6 +7050,25 @@ var handleProfileSelection = (responseData, setSelectedProfile) => {
|
|
|
7050
7050
|
});
|
|
7051
7051
|
}
|
|
7052
7052
|
};
|
|
7053
|
+
var handleUserData = (responseData, setUser) => {
|
|
7054
|
+
if (!setUser) return;
|
|
7055
|
+
if (!hasValidProfileData(responseData)) return;
|
|
7056
|
+
const userId = responseData.userId;
|
|
7057
|
+
const userName = responseData.userName;
|
|
7058
|
+
const userEmail = responseData.userEmail;
|
|
7059
|
+
if (userId) {
|
|
7060
|
+
const userData = {
|
|
7061
|
+
id: userId
|
|
7062
|
+
};
|
|
7063
|
+
if (userName) {
|
|
7064
|
+
userData.name = userName;
|
|
7065
|
+
}
|
|
7066
|
+
if (userEmail) {
|
|
7067
|
+
userData.email = userEmail;
|
|
7068
|
+
}
|
|
7069
|
+
setUser(userData);
|
|
7070
|
+
}
|
|
7071
|
+
};
|
|
7053
7072
|
function useUrlAuthentication(options) {
|
|
7054
7073
|
const location = useLocation2();
|
|
7055
7074
|
useEffect12(() => {
|
|
@@ -7070,6 +7089,7 @@ function useUrlAuthentication(options) {
|
|
|
7070
7089
|
});
|
|
7071
7090
|
options.setSessionInfo(response.data.data);
|
|
7072
7091
|
handleProfileSelection(response.data.data, options.setSelectedProfile);
|
|
7092
|
+
handleUserData(response.data.data, options.setUser);
|
|
7073
7093
|
options.clearParamsFromURL?.();
|
|
7074
7094
|
} catch (error) {
|
|
7075
7095
|
console.error("Erro ao obter informa\xE7\xF5es da sess\xE3o:", error);
|
|
@@ -7080,6 +7100,7 @@ function useUrlAuthentication(options) {
|
|
|
7080
7100
|
location.search,
|
|
7081
7101
|
options.setSessionInfo,
|
|
7082
7102
|
options.setSelectedProfile,
|
|
7103
|
+
options.setUser,
|
|
7083
7104
|
options.setTokens,
|
|
7084
7105
|
options.api,
|
|
7085
7106
|
options.endpoint,
|
|
@@ -7591,6 +7612,15 @@ var useQuizStore = create7()(
|
|
|
7591
7612
|
(answer) => answer.questionId === questionId
|
|
7592
7613
|
);
|
|
7593
7614
|
return userAnswer ? userAnswer.answerStatus : null;
|
|
7615
|
+
},
|
|
7616
|
+
getQuestionIndex: (questionId) => {
|
|
7617
|
+
const { getActiveQuiz } = get();
|
|
7618
|
+
const activeQuiz = getActiveQuiz();
|
|
7619
|
+
if (!activeQuiz) return 0;
|
|
7620
|
+
const questionIndex = activeQuiz.quiz.questions.findIndex(
|
|
7621
|
+
(q) => q.id === questionId
|
|
7622
|
+
);
|
|
7623
|
+
return questionIndex + 1;
|
|
7594
7624
|
}
|
|
7595
7625
|
};
|
|
7596
7626
|
},
|
|
@@ -8433,7 +8463,8 @@ var QuizQuestionList = ({
|
|
|
8433
8463
|
const {
|
|
8434
8464
|
getQuestionsGroupedBySubject,
|
|
8435
8465
|
goToQuestion,
|
|
8436
|
-
getQuestionStatusFromUserAnswers
|
|
8466
|
+
getQuestionStatusFromUserAnswers,
|
|
8467
|
+
getQuestionIndex
|
|
8437
8468
|
} = useQuizStore();
|
|
8438
8469
|
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
8439
8470
|
const getQuestionStatus = (questionId) => {
|
|
@@ -8460,13 +8491,6 @@ var QuizQuestionList = ({
|
|
|
8460
8491
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8461
8492
|
{}
|
|
8462
8493
|
);
|
|
8463
|
-
const getQuestionIndex = (questionId) => {
|
|
8464
|
-
const { bySimulated, byActivity, byQuestionary } = useQuizStore.getState();
|
|
8465
|
-
const quiz = bySimulated ?? byActivity ?? byQuestionary;
|
|
8466
|
-
if (!quiz) return 0;
|
|
8467
|
-
const index = quiz.questions.findIndex((q) => q.id === questionId);
|
|
8468
|
-
return index + 1;
|
|
8469
|
-
};
|
|
8470
8494
|
const getStatusLabel = (status) => {
|
|
8471
8495
|
switch (status) {
|
|
8472
8496
|
case "answered":
|
|
@@ -8804,9 +8828,7 @@ var QuizResultPerformance = forwardRef19(
|
|
|
8804
8828
|
if (quiz) {
|
|
8805
8829
|
quiz.questions.forEach((question) => {
|
|
8806
8830
|
const userAnswerItem = getUserAnswerByQuestionId(question.id);
|
|
8807
|
-
const
|
|
8808
|
-
const isCorrectOption = question?.options.find((op) => op.isCorrect);
|
|
8809
|
-
const isCorrect = userAnswer && userAnswer === isCorrectOption?.id;
|
|
8831
|
+
const isCorrect = userAnswerItem?.answerStatus == "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */;
|
|
8810
8832
|
if (isCorrect) {
|
|
8811
8833
|
correctAnswers++;
|
|
8812
8834
|
}
|
|
@@ -8923,9 +8945,7 @@ var QuizListResult = forwardRef19(({ className, onSubjectClick, ...props }, ref)
|
|
|
8923
8945
|
questions.forEach((question) => {
|
|
8924
8946
|
if (isQuestionAnswered(question.id)) {
|
|
8925
8947
|
const userAnswerItem = getUserAnswerByQuestionId(question.id);
|
|
8926
|
-
|
|
8927
|
-
const isCorrectOption = question?.options.find((op) => op.isCorrect);
|
|
8928
|
-
if (userAnswer === isCorrectOption?.id) {
|
|
8948
|
+
if (userAnswerItem?.answerStatus == "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */) {
|
|
8929
8949
|
correct++;
|
|
8930
8950
|
} else {
|
|
8931
8951
|
incorrect++;
|
|
@@ -8960,28 +8980,36 @@ var QuizListResultByMateria = ({
|
|
|
8960
8980
|
subject,
|
|
8961
8981
|
onQuestionClick
|
|
8962
8982
|
}) => {
|
|
8963
|
-
const {
|
|
8983
|
+
const {
|
|
8984
|
+
getQuestionsGroupedBySubject,
|
|
8985
|
+
getUserAnswerByQuestionId,
|
|
8986
|
+
getQuestionIndex
|
|
8987
|
+
} = useQuizStore();
|
|
8964
8988
|
const groupedQuestions = getQuestionsGroupedBySubject();
|
|
8965
8989
|
const answeredQuestions = groupedQuestions[subject] || [];
|
|
8966
8990
|
return /* @__PURE__ */ jsxs30("div", { className: "w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6", children: [
|
|
8967
8991
|
/* @__PURE__ */ jsx37("div", { className: "flex flex-row pt-4 justify-between", children: /* @__PURE__ */ jsx37("p", { className: "text-text-950 font-bold text-2xl", children: subject }) }),
|
|
8968
8992
|
/* @__PURE__ */ jsxs30("section", { className: "flex flex-col ", children: [
|
|
8969
8993
|
/* @__PURE__ */ jsx37("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Resultado das quest\xF5es" }),
|
|
8970
|
-
/* @__PURE__ */ jsx37("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) =>
|
|
8971
|
-
|
|
8972
|
-
{
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8994
|
+
/* @__PURE__ */ jsx37("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => {
|
|
8995
|
+
const questionIndex = getQuestionIndex(question.id);
|
|
8996
|
+
return /* @__PURE__ */ jsx37("li", { children: /* @__PURE__ */ jsx37(
|
|
8997
|
+
CardStatus,
|
|
8998
|
+
{
|
|
8999
|
+
className: "max-w-full",
|
|
9000
|
+
header: `Quest\xE3o ${questionIndex.toString().padStart(2, "0")}`,
|
|
9001
|
+
status: (() => {
|
|
9002
|
+
const userAnswer = getUserAnswerByQuestionId(question.id);
|
|
9003
|
+
if (userAnswer?.answerStatus === "RESPOSTA_CORRETA" /* RESPOSTA_CORRETA */)
|
|
9004
|
+
return "correct";
|
|
9005
|
+
if (userAnswer?.answerStatus === "RESPOSTA_INCORRETA" /* RESPOSTA_INCORRETA */)
|
|
9006
|
+
return "incorrect";
|
|
9007
|
+
return void 0;
|
|
9008
|
+
})(),
|
|
9009
|
+
onClick: () => onQuestionClick?.(question)
|
|
9010
|
+
}
|
|
9011
|
+
) }, question.id);
|
|
9012
|
+
}) })
|
|
8985
9013
|
] })
|
|
8986
9014
|
] });
|
|
8987
9015
|
};
|