@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,322 +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.parseSolrQuery = exports.buildSolrQuery = exports.solrResponseToPivotFields = exports.solrResponseToFacetFields = exports.solr = void 0;
7
- const get_1 = __importDefault(require("lodash/get"));
8
- const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
9
- const lucene_1 = __importDefault(require("lucene"));
10
- const solr_query_builder_1 = __importDefault(require("solr-query-builder"));
11
- function If(cond, v) {
12
- return !isEmpty_1.default(cond) ? v || cond : '';
13
- }
14
- function processFQValue(val, { join }) {
15
- // val can be one of
16
- // ['certificatoin', 'ecosystem'] (array)
17
- // OR 'certification|ecosystem' (stringifiedArray seprated with pipe)
18
- // OR 'certification' (string)
19
- // OR '*' (star is a special case)
20
- const _val = Array.isArray(val) ? val : val.split('|').length === 1 ? val : val.split('|');
21
- if (Array.isArray(_val)) {
22
- return `(${_val.map((v) => `"${v}"`).join(` ${join} `)})`;
23
- }
24
- else if (val === '*') {
25
- return val;
26
- }
27
- else {
28
- return `"${_val}"`;
29
- }
30
- }
31
- function solr(init) {
32
- let query = init || {};
33
- let beginOr = false;
34
- let partialOrQuery = [];
35
- let partialTag = [];
36
- const solr = {
37
- fq: (k, v, tag, options = { processValue: { join: 'OR' } }) => {
38
- if (isEmpty_1.default(v))
39
- return solr;
40
- const _fq = query.fq || [];
41
- const _tag = If(tag, `{!tag=${tag}}`);
42
- const _v = processFQValue(v, options.processValue);
43
- const pair = `${k}:${_v}`;
44
- const newfq = [..._fq, `${_tag}${pair}`];
45
- if (!beginOr) {
46
- query = Object.assign({}, query, { fq: newfq });
47
- }
48
- else {
49
- if (tag) {
50
- partialTag = [...partialTag, tag];
51
- }
52
- partialOrQuery = [...partialOrQuery, `${pair}`];
53
- }
54
- return solr;
55
- },
56
- preBuiltfq: (k, v, tag) => {
57
- if (isEmpty_1.default(v))
58
- return solr;
59
- const _fq = query.fq || [];
60
- const _tag = If(tag, `{!tag=${tag}}`);
61
- const newfq = [..._fq, `${_tag}${v}`];
62
- query = Object.assign({}, query, { fq: newfq });
63
- return solr;
64
- },
65
- facetField: (facet, excludeTags) => {
66
- const _facetField = query['facet.field'] || [];
67
- const _excludeTags = If(excludeTags, `{!ex=${excludeTags && excludeTags.join(',')}}`);
68
- const newFacetField = [..._facetField, `${_excludeTags}${facet}`];
69
- query = Object.assign({}, query, { 'facet.field': newFacetField });
70
- return solr;
71
- },
72
- pivotField: (pivot, excludeTags) => {
73
- const _facetPivot = query['facet.pivot'] || [];
74
- const _excludeTags = If(excludeTags, `{!ex=${excludeTags && excludeTags.join(',')}}`);
75
- const newPivotField = [..._facetPivot, `${_excludeTags}${pivot}`];
76
- query = Object.assign({}, query, { 'facet.pivot': newPivotField });
77
- return solr;
78
- },
79
- value: () => {
80
- return query;
81
- },
82
- beginOr: () => {
83
- beginOr = true;
84
- partialOrQuery = [];
85
- partialTag = [];
86
- return solr;
87
- },
88
- endOr: () => {
89
- beginOr = false;
90
- const _fq = query.fq || [];
91
- const _tag = partialTag.length > 0 ? `{!tag=${partialTag}}` : '';
92
- const orQuery = partialOrQuery.join(' OR ');
93
- const newFq = [..._fq, `${_tag}${orQuery}`];
94
- query = Object.assign({}, query, { fq: newFq });
95
- return solr;
96
- },
97
- };
98
- return solr;
99
- }
100
- exports.solr = solr;
101
- /**
102
- *
103
- * @param solrResponse
104
- * Accepts solrResponse and then return the facet values in an object map
105
- * with key being the facet key and value being of type IFacetResponse
106
- */
107
- function solrResponseToFacetFields(solrResponse) {
108
- const solrFacets = get_1.default(solrResponse, 'facet_counts.facet_fields', {});
109
- const facets = {};
110
- Object.keys(solrFacets).forEach((_facetKey) => {
111
- const facetKey = _facetKey;
112
- facets[facetKey] = [];
113
- for (let i = 0; i < solrFacets[facetKey].length; i += 2) {
114
- // take every second element
115
- // replace non-breakable spaces with space
116
- const item = solrFacets[facetKey][i].replace(/\s/g, ' ');
117
- if (item) {
118
- facets[facetKey].push({ value: item, count: solrFacets[facetKey][i + 1] });
119
- }
120
- }
121
- });
122
- return facets;
123
- }
124
- exports.solrResponseToFacetFields = solrResponseToFacetFields;
125
- /**
126
- *
127
- * @param solrResponse
128
- * Accepts solrResponse and then return the pivot values in an object map
129
- * with key being the pivot key(ex: 'case_product,case_version') and
130
- * value being of type IFacetResponse and also next pivot as the key and its value again of type IFacetResponse.
131
- */
132
- function solrResponseToPivotFields(solrResponse) {
133
- const solrPivots = get_1.default(solrResponse, 'facet_counts.facet_pivot', {});
134
- const pivots = {};
135
- Object.keys(solrPivots).forEach((_pivotKey) => {
136
- const pivotKey = _pivotKey;
137
- pivots[pivotKey] = [];
138
- for (let i = 0; i < solrPivots[pivotKey].length; i++) {
139
- pivots[pivotKey].push(createPivotObject(solrPivots[pivotKey][i]));
140
- }
141
- });
142
- return pivots;
143
- }
144
- exports.solrResponseToPivotFields = solrResponseToPivotFields;
145
- function createPivotObject(data) {
146
- const valueObj = {
147
- field: data.field,
148
- value: data.value,
149
- count: data.count,
150
- };
151
- if (data.pivot && data.pivot.length > 0) {
152
- const pivotValuesMap = data.pivot.map((item) => ({
153
- value: item.value,
154
- count: item.count,
155
- }));
156
- const pivotKey = data.pivot[0].field;
157
- valueObj[pivotKey] = pivotValuesMap;
158
- }
159
- return valueObj;
160
- }
161
- /**
162
- *
163
- * @param fieldValueMap
164
- * Accepts the output type of solrResponseToPivotFields and then return the
165
- * string query by ORing the values of same type(for ex. all the version will be ORed) and ANDing the
166
- * children values with parent values. Uses solr-query-builder library internally
167
- */
168
- function buildSolrQuery(fieldValueMap, wrapWithParentheses = false) {
169
- let solrQuery = new solr_query_builder_1.default();
170
- wrapWithParentheses && solrQuery.begin();
171
- Object.keys(fieldValueMap).forEach((key) => {
172
- const fields = key.split(',');
173
- const noOfPasses = fields.length;
174
- const currentItem = fieldValueMap[key] || [];
175
- currentItem.forEach((item, index, array) => {
176
- solrQuery = solrQuery.begin().where(item['field']).equals(item['value']);
177
- let currentPass = 0;
178
- currentPass++;
179
- const itemForQuery = item[fields[currentPass]];
180
- if (currentPass === noOfPasses - 1) {
181
- solrQuery = joinValuesWithOr(solrQuery, itemForQuery);
182
- }
183
- while (currentPass < noOfPasses - 1) {
184
- currentPass++;
185
- makeQueryRecursively(solrQuery, itemForQuery, currentPass, noOfPasses, fields);
186
- }
187
- solrQuery = solrQuery.end();
188
- if (index !== array.length - 1) {
189
- solrQuery = solrQuery.or();
190
- }
191
- });
192
- });
193
- wrapWithParentheses && solrQuery.end();
194
- return solrQuery.build();
195
- }
196
- exports.buildSolrQuery = buildSolrQuery;
197
- function joinValuesWithOr(currentQuery, values) {
198
- if (values.length < 1) {
199
- return currentQuery;
200
- }
201
- let _currentQuery = currentQuery.begin();
202
- values.forEach((item, index, array) => {
203
- _currentQuery = _currentQuery.where(item['field']).equals(item['value']);
204
- if (index !== array.length - 1) {
205
- _currentQuery = _currentQuery.or();
206
- }
207
- });
208
- return _currentQuery.end();
209
- }
210
- function makeQueryRecursively(currentQuery, values, currentPass, noOfPasses, fields) {
211
- values.forEach((i, index, array) => {
212
- currentQuery = currentQuery.begin();
213
- currentQuery = currentQuery.where(i['field']).equals(i['value']);
214
- if (currentPass === noOfPasses - 1) {
215
- currentQuery = joinValuesWithOr(currentQuery, i[fields[currentPass]]);
216
- }
217
- if (index !== array.length - 1) {
218
- currentQuery = currentQuery.or();
219
- }
220
- else {
221
- currentQuery = currentQuery.end();
222
- }
223
- });
224
- }
225
- /**
226
- *
227
- * @param query
228
- * Takes a solr string query with AND OR operations
229
- * and return the object with key as the field name
230
- * and value will be the array of field values
231
- * Pivots having logical OR operations will be returned as
232
- * the nested object
233
- */
234
- function parseSolrQuery(query) {
235
- if (!query)
236
- return {};
237
- const parsedQuery = lucene_1.default.parse(query);
238
- if (isEmpty_1.default(parsedQuery)) {
239
- return {};
240
- }
241
- const filterObject = {};
242
- traverseTree(parsedQuery, filterObject);
243
- return filterObject;
244
- }
245
- exports.parseSolrQuery = parseSolrQuery;
246
- function traverseTree(ast, filterObject) {
247
- if (/and/i.test(ast.operator)) {
248
- // if operation is AND between left and right node and right node has a
249
- // parenthesis then it means we are dealing with a pivot here.
250
- // we make it more fool proof by checking if right node is not a field
251
- if (ast.right && ast.right.parenthesized && !ast.right.field && ast.left.field !== 'keyword') {
252
- calculateSolrPivotField(ast, filterObject);
253
- }
254
- else {
255
- ast.left && traverseTree(ast.left, filterObject);
256
- ast.right && traverseTree(ast.right, filterObject);
257
- }
258
- }
259
- else if (ast.operator === '<implicit>' || ast.field) {
260
- // if operator is implicit then it means all the child are the values of
261
- // that node/field we are traversing right now
262
- calculateSolrField(ast, filterObject);
263
- }
264
- else if (/or/i.test(ast.operator)) {
265
- // OR operator will always have a right and left node. Below is just a safe check
266
- // in reality we don't need it
267
- ast.left && traverseTree(ast.left, filterObject);
268
- ast.right && traverseTree(ast.right, filterObject);
269
- }
270
- else if (!ast.operator) {
271
- // if there is no operator we only have left field
272
- // let's traverse that field unless we find an operator
273
- // this will get rid of all the nodes that are just parenthesis
274
- traverseTree(ast.left, filterObject);
275
- }
276
- }
277
- function calculateSolrField(node, filterObject) {
278
- const fieldName = node.field;
279
- const fieldValues = [];
280
- getValues(node, fieldValues);
281
- if (filterObject[fieldName]) {
282
- filterObject[fieldName].push(...fieldValues);
283
- }
284
- else {
285
- filterObject[fieldName] = fieldValues;
286
- }
287
- }
288
- // currently only supports 1 level of Pivot nesting
289
- // HINT: To make it support more level create new getPivotValues
290
- // function instead of using getValues
291
- function calculateSolrPivotField(node, filterObject) {
292
- var _a, _b;
293
- const pivot0Field = (_a = node === null || node === void 0 ? void 0 : node.left) === null || _a === void 0 ? void 0 : _a.field;
294
- const pivot0Value = (_b = node === null || node === void 0 ? void 0 : node.left) === null || _b === void 0 ? void 0 : _b.term;
295
- const vals = [];
296
- getValues(node.right, vals);
297
- const a = {
298
- field: pivot0Field,
299
- value: pivot0Value,
300
- [node.right.left.field]: vals,
301
- };
302
- if (filterObject[pivot0Field]) {
303
- filterObject[pivot0Field].push(a);
304
- }
305
- else {
306
- filterObject[pivot0Field] = [a];
307
- }
308
- }
309
- // this is a recursive function which will traverse all the nodes
310
- // of the tree until we have all the values
311
- function getValues(field, vals) {
312
- if (field === null || field === undefined) {
313
- return;
314
- }
315
- field.term && vals.push(field.term);
316
- if (field.left) {
317
- getValues(field.left, vals);
318
- }
319
- if (field.right) {
320
- getValues(field.right, vals);
321
- }
322
- }
@@ -1,12 +0,0 @@
1
- export declare enum StyleVariants {
2
- INFO = 0,
3
- SUCCESS = 1,
4
- WARNING = 2,
5
- DEFAULT = 3,
6
- DANGER = 4
7
- }
8
- export declare function getBGColorStyle(styleVariant: StyleVariants): {
9
- backgroundColor: string;
10
- };
11
- export declare function getStyleVariantColor(styleVariant: StyleVariants): "#72767B" | "#004368" | "#F0AB00" | "#3E8635" | "#CE2615";
12
- //# sourceMappingURL=styleUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styleUtils.d.ts","sourceRoot":"","sources":["../../src/styleUtils.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACrB,IAAI,IAAA;IACJ,OAAO,IAAA;IACP,OAAO,IAAA;IACP,OAAO,IAAA;IACP,MAAM,IAAA;CACT;AACD,wBAAgB,eAAe,CAAC,YAAY,EAAE,aAAa;;EAI1D;AACD,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,aAAa,6DAe/D"}
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getStyleVariantColor = exports.getBGColorStyle = exports.StyleVariants = void 0;
4
- var StyleVariants;
5
- (function (StyleVariants) {
6
- StyleVariants[StyleVariants["INFO"] = 0] = "INFO";
7
- StyleVariants[StyleVariants["SUCCESS"] = 1] = "SUCCESS";
8
- StyleVariants[StyleVariants["WARNING"] = 2] = "WARNING";
9
- StyleVariants[StyleVariants["DEFAULT"] = 3] = "DEFAULT";
10
- StyleVariants[StyleVariants["DANGER"] = 4] = "DANGER";
11
- })(StyleVariants = exports.StyleVariants || (exports.StyleVariants = {}));
12
- function getBGColorStyle(styleVariant) {
13
- return {
14
- backgroundColor: getStyleVariantColor(styleVariant),
15
- };
16
- }
17
- exports.getBGColorStyle = getBGColorStyle;
18
- function getStyleVariantColor(styleVariant) {
19
- switch (styleVariant) {
20
- case StyleVariants.DEFAULT:
21
- return '#72767B';
22
- case StyleVariants.INFO:
23
- return '#004368';
24
- case StyleVariants.WARNING:
25
- return '#F0AB00';
26
- case StyleVariants.SUCCESS:
27
- return '#3E8635';
28
- case StyleVariants.DANGER:
29
- return '#CE2615';
30
- default:
31
- return '#72767B';
32
- }
33
- }
34
- exports.getStyleVariantColor = getStyleVariantColor;
@@ -1,16 +0,0 @@
1
- export declare const TncConstants: {
2
- HOSTS: {
3
- DEV: string;
4
- QA: string;
5
- Stage: string;
6
- PROD: string;
7
- };
8
- PARTNER_SHARE_SITE_CODE: string;
9
- PARTNER_SHARE_EVENT_CODE: string;
10
- REMOTER_RIDER_EVENT_CODE: string;
11
- REMOTE_RIDER_SITE_CODE: string;
12
- PARTNER_SHARE_LINK_ACCOUNT_SITE_CODE: string;
13
- };
14
- export declare function getTnCHost(): string;
15
- export declare function baseTnCUrl(): string;
16
- //# sourceMappingURL=tncUtil.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tncUtil.d.ts","sourceRoot":"","sources":["../../src/tncUtil.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;;;;;;;;;;;CAYxB,CAAC;AAEF,wBAAgB,UAAU,WAYzB;AAED,wBAAgB,UAAU,WAGzB"}
@@ -1,39 +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.baseTnCUrl = exports.getTnCHost = exports.TncConstants = void 0;
7
- const hydrajs_1 = __importDefault(require("@cee-eng/hydrajs"));
8
- exports.TncConstants = {
9
- HOSTS: {
10
- DEV: 'ams-dev1.devlab.redhat.com',
11
- QA: 'www.qa.redhat.com',
12
- Stage: 'www.stage.redhat.com',
13
- PROD: 'www.redhat.com',
14
- },
15
- PARTNER_SHARE_SITE_CODE: 'customerPortal',
16
- PARTNER_SHARE_EVENT_CODE: 'partnerAuthorization',
17
- REMOTER_RIDER_EVENT_CODE: 'remoteAccessRider',
18
- REMOTE_RIDER_SITE_CODE: 'remoteAccessRider',
19
- PARTNER_SHARE_LINK_ACCOUNT_SITE_CODE: 'customerPortal_linkAccount',
20
- };
21
- function getTnCHost() {
22
- const env = hydrajs_1.default.Env.getEnvName();
23
- switch (env) {
24
- case 'QA':
25
- return exports.TncConstants.HOSTS.QA;
26
- case 'DEV':
27
- return exports.TncConstants.HOSTS.DEV;
28
- case 'Stage':
29
- return exports.TncConstants.HOSTS.Stage;
30
- default:
31
- return exports.TncConstants.HOSTS.PROD;
32
- }
33
- }
34
- exports.getTnCHost = getTnCHost;
35
- function baseTnCUrl() {
36
- const wejava_host = getTnCHost();
37
- return `https://${wejava_host}/wapps/tnc/ackrequired`;
38
- }
39
- exports.baseTnCUrl = baseTnCUrl;
@@ -1,10 +0,0 @@
1
- /**
2
- * Translate the string using i18n.t
3
- * @param {string} key the string to be translated
4
- * @param {object} args additional object to be passed if string interpolation used
5
- * @returns {string} translated string
6
- *
7
- * use getText only in the case when neither <Trans /> nor useTranslation() is available
8
- */
9
- export declare function getText(key: string, args?: object): string;
10
- //# sourceMappingURL=translation-helper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"translation-helper.d.ts","sourceRoot":"","sources":["../../src/translation-helper.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAM1D"}
@@ -1,23 +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.getText = void 0;
7
- const i18next_1 = __importDefault(require("i18next"));
8
- /**
9
- * Translate the string using i18n.t
10
- * @param {string} key the string to be translated
11
- * @param {object} args additional object to be passed if string interpolation used
12
- * @returns {string} translated string
13
- *
14
- * use getText only in the case when neither <Trans /> nor useTranslation() is available
15
- */
16
- function getText(key, args) {
17
- const translatedString = i18next_1.default.t(key, args);
18
- if (!translatedString) {
19
- return key;
20
- }
21
- return translatedString;
22
- }
23
- exports.getText = getText;
@@ -1,19 +0,0 @@
1
- import { IParseOptions, IStringifyOptions } from 'qs';
2
- export declare function getUrlParsedParams(urlParams: string, options?: IParseOptions): any;
3
- export declare function getStringifiedParams<T>(object: T, options?: IStringifyOptions): string;
4
- export declare const REDHAT_DOT_COM_HOSTNAMES: {
5
- QA: string;
6
- STAGE: string;
7
- DEV: string;
8
- PROD: string;
9
- };
10
- export declare const getRedhatDotComHost: (env: any) => string;
11
- export declare const getResTypeFromUrl: (url: string) => string;
12
- export declare const getDrupalResIdFromUrl: (url: string) => string;
13
- export declare const getDrupalResIdIfTypeFromUrl: (url: string, resourceTypes?: string[]) => number;
14
- export declare const getUpdatedQueryString: (currentQuery: Object | string, newQuery: Object, { resetSearchParams, removeEmptyParams }: {
15
- resetSearchParams?: boolean;
16
- removeEmptyParams?: boolean;
17
- }) => string;
18
- export declare const isValidUrl: (url: string) => boolean;
19
- //# sourceMappingURL=urlUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"urlUtils.d.ts","sourceRoot":"","sources":["../../src/urlUtils.ts"],"names":[],"mappings":"AACA,OAAW,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AAG1D,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,OAG5E;AAGD,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,iBAAiB,UAG7E;AAED,eAAO,MAAM,wBAAwB;;;;;CAKpC,CAAC;AAEF,eAAO,MAAM,mBAAmB,sBAW/B,CAAC;AAKF,eAAO,MAAM,iBAAiB,QAAS,MAAM,WAK5C,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAS,MAAM,WAGhD,CAAC;AAEF,eAAO,MAAM,2BAA2B,QAC/B,MAAM,kBACI,MAAM,EAAE,KACxB,MAKF,CAAC;AAMF,eAAO,MAAM,qBAAqB,iBAChB,MAAM,GAAG,MAAM,YACnB,MAAM;;;MAEjB,MAOF,CAAC;AAEF,eAAO,MAAM,UAAU,QAAS,MAAM,KAAG,OAExC,CAAC"}
@@ -1,76 +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.isValidUrl = exports.getUpdatedQueryString = exports.getDrupalResIdIfTypeFromUrl = exports.getDrupalResIdFromUrl = exports.getResTypeFromUrl = exports.getRedhatDotComHost = exports.REDHAT_DOT_COM_HOSTNAMES = exports.getStringifiedParams = exports.getUrlParsedParams = void 0;
7
- const pickBy_1 = __importDefault(require("lodash/pickBy"));
8
- const qs_1 = __importDefault(require("qs"));
9
- // parses url query params to an obj
10
- function getUrlParsedParams(urlParams, options) {
11
- const defaultOptions = { ignoreQueryPrefix: true };
12
- return qs_1.default.parse(urlParams, Object.assign(Object.assign({}, defaultOptions), options));
13
- }
14
- exports.getUrlParsedParams = getUrlParsedParams;
15
- // converts an obj to url query params
16
- function getStringifiedParams(object, options) {
17
- const defaultOptions = { arrayFormat: 'repeat', encode: false };
18
- return qs_1.default.stringify(object, Object.assign(Object.assign({}, defaultOptions), options));
19
- }
20
- exports.getStringifiedParams = getStringifiedParams;
21
- exports.REDHAT_DOT_COM_HOSTNAMES = {
22
- QA: 'https://www.qa.redhat.com',
23
- STAGE: 'https://www.stage.redhat.com',
24
- DEV: 'https://www.dev.redhat.com',
25
- PROD: 'https://www.redhat.com',
26
- };
27
- const getRedhatDotComHost = (env) => {
28
- switch (env) {
29
- case 'QA':
30
- return exports.REDHAT_DOT_COM_HOSTNAMES.QA;
31
- case 'DEV':
32
- return exports.REDHAT_DOT_COM_HOSTNAMES.DEV;
33
- case 'Stage':
34
- return exports.REDHAT_DOT_COM_HOSTNAMES.STAGE;
35
- default:
36
- return exports.REDHAT_DOT_COM_HOSTNAMES.PROD;
37
- }
38
- };
39
- exports.getRedhatDotComHost = getRedhatDotComHost;
40
- const drupalUrlRegexp = /^(https:\/\/access?.?\w+.redhat.com)?\/(\w+)\/(\d+)\S*$/;
41
- const openshiftDocUrlRegexp = /^https:\/\/docs.openshift.com\//;
42
- const getResTypeFromUrl = (url) => {
43
- const drupalUrl = drupalUrlRegexp.exec(url);
44
- const isOpenshiftDocUrl = openshiftDocUrlRegexp.test(url);
45
- return (drupalUrl === null || drupalUrl === void 0 ? void 0 : drupalUrl[2]) ? drupalUrl === null || drupalUrl === void 0 ? void 0 : drupalUrl[2] : isOpenshiftDocUrl ? 'documentation' : 'unknown';
46
- };
47
- exports.getResTypeFromUrl = getResTypeFromUrl;
48
- const getDrupalResIdFromUrl = (url) => {
49
- let m = drupalUrlRegexp.exec(url);
50
- return m === null || m === void 0 ? void 0 : m[2];
51
- };
52
- exports.getDrupalResIdFromUrl = getDrupalResIdFromUrl;
53
- const getDrupalResIdIfTypeFromUrl = (url, resourceTypes = ['solutions', 'articles']) => {
54
- var _a;
55
- let m = drupalUrlRegexp.exec(url);
56
- const resourceType = (_a = m === null || m === void 0 ? void 0 : m[2]) !== null && _a !== void 0 ? _a : '';
57
- const resourceId = m === null || m === void 0 ? void 0 : m[3];
58
- return resourceTypes.includes(resourceType) && !isNaN(parseInt(resourceId)) ? parseInt(resourceId) : undefined;
59
- };
60
- exports.getDrupalResIdIfTypeFromUrl = getDrupalResIdIfTypeFromUrl;
61
- const isFieldValueEmpty = function (value) {
62
- return value === '' || value === undefined || value === null;
63
- };
64
- const getUpdatedQueryString = (currentQuery, newQuery, { resetSearchParams = false, removeEmptyParams = false }) => {
65
- const currentQueryObj = typeof currentQuery === 'string' ? getUrlParsedParams(currentQuery) : currentQuery;
66
- const mergedQueryObject = Object.assign(Object.assign({}, currentQueryObj), newQuery);
67
- const updatedQuery = removeEmptyParams
68
- ? pickBy_1.default(mergedQueryObject, (item) => !isFieldValueEmpty(item))
69
- : mergedQueryObject;
70
- return !resetSearchParams ? getStringifiedParams(updatedQuery) : getStringifiedParams(newQuery);
71
- };
72
- exports.getUpdatedQueryString = getUpdatedQueryString;
73
- const isValidUrl = (url) => {
74
- return /^(http(s)?:\/\/)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/.test(url);
75
- };
76
- exports.isValidUrl = isValidUrl;
@@ -1,3 +0,0 @@
1
- import { IContact } from '@cee-eng/hydrajs/@types/models/contact';
2
- export declare const sortHydraContacts: (hydraContacts: IContact[]) => IContact[];
3
- //# sourceMappingURL=userUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"userUtils.d.ts","sourceRoot":"","sources":["../../src/userUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAGlE,eAAO,MAAM,iBAAiB,kBAAmB,QAAQ,EAAE,KAAG,QAAQ,EAErE,CAAC"}
@@ -1,11 +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.sortHydraContacts = void 0;
7
- const sortBy_1 = __importDefault(require("lodash/sortBy"));
8
- const sortHydraContacts = (hydraContacts) => {
9
- return sortBy_1.default(hydraContacts, 'firstName', 'lastName');
10
- };
11
- exports.sortHydraContacts = sortHydraContacts;
@@ -1,11 +0,0 @@
1
- declare const emojiPattern: RegExp;
2
- declare const mailformat: RegExp;
3
- declare function isEmailValid(object: any): boolean;
4
- declare function isValidRHEmail(object: any): boolean;
5
- declare function isEmojiPattern(object: any): boolean;
6
- declare function isValidGuid(object: any): boolean;
7
- declare function isNumber(str: string): boolean;
8
- declare function isRegularVersion(version: string): boolean;
9
- declare function isImageFile(fileType: any): boolean;
10
- export { isEmailValid, isNumber, isRegularVersion, isValidRHEmail, isEmojiPattern, emojiPattern, mailformat, isValidGuid, isImageFile, };
11
- //# sourceMappingURL=validatorUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validatorUtils.d.ts","sourceRoot":"","sources":["../../src/validatorUtils.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,YAAY,EAAE,MACgY,CAAC;AACrZ,QAAA,MAAM,UAAU,QAGf,CAAC;AAIF,iBAAS,YAAY,CAAC,MAAM,KAAA,WAM3B;AAGD,iBAAS,cAAc,CAAC,MAAM,KAAA,WAM7B;AAED,iBAAS,cAAc,CAAC,MAAM,KAAA,WAM7B;AAED,iBAAS,WAAW,CAAC,MAAM,KAAA,WAO1B;AAED,iBAAS,QAAQ,CAAC,GAAG,EAAE,MAAM,WAE5B;AAED,iBAAS,gBAAgB,CAAC,OAAO,EAAE,MAAM,WAiBxC;AAED,iBAAS,WAAW,CAAC,QAAQ,KAAA,WAE5B;AAED,OAAO,EACH,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,GACd,CAAC"}