@rh-support/utils 2.4.10-beta.6 → 2.5.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.
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,59 +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.getDropdownBtnPlaceholder = exports.toOptions = exports.toOption = void 0;
7
- const isFunction_1 = __importDefault(require("lodash/isFunction"));
8
- const map_1 = __importDefault(require("lodash/map"));
9
- function toOption(value, config = {}) {
10
- return (value && {
11
- value,
12
- label: ((config === null || config === void 0 ? void 0 : config.labelKey)
13
- ? isFunction_1.default(config === null || config === void 0 ? void 0 : config.labelKey)
14
- ? config === null || config === void 0 ? void 0 : config.labelKey(value)
15
- : value[config === null || config === void 0 ? void 0 : config.labelKey] || ''
16
- : value),
17
- disabled: ((config === null || config === void 0 ? void 0 : config.disabledKey) ? value[config === null || config === void 0 ? void 0 : config.disabledKey] : false),
18
- className: (config === null || config === void 0 ? void 0 : config.classNameFn) ? config === null || config === void 0 ? void 0 : config.classNameFn(value) : '',
19
- children: ((config === null || config === void 0 ? void 0 : config.childrenKey)
20
- ? value[config === null || config === void 0 ? void 0 : config.childrenKey]
21
- : undefined),
22
- additionalInfo: ((config === null || config === void 0 ? void 0 : config.additionalInfoKey)
23
- ? value[config === null || config === void 0 ? void 0 : config.additionalInfoKey]
24
- : undefined),
25
- actionItem: ((config === null || config === void 0 ? void 0 : config.actionItemKey)
26
- ? value[config === null || config === void 0 ? void 0 : config.actionItemKey]
27
- : undefined),
28
- isNonActionable: ((config === null || config === void 0 ? void 0 : config.nonActionableItemKey)
29
- ? value[config === null || config === void 0 ? void 0 : config.nonActionableItemKey]
30
- : false),
31
- isNotSearchable: ((config === null || config === void 0 ? void 0 : config.nonSearchableItemKey)
32
- ? value[config === null || config === void 0 ? void 0 : config.nonSearchableItemKey]
33
- : false),
34
- isNotSelectable: ((config === null || config === void 0 ? void 0 : config.nonSelectableItemKey)
35
- ? value[config === null || config === void 0 ? void 0 : config.nonSelectableItemKey]
36
- : false),
37
- });
38
- }
39
- exports.toOption = toOption;
40
- function toOptions(values, config = {}) {
41
- return map_1.default(values, (v) => toOption(v, config));
42
- }
43
- exports.toOptions = toOptions;
44
- function getDropdownBtnPlaceholder(btnPlaceholder, selectedValues, type, totalLength, totalLengthString) {
45
- if (!selectedValues || (selectedValues && selectedValues.length === 0)) {
46
- return btnPlaceholder;
47
- }
48
- else if (selectedValues && selectedValues.length === 1) {
49
- const selectedItem = selectedValues[0];
50
- return typeof selectedItem === 'string' ? selectedItem : selectedItem.value;
51
- }
52
- else if (selectedValues && totalLength && selectedValues.length === totalLength) {
53
- return totalLengthString || btnPlaceholder;
54
- }
55
- else {
56
- return `${selectedValues.length} ${type} selected`;
57
- }
58
- }
59
- exports.getDropdownBtnPlaceholder = getDropdownBtnPlaceholder;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- export interface IPendoTrackEventProperty {
3
- [key: string]: string;
4
- }
5
- declare function haltEvent(event: React.SyntheticEvent<{}>): void;
6
- declare function pendoTrackEvent(name: any, properties?: IPendoTrackEventProperty): void;
7
- declare function dtmTrackEvent(elemRef: React.MutableRefObject<HTMLElement>, eventName: string, event: CustomEventInit<unknown>): void;
8
- export { haltEvent, pendoTrackEvent, dtmTrackEvent };
9
- //# sourceMappingURL=eventUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eventUtils.d.ts","sourceRoot":"","sources":["../../src/eventUtils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,wBAAwB;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,iBAAS,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,QAKjD;AAKD,iBAAS,eAAe,CAAC,IAAI,KAAA,EAAE,UAAU,GAAE,wBAA6B,QAMvE;AAED,iBAAS,aAAa,CAClB,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAC5C,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,QAKlC;AAED,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC"}
@@ -1,32 +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.dtmTrackEvent = exports.pendoTrackEvent = exports.haltEvent = void 0;
7
- const hydrajs_1 = require("@cee-eng/hydrajs");
8
- const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
9
- function haltEvent(event) {
10
- if (event) {
11
- event.stopPropagation();
12
- event.preventDefault();
13
- }
14
- }
15
- exports.haltEvent = haltEvent;
16
- // https://support.pendo.io/hc/en-us/articles/360032294291-Track-Events-Configuration
17
- // if event name is not exist in the pendo then it will create
18
- // new event otherwise it will update existing event.
19
- function pendoTrackEvent(name, properties = {}) {
20
- const pendo = window.pendo;
21
- // log the event for prod and local envirnoment
22
- if (!isEmpty_1.default(pendo) && (hydrajs_1.Env.getEnvName() === hydrajs_1.Env.EnvNames.PROD || hydrajs_1.Env.isLocalEnv())) {
23
- pendo.track(name, properties);
24
- }
25
- }
26
- exports.pendoTrackEvent = pendoTrackEvent;
27
- function dtmTrackEvent(elemRef, eventName, event) {
28
- if (elemRef.current && (hydrajs_1.Env.getEnvName() === hydrajs_1.Env.EnvNames.PROD || hydrajs_1.Env.isLocalEnv())) {
29
- elemRef.current.dispatchEvent(new CustomEvent(eventName, event));
30
- }
31
- }
32
- exports.dtmTrackEvent = dtmTrackEvent;
@@ -1,7 +0,0 @@
1
- declare enum APP_HOST_NAMES {
2
- supportHubHostName = "supportHubHostName"
3
- }
4
- declare const getSFDCEnv: () => string;
5
- declare const getSFDCSecureSupportCaseLink: (caseNumber: string) => string;
6
- export { APP_HOST_NAMES, getSFDCEnv, getSFDCSecureSupportCaseLink };
7
- //# sourceMappingURL=hostNameUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hostNameUtils.d.ts","sourceRoot":"","sources":["../../src/hostNameUtils.ts"],"names":[],"mappings":"AAEA,aAAK,cAAc;IACf,kBAAkB,uBAAuB;CAC5C;AAED,QAAA,MAAM,UAAU,cAoBf,CAAC;AAEF,QAAA,MAAM,4BAA4B,eAAgB,MAAM,WAGvD,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,4BAA4B,EAAE,CAAC"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSFDCSecureSupportCaseLink = exports.getSFDCEnv = exports.APP_HOST_NAMES = void 0;
4
- const hydrajs_1 = require("@cee-eng/hydrajs");
5
- var APP_HOST_NAMES;
6
- (function (APP_HOST_NAMES) {
7
- APP_HOST_NAMES["supportHubHostName"] = "supportHubHostName";
8
- })(APP_HOST_NAMES || (APP_HOST_NAMES = {}));
9
- exports.APP_HOST_NAMES = APP_HOST_NAMES;
10
- const getSFDCEnv = () => {
11
- const env = hydrajs_1.Env.getEnvName();
12
- // Prod HostName
13
- let hostName = 'gss.my.salesforce.com';
14
- switch (env) {
15
- case hydrajs_1.Env.EnvNames.QA:
16
- hostName = 'gss--qa.cs53.my.salesforce.com';
17
- break;
18
- case hydrajs_1.Env.EnvNames.STAGE:
19
- hostName = 'gss--stage2.cs70.my.salesforce.com';
20
- break;
21
- case hydrajs_1.Env.EnvNames.PROD_BETA:
22
- case hydrajs_1.Env.EnvNames.PROD:
23
- hostName = 'gss.my.salesforce.com';
24
- break;
25
- default:
26
- hostName = 'gss.my.salesforce.com';
27
- }
28
- return hostName;
29
- };
30
- exports.getSFDCEnv = getSFDCEnv;
31
- const getSFDCSecureSupportCaseLink = (caseNumber) => {
32
- const hostName = getSFDCEnv();
33
- return `https://${hostName}/apex/Support#/cases/${caseNumber}`;
34
- };
35
- exports.getSFDCSecureSupportCaseLink = getSFDCSecureSupportCaseLink;
@@ -1,14 +0,0 @@
1
- import { IMaintenance } from '@cee-eng/hydrajs/@types/models/maintenance';
2
- export declare enum PCM_CONFIG_FIELD_TYPE {
3
- JSON = "JSON",
4
- JSON_ARRAY = "JSON-ARRAY",
5
- JSON_HASHMAP = "JSON-HASHMAP",
6
- FEATURE_FLAG = "FEATURE-FLAG",
7
- STRING_COMMA_SEPERATED = "STRING-COMMA-SEPERATED",
8
- STRING = "STRING",
9
- NUMBER = "NUMBER"
10
- }
11
- declare function getConfigField(config: IMaintenance[], fieldName: string, fieldType?: PCM_CONFIG_FIELD_TYPE): any;
12
- declare const getFieldInParts: (config: IMaintenance[], fieldName: string, fieldType?: PCM_CONFIG_FIELD_TYPE) => any;
13
- export { getConfigField, getFieldInParts };
14
- //# sourceMappingURL=hydraConfigUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hydraConfigUtils.d.ts","sourceRoot":"","sources":["../../src/hydraConfigUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAO1E,oBAAY,qBAAqB;IAC7B,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,YAAY,iBAAiB;IAC7B,YAAY,iBAAiB;IAC7B,sBAAsB,2BAA2B;IACjD,MAAM,WAAW;IACjB,MAAM,WAAW;CACpB;AAED,iBAAS,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAE,qBAA4B,OAgCzG;AAED,QAAA,MAAM,eAAe,WAAY,YAAY,EAAE,aAAa,MAAM,cAAa,qBAAqB,QAuCnG,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC"}
@@ -1,83 +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.getFieldInParts = exports.getConfigField = exports.PCM_CONFIG_FIELD_TYPE = void 0;
7
- const concat_1 = __importDefault(require("lodash/concat"));
8
- const map_1 = __importDefault(require("lodash/map"));
9
- const merge_1 = __importDefault(require("lodash/merge"));
10
- const reduce_1 = __importDefault(require("lodash/reduce"));
11
- const startsWith_1 = __importDefault(require("lodash/startsWith"));
12
- var PCM_CONFIG_FIELD_TYPE;
13
- (function (PCM_CONFIG_FIELD_TYPE) {
14
- PCM_CONFIG_FIELD_TYPE["JSON"] = "JSON";
15
- PCM_CONFIG_FIELD_TYPE["JSON_ARRAY"] = "JSON-ARRAY";
16
- PCM_CONFIG_FIELD_TYPE["JSON_HASHMAP"] = "JSON-HASHMAP";
17
- PCM_CONFIG_FIELD_TYPE["FEATURE_FLAG"] = "FEATURE-FLAG";
18
- PCM_CONFIG_FIELD_TYPE["STRING_COMMA_SEPERATED"] = "STRING-COMMA-SEPERATED";
19
- PCM_CONFIG_FIELD_TYPE["STRING"] = "STRING";
20
- PCM_CONFIG_FIELD_TYPE["NUMBER"] = "NUMBER";
21
- })(PCM_CONFIG_FIELD_TYPE = exports.PCM_CONFIG_FIELD_TYPE || (exports.PCM_CONFIG_FIELD_TYPE = {}));
22
- function getConfigField(config, fieldName, fieldType = null) {
23
- let values = reduce_1.default(config, (result, v) => {
24
- return v.fieldName.startsWith(fieldName) ? [...result, v.fieldValue] : result;
25
- }, []);
26
- if (fieldType && fieldType === PCM_CONFIG_FIELD_TYPE.STRING) {
27
- return values[0];
28
- }
29
- if (fieldType && fieldType === PCM_CONFIG_FIELD_TYPE.NUMBER) {
30
- return parseInt(values[0], 10);
31
- }
32
- if (fieldType && fieldType === PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG) {
33
- return values.length === 0 ? false : Boolean(parseInt(values[0]));
34
- }
35
- if (values.length === 0)
36
- return null;
37
- if (!fieldType)
38
- return values;
39
- try {
40
- const parsed = values.map((value) => JSON.parse(value));
41
- if (fieldType === PCM_CONFIG_FIELD_TYPE.JSON)
42
- return parsed;
43
- if (fieldType === PCM_CONFIG_FIELD_TYPE.JSON_ARRAY)
44
- return reduce_1.default(parsed, concat_1.default);
45
- if (fieldType === PCM_CONFIG_FIELD_TYPE.JSON_HASHMAP)
46
- return reduce_1.default(parsed, merge_1.default);
47
- }
48
- catch (error) {
49
- console.log(error);
50
- }
51
- }
52
- exports.getConfigField = getConfigField;
53
- const getFieldInParts = (config, fieldName, fieldType = null) => {
54
- const values = reduce_1.default(config, (result, v) => {
55
- return startsWith_1.default(v.fieldName, fieldName) ? [...result, v.fieldValue] : result;
56
- }, []);
57
- if (values.length === 0) {
58
- return null;
59
- }
60
- if (!fieldType) {
61
- return values;
62
- }
63
- try {
64
- if (fieldType === 'STRING-COMMA-SEPERATED') {
65
- return reduce_1.default(values, (acc, value) => {
66
- return acc.concat(value.split(','));
67
- }, []);
68
- }
69
- const parsed = map_1.default(values, JSON.parse);
70
- if (fieldType === 'JSON') {
71
- return parsed;
72
- }
73
- // if (fieldType === 'JSON-ARRAY') { return reduce(parsed, concat); }
74
- if (fieldType === 'JSON-HASHMAP') {
75
- return reduce_1.default(parsed, merge_1.default);
76
- }
77
- }
78
- catch (error) {
79
- // tslint:disable-next-line:no-console
80
- console.error(error);
81
- }
82
- };
83
- exports.getFieldInParts = getFieldInParts;
@@ -1,30 +0,0 @@
1
- export * from './apiUtils';
2
- export * from './appUtils';
3
- export * from './browserDetectionUtils';
4
- export * from './caseUtils';
5
- export * from './cacheUtils';
6
- export * from './csvUtils';
7
- export * from './dateUtils';
8
- export * from './dropdownUtils';
9
- export * from './eventUtils';
10
- export * from './hostNameUtils';
11
- export * from './hydraConfigUtils';
12
- export * from './insightRuleInfoUtils';
13
- export * from './lruCacheUtils';
14
- export * from './productsUtils';
15
- export * from './promiseUtils';
16
- export * from './recommendationUtils';
17
- export * from './solrUtils';
18
- export * from './searchApiUtils';
19
- export * from './scrollUtils';
20
- export * from './urlUtils';
21
- export * from './validatorUtils';
22
- export * from './customElementUtils';
23
- export * from './userUtils';
24
- export * from './styleUtils';
25
- export * from './translation-helper';
26
- export * from './outlier';
27
- export * from './sentry';
28
- export * from './constants/preferredLanguages';
29
- export * from './tncUtil';
30
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,WAAW,CAAC"}
package/lib/cjs/index.js DELETED
@@ -1,41 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./apiUtils"), exports);
14
- __exportStar(require("./appUtils"), exports);
15
- __exportStar(require("./browserDetectionUtils"), exports);
16
- __exportStar(require("./caseUtils"), exports);
17
- __exportStar(require("./cacheUtils"), exports);
18
- __exportStar(require("./csvUtils"), exports);
19
- __exportStar(require("./dateUtils"), exports);
20
- __exportStar(require("./dropdownUtils"), exports);
21
- __exportStar(require("./eventUtils"), exports);
22
- __exportStar(require("./hostNameUtils"), exports);
23
- __exportStar(require("./hydraConfigUtils"), exports);
24
- __exportStar(require("./insightRuleInfoUtils"), exports);
25
- __exportStar(require("./lruCacheUtils"), exports);
26
- __exportStar(require("./productsUtils"), exports);
27
- __exportStar(require("./promiseUtils"), exports);
28
- __exportStar(require("./recommendationUtils"), exports);
29
- __exportStar(require("./solrUtils"), exports);
30
- __exportStar(require("./searchApiUtils"), exports);
31
- __exportStar(require("./scrollUtils"), exports);
32
- __exportStar(require("./urlUtils"), exports);
33
- __exportStar(require("./validatorUtils"), exports);
34
- __exportStar(require("./customElementUtils"), exports);
35
- __exportStar(require("./userUtils"), exports);
36
- __exportStar(require("./styleUtils"), exports);
37
- __exportStar(require("./translation-helper"), exports);
38
- __exportStar(require("./outlier"), exports);
39
- __exportStar(require("./sentry"), exports);
40
- __exportStar(require("./constants/preferredLanguages"), exports);
41
- __exportStar(require("./tncUtil"), exports);
@@ -1,4 +0,0 @@
1
- import { Details } from '@cee-eng/hydrajs/@types/models/insights';
2
- export declare function getRuleReasonHtml(ruleReason: string, reportDetails: Details): string;
3
- export declare function parseDotTemplate(dotString: string, reportDetails: Details): string;
4
- //# sourceMappingURL=insightRuleInfoUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"insightRuleInfoUtils.d.ts","sourceRoot":"","sources":["../../src/insightRuleInfoUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AASlE,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,UAI3E;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,UASzE"}
@@ -1,31 +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.parseDotTemplate = exports.getRuleReasonHtml = void 0;
7
- const ui_toolkit_1 = require("@cee-eng/ui-toolkit");
8
- const doT_1 = __importDefault(require("dot/doT"));
9
- const assign_1 = __importDefault(require("lodash/assign"));
10
- doT_1.default.templateSettings = assign_1.default({}, doT_1.default.templateSettings, {
11
- varname: 'pydata',
12
- strip: false,
13
- });
14
- function getRuleReasonHtml(ruleReason, reportDetails) {
15
- const resultText = parseDotTemplate(ruleReason, reportDetails);
16
- const html = ui_toolkit_1.markdownToHTML(resultText);
17
- return html;
18
- }
19
- exports.getRuleReasonHtml = getRuleReasonHtml;
20
- function parseDotTemplate(dotString, reportDetails) {
21
- let parsedDotString = '';
22
- try {
23
- const tempFn = doT_1.default.template(dotString);
24
- parsedDotString = tempFn(reportDetails);
25
- }
26
- catch (e) {
27
- parsedDotString = '';
28
- }
29
- return parsedDotString;
30
- }
31
- exports.parseDotTemplate = parseDotTemplate;
@@ -1,13 +0,0 @@
1
- export declare class LRUCache<K, V> {
2
- max: number;
3
- cache: Map<K, V>;
4
- constructor(max?: number);
5
- get(key: K): V;
6
- set(key: K, val: V): void;
7
- has(key: K): boolean;
8
- size(): number;
9
- first(): any;
10
- peek(key: K): V;
11
- clear(): void;
12
- }
13
- //# sourceMappingURL=lruCacheUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lruCacheUtils.d.ts","sourceRoot":"","sources":["../../src/lruCacheUtils.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ,CAAC,CAAC,EAAE,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBACL,GAAG,SAAK;IAKpB,GAAG,CAAC,GAAG,EAAE,CAAC;IAUV,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;IAQlB,GAAG,CAAC,GAAG,EAAE,CAAC;IAIV,IAAI;IAIJ,KAAK;IAIL,IAAI,CAAC,GAAG,EAAE,CAAC;IAMX,KAAK;CAGR"}
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LRUCache = void 0;
4
- class LRUCache {
5
- constructor(max = 10) {
6
- this.max = max;
7
- this.cache = new Map();
8
- }
9
- get(key) {
10
- let item = this.cache.get(key);
11
- if (item) {
12
- // refresh key
13
- this.cache.delete(key);
14
- this.cache.set(key, item);
15
- }
16
- return item;
17
- }
18
- set(key, val) {
19
- // refresh key
20
- if (this.cache.has(key))
21
- this.cache.delete(key);
22
- // evict oldest
23
- else if (this.cache.size === this.max)
24
- this.cache.delete(this.first());
25
- this.cache.set(key, val);
26
- }
27
- has(key) {
28
- return this.cache.has(key);
29
- }
30
- size() {
31
- return this.cache.size;
32
- }
33
- first() {
34
- return this.cache.keys().next().value;
35
- }
36
- peek(key) {
37
- if (this.cache.has(key)) {
38
- return this.cache.get(key);
39
- }
40
- }
41
- clear() {
42
- this.cache.clear();
43
- }
44
- }
45
- exports.LRUCache = LRUCache;
@@ -1,16 +0,0 @@
1
- /**
2
- * Outlier Function
3
- * Refer: https://www.cuemath.com/outlier-formula/
4
- *
5
- * An outlier function which takers array of number and find high outlier and low outlier
6
- * 1. Taker array of number and sort then in ascending order.
7
- * 2. Calculate first(q1) and third(q3) quartile.
8
- * 3. Calculate inter-quartile(iqr) range (q3-q1).
9
- * 4. Find the upper boundary value by formula q3 + iqr*1.5.
10
- * 5. Find the lower boundary value by formula q1 - iqr*1.5
11
- *
12
- * @param {number[]} numbers
13
- * @returns {number[]} upper and lower boundary value
14
- */
15
- export declare const outlier: (array: Array<number>) => Array<number>;
16
- //# sourceMappingURL=outlier.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"outlier.d.ts","sourceRoot":"","sources":["../../src/outlier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,OAAO,UAAW,MAAM,MAAM,CAAC,KAAG,MAAM,MAAM,CAkC1D,CAAC"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- /**
3
- * Outlier Function
4
- * Refer: https://www.cuemath.com/outlier-formula/
5
- *
6
- * An outlier function which takers array of number and find high outlier and low outlier
7
- * 1. Taker array of number and sort then in ascending order.
8
- * 2. Calculate first(q1) and third(q3) quartile.
9
- * 3. Calculate inter-quartile(iqr) range (q3-q1).
10
- * 4. Find the upper boundary value by formula q3 + iqr*1.5.
11
- * 5. Find the lower boundary value by formula q1 - iqr*1.5
12
- *
13
- * @param {number[]} numbers
14
- * @returns {number[]} upper and lower boundary value
15
- */
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.outlier = void 0;
18
- const outlier = (array) => {
19
- // Take array length
20
- const arrayLength = array.length;
21
- // Check if length is smaller than four then return array result as it is
22
- if (arrayLength < 4) {
23
- return array;
24
- }
25
- let q1, q3, iqr, upperBoundary, lowerBoundary;
26
- // Make a copy of array plus sort it in ascending order
27
- const sortedArray = array.slice().sort((a, b) => a - b);
28
- // Find the quartiles range
29
- // If median is odd adjust the index by minus one
30
- if (((arrayLength - 1) / 4) % 1 === 0 || (arrayLength / 4) % 1 === 0) {
31
- q1 = (1 / 2) * (sortedArray[Math.floor(arrayLength / 4) - 1] + sortedArray[Math.floor(arrayLength / 4)]);
32
- q3 =
33
- (1 / 2) *
34
- (sortedArray[Math.ceil(arrayLength * (3 / 4)) - 1] + sortedArray[Math.ceil(arrayLength * (3 / 4))]);
35
- }
36
- else {
37
- q1 = sortedArray[Math.floor(arrayLength / 4)];
38
- q3 = sortedArray[Math.floor(arrayLength * (3 / 4))];
39
- }
40
- // Calculate inter-quartile range
41
- iqr = q3 - q1;
42
- // upper boundary
43
- upperBoundary = q3 + iqr * 1.5;
44
- // lower boundary
45
- lowerBoundary = q1 - iqr * 1.5;
46
- return [upperBoundary, lowerBoundary];
47
- };
48
- exports.outlier = outlier;
@@ -1,33 +0,0 @@
1
- import { IProductV2, ISEProduct } from '@cee-eng/hydrajs/@types/models/product';
2
- export interface ITroubleshootProductResponse {
3
- topProducts: Partial<ISEProduct>[];
4
- otherProducts: Partial<ISEProduct>[];
5
- productsResult: Partial<ISEProduct>[];
6
- }
7
- export declare const handleProductSearchResponse: (productsResultAll: ISEProduct[], productsResultEntitled?: IProductV2[], topCount?: number) => ITroubleshootProductResponse;
8
- /**
9
- * This method is used for parsing `hydra/rest/products/contact/{userName}` response form API
10
- * and need to create partial response like method `handleProductSearchResponse`
11
- * @param productsResultEntitled IProductV2[]
12
- * @returns ITroubleshootProductResponse
13
- */
14
- export declare const handleEntitledProductResponse: (productsResultEntitled?: IProductV2[]) => ITroubleshootProductResponse;
15
- /**
16
- * Tries to get top products with priority given to recentlyFiledAgainst
17
- * before checking general top products from un-authed SE API
18
- * @param products Partial<ISEProduct>
19
- */
20
- export declare function getTopProducts(products: Partial<ISEProduct>[], topCount?: number): Partial<ISEProduct>[];
21
- export declare function isOnlyVersion(versions: string[]): boolean;
22
- export declare function getVersionIfOnlyVersion(versions: string[]): string;
23
- export declare function getUniqueSortedVersions(versions: string[]): string[];
24
- export declare const versionSorter: (_a: string, _b: string) => 0 | 1 | -1;
25
- export declare const versionSort: (arr: string[]) => string[];
26
- interface IGetVersionReturnValue {
27
- major: string;
28
- minor?: string;
29
- }
30
- export declare function getVersion(version: string): IGetVersionReturnValue;
31
- export declare function isSpecialSupportOfferingEnabled(allProducts: Partial<ISEProduct>[], selectedProduct: string): boolean;
32
- export {};
33
- //# sourceMappingURL=productsUtils.d.ts.map
@@ -1 +0,0 @@
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,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,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,eAAe,EAAE,MAAM,WAK1G"}