2023-10-19 21:52:01 +00:00
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
2023-10-24 00:18:37 +00:00
|
|
|
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
|
|
|
|
|
2023-10-27 06:09:05 +00:00
|
|
|
const oldConsentString =
|
2023-10-24 00:18:37 +00:00
|
|
|
'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.';
|
2023-10-27 06:09:05 +00:00
|
|
|
const newConsentString =
|
|
|
|
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.';
|
2023-10-20 00:14:40 +00:00
|
|
|
|
2023-10-27 06:09:05 +00:00
|
|
|
let consentString = oldConsentString;
|
|
|
|
const wcSettings = window.wcSettings;
|
|
|
|
const admin = wcSettings?.admin;
|
|
|
|
|
|
|
|
const wpVersion = parseFloat( wcSettings?.wpVersion );
|
|
|
|
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;
|
2023-10-20 00:14:40 +00:00
|
|
|
}
|
2023-10-19 21:52:01 +00:00
|
|
|
|
2023-10-24 00:18:37 +00:00
|
|
|
export const { lock, unlock } =
|
|
|
|
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
|
|
|
consentString,
|
|
|
|
'@wordpress/edit-site'
|
|
|
|
);
|
|
|
|
//# sourceMappingURL=lock-unlock.js.map
|