@eloquentai/chat-sdk 0.34.4-dev.3 → 0.35.0-dev.1
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/hooks/use-chat.d.ts +2 -2
- package/dist/components/chat/hooks/use-message-events.d.ts +2 -2
- package/dist/components/chat/message-mapping.d.ts +5 -8
- package/dist/components/chat/validations.d.ts +12 -0
- package/dist/components/chat-interface/attach-files-button.d.ts +2 -0
- package/dist/components/chat-interface/attachment-chips.d.ts +2 -0
- package/dist/components/chat-interface/message-bubble/message-attachments.d.ts +2 -0
- package/dist/components/chat-interface/types.d.ts +51 -2
- package/dist/components/chat-interface/use-composer-attachments.d.ts +2 -0
- package/dist/components/chat-interface/use-file-drop.d.ts +2 -0
- package/dist/constants.d.ts +6 -0
- package/dist/contexts/error-handling/error-context.d.ts +2 -3
- package/dist/index.css +1 -1
- package/dist/index.mjs +1638 -1487
- package/dist/index.mjs.map +1 -1
- package/dist/lib/attachments.d.ts +16 -0
- package/dist/lib/eloquent-ai-api-client.d.ts +10 -0
- package/dist/lib/http.d.ts +3 -1
- package/dist/{skeleton-Dn06SgHU.js → skeleton-BciF90eZ.js} +6139 -5527
- package/dist/skeleton-BciF90eZ.js.map +1 -0
- package/dist/types/message.d.ts +21 -0
- package/dist/ui.mjs +1 -1
- package/package.json +1 -1
- package/dist/skeleton-Dn06SgHU.js.map +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EloquentAiApiClient } from './eloquent-ai-api-client';
|
|
2
|
+
import { AttachmentFile, AttachmentMimeType, AttachmentSelection, Message, MessageAttachment } from '../types/message';
|
|
3
|
+
export declare class AttachmentUploadError extends Error {
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function toAttachmentUploadError(error: unknown, fileName: string): unknown;
|
|
7
|
+
export declare function selectAttachmentFiles(selectedFiles: AttachmentFile[], files: File[]): AttachmentSelection;
|
|
8
|
+
export declare function restoreAttachmentFiles(sentFiles: AttachmentFile[], currentFiles: AttachmentFile[]): AttachmentFile[];
|
|
9
|
+
export declare function getAttachmentSendError(error: unknown, sentFiles: AttachmentFile[]): string | null;
|
|
10
|
+
export declare function attachPreviewDisplayUrls(attachments: MessageAttachment[], attachmentFiles: AttachmentFile[]): MessageAttachment[];
|
|
11
|
+
export declare function signStoredAttachments(apiClient: Pick<EloquentAiApiClient, "getAttachmentUrls">, conversationId: string, messages: Message[]): Promise<Message[]>;
|
|
12
|
+
export declare function hasStoredAttachments(message: Message): boolean;
|
|
13
|
+
export declare function getAttachmentDisplayUrl(attachment: MessageAttachment): string | undefined;
|
|
14
|
+
export declare function revokeAttachmentDisplayUrls(messages: Message[]): void;
|
|
15
|
+
export declare function isImageAttachment(mimeType: AttachmentMimeType): boolean;
|
|
16
|
+
export declare function isStoredAttachmentUrl(url: string): boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MessageAttachment, AttachmentUrls } from '../types/message';
|
|
1
2
|
import { HttpClientConfig } from './http';
|
|
2
3
|
export interface ConversationApiResponse {
|
|
3
4
|
chat_id: string;
|
|
@@ -69,6 +70,8 @@ export interface BootResponse {
|
|
|
69
70
|
clean_chat_button?: boolean | null;
|
|
70
71
|
/** Auto-hide delay for the proactive message, in milliseconds. Always wins over the proactiveMessageHideDelay prop. */
|
|
71
72
|
proactive_message_hide_delay?: number | null;
|
|
73
|
+
/** Let users attach images and PDFs to their messages. Always wins over the hasAttachments prop. */
|
|
74
|
+
attachments_enabled?: boolean | null;
|
|
72
75
|
};
|
|
73
76
|
}
|
|
74
77
|
export declare class EloquentAiApiClient {
|
|
@@ -103,12 +106,19 @@ export declare class EloquentAiApiClient {
|
|
|
103
106
|
}): Promise<CreateConversationApiResponse>;
|
|
104
107
|
replyToConversation(options: {
|
|
105
108
|
text: string;
|
|
109
|
+
attachments?: MessageAttachment[];
|
|
106
110
|
conversationId: string;
|
|
107
111
|
userId: string;
|
|
108
112
|
deviceId: string;
|
|
109
113
|
userName?: string;
|
|
110
114
|
userData?: Record<string, string | number | boolean>;
|
|
111
115
|
}): Promise<ConversationApiResponse>;
|
|
116
|
+
uploadAttachment(options: {
|
|
117
|
+
conversationId: string;
|
|
118
|
+
file: File;
|
|
119
|
+
onProgress: (progress: number) => void;
|
|
120
|
+
}): Promise<MessageAttachment>;
|
|
121
|
+
getAttachmentUrls(conversationId: string, urls: string[]): Promise<AttachmentUrls>;
|
|
112
122
|
identifyUser(options: {
|
|
113
123
|
conversationId: string;
|
|
114
124
|
userId: string;
|
package/dist/lib/http.d.ts
CHANGED
|
@@ -13,17 +13,19 @@ export interface HttpClientConfig {
|
|
|
13
13
|
}
|
|
14
14
|
export declare class HttpClient {
|
|
15
15
|
private baseURL;
|
|
16
|
-
private
|
|
16
|
+
private appId;
|
|
17
17
|
private region;
|
|
18
18
|
private chatToken;
|
|
19
19
|
constructor(config: HttpClientConfig);
|
|
20
20
|
setRegion(region: string): void;
|
|
21
21
|
setChatToken(token: string | null): void;
|
|
22
22
|
getChatToken(): string | null;
|
|
23
|
+
private getAuthHeaders;
|
|
23
24
|
private request;
|
|
24
25
|
get<T>(url: string): Promise<T>;
|
|
25
26
|
post<T, D>(url: string, data: D): Promise<T>;
|
|
26
27
|
put<T, D>(url: string, data: D): Promise<T>;
|
|
28
|
+
upload(url: string, body: FormData, onProgress: (progress: number) => void): Promise<unknown>;
|
|
27
29
|
/**
|
|
28
30
|
* External GET request without default headers or credentials
|
|
29
31
|
* Used for cross-origin requests that don't need authentication
|