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 BlockErrorBoundary from '@woocommerce/base-components/block-error-boundary';
import { translateJQueryEventToNative } from '@woocommerce/base-utils'; import { translateJQueryEventToNative } from '@woocommerce/base-utils';
import withScrollToTop from '@woocommerce/base-hocs/with-scroll-to-top'; import withScrollToTop from '@woocommerce/base-hocs/with-scroll-to-top';
import { import { CartProvider } from '@woocommerce/base-context/providers';
StoreNoticesProvider,
CartProvider,
} from '@woocommerce/base-context/providers';
import { SlotFillProvider } from '@woocommerce/blocks-checkout'; import { SlotFillProvider } from '@woocommerce/blocks-checkout';
/** /**
@ -87,7 +84,6 @@ const Block = ( { attributes, children, scrollToTop } ) => (
showErrorMessage={ CURRENT_USER_IS_ADMIN } showErrorMessage={ CURRENT_USER_IS_ADMIN }
> >
<SnackbarNoticesContainer context="wc/cart" /> <SnackbarNoticesContainer context="wc/cart" />
<StoreNoticesProvider>
<StoreNoticesContainer context="wc/cart" /> <StoreNoticesContainer context="wc/cart" />
<SlotFillProvider> <SlotFillProvider>
<CartProvider> <CartProvider>
@ -95,7 +91,6 @@ const Block = ( { attributes, children, scrollToTop } ) => (
<ScrollOnError scrollToTop={ scrollToTop } /> <ScrollOnError scrollToTop={ scrollToTop } />
</CartProvider> </CartProvider>
</SlotFillProvider> </SlotFillProvider>
</StoreNoticesProvider>
</BlockErrorBoundary> </BlockErrorBoundary>
); );
export default withScrollToTop( Block ); 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 type { Attributes } from './types';
import { CheckoutBlockContext } from './context'; import { CheckoutBlockContext } from './context';
import { hasNoticesOfType } from '../../utils/notices'; import { hasNoticesOfType } from '../../utils/notices';
import { StoreNoticesProvider } from '../../base/context/providers';
const LoginPrompt = () => { const LoginPrompt = () => {
return ( return (
@ -185,7 +184,6 @@ const Block = ( {
showErrorMessage={ CURRENT_USER_IS_ADMIN } showErrorMessage={ CURRENT_USER_IS_ADMIN }
> >
<SnackbarNoticesContainer context="wc/checkout" /> <SnackbarNoticesContainer context="wc/checkout" />
<StoreNoticesProvider>
<StoreNoticesContainer context="wc/checkout" /> <StoreNoticesContainer context="wc/checkout" />
{ /* SlotFillProvider need to be defined before CheckoutProvider so fills have the SlotFill context ready when they mount. */ } { /* SlotFillProvider need to be defined before CheckoutProvider so fills have the SlotFill context ready when they mount. */ }
<SlotFillProvider> <SlotFillProvider>
@ -202,7 +200,6 @@ const Block = ( {
</SidebarLayout> </SidebarLayout>
</CheckoutProvider> </CheckoutProvider>
</SlotFillProvider> </SlotFillProvider>
</StoreNoticesProvider>
</BlockErrorBoundary> </BlockErrorBoundary>
); );
}; };

View File

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

View File

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

View File

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