@scalemule/chat 0.0.4 → 0.0.7
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/{ChatClient-COmdEJ11.d.ts → ChatClient-DQPHdUHX.d.cts} +21 -2
- package/dist/{ChatClient-BoZaTtyM.d.cts → ChatClient-DtUKF-4c.d.ts} +21 -2
- package/dist/chat.embed.global.js +1 -1
- package/dist/chat.umd.global.js +288 -12
- package/dist/{chunk-ZLMMNFZL.js → chunk-5O5YLRJL.js} +386 -16
- package/dist/chunk-GTMAK3IA.js +285 -0
- package/dist/chunk-TRCELAZQ.cjs +287 -0
- package/dist/{chunk-YDLRISR7.cjs → chunk-W2PWFS3E.cjs} +386 -15
- package/dist/constants.d.ts +9 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/core/ChatClient.d.ts +96 -0
- package/dist/core/ChatClient.d.ts.map +1 -0
- package/dist/core/EventEmitter.d.ts +11 -0
- package/dist/core/EventEmitter.d.ts.map +1 -0
- package/dist/core/MessageCache.d.ts +18 -0
- package/dist/core/MessageCache.d.ts.map +1 -0
- package/dist/core/OfflineQueue.d.ts +19 -0
- package/dist/core/OfflineQueue.d.ts.map +1 -0
- package/dist/element.cjs +542 -51
- package/dist/element.d.ts +2 -2
- package/dist/element.d.ts.map +1 -0
- package/dist/element.js +541 -50
- package/dist/embed/index.d.ts +2 -0
- package/dist/embed/index.d.ts.map +1 -0
- package/dist/factory.d.ts +8 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/iframe.d.cts +1 -1
- package/dist/iframe.d.ts +3 -5
- package/dist/iframe.d.ts.map +1 -0
- package/dist/index.cjs +34 -5
- package/dist/index.d.cts +93 -4
- package/dist/index.d.ts +8 -77
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -4
- package/dist/react-components/ChatInput.d.ts +16 -0
- package/dist/react-components/ChatInput.d.ts.map +1 -0
- package/dist/react-components/ChatMessageItem.d.ts +13 -0
- package/dist/react-components/ChatMessageItem.d.ts.map +1 -0
- package/dist/react-components/ChatMessageList.d.ts +15 -0
- package/dist/react-components/ChatMessageList.d.ts.map +1 -0
- package/dist/react-components/ChatThread.d.ts +12 -0
- package/dist/react-components/ChatThread.d.ts.map +1 -0
- package/dist/react-components/ConversationList.d.ts +13 -0
- package/dist/react-components/ConversationList.d.ts.map +1 -0
- package/dist/react-components/EmojiPicker.d.ts +8 -0
- package/dist/react-components/EmojiPicker.d.ts.map +1 -0
- package/dist/react-components/index.d.ts +8 -0
- package/dist/react-components/index.d.ts.map +1 -0
- package/dist/react-components/theme.d.ts +19 -0
- package/dist/react-components/theme.d.ts.map +1 -0
- package/dist/react-components/utils.d.ts +4 -0
- package/dist/react-components/utils.d.ts.map +1 -0
- package/dist/react.cjs +1213 -53
- package/dist/react.d.cts +100 -4
- package/dist/react.d.ts +38 -15
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +1167 -18
- package/dist/shared/ChatController.d.ts +65 -0
- package/dist/shared/ChatController.d.ts.map +1 -0
- package/dist/shared/upload.d.ts +3 -0
- package/dist/shared/upload.d.ts.map +1 -0
- package/dist/support-widget.global.js +485 -157
- package/dist/support.d.ts +99 -0
- package/dist/support.d.ts.map +1 -0
- package/dist/transport/HttpTransport.d.ts +20 -0
- package/dist/transport/HttpTransport.d.ts.map +1 -0
- package/dist/transport/WebSocketTransport.d.ts +78 -0
- package/dist/transport/WebSocketTransport.d.ts.map +1 -0
- package/dist/{types-BmD7f1gV.d.cts → types-COPVrm3K.d.cts} +25 -1
- package/dist/{types-BmD7f1gV.d.ts → types-COPVrm3K.d.ts} +25 -1
- package/dist/types.d.ts +271 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/umd.d.ts +6 -0
- package/dist/umd.d.ts.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/widget/icons.d.ts +8 -0
- package/dist/widget/icons.d.ts.map +1 -0
- package/dist/widget/index.d.ts +2 -0
- package/dist/widget/index.d.ts.map +1 -0
- package/dist/widget/storage.d.ts +5 -0
- package/dist/widget/storage.d.ts.map +1 -0
- package/dist/widget/styles.d.ts +3 -0
- package/dist/widget/styles.d.ts.map +1 -0
- package/package.json +5 -2
package/dist/react.d.cts
CHANGED
|
@@ -1,7 +1,81 @@
|
|
|
1
|
+
import { f as Attachment, e as ChatMessage, d as Conversation, C as ChatConfig, R as ReadStatus, S as SendMessageOptions, A as ApiResponse, b as ConnectionStatus } from './types-COPVrm3K.cjs';
|
|
2
|
+
export { G as GetMessagesOptions, L as ListConversationsOptions, M as MessagesResponse, p as ReactionSummary, U as UnreadTotalResponse } from './types-COPVrm3K.cjs';
|
|
1
3
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { C as ChatClient } from './ChatClient-
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
import { C as ChatClient } from './ChatClient-DQPHdUHX.cjs';
|
|
5
|
+
|
|
6
|
+
interface ChatInputProps {
|
|
7
|
+
onSend: (content: string, attachments: Attachment[]) => void | Promise<void>;
|
|
8
|
+
onTypingChange?: (isTyping: boolean) => void;
|
|
9
|
+
onUploadAttachment?: (file: File | Blob, onProgress?: (percent: number) => void, signal?: AbortSignal) => Promise<{
|
|
10
|
+
data: Attachment | null;
|
|
11
|
+
error: {
|
|
12
|
+
message: string;
|
|
13
|
+
} | null;
|
|
14
|
+
} | undefined>;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
}
|
|
17
|
+
declare function ChatInput({ onSend, onTypingChange, onUploadAttachment, placeholder, }: ChatInputProps): React.JSX.Element;
|
|
18
|
+
|
|
19
|
+
interface ChatMessageItemProps {
|
|
20
|
+
message: ChatMessage;
|
|
21
|
+
currentUserId?: string;
|
|
22
|
+
onAddReaction?: (messageId: string, emoji: string) => void | Promise<void>;
|
|
23
|
+
onRemoveReaction?: (messageId: string, emoji: string) => void | Promise<void>;
|
|
24
|
+
onReport?: (messageId: string) => void | Promise<void>;
|
|
25
|
+
highlight?: boolean;
|
|
26
|
+
}
|
|
27
|
+
declare function ChatMessageItem({ message, currentUserId, onAddReaction, onRemoveReaction, onReport, highlight, }: ChatMessageItemProps): React.JSX.Element;
|
|
28
|
+
|
|
29
|
+
interface ChatMessageListProps {
|
|
30
|
+
messages: ChatMessage[];
|
|
31
|
+
currentUserId?: string;
|
|
32
|
+
unreadSince?: string;
|
|
33
|
+
scrollToUnreadOnMount?: boolean;
|
|
34
|
+
onAddReaction?: (messageId: string, emoji: string) => void | Promise<void>;
|
|
35
|
+
onRemoveReaction?: (messageId: string, emoji: string) => void | Promise<void>;
|
|
36
|
+
onReport?: (messageId: string) => void | Promise<void>;
|
|
37
|
+
emptyState?: React.ReactNode;
|
|
38
|
+
}
|
|
39
|
+
declare function ChatMessageList({ messages, currentUserId, unreadSince, scrollToUnreadOnMount, onAddReaction, onRemoveReaction, onReport, emptyState, }: ChatMessageListProps): React.JSX.Element;
|
|
40
|
+
|
|
41
|
+
interface ChatTheme {
|
|
42
|
+
primary?: string;
|
|
43
|
+
ownBubble?: string;
|
|
44
|
+
ownText?: string;
|
|
45
|
+
otherBubble?: string;
|
|
46
|
+
otherText?: string;
|
|
47
|
+
surface?: string;
|
|
48
|
+
surfaceMuted?: string;
|
|
49
|
+
borderColor?: string;
|
|
50
|
+
textColor?: string;
|
|
51
|
+
mutedText?: string;
|
|
52
|
+
borderRadius?: number | string;
|
|
53
|
+
fontFamily?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface ChatThreadProps {
|
|
57
|
+
conversationId: string;
|
|
58
|
+
theme?: ChatTheme;
|
|
59
|
+
currentUserId?: string;
|
|
60
|
+
title?: string;
|
|
61
|
+
subtitle?: string;
|
|
62
|
+
}
|
|
63
|
+
declare function ChatThread({ conversationId, theme, currentUserId, title, subtitle, }: ChatThreadProps): React.JSX.Element;
|
|
64
|
+
|
|
65
|
+
interface ConversationListProps {
|
|
66
|
+
conversationType?: Conversation['conversation_type'];
|
|
67
|
+
selectedConversationId?: string | null;
|
|
68
|
+
onSelect?: (conversation: Conversation) => void;
|
|
69
|
+
theme?: ChatTheme;
|
|
70
|
+
title?: string;
|
|
71
|
+
}
|
|
72
|
+
declare function ConversationList({ conversationType, selectedConversationId, onSelect, theme, title, }: ConversationListProps): React.JSX.Element;
|
|
73
|
+
|
|
74
|
+
interface EmojiPickerProps {
|
|
75
|
+
onSelect: (emoji: string) => void;
|
|
76
|
+
emojis?: string[];
|
|
77
|
+
}
|
|
78
|
+
declare function EmojiPicker({ onSelect, emojis, }: EmojiPickerProps): React.JSX.Element;
|
|
5
79
|
|
|
6
80
|
interface ChatProviderProps {
|
|
7
81
|
config: ChatConfig;
|
|
@@ -10,6 +84,7 @@ interface ChatProviderProps {
|
|
|
10
84
|
declare function ChatProvider({ config, children }: ChatProviderProps): React.JSX.Element;
|
|
11
85
|
/** Direct access to the ChatClient instance for custom event subscriptions (e.g., support:new). */
|
|
12
86
|
declare function useChatClient(): ChatClient;
|
|
87
|
+
declare function useChatConfig(): ChatConfig;
|
|
13
88
|
declare function useConnection(): {
|
|
14
89
|
status: ConnectionStatus;
|
|
15
90
|
connect: () => void;
|
|
@@ -17,11 +92,32 @@ declare function useConnection(): {
|
|
|
17
92
|
};
|
|
18
93
|
declare function useChat(conversationId?: string): {
|
|
19
94
|
messages: ChatMessage[];
|
|
95
|
+
readStatuses: ReadStatus[];
|
|
20
96
|
isLoading: boolean;
|
|
21
97
|
error: string | null;
|
|
22
98
|
hasMore: boolean;
|
|
23
99
|
sendMessage: (content: string, options?: Partial<SendMessageOptions>) => Promise<ApiResponse<ChatMessage> | undefined>;
|
|
24
100
|
loadMore: () => Promise<void>;
|
|
101
|
+
editMessage: (messageId: string, content: string) => Promise<ApiResponse<void>>;
|
|
102
|
+
deleteMessage: (messageId: string) => Promise<ApiResponse<void>>;
|
|
103
|
+
addReaction: (messageId: string, emoji: string) => Promise<ApiResponse<void>>;
|
|
104
|
+
removeReaction: (messageId: string, emoji: string) => Promise<ApiResponse<void>>;
|
|
105
|
+
uploadAttachment: (file: File | Blob, onProgress?: (percent: number) => void, signal?: AbortSignal) => Promise<ApiResponse<Attachment>>;
|
|
106
|
+
refreshAttachmentUrl: (messageId: string, fileId: string) => Promise<ApiResponse<{
|
|
107
|
+
url: string;
|
|
108
|
+
}>>;
|
|
109
|
+
reportMessage: (messageId: string, reason: "spam" | "harassment" | "hate" | "violence" | "other", description?: string) => Promise<ApiResponse<{
|
|
110
|
+
reported: boolean;
|
|
111
|
+
}>>;
|
|
112
|
+
muteConversation: (mutedUntil?: string) => Promise<ApiResponse<{
|
|
113
|
+
muted: boolean;
|
|
114
|
+
}> | undefined>;
|
|
115
|
+
unmuteConversation: () => Promise<ApiResponse<{
|
|
116
|
+
muted: boolean;
|
|
117
|
+
}> | undefined>;
|
|
118
|
+
getReadStatus: () => Promise<ApiResponse<{
|
|
119
|
+
statuses: ReadStatus[];
|
|
120
|
+
}> | undefined>;
|
|
25
121
|
markRead: () => Promise<void>;
|
|
26
122
|
};
|
|
27
123
|
declare function usePresence(conversationId?: string): {
|
|
@@ -46,4 +142,4 @@ declare function useUnreadCount(): {
|
|
|
46
142
|
totalUnread: number;
|
|
47
143
|
};
|
|
48
144
|
|
|
49
|
-
export { ApiResponse, ChatClient, ChatConfig, ChatMessage, ChatProvider, ConnectionStatus, Conversation, SendMessageOptions, useChat, useChatClient, useConnection, useConversations, usePresence, useTyping, useUnreadCount };
|
|
145
|
+
export { ApiResponse, ChatClient, ChatConfig, ChatInput, ChatMessage, ChatMessageItem, ChatMessageList, ChatProvider, type ChatTheme, ChatThread, ConnectionStatus, Conversation, ConversationList, EmojiPicker, ReadStatus, SendMessageOptions, useChat, useChatClient, useChatConfig, useConnection, useConversations, usePresence, useTyping, useUnreadCount };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,49 +1,72 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export { G as GetMessagesOptions, L as ListConversationsOptions, M as MessagesResponse, R as ReactionSummary, U as UnreadTotalResponse } from './types-BmD7f1gV.js';
|
|
5
|
-
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import { ChatClient } from './core/ChatClient';
|
|
3
|
+
import type { ChatConfig, ChatMessage, ConnectionStatus, Conversation, ApiResponse, ReadStatus, SendMessageOptions } from './types';
|
|
6
4
|
interface ChatProviderProps {
|
|
7
5
|
config: ChatConfig;
|
|
8
6
|
children: ReactNode;
|
|
9
7
|
}
|
|
10
|
-
declare function ChatProvider({ config, children }: ChatProviderProps): React.JSX.Element;
|
|
8
|
+
export declare function ChatProvider({ config, children }: ChatProviderProps): React.JSX.Element;
|
|
11
9
|
/** Direct access to the ChatClient instance for custom event subscriptions (e.g., support:new). */
|
|
12
|
-
declare function useChatClient(): ChatClient;
|
|
13
|
-
declare function
|
|
10
|
+
export declare function useChatClient(): ChatClient;
|
|
11
|
+
export declare function useChatConfig(): ChatConfig;
|
|
12
|
+
export declare function useConnection(): {
|
|
14
13
|
status: ConnectionStatus;
|
|
15
14
|
connect: () => void;
|
|
16
15
|
disconnect: () => void;
|
|
17
16
|
};
|
|
18
|
-
declare function useChat(conversationId?: string): {
|
|
17
|
+
export declare function useChat(conversationId?: string): {
|
|
19
18
|
messages: ChatMessage[];
|
|
19
|
+
readStatuses: ReadStatus[];
|
|
20
20
|
isLoading: boolean;
|
|
21
21
|
error: string | null;
|
|
22
22
|
hasMore: boolean;
|
|
23
23
|
sendMessage: (content: string, options?: Partial<SendMessageOptions>) => Promise<ApiResponse<ChatMessage> | undefined>;
|
|
24
24
|
loadMore: () => Promise<void>;
|
|
25
|
+
editMessage: (messageId: string, content: string) => Promise<ApiResponse<void>>;
|
|
26
|
+
deleteMessage: (messageId: string) => Promise<ApiResponse<void>>;
|
|
27
|
+
addReaction: (messageId: string, emoji: string) => Promise<ApiResponse<void>>;
|
|
28
|
+
removeReaction: (messageId: string, emoji: string) => Promise<ApiResponse<void>>;
|
|
29
|
+
uploadAttachment: (file: File | Blob, onProgress?: (percent: number) => void, signal?: AbortSignal) => Promise<ApiResponse<import("./types").Attachment>>;
|
|
30
|
+
refreshAttachmentUrl: (messageId: string, fileId: string) => Promise<ApiResponse<{
|
|
31
|
+
url: string;
|
|
32
|
+
}>>;
|
|
33
|
+
reportMessage: (messageId: string, reason: "spam" | "harassment" | "hate" | "violence" | "other", description?: string) => Promise<ApiResponse<{
|
|
34
|
+
reported: boolean;
|
|
35
|
+
}>>;
|
|
36
|
+
muteConversation: (mutedUntil?: string) => Promise<ApiResponse<{
|
|
37
|
+
muted: boolean;
|
|
38
|
+
}> | undefined>;
|
|
39
|
+
unmuteConversation: () => Promise<ApiResponse<{
|
|
40
|
+
muted: boolean;
|
|
41
|
+
}> | undefined>;
|
|
42
|
+
getReadStatus: () => Promise<ApiResponse<{
|
|
43
|
+
statuses: ReadStatus[];
|
|
44
|
+
}> | undefined>;
|
|
25
45
|
markRead: () => Promise<void>;
|
|
26
46
|
};
|
|
27
|
-
declare function usePresence(conversationId?: string): {
|
|
47
|
+
export declare function usePresence(conversationId?: string): {
|
|
28
48
|
members: {
|
|
29
49
|
userId: string;
|
|
30
50
|
status: string;
|
|
31
51
|
userData?: unknown;
|
|
32
52
|
}[];
|
|
33
53
|
};
|
|
34
|
-
declare function useTyping(conversationId?: string): {
|
|
54
|
+
export declare function useTyping(conversationId?: string): {
|
|
35
55
|
typingUsers: string[];
|
|
36
56
|
sendTyping: (isTyping?: boolean) => void;
|
|
37
57
|
};
|
|
38
|
-
declare function useConversations(options?: {
|
|
58
|
+
export declare function useConversations(options?: {
|
|
39
59
|
conversationType?: string;
|
|
40
60
|
}): {
|
|
41
61
|
conversations: Conversation[];
|
|
42
62
|
isLoading: boolean;
|
|
43
63
|
refresh: () => Promise<void>;
|
|
44
64
|
};
|
|
45
|
-
declare function useUnreadCount(): {
|
|
65
|
+
export declare function useUnreadCount(): {
|
|
46
66
|
totalUnread: number;
|
|
47
67
|
};
|
|
48
|
-
|
|
49
|
-
export {
|
|
68
|
+
export { ChatInput, ChatMessageItem, ChatMessageList, ChatThread, ConversationList, EmojiPicker, } from './react-components';
|
|
69
|
+
export { ChatClient } from './core/ChatClient';
|
|
70
|
+
export type { ChatConfig, ChatMessage, ConnectionStatus, Conversation, ApiResponse, SendMessageOptions, GetMessagesOptions, MessagesResponse, ReadStatus, ReactionSummary, UnreadTotalResponse, ListConversationsOptions, } from './types';
|
|
71
|
+
export type { ChatTheme } from './react-components';
|
|
72
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,kBAAkB,EAGnB,MAAM,SAAS,CAAC;AAmBjB,UAAU,iBAAiB;IACzB,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,iBAAiB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAUvF;AAID,mGAAmG;AACnG,wBAAgB,aAAa,IAAI,UAAU,CAE1C;AAED,wBAAgB,aAAa,IAAI,UAAU,CAE1C;AAID,wBAAgB,aAAa,IAAI;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,IAAI,CAAA;CAAE,CAoBzG;AAED,wBAAgB,OAAO,CAAC,cAAc,CAAC,EAAE,MAAM;;;;;;2BAuH3B,MAAM,YAAY,OAAO,CAAC,kBAAkB,CAAC;;6BAkB3C,MAAM,WAAW,MAAM;+BAWvB,MAAM;6BAWN,MAAM,SAAS,MAAM;gCAWrB,MAAM,SAAS,MAAM;6BAW1B,IAAI,GAAG,IAAI,eAAe,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,WAAW,WAAW;sCAWpE,MAAM,UAAU,MAAM;;;+BAY3B,MAAM,UACT,MAAM,GAAG,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,gBAC/C,MAAM;;;oCAYF,MAAM;;;;;;;;;;EAyD7B;AAED,wBAAgB,WAAW,CAAC,cAAc,CAAC,EAAE,MAAM;;gBAGrC,MAAM;gBAAU,MAAM;mBAAa,OAAO;;EAmEvD;AAED,wBAAgB,SAAS,CAAC,cAAc,CAAC,EAAE,MAAM;;;EAqDhD;AAID,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE;;;;EA+CvE;AAID,wBAAgB,cAAc;;EAmC7B;AAED,OAAO,EACL,SAAS,EACT,eAAe,EACf,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,YAAY,EACV,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC"}
|