Built motion from commit (unavailable).|2.5.6
[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 _0xb03e=['outbound','log','unmanaged','salesforce','freshsales','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId'];(function(_0x5b161d,_0x59367e){var _0x480092=function(_0x22abc5){while(--_0x22abc5){_0x5b161d['push'](_0x5b161d['shift']());}};_0x480092(++_0x59367e);}(_0xb03e,0x1eb));var _0xeb03=function(_0x301875,_0x272137){_0x301875=_0x301875-0x0;var _0x31df39=_0xb03e[_0x301875];return _0x31df39;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var zendesk=require(_0xeb03('0x1'));var salesforce=require(_0xeb03('0x2'));var sugarcrm=require(_0xeb03('0x3'));var freshdesk=require(_0xeb03('0x4'));var zoho=require(_0xeb03('0x5'));var desk=require(_0xeb03('0x6'));var vtiger=require(_0xeb03('0x7'));var servicenow=require(_0xeb03('0x8'));var dynamics365=require(_0xeb03('0x9'));var freshsales=require(_0xeb03('0xa'));var integrations=[_0xeb03('0xb'),'salesforce',_0xeb03('0xc'),_0xeb03('0xd'),_0xeb03('0xe'),_0xeb03('0xf'),_0xeb03('0x10'),_0xeb03('0x11'),'freshsales',_0xeb03('0x12')];exports[_0xeb03('0x13')]=function(_0x14cfa0,_0x4f5013,_0x31af2c,_0x48af4f,_0x2388eb,_0x218c41){if(_0x31af2c){if(_[_0xeb03('0x14')](integrations,_0x14cfa0[_0xeb03('0x15')][_0xeb03('0x16')]())){try{var _0x45481b=null;var _0x367d36='';var _0x384cbe=_0x31af2c[_0x14cfa0[_0xeb03('0x15')][_0xeb03('0x16')]()];if(_0x384cbe){var _0x39ab62=_0x384cbe[_0x14cfa0[_0xeb03('0x17')]];if(_0x39ab62){var _0x4d9c8e=_[_0xeb03('0x18')](_0x39ab62[_0xeb03('0x19')],{'id':parseInt(_0x14cfa0[_0xeb03('0x1a')],0xa)});if(_0x4d9c8e){if(_0x48af4f){if(_0x2388eb&&_0x4f5013[_0xeb03('0x1b')]){_0x367d36='queue';}else if(_0x4f5013[_0xeb03('0x1c')]){_0x367d36=_0xeb03('0x1d');}else{console[_0xeb03('0x1e')]('EVENT\x20UNKNOWN',_0x4f5013);}}else{_0x367d36=_0xeb03('0x1f');}switch(_0x14cfa0[_0xeb03('0x15')][_0xeb03('0x16')]()){case _0xeb03('0xb'):zendesk[_0x367d36](_0x14cfa0,_0x4f5013,_0x4d9c8e,_0x48af4f,_0x2388eb,_0x39ab62,_0x218c41);break;case _0xeb03('0x20'):salesforce[_0x367d36](_0x14cfa0,_0x4f5013,_0x4d9c8e,_0x48af4f,_0x2388eb,_0x39ab62,_0x218c41);break;case _0xeb03('0xc'):sugarcrm[_0x367d36](_0x14cfa0,_0x4f5013,_0x4d9c8e,_0x48af4f,_0x2388eb,_0x39ab62,_0x218c41);break;case _0xeb03('0xd'):freshdesk[_0x367d36](_0x14cfa0,_0x4f5013,_0x4d9c8e,_0x48af4f,_0x2388eb,_0x39ab62,_0x218c41);break;case _0xeb03('0xe'):zoho[_0x367d36](_0x14cfa0,_0x4f5013,_0x4d9c8e,_0x48af4f,_0x2388eb,_0x39ab62,_0x218c41);break;case _0xeb03('0xf'):desk[_0x367d36](_0x14cfa0,_0x4f5013,_0x4d9c8e,_0x48af4f,_0x2388eb,_0x39ab62,_0x218c41);break;case _0xeb03('0x10'):vtiger[_0x367d36](_0x14cfa0,_0x4f5013,_0x4d9c8e,_0x48af4f,_0x2388eb,_0x39ab62,_0x218c41);break;case _0xeb03('0x21'):freshsales['cs'](_0x14cfa0,_0x4f5013,_0x4d9c8e,_0x48af4f,_0x2388eb,_0x39ab62,_0x218c41,_0x367d36);break;case _0xeb03('0x12'):servicenow['cs'](_0x14cfa0,_0x4f5013,_0x4d9c8e,_0x48af4f,_0x2388eb,_0x39ab62,_0x218c41,_0x367d36);break;case _0xeb03('0x11'):dynamics365['cs'](_0x14cfa0,_0x4f5013,_0x4d9c8e,_0x48af4f,_0x2388eb,_0x39ab62,_0x218c41,_0x367d36);break;default:console[_0xeb03('0x1e')]('unknown\x20integration');}}else{_0x45481b=require(_0xeb03('0x22'))(_0x14cfa0[_0xeb03('0x15')][_0xeb03('0x16')]());_0x45481b[_0xeb03('0x23')](_0xeb03('0x24'),util[_0xeb03('0x25')](_0xeb03('0x26'),_0x14cfa0[_0xeb03('0x15')][_0xeb03('0x16')](),_0x14cfa0['data3']));}}else{_0x45481b=require(_0xeb03('0x22'))(_0x14cfa0[_0xeb03('0x15')][_0xeb03('0x16')]());_0x45481b[_0xeb03('0x23')](_0xeb03('0x24'),util['format'](_0xeb03('0x27'),_0x14cfa0[_0xeb03('0x15')][_0xeb03('0x16')](),_0x14cfa0[_0xeb03('0x17')]));}}else{}}catch(_0x3f276a){console[_0xeb03('0x23')](_0x3f276a);}}}};