| @@ -2,19 +2,19 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace Give\Promotions; |
| 4 | 4 | |
| 5 | 5 | use Give\Helpers\Hooks; |
| 6 | +use Give\Promotions\BFCM\BFCM2025; | |
| 7 | +use Give\Promotions\Campaigns\CampaignsWelcomeBanner; | |
| 6 | 8 | use Give\Promotions\FreeAddonModal\Controllers\CompleteRestApiEndpoint; |
| 7 | -use Give\Promotions\FreeAddonModal\Controllers\DisplaySettingsButton; | |
| 8 | -use Give\Promotions\FreeAddonModal\Controllers\EnqueueModal; | |
| 9 | -use Give\Promotions\FreeAddonModal\Controllers\PreventFreshInstallPromotion; | |
| 10 | 9 | use Give\Promotions\InPluginUpsells\AddonsAdminPage; |
| 11 | 10 | use Give\Promotions\InPluginUpsells\Endpoints\HideSaleBannerRoute; |
| 12 | 11 | use Give\Promotions\InPluginUpsells\Endpoints\ProductRecommendationsRoute; |
| 13 | 12 | use Give\Promotions\InPluginUpsells\LegacyFormEditor; |
| 14 | 13 | use Give\Promotions\InPluginUpsells\PaymentGateways; |
| 15 | -use Give\Promotions\InPluginUpsells\RecurringDonationsTab; | |
| 16 | -use Give\Promotions\InPluginUpsells\SaleBanners; | |
| 14 | +use Give\Promotions\InPluginUpsells\StellarSaleBanners; | |
| 15 | +use Give\Promotions\ReportsWidgetBanner\ReportsWidgetBanner; | |
| 16 | +use Give\Promotions\WelcomeBanner\Endpoints\DismissWelcomeBannerRoute; | |
| 17 | 17 | use Give\ServiceProviders\ServiceProvider as ServiceProviderContract; |
| 18 | 18 | |
| 19 | 19 | class ServiceProvider implements ServiceProviderContract |
| 20 | 20 | { |
| @@ -38,13 +38,16 @@ | ||
| 38 | 38 | $this->bootFreeAddonModal(); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | + * @since 4.3.0 refactor to add conditional scripts inside admin_enqueue_scripts hook | |
| 43 | + * @since 4.0.0 add CampaignWelcomeBanner | |
| 44 | + * @since 3.13.0 add Stellar banner. | |
| 42 | 45 | * @since 2.27.1 Removed Recurring donations tab app. |
| 46 | + * @since 2.19.0 | |
| 43 | 47 | * |
| 44 | 48 | * Boots the Plugin Upsell promotional page |
| 45 | 49 | * |
| 46 | - * @since 2.19.0 | |
| 47 | 50 | */ |
| 48 | 51 | private function bootPluginUpsells() |
| 49 | 52 | { |
| 50 | 53 | Hooks::addAction('admin_menu', AddonsAdminPage::class, 'register', 70); |
| @@ -49,35 +52,42 @@ | ||
| 49 | 52 | { |
| 50 | 53 | Hooks::addAction('admin_menu', AddonsAdminPage::class, 'register', 70); |
| 51 | 54 | Hooks::addAction('rest_api_init', HideSaleBannerRoute::class, 'registerRoute'); |
| 52 | 55 | Hooks::addAction('rest_api_init', ProductRecommendationsRoute::class, 'registerRoute'); |
| 56 | + Hooks::addAction('rest_api_init', DismissWelcomeBannerRoute::class, 'registerRoute'); | |
| 53 | 57 | |
| 54 | - if (AddonsAdminPage::isShowing()) { | |
| 55 | - Hooks::addAction('admin_enqueue_scripts', AddonsAdminPage::class, 'loadScripts'); | |
| 56 | - } | |
| 58 | + add_action('admin_enqueue_scripts', static function (){ | |
| 59 | + if (ReportsWidgetBanner::isShowing()) { | |
| 60 | + give(ReportsWidgetBanner::class)->loadScripts(); | |
| 61 | + } | |
| 57 | 62 | |
| 58 | - if (SaleBanners::isShowing()) { | |
| 59 | - Hooks::addAction('admin_notices', SaleBanners::class, 'render'); | |
| 60 | - Hooks::addAction('admin_enqueue_scripts', SaleBanners::class, 'loadScripts'); | |
| 61 | - } | |
| 63 | + if (AddonsAdminPage::isShowing()) { | |
| 64 | + give(AddonsAdminPage::class)->loadScripts(); | |
| 65 | + } | |
| 62 | 66 | |
| 63 | - if (PaymentGateways::isShowing()) { | |
| 64 | - Hooks::addAction('admin_enqueue_scripts', PaymentGateways::class, 'loadScripts'); | |
| 65 | - Hooks::addAction( | |
| 66 | - 'give_admin_field_enabled_gateways', | |
| 67 | - PaymentGateways::class, | |
| 68 | - 'renderPaymentGatewayRecommendation' | |
| 69 | - ); | |
| 70 | - } | |
| 67 | + if (PaymentGateways::isShowing()) { | |
| 68 | + give(PaymentGateways::class)->loadScripts(); | |
| 69 | + } | |
| 71 | 70 | |
| 72 | - if (LegacyFormEditor::isShowing()) { | |
| 73 | - Hooks::addAction('admin_enqueue_scripts', LegacyFormEditor::class, 'loadScripts'); | |
| 74 | - Hooks::addAction( | |
| 75 | - 'give_post_form_field_options_settings', | |
| 76 | - LegacyFormEditor::class, | |
| 77 | - 'renderDonationOptionsRecurringRecommendation' | |
| 78 | - ); | |
| 79 | - } | |
| 71 | + if (LegacyFormEditor::isShowing()) { | |
| 72 | + give(LegacyFormEditor::class)->loadScripts(); | |
| 73 | + } | |
| 74 | + }); | |
| 75 | + | |
| 76 | + Hooks::addAction( | |
| 77 | + 'give_admin_field_enabled_gateways', | |
| 78 | + PaymentGateways::class, | |
| 79 | + 'renderPaymentGatewayRecommendation' | |
| 80 | + ); | |
| 81 | + | |
| 82 | + Hooks::addAction( | |
| 83 | + 'give_post_form_field_options_settings', | |
| 84 | + LegacyFormEditor::class, | |
| 85 | + 'renderDonationOptionsRecurringRecommendation' | |
| 86 | + ); | |
| 87 | + | |
| 88 | + Hooks::addAction('admin_init', CampaignsWelcomeBanner::class); | |
| 89 | + Hooks::addAction('admin_init', BFCM2025::class); | |
| 80 | 90 | } |
| 81 | 91 | |
| 82 | 92 | /** |
| 83 | 93 | * Boots the free addon modal promotion |