@rh-support/utils 1.0.91-beta.4 → 2.0.1-beta-1
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.
- package/lib/cjs/apiUtils.js +10 -24
- package/lib/cjs/appUtils.js +18 -19
- package/lib/cjs/cacheUtils.js +53 -93
- package/lib/cjs/caseUtils.d.ts +24 -0
- package/lib/cjs/caseUtils.d.ts.map +1 -1
- package/lib/cjs/caseUtils.js +141 -15
- package/lib/cjs/csvUtils.js +38 -87
- package/lib/cjs/customElementUtils.js +1 -1
- package/lib/cjs/dateUtils.js +19 -25
- package/lib/cjs/dropdownUtils.js +23 -15
- package/lib/cjs/eventUtils.js +4 -5
- package/lib/cjs/hostNameUtils.js +7 -7
- package/lib/cjs/hydraConfigUtils.js +14 -37
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/insightRuleInfoUtils.js +7 -7
- package/lib/cjs/lruCacheUtils.js +18 -20
- package/lib/cjs/outlier.js +4 -4
- package/lib/cjs/productsUtils.js +41 -77
- package/lib/cjs/promiseUtils.js +9 -44
- package/lib/cjs/recommendationUtils.js +7 -19
- package/lib/cjs/scrollUtils.js +14 -25
- package/lib/cjs/searchApiUtils.js +12 -20
- package/lib/cjs/sentry.d.ts.map +1 -1
- package/lib/cjs/sentry.js +6 -19
- package/lib/cjs/solrUtils.js +81 -108
- package/lib/cjs/tncUtil.d.ts +16 -0
- package/lib/cjs/tncUtil.d.ts.map +1 -0
- package/lib/cjs/tncUtil.js +39 -0
- package/lib/cjs/translation-helper.js +2 -2
- package/lib/cjs/urlUtils.js +25 -38
- package/lib/cjs/userUtils.js +2 -2
- package/lib/cjs/validatorUtils.d.ts.map +1 -1
- package/lib/cjs/validatorUtils.js +9 -7
- package/lib/esm/caseUtils.d.ts +24 -0
- package/lib/esm/caseUtils.d.ts.map +1 -1
- package/lib/esm/caseUtils.js +123 -0
- package/lib/esm/dropdownUtils.js +15 -5
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/productsUtils.js +3 -3
- package/lib/esm/searchApiUtils.js +1 -1
- package/lib/esm/sentry.d.ts.map +1 -1
- package/lib/esm/tncUtil.d.ts +16 -0
- package/lib/esm/tncUtil.d.ts.map +1 -0
- package/lib/esm/tncUtil.js +31 -0
- package/lib/esm/validatorUtils.d.ts.map +1 -1
- package/lib/esm/validatorUtils.js +2 -0
- package/package.json +14 -11
package/lib/cjs/productsUtils.js
CHANGED
|
@@ -1,72 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
-
if (!m) return o;
|
|
16
|
-
var i = m.call(o), r, ar = [], e;
|
|
17
|
-
try {
|
|
18
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
-
}
|
|
20
|
-
catch (error) { e = { error: error }; }
|
|
21
|
-
finally {
|
|
22
|
-
try {
|
|
23
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
-
}
|
|
25
|
-
finally { if (e) throw e.error; }
|
|
26
|
-
}
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
30
|
-
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
31
|
-
to[j] = from[i];
|
|
32
|
-
return to;
|
|
33
|
-
};
|
|
34
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
4
|
};
|
|
37
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
6
|
exports.getVersion = exports.versionSort = exports.versionSorter = exports.getUniqueSortedVersions = exports.getVersionIfOnlyVersion = exports.isOnlyVersion = exports.getTopProducts = exports.handleEntitledProductResponse = exports.handleProductSearchResponse = void 0;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
productsResultEntitledMap["" + p.name] = p;
|
|
54
|
-
// }
|
|
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;
|
|
55
21
|
});
|
|
56
|
-
|
|
22
|
+
const productsResult = map_1.default(productsResultAll, (product) => {
|
|
57
23
|
var _c, _d;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return
|
|
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))
|
|
61
27
|
? product.featuredVersion
|
|
62
28
|
: (_d = product === null || product === void 0 ? void 0 : product.versions[0]) !== null && _d !== void 0 ? _d : '' });
|
|
63
29
|
});
|
|
64
|
-
//
|
|
65
|
-
|
|
66
|
-
|
|
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']);
|
|
67
33
|
return {
|
|
68
34
|
productsResult: productsResultSorted,
|
|
69
|
-
topProducts
|
|
35
|
+
topProducts,
|
|
70
36
|
otherProducts: difference_1.default(productsResultSorted, topProducts),
|
|
71
37
|
};
|
|
72
38
|
};
|
|
@@ -77,16 +43,15 @@ exports.handleProductSearchResponse = handleProductSearchResponse;
|
|
|
77
43
|
* @param productsResultEntitled IProductV2[]
|
|
78
44
|
* @returns ITroubleshootProductResponse
|
|
79
45
|
*/
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return __assign(__assign({}, product), { product: product.name, isEntitledProduct: true });
|
|
46
|
+
const handleEntitledProductResponse = (productsResultEntitled = []) => {
|
|
47
|
+
const productsResult = productsResultEntitled.map((product) => {
|
|
48
|
+
return Object.assign(Object.assign({}, product), { product: product.name, isEntitledProduct: true });
|
|
84
49
|
});
|
|
85
|
-
|
|
86
|
-
|
|
50
|
+
const topProducts = getTopProducts(productsResult);
|
|
51
|
+
const productsResultSorted = orderBy_1.default(productsResult, ['product'], ['asc']);
|
|
87
52
|
return {
|
|
88
53
|
productsResult: productsResultSorted,
|
|
89
|
-
topProducts
|
|
54
|
+
topProducts,
|
|
90
55
|
otherProducts: difference_1.default(productsResultSorted, topProducts),
|
|
91
56
|
};
|
|
92
57
|
};
|
|
@@ -96,12 +61,11 @@ exports.handleEntitledProductResponse = handleEntitledProductResponse;
|
|
|
96
61
|
* before checking general top products from un-authed SE API
|
|
97
62
|
* @param products Partial<ISEProduct>
|
|
98
63
|
*/
|
|
99
|
-
function getTopProducts(products, topCount) {
|
|
100
|
-
|
|
101
|
-
var toReturn = remove_1.default(__spreadArray([], __read(products)), function (o) { return o.recentlyFiledAgainst; });
|
|
64
|
+
function getTopProducts(products, topCount = 5) {
|
|
65
|
+
const toReturn = remove_1.default([...products], (o) => o.recentlyFiledAgainst);
|
|
102
66
|
if (toReturn.length < topCount) {
|
|
103
|
-
|
|
104
|
-
toReturn.push
|
|
67
|
+
const generalTopProducts = remove_1.default([...products], (o) => !o.recentlyFiledAgainst && o.isTopProduct);
|
|
68
|
+
toReturn.push(...generalTopProducts);
|
|
105
69
|
}
|
|
106
70
|
return toReturn.slice(0, topCount);
|
|
107
71
|
}
|
|
@@ -118,13 +82,13 @@ function getUniqueSortedVersions(versions) {
|
|
|
118
82
|
return exports.versionSort(uniq_1.default(versions));
|
|
119
83
|
}
|
|
120
84
|
exports.getUniqueSortedVersions = getUniqueSortedVersions;
|
|
121
|
-
|
|
85
|
+
const versionSorter = (_a, _b) => {
|
|
122
86
|
//Added because of wrong order of versions
|
|
123
|
-
|
|
124
|
-
|
|
87
|
+
let a = _a.match(/(\d+|\w+)/gm);
|
|
88
|
+
let b = _b.match(/(\d+|\w+)/gm);
|
|
125
89
|
for (var i = 0; i < (a.length > b.length ? a.length : b.length); i++) {
|
|
126
|
-
|
|
127
|
-
|
|
90
|
+
const x = parseInt(a[i]) || a[i];
|
|
91
|
+
const y = parseInt(b[i]) || b[i];
|
|
128
92
|
if (x === undefined || x < y) {
|
|
129
93
|
return 1;
|
|
130
94
|
}
|
|
@@ -141,16 +105,16 @@ var versionSorter = function (_a, _b) {
|
|
|
141
105
|
return 0;
|
|
142
106
|
};
|
|
143
107
|
exports.versionSorter = versionSorter;
|
|
144
|
-
|
|
108
|
+
const versionSort = (arr) => {
|
|
145
109
|
return arr.sort(exports.versionSorter);
|
|
146
110
|
};
|
|
147
111
|
exports.versionSort = versionSort;
|
|
148
112
|
function getVersion(version) {
|
|
149
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)
|
|
150
|
-
|
|
114
|
+
const versionPartsArray = version.split(' ');
|
|
151
115
|
// find the index that has the version and split it into its parts
|
|
152
|
-
|
|
153
|
-
|
|
116
|
+
const indexOfVersion = versionPartsArray.findIndex((p) => p.includes('.'));
|
|
117
|
+
const splitArray = indexOfVersion > -1 ? versionPartsArray[indexOfVersion].split('.') : version.split('.');
|
|
154
118
|
// if the length of the split array is not 2, or 3 it is not a regular version
|
|
155
119
|
// b/c version === major.minor.patch (patch === component in the request body)
|
|
156
120
|
if (splitArray.length !== 2 && splitArray.length !== 3 && splitArray.length !== 4)
|
package/lib/cjs/promiseUtils.js
CHANGED
|
@@ -8,51 +8,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
12
|
exports.promiseReflection = void 0;
|
|
40
13
|
// Promise.allSetteled is not supported in IE11. Here we use a helper function to mock the functionality
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return [2 /*return*/, { v: v, status: 'fulfilled' }];
|
|
51
|
-
case 2:
|
|
52
|
-
e_1 = _a.sent();
|
|
53
|
-
return [2 /*return*/, { e: e_1, status: 'rejected' }];
|
|
54
|
-
case 3: return [2 /*return*/];
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}); };
|
|
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
|
+
});
|
|
58
23
|
exports.promiseReflection = promiseReflection;
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
16
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
6
|
exports.cleanupMarkDown = exports.decodeMarkTag = exports.truncate = exports.replaceHighlightingData = exports.computeRecommendationAbstract = exports.computeRecommendationTitle = exports.getRecommendationAbstract = exports.getRecommendationTitle = void 0;
|
|
18
|
-
|
|
7
|
+
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
19
8
|
function getRecommendationTitle(doc) {
|
|
20
9
|
return !isEmpty_1.default(doc.publishedTitle) ? doc.publishedTitle : doc.allTitle;
|
|
21
10
|
}
|
|
@@ -25,22 +14,21 @@ function getRecommendationAbstract(doc) {
|
|
|
25
14
|
}
|
|
26
15
|
exports.getRecommendationAbstract = getRecommendationAbstract;
|
|
27
16
|
function computeRecommendationTitle(doc) {
|
|
28
|
-
|
|
17
|
+
const title = getRecommendationTitle(doc);
|
|
29
18
|
return { __html: decodeMarkTag(title) };
|
|
30
19
|
}
|
|
31
20
|
exports.computeRecommendationTitle = computeRecommendationTitle;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var abstract = getRecommendationAbstract(doc);
|
|
21
|
+
const computeRecommendationAbstract = (doc, truncateLen = 128) => {
|
|
22
|
+
const abstract = getRecommendationAbstract(doc);
|
|
35
23
|
return { __html: truncate(cleanupMarkDown(decodeMarkTag(abstract)), truncateLen) };
|
|
36
24
|
};
|
|
37
25
|
exports.computeRecommendationAbstract = computeRecommendationAbstract;
|
|
38
26
|
function replaceHighlightingData(docs, highlighting) {
|
|
39
|
-
return docs.map(
|
|
27
|
+
return docs.map((doc) => {
|
|
40
28
|
// highlight id is either uri or view_uri
|
|
41
29
|
// when we are uploading a file before adding issue summary no highlighting doc is present hence passing an empty object
|
|
42
|
-
|
|
43
|
-
return
|
|
30
|
+
const highlightObj = highlighting[doc.resource_uri] || highlighting[doc.uri] || highlighting[doc.view_uri] || {};
|
|
31
|
+
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 || [] });
|
|
44
32
|
});
|
|
45
33
|
}
|
|
46
34
|
exports.replaceHighlightingData = replaceHighlightingData;
|
package/lib/cjs/scrollUtils.js
CHANGED
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
16
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
6
|
exports.isElementInViewport = exports.scrollIntoView = void 0;
|
|
18
|
-
|
|
7
|
+
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
19
8
|
function scrollIntoView(sectionRef, options) {
|
|
20
9
|
var _a, _b, _c;
|
|
21
10
|
if (isEmpty_1.default(sectionRef === null || sectionRef === void 0 ? void 0 : sectionRef.current))
|
|
@@ -32,39 +21,39 @@ function scrollIntoView(sectionRef, options) {
|
|
|
32
21
|
}
|
|
33
22
|
}
|
|
34
23
|
// lets you delay scroll, else will just run in the next cycle of the javascript event loop
|
|
35
|
-
setTimeout(
|
|
24
|
+
setTimeout(() => {
|
|
36
25
|
var _a, _b, _c;
|
|
37
26
|
// if an offset or navBar is specified then element.scrollIntoView wont work and you need to use window.scrollTo
|
|
38
|
-
|
|
39
|
-
|
|
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);
|
|
40
29
|
if (hasNavbar || hasOffset) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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);
|
|
44
33
|
if (hasNavbar) {
|
|
45
|
-
|
|
34
|
+
const navRect = options.navBarRef.current.getBoundingClientRect();
|
|
46
35
|
// elementTopPosition = already_scrolled - (nav height - section top)
|
|
47
36
|
elementTopPosition = window.pageYOffset - (navRect.height - sectionRect.top);
|
|
48
|
-
|
|
37
|
+
top = elementTopPosition - ((_c = options === null || options === void 0 ? void 0 : options.offset) !== null && _c !== void 0 ? _c : 0);
|
|
49
38
|
}
|
|
50
39
|
// window.scrollTo can throw an error when passing in options, so this try/catch catches the error
|
|
51
40
|
// and only uses the window.scrollTo without the options.
|
|
52
41
|
try {
|
|
53
42
|
window.scrollTo({
|
|
54
|
-
top
|
|
43
|
+
top,
|
|
55
44
|
behavior: 'smooth',
|
|
56
45
|
});
|
|
57
46
|
}
|
|
58
47
|
catch (e) {
|
|
59
|
-
window.scrollTo(0,
|
|
48
|
+
window.scrollTo(0, top);
|
|
60
49
|
}
|
|
61
50
|
}
|
|
62
51
|
else {
|
|
63
52
|
try {
|
|
64
|
-
sectionRef.current.scrollIntoView(
|
|
53
|
+
sectionRef.current.scrollIntoView(Object.assign(Object.assign({}, (options || {})), { behavior: 'smooth' }));
|
|
65
54
|
}
|
|
66
55
|
catch (e) {
|
|
67
|
-
sectionRef.current.scrollIntoView(
|
|
56
|
+
sectionRef.current.scrollIntoView(Object.assign(Object.assign({}, (options || {})), { behavior: 'auto' }));
|
|
68
57
|
}
|
|
69
58
|
}
|
|
70
59
|
}, (_c = options === null || options === void 0 ? void 0 : options.timeout) !== null && _c !== void 0 ? _c : 0);
|
|
@@ -75,7 +64,7 @@ function isElementInViewport(el, topStaticNavRef) {
|
|
|
75
64
|
if (isEmpty_1.default(el === null || el === void 0 ? void 0 : el.current)) {
|
|
76
65
|
return false;
|
|
77
66
|
}
|
|
78
|
-
|
|
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;
|
|
79
68
|
var rect = el.current.getBoundingClientRect();
|
|
80
69
|
return (rect.top - topNavHeight >= 0 &&
|
|
81
70
|
rect.left >= 0 &&
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
4
|
};
|
|
13
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
6
|
exports.getSolrParams = exports.addFiltersToFieldQueries = exports.issuesDefaultParamsObj = exports.documentKindToInclude = void 0;
|
|
15
|
-
|
|
7
|
+
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
16
8
|
exports.documentKindToInclude = 'documentKind:("Solution" OR "Video" OR "Article" OR "Errata" OR "Vulnerability" OR "Cve" OR "LabInfo")';
|
|
17
9
|
exports.issuesDefaultParamsObj = {
|
|
18
10
|
q: '*:*',
|
|
@@ -29,27 +21,27 @@ exports.issuesDefaultParamsObj = {
|
|
|
29
21
|
'hl.fragsize': 0,
|
|
30
22
|
};
|
|
31
23
|
function addFiltersToFieldQueries(fqArray, additionalFilters) {
|
|
32
|
-
Object.keys(additionalFilters).forEach(
|
|
24
|
+
Object.keys(additionalFilters).forEach((_key) => {
|
|
33
25
|
var _a;
|
|
34
|
-
|
|
26
|
+
const val = additionalFilters[_key];
|
|
35
27
|
if (Array.isArray(val) && val.length > 0) {
|
|
36
|
-
|
|
28
|
+
const query = `${_key}:(${val.join(' OR ')})`;
|
|
37
29
|
query && fqArray.push(query);
|
|
38
30
|
}
|
|
39
31
|
else if (typeof val === 'object') {
|
|
40
|
-
|
|
41
|
-
|
|
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 : [];
|
|
42
34
|
if (values.length < 1)
|
|
43
35
|
return;
|
|
44
|
-
|
|
45
|
-
query && fqArray.push(
|
|
36
|
+
const query = `${_key}:(${values.join(' OR ')})`;
|
|
37
|
+
query && fqArray.push(`${excludeFlag ? '-' : ''}${query}`);
|
|
46
38
|
}
|
|
47
39
|
});
|
|
48
40
|
}
|
|
49
41
|
exports.addFiltersToFieldQueries = addFiltersToFieldQueries;
|
|
50
42
|
function getSolrParams(rows, highlighted_fragment_size, additionalFilters, QueryFields) {
|
|
51
|
-
|
|
52
|
-
|
|
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 });
|
|
53
45
|
additionalFilters && addFiltersToFieldQueries(issueParamsObj.fq, additionalFilters);
|
|
54
46
|
return issueParamsObj;
|
|
55
47
|
}
|
package/lib/cjs/sentry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.d.ts","sourceRoot":"","sources":["../../src/sentry.ts"],"names":[],"mappings":"
|
|
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
CHANGED
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.sendToSentry = void 0;
|
|
15
4
|
/**
|
|
16
5
|
* Send current user context to Raven (JS error logging library).
|
|
17
6
|
*/
|
|
18
|
-
function sendToSentry(error, additionalTags, message, extra) {
|
|
7
|
+
function sendToSentry(error, additionalTags = {}, message = '', extra) {
|
|
19
8
|
var _a, _b;
|
|
20
|
-
|
|
21
|
-
if (message === void 0) { message = ''; }
|
|
22
|
-
var state = window.sessionjs._state;
|
|
9
|
+
const state = window.sessionjs._state;
|
|
23
10
|
function expiresIn() {
|
|
24
11
|
try {
|
|
25
12
|
return state.keycloak.tokenParsed['exp'] - Math.ceil(new Date().getTime() / 1000) + state.keycloak.timeSkew;
|
|
@@ -28,8 +15,8 @@ function sendToSentry(error, additionalTags, message, extra) {
|
|
|
28
15
|
return null;
|
|
29
16
|
}
|
|
30
17
|
}
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
const token = window.sessionjs.getToken();
|
|
19
|
+
const userInfo = {
|
|
33
20
|
user_id: token.user_id,
|
|
34
21
|
account_id: token.account_id,
|
|
35
22
|
account_number: token.account_number,
|
|
@@ -43,9 +30,9 @@ function sendToSentry(error, additionalTags, message, extra) {
|
|
|
43
30
|
user_info: userInfo,
|
|
44
31
|
});
|
|
45
32
|
// setting additional tags for debug purpose
|
|
46
|
-
|
|
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' });
|
|
47
34
|
window === null || window === void 0 ? void 0 : window.Raven.setTagsContext(tagsContext);
|
|
48
|
-
window === null || window === void 0 ? void 0 : window.Raven.captureException(error, { extra
|
|
35
|
+
window === null || window === void 0 ? void 0 : window.Raven.captureException(error, { extra });
|
|
49
36
|
if (message)
|
|
50
37
|
window === null || window === void 0 ? void 0 : window.Raven.captureMessage(message, { level: 'error' });
|
|
51
38
|
}
|