Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / services / routing / server / applications / dialogflow.js
index c283e71..a813ce3 100644 (file)
@@ -1 +1 @@
-const a1203_0x1f7c=['endConversation','[%s][DIALOGFLOW]\x20%s','Message','info','message','lodash','AccountId','ChatWebsiteId','isNil','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','./utils','routing','body','../../../../config/logger','then','InteractionId','stringify','error','stop','upperFirst','md5','../../rpc/chatMessage','catch','textRequest','chat','../../rpc/openchannelMessage','isEmpty','result','create','next','interaction','../../rpc/mailMessage','getMustacheRender','consequence','channel','../../rpc/smsMessage','../../rpc/faxMessage','finally','created','metadata','apiai-promise','format','../../rpc/whatsappMessage','account','YYYY-MM-DD\x20HH:mm:ss','dialogflow'];(function(_0x3037bc,_0x1f7cb7){const _0x3a7067=function(_0x4501a1){while(--_0x4501a1){_0x3037bc['push'](_0x3037bc['shift']());}};_0x3a7067(++_0x1f7cb7);}(a1203_0x1f7c,0x14e));const a1203_0x3a70=function(_0x3037bc,_0x1f7cb7){_0x3037bc=_0x3037bc-0x0;let _0x3a7067=a1203_0x1f7c[_0x3037bc];return _0x3a7067;};const _0x4eebd1=a1203_0x3a70;'use strict';const _=require(_0x4eebd1('0x27')),moment=require('moment'),apiai=require(_0x4eebd1('0x1c')),md5=require(_0x4eebd1('0x8')),utils=require(_0x4eebd1('0x2c')),logger=require(_0x4eebd1('0x1'))(_0x4eebd1('0x2d')),rpc={'chatMessage':require(_0x4eebd1('0x9')),'openchannelMessage':require(_0x4eebd1('0xd')),'mailMessage':require(_0x4eebd1('0x13')),'smsMessage':require(_0x4eebd1('0x17')),'faxMessage':require(_0x4eebd1('0x18')),'whatsappMessage':require(_0x4eebd1('0x1e'))};exports[_0x4eebd1('0x15')]=function(_0x4501a1,_0x4f507c){return function(_0x43ea30){const _0x46cbbf=a1203_0x3a70;try{if(!_[_0x46cbbf('0x2a')](this[_0x46cbbf('0x12')]['UserId']))return logger[_0x46cbbf('0x25')](_0x46cbbf('0x23'),_0x4501a1,_0x46cbbf('0x2b')),_0x43ea30[_0x46cbbf('0x11')]();const _0x46fca9={'ContactId':this['contact']['id'],'sentAt':moment()[_0x46cbbf('0x1d')](_0x46cbbf('0x20')),'direction':'out'},_0x4d4da0=this[_0x46cbbf('0x16')];_0x4d4da0===_0x46cbbf('0xc')?_0x46fca9[_0x46cbbf('0x29')]=this[_0x46cbbf('0x1f')]['id']:_0x46fca9[_['upperFirst'](_0x4d4da0)+_0x46cbbf('0x28')]=this[_0x46cbbf('0x1f')]['id'];_0x46fca9[_[_0x46cbbf('0x7')](_0x4d4da0)+_0x46cbbf('0x3')]=this[_0x46cbbf('0x12')]['id'];if(this[_0x46cbbf('0x12')][_0x46cbbf('0x1a')]){const _0x5a8019=_0x4f507c[0x2];if(!_[_0x46cbbf('0xe')](_0x5a8019))return _0x46fca9['body']=utils[_0x46cbbf('0x14')](_0x5a8019,this),rpc[_0x4d4da0+_0x46cbbf('0x24')][_0x46cbbf('0x10')](_0x46fca9)['then'](function(){const _0x2d6222=_0x46cbbf;logger[_0x2d6222('0x25')](_0x2d6222('0x23'),_0x4501a1,_0x46fca9[_0x2d6222('0x0')]);})[_0x46cbbf('0xa')](function(_0x32f183){const _0x1f29a0=_0x46cbbf;logger['error'](_0x1f29a0('0x23'),_0x4501a1,JSON[_0x1f29a0('0x4')](_0x32f183));})[_0x46cbbf('0x19')](function(){const _0x90ba4f=_0x46cbbf;logger[_0x90ba4f('0x25')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4501a1),_0x43ea30[_0x90ba4f('0x6')]();});else logger[_0x46cbbf('0x25')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4501a1),_0x43ea30['stop']();}else{const _0x25ba07=this,_0x40b7e1=apiai(_0x4f507c[0x0],{'language':_0x4f507c[0x1]||'en'});return _0x40b7e1[_0x46cbbf('0xb')](this['message'][_0x46cbbf('0x0')],{'sessionId':md5(this[_0x46cbbf('0x12')]['id'])})[_0x46cbbf('0x2')](function(_0x33b8f8){const _0x4f7b84=_0x46cbbf;return _0x25ba07[_0x4f7b84('0x0')][_0x4f7b84('0x21')]=_0x33b8f8,_0x46fca9[_0x4f7b84('0x0')]=_0x33b8f8[_0x4f7b84('0xf')]['fulfillment']['speech'],rpc[_0x4d4da0+_0x4f7b84('0x24')]['create'](_0x46fca9)[_0x4f7b84('0x2')](function(){const _0x30b4eb=_0x4f7b84;logger[_0x30b4eb('0x25')](_0x30b4eb('0x23'),_0x4501a1,_0x46fca9[_0x30b4eb('0x0')]),_0x33b8f8['result'][_0x30b4eb('0x1b')][_0x30b4eb('0x22')]?_0x43ea30[_0x30b4eb('0x11')]():_0x43ea30['stop']();})[_0x4f7b84('0xa')](function(_0x47d830){const _0x592a31=_0x4f7b84;logger[_0x592a31('0x5')](_0x592a31('0x23'),_0x4501a1,JSON[_0x592a31('0x4')](_0x47d830)),_0x43ea30['next']();});})[_0x46cbbf('0xa')](function(_0x5c38b6){const _0xbb93d2=_0x46cbbf;logger[_0xbb93d2('0x5')](_0xbb93d2('0x23'),_0x4501a1,_0x5c38b6[_0xbb93d2('0x26')]),_0x43ea30['next']();});}}catch(_0x34da82){logger[_0x46cbbf('0x5')](_0x46cbbf('0x23'),_0x4501a1,JSON[_0x46cbbf('0x4')](_0x34da82)),_0x43ea30[_0x46cbbf('0x6')]();}};};
\ No newline at end of file
+const a1203_0x5e38=['catch','message','speech','create','../../rpc/openchannelMessage','account','../../../../config/logger','Message','created','UserId','finally','consequence','error','../../rpc/smsMessage','md5','channel','info','format','./utils','routing','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stringify','result','endConversation','contact','ChatWebsiteId','../../rpc/chatMessage','getMustacheRender','fulfillment','stop','[%s][DIALOGFLOW]\x20%s','then','isNil','upperFirst','../../rpc/faxMessage','metadata','interaction','moment','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','apiai-promise','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','body','../../rpc/mailMessage','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x44c1f5,_0x5e38b9){const _0x5acaf1=function(_0x4f9d0d){while(--_0x4f9d0d){_0x44c1f5['push'](_0x44c1f5['shift']());}};_0x5acaf1(++_0x5e38b9);}(a1203_0x5e38,0x1cf));const a1203_0x5aca=function(_0x44c1f5,_0x5e38b9){_0x44c1f5=_0x44c1f5-0x0;let _0x5acaf1=a1203_0x5e38[_0x44c1f5];return _0x5acaf1;};const _0x21d067=a1203_0x5aca;'use strict';const _=require('lodash'),moment=require(_0x21d067('0x18')),apiai=require(_0x21d067('0x1b')),md5=require(_0x21d067('0x1')),utils=require(_0x21d067('0x5')),logger=require(_0x21d067('0x26'))(_0x21d067('0x6')),rpc={'chatMessage':require(_0x21d067('0xd')),'openchannelMessage':require(_0x21d067('0x24')),'mailMessage':require(_0x21d067('0x1e')),'smsMessage':require(_0x21d067('0x0')),'faxMessage':require(_0x21d067('0x15')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x21d067('0x2b')]=function(_0x4f9d0d,_0x38d30e){return function(_0x391e9d){const _0x529232=a1203_0x5aca;try{if(!_[_0x529232('0x13')](this[_0x529232('0x17')][_0x529232('0x29')]))return logger[_0x529232('0x3')](_0x529232('0x11'),_0x4f9d0d,_0x529232('0x19')),_0x391e9d[_0x529232('0x1a')]();const _0x4131f8={'ContactId':this[_0x529232('0xb')]['id'],'sentAt':moment()[_0x529232('0x4')](_0x529232('0x1f')),'direction':'out'},_0x1f9f0c=this[_0x529232('0x2')];_0x1f9f0c==='chat'?_0x4131f8[_0x529232('0xc')]=this[_0x529232('0x25')]['id']:_0x4131f8[_[_0x529232('0x14')](_0x1f9f0c)+'AccountId']=this['account']['id'];_0x4131f8[_[_0x529232('0x14')](_0x1f9f0c)+'InteractionId']=this['interaction']['id'];if(this[_0x529232('0x17')][_0x529232('0x28')]){const _0x1781fa=_0x38d30e[0x2];if(!_['isEmpty'](_0x1781fa))return _0x4131f8[_0x529232('0x1d')]=utils[_0x529232('0xe')](_0x1781fa,this),rpc[_0x1f9f0c+_0x529232('0x27')][_0x529232('0x23')](_0x4131f8)['then'](function(){const _0x20581d=_0x529232;logger[_0x20581d('0x3')]('[%s][DIALOGFLOW]\x20%s',_0x4f9d0d,_0x4131f8[_0x20581d('0x1d')]);})[_0x529232('0x20')](function(_0x349148){const _0x408007=_0x529232;logger[_0x408007('0x2c')](_0x408007('0x11'),_0x4f9d0d,JSON[_0x408007('0x8')](_0x349148));})[_0x529232('0x2a')](function(){const _0x53451f=_0x529232;logger['info'](_0x53451f('0x7'),_0x4f9d0d),_0x391e9d[_0x53451f('0x10')]();});else logger['info'](_0x529232('0x1c'),_0x4f9d0d),_0x391e9d[_0x529232('0x10')]();}else{const _0x2b41ab=this,_0x54f071=apiai(_0x38d30e[0x0],{'language':_0x38d30e[0x1]||'en'});return _0x54f071['textRequest'](this[_0x529232('0x21')][_0x529232('0x1d')],{'sessionId':md5(this[_0x529232('0x17')]['id'])})[_0x529232('0x12')](function(_0x3fbe18){const _0x384b80=_0x529232;return _0x2b41ab[_0x384b80('0x1d')]['dialogflow']=_0x3fbe18,_0x4131f8[_0x384b80('0x1d')]=_0x3fbe18[_0x384b80('0x9')][_0x384b80('0xf')][_0x384b80('0x22')],rpc[_0x1f9f0c+_0x384b80('0x27')]['create'](_0x4131f8)[_0x384b80('0x12')](function(){const _0x5b1cd9=_0x384b80;logger[_0x5b1cd9('0x3')](_0x5b1cd9('0x11'),_0x4f9d0d,_0x4131f8[_0x5b1cd9('0x1d')]),_0x3fbe18[_0x5b1cd9('0x9')][_0x5b1cd9('0x16')][_0x5b1cd9('0xa')]?_0x391e9d['next']():_0x391e9d['stop']();})[_0x384b80('0x20')](function(_0x52843d){const _0x52ebc9=_0x384b80;logger[_0x52ebc9('0x2c')]('[%s][DIALOGFLOW]\x20%s',_0x4f9d0d,JSON[_0x52ebc9('0x8')](_0x52843d)),_0x391e9d['next']();});})[_0x529232('0x20')](function(_0x3e6cc9){const _0x19aa33=_0x529232;logger[_0x19aa33('0x2c')](_0x19aa33('0x11'),_0x4f9d0d,_0x3e6cc9['message']),_0x391e9d[_0x19aa33('0x1a')]();});}}catch(_0x163768){logger[_0x529232('0x2c')](_0x529232('0x11'),_0x4f9d0d,JSON[_0x529232('0x8')](_0x163768)),_0x391e9d[_0x529232('0x10')]();}};};
\ No newline at end of file