@marketrix.ai/widget 3.8.53 → 3.8.117

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.
@@ -14,7 +14,6 @@ export interface IconData {
14
14
  paths: IconPath[];
15
15
  }
16
16
  export declare const icons: {
17
- /** FaCheckCircle */
18
17
  readonly checkCircle: {
19
18
  readonly viewBox: "0 0 512 512";
20
19
  readonly paths: [{
@@ -22,7 +21,6 @@ export declare const icons: {
22
21
  readonly fill: "currentColor";
23
22
  }];
24
23
  };
25
- /** FaCircle */
26
24
  readonly circle: {
27
25
  readonly viewBox: "0 0 512 512";
28
26
  readonly paths: [{
@@ -30,7 +28,6 @@ export declare const icons: {
30
28
  readonly fill: "currentColor";
31
29
  }];
32
30
  };
33
- /** FaExclamationCircle */
34
31
  readonly exclamationCircle: {
35
32
  readonly viewBox: "0 0 512 512";
36
33
  readonly paths: [{
@@ -38,7 +35,6 @@ export declare const icons: {
38
35
  readonly fill: "currentColor";
39
36
  }];
40
37
  };
41
- /** FaTimesCircle */
42
38
  readonly timesCircle: {
43
39
  readonly viewBox: "0 0 512 512";
44
40
  readonly paths: [{
@@ -46,7 +42,6 @@ export declare const icons: {
46
42
  readonly fill: "currentColor";
47
43
  }];
48
44
  };
49
- /** FaBan */
50
45
  readonly ban: {
51
46
  readonly viewBox: "0 0 512 512";
52
47
  readonly paths: [{
@@ -54,7 +49,6 @@ export declare const icons: {
54
49
  readonly fill: "currentColor";
55
50
  }];
56
51
  };
57
- /** FaArrowUp */
58
52
  readonly arrowUp: {
59
53
  readonly viewBox: "0 0 448 512";
60
54
  readonly paths: [{
@@ -62,7 +56,6 @@ export declare const icons: {
62
56
  readonly fill: "currentColor";
63
57
  }];
64
58
  };
65
- /** FaArrowDown */
66
59
  readonly arrowDown: {
67
60
  readonly viewBox: "0 0 448 512";
68
61
  readonly paths: [{
@@ -70,7 +63,6 @@ export declare const icons: {
70
63
  readonly fill: "currentColor";
71
64
  }];
72
65
  };
73
- /** FiX */
74
66
  readonly x: {
75
67
  readonly viewBox: "0 0 24 24";
76
68
  readonly paths: [{
@@ -89,7 +81,6 @@ export declare const icons: {
89
81
  readonly strokeLinejoin: "round";
90
82
  }];
91
83
  };
92
- /** IoChatbubbleEllipsesOutline */
93
84
  readonly chatBubble: {
94
85
  readonly viewBox: "0 0 512 512";
95
86
  readonly paths: [{
@@ -109,7 +100,6 @@ export declare const icons: {
109
100
  readonly fill: "currentColor";
110
101
  }];
111
102
  };
112
- /** IoStop */
113
103
  readonly stop: {
114
104
  readonly viewBox: "0 0 512 512";
115
105
  readonly paths: [{
@@ -117,7 +107,6 @@ export declare const icons: {
117
107
  readonly fill: "currentColor";
118
108
  }];
119
109
  };
120
- /** LuMousePointerClick */
121
110
  readonly mousePointerClick: {
122
111
  readonly viewBox: "0 0 24 24";
123
112
  readonly paths: [{
@@ -157,7 +146,6 @@ export declare const icons: {
157
146
  readonly strokeLinejoin: "round";
158
147
  }];
159
148
  };
160
- /** SiTicktick */
161
149
  readonly ticktick: {
162
150
  readonly viewBox: "0 0 24 24";
163
151
  readonly paths: [{
@@ -33,10 +33,6 @@ export { getCurrentConfig };
33
33
  * Renders widget into parent container with shadow DOM
34
34
  */
35
35
  export declare const MarketrixWidget: React.FC<MarketrixWidgetProps>;
36
- /**
37
- * addWidget - Function that auto-detects mode and initializes widget
38
- * Supports preview, production, and dev modes
39
- */
40
36
  export declare const mountWidget: (config: AddWidgetConfig) => Promise<void>;
41
37
  export type { InstructionType } from './sdk';
42
38
  export type { AddWidgetConfig, ChatMessage, MarketrixConfig, MarketrixWidgetProps, WidgetState } from './types';
@@ -2,17 +2,11 @@ import type { MarketrixConfig, SendMessageRequest, SendMessageResponse } from '.
2
2
  export declare class ApiService {
3
3
  private config;
4
4
  constructor(config: MarketrixConfig);
5
- /**
6
- * Get the current chat ID (does not create if missing)
7
- */
8
5
  getChatId(): string | null;
9
6
  /**
10
7
  * Get user_id from various sources (config, localStorage, sessionStorage)
11
8
  */
12
9
  private getUserId;
13
- /**
14
- * Log widget question to action_log
15
- */
16
10
  logWidgetQuestion(question: string, mode: string): Promise<void>;
17
11
  /**
18
12
  * Send a message via the typed stream (fire-and-forget).
@@ -1,6 +1,3 @@
1
- /**
2
- * Fingerprint of an indexed element for validation
3
- */
4
1
  export interface ElementFingerprint {
5
2
  tagName: string;
6
3
  id: string | null;
@@ -13,23 +10,14 @@ export interface ElementFingerprint {
13
10
  selector: string;
14
11
  indexVersion: number;
15
12
  }
16
- /**
17
- * Result of validating an element at a given index
18
- */
19
13
  export interface ValidationResult {
20
14
  isValid: boolean;
21
15
  mismatchReason?: 'element_removed' | 'element_changed';
22
16
  }
23
- /**
24
- * Result of looking up an element by index
25
- */
26
17
  export interface ElementLookupResult {
27
18
  element: HTMLElement | null;
28
19
  error?: string;
29
20
  }
30
- /**
31
- * Result of validated element lookup (includes validation info)
32
- */
33
21
  export interface ValidatedElementResult extends ElementLookupResult {
34
22
  validation: ValidationResult;
35
23
  }
@@ -43,13 +31,7 @@ export declare class DomService {
43
31
  private indexVersion;
44
32
  private constructor();
45
33
  static getInstance(): DomService;
46
- /**
47
- * Generate a unique CSS selector for an element
48
- */
49
34
  private generateSelector;
50
- /**
51
- * Generate a fingerprint for an element to enable validation later
52
- */
53
35
  private generateFingerprint;
54
36
  /**
55
37
  * Check if an element matches a stored fingerprint.
@@ -66,29 +48,14 @@ export declare class DomService {
66
48
  * Always clears previous index first.
67
49
  */
68
50
  indexInteractableElements(): Array<[number, Element]>;
69
- /**
70
- * Get element coordinates using getBoundingClientRect()
71
- * Returns viewport-relative coordinates
72
- */
73
51
  private getElementCoordinates;
74
- /**
75
- * Check if an element creates a stacking context
76
- * Based on CSS stacking context rules
77
- */
78
52
  private isStackingContext;
79
- /**
80
- * Calculate global z-order for an element
81
- * Traverses up the DOM tree to identify stacking contexts and calculate z-order
82
- */
83
53
  private calculateGlobalZOrder;
84
54
  /**
85
55
  * Get HTML snapshot with data-id attributes injected.
86
56
  * This re-indexes the live DOM and then produces a corresponding HTML string.
87
57
  */
88
58
  getSnapshotHtml(): string;
89
- /**
90
- * Get actionable elements metadata
91
- */
92
59
  getInteractableElements(): Array<{
93
60
  index: number;
94
61
  fingerprint: ElementFingerprint;
@@ -8,12 +8,5 @@
8
8
  * @returns Promise resolving to the MediaStream
9
9
  */
10
10
  export declare function startScreenShare(): Promise<MediaStream>;
11
- /**
12
- * Stop screen sharing and clear the stream reference.
13
- */
14
11
  export declare function stopScreenShare(): void;
15
- /**
16
- * Check if screensharing is currently active.
17
- * @returns True if screensharing is active, false otherwise
18
- */
19
12
  export declare function isScreenSharing(): boolean;
@@ -9,13 +9,7 @@ declare class SessionManager {
9
9
  private chatId;
10
10
  private initializationPromise;
11
11
  private constructor();
12
- /**
13
- * Get singleton instance
14
- */
15
12
  static getInstance(): SessionManager;
16
- /**
17
- * Get current chat ID without creating a new one
18
- */
19
13
  getChatId(): string | null;
20
14
  /**
21
15
  * Get or create chat ID with promise-based locking
@@ -17,13 +17,7 @@ export declare class SessionRecorder {
17
17
  private consecutiveFailures;
18
18
  private isFlushing;
19
19
  constructor(chatId: string, applicationId: number);
20
- /**
21
- * Send rrweb/metadata command via POST
22
- */
23
20
  private sendMetadata;
24
- /**
25
- * Buffer an event and trigger flush if thresholds are met
26
- */
27
21
  private bufferEvent;
28
22
  /**
29
23
  * Flush buffered events via POST.
@@ -44,16 +38,7 @@ export declare class SessionRecorder {
44
38
  * Internal start implementation. Checks stopRequested at each async boundary.
45
39
  */
46
40
  private doStart;
47
- /**
48
- * Stop recording session. Flushes remaining events before stopping.
49
- */
50
41
  stop(): void;
51
- /**
52
- * Get current session ID
53
- */
54
42
  getSessionId(): string;
55
- /**
56
- * Check if recording is active
57
- */
58
43
  isActive(): boolean;
59
44
  }
@@ -22,9 +22,6 @@ import type { ChatMessage, InstructionType, MarketrixConfig } from '../types';
22
22
  type StoredMessage = Omit<ChatMessage, 'videoStream' | 'timestamp'> & {
23
23
  timestamp: string;
24
24
  };
25
- /**
26
- * Unified storage structure for all widget data
27
- */
28
25
  export interface MarketrixChatContext {
29
26
  chat_id: string | null;
30
27
  messages: StoredMessage[];
@@ -48,25 +45,10 @@ declare class StorageService {
48
45
  private context;
49
46
  private constructor();
50
47
  static getInstance(): StorageService;
51
- /**
52
- * Load context from localStorage
53
- */
54
48
  private loadContext;
55
- /**
56
- * Save context to localStorage
57
- */
58
49
  private saveContext;
59
- /**
60
- * Get the full context
61
- */
62
50
  getContext(): MarketrixChatContext;
63
- /**
64
- * Update context with partial data
65
- */
66
51
  updateContext(updates: Partial<MarketrixChatContext>): void;
67
- /**
68
- * Check if a string is a valid chat_id
69
- */
70
52
  private isValidChatId;
71
53
  /**
72
54
  * Get chat_id with window.name fallback for cross-page navigation
@@ -85,9 +67,6 @@ declare class StorageService {
85
67
  getConfig(): MarketrixConfig | null;
86
68
  setConfig(config: MarketrixConfig | null): void;
87
69
  clear(): void;
88
- /**
89
- * Check if context exists and has a valid chat_id
90
- */
91
70
  hasValidContext(): boolean;
92
71
  }
93
72
  export declare const storageService: StorageService;
@@ -20,13 +20,6 @@ export declare class ValidationService {
20
20
  * Handles both mtxId+mtxKey and mtxApp cases
21
21
  */
22
22
  validateConfig(config: MarketrixConfig): Promise<WidgetValidationResult>;
23
- /**
24
- * Validate by mtxId and mtxKey
25
- */
26
23
  private validateByMarketrixId;
27
- /**
28
- * Validate by mtxApp directly
29
- * Validates the application by ID
30
- */
31
24
  private validateByApplication;
32
25
  }
@@ -86,10 +86,6 @@ export interface SendMessageResponse {
86
86
  task_id?: string;
87
87
  }
88
88
  export type WidgetPosition = WidgetSettingsData['widget_position'];
89
- /**
90
- * Configuration for addWidget function
91
- * Supports preview, production, and dev modes
92
- */
93
89
  export type AddWidgetConfig = ({
94
90
  settings: WidgetSettingsData;
95
91
  mtxId?: never;
@@ -119,9 +115,6 @@ export type AddWidgetConfig = ({
119
115
  /** Controls screen sharing prompts and button. When false, screen access requests are auto-denied and Share Screen button is hidden. Default: true */
120
116
  use_screenshare?: boolean;
121
117
  };
122
- /**
123
- * Props for MarketrixWidget React component
124
- */
125
118
  export interface MarketrixWidgetProps {
126
119
  settings: WidgetSettingsData;
127
120
  container?: HTMLElement;
@@ -5,9 +5,6 @@ import type { MarketrixConfig } from '../types';
5
5
  * Consolidates error instanceof Error ? error.message : String(error)
6
6
  */
7
7
  export declare function extractErrorMessage(error: unknown, fallback?: string): string;
8
- /**
9
- * Handle API error with consistent error message extraction
10
- */
11
8
  export declare function handleApiError(error: unknown, context?: string, config?: Partial<MarketrixConfig>): {
12
9
  isValid: false;
13
10
  error: string;
@@ -25,50 +25,16 @@ export declare const createWidgetContainer: (parentContainer?: HTMLElement, cont
25
25
  * @param previewMode - If true, disables network operations (for integration previews)
26
26
  */
27
27
  export declare const mountWidgetToContainer: (mountEl: HTMLElement, config: MarketrixConfig, previewMode?: boolean) => Root;
28
- /**
29
- * Destroy widget container
30
- * @param container - Container to destroy
31
- */
32
28
  export declare const destroyWidgetContainer: (container: HTMLElement) => void;
33
- /**
34
- * Get current widget instance
35
- */
36
29
  export declare const getWidgetInstance: () => Root | null;
37
- /**
38
- * Set widget instance
39
- */
40
30
  export declare const setWidgetInstance: (instance: Root | null) => void;
41
- /**
42
- * Get current configuration
43
- */
44
31
  export declare const getCurrentConfig: () => MarketrixConfig | null;
45
- /**
46
- * Set current configuration
47
- */
48
32
  export declare const setCurrentConfig: (config: MarketrixConfig | null) => void;
49
- /**
50
- * Check if widget is initialized
51
- */
52
33
  export declare const isWidgetInitialized: () => boolean;
53
- /**
54
- * Clear widget instance and config
55
- */
56
34
  export declare const clearWidgetState: () => void;
57
- /**
58
- * Set programmatic initialization in progress flag
59
- */
60
35
  export declare const setProgrammaticInitInProgress: (inProgress: boolean) => void;
61
- /**
62
- * Check if programmatic initialization is in progress
63
- */
64
36
  export declare const isProgrammaticInitInProgress: () => boolean;
65
- /**
66
- * Show widget settings loader with optional message
67
- */
68
37
  export declare const showWidgetSettingsLoader: (message?: string) => void;
69
- /**
70
- * Hide widget settings loader
71
- */
72
38
  export declare const hideWidgetSettingsLoader: () => void;
73
39
  /**
74
40
  * Auto-initialize widget from script tag attributes
@@ -5,21 +5,9 @@
5
5
  * - Removing thinking markers
6
6
  */
7
7
  import type { ChatMessage, InstructionType } from '../types';
8
- /**
9
- * Remove all __THINKING__ markers from message content
10
- */
11
8
  export declare function removeThinkingMarkers(content: string): string;
12
- /**
13
- * Remove thinking marker from end of content (for display)
14
- */
15
9
  export declare function removeThinkingMarkerFromEnd(content: string): string;
16
- /**
17
- * Check if content has thinking marker
18
- */
19
10
  export declare function hasThinkingMarker(content: string): boolean;
20
- /**
21
- * Add thinking marker to content
22
- */
23
11
  export declare function addThinkingMarker(content: string): string;
24
12
  /**
25
13
  * Message Finder Utility
@@ -56,21 +44,9 @@ export declare function findMessageForProgress(options: FindMessageOptions): {
56
44
  * Also the set that requires element highlighting in ToolService.
57
45
  */
58
46
  export declare const WAIT_FOR_USER_TOOLS: Set<string>;
59
- /**
60
- * Add a new progress step to a message
61
- */
62
47
  export declare function addProgressLine(message: ChatMessage, toolName: string, explanation: string): ChatMessage;
63
- /**
64
- * Mark the last incomplete progress step as completed
65
- */
66
48
  export declare function markProgressLineComplete(message: ChatMessage, toolName?: string): ChatMessage;
67
- /**
68
- * Mark the last incomplete progress step as failed
69
- */
70
49
  export declare function markProgressLineFailed(message: ChatMessage, toolName: string, error: string): ChatMessage;
71
- /**
72
- * Add or remove thinking marker based on task state
73
- */
74
50
  export declare function updateThinkingMarker(message: ChatMessage, isTaskRunning: boolean, currentMode: 'show' | 'tell' | 'do', isWaitingForUser?: boolean): ChatMessage;
75
51
  /**
76
52
  * Tool Name Mapping — derived from BROWSER_TOOLS (single source of truth).
@@ -1,26 +1,17 @@
1
1
  /**
2
2
  * Color utility functions for widget theming
3
3
  */
4
- /**
5
- * Converts hex color to RGB
6
- */
7
4
  export declare function hexToRgb(hex: string): {
8
5
  r: number;
9
6
  g: number;
10
7
  b: number;
11
8
  } | null;
12
- /**
13
- * Gets a contrasting color (white or black) based on the background color
14
- */
15
9
  export declare function getContrastingColor(color: string): string;
16
10
  /**
17
11
  * Adds opacity to a color
18
12
  * Supports hex colors (with or without #) and rgb/rgba strings
19
13
  */
20
14
  export declare function addOpacity(color: string, opacity: number): string;
21
- /**
22
- * Darkens a color by a specified amount (0-1)
23
- */
24
15
  export declare function darkenColor(color: string, amount: number): string;
25
16
  export declare const formatMessageTime: (date: Date | undefined) => string;
26
17
  export declare const getModeDisplayName: (mode: "show" | "tell" | "do") => string;
@@ -4,9 +4,6 @@
4
4
  * Centralized logging utility with log levels and environment-based filtering.
5
5
  * Only logs in development mode to reduce noise in production.
6
6
  */
7
- /**
8
- * Create a scoped logger with a fixed prefix
9
- */
10
7
  export declare function createLogger(prefix: string): {
11
8
  debug: (message: string, ...args: unknown[]) => void;
12
9
  info: (message: string, ...args: unknown[]) => void;
@@ -5,15 +5,6 @@
5
5
  * These are shared utilities used across the codebase.
6
6
  */
7
7
  import type { WidgetSettingsData } from '../sdk';
8
- /**
9
- * Type guard for WidgetSettingsData
10
- */
11
8
  export declare function isWidgetSettingsData(data: unknown): data is WidgetSettingsData;
12
- /**
13
- * Type guard for HTMLElement
14
- */
15
9
  export declare function isHTMLElement(element: Element | null): element is HTMLElement;
16
- /**
17
- * Type guard for HTMLScriptElement
18
- */
19
10
  export declare function isHTMLScriptElement(element: Element | null): element is HTMLScriptElement;