Built motion from commit 6a0adb95.|2.6.31
[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 _0x3dce=['isNil','test','lodash','util','getString','length','sortBy','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail'];(function(_0x4a890,_0x4376a9){var _0x41ff9e=function(_0x21d153){while(--_0x21d153){_0x4a890['push'](_0x4a890['shift']());}};_0x41ff9e(++_0x4376a9);}(_0x3dce,0x1b5));var _0xe3dc=function(_0x86936a,_0xd11952){_0x86936a=_0x86936a-0x0;var _0x1ad2c5=_0x3dce[_0x86936a];return _0x1ad2c5;};'use strict';var _=require(_0xe3dc('0x0'));var util=require(_0xe3dc('0x1'));exports[_0xe3dc('0x2')]=function(_0xc044f5,_0x5ef48c,_0x4e4749){var _0x28e9df=[];if(_0xc044f5[_0xe3dc('0x3')]>0x0){var _0x56e716=_[_0xe3dc('0x4')](_0xc044f5,['id']);for(var _0x547538=0x0;_0x547538<_0x56e716[_0xe3dc('0x3')];_0x547538++){var _0x314262=_0x56e716[_0x547538];if(_0x314262['type']===_0xe3dc('0x5')){_0x28e9df[_0xe3dc('0x6')](_0x314262[_0xe3dc('0x7')]);}else if(_0x314262[_0xe3dc('0x8')]===_0xe3dc('0x9')&&_0x314262[_0xe3dc('0xa')]){_0x5ef48c[_0x314262[_0xe3dc('0xa')]]&&_0x28e9df['push'](_0x5ef48c[_0x314262['variableName']][_0xe3dc('0xb')]());}else if(_0x314262['type']===_0xe3dc('0xc')&&_0x314262[_0xe3dc('0xd')]&&_0x314262[_0xe3dc('0xd')][_0xe3dc('0xe')]){_0x5ef48c[_0x314262[_0xe3dc('0xd')]['name'][_0xe3dc('0xf')]()]&&_0x28e9df[_0xe3dc('0x6')](_0x5ef48c[_0x314262[_0xe3dc('0xd')][_0xe3dc('0xe')]['toLowerCase']()]['toString']());}else if(_0x314262['type']===_0xe3dc('0x10')){if(_0x314262[_0xe3dc('0x11')]===_0xe3dc('0x5')&&_0x314262[_0xe3dc('0x12')]){_0x28e9df['push'](util[_0xe3dc('0x13')](_0xe3dc('0x14'),_0x314262[_0xe3dc('0x12')],_0x314262['keyContent']));}else if(_0x314262[_0xe3dc('0x11')]==='variable'&&_0x314262[_0xe3dc('0xa')]&&_0x314262['key']){_0x5ef48c[_0x314262['variableName']]&&_0x28e9df['push'](util[_0xe3dc('0x13')]('%s:\x20%s',_0x314262[_0xe3dc('0x12')],_0x5ef48c[_0x314262['variableName']]));}else if(_0x314262[_0xe3dc('0x11')]==='customVariable'&&_0x314262[_0xe3dc('0xd')]&&_0x314262[_0xe3dc('0xd')][_0xe3dc('0xe')]&&_0x314262[_0xe3dc('0x12')]){_0x5ef48c[_0x314262['Variable']['name']['toLowerCase']()]&&_0x28e9df[_0xe3dc('0x6')](util[_0xe3dc('0x13')](_0xe3dc('0x14'),_0x314262[_0xe3dc('0x12')],_0x5ef48c[_0x314262['Variable'][_0xe3dc('0xe')][_0xe3dc('0xf')]()]));}}}}return _0x28e9df[_0xe3dc('0x15')](_0x4e4749);};exports[_0xe3dc('0x16')]=function(_0x1084fa){var _0x4258cb=_0x1084fa[_0xe3dc('0x17')](-0x1);if(_0x4258cb==='/'){_0x1084fa=_0x1084fa[_0xe3dc('0x18')](0x0,_0x1084fa[_0xe3dc('0x19')](_0x4258cb));}return _0x1084fa;};exports[_0xe3dc('0x1a')]=function(_0x129dab){if(!_[_0xe3dc('0x1b')](_0x129dab)&&_0x129dab!==''){var _0x16a1b3=/^(([^<>()\[\]\\.,;:\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 _0x16a1b3[_0xe3dc('0x1c')](String(_0x129dab)[_0xe3dc('0xf')]());}else{return![];}};