d1e16233a6911318d7fbaf53bb9b24b3556f7f39
[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 _0xb62e=['./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','exec','includes','data1','toLowerCase','data2','find','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','servicenow','unknown\x20integration','../../../../config/logger','format','%s\x20configuration\x20#%s\x20not\x20found','error','[EXEC]','lodash','util','./zendesk'];(function(_0x298699,_0x4394cc){var _0x353c03=function(_0x8aa6b1){while(--_0x8aa6b1){_0x298699['push'](_0x298699['shift']());}};_0x353c03(++_0x4394cc);}(_0xb62e,0x1de));var _0xeb62=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb62e[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var zendesk=require(_0xeb62('0x2'));var salesforce=require(_0xeb62('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xeb62('0x4'));var zoho=require(_0xeb62('0x5'));var desk=require(_0xeb62('0x6'));var vtiger=require(_0xeb62('0x7'));var servicenow=require(_0xeb62('0x8'));var dynamics365=require(_0xeb62('0x9'));var freshsales=require('./freshsales');var integrations=[_0xeb62('0xa'),_0xeb62('0xb'),_0xeb62('0xc'),'freshdesk',_0xeb62('0xd'),_0xeb62('0xe'),_0xeb62('0xf'),_0xeb62('0x10'),'freshsales','servicenow'];exports[_0xeb62('0x11')]=function(_0x40584b,_0x6d5e94,_0xf93c21,_0x2fe923,_0xc91abc,_0x35afc3){if(_0xf93c21){if(_[_0xeb62('0x12')](integrations,_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')]())){try{var _0x4a493c=null;var _0x422daf='';var _0xcc11c4=_0xf93c21[_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')]()];if(_0xcc11c4){var _0x55a629=_0xcc11c4[_0x40584b[_0xeb62('0x15')]];if(_0x55a629){var _0x2fbad2=_[_0xeb62('0x16')](_0x55a629['Configurations'],{'id':parseInt(_0x40584b[_0xeb62('0x17')],0xa)});if(_0x2fbad2){if(_0x2fe923){if(_0xc91abc&&_0x6d5e94[_0xeb62('0x18')]){_0x422daf=_0xeb62('0x18');}else if(_0x6d5e94['routeId']){_0x422daf=_0xeb62('0x19');}else{console[_0xeb62('0x1a')](_0xeb62('0x1b'),_0x6d5e94);}}else{_0x422daf=_0xeb62('0x1c');}switch(_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')]()){case _0xeb62('0xa'):zendesk[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xb'):salesforce[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xc'):sugarcrm[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0x1d'):freshdesk[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xd'):zoho[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xe'):desk[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case _0xeb62('0xf'):vtiger[_0x422daf](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3);break;case'freshsales':freshsales['cs'](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3,_0x422daf);break;case _0xeb62('0x1e'):servicenow['cs'](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3,_0x422daf);break;case _0xeb62('0x10'):dynamics365['cs'](_0x40584b,_0x6d5e94,_0x2fbad2,_0x2fe923,_0xc91abc,_0x55a629,_0x35afc3,_0x422daf);break;default:console[_0xeb62('0x1a')](_0xeb62('0x1f'));}}else{_0x4a493c=require(_0xeb62('0x20'))(_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')]());_0x4a493c['error']('[EXEC]',util[_0xeb62('0x21')](_0xeb62('0x22'),_0x40584b[_0xeb62('0x13')][_0xeb62('0x14')](),_0x40584b[_0xeb62('0x17')]));}}else{_0x4a493c=require('../../../../config/logger')(_0x40584b['data1'][_0xeb62('0x14')]());_0x4a493c[_0xeb62('0x23')](_0xeb62('0x24'),util[_0xeb62('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x40584b['data1'][_0xeb62('0x14')](),_0x40584b['data2']));}}else{}}catch(_0x448327){console['error'](_0x448327);}}}};