@eloquentai/chat-sdk 0.33.13-dev → 0.33.15-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.
- package/dist/components/chat/chat.d.ts +22 -0
- package/dist/components/chat/{chat.hook.d.ts → hooks/use-chat.d.ts} +3 -3
- package/dist/components/chat/{interface-props.hook.d.ts → hooks/use-interface-props.d.ts} +2 -2
- package/dist/components/chat/{message-events.hook.d.ts → hooks/use-message-events.d.ts} +2 -2
- package/dist/components/chat/{persistence.hook.d.ts → hooks/use-persistence.d.ts} +1 -1
- package/dist/components/chat/{realtime-socket.hook.d.ts → hooks/use-realtime-socket.d.ts} +3 -3
- package/dist/components/chat/{sdk-initialization.hook.d.ts → hooks/use-sdk-initialization.d.ts} +2 -2
- package/dist/components/chat/index.d.ts +1 -22
- package/dist/components/chat/message-mapping.d.ts +17 -0
- package/dist/components/chat-interface/chat-interface.d.ts +2 -0
- package/dist/components/chat-interface/context.d.ts +1 -1
- package/dist/components/chat-interface/index.d.ts +2 -57
- package/dist/components/chat-interface/message-bubble/message-action-buttons.d.ts +6 -0
- package/dist/components/chat-interface/message-bubble/message-animation-state.d.ts +2 -0
- package/dist/components/chat-interface/message-bubble/message-bubble-item.d.ts +7 -0
- package/dist/components/{chat-message-bubble.d.ts → chat-interface/message-bubble/message-bubble.d.ts} +1 -1
- package/dist/components/chat-interface/types.d.ts +56 -0
- package/dist/components/{render-chat.d.ts → embed/render-chat.d.ts} +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/contexts/{agent-cognition-context-definition.d.ts → agent-cognition/agent-cognition-context.d.ts} +1 -1
- package/dist/contexts/{error-handling.utils.d.ts → error-handling/error-context.d.ts} +1 -1
- package/dist/contexts/{constants.d.ts → error-handling/error-messages.d.ts} +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +280 -256
- package/dist/index.mjs.map +1 -1
- package/dist/lib/cookies.d.ts +13 -0
- package/dist/lib/utils.d.ts +0 -20
- package/dist/lib/wrap-promise.d.ts +7 -0
- package/dist/{skeleton-XUmC-tbr.js → skeleton-UBO_tD3w.js} +1570 -1584
- package/dist/skeleton-UBO_tD3w.js.map +1 -0
- package/dist/ui.d.ts +3 -3
- package/dist/ui.mjs +1 -1
- package/package.json +1 -1
- package/dist/contexts/utils.d.ts +0 -2
- package/dist/skeleton-XUmC-tbr.js.map +0 -1
- /package/dist/components/chat/{keyboard-inset.hook.d.ts → hooks/use-keyboard-inset.d.ts} +0 -0
- /package/dist/components/chat/{scroll-lock.hook.d.ts → hooks/use-scroll-lock.d.ts} +0 -0
- /package/dist/components/chat/{ui-initialization.hook.d.ts → hooks/use-ui-initialization.d.ts} +0 -0
- /package/dist/components/chat/{user-identity.hook.d.ts → hooks/use-user-identity.d.ts} +0 -0
- /package/dist/components/{chat-rating-bubble.d.ts → chat-interface/rating-message-bubble.d.ts} +0 -0
- /package/dist/components/{chat-bubble.d.ts → embed/chat-bubble.d.ts} +0 -0
- /package/dist/components/{iframe.d.ts → embed/iframe.d.ts} +0 -0
- /package/dist/components/{portal.d.ts → embed/portal.d.ts} +0 -0
- /package/dist/components/{chat → embed}/proactive-message.d.ts +0 -0
- /package/dist/contexts/{agent-cognition.context.d.ts → agent-cognition/agent-cognition-provider.d.ts} +0 -0
- /package/dist/{hooks → contexts/agent-cognition}/use-agent-cognition-context.d.ts +0 -0
- /package/dist/{hooks → contexts/agent-cognition}/use-agent-cognition.d.ts +0 -0
- /package/dist/contexts/{error-handling.context.d.ts → error-handling/error-provider.d.ts} +0 -0
- /package/dist/hooks/{useFetch.d.ts → use-fetch.d.ts} +0 -0
- /package/dist/{type.d.ts → types/message.d.ts} +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Message } from '../../types/message';
|
|
2
|
+
import { UseChatProps } from './hooks/use-chat';
|
|
3
|
+
/** @internal */
|
|
4
|
+
type InternalChatProps = {
|
|
5
|
+
INTERNAL_ONLY_CHAT_INTERFACE_ONLY?: boolean;
|
|
6
|
+
INTERNAL_ONLY_BLOCK_STYLE?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Force the clear-chat button on or off, winning over both the boot
|
|
9
|
+
* `chat_settings.clean_chat_button` and the public `hasCleanChatButton`
|
|
10
|
+
* prop. Leave unset to keep the normal boot ?? prop resolution.
|
|
11
|
+
*/
|
|
12
|
+
INTERNAL_ONLY_SHOW_CLEAN_CHAT_BUTTON?: boolean;
|
|
13
|
+
/** Show the copy-message button on assistant messages (default false). */
|
|
14
|
+
INTERNAL_ONLY_SHOW_COPY_BUTTON?: boolean;
|
|
15
|
+
INTERNAL_ONLY_ENVIRONMENT?: "test" | "live";
|
|
16
|
+
INTERNAL_ONLY_API_URL?: string;
|
|
17
|
+
INTERNAL_ONLY_FEATURE_MESSAGE_CLICK?: (message: Message) => void;
|
|
18
|
+
INTERNAL_ONLY_FEATURE_CLEAR_CHAT_CLICK?: () => void;
|
|
19
|
+
};
|
|
20
|
+
export type ChatProps = UseChatProps & InternalChatProps;
|
|
21
|
+
export declare function Chat(props: Readonly<ChatProps>): import("react").JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Message, MessageData } from '
|
|
2
|
-
import { ThemeContextType } from '
|
|
3
|
-
import { ChatInterfaceProps } from '
|
|
1
|
+
import { Message, MessageData } from '../../../types/message';
|
|
2
|
+
import { ThemeContextType } from '../../../contexts/theme.context';
|
|
3
|
+
import { ChatInterfaceProps } from '../../chat-interface';
|
|
4
4
|
export interface UseChatProps {
|
|
5
5
|
appId: string;
|
|
6
6
|
userId?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BootResponse } from '
|
|
2
|
-
import { ChatInterfaceProps } from '
|
|
1
|
+
import { BootResponse } from '../../../lib/eloquent-ai-api-client';
|
|
2
|
+
import { ChatInterfaceProps } from '../../chat-interface';
|
|
3
3
|
export interface UseInterfacePropsParams {
|
|
4
4
|
chatProps?: Partial<ChatInterfaceProps>;
|
|
5
5
|
chatSettings: BootResponse["chat_settings"] | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import { Message, MessageData } from '
|
|
3
|
-
import { BootResponse, EloquentAiApiClient } from '
|
|
2
|
+
import { Message, MessageData } from '../../../types/message';
|
|
3
|
+
import { BootResponse, EloquentAiApiClient } from '../../../lib/eloquent-ai-api-client';
|
|
4
4
|
export interface UseMessageEventsProps {
|
|
5
5
|
appId: string;
|
|
6
6
|
userId: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BootResponse, MessageResponse } from '
|
|
2
|
-
import { Message } from '
|
|
3
|
-
import { ChatResponse } from '
|
|
1
|
+
import { BootResponse, MessageResponse } from '../../../lib/eloquent-ai-api-client';
|
|
2
|
+
import { Message } from '../../../types/message';
|
|
3
|
+
import { ChatResponse } from '../validations';
|
|
4
4
|
export type UseRealtimeSocketOptions = {
|
|
5
5
|
chatSettings: BootResponse["chat_settings"] | null;
|
|
6
6
|
chatId: string | null;
|
package/dist/components/chat/{sdk-initialization.hook.d.ts → hooks/use-sdk-initialization.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Message } from '
|
|
2
|
-
import { BootResponse, EloquentAiApiClient } from '
|
|
1
|
+
import { Message } from '../../../types/message';
|
|
2
|
+
import { BootResponse, EloquentAiApiClient } from '../../../lib/eloquent-ai-api-client';
|
|
3
3
|
export interface UseSdkInitializationProps {
|
|
4
4
|
environment: "test" | "live";
|
|
5
5
|
apiUrl?: string;
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { UseChatProps } from './chat.hook';
|
|
3
|
-
/** @internal */
|
|
4
|
-
type InternalChatProps = {
|
|
5
|
-
INTERNAL_ONLY_CHAT_INTERFACE_ONLY?: boolean;
|
|
6
|
-
INTERNAL_ONLY_BLOCK_STYLE?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Force the clear-chat button on or off, winning over both the boot
|
|
9
|
-
* `chat_settings.clean_chat_button` and the public `hasCleanChatButton`
|
|
10
|
-
* prop. Leave unset to keep the normal boot ?? prop resolution.
|
|
11
|
-
*/
|
|
12
|
-
INTERNAL_ONLY_SHOW_CLEAN_CHAT_BUTTON?: boolean;
|
|
13
|
-
/** Show the copy-message button on assistant messages (default false). */
|
|
14
|
-
INTERNAL_ONLY_SHOW_COPY_BUTTON?: boolean;
|
|
15
|
-
INTERNAL_ONLY_ENVIRONMENT?: "test" | "live";
|
|
16
|
-
INTERNAL_ONLY_API_URL?: string;
|
|
17
|
-
INTERNAL_ONLY_FEATURE_MESSAGE_CLICK?: (message: Message) => void;
|
|
18
|
-
INTERNAL_ONLY_FEATURE_CLEAR_CHAT_CLICK?: () => void;
|
|
19
|
-
};
|
|
20
|
-
export type ChatProps = UseChatProps & InternalChatProps;
|
|
21
|
-
export declare function Chat(props: Readonly<ChatProps>): import("react").JSX.Element;
|
|
22
|
-
export {};
|
|
1
|
+
export { Chat, type ChatProps } from './chat';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChatResponse } from './validations';
|
|
2
|
+
import { Message } from '../../types/message';
|
|
3
|
+
/**
|
|
4
|
+
* The single place where API/wire shapes become domain `Message`s.
|
|
5
|
+
*
|
|
6
|
+
* Everything here is a pure function: the hooks own state and timing, this
|
|
7
|
+
* module owns shape. A backend field change should only ever touch this file
|
|
8
|
+
* (and validations.ts), not the hooks.
|
|
9
|
+
*/
|
|
10
|
+
/** A realtime/polled assistant reply, as appended to the transcript. */
|
|
11
|
+
export declare function messageFromChatResponse(response: ChatResponse): Message;
|
|
12
|
+
/** The configured welcome message, shown before any conversation exists. */
|
|
13
|
+
export declare function createWelcomeMessage(content: string): Message;
|
|
14
|
+
/** The star-rating prompt appended when the server requests feedback. */
|
|
15
|
+
export declare function createRatingRequestMessage(): Message;
|
|
16
|
+
/** The notice shown when the user writes into a closed conversation. */
|
|
17
|
+
export declare function createChatClosedNoticeMessage(): Message;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { ChatInterfaceProps } from '
|
|
2
|
+
import { ChatInterfaceProps } from './types';
|
|
3
3
|
declare const ChatContext: import('react').Context<ChatInterfaceProps | undefined>;
|
|
4
4
|
export declare function ChatInterfaceProvider({ children, ...props }: PropsWithChildren<ChatInterfaceProps>): import("react").JSX.Element;
|
|
5
5
|
export declare function useChatInterfaceContext(): ChatInterfaceProps;
|
|
@@ -1,57 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface ChatInterfaceProps {
|
|
4
|
-
displayWelcomeMessages?: boolean;
|
|
5
|
-
theme?: Partial<ThemeContextType>;
|
|
6
|
-
isOpen?: boolean;
|
|
7
|
-
isMobile?: boolean;
|
|
8
|
-
/** Current on-screen keyboard overlap (px), used to lift the input above it. */
|
|
9
|
-
keyboardInset?: number;
|
|
10
|
-
messages?: Message[];
|
|
11
|
-
assistantName?: string;
|
|
12
|
-
assistantLogo?: string;
|
|
13
|
-
legalText?: string;
|
|
14
|
-
/** Show the close (X) button in the chat header. Defaults to true. */
|
|
15
|
-
hasCloseButton?: boolean;
|
|
16
|
-
/** Show the clear-conversation button in the chat header. Defaults to true. */
|
|
17
|
-
hasCleanChatButton?: boolean;
|
|
18
|
-
/** @deprecated Use `hasCloseButton` instead. Ignored when `hasCloseButton` is set. */
|
|
19
|
-
closeButton?: boolean;
|
|
20
|
-
/** @deprecated Use `hasCleanChatButton` instead. Ignored when `hasCleanChatButton` is set. */
|
|
21
|
-
cleanChatButton?: boolean;
|
|
22
|
-
/** Show the copy-message button on assistant messages. Defaults to true. */
|
|
23
|
-
hasCopyButton?: boolean;
|
|
24
|
-
/** @deprecated Use `hasCopyButton` instead. Ignored when `hasCopyButton` is set. */
|
|
25
|
-
hideCopyButton?: boolean;
|
|
26
|
-
collectUserFeedback?: boolean;
|
|
27
|
-
suggestedMessages?: boolean;
|
|
28
|
-
/** Quick-reply pill texts; the row renders nothing when empty. */
|
|
29
|
-
suggestedMessageTexts?: string[];
|
|
30
|
-
/** Rotating conic-gradient frame around the first suggestion pill, colored from the pill/user-bubble background. */
|
|
31
|
-
hasSuggestedMessageAura?: boolean;
|
|
32
|
-
/** Banner-style light streak flashing across the first suggestion pill at random intervals. */
|
|
33
|
-
hasSuggestedMessageShine?: boolean;
|
|
34
|
-
title?: string;
|
|
35
|
-
subtitle?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Play the popup-style panel entrance animation, defaulting to true — the
|
|
38
|
-
* embed widget's existing behavior. With false the interface renders as
|
|
39
|
-
* plain page content with no entrance; read-only transcript views (and
|
|
40
|
-
* server rendering) want this.
|
|
41
|
-
*/
|
|
42
|
-
hasIntroAnimation?: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Mark the widget as running against a test (non-live) agent: a yellow/black
|
|
45
|
-
* caution stripe is drawn down the widget's left edge so a test session can
|
|
46
|
-
* never be mistaken for the production one.
|
|
47
|
-
*/
|
|
48
|
-
isTestMode?: boolean;
|
|
49
|
-
onSendMessage?: (message: MessageData) => Promise<void>;
|
|
50
|
-
onMessageClick?: (message: MessageData) => void;
|
|
51
|
-
onClose?: () => void;
|
|
52
|
-
onCleanChat?: () => void;
|
|
53
|
-
isChatClosed?: boolean;
|
|
54
|
-
onStartNewChat?: () => void;
|
|
55
|
-
onRateChat?: (rating: number) => void;
|
|
56
|
-
}
|
|
57
|
-
export declare function ChatInterface(props: ChatInterfaceProps): import("react").JSX.Element;
|
|
1
|
+
export { ChatInterface } from './chat-interface';
|
|
2
|
+
export type { ChatInterfaceProps } from './types';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ThemeContextType } from '../../contexts/theme.context';
|
|
2
|
+
import { Message, MessageData } from '../../types/message';
|
|
3
|
+
export interface ChatInterfaceProps {
|
|
4
|
+
displayWelcomeMessages?: boolean;
|
|
5
|
+
theme?: Partial<ThemeContextType>;
|
|
6
|
+
isOpen?: boolean;
|
|
7
|
+
isMobile?: boolean;
|
|
8
|
+
/** Current on-screen keyboard overlap (px), used to lift the input above it. */
|
|
9
|
+
keyboardInset?: number;
|
|
10
|
+
messages?: Message[];
|
|
11
|
+
assistantName?: string;
|
|
12
|
+
assistantLogo?: string;
|
|
13
|
+
legalText?: string;
|
|
14
|
+
/** Show the close (X) button in the chat header. Defaults to true. */
|
|
15
|
+
hasCloseButton?: boolean;
|
|
16
|
+
/** Show the clear-conversation button in the chat header. Defaults to true. */
|
|
17
|
+
hasCleanChatButton?: boolean;
|
|
18
|
+
/** @deprecated Use `hasCloseButton` instead. Ignored when `hasCloseButton` is set. */
|
|
19
|
+
closeButton?: boolean;
|
|
20
|
+
/** @deprecated Use `hasCleanChatButton` instead. Ignored when `hasCleanChatButton` is set. */
|
|
21
|
+
cleanChatButton?: boolean;
|
|
22
|
+
/** Show the copy-message button on assistant messages. Defaults to true. */
|
|
23
|
+
hasCopyButton?: boolean;
|
|
24
|
+
/** @deprecated Use `hasCopyButton` instead. Ignored when `hasCopyButton` is set. */
|
|
25
|
+
hideCopyButton?: boolean;
|
|
26
|
+
collectUserFeedback?: boolean;
|
|
27
|
+
suggestedMessages?: boolean;
|
|
28
|
+
/** Quick-reply pill texts; the row renders nothing when empty. */
|
|
29
|
+
suggestedMessageTexts?: string[];
|
|
30
|
+
/** Rotating conic-gradient frame around the first suggestion pill, colored from the pill/user-bubble background. */
|
|
31
|
+
hasSuggestedMessageAura?: boolean;
|
|
32
|
+
/** Banner-style light streak flashing across the first suggestion pill at random intervals. */
|
|
33
|
+
hasSuggestedMessageShine?: boolean;
|
|
34
|
+
title?: string;
|
|
35
|
+
subtitle?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Play the popup-style panel entrance animation, defaulting to true — the
|
|
38
|
+
* embed widget's existing behavior. With false the interface renders as
|
|
39
|
+
* plain page content with no entrance; read-only transcript views (and
|
|
40
|
+
* server rendering) want this.
|
|
41
|
+
*/
|
|
42
|
+
hasIntroAnimation?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Mark the widget as running against a test (non-live) agent: a yellow/black
|
|
45
|
+
* caution stripe is drawn down the widget's left edge so a test session can
|
|
46
|
+
* never be mistaken for the production one.
|
|
47
|
+
*/
|
|
48
|
+
isTestMode?: boolean;
|
|
49
|
+
onSendMessage?: (message: MessageData) => Promise<void>;
|
|
50
|
+
onMessageClick?: (message: MessageData) => void;
|
|
51
|
+
onClose?: () => void;
|
|
52
|
+
onCleanChat?: () => void;
|
|
53
|
+
isChatClosed?: boolean;
|
|
54
|
+
onStartNewChat?: () => void;
|
|
55
|
+
onRateChat?: (rating: number) => void;
|
|
56
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Chat, ChatProps } from './chat';
|
|
2
|
-
import { renderChat } from './render-chat';
|
|
2
|
+
import { renderChat } from './embed/render-chat';
|
|
3
3
|
import { ChatInterface, ChatInterfaceProps } from './chat-interface';
|
|
4
|
-
import { useRealtimeSocket, UseRealtimeSocketOptions, UseRealtimeSocketReturn } from './chat/realtime-socket
|
|
4
|
+
import { useRealtimeSocket, UseRealtimeSocketOptions, UseRealtimeSocketReturn } from './chat/hooks/use-realtime-socket';
|
|
5
5
|
import { ChatResponse } from './chat/validations';
|
|
6
6
|
import { BootResponse, MessageResponse } from '../lib/eloquent-ai-api-client';
|
|
7
7
|
export { Chat, type ChatProps, ChatInterface, type ChatInterfaceProps, renderChat, useRealtimeSocket, type UseRealtimeSocketOptions, type UseRealtimeSocketReturn, type ChatResponse, type BootResponse, type MessageResponse, };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { UseAgentCognitionReturn } from '
|
|
1
|
+
import { UseAgentCognitionReturn } from './use-agent-cognition';
|
|
2
2
|
export declare const AgentCognitionContext: import('react').Context<UseAgentCognitionReturn | null>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './components';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './types/message';
|