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.
@@ -1964,7 +1964,9 @@ var Channel = /*#__PURE__*/function () {
1964
1964
  key: "updatePartial",
1965
1965
  value: function () {
1966
1966
  var _updatePartial = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(update) {
1967
- var data;
1967
+ var _this$data2, _this$data3;
1968
+
1969
+ var data, areCapabilitiesChanged;
1968
1970
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
1969
1971
  while (1) {
1970
1972
  switch (_context8.prev = _context8.next) {
@@ -1974,10 +1976,20 @@ var Channel = /*#__PURE__*/function () {
1974
1976
 
1975
1977
  case 2:
1976
1978
  data = _context8.sent;
1977
- this.data = data.channel;
1979
+ areCapabilitiesChanged = _toConsumableArray(data.channel.own_capabilities || []).sort().join() !== _toConsumableArray(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();
1980
+ this.data = data.channel; // If the capabiltities are changed, we trigger the `capabilities.changed` event.
1981
+
1982
+ if (areCapabilitiesChanged) {
1983
+ this.getClient().dispatchEvent({
1984
+ type: 'capabilities.changed',
1985
+ cid: this.cid,
1986
+ own_capabilities: data.channel.own_capabilities
1987
+ });
1988
+ }
1989
+
1978
1990
  return _context8.abrupt("return", data);
1979
1991
 
1980
- case 5:
1992
+ case 7:
1981
1993
  case "end":
1982
1994
  return _context8.stop();
1983
1995
  }
@@ -2791,7 +2803,7 @@ var Channel = /*#__PURE__*/function () {
2791
2803
 
2792
2804
  this._checkInitialized();
2793
2805
 
2794
- if ((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) {
2806
+ if (!(!((_this$getConfig3 = this.getConfig()) !== null && _this$getConfig3 !== void 0 && _this$getConfig3.read_events) && !this.getClient()._isUsingServerAuth())) {
2795
2807
  _context26.next = 4;
2796
2808
  break;
2797
2809
  }
@@ -2838,7 +2850,7 @@ var Channel = /*#__PURE__*/function () {
2838
2850
  case 0:
2839
2851
  this._checkInitialized();
2840
2852
 
2841
- if ((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) {
2853
+ if (!(!((_this$getConfig4 = this.getConfig()) !== null && _this$getConfig4 !== void 0 && _this$getConfig4.read_events) && !this.getClient()._isUsingServerAuth())) {
2842
2854
  _context27.next = 3;
2843
2855
  break;
2844
2856
  }
@@ -3123,7 +3135,7 @@ var Channel = /*#__PURE__*/function () {
3123
3135
  }, {
3124
3136
  key: "_countMessageAsUnread",
3125
3137
  value: function _countMessageAsUnread(message) {
3126
- var _message$user, _message$user2, _this$data2, _this$data3;
3138
+ var _message$user, _message$user2, _this$data4, _this$data5;
3127
3139
 
3128
3140
  if (message.shadowed) return false;
3129
3141
  if (message.silent) return false;
@@ -3132,7 +3144,7 @@ var Channel = /*#__PURE__*/function () {
3132
3144
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
3133
3145
  if (message.type === 'system') return false; // Return false if channel doesn't allow read events.
3134
3146
 
3135
- 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;
3147
+ 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;
3136
3148
  if (this.muteStatus().muted) return false;
3137
3149
  return true;
3138
3150
  }
@@ -3207,7 +3219,7 @@ var Channel = /*#__PURE__*/function () {
3207
3219
  */
3208
3220
  function () {
3209
3221
  var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(options) {
3210
- var _this$data4, _this$data5;
3222
+ var _this$data6, _this$data7;
3211
3223
 
3212
3224
  var messageSetToAddToIfDoesNotExist,
3213
3225
  queryURL,
@@ -3270,7 +3282,7 @@ var Channel = /*#__PURE__*/function () {
3270
3282
 
3271
3283
 
3272
3284
  _this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
3273
- areCapabilitiesChanged = _toConsumableArray(state.channel.own_capabilities || []).sort().join() !== _toConsumableArray(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();
3285
+ areCapabilitiesChanged = _toConsumableArray(state.channel.own_capabilities || []).sort().join() !== _toConsumableArray(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();
3274
3286
  this.data = state.channel;
3275
3287
  this.offlineMode = false;
3276
3288
 
@@ -10592,7 +10604,7 @@ var StreamChat = /*#__PURE__*/function () {
10592
10604
  }, {
10593
10605
  key: "getUserAgent",
10594
10606
  value: function getUserAgent() {
10595
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.16.0");
10607
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.17.0");
10596
10608
  }
10597
10609
  }, {
10598
10610
  key: "setUserAgent",