@rh-support/utils 2.0.4 → 2.0.6
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/productsUtils.d.ts +1 -0
- package/lib/cjs/productsUtils.d.ts.map +1 -1
- package/lib/cjs/productsUtils.js +9 -1
- package/lib/cjs/searchApiUtils.js +5 -2
- package/lib/esm/productsUtils.d.ts +1 -0
- package/lib/esm/productsUtils.d.ts.map +1 -1
- package/lib/esm/productsUtils.js +5 -0
- package/lib/esm/searchApiUtils.js +1 -1
- package/package.json +7 -8
|
@@ -28,5 +28,6 @@ interface IGetVersionReturnValue {
|
|
|
28
28
|
minor?: string;
|
|
29
29
|
}
|
|
30
30
|
export declare function getVersion(version: string): IGetVersionReturnValue;
|
|
31
|
+
export declare function isSpecialSupportOfferingEnabled(allProducts: any, selectedProduct: string): boolean;
|
|
31
32
|
export {};
|
|
32
33
|
//# sourceMappingURL=productsUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"productsUtils.d.ts","sourceRoot":"","sources":["../../src/productsUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAWhF,MAAM,WAAW,4BAA4B;IACzC,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;IACnC,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;IACrC,cAAc,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;CACzC;AAED,eAAO,MAAM,2BAA2B,sBACjB,UAAU,EAAE,2BACP,UAAU,EAAE,aAC1B,MAAM,KACjB,4BA4BF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,4BACd,UAAU,EAAE,KACrC,4BAeF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,EA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AE/C;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAEzD;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAEzD;AAED,eAAO,MAAM,aAAa,OAAQ,MAAM,MAAM,MAAM,eAmBnD,CAAC;AAEF,eAAO,MAAM,WAAW,QAAS,MAAM,EAAE,aAExC,CAAC;AAEF,UAAU,sBAAsB;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,sBAAsB,CAkBlE;AAED,wBAAgB,+BAA+B,CAAC,WAAW,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,WAKxF"}
|
package/lib/cjs/productsUtils.js
CHANGED
|
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.getVersion = exports.versionSort = exports.versionSorter = exports.getUniqueSortedVersions = exports.getVersionIfOnlyVersion = exports.isOnlyVersion = exports.getTopProducts = exports.handleEntitledProductResponse = exports.handleProductSearchResponse = void 0;
|
|
38
|
+
exports.isSpecialSupportOfferingEnabled = exports.getVersion = exports.versionSort = exports.versionSorter = exports.getUniqueSortedVersions = exports.getVersionIfOnlyVersion = exports.isOnlyVersion = exports.getTopProducts = exports.handleEntitledProductResponse = exports.handleProductSearchResponse = void 0;
|
|
39
39
|
var difference_1 = __importDefault(require("lodash/difference"));
|
|
40
40
|
var forEach_1 = __importDefault(require("lodash/forEach"));
|
|
41
41
|
var isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
@@ -166,3 +166,11 @@ function getVersion(version) {
|
|
|
166
166
|
return { major: version.split('.')[0], minor: version.split('.')[1] };
|
|
167
167
|
}
|
|
168
168
|
exports.getVersion = getVersion;
|
|
169
|
+
function isSpecialSupportOfferingEnabled(allProducts, selectedProduct) {
|
|
170
|
+
var _c;
|
|
171
|
+
var productDetails = (((_c = allProducts.data) === null || _c === void 0 ? void 0 : _c.productsResult) || []).find(function (product) {
|
|
172
|
+
return product === selectedProduct && product.hasSpecialSupportOffering ? true : false;
|
|
173
|
+
});
|
|
174
|
+
return productDetails ? true : false;
|
|
175
|
+
}
|
|
176
|
+
exports.isSpecialSupportOfferingEnabled = isSpecialSupportOfferingEnabled;
|
|
@@ -10,9 +10,12 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
13
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
17
|
exports.getSolrParams = exports.addFiltersToFieldQueries = exports.issuesDefaultParamsObj = exports.documentKindToInclude = void 0;
|
|
15
|
-
var
|
|
18
|
+
var cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
16
19
|
exports.documentKindToInclude = 'documentKind:("Solution" OR "Video" OR "Article" OR "Errata" OR "Vulnerability" OR "Cve" OR "LabInfo")';
|
|
17
20
|
exports.issuesDefaultParamsObj = {
|
|
18
21
|
q: '*:*',
|
|
@@ -48,7 +51,7 @@ function addFiltersToFieldQueries(fqArray, additionalFilters) {
|
|
|
48
51
|
}
|
|
49
52
|
exports.addFiltersToFieldQueries = addFiltersToFieldQueries;
|
|
50
53
|
function getSolrParams(rows, highlighted_fragment_size, additionalFilters, QueryFields) {
|
|
51
|
-
var cloneIssueParams =
|
|
54
|
+
var cloneIssueParams = cloneDeep_1.default(exports.issuesDefaultParamsObj);
|
|
52
55
|
var issueParamsObj = __assign(__assign({}, cloneIssueParams), { rows: rows, 'hl.fragsize': highlighted_fragment_size, seQueryFields: QueryFields || false });
|
|
53
56
|
additionalFilters && addFiltersToFieldQueries(issueParamsObj.fq, additionalFilters);
|
|
54
57
|
return issueParamsObj;
|
|
@@ -28,5 +28,6 @@ interface IGetVersionReturnValue {
|
|
|
28
28
|
minor?: string;
|
|
29
29
|
}
|
|
30
30
|
export declare function getVersion(version: string): IGetVersionReturnValue;
|
|
31
|
+
export declare function isSpecialSupportOfferingEnabled(allProducts: any, selectedProduct: string): boolean;
|
|
31
32
|
export {};
|
|
32
33
|
//# sourceMappingURL=productsUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"productsUtils.d.ts","sourceRoot":"","sources":["../../src/productsUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAWhF,MAAM,WAAW,4BAA4B;IACzC,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;IACnC,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;IACrC,cAAc,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;CACzC;AAED,eAAO,MAAM,2BAA2B,sBACjB,UAAU,EAAE,2BACP,UAAU,EAAE,aAC1B,MAAM,KACjB,4BA4BF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,4BACd,UAAU,EAAE,KACrC,4BAeF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,QAAQ,SAAI,GAAG,OAAO,CAAC,UAAU,CAAC,EAAE,CAOnG;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,WAE/C;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAEzD;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAEzD;AAED,eAAO,MAAM,aAAa,OAAQ,MAAM,MAAM,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E,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,sBAAsB,CAkBlE;AAED,wBAAgB,+BAA+B,CAAC,WAAW,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,WAKxF"}
|
package/lib/esm/productsUtils.js
CHANGED
|
@@ -115,3 +115,8 @@ export function getVersion(version) {
|
|
|
115
115
|
else
|
|
116
116
|
return { major: version.split('.')[0], minor: version.split('.')[1] };
|
|
117
117
|
}
|
|
118
|
+
export function isSpecialSupportOfferingEnabled(allProducts, selectedProduct) {
|
|
119
|
+
var _c;
|
|
120
|
+
const productDetails = (((_c = allProducts.data) === null || _c === void 0 ? void 0 : _c.productsResult) || []).find((product) => product === selectedProduct && product.hasSpecialSupportOffering ? true : false);
|
|
121
|
+
return productDetails ? true : false;
|
|
122
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
2
2
|
export const documentKindToInclude = 'documentKind:("Solution" OR "Video" OR "Article" OR "Errata" OR "Vulnerability" OR "Cve" OR "LabInfo")';
|
|
3
3
|
export const issuesDefaultParamsObj = {
|
|
4
4
|
q: '*:*',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/utils",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Vikas Rathee <vrathee@redhat.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -38,21 +38,20 @@
|
|
|
38
38
|
"clean": "../../node_modules/.bin/rimraf lib config/tsconfig.tsbuildinfo",
|
|
39
39
|
"test:watch": "./../../node_modules/.bin/jest --watch",
|
|
40
40
|
"test:unit": "./../../node_modules/.bin/jest -c ./../../configs/tests/jest.config.unit.js",
|
|
41
|
-
"test:coverage": "./../../node_modules/.bin/jest -c ./../../configs/tests/jest.config.coverage.js",
|
|
41
|
+
"test:coverage": "./../../node_modules/.bin/jest --all -c ./../../configs/tests/jest.config.coverage.js",
|
|
42
42
|
"test:changes": "./../../node_modules/.bin/jest --passWithNoTests -c ./../../configs/tests/jest-only-changed-from-upstream.js",
|
|
43
43
|
"test": "npm run test:changes",
|
|
44
44
|
"prepublish": "npm run clean && npm run build:esm",
|
|
45
45
|
"prepublishOnly": "npm run build"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@cee-eng/hydrajs": "4.15.
|
|
48
|
+
"@cee-eng/hydrajs": "4.15.81",
|
|
49
49
|
"@cee-eng/ui-toolkit": "1.1.6",
|
|
50
|
-
"@rh-support/types": "0.2.0",
|
|
51
50
|
"dompurify": "^2.2.6",
|
|
52
51
|
"i18next": "^19.0.1",
|
|
53
52
|
"js-markdown-extra": "^1.2.4",
|
|
54
53
|
"lazysizes": "^5.3.2",
|
|
55
|
-
"localforage": "^1.
|
|
54
|
+
"localforage": "^1.10.0",
|
|
56
55
|
"lodash": "^4.17.21",
|
|
57
56
|
"marked": "^1.2.4",
|
|
58
57
|
"moment-timezone": "^0.5.32",
|
|
@@ -60,7 +59,7 @@
|
|
|
60
59
|
"solr-query-builder": "1.0.1"
|
|
61
60
|
},
|
|
62
61
|
"dependencies": {
|
|
63
|
-
"@cee-eng/hydrajs": "4.15.
|
|
62
|
+
"@cee-eng/hydrajs": "4.15.81",
|
|
64
63
|
"@cee-eng/ui-toolkit": "1.1.6",
|
|
65
64
|
"@rh-support/types": "2.0.1",
|
|
66
65
|
"dompurify": "^2.2.6",
|
|
@@ -68,7 +67,7 @@
|
|
|
68
67
|
"i18next": "^19.0.1",
|
|
69
68
|
"js-markdown-extra": "^1.2.4",
|
|
70
69
|
"lazysizes": "^5.3.2",
|
|
71
|
-
"localforage": "^1.
|
|
70
|
+
"localforage": "^1.10.0",
|
|
72
71
|
"lodash": "^4.17.21",
|
|
73
72
|
"lucene": "^2.1.1",
|
|
74
73
|
"marked": "^1.2.4",
|
|
@@ -85,5 +84,5 @@
|
|
|
85
84
|
"@types/react-dom": "^17.0.9",
|
|
86
85
|
"moment-timezone": "^0.5.40"
|
|
87
86
|
},
|
|
88
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "6c8212246582dd07e0ee3e57a34fe435f766ba7a"
|
|
89
88
|
}
|