1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
17 // *************************************************************************
18 var _0xab7f=['catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next'];(function(_0x469c33,_0x19afd3){var _0x27cc13=function(_0xc873ae){while(--_0xc873ae){_0x469c33['push'](_0x469c33['shift']());}};_0x27cc13(++_0x19afd3);}(_0xab7f,0xa6));var _0xfab7=function(_0x20f751,_0x3e58b5){_0x20f751=_0x20f751-0x0;var _0x5e694c=_0xab7f[_0x20f751];return _0x5e694c;};'use strict';var _=require(_0xfab7('0x0'));var utils=require(_0xfab7('0x1'));var logger=require(_0xfab7('0x2'))(_0xfab7('0x3'));var rpc={'chatMessage':require(_0xfab7('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xfab7('0x5')),'smsMessage':require(_0xfab7('0x6')),'faxMessage':require(_0xfab7('0x7')),'whatsappMessage':require(_0xfab7('0x8'))};exports['consequence']=function(_0x206d70,_0x1213a8){return function(_0x5cde2d){try{var _0x704224={'body':utils[_0xfab7('0x9')](_0x1213a8[0x0],this),'ContactId':this[_0xfab7('0xa')]['id']};if(this[_0xfab7('0xb')]===_0xfab7('0xc')){_0x704224[_0xfab7('0xd')]=this[_0xfab7('0xe')]['id'];}else{_0x704224[_[_0xfab7('0xf')](this[_0xfab7('0xb')])+'AccountId']=this[_0xfab7('0xe')]['id'];}_0x704224[_[_0xfab7('0xf')](this[_0xfab7('0xb')])+'InteractionId']=this[_0xfab7('0x10')]['id'];if(rpc[this[_0xfab7('0xb')]+_0xfab7('0x11')]){return rpc[this['channel']+_0xfab7('0x11')][_0xfab7('0x12')](_0x704224)['then'](function(_0x220d14){logger[_0xfab7('0x13')](_0xfab7('0x14'),_0x206d70,_0x704224[_0xfab7('0x15')]);_0x5cde2d[_0xfab7('0x16')]();})[_0xfab7('0x17')](function(_0xc1785a){logger[_0xfab7('0x18')]('[%s][MESSAGE]\x20%s',_0x206d70,JSON[_0xfab7('0x19')](_0xc1785a));_0x5cde2d[_0xfab7('0x1a')]();});}}catch(_0x3a30e8){logger[_0xfab7('0x18')](_0xfab7('0x14'),_0x206d70,JSON[_0xfab7('0x19')](_0x3a30e8));_0x5cde2d[_0xfab7('0x1a')]();}};};