cf6803d743734e4f994885bea8b3103a2e16e32e
[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 _0xf2c1=['name','Variable','toLowerCase','key','format','%s:\x20%s','keyContent','keyType','stripTrailingSlash','slice','substring','isNil','test','lodash','util','sortBy','length','type','string','content','variable','variableName','push','toString','customVariable'];(function(_0x21a4a8,_0x2ba153){var _0x1f72e8=function(_0x39e377){while(--_0x39e377){_0x21a4a8['push'](_0x21a4a8['shift']());}};_0x1f72e8(++_0x2ba153);}(_0xf2c1,0x71));var _0x1f2c=function(_0x2f432a,_0x21efbd){_0x2f432a=_0x2f432a-0x0;var _0x9fb239=_0xf2c1[_0x2f432a];return _0x9fb239;};'use strict';var _=require(_0x1f2c('0x0'));var util=require(_0x1f2c('0x1'));exports['getString']=function(_0x2fe8dd,_0x16c2b6,_0x181d7c){var _0x479e09=[];if(_0x2fe8dd['length']>0x0){var _0x765be1=_[_0x1f2c('0x2')](_0x2fe8dd,['id']);for(var _0x352351=0x0;_0x352351<_0x765be1[_0x1f2c('0x3')];_0x352351++){var _0x282e01=_0x765be1[_0x352351];if(_0x282e01[_0x1f2c('0x4')]===_0x1f2c('0x5')){_0x479e09['push'](_0x282e01[_0x1f2c('0x6')]);}else if(_0x282e01['type']===_0x1f2c('0x7')&&_0x282e01[_0x1f2c('0x8')]){_0x16c2b6[_0x282e01[_0x1f2c('0x8')]]&&_0x479e09[_0x1f2c('0x9')](_0x16c2b6[_0x282e01['variableName']][_0x1f2c('0xa')]());}else if(_0x282e01[_0x1f2c('0x4')]===_0x1f2c('0xb')&&_0x282e01['Variable']&&_0x282e01['Variable'][_0x1f2c('0xc')]){_0x16c2b6[_0x282e01[_0x1f2c('0xd')][_0x1f2c('0xc')][_0x1f2c('0xe')]()]&&_0x479e09['push'](_0x16c2b6[_0x282e01['Variable'][_0x1f2c('0xc')][_0x1f2c('0xe')]()][_0x1f2c('0xa')]());}else if(_0x282e01[_0x1f2c('0x4')]==='keyValue'){if(_0x282e01['keyType']===_0x1f2c('0x5')&&_0x282e01[_0x1f2c('0xf')]){_0x479e09['push'](util[_0x1f2c('0x10')](_0x1f2c('0x11'),_0x282e01['key'],_0x282e01[_0x1f2c('0x12')]));}else if(_0x282e01[_0x1f2c('0x13')]==='variable'&&_0x282e01[_0x1f2c('0x8')]&&_0x282e01[_0x1f2c('0xf')]){_0x16c2b6[_0x282e01['variableName']]&&_0x479e09['push'](util[_0x1f2c('0x10')](_0x1f2c('0x11'),_0x282e01['key'],_0x16c2b6[_0x282e01[_0x1f2c('0x8')]]));}else if(_0x282e01[_0x1f2c('0x13')]===_0x1f2c('0xb')&&_0x282e01[_0x1f2c('0xd')]&&_0x282e01['Variable']['name']&&_0x282e01[_0x1f2c('0xf')]){_0x16c2b6[_0x282e01['Variable'][_0x1f2c('0xc')]['toLowerCase']()]&&_0x479e09[_0x1f2c('0x9')](util['format'](_0x1f2c('0x11'),_0x282e01['key'],_0x16c2b6[_0x282e01[_0x1f2c('0xd')][_0x1f2c('0xc')][_0x1f2c('0xe')]()]));}}}}return _0x479e09['join'](_0x181d7c);};exports[_0x1f2c('0x14')]=function(_0x3602c5){var _0x445a7f=_0x3602c5[_0x1f2c('0x15')](-0x1);if(_0x445a7f==='/'){_0x3602c5=_0x3602c5[_0x1f2c('0x16')](0x0,_0x3602c5['lastIndexOf'](_0x445a7f));}return _0x3602c5;};exports['validateEmail']=function(_0x567e29){if(!_[_0x1f2c('0x17')](_0x567e29)&&_0x567e29!==''){var _0x1db755=/^(([^<>()\[\]\\.,;:\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 _0x1db755[_0x1f2c('0x18')](String(_0x567e29)[_0x1f2c('0xe')]());}else{return![];}};