@corva/chat-core 0.1.8 → 0.1.10

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.d.ts CHANGED
@@ -109,6 +109,11 @@ declare const CORVA_MESSAGE_TYPES: {
109
109
  readonly FORWARD: "fwd";
110
110
  readonly APP_COMMENT: "cmt";
111
111
  };
112
+ declare const CORVA_JOIN_MESSAGE_TYPE = "join";
113
+ interface JoinWirePayload {
114
+ userId: string;
115
+ name?: string;
116
+ }
112
117
  interface ForwardWirePayload {
113
118
  cid: string;
114
119
  mid: string;
@@ -137,6 +142,10 @@ type CorvaSystemMessage = {
137
142
  t: typeof CORVA_MESSAGE_TYPES.APP_COMMENT;
138
143
  v: number;
139
144
  d: AppCommentWirePayload;
145
+ } | {
146
+ t: typeof CORVA_JOIN_MESSAGE_TYPE;
147
+ v: number;
148
+ d: JoinWirePayload;
140
149
  };
141
150
  type WireSeverity = 'c' | 'w' | 'i';
142
151
  interface AlertWirePayload {
@@ -525,6 +534,7 @@ interface RevoltSocketEventHandlers {
525
534
  onTyping?: (data: TypingEventData) => void;
526
535
  onRoomChange?: (roomId: string, change: unknown) => void;
527
536
  onChannelAck?: (channelId: string, messageId: string) => void;
537
+ onServerMembersChange?: (serverId: string) => void;
528
538
  onError?: (error: unknown) => void;
529
539
  }
530
540
 
@@ -602,6 +612,7 @@ declare const SYSTEM_MESSAGE_TEXTS: {
602
612
  readonly USER_ADDED: (by: string, user: string) => string;
603
613
  readonly USER_REMOVED: (by: string, user: string) => string;
604
614
  readonly USER_LEFT: (user: string) => string;
615
+ readonly USER_JOINED: (user: string) => string;
605
616
  readonly MESSAGE_PINNED: (user: string) => string;
606
617
  readonly MESSAGE_UNPINNED: (user: string) => string;
607
618
  readonly DEFAULT_USER: "User";
@@ -1441,6 +1452,7 @@ interface MemberStore {
1441
1452
  setTypingUsers: (users: string[]) => void;
1442
1453
  simulateTyping: (userKey: string, isTyping: boolean, displayName?: string) => void;
1443
1454
  loadRoomMembers: (roomId: string, roomType: RoomType, isAssetChat?: boolean) => Promise<void>;
1455
+ refreshServerMembers: (serverId: string) => void;
1444
1456
  searchUsers: (query: string) => Promise<User[]>;
1445
1457
  getUserByUsername: (username: string) => Promise<User | null>;
1446
1458
  getAllVisibleUsers: () => Promise<User[]>;
@@ -1728,10 +1740,11 @@ declare const createSocketEventHandlers: (config: SocketEventHandlersConfig) =>
1728
1740
  }) => void;
1729
1741
  onMessageDelete: (messageId: string, channelId: string) => void;
1730
1742
  onUserStatusChange: (userId: string, status: string) => void;
1743
+ onServerMembersChange: (serverId: string) => void;
1731
1744
  onInvalidSession: () => void | undefined;
1732
1745
  onError: (error: unknown) => void;
1733
1746
  };
1734
1747
 
1735
1748
  declare const installUnreadWatcher: () => void;
1736
1749
 
1737
- export { ALERT_SEVERITY, ASSET_API_FIELDS, ASSET_CHAT_PREFIXES, ASSET_NOUN, type AckScheduler, type AlertData, type AlertSeverity, type AlertWirePayload, type AppCommentAttachment, type AppCommentData, type AppCommentWirePayload, type AppStateAdapter, type AskCorvaData, type AskCorvaWirePayload, type AssetChatChannel, type AssetChatSession, type AssetStore, type Attachment, type AuthStore, CHANNEL_NAME_MAX_LENGTH, CHANNEL_TYPES, CORVA_MESSAGE_TYPES, CORVA_SYS_PREFIX, type ChannelAsset, type ChannelContentFilter, type ChannelContentFilterStore, type ChannelContentFilters, type ChannelNameValidation, type ChannelNotificationPreference, type ChannelNotificationSetting, type ChannelUnread, type ChatAsset, type ChatAssetIdentity, type ChatAssetType, type ChatDates, type ChatHost, type ChatNotifier, type ChatPlatform, type CorvaAPIUser, type CorvaApiAdapter, type CorvaRevoltAuthResponse, type CorvaSystemMessage, type CorvaUser, type CorvaUserService, DATE_SEPARATOR_LABELS, DEFAULT_CHANNEL_CONTENT_FILTER, DEFAULT_CHANNEL_CONTENT_FILTERS, DEFAULT_CHANNEL_PREFERENCE, DEFAULT_FAVORITE_ROOMS_SETTINGS, DEFAULT_HIDDEN_ROOMS_SETTINGS, DEFAULT_NOTIFICATION_PREFERENCES, DEFAULT_NOTIFICATION_SETTINGS, DEFAULT_ROOM_LIST_ORDER, DIRECT_MESSAGE_PLACEHOLDER, type ExternalChannel, type FavoriteRoomsSettings, type FavoriteRoomsStore, type FeedItemData, type FeedWirePayload, type FileAttachment, type FilterEntityWindow, type ForwardWirePayload, type ForwardedFrom, GENERAL_CHAT_NAME, type HiddenRoomsSettings, type HttpClient, type HttpClientConfig, HttpError, type HttpRequestInit, type HttpResponseLike, type JoinRequired, type KeyValueStorage, type LocatorContext, type LoginCredentials, MAX_ATTACHMENT_SIZE_BYTES, MAX_ATTACHMENT_SIZE_MB, MAX_NAVIGATION_HISTORY, MENTION_REPLACE_PATTERN, MENTION_SPLIT_PATTERN, MUTE_PRESET_OPTIONS, type MemberStore, type Message, type MessageCache, type MessageFormData, type MessageStore, NOTIFICATION_DESTINATIONS, NOTIFICATION_SETTING_ALL, NOTIFICATION_SETTING_MENTIONS, NOTIFICATION_SETTING_NOTHING, type NavigationEntry, type NavigationHistoryStore, type NotificationDestination, type NotificationPreferences, type NotificationSettings, type NotificationStore, PAUSE_INDEFINITELY, PAUSE_PRESETS, PAUSE_PRESET_OPTIONS, type PausePreset, type PausePresetOption, REVOLT_SYSTEM_USER_ID, ROOM_LIST_ORDER, type ReadyChannelData, type RevoltAPIInstance, type RevoltChannel, type RevoltIncomingMessagePayload, type RevoltLoginResponse, type RevoltMessage, type RevoltMessageResponse, type RevoltSocketConfig, type RevoltSocketEventHandlers, type RevoltSocketInstance, type RevoltUploadResponse, type RevoltUserResponse, type Room, type RoomListOrder, type RoomStore, type RoomType, SESSION_STORAGE_KEY, SIDEBAR_SECTIONS, SIDEBAR_TABS, SOFT_DELETE_MARKER, SYSTEM_MESSAGE_TEXTS, type SaveSessionParams, type SelectableAssetType, type SessionData, SessionManager, type SharedFile, type SharedRefs, type SidebarSectionKey, type SidebarTabKey, type SocketCloseEventLike, type SocketEventHandlersConfig, type StoredChannelPreference, type Subscription, type TracesViewportRequest, type TypingManager, type UIStore, type UploadAndSendResult, type UploadFile, type UploadedFile, type User, type UserStatus, type ViewportDeepLink, type ViewportIndexCurve, type ViewportMode, WEBSOCKET_CONNECTING, WEBSOCKET_OPEN, type WebSocketLike, type WireSeverity, addMessage, addOrUpdateSubscription, alertMessageAsText, assetStore, authStore, buildAppCommentMessageContent, buildAskCorvaMessageContent, buildFinalMessage, buildForwardMessageContent, buildGroupChannelName, canDeleteMessage, canEditMessage, channelContentFilterStore, channelToAsset, chatToastStore, clearLastOpenedRoom, compareByActivity, compareByName, compareByRecencyDesc, configureChat, configureChatStorage, createAckScheduler, createCorvaUserService, createDMSubscription, createGroupSubscription, createHttpClient, createLatestWinsQueue, createMemoryStorage, createMessageCache, createRevoltAPI, createRevoltSocket, createRoomTaskQueue, createSocketEventHandlers, createSoftDeletedMessage, createTypingManager, deriveAllowedChatAsset, enrichWithCorvaData, ensureChatSession, extractTimestampFromULID, failOptimisticMessage, favoriteRoomsStore, findGeneralRoom, formatAssetChatName, getAppCommentAttachments, getAssetChatChannel, getAssetChatSession, getAssetTypeFromDisplayName, getChatHost, getChatStorage, getCorvaUserFields, getExternalChannel, getLastOpenedRoom, getMessageTimestamp, getPauseUntil, getReactionCount, getRoomDisplayName, getSystemMessageWithCorvaNames, getUserDisplayName, getUserSecondaryText, handleUnauthorized, hasReactions, hasUserReacted, initChat, installUnreadWatcher, isAlertMessage, isAppCommentMessage, isAskCorvaMessage, isChannelMuted, isChatAssetTypeAllowed, isChatStorageConfigured, isCurrentRoomSelection, isDeepEqual, isDefaultChannelPreference, isDisallowedAssetChatRoom, isDmGroup, isExternalServerChannel, isForwardedMessage, isGeneralRoom, isNotificationsPaused, isPauseActive, isSoftDeletedMessage, isSystemMessage, isUnread, isUserOnline, isValidPausePreset, isVisibleUnread, keepChatUsed, loadUntilFound, memberStore, messageStore, navigationHistoryStore, notificationStore, onChatStorageConfigured, parseCorvaSystemMessage, prepareRoomSelection, removeMessageFromList, removeSubscription, resetAssetStore, resetAuthStore, resetChannelContentFilterStore, resetChatAssetPermissionsSnapshot, resetChatHost, resetFavoriteRoomsStore, resetMemberStore, resetMessageStore, resetNavigationHistoryStore, resetNotificationStore, resetRoomStore, resetUIStore, roomStore, saveLastChatActivity, saveLastOpenedRoom, searchMessages, searchRooms, searchUsers, selectCanGoBack, selectCanGoForward, setAllowedChatAssetTypes, settleOptimisticMessage, sharedRefs, sortChannels, sortDMs, sortMessagesByTime, sortUsersByStatus, stripPlatformMentions, uiStore, updateMessageInList, uploadAndSend, validateChannelName, waitForNextPaint, wasRecentlyActive, withChannelPreferenceDefaults };
1750
+ export { ALERT_SEVERITY, ASSET_API_FIELDS, ASSET_CHAT_PREFIXES, ASSET_NOUN, type AckScheduler, type AlertData, type AlertSeverity, type AlertWirePayload, type AppCommentAttachment, type AppCommentData, type AppCommentWirePayload, type AppStateAdapter, type AskCorvaData, type AskCorvaWirePayload, type AssetChatChannel, type AssetChatSession, type AssetStore, type Attachment, type AuthStore, CHANNEL_NAME_MAX_LENGTH, CHANNEL_TYPES, CORVA_JOIN_MESSAGE_TYPE, CORVA_MESSAGE_TYPES, CORVA_SYS_PREFIX, type ChannelAsset, type ChannelContentFilter, type ChannelContentFilterStore, type ChannelContentFilters, type ChannelNameValidation, type ChannelNotificationPreference, type ChannelNotificationSetting, type ChannelUnread, type ChatAsset, type ChatAssetIdentity, type ChatAssetType, type ChatDates, type ChatHost, type ChatNotifier, type ChatPlatform, type CorvaAPIUser, type CorvaApiAdapter, type CorvaRevoltAuthResponse, type CorvaSystemMessage, type CorvaUser, type CorvaUserService, DATE_SEPARATOR_LABELS, DEFAULT_CHANNEL_CONTENT_FILTER, DEFAULT_CHANNEL_CONTENT_FILTERS, DEFAULT_CHANNEL_PREFERENCE, DEFAULT_FAVORITE_ROOMS_SETTINGS, DEFAULT_HIDDEN_ROOMS_SETTINGS, DEFAULT_NOTIFICATION_PREFERENCES, DEFAULT_NOTIFICATION_SETTINGS, DEFAULT_ROOM_LIST_ORDER, DIRECT_MESSAGE_PLACEHOLDER, type ExternalChannel, type FavoriteRoomsSettings, type FavoriteRoomsStore, type FeedItemData, type FeedWirePayload, type FileAttachment, type FilterEntityWindow, type ForwardWirePayload, type ForwardedFrom, GENERAL_CHAT_NAME, type HiddenRoomsSettings, type HttpClient, type HttpClientConfig, HttpError, type HttpRequestInit, type HttpResponseLike, type JoinRequired, type JoinWirePayload, type KeyValueStorage, type LocatorContext, type LoginCredentials, MAX_ATTACHMENT_SIZE_BYTES, MAX_ATTACHMENT_SIZE_MB, MAX_NAVIGATION_HISTORY, MENTION_REPLACE_PATTERN, MENTION_SPLIT_PATTERN, MUTE_PRESET_OPTIONS, type MemberStore, type Message, type MessageCache, type MessageFormData, type MessageStore, NOTIFICATION_DESTINATIONS, NOTIFICATION_SETTING_ALL, NOTIFICATION_SETTING_MENTIONS, NOTIFICATION_SETTING_NOTHING, type NavigationEntry, type NavigationHistoryStore, type NotificationDestination, type NotificationPreferences, type NotificationSettings, type NotificationStore, PAUSE_INDEFINITELY, PAUSE_PRESETS, PAUSE_PRESET_OPTIONS, type PausePreset, type PausePresetOption, REVOLT_SYSTEM_USER_ID, ROOM_LIST_ORDER, type ReadyChannelData, type RevoltAPIInstance, type RevoltChannel, type RevoltIncomingMessagePayload, type RevoltLoginResponse, type RevoltMessage, type RevoltMessageResponse, type RevoltSocketConfig, type RevoltSocketEventHandlers, type RevoltSocketInstance, type RevoltUploadResponse, type RevoltUserResponse, type Room, type RoomListOrder, type RoomStore, type RoomType, SESSION_STORAGE_KEY, SIDEBAR_SECTIONS, SIDEBAR_TABS, SOFT_DELETE_MARKER, SYSTEM_MESSAGE_TEXTS, type SaveSessionParams, type SelectableAssetType, type SessionData, SessionManager, type SharedFile, type SharedRefs, type SidebarSectionKey, type SidebarTabKey, type SocketCloseEventLike, type SocketEventHandlersConfig, type StoredChannelPreference, type Subscription, type TracesViewportRequest, type TypingManager, type UIStore, type UploadAndSendResult, type UploadFile, type UploadedFile, type User, type UserStatus, type ViewportDeepLink, type ViewportIndexCurve, type ViewportMode, WEBSOCKET_CONNECTING, WEBSOCKET_OPEN, type WebSocketLike, type WireSeverity, addMessage, addOrUpdateSubscription, alertMessageAsText, assetStore, authStore, buildAppCommentMessageContent, buildAskCorvaMessageContent, buildFinalMessage, buildForwardMessageContent, buildGroupChannelName, canDeleteMessage, canEditMessage, channelContentFilterStore, channelToAsset, chatToastStore, clearLastOpenedRoom, compareByActivity, compareByName, compareByRecencyDesc, configureChat, configureChatStorage, createAckScheduler, createCorvaUserService, createDMSubscription, createGroupSubscription, createHttpClient, createLatestWinsQueue, createMemoryStorage, createMessageCache, createRevoltAPI, createRevoltSocket, createRoomTaskQueue, createSocketEventHandlers, createSoftDeletedMessage, createTypingManager, deriveAllowedChatAsset, enrichWithCorvaData, ensureChatSession, extractTimestampFromULID, failOptimisticMessage, favoriteRoomsStore, findGeneralRoom, formatAssetChatName, getAppCommentAttachments, getAssetChatChannel, getAssetChatSession, getAssetTypeFromDisplayName, getChatHost, getChatStorage, getCorvaUserFields, getExternalChannel, getLastOpenedRoom, getMessageTimestamp, getPauseUntil, getReactionCount, getRoomDisplayName, getSystemMessageWithCorvaNames, getUserDisplayName, getUserSecondaryText, handleUnauthorized, hasReactions, hasUserReacted, initChat, installUnreadWatcher, isAlertMessage, isAppCommentMessage, isAskCorvaMessage, isChannelMuted, isChatAssetTypeAllowed, isChatStorageConfigured, isCurrentRoomSelection, isDeepEqual, isDefaultChannelPreference, isDisallowedAssetChatRoom, isDmGroup, isExternalServerChannel, isForwardedMessage, isGeneralRoom, isNotificationsPaused, isPauseActive, isSoftDeletedMessage, isSystemMessage, isUnread, isUserOnline, isValidPausePreset, isVisibleUnread, keepChatUsed, loadUntilFound, memberStore, messageStore, navigationHistoryStore, notificationStore, onChatStorageConfigured, parseCorvaSystemMessage, prepareRoomSelection, removeMessageFromList, removeSubscription, resetAssetStore, resetAuthStore, resetChannelContentFilterStore, resetChatAssetPermissionsSnapshot, resetChatHost, resetFavoriteRoomsStore, resetMemberStore, resetMessageStore, resetNavigationHistoryStore, resetNotificationStore, resetRoomStore, resetUIStore, roomStore, saveLastChatActivity, saveLastOpenedRoom, searchMessages, searchRooms, searchUsers, selectCanGoBack, selectCanGoForward, setAllowedChatAssetTypes, settleOptimisticMessage, sharedRefs, sortChannels, sortDMs, sortMessagesByTime, sortUsersByStatus, stripPlatformMentions, uiStore, updateMessageInList, uploadAndSend, validateChannelName, waitForNextPaint, wasRecentlyActive, withChannelPreferenceDefaults };
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ var CORVA_MESSAGE_TYPES = {
24
24
  FORWARD: "fwd",
25
25
  APP_COMMENT: "cmt"
26
26
  };
27
+ var CORVA_JOIN_MESSAGE_TYPE = "join";
27
28
 
28
29
  // src/constants/constants.ts
29
30
  var ASSET_CHAT_PREFIXES = {
@@ -49,6 +50,7 @@ var SYSTEM_MESSAGE_TEXTS = {
49
50
  USER_ADDED: (by, user) => `${by} added ${user} to the channel`,
50
51
  USER_REMOVED: (by, user) => `${user} was removed from this channel by ${by}`,
51
52
  USER_LEFT: (user) => `${user} left the channel`,
53
+ USER_JOINED: (user) => `${user} joined the channel`,
52
54
  MESSAGE_PINNED: (user) => `${user} pinned a message`,
53
55
  MESSAGE_UNPINNED: (user) => `${user} unpinned a message`,
54
56
  DEFAULT_USER: "User"
@@ -285,6 +287,8 @@ var getSystemMessageWithCorvaNames = (message, getUserById) => {
285
287
  return SYSTEM_MESSAGE_TEXTS.USER_REMOVED(actorName ?? "", userName ?? "");
286
288
  case "ul":
287
289
  return SYSTEM_MESSAGE_TEXTS.USER_LEFT(userName ?? "");
290
+ case "uj":
291
+ return SYSTEM_MESSAGE_TEXTS.USER_JOINED(userName ?? "");
288
292
  case "message_pinned":
289
293
  return SYSTEM_MESSAGE_TEXTS.MESSAGE_PINNED(actorName ?? "");
290
294
  case "message_unpinned":
@@ -517,19 +521,18 @@ function buildAppCommentMessageContent(data) {
517
521
  };
518
522
  return `${CORVA_SYS_PREFIX}${JSON.stringify({ t: CORVA_MESSAGE_TYPES.APP_COMMENT, v: 1, d: payload })}`;
519
523
  }
520
- function parseCorvaSystemMessage(content) {
521
- if (!content.startsWith(CORVA_SYS_PREFIX)) {
522
- return null;
523
- }
524
- let parsed;
524
+ function parseCorvaPayload(content) {
525
+ if (!content.startsWith(CORVA_SYS_PREFIX)) return null;
525
526
  try {
526
- parsed = JSON.parse(content.slice(CORVA_SYS_PREFIX.length));
527
+ const parsed = JSON.parse(content.slice(CORVA_SYS_PREFIX.length));
528
+ return parsed && parsed.t && parsed.d ? parsed : null;
527
529
  } catch {
528
530
  return null;
529
531
  }
530
- if (!parsed || !parsed.t || !parsed.d) {
531
- return null;
532
- }
532
+ }
533
+ function parseCorvaSystemMessage(content) {
534
+ const parsed = parseCorvaPayload(content);
535
+ if (!parsed) return null;
533
536
  switch (parsed.t) {
534
537
  case CORVA_MESSAGE_TYPES.ALERT:
535
538
  return {
@@ -561,6 +564,19 @@ function parseCorvaSystemMessage(content) {
561
564
  }
562
565
  }
563
566
  function enrichWithCorvaData(message) {
567
+ const payload = parseCorvaPayload(message.msg);
568
+ if (payload?.t === CORVA_JOIN_MESSAGE_TYPE) {
569
+ const { userId, name } = payload.d;
570
+ return {
571
+ ...message,
572
+ msg: SYSTEM_MESSAGE_TEXTS.USER_JOINED(name || SYSTEM_MESSAGE_TEXTS.DEFAULT_USER),
573
+ u: { _id: "system", username: "system" },
574
+ t: "uj",
575
+ // Without a name, resolve the joined user like other system lines.
576
+ ...!name && userId && { systemUsers: { userId } },
577
+ groupable: false
578
+ };
579
+ }
564
580
  const parsed = parseCorvaSystemMessage(message.msg);
565
581
  if (!parsed) return message;
566
582
  return {
@@ -2183,6 +2199,13 @@ function createEventRouter(userCache2, sessionToken, autumnUrl, handlers, getMem
2183
2199
  }
2184
2200
  break;
2185
2201
  }
2202
+ case "ServerMemberJoin":
2203
+ case "ServerMemberLeave":
2204
+ if (typeof message.id === "string") handlers.onServerMembersChange?.(message.id);
2205
+ break;
2206
+ case "ServerMemberUpdate":
2207
+ if (message.id?.server) handlers.onServerMembersChange?.(message.id.server);
2208
+ break;
2186
2209
  case "UserUpdate":
2187
2210
  if (message.data && typeof message.data.online === "boolean") {
2188
2211
  handlers.onUserStatusChange?.(message.id, message.data.online ? "online" : "offline");
@@ -3294,6 +3317,8 @@ var invalidateVisibleUsers = () => {
3294
3317
  visibleUsersGeneration += 1;
3295
3318
  visibleUsersRequest = null;
3296
3319
  };
3320
+ var SERVER_MEMBERS_REFRESH_DELAY_MS = 500;
3321
+ var serverRefreshTimers = /* @__PURE__ */ new Map();
3297
3322
  var syncedExternalCompanies = /* @__PURE__ */ new Set();
3298
3323
  var ownCompanyId = null;
3299
3324
  var seedSocketUsers = (members) => {
@@ -3465,6 +3490,26 @@ var memberStore = createStore()((set, get) => ({
3465
3490
  console.error("Failed to load room members:", e);
3466
3491
  }
3467
3492
  },
3493
+ refreshServerMembers: (serverId) => {
3494
+ clearTimeout(serverRefreshTimers.get(serverId));
3495
+ serverRefreshTimers.set(
3496
+ serverId,
3497
+ setTimeout(() => {
3498
+ serverRefreshTimers.delete(serverId);
3499
+ const isOwnServer = serverId === authStore.getState().serverId;
3500
+ if (isOwnServer) {
3501
+ set({ serverMembersLoaded: false, serverMembersCache: null, allVisibleUsersCache: null });
3502
+ invalidateVisibleUsers();
3503
+ }
3504
+ const room = roomStore.getState().currentRoom;
3505
+ if (!room) return;
3506
+ const external = getExternalChannel(room._id);
3507
+ const showsServerMembers = external ? external.serverId === serverId : isOwnServer;
3508
+ if (!showsServerMembers || !external && room.t !== "c") return;
3509
+ get().loadRoomMembers(room._id, room.t, !!external).catch((e) => console.error("Failed to refresh room members:", e));
3510
+ }, SERVER_MEMBERS_REFRESH_DELAY_MS)
3511
+ );
3512
+ },
3468
3513
  searchUsers: async (query) => {
3469
3514
  try {
3470
3515
  const currentRoomId = roomStore.getState().currentRoom?._id;
@@ -3594,6 +3639,8 @@ async function mapCorvaUsers(companyId, revoltUsers) {
3594
3639
  }
3595
3640
  }
3596
3641
  var resetMemberStore = () => {
3642
+ serverRefreshTimers.forEach((timer) => clearTimeout(timer));
3643
+ serverRefreshTimers.clear();
3597
3644
  syncedExternalCompanies.clear();
3598
3645
  ownCompanyId = null;
3599
3646
  invalidateVisibleUsers();
@@ -5714,6 +5761,9 @@ var createSocketEventHandlers = (config) => {
5714
5761
  );
5715
5762
  memberStore.setState({ members: updatedMembers });
5716
5763
  },
5764
+ onServerMembersChange: (serverId) => {
5765
+ memberStore.getState().refreshServerMembers(serverId);
5766
+ },
5717
5767
  onInvalidSession: () => api.notifyUnauthorized("ws:Authenticate"),
5718
5768
  onError: (error) => {
5719
5769
  console.error("\u{1F50C} WebSocket error:", error);
@@ -5931,6 +5981,6 @@ function ensureChatSession(corvaUser) {
5931
5981
  return inFlight;
5932
5982
  }
5933
5983
 
5934
- export { ALERT_SEVERITY, ASSET_API_FIELDS, ASSET_CHAT_PREFIXES, ASSET_NOUN, CHANNEL_NAME_MAX_LENGTH, CHANNEL_TYPES, CORVA_MESSAGE_TYPES, CORVA_SYS_PREFIX, DATE_SEPARATOR_LABELS, DEFAULT_CHANNEL_CONTENT_FILTER, DEFAULT_CHANNEL_CONTENT_FILTERS, DEFAULT_CHANNEL_PREFERENCE, DEFAULT_FAVORITE_ROOMS_SETTINGS, DEFAULT_HIDDEN_ROOMS_SETTINGS, DEFAULT_NOTIFICATION_PREFERENCES, DEFAULT_NOTIFICATION_SETTINGS, DEFAULT_ROOM_LIST_ORDER, DIRECT_MESSAGE_PLACEHOLDER, GENERAL_CHAT_NAME, HttpError, MAX_ATTACHMENT_SIZE_BYTES, MAX_ATTACHMENT_SIZE_MB, MAX_NAVIGATION_HISTORY, MENTION_REPLACE_PATTERN, MENTION_SPLIT_PATTERN, MUTE_PRESET_OPTIONS, NOTIFICATION_DESTINATIONS, NOTIFICATION_SETTING_ALL, NOTIFICATION_SETTING_MENTIONS, NOTIFICATION_SETTING_NOTHING, PAUSE_INDEFINITELY, PAUSE_PRESETS, PAUSE_PRESET_OPTIONS, REVOLT_SYSTEM_USER_ID, ROOM_LIST_ORDER, SESSION_STORAGE_KEY, SIDEBAR_SECTIONS, SIDEBAR_TABS, SOFT_DELETE_MARKER, SYSTEM_MESSAGE_TEXTS, SessionManager, WEBSOCKET_CONNECTING, WEBSOCKET_OPEN, addMessage, addOrUpdateSubscription, alertMessageAsText, assetStore, authStore, buildAppCommentMessageContent, buildAskCorvaMessageContent, buildFinalMessage, buildForwardMessageContent, buildGroupChannelName, canDeleteMessage, canEditMessage, channelContentFilterStore, channelToAsset, chatToastStore, clearLastOpenedRoom, compareByActivity, compareByName, compareByRecencyDesc, configureChat, configureChatStorage, createAckScheduler, createCorvaUserService, createDMSubscription, createGroupSubscription, createHttpClient, createLatestWinsQueue, createMemoryStorage, createMessageCache, createRevoltAPI, createRevoltSocket, createRoomTaskQueue, createSocketEventHandlers, createSoftDeletedMessage, createTypingManager, deriveAllowedChatAsset, enrichWithCorvaData, ensureChatSession, extractTimestampFromULID, failOptimisticMessage, favoriteRoomsStore, findGeneralRoom, formatAssetChatName, getAppCommentAttachments, getAssetChatChannel, getAssetChatSession, getAssetTypeFromDisplayName, getChatHost, getChatStorage, getCorvaUserFields, getExternalChannel, getLastOpenedRoom, getMessageTimestamp, getPauseUntil, getReactionCount, getRoomDisplayName, getSystemMessageWithCorvaNames, getUserDisplayName, getUserSecondaryText, handleUnauthorized, hasReactions, hasUserReacted, initChat, installUnreadWatcher, isAlertMessage, isAppCommentMessage, isAskCorvaMessage, isChannelMuted, isChatAssetTypeAllowed, isChatStorageConfigured, isCurrentRoomSelection, isDeepEqual, isDefaultChannelPreference, isDisallowedAssetChatRoom, isDmGroup, isExternalServerChannel, isForwardedMessage, isGeneralRoom, isNotificationsPaused, isPauseActive, isSoftDeletedMessage, isSystemMessage, isUnread, isUserOnline, isValidPausePreset, isVisibleUnread, keepChatUsed, loadUntilFound, memberStore, messageStore, navigationHistoryStore, notificationStore, onChatStorageConfigured, parseCorvaSystemMessage, prepareRoomSelection, removeMessageFromList, removeSubscription, resetAssetStore, resetAuthStore, resetChannelContentFilterStore, resetChatAssetPermissionsSnapshot, resetChatHost, resetFavoriteRoomsStore, resetMemberStore, resetMessageStore, resetNavigationHistoryStore, resetNotificationStore, resetRoomStore, resetUIStore, roomStore, saveLastChatActivity, saveLastOpenedRoom, searchMessages, searchRooms, searchUsers, selectCanGoBack, selectCanGoForward, setAllowedChatAssetTypes, settleOptimisticMessage, sharedRefs, sortChannels, sortDMs, sortMessagesByTime, sortUsersByStatus, stripPlatformMentions, uiStore, updateMessageInList, uploadAndSend, validateChannelName, waitForNextPaint, wasRecentlyActive, withChannelPreferenceDefaults };
5984
+ export { ALERT_SEVERITY, ASSET_API_FIELDS, ASSET_CHAT_PREFIXES, ASSET_NOUN, CHANNEL_NAME_MAX_LENGTH, CHANNEL_TYPES, CORVA_JOIN_MESSAGE_TYPE, CORVA_MESSAGE_TYPES, CORVA_SYS_PREFIX, DATE_SEPARATOR_LABELS, DEFAULT_CHANNEL_CONTENT_FILTER, DEFAULT_CHANNEL_CONTENT_FILTERS, DEFAULT_CHANNEL_PREFERENCE, DEFAULT_FAVORITE_ROOMS_SETTINGS, DEFAULT_HIDDEN_ROOMS_SETTINGS, DEFAULT_NOTIFICATION_PREFERENCES, DEFAULT_NOTIFICATION_SETTINGS, DEFAULT_ROOM_LIST_ORDER, DIRECT_MESSAGE_PLACEHOLDER, GENERAL_CHAT_NAME, HttpError, MAX_ATTACHMENT_SIZE_BYTES, MAX_ATTACHMENT_SIZE_MB, MAX_NAVIGATION_HISTORY, MENTION_REPLACE_PATTERN, MENTION_SPLIT_PATTERN, MUTE_PRESET_OPTIONS, NOTIFICATION_DESTINATIONS, NOTIFICATION_SETTING_ALL, NOTIFICATION_SETTING_MENTIONS, NOTIFICATION_SETTING_NOTHING, PAUSE_INDEFINITELY, PAUSE_PRESETS, PAUSE_PRESET_OPTIONS, REVOLT_SYSTEM_USER_ID, ROOM_LIST_ORDER, SESSION_STORAGE_KEY, SIDEBAR_SECTIONS, SIDEBAR_TABS, SOFT_DELETE_MARKER, SYSTEM_MESSAGE_TEXTS, SessionManager, WEBSOCKET_CONNECTING, WEBSOCKET_OPEN, addMessage, addOrUpdateSubscription, alertMessageAsText, assetStore, authStore, buildAppCommentMessageContent, buildAskCorvaMessageContent, buildFinalMessage, buildForwardMessageContent, buildGroupChannelName, canDeleteMessage, canEditMessage, channelContentFilterStore, channelToAsset, chatToastStore, clearLastOpenedRoom, compareByActivity, compareByName, compareByRecencyDesc, configureChat, configureChatStorage, createAckScheduler, createCorvaUserService, createDMSubscription, createGroupSubscription, createHttpClient, createLatestWinsQueue, createMemoryStorage, createMessageCache, createRevoltAPI, createRevoltSocket, createRoomTaskQueue, createSocketEventHandlers, createSoftDeletedMessage, createTypingManager, deriveAllowedChatAsset, enrichWithCorvaData, ensureChatSession, extractTimestampFromULID, failOptimisticMessage, favoriteRoomsStore, findGeneralRoom, formatAssetChatName, getAppCommentAttachments, getAssetChatChannel, getAssetChatSession, getAssetTypeFromDisplayName, getChatHost, getChatStorage, getCorvaUserFields, getExternalChannel, getLastOpenedRoom, getMessageTimestamp, getPauseUntil, getReactionCount, getRoomDisplayName, getSystemMessageWithCorvaNames, getUserDisplayName, getUserSecondaryText, handleUnauthorized, hasReactions, hasUserReacted, initChat, installUnreadWatcher, isAlertMessage, isAppCommentMessage, isAskCorvaMessage, isChannelMuted, isChatAssetTypeAllowed, isChatStorageConfigured, isCurrentRoomSelection, isDeepEqual, isDefaultChannelPreference, isDisallowedAssetChatRoom, isDmGroup, isExternalServerChannel, isForwardedMessage, isGeneralRoom, isNotificationsPaused, isPauseActive, isSoftDeletedMessage, isSystemMessage, isUnread, isUserOnline, isValidPausePreset, isVisibleUnread, keepChatUsed, loadUntilFound, memberStore, messageStore, navigationHistoryStore, notificationStore, onChatStorageConfigured, parseCorvaSystemMessage, prepareRoomSelection, removeMessageFromList, removeSubscription, resetAssetStore, resetAuthStore, resetChannelContentFilterStore, resetChatAssetPermissionsSnapshot, resetChatHost, resetFavoriteRoomsStore, resetMemberStore, resetMessageStore, resetNavigationHistoryStore, resetNotificationStore, resetRoomStore, resetUIStore, roomStore, saveLastChatActivity, saveLastOpenedRoom, searchMessages, searchRooms, searchUsers, selectCanGoBack, selectCanGoForward, setAllowedChatAssetTypes, settleOptimisticMessage, sharedRefs, sortChannels, sortDMs, sortMessagesByTime, sortUsersByStatus, stripPlatformMentions, uiStore, updateMessageInList, uploadAndSend, validateChannelName, waitForNextPaint, wasRecentlyActive, withChannelPreferenceDefaults };
5935
5985
  //# sourceMappingURL=index.js.map
5936
5986
  //# sourceMappingURL=index.js.map