UNPKG

@replyke/core

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

132 lines (131 loc) 6.35 kB
import type { Conversation, ConversationPreview } from "../../interfaces/models/Conversation"; import type { ChatMessage } from "../../interfaces/models/ChatMessage"; import type { ReplykeState } from "../replykeReducers"; interface ConversationEntry { data: Conversation | null; loading: boolean; error: string | null; } interface MessagesBucket { items: ChatMessage[]; loading: boolean; hasMore: boolean; oldestMessageId: string | null; newestMessageId: string | null; } interface ThreadBucket { items: ChatMessage[]; loading: boolean; hasMore: boolean; } export interface ChatState { conversations: Record<string, ConversationEntry>; conversationList: { items: ConversationPreview[]; loading: boolean; hasMore: boolean; cursor: string | null; }; messages: Record<string, MessagesBucket>; threads: Record<string, ThreadBucket>; typingUsers: Record<string, string[]>; socketConnected: boolean; totalUnreadCount: number | null; unreadConversationCount: number | null; } export declare const setConversation: import("@reduxjs/toolkit").ActionCreatorWithPayload<Conversation, "chat/setConversation">, setConversationLoading: import("@reduxjs/toolkit").ActionCreatorWithPayload<{ conversationId: string; loading: boolean; }, "chat/setConversationLoading">, setConversationList: import("@reduxjs/toolkit").ActionCreatorWithPayload<ConversationPreview[], "chat/setConversationList">, setConversationListLoading: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "chat/setConversationListLoading">, setConversationListHasMore: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "chat/setConversationListHasMore">, setConversationListCursor: import("@reduxjs/toolkit").ActionCreatorWithPayload<string | null, "chat/setConversationListCursor">, upsertConversationPreview: import("@reduxjs/toolkit").ActionCreatorWithPayload<{ conversationId: string; patch: Partial<ConversationPreview>; }, "chat/upsertConversationPreview">, incrementUnread: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "chat/incrementUnread">, clearUnread: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "chat/clearUnread">, setUnreadSummary: import("@reduxjs/toolkit").ActionCreatorWithPayload<{ totalUnread: number; unreadConversationCount: number; }, "chat/setUnreadSummary">, setMessagesLoading: import("@reduxjs/toolkit").ActionCreatorWithPayload<{ conversationId: string; loading: boolean; }, "chat/setMessagesLoading">, setMessagesHasMore: import("@reduxjs/toolkit").ActionCreatorWithPayload<{ conversationId: string; hasMore: boolean; }, "chat/setMessagesHasMore">, upsertMessage: import("@reduxjs/toolkit").ActionCreatorWithPayload<ChatMessage, "chat/upsertMessage">, addOptimisticMessage: import("@reduxjs/toolkit").ActionCreatorWithPayload<ChatMessage, "chat/addOptimisticMessage">, failOptimisticMessage: import("@reduxjs/toolkit").ActionCreatorWithPayload<{ conversationId: string; localId: string; }, "chat/failOptimisticMessage">, removeMessage: import("@reduxjs/toolkit").ActionCreatorWithPayload<{ conversationId: string; messageId: string; }, "chat/removeMessage">, updateReactions: import("@reduxjs/toolkit").ActionCreatorWithPayload<{ conversationId: string; messageId: string; reactionCounts: Record<string, number>; userId: string; emoji: string; delta: 1 | -1; currentUserId: string; }, "chat/updateReactions">, setThreadReplies: import("@reduxjs/toolkit").ActionCreatorWithPayload<{ parentMessageId: string; messages: ChatMessage[]; hasMore: boolean; }, "chat/setThreadReplies">, setThreadLoading: import("@reduxjs/toolkit").ActionCreatorWithPayload<{ parentMessageId: string; loading: boolean; }, "chat/setThreadLoading">, setTypingUsers: import("@reduxjs/toolkit").ActionCreatorWithPayload<{ conversationId: string; userIds: string[]; }, "chat/setTypingUsers">, setSocketConnected: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "chat/setSocketConnected">; declare const _default: import("@reduxjs/toolkit").Reducer<ChatState>; export default _default; export declare const selectConversation: (conversationId: string) => (state: { replyke: ReplykeState; }) => Conversation | null; export declare const selectConversationLoading: (conversationId: string) => (state: { replyke: ReplykeState; }) => boolean; export declare const selectConversationList: (state: { replyke: ReplykeState; }) => ConversationPreview[]; export declare const selectConversationListLoading: (state: { replyke: ReplykeState; }) => boolean; export declare const selectConversationListHasMore: (state: { replyke: ReplykeState; }) => boolean; export declare const selectConversationListCursor: (state: { replyke: ReplykeState; }) => string | null; export declare const selectMessages: (conversationId: string) => (state: { replyke: ReplykeState; }) => ChatMessage[]; export declare const selectMessagesLoading: (conversationId: string) => (state: { replyke: ReplykeState; }) => boolean; export declare const selectMessagesHasMore: (conversationId: string) => (state: { replyke: ReplykeState; }) => boolean; export declare const selectOldestMessageId: (conversationId: string) => (state: { replyke: ReplykeState; }) => string | null; export declare const selectNewestMessageId: (conversationId: string) => (state: { replyke: ReplykeState; }) => string | null; export declare const selectThreadReplies: (parentMessageId: string) => (state: { replyke: ReplykeState; }) => ChatMessage[]; export declare const selectThreadLoading: (parentMessageId: string) => (state: { replyke: ReplykeState; }) => boolean; export declare const selectThreadHasMore: (parentMessageId: string) => (state: { replyke: ReplykeState; }) => boolean; export declare const selectTypingUsers: (conversationId: string) => (state: { replyke: ReplykeState; }) => string[]; export declare const selectSocketConnected: (state: { replyke: ReplykeState; }) => boolean; export declare const selectTotalUnreadCount: (state: { replyke: ReplykeState; }) => number | null; export declare const selectUnreadConversationCount: (state: { replyke: ReplykeState; }) => number | null;