"use strict";(globalThis.webpackChunkPlesk=globalThis.webpackChunkPlesk||[]).push([["app/profile/announcement-settings"],{3217(e,n,t){t.r(n),t.d(n,{default:()=>c});var l=t(397),s=t(396),o=t(787),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},3216(e,n,t){t.r(n),t.d(n,{default:()=>c});var l=t(396),s=t(95),o=t(3217);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()};t.dn(c)}}]);
//# sourceMappingURL=announcement-settings.js.map?147fb2e5ad0e158b768d