/** * External dependencies */ import { __ } from '@wordpress/i18n'; import { ALLOWED_COUNTRIES, ALLOWED_STATES } from '@woocommerce/block-settings'; import { type CartShippingAddress, type CartBillingAddress, isObject, isString, } from '@woocommerce/types'; import { FormFieldsConfig } from '@woocommerce/settings'; import { decodeEntities } from '@wordpress/html-entities'; /** * Internal dependencies */ import './style.scss'; const AddressCard = ( { address, onEdit, target, fieldConfig, }: { address: CartShippingAddress | CartBillingAddress; onEdit: () => void; target: string; fieldConfig: FormFieldsConfig; } ): JSX.Element | null => { const formattedCountry = isString( ALLOWED_COUNTRIES[ address.country ] ) ? decodeEntities( ALLOWED_COUNTRIES[ address.country ] ) : ''; const formattedState = isObject( ALLOWED_STATES[ address.country ] ) && isString( ALLOWED_STATES[ address.country ][ address.state ] ) ? decodeEntities( ALLOWED_STATES[ address.country ][ address.state ] ) : address.state; return (