import { __ } from '@wordpress/i18n';
import { registerPaymentMethod } from '@woocommerce/blocks-registry';
import { decodeEntities } from '@wordpress/html-entities';
import { getSetting } from '@woocommerce/settings';
import IntegratedPayment from "./wc-payplug-integratedPayment-blocks";
import Popup from "./wc-payplug-popup-blocks";
const settings = getSetting( 'payplug_data', {} );
const defaultLabel = __('Gateway method title', 'payplug');
const label = decodeEntities( settings?.title ) || defaultLabel;
/**
* Content component
*/
const Content = (props) => {
if(settings?.IP === true){
return (
)
}
if(settings?.popup === true){
return (
)
}
return window.wp.htmlEntities.decodeEntities( settings?.description || '' );
};
/**
* Label component
*
*/
const Label = () => {
return (
{label}
)
}
const Icon = () => {
return (
)
}
/**
* Payplug payment method config object.
*/
const Payplug = {
name: "payplug",
label: ,
content: ,
edit: ,
canMakePayment: () => true,
ariaLabel: label,
supports: {
features: settings.supports,
showSaveOption: settings?.showSaveOption && settings?.IP,
showSavedCards: settings.showSaveOption ?? false
},
};
registerPaymentMethod( Payplug );