2022-01-11 13:51:48 +00:00
|
|
|
import Model from '@nozbe/watermelondb/Model';
|
2021-12-03 19:27:57 +00:00
|
|
|
|
2022-02-14 16:20:29 +00:00
|
|
|
import { IMessage } from './IMessage';
|
2022-03-08 16:25:27 +00:00
|
|
|
import { IRocketChatRecord } from './IRocketChatRecord';
|
2022-01-11 13:51:48 +00:00
|
|
|
import { IServedBy } from './IServedBy';
|
2022-03-07 21:16:20 +00:00
|
|
|
import { IVisitor, SubscriptionType } from './ISubscription';
|
2022-03-09 17:04:25 +00:00
|
|
|
import { IUser, TNotifications } from './IUser';
|
2022-02-14 16:20:29 +00:00
|
|
|
|
|
|
|
interface IRequestTranscript {
|
|
|
|
email: string;
|
|
|
|
requestedAt: Date;
|
|
|
|
requestedBy: IUser;
|
|
|
|
subject: string;
|
|
|
|
}
|
2021-12-03 19:27:57 +00:00
|
|
|
|
2022-01-11 13:51:48 +00:00
|
|
|
export interface IRoom {
|
2022-02-14 16:20:29 +00:00
|
|
|
fname?: string;
|
2022-03-08 16:25:27 +00:00
|
|
|
_id: string;
|
2022-01-11 13:51:48 +00:00
|
|
|
id: string;
|
2022-01-17 16:10:39 +00:00
|
|
|
rid: string;
|
|
|
|
prid: string;
|
|
|
|
t: SubscriptionType;
|
|
|
|
name: string;
|
|
|
|
teamMain: boolean;
|
|
|
|
alert?: boolean;
|
2022-01-11 13:51:48 +00:00
|
|
|
customFields: string[];
|
|
|
|
broadcast: boolean;
|
|
|
|
encrypted: boolean;
|
|
|
|
ro: boolean;
|
2022-03-07 21:16:20 +00:00
|
|
|
v?: IVisitor;
|
|
|
|
status?: string;
|
2022-01-11 13:51:48 +00:00
|
|
|
servedBy?: IServedBy;
|
|
|
|
departmentId?: string;
|
|
|
|
livechatData?: any;
|
|
|
|
tags?: string[];
|
|
|
|
e2eKeyId?: string;
|
|
|
|
avatarETag?: string;
|
2022-02-21 14:40:57 +00:00
|
|
|
latest?: string;
|
2022-03-08 16:25:27 +00:00
|
|
|
default?: boolean;
|
|
|
|
featured?: boolean;
|
2022-02-25 16:43:42 +00:00
|
|
|
muted?: string[];
|
|
|
|
teamId?: string;
|
|
|
|
ignored?: string;
|
2022-03-08 16:25:27 +00:00
|
|
|
|
|
|
|
_updatedAt?: Date;
|
|
|
|
archived?: boolean;
|
|
|
|
announcement?: string;
|
|
|
|
description?: string;
|
|
|
|
lastMessage?: IMessage;
|
|
|
|
topic?: string;
|
|
|
|
reactWhenReadOnly?: boolean;
|
|
|
|
joinCodeRequired?: boolean;
|
|
|
|
jitsiTimeout?: Date;
|
|
|
|
usernames?: string[];
|
|
|
|
uids: Array<string>;
|
|
|
|
lm?: Date;
|
|
|
|
sysMes?: string[];
|
2022-04-20 20:53:11 +00:00
|
|
|
onHold?: boolean;
|
|
|
|
waitingResponse?: boolean;
|
2022-02-14 16:20:29 +00:00
|
|
|
}
|
|
|
|
|
2022-05-10 21:26:06 +00:00
|
|
|
export interface IRoomSettings {
|
|
|
|
roomName?: string;
|
|
|
|
roomAvatar?: string;
|
|
|
|
roomDescription?: string;
|
|
|
|
roomTopic?: string;
|
|
|
|
roomAnnouncement?: string;
|
|
|
|
roomType?: SubscriptionType;
|
|
|
|
readOnly?: boolean;
|
|
|
|
reactWhenReadOnly?: boolean;
|
|
|
|
systemMessages?: string[];
|
|
|
|
joinCode?: string;
|
|
|
|
encrypted?: boolean;
|
|
|
|
}
|
|
|
|
|
2022-02-14 16:20:29 +00:00
|
|
|
export enum OmnichannelSourceType {
|
|
|
|
WIDGET = 'widget',
|
|
|
|
EMAIL = 'email',
|
|
|
|
SMS = 'sms',
|
|
|
|
APP = 'app',
|
|
|
|
API = 'api',
|
|
|
|
OTHER = 'other' // catch-all source type
|
|
|
|
}
|
2022-04-15 02:27:36 +00:00
|
|
|
|
|
|
|
export interface IOmnichannelSource {
|
|
|
|
// The source, or client, which created the Omnichannel room
|
|
|
|
type: OmnichannelSourceType;
|
|
|
|
// An optional identification of external sources, such as an App
|
|
|
|
id?: string;
|
|
|
|
// A human readable alias that goes with the ID, for post analytical purposes
|
|
|
|
alias?: string;
|
|
|
|
// A label to be shown in the room info
|
|
|
|
label?: string;
|
|
|
|
// The sidebar icon
|
|
|
|
sidebarIcon?: string;
|
|
|
|
// The default sidebar icon
|
|
|
|
defaultIcon?: string;
|
|
|
|
_updatedAt?: Date;
|
|
|
|
queuedAt?: Date;
|
|
|
|
}
|
|
|
|
|
2022-03-07 21:16:20 +00:00
|
|
|
export interface IOmnichannelRoom extends Partial<Omit<IRoom, 'default' | 'featured' | 'broadcast'>> {
|
|
|
|
_id: string;
|
|
|
|
rid: string;
|
2022-02-14 16:20:29 +00:00
|
|
|
t: SubscriptionType.OMNICHANNEL;
|
2022-03-07 21:16:20 +00:00
|
|
|
v: IVisitor;
|
2022-02-14 16:20:29 +00:00
|
|
|
email?: {
|
|
|
|
// Data used when the room is created from an email, via email Integration.
|
|
|
|
inbox: string;
|
|
|
|
thread: string;
|
|
|
|
replyTo: string;
|
|
|
|
subject: string;
|
|
|
|
};
|
2022-04-15 02:27:36 +00:00
|
|
|
source: IOmnichannelSource;
|
2022-02-14 16:20:29 +00:00
|
|
|
transcriptRequest?: IRequestTranscript;
|
|
|
|
servedBy?: IServedBy;
|
|
|
|
onHold?: boolean;
|
|
|
|
departmentId?: string;
|
|
|
|
|
|
|
|
lastMessage?: IMessage & { token?: string };
|
|
|
|
|
2022-03-07 21:16:20 +00:00
|
|
|
tags?: string[];
|
|
|
|
closedAt?: Date;
|
|
|
|
metrics?: any;
|
|
|
|
waitingResponse?: any;
|
|
|
|
responseBy?: any;
|
|
|
|
priorityId?: any;
|
|
|
|
livechatData?: any;
|
2022-02-14 16:20:29 +00:00
|
|
|
queuedAt?: Date;
|
|
|
|
|
|
|
|
ts: Date;
|
|
|
|
label?: string;
|
|
|
|
crmData?: unknown;
|
2022-03-07 21:16:20 +00:00
|
|
|
message?: string;
|
|
|
|
queueOrder?: string;
|
|
|
|
estimatedWaitingTimeQueue?: string;
|
|
|
|
estimatedServiceTimeAt?: Date;
|
2021-12-03 19:27:57 +00:00
|
|
|
}
|
2022-01-11 13:51:48 +00:00
|
|
|
|
|
|
|
export type TRoomModel = IRoom & Model;
|
2022-02-21 19:41:49 +00:00
|
|
|
|
2022-03-08 16:25:27 +00:00
|
|
|
export type RoomType = 'c' | 'd' | 'p' | 'l';
|
|
|
|
export type RoomID = string;
|
|
|
|
export type ChannelName = string;
|
|
|
|
|
|
|
|
// https://github.com/RocketChat/Rocket.Chat/blob/43fa95aeaf5716d728bad943c6a07d1ee7172ee2/definition/IRoom.ts#L17
|
|
|
|
export interface IServerRoom extends IRocketChatRecord {
|
|
|
|
_id: RoomID;
|
|
|
|
t: RoomType;
|
|
|
|
name?: string;
|
2022-02-21 19:41:49 +00:00
|
|
|
fname: string;
|
2022-03-08 16:25:27 +00:00
|
|
|
msgs: number;
|
|
|
|
default?: boolean;
|
|
|
|
broadcast?: boolean;
|
|
|
|
featured?: boolean;
|
|
|
|
encrypted?: boolean;
|
|
|
|
topic?: any;
|
|
|
|
|
2022-05-02 11:53:47 +00:00
|
|
|
username?: string;
|
|
|
|
nickname?: string;
|
|
|
|
federation?: any;
|
|
|
|
roomsCount?: number;
|
|
|
|
|
2022-03-08 16:25:27 +00:00
|
|
|
u: Pick<IUser, '_id' | 'username' | 'name'>;
|
|
|
|
uids: Array<string>;
|
|
|
|
|
|
|
|
lastMessage?: IMessage;
|
|
|
|
lm?: Date;
|
|
|
|
usersCount: number;
|
|
|
|
jitsiTimeout?: Date;
|
|
|
|
webRtcCallStartTime?: Date;
|
|
|
|
servedBy?: {
|
2022-02-21 19:41:49 +00:00
|
|
|
_id: string;
|
|
|
|
};
|
2022-03-08 16:25:27 +00:00
|
|
|
|
|
|
|
streamingOptions?: {
|
|
|
|
id?: string;
|
|
|
|
type: string;
|
2022-02-21 19:41:49 +00:00
|
|
|
};
|
|
|
|
|
2022-03-08 16:25:27 +00:00
|
|
|
prid?: string;
|
|
|
|
avatarETag?: string;
|
|
|
|
tokenpass?: {
|
|
|
|
require: string;
|
|
|
|
tokens: {
|
|
|
|
token: string;
|
|
|
|
balance: number;
|
|
|
|
}[];
|
|
|
|
};
|
|
|
|
|
|
|
|
teamMain?: boolean;
|
|
|
|
teamId?: string;
|
|
|
|
teamDefault?: boolean;
|
|
|
|
open?: boolean;
|
|
|
|
|
|
|
|
autoTranslateLanguage: string;
|
|
|
|
autoTranslate?: boolean;
|
|
|
|
unread?: number;
|
|
|
|
alert?: boolean;
|
|
|
|
hideUnreadStatus?: boolean;
|
2022-06-09 14:42:12 +00:00
|
|
|
status?: string;
|
2022-03-08 16:25:27 +00:00
|
|
|
sysMes?: string[];
|
|
|
|
muted?: string[];
|
|
|
|
unmuted?: string[];
|
|
|
|
|
|
|
|
usernames?: string[];
|
|
|
|
ts?: Date;
|
|
|
|
|
|
|
|
cl?: boolean;
|
|
|
|
ro?: boolean;
|
|
|
|
favorite?: boolean;
|
|
|
|
archived?: boolean;
|
|
|
|
announcement?: string;
|
|
|
|
description?: string;
|
|
|
|
|
|
|
|
reactWhenReadOnly?: boolean;
|
|
|
|
joinCodeRequired?: boolean;
|
|
|
|
e2eKeyId?: string;
|
|
|
|
v?: {
|
|
|
|
_id?: string;
|
|
|
|
token?: string;
|
|
|
|
status: 'online' | 'busy' | 'away' | 'offline';
|
|
|
|
};
|
|
|
|
departmentId?: string;
|
|
|
|
livechatData?: any;
|
|
|
|
tags?: string[];
|
2022-05-02 23:13:39 +00:00
|
|
|
|
|
|
|
isLastOwner?: boolean;
|
2022-02-21 19:41:49 +00:00
|
|
|
}
|
2022-03-09 17:04:25 +00:00
|
|
|
|
|
|
|
export interface IRoomNotifications {
|
2022-05-02 18:24:17 +00:00
|
|
|
[key: string]: any;
|
2022-03-09 17:04:25 +00:00
|
|
|
disableNotifications?: boolean;
|
|
|
|
muteGroupMentions?: boolean;
|
|
|
|
hideUnreadStatus?: boolean;
|
|
|
|
audioNotificationsValue?: string;
|
|
|
|
desktopNotifications?: TNotifications;
|
|
|
|
mobilePushNotifications?: TNotifications;
|
|
|
|
emailNotifications?: TNotifications;
|
|
|
|
}
|
2022-05-02 18:24:17 +00:00
|
|
|
|
|
|
|
export type TRoomNotificationsModel = IRoomNotifications & Model;
|