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