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.
package/dist/browser.js CHANGED
@@ -184,6 +184,7 @@ function isOwnUserBaseProperty(property) {
184
184
  total_unread_count: true,
185
185
  unread_channels: true,
186
186
  unread_count: true,
187
+ unread_threads: true,
187
188
  invisible: true,
188
189
  roles: true
189
190
  };
@@ -6776,20 +6777,22 @@ var Thread = /*#__PURE__*/function () {
6776
6777
  this._channel = client.channel(t.channel.type, t.channel.id);
6777
6778
  this._client = client;
6778
6779
 
6779
- var _iterator = _createForOfIteratorHelper$1(t.read),
6780
- _step;
6780
+ if (t.read) {
6781
+ var _iterator = _createForOfIteratorHelper$1(t.read),
6782
+ _step;
6781
6783
 
6782
- try {
6783
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
6784
- var r = _step.value;
6785
- this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
6786
- last_read: new Date(r.last_read)
6787
- });
6784
+ try {
6785
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
6786
+ var r = _step.value;
6787
+ this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
6788
+ last_read: new Date(r.last_read)
6789
+ });
6790
+ }
6791
+ } catch (err) {
6792
+ _iterator.e(err);
6793
+ } finally {
6794
+ _iterator.f();
6788
6795
  }
6789
- } catch (err) {
6790
- _iterator.e(err);
6791
- } finally {
6792
- _iterator.f();
6793
6796
  }
6794
6797
  }
6795
6798
 
@@ -6798,10 +6801,20 @@ var Thread = /*#__PURE__*/function () {
6798
6801
  value: function getClient() {
6799
6802
  return this._client;
6800
6803
  }
6804
+ /**
6805
+ * addReply - Adds or updates a latestReplies to the thread
6806
+ *
6807
+ * @param {MessageResponse<StreamChatGenerics>} message reply message to be added.
6808
+ */
6809
+
6801
6810
  }, {
6802
6811
  key: "addReply",
6803
6812
  value: function addReply(message) {
6804
- this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message));
6813
+ if (message.parent_id !== this.message.id) {
6814
+ throw new Error('Message does not belong to this thread');
6815
+ }
6816
+
6817
+ this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message), true);
6805
6818
  }
6806
6819
  }, {
6807
6820
  key: "updateReply",
@@ -6827,6 +6840,7 @@ var Thread = /*#__PURE__*/function () {
6827
6840
 
6828
6841
  if (message.parent_id && message.parent_id === this.message.id) {
6829
6842
  this.updateReply(message);
6843
+ return;
6830
6844
  }
6831
6845
 
6832
6846
  if (!message.parent_id && message.id === this.message.id) {
@@ -11167,7 +11181,7 @@ var StreamChat = /*#__PURE__*/function () {
11167
11181
  }, {
11168
11182
  key: "getUserAgent",
11169
11183
  value: function getUserAgent() {
11170
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.18.0");
11184
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.18.1");
11171
11185
  }
11172
11186
  }, {
11173
11187
  key: "setUserAgent",