@marketrix.ai/widget 3.8.491 → 3.8.493
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 +5 -5
- package/dist/src/components/chat/VideoStreamDisplay.d.ts +1 -1
- package/dist/src/context/UIStateContext.d.ts +1 -2
- package/dist/src/context/sseReducer.d.ts +1 -0
- package/dist/src/hooks/useWidget.d.ts +1 -1
- package/dist/src/index.d.ts +4 -4
- package/dist/src/services/BrowserToolService.d.ts +12 -4
- package/dist/src/types/index.d.ts +1 -2
- package/dist/src/utils/chat.d.ts +1 -4
- package/dist/widget.mjs +50 -50
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -131,7 +131,7 @@ import {
|
|
|
131
131
|
unmountWidget,
|
|
132
132
|
updateMarketrixConfig,
|
|
133
133
|
getCurrentConfig,
|
|
134
|
-
|
|
134
|
+
MarketrixWidgetPreview,
|
|
135
135
|
} from '@marketrix.ai/widget';
|
|
136
136
|
```
|
|
137
137
|
|
|
@@ -182,16 +182,16 @@ When recording is enabled, **every input value is masked** — recordings captur
|
|
|
182
182
|
|
|
183
183
|
Both the `mtx-` and rrweb's native `rr-` prefixes are honoured, so existing `rr-block` / `rr-mask` markup keeps working.
|
|
184
184
|
|
|
185
|
-
### `
|
|
185
|
+
### `MarketrixWidgetPreview` — React component
|
|
186
186
|
|
|
187
187
|
For previewing appearance inside a React app (e.g. a settings/configuration screen). Renders into its own Shadow DOM and makes no network calls.
|
|
188
188
|
|
|
189
189
|
```tsx
|
|
190
|
-
import {
|
|
190
|
+
import { MarketrixWidgetPreview } from '@marketrix.ai/widget';
|
|
191
191
|
|
|
192
192
|
function Preview() {
|
|
193
193
|
return (
|
|
194
|
-
<
|
|
194
|
+
<MarketrixWidgetPreview
|
|
195
195
|
settings={{ widget_enabled: true, widget_position: 'bottom_right' /* ...WidgetSettingsData */ }}
|
|
196
196
|
mtxApiHost='https://api.marketrix.ai'
|
|
197
197
|
/>
|
|
@@ -217,7 +217,7 @@ TypeScript types are bundled with the package:
|
|
|
217
217
|
|
|
218
218
|
- `MarketrixConfig` — full config for `initWidget` / `updateMarketrixConfig` (`mtxId`, `mtxKey`, `mtxApiHost`, `userId`, `show_widget`, `use_screenshare`, plus all widget appearance settings, optional).
|
|
219
219
|
- `AddWidgetConfig` — discriminated config for `mountWidget` (production / preview variants + common options).
|
|
220
|
-
- `
|
|
220
|
+
- `MarketrixWidgetPreviewProps` — props for the `MarketrixWidgetPreview` component.
|
|
221
221
|
- `ChatMessage`, `WidgetState`, `InstructionType` (`'tell' | 'show' | 'do'`).
|
|
222
222
|
|
|
223
223
|
---
|
|
@@ -5,14 +5,13 @@ export interface UIState {
|
|
|
5
5
|
activeView: WidgetView;
|
|
6
6
|
currentMode: InstructionType;
|
|
7
7
|
error?: string;
|
|
8
|
-
errorRetryable?: boolean;
|
|
9
8
|
}
|
|
10
9
|
export interface UIStateActions {
|
|
11
10
|
setActiveView: (view: WidgetView) => void;
|
|
12
11
|
toggleWidget: () => void;
|
|
13
12
|
closeWidget: () => void;
|
|
14
13
|
setMode: (mode: InstructionType) => void;
|
|
15
|
-
setError: (error: string | undefined
|
|
14
|
+
setError: (error: string | undefined) => void;
|
|
16
15
|
applyState: (payload: Partial<UIState>) => void;
|
|
17
16
|
}
|
|
18
17
|
interface UIStateContextType {
|
|
@@ -18,7 +18,7 @@ export declare const useWidget: () => {
|
|
|
18
18
|
toggleWidget: () => void;
|
|
19
19
|
closeWidget: () => void;
|
|
20
20
|
setMode: (mode: import("..").InstructionType) => void;
|
|
21
|
-
setError: (error: string | undefined
|
|
21
|
+
setError: (error: string | undefined) => void;
|
|
22
22
|
applyState: (payload: Partial<import("../context/UIStateContext").UIState>) => void;
|
|
23
23
|
};
|
|
24
24
|
};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare global {
|
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import type { AddWidgetConfig, ClientOwnedConfig, MarketrixConfig,
|
|
9
|
+
import type { AddWidgetConfig, ClientOwnedConfig, MarketrixConfig, MarketrixWidgetPreviewProps, ValidWidgetConfig } from './types';
|
|
10
10
|
import { getCurrentConfig } from './utils/bootstrap';
|
|
11
11
|
export declare const initWidget: (config: MarketrixConfig, container?: HTMLElement) => Promise<void>;
|
|
12
12
|
export declare const unmountWidget: () => void;
|
|
@@ -15,12 +15,12 @@ export declare const updateMarketrixConfig: (newConfig: ClientOwnedConfig & {
|
|
|
15
15
|
mtxKey?: string;
|
|
16
16
|
}) => Promise<void>;
|
|
17
17
|
export { getCurrentConfig };
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const MarketrixWidgetPreview: React.FC<MarketrixWidgetPreviewProps>;
|
|
19
19
|
export declare const mountWidget: (config: AddWidgetConfig) => Promise<void>;
|
|
20
20
|
export type { InstructionType } from './sdk';
|
|
21
|
-
export type { AddWidgetConfig, ChatMessage, ClientOwnedConfig, MarketrixConfig,
|
|
21
|
+
export type { AddWidgetConfig, ChatMessage, ClientOwnedConfig, MarketrixConfig, MarketrixWidgetPreviewProps, WidgetState, } from './types';
|
|
22
22
|
declare const _default: {
|
|
23
|
-
|
|
23
|
+
MarketrixWidgetPreview: React.FC<MarketrixWidgetPreviewProps>;
|
|
24
24
|
mountWidget: (config: AddWidgetConfig) => Promise<void>;
|
|
25
25
|
initWidget: (config: MarketrixConfig, container?: HTMLElement) => Promise<void>;
|
|
26
26
|
unmountWidget: () => void;
|
|
@@ -17,13 +17,20 @@ export interface DropdownOptionsData {
|
|
|
17
17
|
text: string;
|
|
18
18
|
}>;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
success:
|
|
20
|
+
type ToolFailure = {
|
|
21
|
+
success: false;
|
|
22
|
+
error: string;
|
|
23
|
+
};
|
|
24
|
+
export type ToolExecutionResult<T = TextData> = {
|
|
25
|
+
success: true;
|
|
22
26
|
data: T;
|
|
23
|
-
error?: string;
|
|
24
27
|
afterResponseAttempt?: () => void;
|
|
25
|
-
}
|
|
28
|
+
} | ToolFailure;
|
|
29
|
+
export declare const FINISH_TOOL = "finish";
|
|
26
30
|
export declare class BrowserToolService {
|
|
31
|
+
private readonly tools;
|
|
32
|
+
getFriendlyToolName(browserToolName: string): string;
|
|
33
|
+
isWaitForUserTool(browserToolName: string): boolean;
|
|
27
34
|
executeTool(browserToolName: string, args: Record<string, unknown>, mode: InstructionType, explanation?: string): Promise<ToolExecutionResult<unknown>>;
|
|
28
35
|
private navigate;
|
|
29
36
|
private search;
|
|
@@ -48,3 +55,4 @@ export declare class BrowserToolService {
|
|
|
48
55
|
private getScreenshot;
|
|
49
56
|
}
|
|
50
57
|
export declare const browserToolService: BrowserToolService;
|
|
58
|
+
export {};
|
|
@@ -53,7 +53,6 @@ export interface WidgetState {
|
|
|
53
53
|
messages: ChatMessage[];
|
|
54
54
|
currentMode: InstructionType;
|
|
55
55
|
error?: string;
|
|
56
|
-
errorRetryable?: boolean;
|
|
57
56
|
isTaskRunning: boolean;
|
|
58
57
|
activeView: WidgetView;
|
|
59
58
|
}
|
|
@@ -69,7 +68,7 @@ export type AddWidgetConfig = ({
|
|
|
69
68
|
}) & ClientOwnedConfig & {
|
|
70
69
|
container?: HTMLElement;
|
|
71
70
|
};
|
|
72
|
-
export interface
|
|
71
|
+
export interface MarketrixWidgetPreviewProps {
|
|
73
72
|
settings: WidgetSettingsData;
|
|
74
73
|
container?: HTMLElement;
|
|
75
74
|
}
|
package/dist/src/utils/chat.d.ts
CHANGED
|
@@ -12,14 +12,11 @@ export declare function findMessageForProgress({ messages, isTaskRunning, curren
|
|
|
12
12
|
index: number;
|
|
13
13
|
message: ChatMessage;
|
|
14
14
|
} | null;
|
|
15
|
-
export declare const WAIT_FOR_USER_TOOLS: Set<string>;
|
|
16
15
|
export declare function addProgressLine(message: ChatMessage, browserToolName: string, explanation: string): ChatMessage;
|
|
17
16
|
export declare const markProgressLineComplete: (message: ChatMessage, browserToolName: string) => ChatMessage;
|
|
18
17
|
export declare function markProgressLineFailed(message: ChatMessage, browserToolName: string, error: string): ChatMessage;
|
|
19
|
-
export declare const TOOL_LABELS: Map<string, string>;
|
|
20
|
-
export declare const getFriendlyToolName: (browserToolName: string) => string;
|
|
21
18
|
export declare const createUserMessage: (content: string, mode?: InstructionType, idPrefix?: string) => ChatMessage;
|
|
22
19
|
export declare const createAgentMessage: (content: string) => ChatMessage;
|
|
23
|
-
export declare const createSystemMessage: (content: string,
|
|
20
|
+
export declare const createSystemMessage: (content: string, idPrefix: string) => ChatMessage;
|
|
24
21
|
export declare const createScreenAccessRequestMessage: (mode: InstructionType | undefined, pendingContent?: string) => ChatMessage;
|
|
25
22
|
export declare const createScreenshareMessage: (stream: MediaStream, mode?: InstructionType) => ChatMessage;
|