@marketrix.ai/widget 1.0.0
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 +600 -0
- package/dist/components/BrowserTools.d.ts +11 -0
- package/dist/components/BrowserTools.d.ts.map +1 -0
- package/dist/components/MarketrixWidget.d.ts +8 -0
- package/dist/components/MarketrixWidget.d.ts.map +1 -0
- package/dist/components/chat/ChatWindow.d.ts +26 -0
- package/dist/components/chat/ChatWindow.d.ts.map +1 -0
- package/dist/components/chat/MessageContent.d.ts +12 -0
- package/dist/components/chat/MessageContent.d.ts.map +1 -0
- package/dist/components/chat/MessageItem.d.ts +21 -0
- package/dist/components/chat/MessageItem.d.ts.map +1 -0
- package/dist/components/chat/MessageList.d.ts +16 -0
- package/dist/components/chat/MessageList.d.ts.map +1 -0
- package/dist/components/chat/ProgressLine.d.ts +13 -0
- package/dist/components/chat/ProgressLine.d.ts.map +1 -0
- package/dist/components/chat/SuggestedActions.d.ts +20 -0
- package/dist/components/chat/SuggestedActions.d.ts.map +1 -0
- package/dist/components/chat/TaskStatusIcon.d.ts +8 -0
- package/dist/components/chat/TaskStatusIcon.d.ts.map +1 -0
- package/dist/components/chat/ThinkingIndicator.d.ts +10 -0
- package/dist/components/chat/ThinkingIndicator.d.ts.map +1 -0
- package/dist/components/chat/VideoStreamDisplay.d.ts +8 -0
- package/dist/components/chat/VideoStreamDisplay.d.ts.map +1 -0
- package/dist/components/chat/WelcomeMessage.d.ts +30 -0
- package/dist/components/chat/WelcomeMessage.d.ts.map +1 -0
- package/dist/components/debug/DebugPanel.d.ts +17 -0
- package/dist/components/debug/DebugPanel.d.ts.map +1 -0
- package/dist/components/dev/DomTestPanel.d.ts +8 -0
- package/dist/components/dev/DomTestPanel.d.ts.map +1 -0
- package/dist/components/input/MessageInput.d.ts +15 -0
- package/dist/components/input/MessageInput.d.ts.map +1 -0
- package/dist/components/input/ModeSelector.d.ts +13 -0
- package/dist/components/input/ModeSelector.d.ts.map +1 -0
- package/dist/components/layout/WidgetButton.d.ts +12 -0
- package/dist/components/layout/WidgetButton.d.ts.map +1 -0
- package/dist/components/ui/DiagnosticModal.d.ts +16 -0
- package/dist/components/ui/DiagnosticModal.d.ts.map +1 -0
- package/dist/components/ui/ErrorDisplay.d.ts +9 -0
- package/dist/components/ui/ErrorDisplay.d.ts.map +1 -0
- package/dist/components/ui/ScreenAccessModal.d.ts +10 -0
- package/dist/components/ui/ScreenAccessModal.d.ts.map +1 -0
- package/dist/components/ui/WidgetSettingsLoader.d.ts +13 -0
- package/dist/components/ui/WidgetSettingsLoader.d.ts.map +1 -0
- package/dist/constants/config.d.ts +26 -0
- package/dist/constants/config.d.ts.map +1 -0
- package/dist/context/WidgetContext.d.ts +34 -0
- package/dist/context/WidgetContext.d.ts.map +1 -0
- package/dist/debug.d.ts +23 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +22790 -0
- package/dist/debug.js.map +1 -0
- package/dist/hooks/usePageLifecycle.d.ts +12 -0
- package/dist/hooks/usePageLifecycle.d.ts.map +1 -0
- package/dist/hooks/useTaskState.d.ts +6 -0
- package/dist/hooks/useTaskState.d.ts.map +1 -0
- package/dist/hooks/useWidget.d.ts +67 -0
- package/dist/hooks/useWidget.d.ts.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.html +1464 -0
- package/dist/index.mjs +14660 -0
- package/dist/index.mjs.map +1 -0
- package/dist/sdk/index.d.ts +6330 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/routes.d.ts +17972 -0
- package/dist/sdk/routes.d.ts.map +1 -0
- package/dist/sdk/schema.d.ts +9345 -0
- package/dist/sdk/schema.d.ts.map +1 -0
- package/dist/services/ApiService.d.ts +53 -0
- package/dist/services/ApiService.d.ts.map +1 -0
- package/dist/services/ChatService.d.ts +46 -0
- package/dist/services/ChatService.d.ts.map +1 -0
- package/dist/services/ConfigManager.d.ts +21 -0
- package/dist/services/ConfigManager.d.ts.map +1 -0
- package/dist/services/DevTestService.d.ts +172 -0
- package/dist/services/DevTestService.d.ts.map +1 -0
- package/dist/services/DomService.d.ts +145 -0
- package/dist/services/DomService.d.ts.map +1 -0
- package/dist/services/IntegrationService.d.ts +18 -0
- package/dist/services/IntegrationService.d.ts.map +1 -0
- package/dist/services/ScreenShareService.d.ts +25 -0
- package/dist/services/ScreenShareService.d.ts.map +1 -0
- package/dist/services/SessionManager.d.ts +68 -0
- package/dist/services/SessionManager.d.ts.map +1 -0
- package/dist/services/ShowModeService.d.ts +33 -0
- package/dist/services/ShowModeService.d.ts.map +1 -0
- package/dist/services/ToolService.d.ts +89 -0
- package/dist/services/ToolService.d.ts.map +1 -0
- package/dist/services/ValidationService.d.ts +34 -0
- package/dist/services/ValidationService.d.ts.map +1 -0
- package/dist/services/WebSocketClient.d.ts +53 -0
- package/dist/services/WebSocketClient.d.ts.map +1 -0
- package/dist/types/browserTools.d.ts +98 -0
- package/dist/types/browserTools.d.ts.map +1 -0
- package/dist/types/index.d.ts +128 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/toolMessages.d.ts +78 -0
- package/dist/types/toolMessages.d.ts.map +1 -0
- package/dist/utils/apiUtils.d.ts +55 -0
- package/dist/utils/apiUtils.d.ts.map +1 -0
- package/dist/utils/bootstrap.d.ts +74 -0
- package/dist/utils/bootstrap.d.ts.map +1 -0
- package/dist/utils/chat.d.ts +97 -0
- package/dist/utils/chat.d.ts.map +1 -0
- package/dist/utils/cleanupUtils.d.ts +24 -0
- package/dist/utils/cleanupUtils.d.ts.map +1 -0
- package/dist/utils/common.d.ts +55 -0
- package/dist/utils/common.d.ts.map +1 -0
- package/dist/utils/config.d.ts +58 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/devTools.d.ts +71 -0
- package/dist/utils/devTools.d.ts.map +1 -0
- package/dist/utils/dom.d.ts +66 -0
- package/dist/utils/dom.d.ts.map +1 -0
- package/dist/utils/format.d.ts +36 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/persistence.d.ts +15 -0
- package/dist/utils/persistence.d.ts.map +1 -0
- package/dist/utils/stateUtils.d.ts +20 -0
- package/dist/utils/stateUtils.d.ts.map +1 -0
- package/dist/utils/validation.d.ts +130 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/widgetPositioning.d.ts +3 -0
- package/dist/utils/widgetPositioning.d.ts.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Widget Initialization, Lifecycle, and Loader Utilities
|
|
3
|
+
*
|
|
4
|
+
* Handles widget container creation, shadow DOM setup, mounting, lifecycle management,
|
|
5
|
+
* and loader display. Consolidates all widget-related DOM manipulation and state management.
|
|
6
|
+
*/
|
|
7
|
+
import { type Root } from 'react-dom/client';
|
|
8
|
+
import type { MarketrixConfig } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* Create widget container and shadow DOM
|
|
11
|
+
* Returns the container element and shadow root
|
|
12
|
+
* @param parentContainer - Optional parent container to mount within. If provided, shadow DOM will be created within this container.
|
|
13
|
+
* @param containerId - Optional unique container ID. If not provided, a unique ID will be generated.
|
|
14
|
+
*/
|
|
15
|
+
export declare const createWidgetContainer: (parentContainer?: HTMLElement, containerId?: string) => {
|
|
16
|
+
container: HTMLElement;
|
|
17
|
+
shadowRoot: ShadowRoot;
|
|
18
|
+
mountEl: HTMLElement;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Mount widget component to the provided mount element
|
|
22
|
+
* Returns the React root instance
|
|
23
|
+
*/
|
|
24
|
+
export declare const mountWidgetToContainer: (mountEl: HTMLElement, config: MarketrixConfig) => Root;
|
|
25
|
+
/**
|
|
26
|
+
* Destroy widget container
|
|
27
|
+
* @param container - Optional specific container to destroy. If not provided, searches for default container.
|
|
28
|
+
*/
|
|
29
|
+
export declare const destroyWidgetContainer: (container?: HTMLElement) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Get current widget instance
|
|
32
|
+
*/
|
|
33
|
+
export declare const getWidgetInstance: () => Root | null;
|
|
34
|
+
/**
|
|
35
|
+
* Set widget instance
|
|
36
|
+
*/
|
|
37
|
+
export declare const setWidgetInstance: (instance: Root | null) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Get current configuration
|
|
40
|
+
*/
|
|
41
|
+
export declare const getCurrentConfig: () => MarketrixConfig | null;
|
|
42
|
+
/**
|
|
43
|
+
* Set current configuration
|
|
44
|
+
*/
|
|
45
|
+
export declare const setCurrentConfig: (config: MarketrixConfig | null) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Check if widget is initialized
|
|
48
|
+
*/
|
|
49
|
+
export declare const isWidgetInitialized: () => boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Clear widget instance and config
|
|
52
|
+
*/
|
|
53
|
+
export declare const clearWidgetState: () => void;
|
|
54
|
+
/**
|
|
55
|
+
* Show widget settings loader with optional message
|
|
56
|
+
*/
|
|
57
|
+
export declare const showWidgetSettingsLoader: (message?: string) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Hide widget settings loader
|
|
60
|
+
*/
|
|
61
|
+
export declare const hideWidgetSettingsLoader: () => void;
|
|
62
|
+
/**
|
|
63
|
+
* Register the widget initialization function and set up auto-initialization
|
|
64
|
+
*
|
|
65
|
+
* This function:
|
|
66
|
+
* 1. Stores the init function synchronously (no delays)
|
|
67
|
+
* 2. Checks DOM ready state
|
|
68
|
+
* 3. Either initializes immediately or waits for DOMContentLoaded
|
|
69
|
+
* 4. Sets up persistence for bookmarklet usage
|
|
70
|
+
*
|
|
71
|
+
* @param initWidget - Function to initialize the widget (passed to avoid circular dependency)
|
|
72
|
+
*/
|
|
73
|
+
export declare const registerAutoInit: (initWidget: (config: MarketrixConfig) => Promise<void>) => void;
|
|
74
|
+
//# sourceMappingURL=bootstrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"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AAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message Content Utilities
|
|
3
|
+
*
|
|
4
|
+
* Centralized utilities for message content transformation, including:
|
|
5
|
+
* - Removing thinking markers
|
|
6
|
+
*/
|
|
7
|
+
import type { ChatMessage, InstructionType } from '../types';
|
|
8
|
+
/**
|
|
9
|
+
* Remove all __THINKING__ markers from message content
|
|
10
|
+
*/
|
|
11
|
+
export declare function removeThinkingMarkers(content: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Remove thinking marker from end of content (for display)
|
|
14
|
+
*/
|
|
15
|
+
export declare function removeThinkingMarkerFromEnd(content: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Check if content has thinking marker
|
|
18
|
+
*/
|
|
19
|
+
export declare function hasThinkingMarker(content: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Add thinking marker to content
|
|
22
|
+
*/
|
|
23
|
+
export declare function addThinkingMarker(content: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Find the index of the last task message (agent message that's not system/placeholder/screen access)
|
|
26
|
+
*/
|
|
27
|
+
export declare function findTaskMessageIndex(messages: ChatMessage[]): number;
|
|
28
|
+
/**
|
|
29
|
+
* Message Finder Utility
|
|
30
|
+
*
|
|
31
|
+
* Centralized logic for finding messages in the chat that should receive
|
|
32
|
+
* progress updates, tool call results, or errors. Eliminates duplicate
|
|
33
|
+
* message finding code across websocket handlers.
|
|
34
|
+
*/
|
|
35
|
+
export interface FindMessageOptions {
|
|
36
|
+
messages: ChatMessage[];
|
|
37
|
+
isTaskRunning: boolean;
|
|
38
|
+
currentMode: InstructionType;
|
|
39
|
+
preferPlaceholder?: boolean;
|
|
40
|
+
requireContent?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Find the message that should receive progress updates
|
|
44
|
+
* ALWAYS returns the LAST (most recent) matching message by searching backwards.
|
|
45
|
+
* Priority order for active show/do tasks:
|
|
46
|
+
* 1. Placeholder message in show/do mode that has content (the "Let me try this" message)
|
|
47
|
+
* 2. Placeholder message in show/do mode (even without content yet)
|
|
48
|
+
* 3. Non-placeholder agent message in show/do mode
|
|
49
|
+
* For other cases:
|
|
50
|
+
* 4. Last placeholder message
|
|
51
|
+
* 5. Last task message
|
|
52
|
+
* 6. Any agent message as fallback
|
|
53
|
+
*/
|
|
54
|
+
export declare function findMessageForProgress(options: FindMessageOptions): {
|
|
55
|
+
index: number;
|
|
56
|
+
message: ChatMessage;
|
|
57
|
+
} | null;
|
|
58
|
+
/**
|
|
59
|
+
* Find a placeholder message, optionally matching the current mode
|
|
60
|
+
*/
|
|
61
|
+
export declare function findPlaceholderMessage(messages: ChatMessage[], currentMode?: InstructionType): {
|
|
62
|
+
index: number;
|
|
63
|
+
message: ChatMessage;
|
|
64
|
+
} | null;
|
|
65
|
+
/**
|
|
66
|
+
* Add a new progress step to a message
|
|
67
|
+
*/
|
|
68
|
+
export declare function addProgressLine(message: ChatMessage, toolName: string, explanation: string): ChatMessage;
|
|
69
|
+
/**
|
|
70
|
+
* Update an existing progress step for a tool
|
|
71
|
+
*/
|
|
72
|
+
export declare function updateProgressLine(message: ChatMessage, toolName: string, status: 'pending' | 'completed' | 'failed', error?: string): ChatMessage;
|
|
73
|
+
/**
|
|
74
|
+
* Mark the last incomplete progress step as completed
|
|
75
|
+
*/
|
|
76
|
+
export declare function markProgressLineComplete(message: ChatMessage, toolName?: string): ChatMessage;
|
|
77
|
+
/**
|
|
78
|
+
* Mark the last incomplete progress step as failed
|
|
79
|
+
*/
|
|
80
|
+
export declare function markProgressLineFailed(message: ChatMessage, toolName: string, error: string): ChatMessage;
|
|
81
|
+
/**
|
|
82
|
+
* Add or remove thinking marker based on task state
|
|
83
|
+
*/
|
|
84
|
+
export declare function updateThinkingMarker(message: ChatMessage, isTaskRunning: boolean, currentMode: 'show' | 'tell' | 'do', isWaitingForUser?: boolean): ChatMessage;
|
|
85
|
+
/**
|
|
86
|
+
* Tool Name Mapping Utility
|
|
87
|
+
*
|
|
88
|
+
* Provides friendly display names for technical tool names.
|
|
89
|
+
* Used for showing user-friendly progress updates in the chat.
|
|
90
|
+
*/
|
|
91
|
+
export declare const TOOL_NAME_MAPPING: Record<string, string>;
|
|
92
|
+
/**
|
|
93
|
+
* Get a friendly display name for a tool
|
|
94
|
+
* Converts snake_case to Title Case if no mapping exists
|
|
95
|
+
*/
|
|
96
|
+
export declare function getFriendlyToolName(toolName: string): string;
|
|
97
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/utils/chat.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE7D;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM,CAapE;AACD;;;;;;GAMG;AAMH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,eAAe,CAAC;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAkDD;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,kBAAkB,GAAG;IACnE,KAAK,EAAE,MAAM,CAAC;I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
+
* Consolidated cleanup functions for widget elements and state.
|
|
5
|
+
* Reduces code duplication across components.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Remove tour spotlight and description overlays
|
|
9
|
+
*/
|
|
10
|
+
export declare function cleanupTourElements(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Remove typewriter cursor styles
|
|
13
|
+
*/
|
|
14
|
+
export declare function cleanupTypewriterStyles(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Remove all step highlight classes and handlers
|
|
17
|
+
*/
|
|
18
|
+
export declare function cleanupStepHighlights(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Master cleanup function that removes all widget-related DOM elements
|
|
21
|
+
* This consolidates cleanup logic from clearChatHistory, removeStepHighlights, etc.
|
|
22
|
+
*/
|
|
23
|
+
export declare function cleanupAllWidgetElements(): void;
|
|
24
|
+
//# sourceMappingURL=cleanupUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanupUtils.d.ts","sourceRoot":"","sources":["../../src/utils/cleanupUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAO1C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAM9C;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAM5C;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAa/C"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger Utility
|
|
3
|
+
*
|
|
4
|
+
* Centralized logging utility with log levels and environment-based filtering.
|
|
5
|
+
* Only logs in development mode to reduce noise in production.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Logger interface
|
|
9
|
+
*/
|
|
10
|
+
export declare const logger: {
|
|
11
|
+
/**
|
|
12
|
+
* Debug logs - detailed information for debugging
|
|
13
|
+
*/
|
|
14
|
+
debug: (prefix: string, message: string, ...args: unknown[]) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Info logs - general information about application flow
|
|
17
|
+
*/
|
|
18
|
+
info: (prefix: string, message: string, ...args: unknown[]) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Warning logs - potential issues that don't break functionality
|
|
21
|
+
*/
|
|
22
|
+
warn: (prefix: string, message: string, ...args: unknown[]) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Error logs - errors that need attention
|
|
25
|
+
*/
|
|
26
|
+
error: (prefix: string, message: string, ...args: unknown[]) => void;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Create a scoped logger with a fixed prefix
|
|
30
|
+
*/
|
|
31
|
+
export declare function createLogger(prefix: string): {
|
|
32
|
+
debug: (message: string, ...args: unknown[]) => void;
|
|
33
|
+
info: (message: string, ...args: unknown[]) => void;
|
|
34
|
+
warn: (message: string, ...args: unknown[]) => void;
|
|
35
|
+
error: (message: string, ...args: unknown[]) => void;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Execute a function safely with error handling
|
|
39
|
+
* Returns the result or undefined if an error occurs
|
|
40
|
+
*/
|
|
41
|
+
export declare function safeExecute<T>(fn: () => T, errorMessage: string, defaultValue?: T): T | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Execute an async function safely with error handling
|
|
44
|
+
* Returns the result or undefined if an error occurs
|
|
45
|
+
*/
|
|
46
|
+
export declare function safeExecuteAsync<T>(fn: () => Promise<T>, errorMessage: string, defaultValue?: T): Promise<T | undefined>;
|
|
47
|
+
/**
|
|
48
|
+
* Centralized error logging
|
|
49
|
+
*/
|
|
50
|
+
export declare function logError(context: string, error: unknown, additionalInfo?: Record<string, unknown>): void;
|
|
51
|
+
/**
|
|
52
|
+
* Centralized warning logging
|
|
53
|
+
*/
|
|
54
|
+
export declare function logWarning(context: string, message: string, additionalInfo?: Record<string, unknown>): void;
|
|
55
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -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C,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvC,IAAI,CAEN"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration Getters
|
|
3
|
+
*
|
|
4
|
+
* Utilities for extracting and formatting configuration values from MarketrixConfig.
|
|
5
|
+
* These functions provide a clean interface for accessing widget configuration.
|
|
6
|
+
*/
|
|
7
|
+
import type { MarketrixConfig } from '../types';
|
|
8
|
+
export interface WidgetTextConfig {
|
|
9
|
+
greeting: string;
|
|
10
|
+
placeholder: string;
|
|
11
|
+
header_ai: string;
|
|
12
|
+
header_live: string;
|
|
13
|
+
body_ai: string;
|
|
14
|
+
body_live: string;
|
|
15
|
+
chat_greeting: string;
|
|
16
|
+
tour_greeting: string;
|
|
17
|
+
}
|
|
18
|
+
export interface WidgetCustomizeConfig {
|
|
19
|
+
colors: {
|
|
20
|
+
primary: string;
|
|
21
|
+
secondary: string;
|
|
22
|
+
background: string;
|
|
23
|
+
text: string;
|
|
24
|
+
border: string;
|
|
25
|
+
};
|
|
26
|
+
sizes: {
|
|
27
|
+
width: string;
|
|
28
|
+
height: string;
|
|
29
|
+
border_radius: string;
|
|
30
|
+
font_size: string;
|
|
31
|
+
};
|
|
32
|
+
animations: {
|
|
33
|
+
slide_duration: string;
|
|
34
|
+
fade_duration: string;
|
|
35
|
+
bounce_effect: boolean;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export interface WidgetPositionConfig {
|
|
39
|
+
position: string;
|
|
40
|
+
offset: {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
};
|
|
44
|
+
z_index: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get widget text configuration from MarketrixConfig
|
|
48
|
+
*/
|
|
49
|
+
export declare function getWidgetText(config: MarketrixConfig): WidgetTextConfig;
|
|
50
|
+
/**
|
|
51
|
+
* Get widget customization configuration from MarketrixConfig
|
|
52
|
+
*/
|
|
53
|
+
export declare function getWidgetCustomize(config: MarketrixConfig): WidgetCustomizeConfig;
|
|
54
|
+
/**
|
|
55
|
+
* Get widget position configuration from MarketrixConfig
|
|
56
|
+
*/
|
|
57
|
+
export declare function getWidgetPosition(config: MarketrixConfig): WidgetPositionConfig;
|
|
58
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,UAAU,EAAE;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,aAAa,EAAE,MAAM,CAAC;QACtB,aAAa,EAAE,OAAO,CAAC;KACxB,CAAC;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,GAAG,gBAAgB,CAYvE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,qBAAqB,CAsBjF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,oBAAoB,CAa/E"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Development Tools - Browser Console Injection
|
|
3
|
+
*
|
|
4
|
+
* Exposes widget services on window object for testing in browser console.
|
|
5
|
+
* Only active in development mode.
|
|
6
|
+
*
|
|
7
|
+
* Usage in browser console:
|
|
8
|
+
* // Index DOM first
|
|
9
|
+
* await devTools.indexDOM()
|
|
10
|
+
*
|
|
11
|
+
* // Test tools
|
|
12
|
+
* await devTools.testTool('click_element', { index: 5 })
|
|
13
|
+
* await devTools.testTool('type_text', { index: 3, text: 'Hello' })
|
|
14
|
+
*
|
|
15
|
+
* // Direct service access
|
|
16
|
+
* domService.getElementByIndex(5)
|
|
17
|
+
* toolExecutionService.executeTool('scroll', { direction: 'down' }, 'do')
|
|
18
|
+
*/
|
|
19
|
+
import { type ToolExecutionResult } from '../services/ToolService';
|
|
20
|
+
export declare const TOOL_PARAMS: Record<string, {
|
|
21
|
+
required: string[];
|
|
22
|
+
optional: string[];
|
|
23
|
+
}>;
|
|
24
|
+
export declare const devTools: {
|
|
25
|
+
/**
|
|
26
|
+
* Index all interactable DOM elements
|
|
27
|
+
* Must be called before using element-based tools
|
|
28
|
+
*/
|
|
29
|
+
indexDOM(): Array<[number, Element]>;
|
|
30
|
+
/**
|
|
31
|
+
* Get indexed elements list with details
|
|
32
|
+
*/
|
|
33
|
+
listElements(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Highlight an element by index (for visual verification)
|
|
36
|
+
*/
|
|
37
|
+
highlightElement(index: number, duration?: number): void;
|
|
38
|
+
/**
|
|
39
|
+
* Test a tool with given arguments
|
|
40
|
+
*/
|
|
41
|
+
testTool(toolName: string, args?: Record<string, unknown>, mode?: "do" | "show", explanation?: string): Promise<ToolExecutionResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Run a sequence of tools
|
|
44
|
+
*/
|
|
45
|
+
runSequence(sequence: Array<{
|
|
46
|
+
tool: string;
|
|
47
|
+
args?: Record<string, unknown>;
|
|
48
|
+
delay?: number;
|
|
49
|
+
}>): Promise<ToolExecutionResult[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Get WebSocket connection status
|
|
52
|
+
*/
|
|
53
|
+
getConnectionStatus(): string;
|
|
54
|
+
/**
|
|
55
|
+
* Get chat messages
|
|
56
|
+
*/
|
|
57
|
+
getMessages(): import("..").ChatMessage[];
|
|
58
|
+
/**
|
|
59
|
+
* Clear chat history
|
|
60
|
+
*/
|
|
61
|
+
clearChat(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Print help
|
|
64
|
+
*/
|
|
65
|
+
help(): void;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Initialize dev tools - expose on window object
|
|
69
|
+
*/
|
|
70
|
+
export declare function initDevTools(): void;
|
|
71
|
+
//# sourceMappingURL=devTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devTools.d.ts","sourceRoot":"","sources":["../../src/utils/devTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,EAAE,KAAK,mBAAmB,EAAwB,MAAM,yBAAyB,CAAC;AAIzF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAmBlF,CAAC;AAGF,eAAO,MAAM,QAAQ;IACnB;;;OAGG;gBACS,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAMpC;;OAEG;oBACa,IAAI;IAapB;;OAEG;4BACqB,MAAM,aAAY,MAAM,GAAU,IAAI;IAsB9D;;OAEG;uBAES,MAAM,SACV,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,SACvB,IAAI,GAAG,MAAM,gBACN,MAAM,GAClB,OAAO,CAAC,mBAAmB,CAAC;IAoC/B;;OAEG;0BAES,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAChF,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAuBjC;;OAEG;2BACoB,MAAM;IAK7B;;OAEG;;IAKH;;OAEG;iBACU,IAAI;IAKjB;;OAEG;YACK,IAAI;CAyBb,CAAC;AAEF;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAmBnC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM Manipulation Utilities
|
|
3
|
+
*
|
|
4
|
+
* Centralized utilities for common DOM operations to reduce code duplication
|
|
5
|
+
* and ensure consistent error handling.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Safely remove an element by ID
|
|
9
|
+
*/
|
|
10
|
+
export declare function removeElementById(id: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* Remove tour click handlers from an element
|
|
13
|
+
*/
|
|
14
|
+
export declare function removeTourClickHandler(element: HTMLElement): void;
|
|
15
|
+
/**
|
|
16
|
+
* Remove all step highlight classes and their associated handlers
|
|
17
|
+
*/
|
|
18
|
+
export declare function removeStepHighlights(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Get all interactive elements on the page, ordered by DOM position.
|
|
21
|
+
* Interactive elements include: buttons, inputs, links, select elements, etc.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getAllInteractiveElements(): HTMLElement[];
|
|
24
|
+
/**
|
|
25
|
+
* Get an interactive element by its index.
|
|
26
|
+
* First tries to use data-id from get_html indexing, then falls back to current behavior.
|
|
27
|
+
* @param index The zero-based index of the element
|
|
28
|
+
* @returns The element at the given index, or null if not found
|
|
29
|
+
*/
|
|
30
|
+
export declare function getElementByIndex(index: number): HTMLElement | null;
|
|
31
|
+
/**
|
|
32
|
+
* Get all file input elements on the page, ordered by DOM position.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getAllFileInputs(): HTMLInputElement[];
|
|
35
|
+
/**
|
|
36
|
+
* Get a file input element by its index.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getFileInputByIndex(index: number): HTMLInputElement | null;
|
|
39
|
+
/**
|
|
40
|
+
* Get all select/dropdown elements on the page, ordered by DOM position.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getAllSelectElements(): HTMLSelectElement[];
|
|
43
|
+
/**
|
|
44
|
+
* Get a select element by its index.
|
|
45
|
+
*/
|
|
46
|
+
export declare function getSelectElementByIndex(index: number): HTMLSelectElement | null;
|
|
47
|
+
export declare function isInteractable(el: Element | null): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Attribute Parsing Utilities
|
|
50
|
+
*
|
|
51
|
+
* Pure utility functions for parsing script tag data attributes.
|
|
52
|
+
* These functions validate and normalize attribute values.
|
|
53
|
+
*/
|
|
54
|
+
/**
|
|
55
|
+
* Parse position attribute from script tag
|
|
56
|
+
*/
|
|
57
|
+
export declare function parsePositionAttribute(value: string | null): 'bottom_right' | 'bottom_left';
|
|
58
|
+
/**
|
|
59
|
+
* Parse theme attribute from script tag
|
|
60
|
+
*/
|
|
61
|
+
export declare function parseThemeAttribute(value: string | null): 'light' | 'dark';
|
|
62
|
+
/**
|
|
63
|
+
* Parse enabled modes attribute from script tag
|
|
64
|
+
*/
|
|
65
|
+
export declare function parseEnabledModesAttribute(value: string | null): ('show' | 'tell' | 'do')[];
|
|
66
|
+
//# sourceMappingURL=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}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color utility functions for widget theming
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Converts hex color to RGB
|
|
6
|
+
*/
|
|
7
|
+
export declare function hexToRgb(hex: string): {
|
|
8
|
+
r: number;
|
|
9
|
+
g: number;
|
|
10
|
+
b: number;
|
|
11
|
+
} | null;
|
|
12
|
+
/**
|
|
13
|
+
* Gets a contrasting color (white or black) based on the background color
|
|
14
|
+
*/
|
|
15
|
+
export declare function getContrastingColor(color: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Adds opacity to a color
|
|
18
|
+
* Supports hex colors (with or without #) and rgb/rgba strings
|
|
19
|
+
*/
|
|
20
|
+
export declare function addOpacity(color: string, opacity: number): string;
|
|
21
|
+
/**
|
|
22
|
+
* Darkens a color by a specified amount (0-1)
|
|
23
|
+
*/
|
|
24
|
+
export declare function darkenColor(color: string, amount: number): string;
|
|
25
|
+
/**
|
|
26
|
+
* Lightens a color by a specified amount (0-1)
|
|
27
|
+
*/
|
|
28
|
+
export declare function lightenColor(color: string, amount: number): string;
|
|
29
|
+
/**
|
|
30
|
+
* Extracts the first color from a gradient string, or returns the color as-is
|
|
31
|
+
*/
|
|
32
|
+
export declare function extractColorFromGradient(color: string): string;
|
|
33
|
+
export declare const formatMessageTime: (date: Date | undefined) => string;
|
|
34
|
+
export declare const getModeDisplayName: (mode: "show" | "tell" | "do") => string;
|
|
35
|
+
export declare const getModeDescription: (mode: "show" | "tell" | "do") => string;
|
|
36
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAShF;AAwBD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAyBjE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAUjE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAUlE;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAkB9D;AACD,eAAO,MAAM,iBAAiB,GAAI,MAAM,IAAI,GAAG,SAAS,KAAG,MAK1D,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,GAAG,MAAM,GAAG,IAAI,KAAG,MAWjE,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,GAAG,MAAM,GAAG,IAAI,KAAG,MAWjE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistence utilities for bookmarklet usage
|
|
3
|
+
* Handles storing and restoring widget configuration for bookmarklet scenarios
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Check if there's a stored bookmarklet config and re-inject the widget
|
|
7
|
+
* This is called on page load to restore widget state from bookmarklet usage
|
|
8
|
+
*/
|
|
9
|
+
export declare const checkAndReinjectOnLoad: () => void;
|
|
10
|
+
/**
|
|
11
|
+
* Initialize persistence for bookmarklet usage
|
|
12
|
+
* Sets up storage mechanism for widget configuration
|
|
13
|
+
*/
|
|
14
|
+
export declare const initializePersistence: () => void;
|
|
15
|
+
//# sourceMappingURL=persistence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../src/utils/persistence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAO,IAoBzC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAO,IAMxC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State Update Utilities
|
|
3
|
+
*
|
|
4
|
+
* Helper functions for common state update patterns to reduce code duplication.
|
|
5
|
+
*/
|
|
6
|
+
import type React from 'react';
|
|
7
|
+
import type { ChatMessage, WidgetState } from '../types';
|
|
8
|
+
/**
|
|
9
|
+
* Add a message to the state
|
|
10
|
+
*/
|
|
11
|
+
export declare function addMessage(setState: React.Dispatch<React.SetStateAction<WidgetState>>, message: ChatMessage): void;
|
|
12
|
+
/**
|
|
13
|
+
* Update a specific message in the state
|
|
14
|
+
*/
|
|
15
|
+
export declare function updateMessage(setState: React.Dispatch<React.SetStateAction<WidgetState>>, messageId: string, updates: Partial<ChatMessage>): void;
|
|
16
|
+
/**
|
|
17
|
+
* Remove a message from the state
|
|
18
|
+
*/
|
|
19
|
+
export declare function removeMessage(setState: React.Dispatch<React.SetStateAction<WidgetState>>, messageId: string): void;
|
|
20
|
+
//# sourceMappingURL=stateUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stateUtils.d.ts","sourceRoot":"","sources":["../../src/utils/stateUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEzD;;GAEG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,EAC3D,OAAO,EAAE,WAAW,GACnB,IAAI,CAKN;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,EAC3D,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,GAC5B,IAAI,CAKN;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,EAC3D,SAAS,EAAE,MAAM,GAChB,IAAI,CAKN"}
|