49f2624cd1c8d8992b53ebea9d1925574527e562
[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 _0xbb07=['stripTrailingSlash','slice','substring','lastIndexOf','isNil','test','lodash','util','length','sortBy','type','string','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s'];(function(_0x17c1a4,_0x195273){var _0x2ecdee=function(_0x3d6b93){while(--_0x3d6b93){_0x17c1a4['push'](_0x17c1a4['shift']());}};_0x2ecdee(++_0x195273);}(_0xbb07,0xf6));var _0x7bb0=function(_0x12e409,_0x379bb4){_0x12e409=_0x12e409-0x0;var _0xacb87b=_0xbb07[_0x12e409];return _0xacb87b;};'use strict';var _=require(_0x7bb0('0x0'));var util=require(_0x7bb0('0x1'));exports['getString']=function(_0x4da104,_0x1199de,_0x5dc07c){var _0x2024b8=[];if(_0x4da104[_0x7bb0('0x2')]>0x0){var _0x236341=_[_0x7bb0('0x3')](_0x4da104,['id']);for(var _0x59332f=0x0;_0x59332f<_0x236341[_0x7bb0('0x2')];_0x59332f++){var _0x2b7407=_0x236341[_0x59332f];if(_0x2b7407[_0x7bb0('0x4')]===_0x7bb0('0x5')){_0x2024b8[_0x7bb0('0x6')](_0x2b7407[_0x7bb0('0x7')]);}else if(_0x2b7407[_0x7bb0('0x4')]===_0x7bb0('0x8')&&_0x2b7407[_0x7bb0('0x9')]){_0x1199de[_0x2b7407[_0x7bb0('0x9')]]&&_0x2024b8[_0x7bb0('0x6')](_0x1199de[_0x2b7407[_0x7bb0('0x9')]]['toString']());}else if(_0x2b7407[_0x7bb0('0x4')]===_0x7bb0('0xa')&&_0x2b7407[_0x7bb0('0xb')]&&_0x2b7407[_0x7bb0('0xb')][_0x7bb0('0xc')]){_0x1199de[_0x2b7407['Variable'][_0x7bb0('0xc')][_0x7bb0('0xd')]()]&&_0x2024b8[_0x7bb0('0x6')](_0x1199de[_0x2b7407[_0x7bb0('0xb')][_0x7bb0('0xc')][_0x7bb0('0xd')]()]['toString']());}else if(_0x2b7407[_0x7bb0('0x4')]==='keyValue'){if(_0x2b7407[_0x7bb0('0xe')]===_0x7bb0('0x5')&&_0x2b7407[_0x7bb0('0xf')]){_0x2024b8['push'](util[_0x7bb0('0x10')]('%s:\x20%s',_0x2b7407[_0x7bb0('0xf')],_0x2b7407['keyContent']));}else if(_0x2b7407[_0x7bb0('0xe')]===_0x7bb0('0x8')&&_0x2b7407[_0x7bb0('0x9')]&&_0x2b7407[_0x7bb0('0xf')]){_0x1199de[_0x2b7407[_0x7bb0('0x9')]]&&_0x2024b8['push'](util[_0x7bb0('0x10')](_0x7bb0('0x11'),_0x2b7407[_0x7bb0('0xf')],_0x1199de[_0x2b7407[_0x7bb0('0x9')]]));}else if(_0x2b7407[_0x7bb0('0xe')]===_0x7bb0('0xa')&&_0x2b7407[_0x7bb0('0xb')]&&_0x2b7407[_0x7bb0('0xb')]['name']&&_0x2b7407[_0x7bb0('0xf')]){_0x1199de[_0x2b7407[_0x7bb0('0xb')][_0x7bb0('0xc')]['toLowerCase']()]&&_0x2024b8[_0x7bb0('0x6')](util[_0x7bb0('0x10')](_0x7bb0('0x11'),_0x2b7407[_0x7bb0('0xf')],_0x1199de[_0x2b7407[_0x7bb0('0xb')][_0x7bb0('0xc')][_0x7bb0('0xd')]()]));}}}}return _0x2024b8['join'](_0x5dc07c);};exports[_0x7bb0('0x12')]=function(_0x37d665){var _0x4245d4=_0x37d665[_0x7bb0('0x13')](-0x1);if(_0x4245d4==='/'){_0x37d665=_0x37d665[_0x7bb0('0x14')](0x0,_0x37d665[_0x7bb0('0x15')](_0x4245d4));}return _0x37d665;};exports['validateEmail']=function(_0xdcee7b){if(!_[_0x7bb0('0x16')](_0xdcee7b)&&_0xdcee7b!==''){var _0x2d6b87=/^(([^<>()\[\]\\.,;:\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 _0x2d6b87[_0x7bb0('0x17')](String(_0xdcee7b)[_0x7bb0('0xd')]());}else{return![];}};