stream-chat 8.14.1 → 8.14.2

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.
@@ -3180,6 +3180,8 @@ var Channel = /*#__PURE__*/function () {
3180
3180
  */
3181
3181
  function () {
3182
3182
  var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(options) {
3183
+ var _this$data4, _this$data5;
3184
+
3183
3185
  var messageSetToAddToIfDoesNotExist,
3184
3186
  queryURL,
3185
3187
  state,
@@ -3187,6 +3189,7 @@ var Channel = /*#__PURE__*/function () {
3187
3189
  tempChannelCid,
3188
3190
  _this$_initializeStat,
3189
3191
  messageSet,
3192
+ areCapabilitiesChanged,
3190
3193
  _args32 = arguments;
3191
3194
 
3192
3195
  return _regeneratorRuntime.wrap(function _callee32$(_context32) {
@@ -3240,8 +3243,18 @@ var Channel = /*#__PURE__*/function () {
3240
3243
 
3241
3244
 
3242
3245
  _this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
3246
+ 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();
3243
3247
  this.data = state.channel;
3244
3248
  this.offlineMode = false;
3249
+
3250
+ if (areCapabilitiesChanged) {
3251
+ this.getClient().dispatchEvent({
3252
+ type: 'capabilities.changed',
3253
+ cid: this.cid,
3254
+ own_capabilities: state.channel.own_capabilities
3255
+ });
3256
+ }
3257
+
3245
3258
  this.getClient().dispatchEvent({
3246
3259
  type: 'channels.queried',
3247
3260
  queriedChannels: {
@@ -3251,7 +3264,7 @@ var Channel = /*#__PURE__*/function () {
3251
3264
  });
3252
3265
  return _context32.abrupt("return", state);
3253
3266
 
3254
- case 15:
3267
+ case 17:
3255
3268
  case "end":
3256
3269
  return _context32.stop();
3257
3270
  }
@@ -3804,11 +3817,25 @@ var Channel = /*#__PURE__*/function () {
3804
3817
 
3805
3818
  case 'channel.updated':
3806
3819
  if (event.channel) {
3807
- var _event$channel$hidden, _event$channel2, _channel$data, _event$channel$own_ca, _event$channel3, _channel$data2;
3820
+ var _event$channel2, _channel$data, _event$channel$hidden, _event$channel3, _channel$data2, _event$channel$own_ca, _event$channel4, _channel$data3;
3821
+
3822
+ var isFrozenChanged = ((_event$channel2 = event.channel) === null || _event$channel2 === void 0 ? void 0 : _event$channel2.frozen) !== undefined && event.channel.frozen !== ((_channel$data = channel.data) === null || _channel$data === void 0 ? void 0 : _channel$data.frozen);
3823
+
3824
+ if (isFrozenChanged) {
3825
+ this.query({
3826
+ state: false,
3827
+ messages: {
3828
+ limit: 0
3829
+ },
3830
+ watchers: {
3831
+ limit: 0
3832
+ }
3833
+ });
3834
+ }
3808
3835
 
3809
3836
  channel.data = _objectSpread$5(_objectSpread$5({}, event.channel), {}, {
3810
- hidden: (_event$channel$hidden = (_event$channel2 = event.channel) === null || _event$channel2 === void 0 ? void 0 : _event$channel2.hidden) !== null && _event$channel$hidden !== void 0 ? _event$channel$hidden : (_channel$data = channel.data) === null || _channel$data === void 0 ? void 0 : _channel$data.hidden,
3811
- own_capabilities: (_event$channel$own_ca = (_event$channel3 = event.channel) === null || _event$channel3 === void 0 ? void 0 : _event$channel3.own_capabilities) !== null && _event$channel$own_ca !== void 0 ? _event$channel$own_ca : (_channel$data2 = channel.data) === null || _channel$data2 === void 0 ? void 0 : _channel$data2.own_capabilities
3837
+ hidden: (_event$channel$hidden = (_event$channel3 = event.channel) === null || _event$channel3 === void 0 ? void 0 : _event$channel3.hidden) !== null && _event$channel$hidden !== void 0 ? _event$channel$hidden : (_channel$data2 = channel.data) === null || _channel$data2 === void 0 ? void 0 : _channel$data2.hidden,
3838
+ own_capabilities: (_event$channel$own_ca = (_event$channel4 = event.channel) === null || _event$channel4 === void 0 ? void 0 : _event$channel4.own_capabilities) !== null && _event$channel$own_ca !== void 0 ? _event$channel$own_ca : (_channel$data3 = channel.data) === null || _channel$data3 === void 0 ? void 0 : _channel$data3.own_capabilities
3812
3839
  });
3813
3840
  }
3814
3841
 
@@ -3935,7 +3962,10 @@ var Channel = /*#__PURE__*/function () {
3935
3962
  this.state.pending_messages = state.pending_messages;
3936
3963
  }
3937
3964
 
3938
- this.state.watcher_count = state.watcher_count || 0; // convert the arrays into objects for easier syncing...
3965
+ if (state.watcher_count !== undefined) {
3966
+ this.state.watcher_count = state.watcher_count;
3967
+ } // convert the arrays into objects for easier syncing...
3968
+
3939
3969
 
3940
3970
  if (state.watchers) {
3941
3971
  var _iterator2 = _createForOfIteratorHelper$2(state.watchers),
@@ -10134,7 +10164,7 @@ var StreamChat = /*#__PURE__*/function () {
10134
10164
  }, {
10135
10165
  key: "getUserAgent",
10136
10166
  value: function getUserAgent() {
10137
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.14.1");
10167
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.14.2");
10138
10168
  }
10139
10169
  }, {
10140
10170
  key: "setUserAgent",
@@ -11527,7 +11557,8 @@ var EVENT_MAP = {
11527
11557
  'channels.queried': true,
11528
11558
  'connection.changed': true,
11529
11559
  'connection.recovered': true,
11530
- 'transport.changed': true
11560
+ 'transport.changed': true,
11561
+ 'capabilities.changed': true
11531
11562
  };
11532
11563
 
11533
11564
  var Allow = 'Allow';