Built motion from commit (unavailable).|2.0.78
[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 _0xf537=['lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','zendesk','salesforce','sugarcrm','desk','exec','includes','data1','toLowerCase','data2','data3','queue','routeId','log','EVENT\x20UNKNOWN','zoho','vtiger','unknown\x20integration','../../../../config/logger','[EXEC]','error','format'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xf537,0x1a4));var _0x7f53=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf537[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7f53('0x0'));var util=require('util');var zendesk=require(_0x7f53('0x1'));var salesforce=require(_0x7f53('0x2'));var sugarcrm=require(_0x7f53('0x3'));var freshdesk=require(_0x7f53('0x4'));var zoho=require('./zoho');var desk=require(_0x7f53('0x5'));var vtiger=require(_0x7f53('0x6'));var integrations=[_0x7f53('0x7'),_0x7f53('0x8'),_0x7f53('0x9'),'freshdesk','zoho',_0x7f53('0xa'),'vtiger'];exports[_0x7f53('0xb')]=function(_0x40a03d,_0x47a993,_0x38abd6,_0x393daa,_0x204c74,_0x167e54){if(_0x38abd6){if(_[_0x7f53('0xc')](integrations,_0x40a03d[_0x7f53('0xd')][_0x7f53('0xe')]())){try{var _0x3554ba=null;var _0x222516='';var _0x202be5=_0x38abd6[_0x40a03d['data1'][_0x7f53('0xe')]()];if(_0x202be5){var _0x445a60=_0x202be5[_0x40a03d[_0x7f53('0xf')]];if(_0x445a60){var _0x4e2167=_['find'](_0x445a60['Configurations'],{'id':parseInt(_0x40a03d[_0x7f53('0x10')],0xa)});if(_0x4e2167){if(_0x393daa){if(_0x204c74&&_0x47a993[_0x7f53('0x11')]){_0x222516=_0x7f53('0x11');}else if(_0x47a993[_0x7f53('0x12')]){_0x222516='outbound';}else{console[_0x7f53('0x13')](_0x7f53('0x14'),_0x47a993);}}else{_0x222516='abandoned';}switch(_0x40a03d['data1'][_0x7f53('0xe')]()){case _0x7f53('0x7'):zendesk[_0x222516](_0x40a03d,_0x47a993,_0x4e2167,_0x393daa,_0x204c74,_0x445a60,_0x167e54);break;case _0x7f53('0x8'):salesforce[_0x222516](_0x40a03d,_0x47a993,_0x4e2167,_0x393daa,_0x204c74,_0x445a60,_0x167e54);break;case _0x7f53('0x9'):sugarcrm[_0x222516](_0x40a03d,_0x47a993,_0x4e2167,_0x393daa,_0x204c74,_0x445a60,_0x167e54);break;case'freshdesk':freshdesk[_0x222516](_0x40a03d,_0x47a993,_0x4e2167,_0x393daa,_0x204c74,_0x445a60,_0x167e54);break;case _0x7f53('0x15'):zoho[_0x222516](_0x40a03d,_0x47a993,_0x4e2167,_0x393daa,_0x204c74,_0x445a60,_0x167e54);break;case _0x7f53('0xa'):desk[_0x222516](_0x40a03d,_0x47a993,_0x4e2167,_0x393daa,_0x204c74,_0x445a60,_0x167e54);break;case _0x7f53('0x16'):vtiger[_0x222516](_0x40a03d,_0x47a993,_0x4e2167,_0x393daa,_0x204c74,_0x445a60,_0x167e54);break;default:console[_0x7f53('0x13')](_0x7f53('0x17'));}}else{_0x3554ba=require(_0x7f53('0x18'))(_0x40a03d['data1']['toLowerCase']());_0x3554ba['error'](_0x7f53('0x19'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x40a03d[_0x7f53('0xd')][_0x7f53('0xe')](),_0x40a03d[_0x7f53('0x10')]));}}else{_0x3554ba=require(_0x7f53('0x18'))(_0x40a03d['data1'][_0x7f53('0xe')]());_0x3554ba[_0x7f53('0x1a')]('[EXEC]',util[_0x7f53('0x1b')]('%s\x20account\x20#%s\x20not\x20found',_0x40a03d[_0x7f53('0xd')][_0x7f53('0xe')](),_0x40a03d['data2']));}}else{}}catch(_0x4e978c){console[_0x7f53('0x1a')](_0x4e978c);}}}};