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.
@@ -5317,25 +5317,27 @@ var CommandSearchSource = class extends BaseSearchSourceSync {
5317
5317
  const selectedCommands = commands.filter(
5318
5318
  (command) => !!(command.name && command.name.toLowerCase().indexOf(searchQuery.toLowerCase()) !== -1)
5319
5319
  );
5320
- selectedCommands.sort((a, b) => {
5321
- let nameA = a.name?.toLowerCase();
5322
- let nameB = b.name?.toLowerCase();
5323
- if (nameA?.indexOf(searchQuery) === 0) {
5324
- nameA = `0${nameA}`;
5325
- }
5326
- if (nameB?.indexOf(searchQuery) === 0) {
5327
- nameB = `0${nameB}`;
5328
- }
5329
- if (nameA != null && nameB != null) {
5330
- if (nameA < nameB) {
5331
- return -1;
5320
+ if (searchQuery) {
5321
+ selectedCommands.sort((a, b) => {
5322
+ let nameA = a.name?.toLowerCase();
5323
+ let nameB = b.name?.toLowerCase();
5324
+ if (nameA?.indexOf(searchQuery) === 0) {
5325
+ nameA = `0${nameA}`;
5332
5326
  }
5333
- if (nameA > nameB) {
5334
- return 1;
5327
+ if (nameB?.indexOf(searchQuery) === 0) {
5328
+ nameB = `0${nameB}`;
5335
5329
  }
5336
- }
5337
- return 0;
5338
- });
5330
+ if (nameA != null && nameB != null) {
5331
+ if (nameA < nameB) {
5332
+ return -1;
5333
+ }
5334
+ if (nameA > nameB) {
5335
+ return 1;
5336
+ }
5337
+ }
5338
+ return 0;
5339
+ });
5340
+ }
5339
5341
  return {
5340
5342
  items: selectedCommands.map((command) => ({
5341
5343
  ...command,
@@ -7617,6 +7619,7 @@ var Thread = class extends WithSubscriptions {
7617
7619
  this.addUnsubscribeFunction(this.subscribeMarkThreadStale());
7618
7620
  this.addUnsubscribeFunction(this.subscribeNewReplies());
7619
7621
  this.addUnsubscribeFunction(this.subscribeRepliesRead());
7622
+ this.addUnsubscribeFunction(this.subscribeRepliesUnread());
7620
7623
  this.addUnsubscribeFunction(this.subscribeMessageDeleted());
7621
7624
  this.addUnsubscribeFunction(this.subscribeMessageUpdated());
7622
7625
  };
@@ -7658,6 +7661,26 @@ var Thread = class extends WithSubscriptions {
7658
7661
  }
7659
7662
  this.state.partialNext({ isStateStale: true });
7660
7663
  }).unsubscribe;
7664
+ this.subscribeRepliesUnread = () => this.client.on("notification.mark_unread", (event) => {
7665
+ if (!event.user || !event.created_at || !event.thread_id) return;
7666
+ if (event.thread_id !== this.id) return;
7667
+ const userId = event.user.id;
7668
+ const createdAt = event.created_at;
7669
+ const user = event.user;
7670
+ this.state.next((current) => ({
7671
+ ...current,
7672
+ read: {
7673
+ ...current.read,
7674
+ [userId]: {
7675
+ ...current.read[userId],
7676
+ lastReadAt: typeof event.last_read_at !== "undefined" ? new Date(event.last_read_at) : new Date(createdAt),
7677
+ user,
7678
+ firstUnreadMessageId: event.first_unread_message_id,
7679
+ unreadMessageCount: event.unread_messages ?? 0
7680
+ }
7681
+ }
7682
+ }));
7683
+ }).unsubscribe;
7661
7684
  this.subscribeNewReplies = () => this.client.on("message.new", (event) => {
7662
7685
  if (!this.client.userID || event.message?.parent_id !== this.id) {
7663
7686
  return;
@@ -12585,6 +12608,7 @@ var ThreadManager = class extends WithSubscriptions {
12585
12608
  const unsubscribeFunctions = [
12586
12609
  "health.check",
12587
12610
  "notification.mark_read",
12611
+ "notification.mark_unread",
12588
12612
  "notification.thread_message_new",
12589
12613
  "notification.channel_deleted"
12590
12614
  ].map(
@@ -16719,7 +16743,7 @@ var StreamChat = class _StreamChat {
16719
16743
  if (this.userAgent) {
16720
16744
  return this.userAgent;
16721
16745
  }
16722
- const version = "9.47.0";
16746
+ const version = "9.48.0";
16723
16747
  const clientBundle = "node-cjs";
16724
16748
  let userAgentString = "";
16725
16749
  if (this.sdkIdentifier) {