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