(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8927],{84445:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/notifications/templates/[id]",function(){return s(77053)}])},59849:function(e,t,s){"use strict";s.d(t,{Z:function(){return u}});var r=s(24246),a=s(36010),n=s(86677),i=s(88340);let l="/images/errors";var o=e=>{let{status:t}=e;return 404===t?(0,r.jsx)(a.Eep,{src:"".concat(l,"/404.svg"),alt:"Error 404",preview:!1}):500===t?(0,r.jsx)(a.Eep,{src:"".concat(l,"/500.svg"),alt:"Error 500",preview:!1}):(0,r.jsx)(a.Eep,{src:"".concat(l,"/unknown.svg"),alt:"Error Unknown",preview:!1})},c=s(812),u=e=>{let{error:t,defaultMessage:s="An unexpected error occurred.  Please try again",actions:l,showReload:u=!0}=e,d=(0,c.e$)(t,s),p="data"in t&&t.data?JSON.stringify(t.data):JSON.stringify(t),h="status"in t&&t.status?t.status:void 0,m=(0,n.useRouter)(),g=l&&l.length>0||u;return(0,r.jsx)(a.kCb,{vertical:!0,align:"center",justify:"center",className:"h-screen","data-testid":"error-page-result",children:(0,r.jsx)(a.x4B,{status:"error",icon:(0,r.jsx)(o,{status:h}),title:"Error ".concat(h),subTitle:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.Typography.Paragraph,{type:"secondary",children:d}),(0,r.jsx)(a.kCb,{justify:"start",className:"max-w-96",children:(0,r.jsx)(a.UO1,{ghost:!0,size:"small",items:[{key:"1",label:"Show details",classNames:{header:"w-fit"},children:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.Typography.Text,{type:"secondary",children:p}),(0,r.jsx)(i.Z,{copyText:p})]})}]})})]}),extra:g&&(0,r.jsxs)(a.kCb,{gap:"small",justify:"center",children:[null==l?void 0:l.map((e,t)=>(0,r.jsx)(a.zxk,{...e,children:e.label},t)),u&&(0,r.jsx)(a.zxk,{onClick:()=>m.reload(),type:"primary",children:"Reload"})]})})})}},77053:function(e,t,s){"use strict";s.r(t);var r=s(24246),a=s(812),n=s(36010),i=s(86677),l=s(59849),o=s(77213),c=s(77830),u=s(58754),d=s(46628),p=s(67810),h=s(47466),m=s(5058),g=s(20149),x=s(31883);t.default=()=>{let e=(0,n.p8r)(),t=(0,i.useRouter)(),s=t.query.id,{data:j,isLoading:y,error:f}=(0,h.gQ)(s),[b]=(0,m.pS)(),[w]=(0,h.ew)(),v=async t=>{var r;let n={is_enabled:t.is_enabled,content:{subject:t.content.subject,body:t.content.body},properties:[]};null===(r=t.properties)||void 0===r||r.forEach(e=>{var t;return null===(t=n.properties)||void 0===t?void 0:t.push(e.id)});let i=await b({templateId:s,template:n});if((0,x.D4)(i)){e((0,d.Vo)((0,a.e$)(i.error)));return}e((0,d.t5)("Messaging template updated successfully"))},{isOpen:k,onOpen:E,onClose:_}=(0,n.E2M)(),C=async()=>{let r=await w(s);if((0,x.D4)(r)){e((0,d.Vo)((0,a.e$)(r.error)));return}e((0,d.t5)("Messaging template deleted successfully")),t.push(c.Wi)};return j?y?(0,r.jsx)(n.Y6B,{}):f?(0,r.jsx)(l.Z,{error:f,defaultMessage:"A problem occurred while fetching the messaging template ".concat(s),actions:[{label:"Return to messaging templates",onClick:()=>t.push(c.Wi)}]}):(0,r.jsxs)(o.Z,{title:"Configure Message",children:[(0,r.jsx)(u.Z,{heading:"Templates",breadcrumbItems:[{title:"Templates",href:c.Wi},{title:"".concat(p.Z[j.type])}]}),(0,r.jsx)(n.TJV,{"data-testid":"add-messaging-template",maxWidth:"720px",children:(0,r.jsx)(g.Z,{template:j,handleSubmit:v,handleDelete:E})}),(0,r.jsx)(n.cVQ,{isOpen:k,onClose:_,onConfirm:C,title:"Delete message template",message:(0,r.jsx)(n.Bjg,{children:"You are about to permanently delete this template message. Are you sure you would like to continue?"})})]}):null}}},function(e){e.O(0,[9177,7630,2888,9774,179],function(){return e(e.s=84445)}),_N_E=e.O()}]);