b96a4091838189546728160a6bcbe9570d643135
[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 _0x7ef8=['length','sortBy','type','push','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','%s:\x20%s','keyContent','format','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','util'];(function(_0x6b9f13,_0x243e7d){var _0x2e6e15=function(_0x44eb61){while(--_0x44eb61){_0x6b9f13['push'](_0x6b9f13['shift']());}};_0x2e6e15(++_0x243e7d);}(_0x7ef8,0x127));var _0x87ef=function(_0x4819e3,_0x5dcdb1){_0x4819e3=_0x4819e3-0x0;var _0x3255c8=_0x7ef8[_0x4819e3];return _0x3255c8;};'use strict';var _=require(_0x87ef('0x0'));var util=require(_0x87ef('0x1'));exports['getString']=function(_0xd5a784,_0x1319d5,_0x1b2337){var _0x257cb3=[];if(_0xd5a784[_0x87ef('0x2')]>0x0){var _0x5afdc3=_[_0x87ef('0x3')](_0xd5a784,['id']);for(var _0x5c83bb=0x0;_0x5c83bb<_0x5afdc3[_0x87ef('0x2')];_0x5c83bb++){var _0x45b613=_0x5afdc3[_0x5c83bb];if(_0x45b613[_0x87ef('0x4')]==='string'){_0x257cb3[_0x87ef('0x5')](_0x45b613['content']);}else if(_0x45b613[_0x87ef('0x4')]===_0x87ef('0x6')&&_0x45b613[_0x87ef('0x7')]){_0x1319d5[_0x45b613[_0x87ef('0x7')]]&&_0x257cb3[_0x87ef('0x5')](_0x1319d5[_0x45b613[_0x87ef('0x7')]][_0x87ef('0x8')]());}else if(_0x45b613[_0x87ef('0x4')]===_0x87ef('0x9')&&_0x45b613[_0x87ef('0xa')]&&_0x45b613[_0x87ef('0xa')][_0x87ef('0xb')]){_0x1319d5[_0x45b613['Variable']['name'][_0x87ef('0xc')]()]&&_0x257cb3['push'](_0x1319d5[_0x45b613['Variable'][_0x87ef('0xb')]['toLowerCase']()]['toString']());}else if(_0x45b613['type']===_0x87ef('0xd')){if(_0x45b613[_0x87ef('0xe')]===_0x87ef('0xf')&&_0x45b613[_0x87ef('0x10')]){_0x257cb3[_0x87ef('0x5')](util['format'](_0x87ef('0x11'),_0x45b613['key'],_0x45b613[_0x87ef('0x12')]));}else if(_0x45b613[_0x87ef('0xe')]===_0x87ef('0x6')&&_0x45b613['variableName']&&_0x45b613[_0x87ef('0x10')]){_0x1319d5[_0x45b613['variableName']]&&_0x257cb3[_0x87ef('0x5')](util[_0x87ef('0x13')](_0x87ef('0x11'),_0x45b613[_0x87ef('0x10')],_0x1319d5[_0x45b613[_0x87ef('0x7')]]));}else if(_0x45b613[_0x87ef('0xe')]===_0x87ef('0x9')&&_0x45b613['Variable']&&_0x45b613[_0x87ef('0xa')]['name']&&_0x45b613[_0x87ef('0x10')]){_0x1319d5[_0x45b613[_0x87ef('0xa')]['name']['toLowerCase']()]&&_0x257cb3[_0x87ef('0x5')](util['format'](_0x87ef('0x11'),_0x45b613['key'],_0x1319d5[_0x45b613['Variable'][_0x87ef('0xb')]['toLowerCase']()]));}}}}return _0x257cb3[_0x87ef('0x14')](_0x1b2337);};exports[_0x87ef('0x15')]=function(_0x44040b){var _0x463802=_0x44040b[_0x87ef('0x16')](-0x1);if(_0x463802==='/'){_0x44040b=_0x44040b[_0x87ef('0x17')](0x0,_0x44040b['lastIndexOf'](_0x463802));}return _0x44040b;};exports[_0x87ef('0x18')]=function(_0x254635){if(!_[_0x87ef('0x19')](_0x254635)&&_0x254635!==''){var _0x2d1694=/^(([^<>()\[\]\\.,;:\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 _0x2d1694[_0x87ef('0x1a')](String(_0x254635)[_0x87ef('0xc')]());}else{return![];}};