Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / services / ami / trigger / integration / salesforce.js
index feaf89b..04fe689 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc513=['content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','securityToken','Connection','clientSecret','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','IsRecurrence','endUserType','lead','WhoId','account','Case','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','User','find','execute','then','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','user_id','moduleSearch','contact_lead','additionalSearchContact','$or','length','cloneDeep','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','contact','first','Name','Phone','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','<unknown>','Caller\x20-\x20%s','format','Company','No\x20Company','forEach','includes','picklist','idField'];(function(_0x33628a,_0x2df134){var _0x25d370=function(_0x5567fc){while(--_0x5567fc){_0x33628a['push'](_0x33628a['shift']());}};_0x25d370(++_0x2df134);}(_0xc513,0x12a));var _0x3c51=function(_0x3c1229,_0x7e25a4){_0x3c1229=_0x3c1229-0x0;var _0x5e0dfd=_0xc513[_0x3c1229];return _0x5e0dfd;};'use strict';var _=require(_0x3c51('0x0'));var rp=require(_0x3c51('0x1'));var moment=require(_0x3c51('0x2'));var BPromise=require(_0x3c51('0x3'));var md5=require('md5');var jsforce=require(_0x3c51('0x4'));var util=require(_0x3c51('0x5'));var Redis=require(_0x3c51('0x6'));var intUtil=require(_0x3c51('0x7'));var config=require(_0x3c51('0x8'));var logger=require(_0x3c51('0x9'))(_0x3c51('0xa'));config[_0x3c51('0xb')]=_['defaults'](config[_0x3c51('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x3c51('0xc'))(new Redis(config['redis']));function emit(_0x4a7670,_0x8e07,_0x550945){io['to'](_0x4a7670)['emit'](_0x8e07,_0x550945);}function getTicket(_0x3edc25,_0x1105d2,_0x527046,_0x30203f,_0x374a49,_0x2bd945,_0x25e2ae,_0x17cfa0){var _0x1ad7d9=Object[_0x3c51('0xd')]({},{'OwnerId':_0x1105d2['id'],'Subject':intUtil[_0x3c51('0xe')](_0x30203f[_0x3c51('0xf')],_0x374a49,'\x20'),'Description':intUtil[_0x3c51('0xe')](_0x30203f[_0x3c51('0x10')],_0x374a49,'\x0a')},getCustomFields(_0x2bd945,_0x374a49));if(_0x527046){if(_0x30203f[_0x3c51('0x11')]===_0x3c51('0x12')){_0x1ad7d9[_0x3c51('0x13')]=moment['utc']();_0x1ad7d9['IsReminderSet']=![];_0x1ad7d9[_0x3c51('0x14')]=![];if(_0x527046[_0x3c51('0x15')]==='contact'||_0x527046['endUserType']===_0x3c51('0x16')){_0x1ad7d9[_0x3c51('0x17')]=_0x527046['id'];}else if(_0x527046[_0x3c51('0x15')]===_0x3c51('0x18')){_0x1ad7d9['WhatId']=_0x527046['id'];}}else if(_0x30203f['ticketType']===_0x3c51('0x19')){if(_0x527046[_0x3c51('0x15')]==='contact'){_0x1ad7d9[_0x3c51('0x1a')]=_0x527046['id'];}else if(_0x527046[_0x3c51('0x15')]===_0x3c51('0x18')){_0x1ad7d9['AccountId']=_0x527046['id'];}else if(_0x527046[_0x3c51('0x15')]===_0x3c51('0x16')&&_0x30203f[_0x3c51('0x1b')]){_0x1ad7d9[_0x30203f[_0x3c51('0x1b')]]=_0x527046['id'];}else{logger[_0x3c51('0x1c')](_0x3c51('0x1d'));}}}return _0x25e2ae[_0x3c51('0x1e')](_0x30203f[_0x3c51('0x11')])[_0x3c51('0x1f')](_0x1ad7d9);}function getUser(_0x397f71,_0x3f38f7,_0x2d81e2){if(!_['isNil'](_0x3f38f7)&&intUtil['validateEmail'](_0x3f38f7)){var _0x5645d={'Email':_0x3f38f7};var _0x26eb50={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2d81e2[_0x3c51('0x1e')](_0x3c51('0x20'))[_0x3c51('0x21')](_0x5645d,_0x26eb50)[_0x3c51('0x22')]()[_0x3c51('0x23')](function(_0x37e6f4){if(_0x37e6f4['length']){var _0x33f8a7=_['find'](_0x37e6f4,function(_0xf197f1){return _0xf197f1[_0x3c51('0x24')]===_0x3f38f7;});if(_0x33f8a7){logger[_0x3c51('0x1c')](_0x3c51('0x25'),_0x3f38f7);return BPromise[_0x3c51('0x26')]({'id':_0x33f8a7['Id'],'name':_0x33f8a7['Name']});}}else{logger[_0x3c51('0x1c')](_0x3c51('0x27'),_0x3f38f7);return _0x2d81e2['identity']()['then'](function(_0x540ec3){return BPromise[_0x3c51('0x26')]({'id':_0x540ec3['user_id'],'name':_0x540ec3[_0x3c51('0x28')]});});}});}else{logger[_0x3c51('0x1c')](_0x3c51('0x27'),_0x3f38f7);return _0x2d81e2['identity']()[_0x3c51('0x23')](function(_0x118a2c){return BPromise['resolve']({'id':_0x118a2c[_0x3c51('0x29')],'name':_0x118a2c[_0x3c51('0x28')]});});}}function getEndUser(_0x4dde3a,_0x2733a8,_0x4ba723,_0x4987d3,_0x4b28d4){var _0x345b1d={'$or':{'Phone':_0x4987d3}};var _0x5ea5f0={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3c51('0x26')]()[_0x3c51('0x23')](function(){logger[_0x3c51('0x1c')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x4987d3,_0x2733a8[_0x3c51('0x2a')]);switch(_0x2733a8[_0x3c51('0x2a')]){case _0x3c51('0x2b'):var _0x3971e2=_['cloneDeep'](_0x345b1d);if(_0x2733a8[_0x3c51('0x2c')]){var _0x31de5d={};_0x31de5d[_0x2733a8['additionalSearchContact']]=_0x4987d3;_['merge'](_0x3971e2[_0x3c51('0x2d')],_0x31de5d);}return _0x4b28d4[_0x3c51('0x1e')]('Contact')[_0x3c51('0x21')](_0x3971e2,_0x5ea5f0)[_0x3c51('0x22')]()[_0x3c51('0x23')](function(_0x53b39c){if(_0x53b39c&&_0x53b39c[_0x3c51('0x2e')]){return _0x53b39c;}else{var _0x257c17=_[_0x3c51('0x2f')](_0x345b1d);if(_0x2733a8['additionalSearchLead']){var _0x45bdf5={};_0x45bdf5[_0x2733a8[_0x3c51('0x30')]]=_0x4987d3;_[_0x3c51('0x31')](_0x257c17[_0x3c51('0x2d')],_0x45bdf5);}return _0x4b28d4['sobject'](_0x3c51('0x32'))['find'](_0x257c17,_0x5ea5f0);}});case _0x3c51('0x33'):var _0x13ec99=_[_0x3c51('0x2f')](_0x345b1d);if(_0x2733a8[_0x3c51('0x34')]){var _0x31de5d={};_0x31de5d[_0x2733a8[_0x3c51('0x34')]]=_0x4987d3;_['merge'](_0x13ec99[_0x3c51('0x2d')],_0x31de5d);}return _0x4b28d4[_0x3c51('0x1e')](_0x3c51('0x35'))[_0x3c51('0x21')](_0x13ec99,_0x5ea5f0)[_0x3c51('0x22')]()[_0x3c51('0x23')](function(_0xbe6927){if(_0xbe6927&&_0xbe6927[_0x3c51('0x2e')]){return _0xbe6927;}else{var _0x3daf26=_[_0x3c51('0x2f')](_0x345b1d);if(_0x2733a8[_0x3c51('0x2c')]){var _0x769216={};_0x769216[_0x2733a8[_0x3c51('0x2c')]]=_0x4987d3;_[_0x3c51('0x31')](_0x3daf26[_0x3c51('0x2d')],_0x769216);}return _0x4b28d4[_0x3c51('0x1e')](_0x3c51('0x36'))[_0x3c51('0x21')](_0x3daf26,_0x5ea5f0)[_0x3c51('0x23')](function(_0x53b744){if(_0x53b744&&_0x53b744[_0x3c51('0x2e')]){return _0x53b744;}else{var _0xc38021=_[_0x3c51('0x2f')](_0x345b1d);if(_0x2733a8[_0x3c51('0x30')]){var _0x5f416b={};_0x5f416b[_0x2733a8[_0x3c51('0x30')]]=_0x4987d3;_['merge'](_0xc38021[_0x3c51('0x2d')],_0x5f416b);}return _0x4b28d4['sobject'](_0x3c51('0x32'))['find'](_0xc38021,_0x5ea5f0);}});}});case _0x3c51('0x37'):var _0x3971e2=_['cloneDeep'](_0x345b1d);if(_0x2733a8[_0x3c51('0x2c')]){var _0x31de5d={};_0x31de5d[_0x2733a8[_0x3c51('0x2c')]]=_0x4987d3;_[_0x3c51('0x31')](_0x3971e2[_0x3c51('0x2d')],_0x31de5d);}return _0x4b28d4[_0x3c51('0x1e')](_0x3c51('0x36'))[_0x3c51('0x21')](_0x3971e2,_0x5ea5f0)[_0x3c51('0x22')]();case _0x3c51('0x16'):var _0x552618=_[_0x3c51('0x2f')](_0x345b1d);if(_0x2733a8[_0x3c51('0x30')]){var _0x31de5d={};_0x31de5d[_0x2733a8[_0x3c51('0x30')]]=_0x4987d3;_[_0x3c51('0x31')](_0x552618[_0x3c51('0x2d')],_0x31de5d);}return _0x4b28d4['sobject'](_0x3c51('0x32'))['find'](_0x552618,_0x5ea5f0);case _0x3c51('0x18'):var _0x13ec99=_[_0x3c51('0x2f')](_0x345b1d);if(_0x2733a8['additionalSearchAccount']){var _0x31de5d={};_0x31de5d[_0x2733a8[_0x3c51('0x34')]]=_0x4987d3;_['merge'](_0x13ec99[_0x3c51('0x2d')],_0x31de5d);}return _0x4b28d4['sobject'](_0x3c51('0x35'))['find'](_0x13ec99,_0x5ea5f0);default:return null;}})[_0x3c51('0x23')](function(_0x14e8f8){if(_0x14e8f8&&_0x14e8f8[_0x3c51('0x2e')]){var _0x47bc8d=_[_0x3c51('0x38')](_0x14e8f8);if(_0x47bc8d){return BPromise[_0x3c51('0x26')]({'id':_0x47bc8d['Id'],'name':_0x47bc8d[_0x3c51('0x39')],'phone':_0x47bc8d[_0x3c51('0x3a')],'endUserType':_0x47bc8d['attributes'][_0x3c51('0x3b')]['toLowerCase']()});}}})[_0x3c51('0x23')](function(_0xd4b099){if(_0xd4b099){logger['info'](_0x3c51('0x3c'),_0xd4b099[_0x3c51('0x15')],_0x4987d3);return BPromise[_0x3c51('0x26')](_0xd4b099);}else{logger[_0x3c51('0x1c')](_0x3c51('0x3d'),_0x4987d3);var _0x2cb5f6={'Phone':_0x4987d3};if(_0x2733a8[_0x3c51('0x3e')]){if(_0x2733a8['moduleCreate']==='contact'){logger[_0x3c51('0x1c')](_0x3c51('0x3f'),_0x4987d3,_0x2733a8['moduleCreate']);_0x2cb5f6[_0x3c51('0x40')]=_0x4ba723!==_0x3c51('0x41')?_0x4ba723:util['format'](_0x3c51('0x42'),_0x4987d3);}else if(_0x2733a8[_0x3c51('0x3e')]===_0x3c51('0x16')){logger[_0x3c51('0x1c')](_0x3c51('0x3f'),_0x4987d3,_0x2733a8[_0x3c51('0x3e')]);_0x2cb5f6[_0x3c51('0x40')]=_0x4ba723!==_0x3c51('0x41')?_0x4ba723:util[_0x3c51('0x43')](_0x3c51('0x42'),_0x4987d3);_0x2cb5f6[_0x3c51('0x44')]=_0x3c51('0x45');}else if(_0x2733a8['moduleCreate']===_0x3c51('0x18')){logger[_0x3c51('0x1c')](_0x3c51('0x3f'),_0x4987d3,_0x2733a8[_0x3c51('0x3e')]);_0x2cb5f6[_0x3c51('0x39')]=_0x4ba723!=='<unknown>'?_0x4ba723:util['format'](_0x3c51('0x42'),_0x4987d3);}else{return null;}}return _0x4b28d4['sobject'](_['upperFirst'](_0x2733a8['moduleCreate']))[_0x3c51('0x1f')](_0x2cb5f6)[_0x3c51('0x23')](function(_0x49d4d4){return BPromise[_0x3c51('0x26')]({'id':_0x49d4d4['id'],'endUserType':_0x2733a8[_0x3c51('0x3e')]});});}});}function getCustomFields(_0x194093,_0x46b660){var _0x4f998e={};if(_0x194093[_0x3c51('0x2e')]>0x0){_[_0x3c51('0x46')](_0x194093,function(_0x5f0425){if(_[_0x3c51('0x47')](['string',_0x3c51('0x48')],_0x5f0425['type'])&&_0x5f0425[_0x3c51('0x49')]){_0x4f998e[_0x5f0425['idField']]=_0x5f0425[_0x3c51('0x4a')][_0x3c51('0x4b')]();}else if(_0x5f0425[_0x3c51('0x3b')]===_0x3c51('0x4c')&&_0x5f0425[_0x3c51('0x4d')]&&_0x5f0425[_0x3c51('0x49')]){_0x46b660[_0x5f0425['variableName']]&&(_0x4f998e[_0x5f0425[_0x3c51('0x49')]]=_0x46b660[_0x5f0425[_0x3c51('0x4d')]][_0x3c51('0x4b')]());}else if(_0x5f0425[_0x3c51('0x3b')]===_0x3c51('0x4e')&&_0x5f0425[_0x3c51('0x4f')]&&_0x5f0425[_0x3c51('0x4f')][_0x3c51('0x50')]&&_0x5f0425[_0x3c51('0x49')]){_0x46b660[_0x5f0425[_0x3c51('0x4f')][_0x3c51('0x50')][_0x3c51('0x51')]()]&&(_0x4f998e[_0x5f0425[_0x3c51('0x49')]]=_0x46b660[_0x5f0425[_0x3c51('0x4f')]['name'][_0x3c51('0x51')]()][_0x3c51('0x4b')]());}});}return _0x4f998e;}function getConnection(_0x5d52c8){var _0x1d9baa=_0x5d52c8[_0x3c51('0x52')]['concat'](_0x5d52c8[_0x3c51('0x53')]);var _0x13e463=new jsforce[(_0x3c51('0x54'))]({'oauth2':{'loginUrl':_0x5d52c8['remoteUri']||'https://login.salesforce.com','clientId':_0x5d52c8['clientId'],'clientSecret':_0x5d52c8[_0x3c51('0x55')]}});return _0x13e463['login'](_0x5d52c8[_0x3c51('0x56')],_0x1d9baa)['then'](function(){logger[_0x3c51('0x1c')](_0x3c51('0x57'));return _0x13e463;});}exports[_0x3c51('0x58')]=function(_0x57e3f6,_0x133931,_0x502580,_0x234230,_0x3f3605,_0x4c40eb){var _0x5e6823,_0x49f185,_0x41c739,_0x3f26b9;_0x4c40eb['serverUrl']=intUtil[_0x3c51('0x59')](_0x4c40eb[_0x3c51('0x5a')]);_0x4c40eb[_0x3c51('0x5b')]=intUtil['stripTrailingSlash'](_0x4c40eb[_0x3c51('0x5b')]);if(_0x3f3605&&_0x3f3605[_0x3c51('0x5c')]){logger['info'](_0x3c51('0x5d'),_0x3c51('0x5e'));_0x133931[_0x3c51('0x5f')]=util[_0x3c51('0x43')](_0x3c51('0x60'),_0x4c40eb[_0x3c51('0x5a')],_0x133931[_0x3c51('0x61')],md5(_0x133931['uniqueid']));}else{_0x133931['recordingURL']='';}return getConnection(_0x4c40eb)[_0x3c51('0x23')](function(_0x46d58b){_0x3f26b9=_0x46d58b;return getUser(_0x4c40eb,_0x234230[_0x3c51('0x62')],_0x3f26b9);})[_0x3c51('0x23')](function(_0x2491f4){_0x5e6823=_0x2491f4;return getEndUser(_0x4c40eb,_0x502580,_0x133931[_0x3c51('0x63')],_0x133931['calleridnum'],_0x3f26b9);})[_0x3c51('0x23')](function(_0x2433ae){_0x49f185=_0x2433ae;return getTicket(_0x4c40eb,_0x5e6823,_0x49f185,_0x502580,_0x133931,_0x502580[_0x3c51('0x64')],_0x3f26b9,_0x3c51('0x58'));})[_0x3c51('0x23')](function(_0x16691b){_0x41c739=_0x16691b;logger[_0x3c51('0x1c')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x41c739['id']);logger[_0x3c51('0x1c')](_0x3c51('0x65'),_0x41c739['id'],_0x234230[_0x3c51('0x50')],_0x4c40eb[_0x3c51('0x3b')]);switch(_0x4c40eb['type']){case _0x3c51('0x66'):emit(util[_0x3c51('0x43')](_0x3c51('0x67'),_0x234230[_0x3c51('0x50')]),'trigger:salesforce:display',{'recordId':_0x41c739['id']});break;case _0x3c51('0x68'):emit(util[_0x3c51('0x43')](_0x3c51('0x67'),_0x234230['name']),_0x3c51('0x69'),{'uri':util[_0x3c51('0x43')](_0x3c51('0x6a'),_0x3f26b9[_0x3c51('0x6b')],_0x41c739['id'])});break;default:logger[_0x3c51('0x6c')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x3c51('0x6d')](function(_0x1138f9){logger['error'](_0x3c51('0x5d'),_0x1138f9);});};exports[_0x3c51('0x6e')]=function(_0x11ac1e,_0x9d257a,_0x574b06,_0xe7dab2,_0x5be811,_0x480bdf,_0x4fce20){var _0x5c5dff,_0x40a8a3,_0x2e3a4b,_0x1c9189;_0x480bdf['serverUrl']=intUtil['stripTrailingSlash'](_0x480bdf[_0x3c51('0x5a')]);_0x480bdf[_0x3c51('0x5b')]=intUtil[_0x3c51('0x59')](_0x480bdf[_0x3c51('0x5b')]);if(_0x4fce20&&_0x4fce20[_0x3c51('0x6f')]&&_0x4fce20['recordingFormat']!==_0x3c51('0x70')){logger['info'](_0x3c51('0x71'),_0x3c51('0x5e'));_0x9d257a[_0x3c51('0x5f')]=util[_0x3c51('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x480bdf['serverUrl'],_0x9d257a[_0x3c51('0x61')],md5(_0x9d257a['uniqueid']));}return getConnection(_0x480bdf)[_0x3c51('0x23')](function(_0x4a04eb){_0x1c9189=_0x4a04eb;return getUser(_0x480bdf,_0xe7dab2[_0x3c51('0x62')],_0x1c9189);})[_0x3c51('0x23')](function(_0x2511d5){_0x5c5dff=_0x2511d5;return getEndUser(_0x480bdf,_0x574b06,_0x9d257a['destcalleridname'],_0x9d257a[_0x3c51('0x72')],_0x1c9189);})['then'](function(_0x5d5292){_0x40a8a3=_0x5d5292;return getTicket(_0x480bdf,_0x5c5dff,_0x40a8a3,_0x574b06,_0x9d257a,_0x574b06[_0x3c51('0x64')],_0x1c9189,_0x3c51('0x6e'));})[_0x3c51('0x23')](function(_0x5974f1){_0x2e3a4b=_0x5974f1;logger['info'](_0x3c51('0x73'),_0x2e3a4b['id']);logger[_0x3c51('0x1c')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2e3a4b['id'],_0xe7dab2['name'],_0x480bdf[_0x3c51('0x3b')]);switch(_0x480bdf[_0x3c51('0x3b')]){case'integrationTab':emit(util[_0x3c51('0x43')](_0x3c51('0x67'),_0xe7dab2[_0x3c51('0x50')]),_0x3c51('0x74'),{'recordId':_0x2e3a4b['id']});break;case _0x3c51('0x68'):emit(util[_0x3c51('0x43')](_0x3c51('0x67'),_0xe7dab2[_0x3c51('0x50')]),_0x3c51('0x69'),{'uri':util[_0x3c51('0x43')](_0x3c51('0x6a'),_0x1c9189[_0x3c51('0x6b')],_0x2e3a4b['id'])});break;default:logger[_0x3c51('0x6c')](_0x3c51('0x71'),_0x3c51('0x75'));}})['catch'](function(_0x4ab4e2){logger[_0x3c51('0x6c')](_0x3c51('0x71'),_0x4ab4e2);});};exports[_0x3c51('0x76')]=function(_0x44f6eb,_0x3ad335,_0x53aea1,_0xe4e74c,_0x324040,_0x3e9223){var _0x208c7f,_0x21e9c4,_0x24ab35,_0x24670d;_0x3e9223[_0x3c51('0x5a')]=intUtil['stripTrailingSlash'](_0x3e9223['serverUrl']);_0x3e9223[_0x3c51('0x5b')]=intUtil['stripTrailingSlash'](_0x3e9223[_0x3c51('0x5b')]);if(_0x324040&&_0x324040[_0x3c51('0x5c')]){logger[_0x3c51('0x1c')]('['+_0x3ad335[_0x3c51('0x77')][_0x3c51('0x78')]()+']',_0x3c51('0x5e'));_0x3ad335[_0x3c51('0x5f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e9223['serverUrl'],_0x3ad335[_0x3c51('0x61')],md5(_0x3ad335['uniqueid']));}else{_0x3ad335['recordingURL']='';}return getConnection(_0x3e9223)[_0x3c51('0x23')](function(_0x58450e){_0x24670d=_0x58450e;if(!_['isNil'](_0xe4e74c)){return getUser(_0x3e9223,_0xe4e74c[_0x3c51('0x50')],_0x24670d);}else{return getUser(_0x3e9223,null,_0x24670d);}})[_0x3c51('0x23')](function(_0x2cdb55){_0x208c7f=_0x2cdb55;return getEndUser(_0x3e9223,_0x53aea1,_0x3ad335[_0x3c51('0x63')],_0x3ad335[_0x3c51('0x79')],_0x24670d);})[_0x3c51('0x23')](function(_0x14f965){_0x21e9c4=_0x14f965;return getTicket(_0x3e9223,_0x208c7f,_0x21e9c4,_0x53aea1,_0x3ad335,_0x53aea1['Fields'],_0x24670d);})[_0x3c51('0x23')](function(_0x4eb458){_0x24ab35=_0x4eb458;logger[_0x3c51('0x1c')]('['+_0x3ad335[_0x3c51('0x77')][_0x3c51('0x78')]()+_0x3c51('0x7a'),_0x24ab35['id']);logger['info']('['+_0x3ad335['lastevent'][_0x3c51('0x78')]()+_0x3c51('0x7b'),_0x3e9223[_0x3c51('0x3b')]);})[_0x3c51('0x6d')](function(_0x27dc48){logger[_0x3c51('0x6c')]('['+_0x3ad335['lastevent'][_0x3c51('0x78')]()+']',_0x27dc48);});};
\ No newline at end of file
+var _0x5ba6=['name','password','concat','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','%s/%s/e','instanceUrl','error','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','Fields',']\x20Ticket\x20%s\x20created.','lodash','moment','bluebird','util','ioredis','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','lead','WhoId','endUserType','account','Case','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','execute','then','length','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','info','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','cloneDeep','additionalSearchAccount','Account','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','<unknown>','Caller\x20-\x20%s','LastName','Company','No\x20Company','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','forEach','includes','string','idField','content','toString','variable','variableName','customVariable','Variable'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x5ba6,0x1a4));var _0x65ba=function(_0x310382,_0x501b76){_0x310382=_0x310382-0x0;var _0x354f3d=_0x5ba6[_0x310382];return _0x354f3d;};'use strict';var _=require(_0x65ba('0x0'));var rp=require('request-promise');var moment=require(_0x65ba('0x1'));var BPromise=require(_0x65ba('0x2'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0x65ba('0x3'));var Redis=require(_0x65ba('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('salesforce');config[_0x65ba('0x5')]=_[_0x65ba('0x6')](config[_0x65ba('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x65ba('0x7'))(new Redis(config[_0x65ba('0x5')]));function emit(_0x1d6599,_0x239902,_0xb4f580){io['to'](_0x1d6599)[_0x65ba('0x8')](_0x239902,_0xb4f580);}function getTicket(_0x40c19d,_0x4a3968,_0x26fc48,_0x67e020,_0x3e530b,_0xc9fcf9,_0x4cdacf,_0x5cb1ba){var _0xa08cc3=Object[_0x65ba('0x9')]({},{'OwnerId':_0x4a3968['id'],'Subject':intUtil[_0x65ba('0xa')](_0x67e020[_0x65ba('0xb')],_0x3e530b,'\x20'),'Description':intUtil[_0x65ba('0xa')](_0x67e020[_0x65ba('0xc')],_0x3e530b,'\x0a')},getCustomFields(_0xc9fcf9,_0x3e530b));if(_0x26fc48){if(_0x67e020[_0x65ba('0xd')]===_0x65ba('0xe')){_0xa08cc3[_0x65ba('0xf')]=moment[_0x65ba('0x10')]();_0xa08cc3[_0x65ba('0x11')]=![];_0xa08cc3[_0x65ba('0x12')]=![];if(_0x26fc48['endUserType']===_0x65ba('0x13')||_0x26fc48['endUserType']===_0x65ba('0x14')){_0xa08cc3[_0x65ba('0x15')]=_0x26fc48['id'];}else if(_0x26fc48[_0x65ba('0x16')]===_0x65ba('0x17')){_0xa08cc3['WhatId']=_0x26fc48['id'];}}else if(_0x67e020[_0x65ba('0xd')]===_0x65ba('0x18')){if(_0x26fc48[_0x65ba('0x16')]===_0x65ba('0x13')){_0xa08cc3[_0x65ba('0x19')]=_0x26fc48['id'];}else if(_0x26fc48[_0x65ba('0x16')]==='account'){_0xa08cc3[_0x65ba('0x1a')]=_0x26fc48['id'];}else if(_0x26fc48['endUserType']===_0x65ba('0x14')&&_0x67e020[_0x65ba('0x1b')]){_0xa08cc3[_0x67e020['leadId']]=_0x26fc48['id'];}else{logger['info'](_0x65ba('0x1c'));}}}return _0x4cdacf[_0x65ba('0x1d')](_0x67e020[_0x65ba('0xd')])[_0x65ba('0x1e')](_0xa08cc3);}function getUser(_0x4c791c,_0x4f6abd,_0x20e48e){if(!_[_0x65ba('0x1f')](_0x4f6abd)&&intUtil['validateEmail'](_0x4f6abd)){var _0x2fa214={'Email':_0x4f6abd};var _0x2a7007={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x20e48e[_0x65ba('0x1d')](_0x65ba('0x20'))[_0x65ba('0x21')](_0x2fa214,_0x2a7007)[_0x65ba('0x22')]()[_0x65ba('0x23')](function(_0x55f240){if(_0x55f240[_0x65ba('0x24')]){var _0x2e0048=_[_0x65ba('0x21')](_0x55f240,function(_0x2eab8c){return _0x2eab8c['Email']===_0x4f6abd;});if(_0x2e0048){logger['info']('Agent\x20%s\x20found.',_0x4f6abd);return BPromise['resolve']({'id':_0x2e0048['Id'],'name':_0x2e0048[_0x65ba('0x25')]});}}else{logger['info'](_0x65ba('0x26'),_0x4f6abd);return _0x20e48e['identity']()['then'](function(_0x189da6){return BPromise[_0x65ba('0x27')]({'id':_0x189da6['user_id'],'name':_0x189da6['display_name']});});}});}else{logger[_0x65ba('0x28')](_0x65ba('0x26'),_0x4f6abd);return _0x20e48e[_0x65ba('0x29')]()[_0x65ba('0x23')](function(_0x518c12){return BPromise[_0x65ba('0x27')]({'id':_0x518c12[_0x65ba('0x2a')],'name':_0x518c12[_0x65ba('0x2b')]});});}}function getEndUser(_0xb9ec3b,_0x1c641a,_0x362db3,_0x1eca33,_0x335637){var _0x440610={'$or':{'Phone':_0x1eca33}};var _0x1eda0b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x65ba('0x23')](function(){logger['info'](_0x65ba('0x2c'),_0x1eca33,_0x1c641a[_0x65ba('0x2d')]);switch(_0x1c641a['moduleSearch']){case _0x65ba('0x2e'):var _0x35a5ea=_['cloneDeep'](_0x440610);if(_0x1c641a[_0x65ba('0x2f')]){var _0x55da2a={};_0x55da2a[_0x1c641a[_0x65ba('0x2f')]]=_0x1eca33;_[_0x65ba('0x30')](_0x35a5ea[_0x65ba('0x31')],_0x55da2a);}return _0x335637[_0x65ba('0x1d')](_0x65ba('0x32'))['find'](_0x35a5ea,_0x1eda0b)[_0x65ba('0x22')]()[_0x65ba('0x23')](function(_0x8d336e){if(_0x8d336e&&_0x8d336e['length']){return _0x8d336e;}else{var _0x51cae9=_['cloneDeep'](_0x440610);if(_0x1c641a[_0x65ba('0x33')]){var _0x55a551={};_0x55a551[_0x1c641a[_0x65ba('0x33')]]=_0x1eca33;_[_0x65ba('0x30')](_0x51cae9[_0x65ba('0x31')],_0x55a551);}return _0x335637[_0x65ba('0x1d')](_0x65ba('0x34'))['find'](_0x51cae9,_0x1eda0b);}});case _0x65ba('0x35'):var _0xf846f5=_[_0x65ba('0x36')](_0x440610);if(_0x1c641a[_0x65ba('0x37')]){var _0x55da2a={};_0x55da2a[_0x1c641a['additionalSearchAccount']]=_0x1eca33;_[_0x65ba('0x30')](_0xf846f5['$or'],_0x55da2a);}return _0x335637['sobject']('Account')[_0x65ba('0x21')](_0xf846f5,_0x1eda0b)[_0x65ba('0x22')]()[_0x65ba('0x23')](function(_0x15d0ac){if(_0x15d0ac&&_0x15d0ac['length']){return _0x15d0ac;}else{var _0x51d8e3=_[_0x65ba('0x36')](_0x440610);if(_0x1c641a[_0x65ba('0x2f')]){var _0x295b17={};_0x295b17[_0x1c641a[_0x65ba('0x2f')]]=_0x1eca33;_[_0x65ba('0x30')](_0x51d8e3['$or'],_0x295b17);}return _0x335637[_0x65ba('0x1d')](_0x65ba('0x32'))[_0x65ba('0x21')](_0x51d8e3,_0x1eda0b)[_0x65ba('0x23')](function(_0x40af42){if(_0x40af42&&_0x40af42[_0x65ba('0x24')]){return _0x40af42;}else{var _0x1c5935=_['cloneDeep'](_0x440610);if(_0x1c641a[_0x65ba('0x33')]){var _0x5af25d={};_0x5af25d[_0x1c641a[_0x65ba('0x33')]]=_0x1eca33;_['merge'](_0x1c5935[_0x65ba('0x31')],_0x5af25d);}return _0x335637[_0x65ba('0x1d')](_0x65ba('0x34'))[_0x65ba('0x21')](_0x1c5935,_0x1eda0b);}});}});case _0x65ba('0x13'):var _0x35a5ea=_[_0x65ba('0x36')](_0x440610);if(_0x1c641a[_0x65ba('0x2f')]){var _0x55da2a={};_0x55da2a[_0x1c641a[_0x65ba('0x2f')]]=_0x1eca33;_[_0x65ba('0x30')](_0x35a5ea[_0x65ba('0x31')],_0x55da2a);}return _0x335637[_0x65ba('0x1d')](_0x65ba('0x32'))[_0x65ba('0x21')](_0x35a5ea,_0x1eda0b)[_0x65ba('0x22')]();case _0x65ba('0x14'):var _0x15863e=_[_0x65ba('0x36')](_0x440610);if(_0x1c641a[_0x65ba('0x33')]){var _0x55da2a={};_0x55da2a[_0x1c641a['additionalSearchLead']]=_0x1eca33;_[_0x65ba('0x30')](_0x15863e[_0x65ba('0x31')],_0x55da2a);}return _0x335637[_0x65ba('0x1d')](_0x65ba('0x34'))[_0x65ba('0x21')](_0x15863e,_0x1eda0b);case _0x65ba('0x17'):var _0xf846f5=_[_0x65ba('0x36')](_0x440610);if(_0x1c641a['additionalSearchAccount']){var _0x55da2a={};_0x55da2a[_0x1c641a['additionalSearchAccount']]=_0x1eca33;_['merge'](_0xf846f5[_0x65ba('0x31')],_0x55da2a);}return _0x335637[_0x65ba('0x1d')](_0x65ba('0x38'))['find'](_0xf846f5,_0x1eda0b);default:return null;}})[_0x65ba('0x23')](function(_0x1be641){if(_0x1be641&&_0x1be641[_0x65ba('0x24')]){var _0x3f6184=_['first'](_0x1be641);if(_0x3f6184){return BPromise[_0x65ba('0x27')]({'id':_0x3f6184['Id'],'name':_0x3f6184[_0x65ba('0x25')],'phone':_0x3f6184[_0x65ba('0x39')],'endUserType':_0x3f6184[_0x65ba('0x3a')][_0x65ba('0x3b')][_0x65ba('0x3c')]()});}}})['then'](function(_0x435bfc){if(_0x435bfc){logger[_0x65ba('0x28')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x435bfc[_0x65ba('0x16')],_0x1eca33);return BPromise[_0x65ba('0x27')](_0x435bfc);}else{logger[_0x65ba('0x28')](_0x65ba('0x3d'),_0x1eca33);var _0xa9c4fe={'Phone':_0x1eca33};if(_0x1c641a[_0x65ba('0x3e')]){if(_0x1c641a[_0x65ba('0x3e')]===_0x65ba('0x13')){logger[_0x65ba('0x28')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1eca33,_0x1c641a[_0x65ba('0x3e')]);_0xa9c4fe['LastName']=_0x362db3!==_0x65ba('0x3f')?_0x362db3:util['format'](_0x65ba('0x40'),_0x1eca33);}else if(_0x1c641a[_0x65ba('0x3e')]===_0x65ba('0x14')){logger[_0x65ba('0x28')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1eca33,_0x1c641a[_0x65ba('0x3e')]);_0xa9c4fe[_0x65ba('0x41')]=_0x362db3!==_0x65ba('0x3f')?_0x362db3:util['format'](_0x65ba('0x40'),_0x1eca33);_0xa9c4fe[_0x65ba('0x42')]=_0x65ba('0x43');}else if(_0x1c641a['moduleCreate']===_0x65ba('0x17')){logger[_0x65ba('0x28')](_0x65ba('0x44'),_0x1eca33,_0x1c641a[_0x65ba('0x3e')]);_0xa9c4fe[_0x65ba('0x25')]=_0x362db3!==_0x65ba('0x3f')?_0x362db3:util[_0x65ba('0x45')]('Caller\x20-\x20%s',_0x1eca33);}else{return null;}}return _0x335637[_0x65ba('0x1d')](_['upperFirst'](_0x1c641a[_0x65ba('0x3e')]))['create'](_0xa9c4fe)[_0x65ba('0x23')](function(_0x562a27){return BPromise[_0x65ba('0x27')]({'id':_0x562a27['id'],'endUserType':_0x1c641a[_0x65ba('0x3e')]});});}});}function getCustomFields(_0x5a85d4,_0x2d1d56){var _0x216058={};if(_0x5a85d4[_0x65ba('0x24')]>0x0){_[_0x65ba('0x46')](_0x5a85d4,function(_0x1e3242){if(_[_0x65ba('0x47')]([_0x65ba('0x48'),'picklist'],_0x1e3242[_0x65ba('0x3b')])&&_0x1e3242['idField']){_0x216058[_0x1e3242[_0x65ba('0x49')]]=_0x1e3242[_0x65ba('0x4a')][_0x65ba('0x4b')]();}else if(_0x1e3242[_0x65ba('0x3b')]===_0x65ba('0x4c')&&_0x1e3242[_0x65ba('0x4d')]&&_0x1e3242[_0x65ba('0x49')]){_0x2d1d56[_0x1e3242[_0x65ba('0x4d')]]&&(_0x216058[_0x1e3242[_0x65ba('0x49')]]=_0x2d1d56[_0x1e3242[_0x65ba('0x4d')]][_0x65ba('0x4b')]());}else if(_0x1e3242['type']===_0x65ba('0x4e')&&_0x1e3242[_0x65ba('0x4f')]&&_0x1e3242[_0x65ba('0x4f')][_0x65ba('0x50')]&&_0x1e3242[_0x65ba('0x49')]){_0x2d1d56[_0x1e3242['Variable'][_0x65ba('0x50')][_0x65ba('0x3c')]()]&&(_0x216058[_0x1e3242[_0x65ba('0x49')]]=_0x2d1d56[_0x1e3242[_0x65ba('0x4f')][_0x65ba('0x50')][_0x65ba('0x3c')]()]['toString']());}});}return _0x216058;}function getConnection(_0x531ab9){var _0x5268c8=_0x531ab9[_0x65ba('0x51')][_0x65ba('0x52')](_0x531ab9['securityToken']);var _0x179ca5=new jsforce['Connection']({'oauth2':{'loginUrl':_0x531ab9[_0x65ba('0x53')]||_0x65ba('0x54'),'clientId':_0x531ab9[_0x65ba('0x55')],'clientSecret':_0x531ab9[_0x65ba('0x56')]}});return _0x179ca5[_0x65ba('0x57')](_0x531ab9[_0x65ba('0x58')],_0x5268c8)[_0x65ba('0x23')](function(){logger[_0x65ba('0x28')](_0x65ba('0x59'));return _0x179ca5;});}exports[_0x65ba('0x5a')]=function(_0x584012,_0x1b2dbf,_0x1ecf8c,_0x1e86fe,_0x505448,_0x2ea63f){var _0x44983d,_0x198e8a,_0x2ff133,_0x4a78f1;_0x2ea63f['serverUrl']=intUtil[_0x65ba('0x5b')](_0x2ea63f[_0x65ba('0x5c')]);_0x2ea63f[_0x65ba('0x53')]=intUtil[_0x65ba('0x5b')](_0x2ea63f[_0x65ba('0x53')]);if(_0x505448&&_0x505448[_0x65ba('0x5d')]){logger['info'](_0x65ba('0x5e'),_0x65ba('0x5f'));_0x1b2dbf['recordingURL']=util[_0x65ba('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ea63f[_0x65ba('0x5c')],_0x1b2dbf['uniqueid'],md5(_0x1b2dbf[_0x65ba('0x60')]));}else{_0x1b2dbf[_0x65ba('0x61')]='';}return getConnection(_0x2ea63f)[_0x65ba('0x23')](function(_0x3f7b18){_0x4a78f1=_0x3f7b18;return getUser(_0x2ea63f,_0x1e86fe[_0x65ba('0x62')],_0x4a78f1);})[_0x65ba('0x23')](function(_0x299ace){_0x44983d=_0x299ace;return getEndUser(_0x2ea63f,_0x1ecf8c,_0x1b2dbf['calleridname'],_0x1b2dbf[_0x65ba('0x63')],_0x4a78f1);})[_0x65ba('0x23')](function(_0x39aef5){_0x198e8a=_0x39aef5;return getTicket(_0x2ea63f,_0x44983d,_0x198e8a,_0x1ecf8c,_0x1b2dbf,_0x1ecf8c['Fields'],_0x4a78f1,'queue');})[_0x65ba('0x23')](function(_0x403d29){_0x2ff133=_0x403d29;logger[_0x65ba('0x28')](_0x65ba('0x64'),_0x2ff133['id']);logger[_0x65ba('0x28')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2ff133['id'],_0x1e86fe[_0x65ba('0x50')],_0x2ea63f[_0x65ba('0x3b')]);switch(_0x2ea63f[_0x65ba('0x3b')]){case _0x65ba('0x65'):emit(util[_0x65ba('0x45')](_0x65ba('0x66'),_0x1e86fe['name']),_0x65ba('0x67'),{'recordId':_0x2ff133['id']});break;case _0x65ba('0x68'):emit(util[_0x65ba('0x45')](_0x65ba('0x66'),_0x1e86fe['name']),'trigger:browser:url',{'uri':util[_0x65ba('0x45')]('%s/%s/e',_0x4a78f1['instanceUrl'],_0x2ff133['id'])});break;default:logger['error'](_0x65ba('0x69'));}})[_0x65ba('0x6a')](function(_0x5a7f28){logger['error']('[QUEUE]',_0x5a7f28);});};exports['outbound']=function(_0xcbfa69,_0x52b8fa,_0x287c60,_0x2e99a2,_0xf20e2e,_0x329b2c,_0x3c46f3){var _0x2966cf,_0x58975b,_0xa29ecd,_0x1199c2;_0x329b2c[_0x65ba('0x5c')]=intUtil['stripTrailingSlash'](_0x329b2c['serverUrl']);_0x329b2c['remoteUri']=intUtil[_0x65ba('0x5b')](_0x329b2c['remoteUri']);if(_0x3c46f3&&_0x3c46f3[_0x65ba('0x6b')]&&_0x3c46f3['recordingFormat']!=='none'){logger[_0x65ba('0x28')](_0x65ba('0x6c'),_0x65ba('0x5f'));_0x52b8fa['recordingURL']=util[_0x65ba('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x329b2c[_0x65ba('0x5c')],_0x52b8fa[_0x65ba('0x60')],md5(_0x52b8fa['uniqueid']));}return getConnection(_0x329b2c)[_0x65ba('0x23')](function(_0x3906dd){_0x1199c2=_0x3906dd;return getUser(_0x329b2c,_0x2e99a2[_0x65ba('0x62')],_0x1199c2);})['then'](function(_0x374f05){_0x2966cf=_0x374f05;return getEndUser(_0x329b2c,_0x287c60,_0x52b8fa[_0x65ba('0x6d')],_0x52b8fa[_0x65ba('0x6e')],_0x1199c2);})[_0x65ba('0x23')](function(_0x267ef3){_0x58975b=_0x267ef3;return getTicket(_0x329b2c,_0x2966cf,_0x58975b,_0x287c60,_0x52b8fa,_0x287c60['Fields'],_0x1199c2,'outbound');})[_0x65ba('0x23')](function(_0x1b2821){_0xa29ecd=_0x1b2821;logger[_0x65ba('0x28')](_0x65ba('0x6f'),_0xa29ecd['id']);logger['info'](_0x65ba('0x70'),_0xa29ecd['id'],_0x2e99a2[_0x65ba('0x50')],_0x329b2c[_0x65ba('0x3b')]);switch(_0x329b2c['type']){case _0x65ba('0x65'):emit(util['format'](_0x65ba('0x66'),_0x2e99a2[_0x65ba('0x50')]),'trigger:salesforce:display',{'recordId':_0xa29ecd['id']});break;case _0x65ba('0x68'):emit(util[_0x65ba('0x45')](_0x65ba('0x66'),_0x2e99a2[_0x65ba('0x50')]),_0x65ba('0x71'),{'uri':util[_0x65ba('0x45')](_0x65ba('0x72'),_0x1199c2[_0x65ba('0x73')],_0xa29ecd['id'])});break;default:logger[_0x65ba('0x74')](_0x65ba('0x6c'),_0x65ba('0x75'));}})[_0x65ba('0x6a')](function(_0x50d2ae){logger[_0x65ba('0x74')](_0x65ba('0x6c'),_0x50d2ae);});};exports[_0x65ba('0x76')]=function(_0x541d08,_0x18ae9f,_0x249eda,_0x327cc8,_0x56ac46,_0x19664f){var _0xf84024,_0x3154fb,_0x58cf9c,_0x401c8c;_0x19664f['serverUrl']=intUtil[_0x65ba('0x5b')](_0x19664f['serverUrl']);_0x19664f[_0x65ba('0x53')]=intUtil[_0x65ba('0x5b')](_0x19664f[_0x65ba('0x53')]);if(_0x56ac46&&_0x56ac46[_0x65ba('0x5d')]){logger[_0x65ba('0x28')]('['+_0x18ae9f[_0x65ba('0x77')][_0x65ba('0x78')]()+']',_0x65ba('0x5f'));_0x18ae9f[_0x65ba('0x61')]=util[_0x65ba('0x45')](_0x65ba('0x79'),_0x19664f[_0x65ba('0x5c')],_0x18ae9f[_0x65ba('0x60')],md5(_0x18ae9f[_0x65ba('0x60')]));}else{_0x18ae9f[_0x65ba('0x61')]='';}return getConnection(_0x19664f)[_0x65ba('0x23')](function(_0x351ec9){_0x401c8c=_0x351ec9;if(!_[_0x65ba('0x1f')](_0x327cc8)){return getUser(_0x19664f,_0x327cc8[_0x65ba('0x50')],_0x401c8c);}else{return getUser(_0x19664f,null,_0x401c8c);}})[_0x65ba('0x23')](function(_0x38a80f){_0xf84024=_0x38a80f;return getEndUser(_0x19664f,_0x249eda,_0x18ae9f[_0x65ba('0x7a')],_0x18ae9f[_0x65ba('0x63')],_0x401c8c);})[_0x65ba('0x23')](function(_0x727fdc){_0x3154fb=_0x727fdc;return getTicket(_0x19664f,_0xf84024,_0x3154fb,_0x249eda,_0x18ae9f,_0x249eda[_0x65ba('0x7b')],_0x401c8c);})['then'](function(_0x57a40f){_0x58cf9c=_0x57a40f;logger[_0x65ba('0x28')]('['+_0x18ae9f['lastevent'][_0x65ba('0x78')]()+_0x65ba('0x7c'),_0x58cf9c['id']);logger[_0x65ba('0x28')]('['+_0x18ae9f[_0x65ba('0x77')][_0x65ba('0x78')]()+']\x20Integration\x20account\x20type\x20%s.',_0x19664f[_0x65ba('0x3b')]);})[_0x65ba('0x6a')](function(_0x58299d){logger['error']('['+_0x18ae9f['lastevent'][_0x65ba('0x78')]()+']',_0x58299d);});};
\ No newline at end of file