Built motion from commit (unavailable).|2.5.23
[motion2.git] / server / services / routing / server / applications / amazonlex.js
index 7b6f54c..46cd669 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfc31=['sms','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerResponse','Message','Failed','lodash','moment','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel'];(function(_0x476569,_0x2ddde9){var _0x18a991=function(_0x269525){while(--_0x269525){_0x476569['push'](_0x476569['shift']());}};_0x18a991(++_0x2ddde9);}(_0xfc31,0xb4));var _0x1fc3=function(_0x3319da,_0x4de71b){_0x3319da=_0x3319da-0x0;var _0x3d42fa=_0xfc31[_0x3319da];return _0x3d42fa;};'use strict';var _=require(_0x1fc3('0x0'));var moment=require(_0x1fc3('0x1'));var AWS=require(_0x1fc3('0x2'));var utils=require('./utils');var logger=require(_0x1fc3('0x3'))('routing');var rpc={'chatMessage':require(_0x1fc3('0x4')),'openchannelMessage':require(_0x1fc3('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1fc3('0x6')),'faxMessage':require(_0x1fc3('0x7')),'whatsappMessage':require(_0x1fc3('0x8'))};exports['consequence']=function(_0x2b4468,_0x26047c){return function(_0x83c550){try{if(!_[_0x1fc3('0x9')](this[_0x1fc3('0xa')][_0x1fc3('0xb')])){logger[_0x1fc3('0xc')](_0x1fc3('0xd'),_0x2b4468,_0x1fc3('0xe'));return _0x83c550[_0x1fc3('0xf')]();}var _0x45a86b={'ContactId':this[_0x1fc3('0x10')]['id'],'sentAt':moment()[_0x1fc3('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x1fc3('0x12')};if(this[_0x1fc3('0x13')]===_0x1fc3('0x14')||this['channel']===_0x1fc3('0x15')){_0x45a86b[_0x1fc3('0x16')]=this['interaction']['phone'];}var _0x18708d=this[_0x1fc3('0x13')];if(_0x18708d===_0x1fc3('0x17')){_0x45a86b['ChatWebsiteId']=this[_0x1fc3('0x18')]['id'];}else{_0x45a86b[_[_0x1fc3('0x19')](_0x18708d)+_0x1fc3('0x1a')]=this['account']['id'];}_0x45a86b[_[_0x1fc3('0x19')](_0x18708d)+_0x1fc3('0x1b')]=this[_0x1fc3('0xa')]['id'];if(this[_0x1fc3('0xa')][_0x1fc3('0x1c')]){var _0x4d364c=_0x26047c[0x4];if(!_[_0x1fc3('0x1d')](_0x4d364c)){_0x45a86b[_0x1fc3('0x1e')]=utils[_0x1fc3('0x1f')](_0x4d364c,this);return rpc[_0x18708d+'Message'][_0x1fc3('0x20')](_0x45a86b)[_0x1fc3('0x21')](function(_0x34759c){logger['info'](_0x1fc3('0xd'),_0x2b4468,_0x45a86b['body']);})[_0x1fc3('0x22')](function(_0x57a195){logger[_0x1fc3('0x23')](_0x1fc3('0xd'),_0x2b4468,JSON[_0x1fc3('0x24')](_0x57a195));})[_0x1fc3('0x25')](function(){logger[_0x1fc3('0xc')](_0x1fc3('0x26'),_0x2b4468);_0x83c550[_0x1fc3('0x27')]();});}else{logger[_0x1fc3('0xc')](_0x1fc3('0x28'),_0x2b4468);_0x83c550[_0x1fc3('0x27')]();}}else{var _0x822b1d=this;var _0x12e849=new AWS[(_0x1fc3('0x29'))]({'accessKeyId':_0x26047c[0x0],'secretAccessKey':_0x26047c[0x1],'region':_0x26047c[0x2]});var _0xa426d2={'botAlias':_0x1fc3('0x2a'),'botName':_0x26047c[0x3],'inputText':this[_0x1fc3('0x2b')]['body'],'userId':this[_0x1fc3('0x13')]+':'+this['interaction']['id'][_0x1fc3('0x2c')]()};_0x12e849[_0x1fc3('0x2d')](_0xa426d2,function(_0x390efb,_0x581fd8){if(_0x390efb){logger['error'](_0x1fc3('0xd'),_0x2b4468,_0x390efb[_0x1fc3('0x2b')]);_0x83c550[_0x1fc3('0xf')]();}else if(_0x581fd8&&_0x581fd8[_0x1fc3('0x2b')]){_0x822b1d[_0x1fc3('0x1e')][_0x1fc3('0x2e')]=_0x581fd8;_0x45a86b[_0x1fc3('0x1e')]=_0x581fd8[_0x1fc3('0x2b')];_0x45a86b['providerName']=_0x1fc3('0x2e');_0x45a86b[_0x1fc3('0x2f')]=JSON[_0x1fc3('0x24')](_0x581fd8);return rpc[_0x18708d+_0x1fc3('0x30')][_0x1fc3('0x20')](_0x45a86b)[_0x1fc3('0x21')](function(_0x11899e){logger[_0x1fc3('0xc')](_0x1fc3('0xd'),_0x2b4468,_0x45a86b[_0x1fc3('0x1e')]);if(_0x581fd8['dialogState']==_0x1fc3('0x31')){_0x83c550[_0x1fc3('0xf')]();}else{_0x83c550['stop']();}})[_0x1fc3('0x22')](function(_0x26f51d){logger[_0x1fc3('0x23')](_0x1fc3('0xd'),_0x2b4468,JSON[_0x1fc3('0x24')](_0x26f51d));_0x83c550['next']();});}else{_0x83c550[_0x1fc3('0xf')]();}});}}catch(_0x48b6f7){logger[_0x1fc3('0x23')](_0x1fc3('0xd'),_0x2b4468,JSON[_0x1fc3('0x24')](_0x48b6f7));_0x83c550['stop']();}};};
\ No newline at end of file
+var _0x92f2=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','$LATEST','message','amazonlex','providerName','providerResponse','dialogState','lodash','moment','./utils'];(function(_0x1bfec1,_0x42c113){var _0x2a330b=function(_0x43a270){while(--_0x43a270){_0x1bfec1['push'](_0x1bfec1['shift']());}};_0x2a330b(++_0x42c113);}(_0x92f2,0x1ad));var _0x292f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x92f2[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x292f('0x0'));var moment=require(_0x292f('0x1'));var AWS=require('aws-sdk');var utils=require(_0x292f('0x2'));var logger=require(_0x292f('0x3'))(_0x292f('0x4'));var rpc={'chatMessage':require(_0x292f('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x292f('0x6')),'faxMessage':require(_0x292f('0x7')),'whatsappMessage':require(_0x292f('0x8'))};exports['consequence']=function(_0x36ca74,_0x3ca6a2){return function(_0x3fa88b){try{if(!_[_0x292f('0x9')](this[_0x292f('0xa')][_0x292f('0xb')])){logger['info'](_0x292f('0xc'),_0x36ca74,_0x292f('0xd'));return _0x3fa88b[_0x292f('0xe')]();}var _0x5b9696={'ContactId':this['contact']['id'],'sentAt':moment()[_0x292f('0xf')](_0x292f('0x10')),'direction':_0x292f('0x11')};if(this[_0x292f('0x12')]===_0x292f('0x13')||this[_0x292f('0x12')]===_0x292f('0x14')){_0x5b9696[_0x292f('0x15')]=this[_0x292f('0xa')]['phone'];}var _0x241db5=this[_0x292f('0x12')];if(_0x241db5===_0x292f('0x16')){_0x5b9696[_0x292f('0x17')]=this[_0x292f('0x18')]['id'];}else{_0x5b9696[_[_0x292f('0x19')](_0x241db5)+_0x292f('0x1a')]=this[_0x292f('0x18')]['id'];}_0x5b9696[_[_0x292f('0x19')](_0x241db5)+_0x292f('0x1b')]=this[_0x292f('0xa')]['id'];if(this['interaction'][_0x292f('0x1c')]){var _0x2db582=_0x3ca6a2[0x4];if(!_[_0x292f('0x1d')](_0x2db582)){_0x5b9696[_0x292f('0x1e')]=utils[_0x292f('0x1f')](_0x2db582,this);return rpc[_0x241db5+_0x292f('0x20')][_0x292f('0x21')](_0x5b9696)[_0x292f('0x22')](function(_0x32c3ad){logger['info'](_0x292f('0xc'),_0x36ca74,_0x5b9696[_0x292f('0x1e')]);})[_0x292f('0x23')](function(_0x358317){logger[_0x292f('0x24')](_0x292f('0xc'),_0x36ca74,JSON[_0x292f('0x25')](_0x358317));})['finally'](function(){logger[_0x292f('0x26')](_0x292f('0x27'),_0x36ca74);_0x3fa88b['stop']();});}else{logger[_0x292f('0x26')](_0x292f('0x28'),_0x36ca74);_0x3fa88b[_0x292f('0x29')]();}}else{var _0x1cbfdf=this;var _0xa96c7d=new AWS['LexRuntime']({'accessKeyId':_0x3ca6a2[0x0],'secretAccessKey':_0x3ca6a2[0x1],'region':_0x3ca6a2[0x2]});var _0x17e554={'botAlias':_0x292f('0x2a'),'botName':_0x3ca6a2[0x3],'inputText':this[_0x292f('0x2b')][_0x292f('0x1e')],'userId':this[_0x292f('0x12')]+':'+this[_0x292f('0xa')]['id']['toString']()};_0xa96c7d['postText'](_0x17e554,function(_0x463812,_0x1ba272){if(_0x463812){logger['error']('[%s][AMAZONLEX]\x20%s',_0x36ca74,_0x463812[_0x292f('0x2b')]);_0x3fa88b[_0x292f('0xe')]();}else if(_0x1ba272&&_0x1ba272[_0x292f('0x2b')]){_0x1cbfdf[_0x292f('0x1e')][_0x292f('0x2c')]=_0x1ba272;_0x5b9696[_0x292f('0x1e')]=_0x1ba272[_0x292f('0x2b')];_0x5b9696[_0x292f('0x2d')]=_0x292f('0x2c');_0x5b9696[_0x292f('0x2e')]=JSON[_0x292f('0x25')](_0x1ba272);return rpc[_0x241db5+_0x292f('0x20')][_0x292f('0x21')](_0x5b9696)[_0x292f('0x22')](function(_0x731eb4){logger[_0x292f('0x26')](_0x292f('0xc'),_0x36ca74,_0x5b9696[_0x292f('0x1e')]);if(_0x1ba272[_0x292f('0x2f')]=='Failed'){_0x3fa88b[_0x292f('0xe')]();}else{_0x3fa88b[_0x292f('0x29')]();}})[_0x292f('0x23')](function(_0x1b4fb3){logger[_0x292f('0x24')](_0x292f('0xc'),_0x36ca74,JSON['stringify'](_0x1b4fb3));_0x3fa88b['next']();});}else{_0x3fa88b['next']();}});}}catch(_0x41e9a7){logger[_0x292f('0x24')](_0x292f('0xc'),_0x36ca74,JSON[_0x292f('0x25')](_0x41e9a7));_0x3fa88b[_0x292f('0x29')]();}};};
\ No newline at end of file