"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["app/profile/announcement-settings"],{3038:(e,n,t)=>{t.r(n),t.d(n,{default:()=>c});var s=t(286),l=t(285),o=t(596),a=t.n(o);const d=({children:e,onClose:n})=>{const[t,o]=(0,l.useState)(!0);return t?(0,l.jsx)(s.StatusMessage,{intent:"info",onClose:()=>{n(),o(!1)},children:e}):null};d.propTypes={children:a().node.isRequired,onClose:a().func.isRequired};const c=d},3037:(e,n,t)=>{t.r(n),t.d(n,{default:()=>c});var s=t(285),l=t(89),o=t(3038);const a="send_personalized_announce",d="none",c=({id:e,email:n,infoClosed:t})=>{const c=l.Locale.getSection("admin.components.forms.admin.announcement-settings"),i=document.getElementById(`${e}-loader`),r=document.getElementById(`${e}`),y=document.getElementById(`${e}-info`),u=document.getElementById(`${e}-checkbox`),p=document.getElementById(`${e}-checkbox-block`),m=document.getElementById(`${e}-radio-block`),g=document.getElementById(`${e}-warning`),h=document.getElementById(`${e}-retry`),f=e=>e.some((e=>e.type===a)),k=async()=>{p.style.display="none",m.style.display="none",g.style.display="none",i.style.display="";try{const{consents:e,status:h}=await l.api.get((0,l.prepareUrl)("/my-profile/get-consent"),{email:n});if(i.style.display="none","error"!==h&&e){const n=e.filter((e=>e.enabled));(e=>{f(e)||e.length>0&&!t&&(0,s.render)((0,s.jsx)(o.default,{onClose:()=>l.api.post((0,l.prepareUrl)("/my-profile/close-consent-info")),children:c.lmsg("consentGivenInfo")}),y)})(n),(e=>{f(e)?(u.checked=!0,p.style.display="",r.value=a,u.addEventListener("change",(e=>{r.value=e.target.checked?a:d}))):e.length>0?(m.style.display="",r.value="send_announce",m.addEventListener("change",(e=>{r.value=e.target.value}))):(u.checked=!1,p.style.display="",r.value=d,u.addEventListener("change",(e=>{r.value=e.target.checked?a:d})))})(n)}else g.style.display=""}catch{i.style.display="none",g.style.display=""}};h.addEventListener("click",(e=>{e.preventDefault(),k()})),window.loadConsentStatus=k,k()}}}]);
//# sourceMappingURL=announcement-settings.js.map?cce0f28c934d4b9a14c3