@alxxsck/ai-assistant 2.5.0 → 2.6.0
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 +28 -5
- package/dist/{Avatar-6uy2g2IY.js → Avatar-DAuV3Kht.js} +1 -1
- package/dist/{ChatWidgetContent-D4MPuXVS.js → ChatWidgetContent-BGznb_xm.js} +2217 -1924
- package/dist/api/messages.api.d.ts +6 -5
- package/dist/bridge-ai-chat-widget.es.js +1 -1
- package/dist/domain/message/message.store.d.ts +14 -1
- package/dist/domain/tracking/LolaEventTracker.d.ts +11 -0
- package/dist/{index-lsZ3qmkK.js → index-DBlYyJlj.js} +3006 -2681
- package/dist/index.d.ts +5 -1
- package/dist/index.types.d.ts +2 -0
- package/dist/ui/components/ChatPaginationSkeleton.d.ts +2 -0
- package/dist/ui/hooks/useCursorPagination.d.ts +15 -0
- package/dist/ui/hooks/usePinnedAutoScroll.d.ts +2 -1
- package/dist/ui/hooks/usePrependScrollAnchor.d.ts +13 -0
- package/package.json +3 -1
|
@@ -2,19 +2,20 @@ import type { AppApi } from "@/App";
|
|
|
2
2
|
import type { WidgetConfig } from "@/index.types";
|
|
3
3
|
import { type ConversationData, type MessageData, type RawMessageData } from "./messages.api.types";
|
|
4
4
|
export declare const MAX_FETCH_MESSAGES = 100;
|
|
5
|
-
type
|
|
6
|
-
items:
|
|
5
|
+
export type CursorPage<T> = {
|
|
6
|
+
items: T[];
|
|
7
7
|
nextCursor: string | null;
|
|
8
8
|
};
|
|
9
|
+
type ConversationsResponse = CursorPage<ConversationData>;
|
|
9
10
|
export declare class ChatApiError extends Error {
|
|
10
11
|
readonly status: number;
|
|
11
12
|
constructor(status: number, message: string);
|
|
12
13
|
}
|
|
13
14
|
export declare const isConversationClosedError: (error: unknown) => boolean;
|
|
14
15
|
export declare const normalizeMessage: (message: RawMessageData, config: WidgetConfig) => MessageData;
|
|
15
|
-
export declare const listConversations: (config: WidgetConfig, api: AppApi) => Promise<ConversationsResponse>;
|
|
16
|
-
export declare const listConversationMessages: (config: WidgetConfig, api: AppApi, conversationId: string) => Promise<MessageData
|
|
16
|
+
export declare const listConversations: (config: WidgetConfig, api: AppApi, cursor?: string, signal?: AbortSignal) => Promise<ConversationsResponse>;
|
|
17
|
+
export declare const listConversationMessages: (config: WidgetConfig, api: AppApi, conversationId: string, cursor?: string, signal?: AbortSignal) => Promise<CursorPage<MessageData>>;
|
|
17
18
|
export declare const createConversation: (config: WidgetConfig, api: AppApi) => Promise<ConversationData>;
|
|
18
|
-
export declare const selectConversation: (config: WidgetConfig, api: AppApi, conversationId: string) => Promise<ConversationData>;
|
|
19
|
+
export declare const selectConversation: (config: WidgetConfig, api: AppApi, conversationId: string, signal?: AbortSignal) => Promise<ConversationData>;
|
|
19
20
|
export declare function sendMessage(config: WidgetConfig, api: AppApi, messageText: string, conversationId?: string, clientMessageId?: `${string}-${string}-${string}-${string}-${string}`): Promise<MessageData>;
|
|
20
21
|
export {};
|
|
@@ -21,8 +21,13 @@ export type MessageStore = {
|
|
|
21
21
|
currentThreadMessages: MessageData[];
|
|
22
22
|
messages: MessageData[];
|
|
23
23
|
conversations: ConversationData[];
|
|
24
|
+
conversationsNextCursor: string | null;
|
|
25
|
+
isLoadingMoreConversations: boolean;
|
|
24
26
|
threadIds: string[];
|
|
25
27
|
loadedThreadIds: Set<string>;
|
|
28
|
+
threadMessagesNextCursor: Map<string, string | null>;
|
|
29
|
+
loadingOlderThreadIds: Set<string>;
|
|
30
|
+
refreshingThreadIds: Set<string>;
|
|
26
31
|
threads: Map<string, MessageData[]>;
|
|
27
32
|
threadsPreviews: ThreadSummary[];
|
|
28
33
|
sendError: string | null;
|
|
@@ -54,16 +59,24 @@ export type MessageStoreActions = {
|
|
|
54
59
|
handleMessagesAgenticSteps: (message: AgenticStepsAppendedData) => void;
|
|
55
60
|
updateThreads: () => void;
|
|
56
61
|
fetchThreadMessages: (conversationId: string) => Promise<void>;
|
|
62
|
+
fetchOlderThreadMessages: (conversationId: string) => Promise<void>;
|
|
63
|
+
cancelThreadMessagesRequest: (conversationId: string) => void;
|
|
64
|
+
cancelConversationPagination: () => void;
|
|
57
65
|
setCurrentThreadMessages: (conversationId: string) => void;
|
|
58
66
|
sendServiceMessage: (message: string) => Promise<void>;
|
|
59
67
|
updateConfig: (config: WidgetConfig, api: AppApi) => void;
|
|
60
|
-
recoverMessages: () => Promise<void>;
|
|
68
|
+
recoverMessages: (preserveLoadedConversations?: boolean) => Promise<void>;
|
|
69
|
+
fetchMoreConversations: () => Promise<void>;
|
|
61
70
|
};
|
|
62
71
|
export declare const useMessageStore: import("zustand").UseBoundStore<import("zustand").StoreApi<MessageStore>>;
|
|
63
72
|
export declare const useSelectCurrentThreadId: () => string | undefined;
|
|
64
73
|
export declare const useSelectCurrentThreadMessages: () => MessageData[];
|
|
65
74
|
export declare const useSelectThreadsPreviews: () => ThreadSummary[];
|
|
75
|
+
export declare const useHasMoreConversations: () => boolean;
|
|
76
|
+
export declare const useIsLoadingMoreConversations: () => boolean;
|
|
66
77
|
export declare const useCurrentThreadId: () => string | undefined;
|
|
78
|
+
export declare const useCurrentThreadHasOlderMessages: () => boolean;
|
|
79
|
+
export declare const useIsLoadingOlderCurrentThread: () => boolean;
|
|
67
80
|
export declare const useLatestReadMessageDate: () => string | null;
|
|
68
81
|
export declare const useLatestMessageDate: () => string | null;
|
|
69
82
|
export declare const useSendError: () => string | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CustomerInteractionSession } from "@/types";
|
|
2
|
+
export type TrackEvent = {
|
|
3
|
+
event: string;
|
|
4
|
+
params?: Record<string, unknown>;
|
|
5
|
+
};
|
|
6
|
+
export declare class LolaEventTracker {
|
|
7
|
+
private readonly getSession;
|
|
8
|
+
private readonly onSessionExpired;
|
|
9
|
+
constructor(getSession: () => CustomerInteractionSession, onSessionExpired: () => void);
|
|
10
|
+
track(trackingEvent: TrackEvent): Promise<void>;
|
|
11
|
+
}
|