/*! For license information please see bea8f93df818f1b2debe.js.LICENSE.txt */
"use strict";(self.webpackChunkaesirx_cmp=self.webpackChunkaesirx_cmp||[]).push([[425],{58425:(s,t,e)=>{e.r(t),e.d(t,{default:()=>S});var i=e(47736),r=e(95394),a=e(33353),o=e(43029),n=e(96540),l=e(56347),d=e(99258),h=e(2376),c=e(95093),A=e.n(c),u=e(56795),v=e(32389),p=class{constructor(){(0,o.Mu)(this,"getAIAdvisor",(async(s,t,e)=>{try{const i=new h.AesirxCmpApiService,r=await i.getConsentsTemplate(s);r?(0,d.h5)((()=>{t(r)})):e({message:"Something went wrong from Server response"})}catch(s){(0,d.h5)((()=>{s.response?.data.error?e({message:s.response?.data?.error}):e({message:s?.response?.data?.error?s.response?.data?._messages[0]?.message:"Something went wrong from Server response"})}))}})),(0,o.Mu)(this,"updateAIAdvisor",(async(s,t,e)=>{try{const i=new h.AesirxCmpApiService,r=await i.updateConsentsTemplate(s);r?(0,d.h5)((()=>{t(r)})):e({message:"Something went wrong from Server response"})}catch(s){(0,d.h5)((()=>{s.response?.data.error?e({message:s.response?.data?.error}):e({message:s?.response?.data?.error?s.response?.data?._messages[0]?.message:"Something went wrong from Server response"})}))}}))}},M=class{constructor(s,t){(0,o.Mu)(this,"consentsStore",null),(0,o.Mu)(this,"status",r.s.READY),(0,o.Mu)(this,"globalStoreViewModel",null),(0,o.Mu)(this,"data",null),(0,o.Mu)(this,"dataFilter",{}),(0,o.Mu)(this,"statusAIAdvisor",r.s.READY),(0,o.Mu)(this,"statusUpdateAIAdvisor",r.s.READY),(0,o.Mu)(this,"aiAdvisor",null),(0,o.Mu)(this,"sortBy",{"sort[]":"","sort_direction[]":""}),(0,o.Mu)(this,"initialize",(async s=>{this.getAIAdvisor(s)})),(0,o.Mu)(this,"getAIAdvisor",(s=>{this.statusAIAdvisor=r.s.LOADING,this.consentsStore.getAIAdvisor(s,this.callbackOnDataAIAdvisorListSuccessHandler,this.callbackOnErrorHandler)})),(0,o.Mu)(this,"updateAIAdvisor",(s=>{this.statusUpdateAIAdvisor=r.s.LOADING,this.consentsStore.updateAIAdvisor(s,this.callbackOnDataUpdateAIAdvisorSuccessHandler,this.callbackOnErrorUpdateConsentHandler)})),(0,o.Mu)(this,"setDataFilter",(s=>{this.dataFilter=s})),(0,o.Mu)(this,"handleFilterDateRange",((s,t)=>{this.statusAIAdvisor=r.s.LOADING;const e={...this.globalStoreViewModel.dateFilter,date_start:A()(s).format("YYYY-MM-DD"),date_end:A()(t).endOf("day").format("YYYY-MM-DD")};this.dateFilter={...this.dateFilter,...e},this.initialize(this.dataFilter,e)})),(0,o.Mu)(this,"handleFilterTableAIAdvisorList",(async s=>{this.statusAIAdvisor=r.s.LOADING,this.dataFilterAIAdvisorList={...this.dataFilterAIAdvisorList,...s};const t={...this.globalStoreViewModel.dateFilter};await this.consentsStore.getAIAdvisor(this.dataFilterAIAdvisorList,t,this.callbackOnDataAIAdvisorListSuccessHandler,this.callbackOnErrorHandler)})),(0,o.Mu)(this,"callbackOnErrorHandler",(()=>{this.status=r.s.READY,this.statusAIAdvisor=r.s.READY,this.aiAdvisor={}})),(0,o.Mu)(this,"callbackOnErrorUpdateConsentHandler",(()=>{this.status=r.s.READY,this.statusUpdateAIAdvisor=r.s.READY})),(0,o.Mu)(this,"callbackOnDataAIAdvisorListSuccessHandler",(s=>{s?(this.statusAIAdvisor=r.s.READY,this.aiAdvisor=s):(this.statusAIAdvisor=r.s.ERROR,this.aiAdvisor={})})),(0,o.Mu)(this,"callbackOnDataUpdateAIAdvisorSuccessHandler",(s=>{s?(this.statusUpdateAIAdvisor=r.s.READY,this.aiAdvisor=s):(this.statusUpdateAIAdvisor=r.s.ERROR,this.aiAdvisor={})})),(0,d.l_)(this),this.consentsStore=s,this.globalStoreViewModel=t}},m=class{constructor(s,t){(0,o.Mu)(this,"consentsList",null),(0,o.Mu)(this,"getAIAdvisorListViewModel",(()=>this.consentsList)),s&&(this.consentsList=new M(s,t))}},g=(0,n.lazy)((()=>e.e(885).then(e.bind(e,54885)))),w=({link:s,...t})=>n.createElement(g,{...t}),I=(0,u.PA)(class extends n.Component{constructor(s){super(s),(0,o.Mu)(this,"consentsStore",null),(0,o.Mu)(this,"behaviorViewModel",null);const{viewModel:t}=s;this.viewModel=t||null,this.biListViewModel=this.viewModel?this.viewModel.getBiListViewModel():null,this.consentsStore=new p({}),this.behaviorViewModel=new m(this.consentsStore,this.biListViewModellog)}render(){const{integration:s=!1}=this.props,{integrationLink:t,activeDomain:e}=this.biListViewModel;return n.createElement(i.P,{viewModel:this.behaviorViewModel},n.createElement(D,{integration:s,integrationLink:t,activeDomain:e,ref:s=>this.componentRef=s}))}}),D=(0,u.PA)(class extends n.Component{constructor(s){super(s)}render(){return n.createElement("div",{className:"aesirxui"},this.props.integration?n.createElement(w,{link:this.props.integrationLink,activeDomain:this.props.activeDomain,...this.props}):n.createElement(n.Fragment,null,n.createElement(l.qh,{exact:!0,path:["/ai-advisor"]},n.createElement(g,null))))}}),S=(0,v.CI)()((0,l.y)((0,a.cm)(I)))},47736:(s,t,e)=>{e.d(t,{P:()=>a,U:()=>o});var i=e(96540),r=i.createContext(),a=({children:s,viewModel:t})=>i.createElement(r.Provider,{value:t},s),o=()=>i.useContext(r)}}]);