"use strict";(globalThis.webpackChunkPlesk=globalThis.webpackChunkPlesk||[]).push([["app/profile/announcement-settings"],{3045(e,n,t){t.r(n),t.d(n,{default:()=>c});var l=t(296),s=t(90),o=t(3046);const a="send_personalized_announce",d="none",c=({id:e,email:n,infoClosed:t})=>{const c=s.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 s.api.get((0,s.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,l.render)((0,l.jsx)(o.default,{onClose:()=>s.api.post((0,s.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()}},3046(e,n,t){t.r(n),t.d(n,{default:()=>c});var l=t(297),s=t(296),o=t(669),a=t.n(o);const d=({children:e,onClose:n})=>{const[t,o]=(0,s.useState)(!0);return t?(0,s.jsx)(l.StatusMessage,{intent:"info",onClose:()=>{n(),o(!1)},children:e}):null};d.propTypes={children:a().node.isRequired,onClose:a().func.isRequired};const c=d}}]);
//# sourceMappingURL=announcement-settings.js.map?4a79db05b34e23b08465