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
|
@@ -6,7 +6,11 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
|
|
9
|
+
try {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
} catch (e) {
|
|
12
|
+
throw mod = 0, e;
|
|
13
|
+
}
|
|
10
14
|
};
|
|
11
15
|
var __export = (target, all) => {
|
|
12
16
|
for (var name in all)
|
|
@@ -203,6 +207,7 @@ __export(index_exports, {
|
|
|
203
207
|
extractPollEnrichedData: () => extractPollEnrichedData,
|
|
204
208
|
formatMessage: () => formatMessage,
|
|
205
209
|
generateFileName: () => generateFileName,
|
|
210
|
+
getAllowedMentionTypesFromCapabilities: () => getAllowedMentionTypesFromCapabilities,
|
|
206
211
|
getAttachmentTypeFromMimeType: () => getAttachmentTypeFromMimeType,
|
|
207
212
|
getCommandByName: () => getCommandByName,
|
|
208
213
|
getCompleteCommandInString: () => getCompleteCommandInString,
|
|
@@ -5343,25 +5348,27 @@ var CommandSearchSource = class extends BaseSearchSourceSync {
|
|
|
5343
5348
|
const selectedCommands = commands.filter(
|
|
5344
5349
|
(command) => !!(command.name && command.name.toLowerCase().indexOf(searchQuery.toLowerCase()) !== -1)
|
|
5345
5350
|
);
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
nameA
|
|
5351
|
-
|
|
5352
|
-
if (nameB?.indexOf(searchQuery) === 0) {
|
|
5353
|
-
nameB = `0${nameB}`;
|
|
5354
|
-
}
|
|
5355
|
-
if (nameA != null && nameB != null) {
|
|
5356
|
-
if (nameA < nameB) {
|
|
5357
|
-
return -1;
|
|
5351
|
+
if (searchQuery) {
|
|
5352
|
+
selectedCommands.sort((a, b) => {
|
|
5353
|
+
let nameA = a.name?.toLowerCase();
|
|
5354
|
+
let nameB = b.name?.toLowerCase();
|
|
5355
|
+
if (nameA?.indexOf(searchQuery) === 0) {
|
|
5356
|
+
nameA = `0${nameA}`;
|
|
5358
5357
|
}
|
|
5359
|
-
if (
|
|
5360
|
-
|
|
5358
|
+
if (nameB?.indexOf(searchQuery) === 0) {
|
|
5359
|
+
nameB = `0${nameB}`;
|
|
5361
5360
|
}
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5361
|
+
if (nameA != null && nameB != null) {
|
|
5362
|
+
if (nameA < nameB) {
|
|
5363
|
+
return -1;
|
|
5364
|
+
}
|
|
5365
|
+
if (nameA > nameB) {
|
|
5366
|
+
return 1;
|
|
5367
|
+
}
|
|
5368
|
+
}
|
|
5369
|
+
return 0;
|
|
5370
|
+
});
|
|
5371
|
+
}
|
|
5365
5372
|
return {
|
|
5366
5373
|
items: selectedCommands.map((command) => ({
|
|
5367
5374
|
...command,
|
|
@@ -6331,13 +6338,14 @@ var calculateLevenshtein = (query, name) => {
|
|
|
6331
6338
|
}
|
|
6332
6339
|
return matrix[name.length][query.length];
|
|
6333
6340
|
};
|
|
6334
|
-
var
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6341
|
+
var hasOwnCapability = (ownCapabilities, capability) => ownCapabilities?.includes(capability) ?? false;
|
|
6342
|
+
var getAllowedMentionTypesFromCapabilities = (ownCapabilities) => ({
|
|
6343
|
+
channel: hasOwnCapability(ownCapabilities, "notify-channel"),
|
|
6344
|
+
here: hasOwnCapability(ownCapabilities, "notify-here"),
|
|
6345
|
+
role: hasOwnCapability(ownCapabilities, "notify-role"),
|
|
6338
6346
|
user: true,
|
|
6339
|
-
user_group:
|
|
6340
|
-
};
|
|
6347
|
+
user_group: hasOwnCapability(ownCapabilities, "notify-group")
|
|
6348
|
+
});
|
|
6341
6349
|
var decodeUserGroupCursor = (cursor) => {
|
|
6342
6350
|
if (!cursor) return void 0;
|
|
6343
6351
|
try {
|
|
@@ -6463,7 +6471,6 @@ var DEFAULT_SUGGESTION_FACTORY_MAPPERS = {
|
|
|
6463
6471
|
var MentionsSearchSource = class extends BaseSearchSource {
|
|
6464
6472
|
constructor(channel, options) {
|
|
6465
6473
|
const {
|
|
6466
|
-
allowedMentionTypes,
|
|
6467
6474
|
mentionAllAppUsers,
|
|
6468
6475
|
suggestionFactoryMappers,
|
|
6469
6476
|
textComposerText,
|
|
@@ -6495,7 +6502,7 @@ var MentionsSearchSource = class extends BaseSearchSource {
|
|
|
6495
6502
|
const finalQueryWord = normalizedQueryWords[normalizedQueryWords.length - 1];
|
|
6496
6503
|
return fullMatchWords.every((queryWord) => normalizedValueWords.includes(queryWord)) && normalizedValueWords.some((valueWord) => valueWord.startsWith(finalQueryWord));
|
|
6497
6504
|
};
|
|
6498
|
-
this.isMentionTypeAllowed = (mentionType) => this.
|
|
6505
|
+
this.isMentionTypeAllowed = (mentionType) => getAllowedMentionTypesFromCapabilities(this.channel.data?.own_capabilities)[mentionType];
|
|
6499
6506
|
this.mapMentionSuggestion = (mentionType, value, searchToken = this.searchQuery) => {
|
|
6500
6507
|
const mapper = this.config.suggestionFactoryMappers?.[mentionType] ?? DEFAULT_SUGGESTION_FACTORY_MAPPERS[mentionType];
|
|
6501
6508
|
return mapper(value, {
|
|
@@ -6679,10 +6686,6 @@ var MentionsSearchSource = class extends BaseSearchSource {
|
|
|
6679
6686
|
this.client = channel.getClient();
|
|
6680
6687
|
this.channel = channel;
|
|
6681
6688
|
this.config = {
|
|
6682
|
-
allowedMentionTypes: {
|
|
6683
|
-
...DEFAULT_ALLOWED_MENTION_TYPES,
|
|
6684
|
-
...allowedMentionTypes
|
|
6685
|
-
},
|
|
6686
6689
|
mentionAllAppUsers,
|
|
6687
6690
|
suggestionFactoryMappers,
|
|
6688
6691
|
textComposerText,
|
|
@@ -16749,7 +16752,7 @@ var StreamChat = class _StreamChat {
|
|
|
16749
16752
|
if (this.userAgent) {
|
|
16750
16753
|
return this.userAgent;
|
|
16751
16754
|
}
|
|
16752
|
-
const version = "9.
|
|
16755
|
+
const version = "9.47.1";
|
|
16753
16756
|
const clientBundle = "browser-cjs";
|
|
16754
16757
|
let userAgentString = "";
|
|
16755
16758
|
if (this.sdkIdentifier) {
|