1import{cL as w,cK as g,s as F,T as i,b as $,M as G,O as k,r as p,fE as V,o as X,q as Z,j as e,b2 as H,n as N,G as t,F as J,H as q,e0 as K,cI as U,x as Q,a3 as L,cB as z,cC as h,cJ as m}from"./index-6arvOuHO.js";import{S as Y}from"./styles-zrWJ4Inh.js";import{R as D}from"./RadioGroup-DzqKclvb.js";import{R as x}from"./Radio-BJ3v5vfb.js";const ee=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,te=w().shape({receiver_mail:g().matches(ee,"Please enter a valid email address").required("Email address is required"),chatTranscript:g().oneOf(["true","false"],"Invalid selection").required("Chat transcript preference is required"),supportTranscript:g().oneOf(["true","false"],"Invalid selection").required("Support transcript preference is required")}),y=F(i)(({theme:{spacing:n,palette:a}})=>({color:a.colors.neutral[500]})),re=F(i)(({theme:{spacing:n,palette:a}})=>({color:a.colors.neutral[500],fontWeight:500})),oe=()=>{const n=$(),{chatbotId:a}=G(),B=k(),[l,_]=p.useState(null),[s,f]=p.useState(!1),[C,T]=p.useState(null),{data:b,isLoading:I,isError:P}=V(a),{register:A,handleSubmit:E,control:S,reset:j,formState:{errors:M}}=X({resolver:Z(te),defaultValues:{receiver_mail:"",chatTranscript:"false",supportTranscript:"false"}});p.useEffect(()=>{if(b){const{id:r,receiver_mail:d="",receive_chat_transcript:o,receive_customer_support_required_chat_transcript:v}=b?.data||{};T(r);const u={receiver_mail:d,chatTranscript:o?"true":"false",supportTranscript:v?"true":"false"};_(u),j(u)}},[b,j]);const R=async r=>{const d={receive_chat_transcript:r?.chatTranscript==="true",receive_customer_support_required_chat_transcript:r?.supportTranscript==="true",receiver_mail:r?.receiver_mail},o=!!C,v=o?`settings/bot-chat-transcript/update/${C}/?bot_id=${a}`:`settings/bot-chat-transcript/create/?bot_id=${a}`,u=o?"PATCH":"POST";try{const c=await B(v,u,d);n(c),c?.success&&(_(d),!o&&c?.data?.id&&T(c.data.id))}catch{n()}finally{f(!1)}},O=()=>{f(r=>!r)},W=()=>{j(l),f(!1)};return I?e.jsx(H,{height:"65vh",children:e.jsx(N,{})}):P?(n(),null):e.jsxs(e.Fragment,{children:[e.jsxs(t,{container:!0,justifyContent:"space-between",width:"100%",children:[e.jsxs(t,{children:[e.jsx(i,{variant:"h5-semibold",sx:{paddingBottom:"2px"},children:"Manage notification"}),e.jsx(i,{variant:"body-sm",children:"Get emails to find out what's going on when you're not online."})]}),e.jsx(t,{children:e.jsxs(J,{children:[s&&e.jsx(q,{sm:!0,variant:"outlined",onClick:W,children:"Discard"}),e.jsx(q,{icon:s?K:U,sm:!0,onClick:s?E(R):O,children:s?"Save":"Edit"})]})})]}),e.jsx(Y,{mt:2,children:e.jsxs("form",{onSubmit:E(R),children:[e.jsxs(t,{container:!0,spacing:2,children:[e.jsxs(t,{size:{xs:12,md:6},children:[e.jsx(i,{variant:"body-medium",children:"Receiver mail"}),e.jsx(y,{variant:"body-sm",sx:{marginBottom:2},children:"Get the transcript of the conversation with the ELX chatbot"})]}),e.jsx(t,{size:{xs:12,md:6},children:s?e.jsx(Q,{fullWidth:!0,type:"text",label:"Email address",id:"receiver_mail",name:"receiver_mail",register:A,errors:M,disabled:!s}):e.jsx(re,{variant:"body-md",children:l?.receiver_mail||"Add email address"})})]}),e.jsx(L,{sx:{margin:"20px 0"}}),e.jsxs(t,{container:!0,spacing:2,children:[e.jsxs(t,{size:{xs:12,md:6},children:[e.jsx(i,{variant:"body-medium",children:"Chat transcript"}),e.jsx(y,{variant:"body-sm",sx:{marginBottom:2},children:"Receive the chat transcript of the conversation in ELX chatbot"})]}),e.jsx(t,{size:{xs:12,md:6},children:e.jsx(z,{name:"chatTranscript",control:S,defaultValue:l?.chatTranscript?"true":"false",render:({field:r})=>e.jsxs(D,{...r,column:"true",children:[e.jsx(h,{value:"true",control:e.jsx(x,{disabled:!s}),label:"Receive transcript",sx:{"& .MuiFormControlLabel-label":{fontWeight:m.semibold}}}),e.jsx(h,{value:"false",control:e.jsx(x,{disabled:!s}),label:"Do not receive transcript",sx:{"& .MuiFormControlLabel-label":{fontWeight:m.semibold}}})]})})})]}),e.jsx(L,{sx:{margin:"20px 0"}}),e.jsxs(t,{container:!0,spacing:2,children:[e.jsxs(t,{size:{xs:12,md:6},children:[e.jsx(i,{variant:"body-medium",children:"Customer support required chat transcript"}),e.jsx(y,{variant:"body-sm",sx:{marginBottom:2},children:"Receive Customer support required chat transcript"})]}),e.jsx(t,{size:{xs:12,md:6},children:e.jsx(z,{name:"supportTranscript",control:S,defaultValue:l?.supp
1ortTranscript?"true":"false",render:({field:r})=>e.jsxs(D,{...r,column:"true",children:[e.jsx(h,{value:"true",control:e.jsx(x,{disabled:!s}),label:"Receive transcript",sx:{"& .MuiFormControlLabel-label":{fontWeight:m.semibold}}}),e.jsx(h,{value:"false",control:e.jsx(x,{disabled:!s}),label:"Do not receive transcript",sx:{"& .MuiFormControlLabel-label":{fontWeight:m.semibold}}})]})})})]})]})})]})};export{oe as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.