Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Order confirmation: Convert Order Details Templates to Blocks #10095

Conversation

mikejolley
Copy link
Member

@mikejolley mikejolley commented Jul 4, 2023

This PR migrates all order details templates to blocks. The blocks are named "totals" and "downloads".

There is still the issue of hiding other content if this block renders empty, but for that see #10094

Fixes #10058
Fixes #10048

Screenshots

Screenshot 2023-07-04 at 13 49 32

Testing

User Facing Testing

  1. Go to Appearance > Editor > Templates > Order Confirmation
  2. Insert the "Order Confirmation Downloads" block
  3. Insert the "Order Confirmation Details" block
  4. Confirm the previews show sample order data in a table format
  5. Save the template
  6. Go to the frontend and place a new order. Ensure you are purchasing a downloadable product (e.g. Album)
  7. Leave the confirmation page open. In a new tab, go to admin and mark the order completed.
  8. Refresh confirmation page.
  9. Confirm the order confirmation page shows the new blocks correctly, including purchased downloads.
  • Do not include in the Testing Notes

WooCommerce Visibility

  • WooCommerce Core
  • Feature plugin
  • Experimental

@mikejolley mikejolley self-assigned this Jul 4, 2023
@woocommercebot woocommercebot requested review from a team and wavvves and removed request for a team July 4, 2023 12:51
@github-actions
Copy link
Contributor

github-actions bot commented Jul 4, 2023

The release ZIP for this PR is accessible via:

https://wcblocks.wpcomstaging.com/wp-content/uploads/woocommerce-gutenberg-products-block-10095.zip

Script Dependencies Report

The compare-assets action has detected some changed script dependencies between this branch and trunk. Please review and confirm the following are correct before merging.

Script Handle Added Removed
order-confirmation-summary.js wp-block-editor, wp-blocks, wp-element, wp-polyfill, wp-primitives, wp-server-side-render ⚠️
order-confirmation-totals.js wp-block-editor, wp-blocks, wp-element, wp-polyfill, wp-primitives, wp-server-side-render ⚠️
order-confirmation-downloads.js wp-block-editor, wp-blocks, wp-components, wp-element, wp-polyfill, wp-primitives, wp-server-side-render ⚠️
order-confirmation-billing-address.js wp-block-editor, wp-blocks, wp-element, wp-polyfill, wp-primitives ⚠️
order-confirmation-shipping-address.js wp-block-editor, wp-blocks, wp-element, wp-polyfill, wp-primitives ⚠️
order-confirmation-status.js wp-block-editor, wp-blocks, wp-element, wp-i18n, wp-polyfill, wp-primitives ⚠️

This comment was automatically generated by the ./github/compare-assets action.

TypeScript Errors Report

  • Files with errors: 474
  • Total errors: 2249

⚠️ ⚠️ This PR introduces new TS errors on 9 files:

assets/js/blocks/order-confirmation/billing-address/index.tsx

assets/js/blocks/order-confirmation/downloads/edit.tsx

assets/js/blocks/order-confirmation/downloads/index.tsx

assets/js/blocks/order-confirmation/shipping-address/index.tsx

assets/js/blocks/order-confirmation/status/index.tsx

assets/js/blocks/order-confirmation/summary/edit.tsx

assets/js/blocks/order-confirmation/summary/index.tsx

assets/js/blocks/order-confirmation/totals/edit.tsx

assets/js/blocks/order-confirmation/totals/index.tsx

comments-aggregator

@mikejolley mikejolley added the type: new block Applied to work that introduces a new block (typically used on an epic issue). label Jul 4, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jul 4, 2023

Size Change: +1.62 kB (0%)

Total Size: 1.19 MB

Filename Size Change
build/active-filters.js 7.54 kB +1 B (0%)
build/all-reviews.js 7.86 kB -1 B (0%)
build/attribute-filter.js 13.3 kB +7 B (0%)
build/breadcrumbs.js 2.13 kB +1 B (0%)
build/cart.js 45.4 kB +4 B (0%)
build/checkout.js 47.9 kB -8 B (0%)
build/customer-account.js 3.18 kB -2 B (0%)
build/featured-category.js 15.1 kB +3 B (0%)
build/featured-product.js 15.3 kB +3 B (0%)
build/filter-wrapper.js 2.4 kB -2 B (0%)
build/legacy-template.js 8.92 kB -3 B (0%)
build/mini-cart-contents.js 18.1 kB -8 B (0%)
build/mini-cart.js 5.93 kB +2 B (0%)
build/order-confirmation-details.js 0 B -1.68 kB (removed) 🏆
build/order-confirmation-shipping-address.js 1.66 kB +1 B (0%)
build/order-confirmation-status.js 1.41 kB -1 B (0%)
build/order-confirmation-summary.js 1.37 kB +3 B (0%)
build/price-filter.js 8.6 kB -1 B (0%)
build/product-add-to-cart.js 8.84 kB +3 B (0%)
build/product-best-sellers.js 8.35 kB -4 B (0%)
build/product-categories.js 2.72 kB +2 B (0%)
build/product-category.js 9.36 kB -2 B (0%)
build/product-collection.js 12.3 kB +1 B (0%)
build/product-image.js 4.21 kB +1 B (0%)
build/product-new.js 8.66 kB +4 B (0%)
build/product-on-sale.js 8.65 kB -2 B (0%)
build/product-query.js 12 kB +4 B (0%)
build/product-results-count.js 1.65 kB +1 B (0%)
build/product-search.js 2.64 kB +1 B (0%)
build/product-template.js 3.34 kB +1 B (0%)
build/product-top-rated.js 8.91 kB +1 B (0%)
build/products-by-attribute.js 9.76 kB +1 B (0%)
build/rating-filter.js 6.92 kB +2 B (0%)
build/reviews-by-category.js 12.1 kB -1 B (0%)
build/reviews-by-product.js 13.3 kB +1 B (0%)
build/single-product.js 11.2 kB +8 B (0%)
build/stock-filter.js 7.68 kB +2 B (0%)
build/wc-blocks-style-rtl.css 28.3 kB +72 B (0%)
build/wc-blocks-style.css 28.3 kB +72 B (0%)
build/wc-blocks-vendors.js 65.5 kB +65 B (0%)
build/order-confirmation-downloads.js 1.39 kB +1.39 kB (new file) 🆕
build/order-confirmation-totals.js 1.68 kB +1.68 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
build/active-filters-frontend.js 8.64 kB
build/active-filters-wrapper-frontend.js 7.58 kB
build/all-products-frontend.js 12.3 kB
build/all-products.js 41.1 kB
build/attribute-filter-frontend.js 23 kB
build/attribute-filter-wrapper-frontend.js 7.74 kB
build/blocks-checkout.js 35.1 kB
build/cart-blocks/cart-accepted-payment-methods-frontend.js 1.38 kB
build/cart-blocks/cart-cross-sells-frontend.js 253 B
build/cart-blocks/cart-cross-sells-products--product-price-frontend.js 2.92 kB
build/cart-blocks/cart-cross-sells-products-frontend.js 3.83 kB
build/cart-blocks/cart-express-payment--checkout-blocks/express-payment-frontend.js 5.16 kB
build/cart-blocks/cart-express-payment-frontend.js 720 B
build/cart-blocks/cart-items-frontend.js 301 B
build/cart-blocks/cart-line-items--mini-cart-contents-block/products-table-frontend.js 5.47 kB
build/cart-blocks/cart-line-items-frontend.js 1.06 kB
build/cart-blocks/cart-order-summary-frontend.js 1.28 kB
build/cart-blocks/cart-totals-frontend.js 307 B
build/cart-blocks/empty-cart-frontend.js 347 B
build/cart-blocks/filled-cart-frontend.js 656 B
build/cart-blocks/order-summary-coupon-form-frontend.js 1.63 kB
build/cart-blocks/order-summary-discount-frontend.js 2.12 kB
build/cart-blocks/order-summary-fee-frontend.js 273 B
build/cart-blocks/order-summary-heading-frontend.js 333 B
build/cart-blocks/order-summary-shipping-frontend.js 17 kB
build/cart-blocks/order-summary-subtotal-frontend.js 274 B
build/cart-blocks/order-summary-taxes-frontend.js 436 B
build/cart-blocks/proceed-to-checkout-frontend.js 1.44 kB
build/cart-frontend.js 29.9 kB
build/catalog-sorting.js 1.7 kB
build/checkout-blocks/actions-frontend.js 1.88 kB
build/checkout-blocks/billing-address--checkout-blocks/shipping-address-frontend.js 4.69 kB
build/checkout-blocks/billing-address-frontend.js 1.18 kB
build/checkout-blocks/contact-information-frontend.js 2.04 kB
build/checkout-blocks/express-payment-frontend.js 1.14 kB
build/checkout-blocks/fields-frontend.js 332 B
build/checkout-blocks/order-note-frontend.js 1.14 kB
build/checkout-blocks/order-summary-cart-items-frontend.js 3.76 kB
build/checkout-blocks/order-summary-coupon-form-frontend.js 1.79 kB
build/checkout-blocks/order-summary-discount-frontend.js 2.29 kB
build/checkout-blocks/order-summary-fee-frontend.js 275 B
build/checkout-blocks/order-summary-frontend.js 1.28 kB
build/checkout-blocks/order-summary-shipping-frontend.js 17 kB
build/checkout-blocks/order-summary-subtotal-frontend.js 273 B
build/checkout-blocks/order-summary-taxes-frontend.js 435 B
build/checkout-blocks/payment-frontend.js 9.27 kB
build/checkout-blocks/pickup-options-frontend.js 4.84 kB
build/checkout-blocks/shipping-address-frontend.js 1.17 kB
build/checkout-blocks/shipping-method-frontend.js 2.63 kB
build/checkout-blocks/shipping-methods-frontend.js 6.41 kB
build/checkout-blocks/terms-frontend.js 1.56 kB
build/checkout-blocks/totals-frontend.js 361 B
build/checkout-frontend.js 31.8 kB
build/filter-wrapper-frontend.js 14.2 kB
build/general-style-rtl.css 1.31 kB
build/general-style.css 1.31 kB
build/handpicked-products.js 8.04 kB
build/mini-cart-component-frontend.js 30.8 kB
build/mini-cart-contents-block/cart-button-frontend.js 1.73 kB
build/mini-cart-contents-block/checkout-button-frontend.js 1.81 kB
build/mini-cart-contents-block/empty-cart-frontend.js 360 B
build/mini-cart-contents-block/filled-cart-frontend.js 267 B
build/mini-cart-contents-block/footer-frontend.js 3.83 kB
build/mini-cart-contents-block/items-frontend.js 237 B
build/mini-cart-contents-block/products-table-frontend.js 588 B
build/mini-cart-contents-block/shopping-button-frontend.js 530 B
build/mini-cart-contents-block/title-frontend.js 1.89 kB
build/mini-cart-contents-block/title-items-counter-frontend.js 1.59 kB
build/mini-cart-contents-block/title-label-frontend.js 1.53 kB
build/mini-cart-frontend.js 2.84 kB
build/order-confirmation-billing-address.js 1.67 kB
build/price-filter-frontend.js 14.7 kB
build/price-filter-wrapper-frontend.js 6.79 kB
build/price-format.js 1.19 kB
build/product-add-to-cart--product-button--product-image--product-price--product-rating--product-rating-s--92e2d51d.js 269 B
build/product-add-to-cart--product-button--product-image--product-rating--product-rating-stars--product-title.js 151 B
build/product-add-to-cart-frontend.js 6.53 kB
build/product-button--product-image--product-price--product-rating--product-rating-stars--product-sale-ba--4e6a8b3c.js 954 B
build/product-button-frontend.js 2.66 kB
build/product-button.js 3.97 kB
build/product-gallery.js 2.3 kB
build/product-image-frontend.js 2.71 kB
build/product-price-frontend.js 231 B
build/product-price.js 1.68 kB
build/product-rating-frontend.js 2.35 kB
build/product-rating-stars-frontend.js 2.24 kB
build/product-rating-stars.js 939 B
build/product-rating.js 1.04 kB
build/product-sale-badge-frontend.js 1.8 kB
build/product-sale-badge.js 666 B
build/product-sku-frontend.js 1.85 kB
build/product-sku.js 535 B
build/product-stock-indicator-frontend.js 2.04 kB
build/product-stock-indicator.js 732 B
build/product-summary-frontend.js 2.26 kB
build/product-summary.js 1 kB
build/product-tag.js 8.87 kB
build/product-title-frontend.js 2.22 kB
build/product-title.js 3.65 kB
build/rating-filter-frontend.js 21.4 kB
build/rating-filter-wrapper-frontend.js 6.23 kB
build/reviews-frontend.js 7.17 kB
build/stock-filter-frontend.js 21.7 kB
build/stock-filter-wrapper-frontend.js 6.5 kB
build/store-notices.js 1.69 kB
build/vendors--attribute-filter-wrapper--cart-blocks/order-summary-coupon-form--cart-blocks/order-summary--48e1e4bb-frontend.js 6.83 kB
build/vendors--attribute-filter-wrapper--cart-blocks/order-summary-shipping--checkout-blocks/billing-addr--d9f38f9d-frontend.js 4.2 kB
build/vendors--attribute-filter-wrapper-frontend.js 5.11 kB
build/vendors--cart-blocks/cart-cross-sells-products--cart-blocks/cart-line-items--cart-blocks/cart-order--3c5fe802-frontend.js 5.26 kB
build/vendors--cart-blocks/cart-line-items--checkout-blocks/order-summary-cart-items--mini-cart-contents---233ab542-frontend.js 3.57 kB
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--decc3dc6-frontend.js 19.4 kB
build/vendors--checkout-blocks/pickup-options--checkout-blocks/shipping-methods-frontend.js 8.25 kB
build/vendors--checkout-blocks/shipping-method-frontend.js 12.4 kB
build/vendors--price-filter-wrapper-frontend.js 2.2 kB
build/vendors--product-add-to-cart-frontend.js 7.25 kB
build/vendors--rating-filter-wrapper-frontend.js 5.11 kB
build/vendors--stock-filter-wrapper-frontend.js 5.11 kB
build/wc-blocks-data.js 22.4 kB
build/wc-blocks-editor-style-rtl.css 6.35 kB
build/wc-blocks-editor-style.css 6.34 kB
build/wc-blocks-google-analytics.js 1.56 kB
build/wc-blocks-middleware.js 934 B
build/wc-blocks-registry.js 3.15 kB
build/wc-blocks-shared-context.js 1.1 kB
build/wc-blocks-shared-hocs.js 1.75 kB
build/wc-blocks-vendors-style-rtl.css 1.96 kB
build/wc-blocks-vendors-style.css 1.96 kB
build/wc-blocks.js 3.74 kB
build/wc-interactivity.js 10.4 kB
build/wc-payment-method-bacs.js 816 B
build/wc-payment-method-cheque.js 811 B
build/wc-payment-method-cod.js 909 B
build/wc-payment-method-paypal.js 837 B
build/wc-settings.js 2.6 kB
build/wc-shipping-method-pickup-location.js 30.4 kB

compressed-size-action

Copy link
Contributor

@wavvves wavvves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@mikejolley mikejolley merged commit 1c8e99f into feature/blockify-order-confirmation Jul 5, 2023
@mikejolley mikejolley deleted the fix/order-items-details-content branch July 5, 2023 16:13
mikejolley added a commit that referenced this pull request Jul 6, 2023
* Move code from templates into the details block

* Details -> Totals

* Downloads block

* Sample content for downloads block

* Add block icon
mikejolley added a commit that referenced this pull request Jul 11, 2023
* Move code from templates into the details block

* Details -> Totals

* Downloads block

* Sample content for downloads block

* Add block icon
mikejolley added a commit that referenced this pull request Jul 18, 2023
* Move code from templates into the details block

* Details -> Totals

* Downloads block

* Sample content for downloads block

* Add block icon
mikejolley added a commit that referenced this pull request Aug 14, 2023
* Move code from templates into the details block

* Details -> Totals

* Downloads block

* Sample content for downloads block

* Add block icon
tarhi-saad pushed a commit that referenced this pull request Aug 25, 2023
* Move code from templates into the details block

* Details -> Totals

* Downloads block

* Sample content for downloads block

* Add block icon
mikejolley added a commit that referenced this pull request Sep 1, 2023
* Move code from templates into the details block

* Details -> Totals

* Downloads block

* Sample content for downloads block

* Add block icon
mikejolley added a commit that referenced this pull request Sep 19, 2023
* Move code from templates into the details block

* Details -> Totals

* Downloads block

* Sample content for downloads block

* Add block icon
mikejolley added a commit that referenced this pull request Sep 20, 2023
* Main block types for confirmation

* Initial blocks

* Styling and placeholders

* Make blocks experimental

* Update summary icon

* Add name/description for status block and missing text descriptions in the block.

Closes #10057

* Order confirmation: Convert Order Details Templates to Blocks (#10095)

* Move code from templates into the details block

* Details -> Totals

* Downloads block

* Sample content for downloads block

* Add block icon

* Add conversion template (#10077)

* Update inner block name

* Add default title constant

* Revert "Add default title constant"

This reverts commit 1dd3bbf.

* Add global styles for order confirmation status block (#10164)

* Implement style controls

* Prevent link color spilling over onto wrapper

* Add styles and remove class names

* Remove __experimentalWritingMode

* Add global styles for order confirmation summary block (#10179)

* Styles for summary

* Remove __experimentalWritingMode

* Add table styles for order details (#10185)

* Add table styles for order details

* __experimentalFontWeight

* Add link styles

* Handle preview link styles

* Unauthenticated views for Order Confirmation template (#10414)

* Different views by permission

* check user id matches when logged out

* Add order confirmation wrapper block (#10286)

* Add a heading wrapper block

* Register the BillingWrapper Block server side

* Fix exception 'render_content' error

* Add the Billing Wrapper Block to the template

* Fix wrong block name error

* Fix php error

* Conditionally render Billing Address within the Wrapper

* Fix parent rendering

* Clean up code (remove billing address from the template)

* Update titles, descriptions, and icons of the billing Block and inner block

* Fix broken block by removing the "parent" keyword

* Use a user-friendly title and description for the Billing Wrapper

* Update Billing Wrapper Block's title case

Co-authored-by: Mike Jolley <mike.jolley@me.com>

* Fix PHP failing unit test

---------

Co-authored-by: Mike Jolley <mike.jolley@me.com>

* Remove "thanks" for authenticated page

* Introduce shipping wrapper based on billing wrapper

Closes #10053

* Order confirmation block: Verify email address for guest customers (#10567)

* Add verify step for guest orders

* Render content to pass through block content

* Revert package changes

* Customer orders cannot use email to verify

* Add style controls for order shipping and billing address blocks (#10633)

* Order confirmation block styling (#10780)

* Add missing heading to order details

* Summary block spacing

* Update css variables

* table styles

* Inherit border styles for cells

* Alignment and address styles

* Add downloads wrapper

* Style controls

* Fix typo

* Update Download Wrapper's Icon

* Fix TS error

* Disable Download Block's server side rendering in the editor

This fixes the loading after each style change from the style controls

* Clean up Downloads render functions

* Fix client side Downloads Block's table border

* Download + Total wrappers and tables styling

* small screen

* Remove server side render for previews

---------

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>

* Shorten template description

* Update test address data

* Avoid leaking order key in permission form

* Remove todo

* Make email form required.

* Remove edit page link

* Remove empty columns from address wrapper

* Remove IIFE

* typo

* Update description to mention billing

* Adjust link scss

* Fix wrapper markup and spacing controls

* Add link preview in editor

* Add initial E2E setup for the Order Confirmation Block (#10840)

* Fix WC_DateTime check

* Move form outside of block markup

* Add additional information block (#10842)

* Add block which contains hooks

* Use skeleton for placeholder instead of illustration

* Remove duplicate methods

* Remove duplicate align tag

* Update meta styles

* Tests for order confirmation conditional blocks (#10972)

* Add tests for conditional blocks

* Move setup into test

* Add E2E to the the Order Confirmation Block (#10863)

* Add editor util functions

* Update editor template E2E test

* Add the "exact" property for consistency

* Skip test

Can't get the element in the page. More investigation needed! Skipping
for now.

* Fix "transformIntoBlocks" logic

* Add tests for logged in user

* Fix "beforeAll" config

* Confirm downloads section is visible when logged in

* Create "verifyOrderConfirmationDetails" util function

* Add logged in test case

* Add Guest user test case

* Fix editor e2e testing

* Apply a proper teardown

* Fix failing tests after logout

* Ensure we are logged in before visiting the editor

* Ensure to have shipping selected

* Wait for changes to be saved on the editor

* Ensure shipping options is selected

* Remove comment

* Ensure we are logged in before going to the admin page

* Mark the Order Confirmation as a side effect test

* OrderConfirmation blocks are not experimental

* resolve merge conflict

* Revert package lock changes

* Fix enqueue_assets

* Fix CSS 404s

* Make template tests more robust

* Fix page URL for default confirmation page

* Try afterEach to log back in

* Skip guest/logout use cases

Login out causes other tests to fail. We will implement these case when
the multiple sign in roles are introduced in the codebase.

* Remove tests requiring login out & add comments

* Remove unused util functions

* Hide confirmation blocks from post editor

---------

Co-authored-by: Saad Tarhi <saad.trh@gmail.com>
Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: new block Applied to work that introduces a new block (typically used on an epic issue).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants