Built motion from commit (unavailable).|2.5.0
[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 _0xbfa7=['toString','customVariable','Variable','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','variable','name','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','lodash','util','getString','length','sortBy','string','push','content','type','variableName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfa7,0x66));var _0x7bfa=function(_0x29776d,_0x5201b1){_0x29776d=_0x29776d-0x0;var _0x997fb=_0xbfa7[_0x29776d];return _0x997fb;};'use strict';var _=require(_0x7bfa('0x0'));var util=require(_0x7bfa('0x1'));exports[_0x7bfa('0x2')]=function(_0x91b19a,_0x2a2de3,_0x34dbe3){var _0x4497d9=[];if(_0x91b19a[_0x7bfa('0x3')]>0x0){var _0x2ffa5b=_[_0x7bfa('0x4')](_0x91b19a,['id']);for(var _0xc21d13=0x0;_0xc21d13<_0x2ffa5b[_0x7bfa('0x3')];_0xc21d13++){var _0x3edd31=_0x2ffa5b[_0xc21d13];if(_0x3edd31['type']===_0x7bfa('0x5')){_0x4497d9[_0x7bfa('0x6')](_0x3edd31[_0x7bfa('0x7')]);}else if(_0x3edd31[_0x7bfa('0x8')]==='variable'&&_0x3edd31[_0x7bfa('0x9')]){_0x2a2de3[_0x3edd31['variableName']]&&_0x4497d9['push'](_0x2a2de3[_0x3edd31[_0x7bfa('0x9')]][_0x7bfa('0xa')]());}else if(_0x3edd31[_0x7bfa('0x8')]===_0x7bfa('0xb')&&_0x3edd31[_0x7bfa('0xc')]&&_0x3edd31[_0x7bfa('0xc')]['name']){_0x2a2de3[_0x3edd31[_0x7bfa('0xc')]['name'][_0x7bfa('0xd')]()]&&_0x4497d9[_0x7bfa('0x6')](_0x2a2de3[_0x3edd31[_0x7bfa('0xc')]['name'][_0x7bfa('0xd')]()][_0x7bfa('0xa')]());}else if(_0x3edd31[_0x7bfa('0x8')]===_0x7bfa('0xe')){if(_0x3edd31[_0x7bfa('0xf')]===_0x7bfa('0x5')&&_0x3edd31[_0x7bfa('0x10')]){_0x4497d9[_0x7bfa('0x6')](util[_0x7bfa('0x11')](_0x7bfa('0x12'),_0x3edd31[_0x7bfa('0x10')],_0x3edd31[_0x7bfa('0x13')]));}else if(_0x3edd31[_0x7bfa('0xf')]===_0x7bfa('0x14')&&_0x3edd31[_0x7bfa('0x9')]&&_0x3edd31[_0x7bfa('0x10')]){_0x2a2de3[_0x3edd31[_0x7bfa('0x9')]]&&_0x4497d9['push'](util[_0x7bfa('0x11')](_0x7bfa('0x12'),_0x3edd31[_0x7bfa('0x10')],_0x2a2de3[_0x3edd31[_0x7bfa('0x9')]]));}else if(_0x3edd31[_0x7bfa('0xf')]===_0x7bfa('0xb')&&_0x3edd31['Variable']&&_0x3edd31[_0x7bfa('0xc')][_0x7bfa('0x15')]&&_0x3edd31[_0x7bfa('0x10')]){_0x2a2de3[_0x3edd31[_0x7bfa('0xc')][_0x7bfa('0x15')][_0x7bfa('0xd')]()]&&_0x4497d9['push'](util[_0x7bfa('0x11')]('%s:\x20%s',_0x3edd31[_0x7bfa('0x10')],_0x2a2de3[_0x3edd31[_0x7bfa('0xc')]['name'][_0x7bfa('0xd')]()]));}}}}return _0x4497d9[_0x7bfa('0x16')](_0x34dbe3);};exports[_0x7bfa('0x17')]=function(_0xb00829){var _0x593343=_0xb00829[_0x7bfa('0x18')](-0x1);if(_0x593343==='/'){_0xb00829=_0xb00829[_0x7bfa('0x19')](0x0,_0xb00829[_0x7bfa('0x1a')](_0x593343));}return _0xb00829;};exports[_0x7bfa('0x1b')]=function(_0x27949e){if(!_['isNil'](_0x27949e)&&_0x27949e!==''){var _0x30c1ff=/^(([^<>()\[\]\\.,;:\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 _0x30c1ff['test'](String(_0x27949e)['toLowerCase']());}else{return![];}};