d9df60afc04509eab5916407d58d30c344658c4d
[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 _0x4cf1=['substring','lastIndexOf','validateEmail','test','lodash','util','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','key','format','%s:\x20%s','keyContent','keyType','stripTrailingSlash','slice'];(function(_0x3b7626,_0x38d495){var _0x1f1c05=function(_0x50bdef){while(--_0x50bdef){_0x3b7626['push'](_0x3b7626['shift']());}};_0x1f1c05(++_0x38d495);}(_0x4cf1,0x12d));var _0x14cf=function(_0x306646,_0xdc2e1b){_0x306646=_0x306646-0x0;var _0x40bd8d=_0x4cf1[_0x306646];return _0x40bd8d;};'use strict';var _=require(_0x14cf('0x0'));var util=require(_0x14cf('0x1'));exports['getString']=function(_0x5f3a15,_0x3094ef,_0x14033b){var _0x1defd8=[];if(_0x5f3a15[_0x14cf('0x2')]>0x0){var _0x46b1e4=_[_0x14cf('0x3')](_0x5f3a15,['id']);for(var _0x6afdc3=0x0;_0x6afdc3<_0x46b1e4[_0x14cf('0x2')];_0x6afdc3++){var _0x3598ff=_0x46b1e4[_0x6afdc3];if(_0x3598ff[_0x14cf('0x4')]===_0x14cf('0x5')){_0x1defd8[_0x14cf('0x6')](_0x3598ff[_0x14cf('0x7')]);}else if(_0x3598ff[_0x14cf('0x4')]===_0x14cf('0x8')&&_0x3598ff[_0x14cf('0x9')]){_0x3094ef[_0x3598ff[_0x14cf('0x9')]]&&_0x1defd8[_0x14cf('0x6')](_0x3094ef[_0x3598ff[_0x14cf('0x9')]][_0x14cf('0xa')]());}else if(_0x3598ff[_0x14cf('0x4')]===_0x14cf('0xb')&&_0x3598ff[_0x14cf('0xc')]&&_0x3598ff['Variable'][_0x14cf('0xd')]){_0x3094ef[_0x3598ff[_0x14cf('0xc')][_0x14cf('0xd')][_0x14cf('0xe')]()]&&_0x1defd8[_0x14cf('0x6')](_0x3094ef[_0x3598ff[_0x14cf('0xc')][_0x14cf('0xd')][_0x14cf('0xe')]()]['toString']());}else if(_0x3598ff[_0x14cf('0x4')]===_0x14cf('0xf')){if(_0x3598ff['keyType']===_0x14cf('0x5')&&_0x3598ff[_0x14cf('0x10')]){_0x1defd8[_0x14cf('0x6')](util[_0x14cf('0x11')](_0x14cf('0x12'),_0x3598ff[_0x14cf('0x10')],_0x3598ff[_0x14cf('0x13')]));}else if(_0x3598ff[_0x14cf('0x14')]==='variable'&&_0x3598ff['variableName']&&_0x3598ff[_0x14cf('0x10')]){_0x3094ef[_0x3598ff[_0x14cf('0x9')]]&&_0x1defd8['push'](util[_0x14cf('0x11')]('%s:\x20%s',_0x3598ff[_0x14cf('0x10')],_0x3094ef[_0x3598ff[_0x14cf('0x9')]]));}else if(_0x3598ff[_0x14cf('0x14')]===_0x14cf('0xb')&&_0x3598ff[_0x14cf('0xc')]&&_0x3598ff[_0x14cf('0xc')]['name']&&_0x3598ff[_0x14cf('0x10')]){_0x3094ef[_0x3598ff[_0x14cf('0xc')][_0x14cf('0xd')][_0x14cf('0xe')]()]&&_0x1defd8['push'](util[_0x14cf('0x11')]('%s:\x20%s',_0x3598ff[_0x14cf('0x10')],_0x3094ef[_0x3598ff[_0x14cf('0xc')][_0x14cf('0xd')][_0x14cf('0xe')]()]));}}}}return _0x1defd8['join'](_0x14033b);};exports[_0x14cf('0x15')]=function(_0x2bee92){var _0x2c81f1=_0x2bee92[_0x14cf('0x16')](-0x1);if(_0x2c81f1==='/'){_0x2bee92=_0x2bee92[_0x14cf('0x17')](0x0,_0x2bee92[_0x14cf('0x18')](_0x2c81f1));}return _0x2bee92;};exports[_0x14cf('0x19')]=function(_0x48d6e6){if(!_['isNil'](_0x48d6e6)&&_0x48d6e6!==''){var _0x51ba8f=/^(([^<>()\[\]\\.,;:\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 _0x51ba8f[_0x14cf('0x1a')](String(_0x48d6e6)['toLowerCase']());}else{return![];}};