analytica-frontend-lib 1.2.85 → 1.2.86

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/index.mjs CHANGED
@@ -23300,6 +23300,53 @@ var LessonPreview = ({
23300
23300
  ] });
23301
23301
  };
23302
23302
 
23303
+ // src/types/lessonAvailability.ts
23304
+ var LESSON_AVAILABILITY = {
23305
+ /** Lesson is available for access */
23306
+ DISPONIVEL: "DISPONIVEL",
23307
+ /** Lesson has not started yet (current date < startDate) */
23308
+ NAO_INICIADA: "NAO_INICIADA",
23309
+ /** Lesson has expired (current date > finalDate) */
23310
+ EXPIRADA: "EXPIRADA"
23311
+ };
23312
+
23313
+ // src/utils/lessonAvailabilityUtils.ts
23314
+ var isDateInPast = (dateString) => {
23315
+ const date = new Date(dateString);
23316
+ const now = /* @__PURE__ */ new Date();
23317
+ return now > date;
23318
+ };
23319
+ var isDateInFuture = (dateString) => {
23320
+ const date = new Date(dateString);
23321
+ const now = /* @__PURE__ */ new Date();
23322
+ return now < date;
23323
+ };
23324
+ var checkLessonAvailability = (startDate, finalDate) => {
23325
+ const start = startDate ? new Date(startDate) : null;
23326
+ const end = finalDate ? new Date(finalDate) : null;
23327
+ let status = LESSON_AVAILABILITY.DISPONIVEL;
23328
+ if (startDate && isDateInFuture(startDate)) {
23329
+ status = LESSON_AVAILABILITY.NAO_INICIADA;
23330
+ } else if (finalDate && isDateInPast(finalDate)) {
23331
+ status = LESSON_AVAILABILITY.EXPIRADA;
23332
+ }
23333
+ return {
23334
+ status,
23335
+ startDate: start,
23336
+ endDate: end,
23337
+ formattedStartDate: startDate ? formatDateToBrazilian(startDate) : null,
23338
+ formattedEndDate: finalDate ? formatDateToBrazilian(finalDate) : null
23339
+ };
23340
+ };
23341
+ var isLessonNotYetAvailable = (startDate) => {
23342
+ if (!startDate) return false;
23343
+ return isDateInFuture(startDate);
23344
+ };
23345
+ var isLessonExpired = (finalDate) => {
23346
+ if (!finalDate) return false;
23347
+ return isDateInPast(finalDate);
23348
+ };
23349
+
23303
23350
  // src/components/ActivityDetails/ActivityDetails.tsx
23304
23351
  import { useState as useState43, useMemo as useMemo26, useCallback as useCallback20, useEffect as useEffect45, useRef as useRef28 } from "react";
23305
23352
  import {
@@ -30476,6 +30523,7 @@ export {
30476
30523
  IconRoundedButton_default as IconRoundedButton,
30477
30524
  ImageUpload,
30478
30525
  Input_default as Input,
30526
+ LESSON_AVAILABILITY,
30479
30527
  LatexRenderer_default as LatexRenderer,
30480
30528
  LessonPreview,
30481
30529
  loadingModal_default as LoadingModal,
@@ -30586,6 +30634,7 @@ export {
30586
30634
  activitiesHistoryApiResponseSchema,
30587
30635
  activityModelsApiResponseSchema,
30588
30636
  buildUserFilterData,
30637
+ checkLessonAvailability,
30589
30638
  cn,
30590
30639
  convertActivityFiltersToQuestionsFilter,
30591
30640
  createActivitiesHistoryHook,
@@ -30660,6 +30709,8 @@ export {
30660
30709
  isChatUserInfoValid,
30661
30710
  isDeadlinePassed,
30662
30711
  isFormValid,
30712
+ isLessonExpired,
30713
+ isLessonNotYetAvailable,
30663
30714
  isStepValid,
30664
30715
  mapActivityStatusToDisplay,
30665
30716
  mapApiStatusToInternal,