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/index.js CHANGED
@@ -1993,7 +1993,9 @@ var Channel = /*#__PURE__*/function () {
1993
1993
  key: "updatePartial",
1994
1994
  value: function () {
1995
1995
  var _updatePartial = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee8(update) {
1996
- var data;
1996
+ var _this$data2, _this$data3;
1997
+
1998
+ var data, areCapabilitiesChanged;
1997
1999
  return _regeneratorRuntime__default['default'].wrap(function _callee8$(_context8) {
1998
2000
  while (1) {
1999
2001
  switch (_context8.prev = _context8.next) {
@@ -2003,10 +2005,20 @@ var Channel = /*#__PURE__*/function () {
2003
2005
 
2004
2006
  case 2:
2005
2007
  data = _context8.sent;
2006
- this.data = data.channel;
2008
+ 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();
2009
+ this.data = data.channel; // If the capabiltities are changed, we trigger the `capabilities.changed` event.
2010
+
2011
+ if (areCapabilitiesChanged) {
2012
+ this.getClient().dispatchEvent({
2013
+ type: 'capabilities.changed',
2014
+ cid: this.cid,
2015
+ own_capabilities: data.channel.own_capabilities
2016
+ });
2017
+ }
2018
+
2007
2019
  return _context8.abrupt("return", data);
2008
2020
 
2009
- case 5:
2021
+ case 7:
2010
2022
  case "end":
2011
2023
  return _context8.stop();
2012
2024
  }
@@ -2820,7 +2832,7 @@ var Channel = /*#__PURE__*/function () {
2820
2832
 
2821
2833
  this._checkInitialized();
2822
2834
 
2823
- if ((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) {
2835
+ if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
2824
2836
  _context26.next = 4;
2825
2837
  break;
2826
2838
  }
@@ -2867,7 +2879,7 @@ var Channel = /*#__PURE__*/function () {
2867
2879
  case 0:
2868
2880
  this._checkInitialized();
2869
2881
 
2870
- if ((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) {
2882
+ if (!(!((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) && !this.getClient()._isUsingServerAuth())) {
2871
2883
  _context27.next = 3;
2872
2884
  break;
2873
2885
  }
@@ -3152,7 +3164,7 @@ var Channel = /*#__PURE__*/function () {
3152
3164
  }, {
3153
3165
  key: "_countMessageAsUnread",
3154
3166
  value: function _countMessageAsUnread(message) {
3155
- var _message$user, _message$user2, _this$data2, _this$data3;
3167
+ var _message$user, _message$user2, _this$data4, _this$data5;
3156
3168
 
3157
3169
  if (message.shadowed) return false;
3158
3170
  if (message.silent) return false;
@@ -3161,7 +3173,7 @@ var Channel = /*#__PURE__*/function () {
3161
3173
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
3162
3174
  if (message.type === 'system') return false; // Return false if channel doesn't allow read events.
3163
3175
 
3164
- 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;
3176
+ 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;
3165
3177
  if (this.muteStatus().muted) return false;
3166
3178
  return true;
3167
3179
  }
@@ -3236,7 +3248,7 @@ var Channel = /*#__PURE__*/function () {
3236
3248
  */
3237
3249
  function () {
3238
3250
  var _query = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee32(options) {
3239
- var _this$data4, _this$data5;
3251
+ var _this$data6, _this$data7;
3240
3252
 
3241
3253
  var messageSetToAddToIfDoesNotExist,
3242
3254
  queryURL,
@@ -3299,7 +3311,7 @@ var Channel = /*#__PURE__*/function () {
3299
3311
 
3300
3312
 
3301
3313
  _this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
3302
- 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();
3314
+ 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();
3303
3315
  this.data = state.channel;
3304
3316
  this.offlineMode = false;
3305
3317
 
@@ -10623,7 +10635,7 @@ var StreamChat = /*#__PURE__*/function () {
10623
10635
  }, {
10624
10636
  key: "getUserAgent",
10625
10637
  value: function getUserAgent() {
10626
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.16.0");
10638
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.17.0");
10627
10639
  }
10628
10640
  }, {
10629
10641
  key: "setUserAgent",