diff --git a/CHANGELOG.md b/CHANGELOG.md index 70a6d60c..a76df8f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * Add `mod-settings.global.read.circulation` permission. Refs UIREQ-1170. * Add `mod-settings.entries.collection.get` permission. Refs UIREQ-1177. * *BREAKING* Migrate to new `mod-circulation-bff` endpoints. Refs UIREQ-1134. +* Fix DOMPurify import. Refs UIREQ-1180. ## [10.0.0] (https://github.com/folio-org/ui-requests/tree/v10.0.0) (2024-10-31) [Full Changelog](https://github.com/folio-org/ui-requests/compare/v9.1.2...v10.0.0) diff --git a/src/components/ComponentToPrint/ComponentToPrint.js b/src/components/ComponentToPrint/ComponentToPrint.js index 20526d07..0169ada7 100644 --- a/src/components/ComponentToPrint/ComponentToPrint.js +++ b/src/components/ComponentToPrint/ComponentToPrint.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import Barcode from 'react-barcode'; import HtmlToReact, { Parser } from 'html-to-react'; -import { sanitize } from 'dompurify'; +import DOMPurify from 'dompurify'; const processNodeDefinitions = new HtmlToReact.ProcessNodeDefinitions(React); const rules = [ @@ -20,7 +20,7 @@ const rules = [ const parser = new Parser(); const ComponentToPrint = ({ dataSource, templateFn }) => { - const componentStr = sanitize(templateFn(dataSource), { ADD_TAGS: ['Barcode'] }); + const componentStr = DOMPurify.sanitize(templateFn(dataSource), { ADD_TAGS: ['Barcode'] }); const Component = parser.parseWithInstructions(componentStr, () => true, rules) || null; return Component; diff --git a/src/routes/RequestsRoute.js b/src/routes/RequestsRoute.js index 178b3015..59e42060 100644 --- a/src/routes/RequestsRoute.js +++ b/src/routes/RequestsRoute.js @@ -16,7 +16,7 @@ import { FormattedMessage, injectIntl, } from 'react-intl'; -import { sanitize } from 'dompurify'; +import DOMPurify from 'dompurify'; import { AppIcon, @@ -1288,7 +1288,7 @@ class RequestsRoute extends React.Component { const slipTypeInLowerCase = slipType.toLowerCase(); const slipTemplate = staffSlips.find(slip => slip.name.toLowerCase() === slipTypeInLowerCase); - return sanitize(get(slipTemplate, 'template', ''), { ADD_TAGS: ['Barcode'] }); + return DOMPurify.sanitize(get(slipTemplate, 'template', ''), { ADD_TAGS: ['Barcode'] }); } handleFilterChange = ({ name, values }) => {