analytica-frontend-lib 1.2.51 → 1.2.52

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 (91) hide show
  1. package/dist/ActivitiesHistory/index.css +19387 -0
  2. package/dist/ActivitiesHistory/index.css.map +1 -0
  3. package/dist/ActivitiesHistory/index.d.ts +2 -0
  4. package/dist/ActivitiesHistory/index.d.ts.map +1 -0
  5. package/dist/ActivitiesHistory/index.js +7381 -0
  6. package/dist/ActivitiesHistory/index.js.map +1 -0
  7. package/dist/ActivitiesHistory/index.mjs +7424 -0
  8. package/dist/ActivitiesHistory/index.mjs.map +1 -0
  9. package/dist/ActivityCardQuestionBanks/index.css +13 -0
  10. package/dist/ActivityCardQuestionBanks/index.css.map +1 -1
  11. package/dist/ActivityCardQuestionPreview/index.css +13 -0
  12. package/dist/ActivityCardQuestionPreview/index.css.map +1 -1
  13. package/dist/ActivityDetails/index.css +13 -0
  14. package/dist/ActivityDetails/index.css.map +1 -1
  15. package/dist/ActivityFilters/index.css +13 -0
  16. package/dist/ActivityFilters/index.css.map +1 -1
  17. package/dist/ActivityPreview/index.css +13 -0
  18. package/dist/ActivityPreview/index.css.map +1 -1
  19. package/dist/AlertManager/index.css +13 -0
  20. package/dist/AlertManager/index.css.map +1 -1
  21. package/dist/RecommendedLessonsHistory/index.css +13 -0
  22. package/dist/RecommendedLessonsHistory/index.css.map +1 -1
  23. package/dist/RecommendedLessonsHistory/index.js +10 -2
  24. package/dist/RecommendedLessonsHistory/index.js.map +1 -1
  25. package/dist/RecommendedLessonsHistory/index.mjs +10 -2
  26. package/dist/RecommendedLessonsHistory/index.mjs.map +1 -1
  27. package/dist/SendActivityModal/SendActivityModal.css +13 -0
  28. package/dist/SendActivityModal/SendActivityModal.css.map +1 -1
  29. package/dist/SendActivityModal/index.css +13 -0
  30. package/dist/SendActivityModal/index.css.map +1 -1
  31. package/dist/TableProvider/index.css +13 -0
  32. package/dist/TableProvider/index.css.map +1 -1
  33. package/dist/hooks/useActivitiesHistory/index.d.ts +210 -0
  34. package/dist/hooks/useActivitiesHistory/index.d.ts.map +1 -0
  35. package/dist/hooks/useActivitiesHistory/index.js +181 -0
  36. package/dist/hooks/useActivitiesHistory/index.js.map +1 -0
  37. package/dist/hooks/useActivitiesHistory/index.mjs +141 -0
  38. package/dist/hooks/useActivitiesHistory/index.mjs.map +1 -0
  39. package/dist/hooks/useActivitiesHistory.d.ts +210 -0
  40. package/dist/hooks/useActivitiesHistory.d.ts.map +1 -0
  41. package/dist/hooks/useActivityModels/index.d.ts +220 -0
  42. package/dist/hooks/useActivityModels/index.d.ts.map +1 -0
  43. package/dist/hooks/useActivityModels/index.js +186 -0
  44. package/dist/hooks/useActivityModels/index.js.map +1 -0
  45. package/dist/hooks/useActivityModels/index.mjs +146 -0
  46. package/dist/hooks/useActivityModels/index.mjs.map +1 -0
  47. package/dist/hooks/useActivityModels.d.ts +220 -0
  48. package/dist/hooks/useActivityModels.d.ts.map +1 -0
  49. package/dist/index.css +13 -0
  50. package/dist/index.css.map +1 -1
  51. package/dist/index.d.ts +8 -0
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +1069 -23
  54. package/dist/index.js.map +1 -1
  55. package/dist/index.mjs +1049 -23
  56. package/dist/index.mjs.map +1 -1
  57. package/dist/styles.css +13 -0
  58. package/dist/styles.css.map +1 -1
  59. package/dist/types/activitiesHistory/index.d.ts +196 -0
  60. package/dist/types/activitiesHistory/index.d.ts.map +1 -0
  61. package/dist/types/activitiesHistory/index.js +92 -0
  62. package/dist/types/activitiesHistory/index.js.map +1 -0
  63. package/dist/types/activitiesHistory/index.mjs +59 -0
  64. package/dist/types/activitiesHistory/index.mjs.map +1 -0
  65. package/dist/types/activitiesHistory.d.ts +196 -0
  66. package/dist/types/activitiesHistory.d.ts.map +1 -0
  67. package/dist/types/common.d.ts +44 -0
  68. package/dist/types/common.d.ts.map +1 -0
  69. package/dist/types/recommendedLessons/index.d.ts +10 -18
  70. package/dist/types/recommendedLessons/index.d.ts.map +1 -1
  71. package/dist/types/recommendedLessons/index.js +27 -22
  72. package/dist/types/recommendedLessons/index.js.map +1 -1
  73. package/dist/types/recommendedLessons/index.mjs +26 -23
  74. package/dist/types/recommendedLessons/index.mjs.map +1 -1
  75. package/dist/types/recommendedLessons.d.ts +10 -18
  76. package/dist/types/recommendedLessons.d.ts.map +1 -1
  77. package/dist/utils/hookErrorHandler.d.ts +24 -0
  78. package/dist/utils/hookErrorHandler.d.ts.map +1 -0
  79. package/package.json +7 -1
  80. package/dist/RecommendedLessonDetails/index.d.ts +0 -5
  81. package/dist/RecommendedLessonDetails/index.d.ts.map +0 -1
  82. package/dist/RecommendedLessonDetails/index.js +0 -4854
  83. package/dist/RecommendedLessonDetails/index.js.map +0 -1
  84. package/dist/RecommendedLessonDetails/index.mjs +0 -4872
  85. package/dist/RecommendedLessonDetails/index.mjs.map +0 -1
  86. package/dist/hooks/useRecommendedLessonDetails/index.d.ts +0 -780
  87. package/dist/hooks/useRecommendedLessonDetails/index.d.ts.map +0 -1
  88. package/dist/hooks/useRecommendedLessonDetails/index.js +0 -204
  89. package/dist/hooks/useRecommendedLessonDetails/index.js.map +0 -1
  90. package/dist/hooks/useRecommendedLessonDetails/index.mjs +0 -174
  91. package/dist/hooks/useRecommendedLessonDetails/index.mjs.map +0 -1
package/dist/index.js CHANGED
@@ -31,11 +31,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
33
  ACTIVITY_AVAILABILITY: () => ACTIVITY_AVAILABILITY,
34
+ ACTIVITY_FILTER_STATUS_OPTIONS: () => ACTIVITY_FILTER_STATUS_OPTIONS,
34
35
  ANSWER_STATUS: () => ANSWER_STATUS,
35
36
  AccordionGroup: () => AccordionGroup,
37
+ ActivitiesHistory: () => ActivitiesHistory,
38
+ ActivityApiStatus: () => GenericApiStatus,
39
+ ActivityBadgeActionType: () => BadgeActionType,
36
40
  ActivityCardQuestionBanks: () => ActivityCardQuestionBanks,
37
41
  ActivityCardQuestionPreview: () => ActivityCardQuestionPreview,
38
42
  ActivityDetails: () => ActivityDetails,
43
+ ActivityDisplayStatus: () => GenericDisplayStatus,
44
+ ActivityDraftType: () => ActivityDraftType,
39
45
  ActivityFilters: () => ActivityFilters,
40
46
  ActivityFiltersPopover: () => ActivityFiltersPopover,
41
47
  ActivityPreview: () => ActivityPreview,
@@ -69,6 +75,8 @@ __export(src_exports, {
69
75
  Chips: () => Chips_default,
70
76
  CorrectActivityModal: () => CorrectActivityModal_default,
71
77
  CreateActivity: () => CreateActivity,
78
+ DEFAULT_ACTIVITIES_PAGINATION: () => DEFAULT_ACTIVITIES_PAGINATION,
79
+ DEFAULT_MODELS_PAGINATION: () => DEFAULT_MODELS_PAGINATION,
72
80
  DIFFICULTY_LEVEL_ENUM: () => DIFFICULTY_LEVEL_ENUM,
73
81
  DateTimeInput: () => DateTimeInput_default,
74
82
  Divider: () => Divider_default,
@@ -84,9 +92,9 @@ __export(src_exports, {
84
92
  FilterModal: () => FilterModal,
85
93
  GOAL_FILTER_STATUS_OPTIONS: () => GOAL_FILTER_STATUS_OPTIONS,
86
94
  GOAL_STATUS_OPTIONS: () => GOAL_STATUS_OPTIONS,
87
- GoalApiStatus: () => GoalApiStatus,
88
- GoalBadgeActionType: () => GoalBadgeActionType,
89
- GoalDisplayStatus: () => GoalDisplayStatus,
95
+ GoalApiStatus: () => GenericApiStatus,
96
+ GoalBadgeActionType: () => BadgeActionType,
97
+ GoalDisplayStatus: () => GenericDisplayStatus,
90
98
  IconButton: () => IconButton_default,
91
99
  IconRender: () => IconRender_default,
92
100
  IconRoundedButton: () => IconRoundedButton_default,
@@ -191,15 +199,21 @@ __export(src_exports, {
191
199
  Toaster: () => Toaster_default,
192
200
  VideoPlayer: () => VideoPlayer_default,
193
201
  Whiteboard: () => Whiteboard_default,
202
+ activitiesHistoryApiResponseSchema: () => activitiesHistoryApiResponseSchema,
203
+ activityModelsApiResponseSchema: () => activityModelsApiResponseSchema,
194
204
  cn: () => cn,
195
205
  convertActivityFiltersToQuestionsFilter: () => convertActivityFiltersToQuestionsFilter,
206
+ createActivitiesHistoryHook: () => createActivitiesHistoryHook,
196
207
  createActivityFiltersDataHook: () => createActivityFiltersDataHook,
208
+ createActivityModelsHook: () => createActivityModelsHook,
197
209
  createNotificationStore: () => createNotificationStore,
198
210
  createNotificationsHook: () => createNotificationsHook,
199
211
  createQuestionsListHook: () => createQuestionsListHook,
200
212
  createRecommendedLessonDetailsHook: () => createRecommendedLessonDetailsHook,
201
213
  createRecommendedLessonsHistoryHook: () => createRecommendedLessonsHistoryHook,
214
+ createUseActivitiesHistory: () => createUseActivitiesHistory,
202
215
  createUseActivityFiltersData: () => createUseActivityFiltersData,
216
+ createUseActivityModels: () => createUseActivityModels,
203
217
  createUseNotificationStore: () => createUseNotificationStore,
204
218
  createUseNotifications: () => createUseNotifications,
205
219
  createUseQuestionsList: () => createUseQuestionsList,
@@ -215,6 +229,7 @@ __export(src_exports, {
215
229
  formatTimeAgo: () => formatTimeAgo,
216
230
  formatTimeSpent: () => formatTimeSpent,
217
231
  generateFileId: () => generateFileId,
232
+ getActivityStatusBadgeAction: () => getActivityStatusBadgeAction,
218
233
  getCategoryIcon: () => getCategoryIcon,
219
234
  getCategoryText: () => getCategoryText,
220
235
  getDeviceType: () => getDeviceType,
@@ -235,12 +250,15 @@ __export(src_exports, {
235
250
  goalApiResponseSchema: () => goalApiResponseSchema,
236
251
  goalDetailsApiResponseSchema: () => goalDetailsApiResponseSchema,
237
252
  goalsHistoryApiResponseSchema: () => goalsHistoryApiResponseSchema,
253
+ handleActivityFetchError: () => handleActivityFetchError,
238
254
  handleGoalFetchError: () => handleGoalFetchError,
239
255
  handleLessonDetailsFetchError: () => handleLessonDetailsFetchError,
256
+ handleModelFetchError: () => handleModelFetchError,
240
257
  historyApiResponseSchema: () => historyApiResponseSchema,
241
258
  isDeadlinePassed: () => isDeadlinePassed,
242
259
  isFormValid: () => isFormValid,
243
260
  isStepValid: () => isStepValid,
261
+ mapActivityStatusToDisplay: () => mapActivityStatusToDisplay,
244
262
  mapApiStatusToInternal: () => mapApiStatusToInternal,
245
263
  mapInternalStatusToApi: () => mapInternalStatusToApi,
246
264
  mapQuestionTypeToEnum: () => mapQuestionTypeToEnum,
@@ -250,7 +268,9 @@ __export(src_exports, {
250
268
  syncDropdownState: () => syncDropdownState,
251
269
  toggleArrayItem: () => toggleArrayItem,
252
270
  toggleSingleValue: () => toggleSingleValue,
271
+ transformActivityToTableItem: () => transformActivityToTableItem,
253
272
  transformGoalToTableItem: () => transformGoalToTableItem,
273
+ transformModelToTableItem: () => transformModelToTableItem,
254
274
  useAlertFormStore: () => useAlertFormStore,
255
275
  useApiConfig: () => useApiConfig,
256
276
  useAppContent: () => useAppContent,
@@ -5225,6 +5245,11 @@ var Toaster = () => {
5225
5245
  toast.id
5226
5246
  )) });
5227
5247
  };
5248
+ var useToast = () => {
5249
+ const addToast = ToastStore_default((state) => state.addToast);
5250
+ const removeToast = ToastStore_default((state) => state.removeToast);
5251
+ return { addToast, removeToast };
5252
+ };
5228
5253
  var Toaster_default = Toaster;
5229
5254
 
5230
5255
  // src/components/Search/Search.tsx
@@ -22523,26 +22548,26 @@ var SendActivityModal_default = SendActivityModal;
22523
22548
  var import_react71 = require("react");
22524
22549
  var import_phosphor_react44 = require("phosphor-react");
22525
22550
 
22526
- // src/types/recommendedLessons.ts
22527
- var GoalApiStatus = /* @__PURE__ */ ((GoalApiStatus3) => {
22528
- GoalApiStatus3["A_VENCER"] = "A_VENCER";
22529
- GoalApiStatus3["VENCIDA"] = "VENCIDA";
22530
- GoalApiStatus3["CONCLUIDA"] = "CONCLUIDA";
22531
- return GoalApiStatus3;
22532
- })(GoalApiStatus || {});
22533
- var GoalDisplayStatus = /* @__PURE__ */ ((GoalDisplayStatus3) => {
22534
- GoalDisplayStatus3["ATIVA"] = "ATIVA";
22535
- GoalDisplayStatus3["VENCIDA"] = "VENCIDA";
22536
- GoalDisplayStatus3["CONCLUIDA"] = "CONCLU\xCDDA";
22537
- return GoalDisplayStatus3;
22538
- })(GoalDisplayStatus || {});
22539
- var GoalBadgeActionType = /* @__PURE__ */ ((GoalBadgeActionType2) => {
22540
- GoalBadgeActionType2["SUCCESS"] = "success";
22541
- GoalBadgeActionType2["WARNING"] = "warning";
22542
- GoalBadgeActionType2["ERROR"] = "error";
22543
- return GoalBadgeActionType2;
22544
- })(GoalBadgeActionType || {});
22545
- var getGoalStatusBadgeAction = (status) => {
22551
+ // src/types/common.ts
22552
+ var GenericApiStatus = /* @__PURE__ */ ((GenericApiStatus2) => {
22553
+ GenericApiStatus2["A_VENCER"] = "A_VENCER";
22554
+ GenericApiStatus2["VENCIDA"] = "VENCIDA";
22555
+ GenericApiStatus2["CONCLUIDA"] = "CONCLUIDA";
22556
+ return GenericApiStatus2;
22557
+ })(GenericApiStatus || {});
22558
+ var GenericDisplayStatus = /* @__PURE__ */ ((GenericDisplayStatus4) => {
22559
+ GenericDisplayStatus4["ATIVA"] = "ATIVA";
22560
+ GenericDisplayStatus4["VENCIDA"] = "VENCIDA";
22561
+ GenericDisplayStatus4["CONCLUIDA"] = "CONCLU\xCDDA";
22562
+ return GenericDisplayStatus4;
22563
+ })(GenericDisplayStatus || {});
22564
+ var BadgeActionType = /* @__PURE__ */ ((BadgeActionType4) => {
22565
+ BadgeActionType4["SUCCESS"] = "success";
22566
+ BadgeActionType4["WARNING"] = "warning";
22567
+ BadgeActionType4["ERROR"] = "error";
22568
+ return BadgeActionType4;
22569
+ })(BadgeActionType || {});
22570
+ var getStatusBadgeAction2 = (status) => {
22546
22571
  const actionMap = {
22547
22572
  ["CONCLU\xCDDA" /* CONCLUIDA */]: "success" /* SUCCESS */,
22548
22573
  ["ATIVA" /* ATIVA */]: "warning" /* WARNING */,
@@ -22550,6 +22575,17 @@ var getGoalStatusBadgeAction = (status) => {
22550
22575
  };
22551
22576
  return actionMap[status] ?? "warning" /* WARNING */;
22552
22577
  };
22578
+ var mapApiStatusToDisplay = (apiStatus) => {
22579
+ const statusMap = {
22580
+ ["A_VENCER" /* A_VENCER */]: "ATIVA" /* ATIVA */,
22581
+ ["VENCIDA" /* VENCIDA */]: "VENCIDA" /* VENCIDA */,
22582
+ ["CONCLUIDA" /* CONCLUIDA */]: "CONCLU\xCDDA" /* CONCLUIDA */
22583
+ };
22584
+ return statusMap[apiStatus];
22585
+ };
22586
+
22587
+ // src/types/recommendedLessons.ts
22588
+ var getGoalStatusBadgeAction = (status) => getStatusBadgeAction2(status);
22553
22589
  var GOAL_FILTER_STATUS_OPTIONS = [
22554
22590
  { id: "VENCIDA" /* VENCIDA */, name: "Vencida" },
22555
22591
  { id: "A_VENCER" /* A_VENCER */, name: "Ativa" }
@@ -24093,14 +24129,1010 @@ var createUseRecommendedLessonDetails = (apiClient) => {
24093
24129
  };
24094
24130
  };
24095
24131
  var createRecommendedLessonDetailsHook = createUseRecommendedLessonDetails;
24132
+
24133
+ // src/components/ActivitiesHistory/ActivitiesHistory.tsx
24134
+ var import_react85 = require("react");
24135
+
24136
+ // src/components/ActivitiesHistory/tabs/HistoryTab.tsx
24137
+ var import_react82 = require("react");
24138
+ var import_phosphor_react46 = require("phosphor-react");
24139
+
24140
+ // src/components/ActivitiesHistory/components/ErrorDisplay.tsx
24141
+ var import_jsx_runtime95 = require("react/jsx-runtime");
24142
+ var ErrorDisplay = ({ error }) => /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Text_default, { size: "lg", color: "text-error-500", children: error }) });
24143
+
24144
+ // src/components/ActivitiesHistory/config/historyTableColumns.tsx
24145
+ var import_phosphor_react45 = require("phosphor-react");
24146
+
24147
+ // src/components/ActivitiesHistory/utils/renderSubjectCell.tsx
24148
+ var import_jsx_runtime96 = require("react/jsx-runtime");
24149
+ var renderSubjectCell = (subjectName, mapSubjectNameToEnum, showEmptyDash = false) => {
24150
+ if (!subjectName) {
24151
+ return showEmptyDash ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(Text_default, { size: "sm", color: "text-text-400", children: "-" }) : null;
24152
+ }
24153
+ const subjectEnum = mapSubjectNameToEnum?.(subjectName);
24154
+ if (!subjectEnum) {
24155
+ return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(Text_default, { size: "sm", className: "truncate", title: subjectName, children: subjectName });
24156
+ }
24157
+ const subjectInfo = getSubjectInfo(subjectEnum);
24158
+ return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { className: "flex items-center gap-2", title: subjectName, children: [
24159
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
24160
+ "span",
24161
+ {
24162
+ className: cn(
24163
+ "w-[21px] h-[21px] flex items-center justify-center rounded-sm text-text-950 shrink-0",
24164
+ subjectInfo.colorClass
24165
+ ),
24166
+ children: subjectInfo.icon
24167
+ }
24168
+ ),
24169
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(Text_default, { size: "sm", className: "truncate", children: subjectName })
24170
+ ] });
24171
+ };
24172
+
24173
+ // src/components/ActivitiesHistory/utils/renderTruncatedText.tsx
24174
+ var import_jsx_runtime97 = require("react/jsx-runtime");
24175
+ var renderTruncatedText = (value) => {
24176
+ const text = typeof value === "string" ? value : "";
24177
+ return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Text_default, { size: "sm", title: text, children: text });
24178
+ };
24179
+
24180
+ // src/components/ActivitiesHistory/utils/filterBuilders.ts
24181
+ var isNonEmptyArray2 = (param) => Array.isArray(param) && param.length > 0;
24182
+ var isValidApiStatus = (value) => Object.values(GenericApiStatus).includes(value);
24183
+ var buildHistoryFiltersFromParams = (params) => {
24184
+ const filters = {
24185
+ page: params.page,
24186
+ limit: params.limit
24187
+ };
24188
+ if (params.search) {
24189
+ filters.search = params.search;
24190
+ }
24191
+ if (isNonEmptyArray2(params.status) && isValidApiStatus(params.status[0])) {
24192
+ filters.status = params.status[0];
24193
+ }
24194
+ if (isNonEmptyArray2(params.school)) {
24195
+ filters.schoolId = params.school[0];
24196
+ }
24197
+ if (isNonEmptyArray2(params.subject)) {
24198
+ filters.subjectId = params.subject[0];
24199
+ }
24200
+ return filters;
24201
+ };
24202
+ var buildModelsFiltersFromParams = (params) => {
24203
+ const filters = {
24204
+ page: params.page,
24205
+ limit: params.limit
24206
+ };
24207
+ if (params.search) {
24208
+ filters.search = params.search;
24209
+ }
24210
+ if (isNonEmptyArray2(params.subject)) {
24211
+ filters.subjectId = params.subject[0];
24212
+ }
24213
+ return filters;
24214
+ };
24215
+
24216
+ // src/components/ActivitiesHistory/utils/filterOptions.ts
24217
+ var getSchoolOptions2 = (data) => {
24218
+ if (!data?.schools) return [];
24219
+ return data.schools.map((school) => ({
24220
+ id: school.id,
24221
+ name: school.name
24222
+ }));
24223
+ };
24224
+ var getSubjectOptions2 = (data) => {
24225
+ if (!data?.subjects) return [];
24226
+ return data.subjects.map((subject) => ({
24227
+ id: subject.id,
24228
+ name: subject.name
24229
+ }));
24230
+ };
24231
+
24232
+ // src/types/activitiesHistory.ts
24233
+ var ActivityDraftType = /* @__PURE__ */ ((ActivityDraftType2) => {
24234
+ ActivityDraftType2["MODELO"] = "MODELO";
24235
+ ActivityDraftType2["RASCUNHO"] = "RASCUNHO";
24236
+ return ActivityDraftType2;
24237
+ })(ActivityDraftType || {});
24238
+ var getActivityStatusBadgeAction = (status) => getStatusBadgeAction2(status);
24239
+ var ACTIVITY_FILTER_STATUS_OPTIONS = [
24240
+ { id: "A_VENCER" /* A_VENCER */, name: "A Vencer" },
24241
+ { id: "VENCIDA" /* VENCIDA */, name: "Vencida" },
24242
+ { id: "CONCLUIDA" /* CONCLUIDA */, name: "Conclu\xEDda" }
24243
+ ];
24244
+ var mapActivityStatusToDisplay = (apiStatus) => mapApiStatusToDisplay(apiStatus);
24245
+
24246
+ // src/components/ActivitiesHistory/config/historyTableColumns.tsx
24247
+ var import_jsx_runtime98 = require("react/jsx-runtime");
24248
+ var createHistoryTableColumns = (mapSubjectNameToEnum) => [
24249
+ {
24250
+ key: "startDate",
24251
+ label: "In\xEDcio",
24252
+ sortable: true
24253
+ },
24254
+ {
24255
+ key: "deadline",
24256
+ label: "Prazo",
24257
+ sortable: true
24258
+ },
24259
+ {
24260
+ key: "title",
24261
+ label: "T\xEDtulo",
24262
+ sortable: true,
24263
+ className: "max-w-[200px] truncate",
24264
+ render: renderTruncatedText
24265
+ },
24266
+ {
24267
+ key: "school",
24268
+ label: "Escola",
24269
+ sortable: true,
24270
+ className: "max-w-[150px] truncate",
24271
+ render: renderTruncatedText
24272
+ },
24273
+ {
24274
+ key: "year",
24275
+ label: "Ano",
24276
+ sortable: true
24277
+ },
24278
+ {
24279
+ key: "subject",
24280
+ label: "Mat\xE9ria",
24281
+ sortable: true,
24282
+ className: "max-w-[140px]",
24283
+ render: (value) => {
24284
+ const subjectName = typeof value === "string" ? value : "";
24285
+ return renderSubjectCell(subjectName, mapSubjectNameToEnum, false);
24286
+ }
24287
+ },
24288
+ {
24289
+ key: "class",
24290
+ label: "Turma",
24291
+ sortable: true
24292
+ },
24293
+ {
24294
+ key: "status",
24295
+ label: "Status",
24296
+ sortable: true,
24297
+ render: (value) => {
24298
+ const status = typeof value === "string" ? value : "";
24299
+ if (!status) {
24300
+ return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text_default, { size: "sm", color: "text-text-500", children: "-" });
24301
+ }
24302
+ return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
24303
+ Badge_default,
24304
+ {
24305
+ variant: "solid",
24306
+ action: getActivityStatusBadgeAction(status),
24307
+ size: "small",
24308
+ children: status
24309
+ }
24310
+ );
24311
+ }
24312
+ },
24313
+ {
24314
+ key: "completionPercentage",
24315
+ label: "Conclus\xE3o",
24316
+ sortable: true,
24317
+ render: (value) => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
24318
+ ProgressBar_default,
24319
+ {
24320
+ value: Number(value),
24321
+ variant: "blue",
24322
+ size: "medium",
24323
+ layout: "compact",
24324
+ showPercentage: true,
24325
+ compactWidth: "w-[100px]"
24326
+ }
24327
+ )
24328
+ },
24329
+ {
24330
+ key: "navigation",
24331
+ label: "",
24332
+ sortable: false,
24333
+ className: "w-12",
24334
+ render: () => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_phosphor_react45.CaretRight, { size: 20, className: "text-text-600" }) })
24335
+ }
24336
+ ];
24337
+
24338
+ // src/components/ActivitiesHistory/config/historyFiltersConfig.ts
24339
+ var createHistoryFiltersConfig = (userData) => [
24340
+ {
24341
+ key: "status",
24342
+ label: "STATUS",
24343
+ categories: [
24344
+ {
24345
+ key: "status",
24346
+ label: "Status da Atividade",
24347
+ selectedIds: [],
24348
+ itens: ACTIVITY_FILTER_STATUS_OPTIONS
24349
+ }
24350
+ ]
24351
+ },
24352
+ {
24353
+ key: "academic",
24354
+ label: "DADOS ACAD\xCAMICOS",
24355
+ categories: [
24356
+ {
24357
+ key: "school",
24358
+ label: "Escola",
24359
+ selectedIds: [],
24360
+ itens: getSchoolOptions2(userData)
24361
+ }
24362
+ ]
24363
+ },
24364
+ {
24365
+ key: "content",
24366
+ label: "CONTE\xDADO",
24367
+ categories: [
24368
+ {
24369
+ key: "subject",
24370
+ label: "Mat\xE9ria",
24371
+ selectedIds: [],
24372
+ itens: getSubjectOptions2(userData)
24373
+ }
24374
+ ]
24375
+ }
24376
+ ];
24377
+
24378
+ // src/hooks/useActivitiesHistory.ts
24379
+ var import_react81 = require("react");
24380
+ var import_zod7 = require("zod");
24381
+ var import_dayjs4 = __toESM(require("dayjs"));
24382
+
24383
+ // src/utils/hookErrorHandler.ts
24384
+ var import_zod6 = require("zod");
24385
+ var createFetchErrorHandler = (validationErrorMessage, genericErrorMessage) => (error) => {
24386
+ if (error instanceof import_zod6.z.ZodError) {
24387
+ console.error(validationErrorMessage, error);
24388
+ return validationErrorMessage;
24389
+ }
24390
+ console.error(genericErrorMessage, error);
24391
+ return genericErrorMessage;
24392
+ };
24393
+
24394
+ // src/hooks/useActivitiesHistory.ts
24395
+ var activityHistoryResponseSchema = import_zod7.z.object({
24396
+ id: import_zod7.z.string().uuid(),
24397
+ title: import_zod7.z.string(),
24398
+ startDate: import_zod7.z.string().nullable(),
24399
+ finalDate: import_zod7.z.string().nullable(),
24400
+ status: import_zod7.z.nativeEnum(GenericApiStatus),
24401
+ completionPercentage: import_zod7.z.number().min(0).max(100),
24402
+ subjectId: import_zod7.z.string().uuid(),
24403
+ schoolId: import_zod7.z.string().optional(),
24404
+ schoolName: import_zod7.z.string().optional(),
24405
+ year: import_zod7.z.string().optional(),
24406
+ className: import_zod7.z.string().optional(),
24407
+ subjectName: import_zod7.z.string().optional()
24408
+ });
24409
+ var activitiesHistoryApiResponseSchema = import_zod7.z.object({
24410
+ message: import_zod7.z.string(),
24411
+ data: import_zod7.z.object({
24412
+ activities: import_zod7.z.array(activityHistoryResponseSchema),
24413
+ pagination: import_zod7.z.object({
24414
+ total: import_zod7.z.number(),
24415
+ page: import_zod7.z.number(),
24416
+ limit: import_zod7.z.number(),
24417
+ totalPages: import_zod7.z.number()
24418
+ })
24419
+ })
24420
+ });
24421
+ var DEFAULT_ACTIVITIES_PAGINATION = {
24422
+ total: 0,
24423
+ page: 1,
24424
+ limit: 10,
24425
+ totalPages: 0
24426
+ };
24427
+ var transformActivityToTableItem = (activity) => {
24428
+ return {
24429
+ id: activity.id,
24430
+ startDate: activity.startDate ? (0, import_dayjs4.default)(activity.startDate).format("DD/MM") : "-",
24431
+ deadline: activity.finalDate ? (0, import_dayjs4.default)(activity.finalDate).format("DD/MM") : "-",
24432
+ title: activity.title,
24433
+ school: activity.schoolName || "-",
24434
+ year: activity.year || "-",
24435
+ subject: activity.subjectName || "-",
24436
+ class: activity.className || "-",
24437
+ status: mapActivityStatusToDisplay(activity.status),
24438
+ completionPercentage: activity.completionPercentage
24439
+ };
24440
+ };
24441
+ var handleActivityFetchError = createFetchErrorHandler(
24442
+ "Erro ao validar dados de hist\xF3rico de atividades",
24443
+ "Erro ao carregar hist\xF3rico de atividades"
24444
+ );
24445
+ var createUseActivitiesHistory = (fetchActivitiesHistory) => {
24446
+ return () => {
24447
+ const [state, setState] = (0, import_react81.useState)({
24448
+ activities: [],
24449
+ loading: false,
24450
+ error: null,
24451
+ pagination: DEFAULT_ACTIVITIES_PAGINATION
24452
+ });
24453
+ const fetchActivities = (0, import_react81.useCallback)(
24454
+ async (filters) => {
24455
+ setState((prev) => ({ ...prev, loading: true, error: null }));
24456
+ try {
24457
+ const responseData = await fetchActivitiesHistory(filters);
24458
+ const validatedData = activitiesHistoryApiResponseSchema.parse(responseData);
24459
+ const tableItems = validatedData.data.activities.map(
24460
+ transformActivityToTableItem
24461
+ );
24462
+ setState({
24463
+ activities: tableItems,
24464
+ loading: false,
24465
+ error: null,
24466
+ pagination: validatedData.data.pagination
24467
+ });
24468
+ } catch (error) {
24469
+ const errorMessage = handleActivityFetchError(error);
24470
+ setState((prev) => ({
24471
+ ...prev,
24472
+ loading: false,
24473
+ error: errorMessage
24474
+ }));
24475
+ }
24476
+ },
24477
+ [fetchActivitiesHistory]
24478
+ );
24479
+ return {
24480
+ ...state,
24481
+ fetchActivities
24482
+ };
24483
+ };
24484
+ };
24485
+ var createActivitiesHistoryHook = createUseActivitiesHistory;
24486
+
24487
+ // src/components/ActivitiesHistory/tabs/HistoryTab.tsx
24488
+ var import_jsx_runtime99 = require("react/jsx-runtime");
24489
+ var HistoryTab = ({
24490
+ fetchActivitiesHistory,
24491
+ onCreateActivity,
24492
+ onRowClick,
24493
+ emptyStateImage,
24494
+ noSearchImage,
24495
+ mapSubjectNameToEnum,
24496
+ userFilterData
24497
+ }) => {
24498
+ const fetchActivitiesHistoryRef = (0, import_react82.useRef)(fetchActivitiesHistory);
24499
+ fetchActivitiesHistoryRef.current = fetchActivitiesHistory;
24500
+ const useActivitiesHistory = (0, import_react82.useMemo)(
24501
+ () => createUseActivitiesHistory(
24502
+ (filters) => fetchActivitiesHistoryRef.current(filters)
24503
+ ),
24504
+ []
24505
+ );
24506
+ const {
24507
+ activities,
24508
+ loading,
24509
+ error,
24510
+ pagination,
24511
+ fetchActivities
24512
+ } = useActivitiesHistory();
24513
+ const historyFilterConfigs = (0, import_react82.useMemo)(
24514
+ () => createHistoryFiltersConfig(userFilterData),
24515
+ [userFilterData]
24516
+ );
24517
+ const historyTableColumns = (0, import_react82.useMemo)(
24518
+ () => createHistoryTableColumns(mapSubjectNameToEnum),
24519
+ [mapSubjectNameToEnum]
24520
+ );
24521
+ const handleParamsChange = (0, import_react82.useCallback)(
24522
+ (params) => {
24523
+ const filters = buildHistoryFiltersFromParams(params);
24524
+ fetchActivities(filters);
24525
+ },
24526
+ [fetchActivities]
24527
+ );
24528
+ if (error) {
24529
+ return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(ErrorDisplay, { error });
24530
+ }
24531
+ return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
24532
+ TableProvider,
24533
+ {
24534
+ data: activities,
24535
+ headers: historyTableColumns,
24536
+ loading,
24537
+ variant: "borderless",
24538
+ enableSearch: true,
24539
+ enableFilters: true,
24540
+ enableTableSort: true,
24541
+ enablePagination: true,
24542
+ enableRowClick: true,
24543
+ initialFilters: historyFilterConfigs,
24544
+ paginationConfig: {
24545
+ itemLabel: "atividades",
24546
+ itemsPerPageOptions: [10, 20, 50, 100],
24547
+ defaultItemsPerPage: 10,
24548
+ totalItems: pagination.total,
24549
+ totalPages: pagination.totalPages
24550
+ },
24551
+ searchPlaceholder: "Buscar atividade",
24552
+ noSearchResultState: {
24553
+ image: noSearchImage
24554
+ },
24555
+ emptyState: {
24556
+ component: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
24557
+ EmptyState_default,
24558
+ {
24559
+ image: emptyStateImage,
24560
+ title: "Incentive sua turma ao aprendizado",
24561
+ description: "Crie uma nova atividade e ajude seus alunos a colocarem o conte\xFAdo em pr\xE1tica!",
24562
+ buttonText: "Criar atividade",
24563
+ buttonIcon: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_phosphor_react46.Plus, { size: 18 }),
24564
+ buttonVariant: "outline",
24565
+ buttonAction: "primary",
24566
+ onButtonClick: onCreateActivity
24567
+ }
24568
+ )
24569
+ },
24570
+ onParamsChange: handleParamsChange,
24571
+ onRowClick,
24572
+ children: (renderProps) => {
24573
+ const {
24574
+ controls,
24575
+ table,
24576
+ pagination: paginationComponent
24577
+ } = renderProps;
24578
+ return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "space-y-4", children: [
24579
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
24580
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
24581
+ Button_default,
24582
+ {
24583
+ variant: "solid",
24584
+ action: "primary",
24585
+ size: "medium",
24586
+ onClick: onCreateActivity,
24587
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_phosphor_react46.Plus, { size: 18, weight: "bold" }),
24588
+ children: "Criar atividade"
24589
+ }
24590
+ ),
24591
+ controls
24592
+ ] }),
24593
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
24594
+ table,
24595
+ paginationComponent
24596
+ ] })
24597
+ ] });
24598
+ }
24599
+ }
24600
+ ) });
24601
+ };
24602
+
24603
+ // src/components/ActivitiesHistory/tabs/ModelsTab.tsx
24604
+ var import_react84 = require("react");
24605
+ var import_phosphor_react48 = require("phosphor-react");
24606
+
24607
+ // src/components/ActivitiesHistory/config/modelsTableColumns.tsx
24608
+ var import_phosphor_react47 = require("phosphor-react");
24609
+ var import_jsx_runtime100 = require("react/jsx-runtime");
24610
+ var createModelsTableColumns = (mapSubjectNameToEnum, onSendActivity, onEditModel, onDeleteModel) => [
24611
+ {
24612
+ key: "title",
24613
+ label: "T\xEDtulo",
24614
+ sortable: true,
24615
+ className: "max-w-[400px]",
24616
+ render: (value) => {
24617
+ const title = typeof value === "string" ? value : "";
24618
+ return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Text_default, { size: "sm", title, className: "truncate block", children: title });
24619
+ }
24620
+ },
24621
+ {
24622
+ key: "savedAt",
24623
+ label: "Salvo em",
24624
+ sortable: true,
24625
+ className: "w-[120px]"
24626
+ },
24627
+ {
24628
+ key: "subject",
24629
+ label: "Mat\xE9ria",
24630
+ sortable: true,
24631
+ className: "max-w-[160px]",
24632
+ render: (value) => {
24633
+ const subjectName = typeof value === "string" ? value : "";
24634
+ return renderSubjectCell(subjectName, mapSubjectNameToEnum, true);
24635
+ }
24636
+ },
24637
+ {
24638
+ key: "actions",
24639
+ label: "",
24640
+ sortable: false,
24641
+ className: "w-[220px]",
24642
+ render: (_value, row) => {
24643
+ const handleSend = (e) => {
24644
+ e.stopPropagation();
24645
+ onSendActivity?.(row);
24646
+ };
24647
+ const handleEdit = (e) => {
24648
+ e.stopPropagation();
24649
+ onEditModel?.(row);
24650
+ };
24651
+ const handleDelete = (e) => {
24652
+ e.stopPropagation();
24653
+ onDeleteModel(row);
24654
+ };
24655
+ return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center gap-2 justify-end", children: [
24656
+ onSendActivity && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
24657
+ Button_default,
24658
+ {
24659
+ variant: "outline",
24660
+ action: "primary",
24661
+ size: "small",
24662
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_phosphor_react47.PaperPlaneTilt, { size: 16 }),
24663
+ onClick: handleSend,
24664
+ "aria-label": "Enviar atividade",
24665
+ children: "Enviar atividade"
24666
+ }
24667
+ ),
24668
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
24669
+ IconButton_default,
24670
+ {
24671
+ icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_phosphor_react47.Trash, { size: 20 }),
24672
+ size: "md",
24673
+ onClick: handleDelete,
24674
+ "aria-label": "Deletar modelo",
24675
+ className: "text-text-600 hover:text-error-500 hover:bg-transparent"
24676
+ }
24677
+ ),
24678
+ onEditModel && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
24679
+ IconButton_default,
24680
+ {
24681
+ icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_phosphor_react47.PencilSimple, { size: 20 }),
24682
+ size: "md",
24683
+ onClick: handleEdit,
24684
+ "aria-label": "Editar modelo",
24685
+ className: "text-text-600 hover:text-primary-700 hover:bg-transparent"
24686
+ }
24687
+ )
24688
+ ] });
24689
+ }
24690
+ }
24691
+ ];
24692
+
24693
+ // src/components/ActivitiesHistory/config/modelsFiltersConfig.ts
24694
+ var createModelsFiltersConfig = (userData) => [
24695
+ {
24696
+ key: "content",
24697
+ label: "CONTE\xDADO",
24698
+ categories: [
24699
+ {
24700
+ key: "subject",
24701
+ label: "Mat\xE9ria",
24702
+ selectedIds: [],
24703
+ itens: getSubjectOptions2(userData)
24704
+ }
24705
+ ]
24706
+ }
24707
+ ];
24708
+
24709
+ // src/hooks/useActivityModels.ts
24710
+ var import_react83 = require("react");
24711
+ var import_zod8 = require("zod");
24712
+ var import_dayjs5 = __toESM(require("dayjs"));
24713
+ var activityDraftFiltersSchema = import_zod8.z.object({
24714
+ questionTypes: import_zod8.z.array(import_zod8.z.string()).optional(),
24715
+ questionBanks: import_zod8.z.array(import_zod8.z.string()).optional(),
24716
+ subjects: import_zod8.z.array(import_zod8.z.string()).optional(),
24717
+ topics: import_zod8.z.array(import_zod8.z.string()).optional(),
24718
+ subtopics: import_zod8.z.array(import_zod8.z.string()).optional(),
24719
+ contents: import_zod8.z.array(import_zod8.z.string()).optional()
24720
+ }).nullable();
24721
+ var activityModelResponseSchema = import_zod8.z.object({
24722
+ id: import_zod8.z.string().uuid(),
24723
+ type: import_zod8.z.nativeEnum(ActivityDraftType),
24724
+ title: import_zod8.z.string().nullable(),
24725
+ creatorUserInstitutionId: import_zod8.z.string().uuid().nullable(),
24726
+ subjectId: import_zod8.z.string().uuid().nullable(),
24727
+ filters: activityDraftFiltersSchema,
24728
+ createdAt: import_zod8.z.string(),
24729
+ updatedAt: import_zod8.z.string()
24730
+ });
24731
+ var activityModelsApiResponseSchema = import_zod8.z.object({
24732
+ message: import_zod8.z.string(),
24733
+ data: import_zod8.z.object({
24734
+ activityDrafts: import_zod8.z.array(activityModelResponseSchema),
24735
+ total: import_zod8.z.number()
24736
+ })
24737
+ });
24738
+ var DEFAULT_MODELS_PAGINATION = {
24739
+ total: 0,
24740
+ page: 1,
24741
+ limit: 10,
24742
+ totalPages: 0
24743
+ };
24744
+ var transformModelToTableItem = (model, subjectsMap) => {
24745
+ const subjectName = model.subjectId ? subjectsMap?.get(model.subjectId) || "" : "";
24746
+ return {
24747
+ id: model.id,
24748
+ title: model.title || "Sem t\xEDtulo",
24749
+ savedAt: (0, import_dayjs5.default)(model.createdAt).format("DD/MM/YYYY"),
24750
+ subject: subjectName,
24751
+ subjectId: model.subjectId
24752
+ };
24753
+ };
24754
+ var handleModelFetchError = createFetchErrorHandler(
24755
+ "Erro ao validar dados de modelos de atividades",
24756
+ "Erro ao carregar modelos de atividades"
24757
+ );
24758
+ var createUseActivityModels = (fetchActivityModels, deleteActivityModel) => {
24759
+ return () => {
24760
+ const [state, setState] = (0, import_react83.useState)({
24761
+ models: [],
24762
+ loading: false,
24763
+ error: null,
24764
+ pagination: DEFAULT_MODELS_PAGINATION
24765
+ });
24766
+ const fetchModels = (0, import_react83.useCallback)(
24767
+ async (filters, subjectsMap) => {
24768
+ setState((prev) => ({ ...prev, loading: true, error: null }));
24769
+ try {
24770
+ const responseData = await fetchActivityModels(filters);
24771
+ const validatedData = activityModelsApiResponseSchema.parse(responseData);
24772
+ const tableItems = validatedData.data.activityDrafts.map(
24773
+ (model) => transformModelToTableItem(model, subjectsMap)
24774
+ );
24775
+ const limit = filters?.limit || 10;
24776
+ const page = filters?.page || 1;
24777
+ const total = validatedData.data.total;
24778
+ const totalPages = Math.ceil(total / limit);
24779
+ setState({
24780
+ models: tableItems,
24781
+ loading: false,
24782
+ error: null,
24783
+ pagination: {
24784
+ total,
24785
+ page,
24786
+ limit,
24787
+ totalPages
24788
+ }
24789
+ });
24790
+ } catch (error) {
24791
+ const errorMessage = handleModelFetchError(error);
24792
+ setState((prev) => ({
24793
+ ...prev,
24794
+ loading: false,
24795
+ error: errorMessage
24796
+ }));
24797
+ }
24798
+ },
24799
+ [fetchActivityModels]
24800
+ );
24801
+ const deleteModel = (0, import_react83.useCallback)(
24802
+ async (id) => {
24803
+ try {
24804
+ await deleteActivityModel(id);
24805
+ return true;
24806
+ } catch (error) {
24807
+ console.error("Erro ao deletar modelo:", error);
24808
+ return false;
24809
+ }
24810
+ },
24811
+ [deleteActivityModel]
24812
+ );
24813
+ return {
24814
+ ...state,
24815
+ fetchModels,
24816
+ deleteModel
24817
+ };
24818
+ };
24819
+ };
24820
+ var createActivityModelsHook = createUseActivityModels;
24821
+
24822
+ // src/components/ActivitiesHistory/tabs/ModelsTab.tsx
24823
+ var import_jsx_runtime101 = require("react/jsx-runtime");
24824
+ var ModelsTab = ({
24825
+ fetchActivityModels,
24826
+ deleteActivityModel,
24827
+ onCreateModel,
24828
+ onSendActivity,
24829
+ onEditModel,
24830
+ emptyStateImage,
24831
+ noSearchImage,
24832
+ mapSubjectNameToEnum,
24833
+ userFilterData,
24834
+ subjectsMap
24835
+ }) => {
24836
+ const [deleteDialogOpen, setDeleteDialogOpen] = (0, import_react84.useState)(false);
24837
+ const [modelToDelete, setModelToDelete] = (0, import_react84.useState)(null);
24838
+ const { addToast } = useToast();
24839
+ const fetchActivityModelsRef = (0, import_react84.useRef)(fetchActivityModels);
24840
+ fetchActivityModelsRef.current = fetchActivityModels;
24841
+ const deleteActivityModelRef = (0, import_react84.useRef)(deleteActivityModel);
24842
+ deleteActivityModelRef.current = deleteActivityModel;
24843
+ const subjectsMapRef = (0, import_react84.useRef)(subjectsMap);
24844
+ subjectsMapRef.current = subjectsMap;
24845
+ const useActivityModels = (0, import_react84.useMemo)(
24846
+ () => createUseActivityModels(
24847
+ (filters) => fetchActivityModelsRef.current(filters),
24848
+ (id) => deleteActivityModelRef.current(id)
24849
+ ),
24850
+ []
24851
+ );
24852
+ const {
24853
+ models,
24854
+ loading: modelsLoading,
24855
+ error: modelsError,
24856
+ pagination: modelsPagination,
24857
+ fetchModels,
24858
+ deleteModel
24859
+ } = useActivityModels();
24860
+ const modelsFilterConfigs = (0, import_react84.useMemo)(
24861
+ () => createModelsFiltersConfig(userFilterData),
24862
+ [userFilterData]
24863
+ );
24864
+ const handleDeleteClick = (0, import_react84.useCallback)((model) => {
24865
+ setModelToDelete(model);
24866
+ setDeleteDialogOpen(true);
24867
+ }, []);
24868
+ const modelsTableColumns = (0, import_react84.useMemo)(
24869
+ () => createModelsTableColumns(
24870
+ mapSubjectNameToEnum,
24871
+ onSendActivity,
24872
+ onEditModel,
24873
+ handleDeleteClick
24874
+ ),
24875
+ [mapSubjectNameToEnum, onSendActivity, onEditModel, handleDeleteClick]
24876
+ );
24877
+ const handleParamsChange = (0, import_react84.useCallback)(
24878
+ (params) => {
24879
+ const filters = buildModelsFiltersFromParams(params);
24880
+ fetchModels(filters, subjectsMapRef.current);
24881
+ },
24882
+ [fetchModels]
24883
+ );
24884
+ (0, import_react84.useEffect)(() => {
24885
+ fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
24886
+ }, [fetchModels]);
24887
+ const handleConfirmDelete = (0, import_react84.useCallback)(async () => {
24888
+ if (modelToDelete) {
24889
+ const success = await deleteModel(modelToDelete.id);
24890
+ if (success) {
24891
+ addToast({ title: "Modelo deletado com sucesso", action: "success" });
24892
+ fetchModels({ page: 1, limit: 10 }, subjectsMapRef.current);
24893
+ } else {
24894
+ addToast({ title: "Erro ao deletar modelo", action: "warning" });
24895
+ }
24896
+ }
24897
+ setDeleteDialogOpen(false);
24898
+ setModelToDelete(null);
24899
+ }, [modelToDelete, deleteModel, fetchModels, addToast]);
24900
+ const handleCancelDelete = (0, import_react84.useCallback)(() => {
24901
+ setDeleteDialogOpen(false);
24902
+ setModelToDelete(null);
24903
+ }, []);
24904
+ return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(import_jsx_runtime101.Fragment, { children: [
24905
+ /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Toaster_default, {}),
24906
+ modelsError ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(ErrorDisplay, { error: modelsError }) : /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: "w-full", "data-testid": "activity-models-tab", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
24907
+ TableProvider,
24908
+ {
24909
+ data: models,
24910
+ headers: modelsTableColumns,
24911
+ loading: modelsLoading,
24912
+ variant: "borderless",
24913
+ enableSearch: true,
24914
+ enableFilters: true,
24915
+ enableTableSort: true,
24916
+ enablePagination: true,
24917
+ initialFilters: modelsFilterConfigs,
24918
+ paginationConfig: {
24919
+ itemLabel: "modelos",
24920
+ itemsPerPageOptions: [10, 20, 50, 100],
24921
+ defaultItemsPerPage: 10,
24922
+ totalItems: modelsPagination.total,
24923
+ totalPages: modelsPagination.totalPages
24924
+ },
24925
+ searchPlaceholder: "Buscar modelo",
24926
+ noSearchResultState: {
24927
+ image: noSearchImage
24928
+ },
24929
+ emptyState: {
24930
+ component: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
24931
+ EmptyState_default,
24932
+ {
24933
+ image: emptyStateImage,
24934
+ title: "Crie modelos para agilizar suas atividades",
24935
+ description: "Salve modelos de atividades para reutilizar e enviar rapidamente para suas turmas!",
24936
+ buttonText: "Criar modelo",
24937
+ buttonIcon: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_phosphor_react48.Plus, { size: 18 }),
24938
+ buttonVariant: "outline",
24939
+ buttonAction: "primary",
24940
+ onButtonClick: onCreateModel
24941
+ }
24942
+ )
24943
+ },
24944
+ onParamsChange: handleParamsChange,
24945
+ children: (renderProps) => {
24946
+ const {
24947
+ controls,
24948
+ table,
24949
+ pagination: paginationComponent
24950
+ } = renderProps;
24951
+ return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "space-y-4", children: [
24952
+ /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
24953
+ /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
24954
+ Button_default,
24955
+ {
24956
+ variant: "solid",
24957
+ action: "primary",
24958
+ size: "medium",
24959
+ onClick: onCreateModel,
24960
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_phosphor_react48.Plus, { size: 18, weight: "bold" }),
24961
+ children: "Criar modelo"
24962
+ }
24963
+ ),
24964
+ controls
24965
+ ] }),
24966
+ /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: "bg-background rounded-xl p-6 space-y-4", children: [
24967
+ table,
24968
+ paginationComponent
24969
+ ] })
24970
+ ] });
24971
+ }
24972
+ }
24973
+ ) }),
24974
+ /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
24975
+ AlertDialog,
24976
+ {
24977
+ isOpen: deleteDialogOpen,
24978
+ onChangeOpen: setDeleteDialogOpen,
24979
+ title: "Deletar modelo",
24980
+ description: `Tem certeza que deseja deletar o modelo "${modelToDelete?.title}"? Esta a\xE7\xE3o n\xE3o pode ser desfeita.`,
24981
+ submitButtonLabel: "Deletar",
24982
+ cancelButtonLabel: "Cancelar",
24983
+ onSubmit: handleConfirmDelete,
24984
+ onCancel: handleCancelDelete
24985
+ }
24986
+ )
24987
+ ] });
24988
+ };
24989
+
24990
+ // src/components/ActivitiesHistory/tabs/DraftsTab.tsx
24991
+ var import_jsx_runtime102 = require("react/jsx-runtime");
24992
+ var DraftsTab = () => {
24993
+ return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "flex items-center justify-center bg-background rounded-xl w-full min-h-[705px]", children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Text_default, { size: "lg", color: "text-text-600", children: "Rascunhos em desenvolvimento" }) });
24994
+ };
24995
+
24996
+ // src/components/ActivitiesHistory/ActivitiesHistory.tsx
24997
+ var import_jsx_runtime103 = require("react/jsx-runtime");
24998
+ var PAGE_TITLES = {
24999
+ ["history" /* HISTORY */]: "Hist\xF3rico de atividades",
25000
+ ["drafts" /* DRAFTS */]: "Rascunhos",
25001
+ ["models" /* MODELS */]: "Modelos de atividades"
25002
+ };
25003
+ var ActivitiesHistory = ({
25004
+ fetchActivitiesHistory,
25005
+ fetchActivityModels,
25006
+ deleteActivityModel,
25007
+ onCreateActivity,
25008
+ onCreateModel,
25009
+ onRowClick,
25010
+ onSendActivity,
25011
+ onEditModel,
25012
+ emptyStateImage,
25013
+ noSearchImage,
25014
+ mapSubjectNameToEnum,
25015
+ userFilterData,
25016
+ subjectsMap
25017
+ }) => {
25018
+ const [activeTab, setActiveTab] = (0, import_react85.useState)("history" /* HISTORY */);
25019
+ return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
25020
+ "div",
25021
+ {
25022
+ "data-testid": "activities-history",
25023
+ className: "flex flex-col w-full h-auto relative justify-center items-center mb-5 overflow-hidden",
25024
+ children: [
25025
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("span", { className: "absolute top-0 left-0 h-[150px] w-full z-0" }),
25026
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "flex flex-col w-full h-full max-w-[1350px] mx-auto z-10 lg:px-0 px-4 pt-4 sm:pt-0", children: [
25027
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "flex flex-col sm:flex-row w-full mb-6 items-start sm:items-center sm:justify-between gap-0 sm:gap-4", children: [
25028
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
25029
+ Text_default,
25030
+ {
25031
+ as: "h1",
25032
+ weight: "bold",
25033
+ className: "leading-[28px] tracking-[0.2px] text-xl lg:text-2xl",
25034
+ children: PAGE_TITLES[activeTab]
25035
+ }
25036
+ ),
25037
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: "flex-shrink-0 lg:w-auto self-center sm:self-auto", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
25038
+ Menu,
25039
+ {
25040
+ defaultValue: "history" /* HISTORY */,
25041
+ value: activeTab,
25042
+ onValueChange: (value) => setActiveTab(value),
25043
+ variant: "menu2",
25044
+ className: "bg-transparent shadow-none px-0",
25045
+ children: /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
25046
+ MenuContent,
25047
+ {
25048
+ variant: "menu2",
25049
+ className: "w-full lg:w-auto max-w-full min-w-0",
25050
+ children: [
25051
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
25052
+ MenuItem,
25053
+ {
25054
+ variant: "menu2",
25055
+ value: "history" /* HISTORY */,
25056
+ "data-testid": "menu-item-history",
25057
+ className: "whitespace-nowrap flex-1 lg:flex-none",
25058
+ children: "Hist\xF3rico"
25059
+ }
25060
+ ),
25061
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
25062
+ MenuItem,
25063
+ {
25064
+ variant: "menu2",
25065
+ value: "drafts" /* DRAFTS */,
25066
+ "data-testid": "menu-item-drafts",
25067
+ className: "whitespace-nowrap flex-1 lg:flex-none",
25068
+ children: "Rascunhos"
25069
+ }
25070
+ ),
25071
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
25072
+ MenuItem,
25073
+ {
25074
+ variant: "menu2",
25075
+ value: "models" /* MODELS */,
25076
+ "data-testid": "menu-item-models",
25077
+ className: "whitespace-nowrap flex-1 lg:flex-none",
25078
+ children: "Modelos"
25079
+ }
25080
+ )
25081
+ ]
25082
+ }
25083
+ )
25084
+ }
25085
+ ) })
25086
+ ] }),
25087
+ /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)("div", { className: "flex flex-col items-center w-full min-h-0 flex-1", children: [
25088
+ activeTab === "history" /* HISTORY */ && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
25089
+ HistoryTab,
25090
+ {
25091
+ fetchActivitiesHistory,
25092
+ onCreateActivity,
25093
+ onRowClick,
25094
+ emptyStateImage,
25095
+ noSearchImage,
25096
+ mapSubjectNameToEnum,
25097
+ userFilterData
25098
+ }
25099
+ ),
25100
+ activeTab === "drafts" /* DRAFTS */ && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(DraftsTab, {}),
25101
+ activeTab === "models" /* MODELS */ && /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
25102
+ ModelsTab,
25103
+ {
25104
+ fetchActivityModels,
25105
+ deleteActivityModel,
25106
+ onCreateModel,
25107
+ onSendActivity,
25108
+ onEditModel,
25109
+ emptyStateImage,
25110
+ noSearchImage,
25111
+ mapSubjectNameToEnum,
25112
+ userFilterData,
25113
+ subjectsMap
25114
+ }
25115
+ )
25116
+ ] })
25117
+ ] })
25118
+ ]
25119
+ }
25120
+ );
25121
+ };
24096
25122
  // Annotate the CommonJS export names for ESM import in node:
24097
25123
  0 && (module.exports = {
24098
25124
  ACTIVITY_AVAILABILITY,
25125
+ ACTIVITY_FILTER_STATUS_OPTIONS,
24099
25126
  ANSWER_STATUS,
24100
25127
  AccordionGroup,
25128
+ ActivitiesHistory,
25129
+ ActivityApiStatus,
25130
+ ActivityBadgeActionType,
24101
25131
  ActivityCardQuestionBanks,
24102
25132
  ActivityCardQuestionPreview,
24103
25133
  ActivityDetails,
25134
+ ActivityDisplayStatus,
25135
+ ActivityDraftType,
24104
25136
  ActivityFilters,
24105
25137
  ActivityFiltersPopover,
24106
25138
  ActivityPreview,
@@ -24134,6 +25166,8 @@ var createRecommendedLessonDetailsHook = createUseRecommendedLessonDetails;
24134
25166
  Chips,
24135
25167
  CorrectActivityModal,
24136
25168
  CreateActivity,
25169
+ DEFAULT_ACTIVITIES_PAGINATION,
25170
+ DEFAULT_MODELS_PAGINATION,
24137
25171
  DIFFICULTY_LEVEL_ENUM,
24138
25172
  DateTimeInput,
24139
25173
  Divider,
@@ -24256,15 +25290,21 @@ var createRecommendedLessonDetailsHook = createUseRecommendedLessonDetails;
24256
25290
  Toaster,
24257
25291
  VideoPlayer,
24258
25292
  Whiteboard,
25293
+ activitiesHistoryApiResponseSchema,
25294
+ activityModelsApiResponseSchema,
24259
25295
  cn,
24260
25296
  convertActivityFiltersToQuestionsFilter,
25297
+ createActivitiesHistoryHook,
24261
25298
  createActivityFiltersDataHook,
25299
+ createActivityModelsHook,
24262
25300
  createNotificationStore,
24263
25301
  createNotificationsHook,
24264
25302
  createQuestionsListHook,
24265
25303
  createRecommendedLessonDetailsHook,
24266
25304
  createRecommendedLessonsHistoryHook,
25305
+ createUseActivitiesHistory,
24267
25306
  createUseActivityFiltersData,
25307
+ createUseActivityModels,
24268
25308
  createUseNotificationStore,
24269
25309
  createUseNotifications,
24270
25310
  createUseQuestionsList,
@@ -24280,6 +25320,7 @@ var createRecommendedLessonDetailsHook = createUseRecommendedLessonDetails;
24280
25320
  formatTimeAgo,
24281
25321
  formatTimeSpent,
24282
25322
  generateFileId,
25323
+ getActivityStatusBadgeAction,
24283
25324
  getCategoryIcon,
24284
25325
  getCategoryText,
24285
25326
  getDeviceType,
@@ -24300,12 +25341,15 @@ var createRecommendedLessonDetailsHook = createUseRecommendedLessonDetails;
24300
25341
  goalApiResponseSchema,
24301
25342
  goalDetailsApiResponseSchema,
24302
25343
  goalsHistoryApiResponseSchema,
25344
+ handleActivityFetchError,
24303
25345
  handleGoalFetchError,
24304
25346
  handleLessonDetailsFetchError,
25347
+ handleModelFetchError,
24305
25348
  historyApiResponseSchema,
24306
25349
  isDeadlinePassed,
24307
25350
  isFormValid,
24308
25351
  isStepValid,
25352
+ mapActivityStatusToDisplay,
24309
25353
  mapApiStatusToInternal,
24310
25354
  mapInternalStatusToApi,
24311
25355
  mapQuestionTypeToEnum,
@@ -24315,7 +25359,9 @@ var createRecommendedLessonDetailsHook = createUseRecommendedLessonDetails;
24315
25359
  syncDropdownState,
24316
25360
  toggleArrayItem,
24317
25361
  toggleSingleValue,
25362
+ transformActivityToTableItem,
24318
25363
  transformGoalToTableItem,
25364
+ transformModelToTableItem,
24319
25365
  useAlertFormStore,
24320
25366
  useApiConfig,
24321
25367
  useAppContent,