This repository was archived by the owner on Nov 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 120
Add ILivechatRoomClosedHandler #189
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d1be509
Add ILivechatRoomClosedHandler
shiqimei d85488d
export ILivechatRoomClosedHandler and fix typos
shiqimei f09c4cc
Update executeListener
shiqimei 3626354
Add 2 new LivechatRead methods
shiqimei 74839f7
Update test-data
shiqimei 7090352
Named imports in alphabetized
shiqimei 101642a
updatedAt and visitorEmails are not mandatory
shiqimei 93593ae
Fix a very serious logic fault
shiqimei 04dafdd
Update src/server/managers/AppListenerManager.ts
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,10 @@ | ||
| import { IDepartment } from '../livechat'; | ||
| import { ILivechatRoom } from '../livechat/ILivechatRoom'; | ||
| import { IVisitor } from '../livechat/IVisitor'; | ||
|
|
||
| export interface ILivechatRead { | ||
| isOnline(): boolean; | ||
| getLivechatRooms(visitor: IVisitor, departmentId?: string): Promise<Array<ILivechatRoom>>; | ||
| getLivechatVisitors(query: object): Promise<Array<IVisitor>>; | ||
| getLivechatDepartments(query: object): Promise<Array<IDepartment>>; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { IHttp, IPersistence, IRead } from '../accessors'; | ||
| import { AppMethod } from '../metadata'; | ||
| import { ILivechatRoom } from './ILivechatRoom'; | ||
|
|
||
| /** | ||
| * Handler called after a livechat room is closed. | ||
| */ | ||
| export interface ILivechatRoomClosedHandler { | ||
| /** | ||
| * Method called *after* a livechat room is closed. | ||
| * | ||
| * @param livechatRoom The livechat room which is closed. | ||
| * @param read An accessor to the environment | ||
| * @param http An accessor to the outside world | ||
| * @param persistence An accessor to the App's persistence | ||
| */ | ||
| [AppMethod.EXECUTE_LIVECHAT_ROOM_CLOSED_HANDLER](data: ILivechatRoom, read: IRead, http: IHttp, persistence: IPersistence): Promise<void>; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,24 @@ | ||
| import { ILivechatRead } from '../../definition/accessors/ILivechatRead'; | ||
| import { IDepartment } from '../../definition/livechat'; | ||
| import { ILivechatRoom } from '../../definition/livechat/ILivechatRoom'; | ||
| import { IVisitor } from '../../definition/livechat/IVisitor'; | ||
| import { ILivechatBridge } from '../bridges/ILivechatBridge'; | ||
| export class LivechatRead implements ILivechatRead { | ||
| constructor(private readonly livechatBridge: ILivechatBridge, private readonly appId: string) { } | ||
|
|
||
| public isOnline(): boolean { | ||
| return this.livechatBridge.isOnline(); | ||
| } | ||
|
|
||
| public getLivechatRooms(visitor: IVisitor, departmentId?: string): Promise<Array<ILivechatRoom>> { | ||
| return this.livechatBridge.findRooms(visitor, departmentId, this.appId); | ||
| } | ||
|
|
||
| public getLivechatVisitors(query: object): Promise<Array<IVisitor>> { | ||
| return this.livechatBridge.findVisitors(query, this.appId); | ||
| } | ||
|
|
||
| public getLivechatDepartments(query: object): Promise<Array<IDepartment>> { | ||
| return this.livechatBridge.findDepartments(query, this.appId); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is getting kinda hard to manage... In the rich messages we have added one type here as well, and this tends to keep growing. We should think of a way of refactoring this in the future