bc2ba0d55e0d0336cf983e8fad23f4ad35648000
[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 _0xfabe=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','routing','number','consequence','error','[%s][TAG]\x20%s','message','join','info','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','lodash'];(function(_0x453b4d,_0x5552e1){var _0x5064a7=function(_0x46c87b){while(--_0x46c87b){_0x453b4d['push'](_0x453b4d['shift']());}};_0x5064a7(++_0x5552e1);}(_0xfabe,0x11c));var _0xefab=function(_0x588557,_0x273bde){_0x588557=_0x588557-0x0;var _0x4a3be7=_0xfabe[_0x588557];return _0x4a3be7;};'use strict';var schema=require(_0xefab('0x0'));var _=require(_0xefab('0x1'));var rpc={'chatInteraction':require(_0xefab('0x2')),'openchannelInteraction':require(_0xefab('0x3')),'smsInteraction':require(_0xefab('0x4')),'mailInteraction':require(_0xefab('0x5')),'faxInteraction':require(_0xefab('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0xefab('0x7'));var tag=schema({'tag':{'type':_0xefab('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xefab('0x9')]=function(_0x1e8171,_0x240b3c,_0x5c9648,_0x7866fb){return function(_0x51c6ed){try{var _0x56683d={'tag':_0x240b3c[0x0]};var _0x258574=tag[_0xefab('0x0')](_0x56683d,{'typecast':!![]});if(_0x258574['length']){logger[_0xefab('0xa')](_0xefab('0xb'),_0x1e8171,_['map'](_0x258574,_0xefab('0xc'))[_0xefab('0xd')](',\x20'));logger[_0xefab('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1e8171);_0x51c6ed[_0xefab('0xf')]();}else{var _0x120a42={'ids':[_0x240b3c[0x0]]};if(rpc[_0x7866fb[_0xefab('0x10')]+_0xefab('0x11')]){rpc[_0x7866fb[_0xefab('0x10')]+'Interaction'][_0xefab('0x12')](_0x7866fb[_0xefab('0x13')]['id'],_0x120a42)[_0xefab('0x14')](function(_0x1f1037){logger[_0xefab('0xe')](_0xefab('0x15'),_0x1e8171,_0x240b3c[0x1],_0x7866fb['channel'],_0x7866fb[_0xefab('0x13')]['id']);})['catch'](function(_0x5d2216){logger[_0xefab('0xa')](_0xefab('0xb'),_0x1e8171,JSON[_0xefab('0x16')](_0x5d2216));logger[_0xefab('0xe')](_0xefab('0x17'),_0x1e8171);})[_0xefab('0x18')](function(){_0x51c6ed['next']();});}}}catch(_0x5b7561){logger[_0xefab('0xa')]('[%s][TAG]\x20%s',_0x1e8171,_[_0xefab('0x19')](_0x5b7561)?JSON[_0xefab('0x16')](_0x5b7561):_0x5b7561);logger[_0xefab('0xe')](_0xefab('0x17'),_0x1e8171);_0x51c6ed[_0xefab('0xf')]();}};};