stream-chat 9.47.0 → 9.48.0

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.
@@ -5133,25 +5133,27 @@ var CommandSearchSource = class extends BaseSearchSourceSync {
5133
5133
  const selectedCommands = commands.filter(
5134
5134
  (command) => !!(command.name && command.name.toLowerCase().indexOf(searchQuery.toLowerCase()) !== -1)
5135
5135
  );
5136
- selectedCommands.sort((a, b) => {
5137
- let nameA = a.name?.toLowerCase();
5138
- let nameB = b.name?.toLowerCase();
5139
- if (nameA?.indexOf(searchQuery) === 0) {
5140
- nameA = `0${nameA}`;
5141
- }
5142
- if (nameB?.indexOf(searchQuery) === 0) {
5143
- nameB = `0${nameB}`;
5144
- }
5145
- if (nameA != null && nameB != null) {
5146
- if (nameA < nameB) {
5147
- return -1;
5136
+ if (searchQuery) {
5137
+ selectedCommands.sort((a, b) => {
5138
+ let nameA = a.name?.toLowerCase();
5139
+ let nameB = b.name?.toLowerCase();
5140
+ if (nameA?.indexOf(searchQuery) === 0) {
5141
+ nameA = `0${nameA}`;
5148
5142
  }
5149
- if (nameA > nameB) {
5150
- return 1;
5143
+ if (nameB?.indexOf(searchQuery) === 0) {
5144
+ nameB = `0${nameB}`;
5151
5145
  }
5152
- }
5153
- return 0;
5154
- });
5146
+ if (nameA != null && nameB != null) {
5147
+ if (nameA < nameB) {
5148
+ return -1;
5149
+ }
5150
+ if (nameA > nameB) {
5151
+ return 1;
5152
+ }
5153
+ }
5154
+ return 0;
5155
+ });
5156
+ }
5155
5157
  return {
5156
5158
  items: selectedCommands.map((command) => ({
5157
5159
  ...command,
@@ -7433,6 +7435,7 @@ var Thread = class extends WithSubscriptions {
7433
7435
  this.addUnsubscribeFunction(this.subscribeMarkThreadStale());
7434
7436
  this.addUnsubscribeFunction(this.subscribeNewReplies());
7435
7437
  this.addUnsubscribeFunction(this.subscribeRepliesRead());
7438
+ this.addUnsubscribeFunction(this.subscribeRepliesUnread());
7436
7439
  this.addUnsubscribeFunction(this.subscribeMessageDeleted());
7437
7440
  this.addUnsubscribeFunction(this.subscribeMessageUpdated());
7438
7441
  };
@@ -7474,6 +7477,26 @@ var Thread = class extends WithSubscriptions {
7474
7477
  }
7475
7478
  this.state.partialNext({ isStateStale: true });
7476
7479
  }).unsubscribe;
7480
+ this.subscribeRepliesUnread = () => this.client.on("notification.mark_unread", (event) => {
7481
+ if (!event.user || !event.created_at || !event.thread_id) return;
7482
+ if (event.thread_id !== this.id) return;
7483
+ const userId = event.user.id;
7484
+ const createdAt = event.created_at;
7485
+ const user = event.user;
7486
+ this.state.next((current) => ({
7487
+ ...current,
7488
+ read: {
7489
+ ...current.read,
7490
+ [userId]: {
7491
+ ...current.read[userId],
7492
+ lastReadAt: typeof event.last_read_at !== "undefined" ? new Date(event.last_read_at) : new Date(createdAt),
7493
+ user,
7494
+ firstUnreadMessageId: event.first_unread_message_id,
7495
+ unreadMessageCount: event.unread_messages ?? 0
7496
+ }
7497
+ }
7498
+ }));
7499
+ }).unsubscribe;
7477
7500
  this.subscribeNewReplies = () => this.client.on("message.new", (event) => {
7478
7501
  if (!this.client.userID || event.message?.parent_id !== this.id) {
7479
7502
  return;
@@ -12401,6 +12424,7 @@ var ThreadManager = class extends WithSubscriptions {
12401
12424
  const unsubscribeFunctions = [
12402
12425
  "health.check",
12403
12426
  "notification.mark_read",
12427
+ "notification.mark_unread",
12404
12428
  "notification.thread_message_new",
12405
12429
  "notification.channel_deleted"
12406
12430
  ].map(
@@ -16535,7 +16559,7 @@ var StreamChat = class _StreamChat {
16535
16559
  if (this.userAgent) {
16536
16560
  return this.userAgent;
16537
16561
  }
16538
- const version = "9.47.0";
16562
+ const version = "9.48.0";
16539
16563
  const clientBundle = "browser-esm";
16540
16564
  let userAgentString = "";
16541
16565
  if (this.sdkIdentifier) {