From 858b2eeeb630879cefef5ab9e108339504495619 Mon Sep 17 00:00:00 2001 From: Dmitriy-Litvinenko Date: Tue, 12 Nov 2024 18:35:46 +0200 Subject: [PATCH] UIREQ-1180: Fix DOMPurify import --- CHANGELOG.md | 3 +++ package.json | 2 +- src/components/ComponentToPrint/ComponentToPrint.js | 4 ++-- src/routes/RequestsRoute.js | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3aa073ed..4c46649c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change history for ui-requests +## 11.0.0 IN PROGRESS +* 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/package.json b/package.json index cabf346d..fee08e1b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@folio/requests", - "version": "10.0.0", + "version": "11.0.0", "description": "Requests manager", "repository": "folio-org/ui-requests", "publishConfig": { 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 de5f3028..d87083db 100644 --- a/src/routes/RequestsRoute.js +++ b/src/routes/RequestsRoute.js @@ -15,7 +15,7 @@ import { FormattedMessage, injectIntl, } from 'react-intl'; -import { sanitize } from 'dompurify'; +import DOMPurify from 'dompurify'; import { AppIcon, @@ -1226,7 +1226,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 }) => {