@corva/chat-core 0.1.20 → 0.1.21
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 +7 -6
- package/dist/index.js +65 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1367,11 +1367,6 @@ interface SharedRefs {
|
|
|
1367
1367
|
}
|
|
1368
1368
|
declare const sharedRefs: SharedRefs;
|
|
1369
1369
|
|
|
1370
|
-
/**
|
|
1371
|
-
* Bootstrap: creates the Revolt API + WebSocket client, wires socket event
|
|
1372
|
-
* handlers to the new stores, and populates sharedRefs. Idempotent for the
|
|
1373
|
-
* configured apiUrl.
|
|
1374
|
-
*/
|
|
1375
1370
|
declare const initChat: () => void;
|
|
1376
1371
|
|
|
1377
1372
|
interface ExternalChannel {
|
|
@@ -1521,6 +1516,12 @@ interface MemberStore {
|
|
|
1521
1516
|
syncCorvaUsers: (companyId?: number) => Promise<boolean>;
|
|
1522
1517
|
}
|
|
1523
1518
|
declare const memberStore: zustand_vanilla.StoreApi<MemberStore>;
|
|
1519
|
+
/**
|
|
1520
|
+
* DM partners from another company are not in the company sync, so after a reload they would
|
|
1521
|
+
* show as their Stoat username. Each id is looked up once; the backend omits the ones the viewer
|
|
1522
|
+
* may not message. Never rejects: a failed lookup is logged and the username stays.
|
|
1523
|
+
*/
|
|
1524
|
+
declare function resolveDmPartners(): Promise<void>;
|
|
1524
1525
|
declare const resetMemberStore: () => void;
|
|
1525
1526
|
|
|
1526
1527
|
interface TracesViewportRequest {
|
|
@@ -1810,4 +1811,4 @@ declare const createSocketEventHandlers: (config: SocketEventHandlersConfig) =>
|
|
|
1810
1811
|
|
|
1811
1812
|
declare const installUnreadWatcher: () => void;
|
|
1812
1813
|
|
|
1813
|
-
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 EditableMentionText, 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_BOUNDARY_SOURCE, MENTION_REPLACE_PATTERN, MENTION_SPLIT_PATTERN, MENTION_USERNAME_SOURCE, MUTE_PRESET_OPTIONS, type MemberStore, type MentionDisplayResolver, type MentionFormat, type MentionLookupOptions, type MentionSegment, type MentionTextSegment, type MentionUserIds, 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, type OutgoingMentionOptions, 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 TextSegment, 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, clearLastOpenedThread, compareByActivity, compareByName, compareByRecencyDesc, compareByUnreadThenRecency, configureChat, configureChatStorage, createAckScheduler, createChannelSubscription, createCorvaUserService, createDMSubscription, createGroupSubscription, createHttpClient, createLatestWinsQueue, createMemoryStorage, createMessageCache, createRevoltAPI, createRevoltSocket, createRoomTaskQueue, createSocketEventHandlers, createSoftDeletedMessage, createTypingManager, decodeMentionsForEdit, deriveAllowedChatAsset, encodeMentionsForSend, encodeOutgoingMentions, enrichWithCorvaData, ensureChatSession, extractTimestampFromULID, failOptimisticMessage, favoriteRoomsStore, findGeneralRoom, findMentionUserById, findMentionUserByUsername, formatAssetChatName, getAppCommentAttachments, getAssetChatChannel, getAssetChatSession, getAssetTypeFromDisplayName, getChatHost, getChatStorage, getCorvaUserFields, getCorvaUserName, getExternalChannel, getHydratedAckedId, getLastOpenedRoom, getLastOpenedThread, getMentionLabel, getMentionSearchHandle, getMentionedUserIds, getMessageTimestamp, getPauseUntil, getPlatformMentionUserIds, 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, isUnknownMention, isUnread, isUserOnline, isValidPausePreset, isVisibleUnread, keepChatUsed, loadUntilFound, mapCorvaMessageNote, memberStore, messageStore, navigationHistoryStore, notificationStore, onChatStorageConfigured, parseCorvaSystemMessage, prepareRoomSelection, removeMessageFromList, removeSubscription, resetAssetStore, resetAuthStore, resetChannelContentFilterStore, resetChatAssetPermissionsSnapshot, resetChatHost, resetFavoriteRoomsStore, resetMemberStore, resetMessageStore, resetNavigationHistoryStore, resetNotificationStore, resetRoomStore, resetUIStore, resolveMentionDisplayName, roomStore, saveLastChatActivity, saveLastOpenedRoom, saveLastOpenedThread, searchMessages, searchRooms, searchUsers, selectCanGoBack, selectCanGoForward, setAllowedChatAssetTypes, settleOptimisticMessage, sharedRefs, sortChannels, sortDMs, sortMessagesByTime, sortUsersByStatus, stripPlatformMentions, toEditableMentionText, toReadableMentionText, toReadableText, tokenizeMentions, uiStore, updateMessageInList, uploadAndSend, validateChannelName, waitForNextPaint, wasRecentlyActive, withChannelPreferenceDefaults };
|
|
1814
|
+
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 EditableMentionText, 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_BOUNDARY_SOURCE, MENTION_REPLACE_PATTERN, MENTION_SPLIT_PATTERN, MENTION_USERNAME_SOURCE, MUTE_PRESET_OPTIONS, type MemberStore, type MentionDisplayResolver, type MentionFormat, type MentionLookupOptions, type MentionSegment, type MentionTextSegment, type MentionUserIds, 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, type OutgoingMentionOptions, 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 TextSegment, 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, clearLastOpenedThread, compareByActivity, compareByName, compareByRecencyDesc, compareByUnreadThenRecency, configureChat, configureChatStorage, createAckScheduler, createChannelSubscription, createCorvaUserService, createDMSubscription, createGroupSubscription, createHttpClient, createLatestWinsQueue, createMemoryStorage, createMessageCache, createRevoltAPI, createRevoltSocket, createRoomTaskQueue, createSocketEventHandlers, createSoftDeletedMessage, createTypingManager, decodeMentionsForEdit, deriveAllowedChatAsset, encodeMentionsForSend, encodeOutgoingMentions, enrichWithCorvaData, ensureChatSession, extractTimestampFromULID, failOptimisticMessage, favoriteRoomsStore, findGeneralRoom, findMentionUserById, findMentionUserByUsername, formatAssetChatName, getAppCommentAttachments, getAssetChatChannel, getAssetChatSession, getAssetTypeFromDisplayName, getChatHost, getChatStorage, getCorvaUserFields, getCorvaUserName, getExternalChannel, getHydratedAckedId, getLastOpenedRoom, getLastOpenedThread, getMentionLabel, getMentionSearchHandle, getMentionedUserIds, getMessageTimestamp, getPauseUntil, getPlatformMentionUserIds, 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, isUnknownMention, isUnread, isUserOnline, isValidPausePreset, isVisibleUnread, keepChatUsed, loadUntilFound, mapCorvaMessageNote, memberStore, messageStore, navigationHistoryStore, notificationStore, onChatStorageConfigured, parseCorvaSystemMessage, prepareRoomSelection, removeMessageFromList, removeSubscription, resetAssetStore, resetAuthStore, resetChannelContentFilterStore, resetChatAssetPermissionsSnapshot, resetChatHost, resetFavoriteRoomsStore, resetMemberStore, resetMessageStore, resetNavigationHistoryStore, resetNotificationStore, resetRoomStore, resetUIStore, resolveDmPartners, resolveMentionDisplayName, roomStore, saveLastChatActivity, saveLastOpenedRoom, saveLastOpenedThread, searchMessages, searchRooms, searchUsers, selectCanGoBack, selectCanGoForward, setAllowedChatAssetTypes, settleOptimisticMessage, sharedRefs, sortChannels, sortDMs, sortMessagesByTime, sortUsersByStatus, stripPlatformMentions, toEditableMentionText, toReadableMentionText, toReadableText, tokenizeMentions, uiStore, updateMessageInList, uploadAndSend, validateChannelName, waitForNextPaint, wasRecentlyActive, withChannelPreferenceDefaults };
|
package/dist/index.js
CHANGED
|
@@ -3467,6 +3467,8 @@ var SERVER_MEMBERS_REFRESH_DELAY_MS = 500;
|
|
|
3467
3467
|
var serverRefreshTimers = /* @__PURE__ */ new Map();
|
|
3468
3468
|
var syncedExternalCompanies = /* @__PURE__ */ new Set();
|
|
3469
3469
|
var ownCompanyId = null;
|
|
3470
|
+
var ownCompanySynced = false;
|
|
3471
|
+
var lookedUpDmPartners = /* @__PURE__ */ new Set();
|
|
3470
3472
|
var seedSocketUsers = (members) => {
|
|
3471
3473
|
sharedRefs.socket?.seedUsers(members);
|
|
3472
3474
|
sharedRefs.api?.seedUserCache(members);
|
|
@@ -3717,7 +3719,12 @@ var memberStore = createStore()((set, get) => ({
|
|
|
3717
3719
|
}
|
|
3718
3720
|
const usersToSync = Array.from(userMap.values());
|
|
3719
3721
|
if (usersToSync.length === 0) return false;
|
|
3720
|
-
|
|
3722
|
+
const synced = await mapCorvaUsers(ownCompanyId, usersToSync);
|
|
3723
|
+
if (synced) {
|
|
3724
|
+
ownCompanySynced = true;
|
|
3725
|
+
void resolveDmPartners();
|
|
3726
|
+
}
|
|
3727
|
+
return synced;
|
|
3721
3728
|
}
|
|
3722
3729
|
}));
|
|
3723
3730
|
var CORVA_USERS_PAGE_SIZE = 500;
|
|
@@ -3745,6 +3752,52 @@ async function fetchCompanyCorvaUsers(companyId) {
|
|
|
3745
3752
|
}
|
|
3746
3753
|
return users;
|
|
3747
3754
|
}
|
|
3755
|
+
function applyCorvaMappings(mappings) {
|
|
3756
|
+
if (mappings.length === 0) return;
|
|
3757
|
+
const store = memberStore.getState();
|
|
3758
|
+
store.bulkSetCorvaUserMappings(mappings);
|
|
3759
|
+
mappings.forEach(({ revoltUserId, corvaUser }) => {
|
|
3760
|
+
sharedRefs.corvaUserService.setMapping(revoltUserId, corvaUser);
|
|
3761
|
+
});
|
|
3762
|
+
const currentRoomId = roomStore.getState().currentRoom?._id;
|
|
3763
|
+
store.setMembers(memberStore.getState().members, currentRoomId);
|
|
3764
|
+
memberStore.setState({ allVisibleUsersCache: null });
|
|
3765
|
+
invalidateVisibleUsers();
|
|
3766
|
+
}
|
|
3767
|
+
var CHAT_USERS_LOOKUP_LIMIT = 100;
|
|
3768
|
+
var toCorvaMapping = (row) => ({
|
|
3769
|
+
revoltUserId: row.revolt_user_id,
|
|
3770
|
+
corvaUser: {
|
|
3771
|
+
id: row.user_id,
|
|
3772
|
+
// The lookup leaves emails out so customers never see Corva staff addresses.
|
|
3773
|
+
email: "",
|
|
3774
|
+
first_name: row.first_name,
|
|
3775
|
+
last_name: row.last_name,
|
|
3776
|
+
company_id: row.company_id,
|
|
3777
|
+
profile_photo: row.profile_photo ?? void 0,
|
|
3778
|
+
title: row.title,
|
|
3779
|
+
company: { name: row.company_name ?? void 0 }
|
|
3780
|
+
}
|
|
3781
|
+
});
|
|
3782
|
+
async function resolveDmPartners() {
|
|
3783
|
+
if (!ownCompanySynced) return;
|
|
3784
|
+
const ownUserId = authStore.getState().user?._id;
|
|
3785
|
+
const { corvaUserMappings } = memberStore.getState();
|
|
3786
|
+
const unresolved = roomStore.getState().subscriptions.filter((sub) => sub.t === "d").map((sub) => sub.dmUserId || sub.recipients?.find((id) => id !== ownUserId)).filter((id) => !!id && !corvaUserMappings[id] && !lookedUpDmPartners.has(id));
|
|
3787
|
+
const ids = [...new Set(unresolved)];
|
|
3788
|
+
ids.forEach((id) => lookedUpDmPartners.add(id));
|
|
3789
|
+
try {
|
|
3790
|
+
for (let start = 0; start < ids.length; start += CHAT_USERS_LOOKUP_LIMIT) {
|
|
3791
|
+
const response = await getChatHost().corvaApi.get(
|
|
3792
|
+
"/v2/integration/revolt_chat_users",
|
|
3793
|
+
{ revolt_user_ids: ids.slice(start, start + CHAT_USERS_LOOKUP_LIMIT) }
|
|
3794
|
+
);
|
|
3795
|
+
applyCorvaMappings((response?.data ?? []).map(toCorvaMapping));
|
|
3796
|
+
}
|
|
3797
|
+
} catch (error) {
|
|
3798
|
+
console.error("Failed to resolve DM partners:", error);
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3748
3801
|
var revoltUsernamesForEmail = (email) => {
|
|
3749
3802
|
const username = email.split("@")[0].toLowerCase().slice(0, 32);
|
|
3750
3803
|
return [username, username.replace(/\+/g, ".")];
|
|
@@ -3767,17 +3820,7 @@ async function mapCorvaUsers(companyId, revoltUsers) {
|
|
|
3767
3820
|
mappings.push({ revoltUserId: revoltUser._id, corvaUser });
|
|
3768
3821
|
}
|
|
3769
3822
|
});
|
|
3770
|
-
|
|
3771
|
-
store.bulkSetCorvaUserMappings(mappings);
|
|
3772
|
-
mappings.forEach(({ revoltUserId, corvaUser }) => {
|
|
3773
|
-
sharedRefs.corvaUserService.setMapping(revoltUserId, corvaUser);
|
|
3774
|
-
});
|
|
3775
|
-
if (mappings.length > 0) {
|
|
3776
|
-
const currentRoomId = roomStore.getState().currentRoom?._id;
|
|
3777
|
-
store.setMembers(memberStore.getState().members, currentRoomId);
|
|
3778
|
-
memberStore.setState({ allVisibleUsersCache: null });
|
|
3779
|
-
invalidateVisibleUsers();
|
|
3780
|
-
}
|
|
3823
|
+
applyCorvaMappings(mappings);
|
|
3781
3824
|
return true;
|
|
3782
3825
|
} catch (error) {
|
|
3783
3826
|
console.error("Failed to sync Corva users:", error);
|
|
@@ -3789,6 +3832,8 @@ var resetMemberStore = () => {
|
|
|
3789
3832
|
serverRefreshTimers.clear();
|
|
3790
3833
|
syncedExternalCompanies.clear();
|
|
3791
3834
|
ownCompanyId = null;
|
|
3835
|
+
ownCompanySynced = false;
|
|
3836
|
+
lookedUpDmPartners.clear();
|
|
3792
3837
|
invalidateVisibleUsers();
|
|
3793
3838
|
memberStore.setState(getInitialState7());
|
|
3794
3839
|
};
|
|
@@ -6238,9 +6283,16 @@ var installUnreadWatcher = () => {
|
|
|
6238
6283
|
};
|
|
6239
6284
|
|
|
6240
6285
|
// src/store/init.ts
|
|
6286
|
+
var dmPartnersWatched = false;
|
|
6241
6287
|
var initChat = () => {
|
|
6242
6288
|
const { apiUrl, wsUrl, platform } = getChatHost();
|
|
6243
6289
|
installUnreadWatcher();
|
|
6290
|
+
if (!dmPartnersWatched) {
|
|
6291
|
+
dmPartnersWatched = true;
|
|
6292
|
+
roomStore.subscribe((state, previous) => {
|
|
6293
|
+
if (state.subscriptions !== previous.subscriptions) void resolveDmPartners();
|
|
6294
|
+
});
|
|
6295
|
+
}
|
|
6244
6296
|
if (sharedRefs.serverUrl === apiUrl && sharedRefs.api) return;
|
|
6245
6297
|
if (sharedRefs.socket) {
|
|
6246
6298
|
try {
|
|
@@ -6335,6 +6387,6 @@ function ensureChatSession(corvaUser) {
|
|
|
6335
6387
|
return inFlight;
|
|
6336
6388
|
}
|
|
6337
6389
|
|
|
6338
|
-
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_BOUNDARY_SOURCE, MENTION_REPLACE_PATTERN, MENTION_SPLIT_PATTERN, MENTION_USERNAME_SOURCE, 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, clearLastOpenedThread, compareByActivity, compareByName, compareByRecencyDesc, compareByUnreadThenRecency, configureChat, configureChatStorage, createAckScheduler, createChannelSubscription, createCorvaUserService, createDMSubscription, createGroupSubscription, createHttpClient, createLatestWinsQueue, createMemoryStorage, createMessageCache, createRevoltAPI, createRevoltSocket, createRoomTaskQueue, createSocketEventHandlers, createSoftDeletedMessage, createTypingManager, decodeMentionsForEdit, deriveAllowedChatAsset, encodeMentionsForSend, encodeOutgoingMentions, enrichWithCorvaData, ensureChatSession, extractTimestampFromULID, failOptimisticMessage, favoriteRoomsStore, findGeneralRoom, findMentionUserById, findMentionUserByUsername, formatAssetChatName, getAppCommentAttachments, getAssetChatChannel, getAssetChatSession, getAssetTypeFromDisplayName, getChatHost, getChatStorage, getCorvaUserFields, getCorvaUserName, getExternalChannel, getHydratedAckedId, getLastOpenedRoom, getLastOpenedThread, getMentionLabel, getMentionSearchHandle, getMentionedUserIds, getMessageTimestamp, getPauseUntil, getPlatformMentionUserIds, 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, isUnknownMention, isUnread, isUserOnline, isValidPausePreset, isVisibleUnread, keepChatUsed, loadUntilFound, mapCorvaMessageNote, memberStore, messageStore, navigationHistoryStore, notificationStore, onChatStorageConfigured, parseCorvaSystemMessage, prepareRoomSelection, removeMessageFromList, removeSubscription, resetAssetStore, resetAuthStore, resetChannelContentFilterStore, resetChatAssetPermissionsSnapshot, resetChatHost, resetFavoriteRoomsStore, resetMemberStore, resetMessageStore, resetNavigationHistoryStore, resetNotificationStore, resetRoomStore, resetUIStore, resolveMentionDisplayName, roomStore, saveLastChatActivity, saveLastOpenedRoom, saveLastOpenedThread, searchMessages, searchRooms, searchUsers, selectCanGoBack, selectCanGoForward, setAllowedChatAssetTypes, settleOptimisticMessage, sharedRefs, sortChannels, sortDMs, sortMessagesByTime, sortUsersByStatus, stripPlatformMentions, toEditableMentionText, toReadableMentionText, toReadableText, tokenizeMentions, uiStore, updateMessageInList, uploadAndSend, validateChannelName, waitForNextPaint, wasRecentlyActive, withChannelPreferenceDefaults };
|
|
6390
|
+
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_BOUNDARY_SOURCE, MENTION_REPLACE_PATTERN, MENTION_SPLIT_PATTERN, MENTION_USERNAME_SOURCE, 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, clearLastOpenedThread, compareByActivity, compareByName, compareByRecencyDesc, compareByUnreadThenRecency, configureChat, configureChatStorage, createAckScheduler, createChannelSubscription, createCorvaUserService, createDMSubscription, createGroupSubscription, createHttpClient, createLatestWinsQueue, createMemoryStorage, createMessageCache, createRevoltAPI, createRevoltSocket, createRoomTaskQueue, createSocketEventHandlers, createSoftDeletedMessage, createTypingManager, decodeMentionsForEdit, deriveAllowedChatAsset, encodeMentionsForSend, encodeOutgoingMentions, enrichWithCorvaData, ensureChatSession, extractTimestampFromULID, failOptimisticMessage, favoriteRoomsStore, findGeneralRoom, findMentionUserById, findMentionUserByUsername, formatAssetChatName, getAppCommentAttachments, getAssetChatChannel, getAssetChatSession, getAssetTypeFromDisplayName, getChatHost, getChatStorage, getCorvaUserFields, getCorvaUserName, getExternalChannel, getHydratedAckedId, getLastOpenedRoom, getLastOpenedThread, getMentionLabel, getMentionSearchHandle, getMentionedUserIds, getMessageTimestamp, getPauseUntil, getPlatformMentionUserIds, 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, isUnknownMention, isUnread, isUserOnline, isValidPausePreset, isVisibleUnread, keepChatUsed, loadUntilFound, mapCorvaMessageNote, memberStore, messageStore, navigationHistoryStore, notificationStore, onChatStorageConfigured, parseCorvaSystemMessage, prepareRoomSelection, removeMessageFromList, removeSubscription, resetAssetStore, resetAuthStore, resetChannelContentFilterStore, resetChatAssetPermissionsSnapshot, resetChatHost, resetFavoriteRoomsStore, resetMemberStore, resetMessageStore, resetNavigationHistoryStore, resetNotificationStore, resetRoomStore, resetUIStore, resolveDmPartners, resolveMentionDisplayName, roomStore, saveLastChatActivity, saveLastOpenedRoom, saveLastOpenedThread, searchMessages, searchRooms, searchUsers, selectCanGoBack, selectCanGoForward, setAllowedChatAssetTypes, settleOptimisticMessage, sharedRefs, sortChannels, sortDMs, sortMessagesByTime, sortUsersByStatus, stripPlatformMentions, toEditableMentionText, toReadableMentionText, toReadableText, tokenizeMentions, uiStore, updateMessageInList, uploadAndSend, validateChannelName, waitForNextPaint, wasRecentlyActive, withChannelPreferenceDefaults };
|
|
6339
6391
|
//# sourceMappingURL=index.js.map
|
|
6340
6392
|
//# sourceMappingURL=index.js.map
|