@realtimexsco/live-chat 1.3.0 → 1.3.2

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 CHANGED
@@ -380,7 +380,6 @@ var init_socket_service = __esm({
380
380
  });
381
381
  this.disconnect();
382
382
  }
383
- console.log("Socket: Starting connection to", config.url);
384
383
  this.currentConfig = config;
385
384
  this.isConnecting = true;
386
385
  const store = getStore();
@@ -389,7 +388,6 @@ var init_socket_service = __esm({
389
388
  this.socket = socket_ioClient.io(config.url, config.options);
390
389
  this.socket.on("connect", () => {
391
390
  this.isConnecting = false;
392
- console.log("Connected to socket with ID:", this.socket?.id);
393
391
  setConnected({ socketId: this.socket?.id || "" });
394
392
  this.emitGetOnlineUsers();
395
393
  });
@@ -567,7 +565,7 @@ var init_group_display_helpers = __esm({
567
565
  });
568
566
 
569
567
  // src/store/helpers/message.helpers.ts
570
- var getMessageSenderId, extractMessageData, mergeLastMessage, messageHasPreviewBody, getLatestMessageFromList, isOwnMessage, getMessageContent, getMessageTimestamp, statusRank, preferHigherStatus, resolveMessageStatus, mergeChatMessages;
568
+ var getMessageSenderId, extractMessageData, statusRank, preferHigherStatus, mergeLastMessage, messageHasPreviewBody, getLatestMessageFromList, isOwnMessage, getMessageContent, getMessageTimestamp, resolveMessageStatus, mergeChatMessages;
571
569
  var init_message_helpers = __esm({
572
570
  "src/store/helpers/message.helpers.ts"() {
573
571
  getMessageSenderId = (message) => String(message?.sender?._id || message?.sender?.id || message?.senderId || message?.fromUserId || message?.sender || "");
@@ -582,21 +580,32 @@ var init_message_helpers = __esm({
582
580
  const caption = payload.caption ?? payload.message?.caption ?? null;
583
581
  return { messageId, content, conversationId, status, isPinned, isStarred, attachmentId, caption };
584
582
  };
583
+ statusRank = { sent: 0, delivered: 1, read: 2 };
584
+ preferHigherStatus = (base, incoming) => {
585
+ const baseRank = statusRank[base?.status] ?? 0;
586
+ const incomingRank = statusRank[incoming?.status] ?? 0;
587
+ if (incomingRank > baseRank) {
588
+ return { ...base, status: incoming.status };
589
+ }
590
+ return base;
591
+ };
585
592
  mergeLastMessage = (existing, incoming) => {
586
593
  if (!incoming) return existing ?? null;
587
594
  if (!existing) return incoming;
588
595
  const content = incoming.content?.trim() ? incoming.content : existing.content;
589
596
  const createdAt = incoming.createdAt ?? incoming.timestamp ?? existing.createdAt ?? existing.timestamp;
590
- const existingTime = new Date(existing.createdAt || existing.timestamp || 0).getTime();
591
- const incomingTime = new Date(incoming.createdAt || incoming.timestamp || 0).getTime();
592
- const newer = incomingTime >= existingTime ? incoming : existing;
597
+ const incomingSenderId = getMessageSenderId(incoming);
598
+ const resolvedSender = incomingSenderId ? incoming.sender ?? incoming.senderId ?? incoming.fromUserId : existing.sender ?? existing.senderId ?? existing.fromUserId ?? incoming.sender;
593
599
  return {
594
600
  ...existing,
595
601
  ...incoming,
596
602
  ...content !== void 0 ? { content } : {},
597
603
  ...createdAt !== void 0 ? { createdAt } : {},
598
604
  attachments: incoming.attachments?.length ? incoming.attachments : existing.attachments,
599
- status: newer.status ?? existing.status ?? incoming.status
605
+ status: preferHigherStatus(existing, incoming).status ?? existing.status ?? incoming.status,
606
+ ...resolvedSender !== void 0 ? { sender: resolvedSender } : {},
607
+ senderId: incoming.senderId ?? existing.senderId,
608
+ fromUserId: incoming.fromUserId ?? existing.fromUserId
600
609
  };
601
610
  };
602
611
  messageHasPreviewBody = (message) => Boolean(String(message?.content || "").trim()) || Array.isArray(message?.attachments) && message.attachments.length > 0;
@@ -619,15 +628,6 @@ var init_message_helpers = __esm({
619
628
  const time = value ? new Date(value).getTime() : NaN;
620
629
  return Number.isFinite(time) ? time : 0;
621
630
  };
622
- statusRank = { sent: 0, delivered: 1, read: 2 };
623
- preferHigherStatus = (base, incoming) => {
624
- const baseRank = statusRank[base?.status] ?? 0;
625
- const incomingRank = statusRank[incoming?.status] ?? 0;
626
- if (incomingRank > baseRank) {
627
- return { ...base, status: incoming.status };
628
- }
629
- return base;
630
- };
631
631
  resolveMessageStatus = (message, conversation, loggedUserId) => {
632
632
  const existing = message?.status || "sent";
633
633
  if (!loggedUserId || !isOwnMessage(message, loggedUserId)) return existing;
@@ -802,7 +802,7 @@ var init_unread_helpers = __esm({
802
802
  });
803
803
 
804
804
  // src/store/helpers/conversation.helpers.ts
805
- var findConversationIdByMessageId, isGroupConversation, normalizeConversationRecord, resolveConversationLastMessage, syncConversationLastMessage, upsertConversationInList, findConversationById, findConversationForChannel, resolveConversationIdForChannel;
805
+ var findConversationIdByMessageId, applyMessageStatusToStore, isGroupConversation, normalizeConversationRecord, resolveConversationLastMessage, syncConversationLastMessage, upsertConversationInList, findConversationById, findConversationIdByLastMessageId, findConversationForChannel, resolveConversationIdForChannel;
806
806
  var init_conversation_helpers = __esm({
807
807
  "src/store/helpers/conversation.helpers.ts"() {
808
808
  init_group_display_helpers();
@@ -816,6 +816,40 @@ var init_conversation_helpers = __esm({
816
816
  )
817
817
  );
818
818
  };
819
+ applyMessageStatusToStore = (state, messageId, status, conversationId) => {
820
+ const normalizedMessageId = String(messageId);
821
+ const resolvedConversationId = conversationId ? String(conversationId) : findConversationIdByMessageId(state.messagesByConversation, normalizedMessageId) || findConversationIdByLastMessageId(state.conversations, normalizedMessageId) || null;
822
+ const nextConversations = state.conversations.map((conversation) => {
823
+ const lastMessageId = String(
824
+ conversation?.lastMessage?._id || conversation?.lastMessage?.id || ""
825
+ );
826
+ if (lastMessageId !== normalizedMessageId) return conversation;
827
+ return {
828
+ ...conversation,
829
+ lastMessage: mergeLastMessage(conversation.lastMessage, { status })
830
+ };
831
+ });
832
+ const nextMessagesByConversation = { ...state.messagesByConversation };
833
+ const patchMessages = (messages) => messages.map(
834
+ (message) => String(message._id || message.id) === normalizedMessageId ? preferHigherStatus(message, { status }) : message
835
+ );
836
+ if (resolvedConversationId && nextMessagesByConversation[resolvedConversationId]) {
837
+ nextMessagesByConversation[resolvedConversationId] = patchMessages(
838
+ nextMessagesByConversation[resolvedConversationId]
839
+ );
840
+ } else {
841
+ for (const cid of Object.keys(nextMessagesByConversation)) {
842
+ const patched = patchMessages(nextMessagesByConversation[cid]);
843
+ if (patched !== nextMessagesByConversation[cid]) {
844
+ nextMessagesByConversation[cid] = patched;
845
+ }
846
+ }
847
+ }
848
+ return {
849
+ conversations: nextConversations,
850
+ messagesByConversation: nextMessagesByConversation
851
+ };
852
+ };
819
853
  isGroupConversation = (conversation) => {
820
854
  if (!conversation) return false;
821
855
  return conversation.conversationType === "group" || !!conversation.isGroup;
@@ -890,13 +924,29 @@ var init_conversation_helpers = __esm({
890
924
  },
891
925
  existing
892
926
  );
893
- const withoutExisting = index >= 0 ? conversations.filter((_, itemIndex) => itemIndex !== index) : conversations;
894
- return [normalized, ...withoutExisting];
927
+ if (index < 0) {
928
+ return [normalized, ...conversations];
929
+ }
930
+ if (lastMessageChanged) {
931
+ const withoutExisting = conversations.filter((_, itemIndex) => itemIndex !== index);
932
+ return [normalized, ...withoutExisting];
933
+ }
934
+ const next = [...conversations];
935
+ next[index] = normalized;
936
+ return next;
895
937
  };
896
938
  findConversationById = (conversations, conversationId) => {
897
939
  if (!conversationId) return void 0;
898
940
  return conversations.find((c) => String(c._id) === String(conversationId));
899
941
  };
942
+ findConversationIdByLastMessageId = (conversations, messageId) => {
943
+ if (!messageId) return null;
944
+ const normalizedMessageId = String(messageId);
945
+ const match = conversations.find(
946
+ (conversation) => String(conversation?.lastMessage?._id || conversation?.lastMessage?.id || "") === normalizedMessageId
947
+ );
948
+ return match?._id ? String(match._id) : null;
949
+ };
900
950
  findConversationForChannel = (channel, loggedUserId, conversations) => {
901
951
  if (!channel || !loggedUserId) return void 0;
902
952
  if (channel.conversationId) {
@@ -1096,13 +1146,109 @@ var init_connection_actions = __esm({
1096
1146
  });
1097
1147
  }
1098
1148
  });
1099
- var chatClientId, chatAccessToken, chatBaseUrl, chatSocketUrl; exports.setChatClientId = void 0; var getChatClientId; exports.setChatAccessToken = void 0; exports.setChatBaseURL = void 0; exports.getChatBaseUrl = void 0; exports.setChatSocketUrl = void 0; exports.getChatSocketUrl = void 0; var rateLimitResetAt, isRateLimited, apiClient;
1149
+
1150
+ // src/services/api/query-params.ts
1151
+ function resolveChatApiKey(url) {
1152
+ if (!url) return null;
1153
+ const path = url.split("?")[0] || "";
1154
+ if (path.includes("/user/login/client-user")) return "login";
1155
+ if (path.includes("/user/list")) return "users";
1156
+ if (path.includes("/conversation/list")) return "conversations";
1157
+ if (path.includes("/conversation/get/information/")) return "conversationInfo";
1158
+ if (path.includes("/message/get-all-from-conversation")) return "messages";
1159
+ if (path.includes("message/pinned-messages") || path.includes("/message/pinned-messages")) {
1160
+ return "pinnedMessages";
1161
+ }
1162
+ if (path.includes("message/starred-messages") || path.includes("/message/starred-messages")) {
1163
+ return "starredMessages";
1164
+ }
1165
+ if (path.includes("/message/search-messages")) return "searchMessages";
1166
+ if (path.includes("/message/searched-message/context")) return "searchMessagesContext";
1167
+ if (path.includes("/conversation/group/create")) return "createGroup";
1168
+ if (path.includes("/conversation/group/permission/update")) return "updateGroupPermissions";
1169
+ if (path.includes("/conversation/group/information/update")) return "updateGroupInfo";
1170
+ if (path.includes("/conversation/group/participants/add-remove")) return "manageMembers";
1171
+ if (path.includes("/conversation/group/admins/add-remove")) return "manageAdmins";
1172
+ if (path.includes("/user/block-unblock")) return "blockUnblock";
1173
+ if (path.includes("/aws/upload/get-presigned-urls")) return "presignedUrls";
1174
+ return null;
1175
+ }
1176
+ function isChatGetApiKey(key) {
1177
+ return !!key && exports.CHAT_GET_API_KEYS.includes(key);
1178
+ }
1179
+ function normalizeQueryParams(params) {
1180
+ if (!params || typeof params !== "object") return {};
1181
+ const next = {};
1182
+ for (const [key, value] of Object.entries(params)) {
1183
+ if (value === void 0 || value === null) continue;
1184
+ const trimmedKey = String(key).trim();
1185
+ if (!trimmedKey) continue;
1186
+ next[trimmedKey] = String(value);
1187
+ }
1188
+ return next;
1189
+ }
1190
+ function normalizeQueryParamsByApi(byApi) {
1191
+ if (!byApi || typeof byApi !== "object") return {};
1192
+ const next = {};
1193
+ for (const [apiKey, params] of Object.entries(byApi)) {
1194
+ if (apiKey === "all" || apiKey === "get") continue;
1195
+ next[apiKey] = normalizeQueryParams(params);
1196
+ }
1197
+ return next;
1198
+ }
1199
+ exports.CHAT_GET_API_KEYS = void 0; exports.CHAT_API_KEYS = void 0;
1200
+ var init_query_params = __esm({
1201
+ "src/services/api/query-params.ts"() {
1202
+ exports.CHAT_GET_API_KEYS = [
1203
+ "users",
1204
+ "conversations",
1205
+ "conversationInfo",
1206
+ "messages",
1207
+ "pinnedMessages",
1208
+ "starredMessages",
1209
+ "searchMessages",
1210
+ "searchMessagesContext"
1211
+ ];
1212
+ exports.CHAT_API_KEYS = [
1213
+ "all",
1214
+ /** All GET endpoints listed in CHAT_GET_API_KEYS */
1215
+ "get",
1216
+ "login",
1217
+ ...exports.CHAT_GET_API_KEYS,
1218
+ "createGroup",
1219
+ "updateGroupPermissions",
1220
+ "updateGroupInfo",
1221
+ "manageMembers",
1222
+ "manageAdmins",
1223
+ "blockUnblock",
1224
+ "presignedUrls"
1225
+ ];
1226
+ }
1227
+ });
1228
+ function resolveParamsForRequest(url, method) {
1229
+ const apiKey = resolveChatApiKey(url);
1230
+ const httpMethod = (method || "get").toLowerCase();
1231
+ const isGet = httpMethod === "get";
1232
+ const perApi = apiKey ? chatQueryParamsByApi[apiKey] : void 0;
1233
+ const applyShared = Object.keys(chatQueryParams).length > 0 && (chatQueryParamApis.includes("all") || chatQueryParamApis.includes("get") && isGet && isChatGetApiKey(apiKey) || apiKey != null && chatQueryParamApis.includes(apiKey));
1234
+ if (!applyShared && !perApi) return {};
1235
+ return {
1236
+ ...applyShared ? chatQueryParams : {},
1237
+ ...perApi || {}
1238
+ };
1239
+ }
1240
+ var chatClientId, chatAccessToken, chatBaseUrl, chatSocketUrl, chatQueryParams, chatQueryParamApis, chatQueryParamsByApi; exports.setChatClientId = void 0; var getChatClientId; exports.setChatAccessToken = void 0; exports.setChatBaseURL = void 0; exports.getChatBaseUrl = void 0; exports.setChatSocketUrl = void 0; exports.getChatSocketUrl = void 0; exports.setChatQueryParams = void 0; exports.getChatQueryParams = void 0; exports.setChatQueryParamApis = void 0; exports.getChatQueryParamApis = void 0; exports.setChatQueryParamsByApi = void 0; exports.getChatQueryParamsByApi = void 0; var rateLimitResetAt, isRateLimited, apiClient;
1100
1241
  var init_client = __esm({
1101
1242
  "src/services/api/client.ts"() {
1243
+ init_query_params();
1244
+ init_query_params();
1102
1245
  chatClientId = "";
1103
1246
  chatAccessToken = "";
1104
1247
  chatBaseUrl = "";
1105
1248
  chatSocketUrl = "";
1249
+ chatQueryParams = {};
1250
+ chatQueryParamApis = ["get"];
1251
+ chatQueryParamsByApi = {};
1106
1252
  exports.setChatClientId = (id) => {
1107
1253
  chatClientId = id.trim();
1108
1254
  };
@@ -1119,6 +1265,22 @@ var init_client = __esm({
1119
1265
  chatSocketUrl = url.trim();
1120
1266
  };
1121
1267
  exports.getChatSocketUrl = () => chatSocketUrl;
1268
+ exports.setChatQueryParams = (params) => {
1269
+ chatQueryParams = normalizeQueryParams(params);
1270
+ };
1271
+ exports.getChatQueryParams = () => ({ ...chatQueryParams });
1272
+ exports.setChatQueryParamApis = (apis) => {
1273
+ if (!apis?.length) {
1274
+ chatQueryParamApis = ["get"];
1275
+ return;
1276
+ }
1277
+ chatQueryParamApis = [...apis];
1278
+ };
1279
+ exports.getChatQueryParamApis = () => [...chatQueryParamApis];
1280
+ exports.setChatQueryParamsByApi = (byApi) => {
1281
+ chatQueryParamsByApi = normalizeQueryParamsByApi(byApi);
1282
+ };
1283
+ exports.getChatQueryParamsByApi = () => ({ ...chatQueryParamsByApi });
1122
1284
  rateLimitResetAt = 0;
1123
1285
  isRateLimited = () => Date.now() < rateLimitResetAt;
1124
1286
  apiClient = axios__default.default.create({
@@ -1135,6 +1297,11 @@ var init_client = __esm({
1135
1297
  config.headers.set("platform", "web");
1136
1298
  config.headers.set("is-tenant", "true");
1137
1299
  config.headers.set("x-client-id", chatClientId);
1300
+ const requestUrl = String(config.url || "");
1301
+ const scopedParams = resolveParamsForRequest(requestUrl, config.method);
1302
+ if (Object.keys(scopedParams).length > 0) {
1303
+ config.params = { ...scopedParams, ...config.params };
1304
+ }
1138
1305
  try {
1139
1306
  const { useStore: useStore2 } = (init_useStore(), __toCommonJS(useStore_exports));
1140
1307
  const accessToken = useStore2.getState().accessToken || chatAccessToken;
@@ -2852,28 +3019,16 @@ var init_dm_actions = __esm({
2852
3019
  },
2853
3020
  receivedStatusUpdate: (payload) => {
2854
3021
  const data = extractMessageData(payload);
2855
- let { conversationId } = data;
2856
3022
  const { messageId, status } = data;
2857
- if (!messageId) return;
3023
+ let { conversationId } = data;
3024
+ if (!messageId || !status) return;
2858
3025
  set({ lastStatusUpdate: payload });
2859
3026
  if (!conversationId) {
2860
- conversationId = findConversationIdByMessageId(get().messagesByConversation, messageId);
3027
+ conversationId = findConversationIdByMessageId(get().messagesByConversation, messageId) || findConversationIdByLastMessageId(get().conversations, messageId) || void 0;
2861
3028
  }
2862
- if (!conversationId || !status) return;
2863
- set((state) => {
2864
- const messages = state.messagesByConversation[conversationId] || [];
2865
- return {
2866
- messagesByConversation: {
2867
- ...state.messagesByConversation,
2868
- [conversationId]: messages.map(
2869
- (m) => String(m._id || m.id) === String(messageId) ? preferHigherStatus(m, { status }) : m
2870
- )
2871
- },
2872
- conversations: state.conversations.map(
2873
- (c) => String(c._id) === String(conversationId) && c.lastMessage && String(c.lastMessage._id || c.lastMessage.id) === String(messageId) ? { ...c, lastMessage: mergeLastMessage(c.lastMessage, { status }) } : c
2874
- )
2875
- };
2876
- });
3029
+ set((state) => ({
3030
+ ...applyMessageStatusToStore(state, String(messageId), status, conversationId)
3031
+ }));
2877
3032
  },
2878
3033
  receivedDMMarkRead: (payload) => {
2879
3034
  const { conversationId } = payload;
@@ -3134,25 +3289,14 @@ var init_group_actions2 = __esm({
3134
3289
  let { conversationId } = data;
3135
3290
  const { messageId, status } = data;
3136
3291
  set({ lastStatusUpdate: payload });
3292
+ if (!status) return;
3137
3293
  if (messageId) {
3138
3294
  if (!conversationId) {
3139
- conversationId = findConversationIdByMessageId(get().messagesByConversation, messageId);
3295
+ conversationId = findConversationIdByMessageId(get().messagesByConversation, messageId) || findConversationIdByLastMessageId(get().conversations, messageId) || void 0;
3140
3296
  }
3141
- if (!conversationId) return;
3142
- set((state) => {
3143
- const messages = state.messagesByConversation[conversationId] || [];
3144
- return {
3145
- messagesByConversation: {
3146
- ...state.messagesByConversation,
3147
- [conversationId]: messages.map(
3148
- (m) => String(m._id || m.id) === String(messageId) ? { ...m, status } : m
3149
- )
3150
- },
3151
- conversations: state.conversations.map(
3152
- (c) => String(c._id) === String(conversationId) && c.lastMessage && String(c.lastMessage._id || c.lastMessage.id) === String(messageId) ? { ...c, lastMessage: { ...c.lastMessage, status } } : c
3153
- )
3154
- };
3155
- });
3297
+ set((state) => ({
3298
+ ...applyMessageStatusToStore(state, String(messageId), status, conversationId)
3299
+ }));
3156
3300
  return;
3157
3301
  }
3158
3302
  if (conversationId && status === "read") {
@@ -3167,7 +3311,7 @@ var init_group_actions2 = __esm({
3167
3311
  if (String(c._id) !== String(conversationId)) return c;
3168
3312
  let nextLastMessage = c.lastMessage;
3169
3313
  if (nextLastMessage && String(nextLastMessage.sender?._id || nextLastMessage.sender) === String(myId)) {
3170
- nextLastMessage = { ...nextLastMessage, status: "read" };
3314
+ nextLastMessage = mergeLastMessage(nextLastMessage, { status: "read" });
3171
3315
  }
3172
3316
  return { ...c, lastMessage: nextLastMessage };
3173
3317
  });
@@ -4320,6 +4464,9 @@ var Chat = ({
4320
4464
  loggedUserDetails,
4321
4465
  apiUrl,
4322
4466
  socketUrl,
4467
+ queryParams,
4468
+ queryParamApis,
4469
+ queryParamsByApi,
4323
4470
  channelsData,
4324
4471
  messagesData,
4325
4472
  onMessageReceived,
@@ -4339,6 +4486,9 @@ var Chat = ({
4339
4486
  if (!clientId || !loggedUserDetails) return;
4340
4487
  setSessionReady(false);
4341
4488
  exports.setChatClientId(clientId);
4489
+ exports.setChatQueryParams(queryParams);
4490
+ exports.setChatQueryParamApis(queryParamApis);
4491
+ exports.setChatQueryParamsByApi(queryParamsByApi);
4342
4492
  const resolvedApiUrl = resolveApiUrl(apiUrl);
4343
4493
  const resolvedSocketUrl = resolveSocketUrl(socketUrl, resolvedApiUrl);
4344
4494
  if (resolvedApiUrl) exports.setChatBaseURL(resolvedApiUrl);
@@ -4408,9 +4558,22 @@ var Chat = ({
4408
4558
  initializeChat();
4409
4559
  return () => {
4410
4560
  setSessionReady(false);
4561
+ exports.setChatQueryParams({});
4562
+ exports.setChatQueryParamApis(["get"]);
4563
+ exports.setChatQueryParamsByApi({});
4411
4564
  exports.socketService.disconnect();
4412
4565
  };
4413
4566
  }, [client?.id, loggedUserDetails?._id, loggedUserDetails?.email, accessToken, apiUrl, socketUrl, setSession, setSessionReady]);
4567
+ const queryConfigKey = JSON.stringify({
4568
+ queryParams: queryParams ?? {},
4569
+ queryParamApis: queryParamApis ?? ["get"],
4570
+ queryParamsByApi: queryParamsByApi ?? {}
4571
+ });
4572
+ React2__default.default.useEffect(() => {
4573
+ exports.setChatQueryParams(queryParams);
4574
+ exports.setChatQueryParamApis(queryParamApis);
4575
+ exports.setChatQueryParamsByApi(queryParamsByApi);
4576
+ }, [queryConfigKey]);
4414
4577
  React2__default.default.useEffect(() => {
4415
4578
  if (lastDM && onMessageReceived) {
4416
4579
  onMessageReceived(lastDM);
@@ -5282,19 +5445,6 @@ function SheetTitle({
5282
5445
  }
5283
5446
  );
5284
5447
  }
5285
- function SheetDescription({
5286
- className,
5287
- ...props
5288
- }) {
5289
- return /* @__PURE__ */ jsxRuntime.jsx(
5290
- radixUi.Dialog.Description,
5291
- {
5292
- "data-slot": "sheet-description",
5293
- className: cn("text-muted-foreground text-sm", className),
5294
- ...props
5295
- }
5296
- );
5297
- }
5298
5448
  function AlertDialog({
5299
5449
  ...props
5300
5450
  }) {
@@ -5622,7 +5772,7 @@ function useCreateChatDialog({
5622
5772
  onUserSelect?.({
5623
5773
  id: user._id,
5624
5774
  name: user.name.charAt(0).toUpperCase() + user.name.slice(1),
5625
- image: user.image || `https://i.pravatar.cc/150?u=${user._id}`,
5775
+ image: user.image || void 0,
5626
5776
  email: user.email,
5627
5777
  isOnline: onlineUsersIds.includes(user._id),
5628
5778
  isGroup: false,
@@ -6034,14 +6184,14 @@ var LoggedUserDetails = ({
6034
6184
  isActive: loggedUserDetails?.isActive ?? true,
6035
6185
  createdAt: loggedUserDetails?.createdAt ? new Date(loggedUserDetails.createdAt) : /* @__PURE__ */ new Date(),
6036
6186
  updatedAt: loggedUserDetails?.updatedAt ? new Date(loggedUserDetails.updatedAt) : /* @__PURE__ */ new Date(),
6037
- image: loggedUserDetails?.image || ""
6187
+ image: loggedUserDetails?.image || void 0
6038
6188
  };
6039
6189
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "shrink-0 border-b border-(--chat-border) bg-(--chat-surface) px-3 pb-3 pt-3", children: [
6040
6190
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-2.5", children: [
6041
6191
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative shrink-0", children: [
6042
6192
  /* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "size-8 ring-1 ring-(--chat-surface)", children: [
6043
- /* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: user?.image, alt: user?.name }),
6044
- /* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: "bg-(--chat-theme-10) text-[10px] font-medium text-(--chat-theme)", children: user.name.charAt(0).toUpperCase() })
6193
+ user.image ? /* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: user.image, alt: user.name }) : null,
6194
+ /* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: "bg-(--chat-theme-10) text-[10px] font-medium text-(--chat-theme)", children: (user.name || "?").charAt(0).toUpperCase() })
6045
6195
  ] }),
6046
6196
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute -bottom-0.5 -right-0.5 size-2 rounded-full border-2 border-(--chat-surface) bg-(--chat-online)" })
6047
6197
  ] }),
@@ -6660,7 +6810,7 @@ function useChannelList({ debouncedSearch = "" }) {
6660
6810
  const conversationId = String(c._id);
6661
6811
  const { id: otherParticipantId, user: resolvedUser } = isGroup ? { id: conversationId, user: null } : resolveOtherParticipant(c, loggedUserDetails?._id, allUsers);
6662
6812
  const name = isGroup ? c.groupName || c.name || "Group Chat" : resolvedUser?.name || "Unknown User";
6663
- const image = isGroup ? resolveGroupImage(c) : resolvedUser?.image || (otherParticipantId ? `https://i.pravatar.cc/150?u=${otherParticipantId}` : void 0);
6813
+ const image = isGroup ? resolveGroupImage(c) : resolvedUser?.image || void 0;
6664
6814
  const isOnline = isGroup ? false : otherParticipantId ? onlineUserIds.includes(otherParticipantId) : false;
6665
6815
  const unreadCount = normalizeUnreadCount(c.unreadCount, loggedUserDetails?._id);
6666
6816
  const isTyping = typingUsersByConv[String(c._id)]?.length > 0;
@@ -6676,15 +6826,13 @@ function useChannelList({ debouncedSearch = "" }) {
6676
6826
  }
6677
6827
  }
6678
6828
  const draftPreview = getConversationDraftPreview(conversationId);
6679
- const lastMsgSenderId = String(
6680
- resolvedLastMessage?.sender?._id || resolvedLastMessage?.sender || ""
6681
- );
6682
- const isOwnLastMessage = lastMsgSenderId === String(loggedUserDetails?._id);
6683
- const lastMessageStatus = resolveMessageStatus(
6684
- resolvedLastMessage,
6685
- c,
6686
- loggedUserDetails?._id
6687
- );
6829
+ const storedLastMessage = c.lastMessage;
6830
+ const storedLastMessageId = String(storedLastMessage?._id || storedLastMessage?.id || "");
6831
+ const resolvedLastMessageId = String(resolvedLastMessage?._id || resolvedLastMessage?.id || "");
6832
+ const lastMessageStatus = storedLastMessageId && resolvedLastMessageId && storedLastMessageId === resolvedLastMessageId ? preferHigherStatus(
6833
+ { status: storedLastMessage?.status },
6834
+ { status: resolvedLastMessage?.status }
6835
+ ).status ?? storedLastMessage?.status ?? resolvedLastMessage?.status : storedLastMessage?.status;
6688
6836
  return {
6689
6837
  id: isGroup ? conversationId : otherParticipantId,
6690
6838
  conversationId,
@@ -6698,12 +6846,11 @@ function useChannelList({ debouncedSearch = "" }) {
6698
6846
  unreadCount,
6699
6847
  isTyping,
6700
6848
  draftPreview,
6701
- isOwnLastMessage,
6702
6849
  pinnedCount: c.pinnedCount,
6703
6850
  starredCount: c.starredCount,
6704
6851
  lastMessage: {
6705
6852
  content: lastMessageContent,
6706
- timestamp: resolvedLastMessage?.createdAt ? formatSidebarTime(resolvedLastMessage.createdAt) : "",
6853
+ timestamp: resolvedLastMessage?.createdAt ? formatSidebarTime(resolvedLastMessage.createdAt) : c.lastMessage?.createdAt ? formatSidebarTime(c.lastMessage.createdAt) : "",
6707
6854
  status: lastMessageStatus,
6708
6855
  sender: "User"
6709
6856
  }
@@ -6732,7 +6879,7 @@ function useChannelList({ debouncedSearch = "" }) {
6732
6879
  init_store_helpers();
6733
6880
  function ChannelListItem({ channel, activeChannel, onChannelSelect }) {
6734
6881
  const isActive = activeChannel?.conversationId ? String(activeChannel.conversationId) === String(channel.conversationId) : activeChannel?.id === channel.id;
6735
- const showReadReceipt = channel.isOwnLastMessage && !channel.unreadCount && !channel.isTyping && !channel.draftPreview;
6882
+ const showReadReceipt = !!channel.lastMessage?.status && !channel.unreadCount && !channel.isTyping && !channel.draftPreview;
6736
6883
  const lastStatus = channel.lastMessage?.status;
6737
6884
  return /* @__PURE__ */ jsxRuntime.jsxs(
6738
6885
  "div",
@@ -6745,7 +6892,7 @@ function ChannelListItem({ channel, activeChannel, onChannelSelect }) {
6745
6892
  children: [
6746
6893
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative shrink-0", children: [
6747
6894
  /* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "size-9", children: [
6748
- /* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: channel.image, alt: channel.name }),
6895
+ channel.image ? /* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: channel.image, alt: channel.name }) : null,
6749
6896
  /* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { className: cn(
6750
6897
  "text-[10px] font-medium",
6751
6898
  isActive ? "bg-(--chat-theme-20) text-(--chat-theme)" : "bg-(--chat-input-bg) text-(--chat-muted)"
@@ -8387,34 +8534,33 @@ function MessageForwardedLabel({ isSender, className, overlay }) {
8387
8534
  }
8388
8535
  );
8389
8536
  }
8537
+ function GroupSenderName({ name, className }) {
8538
+ return /* @__PURE__ */ jsxRuntime.jsx(
8539
+ "span",
8540
+ {
8541
+ className: cn(
8542
+ "block max-w-full truncate text-[13px] font-semibold leading-[1.15] tracking-tight text-(--chat-incoming-text)",
8543
+ className
8544
+ ),
8545
+ children: name
8546
+ }
8547
+ );
8548
+ }
8390
8549
 
8391
8550
  // src/chat/lib/chat-message-bubble.ts
8392
- function getBubbleCornerClasses(isSender, isGroupedWithPrev, isGroupedWithNext) {
8393
- if (isSender) {
8394
- return cn(
8395
- "rounded-tl-[18px] rounded-bl-[18px]",
8396
- isGroupedWithPrev ? "rounded-tr-[6px]" : "rounded-tr-[18px]",
8397
- isGroupedWithNext ? "rounded-br-[6px]" : "rounded-br-[4px]"
8398
- );
8399
- }
8400
- return cn(
8401
- "rounded-tr-[18px] rounded-br-[18px]",
8402
- isGroupedWithPrev ? "rounded-tl-[6px]" : "rounded-tl-[18px]",
8403
- isGroupedWithNext ? "rounded-bl-[6px]" : "rounded-bl-[4px]"
8404
- );
8551
+ function getBubbleCornerClasses() {
8552
+ return "rounded-tl-[18px] rounded-tr-[18px] rounded-br-[18px] rounded-bl-none";
8405
8553
  }
8406
8554
  function getChatBubbleClasses({
8407
8555
  isSender = false,
8408
- isGroupedWithPrev = false,
8409
- isGroupedWithNext = false,
8410
8556
  surface,
8411
8557
  className
8412
8558
  }) {
8413
8559
  const resolvedSurface = surface ?? (isSender ? "sent" : "received");
8414
8560
  const isNeutral = resolvedSurface === "neutral";
8415
8561
  return cn(
8416
- "relative shadow-[0_1px_2px_rgba(15,23,42,0.06)]",
8417
- getBubbleCornerClasses(isSender, isGroupedWithPrev, isGroupedWithNext),
8562
+ "relative",
8563
+ getBubbleCornerClasses(),
8418
8564
  resolvedSurface === "sent" && "chat-bubble-sent bg-(--chat-theme) text-white",
8419
8565
  resolvedSurface === "received" && "chat-bubble-received border border-(--chat-border)/60 bg-(--chat-incoming-bubble) text-(--chat-incoming-text)",
8420
8566
  isNeutral && "chat-bubble-received border border-(--chat-border)/60 bg-(--chat-incoming-bubble) text-(--chat-incoming-text)",
@@ -10229,8 +10375,6 @@ function MessageAttachmentsView({
10229
10375
  "relative w-full",
10230
10376
  isBubbleLayout && getChatBubbleClasses({
10231
10377
  isSender,
10232
- isGroupedWithPrev,
10233
- isGroupedWithNext,
10234
10378
  surface: bubbleSurface,
10235
10379
  className: cn(
10236
10380
  isImageOnlyBubble ? "p-0" : isForwarded ? "px-2 py-0.5" : "px-2.5 py-1"
@@ -10238,7 +10382,7 @@ function MessageAttachmentsView({
10238
10382
  })
10239
10383
  ),
10240
10384
  children: [
10241
- !isSender && showSenderLabel && senderName && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-0.5 pb-1 text-[13px] font-bold leading-tight text-(--chat-text)", children: senderName }),
10385
+ !isSender && showSenderLabel && senderName && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-0.5 pb-1", children: /* @__PURE__ */ jsxRuntime.jsx(GroupSenderName, { name: senderName }) }),
10242
10386
  isBubbleLayout && isForwarded && !isForwardedImageOnly && /* @__PURE__ */ jsxRuntime.jsx(MessageForwardedLabel, { isSender, className: "px-0 pt-0 pb-0" }),
10243
10387
  isBubbleLayout && replySnippet ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 pb-1", children: replySnippet }) : null,
10244
10388
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(
@@ -11650,42 +11794,60 @@ var PermissionDrawer = ({ isOpen, onOpenChange, conversationId, conversationInfo
11650
11794
  { key: "allowMemberRemove", label: "Only Admin Can Remove Members", desc: "Only administrators can remove other participants.", inverted: true },
11651
11795
  { key: "moderationEnabled", label: "Moderation Enabled", desc: "Enables advanced message moderation features." }
11652
11796
  ];
11653
- return /* @__PURE__ */ jsxRuntime.jsx(Sheet, { open: isOpen, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(ChatSheetContent, { className: "flex h-full w-full flex-col p-0 sm:max-w-md", children: [
11654
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6 border-b", children: /* @__PURE__ */ jsxRuntime.jsxs(SheetHeader, { children: [
11655
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
11656
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 bg-primary/10 rounded-lg text-primary", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.UserKey, { size: 20 }) }),
11657
- /* @__PURE__ */ jsxRuntime.jsx(SheetTitle, { className: "text-xl font-bold", children: "Group Permissions" })
11797
+ return /* @__PURE__ */ jsxRuntime.jsx(Sheet, { open: isOpen, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(ChatSheetContent, { showCloseButton: true, className: "sm:max-w-[380px]", children: [
11798
+ /* @__PURE__ */ jsxRuntime.jsxs(SheetHeader, { className: chatSheetHeaderClass, children: [
11799
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
11800
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.UserKey, { size: 15, className: "shrink-0 text-(--chat-theme)" }),
11801
+ /* @__PURE__ */ jsxRuntime.jsx(SheetTitle, { className: chatSheetTitleClass, children: "Group Permissions" })
11658
11802
  ] }),
11659
- /* @__PURE__ */ jsxRuntime.jsx(SheetDescription, { children: "Manage what members can and cannot do in this group." })
11660
- ] }) }),
11661
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-y-auto p-6 space-y-6", children: permissionItems.map((item) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-4", children: [
11662
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-0.5", children: [
11663
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold text-(--chat-text)", children: item.label }),
11664
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs leading-relaxed text-(--chat-muted)", children: item.desc })
11803
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: chatSheetSubtitleClass, children: "Manage what members can and cannot do in this group." })
11804
+ ] }),
11805
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(chatSheetBodyClass, "flex flex-col px-2.5 py-2"), children: [
11806
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "mb-2.5 flex-1", children: [
11807
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "mb-1 px-0.5 text-[10px] font-semibold uppercase tracking-wide text-(--chat-muted)", children: "Permissions" }),
11808
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-(--chat-border) px-3", children: permissionItems.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(
11809
+ "div",
11810
+ {
11811
+ className: cn(
11812
+ "flex items-start justify-between gap-3 py-2.5",
11813
+ index < permissionItems.length - 1 && "border-b border-(--chat-border)"
11814
+ ),
11815
+ children: [
11816
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 space-y-0.5", children: [
11817
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[12px] font-semibold leading-snug text-(--chat-text)", children: item.label }),
11818
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[10px] leading-relaxed text-(--chat-muted)", children: item.desc })
11819
+ ] }),
11820
+ /* @__PURE__ */ jsxRuntime.jsx(
11821
+ Switch,
11822
+ {
11823
+ size: "sm",
11824
+ className: "mt-0.5 shrink-0 data-[state=checked]:bg-(--chat-theme) data-[state=unchecked]:bg-(--chat-border)",
11825
+ checked: "inverted" in item && item.inverted ? !permissions[item.key] : permissions[item.key],
11826
+ onCheckedChange: () => handleToggle(item.key)
11827
+ }
11828
+ )
11829
+ ]
11830
+ },
11831
+ item.key
11832
+ )) })
11665
11833
  ] }),
11666
- /* @__PURE__ */ jsxRuntime.jsx(
11667
- Switch,
11834
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sticky bottom-0 border-t border-(--chat-border) bg-(--chat-surface) px-0.5 pt-2.5 pb-1", children: /* @__PURE__ */ jsxRuntime.jsx(
11835
+ Button,
11668
11836
  {
11669
- checked: "inverted" in item && item.inverted ? !permissions[item.key] : permissions[item.key],
11670
- onCheckedChange: () => handleToggle(item.key)
11837
+ size: "sm",
11838
+ className: "h-8 w-full border border-(--chat-theme) bg-(--chat-theme) text-[12px] text-white hover:opacity-90 disabled:opacity-50",
11839
+ onClick: handleSave,
11840
+ disabled: isSaving,
11841
+ children: isSaving ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11842
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-1 size-3 animate-spin" }),
11843
+ "Saving..."
11844
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11845
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { className: "mr-1 size-3" }),
11846
+ "Save Permissions"
11847
+ ] })
11671
11848
  }
11672
- )
11673
- ] }, item.key)) }),
11674
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-(--chat-border) bg-(--chat-elevated) p-6", children: /* @__PURE__ */ jsxRuntime.jsx(
11675
- Button,
11676
- {
11677
- className: "w-full h-11 font-bold shadow-sm",
11678
- onClick: handleSave,
11679
- disabled: isSaving,
11680
- children: isSaving ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11681
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
11682
- "Saving Changes..."
11683
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11684
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { className: "mr-2 h-4 w-4" }),
11685
- "Save Permissions"
11686
- ] })
11687
- }
11688
- ) })
11849
+ ) })
11850
+ ] })
11689
11851
  ] }) });
11690
11852
  };
11691
11853
  var PermissionDrawer_default = PermissionDrawer;
@@ -12856,7 +13018,7 @@ var MessageToolbar = ({
12856
13018
  }
12857
13019
  ),
12858
13020
  /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: isReactionOpen, onOpenChange: setIsReactionOpen, children: [
12859
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", className: "size-7 rounded-full text-(--chat-muted) transition-all hover:bg-(--chat-hover) hover:text-(--chat-text)", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Smile, { className: "size-3.5" }) }) }),
13021
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", size: "icon", className: "size-7 rounded-full text-(--chat-text) hover:bg-(--chat-hover)", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Smile, { className: "size-3.5" }) }) }),
12860
13022
  /* @__PURE__ */ jsxRuntime.jsx(
12861
13023
  PopoverContent,
12862
13024
  {
@@ -13673,8 +13835,6 @@ function MessageItemTextBubble({
13673
13835
  }) {
13674
13836
  const bubbleClasses = (extra) => getChatBubbleClasses({
13675
13837
  isSender,
13676
- isGroupedWithPrev,
13677
- isGroupedWithNext,
13678
13838
  className: extra
13679
13839
  });
13680
13840
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -13692,7 +13852,7 @@ function MessageItemTextBubble({
13692
13852
  ),
13693
13853
  children: [
13694
13854
  isForwarded && /* @__PURE__ */ jsxRuntime.jsx(MessageForwardedLabel, { isSender, className: "px-0 pt-0 pb-0" }),
13695
- !isSender && showSenderLabel && senderName && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-bold leading-tight text-(--chat-text)", children: senderName }),
13855
+ !isSender && showSenderLabel && senderName && /* @__PURE__ */ jsxRuntime.jsx(GroupSenderName, { name: senderName, className: "mb-0.5" }),
13696
13856
  /* @__PURE__ */ jsxRuntime.jsx(
13697
13857
  MessageReplySnippet_default,
13698
13858
  {
@@ -13967,8 +14127,6 @@ function MessageItemView(props) {
13967
14127
  const showMessageSelectionRadio = selectionMode && !isDeletedForEveryone && !!mid && !hasMultiAttachments;
13968
14128
  const bubbleClasses = (extra) => getChatBubbleClasses({
13969
14129
  isSender,
13970
- isGroupedWithPrev,
13971
- isGroupedWithNext,
13972
14130
  className: extra
13973
14131
  });
13974
14132
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -15975,7 +16133,7 @@ function useForwardModal({ isOpen, onClose, items, onForwardComplete }) {
15975
16133
  (u) => String(u._id) === otherParticipantId
15976
16134
  );
15977
16135
  const name = isGroup ? c.groupName || "Group Chat" : resolvedUser?.name || otherParticipantData?.name || "Unknown User";
15978
- const image = isGroup ? c.image || "" : resolvedUser?.image || otherParticipantData?.image || `https://i.pravatar.cc/150?u=${otherParticipantId}`;
16136
+ const image = isGroup ? c.image || "" : resolvedUser?.image || otherParticipantData?.image || void 0;
15979
16137
  return {
15980
16138
  id: isGroup ? String(c._id) : otherParticipantId,
15981
16139
  conversationId: String(c._id),
@@ -16443,6 +16601,9 @@ var ChatMain = ({
16443
16601
  accessToken,
16444
16602
  apiUrl,
16445
16603
  socketUrl,
16604
+ queryParams,
16605
+ queryParamApis,
16606
+ queryParamsByApi,
16446
16607
  themeColor = "#7494ec",
16447
16608
  theme,
16448
16609
  uiConfig,
@@ -16509,6 +16670,9 @@ var ChatMain = ({
16509
16670
  uiConfig: uiConfigObj,
16510
16671
  apiUrl,
16511
16672
  socketUrl,
16673
+ queryParams,
16674
+ queryParamApis,
16675
+ queryParamsByApi,
16512
16676
  children: /* @__PURE__ */ jsxRuntime.jsx(
16513
16677
  ChatAlertsProvider,
16514
16678
  {
@@ -16716,7 +16880,7 @@ var DefaultChannelListItem = ({
16716
16880
  onSelect
16717
16881
  }) => {
16718
16882
  const { slotClassName } = useChatCustomizationOptional();
16719
- const showReadReceipt = channel.isOwnLastMessage && !channel.unreadCount && !channel.isTyping && !channel.draftPreview;
16883
+ const showReadReceipt = !!channel.lastMessage?.status && !channel.unreadCount && !channel.isTyping && !channel.draftPreview;
16720
16884
  const lastStatus = channel.lastMessage?.status;
16721
16885
  return /* @__PURE__ */ jsxRuntime.jsxs(
16722
16886
  "div",
@@ -16939,6 +17103,7 @@ exports.mergeChatCustomization = mergeChatCustomization;
16939
17103
  exports.mergeChatLayoutConfig = mergeChatLayoutConfig;
16940
17104
  exports.packageDefaultComponents = packageDefaultComponents;
16941
17105
  exports.resolveApiUrl = resolveApiUrl;
17106
+ exports.resolveChatApiKey = resolveChatApiKey;
16942
17107
  exports.resolveSocketUrl = resolveSocketUrl;
16943
17108
  exports.showNotification = showNotification;
16944
17109
  exports.uniqueList = uniqueList;