@marketrix.ai/widget 3.8.242 → 3.8.243
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/src/components/chat/TaskStatusIcon.d.ts +6 -0
- package/dist/src/components/navigation/MessengerShell.d.ts +1 -1
- package/dist/src/components/views/ChatView.d.ts +1 -1
- package/dist/src/context/ChatContext.d.ts +4 -4
- package/dist/src/context/sseReducer.d.ts +2 -2
- package/dist/src/hooks/useWidget.d.ts +2 -2
- package/dist/src/services/ApiService.d.ts +2 -2
- package/dist/src/services/ChatService.d.ts +2 -2
- package/dist/src/services/StorageService.d.ts +4 -4
- package/dist/src/types/index.d.ts +3 -14
- package/dist/src/utils/chat.d.ts +2 -2
- package/dist/widget.mjs +62 -62
- package/dist/widget.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/src/components/chat/SimulationStatusIcon.d.ts +0 -6
|
@@ -6,7 +6,7 @@ export interface MessengerShellProps {
|
|
|
6
6
|
isMinimized: boolean;
|
|
7
7
|
messages: ChatMessage[];
|
|
8
8
|
currentMode: InstructionType;
|
|
9
|
-
|
|
9
|
+
isTaskRunning?: boolean;
|
|
10
10
|
activeView: WidgetView;
|
|
11
11
|
onClose: () => void;
|
|
12
12
|
onSendMessage: (message: string, mode?: InstructionType, applicationId?: number, question?: string, skipUserMessage?: boolean) => void;
|
|
@@ -5,7 +5,7 @@ export interface ChatViewProps {
|
|
|
5
5
|
config: MarketrixConfig;
|
|
6
6
|
messages: ChatMessage[];
|
|
7
7
|
currentMode: InstructionType;
|
|
8
|
-
|
|
8
|
+
isTaskRunning?: boolean;
|
|
9
9
|
onSendMessage: (message: string, mode?: InstructionType, applicationId?: number, question?: string, skipUserMessage?: boolean) => void;
|
|
10
10
|
onSetMode: (mode: InstructionType) => void;
|
|
11
11
|
onAddMessage: (message: ChatMessage) => void;
|
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import type { ChatMessage, InstructionType } from '../types';
|
|
3
3
|
import type { UIStateActions } from './UIStateContext';
|
|
4
4
|
export interface SimulationState {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
activeTaskId: string | null;
|
|
6
|
+
isTaskRunning: boolean;
|
|
7
7
|
}
|
|
8
8
|
export interface ChatState {
|
|
9
9
|
messages: ChatMessage[];
|
|
@@ -18,8 +18,8 @@ export interface ChatActions {
|
|
|
18
18
|
}
|
|
19
19
|
export interface SimulationActions {
|
|
20
20
|
setTaskState: (payload: {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
activeTaskId: string | null;
|
|
22
|
+
isTaskRunning: boolean;
|
|
23
23
|
}) => void;
|
|
24
24
|
stopTask: () => Promise<void>;
|
|
25
25
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { WidgetEvent } from '../sdk';
|
|
2
2
|
import type { ChatMessage, InstructionType } from '../types';
|
|
3
3
|
export interface SseSimulationState {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
activeTaskId: string | null;
|
|
5
|
+
isTaskRunning: boolean;
|
|
6
6
|
}
|
|
7
7
|
export interface SseState {
|
|
8
8
|
messages: ChatMessage[];
|
|
@@ -13,8 +13,8 @@ interface UseWidgetActions {
|
|
|
13
13
|
setError: (error: string | undefined) => void;
|
|
14
14
|
clearError: () => void;
|
|
15
15
|
setTaskState: (payload: {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
activeTaskId: string | null;
|
|
17
|
+
isTaskRunning: boolean;
|
|
18
18
|
}) => void;
|
|
19
19
|
addMessage: (message: ChatMessage) => void;
|
|
20
20
|
updateMessage: (messageId: string, updates: Partial<ChatMessage>) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MarketrixConfig, MessageDispatchRequest
|
|
1
|
+
import type { MarketrixConfig, MessageDispatchRequest } from '../types';
|
|
2
2
|
export declare class ApiService {
|
|
3
3
|
private config;
|
|
4
4
|
constructor(config: MarketrixConfig);
|
|
@@ -7,6 +7,6 @@ export declare class ApiService {
|
|
|
7
7
|
private getUserId;
|
|
8
8
|
logWidgetQuestion(question: string, mode: string): Promise<void>;
|
|
9
9
|
/** Fire-and-forget send over the typed stream; the reply arrives asynchronously as a chat/response event. */
|
|
10
|
-
messageDispatch(request: MessageDispatchRequest): Promise<
|
|
10
|
+
messageDispatch(request: MessageDispatchRequest): Promise<void>;
|
|
11
11
|
updateConfig(newConfig: Partial<MarketrixConfig>): void;
|
|
12
12
|
}
|
|
@@ -2,8 +2,8 @@ import type { ChatMessage, InstructionType } from '../types';
|
|
|
2
2
|
/** Widget state persisted to / restored from localStorage; React context is the runtime source of truth. */
|
|
3
3
|
export interface ChatSnapshot {
|
|
4
4
|
messages: ChatMessage[];
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
isTaskRunning: boolean;
|
|
6
|
+
activeTaskId: string | null;
|
|
7
7
|
currentMode: InstructionType;
|
|
8
8
|
isOpen: boolean;
|
|
9
9
|
isMinimized: boolean;
|
|
@@ -13,8 +13,8 @@ type StoredMessage = Omit<ChatMessage, 'videoStream' | 'timestamp'> & {
|
|
|
13
13
|
export interface MarketrixChatContext {
|
|
14
14
|
chat_id: string | null;
|
|
15
15
|
messages: StoredMessage[];
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
isTaskRunning: boolean;
|
|
17
|
+
activeTaskId: string | null;
|
|
18
18
|
currentMode: InstructionType;
|
|
19
19
|
isOpen: boolean;
|
|
20
20
|
isMinimized: boolean;
|
|
@@ -39,8 +39,8 @@ declare class StorageService {
|
|
|
39
39
|
setChatId(chatId: string | null): void;
|
|
40
40
|
getMessages(): StoredMessage[];
|
|
41
41
|
setMessages(messages: StoredMessage[]): void;
|
|
42
|
-
getChatState(): Pick<MarketrixChatContext, '
|
|
43
|
-
setChatState(state: Partial<Pick<MarketrixChatContext, '
|
|
42
|
+
getChatState(): Pick<MarketrixChatContext, 'isTaskRunning' | 'activeTaskId' | 'currentMode' | 'isOpen' | 'isMinimized' | 'isLoading'>;
|
|
43
|
+
setChatState(state: Partial<Pick<MarketrixChatContext, 'isTaskRunning' | 'activeTaskId' | 'currentMode' | 'isOpen' | 'isMinimized' | 'isLoading'>>): void;
|
|
44
44
|
getConfig(): MarketrixConfig | null;
|
|
45
45
|
setConfig(config: MarketrixConfig | null): void;
|
|
46
46
|
clear(): void;
|
|
@@ -30,7 +30,7 @@ export interface ChatMessage {
|
|
|
30
30
|
isPlaceholder?: boolean;
|
|
31
31
|
placeholderState?: 'thinking' | 'waiting-for-user';
|
|
32
32
|
parts?: MessagePart[];
|
|
33
|
-
|
|
33
|
+
taskStatus?: 'ongoing' | 'done' | 'failed' | 'stopped';
|
|
34
34
|
}
|
|
35
35
|
export interface MessagePart {
|
|
36
36
|
type: 'text' | 'progress';
|
|
@@ -52,26 +52,15 @@ export interface WidgetState {
|
|
|
52
52
|
currentMode: InstructionType;
|
|
53
53
|
agentAvailable: boolean;
|
|
54
54
|
error?: string;
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
activeTaskId: string | null;
|
|
56
|
+
isTaskRunning: boolean;
|
|
57
57
|
activeView: WidgetView;
|
|
58
58
|
}
|
|
59
59
|
export interface MessageDispatchRequest {
|
|
60
60
|
message?: string;
|
|
61
61
|
mode?: InstructionType;
|
|
62
|
-
mtxId?: string;
|
|
63
|
-
mtxKey?: string;
|
|
64
|
-
application_id?: number;
|
|
65
|
-
question?: string;
|
|
66
62
|
requestId?: string;
|
|
67
63
|
}
|
|
68
|
-
export interface MessageDispatchResponse {
|
|
69
|
-
messageId: string;
|
|
70
|
-
response: string;
|
|
71
|
-
mode: InstructionType;
|
|
72
|
-
timestamp: Date;
|
|
73
|
-
task_id?: string;
|
|
74
|
-
}
|
|
75
64
|
export type WidgetPosition = WidgetSettingsData['widget_position'];
|
|
76
65
|
export type AddWidgetConfig = ({
|
|
77
66
|
settings: WidgetSettingsData;
|
package/dist/src/utils/chat.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare function hasThinkingMarker(content: string): boolean;
|
|
|
5
5
|
export declare function addThinkingMarker(content: string): string;
|
|
6
6
|
export interface FindMessageOptions {
|
|
7
7
|
messages: ChatMessage[];
|
|
8
|
-
|
|
8
|
+
isTaskRunning: boolean;
|
|
9
9
|
currentMode: InstructionType;
|
|
10
10
|
requireContent?: boolean;
|
|
11
11
|
}
|
|
@@ -17,6 +17,6 @@ export declare const WAIT_FOR_USER_TOOLS: Set<string>;
|
|
|
17
17
|
export declare function addProgressLine(message: ChatMessage, browserToolName: string, explanation: string): ChatMessage;
|
|
18
18
|
export declare function markProgressLineComplete(message: ChatMessage, browserToolName?: string): ChatMessage;
|
|
19
19
|
export declare function markProgressLineFailed(message: ChatMessage, browserToolName: string, error: string): ChatMessage;
|
|
20
|
-
export declare function updateThinkingMarker(message: ChatMessage,
|
|
20
|
+
export declare function updateThinkingMarker(message: ChatMessage, isTaskRunning: boolean, currentMode: 'show' | 'tell' | 'do', isWaitingForUser?: boolean): ChatMessage;
|
|
21
21
|
export declare const TOOL_NAME_MAPPING: Record<string, string>;
|
|
22
22
|
export declare function getFriendlyToolName(browserToolName: string): string;
|