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.
@@ -5348,25 +5348,27 @@ var CommandSearchSource = class extends BaseSearchSourceSync {
5348
5348
  const selectedCommands = commands.filter(
5349
5349
  (command) => !!(command.name && command.name.toLowerCase().indexOf(searchQuery.toLowerCase()) !== -1)
5350
5350
  );
5351
- selectedCommands.sort((a, b) => {
5352
- let nameA = a.name?.toLowerCase();
5353
- let nameB = b.name?.toLowerCase();
5354
- if (nameA?.indexOf(searchQuery) === 0) {
5355
- nameA = `0${nameA}`;
5356
- }
5357
- if (nameB?.indexOf(searchQuery) === 0) {
5358
- nameB = `0${nameB}`;
5359
- }
5360
- if (nameA != null && nameB != null) {
5361
- if (nameA < nameB) {
5362
- return -1;
5351
+ if (searchQuery) {
5352
+ selectedCommands.sort((a, b) => {
5353
+ let nameA = a.name?.toLowerCase();
5354
+ let nameB = b.name?.toLowerCase();
5355
+ if (nameA?.indexOf(searchQuery) === 0) {
5356
+ nameA = `0${nameA}`;
5363
5357
  }
5364
- if (nameA > nameB) {
5365
- return 1;
5358
+ if (nameB?.indexOf(searchQuery) === 0) {
5359
+ nameB = `0${nameB}`;
5366
5360
  }
5367
- }
5368
- return 0;
5369
- });
5361
+ if (nameA != null && nameB != null) {
5362
+ if (nameA < nameB) {
5363
+ return -1;
5364
+ }
5365
+ if (nameA > nameB) {
5366
+ return 1;
5367
+ }
5368
+ }
5369
+ return 0;
5370
+ });
5371
+ }
5370
5372
  return {
5371
5373
  items: selectedCommands.map((command) => ({
5372
5374
  ...command,
@@ -7648,6 +7650,7 @@ var Thread = class extends WithSubscriptions {
7648
7650
  this.addUnsubscribeFunction(this.subscribeMarkThreadStale());
7649
7651
  this.addUnsubscribeFunction(this.subscribeNewReplies());
7650
7652
  this.addUnsubscribeFunction(this.subscribeRepliesRead());
7653
+ this.addUnsubscribeFunction(this.subscribeRepliesUnread());
7651
7654
  this.addUnsubscribeFunction(this.subscribeMessageDeleted());
7652
7655
  this.addUnsubscribeFunction(this.subscribeMessageUpdated());
7653
7656
  };
@@ -7689,6 +7692,26 @@ var Thread = class extends WithSubscriptions {
7689
7692
  }
7690
7693
  this.state.partialNext({ isStateStale: true });
7691
7694
  }).unsubscribe;
7695
+ this.subscribeRepliesUnread = () => this.client.on("notification.mark_unread", (event) => {
7696
+ if (!event.user || !event.created_at || !event.thread_id) return;
7697
+ if (event.thread_id !== this.id) return;
7698
+ const userId = event.user.id;
7699
+ const createdAt = event.created_at;
7700
+ const user = event.user;
7701
+ this.state.next((current) => ({
7702
+ ...current,
7703
+ read: {
7704
+ ...current.read,
7705
+ [userId]: {
7706
+ ...current.read[userId],
7707
+ lastReadAt: typeof event.last_read_at !== "undefined" ? new Date(event.last_read_at) : new Date(createdAt),
7708
+ user,
7709
+ firstUnreadMessageId: event.first_unread_message_id,
7710
+ unreadMessageCount: event.unread_messages ?? 0
7711
+ }
7712
+ }
7713
+ }));
7714
+ }).unsubscribe;
7692
7715
  this.subscribeNewReplies = () => this.client.on("message.new", (event) => {
7693
7716
  if (!this.client.userID || event.message?.parent_id !== this.id) {
7694
7717
  return;
@@ -12616,6 +12639,7 @@ var ThreadManager = class extends WithSubscriptions {
12616
12639
  const unsubscribeFunctions = [
12617
12640
  "health.check",
12618
12641
  "notification.mark_read",
12642
+ "notification.mark_unread",
12619
12643
  "notification.thread_message_new",
12620
12644
  "notification.channel_deleted"
12621
12645
  ].map(
@@ -16750,7 +16774,7 @@ var StreamChat = class _StreamChat {
16750
16774
  if (this.userAgent) {
16751
16775
  return this.userAgent;
16752
16776
  }
16753
- const version = "9.47.0";
16777
+ const version = "9.48.0";
16754
16778
  const clientBundle = "browser-cjs";
16755
16779
  let userAgentString = "";
16756
16780
  if (this.sdkIdentifier) {