b3b309e9fda1997c4d2d914eb10a1f2f207dc657
[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 _0x41fb=['next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0x41fb,0x12d));var _0xb41f=function(_0x197576,_0xf4aa75){_0x197576=_0x197576-0x0;var _0x3e6603=_0x41fb[_0x197576];return _0x3e6603;};'use strict';var schema=require(_0xb41f('0x0'));var _=require(_0xb41f('0x1'));var rpc={'chatInteraction':require(_0xb41f('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xb41f('0x3')),'mailInteraction':require(_0xb41f('0x4')),'faxInteraction':require(_0xb41f('0x5')),'whatsappInteraction':require(_0xb41f('0x6'))};var logger=require(_0xb41f('0x7'))(_0xb41f('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xb41f('0x9')}});exports[_0xb41f('0xa')]=function(_0x4fe848,_0x4f2e85,_0x3ab2ff,_0x4a3b22){return function(_0x202ea4){try{var _0xc0a7f={'tag':_0x4f2e85[0x0]};var _0x3657dc=tag[_0xb41f('0x0')](_0xc0a7f,{'typecast':!![]});if(_0x3657dc[_0xb41f('0xb')]){logger['error'](_0xb41f('0xc'),_0x4fe848,_[_0xb41f('0xd')](_0x3657dc,_0xb41f('0xe'))[_0xb41f('0xf')](',\x20'));logger[_0xb41f('0x10')](_0xb41f('0x11'),_0x4fe848);_0x202ea4[_0xb41f('0x12')]();}else{var _0x2dc513={'ids':[_0x4f2e85[0x0]]};if(rpc[_0x4a3b22[_0xb41f('0x13')]+_0xb41f('0x14')]){rpc[_0x4a3b22[_0xb41f('0x13')]+_0xb41f('0x14')][_0xb41f('0x15')](_0x4a3b22['interaction']['id'],_0x2dc513)[_0xb41f('0x16')](function(_0x3946c3){logger['info'](_0xb41f('0x17'),_0x4fe848,_0x4f2e85[0x1],_0x4a3b22['channel'],_0x4a3b22[_0xb41f('0x18')]['id']);})[_0xb41f('0x19')](function(_0x123eef){logger['error'](_0xb41f('0xc'),_0x4fe848,JSON[_0xb41f('0x1a')](_0x123eef));logger[_0xb41f('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4fe848);})[_0xb41f('0x1b')](function(){_0x202ea4[_0xb41f('0x12')]();});}}}catch(_0x3ec825){logger[_0xb41f('0x1c')]('[%s][TAG]\x20%s',_0x4fe848,_['isObject'](_0x3ec825)?JSON[_0xb41f('0x1a')](_0x3ec825):_0x3ec825);logger[_0xb41f('0x10')](_0xb41f('0x11'),_0x4fe848);_0x202ea4[_0xb41f('0x12')]();}};};