From 5d2f3aa4ecdd5020c3c8aff66e26a3f127bb44be Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Thu, 20 Feb 2025 11:32:30 -0600 Subject: [PATCH 1/6] department events --- .../app/apps/server/bridges/listeners.js | 12 ++++++++ .../app/livechat/server/lib/departmentsLib.ts | 9 +++++- .../livechat/ILivechatEventContext.ts | 5 ++++ .../IPostLivechatDepartmentDisabled.ts | 25 ++++++++++++++++ .../IPostLivechatDepartmentRemoved.ts | 25 ++++++++++++++++ .../src/definition/livechat/index.ts | 4 +++ .../src/definition/metadata/AppInterface.ts | 2 ++ .../src/definition/metadata/AppMethod.ts | 2 ++ .../src/server/managers/AppListenerManager.ts | 29 +++++++++++++++++++ packages/apps/src/bridges/IListenerBridge.ts | 6 +++- 10 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 packages/apps-engine/src/definition/livechat/IPostLivechatDepartmentDisabled.ts create mode 100644 packages/apps-engine/src/definition/livechat/IPostLivechatDepartmentRemoved.ts diff --git a/apps/meteor/app/apps/server/bridges/listeners.js b/apps/meteor/app/apps/server/bridges/listeners.js index d18d5bdceb656..7ab223dc4bd2d 100644 --- a/apps/meteor/app/apps/server/bridges/listeners.js +++ b/apps/meteor/app/apps/server/bridges/listeners.js @@ -49,6 +49,8 @@ export class AppListenerBridge { case AppInterface.IPostLivechatRoomTransferred: case AppInterface.IPostLivechatGuestSaved: case AppInterface.IPostLivechatRoomSaved: + case AppInterface.IPostLivechatDepartmentRemoved: + case AppInterface.IPostLivechatDepartmentDisabled: return 'livechatEvent'; case AppInterface.IPostUserCreated: case AppInterface.IPostUserUpdated: @@ -196,6 +198,16 @@ export class AppListenerBridge { .getManager() .getListenerManager() .executeListener(inte, await this.orch.getConverters().get('rooms').convertById(data)); + case AppInterface.IPostLivechatDepartmentDisabled: + return this.orch + .getManager() + .getListenerManager() + .executeListener(inte, this.orch.getConverters().get('departments').convertToApp(data)); + case AppInterface.IPostLivechatDepartmentRemoved: + return this.orch + .getManager() + .getListenerManager() + .executeListener(inte, await this.orch.getConverters().get('departments').convertToApp(data)); default: const room = await this.orch.getConverters().get('rooms').convertRoom(data); diff --git a/apps/meteor/app/livechat/server/lib/departmentsLib.ts b/apps/meteor/app/livechat/server/lib/departmentsLib.ts index 7dec370768f0d..b418bdfc3ae6f 100644 --- a/apps/meteor/app/livechat/server/lib/departmentsLib.ts +++ b/apps/meteor/app/livechat/server/lib/departmentsLib.ts @@ -1,3 +1,4 @@ +import { AppEvents, Apps } from '@rocket.chat/apps'; import type { LivechatDepartmentDTO, ILivechatDepartment, ILivechatDepartmentAgents } from '@rocket.chat/core-typings'; import { LivechatDepartment, LivechatDepartmentAgents, LivechatVisitors, LivechatRooms } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; @@ -10,6 +11,7 @@ import { notifyOnLivechatDepartmentAgentChangedByDepartmentId, notifyOnLivechatDepartmentAgentChanged, } from '../../../lib/server/lib/notifyListener'; +import de from 'date-fns/esm/locale/de'; /** * @param {string|null} _id - The department id * @param {Partial} departmentData @@ -133,6 +135,10 @@ export async function saveDepartment( // Disable event if (department?.enabled && !departmentDB?.enabled) { await callbacks.run('livechat.afterDepartmentDisabled', departmentDB); + void Apps.self + ?.getBridges() + ?.getListenerBridge() + .livechatEvent(AppEvents.IPostLivechatDepartmentDisabled, { department: departmentDB }); } if (departmentUnit) { @@ -269,7 +275,7 @@ export async function removeDepartment(departmentId: string) { } }); - const { deletedCount } = await removeByDept; + const { deletedCount } = promiseResponses[0].status === 'fulfilled' ? promiseResponses[0].value : { deletedCount: 0 }; if (deletedCount > 0) { removedAgents.forEach(({ _id: docId, agentId }) => { @@ -285,6 +291,7 @@ export async function removeDepartment(departmentId: string) { } await callbacks.run('livechat.afterRemoveDepartment', { department, agentsIds: removedAgents.map(({ agentId }) => agentId) }); + void Apps.self?.getBridges()?.getListenerBridge().livechatEvent(AppEvents.IPostLivechatDepartmentRemoved, { department }); return ret; } diff --git a/packages/apps-engine/src/definition/livechat/ILivechatEventContext.ts b/packages/apps-engine/src/definition/livechat/ILivechatEventContext.ts index b94f07ef0250e..4a4655c169514 100644 --- a/packages/apps-engine/src/definition/livechat/ILivechatEventContext.ts +++ b/packages/apps-engine/src/definition/livechat/ILivechatEventContext.ts @@ -1,7 +1,12 @@ import type { IUser } from '../users'; +import type { IDepartment } from './IDepartment'; import type { ILivechatRoom } from './ILivechatRoom'; export interface ILivechatEventContext { agent: IUser; room: ILivechatRoom; } + +export interface ILivechatDepartmentStatusContext { + department: IDepartment; +} diff --git a/packages/apps-engine/src/definition/livechat/IPostLivechatDepartmentDisabled.ts b/packages/apps-engine/src/definition/livechat/IPostLivechatDepartmentDisabled.ts new file mode 100644 index 0000000000000..79c67a9774eea --- /dev/null +++ b/packages/apps-engine/src/definition/livechat/IPostLivechatDepartmentDisabled.ts @@ -0,0 +1,25 @@ +import type { IHttp, IModify, IPersistence, IRead } from '../accessors'; +import { AppMethod } from '../metadata'; +import type { ILivechatDepartmentStatusContext } from './ILivechatEventContext'; + +/** + * Handler called after the disablement of a livechat department. + */ +export interface IPostLivechatDepartmentDisabled { + /** + * Handler called *after* the disablement of a livechat department. + * + * @param data the livechat context data which contains the department disabled + * @param read An accessor to the environment + * @param http An accessor to the outside world + * @param persis An accessor to the App's persistence + * @param modify An accessor to the modifier + */ + [AppMethod.EXECUTE_POST_LIVECHAT_DEPARTMENT_DISABLED]( + context: ILivechatDepartmentStatusContext, + read: IRead, + http: IHttp, + persis: IPersistence, + modify?: IModify, + ): Promise; +} diff --git a/packages/apps-engine/src/definition/livechat/IPostLivechatDepartmentRemoved.ts b/packages/apps-engine/src/definition/livechat/IPostLivechatDepartmentRemoved.ts new file mode 100644 index 0000000000000..ef0f202cf262b --- /dev/null +++ b/packages/apps-engine/src/definition/livechat/IPostLivechatDepartmentRemoved.ts @@ -0,0 +1,25 @@ +import type { IHttp, IModify, IPersistence, IRead } from '../accessors'; +import { AppMethod } from '../metadata'; +import type { ILivechatDepartmentStatusContext } from './ILivechatEventContext'; + +/** + * Handler called after the removal of a livechat department. + */ +export interface IPostLivechatDepartmentRemoved { + /** + * Handler called *after* the removal of a livechat department. + * + * @param data the livechat context data which contains the department removed + * @param read An accessor to the environment + * @param http An accessor to the outside world + * @param persis An accessor to the App's persistence + * @param modify An accessor to the modifier + */ + [AppMethod.EXECUTE_POST_LIVECHAT_DEPARTMENT_REMOVED]( + context: ILivechatDepartmentStatusContext, + read: IRead, + http: IHttp, + persis: IPersistence, + modify?: IModify, + ): Promise; +} diff --git a/packages/apps-engine/src/definition/livechat/index.ts b/packages/apps-engine/src/definition/livechat/index.ts index 7cc5a3d1c0046..ff034ee6fea88 100644 --- a/packages/apps-engine/src/definition/livechat/index.ts +++ b/packages/apps-engine/src/definition/livechat/index.ts @@ -8,6 +8,8 @@ import { ILivechatTransferData } from './ILivechatTransferData'; import { ILivechatTransferEventContext, LivechatTransferEventType } from './ILivechatTransferEventContext'; import { IPostLivechatAgentAssigned } from './IPostLivechatAgentAssigned'; import { IPostLivechatAgentUnassigned } from './IPostLivechatAgentUnassigned'; +import { IPostLivechatDepartmentDisabled } from './IPostLivechatDepartmentDisabled'; +import { IPostLivechatDepartmentRemoved } from './IPostLivechatDepartmentRemoved'; import { IPostLivechatGuestSaved } from './IPostLivechatGuestSaved'; import { IPostLivechatRoomClosed } from './IPostLivechatRoomClosed'; import { IPostLivechatRoomSaved } from './IPostLivechatRoomSaved'; @@ -37,4 +39,6 @@ export { IVisitorEmail, IVisitorPhone, LivechatTransferEventType, + IPostLivechatDepartmentRemoved, + IPostLivechatDepartmentDisabled, }; diff --git a/packages/apps-engine/src/definition/metadata/AppInterface.ts b/packages/apps-engine/src/definition/metadata/AppInterface.ts index 23afb7efb0799..3435be25f0a6d 100644 --- a/packages/apps-engine/src/definition/metadata/AppInterface.ts +++ b/packages/apps-engine/src/definition/metadata/AppInterface.ts @@ -48,6 +48,8 @@ export enum AppInterface { IPostLivechatRoomTransferred = 'IPostLivechatRoomTransferred', IPostLivechatGuestSaved = 'IPostLivechatGuestSaved', IPostLivechatRoomSaved = 'IPostLivechatRoomSaved', + IPostLivechatDepartmentRemoved = 'IPostLivechatDepartmentRemoved', + IPostLivechatDepartmentDisabled = 'IPostLivechatDepartmentDisabled', // FileUpload IPreFileUpload = 'IPreFileUpload', // Email diff --git a/packages/apps-engine/src/definition/metadata/AppMethod.ts b/packages/apps-engine/src/definition/metadata/AppMethod.ts index 9cf7fb22aa4fa..540ed9face004 100644 --- a/packages/apps-engine/src/definition/metadata/AppMethod.ts +++ b/packages/apps-engine/src/definition/metadata/AppMethod.ts @@ -89,6 +89,8 @@ export enum AppMethod { EXECUTE_POST_LIVECHAT_ROOM_TRANSFERRED = 'executePostLivechatRoomTransferred', EXECUTE_POST_LIVECHAT_GUEST_SAVED = 'executePostLivechatGuestSaved', EXECUTE_POST_LIVECHAT_ROOM_SAVED = 'executePostLivechatRoomSaved', + EXECUTE_POST_LIVECHAT_DEPARTMENT_DISABLED = 'executePostLivechatDepartmentDisabled', + EXECUTE_POST_LIVECHAT_DEPARTMENT_REMOVED = 'executePostLivechatDepartmentRemoved', // FileUpload EXECUTE_PRE_FILE_UPLOAD = 'executePreFileUpload', // Email diff --git a/packages/apps-engine/src/server/managers/AppListenerManager.ts b/packages/apps-engine/src/server/managers/AppListenerManager.ts index 2d6cd25e62ad6..a71805f370a76 100644 --- a/packages/apps-engine/src/server/managers/AppListenerManager.ts +++ b/packages/apps-engine/src/server/managers/AppListenerManager.ts @@ -30,6 +30,7 @@ import type { AppManager } from '../AppManager'; import type { ProxiedApp } from '../ProxiedApp'; import { Utilities } from '../misc/Utilities'; import { JSONRPC_METHOD_NOT_FOUND } from '../runtime/deno/AppsEngineDenoRuntime'; +import { ILivechatDepartmentStatusContext } from '../../definition/livechat/ILivechatEventContext'; interface IListenerExecutor { [AppInterface.IPreMessageSentPrevent]: { @@ -190,6 +191,14 @@ interface IListenerExecutor { args: [IVisitor]; result: void; }; + [AppInterface.IPostLivechatDepartmentRemoved]: { + args: [ILivechatDepartmentStatusContext]; + result: void; + }; + [AppInterface.IPostLivechatDepartmentDisabled]: { + args: [ILivechatDepartmentStatusContext]; + result: void; + }; // FileUpload [AppInterface.IPreFileUpload]: { args: [IFileUploadContext]; @@ -421,6 +430,10 @@ export class AppListenerManager { return this.executePostLivechatAgentUnassigned(data as ILivechatEventContext); case AppInterface.IPostLivechatRoomTransferred: return this.executePostLivechatRoomTransferred(data as ILivechatTransferEventContext); + case AppInterface.IPostLivechatDepartmentRemoved: + return this.executePostLivechatDepartmentRemoved(data as ILivechatDepartmentStatusContext); + case AppInterface.IPostLivechatDepartmentDisabled: + return this.executePostLivechatDepartmentDisabled(data as ILivechatDepartmentStatusContext); case AppInterface.IPostLivechatGuestSaved: return this.executePostLivechatGuestSaved(data as IVisitor); // FileUpload @@ -1122,6 +1135,22 @@ export class AppListenerManager { } } + private async executePostLivechatDepartmentRemoved(data: ILivechatDepartmentStatusContext): Promise { + for (const appId of this.listeners.get(AppInterface.IPostLivechatDepartmentRemoved)) { + const app = this.manager.getOneById(appId); + + await app.call(AppMethod.EXECUTE_POST_LIVECHAT_DEPARTMENT_REMOVED, data); + } + } + + private async executePostLivechatDepartmentDisabled(data: ILivechatDepartmentStatusContext): Promise { + for (const appId of this.listeners.get(AppInterface.IPostLivechatDepartmentDisabled)) { + const app = this.manager.getOneById(appId); + + await app.call(AppMethod.EXECUTE_POST_LIVECHAT_DEPARTMENT_DISABLED, data); + } + } + // FileUpload private async executePreFileUpload(data: IFileUploadContext): Promise { for (const appId of this.listeners.get(AppInterface.IPreFileUpload)) { diff --git a/packages/apps/src/bridges/IListenerBridge.ts b/packages/apps/src/bridges/IListenerBridge.ts index 313ecf90f5b09..c5a68e631e9c1 100644 --- a/packages/apps/src/bridges/IListenerBridge.ts +++ b/packages/apps/src/bridges/IListenerBridge.ts @@ -29,7 +29,11 @@ declare module '@rocket.chat/apps-engine/server/bridges' { roomEvent(int: 'IPostRoomCreate' | 'IPostRoomDeleted', room: IRoom): Promise; livechatEvent( - int: 'IPostLivechatAgentAssigned' | 'IPostLivechatAgentUnassigned', + int: + | 'IPostLivechatAgentAssigned' + | 'IPostLivechatAgentUnassigned' + | 'IPostLivechatDepartmentRemoved' + | 'IPostLivechatDepartmentDisabled', data: { user: IUser; room: IOmnichannelRoom }, ): Promise; livechatEvent( From 630cdc805abd928bd6d2269ceb39ee51882dfac8 Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Fri, 21 Feb 2025 09:24:53 -0600 Subject: [PATCH 2/6] ts --- apps/meteor/app/livechat/server/lib/departmentsLib.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/meteor/app/livechat/server/lib/departmentsLib.ts b/apps/meteor/app/livechat/server/lib/departmentsLib.ts index b418bdfc3ae6f..2a9a505064b25 100644 --- a/apps/meteor/app/livechat/server/lib/departmentsLib.ts +++ b/apps/meteor/app/livechat/server/lib/departmentsLib.ts @@ -11,7 +11,6 @@ import { notifyOnLivechatDepartmentAgentChangedByDepartmentId, notifyOnLivechatDepartmentAgentChanged, } from '../../../lib/server/lib/notifyListener'; -import de from 'date-fns/esm/locale/de'; /** * @param {string|null} _id - The department id * @param {Partial} departmentData From 4c6c80c16d3f36135db38502b22b755d51d965d8 Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Fri, 21 Feb 2025 10:26:10 -0600 Subject: [PATCH 3/6] fix event --- apps/meteor/app/apps/server/bridges/listeners.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/meteor/app/apps/server/bridges/listeners.js b/apps/meteor/app/apps/server/bridges/listeners.js index 7ab223dc4bd2d..3352d6c5bb371 100644 --- a/apps/meteor/app/apps/server/bridges/listeners.js +++ b/apps/meteor/app/apps/server/bridges/listeners.js @@ -202,12 +202,12 @@ export class AppListenerBridge { return this.orch .getManager() .getListenerManager() - .executeListener(inte, this.orch.getConverters().get('departments').convertToApp(data)); + .executeListener(inte, this.orch.getConverters().get('departments').convertDepartment(data)); case AppInterface.IPostLivechatDepartmentRemoved: return this.orch .getManager() .getListenerManager() - .executeListener(inte, await this.orch.getConverters().get('departments').convertToApp(data)); + .executeListener(inte, await this.orch.getConverters().get('departments').convertDepartment(data)); default: const room = await this.orch.getConverters().get('rooms').convertRoom(data); From 111e8b154f8768056d35c4a7f1bb7bdf46f028af Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Fri, 21 Feb 2025 11:40:29 -0600 Subject: [PATCH 4/6] Create big-tips-greet.md --- .changeset/big-tips-greet.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/big-tips-greet.md diff --git a/.changeset/big-tips-greet.md b/.changeset/big-tips-greet.md new file mode 100644 index 0000000000000..701e013dec0da --- /dev/null +++ b/.changeset/big-tips-greet.md @@ -0,0 +1,7 @@ +--- +"@rocket.chat/meteor": minor +"@rocket.chat/apps-engine": minor +"@rocket.chat/apps": minor +--- + +Allows apps to react to department status changes. From 6e6f96afefae99787b8b58ad6ab6b9085f7e7535 Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Fri, 21 Feb 2025 11:41:10 -0600 Subject: [PATCH 5/6] Apply suggestions from code review Co-authored-by: Douglas Gubert --- apps/meteor/app/apps/server/bridges/listeners.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/meteor/app/apps/server/bridges/listeners.js b/apps/meteor/app/apps/server/bridges/listeners.js index 3352d6c5bb371..d373f828a6c8b 100644 --- a/apps/meteor/app/apps/server/bridges/listeners.js +++ b/apps/meteor/app/apps/server/bridges/listeners.js @@ -202,7 +202,7 @@ export class AppListenerBridge { return this.orch .getManager() .getListenerManager() - .executeListener(inte, this.orch.getConverters().get('departments').convertDepartment(data)); + .executeListener(inte, await this.orch.getConverters().get('departments').convertDepartment(data)); case AppInterface.IPostLivechatDepartmentRemoved: return this.orch .getManager() From d56704298c15c7396f5ede9c5ed9793a0fa10b72 Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Fri, 28 Feb 2025 10:47:10 -0600 Subject: [PATCH 6/6] doug --- .../definition/livechat/ILivechatEventContext.ts | 2 +- .../livechat/IPostLivechatDepartmentDisabled.ts | 4 ++-- .../livechat/IPostLivechatDepartmentRemoved.ts | 4 ++-- .../src/server/managers/AppListenerManager.ts | 14 +++++++------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/apps-engine/src/definition/livechat/ILivechatEventContext.ts b/packages/apps-engine/src/definition/livechat/ILivechatEventContext.ts index 4a4655c169514..c7c554b8376b5 100644 --- a/packages/apps-engine/src/definition/livechat/ILivechatEventContext.ts +++ b/packages/apps-engine/src/definition/livechat/ILivechatEventContext.ts @@ -7,6 +7,6 @@ export interface ILivechatEventContext { room: ILivechatRoom; } -export interface ILivechatDepartmentStatusContext { +export interface ILivechatDepartmentEventContext { department: IDepartment; } diff --git a/packages/apps-engine/src/definition/livechat/IPostLivechatDepartmentDisabled.ts b/packages/apps-engine/src/definition/livechat/IPostLivechatDepartmentDisabled.ts index 79c67a9774eea..a08b1d61e446f 100644 --- a/packages/apps-engine/src/definition/livechat/IPostLivechatDepartmentDisabled.ts +++ b/packages/apps-engine/src/definition/livechat/IPostLivechatDepartmentDisabled.ts @@ -1,6 +1,6 @@ import type { IHttp, IModify, IPersistence, IRead } from '../accessors'; import { AppMethod } from '../metadata'; -import type { ILivechatDepartmentStatusContext } from './ILivechatEventContext'; +import type { ILivechatDepartmentEventContext } from './ILivechatEventContext'; /** * Handler called after the disablement of a livechat department. @@ -16,7 +16,7 @@ export interface IPostLivechatDepartmentDisabled { * @param modify An accessor to the modifier */ [AppMethod.EXECUTE_POST_LIVECHAT_DEPARTMENT_DISABLED]( - context: ILivechatDepartmentStatusContext, + context: ILivechatDepartmentEventContext, read: IRead, http: IHttp, persis: IPersistence, diff --git a/packages/apps-engine/src/definition/livechat/IPostLivechatDepartmentRemoved.ts b/packages/apps-engine/src/definition/livechat/IPostLivechatDepartmentRemoved.ts index ef0f202cf262b..51a08d81eb88e 100644 --- a/packages/apps-engine/src/definition/livechat/IPostLivechatDepartmentRemoved.ts +++ b/packages/apps-engine/src/definition/livechat/IPostLivechatDepartmentRemoved.ts @@ -1,6 +1,6 @@ import type { IHttp, IModify, IPersistence, IRead } from '../accessors'; import { AppMethod } from '../metadata'; -import type { ILivechatDepartmentStatusContext } from './ILivechatEventContext'; +import type { ILivechatDepartmentEventContext } from './ILivechatEventContext'; /** * Handler called after the removal of a livechat department. @@ -16,7 +16,7 @@ export interface IPostLivechatDepartmentRemoved { * @param modify An accessor to the modifier */ [AppMethod.EXECUTE_POST_LIVECHAT_DEPARTMENT_REMOVED]( - context: ILivechatDepartmentStatusContext, + context: ILivechatDepartmentEventContext, read: IRead, http: IHttp, persis: IPersistence, diff --git a/packages/apps-engine/src/server/managers/AppListenerManager.ts b/packages/apps-engine/src/server/managers/AppListenerManager.ts index a71805f370a76..a11a75491c5da 100644 --- a/packages/apps-engine/src/server/managers/AppListenerManager.ts +++ b/packages/apps-engine/src/server/managers/AppListenerManager.ts @@ -3,6 +3,7 @@ import type { IEmailDescriptor, IPreEmailSentContext } from '../../definition/em import { EssentialAppDisabledException } from '../../definition/exceptions'; import type { IExternalComponent } from '../../definition/externalComponent'; import type { ILivechatEventContext, ILivechatRoom, ILivechatTransferEventContext, IVisitor } from '../../definition/livechat'; +import type { ILivechatDepartmentEventContext } from '../../definition/livechat/ILivechatEventContext'; import type { IMessage, IMessageDeleteContext, @@ -30,7 +31,6 @@ import type { AppManager } from '../AppManager'; import type { ProxiedApp } from '../ProxiedApp'; import { Utilities } from '../misc/Utilities'; import { JSONRPC_METHOD_NOT_FOUND } from '../runtime/deno/AppsEngineDenoRuntime'; -import { ILivechatDepartmentStatusContext } from '../../definition/livechat/ILivechatEventContext'; interface IListenerExecutor { [AppInterface.IPreMessageSentPrevent]: { @@ -192,11 +192,11 @@ interface IListenerExecutor { result: void; }; [AppInterface.IPostLivechatDepartmentRemoved]: { - args: [ILivechatDepartmentStatusContext]; + args: [ILivechatDepartmentEventContext]; result: void; }; [AppInterface.IPostLivechatDepartmentDisabled]: { - args: [ILivechatDepartmentStatusContext]; + args: [ILivechatDepartmentEventContext]; result: void; }; // FileUpload @@ -431,9 +431,9 @@ export class AppListenerManager { case AppInterface.IPostLivechatRoomTransferred: return this.executePostLivechatRoomTransferred(data as ILivechatTransferEventContext); case AppInterface.IPostLivechatDepartmentRemoved: - return this.executePostLivechatDepartmentRemoved(data as ILivechatDepartmentStatusContext); + return this.executePostLivechatDepartmentRemoved(data as ILivechatDepartmentEventContext); case AppInterface.IPostLivechatDepartmentDisabled: - return this.executePostLivechatDepartmentDisabled(data as ILivechatDepartmentStatusContext); + return this.executePostLivechatDepartmentDisabled(data as ILivechatDepartmentEventContext); case AppInterface.IPostLivechatGuestSaved: return this.executePostLivechatGuestSaved(data as IVisitor); // FileUpload @@ -1135,7 +1135,7 @@ export class AppListenerManager { } } - private async executePostLivechatDepartmentRemoved(data: ILivechatDepartmentStatusContext): Promise { + private async executePostLivechatDepartmentRemoved(data: ILivechatDepartmentEventContext): Promise { for (const appId of this.listeners.get(AppInterface.IPostLivechatDepartmentRemoved)) { const app = this.manager.getOneById(appId); @@ -1143,7 +1143,7 @@ export class AppListenerManager { } } - private async executePostLivechatDepartmentDisabled(data: ILivechatDepartmentStatusContext): Promise { + private async executePostLivechatDepartmentDisabled(data: ILivechatDepartmentEventContext): Promise { for (const appId of this.listeners.get(AppInterface.IPostLivechatDepartmentDisabled)) { const app = this.manager.getOneById(appId);