stream-chat 9.14.0 → 9.16.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.
@@ -4212,6 +4212,12 @@ var MiddlewareExecutor = class {
4212
4212
  setOrder(order) {
4213
4213
  this.middleware = order.map((id) => this.middleware.find((middleware) => middleware.id === id)).filter(Boolean);
4214
4214
  }
4215
+ remove(middlewareIds) {
4216
+ if (!middlewareIds && !middlewareIds.length) return;
4217
+ this.middleware = this.middleware.filter(
4218
+ (md) => typeof middlewareIds === "string" ? middlewareIds !== md.id : !middlewareIds.includes(md.id)
4219
+ );
4220
+ }
4215
4221
  async executeMiddlewareChain({
4216
4222
  eventName,
4217
4223
  initialValue,
@@ -12513,15 +12519,17 @@ var Poll = class {
12513
12519
  const { max_votes_allowed, ownVotesByOptionId } = this.data;
12514
12520
  const reachedVoteLimit = max_votes_allowed && max_votes_allowed === Object.keys(ownVotesByOptionId).length;
12515
12521
  if (reachedVoteLimit) {
12516
- let oldestVote = Object.values(ownVotesByOptionId)[0];
12517
- Object.values(ownVotesByOptionId).slice(1).forEach((vote) => {
12518
- if (!oldestVote?.created_at || new Date(vote.created_at) < new Date(oldestVote.created_at)) {
12519
- oldestVote = vote;
12522
+ this.client.notifications.addInfo({
12523
+ message: "Reached the vote limit. Remove an existing vote first.",
12524
+ origin: {
12525
+ emitter: "Poll",
12526
+ context: { messageId, optionId }
12527
+ },
12528
+ options: {
12529
+ type: "validation:poll:castVote:limit"
12520
12530
  }
12521
12531
  });
12522
- if (oldestVote?.id) {
12523
- await this.removeVote(oldestVote.id, messageId);
12524
- }
12532
+ return;
12525
12533
  }
12526
12534
  return await this.client.castPollVote(messageId, this.id, {
12527
12535
  option_id: optionId
@@ -16004,7 +16012,7 @@ var StreamChat = class _StreamChat {
16004
16012
  if (this.userAgent) {
16005
16013
  return this.userAgent;
16006
16014
  }
16007
- const version = "9.14.0";
16015
+ const version = "9.16.0";
16008
16016
  const clientBundle = "browser-cjs";
16009
16017
  let userAgentString = "";
16010
16018
  if (this.sdkIdentifier) {