diff --git a/packages/checkout/components/store-notices-container/index.tsx b/packages/checkout/components/store-notices-container/index.tsx index 12faf4790cd..6d6378e334e 100644 --- a/packages/checkout/components/store-notices-container/index.tsx +++ b/packages/checkout/components/store-notices-container/index.tsx @@ -1,6 +1,8 @@ /** * External dependencies */ +import PropTypes from 'prop-types'; +import { useDispatch, useSelect } from '@wordpress/data'; import classnames from 'classnames'; import { Notice } from 'wordpress-components'; import { sanitizeHTML } from '@woocommerce/utils'; @@ -13,6 +15,15 @@ import type { Notice as NoticeType } from '@wordpress/notices'; */ import './style.scss'; +const ALLOWED_TAGS = [ 'a', 'b', 'em', 'i', 'strong', 'p', 'br' ]; +const ALLOWED_ATTR = [ 'target', 'href', 'rel', 'name', 'download' ]; + +const sanitizeHTML = ( html ) => { + return { + __html: sanitize( html, { ALLOWED_TAGS, ALLOWED_ATTR } ), + }; +}; + const getWooClassName = ( { status = 'default' } ) => { switch ( status ) { case 'error':