Built motion from commit (unavailable).|2.3.4
[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 _0x6923=['format','join','substr','validateEmail','test','util','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','%s:\x20%s','key','keyContent'];(function(_0x497232,_0x4f1d61){var _0x5e7853=function(_0x91d282){while(--_0x91d282){_0x497232['push'](_0x497232['shift']());}};_0x5e7853(++_0x4f1d61);}(_0x6923,0x165));var _0x3692=function(_0x2df5ca,_0x8e02f9){_0x2df5ca=_0x2df5ca-0x0;var _0x101af2=_0x6923[_0x2df5ca];return _0x101af2;};'use strict';var _=require('lodash');var util=require(_0x3692('0x0'));exports['getString']=function(_0x204910,_0x150dd0,_0x51141e){var _0x39af3c=[];if(_0x204910['length']>0x0){var _0x376742=_[_0x3692('0x1')](_0x204910,['id']);for(var _0x1a56eb=0x0;_0x1a56eb<_0x376742['length'];_0x1a56eb++){var _0x2967d1=_0x376742[_0x1a56eb];if(_0x2967d1[_0x3692('0x2')]===_0x3692('0x3')){_0x39af3c[_0x3692('0x4')](_0x2967d1[_0x3692('0x5')]);}else if(_0x2967d1[_0x3692('0x2')]===_0x3692('0x6')&&_0x2967d1[_0x3692('0x7')]){_0x150dd0[_0x2967d1['variableName']]&&_0x39af3c['push'](_0x150dd0[_0x2967d1[_0x3692('0x7')]][_0x3692('0x8')]());}else if(_0x2967d1['type']===_0x3692('0x9')&&_0x2967d1[_0x3692('0xa')]&&_0x2967d1['Variable'][_0x3692('0xb')]){_0x150dd0[_0x2967d1[_0x3692('0xa')]['name'][_0x3692('0xc')]()]&&_0x39af3c[_0x3692('0x4')](_0x150dd0[_0x2967d1[_0x3692('0xa')][_0x3692('0xb')][_0x3692('0xc')]()]['toString']());}else if(_0x2967d1['type']==='keyValue'){if(_0x2967d1[_0x3692('0xd')]===_0x3692('0x3')&&_0x2967d1['key']){_0x39af3c[_0x3692('0x4')](util['format'](_0x3692('0xe'),_0x2967d1[_0x3692('0xf')],_0x2967d1[_0x3692('0x10')]));}else if(_0x2967d1[_0x3692('0xd')]===_0x3692('0x6')&&_0x2967d1[_0x3692('0x7')]&&_0x2967d1[_0x3692('0xf')]){_0x150dd0[_0x2967d1['variableName']]&&_0x39af3c['push'](util[_0x3692('0x11')](_0x3692('0xe'),_0x2967d1[_0x3692('0xf')],_0x150dd0[_0x2967d1[_0x3692('0x7')]]));}else if(_0x2967d1[_0x3692('0xd')]===_0x3692('0x9')&&_0x2967d1['Variable']&&_0x2967d1[_0x3692('0xa')]['name']&&_0x2967d1['key']){_0x150dd0[_0x2967d1['Variable'][_0x3692('0xb')][_0x3692('0xc')]()]&&_0x39af3c[_0x3692('0x4')](util['format'](_0x3692('0xe'),_0x2967d1[_0x3692('0xf')],_0x150dd0[_0x2967d1[_0x3692('0xa')][_0x3692('0xb')][_0x3692('0xc')]()]));}}}}return _0x39af3c[_0x3692('0x12')](_0x51141e);};exports['stripTrailingSlash']=function(_0x5e2580){if(_0x5e2580&&_0x5e2580[_0x3692('0x13')](-0x1)==='/'){return _0x5e2580[_0x3692('0x13')](0x0,_0x5e2580['length']-0x1);}return _0x5e2580;};exports[_0x3692('0x14')]=function(_0x258637){if(_0x258637&&_0x258637!==''){var _0x3e7eb7=/^(([^<>()\[\]\\.,;:\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 _0x3e7eb7[_0x3692('0x15')](String(_0x258637)[_0x3692('0xc')]());}else{return![];}};