Built motion from commit 936e8062.|2.5.33
[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 _0x7acd=['role','agent','User','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','isUndefined','updateAttributes','getLicense'];(function(_0x243d14,_0xa28ccb){var _0x20ccee=function(_0x1c3c97){while(--_0x1c3c97){_0x243d14['push'](_0x243d14['shift']());}};_0x20ccee(++_0xa28ccb);}(_0x7acd,0x1e9));var _0xd7ac=function(_0x5ee21d,_0x163480){_0x5ee21d=_0x5ee21d-0x0;var _0x442f38=_0x7acd[_0x5ee21d];return _0x442f38;};'use strict';var _=require(_0xd7ac('0x0'));var BPromise=require(_0xd7ac('0x1'));var db=require(_0xd7ac('0x2'))['db'];var util=require('./license/util');var channels=[_0xd7ac('0x3'),_0xd7ac('0x4'),_0xd7ac('0x5'),_0xd7ac('0x6'),_0xd7ac('0x7'),_0xd7ac('0x8'),_0xd7ac('0x9')];exports[_0xd7ac('0xa')]=function(){return channels;};exports[_0xd7ac('0xb')]=function(_0x3715d9){_0x3715d9=_0x3715d9[_0xd7ac('0xc')]();return _[_0xd7ac('0xd')](channels,_0x3715d9);};exports['clearBlockUser']=function(_0x22244b,_0x2acac9,_0x21ca0a,_0x3b770e){var _0x190719={'loginAttempts':_0x2acac9,'blocked':_0x21ca0a};if(!_[_0xd7ac('0xe')](_0x3b770e)){_0x190719['blockedAt']=_0x3b770e;}return _0x22244b[_0xd7ac('0xf')](_0x190719);};exports[_0xd7ac('0x10')]=function(_0x135ca4){return new BPromise(function(_0x7992d3,_0xfe0802){var _0x4e0b59=0x0;if(_0x135ca4[_0xd7ac('0x11')]!==_0xd7ac('0x12')){_0x7992d3(_0x135ca4);}db[_0xd7ac('0x13')]['count']({'where':{'role':_0xd7ac('0x12'),'online':!![],'id':{'$ne':_0x135ca4['id']}}})['then'](function(_0xc7e7b8){_0x4e0b59=_0xc7e7b8;return util[_0xd7ac('0x10')]();})[_0xd7ac('0x14')](function(_0x3eb86f){if(_0x3eb86f&&_0x3eb86f[_0xd7ac('0x15')]&&_0x4e0b59>=_0x3eb86f[_0xd7ac('0x15')]){throw Error(_0xd7ac('0x16'));}_0x7992d3(_0x135ca4);})['catch'](function(_0x195932){_0xfe0802(_0x195932);});});};