/*! For license information please see 382e1fce0e35896fe521.js.LICENSE.txt */
"use strict";(self.webpackChunkaesirx_cmp=self.webpackChunkaesirx_cmp||[]).push([[220],{54220:(e,t,s)=>{s.r(t),s.d(t,{default:()=>b});var n=s(37321),a=s(95394),i=s(33353),o=s(43029),r=s(96540),l=s(56347),d=s(99258),h=s(2376),c=s(95184),g=s(95093),u=s.n(g),p=s(56795),m=s(32389),M=class{constructor(){(0,o.Mu)(this,"getGeoHandling",(async(e,t,s)=>{try{const n=new h.AesirxCmpApiService,a=await n.getConsentsTemplate(e);a?(0,d.h5)((()=>{t(a)})):s({message:"Something went wrong from Server response"})}catch(e){(0,d.h5)((()=>{e.response?.data.error?s({message:e.response?.data?.error}):s({message:e?.response?.data?.error?e.response?.data?._messages[0]?.message:"Something went wrong from Server response"})}))}})),(0,o.Mu)(this,"updateGeoHandling",(async(e,t,s)=>{try{const n=new h.AesirxCmpApiService,a=await n.updateConsentsTemplate(e);a?(0,d.h5)((()=>{t(a)})):s({message:"Something went wrong from Server response"})}catch(e){(0,d.h5)((()=>{e.response?.data.error?s({message:e.response?.data?.error}):s({message:e?.response?.data?.error?e.response?.data?._messages[0]?.message:"Something went wrong from Server response"})}))}}))}},H=class{constructor(e,t){(0,o.Mu)(this,"consentsStore",null),(0,o.Mu)(this,"status",a.s.READY),(0,o.Mu)(this,"globalStoreViewModel",null),(0,o.Mu)(this,"data",null),(0,o.Mu)(this,"dataFilter",{}),(0,o.Mu)(this,"statusGeoHandling",a.s.READY),(0,o.Mu)(this,"statusUpdateGeoHandling",a.s.READY),(0,o.Mu)(this,"geoHandling",null),(0,o.Mu)(this,"sortBy",{"sort[]":"","sort_direction[]":""}),(0,o.Mu)(this,"initialize",(async e=>{this.getGeoHandling(e)})),(0,o.Mu)(this,"getGeoHandling",(e=>{this.statusGeoHandling=a.s.LOADING,this.consentsStore.getGeoHandling(e,this.callbackOnDataGeoHandlingListSuccessHandler,this.callbackOnErrorHandler)})),(0,o.Mu)(this,"updateGeoHandling",(e=>{this.statusUpdateGeoHandling=a.s.LOADING,this.consentsStore.updateGeoHandling(e,this.callbackOnDataUpdateGeoHandlingSuccessHandler,this.callbackOnErrorUpdateConsentHandler)})),(0,o.Mu)(this,"setDataFilter",(e=>{this.dataFilter=e})),(0,o.Mu)(this,"handleFilterDateRange",((e,t)=>{this.statusGeoHandling=a.s.LOADING;const s={...this.globalStoreViewModel.dateFilter,date_start:u()(e).format("YYYY-MM-DD"),date_end:u()(t).endOf("day").format("YYYY-MM-DD")};this.dateFilter={...this.dateFilter,...s},this.initialize(this.dataFilter,s)})),(0,o.Mu)(this,"handleFilterTableGeoHandlingList",(async e=>{this.statusGeoHandling=a.s.LOADING,this.dataFilterGeoHandlingList={...this.dataFilterGeoHandlingList,...e};const t={...this.globalStoreViewModel.dateFilter};await this.consentsStore.getGeoHandling(this.dataFilterGeoHandlingList,t,this.callbackOnDataGeoHandlingListSuccessHandler,this.callbackOnErrorHandler)})),(0,o.Mu)(this,"callbackOnErrorHandler",(()=>{this.status=a.s.READY,this.statusGeoHandling=a.s.READY,this.geoHandling={}})),(0,o.Mu)(this,"callbackOnErrorUpdateConsentHandler",(()=>{this.status=a.s.READY,this.statusUpdateGeoHandling=a.s.READY})),(0,o.Mu)(this,"callbackOnDataGeoHandlingListSuccessHandler",(e=>{e?(this.statusGeoHandling=a.s.READY,this.geoHandling=e):(this.statusGeoHandling=a.s.ERROR,this.geoHandling={})})),(0,o.Mu)(this,"callbackOnDataUpdateGeoHandlingSuccessHandler",(e=>{e?(this.statusUpdateGeoHandling=a.s.READY,this.geoHandling=e,(0,c.me)("Update Successful")):(this.statusUpdateGeoHandling=a.s.ERROR,this.geoHandling={})})),(0,d.l_)(this),this.consentsStore=e,this.globalStoreViewModel=t}},w=class{constructor(e,t){(0,o.Mu)(this,"consentsList",null),(0,o.Mu)(this,"getGeoHandlingListViewModel",(()=>this.consentsList)),e&&(this.consentsList=new H(e,t))}},G=(0,r.lazy)((()=>Promise.all([s.e(966),s.e(365)]).then(s.bind(s,89365)))),D=({link:e,...t})=>r.createElement(G,{...t}),S=(0,p.PA)(class extends r.Component{constructor(e){super(e),(0,o.Mu)(this,"consentsStore",null),(0,o.Mu)(this,"behaviorViewModel",null);const{viewModel:t}=e;this.viewModel=t||null,this.biListViewModel=this.viewModel?this.viewModel.getBiListViewModel():null,this.consentsStore=new M({}),this.behaviorViewModel=new w(this.consentsStore,this.biListViewModellog)}render(){const{integration:e=!1}=this.props,{integrationLink:t,activeDomain:s}=this.biListViewModel;return r.createElement(n.z,{viewModel:this.behaviorViewModel},r.createElement(E,{integration:e,integrationLink:t,activeDomain:s,ref:e=>this.componentRef=e}))}}),E=(0,p.PA)(class extends r.Component{constructor(e){super(e)}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(l.qh,{exact:!0,path:["/geo-handling"]},r.createElement(G,null))))}}),b=(0,m.CI)()((0,l.y)((0,i.cm)(S)))},37321:(e,t,s)=>{s.d(t,{U:()=>o,z:()=>i});var n=s(96540),a=n.createContext(),i=({children:e,viewModel:t})=>n.createElement(a.Provider,{value:t},e),o=()=>n.useContext(a)}}]);