4b2b8da78e7abd61a6d9b05d215b9a3a3a39ff2b
[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 _0x8df8=['keyValue','keyType','format','%s:\x20%s','key','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','lodash','util','getString','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase'];(function(_0x1270d4,_0x3c8155){var _0x4dd645=function(_0x3a9e5a){while(--_0x3a9e5a){_0x1270d4['push'](_0x1270d4['shift']());}};_0x4dd645(++_0x3c8155);}(_0x8df8,0x178));var _0x88df=function(_0x4cdbc8,_0x4d8e1d){_0x4cdbc8=_0x4cdbc8-0x0;var _0x311448=_0x8df8[_0x4cdbc8];return _0x311448;};'use strict';var _=require(_0x88df('0x0'));var util=require(_0x88df('0x1'));exports[_0x88df('0x2')]=function(_0x40c6ad,_0x11528b,_0x29ded3){var _0x1e4fa8=[];if(_0x40c6ad[_0x88df('0x3')]>0x0){var _0x35d2f0=_[_0x88df('0x4')](_0x40c6ad,['id']);for(var _0x11a401=0x0;_0x11a401<_0x35d2f0[_0x88df('0x3')];_0x11a401++){var _0x2863d6=_0x35d2f0[_0x11a401];if(_0x2863d6[_0x88df('0x5')]===_0x88df('0x6')){_0x1e4fa8[_0x88df('0x7')](_0x2863d6[_0x88df('0x8')]);}else if(_0x2863d6[_0x88df('0x5')]===_0x88df('0x9')&&_0x2863d6['variableName']){_0x11528b[_0x2863d6[_0x88df('0xa')]]&&_0x1e4fa8[_0x88df('0x7')](_0x11528b[_0x2863d6[_0x88df('0xa')]][_0x88df('0xb')]());}else if(_0x2863d6[_0x88df('0x5')]===_0x88df('0xc')&&_0x2863d6['Variable']&&_0x2863d6[_0x88df('0xd')][_0x88df('0xe')]){_0x11528b[_0x2863d6[_0x88df('0xd')][_0x88df('0xe')][_0x88df('0xf')]()]&&_0x1e4fa8['push'](_0x11528b[_0x2863d6['Variable'][_0x88df('0xe')][_0x88df('0xf')]()][_0x88df('0xb')]());}else if(_0x2863d6[_0x88df('0x5')]===_0x88df('0x10')){if(_0x2863d6[_0x88df('0x11')]===_0x88df('0x6')&&_0x2863d6['key']){_0x1e4fa8[_0x88df('0x7')](util[_0x88df('0x12')](_0x88df('0x13'),_0x2863d6[_0x88df('0x14')],_0x2863d6['keyContent']));}else if(_0x2863d6['keyType']===_0x88df('0x9')&&_0x2863d6['variableName']&&_0x2863d6[_0x88df('0x14')]){_0x11528b[_0x2863d6[_0x88df('0xa')]]&&_0x1e4fa8[_0x88df('0x7')](util[_0x88df('0x12')](_0x88df('0x13'),_0x2863d6[_0x88df('0x14')],_0x11528b[_0x2863d6[_0x88df('0xa')]]));}else if(_0x2863d6[_0x88df('0x11')]==='customVariable'&&_0x2863d6['Variable']&&_0x2863d6[_0x88df('0xd')][_0x88df('0xe')]&&_0x2863d6[_0x88df('0x14')]){_0x11528b[_0x2863d6[_0x88df('0xd')][_0x88df('0xe')][_0x88df('0xf')]()]&&_0x1e4fa8[_0x88df('0x7')](util[_0x88df('0x12')](_0x88df('0x13'),_0x2863d6['key'],_0x11528b[_0x2863d6[_0x88df('0xd')][_0x88df('0xe')][_0x88df('0xf')]()]));}}}}return _0x1e4fa8[_0x88df('0x15')](_0x29ded3);};exports[_0x88df('0x16')]=function(_0x4dc19e){var _0x5d1c8b=_0x4dc19e[_0x88df('0x17')](-0x1);if(_0x5d1c8b==='/'){_0x4dc19e=_0x4dc19e[_0x88df('0x18')](0x0,_0x4dc19e[_0x88df('0x19')](_0x5d1c8b));}return _0x4dc19e;};exports[_0x88df('0x1a')]=function(_0x3d1a27){if(!_['isNil'](_0x3d1a27)&&_0x3d1a27!==''){var _0x2f9e11=/^(([^<>()\[\]\\.,;:\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 _0x2f9e11[_0x88df('0x1b')](String(_0x3d1a27)[_0x88df('0xf')]());}else{return![];}};