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
package/dist/esm/index.js
CHANGED
|
@@ -4040,6 +4040,12 @@ var MiddlewareExecutor = class {
|
|
|
4040
4040
|
setOrder(order) {
|
|
4041
4041
|
this.middleware = order.map((id) => this.middleware.find((middleware) => middleware.id === id)).filter(Boolean);
|
|
4042
4042
|
}
|
|
4043
|
+
remove(middlewareIds) {
|
|
4044
|
+
if (!middlewareIds && !middlewareIds.length) return;
|
|
4045
|
+
this.middleware = this.middleware.filter(
|
|
4046
|
+
(md) => typeof middlewareIds === "string" ? middlewareIds !== md.id : !middlewareIds.includes(md.id)
|
|
4047
|
+
);
|
|
4048
|
+
}
|
|
4043
4049
|
async executeMiddlewareChain({
|
|
4044
4050
|
eventName,
|
|
4045
4051
|
initialValue,
|
|
@@ -13470,15 +13476,17 @@ var Poll = class {
|
|
|
13470
13476
|
const { max_votes_allowed, ownVotesByOptionId } = this.data;
|
|
13471
13477
|
const reachedVoteLimit = max_votes_allowed && max_votes_allowed === Object.keys(ownVotesByOptionId).length;
|
|
13472
13478
|
if (reachedVoteLimit) {
|
|
13473
|
-
|
|
13474
|
-
|
|
13475
|
-
|
|
13476
|
-
|
|
13479
|
+
this.client.notifications.addInfo({
|
|
13480
|
+
message: "Reached the vote limit. Remove an existing vote first.",
|
|
13481
|
+
origin: {
|
|
13482
|
+
emitter: "Poll",
|
|
13483
|
+
context: { messageId, optionId }
|
|
13484
|
+
},
|
|
13485
|
+
options: {
|
|
13486
|
+
type: "validation:poll:castVote:limit"
|
|
13477
13487
|
}
|
|
13478
13488
|
});
|
|
13479
|
-
|
|
13480
|
-
await this.removeVote(oldestVote.id, messageId);
|
|
13481
|
-
}
|
|
13489
|
+
return;
|
|
13482
13490
|
}
|
|
13483
13491
|
return await this.client.castPollVote(messageId, this.id, {
|
|
13484
13492
|
option_id: optionId
|
|
@@ -16961,7 +16969,7 @@ var StreamChat = class _StreamChat {
|
|
|
16961
16969
|
if (this.userAgent) {
|
|
16962
16970
|
return this.userAgent;
|
|
16963
16971
|
}
|
|
16964
|
-
const version = "9.
|
|
16972
|
+
const version = "9.15.0";
|
|
16965
16973
|
const clientBundle = "browser-esm";
|
|
16966
16974
|
let userAgentString = "";
|
|
16967
16975
|
if (this.sdkIdentifier) {
|