@magemetrics/ai 0.11.4 → 0.11.5
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/react/ai.js +11008 -10414
- package/dist/react/index.d.ts +56 -1
- package/dist/styles.css +1 -1
- package/dist/web-component/index.d.ts +1 -0
- package/dist/web-component/web-component.es.js +24352 -24109
- package/package.json +5 -14
package/dist/react/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { DirectAuthProvider } from '@magemetrics/core';
|
|
|
6
6
|
import { ExternalAuthProvider } from '@magemetrics/core';
|
|
7
7
|
import { ExternalAuthProviderConfig } from '@magemetrics/core';
|
|
8
8
|
import { FetchNextPageOptions } from '@tanstack/react-query';
|
|
9
|
+
import { FileUIPart } from 'ai';
|
|
9
10
|
import { ForwardRefExoticComponent } from 'react';
|
|
10
11
|
import { InfiniteData } from '@tanstack/react-query';
|
|
11
12
|
import { InfiniteQueryObserverResult } from '@tanstack/react-query';
|
|
@@ -92,6 +93,7 @@ declare interface ChatComponent extends default_2.MemoExoticComponent<(props: Ch
|
|
|
92
93
|
export declare interface ChatContextValue {
|
|
93
94
|
flowId: string | undefined | null;
|
|
94
95
|
enableSpeechToText?: boolean;
|
|
96
|
+
enableFileUpload?: boolean;
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
/**
|
|
@@ -142,9 +144,10 @@ export declare interface ChatInputContextValue {
|
|
|
142
144
|
isAwaitingUserAnswer: boolean;
|
|
143
145
|
onRetry?: () => void;
|
|
144
146
|
onStop?: () => void;
|
|
145
|
-
sendMessage: (text: string, isEditing: boolean) => void;
|
|
147
|
+
sendMessage: (text: string, isEditing: boolean, files?: FileUIPart[]) => void;
|
|
146
148
|
lastUserMessage?: string;
|
|
147
149
|
enableSpeechToText?: boolean;
|
|
150
|
+
enableFileUpload?: boolean;
|
|
148
151
|
}
|
|
149
152
|
|
|
150
153
|
declare const ChatInputDefault: default_2.FC;
|
|
@@ -152,6 +155,7 @@ declare const ChatInputDefault: default_2.FC;
|
|
|
152
155
|
declare interface ChatProps {
|
|
153
156
|
flowId: string | undefined | null;
|
|
154
157
|
enableSpeechToText?: boolean;
|
|
158
|
+
enableFileUpload?: boolean;
|
|
155
159
|
children?: default_2.ReactNode;
|
|
156
160
|
}
|
|
157
161
|
|
|
@@ -205,6 +209,7 @@ declare interface ConfigurableChatComponent extends default_2.FC<ConfigurableCha
|
|
|
205
209
|
declare type ConfigurableChatComponentProps = {
|
|
206
210
|
flowId: string | undefined | null;
|
|
207
211
|
enableSpeechToText?: boolean;
|
|
212
|
+
enableFileUpload?: boolean;
|
|
208
213
|
disableCanvas?: boolean;
|
|
209
214
|
children?: default_2.ReactNode;
|
|
210
215
|
/**
|
|
@@ -236,6 +241,7 @@ declare interface ConversationContentProps {
|
|
|
236
241
|
topBar?: React.ReactNode;
|
|
237
242
|
disableCanvas?: boolean;
|
|
238
243
|
enableSpeechToText?: boolean;
|
|
244
|
+
enableFileUpload?: boolean;
|
|
239
245
|
children?: React.ReactNode;
|
|
240
246
|
}
|
|
241
247
|
|
|
@@ -280,6 +286,51 @@ export { ExternalAuthProvider }
|
|
|
280
286
|
|
|
281
287
|
export { ExternalAuthProviderConfig }
|
|
282
288
|
|
|
289
|
+
export declare interface FileAttachment {
|
|
290
|
+
/** Unique ID for this attachment (for React keys and removal) */
|
|
291
|
+
id: string;
|
|
292
|
+
/** Original file name */
|
|
293
|
+
filename: string;
|
|
294
|
+
/** File size in bytes */
|
|
295
|
+
size: number;
|
|
296
|
+
/** The FileUIPart ready to be sent via sendMessage */
|
|
297
|
+
filePart: FileUIPart;
|
|
298
|
+
/** Validation error, if any */
|
|
299
|
+
error?: string;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export declare interface FileUploadConfig {
|
|
303
|
+
/** Maximum file size per file in bytes. Default: 10 * 1024 * 1024 (10 MB) */
|
|
304
|
+
maxFileSize?: number;
|
|
305
|
+
/** Maximum combined file size in bytes. Default: 20 * 1024 * 1024 (20 MB) */
|
|
306
|
+
maxCombinedSize?: number;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export declare interface FileUploadController {
|
|
310
|
+
/** Currently attached files (valid and invalid) */
|
|
311
|
+
attachments: FileAttachment[];
|
|
312
|
+
/** Whether all attachments are valid and ready to send */
|
|
313
|
+
isReady: boolean;
|
|
314
|
+
/** Whether any file is currently being read (FileReader in progress) */
|
|
315
|
+
isProcessing: boolean;
|
|
316
|
+
/** Total size of all valid attachments in bytes */
|
|
317
|
+
totalSize: number;
|
|
318
|
+
/** Combined size limit error, if total exceeds maxCombinedSize */
|
|
319
|
+
combinedSizeError?: string;
|
|
320
|
+
/** Add files from a FileList (e.g., from an input[type=file]) */
|
|
321
|
+
addFiles: (files: FileList) => void;
|
|
322
|
+
/** Remove a specific attachment by ID */
|
|
323
|
+
removeFile: (id: string) => void;
|
|
324
|
+
/** Clear all attachments */
|
|
325
|
+
clearFiles: () => void;
|
|
326
|
+
/** Get all valid FileUIParts for sendMessage */
|
|
327
|
+
getFileParts: () => FileUIPart[];
|
|
328
|
+
/** Open the native file picker (programmatic trigger) */
|
|
329
|
+
openFilePicker: () => void;
|
|
330
|
+
/** Ref to attach to a hidden file input element */
|
|
331
|
+
fileInputRef: React.RefObject<HTMLInputElement | null>;
|
|
332
|
+
}
|
|
333
|
+
|
|
283
334
|
/**
|
|
284
335
|
* This module handles the formatting and normalization of table cell values for display and sorting.
|
|
285
336
|
*
|
|
@@ -646,6 +697,8 @@ declare type StartOptions = DisplayControlProps & {
|
|
|
646
697
|
autoFocus?: boolean;
|
|
647
698
|
/** Whether speech-to-text controls should be shown */
|
|
648
699
|
enableSpeechToText?: boolean;
|
|
700
|
+
/** Whether file upload should be enabled in the chat input */
|
|
701
|
+
enableFileUpload?: boolean;
|
|
649
702
|
};
|
|
650
703
|
|
|
651
704
|
declare type TableFilters = Record<string, TableFilterValue>;
|
|
@@ -955,6 +1008,8 @@ export declare const useDownloadReportData: (options?: UseMutationOptions<Export
|
|
|
955
1008
|
mutateAsync: UseMutateAsyncFunction<ExportReportDataResult, Error, ExportReportDataParams, unknown>;
|
|
956
1009
|
};
|
|
957
1010
|
|
|
1011
|
+
export declare function useFileUpload(config?: FileUploadConfig): FileUploadController;
|
|
1012
|
+
|
|
958
1013
|
export declare const useMageMetricsApiUrl: () => string;
|
|
959
1014
|
|
|
960
1015
|
export declare const useMageMetricsClient: () => MageMetricsClient;
|