stream-chat 9.14.0 → 9.15.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.
@@ -16732,6 +16732,12 @@ var MiddlewareExecutor = class {
16732
16732
  setOrder(order) {
16733
16733
  this.middleware = order.map((id) => this.middleware.find((middleware) => middleware.id === id)).filter(Boolean);
16734
16734
  }
16735
+ remove(middlewareIds) {
16736
+ if (!middlewareIds && !middlewareIds.length) return;
16737
+ this.middleware = this.middleware.filter(
16738
+ (md) => typeof middlewareIds === "string" ? middlewareIds !== md.id : !middlewareIds.includes(md.id)
16739
+ );
16740
+ }
16735
16741
  async executeMiddlewareChain({
16736
16742
  eventName,
16737
16743
  initialValue,
@@ -25021,15 +25027,17 @@ var Poll = class {
25021
25027
  const { max_votes_allowed, ownVotesByOptionId } = this.data;
25022
25028
  const reachedVoteLimit = max_votes_allowed && max_votes_allowed === Object.keys(ownVotesByOptionId).length;
25023
25029
  if (reachedVoteLimit) {
25024
- let oldestVote = Object.values(ownVotesByOptionId)[0];
25025
- Object.values(ownVotesByOptionId).slice(1).forEach((vote) => {
25026
- if (!oldestVote?.created_at || new Date(vote.created_at) < new Date(oldestVote.created_at)) {
25027
- oldestVote = vote;
25030
+ this.client.notifications.addInfo({
25031
+ message: "Reached the vote limit. Remove an existing vote first.",
25032
+ origin: {
25033
+ emitter: "Poll",
25034
+ context: { messageId, optionId }
25035
+ },
25036
+ options: {
25037
+ type: "validation:poll:castVote:limit"
25028
25038
  }
25029
25039
  });
25030
- if (oldestVote?.id) {
25031
- await this.removeVote(oldestVote.id, messageId);
25032
- }
25040
+ return;
25033
25041
  }
25034
25042
  return await this.client.castPollVote(messageId, this.id, {
25035
25043
  option_id: optionId
@@ -28512,7 +28520,7 @@ var StreamChat = class _StreamChat {
28512
28520
  if (this.userAgent) {
28513
28521
  return this.userAgent;
28514
28522
  }
28515
- const version = "9.14.0";
28523
+ const version = "9.15.0";
28516
28524
  const clientBundle = "node-cjs";
28517
28525
  let userAgentString = "";
28518
28526
  if (this.sdkIdentifier) {