@tracktor/shared-module 2.32.0 → 2.34.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.
- package/dist/chat/types.d.ts +1 -0
- package/dist/context/ChatProvider.d.ts +3 -1
- package/dist/hooks/useChat.d.ts +3 -2
- package/dist/main.js +398 -390
- package/dist/main.umd.cjs +5 -5
- package/package.json +1 -1
package/dist/chat/types.d.ts
CHANGED
|
@@ -94,6 +94,7 @@ export interface ChatClientOptions {
|
|
|
94
94
|
reconnectBaseDelay?: number;
|
|
95
95
|
}
|
|
96
96
|
export interface UseChatParams {
|
|
97
|
+
enabled?: boolean;
|
|
97
98
|
onReady?: (event: ReadyEvent) => void;
|
|
98
99
|
onNewMessage?: (event: NewMessageEvent) => void;
|
|
99
100
|
onNewMessageNotification?: (event: NewMessageNotification) => void;
|
|
@@ -22,7 +22,9 @@ export interface ChatContextValue {
|
|
|
22
22
|
listThreads: (limit?: number, offset?: number) => void;
|
|
23
23
|
markRead: (threadId: string) => void;
|
|
24
24
|
sendMessage: (threadId: string, body: string) => void;
|
|
25
|
+
disconnect: () => void;
|
|
26
|
+
setEnabled: (enabled: boolean) => void;
|
|
25
27
|
}
|
|
26
28
|
export declare const ChatContext: import('react').Context<ChatContextValue | null>;
|
|
27
|
-
declare const ChatProvider: ({ children, token, url, wsPath, reconnect, enabled, context, }: PropsWithChildren<ChatProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
declare const ChatProvider: ({ children, token, url, wsPath, reconnect, enabled: enabledProp, context, }: PropsWithChildren<ChatProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
28
30
|
export default ChatProvider;
|
package/dist/hooks/useChat.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { UseChatParams } from '../chat/types';
|
|
2
2
|
import { ChatContextValue } from '../context/ChatProvider';
|
|
3
|
-
type UseChatReturn = Omit<ChatContextValue, "subscribe">;
|
|
3
|
+
type UseChatReturn = Omit<ChatContextValue, "subscribe" | "setEnabled">;
|
|
4
4
|
/**
|
|
5
5
|
* Hook to access the shared WebSocket chat connection.
|
|
6
6
|
* Provides methods to join/leave threads, send messages, mark as read, and list threads.
|
|
7
7
|
* Accepts optional event handlers (onNewMessage, onNewMessageNotification, etc.).
|
|
8
|
+
* Accepts an optional `enabled` flag to control the WebSocket connection from the consumer.
|
|
8
9
|
* Must be used within a ChatProvider.
|
|
9
10
|
*/
|
|
10
|
-
export declare const useChat: (
|
|
11
|
+
export declare const useChat: (params?: UseChatParams) => UseChatReturn;
|
|
11
12
|
export default useChat;
|