@ermis-network/ermis-chat-react 1.0.6 → 1.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/index.cjs +3802 -1772
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +836 -25
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +304 -1
- package/dist/index.d.ts +304 -1
- package/dist/index.mjs +3755 -1761
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/channelRoleUtils.ts +73 -0
- package/src/channelTypeUtils.ts +46 -0
- package/src/components/Avatar.tsx +57 -31
- package/src/components/BannedOverlay.tsx +40 -0
- package/src/components/ChannelActions.tsx +233 -0
- package/src/components/ChannelHeader.tsx +126 -5
- package/src/components/ChannelInfo/ChannelInfo.tsx +128 -24
- package/src/components/ChannelInfo/ChannelInfoTabs.tsx +67 -28
- package/src/components/ChannelInfo/ChannelSettingsPanel.tsx +90 -1
- package/src/components/ChannelInfo/EditChannelModal.tsx +5 -4
- package/src/components/ChannelInfo/MemberListItem.tsx +2 -1
- package/src/components/ChannelList.tsx +514 -47
- package/src/components/ClosedTopicOverlay.tsx +38 -0
- package/src/components/CreateChannelModal.tsx +53 -16
- package/src/components/EditPreview.tsx +2 -1
- package/src/components/ForwardMessageModal.tsx +2 -1
- package/src/components/MediaLightbox.tsx +314 -0
- package/src/components/MessageInput.tsx +21 -3
- package/src/components/MessageItem.tsx +10 -12
- package/src/components/MessageQuickReactions.tsx +3 -2
- package/src/components/MessageReactions.tsx +8 -3
- package/src/components/MessageRenderers.tsx +174 -54
- package/src/components/PendingOverlay.tsx +51 -0
- package/src/components/PinnedMessages.tsx +2 -1
- package/src/components/ReplyPreview.tsx +2 -1
- package/src/components/SkippedOverlay.tsx +36 -0
- package/src/components/TopicModal.tsx +189 -0
- package/src/components/UserPicker.tsx +1 -1
- package/src/components/VirtualMessageList.tsx +162 -47
- package/src/hooks/useBannedState.ts +27 -3
- package/src/hooks/useBlockedState.ts +3 -2
- package/src/hooks/useChannelCapabilities.ts +10 -8
- package/src/hooks/useChannelData.ts +1 -1
- package/src/hooks/useChannelListUpdates.ts +28 -5
- package/src/hooks/useChannelMessages.ts +2 -3
- package/src/hooks/useChannelRowUpdates.ts +9 -2
- package/src/hooks/useMessageActions.ts +23 -9
- package/src/hooks/useOnlineStatus.ts +71 -0
- package/src/hooks/useOnlineUsers.ts +115 -0
- package/src/hooks/usePendingState.ts +8 -3
- package/src/index.ts +67 -10
- package/src/messageTypeUtils.ts +64 -0
- package/src/styles/_channel-info.css +21 -0
- package/src/styles/_channel-list.css +276 -6
- package/src/styles/_media-lightbox.css +263 -0
- package/src/styles/_message-bubble.css +170 -13
- package/src/styles/_message-input.css +24 -0
- package/src/styles/_message-list.css +76 -6
- package/src/styles/_message-quick-reactions.css +5 -0
- package/src/styles/_message-reactions.css +7 -0
- package/src/styles/_topic-modal.css +154 -0
- package/src/styles/index.css +2 -0
- package/src/types.ts +203 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React$1 from 'react';
|
|
2
2
|
import { Channel as Channel$1, Attachment, FormatMessageResponse, ChannelFilters, ChannelSort, ChannelQueryOptions, ErmisChat, UserCallInfo, MessageLabel, ErmisCallNode, CallStatus } from '@ermis-network/ermis-chat-sdk';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
4
|
import { VListHandle } from 'virtua';
|
|
4
5
|
|
|
5
6
|
type Theme = 'dark' | 'light';
|
|
@@ -219,6 +220,8 @@ type AvatarProps = {
|
|
|
219
220
|
size?: number;
|
|
220
221
|
/** Additional CSS class name */
|
|
221
222
|
className?: string;
|
|
223
|
+
/** Disable opening the lightbox on click */
|
|
224
|
+
disableLightbox?: boolean;
|
|
222
225
|
};
|
|
223
226
|
type ChannelProps = {
|
|
224
227
|
children: React.ReactNode;
|
|
@@ -258,6 +261,16 @@ type ChannelHeaderProps = {
|
|
|
258
261
|
CallBadgeComponent?: React.ComponentType<{
|
|
259
262
|
callType: string;
|
|
260
263
|
}>;
|
|
264
|
+
/** Show online/offline indicator for direct friend channels (default: true) */
|
|
265
|
+
showOnlineStatus?: boolean;
|
|
266
|
+
/** I18n label for "Online" subtitle (default: "Online") */
|
|
267
|
+
onlineLabel?: string;
|
|
268
|
+
/** I18n label for "Offline" subtitle (default: "Offline") */
|
|
269
|
+
offlineLabel?: string;
|
|
270
|
+
/** Custom online indicator component (replaces the default dot + label) */
|
|
271
|
+
OnlineIndicatorComponent?: React.ComponentType<{
|
|
272
|
+
isOnline: boolean;
|
|
273
|
+
}>;
|
|
261
274
|
};
|
|
262
275
|
/** Data passed to a fully custom HeaderComponent */
|
|
263
276
|
type ChannelHeaderData = {
|
|
@@ -265,6 +278,44 @@ type ChannelHeaderData = {
|
|
|
265
278
|
name: string;
|
|
266
279
|
image?: string;
|
|
267
280
|
};
|
|
281
|
+
type ChannelAction = {
|
|
282
|
+
id: string;
|
|
283
|
+
label: string;
|
|
284
|
+
icon?: React.ReactNode;
|
|
285
|
+
onClick: (channel: Channel$1, e: React.MouseEvent) => void;
|
|
286
|
+
isDanger?: boolean;
|
|
287
|
+
};
|
|
288
|
+
type ChannelActionLabels = {
|
|
289
|
+
pinChannel?: string;
|
|
290
|
+
unpinChannel?: string;
|
|
291
|
+
pinTopic?: string;
|
|
292
|
+
unpinTopic?: string;
|
|
293
|
+
blockUser?: string;
|
|
294
|
+
unblockUser?: string;
|
|
295
|
+
editTopic?: string;
|
|
296
|
+
closeTopic?: string;
|
|
297
|
+
reopenTopic?: string;
|
|
298
|
+
createTopic?: string;
|
|
299
|
+
deleteChannel?: string;
|
|
300
|
+
leaveChannel?: string;
|
|
301
|
+
};
|
|
302
|
+
type ChannelActionIcons = {
|
|
303
|
+
PinIcon?: React.ReactNode;
|
|
304
|
+
UnpinIcon?: React.ReactNode;
|
|
305
|
+
BlockIcon?: React.ReactNode;
|
|
306
|
+
UnblockIcon?: React.ReactNode;
|
|
307
|
+
EditTopicIcon?: React.ReactNode;
|
|
308
|
+
CloseTopicIcon?: React.ReactNode;
|
|
309
|
+
ReopenTopicIcon?: React.ReactNode;
|
|
310
|
+
CreateTopicIcon?: React.ReactNode;
|
|
311
|
+
DeleteChannelIcon?: React.ReactNode;
|
|
312
|
+
LeaveChannelIcon?: React.ReactNode;
|
|
313
|
+
};
|
|
314
|
+
type ChannelActionsProps = {
|
|
315
|
+
channel: Channel$1;
|
|
316
|
+
actions: ChannelAction[];
|
|
317
|
+
onClose: () => void;
|
|
318
|
+
};
|
|
268
319
|
type ChannelItemProps = {
|
|
269
320
|
channel: Channel$1;
|
|
270
321
|
isActive: boolean;
|
|
@@ -272,6 +323,7 @@ type ChannelItemProps = {
|
|
|
272
323
|
unreadCount: number;
|
|
273
324
|
lastMessageText: string;
|
|
274
325
|
lastMessageUser: string;
|
|
326
|
+
lastMessageTimestamp?: Date | string | null;
|
|
275
327
|
onSelect: (channel: Channel$1) => void;
|
|
276
328
|
AvatarComponent: React.ComponentType<AvatarProps>;
|
|
277
329
|
/** Whether the current user has blocked this channel (messaging only) */
|
|
@@ -282,6 +334,24 @@ type ChannelItemProps = {
|
|
|
282
334
|
pendingBadgeLabel?: string;
|
|
283
335
|
/** Label for the blocked channel badge indicator */
|
|
284
336
|
blockedBadgeLabel?: string;
|
|
337
|
+
isClosedTopic?: boolean;
|
|
338
|
+
closedTopicIcon?: React.ReactNode;
|
|
339
|
+
PinnedIconComponent?: React.ComponentType;
|
|
340
|
+
ChannelActionsComponent?: React.ComponentType<ChannelActionsProps>;
|
|
341
|
+
/** Handler when Create Topic action is triggered */
|
|
342
|
+
onAddTopic?: (channel: Channel$1) => void;
|
|
343
|
+
/** Handler when Edit Topic action is triggered */
|
|
344
|
+
onEditTopic?: (channel: Channel$1) => void;
|
|
345
|
+
/** Handler when Close/Reopen Topic action is triggered */
|
|
346
|
+
onToggleCloseTopic?: (channel: Channel$1, isClosed: boolean) => void;
|
|
347
|
+
/** Array of action IDs to hide from the actions dropdown */
|
|
348
|
+
hiddenActions?: string[];
|
|
349
|
+
/** Custom labels for default channel actions */
|
|
350
|
+
actionLabels?: ChannelActionLabels;
|
|
351
|
+
/** Custom icons for default channel actions */
|
|
352
|
+
actionIcons?: ChannelActionIcons;
|
|
353
|
+
/** Whether the other user in this direct channel is online (friend channels only) */
|
|
354
|
+
isOnline?: boolean;
|
|
285
355
|
};
|
|
286
356
|
type ChannelListProps = {
|
|
287
357
|
filters?: ChannelFilters;
|
|
@@ -290,6 +360,8 @@ type ChannelListProps = {
|
|
|
290
360
|
renderChannel?: (channel: Channel$1, isActive: boolean) => React.ReactNode;
|
|
291
361
|
onChannelSelect?: (channel: Channel$1) => void;
|
|
292
362
|
className?: string;
|
|
363
|
+
/** Array of action IDs to hide from the actions dropdown */
|
|
364
|
+
hiddenActions?: string[];
|
|
293
365
|
LoadingIndicator?: React.ComponentType<{
|
|
294
366
|
text?: string;
|
|
295
367
|
}>;
|
|
@@ -311,9 +383,37 @@ type ChannelListProps = {
|
|
|
311
383
|
emptyStateLabel?: string;
|
|
312
384
|
/** Label for the blocked channel badge hover */
|
|
313
385
|
blockedBadgeLabel?: string;
|
|
386
|
+
/** Custom component for rendering topic group */
|
|
387
|
+
ChannelTopicGroupComponent?: React.ComponentType<any>;
|
|
388
|
+
/** Custom avatar component for general topic */
|
|
389
|
+
GeneralTopicAvatarComponent?: React.ComponentType<any>;
|
|
390
|
+
/** Custom avatar component for other topics */
|
|
391
|
+
TopicAvatarComponent?: React.ComponentType<any>;
|
|
392
|
+
/** Name for the general topic (default: "general") */
|
|
393
|
+
generalTopicLabel?: string;
|
|
394
|
+
/** Handler when Add Topic button is clicked on a team channel */
|
|
395
|
+
onAddTopic?: (channel: Channel$1) => void;
|
|
396
|
+
/** Optional custom emoji picker for TopicModal */
|
|
397
|
+
TopicEmojiPickerComponent?: React.ComponentType<any>;
|
|
398
|
+
closedTopicIcon?: React.ReactNode;
|
|
399
|
+
PinnedIconComponent?: React.ComponentType;
|
|
400
|
+
/** Custom component for channel actions dropdown */
|
|
401
|
+
ChannelActionsComponent?: React.ComponentType<ChannelActionsProps>;
|
|
402
|
+
/** Handler when Edit Topic action is triggered */
|
|
403
|
+
onEditTopic?: (channel: Channel$1) => void;
|
|
404
|
+
/** Handler when Close/Reopen Topic action is triggered */
|
|
405
|
+
onToggleCloseTopic?: (channel: Channel$1, isClosed: boolean) => void;
|
|
406
|
+
/** Custom labels for default channel actions */
|
|
407
|
+
actionLabels?: ChannelActionLabels;
|
|
408
|
+
/** Custom icons for default channel actions */
|
|
409
|
+
actionIcons?: ChannelActionIcons;
|
|
410
|
+
/** Show online/offline indicator dots on channel item avatars for friend channels (default: true) */
|
|
411
|
+
showOnlineStatus?: boolean;
|
|
314
412
|
};
|
|
315
413
|
type AttachmentProps = {
|
|
316
414
|
attachment: Attachment;
|
|
415
|
+
/** Click handler — when provided, attachment becomes clickable (opens lightbox) */
|
|
416
|
+
onClick?: () => void;
|
|
317
417
|
};
|
|
318
418
|
type MessageRendererProps = {
|
|
319
419
|
message: FormatMessageResponse;
|
|
@@ -330,6 +430,18 @@ type DateSeparatorProps = {
|
|
|
330
430
|
type JumpToLatestProps = {
|
|
331
431
|
onClick: () => void;
|
|
332
432
|
};
|
|
433
|
+
type MediaLightboxItem = {
|
|
434
|
+
type: 'image' | 'video';
|
|
435
|
+
src: string;
|
|
436
|
+
alt?: string;
|
|
437
|
+
posterSrc?: string;
|
|
438
|
+
};
|
|
439
|
+
type MediaLightboxProps = {
|
|
440
|
+
items: MediaLightboxItem[];
|
|
441
|
+
initialIndex?: number;
|
|
442
|
+
isOpen: boolean;
|
|
443
|
+
onClose: () => void;
|
|
444
|
+
};
|
|
333
445
|
type MessageListProps = {
|
|
334
446
|
/** Fully custom render for each message */
|
|
335
447
|
renderMessage?: (message: FormatMessageResponse, isOwnMessage: boolean) => React.ReactNode;
|
|
@@ -377,6 +489,8 @@ type MessageListProps = {
|
|
|
377
489
|
TypingIndicatorComponent?: React.ComponentType;
|
|
378
490
|
/** Custom component for message reactions */
|
|
379
491
|
MessageReactionsComponent?: React.ComponentType<MessageReactionsProps>;
|
|
492
|
+
/** Custom media lightbox component (replaces the default lightbox entirely) */
|
|
493
|
+
MediaLightboxComponent?: React.ComponentType<MediaLightboxProps>;
|
|
380
494
|
/** I18n Labels */
|
|
381
495
|
emptyTitle?: string;
|
|
382
496
|
emptySubtitle?: string;
|
|
@@ -389,6 +503,21 @@ type MessageListProps = {
|
|
|
389
503
|
pendingOverlaySubtitle?: string;
|
|
390
504
|
pendingAcceptLabel?: string;
|
|
391
505
|
pendingRejectLabel?: string;
|
|
506
|
+
/** I18n Label for skip button on direct messaging channels (default: "Skip") */
|
|
507
|
+
pendingSkipLabel?: string;
|
|
508
|
+
skippedOverlayTitle?: string;
|
|
509
|
+
skippedOverlaySubtitle?: string;
|
|
510
|
+
skippedAcceptLabel?: string;
|
|
511
|
+
closedTopicOverlayTitle?: string;
|
|
512
|
+
closedTopicOverlaySubtitle?: string;
|
|
513
|
+
closedTopicReopenLabel?: string;
|
|
514
|
+
/** Custom component for pending invitee notification in direct channels */
|
|
515
|
+
PendingInviteeNotificationComponent?: React.ComponentType<{
|
|
516
|
+
inviteeName?: string;
|
|
517
|
+
label?: string;
|
|
518
|
+
}>;
|
|
519
|
+
/** I18n Label for pending invitee notification */
|
|
520
|
+
pendingInviteeLabel?: string | ((inviteeName?: string) => string);
|
|
392
521
|
};
|
|
393
522
|
type ReactionUser = {
|
|
394
523
|
id: string;
|
|
@@ -410,6 +539,8 @@ type MessageReactionsProps = {
|
|
|
410
539
|
AvatarComponent?: React.ComponentType<AvatarProps>;
|
|
411
540
|
/** Callback when clicking a reaction */
|
|
412
541
|
onClickReaction?: (type: string) => void;
|
|
542
|
+
/** Whether interactions are disabled */
|
|
543
|
+
disabled?: boolean;
|
|
413
544
|
};
|
|
414
545
|
type ReadReceiptUser = {
|
|
415
546
|
id: string;
|
|
@@ -542,6 +673,8 @@ type MessageInputProps = {
|
|
|
542
673
|
sendDisabledLabel?: string;
|
|
543
674
|
/** I18n Label for slow mode active */
|
|
544
675
|
slowModeLabel?: (cooldown: number) => React.ReactNode;
|
|
676
|
+
/** I18n Label for closed topic */
|
|
677
|
+
closedTopicLabel?: string;
|
|
545
678
|
};
|
|
546
679
|
type ReplyPreviewProps = {
|
|
547
680
|
message: FormatMessageResponse;
|
|
@@ -756,6 +889,10 @@ type ChannelInfoCoverProps = {
|
|
|
756
889
|
onEditClick?: () => void;
|
|
757
890
|
/** Whether the channel is public */
|
|
758
891
|
isPublic?: boolean;
|
|
892
|
+
/** Name of the parent channel (if this is a topic) */
|
|
893
|
+
parentChannelName?: string;
|
|
894
|
+
/** Whether the channel is a topic */
|
|
895
|
+
isTopic?: boolean;
|
|
759
896
|
/** Whether the channel is a team channel */
|
|
760
897
|
isTeamChannel?: boolean;
|
|
761
898
|
};
|
|
@@ -767,6 +904,8 @@ type ChannelInfoActionsProps = {
|
|
|
767
904
|
onBlockUser?: () => void;
|
|
768
905
|
onUnblockUser?: () => void;
|
|
769
906
|
isTeamChannel?: boolean;
|
|
907
|
+
isTopic?: boolean;
|
|
908
|
+
isClosedTopic?: boolean;
|
|
770
909
|
isBlocked?: boolean;
|
|
771
910
|
currentUserRole?: string;
|
|
772
911
|
searchLabel?: string;
|
|
@@ -775,6 +914,10 @@ type ChannelInfoActionsProps = {
|
|
|
775
914
|
leaveLabel?: string;
|
|
776
915
|
blockLabel?: string;
|
|
777
916
|
unblockLabel?: string;
|
|
917
|
+
onCloseTopic?: () => void;
|
|
918
|
+
onReopenTopic?: () => void;
|
|
919
|
+
closeTopicLabel?: string;
|
|
920
|
+
reopenTopicLabel?: string;
|
|
778
921
|
};
|
|
779
922
|
type ChannelInfoMember = {
|
|
780
923
|
id: string;
|
|
@@ -976,6 +1119,12 @@ type ChannelInfoProps = {
|
|
|
976
1119
|
/** I18n labels for block/unblock actions */
|
|
977
1120
|
actionsBlockLabel?: string;
|
|
978
1121
|
actionsUnblockLabel?: string;
|
|
1122
|
+
actionsCloseTopicLabel?: string;
|
|
1123
|
+
actionsReopenTopicLabel?: string;
|
|
1124
|
+
/** Settings Panel Topics Labels */
|
|
1125
|
+
settingsWorkspaceTopicsTitle?: string;
|
|
1126
|
+
settingsTopicsFeatureName?: string;
|
|
1127
|
+
settingsTopicsFeatureDescription?: string;
|
|
979
1128
|
};
|
|
980
1129
|
/** Individual user item in UserPicker */
|
|
981
1130
|
type UserPickerUser = {
|
|
@@ -1055,11 +1204,36 @@ type CreateChannelModalProps = {
|
|
|
1055
1204
|
cancelButtonLabel?: string;
|
|
1056
1205
|
createButtonLabel?: string;
|
|
1057
1206
|
creatingButtonLabel?: string;
|
|
1207
|
+
messageButtonLabel?: string;
|
|
1058
1208
|
/** File upload configuration for group channel images */
|
|
1059
1209
|
imageAccept?: string;
|
|
1060
1210
|
maxImageSize?: number;
|
|
1061
1211
|
maxImageSizeError?: string;
|
|
1062
1212
|
};
|
|
1213
|
+
type TopicModalProps = {
|
|
1214
|
+
isOpen: boolean;
|
|
1215
|
+
onClose: () => void;
|
|
1216
|
+
onSuccess?: (channel: Channel$1) => void;
|
|
1217
|
+
/** Inject external emoji picker component */
|
|
1218
|
+
EmojiPickerComponent?: React.ComponentType<{
|
|
1219
|
+
onSelect: (emoji: any) => void;
|
|
1220
|
+
[key: string]: any;
|
|
1221
|
+
}>;
|
|
1222
|
+
/** Parent team channel to create topic under, will use activeChannel if not provided */
|
|
1223
|
+
parentChannel?: Channel$1;
|
|
1224
|
+
/** If provided, operates in edit mode for this topic */
|
|
1225
|
+
topic?: Channel$1;
|
|
1226
|
+
/** i18n labels */
|
|
1227
|
+
title?: string;
|
|
1228
|
+
nameLabel?: string;
|
|
1229
|
+
namePlaceholder?: string;
|
|
1230
|
+
emojiLabel?: string;
|
|
1231
|
+
descriptionLabel?: string;
|
|
1232
|
+
descriptionPlaceholder?: string;
|
|
1233
|
+
cancelButtonLabel?: string;
|
|
1234
|
+
saveButtonLabel?: string;
|
|
1235
|
+
savingButtonLabel?: string;
|
|
1236
|
+
};
|
|
1063
1237
|
|
|
1064
1238
|
declare const ChatProvider: React$1.FC<ChatProviderProps>;
|
|
1065
1239
|
|
|
@@ -1095,6 +1269,7 @@ declare function useChannelRowUpdates(channel: Channel$1, currentUserId?: string
|
|
|
1095
1269
|
*
|
|
1096
1270
|
* Reads the initial value from `channel.state.membership.banned` and subscribes
|
|
1097
1271
|
* to `member.banned` / `member.unbanned` WebSocket events for real-time updates.
|
|
1272
|
+
* If the channel is a topic, it also synchronizes with the parent channel's ban state.
|
|
1098
1273
|
*
|
|
1099
1274
|
* Only triggers a re-render when the *current user* is the target of the event.
|
|
1100
1275
|
*/
|
|
@@ -1120,6 +1295,38 @@ declare function useBlockedState(channel: Channel$1 | null | undefined, currentU
|
|
|
1120
1295
|
isBlocked: boolean;
|
|
1121
1296
|
};
|
|
1122
1297
|
|
|
1298
|
+
type OnlineStatus = 'online' | 'offline' | 'unknown';
|
|
1299
|
+
/**
|
|
1300
|
+
* Hook that returns the online/offline status of a specific user.
|
|
1301
|
+
*
|
|
1302
|
+
* The status is determined by checking `channel.state.watchers` on the
|
|
1303
|
+
* "friend" channel (direct channel where both members have `owner` role).
|
|
1304
|
+
* Real-time updates are received via `user.watching.start` and
|
|
1305
|
+
* `user.watching.stop` WebSocket events on that channel.
|
|
1306
|
+
*
|
|
1307
|
+
* Returns `'unknown'` if the user is not a friend (no qualifying channel found).
|
|
1308
|
+
*
|
|
1309
|
+
* @param userId – The user ID to check the online status of.
|
|
1310
|
+
* @param channels – The full list of loaded channels (from ChannelList).
|
|
1311
|
+
*/
|
|
1312
|
+
declare function useOnlineStatus(userId: string | undefined, channels: Channel$1[]): OnlineStatus;
|
|
1313
|
+
|
|
1314
|
+
/**
|
|
1315
|
+
* Bulk hook that returns a `Set<string>` of user IDs that are currently online.
|
|
1316
|
+
*
|
|
1317
|
+
* Only users who are "friends" (exist in a direct channel where both
|
|
1318
|
+
* members have `owner` role) are tracked. The status is derived from
|
|
1319
|
+
* `channel.state.watchers` and kept in sync via `user.watching.start`
|
|
1320
|
+
* and `user.watching.stop` WebSocket events at the **client** level
|
|
1321
|
+
* for efficiency (single subscription instead of N per-channel ones).
|
|
1322
|
+
*
|
|
1323
|
+
* Usage in ChannelList: `const onlineUsers = useOnlineUsers(channels);`
|
|
1324
|
+
* Then check: `onlineUsers.has(userId)`.
|
|
1325
|
+
*
|
|
1326
|
+
* @param channels – The full list of loaded channels (from ChannelList).
|
|
1327
|
+
*/
|
|
1328
|
+
declare function useOnlineUsers(channels: Channel$1[]): Set<string>;
|
|
1329
|
+
|
|
1123
1330
|
/**
|
|
1124
1331
|
* Hook that tracks whether the current user is in a 'pending' state for the given channel.
|
|
1125
1332
|
*/
|
|
@@ -1132,7 +1339,18 @@ declare function usePendingState(channel: Channel$1 | null | undefined, currentU
|
|
|
1132
1339
|
*/
|
|
1133
1340
|
declare const Avatar: React$1.FC<AvatarProps>;
|
|
1134
1341
|
|
|
1342
|
+
declare function computeDefaultActions(channel: Channel$1, currentUserId?: string, options?: {
|
|
1343
|
+
onAddTopic?: (channel: Channel$1) => void;
|
|
1344
|
+
onEditTopic?: (channel: Channel$1) => void;
|
|
1345
|
+
onToggleCloseTopic?: (channel: Channel$1, isClosed: boolean) => void;
|
|
1346
|
+
isBlocked?: boolean;
|
|
1347
|
+
actionLabels?: ChannelActionLabels;
|
|
1348
|
+
actionIcons?: ChannelActionIcons;
|
|
1349
|
+
}): ChannelAction[];
|
|
1350
|
+
declare const DefaultChannelActions: React$1.FC<ChannelActionsProps>;
|
|
1351
|
+
|
|
1135
1352
|
declare const ChannelItem: React$1.FC<ChannelItemProps>;
|
|
1353
|
+
declare const ChannelTopicGroup: React$1.MemoExoticComponent<({ channel, activeChannel, handleSelect, renderChannel, ChannelItemComponent, AvatarComponent, GeneralTopicAvatarComponent, TopicAvatarComponent, currentUserId, pendingBadgeLabel, blockedBadgeLabel, generalTopicLabel, closedTopicIcon, PinnedIconComponent, ChannelActionsComponent, onAddTopic, onEditTopic, onToggleCloseTopic, hiddenActions, actionLabels, actionIcons, }: any) => react_jsx_runtime.JSX.Element>;
|
|
1136
1354
|
declare const ChannelList: React$1.FC<ChannelListProps>;
|
|
1137
1355
|
|
|
1138
1356
|
/**
|
|
@@ -1154,6 +1372,8 @@ declare const Channel: React$1.FC<ChannelProps>;
|
|
|
1154
1372
|
* - `AvatarComponent` — replace the avatar
|
|
1155
1373
|
* - `renderTitle(channel)` — fully custom title rendering
|
|
1156
1374
|
* - `renderRight(channel)` — render content on the right side
|
|
1375
|
+
* - `showOnlineStatus` — show online/offline dot for friend channels (default: true)
|
|
1376
|
+
* - `OnlineIndicatorComponent` — replace the default indicator
|
|
1157
1377
|
*
|
|
1158
1378
|
* For a fully custom header, use `Channel`'s `HeaderComponent` prop instead.
|
|
1159
1379
|
*/
|
|
@@ -1193,6 +1413,7 @@ declare const MessageReactions: React$1.FC<MessageReactionsProps>;
|
|
|
1193
1413
|
declare const MessageQuickReactions: React$1.FC<{
|
|
1194
1414
|
message: FormatMessageResponse;
|
|
1195
1415
|
isOwnMessage: boolean;
|
|
1416
|
+
disabled?: boolean;
|
|
1196
1417
|
}>;
|
|
1197
1418
|
|
|
1198
1419
|
type MessageActionList = {
|
|
@@ -1239,6 +1460,79 @@ declare function replaceMentionsForPreview(text: string, message: FormatMessageR
|
|
|
1239
1460
|
mentioned_all?: boolean;
|
|
1240
1461
|
}, userMap: Record<string, string>, renderWrapper?: (userId: string, name: string) => string): string;
|
|
1241
1462
|
|
|
1463
|
+
/** Channel supports group features: roles, capabilities, settings, topics, edit, delete */
|
|
1464
|
+
declare function isGroupChannel(channel: Channel$1 | null | undefined): boolean;
|
|
1465
|
+
/** Channel is a direct (1-on-1) conversation: block/unblock, no roles */
|
|
1466
|
+
declare function isDirectChannel(channel: Channel$1 | null | undefined): boolean;
|
|
1467
|
+
/** Channel is a topic (sub-channel of a group channel) */
|
|
1468
|
+
declare function isTopicChannel(channel: Channel$1 | null | undefined): boolean;
|
|
1469
|
+
/** Channel is a public group that users can join without invite */
|
|
1470
|
+
declare function isPublicGroupChannel(channel: Channel$1 | null | undefined): boolean;
|
|
1471
|
+
/** The proxy "general" channel of a topics-enabled group */
|
|
1472
|
+
declare function isGeneralProxy(channel: Channel$1 | null | undefined): boolean;
|
|
1473
|
+
/** Channel has topics feature enabled */
|
|
1474
|
+
declare function hasTopicsEnabled(channel: Channel$1 | null | undefined): boolean;
|
|
1475
|
+
/** Whether blocked state is relevant for this channel type */
|
|
1476
|
+
declare function supportsBlocking(channel: Channel$1 | null | undefined): boolean;
|
|
1477
|
+
|
|
1478
|
+
declare const CHANNEL_ROLES: {
|
|
1479
|
+
readonly OWNER: "owner";
|
|
1480
|
+
readonly MODERATOR: "moder";
|
|
1481
|
+
readonly MEMBER: "member";
|
|
1482
|
+
readonly PENDING: "pending";
|
|
1483
|
+
readonly SKIPPED: "skipped";
|
|
1484
|
+
};
|
|
1485
|
+
type ChannelRole = typeof CHANNEL_ROLES[keyof typeof CHANNEL_ROLES] | string;
|
|
1486
|
+
/** Checks if the user is in a pending state */
|
|
1487
|
+
declare function isPendingMember(role?: string): boolean;
|
|
1488
|
+
/** Checks if the user is in a skipped state (skipped a direct message invite) */
|
|
1489
|
+
declare function isSkippedMember(role?: string): boolean;
|
|
1490
|
+
/** Checks if the user has management permissions (owner or moderator) */
|
|
1491
|
+
declare function canManageChannel(role?: string): boolean;
|
|
1492
|
+
/** Determines if the current user has the permission to remove a specific target member */
|
|
1493
|
+
declare function canRemoveTargetMember(currentUserRole?: string, targetRole?: string): boolean;
|
|
1494
|
+
/** Determines if the current user has the permission to ban a specific target member */
|
|
1495
|
+
declare function canBanTargetMember(currentUserRole?: string, targetRole?: string): boolean;
|
|
1496
|
+
/** Determines if the current user has the permission to promote a member to moderator */
|
|
1497
|
+
declare function canPromoteTargetMember(currentUserRole?: string, targetRole?: string): boolean;
|
|
1498
|
+
/** Determines if the current user has the permission to demote a moderator to simple member */
|
|
1499
|
+
declare function canDemoteTargetMember(currentUserRole?: string, targetRole?: string): boolean;
|
|
1500
|
+
/** Checks if the user is an owner of the channel */
|
|
1501
|
+
declare function isOwnerMember(role?: string): boolean;
|
|
1502
|
+
/**
|
|
1503
|
+
* Checks if a direct channel represents a "friend" relationship:
|
|
1504
|
+
* both members must have the 'owner' channel_role.
|
|
1505
|
+
*/
|
|
1506
|
+
declare function isFriendChannel(channel: Channel$1 | null | undefined, targetUserId: string, currentUserId: string): boolean;
|
|
1507
|
+
|
|
1508
|
+
declare const MESSAGE_TYPES: {
|
|
1509
|
+
readonly REGULAR: "regular";
|
|
1510
|
+
readonly SYSTEM: "system";
|
|
1511
|
+
readonly STICKER: "sticker";
|
|
1512
|
+
readonly SIGNAL: "signal";
|
|
1513
|
+
readonly ERROR: "error";
|
|
1514
|
+
};
|
|
1515
|
+
declare const ATTACHMENT_TYPES: {
|
|
1516
|
+
readonly IMAGE: "image";
|
|
1517
|
+
readonly VIDEO: "video";
|
|
1518
|
+
readonly VOICE_RECORDING: "voiceRecording";
|
|
1519
|
+
readonly LINK_PREVIEW: "linkPreview";
|
|
1520
|
+
readonly FILE: "file";
|
|
1521
|
+
readonly AUDIO: "audio";
|
|
1522
|
+
};
|
|
1523
|
+
type MessageType = (typeof MESSAGE_TYPES)[keyof typeof MESSAGE_TYPES] | string;
|
|
1524
|
+
type AttachmentType = (typeof ATTACHMENT_TYPES)[keyof typeof ATTACHMENT_TYPES] | string;
|
|
1525
|
+
declare function isSystemMessage(message: any): boolean;
|
|
1526
|
+
declare function isStickerMessage(message: any): boolean;
|
|
1527
|
+
declare function isRegularMessage(message: any): boolean;
|
|
1528
|
+
declare function isSignalMessage(message: any): boolean;
|
|
1529
|
+
declare function isImageAttachment(attachment: any): boolean;
|
|
1530
|
+
declare function isVideoAttachment(attachment: any): boolean;
|
|
1531
|
+
declare function isVoiceRecordingAttachment(attachment: any): boolean;
|
|
1532
|
+
declare function isLinkPreviewAttachment(attachment: any): boolean;
|
|
1533
|
+
declare function isImage(attachment: any): boolean;
|
|
1534
|
+
declare function isVideo(attachment: any): boolean;
|
|
1535
|
+
|
|
1242
1536
|
declare const MessageAttachment: React$1.FC<AttachmentProps>;
|
|
1243
1537
|
declare const AttachmentList: React$1.FC<{
|
|
1244
1538
|
attachments?: Attachment[];
|
|
@@ -1261,6 +1555,13 @@ declare const ErrorMessage: React$1.FC<MessageRendererProps>;
|
|
|
1261
1555
|
*/
|
|
1262
1556
|
declare const defaultMessageRenderers: Record<MessageLabel, React$1.ComponentType<MessageRendererProps>>;
|
|
1263
1557
|
|
|
1558
|
+
/**
|
|
1559
|
+
* MediaLightbox – full-screen overlay for viewing images & videos.
|
|
1560
|
+
* Supports prev/next navigation, keyboard controls, and image zoom.
|
|
1561
|
+
* Renders via React portal into document.body.
|
|
1562
|
+
*/
|
|
1563
|
+
declare const MediaLightbox: React$1.FC<MediaLightboxProps>;
|
|
1564
|
+
|
|
1264
1565
|
declare const MessageInput: React$1.FC<MessageInputProps>;
|
|
1265
1566
|
|
|
1266
1567
|
/**
|
|
@@ -1340,6 +1641,8 @@ declare const ReplyPreview: React$1.FC<ReplyPreviewProps>;
|
|
|
1340
1641
|
|
|
1341
1642
|
declare const ForwardMessageModal: React$1.FC<ForwardMessageModalProps>;
|
|
1342
1643
|
|
|
1644
|
+
declare const TopicModal: React$1.FC<TopicModalProps>;
|
|
1645
|
+
|
|
1343
1646
|
type TypingUser = {
|
|
1344
1647
|
id: string;
|
|
1345
1648
|
name?: string;
|
|
@@ -1439,4 +1742,4 @@ declare const ErmisCallProvider: React$1.FC<ErmisCallProviderProps>;
|
|
|
1439
1742
|
|
|
1440
1743
|
declare const ErmisCallUI: React$1.FC<ErmisCallUIProps>;
|
|
1441
1744
|
|
|
1442
|
-
export { type AddMemberButtonProps, type AddMemberModalProps, type AddMemberUserItemProps, type AttachButtonProps, type AttachmentItem, AttachmentList, type AttachmentProps, Avatar, type AvatarProps, type CallContextValue, Channel, ChannelHeader, type ChannelHeaderData, type ChannelHeaderProps, ChannelInfo, type ChannelInfoActionsProps, type ChannelInfoCoverProps, type ChannelInfoEmptyStateProps, type ChannelInfoFileItemProps, type ChannelInfoHeaderProps, type ChannelInfoLinkItemProps, type ChannelInfoMediaItemProps, type ChannelInfoMemberItemProps, type ChannelInfoProps, type ChannelInfoTabsProps, ChannelItem, type ChannelItemProps, ChannelList, type ChannelListProps, type ChannelProps, type ChatContextValue, ChatProvider, type ChatProviderProps, CreateChannelModal, type CreateChannelModalProps, type DateSeparatorProps, DefaultChannelInfoActions, DefaultChannelInfoCover, DefaultChannelInfoHeader, DefaultChannelInfoTabs, Dropdown, type DropdownProps, type EmojiButtonProps, type EmojiPickerProps, type ErmisCallConnectedAudioProps, type ErmisCallConnectedVideoProps, ErmisCallContext, type ErmisCallControlsBarProps, type ErmisCallErrorProps, ErmisCallProvider, type ErmisCallProviderProps, type ErmisCallRingingProps, ErmisCallUI, type ErmisCallUIProps, ErrorMessage, type FilePreviewItem, FilesPreview, type FilesPreviewProps, type ForwardChannelItemProps, ForwardMessageModal, type ForwardMessageModalProps, type JumpToLatestProps, type LatestReaction, type MediaTab, type MentionMember, type MentionPayload, MentionSuggestions, type MentionSuggestionsProps, MessageActionsBox, type MessageActionsBoxProps, MessageAttachment, type MessageBubbleProps, MessageInput, type MessageInputProps, MessageItem, type MessageItemProps, type MessageListProps, MessageQuickReactions, MessageReactions, type MessageReactionsProps, type MessageRendererProps, Modal, type ModalProps, Panel, type PinnedMessageItemProps, PinnedMessages, type PinnedMessagesProps, PollMessage, QuotedMessagePreview, type QuotedMessagePreviewProps, type ReactionUser, RegularMessage, ReplyPreview, type ReplyPreviewProps, type SendButtonProps, SignalMessage, StickerMessage, SystemMessage, SystemMessageItem, type SystemMessageItemProps, type Theme, TypingIndicator, type TypingIndicatorProps, type TypingUser, type UseChannelMessagesOptions, type UseChannelReturn, type UseLoadMessagesOptions, type UseLoadMessagesReturn, type UseMentionsOptions, type UseMentionsReturn, type UseScrollToMessageOptions, type UseScrollToMessageReturn, UserPicker, type UserPickerItemProps, type UserPickerProps, type UserPickerSelectedBoxProps, type UserPickerUser, VirtualMessageList, closeAllDropdowns, dedupMessages, defaultMessageRenderers, formatDateLabel, formatTime, getDateKey, getMessageUserId, replaceMentionsForPreview, useBannedState, useBlockedState, useCallContext, useChannel, useChannelListUpdates, useChannelMessages, useChannelRowUpdates, useChatClient, useLoadMessages, useMentions, useMessageActions, usePendingState, useScrollToMessage, useTypingIndicator };
|
|
1745
|
+
export { ATTACHMENT_TYPES, type AddMemberButtonProps, type AddMemberModalProps, type AddMemberUserItemProps, type AttachButtonProps, type AttachmentItem, AttachmentList, type AttachmentProps, type AttachmentType, Avatar, type AvatarProps, CHANNEL_ROLES, type CallContextValue, Channel, type ChannelAction, type ChannelActionsProps, ChannelHeader, type ChannelHeaderData, type ChannelHeaderProps, ChannelInfo, type ChannelInfoActionsProps, type ChannelInfoCoverProps, type ChannelInfoEmptyStateProps, type ChannelInfoFileItemProps, type ChannelInfoHeaderProps, type ChannelInfoLinkItemProps, type ChannelInfoMediaItemProps, type ChannelInfoMemberItemProps, type ChannelInfoProps, type ChannelInfoTabsProps, ChannelItem, type ChannelItemProps, ChannelList, type ChannelListProps, type ChannelProps, type ChannelRole, ChannelTopicGroup, type ChatContextValue, ChatProvider, type ChatProviderProps, CreateChannelModal, type CreateChannelModalProps, type DateSeparatorProps, DefaultChannelActions, DefaultChannelInfoActions, DefaultChannelInfoCover, DefaultChannelInfoHeader, DefaultChannelInfoTabs, Dropdown, type DropdownProps, type EmojiButtonProps, type EmojiPickerProps, type ErmisCallConnectedAudioProps, type ErmisCallConnectedVideoProps, ErmisCallContext, type ErmisCallControlsBarProps, type ErmisCallErrorProps, ErmisCallProvider, type ErmisCallProviderProps, type ErmisCallRingingProps, ErmisCallUI, type ErmisCallUIProps, ErrorMessage, type FilePreviewItem, FilesPreview, type FilesPreviewProps, type ForwardChannelItemProps, ForwardMessageModal, type ForwardMessageModalProps, type JumpToLatestProps, type LatestReaction, MESSAGE_TYPES, MediaLightbox, type MediaLightboxItem, type MediaLightboxProps, type MediaTab, type MentionMember, type MentionPayload, MentionSuggestions, type MentionSuggestionsProps, MessageActionsBox, type MessageActionsBoxProps, MessageAttachment, type MessageBubbleProps, MessageInput, type MessageInputProps, MessageItem, type MessageItemProps, type MessageListProps, MessageQuickReactions, MessageReactions, type MessageReactionsProps, type MessageRendererProps, type MessageType, Modal, type ModalProps, type OnlineStatus, Panel, type PinnedMessageItemProps, PinnedMessages, type PinnedMessagesProps, PollMessage, QuotedMessagePreview, type QuotedMessagePreviewProps, type ReactionUser, RegularMessage, ReplyPreview, type ReplyPreviewProps, type SendButtonProps, SignalMessage, StickerMessage, SystemMessage, SystemMessageItem, type SystemMessageItemProps, type Theme, TopicModal, TypingIndicator, type TypingIndicatorProps, type TypingUser, type UseChannelMessagesOptions, type UseChannelReturn, type UseLoadMessagesOptions, type UseLoadMessagesReturn, type UseMentionsOptions, type UseMentionsReturn, type UseScrollToMessageOptions, type UseScrollToMessageReturn, UserPicker, type UserPickerItemProps, type UserPickerProps, type UserPickerSelectedBoxProps, type UserPickerUser, VirtualMessageList, canBanTargetMember, canDemoteTargetMember, canManageChannel, canPromoteTargetMember, canRemoveTargetMember, closeAllDropdowns, computeDefaultActions, dedupMessages, defaultMessageRenderers, formatDateLabel, formatTime, getDateKey, getMessageUserId, hasTopicsEnabled, isDirectChannel, isFriendChannel, isGeneralProxy, isGroupChannel, isImage, isImageAttachment, isLinkPreviewAttachment, isOwnerMember, isPendingMember, isPublicGroupChannel, isRegularMessage, isSignalMessage, isSkippedMember, isStickerMessage, isSystemMessage, isTopicChannel, isVideo, isVideoAttachment, isVoiceRecordingAttachment, replaceMentionsForPreview, supportsBlocking, useBannedState, useBlockedState, useCallContext, useChannel, useChannelListUpdates, useChannelMessages, useChannelRowUpdates, useChatClient, useLoadMessages, useMentions, useMessageActions, useOnlineStatus, useOnlineUsers, usePendingState, useScrollToMessage, useTypingIndicator };
|