@marketrix.ai/widget 3.8.473 → 3.8.475
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/blocks/WidgetFab.d.ts +1 -1
- package/dist/src/components/views/ChatView.d.ts +2 -2
- package/dist/src/context/sseReducer.d.ts +0 -6
- package/dist/src/hooks/useDragSnap.d.ts +2 -2
- package/dist/src/hooks/useScreenShare.d.ts +3 -3
- package/dist/src/index.d.ts +10 -4
- package/dist/src/services/ShowModeService.d.ts +1 -1
- package/dist/src/services/StorageService.d.ts +0 -1
- package/dist/src/services/StreamClient.d.ts +1 -0
- package/dist/src/types/index.d.ts +9 -14
- package/dist/src/utils/chat.d.ts +1 -2
- package/dist/src/utils/validation.d.ts +2 -0
- package/dist/widget.mjs +57 -58
- package/package.json +3 -2
- package/dist/widget.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { WidgetPosition } from '../../types';
|
|
3
3
|
interface WidgetFabProps {
|
|
4
|
-
|
|
4
|
+
onPositionCommit: (position: WidgetPosition) => void;
|
|
5
5
|
}
|
|
6
6
|
export declare const WidgetFab: React.FC<WidgetFabProps>;
|
|
7
7
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface ChatViewProps {
|
|
3
3
|
onScreenSharingChange: (isSharing: boolean) => void;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
startScreenShareRef: React.MutableRefObject<(() => void) | null>;
|
|
5
|
+
stopScreenShareRef: React.MutableRefObject<(() => void) | null>;
|
|
6
6
|
messageInputRef: React.RefObject<HTMLTextAreaElement | null>;
|
|
7
7
|
}
|
|
8
8
|
export declare const ChatView: React.FC<ChatViewProps>;
|
|
@@ -39,12 +39,6 @@ export declare function reduceTransportFailure(state: SseState, text: string): S
|
|
|
39
39
|
* into the gap where the api has no tab to push to. `reduceTransportFailure` cannot see that, since
|
|
40
40
|
* nothing told the transport it failed, so without this the bubble sits on "thinking" and the composer
|
|
41
41
|
* stays disabled forever.
|
|
42
|
-
*
|
|
43
|
-
* Only fires on a message that received ZERO signs of life — still `thinking` with no progress line
|
|
44
|
-
* and no streamed text. A `do`/`show` task that is genuinely still running has already advanced past
|
|
45
|
-
* this (a `tool/call` flips `placeholderState` or adds a line, a `chat/delta` adds a part) and must
|
|
46
|
-
* never be cut off just because it is taking a while; a task that never even started is what this
|
|
47
|
-
* catches.
|
|
48
42
|
*/
|
|
49
43
|
export declare function reduceStaleReply(state: SseState, messageId: string, text: string): SseState;
|
|
50
44
|
export declare function reduceSse(state: SseState, event: WidgetEvent, currentMode: InstructionType): ReduceResult;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { WidgetPosition } from '../types';
|
|
3
3
|
export interface UseDragSnapOptions {
|
|
4
4
|
position: WidgetPosition;
|
|
5
|
-
|
|
5
|
+
onPositionCommit: (position: WidgetPosition) => void;
|
|
6
6
|
isPreviewMode?: boolean;
|
|
7
7
|
wrapperRef: React.RefObject<HTMLDivElement | null>;
|
|
8
8
|
}
|
|
@@ -18,4 +18,4 @@ export interface UseDragSnapResult {
|
|
|
18
18
|
onPointerCancel: (event: React.PointerEvent<HTMLButtonElement>) => void;
|
|
19
19
|
suppressUntilRef: React.RefObject<number>;
|
|
20
20
|
}
|
|
21
|
-
export declare function useDragSnap({ position,
|
|
21
|
+
export declare function useDragSnap({ position, onPositionCommit, isPreviewMode, wrapperRef, }: UseDragSnapOptions): UseDragSnapResult;
|
|
@@ -7,8 +7,8 @@ export interface PendingMessage {
|
|
|
7
7
|
}
|
|
8
8
|
export interface UseScreenShareOptions {
|
|
9
9
|
onScreenSharingChange?: (isSharing: boolean) => void;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
startScreenShareRef?: React.MutableRefObject<(() => void) | null>;
|
|
11
|
+
stopScreenShareRef?: React.MutableRefObject<(() => void) | null>;
|
|
12
12
|
onAddMessage: (message: ChatMessage) => void;
|
|
13
13
|
onUpdateMessage: (messageId: string, updates: Partial<ChatMessage>) => void;
|
|
14
14
|
onRemoveMessage?: (messageId: string) => void;
|
|
@@ -26,4 +26,4 @@ export interface UseScreenShareReturn {
|
|
|
26
26
|
handleScreenAccessRequestDeny: () => void;
|
|
27
27
|
requestScreenAccess: (mode: InstructionType) => void;
|
|
28
28
|
}
|
|
29
|
-
export declare function useScreenShare({ onScreenSharingChange,
|
|
29
|
+
export declare function useScreenShare({ onScreenSharingChange, startScreenShareRef, stopScreenShareRef, onAddMessage, onUpdateMessage, onRemoveMessage, onSendMessage, pendingMessage, setPendingMessage, }: UseScreenShareOptions): UseScreenShareReturn;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -6,22 +6,28 @@ declare global {
|
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import type { AddWidgetConfig, MarketrixConfig, MarketrixWidgetProps } from './types';
|
|
9
|
+
import type { AddWidgetConfig, ClientOwnedConfig, MarketrixConfig, MarketrixWidgetProps } 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;
|
|
13
|
-
export declare const updateMarketrixConfig: (newConfig:
|
|
13
|
+
export declare const updateMarketrixConfig: (newConfig: ClientOwnedConfig & {
|
|
14
|
+
mtxId?: string;
|
|
15
|
+
mtxKey?: string;
|
|
16
|
+
}) => Promise<void>;
|
|
14
17
|
export { getCurrentConfig };
|
|
15
18
|
export declare const MarketrixWidget: React.FC<MarketrixWidgetProps>;
|
|
16
19
|
export declare const mountWidget: (config: AddWidgetConfig) => Promise<void>;
|
|
17
20
|
export type { InstructionType } from './sdk';
|
|
18
|
-
export type { AddWidgetConfig, ChatMessage, MarketrixConfig, MarketrixWidgetProps, WidgetState } from './types';
|
|
21
|
+
export type { AddWidgetConfig, ChatMessage, ClientOwnedConfig, MarketrixConfig, MarketrixWidgetProps, WidgetState, } from './types';
|
|
19
22
|
declare const _default: {
|
|
20
23
|
MarketrixWidget: React.FC<MarketrixWidgetProps>;
|
|
21
24
|
mountWidget: (config: AddWidgetConfig) => Promise<void>;
|
|
22
25
|
initWidget: (config: MarketrixConfig, container?: HTMLElement) => Promise<void>;
|
|
23
26
|
unmountWidget: () => void;
|
|
24
|
-
updateMarketrixConfig: (newConfig:
|
|
27
|
+
updateMarketrixConfig: (newConfig: ClientOwnedConfig & {
|
|
28
|
+
mtxId?: string;
|
|
29
|
+
mtxKey?: string;
|
|
30
|
+
}) => Promise<void>;
|
|
25
31
|
getCurrentConfig: () => MarketrixConfig | null;
|
|
26
32
|
};
|
|
27
33
|
export default _default;
|
|
@@ -28,7 +28,7 @@ export declare class ShowModeService {
|
|
|
28
28
|
private setupContinueButton;
|
|
29
29
|
/** checkElementInteractable's first test is `document.body.contains`, so this one watchdog also covers removal. */
|
|
30
30
|
private setupVisibilityMonitoring;
|
|
31
|
-
private
|
|
31
|
+
private failShowAction;
|
|
32
32
|
private escapeHtml;
|
|
33
33
|
}
|
|
34
34
|
export declare const showModeService: ShowModeService;
|
|
@@ -35,6 +35,7 @@ export declare class StreamClient {
|
|
|
35
35
|
* `registered` resets the counters, so without this reset the widget's Retry button had nothing it
|
|
36
36
|
* could do — which is why it was wired to plain dismiss. */
|
|
37
37
|
reconnectNow(): void;
|
|
38
|
+
ready(chatId: string): Promise<void>;
|
|
38
39
|
waitUntilRegistered(): Promise<void>;
|
|
39
40
|
connect(chatId: string): Promise<void>;
|
|
40
41
|
private consumeEvents;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import type { InstructionType, WidgetSettingsData } from '../sdk';
|
|
2
2
|
export type { InstructionType, WidgetSettingsData } from '../sdk';
|
|
3
|
-
export
|
|
4
|
-
mtxId?: string;
|
|
5
|
-
mtxKey?: string;
|
|
6
|
-
mtxApp?: number;
|
|
7
|
-
userId?: number;
|
|
3
|
+
export interface ClientOwnedConfig {
|
|
8
4
|
mtxApiHost?: string;
|
|
5
|
+
userId?: number;
|
|
9
6
|
widget_position_z_index?: number;
|
|
10
|
-
isPreviewMode?: boolean;
|
|
11
7
|
/** When false, widget initializes fully but UI is hidden. Default: true */
|
|
12
8
|
show_widget?: boolean;
|
|
13
9
|
/** When false, screen access requests are auto-denied and Share Screen button is hidden. Default: true */
|
|
14
10
|
use_screenshare?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type MarketrixConfig = Partial<WidgetSettingsData> & ClientOwnedConfig & {
|
|
13
|
+
mtxId?: string;
|
|
14
|
+
mtxKey?: string;
|
|
15
|
+
mtxApp?: number;
|
|
16
|
+
isPreviewMode?: boolean;
|
|
15
17
|
};
|
|
16
18
|
export interface ChatMessage {
|
|
17
19
|
id: string;
|
|
@@ -55,15 +57,8 @@ export type AddWidgetConfig = ({
|
|
|
55
57
|
settings?: never;
|
|
56
58
|
mtxId: string;
|
|
57
59
|
mtxKey: string;
|
|
58
|
-
}) & {
|
|
60
|
+
}) & ClientOwnedConfig & {
|
|
59
61
|
container?: HTMLElement;
|
|
60
|
-
mtxApiHost?: string;
|
|
61
|
-
userId?: number;
|
|
62
|
-
widget_position_z_index?: number;
|
|
63
|
-
/** When false, widget initializes fully but UI is hidden. Default: true */
|
|
64
|
-
show_widget?: boolean;
|
|
65
|
-
/** When false, screen access requests are auto-denied and Share Screen button is hidden. Default: true */
|
|
66
|
-
use_screenshare?: boolean;
|
|
67
62
|
};
|
|
68
63
|
export interface MarketrixWidgetProps {
|
|
69
64
|
settings: WidgetSettingsData;
|
package/dist/src/utils/chat.d.ts
CHANGED
|
@@ -15,6 +15,5 @@ export declare const WAIT_FOR_USER_TOOLS: Set<string>;
|
|
|
15
15
|
export declare function addProgressLine(message: ChatMessage, browserToolName: string, explanation: string): ChatMessage;
|
|
16
16
|
export declare const markProgressLineComplete: (message: ChatMessage, browserToolName: string) => ChatMessage;
|
|
17
17
|
export declare function markProgressLineFailed(message: ChatMessage, browserToolName: string, error: string): ChatMessage;
|
|
18
|
-
|
|
19
|
-
export declare const BROWSER_TOOLS: Map<string, string>;
|
|
18
|
+
export declare const TOOL_LABELS: Map<string, string>;
|
|
20
19
|
export declare const getFriendlyToolName: (browserToolName: string) => string;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import type { ZodError } from 'zod';
|
|
1
2
|
export declare function isHTMLElement(element: Element | null): element is HTMLElement;
|
|
2
3
|
export declare function isHTMLScriptElement(element: Element | null): element is HTMLScriptElement;
|
|
4
|
+
export declare const invalidSettingsMessage: (error: ZodError) => string;
|