@smartspace/chat-ui 1.14.4-main.aaa3b2d → 1.14.4-main.eb2d6ff
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/index.d.ts +10 -1
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1092,6 +1092,15 @@ declare const DRAFT_THREAD_PREFIX = "draft-";
|
|
|
1092
1092
|
declare function markDraftThreadId(threadId: string): void;
|
|
1093
1093
|
declare function unmarkDraftThreadId(threadId: string): void;
|
|
1094
1094
|
declare function isDraftThreadId(threadId?: string | null): boolean;
|
|
1095
|
+
/**
|
|
1096
|
+
* Reactive equivalent of isDraftThreadId() -- re-renders the caller when
|
|
1097
|
+
* markDraftThreadId/unmarkDraftThreadId changes this threadId's status, even
|
|
1098
|
+
* if that happens from an unrelated component (e.g. the thread list noticing
|
|
1099
|
+
* a draft is now server-backed). Use this in any component whose render
|
|
1100
|
+
* output depends on draft status; the plain function is fine for one-off
|
|
1101
|
+
* checks inside event handlers or non-React code.
|
|
1102
|
+
*/
|
|
1103
|
+
declare function useIsDraftThreadId(threadId?: string | null): boolean;
|
|
1095
1104
|
declare function createDraftThreadId(): string;
|
|
1096
1105
|
|
|
1097
1106
|
/**
|
|
@@ -1404,4 +1413,4 @@ declare function useModels({ search, take, skip, }?: {
|
|
|
1404
1413
|
total: number;
|
|
1405
1414
|
}, Error>;
|
|
1406
1415
|
|
|
1407
|
-
export { type ChatContextIds, type ChatIdentity, ChatProvider, type ChatProviderProps, type ChatService, ChatVariablesForm, DRAFT_THREAD_PREFIX, DateFromApi, type FileInfo$1 as FileInfo, type FileScope, type FlowRunVariables, MarkdownEditor, type MarkdownEditorHandle, type MentionUser, type Message, MessageComposer, type MessageComposerProps, type MessageContentItem, type MessageError, type MessageErrorLike, MessageList, type MessageListProps, MessageListSkeleton, MessageMarkdown, type MessageThread, type MessageValue, MessageValueType, type Model, type ModelProperty, NEW_THREAD_ID, type RetryStatus, THREAD_LIST_PAGE_SIZE, type ThreadsResponse, type Variables, type Workspace, applyDeltaToMessage, applyThreadToCache, createDraftThreadId, createThreadId, downloadFileBlobOptions, filesKeys, flowRunsKeys, getMessageErrorText, getModelIcon, getRetryStatusText, getThreadPlaceholderFromListCache, getUserPhotoUrl, invalidateWorkspaceThreadLists, isDraftThreadId, mapFileInfoDtoToModel, mapMentionUserDtoToModel, mapMessageDtoToModel, mapMessageErrorDtoToModel, mapMessageValueDtoToModel, mapMessagesDtoToModels, mapSignalRThreadSummaryToModel, mapThreadDtoToModel, mapThreadsResponseDtoToModel, mapWorkspaceDtoToModel, mapWorkspacesDtoToModels, markDraftThreadId, messagesKeys, messagesListOptions, messagesMutationsKeys, modelsKeys, parseDateTime, parseDateTimeHuman, parseRetryStatus, randomUUID, setThreadOptimisticRunning, setThreadRunningInLists, taggableUsersOptions, threadDetailOptions, threadsKeys, unmarkDraftThreadId, useAddInputToMessage, useChatContext, useChatIdentity, useChatService, useDownloadFileBlobQuery, useFileMutations, useFlowRunVariables, useMessages, useModels, useSendMessage, useTaggableWorkspaceUsers, useThread, useThreadIsRunning, useUpdateFlowRunVariable, useWorkspace, utcDate, workspaceDetailOptions, workspaceKeys };
|
|
1416
|
+
export { type ChatContextIds, type ChatIdentity, ChatProvider, type ChatProviderProps, type ChatService, ChatVariablesForm, DRAFT_THREAD_PREFIX, DateFromApi, type FileInfo$1 as FileInfo, type FileScope, type FlowRunVariables, MarkdownEditor, type MarkdownEditorHandle, type MentionUser, type Message, MessageComposer, type MessageComposerProps, type MessageContentItem, type MessageError, type MessageErrorLike, MessageList, type MessageListProps, MessageListSkeleton, MessageMarkdown, type MessageThread, type MessageValue, MessageValueType, type Model, type ModelProperty, NEW_THREAD_ID, type RetryStatus, THREAD_LIST_PAGE_SIZE, type ThreadsResponse, type Variables, type Workspace, applyDeltaToMessage, applyThreadToCache, createDraftThreadId, createThreadId, downloadFileBlobOptions, filesKeys, flowRunsKeys, getMessageErrorText, getModelIcon, getRetryStatusText, getThreadPlaceholderFromListCache, getUserPhotoUrl, invalidateWorkspaceThreadLists, isDraftThreadId, mapFileInfoDtoToModel, mapMentionUserDtoToModel, mapMessageDtoToModel, mapMessageErrorDtoToModel, mapMessageValueDtoToModel, mapMessagesDtoToModels, mapSignalRThreadSummaryToModel, mapThreadDtoToModel, mapThreadsResponseDtoToModel, mapWorkspaceDtoToModel, mapWorkspacesDtoToModels, markDraftThreadId, messagesKeys, messagesListOptions, messagesMutationsKeys, modelsKeys, parseDateTime, parseDateTimeHuman, parseRetryStatus, randomUUID, setThreadOptimisticRunning, setThreadRunningInLists, taggableUsersOptions, threadDetailOptions, threadsKeys, unmarkDraftThreadId, useAddInputToMessage, useChatContext, useChatIdentity, useChatService, useDownloadFileBlobQuery, useFileMutations, useFlowRunVariables, useIsDraftThreadId, useMessages, useModels, useSendMessage, useTaggableWorkspaceUsers, useThread, useThreadIsRunning, useUpdateFlowRunVariable, useWorkspace, utcDate, workspaceDetailOptions, workspaceKeys };
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import MuiButton from '@mui/material/Button';
|
|
|
2
2
|
import IconButton from '@mui/material/IconButton';
|
|
3
3
|
import { Loader2, Check, X, Paperclip, Square, ArrowBigUp, Minimize2, AlertTriangle, FileImage, FileVideo, FileAudio, FileArchive, FileCode, FileSpreadsheet, Presentation, FileText, ChevronUp, Download, Copy, Globe, ShieldAlert } from 'lucide-react';
|
|
4
4
|
import * as React9 from 'react';
|
|
5
|
-
import { createContext, forwardRef, useImperativeHandle, useRef, useState, useEffect, useMemo, useCallback, createElement, useContext } from 'react';
|
|
5
|
+
import { createContext, forwardRef, useImperativeHandle, useRef, useState, useEffect, useMemo, useCallback, createElement, useContext, useSyncExternalStore } from 'react';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
import { useQuery, queryOptions, useQueryClient, useMutation, skipToken } from '@tanstack/react-query';
|
|
@@ -220,8 +220,6 @@ var saveFile = (blob, fileName) => {
|
|
|
220
220
|
});
|
|
221
221
|
a.click();
|
|
222
222
|
};
|
|
223
|
-
|
|
224
|
-
// src/shared/utils/threadId.ts
|
|
225
223
|
var NEW_THREAD_ID = "__new__";
|
|
226
224
|
function createThreadId() {
|
|
227
225
|
const cryptoObj = globalThis?.crypto;
|
|
@@ -231,6 +229,16 @@ var DRAFT_THREAD_PREFIX = "draft-";
|
|
|
231
229
|
var DRAFT_THREAD_STORAGE_KEY = "ss:draftThreadIds";
|
|
232
230
|
var draftThreadIds = /* @__PURE__ */ new Set();
|
|
233
231
|
var hydratedFromStorage = false;
|
|
232
|
+
var draftThreadIdsListeners = /* @__PURE__ */ new Set();
|
|
233
|
+
function notifyDraftThreadIdsChanged() {
|
|
234
|
+
for (const listener2 of draftThreadIdsListeners) listener2();
|
|
235
|
+
}
|
|
236
|
+
function subscribeDraftThreadIdsChanged(listener2) {
|
|
237
|
+
draftThreadIdsListeners.add(listener2);
|
|
238
|
+
return () => {
|
|
239
|
+
draftThreadIdsListeners.delete(listener2);
|
|
240
|
+
};
|
|
241
|
+
}
|
|
234
242
|
function isBrowserStorageAvailable() {
|
|
235
243
|
try {
|
|
236
244
|
return typeof window !== "undefined" && !!window.sessionStorage;
|
|
@@ -268,12 +276,14 @@ function markDraftThreadId(threadId) {
|
|
|
268
276
|
hydrateFromStorageOnce();
|
|
269
277
|
draftThreadIds.add(threadId);
|
|
270
278
|
persistToStorage();
|
|
279
|
+
notifyDraftThreadIdsChanged();
|
|
271
280
|
}
|
|
272
281
|
function unmarkDraftThreadId(threadId) {
|
|
273
282
|
if (!threadId) return;
|
|
274
283
|
hydrateFromStorageOnce();
|
|
275
284
|
draftThreadIds.delete(threadId);
|
|
276
285
|
persistToStorage();
|
|
286
|
+
notifyDraftThreadIdsChanged();
|
|
277
287
|
}
|
|
278
288
|
function isDraftThreadId(threadId) {
|
|
279
289
|
if (!threadId) return false;
|
|
@@ -281,6 +291,12 @@ function isDraftThreadId(threadId) {
|
|
|
281
291
|
hydrateFromStorageOnce();
|
|
282
292
|
return draftThreadIds.has(threadId);
|
|
283
293
|
}
|
|
294
|
+
function useIsDraftThreadId(threadId) {
|
|
295
|
+
return useSyncExternalStore(
|
|
296
|
+
subscribeDraftThreadIdsChanged,
|
|
297
|
+
() => isDraftThreadId(threadId)
|
|
298
|
+
);
|
|
299
|
+
}
|
|
284
300
|
function createDraftThreadId() {
|
|
285
301
|
const cryptoObj = globalThis?.crypto;
|
|
286
302
|
return typeof cryptoObj?.randomUUID === "function" ? cryptoObj.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
@@ -20891,6 +20907,6 @@ function mapWorkspaceDtoToModel(dto) {
|
|
|
20891
20907
|
}
|
|
20892
20908
|
var mapWorkspacesDtoToModels = (arr) => arr.map(mapWorkspaceDtoToModel);
|
|
20893
20909
|
|
|
20894
|
-
export { ChatProvider, ChatVariablesForm, DRAFT_THREAD_PREFIX, DateFromApi, MarkdownEditor, MessageComposer, MessageList, MessageListSkeleton, MessageMarkdown, MessageValueType, NEW_THREAD_ID, THREAD_LIST_PAGE_SIZE, applyDeltaToMessage, applyThreadToCache, createDraftThreadId, createThreadId, downloadFileBlobOptions, filesKeys, flowRunsKeys, getMessageErrorText, getModelIcon, getRetryStatusText, getThreadPlaceholderFromListCache, getUserPhotoUrl, invalidateWorkspaceThreadLists, isDraftThreadId, mapFileInfoDtoToModel, mapMentionUserDtoToModel, mapMessageDtoToModel, mapMessageErrorDtoToModel, mapMessageValueDtoToModel, mapMessagesDtoToModels, mapSignalRThreadSummaryToModel, mapThreadDtoToModel, mapThreadsResponseDtoToModel, mapWorkspaceDtoToModel, mapWorkspacesDtoToModels, markDraftThreadId, messagesKeys, messagesListOptions, messagesMutationsKeys, modelsKeys, parseDateTime, parseDateTimeHuman, parseRetryStatus, randomUUID, setThreadOptimisticRunning, setThreadRunningInLists, taggableUsersOptions, threadDetailOptions, threadsKeys, unmarkDraftThreadId, useAddInputToMessage, useChatContext, useChatIdentity, useChatService, useDownloadFileBlobQuery, useFileMutations, useFlowRunVariables, useMessages, useModels, useSendMessage, useTaggableWorkspaceUsers, useThread, useThreadIsRunning, useUpdateFlowRunVariable, useWorkspace, utcDate, workspaceDetailOptions, workspaceKeys };
|
|
20910
|
+
export { ChatProvider, ChatVariablesForm, DRAFT_THREAD_PREFIX, DateFromApi, MarkdownEditor, MessageComposer, MessageList, MessageListSkeleton, MessageMarkdown, MessageValueType, NEW_THREAD_ID, THREAD_LIST_PAGE_SIZE, applyDeltaToMessage, applyThreadToCache, createDraftThreadId, createThreadId, downloadFileBlobOptions, filesKeys, flowRunsKeys, getMessageErrorText, getModelIcon, getRetryStatusText, getThreadPlaceholderFromListCache, getUserPhotoUrl, invalidateWorkspaceThreadLists, isDraftThreadId, mapFileInfoDtoToModel, mapMentionUserDtoToModel, mapMessageDtoToModel, mapMessageErrorDtoToModel, mapMessageValueDtoToModel, mapMessagesDtoToModels, mapSignalRThreadSummaryToModel, mapThreadDtoToModel, mapThreadsResponseDtoToModel, mapWorkspaceDtoToModel, mapWorkspacesDtoToModels, markDraftThreadId, messagesKeys, messagesListOptions, messagesMutationsKeys, modelsKeys, parseDateTime, parseDateTimeHuman, parseRetryStatus, randomUUID, setThreadOptimisticRunning, setThreadRunningInLists, taggableUsersOptions, threadDetailOptions, threadsKeys, unmarkDraftThreadId, useAddInputToMessage, useChatContext, useChatIdentity, useChatService, useDownloadFileBlobQuery, useFileMutations, useFlowRunVariables, useIsDraftThreadId, useMessages, useModels, useSendMessage, useTaggableWorkspaceUsers, useThread, useThreadIsRunning, useUpdateFlowRunVariable, useWorkspace, utcDate, workspaceDetailOptions, workspaceKeys };
|
|
20895
20911
|
//# sourceMappingURL=index.js.map
|
|
20896
20912
|
//# sourceMappingURL=index.js.map
|