Built motion from commit 19a84241.|2.5.34
[motion2.git] / server / services / routing / server / applications / tag.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 _0x50e1=['catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','consequence','length','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x50e1,0x148));var _0x150e=function(_0x2442cd,_0x53a46e){_0x2442cd=_0x2442cd-0x0;var _0x2e491b=_0x50e1[_0x2442cd];return _0x2e491b;};'use strict';var schema=require(_0x150e('0x0'));var _=require(_0x150e('0x1'));var rpc={'chatInteraction':require(_0x150e('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x150e('0x3')),'mailInteraction':require(_0x150e('0x4')),'faxInteraction':require(_0x150e('0x5')),'whatsappInteraction':require(_0x150e('0x6'))};var logger=require('../../../../config/logger')(_0x150e('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x150e('0x8')]=function(_0x5899eb,_0x5c15c3,_0x225d67,_0x1a7f49){return function(_0x3e0650){try{var _0xc56bf7={'tag':_0x5c15c3[0x0]};var _0x1ac49b=tag[_0x150e('0x0')](_0xc56bf7,{'typecast':!![]});if(_0x1ac49b[_0x150e('0x9')]){logger[_0x150e('0xa')](_0x150e('0xb'),_0x5899eb,_[_0x150e('0xc')](_0x1ac49b,_0x150e('0xd'))['join'](',\x20'));logger[_0x150e('0xe')](_0x150e('0xf'),_0x5899eb);_0x3e0650[_0x150e('0x10')]();}else{var _0x556ad2={'ids':[_0x5c15c3[0x0]]};if(rpc[_0x1a7f49[_0x150e('0x11')]+_0x150e('0x12')]){rpc[_0x1a7f49[_0x150e('0x11')]+'Interaction'][_0x150e('0x13')](_0x1a7f49[_0x150e('0x14')]['id'],_0x556ad2)[_0x150e('0x15')](function(_0x2fbcde){logger[_0x150e('0xe')](_0x150e('0x16'),_0x5899eb,_0x5c15c3[0x1],_0x1a7f49[_0x150e('0x11')],_0x1a7f49[_0x150e('0x14')]['id']);})[_0x150e('0x17')](function(_0x5016e4){logger['error']('[%s][TAG]\x20%s',_0x5899eb,JSON[_0x150e('0x18')](_0x5016e4));logger[_0x150e('0xe')](_0x150e('0xf'),_0x5899eb);})[_0x150e('0x19')](function(){_0x3e0650[_0x150e('0x10')]();});}}}catch(_0x5bb021){logger['error'](_0x150e('0xb'),_0x5899eb,_[_0x150e('0x1a')](_0x5bb021)?JSON['stringify'](_0x5bb021):_0x5bb021);logger['info'](_0x150e('0xf'),_0x5899eb);_0x3e0650[_0x150e('0x10')]();}};};