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.
- package/dist/cjs/index.browser.cjs +16 -8
- package/dist/cjs/index.browser.cjs.map +2 -2
- package/dist/cjs/index.node.cjs +16 -8
- package/dist/cjs/index.node.cjs.map +2 -2
- package/dist/esm/index.js +16 -8
- package/dist/esm/index.js.map +2 -2
- package/dist/types/middleware.d.ts +1 -0
- package/dist/types/poll.d.ts +1 -1
- package/package.json +1 -1
- package/src/middleware.ts +9 -0
- package/src/poll.ts +11 -14
|
@@ -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
|
-
|
|
12517
|
-
|
|
12518
|
-
|
|
12519
|
-
|
|
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
|
-
|
|
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.
|
|
16015
|
+
const version = "9.15.0";
|
|
16008
16016
|
const clientBundle = "browser-cjs";
|
|
16009
16017
|
let userAgentString = "";
|
|
16010
16018
|
if (this.sdkIdentifier) {
|