@v-tilt/browser 1.3.0 → 1.4.1
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/all-external-dependencies.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/chat.js +2 -0
- package/dist/chat.js.map +1 -0
- package/dist/entrypoints/chat.d.ts +22 -0
- package/dist/extensions/chat/chat-wrapper.d.ts +172 -0
- package/dist/extensions/chat/chat.d.ts +87 -0
- package/dist/extensions/chat/index.d.ts +10 -0
- package/dist/extensions/chat/types.d.ts +156 -0
- package/dist/external-scripts-loader.js +1 -1
- package/dist/external-scripts-loader.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +279 -2
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.d.ts +279 -2
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/recorder.js.map +1 -1
- package/dist/types.d.ts +27 -0
- package/dist/utils/globals.d.ts +111 -1
- package/dist/vtilt.d.ts +11 -1
- package/dist/web-vitals.js.map +1 -1
- package/lib/entrypoints/chat.d.ts +22 -0
- package/lib/entrypoints/chat.js +32 -0
- package/lib/entrypoints/external-scripts-loader.js +1 -1
- package/lib/extensions/chat/chat-wrapper.d.ts +172 -0
- package/lib/extensions/chat/chat-wrapper.js +497 -0
- package/lib/extensions/chat/chat.d.ts +87 -0
- package/lib/extensions/chat/chat.js +1004 -0
- package/lib/extensions/chat/index.d.ts +10 -0
- package/lib/extensions/chat/index.js +27 -0
- package/lib/extensions/chat/types.d.ts +156 -0
- package/lib/extensions/chat/types.js +22 -0
- package/lib/types.d.ts +27 -0
- package/lib/utils/globals.d.ts +111 -1
- package/lib/vtilt.d.ts +11 -1
- package/lib/vtilt.js +42 -1
- package/package.json +2 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat Entrypoint
|
|
3
|
+
*
|
|
4
|
+
* This file is built as a separate bundle (chat.js) that can be
|
|
5
|
+
* lazy-loaded when chat is enabled.
|
|
6
|
+
*
|
|
7
|
+
* Uses Ably for real-time messaging (imported directly in chat.ts).
|
|
8
|
+
*
|
|
9
|
+
* It exports:
|
|
10
|
+
* - initChat: Factory function to create LazyLoadedChat
|
|
11
|
+
*/
|
|
12
|
+
import { type ChatConfig, type LazyLoadedChatInterface } from "../utils/globals";
|
|
13
|
+
import { LazyLoadedChat } from "../extensions/chat/chat";
|
|
14
|
+
import type { VTilt } from "../vtilt";
|
|
15
|
+
/**
|
|
16
|
+
* Factory function to create a LazyLoadedChat instance
|
|
17
|
+
*
|
|
18
|
+
* Called by ChatWrapper after the chat script is loaded
|
|
19
|
+
*/
|
|
20
|
+
declare function initChat(instance: VTilt, config?: ChatConfig): LazyLoadedChatInterface;
|
|
21
|
+
export { initChat, LazyLoadedChat };
|
|
22
|
+
export default initChat;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat Wrapper
|
|
3
|
+
*
|
|
4
|
+
* Lightweight wrapper that handles the decision of WHEN to load the chat widget.
|
|
5
|
+
* The actual chat logic is in LazyLoadedChat which is loaded on demand.
|
|
6
|
+
*
|
|
7
|
+
* This follows the same pattern as SessionRecordingWrapper.
|
|
8
|
+
*
|
|
9
|
+
* ## Initialization Modes (Intercom-like flexibility)
|
|
10
|
+
*
|
|
11
|
+
* 1. **Snippet-only (dashboard configured)**:
|
|
12
|
+
* Just add the vTilt snippet - widget auto-configures from project settings.
|
|
13
|
+
* ```js
|
|
14
|
+
* vt.init('token', { api_host: '...' })
|
|
15
|
+
* // Chat widget appears based on dashboard settings
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* 2. **Code-configured (optional overrides)**:
|
|
19
|
+
* Override dashboard settings with code for advanced customization.
|
|
20
|
+
* ```js
|
|
21
|
+
* vt.init('token', {
|
|
22
|
+
* api_host: '...',
|
|
23
|
+
* chat: {
|
|
24
|
+
* enabled: true,
|
|
25
|
+
* position: 'bottom-left',
|
|
26
|
+
* greeting: 'Custom greeting!'
|
|
27
|
+
* }
|
|
28
|
+
* })
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* Code config always takes precedence over dashboard settings.
|
|
32
|
+
*/
|
|
33
|
+
import type { VTilt } from "../../vtilt";
|
|
34
|
+
import type { ChatConfig } from "../../utils/globals";
|
|
35
|
+
import type { MessageCallback, TypingCallback, ConnectionCallback, Unsubscribe } from "./types";
|
|
36
|
+
/** Status when lazy loading is in progress */
|
|
37
|
+
export declare const CHAT_LOADING: "loading";
|
|
38
|
+
/**
|
|
39
|
+
* Chat Wrapper
|
|
40
|
+
*
|
|
41
|
+
* This is the lightweight class that lives in the main bundle.
|
|
42
|
+
* It handles:
|
|
43
|
+
* - Auto-fetching settings from dashboard (Intercom-like)
|
|
44
|
+
* - Merging server settings with code config
|
|
45
|
+
* - Deciding if chat should be enabled
|
|
46
|
+
* - Lazy loading the actual chat widget code
|
|
47
|
+
* - Delegating to LazyLoadedChat
|
|
48
|
+
* - Queuing messages/callbacks before widget loads
|
|
49
|
+
*/
|
|
50
|
+
export declare class ChatWrapper {
|
|
51
|
+
private readonly _instance;
|
|
52
|
+
private _lazyLoadedChat;
|
|
53
|
+
private _config;
|
|
54
|
+
private _serverConfig;
|
|
55
|
+
private _configFetched;
|
|
56
|
+
private _isLoading;
|
|
57
|
+
private _loadError;
|
|
58
|
+
private _pendingMessages;
|
|
59
|
+
private _pendingCallbacks;
|
|
60
|
+
private _messageCallbacks;
|
|
61
|
+
private _typingCallbacks;
|
|
62
|
+
private _connectionCallbacks;
|
|
63
|
+
constructor(_instance: VTilt, config?: ChatConfig);
|
|
64
|
+
/**
|
|
65
|
+
* Whether the chat widget is open
|
|
66
|
+
*/
|
|
67
|
+
get isOpen(): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Whether connected to realtime service
|
|
70
|
+
*/
|
|
71
|
+
get isConnected(): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Whether the widget is loading
|
|
74
|
+
*/
|
|
75
|
+
get isLoading(): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Number of unread messages
|
|
78
|
+
*/
|
|
79
|
+
get unreadCount(): number;
|
|
80
|
+
/**
|
|
81
|
+
* Current channel (if any)
|
|
82
|
+
*/
|
|
83
|
+
get channel(): import("./types").ChatChannel | null;
|
|
84
|
+
/**
|
|
85
|
+
* Open the chat widget
|
|
86
|
+
*/
|
|
87
|
+
open(): void;
|
|
88
|
+
/**
|
|
89
|
+
* Close the chat widget
|
|
90
|
+
*/
|
|
91
|
+
close(): void;
|
|
92
|
+
/**
|
|
93
|
+
* Toggle the chat widget open/closed
|
|
94
|
+
*/
|
|
95
|
+
toggle(): void;
|
|
96
|
+
/**
|
|
97
|
+
* Show the chat widget (make visible but not necessarily open)
|
|
98
|
+
*/
|
|
99
|
+
show(): void;
|
|
100
|
+
/**
|
|
101
|
+
* Hide the chat widget
|
|
102
|
+
*/
|
|
103
|
+
hide(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Send a message
|
|
106
|
+
*/
|
|
107
|
+
sendMessage(content: string): void;
|
|
108
|
+
/**
|
|
109
|
+
* Mark messages as read
|
|
110
|
+
*/
|
|
111
|
+
markAsRead(): void;
|
|
112
|
+
/**
|
|
113
|
+
* Subscribe to new messages
|
|
114
|
+
*/
|
|
115
|
+
onMessage(callback: MessageCallback): Unsubscribe;
|
|
116
|
+
/**
|
|
117
|
+
* Subscribe to typing indicators
|
|
118
|
+
*/
|
|
119
|
+
onTyping(callback: TypingCallback): Unsubscribe;
|
|
120
|
+
/**
|
|
121
|
+
* Subscribe to connection changes
|
|
122
|
+
*/
|
|
123
|
+
onConnectionChange(callback: ConnectionCallback): Unsubscribe;
|
|
124
|
+
/**
|
|
125
|
+
* Start chat if enabled, called by VTilt after init
|
|
126
|
+
*
|
|
127
|
+
* This method supports two modes (Intercom-like):
|
|
128
|
+
* 1. Auto-config: Fetch settings from /api/chat/settings (default)
|
|
129
|
+
* 2. Code-only: Use only code config (autoConfig: false)
|
|
130
|
+
*/
|
|
131
|
+
startIfEnabled(): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Update configuration
|
|
134
|
+
*/
|
|
135
|
+
updateConfig(config: Partial<ChatConfig>): void;
|
|
136
|
+
/**
|
|
137
|
+
* Get the merged configuration (server + code, code takes precedence)
|
|
138
|
+
*/
|
|
139
|
+
getMergedConfig(): ChatConfig;
|
|
140
|
+
/**
|
|
141
|
+
* Destroy the chat widget
|
|
142
|
+
*/
|
|
143
|
+
destroy(): void;
|
|
144
|
+
private get _isChatEnabled();
|
|
145
|
+
/**
|
|
146
|
+
* Fetch chat settings from the server
|
|
147
|
+
* This enables "snippet-only" installation where widget configures from dashboard
|
|
148
|
+
*/
|
|
149
|
+
private _fetchServerSettings;
|
|
150
|
+
/**
|
|
151
|
+
* Show the chat bubble (launcher button) without fully loading the widget
|
|
152
|
+
* This creates a lightweight bubble that loads the full widget on click
|
|
153
|
+
*/
|
|
154
|
+
private _showBubble;
|
|
155
|
+
private get _scriptName();
|
|
156
|
+
/**
|
|
157
|
+
* Schedule preload on idle
|
|
158
|
+
*/
|
|
159
|
+
private _schedulePreload;
|
|
160
|
+
/**
|
|
161
|
+
* Lazy load and then execute callback
|
|
162
|
+
*/
|
|
163
|
+
private _lazyLoadAndThen;
|
|
164
|
+
/**
|
|
165
|
+
* Lazy load the chat script
|
|
166
|
+
*/
|
|
167
|
+
private _lazyLoad;
|
|
168
|
+
/**
|
|
169
|
+
* Called after the chat script is loaded
|
|
170
|
+
*/
|
|
171
|
+
private _onScriptLoaded;
|
|
172
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy Loaded Chat Implementation
|
|
3
|
+
*
|
|
4
|
+
* The actual chat widget implementation that is loaded on demand.
|
|
5
|
+
* This file is bundled into chat.js and loaded when chat is enabled.
|
|
6
|
+
*
|
|
7
|
+
* Uses Ably for real-time messaging.
|
|
8
|
+
*/
|
|
9
|
+
import type { VTilt } from "../../vtilt";
|
|
10
|
+
import type { ChatConfig, ChatChannel, LazyLoadedChatInterface } from "../../utils/globals";
|
|
11
|
+
import type { MessageCallback, TypingCallback, ConnectionCallback, Unsubscribe } from "./types";
|
|
12
|
+
export declare class LazyLoadedChat implements LazyLoadedChatInterface {
|
|
13
|
+
private _instance;
|
|
14
|
+
private _config;
|
|
15
|
+
private _state;
|
|
16
|
+
private _container;
|
|
17
|
+
private _widget;
|
|
18
|
+
private _bubble;
|
|
19
|
+
private _ably;
|
|
20
|
+
private _ablyChannel;
|
|
21
|
+
private _typingChannel;
|
|
22
|
+
private _connectionState;
|
|
23
|
+
private _messageCallbacks;
|
|
24
|
+
private _typingCallbacks;
|
|
25
|
+
private _connectionCallbacks;
|
|
26
|
+
private _typingTimeout;
|
|
27
|
+
private _typingDebounce;
|
|
28
|
+
private _isUserTyping;
|
|
29
|
+
private _initialUserReadAt;
|
|
30
|
+
private _isMarkingRead;
|
|
31
|
+
constructor(instance: VTilt, config?: ChatConfig);
|
|
32
|
+
get isOpen(): boolean;
|
|
33
|
+
get isConnected(): boolean;
|
|
34
|
+
get isLoading(): boolean;
|
|
35
|
+
get unreadCount(): number;
|
|
36
|
+
get channel(): ChatChannel | null;
|
|
37
|
+
open(): void;
|
|
38
|
+
close(): void;
|
|
39
|
+
toggle(): void;
|
|
40
|
+
show(): void;
|
|
41
|
+
hide(): void;
|
|
42
|
+
sendMessage(content: string): Promise<void>;
|
|
43
|
+
markAsRead(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Automatically mark unread agent/AI messages as read
|
|
46
|
+
* Called when widget opens or new messages arrive while open
|
|
47
|
+
*/
|
|
48
|
+
private _autoMarkAsRead;
|
|
49
|
+
/**
|
|
50
|
+
* Check if a message has been read by the user (using initial cursor)
|
|
51
|
+
*/
|
|
52
|
+
private _isMessageReadByUser;
|
|
53
|
+
onMessage(callback: MessageCallback): Unsubscribe;
|
|
54
|
+
onTyping(callback: TypingCallback): Unsubscribe;
|
|
55
|
+
onConnectionChange(callback: ConnectionCallback): Unsubscribe;
|
|
56
|
+
destroy(): void;
|
|
57
|
+
private _initializeChannel;
|
|
58
|
+
private _connectRealtime;
|
|
59
|
+
private _disconnectRealtime;
|
|
60
|
+
private _extractProjectId;
|
|
61
|
+
private _handleNewMessage;
|
|
62
|
+
private _handleTypingEvent;
|
|
63
|
+
private _handleReadCursorEvent;
|
|
64
|
+
private _notifyConnectionChange;
|
|
65
|
+
private _createUI;
|
|
66
|
+
private _attachEventListeners;
|
|
67
|
+
private _handleUserTyping;
|
|
68
|
+
private _sendTypingIndicator;
|
|
69
|
+
private _handleSend;
|
|
70
|
+
private _updateUI;
|
|
71
|
+
private _renderMessages;
|
|
72
|
+
private _getContainerStyles;
|
|
73
|
+
private _getBubbleStyles;
|
|
74
|
+
private _getBubbleHTML;
|
|
75
|
+
private _getWidgetStyles;
|
|
76
|
+
private _getWidgetHTML;
|
|
77
|
+
private _getMessageHTML;
|
|
78
|
+
/**
|
|
79
|
+
* Check if a message has been read by the agent using cursor comparison
|
|
80
|
+
*/
|
|
81
|
+
private _isMessageReadByAgent;
|
|
82
|
+
private _apiRequest;
|
|
83
|
+
private _trackEvent;
|
|
84
|
+
private _getTimeOpen;
|
|
85
|
+
private _escapeHTML;
|
|
86
|
+
private _formatTime;
|
|
87
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat Extension
|
|
3
|
+
*
|
|
4
|
+
* Exports for the chat widget extension.
|
|
5
|
+
* The main export is ChatWrapper which is included in the main bundle.
|
|
6
|
+
* The actual implementation (LazyLoadedChat) is loaded on demand.
|
|
7
|
+
*/
|
|
8
|
+
export { ChatWrapper } from "./chat-wrapper";
|
|
9
|
+
export * from "./types";
|
|
10
|
+
export type { ChatMessage, ChatChannel, ChatConfig, ChatTheme, LazyLoadedChatInterface, } from "../../utils/globals";
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat Extension Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the chat widget extension.
|
|
5
|
+
* Core types are re-exported from globals.ts for consistency.
|
|
6
|
+
*/
|
|
7
|
+
export type { ChatMessage, ChatChannel, ChatConfig, ChatTheme, LazyLoadedChatInterface, } from "../../utils/globals";
|
|
8
|
+
/**
|
|
9
|
+
* Sender types for chat messages
|
|
10
|
+
*/
|
|
11
|
+
export type SenderType = "user" | "agent" | "ai" | "system";
|
|
12
|
+
/**
|
|
13
|
+
* Channel status
|
|
14
|
+
*/
|
|
15
|
+
export type ChannelStatus = "open" | "closed" | "snoozed";
|
|
16
|
+
/**
|
|
17
|
+
* Content types for messages
|
|
18
|
+
*/
|
|
19
|
+
export type ContentType = "text" | "html" | "attachment";
|
|
20
|
+
/**
|
|
21
|
+
* Widget position options
|
|
22
|
+
*/
|
|
23
|
+
export type WidgetPosition = "bottom-right" | "bottom-left";
|
|
24
|
+
/**
|
|
25
|
+
* Connection state for realtime
|
|
26
|
+
*/
|
|
27
|
+
export type ConnectionState = "connecting" | "connected" | "disconnected" | "error";
|
|
28
|
+
/**
|
|
29
|
+
* Typing status event
|
|
30
|
+
*/
|
|
31
|
+
export interface TypingStatus {
|
|
32
|
+
channel_id: string;
|
|
33
|
+
sender_type: SenderType;
|
|
34
|
+
sender_id: string;
|
|
35
|
+
is_typing: boolean;
|
|
36
|
+
timestamp: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Presence status for users
|
|
40
|
+
*/
|
|
41
|
+
export interface PresenceStatus {
|
|
42
|
+
distinct_id: string;
|
|
43
|
+
status: "online" | "away" | "offline";
|
|
44
|
+
last_seen_at: string;
|
|
45
|
+
current_page_url?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Chat event names for analytics tracking
|
|
49
|
+
*/
|
|
50
|
+
export declare const CHAT_EVENTS: {
|
|
51
|
+
readonly STARTED: "$chat_started";
|
|
52
|
+
readonly MESSAGE_SENT: "$chat_message_sent";
|
|
53
|
+
readonly MESSAGE_RECEIVED: "$chat_message_received";
|
|
54
|
+
readonly AI_HANDOFF: "$chat_ai_handoff";
|
|
55
|
+
readonly CLOSED: "$chat_closed";
|
|
56
|
+
readonly READ: "$chat_read";
|
|
57
|
+
readonly WIDGET_OPENED: "$chat_widget_opened";
|
|
58
|
+
readonly WIDGET_CLOSED: "$chat_widget_closed";
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Chat event properties for $chat_message_sent
|
|
62
|
+
*/
|
|
63
|
+
export interface ChatMessageSentEventProperties {
|
|
64
|
+
$channel_id: string;
|
|
65
|
+
$message_id: string;
|
|
66
|
+
$content_preview: string;
|
|
67
|
+
$sender_type: SenderType;
|
|
68
|
+
$ai_mode: boolean;
|
|
69
|
+
$word_count: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Chat event properties for $chat_message_received
|
|
73
|
+
*/
|
|
74
|
+
export interface ChatMessageReceivedEventProperties {
|
|
75
|
+
$channel_id: string;
|
|
76
|
+
$message_id: string;
|
|
77
|
+
$content_preview: string;
|
|
78
|
+
$sender_type: SenderType;
|
|
79
|
+
$response_time_ms?: number;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Chat event properties for $chat_started
|
|
83
|
+
*/
|
|
84
|
+
export interface ChatStartedEventProperties {
|
|
85
|
+
$channel_id: string;
|
|
86
|
+
$initiated_by: "user" | "agent";
|
|
87
|
+
$ai_mode: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Chat event properties for $chat_closed
|
|
91
|
+
*/
|
|
92
|
+
export interface ChatClosedEventProperties {
|
|
93
|
+
$channel_id: string;
|
|
94
|
+
$resolved_by: "agent" | "user" | "system" | "auto";
|
|
95
|
+
$resolution: "resolved" | "unresolved" | "abandoned";
|
|
96
|
+
$message_count: number;
|
|
97
|
+
$duration_seconds: number;
|
|
98
|
+
$ai_only: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Internal widget state
|
|
102
|
+
*/
|
|
103
|
+
export interface ChatWidgetState {
|
|
104
|
+
isOpen: boolean;
|
|
105
|
+
isVisible: boolean;
|
|
106
|
+
isConnected: boolean;
|
|
107
|
+
isLoading: boolean;
|
|
108
|
+
unreadCount: number;
|
|
109
|
+
channel: import("../../utils/globals").ChatChannel | null;
|
|
110
|
+
messages: import("../../utils/globals").ChatMessage[];
|
|
111
|
+
isTyping: boolean;
|
|
112
|
+
typingSender: string | null;
|
|
113
|
+
agentLastReadAt: string | null;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Message callback type
|
|
117
|
+
*/
|
|
118
|
+
export type MessageCallback = (message: import("../../utils/globals").ChatMessage) => void;
|
|
119
|
+
/**
|
|
120
|
+
* Typing callback type
|
|
121
|
+
*/
|
|
122
|
+
export type TypingCallback = (isTyping: boolean, senderType: string) => void;
|
|
123
|
+
/**
|
|
124
|
+
* Connection callback type
|
|
125
|
+
*/
|
|
126
|
+
export type ConnectionCallback = (connected: boolean) => void;
|
|
127
|
+
/**
|
|
128
|
+
* Unsubscribe function type
|
|
129
|
+
*/
|
|
130
|
+
export type Unsubscribe = () => void;
|
|
131
|
+
/**
|
|
132
|
+
* API response for creating a channel
|
|
133
|
+
*/
|
|
134
|
+
export interface CreateChannelResponse {
|
|
135
|
+
channel: import("../../utils/globals").ChatChannel;
|
|
136
|
+
config: {
|
|
137
|
+
ai_enabled: boolean;
|
|
138
|
+
ai_greeting: string | null;
|
|
139
|
+
widget_greeting: string | null;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* API response for sending a message
|
|
144
|
+
*/
|
|
145
|
+
export interface SendMessageResponse {
|
|
146
|
+
message: import("../../utils/globals").ChatMessage;
|
|
147
|
+
ai_response?: import("../../utils/globals").ChatMessage;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Ably realtime channel for chat
|
|
151
|
+
*/
|
|
152
|
+
export interface AblyChannel {
|
|
153
|
+
subscribe: (event: string, callback: (message: unknown) => void) => void;
|
|
154
|
+
unsubscribe: () => void;
|
|
155
|
+
publish: (event: string, data: unknown) => Promise<void>;
|
|
156
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(n){"use strict";var i="undefined"!=typeof window?window:void 0,l="undefined"!=typeof globalThis?globalThis:i,r=null==l?void 0:l.navigator,o=null==l?void 0:l.document;null==l||l.location,null==l||l.fetch,(null==l?void 0:l.XMLHttpRequest)&&"withCredentials"in new l.XMLHttpRequest&&l.XMLHttpRequest,null==l||l.AbortController,null==r||r.userAgent;var t=null!=i?i:{},d=(n,i,l)=>{if(n.getConfig().disable_external_dependency_loading)return console.warn("[ExternalScriptsLoader] "+i+" was requested but loading of external scripts is disabled."),l("Loading of external scripts is disabled");var r=null==o?void 0:o.querySelectorAll("script");if(r)for(var t,d=function(){if(r[e].src===i){var n=r[e];return n.__vtilt_loading_callback_fired?{v:l()}:(n.addEventListener("load",i=>{n.__vtilt_loading_callback_fired=!0,l(void 0,i)}),n.onerror=n=>l(n),{v:void 0})}},e=0;e<r.length;e++)if(t=d())return t.v;var a=()=>{var n;if(!o)return l("document not found");var r=o.createElement("script");r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=n=>{r.__vtilt_loading_callback_fired=!0,l(void 0,n)},r.onerror=n=>l(n);var t=o.querySelectorAll("body > script");t.length>0?null===(n=t[0].parentNode)||void 0===n||n.insertBefore(r,t[0]):o.body.appendChild(r)};(null==o?void 0:o.body)?a():null==o||o.addEventListener("DOMContentLoaded",a)},e=(n,i)=>{var l=n.getConfig();return l.script_host?l.script_host.replace(/\/+$/gm,"")+"/dist/"+i+".js":"https://unpkg.com/@v-tilt/browser@1.
|
|
1
|
+
!function(n){"use strict";var i="undefined"!=typeof window?window:void 0,l="undefined"!=typeof globalThis?globalThis:i,r=null==l?void 0:l.navigator,o=null==l?void 0:l.document;null==l||l.location,null==l||l.fetch,(null==l?void 0:l.XMLHttpRequest)&&"withCredentials"in new l.XMLHttpRequest&&l.XMLHttpRequest,null==l||l.AbortController,null==r||r.userAgent;var t=null!=i?i:{},d=(n,i,l)=>{if(n.getConfig().disable_external_dependency_loading)return console.warn("[ExternalScriptsLoader] "+i+" was requested but loading of external scripts is disabled."),l("Loading of external scripts is disabled");var r=null==o?void 0:o.querySelectorAll("script");if(r)for(var t,d=function(){if(r[e].src===i){var n=r[e];return n.__vtilt_loading_callback_fired?{v:l()}:(n.addEventListener("load",i=>{n.__vtilt_loading_callback_fired=!0,l(void 0,i)}),n.onerror=n=>l(n),{v:void 0})}},e=0;e<r.length;e++)if(t=d())return t.v;var a=()=>{var n;if(!o)return l("document not found");var r=o.createElement("script");r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=n=>{r.__vtilt_loading_callback_fired=!0,l(void 0,n)},r.onerror=n=>l(n);var t=o.querySelectorAll("body > script");t.length>0?null===(n=t[0].parentNode)||void 0===n||n.insertBefore(r,t[0]):o.body.appendChild(r)};(null==o?void 0:o.body)?a():null==o||o.addEventListener("DOMContentLoaded",a)},e=(n,i)=>{var l=n.getConfig();return l.script_host?l.script_host.replace(/\/+$/gm,"")+"/dist/"+i+".js":"https://unpkg.com/@v-tilt/browser@1.4.1/dist/"+i+".js"};t.__VTiltExtensions__=t.__VTiltExtensions__||{},t.__VTiltExtensions__.loadExternalDependency=(n,i,l)=>{var r=e(n,i);d(n,r,l)},n.getExtensionUrl=e,n.loadScript=d}({});
|
|
2
2
|
//# sourceMappingURL=external-scripts-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-scripts-loader.js","sources":["../src/utils/globals.ts","../src/entrypoints/external-scripts-loader.ts"],"sourcesContent":[null,null],"names":["win","window","undefined","global","globalThis","navigator","document","location","fetch","XMLHttpRequest","AbortController","userAgent","assignableWindow","loadScript","vtilt","url","callback","getConfig","disable_external_dependency_loading","console","warn","LOGGER_PREFIX","existingScripts","querySelectorAll","_ret","_loop","i","src","alreadyExistingScriptTag","__vtilt_loading_callback_fired","v","addEventListener","event","onerror","error","length","addScript","scriptTag","createElement","type","crossOrigin","onload","scripts","_a","parentNode","insertBefore","body","appendChild","getExtensionUrl","kind","config","script_host","replace","__VTiltExtensions__","loadExternalDependency"],"mappings":"0BAaA,IAAMA,EACc,oBAAXC,OAAyBA,YAASC,
|
|
1
|
+
{"version":3,"file":"external-scripts-loader.js","sources":["../src/utils/globals.ts","../src/entrypoints/external-scripts-loader.ts"],"sourcesContent":[null,null],"names":["win","window","undefined","global","globalThis","navigator","document","location","fetch","XMLHttpRequest","AbortController","userAgent","assignableWindow","loadScript","vtilt","url","callback","getConfig","disable_external_dependency_loading","console","warn","LOGGER_PREFIX","existingScripts","querySelectorAll","_ret","_loop","i","src","alreadyExistingScriptTag","__vtilt_loading_callback_fired","v","addEventListener","event","onerror","error","length","addScript","scriptTag","createElement","type","crossOrigin","onload","scripts","_a","parentNode","insertBefore","body","appendChild","getExtensionUrl","kind","config","script_host","replace","__VTiltExtensions__","loadExternalDependency"],"mappings":"0BAaA,IAAMA,EACc,oBAAXC,OAAyBA,YAASC,EAuOrCC,EACkB,oBAAfC,WAA6BA,WAAaJ,EAMtCK,EAAYF,aAAM,EAANA,EAAQE,UACpBC,EAAWH,aAAM,EAANA,EAAQG,SACRH,SAAAA,EAAQI,SACXJ,SAAAA,EAAQK,OAE3BL,aAAM,EAANA,EAAQM,iBAAkB,oBAAqB,IAAIN,EAAOM,gBACtDN,EAAOM,eAEkBN,SAAAA,EAAQO,gBACdL,SAAAA,EAAWM,UAC7B,IAAMC,EAAqCZ,QAAAA,EAAQ,CAAA,ECnPpDa,EAAaA,CACjBC,EACAC,EACAC,KAKA,GAHeF,EAAMG,YAGDC,oCAIlB,OAHAC,QAAQC,KACHC,2BAAiBN,iEAEfC,EAAS,2CAIlB,IAAMM,EAAkBhB,aAAQ,EAARA,EAAUiB,iBAAiB,UACnD,GAAID,EACF,IADmB,IAuBlBE,EAvBkBC,EAAA,WAEjB,GAAIH,EAAgBI,GAAGC,MAAQZ,EAAK,CAClC,IAAMa,EAA2BN,EAC/BI,GAKF,OAAIE,EAAyBC,+BAC3B,CAAAC,EACOd,MAITY,EAAyBG,iBAAiB,OAASC,IACjDJ,EAAyBC,gCAAiC,EAC1Db,OAASd,EAAW8B,KAEtBJ,EAAyBK,QAAWC,GAAUlB,EAASkB,GAAO,CAAAJ,OAAA,GAGhE,CACF,EAtBSJ,EAAI,EAAGA,EAAIJ,EAAgBa,OAAQT,IAAG,GAAAF,EAAAC,IAAA,OAAAD,EAAAM,EAyBjD,IAAMM,EAAYA,WAChB,IAAK9B,EACH,OAAOU,EAAS,sBAGlB,IAAMqB,EAAY/B,EAASgC,cAAc,UAGzCD,EAAUE,KAAO,kBACjBF,EAAUG,YAAc,YACxBH,EAAUV,IAAMZ,EAChBsB,EAAUI,OAAUT,IAClBK,EAAUR,gCAAiC,EAC3Cb,OAASd,EAAW8B,IAEtBK,EAAUJ,QAAWC,GAAUlB,EAASkB,GAExC,IAAMQ,EAAUpC,EAASiB,iBAAiB,iBACtCmB,EAAQP,OAAS,EACE,QAArBQ,EAAAD,EAAQ,GAAGE,kBAAU,IAAAD,GAAAA,EAAEE,aAAaR,EAAWK,EAAQ,IAEvDpC,EAASwC,KAAKC,YAAYV,KAI1B/B,aAAQ,EAARA,EAAUwC,MACZV,IAEA9B,SAAAA,EAAUyB,iBAAiB,mBAAoBK,IAmB7CY,EAAkBA,CAAClC,EAAcmC,KACrC,IAAMC,EAASpC,EAAMG,YAGrB,OAAIiC,EAAOC,YACSD,EAAOC,YAAYC,QAAQ,SAAU,aAC3BH,EAAI,MAKlC,gDAAgEA,EAAI,OAItErC,EAAiByC,oBACfzC,EAAiByC,qBAAuB,CAAA,EAK1CzC,EAAiByC,oBAAoBC,uBAAyB,CAC5DxC,EACAmC,EACAjC,KAEA,IAAMD,EAAMiC,EAAgBlC,EAAOmC,GACnCpC,EAAWC,EAAOC,EAAKC"}
|