mediasfu-vue 1.0.3 → 1.0.4

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
@@ -145,6 +145,46 @@ const joinRoomOnMediaSFU = async ({
145
145
  };
146
146
  }
147
147
  };
148
+ const COMMON_LANGUAGE_CODES = [
149
+ "en",
150
+ "es",
151
+ "fr",
152
+ "de",
153
+ "it",
154
+ "pt",
155
+ "nl",
156
+ "ru",
157
+ "zh",
158
+ "ja",
159
+ "ko",
160
+ "ar",
161
+ "hi",
162
+ "bn",
163
+ "tr",
164
+ "pl",
165
+ "vi",
166
+ "th",
167
+ "id",
168
+ "ms",
169
+ "sw",
170
+ "yo",
171
+ "ha",
172
+ "ig",
173
+ "zu",
174
+ "am",
175
+ "tw",
176
+ "he",
177
+ "fa",
178
+ "uk",
179
+ "el",
180
+ "cs",
181
+ "ro",
182
+ "hu",
183
+ "sv",
184
+ "da",
185
+ "no",
186
+ "fi"
187
+ ];
148
188
  const createLiveSubtitle = (params) => {
149
189
  return mediasfuShared.createLiveSubtitle(params);
150
190
  };
@@ -12092,7 +12132,7 @@ const _sfc_main$1d = /* @__PURE__ */ vue.defineComponent({
12092
12132
  },
12093
12133
  setup(__props) {
12094
12134
  const props = __props;
12095
- const allLanguages = mediasfuShared.SUPPORTED_LANGUAGE_CODES.map((code) => ({
12135
+ const allLanguages = COMMON_LANGUAGE_CODES.map((code) => ({
12096
12136
  code,
12097
12137
  name: mediasfuShared.getLanguageName(code)
12098
12138
  }));
@@ -12184,7 +12224,7 @@ const _sfc_main$1d = /* @__PURE__ */ vue.defineComponent({
12184
12224
  const buildFilteredLanguages = (mode, allowedEntries, blockedEntries) => {
12185
12225
  const allowed = new Set((allowedEntries ?? []).map((entry) => entry.code));
12186
12226
  const blocked = new Set(blockedEntries ?? []);
12187
- let codes = [...mediasfuShared.SUPPORTED_LANGUAGE_CODES];
12227
+ let codes = [...COMMON_LANGUAGE_CODES];
12188
12228
  if (mode === "allowlist" && allowed.size > 0) {
12189
12229
  codes = codes.filter((code) => allowed.has(code));
12190
12230
  }
@@ -12920,7 +12960,7 @@ const _sfc_main$1d = /* @__PURE__ */ vue.defineComponent({
12920
12960
  };
12921
12961
  }
12922
12962
  });
12923
- const TranslationSettingsModal = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["__scopeId", "data-v-4a249c4c"]]);
12963
+ const TranslationSettingsModal = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["__scopeId", "data-v-546da8f5"]]);
12924
12964
  const _hoisted_1$k = { style: {
12925
12965
  display: "flex",
12926
12966
  flexDirection: "row",
@@ -13005,10 +13045,10 @@ const _sfc_main$1c = /* @__PURE__ */ vue.defineComponent({
13005
13045
  if (senderId.value) {
13006
13046
  return `Send a direct message to ${senderId.value}`;
13007
13047
  }
13008
- if (props.focusedInput && props.startDirectMessage && props.directMessageDetails) {
13048
+ if (props.directMessageDetails) {
13009
13049
  return `Send a direct message to ${props.directMessageDetails.name}`;
13010
13050
  }
13011
- return "Select a message to reply to";
13051
+ return props.islevel === "2" ? "Select a message to reply to" : "Send a direct message to the host";
13012
13052
  }
13013
13053
  return props.eventType === "chat" ? "Send a message" : "Send a message to everyone";
13014
13054
  });
@@ -13020,7 +13060,7 @@ const _sfc_main$1c = /* @__PURE__ */ vue.defineComponent({
13020
13060
  );
13021
13061
  const emptyStateHint = vue.computed(() => {
13022
13062
  if (props.type === "direct") {
13023
- return props.islevel === "2" ? "Start a conversation from the Participants panel." : "Reply to another participant to begin a private conversation.";
13063
+ return props.islevel === "2" ? "Start a conversation from the Participants panel." : "Send a private message to the host from here.";
13024
13064
  }
13025
13065
  return "Send a message to everyone in the room.";
13026
13066
  });
@@ -13208,7 +13248,7 @@ const _sfc_main$1c = /* @__PURE__ */ vue.defineComponent({
13208
13248
  }
13209
13249
  await props.onSendMessagePress({
13210
13250
  message,
13211
- receivers: props.type === "direct" ? [senderId.value] : [],
13251
+ receivers: props.type === "direct" && senderId.value ? [senderId.value] : [],
13212
13252
  group: props.type === "group",
13213
13253
  messagesLength: props.messagesLength,
13214
13254
  member: props.member,
@@ -13293,7 +13333,7 @@ const _sfc_main$1c = /* @__PURE__ */ vue.defineComponent({
13293
13333
  ], 4),
13294
13334
  vue.createElementVNode("p", {
13295
13335
  style: vue.normalizeStyle(styles.infoBoxText)
13296
- }, " Your direct messages are only visible to you and the host or co-host. ", 4)
13336
+ }, " Direct messages you send here go straight to the host and stay private. ", 4)
13297
13337
  ], 4)) : vue.createCommentVNode("", true),
13298
13338
  __props.messages.length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
13299
13339
  key: 2,
@@ -13408,12 +13448,80 @@ const _sfc_main$1c = /* @__PURE__ */ vue.defineComponent({
13408
13448
  };
13409
13449
  }
13410
13450
  });
13451
+ const sendMessage = async ({
13452
+ message,
13453
+ receivers,
13454
+ group,
13455
+ messagesLength,
13456
+ member,
13457
+ sender,
13458
+ islevel,
13459
+ showAlert,
13460
+ coHostResponsibility,
13461
+ coHost,
13462
+ roomName,
13463
+ socket,
13464
+ chatSetting
13465
+ }) => {
13466
+ let chatValue = false;
13467
+ const normalizedReceivers = (receivers ?? []).filter(
13468
+ (receiver) => typeof receiver === "string" && receiver.trim().length > 0
13469
+ );
13470
+ if (messagesLength > 100 && roomName.startsWith("d") || messagesLength > 500 && roomName.startsWith("s") || messagesLength > 1e5 && roomName.startsWith("p")) {
13471
+ showAlert?.({
13472
+ message: "You have reached the maximum number of messages allowed.",
13473
+ type: "danger",
13474
+ duration: 3e3
13475
+ });
13476
+ return;
13477
+ }
13478
+ if (!message || message === "") {
13479
+ showAlert?.({
13480
+ message: "Message is not valid.",
13481
+ type: "danger",
13482
+ duration: 3e3
13483
+ });
13484
+ return;
13485
+ }
13486
+ if (normalizedReceivers.length < 1 && group === false && islevel === "2") {
13487
+ showAlert?.({
13488
+ message: "Please select a message to reply to",
13489
+ type: "danger",
13490
+ duration: 3e3
13491
+ });
13492
+ return;
13493
+ }
13494
+ const messageObject = {
13495
+ sender: sender ? sender : member,
13496
+ receivers: normalizedReceivers,
13497
+ message,
13498
+ timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString(),
13499
+ group: group !== void 0 && group !== null ? group : false
13500
+ };
13501
+ try {
13502
+ chatValue = coHostResponsibility.find((item) => item.name === "chat")?.value ?? false;
13503
+ } catch (error) {
13504
+ console.error(error);
13505
+ }
13506
+ if (!(islevel === "2" || coHost === member && chatValue === true) && !chatSetting) {
13507
+ showAlert?.({
13508
+ message: "You are not allowed to send a message in this event room",
13509
+ type: "danger",
13510
+ duration: 3e3
13511
+ });
13512
+ return;
13513
+ }
13514
+ socket.emit("sendMessage", {
13515
+ messageObject,
13516
+ roomName
13517
+ });
13518
+ };
13411
13519
  const _sfc_main$1b = /* @__PURE__ */ vue.defineComponent({
13412
13520
  __name: "MessagesModal",
13413
13521
  props: {
13414
13522
  isMessagesModalVisible: { type: Boolean },
13415
13523
  onMessagesClose: {},
13416
- onSendMessagePress: { type: Function, default: mediasfuShared.sendMessage },
13524
+ onSendMessagePress: { type: Function, default: sendMessage },
13417
13525
  messages: {},
13418
13526
  eventType: {},
13419
13527
  member: {},
@@ -28927,7 +29035,7 @@ const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
28927
29035
  if (!canSendMessage.value) {
28928
29036
  return;
28929
29037
  }
28930
- const sendHandler = props.onSendMessagePress ?? mediasfuShared.sendMessage;
29038
+ const sendHandler = props.onSendMessagePress ?? sendMessage;
28931
29039
  const message = currentComposerValue.value.trim();
28932
29040
  await sendHandler({
28933
29041
  message,
@@ -29204,7 +29312,7 @@ const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
29204
29312
  };
29205
29313
  }
29206
29314
  });
29207
- const ModernMessagesModal = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-30c7b9f4"]]);
29315
+ const ModernMessagesModal = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-1ee2c467"]]);
29208
29316
  const panelGradientBackground$c = "linear-gradient(180deg, var(--ms-modern-panel-surface-elevated) 0%, var(--ms-modern-panel-surface) 100%)";
29209
29317
  const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
29210
29318
  __name: "ModernPanelistsModal",
@@ -47523,6 +47631,7 @@ exports.AudioCard = _sfc_main$1O;
47523
47631
  exports.AudioGrid = _sfc_main$N;
47524
47632
  exports.BackgroundModal = BackgroundModal;
47525
47633
  exports.BreakoutRoomsModal = BreakoutRoomsModal;
47634
+ exports.COMMON_LANGUAGE_CODES = COMMON_LANGUAGE_CODES;
47526
47635
  exports.CardVideoDisplay = _sfc_main$1R;
47527
47636
  exports.CoHostModal = CoHostModal;
47528
47637
  exports.ConfigureWhiteboardModal = ConfigureWhiteboardModal;