Rename collection to shipping to reflect the block purpose
This commit is contained in:
parent
87c51d822f
commit
82e9155167
|
@ -43,7 +43,7 @@ export const Edit = ( {
|
|||
[ 'woocommerce/checkout-contact-information-block', {}, [] ],
|
||||
...[
|
||||
isExperimentalBuild()
|
||||
? [ 'woocommerce/checkout-collection-method-block', {}, [] ]
|
||||
? [ 'woocommerce/checkout-shipping-method-block', {}, [] ]
|
||||
: null,
|
||||
],
|
||||
...[
|
||||
|
|
|
@ -47,7 +47,7 @@ export const Edit = ( {
|
|||
attributes={ attributes }
|
||||
setAttributes={ setAttributes }
|
||||
className={ classnames(
|
||||
'wc-block-checkout__collection-method',
|
||||
'wc-block-checkout__shipping-method',
|
||||
className
|
||||
) }
|
||||
>
|
||||
|
|
|
@ -34,7 +34,7 @@ export default {
|
|||
},
|
||||
shippingText: {
|
||||
type: 'string',
|
||||
default: __( 'Delivery', 'woo-gutenberg-products-block' ),
|
||||
default: __( 'Shipping', 'woo-gutenberg-products-block' ),
|
||||
},
|
||||
lock: {
|
||||
type: 'object',
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"name": "woocommerce/checkout-collection-method-block",
|
||||
"name": "woocommerce/checkout-shipping-method-block",
|
||||
"version": "1.0.0",
|
||||
"title": "Shipping Method",
|
||||
"description": "Select between delivery or collection.",
|
||||
"description": "Select between shipping or local pickup.",
|
||||
"category": "woocommerce",
|
||||
"supports": {
|
||||
"align": false,
|
|
@ -33,19 +33,22 @@ const LocalPickupSelector = ( {
|
|||
return (
|
||||
<Radio
|
||||
value="pickup"
|
||||
className={ classnames( 'wc-block-checkout__collection-item', {
|
||||
'wc-block-checkout__collection-item--selected':
|
||||
checked === 'pickup',
|
||||
} ) }
|
||||
className={ classnames(
|
||||
'wc-block-checkout__shipping-method-option',
|
||||
{
|
||||
'wc-block-checkout__shipping-method-option--selected':
|
||||
checked === 'pickup',
|
||||
}
|
||||
) }
|
||||
>
|
||||
{ showIcon === true && (
|
||||
<Icon
|
||||
icon={ store }
|
||||
size={ 28 }
|
||||
className="wc-block-checkout__collection-item-icon"
|
||||
className="wc-block-checkout__shipping-method-option-icon"
|
||||
/>
|
||||
) }
|
||||
<span className="wc-block-checkout__collection-item-title">
|
||||
<span className="wc-block-checkout__shipping-method-option-title">
|
||||
{ toggleText }
|
||||
</span>
|
||||
{ showPrice === true && (
|
||||
|
@ -70,7 +73,7 @@ const ShippingSelector = ( {
|
|||
} ) => {
|
||||
const Price =
|
||||
rate.min === undefined ? (
|
||||
<span className="wc-block-checkout__collection-item-price">
|
||||
<span className="wc-block-checkout__shipping-method-option-price">
|
||||
{ __(
|
||||
'calculated with an address',
|
||||
'woo-gutenberg-products-block'
|
||||
|
@ -83,19 +86,22 @@ const ShippingSelector = ( {
|
|||
return (
|
||||
<Radio
|
||||
value="shipping"
|
||||
className={ classnames( 'wc-block-checkout__collection-item', {
|
||||
'wc-block-checkout__collection-item--selected':
|
||||
checked === 'shipping',
|
||||
} ) }
|
||||
className={ classnames(
|
||||
'wc-block-checkout__shipping-method-option',
|
||||
{
|
||||
'wc-block-checkout__shipping-method-option--selected':
|
||||
checked === 'shipping',
|
||||
}
|
||||
) }
|
||||
>
|
||||
{ showIcon === true && (
|
||||
<Icon
|
||||
icon={ shipping }
|
||||
size={ 28 }
|
||||
className="wc-block-checkout__collection-item-icon"
|
||||
className="wc-block-checkout__shipping-method-option-icon"
|
||||
/>
|
||||
) }
|
||||
<span className="wc-block-checkout__collection-item-title">
|
||||
<span className="wc-block-checkout__shipping-method-option-title">
|
||||
{ toggleText }
|
||||
</span>
|
||||
{ showPrice === true && Price }
|
||||
|
@ -121,8 +127,8 @@ const Block = ( {
|
|||
|
||||
return (
|
||||
<RadioGroup
|
||||
id="collection-method"
|
||||
className="wc-block-checkout__collection-method-container"
|
||||
id="shipping-method"
|
||||
className="wc-block-checkout__shipping-method-container"
|
||||
label="options"
|
||||
onChange={ onChange }
|
||||
checked={ checked }
|
|
@ -52,22 +52,25 @@ const LocalPickupSelector = ( {
|
|||
return (
|
||||
<Radio
|
||||
value="pickup"
|
||||
className={ classnames( 'wc-block-checkout__collection-item', {
|
||||
'wc-block-checkout__collection-item--selected':
|
||||
checked === 'pickup',
|
||||
} ) }
|
||||
className={ classnames(
|
||||
'wc-block-checkout__shipping-method-option',
|
||||
{
|
||||
'wc-block-checkout__shipping-method-option--selected':
|
||||
checked === 'pickup',
|
||||
}
|
||||
) }
|
||||
>
|
||||
{ showIcon === true && (
|
||||
<Icon
|
||||
icon={ store }
|
||||
size={ 28 }
|
||||
className="wc-block-checkout__collection-item-icon"
|
||||
className="wc-block-checkout__shipping-method-option-icon"
|
||||
/>
|
||||
) }
|
||||
<RichText
|
||||
value={ toggleText }
|
||||
tagName="span"
|
||||
className="wc-block-checkout__collection-item-title"
|
||||
className="wc-block-checkout__shipping-method-option-title"
|
||||
onChange={ ( value ) =>
|
||||
setAttributes( { localPickupText: value } )
|
||||
}
|
||||
|
@ -98,7 +101,7 @@ const ShippingSelector = ( {
|
|||
} ) => {
|
||||
const Price =
|
||||
rate.min === undefined ? (
|
||||
<span className="wc-block-checkout__collection-item-price">
|
||||
<span className="wc-block-checkout__shipping-method-option-price">
|
||||
{ __(
|
||||
'calculated with an address',
|
||||
'woo-gutenberg-products-block'
|
||||
|
@ -111,22 +114,25 @@ const ShippingSelector = ( {
|
|||
return (
|
||||
<Radio
|
||||
value="shipping"
|
||||
className={ classnames( 'wc-block-checkout__collection-item', {
|
||||
'wc-block-checkout__collection-item--selected':
|
||||
checked === 'shipping',
|
||||
} ) }
|
||||
className={ classnames(
|
||||
'wc-block-checkout__shipping-method-option',
|
||||
{
|
||||
'wc-block-checkout__shipping-method-option--selected':
|
||||
checked === 'shipping',
|
||||
}
|
||||
) }
|
||||
>
|
||||
{ showIcon === true && (
|
||||
<Icon
|
||||
icon={ shipping }
|
||||
size={ 28 }
|
||||
className="wc-block-checkout__collection-item-icon"
|
||||
className="wc-block-checkout__shipping-method-option-icon"
|
||||
/>
|
||||
) }
|
||||
<RichText
|
||||
value={ toggleText }
|
||||
tagName="span"
|
||||
className="wc-block-checkout__collection-item-title"
|
||||
className="wc-block-checkout__shipping-method-option-title"
|
||||
onChange={ ( value ) =>
|
||||
setAttributes( { shippingText: value } )
|
||||
}
|
||||
|
@ -193,7 +199,7 @@ export const Edit = ( {
|
|||
attributes={ attributes }
|
||||
setAttributes={ setAttributes }
|
||||
className={ classnames(
|
||||
'wc-block-checkout__collection-method',
|
||||
'wc-block-checkout__shipping-method',
|
||||
className
|
||||
) }
|
||||
>
|
||||
|
@ -234,8 +240,8 @@ export const Edit = ( {
|
|||
</PanelBody>
|
||||
</InspectorControls>
|
||||
<RadioGroup
|
||||
id="collection-method"
|
||||
className="wc-block-checkout__collection-method-container"
|
||||
id="shipping-method"
|
||||
className="wc-block-checkout__shipping-method-container"
|
||||
label="options"
|
||||
onChange={ changeView }
|
||||
checked={ prefersCollection ? 'pickup' : 'shipping' }
|
||||
|
@ -261,7 +267,7 @@ export const Edit = ( {
|
|||
toggleText={ localPickupText }
|
||||
/>
|
||||
</RadioGroup>
|
||||
<AdditionalFields block={ innerBlockAreas.COLLECTION_METHOD } />
|
||||
<AdditionalFields block={ innerBlockAreas.SHIPPING_METHOD } />
|
||||
</FormStepBlock>
|
||||
);
|
||||
};
|
|
@ -71,10 +71,10 @@ const FrontendBlock = ( {
|
|||
|
||||
return (
|
||||
<FormStep
|
||||
id="collection-method"
|
||||
id="shipping-method"
|
||||
disabled={ checkoutIsProcessing }
|
||||
className={ classnames(
|
||||
'wc-block-checkout__collection-method',
|
||||
'wc-block-checkout__shipping-method',
|
||||
className
|
||||
) }
|
||||
title={ title }
|
|
@ -10,7 +10,7 @@ import { registerExperimentalBlockType } from '@woocommerce/block-settings';
|
|||
import { Edit, Save } from './edit';
|
||||
import attributes from './attributes';
|
||||
|
||||
registerExperimentalBlockType( 'woocommerce/checkout-collection-method-block', {
|
||||
registerExperimentalBlockType( 'woocommerce/checkout-shipping-method-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
|
@ -36,7 +36,7 @@ export const RatePrice = ( {
|
|||
);
|
||||
|
||||
return (
|
||||
<span className="wc-block-checkout__collection-item-price">
|
||||
<span className="wc-block-checkout__shipping-method-option-price">
|
||||
{ minRatePrice === maxRatePrice
|
||||
? priceElement
|
||||
: createInterpolateElement(
|
|
@ -1,11 +1,11 @@
|
|||
.wc-block-checkout__collection-method-container {
|
||||
.wc-block-checkout__shipping-method-container {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: $gap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.wc-block-checkout__collection-item {
|
||||
.wc-block-checkout__shipping-method-option {
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
@ -20,21 +20,21 @@
|
|||
background-color: transparent;
|
||||
border: none;
|
||||
outline: 1px solid currentColor;
|
||||
&.wc-block-checkout__collection-item--selected {
|
||||
&.wc-block-checkout__shipping-method-option--selected {
|
||||
outline-width: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.wc-block-checkout__collection-item-icon {
|
||||
.wc-block-checkout__shipping-method-option-icon {
|
||||
fill: currentColor;
|
||||
}
|
||||
|
||||
.wc-block-checkout__collection-item-title {
|
||||
.wc-block-checkout__shipping-method-option-title {
|
||||
@include font-size(regular, 1rem);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.wc-block-checkout__collection-item-price {
|
||||
.wc-block-checkout__shipping-method-option-price {
|
||||
@include font-size(small, 1rem);
|
||||
|
||||
em {
|
|
@ -2,7 +2,7 @@
|
|||
"name": "woocommerce/checkout-shipping-methods-block",
|
||||
"version": "1.0.0",
|
||||
"title": "Shipping Options",
|
||||
"description": "Shipping options for your store.",
|
||||
"description": "Display shipping options and rates for your store.",
|
||||
"category": "woocommerce",
|
||||
"supports": {
|
||||
"align": false,
|
||||
|
|
|
@ -9,8 +9,8 @@ import CHECKOUT_FIELDS from './checkout-fields-block/block.json';
|
|||
import CHECKOUT_ORDER_NOTE from './checkout-order-note-block/block.json';
|
||||
import CHECKOUT_PAYMENT from './checkout-payment-block/block.json';
|
||||
import CHECKOUT_SHIPPING_ADDRESS from './checkout-shipping-address-block/block.json';
|
||||
import CHECKOUT_SHIPPING_METHOD from './checkout-shipping-method-block/block.json';
|
||||
import CHECKOUT_SHIPPING_METHODS from './checkout-shipping-methods-block/block.json';
|
||||
import CHECKOUT_COLLECTION_METHOD from './checkout-collection-method-block/block.json';
|
||||
import CHECKOUT_PICKUP_LOCATION from './checkout-pickup-options-block/block.json';
|
||||
import CHECKOUT_TERMS from './checkout-terms-block/block.json';
|
||||
import CHECKOUT_TOTALS from './checkout-totals-block/block.json';
|
||||
|
@ -31,8 +31,10 @@ export default {
|
|||
CHECKOUT_FIELDS,
|
||||
CHECKOUT_ORDER_NOTE,
|
||||
CHECKOUT_PAYMENT,
|
||||
CHECKOUT_SHIPPING_METHOD,
|
||||
CHECKOUT_SHIPPING_ADDRESS,
|
||||
CHECKOUT_SHIPPING_METHODS,
|
||||
CHECKOUT_PICKUP_LOCATION,
|
||||
CHECKOUT_TERMS,
|
||||
CHECKOUT_TOTALS,
|
||||
CHECKOUT_ORDER_SUMMARY,
|
||||
|
@ -43,6 +45,4 @@ export default {
|
|||
CHECKOUT_ORDER_SUMMARY_COUPON_FORM,
|
||||
CHECKOUT_ORDER_SUMMARY_TAXES,
|
||||
CHECKOUT_ORDER_SUMMARY_CART_ITEMS,
|
||||
CHECKOUT_COLLECTION_METHOD,
|
||||
CHECKOUT_PICKUP_LOCATION,
|
||||
};
|
||||
|
|
|
@ -12,8 +12,8 @@ import './checkout-order-note-block';
|
|||
import './checkout-order-summary-block';
|
||||
import './checkout-payment-block';
|
||||
import './checkout-express-payment-block';
|
||||
import './checkout-shipping-method-block';
|
||||
import './checkout-shipping-methods-block';
|
||||
import './checkout-collection-method-block';
|
||||
import './checkout-pickup-options-block';
|
||||
import './checkout-order-summary-subtotal';
|
||||
import './checkout-order-summary-fee';
|
||||
|
|
|
@ -50,11 +50,11 @@ registerCheckoutBlock( {
|
|||
|
||||
if ( isExperimentalBuild() ) {
|
||||
registerCheckoutBlock( {
|
||||
metadata: metadata.CHECKOUT_COLLECTION_METHOD,
|
||||
metadata: metadata.CHECKOUT_SHIPPING_METHOD,
|
||||
component: lazy(
|
||||
() =>
|
||||
import(
|
||||
/* webpackChunkName: "checkout-blocks/collection-method" */ './checkout-collection-method-block/frontend'
|
||||
/* webpackChunkName: "checkout-blocks/shipping-method" */ './checkout-shipping-method-block/frontend'
|
||||
)
|
||||
),
|
||||
} );
|
||||
|
|
|
@ -38122,6 +38122,16 @@
|
|||
"inherits": "2.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/node-pty": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/node-pty/-/node-pty-0.9.0.tgz",
|
||||
"integrity": "sha512-MBnCQl83FTYOu7B4xWw10AW77AAh7ThCE1VXEv+JeWj8mSpGo+0bwgsV+b23ljBFwEM9OmsOv3kM27iUPPm84g==",
|
||||
"hasInstallScript": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"nan": "^2.14.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-releases": {
|
||||
"version": "2.0.4",
|
||||
"license": "MIT"
|
||||
|
@ -76698,6 +76708,15 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node-pty": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/node-pty/-/node-pty-0.9.0.tgz",
|
||||
"integrity": "sha512-MBnCQl83FTYOu7B4xWw10AW77AAh7ThCE1VXEv+JeWj8mSpGo+0bwgsV+b23ljBFwEM9OmsOv3kM27iUPPm84g==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"nan": "^2.14.0"
|
||||
}
|
||||
},
|
||||
"node-releases": {
|
||||
"version": "2.0.4"
|
||||
},
|
||||
|
|
|
@ -12,8 +12,8 @@ export enum innerBlockAreas {
|
|||
CONTACT_INFORMATION = 'woocommerce/checkout-contact-information-block',
|
||||
SHIPPING_ADDRESS = 'woocommerce/checkout-shipping-address-block',
|
||||
BILLING_ADDRESS = 'woocommerce/checkout-billing-address-block',
|
||||
SHIPPING_METHOD = 'woocommerce/checkout-shipping-method-block',
|
||||
SHIPPING_METHODS = 'woocommerce/checkout-shipping-methods-block',
|
||||
COLLECTION_METHOD = 'woocommerce/checkout-collection-method-block',
|
||||
PICKUP_LOCATION = 'woocommerce/checkout-pickup-options-block',
|
||||
PAYMENT_METHODS = 'woocommerce/checkout-payment-methods-block',
|
||||
CART = 'woocommerce/cart',
|
||||
|
|
|
@ -444,7 +444,7 @@ class Checkout extends AbstractBlock {
|
|||
'CheckoutPaymentBlock',
|
||||
'CheckoutShippingAddressBlock',
|
||||
'CheckoutShippingMethodsBlock',
|
||||
'CheckoutCollectionMethodBlock',
|
||||
'CheckoutShippingMethodBlock',
|
||||
'CheckoutPickupOptionsBlock',
|
||||
'CheckoutTermsBlock',
|
||||
'CheckoutTotalsBlock',
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CheckoutCollectionMethodBlock class.
|
||||
*/
|
||||
class CheckoutCollectionMethodBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'checkout-collection-method-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CheckoutShippingMethodBlock class.
|
||||
*/
|
||||
class CheckoutShippingMethodBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'checkout-shipping-method-block';
|
||||
}
|
Loading…
Reference in New Issue