Built motion from commit b517aaa2a6638133380e4d135c64a80893061362. Version 3.0.0...
[motion-next.git] / server / services / routing / server / applications / autoreply.js
index 59f2ef9..7b5d7bb 100644 (file)
@@ -1 +1 @@
-const a1201_0x276a=['account','../../mailRpc','interaction','finally','auth','[%s][AUTOREPLY]\x20%s','YYYY-MM-DD\x20HH:mm:ss','user','upperFirst','<div','service','created','stop','Re:','../../rpc/chatMessage','read','../../rpc/openchannelMessage','Re:\x20','host','format','../../../../config/logger','error','next','../../rpc/whatsappMessage','../../rpc/faxMessage','port','Smtp','inReplyTo','messageId','channel','html','AccountId','body','../../rpc/smsMessage','getMustacheRender','contact','message','info','replace','out','create','[RPC][%s][AUTOREPLY]\x20%s','ChatWebsiteId','isNil','phone','<div\x20id=\x22xm-mail-content\x22','mail','secure','../../rpc/mailMessage','pass','InteractionId','then','catch','Message','</div>','stringify','startsWith','sendMailMessage','from','./utils','subject','chat'];(function(_0x379d14,_0x276a36){const _0x4030ba=function(_0x5056ff){while(--_0x5056ff){_0x379d14['push'](_0x379d14['shift']());}};_0x4030ba(++_0x276a36);}(a1201_0x276a,0x19a));const a1201_0x4030=function(_0x379d14,_0x276a36){_0x379d14=_0x379d14-0x0;let _0x4030ba=a1201_0x276a[_0x379d14];return _0x4030ba;};const _0x3dd77e=a1201_0x4030;'use strict';const _=require('lodash'),moment=require('moment'),utils=require(_0x3dd77e('0x15')),logger=require(_0x3dd77e('0x2c'))('routing'),rpc={'chatMessage':require(_0x3dd77e('0x26')),'openchannelMessage':require(_0x3dd77e('0x28')),'mailMessage':require(_0x3dd77e('0xa')),'smsMessage':require(_0x3dd77e('0x39')),'faxMessage':require(_0x3dd77e('0x30')),'whatsappMessage':require(_0x3dd77e('0x2f'))},mailRpc=require(_0x3dd77e('0x19'));exports['consequence']=function(_0x5056ff,_0x4c7d77){return function(_0x4431e0){const _0x5318cd=a1201_0x4030;try{if(_0x4c7d77[0x0]==='1'&&(_[_0x5318cd('0x5')](this[_0x5318cd('0x1a')][_0x5318cd('0x23')])||!this[_0x5318cd('0x1a')]['created']))return logger['info']('[%s][AUTOREPLY]\x20%s',_0x5056ff,'Autoreply\x20already\x20sent'),_0x4431e0[_0x5318cd('0x2e')]();const _0x460656=this[_0x5318cd('0x35')],_0x21a278={'body':utils[_0x5318cd('0x3a')](_0x4c7d77[0x1],this),'ContactId':this[_0x5318cd('0x3b')]['id'],'sentAt':moment()[_0x5318cd('0x2b')](_0x5318cd('0x1e')),'direction':_0x5318cd('0x1')};this[_0x5318cd('0x3c')]&&(_0x21a278['to']=this[_0x5318cd('0x3c')][_0x5318cd('0x14')]||'',_0x21a278['cc']=this[_0x5318cd('0x3c')]['cc']||'',_0x21a278['from']=this[_0x5318cd('0x3c')]['to']||'',_0x21a278[_0x5318cd('0x6')]=this[_0x5318cd('0x3c')][_0x5318cd('0x6')]||'',_0x21a278[_0x5318cd('0x27')]=!![],this[_0x5318cd('0x3c')][_0x5318cd('0x16')]&&(_0x21a278[_0x5318cd('0x16')]='',_0x21a278['subject']+=_[_0x5318cd('0x12')](this[_0x5318cd('0x3c')][_0x5318cd('0x16')],_0x5318cd('0x25'))?'':_0x5318cd('0x29'),_0x21a278[_0x5318cd('0x16')]+=this[_0x5318cd('0x3c')][_0x5318cd('0x16')]));this[_0x5318cd('0x35')]===_0x5318cd('0x17')?_0x21a278[_0x5318cd('0x4')]=this[_0x5318cd('0x18')]['id']:_0x21a278[_[_0x5318cd('0x20')](this[_0x5318cd('0x35')])+_0x5318cd('0x37')]=this[_0x5318cd('0x18')]['id'];_0x21a278[_[_0x5318cd('0x20')](this['channel'])+_0x5318cd('0xc')]=this[_0x5318cd('0x1a')]['id'];if(rpc[this['channel']+_0x5318cd('0xf')]){if(this[_0x5318cd('0x35')]===_0x5318cd('0x8')){const _0x7f7642={'tls':{'rejectUnauthorized':![]}};return this['account'][_0x5318cd('0x32')][_0x5318cd('0x22')]?_0x7f7642[_0x5318cd('0x22')]=this[_0x5318cd('0x18')][_0x5318cd('0x32')][_0x5318cd('0x22')]:(_0x7f7642[_0x5318cd('0x2a')]=this[_0x5318cd('0x18')]['Smtp'][_0x5318cd('0x2a')],_0x7f7642[_0x5318cd('0x31')]=this[_0x5318cd('0x18')][_0x5318cd('0x32')][_0x5318cd('0x31')],_0x7f7642[_0x5318cd('0x9')]=this[_0x5318cd('0x18')][_0x5318cd('0x32')][_0x5318cd('0x9')]),this['account']['Smtp']['authentication']&&(_0x7f7642[_0x5318cd('0x1c')]={'user':this[_0x5318cd('0x18')][_0x5318cd('0x32')][_0x5318cd('0x1f')],'pass':this[_0x5318cd('0x18')][_0x5318cd('0x32')][_0x5318cd('0xb')]}),_0x21a278[_0x5318cd('0x33')]=this[_0x5318cd('0x3c')][_0x5318cd('0x34')],_0x21a278[_0x5318cd('0x36')]='<div\x20id=\x22xm-mail-content\x22>'+_[_0x5318cd('0x0')](_0x21a278[_0x5318cd('0x38')],_0x5318cd('0x7'),_0x5318cd('0x21'))+_0x5318cd('0x10'),mailRpc[_0x5318cd('0x13')](_0x7f7642,_0x21a278)[_0x5318cd('0xd')](function(_0x2b7296){const _0x3e786d=_0x5318cd;return logger[_0x3e786d('0x3d')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x5056ff),_0x21a278['messageId']=_0x2b7296['message'][_0x3e786d('0x34')],rpc[_0x460656+_0x3e786d('0xf')][_0x3e786d('0x2')](_0x21a278);})['then'](function(_0x149a4e){const _0x49a505=_0x5318cd;logger[_0x49a505('0x3d')](_0x49a505('0x1d'),_0x5056ff,JSON[_0x49a505('0x11')](_0x149a4e));})[_0x5318cd('0xe')](function(_0x2d34ee){const _0x38f2fc=_0x5318cd;logger[_0x38f2fc('0x2d')](_0x38f2fc('0x3'),_0x5056ff,JSON[_0x38f2fc('0x11')](_0x2d34ee));})['finally'](function(){_0x4431e0['next']();});}else return rpc[this[_0x5318cd('0x35')]+_0x5318cd('0xf')]['create'](_0x21a278)[_0x5318cd('0xd')](function(){const _0xfec8b7=_0x5318cd;logger[_0xfec8b7('0x3d')](_0xfec8b7('0x1d'),_0x5056ff,_0x21a278[_0xfec8b7('0x38')]);})[_0x5318cd('0xe')](function(_0x522624){const _0x1511c6=_0x5318cd;logger[_0x1511c6('0x2d')]('[%s][AUTOREPLY]\x20%s',_0x5056ff,JSON[_0x1511c6('0x11')](_0x522624));})[_0x5318cd('0x1b')](function(){const _0x16f4b4=_0x5318cd;_0x4431e0[_0x16f4b4('0x2e')]();});}}catch(_0x577de0){logger[_0x5318cd('0x2d')](_0x5318cd('0x1d'),_0x5056ff,JSON[_0x5318cd('0x11')](_0x577de0)),_0x4431e0[_0x5318cd('0x24')]();}};};
\ No newline at end of file
+const a1201_0x1a78=['mail','account','host','consequence','from','routing','../../rpc/whatsappMessage','format','catch','create','secure','then','inReplyTo','upperFirst','Message','startsWith','Autoreply\x20already\x20sent','<div\x20id=\x22xm-mail-content\x22','channel','moment','next','ChatWebsiteId','../../mailRpc','pass','stringify','read','Re:\x20','<div','subject','phone','authentication','[%s][AUTOREPLY]\x20%s','getMustacheRender','user','info','[RPC][%s][AUTOREPLY]\x20%s','messageId','message','<div\x20id=\x22xm-mail-content\x22>','isNil','</div>','port','body','html','service','../../rpc/openchannelMessage','Smtp','created','interaction','Re:','AccountId','lodash','../../rpc/smsMessage','out','error','contact','../../../../config/logger','finally'];(function(_0x5a2cae,_0x1a78dd){const _0x3cb0f8=function(_0x3ce300){while(--_0x3ce300){_0x5a2cae['push'](_0x5a2cae['shift']());}};_0x3cb0f8(++_0x1a78dd);}(a1201_0x1a78,0x19f));const a1201_0x3cb0=function(_0x5a2cae,_0x1a78dd){_0x5a2cae=_0x5a2cae-0x0;let _0x3cb0f8=a1201_0x1a78[_0x5a2cae];return _0x3cb0f8;};const _0x4a728a=a1201_0x3cb0;'use strict';const _=require(_0x4a728a('0x2a')),moment=require(_0x4a728a('0xa')),utils=require('./utils'),logger=require(_0x4a728a('0x2f'))(_0x4a728a('0x36')),rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4a728a('0x24')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x4a728a('0x2b')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4a728a('0x37'))},mailRpc=require(_0x4a728a('0xd'));exports[_0x4a728a('0x34')]=function(_0x3ce300,_0x2ed3d0){return function(_0x335499){const _0x292154=a1201_0x3cb0;try{if(_0x2ed3d0[0x0]==='1'&&(_[_0x292154('0x1e')](this[_0x292154('0x27')][_0x292154('0x26')])||!this[_0x292154('0x27')][_0x292154('0x26')]))return logger['info'](_0x292154('0x16'),_0x3ce300,_0x292154('0x7')),_0x335499[_0x292154('0xb')]();const _0x1ddfb8=this[_0x292154('0x9')],_0x118df0={'body':utils[_0x292154('0x17')](_0x2ed3d0[0x1],this),'ContactId':this[_0x292154('0x2e')]['id'],'sentAt':moment()[_0x292154('0x38')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x292154('0x2c')};this[_0x292154('0x1c')]&&(_0x118df0['to']=this[_0x292154('0x1c')][_0x292154('0x35')]||'',_0x118df0['cc']=this[_0x292154('0x1c')]['cc']||'',_0x118df0[_0x292154('0x35')]=this[_0x292154('0x1c')]['to']||'',_0x118df0[_0x292154('0x14')]=this['message']['phone']||'',_0x118df0[_0x292154('0x10')]=!![],this[_0x292154('0x1c')][_0x292154('0x13')]&&(_0x118df0[_0x292154('0x13')]='',_0x118df0[_0x292154('0x13')]+=_[_0x292154('0x6')](this[_0x292154('0x1c')][_0x292154('0x13')],_0x292154('0x28'))?'':_0x292154('0x11'),_0x118df0['subject']+=this['message'][_0x292154('0x13')]));this[_0x292154('0x9')]==='chat'?_0x118df0[_0x292154('0xc')]=this[_0x292154('0x32')]['id']:_0x118df0[_[_0x292154('0x4')](this[_0x292154('0x9')])+_0x292154('0x29')]=this['account']['id'];_0x118df0[_[_0x292154('0x4')](this[_0x292154('0x9')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x292154('0x9')]+_0x292154('0x5')]){if(this[_0x292154('0x9')]===_0x292154('0x31')){const _0xeb98ae={'tls':{'rejectUnauthorized':![]}};return this[_0x292154('0x32')][_0x292154('0x25')][_0x292154('0x23')]?_0xeb98ae['service']=this['account']['Smtp'][_0x292154('0x23')]:(_0xeb98ae[_0x292154('0x33')]=this[_0x292154('0x32')][_0x292154('0x25')][_0x292154('0x33')],_0xeb98ae['port']=this[_0x292154('0x32')][_0x292154('0x25')][_0x292154('0x20')],_0xeb98ae[_0x292154('0x1')]=this['account'][_0x292154('0x25')][_0x292154('0x1')]),this[_0x292154('0x32')][_0x292154('0x25')][_0x292154('0x15')]&&(_0xeb98ae['auth']={'user':this['account']['Smtp'][_0x292154('0x18')],'pass':this[_0x292154('0x32')][_0x292154('0x25')][_0x292154('0xe')]}),_0x118df0[_0x292154('0x3')]=this[_0x292154('0x1c')][_0x292154('0x1b')],_0x118df0[_0x292154('0x22')]=_0x292154('0x1d')+_['replace'](_0x118df0[_0x292154('0x21')],_0x292154('0x8'),_0x292154('0x12'))+_0x292154('0x1f'),mailRpc['sendMailMessage'](_0xeb98ae,_0x118df0)[_0x292154('0x2')](function(_0x464ec8){const _0x4cddde=_0x292154;return logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x3ce300),_0x118df0[_0x4cddde('0x1b')]=_0x464ec8[_0x4cddde('0x1c')][_0x4cddde('0x1b')],rpc[_0x1ddfb8+_0x4cddde('0x5')][_0x4cddde('0x0')](_0x118df0);})[_0x292154('0x2')](function(_0x4a38bb){const _0x2f1e62=_0x292154;logger[_0x2f1e62('0x19')](_0x2f1e62('0x16'),_0x3ce300,JSON[_0x2f1e62('0xf')](_0x4a38bb));})[_0x292154('0x39')](function(_0xfe31ff){const _0x1c28b9=_0x292154;logger[_0x1c28b9('0x2d')](_0x1c28b9('0x1a'),_0x3ce300,JSON[_0x1c28b9('0xf')](_0xfe31ff));})['finally'](function(){const _0x535acb=_0x292154;_0x335499[_0x535acb('0xb')]();});}else return rpc[this[_0x292154('0x9')]+_0x292154('0x5')]['create'](_0x118df0)[_0x292154('0x2')](function(){const _0x4aa8ba=_0x292154;logger[_0x4aa8ba('0x19')](_0x4aa8ba('0x16'),_0x3ce300,_0x118df0[_0x4aa8ba('0x21')]);})[_0x292154('0x39')](function(_0x131ea6){const _0x5bd2d6=_0x292154;logger[_0x5bd2d6('0x2d')](_0x5bd2d6('0x16'),_0x3ce300,JSON['stringify'](_0x131ea6));})[_0x292154('0x30')](function(){const _0x5d6273=_0x292154;_0x335499[_0x5d6273('0xb')]();});}}catch(_0x41bcc1){logger[_0x292154('0x2d')]('[%s][AUTOREPLY]\x20%s',_0x3ce300,JSON['stringify'](_0x41bcc1)),_0x335499['stop']();}};};
\ No newline at end of file