Built motion from commit 598073ad.|2.5.44
[motion2.git] / server / services / ami / trigger / integration / util.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 _0x721f=['name','toLowerCase','keyType','format','%s:\x20%s','key','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','getString','length','type','string','push','content','variable','variableName','toString','customVariable','Variable'];(function(_0x327c4a,_0x2a85c8){var _0x214159=function(_0x4dc202){while(--_0x4dc202){_0x327c4a['push'](_0x327c4a['shift']());}};_0x214159(++_0x2a85c8);}(_0x721f,0xd6));var _0xf721=function(_0x3356af,_0x23a001){_0x3356af=_0x3356af-0x0;var _0x402610=_0x721f[_0x3356af];return _0x402610;};'use strict';var _=require('lodash');var util=require('util');exports[_0xf721('0x0')]=function(_0x4b0c6b,_0x50d9eb,_0x1143ff){var _0x3b1426=[];if(_0x4b0c6b[_0xf721('0x1')]>0x0){var _0x5584ad=_['sortBy'](_0x4b0c6b,['id']);for(var _0x50098a=0x0;_0x50098a<_0x5584ad[_0xf721('0x1')];_0x50098a++){var _0xc5bed0=_0x5584ad[_0x50098a];if(_0xc5bed0[_0xf721('0x2')]===_0xf721('0x3')){_0x3b1426[_0xf721('0x4')](_0xc5bed0[_0xf721('0x5')]);}else if(_0xc5bed0[_0xf721('0x2')]===_0xf721('0x6')&&_0xc5bed0['variableName']){_0x50d9eb[_0xc5bed0[_0xf721('0x7')]]&&_0x3b1426[_0xf721('0x4')](_0x50d9eb[_0xc5bed0[_0xf721('0x7')]][_0xf721('0x8')]());}else if(_0xc5bed0[_0xf721('0x2')]===_0xf721('0x9')&&_0xc5bed0[_0xf721('0xa')]&&_0xc5bed0[_0xf721('0xa')][_0xf721('0xb')]){_0x50d9eb[_0xc5bed0[_0xf721('0xa')]['name'][_0xf721('0xc')]()]&&_0x3b1426[_0xf721('0x4')](_0x50d9eb[_0xc5bed0[_0xf721('0xa')][_0xf721('0xb')][_0xf721('0xc')]()][_0xf721('0x8')]());}else if(_0xc5bed0['type']==='keyValue'){if(_0xc5bed0[_0xf721('0xd')]===_0xf721('0x3')&&_0xc5bed0['key']){_0x3b1426[_0xf721('0x4')](util[_0xf721('0xe')](_0xf721('0xf'),_0xc5bed0[_0xf721('0x10')],_0xc5bed0['keyContent']));}else if(_0xc5bed0[_0xf721('0xd')]===_0xf721('0x6')&&_0xc5bed0[_0xf721('0x7')]&&_0xc5bed0[_0xf721('0x10')]){_0x50d9eb[_0xc5bed0['variableName']]&&_0x3b1426[_0xf721('0x4')](util['format']('%s:\x20%s',_0xc5bed0[_0xf721('0x10')],_0x50d9eb[_0xc5bed0[_0xf721('0x7')]]));}else if(_0xc5bed0[_0xf721('0xd')]===_0xf721('0x9')&&_0xc5bed0[_0xf721('0xa')]&&_0xc5bed0[_0xf721('0xa')][_0xf721('0xb')]&&_0xc5bed0[_0xf721('0x10')]){_0x50d9eb[_0xc5bed0[_0xf721('0xa')]['name'][_0xf721('0xc')]()]&&_0x3b1426[_0xf721('0x4')](util['format'](_0xf721('0xf'),_0xc5bed0[_0xf721('0x10')],_0x50d9eb[_0xc5bed0[_0xf721('0xa')]['name'][_0xf721('0xc')]()]));}}}}return _0x3b1426[_0xf721('0x11')](_0x1143ff);};exports[_0xf721('0x12')]=function(_0x227427){var _0x5d09da=_0x227427[_0xf721('0x13')](-0x1);if(_0x5d09da==='/'){_0x227427=_0x227427[_0xf721('0x14')](0x0,_0x227427[_0xf721('0x15')](_0x5d09da));}return _0x227427;};exports[_0xf721('0x16')]=function(_0x14c7e8){if(!_[_0xf721('0x17')](_0x14c7e8)&&_0x14c7e8!==''){var _0x3aef3e=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x3aef3e[_0xf721('0x18')](String(_0x14c7e8)[_0xf721('0xc')]());}else{return![];}};