import { registerPaymentMethodExtensionCallbacks } from '@woocommerce/blocks-registry';

// Yeni ödeme alanı tanımlama
const customCheckoutField = {
	id: 'my-custom-field',
	label: 'Özel Bilgi',
	render: ( props ) => {
		return (
			<div className="my-custom-checkout-field">
				<label htmlFor="my_custom_field">Özel Alan</label>
				<input
					type="text"
					id="my_custom_field"
					name="my_custom_field"
					value={props.billingData['my_custom_field'] || ''}
					onChange={(event) => props.setBillingData({ my_custom_field: event.target.value })}
				/>
			</div>
		);
	},
};

// WooCommerce bloklarının ödeme sürecine bu alanı ekler
registerPaymentMethodExtensionCallbacks('woocommerce-marketplace', {
	beforeProcessing: customCheckoutField,
});
