"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["app/profile/announcement-settings"],{1982:(e,n,t)=>{t.r(n),t.d(n,{default:()=>c});var s=t(240),l=t(239),o=t(241),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},1981:(e,n,t)=>{t.r(n),t.d(n,{default:()=>i});var s=t(240),l=t(239),o=t(90),a=t(1982);const d="send_personalized_announce",c="none",i=({id:e,email:n,infoClosed:t,dialogShown:i})=>{const r=o.Locale.getSection("admin.components.forms.admin.announcement-settings"),u=document.getElementById(`${e}-loader`),y=document.getElementById(`${e}`),p=document.getElementById(`${e}-info`),m=document.getElementById(`${e}-checkbox`),g=document.getElementById(`${e}-checkbox-block`),h=document.getElementById(`${e}-radio-block`),f=document.getElementById(`${e}-warning`),v=document.getElementById(`${e}-retry`),k=e=>e.some((e=>e.type===d)),E=async()=>{g.style.display="none",h.style.display="none",f.style.display="none",u.style.display="";try{const{consents:e,status:v}=await o.api.get((0,o.prepareUrl)("/my-profile/get-consent"),{email:n});if(u.style.display="none","error"!==v&&e){const n=e.filter((e=>e.enabled));(e=>{k(e)||(e.length>0?!t&&(0,l.render)((0,l.jsx)(a.default,{onClose:()=>o.api.post((0,o.prepareUrl)("/my-profile/close-consent-info")),children:r.lmsg("consentGivenInfo")}),p):i&&(0,l.render)((0,l.jsx)(s.StatusMessage,{intent:"info",children:r.lmsg("consentNotGivenInfo")}),p))})(n),(e=>{k(e)?(m.checked=!0,g.style.display="",y.value=d,m.addEventListener("change",(e=>{y.value=e.target.checked?d:c}))):e.length>0?(h.style.display="",y.value="send_announce",h.addEventListener("change",(e=>{y.value=e.target.value}))):(m.checked=!1,g.style.display="",y.value=c,m.addEventListener("change",(e=>{y.value=e.target.checked?d:c})))})(n)}else f.style.display=""}catch{u.style.display="none",f.style.display=""}};v.addEventListener("click",(e=>{e.preventDefault(),E()})),window.loadConsentStatus=E,E()}}}]);
//# sourceMappingURL=announcement-settings.js.map?f89caf5898e0499b106b