analytica-frontend-lib 1.1.92 → 1.1.94

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 (35) hide show
  1. package/dist/BreadcrumbMenu/breadcrumbStore/index.d.mts +77 -0
  2. package/dist/BreadcrumbMenu/breadcrumbStore/index.d.ts +77 -0
  3. package/dist/BreadcrumbMenu/breadcrumbStore/index.js +146 -0
  4. package/dist/BreadcrumbMenu/breadcrumbStore/index.js.map +1 -0
  5. package/dist/BreadcrumbMenu/breadcrumbStore/index.mjs +120 -0
  6. package/dist/BreadcrumbMenu/breadcrumbStore/index.mjs.map +1 -0
  7. package/dist/BreadcrumbMenu/index.d.mts +31 -0
  8. package/dist/BreadcrumbMenu/index.d.ts +31 -0
  9. package/dist/BreadcrumbMenu/index.js +308 -0
  10. package/dist/BreadcrumbMenu/index.js.map +1 -0
  11. package/dist/BreadcrumbMenu/index.mjs +289 -0
  12. package/dist/BreadcrumbMenu/index.mjs.map +1 -0
  13. package/dist/BreadcrumbMenu/useBreadcrumbBuilder/index.d.mts +48 -0
  14. package/dist/BreadcrumbMenu/useBreadcrumbBuilder/index.d.ts +48 -0
  15. package/dist/BreadcrumbMenu/useBreadcrumbBuilder/index.js +189 -0
  16. package/dist/BreadcrumbMenu/useBreadcrumbBuilder/index.js.map +1 -0
  17. package/dist/BreadcrumbMenu/useBreadcrumbBuilder/index.mjs +164 -0
  18. package/dist/BreadcrumbMenu/useBreadcrumbBuilder/index.mjs.map +1 -0
  19. package/dist/BreadcrumbMenu/useUrlParams/index.d.mts +28 -0
  20. package/dist/BreadcrumbMenu/useUrlParams/index.d.ts +28 -0
  21. package/dist/BreadcrumbMenu/useUrlParams/index.js +43 -0
  22. package/dist/BreadcrumbMenu/useUrlParams/index.js.map +1 -0
  23. package/dist/BreadcrumbMenu/useUrlParams/index.mjs +18 -0
  24. package/dist/BreadcrumbMenu/useUrlParams/index.mjs.map +1 -0
  25. package/dist/index.css +3 -0
  26. package/dist/index.css.map +1 -1
  27. package/dist/index.d.mts +185 -3
  28. package/dist/index.d.ts +185 -3
  29. package/dist/index.js +546 -6
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +537 -6
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/styles.css +3 -0
  34. package/dist/styles.css.map +1 -1
  35. package/package.json +2 -1
package/dist/index.d.mts CHANGED
@@ -42,7 +42,7 @@ export { default as NotFound } from './NotFound/index.mjs';
42
42
  export { default as VideoPlayer } from './VideoPlayer/index.mjs';
43
43
  export { default as Whiteboard } from './Whiteboard/index.mjs';
44
44
  export { default as DownloadButton, DownloadButtonProps, DownloadContent } from './DownloadButton/index.mjs';
45
- export { AuthProvider, ProtectedRoute, PublicRoute, getRootDomain, useAuth, useAuthGuard, useRouteAuth, withAuth } from './Auth/index.mjs';
45
+ export { AuthContextType, AuthProvider, ProtectedRoute, PublicRoute, getRootDomain, useAuth, useAuthGuard, useRouteAuth, withAuth } from './Auth/index.mjs';
46
46
  export { CardAccordation } from './Accordation/index.mjs';
47
47
  export { AlternativesList } from './Alternative/index.mjs';
48
48
  export { createZustandAuthAdapter } from './Auth/zustandAuthAdapter/index.mjs';
@@ -56,8 +56,12 @@ export { MultipleChoiceList } from './MultipleChoice/index.mjs';
56
56
  export { default as IconRender } from './IconRender/index.mjs';
57
57
  export { DeviceType, getDeviceType, useMobile } from './hooks/useMobile/index.mjs';
58
58
  export { useTheme } from './hooks/useTheme/index.mjs';
59
+ export { BreadcrumbMenu, BreadcrumbMenuProps } from './BreadcrumbMenu/index.mjs';
60
+ export { BreadcrumbBuilderConfig, BreadcrumbLevel, BreadcrumbLevelStatic, BreadcrumbLevelWithData, useBreadcrumbBuilder } from './BreadcrumbMenu/useBreadcrumbBuilder/index.mjs';
61
+ export { UrlParamsConfig, useUrlParams } from './BreadcrumbMenu/useUrlParams/index.mjs';
62
+ export { BreadcrumbItem, useBreadcrumb } from './BreadcrumbMenu/breadcrumbStore/index.mjs';
63
+ import * as zustand_middleware from 'zustand/middleware';
59
64
  export { cn, getSubjectColorWithOpacity, syncDropdownState } from './utils/index.mjs';
60
- import 'zustand/middleware';
61
65
  import 'clsx';
62
66
 
63
67
  /**
@@ -431,4 +435,182 @@ declare const QuizListResultByMateria: ({ subject, onQuestionClick, subjectName,
431
435
  subjectName?: string;
432
436
  }) => react_jsx_runtime.JSX.Element;
433
437
 
434
- export { CheckboxList, CheckboxListItem, FetchNotificationsParams, Notification, type NotificationActions, NotificationApiClient, NotificationEntityType, NotificationGroup, type NotificationState, type NotificationStore, NotificationType, Question, QuizAlternative, QuizConnectDots, QuizDissertative, QuizHeaderResult, QuizImageQuestion, QuizListResult, QuizListResultByMateria, QuizMultipleChoice, QuizResultHeaderTitle, QuizResultPerformance, QuizResultTitle, QuizTrueOrFalse, createNotificationStore, createNotificationsHook, createUseNotificationStore, createUseNotifications, formatTimeAgo, getStatusBadge };
438
+ /**
439
+ * Interface representing user authentication tokens.
440
+ */
441
+ interface AuthTokens {
442
+ token: string;
443
+ refreshToken: string;
444
+ [key: string]: unknown;
445
+ }
446
+ /**
447
+ * Interface representing a user profile.
448
+ */
449
+ interface UserProfile {
450
+ id: string;
451
+ name?: string;
452
+ email?: string;
453
+ [key: string]: unknown;
454
+ }
455
+ /**
456
+ * Interface representing a user.
457
+ */
458
+ interface User {
459
+ id: string;
460
+ name?: string;
461
+ email?: string;
462
+ [key: string]: unknown;
463
+ }
464
+ /**
465
+ * Interface representing session information from the API.
466
+ */
467
+ interface SessionInfo {
468
+ sessionId: string;
469
+ userId: string;
470
+ profileId: string;
471
+ institutionId: string;
472
+ schoolId: string;
473
+ schoolYearId: string;
474
+ classId: string;
475
+ subjects: string[];
476
+ schools: string[];
477
+ [key: string]: unknown;
478
+ }
479
+ /**
480
+ * Interface defining the authentication state.
481
+ */
482
+ interface AuthState {
483
+ user: User | null;
484
+ tokens: AuthTokens | null;
485
+ isAuthenticated: boolean;
486
+ profiles: UserProfile[];
487
+ selectedProfile: UserProfile | null;
488
+ sessionInfo: SessionInfo | null;
489
+ setUser: (user: User | null) => void;
490
+ setTokens: (tokens: AuthTokens | null) => void;
491
+ setProfiles: (profiles: UserProfile[]) => void;
492
+ setSelectedProfile: (profile: UserProfile | null) => void;
493
+ setSessionInfo: (sessionInfo: SessionInfo | null) => void;
494
+ signIn: (user: User, tokens: AuthTokens, profiles: UserProfile[]) => void;
495
+ signOut: () => void;
496
+ updateUserSession: (sessionData: Partial<User>) => void;
497
+ }
498
+ /**
499
+ * Zustand store for managing authentication state with persistence.
500
+ */
501
+ declare const useAuthStore: zustand.UseBoundStore<Omit<zustand.StoreApi<AuthState>, "persist"> & {
502
+ persist: {
503
+ setOptions: (options: Partial<zustand_middleware.PersistOptions<AuthState, unknown>>) => void;
504
+ clearStorage: () => void;
505
+ rehydrate: () => Promise<void> | void;
506
+ hasHydrated: () => boolean;
507
+ onHydrate: (fn: (state: AuthState) => void) => () => void;
508
+ onFinishHydration: (fn: (state: AuthState) => void) => () => void;
509
+ getOptions: () => Partial<zustand_middleware.PersistOptions<AuthState, unknown>>;
510
+ };
511
+ }>;
512
+
513
+ /**
514
+ * Hook que gerencia a inicialização da aplicação e funções de autenticação
515
+ * Combina a lógica de obtenção do institutionId, inicialização do app store e funções de auth
516
+ *
517
+ * @param {UseAppInitializationProps} props - Propriedades do hook
518
+ * @returns {object} Estado da inicialização, funções relacionadas e funções de autenticação
519
+ */
520
+ declare function useAppInitialization(): {
521
+ getInstitutionId: string | null;
522
+ initialize: (id: string | null) => void;
523
+ initialized: boolean;
524
+ institutionId: string | null;
525
+ authFunctions: {
526
+ checkAuth: () => Promise<boolean>;
527
+ signOut: () => void;
528
+ getUser: () => User | null;
529
+ getSessionInfo: () => SessionInfo | null;
530
+ getTokens: () => AuthTokens | null;
531
+ };
532
+ };
533
+
534
+ /**
535
+ * Interface para as configurações do hook useAppContent
536
+ */
537
+ interface UseAppContentConfig {
538
+ /** API instance para configuração */
539
+ api: {
540
+ get: (endpoint: string, config: unknown) => Promise<unknown>;
541
+ };
542
+ /** ID da instituição obtido externamente */
543
+ getInstitutionId: string | null | undefined;
544
+ /** Função de inicialização obtida externamente */
545
+ initialize: (institutionId: string) => void;
546
+ /** Estado de inicialização obtido externamente */
547
+ initialized: boolean;
548
+ /** Endpoint para autenticação via URL */
549
+ endpoint?: string;
550
+ /** Número máximo de tentativas em caso de erro */
551
+ maxRetries?: number;
552
+ /** Delay entre tentativas em ms */
553
+ retryDelay?: number;
554
+ /** Callback para limpeza de parâmetros da URL */
555
+ onClearParamsFromURL?: () => void;
556
+ /** Callback para tratamento de erro */
557
+ onError?: (error: unknown) => void;
558
+ /** Callback para navegação quando página não encontrada */
559
+ onNotFoundNavigation?: () => void;
560
+ }
561
+ /**
562
+ * Hook que encapsula toda a lógica do componente AppContent
563
+ * Centraliza a configuração de autenticação, tema, navegação e inicialização
564
+ *
565
+ * @param {UseAppContentConfig} config - Configurações do hook
566
+ * @returns {object} Funções e estado necessários para o AppContent
567
+ */
568
+ declare function useAppContent(config: UseAppContentConfig): {
569
+ handleNotFoundNavigation: () => void;
570
+ urlAuthConfig: {
571
+ setTokens: (tokens: AuthTokens | null) => void;
572
+ setSessionInfo: (sessionInfo: SessionInfo | null) => void;
573
+ setSelectedProfile: (profile: {
574
+ id: string;
575
+ }) => void;
576
+ api: {
577
+ get: (endpoint: string, config: unknown) => Promise<unknown>;
578
+ };
579
+ endpoint: string;
580
+ clearParamsFromURL: () => void;
581
+ maxRetries: number;
582
+ retryDelay: number;
583
+ onError: (error: unknown) => void;
584
+ };
585
+ institutionIdToUse: string | null | undefined;
586
+ };
587
+
588
+ declare function useInstitutionId(): string | null;
589
+
590
+ /**
591
+ * Interface defining the application state
592
+ */
593
+ interface AppState {
594
+ institutionId: string | null;
595
+ initialized: boolean;
596
+ setInstitutionId: (institutionId: string | null) => void;
597
+ setInitialized: (initialized: boolean) => void;
598
+ initialize: (id: string | null) => void;
599
+ }
600
+ /**
601
+ * Zustand store for managing application-wide state with persistence
602
+ * @returns {AppState} The application state store
603
+ */
604
+ declare const useAppStore: zustand.UseBoundStore<Omit<zustand.StoreApi<AppState>, "persist"> & {
605
+ persist: {
606
+ setOptions: (options: Partial<zustand_middleware.PersistOptions<AppState, unknown>>) => void;
607
+ clearStorage: () => void;
608
+ rehydrate: () => Promise<void> | void;
609
+ hasHydrated: () => boolean;
610
+ onHydrate: (fn: (state: AppState) => void) => () => void;
611
+ onFinishHydration: (fn: (state: AppState) => void) => () => void;
612
+ getOptions: () => Partial<zustand_middleware.PersistOptions<AppState, unknown>>;
613
+ };
614
+ }>;
615
+
616
+ export { type AuthState, CheckboxList, CheckboxListItem, FetchNotificationsParams, Notification, type NotificationActions, NotificationApiClient, NotificationEntityType, NotificationGroup, type NotificationState, type NotificationStore, NotificationType, Question, QuizAlternative, QuizConnectDots, QuizDissertative, QuizHeaderResult, QuizImageQuestion, QuizListResult, QuizListResultByMateria, QuizMultipleChoice, QuizResultHeaderTitle, QuizResultPerformance, QuizResultTitle, QuizTrueOrFalse, createNotificationStore, createNotificationsHook, createUseNotificationStore, createUseNotifications, formatTimeAgo, getStatusBadge, useAppContent, useAppInitialization, useAppStore, useAuthStore, useInstitutionId };
package/dist/index.d.ts CHANGED
@@ -42,7 +42,7 @@ export { default as NotFound } from './NotFound/index.js';
42
42
  export { default as VideoPlayer } from './VideoPlayer/index.js';
43
43
  export { default as Whiteboard } from './Whiteboard/index.js';
44
44
  export { default as DownloadButton, DownloadButtonProps, DownloadContent } from './DownloadButton/index.js';
45
- export { AuthProvider, ProtectedRoute, PublicRoute, getRootDomain, useAuth, useAuthGuard, useRouteAuth, withAuth } from './Auth/index.js';
45
+ export { AuthContextType, AuthProvider, ProtectedRoute, PublicRoute, getRootDomain, useAuth, useAuthGuard, useRouteAuth, withAuth } from './Auth/index.js';
46
46
  export { CardAccordation } from './Accordation/index.js';
47
47
  export { AlternativesList } from './Alternative/index.js';
48
48
  export { createZustandAuthAdapter } from './Auth/zustandAuthAdapter/index.js';
@@ -56,8 +56,12 @@ export { MultipleChoiceList } from './MultipleChoice/index.js';
56
56
  export { default as IconRender } from './IconRender/index.js';
57
57
  export { DeviceType, getDeviceType, useMobile } from './hooks/useMobile/index.js';
58
58
  export { useTheme } from './hooks/useTheme/index.js';
59
+ export { BreadcrumbMenu, BreadcrumbMenuProps } from './BreadcrumbMenu/index.js';
60
+ export { BreadcrumbBuilderConfig, BreadcrumbLevel, BreadcrumbLevelStatic, BreadcrumbLevelWithData, useBreadcrumbBuilder } from './BreadcrumbMenu/useBreadcrumbBuilder/index.js';
61
+ export { UrlParamsConfig, useUrlParams } from './BreadcrumbMenu/useUrlParams/index.js';
62
+ export { BreadcrumbItem, useBreadcrumb } from './BreadcrumbMenu/breadcrumbStore/index.js';
63
+ import * as zustand_middleware from 'zustand/middleware';
59
64
  export { cn, getSubjectColorWithOpacity, syncDropdownState } from './utils/index.js';
60
- import 'zustand/middleware';
61
65
  import 'clsx';
62
66
 
63
67
  /**
@@ -431,4 +435,182 @@ declare const QuizListResultByMateria: ({ subject, onQuestionClick, subjectName,
431
435
  subjectName?: string;
432
436
  }) => react_jsx_runtime.JSX.Element;
433
437
 
434
- export { CheckboxList, CheckboxListItem, FetchNotificationsParams, Notification, type NotificationActions, NotificationApiClient, NotificationEntityType, NotificationGroup, type NotificationState, type NotificationStore, NotificationType, Question, QuizAlternative, QuizConnectDots, QuizDissertative, QuizHeaderResult, QuizImageQuestion, QuizListResult, QuizListResultByMateria, QuizMultipleChoice, QuizResultHeaderTitle, QuizResultPerformance, QuizResultTitle, QuizTrueOrFalse, createNotificationStore, createNotificationsHook, createUseNotificationStore, createUseNotifications, formatTimeAgo, getStatusBadge };
438
+ /**
439
+ * Interface representing user authentication tokens.
440
+ */
441
+ interface AuthTokens {
442
+ token: string;
443
+ refreshToken: string;
444
+ [key: string]: unknown;
445
+ }
446
+ /**
447
+ * Interface representing a user profile.
448
+ */
449
+ interface UserProfile {
450
+ id: string;
451
+ name?: string;
452
+ email?: string;
453
+ [key: string]: unknown;
454
+ }
455
+ /**
456
+ * Interface representing a user.
457
+ */
458
+ interface User {
459
+ id: string;
460
+ name?: string;
461
+ email?: string;
462
+ [key: string]: unknown;
463
+ }
464
+ /**
465
+ * Interface representing session information from the API.
466
+ */
467
+ interface SessionInfo {
468
+ sessionId: string;
469
+ userId: string;
470
+ profileId: string;
471
+ institutionId: string;
472
+ schoolId: string;
473
+ schoolYearId: string;
474
+ classId: string;
475
+ subjects: string[];
476
+ schools: string[];
477
+ [key: string]: unknown;
478
+ }
479
+ /**
480
+ * Interface defining the authentication state.
481
+ */
482
+ interface AuthState {
483
+ user: User | null;
484
+ tokens: AuthTokens | null;
485
+ isAuthenticated: boolean;
486
+ profiles: UserProfile[];
487
+ selectedProfile: UserProfile | null;
488
+ sessionInfo: SessionInfo | null;
489
+ setUser: (user: User | null) => void;
490
+ setTokens: (tokens: AuthTokens | null) => void;
491
+ setProfiles: (profiles: UserProfile[]) => void;
492
+ setSelectedProfile: (profile: UserProfile | null) => void;
493
+ setSessionInfo: (sessionInfo: SessionInfo | null) => void;
494
+ signIn: (user: User, tokens: AuthTokens, profiles: UserProfile[]) => void;
495
+ signOut: () => void;
496
+ updateUserSession: (sessionData: Partial<User>) => void;
497
+ }
498
+ /**
499
+ * Zustand store for managing authentication state with persistence.
500
+ */
501
+ declare const useAuthStore: zustand.UseBoundStore<Omit<zustand.StoreApi<AuthState>, "persist"> & {
502
+ persist: {
503
+ setOptions: (options: Partial<zustand_middleware.PersistOptions<AuthState, unknown>>) => void;
504
+ clearStorage: () => void;
505
+ rehydrate: () => Promise<void> | void;
506
+ hasHydrated: () => boolean;
507
+ onHydrate: (fn: (state: AuthState) => void) => () => void;
508
+ onFinishHydration: (fn: (state: AuthState) => void) => () => void;
509
+ getOptions: () => Partial<zustand_middleware.PersistOptions<AuthState, unknown>>;
510
+ };
511
+ }>;
512
+
513
+ /**
514
+ * Hook que gerencia a inicialização da aplicação e funções de autenticação
515
+ * Combina a lógica de obtenção do institutionId, inicialização do app store e funções de auth
516
+ *
517
+ * @param {UseAppInitializationProps} props - Propriedades do hook
518
+ * @returns {object} Estado da inicialização, funções relacionadas e funções de autenticação
519
+ */
520
+ declare function useAppInitialization(): {
521
+ getInstitutionId: string | null;
522
+ initialize: (id: string | null) => void;
523
+ initialized: boolean;
524
+ institutionId: string | null;
525
+ authFunctions: {
526
+ checkAuth: () => Promise<boolean>;
527
+ signOut: () => void;
528
+ getUser: () => User | null;
529
+ getSessionInfo: () => SessionInfo | null;
530
+ getTokens: () => AuthTokens | null;
531
+ };
532
+ };
533
+
534
+ /**
535
+ * Interface para as configurações do hook useAppContent
536
+ */
537
+ interface UseAppContentConfig {
538
+ /** API instance para configuração */
539
+ api: {
540
+ get: (endpoint: string, config: unknown) => Promise<unknown>;
541
+ };
542
+ /** ID da instituição obtido externamente */
543
+ getInstitutionId: string | null | undefined;
544
+ /** Função de inicialização obtida externamente */
545
+ initialize: (institutionId: string) => void;
546
+ /** Estado de inicialização obtido externamente */
547
+ initialized: boolean;
548
+ /** Endpoint para autenticação via URL */
549
+ endpoint?: string;
550
+ /** Número máximo de tentativas em caso de erro */
551
+ maxRetries?: number;
552
+ /** Delay entre tentativas em ms */
553
+ retryDelay?: number;
554
+ /** Callback para limpeza de parâmetros da URL */
555
+ onClearParamsFromURL?: () => void;
556
+ /** Callback para tratamento de erro */
557
+ onError?: (error: unknown) => void;
558
+ /** Callback para navegação quando página não encontrada */
559
+ onNotFoundNavigation?: () => void;
560
+ }
561
+ /**
562
+ * Hook que encapsula toda a lógica do componente AppContent
563
+ * Centraliza a configuração de autenticação, tema, navegação e inicialização
564
+ *
565
+ * @param {UseAppContentConfig} config - Configurações do hook
566
+ * @returns {object} Funções e estado necessários para o AppContent
567
+ */
568
+ declare function useAppContent(config: UseAppContentConfig): {
569
+ handleNotFoundNavigation: () => void;
570
+ urlAuthConfig: {
571
+ setTokens: (tokens: AuthTokens | null) => void;
572
+ setSessionInfo: (sessionInfo: SessionInfo | null) => void;
573
+ setSelectedProfile: (profile: {
574
+ id: string;
575
+ }) => void;
576
+ api: {
577
+ get: (endpoint: string, config: unknown) => Promise<unknown>;
578
+ };
579
+ endpoint: string;
580
+ clearParamsFromURL: () => void;
581
+ maxRetries: number;
582
+ retryDelay: number;
583
+ onError: (error: unknown) => void;
584
+ };
585
+ institutionIdToUse: string | null | undefined;
586
+ };
587
+
588
+ declare function useInstitutionId(): string | null;
589
+
590
+ /**
591
+ * Interface defining the application state
592
+ */
593
+ interface AppState {
594
+ institutionId: string | null;
595
+ initialized: boolean;
596
+ setInstitutionId: (institutionId: string | null) => void;
597
+ setInitialized: (initialized: boolean) => void;
598
+ initialize: (id: string | null) => void;
599
+ }
600
+ /**
601
+ * Zustand store for managing application-wide state with persistence
602
+ * @returns {AppState} The application state store
603
+ */
604
+ declare const useAppStore: zustand.UseBoundStore<Omit<zustand.StoreApi<AppState>, "persist"> & {
605
+ persist: {
606
+ setOptions: (options: Partial<zustand_middleware.PersistOptions<AppState, unknown>>) => void;
607
+ clearStorage: () => void;
608
+ rehydrate: () => Promise<void> | void;
609
+ hasHydrated: () => boolean;
610
+ onHydrate: (fn: (state: AppState) => void) => () => void;
611
+ onFinishHydration: (fn: (state: AppState) => void) => () => void;
612
+ getOptions: () => Partial<zustand_middleware.PersistOptions<AppState, unknown>>;
613
+ };
614
+ }>;
615
+
616
+ export { type AuthState, CheckboxList, CheckboxListItem, FetchNotificationsParams, Notification, type NotificationActions, NotificationApiClient, NotificationEntityType, NotificationGroup, type NotificationState, type NotificationStore, NotificationType, Question, QuizAlternative, QuizConnectDots, QuizDissertative, QuizHeaderResult, QuizImageQuestion, QuizListResult, QuizListResultByMateria, QuizMultipleChoice, QuizResultHeaderTitle, QuizResultPerformance, QuizResultTitle, QuizTrueOrFalse, createNotificationStore, createNotificationsHook, createUseNotificationStore, createUseNotifications, formatTimeAgo, getStatusBadge, useAppContent, useAppInitialization, useAppStore, useAuthStore, useInstitutionId };