@scalemule/chat 0.0.7 → 0.0.8
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/react.cjs +159 -111
- package/dist/react.js +83 -35
- package/package.json +1 -1
- package/dist/ChatClient-DQPHdUHX.d.cts +0 -107
- package/dist/ChatClient-DtUKF-4c.d.ts +0 -107
- package/dist/constants.d.ts +0 -9
- package/dist/constants.d.ts.map +0 -1
- package/dist/core/ChatClient.d.ts +0 -96
- package/dist/core/ChatClient.d.ts.map +0 -1
- package/dist/core/EventEmitter.d.ts +0 -11
- package/dist/core/EventEmitter.d.ts.map +0 -1
- package/dist/core/MessageCache.d.ts +0 -18
- package/dist/core/MessageCache.d.ts.map +0 -1
- package/dist/core/OfflineQueue.d.ts +0 -19
- package/dist/core/OfflineQueue.d.ts.map +0 -1
- package/dist/element.d.cts +0 -2
- package/dist/element.d.ts +0 -2
- package/dist/element.d.ts.map +0 -1
- package/dist/embed/index.d.ts +0 -2
- package/dist/embed/index.d.ts.map +0 -1
- package/dist/factory.d.ts +0 -8
- package/dist/factory.d.ts.map +0 -1
- package/dist/iframe.d.cts +0 -17
- package/dist/iframe.d.ts +0 -15
- package/dist/iframe.d.ts.map +0 -1
- package/dist/index.d.cts +0 -166
- package/dist/index.d.ts +0 -8
- package/dist/index.d.ts.map +0 -1
- package/dist/react-components/ChatInput.d.ts +0 -16
- package/dist/react-components/ChatInput.d.ts.map +0 -1
- package/dist/react-components/ChatMessageItem.d.ts +0 -13
- package/dist/react-components/ChatMessageItem.d.ts.map +0 -1
- package/dist/react-components/ChatMessageList.d.ts +0 -15
- package/dist/react-components/ChatMessageList.d.ts.map +0 -1
- package/dist/react-components/ChatThread.d.ts +0 -12
- package/dist/react-components/ChatThread.d.ts.map +0 -1
- package/dist/react-components/ConversationList.d.ts +0 -13
- package/dist/react-components/ConversationList.d.ts.map +0 -1
- package/dist/react-components/EmojiPicker.d.ts +0 -8
- package/dist/react-components/EmojiPicker.d.ts.map +0 -1
- package/dist/react-components/index.d.ts +0 -8
- package/dist/react-components/index.d.ts.map +0 -1
- package/dist/react-components/theme.d.ts +0 -19
- package/dist/react-components/theme.d.ts.map +0 -1
- package/dist/react-components/utils.d.ts +0 -4
- package/dist/react-components/utils.d.ts.map +0 -1
- package/dist/react.d.cts +0 -145
- package/dist/react.d.ts +0 -72
- package/dist/react.d.ts.map +0 -1
- package/dist/shared/ChatController.d.ts +0 -65
- package/dist/shared/ChatController.d.ts.map +0 -1
- package/dist/shared/upload.d.ts +0 -3
- package/dist/shared/upload.d.ts.map +0 -1
- package/dist/support.d.ts +0 -99
- package/dist/support.d.ts.map +0 -1
- package/dist/transport/HttpTransport.d.ts +0 -20
- package/dist/transport/HttpTransport.d.ts.map +0 -1
- package/dist/transport/WebSocketTransport.d.ts +0 -78
- package/dist/transport/WebSocketTransport.d.ts.map +0 -1
- package/dist/types-COPVrm3K.d.cts +0 -256
- package/dist/types-COPVrm3K.d.ts +0 -256
- package/dist/types.d.ts +0 -271
- package/dist/types.d.ts.map +0 -1
- package/dist/umd.d.ts +0 -6
- package/dist/umd.d.ts.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
- package/dist/widget/icons.d.ts +0 -8
- package/dist/widget/icons.d.ts.map +0 -1
- package/dist/widget/index.d.ts +0 -2
- package/dist/widget/index.d.ts.map +0 -1
- package/dist/widget/storage.d.ts +0 -5
- package/dist/widget/storage.d.ts.map +0 -1
- package/dist/widget/styles.d.ts +0 -3
- package/dist/widget/styles.d.ts.map +0 -1
package/dist/react.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ChatClient } from './chunk-5O5YLRJL.js';
|
|
2
2
|
export { ChatClient } from './chunk-5O5YLRJL.js';
|
|
3
|
-
import
|
|
3
|
+
import React4, { createContext, useState, useRef, useMemo, useEffect, useCallback, useContext } from 'react';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
|
+
import { createPortal } from 'react-dom';
|
|
5
6
|
|
|
6
7
|
function ChatInput({
|
|
7
8
|
onSend,
|
|
@@ -230,43 +231,90 @@ function ChatInput({
|
|
|
230
231
|
}
|
|
231
232
|
);
|
|
232
233
|
}
|
|
233
|
-
var
|
|
234
|
+
var QUICK_REACTIONS = ["\u2764\uFE0F", "\u{1F602}", "\u{1F44D}", "\u{1F525}", "\u{1F62E}", "\u{1F622}", "\u{1F44F}", "\u{1F64C}"];
|
|
234
235
|
function EmojiPicker({
|
|
235
236
|
onSelect,
|
|
236
|
-
|
|
237
|
+
onClose,
|
|
238
|
+
anchorRef,
|
|
239
|
+
emojis = QUICK_REACTIONS
|
|
237
240
|
}) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
style: {
|
|
257
|
-
width: 32,
|
|
258
|
-
height: 32,
|
|
259
|
-
border: "none",
|
|
260
|
-
background: "transparent",
|
|
261
|
-
borderRadius: 999,
|
|
262
|
-
cursor: "pointer",
|
|
263
|
-
fontSize: 18
|
|
264
|
-
},
|
|
265
|
-
children: emoji
|
|
266
|
-
},
|
|
267
|
-
emoji
|
|
268
|
-
))
|
|
241
|
+
const ref = useRef(null);
|
|
242
|
+
const [position, setPosition] = useState(null);
|
|
243
|
+
useEffect(() => {
|
|
244
|
+
const anchor = anchorRef.current;
|
|
245
|
+
if (!anchor) return;
|
|
246
|
+
const rect = anchor.getBoundingClientRect();
|
|
247
|
+
const pickerWidth = emojis.length * 36 + 16;
|
|
248
|
+
let left = rect.left + rect.width / 2 - pickerWidth / 2;
|
|
249
|
+
if (left < 8) left = 8;
|
|
250
|
+
if (left + pickerWidth > window.innerWidth - 8)
|
|
251
|
+
left = window.innerWidth - 8 - pickerWidth;
|
|
252
|
+
setPosition({ top: rect.top - 8, left });
|
|
253
|
+
}, [anchorRef, emojis.length]);
|
|
254
|
+
useEffect(() => {
|
|
255
|
+
function handleClickOutside(e) {
|
|
256
|
+
if (ref.current && !ref.current.contains(e.target) && anchorRef.current && !anchorRef.current.contains(e.target)) {
|
|
257
|
+
onClose();
|
|
258
|
+
}
|
|
269
259
|
}
|
|
260
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
261
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
262
|
+
}, [onClose, anchorRef]);
|
|
263
|
+
if (!position) return null;
|
|
264
|
+
return createPortal(
|
|
265
|
+
/* @__PURE__ */ jsx(
|
|
266
|
+
"div",
|
|
267
|
+
{
|
|
268
|
+
ref,
|
|
269
|
+
style: {
|
|
270
|
+
position: "fixed",
|
|
271
|
+
top: position.top,
|
|
272
|
+
left: position.left,
|
|
273
|
+
transform: "translateY(-100%)",
|
|
274
|
+
background: "var(--sm-surface, #fff)",
|
|
275
|
+
border: "1px solid var(--sm-border-color, #e5e7eb)",
|
|
276
|
+
borderRadius: 12,
|
|
277
|
+
boxShadow: "0 10px 25px rgba(15, 23, 42, 0.12)",
|
|
278
|
+
padding: 8,
|
|
279
|
+
display: "flex",
|
|
280
|
+
gap: 4,
|
|
281
|
+
zIndex: 9999
|
|
282
|
+
},
|
|
283
|
+
children: emojis.map((emoji) => /* @__PURE__ */ jsx(
|
|
284
|
+
"button",
|
|
285
|
+
{
|
|
286
|
+
onClick: () => {
|
|
287
|
+
onSelect(emoji);
|
|
288
|
+
onClose();
|
|
289
|
+
},
|
|
290
|
+
type: "button",
|
|
291
|
+
"aria-label": `React with ${emoji}`,
|
|
292
|
+
style: {
|
|
293
|
+
width: 32,
|
|
294
|
+
height: 32,
|
|
295
|
+
display: "flex",
|
|
296
|
+
alignItems: "center",
|
|
297
|
+
justifyContent: "center",
|
|
298
|
+
borderRadius: 8,
|
|
299
|
+
border: "none",
|
|
300
|
+
background: "transparent",
|
|
301
|
+
cursor: "pointer",
|
|
302
|
+
fontSize: 18,
|
|
303
|
+
transition: "background 0.15s ease"
|
|
304
|
+
},
|
|
305
|
+
onMouseEnter: (e) => {
|
|
306
|
+
e.target.style.background = "var(--sm-surface-muted, #f8fafc)";
|
|
307
|
+
},
|
|
308
|
+
onMouseLeave: (e) => {
|
|
309
|
+
e.target.style.background = "transparent";
|
|
310
|
+
},
|
|
311
|
+
children: emoji
|
|
312
|
+
},
|
|
313
|
+
emoji
|
|
314
|
+
))
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
document.body
|
|
270
318
|
);
|
|
271
319
|
}
|
|
272
320
|
|
|
@@ -590,7 +638,7 @@ function ChatMessageList({
|
|
|
590
638
|
const previousMessage = messages[index - 1];
|
|
591
639
|
const showDateDivider = !previousMessage || !isSameDay(previousMessage.created_at, message.created_at);
|
|
592
640
|
const showUnreadDivider = unreadIndex === index;
|
|
593
|
-
return /* @__PURE__ */ jsxs(
|
|
641
|
+
return /* @__PURE__ */ jsxs(React4.Fragment, { children: [
|
|
594
642
|
showDateDivider ? /* @__PURE__ */ jsx(
|
|
595
643
|
"div",
|
|
596
644
|
{
|
package/package.json
CHANGED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { a as ChatEventMap, C as ChatConfig, b as ConnectionStatus, c as CreateConversationOptions, A as ApiResponse, d as Conversation, L as ListConversationsOptions, S as SendMessageOptions, e as ChatMessage, G as GetMessagesOptions, M as MessagesResponse, f as Attachment, U as UnreadTotalResponse, R as ReadStatus, g as ChannelSettings, h as ChannelWithSettings, i as CreateEphemeralChannelOptions, j as CreateLargeRoomOptions } from './types-COPVrm3K.cjs';
|
|
2
|
-
|
|
3
|
-
type Listener<T> = (data: T) => void;
|
|
4
|
-
declare class EventEmitter<EventMap extends Record<string, any>> {
|
|
5
|
-
private listeners;
|
|
6
|
-
on<K extends keyof EventMap>(event: K, callback: Listener<EventMap[K]>): () => void;
|
|
7
|
-
off<K extends keyof EventMap>(event: K, callback: Listener<EventMap[K]>): void;
|
|
8
|
-
once<K extends keyof EventMap>(event: K, callback: Listener<EventMap[K]>): () => void;
|
|
9
|
-
emit<K extends keyof EventMap>(event: K, ...[data]: EventMap[K] extends void ? [] : [EventMap[K]]): void;
|
|
10
|
-
removeAllListeners(event?: keyof EventMap): void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
declare class ChatClient extends EventEmitter<ChatEventMap> {
|
|
14
|
-
private http;
|
|
15
|
-
private ws;
|
|
16
|
-
private cache;
|
|
17
|
-
private offlineQueue;
|
|
18
|
-
private conversationSubs;
|
|
19
|
-
private conversationTypes;
|
|
20
|
-
private currentUserId?;
|
|
21
|
-
constructor(config: ChatConfig);
|
|
22
|
-
get status(): ConnectionStatus;
|
|
23
|
-
get userId(): string | undefined;
|
|
24
|
-
connect(): void;
|
|
25
|
-
disconnect(): void;
|
|
26
|
-
createConversation(options: CreateConversationOptions): Promise<ApiResponse<Conversation>>;
|
|
27
|
-
listConversations(options?: ListConversationsOptions): Promise<ApiResponse<Conversation[]>>;
|
|
28
|
-
getConversation(id: string): Promise<ApiResponse<Conversation>>;
|
|
29
|
-
private trackConversationType;
|
|
30
|
-
sendMessage(conversationId: string, options: SendMessageOptions): Promise<ApiResponse<ChatMessage>>;
|
|
31
|
-
getMessages(conversationId: string, options?: GetMessagesOptions): Promise<ApiResponse<MessagesResponse>>;
|
|
32
|
-
editMessage(messageId: string, content: string): Promise<ApiResponse<void>>;
|
|
33
|
-
deleteMessage(messageId: string): Promise<ApiResponse<void>>;
|
|
34
|
-
uploadAttachment(file: File | Blob, onProgress?: (percent: number) => void, signal?: AbortSignal): Promise<ApiResponse<Attachment>>;
|
|
35
|
-
refreshAttachmentUrl(messageId: string, fileId: string): Promise<ApiResponse<{
|
|
36
|
-
url: string;
|
|
37
|
-
}>>;
|
|
38
|
-
getCachedMessages(conversationId: string): ChatMessage[];
|
|
39
|
-
stageOptimisticMessage(conversationId: string, message: ChatMessage): ChatMessage;
|
|
40
|
-
addReaction(messageId: string, emoji: string): Promise<ApiResponse<void>>;
|
|
41
|
-
removeReaction(messageId: string, emoji: string): Promise<ApiResponse<void>>;
|
|
42
|
-
reportMessage(messageId: string, reason: 'spam' | 'harassment' | 'hate' | 'violence' | 'other', description?: string): Promise<ApiResponse<{
|
|
43
|
-
reported: boolean;
|
|
44
|
-
}>>;
|
|
45
|
-
muteConversation(conversationId: string, mutedUntil?: string): Promise<ApiResponse<{
|
|
46
|
-
muted: boolean;
|
|
47
|
-
}>>;
|
|
48
|
-
unmuteConversation(conversationId: string): Promise<ApiResponse<{
|
|
49
|
-
muted: boolean;
|
|
50
|
-
}>>;
|
|
51
|
-
getUnreadTotal(): Promise<ApiResponse<UnreadTotalResponse>>;
|
|
52
|
-
sendTyping(conversationId: string, isTyping?: boolean): Promise<void>;
|
|
53
|
-
markRead(conversationId: string): Promise<void>;
|
|
54
|
-
getReadStatus(conversationId: string): Promise<ApiResponse<{
|
|
55
|
-
statuses: ReadStatus[];
|
|
56
|
-
}>>;
|
|
57
|
-
addParticipant(conversationId: string, userId: string): Promise<ApiResponse<void>>;
|
|
58
|
-
removeParticipant(conversationId: string, userId: string): Promise<ApiResponse<void>>;
|
|
59
|
-
joinPresence(conversationId: string, userData?: unknown): void;
|
|
60
|
-
leavePresence(conversationId: string): void;
|
|
61
|
-
/** Update presence status (online/away/dnd) without leaving the channel. */
|
|
62
|
-
updatePresence(conversationId: string, status: 'online' | 'away' | 'dnd', userData?: unknown): void;
|
|
63
|
-
getChannelSettings(channelId: string): Promise<ApiResponse<ChannelSettings>>;
|
|
64
|
-
/**
|
|
65
|
-
* Set the conversation type for channel name routing.
|
|
66
|
-
* Large rooms use `conversation:lr:` prefix to skip MySQL in the realtime service.
|
|
67
|
-
*/
|
|
68
|
-
setConversationType(conversationId: string, type: Conversation['conversation_type']): void;
|
|
69
|
-
/**
|
|
70
|
-
* Find an active ephemeral or large_room channel by linked session ID.
|
|
71
|
-
* Returns null (not an error) if no active channel exists.
|
|
72
|
-
*/
|
|
73
|
-
findChannelBySessionId(linkedSessionId: string): Promise<ChannelWithSettings | null>;
|
|
74
|
-
/**
|
|
75
|
-
* Self-join an ephemeral or large_room channel. Idempotent.
|
|
76
|
-
*/
|
|
77
|
-
joinChannel(channelId: string): Promise<ApiResponse<{
|
|
78
|
-
participant_id: string;
|
|
79
|
-
role: string;
|
|
80
|
-
joined_at: string;
|
|
81
|
-
}>>;
|
|
82
|
-
/**
|
|
83
|
-
* Create an ephemeral channel tied to a session (e.g., a video snap).
|
|
84
|
-
*/
|
|
85
|
-
createEphemeralChannel(options: CreateEphemeralChannelOptions): Promise<ApiResponse<ChannelWithSettings>>;
|
|
86
|
-
/**
|
|
87
|
-
* Create a large room channel (high-concurrency, skips MySQL tracking in realtime).
|
|
88
|
-
*/
|
|
89
|
-
createLargeRoom(options: CreateLargeRoomOptions): Promise<ApiResponse<ChannelWithSettings>>;
|
|
90
|
-
/**
|
|
91
|
-
* Get the global concurrent subscriber count for a conversation.
|
|
92
|
-
*/
|
|
93
|
-
getSubscriberCount(conversationId: string): Promise<number>;
|
|
94
|
-
subscribeToConversation(conversationId: string): () => void;
|
|
95
|
-
/** Build channel name with correct prefix based on conversation type. */
|
|
96
|
-
private channelName;
|
|
97
|
-
destroy(): void;
|
|
98
|
-
private handleRealtimeMessage;
|
|
99
|
-
private handlePrivateMessage;
|
|
100
|
-
private normalizeMessage;
|
|
101
|
-
private buildEditedMessage;
|
|
102
|
-
private applyReactionEvent;
|
|
103
|
-
private handleConversationMessage;
|
|
104
|
-
private flushOfflineQueue;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export { ChatClient as C, EventEmitter as E };
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { a as ChatEventMap, C as ChatConfig, b as ConnectionStatus, c as CreateConversationOptions, A as ApiResponse, d as Conversation, L as ListConversationsOptions, S as SendMessageOptions, e as ChatMessage, G as GetMessagesOptions, M as MessagesResponse, f as Attachment, U as UnreadTotalResponse, R as ReadStatus, g as ChannelSettings, h as ChannelWithSettings, i as CreateEphemeralChannelOptions, j as CreateLargeRoomOptions } from './types-COPVrm3K.js';
|
|
2
|
-
|
|
3
|
-
type Listener<T> = (data: T) => void;
|
|
4
|
-
declare class EventEmitter<EventMap extends Record<string, any>> {
|
|
5
|
-
private listeners;
|
|
6
|
-
on<K extends keyof EventMap>(event: K, callback: Listener<EventMap[K]>): () => void;
|
|
7
|
-
off<K extends keyof EventMap>(event: K, callback: Listener<EventMap[K]>): void;
|
|
8
|
-
once<K extends keyof EventMap>(event: K, callback: Listener<EventMap[K]>): () => void;
|
|
9
|
-
emit<K extends keyof EventMap>(event: K, ...[data]: EventMap[K] extends void ? [] : [EventMap[K]]): void;
|
|
10
|
-
removeAllListeners(event?: keyof EventMap): void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
declare class ChatClient extends EventEmitter<ChatEventMap> {
|
|
14
|
-
private http;
|
|
15
|
-
private ws;
|
|
16
|
-
private cache;
|
|
17
|
-
private offlineQueue;
|
|
18
|
-
private conversationSubs;
|
|
19
|
-
private conversationTypes;
|
|
20
|
-
private currentUserId?;
|
|
21
|
-
constructor(config: ChatConfig);
|
|
22
|
-
get status(): ConnectionStatus;
|
|
23
|
-
get userId(): string | undefined;
|
|
24
|
-
connect(): void;
|
|
25
|
-
disconnect(): void;
|
|
26
|
-
createConversation(options: CreateConversationOptions): Promise<ApiResponse<Conversation>>;
|
|
27
|
-
listConversations(options?: ListConversationsOptions): Promise<ApiResponse<Conversation[]>>;
|
|
28
|
-
getConversation(id: string): Promise<ApiResponse<Conversation>>;
|
|
29
|
-
private trackConversationType;
|
|
30
|
-
sendMessage(conversationId: string, options: SendMessageOptions): Promise<ApiResponse<ChatMessage>>;
|
|
31
|
-
getMessages(conversationId: string, options?: GetMessagesOptions): Promise<ApiResponse<MessagesResponse>>;
|
|
32
|
-
editMessage(messageId: string, content: string): Promise<ApiResponse<void>>;
|
|
33
|
-
deleteMessage(messageId: string): Promise<ApiResponse<void>>;
|
|
34
|
-
uploadAttachment(file: File | Blob, onProgress?: (percent: number) => void, signal?: AbortSignal): Promise<ApiResponse<Attachment>>;
|
|
35
|
-
refreshAttachmentUrl(messageId: string, fileId: string): Promise<ApiResponse<{
|
|
36
|
-
url: string;
|
|
37
|
-
}>>;
|
|
38
|
-
getCachedMessages(conversationId: string): ChatMessage[];
|
|
39
|
-
stageOptimisticMessage(conversationId: string, message: ChatMessage): ChatMessage;
|
|
40
|
-
addReaction(messageId: string, emoji: string): Promise<ApiResponse<void>>;
|
|
41
|
-
removeReaction(messageId: string, emoji: string): Promise<ApiResponse<void>>;
|
|
42
|
-
reportMessage(messageId: string, reason: 'spam' | 'harassment' | 'hate' | 'violence' | 'other', description?: string): Promise<ApiResponse<{
|
|
43
|
-
reported: boolean;
|
|
44
|
-
}>>;
|
|
45
|
-
muteConversation(conversationId: string, mutedUntil?: string): Promise<ApiResponse<{
|
|
46
|
-
muted: boolean;
|
|
47
|
-
}>>;
|
|
48
|
-
unmuteConversation(conversationId: string): Promise<ApiResponse<{
|
|
49
|
-
muted: boolean;
|
|
50
|
-
}>>;
|
|
51
|
-
getUnreadTotal(): Promise<ApiResponse<UnreadTotalResponse>>;
|
|
52
|
-
sendTyping(conversationId: string, isTyping?: boolean): Promise<void>;
|
|
53
|
-
markRead(conversationId: string): Promise<void>;
|
|
54
|
-
getReadStatus(conversationId: string): Promise<ApiResponse<{
|
|
55
|
-
statuses: ReadStatus[];
|
|
56
|
-
}>>;
|
|
57
|
-
addParticipant(conversationId: string, userId: string): Promise<ApiResponse<void>>;
|
|
58
|
-
removeParticipant(conversationId: string, userId: string): Promise<ApiResponse<void>>;
|
|
59
|
-
joinPresence(conversationId: string, userData?: unknown): void;
|
|
60
|
-
leavePresence(conversationId: string): void;
|
|
61
|
-
/** Update presence status (online/away/dnd) without leaving the channel. */
|
|
62
|
-
updatePresence(conversationId: string, status: 'online' | 'away' | 'dnd', userData?: unknown): void;
|
|
63
|
-
getChannelSettings(channelId: string): Promise<ApiResponse<ChannelSettings>>;
|
|
64
|
-
/**
|
|
65
|
-
* Set the conversation type for channel name routing.
|
|
66
|
-
* Large rooms use `conversation:lr:` prefix to skip MySQL in the realtime service.
|
|
67
|
-
*/
|
|
68
|
-
setConversationType(conversationId: string, type: Conversation['conversation_type']): void;
|
|
69
|
-
/**
|
|
70
|
-
* Find an active ephemeral or large_room channel by linked session ID.
|
|
71
|
-
* Returns null (not an error) if no active channel exists.
|
|
72
|
-
*/
|
|
73
|
-
findChannelBySessionId(linkedSessionId: string): Promise<ChannelWithSettings | null>;
|
|
74
|
-
/**
|
|
75
|
-
* Self-join an ephemeral or large_room channel. Idempotent.
|
|
76
|
-
*/
|
|
77
|
-
joinChannel(channelId: string): Promise<ApiResponse<{
|
|
78
|
-
participant_id: string;
|
|
79
|
-
role: string;
|
|
80
|
-
joined_at: string;
|
|
81
|
-
}>>;
|
|
82
|
-
/**
|
|
83
|
-
* Create an ephemeral channel tied to a session (e.g., a video snap).
|
|
84
|
-
*/
|
|
85
|
-
createEphemeralChannel(options: CreateEphemeralChannelOptions): Promise<ApiResponse<ChannelWithSettings>>;
|
|
86
|
-
/**
|
|
87
|
-
* Create a large room channel (high-concurrency, skips MySQL tracking in realtime).
|
|
88
|
-
*/
|
|
89
|
-
createLargeRoom(options: CreateLargeRoomOptions): Promise<ApiResponse<ChannelWithSettings>>;
|
|
90
|
-
/**
|
|
91
|
-
* Get the global concurrent subscriber count for a conversation.
|
|
92
|
-
*/
|
|
93
|
-
getSubscriberCount(conversationId: string): Promise<number>;
|
|
94
|
-
subscribeToConversation(conversationId: string): () => void;
|
|
95
|
-
/** Build channel name with correct prefix based on conversation type. */
|
|
96
|
-
private channelName;
|
|
97
|
-
destroy(): void;
|
|
98
|
-
private handleRealtimeMessage;
|
|
99
|
-
private handlePrivateMessage;
|
|
100
|
-
private normalizeMessage;
|
|
101
|
-
private buildEditedMessage;
|
|
102
|
-
private applyReactionEvent;
|
|
103
|
-
private handleConversationMessage;
|
|
104
|
-
private flushOfflineQueue;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export { ChatClient as C, EventEmitter as E };
|
package/dist/constants.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_API_BASE_URL = "https://api.scalemule.com";
|
|
2
|
-
export declare const DEFAULT_WS_RECONNECT_BASE_DELAY = 1000;
|
|
3
|
-
export declare const DEFAULT_WS_RECONNECT_MAX_DELAY = 30000;
|
|
4
|
-
export declare const DEFAULT_WS_RECONNECT_MAX_RETRIES: number;
|
|
5
|
-
export declare const DEFAULT_WS_HEARTBEAT_INTERVAL = 30000;
|
|
6
|
-
export declare const DEFAULT_MESSAGE_CACHE_SIZE = 200;
|
|
7
|
-
export declare const DEFAULT_MAX_CONVERSATIONS_CACHED = 50;
|
|
8
|
-
export declare const DEFAULT_REQUEST_TIMEOUT = 10000;
|
|
9
|
-
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,8BAA8B,CAAC;AAChE,eAAO,MAAM,+BAA+B,OAAO,CAAC;AACpD,eAAO,MAAM,8BAA8B,QAAQ,CAAC;AACpD,eAAO,MAAM,gCAAgC,QAAW,CAAC;AACzD,eAAO,MAAM,6BAA6B,QAAQ,CAAC;AACnD,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAC9C,eAAO,MAAM,gCAAgC,KAAK,CAAC;AACnD,eAAO,MAAM,uBAAuB,QAAQ,CAAC"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from './EventEmitter';
|
|
2
|
-
import type { Attachment, ApiResponse, ChatConfig, ChatEventMap, ChatMessage, ChannelWithSettings, ConnectionStatus, Conversation, CreateConversationOptions, CreateEphemeralChannelOptions, CreateLargeRoomOptions, GetMessagesOptions, ListConversationsOptions, MessagesResponse, ReadStatus, SendMessageOptions, ChannelSettings, UnreadTotalResponse } from '../types';
|
|
3
|
-
export declare class ChatClient extends EventEmitter<ChatEventMap> {
|
|
4
|
-
private http;
|
|
5
|
-
private ws;
|
|
6
|
-
private cache;
|
|
7
|
-
private offlineQueue;
|
|
8
|
-
private conversationSubs;
|
|
9
|
-
private conversationTypes;
|
|
10
|
-
private currentUserId?;
|
|
11
|
-
constructor(config: ChatConfig);
|
|
12
|
-
get status(): ConnectionStatus;
|
|
13
|
-
get userId(): string | undefined;
|
|
14
|
-
connect(): void;
|
|
15
|
-
disconnect(): void;
|
|
16
|
-
createConversation(options: CreateConversationOptions): Promise<ApiResponse<Conversation>>;
|
|
17
|
-
listConversations(options?: ListConversationsOptions): Promise<ApiResponse<Conversation[]>>;
|
|
18
|
-
getConversation(id: string): Promise<ApiResponse<Conversation>>;
|
|
19
|
-
private trackConversationType;
|
|
20
|
-
sendMessage(conversationId: string, options: SendMessageOptions): Promise<ApiResponse<ChatMessage>>;
|
|
21
|
-
getMessages(conversationId: string, options?: GetMessagesOptions): Promise<ApiResponse<MessagesResponse>>;
|
|
22
|
-
editMessage(messageId: string, content: string): Promise<ApiResponse<void>>;
|
|
23
|
-
deleteMessage(messageId: string): Promise<ApiResponse<void>>;
|
|
24
|
-
uploadAttachment(file: File | Blob, onProgress?: (percent: number) => void, signal?: AbortSignal): Promise<ApiResponse<Attachment>>;
|
|
25
|
-
refreshAttachmentUrl(messageId: string, fileId: string): Promise<ApiResponse<{
|
|
26
|
-
url: string;
|
|
27
|
-
}>>;
|
|
28
|
-
getCachedMessages(conversationId: string): ChatMessage[];
|
|
29
|
-
stageOptimisticMessage(conversationId: string, message: ChatMessage): ChatMessage;
|
|
30
|
-
addReaction(messageId: string, emoji: string): Promise<ApiResponse<void>>;
|
|
31
|
-
removeReaction(messageId: string, emoji: string): Promise<ApiResponse<void>>;
|
|
32
|
-
reportMessage(messageId: string, reason: 'spam' | 'harassment' | 'hate' | 'violence' | 'other', description?: string): Promise<ApiResponse<{
|
|
33
|
-
reported: boolean;
|
|
34
|
-
}>>;
|
|
35
|
-
muteConversation(conversationId: string, mutedUntil?: string): Promise<ApiResponse<{
|
|
36
|
-
muted: boolean;
|
|
37
|
-
}>>;
|
|
38
|
-
unmuteConversation(conversationId: string): Promise<ApiResponse<{
|
|
39
|
-
muted: boolean;
|
|
40
|
-
}>>;
|
|
41
|
-
getUnreadTotal(): Promise<ApiResponse<UnreadTotalResponse>>;
|
|
42
|
-
sendTyping(conversationId: string, isTyping?: boolean): Promise<void>;
|
|
43
|
-
markRead(conversationId: string): Promise<void>;
|
|
44
|
-
getReadStatus(conversationId: string): Promise<ApiResponse<{
|
|
45
|
-
statuses: ReadStatus[];
|
|
46
|
-
}>>;
|
|
47
|
-
addParticipant(conversationId: string, userId: string): Promise<ApiResponse<void>>;
|
|
48
|
-
removeParticipant(conversationId: string, userId: string): Promise<ApiResponse<void>>;
|
|
49
|
-
joinPresence(conversationId: string, userData?: unknown): void;
|
|
50
|
-
leavePresence(conversationId: string): void;
|
|
51
|
-
/** Update presence status (online/away/dnd) without leaving the channel. */
|
|
52
|
-
updatePresence(conversationId: string, status: 'online' | 'away' | 'dnd', userData?: unknown): void;
|
|
53
|
-
getChannelSettings(channelId: string): Promise<ApiResponse<ChannelSettings>>;
|
|
54
|
-
/**
|
|
55
|
-
* Set the conversation type for channel name routing.
|
|
56
|
-
* Large rooms use `conversation:lr:` prefix to skip MySQL in the realtime service.
|
|
57
|
-
*/
|
|
58
|
-
setConversationType(conversationId: string, type: Conversation['conversation_type']): void;
|
|
59
|
-
/**
|
|
60
|
-
* Find an active ephemeral or large_room channel by linked session ID.
|
|
61
|
-
* Returns null (not an error) if no active channel exists.
|
|
62
|
-
*/
|
|
63
|
-
findChannelBySessionId(linkedSessionId: string): Promise<ChannelWithSettings | null>;
|
|
64
|
-
/**
|
|
65
|
-
* Self-join an ephemeral or large_room channel. Idempotent.
|
|
66
|
-
*/
|
|
67
|
-
joinChannel(channelId: string): Promise<ApiResponse<{
|
|
68
|
-
participant_id: string;
|
|
69
|
-
role: string;
|
|
70
|
-
joined_at: string;
|
|
71
|
-
}>>;
|
|
72
|
-
/**
|
|
73
|
-
* Create an ephemeral channel tied to a session (e.g., a video snap).
|
|
74
|
-
*/
|
|
75
|
-
createEphemeralChannel(options: CreateEphemeralChannelOptions): Promise<ApiResponse<ChannelWithSettings>>;
|
|
76
|
-
/**
|
|
77
|
-
* Create a large room channel (high-concurrency, skips MySQL tracking in realtime).
|
|
78
|
-
*/
|
|
79
|
-
createLargeRoom(options: CreateLargeRoomOptions): Promise<ApiResponse<ChannelWithSettings>>;
|
|
80
|
-
/**
|
|
81
|
-
* Get the global concurrent subscriber count for a conversation.
|
|
82
|
-
*/
|
|
83
|
-
getSubscriberCount(conversationId: string): Promise<number>;
|
|
84
|
-
subscribeToConversation(conversationId: string): () => void;
|
|
85
|
-
/** Build channel name with correct prefix based on conversation type. */
|
|
86
|
-
private channelName;
|
|
87
|
-
destroy(): void;
|
|
88
|
-
private handleRealtimeMessage;
|
|
89
|
-
private handlePrivateMessage;
|
|
90
|
-
private normalizeMessage;
|
|
91
|
-
private buildEditedMessage;
|
|
92
|
-
private applyReactionEvent;
|
|
93
|
-
private handleConversationMessage;
|
|
94
|
-
private flushOfflineQueue;
|
|
95
|
-
}
|
|
96
|
-
//# sourceMappingURL=ChatClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChatClient.d.ts","sourceRoot":"","sources":["../../src/core/ChatClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAO9C,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,WAAW,EAEX,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,yBAAyB,EACzB,6BAA6B,EAC7B,sBAAs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,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAIvH;;OAEG;IACG,sBAAsB,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAQ/G;;OAEG;IACG,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAQjG;;OAEG;IACG,kBAAkB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOjE,uBAAuB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,IAAI;IAa3D,yEAAyE;IACzE,OAAO,CAAC,WAAW;IAgBnB,OAAO,IAAI,IAAI;IAQf,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,oBAAoB;IAwC5B,OAAO,CAAC,gBAAgB;IAmBxB,OAAO,CAAC,kBAAkB;IAyB1B,OAAO,CAAC,kBAAkB;IA0D1B,OAAO,CAAC,yBAAyB;YAoGnB,iBAAiB;CAUhC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type Listener<T> = (data: T) => void;
|
|
2
|
-
export declare class EventEmitter<EventMap extends Record<string, any>> {
|
|
3
|
-
private listeners;
|
|
4
|
-
on<K extends keyof EventMap>(event: K, callback: Listener<EventMap[K]>): () => void;
|
|
5
|
-
off<K extends keyof EventMap>(event: K, callback: Listener<EventMap[K]>): void;
|
|
6
|
-
once<K extends keyof EventMap>(event: K, callback: Listener<EventMap[K]>): () => void;
|
|
7
|
-
emit<K extends keyof EventMap>(event: K, ...[data]: EventMap[K] extends void ? [] : [EventMap[K]]): void;
|
|
8
|
-
removeAllListeners(event?: keyof EventMap): void;
|
|
9
|
-
}
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=EventEmitter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["../../src/core/EventEmitter.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;AAGrC,qBAAa,YAAY,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAC5D,OAAO,CAAC,SAAS,CAAqD;IAEtE,EAAE,CAAC,CAAC,SAAS,MAAM,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IAQnF,GAAG,CAAC,CAAC,SAAS,MAAM,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;IAI9E,IAAI,CAAC,CAAC,SAAS,MAAM,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IAQrF,IAAI,CAAC,CAAC,SAAS,MAAM,QAAQ,EAC3B,KAAK,EAAE,CAAC,EACR,GAAG,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GACvD,IAAI;IAaP,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,QAAQ,GAAG,IAAI;CAOjD"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ChatMessage } from '../types';
|
|
2
|
-
export declare class MessageCache {
|
|
3
|
-
private cache;
|
|
4
|
-
private maxMessages;
|
|
5
|
-
private maxConversations;
|
|
6
|
-
constructor(maxMessages?: number, maxConversations?: number);
|
|
7
|
-
getMessages(conversationId: string): ChatMessage[];
|
|
8
|
-
getMessage(conversationId: string, messageId: string): ChatMessage | undefined;
|
|
9
|
-
setMessages(conversationId: string, messages: ChatMessage[]): void;
|
|
10
|
-
addMessage(conversationId: string, message: ChatMessage): void;
|
|
11
|
-
upsertMessage(conversationId: string, message: ChatMessage): void;
|
|
12
|
-
updateMessage(conversationId: string, message: ChatMessage): void;
|
|
13
|
-
reconcileOptimisticMessage(conversationId: string, message: ChatMessage): ChatMessage;
|
|
14
|
-
removeMessage(conversationId: string, messageId: string): void;
|
|
15
|
-
clear(conversationId?: string): void;
|
|
16
|
-
private evictOldConversations;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=MessageCache.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MessageCache.d.ts","sourceRoot":"","sources":["../../src/core/MessageCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAoC;IACjD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,gBAAgB,CAAS;gBAErB,WAAW,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM;IAK3D,WAAW,CAAC,cAAc,EAAE,MAAM,GAAG,WAAW,EAAE;IAIlD,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAI9E,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI;IAKlE,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI;IAc9D,aAAa,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI;IASjE,aAAa,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI;IASjE,0BAA0B,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,WAAW;IAyBrF,aAAa,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAS9D,KAAK,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAQpC,OAAO,CAAC,qBAAqB;CAM9B"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
interface QueuedMessage {
|
|
2
|
-
conversationId: string;
|
|
3
|
-
content: string;
|
|
4
|
-
message_type: string;
|
|
5
|
-
attachments?: unknown[];
|
|
6
|
-
timestamp: number;
|
|
7
|
-
}
|
|
8
|
-
export declare class OfflineQueue {
|
|
9
|
-
private queue;
|
|
10
|
-
private enabled;
|
|
11
|
-
constructor(enabled?: boolean);
|
|
12
|
-
enqueue(conversationId: string, content: string, messageType?: string, attachments?: unknown[]): void;
|
|
13
|
-
drain(): QueuedMessage[];
|
|
14
|
-
get size(): number;
|
|
15
|
-
private save;
|
|
16
|
-
private load;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=OfflineQueue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OfflineQueue.d.ts","sourceRoot":"","sources":["../../src/core/OfflineQueue.ts"],"names":[],"mappings":"AAEA,UAAU,aAAa;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,OAAO,CAAU;gBAEb,OAAO,UAAO;IAO1B,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,SAAS,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI;IAYrG,KAAK,IAAI,aAAa,EAAE;IAOxB,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,OAAO,CAAC,IAAI;IAUZ,OAAO,CAAC,IAAI;CAYb"}
|
package/dist/element.d.cts
DELETED
package/dist/element.d.ts
DELETED
package/dist/element.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":""}
|
package/dist/embed/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/embed/index.ts"],"names":[],"mappings":""}
|
package/dist/factory.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ChatClient } from './core/ChatClient';
|
|
2
|
-
import type { ChatConfig } from './types';
|
|
3
|
-
export declare const ScaleMuleChat: {
|
|
4
|
-
create(config: ChatConfig): ChatClient;
|
|
5
|
-
version: string;
|
|
6
|
-
};
|
|
7
|
-
export type { ChatConfig };
|
|
8
|
-
//# sourceMappingURL=factory.d.ts.map
|
package/dist/factory.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,eAAO,MAAM,aAAa;mBACT,UAAU,GAAG,UAAU;;CAKvC,CAAC;AAEF,YAAY,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/iframe.d.cts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { C as ChatConfig } from './types-COPVrm3K.cjs';
|
|
2
|
-
|
|
3
|
-
declare class ChatIframeController {
|
|
4
|
-
private iframe;
|
|
5
|
-
private listeners;
|
|
6
|
-
constructor(container: HTMLElement, config: ChatConfig & {
|
|
7
|
-
conversationId?: string;
|
|
8
|
-
iframeSrc?: string;
|
|
9
|
-
});
|
|
10
|
-
on(event: string, callback: (data: unknown) => void): () => void;
|
|
11
|
-
sendMessage(content: string): void;
|
|
12
|
-
destroy(): void;
|
|
13
|
-
private handleMessage;
|
|
14
|
-
private postToIframe;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { ChatIframeController };
|
package/dist/iframe.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ChatConfig } from './types';
|
|
2
|
-
export declare class ChatIframeController {
|
|
3
|
-
private iframe;
|
|
4
|
-
private listeners;
|
|
5
|
-
constructor(container: HTMLElement, config: ChatConfig & {
|
|
6
|
-
conversationId?: string;
|
|
7
|
-
iframeSrc?: string;
|
|
8
|
-
});
|
|
9
|
-
on(event: string, callback: (data: unknown) => void): () => void;
|
|
10
|
-
sendMessage(content: string): void;
|
|
11
|
-
destroy(): void;
|
|
12
|
-
private handleMessage;
|
|
13
|
-
private postToIframe;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=iframe.d.ts.map
|
package/dist/iframe.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"iframe.d.ts","sourceRoot":"","sources":["../src/iframe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,SAAS,CAAC;AAEvD,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,SAAS,CAAmD;gBAGlE,SAAS,EAAE,WAAW,EACtB,MAAM,EAAE,UAAU,GAAG;QAAE,cAAc,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;IAkBtE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI;IAQhE,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIlC,OAAO,IAAI,IAAI;IAMf,OAAO,CAAC,aAAa,CAQnB;IAEF,OAAO,CAAC,YAAY;CAGrB"}
|