Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / components / interaction / utils.js
index f95515f..ff6683f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb0f7=['_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','Interaction','findOne','then','update','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','capitalize','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags'];(function(_0x39a378,_0x24e80){var _0x578a3b=function(_0x8f8e2){while(--_0x8f8e2){_0x39a378['push'](_0x39a378['shift']());}};_0x578a3b(++_0x24e80);}(_0xb0f7,0x1df));var _0x7b0f=function(_0x35f1f0,_0x5a69a3){_0x35f1f0=_0x35f1f0-0x0;var _0x41cd13=_0xb0f7[_0x35f1f0];return _0x41cd13;};'use strict';var _=require(_0x7b0f('0x0'));var db=require(_0x7b0f('0x1'))['db'];var loggers={'openchannel':require(_0x7b0f('0x2'))(_0x7b0f('0x3')),'mail':require(_0x7b0f('0x2'))(_0x7b0f('0x4')),'fax':require(_0x7b0f('0x2'))(_0x7b0f('0x5')),'sms':require(_0x7b0f('0x2'))('sms-interactions'),'chat':require('../../config/logger')(_0x7b0f('0x6')),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getAccountFK(_0x464ff2){return _[_0x7b0f('0x7')](_0x464ff2)+(_0x464ff2==='chat'?_0x7b0f('0x8'):_0x7b0f('0x9'))+'Id';}function getInteractionFK(_0x44286c){return _['capitalize'](_0x44286c)+_0x7b0f('0xa');}function getInteractionId(_0x2eb29e,_0x456c99,_0xe6c1c0){if(_0x2eb29e&&_0x2eb29e[_[_0x7b0f('0xb')](_0xe6c1c0)+_0x7b0f('0xa')]){return _0x2eb29e[_[_0x7b0f('0xb')](_0xe6c1c0)+_0x7b0f('0xa')];}else if(_0x2eb29e&&_0x2eb29e['id']){return _0x2eb29e['id'];}else if(_0x456c99&&_0x456c99['id']){return _0x456c99['id'];}else{return _0x7b0f('0xc');}}function getInteractionsTables(_0x5be9e3){return{'accounts':_0x5be9e3+'_'+(_0x5be9e3==='chat'?_0x7b0f('0xd'):_0x7b0f('0xe')),'interactions':_0x5be9e3+_0x7b0f('0xf'),'interactionsTags':_0x5be9e3+_0x7b0f('0x10'),'messages':_0x5be9e3+_0x7b0f('0x11'),'userInteractions':_0x7b0f('0x12')+_0x5be9e3+'_interactions'};}function getSelectedTags(_0x56db2d){var _0x1222d7=[];if(_0x56db2d){_0x1222d7=Array[_0x7b0f('0x13')](_0x56db2d)?_0x56db2d:[_0x56db2d];}return _0x1222d7;}function log(_0x5dcbb1,_0x21f4c4,_0x38def6,_0x12b99d,_0x303cbb,_0x2d8642){loggers[_0x303cbb['toLowerCase']()][_0x5dcbb1](_0x7b0f('0x14'),_0x2d8642[_0x7b0f('0x15')](),_0x21f4c4?_0x21f4c4['id']:null,_0x21f4c4?_0x21f4c4['name']:null,_0x21f4c4?_0x21f4c4[_0x7b0f('0x16')]:null,getInteractionId(_0x38def6,_0x12b99d,_0x303cbb),_0x38def6?JSON[_0x7b0f('0x17')](_0x38def6):'null');}function updateUser(_0x2c4209,_0xf26736,_0x305ab2,_0x58f5e1,_0x5df71e){db[_[_0x7b0f('0xb')](_0x58f5e1)+_0x7b0f('0x18')][_0x7b0f('0x19')]({'where':{'id':getInteractionId(_0xf26736,_0x305ab2,_0x58f5e1)}})[_0x7b0f('0x1a')](function(_0x3087f0){if(_0x3087f0){return _0x3087f0[_0x7b0f('0x1b')]({'UserId':_0x2c4209?_0x2c4209['id']:null});}})['then'](function(_0x475ad7){if(_0x475ad7){log('info',_0x2c4209,_0xf26736,_0x305ab2,_0x58f5e1,_0x5df71e);}})[_0x7b0f('0x1c')](function(){log(_0x7b0f('0x1d'),_0x2c4209,_0xf26736,_0x305ab2,_0x58f5e1,_0x5df71e);});}module[_0x7b0f('0x1e')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser};
\ No newline at end of file
+var _0x7d14=['../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','Website','Account','capitalize','InteractionId','upperFirst','unknown','chat','websites','accounts','_interactions','_interaction_has_tags','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','Interaction','then','update','info','catch','lodash','../../mysqldb'];(function(_0x5e9861,_0x45bf40){var _0x2a2232=function(_0x95e394){while(--_0x95e394){_0x5e9861['push'](_0x5e9861['shift']());}};_0x2a2232(++_0x45bf40);}(_0x7d14,0x1cc));var _0x47d1=function(_0x72e1d6,_0xf9b7f0){_0x72e1d6=_0x72e1d6-0x0;var _0x620e86=_0x7d14[_0x72e1d6];return _0x620e86;};'use strict';var _=require(_0x47d1('0x0'));var db=require(_0x47d1('0x1'))['db'];var loggers={'openchannel':require(_0x47d1('0x2'))(_0x47d1('0x3')),'mail':require(_0x47d1('0x2'))(_0x47d1('0x4')),'fax':require(_0x47d1('0x2'))(_0x47d1('0x5')),'sms':require(_0x47d1('0x2'))(_0x47d1('0x6')),'chat':require(_0x47d1('0x2'))(_0x47d1('0x7')),'whatsapp':require('../../config/logger')(_0x47d1('0x8'))};function getAccountFK(_0x2f04ed){return _['capitalize'](_0x2f04ed)+(_0x2f04ed==='chat'?_0x47d1('0x9'):_0x47d1('0xa'))+'Id';}function getInteractionFK(_0x3f7e2d){return _[_0x47d1('0xb')](_0x3f7e2d)+_0x47d1('0xc');}function getInteractionId(_0x2151e0,_0x249e21,_0x4257fb){if(_0x2151e0&&_0x2151e0[_[_0x47d1('0xd')](_0x4257fb)+'InteractionId']){return _0x2151e0[_[_0x47d1('0xd')](_0x4257fb)+'InteractionId'];}else if(_0x2151e0&&_0x2151e0['id']){return _0x2151e0['id'];}else if(_0x249e21&&_0x249e21['id']){return _0x249e21['id'];}else{return _0x47d1('0xe');}}function getInteractionsTables(_0x555b97){return{'accounts':_0x555b97+'_'+(_0x555b97===_0x47d1('0xf')?_0x47d1('0x10'):_0x47d1('0x11')),'interactions':_0x555b97+_0x47d1('0x12'),'interactionsTags':_0x555b97+_0x47d1('0x13'),'messages':_0x555b97+'_messages','userInteractions':_0x47d1('0x14')+_0x555b97+_0x47d1('0x12')};}function getSelectedTags(_0x3f8050){var _0x36b16c=[];if(_0x3f8050){_0x36b16c=Array[_0x47d1('0x15')](_0x3f8050)?_0x3f8050:[_0x3f8050];}return _0x36b16c;}function log(_0x1fe244,_0x4826f1,_0x45217f,_0x5bbac0,_0x1ab289,_0x2ea91d){loggers[_0x1ab289[_0x47d1('0x16')]()][_0x1fe244](_0x47d1('0x17'),_0x2ea91d[_0x47d1('0x18')](),_0x4826f1?_0x4826f1['id']:null,_0x4826f1?_0x4826f1[_0x47d1('0x19')]:null,_0x4826f1?_0x4826f1[_0x47d1('0x1a')]:null,getInteractionId(_0x45217f,_0x5bbac0,_0x1ab289),_0x45217f?JSON['stringify'](_0x45217f):_0x47d1('0x1b'));}function updateUser(_0x187bdd,_0x215be8,_0x372046,_0x36a1ef,_0x2cfe79){db[_[_0x47d1('0xd')](_0x36a1ef)+_0x47d1('0x1c')]['findOne']({'where':{'id':getInteractionId(_0x215be8,_0x372046,_0x36a1ef)}})[_0x47d1('0x1d')](function(_0xbc834b){if(_0xbc834b){return _0xbc834b[_0x47d1('0x1e')]({'UserId':_0x187bdd?_0x187bdd['id']:null});}})['then'](function(_0x27879c){if(_0x27879c){log(_0x47d1('0x1f'),_0x187bdd,_0x215be8,_0x372046,_0x36a1ef,_0x2cfe79);}})[_0x47d1('0x20')](function(){log('error',_0x187bdd,_0x215be8,_0x372046,_0x36a1ef,_0x2cfe79);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser};
\ No newline at end of file