8e67d3dab4aca54b74e786817d2713adbe89f802
[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 _0x5abc=['./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','unknown\x20integration','../../../../config/logger','[EXEC]','error','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./sugarcrm'];(function(_0x3fe73f,_0x9ff525){var _0xc27629=function(_0x51cd68){while(--_0x51cd68){_0x3fe73f['push'](_0x3fe73f['shift']());}};_0xc27629(++_0x9ff525);}(_0x5abc,0x94));var _0xc5ab=function(_0x479f59,_0x12b753){_0x479f59=_0x479f59-0x0;var _0x1d327a=_0x5abc[_0x479f59];return _0x1d327a;};'use strict';var _=require(_0xc5ab('0x0'));var util=require(_0xc5ab('0x1'));var zendesk=require(_0xc5ab('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xc5ab('0x3'));var freshdesk=require(_0xc5ab('0x4'));var zoho=require(_0xc5ab('0x5'));var desk=require(_0xc5ab('0x6'));var vtiger=require(_0xc5ab('0x7'));var servicenow=require(_0xc5ab('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0xc5ab('0x9'));var integrations=['zendesk',_0xc5ab('0xa'),_0xc5ab('0xb'),_0xc5ab('0xc'),_0xc5ab('0xd'),_0xc5ab('0xe'),_0xc5ab('0xf'),_0xc5ab('0x10'),_0xc5ab('0x11'),_0xc5ab('0x12')];exports[_0xc5ab('0x13')]=function(_0xa3ff61,_0x1fb841,_0x17465f,_0x3a1561,_0x3fc5d6,_0x182c09){if(_0x17465f){if(_['includes'](integrations,_0xa3ff61[_0xc5ab('0x14')][_0xc5ab('0x15')]())){try{var _0x48d52a=null;var _0x5729c5='';var _0x35065d=_0x17465f[_0xa3ff61[_0xc5ab('0x14')][_0xc5ab('0x15')]()];if(_0x35065d){var _0x22371f=_0x35065d[_0xa3ff61['data2']];if(_0x22371f){var _0x4ded77=_[_0xc5ab('0x16')](_0x22371f[_0xc5ab('0x17')],{'id':parseInt(_0xa3ff61[_0xc5ab('0x18')],0xa)});if(_0x4ded77){if(_0x3a1561){if(_0x3fc5d6&&_0x1fb841[_0xc5ab('0x19')]){_0x5729c5=_0xc5ab('0x19');}else if(_0x1fb841[_0xc5ab('0x1a')]){_0x5729c5=_0xc5ab('0x1b');}else{console[_0xc5ab('0x1c')](_0xc5ab('0x1d'),_0x1fb841);}}else{_0x5729c5=_0xc5ab('0x1e');}switch(_0xa3ff61[_0xc5ab('0x14')][_0xc5ab('0x15')]()){case _0xc5ab('0x1f'):zendesk[_0x5729c5](_0xa3ff61,_0x1fb841,_0x4ded77,_0x3a1561,_0x3fc5d6,_0x22371f,_0x182c09);break;case'salesforce':salesforce[_0x5729c5](_0xa3ff61,_0x1fb841,_0x4ded77,_0x3a1561,_0x3fc5d6,_0x22371f,_0x182c09);break;case _0xc5ab('0xb'):sugarcrm[_0x5729c5](_0xa3ff61,_0x1fb841,_0x4ded77,_0x3a1561,_0x3fc5d6,_0x22371f,_0x182c09);break;case _0xc5ab('0xc'):freshdesk[_0x5729c5](_0xa3ff61,_0x1fb841,_0x4ded77,_0x3a1561,_0x3fc5d6,_0x22371f,_0x182c09);break;case'zoho':zoho[_0x5729c5](_0xa3ff61,_0x1fb841,_0x4ded77,_0x3a1561,_0x3fc5d6,_0x22371f,_0x182c09);break;case _0xc5ab('0xe'):desk[_0x5729c5](_0xa3ff61,_0x1fb841,_0x4ded77,_0x3a1561,_0x3fc5d6,_0x22371f,_0x182c09);break;case'vtiger':vtiger[_0x5729c5](_0xa3ff61,_0x1fb841,_0x4ded77,_0x3a1561,_0x3fc5d6,_0x22371f,_0x182c09);break;case'freshsales':freshsales['cs'](_0xa3ff61,_0x1fb841,_0x4ded77,_0x3a1561,_0x3fc5d6,_0x22371f,_0x182c09,_0x5729c5);break;case _0xc5ab('0x12'):servicenow['cs'](_0xa3ff61,_0x1fb841,_0x4ded77,_0x3a1561,_0x3fc5d6,_0x22371f,_0x182c09,_0x5729c5);break;case'dynamics365':dynamics365['cs'](_0xa3ff61,_0x1fb841,_0x4ded77,_0x3a1561,_0x3fc5d6,_0x22371f,_0x182c09,_0x5729c5);break;default:console[_0xc5ab('0x1c')](_0xc5ab('0x20'));}}else{_0x48d52a=require(_0xc5ab('0x21'))(_0xa3ff61['data1'][_0xc5ab('0x15')]());_0x48d52a['error'](_0xc5ab('0x22'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0xa3ff61[_0xc5ab('0x14')][_0xc5ab('0x15')](),_0xa3ff61['data3']));}}else{_0x48d52a=require(_0xc5ab('0x21'))(_0xa3ff61[_0xc5ab('0x14')][_0xc5ab('0x15')]());_0x48d52a[_0xc5ab('0x23')](_0xc5ab('0x22'),util['format'](_0xc5ab('0x24'),_0xa3ff61[_0xc5ab('0x14')][_0xc5ab('0x15')](),_0xa3ff61[_0xc5ab('0x25')]));}}else{}}catch(_0x4d340f){console[_0xc5ab('0x23')](_0x4d340f);}}}};