2022-03-08 14:30:45 +00:00
|
|
|
import { ICannedResponse } from '../../ICannedResponse';
|
2022-02-14 16:20:29 +00:00
|
|
|
import { ILivechatAgent } from '../../ILivechatAgent';
|
|
|
|
import { ILivechatDepartment } from '../../ILivechatDepartment';
|
|
|
|
import { ILivechatDepartmentAgents } from '../../ILivechatDepartmentAgents';
|
|
|
|
import { ILivechatMonitor } from '../../ILivechatMonitor';
|
|
|
|
import { ILivechatTag } from '../../ILivechatTag';
|
|
|
|
import { ILivechatVisitor, ILivechatVisitorDTO } from '../../ILivechatVisitor';
|
|
|
|
import { IMessage } from '../../IMessage';
|
|
|
|
import { IOmnichannelRoom, IRoom } from '../../IRoom';
|
|
|
|
import { ISetting } from '../../ISetting';
|
|
|
|
import { PaginatedRequest } from '../helpers/PaginatedRequest';
|
|
|
|
import { PaginatedResult } from '../helpers/PaginatedResult';
|
|
|
|
|
|
|
|
type booleanString = 'true' | 'false';
|
|
|
|
|
|
|
|
export type OmnichannelEndpoints = {
|
|
|
|
'livechat/appearance': {
|
|
|
|
GET: () => {
|
|
|
|
appearance: ISetting[];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
'livechat/visitors.info': {
|
|
|
|
GET: (params: { visitorId: string }) => {
|
2022-03-03 21:46:53 +00:00
|
|
|
visitor: ILivechatVisitor;
|
2022-02-14 16:20:29 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
'livechat/room.onHold': {
|
|
|
|
POST: (params: { roomId: IRoom['_id'] }) => void;
|
|
|
|
};
|
|
|
|
'livechat/monitors.list': {
|
|
|
|
GET: (params: PaginatedRequest<{ text: string }>) => PaginatedResult<{
|
|
|
|
monitors: ILivechatMonitor[];
|
|
|
|
}>;
|
|
|
|
};
|
|
|
|
'livechat/tags.list': {
|
|
|
|
GET: (params: PaginatedRequest<{ text: string }, 'name'>) => PaginatedResult<{
|
|
|
|
tags: ILivechatTag[];
|
|
|
|
}>;
|
|
|
|
};
|
|
|
|
'livechat/department': {
|
|
|
|
GET: (
|
|
|
|
params: PaginatedRequest<{
|
|
|
|
text: string;
|
|
|
|
onlyMyDepartments?: booleanString;
|
|
|
|
enabled?: boolean;
|
|
|
|
excludeDepartmentId?: string;
|
|
|
|
}>
|
|
|
|
) => PaginatedResult<{
|
|
|
|
departments: ILivechatDepartment[];
|
|
|
|
}>;
|
|
|
|
POST: (params: { department: Partial<ILivechatDepartment>; agents: string[] }) => {
|
|
|
|
department: ILivechatDepartment;
|
|
|
|
agents: any[];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
'livechat/department/:_id': {
|
|
|
|
GET: (params: { onlyMyDepartments?: booleanString; includeAgents?: booleanString }) => {
|
|
|
|
department: ILivechatDepartment | null;
|
|
|
|
agents?: any[];
|
|
|
|
};
|
|
|
|
PUT: (params: { department: Partial<ILivechatDepartment>[]; agents: any[] }) => {
|
|
|
|
department: ILivechatDepartment;
|
|
|
|
agents: any[];
|
|
|
|
};
|
|
|
|
DELETE: () => void;
|
|
|
|
};
|
|
|
|
'livechat/department.autocomplete': {
|
|
|
|
GET: (params: { selector: string; onlyMyDepartments: booleanString }) => {
|
|
|
|
items: ILivechatDepartment[];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
'livechat/department/:departmentId/agents': {
|
|
|
|
GET: (params: { sort: string }) => PaginatedResult<{ agents: ILivechatDepartmentAgents[] }>;
|
|
|
|
POST: (params: { upsert: string[]; remove: string[] }) => void;
|
|
|
|
};
|
2022-03-02 19:00:51 +00:00
|
|
|
'livechat/department/:departmentId/?includeAgents=false': {
|
2022-03-03 21:46:53 +00:00
|
|
|
GET: () => PaginatedResult<{ department: ILivechatDepartment }>;
|
2022-03-02 19:00:51 +00:00
|
|
|
};
|
2022-02-14 16:20:29 +00:00
|
|
|
'livechat/departments.available-by-unit/:id': {
|
|
|
|
GET: (params: PaginatedRequest<{ text: string }>) => PaginatedResult<{
|
|
|
|
departments: ILivechatDepartment[];
|
|
|
|
}>;
|
|
|
|
};
|
|
|
|
'livechat/departments.by-unit/': {
|
|
|
|
GET: (params: PaginatedRequest<{ text: string }>) => PaginatedResult<{
|
|
|
|
departments: ILivechatDepartment[];
|
|
|
|
}>;
|
|
|
|
};
|
|
|
|
|
|
|
|
'livechat/departments.by-unit/:id': {
|
|
|
|
GET: (params: PaginatedRequest<{ text: string }>) => PaginatedResult<{
|
|
|
|
departments: ILivechatDepartment[];
|
|
|
|
}>;
|
|
|
|
};
|
|
|
|
|
|
|
|
'livechat/department.listByIds': {
|
|
|
|
GET: (params: { ids: string[]; fields?: Record<string, unknown> }) => { departments: ILivechatDepartment[] };
|
|
|
|
};
|
|
|
|
|
|
|
|
'livechat/custom-fields': {
|
|
|
|
GET: (params: PaginatedRequest<{ text: string }>) => PaginatedResult<{
|
|
|
|
customFields: [
|
|
|
|
{
|
|
|
|
_id: string;
|
|
|
|
label: string;
|
2022-03-08 14:37:38 +00:00
|
|
|
visibility?: string;
|
|
|
|
scope?: string;
|
2022-02-14 16:20:29 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
}>;
|
|
|
|
};
|
|
|
|
'livechat/rooms': {
|
|
|
|
GET: (params: {
|
|
|
|
guest: string;
|
|
|
|
fname: string;
|
|
|
|
servedBy: string[];
|
|
|
|
status: string;
|
|
|
|
department: string;
|
|
|
|
from: string;
|
|
|
|
to: string;
|
|
|
|
customFields: any;
|
|
|
|
current: number;
|
|
|
|
itemsPerPage: number;
|
|
|
|
tags: string[];
|
|
|
|
}) => PaginatedResult<{
|
|
|
|
rooms: IOmnichannelRoom[];
|
|
|
|
}>;
|
|
|
|
};
|
|
|
|
'livechat/:rid/messages': {
|
|
|
|
GET: (params: PaginatedRequest<{ query: string }>) => PaginatedResult<{
|
|
|
|
messages: IMessage[];
|
|
|
|
}>;
|
|
|
|
};
|
|
|
|
'livechat/users/agent': {
|
|
|
|
GET: (params: PaginatedRequest<{ text?: string }>) => PaginatedResult<{
|
|
|
|
users: {
|
|
|
|
_id: string;
|
|
|
|
emails: {
|
|
|
|
address: string;
|
|
|
|
verified: boolean;
|
|
|
|
}[];
|
|
|
|
status: string;
|
|
|
|
name: string;
|
|
|
|
username: string;
|
|
|
|
statusLivechat: string;
|
|
|
|
livechat: {
|
|
|
|
maxNumberSimultaneousChat: number;
|
|
|
|
};
|
|
|
|
}[];
|
|
|
|
}>;
|
|
|
|
};
|
|
|
|
|
|
|
|
'livechat/visitor': {
|
|
|
|
POST: (params: { visitor: ILivechatVisitorDTO }) => { visitor: ILivechatVisitor };
|
|
|
|
};
|
|
|
|
|
|
|
|
'livechat/visitor/:token': {
|
|
|
|
GET: (params: { token: string }) => { visitor: ILivechatVisitor };
|
|
|
|
DELETE: (params: { token: string }) => { visitor: { _id: string; ts: string } };
|
|
|
|
};
|
|
|
|
|
|
|
|
'livechat/visitor/:token/room': {
|
|
|
|
GET: (params: { token: string }) => { rooms: IOmnichannelRoom[] };
|
|
|
|
};
|
|
|
|
|
|
|
|
'livechat/visitor.callStatus': {
|
|
|
|
POST: (params: { token: string; callStatus: string; rid: string; callId: string }) => {
|
|
|
|
token: string;
|
|
|
|
callStatus: string;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
'livechat/visitor.status': {
|
|
|
|
POST: (params: { token: string; status: string }) => { token: string; status: string };
|
|
|
|
};
|
|
|
|
|
|
|
|
'livechat/queue': {
|
|
|
|
GET: (params: {
|
|
|
|
agentId?: ILivechatAgent['_id'];
|
|
|
|
includeOfflineAgents?: boolean;
|
|
|
|
departmentId?: ILivechatAgent['_id'];
|
|
|
|
offset: number;
|
|
|
|
count: number;
|
2022-02-25 21:32:03 +00:00
|
|
|
sort: string | { uploadedAt: number };
|
2022-02-14 16:20:29 +00:00
|
|
|
}) => {
|
|
|
|
queue: {
|
|
|
|
chats: number;
|
|
|
|
department: { _id: string; name: string };
|
|
|
|
user: { _id: string; username: string; status: string };
|
|
|
|
}[];
|
|
|
|
count: number;
|
|
|
|
offset: number;
|
|
|
|
total: number;
|
|
|
|
};
|
|
|
|
};
|
2022-03-08 14:30:45 +00:00
|
|
|
|
2022-03-08 15:04:41 +00:00
|
|
|
'livechat/agents/:uid/departments?enabledDepartmentsOnly=true': {
|
|
|
|
GET: () => { departments: ILivechatDepartment[] };
|
|
|
|
};
|
|
|
|
|
2022-03-08 14:30:45 +00:00
|
|
|
'canned-responses': {
|
|
|
|
GET: (params: PaginatedRequest<{ scope?: string; departmentId?: string; text?: string }>) => PaginatedResult<{
|
|
|
|
cannedResponses: ICannedResponse[];
|
|
|
|
}>;
|
|
|
|
};
|
2022-02-14 16:20:29 +00:00
|
|
|
};
|