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/browser.js CHANGED
@@ -3666,6 +3666,7 @@ var Channel = /*#__PURE__*/function () {
3666
3666
  channelState.read[event.user.id] = {
3667
3667
  // because in client.ts the handleEvent call that flows to this sets this `event.received_at = new Date();`
3668
3668
  last_read: new Date(event.created_at),
3669
+ last_read_message_id: event.last_read_message_id,
3669
3670
  user: event.user,
3670
3671
  unread_messages: 0
3671
3672
  };
@@ -6861,6 +6862,8 @@ var StreamChat = /*#__PURE__*/function () {
6861
6862
 
6862
6863
  _defineProperty__default['default'](this, "updateUser", this.upsertUser);
6863
6864
 
6865
+ _defineProperty__default['default'](this, "_unblockMessage", this.unblockMessage);
6866
+
6864
6867
  _defineProperty__default['default'](this, "markAllRead", this.markChannelsRead);
6865
6868
 
6866
6869
  _defineProperty__default['default'](this, "_isUsingServerAuth", function () {
@@ -7958,7 +7961,7 @@ var StreamChat = /*#__PURE__*/function () {
7958
7961
  *
7959
7962
  * @param {BannedUsersFilters} filterConditions MongoDB style filter conditions
7960
7963
  * @param {BannedUsersSort} sort Sort options [{created_at: 1}].
7961
- * @param {BannedUsersPaginationOptions} options Option object, {limit: 10, offset:0}
7964
+ * @param {BannedUsersPaginationOptions} options Option object, {limit: 10, offset:0, exclude_expired_bans: true}
7962
7965
  *
7963
7966
  * @return {Promise<BannedUsersResponse<StreamChatGenerics>>} Ban Query Response
7964
7967
  */
@@ -8477,6 +8480,8 @@ var StreamChat = /*#__PURE__*/function () {
8477
8480
  }, {
8478
8481
  key: "channel",
8479
8482
  value: function channel(channelType, channelIDOrCustom) {
8483
+ var _custom$members;
8484
+
8480
8485
  var custom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
8481
8486
 
8482
8487
  if (!this.userID && !this._isUsingServerAuth()) {
@@ -8485,18 +8490,23 @@ var StreamChat = /*#__PURE__*/function () {
8485
8490
 
8486
8491
  if (~channelType.indexOf(':')) {
8487
8492
  throw Error("Invalid channel group ".concat(channelType, ", can't contain the : character"));
8493
+ } // support channel("messaging", {options})
8494
+
8495
+
8496
+ if (channelIDOrCustom && _typeof__default['default'](channelIDOrCustom) === 'object') {
8497
+ return this.getChannelByMembers(channelType, channelIDOrCustom);
8498
+ } // // support channel("messaging", undefined, {options})
8499
+
8500
+
8501
+ if (!channelIDOrCustom && _typeof__default['default'](custom) === 'object' && (_custom$members = custom.members) !== null && _custom$members !== void 0 && _custom$members.length) {
8502
+ return this.getChannelByMembers(channelType, custom);
8488
8503
  } // support channel("messaging", null, {options})
8489
8504
  // support channel("messaging", undefined, {options})
8490
8505
  // support channel("messaging", "", {options})
8491
8506
 
8492
8507
 
8493
- if (channelIDOrCustom == null || channelIDOrCustom === '') {
8508
+ if (!channelIDOrCustom) {
8494
8509
  return new Channel(this, channelType, undefined, custom);
8495
- } // support channel("messaging", {options})
8496
-
8497
-
8498
- if (_typeof__default['default'](channelIDOrCustom) === 'object') {
8499
- return this.getChannelByMembers(channelType, channelIDOrCustom);
8500
8510
  }
8501
8511
 
8502
8512
  return this.getChannelById(channelType, channelIDOrCustom, custom);
@@ -9595,22 +9605,18 @@ var StreamChat = /*#__PURE__*/function () {
9595
9605
  return _reviewFlagReport;
9596
9606
  }()
9597
9607
  /**
9598
- * _unblockMessage - unblocks message blocked by automod
9608
+ * unblockMessage - unblocks message blocked by automod
9599
9609
  *
9600
- * Note: Do not use this.
9601
- * It is present for internal usage only.
9602
- * This function can, and will, break and/or be removed at any point in time.
9603
9610
  *
9604
- * @private
9605
9611
  * @param {string} targetMessageID
9606
9612
  * @param {string} [options.user_id] currentUserID, only used with serverside auth
9607
9613
  * @returns {Promise<APIResponse>}
9608
9614
  */
9609
9615
 
9610
9616
  }, {
9611
- key: "_unblockMessage",
9617
+ key: "unblockMessage",
9612
9618
  value: function () {
9613
- var _unblockMessage2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee49(targetMessageID) {
9619
+ var _unblockMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee49(targetMessageID) {
9614
9620
  var options,
9615
9621
  _args49 = arguments;
9616
9622
  return _regeneratorRuntime__default['default'].wrap(function _callee49$(_context49) {
@@ -9634,20 +9640,12 @@ var StreamChat = /*#__PURE__*/function () {
9634
9640
  }, _callee49, this);
9635
9641
  }));
9636
9642
 
9637
- function _unblockMessage(_x63) {
9638
- return _unblockMessage2.apply(this, arguments);
9643
+ function unblockMessage(_x63) {
9644
+ return _unblockMessage.apply(this, arguments);
9639
9645
  }
9640
9646
 
9641
- return _unblockMessage;
9642
- }()
9643
- /**
9644
- * @deprecated use markChannelsRead instead
9645
- *
9646
- * markAllRead - marks all channels for this user as read
9647
- * @param {MarkAllReadOptions<StreamChatGenerics>} [data]
9648
- *
9649
- * @return {Promise<APIResponse>}
9650
- */
9647
+ return unblockMessage;
9648
+ }() // alias for backwards compatibility
9651
9649
 
9652
9650
  }, {
9653
9651
  key: "markChannelsRead",
@@ -10048,7 +10046,7 @@ var StreamChat = /*#__PURE__*/function () {
10048
10046
  switch (_context55.prev = _context55.next) {
10049
10047
  case 0:
10050
10048
  _context55.next = 2;
10051
- return this.get(this.baseURL + "/messages/".concat(messageID));
10049
+ return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)));
10052
10050
 
10053
10051
  case 2:
10054
10052
  return _context55.abrupt("return", _context55.sent);
@@ -10070,7 +10068,7 @@ var StreamChat = /*#__PURE__*/function () {
10070
10068
  }, {
10071
10069
  key: "getUserAgent",
10072
10070
  value: function getUserAgent() {
10073
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.10.1");
10071
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.12.0");
10074
10072
  }
10075
10073
  }, {
10076
10074
  key: "setUserAgent",