Built motion from commit 9d0783e6.|2.6.13
[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 _0x5f09=['isNil','test','lodash','getString','length','sortBy','type','string','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail'];(function(_0x2d9fdc,_0x5d18cd){var _0x39d84b=function(_0x1e0951){while(--_0x1e0951){_0x2d9fdc['push'](_0x2d9fdc['shift']());}};_0x39d84b(++_0x5d18cd);}(_0x5f09,0xf5));var _0x95f0=function(_0x3fc9f3,_0x3457c3){_0x3fc9f3=_0x3fc9f3-0x0;var _0x13eb31=_0x5f09[_0x3fc9f3];return _0x13eb31;};'use strict';var _=require(_0x95f0('0x0'));var util=require('util');exports[_0x95f0('0x1')]=function(_0x4adbb4,_0x396631,_0x59e61c){var _0x2718e3=[];if(_0x4adbb4[_0x95f0('0x2')]>0x0){var _0x40e743=_[_0x95f0('0x3')](_0x4adbb4,['id']);for(var _0x1fe803=0x0;_0x1fe803<_0x40e743[_0x95f0('0x2')];_0x1fe803++){var _0x5def1f=_0x40e743[_0x1fe803];if(_0x5def1f[_0x95f0('0x4')]===_0x95f0('0x5')){_0x2718e3[_0x95f0('0x6')](_0x5def1f[_0x95f0('0x7')]);}else if(_0x5def1f[_0x95f0('0x4')]===_0x95f0('0x8')&&_0x5def1f[_0x95f0('0x9')]){_0x396631[_0x5def1f['variableName']]&&_0x2718e3[_0x95f0('0x6')](_0x396631[_0x5def1f['variableName']]['toString']());}else if(_0x5def1f[_0x95f0('0x4')]===_0x95f0('0xa')&&_0x5def1f['Variable']&&_0x5def1f['Variable']['name']){_0x396631[_0x5def1f[_0x95f0('0xb')][_0x95f0('0xc')]['toLowerCase']()]&&_0x2718e3['push'](_0x396631[_0x5def1f[_0x95f0('0xb')][_0x95f0('0xc')][_0x95f0('0xd')]()]['toString']());}else if(_0x5def1f[_0x95f0('0x4')]===_0x95f0('0xe')){if(_0x5def1f[_0x95f0('0xf')]==='string'&&_0x5def1f[_0x95f0('0x10')]){_0x2718e3[_0x95f0('0x6')](util[_0x95f0('0x11')](_0x95f0('0x12'),_0x5def1f[_0x95f0('0x10')],_0x5def1f[_0x95f0('0x13')]));}else if(_0x5def1f[_0x95f0('0xf')]===_0x95f0('0x8')&&_0x5def1f[_0x95f0('0x9')]&&_0x5def1f[_0x95f0('0x10')]){_0x396631[_0x5def1f[_0x95f0('0x9')]]&&_0x2718e3[_0x95f0('0x6')](util[_0x95f0('0x11')](_0x95f0('0x12'),_0x5def1f[_0x95f0('0x10')],_0x396631[_0x5def1f['variableName']]));}else if(_0x5def1f[_0x95f0('0xf')]===_0x95f0('0xa')&&_0x5def1f[_0x95f0('0xb')]&&_0x5def1f['Variable'][_0x95f0('0xc')]&&_0x5def1f['key']){_0x396631[_0x5def1f[_0x95f0('0xb')][_0x95f0('0xc')][_0x95f0('0xd')]()]&&_0x2718e3[_0x95f0('0x6')](util[_0x95f0('0x11')](_0x95f0('0x12'),_0x5def1f['key'],_0x396631[_0x5def1f[_0x95f0('0xb')]['name']['toLowerCase']()]));}}}}return _0x2718e3['join'](_0x59e61c);};exports[_0x95f0('0x14')]=function(_0x5b4d40){var _0x4f48b2=_0x5b4d40[_0x95f0('0x15')](-0x1);if(_0x4f48b2==='/'){_0x5b4d40=_0x5b4d40[_0x95f0('0x16')](0x0,_0x5b4d40[_0x95f0('0x17')](_0x4f48b2));}return _0x5b4d40;};exports[_0x95f0('0x18')]=function(_0x6040cf){if(!_[_0x95f0('0x19')](_0x6040cf)&&_0x6040cf!==''){var _0x1b8a75=/^(([^<>()\[\]\\.,;:\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 _0x1b8a75[_0x95f0('0x1a')](String(_0x6040cf)['toLowerCase']());}else{return![];}};