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.es.js CHANGED
@@ -3146,7 +3146,8 @@ var Channel = /*#__PURE__*/function () {
3146
3146
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
3147
3147
  if (message.type === 'system') return false; // Return false if channel doesn't allow read events.
3148
3148
 
3149
- 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;
3149
+ 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
3150
+
3150
3151
  if (this.muteStatus().muted) return false;
3151
3152
  return true;
3152
3153
  }
@@ -6223,7 +6224,7 @@ var Campaign = /*#__PURE__*/function () {
6223
6224
  case 0:
6224
6225
  this.verifyCampaignId();
6225
6226
  _context4.next = 3;
6226
- return this.client.delete(this.client.baseURL + "/campaigns/".concat(this.id));
6227
+ return this.client.deleteCampaign(this.id);
6227
6228
 
6228
6229
  case 3:
6229
6230
  return _context4.abrupt("return", _context4.sent);
@@ -6251,7 +6252,7 @@ var Campaign = /*#__PURE__*/function () {
6251
6252
  switch (_context5.prev = _context5.next) {
6252
6253
  case 0:
6253
6254
  this.verifyCampaignId();
6254
- return _context5.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/stop")));
6255
+ return _context5.abrupt("return", this.client.stopCampaign(this.id));
6255
6256
 
6256
6257
  case 2:
6257
6258
  case "end":
@@ -8390,8 +8391,8 @@ var StreamChat = /*#__PURE__*/function () {
8390
8391
  key: "_handleClientEvent",
8391
8392
  value: function _handleClientEvent(event) {
8392
8393
  var _event$me,
8393
- _this3 = this,
8394
- _event$me2;
8394
+ _event$me2,
8395
+ _this3 = this;
8395
8396
 
8396
8397
  var client = this;
8397
8398
  var postListenerCallbacks = [];
@@ -8416,21 +8417,6 @@ var StreamChat = /*#__PURE__*/function () {
8416
8417
  }
8417
8418
 
8418
8419
  if (event.type === 'notification.channel_mutes_updated' && (_event$me = event.me) !== null && _event$me !== void 0 && _event$me.channel_mutes) {
8419
- var currentMutedChannelIds = [];
8420
- var nextMutedChannelIds = [];
8421
- this.mutedChannels.forEach(function (mute) {
8422
- return mute.channel && currentMutedChannelIds.push(mute.channel.cid);
8423
- });
8424
- event.me.channel_mutes.forEach(function (mute) {
8425
- return mute.channel && nextMutedChannelIds.push(mute.channel.cid);
8426
- });
8427
- /** Set the unread count of un-muted channels to 0, which is the behaviour of backend */
8428
-
8429
- currentMutedChannelIds.forEach(function (cid) {
8430
- if (!nextMutedChannelIds.includes(cid) && _this3.activeChannels[cid]) {
8431
- _this3.activeChannels[cid].state.unreadCount = 0;
8432
- }
8433
- });
8434
8420
  this.mutedChannels = event.me.channel_mutes;
8435
8421
  }
8436
8422
 
@@ -11117,7 +11103,7 @@ var StreamChat = /*#__PURE__*/function () {
11117
11103
  }, {
11118
11104
  key: "getUserAgent",
11119
11105
  value: function getUserAgent() {
11120
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.24.0");
11106
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.25.1");
11121
11107
  }
11122
11108
  }, {
11123
11109
  key: "setUserAgent",
@@ -11417,11 +11403,11 @@ var StreamChat = /*#__PURE__*/function () {
11417
11403
  }, {
11418
11404
  key: "campaign",
11419
11405
  value: function campaign(idOrData, data) {
11420
- if (typeof idOrData === 'string') {
11421
- return new Campaign(this, idOrData, data);
11406
+ if (idOrData && _typeof(idOrData) === 'object') {
11407
+ return new Campaign(this, null, idOrData);
11422
11408
  }
11423
11409
 
11424
- return new Campaign(this, null, idOrData);
11410
+ return new Campaign(this, idOrData, data);
11425
11411
  }
11426
11412
  }, {
11427
11413
  key: "segment",
@@ -12032,22 +12018,14 @@ var StreamChat = /*#__PURE__*/function () {
12032
12018
  key: "stopCampaign",
12033
12019
  value: function () {
12034
12020
  var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee81(id) {
12035
- var _yield$this$patch, campaign;
12036
-
12037
12021
  return _regeneratorRuntime.wrap(function _callee81$(_context81) {
12038
12022
  while (1) {
12039
12023
  switch (_context81.prev = _context81.next) {
12040
12024
  case 0:
12041
12025
  this.validateServerSideAuth();
12042
- _context81.next = 3;
12043
- return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
12044
-
12045
- case 3:
12046
- _yield$this$patch = _context81.sent;
12047
- campaign = _yield$this$patch.campaign;
12048
- return _context81.abrupt("return", campaign);
12026
+ return _context81.abrupt("return", this.post(this.baseURL + "/campaigns/".concat(id, "/stop")));
12049
12027
 
12050
- case 6:
12028
+ case 2:
12051
12029
  case "end":
12052
12030
  return _context81.stop();
12053
12031
  }