@marketrix.ai/widget 3.8.490 → 3.8.491
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/WidgetRoot.d.ts +2 -2
- package/dist/src/context/UIStateContext.d.ts +2 -1
- package/dist/src/hooks/useWidget.d.ts +2 -4
- package/dist/src/index.d.ts +2 -2
- package/dist/src/services/BrowserToolService.d.ts +2 -1
- package/dist/src/services/ChatService.d.ts +4 -12
- package/dist/src/services/StorageService.d.ts +4 -2
- package/dist/src/services/WidgetService.d.ts +2 -3
- package/dist/src/types/index.d.ts +3 -0
- package/dist/src/utils/bootstrap.d.ts +4 -4
- package/dist/src/utils/chat.d.ts +5 -0
- package/dist/widget.mjs +64 -64
- package/package.json +1 -1
- package/dist/src/services/ApiService.d.ts +0 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ValidWidgetConfig } from '../types';
|
|
3
3
|
interface WidgetRootProps {
|
|
4
|
-
config:
|
|
4
|
+
config: ValidWidgetConfig;
|
|
5
5
|
}
|
|
6
6
|
export declare const WidgetRoot: React.FC<WidgetRootProps>;
|
|
7
7
|
export {};
|
|
@@ -5,13 +5,14 @@ export interface UIState {
|
|
|
5
5
|
activeView: WidgetView;
|
|
6
6
|
currentMode: InstructionType;
|
|
7
7
|
error?: string;
|
|
8
|
+
errorRetryable?: boolean;
|
|
8
9
|
}
|
|
9
10
|
export interface UIStateActions {
|
|
10
11
|
setActiveView: (view: WidgetView) => void;
|
|
11
12
|
toggleWidget: () => void;
|
|
12
13
|
closeWidget: () => void;
|
|
13
14
|
setMode: (mode: InstructionType) => void;
|
|
14
|
-
setError: (error: string | undefined) => void;
|
|
15
|
+
setError: (error: string | undefined, retryable?: boolean) => void;
|
|
15
16
|
applyState: (payload: Partial<UIState>) => void;
|
|
16
17
|
}
|
|
17
18
|
interface UIStateContextType {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { WidgetRenderedSettings } from '../utils/validation';
|
|
3
|
-
export type ValidWidgetConfig = MarketrixConfig & Required<Pick<MarketrixConfig, keyof WidgetRenderedSettings>>;
|
|
1
|
+
import type { ValidWidgetConfig, WidgetState } from '../types';
|
|
4
2
|
/** Every setting resolved: API settings plus the position and script-tag overrides WidgetRoot layers on top. */
|
|
5
3
|
export declare const WidgetConfigContext: import("react").Context<ValidWidgetConfig | null>;
|
|
6
4
|
export declare const useWidgetConfig: () => ValidWidgetConfig;
|
|
@@ -20,7 +18,7 @@ export declare const useWidget: () => {
|
|
|
20
18
|
toggleWidget: () => void;
|
|
21
19
|
closeWidget: () => void;
|
|
22
20
|
setMode: (mode: import("..").InstructionType) => void;
|
|
23
|
-
setError: (error: string | undefined) => void;
|
|
21
|
+
setError: (error: string | undefined, retryable?: boolean) => void;
|
|
24
22
|
applyState: (payload: Partial<import("../context/UIStateContext").UIState>) => void;
|
|
25
23
|
};
|
|
26
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, MarketrixWidgetProps } from './types';
|
|
9
|
+
import type { AddWidgetConfig, ClientOwnedConfig, MarketrixConfig, MarketrixWidgetProps, 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;
|
|
@@ -28,6 +28,6 @@ declare const _default: {
|
|
|
28
28
|
mtxId?: string;
|
|
29
29
|
mtxKey?: string;
|
|
30
30
|
}) => Promise<void>;
|
|
31
|
-
getCurrentConfig: () =>
|
|
31
|
+
getCurrentConfig: () => ValidWidgetConfig | null;
|
|
32
32
|
};
|
|
33
33
|
export default _default;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { InstructionType } from '../types';
|
|
1
2
|
export interface TextData {
|
|
2
3
|
text: string;
|
|
3
4
|
}
|
|
@@ -23,7 +24,7 @@ export interface ToolExecutionResult<T = TextData> {
|
|
|
23
24
|
afterResponseAttempt?: () => void;
|
|
24
25
|
}
|
|
25
26
|
export declare class BrowserToolService {
|
|
26
|
-
executeTool(browserToolName: string, args: Record<string, unknown>, mode
|
|
27
|
+
executeTool(browserToolName: string, args: Record<string, unknown>, mode: InstructionType, explanation?: string): Promise<ToolExecutionResult<unknown>>;
|
|
27
28
|
private navigate;
|
|
28
29
|
private search;
|
|
29
30
|
private clickElement;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
persist(snapshot: ChatSnapshot): void;
|
|
6
|
-
}
|
|
7
|
-
export declare const chatService: ChatService;
|
|
8
|
-
export declare const createUserMessage: (content: string, mode?: InstructionType, idPrefix?: string) => ChatMessage;
|
|
9
|
-
export declare const createAgentMessage: (content: string) => ChatMessage;
|
|
10
|
-
export declare const createSystemMessage: (content: string, mode: InstructionType, sender: "user" | "agent", idPrefix: string) => ChatMessage;
|
|
11
|
-
export declare const createScreenAccessRequestMessage: (mode: InstructionType | undefined, pendingContent?: string) => ChatMessage;
|
|
12
|
-
export declare const createScreenshareMessage: (stream: MediaStream, mode?: InstructionType) => ChatMessage;
|
|
1
|
+
import { type InstructionType } from '../sdk';
|
|
2
|
+
import { type CredentialedConfig } from './StorageService';
|
|
3
|
+
/** The reply does not come back from here — it arrives asynchronously as a chat/response event on the stream. */
|
|
4
|
+
export declare function chatPost(config: CredentialedConfig, message: string, mode: InstructionType, requestId: string): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChatMessage, InstructionType, MarketrixConfig } from '../types';
|
|
1
|
+
import type { ChatMessage, InstructionType, MarketrixConfig, ValidWidgetConfig } from '../types';
|
|
2
2
|
export type StoredMessage = Omit<ChatMessage, 'videoStream' | 'timestamp'> & {
|
|
3
3
|
timestamp: string;
|
|
4
4
|
};
|
|
@@ -7,7 +7,7 @@ export interface ChatSnapshot {
|
|
|
7
7
|
currentMode: InstructionType;
|
|
8
8
|
isOpen: boolean;
|
|
9
9
|
}
|
|
10
|
-
export type CredentialedConfig =
|
|
10
|
+
export type CredentialedConfig = ValidWidgetConfig & {
|
|
11
11
|
mtxId: string;
|
|
12
12
|
mtxKey: string;
|
|
13
13
|
};
|
|
@@ -32,4 +32,6 @@ declare class StorageService {
|
|
|
32
32
|
setConfig(config: CredentialedConfig): void;
|
|
33
33
|
}
|
|
34
34
|
export declare const storageService: StorageService;
|
|
35
|
+
export declare function readChatSnapshot(): ChatSnapshot;
|
|
36
|
+
export declare function writeChatSnapshot(snapshot: ChatSnapshot): void;
|
|
35
37
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { MarketrixConfig } from '../types';
|
|
1
|
+
import type { MarketrixConfig, ValidWidgetConfig } from '../types';
|
|
3
2
|
import { type WidgetRenderedSettings } from '../utils/validation';
|
|
4
3
|
import type { CredentialedConfig } from './StorageService';
|
|
5
|
-
export declare function createConfigFromSettings(widgetSettings:
|
|
4
|
+
export declare function createConfigFromSettings(widgetSettings: WidgetRenderedSettings, baseConfig?: Partial<MarketrixConfig>): ValidWidgetConfig;
|
|
6
5
|
export declare function loadWidgetConfig(config: MarketrixConfig): Promise<CredentialedConfig>;
|
|
@@ -16,6 +16,8 @@ export type MarketrixConfig = Partial<WidgetRenderedSettings> & ClientOwnedConfi
|
|
|
16
16
|
mtxApp?: number;
|
|
17
17
|
isPreviewMode?: boolean;
|
|
18
18
|
};
|
|
19
|
+
/** A MarketrixConfig that has been through parseWidgetSettings — every rendered setting present. */
|
|
20
|
+
export type ValidWidgetConfig = MarketrixConfig & Required<Pick<MarketrixConfig, keyof WidgetRenderedSettings>>;
|
|
19
21
|
export interface ChatMessage {
|
|
20
22
|
id: string;
|
|
21
23
|
content: string;
|
|
@@ -51,6 +53,7 @@ export interface WidgetState {
|
|
|
51
53
|
messages: ChatMessage[];
|
|
52
54
|
currentMode: InstructionType;
|
|
53
55
|
error?: string;
|
|
56
|
+
errorRetryable?: boolean;
|
|
54
57
|
isTaskRunning: boolean;
|
|
55
58
|
activeView: WidgetView;
|
|
56
59
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type Root } from 'react-dom/client';
|
|
2
2
|
import type { NotificationTone } from '../design-system/component-tokens';
|
|
3
|
-
import type { MarketrixConfig } from '../types';
|
|
3
|
+
import type { MarketrixConfig, ValidWidgetConfig } from '../types';
|
|
4
4
|
export interface WidgetMount {
|
|
5
5
|
instance: Root;
|
|
6
|
-
config:
|
|
6
|
+
config: ValidWidgetConfig;
|
|
7
7
|
container: HTMLElement;
|
|
8
8
|
host: HTMLElement | undefined;
|
|
9
9
|
previewMode: boolean;
|
|
@@ -16,9 +16,9 @@ export declare const createWidgetContainer: (parentContainer?: HTMLElement) => {
|
|
|
16
16
|
shadowRoot: ShadowRoot;
|
|
17
17
|
mountEl: HTMLElement;
|
|
18
18
|
};
|
|
19
|
-
export declare const mountWidgetToContainer: (mountEl: HTMLElement, config:
|
|
19
|
+
export declare const mountWidgetToContainer: (mountEl: HTMLElement, config: ValidWidgetConfig, previewMode?: boolean) => Root;
|
|
20
20
|
export declare const isWidgetInitialized: () => boolean;
|
|
21
|
-
export declare const getCurrentConfig: () =>
|
|
21
|
+
export declare const getCurrentConfig: () => ValidWidgetConfig | null;
|
|
22
22
|
export declare const showHostPageNotice: (message: string, tone?: NotificationTone) => void;
|
|
23
23
|
export declare const hideHostPageNotice: () => void;
|
|
24
24
|
export declare const autoInitializeWidget: (initWidget: (config: MarketrixConfig) => Promise<void>) => void;
|
package/dist/src/utils/chat.d.ts
CHANGED
|
@@ -18,3 +18,8 @@ export declare const markProgressLineComplete: (message: ChatMessage, browserToo
|
|
|
18
18
|
export declare function markProgressLineFailed(message: ChatMessage, browserToolName: string, error: string): ChatMessage;
|
|
19
19
|
export declare const TOOL_LABELS: Map<string, string>;
|
|
20
20
|
export declare const getFriendlyToolName: (browserToolName: string) => string;
|
|
21
|
+
export declare const createUserMessage: (content: string, mode?: InstructionType, idPrefix?: string) => ChatMessage;
|
|
22
|
+
export declare const createAgentMessage: (content: string) => ChatMessage;
|
|
23
|
+
export declare const createSystemMessage: (content: string, mode: InstructionType, sender: "user" | "agent", idPrefix: string) => ChatMessage;
|
|
24
|
+
export declare const createScreenAccessRequestMessage: (mode: InstructionType | undefined, pendingContent?: string) => ChatMessage;
|
|
25
|
+
export declare const createScreenshareMessage: (stream: MediaStream, mode?: InstructionType) => ChatMessage;
|