f65af28ad7daa2113cecd58a56374ad1156424a7
[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 _0xf2f5=['variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','stripTrailingSlash','slice','substring','test','lodash','util','getString','length','sortBy','type','string','push','content','variable'];(function(_0x5500ea,_0x4446ed){var _0x7b9f5b=function(_0x54f657){while(--_0x54f657){_0x5500ea['push'](_0x5500ea['shift']());}};_0x7b9f5b(++_0x4446ed);}(_0xf2f5,0x154));var _0x5f2f=function(_0x35dec3,_0x26389e){_0x35dec3=_0x35dec3-0x0;var _0x4f89a6=_0xf2f5[_0x35dec3];return _0x4f89a6;};'use strict';var _=require(_0x5f2f('0x0'));var util=require(_0x5f2f('0x1'));exports[_0x5f2f('0x2')]=function(_0x3e6c8a,_0x119f05,_0x3e2536){var _0x3f7a26=[];if(_0x3e6c8a[_0x5f2f('0x3')]>0x0){var _0x2aeeb6=_[_0x5f2f('0x4')](_0x3e6c8a,['id']);for(var _0x5ac410=0x0;_0x5ac410<_0x2aeeb6[_0x5f2f('0x3')];_0x5ac410++){var _0x239337=_0x2aeeb6[_0x5ac410];if(_0x239337[_0x5f2f('0x5')]===_0x5f2f('0x6')){_0x3f7a26[_0x5f2f('0x7')](_0x239337[_0x5f2f('0x8')]);}else if(_0x239337[_0x5f2f('0x5')]===_0x5f2f('0x9')&&_0x239337[_0x5f2f('0xa')]){_0x119f05[_0x239337[_0x5f2f('0xa')]]&&_0x3f7a26[_0x5f2f('0x7')](_0x119f05[_0x239337['variableName']][_0x5f2f('0xb')]());}else if(_0x239337[_0x5f2f('0x5')]==='customVariable'&&_0x239337['Variable']&&_0x239337[_0x5f2f('0xc')][_0x5f2f('0xd')]){_0x119f05[_0x239337[_0x5f2f('0xc')][_0x5f2f('0xd')][_0x5f2f('0xe')]()]&&_0x3f7a26[_0x5f2f('0x7')](_0x119f05[_0x239337[_0x5f2f('0xc')][_0x5f2f('0xd')][_0x5f2f('0xe')]()]['toString']());}else if(_0x239337[_0x5f2f('0x5')]===_0x5f2f('0xf')){if(_0x239337[_0x5f2f('0x10')]==='string'&&_0x239337[_0x5f2f('0x11')]){_0x3f7a26['push'](util[_0x5f2f('0x12')]('%s:\x20%s',_0x239337['key'],_0x239337['keyContent']));}else if(_0x239337[_0x5f2f('0x10')]===_0x5f2f('0x9')&&_0x239337[_0x5f2f('0xa')]&&_0x239337[_0x5f2f('0x11')]){_0x119f05[_0x239337[_0x5f2f('0xa')]]&&_0x3f7a26[_0x5f2f('0x7')](util[_0x5f2f('0x12')](_0x5f2f('0x13'),_0x239337[_0x5f2f('0x11')],_0x119f05[_0x239337['variableName']]));}else if(_0x239337['keyType']==='customVariable'&&_0x239337[_0x5f2f('0xc')]&&_0x239337[_0x5f2f('0xc')][_0x5f2f('0xd')]&&_0x239337['key']){_0x119f05[_0x239337[_0x5f2f('0xc')][_0x5f2f('0xd')]['toLowerCase']()]&&_0x3f7a26[_0x5f2f('0x7')](util[_0x5f2f('0x12')](_0x5f2f('0x13'),_0x239337[_0x5f2f('0x11')],_0x119f05[_0x239337[_0x5f2f('0xc')]['name'][_0x5f2f('0xe')]()]));}}}}return _0x3f7a26[_0x5f2f('0x14')](_0x3e2536);};exports[_0x5f2f('0x15')]=function(_0x492b55){var _0x1ebb78=_0x492b55[_0x5f2f('0x16')](-0x1);if(_0x1ebb78==='/'){_0x492b55=_0x492b55[_0x5f2f('0x17')](0x0,_0x492b55['lastIndexOf'](_0x1ebb78));}return _0x492b55;};exports['validateEmail']=function(_0x5a0254){if(!_['isNil'](_0x5a0254)&&_0x5a0254!==''){var _0x3b048a=/^(([^<>()\[\]\\.,;:\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 _0x3b048a[_0x5f2f('0x18')](String(_0x5a0254)['toLowerCase']());}else{return![];}};