import { Slot, SlotFillProvider, withFilters } from '@wordpress/components'; import { Formik, Form } from 'formik'; import React from 'react'; import RadioGroupFieldOptionInterface from '../../../interfaces/RadioGroupFieldOptionInterface'; import SettingsFormContainerPropsInterface from '../../../interfaces/SettingsFormContainerPropsInterface'; import SettingsFormPropsPlanInterface from '../../../interfaces/SettingsFormPropsPlanInterface'; import AdminPageSection from '../AdminPageSection'; import RadioGroupField from '../Fields/RadioGroupField'; import TextField from '../Fields/TextField'; import TrustBadgeRepeater from '../TrustBadgeRepeater'; import ToggleCheckboxField from '../Fields/ToggleCheckboxField'; const radioOptions: RadioGroupFieldOptionInterface[] = [ { value: 'below_cart_summary', label: 'Below the checkout cart summary', description: 'Output in a single column below the checkout cart summary totals', }, { value: 'below_checkout_form', label: 'After the checkout form', description: 'Output in a single row below the checkout form above the footer', }, { value: 'in_footer', label: 'Top of the footer', description: 'Output in a single row inside the footer', }, ]; interface TrustBadgeSettingsInterface { enable_trust_badges: boolean; trust_badge_position: string; trust_badges_title: string; trust_badges: any[]; } interface TrustBadgeFormWooCommerceSettingsInterface { shipping_methods: any; } interface TrustBadgeSettingsFormPropsInterface extends SettingsFormContainerPropsInterface { settings: TrustBadgeSettingsInterface; woocommerce_settings: TrustBadgeFormWooCommerceSettingsInterface; plan: SettingsFormPropsPlanInterface; params: any; } const TrustBadgeSettingsForm: React.FC = ( props ) => { const { saveSettings, isLoading, searchTerm } = props; const AdditionalSettings = withFilters( 'CheckoutWC.Admin.Settings.Pages.TrustBadge', )( () => <> ); return ( { await saveSettings( values ); }} > {( { values } ) => (
{ props.plan.plan_level >= 1 && values.enable_trust_badges && ( <> ) } } /> { props.plan.plan_level >= 1 && values.enable_trust_badges && ( } /> ) } )}
); }; export default TrustBadgeSettingsForm;