(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3663],{87439:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/messaging/[id]",function(){return s(79545)}])},79545:function(e,t,s){"use strict";s.r(t);var n=s(24246),a=s(812),i=s(38355),l=s(86677),r=s(77213),u=s(77830),o=s(58754),d=s(46628),c=s(67810),p=s(47466),m=s(5058),g=s(20149),f=s(31883);t.default=()=>{let e=(0,i.pmc)(),t=(0,l.useRouter)(),s=t.query.id,{data:h,isLoading:_}=(0,p.gQ)(s),[b]=(0,m.pS)(),[x]=(0,p.ew)(),y=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,f.D4)(l)){e((0,d.Vo)((0,a.e$)(l.error)));return}e((0,d.t5)("Messaging template updated successfully"))},{isOpen:j,onOpen:w,onClose:v}=(0,i.qY0)(),C=async()=>{let n=await x(s);if((0,f.D4)(n)){e((0,d.Vo)((0,a.e$)(n.error)));return}e((0,d.t5)("Messaging template deleted successfully")),t.push(u.q)};return h?_?(0,n.jsx)(i.$jN,{}):(0,n.jsxs)(r.Z,{title:"Configure Message",children:[(0,n.jsx)(o.Z,{heading:"Messaging",breadcrumbItems:[{title:"Messaging",href:u.q},{title:"".concat(c.Z[h.type])}]}),(0,n.jsx)(i.xuv,{"data-testid":"add-messaging-template",maxWidth:"720px",children:(0,n.jsx)(g.Z,{template:h,handleSubmit:y,handleDelete:w})}),(0,n.jsx)(i.cVQ,{isOpen:j,onClose:v,onConfirm:C,title:"Delete message template",message:(0,n.jsx)(i.xvT,{children:"You are about to permanently delete this template message. Are you sure you would like to continue?"})})]}):null}}},function(e){e.O(0,[7630,2888,9774,179],function(){return e(e.s=87439)}),_N_E=e.O()}]);