(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(46582)}])},46582:function(e,t,s){"use strict";s.r(t);var n=s(24246),i=s(60136),l=s(69746),r=s(86677),a=s(43124),o=s(11032),u=s(16781),d=s(44444),c=s(12623),p=s(97193),m=s(43073);t.default=()=>{let e=(0,l.pmc)(),t=(0,r.useRouter)(),s=t.query.id,{data:g,isLoading:f}=(0,d.gQ)(s),[h]=(0,c.pS)(),[x]=(0,d.ew)(),_=async t=>{var n;let l={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=l.properties)||void 0===t?void 0:t.push(e.id)});let r=await h({templateId:s,template:l});if((0,m.D4)(r)){e((0,u.Vo)((0,i.e$)(r.error)));return}e((0,u.t5)("Messaging template updated successfully"))},{isOpen:j,onOpen:v,onClose:b}=(0,l.qY0)(),w=async()=>{let n=await x(s);if((0,m.D4)(n)){e((0,u.Vo)((0,i.e$)(n.error)));return}e((0,u.t5)("Messaging template deleted successfully")),t.push(o.q)};return g?f?(0,n.jsx)(l.$jN,{}):(0,n.jsxs)(a.Z,{title:"Configure Message",children:[(0,n.jsxs)(l.xuv,{"data-testid":"add-messaging-template",children:[(0,n.jsx)(l.X6q,{marginBottom:2,fontSize:"2xl",children:"Configure message"}),(0,n.jsxs)(l.xuv,{maxWidth:"720px",children:[(0,n.jsx)(l.xvT,{fontSize:"sm",children:"Configure this message"}),(0,n.jsx)(l.xuv,{padding:2,children:(0,n.jsx)(p.Z,{template:g,handleSubmit:_,handleDelete:v})})]})]}),(0,n.jsx)(l.cVQ,{isOpen:j,onClose:b,onConfirm:w,title:"Delete message template",message:(0,n.jsx)(l.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,[3528,9414,2888,9774,179],function(){return e(e.s=87439)}),_N_E=e.O()}]);