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