@bcc-code/vue-bcc-chat-ui 1.5.0 → 1.6.0

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.
@@ -0,0 +1,2 @@
1
+ import { OfflineStore } from './types.js';
2
+ export declare function cometChatAPIInterceptor(_fetch: typeof fetch, offlineStore: OfflineStore): typeof fetch;
@@ -0,0 +1,2 @@
1
+ import { OfflineStore } from './types.js';
2
+ export declare function cometChatWSOnMessageInterceptor(_onmessage: typeof WebSocket.prototype.onmessage, offlineStore: OfflineStore): typeof WebSocket.prototype.onmessage;
@@ -0,0 +1 @@
1
+ export declare function installOfflineCaching(): void;
@@ -0,0 +1,13 @@
1
+ import { Conversation, ConversationPaginationMeta, Group, Message, MessagePaginationMeta, OfflineStore, PaginatedResponse } from "./types";
2
+ export declare class OfflineStoreLocalStorage implements OfflineStore {
3
+ #private;
4
+ storePrefix: string;
5
+ constructor(storePrefix?: string);
6
+ getGroupMessages(groupId: string, pagination: MessagePaginationMeta): PaginatedResponse<Message>;
7
+ getThreadMessages(parentId: string, pagination: MessagePaginationMeta): PaginatedResponse<Message>;
8
+ saveMessages(messages: Message[]): void;
9
+ getConversations(pagination: ConversationPaginationMeta): PaginatedResponse<Conversation>;
10
+ saveConversations(conversations: Conversation[]): void;
11
+ getGroup(groupId: string): Group | null;
12
+ saveGroup(group: Group): void;
13
+ }
@@ -0,0 +1,41 @@
1
+ export type ReqType = {
2
+ url: URL;
3
+ query: Record<string, any>;
4
+ method: string;
5
+ };
6
+ export interface MessagePaginationMeta {
7
+ per_page: number;
8
+ affix: "prepend" | "append";
9
+ id?: string;
10
+ sent_at?: number;
11
+ }
12
+ export interface ConversationPaginationMeta {
13
+ per_page: number;
14
+ page: number;
15
+ }
16
+ export interface Message {
17
+ id: string;
18
+ receiver: string;
19
+ sentAt: number;
20
+ parentId?: string;
21
+ }
22
+ export interface Conversation {
23
+ conversationId: string;
24
+ updatedAt: number;
25
+ }
26
+ export interface Group {
27
+ guid: string;
28
+ }
29
+ export interface PaginatedResponse<T> {
30
+ data: T[];
31
+ total: number;
32
+ }
33
+ export interface OfflineStore {
34
+ getGroupMessages(groupId: string, pagination: MessagePaginationMeta): PaginatedResponse<Message>;
35
+ getThreadMessages(parentId: string, pagination: MessagePaginationMeta): PaginatedResponse<Message>;
36
+ saveMessages(messages: Message[]): void;
37
+ getConversations(pagination: ConversationPaginationMeta): PaginatedResponse<Conversation>;
38
+ saveConversations(conversations: Conversation[]): void;
39
+ getGroup(groupId: string): Group | null;
40
+ saveGroup(group: Group): void;
41
+ }