From a6fa273093e9c6bbea0c2ae4d1ca11559e3d8a35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Thu, 27 Aug 2020 09:36:37 +0200 Subject: [PATCH 1/9] Rename CheckoutForm to Form --- .../js/base/components/cart-checkout/form/style.scss | 4 ---- .../base/components/{cart-checkout => }/form/index.js | 11 ++--------- assets/js/blocks/cart-checkout/checkout/block.js | 9 ++++++--- assets/js/blocks/cart-checkout/checkout/style.scss | 5 +++++ 4 files changed, 13 insertions(+), 16 deletions(-) delete mode 100644 assets/js/base/components/cart-checkout/form/style.scss rename assets/js/base/components/{cart-checkout => }/form/index.js (78%) diff --git a/assets/js/base/components/cart-checkout/form/style.scss b/assets/js/base/components/cart-checkout/form/style.scss deleted file mode 100644 index 1e79c4f0500..00000000000 --- a/assets/js/base/components/cart-checkout/form/style.scss +++ /dev/null @@ -1,4 +0,0 @@ -.wc-block-components-checkout-form { - margin: 0; - max-width: 100%; -} diff --git a/assets/js/base/components/cart-checkout/form/index.js b/assets/js/base/components/form/index.js similarity index 78% rename from assets/js/base/components/cart-checkout/form/index.js rename to assets/js/base/components/form/index.js index 35753acddb6..987f930ea04 100644 --- a/assets/js/base/components/cart-checkout/form/index.js +++ b/assets/js/base/components/form/index.js @@ -4,11 +4,6 @@ import classnames from 'classnames'; import PropTypes from 'prop-types'; -/** - * Internal dependencies - */ -import './style.scss'; - const CheckoutForm = ( { className, children, @@ -18,12 +13,10 @@ const CheckoutForm = ( { event.preventDefault(); onSubmit( event ); }; + return (
{ children } diff --git a/assets/js/blocks/cart-checkout/checkout/block.js b/assets/js/blocks/cart-checkout/checkout/block.js index 3980be822d9..676ef7a53bd 100644 --- a/assets/js/blocks/cart-checkout/checkout/block.js +++ b/assets/js/blocks/cart-checkout/checkout/block.js @@ -7,12 +7,12 @@ import { __ } from '@wordpress/i18n'; import { AddressForm, FormStep, - CheckoutForm, PlaceOrderButton, Policies, ReturnToCartButton, ShippingRatesControl, } from '@woocommerce/base-components/cart-checkout'; +import { Form } from '@woocommerce/base-components/form'; import { ValidatedTextInput } from '@woocommerce/base-components/text-input'; import CheckboxControl from '@woocommerce/base-components/checkbox-control'; import { @@ -220,7 +220,10 @@ const Checkout = ( { attributes, scrollToTop } ) => {
{ cartNeedsPayment && } - + { /> ) } - +
{ attributes.showReturnToCart && ( Date: Thu, 27 Aug 2020 10:05:45 +0200 Subject: [PATCH 2/9] Create CheckoutForm component --- .../js/base/components/cart-checkout/index.js | 1 - .../js/blocks/cart-checkout/checkout/block.js | 321 +---------------- .../cart-checkout/checkout/form/index.js | 329 ++++++++++++++++++ 3 files changed, 343 insertions(+), 308 deletions(-) create mode 100644 assets/js/blocks/cart-checkout/checkout/form/index.js diff --git a/assets/js/base/components/cart-checkout/index.js b/assets/js/base/components/cart-checkout/index.js index 2c81b4b39c7..cc8c82bfad8 100644 --- a/assets/js/base/components/cart-checkout/index.js +++ b/assets/js/base/components/cart-checkout/index.js @@ -1,5 +1,4 @@ export { default as AddressForm } from './address-form'; -export { default as CheckoutForm } from './form'; export { default as FormStep } from './form-step'; export { default as OrderSummary } from './order-summary'; export { default as PlaceOrderButton } from './place-order-button'; diff --git a/assets/js/blocks/cart-checkout/checkout/block.js b/assets/js/blocks/cart-checkout/checkout/block.js index 676ef7a53bd..0a0ea86fa84 100644 --- a/assets/js/blocks/cart-checkout/checkout/block.js +++ b/assets/js/blocks/cart-checkout/checkout/block.js @@ -2,44 +2,21 @@ * External dependencies */ import classnames from 'classnames'; -import { useMemo, useEffect } from '@wordpress/element'; +import { useEffect } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { - AddressForm, - FormStep, PlaceOrderButton, Policies, ReturnToCartButton, - ShippingRatesControl, } from '@woocommerce/base-components/cart-checkout'; -import { Form } from '@woocommerce/base-components/form'; -import { ValidatedTextInput } from '@woocommerce/base-components/text-input'; -import CheckboxControl from '@woocommerce/base-components/checkbox-control'; -import { - getCurrencyFromPriceResponse, - getShippingRatesPackageCount, - getShippingRatesRateCount, -} from '@woocommerce/base-utils'; -import FormattedMonetaryAmount from '@woocommerce/base-components/formatted-monetary-amount'; import { CheckoutProvider, useCheckoutContext, useEditorContext, - useShippingDataContext, useValidationContext, - StoreNoticesProvider, } from '@woocommerce/base-context'; -import { - useStoreCart, - usePaymentMethods, - useStoreNotices, - useCheckoutAddress, -} from '@woocommerce/base-hooks'; -import { - CheckoutExpressPayment, - PaymentMethods, -} from '@woocommerce/base-components/payment-methods'; -import { decodeEntities } from '@wordpress/html-entities'; +import { useStoreCart, useStoreNotices } from '@woocommerce/base-hooks'; +import { CheckoutExpressPayment } from '@woocommerce/base-components/payment-methods'; import { Sidebar, SidebarLayout, @@ -47,19 +24,14 @@ import { } from '@woocommerce/base-components/sidebar-layout'; import { getSetting } from '@woocommerce/settings'; import withScrollToTop from '@woocommerce/base-hocs/with-scroll-to-top'; -import { - CHECKOUT_SHOW_LOGIN_REMINDER, - CHECKOUT_ALLOWS_GUEST, - DISPLAY_CART_PRICES_INCLUDING_TAX, -} from '@woocommerce/block-settings'; +import { CHECKOUT_ALLOWS_GUEST } from '@woocommerce/block-settings'; /** * Internal dependencies */ +import CheckoutForm from './form'; import CheckoutSidebar from './sidebar'; import CheckoutOrderError from './checkout-order-error'; -import CheckoutOrderNotes from './checkout-order-notes'; -import NoShippingPlaceholder from './no-shipping-placeholder'; import './style.scss'; /** @@ -76,29 +48,6 @@ const Block = ( props ) => { ); }; -/** - * Renders a shipping rate control option. - * - * @param {Object} option Shipping Rate. - */ -const renderShippingRatesControlOption = ( option ) => { - const priceWithTaxes = DISPLAY_CART_PRICES_INCLUDING_TAX - ? parseInt( option.price, 10 ) + parseInt( option.taxes, 10 ) - : parseInt( option.price, 10 ); - return { - label: decodeEntities( option.name ), - value: option.rate_id, - description: decodeEntities( option.description ), - secondaryLabel: ( - - ), - secondaryDescription: decodeEntities( option.delivery_time ), - }; -}; - /** * Main Checkout Component. * @@ -117,49 +66,13 @@ const Checkout = ( { attributes, scrollToTop } ) => { hasOrder, hasError: checkoutHasError, isIdle: checkoutIsIdle, - isProcessing: checkoutIsProcessing, customerId, - onSubmit, - orderNotes, - dispatchActions, } = useCheckoutContext(); - const { setOrderNotes } = dispatchActions; const { hasValidationErrors, showAllValidationErrors, } = useValidationContext(); - const { - shippingRates, - shippingRatesLoading, - needsShipping, - } = useShippingDataContext(); - const { paymentMethods } = usePaymentMethods(); const { hasNoticesOfType } = useStoreNotices(); - const { - defaultAddressFields, - shippingFields, - setShippingFields, - billingFields, - setBillingFields, - setEmail, - setPhone, - shippingAsBilling, - setShippingAsBilling, - showBillingFields, - } = useCheckoutAddress(); - const addressFieldsConfig = useMemo( () => { - return { - company: { - ...defaultAddressFields.company, - hidden: ! attributes.showCompanyField, - required: attributes.requireCompanyField, - }, - address_2: { - ...defaultAddressFields.address_2, - hidden: ! attributes.showApartmentField, - }, - }; - }, [ defaultAddressFields, attributes ] ); const hasErrorsToDisplay = checkoutIsIdle && @@ -198,20 +111,6 @@ const Checkout = ( { attributes, scrollToTop } ) => { ); } - const loginPrompt = () => - CHECKOUT_SHOW_LOGIN_REMINDER && - ! customerId && ( - <> - { __( - 'Already have an account? ', - 'woo-gutenberg-products-block' - ) } - - { __( 'Log in.', 'woo-gutenberg-products-block' ) } - - - ); - const checkoutClassName = classnames( 'wc-block-checkout', { 'has-dark-controls': attributes.hasDarkControls, } ); @@ -220,207 +119,15 @@ const Checkout = ( { attributes, scrollToTop } ) => {
{ cartNeedsPayment && } -
- - - - { needsShipping && ( - - - { attributes.showPhoneField && ( - - ) } - - setShippingAsBilling( isChecked ) - } - /> - - ) } - { showBillingFields && ( - - - - ) } - { needsShipping && ( - - 1 - ? __( - 'Select shipping options below.', - 'woo-gutenberg-products-block' - ) - : '' - } - > - { isEditor && - ! getShippingRatesPackageCount( - shippingRates - ) ? ( - - ) : ( - - ) } - - ) } - { cartNeedsPayment && ( - 1 - ? __( - 'Select a payment method below.', - 'woo-gutenberg-products-block' - ) - : '' - } - > - - - - - ) } - { attributes.showOrderNotes && ( - - - - ) } -
+
{ attributes.showReturnToCart && ( { + const priceWithTaxes = DISPLAY_CART_PRICES_INCLUDING_TAX + ? parseInt( option.price, 10 ) + parseInt( option.taxes, 10 ) + : parseInt( option.price, 10 ); + return { + label: decodeEntities( option.name ), + value: option.rate_id, + description: decodeEntities( option.description ), + secondaryLabel: ( + + ), + secondaryDescription: decodeEntities( option.delivery_time ), + }; +}; + +const CheckoutForm = ( { + loginToCheckoutUrl, + requireCompanyField, + requirePhoneField, + showApartmentField, + showCompanyField, + showOrderNotes, + showPhoneField, +} ) => { + const { isEditor } = useEditorContext(); + const { cartNeedsPayment } = useStoreCart(); + const { + isProcessing: checkoutIsProcessing, + customerId, + onSubmit, + orderNotes, + dispatchActions, + } = useCheckoutContext(); + const { setOrderNotes } = dispatchActions; + const { + shippingRates, + shippingRatesLoading, + needsShipping, + } = useShippingDataContext(); + const { paymentMethods } = usePaymentMethods(); + const { + defaultAddressFields, + shippingFields, + setShippingFields, + billingFields, + setBillingFields, + setEmail, + setPhone, + shippingAsBilling, + setShippingAsBilling, + showBillingFields, + } = useCheckoutAddress(); + const addressFieldsConfig = useMemo( () => { + return { + company: { + ...defaultAddressFields.company, + hidden: ! showCompanyField, + required: requireCompanyField, + }, + address_2: { + ...defaultAddressFields.address_2, + hidden: ! showApartmentField, + }, + }; + }, [ + defaultAddressFields, + showCompanyField, + requireCompanyField, + showApartmentField, + ] ); + + const loginPrompt = () => + CHECKOUT_SHOW_LOGIN_REMINDER && + ! customerId && ( + <> + { __( + 'Already have an account? ', + 'woo-gutenberg-products-block' + ) } + + { __( 'Log in.', 'woo-gutenberg-products-block' ) } + + + ); + + return ( +
+ + + + { needsShipping && ( + + + { showPhoneField && ( + + ) } + + setShippingAsBilling( isChecked ) + } + /> + + ) } + { showBillingFields && ( + + + + ) } + { needsShipping && ( + 1 + ? __( + 'Select shipping options below.', + 'woo-gutenberg-products-block' + ) + : '' + } + > + { isEditor && + ! getShippingRatesPackageCount( shippingRates ) ? ( + + ) : ( + + ) } + + ) } + { cartNeedsPayment && ( + 1 + ? __( + 'Select a payment method below.', + 'woo-gutenberg-products-block' + ) + : '' + } + > + + + + + ) } + { showOrderNotes && ( + + + + ) } +
+ ); +}; + +export default CheckoutForm; From 5d0e91b1921d479753ac0d3745da17739db03561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Thu, 27 Aug 2020 10:07:48 +0200 Subject: [PATCH 3/9] Simplify directory structure --- .../cart-checkout/form-step/style.scss | 6 +- .../cart-checkout/checkout/form/index.js | 10 ++- .../no-shipping-placeholder/index.js | 0 .../no-shipping-placeholder/style.scss | 0 .../order-notes}/index.js | 0 .../order-notes}/style.scss | 0 .../cart-checkout/checkout/form/style.scss | 66 ++++++++++++++++++ .../blocks/cart-checkout/checkout/style.scss | 67 +------------------ 8 files changed, 74 insertions(+), 75 deletions(-) rename assets/js/blocks/cart-checkout/checkout/{ => form}/no-shipping-placeholder/index.js (100%) rename assets/js/blocks/cart-checkout/checkout/{ => form}/no-shipping-placeholder/style.scss (100%) rename assets/js/blocks/cart-checkout/checkout/{checkout-order-notes => form/order-notes}/index.js (100%) rename assets/js/blocks/cart-checkout/checkout/{checkout-order-notes => form/order-notes}/style.scss (100%) create mode 100644 assets/js/blocks/cart-checkout/checkout/form/style.scss diff --git a/assets/js/base/components/cart-checkout/form-step/style.scss b/assets/js/base/components/cart-checkout/form-step/style.scss index 9f9d8be02dc..b381ed43472 100644 --- a/assets/js/base/components/cart-checkout/form-step/style.scss +++ b/assets/js/base/components/cart-checkout/form-step/style.scss @@ -1,8 +1,8 @@ -.wc-block-components-checkout-form { +.wc-block-components-form { counter-reset: checkout-step; } -.wc-block-components-checkout-form .wc-block-components-checkout-step { +.wc-block-components-form .wc-block-components-checkout-step { position: relative; border: none; padding: 0 0 0 $gap-larger; @@ -22,7 +22,7 @@ padding-bottom: em($gap-large); } -.wc-block-components-checkout-form .wc-block-components-checkout-step:disabled { +.wc-block-components-form .wc-block-components-checkout-step:disabled { opacity: 0.6; } diff --git a/assets/js/blocks/cart-checkout/checkout/form/index.js b/assets/js/blocks/cart-checkout/checkout/form/index.js index 6ae925698b0..e9b09733592 100644 --- a/assets/js/blocks/cart-checkout/checkout/form/index.js +++ b/assets/js/blocks/cart-checkout/checkout/form/index.js @@ -38,8 +38,9 @@ import { /** * Internal dependencies */ -import CheckoutOrderNotes from '../checkout-order-notes'; -import NoShippingPlaceholder from '../no-shipping-placeholder'; +import CheckoutOrderNotes from './order-notes'; +import NoShippingPlaceholder from './no-shipping-placeholder'; +import './style.scss'; /** * Renders a shipping rate control option. @@ -135,10 +136,7 @@ const CheckoutForm = ( { ); return ( -
+ Date: Thu, 27 Aug 2020 10:08:03 +0200 Subject: [PATCH 4/9] Add docs about class name changes --- docs/theming/class-names-update-330.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/theming/class-names-update-330.md b/docs/theming/class-names-update-330.md index b28f23f004d..c6dbb5ed81b 100644 --- a/docs/theming/class-names-update-330.md +++ b/docs/theming/class-names-update-330.md @@ -45,4 +45,8 @@ WC Blocks 3.3.0, introduced express payment methods in the Cart block. In order wc-block-components-express-checkout-payment-event-buttons wc-block-components-express-payment__event-buttons + + wc-block-components-checkout-form + wc-block-checkout__form + From 9f7701cdb193938c159ddd92f7b44370ea25d386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Thu, 27 Aug 2020 10:09:59 +0200 Subject: [PATCH 5/9] Add PropTypes to CheckoutForm --- assets/js/blocks/cart-checkout/checkout/form/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/assets/js/blocks/cart-checkout/checkout/form/index.js b/assets/js/blocks/cart-checkout/checkout/form/index.js index e9b09733592..416340abbd1 100644 --- a/assets/js/blocks/cart-checkout/checkout/form/index.js +++ b/assets/js/blocks/cart-checkout/checkout/form/index.js @@ -34,6 +34,7 @@ import { CHECKOUT_SHOW_LOGIN_REMINDER, DISPLAY_CART_PRICES_INCLUDING_TAX, } from '@woocommerce/block-settings'; +import PropTypes from 'prop-types'; /** * Internal dependencies @@ -324,4 +325,14 @@ const CheckoutForm = ( { ); }; +CheckoutForm.propTypes = { + loginToCheckoutUrl: PropTypes.string.isRequired, + requireCompanyField: PropTypes.bool.isRequired, + requirePhoneField: PropTypes.bool.isRequired, + showApartmentField: PropTypes.bool.isRequired, + showCompanyField: PropTypes.bool.isRequired, + showOrderNotes: PropTypes.bool.isRequired, + showPhoneField: PropTypes.bool.isRequired, +}; + export default CheckoutForm; From fbb5d2eae25d4730477d3243f8fe7903897c0358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Thu, 27 Aug 2020 10:11:46 +0200 Subject: [PATCH 6/9] Update skeleton class name --- src/BlockTypes/Checkout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BlockTypes/Checkout.php b/src/BlockTypes/Checkout.php index b08b3be7ba3..b4dc616c2f5 100644 --- a/src/BlockTypes/Checkout.php +++ b/src/BlockTypes/Checkout.php @@ -208,7 +208,7 @@ protected function get_skeleton() {
- +
From 39c2824bc7ddfe4d82fdf13cc0b63627759515e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Thu, 27 Aug 2020 10:24:32 +0200 Subject: [PATCH 7/9] Extract LoginPrompt --- .../cart-checkout/checkout/form/index.js | 25 +++----------- .../checkout/form/login-prompt.js | 33 +++++++++++++++++++ 2 files changed, 38 insertions(+), 20 deletions(-) create mode 100644 assets/js/blocks/cart-checkout/checkout/form/login-prompt.js diff --git a/assets/js/blocks/cart-checkout/checkout/form/index.js b/assets/js/blocks/cart-checkout/checkout/form/index.js index 416340abbd1..39f9051451c 100644 --- a/assets/js/blocks/cart-checkout/checkout/form/index.js +++ b/assets/js/blocks/cart-checkout/checkout/form/index.js @@ -30,16 +30,14 @@ import { } from '@woocommerce/base-hooks'; import { PaymentMethods } from '@woocommerce/base-components/payment-methods'; import { decodeEntities } from '@wordpress/html-entities'; -import { - CHECKOUT_SHOW_LOGIN_REMINDER, - DISPLAY_CART_PRICES_INCLUDING_TAX, -} from '@woocommerce/block-settings'; +import { DISPLAY_CART_PRICES_INCLUDING_TAX } from '@woocommerce/block-settings'; import PropTypes from 'prop-types'; /** * Internal dependencies */ import CheckoutOrderNotes from './order-notes'; +import LoginPrompt from './login-prompt'; import NoShippingPlaceholder from './no-shipping-placeholder'; import './style.scss'; @@ -79,7 +77,6 @@ const CheckoutForm = ( { const { cartNeedsPayment } = useStoreCart(); const { isProcessing: checkoutIsProcessing, - customerId, onSubmit, orderNotes, dispatchActions, @@ -122,20 +119,6 @@ const CheckoutForm = ( { showApartmentField, ] ); - const loginPrompt = () => - CHECKOUT_SHOW_LOGIN_REMINDER && - ! customerId && ( - <> - { __( - 'Already have an account? ', - 'woo-gutenberg-products-block' - ) } - - { __( 'Log in.', 'woo-gutenberg-products-block' ) } - - - ); - return ( ( + + ) } > { + const { customerId } = useCheckoutContext(); + + if ( ! CHECKOUT_SHOW_LOGIN_REMINDER || customerId ) { + return null; + } + + return ( + <> + { __( + 'Already have an account? ', + 'woo-gutenberg-products-block' + ) } + + { __( 'Log in.', 'woo-gutenberg-products-block' ) } + + + ); +}; + +LoginPrompt.propTypes = { + loginToCheckoutUrl: PropTypes.string.isRequired, +}; + +export default LoginPrompt; From bc03b8906bcb8990600a195e7cce1c98997f24b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Mon, 31 Aug 2020 11:57:48 +0200 Subject: [PATCH 8/9] Move loginToCheckoutUrl to a constant --- assets/js/blocks/cart-checkout/checkout/block.js | 8 ++------ .../js/blocks/cart-checkout/checkout/form/index.js | 6 +----- .../cart-checkout/checkout/form/login-prompt.js | 14 +++++++------- assets/js/blocks/cart-checkout/checkout/utils.js | 3 +++ 4 files changed, 13 insertions(+), 18 deletions(-) create mode 100644 assets/js/blocks/cart-checkout/checkout/utils.js diff --git a/assets/js/blocks/cart-checkout/checkout/block.js b/assets/js/blocks/cart-checkout/checkout/block.js index 0a0ea86fa84..342f8708afa 100644 --- a/assets/js/blocks/cart-checkout/checkout/block.js +++ b/assets/js/blocks/cart-checkout/checkout/block.js @@ -32,6 +32,7 @@ import { CHECKOUT_ALLOWS_GUEST } from '@woocommerce/block-settings'; import CheckoutForm from './form'; import CheckoutSidebar from './sidebar'; import CheckoutOrderError from './checkout-order-error'; +import { LOGIN_TO_CHECKOUT_URL } from './utils'; import './style.scss'; /** @@ -90,10 +91,6 @@ const Checkout = ( { attributes, scrollToTop } ) => { return ; } - const loginToCheckoutUrl = `/wp-login.php?redirect_to=${ encodeURIComponent( - window.location.href - ) }`; - if ( ! isEditor && ! customerId && ! CHECKOUT_ALLOWS_GUEST ) { return ( <> @@ -101,7 +98,7 @@ const Checkout = ( { attributes, scrollToTop } ) => { 'You must be logged in to checkout. ', 'woo-gutenberg-products-block' ) } - + { __( 'Click here to log in.', 'woo-gutenberg-products-block' @@ -120,7 +117,6 @@ const Checkout = ( { attributes, scrollToTop } ) => {
{ cartNeedsPayment && } { }; const CheckoutForm = ( { - loginToCheckoutUrl, requireCompanyField, requirePhoneField, showApartmentField, @@ -133,9 +132,7 @@ const CheckoutForm = ( { "We'll use this email to send you details and updates about your order.", 'woo-gutenberg-products-block' ) } - stepHeadingContent={ () => ( - - ) } + stepHeadingContent={ () => } > { +/** + * Internal dependencies + */ +import { LOGIN_TO_CHECKOUT_URL } from '../utils'; + +const LoginPrompt = () => { const { customerId } = useCheckoutContext(); if ( ! CHECKOUT_SHOW_LOGIN_REMINDER || customerId ) { @@ -19,15 +23,11 @@ const LoginPrompt = ( { loginToCheckoutUrl } ) => { 'Already have an account? ', 'woo-gutenberg-products-block' ) } - + { __( 'Log in.', 'woo-gutenberg-products-block' ) } ); }; -LoginPrompt.propTypes = { - loginToCheckoutUrl: PropTypes.string.isRequired, -}; - export default LoginPrompt; diff --git a/assets/js/blocks/cart-checkout/checkout/utils.js b/assets/js/blocks/cart-checkout/checkout/utils.js new file mode 100644 index 00000000000..622d6e1a1d5 --- /dev/null +++ b/assets/js/blocks/cart-checkout/checkout/utils.js @@ -0,0 +1,3 @@ +export const LOGIN_TO_CHECKOUT_URL = `/wp-login.php?redirect_to=${ encodeURIComponent( + window.location.href +) }`; From 0710e73a2e856f84384667451904f1e8e736f08d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Mon, 31 Aug 2020 12:00:31 +0200 Subject: [PATCH 9/9] Move replaced class name docs to 3.4.0 specific file --- docs/theming/README.md | 1 + docs/theming/class-names-update-330.md | 6 +----- docs/theming/class-names-update-340.md | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 docs/theming/class-names-update-340.md diff --git a/docs/theming/README.md b/docs/theming/README.md index f53dcb3bff0..40e27488e5a 100644 --- a/docs/theming/README.md +++ b/docs/theming/README.md @@ -72,3 +72,4 @@ WooCommerce Blocks avoids using legacy unprefixed classes as much as possible. H - [Product grid blocks style update in 2.7.0](./product-grid-270.md) - [Class names update in 2.8.0](./class-names-update-280.md) - [Class names update in 3.3.0](./class-names-update-330.md) +- [Class names update in 3.4.0](./class-names-update-340.md) diff --git a/docs/theming/class-names-update-330.md b/docs/theming/class-names-update-330.md index c6dbb5ed81b..54dd4bb1e31 100644 --- a/docs/theming/class-names-update-330.md +++ b/docs/theming/class-names-update-330.md @@ -1,4 +1,4 @@ -# Class names update in 2.8.0 +# Class names update in 3.3.0 WC Blocks 3.3.0, introduced express payment methods in the Cart block. In order to make it easy to write styles for express payment methods for the Cart and Checkout blocks separately, we updated several class names: @@ -45,8 +45,4 @@ WC Blocks 3.3.0, introduced express payment methods in the Cart block. In order wc-block-components-express-checkout-payment-event-buttons wc-block-components-express-payment__event-buttons - - wc-block-components-checkout-form - wc-block-checkout__form - diff --git a/docs/theming/class-names-update-340.md b/docs/theming/class-names-update-340.md new file mode 100644 index 00000000000..0962ed18562 --- /dev/null +++ b/docs/theming/class-names-update-340.md @@ -0,0 +1,14 @@ +# Class names update in 3.4.0 + +## Replaced classes + + + + + + + + + + +
RemovedNew class
wc-block-components-checkout-formwc-block-checkout__form