@marketrix.ai/widget 1.0.13 → 1.0.15
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/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 +20 -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 +15 -0
- package/dist/debug.d.ts.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 +78 -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/sdk/index.d.ts +6405 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/routes.d.ts +18211 -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 +22 -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 +20 -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/SessionRecorder.d.ts +81 -0
- package/dist/services/SessionRecorder.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 +35 -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 +136 -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 +56 -0
- package/dist/utils/apiUtils.d.ts.map +1 -0
- package/dist/utils/bootstrap.d.ts +73 -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/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 +6 -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 +1 -2
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Utilities
|
|
3
|
+
*
|
|
4
|
+
* Consolidates API response validation, data extraction, and error handling patterns.
|
|
5
|
+
* Eliminates repetition of response validation and error handling across services.
|
|
6
|
+
*/
|
|
7
|
+
import type { MarketrixConfig } from '../types';
|
|
8
|
+
/**
|
|
9
|
+
* API Response Body structure (matches SDK's ResBody interface)
|
|
10
|
+
*/
|
|
11
|
+
interface ApiResponseBody<T = unknown> {
|
|
12
|
+
success: boolean;
|
|
13
|
+
data?: T;
|
|
14
|
+
error?: string;
|
|
15
|
+
message?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Generic API response type - flexible to handle SDK union types
|
|
19
|
+
*/
|
|
20
|
+
type ApiResponse<T = unknown> = {
|
|
21
|
+
status: number;
|
|
22
|
+
body?: ApiResponseBody<T> | null | unknown;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Validate API response structure
|
|
27
|
+
* Consolidates the repeated pattern: response.status === 200 && response.body?.success
|
|
28
|
+
*/
|
|
29
|
+
export declare function isValidApiResponse<T = unknown>(response: ApiResponse<T>): response is ApiResponse<T> & {
|
|
30
|
+
status: 200;
|
|
31
|
+
body: ApiResponseBody<T>;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Extract data from API response with validation
|
|
35
|
+
* Consolidates the pattern: isValidApiResponse(response) && response.body.data
|
|
36
|
+
*/
|
|
37
|
+
export declare function extractApiData<T>(response: ApiResponse<T>): T | null;
|
|
38
|
+
/**
|
|
39
|
+
* Check if error is a connection/network error
|
|
40
|
+
* Consolidates the repeated pattern across widgetValidationService and other services
|
|
41
|
+
*/
|
|
42
|
+
export declare function isConnectionError(error: unknown): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Extract error message from unknown error type
|
|
45
|
+
* Consolidates error instanceof Error ? error.message : String(error)
|
|
46
|
+
*/
|
|
47
|
+
export declare function extractErrorMessage(error: unknown, fallback?: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Handle API error with consistent error message extraction
|
|
50
|
+
*/
|
|
51
|
+
export declare function handleApiError(error: unknown, context?: string, config?: Partial<MarketrixConfig>): {
|
|
52
|
+
isValid: false;
|
|
53
|
+
error: string;
|
|
54
|
+
};
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=apiUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiUtils.d.ts","sourceRoot":"","sources":["../../src/utils/apiUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAMhD;;GAEG;AACH,UAAU,eAAe,CAAC,CAAC,GAAG,OAAO;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,KAAK,WAAW,CAAC,CAAC,GAAG,OAAO,IAAI;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC;IAC3C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,OAAO,EAC5C,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,GACvB,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,CAAA;CAAE,CAGxE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAQpE;AAMD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQzD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,SAAkB,GAAG,MAAM,CAQtF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,OAAO,SAAc,EACrB,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAChC;IACD,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAgBA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
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 - Container to destroy
|
|
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
|
+
* Auto-initialize widget from script tag attributes
|
|
64
|
+
* Retries if script tag not found to handle timing issues with ES module loading
|
|
65
|
+
*/
|
|
66
|
+
export declare const autoInitializeWidget: (retryCount?: number) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Register the widget initialization function and set up auto-initialization
|
|
69
|
+
*
|
|
70
|
+
* @param initWidget - Function to initialize the widget (passed to avoid circular dependency)
|
|
71
|
+
*/
|
|
72
|
+
export declare const registerAutoInit: (initWidget: (config: MarketrixConfig) => Promise<void>) => void;
|
|
73
|
+
//# sourceMappingURL=bootstrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/utils/bootstrap.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAMzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAsBhD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,kBAAkB,WAAW,EAC7B,cAAc,MAAM,KACnB;IACD,SAAS,EAAE,WAAW,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,WAAW,CAAC;CA2DtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAAI,SAAS,WAAW,EAAE,QAAQ,eAAe,KAAG,IAatF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAAI,WAAW,WAAW,KAAG,IAK/D,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAO,IAAI,GAAG,IAE3C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,IAAI,GAAG,IAAI,KAAG,IAEzD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAO,eAAe,GAAG,IAErD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,eAAe,GAAG,IAAI,KAAG,IAEjE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAO,OAEtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAO,IAGnC,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,UAAU,MAAM,KAAG,IA0C3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,QAAO,IAU3C,CAAC;AAWF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,mBAAc,KAAG,IA0GrD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,YAAY,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,KAAG,IASzF,CAAC"}
|
|
@@ -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;IACd,OAAO,EAAE,WAAW,CAAC;CACtB,GAAG,IAAI,CA8IP;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,WAAW,EAAE,EACvB,WAAW,CAAC,EAAE,eAAe,GAC5B;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,WAAW,CAAA;CAAE,GAAG,IAAI,CA+BhD;AAsDD;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,WAAW,CAuCb;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,EAC1C,KAAK,CAAC,EAAE,MAAM,GACb,WAAW,CA0Cb;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,CAuB7F;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,WAAW,CA4Cb;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,WAAW,EACpB,aAAa,EAAE,OAAO,EACtB,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,EACnC,gBAAgB,GAAE,OAAe,GAChC,WAAW,CAkCb;AACD;;;;;GAKG;AAEH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA4BpD,CAAC;AAEF;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAsB5D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cleanup Utilities
|
|
3
|
+
*
|
|
4
|
+
* 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;AAIH;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAS/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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyCH;;GAEG;AACH,eAAO,MAAM,MAAM;IACjB;;OAEG;oBACa,MAAM,WAAW,MAAM,WAAW,OAAO,EAAE,KAAG,IAAI;IAMlE;;OAEG;mBACY,MAAM,WAAW,MAAM,WAAW,OAAO,EAAE,KAAG,IAAI;IAMjE;;OAEG;mBACY,MAAM,WAAW,MAAM,WAAW,OAAO,EAAE,KAAG,IAAI;IAMjE;;OAEG;oBACa,MAAM,WAAW,MAAM,WAAW,OAAO,EAAE,KAAG,IAAI;CAKnE,CAAC;AAEF;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM;qBAEtB,MAAM,WAAW,OAAO,EAAE;oBAC3B,MAAM,WAAW,OAAO,EAAE;oBAC1B,MAAM,WAAW,OAAO,EAAE;qBACzB,MAAM,WAAW,OAAO,EAAE;EAE9C;AAYD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAOjG;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,YAAY,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,CAAC,GACf,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAOxB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,OAAO,EACd,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvC,IAAI,CAQN;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvC,IAAI,CAEN"}
|
|
@@ -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,CAiBnC"}
|
|
@@ -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=dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/utils/dom.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CASlD;AAkBD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAQjE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAY3C;AAQD;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,WAAW,EAAE,CA0CzD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAiBnE;AAiCD;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,gBAAgB,EAAE,CAGrD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAM1E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,EAAE,CAG1D;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAM/E;AACD,wBAAgB,cAAc,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAsN1D;AACD;;;;;GAKG;AAEH;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,cAAc,GAAG,aAAa,CAK3F;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,CAK1E;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,CAe3F"}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../src/utils/persistence.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -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"}
|