@bcc-code/vue-bcc-chat-ui 1.4.2 → 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.
@@ -1,14 +1,13 @@
1
- export declare const setAccessToken: (token: string | null | undefined) => void;
2
- export declare const refreshConnection: () => Promise<void>;
3
- export declare const connect: (connectionName: string | null | undefined) => Promise<null | undefined>;
4
- export declare const disconnect: (connectionName: string | null | undefined) => Promise<any>;
1
+ export declare const connected: import("vue").ComputedRef<boolean>;
5
2
  export declare const reconnect: () => Promise<boolean>;
3
+ export declare const connect: (connectionName?: string | null | undefined) => Promise<boolean>;
4
+ export declare const disconnect: (connectionName?: string | null | undefined) => Promise<void>;
5
+ export declare const setAccessToken: (token: string) => Promise<void>;
6
6
  declare const _default: {
7
- setAccessToken: (token: string | null | undefined) => void;
8
- connect: (connectionName: string | null | undefined) => Promise<null | undefined>;
9
- disconnect: (connectionName: string | null | undefined) => Promise<any>;
7
+ setAccessToken: (token: string) => Promise<void>;
8
+ connect: (connectionName?: string | null | undefined) => Promise<boolean>;
9
+ disconnect: (connectionName?: string | null | undefined) => Promise<void>;
10
10
  reconnect: () => Promise<boolean>;
11
- refreshConnection: () => Promise<void>;
12
11
  connected: import("vue").ComputedRef<boolean>;
13
12
  };
14
13
  export default _default;
@@ -15,12 +15,12 @@ export interface MessageInfo {
15
15
  sentAt: Date;
16
16
  }
17
17
  export declare const userChats: Ref<UserChatInfo[]>;
18
- export declare const getGroup: (groupUid: string) => Promise<Group>;
18
+ export declare const getGroup: (groupUid: string) => Promise<Group | null>;
19
19
  export declare const clearGroupChatCount: (groupUid: string) => Promise<void>;
20
20
  export declare const getGroupOnlineCount: (groupUid: string) => Promise<Object | 0>;
21
21
  export declare const getUserChats: () => Promise<Ref<UserChatInfo[]>> | undefined;
22
22
  declare const _default: {
23
- getGroup: (groupUid: string) => Promise<Group>;
23
+ getGroup: (groupUid: string) => Promise<Group | null>;
24
24
  userChats: Ref<UserChatInfo[]>;
25
25
  getUserChats: () => Promise<Ref<UserChatInfo[]>> | undefined;
26
26
  clearGroupChatCount: (groupUid: string) => Promise<void>;
@@ -10,8 +10,10 @@ export * as mobileView from "./mobileView";
10
10
  export * as connection from "./connection";
11
11
  export * as data from "./data";
12
12
  export * as environment from "./environment";
13
+ export * as login from "./login";
13
14
  declare const _default: {
14
15
  install: (app: any, options: ChatInstallOptions) => Promise<void>;
16
+ initialized: import("vue").ComputedRef<boolean>;
15
17
  environment: {
16
18
  install: (_: any, environment: string) => void;
17
19
  setCurrentEnvironment: (environment: string | null) => import("./environment").ChatEnvironmentConfig;
@@ -27,21 +29,26 @@ declare const _default: {
27
29
  install: (app: any) => Promise<void>;
28
30
  switchView: () => void;
29
31
  isMobileView: any;
32
+ watchAndApplyStyle: typeof import("./mobileView").watchAndApplyStyle;
30
33
  };
31
34
  connection: {
32
- setAccessToken: (token: string | null | undefined) => void;
33
- connect: (connectionName: string | null | undefined) => Promise<null | undefined>;
34
- disconnect: (connectionName: string | null | undefined) => Promise<any>;
35
+ setAccessToken: (token: string) => Promise<void>;
36
+ connect: (connectionName?: string | null | undefined) => Promise<boolean>;
37
+ disconnect: (connectionName?: string | null | undefined) => Promise<void>;
35
38
  reconnect: () => Promise<boolean>;
36
- refreshConnection: () => Promise<void>;
37
39
  connected: import("vue").ComputedRef<boolean>;
38
40
  };
39
41
  data: {
40
- getGroup: (groupUid: string) => Promise<import("@cometchat/chat-sdk-javascript").Group>;
42
+ getGroup: (groupUid: string) => Promise<import("@cometchat/chat-sdk-javascript").Group | null>;
41
43
  userChats: Ref<import("./data").UserChatInfo[]>;
42
44
  getUserChats: () => Promise<Ref<import("./data").UserChatInfo[]>> | undefined;
43
45
  clearGroupChatCount: (groupUid: string) => Promise<void>;
44
46
  getGroupOnlineCount: (groupUid: string) => Promise<Object | 0>;
45
47
  };
48
+ login: {
49
+ loggedIn: Ref<boolean>;
50
+ login: (accessToken?: string | null | undefined) => Promise<boolean | undefined>;
51
+ logout: () => Promise<boolean>;
52
+ };
46
53
  };
47
54
  export default _default;
@@ -0,0 +1,9 @@
1
+ export declare const loggedIn: import("vue").Ref<boolean>;
2
+ export declare const login: (accessToken?: string | null | undefined) => Promise<boolean | undefined>;
3
+ export declare const logout: () => Promise<boolean>;
4
+ declare const _default: {
5
+ loggedIn: import("vue").Ref<boolean>;
6
+ login: (accessToken?: string | null | undefined) => Promise<boolean | undefined>;
7
+ logout: () => Promise<boolean>;
8
+ };
9
+ export default _default;
@@ -13,5 +13,6 @@ declare const _default: {
13
13
  install: (app: any) => Promise<void>;
14
14
  switchView: () => void;
15
15
  isMobileView: any;
16
+ watchAndApplyStyle: typeof watchAndApplyStyle;
16
17
  };
17
18
  export default _default;
@@ -1,4 +1,2 @@
1
- export interface TokenResponse {
2
- token: string;
3
- }
1
+ export declare const clearToken: () => Promise<void>;
4
2
  export declare const getToken: (authToken: string, chatApiEndpoint: string) => Promise<string | null>;
@@ -1,5 +1,7 @@
1
+ export declare const initialized: import("vue").ComputedRef<boolean>;
1
2
  export declare const init: () => Promise<void>;
2
3
  declare const _default: {
4
+ initialized: import("vue").ComputedRef<boolean>;
3
5
  init: () => Promise<void>;
4
6
  getUIKitSettings: () => import("@cometchat/chat-uikit-vue").UIKitSettings;
5
7
  };
@@ -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
+ }