2020-04-01 09:27:53 +00:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2020-11-16 13:12:56 +00:00
|
|
|
import { CheckoutProvider } from '../checkout';
|
2020-04-01 09:27:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Cart provider
|
|
|
|
* This wraps the Cart and provides an api interface for the Cart to
|
|
|
|
* children via various hooks.
|
|
|
|
*
|
2020-04-30 09:52:36 +00:00
|
|
|
* @param {Object} props Incoming props for the provider.
|
|
|
|
* @param {Object} [props.children] The children being wrapped.
|
|
|
|
* @param {string} [props.redirectUrl] Initialize what the cart will
|
|
|
|
* redirect to after successful
|
|
|
|
* submit.
|
2020-04-01 09:27:53 +00:00
|
|
|
*/
|
2020-04-30 09:52:36 +00:00
|
|
|
export const CartProvider = ( { children, redirectUrl } ) => {
|
2020-04-01 09:27:53 +00:00
|
|
|
return (
|
2020-11-16 13:12:56 +00:00
|
|
|
<CheckoutProvider isCart={ true } redirectUrl={ redirectUrl }>
|
|
|
|
{ children }
|
|
|
|
</CheckoutProvider>
|
2020-04-01 09:27:53 +00:00
|
|
|
);
|
|
|
|
};
|