@@ -430,9 +430,16 @@ export const editLivechat = (userData: TParams, roomData: TParams): Promise<{ er
430430 return sdk . post ( 'livechat/room.saveInfo' , { guestData : userData , roomData } ) as any ;
431431} ;
432432
433- export const returnLivechat = ( rid : string ) : Promise < boolean > =>
433+ export const returnLivechat = ( rid : string , departmentId ?: string ) : Promise < any > => {
434+ const serverVersion = reduxStore . getState ( ) . server . version ;
435+
436+ if ( compareServerVersion ( serverVersion , 'greaterThanOrEqualTo' , '7.12.0' ) ) {
437+ return sdk . post ( 'livechat/inquiries.returnAsInquiry' , { roomId : rid , departmentId } ) ;
438+ }
439+
434440 // RC 0.72.0
435- sdk . methodCallWrapper ( 'livechat:returnAsInquiry' , rid ) ;
441+ return sdk . methodCallWrapper ( 'livechat:returnAsInquiry' , rid ) ;
442+ } ;
436443
437444export const onHoldLivechat = ( roomId : string ) => sdk . post ( 'livechat/room.onHold' , { roomId } ) ;
438445
@@ -461,17 +468,26 @@ export const usersAutoComplete = (selector: any) =>
461468 // RC 2.4.0
462469 sdk . get ( 'users.autocomplete' , { selector } ) ;
463470
464- export const getRoutingConfig = ( ) : Promise < {
471+ export const getRoutingConfig = async ( ) : Promise < {
465472 previewRoom : boolean ;
466473 showConnecting : boolean ;
467474 showQueue : boolean ;
468475 showQueueLink : boolean ;
469476 returnQueue : boolean ;
470477 enableTriggerAction : boolean ;
471478 autoAssignAgent : boolean ;
472- } > =>
479+ } > => {
480+ const serverVersion = reduxStore . getState ( ) . server . version ;
481+ if ( compareServerVersion ( serverVersion , 'greaterThanOrEqualTo' , '7.11.0' ) ) {
482+ const result = await sdk . get ( 'livechat/config/routing' ) ;
483+ if ( result . success ) {
484+ return result . config ;
485+ }
486+ }
487+
473488 // RC 2.0.0
474- sdk . methodCallWrapper ( 'livechat:getRoutingConfig' ) ;
489+ return sdk . methodCallWrapper ( 'livechat:getRoutingConfig' ) ;
490+ } ;
475491
476492export const getTagsList = ( ) : Promise < ILivechatTag [ ] > =>
477493 // RC 2.0.0
@@ -515,17 +531,13 @@ export const deleteRoom = (roomId: string, t: RoomTypes) =>
515531 // RC 0.49.0
516532 sdk . post ( `${ roomTypeToApiType ( t ) } .delete` , { roomId } ) ;
517533
518- export const toggleMuteUserInRoom = (
519- rid : string ,
520- username : string ,
521- mute : boolean
522- ) : Promise < { message : { msg : string ; result : boolean } ; success : boolean } > => {
523- if ( mute ) {
524- // RC 0.51.0
525- return sdk . methodCallWrapper ( 'muteUserInRoom' , { rid, username } ) ;
534+ export const toggleMuteUserInRoom = ( rid : string , username : string , userId : string , mute : boolean ) => {
535+ const serverVersion = reduxStore . getState ( ) . server . version ;
536+ if ( compareServerVersion ( serverVersion , 'greaterThanOrEqualTo' , '6.8.0' ) ) {
537+ return sdk . post ( mute ? 'rooms.muteUser' : 'rooms.unmuteUser' , { roomId : rid , userId } ) ;
526538 }
527539 // RC 0.51.0
528- return sdk . methodCallWrapper ( 'unmuteUserInRoom' , { rid, username } ) ;
540+ return sdk . methodCallWrapper ( mute ? 'muteUserInRoom' : 'unmuteUserInRoom' , { rid, username } ) ;
529541} ;
530542
531543export const toggleRoomOwner = ( {
0 commit comments