analytica-frontend-lib 1.2.68 → 1.2.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/useSendActivity/index.d.ts +47 -0
- package/dist/hooks/useSendActivity/index.d.ts.map +1 -0
- package/dist/hooks/useSendActivity/index.js +194 -0
- package/dist/hooks/useSendActivity/index.js.map +1 -0
- package/dist/hooks/useSendActivity/index.mjs +159 -0
- package/dist/hooks/useSendActivity/index.mjs.map +1 -0
- package/dist/hooks/useSendActivity.d.ts +47 -0
- package/dist/hooks/useSendActivity.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +187 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +183 -3
- package/dist/index.mjs.map +1 -1
- package/dist/types/activities/index.d.ts +81 -0
- package/dist/types/activities/index.d.ts.map +1 -0
- package/dist/types/activities/index.js +52 -0
- package/dist/types/activities/index.js.map +1 -0
- package/dist/types/activities/index.mjs +25 -0
- package/dist/types/activities/index.mjs.map +1 -0
- package/dist/types/activities.d.ts +81 -0
- package/dist/types/activities.d.ts.map +1 -0
- package/dist/types/sendActivity/index.d.ts +127 -0
- package/dist/types/sendActivity/index.d.ts.map +1 -0
- package/dist/types/sendActivity/index.js +19 -0
- package/dist/types/sendActivity/index.js.map +1 -0
- package/dist/types/sendActivity/index.mjs +1 -0
- package/dist/types/sendActivity/index.mjs.map +1 -0
- package/dist/types/sendActivity.d.ts +127 -0
- package/dist/types/sendActivity.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -14658,9 +14658,9 @@ var ActivityType = /* @__PURE__ */ ((ActivityType2) => {
|
|
|
14658
14658
|
ActivityType2["ATIVIDADE"] = "ATIVIDADE";
|
|
14659
14659
|
return ActivityType2;
|
|
14660
14660
|
})(ActivityType || {});
|
|
14661
|
-
var ActivityStatus = /* @__PURE__ */ ((
|
|
14662
|
-
|
|
14663
|
-
return
|
|
14661
|
+
var ActivityStatus = /* @__PURE__ */ ((ActivityStatus3) => {
|
|
14662
|
+
ActivityStatus3["A_VENCER"] = "A_VENCER";
|
|
14663
|
+
return ActivityStatus3;
|
|
14664
14664
|
})(ActivityStatus || {});
|
|
14665
14665
|
|
|
14666
14666
|
// src/components/ActivityCreate/ActivityCreate.utils.ts
|
|
@@ -27210,6 +27210,182 @@ var getChatUserInfo = (user, tokens, sessionInfo, defaultUserName = "Usuario") =
|
|
|
27210
27210
|
token
|
|
27211
27211
|
};
|
|
27212
27212
|
};
|
|
27213
|
+
|
|
27214
|
+
// src/types/activities.ts
|
|
27215
|
+
var ActivityStatus2 = /* @__PURE__ */ ((ActivityStatus3) => {
|
|
27216
|
+
ActivityStatus3["MODELO"] = "MODELO";
|
|
27217
|
+
ActivityStatus3["NAO_INICIADA"] = "NAO_INICIADA";
|
|
27218
|
+
ActivityStatus3["EM_ANDAMENTO"] = "EM_ANDAMENTO";
|
|
27219
|
+
ActivityStatus3["CONCLUIDA"] = "CONCLUIDA";
|
|
27220
|
+
return ActivityStatus3;
|
|
27221
|
+
})(ActivityStatus2 || {});
|
|
27222
|
+
var ActivityFilter = /* @__PURE__ */ ((ActivityFilter2) => {
|
|
27223
|
+
ActivityFilter2["NEAR"] = "NEAR";
|
|
27224
|
+
ActivityFilter2["CONCLUDED"] = "CONCLUDED";
|
|
27225
|
+
return ActivityFilter2;
|
|
27226
|
+
})(ActivityFilter || {});
|
|
27227
|
+
var CalendarActivityStatus = /* @__PURE__ */ ((CalendarActivityStatus2) => {
|
|
27228
|
+
CalendarActivityStatus2["NEAR_DEADLINE"] = "near-deadline";
|
|
27229
|
+
CalendarActivityStatus2["OVERDUE"] = "overdue";
|
|
27230
|
+
CalendarActivityStatus2["IN_DEADLINE"] = "in-deadline";
|
|
27231
|
+
return CalendarActivityStatus2;
|
|
27232
|
+
})(CalendarActivityStatus || {});
|
|
27233
|
+
|
|
27234
|
+
// src/hooks/useSendActivity.ts
|
|
27235
|
+
import { useState as useState54, useCallback as useCallback32, useMemo as useMemo30, useRef as useRef30 } from "react";
|
|
27236
|
+
import dayjs6 from "dayjs";
|
|
27237
|
+
function transformToCategoryConfig(data) {
|
|
27238
|
+
return [
|
|
27239
|
+
{
|
|
27240
|
+
key: "escola",
|
|
27241
|
+
label: "Escola",
|
|
27242
|
+
itens: data.schools,
|
|
27243
|
+
selectedIds: []
|
|
27244
|
+
},
|
|
27245
|
+
{
|
|
27246
|
+
key: "serie",
|
|
27247
|
+
label: "S\xE9rie",
|
|
27248
|
+
dependsOn: ["escola"],
|
|
27249
|
+
itens: data.schoolYears,
|
|
27250
|
+
filteredBy: [{ key: "escola", internalField: "escolaId" }],
|
|
27251
|
+
selectedIds: []
|
|
27252
|
+
},
|
|
27253
|
+
{
|
|
27254
|
+
key: "turma",
|
|
27255
|
+
label: "Turma",
|
|
27256
|
+
dependsOn: ["escola", "serie"],
|
|
27257
|
+
itens: data.classes,
|
|
27258
|
+
filteredBy: [
|
|
27259
|
+
{ key: "escola", internalField: "escolaId" },
|
|
27260
|
+
{ key: "serie", internalField: "serieId" }
|
|
27261
|
+
],
|
|
27262
|
+
selectedIds: []
|
|
27263
|
+
},
|
|
27264
|
+
{
|
|
27265
|
+
key: "alunos",
|
|
27266
|
+
label: "Aluno",
|
|
27267
|
+
dependsOn: ["escola", "serie", "turma"],
|
|
27268
|
+
itens: data.students,
|
|
27269
|
+
filteredBy: [
|
|
27270
|
+
{ key: "escola", internalField: "escolaId" },
|
|
27271
|
+
{ key: "serie", internalField: "serieId" },
|
|
27272
|
+
{ key: "turma", internalField: "turmaId" }
|
|
27273
|
+
],
|
|
27274
|
+
selectedIds: []
|
|
27275
|
+
}
|
|
27276
|
+
];
|
|
27277
|
+
}
|
|
27278
|
+
function toISODateTime(date, time) {
|
|
27279
|
+
return dayjs6(`${date}T${time}`).toISOString();
|
|
27280
|
+
}
|
|
27281
|
+
function useSendActivity(config) {
|
|
27282
|
+
const {
|
|
27283
|
+
fetchCategories,
|
|
27284
|
+
createActivity,
|
|
27285
|
+
sendToStudents,
|
|
27286
|
+
fetchQuestionIds,
|
|
27287
|
+
onSuccess,
|
|
27288
|
+
onError
|
|
27289
|
+
} = config;
|
|
27290
|
+
const [isOpen, setIsOpen] = useState54(false);
|
|
27291
|
+
const [selectedModel, setSelectedModel] = useState54(
|
|
27292
|
+
null
|
|
27293
|
+
);
|
|
27294
|
+
const [categories, setCategories] = useState54([]);
|
|
27295
|
+
const [isLoading, setIsLoading] = useState54(false);
|
|
27296
|
+
const [isCategoriesLoading, setIsCategoriesLoading] = useState54(false);
|
|
27297
|
+
const categoriesLoadedRef = useRef30(false);
|
|
27298
|
+
const initialData = useMemo30(() => {
|
|
27299
|
+
if (!selectedModel) return void 0;
|
|
27300
|
+
return {
|
|
27301
|
+
title: selectedModel.title
|
|
27302
|
+
};
|
|
27303
|
+
}, [selectedModel]);
|
|
27304
|
+
const loadCategories = useCallback32(async () => {
|
|
27305
|
+
if (categoriesLoadedRef.current) return;
|
|
27306
|
+
setIsCategoriesLoading(true);
|
|
27307
|
+
try {
|
|
27308
|
+
const data = await fetchCategories();
|
|
27309
|
+
const categoryConfig = transformToCategoryConfig(data);
|
|
27310
|
+
setCategories(categoryConfig);
|
|
27311
|
+
categoriesLoadedRef.current = true;
|
|
27312
|
+
} catch (error) {
|
|
27313
|
+
console.error("Error loading categories:", error);
|
|
27314
|
+
onError?.("Erro ao carregar destinat\xE1rios");
|
|
27315
|
+
} finally {
|
|
27316
|
+
setIsCategoriesLoading(false);
|
|
27317
|
+
}
|
|
27318
|
+
}, [fetchCategories, onError]);
|
|
27319
|
+
const openModal = useCallback32(
|
|
27320
|
+
(model) => {
|
|
27321
|
+
setSelectedModel(model);
|
|
27322
|
+
setIsOpen(true);
|
|
27323
|
+
void loadCategories();
|
|
27324
|
+
},
|
|
27325
|
+
[loadCategories]
|
|
27326
|
+
);
|
|
27327
|
+
const closeModal = useCallback32(() => {
|
|
27328
|
+
setIsOpen(false);
|
|
27329
|
+
setSelectedModel(null);
|
|
27330
|
+
}, []);
|
|
27331
|
+
const onCategoriesChange = useCallback32(
|
|
27332
|
+
(updatedCategories) => {
|
|
27333
|
+
setCategories(updatedCategories);
|
|
27334
|
+
},
|
|
27335
|
+
[]
|
|
27336
|
+
);
|
|
27337
|
+
const handleSubmit = useCallback32(
|
|
27338
|
+
async (data) => {
|
|
27339
|
+
if (!selectedModel) return;
|
|
27340
|
+
setIsLoading(true);
|
|
27341
|
+
try {
|
|
27342
|
+
const questionIds = await fetchQuestionIds(selectedModel.id);
|
|
27343
|
+
if (!questionIds || questionIds.length === 0) {
|
|
27344
|
+
throw new Error("N\xE3o foi poss\xEDvel obter quest\xF5es do modelo");
|
|
27345
|
+
}
|
|
27346
|
+
const createResponse = await createActivity({
|
|
27347
|
+
title: data.title,
|
|
27348
|
+
subjectId: selectedModel.subjectId,
|
|
27349
|
+
questionIds,
|
|
27350
|
+
subtype: data.subtype,
|
|
27351
|
+
notification: data.notification,
|
|
27352
|
+
startDate: toISODateTime(data.startDate, data.startTime),
|
|
27353
|
+
finalDate: toISODateTime(data.finalDate, data.finalTime),
|
|
27354
|
+
canRetry: data.canRetry
|
|
27355
|
+
});
|
|
27356
|
+
await sendToStudents(createResponse.id, data.students);
|
|
27357
|
+
onSuccess?.(`Atividade enviada para ${data.students.length} aluno(s)`);
|
|
27358
|
+
closeModal();
|
|
27359
|
+
} catch (error) {
|
|
27360
|
+
console.error("Error sending activity:", error);
|
|
27361
|
+
onError?.("Erro ao enviar atividade");
|
|
27362
|
+
} finally {
|
|
27363
|
+
setIsLoading(false);
|
|
27364
|
+
}
|
|
27365
|
+
},
|
|
27366
|
+
[
|
|
27367
|
+
selectedModel,
|
|
27368
|
+
fetchQuestionIds,
|
|
27369
|
+
createActivity,
|
|
27370
|
+
sendToStudents,
|
|
27371
|
+
onSuccess,
|
|
27372
|
+
onError,
|
|
27373
|
+
closeModal
|
|
27374
|
+
]
|
|
27375
|
+
);
|
|
27376
|
+
return {
|
|
27377
|
+
isOpen,
|
|
27378
|
+
openModal,
|
|
27379
|
+
closeModal,
|
|
27380
|
+
selectedModel,
|
|
27381
|
+
initialData,
|
|
27382
|
+
categories,
|
|
27383
|
+
onCategoriesChange,
|
|
27384
|
+
isLoading,
|
|
27385
|
+
isCategoriesLoading,
|
|
27386
|
+
handleSubmit
|
|
27387
|
+
};
|
|
27388
|
+
}
|
|
27213
27389
|
export {
|
|
27214
27390
|
ACTIVITY_AVAILABILITY,
|
|
27215
27391
|
ACTIVITY_FILTER_STATUS_OPTIONS,
|
|
@@ -27223,6 +27399,7 @@ export {
|
|
|
27223
27399
|
ActivityDetails,
|
|
27224
27400
|
GenericDisplayStatus as ActivityDisplayStatus,
|
|
27225
27401
|
ActivityDraftType,
|
|
27402
|
+
ActivityFilter,
|
|
27226
27403
|
ActivityFilters,
|
|
27227
27404
|
ActivityFiltersPopover,
|
|
27228
27405
|
ActivityPreview,
|
|
@@ -27240,6 +27417,7 @@ export {
|
|
|
27240
27417
|
CHAT_MESSAGE_TYPES,
|
|
27241
27418
|
QUESTION_STATUS2 as CORRECTION_QUESTION_STATUS,
|
|
27242
27419
|
Calendar_default as Calendar,
|
|
27420
|
+
CalendarActivityStatus,
|
|
27243
27421
|
CardAccordation,
|
|
27244
27422
|
CardActivitiesResults,
|
|
27245
27423
|
CardAudio,
|
|
@@ -27278,6 +27456,7 @@ export {
|
|
|
27278
27456
|
FilterModal,
|
|
27279
27457
|
GOAL_FILTER_STATUS_OPTIONS,
|
|
27280
27458
|
GOAL_STATUS_OPTIONS,
|
|
27459
|
+
ActivityStatus2 as GeneralActivityStatus,
|
|
27281
27460
|
GenericApiStatus as GoalApiStatus,
|
|
27282
27461
|
BadgeActionType as GoalBadgeActionType,
|
|
27283
27462
|
GenericDisplayStatus as GoalDisplayStatus,
|
|
@@ -27490,6 +27669,7 @@ export {
|
|
|
27490
27669
|
useQuestionsPdfPrint,
|
|
27491
27670
|
useQuizStore,
|
|
27492
27671
|
useRouteAuth,
|
|
27672
|
+
useSendActivity,
|
|
27493
27673
|
useSendActivityModal,
|
|
27494
27674
|
useTableFilter,
|
|
27495
27675
|
useTableSort,
|