@marketrix.ai/widget 3.8.457 → 3.8.459
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/base/IconButton.d.ts +1 -1
- package/dist/src/components/base/Surface.d.ts +2 -2
- package/dist/src/components/base/Text.d.ts +1 -3
- package/dist/src/components/base/layoutProps.d.ts +0 -11
- package/dist/src/components/blocks/NotificationToast.d.ts +2 -1
- package/dist/src/context/ChatContext.d.ts +0 -3
- package/dist/src/context/UIStateContext.d.ts +0 -1
- package/dist/src/context/sseReducer.d.ts +2 -0
- package/dist/src/design-system/component-tokens.d.ts +2 -2
- package/dist/src/design-system/semantic-tokens.d.ts +2 -13
- package/dist/src/hooks/useWidget.d.ts +0 -1
- package/dist/src/sdk/index.d.ts +2 -2
- package/dist/src/services/BrowserToolService.d.ts +0 -51
- package/dist/src/services/DomService.d.ts +1 -3
- package/dist/src/services/ShowModeService.d.ts +1 -2
- package/dist/src/services/StorageService.d.ts +2 -2
- package/dist/src/utils/bootstrap.d.ts +3 -5
- package/dist/src/utils/chat.d.ts +2 -8
- package/dist/src/utils/suggestedActions.d.ts +2 -2
- package/dist/widget.mjs +59 -63
- package/dist/widget.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/src/components/chat/ProgressLine.d.ts +0 -6
- package/dist/src/components/ui/WidgetSettingsLoader.d.ts +0 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef } from 'react';
|
|
2
2
|
import { type TextTone } from '../../design-system/component-tokens';
|
|
3
3
|
import type { ShadowToken } from '../../design-system/shadows';
|
|
4
|
-
type IconButtonVariant = 'primary' | 'secondary' | 'ghost'
|
|
4
|
+
type IconButtonVariant = 'primary' | 'secondary' | 'ghost';
|
|
5
5
|
type IconButtonSize = 'xs' | 'sm';
|
|
6
6
|
type IconButtonShape = 'circle' | 'theme';
|
|
7
7
|
export interface IconButtonProps extends ComponentPropsWithRef<'button'> {
|
|
@@ -2,8 +2,8 @@ import { type ElementType } from 'react';
|
|
|
2
2
|
import { type RadiusToken } from '../../design-system/component-tokens';
|
|
3
3
|
import type { ShadowToken } from '../../design-system/shadows';
|
|
4
4
|
import { type LayoutProps } from './layoutProps';
|
|
5
|
-
export type SurfaceBackground = 'default' | 'card'
|
|
6
|
-
export type SurfacePadding = 'none' | '
|
|
5
|
+
export type SurfaceBackground = 'default' | 'card';
|
|
6
|
+
export type SurfacePadding = 'none' | 'card' | 'toast';
|
|
7
7
|
export interface SurfaceProps extends LayoutProps, Omit<React.HTMLAttributes<HTMLElement>, 'className'> {
|
|
8
8
|
as?: ElementType;
|
|
9
9
|
background?: SurfaceBackground;
|
|
@@ -7,8 +7,6 @@ type TextAlign = 'center' | 'right';
|
|
|
7
7
|
export interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
8
8
|
as?: ElementType;
|
|
9
9
|
block?: boolean;
|
|
10
|
-
clamp?: 1 | 2 | 3;
|
|
11
|
-
code?: boolean;
|
|
12
10
|
inheritColor?: boolean;
|
|
13
11
|
italic?: boolean;
|
|
14
12
|
leading?: TextLeading;
|
|
@@ -22,5 +20,5 @@ export interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
22
20
|
className?: string;
|
|
23
21
|
ref?: Ref<HTMLElement>;
|
|
24
22
|
}
|
|
25
|
-
export declare function Text({ as: Component, block,
|
|
23
|
+
export declare function Text({ as: Component, block, inheritColor, italic, leading, tone, variant, size, weight, truncate, align, className, ref, style, ...props }: TextProps): import("react").JSX.Element;
|
|
26
24
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { CSSProperties, ElementType } from 'react';
|
|
2
|
-
import type { ShadowToken } from '../../design-system/shadows';
|
|
3
2
|
export type SpacingToken = 'none' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
4
3
|
export interface LayoutProps {
|
|
5
4
|
padding?: SpacingToken;
|
|
@@ -7,15 +6,9 @@ export interface LayoutProps {
|
|
|
7
6
|
paddingY?: SpacingToken;
|
|
8
7
|
paddingTop?: SpacingToken;
|
|
9
8
|
paddingBottom?: SpacingToken;
|
|
10
|
-
margin?: SpacingToken;
|
|
11
|
-
marginX?: SpacingToken;
|
|
12
|
-
marginY?: SpacingToken;
|
|
13
|
-
marginTop?: SpacingToken;
|
|
14
|
-
marginBottom?: SpacingToken;
|
|
15
9
|
gap?: SpacingToken;
|
|
16
10
|
align?: 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
17
11
|
justify?: 'start' | 'center' | 'end' | 'between' | 'around';
|
|
18
|
-
wrap?: boolean;
|
|
19
12
|
grow?: boolean;
|
|
20
13
|
shrink?: boolean;
|
|
21
14
|
position?: 'relative' | 'absolute' | 'fixed' | 'sticky';
|
|
@@ -25,12 +18,8 @@ export interface LayoutProps {
|
|
|
25
18
|
width?: 'full' | 'auto';
|
|
26
19
|
height?: 'full' | 'auto';
|
|
27
20
|
minWidth?: '0';
|
|
28
|
-
minHeight?: '0';
|
|
29
21
|
border?: boolean | 'top' | 'bottom' | 'left' | 'right';
|
|
30
22
|
rounded?: boolean | 'none' | 'sm' | 'full' | 'lg' | 'theme' | 'md' | 'xl' | 'pill' | 'circle';
|
|
31
|
-
shadow?: boolean | ShadowToken | 'theme';
|
|
32
|
-
cursor?: 'pointer' | 'default' | 'not-allowed' | 'grab';
|
|
33
|
-
opacity?: 0 | 50 | 80 | 100;
|
|
34
23
|
animate?: 'spin' | 'ping' | 'pulse' | 'fadeIn' | 'none';
|
|
35
24
|
hidden?: boolean;
|
|
36
25
|
as?: ElementType;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ChatMessage, InstructionType } from '../types';
|
|
3
3
|
import { type TaskState } from './sseReducer';
|
|
4
|
-
import type { UIStateActions } from './UIStateContext';
|
|
5
4
|
export interface ChatActions {
|
|
6
5
|
addMessage: (message: ChatMessage) => void;
|
|
7
6
|
updateMessage: (messageId: string, updates: Partial<ChatMessage>) => void;
|
|
@@ -26,8 +25,6 @@ interface ChatContextType {
|
|
|
26
25
|
interface ChatProviderProps {
|
|
27
26
|
children: React.ReactNode;
|
|
28
27
|
previewMode?: boolean;
|
|
29
|
-
currentMode: InstructionType;
|
|
30
|
-
uiActions: Pick<UIStateActions, 'setLoading' | 'setError'>;
|
|
31
28
|
}
|
|
32
29
|
export declare const ChatProvider: React.FC<ChatProviderProps>;
|
|
33
30
|
export declare const useChatContext: () => ChatContextType;
|
|
@@ -14,7 +14,6 @@ export interface UIStateActions {
|
|
|
14
14
|
setMode: (mode: InstructionType) => void;
|
|
15
15
|
setLoading: (loading: boolean) => void;
|
|
16
16
|
setError: (error: string | undefined) => void;
|
|
17
|
-
clearError: () => void;
|
|
18
17
|
applyState: (payload: Partial<UIState>) => void;
|
|
19
18
|
}
|
|
20
19
|
interface UIStateContextType {
|
|
@@ -27,5 +27,7 @@ type ProgressStatus = 'in_progress' | 'completed' | 'failed';
|
|
|
27
27
|
export declare function reduceToolProgress(state: SseState, browserToolName: string, explanation: string, status: ProgressStatus, currentMode: InstructionType, error?: string): SseState;
|
|
28
28
|
export declare function reduceToolDone(state: SseState, currentMode: InstructionType): SseState;
|
|
29
29
|
export declare function reduceStop(state: SseState, currentMode: InstructionType): SseState;
|
|
30
|
+
/** Settles a pending message into a plain error bubble — the one shape for both a failed POST and a chat/error. */
|
|
31
|
+
export declare function reduceError(state: SseState, messageId: string, text: string): SseState;
|
|
30
32
|
export declare function reduceSse(state: SseState, event: WidgetEvent, currentMode: InstructionType): ReduceResult;
|
|
31
33
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
2
|
import { type ShadowToken } from './shadows';
|
|
3
3
|
export type RadiusToken = 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'theme' | 'pill' | 'circle';
|
|
4
|
-
export type TextTone = 'default' | 'muted' | 'faint' | 'primary' | '
|
|
4
|
+
export type TextTone = 'default' | 'muted' | 'faint' | 'primary' | 'inherit';
|
|
5
5
|
export type TextLeading = 'tight' | 'snug' | 'normal' | 'relaxed';
|
|
6
|
-
export type NotificationTone = 'info' | 'error';
|
|
6
|
+
export type NotificationTone = 'info' | 'error' | 'neutral';
|
|
7
7
|
export declare const radiusClasses: Record<RadiusToken, string>;
|
|
8
8
|
export declare const textToneClasses: Record<TextTone, string>;
|
|
9
9
|
export declare const textLeadingClasses: Record<TextLeading, string>;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import type { WidgetSettingsData } from '../sdk';
|
|
2
|
-
|
|
2
|
+
type SemanticTokens = {
|
|
3
3
|
color: {
|
|
4
4
|
background: string;
|
|
5
5
|
foreground: string;
|
|
6
6
|
foregroundMuted: string;
|
|
7
7
|
foregroundFaint: string;
|
|
8
8
|
border: string;
|
|
9
|
-
borderMuted: string;
|
|
10
9
|
primary: string;
|
|
11
10
|
primaryForeground: string;
|
|
12
11
|
primaryHover: string;
|
|
13
|
-
primaryMuted: string;
|
|
14
12
|
secondary: string;
|
|
15
13
|
secondaryForeground: string;
|
|
16
14
|
secondaryBg: string;
|
|
@@ -18,20 +16,11 @@ export type SemanticTokens = {
|
|
|
18
16
|
};
|
|
19
17
|
radius: string;
|
|
20
18
|
shadow: string;
|
|
21
|
-
typography: {
|
|
22
|
-
fontSizeBase: string;
|
|
23
|
-
};
|
|
24
19
|
motion: {
|
|
25
20
|
durationAnimation: string;
|
|
26
21
|
durationFade: string;
|
|
27
22
|
};
|
|
28
|
-
size: {
|
|
29
|
-
widgetWidth: string;
|
|
30
|
-
widgetHeight: string;
|
|
31
|
-
};
|
|
32
23
|
};
|
|
33
|
-
export type WidgetStyleSettingsDefaults = Pick<WidgetSettingsData, 'widget_background_color' | 'widget_text_color' | 'widget_border_color' | 'widget_accent_color' | 'widget_secondary_color' | 'widget_border_radius' | 'widget_font_size' | 'widget_width' | 'widget_height' | 'widget_shadow' | 'widget_animation_duration' | 'widget_fade_duration'>;
|
|
34
|
-
export declare const WIDGET_STYLE_SETTINGS_DEFAULTS: WidgetStyleSettingsDefaults;
|
|
35
|
-
export declare function mapWidgetSettingsToSemanticTokens(settings: WidgetStyleSettingsDefaults): SemanticTokens;
|
|
36
24
|
export declare function createSemanticTokens(settings?: Partial<WidgetSettingsData>): SemanticTokens;
|
|
37
25
|
export declare function semanticTokensToCssCustomProperties(tokens: SemanticTokens): Record<string, string>;
|
|
26
|
+
export {};
|
|
@@ -24,7 +24,6 @@ export declare const useWidget: () => {
|
|
|
24
24
|
setMode: (mode: import("..").InstructionType) => void;
|
|
25
25
|
setLoading: (loading: boolean) => void;
|
|
26
26
|
setError: (error: string | undefined) => void;
|
|
27
|
-
clearError: () => void;
|
|
28
27
|
applyState: (payload: Partial<import("../context/UIStateContext").UIState>) => void;
|
|
29
28
|
};
|
|
30
29
|
};
|
package/dist/src/sdk/index.d.ts
CHANGED
|
@@ -465,6 +465,6 @@ export declare const sdk: {
|
|
|
465
465
|
};
|
|
466
466
|
export { WidgetSettingsDataSchema } from './contracts/entities';
|
|
467
467
|
export { WidgetEventSchema } from './contracts/widget';
|
|
468
|
-
export type {
|
|
469
|
-
export type { WidgetCommand, WidgetEvent
|
|
468
|
+
export type { InstructionType, WidgetData, WidgetSettingsData } from './contracts/entities';
|
|
469
|
+
export type { WidgetCommand, WidgetEvent } from './contracts/widget';
|
|
470
470
|
export type { widgetContract } from './contract';
|
|
@@ -21,57 +21,6 @@ export interface ToolExecutionResult<T = TextData> {
|
|
|
21
21
|
data: T;
|
|
22
22
|
error?: string;
|
|
23
23
|
}
|
|
24
|
-
export interface NavigateParams {
|
|
25
|
-
url: string;
|
|
26
|
-
new_tab?: boolean;
|
|
27
|
-
}
|
|
28
|
-
export interface SearchParams {
|
|
29
|
-
query: string;
|
|
30
|
-
engine?: 'duckduckgo' | 'google' | 'bing';
|
|
31
|
-
}
|
|
32
|
-
export interface ClickElementParams {
|
|
33
|
-
index: number;
|
|
34
|
-
coordinate_x?: number;
|
|
35
|
-
coordinate_y?: number;
|
|
36
|
-
}
|
|
37
|
-
export interface TypeTextParams {
|
|
38
|
-
index: number;
|
|
39
|
-
text: string;
|
|
40
|
-
clear?: boolean;
|
|
41
|
-
}
|
|
42
|
-
export interface ScrollParams {
|
|
43
|
-
direction: 'up' | 'down' | 'left' | 'right';
|
|
44
|
-
}
|
|
45
|
-
export interface ScrollToTextParams {
|
|
46
|
-
text: string;
|
|
47
|
-
}
|
|
48
|
-
export interface SendKeysParams {
|
|
49
|
-
index: number;
|
|
50
|
-
keys: string;
|
|
51
|
-
}
|
|
52
|
-
export interface SelectDropdownOptionParams {
|
|
53
|
-
index: number;
|
|
54
|
-
option: string;
|
|
55
|
-
}
|
|
56
|
-
export interface GetDropdownOptionsParams {
|
|
57
|
-
index: number;
|
|
58
|
-
}
|
|
59
|
-
export interface UploadFileParams {
|
|
60
|
-
index: number;
|
|
61
|
-
path: string;
|
|
62
|
-
}
|
|
63
|
-
export interface DoneParams {
|
|
64
|
-
success: boolean;
|
|
65
|
-
message?: string;
|
|
66
|
-
}
|
|
67
|
-
export interface WaitParams {
|
|
68
|
-
seconds: number;
|
|
69
|
-
}
|
|
70
|
-
export interface ExtractParams {
|
|
71
|
-
query?: string;
|
|
72
|
-
extract_links?: boolean;
|
|
73
|
-
start_from_char?: number;
|
|
74
|
-
}
|
|
75
24
|
export declare class BrowserToolService {
|
|
76
25
|
executeTool(browserToolName: string, args: Record<string, unknown>, mode?: string, explanation?: string): Promise<ToolExecutionResult<unknown>>;
|
|
77
26
|
private navigate;
|
|
@@ -8,9 +8,7 @@ export declare class DomService {
|
|
|
8
8
|
private generateSelector;
|
|
9
9
|
private staleReason;
|
|
10
10
|
private indexInteractableElements;
|
|
11
|
-
|
|
12
|
-
private isStackingContext;
|
|
13
|
-
private calculateGlobalZOrder;
|
|
11
|
+
/** `data-id` is the whole contract: the agent parses the snapshot for `[data-id]` and reads nothing else off it. */
|
|
14
12
|
getSnapshotHtml(): string;
|
|
15
13
|
getSequenceForElement(element: Element): number | undefined;
|
|
16
14
|
private clearIndex;
|
|
@@ -14,7 +14,6 @@ export declare class ShowModeService {
|
|
|
14
14
|
private rejectPromise;
|
|
15
15
|
private clickHandler;
|
|
16
16
|
private scrollHandler;
|
|
17
|
-
private mutationObserver;
|
|
18
17
|
private visibilityCheckInterval;
|
|
19
18
|
showToolAction(options: ShowModeOptions): Promise<boolean>;
|
|
20
19
|
cleanup(): void;
|
|
@@ -26,7 +25,7 @@ export declare class ShowModeService {
|
|
|
26
25
|
private updatePopupPosition;
|
|
27
26
|
private setupClickHandler;
|
|
28
27
|
private setupContinueButton;
|
|
29
|
-
|
|
28
|
+
/** checkElementInteractable's first test is `document.body.contains`, so this one watchdog also covers removal. */
|
|
30
29
|
private setupVisibilityMonitoring;
|
|
31
30
|
private failWithElementGone;
|
|
32
31
|
private escapeHtml;
|
|
@@ -2,14 +2,14 @@ import type { ChatMessage, InstructionType, MarketrixConfig } from '../types';
|
|
|
2
2
|
export type StoredMessage = Omit<ChatMessage, 'videoStream' | 'timestamp'> & {
|
|
3
3
|
timestamp: string;
|
|
4
4
|
};
|
|
5
|
-
/** The
|
|
5
|
+
/** The durable half of the widget's React state. `isLoading` is deliberately absent — restoring it would
|
|
6
|
+
* leave the FAB glowing for a request that died with the previous page. */
|
|
6
7
|
export interface ChatSnapshot {
|
|
7
8
|
messages: ChatMessage[];
|
|
8
9
|
isTaskRunning: boolean;
|
|
9
10
|
activeTaskId: string | null;
|
|
10
11
|
currentMode: InstructionType;
|
|
11
12
|
isOpen: boolean;
|
|
12
|
-
isLoading: boolean;
|
|
13
13
|
}
|
|
14
14
|
export type MarketrixChatContext = Omit<ChatSnapshot, 'messages'> & {
|
|
15
15
|
chat_id: string | null;
|
|
@@ -3,9 +3,8 @@ import type { MarketrixConfig } from '../types';
|
|
|
3
3
|
export declare const widgetState: {
|
|
4
4
|
instance: Root | null;
|
|
5
5
|
config: MarketrixConfig | null;
|
|
6
|
-
programmaticInit: boolean;
|
|
7
6
|
};
|
|
8
|
-
export declare const createWidgetContainer: (parentContainer?: HTMLElement
|
|
7
|
+
export declare const createWidgetContainer: (parentContainer?: HTMLElement) => {
|
|
9
8
|
container: HTMLElement;
|
|
10
9
|
shadowRoot: ShadowRoot;
|
|
11
10
|
mountEl: HTMLElement;
|
|
@@ -13,7 +12,6 @@ export declare const createWidgetContainer: (parentContainer?: HTMLElement, cont
|
|
|
13
12
|
export declare const mountWidgetToContainer: (mountEl: HTMLElement, config: MarketrixConfig, previewMode?: boolean) => Root;
|
|
14
13
|
export declare const isWidgetInitialized: () => boolean;
|
|
15
14
|
export declare const getCurrentConfig: () => MarketrixConfig | null;
|
|
16
|
-
export declare const showWidgetSettingsLoader: (message
|
|
15
|
+
export declare const showWidgetSettingsLoader: (message: string) => void;
|
|
17
16
|
export declare const hideWidgetSettingsLoader: () => void;
|
|
18
|
-
export declare const autoInitializeWidget: () => void;
|
|
19
|
-
export declare const registerAutoInit: (initWidget: (config: MarketrixConfig) => Promise<void>) => void;
|
|
17
|
+
export declare const autoInitializeWidget: (initWidget: (config: MarketrixConfig) => Promise<void>) => void;
|
package/dist/src/utils/chat.d.ts
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import type { ChatMessage, InstructionType } from '../types';
|
|
2
2
|
export declare const getModeDisplayName: (mode: InstructionType) => string;
|
|
3
3
|
export declare const formatMessageTime: (date: Date | undefined) => string;
|
|
4
|
-
export declare function removeThinkingMarkers(content: string): string;
|
|
5
|
-
export declare function removeThinkingMarkerFromEnd(content: string): string;
|
|
6
|
-
export declare function hasThinkingMarker(content: string): boolean;
|
|
7
|
-
export declare function addThinkingMarker(content: string): string;
|
|
8
4
|
export interface FindMessageOptions {
|
|
9
5
|
messages: ChatMessage[];
|
|
10
6
|
isTaskRunning: boolean;
|
|
11
7
|
currentMode: InstructionType;
|
|
12
|
-
requireContent?: boolean;
|
|
13
8
|
}
|
|
14
9
|
/** Ranked predicates: the first rank matching anything wins, and within it the newest message. */
|
|
15
|
-
export declare function findMessageForProgress({ messages, isTaskRunning, currentMode,
|
|
10
|
+
export declare function findMessageForProgress({ messages, isTaskRunning, currentMode, }: FindMessageOptions): {
|
|
16
11
|
index: number;
|
|
17
12
|
message: ChatMessage;
|
|
18
13
|
} | null;
|
|
19
14
|
export declare const WAIT_FOR_USER_TOOLS: Set<string>;
|
|
20
15
|
export declare function filterCancellationText(content: string): string;
|
|
21
16
|
export declare function addProgressLine(message: ChatMessage, browserToolName: string, explanation: string): ChatMessage;
|
|
22
|
-
export declare
|
|
17
|
+
export declare const markProgressLineComplete: (message: ChatMessage) => ChatMessage;
|
|
23
18
|
export declare function markProgressLineFailed(message: ChatMessage, browserToolName: string, error: string): ChatMessage;
|
|
24
|
-
export declare function updateThinkingMarker(message: ChatMessage, isTaskRunning: boolean, currentMode: 'show' | 'tell' | 'do', isWaitingForUser?: boolean): ChatMessage;
|
|
25
19
|
/** Tool id -> the phrase shown in the activity log. Also the allowlist of tools the agent may call. */
|
|
26
20
|
export declare const BROWSER_TOOLS: Map<string, string>;
|
|
27
21
|
export declare function getFriendlyToolName(browserToolName: string): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { MarketrixConfig } from '../types';
|
|
1
|
+
import type { InstructionType, MarketrixConfig } from '../types';
|
|
2
2
|
export interface SuggestedActionItem {
|
|
3
3
|
id: string;
|
|
4
4
|
text: string;
|
|
5
|
-
type:
|
|
5
|
+
type: InstructionType;
|
|
6
6
|
}
|
|
7
7
|
export declare function getSuggestedActionsFromConfig(config: MarketrixConfig): SuggestedActionItem[];
|