Merge pull request #3595 from woocommerce/PCP-4966-phase-2-change-banner-text
Some checks are pending
CI / PHP 7.4 (push) Waiting to run
CI / PHP 8.0 (push) Waiting to run
CI / PHP 8.1 (push) Waiting to run
CI / PHP 8.2 (push) Waiting to run
CI / PHP 8.3 (push) Waiting to run
CI / PHP 8.4 (push) Waiting to run
PR Playground Demo / prepare_version (push) Waiting to run
PR Playground Demo / build_plugin (push) Blocked by required conditions
PR Playground Demo / create_archive (push) Blocked by required conditions
PR Playground Demo / Comment on PR with Playground details (push) Blocked by required conditions

Phase 2: Settings Migration - Change banner text
This commit is contained in:
Emili Castells 2025-08-18 17:22:30 +02:00 committed by GitHub
commit 6b84fa00f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 6 deletions

View file

@ -3,7 +3,9 @@ document.addEventListener( 'DOMContentLoaded', () => {
const button = document.querySelector(
'.button.button-settings-switch-ui'
);
const link = document.querySelector( 'a.settings-switch-ui' );
const link = document.querySelector(
'.ppcp-notice-wrapper:not(.inline) a.settings-switch-ui'
);
if ( typeof config === 'undefined' || ( ! button && ! link ) ) {
return;
@ -45,7 +47,10 @@ document.addEventListener( 'DOMContentLoaded', () => {
button.addEventListener( 'click', handleClick );
}
if ( link ) {
link.addEventListener( 'click', handleClick );
}
document.addEventListener( 'click', ( event ) => {
const linkElement = event.target.closest( 'a.settings-switch-ui' );
if ( linkElement ) {
handleClick( event );
}
} );
} );

View file

@ -107,7 +107,7 @@ class SettingsModule implements ServiceModule, ExecutableModule {
'woocommerce_paypal_payments_inside_settings_page_header',
static fn() : string => sprintf(
'<button type="button" class="button button-settings-switch-ui" aria-describedby="switch-ui-desc">%s</button><span id="switch-ui-desc" class="screen-reader-text">%s</span>',
esc_html__( 'Switch to new settings UI', 'woocommerce-paypal-payments' ),
esc_html__( 'Switch to New Settings', 'woocommerce-paypal-payments' ),
esc_html__( 'This action will permanently switch to the new settings interface and cannot be undone', 'woocommerce-paypal-payments' )
)
);
@ -128,7 +128,7 @@ class SettingsModule implements ServiceModule, ExecutableModule {
$message = sprintf(
// translators: %1$s is the URL for the startup guide.
__(
'🎉 <strong>Discover the new PayPal Payments settings!</strong> Enjoy a cleaner, faster interface. Check out the <a href="%1$s" target="_blank">Startup Guide</a>, then click <a href="#" class="settings-switch-ui" role="button" aria-describedby="switch-ui-desc"><strong>Switch to New Settings</strong></a> to activate it.',
'<strong>📢 Important: New PayPal Payments settings UI becoming default in October!</strong><br>We\'ve redesigned the settings for better performance and usability. Starting late October, this improved design will be the default for all WooCommerce installations to enjoy faster navigation, cleaner organization, and improved performance. Check out the <a href="%1$s" target="_blank">Startup Guide</a>, then click <a href="#" class="settings-switch-ui" role="button" aria-describedby="switch-ui-desc"><strong>Switch to New Settings</strong></a> to activate it.',
'woocommerce-paypal-payments'
),
'https://woocommerce.com/document/woocommerce-paypal-payments/paypal-payments-startup-guide/'