Remove all traces of Notification Context

This commit is contained in:
Alex Florisca 2022-08-22 16:50:37 +01:00
parent 1d78f097cb
commit ef1dc66068
5 changed files with 29 additions and 52 deletions

View File

@ -13,10 +13,7 @@ import { CURRENT_USER_IS_ADMIN } from '@woocommerce/settings';
import BlockErrorBoundary from '@woocommerce/base-components/block-error-boundary';
import { translateJQueryEventToNative } from '@woocommerce/base-utils';
import withScrollToTop from '@woocommerce/base-hocs/with-scroll-to-top';
import {
StoreNoticesProvider,
CartProvider,
} from '@woocommerce/base-context/providers';
import { CartProvider } from '@woocommerce/base-context/providers';
import { SlotFillProvider } from '@woocommerce/blocks-checkout';
/**
@ -87,15 +84,13 @@ const Block = ( { attributes, children, scrollToTop } ) => (
showErrorMessage={ CURRENT_USER_IS_ADMIN }
>
<SnackbarNoticesContainer context="wc/cart" />
<StoreNoticesProvider>
<StoreNoticesContainer context="wc/cart" />
<SlotFillProvider>
<CartProvider>
<Cart attributes={ attributes }>{ children }</Cart>
<ScrollOnError scrollToTop={ scrollToTop } />
</CartProvider>
</SlotFillProvider>
</StoreNoticesProvider>
<StoreNoticesContainer context="wc/cart" />
<SlotFillProvider>
<CartProvider>
<Cart attributes={ attributes }>{ children }</Cart>
<ScrollOnError scrollToTop={ scrollToTop } />
</CartProvider>
</SlotFillProvider>
</BlockErrorBoundary>
);
export default withScrollToTop( Block );

View File

@ -31,7 +31,6 @@ import { LOGIN_TO_CHECKOUT_URL, isLoginRequired, reloadPage } from './utils';
import type { Attributes } from './types';
import { CheckoutBlockContext } from './context';
import { hasNoticesOfType } from '../../utils/notices';
import { StoreNoticesProvider } from '../../base/context/providers';
const LoginPrompt = () => {
return (
@ -185,24 +184,22 @@ const Block = ( {
showErrorMessage={ CURRENT_USER_IS_ADMIN }
>
<SnackbarNoticesContainer context="wc/checkout" />
<StoreNoticesProvider>
<StoreNoticesContainer context="wc/checkout" />
{ /* SlotFillProvider need to be defined before CheckoutProvider so fills have the SlotFill context ready when they mount. */ }
<SlotFillProvider>
<CheckoutProvider>
<SidebarLayout
className={ classnames( 'wc-block-checkout', {
'has-dark-controls': attributes.hasDarkControls,
} ) }
>
<Checkout attributes={ attributes }>
{ children }
</Checkout>
<ScrollOnError scrollToTop={ scrollToTop } />
</SidebarLayout>
</CheckoutProvider>
</SlotFillProvider>
</StoreNoticesProvider>
<StoreNoticesContainer context="wc/checkout" />
{ /* SlotFillProvider need to be defined before CheckoutProvider so fills have the SlotFill context ready when they mount. */ }
<SlotFillProvider>
<CheckoutProvider>
<SidebarLayout
className={ classnames( 'wc-block-checkout', {
'has-dark-controls': attributes.hasDarkControls,
} ) }
>
<Checkout attributes={ attributes }>
{ children }
</Checkout>
<ScrollOnError scrollToTop={ scrollToTop } />
</SidebarLayout>
</CheckoutProvider>
</SlotFillProvider>
</BlockErrorBoundary>
);
};

View File

@ -6,10 +6,7 @@ import PropTypes from 'prop-types';
import { ProductListContainer } from '@woocommerce/base-components/product-list';
import { InnerBlockLayoutContextProvider } from '@woocommerce/shared-context';
import { gridBlockPreview } from '@woocommerce/resource-previews';
import {
StoreNoticesProvider,
StoreNoticesContainer,
} from '@woocommerce/base-context';
import { StoreNoticesContainer } from '@woocommerce/base-context';
/**
* The All Products Block.
@ -40,9 +37,7 @@ class Block extends Component {
parentName="woocommerce/all-products"
parentClassName="wc-block-grid"
>
<StoreNoticesProvider>
<StoreNoticesContainer context={ 'wc/all-products' } />
</StoreNoticesProvider>
<StoreNoticesContainer context={ 'wc/all-products' } />
<ProductListContainer
attributes={ attributes }
urlParameterSuffix={ urlParameterSuffix }

View File

@ -1,7 +1,6 @@
/**
* External dependencies
*/
import { StoreNoticesProvider } from '@woocommerce/base-context';
import { renderFrontend } from '@woocommerce/base-utils';
/**
@ -15,11 +14,7 @@ import Block from './block';
* @param {*} props
*/
const AllProductsFrontend = ( props ) => {
return (
<StoreNoticesProvider context="wc/all-products">
<Block { ...props } />
</StoreNoticesProvider>
);
return <Block { ...props } />;
};
const getProps = ( el ) => ( {

View File

@ -7,10 +7,7 @@ import {
InnerBlockLayoutContextProvider,
ProductDataContextProvider,
} from '@woocommerce/shared-context';
import {
StoreNoticesProvider,
StoreNoticesContainer,
} from '@woocommerce/base-context';
import { StoreNoticesContainer } from '@woocommerce/base-context';
import { useStoreEvents } from '@woocommerce/base-context/hooks';
/**
@ -49,9 +46,7 @@ const Block = ( { isLoading, product, children } ) => {
product={ product }
isLoading={ isLoading }
>
<StoreNoticesProvider>
<StoreNoticesContainer context={ noticeContext } />
</StoreNoticesProvider>
<StoreNoticesContainer context={ noticeContext } />
<div className={ className }>{ children }</div>
</ProductDataContextProvider>
</InnerBlockLayoutContextProvider>