/* eslint-disable @wordpress/no-unsafe-wp-apis */
/**
* External dependencies
*/
import clsx from 'clsx';
import { __ } from '@wordpress/i18n';
import { PanelBody, ToggleControl } from '@wordpress/components';
import { Icon, store, shipping } from '@wordpress/icons';
import { ADMIN_URL, getSetting } from '@woocommerce/settings';
import { LOCAL_PICKUP_ENABLED } from '@woocommerce/block-settings';
import {
InspectorControls,
useBlockProps,
RichText,
} from '@wordpress/block-editor';
import Button from '@woocommerce/base-components/button';
import { useShippingData } from '@woocommerce/base-context/hooks';
import { innerBlockAreas } from '@woocommerce/blocks-checkout';
import { useDispatch, useSelect } from '@wordpress/data';
import { CHECKOUT_STORE_KEY } from '@woocommerce/block-data';
import ExternalLinkCard from '@woocommerce/editor-components/external-link-card';
import { useEffect } from '@wordpress/element';
/**
* Internal dependencies
*/
import {
FormStepBlock,
AdditionalFields,
AdditionalFieldsContent,
} from '../../form-step';
import { RatePrice, getLocalPickupPrices, getShippingPrices } from './shared';
import type { minMaxPrices } from './shared';
import './style.scss';
import { defaultShippingText, defaultLocalPickupText } from './constants';
const LocalPickupSelector = ( {
checked,
rate,
showPrice,
showIcon,
toggleText,
setAttributes,
onClick,
}: {
checked: string;
rate: minMaxPrices;
showPrice: boolean;
showIcon: boolean;
toggleText: string;
onClick: () => void;
setAttributes: ( attributes: Record< string, unknown > ) => void;
} ) => {
return (
);
};
const ShippingSelector = ( {
checked,
rate,
showPrice,
showIcon,
toggleText,
setAttributes,
onClick,
}: {
checked: string;
rate: minMaxPrices;
showPrice: boolean;
showIcon: boolean;
toggleText: string;
setAttributes: ( attributes: Record< string, unknown > ) => void;
onClick: () => void;
} ) => {
const Price =
rate.min === undefined ? (
{ __( 'calculated with an address', 'woocommerce' ) }
) : (
{ __(
'Choose how this block is displayed to your customers.',
'woocommerce'
) }
{ __(
'Methods can be made managed in your store settings.',
'woocommerce'
) }