1d66448181ea97f39969413cc95488114cb6d3cc
[motion-next.git] / server / components / interaction / service.js
1 const a833_0x50c9=['chat-interactions','Interaction','upperFirst','error','omit','body','toUpperCase','query','clone','unknown','mail-interactions','info','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','sms-interactions','catch','../../config/logger','then','update','findOne','whatsapp-interactions','name','mobile'];(function(_0x431524,_0x50c997){const _0x525582=function(_0x5e69dc){while(--_0x5e69dc){_0x431524['push'](_0x431524['shift']());}};_0x525582(++_0x50c997);}(a833_0x50c9,0x185));const a833_0x5255=function(_0x431524,_0x50c997){_0x431524=_0x431524-0x0;let _0x525582=a833_0x50c9[_0x431524];return _0x525582;};const _0x553f3c=a833_0x5255;'use strict';const _=require('lodash'),db=require('../../mysqldb')['db'],loggers={'openchannel':require(_0x553f3c('0x0'))('openchannel-interactions'),'mail':require(_0x553f3c('0x0'))(_0x553f3c('0x11')),'fax':require(_0x553f3c('0x0'))('fax-interactions'),'sms':require(_0x553f3c('0x0'))(_0x553f3c('0x14')),'chat':require(_0x553f3c('0x0'))(_0x553f3c('0x7')),'whatsapp':require(_0x553f3c('0x0'))(_0x553f3c('0x4'))};function getInteractionId(_0x5e69dc,_0x87d31f,_0xea19e1){const _0x3005c9=_0x553f3c;if(_0x5e69dc&&_0x5e69dc[_[_0x3005c9('0x9')](_0xea19e1)+'InteractionId'])return _0x5e69dc[_[_0x3005c9('0x9')](_0xea19e1)+'InteractionId'];else{if(_0x5e69dc&&_0x5e69dc['id'])return _0x5e69dc['id'];else return _0x87d31f&&_0x87d31f['id']?_0x87d31f['id']:_0x3005c9('0x10');}}function log(_0x119425,_0x59d537,_0x58f3aa,_0x4dde74,_0x4a23ab,_0x212ef8){const _0x43342d=_0x553f3c;loggers[_0x4a23ab['toLowerCase']()][_0x119425](_0x43342d('0x13'),_0x212ef8[_0x43342d('0xd')](),_0x59d537?_0x59d537['id']:null,_0x59d537?_0x59d537[_0x43342d('0x5')]:null,_0x59d537?_0x59d537['role']:null,getInteractionId(_0x58f3aa,_0x4dde74,_0x4a23ab),_0x58f3aa?JSON['stringify'](_0x58f3aa):'null');}function updateUser(_0x32ccde,_0x5e356e,_0x36dc64,_0x3267f0,_0x2460f4){const _0x35e9a2=_0x553f3c;db[_[_0x35e9a2('0x9')](_0x3267f0)+_0x35e9a2('0x8')][_0x35e9a2('0x3')]({'where':{'id':getInteractionId(_0x5e356e,_0x36dc64,_0x3267f0)}})[_0x35e9a2('0x1')](function(_0x1de483){const _0x39877f=_0x35e9a2;if(_0x1de483)return _0x1de483[_0x39877f('0x2')]({'UserId':_0x32ccde?_0x32ccde['id']:null});})[_0x35e9a2('0x1')](function(_0x5bdbbe){const _0x4fb42f=_0x35e9a2;_0x5bdbbe&&log(_0x4fb42f('0x12'),_0x32ccde,_0x5e356e,_0x36dc64,_0x3267f0,_0x2460f4);})[_0x35e9a2('0x15')](function(){const _0x52b147=_0x35e9a2;log(_0x52b147('0xa'),_0x32ccde,_0x5e356e,_0x36dc64,_0x3267f0,_0x2460f4);});}exports['tracked']=function(_0x5d0543,_0x58d711){return function(_0x795e08,_0x1b2655,_0x5086b3){const _0x2b9e47=a833_0x5255,_0x73b73b=_0x795e08['user'];let _0x5601f6={};const _0x32acd3=_0x795e08[_0x2b9e47('0xe')];_0x5601f6&&(_0x5601f6=_[_0x2b9e47('0xf')](_0x795e08[_0x2b9e47('0xc')]),_0x5601f6=_[_0x2b9e47('0xb')](_0x5601f6,[_0x2b9e47('0xc'),'html','phone','fax',_0x2b9e47('0x6')])),updateUser(_0x73b73b,_0x5601f6,_0x32acd3,_0x5d0543,_0x58d711),_0x5086b3(null);};};