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.
@@ -3145,7 +3145,8 @@ var Channel = /*#__PURE__*/function () {
3145
3145
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
3146
3146
  if (message.type === 'system') return false; // Return false if channel doesn't allow read events.
3147
3147
 
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;
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; // FIXME: see #1265, adjust and count new messages even when the channel is muted
3149
+
3149
3150
  if (this.muteStatus().muted) return false;
3150
3151
  return true;
3151
3152
  }
@@ -6220,7 +6221,7 @@ var Campaign = /*#__PURE__*/function () {
6220
6221
  case 0:
6221
6222
  this.verifyCampaignId();
6222
6223
  _context4.next = 3;
6223
- return this.client.delete(this.client.baseURL + "/campaigns/".concat(this.id));
6224
+ return this.client.deleteCampaign(this.id);
6224
6225
 
6225
6226
  case 3:
6226
6227
  return _context4.abrupt("return", _context4.sent);
@@ -6248,7 +6249,7 @@ var Campaign = /*#__PURE__*/function () {
6248
6249
  switch (_context5.prev = _context5.next) {
6249
6250
  case 0:
6250
6251
  this.verifyCampaignId();
6251
- return _context5.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/stop")));
6252
+ return _context5.abrupt("return", this.client.stopCampaign(this.id));
6252
6253
 
6253
6254
  case 2:
6254
6255
  case "end":
@@ -8387,8 +8388,8 @@ var StreamChat = /*#__PURE__*/function () {
8387
8388
  key: "_handleClientEvent",
8388
8389
  value: function _handleClientEvent(event) {
8389
8390
  var _event$me,
8390
- _this3 = this,
8391
- _event$me2;
8391
+ _event$me2,
8392
+ _this3 = this;
8392
8393
 
8393
8394
  var client = this;
8394
8395
  var postListenerCallbacks = [];
@@ -8413,21 +8414,6 @@ var StreamChat = /*#__PURE__*/function () {
8413
8414
  }
8414
8415
 
8415
8416
  if (event.type === 'notification.channel_mutes_updated' && (_event$me = event.me) !== null && _event$me !== void 0 && _event$me.channel_mutes) {
8416
- var currentMutedChannelIds = [];
8417
- var nextMutedChannelIds = [];
8418
- this.mutedChannels.forEach(function (mute) {
8419
- return mute.channel && currentMutedChannelIds.push(mute.channel.cid);
8420
- });
8421
- event.me.channel_mutes.forEach(function (mute) {
8422
- return mute.channel && nextMutedChannelIds.push(mute.channel.cid);
8423
- });
8424
- /** Set the unread count of un-muted channels to 0, which is the behaviour of backend */
8425
-
8426
- currentMutedChannelIds.forEach(function (cid) {
8427
- if (!nextMutedChannelIds.includes(cid) && _this3.activeChannels[cid]) {
8428
- _this3.activeChannels[cid].state.unreadCount = 0;
8429
- }
8430
- });
8431
8417
  this.mutedChannels = event.me.channel_mutes;
8432
8418
  }
8433
8419
 
@@ -11114,7 +11100,7 @@ var StreamChat = /*#__PURE__*/function () {
11114
11100
  }, {
11115
11101
  key: "getUserAgent",
11116
11102
  value: function getUserAgent() {
11117
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.24.0");
11103
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.25.1");
11118
11104
  }
11119
11105
  }, {
11120
11106
  key: "setUserAgent",
@@ -11414,11 +11400,11 @@ var StreamChat = /*#__PURE__*/function () {
11414
11400
  }, {
11415
11401
  key: "campaign",
11416
11402
  value: function campaign(idOrData, data) {
11417
- if (typeof idOrData === 'string') {
11418
- return new Campaign(this, idOrData, data);
11403
+ if (idOrData && _typeof(idOrData) === 'object') {
11404
+ return new Campaign(this, null, idOrData);
11419
11405
  }
11420
11406
 
11421
- return new Campaign(this, null, idOrData);
11407
+ return new Campaign(this, idOrData, data);
11422
11408
  }
11423
11409
  }, {
11424
11410
  key: "segment",
@@ -12029,22 +12015,14 @@ var StreamChat = /*#__PURE__*/function () {
12029
12015
  key: "stopCampaign",
12030
12016
  value: function () {
12031
12017
  var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee81(id) {
12032
- var _yield$this$patch, campaign;
12033
-
12034
12018
  return _regeneratorRuntime.wrap(function _callee81$(_context81) {
12035
12019
  while (1) {
12036
12020
  switch (_context81.prev = _context81.next) {
12037
12021
  case 0:
12038
12022
  this.validateServerSideAuth();
12039
- _context81.next = 3;
12040
- return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
12041
-
12042
- case 3:
12043
- _yield$this$patch = _context81.sent;
12044
- campaign = _yield$this$patch.campaign;
12045
- return _context81.abrupt("return", campaign);
12023
+ return _context81.abrupt("return", this.post(this.baseURL + "/campaigns/".concat(id, "/stop")));
12046
12024
 
12047
- case 6:
12025
+ case 2:
12048
12026
  case "end":
12049
12027
  return _context81.stop();
12050
12028
  }