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/cjs/index.node.js
CHANGED
|
@@ -176,6 +176,7 @@ __export(index_exports, {
|
|
|
176
176
|
extractPollEnrichedData: () => extractPollEnrichedData,
|
|
177
177
|
formatMessage: () => formatMessage,
|
|
178
178
|
generateFileName: () => generateFileName,
|
|
179
|
+
getAllowedMentionTypesFromCapabilities: () => getAllowedMentionTypesFromCapabilities,
|
|
179
180
|
getAttachmentTypeFromMimeType: () => getAttachmentTypeFromMimeType,
|
|
180
181
|
getCommandByName: () => getCommandByName,
|
|
181
182
|
getCompleteCommandInString: () => getCompleteCommandInString,
|
|
@@ -5316,25 +5317,27 @@ var CommandSearchSource = class extends BaseSearchSourceSync {
|
|
|
5316
5317
|
const selectedCommands = commands.filter(
|
|
5317
5318
|
(command) => !!(command.name && command.name.toLowerCase().indexOf(searchQuery.toLowerCase()) !== -1)
|
|
5318
5319
|
);
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
nameA
|
|
5324
|
-
|
|
5325
|
-
if (nameB?.indexOf(searchQuery) === 0) {
|
|
5326
|
-
nameB = `0${nameB}`;
|
|
5327
|
-
}
|
|
5328
|
-
if (nameA != null && nameB != null) {
|
|
5329
|
-
if (nameA < nameB) {
|
|
5330
|
-
return -1;
|
|
5320
|
+
if (searchQuery) {
|
|
5321
|
+
selectedCommands.sort((a, b) => {
|
|
5322
|
+
let nameA = a.name?.toLowerCase();
|
|
5323
|
+
let nameB = b.name?.toLowerCase();
|
|
5324
|
+
if (nameA?.indexOf(searchQuery) === 0) {
|
|
5325
|
+
nameA = `0${nameA}`;
|
|
5331
5326
|
}
|
|
5332
|
-
if (
|
|
5333
|
-
|
|
5327
|
+
if (nameB?.indexOf(searchQuery) === 0) {
|
|
5328
|
+
nameB = `0${nameB}`;
|
|
5334
5329
|
}
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5330
|
+
if (nameA != null && nameB != null) {
|
|
5331
|
+
if (nameA < nameB) {
|
|
5332
|
+
return -1;
|
|
5333
|
+
}
|
|
5334
|
+
if (nameA > nameB) {
|
|
5335
|
+
return 1;
|
|
5336
|
+
}
|
|
5337
|
+
}
|
|
5338
|
+
return 0;
|
|
5339
|
+
});
|
|
5340
|
+
}
|
|
5338
5341
|
return {
|
|
5339
5342
|
items: selectedCommands.map((command) => ({
|
|
5340
5343
|
...command,
|
|
@@ -6304,13 +6307,14 @@ var calculateLevenshtein = (query, name) => {
|
|
|
6304
6307
|
}
|
|
6305
6308
|
return matrix[name.length][query.length];
|
|
6306
6309
|
};
|
|
6307
|
-
var
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6310
|
+
var hasOwnCapability = (ownCapabilities, capability) => ownCapabilities?.includes(capability) ?? false;
|
|
6311
|
+
var getAllowedMentionTypesFromCapabilities = (ownCapabilities) => ({
|
|
6312
|
+
channel: hasOwnCapability(ownCapabilities, "notify-channel"),
|
|
6313
|
+
here: hasOwnCapability(ownCapabilities, "notify-here"),
|
|
6314
|
+
role: hasOwnCapability(ownCapabilities, "notify-role"),
|
|
6311
6315
|
user: true,
|
|
6312
|
-
user_group:
|
|
6313
|
-
};
|
|
6316
|
+
user_group: hasOwnCapability(ownCapabilities, "notify-group")
|
|
6317
|
+
});
|
|
6314
6318
|
var decodeUserGroupCursor = (cursor) => {
|
|
6315
6319
|
if (!cursor) return void 0;
|
|
6316
6320
|
try {
|
|
@@ -6436,7 +6440,6 @@ var DEFAULT_SUGGESTION_FACTORY_MAPPERS = {
|
|
|
6436
6440
|
var MentionsSearchSource = class extends BaseSearchSource {
|
|
6437
6441
|
constructor(channel, options) {
|
|
6438
6442
|
const {
|
|
6439
|
-
allowedMentionTypes,
|
|
6440
6443
|
mentionAllAppUsers,
|
|
6441
6444
|
suggestionFactoryMappers,
|
|
6442
6445
|
textComposerText,
|
|
@@ -6468,7 +6471,7 @@ var MentionsSearchSource = class extends BaseSearchSource {
|
|
|
6468
6471
|
const finalQueryWord = normalizedQueryWords[normalizedQueryWords.length - 1];
|
|
6469
6472
|
return fullMatchWords.every((queryWord) => normalizedValueWords.includes(queryWord)) && normalizedValueWords.some((valueWord) => valueWord.startsWith(finalQueryWord));
|
|
6470
6473
|
};
|
|
6471
|
-
this.isMentionTypeAllowed = (mentionType) => this.
|
|
6474
|
+
this.isMentionTypeAllowed = (mentionType) => getAllowedMentionTypesFromCapabilities(this.channel.data?.own_capabilities)[mentionType];
|
|
6472
6475
|
this.mapMentionSuggestion = (mentionType, value, searchToken = this.searchQuery) => {
|
|
6473
6476
|
const mapper = this.config.suggestionFactoryMappers?.[mentionType] ?? DEFAULT_SUGGESTION_FACTORY_MAPPERS[mentionType];
|
|
6474
6477
|
return mapper(value, {
|
|
@@ -6652,10 +6655,6 @@ var MentionsSearchSource = class extends BaseSearchSource {
|
|
|
6652
6655
|
this.client = channel.getClient();
|
|
6653
6656
|
this.channel = channel;
|
|
6654
6657
|
this.config = {
|
|
6655
|
-
allowedMentionTypes: {
|
|
6656
|
-
...DEFAULT_ALLOWED_MENTION_TYPES,
|
|
6657
|
-
...allowedMentionTypes
|
|
6658
|
-
},
|
|
6659
6658
|
mentionAllAppUsers,
|
|
6660
6659
|
suggestionFactoryMappers,
|
|
6661
6660
|
textComposerText,
|
|
@@ -16722,7 +16721,7 @@ var StreamChat = class _StreamChat {
|
|
|
16722
16721
|
if (this.userAgent) {
|
|
16723
16722
|
return this.userAgent;
|
|
16724
16723
|
}
|
|
16725
|
-
const version = "9.
|
|
16724
|
+
const version = "9.47.1";
|
|
16726
16725
|
const clientBundle = "node-cjs";
|
|
16727
16726
|
let userAgentString = "";
|
|
16728
16727
|
if (this.sdkIdentifier) {
|
|
@@ -19468,6 +19467,7 @@ var LiveLocationManager = _LiveLocationManager;
|
|
|
19468
19467
|
extractPollEnrichedData,
|
|
19469
19468
|
formatMessage,
|
|
19470
19469
|
generateFileName,
|
|
19470
|
+
getAllowedMentionTypesFromCapabilities,
|
|
19471
19471
|
getAttachmentTypeFromMimeType,
|
|
19472
19472
|
getCommandByName,
|
|
19473
19473
|
getCompleteCommandInString,
|