@scalemule/chat 0.0.7 → 0.0.9
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-components/ChatInput.d.ts +10 -2
- package/dist/react-components/ChatInput.d.ts.map +1 -1
- package/dist/react-components/ChatMessageItem.d.ts +13 -2
- package/dist/react-components/ChatMessageItem.d.ts.map +1 -1
- package/dist/react-components/ChatMessageList.d.ts +20 -4
- package/dist/react-components/ChatMessageList.d.ts.map +1 -1
- package/dist/react-components/ChatThread.d.ts +8 -1
- package/dist/react-components/ChatThread.d.ts.map +1 -1
- package/dist/react-components/EmojiPicker.d.ts +8 -1
- package/dist/react-components/EmojiPicker.d.ts.map +1 -1
- package/dist/react-components/ReactionBar.d.ts +10 -0
- package/dist/react-components/ReactionBar.d.ts.map +1 -0
- package/dist/react-components/ReportDialog.d.ts +30 -0
- package/dist/react-components/ReportDialog.d.ts.map +1 -0
- package/dist/react-components/index.d.ts +3 -1
- package/dist/react-components/index.d.ts.map +1 -1
- package/dist/react.cjs +1981 -559
- package/dist/react.d.cts +97 -13
- package/dist/react.d.ts +1 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +1913 -494
- package/dist/support-widget.global.js +50 -25
- package/dist/widget/styles.d.ts +1 -1
- package/dist/widget/styles.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/react.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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,
|
|
1
|
+
import { f as Attachment, e as ChatMessage, d as Conversation, p as ReactionSummary, 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, U as UnreadTotalResponse } from './types-COPVrm3K.cjs';
|
|
3
3
|
import React, { ReactNode } from 'react';
|
|
4
4
|
import { C as ChatClient } from './ChatClient-DQPHdUHX.cjs';
|
|
5
5
|
|
|
6
6
|
interface ChatInputProps {
|
|
7
|
-
onSend: (content: string, attachments
|
|
7
|
+
onSend: (content: string, attachments?: Attachment[]) => void | Promise<void>;
|
|
8
8
|
onTypingChange?: (isTyping: boolean) => void;
|
|
9
9
|
onUploadAttachment?: (file: File | Blob, onProgress?: (percent: number) => void, signal?: AbortSignal) => Promise<{
|
|
10
10
|
data: Attachment | null;
|
|
@@ -12,31 +12,66 @@ interface ChatInputProps {
|
|
|
12
12
|
message: string;
|
|
13
13
|
} | null;
|
|
14
14
|
} | undefined>;
|
|
15
|
+
onDeleteAttachment?: (fileId: string) => void | Promise<void>;
|
|
16
|
+
onValidateFile?: (file: File) => {
|
|
17
|
+
valid: boolean;
|
|
18
|
+
error?: string;
|
|
19
|
+
};
|
|
15
20
|
placeholder?: string;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
maxAttachments?: number;
|
|
23
|
+
accept?: string;
|
|
16
24
|
}
|
|
17
|
-
declare function ChatInput({ onSend, onTypingChange, onUploadAttachment, placeholder, }: ChatInputProps): React.JSX.Element;
|
|
25
|
+
declare function ChatInput({ onSend, onTypingChange, onUploadAttachment, onDeleteAttachment, onValidateFile, placeholder, disabled, maxAttachments, accept, }: ChatInputProps): React.JSX.Element;
|
|
18
26
|
|
|
27
|
+
interface UserProfile$2 {
|
|
28
|
+
display_name: string;
|
|
29
|
+
username?: string;
|
|
30
|
+
avatar_url?: string;
|
|
31
|
+
}
|
|
19
32
|
interface ChatMessageItemProps {
|
|
20
33
|
message: ChatMessage;
|
|
21
34
|
currentUserId?: string;
|
|
35
|
+
conversationId?: string;
|
|
36
|
+
profile?: UserProfile$2;
|
|
22
37
|
onAddReaction?: (messageId: string, emoji: string) => void | Promise<void>;
|
|
23
38
|
onRemoveReaction?: (messageId: string, emoji: string) => void | Promise<void>;
|
|
24
|
-
|
|
39
|
+
onEdit?: (messageId: string, content: string) => void | Promise<void>;
|
|
40
|
+
onDelete?: (messageId: string) => void | Promise<void>;
|
|
41
|
+
onReport?: (messageId: string) => void;
|
|
42
|
+
onFetchAttachmentUrl?: (fileId: string) => Promise<string>;
|
|
43
|
+
isOwnMessage?: boolean;
|
|
25
44
|
highlight?: boolean;
|
|
26
45
|
}
|
|
27
|
-
declare function ChatMessageItem({ message, currentUserId, onAddReaction, onRemoveReaction, onReport, highlight, }: ChatMessageItemProps): React.JSX.Element;
|
|
46
|
+
declare function ChatMessageItem({ message, currentUserId, conversationId, profile, onAddReaction, onRemoveReaction, onEdit, onDelete, onReport, onFetchAttachmentUrl, isOwnMessage: isOwnMessageProp, highlight, }: ChatMessageItemProps): React.JSX.Element;
|
|
28
47
|
|
|
48
|
+
interface UserProfile$1 {
|
|
49
|
+
display_name: string;
|
|
50
|
+
username?: string;
|
|
51
|
+
avatar_url?: string;
|
|
52
|
+
}
|
|
29
53
|
interface ChatMessageListProps {
|
|
30
54
|
messages: ChatMessage[];
|
|
31
55
|
currentUserId?: string;
|
|
32
|
-
|
|
33
|
-
|
|
56
|
+
conversationId?: string;
|
|
57
|
+
profiles?: Map<string, UserProfile$1>;
|
|
58
|
+
hasMore?: boolean;
|
|
59
|
+
isLoading?: boolean;
|
|
60
|
+
onLoadMore?: () => void;
|
|
34
61
|
onAddReaction?: (messageId: string, emoji: string) => void | Promise<void>;
|
|
35
62
|
onRemoveReaction?: (messageId: string, emoji: string) => void | Promise<void>;
|
|
36
|
-
|
|
63
|
+
onEdit?: (messageId: string, content: string) => void | Promise<void>;
|
|
64
|
+
onDelete?: (messageId: string) => void | Promise<void>;
|
|
65
|
+
onReport?: (messageId: string) => void;
|
|
66
|
+
onFetchAttachmentUrl?: (fileId: string) => Promise<string>;
|
|
67
|
+
firstUnreadMessageId?: string;
|
|
68
|
+
/** @deprecated use firstUnreadMessageId instead */
|
|
69
|
+
unreadSince?: string;
|
|
70
|
+
isNearBottom?: boolean;
|
|
71
|
+
onReachBottom?: () => void;
|
|
37
72
|
emptyState?: React.ReactNode;
|
|
38
73
|
}
|
|
39
|
-
declare function ChatMessageList({ messages, currentUserId,
|
|
74
|
+
declare function ChatMessageList({ messages, currentUserId, conversationId, profiles, hasMore, isLoading, onLoadMore, onAddReaction, onRemoveReaction, onEdit, onDelete, onReport, onFetchAttachmentUrl, firstUnreadMessageId, unreadSince, isNearBottom: isNearBottomProp, onReachBottom, emptyState, }: ChatMessageListProps): React.JSX.Element;
|
|
40
75
|
|
|
41
76
|
interface ChatTheme {
|
|
42
77
|
primary?: string;
|
|
@@ -53,14 +88,21 @@ interface ChatTheme {
|
|
|
53
88
|
fontFamily?: string;
|
|
54
89
|
}
|
|
55
90
|
|
|
91
|
+
interface UserProfile {
|
|
92
|
+
display_name: string;
|
|
93
|
+
username?: string;
|
|
94
|
+
avatar_url?: string;
|
|
95
|
+
}
|
|
56
96
|
interface ChatThreadProps {
|
|
57
97
|
conversationId: string;
|
|
58
98
|
theme?: ChatTheme;
|
|
59
99
|
currentUserId?: string;
|
|
100
|
+
profiles?: Map<string, UserProfile>;
|
|
60
101
|
title?: string;
|
|
61
102
|
subtitle?: string;
|
|
103
|
+
onFetchAttachmentUrl?: (fileId: string) => Promise<string>;
|
|
62
104
|
}
|
|
63
|
-
declare function ChatThread({ conversationId, theme, currentUserId, title, subtitle, }: ChatThreadProps): React.JSX.Element;
|
|
105
|
+
declare function ChatThread({ conversationId, theme, currentUserId, profiles, title, subtitle, onFetchAttachmentUrl, }: ChatThreadProps): React.JSX.Element;
|
|
64
106
|
|
|
65
107
|
interface ConversationListProps {
|
|
66
108
|
conversationType?: Conversation['conversation_type'];
|
|
@@ -73,9 +115,51 @@ declare function ConversationList({ conversationType, selectedConversationId, on
|
|
|
73
115
|
|
|
74
116
|
interface EmojiPickerProps {
|
|
75
117
|
onSelect: (emoji: string) => void;
|
|
118
|
+
onClose: () => void;
|
|
119
|
+
anchorRef: React.RefObject<HTMLButtonElement | null>;
|
|
76
120
|
emojis?: string[];
|
|
77
121
|
}
|
|
78
|
-
declare function EmojiPicker({ onSelect, emojis, }: EmojiPickerProps): React.JSX.Element;
|
|
122
|
+
declare function EmojiPicker({ onSelect, onClose, anchorRef, emojis, }: EmojiPickerProps): React.JSX.Element | null;
|
|
123
|
+
interface EmojiPickerTriggerProps {
|
|
124
|
+
onSelect: (emoji: string) => void;
|
|
125
|
+
emojis?: string[];
|
|
126
|
+
}
|
|
127
|
+
declare function EmojiPickerTrigger({ onSelect, emojis, }: EmojiPickerTriggerProps): React.JSX.Element;
|
|
128
|
+
|
|
129
|
+
interface ReactionBarProps {
|
|
130
|
+
reactions: ReactionSummary[];
|
|
131
|
+
currentUserId?: string;
|
|
132
|
+
onToggleReaction: (emoji: string) => void;
|
|
133
|
+
}
|
|
134
|
+
declare function ReactionBar({ reactions, currentUserId, onToggleReaction, }: ReactionBarProps): React.JSX.Element | null;
|
|
135
|
+
|
|
136
|
+
declare const REPORT_REASONS: readonly [{
|
|
137
|
+
readonly value: "spam";
|
|
138
|
+
readonly label: "Spam";
|
|
139
|
+
}, {
|
|
140
|
+
readonly value: "harassment";
|
|
141
|
+
readonly label: "Harassment";
|
|
142
|
+
}, {
|
|
143
|
+
readonly value: "hate";
|
|
144
|
+
readonly label: "Hate speech";
|
|
145
|
+
}, {
|
|
146
|
+
readonly value: "violence";
|
|
147
|
+
readonly label: "Violence";
|
|
148
|
+
}, {
|
|
149
|
+
readonly value: "other";
|
|
150
|
+
readonly label: "Other";
|
|
151
|
+
}];
|
|
152
|
+
type ReportReason = (typeof REPORT_REASONS)[number]['value'];
|
|
153
|
+
interface ReportDialogProps {
|
|
154
|
+
messageId: string;
|
|
155
|
+
onSubmit: (data: {
|
|
156
|
+
messageId: string;
|
|
157
|
+
reason: ReportReason;
|
|
158
|
+
description?: string;
|
|
159
|
+
}) => void | Promise<void>;
|
|
160
|
+
onClose: () => void;
|
|
161
|
+
}
|
|
162
|
+
declare function ReportDialog({ messageId, onSubmit, onClose, }: ReportDialogProps): React.JSX.Element;
|
|
79
163
|
|
|
80
164
|
interface ChatProviderProps {
|
|
81
165
|
config: ChatConfig;
|
|
@@ -142,4 +226,4 @@ declare function useUnreadCount(): {
|
|
|
142
226
|
totalUnread: number;
|
|
143
227
|
};
|
|
144
228
|
|
|
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 };
|
|
229
|
+
export { ApiResponse, ChatClient, ChatConfig, ChatInput, ChatMessage, ChatMessageItem, ChatMessageList, ChatProvider, type ChatTheme, ChatThread, ConnectionStatus, Conversation, ConversationList, EmojiPicker, EmojiPickerTrigger, ReactionBar, ReactionSummary, ReadStatus, ReportDialog, SendMessageOptions, useChat, useChatClient, useChatConfig, useConnection, useConversations, usePresence, useTyping, useUnreadCount };
|
package/dist/react.d.ts
CHANGED
|
@@ -65,7 +65,7 @@ export declare function useConversations(options?: {
|
|
|
65
65
|
export declare function useUnreadCount(): {
|
|
66
66
|
totalUnread: number;
|
|
67
67
|
};
|
|
68
|
-
export { ChatInput, ChatMessageItem, ChatMessageList, ChatThread, ConversationList, EmojiPicker, } from './react-components';
|
|
68
|
+
export { ChatInput, ChatMessageItem, ChatMessageList, ChatThread, ConversationList, EmojiPicker, EmojiPickerTrigger, ReactionBar, ReportDialog, } from './react-components';
|
|
69
69
|
export { ChatClient } from './core/ChatClient';
|
|
70
70
|
export type { ChatConfig, ChatMessage, ConnectionStatus, Conversation, ApiResponse, SendMessageOptions, GetMessagesOptions, MessagesResponse, ReadStatus, ReactionSummary, UnreadTotalResponse, ListConversationsOptions, } from './types';
|
|
71
71
|
export type { ChatTheme } from './react-components';
|
package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