@eloquentai/chat-sdk 0.25.11 → 0.25.13-dev

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.
@@ -9,6 +9,7 @@ export interface UseBackgroundPollerProps {
9
9
  setMessages: React.Dispatch<React.SetStateAction<Message[]>>;
10
10
  chatOpen: boolean;
11
11
  onReceiveMessage: (response: ConversationResponse, conversationId: string) => void;
12
+ onConversationClosed?: () => void;
12
13
  }
13
14
  export interface UseBackgroundPollerReturn {
14
15
  setPollingMode: (mode: PollingMode) => void;
@@ -16,4 +17,4 @@ export interface UseBackgroundPollerReturn {
16
17
  startPolling: () => void;
17
18
  stopPolling: () => void;
18
19
  }
19
- export declare function useBackgroundPoller({ apiClient, conversationId, messages, setMessages, chatOpen, onReceiveMessage, }: UseBackgroundPollerProps): UseBackgroundPollerReturn;
20
+ export declare function useBackgroundPoller({ apiClient, conversationId, messages, setMessages, chatOpen, onReceiveMessage, onConversationClosed, }: UseBackgroundPollerProps): UseBackgroundPollerReturn;
@@ -31,6 +31,8 @@ export interface UseChatReturn {
31
31
  autoHideDelay: number;
32
32
  };
33
33
  hideProactiveMessage: () => void;
34
+ isConversationClosed: boolean;
35
+ onStartNewConversation: () => void;
34
36
  }
35
37
  /**
36
38
  * The primary chat hook, responsible for managing the chat state and operations.
@@ -18,6 +18,8 @@ export interface UseMessageEventsProps {
18
18
  currentConversation: Conversation | null;
19
19
  setCurrentConversation: React.Dispatch<React.SetStateAction<Conversation | null>>;
20
20
  chatOpen: boolean;
21
+ onConversationClosed?: () => void;
22
+ isConversationClosed?: boolean;
21
23
  }
22
24
  export interface UseMessageEventsReturn {
23
25
  onCleanMessages: () => void;
@@ -26,4 +28,4 @@ export interface UseMessageEventsReturn {
26
28
  /**
27
29
  * Hook to handle message events like sending and cleaning
28
30
  */
29
- export declare function useMessageEvents({ appId, userId, userName, userData, externalId, deviceId, apiClient, chatSettings, messages, setMessages, currentConversation, setCurrentConversation, chatOpen, }: UseMessageEventsProps): UseMessageEventsReturn;
31
+ export declare function useMessageEvents({ appId, userId, userName, userData, externalId, deviceId, apiClient, chatSettings, messages, setMessages, currentConversation, setCurrentConversation, chatOpen, onConversationClosed, isConversationClosed, }: UseMessageEventsProps): UseMessageEventsReturn;
@@ -5,11 +5,12 @@ type UseRealTimeEventsProps = {
5
5
  onReceiveCognition: (content: string) => void;
6
6
  onCognitionComplete: () => void;
7
7
  onError?: () => void;
8
+ onConversationClosed?: () => void;
8
9
  chatSettings: BootResponse["chat_settings"] | null;
9
10
  };
10
11
  type UseRealTimeEventsReturn = {
11
12
  connect: (conversationId: string) => Promise<void>;
12
13
  disconnect: () => void;
13
14
  };
14
- export declare function useRealTimeEvents({ onReceiveMessage, onReceiveCognition, onError, chatSettings, }: UseRealTimeEventsProps): UseRealTimeEventsReturn;
15
+ export declare function useRealTimeEvents({ onReceiveMessage, onReceiveCognition, onError, onConversationClosed, chatSettings, }: UseRealTimeEventsProps): UseRealTimeEventsReturn;
15
16
  export {};
@@ -19,6 +19,13 @@ export declare const conversationResponseApiSchema: z.ZodUnion<readonly [z.ZodOb
19
19
  type: z.ZodLiteral<"agent_cognition">;
20
20
  content: z.ZodString;
21
21
  }, z.core.$strip>;
22
+ }, z.core.$strip>, z.ZodObject<{
23
+ message_id: z.ZodNullable<z.ZodString>;
24
+ created_at: z.ZodString;
25
+ data: z.ZodObject<{
26
+ type: z.ZodLiteral<"chat_closed_expired">;
27
+ content: z.ZodString;
28
+ }, z.core.$strip>;
22
29
  }, z.core.$strip>]>;
23
30
  export type ConversationResponseApi = z.infer<typeof conversationResponseApiSchema>;
24
31
  type NotificationData = ConversationResponseApi["data"];
@@ -41,6 +48,13 @@ export type AgentCognitionNotification = {
41
48
  type: "agent_cognition";
42
49
  }>;
43
50
  };
51
+ export type ChatClosedExpiredNotification = {
52
+ message_id: string | null;
53
+ created_at: string;
54
+ data: Extract<NotificationData, {
55
+ type: "chat_closed_expired";
56
+ }>;
57
+ };
44
58
  export declare const conversationResponseSchema: z.ZodObject<{
45
59
  message_id: z.ZodString;
46
60
  response: z.ZodObject<{
@@ -19,5 +19,7 @@ export interface ChatInterfaceProps {
19
19
  onMessageClick?: (message: MessageData) => void;
20
20
  onClose?: () => void;
21
21
  onCleanChat?: () => void;
22
+ isConversationClosed?: boolean;
23
+ onStartNewConversation?: () => void;
22
24
  }
23
25
  export declare function ChatInterface(props: ChatInterfaceProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import * as Oe from "react";
2
2
  import { version as Zu } from "react";
3
- import { g as Rp } from "./index-Dh2wxFxZ.js";
3
+ import { g as Rp } from "./index-DEM24hKD.js";
4
4
  try {
5
5
  let e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}, t = new e.Error().stack;
6
6
  t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "e912b1ab-8839-4e6c-90b8-c20d1854ba0f", e._sentryDebugIdIdentifier = "sentry-dbid-e912b1ab-8839-4e6c-90b8-c20d1854ba0f");
@@ -18790,4 +18790,4 @@ export {
18790
18790
  iR as wrapUseRoutesV7,
18791
18791
  ik as zodErrorsIntegration
18792
18792
  };
18793
- //# sourceMappingURL=index-CrW-I_nj.js.map
18793
+ //# sourceMappingURL=index-BVjtTZAq.js.map