2021-03-19 10:05:42 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { Guide } from '@wordpress/components';
|
|
|
|
import { __ } from '@wordpress/i18n';
|
2021-07-07 12:27:50 +00:00
|
|
|
import { createInterpolateElement } from '@wordpress/element';
|
2021-03-19 10:05:42 +00:00
|
|
|
import { isWpVersion } from '@woocommerce/settings';
|
|
|
|
import type { ReactElement } from 'react';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import { useCompatibilityNotice } from './use-compatibility-notice';
|
|
|
|
import WooImage from './woo-image';
|
|
|
|
|
|
|
|
interface CartCheckoutCompatibilityNoticeProps {
|
2021-10-21 09:07:20 +00:00
|
|
|
blockName: 'cart' | 'checkout' | 'mini-cart';
|
2021-03-19 10:05:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function CartCheckoutCompatibilityNotice( {
|
|
|
|
blockName,
|
|
|
|
}: CartCheckoutCompatibilityNoticeProps ): ReactElement | null {
|
|
|
|
const [ isVisible, dismissNotice ] = useCompatibilityNotice( blockName );
|
|
|
|
|
|
|
|
if ( isWpVersion( '5.4', '<=' ) || ! isVisible ) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Guide
|
2021-11-22 01:48:27 +00:00
|
|
|
className="wc-block-welcome-guide"
|
2021-03-19 10:05:42 +00:00
|
|
|
contentLabel={ __(
|
|
|
|
'Compatibility notice',
|
|
|
|
'woo-gutenberg-products-block'
|
|
|
|
) }
|
|
|
|
onFinish={ () => dismissNotice() }
|
|
|
|
finishButtonText={ __( 'Got it!', 'woo-gutenberg-products-block' ) }
|
|
|
|
pages={ [
|
|
|
|
{
|
|
|
|
image: <WooImage />,
|
|
|
|
content: (
|
|
|
|
<>
|
2021-11-22 01:48:27 +00:00
|
|
|
<h1 className="wc-block-welcome-guide__heading">
|
2021-03-19 10:05:42 +00:00
|
|
|
{ __(
|
|
|
|
'Compatibility notice',
|
|
|
|
'woo-gutenberg-products-block'
|
|
|
|
) }
|
|
|
|
</h1>
|
2021-11-22 01:48:27 +00:00
|
|
|
<p className="wc-block-welcome-guide__text">
|
2021-03-19 10:05:42 +00:00
|
|
|
{ createInterpolateElement(
|
|
|
|
__(
|
|
|
|
'This block may not be compatible with <em>all</em> checkout extensions and integrations.',
|
|
|
|
'woo-gutenberg-products-block'
|
|
|
|
),
|
|
|
|
{
|
|
|
|
em: <em />,
|
|
|
|
}
|
|
|
|
) }
|
|
|
|
</p>
|
2021-11-22 01:48:27 +00:00
|
|
|
<p className="wc-block-welcome-guide__text">
|
2021-03-19 10:05:42 +00:00
|
|
|
{ createInterpolateElement(
|
|
|
|
__(
|
|
|
|
'We recommend reviewing our <a>expanding list</a> of compatible extensions prior to using this block on a live store.',
|
|
|
|
'woo-gutenberg-products-block'
|
|
|
|
),
|
|
|
|
{
|
|
|
|
a: (
|
|
|
|
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
|
|
<a
|
|
|
|
href="https://docs.woocommerce.com/document/cart-checkout-blocks-support-status/"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
}
|
|
|
|
) }
|
|
|
|
</p>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
] }
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|