@marketrix.ai/widget 3.8.485 → 3.8.486
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/navigation/ResizeHandle.d.ts +7 -0
- package/dist/src/context/ChatContext.d.ts +1 -1
- package/dist/src/context/sseReducer.d.ts +3 -1
- package/dist/src/hooks/useResize.d.ts +10 -25
- package/dist/src/hooks/useWidget.d.ts +1 -1
- package/dist/src/services/DomService.d.ts +1 -1
- package/dist/src/services/StreamClient.d.ts +1 -5
- package/dist/src/useSyncExternalStoreShim.d.ts +2 -0
- package/dist/src/utils/dom.d.ts +2 -1
- package/dist/src/utils/widgetPositioning.d.ts +8 -0
- package/dist/widget.mjs +65 -65
- package/package.json +1 -1
- package/dist/src/components/navigation/ResizeHandles.d.ts +0 -6
- package/dist/src/react19.d.ts +0 -2
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ResizeGrip } from '../../utils/widgetPositioning';
|
|
3
|
+
export interface ResizeHandleProps {
|
|
4
|
+
grip: ResizeGrip;
|
|
5
|
+
onMouseDown: (e: React.MouseEvent) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const ResizeHandle: React.FC<ResizeHandleProps>;
|
|
@@ -10,7 +10,7 @@ export interface ChatActions {
|
|
|
10
10
|
messageDispatch: (content: string, mode?: InstructionType, skipUserMessage?: boolean) => Promise<void>;
|
|
11
11
|
}
|
|
12
12
|
export interface TaskActions {
|
|
13
|
-
|
|
13
|
+
resetTask: () => void;
|
|
14
14
|
stopTask: () => Promise<void>;
|
|
15
15
|
}
|
|
16
16
|
interface ChatContextType {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { WidgetEvent } from '../sdk';
|
|
2
2
|
import { type ChatMessage, type InstructionType } from '../types';
|
|
3
|
+
export type TaskPhase = 'idle' | 'running' | 'stopped';
|
|
3
4
|
export interface TaskState {
|
|
4
|
-
|
|
5
|
+
phase: TaskPhase;
|
|
5
6
|
}
|
|
6
7
|
export interface SseState {
|
|
7
8
|
messages: ChatMessage[];
|
|
@@ -23,6 +24,7 @@ type ProgressStatus = 'in_progress' | 'completed' | 'failed';
|
|
|
23
24
|
export declare function reduceToolProgress(state: SseState, browserToolName: string, explanation: string, status: ProgressStatus, currentMode: InstructionType, error?: string): SseState;
|
|
24
25
|
export declare function reduceToolDone(state: SseState, currentMode: InstructionType): SseState;
|
|
25
26
|
export declare function reduceStop(state: SseState, currentMode: InstructionType): SseState;
|
|
27
|
+
export declare function reduceDispatch(state: SseState, placeholder: ChatMessage): SseState;
|
|
26
28
|
declare const TASK_STATUS: {
|
|
27
29
|
readonly completed: "done";
|
|
28
30
|
readonly failed: "failed";
|
|
@@ -1,29 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
readonly growX: -1;
|
|
4
|
-
readonly growY: -1;
|
|
5
|
-
readonly cursor: "nwse-resize";
|
|
6
|
-
};
|
|
7
|
-
readonly 'top-right': {
|
|
8
|
-
readonly growX: 1;
|
|
9
|
-
readonly growY: -1;
|
|
10
|
-
readonly cursor: "nesw-resize";
|
|
11
|
-
};
|
|
12
|
-
readonly 'bottom-left': {
|
|
13
|
-
readonly growX: -1;
|
|
14
|
-
readonly growY: 1;
|
|
15
|
-
readonly cursor: "nesw-resize";
|
|
16
|
-
};
|
|
17
|
-
readonly 'bottom-right': {
|
|
18
|
-
readonly growX: 1;
|
|
19
|
-
readonly growY: 1;
|
|
20
|
-
readonly cursor: "nwse-resize";
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export type ResizeCorner = keyof typeof RESIZE_CORNERS;
|
|
24
|
-
export declare function useResize(settingsWidth: string | undefined, settingsHeight: string | undefined, tenantScope: string, isPreviewMode: boolean): {
|
|
1
|
+
import type { WidgetPosition } from '../types';
|
|
2
|
+
export declare function useResize(settingsWidth: string | undefined, settingsHeight: string | undefined, position: WidgetPosition, tenantScope: string, isPreviewMode: boolean): {
|
|
25
3
|
widthPx: string;
|
|
26
4
|
heightPx: string;
|
|
27
|
-
|
|
5
|
+
grip: {
|
|
6
|
+
vertical: "top" | "bottom";
|
|
7
|
+
horizontal: "left" | "right";
|
|
8
|
+
growX: number;
|
|
9
|
+
growY: number;
|
|
10
|
+
cursor: string;
|
|
11
|
+
};
|
|
12
|
+
onResizeStart: (e: React.MouseEvent) => void;
|
|
28
13
|
containerRef: import("react").RefObject<HTMLDivElement | null>;
|
|
29
14
|
};
|
|
@@ -13,7 +13,7 @@ export declare const useWidget: () => {
|
|
|
13
13
|
setMessages: (messages: import("..").ChatMessage[]) => void;
|
|
14
14
|
clearMessages: () => void;
|
|
15
15
|
messageDispatch: (content: string, mode?: import("..").InstructionType, skipUserMessage?: boolean) => Promise<void>;
|
|
16
|
-
|
|
16
|
+
resetTask: () => void;
|
|
17
17
|
stopTask: () => Promise<void>;
|
|
18
18
|
setActiveView: (view: import("../types").WidgetView) => void;
|
|
19
19
|
toggleWidget: () => void;
|
|
@@ -7,7 +7,7 @@ export declare class DomService {
|
|
|
7
7
|
private elementToSequence;
|
|
8
8
|
private generateAnchoredSelector;
|
|
9
9
|
private staleReason;
|
|
10
|
-
private
|
|
10
|
+
private indexElements;
|
|
11
11
|
/** `data-id` is the whole contract: the agent parses the snapshot for `[data-id]` and reads nothing else off it. */
|
|
12
12
|
reindexAndSnapshot(): string;
|
|
13
13
|
getSequenceForElement(element: Element): number | undefined;
|
|
@@ -28,12 +28,7 @@ export declare class StreamClient {
|
|
|
28
28
|
removeCallbacks(callbacks: StreamClientCallbacks): void;
|
|
29
29
|
isConnected(): boolean;
|
|
30
30
|
private reconnectSuppressed;
|
|
31
|
-
/** Whether a user-driven retry can achieve anything: there is a chat to rejoin and nothing has
|
|
32
|
-
* suppressed reconnection. */
|
|
33
31
|
canReconnect(): boolean;
|
|
34
|
-
/** The user asked to retry. `scheduleReconnect` gives up permanently at `maxReconnectAttempts` and only
|
|
35
|
-
* `registered` resets the counters, so without this reset the widget's Retry button had nothing it
|
|
36
|
-
* could do — which is why it was wired to plain dismiss. */
|
|
37
32
|
reconnectNow(): void;
|
|
38
33
|
ready(chatId: string): Promise<void>;
|
|
39
34
|
waitUntilRegistered(): Promise<void>;
|
|
@@ -46,5 +41,6 @@ export declare class StreamClient {
|
|
|
46
41
|
private giveUp;
|
|
47
42
|
private handleMessage;
|
|
48
43
|
private scheduleReconnect;
|
|
44
|
+
private abortConnection;
|
|
49
45
|
private clearReconnectTimer;
|
|
50
46
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { useSyncExternalStore } from 'react';
|
|
2
|
+
export declare function useSyncExternalStoreWithSelector<Snapshot, Selection>(subscribe: (onStoreChange: () => void) => () => void, getSnapshot: () => Snapshot, getServerSnapshot: (() => Snapshot) | undefined, selector: (snapshot: Snapshot) => Selection, isEqual?: (previous: Selection, next: Selection) => boolean): Selection;
|
package/dist/src/utils/dom.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const WIDGET_SHADOW_HOST_CLASS = "marketrix-widget-container";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function disabledReason(el: Element): string | null;
|
|
3
|
+
export declare function isIndexable(el: Element | null): boolean;
|
|
@@ -15,6 +15,14 @@ export declare const getCorner: (position: WidgetPosition) => {
|
|
|
15
15
|
};
|
|
16
16
|
export declare const isWidgetPosition: (value: unknown) => value is WidgetPosition;
|
|
17
17
|
export declare const getPanelPositionStyle: (position: WidgetPosition) => React.CSSProperties;
|
|
18
|
+
export declare const getResizeGrip: (position: WidgetPosition) => {
|
|
19
|
+
vertical: "top" | "bottom";
|
|
20
|
+
horizontal: "left" | "right";
|
|
21
|
+
growX: number;
|
|
22
|
+
growY: number;
|
|
23
|
+
cursor: string;
|
|
24
|
+
};
|
|
25
|
+
export type ResizeGrip = ReturnType<typeof getResizeGrip>;
|
|
18
26
|
export declare const getAnchorTopLeft: (position: WidgetPosition, vw: number, vh: number, w: number, h: number) => {
|
|
19
27
|
x: number;
|
|
20
28
|
y: number;
|