Convert product-elements/price to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/7683)
* Convert product-element/price to TypeScript * Apply feedback from woocommerce/woocommerce-blocks#7095 to this PR * Export block due to Cross-Sells dependency * Update assets/js/atomic/blocks/product-elements/price/edit.tsx Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> * bot: update checkstyle.xml * Apply review feedback * Outsource supports section * bot: update checkstyle.xml * Resolve merge conflicts * bot: update checkstyle.xml * Solve TS error in cart-cross-sells-product.tsx * bot: update checkstyle.xml * Solve TS error regarding min_amount and max_amount * bot: update checkstyle.xml * Empty-Commit * Fix TS problems in product-elements/price/block.tsx * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * bot: update checkstyle.xml * Resolve merge conflicts * Convert product-element/price to TypeScript * Apply feedback from woocommerce/woocommerce-blocks#7095 to this PR * Export block due to Cross-Sells dependency * Apply review feedback * Update assets/js/atomic/blocks/product-elements/price/edit.tsx Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS error in cart-cross-sells-product.tsx * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS error regarding min_amount and max_amount * Empty-Commit * bot: update checkstyle.xml * Fix TS problems in product-elements/price/block.tsx * bot: update checkstyle.xml * bot: update checkstyle.xml * Solve TS errors * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * bot: update checkstyle.xml * bot: update checkstyle.xml * Empty checkstyle.xml * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Solve TS errors * bot: update checkstyle.xml * Use BlockAttributes from @wordpress/blocks * Fix TS error * Fix TS errors * Fix TS error Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
46f0330a0a
commit
63bb47bb3d
|
@ -1,8 +1,9 @@
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
|
import { BlockAttributes } from '@wordpress/blocks';
|
||||||
|
|
||||||
export const blockAttributes = {
|
export const blockAttributes: BlockAttributes = {
|
||||||
productId: {
|
productId: {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
default: 0,
|
default: 0,
|
|
@ -1,7 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import ProductPrice from '@woocommerce/base-components/product-price';
|
import ProductPrice from '@woocommerce/base-components/product-price';
|
||||||
import { getCurrencyFromPriceResponse } from '@woocommerce/price-format';
|
import { getCurrencyFromPriceResponse } from '@woocommerce/price-format';
|
||||||
|
@ -11,22 +10,32 @@ import {
|
||||||
} from '@woocommerce/shared-context';
|
} from '@woocommerce/shared-context';
|
||||||
import { useColorProps, useTypographyProps } from '@woocommerce/base-hooks';
|
import { useColorProps, useTypographyProps } from '@woocommerce/base-hooks';
|
||||||
import { withProductDataContext } from '@woocommerce/shared-hocs';
|
import { withProductDataContext } from '@woocommerce/shared-hocs';
|
||||||
|
import type { HTMLAttributes } from 'react';
|
||||||
|
import { CurrencyCode } from '@woocommerce/type-defs/currency';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
|
import type { BlockAttributes } from './types';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
/**
|
type Props = BlockAttributes & HTMLAttributes< HTMLDivElement >;
|
||||||
* Product Price Block Component.
|
|
||||||
*
|
interface PriceProps {
|
||||||
* @param {Object} props Incoming props.
|
currency_code: CurrencyCode;
|
||||||
* @param {string} [props.className] CSS Class name for the component.
|
currency_symbol: string;
|
||||||
* @param {string} [props.textAlign] Text alignment.
|
currency_minor_unit: number;
|
||||||
* context will be used if this is not provided.
|
currency_decimal_separator: string;
|
||||||
* @return {*} The component.
|
currency_thousand_separator: string;
|
||||||
*/
|
currency_prefix: string;
|
||||||
export const Block = ( props ) => {
|
currency_suffix: string;
|
||||||
|
price: string;
|
||||||
|
regular_price: string;
|
||||||
|
sale_price: string;
|
||||||
|
price_range: null | { min_amount: string; max_amount: string };
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Block = ( props: Props ): JSX.Element | null => {
|
||||||
const { className, textAlign } = props;
|
const { className, textAlign } = props;
|
||||||
const { parentClassName } = useInnerBlockLayoutContext();
|
const { parentClassName } = useInnerBlockLayoutContext();
|
||||||
const { product } = useProductDataContext();
|
const { product } = useProductDataContext();
|
||||||
|
@ -54,7 +63,7 @@ export const Block = ( props ) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const prices = product.prices;
|
const prices: PriceProps = product.prices;
|
||||||
const currency = getCurrencyFromPriceResponse( prices );
|
const currency = getCurrencyFromPriceResponse( prices );
|
||||||
const isOnSale = prices.price !== prices.regular_price;
|
const isOnSale = prices.price !== prices.regular_price;
|
||||||
const priceClassName = classnames( {
|
const priceClassName = classnames( {
|
||||||
|
@ -84,10 +93,4 @@ export const Block = ( props ) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
Block.propTypes = {
|
|
||||||
className: PropTypes.string,
|
|
||||||
product: PropTypes.object,
|
|
||||||
textAlign: PropTypes.oneOf( [ 'left', 'right', 'center' ] ),
|
|
||||||
};
|
|
||||||
|
|
||||||
export default withProductDataContext( Block );
|
export default withProductDataContext( Block );
|
|
@ -4,17 +4,17 @@
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { currencyDollar, Icon } from '@wordpress/icons';
|
import { currencyDollar, Icon } from '@wordpress/icons';
|
||||||
|
|
||||||
export const BLOCK_TITLE = __(
|
export const BLOCK_TITLE: string = __(
|
||||||
'Product Price',
|
'Product Price',
|
||||||
'woo-gutenberg-products-block'
|
'woo-gutenberg-products-block'
|
||||||
);
|
);
|
||||||
export const BLOCK_ICON = (
|
export const BLOCK_ICON: JSX.Element = (
|
||||||
<Icon
|
<Icon
|
||||||
icon={ currencyDollar }
|
icon={ currencyDollar }
|
||||||
className="wc-block-editor-components-block-icon"
|
className="wc-block-editor-components-block-icon"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
export const BLOCK_DESCRIPTION = __(
|
export const BLOCK_DESCRIPTION: string = __(
|
||||||
'Display the price of a product.',
|
'Display the price of a product.',
|
||||||
'woo-gutenberg-products-block'
|
'woo-gutenberg-products-block'
|
||||||
);
|
);
|
|
@ -1,58 +0,0 @@
|
||||||
/**
|
|
||||||
* External dependencies
|
|
||||||
*/
|
|
||||||
import {
|
|
||||||
AlignmentToolbar,
|
|
||||||
BlockControls,
|
|
||||||
useBlockProps,
|
|
||||||
} from '@wordpress/block-editor';
|
|
||||||
import { __ } from '@wordpress/i18n';
|
|
||||||
import { useEffect } from 'react';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal dependencies
|
|
||||||
*/
|
|
||||||
import Block from './block';
|
|
||||||
import withProductSelector from '../shared/with-product-selector';
|
|
||||||
import { BLOCK_TITLE, BLOCK_ICON } from './constants';
|
|
||||||
|
|
||||||
const PriceEdit = ( { attributes, setAttributes, context } ) => {
|
|
||||||
const blockProps = useBlockProps();
|
|
||||||
const blockAttrs = {
|
|
||||||
...attributes,
|
|
||||||
...context,
|
|
||||||
};
|
|
||||||
const isDescendentOfQueryLoop = Number.isFinite( context.queryId );
|
|
||||||
|
|
||||||
useEffect(
|
|
||||||
() => setAttributes( { isDescendentOfQueryLoop } ),
|
|
||||||
[ setAttributes, isDescendentOfQueryLoop ]
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<BlockControls>
|
|
||||||
{ isDescendentOfQueryLoop && (
|
|
||||||
<AlignmentToolbar
|
|
||||||
value={ attributes.textAlign }
|
|
||||||
onChange={ ( newAlign ) => {
|
|
||||||
setAttributes( { textAlign: newAlign } );
|
|
||||||
} }
|
|
||||||
/>
|
|
||||||
) }
|
|
||||||
</BlockControls>
|
|
||||||
<div { ...blockProps }>
|
|
||||||
<Block { ...blockAttrs } />
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default withProductSelector( {
|
|
||||||
icon: BLOCK_ICON,
|
|
||||||
label: BLOCK_TITLE,
|
|
||||||
description: __(
|
|
||||||
'Choose a product to display its price.',
|
|
||||||
'woo-gutenberg-products-block'
|
|
||||||
),
|
|
||||||
} )( PriceEdit );
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
/**
|
||||||
|
* External dependencies
|
||||||
|
*/
|
||||||
|
import {
|
||||||
|
AlignmentToolbar,
|
||||||
|
BlockControls,
|
||||||
|
useBlockProps,
|
||||||
|
} from '@wordpress/block-editor';
|
||||||
|
import { useEffect } from 'react';
|
||||||
|
import type { BlockAlignment } from '@wordpress/blocks';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
import Block from './block';
|
||||||
|
import withProductSelector from '../shared/with-product-selector';
|
||||||
|
import { BLOCK_TITLE as label, BLOCK_ICON as icon } from './constants';
|
||||||
|
|
||||||
|
type UnsupportedAligments = 'wide' | 'full';
|
||||||
|
type AllowedAlignments = Exclude< BlockAlignment, UnsupportedAligments >;
|
||||||
|
|
||||||
|
interface BlockAttributes {
|
||||||
|
textAlign?: AllowedAlignments;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Attributes {
|
||||||
|
textAlign: 'left' | 'center' | 'right';
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Context {
|
||||||
|
queryId: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
attributes: Attributes;
|
||||||
|
setAttributes: (
|
||||||
|
attributes: Partial< BlockAttributes > & Record< string, unknown >
|
||||||
|
) => void;
|
||||||
|
context: Context;
|
||||||
|
}
|
||||||
|
|
||||||
|
const PriceEdit = ( {
|
||||||
|
attributes,
|
||||||
|
setAttributes,
|
||||||
|
context,
|
||||||
|
}: Props ): JSX.Element => {
|
||||||
|
const blockProps = useBlockProps();
|
||||||
|
const blockAttrs = {
|
||||||
|
...attributes,
|
||||||
|
...context,
|
||||||
|
};
|
||||||
|
const isDescendentOfQueryLoop = Number.isFinite( context.queryId );
|
||||||
|
|
||||||
|
useEffect(
|
||||||
|
() => setAttributes( { isDescendentOfQueryLoop } ),
|
||||||
|
[ setAttributes, isDescendentOfQueryLoop ]
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<BlockControls>
|
||||||
|
{ isDescendentOfQueryLoop && (
|
||||||
|
<AlignmentToolbar
|
||||||
|
value={ attributes.textAlign }
|
||||||
|
onChange={ ( textAlign: AllowedAlignments ) => {
|
||||||
|
setAttributes( { textAlign } );
|
||||||
|
} }
|
||||||
|
/>
|
||||||
|
) }
|
||||||
|
</BlockControls>
|
||||||
|
<div { ...blockProps }>
|
||||||
|
<Block { ...blockAttrs } />
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default withProductSelector( { icon, label } )( PriceEdit );
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
|
|
||||||
import { registerBlockType } from '@wordpress/blocks';
|
import { registerBlockType } from '@wordpress/blocks';
|
||||||
|
import type { BlockConfiguration } from '@wordpress/blocks';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
|
@ -10,13 +10,18 @@ import { registerBlockType } from '@wordpress/blocks';
|
||||||
import sharedConfig from '../shared/config';
|
import sharedConfig from '../shared/config';
|
||||||
import edit from './edit';
|
import edit from './edit';
|
||||||
import attributes from './attributes';
|
import attributes from './attributes';
|
||||||
|
import { supports } from './supports';
|
||||||
import {
|
import {
|
||||||
BLOCK_TITLE as title,
|
BLOCK_TITLE as title,
|
||||||
BLOCK_ICON as icon,
|
BLOCK_ICON as icon,
|
||||||
BLOCK_DESCRIPTION as description,
|
BLOCK_DESCRIPTION as description,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
|
||||||
const blockConfig = {
|
type CustomBlockConfiguration = BlockConfiguration & {
|
||||||
|
ancestor: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
const blockConfig: CustomBlockConfiguration = {
|
||||||
...sharedConfig,
|
...sharedConfig,
|
||||||
apiVersion: 2,
|
apiVersion: 2,
|
||||||
title,
|
title,
|
||||||
|
@ -29,25 +34,8 @@ const blockConfig = {
|
||||||
usesContext: [ 'query', 'queryId', 'postId' ],
|
usesContext: [ 'query', 'queryId', 'postId' ],
|
||||||
icon: { src: icon },
|
icon: { src: icon },
|
||||||
attributes,
|
attributes,
|
||||||
|
supports,
|
||||||
edit,
|
edit,
|
||||||
supports: {
|
|
||||||
...sharedConfig.supports,
|
|
||||||
...( isFeaturePluginBuild() && {
|
|
||||||
color: {
|
|
||||||
text: true,
|
|
||||||
background: true,
|
|
||||||
link: false,
|
|
||||||
__experimentalSkipSerialization: true,
|
|
||||||
},
|
|
||||||
typography: {
|
|
||||||
fontSize: true,
|
|
||||||
__experimentalFontWeight: true,
|
|
||||||
__experimentalFontStyle: true,
|
|
||||||
__experimentalSkipSerialization: true,
|
|
||||||
},
|
|
||||||
__experimentalSelector: '.wc-block-components-product-price',
|
|
||||||
} ),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
registerBlockType( 'woocommerce/product-price', blockConfig );
|
registerBlockType( 'woocommerce/product-price', blockConfig );
|
|
@ -0,0 +1,28 @@
|
||||||
|
/**
|
||||||
|
* External dependencies
|
||||||
|
*/
|
||||||
|
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
import sharedConfig from '../shared/config';
|
||||||
|
|
||||||
|
export const supports = {
|
||||||
|
...sharedConfig.supports,
|
||||||
|
...( isFeaturePluginBuild() && {
|
||||||
|
color: {
|
||||||
|
text: true,
|
||||||
|
background: false,
|
||||||
|
link: false,
|
||||||
|
__experimentalSkipSerialization: true,
|
||||||
|
},
|
||||||
|
typography: {
|
||||||
|
fontSize: true,
|
||||||
|
__experimentalFontWeight: true,
|
||||||
|
__experimentalFontStyle: true,
|
||||||
|
__experimentalSkipSerialization: true,
|
||||||
|
},
|
||||||
|
__experimentalSelector: '.wc-block-components-product-price',
|
||||||
|
} ),
|
||||||
|
};
|
|
@ -0,0 +1,6 @@
|
||||||
|
export interface BlockAttributes {
|
||||||
|
productId?: number;
|
||||||
|
className?: string;
|
||||||
|
textAlign?: 'left' | 'center' | 'right';
|
||||||
|
isDescendentOfQueryLoop?: boolean;
|
||||||
|
}
|
|
@ -17,7 +17,11 @@ import {
|
||||||
} from './constants';
|
} from './constants';
|
||||||
import { supports } from './support';
|
import { supports } from './support';
|
||||||
|
|
||||||
const blockConfig: BlockConfiguration = {
|
type CustomBlockConfiguration = BlockConfiguration & {
|
||||||
|
ancestor: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
const blockConfig: CustomBlockConfiguration = {
|
||||||
...sharedConfig,
|
...sharedConfig,
|
||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export interface BlockAttributes {
|
export interface BlockAttributes {
|
||||||
productId: number;
|
productId?: number;
|
||||||
align: 'left' | 'center' | 'right';
|
align?: 'left' | 'center' | 'right';
|
||||||
isDescendentOfQueryLoop: boolean;
|
isDescendentOfQueryLoop: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,12 @@ import {
|
||||||
BLOCK_DESCRIPTION as description,
|
BLOCK_DESCRIPTION as description,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
|
||||||
const blockConfig: BlockConfiguration = {
|
type CustomBlockConfiguration = BlockConfiguration & {
|
||||||
|
ancestor: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
const blockConfig: CustomBlockConfiguration = {
|
||||||
|
...sharedConfig,
|
||||||
apiVersion: 2,
|
apiVersion: 2,
|
||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
|
@ -31,7 +36,4 @@ const blockConfig: BlockConfiguration = {
|
||||||
edit,
|
edit,
|
||||||
};
|
};
|
||||||
|
|
||||||
registerBlockType( 'woocommerce/product-sku', {
|
registerBlockType( 'woocommerce/product-sku', { ...blockConfig } );
|
||||||
...sharedConfig,
|
|
||||||
...blockConfig,
|
|
||||||
} );
|
|
|
@ -18,7 +18,11 @@ import {
|
||||||
BLOCK_DESCRIPTION as description,
|
BLOCK_DESCRIPTION as description,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
|
||||||
const blockConfig: BlockConfiguration = {
|
type CustomBlockConfiguration = BlockConfiguration & {
|
||||||
|
ancestor: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
const blockConfig: CustomBlockConfiguration = {
|
||||||
...sharedConfig,
|
...sharedConfig,
|
||||||
apiVersion: 2,
|
apiVersion: 2,
|
||||||
title,
|
title,
|
||||||
|
|
|
@ -24,7 +24,7 @@ interface FormattedMonetaryAmountProps
|
||||||
value: number | string; // Value of money amount.
|
value: number | string; // Value of money amount.
|
||||||
currency: Currency | Record< string, never >; // Currency configuration object.
|
currency: Currency | Record< string, never >; // Currency configuration object.
|
||||||
onValueChange?: ( unit: number ) => void; // Function to call when value changes.
|
onValueChange?: ( unit: number ) => void; // Function to call when value changes.
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties | undefined;
|
||||||
renderText?: ( value: string ) => JSX.Element;
|
renderText?: ( value: string ) => JSX.Element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,16 +35,23 @@ const currencyToNumberFormat = (
|
||||||
currency: FormattedMonetaryAmountProps[ 'currency' ]
|
currency: FormattedMonetaryAmountProps[ 'currency' ]
|
||||||
) => {
|
) => {
|
||||||
return {
|
return {
|
||||||
thousandSeparator: currency.thousandSeparator,
|
thousandSeparator: currency?.thousandSeparator,
|
||||||
decimalSeparator: currency.decimalSeparator,
|
decimalSeparator: currency?.decimalSeparator,
|
||||||
decimalScale: currency.minorUnit,
|
decimalScale: currency?.minorUnit,
|
||||||
fixedDecimalScale: true,
|
fixedDecimalScale: true,
|
||||||
prefix: currency.prefix,
|
prefix: currency?.prefix,
|
||||||
suffix: currency.suffix,
|
suffix: currency?.suffix,
|
||||||
isNumericString: true,
|
isNumericString: true,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type CustomFormattedMonetaryAmountProps = Omit<
|
||||||
|
FormattedMonetaryAmountProps,
|
||||||
|
'currency'
|
||||||
|
> & {
|
||||||
|
currency: Currency | Record< string, never >;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FormattedMonetaryAmount component.
|
* FormattedMonetaryAmount component.
|
||||||
*
|
*
|
||||||
|
@ -57,7 +64,7 @@ const FormattedMonetaryAmount = ( {
|
||||||
onValueChange,
|
onValueChange,
|
||||||
displayType = 'text',
|
displayType = 'text',
|
||||||
...props
|
...props
|
||||||
}: FormattedMonetaryAmountProps ): ReactElement | null => {
|
}: CustomFormattedMonetaryAmountProps ): ReactElement | null => {
|
||||||
const value =
|
const value =
|
||||||
typeof rawValue === 'string' ? parseInt( rawValue, 10 ) : rawValue;
|
typeof rawValue === 'string' ? parseInt( rawValue, 10 ) : rawValue;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ interface PriceRangeProps {
|
||||||
/**
|
/**
|
||||||
* Currency configuration object
|
* Currency configuration object
|
||||||
*/
|
*/
|
||||||
currency: Currency | Record< string, never >;
|
currency: Currency | Record< string, never > | undefined;
|
||||||
/**
|
/**
|
||||||
* The maximum price for the range
|
* The maximum price for the range
|
||||||
*/
|
*/
|
||||||
|
@ -31,13 +31,13 @@ interface PriceRangeProps {
|
||||||
*
|
*
|
||||||
* **Note:** this excludes the dash in between the elements
|
* **Note:** this excludes the dash in between the elements
|
||||||
*/
|
*/
|
||||||
priceClassName?: string;
|
priceClassName?: string | undefined;
|
||||||
/**
|
/**
|
||||||
* Any custom style to be applied to each of the elements containing the prices
|
* Any custom style to be applied to each of the elements containing the prices
|
||||||
*
|
*
|
||||||
* **Note:** this excludes the dash in between the elements
|
* **Note:** this excludes the dash in between the elements
|
||||||
*/
|
*/
|
||||||
priceStyle?: React.CSSProperties;
|
priceStyle?: React.CSSProperties | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PriceRange = ( {
|
const PriceRange = ( {
|
||||||
|
@ -89,19 +89,19 @@ interface SalePriceProps {
|
||||||
/**
|
/**
|
||||||
* Currency configuration object
|
* Currency configuration object
|
||||||
*/
|
*/
|
||||||
currency: Currency | Record< string, never >;
|
currency: Currency | Record< string, never > | undefined;
|
||||||
/**
|
/**
|
||||||
* CSS class to be applied to the regular price container
|
* CSS class to be applied to the regular price container
|
||||||
*
|
*
|
||||||
* i.e. `<del>` element
|
* i.e. `<del>` element
|
||||||
*/
|
*/
|
||||||
regularPriceClassName?: string;
|
regularPriceClassName?: string | undefined;
|
||||||
/**
|
/**
|
||||||
* Custom style to be applied to the regular price container
|
* Custom style to be applied to the regular price container
|
||||||
*
|
*
|
||||||
* i.e. `<del>` element
|
* i.e. `<del>` element
|
||||||
*/
|
*/
|
||||||
regularPriceStyle?: React.CSSProperties;
|
regularPriceStyle?: React.CSSProperties | undefined;
|
||||||
/**
|
/**
|
||||||
* The regular price before the sale
|
* The regular price before the sale
|
||||||
*/
|
*/
|
||||||
|
@ -111,17 +111,17 @@ interface SalePriceProps {
|
||||||
*
|
*
|
||||||
* i.e. `<ins>` element
|
* i.e. `<ins>` element
|
||||||
*/
|
*/
|
||||||
priceClassName?: string;
|
priceClassName?: string | undefined;
|
||||||
/**
|
/**
|
||||||
* Custom style to be applied to the regular price container
|
* Custom style to be applied to the regular price container
|
||||||
*
|
*
|
||||||
* i.e. `<ins>` element
|
* i.e. `<ins>` element
|
||||||
*/
|
*/
|
||||||
priceStyle?: React.CSSProperties;
|
priceStyle?: React.CSSProperties | undefined;
|
||||||
/**
|
/**
|
||||||
* The new price during the sale
|
* The new price during the sale
|
||||||
*/
|
*/
|
||||||
price: number | string;
|
price: number | string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SalePrice = ( {
|
const SalePrice = ( {
|
||||||
|
@ -183,25 +183,25 @@ export interface ProductPriceProps {
|
||||||
* Applies the `wc-block-components-product-price--align-${ align }` utility
|
* Applies the `wc-block-components-product-price--align-${ align }` utility
|
||||||
* class to the wrapper.
|
* class to the wrapper.
|
||||||
*/
|
*/
|
||||||
align?: 'left' | 'center' | 'right';
|
align?: 'left' | 'center' | 'right' | undefined;
|
||||||
/**
|
/**
|
||||||
* CSS class for the wrapper
|
* CSS class for the wrapper
|
||||||
*/
|
*/
|
||||||
className?: string;
|
className?: string | undefined;
|
||||||
/**
|
/**
|
||||||
* Currency configuration object
|
* Currency configuration object
|
||||||
*/
|
*/
|
||||||
currency: Currency | Record< string, never >;
|
currency?: Currency | Record< string, never >;
|
||||||
/**
|
/**
|
||||||
* The string version of the element to use for the price interpolation
|
* The string version of the element to use for the price interpolation
|
||||||
*
|
*
|
||||||
* **Note:** It should contain `<price/>` (which is also the default value)
|
* **Note:** It should contain `<price/>` (which is also the default value)
|
||||||
*/
|
*/
|
||||||
format: string;
|
format?: string;
|
||||||
/**
|
/**
|
||||||
* The current price
|
* The current price
|
||||||
*/
|
*/
|
||||||
price: number | string;
|
price?: number | string;
|
||||||
/**
|
/**
|
||||||
* CSS class for the current price wrapper
|
* CSS class for the current price wrapper
|
||||||
*/
|
*/
|
||||||
|
@ -209,36 +209,36 @@ export interface ProductPriceProps {
|
||||||
/**
|
/**
|
||||||
* Custom style for the current price
|
* Custom style for the current price
|
||||||
*/
|
*/
|
||||||
priceStyle?: React.CSSProperties;
|
priceStyle?: React.CSSProperties | undefined;
|
||||||
/**
|
/**
|
||||||
* The maximum price in a range
|
* The maximum price in a range
|
||||||
*
|
*
|
||||||
* If both `maxPrice` and `minPrice` are set, the component will be rendered
|
* If both `maxPrice` and `minPrice` are set, the component will be rendered
|
||||||
* as a `PriceRange` component, otherwise, this value will be ignored.
|
* as a `PriceRange` component, otherwise, this value will be ignored.
|
||||||
*/
|
*/
|
||||||
maxPrice?: number | string;
|
maxPrice?: number | string | undefined;
|
||||||
/**
|
/**
|
||||||
* The minimum price in a range
|
* The minimum price in a range
|
||||||
*
|
*
|
||||||
* If both `maxPrice` and `minPrice` are set, the component will be rendered
|
* If both `maxPrice` and `minPrice` are set, the component will be rendered
|
||||||
* as a `PriceRange` component, otherwise, this value will be ignored.
|
* as a `PriceRange` component, otherwise, this value will be ignored.
|
||||||
*/
|
*/
|
||||||
minPrice?: number | string;
|
minPrice?: number | string | undefined;
|
||||||
/**
|
/**
|
||||||
* The regular price if the item is currently on sale
|
* The regular price if the item is currently on sale
|
||||||
*
|
*
|
||||||
* If this property exists and is different from the current price, then the
|
* If this property exists and is different from the current price, then the
|
||||||
* component will be rendered as a `SalePrice` component.
|
* component will be rendered as a `SalePrice` component.
|
||||||
*/
|
*/
|
||||||
regularPrice?: number | string;
|
regularPrice?: number | string | undefined;
|
||||||
/**
|
/**
|
||||||
* CSS class to apply to the regular price wrapper
|
* CSS class to apply to the regular price wrapper
|
||||||
*/
|
*/
|
||||||
regularPriceClassName?: string;
|
regularPriceClassName?: string | undefined;
|
||||||
/**
|
/**
|
||||||
* Custom style to apply to the regular price wrapper.
|
* Custom style to apply to the regular price wrapper.
|
||||||
*/
|
*/
|
||||||
regularPriceStyle?: React.CSSProperties;
|
regularPriceStyle?: React.CSSProperties | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProductPrice = ( {
|
const ProductPrice = ( {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
import { SymbolPosition } from '@woocommerce/types';
|
import { SymbolPosition, CurrencyCode } from '@woocommerce/types';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
|
@ -11,7 +11,7 @@ declare global {
|
||||||
|
|
||||||
export interface WooCommerceSiteCurrency {
|
export interface WooCommerceSiteCurrency {
|
||||||
// The ISO code for the currency.
|
// The ISO code for the currency.
|
||||||
code: string;
|
code: CurrencyCode;
|
||||||
// The precision (decimal places).
|
// The precision (decimal places).
|
||||||
precision: number;
|
precision: number;
|
||||||
// The symbol for the currency (eg '$')
|
// The symbol for the currency (eg '$')
|
||||||
|
@ -86,15 +86,19 @@ const defaults: WooCommerceSharedSettings = {
|
||||||
const globalSharedSettings =
|
const globalSharedSettings =
|
||||||
typeof window.wcSettings === 'object' ? window.wcSettings : {};
|
typeof window.wcSettings === 'object' ? window.wcSettings : {};
|
||||||
|
|
||||||
|
interface AllSettings extends Record< string, unknown > {
|
||||||
|
currency: WooCommerceSiteCurrency;
|
||||||
|
}
|
||||||
|
|
||||||
// Use defaults or global settings, depending on what is set.
|
// Use defaults or global settings, depending on what is set.
|
||||||
const allSettings: Record< string, unknown > = {
|
const allSettings: AllSettings = {
|
||||||
...defaults,
|
...defaults,
|
||||||
...globalSharedSettings,
|
...globalSharedSettings,
|
||||||
};
|
};
|
||||||
|
|
||||||
allSettings.currency = {
|
allSettings.currency = {
|
||||||
...defaults.currency,
|
...defaults.currency,
|
||||||
...( allSettings.currency as Record< string, unknown > ),
|
...( allSettings.currency as WooCommerceSiteCurrency ),
|
||||||
};
|
};
|
||||||
|
|
||||||
allSettings.locale = {
|
allSettings.locale = {
|
||||||
|
|
|
@ -70,8 +70,8 @@ export const useProductDataContext = () => useContext( ProductDataContext );
|
||||||
|
|
||||||
interface ProductDataContextProviderProps {
|
interface ProductDataContextProviderProps {
|
||||||
product: ProductResponseItem | null;
|
product: ProductResponseItem | null;
|
||||||
|
children: JSX.Element | JSX.Element[];
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
children: React.ReactNode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -240,16 +240,11 @@
|
||||||
Argument of type 'string | BlockConfiguration<{}>' is not assignable to parameter of type 'string'.
|
Argument of type 'string | BlockConfiguration<{}>' is not assignable to parameter of type 'string'.
|
||||||
Type 'BlockConfiguration<{}>' is not assignable to type 'string'." source="TS2769" />
|
Type 'BlockConfiguration<{}>' is not assignable to type 'string'." source="TS2769" />
|
||||||
</file>
|
</file>
|
||||||
<file name="packages/prices/utils/price.ts">
|
<file name="assets/js/base/components/formatted-monetary-amount/index.tsx">
|
||||||
<error line="52" column="8" severity="error" message="Object is of type 'unknown'." source="TS2571" />
|
<error line="75" column="35" severity="error" message="Object is possibly 'undefined'." source="TS2532" />
|
||||||
<error line="53" column="10" severity="error" message="Object is of type 'unknown'." source="TS2571" />
|
<error line="88" column="30" severity="error" message="Argument of type 'Currency | Record<string, never> | undefined' is not assignable to parameter of type 'Currency | Record<string, never>'.
|
||||||
<error line="54" column="21" severity="error" message="Object is of type 'unknown'." source="TS2571" />
|
Type 'undefined' is not assignable to type 'Currency | Record<string, never>'." source="TS2345" />
|
||||||
<error line="55" column="20" severity="error" message="Object is of type 'unknown'." source="TS2571" />
|
<error line="97" column="50" severity="error" message="Object is possibly 'undefined'." source="TS2532" />
|
||||||
<error line="56" column="13" severity="error" message="Object is of type 'unknown'." source="TS2571" />
|
|
||||||
<error line="58" column="3" severity="error" message="Object is of type 'unknown'." source="TS2571" />
|
|
||||||
<error line="59" column="3" severity="error" message="Object is of type 'unknown'." source="TS2571" />
|
|
||||||
<error line="62" column="3" severity="error" message="Object is of type 'unknown'." source="TS2571" />
|
|
||||||
<error line="63" column="3" severity="error" message="Object is of type 'unknown'." source="TS2571" />
|
|
||||||
</file>
|
</file>
|
||||||
<file name="packages/prices/utils/index.js">
|
<file name="packages/prices/utils/index.js">
|
||||||
<error line="1" column="15" severity="error" message="File '/home/runner/work/woocommerce-blocks/woocommerce-blocks/packages/prices/utils/price.ts' is not listed within the file list of project '/home/runner/work/woocommerce-blocks/woocommerce-blocks/tsconfig.json'. Projects must list all files or use an 'include' pattern." source="TS6307" />
|
<error line="1" column="15" severity="error" message="File '/home/runner/work/woocommerce-blocks/woocommerce-blocks/packages/prices/utils/price.ts' is not listed within the file list of project '/home/runner/work/woocommerce-blocks/woocommerce-blocks/tsconfig.json'. Projects must list all files or use an 'include' pattern." source="TS6307" />
|
||||||
|
@ -266,7 +261,7 @@
|
||||||
Imported via '@woocommerce/price-format' from file '/home/runner/work/woocommerce-blocks/woocommerce-blocks/packages/checkout/components/totals/taxes/index.tsx'
|
Imported via '@woocommerce/price-format' from file '/home/runner/work/woocommerce-blocks/woocommerce-blocks/packages/checkout/components/totals/taxes/index.tsx'
|
||||||
Imported via '@woocommerce/price-format' from file '/home/runner/work/woocommerce-blocks/woocommerce-blocks/packages/checkout/components/totals/fees/index.tsx'
|
Imported via '@woocommerce/price-format' from file '/home/runner/work/woocommerce-blocks/woocommerce-blocks/packages/checkout/components/totals/fees/index.tsx'
|
||||||
Imported via '@woocommerce/price-format' from file '/home/runner/work/woocommerce-blocks/woocommerce-blocks/assets/js/base/components/product-price/index.tsx'
|
Imported via '@woocommerce/price-format' from file '/home/runner/work/woocommerce-blocks/woocommerce-blocks/assets/js/base/components/product-price/index.tsx'
|
||||||
Imported via '@woocommerce/price-format' from file '/home/runner/work/woocommerce-blocks/woocommerce-blocks/assets/js/atomic/blocks/product-elements/price/block.js'
|
Imported via '@woocommerce/price-format' from file '/home/runner/work/woocommerce-blocks/woocommerce-blocks/assets/js/atomic/blocks/product-elements/price/block.tsx'
|
||||||
Imported via '@woocommerce/price-format' from file '/home/runner/work/woocommerce-blocks/woocommerce-blocks/assets/js/base/context/hooks/payment-methods/use-payment-method-interface.ts'
|
Imported via '@woocommerce/price-format' from file '/home/runner/work/woocommerce-blocks/woocommerce-blocks/assets/js/base/context/hooks/payment-methods/use-payment-method-interface.ts'
|
||||||
Imported via '@woocommerce/price-format' from file '/home/runner/work/woocommerce-blocks/woocommerce-blocks/assets/js/base/components/cart-checkout/order-summary/order-summary-item.tsx'
|
Imported via '@woocommerce/price-format' from file '/home/runner/work/woocommerce-blocks/woocommerce-blocks/assets/js/base/components/cart-checkout/order-summary/order-summary-item.tsx'
|
||||||
Imported via '@woocommerce/price-format' from file '/home/runner/work/woocommerce-blocks/woocommerce-blocks/assets/js/base/components/cart-checkout/product-sale-badge/index.tsx'
|
Imported via '@woocommerce/price-format' from file '/home/runner/work/woocommerce-blocks/woocommerce-blocks/assets/js/base/components/cart-checkout/product-sale-badge/index.tsx'
|
||||||
|
@ -584,6 +579,15 @@
|
||||||
<error line="4" column="12" severity="error" message="Generic type 'Array<T>' requires 1 type argument(s)." source="TS2314" />
|
<error line="4" column="12" severity="error" message="Generic type 'Array<T>' requires 1 type argument(s)." source="TS2314" />
|
||||||
<error line="13" column="12" severity="error" message="Generic type 'Array<T>' requires 1 type argument(s)." source="TS2314" />
|
<error line="13" column="12" severity="error" message="Generic type 'Array<T>' requires 1 type argument(s)." source="TS2314" />
|
||||||
</file>
|
</file>
|
||||||
|
<file name="assets/js/base/components/block-error-boundary/index.tsx">
|
||||||
|
<error line="58" column="6" severity="error" message="Type '{ showErrorBlock: boolean; errorMessage: string | null; header: string | undefined; imageUrl: string | undefined; text: ReactNode; errorMessagePrefix: string | undefined; button: ReactNode; }' is not assignable to type 'BlockErrorProps' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
|
||||||
|
Types of property 'imageUrl' are incompatible.
|
||||||
|
Type 'string | undefined' is not assignable to type 'string'.
|
||||||
|
Type 'undefined' is not assignable to type 'string'." source="TS2375" />
|
||||||
|
<error line="58" column="6" severity="error" message="'BlockError' cannot be used as a JSX component.
|
||||||
|
Its return type 'ReactNode' is not a valid JSX element.
|
||||||
|
Type 'undefined' is not assignable to type 'Element | null'." source="TS2786" />
|
||||||
|
</file>
|
||||||
<file name="assets/js/base/utils/render-frontend.tsx">
|
<file name="assets/js/base/utils/render-frontend.tsx">
|
||||||
<error line="60" column="4" severity="error" message="No overload matches this call.
|
<error line="60" column="4" severity="error" message="No overload matches this call.
|
||||||
Overload 1 of 2, '(props: BlockErrorBoundaryProps | Readonly<BlockErrorBoundaryProps>): BlockErrorBoundary', gave the following error.
|
Overload 1 of 2, '(props: BlockErrorBoundaryProps | Readonly<BlockErrorBoundaryProps>): BlockErrorBoundary', gave the following error.
|
||||||
|
@ -636,22 +640,6 @@
|
||||||
<file name="assets/js/data/cart/controls.js">
|
<file name="assets/js/data/cart/controls.js">
|
||||||
<error line="18" column="31" severity="error" message="Parameter 'preserveCartData' implicitly has an 'any' type." source="TS7006" />
|
<error line="18" column="31" severity="error" message="Parameter 'preserveCartData' implicitly has an 'any' type." source="TS7006" />
|
||||||
</file>
|
</file>
|
||||||
<file name="assets/js/data/checkout/thunks.ts">
|
|
||||||
<error line="5" column="10" severity="error" message="Module '"@wordpress/notices"' has no exported member 'store'." source="TS2305" />
|
|
||||||
<error line="57" column="11" severity="error" message="Property 'createErrorNotice' does not exist on type 'typeof import("/home/runner/work/woocommerce-blocks/woocommerce-blocks/node_modules/@types/wordpress__rich-text/store/actions")'." source="TS2339" />
|
|
||||||
<error line="92" column="12" severity="error" message="Property 'createErrorNotice' does not exist on type 'typeof import("/home/runner/work/woocommerce-blocks/woocommerce-blocks/node_modules/@types/wordpress__rich-text/store/actions")'." source="TS2339" />
|
|
||||||
</file>
|
|
||||||
<file name="assets/js/data/checkout/reducers.ts">
|
|
||||||
<error line="164" column="25" severity="error" message="Property 'SET_PRISTINE' does not exist on type '{ readonly SET_IDLE: "SET_IDLE"; readonly SET_REDIRECT_URL: "SET_REDIRECT_URL"; readonly SET_COMPLETE: "SET_CHECKOUT_COMPLETE"; readonly SET_BEFORE_PROCESSING: "SET_BEFORE_PROCESSING"; ... 11 more ...; readonly SET_IS_CART: "SET_IS_CART"; }'." source="TS2339" />
|
|
||||||
</file>
|
|
||||||
<file name="assets/js/data/checkout/index.ts">
|
|
||||||
<error line="21" column="44" severity="error" message="Argument of type '{ reducer: (state: CheckoutState | undefined, action: actions.CheckoutAction) => CheckoutState; selectors: typeof selectors; actions: typeof actions; }' is not assignable to parameter of type 'StoreConfig<CheckoutState>'.
|
|
||||||
Types of property 'actions' are incompatible.
|
|
||||||
Type 'typeof import("/home/runner/work/woocommerce-blocks/woocommerce-blocks/assets/js/data/checkout/actions")' is not assignable to type '{ [k: string]: (...args: readonly any[]) => AnyAction | Generator<any, any, unknown>; }'.
|
|
||||||
Property '__internalProcessCheckoutResponse' is incompatible with index signature.
|
|
||||||
Type '(response: CheckoutResponse) => ({ dispatch, }: { dispatch: DispatchFromMap<typeof actions>; }) => void' is not assignable to type '(...args: readonly any[]) => AnyAction | Generator<any, any, unknown>'.
|
|
||||||
Type '({ dispatch, }: { dispatch: DispatchFromMap<typeof actions>; }) => void' is not assignable to type 'AnyAction | Generator<any, any, unknown>'." source="TS2345" />
|
|
||||||
</file>
|
|
||||||
<file name="assets/js/previews/cart.ts">
|
<file name="assets/js/previews/cart.ts">
|
||||||
<error line="75" column="4" severity="error" message="Property 'price_range' is missing in type '{ currency_code: "USD"; currency_symbol: string; currency_minor_unit: number; currency_decimal_separator: string; currency_thousand_separator: string; currency_prefix: string; currency_suffix: string; price: string; regular_price: string; sale_price: string; raw_prices: { ...; }; }' but required in type 'CartItemPrices'." source="TS2741" />
|
<error line="75" column="4" severity="error" message="Property 'price_range' is missing in type '{ currency_code: "USD"; currency_symbol: string; currency_minor_unit: number; currency_decimal_separator: string; currency_thousand_separator: string; currency_prefix: string; currency_suffix: string; price: string; regular_price: string; sale_price: string; raw_prices: { ...; }; }' but required in type 'CartItemPrices'." source="TS2741" />
|
||||||
<error line="141" column="4" severity="error" message="Property 'price_range' is missing in type '{ currency_code: "USD"; currency_symbol: string; currency_minor_unit: number; currency_decimal_separator: string; currency_thousand_separator: string; currency_prefix: string; currency_suffix: string; price: string; regular_price: string; sale_price: string; raw_prices: { ...; }; }' but required in type 'CartItemPrices'." source="TS2741" />
|
<error line="141" column="4" severity="error" message="Property 'price_range' is missing in type '{ currency_code: "USD"; currency_symbol: string; currency_minor_unit: number; currency_decimal_separator: string; currency_thousand_separator: string; currency_prefix: string; currency_suffix: string; price: string; regular_price: string; sale_price: string; raw_prices: { ...; }; }' but required in type 'CartItemPrices'." source="TS2741" />
|
||||||
|
@ -699,15 +687,31 @@
|
||||||
<error line="120" column="41" severity="error" message="Property 'validationErrors' does not exist on type 'never'." source="TS2339" />
|
<error line="120" column="41" severity="error" message="Property 'validationErrors' does not exist on type 'never'." source="TS2339" />
|
||||||
</file>
|
</file>
|
||||||
<file name="assets/js/data/payment/actions.ts">
|
<file name="assets/js/data/payment/actions.ts">
|
||||||
<error line="51" column="19" severity="error" message="Binding element 'select' implicitly has an 'any' type." source="TS7031" />
|
<error line="52" column="19" severity="error" message="Binding element 'select' implicitly has an 'any' type." source="TS7031" />
|
||||||
<error line="51" column="27" severity="error" message="Binding element 'dispatch' implicitly has an 'any' type." source="TS7031" />
|
<error line="52" column="27" severity="error" message="Binding element 'dispatch' implicitly has an 'any' type." source="TS7031" />
|
||||||
<error line="122" column="19" severity="error" message="Binding element 'dispatch' implicitly has an 'any' type." source="TS7031" />
|
<error line="133" column="19" severity="error" message="Binding element 'dispatch' implicitly has an 'any' type." source="TS7031" />
|
||||||
<error line="122" column="29" severity="error" message="Binding element 'select' implicitly has an 'any' type." source="TS7031" />
|
<error line="133" column="29" severity="error" message="Binding element 'select' implicitly has an 'any' type." source="TS7031" />
|
||||||
<error line="170" column="19" severity="error" message="Binding element 'select' implicitly has an 'any' type." source="TS7031" />
|
<error line="181" column="19" severity="error" message="Binding element 'select' implicitly has an 'any' type." source="TS7031" />
|
||||||
<error line="170" column="27" severity="error" message="Binding element 'dispatch' implicitly has an 'any' type." source="TS7031" />
|
<error line="181" column="27" severity="error" message="Binding element 'dispatch' implicitly has an 'any' type." source="TS7031" />
|
||||||
|
</file>
|
||||||
|
<file name="assets/js/data/checkout/thunks.ts">
|
||||||
|
<error line="5" column="10" severity="error" message="Module '"@wordpress/notices"' has no exported member 'store'." source="TS2305" />
|
||||||
|
<error line="63" column="11" severity="error" message="Property 'createErrorNotice' does not exist on type 'typeof import("/home/runner/work/woocommerce-blocks/woocommerce-blocks/node_modules/@types/wordpress__rich-text/store/actions")'." source="TS2339" />
|
||||||
|
<error line="98" column="12" severity="error" message="Property 'createErrorNotice' does not exist on type 'typeof import("/home/runner/work/woocommerce-blocks/woocommerce-blocks/node_modules/@types/wordpress__rich-text/store/actions")'." source="TS2339" />
|
||||||
|
</file>
|
||||||
|
<file name="assets/js/data/checkout/reducers.ts">
|
||||||
|
<error line="152" column="25" severity="error" message="Property 'SET_PRISTINE' does not exist on type '{ readonly SET_IDLE: "SET_IDLE"; readonly SET_REDIRECT_URL: "SET_REDIRECT_URL"; readonly SET_COMPLETE: "SET_CHECKOUT_COMPLETE"; readonly SET_BEFORE_PROCESSING: "SET_BEFORE_PROCESSING"; ... 10 more ...; readonly SET_IS_CART: "SET_IS_CART"; }'." source="TS2339" />
|
||||||
|
</file>
|
||||||
|
<file name="assets/js/data/checkout/index.ts">
|
||||||
|
<error line="21" column="44" severity="error" message="Argument of type '{ reducer: (state: CheckoutState | undefined, action: actions.CheckoutAction) => CheckoutState; selectors: typeof selectors; actions: typeof actions; }' is not assignable to parameter of type 'StoreConfig<CheckoutState>'.
|
||||||
|
Types of property 'actions' are incompatible.
|
||||||
|
Type 'typeof import("/home/runner/work/woocommerce-blocks/woocommerce-blocks/assets/js/data/checkout/actions")' is not assignable to type '{ [k: string]: (...args: readonly any[]) => AnyAction | Generator<any, any, unknown>; }'.
|
||||||
|
Property '__internalProcessCheckoutResponse' is incompatible with index signature.
|
||||||
|
Type '(response: CheckoutResponse) => ({ dispatch, }: { dispatch: DispatchFromMap<typeof actions>; }) => void' is not assignable to type '(...args: readonly any[]) => AnyAction | Generator<any, any, unknown>'.
|
||||||
|
Type '({ dispatch, }: { dispatch: DispatchFromMap<typeof actions>; }) => void' is not assignable to type 'AnyAction | Generator<any, any, unknown>'." source="TS2345" />
|
||||||
</file>
|
</file>
|
||||||
<file name="assets/js/data/payment/index.ts">
|
<file name="assets/js/data/payment/index.ts">
|
||||||
<error line="25" column="44" severity="error" message="Argument of type '{ reducer: Reducer<PaymentMethodDataState, AnyAction>; selectors: typeof selectors; actions: typeof actions; controls: any; }' is not assignable to parameter of type 'StoreConfig<PaymentMethodDataState>'.
|
<error line="25" column="44" severity="error" message="Argument of type '{ reducer: Reducer<PaymentState, AnyAction>; selectors: typeof selectors; actions: typeof actions; controls: any; }' is not assignable to parameter of type 'StoreConfig<PaymentState>'.
|
||||||
Types of property 'actions' are incompatible.
|
Types of property 'actions' are incompatible.
|
||||||
Type 'typeof import("/home/runner/work/woocommerce-blocks/woocommerce-blocks/assets/js/data/payment/actions")' is not assignable to type '{ [k: string]: (...args: readonly any[]) => AnyAction | Generator<any, any, unknown>; }'.
|
Type 'typeof import("/home/runner/work/woocommerce-blocks/woocommerce-blocks/assets/js/data/payment/actions")' is not assignable to type '{ [k: string]: (...args: readonly any[]) => AnyAction | Generator<any, any, unknown>; }'.
|
||||||
Property '__internalUpdateAvailablePaymentMethods' is incompatible with index signature.
|
Property '__internalUpdateAvailablePaymentMethods' is incompatible with index signature.
|
||||||
|
@ -761,18 +765,8 @@
|
||||||
No index signature with a parameter of type 'string' was found on type 'Object'." source="TS7053" />
|
No index signature with a parameter of type 'string' was found on type 'Object'." source="TS7053" />
|
||||||
</file>
|
</file>
|
||||||
<file name="assets/js/base/components/product-price/index.tsx">
|
<file name="assets/js/base/components/product-price/index.tsx">
|
||||||
<error line="285" column="5" severity="error" message="Type '{ currency: Currency | Record<string, never>; price: string | number; priceClassName: string | undefined; priceStyle: CSSProperties | undefined; regularPrice: string | number; regularPriceClassName: string | undefined; regularPriceStyle: CSSProperties | undefined; }' is not assignable to type 'SalePriceProps' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
|
<error line="173" column="5" severity="error" message="Type 'string | number | undefined' is not assignable to type 'string | number'.
|
||||||
Types of property 'regularPriceClassName' are incompatible.
|
Type 'undefined' is not assignable to type 'string | number'." source="TS2322" />
|
||||||
Type 'string | undefined' is not assignable to type 'string'.
|
|
||||||
Type 'undefined' is not assignable to type 'string'." source="TS2375" />
|
|
||||||
<error line="297" column="5" severity="error" message="Type '{ currency: Currency | Record<string, never>; maxPrice: string | number; minPrice: string | number; priceClassName: string | undefined; priceStyle: CSSProperties | undefined; }' is not assignable to type 'PriceRangeProps' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
|
|
||||||
Types of property 'priceClassName' are incompatible.
|
|
||||||
Type 'string | undefined' is not assignable to type 'string'.
|
|
||||||
Type 'undefined' is not assignable to type 'string'." source="TS2375" />
|
|
||||||
<error line="307" column="5" severity="error" message="Type '{ className: string; currency: Currency | Record<string, never>; value: string | number; style: CSSProperties | undefined; }' is not assignable to type 'FormattedMonetaryAmountProps' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
|
|
||||||
Types of property 'style' are incompatible.
|
|
||||||
Type 'CSSProperties | undefined' is not assignable to type 'CSSProperties'.
|
|
||||||
Type 'undefined' is not assignable to type 'Properties<string | number, string & {}>'." source="TS2375" />
|
|
||||||
</file>
|
</file>
|
||||||
<file name="assets/js/shared/context/inner-block-layout-context.js">
|
<file name="assets/js/shared/context/inner-block-layout-context.js">
|
||||||
<error line="26" column="2" severity="error" message="Binding element 'children' implicitly has an 'any' type." source="TS7031" />
|
<error line="26" column="2" severity="error" message="Binding element 'children' implicitly has an 'any' type." source="TS7031" />
|
||||||
|
@ -1100,10 +1094,6 @@
|
||||||
<error line="12" column="27" severity="error" message="Parameter 'OriginalComponent' implicitly has an 'any' type." source="TS7006" />
|
<error line="12" column="27" severity="error" message="Parameter 'OriginalComponent' implicitly has an 'any' type." source="TS7006" />
|
||||||
<error line="13" column="12" severity="error" message="Parameter 'ownProps' implicitly has an 'any' type." source="TS7006" />
|
<error line="13" column="12" severity="error" message="Parameter 'ownProps' implicitly has an 'any' type." source="TS7006" />
|
||||||
</file>
|
</file>
|
||||||
<file name="assets/js/atomic/blocks/product-elements/price/block.js">
|
|
||||||
<error line="52" column="18" severity="error" message="Type 'string | undefined' is not assignable to type '"center" | "left" | "right" | undefined' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the type of the target." source="TS2412" />
|
|
||||||
<error line="66" column="4" severity="error" message="Type 'string | undefined' is not assignable to type '"center" | "left" | "right" | undefined' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the type of the target." source="TS2412" />
|
|
||||||
</file>
|
|
||||||
<file name="assets/js/atomic/blocks/product-elements/button/block.js">
|
<file name="assets/js/atomic/blocks/product-elements/button/block.js">
|
||||||
<error line="100" column="3" severity="error" message="Property 'id' does not exist on type 'Object | undefined'." source="TS2339" />
|
<error line="100" column="3" severity="error" message="Property 'id' does not exist on type 'Object | undefined'." source="TS2339" />
|
||||||
<error line="101" column="3" severity="error" message="Property 'permalink' does not exist on type 'Object | undefined'." source="TS2339" />
|
<error line="101" column="3" severity="error" message="Property 'permalink' does not exist on type 'Object | undefined'." source="TS2339" />
|
||||||
|
@ -1316,14 +1306,9 @@
|
||||||
Type '{ text: true; background: true; link: false; gradients: true; __experimentalSkipSerialization: true; }' is not assignable to type 'Partial<ColorProps>'.
|
Type '{ text: true; background: true; link: false; gradients: true; __experimentalSkipSerialization: true; }' is not assignable to type 'Partial<ColorProps>'.
|
||||||
Object literal may only specify known properties, and '__experimentalSkipSerialization' does not exist in type 'Partial<ColorProps>'." source="TS2322" />
|
Object literal may only specify known properties, and '__experimentalSkipSerialization' does not exist in type 'Partial<ColorProps>'." source="TS2322" />
|
||||||
</file>
|
</file>
|
||||||
<file name="assets/js/atomic/blocks/product-elements/price/edit.js">
|
<file name="assets/js/atomic/blocks/product-elements/rating/index.ts">
|
||||||
<error line="20" column="23" severity="error" message="Binding element 'attributes' implicitly has an 'any' type." source="TS7031" />
|
<error line="25" column="2" severity="error" message="Type '{ apiVersion: number; title: string; description: string; usesContext: string[]; ancestor: string[]; icon: { src: JSX.Element; }; attributes: { productId: { type: string; default: number; }; isDescendentOfQueryLoop: { ...; }; }; supports: { ...; }; edit: (props: any) => JSX.Element; }' is not assignable to type 'BlockConfiguration<{}>'.
|
||||||
<error line="20" column="35" severity="error" message="Binding element 'setAttributes' implicitly has an 'any' type." source="TS7031" />
|
Object literal may only specify known properties, and 'ancestor' does not exist in type 'BlockConfiguration<{}>'." source="TS2322" />
|
||||||
<error line="20" column="50" severity="error" message="Binding element 'context' implicitly has an 'any' type." source="TS7031" />
|
|
||||||
</file>
|
|
||||||
<file name="assets/js/atomic/blocks/product-elements/price/attributes.js">
|
|
||||||
<error line="20" column="3" severity="error" message="Type '{ textAlign: { type: string; }; productId: { type: string; default: number; }; isDescendentOfQueryLoop: { type: string; default: boolean; }; }' is not assignable to type '{ productId: { type: string; default: number; }; isDescendentOfQueryLoop: { type: string; default: boolean; }; }'.
|
|
||||||
Object literal may only specify known properties, and 'textAlign' does not exist in type '{ productId: { type: string; default: number; }; isDescendentOfQueryLoop: { type: string; default: boolean; }; }'." source="TS2322" />
|
|
||||||
</file>
|
</file>
|
||||||
<file name="assets/js/atomic/blocks/product-elements/button/edit.js">
|
<file name="assets/js/atomic/blocks/product-elements/button/edit.js">
|
||||||
<error line="13" column="18" severity="error" message="Binding element 'attributes' implicitly has an 'any' type." source="TS7031" />
|
<error line="13" column="18" severity="error" message="Binding element 'attributes' implicitly has an 'any' type." source="TS7031" />
|
||||||
|
@ -1344,6 +1329,9 @@
|
||||||
Types of parameters '__0' and 'props' are incompatible.
|
Types of parameters '__0' and 'props' are incompatible.
|
||||||
Property 'context' is missing in type 'BlockEditProps<{}> & { children?: ReactNode; }' but required in type '{ attributes: any; setAttributes: any; context: any; }'." source="TS2769" />
|
Property 'context' is missing in type 'BlockEditProps<{}> & { children?: ReactNode; }' but required in type '{ attributes: any; setAttributes: any; context: any; }'." source="TS2769" />
|
||||||
</file>
|
</file>
|
||||||
|
<file name="assets/js/editor-components/edit-product-link/index.js">
|
||||||
|
<error line="18" column="40" severity="error" message="Property 'productId' does not exist on type 'Object'." source="TS2339" />
|
||||||
|
</file>
|
||||||
<file name="assets/js/atomic/blocks/product-elements/sku/index.ts">
|
<file name="assets/js/atomic/blocks/product-elements/sku/index.ts">
|
||||||
<error line="25" column="2" severity="error" message="Type '{ apiVersion: number; title: string; description: string; icon: { src: JSX.Element; }; usesContext: string[]; ancestor: string[]; attributes: Record<string, Record<string, unknown>>; edit: (props: any) => JSX.Element; }' is not assignable to type 'BlockConfiguration<{}>'.
|
<error line="25" column="2" severity="error" message="Type '{ apiVersion: number; title: string; description: string; icon: { src: JSX.Element; }; usesContext: string[]; ancestor: string[]; attributes: Record<string, Record<string, unknown>>; edit: (props: any) => JSX.Element; }' is not assignable to type 'BlockConfiguration<{}>'.
|
||||||
Object literal may only specify known properties, and 'ancestor' does not exist in type 'BlockConfiguration<{}>'." source="TS2322" />
|
Object literal may only specify known properties, and 'ancestor' does not exist in type 'BlockConfiguration<{}>'." source="TS2322" />
|
||||||
|
@ -1361,11 +1349,24 @@
|
||||||
Type 'Readonly<{}>' is not assignable to type 'Record<string, unknown> & { className: string; }'.
|
Type 'Readonly<{}>' is not assignable to type 'Record<string, unknown> & { className: string; }'.
|
||||||
Property 'className' is missing in type 'Readonly<{}>' but required in type '{ className: string; }'." source="TS2322" />
|
Property 'className' is missing in type 'Readonly<{}>' but required in type '{ className: string; }'." source="TS2322" />
|
||||||
</file>
|
</file>
|
||||||
|
<file name="assets/js/atomic/blocks/product-elements/add-to-cart/edit.js">
|
||||||
|
<error line="25" column="18" severity="error" message="Binding element 'attributes' implicitly has an 'any' type." source="TS7031" />
|
||||||
|
<error line="25" column="30" severity="error" message="Binding element 'setAttributes' implicitly has an 'any' type." source="TS7031" />
|
||||||
|
<error line="36" column="21" severity="error" message="Type '{ productId: number; }' is not assignable to type 'IntrinsicAttributes & Object'.
|
||||||
|
Property 'productId' does not exist on type 'IntrinsicAttributes & Object'." source="TS2322" />
|
||||||
|
</file>
|
||||||
<file name="assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/variation-attributes/test/index.js">
|
<file name="assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/variation-attributes/test/index.js">
|
||||||
<error line="195" column="38" severity="error" message="Argument of type 'null' is not assignable to parameter of type 'Object'." source="TS2345" />
|
<error line="195" column="38" severity="error" message="Argument of type 'null' is not assignable to parameter of type 'Object'." source="TS2345" />
|
||||||
<error line="252" column="56" severity="error" message="Argument of type 'null' is not assignable to parameter of type 'Object'." source="TS2345" />
|
<error line="252" column="56" severity="error" message="Argument of type 'null' is not assignable to parameter of type 'Object'." source="TS2345" />
|
||||||
<error line="475" column="34" severity="error" message="Argument of type 'null' is not assignable to parameter of type 'Object | undefined'." source="TS2345" />
|
<error line="475" column="34" severity="error" message="Argument of type 'null' is not assignable to parameter of type 'Object | undefined'." source="TS2345" />
|
||||||
</file>
|
</file>
|
||||||
|
<file name="assets/js/atomic/blocks/product-elements/image/test/block.test.tsx">
|
||||||
|
<error line="66" column="6" severity="error" message="Type '{ name: string; id: number; fallbackAlt: string; permalink: string; images: { id: number; src: string; thumbnail: string; srcset: string; sizes: string; name: string; alt: string; }[]; }' is missing the following properties from type 'ProductResponseItem': parent, type, variation, sku, and 18 more." source="TS2740" />
|
||||||
|
<error line="100" column="6" severity="error" message="Type '{ name: string; id: number; fallbackAlt: string; permalink: string; images: never[]; }' is missing the following properties from type 'ProductResponseItem': parent, type, variation, sku, and 18 more." source="TS2740" />
|
||||||
|
<error line="133" column="6" severity="error" message="Type '{ name: string; id: number; fallbackAlt: string; permalink: string; images: { id: number; src: string; thumbnail: string; srcset: string; sizes: string; name: string; alt: string; }[]; }' is not assignable to type 'ProductResponseItem'." source="TS2322" />
|
||||||
|
<error line="163" column="6" severity="error" message="Type '{ name: string; id: number; fallbackAlt: string; permalink: string; images: never[]; }' is not assignable to type 'ProductResponseItem'." source="TS2322" />
|
||||||
|
<error line="191" column="6" severity="error" message="Type '{ name: string; id: number; fallbackAlt: string; permalink: string; images: never[]; }' is not assignable to type 'ProductResponseItem'." source="TS2322" />
|
||||||
|
</file>
|
||||||
<file name="assets/js/atomic/blocks/product-elements/title/test/block.test.js">
|
<file name="assets/js/atomic/blocks/product-elements/title/test/block.test.js">
|
||||||
<error line="22" column="33" severity="error" message="Type '{ id: number; name: string; permalink: string; }' is missing the following properties from type 'ProductResponseItem': parent, type, variation, sku, and 19 more." source="TS2740" />
|
<error line="22" column="33" severity="error" message="Type '{ id: number; name: string; permalink: string; }' is missing the following properties from type 'ProductResponseItem': parent, type, variation, sku, and 19 more." source="TS2740" />
|
||||||
<error line="23" column="7" severity="error" message="Type '{ showProductLink: false; }' is missing the following properties from type 'Attributes': headingLevel, align" source="TS2739" />
|
<error line="23" column="7" severity="error" message="Type '{ showProductLink: false; }' is missing the following properties from type 'Attributes': headingLevel, align" source="TS2739" />
|
||||||
|
@ -3688,17 +3689,27 @@
|
||||||
<error line="17" column="16" severity="error" message="Parameter 'value' implicitly has an 'any[]' type." source="TS7006" />
|
<error line="17" column="16" severity="error" message="Parameter 'value' implicitly has an 'any[]' type." source="TS7006" />
|
||||||
</file>
|
</file>
|
||||||
<file name="assets/js/blocks/single-product/edit/layout-editor.tsx">
|
<file name="assets/js/blocks/single-product/edit/layout-editor.tsx">
|
||||||
<error line="81" column="7" severity="error" message="Type '{}[][]' is not assignable to type 'readonly Template[]'.
|
<error line="89" column="7" severity="error" message="Type '{}[][]' is not assignable to type 'readonly Template[]'.
|
||||||
Type '{}[]' is not assignable to type 'Template'.
|
Type '{}[]' is not assignable to type 'Template'.
|
||||||
Target requires 1 element(s) but source may have fewer." source="TS2322" />
|
Target requires 1 element(s) but source may have fewer." source="TS2322" />
|
||||||
<error line="84" column="7" severity="error" message="Type 'false' is not assignable to type 'ComponentType<{}> | undefined'." source="TS2322" />
|
<error line="92" column="7" severity="error" message="Type 'false' is not assignable to type 'ComponentType<{}> | undefined'." source="TS2322" />
|
||||||
</file>
|
</file>
|
||||||
<file name="assets/js/blocks/single-product/edit/index.tsx">
|
<file name="assets/js/blocks/single-product/edit/index.tsx">
|
||||||
<error line="83" column="5" severity="error" message="No overload matches this call.
|
<error line="37" column="2" severity="error" message="Binding element 'className' implicitly has an 'any' type." source="TS7031" />
|
||||||
|
<error line="38" column="2" severity="error" message="Binding element 'attributes' implicitly has an 'any' type." source="TS7031" />
|
||||||
|
<error line="39" column="2" severity="error" message="Binding element 'setAttributes' implicitly has an 'any' type." source="TS7031" />
|
||||||
|
<error line="40" column="2" severity="error" message="Binding element 'error' implicitly has an 'any' type." source="TS7031" />
|
||||||
|
<error line="41" column="2" severity="error" message="Binding element 'getProduct' implicitly has an 'any' type." source="TS7031" />
|
||||||
|
<error line="42" column="2" severity="error" message="Binding element 'product' implicitly has an 'any' type." source="TS7031" />
|
||||||
|
<error line="43" column="2" severity="error" message="Binding element 'isLoading' implicitly has an 'any' type." source="TS7031" />
|
||||||
|
<error line="44" column="2" severity="error" message="Binding element 'clientId' implicitly has an 'any' type." source="TS7031" />
|
||||||
|
<error line="65" column="5" severity="error" message="No overload matches this call.
|
||||||
Overload 1 of 2, '(props: BlockErrorBoundaryProps | Readonly<BlockErrorBoundaryProps>): BlockErrorBoundary', gave the following error.
|
Overload 1 of 2, '(props: BlockErrorBoundaryProps | Readonly<BlockErrorBoundaryProps>): BlockErrorBoundary', gave the following error.
|
||||||
Property 'text' is missing in type '{ children: Element[]; header: string; }' but required in type 'Readonly<BlockErrorBoundaryProps>'.
|
Property 'text' is missing in type '{ children: Element[]; header: string; }' but required in type 'Readonly<BlockErrorBoundaryProps>'.
|
||||||
Overload 2 of 2, '(props: BlockErrorBoundaryProps, context: any): BlockErrorBoundary', gave the following error.
|
Overload 2 of 2, '(props: BlockErrorBoundaryProps, context: any): BlockErrorBoundary', gave the following error.
|
||||||
Property 'text' is missing in type '{ children: Element[]; header: string; }' but required in type 'Readonly<BlockErrorBoundaryProps>'." source="TS2769" />
|
Property 'text' is missing in type '{ children: Element[]; header: string; }' but required in type 'Readonly<BlockErrorBoundaryProps>'." source="TS2769" />
|
||||||
|
<error line="113" column="24" severity="error" message="Type '{ productId: any; }' is not assignable to type 'IntrinsicAttributes & Object'.
|
||||||
|
Property 'productId' does not exist on type 'IntrinsicAttributes & Object'." source="TS2322" />
|
||||||
</file>
|
</file>
|
||||||
<file name="assets/js/blocks/single-product/save.js">
|
<file name="assets/js/blocks/single-product/save.js">
|
||||||
<error line="7" column="18" severity="error" message="Binding element 'attributes' implicitly has an 'any' type." source="TS7031" />
|
<error line="7" column="18" severity="error" message="Binding element 'attributes' implicitly has an 'any' type." source="TS7031" />
|
||||||
|
|
Loading…
Reference in New Issue