/** * External dependencies */ import { __ } from '@wordpress/i18n'; import { withFeedbackPrompt } from '@woocommerce/block-hocs'; import { previewCart, previewShippingRates, } from '@woocommerce/resource-previews'; import { InspectorControls } from '@wordpress/block-editor'; import { PanelBody, ToggleControl, CheckboxControl, Notice, } from '@wordpress/components'; import BlockErrorBoundary from '@woocommerce/base-components/block-error-boundary'; import { PRIVACY_URL, TERMS_URL, SHIPPING_METHODS_EXIST, } from '@woocommerce/block-settings'; import { getAdminLink } from '@woocommerce/settings'; import { __experimentalCreateInterpolateElement } from 'wordpress-element'; /** * Internal dependencies */ import Block from './block.js'; import './editor.scss'; const CheckoutEditor = ( { attributes, setAttributes } ) => { const { className, useShippingAsBilling, showCompanyField, showAddress2Field, showPhoneField, requireCompanyField, requirePhoneField, showPolicyLinks, } = attributes; return (

{ __( 'Choose whether your checkout form requires extra information from customers.', 'woo-gutenberg-products-block' ) }

setAttributes( { showCompanyField: ! showCompanyField, } ) } /> { showCompanyField && ( setAttributes( { requireCompanyField: ! requireCompanyField, } ) } className="components-base-control--nested" /> ) } setAttributes( { showAddress2Field: ! showAddress2Field, } ) } /> setAttributes( { showPhoneField: ! showPhoneField, } ) } /> { showPhoneField && ( setAttributes( { requirePhoneField: ! requirePhoneField, } ) } className="components-base-control--nested" /> ) }

{ __( 'Reduce the number of fields required to checkout.', 'woo-gutenberg-products-block' ) }

setAttributes( { useShippingAsBilling: ! useShippingAsBilling, } ) } />

{ __( 'Choose additional content to display on checkout.', 'woo-gutenberg-products-block' ) }

setAttributes( { showPolicyLinks: ! showPolicyLinks, } ) } /> { showPolicyLinks && ( ! PRIVACY_URL || ! TERMS_URL ) && ( { __experimentalCreateInterpolateElement( __( 'Pages must be first setup in store settings: Privacy policy, Terms and conditions.', 'woo-gutenberg-products-block' ), { a1: ( // eslint-disable-next-line jsx-a11y/anchor-has-content ), a2: ( // eslint-disable-next-line jsx-a11y/anchor-has-content ), } ) } ) }
); }; export default withFeedbackPrompt( __( 'We are currently working on improving our cart and checkout blocks, providing merchants with the tools and customization options they need.', 'woo-gutenberg-products-block' ) )( CheckoutEditor );