stream-chat 9.46.0 → 9.47.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.
@@ -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,
@@ -6304,13 +6305,14 @@ var calculateLevenshtein = (query, name) => {
6304
6305
  }
6305
6306
  return matrix[name.length][query.length];
6306
6307
  };
6307
- var DEFAULT_ALLOWED_MENTION_TYPES = {
6308
- channel: true,
6309
- here: true,
6310
- role: true,
6308
+ var hasOwnCapability = (ownCapabilities, capability) => ownCapabilities?.includes(capability) ?? false;
6309
+ var getAllowedMentionTypesFromCapabilities = (ownCapabilities) => ({
6310
+ channel: hasOwnCapability(ownCapabilities, "notify-channel"),
6311
+ here: hasOwnCapability(ownCapabilities, "notify-here"),
6312
+ role: hasOwnCapability(ownCapabilities, "notify-role"),
6311
6313
  user: true,
6312
- user_group: true
6313
- };
6314
+ user_group: hasOwnCapability(ownCapabilities, "notify-group")
6315
+ });
6314
6316
  var decodeUserGroupCursor = (cursor) => {
6315
6317
  if (!cursor) return void 0;
6316
6318
  try {
@@ -6436,7 +6438,6 @@ var DEFAULT_SUGGESTION_FACTORY_MAPPERS = {
6436
6438
  var MentionsSearchSource = class extends BaseSearchSource {
6437
6439
  constructor(channel, options) {
6438
6440
  const {
6439
- allowedMentionTypes,
6440
6441
  mentionAllAppUsers,
6441
6442
  suggestionFactoryMappers,
6442
6443
  textComposerText,
@@ -6468,7 +6469,7 @@ var MentionsSearchSource = class extends BaseSearchSource {
6468
6469
  const finalQueryWord = normalizedQueryWords[normalizedQueryWords.length - 1];
6469
6470
  return fullMatchWords.every((queryWord) => normalizedValueWords.includes(queryWord)) && normalizedValueWords.some((valueWord) => valueWord.startsWith(finalQueryWord));
6470
6471
  };
6471
- this.isMentionTypeAllowed = (mentionType) => this.config.allowedMentionTypes?.[mentionType] ?? true;
6472
+ this.isMentionTypeAllowed = (mentionType) => getAllowedMentionTypesFromCapabilities(this.channel.data?.own_capabilities)[mentionType];
6472
6473
  this.mapMentionSuggestion = (mentionType, value, searchToken = this.searchQuery) => {
6473
6474
  const mapper = this.config.suggestionFactoryMappers?.[mentionType] ?? DEFAULT_SUGGESTION_FACTORY_MAPPERS[mentionType];
6474
6475
  return mapper(value, {
@@ -6652,10 +6653,6 @@ var MentionsSearchSource = class extends BaseSearchSource {
6652
6653
  this.client = channel.getClient();
6653
6654
  this.channel = channel;
6654
6655
  this.config = {
6655
- allowedMentionTypes: {
6656
- ...DEFAULT_ALLOWED_MENTION_TYPES,
6657
- ...allowedMentionTypes
6658
- },
6659
6656
  mentionAllAppUsers,
6660
6657
  suggestionFactoryMappers,
6661
6658
  textComposerText,
@@ -16722,7 +16719,7 @@ var StreamChat = class _StreamChat {
16722
16719
  if (this.userAgent) {
16723
16720
  return this.userAgent;
16724
16721
  }
16725
- const version = "9.46.0";
16722
+ const version = "9.47.0";
16726
16723
  const clientBundle = "node-cjs";
16727
16724
  let userAgentString = "";
16728
16725
  if (this.sdkIdentifier) {
@@ -19468,6 +19465,7 @@ var LiveLocationManager = _LiveLocationManager;
19468
19465
  extractPollEnrichedData,
19469
19466
  formatMessage,
19470
19467
  generateFileName,
19468
+ getAllowedMentionTypesFromCapabilities,
19471
19469
  getAttachmentTypeFromMimeType,
19472
19470
  getCommandByName,
19473
19471
  getCompleteCommandInString,