stream-chat 8.10.1 → 8.12.0

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.
@@ -3641,6 +3641,7 @@ var Channel = /*#__PURE__*/function () {
3641
3641
  channelState.read[event.user.id] = {
3642
3642
  // because in client.ts the handleEvent call that flows to this sets this `event.received_at = new Date();`
3643
3643
  last_read: new Date(event.created_at),
3644
+ last_read_message_id: event.last_read_message_id,
3644
3645
  user: event.user,
3645
3646
  unread_messages: 0
3646
3647
  };
@@ -6836,6 +6837,8 @@ var StreamChat = /*#__PURE__*/function () {
6836
6837
 
6837
6838
  _defineProperty(this, "updateUser", this.upsertUser);
6838
6839
 
6840
+ _defineProperty(this, "_unblockMessage", this.unblockMessage);
6841
+
6839
6842
  _defineProperty(this, "markAllRead", this.markChannelsRead);
6840
6843
 
6841
6844
  _defineProperty(this, "_isUsingServerAuth", function () {
@@ -7933,7 +7936,7 @@ var StreamChat = /*#__PURE__*/function () {
7933
7936
  *
7934
7937
  * @param {BannedUsersFilters} filterConditions MongoDB style filter conditions
7935
7938
  * @param {BannedUsersSort} sort Sort options [{created_at: 1}].
7936
- * @param {BannedUsersPaginationOptions} options Option object, {limit: 10, offset:0}
7939
+ * @param {BannedUsersPaginationOptions} options Option object, {limit: 10, offset:0, exclude_expired_bans: true}
7937
7940
  *
7938
7941
  * @return {Promise<BannedUsersResponse<StreamChatGenerics>>} Ban Query Response
7939
7942
  */
@@ -8452,6 +8455,8 @@ var StreamChat = /*#__PURE__*/function () {
8452
8455
  }, {
8453
8456
  key: "channel",
8454
8457
  value: function channel(channelType, channelIDOrCustom) {
8458
+ var _custom$members;
8459
+
8455
8460
  var custom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
8456
8461
 
8457
8462
  if (!this.userID && !this._isUsingServerAuth()) {
@@ -8460,18 +8465,23 @@ var StreamChat = /*#__PURE__*/function () {
8460
8465
 
8461
8466
  if (~channelType.indexOf(':')) {
8462
8467
  throw Error("Invalid channel group ".concat(channelType, ", can't contain the : character"));
8468
+ } // support channel("messaging", {options})
8469
+
8470
+
8471
+ if (channelIDOrCustom && _typeof(channelIDOrCustom) === 'object') {
8472
+ return this.getChannelByMembers(channelType, channelIDOrCustom);
8473
+ } // // support channel("messaging", undefined, {options})
8474
+
8475
+
8476
+ if (!channelIDOrCustom && _typeof(custom) === 'object' && (_custom$members = custom.members) !== null && _custom$members !== void 0 && _custom$members.length) {
8477
+ return this.getChannelByMembers(channelType, custom);
8463
8478
  } // support channel("messaging", null, {options})
8464
8479
  // support channel("messaging", undefined, {options})
8465
8480
  // support channel("messaging", "", {options})
8466
8481
 
8467
8482
 
8468
- if (channelIDOrCustom == null || channelIDOrCustom === '') {
8483
+ if (!channelIDOrCustom) {
8469
8484
  return new Channel(this, channelType, undefined, custom);
8470
- } // support channel("messaging", {options})
8471
-
8472
-
8473
- if (_typeof(channelIDOrCustom) === 'object') {
8474
- return this.getChannelByMembers(channelType, channelIDOrCustom);
8475
8485
  }
8476
8486
 
8477
8487
  return this.getChannelById(channelType, channelIDOrCustom, custom);
@@ -9570,22 +9580,18 @@ var StreamChat = /*#__PURE__*/function () {
9570
9580
  return _reviewFlagReport;
9571
9581
  }()
9572
9582
  /**
9573
- * _unblockMessage - unblocks message blocked by automod
9583
+ * unblockMessage - unblocks message blocked by automod
9574
9584
  *
9575
- * Note: Do not use this.
9576
- * It is present for internal usage only.
9577
- * This function can, and will, break and/or be removed at any point in time.
9578
9585
  *
9579
- * @private
9580
9586
  * @param {string} targetMessageID
9581
9587
  * @param {string} [options.user_id] currentUserID, only used with serverside auth
9582
9588
  * @returns {Promise<APIResponse>}
9583
9589
  */
9584
9590
 
9585
9591
  }, {
9586
- key: "_unblockMessage",
9592
+ key: "unblockMessage",
9587
9593
  value: function () {
9588
- var _unblockMessage2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(targetMessageID) {
9594
+ var _unblockMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(targetMessageID) {
9589
9595
  var options,
9590
9596
  _args49 = arguments;
9591
9597
  return _regeneratorRuntime.wrap(function _callee49$(_context49) {
@@ -9609,20 +9615,12 @@ var StreamChat = /*#__PURE__*/function () {
9609
9615
  }, _callee49, this);
9610
9616
  }));
9611
9617
 
9612
- function _unblockMessage(_x63) {
9613
- return _unblockMessage2.apply(this, arguments);
9618
+ function unblockMessage(_x63) {
9619
+ return _unblockMessage.apply(this, arguments);
9614
9620
  }
9615
9621
 
9616
- return _unblockMessage;
9617
- }()
9618
- /**
9619
- * @deprecated use markChannelsRead instead
9620
- *
9621
- * markAllRead - marks all channels for this user as read
9622
- * @param {MarkAllReadOptions<StreamChatGenerics>} [data]
9623
- *
9624
- * @return {Promise<APIResponse>}
9625
- */
9622
+ return unblockMessage;
9623
+ }() // alias for backwards compatibility
9626
9624
 
9627
9625
  }, {
9628
9626
  key: "markChannelsRead",
@@ -10023,7 +10021,7 @@ var StreamChat = /*#__PURE__*/function () {
10023
10021
  switch (_context55.prev = _context55.next) {
10024
10022
  case 0:
10025
10023
  _context55.next = 2;
10026
- return this.get(this.baseURL + "/messages/".concat(messageID));
10024
+ return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)));
10027
10025
 
10028
10026
  case 2:
10029
10027
  return _context55.abrupt("return", _context55.sent);
@@ -10045,7 +10043,7 @@ var StreamChat = /*#__PURE__*/function () {
10045
10043
  }, {
10046
10044
  key: "getUserAgent",
10047
10045
  value: function getUserAgent() {
10048
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.10.1");
10046
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.12.0");
10049
10047
  }
10050
10048
  }, {
10051
10049
  key: "setUserAgent",