Fix CYS JS conflict error latest Gutenberg version (#41052)

* dequeue wpcom.editor on cys pages

* Add gutenberg_version to wcSettings.admin

* Use the new consent string for Gutenberg 16.9 and above

* Add changefile(s) from automation for the following project(s): woocommerce

* Revert "dequeue wpcom.editor on cys pages"

This reverts commit 85c039c7dc.

* Update changelog

* Add changefile(s) from automation for the following project(s): woocommerce

* Revert "Add changefile(s) from automation for the following project(s): woocommerce"

This reverts commit 4554626fde.

* Fix lint issues

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Adrian Duffell <9312929+adrianduffell@users.noreply.github.com>
This commit is contained in:
Moon 2023-10-26 23:09:05 -07:00 committed by GitHub
parent c305680792
commit d562fbdc5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 8 deletions

View File

@ -3,16 +3,27 @@
*/ */
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis'; import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
let consentString = const oldConsentString =
'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.'; 'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.';
const newConsentString =
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.';
if ( window.wcSettings && window.wcSettings.wpVersion ) { let consentString = oldConsentString;
// Parse the version string as a floating-point number const wcSettings = window.wcSettings;
const wpVersion = parseFloat( window.wcSettings.wpVersion ); const admin = wcSettings?.admin;
if ( ! isNaN( wpVersion ) && wpVersion >= 6.4 ) {
consentString = const wpVersion = parseFloat( wcSettings?.wpVersion );
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.'; const gutenbergVersion = parseFloat( admin?.gutenberg_version );
}
// Use the new consent string if the WP version is 6.4 and above
if ( ! isNaN( wpVersion ) && wpVersion >= 6.4 ) {
consentString = newConsentString;
}
// Users can install the latest Gutenberg plugin manually
// Use the new consent string for Gutenberg 16.9 and above
if ( ! isNaN( gutenbergVersion ) && gutenbergVersion >= 16.9 ) {
consentString = newConsentString;
} }
export const { lock, unlock } = export const { lock, unlock } =

View File

@ -0,0 +1,4 @@
Significance: minor
Type: fix
Fix blank assember hub (CYS) issue on WP 6.3 + latest Gutenberg.

View File

@ -239,6 +239,8 @@ class Settings {
$settings['isWooPayEligible'] = WCPayPromotionInit::is_woopay_eligible(); $settings['isWooPayEligible'] = WCPayPromotionInit::is_woopay_eligible();
$settings['gutenberg_version'] = defined( 'GUTENBERG_VERSION' ) ? constant( 'GUTENBERG_VERSION' ) : 0;
return $settings; return $settings;
} }