2023-10-19 21:52:01 +00:00
|
|
|
/**
|
2024-06-20 08:00:47 +00:00
|
|
|
* External dependencies
|
2023-10-19 21:52:01 +00:00
|
|
|
*/
|
2023-10-24 00:18:37 +00:00
|
|
|
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
|
|
|
|
|
2024-06-20 08:00:47 +00:00
|
|
|
const wordPressConsentString = {
|
|
|
|
6.4: 'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',
|
|
|
|
6.5: 'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
|
|
|
|
6.6: 'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
|
|
|
|
};
|
2023-10-20 00:14:40 +00:00
|
|
|
|
2024-06-20 08:00:47 +00:00
|
|
|
function optInToUnstableAPIs() {
|
|
|
|
let error;
|
|
|
|
for ( const optInString of Object.values( wordPressConsentString ) ) {
|
|
|
|
try {
|
|
|
|
return __dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
|
|
|
optInString,
|
|
|
|
'@wordpress/edit-site'
|
|
|
|
);
|
|
|
|
} catch ( anError ) {
|
|
|
|
error = anError;
|
|
|
|
}
|
|
|
|
}
|
2023-10-27 06:09:05 +00:00
|
|
|
|
2024-06-20 08:00:47 +00:00
|
|
|
throw error;
|
2023-10-20 00:14:40 +00:00
|
|
|
}
|
2023-10-19 21:52:01 +00:00
|
|
|
|
2024-06-20 08:00:47 +00:00
|
|
|
export const { lock, unlock } = optInToUnstableAPIs();
|
2023-10-24 00:18:37 +00:00
|
|
|
//# sourceMappingURL=lock-unlock.js.map
|