/** * External dependencies */ import { Fragment, useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import FormStep from '@woocommerce/base-components/checkout/form-step'; import CheckoutForm from '@woocommerce/base-components/checkout/form'; import NoShipping from '@woocommerce/base-components/checkout/no-shipping'; import TextInput from '@woocommerce/base-components/text-input'; import RadioControl from '@woocommerce/base-components/radio-control'; import InputRow from '@woocommerce/base-components/input-row'; import { CheckboxControl, Placeholder } from '@wordpress/components'; /** * Internal dependencies */ import './style.scss'; /** * Component displaying an attribute filter. */ const Block = ( { shippingMethods = [], isEditor = false } ) => { const [ shippingMethod, setShippingMethod ] = useState( {} ); const [ contactFields, setContactFields ] = useState( {} ); const [ shouldSavePayment, setShouldSavePayment ] = useState( true ); const [ shippingFields, setShippingFields ] = useState( {} ); return ( ( { __( 'Already have an account? ', 'woo-gutenberg-products-block' ) } { __( 'Log in.', 'woo-gutenberg-products-block' ) } ) } > setContactFields( { ...contactFields, email: newValue, } ) } /> setContactFields( { ...contactFields, keepUpdated: ! contactFields.keepUpdated, } ) } /> { shippingMethods.length === 0 && ( { isEditor && } ) } { shippingMethods.length > 0 && ( setShippingFields( { ...shippingFields, firstName: newValue, } ) } /> setShippingFields( { ...shippingFields, lastName: newValue, } ) } /> setShippingFields( { ...shippingFields, streetAddress: newValue, } ) } /> setShippingFields( { ...shippingFields, apartment: newValue, } ) } /> setShippingFields( { ...shippingFields, country: newValue, } ) } /> setShippingFields( { ...shippingFields, country: newValue, } ) } /> setShippingFields( { ...shippingFields, county: newValue, } ) } /> setShippingFields( { ...shippingFields, postalCode: newValue, } ) } /> setShippingFields( { ...shippingFields, phone: newValue, } ) } /> setShippingFields( { ...shippingFields, useSameForBilling: ! shippingFields.useSameForBilling, } ) } /> setShippingMethod( { ...shippingMethod, method: option, } ) } options={ [ { label: 'Click & Collect', value: 'collect', description: 'Pickup between 12:00 - 16:00 (Mon-Fri)', secondaryLabel: 'FREE', }, { label: 'Regular shipping', value: 'usps-normal', description: 'Dispatched via USPS', secondaryLabel: '€10.00', secondaryDescription: '5 business days', }, { label: 'Express shipping', value: 'ups-express', description: 'Dispatched via USPS', secondaryLabel: '€50.00', secondaryDescription: '2 business days', }, ] } /> setShippingMethod( { ...shippingMethod, orderNote: ! shippingMethod.orderNote, } ) } /> ) } Payment methods, coming soon setShouldSavePayment( ! shouldSavePayment ) } /> ); }; export default Block;