Built motion from commit 911eb874.|2.6.31
[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 _0x53f6=['info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','isObject','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][TAG]\x20%s','map','message'];(function(_0x689bcc,_0x4a2c5d){var _0xbef31f=function(_0x1269a9){while(--_0x1269a9){_0x689bcc['push'](_0x689bcc['shift']());}};_0xbef31f(++_0x4a2c5d);}(_0x53f6,0xf5));var _0x653f=function(_0xc6b011,_0x5d1f19){_0xc6b011=_0xc6b011-0x0;var _0x420171=_0x53f6[_0xc6b011];return _0x420171;};'use strict';var schema=require('validate');var _=require(_0x653f('0x0'));var rpc={'chatInteraction':require(_0x653f('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x653f('0x2')),'mailInteraction':require(_0x653f('0x3')),'faxInteraction':require(_0x653f('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x653f('0x5'))(_0x653f('0x6'));var tag=schema({'tag':{'type':_0x653f('0x7'),'required':!![],'message':_0x653f('0x8')}});exports[_0x653f('0x9')]=function(_0x5e0b89,_0x42313d,_0x1a7121,_0x4f1e5f){return function(_0x44dcab){try{var _0x46e2e5={'tag':_0x42313d[0x0]};var _0x5b186a=tag[_0x653f('0xa')](_0x46e2e5,{'typecast':!![]});if(_0x5b186a['length']){logger[_0x653f('0xb')](_0x653f('0xc'),_0x5e0b89,_[_0x653f('0xd')](_0x5b186a,_0x653f('0xe'))['join'](',\x20'));logger[_0x653f('0xf')](_0x653f('0x10'),_0x5e0b89);_0x44dcab[_0x653f('0x11')]();}else{var _0x2c07df={'ids':[_0x42313d[0x0]]};if(rpc[_0x4f1e5f[_0x653f('0x12')]+'Interaction']){rpc[_0x4f1e5f['channel']+_0x653f('0x13')][_0x653f('0x14')](_0x4f1e5f[_0x653f('0x15')]['id'],_0x2c07df)['then'](function(_0x1d4ff3){logger[_0x653f('0xf')](_0x653f('0x16'),_0x5e0b89,_0x42313d[0x1],_0x4f1e5f['channel'],_0x4f1e5f[_0x653f('0x15')]['id']);})[_0x653f('0x17')](function(_0x3ca069){logger[_0x653f('0xb')](_0x653f('0xc'),_0x5e0b89,JSON[_0x653f('0x18')](_0x3ca069));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5e0b89);})['finally'](function(){_0x44dcab[_0x653f('0x11')]();});}}}catch(_0x46403a){logger['error']('[%s][TAG]\x20%s',_0x5e0b89,_[_0x653f('0x19')](_0x46403a)?JSON[_0x653f('0x18')](_0x46403a):_0x46403a);logger[_0x653f('0xf')](_0x653f('0x10'),_0x5e0b89);_0x44dcab[_0x653f('0x11')]();}};};