2022-11-24 11:37:08 +00:00
|
|
|
import type { AtLeast } from './utils';
|
|
|
|
import type { IRocketChatRecord } from './IRocketChatRecord';
|
|
|
|
import type { IRoom } from './IRoom';
|
|
|
|
import type { IUser } from './IUser';
|
|
|
|
import type { IMessage } from './IMessage';
|
|
|
|
|
2023-03-01 18:26:56 +00:00
|
|
|
export declare enum VideoConferenceStatus {
|
2022-11-24 11:37:08 +00:00
|
|
|
CALLING = 0,
|
|
|
|
STARTED = 1,
|
|
|
|
EXPIRED = 2,
|
|
|
|
ENDED = 3,
|
|
|
|
DECLINED = 4
|
|
|
|
}
|
2023-03-01 18:26:56 +00:00
|
|
|
export declare type DirectCallInstructions = {
|
2022-11-24 11:37:08 +00:00
|
|
|
type: 'direct';
|
2023-03-01 18:26:56 +00:00
|
|
|
calleeId: IUser['_id'];
|
2022-11-24 11:37:08 +00:00
|
|
|
callId: string;
|
|
|
|
};
|
2023-03-01 18:26:56 +00:00
|
|
|
export declare type ConferenceInstructions = {
|
2022-11-24 11:37:08 +00:00
|
|
|
type: 'videoconference';
|
|
|
|
callId: string;
|
|
|
|
rid: IRoom['_id'];
|
|
|
|
};
|
2023-03-01 18:26:56 +00:00
|
|
|
export declare type LivechatInstructions = {
|
2022-11-24 11:37:08 +00:00
|
|
|
type: 'livechat';
|
|
|
|
callId: string;
|
|
|
|
};
|
2023-03-01 18:26:56 +00:00
|
|
|
export declare type VideoConferenceType =
|
|
|
|
| DirectCallInstructions['type']
|
|
|
|
| ConferenceInstructions['type']
|
|
|
|
| LivechatInstructions['type'];
|
2022-11-24 11:37:08 +00:00
|
|
|
export interface IVideoConferenceUser extends Pick<Required<IUser>, '_id' | 'username' | 'name' | 'avatarETag'> {
|
|
|
|
ts: Date;
|
|
|
|
}
|
|
|
|
export interface IVideoConference extends IRocketChatRecord {
|
|
|
|
type: VideoConferenceType;
|
|
|
|
rid: string;
|
|
|
|
users: IVideoConferenceUser[];
|
|
|
|
status: VideoConferenceStatus;
|
|
|
|
messages: {
|
|
|
|
started?: IMessage['_id'];
|
|
|
|
ended?: IMessage['_id'];
|
|
|
|
};
|
|
|
|
url?: string;
|
2023-03-01 18:26:56 +00:00
|
|
|
createdBy: Pick<Required<IUser>, '_id' | 'username' | 'name'>;
|
2022-11-24 11:37:08 +00:00
|
|
|
createdAt: Date;
|
2023-03-01 18:26:56 +00:00
|
|
|
endedBy?: Pick<Required<IUser>, '_id' | 'username' | 'name'>;
|
2022-11-24 11:37:08 +00:00
|
|
|
endedAt?: Date;
|
|
|
|
providerName: string;
|
|
|
|
providerData?: Record<string, any>;
|
|
|
|
ringing?: boolean;
|
|
|
|
}
|
|
|
|
export interface IDirectVideoConference extends IVideoConference {
|
|
|
|
type: 'direct';
|
|
|
|
}
|
|
|
|
export interface IGroupVideoConference extends IVideoConference {
|
|
|
|
type: 'videoconference';
|
|
|
|
anonymousUsers: number;
|
|
|
|
title: string;
|
|
|
|
}
|
|
|
|
export interface ILivechatVideoConference extends IVideoConference {
|
|
|
|
type: 'livechat';
|
|
|
|
}
|
2023-03-01 18:26:56 +00:00
|
|
|
export declare type VideoConference = IDirectVideoConference | IGroupVideoConference | ILivechatVideoConference;
|
|
|
|
export declare type VideoConferenceInstructions = DirectCallInstructions | ConferenceInstructions | LivechatInstructions;
|
|
|
|
export declare const isDirectVideoConference: (call: VideoConference | undefined | null) => call is IDirectVideoConference;
|
|
|
|
export declare const isGroupVideoConference: (call: VideoConference | undefined | null) => call is IGroupVideoConference;
|
|
|
|
export declare const isLivechatVideoConference: (call: VideoConference | undefined | null) => call is ILivechatVideoConference;
|
|
|
|
declare type GroupVideoConferenceCreateData = Omit<IGroupVideoConference, 'createdBy'> & {
|
|
|
|
createdBy: IUser['_id'];
|
|
|
|
};
|
|
|
|
declare type DirectVideoConferenceCreateData = Omit<IDirectVideoConference, 'createdBy'> & {
|
|
|
|
createdBy: IUser['_id'];
|
|
|
|
};
|
|
|
|
declare type LivechatVideoConferenceCreateData = Omit<ILivechatVideoConference, 'createdBy'> & {
|
|
|
|
createdBy: IUser['_id'];
|
|
|
|
};
|
|
|
|
export declare type VideoConferenceCreateData = AtLeast<
|
|
|
|
DirectVideoConferenceCreateData | GroupVideoConferenceCreateData | LivechatVideoConferenceCreateData,
|
|
|
|
'createdBy' | 'type' | 'rid' | 'providerName' | 'providerData'
|
|
|
|
>;
|
2022-11-24 11:37:08 +00:00
|
|
|
|
2023-03-01 18:26:56 +00:00
|
|
|
export type VideoConferenceCapabilities = {
|
|
|
|
mic?: boolean;
|
|
|
|
cam?: boolean;
|
|
|
|
title?: boolean;
|
|
|
|
};
|
2022-11-24 11:37:08 +00:00
|
|
|
|
2023-03-01 18:26:56 +00:00
|
|
|
export type VideoConfStartProps = { roomId: string; title?: string; allowRinging?: boolean };
|
2022-11-24 11:37:08 +00:00
|
|
|
|
2023-03-01 18:26:56 +00:00
|
|
|
export type VideoConfJoinProps = {
|
|
|
|
callId: string;
|
|
|
|
state?: {
|
|
|
|
mic?: boolean;
|
|
|
|
cam?: boolean;
|
|
|
|
};
|
|
|
|
};
|
2022-11-24 11:37:08 +00:00
|
|
|
|
2023-03-01 18:26:56 +00:00
|
|
|
export type VideoConfCancelProps = {
|
|
|
|
callId: string;
|
|
|
|
};
|
2022-11-24 11:37:08 +00:00
|
|
|
|
2023-03-01 18:26:56 +00:00
|
|
|
export type VideoConfListProps = {
|
|
|
|
roomId: string;
|
|
|
|
count?: number;
|
|
|
|
offset?: number;
|
|
|
|
};
|
2022-11-24 11:37:08 +00:00
|
|
|
|
2023-03-01 18:26:56 +00:00
|
|
|
export type VideoConfInfoProps = { callId: string };
|
2023-07-04 00:03:39 +00:00
|
|
|
|
|
|
|
export type VideoConfCall = VideoConference & { capabilities: VideoConferenceCapabilities };
|