| @@ -99,8 +99,12 @@ | ||
| 99 | 99 | 'nonce' => wp_create_nonce( 'subscrpt_integration_install_nonce' ), |
| 100 | 100 | 'ajaxUrl' => admin_url( 'admin-ajax.php' ), |
| 101 | 101 | ) |
| 102 | 102 | ); |
| 103 | + | |
| 104 | + // Browser-side filter rail. Enqueued on this hook, not in the render | |
| 105 | + // callback, so it always loads. | |
| 106 | + wp_enqueue_script( 'subscrpt-integrations-filter', SUBSCRPT_ASSETS . '/js/admin/integrations-filter.js', [], SUBSCRPT_VERSION, true ); | |
| 103 | 107 | } |
| 104 | 108 | |
| 105 | 109 | /** |
| 106 | 110 | * Handle AJAX request for integrations. |
| @@ -237,9 +241,9 @@ | ||
| 237 | 241 | ], |
| 238 | 242 | 'stripe' => [ |
| 239 | 243 | 'title' => 'Stripe', |
| 240 | 244 | 'description' => 'Process subscription payments securely with Stripe.', |
| 241 | - 'icon_url' => 'https://ps.w.org/woocommerce-gateway-stripe/assets/icon-256x256.png', | |
| 245 | + 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/stripe.png', | |
| 242 | 246 | 'type' => 'payment_gateway', |
| 243 | 247 | 'is_installed' => class_exists( 'WC_Stripe' ), |
| 244 | 248 | 'is_active' => self::is_gateway_enabled( 'stripe' ), |
| 245 | 249 | 'supports_recurring' => true, |
| @@ -389,9 +393,9 @@ | ||
| 389 | 393 | // LMS. |
| 390 | 394 | 'tutor_lms' => [ |
| 391 | 395 | 'title' => 'Tutor LMS', |
| 392 | 396 | 'description' => 'Restrict course access based on subscription status. Enroll and unenroll students automatically.', |
| 393 | - 'icon_url' => 'https://ps.w.org/tutor/assets/icon-256x256.gif', | |
| 397 | + 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/tutor-lms.jpeg', | |
| 394 | 398 | 'type' => 'third_party', |
| 395 | 399 | 'is_pro' => true, |
| 396 | 400 | 'category' => 'lms', |
| 397 | 401 | 'is_installed' => is_plugin_active( 'tutor/tutor.php' ) && class_exists( 'TUTOR\Tutor' ), |
| @@ -412,9 +416,9 @@ | ||
| 412 | 416 | ], |
| 413 | 417 | 'learnpress' => [ |
| 414 | 418 | 'title' => 'LearnPress', |
| 415 | 419 | 'description' => 'Connect subscriptions with LearnPress courses. Enroll users automatically when subscriptions are active.', |
| 416 | - 'icon_url' => 'https://ps.w.org/learnpress/assets/icon-256x256.gif', | |
| 420 | + 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/learnpress.png', | |
| 417 | 421 | 'type' => 'third_party', |
| 418 | 422 | 'is_pro' => true, |
| 419 | 423 | 'category' => 'lms', |
| 420 | 424 | 'is_installed' => is_plugin_active( 'learnpress/learnpress.php' ) && class_exists( 'LearnPress' ), |
| @@ -459,9 +463,9 @@ | ||
| 459 | 463 | // CRM. |
| 460 | 464 | 'fluentcrm' => [ |
| 461 | 465 | 'title' => 'FluentCRM', |
| 462 | 466 | 'description' => 'Trigger email sequences and manage contacts based on subscription events and status changes.', |
| 463 | - 'icon_url' => 'https://ps.w.org/fluent-crm/assets/icon-256x256.png', | |
| 467 | + 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/fluentcrm.png', | |
| 464 | 468 | 'type' => 'third_party', |
| 465 | 469 | 'is_pro' => true, |
| 466 | 470 | 'category' => 'crm', |
| 467 | 471 | 'is_installed' => class_exists( 'FluentCrm\App\Services\Funnel\BaseTrigger' ), |
| @@ -483,9 +487,9 @@ | ||
| 483 | 487 | // Automation. |
| 484 | 488 | 'automatorwp' => [ |
| 485 | 489 | 'title' => 'AutomatorWP', |
| 486 | 490 | 'description' => 'Build powerful automations triggered by subscription events without writing any code.', |
| 487 | - 'icon_url' => 'https://ps.w.org/automatorwp/assets/icon-256x256.png', | |
| 491 | + 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/automatorwp.png', | |
| 488 | 492 | 'type' => 'third_party', |
| 489 | 493 | 'is_pro' => true, |
| 490 | 494 | 'category' => 'automation', |
| 491 | 495 | 'is_installed' => is_plugin_active( 'automatorwp/automatorwp.php' ) && class_exists( 'AutomatorWP' ), |
| @@ -506,9 +510,9 @@ | ||
| 506 | 510 | ], |
| 507 | 511 | 'wpfusion' => [ |
| 508 | 512 | 'title' => 'WP Fusion', |
| 509 | 513 | 'description' => 'Sync subscription data with your CRM and marketing platforms through WP Fusion.', |
| 510 | - 'icon_url' => 'https://ps.w.org/wp-fusion-lite/assets/icon-256x256.png', | |
| 514 | + 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/wp-fusion.png', | |
| 511 | 515 | 'type' => 'third_party', |
| 512 | 516 | 'is_pro' => true, |
| 513 | 517 | 'category' => 'automation', |
| 514 | 518 | 'is_installed' => class_exists( 'WPF_Integrations_Base' ), |
| @@ -530,9 +534,9 @@ | ||
| 530 | 534 | // Email Marketing. |
| 531 | 535 | 'mailpoet' => [ |
| 532 | 536 | 'title' => 'MailPoet', |
| 533 | 537 | 'description' => 'Add subscribers to MailPoet lists and trigger email automations based on subscription lifecycle events.', |
| 534 | - 'icon_url' => 'https://ps.w.org/mailpoet/assets/icon-256x256.png', | |
| 538 | + 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/mailpoet.png', | |
| 535 | 539 | 'type' => 'third_party', |
| 536 | 540 | 'is_pro' => true, |
| 537 | 541 | 'category' => 'email', |
| 538 | 542 | 'is_installed' => is_plugin_active( 'mailpoet/mailpoet.php' ) || is_plugin_active( 'mailpoet-premium/mailpoet-premium.php' ), |
| @@ -577,9 +581,9 @@ | ||
| 577 | 581 | ], |
| 578 | 582 | 'license_mgr' => [ |
| 579 | 583 | 'title' => 'License Manager for WooCommerce', |
| 580 | 584 | 'description' => 'Generate and manage software license keys that are automatically tied to active subscriptions.', |
| 581 | - 'icon_url' => 'https://ps.w.org/license-manager-for-woocommerce/assets/icon-256x256.gif', | |
| 585 | + 'icon_url' => SUBSCRPT_ASSETS . '/images/integrations/license-manager.png', | |
| 582 | 586 | 'type' => 'third_party', |
| 583 | 587 | 'is_pro' => true, |
| 584 | 588 | 'category' => 'license', |
| 585 | 589 | 'is_installed' => is_plugin_active( 'license-manager-for-woocommerce/license-manager-for-woocommerce.php' ) && class_exists( 'LicenseManagerForWooCommerce\Models\Resources\License' ), |
| @@ -618,9 +622,10 @@ | ||
| 618 | 622 | foreach ( $integrations as $integration ) { |
| 619 | 623 | $is_installed = $integration['is_installed'] ?? false; |
| 620 | 624 | $is_active = $integration['is_active'] ?? false; |
| 621 | 625 | |
| 622 | - $cleaned_actions = []; | |
| 626 | + $cleaned_actions = []; | |
| 627 | + $shown_install_url = null; | |
| 623 | 628 | |
| 624 | 629 | foreach ( $integration['actions'] as $integration_action ) { |
| 625 | 630 | $action_tag = $integration_action['action'] ?? null; |
| 626 | 631 | |
| @@ -626,8 +631,9 @@ | ||
| 626 | 631 | |
| 627 | 632 | if ( 'install' === $action_tag ) { |
| 628 | 633 | if ( ! $is_installed ) { |
| 629 | 634 | $cleaned_actions[] = $integration_action; |
| 635 | + $shown_install_url = $integration_action['url'] ?? null; | |
| 630 | 636 | } |
| 631 | 637 | continue; |
| 632 | 638 | } |
| 633 | 639 | if ( 'uninstall' === $action_tag ) { |
| @@ -648,9 +654,14 @@ | ||
| 648 | 654 | } |
| 649 | 655 | continue; |
| 650 | 656 | } |
| 651 | 657 | |
| 652 | - // Default. | |
| 658 | + // Default. Skip a "More Details"-style link that just repeats the | |
| 659 | + // install/"Get X" link already shown (e.g. Paddle), so the card | |
| 660 | + // does not carry the same URL twice. | |
| 661 | + if ( null !== $shown_install_url && ( $integration_action['url'] ?? null ) === $shown_install_url ) { | |
| 662 | + continue; | |
| 663 | + } | |
| 653 | 664 | $cleaned_actions[] = $integration_action; |
| 654 | 665 | } |
| 655 | 666 | |
| 656 | 667 | // Overwrite. |
| @@ -666,11 +677,8 @@ | ||
| 666 | 677 | */ |
| 667 | 678 | public function render_integrations_page() { |
| 668 | 679 | $integrations = $this->integrations; |
| 669 | 680 | $integrations = $this->filter_integration_actions( $integrations ); |
| 670 | - | |
| 671 | - // Integrations styles. | |
| 672 | - // wp_enqueue_style( 'wp-subs-integration-settings', SUBSCRPT_ASSETS . '/css/integration_settings.css', [], SUBSCRPT_VERSION, 'all' ); | |
| 673 | 681 | |
| 674 | 682 | $menu = new \SpringDevs\Subscription\Admin\Menu(); |
| 675 | 683 | $menu->render_admin_header( __( 'Integrations', 'subscription' ) ); |
| 676 | 684 | include 'views/integrations.php'; |