@ermis-network/ermis-chat-sdk 1.0.2 → 1.0.3

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.d.mts CHANGED
@@ -1281,6 +1281,7 @@ declare class ErmisCallNode<ErmisChatGenerics extends ExtendableGenerics = Defau
1281
1281
  private getAvailableDevices;
1282
1282
  private getMediaConstraints;
1283
1283
  startLocalStream(): Promise<MediaStream | null | undefined>;
1284
+ private applyLocalStream;
1284
1285
  private setConnectionMessage;
1285
1286
  private setCallStatus;
1286
1287
  private setUserInfo;
@@ -1456,15 +1457,33 @@ declare const createForwardMessagePayload: <ErmisChatGenerics extends Extendable
1456
1457
  declare function parseSystemMessage(value: string, userMap: Record<string, string>): string;
1457
1458
 
1458
1459
  /**
1459
- * Parse a raw signal message string into a human-readable English sentence.
1460
+ * Call type constants for signal messages.
1461
+ */
1462
+ declare const CallType: {
1463
+ readonly AUDIO: "audio";
1464
+ readonly VIDEO: "video";
1465
+ };
1466
+ type CallTypeValue = (typeof CallType)[keyof typeof CallType];
1467
+ /**
1468
+ * Result of parsing a signal message.
1469
+ */
1470
+ interface SignalMessageResult {
1471
+ text: string;
1472
+ duration: string;
1473
+ callType: CallTypeValue | '';
1474
+ color: string;
1475
+ }
1476
+ /**
1477
+ * Parse a raw signal message string into a structured object
1478
+ * containing text, duration, call type, and color.
1460
1479
  *
1461
1480
  * Signal messages represent call events. The raw format is:
1462
- * `"<formatId> <userID> [<param1> <param2> ...]"`
1481
+ * `"<formatId> <callerId> [<enderId> <duration>]"`
1463
1482
  *
1464
- * @param value - Raw signal message string from the server
1465
- * @param userMap - Mapping of user IDs display names
1466
- * @returns Parsed English text, or the original string if unknown
1483
+ * @param value - Raw signal message string from the server
1484
+ * @param myUserId - The current user's ID (from client.userID)
1485
+ * @returns Parsed signal message object, or null if input is empty
1467
1486
  */
1468
- declare function parseSignalMessage(value: string, userMap: Record<string, string>): string;
1487
+ declare function parseSignalMessage(value: string, myUserId: string): SignalMessageResult | null;
1469
1488
 
1470
- export { type APIErrorResponse, type APIResponse, type AscDesc, type Attachment, type AttachmentResponse, type AudioConfig, CallAction, type CallEventData, type CallEventType, CallStatus, Channel, type ChannelAPIResponse, type ChannelData, type ChannelFilters, type ChannelMemberResponse, type ChannelMembership, type ChannelQueryOptions, type ChannelResponse, type ChannelSort, ChannelState, type ChannelStateOptions, ClientState, type ConnectAPIResponse, type ConnectionOpen, type Contact, type ContactResponse, type ContactResult, type DefaultGenerics, EVENT_MAP, type EditMessage, ErmisAuthProvider, ErmisCallNode, ErmisChat, type ErmisChatOptions, ErrorFromResponse, type Event$1 as Event, type EventHandler, type EventTypes, type ExtendableGenerics, FRAME_TYPE, type FormatMessageResponse, type ForwardMessage, type IMediaReceiverEvents, type INodeCall, type LiteralStringForUnion, type LogLevel, type Logger, type Message, type MessageBase, type MessageLabel, type MessageResponse, type MessageResponseBase, type MessageSetType, type Metadata, type PollMessage, type QueryChannelAPIResponse, type QueryChannelsAPIResponse, type Reaction, type ReactionAPIResponse, type ReactionResponse, type ReadResponse, type Role, type SendFileAPIResponse, type SendMessageAPIResponse, type SignalData, StableWSConnection, TokenManager, type TransceiverState, type UR, type UpdateChannelAPIResponse, type UserCallInfo, type UserResponse, type UsersResponse, type VideoConfig, type VoiceRecordingMeta, buildAttachmentPayload, chatCodes, createForwardMessagePayload, formatMessage, getAttachmentCategory, isHeicFile, isVideoFile, logChatPromiseExecution, normalizeFileName, parseSignalMessage, parseSystemMessage };
1489
+ export { type APIErrorResponse, type APIResponse, type AscDesc, type Attachment, type AttachmentResponse, type AudioConfig, CallAction, type CallEventData, type CallEventType, CallStatus, CallType, type CallTypeValue, Channel, type ChannelAPIResponse, type ChannelData, type ChannelFilters, type ChannelMemberResponse, type ChannelMembership, type ChannelQueryOptions, type ChannelResponse, type ChannelSort, ChannelState, type ChannelStateOptions, ClientState, type ConnectAPIResponse, type ConnectionOpen, type Contact, type ContactResponse, type ContactResult, type DefaultGenerics, EVENT_MAP, type EditMessage, ErmisAuthProvider, ErmisCallNode, ErmisChat, type ErmisChatOptions, ErrorFromResponse, type Event$1 as Event, type EventHandler, type EventTypes, type ExtendableGenerics, FRAME_TYPE, type FormatMessageResponse, type ForwardMessage, type IMediaReceiverEvents, type INodeCall, type LiteralStringForUnion, type LogLevel, type Logger, type Message, type MessageBase, type MessageLabel, type MessageResponse, type MessageResponseBase, type MessageSetType, type Metadata, type PollMessage, type QueryChannelAPIResponse, type QueryChannelsAPIResponse, type Reaction, type ReactionAPIResponse, type ReactionResponse, type ReadResponse, type Role, type SendFileAPIResponse, type SendMessageAPIResponse, type SignalData, type SignalMessageResult, StableWSConnection, TokenManager, type TransceiverState, type UR, type UpdateChannelAPIResponse, type UserCallInfo, type UserResponse, type UsersResponse, type VideoConfig, type VoiceRecordingMeta, buildAttachmentPayload, chatCodes, createForwardMessagePayload, formatMessage, getAttachmentCategory, isHeicFile, isVideoFile, logChatPromiseExecution, normalizeFileName, parseSignalMessage, parseSystemMessage };
package/dist/index.d.ts CHANGED
@@ -1281,6 +1281,7 @@ declare class ErmisCallNode<ErmisChatGenerics extends ExtendableGenerics = Defau
1281
1281
  private getAvailableDevices;
1282
1282
  private getMediaConstraints;
1283
1283
  startLocalStream(): Promise<MediaStream | null | undefined>;
1284
+ private applyLocalStream;
1284
1285
  private setConnectionMessage;
1285
1286
  private setCallStatus;
1286
1287
  private setUserInfo;
@@ -1456,15 +1457,33 @@ declare const createForwardMessagePayload: <ErmisChatGenerics extends Extendable
1456
1457
  declare function parseSystemMessage(value: string, userMap: Record<string, string>): string;
1457
1458
 
1458
1459
  /**
1459
- * Parse a raw signal message string into a human-readable English sentence.
1460
+ * Call type constants for signal messages.
1461
+ */
1462
+ declare const CallType: {
1463
+ readonly AUDIO: "audio";
1464
+ readonly VIDEO: "video";
1465
+ };
1466
+ type CallTypeValue = (typeof CallType)[keyof typeof CallType];
1467
+ /**
1468
+ * Result of parsing a signal message.
1469
+ */
1470
+ interface SignalMessageResult {
1471
+ text: string;
1472
+ duration: string;
1473
+ callType: CallTypeValue | '';
1474
+ color: string;
1475
+ }
1476
+ /**
1477
+ * Parse a raw signal message string into a structured object
1478
+ * containing text, duration, call type, and color.
1460
1479
  *
1461
1480
  * Signal messages represent call events. The raw format is:
1462
- * `"<formatId> <userID> [<param1> <param2> ...]"`
1481
+ * `"<formatId> <callerId> [<enderId> <duration>]"`
1463
1482
  *
1464
- * @param value - Raw signal message string from the server
1465
- * @param userMap - Mapping of user IDs display names
1466
- * @returns Parsed English text, or the original string if unknown
1483
+ * @param value - Raw signal message string from the server
1484
+ * @param myUserId - The current user's ID (from client.userID)
1485
+ * @returns Parsed signal message object, or null if input is empty
1467
1486
  */
1468
- declare function parseSignalMessage(value: string, userMap: Record<string, string>): string;
1487
+ declare function parseSignalMessage(value: string, myUserId: string): SignalMessageResult | null;
1469
1488
 
1470
- export { type APIErrorResponse, type APIResponse, type AscDesc, type Attachment, type AttachmentResponse, type AudioConfig, CallAction, type CallEventData, type CallEventType, CallStatus, Channel, type ChannelAPIResponse, type ChannelData, type ChannelFilters, type ChannelMemberResponse, type ChannelMembership, type ChannelQueryOptions, type ChannelResponse, type ChannelSort, ChannelState, type ChannelStateOptions, ClientState, type ConnectAPIResponse, type ConnectionOpen, type Contact, type ContactResponse, type ContactResult, type DefaultGenerics, EVENT_MAP, type EditMessage, ErmisAuthProvider, ErmisCallNode, ErmisChat, type ErmisChatOptions, ErrorFromResponse, type Event$1 as Event, type EventHandler, type EventTypes, type ExtendableGenerics, FRAME_TYPE, type FormatMessageResponse, type ForwardMessage, type IMediaReceiverEvents, type INodeCall, type LiteralStringForUnion, type LogLevel, type Logger, type Message, type MessageBase, type MessageLabel, type MessageResponse, type MessageResponseBase, type MessageSetType, type Metadata, type PollMessage, type QueryChannelAPIResponse, type QueryChannelsAPIResponse, type Reaction, type ReactionAPIResponse, type ReactionResponse, type ReadResponse, type Role, type SendFileAPIResponse, type SendMessageAPIResponse, type SignalData, StableWSConnection, TokenManager, type TransceiverState, type UR, type UpdateChannelAPIResponse, type UserCallInfo, type UserResponse, type UsersResponse, type VideoConfig, type VoiceRecordingMeta, buildAttachmentPayload, chatCodes, createForwardMessagePayload, formatMessage, getAttachmentCategory, isHeicFile, isVideoFile, logChatPromiseExecution, normalizeFileName, parseSignalMessage, parseSystemMessage };
1489
+ export { type APIErrorResponse, type APIResponse, type AscDesc, type Attachment, type AttachmentResponse, type AudioConfig, CallAction, type CallEventData, type CallEventType, CallStatus, CallType, type CallTypeValue, Channel, type ChannelAPIResponse, type ChannelData, type ChannelFilters, type ChannelMemberResponse, type ChannelMembership, type ChannelQueryOptions, type ChannelResponse, type ChannelSort, ChannelState, type ChannelStateOptions, ClientState, type ConnectAPIResponse, type ConnectionOpen, type Contact, type ContactResponse, type ContactResult, type DefaultGenerics, EVENT_MAP, type EditMessage, ErmisAuthProvider, ErmisCallNode, ErmisChat, type ErmisChatOptions, ErrorFromResponse, type Event$1 as Event, type EventHandler, type EventTypes, type ExtendableGenerics, FRAME_TYPE, type FormatMessageResponse, type ForwardMessage, type IMediaReceiverEvents, type INodeCall, type LiteralStringForUnion, type LogLevel, type Logger, type Message, type MessageBase, type MessageLabel, type MessageResponse, type MessageResponseBase, type MessageSetType, type Metadata, type PollMessage, type QueryChannelAPIResponse, type QueryChannelsAPIResponse, type Reaction, type ReactionAPIResponse, type ReactionResponse, type ReadResponse, type Role, type SendFileAPIResponse, type SendMessageAPIResponse, type SignalData, type SignalMessageResult, StableWSConnection, TokenManager, type TransceiverState, type UR, type UpdateChannelAPIResponse, type UserCallInfo, type UserResponse, type UsersResponse, type VideoConfig, type VoiceRecordingMeta, buildAttachmentPayload, chatCodes, createForwardMessagePayload, formatMessage, getAttachmentCategory, isHeicFile, isVideoFile, logChatPromiseExecution, normalizeFileName, parseSignalMessage, parseSystemMessage };
package/dist/index.mjs CHANGED
@@ -3605,7 +3605,7 @@ var ErmisChat = class _ErmisChat {
3605
3605
  return pinExpires;
3606
3606
  }
3607
3607
  getUserAgent() {
3608
- return this.userAgent || `ermis-chat-sdk-javascript-client-${this.node ? "node" : "browser"}-${"1.0.2"}`;
3608
+ return this.userAgent || `ermis-chat-sdk-javascript-client-${this.node ? "node" : "browser"}-${"1.0.3"}`;
3609
3609
  }
3610
3610
  setUserAgent(userAgent) {
3611
3611
  this.userAgent = userAgent;
@@ -6314,21 +6314,38 @@ var ErmisCallNode = class {
6314
6314
  const mediaConstraints = await this.getMediaConstraints();
6315
6315
  try {
6316
6316
  const stream = await navigator.mediaDevices.getUserMedia(mediaConstraints);
6317
- if (this.callStatus === "ended" /* ENDED */) {
6318
- stream.getTracks().forEach((track) => track.stop());
6319
- this.destroy();
6320
- return;
6317
+ return this.applyLocalStream(stream);
6318
+ } catch (error) {
6319
+ console.warn("Error getting user media:", error?.message);
6320
+ if (this.callType === "video" && mediaConstraints.video) {
6321
+ try {
6322
+ const audioOnlyStream = await navigator.mediaDevices.getUserMedia({
6323
+ audio: mediaConstraints.audio,
6324
+ video: false
6325
+ });
6326
+ this.setConnectionMessage("Camera not available, using audio only");
6327
+ return this.applyLocalStream(audioOnlyStream);
6328
+ } catch {
6329
+ }
6321
6330
  }
6322
- if (this.onLocalStream) {
6323
- this.onLocalStream(stream);
6331
+ if (typeof this.onError === "function") {
6332
+ this.onError("No microphone or camera found. Please check your device.");
6324
6333
  }
6325
- this.localStream = stream;
6326
- return stream;
6327
- } catch (error) {
6328
- console.error("Error getting user media:", error);
6329
6334
  return null;
6330
6335
  }
6331
6336
  }
6337
+ applyLocalStream(stream) {
6338
+ if (this.callStatus === "ended" /* ENDED */) {
6339
+ stream.getTracks().forEach((track) => track.stop());
6340
+ this.destroy();
6341
+ return;
6342
+ }
6343
+ if (this.onLocalStream) {
6344
+ this.onLocalStream(stream);
6345
+ }
6346
+ this.localStream = stream;
6347
+ return stream;
6348
+ }
6332
6349
  setConnectionMessage(message) {
6333
6350
  if (typeof this.onConnectionMessageChange === "function") {
6334
6351
  this.onConnectionMessageChange(message);
@@ -6373,20 +6390,10 @@ var ErmisCallNode = class {
6373
6390
  this.isDestroyed = false;
6374
6391
  this.callStatus = "";
6375
6392
  this.callType = is_video ? "video" : "audio";
6376
- await this.startLocalStream();
6377
- if (this.callStatus === "ended" /* ENDED */) return;
6378
6393
  this.setUserInfo(cid, eventUserId);
6379
6394
  this.setCallStatus("ringing" /* RINGING */);
6380
6395
  this.cid = cid || "";
6381
6396
  this.metadata = metadata || {};
6382
- console.log("----metadata---", metadata);
6383
- if (eventUserId !== this.userID) {
6384
- await this.initialize();
6385
- }
6386
- if (this.localStream && this.mediaSender && this.mediaReceiver) {
6387
- this.mediaSender?.initEncoders(this.localStream);
6388
- this.mediaReceiver?.initDecoders(this.callType);
6389
- }
6390
6397
  if (typeof this.onCallEvent === "function") {
6391
6398
  this.onCallEvent({
6392
6399
  type: eventUserId !== this.userID ? "incoming" : "outgoing",
@@ -6397,6 +6404,15 @@ var ErmisCallNode = class {
6397
6404
  metadata: this.metadata
6398
6405
  });
6399
6406
  }
6407
+ await this.startLocalStream();
6408
+ if (this.callStatus === "ended" /* ENDED */) return;
6409
+ if (eventUserId !== this.userID) {
6410
+ await this.initialize();
6411
+ }
6412
+ if (this.localStream && this.mediaSender && this.mediaReceiver) {
6413
+ this.mediaSender?.initEncoders(this.localStream);
6414
+ this.mediaReceiver?.initDecoders(this.callType);
6415
+ }
6400
6416
  if (eventUserId === this.userID) {
6401
6417
  if (this.missCallTimeout) clearTimeout(this.missCallTimeout);
6402
6418
  this.missCallTimeout = setTimeout(async () => {
@@ -6657,21 +6673,30 @@ var ErmisCallNode = class {
6657
6673
  }
6658
6674
  async stopScreenShare() {
6659
6675
  const mediaConstraints = await this.getMediaConstraints();
6660
- const cameraStream = await navigator.mediaDevices.getUserMedia(mediaConstraints);
6661
- const cameraTrack = cameraStream.getVideoTracks()[0];
6662
- if (this.localStream) {
6663
- this.localStream.getVideoTracks().forEach((track) => track.stop());
6664
- this.localStream.removeTrack(this.localStream.getVideoTracks()[0]);
6665
- this.localStream.addTrack(cameraTrack);
6666
- } else {
6667
- this.localStream = cameraStream;
6668
- }
6669
- if (this.onLocalStream) {
6670
- this.onLocalStream(this.localStream);
6671
- this.mediaSender?.replaceVideoTrack(this.localStream.getVideoTracks()[0]);
6672
- }
6673
- if (typeof this.onScreenShareChange === "function") {
6674
- this.onScreenShareChange(false);
6676
+ try {
6677
+ const cameraStream = await navigator.mediaDevices.getUserMedia({
6678
+ video: mediaConstraints.video,
6679
+ audio: false
6680
+ });
6681
+ const cameraTrack = cameraStream.getVideoTracks()[0];
6682
+ if (this.localStream) {
6683
+ this.localStream.getVideoTracks().forEach((track) => {
6684
+ track.stop();
6685
+ this.localStream?.removeTrack(track);
6686
+ });
6687
+ this.localStream.addTrack(cameraTrack);
6688
+ } else {
6689
+ this.localStream = cameraStream;
6690
+ }
6691
+ if (this.onLocalStream) {
6692
+ this.onLocalStream(this.localStream);
6693
+ this.mediaSender?.replaceVideoTrack(this.localStream.getVideoTracks()[0]);
6694
+ }
6695
+ if (typeof this.onScreenShareChange === "function") {
6696
+ this.onScreenShareChange(false);
6697
+ }
6698
+ } catch (error) {
6699
+ console.error("Error stopping screen share and reverting to camera:", error);
6675
6700
  }
6676
6701
  }
6677
6702
  async toggleMic(enabled) {
@@ -6939,7 +6964,7 @@ var ErmisAuthProvider = class {
6939
6964
  return data;
6940
6965
  }
6941
6966
  getUserAgent() {
6942
- return this.userAgent || `ermis-chat-sdk-javascript-client-${this.node ? "node" : "browser"}-${"1.0.2"}`;
6967
+ return this.userAgent || `ermis-chat-sdk-javascript-client-${this.node ? "node" : "browser"}-${"1.0.3"}`;
6943
6968
  }
6944
6969
  setUserAgent(userAgent) {
6945
6970
  this.userAgent = userAgent;
@@ -7172,70 +7197,116 @@ function parseSystemMessage(value, userMap) {
7172
7197
  }
7173
7198
 
7174
7199
  // src/signal_message.ts
7175
- function formatDuration(durationSec) {
7176
- const sec = parseInt(durationSec, 10);
7177
- if (isNaN(sec) || sec < 0) return durationSec;
7178
- const minutes = Math.floor(sec / 60);
7179
- const seconds = sec % 60;
7180
- return `${minutes}:${seconds.toString().padStart(2, "0")}`;
7181
- }
7182
- function resolveUser2(userId, userMap) {
7183
- return userMap[userId] ?? userId;
7200
+ var CallType = {
7201
+ AUDIO: "audio",
7202
+ VIDEO: "video"
7203
+ };
7204
+ function formatDuration(durationMs) {
7205
+ if (!durationMs) return "";
7206
+ const ms = parseInt(durationMs, 10);
7207
+ if (isNaN(ms) || ms <= 0) return "";
7208
+ const totalSeconds = Math.floor(ms / 1e3);
7209
+ const minutes = Math.floor(totalSeconds / 60);
7210
+ const seconds = totalSeconds % 60;
7211
+ return `${minutes} min, ${seconds} sec`;
7184
7212
  }
7185
- function parseSignalMessage(value, userMap) {
7186
- if (!value || typeof value !== "string") return value ?? "";
7213
+ function parseSignalMessage(value, myUserId) {
7214
+ if (!value || typeof value !== "string") return null;
7187
7215
  const trimmed = value.trim();
7188
- if (!trimmed) return "";
7216
+ if (!trimmed) return null;
7189
7217
  const parts = trimmed.split(" ");
7190
- const formatId = parts[0];
7191
- const userId = parts[1] ?? "";
7192
- const userName = userId ? resolveUser2(userId, userMap) : "User";
7193
- switch (formatId) {
7194
- // 1: Audio call started
7195
- case "1":
7196
- return `\u{1F4DE} ${userName} started an audio call.`;
7197
- // 2: Audio call missed
7198
- case "2":
7199
- return `\u{1F4DE} Missed audio call from ${userName}.`;
7200
- // 3: Audio call ended (caller_id ender_id duration)
7201
- case "3": {
7202
- const enderId = parts[2] ?? "";
7203
- const duration = parts[3] ?? "0";
7204
- const enderName = enderId ? resolveUser2(enderId, userMap) : "User";
7205
- return `\u{1F4DE} Audio call by ${userName}, ended by ${enderName}. Duration: ${formatDuration(duration)}.`;
7206
- }
7207
- // 4: Video call started
7208
- case "4":
7209
- return `\u{1F4F9} ${userName} started a video call.`;
7210
- // 5: Video call missed
7211
- case "5":
7212
- return `\u{1F4F9} Missed video call from ${userName}.`;
7213
- // 6: Video call ended (caller_id ender_id duration)
7214
- case "6": {
7215
- const enderId = parts[2] ?? "";
7216
- const duration = parts[3] ?? "0";
7217
- const enderName = enderId ? resolveUser2(enderId, userMap) : "User";
7218
- return `\u{1F4F9} Video call by ${userName}, ended by ${enderName}. Duration: ${formatDuration(duration)}.`;
7219
- }
7220
- // 7: Audio call rejected
7221
- case "7":
7222
- return `\u{1F4DE} Audio call from ${userName} was rejected.`;
7223
- // 8: Video call rejected
7224
- case "8":
7225
- return `\u{1F4F9} Video call from ${userName} was rejected.`;
7226
- // 9: Audio call busy
7227
- case "9":
7228
- return `\u{1F4DE} Audio call from ${userName} \u2014 recipient was busy.`;
7229
- // 10: Video call busy
7230
- case "10":
7231
- return `\u{1F4F9} Video call from ${userName} \u2014 recipient was busy.`;
7218
+ const number = parseInt(parts[0], 10);
7219
+ const callerId = parts[1] ?? "";
7220
+ const isMe = myUserId === callerId;
7221
+ let enderId = "";
7222
+ let duration = "";
7223
+ let callType = "";
7224
+ let color = "";
7225
+ if (number === 3 || number === 6) {
7226
+ enderId = parts[2] ?? "";
7227
+ duration = parts[3] === "0" ? "" : parts[3] ?? "";
7228
+ }
7229
+ let text;
7230
+ switch (number) {
7231
+ case 1:
7232
+ text = isMe ? "Calling..." : "Incoming audio call...";
7233
+ callType = CallType.AUDIO;
7234
+ color = "#54D62C";
7235
+ break;
7236
+ case 2:
7237
+ text = isMe ? "Outgoing audio call" : "You missed audio call";
7238
+ callType = CallType.AUDIO;
7239
+ color = "#FF4842";
7240
+ break;
7241
+ case 3:
7242
+ if (duration) {
7243
+ text = isMe ? "Outgoing audio call" : "Incoming audio call";
7244
+ color = "#54D62C";
7245
+ } else {
7246
+ if (enderId === myUserId) {
7247
+ text = "You cancel audio call";
7248
+ } else {
7249
+ text = "You missed audio call";
7250
+ }
7251
+ color = "#FF4842";
7252
+ }
7253
+ callType = CallType.AUDIO;
7254
+ break;
7255
+ case 4:
7256
+ text = isMe ? "Calling..." : "Incoming video call...";
7257
+ callType = CallType.VIDEO;
7258
+ color = "#54D62C";
7259
+ break;
7260
+ case 5:
7261
+ text = isMe ? "Outgoing video call" : "You missed video call";
7262
+ callType = CallType.VIDEO;
7263
+ color = "#FF4842";
7264
+ break;
7265
+ case 6:
7266
+ if (duration) {
7267
+ text = isMe ? "Outgoing video call" : "Incoming video call";
7268
+ color = "#54D62C";
7269
+ } else {
7270
+ if (enderId === myUserId) {
7271
+ text = "You cancel video call";
7272
+ } else {
7273
+ text = "You missed video call";
7274
+ }
7275
+ color = "#FF4842";
7276
+ }
7277
+ callType = CallType.VIDEO;
7278
+ break;
7279
+ case 7:
7280
+ text = isMe ? "Recipient rejected audio call" : "You rejected audio call";
7281
+ callType = CallType.AUDIO;
7282
+ color = "#FF4842";
7283
+ break;
7284
+ case 8:
7285
+ text = isMe ? "Recipient rejected video call" : "You rejected video call";
7286
+ callType = CallType.VIDEO;
7287
+ color = "#FF4842";
7288
+ break;
7289
+ case 9:
7290
+ text = isMe ? "Recipient was busy" : "You missed audio call";
7291
+ callType = CallType.AUDIO;
7292
+ color = "#FF4842";
7293
+ break;
7294
+ case 10:
7295
+ text = isMe ? "Recipient was busy" : "You missed video call";
7296
+ callType = CallType.VIDEO;
7297
+ color = "#FF4842";
7298
+ break;
7232
7299
  default:
7233
- return trimmed;
7300
+ text = trimmed;
7301
+ callType = "";
7302
+ color = "";
7234
7303
  }
7304
+ return { text, duration: formatDuration(duration), callType, color };
7235
7305
  }
7236
7306
  export {
7237
7307
  CallAction,
7238
7308
  CallStatus,
7309
+ CallType,
7239
7310
  Channel,
7240
7311
  ChannelState,
7241
7312
  ClientState,