b1575a49ac56915336c8e3d78a4fc7db92f21e08
[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 _0x3ef2=['validateEmail','isNil','test','lodash','length','sortBy','type','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','keyValue','string','format','%s:\x20%s','key','keyContent','keyType','join','stripTrailingSlash','slice','lastIndexOf'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3ef2,0x1bd));var _0x23ef=function(_0x37abc5,_0x5e2d44){_0x37abc5=_0x37abc5-0x0;var _0x22422c=_0x3ef2[_0x37abc5];return _0x22422c;};'use strict';var _=require(_0x23ef('0x0'));var util=require('util');exports['getString']=function(_0x3d56e3,_0x12edd0,_0x70a55d){var _0x4af71f=[];if(_0x3d56e3[_0x23ef('0x1')]>0x0){var _0x4dcb90=_[_0x23ef('0x2')](_0x3d56e3,['id']);for(var _0xa6b67a=0x0;_0xa6b67a<_0x4dcb90['length'];_0xa6b67a++){var _0x29759a=_0x4dcb90[_0xa6b67a];if(_0x29759a[_0x23ef('0x3')]==='string'){_0x4af71f[_0x23ef('0x4')](_0x29759a[_0x23ef('0x5')]);}else if(_0x29759a[_0x23ef('0x3')]===_0x23ef('0x6')&&_0x29759a[_0x23ef('0x7')]){_0x12edd0[_0x29759a[_0x23ef('0x7')]]&&_0x4af71f[_0x23ef('0x4')](_0x12edd0[_0x29759a[_0x23ef('0x7')]]['toString']());}else if(_0x29759a[_0x23ef('0x3')]===_0x23ef('0x8')&&_0x29759a['Variable']&&_0x29759a[_0x23ef('0x9')]['name']){_0x12edd0[_0x29759a[_0x23ef('0x9')][_0x23ef('0xa')]['toLowerCase']()]&&_0x4af71f[_0x23ef('0x4')](_0x12edd0[_0x29759a[_0x23ef('0x9')][_0x23ef('0xa')][_0x23ef('0xb')]()]['toString']());}else if(_0x29759a['type']===_0x23ef('0xc')){if(_0x29759a['keyType']===_0x23ef('0xd')&&_0x29759a['key']){_0x4af71f[_0x23ef('0x4')](util[_0x23ef('0xe')](_0x23ef('0xf'),_0x29759a[_0x23ef('0x10')],_0x29759a[_0x23ef('0x11')]));}else if(_0x29759a['keyType']==='variable'&&_0x29759a[_0x23ef('0x7')]&&_0x29759a['key']){_0x12edd0[_0x29759a[_0x23ef('0x7')]]&&_0x4af71f[_0x23ef('0x4')](util['format'](_0x23ef('0xf'),_0x29759a[_0x23ef('0x10')],_0x12edd0[_0x29759a[_0x23ef('0x7')]]));}else if(_0x29759a[_0x23ef('0x12')]===_0x23ef('0x8')&&_0x29759a[_0x23ef('0x9')]&&_0x29759a[_0x23ef('0x9')]['name']&&_0x29759a[_0x23ef('0x10')]){_0x12edd0[_0x29759a[_0x23ef('0x9')][_0x23ef('0xa')][_0x23ef('0xb')]()]&&_0x4af71f[_0x23ef('0x4')](util[_0x23ef('0xe')](_0x23ef('0xf'),_0x29759a['key'],_0x12edd0[_0x29759a[_0x23ef('0x9')][_0x23ef('0xa')][_0x23ef('0xb')]()]));}}}}return _0x4af71f[_0x23ef('0x13')](_0x70a55d);};exports[_0x23ef('0x14')]=function(_0x51fe8b){var _0x3952af=_0x51fe8b[_0x23ef('0x15')](-0x1);if(_0x3952af==='/'){_0x51fe8b=_0x51fe8b['substring'](0x0,_0x51fe8b[_0x23ef('0x16')](_0x3952af));}return _0x51fe8b;};exports[_0x23ef('0x17')]=function(_0x47ace7){if(!_[_0x23ef('0x18')](_0x47ace7)&&_0x47ace7!==''){var _0x211a9a=/^(([^<>()\[\]\\.,;:\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 _0x211a9a[_0x23ef('0x19')](String(_0x47ace7)[_0x23ef('0xb')]());}else{return![];}};