aa1238969cd6cd79c30bc4d6a402fcfc3208a3ca
[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 _0x7ed4=['updateAttributes','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','blockedAt'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0x7ed4,0x18f));var _0x47ed=function(_0x18c8b5,_0x2a15d3){_0x18c8b5=_0x18c8b5-0x0;var _0x358984=_0x7ed4[_0x18c8b5];return _0x358984;};'use strict';var _=require(_0x47ed('0x0'));var BPromise=require(_0x47ed('0x1'));var db=require(_0x47ed('0x2'))['db'];var util=require(_0x47ed('0x3'));var channels=[_0x47ed('0x4'),_0x47ed('0x5'),_0x47ed('0x6'),'fax',_0x47ed('0x7'),'whatsapp',_0x47ed('0x8')];exports[_0x47ed('0x9')]=function(){return channels;};exports[_0x47ed('0xa')]=function(_0x164c6a){_0x164c6a=_0x164c6a[_0x47ed('0xb')]();return _[_0x47ed('0xc')](channels,_0x164c6a);};exports[_0x47ed('0xd')]=function(_0xcd8de1,_0x32aeb7,_0x15fb1e,_0x4af757){var _0x584313={'loginAttempts':_0x32aeb7,'blocked':_0x15fb1e};if(!_['isUndefined'](_0x4af757)){_0x584313[_0x47ed('0xe')]=_0x4af757;}return _0xcd8de1[_0x47ed('0xf')](_0x584313);};exports['getLicense']=function(_0xbf7f81){return new BPromise(function(_0x5525b1,_0xad3ca5){var _0x1e4a99=0x0;if(_0xbf7f81[_0x47ed('0x10')]!==_0x47ed('0x11')){_0x5525b1(_0xbf7f81);}db[_0x47ed('0x12')][_0x47ed('0x13')]({'where':{'role':_0x47ed('0x11'),'online':!![],'id':{'$ne':_0xbf7f81['id']}}})[_0x47ed('0x14')](function(_0x29d537){_0x1e4a99=_0x29d537;return util['getLicense']();})[_0x47ed('0x14')](function(_0x255dc0){if(_0x255dc0&&_0x255dc0[_0x47ed('0x15')]&&_0x1e4a99>=_0x255dc0[_0x47ed('0x15')]){throw Error(_0x47ed('0x16'));}_0x5525b1(_0xbf7f81);})['catch'](function(_0x41e784){_0xad3ca5(_0x41e784);});});};