/*! For license information please see 0ec52c9010751e84dca8.js.LICENSE.txt */
"use strict";(self.webpackChunkaesirx_cmp=self.webpackChunkaesirx_cmp||[]).push([[260],{84260:(s,t,e)=>{e.r(t),e.d(t,{default:()=>b});var n=e(1465),i=e(95394),o=e(33353),a=e(43029),r=e(96540),c=e(56347),l=e(99258),h=e(2376),d=e(95184),u=e(95093),g=e.n(u),L=e(56795),p=e(32389),M=class{constructor(){(0,a.Mu)(this,"getConsentsLogic",(async(s,t,e)=>{try{const n=new h.AesirxCmpApiService,i=await n.getConsentsTemplate(s);i?(0,l.h5)((()=>{t(i)})):e({message:"Something went wrong from Server response"})}catch(s){(0,l.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,a.Mu)(this,"updateConsentsLogic",(async(s,t,e)=>{try{const n=new h.AesirxCmpApiService,i=await n.updateConsentsTemplate(s);i?(0,l.h5)((()=>{t(i)})):e({message:"Something went wrong from Server response"})}catch(s){(0,l.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,a.Mu)(this,"consentsStore",null),(0,a.Mu)(this,"status",i.s.READY),(0,a.Mu)(this,"globalStoreViewModel",null),(0,a.Mu)(this,"data",null),(0,a.Mu)(this,"dataFilter",{}),(0,a.Mu)(this,"statusConsentsLogic",i.s.READY),(0,a.Mu)(this,"statusUpdateConsentsLogic",i.s.READY),(0,a.Mu)(this,"consentsLogic",null),(0,a.Mu)(this,"sortBy",{"sort[]":"","sort_direction[]":""}),(0,a.Mu)(this,"initialize",(async s=>{this.getConsentsLogic(s)})),(0,a.Mu)(this,"getConsentsLogic",(s=>{this.statusConsentsLogic=i.s.LOADING,this.consentsStore.getConsentsLogic(s,this.callbackOnDataConsentsLogicListSuccessHandler,this.callbackOnErrorHandler)})),(0,a.Mu)(this,"updateConsentsLogic",(s=>{this.statusUpdateConsentsLogic=i.s.LOADING,this.consentsStore.updateConsentsLogic(s,this.callbackOnDataUpdateConsentLogicSuccessHandler,this.callbackOnErrorUpdateConsentHandler)})),(0,a.Mu)(this,"setDataFilter",(s=>{this.dataFilter=s})),(0,a.Mu)(this,"handleFilterDateRange",((s,t)=>{this.statusConsentsLogic=i.s.LOADING;const e={...this.globalStoreViewModel.dateFilter,date_start:g()(s).format("YYYY-MM-DD"),date_end:g()(t).endOf("day").format("YYYY-MM-DD")};this.dateFilter={...this.dateFilter,...e},this.initialize(this.dataFilter,e)})),(0,a.Mu)(this,"handleFilterTableConsentsLogicList",(async s=>{this.statusConsentsLogic=i.s.LOADING,this.dataFilterConsentsLogicList={...this.dataFilterConsentsLogicList,...s};const t={...this.globalStoreViewModel.dateFilter};await this.consentsStore.getConsentsLogic(this.dataFilterConsentsLogicList,t,this.callbackOnDataConsentsLogicListSuccessHandler,this.callbackOnErrorHandler)})),(0,a.Mu)(this,"callbackOnErrorHandler",(()=>{this.status=i.s.READY,this.statusConsentsLogic=i.s.READY,this.consentsLogic={}})),(0,a.Mu)(this,"callbackOnErrorUpdateConsentHandler",(()=>{this.status=i.s.READY,this.statusUpdateConsentsLogic=i.s.READY})),(0,a.Mu)(this,"callbackOnDataConsentsLogicListSuccessHandler",(s=>{s?(this.statusConsentsLogic=i.s.READY,this.consentsLogic=s):(this.statusConsentsLogic=i.s.ERROR,this.consentsLogic={})})),(0,a.Mu)(this,"callbackOnDataUpdateConsentLogicSuccessHandler",(s=>{s?(this.statusUpdateConsentsLogic=i.s.READY,this.consentsLogic=s,(0,d.me)("Update Successful")):(this.statusUpdateConsentsLogic=i.s.ERROR,this.consentsLogic={})})),(0,l.l_)(this),this.consentsStore=s,this.globalStoreViewModel=t}},C=class{constructor(s,t){(0,a.Mu)(this,"consentsList",null),(0,a.Mu)(this,"getConsentsLogicListViewModel",(()=>this.consentsList)),s&&(this.consentsList=new m(s,t))}},w=(0,r.lazy)((()=>e.e(17).then(e.bind(e,92017)))),D=({link:s,...t})=>r.createElement(w,{...t}),S=(0,L.PA)(class extends r.Component{constructor(s){super(s),(0,a.Mu)(this,"consentsStore",null),(0,a.Mu)(this,"behaviorViewModel",null);const{viewModel:t}=s;this.viewModel=t||null,this.biListViewModel=this.viewModel?this.viewModel.getBiListViewModel():null,this.consentsStore=new M({}),this.behaviorViewModel=new C(this.consentsStore,this.biListViewModellog)}render(){const{integration:s=!1}=this.props,{integrationLink:t,activeDomain:e}=this.biListViewModel;return r.createElement(n.O,{viewModel:this.behaviorViewModel},r.createElement(E,{integration:s,integrationLink:t,activeDomain:e,ref:s=>this.componentRef=s}))}}),E=(0,L.PA)(class extends r.Component{constructor(s){super(s)}render(){return r.createElement("div",{className:"aesirxui"},this.props.integration?r.createElement(D,{link:this.props.integrationLink,activeDomain:this.props.activeDomain,...this.props}):r.createElement(r.Fragment,null,r.createElement(c.qh,{exact:!0,path:["/consent-logic"]},r.createElement(w,null))))}}),b=(0,p.CI)()((0,c.y)((0,o.cm)(S)))},1465:(s,t,e)=>{e.d(t,{H:()=>a,O:()=>o});var n=e(96540),i=n.createContext(),o=({children:s,viewModel:t})=>n.createElement(i.Provider,{value:t},s),a=()=>n.useContext(i)}}]);