@eloquentai/chat-sdk 0.28.0-dev → 0.28.1-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.
@@ -33,6 +33,7 @@ export interface UseChatReturn {
33
33
  hideProactiveMessage: () => void;
34
34
  isChatClosed: boolean;
35
35
  onStartNewChat: () => void;
36
+ onRateChat: (rating: number) => Promise<void>;
36
37
  }
37
38
  /**
38
39
  * The primary chat hook, responsible for managing the chat state and operations.
@@ -24,6 +24,7 @@ export interface UseMessageEventsProps {
24
24
  export interface UseMessageEventsReturn {
25
25
  onCleanMessages: () => void;
26
26
  onSendMessage: (data: MessageData) => Promise<void>;
27
+ onRateChat: (rating: number) => Promise<void>;
27
28
  }
28
29
  /**
29
30
  * Hook to handle message events like sending and cleaning
@@ -13,6 +13,7 @@ export type UseRealtimeSocketOptions = {
13
13
  onAgentCapturedUrl?: (content: string) => void;
14
14
  onAgentTopic?: (content: string) => void;
15
15
  onAgentSummary?: (content: string) => void;
16
+ onRatingRequest?: () => void;
16
17
  fetchHistory: (chatId: string) => Promise<MessageResponse[]>;
17
18
  backupPollingInterval?: number;
18
19
  };
@@ -21,4 +22,4 @@ export type UseRealtimeSocketReturn = {
21
22
  disconnect: () => void;
22
23
  clearProcessedIds: () => void;
23
24
  };
24
- export declare function useRealtimeSocket({ chatSettings, chatId, messages, onMessage, onCognition, onCognitionComplete, onError, onChatClosed, onAgentCapturedUrl, onAgentTopic, onAgentSummary, fetchHistory, backupPollingInterval, }: UseRealtimeSocketOptions): UseRealtimeSocketReturn;
25
+ export declare function useRealtimeSocket({ chatSettings, chatId, messages, onMessage, onCognition, onCognitionComplete, onError, onChatClosed, onAgentCapturedUrl, onAgentTopic, onAgentSummary, onRatingRequest, fetchHistory, backupPollingInterval, }: UseRealtimeSocketOptions): UseRealtimeSocketReturn;
@@ -44,6 +44,12 @@ export declare const chatResponseApiSchema: z.ZodUnion<readonly [z.ZodObject<{
44
44
  type: z.ZodLiteral<"chat_closed_expired">;
45
45
  content: z.ZodString;
46
46
  }, z.core.$strip>;
47
+ }, z.core.$strip>, z.ZodObject<{
48
+ created_at: z.ZodString;
49
+ data: z.ZodObject<{
50
+ type: z.ZodLiteral<"chat_rating">;
51
+ content: z.ZodString;
52
+ }, z.core.$strip>;
47
53
  }, z.core.$strip>]>;
48
54
  export type ChatResponseApi = z.infer<typeof chatResponseApiSchema>;
49
55
  type NotificationData = ChatResponseApi["data"];
@@ -91,6 +97,12 @@ export type ChatClosedExpiredNotification = {
91
97
  type: "chat_closed_expired";
92
98
  }>;
93
99
  };
100
+ export type ChatRatingNotification = {
101
+ created_at: string;
102
+ data: Extract<NotificationData, {
103
+ type: "chat_rating";
104
+ }>;
105
+ };
94
106
  export declare const chatResponseSchema: z.ZodObject<{
95
107
  message_id: z.ZodString;
96
108
  response: z.ZodObject<{
@@ -21,5 +21,6 @@ export interface ChatInterfaceProps {
21
21
  onCleanChat?: () => void;
22
22
  isChatClosed?: boolean;
23
23
  onStartNewChat?: () => void;
24
+ onRateChat?: (rating: number) => void;
24
25
  }
25
26
  export declare function ChatInterface(props: ChatInterfaceProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ interface RatingMessageBubbleProps {
2
+ onRate: (rating: number) => void;
3
+ }
4
+ export declare function RatingMessageBubble({ onRate }: RatingMessageBubbleProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,7 @@
1
+ interface StarRatingProps {
2
+ value: number;
3
+ onChange: (rating: number) => void;
4
+ disabled?: boolean;
5
+ }
6
+ export declare function StarRating({ value, onChange, disabled, }: StarRatingProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};