Built motion from commit (unavailable).|2.5.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 _0xdfc2=['length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','interaction','catch','finally','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xdfc2,0x1b6));var _0x2dfc=function(_0x5602ac,_0x4666a2){_0x5602ac=_0x5602ac-0x0;var _0x150efa=_0xdfc2[_0x5602ac];return _0x150efa;};'use strict';var schema=require(_0x2dfc('0x0'));var _=require(_0x2dfc('0x1'));var rpc={'chatInteraction':require(_0x2dfc('0x2')),'openchannelInteraction':require(_0x2dfc('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x2dfc('0x4')),'faxInteraction':require(_0x2dfc('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x2dfc('0x6'));var tag=schema({'tag':{'type':_0x2dfc('0x7'),'required':!![],'message':_0x2dfc('0x8')}});exports[_0x2dfc('0x9')]=function(_0x29b597,_0x49fe7b,_0x6f6b6c,_0x33f4b0){return function(_0x1a8e8c){try{var _0xbb2b16={'tag':_0x49fe7b[0x0]};var _0x2e17d2=tag[_0x2dfc('0x0')](_0xbb2b16,{'typecast':!![]});if(_0x2e17d2[_0x2dfc('0xa')]){logger[_0x2dfc('0xb')](_0x2dfc('0xc'),_0x29b597,_[_0x2dfc('0xd')](_0x2e17d2,_0x2dfc('0xe'))[_0x2dfc('0xf')](',\x20'));logger[_0x2dfc('0x10')](_0x2dfc('0x11'),_0x29b597);_0x1a8e8c[_0x2dfc('0x12')]();}else{var _0x3cab4b={'ids':[_0x49fe7b[0x0]]};if(rpc[_0x33f4b0[_0x2dfc('0x13')]+_0x2dfc('0x14')]){rpc[_0x33f4b0[_0x2dfc('0x13')]+_0x2dfc('0x14')][_0x2dfc('0x15')](_0x33f4b0['interaction']['id'],_0x3cab4b)[_0x2dfc('0x16')](function(_0x399825){logger[_0x2dfc('0x10')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x29b597,_0x49fe7b[0x1],_0x33f4b0[_0x2dfc('0x13')],_0x33f4b0[_0x2dfc('0x17')]['id']);})[_0x2dfc('0x18')](function(_0x2a45de){logger[_0x2dfc('0xb')](_0x2dfc('0xc'),_0x29b597,JSON['stringify'](_0x2a45de));logger['info'](_0x2dfc('0x11'),_0x29b597);})[_0x2dfc('0x19')](function(){_0x1a8e8c[_0x2dfc('0x12')]();});}}}catch(_0x41701c){logger[_0x2dfc('0xb')]('[%s][TAG]\x20%s',_0x29b597,_[_0x2dfc('0x1a')](_0x41701c)?JSON[_0x2dfc('0x1b')](_0x41701c):_0x41701c);logger['info'](_0x2dfc('0x11'),_0x29b597);_0x1a8e8c['next']();}};};