"use strict";(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[726],{18325:(t,e,a)=>{var o=a(79124),i=a(59437),n=a(81448),l=a(94195),s=a(57450),r=a(29975),c=a(7378),m=a(66248),u=a(51047),d=a(20363),p=a(19669),h=a(86106);function _({showModal:t,onClose:e}){return t?(0,h.jsx)(d.D,{onRequestClose:e,tracking:{utm_medium:"upsell_modal",utm_campaign:"create_automation_from_scratch"},children:(0,i.__)("Creating custom automations is a premium feature.","mailpoet")}):null}function g({variant:t="secondary",isPageTitleAction:e=!1}){const[a,o]=(0,c.useState)(!1),[n,l]=(0,c.useState)(null),[s,r]=(0,c.useState)(!1),d=(0,c.useCallback)((()=>{!function(t,e){u.Hooks.applyFilters("mailpoet.automation.templates.from_scratch_button",(()=>{r(!1),o(!0)}))(e)}(0,l)}),[]);return(0,h.jsxs)(h.Fragment,{children:[n&&(0,h.jsx)(p.$,{type:"error",closable:!0,timeout:!1,children:(0,h.jsx)("p",{children:n})}),e?(0,h.jsx)("button",{className:"page-title-action "+(s?"mailpoet-button-with-spinner":""),onClick:()=>{r(!0),d()},type:"button",children:(0,i.__)("Or, create custom automation","mailpoet")}):(0,h.jsx)(m.Ay,{variant:t,isBusy:s&&"link"!==t,disabled:s,onClick:()=>{r(!0),d()},children:(0,i.__)("Create custom automation","mailpoet")}),(0,h.jsx)(_,{showModal:a,onClose:()=>{o(!1),r(!1)}})]})}var x=a(6830),j=a(43318),w=a(75514),b=a(71054);const k=[{name:"all",title:(0,h.jsx)(w.Ic,{title:(0,i.__)("All","mailpoet"),count:l.X.length})},...l.s.map((t=>({...t,count:l.X.filter((e=>e.category===t.slug)).length}))).filter((({count:t})=>t>0)).map((({name:t,slug:e,count:a})=>({name:e,title:(0,h.jsx)(w.Ic,{title:t,count:a})})))];function f(){const t=new URLSearchParams(window.location.search),e=t.get("loadedvia"),a=t.get("initialTab");return"woo_multichannel_dashboard"===e&&window.MailPoet.trackEvent("MailPoet - WooCommerce Multichannel Marketing dashboard > Automation template selection page",{"WooCommerce version":window.mailpoet_woocommerce_version}),(0,h.jsxs)("div",{className:"mailpoet-main-container",children:[(0,h.jsx)(r.x,{}),(0,h.jsx)(x.z,{heading:(0,i.__)("Start with a template","mailpoet"),headingPrefix:(0,h.jsx)(x.o,{href:j.U.urls.automationListing,label:(0,i.__)("Back to automation list","mailpoet")}),children:(0,h.jsx)(g,{isPageTitleAction:!0})}),(0,h.jsx)(w.Kp,{tabs:k,initialTabName:a,children:t=>(0,h.jsx)(b.i,{templates:l.X.filter((e=>"all"===t.name||e.category===t.name))})}),(0,h.jsxs)(w.wi,{children:[(0,h.jsx)("p",{children:(0,i.__)("Can’t find what you’re looking for?","mailpoet")}),(0,h.jsx)(g,{variant:"link"})]})]})}window.addEventListener("DOMContentLoaded",(()=>{const t=document.getElementById("mailpoet_automation_templates");t&&((0,n.registerTranslations)(),(0,s.b)(),(0,o.H)(t).render((0,h.jsx)(f,{})))}))},41669:t=>{t.exports=jQuery}},t=>{t.O(0,[223],(()=>t(t.s=18325))),t.O()}]);