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.
package/dist/index.js CHANGED
@@ -3670,6 +3670,7 @@ var Channel = /*#__PURE__*/function () {
3670
3670
  channelState.read[event.user.id] = {
3671
3671
  // because in client.ts the handleEvent call that flows to this sets this `event.received_at = new Date();`
3672
3672
  last_read: new Date(event.created_at),
3673
+ last_read_message_id: event.last_read_message_id,
3673
3674
  user: event.user,
3674
3675
  unread_messages: 0
3675
3676
  };
@@ -6867,6 +6868,8 @@ var StreamChat = /*#__PURE__*/function () {
6867
6868
 
6868
6869
  _defineProperty__default['default'](this, "updateUser", this.upsertUser);
6869
6870
 
6871
+ _defineProperty__default['default'](this, "_unblockMessage", this.unblockMessage);
6872
+
6870
6873
  _defineProperty__default['default'](this, "markAllRead", this.markChannelsRead);
6871
6874
 
6872
6875
  _defineProperty__default['default'](this, "_isUsingServerAuth", function () {
@@ -7964,7 +7967,7 @@ var StreamChat = /*#__PURE__*/function () {
7964
7967
  *
7965
7968
  * @param {BannedUsersFilters} filterConditions MongoDB style filter conditions
7966
7969
  * @param {BannedUsersSort} sort Sort options [{created_at: 1}].
7967
- * @param {BannedUsersPaginationOptions} options Option object, {limit: 10, offset:0}
7970
+ * @param {BannedUsersPaginationOptions} options Option object, {limit: 10, offset:0, exclude_expired_bans: true}
7968
7971
  *
7969
7972
  * @return {Promise<BannedUsersResponse<StreamChatGenerics>>} Ban Query Response
7970
7973
  */
@@ -8483,6 +8486,8 @@ var StreamChat = /*#__PURE__*/function () {
8483
8486
  }, {
8484
8487
  key: "channel",
8485
8488
  value: function channel(channelType, channelIDOrCustom) {
8489
+ var _custom$members;
8490
+
8486
8491
  var custom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
8487
8492
 
8488
8493
  if (!this.userID && !this._isUsingServerAuth()) {
@@ -8491,18 +8496,23 @@ var StreamChat = /*#__PURE__*/function () {
8491
8496
 
8492
8497
  if (~channelType.indexOf(':')) {
8493
8498
  throw Error("Invalid channel group ".concat(channelType, ", can't contain the : character"));
8499
+ } // support channel("messaging", {options})
8500
+
8501
+
8502
+ if (channelIDOrCustom && _typeof__default['default'](channelIDOrCustom) === 'object') {
8503
+ return this.getChannelByMembers(channelType, channelIDOrCustom);
8504
+ } // // support channel("messaging", undefined, {options})
8505
+
8506
+
8507
+ if (!channelIDOrCustom && _typeof__default['default'](custom) === 'object' && (_custom$members = custom.members) !== null && _custom$members !== void 0 && _custom$members.length) {
8508
+ return this.getChannelByMembers(channelType, custom);
8494
8509
  } // support channel("messaging", null, {options})
8495
8510
  // support channel("messaging", undefined, {options})
8496
8511
  // support channel("messaging", "", {options})
8497
8512
 
8498
8513
 
8499
- if (channelIDOrCustom == null || channelIDOrCustom === '') {
8514
+ if (!channelIDOrCustom) {
8500
8515
  return new Channel(this, channelType, undefined, custom);
8501
- } // support channel("messaging", {options})
8502
-
8503
-
8504
- if (_typeof__default['default'](channelIDOrCustom) === 'object') {
8505
- return this.getChannelByMembers(channelType, channelIDOrCustom);
8506
8516
  }
8507
8517
 
8508
8518
  return this.getChannelById(channelType, channelIDOrCustom, custom);
@@ -9601,22 +9611,18 @@ var StreamChat = /*#__PURE__*/function () {
9601
9611
  return _reviewFlagReport;
9602
9612
  }()
9603
9613
  /**
9604
- * _unblockMessage - unblocks message blocked by automod
9614
+ * unblockMessage - unblocks message blocked by automod
9605
9615
  *
9606
- * Note: Do not use this.
9607
- * It is present for internal usage only.
9608
- * This function can, and will, break and/or be removed at any point in time.
9609
9616
  *
9610
- * @private
9611
9617
  * @param {string} targetMessageID
9612
9618
  * @param {string} [options.user_id] currentUserID, only used with serverside auth
9613
9619
  * @returns {Promise<APIResponse>}
9614
9620
  */
9615
9621
 
9616
9622
  }, {
9617
- key: "_unblockMessage",
9623
+ key: "unblockMessage",
9618
9624
  value: function () {
9619
- var _unblockMessage2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee49(targetMessageID) {
9625
+ var _unblockMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee49(targetMessageID) {
9620
9626
  var options,
9621
9627
  _args49 = arguments;
9622
9628
  return _regeneratorRuntime__default['default'].wrap(function _callee49$(_context49) {
@@ -9640,20 +9646,12 @@ var StreamChat = /*#__PURE__*/function () {
9640
9646
  }, _callee49, this);
9641
9647
  }));
9642
9648
 
9643
- function _unblockMessage(_x63) {
9644
- return _unblockMessage2.apply(this, arguments);
9649
+ function unblockMessage(_x63) {
9650
+ return _unblockMessage.apply(this, arguments);
9645
9651
  }
9646
9652
 
9647
- return _unblockMessage;
9648
- }()
9649
- /**
9650
- * @deprecated use markChannelsRead instead
9651
- *
9652
- * markAllRead - marks all channels for this user as read
9653
- * @param {MarkAllReadOptions<StreamChatGenerics>} [data]
9654
- *
9655
- * @return {Promise<APIResponse>}
9656
- */
9653
+ return unblockMessage;
9654
+ }() // alias for backwards compatibility
9657
9655
 
9658
9656
  }, {
9659
9657
  key: "markChannelsRead",
@@ -10054,7 +10052,7 @@ var StreamChat = /*#__PURE__*/function () {
10054
10052
  switch (_context55.prev = _context55.next) {
10055
10053
  case 0:
10056
10054
  _context55.next = 2;
10057
- return this.get(this.baseURL + "/messages/".concat(messageID));
10055
+ return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)));
10058
10056
 
10059
10057
  case 2:
10060
10058
  return _context55.abrupt("return", _context55.sent);
@@ -10076,7 +10074,7 @@ var StreamChat = /*#__PURE__*/function () {
10076
10074
  }, {
10077
10075
  key: "getUserAgent",
10078
10076
  value: function getUserAgent() {
10079
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.10.1");
10077
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.12.0");
10080
10078
  }
10081
10079
  }, {
10082
10080
  key: "setUserAgent",