@eloquentai/chat-sdk 0.33.10-dev → 0.33.12-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/README.md +1 -1
- package/dist/components/chat/chat.hook.d.ts +8 -1
- package/dist/components/chat/index.d.ts +8 -3
- package/dist/components/chat/validations.d.ts +61 -61
- package/dist/components/chat-interface/index.d.ts +8 -5
- package/dist/components/chat-interface/shared.d.ts +9 -0
- package/dist/components/chat-interface/suggested-messages.d.ts +6 -5
- package/dist/embed-loader.d.ts +35 -0
- package/dist/embed-loader.entry.d.ts +1 -0
- package/dist/hooks/use-debounce.d.ts +6 -0
- package/dist/hooks/use-latest-ref.d.ts +9 -0
- package/dist/hooks/use-typed-text.d.ts +1 -1
- package/dist/index-hFbiYJI3.js +4165 -0
- package/dist/index-hFbiYJI3.js.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.mjs +1482 -6612
- package/dist/index.mjs.map +1 -1
- package/dist/lib/appsync-events-client.d.ts +71 -0
- package/dist/lib/config.d.ts +0 -15
- package/dist/{index-BDRYeCzO.js → skeleton-D9bMRvrB.js} +2392 -2637
- package/dist/skeleton-D9bMRvrB.js.map +1 -0
- package/dist/ui.mjs +7 -7
- package/package.json +6 -11
- package/dist/components/logo-animated.d.ts +0 -6
- package/dist/config-dHSmhpBm.js +0 -36
- package/dist/config-dHSmhpBm.js.map +0 -1
- package/dist/hooks/useTypewriter.d.ts +0 -1
- package/dist/index-BDRYeCzO.js.map +0 -1
- package/dist/index-DZkoAai8.js +0 -18793
- package/dist/index-DZkoAai8.js.map +0 -1
- package/dist/logo-animated-C9IKnbYd.js +0 -7413
- package/dist/logo-animated-C9IKnbYd.js.map +0 -1
package/README.md
CHANGED
|
@@ -121,7 +121,7 @@ Passed via the `chatProps` prop.
|
|
|
121
121
|
| `assistantName` | `string` | Name shown for the assistant in the chat header. |
|
|
122
122
|
| `assistantLogo` | `string` | URL of the logo shown for the assistant. |
|
|
123
123
|
| `legalText` | `string` | Legal/disclaimer text shown in the chat window. |
|
|
124
|
-
| `
|
|
124
|
+
| `hasCopyButton` | `boolean` | Show the "copy message" button on assistant messages. |
|
|
125
125
|
| `collectUserFeedback` | `boolean` | Enable thumbs up/down feedback on assistant messages. |
|
|
126
126
|
| `suggestedMessages` | `boolean` | Show suggested message chips to the user. |
|
|
127
127
|
| `title` | `string` | Title shown in the chat header. |
|
|
@@ -56,10 +56,17 @@ export interface UseChatReturn {
|
|
|
56
56
|
* @param options The hook parameters
|
|
57
57
|
* @returns The chat hook return type
|
|
58
58
|
*/
|
|
59
|
-
export declare function useChat({ environment, apiUrl, appId, userId: initialUserId, userName, userData, chatProps, isMobile: propIsMobile, isInitiallyOpen: propIsInitiallyOpen, hasCloseButton: propHasCloseButton, hasCleanChatButton: propHasCleanChatButton, initialOpen: deprecatedInitialOpen, closeButton: deprecatedCloseButton, cleanChatButton: deprecatedCleanChatButton, proactiveMessageHideDelay: propProactiveMessageHideDelay, isAlwaysOpen, }: Readonly<Partial<UseChatProps> & {
|
|
59
|
+
export declare function useChat({ environment, apiUrl, appId, userId: initialUserId, userName, userData, chatProps, isMobile: propIsMobile, isInitiallyOpen: propIsInitiallyOpen, hasCloseButton: propHasCloseButton, hasCleanChatButton: propHasCleanChatButton, initialOpen: deprecatedInitialOpen, closeButton: deprecatedCloseButton, cleanChatButton: deprecatedCleanChatButton, proactiveMessageHideDelay: propProactiveMessageHideDelay, isAlwaysOpen, hasCleanChatButtonOverride, }: Readonly<Partial<UseChatProps> & {
|
|
60
60
|
environment: "test" | "live";
|
|
61
61
|
apiUrl?: string;
|
|
62
62
|
appId: string;
|
|
63
|
+
/**
|
|
64
|
+
* Internal-only kill-switch (INTERNAL_ONLY_SHOW_CLEAN_CHAT_BUTTON): when
|
|
65
|
+
* set, wins over both the boot `chat_settings.clean_chat_button` and the
|
|
66
|
+
* `hasCleanChatButton` prop. Leave undefined for the normal boot ?? prop
|
|
67
|
+
* resolution.
|
|
68
|
+
*/
|
|
69
|
+
hasCleanChatButtonOverride?: boolean;
|
|
63
70
|
/**
|
|
64
71
|
* Embedded mode (INTERNAL_ONLY_CHAT_INTERFACE_ONLY): the interface is the
|
|
65
72
|
* page content and there is no launcher bubble to reopen a closed chat, so
|
|
@@ -4,13 +4,18 @@ import { UseChatProps } from './chat.hook';
|
|
|
4
4
|
type InternalChatProps = {
|
|
5
5
|
INTERNAL_ONLY_CHAT_INTERFACE_ONLY?: boolean;
|
|
6
6
|
INTERNAL_ONLY_BLOCK_STYLE?: boolean;
|
|
7
|
-
|
|
8
|
-
|
|
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;
|
|
9
15
|
INTERNAL_ONLY_ENVIRONMENT?: "test" | "live";
|
|
10
16
|
INTERNAL_ONLY_API_URL?: string;
|
|
11
17
|
INTERNAL_ONLY_FEATURE_MESSAGE_CLICK?: (message: Message) => void;
|
|
12
18
|
INTERNAL_ONLY_FEATURE_CLEAR_CHAT_CLICK?: () => void;
|
|
13
|
-
INTERNAL_ONLY_FEATURE_HIDE_COPY_BUTTON?: boolean;
|
|
14
19
|
};
|
|
15
20
|
export type ChatProps = UseChatProps & InternalChatProps;
|
|
16
21
|
export declare function Chat(props: Readonly<ChatProps>): import("react").JSX.Element;
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const chatResponseApiSchema: z.
|
|
3
|
-
message_id: z.
|
|
4
|
-
created_at: z.
|
|
5
|
-
data: z.
|
|
6
|
-
type: z.
|
|
7
|
-
content: z.
|
|
8
|
-
role: z.
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
export declare const chatResponseApiSchema: z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
3
|
+
message_id: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
4
|
+
created_at: z.ZodMiniString<string>;
|
|
5
|
+
data: z.ZodMiniObject<{
|
|
6
|
+
type: z.ZodMiniLiteral<"utterance">;
|
|
7
|
+
content: z.ZodMiniString<string>;
|
|
8
|
+
role: z.ZodMiniString<string>;
|
|
9
9
|
}, z.core.$strip>;
|
|
10
|
-
}, z.core.$strip>, z.
|
|
11
|
-
created_at: z.
|
|
12
|
-
data: z.
|
|
13
|
-
type: z.
|
|
14
|
-
code: z.
|
|
10
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
11
|
+
created_at: z.ZodMiniString<string>;
|
|
12
|
+
data: z.ZodMiniObject<{
|
|
13
|
+
type: z.ZodMiniLiteral<"error">;
|
|
14
|
+
code: z.ZodMiniString<string>;
|
|
15
15
|
}, z.core.$strip>;
|
|
16
|
-
}, z.core.$strip>, z.
|
|
17
|
-
created_at: z.
|
|
18
|
-
data: z.
|
|
19
|
-
type: z.
|
|
20
|
-
content: z.
|
|
16
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
17
|
+
created_at: z.ZodMiniString<string>;
|
|
18
|
+
data: z.ZodMiniObject<{
|
|
19
|
+
type: z.ZodMiniLiteral<"agent_cognition">;
|
|
20
|
+
content: z.ZodMiniString<string>;
|
|
21
21
|
}, z.core.$strip>;
|
|
22
|
-
}, z.core.$strip>, z.
|
|
23
|
-
created_at: z.
|
|
24
|
-
data: z.
|
|
25
|
-
type: z.
|
|
26
|
-
content: z.
|
|
22
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
23
|
+
created_at: z.ZodMiniString<string>;
|
|
24
|
+
data: z.ZodMiniObject<{
|
|
25
|
+
type: z.ZodMiniLiteral<"agent_captured_url">;
|
|
26
|
+
content: z.ZodMiniString<string>;
|
|
27
27
|
}, z.core.$strip>;
|
|
28
|
-
}, z.core.$strip>, z.
|
|
29
|
-
created_at: z.
|
|
30
|
-
data: z.
|
|
31
|
-
type: z.
|
|
32
|
-
content: z.
|
|
28
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
29
|
+
created_at: z.ZodMiniString<string>;
|
|
30
|
+
data: z.ZodMiniObject<{
|
|
31
|
+
type: z.ZodMiniLiteral<"agent_topic">;
|
|
32
|
+
content: z.ZodMiniString<string>;
|
|
33
33
|
}, z.core.$strip>;
|
|
34
|
-
}, z.core.$strip>, z.
|
|
35
|
-
created_at: z.
|
|
36
|
-
data: z.
|
|
37
|
-
type: z.
|
|
38
|
-
content: z.
|
|
34
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
35
|
+
created_at: z.ZodMiniString<string>;
|
|
36
|
+
data: z.ZodMiniObject<{
|
|
37
|
+
type: z.ZodMiniLiteral<"agent_summary">;
|
|
38
|
+
content: z.ZodMiniString<string>;
|
|
39
39
|
}, z.core.$strip>;
|
|
40
|
-
}, z.core.$strip>, z.
|
|
41
|
-
message_id: z.
|
|
42
|
-
created_at: z.
|
|
43
|
-
data: z.
|
|
44
|
-
type: z.
|
|
45
|
-
content: z.
|
|
40
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
41
|
+
message_id: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
42
|
+
created_at: z.ZodMiniString<string>;
|
|
43
|
+
data: z.ZodMiniObject<{
|
|
44
|
+
type: z.ZodMiniLiteral<"chat_closed_expired">;
|
|
45
|
+
content: z.ZodMiniString<string>;
|
|
46
46
|
}, z.core.$strip>;
|
|
47
|
-
}, z.core.$strip>, z.
|
|
48
|
-
created_at: z.
|
|
49
|
-
data: z.
|
|
50
|
-
type: z.
|
|
51
|
-
content: z.
|
|
47
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
48
|
+
created_at: z.ZodMiniString<string>;
|
|
49
|
+
data: z.ZodMiniObject<{
|
|
50
|
+
type: z.ZodMiniLiteral<"chat_rating">;
|
|
51
|
+
content: z.ZodMiniString<string>;
|
|
52
52
|
}, z.core.$strip>;
|
|
53
|
-
}, z.core.$strip>, z.
|
|
54
|
-
created_at: z.
|
|
55
|
-
data: z.
|
|
56
|
-
type: z.
|
|
57
|
-
content: z.
|
|
53
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
54
|
+
created_at: z.ZodMiniString<string>;
|
|
55
|
+
data: z.ZodMiniObject<{
|
|
56
|
+
type: z.ZodMiniLiteral<"breadcrumb">;
|
|
57
|
+
content: z.ZodMiniString<string>;
|
|
58
58
|
}, z.core.$strip>;
|
|
59
|
-
}, z.core.$strip>, z.
|
|
60
|
-
message_id: z.
|
|
61
|
-
created_at: z.
|
|
62
|
-
data: z.
|
|
63
|
-
type: z.
|
|
64
|
-
content: z.
|
|
59
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
60
|
+
message_id: z.ZodMiniNullable<z.ZodMiniString<string>>;
|
|
61
|
+
created_at: z.ZodMiniString<string>;
|
|
62
|
+
data: z.ZodMiniObject<{
|
|
63
|
+
type: z.ZodMiniLiteral<"chat_escalated">;
|
|
64
|
+
content: z.ZodMiniNull;
|
|
65
65
|
}, z.core.$strip>;
|
|
66
66
|
}, z.core.$strip>]>;
|
|
67
67
|
export type ChatResponseApi = z.infer<typeof chatResponseApiSchema>;
|
|
@@ -103,12 +103,12 @@ export type AgentSummaryNotification = {
|
|
|
103
103
|
type: "agent_summary";
|
|
104
104
|
}>;
|
|
105
105
|
};
|
|
106
|
-
export declare const chatResponseSchema: z.
|
|
107
|
-
message_id: z.
|
|
108
|
-
response: z.
|
|
109
|
-
id: z.
|
|
110
|
-
type: z.
|
|
111
|
-
content: z.
|
|
106
|
+
export declare const chatResponseSchema: z.ZodMiniObject<{
|
|
107
|
+
message_id: z.ZodMiniString<string>;
|
|
108
|
+
response: z.ZodMiniObject<{
|
|
109
|
+
id: z.ZodMiniString<string>;
|
|
110
|
+
type: z.ZodMiniString<string>;
|
|
111
|
+
content: z.ZodMiniString<string>;
|
|
112
112
|
}, z.core.$strip>;
|
|
113
113
|
}, z.core.$strip>;
|
|
114
114
|
export type ChatResponse = z.infer<typeof chatResponseSchema>;
|
|
@@ -19,10 +19,13 @@ export interface ChatInterfaceProps {
|
|
|
19
19
|
closeButton?: boolean;
|
|
20
20
|
/** @deprecated Use `hasCleanChatButton` instead. Ignored when `hasCleanChatButton` is set. */
|
|
21
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. */
|
|
22
25
|
hideCopyButton?: boolean;
|
|
23
26
|
collectUserFeedback?: boolean;
|
|
24
27
|
suggestedMessages?: boolean;
|
|
25
|
-
/**
|
|
28
|
+
/** Quick-reply pill texts; the row renders nothing when empty. */
|
|
26
29
|
suggestedMessageTexts?: string[];
|
|
27
30
|
/** Rotating conic-gradient frame around the first suggestion pill, colored from the pill/user-bubble background. */
|
|
28
31
|
hasSuggestedMessageAura?: boolean;
|
|
@@ -31,10 +34,10 @@ export interface ChatInterfaceProps {
|
|
|
31
34
|
title?: string;
|
|
32
35
|
subtitle?: string;
|
|
33
36
|
/**
|
|
34
|
-
* Play the
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
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.
|
|
38
41
|
*/
|
|
39
42
|
hasIntroAnimation?: boolean;
|
|
40
43
|
/**
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Header row layout, shared between the real header and its loading skeleton
|
|
3
|
+
* so the skeleton cannot drift out of alignment with what it mimics.
|
|
4
|
+
*/
|
|
5
|
+
export declare const headerRowClassName = "eloq:p-4 eloq:flex eloq:flex-row eloq:items-center eloq:justify-between eloq:space-y-0";
|
|
6
|
+
/** Avatar + title cluster on the left side of the header row. */
|
|
7
|
+
export declare const headerTitleGroupClassName = "eloq:flex eloq:flex-row eloq:items-center eloq:space-x-3";
|
|
8
|
+
/** Secondary text beside a title (header subtitle, bubble assistant name). */
|
|
9
|
+
export declare const subtitleTextClassName = "eloq:text-xs eloq:text-gray-500 eloq:dark:text-muted-foreground";
|
|
1
10
|
export declare const cardContainerClassName: ({ isOpen, isMobile, skipAnimation, }: {
|
|
2
11
|
isOpen: boolean;
|
|
3
12
|
isMobile: boolean | undefined;
|
|
@@ -4,11 +4,12 @@ export interface SuggestedMessagesProps {
|
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* The quick-reply pill row shown above the composer. Renders nothing unless
|
|
7
|
-
* `suggestedMessages` is enabled in the chat-interface context
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* `suggestedMessages` is enabled in the chat-interface context AND
|
|
8
|
+
* `suggestedMessageTexts` is non-empty (there are no placeholder examples),
|
|
9
|
+
* and only until the conversation starts: the pills disappear the moment the
|
|
10
|
+
* user sends their first message (they reappear when the chat is cleared,
|
|
11
|
+
* since the message list resets). Clicking a pill only fills the composer —
|
|
12
|
+
* the pills stay until the message is actually sent. Two independently
|
|
12
13
|
* toggleable effects highlight the first (primary) pill:
|
|
13
14
|
* - `hasSuggestedMessageAura` — a rotating conic-gradient frame in a
|
|
14
15
|
* saturated/soft pair derived from the pill background (or the user-bubble
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const EMBED_MODULE_FILE_NAME = "index.embed.js";
|
|
2
|
+
export declare const EMBED_GLOBAL_NAME = "EloquentChatSDK";
|
|
3
|
+
type UnmountFunction = () => void;
|
|
4
|
+
type RenderChatFunction = (container: HTMLElement, props: Record<string, unknown>) => UnmountFunction;
|
|
5
|
+
/** The shape of the dynamically imported SDK module the loader hands off to. */
|
|
6
|
+
export type EmbedSdkModule = Record<string, unknown> & {
|
|
7
|
+
renderChat: RenderChatFunction;
|
|
8
|
+
};
|
|
9
|
+
export type EmbedSdkGlobal = Record<string, unknown> & {
|
|
10
|
+
renderChat: RenderChatFunction;
|
|
11
|
+
/** Resolves with the SDK module, or null when loading failed. */
|
|
12
|
+
ready: Promise<EmbedSdkModule | null>;
|
|
13
|
+
};
|
|
14
|
+
/** Resolves the ES module URL next to the loader's own script URL. */
|
|
15
|
+
export declare function resolveEmbedModuleUrl(loaderScriptUrl: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Finds the absolute URL of the loader's own <script> tag.
|
|
18
|
+
* `document.currentScript` is only populated during the initial synchronous
|
|
19
|
+
* evaluation, which is exactly when the loader runs; the tag scan is a
|
|
20
|
+
* fallback for exotic loading strategies (e.g. the snippet injected the tag
|
|
21
|
+
* without src-based execution order guarantees).
|
|
22
|
+
*/
|
|
23
|
+
export declare function findLoaderScriptUrl(documentReference: Document): string | null;
|
|
24
|
+
export type InstallEmbedLoaderOptions = {
|
|
25
|
+
globalObject: Record<string, unknown>;
|
|
26
|
+
documentReference: Document;
|
|
27
|
+
importModule: (moduleUrl: string) => Promise<EmbedSdkModule>;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Installs the queueing SDK global and kicks off the module import.
|
|
31
|
+
* Returns the module (or null on failure) — the same promise exposed as
|
|
32
|
+
* `window.EloquentChatSDK.ready`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function installEmbedLoader({ globalObject, documentReference, importModule, }: InstallEmbedLoaderOptions): Promise<EmbedSdkModule | null>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns `value` delayed by `delayMilliseconds`: the returned value only
|
|
3
|
+
* updates once the input has stayed unchanged for the full delay. Drop-in
|
|
4
|
+
* replacement for `useDebounce` from `@uidotdev/usehooks`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useDebounce<Type>(value: Type, delayMilliseconds: number): Type;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a ref that always holds the latest `value`, updated after every
|
|
3
|
+
* render. The "latest ref" pattern: long-lived closures (timers, socket
|
|
4
|
+
* subscriptions) read `ref.current` at call time instead of capturing a
|
|
5
|
+
* stale value, without needing the value in any dependency array.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useLatestRef<Type>(value: Type): {
|
|
8
|
+
readonly current: Type;
|
|
9
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Reveals `text` one character at a time, restarting whenever the text changes.
|
|
3
3
|
*
|
|
4
|
-
* Distinct from
|
|
4
|
+
* Distinct from message rendering, which reveals whole messages at once: cognition
|
|
5
5
|
* labels are a few words that replace each other, so typing them in is what
|
|
6
6
|
* makes the swap read as the agent moving on to the next step rather than the
|
|
7
7
|
* text glitching.
|