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.
@@ -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
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
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,
@@ -6331,13 +6336,14 @@ var calculateLevenshtein = (query, name) => {
6331
6336
  }
6332
6337
  return matrix[name.length][query.length];
6333
6338
  };
6334
- var DEFAULT_ALLOWED_MENTION_TYPES = {
6335
- channel: true,
6336
- here: true,
6337
- role: true,
6339
+ var hasOwnCapability = (ownCapabilities, capability) => ownCapabilities?.includes(capability) ?? false;
6340
+ var getAllowedMentionTypesFromCapabilities = (ownCapabilities) => ({
6341
+ channel: hasOwnCapability(ownCapabilities, "notify-channel"),
6342
+ here: hasOwnCapability(ownCapabilities, "notify-here"),
6343
+ role: hasOwnCapability(ownCapabilities, "notify-role"),
6338
6344
  user: true,
6339
- user_group: true
6340
- };
6345
+ user_group: hasOwnCapability(ownCapabilities, "notify-group")
6346
+ });
6341
6347
  var decodeUserGroupCursor = (cursor) => {
6342
6348
  if (!cursor) return void 0;
6343
6349
  try {
@@ -6463,7 +6469,6 @@ var DEFAULT_SUGGESTION_FACTORY_MAPPERS = {
6463
6469
  var MentionsSearchSource = class extends BaseSearchSource {
6464
6470
  constructor(channel, options) {
6465
6471
  const {
6466
- allowedMentionTypes,
6467
6472
  mentionAllAppUsers,
6468
6473
  suggestionFactoryMappers,
6469
6474
  textComposerText,
@@ -6495,7 +6500,7 @@ var MentionsSearchSource = class extends BaseSearchSource {
6495
6500
  const finalQueryWord = normalizedQueryWords[normalizedQueryWords.length - 1];
6496
6501
  return fullMatchWords.every((queryWord) => normalizedValueWords.includes(queryWord)) && normalizedValueWords.some((valueWord) => valueWord.startsWith(finalQueryWord));
6497
6502
  };
6498
- this.isMentionTypeAllowed = (mentionType) => this.config.allowedMentionTypes?.[mentionType] ?? true;
6503
+ this.isMentionTypeAllowed = (mentionType) => getAllowedMentionTypesFromCapabilities(this.channel.data?.own_capabilities)[mentionType];
6499
6504
  this.mapMentionSuggestion = (mentionType, value, searchToken = this.searchQuery) => {
6500
6505
  const mapper = this.config.suggestionFactoryMappers?.[mentionType] ?? DEFAULT_SUGGESTION_FACTORY_MAPPERS[mentionType];
6501
6506
  return mapper(value, {
@@ -6679,10 +6684,6 @@ var MentionsSearchSource = class extends BaseSearchSource {
6679
6684
  this.client = channel.getClient();
6680
6685
  this.channel = channel;
6681
6686
  this.config = {
6682
- allowedMentionTypes: {
6683
- ...DEFAULT_ALLOWED_MENTION_TYPES,
6684
- ...allowedMentionTypes
6685
- },
6686
6687
  mentionAllAppUsers,
6687
6688
  suggestionFactoryMappers,
6688
6689
  textComposerText,
@@ -16749,7 +16750,7 @@ var StreamChat = class _StreamChat {
16749
16750
  if (this.userAgent) {
16750
16751
  return this.userAgent;
16751
16752
  }
16752
- const version = "9.46.0";
16753
+ const version = "9.47.0";
16753
16754
  const clientBundle = "browser-cjs";
16754
16755
  let userAgentString = "";
16755
16756
  if (this.sdkIdentifier) {