63018d17223960ff0622f3440e2375a5e64f13ec
[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 _0xcc06=['keyValue','keyType','format','%s:\x20%s','key','keyContent','join','slice','substring','lastIndexOf','validateEmail','isNil','lodash','util','length','sortBy','type','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase'];(function(_0x33e7ff,_0x38e104){var _0x2cf2ee=function(_0x33eafa){while(--_0x33eafa){_0x33e7ff['push'](_0x33e7ff['shift']());}};_0x2cf2ee(++_0x38e104);}(_0xcc06,0x8e));var _0x6cc0=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xcc06[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x6cc0('0x0'));var util=require(_0x6cc0('0x1'));exports['getString']=function(_0x59637c,_0x1fb901,_0x384132){var _0x58c72a=[];if(_0x59637c[_0x6cc0('0x2')]>0x0){var _0xcb0f5d=_[_0x6cc0('0x3')](_0x59637c,['id']);for(var _0x3bf3c8=0x0;_0x3bf3c8<_0xcb0f5d['length'];_0x3bf3c8++){var _0x29b8e7=_0xcb0f5d[_0x3bf3c8];if(_0x29b8e7[_0x6cc0('0x4')]==='string'){_0x58c72a[_0x6cc0('0x5')](_0x29b8e7[_0x6cc0('0x6')]);}else if(_0x29b8e7[_0x6cc0('0x4')]===_0x6cc0('0x7')&&_0x29b8e7[_0x6cc0('0x8')]){_0x1fb901[_0x29b8e7[_0x6cc0('0x8')]]&&_0x58c72a[_0x6cc0('0x5')](_0x1fb901[_0x29b8e7[_0x6cc0('0x8')]][_0x6cc0('0x9')]());}else if(_0x29b8e7[_0x6cc0('0x4')]===_0x6cc0('0xa')&&_0x29b8e7[_0x6cc0('0xb')]&&_0x29b8e7[_0x6cc0('0xb')][_0x6cc0('0xc')]){_0x1fb901[_0x29b8e7[_0x6cc0('0xb')]['name'][_0x6cc0('0xd')]()]&&_0x58c72a['push'](_0x1fb901[_0x29b8e7[_0x6cc0('0xb')]['name'][_0x6cc0('0xd')]()][_0x6cc0('0x9')]());}else if(_0x29b8e7[_0x6cc0('0x4')]===_0x6cc0('0xe')){if(_0x29b8e7[_0x6cc0('0xf')]==='string'&&_0x29b8e7['key']){_0x58c72a[_0x6cc0('0x5')](util[_0x6cc0('0x10')](_0x6cc0('0x11'),_0x29b8e7[_0x6cc0('0x12')],_0x29b8e7[_0x6cc0('0x13')]));}else if(_0x29b8e7[_0x6cc0('0xf')]===_0x6cc0('0x7')&&_0x29b8e7['variableName']&&_0x29b8e7['key']){_0x1fb901[_0x29b8e7['variableName']]&&_0x58c72a[_0x6cc0('0x5')](util[_0x6cc0('0x10')](_0x6cc0('0x11'),_0x29b8e7['key'],_0x1fb901[_0x29b8e7[_0x6cc0('0x8')]]));}else if(_0x29b8e7[_0x6cc0('0xf')]==='customVariable'&&_0x29b8e7[_0x6cc0('0xb')]&&_0x29b8e7[_0x6cc0('0xb')][_0x6cc0('0xc')]&&_0x29b8e7[_0x6cc0('0x12')]){_0x1fb901[_0x29b8e7['Variable']['name'][_0x6cc0('0xd')]()]&&_0x58c72a['push'](util[_0x6cc0('0x10')](_0x6cc0('0x11'),_0x29b8e7[_0x6cc0('0x12')],_0x1fb901[_0x29b8e7['Variable']['name'][_0x6cc0('0xd')]()]));}}}}return _0x58c72a[_0x6cc0('0x14')](_0x384132);};exports['stripTrailingSlash']=function(_0x1606eb){var _0x3b0240=_0x1606eb[_0x6cc0('0x15')](-0x1);if(_0x3b0240==='/'){_0x1606eb=_0x1606eb[_0x6cc0('0x16')](0x0,_0x1606eb[_0x6cc0('0x17')](_0x3b0240));}return _0x1606eb;};exports[_0x6cc0('0x18')]=function(_0x1c44c2){if(!_[_0x6cc0('0x19')](_0x1c44c2)&&_0x1c44c2!==''){var _0x1b02bf=/^(([^<>()\[\]\\.,;:\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 _0x1b02bf['test'](String(_0x1c44c2)[_0x6cc0('0xd')]());}else{return![];}};