@smartspace/chat-ui 1.13.1-pr.249.63aeeb3 → 1.13.1-pr.250.fae775f

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 CHANGED
@@ -1019,6 +1019,23 @@ declare function unmarkDraftThreadId(threadId: string): void;
1019
1019
  declare function isDraftThreadId(threadId?: string | null): boolean;
1020
1020
  declare function createDraftThreadId(): string;
1021
1021
 
1022
+ /**
1023
+ * Treat an API date string as UTC even when it lacks a trailing "Z".
1024
+ * If already a Date, returns it as-is (Date stores UTC internally).
1025
+ */
1026
+ declare function utcDate(value: string | Date): Date;
1027
+ /**
1028
+ * Zod schema that coerces a Date, ISO string, or numeric timestamp
1029
+ * from the API into a Date object, ensuring timezone-less strings
1030
+ * are treated as UTC.
1031
+ */
1032
+ declare const DateFromApi: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodCoercedDate<unknown>>;
1033
+
1034
+ declare function parseDateTime(date: Date | string, customFormat?: string): string;
1035
+ declare function parseDateTimeHuman(date: Date | string): string;
1036
+
1037
+ declare function getUserPhotoUrl(userId: string | null | undefined): string | undefined;
1038
+
1022
1039
  declare const messagesKeys: {
1023
1040
  all: readonly ["messages"];
1024
1041
  lists: () => readonly ["messages", "list"];
@@ -1305,4 +1322,4 @@ declare function useModels({ search, take, skip, }?: {
1305
1322
  total: number;
1306
1323
  }, Error>;
1307
1324
 
1308
- export { type ChatContextIds, type ChatIdentity, ChatProvider, type ChatProviderProps, type ChatService, ChatVariablesForm, DRAFT_THREAD_PREFIX, type FileInfo$1 as FileInfo, type FileScope, type FlowRunVariables, MarkdownEditor, type MarkdownEditorHandle, type MentionUser, type Message, MessageComposer, type MessageComposerProps, type MessageContentItem, type MessageError, MessageList, type MessageListProps, MessageListSkeleton, MessageMarkdown, type MessageThread, type MessageValue, MessageValueType, type Model, type ModelProperty, NEW_THREAD_ID, THREAD_LIST_PAGE_SIZE, type ThreadsResponse, type Variables, type Workspace, applyDeltaToMessage, applyThreadToCache, createDraftThreadId, createThreadId, downloadFileBlobOptions, filesKeys, flowRunsKeys, getModelIcon, getThreadPlaceholderFromListCache, invalidateWorkspaceThreadLists, isDraftThreadId, mapFileInfoDtoToModel, mapMentionUserDtoToModel, mapMessageDtoToModel, mapMessageErrorDtoToModel, mapMessageValueDtoToModel, mapMessagesDtoToModels, mapSignalRThreadSummaryToModel, mapThreadDtoToModel, mapThreadsResponseDtoToModel, mapWorkspaceDtoToModel, mapWorkspacesDtoToModels, markDraftThreadId, messagesKeys, messagesListOptions, messagesMutationsKeys, modelsKeys, setThreadOptimisticRunning, setThreadRunningInLists, taggableUsersOptions, threadDetailOptions, threadsKeys, unmarkDraftThreadId, useAddInputToMessage, useChatContext, useChatIdentity, useChatService, useDownloadFileBlobQuery, useFileMutations, useFlowRunVariables, useMessages, useModels, useSendMessage, useTaggableWorkspaceUsers, useThread, useThreadIsRunning, useUpdateFlowRunVariable, useWorkspace, workspaceDetailOptions, workspaceKeys };
1325
+ 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, MessageList, type MessageListProps, MessageListSkeleton, MessageMarkdown, type MessageThread, type MessageValue, MessageValueType, type Model, type ModelProperty, NEW_THREAD_ID, THREAD_LIST_PAGE_SIZE, type ThreadsResponse, type Variables, type Workspace, applyDeltaToMessage, applyThreadToCache, createDraftThreadId, createThreadId, downloadFileBlobOptions, filesKeys, flowRunsKeys, getModelIcon, getThreadPlaceholderFromListCache, getUserPhotoUrl, invalidateWorkspaceThreadLists, isDraftThreadId, mapFileInfoDtoToModel, mapMentionUserDtoToModel, mapMessageDtoToModel, mapMessageErrorDtoToModel, mapMessageValueDtoToModel, mapMessagesDtoToModels, mapSignalRThreadSummaryToModel, mapThreadDtoToModel, mapThreadsResponseDtoToModel, mapWorkspaceDtoToModel, mapWorkspacesDtoToModels, markDraftThreadId, messagesKeys, messagesListOptions, messagesMutationsKeys, modelsKeys, parseDateTime, parseDateTimeHuman, setThreadOptimisticRunning, setThreadRunningInLists, taggableUsersOptions, threadDetailOptions, threadsKeys, unmarkDraftThreadId, useAddInputToMessage, useChatContext, useChatIdentity, useChatService, useDownloadFileBlobQuery, useFileMutations, useFlowRunVariables, useMessages, useModels, useSendMessage, useTaggableWorkspaceUsers, useThread, useThreadIsRunning, useUpdateFlowRunVariable, useWorkspace, utcDate, workspaceDetailOptions, workspaceKeys };
package/dist/index.js CHANGED
@@ -3310,7 +3310,7 @@ function utcDate(value) {
3310
3310
  }
3311
3311
  return new Date(value);
3312
3312
  }
3313
- z.preprocess((val) => {
3313
+ var DateFromApi = z.preprocess((val) => {
3314
3314
  if (typeof val === "string" && !hasTimezone(val)) {
3315
3315
  return val + "Z";
3316
3316
  }
@@ -3459,10 +3459,10 @@ function useSendMessage() {
3459
3459
  if (!threadId) throw new Error("Thread ID is required");
3460
3460
  if (!workspaceId) throw new Error("Workspace ID is required");
3461
3461
  const optimistic = {
3462
- id: `temp-${crypto.randomUUID()}`,
3462
+ id: `temp-${Date.now()}`,
3463
3463
  values: [
3464
3464
  {
3465
- id: `temp-${crypto.randomUUID()}-prompt`,
3465
+ id: `temp-${Date.now()}-prompt`,
3466
3466
  type: "Input" /* INPUT */,
3467
3467
  name: "prompt",
3468
3468
  value: contentList,
@@ -3473,7 +3473,7 @@ function useSendMessage() {
3473
3473
  },
3474
3474
  ...files?.length ? [
3475
3475
  {
3476
- id: `temp-${crypto.randomUUID()}-files`,
3476
+ id: `temp-${Date.now()}-files`,
3477
3477
  type: "Input" /* INPUT */,
3478
3478
  name: "files",
3479
3479
  value: files,
@@ -3485,7 +3485,7 @@ function useSendMessage() {
3485
3485
  ] : [],
3486
3486
  ...variables && Object.keys(variables).length ? [
3487
3487
  {
3488
- id: `temp-${crypto.randomUUID()}-vars`,
3488
+ id: `temp-${Date.now()}-vars`,
3489
3489
  type: "Input" /* INPUT */,
3490
3490
  name: "variables",
3491
3491
  value: variables,
@@ -3627,10 +3627,7 @@ var workspaceDetailOptions = ({
3627
3627
  });
3628
3628
  function useWorkspace(workspaceId) {
3629
3629
  const service = useChatService();
3630
- return useQuery({
3631
- ...workspaceDetailOptions({ service, workspaceId }),
3632
- enabled: !!workspaceId
3633
- });
3630
+ return useQuery(workspaceDetailOptions({ service, workspaceId }));
3634
3631
  }
3635
3632
  var taggableUsersOptions = ({
3636
3633
  service,
@@ -19086,14 +19083,20 @@ dayjs.extend(relativeTime);
19086
19083
  dayjs.extend(advancedFormat);
19087
19084
  function parseDateTime(date, customFormat) {
19088
19085
  const d = dayjs.utc(date).local();
19089
- return d.format(customFormat);
19086
+ if (customFormat === "X") return Math.floor(d.valueOf() / 1e3).toString();
19087
+ if (customFormat === "x") return d.valueOf().toString();
19088
+ return d.format(customFormat ?? "YYYY-MM-DD HH:mm:ss");
19089
+ }
19090
+ function parseDateTimeHuman(date) {
19091
+ return dayjs.utc(date).local().fromNow();
19090
19092
  }
19091
19093
 
19092
19094
  // src/shared/utils/userPhoto.ts
19093
19095
  function getChatApiBaseUrl() {
19094
19096
  try {
19095
19097
  const w = window;
19096
- const cfg = w?.ssconfig?.Chat_Api_Uri ?? import.meta.env.VITE_CHAT_API_URI;
19098
+ const env2 = import.meta.env;
19099
+ const cfg = w?.ssconfig?.Chat_Api_Uri ?? env2?.VITE_CHAT_API_URI;
19097
19100
  return typeof cfg === "string" && cfg.trim() ? cfg.trim() : "";
19098
19101
  } catch {
19099
19102
  return "";
@@ -20146,6 +20149,6 @@ function mapWorkspaceDtoToModel(dto) {
20146
20149
  }
20147
20150
  var mapWorkspacesDtoToModels = (arr) => arr.map(mapWorkspaceDtoToModel);
20148
20151
 
20149
- export { ChatProvider, ChatVariablesForm, DRAFT_THREAD_PREFIX, MarkdownEditor, MessageComposer, MessageList, MessageListSkeleton, MessageMarkdown, MessageValueType, NEW_THREAD_ID, THREAD_LIST_PAGE_SIZE, applyDeltaToMessage, applyThreadToCache, createDraftThreadId, createThreadId, downloadFileBlobOptions, filesKeys, flowRunsKeys, getModelIcon, getThreadPlaceholderFromListCache, invalidateWorkspaceThreadLists, isDraftThreadId, mapFileInfoDtoToModel, mapMentionUserDtoToModel, mapMessageDtoToModel, mapMessageErrorDtoToModel, mapMessageValueDtoToModel, mapMessagesDtoToModels, mapSignalRThreadSummaryToModel, mapThreadDtoToModel, mapThreadsResponseDtoToModel, mapWorkspaceDtoToModel, mapWorkspacesDtoToModels, markDraftThreadId, messagesKeys, messagesListOptions, messagesMutationsKeys, modelsKeys, setThreadOptimisticRunning, setThreadRunningInLists, taggableUsersOptions, threadDetailOptions, threadsKeys, unmarkDraftThreadId, useAddInputToMessage, useChatContext, useChatIdentity, useChatService, useDownloadFileBlobQuery, useFileMutations, useFlowRunVariables, useMessages, useModels, useSendMessage, useTaggableWorkspaceUsers, useThread, useThreadIsRunning, useUpdateFlowRunVariable, useWorkspace, workspaceDetailOptions, workspaceKeys };
20152
+ 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, getModelIcon, getThreadPlaceholderFromListCache, getUserPhotoUrl, invalidateWorkspaceThreadLists, isDraftThreadId, mapFileInfoDtoToModel, mapMentionUserDtoToModel, mapMessageDtoToModel, mapMessageErrorDtoToModel, mapMessageValueDtoToModel, mapMessagesDtoToModels, mapSignalRThreadSummaryToModel, mapThreadDtoToModel, mapThreadsResponseDtoToModel, mapWorkspaceDtoToModel, mapWorkspacesDtoToModels, markDraftThreadId, messagesKeys, messagesListOptions, messagesMutationsKeys, modelsKeys, parseDateTime, parseDateTimeHuman, setThreadOptimisticRunning, setThreadRunningInLists, taggableUsersOptions, threadDetailOptions, threadsKeys, unmarkDraftThreadId, useAddInputToMessage, useChatContext, useChatIdentity, useChatService, useDownloadFileBlobQuery, useFileMutations, useFlowRunVariables, useMessages, useModels, useSendMessage, useTaggableWorkspaceUsers, useThread, useThreadIsRunning, useUpdateFlowRunVariable, useWorkspace, utcDate, workspaceDetailOptions, workspaceKeys };
20150
20153
  //# sourceMappingURL=index.js.map
20151
20154
  //# sourceMappingURL=index.js.map