Built motion from commit 753c950e.|2.5.42
[motion2.git] / server / components / interaction / service.js
index 144c369..6cfb507 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2b83=['body','html','phone','fax','mobile','../../mysqldb','../../config/logger','mail-interactions','sms-interactions','upperFirst','InteractionId','toLowerCase','toUpperCase','name','null','Interaction','findOne','update','catch','query','clone','omit'];(function(_0x99ba67,_0x10eae9){var _0x5c4f7d=function(_0x2962f6){while(--_0x2962f6){_0x99ba67['push'](_0x99ba67['shift']());}};_0x5c4f7d(++_0x10eae9);}(_0x2b83,0x1d3));var _0x32b8=function(_0x1e0ec6,_0x2a561e){_0x1e0ec6=_0x1e0ec6-0x0;var _0x9c94ba=_0x2b83[_0x1e0ec6];return _0x9c94ba;};'use strict';var _=require('lodash');var db=require(_0x32b8('0x0'))['db'];var loggers={'openchannel':require(_0x32b8('0x1'))('openchannel-interactions'),'mail':require(_0x32b8('0x1'))(_0x32b8('0x2')),'fax':require(_0x32b8('0x1'))('fax-interactions'),'sms':require('../../config/logger')(_0x32b8('0x3')),'chat':require(_0x32b8('0x1'))('chat-interactions'),'whatsapp':require(_0x32b8('0x1'))('whatsapp-interactions')};function getInteractionId(_0x18150c,_0x342a03,_0x36bde3){if(_0x18150c&&_0x18150c[_[_0x32b8('0x4')](_0x36bde3)+'InteractionId']){return _0x18150c[_[_0x32b8('0x4')](_0x36bde3)+_0x32b8('0x5')];}else if(_0x18150c&&_0x18150c['id']){return _0x18150c['id'];}else if(_0x342a03&&_0x342a03['id']){return _0x342a03['id'];}else{return'unknown';}}function log(_0x4f2aa0,_0x3f58a5,_0x5ecf4e,_0x10e421,_0x31b795,_0x465672){loggers[_0x31b795[_0x32b8('0x6')]()][_0x4f2aa0]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x465672[_0x32b8('0x7')](),_0x3f58a5?_0x3f58a5['id']:null,_0x3f58a5?_0x3f58a5[_0x32b8('0x8')]:null,_0x3f58a5?_0x3f58a5['role']:null,getInteractionId(_0x5ecf4e,_0x10e421,_0x31b795),_0x5ecf4e?JSON['stringify'](_0x5ecf4e):_0x32b8('0x9'));}function updateUser(_0x5a0ef2,_0x41594c,_0x4b838f,_0x37aa93,_0x6b533e){db[_[_0x32b8('0x4')](_0x37aa93)+_0x32b8('0xa')][_0x32b8('0xb')]({'where':{'id':getInteractionId(_0x41594c,_0x4b838f,_0x37aa93)}})['then'](function(_0x4c8fc9){if(_0x4c8fc9){return _0x4c8fc9[_0x32b8('0xc')]({'UserId':_0x5a0ef2?_0x5a0ef2['id']:null});}})['then'](function(_0x4e0d7a){if(_0x4e0d7a){log('info',_0x5a0ef2,_0x41594c,_0x4b838f,_0x37aa93,_0x6b533e);}})[_0x32b8('0xd')](function(){log('error',_0x5a0ef2,_0x41594c,_0x4b838f,_0x37aa93,_0x6b533e);});}exports['tracked']=function(_0x2828fc,_0x2ce0ea){return function(_0x2ba4eb,_0x1793b9,_0x599bc3){var _0x49ed18=_0x2ba4eb['user'];var _0x38f02b={};var _0x2ffea2=_0x2ba4eb[_0x32b8('0xe')];if(_0x38f02b){_0x38f02b=_[_0x32b8('0xf')](_0x2ba4eb['body']);_0x38f02b=_[_0x32b8('0x10')](_0x38f02b,[_0x32b8('0x11'),_0x32b8('0x12'),_0x32b8('0x13'),_0x32b8('0x14'),_0x32b8('0x15')]);}updateUser(_0x49ed18,_0x38f02b,_0x2ffea2,_0x2828fc,_0x2ce0ea);_0x599bc3(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