@marketrix.ai/widget 3.8.490 → 3.8.492
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/WidgetRoot.d.ts +2 -2
- package/dist/src/components/chat/VideoStreamDisplay.d.ts +1 -1
- package/dist/src/context/sseReducer.d.ts +1 -0
- package/dist/src/hooks/useWidget.d.ts +1 -3
- package/dist/src/index.d.ts +5 -5
- package/dist/src/services/BrowserToolService.d.ts +10 -5
- 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 -1
- 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
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
|
---
|
|
@@ -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 {};
|
|
@@ -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;
|
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;
|
|
@@ -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
|
}
|
|
@@ -16,14 +17,17 @@ export interface DropdownOptionsData {
|
|
|
16
17
|
text: string;
|
|
17
18
|
}>;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
success:
|
|
20
|
+
type ToolFailure = {
|
|
21
|
+
success: false;
|
|
22
|
+
error: string;
|
|
23
|
+
};
|
|
24
|
+
export type ToolExecutionResult<T = TextData> = {
|
|
25
|
+
success: true;
|
|
21
26
|
data: T;
|
|
22
|
-
error?: string;
|
|
23
27
|
afterResponseAttempt?: () => void;
|
|
24
|
-
}
|
|
28
|
+
} | ToolFailure;
|
|
25
29
|
export declare class BrowserToolService {
|
|
26
|
-
executeTool(browserToolName: string, args: Record<string, unknown>, mode
|
|
30
|
+
executeTool(browserToolName: string, args: Record<string, unknown>, mode: InstructionType, explanation?: string): Promise<ToolExecutionResult<unknown>>;
|
|
27
31
|
private navigate;
|
|
28
32
|
private search;
|
|
29
33
|
private clickElement;
|
|
@@ -47,3 +51,4 @@ export declare class BrowserToolService {
|
|
|
47
51
|
private getScreenshot;
|
|
48
52
|
}
|
|
49
53
|
export declare const browserToolService: BrowserToolService;
|
|
54
|
+
export {};
|
|
@@ -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;
|
|
@@ -66,7 +68,7 @@ export type AddWidgetConfig = ({
|
|
|
66
68
|
}) & ClientOwnedConfig & {
|
|
67
69
|
container?: HTMLElement;
|
|
68
70
|
};
|
|
69
|
-
export interface
|
|
71
|
+
export interface MarketrixWidgetPreviewProps {
|
|
70
72
|
settings: WidgetSettingsData;
|
|
71
73
|
container?: HTMLElement;
|
|
72
74
|
}
|
|
@@ -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, idPrefix: string) => ChatMessage;
|
|
24
|
+
export declare const createScreenAccessRequestMessage: (mode: InstructionType | undefined, pendingContent?: string) => ChatMessage;
|
|
25
|
+
export declare const createScreenshareMessage: (stream: MediaStream, mode?: InstructionType) => ChatMessage;
|