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