PageSourceSearch

https://circle21.events/_next/static/chunks/pages/adminDashboard/allNewsletterTemplates-c99dace8e0693d57.js

js circle21.events collected 2026-09-24 12:16:31 UTC 14,290 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2332],{94158:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/adminDashboard/allNewsletterTemplates",function(){return a(23323)}])},35168:function(e,t,a){"use strict";a.d(t,{O:function(){return useEditTemplate}});var l=a(1775),n=a(50951),i=a(88164);function useEditTemplate(){return(0,i.D)(async e=>{let{id:t,payload:a}=e,{data:l}=await n.x1.put("/api/email-templates/".concat(t),a);return l},{async onSuccess(){await l.Eh.invalidateQueries({queryKey:["email-templates"]}),await l.Eh.invalidateQueries({queryKey:["email-template"]})}})}},23323:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return AllNewsletterTemplates}});var l=a(11527),n=a(50959),i=a(1709),r=a.n(i),s=a(62585),o=a(41224),c=a(50455),d=a(85409),p=a(86507),m=a(58934),u=a(7756),x=a(59342),h=a(29376),g=a(74995),f=a(54554),y=a(58607),v=a(96600),j=a(69730),Z=a(60768),w=a(6923),_=a(12223),b=a(82187),C=a.n(b),T=a(55419),S=a(58201),k=a(65610),A=a(27360),L=a(48691),E=a(1775),N=a(50951),M=a(88164),D=a(35168),P=a(62779),H=a.n(P),I=a(6896);function BlockPreview(e){let{block:t}=e;switch(t.type){case"text":{let e="body"===t.variant?"p":t.variant;return n.createElement(e,{style:{fontSize:t.fontSize,fontWeight:t.fontWeight,textAlign:t.alignment,margin:"0 0 6px",padding:0,color:"#1a1a1a",lineHeight:1.5,whiteSpace:"pre-wrap"}},t.value||" ")}case"rich-text":return(0,l.jsx)("div",{style:{margin:"0 0 6px",color:"#1a1a1a",lineHeight:1.5,fontSize:16},dangerouslySetInnerHTML:{__html:t.content||""}});case"separator":return(0,l.jsx)("div",{style:{margin:"6px 0",borderTop:"".concat(t.thickness,"px ").concat(t.style," ").concat(t.color),fontSize:0,lineHeight:0}});case"button":return(0,l.jsx)("div",{style:{textAlign:t.alignment,margin:"6px 0"},children:(0,l.jsx)("span",{style:{display:"inline-block",padding:"10px 20px",backgroundColor:t.backgroundColor,color:t.textColor,borderRadius:20,fontWeight:"bold",fontSize:14},children:t.label||"Button"})});case"image":if(!t.src)break;return(0,l.jsx)("div",{style:{textAlign:t.alignment,margin:"6px 0"},children:(0,l.jsx)("img",{src:t.src,alt:"",style:{maxWidth:"".concat(t.width,"%"),height:"auto",display:"inline-block"}})});case"grid":return(0,l.jsx)("div",{style:{margin:"6px 0",display:"grid",gridTemplateColumns:"repeat(".concat(t.columns,", 1fr)"),gap:4},children:t.cells.map(e=>(0,l.jsx)("div",{style:{border:t.showBorders?"".concat(t.borderWidth,"px ").concat(t.borderStyle," ").concat(t.borderColor):void 0,padding:4,minHeight:24,backgroundColor:e.backgroundColor||void 0},children:e.child&&(0,l.jsx)(BlockPreview,{block:e.child})},e.id))});case"footer":return(0,l.jsxs)("div",{style:{padding:"8px 12px",background:"#1a1a1a",borderRadius:6,fontSize:10,color:"#9ca3af"},children:[(0,l.jsx)("span",{style:{color:"#f5f5f5",fontWeight:600},children:"Circle 21"})," \xb7 ",(0,l.jsx)("a",{href:t.privacyUrl,style:{color:"#9ca3af"},children:"Privacy"})," \xb7 ",(0,l.jsx)("a",{href:t.termsUrl,style:{color:"#9ca3af"},children:"Terms"})]});case"container":return(0,l.jsx)("div",{style:{display:"flex",flexDirection:t.flexDirection,justifyContent:t.justifyContent,alignItems:t.alignItems,flexWrap:t.flexWrap,gap:t.gap,padding:"".concat(t.padding.top,"px ").concat(t.padding.right,"px ").concat(t.padding.bottom,"px ").concat(t.padding.left,"px"),marginTop:t.marginTop,marginBottom:t.marginBottom,backgroundColor:t.backgroundColor||void 0,borderRadius:t.borderRadius,width:"custom"===t.widthType?"".concat(t.widthValue).concat(t.widthUnit):"100%"},children:t.children.map(e=>(0,l.jsx)(BlockPreview,{block:e},e.id))})}return null}function TemplateCard(e){var t;let{template:a}=e,i=(0,v.useRouter)(),{mutateAsync:r,isLoading:o}=(0,M.D)(async e=>{let{data:t}=await N.x1.delete("/api/email-templates/".concat(e));return t},{async onSuccess(){await E.Eh.invalidateQueries({queryKey:["email-templates"]})}}),{mutateAsync:d}
1=(0,D.O)(),[p,m]=(0,n.useState)(!1),[u,x]=(0,n.useState)(!1),[h,f]=(0,n.useState)(!1),b=a.is_active,L=null!==(t=a.design_json)&&void 0!==t?t:[],P=Array.isArray(L)?L:L.blocks,handleToggleActive=async e=>{e.stopPropagation();try{await d({id:a.id,payload:{is_active:!b}}),I.Am.success("Template updated successfully")}catch(e){console.error("Error updating template:",e),I.Am.error("Failed to update template")}},openTemplateInBrowser=e=>{let t=window.open("","_blank");t&&e&&(t.document.open(),t.document.write(e),t.document.close())},handleDelete=async e=>{try{await r(e),I.Am.success("Template deleted successfully")}catch(e){console.error("Error deleting template:",e),I.Am.error("Failed to delete template"),m(!1)}};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:C()(H().card,{[H().inactive]:!b}),children:[(0,l.jsxs)("div",{className:H().header,children:[(0,l.jsxs)("div",{className:H().headerTop,children:[(0,l.jsx)(c.Z,{className:H().name,children:a.name}),(0,l.jsx)("div",{className:H().headerActions,children:(0,l.jsx)("div",{className:H().dotsButton,children:(0,l.jsx)(T.Z,{variant:"contained",disabled:!b,dropDownOptions:{placement:"bottom-end",theme:"light"},dropdown:e=>[{label:"Edit",icon:(0,l.jsx)(Z.z,{}),onClick:t=>{t.stopPropagation(),e(!1),i.push("/adminDashboard/allNewsletterTemplates/builder?id=".concat(a.id))}},{label:"Open in browser",icon:(0,l.jsx)(w.o,{}),onClick:t=>{t.stopPropagation(),e(!1),openTemplateInBrowser(a.html)}},{label:"Send Test Email",icon:(0,l.jsx)(j.kcA,{}),onClick:t=>{t.stopPropagation(),f(!0),e(!1)}},{label:"Delete",style:{color:"red"},color:"red",icon:(0,l.jsx)(_.r,{color:"red"}),onClick:t=>{t.stopPropagation(),e(!1),m(!0)}}],onClick:e=>{e.stopPropagation(),e.preventDefault()},children:(0,l.jsx)(j.nWS,{style:{color:"var(--color-neutral700)"}})})})})]}),(0,l.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,l.jsx)(c.Z,{className:H().date,children:new Date(a.created_at).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}),(0,l.jsx)(S.Z,{label:b?"Active":"Inactive",size:"xs",color:b?"#22c55e":"#9ca3af"})]})]}),(0,l.jsx)("div",{className:H().preview,onClick:e=>{e.stopPropagation(),x(!0)},children:0===P.length?(0,l.jsx)("div",{className:H().empty,children:"No blocks"}):(0,l.jsx)("div",{className:H().previewScaler,children:P.map(e=>(0,l.jsx)(BlockPreview,{block:e},e.id))})}),(0,l.jsxs)("div",{className:H().footer,children:[(0,l.jsx)(c.Z,{className:H().footerLabel,children:"Template Visibility"}),(0,l.jsx)(k.Z,{checked:b,onClick:handleToggleActive})]})]}),(0,l.jsx)(A.Z,{isOpen:u,title:a.name,onClose:()=>x(!1),style:{maxWidth:"660px",width:"calc(100vw - 48px)",padding:"24px"},contentClassName:H().previewModalContent,children:(0,l.jsx)("iframe",{srcDoc:a.html,className:H().previewIframe,title:"Preview: ".concat(a.name)})}),(0,l.jsx)(A.Z,{isOpen:p,title:"Are you sure you want to delete this template?",onClose:()=>m(!1),showCloseIcon:!1,children:(0,l.jsxs)(y.ZP,{container:!0,gap:1,marginTop:5,children:[(0,l.jsx)(y.ZP,{flex:"1 1 0",children:(0,l.jsx)(g.Z,{fullWidth:!0,theme:"light",variant:"outlined",onClick:()=>m(!1),children:"No"})}),(0,l.jsx)(y.ZP,{flex:"1 1 0",children:(0,l.jsx)(g.Z,{fullWidth:!0,theme:"light",onClick:()=>{handleDelete(a.id)},loading:o,children:"Yes"})})]})}),(0,l.jsx)(A.Z,{isOpen:h,title:"Send Test Email",onClose:()=>f(!1),showCloseIcon:!1,style:{maxWidth:"480px",width:"calc(100vw - 48px)"},children:(0,l.jsx)(SendTestEmailForm,{templateId:a.id,onClose:()=>f(!1)})})]})}function SendTestEmailForm(e){let{templateId:t,onClose:a}=e,{mutateAsync:i,isLoading:r}=(0,M.D)(async e=>{let{templateId:t,payload:a}=e,{data:l}=await N.x1.post("/api/email-templates/".concat(t,"/test"),a);return l}
1),[o,d]=(0,n.useState)(""),[p,m]=(0,n.useState)(""),[u,x]=(0,n.useState)(""),[h,f]=(0,n.useState)(!1),handleSubmit=async()=>{if(f(!0),o.trim()&&p.trim())try{await i({templateId:t,payload:{email:o,subject:p,preheader:u}}),I.Am.success("Test email sent successfully"),a()}catch(e){I.Am.error("Failed to send test email")}};return(0,l.jsxs)(s.Z,{display:"flex",flexDirection:"column",gap:3,px:1,pt:2,pb:1,children:[(0,l.jsxs)(s.Z,{display:"flex",flexDirection:"column",gap:1.5,children:[(0,l.jsx)(c.Z,{fontSize:"12px",fontWeight:700,color:"var(--color-neutral700)",textTransform:"uppercase",textAlign:"left",children:"Email Settings"}),(0,l.jsx)(s.Z,{display:"flex",flexDirection:"column",gap:.75,children:(0,l.jsx)(L.Z,{variant:"outlined",value:p,onChange:e=>m(e.target.value),placeholder:"Subject",error:h&&!p.trim()?"Required":void 0})}),(0,l.jsx)(s.Z,{display:"flex",flexDirection:"column",gap:.75,children:(0,l.jsx)(L.Z,{variant:"outlined",value:u,onChange:e=>x(e.target.value),placeholder:"Short preheader text"})})]}),(0,l.jsxs)(s.Z,{display:"flex",flexDirection:"column",gap:1.5,children:[(0,l.jsx)(c.Z,{fontSize:"12px",textAlign:"left",fontWeight:700,color:"var(--color-neutral700)",textTransform:"uppercase",children:"Recipient"}),(0,l.jsx)(s.Z,{display:"flex",flexDirection:"column",gap:.75,children:(0,l.jsx)(L.Z,{variant:"outlined",value:o,onChange:e=>d(e.target.value),placeholder:"[email protected]",error:h&&!o.trim()?"Required":void 0})})]}),(0,l.jsxs)(s.Z,{display:"flex",gap:1.5,children:[(0,l.jsx)(g.Z,{fullWidth:!0,theme:"light",variant:"outlined",onClick:a,children:"Cancel"}),(0,l.jsx)(g.Z,{fullWidth:!0,theme:"light",loading:r,onClick:handleSubmit,children:"Send"})]})]})}var W=a(65985);function AllNewsletterTemplates(){var e;let t=(0,x.HP)(e=>e.data),a=(0,m.Z)(null==t?void 0:t.is_admin),n=(0,u.Z)(null==t?void 0:t.is_support_admin),{data:i,isLoading:y}=(0,f.n)();if(a.isFetching||n.isFetching)return(0,l.jsx)(p.B,{isLoading:!0});if(!a.isSuccess&&!n.isSuccess)return null;let v=null!==(e=null==i?void 0:i.data)&&void 0!==e?e:[],j=(0,l.jsx)(r(),{href:"/adminDashboard/allNewsletterTemplates/builder",passHref:!0,legacyBehavior:!0,children:(0,l.jsx)(g.Z,{size:"small",startIcon:(0,l.jsx)(d.v,{size:16}),children:"New Template"})});return(0,l.jsxs)(h.Z,{children:[(0,l.jsx)(s.Z,{sx:{padding:{xs:"28px 32px 0",sm:"28px 32px 0",md:0}}})," ",(0,l.jsx)(W.Z,{title:"Email Templates",actions:j}),(0,l.jsxs)(s.Z,{sx:{display:"flex",flexDirection:"column",gap:"24px",padding:{md:0,sm:"0 20px",xs:"0 20px"}},children:[y&&(0,l.jsx)(s.Z,{sx:{display:"flex",justifyContent:"center",paddingTop:"64px"},children:(0,l.jsx)(o.Z,{size:32})}),!y&&0===v.length&&(0,l.jsxs)(s.Z,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",paddingTop:"80px",gap:"12px"},children:[(0,l.jsx)(c.Z,{sx:{fontSize:"15px",fontWeight:600,color:"var(--color-neutral500)"},children:"No templates yet"}),(0,l.jsx)(c.Z,{sx:{fontSize:"13px",color:"var(--color-neutral400)"},children:"Create your first template using the Template Builder."})]}),!y&&v.length>0&&(0,l.jsx)(s.Z,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(400px, 1fr))",gap:"20px"},children:v.map(e=>(0,l.jsx)(TemplateCard,{template:e},e.id))})]})]})}},62779:function(e){e.exports={card:"style_card__VRk12",inactive:"style_inactive__jmeHh",header:"style_header__TNS_r",preview:"style_preview__F_cts",headerTop:"style_headerTop__yq1tR",headerActions:"style_headerActions__JQoAL",name:"style_name__ja4LR",date:"style_date__O1JLU",previewScaler:"style_previewScaler__bDbPH",empty:"style_empty__I9eMz",footer:"style_footer__cy3eg",footerLabel:"style_footerLabel__CBtJd",previewModalContent:"style_previewModalContent__IP7h4",previewIframe:"style_previewIframe__txjUb"}},60768:function(e,t,a){"use strict";a.d(t,{z:function(){return s}});var l=a(50959),n=a(18329);let i=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM93,180l71-71,11,11-71,71ZM76,163,65,152l71-71,11,11ZM52,173l15.51,15.51h0L83,204H52ZM192,103,153,64l18.34-18.34,39,39Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z",opacity:"0.2"}),l.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM51.31,160,136,75.31,152.69,92,68,176.68ZM48,179.31,76.69,208H48Zm48,25.38L79.31,188,164,103.31,180.69,120Zm96-96L147.31,64l24-24L216,84.68Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM51.31,160l90.35-90.35,16.68,16.69L68,176.68ZM48,179.31,76.69,208H48Zm48,25.38L79.31,188l90.35-90.35h0l16.68,16.69Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM48.49,160,136,72.48,155.51,92,68,179.51ZM46,208V174.48L81.51,210H48A2,2,0,0,1,46,208Zm50-.49L76.49,188,164,100.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM51.31,160,136,75.31,152.69,92,68,176.68ZM48,179.31,76.69,208H48Zm48,25.38L79.31,188,164,103.31,180.69,120Zm96-96L147.31,64l24-24L216,84.68Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17ZM45.66,160,136,69.65,158.34,92,68,182.34ZM44,208V169.66l21.17,21.17h0L86.34,212H48A4,4,0,0,1,44,208Zm52,2.34L73.66,188,164,97.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z"}))]]),r=l.forwardRef((e,t)=>
1l.createElement(n.Z,{ref:t,...e,weights:i}));r.displayName="PencilIcon";let s=r}},function(e){e.O(0,[8217,2416,9774,2888,179],function(){return e(e.s=94158)}),_N_E=e.O()}]);

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.