stream-chat 8.24.0 → 8.25.1

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
@@ -3174,7 +3174,8 @@ var Channel = /*#__PURE__*/function () {
3174
3174
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
3175
3175
  if (message.type === 'system') return false; // Return false if channel doesn't allow read events.
3176
3176
 
3177
- 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;
3177
+ 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; // FIXME: see #1265, adjust and count new messages even when the channel is muted
3178
+
3178
3179
  if (this.muteStatus().muted) return false;
3179
3180
  return true;
3180
3181
  }
@@ -6251,7 +6252,7 @@ var Campaign = /*#__PURE__*/function () {
6251
6252
  case 0:
6252
6253
  this.verifyCampaignId();
6253
6254
  _context4.next = 3;
6254
- return this.client.delete(this.client.baseURL + "/campaigns/".concat(this.id));
6255
+ return this.client.deleteCampaign(this.id);
6255
6256
 
6256
6257
  case 3:
6257
6258
  return _context4.abrupt("return", _context4.sent);
@@ -6279,7 +6280,7 @@ var Campaign = /*#__PURE__*/function () {
6279
6280
  switch (_context5.prev = _context5.next) {
6280
6281
  case 0:
6281
6282
  this.verifyCampaignId();
6282
- return _context5.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/stop")));
6283
+ return _context5.abrupt("return", this.client.stopCampaign(this.id));
6283
6284
 
6284
6285
  case 2:
6285
6286
  case "end":
@@ -8418,8 +8419,8 @@ var StreamChat = /*#__PURE__*/function () {
8418
8419
  key: "_handleClientEvent",
8419
8420
  value: function _handleClientEvent(event) {
8420
8421
  var _event$me,
8421
- _this3 = this,
8422
- _event$me2;
8422
+ _event$me2,
8423
+ _this3 = this;
8423
8424
 
8424
8425
  var client = this;
8425
8426
  var postListenerCallbacks = [];
@@ -8444,21 +8445,6 @@ var StreamChat = /*#__PURE__*/function () {
8444
8445
  }
8445
8446
 
8446
8447
  if (event.type === 'notification.channel_mutes_updated' && (_event$me = event.me) !== null && _event$me !== void 0 && _event$me.channel_mutes) {
8447
- var currentMutedChannelIds = [];
8448
- var nextMutedChannelIds = [];
8449
- this.mutedChannels.forEach(function (mute) {
8450
- return mute.channel && currentMutedChannelIds.push(mute.channel.cid);
8451
- });
8452
- event.me.channel_mutes.forEach(function (mute) {
8453
- return mute.channel && nextMutedChannelIds.push(mute.channel.cid);
8454
- });
8455
- /** Set the unread count of un-muted channels to 0, which is the behaviour of backend */
8456
-
8457
- currentMutedChannelIds.forEach(function (cid) {
8458
- if (!nextMutedChannelIds.includes(cid) && _this3.activeChannels[cid]) {
8459
- _this3.activeChannels[cid].state.unreadCount = 0;
8460
- }
8461
- });
8462
8448
  this.mutedChannels = event.me.channel_mutes;
8463
8449
  }
8464
8450
 
@@ -11145,7 +11131,7 @@ var StreamChat = /*#__PURE__*/function () {
11145
11131
  }, {
11146
11132
  key: "getUserAgent",
11147
11133
  value: function getUserAgent() {
11148
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.24.0");
11134
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.25.1");
11149
11135
  }
11150
11136
  }, {
11151
11137
  key: "setUserAgent",
@@ -11445,11 +11431,11 @@ var StreamChat = /*#__PURE__*/function () {
11445
11431
  }, {
11446
11432
  key: "campaign",
11447
11433
  value: function campaign(idOrData, data) {
11448
- if (typeof idOrData === 'string') {
11449
- return new Campaign(this, idOrData, data);
11434
+ if (idOrData && _typeof__default['default'](idOrData) === 'object') {
11435
+ return new Campaign(this, null, idOrData);
11450
11436
  }
11451
11437
 
11452
- return new Campaign(this, null, idOrData);
11438
+ return new Campaign(this, idOrData, data);
11453
11439
  }
11454
11440
  }, {
11455
11441
  key: "segment",
@@ -12060,22 +12046,14 @@ var StreamChat = /*#__PURE__*/function () {
12060
12046
  key: "stopCampaign",
12061
12047
  value: function () {
12062
12048
  var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee81(id) {
12063
- var _yield$this$patch, campaign;
12064
-
12065
12049
  return _regeneratorRuntime__default['default'].wrap(function _callee81$(_context81) {
12066
12050
  while (1) {
12067
12051
  switch (_context81.prev = _context81.next) {
12068
12052
  case 0:
12069
12053
  this.validateServerSideAuth();
12070
- _context81.next = 3;
12071
- return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
12072
-
12073
- case 3:
12074
- _yield$this$patch = _context81.sent;
12075
- campaign = _yield$this$patch.campaign;
12076
- return _context81.abrupt("return", campaign);
12054
+ return _context81.abrupt("return", this.post(this.baseURL + "/campaigns/".concat(id, "/stop")));
12077
12055
 
12078
- case 6:
12056
+ case 2:
12079
12057
  case "end":
12080
12058
  return _context81.stop();
12081
12059
  }