Built motion from commit 1fa89557.|2.6.10
[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 _0xfc2a=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','next','isObject','validate','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','message','join','info'];(function(_0x316e16,_0xefcdc7){var _0x1580df=function(_0x2aadde){while(--_0x2aadde){_0x316e16['push'](_0x316e16['shift']());}};_0x1580df(++_0xefcdc7);}(_0xfc2a,0x92));var _0xafc2=function(_0x2d560b,_0x4278af){_0x2d560b=_0x2d560b-0x0;var _0x49a56c=_0xfc2a[_0x2d560b];return _0x49a56c;};'use strict';var schema=require(_0xafc2('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xafc2('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xafc2('0x2')),'faxInteraction':require(_0xafc2('0x3')),'whatsappInteraction':require(_0xafc2('0x4'))};var logger=require(_0xafc2('0x5'))(_0xafc2('0x6'));var tag=schema({'tag':{'type':_0xafc2('0x7'),'required':!![],'message':_0xafc2('0x8')}});exports[_0xafc2('0x9')]=function(_0x4646d5,_0x477ddf,_0x51ca11,_0x246124){return function(_0x33abea){try{var _0x10af92={'tag':_0x477ddf[0x0]};var _0x2ef489=tag['validate'](_0x10af92,{'typecast':!![]});if(_0x2ef489['length']){logger[_0xafc2('0xa')](_0xafc2('0xb'),_0x4646d5,_[_0xafc2('0xc')](_0x2ef489,_0xafc2('0xd'))[_0xafc2('0xe')](',\x20'));logger[_0xafc2('0xf')](_0xafc2('0x10'),_0x4646d5);_0x33abea['next']();}else{var _0x1e5372={'ids':[_0x477ddf[0x0]]};if(rpc[_0x246124[_0xafc2('0x11')]+_0xafc2('0x12')]){rpc[_0x246124['channel']+_0xafc2('0x12')][_0xafc2('0x13')](_0x246124['interaction']['id'],_0x1e5372)[_0xafc2('0x14')](function(_0x4171fd){logger[_0xafc2('0xf')](_0xafc2('0x15'),_0x4646d5,_0x477ddf[0x1],_0x246124[_0xafc2('0x11')],_0x246124[_0xafc2('0x16')]['id']);})[_0xafc2('0x17')](function(_0x30fa47){logger[_0xafc2('0xa')](_0xafc2('0xb'),_0x4646d5,JSON[_0xafc2('0x18')](_0x30fa47));logger['info'](_0xafc2('0x10'),_0x4646d5);})['finally'](function(){_0x33abea[_0xafc2('0x19')]();});}}}catch(_0x1bbd16){logger[_0xafc2('0xa')](_0xafc2('0xb'),_0x4646d5,_[_0xafc2('0x1a')](_0x1bbd16)?JSON[_0xafc2('0x18')](_0x1bbd16):_0x1bbd16);logger[_0xafc2('0xf')](_0xafc2('0x10'),_0x4646d5);_0x33abea[_0xafc2('0x19')]();}};};