Built motion from commit (unavailable).|2.5.13
[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 _0xbec6=['join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyType','key','format','%s:\x20%s','keyContent'];(function(_0x285a14,_0x394a27){var _0x3430cc=function(_0x46d2d7){while(--_0x46d2d7){_0x285a14['push'](_0x285a14['shift']());}};_0x3430cc(++_0x394a27);}(_0xbec6,0x104));var _0x6bec=function(_0x15942a,_0x13b58c){_0x15942a=_0x15942a-0x0;var _0x36a9fb=_0xbec6[_0x15942a];return _0x36a9fb;};'use strict';var _=require(_0x6bec('0x0'));var util=require(_0x6bec('0x1'));exports[_0x6bec('0x2')]=function(_0x4e4079,_0x3839fb,_0x2e0164){var _0x35d084=[];if(_0x4e4079[_0x6bec('0x3')]>0x0){var _0x48f2b8=_[_0x6bec('0x4')](_0x4e4079,['id']);for(var _0x243618=0x0;_0x243618<_0x48f2b8[_0x6bec('0x3')];_0x243618++){var _0x277e02=_0x48f2b8[_0x243618];if(_0x277e02[_0x6bec('0x5')]===_0x6bec('0x6')){_0x35d084[_0x6bec('0x7')](_0x277e02['content']);}else if(_0x277e02['type']===_0x6bec('0x8')&&_0x277e02[_0x6bec('0x9')]){_0x3839fb[_0x277e02[_0x6bec('0x9')]]&&_0x35d084[_0x6bec('0x7')](_0x3839fb[_0x277e02[_0x6bec('0x9')]]['toString']());}else if(_0x277e02['type']===_0x6bec('0xa')&&_0x277e02[_0x6bec('0xb')]&&_0x277e02[_0x6bec('0xb')][_0x6bec('0xc')]){_0x3839fb[_0x277e02[_0x6bec('0xb')]['name'][_0x6bec('0xd')]()]&&_0x35d084[_0x6bec('0x7')](_0x3839fb[_0x277e02[_0x6bec('0xb')][_0x6bec('0xc')]['toLowerCase']()][_0x6bec('0xe')]());}else if(_0x277e02['type']==='keyValue'){if(_0x277e02[_0x6bec('0xf')]===_0x6bec('0x6')&&_0x277e02[_0x6bec('0x10')]){_0x35d084[_0x6bec('0x7')](util[_0x6bec('0x11')](_0x6bec('0x12'),_0x277e02[_0x6bec('0x10')],_0x277e02[_0x6bec('0x13')]));}else if(_0x277e02['keyType']==='variable'&&_0x277e02[_0x6bec('0x9')]&&_0x277e02[_0x6bec('0x10')]){_0x3839fb[_0x277e02[_0x6bec('0x9')]]&&_0x35d084[_0x6bec('0x7')](util[_0x6bec('0x11')](_0x6bec('0x12'),_0x277e02[_0x6bec('0x10')],_0x3839fb[_0x277e02['variableName']]));}else if(_0x277e02[_0x6bec('0xf')]===_0x6bec('0xa')&&_0x277e02[_0x6bec('0xb')]&&_0x277e02['Variable'][_0x6bec('0xc')]&&_0x277e02[_0x6bec('0x10')]){_0x3839fb[_0x277e02['Variable'][_0x6bec('0xc')]['toLowerCase']()]&&_0x35d084['push'](util[_0x6bec('0x11')](_0x6bec('0x12'),_0x277e02[_0x6bec('0x10')],_0x3839fb[_0x277e02[_0x6bec('0xb')][_0x6bec('0xc')][_0x6bec('0xd')]()]));}}}}return _0x35d084[_0x6bec('0x14')](_0x2e0164);};exports[_0x6bec('0x15')]=function(_0x7110f8){var _0x5509d6=_0x7110f8[_0x6bec('0x16')](-0x1);if(_0x5509d6==='/'){_0x7110f8=_0x7110f8[_0x6bec('0x17')](0x0,_0x7110f8[_0x6bec('0x18')](_0x5509d6));}return _0x7110f8;};exports[_0x6bec('0x19')]=function(_0x4c2ff0){if(!_[_0x6bec('0x1a')](_0x4c2ff0)&&_0x4c2ff0!==''){var _0x295653=/^(([^<>()\[\]\\.,;:\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 _0x295653[_0x6bec('0x1b')](String(_0x4c2ff0)['toLowerCase']());}else{return![];}};