| 1 |
<?php |
| 2 |
/** |
| 3 |
* View automations |
| 4 |
* |
| 5 |
* @package |
| 6 |
*/ |
| 7 |
|
| 8 |
use WPFunnels\Wpfnl_functions; |
| 9 |
|
| 10 |
if ( ! Wpfnl_functions::is_mail_mint_pro_license_active() || ! Wpfnl_functions::is_pro_license_activated() ) : |
| 11 |
?> |
| 12 |
<div class="wpfnl"> |
| 13 |
<div class="wpfnl-dashboard wpfnl-automations"> |
| 14 |
<nav class="wpfnl-dashboard__nav"> |
| 15 |
<?php require_once WPFNL_DIR . '/admin/partials/dashboard-nav.php'; ?> |
| 16 |
</nav> |
| 17 |
|
| 18 |
<div class="dashboard-nav__content"> |
| 19 |
<div class="wpfnl-automation-content"> |
| 20 |
<div class="wpfnl-automation-hero"> |
| 21 |
<div class="wpfnl-automation-hero-left"> |
| 22 |
<h1 class="hero-title">Automate Your Funnels with Mail Mint</h1> |
| 23 |
<p class="hero-description">Create automated email journeys, behavior-based workflows, and follow-up sequences that maximize your funnel conversions.</p> |
| 24 |
|
| 25 |
<div class="cta-buttons"> |
| 26 |
<?php if ( ! Wpfnl_functions::is_mail_mint_free_active() ) : ?> |
| 27 |
<a href="#" role="button" aria-label="Download Mail Mint" rel="noopener noreferrer" class="btn-default wpfnl-install-mailmint"> |
| 28 |
<span class="btn-text">Download Mail Mint</span> |
| 29 |
<span class="loader" style="display:none;"> |
| 30 |
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 31 |
<circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2"/> |
| 32 |
<path d="M15 8a7 7 0 01-7 7" stroke="currentColor" stroke-width="2" stroke-linecap="round"> |
| 33 |
<animateTransform attributeName="transform" type="rotate" from="0 8 8" to="360 8 8" dur="1s" repeatCount="indefinite"/> |
| 34 |
</path> |
| 35 |
</svg> |
| 36 |
</span> |
| 37 |
</a> |
| 38 |
<?php endif; ?> |
| 39 |
<a href="https://getwpfunnels.com/pricing/" role="button" target="_blank" aria-label="Upgrade to Pro" rel="noopener noreferrer" class="btn-default">Upgrade to Pro</a> |
| 40 |
<?php //endif; ?> |
| 41 |
</div> |
| 42 |
</div> |
| 43 |
|
| 44 |
<div class="wpfnl-automation-hero-right"> |
| 45 |
<span class="rating"> |
| 46 |
<svg width="66" height="11" viewBox="0 0 66 11" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.35272 0.795459C5.37435 0.751757 5.40777 0.71497 5.44919 0.689251C5.49062 0.663531 5.53841 0.649902 5.58718 0.649902C5.63594 0.649902 5.68373 0.663531 5.72516 0.689251C5.76659 0.71497 5.8 0.751757 5.82163 0.795459L6.96182 3.10497C7.03694 3.25697 7.14781 3.38849 7.28494 3.48821C7.42206 3.58794 7.58134 3.65291 7.7491 3.67753L10.299 4.05068C10.3473 4.05768 10.3927 4.07806 10.43 4.10952C10.4674 4.14097 10.4952 4.18225 10.5102 4.22867C10.5253 4.2751 10.5272 4.32483 10.5155 4.37223C10.5038 4.41962 10.4791 4.46281 10.4441 4.49689L8.60005 6.29257C8.47844 6.41108 8.38744 6.55737 8.33491 6.71885C8.28237 6.88032 8.26987 7.05215 8.29846 7.21953L8.73381 9.75658C8.74234 9.80487 8.73712 9.85459 8.71876 9.90006C8.70039 9.94553 8.66961 9.98492 8.62993 10.0137C8.59025 10.0426 8.54327 10.0596 8.49435 10.063C8.44543 10.0665 8.39654 10.056 8.35325 10.033L6.07386 8.83455C5.92366 8.75569 5.75657 8.71449 5.58693 8.71449C5.41729 8.71449 5.25019 8.75569 5.1 8.83455L2.8211 10.033C2.77783 10.0559 2.72899 10.0662 2.68016 10.0627C2.63132 10.0593 2.58443 10.0422 2.54483 10.0134C2.50524 9.98456 2.47452 9.94522 2.45617 9.89983C2.43782 9.85444 2.43257 9.80481 2.44104 9.75658L2.87589 7.22002C2.90461 7.05256 2.89217 6.88063 2.83963 6.71905C2.78709 6.55747 2.69603 6.41111 2.5743 6.29257L0.730253 4.49738C0.695008 4.46334 0.670032 4.42008 0.658171 4.37254C0.646309 4.325 0.648039 4.27508 0.663164 4.22847C0.678288 4.18186 0.706199 4.14044 0.743717 4.10892C0.781234 4.0774 0.826851 4.05705 0.875369 4.05019L3.42476 3.67753C3.59271 3.6531 3.7522 3.58822 3.88952 3.48848C4.02683 3.38874 4.13785 3.25712 4.21302 3.10497L5.35272 0.795459Z" fill="#ee8134" stroke="#ee8134" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M18.8918 0.795459C18.9134 0.751757 18.9468 0.71497 18.9883 0.689251C19.0297 0.663531 19.0775 0.649902 19.1262 0.649902C19.175 0.649902 19.2228 0.663531 19.2642 0.689251C19.3056 0.71497 19.3391 0.751757 19.3607 0.795459L20.5009 3.10497C20.576 3.25697 20.6869 3.38849 20.824 3.48821C20.9611 3.58794 21.1204 3.65291 21.2882 3.67753L23.838 4.05068C23.8864 4.05768 23.9318 4.07806 23.9691 4.10952C24.0064 4.14097 24.0342 4.18225 24.0493 4.22867C24.0644 4.2751 24.0662 4.32483 24.0545 4.37223C24.0428 4.41962 24.0181 4.46281 23.9832 4.49689L22.1391 6.29257C22.0175 6.41108 21.9265 6.55737 21.874 6.71885C21.8214 6.88032 21.8089 7.05215 21.8375 7.21953L22.2729 9.75658C22.2814 9.80487 22.2762 9.85459 22.2578 9.90006C22.2395 9.94553 22.2087 9.98492 22.169 10.0137C22.1293 10.0426 22.0823 10.0596 22.0334 10.063C21.9845 10.0665 21.9356 10.056 21.8923 10.033L19.6129 8.83455C19.4627 8.75569 19.2956 8.71449 19.126 8.71449C18.9564 8.71449 18.7893 8.75569 18.6391 8.83455L16.3602 10.033C16.3169 10.0559 16.2681 10.0662 16.2192 10.0627C16.1704 10.0593 16.1235 10.0422 16.0839 10.0134C16.0443 9.98456 16.0136 9.94522 15.9952 9.89983C15.9769 9.85444 15.9716 9.80481 15.9801 9.75658L16.415 7.22002C16.4437 7.05256 16.4312 6.88063 16.3787 6.71905C16.3261 6.55747 16.2351 6.41111 16.1134 6.29257L14.2693 4.49738C14.2341 4.46334 14.2091 4.42008 14.1972 4.37254C14.1854 4.325 14.1871 4.27508 14.2022 4.22847C14.2174 4.18186 14.2453 4.14044 14.2828 4.10892C14.3203 4.0774 14.3659 4.05705 14.4144 4.05019L16.9638 3.67753C17.1318 3.6531 17.2913 3.58822 17.4286 3.48848C17.5659 3.38874 17.6769 3.25712 17.7521 3.10497L18.8918 0.795459Z" fill="#ee8134" stroke="#ee8134" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M32.4289 0.795459C32.4505 0.751757 32.4839 0.71497 32.5254 0.689251C32.5668 0.663531 32.6146 0.649902 32.6633 0.649902C32.7121 0.649902 32.7599 0.663531 32.8013 0.689251C32.8428 0.71497 32.8762 0.751757 32.8978 0.795459L34.038 3.10497C34.1131 3.25697 34.224 3.38849 34.3611 3.48821C34.4982 3.58794 34.6575 3.65291 34.8253 3.67753L37.3752 4.05068C37.4235 4.05768 37.4689 4.07806 37.5062 4.10952C37.5435 4.14097 37.5713 4.18225 37.5864 4.22867C37.6015 4.2751 37.6033 4.32483 37.5916 4.37223C37.5799 4.41962 37.5552 4.46281 37.5203 4.49689L35.6762 6.29257C35.5546 6.41108 35.4636 6.55737 35.4111 6.71885C35.3585 6.88032 35.346 7.05215 35.3746 7.21953L35.81 9.75658C35.8185 9.80487 35.8133 9.85459 35.7949 9.90006C35.7766 9.94553 35.7458 9.98492 35.7061 10.0137C35.6664 10.0426 35.6194 10.0596 35.5705 10.063C35.5216 10.0665 35.4727 10.056 35.4294 10.033L33.15 8.83455C32.9998 8.75569 32.8327 8.71449 32.6631 8.71449C32.4935 8.71449 32.3264 8.75569 32.1762 8.83455L29.8973 10.033C29.854 10.0559 29.8052 10.0662 29.7563 10.0627C29.7075 10.0593 29.6606 10.0422 29.621 10.0134C29.5814 9.98456 29.5507 9.94522 29.5323 9.89983C29.514 9.85444 29.5087 9.80481 29.5172 9.75658L29.9521 7.22002C29.9808 7.05256 29.9683 6.88063 29.9158 6.71905C29.8633 6.55747 29.7722 6.41111 29.6505 6.29257L27.8064 4.49738C27.7712 4.46334 27.7462 4.42008 27.7343 4.37254C27.7225 4.325 27.7242 4.27508 27.7393 4.22847C27.7545 4.18186 27.7824 4.14044 27.8199 4.10892C27.8574 4.0774 27.903 4.05705 27.9515 4.05019L30.5009 3.67753C30.6689 3.6531 30.8284 3.58822 30.9657 3.48848C31.103 3.38874 31.214 3.25712 31.2892 3.10497L32.4289 0.795459Z" fill="#ee8134" stroke="#ee8134" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M45.968 0.795459C45.9896 0.751757 46.023 0.71497 46.0644 0.689251C46.1059 0.663531 46.1536 0.649902 46.2024 0.649902C46.2512 0.649902 46.299 0.663531 46.3404 0.689251C46.3818 0.71497 46.4152 0.751757 46.4369 0.795459L47.5771 3.10497C47.6522 3.25697 47.763 3.38849 47.9002 3.48821C48.0373 3.58794 48.1966 3.65291 48.3643 3.67753L50.9142 4.05068C50.9625 4.05768 51.0079 4.07806 51.0453 4.10952C51.0826 4.14097 51.1104 4.18225 51.1255 4.22867C51.1406 4.2751 51.1424 4.32483 51.1307 4.37223C51.119 4.41962 51.0943 4.46281 51.0593 4.49689L49.2153 6.29257C49.0937 6.41108 49.0027 6.55737 48.9501 6.71885C48.8976 6.88032 48.8851 7.05215 48.9137 7.21953L49.349 9.75658C49.3576 9.80487 49.3524 9.85459 49.334 9.90006C49.3156 9.94553 49.2848 9.98492 49.2452 10.0137C49.2055 10.0426 49.1585 10.0596 49.1096 10.063C49.0607 10.0665 49.0118 10.056 48.9685 10.033L46.6891 8.83455C46.5389 8.75569 46.3718 8.71449 46.2022 8.71449C46.0325 8.71449 45.8654 8.75569 45.7152 8.83455L43.4363 10.033C43.3931 10.0559 43.3442 10.0662 43.2954 10.0627C43.2466 10.0593 43.1997 10.0422 43.1601 10.0134C43.1205 9.98456 43.0898 9.94522 43.0714 9.89983C43.0531 9.85444 43.0478 9.80481 43.0563 9.75658L43.4911 7.22002C43.5198 7.05256 43.5074 6.88063 43.4549 6.71905C43.4023 6.55747 43.3113 6.41111 43.1895 6.29257L41.3455 4.49738C41.3102 4.46334 41.2853 4.42008 41.2734 4.37254C41.2615 4.325 41.2633 4.27508 41.2784 4.22847C41.2935 4.18186 41.3214 4.14044 41.359 4.10892C41.3965 4.0774 41.4421 4.05705 41.4906 4.05019L44.04 3.67753C44.2079 3.6531 44.3674 3.58822 44.5048 3.48848C44.6421 3.38874 44.7531 3.25712 44.8283 3.10497L45.968 0.795459Z" fill="#ee8134" stroke="#ee8134" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M59.507 0.795459C59.5286 0.751757 59.5621 0.71497 59.6035 0.689251C59.6449 0.663531 59.6927 0.649902 59.7415 0.649902C59.7902 0.649902 59.838 0.663531 59.8795 0.689251C59.9209 0.71497 59.9543 0.751757 59.9759 0.795459L61.1161 3.10497C61.1912 3.25697 61.3021 3.38849 61.4392 3.48821C61.5764 3.58794 61.7356 3.65291 61.9034 3.67753L64.4533 4.05068C64.5016 4.05768 64.547 4.07806 64.5843 4.10952C64.6217 4.14097 64.6494 4.18225 64.6645 4.22867C64.6796 4.2751 64.6815 4.32483 64.6698 4.37223C64.6581 4.41962 64.6334 4.46281 64.5984 4.49689L62.7543 6.29257C62.6327 6.41108 62.5417 6.55737 62.4892 6.71885C62.4367 6.88032 62.4242 7.05215 62.4528 7.21953L62.8881 9.75658C62.8966 9.80487 62.8914 9.85459 62.8731 9.90006C62.8547 9.94553 62.8239 9.98492 62.7842 10.0137C62.7446 10.0426 62.6976 10.0596 62.6487 10.063C62.5997 10.0665 62.5508 10.056 62.5075 10.033L60.2282 8.83455C60.078 8.75569 59.9109 8.71449 59.7412 8.71449C59.5716 8.71449 59.4045 8.75569 59.2543 8.83455L56.9754 10.033C56.9321 10.0559 56.8833 10.0662 56.8345 10.0627C56.7856 10.0593 56.7387 10.0422 56.6991 10.0134C56.6595 9.98456 56.6288 9.94522 56.6105 9.89983C56.5921 9.85444 56.5869 9.80481 56.5953 9.75658L57.0302 7.22002C57.0589 7.05256 57.0465 6.88063 56.9939 6.71905C56.9414 6.55747 56.8503 6.41111 56.7286 6.29257L54.8846 4.49738C54.8493 4.46334 54.8243 4.42008 54.8125 4.37254C54.8006 4.325 54.8023 4.27508 54.8175 4.22847C54.8326 4.18186 54.8605 4.14044 54.898 4.10892C54.9355 4.0774 54.9811 4.05705 55.0297 4.05019L57.5791 3.67753C57.747 3.6531 57.9065 3.58822 58.0438 3.48848C58.1811 3.38874 58.2921 3.25712 58.3673 3.10497L59.507 0.795459Z" fill="#ee8134" stroke="#ee8134" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></svg> |
| 47 |
Rated 5 Stars by Users |
| 48 |
</span> |
| 49 |
|
| 50 |
<ul class="feature-list"> |
| 51 |
<li>360° Contact Profiles</li> |
| 52 |
<li>Email Builder</li> |
| 53 |
<li>Marketing Automations</li> |
| 54 |
<li>Campaign Ferformance</li> |
| 55 |
<li>Abandoned Cart Recovery</li> |
| 56 |
</ul> |
| 57 |
</div> |
| 58 |
</div> |
| 59 |
|
| 60 |
<!-- Hero Image Section --> |
| 61 |
<section class="hero-section"> |
| 62 |
<div class="hero-video-container"> |
| 63 |
<iframe |
| 64 |
width="560" |
| 65 |
height="315" |
| 66 |
src="https://www.youtube.com/embed/lRKDasiv9O0?si=R_9sKePZq0yn7gCk" |
| 67 |
title="Mail Mint Overview Video" |
| 68 |
frameborder="0" |
| 69 |
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" |
| 70 |
allowfullscreen |
| 71 |
></iframe> |
| 72 |
</div> |
| 73 |
</section> |
| 74 |
|
| 75 |
<!-- Features Section --> |
| 76 |
<section class="features-section"> |
| 77 |
|
| 78 |
<div class="feature-container"> |
| 79 |
|
| 80 |
<h2 class="section-title">See how WPFunnels and Mail Mint work together</h2> |
| 81 |
|
| 82 |
<div class="features-grid"> |
| 83 |
<!-- Feature 1 --> |
| 84 |
<div class="feature-card"> |
| 85 |
<div class="feature-icon"> |
| 86 |
<?php |
| 87 |
$svg_path = WPFNL_PATH . '/admin/assets/images/contact-management.svg'; |
| 88 |
if (file_exists($svg_path)) { |
| 89 |
echo file_get_contents($svg_path); |
| 90 |
} |
| 91 |
?> |
| 92 |
</div> |
| 93 |
<h3 class="feature-title">Email Marketing Automation</h3> |
| 94 |
<p class="feature-description">Automate email marketing campaigns based on customer actions, such as abandoned carts or completed purchases in WPFunnels.</p> |
| 95 |
</div> |
| 96 |
|
| 97 |
<!-- Feature 2 --> |
| 98 |
<div class="feature-card"> |
| 99 |
<div class="feature-icon"> |
| 100 |
<?php |
| 101 |
$svg_path = WPFNL_PATH . '/admin/assets/images/email-builder.svg'; |
| 102 |
if (file_exists($svg_path)) { |
| 103 |
echo file_get_contents($svg_path); |
| 104 |
} |
| 105 |
?> |
| 106 |
</div> |
| 107 |
<h3 class="feature-title">Upsell and Cross-sell Automation</h3> |
| 108 |
<p class="feature-description">Automatically trigger personalized upsell and cross-sell offers in your WPFunnels based on each customer’s purchase behavior and product engagement in WooCommerce.</p> |
| 109 |
</div> |
| 110 |
|
| 111 |
<!-- Feature 3 --> |
| 112 |
<div class="feature-card"> |
| 113 |
<div class="feature-icon"> |
| 114 |
<?php |
| 115 |
$svg_path = WPFNL_PATH . '/admin/assets/images/email-sequence.svg'; |
| 116 |
if (file_exists($svg_path)) { |
| 117 |
echo file_get_contents($svg_path); |
| 118 |
} |
| 119 |
?> |
| 120 |
</div> |
| 121 |
<h3 class="feature-title">Automated Coupon Code</h3> |
| 122 |
<p class="feature-description">Automatically create and send coupon codes based on customer actions or conditions in WooCommerce.</p> |
| 123 |
</div> |
| 124 |
|
| 125 |
<!-- Feature 4 --> |
| 126 |
<div class="feature-card"> |
| 127 |
<div class="feature-icon"> |
| 128 |
<?php |
| 129 |
$svg_path = WPFNL_PATH . '/admin/assets/images/automation-flows.svg'; |
| 130 |
if (file_exists($svg_path)) { |
| 131 |
echo file_get_contents($svg_path); |
| 132 |
} |
| 133 |
?> |
| 134 |
</div> |
| 135 |
<h3 class="feature-title">Order Alerts & Automations</h3> |
| 136 |
<p class="feature-description">Trigger instant notifications and automate actions for new or updated WooCommerce orders in WPFunnels.</p> |
| 137 |
</div> |
| 138 |
|
| 139 |
<!-- Feature 5 --> |
| 140 |
<div class="feature-card"> |
| 141 |
<div class="feature-icon"> |
| 142 |
<?php |
| 143 |
$svg_path = WPFNL_PATH . '/admin/assets/images/realtime-analytics.svg'; |
| 144 |
if (file_exists($svg_path)) { |
| 145 |
echo file_get_contents($svg_path); |
| 146 |
} |
| 147 |
?> |
| 148 |
</div> |
| 149 |
<h3 class="feature-title">Real-time Analytics</h3> |
| 150 |
<p class="feature-description">Actionable analytics to help you make data-driven decisions and optimize your campaigns.</p> |
| 151 |
</div> |
| 152 |
|
| 153 |
<!-- Feature 6 --> |
| 154 |
<div class="feature-card"> |
| 155 |
<div class="feature-icon"> |
| 156 |
<?php |
| 157 |
$svg_path = WPFNL_PATH . '/admin/assets/images/dynamic-segmentation.svg'; |
| 158 |
if (file_exists($svg_path)) { |
| 159 |
echo file_get_contents($svg_path); |
| 160 |
} |
| 161 |
?> |
| 162 |
</div> |
| 163 |
<h3 class="feature-title">Customer Winback Automation</h3> |
| 164 |
<p class="feature-description">Re-engage inactive customers automatically with targeted offers and reminders in WPFunnels.</p> |
| 165 |
</div> |
| 166 |
|
| 167 |
<!-- Feature 7 --> |
| 168 |
<div class="feature-card"> |
| 169 |
<div class="feature-icon"> |
| 170 |
<?php |
| 171 |
$svg_path = WPFNL_PATH . '/admin/assets/images/stunning-email-templates.svg'; |
| 172 |
if (file_exists($svg_path)) { |
| 173 |
echo file_get_contents($svg_path); |
| 174 |
} |
| 175 |
?> |
| 176 |
</div> |
| 177 |
<h3 class="feature-title">Stunning Email Templates</h3> |
| 178 |
<p class="feature-description">Impress subscribers with visually appealing email templates by Mail Mint to get more opens and clicks.</p> |
| 179 |
</div> |
| 180 |
|
| 181 |
<!-- Feature 8 --> |
| 182 |
<div class="feature-card"> |
| 183 |
<div class="feature-icon"> |
| 184 |
<?php |
| 185 |
$svg_path = WPFNL_PATH . '/admin/assets/images/woocommerce-icon.svg'; |
| 186 |
if (file_exists($svg_path)) { |
| 187 |
echo file_get_contents($svg_path); |
| 188 |
} |
| 189 |
?> |
| 190 |
</div> |
| 191 |
<h3 class="feature-title">WooCommerce</h3> |
| 192 |
<p class="feature-description">Trigger personalized and automated email campaigns for your WooCommerce store based on customer actions, order status, etc.</p> |
| 193 |
</div> |
| 194 |
</div> |
| 195 |
|
| 196 |
<p class="features-footer">These are just examples. The possibilities are truly endless.</p> |
| 197 |
</div> |
| 198 |
</section> |
| 199 |
|
| 200 |
<!-- Bottom CTA Section --> |
| 201 |
<section class="bottom-cta-section"> |
| 202 |
<div class="cta-content-container"> |
| 203 |
<div class="cta-text"> |
| 204 |
<h2 class="cta-title">Stay Focused On Reaching Your Business Goals With Mail Mint</h2> |
| 205 |
<p class="cta-subtitle">Launch successful sales campaigns, run a profitable business & develop a trusting relationship with your customers.</p> |
| 206 |
</div> |
| 207 |
<div class="cta-btn-wrapper"> |
| 208 |
<a href="https://getwpfunnels.com/email-marketing-automation-mail-mint/" target="_blank" role="button" aria-label="Visit Mail Mint Website" rel="noopener noreferrer" class="btn btn-primary">Visit Mail Mint Website</a> |
| 209 |
</div> |
| 210 |
</div> |
| 211 |
</section> |
| 212 |
</div> |
| 213 |
</div> |
| 214 |
</div> |
| 215 |
</div> |
| 216 |
|
| 217 |
<script> |
| 218 |
jQuery(document).ready(function($) { |
| 219 |
// Handle Mail Mint plugin download |
| 220 |
$('.wpfnl-install-mailmint').on('click', function(e) { |
| 221 |
e.preventDefault(); |
| 222 |
|
| 223 |
var btn = $(this); |
| 224 |
var loader = btn.find('.loader'); |
| 225 |
var btnText = btn.find('.btn-text'); |
| 226 |
|
| 227 |
// Disable button and show loader |
| 228 |
btn.prop('disabled', true); |
| 229 |
loader.show(); |
| 230 |
btnText.text('Downloading...'); |
| 231 |
|
| 232 |
// Get plugin information from WordPress.org API |
| 233 |
$.ajax({ |
| 234 |
url: 'https://api.wordpress.org/plugins/info/1.0/mail-mint.json', |
| 235 |
type: 'GET', |
| 236 |
dataType: 'json', |
| 237 |
success: function(response) { |
| 238 |
if (response && response.download_link) { |
| 239 |
// Create a temporary link to download the file |
| 240 |
var downloadLink = document.createElement('a'); |
| 241 |
downloadLink.href = response.download_link; |
| 242 |
downloadLink.download = 'mail-mint.zip'; |
| 243 |
document.body.appendChild(downloadLink); |
| 244 |
downloadLink.click(); |
| 245 |
document.body.removeChild(downloadLink); |
| 246 |
|
| 247 |
// Update button state |
| 248 |
btnText.text('Downloaded Successfully!'); |
| 249 |
loader.hide(); |
| 250 |
|
| 251 |
// Reset button after 2 seconds |
| 252 |
setTimeout(function() { |
| 253 |
btnText.text('Download Mail Mint'); |
| 254 |
btn.prop('disabled', false); |
| 255 |
}, 2000); |
| 256 |
} else { |
| 257 |
btnText.text('Download Failed'); |
| 258 |
loader.hide(); |
| 259 |
btn.prop('disabled', false); |
| 260 |
alert('Could not get download link for Mail Mint plugin.'); |
| 261 |
} |
| 262 |
}, |
| 263 |
error: function(xhr, status, error) { |
| 264 |
btnText.text('Download Mail Mint'); |
| 265 |
loader.hide(); |
| 266 |
btn.prop('disabled', false); |
| 267 |
alert('Failed to fetch plugin information. Please try again or download directly from WordPress.org'); |
| 268 |
} |
| 269 |
}); |
| 270 |
}); |
| 271 |
}); |
| 272 |
</script> |
| 273 |
|
| 274 |
<?php else : ?> |
| 275 |
|
| 276 |
<div class="wpfnl"> |
| 277 |
<div class="wpfnl-dashboard"> |
| 278 |
<nav class="wpfnl-dashboard__nav"> |
| 279 |
<?php require_once WPFNL_DIR . '/admin/partials/dashboard-nav.php'; ?> |
| 280 |
</nav> |
| 281 |
|
| 282 |
<div class="dashboard-nav__content"> |
| 283 |
<div class="wpfnl-dashboard__header overview-header"> |
| 284 |
<div class="wpfnl-dashboard-header-left"> |
| 285 |
<h2 class="wpfnl-dashboard-title"><?php echo __('Automations', 'wpfnl'); ?></h2> |
| 286 |
</div> |
| 287 |
<div class="wpfnl-dashboard-header-right"> |
| 288 |
<form class="funnel-search" method="get"> |
| 289 |
<div class="search-group"> |
| 290 |
<input name="page" type="hidden" value="wpfnl_automations"> |
| 291 |
<?php require_once WPFNL_DIR . '/admin/partials/icons/search-icon.php'; ?> |
| 292 |
<input name="s" type="text" value="" placeholder="<?php echo __('Search funnel...', 'wpfnl'); ?>"> |
| 293 |
</div> |
| 294 |
</form> |
| 295 |
<!-- <a href="#" class="import-export wpfnl-import-funnels"> |
| 296 |
<?php |
| 297 |
require WPFNL_DIR . '/admin/partials/icons/import-icon.php'; |
| 298 |
echo __('Import', 'wpfnl'); |
| 299 |
?> |
| 300 |
</a> --> |
| 301 |
<a href="#" class="btn-default add-new-funnel-btn"> |
| 302 |
<?php |
| 303 |
require WPFNL_DIR . '/admin/partials/icons/plus-icon.php'; |
| 304 |
echo esc_html__('Add New Automation', 'wpfnl'); |
| 305 |
?> |
| 306 |
</a> |
| 307 |
</div> |
| 308 |
</div> |
| 309 |
|
| 310 |
<div class="wpfnl-dashboard__inner-content"> |
| 311 |
<?php |
| 312 |
// Get pagination parameters |
| 313 |
$current_page = isset($_GET['paged']) ? max(1, intval($_GET['paged'])) : 1; |
| 314 |
$per_page = isset($_GET['per_page']) ? max(1, intval($_GET['per_page'])) : 10; |
| 315 |
|
| 316 |
$result = Wpfnl_functions::retrieve_all_automations($current_page, $per_page); |
| 317 |
$automations = isset($result['data']) ? $result['data'] : array(); |
| 318 |
$total = isset($result['total']) ? $result['total'] : 0; |
| 319 |
$total_pages = isset($result['total_pages']) ? $result['total_pages'] : 0; |
| 320 |
$per_page = isset($result['per_page']) ? $result['per_page'] : 10; |
| 321 |
if (!empty($automations)) : |
| 322 |
?> |
| 323 |
<div class="funnel-list__wrapper"> |
| 324 |
<div class="funnel__single-list list-header"> |
| 325 |
<div class="bulk-action-wrapper" style="display:none;"> |
| 326 |
<p> |
| 327 |
<span class="selected-funnel-count">0 <?php echo __('Automation', 'wpfnl'); ?></span> |
| 328 |
<?php echo __('Selected', 'wpfnl'); ?> |
| 329 |
</p> |
| 330 |
<button class="btn-default bulk-delete-toggler"> |
| 331 |
<?php echo __('Bulk Actions', 'wpfnl'); ?> |
| 332 |
<svg width="8" height="6" fill="none" viewBox="0 0 8 6" xmlns="http://www.w3.org/2000/svg"><path fill="#fff" stroke="#fff" stroke-width=".2" d="M4 5.28a.559.559 0 01-.396-.164l-3.44-3.44A.56.56 0 11.956.884L4 3.928 7.044.884a.56.56 0 01.792.792l-3.44 3.44A.559.559 0 014 5.28z"/></svg> |
| 333 |
<ul class="wpfnl-dropdown"> |
| 334 |
<li> |
| 335 |
<a href="#" class="delete wpfnl-automation-bulk-delete"> |
| 336 |
<?php require WPFNL_DIR . '/admin/partials/icons/delete-icon.php'; ?> |
| 337 |
<?php echo __('Delete', 'wpfnl'); ?> |
| 338 |
</a> |
| 339 |
</li> |
| 340 |
</ul> |
| 341 |
</button> |
| 342 |
</div> |
| 343 |
<div class="funnel-list__bulk-action"> |
| 344 |
<div class="funnel-list__bulk-select select-all-funnels"> |
| 345 |
<span class="wpfnl-checkbox no-title"> |
| 346 |
<input type="checkbox" name="automation-list__bulk-select" id="automation-list__bulk-select"> |
| 347 |
<label for="automation-list__bulk-select"></label> |
| 348 |
</span> |
| 349 |
</div> |
| 350 |
</div> |
| 351 |
<div class="list-cell wpfnl-name"><?php echo __('Automation Name', 'wpfnl'); ?></div> |
| 352 |
<div class="list-cell wpfnl-customers"><?php echo __('Customers', 'wpfnl'); ?></div> |
| 353 |
<div class="list-cell wpfnl-status"><?php echo __('Status', 'wpfnl'); ?></div> |
| 354 |
<div class="list-cell list-action"><?php echo __('Action', 'wpfnl'); ?></div> |
| 355 |
</div> |
| 356 |
<?php |
| 357 |
foreach ($automations as $automation) : |
| 358 |
?> |
| 359 |
<div class="funnel__single-list list-body"> |
| 360 |
<div class="funnel-list__bulk-action"> |
| 361 |
<span class="wpfnl-checkbox no-title"> |
| 362 |
<input type="checkbox" name="automation-list-select" id="automation-list-<?php echo esc_attr( $automation['id'] ); ?>-select" data-id="<?php echo esc_attr( $automation['id'] ); ?>"> |
| 363 |
<label for="automation-list-<?php echo esc_attr( $automation['id'] ); ?>-select"></label> |
| 364 |
</span> |
| 365 |
</div> |
| 366 |
<div class="list-cell wpfnl-name"> |
| 367 |
<span class="builder-logo"> |
| 368 |
<?php require WPFNL_DIR . '/admin/partials/icons/automation-list-icon.php'; ?> |
| 369 |
</span> |
| 370 |
<a href="#" class="name" data-id="<?php echo esc_attr( $automation['id'] ); ?>"><?php echo esc_html( $automation['name'] ); ?></a> |
| 371 |
<span class="steps"><?php echo $automation['created_at']; ?></span> |
| 372 |
</div> |
| 373 |
<div class="list-cell wpfnl-customers"> |
| 374 |
<div class="customers-count active-customers"> |
| 375 |
<?php require WPFNL_DIR . '/admin/partials/icons/calender-icon.php'; ?> |
| 376 |
<span><?php echo $automation['enterance']; ?></span> |
| 377 |
</div> |
| 378 |
<div class="customers-count paused-customers"> |
| 379 |
<?php require WPFNL_DIR . '/admin/partials/icons/pause-icon.php'; ?> |
| 380 |
<span><?php echo $automation['processing']; ?></span> |
| 381 |
</div> |
| 382 |
<div class="customers-count completed-customers"> |
| 383 |
<?php require WPFNL_DIR . '/admin/partials/icons/automation-check-icon.php'; ?> |
| 384 |
<span><?php echo $automation['completed']; ?></span> |
| 385 |
</div> |
| 386 |
</div> |
| 387 |
<div class="list-cell wpfnl-status"> |
| 388 |
<span class="wpfnl-switcher extra-sm no-title"> |
| 389 |
<input type="checkbox" name="enable-log-status" id="enable-log-status-<?php echo $automation['id']; ?>" data-id="<?php echo esc_attr( $automation['id'] ); ?>" <?php echo ($automation['status'] === 'active') ? 'checked' : ''; ?>> |
| 390 |
<label for="enable-log-status-<?php echo $automation['id']; ?>"></label> |
| 391 |
</span> |
| 392 |
<span class="wpfnl-status-loader" style="color: #6E42D3; display:none;margin-left:6px;vertical-align:middle; position: absolute; top: 1px;"> |
| 393 |
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg" style="animation:wpfnl-spin 1s linear infinite;"> |
| 394 |
<circle cx="7" cy="7" r="6" stroke="currentColor" stroke-opacity="0.25" stroke-width="2"/> |
| 395 |
<path d="M13 7a6 6 0 01-6 6" stroke="currentColor" stroke-width="2" stroke-linecap="round"/> |
| 396 |
</svg> |
| 397 |
</span> |
| 398 |
</div> |
| 399 |
<div class="list-cell list-action"> |
| 400 |
<span class="more-action funnel-list__more-action"> |
| 401 |
<?php require WPFNL_DIR . '/admin/partials/icons/dot-icon.php'; ?> |
| 402 |
<ul class="more-actions wpfnl-dropdown"> |
| 403 |
<li> |
| 404 |
<a href="#" class="wpfnl-edit-automation edit" data-id="<?php echo esc_attr( $automation['id'] ); ?>"><?php echo __('Edit', 'wpfnl'); ?> |
| 405 |
</a> |
| 406 |
<a href="#" class="wpfnl-delete-automation delete" data-id="<?php echo esc_attr( $automation['id'] ); ?>"><?php echo __('Delete', 'wpfnl'); ?> |
| 407 |
</a> |
| 408 |
</li> |
| 409 |
</ul> |
| 410 |
</span> |
| 411 |
</div> |
| 412 |
</div> |
| 413 |
<?php endforeach; ?> |
| 414 |
|
| 415 |
<div class="list-footer"> |
| 416 |
<div class="pagination-number"> |
| 417 |
<p> |
| 418 |
<strong><?php echo __('Showing', 'wpfnl'); ?></strong> |
| 419 |
<select name="wpfnl_listing_page_offset" id="wpfnl_listing_page_offset"> |
| 420 |
<option value="10" <?php selected($per_page, 10); ?>>10</option> |
| 421 |
<option value="20" <?php selected($per_page, 20); ?>>20</option> |
| 422 |
<option value="30" <?php selected($per_page, 30); ?>>30</option> |
| 423 |
</select> |
| 424 |
<?php |
| 425 |
$start = ($current_page - 1) * $per_page + 1; |
| 426 |
$end = min($current_page * $per_page, $total); |
| 427 |
echo sprintf('%d-%d of %d items', $start, $end, $total); |
| 428 |
?> |
| 429 |
</p> |
| 430 |
</div> |
| 431 |
<div class="pagination"> |
| 432 |
<div class="wpfnl-pagination"> |
| 433 |
<?php |
| 434 |
$base_url = add_query_arg(array( |
| 435 |
'page' => 'wpfnl_automations', |
| 436 |
'per_page' => $per_page, |
| 437 |
), admin_url('admin.php')); |
| 438 |
|
| 439 |
// Previous button |
| 440 |
$prev_class = ($current_page <= 1) ? 'nav-link prev disabled' : 'nav-link prev'; |
| 441 |
$prev_url = ($current_page <= 1) ? '#' : add_query_arg('paged', $current_page - 1, $base_url); |
| 442 |
?> |
| 443 |
<a href="<?php echo esc_url($prev_url); ?>" class="<?php echo esc_attr($prev_class); ?>"> |
| 444 |
<svg width="12" height="12" fill="none" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg"><path fill="#7A8B9A" d="M6.002 12a.856.856 0 01-.609-.25L.25 6.586a.863.863 0 010-1.214L5.393.207a.855.855 0 011.415.62.863.863 0 01-.206.594L2.067 5.974l4.535 4.554a.862.862 0 01-.6 1.472z"/><path fill="#7A8B9A" d="M11.147 12a.856.856 0 01-.61-.25L5.395 6.586a.863.863 0 010-1.214L10.538.207a.855.855 0 011.414.62.862.862 0 01-.205.594L7.21 5.974l4.536 4.554a.862.862 0 01-.6 1.472z"/></svg> |
| 445 |
</a> |
| 446 |
<?php |
| 447 |
// Page numbers |
| 448 |
$range = 2; |
| 449 |
for ($i = 1; $i <= $total_pages; $i++) { |
| 450 |
if ($i == 1 || $i == $total_pages || ($i >= $current_page - $range && $i <= $current_page + $range)) { |
| 451 |
$active_class = ($i == $current_page) ? 'nav-link active' : 'nav-link'; |
| 452 |
$page_url = add_query_arg('paged', $i, $base_url); |
| 453 |
echo '<a href="' . esc_url($page_url) . '" class="' . esc_attr($active_class) . '">' . $i . '</a>'; |
| 454 |
} elseif ($i == $current_page - $range - 1 || $i == $current_page + $range + 1) { |
| 455 |
echo '<span class="nav-link dots">...</span>'; |
| 456 |
} |
| 457 |
} |
| 458 |
|
| 459 |
// Next button |
| 460 |
$next_class = ($current_page >= $total_pages) ? 'nav-link next disabled' : 'nav-link next'; |
| 461 |
$next_url = ($current_page >= $total_pages) ? '#' : add_query_arg('paged', $current_page + 1, $base_url); |
| 462 |
?> |
| 463 |
<a href="<?php echo esc_url($next_url); ?>" class="<?php echo esc_attr($next_class); ?>"> |
| 464 |
<svg width="12" height="12" fill="none" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg"><path fill="#7A8B9A" d="M5.998 12a.856.856 0 00.609-.25l5.144-5.164a.863.863 0 000-1.214L6.607.207a.855.855 0 00-1.415.62.863.863 0 00.206.594l4.535 4.553-4.535 4.554a.862.862 0 00.6 1.472z"/><path fill="#7A8B9A" d="M.853 12a.856.856 0 00.61-.25l5.143-5.164a.863.863 0 000-1.214L1.462.207a.855.855 0 00-1.414.62.863.863 0 00.205.594L4.79 5.974.253 10.528A.862.862 0 00.853 12z"/></svg> |
| 465 |
</a> |
| 466 |
</div> |
| 467 |
</div> |
| 468 |
</div> |
| 469 |
</div> |
| 470 |
|
| 471 |
|
| 472 |
<?php else: ?> |
| 473 |
<div class="wpfnl-funnel-automation-pro-settings-wrapper"> |
| 474 |
<div class="feature-content-wrapper"> |
| 475 |
<div class="feature-card-wrapper"> |
| 476 |
<div class="single-card"> |
| 477 |
<div class="card-icon"> |
| 478 |
<?php |
| 479 |
$svg_path = WPFNL_PATH . '/admin/assets/images/welcome-email.svg'; |
| 480 |
if (file_exists($svg_path)) { |
| 481 |
echo file_get_contents($svg_path); |
| 482 |
} |
| 483 |
?> |
| 484 |
</div> |
| 485 |
<h2 class="card-title">Opt-in Welcome Email</h2> |
| 486 |
<div class="logo-wrapper"> |
| 487 |
<img src="<?php echo esc_url( WPFNL_URL . 'admin/assets/images/automation-loader.png' ); ?>" alt="<?php esc_attr_e('Loader', 'wpfnl'); ?>"> |
| 488 |
</div> |
| 489 |
</div> |
| 490 |
|
| 491 |
<div class="single-card"> |
| 492 |
<div class="card-icon"> |
| 493 |
<?php |
| 494 |
$svg_path = WPFNL_PATH . '/admin/assets/images/login-notification.svg'; |
| 495 |
if (file_exists($svg_path)) { |
| 496 |
echo file_get_contents($svg_path); |
| 497 |
} |
| 498 |
?> |
| 499 |
</div> |
| 500 |
<h2 class="card-title">User Login Notification</h2> |
| 501 |
<div class="logo-wrapper"> |
| 502 |
<img src="<?php echo esc_url( WPFNL_URL . 'admin/assets/images/automation-loader.png' ); ?>" alt="<?php esc_attr_e('Loader', 'wpfnl'); ?>"> |
| 503 |
</div> |
| 504 |
</div> |
| 505 |
|
| 506 |
<div class="single-card"> |
| 507 |
<div class="card-icon"> |
| 508 |
<?php |
| 509 |
$svg_path = WPFNL_PATH . '/admin/assets/images/first-order-in-store.svg'; |
| 510 |
if (file_exists($svg_path)) { |
| 511 |
echo file_get_contents($svg_path); |
| 512 |
} |
| 513 |
?> |
| 514 |
</div> |
| 515 |
<h2 class="card-title">WC - First Order In Store</h2> |
| 516 |
<div class="logo-wrapper"> |
| 517 |
<img src="<?php echo esc_url( WPFNL_URL . 'admin/assets/images/automation-loader.png' ); ?>" alt="<?php esc_attr_e('Loader', 'wpfnl'); ?>"> |
| 518 |
</div> |
| 519 |
</div> |
| 520 |
|
| 521 |
<div class="single-card"> |
| 522 |
<div class="card-icon"> |
| 523 |
<?php |
| 524 |
$svg_path = WPFNL_PATH . '/admin/assets/images/new-user-welcome-email.svg'; |
| 525 |
if (file_exists($svg_path)) { |
| 526 |
echo file_get_contents($svg_path); |
| 527 |
} |
| 528 |
?> |
| 529 |
</div> |
| 530 |
<h2 class="card-title">New User Welcome Email</h2> |
| 531 |
<div class="logo-wrapper"> |
| 532 |
<img src="<?php echo esc_url( WPFNL_URL . 'admin/assets/images/automation-loader.png' ); ?>" alt="<?php esc_attr_e('Loader', 'wpfnl'); ?>"> |
| 533 |
</div> |
| 534 |
</div> |
| 535 |
</div> |
| 536 |
<div class="feature-text-wrapper"> |
| 537 |
<h2 class="feature-heading">Quick-start with ready-made recipes</h2> |
| 538 |
<p class="feature-des">Save time by importing and editing our ever-growing library of practical automation recipes to fit your needs</p> |
| 539 |
</div> |
| 540 |
</div> |
| 541 |
<!-- --> |
| 542 |
<div class="feature-content-wrapper"> |
| 543 |
<div class="feature-card-wrapper feature-card-img"> |
| 544 |
<img src="<?php echo esc_url( WPFNL_URL . 'admin/assets/images/build-automation.webp' ); ?>" alt="<?php esc_attr_e('Mail Mint logo', 'wpfnl'); ?>"> |
| 545 |
</div> |
| 546 |
<div class="feature-text-wrapper"> |
| 547 |
<h2 class="feature-heading">Build any automation you imagine</h2> |
| 548 |
<p class="feature-des">save time by importing and editing our ever-growing library of practical automation recipes to fit your needs</p> |
| 549 |
</div> |
| 550 |
</div> |
| 551 |
</div> |
| 552 |
<?php endif; ?> |
| 553 |
</div> |
| 554 |
</div> |
| 555 |
</div> |
| 556 |
</div> |
| 557 |
|
| 558 |
<script> |
| 559 |
jQuery(document).ready(function($) { |
| 560 |
// Handle per page dropdown change |
| 561 |
$('#wpfnl_listing_page_offset').on('change', function() { |
| 562 |
var perPage = $(this).val(); |
| 563 |
var currentUrl = new URL(window.location.href); |
| 564 |
currentUrl.searchParams.set('per_page', perPage); |
| 565 |
currentUrl.searchParams.set('paged', 1); // Reset to first page |
| 566 |
window.location.href = currentUrl.toString(); |
| 567 |
}); |
| 568 |
|
| 569 |
// wpfnl-admin.js calls e.stopPropagation() on every .wpfnl-dropdown click, |
| 570 |
// which prevents events from bubbling to document-level listeners. |
| 571 |
// Using direct element binding fires BEFORE stopPropagation is called on the |
| 572 |
// parent .wpfnl-dropdown element, so both Edit and Delete work correctly. |
| 573 |
|
| 574 |
// Handle automation name click - open the canvas editor |
| 575 |
document.querySelectorAll('.wpfnl-name .name').forEach(function(link) { |
| 576 |
link.addEventListener('click', function(e) { |
| 577 |
e.preventDefault(); |
| 578 |
e.stopPropagation(); |
| 579 |
var id = link.getAttribute('data-id'); |
| 580 |
if (typeof window.wpfnlOpenAutomationModal === 'function') { |
| 581 |
window.wpfnlOpenAutomationModal(id); |
| 582 |
} |
| 583 |
}); |
| 584 |
}); |
| 585 |
|
| 586 |
// Handle status toggle - PUT to REST API |
| 587 |
document.querySelectorAll('.wpfnl-status input[type="checkbox"]').forEach(function(checkbox) { |
| 588 |
checkbox.addEventListener('change', function() { |
| 589 |
var automationId = checkbox.getAttribute('data-id'); |
| 590 |
var newStatus = checkbox.checked ? 'active' : 'pause'; |
| 591 |
var restUrl = wpfnlAutomationVars.restUrl + 'wpfunnels/v1/automation-canvas/' + automationId; |
| 592 |
var loader = checkbox.closest('.list-cell.wpfnl-status').querySelector('.wpfnl-status-loader'); |
| 593 |
|
| 594 |
checkbox.disabled = true; |
| 595 |
loader.style.display = 'inline-block'; |
| 596 |
|
| 597 |
$.ajax({ |
| 598 |
url: restUrl, |
| 599 |
type: 'PUT', |
| 600 |
contentType: 'application/json', |
| 601 |
data: JSON.stringify({ status: newStatus }), |
| 602 |
beforeSend: function(xhr) { |
| 603 |
xhr.setRequestHeader('X-WP-Nonce', wpfnlAutomationVars.restNonce); |
| 604 |
}, |
| 605 |
success: function() { |
| 606 |
checkbox.disabled = false; |
| 607 |
loader.style.display = 'none'; |
| 608 |
}, |
| 609 |
error: function() { |
| 610 |
checkbox.checked = !checkbox.checked; // revert |
| 611 |
checkbox.disabled = false; |
| 612 |
loader.style.display = 'none'; |
| 613 |
alert('Failed to update automation status. Please try again.'); |
| 614 |
} |
| 615 |
}); |
| 616 |
}); |
| 617 |
}); |
| 618 |
|
| 619 |
// Keyframe animation for the status loader spinner (injected once) |
| 620 |
if (!document.getElementById('wpfnl-spin-style')) { |
| 621 |
var style = document.createElement('style'); |
| 622 |
style.id = 'wpfnl-spin-style'; |
| 623 |
style.textContent = '@keyframes wpfnl-spin { to { transform: rotate(360deg); } }'; |
| 624 |
document.head.appendChild(style); |
| 625 |
} |
| 626 |
|
| 627 |
// Handle edit automation - open the React modal via the exposed global |
| 628 |
document.querySelectorAll('.wpfnl-edit-automation').forEach(function(btn) { |
| 629 |
btn.addEventListener('click', function(e) { |
| 630 |
e.preventDefault(); |
| 631 |
e.stopPropagation(); |
| 632 |
btn.closest('.funnel-list__more-action').classList.remove('show-actions'); |
| 633 |
var id = btn.getAttribute('data-id'); |
| 634 |
if (typeof window.wpfnlOpenAutomationModal === 'function') { |
| 635 |
window.wpfnlOpenAutomationModal(id); |
| 636 |
} |
| 637 |
}); |
| 638 |
}); |
| 639 |
|
| 640 |
// Handle delete automation - direct REST API call |
| 641 |
document.querySelectorAll('.wpfnl-delete-automation').forEach(function(btn) { |
| 642 |
btn.addEventListener('click', function(e) { |
| 643 |
e.preventDefault(); |
| 644 |
e.stopPropagation(); |
| 645 |
btn.closest('.funnel-list__more-action').classList.remove('show-actions'); |
| 646 |
|
| 647 |
var automationId = btn.getAttribute('data-id'); |
| 648 |
|
| 649 |
if ( ! confirm('Are you sure you want to delete this automation? This action cannot be undone.') ) { |
| 650 |
return; |
| 651 |
} |
| 652 |
|
| 653 |
var restUrl = wpfnlAutomationVars.restUrl + 'wpfunnels/v1/automation-canvas/' + automationId; |
| 654 |
var row = btn.closest('.funnel__single-list'); |
| 655 |
row.style.opacity = '0.5'; |
| 656 |
|
| 657 |
$.ajax({ |
| 658 |
url: restUrl, |
| 659 |
type: 'DELETE', |
| 660 |
beforeSend: function(xhr) { |
| 661 |
xhr.setRequestHeader('X-WP-Nonce', wpfnlAutomationVars.restNonce); |
| 662 |
}, |
| 663 |
success: function() { |
| 664 |
location.reload(); |
| 665 |
}, |
| 666 |
error: function() { |
| 667 |
row.style.opacity = '1'; |
| 668 |
alert('Failed to delete automation. Please try again.'); |
| 669 |
} |
| 670 |
}); |
| 671 |
}); |
| 672 |
}); |
| 673 |
|
| 674 |
// Bulk action: counter + show/hide wrapper (mirrors funnel listing pattern) |
| 675 |
function automationSelectedCounter() { |
| 676 |
var total = $('input[name=automation-list-select]:checked').length; |
| 677 |
if (total > 0) { |
| 678 |
var label = total > 1 ? total + ' Automations' : total + ' Automation'; |
| 679 |
$('.funnel__single-list.list-header .bulk-action-wrapper .selected-funnel-count').text(label); |
| 680 |
$('.funnel__single-list.list-header .bulk-action-wrapper').css('display', 'flex'); |
| 681 |
} else { |
| 682 |
$('.funnel__single-list.list-header .bulk-action-wrapper').css('display', 'none'); |
| 683 |
} |
| 684 |
} |
| 685 |
|
| 686 |
// Per-row checkbox change |
| 687 |
$('.funnel__single-list.list-body input[name=automation-list-select]').on('change', function() { |
| 688 |
$('#automation-list__bulk-select').prop('checked', false); |
| 689 |
automationSelectedCounter(); |
| 690 |
}); |
| 691 |
|
| 692 |
// Select-all checkbox change |
| 693 |
$('#automation-list__bulk-select').on('change', function() { |
| 694 |
if ($(this).is(':checked')) { |
| 695 |
$('input[name=automation-list-select]').prop('checked', true); |
| 696 |
automationSelectedCounter(); |
| 697 |
} else { |
| 698 |
$('.funnel__single-list.list-header .bulk-action-wrapper').css('display', 'none'); |
| 699 |
$('input[name=automation-list-select]').prop('checked', false); |
| 700 |
} |
| 701 |
}); |
| 702 |
|
| 703 |
// Bulk delete (from dropdown) |
| 704 |
$(document).on('click', '.wpfnl-automation-bulk-delete', function(e) { |
| 705 |
e.preventDefault(); |
| 706 |
e.stopPropagation(); |
| 707 |
$('.bulk-delete-toggler').removeClass('show-dropdown'); |
| 708 |
|
| 709 |
var checked = $('input[name=automation-list-select]:checked'); |
| 710 |
if (checked.length === 0) return; |
| 711 |
|
| 712 |
if ( ! confirm('Are you sure you want to delete ' + checked.length + ' automation(s)? This action cannot be undone.') ) { |
| 713 |
return; |
| 714 |
} |
| 715 |
|
| 716 |
var ids = []; |
| 717 |
checked.each(function() { ids.push($(this).data('id')); }); |
| 718 |
|
| 719 |
var remaining = ids.length; |
| 720 |
var failed = 0; |
| 721 |
|
| 722 |
$.each(ids, function(i, automationId) { |
| 723 |
var row = $('input[name=automation-list-select][data-id="' + automationId + '"]').closest('.funnel__single-list'); |
| 724 |
row.css('opacity', '0.5'); |
| 725 |
|
| 726 |
$.ajax({ |
| 727 |
url: wpfnlAutomationVars.restUrl + 'wpfunnels/v1/automation-canvas/' + automationId, |
| 728 |
type: 'DELETE', |
| 729 |
beforeSend: function(xhr) { |
| 730 |
xhr.setRequestHeader('X-WP-Nonce', wpfnlAutomationVars.restNonce); |
| 731 |
}, |
| 732 |
success: function() { |
| 733 |
row.remove(); |
| 734 |
}, |
| 735 |
error: function() { |
| 736 |
row.css('opacity', '1'); |
| 737 |
failed++; |
| 738 |
}, |
| 739 |
complete: function() { |
| 740 |
remaining--; |
| 741 |
if (remaining === 0) { |
| 742 |
if (failed > 0) { |
| 743 |
alert(failed + ' automation(s) could not be deleted. Please try again.'); |
| 744 |
} |
| 745 |
location.reload(); |
| 746 |
} |
| 747 |
} |
| 748 |
}); |
| 749 |
}); |
| 750 |
}); |
| 751 |
}); |
| 752 |
</script> |
| 753 |
|
| 754 |
<?php endif; ?> |
| 755 |
|
| 756 |
<!-- Automation Canvas Root --> |
| 757 |
<div id="wpfnl-automation-canvas-root"></div> |
| 758 |
|