@rh-support/utils 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"appUtils.d.ts","sourceRoot":"","sources":["../../src/appUtils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,cAe7B,CAAC;AAEF,eAAO,MAAM,aAAa,WAEzB,CAAC;AAEF,MAAM,WAAW,cAAc;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAGD,eAAO,MAAM,gBAAgB,YAAa,MAAM,iBAAiB,MAAM,KAAG,cAGxE,CAAC;AAEH,eAAO,MAAM,gBAAgB,YAAa,MAAM,iBAAiB,MAAM,SAItE,CAAC;AAgBF,eAAO,MAAM,uBAAuB,iBAAkB,OAAO,WAE5D,CAAC;AAGF,eAAO,MAAM,iBAAiB,WAAW,OAAO,SAG/C,CAAC"}
1
+ {"version":3,"file":"appUtils.d.ts","sourceRoot":"","sources":["../../src/appUtils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,cAe7B,CAAC;AAEF,eAAO,MAAM,aAAa,WAEzB,CAAC;AAEF,MAAM,WAAW,cAAc;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAGD,eAAO,MAAM,gBAAgB,YAAa,MAAM,iBAAiB,MAAM,KAAG,cAGxE,CAAC;AAEH,eAAO,MAAM,gBAAgB,YAAa,MAAM,iBAAiB,MAAM,SAItE,CAAC;AAgBF,eAAO,MAAM,uBAAuB,iBAAkB,OAAO,WAI5D,CAAC;AAGF,eAAO,MAAM,iBAAiB,WAAW,OAAO,SAG/C,CAAC"}
@@ -56,7 +56,9 @@ const fteHostNames = ['access.devgssfte.devlab.phx1.redhat.com', 'fte.foo.redhat
56
56
  const ciHostNames = ['access.devgssci.devlab.phx1.redhat.com', 'ci.foo.redhat.com', 'fooci.redhat.com'];
57
57
  const stageHostNames = ['access.stage.redhat.com', 'stage.foo.redhat.com', 'foostage.redhat.com'];
58
58
  const getUserAgentForCaseMode = (isCaseCreate) => {
59
- return isCaseCreate ? `Portal Case Management ${exports.getAppVersion()}` : `Solution Engine ${exports.getAppVersion()}`;
59
+ return isCaseCreate
60
+ ? `Portal Case Management - Get Support ${exports.getAppVersion()}`
61
+ : `Portal Case Management - Troubleshoot ${exports.getAppVersion()}`;
60
62
  };
61
63
  exports.getUserAgentForCaseMode = getUserAgentForCaseMode;
62
64
  const securedSupport = { pathPrefix: '', isGs4: false };
@@ -1 +1 @@
1
- {"version":3,"file":"recommendationUtils.d.ts","sourceRoot":"","sources":["../../src/recommendationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAG7F,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAEvE;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAE1E;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,mBAAmB;;EAGlE;AACD,eAAO,MAAM,6BAA6B;;CAGzC,CAAC;AAEF,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,mBAAmB,EAAE,EAC3B,YAAY,EAAE,YAAY,GAC3B,mBAAmB,EAAE,CAevB;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKzD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,UAU1C"}
1
+ {"version":3,"file":"recommendationUtils.d.ts","sourceRoot":"","sources":["../../src/recommendationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAI7F,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAEvE;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAE1E;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,mBAAmB;;EAGlE;AACD,eAAO,MAAM,6BAA6B;;CAIzC,CAAC;AAEF,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,mBAAmB,EAAE,EAC3B,YAAY,EAAE,YAAY,GAC3B,mBAAmB,EAAE,CAevB;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKzD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,UAU1C"}
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.cleanupMarkDown = exports.decodeMarkTag = exports.truncate = exports.replaceHighlightingData = exports.computeRecommendationAbstract = exports.computeRecommendationTitle = exports.getRecommendationAbstract = exports.getRecommendationTitle = void 0;
7
+ const dompurify_1 = __importDefault(require("dompurify"));
7
8
  const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
8
9
  function getRecommendationTitle(doc) {
9
10
  return !isEmpty_1.default(doc.publishedTitle) ? doc.publishedTitle : doc.allTitle;
@@ -15,12 +16,13 @@ function getRecommendationAbstract(doc) {
15
16
  exports.getRecommendationAbstract = getRecommendationAbstract;
16
17
  function computeRecommendationTitle(doc) {
17
18
  const title = getRecommendationTitle(doc);
18
- return { __html: decodeMarkTag(title) };
19
+ return { __html: dompurify_1.default.sanitize(decodeMarkTag(title)) };
19
20
  }
20
21
  exports.computeRecommendationTitle = computeRecommendationTitle;
21
22
  const computeRecommendationAbstract = (doc, truncateLen = 128) => {
22
23
  const abstract = getRecommendationAbstract(doc);
23
- return { __html: truncate(cleanupMarkDown(decodeMarkTag(abstract)), truncateLen) };
24
+ const processedAbstract = truncate(cleanupMarkDown(decodeMarkTag(abstract)), truncateLen);
25
+ return { __html: dompurify_1.default.sanitize(processedAbstract) };
24
26
  };
25
27
  exports.computeRecommendationAbstract = computeRecommendationAbstract;
26
28
  function replaceHighlightingData(docs, highlighting) {
@@ -1 +1 @@
1
- {"version":3,"file":"appUtils.d.ts","sourceRoot":"","sources":["../../src/appUtils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,cAe7B,CAAC;AAEF,eAAO,MAAM,aAAa,WAEzB,CAAC;AAEF,MAAM,WAAW,cAAc;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAGD,eAAO,MAAM,gBAAgB,YAAa,MAAM,iBAAiB,MAAM,KAAG,cAGxE,CAAC;AAEH,eAAO,MAAM,gBAAgB,YAAa,MAAM,iBAAiB,MAAM,SAItE,CAAC;AAgBF,eAAO,MAAM,uBAAuB,iBAAkB,OAAO,WAE5D,CAAC;AAGF,eAAO,MAAM,iBAAiB,WAAW,OAAO,SAG/C,CAAC"}
1
+ {"version":3,"file":"appUtils.d.ts","sourceRoot":"","sources":["../../src/appUtils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,cAe7B,CAAC;AAEF,eAAO,MAAM,aAAa,WAEzB,CAAC;AAEF,MAAM,WAAW,cAAc;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAGD,eAAO,MAAM,gBAAgB,YAAa,MAAM,iBAAiB,MAAM,KAAG,cAGxE,CAAC;AAEH,eAAO,MAAM,gBAAgB,YAAa,MAAM,iBAAiB,MAAM,SAItE,CAAC;AAgBF,eAAO,MAAM,uBAAuB,iBAAkB,OAAO,WAI5D,CAAC;AAGF,eAAO,MAAM,iBAAiB,WAAW,OAAO,SAG/C,CAAC"}
@@ -46,7 +46,9 @@ const fteHostNames = ['access.devgssfte.devlab.phx1.redhat.com', 'fte.foo.redhat
46
46
  const ciHostNames = ['access.devgssci.devlab.phx1.redhat.com', 'ci.foo.redhat.com', 'fooci.redhat.com'];
47
47
  const stageHostNames = ['access.stage.redhat.com', 'stage.foo.redhat.com', 'foostage.redhat.com'];
48
48
  export const getUserAgentForCaseMode = (isCaseCreate) => {
49
- return isCaseCreate ? `Portal Case Management ${getAppVersion()}` : `Solution Engine ${getAppVersion()}`;
49
+ return isCaseCreate
50
+ ? `Portal Case Management - Get Support ${getAppVersion()}`
51
+ : `Portal Case Management - Troubleshoot ${getAppVersion()}`;
50
52
  };
51
53
  const securedSupport = { pathPrefix: '', isGs4: false };
52
54
  export const setSecuredSupport = (isGs4 = false) => {
@@ -1 +1 @@
1
- {"version":3,"file":"recommendationUtils.d.ts","sourceRoot":"","sources":["../../src/recommendationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAG7F,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAEvE;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAE1E;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,mBAAmB;;EAGlE;AACD,eAAO,MAAM,6BAA6B;;CAGzC,CAAC;AAEF,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,mBAAmB,EAAE,EAC3B,YAAY,EAAE,YAAY,GAC3B,mBAAmB,EAAE,CAevB;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKzD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,UAU1C"}
1
+ {"version":3,"file":"recommendationUtils.d.ts","sourceRoot":"","sources":["../../src/recommendationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAI7F,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAEvE;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAE1E;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,mBAAmB;;EAGlE;AACD,eAAO,MAAM,6BAA6B;;CAIzC,CAAC;AAEF,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,mBAAmB,EAAE,EAC3B,YAAY,EAAE,YAAY,GAC3B,mBAAmB,EAAE,CAevB;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKzD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,UAU1C"}
@@ -1,3 +1,4 @@
1
+ import DOMPurify from 'dompurify';
1
2
  import isEmpty from 'lodash/isEmpty';
2
3
  export function getRecommendationTitle(doc) {
3
4
  return !isEmpty(doc.publishedTitle) ? doc.publishedTitle : doc.allTitle;
@@ -7,11 +8,12 @@ export function getRecommendationAbstract(doc) {
7
8
  }
8
9
  export function computeRecommendationTitle(doc) {
9
10
  const title = getRecommendationTitle(doc);
10
- return { __html: decodeMarkTag(title) };
11
+ return { __html: DOMPurify.sanitize(decodeMarkTag(title)) };
11
12
  }
12
13
  export const computeRecommendationAbstract = (doc, truncateLen = 128) => {
13
14
  const abstract = getRecommendationAbstract(doc);
14
- return { __html: truncate(cleanupMarkDown(decodeMarkTag(abstract)), truncateLen) };
15
+ const processedAbstract = truncate(cleanupMarkDown(decodeMarkTag(abstract)), truncateLen);
16
+ return { __html: DOMPurify.sanitize(processedAbstract) };
15
17
  };
16
18
  export function replaceHighlightingData(docs, highlighting) {
17
19
  return docs.map((doc) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/utils",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "> TODO: description",
5
5
  "author": "Vikas Rathee <vrathee@redhat.com>",
6
6
  "license": "ISC",
@@ -88,5 +88,5 @@
88
88
  "defaults and supports es6-module",
89
89
  "maintained node versions"
90
90
  ],
91
- "gitHead": "d0220cf8078eb0da56f34f1cf0598edad0704669"
91
+ "gitHead": "8f7f0aee0461c78e8a5cc0e16777371c4ae1305d"
92
92
  }