woocommerce/plugins/woocommerce-blocks/packages/checkout/utils
Alex Florisca d9bf1ba94c Convert components to Typescript (https://github.com/woocommerce/woocommerce-blocks/pull/5241)
* Convert ReturnToCartButton component to TS

* Convert FormStep component to TS

* Remoe proptypes from FormStep and AddressFormn components

* Converted order-summary component to TS

* Convert product-price component to TS

* alias path to type-defs

* Fix errors

* Changes from Thomas feedback

* Change minPrice maxPrice logic to be more robust

* Changed types from inline to interface in ReturnToCartButton component

* Check for string type in order-summary-item

* add missing isString check
2021-11-26 17:03:12 +00:00
..
validation Convert components to Typescript (https://github.com/woocommerce/woocommerce-blocks/pull/5241) 2021-11-26 17:03:12 +00:00
README.md Add Checkout Package and Checkout i2 Documentation (https://github.com/woocommerce/woocommerce-blocks/pull/4892) 2021-10-12 15:23:52 +01:00
extension-cart-update.ts Add cart/extensions endpoint to allow third party extensions to process server-side and get a new cart (https://github.com/woocommerce/woocommerce-blocks/pull/4298) 2021-06-07 12:16:47 +03:00
index.js Add cart/extensions endpoint to allow third party extensions to process server-side and get a new cart (https://github.com/woocommerce/woocommerce-blocks/pull/4298) 2021-06-07 12:16:47 +03:00

README.md

Checkout - Utilities

Miscellaneous utility functions for dealing with checkout functionality.

Table of Contents

extensionCartUpdate

When executed, this will call the cart/extensions REST API endpoint. The new cart is then received into the client-side store.

Usage

// Aliased import
import { extensionCartUpdate } from '@woocommerce/blocks-checkout';

// Global import
// const { extensionCartUpdate } = wc.blocksCheckout;

extensionCartUpdate( {
	namespace: 'extension-unique-namespace',
	data: {
		key: 'value',
	},
} );

Options

The following options are available:

args (object, required)

Args to pass to the Rest API endpoint. This can contain data and a namespace to trigger extension specific functionality on the server-side. You can read more about this, and the server-side implementation, in this doc.

mustContain

Ensures that a given value contains a string, or throws an error.

Usage

// Aliased import
import { mustContain } from '@woocommerce/blocks-checkout';

// Global import
// const { mustContain } = wc.blocksCheckout;

mustContain( 'This is a string containing a <price />', '<price />' ); // This will not throw an error
mustContain( 'This is a string', '<price />' ); // This will throw an error

Options

The following options are available:

value (string, required)

Value being checked. Must be a string.

requiredValue (string, required)

What value must contain. If this is not found within value, and error will be thrown.



WooCommerce
We're hiring! Come work with us!