Built motion from commit 775e2a94.|2.6.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 _0x25d1=['count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','chat','fax','sms','whatsapp','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent'];(function(_0x3c1a37,_0x58d56e){var _0x44a11d=function(_0x549247){while(--_0x549247){_0x3c1a37['push'](_0x3c1a37['shift']());}};_0x44a11d(++_0x58d56e);}(_0x25d1,0xf5));var _0x125d=function(_0x314c1d,_0x3fba0c){_0x314c1d=_0x314c1d-0x0;var _0x511529=_0x25d1[_0x314c1d];return _0x511529;};'use strict';var _=require(_0x125d('0x0'));var BPromise=require(_0x125d('0x1'));var db=require(_0x125d('0x2'))['db'];var util=require(_0x125d('0x3'));var channels=[_0x125d('0x4'),'mail',_0x125d('0x5'),_0x125d('0x6'),_0x125d('0x7'),_0x125d('0x8'),'openchannel'];exports[_0x125d('0x9')]=function(){return channels;};exports[_0x125d('0xa')]=function(_0x35cb8e){_0x35cb8e=_0x35cb8e[_0x125d('0xb')]();return _['includes'](channels,_0x35cb8e);};exports[_0x125d('0xc')]=function(_0x57eac6,_0x54001a,_0x34c437,_0x52885e){var _0x4af1c9={'loginAttempts':_0x54001a,'blocked':_0x34c437};if(!_[_0x125d('0xd')](_0x52885e)){_0x4af1c9[_0x125d('0xe')]=_0x52885e;}return _0x57eac6[_0x125d('0xf')](_0x4af1c9);};exports[_0x125d('0x10')]=function(_0x10074b){return new BPromise(function(_0x2afe05,_0x339556){var _0x228c0d=0x0;if(_0x10074b[_0x125d('0x11')]!==_0x125d('0x12')){_0x2afe05(_0x10074b);}db['User'][_0x125d('0x13')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x10074b['id']}}})[_0x125d('0x14')](function(_0x187967){_0x228c0d=_0x187967;return util[_0x125d('0x10')]();})[_0x125d('0x14')](function(_0xeb02cd){if(_0xeb02cd&&_0xeb02cd[_0x125d('0x15')]&&_0x228c0d>=_0xeb02cd[_0x125d('0x15')]){throw Error(_0x125d('0x16'));}_0x2afe05(_0x10074b);})[_0x125d('0x17')](function(_0x27ddd6){_0x339556(_0x27ddd6);});});};