Built motion from commit 753c950e.|2.5.42
[motion2.git] / server / components / interaction / service.js
index 550779b..6cfb507 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ba8=['info','catch','error','tracked','clone','body','html','phone','fax','lodash','openchannel-interactions','mail-interactions','sms-interactions','../../config/logger','whatsapp-interactions','upperFirst','InteractionId','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','Interaction','findOne','then','update'];(function(_0x408bb6,_0x51ec4a){var _0x830d87=function(_0x2a0ccd){while(--_0x2a0ccd){_0x408bb6['push'](_0x408bb6['shift']());}};_0x830d87(++_0x51ec4a);}(_0x1ba8,0x10d));var _0x81ba=function(_0x18850d,_0x553264){_0x18850d=_0x18850d-0x0;var _0x59ba45=_0x1ba8[_0x18850d];return _0x59ba45;};'use strict';var _=require(_0x81ba('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x81ba('0x1')),'mail':require('../../config/logger')(_0x81ba('0x2')),'fax':require('../../config/logger')('fax-interactions'),'sms':require('../../config/logger')(_0x81ba('0x3')),'chat':require(_0x81ba('0x4'))('chat-interactions'),'whatsapp':require(_0x81ba('0x4'))(_0x81ba('0x5'))};function getInteractionId(_0x5bf14b,_0x5e24d3,_0xc45bdb){if(_0x5bf14b&&_0x5bf14b[_[_0x81ba('0x6')](_0xc45bdb)+_0x81ba('0x7')]){return _0x5bf14b[_['upperFirst'](_0xc45bdb)+_0x81ba('0x7')];}else if(_0x5bf14b&&_0x5bf14b['id']){return _0x5bf14b['id'];}else if(_0x5e24d3&&_0x5e24d3['id']){return _0x5e24d3['id'];}else{return'unknown';}}function log(_0x377869,_0x2f773e,_0x2ff46c,_0x210f1a,_0x482711,_0x1520ae){loggers[_0x482711['toLowerCase']()][_0x377869](_0x81ba('0x8'),_0x1520ae[_0x81ba('0x9')](),_0x2f773e?_0x2f773e['id']:null,_0x2f773e?_0x2f773e[_0x81ba('0xa')]:null,_0x2f773e?_0x2f773e[_0x81ba('0xb')]:null,getInteractionId(_0x2ff46c,_0x210f1a,_0x482711),_0x2ff46c?JSON['stringify'](_0x2ff46c):_0x81ba('0xc'));}function updateUser(_0x51a5c4,_0x3b9329,_0x741125,_0x5810c1,_0x44a51c){db[_['upperFirst'](_0x5810c1)+_0x81ba('0xd')][_0x81ba('0xe')]({'where':{'id':getInteractionId(_0x3b9329,_0x741125,_0x5810c1)}})[_0x81ba('0xf')](function(_0x12f9bf){if(_0x12f9bf){return _0x12f9bf[_0x81ba('0x10')]({'UserId':_0x51a5c4?_0x51a5c4['id']:null});}})[_0x81ba('0xf')](function(_0x56822b){if(_0x56822b){log(_0x81ba('0x11'),_0x51a5c4,_0x3b9329,_0x741125,_0x5810c1,_0x44a51c);}})[_0x81ba('0x12')](function(){log(_0x81ba('0x13'),_0x51a5c4,_0x3b9329,_0x741125,_0x5810c1,_0x44a51c);});}exports[_0x81ba('0x14')]=function(_0x2a9db5,_0x4bf57a){return function(_0x3cc696,_0xf1d3b2,_0x533282){var _0x232f25=_0x3cc696['user'];var _0x33fb9f={};var _0x58d6e1=_0x3cc696['query'];if(_0x33fb9f){_0x33fb9f=_[_0x81ba('0x15')](_0x3cc696[_0x81ba('0x16')]);_0x33fb9f=_['omit'](_0x33fb9f,['body',_0x81ba('0x17'),_0x81ba('0x18'),_0x81ba('0x19'),'mobile']);}updateUser(_0x232f25,_0x33fb9f,_0x58d6e1,_0x2a9db5,_0x4bf57a);_0x533282(null);};};
\ No newline at end of file
+var _0xfc66=['../../config/logger','sms-interactions','chat-interactions','whatsapp-interactions','InteractionId','upperFirst','name','role','stringify','null','Interaction','findOne','then','info','error','tracked','user','query','clone','body','html','fax','mobile','lodash','../../mysqldb','openchannel-interactions','mail-interactions'];(function(_0x6ec16,_0x2e8212){var _0x2b62ac=function(_0x3aa462){while(--_0x3aa462){_0x6ec16['push'](_0x6ec16['shift']());}};_0x2b62ac(++_0x2e8212);}(_0xfc66,0x140));var _0x6fc6=function(_0x1174ca,_0x4964c3){_0x1174ca=_0x1174ca-0x0;var _0x3570c7=_0xfc66[_0x1174ca];return _0x3570c7;};'use strict';var _=require(_0x6fc6('0x0'));var db=require(_0x6fc6('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x6fc6('0x2')),'mail':require('../../config/logger')(_0x6fc6('0x3')),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0x6fc6('0x4'))(_0x6fc6('0x5')),'chat':require('../../config/logger')(_0x6fc6('0x6')),'whatsapp':require(_0x6fc6('0x4'))(_0x6fc6('0x7'))};function getInteractionId(_0xcc210a,_0x261e13,_0x421bb7){if(_0xcc210a&&_0xcc210a[_['upperFirst'](_0x421bb7)+_0x6fc6('0x8')]){return _0xcc210a[_[_0x6fc6('0x9')](_0x421bb7)+_0x6fc6('0x8')];}else if(_0xcc210a&&_0xcc210a['id']){return _0xcc210a['id'];}else if(_0x261e13&&_0x261e13['id']){return _0x261e13['id'];}else{return'unknown';}}function log(_0xd7e97e,_0x3b0fa0,_0x1acbe0,_0x23c4eb,_0x35401a,_0x5bf191){loggers[_0x35401a['toLowerCase']()][_0xd7e97e]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5bf191['toUpperCase'](),_0x3b0fa0?_0x3b0fa0['id']:null,_0x3b0fa0?_0x3b0fa0[_0x6fc6('0xa')]:null,_0x3b0fa0?_0x3b0fa0[_0x6fc6('0xb')]:null,getInteractionId(_0x1acbe0,_0x23c4eb,_0x35401a),_0x1acbe0?JSON[_0x6fc6('0xc')](_0x1acbe0):_0x6fc6('0xd'));}function updateUser(_0x3ed30b,_0x5f5bdc,_0x36bb8f,_0x2e339d,_0x3af1c7){db[_[_0x6fc6('0x9')](_0x2e339d)+_0x6fc6('0xe')][_0x6fc6('0xf')]({'where':{'id':getInteractionId(_0x5f5bdc,_0x36bb8f,_0x2e339d)}})[_0x6fc6('0x10')](function(_0x123bd8){if(_0x123bd8){return _0x123bd8['update']({'UserId':_0x3ed30b?_0x3ed30b['id']:null});}})[_0x6fc6('0x10')](function(_0x2c0772){if(_0x2c0772){log(_0x6fc6('0x11'),_0x3ed30b,_0x5f5bdc,_0x36bb8f,_0x2e339d,_0x3af1c7);}})['catch'](function(){log(_0x6fc6('0x12'),_0x3ed30b,_0x5f5bdc,_0x36bb8f,_0x2e339d,_0x3af1c7);});}exports[_0x6fc6('0x13')]=function(_0x129ce7,_0x504763){return function(_0x2125c0,_0xa80c14,_0x3f1ade){var _0x4f7bb1=_0x2125c0[_0x6fc6('0x14')];var _0x37674a={};var _0x3cf742=_0x2125c0[_0x6fc6('0x15')];if(_0x37674a){_0x37674a=_[_0x6fc6('0x16')](_0x2125c0[_0x6fc6('0x17')]);_0x37674a=_['omit'](_0x37674a,['body',_0x6fc6('0x18'),'phone',_0x6fc6('0x19'),_0x6fc6('0x1a')]);}updateUser(_0x4f7bb1,_0x37674a,_0x3cf742,_0x129ce7,_0x504763);_0x3f1ade(null);};};
\ No newline at end of file