"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[457],{23561:function(e,t,a){var s=a(64151),o=a(30337),n=a(9090),l=a(71128),i=a(83544),c=a(15160),r=a(20035),u=a(33684),m=a(49231),d=a(52278),p=a(34517),h=a(47842),x=a(86591),j=a(33357),_=a(20360),f=a(20264);function C(e){let{showModal:t,onClose:a}=e;return t?(0,f.jsx)(j.ZG,{onRequestClose:a,tracking:{utm_medium:"upsell_modal",utm_campaign:"create_automation_from_scratch"},children:(0,o.__)("You cannot create automation from scratch.","mailpoet")}):null}function k(e,t){p.Hooks.applyFilters("mailpoet.automation.templates.from_scratch_button",(()=>{e()}))(t)}function b(){const[e,t]=(0,m.useState)(!1),[a,s]=(0,m.useState)(null),[n,l]=(0,m.useState)(!1),i=(0,m.useCallback)((()=>{k((()=>{t(!0)}),s)}),[]);return(0,f.jsxs)(f.Fragment,{children:[a&&(0,f.jsx)(_.q,{type:"error",closable:!0,timeout:!1,children:(0,f.jsx)("p",{children:a})}),(0,f.jsx)(d.Z,{variant:"secondary",isBusy:n,disabled:n,onClick:()=>{l(!0),i()},children:(0,o.__)("From scratch","mailpoet")}),(0,f.jsx)(C,{showModal:e,onClose:()=>{t(!1),l(!1)}})]})}function g(){const[e,t]=(0,m.useState)(!1),[a,s]=(0,m.useState)(!1),[n,l]=(0,m.useState)(null),i=(0,m.useCallback)((()=>{k((()=>{t(!0)}),l)}),[]);return(0,f.jsxs)("li",{className:"mailpoet-automation-template-list-item mailpoet-automation-from-scratch",children:[n&&(0,f.jsx)(_.q,{type:"error",closable:!0,timeout:!1,children:(0,f.jsx)("p",{children:n})}),(0,f.jsxs)(d.Z,{isBusy:a,disabled:a,onClick:()=>{s(!0),i()},children:[(0,f.jsx)(h.Z,{width:"50px",height:"50px",icon:x.Z}),(0,o.__)("Create from scratch","mailpoet")]}),(0,f.jsx)(C,{showModal:e,onClose:()=>{t(!1),s(!1)}})]})}function w(){return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.Q,{}),(0,f.jsxs)(n.Z,{className:"mailpoet-automation-templates-heading",children:[(0,f.jsx)("h1",{className:"wp-heading-inline",children:(0,o.__)("Choose your automation template","mailpoet")}),(0,f.jsx)(b,{})]}),(0,f.jsxs)("ul",{className:"mailpoet-automation-templates",children:[l.U.map((e=>(0,f.jsx)(i.v,{template:e},e.slug))),(0,f.jsx)(g,{})]})]})}window.addEventListener("DOMContentLoaded",(()=>{const e=document.getElementById("mailpoet_automation_templates");e&&((0,r.P)(),(0,c.q)(),s.render((0,f.jsx)(w,{}),e))}))},65311:function(e){e.exports=jQuery}},function(e){e.O(0,[351],(function(){return 23561,e(e.s=23561)})),e.O()}]);