@rh-support/utils 2.4.10-beta.6 → 2.5.0

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.
Files changed (134) hide show
  1. package/README.md +0 -2
  2. package/lib/esm/apiUtils.d.ts +2 -2
  3. package/lib/esm/apiUtils.d.ts.map +1 -1
  4. package/lib/esm/apiUtils.js +18 -6
  5. package/lib/esm/csvUtils.d.ts +2 -2
  6. package/lib/esm/csvUtils.d.ts.map +1 -1
  7. package/lib/esm/csvUtils.js +9 -16
  8. package/lib/esm/dateUtils.d.ts +11 -9
  9. package/lib/esm/dateUtils.d.ts.map +1 -1
  10. package/lib/esm/dateUtils.js +96 -11
  11. package/lib/esm/dropdownUtils.d.ts +1 -1
  12. package/lib/esm/dropdownUtils.d.ts.map +1 -1
  13. package/lib/esm/eventUtils.d.ts +14 -2
  14. package/lib/esm/eventUtils.d.ts.map +1 -1
  15. package/lib/esm/eventUtils.js +101 -5
  16. package/lib/esm/hostNameUtils.d.ts.map +1 -1
  17. package/lib/esm/hydraConfigUtils.d.ts +1 -1
  18. package/lib/esm/hydraConfigUtils.d.ts.map +1 -1
  19. package/lib/esm/index.d.ts +0 -2
  20. package/lib/esm/index.d.ts.map +1 -1
  21. package/lib/esm/index.js +0 -2
  22. package/lib/esm/outlier.d.ts.map +1 -1
  23. package/lib/esm/promiseUtils.d.ts.map +1 -1
  24. package/lib/esm/recommendationUtils.js +2 -2
  25. package/lib/esm/searchApiUtils.d.ts +2 -2
  26. package/lib/esm/searchApiUtils.d.ts.map +1 -1
  27. package/lib/esm/searchApiUtils.js +3 -3
  28. package/lib/esm/solrUtils.d.ts +4 -4
  29. package/lib/esm/solrUtils.d.ts.map +1 -1
  30. package/lib/esm/solrUtils.js +1 -2
  31. package/lib/esm/translation-helper.d.ts +5 -1
  32. package/lib/esm/translation-helper.d.ts.map +1 -1
  33. package/lib/esm/translation-helper.js +1 -1
  34. package/lib/esm/urlUtils.d.ts +3 -1
  35. package/lib/esm/urlUtils.d.ts.map +1 -1
  36. package/lib/esm/urlUtils.js +14 -5
  37. package/lib/esm/validatorUtils.js +1 -1
  38. package/package.json +17 -31
  39. package/lib/cjs/apiUtils.d.ts +0 -17
  40. package/lib/cjs/apiUtils.d.ts.map +0 -1
  41. package/lib/cjs/apiUtils.js +0 -52
  42. package/lib/cjs/appUtils.d.ts +0 -11
  43. package/lib/cjs/appUtils.d.ts.map +0 -1
  44. package/lib/cjs/appUtils.js +0 -67
  45. package/lib/cjs/browserDetectionUtils.d.ts +0 -3
  46. package/lib/cjs/browserDetectionUtils.d.ts.map +0 -1
  47. package/lib/cjs/browserDetectionUtils.js +0 -9
  48. package/lib/cjs/cacheUtils.d.ts +0 -27
  49. package/lib/cjs/cacheUtils.d.ts.map +0 -1
  50. package/lib/cjs/cacheUtils.js +0 -137
  51. package/lib/cjs/caseUtils.d.ts +0 -40
  52. package/lib/cjs/caseUtils.d.ts.map +0 -1
  53. package/lib/cjs/caseUtils.js +0 -225
  54. package/lib/cjs/constants/preferredLanguages.d.ts +0 -33
  55. package/lib/cjs/constants/preferredLanguages.d.ts.map +0 -1
  56. package/lib/cjs/constants/preferredLanguages.js +0 -35
  57. package/lib/cjs/csvUtils.d.ts +0 -24
  58. package/lib/cjs/csvUtils.d.ts.map +0 -1
  59. package/lib/cjs/csvUtils.js +0 -109
  60. package/lib/cjs/customElementUtils.d.ts +0 -20
  61. package/lib/cjs/customElementUtils.d.ts.map +0 -1
  62. package/lib/cjs/customElementUtils.js +0 -23
  63. package/lib/cjs/dateUtils.d.ts +0 -16
  64. package/lib/cjs/dateUtils.d.ts.map +0 -1
  65. package/lib/cjs/dateUtils.js +0 -78
  66. package/lib/cjs/dropdownUtils.d.ts +0 -18
  67. package/lib/cjs/dropdownUtils.d.ts.map +0 -1
  68. package/lib/cjs/dropdownUtils.js +0 -59
  69. package/lib/cjs/eventUtils.d.ts +0 -9
  70. package/lib/cjs/eventUtils.d.ts.map +0 -1
  71. package/lib/cjs/eventUtils.js +0 -32
  72. package/lib/cjs/hostNameUtils.d.ts +0 -7
  73. package/lib/cjs/hostNameUtils.d.ts.map +0 -1
  74. package/lib/cjs/hostNameUtils.js +0 -35
  75. package/lib/cjs/hydraConfigUtils.d.ts +0 -14
  76. package/lib/cjs/hydraConfigUtils.d.ts.map +0 -1
  77. package/lib/cjs/hydraConfigUtils.js +0 -83
  78. package/lib/cjs/index.d.ts +0 -30
  79. package/lib/cjs/index.d.ts.map +0 -1
  80. package/lib/cjs/index.js +0 -41
  81. package/lib/cjs/insightRuleInfoUtils.d.ts +0 -4
  82. package/lib/cjs/insightRuleInfoUtils.d.ts.map +0 -1
  83. package/lib/cjs/insightRuleInfoUtils.js +0 -31
  84. package/lib/cjs/lruCacheUtils.d.ts +0 -13
  85. package/lib/cjs/lruCacheUtils.d.ts.map +0 -1
  86. package/lib/cjs/lruCacheUtils.js +0 -45
  87. package/lib/cjs/outlier.d.ts +0 -16
  88. package/lib/cjs/outlier.d.ts.map +0 -1
  89. package/lib/cjs/outlier.js +0 -48
  90. package/lib/cjs/productsUtils.d.ts +0 -33
  91. package/lib/cjs/productsUtils.d.ts.map +0 -1
  92. package/lib/cjs/productsUtils.js +0 -138
  93. package/lib/cjs/promiseUtils.d.ts +0 -8
  94. package/lib/cjs/promiseUtils.d.ts.map +0 -1
  95. package/lib/cjs/promiseUtils.js +0 -23
  96. package/lib/cjs/recommendationUtils.d.ts +0 -14
  97. package/lib/cjs/recommendationUtils.d.ts.map +0 -1
  98. package/lib/cjs/recommendationUtils.js +0 -61
  99. package/lib/cjs/scrollUtils.d.ts +0 -11
  100. package/lib/cjs/scrollUtils.d.ts.map +0 -1
  101. package/lib/cjs/scrollUtils.js +0 -74
  102. package/lib/cjs/searchApiUtils.d.ts +0 -44
  103. package/lib/cjs/searchApiUtils.d.ts.map +0 -1
  104. package/lib/cjs/searchApiUtils.js +0 -48
  105. package/lib/cjs/sentry.d.ts +0 -14
  106. package/lib/cjs/sentry.d.ts.map +0 -1
  107. package/lib/cjs/sentry.js +0 -40
  108. package/lib/cjs/solrUtils.d.ts +0 -74
  109. package/lib/cjs/solrUtils.d.ts.map +0 -1
  110. package/lib/cjs/solrUtils.js +0 -322
  111. package/lib/cjs/styleUtils.d.ts +0 -12
  112. package/lib/cjs/styleUtils.d.ts.map +0 -1
  113. package/lib/cjs/styleUtils.js +0 -34
  114. package/lib/cjs/tncUtil.d.ts +0 -16
  115. package/lib/cjs/tncUtil.d.ts.map +0 -1
  116. package/lib/cjs/tncUtil.js +0 -39
  117. package/lib/cjs/translation-helper.d.ts +0 -10
  118. package/lib/cjs/translation-helper.d.ts.map +0 -1
  119. package/lib/cjs/translation-helper.js +0 -23
  120. package/lib/cjs/urlUtils.d.ts +0 -19
  121. package/lib/cjs/urlUtils.d.ts.map +0 -1
  122. package/lib/cjs/urlUtils.js +0 -76
  123. package/lib/cjs/userUtils.d.ts +0 -3
  124. package/lib/cjs/userUtils.d.ts.map +0 -1
  125. package/lib/cjs/userUtils.js +0 -11
  126. package/lib/cjs/validatorUtils.d.ts +0 -11
  127. package/lib/cjs/validatorUtils.d.ts.map +0 -1
  128. package/lib/cjs/validatorUtils.js +0 -76
  129. package/lib/esm/customElementUtils.d.ts +0 -20
  130. package/lib/esm/customElementUtils.d.ts.map +0 -1
  131. package/lib/esm/customElementUtils.js +0 -19
  132. package/lib/esm/insightRuleInfoUtils.d.ts +0 -4
  133. package/lib/esm/insightRuleInfoUtils.d.ts.map +0 -1
  134. package/lib/esm/insightRuleInfoUtils.js +0 -23
@@ -1,138 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isSpecialSupportOfferingEnabled = exports.getVersion = exports.versionSort = exports.versionSorter = exports.getUniqueSortedVersions = exports.getVersionIfOnlyVersion = exports.isOnlyVersion = exports.getTopProducts = exports.handleEntitledProductResponse = exports.handleProductSearchResponse = void 0;
7
- const difference_1 = __importDefault(require("lodash/difference"));
8
- const forEach_1 = __importDefault(require("lodash/forEach"));
9
- const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
10
- const map_1 = __importDefault(require("lodash/map"));
11
- const orderBy_1 = __importDefault(require("lodash/orderBy"));
12
- const remove_1 = __importDefault(require("lodash/remove"));
13
- const uniq_1 = __importDefault(require("lodash/uniq"));
14
- const validatorUtils_1 = require("./validatorUtils");
15
- const handleProductSearchResponse = (productsResultAll, productsResultEntitled = [], topCount = 5) => {
16
- const productsResultEntitledMap = {};
17
- forEach_1.default(productsResultEntitled, (p) => {
18
- // If (p.supportedForCustomer)
19
- // Needs confirmation froom CCM team before adding
20
- productsResultEntitledMap[`${p.name}`] = p;
21
- });
22
- const productsResult = map_1.default(productsResultAll, (product) => {
23
- var _c, _d;
24
- const entitledProduct = productsResultEntitledMap[product.product];
25
- const uniqueVersions = getUniqueSortedVersions(product.versions);
26
- return Object.assign(Object.assign(Object.assign({}, product), entitledProduct), { versions: uniqueVersions, isEntitledProduct: !isEmpty_1.default(entitledProduct), featuredVersion: ((_c = product.versions) === null || _c === void 0 ? void 0 : _c.includes(product.featuredVersion))
27
- ? product.featuredVersion
28
- : (_d = product === null || product === void 0 ? void 0 : product.versions[0]) !== null && _d !== void 0 ? _d : '' });
29
- });
30
- // We get products based on the highest number of support cases
31
- const topProducts = getTopProducts(productsResult, topCount);
32
- const productsResultSorted = orderBy_1.default(productsResult, ['product'], ['asc']);
33
- return {
34
- productsResult: productsResultSorted,
35
- topProducts,
36
- otherProducts: difference_1.default(productsResultSorted, topProducts),
37
- };
38
- };
39
- exports.handleProductSearchResponse = handleProductSearchResponse;
40
- /**
41
- * This method is used for parsing `hydra/rest/products/contact/{userName}` response form API
42
- * and need to create partial response like method `handleProductSearchResponse`
43
- * @param productsResultEntitled IProductV2[]
44
- * @returns ITroubleshootProductResponse
45
- */
46
- const handleEntitledProductResponse = (productsResultEntitled = []) => {
47
- const productsResult = productsResultEntitled.map((product) => {
48
- return Object.assign(Object.assign({}, product), { product: product.name, isEntitledProduct: true });
49
- });
50
- const topProducts = getTopProducts(productsResult);
51
- const productsResultSorted = orderBy_1.default(productsResult, ['product'], ['asc']);
52
- return {
53
- productsResult: productsResultSorted,
54
- topProducts,
55
- otherProducts: difference_1.default(productsResultSorted, topProducts),
56
- };
57
- };
58
- exports.handleEntitledProductResponse = handleEntitledProductResponse;
59
- /**
60
- * Tries to get top products with priority given to recentlyFiledAgainst
61
- * before checking general top products from un-authed SE API
62
- * @param products Partial<ISEProduct>
63
- */
64
- function getTopProducts(products, topCount = 5) {
65
- const toReturn = remove_1.default([...products], (o) => o.recentlyFiledAgainst);
66
- if (toReturn.length < topCount) {
67
- const generalTopProducts = remove_1.default([...products], (o) => !o.recentlyFiledAgainst && o.isTopProduct);
68
- toReturn.push(...generalTopProducts);
69
- }
70
- return toReturn.slice(0, topCount);
71
- }
72
- exports.getTopProducts = getTopProducts;
73
- function isOnlyVersion(versions) {
74
- return (versions === null || versions === void 0 ? void 0 : versions.length) && versions.length === 1;
75
- }
76
- exports.isOnlyVersion = isOnlyVersion;
77
- function getVersionIfOnlyVersion(versions) {
78
- return isOnlyVersion(versions) ? versions[0] : undefined;
79
- }
80
- exports.getVersionIfOnlyVersion = getVersionIfOnlyVersion;
81
- function getUniqueSortedVersions(versions) {
82
- return exports.versionSort(uniq_1.default(versions));
83
- }
84
- exports.getUniqueSortedVersions = getUniqueSortedVersions;
85
- const versionSorter = (_a, _b) => {
86
- //Added because of wrong order of versions
87
- let a = _a.match(/(\d+|\w+)/gm);
88
- let b = _b.match(/(\d+|\w+)/gm);
89
- for (var i = 0; i < (a.length > b.length ? a.length : b.length); i++) {
90
- const x = parseInt(a[i]) || a[i];
91
- const y = parseInt(b[i]) || b[i];
92
- if (x === undefined || x < y) {
93
- return 1;
94
- }
95
- else if (y === undefined || y < x) {
96
- return -1;
97
- }
98
- }
99
- if (_a.length > _b.length) {
100
- return 1;
101
- }
102
- else if (_b.length > _a.length) {
103
- return -1;
104
- }
105
- return 0;
106
- };
107
- exports.versionSorter = versionSorter;
108
- const versionSort = (arr) => {
109
- return arr.sort(exports.versionSorter);
110
- };
111
- exports.versionSort = versionSort;
112
- function getVersion(version) {
113
- // splits the version into its parts because some versions can have words in front of them (e.g. Red Hat Build of Thorntail - Thorntail 1.x)
114
- const versionPartsArray = version.split(' ');
115
- // find the index that has the version and split it into its parts
116
- const indexOfVersion = versionPartsArray.findIndex((p) => p.includes('.'));
117
- const splitArray = indexOfVersion > -1 ? versionPartsArray[indexOfVersion].split('.') : version.split('.');
118
- // if the length of the split array is not 2, or 3 it is not a regular version
119
- // b/c version === major.minor.patch (patch === component in the request body)
120
- if (splitArray.length !== 2 && splitArray.length !== 3 && splitArray.length !== 4)
121
- return { major: version };
122
- // if either of the split array is not a number then it is not a regular version.
123
- // there is no need to check if the second or third is a number because it is possible for the version to have a letter the version "number"
124
- // e.g. 1.x or 1.2.x
125
- if (!validatorUtils_1.isNumber(splitArray[0]))
126
- return { major: version };
127
- else if (!validatorUtils_1.isNumber(splitArray[1]))
128
- return { major: version.split('.')[0] };
129
- else
130
- return { major: version.split('.')[0], minor: version.split('.')[1] };
131
- }
132
- exports.getVersion = getVersion;
133
- function isSpecialSupportOfferingEnabled(allProducts, selectedProduct) {
134
- var _c;
135
- const productHasSpecialSupportOffering = (_c = allProducts.find((product) => product.name === selectedProduct)) === null || _c === void 0 ? void 0 : _c.hasSpecialSupportOffering;
136
- return productHasSpecialSupportOffering;
137
- }
138
- exports.isSpecialSupportOfferingEnabled = isSpecialSupportOfferingEnabled;
@@ -1,8 +0,0 @@
1
- interface IPromiseReflection<T> {
2
- v?: T;
3
- status: 'fulfilled' | 'rejected';
4
- e?: Error;
5
- }
6
- declare const promiseReflection: <T>(p: Promise<T>) => Promise<IPromiseReflection<T>>;
7
- export { promiseReflection, IPromiseReflection };
8
- //# sourceMappingURL=promiseUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promiseUtils.d.ts","sourceRoot":"","sources":["../../src/promiseUtils.ts"],"names":[],"mappings":"AAAA,UAAU,kBAAkB,CAAC,CAAC;IAC1B,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,MAAM,EAAE,WAAW,GAAG,UAAU,CAAC;IACjC,CAAC,CAAC,EAAE,KAAK,CAAC;CACb;AAGD,QAAA,MAAM,iBAAiB,sDAOtB,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.promiseReflection = void 0;
13
- // Promise.allSetteled is not supported in IE11. Here we use a helper function to mock the functionality
14
- const promiseReflection = (p) => __awaiter(void 0, void 0, void 0, function* () {
15
- try {
16
- const v = yield p;
17
- return { v, status: 'fulfilled' };
18
- }
19
- catch (e) {
20
- return { e, status: 'rejected' };
21
- }
22
- });
23
- exports.promiseReflection = promiseReflection;
@@ -1,14 +0,0 @@
1
- import { Highlighting, ISolrRecommendation } from '@cee-eng/hydrajs/@types/models/solr/solr';
2
- export declare function getRecommendationTitle(doc: ISolrRecommendation): string;
3
- export declare function getRecommendationAbstract(doc: ISolrRecommendation): string;
4
- export declare function computeRecommendationTitle(doc: ISolrRecommendation): {
5
- __html: string;
6
- };
7
- export declare const computeRecommendationAbstract: (doc: any, truncateLen?: number) => {
8
- __html: string;
9
- };
10
- export declare function replaceHighlightingData(docs: ISolrRecommendation[], highlighting: Highlighting): ISolrRecommendation[];
11
- export declare function truncate(str: string, len: number): string;
12
- export declare function decodeMarkTag(str: string): string;
13
- export declare function cleanupMarkDown(str: string): string;
14
- //# sourceMappingURL=recommendationUtils.d.ts.map
@@ -1 +0,0 @@
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,CAgBvB;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,61 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
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"));
8
- const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
9
- function getRecommendationTitle(doc) {
10
- return !isEmpty_1.default(doc.publishedTitle) ? doc.publishedTitle : doc.allTitle;
11
- }
12
- exports.getRecommendationTitle = getRecommendationTitle;
13
- function getRecommendationAbstract(doc) {
14
- return !isEmpty_1.default(doc.publishedAbstract) ? doc.publishedAbstract : doc.abstract;
15
- }
16
- exports.getRecommendationAbstract = getRecommendationAbstract;
17
- function computeRecommendationTitle(doc) {
18
- const title = getRecommendationTitle(doc);
19
- return { __html: dompurify_1.default.sanitize(decodeMarkTag(title)) };
20
- }
21
- exports.computeRecommendationTitle = computeRecommendationTitle;
22
- const computeRecommendationAbstract = (doc, truncateLen = 128) => {
23
- const abstract = getRecommendationAbstract(doc);
24
- const processedAbstract = truncate(cleanupMarkDown(decodeMarkTag(abstract)), truncateLen);
25
- return { __html: dompurify_1.default.sanitize(processedAbstract) };
26
- };
27
- exports.computeRecommendationAbstract = computeRecommendationAbstract;
28
- function replaceHighlightingData(docs, highlighting) {
29
- return docs.map((doc) => {
30
- // highlight id is either uri or view_uri
31
- // when we are uploading a file before adding issue summary no highlighting doc is present hence passing an empty object
32
- const highlightObj = highlighting
33
- ? highlighting[doc.resource_uri] || highlighting[doc.uri] || highlighting[doc.view_uri] || {}
34
- : {};
35
- return Object.assign(Object.assign({}, doc), { abstract: (highlightObj.abstract && highlightObj.abstract[0]) || doc.abstract || '', publishedAbstract: (highlightObj.publishedAbstract && highlightObj.publishedAbstract[0]) || doc.publishedAbstract || '', issue: highlightObj.issue || doc.issue || [] });
36
- });
37
- }
38
- exports.replaceHighlightingData = replaceHighlightingData;
39
- function truncate(str, len) {
40
- if (str.length > len) {
41
- return str.substring(0, len).replace(/<[^>]*$/, '') + '&hellip;';
42
- }
43
- return str;
44
- }
45
- exports.truncate = truncate;
46
- function decodeMarkTag(str) {
47
- return str.replace(/%3Cmark%3E/gm, '<mark>').replace(/%3C%2Fmark%3E/gm, '</mark>');
48
- }
49
- exports.decodeMarkTag = decodeMarkTag;
50
- function cleanupMarkDown(str) {
51
- return str
52
- .replace('### Overview', '')
53
- .replace(/~~~ /gm, '')
54
- .replace(/~~/gm, '')
55
- .replace(/###/gm, '')
56
- .replace(/##/gm, '')
57
- .replace(/#/gm, '')
58
- .replace(/\\\*\\\*\\\*/gm, '***')
59
- .replace(/\\\*\\\*/gm, '**');
60
- }
61
- exports.cleanupMarkDown = cleanupMarkDown;
@@ -1,11 +0,0 @@
1
- import React, { MutableRefObject } from 'react';
2
- interface IScrollIntoViewOptions extends ScrollIntoViewOptions {
3
- navBarRef?: MutableRefObject<HTMLElement>;
4
- offset?: number;
5
- timeout?: number;
6
- onlyIfNotInViewport?: boolean;
7
- }
8
- export declare function scrollIntoView(sectionRef: React.MutableRefObject<HTMLElement>, options?: IScrollIntoViewOptions): void;
9
- export declare function isElementInViewport(el: MutableRefObject<HTMLElement>, topStaticNavRef?: MutableRefObject<HTMLElement>): boolean;
10
- export {};
11
- //# sourceMappingURL=scrollUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scrollUtils.d.ts","sourceRoot":"","sources":["../../src/scrollUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEhD,UAAU,sBAAuB,SAAQ,qBAAqB;IAC1D,SAAS,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,EAAE,sBAAsB,QA4C/G;AAED,wBAAgB,mBAAmB,CAC/B,EAAE,EAAE,gBAAgB,CAAC,WAAW,CAAC,EACjC,eAAe,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,WAalD"}
@@ -1,74 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isElementInViewport = exports.scrollIntoView = void 0;
7
- const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
8
- function scrollIntoView(sectionRef, options) {
9
- var _a, _b, _c;
10
- if (isEmpty_1.default(sectionRef === null || sectionRef === void 0 ? void 0 : sectionRef.current))
11
- return;
12
- if (!!(options === null || options === void 0 ? void 0 : options.onlyIfNotInViewport) && isElementInViewport(sectionRef, options === null || options === void 0 ? void 0 : options.navBarRef))
13
- return;
14
- // If we have a nav that has been scrolled down then just scrolling it to top will bring content in view
15
- if (((_b = (_a = options === null || options === void 0 ? void 0 : options.navBarRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect().top) > 0) {
16
- try {
17
- options.navBarRef.current.scrollIntoView({ behavior: 'smooth' });
18
- }
19
- catch (e) {
20
- options.navBarRef.current.scrollIntoView();
21
- }
22
- }
23
- // lets you delay scroll, else will just run in the next cycle of the javascript event loop
24
- setTimeout(() => {
25
- var _a, _b, _c;
26
- // if an offset or navBar is specified then element.scrollIntoView wont work and you need to use window.scrollTo
27
- const hasNavbar = !!((_a = options === null || options === void 0 ? void 0 : options.navBarRef) === null || _a === void 0 ? void 0 : _a.current);
28
- const hasOffset = !!(options === null || options === void 0 ? void 0 : options.offset);
29
- if (hasNavbar || hasOffset) {
30
- const sectionRect = sectionRef.current.getBoundingClientRect();
31
- let elementTopPosition = sectionRect.top;
32
- let top = elementTopPosition - ((_b = options === null || options === void 0 ? void 0 : options.offset) !== null && _b !== void 0 ? _b : 0);
33
- if (hasNavbar) {
34
- const navRect = options.navBarRef.current.getBoundingClientRect();
35
- // elementTopPosition = already_scrolled - (nav height - section top)
36
- elementTopPosition = window.pageYOffset - (navRect.height - sectionRect.top);
37
- top = elementTopPosition - ((_c = options === null || options === void 0 ? void 0 : options.offset) !== null && _c !== void 0 ? _c : 0);
38
- }
39
- // window.scrollTo can throw an error when passing in options, so this try/catch catches the error
40
- // and only uses the window.scrollTo without the options.
41
- try {
42
- window.scrollTo({
43
- top,
44
- behavior: 'smooth',
45
- });
46
- }
47
- catch (e) {
48
- window.scrollTo(0, top);
49
- }
50
- }
51
- else {
52
- try {
53
- sectionRef.current.scrollIntoView(Object.assign(Object.assign({}, (options || {})), { behavior: 'smooth' }));
54
- }
55
- catch (e) {
56
- sectionRef.current.scrollIntoView(Object.assign(Object.assign({}, (options || {})), { behavior: 'auto' }));
57
- }
58
- }
59
- }, (_c = options === null || options === void 0 ? void 0 : options.timeout) !== null && _c !== void 0 ? _c : 0);
60
- }
61
- exports.scrollIntoView = scrollIntoView;
62
- function isElementInViewport(el, topStaticNavRef) {
63
- var _a, _b;
64
- if (isEmpty_1.default(el === null || el === void 0 ? void 0 : el.current)) {
65
- return false;
66
- }
67
- const topNavHeight = (_b = (_a = topStaticNavRef === null || topStaticNavRef === void 0 ? void 0 : topStaticNavRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0;
68
- var rect = el.current.getBoundingClientRect();
69
- return (rect.top - topNavHeight >= 0 &&
70
- rect.left >= 0 &&
71
- rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) /* or $(window).height() */ &&
72
- rect.right <= (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */);
73
- }
74
- exports.isElementInViewport = isElementInViewport;
@@ -1,44 +0,0 @@
1
- import { ISearchSolrQuery } from '@cee-eng/hydrajs/@types/api/search';
2
- import { ISolrRecommendation } from '@cee-eng/hydrajs/@types/models/solr/solr';
3
- export declare const documentKindToInclude = "documentKind:(\"Solution\" OR \"Video\" OR \"Article\" OR \"Errata\" OR \"Vulnerability\" OR \"Cve\" OR \"LabInfo\")";
4
- export declare const issuesDefaultParamsObj: ISearchSolrQuery;
5
- export declare type IRecommendationAdditionalFilters = {
6
- [key in keyof ISolrRecommendation]?: string[] | {
7
- values: string[];
8
- exclude: true;
9
- };
10
- };
11
- export declare function addFiltersToFieldQueries(fqArray: string[], additionalFilters: any): void;
12
- export declare function getSolrParams(rows: number, highlighted_fragment_size: number, additionalFilters?: IRecommendationAdditionalFilters, QueryFields?: boolean): {
13
- rows: number;
14
- 'hl.fragsize': number;
15
- seQueryFields: boolean;
16
- expressionParams?: {
17
- case_number: string;
18
- case_product: string;
19
- case_version: string;
20
- };
21
- fq?: string | string[];
22
- sort?: string;
23
- fl?: string;
24
- showRetired?: boolean;
25
- mltDocSearch?: boolean;
26
- newSearch?: boolean;
27
- hl?: boolean;
28
- 'hl.fl'?: string;
29
- 'hl.simple.pre'?: string;
30
- 'hl.simple.post'?: string;
31
- 'hl.snippets'?: number;
32
- wt?: string;
33
- 'facet.pivot'?: string;
34
- 'facet.pivot.mincount'?: string;
35
- facet?: boolean;
36
- 'face.sort'?: string;
37
- 'facet.field'?: string[];
38
- 'facet.mincount'?: string;
39
- rerank?: boolean;
40
- q?: string;
41
- start?: number;
42
- clientName?: string;
43
- };
44
- //# sourceMappingURL=searchApiUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"searchApiUtils.d.ts","sourceRoot":"","sources":["../../src/searchApiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAG/E,eAAO,MAAM,qBAAqB,yHAC0E,CAAC;AAE7G,eAAO,MAAM,sBAAsB,EAAE,gBAapC,CAAC;AAMF,oBAAY,gCAAgC,GAAG;KAC1C,GAAG,IAAI,MAAM,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,IAAI,CAAA;KAAE;CACtF,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,iBAAiB,KAAA,QAc5E;AAED,wBAAgB,aAAa,CACzB,IAAI,EAAE,MAAM,EACZ,yBAAyB,EAAE,MAAM,EACjC,iBAAiB,CAAC,EAAE,gCAAgC,EACpD,WAAW,CAAC,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWxB"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getSolrParams = exports.addFiltersToFieldQueries = exports.issuesDefaultParamsObj = exports.documentKindToInclude = void 0;
7
- const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
8
- exports.documentKindToInclude = 'documentKind:("Solution" OR "Video" OR "Article" OR "Errata" OR "Vulnerability" OR "Cve" OR "LabInfo")';
9
- exports.issuesDefaultParamsObj = {
10
- q: '*:*',
11
- fq: [exports.documentKindToInclude, '-internalTags:helper_solution', '-documentKind:Documentation'],
12
- start: 0,
13
- rows: 10,
14
- fl: 'id, allTitle, publishedTitle, view_uri, resource_uri, uri, issue, lastModifiedDate, kcsState, kcsRateUp, kcsRateDown, documentKind, publishedAbstract, abstract, authorSSOName, tag',
15
- seQueryFields: false,
16
- hl: true,
17
- 'hl.fl': 'abstract, publishedAbstract, issue',
18
- 'hl.simple.pre': '%3Cmark%3E',
19
- 'hl.simple.post': '%3C%2Fmark%3E',
20
- 'hl.snippets': 1,
21
- 'hl.fragsize': 0,
22
- };
23
- function addFiltersToFieldQueries(fqArray, additionalFilters) {
24
- Object.keys(additionalFilters).forEach((_key) => {
25
- var _a;
26
- const val = additionalFilters[_key];
27
- if (Array.isArray(val) && val.length > 0) {
28
- const query = `${_key}:(${val.join(' OR ')})`;
29
- query && fqArray.push(query);
30
- }
31
- else if (typeof val === 'object') {
32
- const excludeFlag = val === null || val === void 0 ? void 0 : val.exclude;
33
- const values = (_a = val === null || val === void 0 ? void 0 : val.values) !== null && _a !== void 0 ? _a : [];
34
- if (values.length < 1)
35
- return;
36
- const query = `${_key}:(${values.join(' OR ')})`;
37
- query && fqArray.push(`${excludeFlag ? '-' : ''}${query}`);
38
- }
39
- });
40
- }
41
- exports.addFiltersToFieldQueries = addFiltersToFieldQueries;
42
- function getSolrParams(rows, highlighted_fragment_size, additionalFilters, QueryFields) {
43
- const cloneIssueParams = cloneDeep_1.default(exports.issuesDefaultParamsObj);
44
- const issueParamsObj = Object.assign(Object.assign({}, cloneIssueParams), { rows, 'hl.fragsize': highlighted_fragment_size, seQueryFields: QueryFields || false });
45
- additionalFilters && addFiltersToFieldQueries(issueParamsObj.fq, additionalFilters);
46
- return issueParamsObj;
47
- }
48
- exports.getSolrParams = getSolrParams;
@@ -1,14 +0,0 @@
1
- declare global {
2
- interface Window {
3
- sessionjs: any;
4
- Raven: any;
5
- app: string;
6
- }
7
- }
8
- /**
9
- * Send current user context to Raven (JS error logging library).
10
- */
11
- export declare function sendToSentry(error: Error, additionalTags?: {}, message?: string, extra?: {
12
- error: Error | any;
13
- }): void;
14
- //# sourceMappingURL=sentry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sentry.d.ts","sourceRoot":"","sources":["../../src/sentry.ts"],"names":[],"mappings":"AAOA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,SAAS,EAAE,GAAG,CAAC;QACf,KAAK,EAAE,GAAG,CAAC;QACX,GAAG,EAAE,MAAM,CAAC;KACf;CACJ;AAED;;GAEG;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,KAAK,EAAE,OAAO,GAAE,MAAW,EAAE,KAAK,CAAC,EAAE;IAAE,KAAK,EAAE,KAAK,GAAG,GAAG,CAAA;CAAE,QAwCnH"}
package/lib/cjs/sentry.js DELETED
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendToSentry = void 0;
4
- /**
5
- * Send current user context to Raven (JS error logging library).
6
- */
7
- function sendToSentry(error, additionalTags = {}, message = '', extra) {
8
- var _a, _b;
9
- const state = window.sessionjs._state;
10
- function expiresIn() {
11
- try {
12
- return state.keycloak.tokenParsed['exp'] - Math.ceil(new Date().getTime() / 1000) + state.keycloak.timeSkew;
13
- }
14
- catch (e) {
15
- return null;
16
- }
17
- }
18
- const token = window.sessionjs.getToken();
19
- const userInfo = {
20
- user_id: token.user_id,
21
- account_id: token.account_id,
22
- account_number: token.account_number,
23
- internal: token.internal,
24
- lang: token.lang,
25
- };
26
- if (typeof (window === null || window === void 0 ? void 0 : window.Raven) !== 'undefined' && typeof ((_a = window === null || window === void 0 ? void 0 : window.Raven) === null || _a === void 0 ? void 0 : _a.captureException) === 'function') {
27
- // setting user context
28
- window === null || window === void 0 ? void 0 : window.Raven.setUserContext({
29
- id: userInfo.user_id,
30
- user_info: userInfo,
31
- });
32
- // setting additional tags for debug purpose
33
- let tagsContext = Object.assign(Object.assign({ is_authenticated: window.sessionjs.isAuthenticated(), is_token_expired: state.keycloak.authenticated ? state.keycloak.isTokenExpired(0) : null, token_expires_in: expiresIn() }, additionalTags), { app_name: (_b = window.app) !== null && _b !== void 0 ? _b : 'Portal Case Management' });
34
- window === null || window === void 0 ? void 0 : window.Raven.setTagsContext(tagsContext);
35
- window === null || window === void 0 ? void 0 : window.Raven.captureException(error, { extra });
36
- if (message)
37
- window === null || window === void 0 ? void 0 : window.Raven.captureMessage(message, { level: 'error' });
38
- }
39
- }
40
- exports.sendToSentry = sendToSentry;
@@ -1,74 +0,0 @@
1
- import { IFacetResponse } from '@rh-support/types/shared';
2
- export interface ISolrQP {
3
- start?: number;
4
- rows?: number;
5
- sort?: string | boolean;
6
- q?: string;
7
- 'facet.mincount'?: number;
8
- 'facet.pivot.mincount'?: number;
9
- 'facet.limit'?: number;
10
- 'facet.sort'?: string;
11
- 'facet.query'?: string[];
12
- fl?: string;
13
- defType?: string;
14
- facet?: boolean;
15
- 'facet.field'?: string[];
16
- 'facet.pivot'?: string;
17
- fq?: string[];
18
- 'f.case_product.facet.limit'?: number;
19
- 'f.case_version.facet.pivot.limit'?: number;
20
- 'f.case_version.facet.pivot.mincount'?: number;
21
- }
22
- export declare function solr(init?: ISolrQP): {
23
- fq: (k: string, v: string | string[], tag?: string, options?: {
24
- processValue: {
25
- join: string;
26
- };
27
- }) => any;
28
- preBuiltfq: (k: string, v: string | string[], tag?: string) => any;
29
- facetField: (facet: string, excludeTags?: string[]) => any;
30
- pivotField: (pivot: string, excludeTags?: string[]) => any;
31
- value: () => ISolrQP;
32
- beginOr: () => any;
33
- endOr: () => any;
34
- };
35
- export declare type ISolrResponseToFacetFields<T> = {
36
- [key in keyof T]?: IFacetResponse[];
37
- };
38
- /**
39
- *
40
- * @param solrResponse
41
- * Accepts solrResponse and then return the facet values in an object map
42
- * with key being the facet key and value being of type IFacetResponse
43
- */
44
- export declare function solrResponseToFacetFields<T, U>(solrResponse: T): ISolrResponseToFacetFields<U>;
45
- export declare type ISolrResponseToPivotFields<T, U> = {
46
- [key in keyof T]?: U[];
47
- };
48
- /**
49
- *
50
- * @param solrResponse
51
- * Accepts solrResponse and then return the pivot values in an object map
52
- * with key being the pivot key(ex: 'case_product,case_version') and
53
- * value being of type IFacetResponse and also next pivot as the key and its value again of type IFacetResponse.
54
- */
55
- export declare function solrResponseToPivotFields<T, U, V>(solrResponse: T): ISolrResponseToPivotFields<U, V>;
56
- /**
57
- *
58
- * @param fieldValueMap
59
- * Accepts the output type of solrResponseToPivotFields and then return the
60
- * string query by ORing the values of same type(for ex. all the version will be ORed) and ANDing the
61
- * children values with parent values. Uses solr-query-builder library internally
62
- */
63
- export declare function buildSolrQuery(fieldValueMap: any, wrapWithParentheses?: boolean): any;
64
- /**
65
- *
66
- * @param query
67
- * Takes a solr string query with AND OR operations
68
- * and return the object with key as the field name
69
- * and value will be the array of field values
70
- * Pivots having logical OR operations will be returned as
71
- * the nested object
72
- */
73
- export declare function parseSolrQuery(query: string): {};
74
- //# sourceMappingURL=solrUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"solrUtils.d.ts","sourceRoot":"","sources":["../../src/solrUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAM1D,MAAM,WAAW,OAAO;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACd,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,kCAAkC,CAAC,EAAE,MAAM,CAAC;IAC5C,qCAAqC,CAAC,EAAE,MAAM,CAAC;CAClD;AAsBD,wBAAgB,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO;YAOnB,MAAM,KAAK,MAAM,GAAG,MAAM,EAAE,QAAQ,MAAM;;;;;oBAmBlC,MAAM,KAAK,MAAM,GAAG,MAAM,EAAE,QAAQ,MAAM;wBAWtC,MAAM,gBAAgB,MAAM,EAAE;wBAS9B,MAAM,gBAAgB,MAAM,EAAE;iBAOvC,OAAO;;;EAoBzB;AAED,oBAAY,0BAA0B,CAAC,CAAC,IAAI;KACvC,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE;CACtC,CAAC;AAEF;;;;;GAKG;AAEH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,0BAA0B,CAAC,CAAC,CAAC,CAiB9F;AAED,oBAAY,0BAA0B,CAAC,CAAC,EAAE,CAAC,IAAI;KAC1C,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;CACzB,CAAC;AAEF;;;;;;GAMG;AAEH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,CAWpG;AAmBD;;;;;;GAMG;AAEH,wBAAgB,cAAc,CAAC,aAAa,KAAA,EAAE,mBAAmB,UAAQ,OA4BxE;AA+BD;;;;;;;;GAQG;AAEH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,MAU3C"}