Built motion from commit (unavailable).|2.4.21
[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 _0x14a0=['../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./dynamics365','./freshsales','zendesk','freshdesk','zoho','desk','freshsales','data1','toLowerCase','data2','find','Configurations','queue','outbound','log','unmanaged','salesforce','sugarcrm','vtiger','servicenow','dynamics365'];(function(_0x258d09,_0x5717d3){var _0x189452=function(_0x323ae7){while(--_0x323ae7){_0x258d09['push'](_0x258d09['shift']());}};_0x189452(++_0x5717d3);}(_0x14a0,0x8e));var _0x014a=function(_0x31ff27,_0x2d72ea){_0x31ff27=_0x31ff27-0x0;var _0x45514f=_0x14a0[_0x31ff27];return _0x45514f;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var zendesk=require(_0x014a('0x1'));var salesforce=require(_0x014a('0x2'));var sugarcrm=require(_0x014a('0x3'));var freshdesk=require(_0x014a('0x4'));var zoho=require(_0x014a('0x5'));var desk=require(_0x014a('0x6'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x014a('0x7'));var freshsales=require(_0x014a('0x8'));var integrations=[_0x014a('0x9'),'salesforce','sugarcrm',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'vtiger','dynamics365',_0x014a('0xd'),'servicenow'];exports['exec']=function(_0x5aa52f,_0x4f3539,_0x330469,_0x4c7418,_0x431be8,_0x168c70){if(_0x330469){if(_['includes'](integrations,_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')]())){try{var _0x2c84ad=null;var _0x43bfeb='';var _0x1bcd1=_0x330469[_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')]()];if(_0x1bcd1){var _0x23c917=_0x1bcd1[_0x5aa52f[_0x014a('0x10')]];if(_0x23c917){var _0x71535d=_[_0x014a('0x11')](_0x23c917[_0x014a('0x12')],{'id':parseInt(_0x5aa52f['data3'],0xa)});if(_0x71535d){if(_0x4c7418){if(_0x431be8&&_0x4f3539[_0x014a('0x13')]){_0x43bfeb=_0x014a('0x13');}else if(_0x4f3539['routeId']){_0x43bfeb=_0x014a('0x14');}else{console[_0x014a('0x15')]('EVENT\x20UNKNOWN',_0x4f3539);}}else{_0x43bfeb=_0x014a('0x16');}switch(_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')]()){case _0x014a('0x9'):zendesk[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0x17'):salesforce[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0x18'):sugarcrm[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0xa'):freshdesk[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0xb'):zoho[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0xc'):desk[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0x19'):vtiger[_0x43bfeb](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70);break;case _0x014a('0xd'):freshsales['cs'](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70,_0x43bfeb);break;case _0x014a('0x1a'):servicenow['cs'](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70,_0x43bfeb);break;case _0x014a('0x1b'):dynamics365['cs'](_0x5aa52f,_0x4f3539,_0x71535d,_0x4c7418,_0x431be8,_0x23c917,_0x168c70,_0x43bfeb);break;default:console[_0x014a('0x15')]('unknown\x20integration');}}else{_0x2c84ad=require(_0x014a('0x1c'))(_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')]());_0x2c84ad[_0x014a('0x1d')](_0x014a('0x1e'),util[_0x014a('0x1f')](_0x014a('0x20'),_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')](),_0x5aa52f['data3']));}}else{_0x2c84ad=require(_0x014a('0x1c'))(_0x5aa52f['data1'][_0x014a('0xf')]());_0x2c84ad[_0x014a('0x1d')](_0x014a('0x1e'),util[_0x014a('0x1f')](_0x014a('0x21'),_0x5aa52f[_0x014a('0xe')][_0x014a('0xf')](),_0x5aa52f[_0x014a('0x10')]));}}else{}}catch(_0x165a42){console['error'](_0x165a42);}}}};