analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
89 lines • 2.58 kB
TypeScript
import { Notification, NotificationGroup, FetchNotificationsParams, NotificationApiClient } from '../types/notifications';
/**
* Notification store state interface
*/
export interface NotificationState {
/**
* List of all notifications
*/
notifications: Notification[];
/**
* Number of unread notifications
*/
unreadCount: number;
/**
* Loading state
*/
loading: boolean;
/**
* Error state
*/
error: string | null;
/**
* Whether there are more notifications to load
*/
hasMore: boolean;
/**
* Current page for pagination
*/
currentPage: number;
}
/**
* Notification store actions interface
*/
export interface NotificationActions {
/**
* Fetch notifications from API
*/
fetchNotifications: (params?: FetchNotificationsParams) => Promise<void>;
/**
* Mark a specific notification as read
*/
markAsRead: (id: string) => Promise<void>;
/**
* Mark all notifications as read
*/
markAllAsRead: () => Promise<void>;
/**
* Delete a notification
*/
deleteNotification: (id: string) => Promise<void>;
/**
* Clear all notifications
*/
clearNotifications: () => void;
/**
* Reset error state
*/
resetError: () => void;
/**
* Group notifications by time periods
*/
getGroupedNotifications: () => NotificationGroup[];
}
export type NotificationStore = NotificationState & NotificationActions;
/**
* Format time relative to now
*/
export declare const formatTimeAgo: (date: Date) => string;
/**
* Create notification store with injected API client
*/
export declare const createNotificationStore: (apiClient: NotificationApiClient) => import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<NotificationStore>, "setState" | "devtools"> & {
setState(partial: NotificationStore | Partial<NotificationStore> | ((state: NotificationStore) => NotificationStore | Partial<NotificationStore>), replace?: false | undefined, action?: (string | {
[x: string]: unknown;
[x: number]: unknown;
[x: symbol]: unknown;
type: string;
}) | undefined): void;
setState(state: NotificationStore | ((state: NotificationStore) => NotificationStore), replace: true, action?: (string | {
[x: string]: unknown;
[x: number]: unknown;
[x: symbol]: unknown;
type: string;
}) | undefined): void;
devtools: {
cleanup: () => void;
};
}>;
//# sourceMappingURL=notificationStore.d.ts.map