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-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;
|