analytica-frontend-lib 1.2.60 → 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 (37) 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.d.ts +3 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +310 -77
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +303 -77
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/types/studentActivityCorrection.d.ts +5 -0
  32. package/dist/types/studentActivityCorrection.d.ts.map +1 -1
  33. package/dist/utils/filterHelpers.d.ts +105 -0
  34. package/dist/utils/filterHelpers.d.ts.map +1 -0
  35. package/dist/utils/subjectMappers.d.ts +29 -0
  36. package/dist/utils/subjectMappers.d.ts.map +1 -0
  37. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -208,6 +208,7 @@ __export(src_exports, {
208
208
  Whiteboard: () => Whiteboard_default,
209
209
  activitiesHistoryApiResponseSchema: () => activitiesHistoryApiResponseSchema,
210
210
  activityModelsApiResponseSchema: () => activityModelsApiResponseSchema,
211
+ buildUserFilterData: () => buildUserFilterData,
211
212
  cn: () => cn,
212
213
  convertActivityFiltersToQuestionsFilter: () => convertActivityFiltersToQuestionsFilter,
213
214
  createActivitiesHistoryHook: () => createActivitiesHistoryHook,
@@ -243,10 +244,13 @@ __export(src_exports, {
243
244
  getCategoryText: () => getCategoryText,
244
245
  getChatUserInfo: () => getChatUserInfo,
245
246
  getChatWsUrl: () => getChatWsUrl,
247
+ getClassOptionsFromUserData: () => getClassOptionsFromUserData,
246
248
  getDeviceType: () => getDeviceType,
247
249
  getGoalStatusBadgeAction: () => getGoalStatusBadgeAction,
248
250
  getQuestionStatusBadgeConfig: () => getQuestionStatusBadgeConfig,
249
251
  getRootDomain: () => getRootDomain,
252
+ getSchoolOptionsFromUserData: () => getSchoolOptionsFromUserData,
253
+ getSchoolYearOptionsFromUserData: () => getSchoolYearOptionsFromUserData,
250
254
  getSelectedIdsFromCategories: () => getSelectedIdsFromCategories,
251
255
  getStatusBadge: () => getStatusBadge,
252
256
  getStatusBadgeAction: () => getStatusBadgeAction,
@@ -258,6 +262,7 @@ __export(src_exports, {
258
262
  getSubjectIcon: () => getSubjectIcon,
259
263
  getSubjectInfo: () => getSubjectInfo,
260
264
  getSubjectName: () => getSubjectName,
265
+ getSubjectOptionsFromUserData: () => getSubjectOptionsFromUserData,
261
266
  goalApiResponseSchema: () => goalApiResponseSchema,
262
267
  goalDetailsApiResponseSchema: () => goalDetailsApiResponseSchema,
263
268
  goalsHistoryApiResponseSchema: () => goalsHistoryApiResponseSchema,
@@ -275,6 +280,8 @@ __export(src_exports, {
275
280
  mapInternalStatusToApi: () => mapInternalStatusToApi,
276
281
  mapQuestionTypeToEnum: () => mapQuestionTypeToEnum,
277
282
  mapQuestionTypeToEnumRequired: () => mapQuestionTypeToEnumRequired,
283
+ mapSubjectEnumToName: () => mapSubjectEnumToName,
284
+ mapSubjectNameToEnum: () => mapSubjectNameToEnum,
278
285
  questionTypeLabels: () => questionTypeLabels,
279
286
  supportSchema: () => supportSchema,
280
287
  syncDropdownState: () => syncDropdownState,
@@ -10005,7 +10012,9 @@ var FileAttachment_default = FileAttachment;
10005
10012
  var QUESTION_STATUS2 = {
10006
10013
  CORRETA: "CORRETA",
10007
10014
  INCORRETA: "INCORRETA",
10008
- EM_BRANCO: "EM_BRANCO"
10015
+ EM_BRANCO: "EM_BRANCO",
10016
+ /** Reserved for future use - pending teacher evaluation for essay questions */
10017
+ PENDENTE: "PENDENTE"
10009
10018
  };
10010
10019
  var getQuestionStatusBadgeConfig = (status) => {
10011
10020
  const configs = {
@@ -10023,6 +10032,11 @@ var getQuestionStatusBadgeConfig = (status) => {
10023
10032
  label: "Em branco",
10024
10033
  bgColor: "bg-gray-100",
10025
10034
  textColor: "text-gray-600"
10035
+ },
10036
+ [QUESTION_STATUS2.PENDENTE]: {
10037
+ label: "Pendente",
10038
+ bgColor: "bg-warning-background",
10039
+ textColor: "text-warning-800"
10026
10040
  }
10027
10041
  };
10028
10042
  return configs[status];
@@ -10106,17 +10120,26 @@ var CorrectActivityModal = ({
10106
10120
  const [savedObservation, setSavedObservation] = (0, import_react29.useState)("");
10107
10121
  const [attachedFiles, setAttachedFiles] = (0, import_react29.useState)([]);
10108
10122
  const [savedFiles, setSavedFiles] = (0, import_react29.useState)([]);
10123
+ const [existingAttachment, setExistingAttachment] = (0, import_react29.useState)(
10124
+ null
10125
+ );
10109
10126
  const fileInputRef = (0, import_react29.useRef)(null);
10110
10127
  (0, import_react29.useEffect)(() => {
10111
10128
  if (isOpen) {
10112
10129
  setObservation("");
10113
10130
  setIsObservationExpanded(false);
10114
- setIsObservationSaved(false);
10115
- setSavedObservation("");
10116
10131
  setAttachedFiles([]);
10117
10132
  setSavedFiles([]);
10133
+ setExistingAttachment(data?.attachment ?? null);
10134
+ if (data?.observation || data?.attachment) {
10135
+ setIsObservationSaved(true);
10136
+ setSavedObservation(data.observation || "");
10137
+ } else {
10138
+ setIsObservationSaved(false);
10139
+ setSavedObservation("");
10140
+ }
10118
10141
  }
10119
- }, [isOpen, data?.studentId]);
10142
+ }, [isOpen, data?.studentId, data?.observation, data?.attachment]);
10120
10143
  const handleOpenObservation = () => {
10121
10144
  setIsObservationExpanded(true);
10122
10145
  };
@@ -10130,12 +10153,16 @@ var CorrectActivityModal = ({
10130
10153
  setAttachedFiles((prev) => prev.filter((f) => f.id !== id));
10131
10154
  };
10132
10155
  const handleSaveObservation = () => {
10133
- if (observation.trim() || attachedFiles.length > 0) {
10156
+ if (observation.trim() || attachedFiles.length > 0 || existingAttachment) {
10157
+ if (!data?.studentId) {
10158
+ return;
10159
+ }
10134
10160
  setSavedObservation(observation);
10135
10161
  setSavedFiles([...attachedFiles]);
10136
10162
  setIsObservationSaved(true);
10137
10163
  setIsObservationExpanded(false);
10138
10164
  onObservationSubmit?.(
10165
+ data.studentId,
10139
10166
  observation,
10140
10167
  attachedFiles.map((f) => f.file)
10141
10168
  );
@@ -10149,9 +10176,80 @@ var CorrectActivityModal = ({
10149
10176
  };
10150
10177
  if (!data) return null;
10151
10178
  const title = isViewOnly ? "Detalhes da atividade" : "Corrigir atividade";
10152
- const formattedScore = data.score === null ? "-" : data.score.toFixed(1);
10179
+ const formattedScore = data.score == null ? "-" : data.score.toFixed(1);
10153
10180
  const renderObservationSection = () => {
10154
- if (isViewOnly) return null;
10181
+ const getFileNameFromUrl = (url) => {
10182
+ try {
10183
+ const urlObj = new URL(url);
10184
+ const urlPath = urlObj.pathname;
10185
+ return urlPath.split("/").pop() || "Anexo";
10186
+ } catch {
10187
+ return "Anexo";
10188
+ }
10189
+ };
10190
+ const renderAttachmentInput = () => {
10191
+ if (attachedFiles.length > 0) {
10192
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("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: [
10193
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_phosphor_react23.Paperclip, { size: 18, className: "text-text-800 flex-shrink-0" }),
10194
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: attachedFiles[0].file.name }),
10195
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10196
+ "button",
10197
+ {
10198
+ type: "button",
10199
+ onClick: () => handleFileRemove(attachedFiles[0].id),
10200
+ className: "text-text-700 hover:text-text-800 flex-shrink-0",
10201
+ "aria-label": `Remover ${attachedFiles[0].file.name}`,
10202
+ children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_phosphor_react23.X, { size: 18 })
10203
+ }
10204
+ )
10205
+ ] });
10206
+ }
10207
+ if (existingAttachment) {
10208
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center gap-2", children: [
10209
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10210
+ "a",
10211
+ {
10212
+ href: existingAttachment,
10213
+ target: "_blank",
10214
+ rel: "noopener noreferrer",
10215
+ 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",
10216
+ children: [
10217
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_phosphor_react23.Paperclip, { size: 18, className: "text-text-800 flex-shrink-0" }),
10218
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: getFileNameFromUrl(existingAttachment) })
10219
+ ]
10220
+ }
10221
+ ),
10222
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10223
+ Button_default,
10224
+ {
10225
+ type: "button",
10226
+ variant: "outline",
10227
+ size: "small",
10228
+ onClick: () => fileInputRef.current?.click(),
10229
+ className: "flex items-center gap-2",
10230
+ children: [
10231
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_phosphor_react23.Paperclip, { size: 18 }),
10232
+ "Trocar"
10233
+ ]
10234
+ }
10235
+ )
10236
+ ] });
10237
+ }
10238
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10239
+ Button_default,
10240
+ {
10241
+ type: "button",
10242
+ variant: "outline",
10243
+ size: "small",
10244
+ onClick: () => fileInputRef.current?.click(),
10245
+ className: "flex items-center gap-2",
10246
+ children: [
10247
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_phosphor_react23.Paperclip, { size: 18 }),
10248
+ "Anexar"
10249
+ ]
10250
+ }
10251
+ );
10252
+ };
10155
10253
  if (isObservationSaved) {
10156
10254
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "bg-background border border-border-100 rounded-lg p-4 space-y-2", children: [
10157
10255
  /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3", children: [
@@ -10167,6 +10265,25 @@ var CorrectActivityModal = ({
10167
10265
  ),
10168
10266
  /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: savedFiles[0].file.name })
10169
10267
  ] }),
10268
+ savedFiles.length === 0 && existingAttachment && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10269
+ "a",
10270
+ {
10271
+ href: existingAttachment,
10272
+ target: "_blank",
10273
+ rel: "noopener noreferrer",
10274
+ 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",
10275
+ children: [
10276
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10277
+ import_phosphor_react23.Paperclip,
10278
+ {
10279
+ size: 18,
10280
+ className: "text-text-800 flex-shrink-0"
10281
+ }
10282
+ ),
10283
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: getFileNameFromUrl(existingAttachment) })
10284
+ ]
10285
+ }
10286
+ ),
10170
10287
  /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10171
10288
  Button_default,
10172
10289
  {
@@ -10217,40 +10334,14 @@ var CorrectActivityModal = ({
10217
10334
  }
10218
10335
  ),
10219
10336
  /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col-reverse sm:flex-row gap-3 sm:justify-between", children: [
10220
- attachedFiles.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("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: [
10221
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_phosphor_react23.Paperclip, { size: 18, className: "text-text-800 flex-shrink-0" }),
10222
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-base font-medium text-text-800 truncate", children: attachedFiles[0].file.name }),
10223
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10224
- "button",
10225
- {
10226
- type: "button",
10227
- onClick: () => handleFileRemove(attachedFiles[0].id),
10228
- className: "text-text-700 hover:text-text-800 flex-shrink-0",
10229
- "aria-label": `Remover ${attachedFiles[0].file.name}`,
10230
- children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_phosphor_react23.X, { size: 18 })
10231
- }
10232
- )
10233
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
10234
- Button_default,
10235
- {
10236
- type: "button",
10237
- variant: "outline",
10238
- size: "small",
10239
- onClick: () => fileInputRef.current?.click(),
10240
- className: "flex items-center gap-2",
10241
- children: [
10242
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_phosphor_react23.Paperclip, { size: 18 }),
10243
- "Anexar"
10244
- ]
10245
- }
10246
- ),
10337
+ renderAttachmentInput(),
10247
10338
  /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10248
10339
  Button_default,
10249
10340
  {
10250
10341
  type: "button",
10251
10342
  size: "small",
10252
10343
  onClick: handleSaveObservation,
10253
- disabled: !observation.trim() && attachedFiles.length === 0,
10344
+ disabled: !observation.trim() && attachedFiles.length === 0 && !existingAttachment,
10254
10345
  children: "Salvar"
10255
10346
  }
10256
10347
  )
@@ -10276,8 +10367,8 @@ var CorrectActivityModal = ({
10276
10367
  contentClassName: "max-h-[80vh] overflow-y-auto",
10277
10368
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "space-y-6", children: [
10278
10369
  /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center gap-3", children: [
10279
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "w-10 h-10 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text_default, { className: "text-lg font-semibold text-primary-700", children: data.studentName.charAt(0).toUpperCase() }) }),
10280
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text_default, { className: "text-lg font-medium text-text-950", children: data.studentName })
10370
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "w-10 h-10 bg-primary-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text_default, { className: "text-lg font-semibold text-primary-700", children: data.studentName?.charAt(0).toUpperCase() || "-" }) }),
10371
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text_default, { className: "text-lg font-medium text-text-950", children: data.studentName || "Aluno" })
10281
10372
  ] }),
10282
10373
  /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "grid grid-cols-3 gap-4", children: [
10283
10374
  /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(StatCard, { label: "Nota", value: formattedScore, variant: "score" }),
@@ -10301,7 +10392,7 @@ var CorrectActivityModal = ({
10301
10392
  renderObservationSection(),
10302
10393
  /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "space-y-2", children: [
10303
10394
  /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text_default, { className: "text-sm font-bold text-text-950", children: "Respostas" }),
10304
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(AccordionGroup, { type: "multiple", className: "space-y-2", children: data.questions.map((question) => {
10395
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(AccordionGroup, { type: "multiple", className: "space-y-2", children: data.questions?.map((question) => {
10305
10396
  const badgeConfig = getQuestionStatusBadgeConfig(question.status);
10306
10397
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
10307
10398
  CardAccordation,
@@ -20808,7 +20899,7 @@ var ActivityDetails = ({
20808
20899
  onBack,
20809
20900
  onViewActivity,
20810
20901
  emptyStateImage,
20811
- mapSubjectNameToEnum
20902
+ mapSubjectNameToEnum: mapSubjectNameToEnum2
20812
20903
  }) => {
20813
20904
  const { isMobile } = useMobile();
20814
20905
  const [page, setPage] = (0, import_react63.useState)(1);
@@ -20855,7 +20946,11 @@ var ActivityDetails = ({
20855
20946
  setIsViewOnlyModal(isViewOnly);
20856
20947
  setCorrectionError(null);
20857
20948
  try {
20858
- const correction = await fetchStudentCorrection(activityId, studentId);
20949
+ const correction = await fetchStudentCorrection(
20950
+ activityId,
20951
+ studentId,
20952
+ student.studentName || "Aluno"
20953
+ );
20859
20954
  setCorrectionData(correction);
20860
20955
  setIsModalOpen(true);
20861
20956
  } catch (err) {
@@ -20871,21 +20966,15 @@ var ActivityDetails = ({
20871
20966
  setIsModalOpen(false);
20872
20967
  }, []);
20873
20968
  const handleObservationSubmit = (0, import_react63.useCallback)(
20874
- async (observation, files) => {
20875
- if (!activityId || !correctionData?.studentId) return;
20969
+ async (studentId, observation, files) => {
20970
+ if (!activityId || !studentId) return;
20876
20971
  try {
20877
- await submitObservation(
20878
- activityId,
20879
- correctionData.studentId,
20880
- observation,
20881
- files
20882
- );
20883
- setIsModalOpen(false);
20972
+ await submitObservation(activityId, studentId, observation, files);
20884
20973
  } catch (err) {
20885
20974
  console.error("Failed to submit observation:", err);
20886
20975
  }
20887
20976
  },
20888
- [activityId, correctionData?.studentId, submitObservation]
20977
+ [activityId, submitObservation]
20889
20978
  );
20890
20979
  const tableData = (0, import_react63.useMemo)(() => {
20891
20980
  if (!data?.students) return [];
@@ -20928,7 +21017,7 @@ var ActivityDetails = ({
20928
21017
  onBack();
20929
21018
  }
20930
21019
  };
20931
- const subjectEnum = data?.activity?.subjectName && mapSubjectNameToEnum ? mapSubjectNameToEnum(data.activity.subjectName) : null;
21020
+ const subjectEnum = data?.activity?.subjectName && mapSubjectNameToEnum2 ? mapSubjectNameToEnum2(data.activity.subjectName) : null;
20932
21021
  const subjectInfo = subjectEnum ? getSubjectInfo(subjectEnum) : null;
20933
21022
  if (loading && !data) {
20934
21023
  return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "flex flex-col w-full h-auto relative justify-center items-center mb-5 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "flex flex-col w-full h-full max-w-[1150px] mx-auto z-10 lg:px-0 px-4 pt-4 gap-4", children: [
@@ -23141,7 +23230,7 @@ var createGoalFiltersConfig = (userData) => [
23141
23230
  ]
23142
23231
  }
23143
23232
  ];
23144
- var createTableColumns2 = (mapSubjectNameToEnum, onDeleteGoal, onEditGoal) => [
23233
+ var createTableColumns2 = (mapSubjectNameToEnum2, onDeleteGoal, onEditGoal) => [
23145
23234
  {
23146
23235
  key: "startDate",
23147
23236
  label: "In\xEDcio",
@@ -23184,7 +23273,7 @@ var createTableColumns2 = (mapSubjectNameToEnum, onDeleteGoal, onEditGoal) => [
23184
23273
  className: "max-w-[140px]",
23185
23274
  render: (value) => {
23186
23275
  const subjectName = typeof value === "string" ? value : "";
23187
- const subjectEnum = mapSubjectNameToEnum?.(subjectName);
23276
+ const subjectEnum = mapSubjectNameToEnum2?.(subjectName);
23188
23277
  if (!subjectEnum) {
23189
23278
  return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Text_default, { size: "sm", className: "truncate", title: subjectName, children: subjectName });
23190
23279
  }
@@ -23297,7 +23386,7 @@ var RecommendedLessonsHistory = ({
23297
23386
  onEditGoal,
23298
23387
  emptyStateImage,
23299
23388
  noSearchImage,
23300
- mapSubjectNameToEnum,
23389
+ mapSubjectNameToEnum: mapSubjectNameToEnum2,
23301
23390
  userFilterData,
23302
23391
  title = "Hist\xF3rico de aulas recomendadas",
23303
23392
  createButtonText = "Criar aula",
@@ -23324,8 +23413,8 @@ var RecommendedLessonsHistory = ({
23324
23413
  [userFilterData]
23325
23414
  );
23326
23415
  const tableColumns = (0, import_react71.useMemo)(
23327
- () => createTableColumns2(mapSubjectNameToEnum, onDeleteGoal, onEditGoal),
23328
- [mapSubjectNameToEnum, onDeleteGoal, onEditGoal]
23416
+ () => createTableColumns2(mapSubjectNameToEnum2, onDeleteGoal, onEditGoal),
23417
+ [mapSubjectNameToEnum2, onDeleteGoal, onEditGoal]
23329
23418
  );
23330
23419
  const handleParamsChange = (0, import_react71.useCallback)(
23331
23420
  (params) => {
@@ -23536,12 +23625,12 @@ var import_jsx_runtime89 = require("react/jsx-runtime");
23536
23625
  var LessonHeader = ({
23537
23626
  data,
23538
23627
  onViewLesson,
23539
- mapSubjectNameToEnum,
23628
+ mapSubjectNameToEnum: mapSubjectNameToEnum2,
23540
23629
  viewLessonLabel
23541
23630
  }) => {
23542
23631
  const { goal, breakdown } = data;
23543
23632
  const subjectName = goal.lessonsGoals[0]?.supLessonsProgress?.lesson?.subject?.name || "";
23544
- const subjectEnum = mapSubjectNameToEnum?.(subjectName);
23633
+ const subjectEnum = mapSubjectNameToEnum2?.(subjectName);
23545
23634
  const subjectInfo = subjectEnum ? getSubjectInfo(subjectEnum) : null;
23546
23635
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "bg-background rounded-xl border border-border-50 p-6", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex flex-col lg:flex-row lg:items-start lg:justify-between gap-4", children: [
23547
23636
  /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex flex-col gap-2", children: [
@@ -24103,7 +24192,7 @@ var RecommendedLessonDetails = ({
24103
24192
  onViewLesson,
24104
24193
  onViewStudentPerformance,
24105
24194
  onBreadcrumbClick,
24106
- mapSubjectNameToEnum,
24195
+ mapSubjectNameToEnum: mapSubjectNameToEnum2,
24107
24196
  breadcrumbs,
24108
24197
  labels: customLabels,
24109
24198
  className
@@ -24165,7 +24254,7 @@ var RecommendedLessonDetails = ({
24165
24254
  {
24166
24255
  data,
24167
24256
  onViewLesson,
24168
- mapSubjectNameToEnum,
24257
+ mapSubjectNameToEnum: mapSubjectNameToEnum2,
24169
24258
  viewLessonLabel: labels.viewLesson
24170
24259
  }
24171
24260
  ),
@@ -24366,11 +24455,11 @@ var import_phosphor_react45 = require("phosphor-react");
24366
24455
 
24367
24456
  // src/components/ActivitiesHistory/utils/renderSubjectCell.tsx
24368
24457
  var import_jsx_runtime96 = require("react/jsx-runtime");
24369
- var renderSubjectCell = (subjectName, mapSubjectNameToEnum, showEmptyDash = false) => {
24458
+ var renderSubjectCell = (subjectName, mapSubjectNameToEnum2, showEmptyDash = false) => {
24370
24459
  if (!subjectName) {
24371
24460
  return showEmptyDash ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(Text_default, { size: "sm", color: "text-text-400", children: "-" }) : null;
24372
24461
  }
24373
- const subjectEnum = mapSubjectNameToEnum?.(subjectName);
24462
+ const subjectEnum = mapSubjectNameToEnum2?.(subjectName);
24374
24463
  if (!subjectEnum) {
24375
24464
  return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(Text_default, { size: "sm", className: "truncate", title: subjectName, children: subjectName });
24376
24465
  }
@@ -24465,7 +24554,7 @@ var mapActivityStatusToDisplay = (apiStatus) => mapApiStatusToDisplay(apiStatus)
24465
24554
 
24466
24555
  // src/components/ActivitiesHistory/config/historyTableColumns.tsx
24467
24556
  var import_jsx_runtime98 = require("react/jsx-runtime");
24468
- var createHistoryTableColumns = (mapSubjectNameToEnum) => [
24557
+ var createHistoryTableColumns = (mapSubjectNameToEnum2) => [
24469
24558
  {
24470
24559
  key: "startDate",
24471
24560
  label: "In\xEDcio",
@@ -24502,7 +24591,7 @@ var createHistoryTableColumns = (mapSubjectNameToEnum) => [
24502
24591
  className: "max-w-[140px]",
24503
24592
  render: (value) => {
24504
24593
  const subjectName = typeof value === "string" ? value : "";
24505
- return renderSubjectCell(subjectName, mapSubjectNameToEnum, false);
24594
+ return renderSubjectCell(subjectName, mapSubjectNameToEnum2, false);
24506
24595
  }
24507
24596
  },
24508
24597
  {
@@ -24618,7 +24707,7 @@ var activityHistoryResponseSchema = import_zod7.z.object({
24618
24707
  startDate: import_zod7.z.string().nullable(),
24619
24708
  finalDate: import_zod7.z.string().nullable(),
24620
24709
  status: import_zod7.z.nativeEnum(GenericApiStatus),
24621
- completionPercentage: import_zod7.z.number().min(0).max(100),
24710
+ completionPercentage: import_zod7.z.number().min(0).max(100).optional().default(0),
24622
24711
  subjectId: import_zod7.z.string().uuid().optional().nullable(),
24623
24712
  schoolId: import_zod7.z.string().optional(),
24624
24713
  schoolName: import_zod7.z.string().optional(),
@@ -24629,7 +24718,11 @@ var activityHistoryResponseSchema = import_zod7.z.object({
24629
24718
  var activitiesHistoryApiResponseSchema = import_zod7.z.object({
24630
24719
  message: import_zod7.z.string(),
24631
24720
  data: import_zod7.z.object({
24632
- activities: import_zod7.z.array(activityHistoryResponseSchema),
24721
+ activities: import_zod7.z.array(import_zod7.z.unknown()).transform(
24722
+ (items) => items.map((item) => activityHistoryResponseSchema.safeParse(item)).filter(
24723
+ (result) => result.success
24724
+ ).map((result) => result.data)
24725
+ ),
24633
24726
  pagination: import_zod7.z.object({
24634
24727
  total: import_zod7.z.number(),
24635
24728
  page: import_zod7.z.number(),
@@ -24712,7 +24805,7 @@ var HistoryTab = ({
24712
24805
  onRowClick,
24713
24806
  emptyStateImage,
24714
24807
  noSearchImage,
24715
- mapSubjectNameToEnum,
24808
+ mapSubjectNameToEnum: mapSubjectNameToEnum2,
24716
24809
  userFilterData
24717
24810
  }) => {
24718
24811
  const fetchActivitiesHistoryRef = (0, import_react82.useRef)(fetchActivitiesHistory);
@@ -24735,8 +24828,8 @@ var HistoryTab = ({
24735
24828
  [userFilterData]
24736
24829
  );
24737
24830
  const historyTableColumns = (0, import_react82.useMemo)(
24738
- () => createHistoryTableColumns(mapSubjectNameToEnum),
24739
- [mapSubjectNameToEnum]
24831
+ () => createHistoryTableColumns(mapSubjectNameToEnum2),
24832
+ [mapSubjectNameToEnum2]
24740
24833
  );
24741
24834
  const handleParamsChange = (0, import_react82.useCallback)(
24742
24835
  (params) => {
@@ -24827,7 +24920,7 @@ var import_phosphor_react48 = require("phosphor-react");
24827
24920
  // src/components/ActivitiesHistory/config/modelsTableColumns.tsx
24828
24921
  var import_phosphor_react47 = require("phosphor-react");
24829
24922
  var import_jsx_runtime100 = require("react/jsx-runtime");
24830
- var createModelsTableColumns = (mapSubjectNameToEnum, onSendActivity, onEditModel, onDeleteModel) => [
24923
+ var createModelsTableColumns = (mapSubjectNameToEnum2, onSendActivity, onEditModel, onDeleteModel) => [
24831
24924
  {
24832
24925
  key: "title",
24833
24926
  label: "T\xEDtulo",
@@ -24851,7 +24944,7 @@ var createModelsTableColumns = (mapSubjectNameToEnum, onSendActivity, onEditMode
24851
24944
  className: "max-w-[160px]",
24852
24945
  render: (value) => {
24853
24946
  const subjectName = typeof value === "string" ? value : "";
24854
- return renderSubjectCell(subjectName, mapSubjectNameToEnum, true);
24947
+ return renderSubjectCell(subjectName, mapSubjectNameToEnum2, true);
24855
24948
  }
24856
24949
  },
24857
24950
  {
@@ -25049,7 +25142,7 @@ var ModelsTab = ({
25049
25142
  onEditModel,
25050
25143
  emptyStateImage,
25051
25144
  noSearchImage,
25052
- mapSubjectNameToEnum,
25145
+ mapSubjectNameToEnum: mapSubjectNameToEnum2,
25053
25146
  userFilterData,
25054
25147
  subjectsMap
25055
25148
  }) => {
@@ -25087,12 +25180,12 @@ var ModelsTab = ({
25087
25180
  }, []);
25088
25181
  const modelsTableColumns = (0, import_react84.useMemo)(
25089
25182
  () => createModelsTableColumns(
25090
- mapSubjectNameToEnum,
25183
+ mapSubjectNameToEnum2,
25091
25184
  onSendActivity,
25092
25185
  onEditModel,
25093
25186
  handleDeleteClick
25094
25187
  ),
25095
- [mapSubjectNameToEnum, onSendActivity, onEditModel, handleDeleteClick]
25188
+ [mapSubjectNameToEnum2, onSendActivity, onEditModel, handleDeleteClick]
25096
25189
  );
25097
25190
  const handleParamsChange = (0, import_react84.useCallback)(
25098
25191
  (params) => {
@@ -25231,7 +25324,7 @@ var ActivitiesHistory = ({
25231
25324
  onEditModel,
25232
25325
  emptyStateImage,
25233
25326
  noSearchImage,
25234
- mapSubjectNameToEnum,
25327
+ mapSubjectNameToEnum: mapSubjectNameToEnum2,
25235
25328
  userFilterData,
25236
25329
  subjectsMap
25237
25330
  }) => {
@@ -25313,7 +25406,7 @@ var ActivitiesHistory = ({
25313
25406
  onRowClick,
25314
25407
  emptyStateImage,
25315
25408
  noSearchImage,
25316
- mapSubjectNameToEnum,
25409
+ mapSubjectNameToEnum: mapSubjectNameToEnum2,
25317
25410
  userFilterData
25318
25411
  }
25319
25412
  ),
@@ -25328,7 +25421,7 @@ var ActivitiesHistory = ({
25328
25421
  onEditModel,
25329
25422
  emptyStateImage,
25330
25423
  noSearchImage,
25331
- mapSubjectNameToEnum,
25424
+ mapSubjectNameToEnum: mapSubjectNameToEnum2,
25332
25425
  userFilterData,
25333
25426
  subjectsMap
25334
25427
  }
@@ -25340,6 +25433,139 @@ var ActivitiesHistory = ({
25340
25433
  );
25341
25434
  };
25342
25435
 
25436
+ // src/utils/subjectMappers.ts
25437
+ var SUBJECT_NAME_MAPPING = {
25438
+ matem\u00E1tica: "Matem\xE1tica" /* MATEMATICA */,
25439
+ portugu\u00EAs: "Portugu\xEAs" /* PORTUGUES */,
25440
+ ci\u00EAncias: "Biologia" /* BIOLOGIA */,
25441
+ hist\u00F3ria: "Hist\xF3ria" /* HISTORIA */,
25442
+ geografia: "Geografia" /* GEOGRAFIA */,
25443
+ ingl\u00EAs: "Ingl\xEAs" /* INGLES */,
25444
+ "educa\xE7\xE3o f\xEDsica": "Ed. F\xEDsica" /* EDUCACAO_FISICA */,
25445
+ artes: "Artes" /* ARTES */,
25446
+ tecnologia: "Trilhas" /* TRILHAS */,
25447
+ f\u00EDsica: "F\xEDsica" /* FISICA */,
25448
+ literatura: "Literatura" /* LITERATURA */,
25449
+ biologia: "Biologia" /* BIOLOGIA */,
25450
+ qu\u00EDmica: "Qu\xEDmica" /* QUIMICA */,
25451
+ filosofia: "Filosofia" /* FILOSOFIA */,
25452
+ espanhol: "Espanhol" /* ESPANHOL */,
25453
+ reda\u00E7\u00E3o: "Reda\xE7\xE3o" /* REDACAO */,
25454
+ sociologia: "Sociologia" /* SOCIOLOGIA */,
25455
+ trilhas: "Trilhas" /* TRILHAS */
25456
+ };
25457
+ var mapSubjectNameToEnum = (subjectName) => {
25458
+ const normalized = subjectName.trim().toLowerCase();
25459
+ return SUBJECT_NAME_MAPPING[normalized] || null;
25460
+ };
25461
+ var mapSubjectEnumToName = (subjectEnum) => {
25462
+ const reverseMapping = {
25463
+ ["Matem\xE1tica" /* MATEMATICA */]: "Matem\xE1tica",
25464
+ ["Portugu\xEAs" /* PORTUGUES */]: "Portugu\xEAs",
25465
+ ["Biologia" /* BIOLOGIA */]: "Biologia",
25466
+ ["Hist\xF3ria" /* HISTORIA */]: "Hist\xF3ria",
25467
+ ["Geografia" /* GEOGRAFIA */]: "Geografia",
25468
+ ["Ingl\xEAs" /* INGLES */]: "Ingl\xEAs",
25469
+ ["Ed. F\xEDsica" /* EDUCACAO_FISICA */]: "Educa\xE7\xE3o F\xEDsica",
25470
+ ["Artes" /* ARTES */]: "Artes",
25471
+ ["F\xEDsica" /* FISICA */]: "F\xEDsica",
25472
+ ["Literatura" /* LITERATURA */]: "Literatura",
25473
+ ["Qu\xEDmica" /* QUIMICA */]: "Qu\xEDmica",
25474
+ ["Filosofia" /* FILOSOFIA */]: "Filosofia",
25475
+ ["Espanhol" /* ESPANHOL */]: "Espanhol",
25476
+ ["Reda\xE7\xE3o" /* REDACAO */]: "Reda\xE7\xE3o",
25477
+ ["Sociologia" /* SOCIOLOGIA */]: "Sociologia",
25478
+ ["Trilhas" /* TRILHAS */]: "Trilhas"
25479
+ };
25480
+ return reverseMapping[subjectEnum] || subjectEnum;
25481
+ };
25482
+
25483
+ // src/utils/filterHelpers.ts
25484
+ var getSchoolOptionsFromUserData = (userData) => {
25485
+ if (!userData?.userInstitutions) {
25486
+ return [];
25487
+ }
25488
+ const schoolsMap = /* @__PURE__ */ new Map();
25489
+ for (const userInst of userData.userInstitutions) {
25490
+ if (userInst.school?.id && userInst.school?.name) {
25491
+ schoolsMap.set(userInst.school.id, {
25492
+ id: userInst.school.id,
25493
+ name: userInst.school.name
25494
+ });
25495
+ }
25496
+ }
25497
+ return Array.from(schoolsMap.values()).sort(
25498
+ (a, b) => a.name.localeCompare(b.name, "pt-BR")
25499
+ );
25500
+ };
25501
+ var getSubjectOptionsFromUserData = (userData) => {
25502
+ if (!userData?.subTeacherTopicClasses) {
25503
+ return [];
25504
+ }
25505
+ const subjectsMap = /* @__PURE__ */ new Map();
25506
+ for (const subTeacher of userData.subTeacherTopicClasses) {
25507
+ if (subTeacher.subject?.id && subTeacher.subject?.name) {
25508
+ subjectsMap.set(subTeacher.subject.id, {
25509
+ id: subTeacher.subject.id,
25510
+ name: subTeacher.subject.name
25511
+ });
25512
+ }
25513
+ }
25514
+ return Array.from(subjectsMap.values()).sort(
25515
+ (a, b) => a.name.localeCompare(b.name, "pt-BR")
25516
+ );
25517
+ };
25518
+ var getSchoolYearOptionsFromUserData = (userData) => {
25519
+ if (!userData?.userInstitutions) {
25520
+ return [];
25521
+ }
25522
+ const schoolYearsMap = /* @__PURE__ */ new Map();
25523
+ for (const userInst of userData.userInstitutions) {
25524
+ if (userInst.schoolYear?.id && userInst.schoolYear?.name) {
25525
+ schoolYearsMap.set(userInst.schoolYear.id, {
25526
+ id: userInst.schoolYear.id,
25527
+ name: userInst.schoolYear.name
25528
+ });
25529
+ }
25530
+ }
25531
+ return Array.from(schoolYearsMap.values()).sort(
25532
+ (a, b) => a.name.localeCompare(b.name, "pt-BR")
25533
+ );
25534
+ };
25535
+ var getClassOptionsFromUserData = (userData) => {
25536
+ if (!userData) {
25537
+ return [];
25538
+ }
25539
+ const classesMap = /* @__PURE__ */ new Map();
25540
+ if (userData.userInstitutions) {
25541
+ for (const userInst of userData.userInstitutions) {
25542
+ if (userInst.class?.id && userInst.class?.name) {
25543
+ classesMap.set(userInst.class.id, {
25544
+ id: userInst.class.id,
25545
+ name: userInst.class.name
25546
+ });
25547
+ }
25548
+ }
25549
+ }
25550
+ if (userData.subTeacherTopicClasses) {
25551
+ for (const subTeacher of userData.subTeacherTopicClasses) {
25552
+ if (subTeacher.class?.id && subTeacher.class?.name) {
25553
+ classesMap.set(subTeacher.class.id, {
25554
+ id: subTeacher.class.id,
25555
+ name: subTeacher.class.name
25556
+ });
25557
+ }
25558
+ }
25559
+ }
25560
+ return Array.from(classesMap.values()).sort(
25561
+ (a, b) => a.name.localeCompare(b.name, "pt-BR")
25562
+ );
25563
+ };
25564
+ var buildUserFilterData = (userData) => ({
25565
+ schools: getSchoolOptionsFromUserData(userData),
25566
+ subjects: getSubjectOptionsFromUserData(userData)
25567
+ });
25568
+
25343
25569
  // src/hooks/useChat.ts
25344
25570
  var import_react86 = require("react");
25345
25571
  var WS_STATES = {
@@ -26315,6 +26541,7 @@ var getChatUserInfo = (user, tokens, sessionInfo, defaultUserName = "Usuario") =
26315
26541
  Whiteboard,
26316
26542
  activitiesHistoryApiResponseSchema,
26317
26543
  activityModelsApiResponseSchema,
26544
+ buildUserFilterData,
26318
26545
  cn,
26319
26546
  convertActivityFiltersToQuestionsFilter,
26320
26547
  createActivitiesHistoryHook,
@@ -26350,10 +26577,13 @@ var getChatUserInfo = (user, tokens, sessionInfo, defaultUserName = "Usuario") =
26350
26577
  getCategoryText,
26351
26578
  getChatUserInfo,
26352
26579
  getChatWsUrl,
26580
+ getClassOptionsFromUserData,
26353
26581
  getDeviceType,
26354
26582
  getGoalStatusBadgeAction,
26355
26583
  getQuestionStatusBadgeConfig,
26356
26584
  getRootDomain,
26585
+ getSchoolOptionsFromUserData,
26586
+ getSchoolYearOptionsFromUserData,
26357
26587
  getSelectedIdsFromCategories,
26358
26588
  getStatusBadge,
26359
26589
  getStatusBadgeAction,
@@ -26365,6 +26595,7 @@ var getChatUserInfo = (user, tokens, sessionInfo, defaultUserName = "Usuario") =
26365
26595
  getSubjectIcon,
26366
26596
  getSubjectInfo,
26367
26597
  getSubjectName,
26598
+ getSubjectOptionsFromUserData,
26368
26599
  goalApiResponseSchema,
26369
26600
  goalDetailsApiResponseSchema,
26370
26601
  goalsHistoryApiResponseSchema,
@@ -26382,6 +26613,8 @@ var getChatUserInfo = (user, tokens, sessionInfo, defaultUserName = "Usuario") =
26382
26613
  mapInternalStatusToApi,
26383
26614
  mapQuestionTypeToEnum,
26384
26615
  mapQuestionTypeToEnumRequired,
26616
+ mapSubjectEnumToName,
26617
+ mapSubjectNameToEnum,
26385
26618
  questionTypeLabels,
26386
26619
  supportSchema,
26387
26620
  syncDropdownState,