Merge branch 'develop' into chore.dehydrate-login-methods-from-rocketchatjs

This commit is contained in:
Gerzon Z 2022-03-02 15:55:46 -04:00
commit 3cd8926b70
5 changed files with 47 additions and 9 deletions

View File

@ -1,6 +1,6 @@
import { ITeam } from '../../ITeam'; import { ITeam } from '../../ITeam';
import type { IMessage, IMessageFromServer } from '../../IMessage'; import type { IMessage, IMessageFromServer } from '../../IMessage';
import type { IRoom } from '../../IRoom'; import type { IRoom, IServerRoomItem } from '../../IRoom';
import type { IUser } from '../../IUser'; import type { IUser } from '../../IUser';
export type ChannelsEndpoints = { export type ChannelsEndpoints = {
@ -29,6 +29,20 @@ export type ChannelsEndpoints = {
messages: IMessageFromServer[]; messages: IMessageFromServer[];
}; };
}; };
'channels.create': {
POST: (params: {
name: string;
members: string[];
readOnly: boolean;
extraData: {
broadcast: boolean;
encrypted: boolean;
teamId?: string;
};
}) => {
group: Partial<IServerRoomItem>;
};
};
'channels.convertToTeam': { 'channels.convertToTeam': {
POST: (params: { channelId: string; channelName: string }) => { team: ITeam }; POST: (params: { channelId: string; channelName: string }) => { team: ITeam };
}; };

View File

@ -1,6 +1,6 @@
import { ITeam } from '../../ITeam'; import { ITeam } from '../../ITeam';
import type { IMessage, IMessageFromServer } from '../../IMessage'; import type { IMessage, IMessageFromServer } from '../../IMessage';
import type { IRoom } from '../../IRoom'; import type { IRoom, IServerRoomItem } from '../../IRoom';
import type { IUser } from '../../IUser'; import type { IUser } from '../../IUser';
export type GroupsEndpoints = { export type GroupsEndpoints = {
@ -23,6 +23,20 @@ export type GroupsEndpoints = {
messages: IMessageFromServer[]; messages: IMessageFromServer[];
}; };
}; };
'groups.create': {
POST: (params: {
name: string;
members: string[];
readOnly: boolean;
extraData: {
broadcast: boolean;
encrypted: boolean;
teamId?: string;
};
}) => {
group: Partial<IServerRoomItem>;
};
};
'groups.convertToTeam': { 'groups.convertToTeam': {
POST: (params: { roomId: string; roomName: string }) => { team: ITeam }; POST: (params: { roomId: string; roomName: string }) => { team: ITeam };
}; };

View File

@ -76,6 +76,9 @@ export type OmnichannelEndpoints = {
GET: (params: { sort: string }) => PaginatedResult<{ agents: ILivechatDepartmentAgents[] }>; GET: (params: { sort: string }) => PaginatedResult<{ agents: ILivechatDepartmentAgents[] }>;
POST: (params: { upsert: string[]; remove: string[] }) => void; POST: (params: { upsert: string[]; remove: string[] }) => void;
}; };
'livechat/department/:departmentId/?includeAgents=false': {
GET: () => PaginatedResult<{ department: ILivechatDepartment[] }>;
};
'livechat/departments.available-by-unit/:id': { 'livechat/departments.available-by-unit/:id': {
GET: (params: PaginatedRequest<{ text: string }>) => PaginatedResult<{ GET: (params: PaginatedRequest<{ text: string }>) => PaginatedResult<{
departments: ILivechatDepartment[]; departments: ILivechatDepartment[];

View File

@ -19,7 +19,7 @@ export const createChannel = ({
broadcast: boolean; broadcast: boolean;
encrypted: boolean; encrypted: boolean;
teamId: string; teamId: string;
}): any => { }) => {
const params = { const params = {
name, name,
members: users, members: users,
@ -30,8 +30,6 @@ export const createChannel = ({
...(teamId && { teamId }) ...(teamId && { teamId })
} }
}; };
// TODO: missing definitions from server
// @ts-ignore
return sdk.post(type ? 'groups.create' : 'channels.create', params); return sdk.post(type ? 'groups.create' : 'channels.create', params);
}; };
@ -83,7 +81,8 @@ export const forgotPassword = (email: string): any =>
// @ts-ignore // @ts-ignore
sdk.post('users.forgotPassword', { email }); sdk.post('users.forgotPassword', { email });
export const sendConfirmationEmail = (email: string) => sdk.methodCallWrapper('sendConfirmationEmail', email); export const sendConfirmationEmail = (email: string): Promise<{ message: string; success: boolean }> =>
sdk.methodCallWrapper('sendConfirmationEmail', email);
export const spotlight = (search: string, usernames: string, type: { users: boolean; rooms: boolean }) => export const spotlight = (search: string, usernames: string, type: { users: boolean; rooms: boolean }) =>
// RC 0.51.0 // RC 0.51.0
@ -406,7 +405,7 @@ export const forwardLivechat = (transferData: any) =>
// RC 0.36.0 // RC 0.36.0
sdk.methodCallWrapper('livechat:transfer', transferData); sdk.methodCallWrapper('livechat:transfer', transferData);
export const getDepartmentInfo = (departmentId: string): any => export const getDepartmentInfo = (departmentId: string) =>
// RC 2.2.0 // RC 2.2.0
sdk.get(`livechat/department/${departmentId}?includeAgents=false`); sdk.get(`livechat/department/${departmentId}?includeAgents=false`);
@ -427,7 +426,15 @@ export const usersAutoComplete = (selector: any) =>
// RC 2.4.0 // RC 2.4.0
sdk.get('users.autocomplete', { selector }); sdk.get('users.autocomplete', { selector });
export const getRoutingConfig = () => export const getRoutingConfig = (): Promise<{
previewRoom: boolean;
showConnecting: boolean;
showQueue: boolean;
showQueueLink: boolean;
returnQueue: boolean;
enableTriggerAction: boolean;
autoAssignAgent: boolean;
}> =>
// RC 2.0.0 // RC 2.0.0
sdk.methodCallWrapper('livechat:getRoutingConfig'); sdk.methodCallWrapper('livechat:getRoutingConfig');

View File

@ -347,7 +347,7 @@ class RoomActionsView extends React.Component<IRoomActionsViewProps, IRoomAction
const { returnQueue } = await RocketChat.getRoutingConfig(); const { returnQueue } = await RocketChat.getRoutingConfig();
return returnQueue; return returnQueue;
} catch { } catch {
// do nothing return false;
} }
}; };