Built motion from commit (unavailable).|2.5.0
[motion2.git] / server / services / routing / server / applications / gotoif.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 _0xf3ae=['html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash'];(function(_0x3e379b,_0x119328){var _0x42398a=function(_0x3aa63d){while(--_0x3aa63d){_0x3e379b['push'](_0x3e379b['shift']());}};_0x42398a(++_0x119328);}(_0xf3ae,0x1cf));var _0xef3a=function(_0x33d949,_0x31b6f3){_0x33d949=_0x33d949-0x0;var _0x4a513f=_0xf3ae[_0x33d949];return _0x4a513f;};'use strict';var schema=require(_0xef3a('0x0'));var _=require(_0xef3a('0x1'));var htmlToText=require(_0xef3a('0x2'));var utils=require(_0xef3a('0x3'));var logger=require(_0xef3a('0x4'))(_0xef3a('0x5'));var gotoif=schema({'condition':{'type':_0xef3a('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xef3a('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xef3a('0x7'),'message':_0xef3a('0x8')}});exports[_0xef3a('0x9')]=function(_0x3f59f7,_0x3c54f8){return function(_0x4aa130){try{var _0x364db0={'condition':htmlToText['fromString'](utils[_0xef3a('0xa')](_0x3c54f8[0x0],this),{'wordwrap':![]})[_0xef3a('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3c54f8[0x1],'priorityFalse':_0x3c54f8[0x2]};var _0x4807b0=gotoif[_0xef3a('0x0')](_0x364db0,{'typecast':!![]});if(_0x4807b0[_0xef3a('0xc')]){logger[_0xef3a('0xd')](_0xef3a('0xe'),_0x3f59f7,_[_0xef3a('0xf')](_0x4807b0,_0xef3a('0x10'))[_0xef3a('0x11')](',\x20'));_0x4aa130[_0xef3a('0x12')]();}else{try{var _0x438d9d=eval('('+_0x364db0[_0xef3a('0x13')]+')');var _0x1705a8=_0x438d9d?_0x364db0[_0xef3a('0x14')]:_0x364db0[_0xef3a('0x15')];logger[_0xef3a('0x16')](_0xef3a('0x17'),_0x3f59f7,_0x364db0[_0xef3a('0x13')],_0x438d9d,_0x1705a8||'next');if(_0x1705a8){var _0xacb7bf=_[_0xef3a('0x18')](_0x4aa130[_0xef3a('0x19')](),{'p':_0x1705a8});if(_0xacb7bf>=0x0){logger[_0xef3a('0x16')](_0xef3a('0x1a'),_0x3f59f7,_0x1705a8||'next',_0xacb7bf);_0x4aa130[_0xef3a('0x1b')](_0xacb7bf);}else{logger['info'](_0xef3a('0x1c'),_0x3f59f7,_0x1705a8||'next');_0x4aa130[_0xef3a('0x12')]();}}else{_0x4aa130[_0xef3a('0x1b')]();}}catch(_0x333a3e){logger[_0xef3a('0xd')](_0xef3a('0x1d'),_0x3f59f7,_0x333a3e[_0xef3a('0x10')]);_0x4aa130['stop']();}}}catch(_0xd9423a){logger[_0xef3a('0xd')]('[%s][GOTOIF]\x20%s',_0x3f59f7,JSON[_0xef3a('0x1e')](_0xd9423a));_0x4aa130['stop']();}};};