From 82e915516765726396d1f3525c70fe1feb6c2d79 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 20 Oct 2022 11:48:46 +0100 Subject: [PATCH] Rename collection to shipping to reflect the block purpose --- .../checkout-fields-block/edit.tsx | 2 +- .../checkout-pickup-options-block/edit.tsx | 2 +- .../attributes.tsx | 2 +- .../block.json | 4 +- .../block.tsx | 36 ++++++++++------- .../edit.tsx | 40 +++++++++++-------- .../frontend.tsx | 4 +- .../index.tsx | 2 +- .../shared/helpers.ts | 0 .../shared/index.js | 0 .../shared/rate-price.tsx | 2 +- .../style.scss | 12 +++--- .../block.json | 2 +- .../inner-blocks/component-metadata.ts | 6 +-- .../js/blocks/checkout/inner-blocks/index.tsx | 2 +- .../inner-blocks/register-components.ts | 4 +- plugins/woocommerce-blocks/package-lock.json | 19 +++++++++ .../checkout/blocks-registry/types.ts | 2 +- .../src/BlockTypes/Checkout.php | 2 +- .../CheckoutCollectionMethodBlock.php | 14 ------- .../CheckoutShippingMethodBlock.php | 14 +++++++ 21 files changed, 101 insertions(+), 70 deletions(-) rename plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/{checkout-collection-method-block => checkout-shipping-method-block}/attributes.tsx (92%) rename plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/{checkout-collection-method-block => checkout-shipping-method-block}/block.json (81%) rename plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/{checkout-collection-method-block => checkout-shipping-method-block}/block.tsx (76%) rename plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/{checkout-collection-method-block => checkout-shipping-method-block}/edit.tsx (86%) rename plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/{checkout-collection-method-block => checkout-shipping-method-block}/frontend.tsx (96%) rename plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/{checkout-collection-method-block => checkout-shipping-method-block}/index.tsx (84%) rename plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/{checkout-collection-method-block => checkout-shipping-method-block}/shared/helpers.ts (100%) rename plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/{checkout-collection-method-block => checkout-shipping-method-block}/shared/index.js (100%) rename plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/{checkout-collection-method-block => checkout-shipping-method-block}/shared/rate-price.tsx (95%) rename plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/{checkout-collection-method-block => checkout-shipping-method-block}/style.scss (65%) delete mode 100644 plugins/woocommerce-blocks/src/BlockTypes/CheckoutCollectionMethodBlock.php create mode 100644 plugins/woocommerce-blocks/src/BlockTypes/CheckoutShippingMethodBlock.php diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/edit.tsx index 3fc082d6673..085cc020128 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/edit.tsx @@ -43,7 +43,7 @@ export const Edit = ( { [ 'woocommerce/checkout-contact-information-block', {}, [] ], ...[ isExperimentalBuild() - ? [ 'woocommerce/checkout-collection-method-block', {}, [] ] + ? [ 'woocommerce/checkout-shipping-method-block', {}, [] ] : null, ], ...[ diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-pickup-options-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-pickup-options-block/edit.tsx index 6ca3ea85156..b1d6de4f82d 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-pickup-options-block/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-pickup-options-block/edit.tsx @@ -47,7 +47,7 @@ export const Edit = ( { attributes={ attributes } setAttributes={ setAttributes } className={ classnames( - 'wc-block-checkout__collection-method', + 'wc-block-checkout__shipping-method', className ) } > diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-collection-method-block/attributes.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/attributes.tsx similarity index 92% rename from plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-collection-method-block/attributes.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/attributes.tsx index cbe58748d34..682142a337e 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-collection-method-block/attributes.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/attributes.tsx @@ -34,7 +34,7 @@ export default { }, shippingText: { type: 'string', - default: __( 'Delivery', 'woo-gutenberg-products-block' ), + default: __( 'Shipping', 'woo-gutenberg-products-block' ), }, lock: { type: 'object', diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-collection-method-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/block.json similarity index 81% rename from plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-collection-method-block/block.json rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/block.json index 34b09608991..b080adafec9 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-collection-method-block/block.json +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/block.json @@ -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, diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-collection-method-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/block.tsx similarity index 76% rename from plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-collection-method-block/block.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/block.tsx index d8f05b86380..3f80602fafc 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-collection-method-block/block.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/block.tsx @@ -33,19 +33,22 @@ const LocalPickupSelector = ( { return ( { showIcon === true && ( ) } - + { toggleText } { showPrice === true && ( @@ -70,7 +73,7 @@ const ShippingSelector = ( { } ) => { const Price = rate.min === undefined ? ( - + { __( 'calculated with an address', 'woo-gutenberg-products-block' @@ -83,19 +86,22 @@ const ShippingSelector = ( { return ( { showIcon === true && ( ) } - + { toggleText } { showPrice === true && Price } @@ -121,8 +127,8 @@ const Block = ( { return ( { showIcon === true && ( ) } setAttributes( { localPickupText: value } ) } @@ -98,7 +101,7 @@ const ShippingSelector = ( { } ) => { const Price = rate.min === undefined ? ( - + { __( 'calculated with an address', 'woo-gutenberg-products-block' @@ -111,22 +114,25 @@ const ShippingSelector = ( { return ( { showIcon === true && ( ) } 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 = ( { - + ); }; diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-collection-method-block/frontend.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/frontend.tsx similarity index 96% rename from plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-collection-method-block/frontend.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/frontend.tsx index aa6138ae0d6..1695be7d7f3 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-collection-method-block/frontend.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/frontend.tsx @@ -71,10 +71,10 @@ const FrontendBlock = ( { return ( + { minRatePrice === maxRatePrice ? priceElement : createInterpolateElement( diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-collection-method-block/style.scss b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/style.scss similarity index 65% rename from plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-collection-method-block/style.scss rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/style.scss index 781a446cf22..0a9a4817db2 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-collection-method-block/style.scss +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/style.scss @@ -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 { diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/block.json index 861a9299560..df53c0117c8 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/block.json +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/block.json @@ -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, diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/component-metadata.ts b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/component-metadata.ts index ef571c5c3e8..d117b7c3759 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/component-metadata.ts +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/component-metadata.ts @@ -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, }; diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/index.tsx index 1ea2d052ec8..c995b7ddb4e 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/index.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/index.tsx @@ -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'; diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/register-components.ts b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/register-components.ts index 612b76fbdb8..af91db90321 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/register-components.ts +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/register-components.ts @@ -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' ) ), } ); diff --git a/plugins/woocommerce-blocks/package-lock.json b/plugins/woocommerce-blocks/package-lock.json index 7ccbae032e7..3be03785ff9 100644 --- a/plugins/woocommerce-blocks/package-lock.json +++ b/plugins/woocommerce-blocks/package-lock.json @@ -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" }, diff --git a/plugins/woocommerce-blocks/packages/checkout/blocks-registry/types.ts b/plugins/woocommerce-blocks/packages/checkout/blocks-registry/types.ts index ed07900b81a..e6eb4ca43ff 100644 --- a/plugins/woocommerce-blocks/packages/checkout/blocks-registry/types.ts +++ b/plugins/woocommerce-blocks/packages/checkout/blocks-registry/types.ts @@ -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', diff --git a/plugins/woocommerce-blocks/src/BlockTypes/Checkout.php b/plugins/woocommerce-blocks/src/BlockTypes/Checkout.php index ae29cebd384..ec3b32d788e 100644 --- a/plugins/woocommerce-blocks/src/BlockTypes/Checkout.php +++ b/plugins/woocommerce-blocks/src/BlockTypes/Checkout.php @@ -444,7 +444,7 @@ class Checkout extends AbstractBlock { 'CheckoutPaymentBlock', 'CheckoutShippingAddressBlock', 'CheckoutShippingMethodsBlock', - 'CheckoutCollectionMethodBlock', + 'CheckoutShippingMethodBlock', 'CheckoutPickupOptionsBlock', 'CheckoutTermsBlock', 'CheckoutTotalsBlock', diff --git a/plugins/woocommerce-blocks/src/BlockTypes/CheckoutCollectionMethodBlock.php b/plugins/woocommerce-blocks/src/BlockTypes/CheckoutCollectionMethodBlock.php deleted file mode 100644 index 6f800d4de92..00000000000 --- a/plugins/woocommerce-blocks/src/BlockTypes/CheckoutCollectionMethodBlock.php +++ /dev/null @@ -1,14 +0,0 @@ -