const settings = window.wc.wcSettings.getSetting( 'cetelem_data', {} );

const label = window.wp.htmlEntities.decodeEntities( settings.title ) || window.wp.i18n.__( 'Financing with Cetelem', 'cetelem-payment-gateway' );

const Label = React.createElement( 'div', { style: { display: 'flex', 'justify-content': 'space-between', width: '100%' } }, label, React.createElement( 'img', { src: settings.icon, alt: settings.title } ) );

const Content = () => {
    return window.wp.htmlEntities.decodeEntities( settings.description || '' );
};

const htmlToElem = ( html ) => wp.element.RawHTML( { children: html } );

const Cetelem_Gateway = {
    name: 'cetelem',
    label: Label,
    icon: settings.icon,
    content: htmlToElem( settings.description ),
    edit: Object( window.wp.element.createElement )( Content, null ),
    canMakePayment: () => true,
    ariaLabel: label,
    supports: {
        features: settings.supports,
    },
};
window.wc.wcBlocksRegistry.registerPaymentMethod( Cetelem_Gateway );
