From 8dcfc790a1e44c5e16078c7eb1f64eb7d792acee Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Thu, 17 Oct 2024 18:34:56 +0530 Subject: [PATCH 1/3] Missed Changes --- .../WPAdmin/Listeners/DataAttrListener.php | 51 ------------------- .../WPAdmin/Listeners/InstallerListener.php | 40 +++++++++++++-- includes/WPAdmin/WPAdmin.php | 2 - src/Installer/components/Modal/index.jsx | 13 +++-- 4 files changed, 45 insertions(+), 61 deletions(-) delete mode 100644 includes/WPAdmin/Listeners/DataAttrListener.php diff --git a/includes/WPAdmin/Listeners/DataAttrListener.php b/includes/WPAdmin/Listeners/DataAttrListener.php deleted file mode 100644 index 3c46bc1..0000000 --- a/includes/WPAdmin/Listeners/DataAttrListener.php +++ /dev/null @@ -1,51 +0,0 @@ - \get_home_url() . '/index.php?rest_route=', - 'pluginInstallHash' => PluginInstaller::rest_get_plugin_install_hash(), - ) - ) . ';', - 'before' - ); - - wp_enqueue_script( 'nfd-installer-data-attr-listener' ); - } - } -} \ No newline at end of file diff --git a/includes/WPAdmin/Listeners/InstallerListener.php b/includes/WPAdmin/Listeners/InstallerListener.php index 95718e5..6dfad88 100644 --- a/includes/WPAdmin/Listeners/InstallerListener.php +++ b/includes/WPAdmin/Listeners/InstallerListener.php @@ -15,18 +15,52 @@ class InstallerListener { */ public function __construct() { // Hook to enqueue installer scripts - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_installer_script' ) ); + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_installer_scripts' ) ); // Hook to listen to premium plugin activation $this->listen_for_premium_plugin_activation(); } /** - * Enqueues the installer script. + * Enqueues all the installer scripts that are required. * * @return void */ - public function enqueue_installer_script() { + public function enqueue_installer_scripts() { + $this->enqueue_data_attr_listener(); + $this->enqueue_installer_react_script(); + } + + + /** + * Enqueues the data-* attribute listener script. + * + * @return void + */ + public function enqueue_data_attr_listener() { + $asset_file = NFD_INSTALLER_BUILD_DIR . '/dataAttrListener.asset.php'; + + if ( is_readable( $asset_file ) ) { + $asset = include $asset_file; + + wp_register_script( + 'nfd-installer-data-attr-listener', + NFD_INSTALLER_BUILD_URL . '/dataAttrListener.js', + array_merge( $asset['dependencies'], array() ), + $asset['version'], + true + ); + + wp_enqueue_script( 'nfd-installer-data-attr-listener' ); + } + } + + /** + * Enqueues the installer react scripts. + * + * @return void + */ + public function enqueue_installer_react_script() { $asset_file = NFD_INSTALLER_BUILD_DIR . '/installer.asset.php'; if ( is_readable( $asset_file ) ) { diff --git a/includes/WPAdmin/WPAdmin.php b/includes/WPAdmin/WPAdmin.php index f85c4aa..8169d75 100644 --- a/includes/WPAdmin/WPAdmin.php +++ b/includes/WPAdmin/WPAdmin.php @@ -2,7 +2,6 @@ namespace NewfoldLabs\WP\Module\Installer\WPAdmin; -use NewfoldLabs\WP\Module\Installer\WPAdmin\Listeners\DataAttrListener; use NewfoldLabs\WP\Module\Installer\WPAdmin\Listeners\InstallerListener; /** @@ -13,7 +12,6 @@ class WPAdmin { * Constructor for the WPAdmin class. */ public function __construct() { - new DataAttrListener(); new InstallerListener(); } } diff --git a/src/Installer/components/Modal/index.jsx b/src/Installer/components/Modal/index.jsx index 0890762..59177bb 100644 --- a/src/Installer/components/Modal/index.jsx +++ b/src/Installer/components/Modal/index.jsx @@ -1,7 +1,6 @@ // External Imports import apiFetch from '@wordpress/api-fetch'; import { __, sprintf } from '@wordpress/i18n'; -import { Icon, info } from '@wordpress/icons'; import { createInterpolateElement, useRef, @@ -10,7 +9,7 @@ import { } from '@wordpress/element'; // Internal Imports -import { loadingInstaller } from '../../static/icons/index'; +import { errorIcon, loadingInstaller } from '../../static/icons/index'; import { INSTALLER_DIV, installerAPI, @@ -160,7 +159,7 @@ const Modal = ( { { sprintf( /* translators: %s: Plugin Name */ __( - 'Activating… %s', + 'Activating the %s', 'wp-module-onboarding' ), pluginName @@ -171,9 +170,13 @@ const Modal = ( { ) } { pluginStatus === 'failed' && (
-
{ errorMessage }
From e2ac73d1fc891224576c5692bd4b0e01de495ebd Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Thu, 17 Oct 2024 18:37:14 +0530 Subject: [PATCH 2/3] Revert "Missed Changes" This reverts commit 8dcfc790a1e44c5e16078c7eb1f64eb7d792acee. --- .../WPAdmin/Listeners/DataAttrListener.php | 51 +++++++++++++++++++ .../WPAdmin/Listeners/InstallerListener.php | 40 ++------------- includes/WPAdmin/WPAdmin.php | 2 + 3 files changed, 56 insertions(+), 37 deletions(-) create mode 100644 includes/WPAdmin/Listeners/DataAttrListener.php diff --git a/includes/WPAdmin/Listeners/DataAttrListener.php b/includes/WPAdmin/Listeners/DataAttrListener.php new file mode 100644 index 0000000..3c46bc1 --- /dev/null +++ b/includes/WPAdmin/Listeners/DataAttrListener.php @@ -0,0 +1,51 @@ + \get_home_url() . '/index.php?rest_route=', + 'pluginInstallHash' => PluginInstaller::rest_get_plugin_install_hash(), + ) + ) . ';', + 'before' + ); + + wp_enqueue_script( 'nfd-installer-data-attr-listener' ); + } + } +} \ No newline at end of file diff --git a/includes/WPAdmin/Listeners/InstallerListener.php b/includes/WPAdmin/Listeners/InstallerListener.php index 6dfad88..95718e5 100644 --- a/includes/WPAdmin/Listeners/InstallerListener.php +++ b/includes/WPAdmin/Listeners/InstallerListener.php @@ -15,52 +15,18 @@ class InstallerListener { */ public function __construct() { // Hook to enqueue installer scripts - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_installer_scripts' ) ); + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_installer_script' ) ); // Hook to listen to premium plugin activation $this->listen_for_premium_plugin_activation(); } /** - * Enqueues all the installer scripts that are required. + * Enqueues the installer script. * * @return void */ - public function enqueue_installer_scripts() { - $this->enqueue_data_attr_listener(); - $this->enqueue_installer_react_script(); - } - - - /** - * Enqueues the data-* attribute listener script. - * - * @return void - */ - public function enqueue_data_attr_listener() { - $asset_file = NFD_INSTALLER_BUILD_DIR . '/dataAttrListener.asset.php'; - - if ( is_readable( $asset_file ) ) { - $asset = include $asset_file; - - wp_register_script( - 'nfd-installer-data-attr-listener', - NFD_INSTALLER_BUILD_URL . '/dataAttrListener.js', - array_merge( $asset['dependencies'], array() ), - $asset['version'], - true - ); - - wp_enqueue_script( 'nfd-installer-data-attr-listener' ); - } - } - - /** - * Enqueues the installer react scripts. - * - * @return void - */ - public function enqueue_installer_react_script() { + public function enqueue_installer_script() { $asset_file = NFD_INSTALLER_BUILD_DIR . '/installer.asset.php'; if ( is_readable( $asset_file ) ) { diff --git a/includes/WPAdmin/WPAdmin.php b/includes/WPAdmin/WPAdmin.php index 8169d75..f85c4aa 100644 --- a/includes/WPAdmin/WPAdmin.php +++ b/includes/WPAdmin/WPAdmin.php @@ -2,6 +2,7 @@ namespace NewfoldLabs\WP\Module\Installer\WPAdmin; +use NewfoldLabs\WP\Module\Installer\WPAdmin\Listeners\DataAttrListener; use NewfoldLabs\WP\Module\Installer\WPAdmin\Listeners\InstallerListener; /** @@ -12,6 +13,7 @@ class WPAdmin { * Constructor for the WPAdmin class. */ public function __construct() { + new DataAttrListener(); new InstallerListener(); } } From ebe2643d70b967345b96f8f60ef98ecc009d034e Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Thu, 17 Oct 2024 18:39:20 +0530 Subject: [PATCH 3/3] Update DataAttrListener.php --- includes/WPAdmin/Listeners/DataAttrListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/WPAdmin/Listeners/DataAttrListener.php b/includes/WPAdmin/Listeners/DataAttrListener.php index 3c46bc1..6a21634 100644 --- a/includes/WPAdmin/Listeners/DataAttrListener.php +++ b/includes/WPAdmin/Listeners/DataAttrListener.php @@ -48,4 +48,4 @@ public function enqueue_data_attr_listener() { wp_enqueue_script( 'nfd-installer-data-attr-listener' ); } } -} \ No newline at end of file +}