/** * Re-reads the control schema over `GET /aureon/v1/settings` (see * `Aureon\Core\REST`). * * The Customizer gets its schema from the `window.aureonAdmin` config blob, * serialized when `customize.php` rendered. The schema describes state the * theme reads from elsewhere in WordPress (which WooCommerce pages use the * block cart/checkout, what shipping methods exist, the store currency …), * none of which lives in the settings tree, so a plugin action can invalidate * it without touching a single setting — see the `refresh` flag on a panel * action's response in `Admin_Panel::panel_sections()`'s docblock. Only the * schema is adopted by the caller — re-adopting `settings` would clobber * whatever the user has edited but not yet published. */ import apiFetch from '@wordpress/api-fetch'; import type { SettingsSchema } from './types'; const SETTINGS_PATH = window.aureonAdmin?.settingsPath ?? '/aureon/v1/settings'; export function loadSchema(): Promise< SettingsSchema > { return apiFetch< { schema?: SettingsSchema } >( { path: SETTINGS_PATH, } ).then( ( res ) => res.schema ?? {} ); }