"use strict";(self.webpackChunkLiveHelperChat=self.webpackChunkLiveHelperChat||[]).push([[783],{5783:function(t,i,e){e.r(i),e.d(i,{activityMonitoring:function(){return c}});var s=e(5671),n=e(3144),u=e(593),a=e(2137),c=new(function(){function t(){(0,s.Z)(this,t),this.params={},this.timeoutStatuscheck=null,this.timeoutActivity=null,this.attributes=null,this.userActive=1}return(0,n.Z)(t,[{key:"attatchActivityListeners",value:function(){var t=this;if(this.params.track_activity){var i=function(){t.resetTimeoutActivity()};this.params.track_mouse&&(u.U.listen(window,"mousemove",i,"lhc_mousemove_w"),u.U.listen(document,"mousemove",i,"lhc_mousemove_d")),u.U.listen(window,"mousedown",i,"lhc_mousedown"),u.U.listen(window,"click",i,"lhc_click"),u.U.listen(window,"scroll",i,"lhc_scroll"),u.U.listen(window,"keypress",i,"lhc_keypress"),u.U.listen(window,"load",i,"lhc_load"),u.U.listen(document,"scroll",i,"lhc_scroll"),u.U.listen(document,"touchstart",i,"lhc_touchstart"),u.U.listen(document,"touchend",i,"lhc_touchend"),this.resetTimeoutActivity()}}},{key:"resetTimeoutActivity",value:function(){var t=this,i=0==this.userActive;this.userActive=1,1==i&&this.syncUserStatus(1),clearTimeout(this.timeoutActivity),this.timeoutActivity=setTimeout((function(){t.userActive=0,t.syncUserStatus(1)}),3e5)}},{key:"setParams",value:function(t,i){this.params=t,this.attributes=i,this.attatchActivityListeners(),this.initMonitoring()}},{key:"initMonitoring",value:function(){var t=this;clearTimeout(this.timeoutStatuscheck),this.timeoutStatuscheck=setTimeout((function(){t.syncUserStatus(0),t.initMonitoring()}),1e3*this.params.timeout)}},{key:"syncUserStatus",value:function(t){var i=this,e=this.attributes.userSession.getSessionAttributes(),s={vid:this.attributes.userSession.getVID(),wopen:this.attributes.widgetStatus.value?1:0,uaction:t,uactiv:this.userActive,dep:this.attributes.department.join(",")};e.id&&e.hash&&(s.hash=e.id+"_"+e.hash),a.a.makeRequest(this.attributes.LHC_API.args.lhc_base_url+this.attributes.lang+"widgetrestapi/chatcheckstatus",{params:s},(function(t){1==t.change_status&&i.attributes.onlineStatus.value!=t.online&&i.attributes.onlineStatus.next(t.online)}))}}]),t}())}}]);
//# sourceMappingURL=a68fc3eccb8af7392e9f.js.map