Built motion from commit (unavailable).|2.3.6
[motion2.git] / server / services / routing / server / applications / amazonlex.js
index df4af66..ba76586 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbafa=['contact','format','out','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','then','info','catch','error','stringify','[%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','postText','Message','dialogState','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','isNil','interaction','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next'];(function(_0x39e2af,_0x3d4baf){var _0x4ce86d=function(_0x3b8b55){while(--_0x3b8b55){_0x39e2af['push'](_0x39e2af['shift']());}};_0x4ce86d(++_0x3d4baf);}(_0xbafa,0x92));var _0xabaf=function(_0x49fdaf,_0x37104a){_0x49fdaf=_0x49fdaf-0x0;var _0x228bc9=_0xbafa[_0x49fdaf];return _0x228bc9;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xabaf('0x0'));var logger=require(_0xabaf('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xabaf('0x2')),'mailMessage':require(_0xabaf('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xabaf('0x4'))};exports['consequence']=function(_0x5a1814,_0x16e734){return function(_0x205bd6){try{if(!_[_0xabaf('0x5')](this[_0xabaf('0x6')]['UserId'])){logger['info'](_0xabaf('0x7'),_0x5a1814,_0xabaf('0x8'));return _0x205bd6[_0xabaf('0x9')]();}var _0x51c043={'ContactId':this[_0xabaf('0xa')]['id'],'sentAt':moment()[_0xabaf('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xabaf('0xc')};var _0x2eecc2=this[_0xabaf('0xd')];if(_0x2eecc2===_0xabaf('0xe')){_0x51c043[_0xabaf('0xf')]=this[_0xabaf('0x10')]['id'];}else{_0x51c043[_[_0xabaf('0x11')](_0x2eecc2)+_0xabaf('0x12')]=this[_0xabaf('0x10')]['id'];}_0x51c043[_[_0xabaf('0x11')](_0x2eecc2)+_0xabaf('0x13')]=this[_0xabaf('0x6')]['id'];if(this[_0xabaf('0x6')][_0xabaf('0x14')]){var _0x302a11=_0x16e734[0x4];if(!_[_0xabaf('0x15')](_0x302a11)){_0x51c043[_0xabaf('0x16')]=utils[_0xabaf('0x17')](_0x302a11,this);return rpc[_0x2eecc2+'Message'][_0xabaf('0x18')](_0x51c043)[_0xabaf('0x19')](function(_0x22ed8c){logger[_0xabaf('0x1a')](_0xabaf('0x7'),_0x5a1814,_0x51c043['body']);})[_0xabaf('0x1b')](function(_0x296ccb){logger[_0xabaf('0x1c')](_0xabaf('0x7'),_0x5a1814,JSON[_0xabaf('0x1d')](_0x296ccb));})['finally'](function(){logger[_0xabaf('0x1a')](_0xabaf('0x1e'),_0x5a1814);_0x205bd6[_0xabaf('0x1f')]();});}else{logger[_0xabaf('0x1a')](_0xabaf('0x20'),_0x5a1814);_0x205bd6[_0xabaf('0x1f')]();}}else{var _0x5d0e13=this;var _0x3755c7=new AWS[(_0xabaf('0x21'))]({'accessKeyId':_0x16e734[0x0],'secretAccessKey':_0x16e734[0x1],'region':_0x16e734[0x2]});var _0x21c0d9={'botAlias':_0xabaf('0x22'),'botName':_0x16e734[0x3],'inputText':this[_0xabaf('0x23')][_0xabaf('0x16')],'userId':this[_0xabaf('0x6')]['id']['toString']()};_0x3755c7[_0xabaf('0x24')](_0x21c0d9,function(_0x48dd6a,_0x41131d){if(_0x48dd6a){logger[_0xabaf('0x1c')](_0xabaf('0x7'),_0x5a1814,_0x48dd6a[_0xabaf('0x23')]);_0x205bd6[_0xabaf('0x9')]();}else if(_0x41131d&&_0x41131d[_0xabaf('0x23')]){_0x5d0e13[_0xabaf('0x16')]['amazonlex']=_0x41131d;_0x51c043[_0xabaf('0x16')]=_0x41131d['message'];return rpc[_0x2eecc2+_0xabaf('0x25')][_0xabaf('0x18')](_0x51c043)[_0xabaf('0x19')](function(_0x166abb){logger[_0xabaf('0x1a')]('[%s][AMAZONLEX]\x20%s',_0x5a1814,_0x51c043['body']);if(_0x41131d[_0xabaf('0x26')]=='Failed'){_0x205bd6[_0xabaf('0x9')]();}else{_0x205bd6[_0xabaf('0x1f')]();}})['catch'](function(_0x3bf15f){logger['error']('[%s][AMAZONLEX]\x20%s',_0x5a1814,JSON[_0xabaf('0x1d')](_0x3bf15f));_0x205bd6[_0xabaf('0x9')]();});}else{_0x205bd6[_0xabaf('0x9')]();}});}}catch(_0x37d9b2){logger['error'](_0xabaf('0x7'),_0x5a1814,JSON['stringify'](_0x37d9b2));_0x205bd6[_0xabaf('0x1f')]();}};};
\ No newline at end of file
+var _0x0cdf=['message','dialogState','Failed','error','lodash','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','catch','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x0cdf,0x190));var _0xf0cd=function(_0x78699f,_0x9b5e13){_0x78699f=_0x78699f-0x0;var _0x26bfc7=_0x0cdf[_0x78699f];return _0x26bfc7;};'use strict';var _=require(_0xf0cd('0x0'));var moment=require('moment');var AWS=require(_0xf0cd('0x1'));var utils=require(_0xf0cd('0x2'));var logger=require(_0xf0cd('0x3'))('routing');var rpc={'chatMessage':require(_0xf0cd('0x4')),'openchannelMessage':require(_0xf0cd('0x5')),'mailMessage':require(_0xf0cd('0x6')),'smsMessage':require(_0xf0cd('0x7')),'faxMessage':require(_0xf0cd('0x8'))};exports[_0xf0cd('0x9')]=function(_0x4447ff,_0x4eb7eb){return function(_0x36e6c9){try{if(!_[_0xf0cd('0xa')](this[_0xf0cd('0xb')]['UserId'])){logger[_0xf0cd('0xc')](_0xf0cd('0xd'),_0x4447ff,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x36e6c9[_0xf0cd('0xe')]();}var _0x1e98a4={'ContactId':this[_0xf0cd('0xf')]['id'],'sentAt':moment()[_0xf0cd('0x10')](_0xf0cd('0x11')),'direction':'out'};var _0x3fa965=this[_0xf0cd('0x12')];if(_0x3fa965===_0xf0cd('0x13')){_0x1e98a4[_0xf0cd('0x14')]=this[_0xf0cd('0x15')]['id'];}else{_0x1e98a4[_[_0xf0cd('0x16')](_0x3fa965)+_0xf0cd('0x17')]=this[_0xf0cd('0x15')]['id'];}_0x1e98a4[_['upperFirst'](_0x3fa965)+_0xf0cd('0x18')]=this[_0xf0cd('0xb')]['id'];if(this[_0xf0cd('0xb')][_0xf0cd('0x19')]){var _0x10413a=_0x4eb7eb[0x4];if(!_[_0xf0cd('0x1a')](_0x10413a)){_0x1e98a4[_0xf0cd('0x1b')]=utils[_0xf0cd('0x1c')](_0x10413a,this);return rpc[_0x3fa965+_0xf0cd('0x1d')]['create'](_0x1e98a4)[_0xf0cd('0x1e')](function(_0x59631d){logger['info'](_0xf0cd('0xd'),_0x4447ff,_0x1e98a4[_0xf0cd('0x1b')]);})[_0xf0cd('0x1f')](function(_0x2a17ed){logger['error']('[%s][AMAZONLEX]\x20%s',_0x4447ff,JSON[_0xf0cd('0x20')](_0x2a17ed));})[_0xf0cd('0x21')](function(){logger[_0xf0cd('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4447ff);_0x36e6c9[_0xf0cd('0x22')]();});}else{logger[_0xf0cd('0xc')](_0xf0cd('0x23'),_0x4447ff);_0x36e6c9[_0xf0cd('0x22')]();}}else{var _0x45112f=this;var _0x10be2a=new AWS[(_0xf0cd('0x24'))]({'accessKeyId':_0x4eb7eb[0x0],'secretAccessKey':_0x4eb7eb[0x1],'region':_0x4eb7eb[0x2]});var _0x3f7bdc={'botAlias':_0xf0cd('0x25'),'botName':_0x4eb7eb[0x3],'inputText':this['message'][_0xf0cd('0x1b')],'userId':this[_0xf0cd('0xb')]['id'][_0xf0cd('0x26')]()};_0x10be2a[_0xf0cd('0x27')](_0x3f7bdc,function(_0x3e9eef,_0x5f7917){if(_0x3e9eef){logger['error'](_0xf0cd('0xd'),_0x4447ff,_0x3e9eef['message']);_0x36e6c9['next']();}else if(_0x5f7917&&_0x5f7917[_0xf0cd('0x28')]){_0x45112f['body']['amazonlex']=_0x5f7917;_0x1e98a4['body']=_0x5f7917[_0xf0cd('0x28')];return rpc[_0x3fa965+_0xf0cd('0x1d')]['create'](_0x1e98a4)[_0xf0cd('0x1e')](function(_0xfd775a){logger['info'](_0xf0cd('0xd'),_0x4447ff,_0x1e98a4[_0xf0cd('0x1b')]);if(_0x5f7917[_0xf0cd('0x29')]==_0xf0cd('0x2a')){_0x36e6c9['next']();}else{_0x36e6c9['stop']();}})['catch'](function(_0xcddd68){logger[_0xf0cd('0x2b')](_0xf0cd('0xd'),_0x4447ff,JSON[_0xf0cd('0x20')](_0xcddd68));_0x36e6c9['next']();});}else{_0x36e6c9['next']();}});}}catch(_0x5a525c){logger[_0xf0cd('0x2b')](_0xf0cd('0xd'),_0x4447ff,JSON['stringify'](_0x5a525c));_0x36e6c9[_0xf0cd('0x22')]();}};};
\ No newline at end of file