Built motion from commit e2351160.|2.5.50
[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 _0x2da5=['mail','chat','fax','sms','whatsapp','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice'];(function(_0x2f4831,_0x17d160){var _0x1b2fa7=function(_0x54317f){while(--_0x54317f){_0x2f4831['push'](_0x2f4831['shift']());}};_0x1b2fa7(++_0x17d160);}(_0x2da5,0xeb));var _0x52da=function(_0x12a2b9,_0x5ce506){_0x12a2b9=_0x12a2b9-0x0;var _0x4f9fa3=_0x2da5[_0x12a2b9];return _0x4f9fa3;};'use strict';var _=require(_0x52da('0x0'));var BPromise=require(_0x52da('0x1'));var db=require(_0x52da('0x2'))['db'];var util=require(_0x52da('0x3'));var channels=[_0x52da('0x4'),_0x52da('0x5'),_0x52da('0x6'),_0x52da('0x7'),_0x52da('0x8'),_0x52da('0x9'),'openchannel'];exports['getChannels']=function(){return channels;};exports[_0x52da('0xa')]=function(_0x16d61f){_0x16d61f=_0x16d61f[_0x52da('0xb')]();return _[_0x52da('0xc')](channels,_0x16d61f);};exports[_0x52da('0xd')]=function(_0x47bc4e,_0x3ef5de,_0x12ad95,_0x52496c){var _0x12e781={'loginAttempts':_0x3ef5de,'blocked':_0x12ad95};if(!_[_0x52da('0xe')](_0x52496c)){_0x12e781[_0x52da('0xf')]=_0x52496c;}return _0x47bc4e[_0x52da('0x10')](_0x12e781);};exports[_0x52da('0x11')]=function(_0x5990d0){return new BPromise(function(_0x26215c,_0x340123){var _0x35136c=0x0;if(_0x5990d0['role']!=='agent'){_0x26215c(_0x5990d0);}db[_0x52da('0x12')][_0x52da('0x13')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x5990d0['id']}}})[_0x52da('0x14')](function(_0xe37277){_0x35136c=_0xe37277;return util['getLicense']();})[_0x52da('0x14')](function(_0x4f9e1e){if(_0x4f9e1e&&_0x4f9e1e[_0x52da('0x15')]&&_0x35136c>=_0x4f9e1e[_0x52da('0x15')]){throw Error(_0x52da('0x16'));}_0x26215c(_0x5990d0);})[_0x52da('0x17')](function(_0x2f1eb0){_0x340123(_0x2f1eb0);});});};