"use strict";(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[726],{58405(t,e,a){var o=a(79124),i=a(69139),n=a(75245),l=a(42149),s=a(25444),r=a(3354),c=a(7378),m=a(69611),u=a(58633),d=a(50117),p=a(36635),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(35011),j=a(16725),w=a(60078),b=a(32873);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=58405)),t.O()}]);