analytica-frontend-lib 1.2.61 → 1.2.62

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.
Files changed (31) hide show
  1. package/dist/ActivitiesHistory/index.js +6 -2
  2. package/dist/ActivitiesHistory/index.js.map +1 -1
  3. package/dist/ActivitiesHistory/index.mjs +6 -2
  4. package/dist/ActivitiesHistory/index.mjs.map +1 -1
  5. package/dist/ActivityDetails/index.d.ts +1 -1
  6. package/dist/ActivityDetails/index.d.ts.map +1 -1
  7. package/dist/ActivityDetails/index.js +131 -49
  8. package/dist/ActivityDetails/index.js.map +1 -1
  9. package/dist/ActivityDetails/index.mjs +131 -49
  10. package/dist/ActivityDetails/index.mjs.map +1 -1
  11. package/dist/CorrectActivityModal/index.d.ts +1 -1
  12. package/dist/CorrectActivityModal/index.d.ts.map +1 -1
  13. package/dist/CorrectActivityModal/index.js +122 -38
  14. package/dist/CorrectActivityModal/index.js.map +1 -1
  15. package/dist/CorrectActivityModal/index.mjs +122 -38
  16. package/dist/CorrectActivityModal/index.mjs.map +1 -1
  17. package/dist/hooks/useActivitiesHistory/index.d.ts +4 -56
  18. package/dist/hooks/useActivitiesHistory/index.d.ts.map +1 -1
  19. package/dist/hooks/useActivitiesHistory/index.js +6 -2
  20. package/dist/hooks/useActivitiesHistory/index.js.map +1 -1
  21. package/dist/hooks/useActivitiesHistory/index.mjs +6 -2
  22. package/dist/hooks/useActivitiesHistory/index.mjs.map +1 -1
  23. package/dist/hooks/useActivitiesHistory.d.ts +4 -56
  24. package/dist/hooks/useActivitiesHistory.d.ts.map +1 -1
  25. package/dist/index.js +137 -51
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +137 -51
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/types/studentActivityCorrection.d.ts +5 -0
  30. package/dist/types/studentActivityCorrection.d.ts.map +1 -1
  31. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -9789,7 +9789,9 @@ var FileAttachment_default = FileAttachment;
9789
9789
  var QUESTION_STATUS2 = {
9790
9790
  CORRETA: "CORRETA",
9791
9791
  INCORRETA: "INCORRETA",
9792
- EM_BRANCO: "EM_BRANCO"
9792
+ EM_BRANCO: "EM_BRANCO",
9793
+ /** Reserved for future use - pending teacher evaluation for essay questions */
9794
+ PENDENTE: "PENDENTE"
9793
9795
  };
9794
9796
  var getQuestionStatusBadgeConfig = (status) => {
9795
9797
  const configs = {
@@ -9807,6 +9809,11 @@ var getQuestionStatusBadgeConfig = (status) => {
9807
9809
  label: "Em branco",
9808
9810
  bgColor: "bg-gray-100",
9809
9811
  textColor: "text-gray-600"
9812
+ },
9813
+ [QUESTION_STATUS2.PENDENTE]: {
9814
+ label: "Pendente",
9815
+ bgColor: "bg-warning-background",
9816
+ textColor: "text-warning-800"
9810
9817
  }
9811
9818
  };
9812
9819
  return configs[status];
@@ -9890,17 +9897,26 @@ var CorrectActivityModal = ({
9890
9897
  const [savedObservation, setSavedObservation] = useState18("");
9891
9898
  const [attachedFiles, setAttachedFiles] = useState18([]);
9892
9899
  const [savedFiles, setSavedFiles] = useState18([]);
9900
+ const [existingAttachment, setExistingAttachment] = useState18(
9901
+ null
9902
+ );
9893
9903
  const fileInputRef = useRef12(null);
9894
9904
  useEffect17(() => {
9895
9905
  if (isOpen) {
9896
9906
  setObservation("");
9897
9907
  setIsObservationExpanded(false);
9898
- setIsObservationSaved(false);
9899
- setSavedObservation("");
9900
9908
  setAttachedFiles([]);
9901
9909
  setSavedFiles([]);
9910
+ setExistingAttachment(data?.attachment ?? null);
9911
+ if (data?.observation || data?.attachment) {
9912
+ setIsObservationSaved(true);
9913
+ setSavedObservation(data.observation || "");
9914
+ } else {
9915
+ setIsObservationSaved(false);
9916
+ setSavedObservation("");
9917
+ }
9902
9918
  }
9903
- }, [isOpen, data?.studentId]);
9919
+ }, [isOpen, data?.studentId, data?.observation, data?.attachment]);
9904
9920
  const handleOpenObservation = () => {
9905
9921
  setIsObservationExpanded(true);
9906
9922
  };
@@ -9914,12 +9930,16 @@ var CorrectActivityModal = ({
9914
9930
  setAttachedFiles((prev) => prev.filter((f) => f.id !== id));
9915
9931
  };
9916
9932
  const handleSaveObservation = () => {
9917
- if (observation.trim() || attachedFiles.length > 0) {
9933
+ if (observation.trim() || attachedFiles.length > 0 || existingAttachment) {
9934
+ if (!data?.studentId) {
9935
+ return;
9936
+ }
9918
9937
  setSavedObservation(observation);
9919
9938
  setSavedFiles([...attachedFiles]);
9920
9939
  setIsObservationSaved(true);
9921
9940
  setIsObservationExpanded(false);
9922
9941
  onObservationSubmit?.(
9942
+ data.studentId,
9923
9943
  observation,
9924
9944
  attachedFiles.map((f) => f.file)
9925
9945
  );
@@ -9933,9 +9953,80 @@ var CorrectActivityModal = ({
9933
9953
  };
9934
9954
  if (!data) return null;
9935
9955
  const title = isViewOnly ? "Detalhes da atividade" : "Corrigir atividade";
9936
- const formattedScore = data.score === null ? "-" : data.score.toFixed(1);
9956
+ const formattedScore = data.score == null ? "-" : data.score.toFixed(1);
9937
9957
  const renderObservationSection = () => {
9938
- if (isViewOnly) return null;
9958
+ const getFileNameFromUrl = (url) => {
9959
+ try {
9960
+ const urlObj = new URL(url);
9961
+ const urlPath = urlObj.pathname;
9962
+ return urlPath.split("/").pop() || "Anexo";
9963
+ } catch {
9964
+ return "Anexo";
9965
+ }
9966
+ };
9967
+ const renderAttachmentInput = () => {
9968
+ if (attachedFiles.length > 0) {
9969
+ return /* @__PURE__ */ jsxs41("div", { className: "flex items-center justify-center gap-2 px-5 h-10 bg-secondary-500 rounded-full min-w-0 max-w-[150px]", children: [
9970
+ /* @__PURE__ */ jsx50(Paperclip3, { size: 18, className: "text-text-800 flex-shrink-0" }),
9971
+ /* @__PURE__ */ jsx50("span", { className: "text-base font-medium text-text-800 truncate", children: attachedFiles[0].file.name }),
9972
+ /* @__PURE__ */ jsx50(
9973
+ "button",
9974
+ {
9975
+ type: "button",
9976
+ onClick: () => handleFileRemove(attachedFiles[0].id),
9977
+ className: "text-text-700 hover:text-text-800 flex-shrink-0",
9978
+ "aria-label": `Remover ${attachedFiles[0].file.name}`,
9979
+ children: /* @__PURE__ */ jsx50(X6, { size: 18 })
9980
+ }
9981
+ )
9982
+ ] });
9983
+ }
9984
+ if (existingAttachment) {
9985
+ return /* @__PURE__ */ jsxs41("div", { className: "flex items-center gap-2", children: [
9986
+ /* @__PURE__ */ jsxs41(
9987
+ "a",
9988
+ {
9989
+ href: existingAttachment,
9990
+ target: "_blank",
9991
+ rel: "noopener noreferrer",
9992
+ className: "flex items-center gap-2 px-5 h-10 bg-secondary-500 rounded-full min-w-0 max-w-[150px] hover:bg-secondary-600 transition-colors",
9993
+ children: [
9994
+ /* @__PURE__ */ jsx50(Paperclip3, { size: 18, className: "text-text-800 flex-shrink-0" }),
9995
+ /* @__PURE__ */ jsx50("span", { className: "text-base font-medium text-text-800 truncate", children: getFileNameFromUrl(existingAttachment) })
9996
+ ]
9997
+ }
9998
+ ),
9999
+ /* @__PURE__ */ jsxs41(
10000
+ Button_default,
10001
+ {
10002
+ type: "button",
10003
+ variant: "outline",
10004
+ size: "small",
10005
+ onClick: () => fileInputRef.current?.click(),
10006
+ className: "flex items-center gap-2",
10007
+ children: [
10008
+ /* @__PURE__ */ jsx50(Paperclip3, { size: 18 }),
10009
+ "Trocar"
10010
+ ]
10011
+ }
10012
+ )
10013
+ ] });
10014
+ }
10015
+ return /* @__PURE__ */ jsxs41(
10016
+ Button_default,
10017
+ {
10018
+ type: "button",
10019
+ variant: "outline",
10020
+ size: "small",
10021
+ onClick: () => fileInputRef.current?.click(),
10022
+ className: "flex items-center gap-2",
10023
+ children: [
10024
+ /* @__PURE__ */ jsx50(Paperclip3, { size: 18 }),
10025
+ "Anexar"
10026
+ ]
10027
+ }
10028
+ );
10029
+ };
9939
10030
  if (isObservationSaved) {
9940
10031
  return /* @__PURE__ */ jsxs41("div", { className: "bg-background border border-border-100 rounded-lg p-4 space-y-2", children: [
9941
10032
  /* @__PURE__ */ jsxs41("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3", children: [
@@ -9951,6 +10042,25 @@ var CorrectActivityModal = ({
9951
10042
  ),
9952
10043
  /* @__PURE__ */ jsx50("span", { className: "text-base font-medium text-text-800 truncate", children: savedFiles[0].file.name })
9953
10044
  ] }),
10045
+ savedFiles.length === 0 && existingAttachment && /* @__PURE__ */ jsxs41(
10046
+ "a",
10047
+ {
10048
+ href: existingAttachment,
10049
+ target: "_blank",
10050
+ rel: "noopener noreferrer",
10051
+ className: "flex items-center gap-2 px-5 h-10 bg-secondary-500 rounded-full min-w-0 max-w-[150px] hover:bg-secondary-600 transition-colors",
10052
+ children: [
10053
+ /* @__PURE__ */ jsx50(
10054
+ Paperclip3,
10055
+ {
10056
+ size: 18,
10057
+ className: "text-text-800 flex-shrink-0"
10058
+ }
10059
+ ),
10060
+ /* @__PURE__ */ jsx50("span", { className: "text-base font-medium text-text-800 truncate", children: getFileNameFromUrl(existingAttachment) })
10061
+ ]
10062
+ }
10063
+ ),
9954
10064
  /* @__PURE__ */ jsxs41(
9955
10065
  Button_default,
9956
10066
  {
@@ -10001,40 +10111,14 @@ var CorrectActivityModal = ({
10001
10111
  }
10002
10112
  ),
10003
10113
  /* @__PURE__ */ jsxs41("div", { className: "flex flex-col-reverse sm:flex-row gap-3 sm:justify-between", children: [
10004
- attachedFiles.length > 0 ? /* @__PURE__ */ jsxs41("div", { className: "flex items-center justify-center gap-2 px-5 h-10 bg-secondary-500 rounded-full min-w-0 max-w-[150px]", children: [
10005
- /* @__PURE__ */ jsx50(Paperclip3, { size: 18, className: "text-text-800 flex-shrink-0" }),
10006
- /* @__PURE__ */ jsx50("span", { className: "text-base font-medium text-text-800 truncate", children: attachedFiles[0].file.name }),
10007
- /* @__PURE__ */ jsx50(
10008
- "button",
10009
- {
10010
- type: "button",
10011
- onClick: () => handleFileRemove(attachedFiles[0].id),
10012
- className: "text-text-700 hover:text-text-800 flex-shrink-0",
10013
- "aria-label": `Remover ${attachedFiles[0].file.name}`,
10014
- children: /* @__PURE__ */ jsx50(X6, { size: 18 })
10015
- }
10016
- )
10017
- ] }) : /* @__PURE__ */ jsxs41(
10018
- Button_default,
10019
- {
10020
- type: "button",
10021
- variant: "outline",
10022
- size: "small",
10023
- onClick: () => fileInputRef.current?.click(),
10024
- className: "flex items-center gap-2",
10025
- children: [
10026
- /* @__PURE__ */ jsx50(Paperclip3, { size: 18 }),
10027
- "Anexar"
10028
- ]
10029
- }
10030
- ),
10114
+ renderAttachmentInput(),
10031
10115
  /* @__PURE__ */ jsx50(
10032
10116
  Button_default,
10033
10117
  {
10034
10118
  type: "button",
10035
10119
  size: "small",
10036
10120
  onClick: handleSaveObservation,
10037
- disabled: !observation.trim() && attachedFiles.length === 0,
10121
+ disabled: !observation.trim() && attachedFiles.length === 0 && !existingAttachment,
10038
10122
  children: "Salvar"
10039
10123
  }
10040
10124
  )
@@ -10060,8 +10144,8 @@ var CorrectActivityModal = ({
10060
10144
  contentClassName: "max-h-[80vh] overflow-y-auto",
10061
10145
  children: /* @__PURE__ */ jsxs41("div", { className: "space-y-6", children: [
10062
10146
  /* @__PURE__ */ jsxs41("div", { className: "flex items-center gap-3", children: [
10063
- /* @__PURE__ */ jsx50("div", { className: "w-10 h-10 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx50(Text_default, { className: "text-lg font-semibold text-primary-700", children: data.studentName.charAt(0).toUpperCase() }) }),
10064
- /* @__PURE__ */ jsx50(Text_default, { className: "text-lg font-medium text-text-950", children: data.studentName })
10147
+ /* @__PURE__ */ jsx50("div", { className: "w-10 h-10 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx50(Text_default, { className: "text-lg font-semibold text-primary-700", children: data.studentName?.charAt(0).toUpperCase() || "-" }) }),
10148
+ /* @__PURE__ */ jsx50(Text_default, { className: "text-lg font-medium text-text-950", children: data.studentName || "Aluno" })
10065
10149
  ] }),
10066
10150
  /* @__PURE__ */ jsxs41("div", { className: "grid grid-cols-3 gap-4", children: [
10067
10151
  /* @__PURE__ */ jsx50(StatCard, { label: "Nota", value: formattedScore, variant: "score" }),
@@ -10085,7 +10169,7 @@ var CorrectActivityModal = ({
10085
10169
  renderObservationSection(),
10086
10170
  /* @__PURE__ */ jsxs41("div", { className: "space-y-2", children: [
10087
10171
  /* @__PURE__ */ jsx50(Text_default, { className: "text-sm font-bold text-text-950", children: "Respostas" }),
10088
- /* @__PURE__ */ jsx50(AccordionGroup, { type: "multiple", className: "space-y-2", children: data.questions.map((question) => {
10172
+ /* @__PURE__ */ jsx50(AccordionGroup, { type: "multiple", className: "space-y-2", children: data.questions?.map((question) => {
10089
10173
  const badgeConfig = getQuestionStatusBadgeConfig(question.status);
10090
10174
  return /* @__PURE__ */ jsx50(
10091
10175
  CardAccordation,
@@ -20709,7 +20793,11 @@ var ActivityDetails = ({
20709
20793
  setIsViewOnlyModal(isViewOnly);
20710
20794
  setCorrectionError(null);
20711
20795
  try {
20712
- const correction = await fetchStudentCorrection(activityId, studentId);
20796
+ const correction = await fetchStudentCorrection(
20797
+ activityId,
20798
+ studentId,
20799
+ student.studentName || "Aluno"
20800
+ );
20713
20801
  setCorrectionData(correction);
20714
20802
  setIsModalOpen(true);
20715
20803
  } catch (err) {
@@ -20725,21 +20813,15 @@ var ActivityDetails = ({
20725
20813
  setIsModalOpen(false);
20726
20814
  }, []);
20727
20815
  const handleObservationSubmit = useCallback16(
20728
- async (observation, files) => {
20729
- if (!activityId || !correctionData?.studentId) return;
20816
+ async (studentId, observation, files) => {
20817
+ if (!activityId || !studentId) return;
20730
20818
  try {
20731
- await submitObservation(
20732
- activityId,
20733
- correctionData.studentId,
20734
- observation,
20735
- files
20736
- );
20737
- setIsModalOpen(false);
20819
+ await submitObservation(activityId, studentId, observation, files);
20738
20820
  } catch (err) {
20739
20821
  console.error("Failed to submit observation:", err);
20740
20822
  }
20741
20823
  },
20742
- [activityId, correctionData?.studentId, submitObservation]
20824
+ [activityId, submitObservation]
20743
20825
  );
20744
20826
  const tableData = useMemo24(() => {
20745
20827
  if (!data?.students) return [];
@@ -24488,7 +24570,7 @@ var activityHistoryResponseSchema = z6.object({
24488
24570
  startDate: z6.string().nullable(),
24489
24571
  finalDate: z6.string().nullable(),
24490
24572
  status: z6.nativeEnum(GenericApiStatus),
24491
- completionPercentage: z6.number().min(0).max(100),
24573
+ completionPercentage: z6.number().min(0).max(100).optional().default(0),
24492
24574
  subjectId: z6.string().uuid().optional().nullable(),
24493
24575
  schoolId: z6.string().optional(),
24494
24576
  schoolName: z6.string().optional(),
@@ -24499,7 +24581,11 @@ var activityHistoryResponseSchema = z6.object({
24499
24581
  var activitiesHistoryApiResponseSchema = z6.object({
24500
24582
  message: z6.string(),
24501
24583
  data: z6.object({
24502
- activities: z6.array(activityHistoryResponseSchema),
24584
+ activities: z6.array(z6.unknown()).transform(
24585
+ (items) => items.map((item) => activityHistoryResponseSchema.safeParse(item)).filter(
24586
+ (result) => result.success
24587
+ ).map((result) => result.data)
24588
+ ),
24503
24589
  pagination: z6.object({
24504
24590
  total: z6.number(),
24505
24591
  page: z6.number(),