Built motion from commit (unavailable).|2.4.19
[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 _0x0e45=['join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message'];(function(_0x163a86,_0x187d42){var _0x2b8a53=function(_0x372c8f){while(--_0x372c8f){_0x163a86['push'](_0x163a86['shift']());}};_0x2b8a53(++_0x187d42);}(_0x0e45,0xad));var _0x50e4=function(_0x16f488,_0x5cb0f5){_0x16f488=_0x16f488-0x0;var _0x228bf9=_0x0e45[_0x16f488];return _0x228bf9;};'use strict';var schema=require(_0x50e4('0x0'));var _=require(_0x50e4('0x1'));var htmlToText=require(_0x50e4('0x2'));var utils=require(_0x50e4('0x3'));var logger=require(_0x50e4('0x4'))(_0x50e4('0x5'));var gotoif=schema({'condition':{'type':_0x50e4('0x6'),'required':!![],'message':_0x50e4('0x7')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x50e4('0x8'),'message':_0x50e4('0x9')}});exports[_0x50e4('0xa')]=function(_0x310038,_0x5ed652){return function(_0x99d5bf){try{var _0x1ff314={'condition':htmlToText[_0x50e4('0xb')](utils[_0x50e4('0xc')](_0x5ed652[0x0],this),{'wordwrap':![]})[_0x50e4('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5ed652[0x1],'priorityFalse':_0x5ed652[0x2]};var _0x252733=gotoif[_0x50e4('0x0')](_0x1ff314,{'typecast':!![]});if(_0x252733[_0x50e4('0xe')]){logger[_0x50e4('0xf')](_0x50e4('0x10'),_0x310038,_[_0x50e4('0x11')](_0x252733,_0x50e4('0x12'))[_0x50e4('0x13')](',\x20'));_0x99d5bf[_0x50e4('0x14')]();}else{try{var _0x5280d4=eval('('+_0x1ff314[_0x50e4('0x15')]+')');var _0x50ae5a=_0x5280d4?_0x1ff314['priorityTrue']:_0x1ff314[_0x50e4('0x16')];logger[_0x50e4('0x17')](_0x50e4('0x18'),_0x310038,_0x1ff314[_0x50e4('0x15')],_0x5280d4,_0x50ae5a||_0x50e4('0x19'));if(_0x50ae5a){var _0xa1f651=_[_0x50e4('0x1a')](_0x99d5bf[_0x50e4('0x1b')](),{'p':_0x50ae5a});if(_0xa1f651>=0x0){logger['info'](_0x50e4('0x1c'),_0x310038,_0x50ae5a||_0x50e4('0x19'),_0xa1f651);_0x99d5bf[_0x50e4('0x19')](_0xa1f651);}else{logger[_0x50e4('0x17')](_0x50e4('0x1d'),_0x310038,_0x50ae5a||_0x50e4('0x19'));_0x99d5bf['stop']();}}else{_0x99d5bf[_0x50e4('0x19')]();}}catch(_0x25232d){logger[_0x50e4('0xf')](_0x50e4('0x1e'),_0x310038,_0x25232d[_0x50e4('0x12')]);_0x99d5bf[_0x50e4('0x14')]();}}}catch(_0x1b1b23){logger[_0x50e4('0xf')](_0x50e4('0x10'),_0x310038,JSON[_0x50e4('0x1f')](_0x1b1b23));_0x99d5bf['stop']();}};};