Fixed Blocks Linting Errors (#42727)
This commit is contained in:
parent
dd255a2820
commit
ec9b7852f9
|
@ -119,6 +119,7 @@ const restrictedImports = [
|
|||
module.exports = {
|
||||
env: {
|
||||
browser: true,
|
||||
jest: true,
|
||||
},
|
||||
root: true,
|
||||
extends: [
|
||||
|
@ -192,7 +193,7 @@ module.exports = {
|
|||
'@wordpress/i18n-text-domain': [
|
||||
'error',
|
||||
{
|
||||
allowedTextDomain: [ 'woo-gutenberg-products-block' ],
|
||||
allowedTextDomain: [ 'woocommerce' ],
|
||||
},
|
||||
],
|
||||
'no-restricted-imports': [
|
||||
|
|
|
@ -54,10 +54,7 @@ const Edit = ( props: BlockEditProps< Attributes > ) => {
|
|||
<button
|
||||
className={ `single_add_to_cart_button button alt wp-element-button` }
|
||||
>
|
||||
{ __(
|
||||
'Add to cart',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'Add to cart', 'woocommerce' ) }
|
||||
</button>
|
||||
</Disabled>
|
||||
</div>
|
||||
|
|
|
@ -43,9 +43,7 @@ const Edit = ( { attributes, setAttributes }: EditProps ) => {
|
|||
>
|
||||
<EditProductLink productId={ product.id } />
|
||||
<InspectorControls>
|
||||
<PanelBody
|
||||
title={ __( 'Layout', 'woocommerce' ) }
|
||||
>
|
||||
<PanelBody title={ __( 'Layout', 'woocommerce' ) }>
|
||||
{ productSupportsAddToCartForm( product ) ? (
|
||||
<ToggleControl
|
||||
label={ __(
|
||||
|
|
|
@ -30,10 +30,7 @@ const AttributeSelectControl = ( {
|
|||
options = [],
|
||||
value = '',
|
||||
onChange = () => void 0,
|
||||
errorMessage = __(
|
||||
'Please select a value.',
|
||||
'woocommerce'
|
||||
),
|
||||
errorMessage = __( 'Please select a value.', 'woocommerce' ),
|
||||
}: Props ) => {
|
||||
const errorId = attributeName;
|
||||
|
||||
|
|
|
@ -165,8 +165,7 @@ const AddToCartButton = () => {
|
|||
className="wc-block-components-product-add-to-cart-button"
|
||||
href={ addToCartButtonData.url }
|
||||
text={
|
||||
addToCartButtonData.text ||
|
||||
__( 'View Product', 'woocommerce' )
|
||||
addToCartButtonData.text || __( 'View Product', 'woocommerce' )
|
||||
}
|
||||
onClick={ () => {
|
||||
dispatchStoreEvent( 'product-view-link', {
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
import { __ } from '@wordpress/i18n';
|
||||
|
||||
const ProductUnavailable = ( {
|
||||
reason = __(
|
||||
'Sorry, this product cannot be purchased.',
|
||||
'woocommerce'
|
||||
),
|
||||
reason = __( 'Sorry, this product cannot be purchased.', 'woocommerce' ),
|
||||
} ) => {
|
||||
return (
|
||||
<div className="wc-block-components-product-add-to-cart-unavailable">
|
||||
|
|
|
@ -51,17 +51,11 @@ const AddToCartButton = ( {
|
|||
const buttonText = addedToCart
|
||||
? sprintf(
|
||||
/* translators: %s number of products in cart. */
|
||||
_n(
|
||||
'%d in cart',
|
||||
'%d in cart',
|
||||
cartQuantity,
|
||||
'woocommerce'
|
||||
),
|
||||
_n( '%d in cart', '%d in cart', cartQuantity, 'woocommerce' ),
|
||||
cartQuantity
|
||||
)
|
||||
: decodeEntities(
|
||||
productCartDetails?.text ||
|
||||
__( 'Add to cart', 'woocommerce' )
|
||||
productCartDetails?.text || __( 'Add to cart', 'woocommerce' )
|
||||
);
|
||||
|
||||
const ButtonTag = allowAddToCart ? 'button' : 'a';
|
||||
|
|
|
@ -41,15 +41,8 @@ function WidthPanel( {
|
|||
}
|
||||
|
||||
return (
|
||||
<PanelBody
|
||||
title={ __( 'Width settings', 'woocommerce' ) }
|
||||
>
|
||||
<ButtonGroup
|
||||
aria-label={ __(
|
||||
'Button width',
|
||||
'woocommerce'
|
||||
) }
|
||||
>
|
||||
<PanelBody title={ __( 'Width settings', 'woocommerce' ) }>
|
||||
<ButtonGroup aria-label={ __( 'Button width', 'woocommerce' ) }>
|
||||
{ [ 25, 50, 75, 100 ].map( ( widthValue ) => {
|
||||
return (
|
||||
<Button
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import { image, Icon } from '@wordpress/icons';
|
||||
|
||||
export const BLOCK_TITLE: string = __(
|
||||
'Product Image',
|
||||
'woocommerce'
|
||||
);
|
||||
export const BLOCK_TITLE: string = __( 'Product Image', 'woocommerce' );
|
||||
export const BLOCK_ICON: JSX.Element = (
|
||||
<Icon icon={ image } className="wc-block-editor-components-block-icon" />
|
||||
);
|
||||
|
|
|
@ -73,14 +73,9 @@ const Edit = ( {
|
|||
height={ height }
|
||||
setAttributes={ setAttributes }
|
||||
/>
|
||||
<PanelBody
|
||||
title={ __( 'Content', 'woocommerce' ) }
|
||||
>
|
||||
<PanelBody title={ __( 'Content', 'woocommerce' ) }>
|
||||
<ToggleControl
|
||||
label={ __(
|
||||
'Link to Product Page',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Link to Product Page', 'woocommerce' ) }
|
||||
help={ __(
|
||||
'Links the image to the single product listing.',
|
||||
'woocommerce'
|
||||
|
@ -93,10 +88,7 @@ const Edit = ( {
|
|||
}
|
||||
/>
|
||||
<ToggleControl
|
||||
label={ __(
|
||||
'Show On-Sale Badge',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Show On-Sale Badge', 'woocommerce' ) }
|
||||
help={ __(
|
||||
'Display a “sale” badge if the product is on-sale.',
|
||||
'woocommerce'
|
||||
|
@ -121,33 +113,21 @@ const Edit = ( {
|
|||
>
|
||||
<ToggleGroupControlOption
|
||||
value="left"
|
||||
label={ __(
|
||||
'Left',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Left', 'woocommerce' ) }
|
||||
/>
|
||||
<ToggleGroupControlOption
|
||||
value="center"
|
||||
label={ __(
|
||||
'Center',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Center', 'woocommerce' ) }
|
||||
/>
|
||||
<ToggleGroupControlOption
|
||||
value="right"
|
||||
label={ __(
|
||||
'Right',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Right', 'woocommerce' ) }
|
||||
/>
|
||||
</ToggleGroupControl>
|
||||
) }
|
||||
{ ! isBlockThemeEnabled && (
|
||||
<ToggleGroupControl
|
||||
label={ __(
|
||||
'Image Sizing',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Image Sizing', 'woocommerce' ) }
|
||||
help={ createInterpolateElement(
|
||||
__(
|
||||
'Product image cropping can be modified in the <a>Customizer</a>.',
|
||||
|
@ -173,17 +153,11 @@ const Edit = ( {
|
|||
>
|
||||
<ToggleGroupControlOption
|
||||
value={ ImageSizing.SINGLE }
|
||||
label={ __(
|
||||
'Full Size',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Full Size', 'woocommerce' ) }
|
||||
/>
|
||||
<ToggleGroupControlOption
|
||||
value={ ImageSizing.THUMBNAIL }
|
||||
label={ __(
|
||||
'Cropped',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Cropped', 'woocommerce' ) }
|
||||
/>
|
||||
</ToggleGroupControl>
|
||||
) }
|
||||
|
|
|
@ -99,24 +99,15 @@ export const ImageSizeSettings = ( {
|
|||
<>
|
||||
<ToggleGroupControlOption
|
||||
value="cover"
|
||||
label={ __(
|
||||
'Cover',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Cover', 'woocommerce' ) }
|
||||
/>
|
||||
<ToggleGroupControlOption
|
||||
value="contain"
|
||||
label={ __(
|
||||
'Contain',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Contain', 'woocommerce' ) }
|
||||
/>
|
||||
<ToggleGroupControlOption
|
||||
value="fill"
|
||||
label={ __(
|
||||
'Fill',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Fill', 'woocommerce' ) }
|
||||
/>
|
||||
</>
|
||||
</ToggleGroupControl>
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import { currencyDollar, Icon } from '@wordpress/icons';
|
||||
|
||||
export const BLOCK_TITLE: string = __(
|
||||
'Product Price',
|
||||
'woocommerce'
|
||||
);
|
||||
export const BLOCK_TITLE: string = __( 'Product Price', 'woocommerce' );
|
||||
export const BLOCK_ICON: JSX.Element = (
|
||||
<Icon
|
||||
icon={ currencyDollar }
|
||||
|
|
|
@ -29,10 +29,7 @@ const Edit = () => {
|
|||
[
|
||||
'core/post-terms',
|
||||
{
|
||||
prefix: __(
|
||||
'Category: ',
|
||||
'woocommerce'
|
||||
),
|
||||
prefix: __( 'Category: ', 'woocommerce' ),
|
||||
term: 'product_cat',
|
||||
},
|
||||
],
|
||||
|
|
|
@ -26,12 +26,7 @@ export const ProductReviews = () => {
|
|||
) }
|
||||
</p>
|
||||
</Notice>
|
||||
<h2>
|
||||
{ __(
|
||||
'3 reviews for this product',
|
||||
'woocommerce'
|
||||
) }
|
||||
</h2>
|
||||
<h2>{ __( '3 reviews for this product', 'woocommerce' ) }</h2>
|
||||
<img
|
||||
src={ `${ WC_BLOCKS_IMAGE_URL }block-placeholders/product-reviews.svg` }
|
||||
alt="Placeholder"
|
||||
|
@ -39,21 +34,11 @@ export const ProductReviews = () => {
|
|||
<h3>{ __( 'Add a review', 'woocommerce' ) }</h3>
|
||||
<div className="wp-block-woocommerce-product-reviews__editor__form-container">
|
||||
<div className="wp-block-woocommerce-product-reviews__editor__row">
|
||||
<span>
|
||||
{ __(
|
||||
'Your rating *',
|
||||
'woocommerce'
|
||||
) }
|
||||
</span>
|
||||
<span>{ __( 'Your rating *', 'woocommerce' ) }</span>
|
||||
<p className="wp-block-woocommerce-product-reviews__editor__stars"></p>
|
||||
</div>
|
||||
<div className="wp-block-woocommerce-product-reviews__editor__row">
|
||||
<span>
|
||||
{ __(
|
||||
'Your review *',
|
||||
'woocommerce'
|
||||
) }
|
||||
</span>
|
||||
<span>{ __( 'Your review *', 'woocommerce' ) }</span>
|
||||
<textarea />
|
||||
</div>
|
||||
<input
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import { starEmpty, Icon } from '@wordpress/icons';
|
||||
|
||||
export const BLOCK_TITLE: string = __(
|
||||
'Product Rating',
|
||||
'woocommerce'
|
||||
);
|
||||
export const BLOCK_TITLE: string = __( 'Product Rating', 'woocommerce' );
|
||||
export const BLOCK_ICON: JSX.Element = (
|
||||
<Icon
|
||||
icon={ starEmpty }
|
||||
|
|
|
@ -53,10 +53,7 @@ export const Block = ( props: Props ): JSX.Element | null => {
|
|||
>
|
||||
<Label
|
||||
label={ __( 'Sale', 'woocommerce' ) }
|
||||
screenReaderLabel={ __(
|
||||
'Product on sale',
|
||||
'woocommerce'
|
||||
) }
|
||||
screenReaderLabel={ __( 'Product on sale', 'woocommerce' ) }
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import { percent, Icon } from '@wordpress/icons';
|
||||
|
||||
export const BLOCK_TITLE: string = __(
|
||||
'On-Sale Badge',
|
||||
'woocommerce'
|
||||
);
|
||||
export const BLOCK_TITLE: string = __( 'On-Sale Badge', 'woocommerce' );
|
||||
export const BLOCK_ICON: JSX.Element = (
|
||||
<Icon icon={ percent } className="wc-block-editor-components-block-icon" />
|
||||
);
|
||||
|
|
|
@ -62,10 +62,7 @@ export const ProductSelector = ( {
|
|||
<TextToolbarButton
|
||||
onClick={ () => setIsEditing( true ) }
|
||||
>
|
||||
{ __(
|
||||
'Switch product…',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'Switch product…', 'woocommerce' ) }
|
||||
</TextToolbarButton>
|
||||
</ToolbarGroup>
|
||||
</BlockControls>
|
||||
|
|
|
@ -75,10 +75,7 @@ const withProductSelector = ( selectorArgs ) => ( OriginalComponent ) => {
|
|||
<TextToolbarButton
|
||||
onClick={ () => setIsEditing( true ) }
|
||||
>
|
||||
{ __(
|
||||
'Switch product…',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'Switch product…', 'woocommerce' ) }
|
||||
</TextToolbarButton>
|
||||
</ToolbarGroup>
|
||||
</BlockControls>
|
||||
|
|
|
@ -36,8 +36,7 @@ const Preview = ( {
|
|||
} ) }
|
||||
style={ style }
|
||||
>
|
||||
{ __( 'SKU:', 'woocommerce' ) }{ ' ' }
|
||||
<strong>{ sku }</strong>
|
||||
{ __( 'SKU:', 'woocommerce' ) } <strong>{ sku }</strong>
|
||||
</div>
|
||||
);
|
||||
|
||||
|
|
|
@ -5,10 +5,7 @@ import { __ } from '@wordpress/i18n';
|
|||
import { barcode } from '@woocommerce/icons';
|
||||
import { Icon } from '@wordpress/icons';
|
||||
|
||||
export const BLOCK_TITLE: string = __(
|
||||
'Product SKU',
|
||||
'woocommerce'
|
||||
);
|
||||
export const BLOCK_TITLE: string = __( 'Product SKU', 'woocommerce' );
|
||||
export const BLOCK_ICON: JSX.Element = (
|
||||
<Icon icon={ barcode } className="wc-block-editor-components-block-icon" />
|
||||
);
|
||||
|
|
|
@ -24,11 +24,11 @@ import type { BlockAttributes } from './types';
|
|||
* - Available on backorder
|
||||
* - 2 left in stock
|
||||
*
|
||||
* @param stockInfo Object containing stock information.
|
||||
* @param stockInfo.isInStock Whether product is in stock.
|
||||
* @param stockInfo.isLowStock Whether product is low in stock.
|
||||
* @param stockInfo.lowStockAmount Number of items left in stock.
|
||||
* @param stockInfo.isOnBackorder Whether product is on backorder.
|
||||
* @param stockInfo Object containing stock information.
|
||||
* @param stockInfo.isInStock Whether product is in stock.
|
||||
* @param stockInfo.isLowStock Whether product is low in stock.
|
||||
* @param stockInfo.lowStockAmount Number of items left in stock.
|
||||
* @param stockInfo.isOnBackorder Whether product is on backorder.
|
||||
* @return string Stock text.
|
||||
*/
|
||||
const getTextBasedOnStock = ( {
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import { page, Icon } from '@wordpress/icons';
|
||||
|
||||
export const BLOCK_TITLE: string = __(
|
||||
'Product Summary',
|
||||
'woocommerce'
|
||||
);
|
||||
export const BLOCK_TITLE: string = __( 'Product Summary', 'woocommerce' );
|
||||
export const BLOCK_ICON: JSX.Element = (
|
||||
<Icon icon={ page } className="wc-block-editor-components-block-icon" />
|
||||
);
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import { heading, Icon } from '@wordpress/icons';
|
||||
|
||||
export const BLOCK_TITLE: string = __(
|
||||
'Product Title',
|
||||
'woocommerce'
|
||||
);
|
||||
export const BLOCK_TITLE: string = __( 'Product Title', 'woocommerce' );
|
||||
export const BLOCK_ICON: JSX.Element = (
|
||||
<Icon icon={ heading } className="wc-block-editor-components-block-icon" />
|
||||
);
|
||||
|
|
|
@ -52,17 +52,9 @@ const TitleEdit = ( { attributes, setAttributes }: Props ): JSX.Element => {
|
|||
) }
|
||||
</BlockControls>
|
||||
<InspectorControls>
|
||||
<PanelBody
|
||||
title={ __(
|
||||
'Link settings',
|
||||
'woocommerce'
|
||||
) }
|
||||
>
|
||||
<PanelBody title={ __( 'Link settings', 'woocommerce' ) }>
|
||||
<ToggleControl
|
||||
label={ __(
|
||||
'Make title a link',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Make title a link', 'woocommerce' ) }
|
||||
checked={ showProductLink }
|
||||
onChange={ () =>
|
||||
setAttributes( {
|
||||
|
@ -73,10 +65,7 @@ const TitleEdit = ( { attributes, setAttributes }: Props ): JSX.Element => {
|
|||
{ showProductLink && (
|
||||
<>
|
||||
<ToggleControl
|
||||
label={ __(
|
||||
'Open in new tab',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Open in new tab', 'woocommerce' ) }
|
||||
onChange={ ( value ) =>
|
||||
setAttributes( {
|
||||
linkTarget: value ? '_blank' : '_self',
|
||||
|
|
|
@ -12,10 +12,7 @@ import type { BlockErrorProps } from './types';
|
|||
const BlockError = ( {
|
||||
imageUrl = `${ WC_BLOCKS_IMAGE_URL }/block-error.svg`,
|
||||
header = __( 'Oops!', 'woocommerce' ),
|
||||
text = __(
|
||||
'There was an error loading the content.',
|
||||
'woocommerce'
|
||||
),
|
||||
text = __( 'There was an error loading the content.', 'woocommerce' ),
|
||||
errorMessage,
|
||||
errorMessagePrefix = __( 'Error:', 'woocommerce' ),
|
||||
button,
|
||||
|
|
|
@ -28,10 +28,7 @@ const customValidationHandler = (
|
|||
} )
|
||||
) {
|
||||
inputObject.setCustomValidity(
|
||||
__(
|
||||
'Please enter a valid postcode',
|
||||
'woocommerce'
|
||||
)
|
||||
__( 'Please enter a valid postcode', 'woocommerce' )
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -23,10 +23,7 @@ const validateShippingCountry = ( values: ShippingAddress ): void => {
|
|||
} else {
|
||||
dispatch( VALIDATION_STORE_KEY ).setValidationErrors( {
|
||||
[ validationErrorId ]: {
|
||||
message: __(
|
||||
'Please select your country',
|
||||
'woocommerce'
|
||||
),
|
||||
message: __( 'Please select your country', 'woocommerce' ),
|
||||
hidden: false,
|
||||
},
|
||||
} );
|
||||
|
|
|
@ -341,10 +341,7 @@ const CartLineItemRow: React.ForwardRefExoticComponent<
|
|||
} }
|
||||
disabled={ isPendingDelete }
|
||||
>
|
||||
{ __(
|
||||
'Remove item',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'Remove item', 'woocommerce' ) }
|
||||
</button>
|
||||
) }
|
||||
</div>
|
||||
|
|
|
@ -79,19 +79,13 @@ const CartLineItemsTable = ( {
|
|||
<thead>
|
||||
<tr className="wc-block-cart-items__header">
|
||||
<th className="wc-block-cart-items__header-image">
|
||||
<span>
|
||||
{ __( 'Product', 'woocommerce' ) }
|
||||
</span>
|
||||
<span>{ __( 'Product', 'woocommerce' ) }</span>
|
||||
</th>
|
||||
<th className="wc-block-cart-items__header-product">
|
||||
<span>
|
||||
{ __( 'Details', 'woocommerce' ) }
|
||||
</span>
|
||||
<span>{ __( 'Details', 'woocommerce' ) }</span>
|
||||
</th>
|
||||
<th className="wc-block-cart-items__header-total">
|
||||
<span>
|
||||
{ __( 'Total', 'woocommerce' ) }
|
||||
</span>
|
||||
<span>{ __( 'Total', 'woocommerce' ) }</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
@ -27,10 +27,7 @@ const Policies = (): JSX.Element => {
|
|||
>
|
||||
{ PRIVACY_PAGE_NAME
|
||||
? decodeEntities( PRIVACY_PAGE_NAME )
|
||||
: __(
|
||||
'Privacy Policy',
|
||||
'woocommerce'
|
||||
) }
|
||||
: __( 'Privacy Policy', 'woocommerce' ) }
|
||||
</a>
|
||||
</li>
|
||||
) }
|
||||
|
@ -43,10 +40,7 @@ const Policies = (): JSX.Element => {
|
|||
>
|
||||
{ TERMS_PAGE_NAME
|
||||
? decodeEntities( TERMS_PAGE_NAME )
|
||||
: __(
|
||||
'Terms and Conditions',
|
||||
'woocommerce'
|
||||
) }
|
||||
: __( 'Terms and Conditions', 'woocommerce' ) }
|
||||
</a>
|
||||
</li>
|
||||
) }
|
||||
|
|
|
@ -109,10 +109,7 @@ const ShippingRatesControl = ( {
|
|||
return (
|
||||
<LoadingMask
|
||||
isLoading={ isLoadingRates }
|
||||
screenReaderLabel={ __(
|
||||
'Loading shipping rates…',
|
||||
'woocommerce'
|
||||
) }
|
||||
screenReaderLabel={ __( 'Loading shipping rates…', 'woocommerce' ) }
|
||||
showSpinner={ true }
|
||||
>
|
||||
{ hasSelectedLocalPickup &&
|
||||
|
|
|
@ -92,10 +92,7 @@ export const TotalsCoupon = ( {
|
|||
role="button"
|
||||
href="#wc-block-components-totals-coupon__form"
|
||||
className="wc-block-components-totals-coupon-link"
|
||||
aria-label={ __(
|
||||
'Add a coupon',
|
||||
'woocommerce'
|
||||
) }
|
||||
aria-label={ __( 'Add a coupon', 'woocommerce' ) }
|
||||
onClick={ handleCouponAnchorClick }
|
||||
>
|
||||
{ __( 'Add a coupon', 'woocommerce' ) }
|
||||
|
@ -118,10 +115,7 @@ export const TotalsCoupon = ( {
|
|||
id={ textInputId }
|
||||
errorId="coupon"
|
||||
className="wc-block-components-totals-coupon__input"
|
||||
label={ __(
|
||||
'Enter code',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Enter code', 'woocommerce' ) }
|
||||
value={ couponValue }
|
||||
ariaDescribedBy={ validationErrorId }
|
||||
onChange={ ( newCouponValue ) => {
|
||||
|
@ -138,10 +132,7 @@ export const TotalsCoupon = ( {
|
|||
onClick={ handleCouponSubmit }
|
||||
type="submit"
|
||||
>
|
||||
{ __(
|
||||
'Apply',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'Apply', 'woocommerce' ) }
|
||||
</Button>
|
||||
</form>
|
||||
<ValidationInputError
|
||||
|
|
|
@ -90,10 +90,7 @@ const TotalsDiscount = ( {
|
|||
text={ cartCoupon.label }
|
||||
screenReaderText={ sprintf(
|
||||
/* translators: %s Coupon code. */
|
||||
__(
|
||||
'Coupon: %s',
|
||||
'woocommerce'
|
||||
),
|
||||
__( 'Coupon: %s', 'woocommerce' ),
|
||||
cartCoupon.label
|
||||
) }
|
||||
disabled={ isRemovingCoupon }
|
||||
|
|
|
@ -86,10 +86,7 @@ const TotalsFooterItem = ( {
|
|||
} )
|
||||
.join( ', ' )
|
||||
)
|
||||
: __(
|
||||
'Including <TaxAmount/> in taxes',
|
||||
'woocommerce'
|
||||
);
|
||||
: __( 'Including <TaxAmount/> in taxes', 'woocommerce' );
|
||||
|
||||
return (
|
||||
<TotalsItem
|
||||
|
|
|
@ -51,10 +51,7 @@ export const ShippingAddress = ( {
|
|||
) }
|
||||
{ showCalculator && (
|
||||
<CalculatorButton
|
||||
label={ __(
|
||||
'Change address',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Change address', 'woocommerce' ) }
|
||||
isShippingCalculatorOpen={ isShippingCalculatorOpen }
|
||||
setIsShippingCalculatorOpen={ setIsShippingCalculatorOpen }
|
||||
/>
|
||||
|
|
|
@ -25,24 +25,15 @@ export const ShippingPlaceholder = ( {
|
|||
return (
|
||||
<em>
|
||||
{ isCheckout
|
||||
? __(
|
||||
'No shipping options available',
|
||||
'woocommerce'
|
||||
)
|
||||
: __(
|
||||
'Calculated during checkout',
|
||||
'woocommerce'
|
||||
) }
|
||||
? __( 'No shipping options available', 'woocommerce' )
|
||||
: __( 'Calculated during checkout', 'woocommerce' ) }
|
||||
</em>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<CalculatorButton
|
||||
label={ __(
|
||||
'Add an address for shipping options',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Add an address for shipping options', 'woocommerce' ) }
|
||||
isShippingCalculatorOpen={ isShippingCalculatorOpen }
|
||||
setIsShippingCalculatorOpen={ setIsShippingCalculatorOpen }
|
||||
/>
|
||||
|
|
|
@ -46,10 +46,7 @@ const Combobox = ( {
|
|||
options,
|
||||
value,
|
||||
required = false,
|
||||
errorMessage = __(
|
||||
'Please select a value.',
|
||||
'woocommerce'
|
||||
),
|
||||
errorMessage = __( 'Please select a value.', 'woocommerce' ),
|
||||
errorId: incomingErrorId,
|
||||
instanceId = '0',
|
||||
autoComplete = 'off',
|
||||
|
|
|
@ -23,10 +23,7 @@ export const CountryInput = ( {
|
|||
autoComplete = 'off',
|
||||
required = false,
|
||||
errorId,
|
||||
errorMessage = __(
|
||||
'Please select a country',
|
||||
'woocommerce'
|
||||
),
|
||||
errorMessage = __( 'Please select a country', 'woocommerce' ),
|
||||
}: CountryInputWithCountriesProps ): JSX.Element => {
|
||||
const options = useMemo(
|
||||
() =>
|
||||
|
|
|
@ -32,12 +32,7 @@ const FilterElementLabel = ( {
|
|||
label={ count.toString() }
|
||||
screenReaderLabel={ sprintf(
|
||||
/* translators: %s number of products. */
|
||||
_n(
|
||||
'%s product',
|
||||
'%s products',
|
||||
count,
|
||||
'woocommerce'
|
||||
),
|
||||
_n( '%s product', '%s products', count, 'woocommerce' ),
|
||||
count
|
||||
) }
|
||||
wrapperElement="span"
|
||||
|
|
|
@ -42,8 +42,7 @@ const LoadingMask = ( {
|
|||
</div>
|
||||
{ isLoading && (
|
||||
<span className="screen-reader-text">
|
||||
{ screenReaderLabel ||
|
||||
__( 'Loading…', 'woocommerce' ) }
|
||||
{ screenReaderLabel || __( 'Loading…', 'woocommerce' ) }
|
||||
</span>
|
||||
) }
|
||||
</div>
|
||||
|
|
|
@ -75,10 +75,7 @@ const NoticeBanner = ( {
|
|||
<Button
|
||||
className="wc-block-components-notice-banner__dismiss"
|
||||
icon={ close }
|
||||
label={ __(
|
||||
'Dismiss this notice',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Dismiss this notice', 'woocommerce' ) }
|
||||
onClick={ dismiss }
|
||||
showTooltip={ false }
|
||||
/>
|
||||
|
|
|
@ -90,10 +90,7 @@ const Pagination = ( {
|
|||
<button
|
||||
className="wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow"
|
||||
onClick={ () => onPageChange( currentPage - 1 ) }
|
||||
title={ __(
|
||||
'Previous page',
|
||||
'woocommerce'
|
||||
) }
|
||||
title={ __( 'Previous page', 'woocommerce' ) }
|
||||
disabled={ currentPage <= 1 }
|
||||
>
|
||||
<Label
|
||||
|
@ -212,10 +209,7 @@ const Pagination = ( {
|
|||
>
|
||||
<Label
|
||||
label="→"
|
||||
screenReaderLabel={ __(
|
||||
'Next page',
|
||||
'woocommerce'
|
||||
) }
|
||||
screenReaderLabel={ __( 'Next page', 'woocommerce' ) }
|
||||
/>
|
||||
</button>
|
||||
) }
|
||||
|
|
|
@ -21,10 +21,7 @@ const ProductSortSelect = ( {
|
|||
options={ [
|
||||
{
|
||||
key: 'menu_order',
|
||||
label: __(
|
||||
'Default sorting',
|
||||
'woocommerce'
|
||||
),
|
||||
label: __( 'Default sorting', 'woocommerce' ),
|
||||
},
|
||||
{
|
||||
key: 'popularity',
|
||||
|
@ -32,10 +29,7 @@ const ProductSortSelect = ( {
|
|||
},
|
||||
{
|
||||
key: 'rating',
|
||||
label: __(
|
||||
'Average rating',
|
||||
'woocommerce'
|
||||
),
|
||||
label: __( 'Average rating', 'woocommerce' ),
|
||||
},
|
||||
{
|
||||
key: 'date',
|
||||
|
@ -43,23 +37,14 @@ const ProductSortSelect = ( {
|
|||
},
|
||||
{
|
||||
key: 'price',
|
||||
label: __(
|
||||
'Price: low to high',
|
||||
'woocommerce'
|
||||
),
|
||||
label: __( 'Price: low to high', 'woocommerce' ),
|
||||
},
|
||||
{
|
||||
key: 'price-desc',
|
||||
label: __(
|
||||
'Price: high to low',
|
||||
'woocommerce'
|
||||
),
|
||||
label: __( 'Price: high to low', 'woocommerce' ),
|
||||
},
|
||||
] }
|
||||
screenReaderLabel={ __(
|
||||
'Order products by',
|
||||
'woocommerce'
|
||||
) }
|
||||
screenReaderLabel={ __( 'Order products by', 'woocommerce' ) }
|
||||
value={ value }
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -52,10 +52,7 @@ const PriceRange = ( {
|
|||
<span className="screen-reader-text">
|
||||
{ sprintf(
|
||||
/* translators: %1$s min price, %2$s max price */
|
||||
__(
|
||||
'Price between %1$s and %2$s',
|
||||
'woocommerce'
|
||||
),
|
||||
__( 'Price between %1$s and %2$s', 'woocommerce' ),
|
||||
formatPrice( minPrice ),
|
||||
formatPrice( maxPrice )
|
||||
) }
|
||||
|
|
|
@ -183,10 +183,7 @@ const QuantitySelector = ( {
|
|||
} }
|
||||
aria-label={ sprintf(
|
||||
/* translators: %s refers to the item name in the cart. */
|
||||
__(
|
||||
'Quantity of %s in your cart.',
|
||||
'woocommerce'
|
||||
),
|
||||
__( 'Quantity of %s in your cart.', 'woocommerce' ),
|
||||
itemName
|
||||
) }
|
||||
/>
|
||||
|
@ -194,10 +191,7 @@ const QuantitySelector = ( {
|
|||
ref={ decreaseButtonRef }
|
||||
aria-label={ sprintf(
|
||||
/* translators: %s refers to the item name in the cart. */
|
||||
__(
|
||||
'Reduce quantity of %s',
|
||||
'woocommerce'
|
||||
),
|
||||
__( 'Reduce quantity of %s', 'woocommerce' ),
|
||||
itemName
|
||||
) }
|
||||
className="wc-block-components-quantity-selector__button wc-block-components-quantity-selector__button--minus"
|
||||
|
@ -208,10 +202,7 @@ const QuantitySelector = ( {
|
|||
speak(
|
||||
sprintf(
|
||||
/* translators: %s refers to the item's new quantity in the cart. */
|
||||
__(
|
||||
'Quantity reduced to %s.',
|
||||
'woocommerce'
|
||||
),
|
||||
__( 'Quantity reduced to %s.', 'woocommerce' ),
|
||||
newQuantity
|
||||
)
|
||||
);
|
||||
|
@ -224,10 +215,7 @@ const QuantitySelector = ( {
|
|||
ref={ increaseButtonRef }
|
||||
aria-label={ sprintf(
|
||||
/* translators: %s refers to the item's name in the cart. */
|
||||
__(
|
||||
'Increase quantity of %s',
|
||||
'woocommerce'
|
||||
),
|
||||
__( 'Increase quantity of %s', 'woocommerce' ),
|
||||
itemName
|
||||
) }
|
||||
disabled={ ! canIncrease }
|
||||
|
@ -238,10 +226,7 @@ const QuantitySelector = ( {
|
|||
speak(
|
||||
sprintf(
|
||||
/* translators: %s refers to the item's new quantity in the cart. */
|
||||
__(
|
||||
'Quantity increased to %s.',
|
||||
'woocommerce'
|
||||
),
|
||||
__( 'Quantity increased to %s.', 'woocommerce' ),
|
||||
newQuantity
|
||||
)
|
||||
);
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
// count symbols like one char
|
||||
function getCharArr( rowCut ) {
|
||||
// eslint-disable-next-line prefer-const
|
||||
let charArr = [],
|
||||
subRow,
|
||||
match,
|
||||
char;
|
||||
|
||||
for ( let i = 0; i < rowCut.length; i++ ) {
|
||||
subRow = rowCut.substring( i );
|
||||
match = subRow.match( /^&[a-z0-9#]+;/ );
|
||||
|
||||
if ( match ) {
|
||||
char = match[ 0 ];
|
||||
charArr.push( char );
|
||||
i += char.length - 1;
|
||||
} else {
|
||||
charArr.push( rowCut[ i ] );
|
||||
}
|
||||
}
|
||||
|
||||
return charArr;
|
||||
}
|
||||
|
||||
// Copy-pasted from https://github.com/brankosekulic/trimHtml/blob/master/index.js
|
||||
// the published npm version of this code contains a bug that causes it throw exceptions.
|
||||
export function trimHtml( html, options ) {
|
||||
|
@ -131,27 +155,3 @@ export function trimHtml( html, options ) {
|
|||
more,
|
||||
};
|
||||
}
|
||||
|
||||
// count symbols like one char
|
||||
function getCharArr( rowCut ) {
|
||||
// eslint-disable-next-line prefer-const
|
||||
let charArr = [],
|
||||
subRow,
|
||||
match,
|
||||
char;
|
||||
|
||||
for ( let i = 0; i < rowCut.length; i++ ) {
|
||||
subRow = rowCut.substring( i );
|
||||
match = subRow.match( /^&[a-z0-9#]+;/ );
|
||||
|
||||
if ( match ) {
|
||||
char = match[ 0 ];
|
||||
charArr.push( char );
|
||||
i += char.length - 1;
|
||||
} else {
|
||||
charArr.push( rowCut[ i ] );
|
||||
}
|
||||
}
|
||||
|
||||
return charArr;
|
||||
}
|
||||
|
|
|
@ -44,10 +44,7 @@ function getReviewImage(
|
|||
{ review.verified && (
|
||||
<div
|
||||
className="wc-block-review-list-item__verified wc-block-components-review-list-item__verified"
|
||||
title={ __(
|
||||
'Verified buyer',
|
||||
'woocommerce'
|
||||
) }
|
||||
title={ __( 'Verified buyer', 'woocommerce' ) }
|
||||
>
|
||||
{ __( 'Verified buyer', 'woocommerce' ) }
|
||||
</div>
|
||||
|
@ -60,14 +57,8 @@ function getReviewContent( review: Review ): JSX.Element {
|
|||
return (
|
||||
<ReadMore
|
||||
maxLines={ 10 }
|
||||
moreText={ __(
|
||||
'Read full review',
|
||||
'woocommerce'
|
||||
) }
|
||||
lessText={ __(
|
||||
'Hide full review',
|
||||
'woocommerce'
|
||||
) }
|
||||
moreText={ __( 'Read full review', 'woocommerce' ) }
|
||||
lessText={ __( 'Hide full review', 'woocommerce' ) }
|
||||
className="wc-block-review-list-item__text wc-block-components-review-list-item__text"
|
||||
>
|
||||
<div
|
||||
|
|
|
@ -33,24 +33,15 @@ const ReviewSortSelect = ( {
|
|||
},
|
||||
{
|
||||
key: 'highest-rating',
|
||||
label: __(
|
||||
'Highest rating',
|
||||
'woocommerce'
|
||||
),
|
||||
label: __( 'Highest rating', 'woocommerce' ),
|
||||
},
|
||||
{
|
||||
key: 'lowest-rating',
|
||||
label: __(
|
||||
'Lowest rating',
|
||||
'woocommerce'
|
||||
),
|
||||
label: __( 'Lowest rating', 'woocommerce' ),
|
||||
},
|
||||
] }
|
||||
readOnly={ readOnly }
|
||||
screenReaderLabel={ __(
|
||||
'Order reviews by',
|
||||
'woocommerce'
|
||||
) }
|
||||
screenReaderLabel={ __( 'Order reviews by', 'woocommerce' ) }
|
||||
value={ value }
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -101,10 +101,7 @@ const StateInput = ( {
|
|||
onChange={ onChangeState }
|
||||
options={ options }
|
||||
value={ value }
|
||||
errorMessage={ __(
|
||||
'Please select a state.',
|
||||
'woocommerce'
|
||||
) }
|
||||
errorMessage={ __( 'Please select a state.', 'woocommerce' ) }
|
||||
errorId={ errorId }
|
||||
required={ required }
|
||||
autoComplete={ autoComplete }
|
||||
|
|
|
@ -48,21 +48,13 @@ export const prepareTotalItems = (
|
|||
};
|
||||
|
||||
newTotals.push(
|
||||
factory(
|
||||
__( 'Subtotal:', 'woocommerce' ),
|
||||
'total_items'
|
||||
)
|
||||
factory( __( 'Subtotal:', 'woocommerce' ), 'total_items' )
|
||||
);
|
||||
|
||||
newTotals.push(
|
||||
factory( __( 'Fees:', 'woocommerce' ), 'total_fees' )
|
||||
);
|
||||
newTotals.push( factory( __( 'Fees:', 'woocommerce' ), 'total_fees' ) );
|
||||
|
||||
newTotals.push(
|
||||
factory(
|
||||
__( 'Discount:', 'woocommerce' ),
|
||||
'total_discount'
|
||||
)
|
||||
factory( __( 'Discount:', 'woocommerce' ), 'total_discount' )
|
||||
);
|
||||
|
||||
newTotals.push( {
|
||||
|
@ -74,10 +66,7 @@ export const prepareTotalItems = (
|
|||
|
||||
if ( needsShipping ) {
|
||||
newTotals.push(
|
||||
factory(
|
||||
__( 'Shipping:', 'woocommerce' ),
|
||||
'total_shipping'
|
||||
)
|
||||
factory( __( 'Shipping:', 'woocommerce' ), 'total_shipping' )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ export const useQueryStateByKey = ( queryKey, defaultValue, context ) => {
|
|||
const store = select( storeKey );
|
||||
return store.getValueForQueryKey( context, queryKey, defaultValue );
|
||||
},
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[ context, queryKey ]
|
||||
);
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ const AddToCartFormContext = createContext( {
|
|||
* @return {AddToCartFormContext} Returns the add to cart form data context value
|
||||
*/
|
||||
export const useAddToCartFormContext = () => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
return useContext( AddToCartFormContext );
|
||||
};
|
||||
|
@ -315,6 +316,7 @@ export const AddToCartFormStateContextProvider = ( {
|
|||
};
|
||||
return (
|
||||
<AddToCartFormContext.Provider
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
value={ contextData }
|
||||
>
|
||||
|
|
|
@ -37,6 +37,7 @@ describe( 'usePositionRelativeToViewport', () => {
|
|||
const observe = jest.fn();
|
||||
const unobserve = jest.fn();
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
IntersectionObserver = jest.fn( () => ( {
|
||||
observe,
|
||||
|
@ -61,8 +62,10 @@ describe( 'usePositionRelativeToViewport', () => {
|
|||
( { position, isIntersecting, top } ) => {
|
||||
let intersectionObserverCallback = ( entries ) => entries;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
IntersectionObserver = jest.fn( ( callback ) => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
intersectionObserverCallback = callback;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ const generateRate = (
|
|||
price: string,
|
||||
instanceID: number,
|
||||
selected = false
|
||||
): typeof testPackage.shipping_rates[ 0 ] => {
|
||||
): ( typeof testPackage.shipping_rates )[ 0 ] => {
|
||||
return {
|
||||
rate_id: rateId,
|
||||
name,
|
||||
|
|
|
@ -8,6 +8,47 @@ import deprecated from '@wordpress/deprecated';
|
|||
*/
|
||||
import { registeredBlockComponents } from './registered-block-components-init';
|
||||
|
||||
/**
|
||||
* Asserts that an option is of the given type. Otherwise, throws an error.
|
||||
*
|
||||
* @throws Will throw an error if the type of the option doesn't match the expected type.
|
||||
* @param {Object} options Object containing the option to validate.
|
||||
* @param {string} optionName Name of the option to validate.
|
||||
* @param {string} expectedType Type expected for the option.
|
||||
*/
|
||||
const assertOption = ( options, optionName, expectedType ) => {
|
||||
const actualType = typeof options[ optionName ];
|
||||
if ( actualType !== expectedType ) {
|
||||
throw new Error(
|
||||
`Incorrect value for the ${ optionName } argument when registering a block component. It was a ${ actualType }, but must be a ${ expectedType }.`
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Asserts that an option is a valid react element or lazy callback. Otherwise, throws an error.
|
||||
*
|
||||
* @throws Will throw an error if the type of the option doesn't match the expected type.
|
||||
* @param {Object} options Object containing the option to validate.
|
||||
* @param {string} optionName Name of the option to validate.
|
||||
*/
|
||||
const assertBlockComponent = ( options, optionName ) => {
|
||||
if ( options[ optionName ] ) {
|
||||
if ( typeof options[ optionName ] === 'function' ) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
options[ optionName ].$$typeof &&
|
||||
options[ optionName ].$$typeof === Symbol.for( 'react.lazy' )
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new Error(
|
||||
`Incorrect value for the ${ optionName } argument when registering a block component. Component must be a valid React Element or Lazy callback.`
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Register a Block Component.
|
||||
*
|
||||
|
@ -42,47 +83,6 @@ export function registerBlockComponent( options ) {
|
|||
registeredBlockComponents[ context ][ blockName ] = component;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that an option is a valid react element or lazy callback. Otherwise, throws an error.
|
||||
*
|
||||
* @throws Will throw an error if the type of the option doesn't match the expected type.
|
||||
* @param {Object} options Object containing the option to validate.
|
||||
* @param {string} optionName Name of the option to validate.
|
||||
*/
|
||||
const assertBlockComponent = ( options, optionName ) => {
|
||||
if ( options[ optionName ] ) {
|
||||
if ( typeof options[ optionName ] === 'function' ) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
options[ optionName ].$$typeof &&
|
||||
options[ optionName ].$$typeof === Symbol.for( 'react.lazy' )
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new Error(
|
||||
`Incorrect value for the ${ optionName } argument when registering a block component. Component must be a valid React Element or Lazy callback.`
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Asserts that an option is of the given type. Otherwise, throws an error.
|
||||
*
|
||||
* @throws Will throw an error if the type of the option doesn't match the expected type.
|
||||
* @param {Object} options Object containing the option to validate.
|
||||
* @param {string} optionName Name of the option to validate.
|
||||
* @param {string} expectedType Type expected for the option.
|
||||
*/
|
||||
const assertOption = ( options, optionName, expectedType ) => {
|
||||
const actualType = typeof options[ optionName ];
|
||||
if ( actualType !== expectedType ) {
|
||||
throw new Error(
|
||||
`Incorrect value for the ${ optionName } argument when registering a block component. It was a ${ actualType }, but must be a ${ expectedType }.`
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Alias of registerBlockComponent kept for backwards compatibility.
|
||||
*
|
||||
|
|
|
@ -96,10 +96,7 @@ const ActiveFiltersBlock = ( {
|
|||
return null;
|
||||
}
|
||||
|
||||
const stockStatusLabel = __(
|
||||
'Stock Status',
|
||||
'woocommerce'
|
||||
);
|
||||
const stockStatusLabel = __( 'Stock Status', 'woocommerce' );
|
||||
|
||||
return (
|
||||
<li>
|
||||
|
@ -258,10 +255,7 @@ const ActiveFiltersBlock = ( {
|
|||
type: ratingLabel,
|
||||
name: sprintf(
|
||||
/* translators: %s is referring to the average rating value */
|
||||
__(
|
||||
'Rated %s out of 5',
|
||||
'woocommerce'
|
||||
),
|
||||
__( 'Rated %s out of 5', 'woocommerce' ),
|
||||
slug
|
||||
),
|
||||
removeCallback: () => {
|
||||
|
@ -349,25 +343,13 @@ const ActiveFiltersBlock = ( {
|
|||
{ isEditor ? (
|
||||
<>
|
||||
{ renderRemovableListItem( {
|
||||
type: __(
|
||||
'Size',
|
||||
'woocommerce'
|
||||
),
|
||||
name: __(
|
||||
'Small',
|
||||
'woocommerce'
|
||||
),
|
||||
type: __( 'Size', 'woocommerce' ),
|
||||
name: __( 'Small', 'woocommerce' ),
|
||||
displayStyle: blockAttributes.displayStyle,
|
||||
} ) }
|
||||
{ renderRemovableListItem( {
|
||||
type: __(
|
||||
'Color',
|
||||
'woocommerce'
|
||||
),
|
||||
name: __(
|
||||
'Blue',
|
||||
'woocommerce'
|
||||
),
|
||||
type: __( 'Color', 'woocommerce' ),
|
||||
name: __( 'Blue', 'woocommerce' ),
|
||||
displayStyle: blockAttributes.displayStyle,
|
||||
} ) }
|
||||
</>
|
||||
|
@ -401,10 +383,7 @@ const ActiveFiltersBlock = ( {
|
|||
} }
|
||||
>
|
||||
<Label
|
||||
label={ __(
|
||||
'Clear All',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Clear All', 'woocommerce' ) }
|
||||
screenReaderLabel={ __(
|
||||
'Clear All Filters',
|
||||
'woocommerce'
|
||||
|
|
|
@ -37,17 +37,9 @@ const Edit = ( {
|
|||
const getInspectorControls = () => {
|
||||
return (
|
||||
<InspectorControls key="inspector">
|
||||
<PanelBody
|
||||
title={ __(
|
||||
'Display Settings',
|
||||
'woocommerce'
|
||||
) }
|
||||
>
|
||||
<PanelBody title={ __( 'Display Settings', 'woocommerce' ) }>
|
||||
<ToggleGroupControl
|
||||
label={ __(
|
||||
'Display Style',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Display Style', 'woocommerce' ) }
|
||||
value={ displayStyle }
|
||||
onChange={ ( value: Attributes[ 'displayStyle' ] ) =>
|
||||
setAttributes( {
|
||||
|
@ -58,17 +50,11 @@ const Edit = ( {
|
|||
>
|
||||
<ToggleGroupControlOption
|
||||
value="list"
|
||||
label={ __(
|
||||
'List',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'List', 'woocommerce' ) }
|
||||
/>
|
||||
<ToggleGroupControlOption
|
||||
value="chips"
|
||||
label={ __(
|
||||
'Chips',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Chips', 'woocommerce' ) }
|
||||
/>
|
||||
</ToggleGroupControl>
|
||||
</PanelBody>
|
||||
|
|
|
@ -555,10 +555,7 @@ const AttributeFilterBlock = ( {
|
|||
disabled={ isLoading }
|
||||
placeholder={ sprintf(
|
||||
/* translators: %s attribute name. */
|
||||
__(
|
||||
'Select %s',
|
||||
'woocommerce'
|
||||
),
|
||||
__( 'Select %s', 'woocommerce' ),
|
||||
attributeObject.label
|
||||
) }
|
||||
onChange={ ( tokens: string[] ) => {
|
||||
|
@ -609,34 +606,22 @@ const AttributeFilterBlock = ( {
|
|||
messages={ {
|
||||
added: sprintf(
|
||||
/* translators: %s is the attribute label. */
|
||||
__(
|
||||
'%s filter added.',
|
||||
'woocommerce'
|
||||
),
|
||||
__( '%s filter added.', 'woocommerce' ),
|
||||
attributeObject.label
|
||||
),
|
||||
removed: sprintf(
|
||||
/* translators: %s is the attribute label. */
|
||||
__(
|
||||
'%s filter removed.',
|
||||
'woocommerce'
|
||||
),
|
||||
__( '%s filter removed.', 'woocommerce' ),
|
||||
attributeObject.label
|
||||
),
|
||||
remove: sprintf(
|
||||
/* translators: %s is the attribute label. */
|
||||
__(
|
||||
'Remove %s filter.',
|
||||
'woocommerce'
|
||||
),
|
||||
__( 'Remove %s filter.', 'woocommerce' ),
|
||||
attributeObject.label.toLocaleLowerCase()
|
||||
),
|
||||
__experimentalInvalid: sprintf(
|
||||
/* translators: %s is the attribute label. */
|
||||
__(
|
||||
'Invalid %s filter.',
|
||||
'woocommerce'
|
||||
),
|
||||
__( 'Invalid %s filter.', 'woocommerce' ),
|
||||
attributeObject.label.toLocaleLowerCase()
|
||||
),
|
||||
} }
|
||||
|
|
|
@ -127,19 +127,13 @@ const Edit = ( {
|
|||
isCompact: boolean;
|
||||
} ) => {
|
||||
const messages = {
|
||||
clear: __(
|
||||
'Clear selected attribute',
|
||||
'woocommerce'
|
||||
),
|
||||
clear: __( 'Clear selected attribute', 'woocommerce' ),
|
||||
list: __( 'Product Attributes', 'woocommerce' ),
|
||||
noItems: __(
|
||||
"Your store doesn't have any product attributes.",
|
||||
'woocommerce'
|
||||
),
|
||||
search: __(
|
||||
'Search for a product attribute:',
|
||||
'woocommerce'
|
||||
),
|
||||
search: __( 'Search for a product attribute:', 'woocommerce' ),
|
||||
selected: ( n: number ) =>
|
||||
sprintf(
|
||||
/* translators: %d is the number of attributes selected. */
|
||||
|
@ -182,17 +176,9 @@ const Edit = ( {
|
|||
const getInspectorControls = () => {
|
||||
return (
|
||||
<InspectorControls key="inspector">
|
||||
<PanelBody
|
||||
title={ __(
|
||||
'Display Settings',
|
||||
'woocommerce'
|
||||
) }
|
||||
>
|
||||
<PanelBody title={ __( 'Display Settings', 'woocommerce' ) }>
|
||||
<ToggleControl
|
||||
label={ __(
|
||||
'Display product count',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Display product count', 'woocommerce' ) }
|
||||
checked={ showCounts }
|
||||
onChange={ () =>
|
||||
setAttributes( {
|
||||
|
@ -215,25 +201,16 @@ const Edit = ( {
|
|||
>
|
||||
<ToggleGroupControlOption
|
||||
value="multiple"
|
||||
label={ __(
|
||||
'Multiple',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Multiple', 'woocommerce' ) }
|
||||
/>
|
||||
<ToggleGroupControlOption
|
||||
value="single"
|
||||
label={ __(
|
||||
'Single',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Single', 'woocommerce' ) }
|
||||
/>
|
||||
</ToggleGroupControl>
|
||||
{ selectType === 'multiple' && (
|
||||
<ToggleGroupControl
|
||||
label={ __(
|
||||
'Filter Conditions',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Filter Conditions', 'woocommerce' ) }
|
||||
help={
|
||||
queryType === 'and'
|
||||
? __(
|
||||
|
@ -255,25 +232,16 @@ const Edit = ( {
|
|||
>
|
||||
<ToggleGroupControlOption
|
||||
value="and"
|
||||
label={ __(
|
||||
'All',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'All', 'woocommerce' ) }
|
||||
/>
|
||||
<ToggleGroupControlOption
|
||||
value="or"
|
||||
label={ __(
|
||||
'Any',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Any', 'woocommerce' ) }
|
||||
/>
|
||||
</ToggleGroupControl>
|
||||
) }
|
||||
<ToggleGroupControl
|
||||
label={ __(
|
||||
'Display Style',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Display Style', 'woocommerce' ) }
|
||||
value={ displayStyle }
|
||||
onChange={ ( value: string ) =>
|
||||
setAttributes( {
|
||||
|
@ -284,17 +252,11 @@ const Edit = ( {
|
|||
>
|
||||
<ToggleGroupControlOption
|
||||
value="list"
|
||||
label={ __(
|
||||
'List',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'List', 'woocommerce' ) }
|
||||
/>
|
||||
<ToggleGroupControlOption
|
||||
value="dropdown"
|
||||
label={ __(
|
||||
'Dropdown',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Dropdown', 'woocommerce' ) }
|
||||
/>
|
||||
</ToggleGroupControl>
|
||||
<ToggleControl
|
||||
|
@ -315,10 +277,7 @@ const Edit = ( {
|
|||
/>
|
||||
</PanelBody>
|
||||
<PanelBody
|
||||
title={ __(
|
||||
'Content Settings',
|
||||
'woocommerce'
|
||||
) }
|
||||
title={ __( 'Content Settings', 'woocommerce' ) }
|
||||
initialOpen={ false }
|
||||
>
|
||||
{ renderAttributeControl( { isCompact: true } ) }
|
||||
|
@ -331,10 +290,7 @@ const Edit = ( {
|
|||
<Placeholder
|
||||
className="wc-block-attribute-filter"
|
||||
icon={ <Icon icon={ category } /> }
|
||||
label={ __(
|
||||
'Filter by Attribute',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Filter by Attribute', 'woocommerce' ) }
|
||||
instructions={ __(
|
||||
'Display a list of filters based on the selected attributes.',
|
||||
'woocommerce'
|
||||
|
@ -354,8 +310,7 @@ const Edit = ( {
|
|||
) }
|
||||
target="_top"
|
||||
>
|
||||
{ __( 'Add new attribute', 'woocommerce' ) +
|
||||
' ' }
|
||||
{ __( 'Add new attribute', 'woocommerce' ) + ' ' }
|
||||
<Icon icon={ external } />
|
||||
</Button>
|
||||
<Button
|
||||
|
@ -384,10 +339,7 @@ const Edit = ( {
|
|||
<Placeholder
|
||||
className="wc-block-attribute-filter"
|
||||
icon={ <Icon icon={ category } /> }
|
||||
label={ __(
|
||||
'Filter by Attribute',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Filter by Attribute', 'woocommerce' ) }
|
||||
>
|
||||
<div className="wc-block-attribute-filter__instructions">
|
||||
{ __(
|
||||
|
|
|
@ -17,9 +17,7 @@ const Edit = () => {
|
|||
return (
|
||||
<div { ...blockProps }>
|
||||
<Disabled>
|
||||
<a href="/">
|
||||
{ __( 'Breadcrumbs', 'woocommerce' ) }
|
||||
</a>
|
||||
<a href="/">{ __( 'Breadcrumbs', 'woocommerce' ) }</a>
|
||||
{ __( ' / Navigation / Path', 'woocommerce' ) }
|
||||
</Disabled>
|
||||
</div>
|
||||
|
|
|
@ -18,10 +18,7 @@ export const BlockSettings = ( {
|
|||
<InspectorControls>
|
||||
<PanelBody title={ __( 'Style', 'woocommerce' ) }>
|
||||
<ToggleControl
|
||||
label={ __(
|
||||
'Dark mode inputs',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Dark mode inputs', 'woocommerce' ) }
|
||||
help={ __(
|
||||
'Inputs styled specifically for use on dark background colors.',
|
||||
'woocommerce'
|
||||
|
|
|
@ -156,10 +156,7 @@ const ExpressPaymentMethods = () => {
|
|||
} )
|
||||
) : (
|
||||
<li key="noneRegistered">
|
||||
{ __(
|
||||
'No registered Payment Methods',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'No registered Payment Methods', 'woocommerce' ) }
|
||||
</li>
|
||||
);
|
||||
|
||||
|
|
|
@ -89,10 +89,7 @@ const CheckoutExpressPayment = () => {
|
|||
className="wc-block-components-express-payment__title"
|
||||
headingLevel="2"
|
||||
>
|
||||
{ __(
|
||||
'Express Checkout',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'Express Checkout', 'woocommerce' ) }
|
||||
</Title>
|
||||
</div>
|
||||
<div className="wc-block-components-express-payment__content">
|
||||
|
|
|
@ -45,10 +45,7 @@ const PaymentMethods = () => {
|
|||
<SavedPaymentMethodOptions />
|
||||
{ Object.keys( savedPaymentMethods ).length > 0 && (
|
||||
<Label
|
||||
label={ __(
|
||||
'Use another payment method.',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Use another payment method.', 'woocommerce' ) }
|
||||
screenReaderLabel={ __(
|
||||
'Other available payment methods',
|
||||
'woocommerce'
|
||||
|
|
|
@ -35,10 +35,7 @@ const getCcOrEcheckLabel = ( {
|
|||
} ): string => {
|
||||
return sprintf(
|
||||
/* translators: %1$s is referring to the payment method brand, %2$s is referring to the last 4 digits of the payment card, %3$s is referring to the expiry date. */
|
||||
__(
|
||||
'%1$s ending in %2$s (expires %3$s)',
|
||||
'woocommerce'
|
||||
),
|
||||
__( '%1$s ending in %2$s (expires %3$s)', 'woocommerce' ),
|
||||
method.brand,
|
||||
method.last4,
|
||||
expires
|
||||
|
|
|
@ -87,10 +87,7 @@ export const Switcher = ( {
|
|||
<BlockControls>
|
||||
<ToolbarGroup>
|
||||
<ToolbarDropdownMenu
|
||||
label={ __(
|
||||
'Switch view',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Switch view', 'woocommerce' ) }
|
||||
text={ currentViewLabel }
|
||||
icon={
|
||||
<Icon icon={ eye } style={ { marginRight: '8px' } } />
|
||||
|
|
|
@ -77,19 +77,13 @@ export const Edit = ( { clientId, className, attributes, setAttributes } ) => {
|
|||
/>
|
||||
</InspectorControls>
|
||||
<BlockErrorBoundary
|
||||
header={ __(
|
||||
'Cart Block Error',
|
||||
'woocommerce'
|
||||
) }
|
||||
header={ __( 'Cart Block Error', 'woocommerce' ) }
|
||||
text={ __(
|
||||
'There was an error whilst rendering the cart block. If this problem continues, try re-creating the block.',
|
||||
'woocommerce'
|
||||
) }
|
||||
showErrorMessage={ true }
|
||||
errorMessagePrefix={ __(
|
||||
'Error message:',
|
||||
'woocommerce'
|
||||
) }
|
||||
errorMessagePrefix={ __( 'Error message:', 'woocommerce' ) }
|
||||
>
|
||||
<EditorProvider
|
||||
previewData={ { previewCart } }
|
||||
|
|
|
@ -13,10 +13,7 @@ export const Edit = (): JSX.Element => {
|
|||
[
|
||||
'core/heading',
|
||||
{
|
||||
content: __(
|
||||
'You may be interested in…',
|
||||
'woocommerce'
|
||||
),
|
||||
content: __( 'You may be interested in…', 'woocommerce' ),
|
||||
level: 2,
|
||||
fontSize: 'large',
|
||||
},
|
||||
|
|
|
@ -30,9 +30,7 @@ export const Edit = ( { attributes, setAttributes }: Props ): JSX.Element => {
|
|||
return (
|
||||
<div { ...blockProps }>
|
||||
<InspectorControls>
|
||||
<PanelBody
|
||||
title={ __( 'Settings', 'woocommerce' ) }
|
||||
>
|
||||
<PanelBody title={ __( 'Settings', 'woocommerce' ) }>
|
||||
<RangeControl
|
||||
label={ __(
|
||||
'Cross-Sells products to show',
|
||||
|
|
|
@ -32,10 +32,7 @@ export const Edit = ( {
|
|||
<InspectorControls>
|
||||
{ !! shippingEnabled && (
|
||||
<PanelBody
|
||||
title={ __(
|
||||
'Shipping Calculations',
|
||||
'woocommerce'
|
||||
) }
|
||||
title={ __( 'Shipping Calculations', 'woocommerce' ) }
|
||||
>
|
||||
<p className="wc-block-checkout__controls-text">
|
||||
{ __(
|
||||
|
@ -46,10 +43,7 @@ export const Edit = ( {
|
|||
<ExternalLink
|
||||
href={ `${ ADMIN_URL }admin.php?page=wc-settings&tab=shipping§ion=options` }
|
||||
>
|
||||
{ __(
|
||||
'Manage shipping options',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'Manage shipping options', 'woocommerce' ) }
|
||||
</ExternalLink>{ ' ' }
|
||||
</PanelBody>
|
||||
) }
|
||||
|
|
|
@ -38,12 +38,7 @@ export const Edit = ( {
|
|||
{ taxesEnabled &&
|
||||
displayItemizedTaxes &&
|
||||
! displayCartPricesIncludingTax && (
|
||||
<PanelBody
|
||||
title={ __(
|
||||
'Taxes',
|
||||
'woocommerce'
|
||||
) }
|
||||
>
|
||||
<PanelBody title={ __( 'Taxes', 'woocommerce' ) }>
|
||||
<ToggleControl
|
||||
label={ __(
|
||||
'Show rate after tax name',
|
||||
|
|
|
@ -23,10 +23,7 @@ const browseStoreTemplate = SHOP_URL
|
|||
align: 'center',
|
||||
content: sprintf(
|
||||
/* translators: %s is the link to the store product directory. */
|
||||
__(
|
||||
'<a href="%s">Browse store</a>',
|
||||
'woocommerce'
|
||||
),
|
||||
__( '<a href="%s">Browse store</a>', 'woocommerce' ),
|
||||
SHOP_URL
|
||||
),
|
||||
dropCap: false,
|
||||
|
@ -39,10 +36,7 @@ const defaultTemplate = [
|
|||
'core/heading',
|
||||
{
|
||||
textAlign: 'center',
|
||||
content: __(
|
||||
'Your cart is currently empty!',
|
||||
'woocommerce'
|
||||
),
|
||||
content: __( 'Your cart is currently empty!', 'woocommerce' ),
|
||||
level: 2,
|
||||
className: 'with-empty-cart-icon wc-block-cart__empty-cart__title',
|
||||
},
|
||||
|
|
|
@ -3,7 +3,4 @@
|
|||
*/
|
||||
import { __ } from '@wordpress/i18n';
|
||||
|
||||
export const defaultButtonLabel = __(
|
||||
'Proceed to Checkout',
|
||||
'woocommerce'
|
||||
);
|
||||
export const defaultButtonLabel = __( 'Proceed to Checkout', 'woocommerce' );
|
||||
|
|
|
@ -8,9 +8,7 @@ import { __ } from '@wordpress/i18n';
|
|||
const CatalogSorting = () => {
|
||||
return (
|
||||
<select className="orderby">
|
||||
<option>
|
||||
{ __( 'Default sorting', 'woocommerce' ) }
|
||||
</option>
|
||||
<option>{ __( 'Default sorting', 'woocommerce' ) }</option>
|
||||
</select>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -63,10 +63,7 @@ const AddressCard = ( {
|
|||
role="button"
|
||||
href={ '#' + target }
|
||||
className="wc-block-components-address-card__edit"
|
||||
aria-label={ __(
|
||||
'Edit address',
|
||||
'woocommerce'
|
||||
) }
|
||||
aria-label={ __( 'Edit address', 'woocommerce' ) }
|
||||
onClick={ ( e ) => {
|
||||
onEdit();
|
||||
e.preventDefault();
|
||||
|
|
|
@ -34,15 +34,9 @@ import { CheckoutBlockContext } from './context';
|
|||
const MustLoginPrompt = () => {
|
||||
return (
|
||||
<div className="wc-block-must-login-prompt">
|
||||
{ __(
|
||||
'You must be logged in to checkout.',
|
||||
'woocommerce'
|
||||
) }{ ' ' }
|
||||
{ __( 'You must be logged in to checkout.', 'woocommerce' ) }{ ' ' }
|
||||
<a href={ LOGIN_TO_CHECKOUT_URL }>
|
||||
{ __(
|
||||
'Click here to log in.',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'Click here to log in.', 'woocommerce' ) }
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -30,6 +30,67 @@ const cartItemErrorCodes = [
|
|||
|
||||
const preloadedCheckoutData = getSetting( 'checkoutData', {} );
|
||||
|
||||
/**
|
||||
* Get the error message to display.
|
||||
*
|
||||
* @param {Object} props Incoming props for the component.
|
||||
* @param {Object} props.errorData Object containing code and message.
|
||||
*/
|
||||
const ErrorTitle = ( { errorData } ) => {
|
||||
let heading = __( 'Checkout error', 'woocommerce' );
|
||||
|
||||
if ( cartItemErrorCodes.includes( errorData.code ) ) {
|
||||
heading = __( 'There is a problem with your cart', 'woocommerce' );
|
||||
}
|
||||
|
||||
return (
|
||||
<strong className="wc-block-checkout-error_title">{ heading }</strong>
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the error message to display.
|
||||
*
|
||||
* @param {Object} props Incoming props for the component.
|
||||
* @param {Object} props.errorData Object containing code and message.
|
||||
*/
|
||||
const ErrorMessage = ( { errorData } ) => {
|
||||
let message = errorData.message;
|
||||
|
||||
if ( cartItemErrorCodes.includes( errorData.code ) ) {
|
||||
message =
|
||||
message +
|
||||
' ' +
|
||||
__( 'Please edit your cart and try again.', 'woocommerce' );
|
||||
}
|
||||
|
||||
return <p className="wc-block-checkout-error__description">{ message }</p>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the CTA button to display.
|
||||
*
|
||||
* @param {Object} props Incoming props for the component.
|
||||
* @param {Object} props.errorData Object containing code and message.
|
||||
*/
|
||||
const ErrorButton = ( { errorData } ) => {
|
||||
let buttonText = __( 'Retry', 'woocommerce' );
|
||||
let buttonUrl = 'javascript:window.location.reload(true)';
|
||||
|
||||
if ( cartItemErrorCodes.includes( errorData.code ) ) {
|
||||
buttonText = __( 'Edit your cart', 'woocommerce' );
|
||||
buttonUrl = CART_URL;
|
||||
}
|
||||
|
||||
return (
|
||||
<span className="wp-block-button">
|
||||
<a href={ buttonUrl } className="wp-block-button__link">
|
||||
{ buttonText }
|
||||
</a>
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* When an order was not created for the checkout, for example, when an item
|
||||
* was out of stock, this component will be shown instead of the checkout form.
|
||||
|
@ -68,71 +129,4 @@ const CheckoutOrderError = () => {
|
|||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the error message to display.
|
||||
*
|
||||
* @param {Object} props Incoming props for the component.
|
||||
* @param {Object} props.errorData Object containing code and message.
|
||||
*/
|
||||
const ErrorTitle = ( { errorData } ) => {
|
||||
let heading = __( 'Checkout error', 'woocommerce' );
|
||||
|
||||
if ( cartItemErrorCodes.includes( errorData.code ) ) {
|
||||
heading = __(
|
||||
'There is a problem with your cart',
|
||||
'woocommerce'
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<strong className="wc-block-checkout-error_title">{ heading }</strong>
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the error message to display.
|
||||
*
|
||||
* @param {Object} props Incoming props for the component.
|
||||
* @param {Object} props.errorData Object containing code and message.
|
||||
*/
|
||||
const ErrorMessage = ( { errorData } ) => {
|
||||
let message = errorData.message;
|
||||
|
||||
if ( cartItemErrorCodes.includes( errorData.code ) ) {
|
||||
message =
|
||||
message +
|
||||
' ' +
|
||||
__(
|
||||
'Please edit your cart and try again.',
|
||||
'woocommerce'
|
||||
);
|
||||
}
|
||||
|
||||
return <p className="wc-block-checkout-error__description">{ message }</p>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the CTA button to display.
|
||||
*
|
||||
* @param {Object} props Incoming props for the component.
|
||||
* @param {Object} props.errorData Object containing code and message.
|
||||
*/
|
||||
const ErrorButton = ( { errorData } ) => {
|
||||
let buttonText = __( 'Retry', 'woocommerce' );
|
||||
let buttonUrl = 'javascript:window.location.reload(true)';
|
||||
|
||||
if ( cartItemErrorCodes.includes( errorData.code ) ) {
|
||||
buttonText = __( 'Edit your cart', 'woocommerce' );
|
||||
buttonUrl = CART_URL;
|
||||
}
|
||||
|
||||
return (
|
||||
<span className="wp-block-button">
|
||||
<a href={ buttonUrl } className="wp-block-button__link">
|
||||
{ buttonText }
|
||||
</a>
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
export default CheckoutOrderError;
|
||||
|
|
|
@ -100,9 +100,7 @@ export const Edit = ( {
|
|||
|
||||
const addressFieldControls = (): JSX.Element => (
|
||||
<InspectorControls>
|
||||
<PanelBody
|
||||
title={ __( 'Address Fields', 'woocommerce' ) }
|
||||
>
|
||||
<PanelBody title={ __( 'Address Fields', 'woocommerce' ) }>
|
||||
<p className="wc-block-checkout__controls-text">
|
||||
{ __(
|
||||
'Show or hide fields in the checkout address forms.',
|
||||
|
@ -116,10 +114,7 @@ export const Edit = ( {
|
|||
/>
|
||||
{ showCompanyField && (
|
||||
<CheckboxControl
|
||||
label={ __(
|
||||
'Require company name?',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Require company name?', 'woocommerce' ) }
|
||||
checked={ requireCompanyField }
|
||||
onChange={ () =>
|
||||
toggleAttribute( 'requireCompanyField' )
|
||||
|
@ -128,10 +123,7 @@ export const Edit = ( {
|
|||
/>
|
||||
) }
|
||||
<ToggleControl
|
||||
label={ __(
|
||||
'Apartment, suite, etc.',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Apartment, suite, etc.', 'woocommerce' ) }
|
||||
checked={ showApartmentField }
|
||||
onChange={ () => toggleAttribute( 'showApartmentField' ) }
|
||||
/>
|
||||
|
@ -142,10 +134,7 @@ export const Edit = ( {
|
|||
/>
|
||||
{ showPhoneField && (
|
||||
<CheckboxControl
|
||||
label={ __(
|
||||
'Require phone number?',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Require phone number?', 'woocommerce' ) }
|
||||
checked={ requirePhoneField }
|
||||
onChange={ () =>
|
||||
toggleAttribute( 'requirePhoneField' )
|
||||
|
|
|
@ -20,10 +20,7 @@ const EmptyCart = () => {
|
|||
size={ 100 }
|
||||
/>
|
||||
<strong className="wc-block-checkout-empty__title">
|
||||
{ __(
|
||||
'Your cart is currently empty!',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'Your cart is currently empty!', 'woocommerce' ) }
|
||||
</strong>
|
||||
<p className="wc-block-checkout-empty__description">
|
||||
{ __(
|
||||
|
|
|
@ -5,10 +5,7 @@ import { __ } from '@wordpress/i18n';
|
|||
|
||||
const attributes = ( {
|
||||
defaultTitle = __( 'Step', 'woocommerce' ),
|
||||
defaultDescription = __(
|
||||
'Step description text.',
|
||||
'woocommerce'
|
||||
),
|
||||
defaultDescription = __( 'Step description text.', 'woocommerce' ),
|
||||
defaultShowStepNumber = true,
|
||||
}: {
|
||||
defaultTitle: string;
|
||||
|
|
|
@ -41,17 +41,9 @@ export const FormStepBlock = ( {
|
|||
return (
|
||||
<div { ...blockProps }>
|
||||
<InspectorControls>
|
||||
<PanelBody
|
||||
title={ __(
|
||||
'Form Step Options',
|
||||
'woocommerce'
|
||||
) }
|
||||
>
|
||||
<PanelBody title={ __( 'Form Step Options', 'woocommerce' ) }>
|
||||
<ToggleControl
|
||||
label={ __(
|
||||
'Show step number',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Show step number', 'woocommerce' ) }
|
||||
checked={ showStepNumber }
|
||||
onChange={ () =>
|
||||
setAttributes( {
|
||||
|
|
|
@ -3,7 +3,4 @@
|
|||
*/
|
||||
import { __ } from '@wordpress/i18n';
|
||||
|
||||
export const defaultPlaceOrderButtonLabel = __(
|
||||
'Place Order',
|
||||
'woocommerce'
|
||||
);
|
||||
export const defaultPlaceOrderButtonLabel = __( 'Place Order', 'woocommerce' );
|
||||
|
|
|
@ -51,12 +51,7 @@ export const Edit = ( {
|
|||
return (
|
||||
<div { ...blockProps }>
|
||||
<InspectorControls>
|
||||
<PanelBody
|
||||
title={ __(
|
||||
'Account options',
|
||||
'woocommerce'
|
||||
) }
|
||||
>
|
||||
<PanelBody title={ __( 'Account options', 'woocommerce' ) }>
|
||||
<ToggleControl
|
||||
label={ __(
|
||||
'Show a "Return to Cart" link',
|
||||
|
|
|
@ -3,10 +3,7 @@
|
|||
*/
|
||||
import { __ } from '@wordpress/i18n';
|
||||
|
||||
export const DEFAULT_TITLE = __(
|
||||
'Billing address',
|
||||
'woocommerce'
|
||||
);
|
||||
export const DEFAULT_TITLE = __( 'Billing address', 'woocommerce' );
|
||||
export const DEFAULT_DESCRIPTION = __(
|
||||
'Enter the billing address that matches your payment method.',
|
||||
'woocommerce'
|
||||
|
|
|
@ -10,10 +10,7 @@ import formStepAttributes from '../../form-step/attributes';
|
|||
|
||||
export default {
|
||||
...formStepAttributes( {
|
||||
defaultTitle: __(
|
||||
'Contact information',
|
||||
'woocommerce'
|
||||
),
|
||||
defaultTitle: __( 'Contact information', 'woocommerce' ),
|
||||
defaultDescription: __(
|
||||
"We'll use this email to send you details and updates about your order.",
|
||||
'woocommerce'
|
||||
|
|
|
@ -41,10 +41,7 @@ const Block = (): JSX.Element => {
|
|||
getSetting( 'checkoutAllowsSignup', false ) && (
|
||||
<CheckboxControl
|
||||
className="wc-block-checkout__create-account"
|
||||
label={ __(
|
||||
'Create an account?',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Create an account?', 'woocommerce' ) }
|
||||
checked={ shouldCreateAccount }
|
||||
onChange={ ( value ) =>
|
||||
__internalSetShouldCreateAccount( value )
|
||||
|
|
|
@ -56,10 +56,7 @@ export const Edit = ( {
|
|||
<ExternalLink
|
||||
href={ `${ ADMIN_URL }admin.php?page=wc-settings&tab=account` }
|
||||
>
|
||||
{ __(
|
||||
'Manage account settings',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'Manage account settings', 'woocommerce' ) }
|
||||
</ExternalLink>
|
||||
</PanelBody>
|
||||
</InspectorControls>
|
||||
|
|
|
@ -22,10 +22,7 @@ const LoginPrompt = () => {
|
|||
|
||||
return (
|
||||
<>
|
||||
{ __(
|
||||
'Already have an account? ',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'Already have an account? ', 'woocommerce' ) }
|
||||
<a href={ LOGIN_TO_CHECKOUT_URL }>
|
||||
{ __( 'Log in.', 'woocommerce' ) }
|
||||
</a>
|
||||
|
|
|
@ -45,10 +45,7 @@ const Block = ( { className }: { className?: string } ): JSX.Element => {
|
|||
'Notes about your order, e.g. special notes for delivery.',
|
||||
'woocommerce'
|
||||
)
|
||||
: __(
|
||||
'Notes about your order.',
|
||||
'woocommerce'
|
||||
)
|
||||
: __( 'Notes about your order.', 'woocommerce' )
|
||||
}
|
||||
value={ orderNotes }
|
||||
/>
|
||||
|
|
|
@ -38,12 +38,7 @@ export const Edit = ( {
|
|||
{ taxesEnabled &&
|
||||
displayItemizedTaxes &&
|
||||
! displayCartPricesIncludingTax && (
|
||||
<PanelBody
|
||||
title={ __(
|
||||
'Taxes',
|
||||
'woocommerce'
|
||||
) }
|
||||
>
|
||||
<PanelBody title={ __( 'Taxes', 'woocommerce' ) }>
|
||||
<ToggleControl
|
||||
label={ __(
|
||||
'Show rate after tax name',
|
||||
|
|
|
@ -64,12 +64,7 @@ export const Edit = ( {
|
|||
>
|
||||
<InspectorControls>
|
||||
{ globalPaymentMethods.length > 0 && (
|
||||
<PanelBody
|
||||
title={ __(
|
||||
'Methods',
|
||||
'woocommerce'
|
||||
) }
|
||||
>
|
||||
<PanelBody title={ __( 'Methods', 'woocommerce' ) }>
|
||||
<p className="wc-block-checkout__controls-text">
|
||||
{ __(
|
||||
'You currently have the following payment integrations active.',
|
||||
|
@ -118,10 +113,7 @@ export const Edit = ( {
|
|||
<ExternalLink
|
||||
href={ `${ ADMIN_URL }admin.php?page=wc-settings&tab=checkout` }
|
||||
>
|
||||
{ __(
|
||||
'Manage payment methods',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'Manage payment methods', 'woocommerce' ) }
|
||||
</ExternalLink>
|
||||
</PanelBody>
|
||||
) }
|
||||
|
|
|
@ -78,9 +78,7 @@ const renderPickupLocation = (
|
|||
const details = getPickupDetails( option );
|
||||
|
||||
// Default to showing "free" as the secondary label. Price checks below will update it if needed.
|
||||
let secondaryLabel = (
|
||||
<em>{ __( 'free', 'woocommerce' ) }</em>
|
||||
);
|
||||
let secondaryLabel = <em>{ __( 'free', 'woocommerce' ) }</em>;
|
||||
|
||||
// If there is a cost for local pickup, show the cost per package.
|
||||
if ( parseInt( priceWithTaxes, 10 ) > 0 ) {
|
||||
|
|
|
@ -127,10 +127,7 @@ const Block = ( {
|
|||
</WrapperComponent>
|
||||
<CheckboxControl
|
||||
className="wc-block-checkout__use-address-for-billing"
|
||||
label={ __(
|
||||
'Use same address for billing',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Use same address for billing', 'woocommerce' ) }
|
||||
checked={ useShippingAsBilling }
|
||||
onChange={ ( checked: boolean ) => {
|
||||
setUseShippingAsBilling( checked );
|
||||
|
|
|
@ -25,10 +25,7 @@ import { shippingAddressHasValidationErrors } from '../../../../data/cart/utils'
|
|||
|
||||
const SHIPPING_RATE_ERROR = {
|
||||
hidden: true,
|
||||
message: __(
|
||||
'Shipping options are not available',
|
||||
'woocommerce'
|
||||
),
|
||||
message: __( 'Shipping options are not available', 'woocommerce' ),
|
||||
};
|
||||
|
||||
const LocalPickupSelector = ( {
|
||||
|
@ -124,10 +121,7 @@ const ShippingSelector = ( {
|
|||
const Price =
|
||||
rate.min === undefined || rateShouldBeHidden ? (
|
||||
<span className="wc-block-checkout__shipping-method-option-price">
|
||||
{ __(
|
||||
'calculated with an address',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'calculated with an address', 'woocommerce' ) }
|
||||
</span>
|
||||
) : (
|
||||
<RatePrice minRate={ rate.min } maxRate={ rate.max } />
|
||||
|
|
|
@ -3,12 +3,6 @@
|
|||
*/
|
||||
import { __ } from '@wordpress/i18n';
|
||||
|
||||
export const defaultLocalPickupText = __(
|
||||
'Local Pickup',
|
||||
'woocommerce'
|
||||
);
|
||||
export const defaultLocalPickupText = __( 'Local Pickup', 'woocommerce' );
|
||||
|
||||
export const defaultShippingText = __(
|
||||
'Shipping',
|
||||
'woocommerce'
|
||||
);
|
||||
export const defaultShippingText = __( 'Shipping', 'woocommerce' );
|
||||
|
|
|
@ -106,10 +106,7 @@ const ShippingSelector = ( {
|
|||
const Price =
|
||||
rate.min === undefined ? (
|
||||
<span className="wc-block-checkout__shipping-method-option-price">
|
||||
{ __(
|
||||
'calculated with an address',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'calculated with an address', 'woocommerce' ) }
|
||||
</span>
|
||||
) : (
|
||||
<RatePrice minRate={ rate.min } maxRate={ rate.max } />
|
||||
|
@ -210,9 +207,7 @@ export const Edit = ( {
|
|||
) }
|
||||
>
|
||||
<InspectorControls>
|
||||
<PanelBody
|
||||
title={ __( 'Appearance', 'woocommerce' ) }
|
||||
>
|
||||
<PanelBody title={ __( 'Appearance', 'woocommerce' ) }>
|
||||
<p className="wc-block-checkout__controls-text">
|
||||
{ __(
|
||||
'Choose how this block is displayed to your customers.',
|
||||
|
@ -220,10 +215,7 @@ export const Edit = ( {
|
|||
) }
|
||||
</p>
|
||||
<ToggleControl
|
||||
label={ __(
|
||||
'Show icon',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Show icon', 'woocommerce' ) }
|
||||
checked={ showIcon }
|
||||
onChange={ () =>
|
||||
setAttributes( {
|
||||
|
@ -232,10 +224,7 @@ export const Edit = ( {
|
|||
}
|
||||
/>
|
||||
<ToggleControl
|
||||
label={ __(
|
||||
'Show costs',
|
||||
'woocommerce'
|
||||
) }
|
||||
label={ __( 'Show costs', 'woocommerce' ) }
|
||||
checked={ showPrice }
|
||||
onChange={ () =>
|
||||
setAttributes( {
|
||||
|
@ -244,12 +233,7 @@ export const Edit = ( {
|
|||
}
|
||||
/>
|
||||
</PanelBody>
|
||||
<PanelBody
|
||||
title={ __(
|
||||
'Shipping Methods',
|
||||
'woocommerce'
|
||||
) }
|
||||
>
|
||||
<PanelBody title={ __( 'Shipping Methods', 'woocommerce' ) }>
|
||||
<p className="wc-block-checkout__controls-text">
|
||||
{ __(
|
||||
'Methods can be made managed in your store settings.',
|
||||
|
@ -259,10 +243,7 @@ export const Edit = ( {
|
|||
<ExternalLinkCard
|
||||
key={ 'shipping_methods' }
|
||||
href={ `${ ADMIN_URL }admin.php?page=wc-settings&tab=shipping` }
|
||||
title={ __(
|
||||
'Shipping',
|
||||
'woocommerce'
|
||||
) }
|
||||
title={ __( 'Shipping', 'woocommerce' ) }
|
||||
description={ __(
|
||||
'Manage your shipping zones, methods, and rates.',
|
||||
'woocommerce'
|
||||
|
@ -271,10 +252,7 @@ export const Edit = ( {
|
|||
<ExternalLinkCard
|
||||
key={ 'pickup_location' }
|
||||
href={ `${ ADMIN_URL }admin.php?page=wc-settings&tab=shipping§ion=pickup_location` }
|
||||
title={ __(
|
||||
'Local Pickup',
|
||||
'woocommerce'
|
||||
) }
|
||||
title={ __( 'Local Pickup', 'woocommerce' ) }
|
||||
description={ __(
|
||||
'Allow customers to choose a local pickup location during checkout.',
|
||||
'woocommerce'
|
||||
|
|
|
@ -44,10 +44,7 @@ export const RatePrice = ( {
|
|||
: createInterpolateElement(
|
||||
minRatePrice === 0 && maxRatePrice === 0
|
||||
? '<price />'
|
||||
: __(
|
||||
'from <price />',
|
||||
'woocommerce'
|
||||
),
|
||||
: __( 'from <price />', 'woocommerce' ),
|
||||
{
|
||||
price: priceElement,
|
||||
}
|
||||
|
|
|
@ -65,10 +65,7 @@ export const Edit = ( {
|
|||
>
|
||||
<InspectorControls>
|
||||
<PanelBody
|
||||
title={ __(
|
||||
'Shipping Calculations',
|
||||
'woocommerce'
|
||||
) }
|
||||
title={ __( 'Shipping Calculations', 'woocommerce' ) }
|
||||
>
|
||||
<p className="wc-block-checkout__controls-text">
|
||||
{ __(
|
||||
|
@ -79,19 +76,11 @@ export const Edit = ( {
|
|||
<ExternalLink
|
||||
href={ `${ ADMIN_URL }admin.php?page=wc-settings&tab=shipping§ion=options` }
|
||||
>
|
||||
{ __(
|
||||
'Manage shipping options',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'Manage shipping options', 'woocommerce' ) }
|
||||
</ExternalLink>{ ' ' }
|
||||
</PanelBody>
|
||||
{ globalShippingMethods.length > 0 && (
|
||||
<PanelBody
|
||||
title={ __(
|
||||
'Methods',
|
||||
'woocommerce'
|
||||
) }
|
||||
>
|
||||
<PanelBody title={ __( 'Methods', 'woocommerce' ) }>
|
||||
<p className="wc-block-checkout__controls-text">
|
||||
{ __(
|
||||
'The following shipping integrations are active on your store.',
|
||||
|
@ -111,20 +100,12 @@ export const Edit = ( {
|
|||
<ExternalLink
|
||||
href={ `${ ADMIN_URL }admin.php?page=wc-settings&tab=shipping` }
|
||||
>
|
||||
{ __(
|
||||
'Manage shipping methods',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'Manage shipping methods', 'woocommerce' ) }
|
||||
</ExternalLink>
|
||||
</PanelBody>
|
||||
) }
|
||||
{ activeShippingZones.length && (
|
||||
<PanelBody
|
||||
title={ __(
|
||||
'Shipping Zones',
|
||||
'woocommerce'
|
||||
) }
|
||||
>
|
||||
<PanelBody title={ __( 'Shipping Zones', 'woocommerce' ) }>
|
||||
<p className="wc-block-checkout__controls-text">
|
||||
{ __(
|
||||
'Shipping Zones can be made managed in your store settings.',
|
||||
|
|
|
@ -30,10 +30,7 @@ const NoShippingPlaceholder = () => {
|
|||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{ __(
|
||||
'Configure Shipping Options',
|
||||
'woocommerce'
|
||||
) }
|
||||
{ __( 'Configure Shipping Options', 'woocommerce' ) }
|
||||
</Button>
|
||||
</Placeholder>
|
||||
);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue