@rh-support/utils 2.0.5 → 2.0.7

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.
@@ -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,MAAM,eAmBnD,CAAC;AAEF,eAAO,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AM,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"}
@@ -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"));
@@ -49,9 +49,9 @@ var handleProductSearchResponse = function (productsResultAll, productsResultEnt
49
49
  if (topCount === void 0) { topCount = 5; }
50
50
  var productsResultEntitledMap = {};
51
51
  forEach_1.default(productsResultEntitled, function (p) {
52
- // if (p.supportedForCustomer) { // Needs confirmation froom CCM team before adding
52
+ // If (p.supportedForCustomer)
53
+ // Needs confirmation froom CCM team before adding
53
54
  productsResultEntitledMap["" + p.name] = p;
54
- // }
55
55
  });
56
56
  var productsResult = map_1.default(productsResultAll, function (product) {
57
57
  var _c, _d;
@@ -61,7 +61,7 @@ var handleProductSearchResponse = function (productsResultAll, productsResultEnt
61
61
  ? product.featuredVersion
62
62
  : (_d = product === null || product === void 0 ? void 0 : product.versions[0]) !== null && _d !== void 0 ? _d : '' });
63
63
  });
64
- // we get products based on the highest number of support cases
64
+ // We get products based on the highest number of support cases
65
65
  var topProducts = getTopProducts(productsResult, topCount);
66
66
  var productsResultSorted = orderBy_1.default(productsResult, ['product'], ['asc']);
67
67
  return {
@@ -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;
@@ -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,C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AAE,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,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"}
@@ -9,9 +9,9 @@ import { isNumber } from './validatorUtils';
9
9
  export const handleProductSearchResponse = (productsResultAll, productsResultEntitled = [], topCount = 5) => {
10
10
  const productsResultEntitledMap = {};
11
11
  forEach(productsResultEntitled, (p) => {
12
- // if (p.supportedForCustomer) { // Needs confirmation froom CCM team before adding
12
+ // If (p.supportedForCustomer)
13
+ // Needs confirmation froom CCM team before adding
13
14
  productsResultEntitledMap[`${p.name}`] = p;
14
- // }
15
15
  });
16
16
  const productsResult = map(productsResultAll, (product) => {
17
17
  var _c, _d;
@@ -21,7 +21,7 @@ export const handleProductSearchResponse = (productsResultAll, productsResultEnt
21
21
  ? product.featuredVersion
22
22
  : (_d = product === null || product === void 0 ? void 0 : product.versions[0]) !== null && _d !== void 0 ? _d : '' });
23
23
  });
24
- // we get products based on the highest number of support cases
24
+ // We get products based on the highest number of support cases
25
25
  const topProducts = getTopProducts(productsResult, topCount);
26
26
  const productsResultSorted = orderBy(productsResult, ['product'], ['asc']);
27
27
  return {
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/utils",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "> TODO: description",
5
5
  "author": "Vikas Rathee <vrathee@redhat.com>",
6
6
  "license": "ISC",
@@ -45,7 +45,7 @@
45
45
  "prepublishOnly": "npm run build"
46
46
  },
47
47
  "peerDependencies": {
48
- "@cee-eng/hydrajs": "4.15.78",
48
+ "@cee-eng/hydrajs": "4.15.81",
49
49
  "@cee-eng/ui-toolkit": "1.1.6",
50
50
  "dompurify": "^2.2.6",
51
51
  "i18next": "^19.0.1",
@@ -59,9 +59,9 @@
59
59
  "solr-query-builder": "1.0.1"
60
60
  },
61
61
  "dependencies": {
62
- "@cee-eng/hydrajs": "4.15.78",
62
+ "@cee-eng/hydrajs": "4.15.81",
63
63
  "@cee-eng/ui-toolkit": "1.1.6",
64
- "@rh-support/types": "2.0.1",
64
+ "@rh-support/types": "2.0.2",
65
65
  "dompurify": "^2.2.6",
66
66
  "dot": "^1.1.3",
67
67
  "i18next": "^19.0.1",
@@ -84,5 +84,5 @@
84
84
  "@types/react-dom": "^17.0.9",
85
85
  "moment-timezone": "^0.5.40"
86
86
  },
87
- "gitHead": "f4106bdae110f32d4968b2a9544fc4bbf76ce11e"
87
+ "gitHead": "c05aa6c2542ab83bfc1984ec113a116f0885d123"
88
88
  }