"use strict";(globalThis.webpackChunkPlesk=globalThis.webpackChunkPlesk||[]).push([["app/profile/announcement-settings"],{3194(e,n,t){t.r(n),t.d(n,{default:()=>c});var l=t(373),s=t(372),a=t(762),o=t.n(a);const d=({children:e,onClose:n})=>{const[t,a]=(0,s.useState)(!0);return t?(0,s.jsx)(l.StatusMessage,{intent:"info",onClose:()=>{n(),a(!1)},children:e}):null};d.propTypes={children:o().node.isRequired,onClose:o().func.isRequired};const c=d},3193(e,n,t){t.r(n),t.d(n,{default:()=>c});var l=t(372),s=t(95),a=t(3194);const o="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}`),u=document.getElementById(`${e}-info`),y=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===o),v=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)(a.default,{onClose:()=>s.api.post((0,s.prepareUrl)("/my-profile/close-consent-info")),children:c.lmsg("consentGivenInfo")}),u)})(n),(e=>{f(e)?(y.checked=!0,p.style.display="",r.value=o,y.addEventListener("change",e=>{r.value=e.target.checked?o:d})):e.length>0?(m.style.display="",r.value="send_announce",m.addEventListener("change",e=>{r.value=e.target.value})):(y.checked=!1,p.style.display="",r.value=d,y.addEventListener("change",e=>{r.value=e.target.checked?o:d}))})(n)}else g.style.display=""}catch{i.style.display="none",g.style.display=""}};h.addEventListener("click",e=>{e.preventDefault(),v()}),window.loadConsentStatus=v,v()};(Object.getOwnPropertyDescriptor(c,"name")||{}).writable||Object.defineProperty(c,"name",{value:"default",configurable:!0})}}]);
//# sourceMappingURL=announcement-settings.js.map?6c642d191115482899da