Built motion from commit d5e4af8c.|2.6.23
[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 _0x12e2=['chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','voice'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x12e2,0xcb));var _0x212e=function(_0x5096f2,_0x428e9e){_0x5096f2=_0x5096f2-0x0;var _0x1200b4=_0x12e2[_0x5096f2];return _0x1200b4;};'use strict';var _=require(_0x212e('0x0'));var BPromise=require('bluebird');var db=require(_0x212e('0x1'))['db'];var util=require(_0x212e('0x2'));var channels=[_0x212e('0x3'),'mail',_0x212e('0x4'),_0x212e('0x5'),_0x212e('0x6'),_0x212e('0x7'),_0x212e('0x8')];exports[_0x212e('0x9')]=function(){return channels;};exports[_0x212e('0xa')]=function(_0x4a8fcc){_0x4a8fcc=_0x4a8fcc['toLowerCase']();return _[_0x212e('0xb')](channels,_0x4a8fcc);};exports[_0x212e('0xc')]=function(_0x3f184d,_0x994f9d,_0x1301f6,_0x69a5d){var _0xd1e322={'loginAttempts':_0x994f9d,'blocked':_0x1301f6};if(!_[_0x212e('0xd')](_0x69a5d)){_0xd1e322[_0x212e('0xe')]=_0x69a5d;}return _0x3f184d[_0x212e('0xf')](_0xd1e322);};exports[_0x212e('0x10')]=function(_0x1fb6f7){return new BPromise(function(_0x2e614e,_0x95fffc){var _0x4095cb=0x0;if(_0x1fb6f7[_0x212e('0x11')]!==_0x212e('0x12')){_0x2e614e(_0x1fb6f7);}db['User']['count']({'where':{'role':_0x212e('0x12'),'online':!![],'id':{'$ne':_0x1fb6f7['id']}}})['then'](function(_0x4e5741){_0x4095cb=_0x4e5741;return util[_0x212e('0x10')]();})[_0x212e('0x13')](function(_0x111f50){if(_0x111f50&&_0x111f50[_0x212e('0x14')]&&_0x4095cb>=_0x111f50[_0x212e('0x14')]){throw Error(_0x212e('0x15'));}_0x2e614e(_0x1fb6f7);})[_0x212e('0x16')](function(_0x4392cb){_0x95fffc(_0x4392cb);});});};