Built motion from commit (unavailable).|2.6.0
[motion2.git] / server / config / utils.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 _0x24db=['isUndefined','blockedAt','role','agent','User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x24db,0xec));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb24d('0x0'));var BPromise=require(_0xb24d('0x1'));var db=require(_0xb24d('0x2'))['db'];var util=require(_0xb24d('0x3'));var channels=['voice',_0xb24d('0x4'),_0xb24d('0x5'),_0xb24d('0x6'),_0xb24d('0x7'),_0xb24d('0x8'),_0xb24d('0x9')];exports[_0xb24d('0xa')]=function(){return channels;};exports[_0xb24d('0xb')]=function(_0x400fd7){_0x400fd7=_0x400fd7['toLowerCase']();return _[_0xb24d('0xc')](channels,_0x400fd7);};exports[_0xb24d('0xd')]=function(_0xeabf25,_0xce63fe,_0x29fecc,_0x567a58){var _0x231c65={'loginAttempts':_0xce63fe,'blocked':_0x29fecc};if(!_[_0xb24d('0xe')](_0x567a58)){_0x231c65[_0xb24d('0xf')]=_0x567a58;}return _0xeabf25['updateAttributes'](_0x231c65);};exports['getLicense']=function(_0x44923e){return new BPromise(function(_0x36326b,_0x205afc){var _0xcce3f8=0x0;if(_0x44923e[_0xb24d('0x10')]!==_0xb24d('0x11')){_0x36326b(_0x44923e);}db[_0xb24d('0x12')][_0xb24d('0x13')]({'where':{'role':_0xb24d('0x11'),'online':!![],'id':{'$ne':_0x44923e['id']}}})[_0xb24d('0x14')](function(_0x1ee26f){_0xcce3f8=_0x1ee26f;return util[_0xb24d('0x15')]();})[_0xb24d('0x14')](function(_0x1ac34c){if(_0x1ac34c&&_0x1ac34c[_0xb24d('0x16')]&&_0xcce3f8>=_0x1ac34c[_0xb24d('0x16')]){throw Error(_0xb24d('0x17'));}_0x36326b(_0x44923e);})[_0xb24d('0x18')](function(_0x4bc7ea){_0x205afc(_0x4bc7ea);});});};