stream-chat 9.46.0 → 9.47.1
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.js +34 -31
- package/dist/cjs/index.browser.js.map +2 -2
- package/dist/cjs/index.node.js +30 -30
- package/dist/cjs/index.node.js.map +2 -2
- package/dist/esm/index.mjs +34 -31
- package/dist/esm/index.mjs.map +2 -2
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +1 -1
- package/dist/types/types.d.ts +4 -0
- package/package.json +2 -2
- package/src/messageComposer/middleware/textComposer/commands.ts +21 -19
- package/src/messageComposer/middleware/textComposer/mentions.ts +14 -13
- package/src/types.ts +4 -0
package/dist/esm/index.mjs
CHANGED
|
@@ -5,7 +5,11 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
|
|
8
|
+
try {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
} catch (e) {
|
|
11
|
+
throw mod = 0, e;
|
|
12
|
+
}
|
|
9
13
|
};
|
|
10
14
|
var __copyProps = (to, from, except, desc) => {
|
|
11
15
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -5129,25 +5133,27 @@ var CommandSearchSource = class extends BaseSearchSourceSync {
|
|
|
5129
5133
|
const selectedCommands = commands.filter(
|
|
5130
5134
|
(command) => !!(command.name && command.name.toLowerCase().indexOf(searchQuery.toLowerCase()) !== -1)
|
|
5131
5135
|
);
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
nameA
|
|
5137
|
-
|
|
5138
|
-
if (nameB?.indexOf(searchQuery) === 0) {
|
|
5139
|
-
nameB = `0${nameB}`;
|
|
5140
|
-
}
|
|
5141
|
-
if (nameA != null && nameB != null) {
|
|
5142
|
-
if (nameA < nameB) {
|
|
5143
|
-
return -1;
|
|
5136
|
+
if (searchQuery) {
|
|
5137
|
+
selectedCommands.sort((a, b) => {
|
|
5138
|
+
let nameA = a.name?.toLowerCase();
|
|
5139
|
+
let nameB = b.name?.toLowerCase();
|
|
5140
|
+
if (nameA?.indexOf(searchQuery) === 0) {
|
|
5141
|
+
nameA = `0${nameA}`;
|
|
5144
5142
|
}
|
|
5145
|
-
if (
|
|
5146
|
-
|
|
5143
|
+
if (nameB?.indexOf(searchQuery) === 0) {
|
|
5144
|
+
nameB = `0${nameB}`;
|
|
5147
5145
|
}
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5146
|
+
if (nameA != null && nameB != null) {
|
|
5147
|
+
if (nameA < nameB) {
|
|
5148
|
+
return -1;
|
|
5149
|
+
}
|
|
5150
|
+
if (nameA > nameB) {
|
|
5151
|
+
return 1;
|
|
5152
|
+
}
|
|
5153
|
+
}
|
|
5154
|
+
return 0;
|
|
5155
|
+
});
|
|
5156
|
+
}
|
|
5151
5157
|
return {
|
|
5152
5158
|
items: selectedCommands.map((command) => ({
|
|
5153
5159
|
...command,
|
|
@@ -6117,13 +6123,14 @@ var calculateLevenshtein = (query, name) => {
|
|
|
6117
6123
|
}
|
|
6118
6124
|
return matrix[name.length][query.length];
|
|
6119
6125
|
};
|
|
6120
|
-
var
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6126
|
+
var hasOwnCapability = (ownCapabilities, capability) => ownCapabilities?.includes(capability) ?? false;
|
|
6127
|
+
var getAllowedMentionTypesFromCapabilities = (ownCapabilities) => ({
|
|
6128
|
+
channel: hasOwnCapability(ownCapabilities, "notify-channel"),
|
|
6129
|
+
here: hasOwnCapability(ownCapabilities, "notify-here"),
|
|
6130
|
+
role: hasOwnCapability(ownCapabilities, "notify-role"),
|
|
6124
6131
|
user: true,
|
|
6125
|
-
user_group:
|
|
6126
|
-
};
|
|
6132
|
+
user_group: hasOwnCapability(ownCapabilities, "notify-group")
|
|
6133
|
+
});
|
|
6127
6134
|
var decodeUserGroupCursor = (cursor) => {
|
|
6128
6135
|
if (!cursor) return void 0;
|
|
6129
6136
|
try {
|
|
@@ -6249,7 +6256,6 @@ var DEFAULT_SUGGESTION_FACTORY_MAPPERS = {
|
|
|
6249
6256
|
var MentionsSearchSource = class extends BaseSearchSource {
|
|
6250
6257
|
constructor(channel, options) {
|
|
6251
6258
|
const {
|
|
6252
|
-
allowedMentionTypes,
|
|
6253
6259
|
mentionAllAppUsers,
|
|
6254
6260
|
suggestionFactoryMappers,
|
|
6255
6261
|
textComposerText,
|
|
@@ -6281,7 +6287,7 @@ var MentionsSearchSource = class extends BaseSearchSource {
|
|
|
6281
6287
|
const finalQueryWord = normalizedQueryWords[normalizedQueryWords.length - 1];
|
|
6282
6288
|
return fullMatchWords.every((queryWord) => normalizedValueWords.includes(queryWord)) && normalizedValueWords.some((valueWord) => valueWord.startsWith(finalQueryWord));
|
|
6283
6289
|
};
|
|
6284
|
-
this.isMentionTypeAllowed = (mentionType) => this.
|
|
6290
|
+
this.isMentionTypeAllowed = (mentionType) => getAllowedMentionTypesFromCapabilities(this.channel.data?.own_capabilities)[mentionType];
|
|
6285
6291
|
this.mapMentionSuggestion = (mentionType, value, searchToken = this.searchQuery) => {
|
|
6286
6292
|
const mapper = this.config.suggestionFactoryMappers?.[mentionType] ?? DEFAULT_SUGGESTION_FACTORY_MAPPERS[mentionType];
|
|
6287
6293
|
return mapper(value, {
|
|
@@ -6465,10 +6471,6 @@ var MentionsSearchSource = class extends BaseSearchSource {
|
|
|
6465
6471
|
this.client = channel.getClient();
|
|
6466
6472
|
this.channel = channel;
|
|
6467
6473
|
this.config = {
|
|
6468
|
-
allowedMentionTypes: {
|
|
6469
|
-
...DEFAULT_ALLOWED_MENTION_TYPES,
|
|
6470
|
-
...allowedMentionTypes
|
|
6471
|
-
},
|
|
6472
6474
|
mentionAllAppUsers,
|
|
6473
6475
|
suggestionFactoryMappers,
|
|
6474
6476
|
textComposerText,
|
|
@@ -16535,7 +16537,7 @@ var StreamChat = class _StreamChat {
|
|
|
16535
16537
|
if (this.userAgent) {
|
|
16536
16538
|
return this.userAgent;
|
|
16537
16539
|
}
|
|
16538
|
-
const version = "9.
|
|
16540
|
+
const version = "9.47.1";
|
|
16539
16541
|
const clientBundle = "browser-esm";
|
|
16540
16542
|
let userAgentString = "";
|
|
16541
16543
|
if (this.sdkIdentifier) {
|
|
@@ -19280,6 +19282,7 @@ export {
|
|
|
19280
19282
|
extractPollEnrichedData,
|
|
19281
19283
|
formatMessage,
|
|
19282
19284
|
generateFileName,
|
|
19285
|
+
getAllowedMentionTypesFromCapabilities,
|
|
19283
19286
|
getAttachmentTypeFromMimeType,
|
|
19284
19287
|
getCommandByName,
|
|
19285
19288
|
getCompleteCommandInString,
|