Built motion from commit 25580385.|2.6.2
[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 _0x7ad8=['format','%s:\x20%s','keyContent','stripTrailingSlash','slice','substring','lastIndexOf','test','util','sortBy','length','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key'];(function(_0xdae953,_0x5c6c70){var _0x9d358e=function(_0x18cc95){while(--_0x18cc95){_0xdae953['push'](_0xdae953['shift']());}};_0x9d358e(++_0x5c6c70);}(_0x7ad8,0x170));var _0x87ad=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0x7ad8[_0x2e3dfc];return _0x4b1245;};'use strict';var _=require('lodash');var util=require(_0x87ad('0x0'));exports['getString']=function(_0x3571ff,_0x5ef61f,_0xaf84e6){var _0x3ee677=[];if(_0x3571ff['length']>0x0){var _0x6b7711=_[_0x87ad('0x1')](_0x3571ff,['id']);for(var _0x1b84b0=0x0;_0x1b84b0<_0x6b7711[_0x87ad('0x2')];_0x1b84b0++){var _0x1d2ec8=_0x6b7711[_0x1b84b0];if(_0x1d2ec8['type']==='string'){_0x3ee677[_0x87ad('0x3')](_0x1d2ec8[_0x87ad('0x4')]);}else if(_0x1d2ec8[_0x87ad('0x5')]===_0x87ad('0x6')&&_0x1d2ec8['variableName']){_0x5ef61f[_0x1d2ec8[_0x87ad('0x7')]]&&_0x3ee677[_0x87ad('0x3')](_0x5ef61f[_0x1d2ec8[_0x87ad('0x7')]][_0x87ad('0x8')]());}else if(_0x1d2ec8[_0x87ad('0x5')]===_0x87ad('0x9')&&_0x1d2ec8[_0x87ad('0xa')]&&_0x1d2ec8[_0x87ad('0xa')][_0x87ad('0xb')]){_0x5ef61f[_0x1d2ec8[_0x87ad('0xa')][_0x87ad('0xb')][_0x87ad('0xc')]()]&&_0x3ee677[_0x87ad('0x3')](_0x5ef61f[_0x1d2ec8[_0x87ad('0xa')][_0x87ad('0xb')][_0x87ad('0xc')]()][_0x87ad('0x8')]());}else if(_0x1d2ec8['type']===_0x87ad('0xd')){if(_0x1d2ec8[_0x87ad('0xe')]==='string'&&_0x1d2ec8[_0x87ad('0xf')]){_0x3ee677[_0x87ad('0x3')](util[_0x87ad('0x10')](_0x87ad('0x11'),_0x1d2ec8['key'],_0x1d2ec8[_0x87ad('0x12')]));}else if(_0x1d2ec8[_0x87ad('0xe')]===_0x87ad('0x6')&&_0x1d2ec8[_0x87ad('0x7')]&&_0x1d2ec8['key']){_0x5ef61f[_0x1d2ec8[_0x87ad('0x7')]]&&_0x3ee677[_0x87ad('0x3')](util[_0x87ad('0x10')](_0x87ad('0x11'),_0x1d2ec8[_0x87ad('0xf')],_0x5ef61f[_0x1d2ec8[_0x87ad('0x7')]]));}else if(_0x1d2ec8[_0x87ad('0xe')]===_0x87ad('0x9')&&_0x1d2ec8[_0x87ad('0xa')]&&_0x1d2ec8[_0x87ad('0xa')][_0x87ad('0xb')]&&_0x1d2ec8[_0x87ad('0xf')]){_0x5ef61f[_0x1d2ec8[_0x87ad('0xa')][_0x87ad('0xb')][_0x87ad('0xc')]()]&&_0x3ee677[_0x87ad('0x3')](util[_0x87ad('0x10')](_0x87ad('0x11'),_0x1d2ec8[_0x87ad('0xf')],_0x5ef61f[_0x1d2ec8[_0x87ad('0xa')][_0x87ad('0xb')][_0x87ad('0xc')]()]));}}}}return _0x3ee677['join'](_0xaf84e6);};exports[_0x87ad('0x13')]=function(_0x5d8127){var _0x4bcbf6=_0x5d8127[_0x87ad('0x14')](-0x1);if(_0x4bcbf6==='/'){_0x5d8127=_0x5d8127[_0x87ad('0x15')](0x0,_0x5d8127[_0x87ad('0x16')](_0x4bcbf6));}return _0x5d8127;};exports['validateEmail']=function(_0x20205f){if(!_['isNil'](_0x20205f)&&_0x20205f!==''){var _0x1228df=/^(([^<>()\[\]\\.,;:\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 _0x1228df[_0x87ad('0x17')](String(_0x20205f)['toLowerCase']());}else{return![];}};