woocommerce/plugins/woocommerce-blocks/assets/js/blocks/classic-template/order-confirmation.tsx

154 lines
4.2 KiB
TypeScript
Raw Normal View History

Add Cart/Checkout/Order-Received Templates (https://github.com/woocommerce/woocommerce-blocks/pull/9301) * WIP: dirty attempt to dry run Cart & Checkout templates * Added Cart and Checkout to the template hierarchies * Merge branch 'trunk' into poc/cart_and_checkout_fse_templates * Updated cart & Checkout templates * Order Received FSE template (https://github.com/woocommerce/woocommerce-blocks/pull/8937) * Order Received template bootstrap * typo * WIP: new block * add logic here * Order received classic template * reverted constants.ts * Added the post title (buggy) * Corrected page title * Updated constants.ts * Fixed template typo * removed placeholder for order received block * add order-received template description * updated placeholder description * Formatting fixes * Template description. * replaced hardcoded string with OrderReceivedTemplate::SLUG --------- Co-authored-by: Luigi <gigitux@gmail.com> * Code formatting (https://github.com/woocommerce/woocommerce-blocks/pull/8350) * Code formatting * page_template_hierarchy priority to 1 (https://github.com/woocommerce/woocommerce-blocks/pull/9323) Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com> * Migrate Cart and Checkout Pages to the Template Editor when using a FSE theme (https://github.com/woocommerce/woocommerce-blocks/pull/9339) * Introduce woocommerce_blocks_template_content hook * Migrate cart and checkout page content to the template editor * Add redirection from edit page to edit template --------- Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com> * Removed header and footer from checkout template. (https://github.com/woocommerce/woocommerce-blocks/pull/9378) * Removed header and footer from checkout template. * Removed header and footer from checkout template migration * Permalink solution for the checkout endpoint/template (https://github.com/woocommerce/woocommerce-blocks/pull/9406) * Checkout endpoint work * Move setting field to util * Include link to edit the template * Remove todo * Refactor checkout templates to share logic (https://github.com/woocommerce/woocommerce-blocks/pull/9411) * Sync endpoints with pages (https://github.com/woocommerce/woocommerce-blocks/pull/9426) * Switch to page syncing * Update settings descriptions --------- Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com> * Migrate pages to templates once (https://github.com/woocommerce/woocommerce-blocks/pull/9488) * Migrate content on init, once * Skip migration if page does not exist * Put back HTML for header and footer parts * Fix page redirect due to wrong ID * fix loading template part * Removed unnecessary var * update cart and checkout html templates --------- Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com> * Include a notice to redirect user to template editor (https://github.com/woocommerce/woocommerce-blocks/pull/9508) * Template Placeholder Design for the Order Received Template (https://github.com/woocommerce/woocommerce-blocks/pull/9602) * Load frontend styles in editor iframe * Update placeholder to include skeleton and updated icons * Update classic template configs * 1px border for .wp-block-woocommerce-classic-template__placeholder-copy * Show copy on focus * Sample data --------- Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com> * Add simplified header on checkout template (https://github.com/woocommerce/woocommerce-blocks/pull/9607) * Added simplified header on checkout template * Moved simplified header to template part * updated constants.ts * added template part to checkout.html * Add missing translation * frontpage_template_hierarchy no longer needed * Allow plugin based template parts (https://github.com/woocommerce/woocommerce-blocks/pull/9667) * Merge branch 'trunk' into add/9288_cart-checkout-order-received_fse_templates * Synced templates on blockified folder * Add blockified order-received.html * removed WooCommerce prefix * Refactor/rebrand order received template to order confirmation (https://github.com/woocommerce/woocommerce-blocks/pull/9734) * rebrand order received to order confirmation * updated descriptions for templates * updated descriptions for order confirmation placeholder * Resolve merge conflict * Resolve merge conflicts * Resolve more merge conflicts after rebase * Fix formatting * Use patterns for localisation (https://github.com/woocommerce/woocommerce-blocks/pull/9883) * e2e tests for cart and checkout templates (https://github.com/woocommerce/woocommerce-blocks/pull/9939) * Merge branch 'trunk' into poc/cart_and_checkout_fse_templates * Merge branch 'trunk' into add/9288_cart-checkout-order-received_fse_templates * Resolve merge conflicts * Add e2e for permalink settings * Test that templates exist * Add test to check that templates can be edited * Add tests to confirm templates can be edited * Ensure cart has contents before running tests on frontend views * Commend out problem test * Make sure search has multiple results * Remove useThrottle - bad rebase * Revert changes to docs after rebase * Revert function call for noReviewsPlaceholder * Bad rebase * Reverts * Remove revertTemplate * Spacing * Wait for networkidle after navigation * Always wait for network * Use button roles in site editor * More specific button locator * Update option comparison * Fix template content * Disable failing tests * Disable failing classic template tests * Use enterEditMode * More enterEditMode usage * enterEditMode * Use test.skip * More robust selectors * Alt iframe selector --------- Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com> * Skip flakey test --------- Co-authored-by: Luigi <gigitux@gmail.com> Co-authored-by: Mike Jolley <mike.jolley@me.com>
2023-06-29 13:41:22 +00:00
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
const isConversionPossible = () => {
return false;
};
const getDescription = () => {
return __(
'This block represents the classic template used to display the order confirmation. The actual rendered template may appear different from this placeholder.',
'woo-gutenberg-products-block'
);
};
const getSkeleton = () => {
return (
<div className="woocommerce-page">
<div className="woocommerce-order">
<h1>
{ __( 'Order received', 'woo-gutenberg-products-block' ) }
</h1>
<p className="woocommerce-notice woocommerce-notice--success woocommerce-thankyou-order-confirmation">
{ __(
'Thank you. Your order has been received.',
'woo-gutenberg-products-block'
) }
</p>
<ul className="woocommerce-order-overview woocommerce-thankyou-order-details order_details">
<li className="woocommerce-order-overview__order order">
{ __( 'Order number', 'woo-gutenberg-products-block' ) }
: <strong>123</strong>
</li>
<li className="woocommerce-order-overview__date date">
{ __( 'Date', 'woo-gutenberg-products-block' ) }:{ ' ' }
<strong>May 25, 2023</strong>
</li>
<li className="woocommerce-order-overview__email email">
{ __( 'Email', 'woo-gutenberg-products-block' ) }:{ ' ' }
<strong>shopper@woo.com</strong>
</li>
<li className="woocommerce-order-overview__total total">
{ __( 'Total', 'woo-gutenberg-products-block' ) }:{ ' ' }
<strong>$20.00</strong>
</li>
</ul>
<section className="woocommerce-order-details">
<h2 className="woocommerce-order-details__title">
{ __(
'Order details',
'woo-gutenberg-products-block'
) }
</h2>
<table className="woocommerce-table woocommerce-table--order-details shop_table order_details">
<thead>
<tr>
<th className="woocommerce-table__product-name product-name">
{ __(
'Product',
'woo-gutenberg-products-block'
) }
</th>
<th className="woocommerce-table__product-table product-total">
{ __(
'Total',
'woo-gutenberg-products-block'
) }
</th>
</tr>
</thead>
<tbody>
<tr className="woocommerce-table__line-item order_item">
<td className="woocommerce-table__product-name product-name">
Sample Product{ ' ' }
<strong className="product-quantity">
×&nbsp;2
</strong>{ ' ' }
</td>
<td className="woocommerce-table__product-total product-total">
$20.00
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th scope="row">
{ __(
'Subtotal',
'woo-gutenberg-products-block'
) }
:
</th>
<td>$20.00</td>
</tr>
<tr>
<th scope="row">
{ __(
'Total',
'woo-gutenberg-products-block'
) }
:
</th>
<td>$20.00</td>
</tr>
</tfoot>
</table>
</section>
<section className="woocommerce-customer-details">
<section className="woocommerce-columns woocommerce-columns--2 woocommerce-columns--addresses col2-set addresses">
<div className="woocommerce-column woocommerce-column--1 woocommerce-column--billing-address col-1">
<h2 className="woocommerce-column__title">
{ __(
'Billing address',
'woo-gutenberg-products-block'
) }
</h2>
<address>
123 Main St
<br />
New York, NY 10001
<br />
United States (US)
</address>
</div>
<div className="woocommerce-column woocommerce-column--2 woocommerce-column--shipping-address col-2">
<h2 className="woocommerce-column__title">
{ __(
'Shipping address',
'woo-gutenberg-products-block'
) }
</h2>
<address>
123 Main St
<br />
New York, NY 10001
<br />
United States (US)
</address>
</div>
</section>
</section>
</div>
</div>
);
};
export { isConversionPossible, getDescription, getSkeleton };