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.
@@ -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
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
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") {
@@ -6117,13 +6121,14 @@ var calculateLevenshtein = (query, name) => {
6117
6121
  }
6118
6122
  return matrix[name.length][query.length];
6119
6123
  };
6120
- var DEFAULT_ALLOWED_MENTION_TYPES = {
6121
- channel: true,
6122
- here: true,
6123
- role: true,
6124
+ var hasOwnCapability = (ownCapabilities, capability) => ownCapabilities?.includes(capability) ?? false;
6125
+ var getAllowedMentionTypesFromCapabilities = (ownCapabilities) => ({
6126
+ channel: hasOwnCapability(ownCapabilities, "notify-channel"),
6127
+ here: hasOwnCapability(ownCapabilities, "notify-here"),
6128
+ role: hasOwnCapability(ownCapabilities, "notify-role"),
6124
6129
  user: true,
6125
- user_group: true
6126
- };
6130
+ user_group: hasOwnCapability(ownCapabilities, "notify-group")
6131
+ });
6127
6132
  var decodeUserGroupCursor = (cursor) => {
6128
6133
  if (!cursor) return void 0;
6129
6134
  try {
@@ -6249,7 +6254,6 @@ var DEFAULT_SUGGESTION_FACTORY_MAPPERS = {
6249
6254
  var MentionsSearchSource = class extends BaseSearchSource {
6250
6255
  constructor(channel, options) {
6251
6256
  const {
6252
- allowedMentionTypes,
6253
6257
  mentionAllAppUsers,
6254
6258
  suggestionFactoryMappers,
6255
6259
  textComposerText,
@@ -6281,7 +6285,7 @@ var MentionsSearchSource = class extends BaseSearchSource {
6281
6285
  const finalQueryWord = normalizedQueryWords[normalizedQueryWords.length - 1];
6282
6286
  return fullMatchWords.every((queryWord) => normalizedValueWords.includes(queryWord)) && normalizedValueWords.some((valueWord) => valueWord.startsWith(finalQueryWord));
6283
6287
  };
6284
- this.isMentionTypeAllowed = (mentionType) => this.config.allowedMentionTypes?.[mentionType] ?? true;
6288
+ this.isMentionTypeAllowed = (mentionType) => getAllowedMentionTypesFromCapabilities(this.channel.data?.own_capabilities)[mentionType];
6285
6289
  this.mapMentionSuggestion = (mentionType, value, searchToken = this.searchQuery) => {
6286
6290
  const mapper = this.config.suggestionFactoryMappers?.[mentionType] ?? DEFAULT_SUGGESTION_FACTORY_MAPPERS[mentionType];
6287
6291
  return mapper(value, {
@@ -6465,10 +6469,6 @@ var MentionsSearchSource = class extends BaseSearchSource {
6465
6469
  this.client = channel.getClient();
6466
6470
  this.channel = channel;
6467
6471
  this.config = {
6468
- allowedMentionTypes: {
6469
- ...DEFAULT_ALLOWED_MENTION_TYPES,
6470
- ...allowedMentionTypes
6471
- },
6472
6472
  mentionAllAppUsers,
6473
6473
  suggestionFactoryMappers,
6474
6474
  textComposerText,
@@ -16535,7 +16535,7 @@ var StreamChat = class _StreamChat {
16535
16535
  if (this.userAgent) {
16536
16536
  return this.userAgent;
16537
16537
  }
16538
- const version = "9.46.0";
16538
+ const version = "9.47.0";
16539
16539
  const clientBundle = "browser-esm";
16540
16540
  let userAgentString = "";
16541
16541
  if (this.sdkIdentifier) {
@@ -19280,6 +19280,7 @@ export {
19280
19280
  extractPollEnrichedData,
19281
19281
  formatMessage,
19282
19282
  generateFileName,
19283
+ getAllowedMentionTypesFromCapabilities,
19283
19284
  getAttachmentTypeFromMimeType,
19284
19285
  getCommandByName,
19285
19286
  getCompleteCommandInString,