File "automation_templates.js"

Full Path: /home/warrior1/public_html/languages/wp-content-20241001222009/plugins/mailpoet/assets/dist/js/automation_templates.js
File size: 3.16 KB
MIME-type: text/plain
Charset: utf-8

"use strict";(self.webpackChunkMailPoet3=self.webpackChunkMailPoet3||[]).push([[457],{70837:function(t,e,a){var o=a(64151),l=a(30337),s=a(9090);const n=window.mailpoet_automation_templates;var i=a(52278),r=a(95393),c=a(12374),m=a(62668),u=a(20360),d=a(20264);function h(t){let{template:e}=t;const[a,{loading:o,error:s,data:n}]=(0,c.Db)("workflows/create-from-template",{method:"POST",body:JSON.stringify({slug:e.slug})});!s&&n&&(window.location.href=(0,r.f)(m.x.urls.automationEditor,{id:n.data.id}));let h=null;return s&&(h=(0,d.jsx)(u.q,{type:"error",closable:!0,timeout:!1,children:(0,d.jsx)("p",{children:s.data?s.data.message:(0,l.__)("Could not create workflow.","mailpoet")})})),(0,d.jsxs)("li",{className:"mailpoet-automation-template-list-item",children:[h,(0,d.jsxs)(i.Z,{isBusy:o,onClick:()=>{a()},children:[(0,d.jsxs)("h2",{children:[e.name," →"]}),(0,d.jsx)("p",{children:e.description})]})]})}var p=a(20035),x=a(33684),j=a(49231),w=a(34517),f=a(47842),_=a(33140),g=(0,j.createElement)(_.Wj,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,j.createElement)(_.y$,{d:"M2 12C2 6.44444 6.44444 2 12 2C17.5556 2 22 6.44444 22 12C22 17.5556 17.5556 22 12 22C6.44444 22 2 17.5556 2 12ZM13 11V7H11V11H7V13H11V17H13V13H17V11H13Z"})),C=a(33357);function k(t){let{showModal:e,setShowModal:a}=t;return e?(0,d.jsx)(C.Z,{onRequestClose:()=>{a(!1)},tracking:{utm_medium:"upsell_modal",utm_campaign:"create_automation_from_scratch"},children:(0,l.__)("You cannot create automation from scratch.","mailpoet")}):null}function y(t,e){w.Hooks.applyFilters("mailpoet.automation.templates.from_scratch_button",(()=>{t()}))(e)}function M(){const[t,e]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null),s=(0,j.useCallback)((()=>{y((()=>{e(!0)}),o)}),[]);return(0,d.jsxs)(d.Fragment,{children:[a&&(0,d.jsx)(u.q,{type:"error",closable:!0,timeout:!1,children:(0,d.jsx)("p",{children:a})}),(0,d.jsx)(i.Z,{variant:"secondary",onClick:()=>s(),children:(0,l.__)("From scratch","mailpoet")}),(0,d.jsx)(k,{showModal:t,setShowModal:e})]})}function b(){const[t,e]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null),s=(0,j.useCallback)((()=>{y((()=>{e(!0)}),o)}),[]);return(0,d.jsxs)("li",{className:"mailpoet-automation-template-list-item mailpoet-automation-from-scratch",children:[a&&(0,d.jsx)(u.q,{type:"error",closable:!0,timeout:!1,children:(0,d.jsx)("p",{children:a})}),(0,d.jsxs)(i.Z,{onClick:()=>s(),children:[(0,d.jsx)(f.Z,{width:"50px",height:"50px",icon:g}),(0,l.__)("Create from scratch","mailpoet")]}),(0,d.jsx)(k,{showModal:t,setShowModal:e})]})}function S(){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(x.Q,{}),(0,d.jsxs)(s.Z,{className:"mailpoet-automation-templates-heading",children:[(0,d.jsx)("h1",{className:"wp-heading-inline",children:(0,l.__)("Choose your automation template","mailpoet")}),(0,d.jsx)(M,{})]}),(0,d.jsxs)("ul",{className:"mailpoet-automation-templates",children:[n.map((t=>(0,d.jsx)(h,{template:t},t.slug))),(0,d.jsx)(b,{})]})]})}window.addEventListener("DOMContentLoaded",(()=>{const t=document.getElementById("mailpoet_automation_templates");t&&((0,p.P)(),(0,c.qN)(),o.render((0,d.jsx)(S,{}),t))}))},65311:function(t){t.exports=jQuery}},function(t){t.O(0,[351],(function(){return 70837,t(t.s=70837)})),t.O()}]);