Built motion from commit (unavailable).|2.5.22
[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 _0x736e=['sortBy','type','string','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','key','format','%s:\x20%s','keyType','join','slice','substring','lastIndexOf','validateEmail','test','lodash','getString','length'];(function(_0x32ffb5,_0x3866b5){var _0x3cbd7a=function(_0x42315b){while(--_0x42315b){_0x32ffb5['push'](_0x32ffb5['shift']());}};_0x3cbd7a(++_0x3866b5);}(_0x736e,0x65));var _0xe736=function(_0x352ce,_0x2dd65c){_0x352ce=_0x352ce-0x0;var _0x112db5=_0x736e[_0x352ce];return _0x112db5;};'use strict';var _=require(_0xe736('0x0'));var util=require('util');exports[_0xe736('0x1')]=function(_0xcf4ba6,_0x494454,_0x462ff2){var _0x30a46d=[];if(_0xcf4ba6[_0xe736('0x2')]>0x0){var _0x5ce995=_[_0xe736('0x3')](_0xcf4ba6,['id']);for(var _0x5beb75=0x0;_0x5beb75<_0x5ce995[_0xe736('0x2')];_0x5beb75++){var _0xe2f1a4=_0x5ce995[_0x5beb75];if(_0xe2f1a4[_0xe736('0x4')]===_0xe736('0x5')){_0x30a46d[_0xe736('0x6')](_0xe2f1a4[_0xe736('0x7')]);}else if(_0xe2f1a4['type']===_0xe736('0x8')&&_0xe2f1a4[_0xe736('0x9')]){_0x494454[_0xe2f1a4['variableName']]&&_0x30a46d['push'](_0x494454[_0xe2f1a4['variableName']]['toString']());}else if(_0xe2f1a4[_0xe736('0x4')]===_0xe736('0xa')&&_0xe2f1a4['Variable']&&_0xe2f1a4[_0xe736('0xb')][_0xe736('0xc')]){_0x494454[_0xe2f1a4['Variable'][_0xe736('0xc')][_0xe736('0xd')]()]&&_0x30a46d['push'](_0x494454[_0xe2f1a4[_0xe736('0xb')][_0xe736('0xc')][_0xe736('0xd')]()][_0xe736('0xe')]());}else if(_0xe2f1a4[_0xe736('0x4')]===_0xe736('0xf')){if(_0xe2f1a4['keyType']==='string'&&_0xe2f1a4[_0xe736('0x10')]){_0x30a46d[_0xe736('0x6')](util[_0xe736('0x11')](_0xe736('0x12'),_0xe2f1a4['key'],_0xe2f1a4['keyContent']));}else if(_0xe2f1a4[_0xe736('0x13')]==='variable'&&_0xe2f1a4['variableName']&&_0xe2f1a4['key']){_0x494454[_0xe2f1a4['variableName']]&&_0x30a46d[_0xe736('0x6')](util['format'](_0xe736('0x12'),_0xe2f1a4[_0xe736('0x10')],_0x494454[_0xe2f1a4[_0xe736('0x9')]]));}else if(_0xe2f1a4[_0xe736('0x13')]==='customVariable'&&_0xe2f1a4[_0xe736('0xb')]&&_0xe2f1a4['Variable'][_0xe736('0xc')]&&_0xe2f1a4[_0xe736('0x10')]){_0x494454[_0xe2f1a4['Variable']['name'][_0xe736('0xd')]()]&&_0x30a46d['push'](util[_0xe736('0x11')](_0xe736('0x12'),_0xe2f1a4[_0xe736('0x10')],_0x494454[_0xe2f1a4[_0xe736('0xb')][_0xe736('0xc')]['toLowerCase']()]));}}}}return _0x30a46d[_0xe736('0x14')](_0x462ff2);};exports['stripTrailingSlash']=function(_0x566c18){var _0x307974=_0x566c18[_0xe736('0x15')](-0x1);if(_0x307974==='/'){_0x566c18=_0x566c18[_0xe736('0x16')](0x0,_0x566c18[_0xe736('0x17')](_0x307974));}return _0x566c18;};exports[_0xe736('0x18')]=function(_0x4a7f41){if(!_['isNil'](_0x4a7f41)&&_0x4a7f41!==''){var _0x25d40c=/^(([^<>()\[\]\\.,;:\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 _0x25d40c[_0xe736('0x19')](String(_0x4a7f41)['toLowerCase']());}else{return![];}};