Built motion from commit (unavailable).|2.6.0
[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 _0xc8f7=['content','variableName','toString','customVariable','Variable','name','toLowerCase','string','key','format','keyContent','variable','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','test','length','sortBy','type','push'];(function(_0x1300fa,_0x29204d){var _0x15ea35=function(_0x2d8f9c){while(--_0x2d8f9c){_0x1300fa['push'](_0x1300fa['shift']());}};_0x15ea35(++_0x29204d);}(_0xc8f7,0x172));var _0x7c8f=function(_0x4d209b,_0x1a05e8){_0x4d209b=_0x4d209b-0x0;var _0xc5e693=_0xc8f7[_0x4d209b];return _0xc5e693;};'use strict';var _=require('lodash');var util=require('util');exports['getString']=function(_0x28e2cf,_0x29cc75,_0x1980b1){var _0x5ae1b2=[];if(_0x28e2cf[_0x7c8f('0x0')]>0x0){var _0xea4e19=_[_0x7c8f('0x1')](_0x28e2cf,['id']);for(var _0x3dc9f1=0x0;_0x3dc9f1<_0xea4e19[_0x7c8f('0x0')];_0x3dc9f1++){var _0x2e8c73=_0xea4e19[_0x3dc9f1];if(_0x2e8c73[_0x7c8f('0x2')]==='string'){_0x5ae1b2[_0x7c8f('0x3')](_0x2e8c73[_0x7c8f('0x4')]);}else if(_0x2e8c73[_0x7c8f('0x2')]==='variable'&&_0x2e8c73[_0x7c8f('0x5')]){_0x29cc75[_0x2e8c73[_0x7c8f('0x5')]]&&_0x5ae1b2[_0x7c8f('0x3')](_0x29cc75[_0x2e8c73[_0x7c8f('0x5')]][_0x7c8f('0x6')]());}else if(_0x2e8c73[_0x7c8f('0x2')]===_0x7c8f('0x7')&&_0x2e8c73[_0x7c8f('0x8')]&&_0x2e8c73['Variable']['name']){_0x29cc75[_0x2e8c73['Variable'][_0x7c8f('0x9')][_0x7c8f('0xa')]()]&&_0x5ae1b2['push'](_0x29cc75[_0x2e8c73['Variable'][_0x7c8f('0x9')][_0x7c8f('0xa')]()][_0x7c8f('0x6')]());}else if(_0x2e8c73[_0x7c8f('0x2')]==='keyValue'){if(_0x2e8c73['keyType']===_0x7c8f('0xb')&&_0x2e8c73[_0x7c8f('0xc')]){_0x5ae1b2['push'](util[_0x7c8f('0xd')]('%s:\x20%s',_0x2e8c73[_0x7c8f('0xc')],_0x2e8c73[_0x7c8f('0xe')]));}else if(_0x2e8c73['keyType']===_0x7c8f('0xf')&&_0x2e8c73[_0x7c8f('0x5')]&&_0x2e8c73[_0x7c8f('0xc')]){_0x29cc75[_0x2e8c73['variableName']]&&_0x5ae1b2[_0x7c8f('0x3')](util[_0x7c8f('0xd')]('%s:\x20%s',_0x2e8c73[_0x7c8f('0xc')],_0x29cc75[_0x2e8c73['variableName']]));}else if(_0x2e8c73['keyType']==='customVariable'&&_0x2e8c73[_0x7c8f('0x8')]&&_0x2e8c73[_0x7c8f('0x8')]['name']&&_0x2e8c73[_0x7c8f('0xc')]){_0x29cc75[_0x2e8c73[_0x7c8f('0x8')][_0x7c8f('0x9')][_0x7c8f('0xa')]()]&&_0x5ae1b2['push'](util[_0x7c8f('0xd')]('%s:\x20%s',_0x2e8c73['key'],_0x29cc75[_0x2e8c73[_0x7c8f('0x8')]['name'][_0x7c8f('0xa')]()]));}}}}return _0x5ae1b2[_0x7c8f('0x10')](_0x1980b1);};exports[_0x7c8f('0x11')]=function(_0x29862a){var _0x3565f4=_0x29862a['slice'](-0x1);if(_0x3565f4==='/'){_0x29862a=_0x29862a[_0x7c8f('0x12')](0x0,_0x29862a[_0x7c8f('0x13')](_0x3565f4));}return _0x29862a;};exports[_0x7c8f('0x14')]=function(_0x42a292){if(!_['isNil'](_0x42a292)&&_0x42a292!==''){var _0x59fc89=/^(([^<>()\[\]\\.,;:\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 _0x59fc89[_0x7c8f('0x15')](String(_0x42a292)[_0x7c8f('0xa')]());}else{return![];}};