From 43613fad611d00ee0e45c6f78f5aac979077f7e6 Mon Sep 17 00:00:00 2001 From: Zak Burke Date: Thu, 14 Nov 2024 06:36:50 -0500 Subject: [PATCH] UIU-3267 correctly import from dompurify (#2798) Import from `dompurify` as shown in example code; `sanitize` was never deliberately provided as a named export. Not sure how this ever worked. Refs UIU-3267 --- CHANGELOG.md | 2 ++ package.json | 2 +- .../components/PrintToPDFWrapper/PrintTemplate.js | 4 ++-- yarn.lock | 8 ++++---- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9adae498c..c117084eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [11.1.0] In progress +* Correctly import from `dompurify`. Refs UIU-3267. + ## [11.0.1](https://github.com/folio-org/ui-users/tree/v11.0.1) (2024-11-08) [Full Changelog](https://github.com/folio-org/ui-users/compare/v11.0.0...v11.0.1) diff --git a/package.json b/package.json index 40aae58db..c90b06a9b 100644 --- a/package.json +++ b/package.json @@ -1178,7 +1178,7 @@ }, "dependencies": { "compressorjs": "^1.2.1", - "dompurify": "^3.1.7", + "dompurify": "^3.2.0", "final-form-set-field-data": "^1.0.2", "get-orientation": "^1.1.2", "hashcode": "^1.0.3", diff --git a/src/components/Loans/OpenLoans/components/PrintToPDFWrapper/PrintTemplate.js b/src/components/Loans/OpenLoans/components/PrintToPDFWrapper/PrintTemplate.js index 17752b76e..e012a50ab 100644 --- a/src/components/Loans/OpenLoans/components/PrintToPDFWrapper/PrintTemplate.js +++ b/src/components/Loans/OpenLoans/components/PrintToPDFWrapper/PrintTemplate.js @@ -2,7 +2,7 @@ import React from 'react'; import Barcode from 'react-barcode'; import PropTypes from 'prop-types'; 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 PrintTemplate = ({ 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/yarn.lock b/yarn.lock index 84e7a4fc8..14b994e65 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5901,10 +5901,10 @@ dompurify@^3.0.9: resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.1.1.tgz#e83de1e0ba7f1014f36686fbc63a2a3a1bdb93f6" integrity sha512-tVP8C/GJwnABOn/7cx/ymx/hXpmBfWIPihC1aOEvS8GbMqy3pgeYtJk1HXN3CO7tu+8bpY18f6isjR5Cymj0TQ== -dompurify@^3.1.7: - version "3.1.7" - resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.1.7.tgz#711a8c96479fb6ced93453732c160c3c72418a6a" - integrity sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ== +dompurify@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-3.2.0.tgz#53c414317c51503183696fcdef6dd3f916c607ed" + integrity sha512-AMdOzK44oFWqHEi0wpOqix/fUNY707OmoeFDnbi3Q5I8uOpy21ufUA5cDJPr0bosxrflOVD/H2DMSvuGKJGfmQ== domutils@^2.5.2, domutils@^2.8.0: version "2.8.0"