"use strict";(globalThis.webpackChunkadmin=globalThis.webpackChunkadmin||[]).push([[4075],{4075(e,s,r){r.d(s,{GroupEmailSettings:()=>d});var a=r(7723),i=r(1455),t=r.n(i),o=r(6087),n=r(6427),l=r(7143),p=r(692),m=r(3084),c=r(790);const _={user:"",password:"",subject_prefix:"",whitelist:"",blocked:"",additional_recipients:""},d=()=>{const[e,s]=(0,o.useState)(null),[r,i]=(0,o.useState)(""),[d,v]=(0,o.useState)(!1),{createSuccessNotice:u,createErrorNotice:h,removeAllNotices:k}=(0,l.useDispatch)(p.store);(0,o.useEffect)(()=>{t()({path:"/rsvpmaker/v1/rsvp_options"}).then(e=>{const r=e.group_email||{};s({active:!!r.active,server:r.server||"{localhost:995/pop3/ssl/novalidate-cert}",queue_limit:r.queue_limit||10,postmark_handle_incoming:!!r.postmark_handle_incoming,is_toastmasters:!!r.is_toastmasters,member:{..._,...r.member||{}},officer:{..._,...r.officer||{}},extra:{..._,...r.extra||{}},bot:{..._,...r.bot||{}}}),i("")}).catch(e=>{i(e?.message||(0,a.__)("Could not load Group Email settings.","rsvpmaker"))})},[]);const g=(e,r,a)=>{s(s=>({...s,[e]:{...s[e],[r]:a}}))};if(!e)return r?(0,c.jsx)("p",{children:(0,a.__)("Could not load Group Email settings. Check your permissions and REST API response.","rsvpmaker")}):(0,c.jsx)("p",{children:(0,a.__)("Loading...","rsvpmaker")});const x=(s,r,i=!1)=>(0,c.jsxs)("section",{style:{borderTop:"1px solid #ddd",marginTop:"16px",paddingTop:"16px"},children:[(0,c.jsx)("p",{children:(0,a.__)("These are optional settings for managing a mailing list with RSVPMaker. Configure email handling for this list. Use the whitelist and blocked fields to control which incoming messages are processed. Use additional recipients to specify any email addresses that should receive copies of messages sent to this list.","rsvpmaker")}),(0,c.jsx)("h3",{children:r}),!i&&!e.postmark_handle_incoming&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.TextControl,{label:(0,a.__)("Email/User","rsvpmaker"),value:e[s].user,onChange:e=>g(s,"user",e)}),(0,c.jsx)(n.TextControl,{label:(0,a.__)("Password","rsvpmaker"),value:e[s].password,onChange:e=>g(s,"password",e)})]}),"bot"!==s&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.TextControl,{label:(0,a.__)("Subject Prefix","rsvpmaker"),value:e[s].subject_prefix,onChange:e=>g(s,"subject_prefix",e)}),(0,c.jsx)(n.TextareaControl,{label:(0,a.__)("Whitelist","rsvpmaker"),value:e[s].whitelist,onChange:e=>g(s,"whitelist",e)}),(0,c.jsx)(n.TextareaControl,{label:(0,a.__)("Blocked","rsvpmaker"),value:e[s].blocked,onChange:e=>g(s,"blocked",e)}),(0,c.jsx)(n.TextareaControl,{label:(0,a.__)("Additional Recipients","rsvpmaker"),value:e[s].additional_recipients,onChange:e=>g(s,"additional_recipients",e)})]})]});return(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{children:(0,a.__)("Configure member email relay and list routing options.","rsvpmaker")}),(0,c.jsx)(m.q,{}),(0,c.jsx)(n.ToggleControl,{label:(0,a.__)("Activate Group Email Relay","rsvpmaker"),checked:e.active,onChange:e=>s(s=>({...s,active:e}))}),!e.postmark_handle_incoming&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.TextControl,{label:(0,a.__)("POP3 Server","rsvpmaker"),value:e.server,onChange:e=>s(s=>({...s,server:e}))}),(0,c.jsx)(n.TextControl,{label:(0,a.__)("Queue Limit","rsvpmaker"),type:"number",value:String(e.queue_limit),onChange:e=>s(s=>({...s,queue_limit:e}))})]}),e.postmark_handle_incoming&&(0,c.jsx)("p",{children:(0,a.__)("Incoming messages are handled by Postmark integration.","rsvpmaker")}),x("member",(0,a.__)("Member List","rsvpmaker")),e.is_toastmasters&&x("officer",(0,a.__)("Officer List","rsvpmaker")),x("extra",(0,a.__)("Extra List","rsvpmaker")),!e.postmark_handle_incoming&&x("bot",(0,a.__)("Bot Account","rsvpmaker"),!0),(0,c.jsx)("div",{style:{marginTop:"16px"},children:(0,c.jsx)(n.Button,{variant:"primary",onClick:async()=>{if(!e)return;v(!0),k?.();const s=[{type:"option_raw",key:"rsvpmaker_discussion_active",value:e.active?1:0},{type:"option_raw",key:"rsvpmaker_discussion_server",value:e.server||""},{type:"option_raw",key:"rsvpmaker_email_queue_limit",value:parseInt(e.queue_limit,10)||10},{type:"option_raw",key:"rsvpmaker_discussion_member",value:e.member},{type:"option_raw",key:"rsvpmaker_discussion_officer",value:e.officer},{type:"option_raw",key:"rsvpmaker_discussion_extra",value:e.extra},{type:"option_raw",key:"rsvpmaker_discussion_bot",value:e.bot}];try{await t()({path:"/rsvpmaker/v1/rsvp_options",method:"POST",data:s}),u((0,a.__)("Group Email settings saved.","rsvpmaker"),{isDismissible:!0})}catch(e){h((0,a.__)("Error saving Group Email settings.","rsvpmaker"),{isDismissible:!0})}finally{v(!1)}},disabled:d,children:d?(0,a.__)("Saving...","rsvpmaker"):(0,a.__)("Save","rsvpmaker")})})]})}},3084(e,s,r){r.d(s,{q:()=>n});var a=r(7143),i=r(692),t=r(6427),o=r(790);const n=()=>{const{removeNotice:e}=(0,a.useDispatch)(i.store),s=(0,a.useSelect)(e=>e(i.store).getNotices());return 0===s.length?null:(0,o.jsx)(t.NoticeList,{notices:s,onRemove:e})}}}]);