Built motion from commit (unavailable).|2.5.9
[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 _0x3966=['bluebird','../mysqldb','mail','chat','fax','sms','whatsapp','isValidChannel','toLowerCase','includes','clearBlockUser','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash'];(function(_0x48df04,_0x1522b1){var _0x4de5fa=function(_0x3ae6db){while(--_0x3ae6db){_0x48df04['push'](_0x48df04['shift']());}};_0x4de5fa(++_0x1522b1);}(_0x3966,0xc5));var _0x6396=function(_0xaf9d09,_0xdf106b){_0xaf9d09=_0xaf9d09-0x0;var _0x10428e=_0x3966[_0xaf9d09];return _0x10428e;};'use strict';var _=require(_0x6396('0x0'));var BPromise=require(_0x6396('0x1'));var db=require(_0x6396('0x2'))['db'];var util=require('./license/util');var channels=['voice',_0x6396('0x3'),_0x6396('0x4'),_0x6396('0x5'),_0x6396('0x6'),_0x6396('0x7'),'openchannel'];exports['getChannels']=function(){return channels;};exports[_0x6396('0x8')]=function(_0x1fc2c3){_0x1fc2c3=_0x1fc2c3[_0x6396('0x9')]();return _[_0x6396('0xa')](channels,_0x1fc2c3);};exports[_0x6396('0xb')]=function(_0x23d57f,_0xbba7c4,_0x125958,_0x597e2d){var _0x51ab28={'loginAttempts':_0xbba7c4,'blocked':_0x125958};if(!_['isUndefined'](_0x597e2d)){_0x51ab28['blockedAt']=_0x597e2d;}return _0x23d57f[_0x6396('0xc')](_0x51ab28);};exports[_0x6396('0xd')]=function(_0x143cf9){return new BPromise(function(_0x58185e,_0x29cd42){var _0x38c7b6=0x0;if(_0x143cf9[_0x6396('0xe')]!==_0x6396('0xf')){_0x58185e(_0x143cf9);}db[_0x6396('0x10')][_0x6396('0x11')]({'where':{'role':_0x6396('0xf'),'online':!![],'id':{'$ne':_0x143cf9['id']}}})[_0x6396('0x12')](function(_0xb95fb2){_0x38c7b6=_0xb95fb2;return util[_0x6396('0xd')]();})[_0x6396('0x12')](function(_0x3633b0){if(_0x3633b0&&_0x3633b0[_0x6396('0x13')]&&_0x38c7b6>=_0x3633b0[_0x6396('0x13')]){throw Error(_0x6396('0x14'));}_0x58185e(_0x143cf9);})[_0x6396('0x15')](function(_0x5a4fce){_0x29cd42(_0x5a4fce);});});};