(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)}])},77053:function(e,t,s){"use strict";s.r(t);var n=s(24246),a=s(812),i=s(41725),l=s(86677),r=s(77213),o=s(77830),u=s(58754),d=s(46628),p=s(67810),c=s(47466),m=s(5058),f=s(20149),h=s(31883);t.default=()=>{let e=(0,i.p8r)(),t=(0,l.useRouter)(),s=t.query.id,{data:g,isLoading:_}=(0,c.gQ)(s),[b]=(0,m.pS)(),[y]=(0,c.ew)(),j=async t=>{var n;let i={is_enabled:t.is_enabled,content:{subject:t.content.subject,body:t.content.body},properties:[]};null===(n=t.properties)||void 0===n||n.forEach(e=>{var t;return null===(t=i.properties)||void 0===t?void 0:t.push(e.id)});let l=await b({templateId:s,template:i});if((0,h.D4)(l)){e((0,d.Vo)((0,a.e$)(l.error)));return}e((0,d.t5)("Messaging template updated successfully"))},{isOpen:w,onOpen:x,onClose:E}=(0,i.E2M)(),v=async()=>{let n=await y(s);if((0,h.D4)(n)){e((0,d.Vo)((0,a.e$)(n.error)));return}e((0,d.t5)("Messaging template deleted successfully")),t.push(o.Wi)};return g?_?(0,n.jsx)(i.Y6B,{}):(0,n.jsxs)(r.Z,{title:"Configure Message",children:[(0,n.jsx)(u.Z,{heading:"Templates",breadcrumbItems:[{title:"Templates",href:o.Wi},{title:"".concat(p.Z[g.type])}]}),(0,n.jsx)(i.TJV,{"data-testid":"add-messaging-template",maxWidth:"720px",children:(0,n.jsx)(f.Z,{template:g,handleSubmit:j,handleDelete:x})}),(0,n.jsx)(i.cVQ,{isOpen:w,onClose:E,onConfirm:v,title:"Delete message template",message:(0,n.jsx)(i.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()}]);