stream-chat 8.16.0 → 8.17.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.
package/dist/browser.js CHANGED
@@ -1989,7 +1989,9 @@ var Channel = /*#__PURE__*/function () {
1989
1989
  key: "updatePartial",
1990
1990
  value: function () {
1991
1991
  var _updatePartial = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee8(update) {
1992
- var data;
1992
+ var _this$data2, _this$data3;
1993
+
1994
+ var data, areCapabilitiesChanged;
1993
1995
  return _regeneratorRuntime__default['default'].wrap(function _callee8$(_context8) {
1994
1996
  while (1) {
1995
1997
  switch (_context8.prev = _context8.next) {
@@ -1999,10 +2001,20 @@ var Channel = /*#__PURE__*/function () {
1999
2001
 
2000
2002
  case 2:
2001
2003
  data = _context8.sent;
2002
- this.data = data.channel;
2004
+ areCapabilitiesChanged = _toConsumableArray__default['default'](data.channel.own_capabilities || []).sort().join() !== _toConsumableArray__default['default'](Array.isArray((_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.own_capabilities) ? (_this$data3 = this.data) === null || _this$data3 === void 0 ? void 0 : _this$data3.own_capabilities : []).sort().join();
2005
+ this.data = data.channel; // If the capabiltities are changed, we trigger the `capabilities.changed` event.
2006
+
2007
+ if (areCapabilitiesChanged) {
2008
+ this.getClient().dispatchEvent({
2009
+ type: 'capabilities.changed',
2010
+ cid: this.cid,
2011
+ own_capabilities: data.channel.own_capabilities
2012
+ });
2013
+ }
2014
+
2003
2015
  return _context8.abrupt("return", data);
2004
2016
 
2005
- case 5:
2017
+ case 7:
2006
2018
  case "end":
2007
2019
  return _context8.stop();
2008
2020
  }
@@ -2816,7 +2828,7 @@ var Channel = /*#__PURE__*/function () {
2816
2828
 
2817
2829
  this._checkInitialized();
2818
2830
 
2819
- if ((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) {
2831
+ if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
2820
2832
  _context26.next = 4;
2821
2833
  break;
2822
2834
  }
@@ -2863,7 +2875,7 @@ var Channel = /*#__PURE__*/function () {
2863
2875
  case 0:
2864
2876
  this._checkInitialized();
2865
2877
 
2866
- if ((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) {
2878
+ if (!(!((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) && !this.getClient()._isUsingServerAuth())) {
2867
2879
  _context27.next = 3;
2868
2880
  break;
2869
2881
  }
@@ -3148,7 +3160,7 @@ var Channel = /*#__PURE__*/function () {
3148
3160
  }, {
3149
3161
  key: "_countMessageAsUnread",
3150
3162
  value: function _countMessageAsUnread(message) {
3151
- var _message$user, _message$user2, _this$data2, _this$data3;
3163
+ var _message$user, _message$user2, _this$data4, _this$data5;
3152
3164
 
3153
3165
  if (message.shadowed) return false;
3154
3166
  if (message.silent) return false;
@@ -3157,7 +3169,7 @@ var Channel = /*#__PURE__*/function () {
3157
3169
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
3158
3170
  if (message.type === 'system') return false; // Return false if channel doesn't allow read events.
3159
3171
 
3160
- if (Array.isArray((_this$data2 = this.data) === null || _this$data2 === void 0 ? void 0 : _this$data2.own_capabilities) && !((_this$data3 = this.data) !== null && _this$data3 !== void 0 && _this$data3.own_capabilities.includes('read-events'))) return false;
3172
+ if (Array.isArray((_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.own_capabilities) && !((_this$data5 = this.data) !== null && _this$data5 !== void 0 && _this$data5.own_capabilities.includes('read-events'))) return false;
3161
3173
  if (this.muteStatus().muted) return false;
3162
3174
  return true;
3163
3175
  }
@@ -3232,7 +3244,7 @@ var Channel = /*#__PURE__*/function () {
3232
3244
  */
3233
3245
  function () {
3234
3246
  var _query = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee32(options) {
3235
- var _this$data4, _this$data5;
3247
+ var _this$data6, _this$data7;
3236
3248
 
3237
3249
  var messageSetToAddToIfDoesNotExist,
3238
3250
  queryURL,
@@ -3295,7 +3307,7 @@ var Channel = /*#__PURE__*/function () {
3295
3307
 
3296
3308
 
3297
3309
  _this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
3298
- areCapabilitiesChanged = _toConsumableArray__default['default'](state.channel.own_capabilities || []).sort().join() !== _toConsumableArray__default['default'](Array.isArray((_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.own_capabilities) ? (_this$data5 = this.data) === null || _this$data5 === void 0 ? void 0 : _this$data5.own_capabilities : []).sort().join();
3310
+ areCapabilitiesChanged = _toConsumableArray__default['default'](state.channel.own_capabilities || []).sort().join() !== _toConsumableArray__default['default'](Array.isArray((_this$data6 = this.data) === null || _this$data6 === void 0 ? void 0 : _this$data6.own_capabilities) ? (_this$data7 = this.data) === null || _this$data7 === void 0 ? void 0 : _this$data7.own_capabilities : []).sort().join();
3299
3311
  this.data = state.channel;
3300
3312
  this.offlineMode = false;
3301
3313
 
@@ -10617,7 +10629,7 @@ var StreamChat = /*#__PURE__*/function () {
10617
10629
  }, {
10618
10630
  key: "getUserAgent",
10619
10631
  value: function getUserAgent() {
10620
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.16.0");
10632
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.17.0");
10621
10633
  }
10622
10634
  }, {
10623
10635
  key: "setUserAgent",