mediasfu-shared 1.0.4 → 1.0.5

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/index.cjs CHANGED
@@ -6368,6 +6368,7 @@ const updateRoomParametersClient = ({ parameters }) => {
6368
6368
  }
6369
6369
  };
6370
6370
  const DEFAULT_MEDIA_SFU_ROOM_API_URL = "https://mediasfu.com/v1/rooms/";
6371
+ const getDefaultMediaSFURoomApiUrl = () => DEFAULT_MEDIA_SFU_ROOM_API_URL;
6371
6372
  const normalizeManagedRoomApi = (normalizedLink) => {
6372
6373
  if (normalizedLink.includes("/v1/rooms")) {
6373
6374
  return `${normalizedLink.replace(/\/$/, "")}/`;
@@ -6377,7 +6378,7 @@ const normalizeManagedRoomApi = (normalizedLink) => {
6377
6378
  const resolveMediaSFURoomApi = (localLink, action) => {
6378
6379
  const normalizedLink = localLink?.trim();
6379
6380
  if (!normalizedLink) {
6380
- return DEFAULT_MEDIA_SFU_ROOM_API_URL;
6381
+ return getDefaultMediaSFURoomApiUrl();
6381
6382
  }
6382
6383
  if (normalizedLink.includes("mediasfu.com")) {
6383
6384
  return normalizeManagedRoomApi(normalizedLink);
@@ -7917,6 +7918,9 @@ const sendMessage = async ({
7917
7918
  chatSetting
7918
7919
  }) => {
7919
7920
  let chatValue = false;
7921
+ const normalizedReceivers = (receivers ?? []).filter(
7922
+ (receiver) => typeof receiver === "string" && receiver.trim().length > 0
7923
+ );
7920
7924
  if (messagesLength > 100 && roomName.startsWith("d") || messagesLength > 500 && roomName.startsWith("s") || messagesLength > 1e5 && roomName.startsWith("p")) {
7921
7925
  showAlert?.({
7922
7926
  message: "You have reached the maximum number of messages allowed.",
@@ -7933,7 +7937,7 @@ const sendMessage = async ({
7933
7937
  });
7934
7938
  return;
7935
7939
  }
7936
- if (receivers.length < 1 && group === false) {
7940
+ if (normalizedReceivers.length < 1 && group === false && islevel === "2") {
7937
7941
  showAlert?.({
7938
7942
  message: "Please select a message to reply to",
7939
7943
  type: "danger",
@@ -7943,7 +7947,7 @@ const sendMessage = async ({
7943
7947
  }
7944
7948
  const messageObject = {
7945
7949
  sender: sender ? sender : member,
7946
- receivers,
7950
+ receivers: normalizedReceivers,
7947
7951
  message,
7948
7952
  timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString(),
7949
7953
  group: group !== void 0 && group !== null ? group : false
@@ -10100,13 +10104,112 @@ const TTS_SUPPORT_BY_LANGUAGE = {
10100
10104
  ca: "good",
10101
10105
  auto: "n/a"
10102
10106
  };
10107
+ const LANGUAGE_NAMES_EN = {
10108
+ en: "English",
10109
+ es: "Spanish",
10110
+ fr: "French",
10111
+ de: "German",
10112
+ it: "Italian",
10113
+ pt: "Portuguese",
10114
+ nl: "Dutch",
10115
+ ru: "Russian",
10116
+ zh: "Chinese",
10117
+ ja: "Japanese",
10118
+ ko: "Korean",
10119
+ ar: "Arabic",
10120
+ hi: "Hindi",
10121
+ bn: "Bengali",
10122
+ pa: "Punjabi",
10123
+ te: "Telugu",
10124
+ mr: "Marathi",
10125
+ ta: "Tamil",
10126
+ ur: "Urdu",
10127
+ gu: "Gujarati",
10128
+ kn: "Kannada",
10129
+ ml: "Malayalam",
10130
+ ne: "Nepali",
10131
+ si: "Sinhala",
10132
+ tr: "Turkish",
10133
+ pl: "Polish",
10134
+ vi: "Vietnamese",
10135
+ th: "Thai",
10136
+ id: "Indonesian",
10137
+ ms: "Malay",
10138
+ tl: "Filipino",
10139
+ km: "Khmer",
10140
+ lo: "Lao",
10141
+ my: "Burmese",
10142
+ sw: "Swahili",
10143
+ yo: "Yoruba",
10144
+ ha: "Hausa",
10145
+ ig: "Igbo",
10146
+ zu: "Zulu",
10147
+ xh: "Xhosa",
10148
+ af: "Afrikaans",
10149
+ st: "Sesotho",
10150
+ tn: "Tswana",
10151
+ sn: "Shona",
10152
+ am: "Amharic",
10153
+ so: "Somali",
10154
+ rw: "Kinyarwanda",
10155
+ mg: "Malagasy",
10156
+ ny: "Chichewa",
10157
+ ee: "Ewe",
10158
+ tw: "Twi",
10159
+ gaa: "Ga",
10160
+ he: "Hebrew",
10161
+ fa: "Persian",
10162
+ ps: "Pashto",
10163
+ ku: "Kurdish",
10164
+ uk: "Ukrainian",
10165
+ el: "Greek",
10166
+ cs: "Czech",
10167
+ ro: "Romanian",
10168
+ hu: "Hungarian",
10169
+ sv: "Swedish",
10170
+ da: "Danish",
10171
+ no: "Norwegian",
10172
+ fi: "Finnish",
10173
+ sk: "Slovak",
10174
+ bg: "Bulgarian",
10175
+ hr: "Croatian",
10176
+ et: "Estonian",
10177
+ lt: "Lithuanian",
10178
+ lv: "Latvian",
10179
+ sl: "Slovenian",
10180
+ sr: "Serbian",
10181
+ bs: "Bosnian",
10182
+ mk: "Macedonian",
10183
+ is: "Icelandic",
10184
+ ga: "Irish",
10185
+ cy: "Welsh",
10186
+ mt: "Maltese",
10187
+ lb: "Luxembourgish",
10188
+ sq: "Albanian",
10189
+ be: "Belarusian",
10190
+ ka: "Georgian",
10191
+ hy: "Armenian",
10192
+ az: "Azerbaijani",
10193
+ eu: "Basque",
10194
+ gl: "Galician",
10195
+ ca: "Catalan",
10196
+ la: "Latin",
10197
+ eo: "Esperanto",
10198
+ kk: "Kazakh",
10199
+ uz: "Uzbek",
10200
+ tg: "Tajik",
10201
+ ky: "Kyrgyz",
10202
+ tk: "Turkmen",
10203
+ mn: "Mongolian"
10204
+ };
10103
10205
  const getDisplayName = (code, locale, fallback) => {
10104
10206
  try {
10105
10207
  const displayNames = new Intl.DisplayNames([locale], { type: "language" });
10106
- return displayNames.of(code) || fallback;
10208
+ const result = displayNames.of(code);
10209
+ if (result) return result;
10107
10210
  } catch {
10108
- return fallback;
10109
10211
  }
10212
+ return LANGUAGE_NAMES_EN[code] ?? fallback;
10110
10213
  };
10111
10214
  const normalizeLanguageCode = (code) => {
10112
10215
  if (!code || typeof code !== "string") {
@@ -10153,6 +10256,58 @@ const getSupportedLanguages = (displayLocale = "en") => {
10153
10256
  };
10154
10257
  }).sort((left, right) => left.name.localeCompare(right.name));
10155
10258
  };
10259
+ const COMMON_LANGUAGE_CODES = [
10260
+ "en",
10261
+ "es",
10262
+ "fr",
10263
+ "de",
10264
+ "it",
10265
+ "pt",
10266
+ "nl",
10267
+ "ru",
10268
+ "zh",
10269
+ "ja",
10270
+ "ko",
10271
+ "ar",
10272
+ "hi",
10273
+ "bn",
10274
+ "tr",
10275
+ "pl",
10276
+ "vi",
10277
+ "th",
10278
+ "id",
10279
+ "ms",
10280
+ "sw",
10281
+ "yo",
10282
+ "ha",
10283
+ "ig",
10284
+ "zu",
10285
+ "am",
10286
+ "tw",
10287
+ "he",
10288
+ "fa",
10289
+ "uk",
10290
+ "el",
10291
+ "cs",
10292
+ "ro",
10293
+ "hu",
10294
+ "sv",
10295
+ "da",
10296
+ "no",
10297
+ "fi"
10298
+ ];
10299
+ const getCommonLanguages = (displayLocale = "en") => {
10300
+ return COMMON_LANGUAGE_CODES.map((code) => {
10301
+ const metadata = getLanguageMetadata(code);
10302
+ return {
10303
+ code,
10304
+ name: getLanguageName(code, displayLocale),
10305
+ nativeName: metadata.nativeName,
10306
+ region: metadata.region,
10307
+ ttsSupport: metadata.ttsSupport
10308
+ };
10309
+ }).sort((left, right) => left.name.localeCompare(right.name));
10310
+ };
10156
10311
  const TTS_PROVIDERS = {
10157
10312
  deepgram: { name: "Deepgram Aura", supportsSSML: false, isDefault: true },
10158
10313
  openai: { name: "OpenAI TTS", supportsSSML: false, multilingual: true },
@@ -12893,6 +13048,7 @@ const launchConfigureWhiteboard = ({
12893
13048
  }) => {
12894
13049
  updateIsConfigureWhiteboardModalVisible(!isConfigureWhiteboardModalVisible);
12895
13050
  };
13051
+ exports.COMMON_LANGUAGE_CODES = COMMON_LANGUAGE_CODES;
12896
13052
  exports.MediaStream = MediaStream$1;
12897
13053
  exports.MediaStreamTrack = MediaStreamTrack;
12898
13054
  exports.QnHDCons = QnHDCons;
@@ -12980,6 +13136,7 @@ exports.generateRandomRequestList = generateRandomRequestList;
12980
13136
  exports.generateRandomWaitingRoomList = generateRandomWaitingRoomList;
12981
13137
  exports.getActiveTranslationConsumers = getActiveTranslationConsumers;
12982
13138
  exports.getAvailableVoices = getAvailableVoices;
13139
+ exports.getCommonLanguages = getCommonLanguages;
12983
13140
  exports.getDomains = getDomains;
12984
13141
  exports.getEstimate = getEstimate;
12985
13142
  exports.getLanguageMetadata = getLanguageMetadata;