2ab2b50de8a4150b2fbabdf8468c2081e3195cb3
[motion2.git] / server / services / ami / trigger / integration / index.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xacf7=['servicenow','exec','includes','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zoho','vtiger','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','desk','dynamics365','freshsales'];(function(_0x539e7a,_0x486b31){var _0x402f1a=function(_0x27baf7){while(--_0x27baf7){_0x539e7a['push'](_0x539e7a['shift']());}};_0x402f1a(++_0x486b31);}(_0xacf7,0x14f));var _0x7acf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xacf7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7acf('0x0'));var util=require(_0x7acf('0x1'));var zendesk=require(_0x7acf('0x2'));var salesforce=require(_0x7acf('0x3'));var sugarcrm=require(_0x7acf('0x4'));var freshdesk=require(_0x7acf('0x5'));var zoho=require(_0x7acf('0x6'));var desk=require(_0x7acf('0x7'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0x7acf('0x8'));var integrations=[_0x7acf('0x9'),_0x7acf('0xa'),_0x7acf('0xb'),_0x7acf('0xc'),'zoho',_0x7acf('0xd'),'vtiger',_0x7acf('0xe'),_0x7acf('0xf'),_0x7acf('0x10')];exports[_0x7acf('0x11')]=function(_0x2f4e08,_0xaa91c1,_0x2ba347,_0x470bae,_0x310f3b,_0x3cc1cf){if(_0x2ba347){if(_[_0x7acf('0x12')](integrations,_0x2f4e08['data1'][_0x7acf('0x13')]())){try{var _0xbfd54e=null;var _0x3553cd='';var _0x577723=_0x2ba347[_0x2f4e08[_0x7acf('0x14')][_0x7acf('0x13')]()];if(_0x577723){var _0x243064=_0x577723[_0x2f4e08[_0x7acf('0x15')]];if(_0x243064){var _0x4972db=_[_0x7acf('0x16')](_0x243064[_0x7acf('0x17')],{'id':parseInt(_0x2f4e08[_0x7acf('0x18')],0xa)});if(_0x4972db){if(_0x470bae){if(_0x310f3b&&_0xaa91c1[_0x7acf('0x19')]){_0x3553cd=_0x7acf('0x19');}else if(_0xaa91c1[_0x7acf('0x1a')]){_0x3553cd=_0x7acf('0x1b');}else{console[_0x7acf('0x1c')](_0x7acf('0x1d'),_0xaa91c1);}}else{_0x3553cd=_0x7acf('0x1e');}switch(_0x2f4e08['data1'][_0x7acf('0x13')]()){case _0x7acf('0x9'):zendesk[_0x3553cd](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf);break;case'salesforce':salesforce[_0x3553cd](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf);break;case _0x7acf('0xb'):sugarcrm[_0x3553cd](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf);break;case'freshdesk':freshdesk[_0x3553cd](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf);break;case _0x7acf('0x1f'):zoho[_0x3553cd](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf);break;case _0x7acf('0xd'):desk[_0x3553cd](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf);break;case _0x7acf('0x20'):vtiger[_0x3553cd](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf);break;case _0x7acf('0xf'):freshsales['cs'](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf,_0x3553cd);break;case _0x7acf('0x10'):servicenow['cs'](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf,_0x3553cd);break;case _0x7acf('0xe'):dynamics365['cs'](_0x2f4e08,_0xaa91c1,_0x4972db,_0x470bae,_0x310f3b,_0x243064,_0x3cc1cf,_0x3553cd);break;default:console[_0x7acf('0x1c')](_0x7acf('0x21'));}}else{_0xbfd54e=require(_0x7acf('0x22'))(_0x2f4e08[_0x7acf('0x14')]['toLowerCase']());_0xbfd54e[_0x7acf('0x23')](_0x7acf('0x24'),util[_0x7acf('0x25')]('%s\x20configuration\x20#%s\x20not\x20found',_0x2f4e08[_0x7acf('0x14')][_0x7acf('0x13')](),_0x2f4e08['data3']));}}else{_0xbfd54e=require(_0x7acf('0x22'))(_0x2f4e08[_0x7acf('0x14')][_0x7acf('0x13')]());_0xbfd54e[_0x7acf('0x23')](_0x7acf('0x24'),util[_0x7acf('0x25')](_0x7acf('0x26'),_0x2f4e08['data1']['toLowerCase'](),_0x2f4e08[_0x7acf('0x15')]));}}else{}}catch(_0x4412c8){console['error'](_0x4412c8);}}}};