34daf9a05f3e0a82a3130e9b4bc3d52d969ffe7b
[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 _0x7cc8=['./zendesk','./salesforce','./sugarcrm','./desk','./vtiger','./servicenow','./dynamics365','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zendesk','freshdesk','freshsales','log','unknown\x20integration','../../../../config/logger','format','%s\x20configuration\x20#%s\x20not\x20found','error','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x7cc8,0x76));var _0x87cc=function(_0x1b6551,_0x533804){_0x1b6551=_0x1b6551-0x0;var _0xd62d41=_0x7cc8[_0x1b6551];return _0xd62d41;};'use strict';var _=require(_0x87cc('0x0'));var util=require(_0x87cc('0x1'));var zendesk=require(_0x87cc('0x2'));var salesforce=require(_0x87cc('0x3'));var sugarcrm=require(_0x87cc('0x4'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0x87cc('0x5'));var vtiger=require(_0x87cc('0x6'));var servicenow=require(_0x87cc('0x7'));var dynamics365=require(_0x87cc('0x8'));var freshsales=require('./freshsales');var integrations=['zendesk',_0x87cc('0x9'),_0x87cc('0xa'),'freshdesk',_0x87cc('0xb'),_0x87cc('0xc'),_0x87cc('0xd'),_0x87cc('0xe'),'freshsales',_0x87cc('0xf')];exports[_0x87cc('0x10')]=function(_0x3ffde8,_0x4982b5,_0xb7e7c9,_0x2d471f,_0x1a4384,_0x31a3d0){if(_0xb7e7c9){if(_[_0x87cc('0x11')](integrations,_0x3ffde8[_0x87cc('0x12')][_0x87cc('0x13')]())){try{var _0x4ec7f6=null;var _0x20639d='';var _0x497717=_0xb7e7c9[_0x3ffde8[_0x87cc('0x12')][_0x87cc('0x13')]()];if(_0x497717){var _0x147983=_0x497717[_0x3ffde8[_0x87cc('0x14')]];if(_0x147983){var _0x3d2a6f=_[_0x87cc('0x15')](_0x147983[_0x87cc('0x16')],{'id':parseInt(_0x3ffde8[_0x87cc('0x17')],0xa)});if(_0x3d2a6f){if(_0x2d471f){if(_0x1a4384&&_0x4982b5['queue']){_0x20639d=_0x87cc('0x18');}else if(_0x4982b5[_0x87cc('0x19')]){_0x20639d=_0x87cc('0x1a');}else{console['log'](_0x87cc('0x1b'),_0x4982b5);}}else{_0x20639d=_0x87cc('0x1c');}switch(_0x3ffde8[_0x87cc('0x12')][_0x87cc('0x13')]()){case _0x87cc('0x1d'):zendesk[_0x20639d](_0x3ffde8,_0x4982b5,_0x3d2a6f,_0x2d471f,_0x1a4384,_0x147983,_0x31a3d0);break;case _0x87cc('0x9'):salesforce[_0x20639d](_0x3ffde8,_0x4982b5,_0x3d2a6f,_0x2d471f,_0x1a4384,_0x147983,_0x31a3d0);break;case _0x87cc('0xa'):sugarcrm[_0x20639d](_0x3ffde8,_0x4982b5,_0x3d2a6f,_0x2d471f,_0x1a4384,_0x147983,_0x31a3d0);break;case _0x87cc('0x1e'):freshdesk[_0x20639d](_0x3ffde8,_0x4982b5,_0x3d2a6f,_0x2d471f,_0x1a4384,_0x147983,_0x31a3d0);break;case _0x87cc('0xb'):zoho[_0x20639d](_0x3ffde8,_0x4982b5,_0x3d2a6f,_0x2d471f,_0x1a4384,_0x147983,_0x31a3d0);break;case _0x87cc('0xc'):desk[_0x20639d](_0x3ffde8,_0x4982b5,_0x3d2a6f,_0x2d471f,_0x1a4384,_0x147983,_0x31a3d0);break;case _0x87cc('0xd'):vtiger[_0x20639d](_0x3ffde8,_0x4982b5,_0x3d2a6f,_0x2d471f,_0x1a4384,_0x147983,_0x31a3d0);break;case _0x87cc('0x1f'):freshsales['cs'](_0x3ffde8,_0x4982b5,_0x3d2a6f,_0x2d471f,_0x1a4384,_0x147983,_0x31a3d0,_0x20639d);break;case _0x87cc('0xf'):servicenow['cs'](_0x3ffde8,_0x4982b5,_0x3d2a6f,_0x2d471f,_0x1a4384,_0x147983,_0x31a3d0,_0x20639d);break;case _0x87cc('0xe'):dynamics365['cs'](_0x3ffde8,_0x4982b5,_0x3d2a6f,_0x2d471f,_0x1a4384,_0x147983,_0x31a3d0,_0x20639d);break;default:console[_0x87cc('0x20')](_0x87cc('0x21'));}}else{_0x4ec7f6=require(_0x87cc('0x22'))(_0x3ffde8[_0x87cc('0x12')][_0x87cc('0x13')]());_0x4ec7f6['error']('[EXEC]',util[_0x87cc('0x23')](_0x87cc('0x24'),_0x3ffde8[_0x87cc('0x12')][_0x87cc('0x13')](),_0x3ffde8[_0x87cc('0x17')]));}}else{_0x4ec7f6=require(_0x87cc('0x22'))(_0x3ffde8[_0x87cc('0x12')][_0x87cc('0x13')]());_0x4ec7f6[_0x87cc('0x25')](_0x87cc('0x26'),util[_0x87cc('0x23')](_0x87cc('0x27'),_0x3ffde8[_0x87cc('0x12')][_0x87cc('0x13')](),_0x3ffde8['data2']));}}else{}}catch(_0x235a83){console[_0x87cc('0x25')](_0x235a83);}}}};