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/index.js CHANGED
@@ -188,6 +188,7 @@ function isOwnUserBaseProperty(property) {
188
188
  total_unread_count: true,
189
189
  unread_channels: true,
190
190
  unread_count: true,
191
+ unread_threads: true,
191
192
  invisible: true,
192
193
  roles: true
193
194
  };
@@ -6782,20 +6783,22 @@ var Thread = /*#__PURE__*/function () {
6782
6783
  this._channel = client.channel(t.channel.type, t.channel.id);
6783
6784
  this._client = client;
6784
6785
 
6785
- var _iterator = _createForOfIteratorHelper$1(t.read),
6786
- _step;
6786
+ if (t.read) {
6787
+ var _iterator = _createForOfIteratorHelper$1(t.read),
6788
+ _step;
6787
6789
 
6788
- try {
6789
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
6790
- var r = _step.value;
6791
- this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
6792
- last_read: new Date(r.last_read)
6793
- });
6790
+ try {
6791
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
6792
+ var r = _step.value;
6793
+ this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
6794
+ last_read: new Date(r.last_read)
6795
+ });
6796
+ }
6797
+ } catch (err) {
6798
+ _iterator.e(err);
6799
+ } finally {
6800
+ _iterator.f();
6794
6801
  }
6795
- } catch (err) {
6796
- _iterator.e(err);
6797
- } finally {
6798
- _iterator.f();
6799
6802
  }
6800
6803
  }
6801
6804
 
@@ -6804,10 +6807,20 @@ var Thread = /*#__PURE__*/function () {
6804
6807
  value: function getClient() {
6805
6808
  return this._client;
6806
6809
  }
6810
+ /**
6811
+ * addReply - Adds or updates a latestReplies to the thread
6812
+ *
6813
+ * @param {MessageResponse<StreamChatGenerics>} message reply message to be added.
6814
+ */
6815
+
6807
6816
  }, {
6808
6817
  key: "addReply",
6809
6818
  value: function addReply(message) {
6810
- this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message));
6819
+ if (message.parent_id !== this.message.id) {
6820
+ throw new Error('Message does not belong to this thread');
6821
+ }
6822
+
6823
+ this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message), true);
6811
6824
  }
6812
6825
  }, {
6813
6826
  key: "updateReply",
@@ -6833,6 +6846,7 @@ var Thread = /*#__PURE__*/function () {
6833
6846
 
6834
6847
  if (message.parent_id && message.parent_id === this.message.id) {
6835
6848
  this.updateReply(message);
6849
+ return;
6836
6850
  }
6837
6851
 
6838
6852
  if (!message.parent_id && message.id === this.message.id) {
@@ -11173,7 +11187,7 @@ var StreamChat = /*#__PURE__*/function () {
11173
11187
  }, {
11174
11188
  key: "getUserAgent",
11175
11189
  value: function getUserAgent() {
11176
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.18.0");
11190
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.18.1");
11177
11191
  }
11178
11192
  }, {
11179
11193
  key: "setUserAgent",