/**
 * Donations List Block - Editor Registration
 */
( function( blocks, element, i18n, serverSideRender ) {
	var el = element.createElement;
	var __ = i18n.__;

	blocks.registerBlockType( 'ambassadorhub/donations-list', {
		title: __( 'Donations List', 'ambassador-fundraiser' ),
		icon: 'heart',
		category: 'ambassadorhub',
		attributes: {
			limit: {
				type: 'number',
				default: 10
			}
		},
		edit: function( props ) {
			var blockProps = wp.blockEditor.useBlockProps();
			return el( 'div', blockProps,
				el( serverSideRender, {
					block: 'ambassadorhub/donations-list',
					attributes: props.attributes
				} )
			);
		},
		save: function() {
			return null; // Server-side render
		}
	} );
} )(
	window.wp.blocks,
	window.wp.element,
	window.wp.i18n,
	window.wp.serverSideRender
);
