Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Rename RadioControlOption type to RadioControlOptionType
Browse files Browse the repository at this point in the history
  • Loading branch information
opr committed Oct 23, 2023
1 parent 0e6ff91 commit 2c93a40
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/**
* External dependencies
*/
import { RadioControl } from '@woocommerce/blocks-components';
import {
RadioControl,
RadioControlOptionType,
} from '@woocommerce/blocks-components';
import { CartShippingPackageShippingRate } from '@woocommerce/types';
/**
* Internal dependencies
*/
import type { RadioControlOption } from '../../../../../../packages/components/radio-control/types';

interface LocalPickupSelectProps {
title?: string | undefined;
Expand All @@ -17,7 +16,7 @@ interface LocalPickupSelectProps {
renderPickupLocation: (
location: CartShippingPackageShippingRate,
pickupLocationsCount: number
) => RadioControlOption;
) => RadioControlOptionType;
packageCount: number;
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import { useMemo, cloneElement } from '@wordpress/element';
import { __, sprintf } from '@wordpress/i18n';
import { noticeContexts } from '@woocommerce/base-context';
import { RadioControl } from '@woocommerce/blocks-components';
import {
RadioControl,
RadioControlOptionType,
} from '@woocommerce/blocks-components';
import {
usePaymentMethodInterface,
useStoreEvents,
Expand All @@ -19,7 +22,6 @@ import { isNull } from '@woocommerce/types';
*/
import { getCanMakePaymentArg } from '../../../data/payment/utils/check-payment-methods';
import { CustomerPaymentMethodConfiguration } from '../../../data/payment/types';
import type { RadioControlOption } from '../../../../../packages/components/radio-control/types';

/**
* Returns the option object for a cc or echeck saved payment method token.
Expand Down Expand Up @@ -87,7 +89,7 @@ const SavedPaymentMethodOptions = () => {
const { removeNotice } = useDispatch( 'core/notices' );
const { dispatchCheckoutEvent } = useStoreEvents();

const options = useMemo< RadioControlOption[] >( () => {
const options = useMemo< RadioControlOptionType[] >( () => {
const types = Object.keys( savedPaymentMethods );

// Get individual payment methods from saved payment methods and put them into a unique array.
Expand Down Expand Up @@ -145,7 +147,7 @@ const SavedPaymentMethodOptions = () => {
} );
return mappedOptions.filter(
( option ) => typeof option !== 'undefined'
) as RadioControlOption[];
) as RadioControlOptionType[];
}, [
savedPaymentMethods,
paymentMethods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import {
} from '@wordpress/element';
import { useShippingData, useStoreCart } from '@woocommerce/base-context/hooks';
import { getCurrencyFromPriceResponse } from '@woocommerce/price-format';
import { FormattedMonetaryAmount } from '@woocommerce/blocks-components';
import {
FormattedMonetaryAmount,
RadioControlOptionType,
} from '@woocommerce/blocks-components';
import { decodeEntities } from '@wordpress/html-entities';
import { getSetting } from '@woocommerce/settings';
import { Icon, mapMarker } from '@wordpress/icons';
Expand All @@ -26,7 +29,6 @@ import { LocalPickupSelect } from '@woocommerce/base-components/cart-checkout/lo
* Internal dependencies
*/
import ShippingRatesControlPackage from '../../../../base/components/cart-checkout/shipping-rates-control-package';
import type { RadioControlOption } from '../../../../../../packages/components/radio-control/types';

const getPickupLocation = (
option: CartShippingPackageShippingRate
Expand Down Expand Up @@ -67,7 +69,7 @@ const getPickupDetails = (
const renderPickupLocation = (
option: CartShippingPackageShippingRate,
packageCount: number
): RadioControlOption => {
): RadioControlOptionType => {
const priceWithTaxes = getSetting( 'displayCartPricesIncludingTax', false )
? parseInt( option.price, 10 ) + parseInt( option.taxes, 10 )
: option.price;
Expand Down
1 change: 1 addition & 0 deletions packages/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export {
RadioControlOption,
RadioControlOptionLayout,
} from './radio-control';
export type { RadioControlOption as RadioControlOptionType } from './radio-control/types';
export { default as FormattedMonetaryAmount } from './formatted-monetary-amount';
export { Chip, RemovableChip } from './chip';
export { default as RadioControlAccordion } from './radio-control-accordion';

0 comments on commit 2c93a40

Please sign in to comment.