Built motion from commit db94841.|2.5.3
[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 _0xba74=['mail','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','agent','User','count','then','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util'];(function(_0x284a61,_0x231686){var _0x220e3c=function(_0x104496){while(--_0x104496){_0x284a61['push'](_0x284a61['shift']());}};_0x220e3c(++_0x231686);}(_0xba74,0x1dc));var _0x4ba7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xba74[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x4ba7('0x0'));var BPromise=require(_0x4ba7('0x1'));var db=require(_0x4ba7('0x2'))['db'];var util=require(_0x4ba7('0x3'));var channels=['voice',_0x4ba7('0x4'),'chat',_0x4ba7('0x5'),_0x4ba7('0x6'),_0x4ba7('0x7'),_0x4ba7('0x8')];exports[_0x4ba7('0x9')]=function(){return channels;};exports[_0x4ba7('0xa')]=function(_0x343fc0){_0x343fc0=_0x343fc0[_0x4ba7('0xb')]();return _[_0x4ba7('0xc')](channels,_0x343fc0);};exports[_0x4ba7('0xd')]=function(_0x4032c5,_0x2a7e66,_0xa4b1e3,_0x2fa0b1){var _0x37141e={'loginAttempts':_0x2a7e66,'blocked':_0xa4b1e3};if(!_[_0x4ba7('0xe')](_0x2fa0b1)){_0x37141e[_0x4ba7('0xf')]=_0x2fa0b1;}return _0x4032c5[_0x4ba7('0x10')](_0x37141e);};exports[_0x4ba7('0x11')]=function(_0x705461){return new BPromise(function(_0x1d13a8,_0x5031ea){var _0x18b60e=0x0;if(_0x705461['role']!==_0x4ba7('0x12')){_0x1d13a8(_0x705461);}db[_0x4ba7('0x13')][_0x4ba7('0x14')]({'where':{'role':_0x4ba7('0x12'),'online':!![],'id':{'$ne':_0x705461['id']}}})[_0x4ba7('0x15')](function(_0x10e7fb){_0x18b60e=_0x10e7fb;return util[_0x4ba7('0x11')]();})[_0x4ba7('0x15')](function(_0x59842c){if(_0x59842c&&_0x59842c['agents']&&_0x18b60e>=_0x59842c['agents']){throw Error(_0x4ba7('0x16'));}_0x1d13a8(_0x705461);})[_0x4ba7('0x17')](function(_0x2c93bc){_0x5031ea(_0x2c93bc);});});};