import { __ } from '@wordpress/i18n';
import { getElement } from '../fields/FieldRegistry';
/**
* Right panel — campaign-level settings when nothing is selected,
* or schema-driven element settings when an element is selected.
*
* Element settings controls are generated from the PHP settingsSchema
* (localized via betterPaymentCampaignData.elements), so adding a new
* control to PHP automatically adds it here without touching this file.
*/
export default function SettingsPanel( { meta, layout, selectedElementId, selectedColumnId, dispatch } ) {
let selectedElement = null;
if ( selectedElementId && layout?.columns ) {
for ( const col of layout.columns ) {
const found = col.elements.find( ( el ) => el.id === selectedElementId );
if ( found ) { selectedElement = found; break; }
}
}
if ( selectedElement ) {
const def = getElement( selectedElement.type );
return (