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/browser.js CHANGED
@@ -3170,7 +3170,8 @@ var Channel = /*#__PURE__*/function () {
3170
3170
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
3171
3171
  if (message.type === 'system') return false; // Return false if channel doesn't allow read events.
3172
3172
 
3173
- 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;
3173
+ 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
3174
+
3174
3175
  if (this.muteStatus().muted) return false;
3175
3176
  return true;
3176
3177
  }
@@ -6245,7 +6246,7 @@ var Campaign = /*#__PURE__*/function () {
6245
6246
  case 0:
6246
6247
  this.verifyCampaignId();
6247
6248
  _context4.next = 3;
6248
- return this.client.delete(this.client.baseURL + "/campaigns/".concat(this.id));
6249
+ return this.client.deleteCampaign(this.id);
6249
6250
 
6250
6251
  case 3:
6251
6252
  return _context4.abrupt("return", _context4.sent);
@@ -6273,7 +6274,7 @@ var Campaign = /*#__PURE__*/function () {
6273
6274
  switch (_context5.prev = _context5.next) {
6274
6275
  case 0:
6275
6276
  this.verifyCampaignId();
6276
- return _context5.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/stop")));
6277
+ return _context5.abrupt("return", this.client.stopCampaign(this.id));
6277
6278
 
6278
6279
  case 2:
6279
6280
  case "end":
@@ -8412,8 +8413,8 @@ var StreamChat = /*#__PURE__*/function () {
8412
8413
  key: "_handleClientEvent",
8413
8414
  value: function _handleClientEvent(event) {
8414
8415
  var _event$me,
8415
- _this3 = this,
8416
- _event$me2;
8416
+ _event$me2,
8417
+ _this3 = this;
8417
8418
 
8418
8419
  var client = this;
8419
8420
  var postListenerCallbacks = [];
@@ -8438,21 +8439,6 @@ var StreamChat = /*#__PURE__*/function () {
8438
8439
  }
8439
8440
 
8440
8441
  if (event.type === 'notification.channel_mutes_updated' && (_event$me = event.me) !== null && _event$me !== void 0 && _event$me.channel_mutes) {
8441
- var currentMutedChannelIds = [];
8442
- var nextMutedChannelIds = [];
8443
- this.mutedChannels.forEach(function (mute) {
8444
- return mute.channel && currentMutedChannelIds.push(mute.channel.cid);
8445
- });
8446
- event.me.channel_mutes.forEach(function (mute) {
8447
- return mute.channel && nextMutedChannelIds.push(mute.channel.cid);
8448
- });
8449
- /** Set the unread count of un-muted channels to 0, which is the behaviour of backend */
8450
-
8451
- currentMutedChannelIds.forEach(function (cid) {
8452
- if (!nextMutedChannelIds.includes(cid) && _this3.activeChannels[cid]) {
8453
- _this3.activeChannels[cid].state.unreadCount = 0;
8454
- }
8455
- });
8456
8442
  this.mutedChannels = event.me.channel_mutes;
8457
8443
  }
8458
8444
 
@@ -11139,7 +11125,7 @@ var StreamChat = /*#__PURE__*/function () {
11139
11125
  }, {
11140
11126
  key: "getUserAgent",
11141
11127
  value: function getUserAgent() {
11142
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.24.0");
11128
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.25.1");
11143
11129
  }
11144
11130
  }, {
11145
11131
  key: "setUserAgent",
@@ -11439,11 +11425,11 @@ var StreamChat = /*#__PURE__*/function () {
11439
11425
  }, {
11440
11426
  key: "campaign",
11441
11427
  value: function campaign(idOrData, data) {
11442
- if (typeof idOrData === 'string') {
11443
- return new Campaign(this, idOrData, data);
11428
+ if (idOrData && _typeof__default['default'](idOrData) === 'object') {
11429
+ return new Campaign(this, null, idOrData);
11444
11430
  }
11445
11431
 
11446
- return new Campaign(this, null, idOrData);
11432
+ return new Campaign(this, idOrData, data);
11447
11433
  }
11448
11434
  }, {
11449
11435
  key: "segment",
@@ -12054,22 +12040,14 @@ var StreamChat = /*#__PURE__*/function () {
12054
12040
  key: "stopCampaign",
12055
12041
  value: function () {
12056
12042
  var _stopCampaign = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee81(id) {
12057
- var _yield$this$patch, campaign;
12058
-
12059
12043
  return _regeneratorRuntime__default['default'].wrap(function _callee81$(_context81) {
12060
12044
  while (1) {
12061
12045
  switch (_context81.prev = _context81.next) {
12062
12046
  case 0:
12063
12047
  this.validateServerSideAuth();
12064
- _context81.next = 3;
12065
- return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
12066
-
12067
- case 3:
12068
- _yield$this$patch = _context81.sent;
12069
- campaign = _yield$this$patch.campaign;
12070
- return _context81.abrupt("return", campaign);
12048
+ return _context81.abrupt("return", this.post(this.baseURL + "/campaigns/".concat(id, "/stop")));
12071
12049
 
12072
- case 6:
12050
+ case 2:
12073
12051
  case "end":
12074
12052
  return _context81.stop();
12075
12053
  }