Built motion from commit bab6f49e.|2.6.17
[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 _0x8edb=['includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','voice','mail','fax','openchannel','getChannels','isValidChannel','toLowerCase'];(function(_0xf5d62a,_0x14ce6e){var _0x573db5=function(_0x56cf3f){while(--_0x56cf3f){_0xf5d62a['push'](_0xf5d62a['shift']());}};_0x573db5(++_0x14ce6e);}(_0x8edb,0xe8));var _0xb8ed=function(_0x1932fe,_0x47632c){_0x1932fe=_0x1932fe-0x0;var _0x18b078=_0x8edb[_0x1932fe];return _0x18b078;};'use strict';var _=require(_0xb8ed('0x0'));var BPromise=require(_0xb8ed('0x1'));var db=require(_0xb8ed('0x2'))['db'];var util=require('./license/util');var channels=[_0xb8ed('0x3'),_0xb8ed('0x4'),'chat',_0xb8ed('0x5'),'sms','whatsapp',_0xb8ed('0x6')];exports[_0xb8ed('0x7')]=function(){return channels;};exports[_0xb8ed('0x8')]=function(_0xec1933){_0xec1933=_0xec1933[_0xb8ed('0x9')]();return _[_0xb8ed('0xa')](channels,_0xec1933);};exports[_0xb8ed('0xb')]=function(_0x56d1d0,_0x4a8cb6,_0x5e8d8c,_0x407026){var _0x3485a9={'loginAttempts':_0x4a8cb6,'blocked':_0x5e8d8c};if(!_[_0xb8ed('0xc')](_0x407026)){_0x3485a9[_0xb8ed('0xd')]=_0x407026;}return _0x56d1d0[_0xb8ed('0xe')](_0x3485a9);};exports[_0xb8ed('0xf')]=function(_0x13e5cc){return new BPromise(function(_0x52f30a,_0x57aaf5){var _0x2148f7=0x0;if(_0x13e5cc['role']!==_0xb8ed('0x10')){_0x52f30a(_0x13e5cc);}db['User'][_0xb8ed('0x11')]({'where':{'role':_0xb8ed('0x10'),'online':!![],'id':{'$ne':_0x13e5cc['id']}}})[_0xb8ed('0x12')](function(_0x47f484){_0x2148f7=_0x47f484;return util['getLicense']();})[_0xb8ed('0x12')](function(_0x2735e0){if(_0x2735e0&&_0x2735e0[_0xb8ed('0x13')]&&_0x2148f7>=_0x2735e0['agents']){throw Error(_0xb8ed('0x14'));}_0x52f30a(_0x13e5cc);})[_0xb8ed('0x15')](function(_0x578574){_0x57aaf5(_0x578574);});});};