Built motion from commit 639a1a7f.|2.6.19
[motion2.git] / server / components / interaction / utils.js
index 1b29ffa..cad865f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb884=['chat','_interactions','_interaction_has_tags','_messages','toUpperCase','name','role','stringify','null','findOne','update','then','info','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','upperFirst','InteractionId','unknown'];(function(_0xd5fd5c,_0x3e2a66){var _0x3b0663=function(_0x40643b){while(--_0x40643b){_0xd5fd5c['push'](_0xd5fd5c['shift']());}};_0x3b0663(++_0x3e2a66);}(_0xb884,0x15f));var _0x4b88=function(_0x23f8c8,_0xb536b9){_0x23f8c8=_0x23f8c8-0x0;var _0x3dc718=_0xb884[_0x23f8c8];return _0x3dc718;};'use strict';var _=require(_0x4b88('0x0'));var db=require(_0x4b88('0x1'))['db'];var loggers={'openchannel':require(_0x4b88('0x2'))(_0x4b88('0x3')),'mail':require(_0x4b88('0x2'))('mail-interactions'),'fax':require('../../config/logger')(_0x4b88('0x4')),'sms':require('../../config/logger')(_0x4b88('0x5')),'chat':require(_0x4b88('0x2'))(_0x4b88('0x6')),'whatsapp':require('../../config/logger')(_0x4b88('0x7'))};function getAccountFK(_0x1ed847){return _[_0x4b88('0x8')](_0x1ed847)+(_0x1ed847==='chat'?_0x4b88('0x9'):'Account')+'Id';}function getInteractionFK(_0xdac2f4){return _[_0x4b88('0x8')](_0xdac2f4)+'InteractionId';}function getInteractionId(_0xfa4900,_0x48f06a,_0x5c6665){if(_0xfa4900&&_0xfa4900[_[_0x4b88('0xa')](_0x5c6665)+_0x4b88('0xb')]){return _0xfa4900[_[_0x4b88('0xa')](_0x5c6665)+'InteractionId'];}else if(_0xfa4900&&_0xfa4900['id']){return _0xfa4900['id'];}else if(_0x48f06a&&_0x48f06a['id']){return _0x48f06a['id'];}else{return _0x4b88('0xc');}}function getInteractionsTables(_0x2c1346){return{'accounts':_0x2c1346+'_'+(_0x2c1346===_0x4b88('0xd')?'websites':'accounts'),'interactions':_0x2c1346+_0x4b88('0xe'),'interactionsTags':_0x2c1346+_0x4b88('0xf'),'messages':_0x2c1346+_0x4b88('0x10'),'userInteractions':'user_has_'+_0x2c1346+_0x4b88('0xe')};}function getSelectedTags(_0x305991){var _0x249d29=[];if(_0x305991){_0x249d29=Array['isArray'](_0x305991)?_0x305991:[_0x305991];}return _0x249d29;}function log(_0x5b52c3,_0x1a59ec,_0x46fc15,_0x829534,_0x31f133,_0x49c121){loggers[_0x31f133['toLowerCase']()][_0x5b52c3]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x49c121[_0x4b88('0x11')](),_0x1a59ec?_0x1a59ec['id']:null,_0x1a59ec?_0x1a59ec[_0x4b88('0x12')]:null,_0x1a59ec?_0x1a59ec[_0x4b88('0x13')]:null,getInteractionId(_0x46fc15,_0x829534,_0x31f133),_0x46fc15?JSON[_0x4b88('0x14')](_0x46fc15):_0x4b88('0x15'));}function updateUser(_0x5f2da6,_0x226427,_0x4b23ac,_0x4c37dc,_0x3b03ad){db[_[_0x4b88('0xa')](_0x4c37dc)+'Interaction'][_0x4b88('0x16')]({'where':{'id':getInteractionId(_0x226427,_0x4b23ac,_0x4c37dc)}})['then'](function(_0x4ee0e4){if(_0x4ee0e4){return _0x4ee0e4[_0x4b88('0x17')]({'UserId':_0x5f2da6?_0x5f2da6['id']:null});}})[_0x4b88('0x18')](function(_0xc4d2bf){if(_0xc4d2bf){log(_0x4b88('0x19'),_0x5f2da6,_0x226427,_0x4b23ac,_0x4c37dc,_0x3b03ad);}})['catch'](function(){log(_0x4b88('0x1a'),_0x5f2da6,_0x226427,_0x4b23ac,_0x4c37dc,_0x3b03ad);});}module[_0x4b88('0x1b')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser};
\ No newline at end of file
+var _0xcdbc=['name','stringify','null','Interaction','findOne','then','update','catch','error','exports','lodash','../../config/logger','openchannel-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','upperFirst','InteractionId','unknown','websites','accounts','_interactions','_messages','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcdbc,0x1bd));var _0xccdb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcdbc[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xccdb('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xccdb('0x1'))(_0xccdb('0x2')),'mail':require(_0xccdb('0x1'))('mail-interactions'),'fax':require(_0xccdb('0x1'))(_0xccdb('0x3')),'sms':require(_0xccdb('0x1'))('sms-interactions'),'chat':require(_0xccdb('0x1'))(_0xccdb('0x4')),'whatsapp':require(_0xccdb('0x1'))(_0xccdb('0x5'))};function getAccountFK(_0x1fdc40){return _[_0xccdb('0x6')](_0x1fdc40)+(_0x1fdc40===_0xccdb('0x7')?_0xccdb('0x8'):_0xccdb('0x9'))+'Id';}function getInteractionFK(_0x2b48a4){return _[_0xccdb('0x6')](_0x2b48a4)+'InteractionId';}function getInteractionId(_0x28ef70,_0x3b4fce,_0x2f07e9){if(_0x28ef70&&_0x28ef70[_[_0xccdb('0xa')](_0x2f07e9)+_0xccdb('0xb')]){return _0x28ef70[_[_0xccdb('0xa')](_0x2f07e9)+'InteractionId'];}else if(_0x28ef70&&_0x28ef70['id']){return _0x28ef70['id'];}else if(_0x3b4fce&&_0x3b4fce['id']){return _0x3b4fce['id'];}else{return _0xccdb('0xc');}}function getInteractionsTables(_0x4e53b4){return{'accounts':_0x4e53b4+'_'+(_0x4e53b4==='chat'?_0xccdb('0xd'):_0xccdb('0xe')),'interactions':_0x4e53b4+_0xccdb('0xf'),'interactionsTags':_0x4e53b4+'_interaction_has_tags','messages':_0x4e53b4+_0xccdb('0x10'),'userInteractions':'user_has_'+_0x4e53b4+_0xccdb('0xf')};}function getSelectedTags(_0x399f6a){var _0x218c98=[];if(_0x399f6a){_0x218c98=Array[_0xccdb('0x11')](_0x399f6a)?_0x399f6a:[_0x399f6a];}return _0x218c98;}function log(_0x36bfe1,_0x50f579,_0x5ed9c3,_0x5eef82,_0x56e40c,_0x11b3b5){loggers[_0x56e40c['toLowerCase']()][_0x36bfe1](_0xccdb('0x12'),_0x11b3b5['toUpperCase'](),_0x50f579?_0x50f579['id']:null,_0x50f579?_0x50f579[_0xccdb('0x13')]:null,_0x50f579?_0x50f579['role']:null,getInteractionId(_0x5ed9c3,_0x5eef82,_0x56e40c),_0x5ed9c3?JSON[_0xccdb('0x14')](_0x5ed9c3):_0xccdb('0x15'));}function updateUser(_0x375d88,_0x4acb40,_0x4216c4,_0xa8d08b,_0x20a8a0){db[_['upperFirst'](_0xa8d08b)+_0xccdb('0x16')][_0xccdb('0x17')]({'where':{'id':getInteractionId(_0x4acb40,_0x4216c4,_0xa8d08b)}})[_0xccdb('0x18')](function(_0x1cf573){if(_0x1cf573){return _0x1cf573[_0xccdb('0x19')]({'UserId':_0x375d88?_0x375d88['id']:null});}})[_0xccdb('0x18')](function(_0x56d504){if(_0x56d504){log('info',_0x375d88,_0x4acb40,_0x4216c4,_0xa8d08b,_0x20a8a0);}})[_0xccdb('0x1a')](function(){log(_0xccdb('0x1b'),_0x375d88,_0x4acb40,_0x4216c4,_0xa8d08b,_0x20a8a0);});}module[_0xccdb('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser};
\ No newline at end of file