ae43abd4c21dcc2ec32e961612e6242bbc01c64b
[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 _0x801e=['customVariable','Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','format','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','type','string','variable','variableName','push','toString'];(function(_0x1711fa,_0xcc2e28){var _0x4c615c=function(_0x138f60){while(--_0x138f60){_0x1711fa['push'](_0x1711fa['shift']());}};_0x4c615c(++_0xcc2e28);}(_0x801e,0x13b));var _0xe801=function(_0x520557,_0x249a78){_0x520557=_0x520557-0x0;var _0x37a49a=_0x801e[_0x520557];return _0x37a49a;};'use strict';var _=require(_0xe801('0x0'));var util=require(_0xe801('0x1'));exports[_0xe801('0x2')]=function(_0x317844,_0x6ed08c,_0x1eb180){var _0x2d6d6a=[];if(_0x317844[_0xe801('0x3')]>0x0){var _0x339c62=_['sortBy'](_0x317844,['id']);for(var _0x3d9dd3=0x0;_0x3d9dd3<_0x339c62[_0xe801('0x3')];_0x3d9dd3++){var _0x547049=_0x339c62[_0x3d9dd3];if(_0x547049[_0xe801('0x4')]===_0xe801('0x5')){_0x2d6d6a['push'](_0x547049['content']);}else if(_0x547049[_0xe801('0x4')]===_0xe801('0x6')&&_0x547049[_0xe801('0x7')]){_0x6ed08c[_0x547049[_0xe801('0x7')]]&&_0x2d6d6a[_0xe801('0x8')](_0x6ed08c[_0x547049[_0xe801('0x7')]][_0xe801('0x9')]());}else if(_0x547049[_0xe801('0x4')]===_0xe801('0xa')&&_0x547049[_0xe801('0xb')]&&_0x547049[_0xe801('0xb')]['name']){_0x6ed08c[_0x547049[_0xe801('0xb')][_0xe801('0xc')][_0xe801('0xd')]()]&&_0x2d6d6a['push'](_0x6ed08c[_0x547049[_0xe801('0xb')]['name'][_0xe801('0xd')]()][_0xe801('0x9')]());}else if(_0x547049[_0xe801('0x4')]===_0xe801('0xe')){if(_0x547049[_0xe801('0xf')]===_0xe801('0x5')&&_0x547049[_0xe801('0x10')]){_0x2d6d6a[_0xe801('0x8')](util['format'](_0xe801('0x11'),_0x547049['key'],_0x547049['keyContent']));}else if(_0x547049[_0xe801('0xf')]===_0xe801('0x6')&&_0x547049['variableName']&&_0x547049[_0xe801('0x10')]){_0x6ed08c[_0x547049[_0xe801('0x7')]]&&_0x2d6d6a[_0xe801('0x8')](util[_0xe801('0x12')](_0xe801('0x11'),_0x547049[_0xe801('0x10')],_0x6ed08c[_0x547049[_0xe801('0x7')]]));}else if(_0x547049[_0xe801('0xf')]===_0xe801('0xa')&&_0x547049['Variable']&&_0x547049['Variable'][_0xe801('0xc')]&&_0x547049['key']){_0x6ed08c[_0x547049['Variable'][_0xe801('0xc')][_0xe801('0xd')]()]&&_0x2d6d6a[_0xe801('0x8')](util[_0xe801('0x12')](_0xe801('0x11'),_0x547049[_0xe801('0x10')],_0x6ed08c[_0x547049[_0xe801('0xb')][_0xe801('0xc')]['toLowerCase']()]));}}}}return _0x2d6d6a['join'](_0x1eb180);};exports[_0xe801('0x13')]=function(_0x8916f5){var _0x4455c8=_0x8916f5[_0xe801('0x14')](-0x1);if(_0x4455c8==='/'){_0x8916f5=_0x8916f5[_0xe801('0x15')](0x0,_0x8916f5[_0xe801('0x16')](_0x4455c8));}return _0x8916f5;};exports[_0xe801('0x17')]=function(_0x4003c3){if(!_[_0xe801('0x18')](_0x4003c3)&&_0x4003c3!==''){var _0x41dd97=/^(([^<>()\[\]\\.,;:\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 _0x41dd97['test'](String(_0x4003c3)[_0xe801('0xd')]());}else{return![];}};