stream-chat 8.18.0 → 8.18.1

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.
@@ -159,6 +159,7 @@ function isOwnUserBaseProperty(property) {
159
159
  total_unread_count: true,
160
160
  unread_channels: true,
161
161
  unread_count: true,
162
+ unread_threads: true,
162
163
  invisible: true,
163
164
  roles: true
164
165
  };
@@ -6751,20 +6752,22 @@ var Thread = /*#__PURE__*/function () {
6751
6752
  this._channel = client.channel(t.channel.type, t.channel.id);
6752
6753
  this._client = client;
6753
6754
 
6754
- var _iterator = _createForOfIteratorHelper$1(t.read),
6755
- _step;
6755
+ if (t.read) {
6756
+ var _iterator = _createForOfIteratorHelper$1(t.read),
6757
+ _step;
6756
6758
 
6757
- try {
6758
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
6759
- var r = _step.value;
6760
- this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
6761
- last_read: new Date(r.last_read)
6762
- });
6759
+ try {
6760
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
6761
+ var r = _step.value;
6762
+ this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
6763
+ last_read: new Date(r.last_read)
6764
+ });
6765
+ }
6766
+ } catch (err) {
6767
+ _iterator.e(err);
6768
+ } finally {
6769
+ _iterator.f();
6763
6770
  }
6764
- } catch (err) {
6765
- _iterator.e(err);
6766
- } finally {
6767
- _iterator.f();
6768
6771
  }
6769
6772
  }
6770
6773
 
@@ -6773,10 +6776,20 @@ var Thread = /*#__PURE__*/function () {
6773
6776
  value: function getClient() {
6774
6777
  return this._client;
6775
6778
  }
6779
+ /**
6780
+ * addReply - Adds or updates a latestReplies to the thread
6781
+ *
6782
+ * @param {MessageResponse<StreamChatGenerics>} message reply message to be added.
6783
+ */
6784
+
6776
6785
  }, {
6777
6786
  key: "addReply",
6778
6787
  value: function addReply(message) {
6779
- this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message));
6788
+ if (message.parent_id !== this.message.id) {
6789
+ throw new Error('Message does not belong to this thread');
6790
+ }
6791
+
6792
+ this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message), true);
6780
6793
  }
6781
6794
  }, {
6782
6795
  key: "updateReply",
@@ -6802,6 +6815,7 @@ var Thread = /*#__PURE__*/function () {
6802
6815
 
6803
6816
  if (message.parent_id && message.parent_id === this.message.id) {
6804
6817
  this.updateReply(message);
6818
+ return;
6805
6819
  }
6806
6820
 
6807
6821
  if (!message.parent_id && message.id === this.message.id) {
@@ -11142,7 +11156,7 @@ var StreamChat = /*#__PURE__*/function () {
11142
11156
  }, {
11143
11157
  key: "getUserAgent",
11144
11158
  value: function getUserAgent() {
11145
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.18.0");
11159
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.18.1");
11146
11160
  }
11147
11161
  }, {
11148
11162
  key: "setUserAgent",