2022-01-11 13:51:48 +00:00
|
|
|
import Model from '@nozbe/watermelondb/Model';
|
2022-02-21 19:41:49 +00:00
|
|
|
import { MarkdownAST } from '@rocket.chat/message-parser';
|
2021-12-03 19:27:57 +00:00
|
|
|
|
2022-02-21 19:41:49 +00:00
|
|
|
import { IAttachment } from './IAttachment';
|
2022-02-14 16:20:29 +00:00
|
|
|
import { IMessage } from './IMessage';
|
2022-01-11 13:51:48 +00:00
|
|
|
import { IServedBy } from './IServedBy';
|
2022-01-17 16:10:39 +00:00
|
|
|
import { SubscriptionType } from './ISubscription';
|
2022-02-14 16:20:29 +00:00
|
|
|
import { IUser } from './IUser';
|
|
|
|
|
|
|
|
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
|
|
|
_id?: string;
|
|
|
|
fname?: 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-02-14 16:20:29 +00:00
|
|
|
v?: {
|
|
|
|
_id?: string;
|
|
|
|
token?: string;
|
|
|
|
status: 'online' | 'busy' | 'away' | 'offline';
|
|
|
|
};
|
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-02-14 16:20:29 +00:00
|
|
|
default?: true;
|
|
|
|
featured?: true;
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum OmnichannelSourceType {
|
|
|
|
WIDGET = 'widget',
|
|
|
|
EMAIL = 'email',
|
|
|
|
SMS = 'sms',
|
|
|
|
APP = 'app',
|
|
|
|
API = 'api',
|
|
|
|
OTHER = 'other' // catch-all source type
|
|
|
|
}
|
|
|
|
export interface IOmnichannelRoom extends Omit<IRoom, 'default' | 'featured' | 'broadcast' | ''> {
|
|
|
|
t: SubscriptionType.OMNICHANNEL;
|
|
|
|
v: {
|
|
|
|
_id?: string;
|
|
|
|
token?: string;
|
|
|
|
status: 'online' | 'busy' | 'away' | 'offline';
|
|
|
|
};
|
|
|
|
email?: {
|
|
|
|
// Data used when the room is created from an email, via email Integration.
|
|
|
|
inbox: string;
|
|
|
|
thread: string;
|
|
|
|
replyTo: string;
|
|
|
|
subject: string;
|
|
|
|
};
|
|
|
|
source: {
|
|
|
|
// TODO: looks like this is not so required as the definition suggests
|
|
|
|
// 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;
|
|
|
|
};
|
|
|
|
transcriptRequest?: IRequestTranscript;
|
|
|
|
servedBy?: IServedBy;
|
|
|
|
onHold?: boolean;
|
|
|
|
departmentId?: string;
|
|
|
|
|
|
|
|
lastMessage?: IMessage & { token?: string };
|
|
|
|
|
|
|
|
tags: any;
|
|
|
|
closedAt: any;
|
|
|
|
metrics: any;
|
|
|
|
waitingResponse: any;
|
|
|
|
responseBy: any;
|
|
|
|
priorityId: any;
|
|
|
|
livechatData: any;
|
|
|
|
queuedAt?: Date;
|
|
|
|
|
|
|
|
ts: Date;
|
|
|
|
label?: string;
|
|
|
|
crmData?: unknown;
|
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
|
|
|
|
|
|
|
export interface IServerRoomItem {
|
|
|
|
_id: string;
|
|
|
|
name: string;
|
|
|
|
fname: string;
|
|
|
|
t: SubscriptionType;
|
|
|
|
u: {
|
|
|
|
_id: string;
|
|
|
|
username: string;
|
|
|
|
};
|
|
|
|
customFields: {};
|
|
|
|
ts: string;
|
|
|
|
ro: boolean;
|
|
|
|
_updatedAt: string;
|
|
|
|
lm: string;
|
|
|
|
lastMessage: {
|
|
|
|
alias: string;
|
|
|
|
msg: string;
|
|
|
|
attachments: IAttachment[];
|
|
|
|
parseUrls: boolean;
|
|
|
|
bot: {
|
|
|
|
i: string;
|
|
|
|
};
|
|
|
|
groupable: boolean;
|
|
|
|
avatar: string;
|
|
|
|
ts: string;
|
|
|
|
u: IUser;
|
|
|
|
rid: string;
|
|
|
|
_id: string;
|
|
|
|
_updatedAt: string;
|
|
|
|
mentions: [];
|
|
|
|
channels: [];
|
|
|
|
md: MarkdownAST;
|
|
|
|
};
|
|
|
|
topic: string;
|
|
|
|
joinCodeRequired: boolean;
|
|
|
|
description: string;
|
|
|
|
jitsiTimeout: string;
|
|
|
|
usersCount: number;
|
|
|
|
e2eKeyId: string;
|
|
|
|
avatarETag: string;
|
|
|
|
encrypted: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IServerRoom {
|
|
|
|
update: IServerRoomItem[];
|
|
|
|
remove: IServerRoomItem[];
|
|
|
|
success: boolean;
|
|
|
|
}
|