@ethora/chat-component 25.6.1 → 25.6.3

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,6 +1,7 @@
1
1
  import { Element } from 'ltx';
2
+ import { IMessage } from '../types/types';
2
3
  import { default as XmppClient } from './xmppClient';
3
- declare const onRealtimeMessage: (stanza: Element) => Promise<import('../types/types').IMessage>;
4
+ declare const onRealtimeMessage: (stanza: Element) => Promise<IMessage>;
4
5
  declare const onReactionMessage: (stanza: Element) => Promise<void>;
5
6
  declare const onDeleteMessage: (stanza: Element) => Promise<void>;
6
7
  declare const onEditMessage: (stanza: Element) => Promise<void>;
@@ -15,4 +16,5 @@ declare const onGetLastMessageArchive: (stanza: Element) => void;
15
16
  declare const onNewRoomCreated: (stanza: Element, xmpp: any) => void;
16
17
  declare const onGetChatRooms: (stanza: Element, xmpp: any) => void;
17
18
  declare const onRoomKicked: (stanza: Element) => Promise<void>;
18
- export { onRealtimeMessage, onMessageHistory, onPresenceInRoom, onReactionHistory, onGetLastMessageArchive, handleComposing, onGetChatRooms, onNewRoomCreated, onGetMembers, onGetRoomInfo, onDeleteMessage, onEditMessage, onReactionMessage, onChatInvite, onRoomKicked, };
19
+ declare const onMessageError: (stanza: Element, client: XmppClient) => Promise<void>;
20
+ export { onRealtimeMessage, onMessageHistory, onPresenceInRoom, onReactionHistory, onGetLastMessageArchive, handleComposing, onGetChatRooms, onNewRoomCreated, onGetMembers, onGetRoomInfo, onDeleteMessage, onEditMessage, onReactionMessage, onChatInvite, onRoomKicked, onMessageError, };
@@ -0,0 +1 @@
1
+ export declare function isPong(stanza: any, pingId: string): boolean;
@@ -0,0 +1 @@
1
+ export declare function sendPing(client: any, to: string, id?: string): string;
@@ -8,11 +8,20 @@ export declare class XmppClient implements XmppClientInterface {
8
8
  conference: string;
9
9
  username: string;
10
10
  status: string;
11
+ resource: string;
11
12
  password: string;
12
13
  reconnectAttempts: number;
13
14
  maxReconnectAttempts: number;
14
15
  reconnectDelay: number;
16
+ private reconnecting;
17
+ private reconnectPromise;
15
18
  checkOnline(): boolean;
19
+ pingInterval: any;
20
+ pingTimeout: any;
21
+ lastPingId: string | null;
22
+ pingIntervalMs: number;
23
+ pongTimeoutMs: number;
24
+ pingOnSendEnabled: boolean;
16
25
  constructor(username: string, password: string, xmppSettings?: xmppSettingsInterface);
17
26
  initializeClient(): Promise<void>;
18
27
  disconnect(): Promise<void>;
@@ -34,7 +43,8 @@ export declare class XmppClient implements XmppClientInterface {
34
43
  getRoomInfoStanza: (roomJID: string) => void;
35
44
  getRoomMembersStanza: (roomJID: string) => void;
36
45
  setVCardStanza(xmppUsername: string): void;
37
- sendMessage: (roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string, customId?: string) => void;
46
+ sendMessageWithPingCheck(sendFn: () => Promise<void>, retry?: boolean): Promise<boolean>;
47
+ sendMessage: (roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string, customId?: string) => Promise<boolean>;
38
48
  sendTextMessageWithTranslateTagStanza: (roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string, langSource?: Iso639_1Codes) => void;
39
49
  deleteMessageStanza(room: string, msgId: string): void;
40
50
  editMessageStanza(room: string, msgId: string, text: string): void;
@@ -44,5 +54,8 @@ export declare class XmppClient implements XmppClientInterface {
44
54
  actionSetTimestampToPrivateStoreStanza(chatId: string, timestamp: number, chats?: string[]): Promise<void>;
45
55
  createPrivateRoomStanza(title: string, description: string, to: string): Promise<string>;
46
56
  sendMediaMessageStanza(roomJID: string, data: any): void;
57
+ sendPing(): void;
58
+ handlePong(): void;
59
+ handlePingTimeout(): void;
47
60
  }
48
61
  export default XmppClient;
@@ -1,15 +1,19 @@
1
+ import { PayloadAction } from '@reduxjs/toolkit';
1
2
  import { IMessage } from '../types/types';
2
3
  interface roomHeapSliceState {
3
- messageHeap: IMessage[];
4
+ messageHeap: [string, IMessage][];
4
5
  }
5
6
  export declare const roomHeapSlice: import('@reduxjs/toolkit').Slice<roomHeapSliceState, {
6
- addMessageToHeap: (state: import('immer').WritableDraft<roomHeapSliceState>, action: {
7
- payload: any;
8
- type: string;
9
- }) => void;
7
+ addMessageToHeap: (state: import('immer').WritableDraft<roomHeapSliceState>, action: PayloadAction<{
8
+ jid: string;
9
+ message: IMessage;
10
+ }>) => void;
10
11
  popMessageFromHeap: (state: import('immer').WritableDraft<roomHeapSliceState>) => void;
11
12
  clearHeap: (state: import('immer').WritableDraft<roomHeapSliceState>) => void;
12
- }, "roomHeapSlice", "roomHeapSlice", import('@reduxjs/toolkit').SliceSelectors<roomHeapSliceState>>;
13
- export declare const addMessageToHeap: import('@reduxjs/toolkit').ActionCreatorWithPayload<any, "roomHeapSlice/addMessageToHeap">, popMessageFromHeap: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"roomHeapSlice/popMessageFromHeap">, clearHeap: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"roomHeapSlice/clearHeap">;
13
+ }, "roomHeapStore", "roomHeapStore", import('@reduxjs/toolkit').SliceSelectors<roomHeapSliceState>>;
14
+ export declare const addMessageToHeap: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
15
+ jid: string;
16
+ message: IMessage;
17
+ }, "roomHeapStore/addMessageToHeap">, popMessageFromHeap: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"roomHeapStore/popMessageFromHeap">, clearHeap: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"roomHeapStore/clearHeap">;
14
18
  declare const _default: import('redux').Reducer<roomHeapSliceState>;
15
19
  export default _default;
@@ -103,4 +103,5 @@ export interface IConfig {
103
103
  enabled: boolean;
104
104
  filterFunction: (text: string) => string;
105
105
  };
106
+ disableTypingIndicator?: boolean;
106
107
  }
@@ -10,6 +10,7 @@ export interface xmppSettingsInterface {
10
10
  devServer: string;
11
11
  host: string;
12
12
  conference?: string;
13
+ xmppPingOnSendEnabled?: boolean;
13
14
  }
14
15
  export interface MediaUploadData {
15
16
  file: File;
@@ -24,6 +25,7 @@ export interface XmppClientInterface {
24
25
  conference: string;
25
26
  username: string;
26
27
  status: string;
28
+ resource: string;
27
29
  password: string;
28
30
  reconnectAttempts: number;
29
31
  maxReconnectAttempts: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethora/chat-component",
3
- "version": "25.6.1",
3
+ "version": "25.6.3",
4
4
  "type": "module",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",
@@ -1,4 +0,0 @@
1
- export declare const useStoreConsole: () => {
2
- chatSettingStore: any;
3
- rooms: any;
4
- };
@@ -1,24 +0,0 @@
1
- import { Reducer } from '@reduxjs/toolkit';
2
- import { IRoom } from '../types/types';
3
- import { AnyAction } from 'redux-saga';
4
- declare const rootReducer: Reducer<{
5
- chatSettingStore: any;
6
- rooms: any;
7
- }, import('redux').UnknownAction, Partial<{
8
- chatSettingStore: any;
9
- rooms: any;
10
- }>>;
11
- export type RootState = ReturnType<typeof rootReducer>;
12
- export declare const getActiveRoom: (state: RootState) => IRoom | null;
13
- export declare const store: import('@reduxjs/toolkit').EnhancedStore<{
14
- chatSettingStore: any;
15
- rooms: any;
16
- }, AnyAction, import('@reduxjs/toolkit').Tuple<[import('redux').StoreEnhancer<{
17
- dispatch: import('redux-thunk').ThunkDispatch<{
18
- chatSettingStore: any;
19
- rooms: any;
20
- }, undefined, import('redux').UnknownAction>;
21
- }>, import('redux').StoreEnhancer]>>;
22
- export type AppDispatch = typeof store.dispatch;
23
- export declare const persistor: import('redux-persist').Persistor;
24
- export {};