Built motion from commit 464be02.|0.0.84
[motion.git] / server / config / routing / chat / index.js
1 var _0x6767=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x75\x74\x69\x6C","\x61\x73\x79\x6E\x63","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C","\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x68\x61\x74\x56\x69\x73\x69\x74\x6F\x72","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65","\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x53\x65\x73\x73\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x49\x6E\x74\x65\x72\x76\x61\x6C","\x55\x73\x65\x72","\x2E\x2F\x73\x65\x73\x73\x69\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x73","\x43\x68\x61\x74\x20\x52\x6F\x75\x74\x69\x6E\x67\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E","\x6C\x6F\x67","\x6F\x72\x69\x67\x69\x6E","\x77\x65\x62\x63\x68\x61\x74","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x77\x65\x62\x73\x69\x74\x65\x69\x64","\x69\x64","\x77\x65\x62\x73\x69\x74\x65\x6E\x61\x6D\x65","\x6E\x61\x6D\x65","\x77\x65\x62\x73\x69\x74\x65\x61\x64\x64\x72\x65\x73\x73","\x61\x64\x64\x72\x65\x73\x73","\x66\x69\x64\x65\x6C\x69\x74\x79","\x61\x70\x70\x74\x69\x6D\x65\x6F\x75\x74","\x71\x75\x65\x75\x65\x74\x69\x6D\x65\x6F\x75\x74","\x74\x69\x6D\x65\x6F\x75\x74","\x73\x74\x72\x61\x74\x65\x67\x79","\x62\x65\x65\x70\x61\x6C\x6C","\x70\x72\x69\x6F\x72\x69\x74\x79\x20\x41\x53\x43","\x6F\x6E\x6C\x69\x6E\x65","\x63\x68\x61\x74\x50\x61\x75\x73\x65","\x67\x65\x74\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x65\x78\x74\x65\x72\x6E\x61\x6C","\x76\x69\x73\x69\x74\x6F\x72\x69\x64","\x63\x72\x65\x61\x74\x65","\x72\x6F\x6F\x6D\x69\x64","\x75\x6E\x69\x71\x75\x65\x69\x64","\x25\x73\x2E\x25\x73","\x75\x6E\x69\x78","\x66\x6F\x72\x6D\x61\x74","\x61\x67\x65\x6E\x74\x73","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x63\x6C\x6F\x6E\x65\x44\x65\x65\x70","\x6C\x65\x6E\x67\x74\x68","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x76\x69\x73\x69\x74\x6F\x72\x6E\x61\x6D\x65","\x76\x69\x73\x69\x74\x6F\x72\x65\x6D\x61\x69\x6C","\x61\x67\x65\x6E\x74","\x71\x75\x65\x75\x65\x69\x64","\x71\x75\x65\x75\x65\x6E\x61\x6D\x65","\x74\x69\x6D\x65\x73\x6C\x6F\x74","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x73\x75\x62\x6A\x65\x63\x74","\x66\x72\x6F\x6D","\x64\x61\x74\x61\x31","\x64\x61\x74\x61\x32","\x64\x61\x74\x61\x33","\x6C\x61\x62\x65\x6C\x44\x61\x74\x61\x31","\x6C\x61\x62\x65\x6C\x44\x61\x74\x61\x32","\x6C\x61\x62\x65\x6C\x44\x61\x74\x61\x33","\x61\x70\x70","\x6D\x61\x70","\x71\x75\x65\x75\x65","\x75\x70\x64\x61\x74\x65","\x45\x6E\x64\x20\x63\x68\x61\x74\x20\x72\x6F\x75\x74\x69\x6E\x67\x2E\x2E","\x43\x68\x61\x74\x20\x75\x6E\x6D\x61\x6E\x61\x67\x65\x64\x3A","\x43\x68\x61\x74\x20\x61\x62\x61\x6E\x64\x6F\x6E\x3A","\x77\x61\x74\x65\x72\x66\x61\x6C\x6C","\x61\x62\x61\x6E\x64\x6F\x6E","\x55\x4E\x4D\x41\x4E\x41\x47\x45\x44","\x75\x6E\x73\x65\x72\x76\x65\x64","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x49\x64","\x65\x72\x72","\x55\x6E\x6B\x6E\x6F\x77\x6E\x20\x43\x68\x61\x74\x52\x6F\x6F\x6D\x2E\x2E","\x55\x6E\x6B\x6E\x6F\x77\x6E\x20\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x20\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73\x2E\x2E","\x55\x6E\x6B\x6E\x6F\x77\x6E\x20\x43\x68\x61\x74\x57\x65\x62\x73\x69\x74\x65\x2E\x2E","\x66\x69\x6E\x64\x42\x79\x49\x64","\x55\x73\x65\x72\x73","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x44\x45\x53\x43","\x66\x69\x6E\x64\x4F\x6E\x65"];_0x6767[0];var _=require(_0x6767[1]);var moment=require(_0x6767[2]);var util=require(_0x6767[3]);var async=require(_0x6767[4]);var Util=require(_0x6767[5]);var ChatApplication=require(_0x6767[7])[_0x6767[6]];var ChatVisitor=require(_0x6767[7])[_0x6767[8]];var ChatWebsite=require(_0x6767[7])[_0x6767[9]];var ChatQueue=require(_0x6767[7])[_0x6767[10]];var ChatRoom=require(_0x6767[7])[_0x6767[11]];var ReportChat=require(_0x6767[7])[_0x6767[12]];var ReportChatSession=require(_0x6767[7])[_0x6767[13]];var ReportChatRoom=require(_0x6767[7])[_0x6767[14]];var Interval=require(_0x6767[7])[_0x6767[15]];var User=require(_0x6767[7])[_0x6767[16]];var Session=require(_0x6767[17]);module[_0x6767[18]]=function(){console[_0x6767[20]](_0x6767[19]);ChatVisitor[_0x6767[23]](function(_0x67f6x11){if(_0x67f6x11[_0x6767[21]]===_0x6767[22]){handleVisitor(_0x67f6x11)}})};function handleEntityNotFound(_0x67f6x13){return function(_0x67f6x14){if(!_0x67f6x14){throw {message:_0x67f6x13}};return _0x67f6x14}}function handleChatWebsite(_0x67f6x16,_0x67f6x17){return function(_0x67f6x18){_0x67f6x16[_0x6767[24]]=_0x67f6x18[_0x6767[25]];_0x67f6x16[_0x6767[26]]=_0x67f6x18[_0x6767[27]];_0x67f6x16[_0x6767[28]]=_0x67f6x18[_0x6767[29]];_0x67f6x17[_0x6767[30]]=_0x67f6x18[_0x6767[30]];if(_0x67f6x18[_0x6767[30]]){_0x67f6x17[_0x6767[31]]=_0x67f6x17[_0x6767[32]]=_0x67f6x18[_0x6767[33]];_0x67f6x17[_0x6767[30]]=_0x67f6x18[_0x6767[33]];_0x67f6x17[_0x6767[34]]=_0x6767[35]};return _0x67f6x18[_0x6767[39]]({order:_0x6767[36],include:[{model:ChatQueue,attributes:[_0x6767[25],_0x6767[27],_0x6767[33],_0x6767[34]],include:[{model:User,attributes:[_0x6767[25],_0x6767[27],_0x6767[37],_0x6767[38]]}]},{model:User,attributes:[_0x6767[25],_0x6767[27],_0x6767[37],_0x6767[38]]},{model:Interval,include:[{all:true}]}]})}}function handleChatRoom(_0x67f6x16,_0x67f6x1a,_0x67f6x17){return function(_0x67f6x1b){_0x67f6x1b[_0x6767[41]](function(_0x67f6x1c){_0x67f6x1a[_0x6767[40]](_0x67f6x1c)});_0x67f6x1a=_0x67f6x1b;return ChatRoom[_0x6767[44]]({type:_0x6767[42],ChatVisitorId:_0x67f6x16[_0x6767[43]],ChatWebsiteId:_0x67f6x16[_0x6767[24]]},{include:[{all:true}]})}}function handleApps(_0x67f6x16,_0x67f6x1a,_0x67f6x17){return function(_0x67f6x1e){var _0x67f6x1f=[];_0x67f6x16[_0x6767[45]]=_0x67f6x1e[_0x6767[25]];_0x67f6x16[_0x6767[46]]=util[_0x6767[49]](_0x6767[47],moment()[_0x6767[48]](),_0x67f6x1e[_0x6767[25]]);if(_0x67f6x17[_0x6767[30]]){_0x67f6x16[_0x6767[32]]=_0x67f6x17[_0x6767[30]];_0x67f6x16[_0x6767[31]]=_0x67f6x17[_0x6767[30]];_0x67f6x16[_0x6767[50]]=_0x67f6x17[_0x6767[50]];_0x67f6x16[_0x6767[51]]=_0x6767[30];_0x67f6x16[_0x6767[34]]=_0x6767[35];var _0x67f6x20=_[_0x6767[52]](_0x67f6x16);if(_0x67f6x20[_0x6767[50]][_0x6767[53]]){_0x67f6x1f[_0x6767[40]](function(_0x67f6x21){return ReportChatRoom[_0x6767[44]]({uniqueid:_0x67f6x20[_0x6767[46]],subject:_0x67f6x20[_0x6767[64]],websitename:_0x67f6x20[_0x6767[26]],websiteaddress:_0x67f6x20[_0x6767[28]],websiteid:_0x67f6x20[_0x6767[24]],visitorid:_0x67f6x20[_0x6767[43]],visitorname:_0x67f6x20[_0x6767[57]],visitoremail:_0x67f6x20[_0x6767[58]],from:_0x67f6x20[_0x6767[65]],roomid:_0x67f6x20[_0x6767[45]],data1:_0x67f6x16[_0x6767[66]],data2:_0x67f6x16[_0x6767[67]],data3:_0x67f6x16[_0x6767[68]],labelData1:_0x67f6x16[_0x6767[69]],labelData2:_0x67f6x16[_0x6767[70]],labelData3:_0x67f6x16[_0x6767[71]],joinAt:moment()[_0x6767[49]](_0x6767[63])})[_0x6767[56]](function(){return ReportChatSession[_0x6767[44]]({uniqueid:_0x67f6x20[_0x6767[46]],websitename:_0x67f6x20[_0x6767[26]],websiteaddress:_0x67f6x20[_0x6767[28]],websiteid:_0x67f6x20[_0x6767[24]],application:_0x67f6x20[_0x6767[51]],visitorid:_0x67f6x20[_0x6767[43]],visitorname:_0x67f6x20[_0x6767[57]],visitoremail:_0x67f6x20[_0x6767[58]],memberid:(_0x67f6x20[_0x6767[51]]===_0x6767[59]&&_0x67f6x20[_0x6767[50]][0])?_0x67f6x20[_0x6767[50]][0][_0x6767[25]]:null,membername:(_0x67f6x20[_0x6767[51]]===_0x6767[59]&&_0x67f6x20[_0x6767[50]][0])?_0x67f6x20[_0x6767[50]][0][_0x6767[27]]:null,queueid:_0x67f6x20[_0x6767[60]],queuename:_0x67f6x20[_0x6767[61]],roomid:_0x67f6x20[_0x6767[45]],fidelity:_0x67f6x20[_0x6767[51]]===_0x6767[30]?_0x67f6x20[_0x6767[62]]:null,joinAt:moment()[_0x6767[49]](_0x6767[63])})})[_0x6767[56]](function(){ new Session(_0x67f6x20,_0x67f6x21)})[_0x6767[55]](function(_0x67f6x22){console[_0x6767[54]](_0x67f6x22)})})}};_0x67f6x1a[_0x6767[41]](function(_0x67f6x1c,_0x67f6x23){var _0x67f6x20=_[_0x6767[52]](_0x67f6x16);_0x67f6x20[_0x6767[31]]=_0x67f6x1c[_0x6767[33]];_0x67f6x20[_0x6767[51]]=_0x67f6x1c[_0x6767[72]];switch(_0x67f6x1c[_0x6767[72]]){case _0x6767[74]:_0x67f6x20[_0x6767[60]]=_0x67f6x1c[_0x6767[10]][_0x6767[25]];_0x67f6x20[_0x6767[61]]=_0x67f6x1c[_0x6767[10]][_0x6767[27]];_0x67f6x20[_0x6767[34]]=_0x67f6x1c[_0x6767[10]][_0x6767[34]];_0x67f6x20[_0x6767[32]]=_0x67f6x1c[_0x6767[10]][_0x6767[33]];_0x67f6x20[_0x6767[50]]=_[_0x6767[73]](_0x67f6x1c[_0x6767[10]].Users,function(_0x67f6x24){return {id:_0x67f6x24[_0x6767[25]],name:_0x67f6x24[_0x6767[27]]}});break;case _0x6767[59]:_0x67f6x20[_0x6767[32]]=_0x67f6x1c[_0x6767[33]];_0x67f6x20[_0x6767[34]]=_0x6767[35];_0x67f6x20[_0x6767[50]]=[{id:_0x67f6x1c[_0x6767[16]][_0x6767[25]],name:_0x67f6x1c[_0x6767[16]][_0x6767[27]]}];break;default:};if(_0x67f6x1f[_0x6767[53]]){_0x67f6x1f[_0x6767[40]](function(_0x67f6x25,_0x67f6x26,_0x67f6x21){if(_0x67f6x25){return _0x67f6x21(null,_0x67f6x25,_0x67f6x26)}else {return ReportChatSession[_0x6767[75]]({leaveAt:moment()[_0x6767[49]](_0x6767[63]),unmanaged:true},{where:{leaveAt:null,uniqueid:_0x67f6x20[_0x6767[46]]}})[_0x6767[56]](function(){return ReportChatSession[_0x6767[44]]({uniqueid:_0x67f6x20[_0x6767[46]],websitename:_0x67f6x20[_0x6767[26]],websiteaddress:_0x67f6x20[_0x6767[28]],websiteid:_0x67f6x20[_0x6767[24]],application:_0x67f6x20[_0x6767[51]],visitorid:_0x67f6x20[_0x6767[43]],visitorname:_0x67f6x20[_0x6767[57]],visitoremail:_0x67f6x20[_0x6767[58]],memberid:(_0x67f6x20[_0x6767[51]]===_0x6767[59]&&_0x67f6x20[_0x6767[50]][0])?_0x67f6x20[_0x6767[50]][0][_0x6767[25]]:null,membername:(_0x67f6x20[_0x6767[51]]===_0x6767[59]&&_0x67f6x20[_0x6767[50]][0])?_0x67f6x20[_0x6767[50]][0][_0x6767[27]]:null,queueid:_0x67f6x20[_0x6767[60]],queuename:_0x67f6x20[_0x6767[61]],roomid:_0x67f6x20[_0x6767[45]],fidelity:_0x67f6x20[_0x6767[51]]===_0x6767[30]?_0x67f6x20[_0x6767[62]]:null,joinAt:moment()[_0x6767[49]](_0x6767[63])})})[_0x6767[56]](function(){ new Session(_0x67f6x20,_0x67f6x21)})[_0x6767[55]](function(_0x67f6x22){console[_0x6767[54]](_0x67f6x22)})}})}else {_0x67f6x1f[_0x6767[40]](function(_0x67f6x21){return ReportChatRoom[_0x6767[44]]({uniqueid:_0x67f6x20[_0x6767[46]],subject:_0x67f6x20[_0x6767[64]],websitename:_0x67f6x20[_0x6767[26]],websiteaddress:_0x67f6x20[_0x6767[28]],websiteid:_0x67f6x20[_0x6767[24]],visitorid:_0x67f6x20[_0x6767[43]],visitorname:_0x67f6x20[_0x6767[57]],visitoremail:_0x67f6x20[_0x6767[58]],from:_0x67f6x20[_0x6767[65]],roomid:_0x67f6x20[_0x6767[45]],data1:_0x67f6x16[_0x6767[66]],data2:_0x67f6x16[_0x6767[67]],data3:_0x67f6x16[_0x6767[68]],labelData1:_0x67f6x16[_0x6767[69]],labelData2:_0x67f6x16[_0x6767[70]],labelData3:_0x67f6x16[_0x6767[71]],joinAt:moment()[_0x6767[49]](_0x6767[63])})[_0x6767[56]](function(){return ReportChatSession[_0x6767[44]]({uniqueid:_0x67f6x20[_0x6767[46]],websitename:_0x67f6x20[_0x6767[26]],websiteaddress:_0x67f6x20[_0x6767[28]],websiteid:_0x67f6x20[_0x6767[24]],application:_0x67f6x20[_0x6767[51]],visitorid:_0x67f6x20[_0x6767[43]],visitorname:_0x67f6x20[_0x6767[57]],visitoremail:_0x67f6x20[_0x6767[58]],memberid:(_0x67f6x20[_0x6767[51]]===_0x6767[59]&&_0x67f6x20[_0x6767[50]][0])?_0x67f6x20[_0x6767[50]][0][_0x6767[25]]:null,membername:(_0x67f6x20[_0x6767[51]]===_0x6767[59]&&_0x67f6x20[_0x6767[50]][0])?_0x67f6x20[_0x6767[50]][0][_0x6767[27]]:null,queueid:_0x67f6x20[_0x6767[60]],queuename:_0x67f6x20[_0x6767[61]],roomid:_0x67f6x20[_0x6767[45]],fidelity:_0x67f6x20[_0x6767[51]]===_0x6767[30]?_0x67f6x20[_0x6767[62]]:null,joinAt:moment()[_0x6767[49]](_0x6767[63])})})[_0x6767[56]](function(){ new Session(_0x67f6x20,_0x67f6x21)})[_0x6767[55]](function(_0x67f6x22){console[_0x6767[54]](_0x67f6x22)})})}});async[_0x6767[79]](_0x67f6x1f,function(_0x67f6x22,_0x67f6x27,_0x67f6x26){if(_0x67f6x22){console[_0x6767[54]](_0x67f6x22)};console[_0x6767[20]](_0x6767[76]);if(!_0x67f6x27){console[_0x6767[20]](_0x6767[77],_0x67f6x16[_0x6767[46]]);return ReportChatRoom[_0x6767[75]]({leaveAt:moment()[_0x6767[49]](_0x6767[63]),unmanaged:true},{where:{leaveAt:null,uniqueid:_0x67f6x16[_0x6767[46]]},individualHooks:true})[_0x6767[56]](function(){return ReportChatSession[_0x6767[75]]({leaveAt:moment()[_0x6767[49]](_0x6767[63]),unmanaged:true},{where:{leaveAt:null,uniqueid:_0x67f6x16[_0x6767[46]]},individualHooks:true})})[_0x6767[56]](handleUnmanaged(_0x67f6x16))[_0x6767[55]](function(_0x67f6x22){console[_0x6767[54]](_0x67f6x22)})};if(_0x67f6x26){console[_0x6767[20]](_0x6767[78],_0x67f6x16[_0x6767[46]]);return ReportChatRoom[_0x6767[75]]({leaveAt:moment()[_0x6767[49]](_0x6767[63]),abandon:true},{where:{leaveAt:null,uniqueid:_0x67f6x16[_0x6767[46]]},individualHooks:true})[_0x6767[56]](handleAbandon(_0x67f6x16))[_0x6767[55]](function(_0x67f6x22){console[_0x6767[54]](_0x67f6x22)})};return})}}function handleAbandon(_0x67f6x16){return function(_0x67f6x29){return ChatVisitor[_0x6767[75]]({status:_0x6767[80]},{where:{id:_0x67f6x16[_0x6767[43]]}})}}function handleUnmanaged(_0x67f6x16){return function(_0x67f6x2b){return ChatVisitor[_0x6767[75]]({status:_0x6767[82]},{where:{id:_0x67f6x16[_0x6767[43]]}})[_0x6767[56]](function(){return ChatRoom[_0x6767[75]]({status:_0x6767[81]},{where:{id:_0x67f6x16[_0x6767[45]]}})})}}function handleVisitor(_0x67f6x11){var _0x67f6x1a=[];var _0x67f6x17={agents:[]};var _0x67f6x16={visitorid:_0x67f6x11[_0x6767[25]],visitorname:_0x67f6x11[_0x6767[83]],visitoremail:_0x67f6x11[_0x6767[84]],websiteid:_0x67f6x11[_0x6767[85]],data1:_0x67f6x11[_0x6767[66]]||null,data2:_0x67f6x11[_0x6767[67]]||null,data3:_0x67f6x11[_0x6767[68]]||null,labelData1:_0x67f6x11[_0x6767[69]]||null,labelData2:_0x67f6x11[_0x6767[70]]||null,labelData3:_0x67f6x11[_0x6767[71]]||null,joinAt:moment()[_0x6767[49]](_0x6767[63])};return ChatRoom[_0x6767[94]]({order:[[_0x6767[92],_0x6767[93]]],include:[{model:User,attributes:[_0x6767[25],_0x6767[27],_0x6767[37],_0x6767[38]],where:{id:{$gt:0}}},{model:ChatVisitor,where:{email:_0x67f6x11[_0x6767[84]]}}]})[_0x6767[56]](function(_0x67f6x2d){if(_0x67f6x2d&&_0x67f6x2d[_0x6767[91]][_0x6767[53]]>0){_0x67f6x17[_0x6767[50]]=_[_0x6767[73]](_0x67f6x2d.Users,function(_0x67f6x2e){return {id:_0x67f6x2e[_0x6767[25]],name:_0x67f6x2e[_0x6767[27]]}})};return})[_0x6767[56]](function(){return ChatWebsite[_0x6767[90]](_0x67f6x11.ChatWebsiteId)})[_0x6767[56]](handleEntityNotFound(_0x6767[89]))[_0x6767[56]](handleChatWebsite(_0x67f6x16,_0x67f6x17))[_0x6767[56]](handleEntityNotFound(_0x6767[88]))[_0x6767[56]](handleChatRoom(_0x67f6x16,_0x67f6x1a,_0x67f6x17))[_0x6767[56]](handleEntityNotFound(_0x6767[87]))[_0x6767[56]](handleApps(_0x67f6x16,_0x67f6x1a,_0x67f6x17))[_0x6767[55]](function(_0x67f6x22){console[_0x6767[54]](_0x6767[86],_0x67f6x22)})}