@rh-support/utils 2.1.13 → 2.1.15
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.d.ts +8 -0
- package/lib/cjs/apiUtils.d.ts.map +1 -1
- package/lib/cjs/apiUtils.js +21 -1
- package/lib/cjs/dateUtils.d.ts +1 -0
- package/lib/cjs/dateUtils.d.ts.map +1 -1
- package/lib/cjs/dateUtils.js +23 -1
- package/lib/cjs/hydraConfigUtils.d.ts +3 -1
- package/lib/cjs/hydraConfigUtils.d.ts.map +1 -1
- package/lib/cjs/hydraConfigUtils.js +8 -0
- package/lib/cjs/index.d.ts +0 -1
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +0 -1
- package/lib/cjs/recommendationUtils.d.ts.map +1 -1
- package/lib/cjs/recommendationUtils.js +3 -1
- package/lib/cjs/searchApiUtils.d.ts +1 -0
- package/lib/cjs/searchApiUtils.d.ts.map +1 -1
- package/lib/esm/apiUtils.d.ts +8 -0
- package/lib/esm/apiUtils.d.ts.map +1 -1
- package/lib/esm/apiUtils.js +19 -0
- package/lib/esm/dateUtils.d.ts +1 -0
- package/lib/esm/dateUtils.d.ts.map +1 -1
- package/lib/esm/dateUtils.js +21 -0
- package/lib/esm/hydraConfigUtils.d.ts +3 -1
- package/lib/esm/hydraConfigUtils.d.ts.map +1 -1
- package/lib/esm/hydraConfigUtils.js +8 -0
- package/lib/esm/index.d.ts +0 -1
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +0 -1
- package/lib/esm/recommendationUtils.d.ts.map +1 -1
- package/lib/esm/recommendationUtils.js +3 -1
- package/lib/esm/searchApiUtils.d.ts +1 -0
- package/lib/esm/searchApiUtils.d.ts.map +1 -1
- package/package.json +4 -4
- package/lib/cjs/customElementUtils.d.ts +0 -20
- package/lib/cjs/customElementUtils.d.ts.map +0 -1
- package/lib/cjs/customElementUtils.js +0 -23
- package/lib/esm/customElementUtils.d.ts +0 -20
- package/lib/esm/customElementUtils.d.ts.map +0 -1
- package/lib/esm/customElementUtils.js +0 -19
package/lib/cjs/apiUtils.d.ts
CHANGED
|
@@ -6,4 +6,12 @@ export declare function getApiUpdationStatus(isUpdating?: boolean, isError?: boo
|
|
|
6
6
|
export declare function getApiDeletionStatus(isDeleting?: boolean, isError?: boolean, errorMessage?: string): IApiDeleteState;
|
|
7
7
|
export declare function haventLoadedMetadata<T>(apiResponse: IApiResponseDetails<T>, isEmptyCallback?: (data: T) => boolean): boolean;
|
|
8
8
|
export declare function haventLoadedProductsMetadata(apiResponse: IApiResponseDetails<ITroubleshootProductResponse>): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* We are firstly remove the special characters from the string and then encode the string. After that
|
|
11
|
+
* we are trimming text as per limit set and then decode the string.
|
|
12
|
+
* @param description Description string
|
|
13
|
+
* @param limit Limit to trim the string
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export declare const getTrimmedSpecialCharacters: (description?: string, limit?: number) => string;
|
|
9
17
|
//# sourceMappingURL=apiUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiUtils.d.ts","sourceRoot":"","sources":["../../src/apiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"apiUtils.d.ts","sourceRoot":"","sources":["../../src/apiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAIlH,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAE/D,wBAAgB,oBAAoB,CAAC,CAAC,EAClC,IAAI,GAAE,CAAa,EACnB,UAAU,GAAE,OAAe,EAC3B,OAAO,GAAE,OAAe,EACxB,YAAY,GAAE,MAAW,EACzB,KAAK,GAAE,KAAY,GACpB,mBAAmB,CAAC,CAAC,CAAC,CAExB;AAED,wBAAgB,oBAAoB,CAChC,UAAU,GAAE,OAAe,EAC3B,OAAO,GAAE,OAAe,EACxB,YAAY,GAAE,MAAW,GAC1B,eAAe,CAEjB;AACD,wBAAgB,oBAAoB,CAChC,UAAU,GAAE,OAAe,EAC3B,OAAO,GAAE,OAAe,EACxB,YAAY,GAAE,MAAW,GAC1B,eAAe,CAEjB;AACD,wBAAgB,oBAAoB,CAChC,UAAU,GAAE,OAAe,EAC3B,OAAO,GAAE,OAAe,EACxB,YAAY,GAAE,MAAW,GAC1B,eAAe,CAEjB;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAClC,WAAW,EAAE,mBAAmB,CAAC,CAAC,CAAC,EACnC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GACvC,OAAO,CAGT;AAED,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,mBAAmB,CAAC,4BAA4B,CAAC,GAAG,OAAO,CAEpH;AAED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,kDASvC,CAAC"}
|
package/lib/cjs/apiUtils.js
CHANGED
|
@@ -3,8 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.haventLoadedProductsMetadata = exports.haventLoadedMetadata = exports.getApiDeletionStatus = exports.getApiUpdationStatus = exports.getApiCreationStatus = exports.getApiResourceObject = void 0;
|
|
6
|
+
exports.getTrimmedSpecialCharacters = exports.haventLoadedProductsMetadata = exports.haventLoadedMetadata = exports.getApiDeletionStatus = exports.getApiUpdationStatus = exports.getApiCreationStatus = exports.getApiResourceObject = void 0;
|
|
7
7
|
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
8
|
+
const trim_1 = __importDefault(require("lodash/trim"));
|
|
8
9
|
function getApiResourceObject(data = undefined, isFetching = false, isError = false, errorMessage = '', error = null) {
|
|
9
10
|
return { data, isFetching, isError, errorMessage, error };
|
|
10
11
|
}
|
|
@@ -30,3 +31,22 @@ function haventLoadedProductsMetadata(apiResponse) {
|
|
|
30
31
|
return isEmpty_1.default(apiResponse.data.productsResult) && !apiResponse.isFetching && !apiResponse.isError;
|
|
31
32
|
}
|
|
32
33
|
exports.haventLoadedProductsMetadata = haventLoadedProductsMetadata;
|
|
34
|
+
/**
|
|
35
|
+
* We are firstly remove the special characters from the string and then encode the string. After that
|
|
36
|
+
* we are trimming text as per limit set and then decode the string.
|
|
37
|
+
* @param description Description string
|
|
38
|
+
* @param limit Limit to trim the string
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
const getTrimmedSpecialCharacters = (description = '', limit = 4000) => {
|
|
42
|
+
if (description) {
|
|
43
|
+
const removeSpecialCharacters = trim_1.default(description.replace(/[^a-zA-Z0-9 ]/g, '').replace(/ {2,}/g, ' '));
|
|
44
|
+
const encodedDescription = encodeURIComponent(removeSpecialCharacters);
|
|
45
|
+
const trimmedDescription = encodedDescription.slice(0, limit);
|
|
46
|
+
return decodeURIComponent(trimmedDescription) || '';
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return description;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
exports.getTrimmedSpecialCharacters = getTrimmedSpecialCharacters;
|
package/lib/cjs/dateUtils.d.ts
CHANGED
|
@@ -11,5 +11,6 @@ declare type AddToDate = {
|
|
|
11
11
|
date?: string;
|
|
12
12
|
};
|
|
13
13
|
export declare const addDaysToDate: (params: AddToDate) => moment.Moment;
|
|
14
|
+
export declare const trafficSplit: (testVariationWeight: number, dateString: string) => "A" | "B";
|
|
14
15
|
export {};
|
|
15
16
|
//# sourceMappingURL=dateUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateUtils.d.ts","sourceRoot":"","sources":["../../src/dateUtils.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,eAAO,MAAM,UAAU,wCAGX,KAAK,qBAAqB,WASrC,CAAC;AAEF,eAAO,MAAM,cAAc,wCAGf,KAAK,qBAAqB,WAerC,CAAC;AAEF,eAAO,MAAM,OAAO,SAAU,MAAM,KAAG,MAAmC,CAAC;AAE3E,eAAO,MAAM,2BAA2B,WAAY,MAAM,WAEzD,CAAC;AAEF,eAAO,MAAM,qBAAqB,aAAc,MAAM,KAAG,MAExD,CAAC;AAEF,eAAO,MAAM,+BAA+B,SAClC,MAAM,gBACC,OAAO,UAAU,CAAC,OAAO,KACvC,OAEF,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,MAAM,gBAAe,OAAO,UAAU,CAAC,OAAO,YAEhF,CAAC;AAEF,aAAK,SAAS,GAAG;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,aAAa,WAAY,SAAS,kBAG9C,CAAC"}
|
|
1
|
+
{"version":3,"file":"dateUtils.d.ts","sourceRoot":"","sources":["../../src/dateUtils.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,eAAO,MAAM,UAAU,wCAGX,KAAK,qBAAqB,WASrC,CAAC;AAEF,eAAO,MAAM,cAAc,wCAGf,KAAK,qBAAqB,WAerC,CAAC;AAEF,eAAO,MAAM,OAAO,SAAU,MAAM,KAAG,MAAmC,CAAC;AAE3E,eAAO,MAAM,2BAA2B,WAAY,MAAM,WAEzD,CAAC;AAEF,eAAO,MAAM,qBAAqB,aAAc,MAAM,KAAG,MAExD,CAAC;AAEF,eAAO,MAAM,+BAA+B,SAClC,MAAM,gBACC,OAAO,UAAU,CAAC,OAAO,KACvC,OAEF,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,MAAM,gBAAe,OAAO,UAAU,CAAC,OAAO,YAEhF,CAAC;AAEF,aAAK,SAAS,GAAG;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,aAAa,WAAY,SAAS,kBAG9C,CAAC;AAOF,eAAO,MAAM,YAAY,wBAAyB,MAAM,cAAc,MAAM,cAe3E,CAAC"}
|
package/lib/cjs/dateUtils.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.addDaysToDate = exports.isFutureDate = exports.isCurrentDateSameAsOrBeforeDate = exports.getPastUTCDateFromNow = exports.getTimezoneOffsetFromTZName = exports.isoDate = exports.formatDateTime = exports.formatDate = void 0;
|
|
6
|
+
exports.trafficSplit = exports.addDaysToDate = exports.isFutureDate = exports.isCurrentDateSameAsOrBeforeDate = exports.getPastUTCDateFromNow = exports.getTimezoneOffsetFromTZName = exports.isoDate = exports.formatDateTime = exports.formatDate = void 0;
|
|
7
7
|
const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
8
8
|
const formatDate = (date, locale = 'en-us', format = { month: 'short', day: 'numeric', year: 'numeric' }) => {
|
|
9
9
|
if (!date) {
|
|
@@ -54,3 +54,25 @@ const addDaysToDate = (params) => {
|
|
|
54
54
|
return moment_timezone_1.default(date).add(days, 'days');
|
|
55
55
|
};
|
|
56
56
|
exports.addDaysToDate = addDaysToDate;
|
|
57
|
+
// split traffic based on time and weight
|
|
58
|
+
// for example, if testVariationWeight is 2 and the current time in seconds modulo 10 is less than 2,
|
|
59
|
+
// redirect to test version (20% of the time), else redirect to control version (80% of the time)
|
|
60
|
+
// @wieght: a number between 0 and 10
|
|
61
|
+
// @dateString: date string
|
|
62
|
+
const trafficSplit = (testVariationWeight, dateString) => {
|
|
63
|
+
if (testVariationWeight === 10)
|
|
64
|
+
return 'A'; // test
|
|
65
|
+
if (testVariationWeight === 0 || !testVariationWeight || isNaN(testVariationWeight))
|
|
66
|
+
return 'B'; // control
|
|
67
|
+
const date = new Date(dateString);
|
|
68
|
+
const seconds = date.getSeconds();
|
|
69
|
+
const totalWeight = 10;
|
|
70
|
+
const moduloResult = seconds % totalWeight;
|
|
71
|
+
if (moduloResult < testVariationWeight) {
|
|
72
|
+
return 'A';
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
return 'B';
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
exports.trafficSplit = trafficSplit;
|
|
@@ -4,7 +4,9 @@ export declare enum PCM_CONFIG_FIELD_TYPE {
|
|
|
4
4
|
JSON_ARRAY = "JSON-ARRAY",
|
|
5
5
|
JSON_HASHMAP = "JSON-HASHMAP",
|
|
6
6
|
FEATURE_FLAG = "FEATURE-FLAG",
|
|
7
|
-
STRING_COMMA_SEPERATED = "STRING-COMMA-SEPERATED"
|
|
7
|
+
STRING_COMMA_SEPERATED = "STRING-COMMA-SEPERATED",
|
|
8
|
+
STRING = "STRING",
|
|
9
|
+
NUMBER = "NUMBER"
|
|
8
10
|
}
|
|
9
11
|
declare function getConfigField(config: IMaintenance[], fieldName: string, fieldType?: PCM_CONFIG_FIELD_TYPE): any;
|
|
10
12
|
declare const getFieldInParts: (config: IMaintenance[], fieldName: string, fieldType?: PCM_CONFIG_FIELD_TYPE) => any;
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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"}
|
|
@@ -16,11 +16,19 @@ var PCM_CONFIG_FIELD_TYPE;
|
|
|
16
16
|
PCM_CONFIG_FIELD_TYPE["JSON_HASHMAP"] = "JSON-HASHMAP";
|
|
17
17
|
PCM_CONFIG_FIELD_TYPE["FEATURE_FLAG"] = "FEATURE-FLAG";
|
|
18
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";
|
|
19
21
|
})(PCM_CONFIG_FIELD_TYPE = exports.PCM_CONFIG_FIELD_TYPE || (exports.PCM_CONFIG_FIELD_TYPE = {}));
|
|
20
22
|
function getConfigField(config, fieldName, fieldType = null) {
|
|
21
23
|
let values = reduce_1.default(config, (result, v) => {
|
|
22
24
|
return v.fieldName.startsWith(fieldName) ? [...result, v.fieldValue] : result;
|
|
23
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
|
+
}
|
|
24
32
|
if (fieldType && fieldType === PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG) {
|
|
25
33
|
return values.length === 0 ? false : Boolean(parseInt(values[0]));
|
|
26
34
|
}
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ export * from './searchApiUtils';
|
|
|
19
19
|
export * from './scrollUtils';
|
|
20
20
|
export * from './urlUtils';
|
|
21
21
|
export * from './validatorUtils';
|
|
22
|
-
export * from './customElementUtils';
|
|
23
22
|
export * from './userUtils';
|
|
24
23
|
export * from './styleUtils';
|
|
25
24
|
export * from './translation-helper';
|
package/lib/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,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
CHANGED
|
@@ -31,7 +31,6 @@ __exportStar(require("./searchApiUtils"), exports);
|
|
|
31
31
|
__exportStar(require("./scrollUtils"), exports);
|
|
32
32
|
__exportStar(require("./urlUtils"), exports);
|
|
33
33
|
__exportStar(require("./validatorUtils"), exports);
|
|
34
|
-
__exportStar(require("./customElementUtils"), exports);
|
|
35
34
|
__exportStar(require("./userUtils"), exports);
|
|
36
35
|
__exportStar(require("./styleUtils"), exports);
|
|
37
36
|
__exportStar(require("./translation-helper"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recommendationUtils.d.ts","sourceRoot":"","sources":["../../src/recommendationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAI7F,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAEvE;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAE1E;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,mBAAmB;;EAGlE;AACD,eAAO,MAAM,6BAA6B;;CAIzC,CAAC;AAEF,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,mBAAmB,EAAE,EAC3B,YAAY,EAAE,YAAY,GAC3B,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"recommendationUtils.d.ts","sourceRoot":"","sources":["../../src/recommendationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAI7F,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAEvE;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAE1E;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,mBAAmB;;EAGlE;AACD,eAAO,MAAM,6BAA6B;;CAIzC,CAAC;AAEF,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,mBAAmB,EAAE,EAC3B,YAAY,EAAE,YAAY,GAC3B,mBAAmB,EAAE,CAgBvB;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKzD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,UAU1C"}
|
|
@@ -29,7 +29,9 @@ function replaceHighlightingData(docs, highlighting) {
|
|
|
29
29
|
return docs.map((doc) => {
|
|
30
30
|
// highlight id is either uri or view_uri
|
|
31
31
|
// when we are uploading a file before adding issue summary no highlighting doc is present hence passing an empty object
|
|
32
|
-
const highlightObj = highlighting
|
|
32
|
+
const highlightObj = highlighting
|
|
33
|
+
? highlighting[doc.resource_uri] || highlighting[doc.uri] || highlighting[doc.view_uri] || {}
|
|
34
|
+
: {};
|
|
33
35
|
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 || [] });
|
|
34
36
|
});
|
|
35
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchApiUtils.d.ts","sourceRoot":"","sources":["../../src/searchApiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAG/E,eAAO,MAAM,qBAAqB,yHAC0E,CAAC;AAE7G,eAAO,MAAM,sBAAsB,EAAE,gBAapC,CAAC;AAMF,oBAAY,gCAAgC,GAAG;KAC1C,GAAG,IAAI,MAAM,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,IAAI,CAAA;KAAE;CACtF,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,iBAAiB,KAAA,QAc5E;AAED,wBAAgB,aAAa,CACzB,IAAI,EAAE,MAAM,EACZ,yBAAyB,EAAE,MAAM,EACjC,iBAAiB,CAAC,EAAE,gCAAgC,EACpD,WAAW,CAAC,EAAE,OAAO
|
|
1
|
+
{"version":3,"file":"searchApiUtils.d.ts","sourceRoot":"","sources":["../../src/searchApiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAG/E,eAAO,MAAM,qBAAqB,yHAC0E,CAAC;AAE7G,eAAO,MAAM,sBAAsB,EAAE,gBAapC,CAAC;AAMF,oBAAY,gCAAgC,GAAG;KAC1C,GAAG,IAAI,MAAM,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,IAAI,CAAA;KAAE;CACtF,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,iBAAiB,KAAA,QAc5E;AAED,wBAAgB,aAAa,CACzB,IAAI,EAAE,MAAM,EACZ,yBAAyB,EAAE,MAAM,EACjC,iBAAiB,CAAC,EAAE,gCAAgC,EACpD,WAAW,CAAC,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWxB"}
|
package/lib/esm/apiUtils.d.ts
CHANGED
|
@@ -6,4 +6,12 @@ export declare function getApiUpdationStatus(isUpdating?: boolean, isError?: boo
|
|
|
6
6
|
export declare function getApiDeletionStatus(isDeleting?: boolean, isError?: boolean, errorMessage?: string): IApiDeleteState;
|
|
7
7
|
export declare function haventLoadedMetadata<T>(apiResponse: IApiResponseDetails<T>, isEmptyCallback?: (data: T) => boolean): boolean;
|
|
8
8
|
export declare function haventLoadedProductsMetadata(apiResponse: IApiResponseDetails<ITroubleshootProductResponse>): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* We are firstly remove the special characters from the string and then encode the string. After that
|
|
11
|
+
* we are trimming text as per limit set and then decode the string.
|
|
12
|
+
* @param description Description string
|
|
13
|
+
* @param limit Limit to trim the string
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export declare const getTrimmedSpecialCharacters: (description?: string, limit?: number) => string;
|
|
9
17
|
//# sourceMappingURL=apiUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiUtils.d.ts","sourceRoot":"","sources":["../../src/apiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"apiUtils.d.ts","sourceRoot":"","sources":["../../src/apiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAIlH,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAE/D,wBAAgB,oBAAoB,CAAC,CAAC,EAClC,IAAI,GAAE,CAAa,EACnB,UAAU,GAAE,OAAe,EAC3B,OAAO,GAAE,OAAe,EACxB,YAAY,GAAE,MAAW,EACzB,KAAK,GAAE,KAAY,GACpB,mBAAmB,CAAC,CAAC,CAAC,CAExB;AAED,wBAAgB,oBAAoB,CAChC,UAAU,GAAE,OAAe,EAC3B,OAAO,GAAE,OAAe,EACxB,YAAY,GAAE,MAAW,GAC1B,eAAe,CAEjB;AACD,wBAAgB,oBAAoB,CAChC,UAAU,GAAE,OAAe,EAC3B,OAAO,GAAE,OAAe,EACxB,YAAY,GAAE,MAAW,GAC1B,eAAe,CAEjB;AACD,wBAAgB,oBAAoB,CAChC,UAAU,GAAE,OAAe,EAC3B,OAAO,GAAE,OAAe,EACxB,YAAY,GAAE,MAAW,GAC1B,eAAe,CAEjB;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAClC,WAAW,EAAE,mBAAmB,CAAC,CAAC,CAAC,EACnC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GACvC,OAAO,CAGT;AAED,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,mBAAmB,CAAC,4BAA4B,CAAC,GAAG,OAAO,CAEpH;AAED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,kDASvC,CAAC"}
|
package/lib/esm/apiUtils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import isEmpty from 'lodash/isEmpty';
|
|
2
|
+
import trim from 'lodash/trim';
|
|
2
3
|
export function getApiResourceObject(data = undefined, isFetching = false, isError = false, errorMessage = '', error = null) {
|
|
3
4
|
return { data, isFetching, isError, errorMessage, error };
|
|
4
5
|
}
|
|
@@ -18,3 +19,21 @@ export function haventLoadedMetadata(apiResponse, isEmptyCallback) {
|
|
|
18
19
|
export function haventLoadedProductsMetadata(apiResponse) {
|
|
19
20
|
return isEmpty(apiResponse.data.productsResult) && !apiResponse.isFetching && !apiResponse.isError;
|
|
20
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* We are firstly remove the special characters from the string and then encode the string. After that
|
|
24
|
+
* we are trimming text as per limit set and then decode the string.
|
|
25
|
+
* @param description Description string
|
|
26
|
+
* @param limit Limit to trim the string
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
export const getTrimmedSpecialCharacters = (description = '', limit = 4000) => {
|
|
30
|
+
if (description) {
|
|
31
|
+
const removeSpecialCharacters = trim(description.replace(/[^a-zA-Z0-9 ]/g, '').replace(/ {2,}/g, ' '));
|
|
32
|
+
const encodedDescription = encodeURIComponent(removeSpecialCharacters);
|
|
33
|
+
const trimmedDescription = encodedDescription.slice(0, limit);
|
|
34
|
+
return decodeURIComponent(trimmedDescription) || '';
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return description;
|
|
38
|
+
}
|
|
39
|
+
};
|
package/lib/esm/dateUtils.d.ts
CHANGED
|
@@ -11,5 +11,6 @@ declare type AddToDate = {
|
|
|
11
11
|
date?: string;
|
|
12
12
|
};
|
|
13
13
|
export declare const addDaysToDate: (params: AddToDate) => moment.Moment;
|
|
14
|
+
export declare const trafficSplit: (testVariationWeight: number, dateString: string) => "A" | "B";
|
|
14
15
|
export {};
|
|
15
16
|
//# sourceMappingURL=dateUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateUtils.d.ts","sourceRoot":"","sources":["../../src/dateUtils.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,eAAO,MAAM,UAAU,wCAGX,KAAK,qBAAqB,WASrC,CAAC;AAEF,eAAO,MAAM,cAAc,wCAGf,KAAK,qBAAqB,WAerC,CAAC;AAEF,eAAO,MAAM,OAAO,SAAU,MAAM,KAAG,MAAmC,CAAC;AAE3E,eAAO,MAAM,2BAA2B,WAAY,MAAM,WAEzD,CAAC;AAEF,eAAO,MAAM,qBAAqB,aAAc,MAAM,KAAG,MAExD,CAAC;AAEF,eAAO,MAAM,+BAA+B,SAClC,MAAM,gBACC,OAAO,UAAU,CAAC,OAAO,KACvC,OAEF,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,MAAM,gBAAe,OAAO,UAAU,CAAC,OAAO,YAEhF,CAAC;AAEF,aAAK,SAAS,GAAG;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,aAAa,WAAY,SAAS,kBAG9C,CAAC"}
|
|
1
|
+
{"version":3,"file":"dateUtils.d.ts","sourceRoot":"","sources":["../../src/dateUtils.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,eAAO,MAAM,UAAU,wCAGX,KAAK,qBAAqB,WASrC,CAAC;AAEF,eAAO,MAAM,cAAc,wCAGf,KAAK,qBAAqB,WAerC,CAAC;AAEF,eAAO,MAAM,OAAO,SAAU,MAAM,KAAG,MAAmC,CAAC;AAE3E,eAAO,MAAM,2BAA2B,WAAY,MAAM,WAEzD,CAAC;AAEF,eAAO,MAAM,qBAAqB,aAAc,MAAM,KAAG,MAExD,CAAC;AAEF,eAAO,MAAM,+BAA+B,SAClC,MAAM,gBACC,OAAO,UAAU,CAAC,OAAO,KACvC,OAEF,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,MAAM,gBAAe,OAAO,UAAU,CAAC,OAAO,YAEhF,CAAC;AAEF,aAAK,SAAS,GAAG;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,aAAa,WAAY,SAAS,kBAG9C,CAAC;AAOF,eAAO,MAAM,YAAY,wBAAyB,MAAM,cAAc,MAAM,cAe3E,CAAC"}
|
package/lib/esm/dateUtils.js
CHANGED
|
@@ -40,3 +40,24 @@ export const addDaysToDate = (params) => {
|
|
|
40
40
|
const { days, date = new Date() } = params;
|
|
41
41
|
return moment(date).add(days, 'days');
|
|
42
42
|
};
|
|
43
|
+
// split traffic based on time and weight
|
|
44
|
+
// for example, if testVariationWeight is 2 and the current time in seconds modulo 10 is less than 2,
|
|
45
|
+
// redirect to test version (20% of the time), else redirect to control version (80% of the time)
|
|
46
|
+
// @wieght: a number between 0 and 10
|
|
47
|
+
// @dateString: date string
|
|
48
|
+
export const trafficSplit = (testVariationWeight, dateString) => {
|
|
49
|
+
if (testVariationWeight === 10)
|
|
50
|
+
return 'A'; // test
|
|
51
|
+
if (testVariationWeight === 0 || !testVariationWeight || isNaN(testVariationWeight))
|
|
52
|
+
return 'B'; // control
|
|
53
|
+
const date = new Date(dateString);
|
|
54
|
+
const seconds = date.getSeconds();
|
|
55
|
+
const totalWeight = 10;
|
|
56
|
+
const moduloResult = seconds % totalWeight;
|
|
57
|
+
if (moduloResult < testVariationWeight) {
|
|
58
|
+
return 'A';
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return 'B';
|
|
62
|
+
}
|
|
63
|
+
};
|
|
@@ -4,7 +4,9 @@ export declare enum PCM_CONFIG_FIELD_TYPE {
|
|
|
4
4
|
JSON_ARRAY = "JSON-ARRAY",
|
|
5
5
|
JSON_HASHMAP = "JSON-HASHMAP",
|
|
6
6
|
FEATURE_FLAG = "FEATURE-FLAG",
|
|
7
|
-
STRING_COMMA_SEPERATED = "STRING-COMMA-SEPERATED"
|
|
7
|
+
STRING_COMMA_SEPERATED = "STRING-COMMA-SEPERATED",
|
|
8
|
+
STRING = "STRING",
|
|
9
|
+
NUMBER = "NUMBER"
|
|
8
10
|
}
|
|
9
11
|
declare function getConfigField(config: IMaintenance[], fieldName: string, fieldType?: PCM_CONFIG_FIELD_TYPE): any;
|
|
10
12
|
declare const getFieldInParts: (config: IMaintenance[], fieldName: string, fieldType?: PCM_CONFIG_FIELD_TYPE) => any;
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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"}
|
|
@@ -10,11 +10,19 @@ export var PCM_CONFIG_FIELD_TYPE;
|
|
|
10
10
|
PCM_CONFIG_FIELD_TYPE["JSON_HASHMAP"] = "JSON-HASHMAP";
|
|
11
11
|
PCM_CONFIG_FIELD_TYPE["FEATURE_FLAG"] = "FEATURE-FLAG";
|
|
12
12
|
PCM_CONFIG_FIELD_TYPE["STRING_COMMA_SEPERATED"] = "STRING-COMMA-SEPERATED";
|
|
13
|
+
PCM_CONFIG_FIELD_TYPE["STRING"] = "STRING";
|
|
14
|
+
PCM_CONFIG_FIELD_TYPE["NUMBER"] = "NUMBER";
|
|
13
15
|
})(PCM_CONFIG_FIELD_TYPE || (PCM_CONFIG_FIELD_TYPE = {}));
|
|
14
16
|
function getConfigField(config, fieldName, fieldType = null) {
|
|
15
17
|
let values = reduce(config, (result, v) => {
|
|
16
18
|
return v.fieldName.startsWith(fieldName) ? [...result, v.fieldValue] : result;
|
|
17
19
|
}, []);
|
|
20
|
+
if (fieldType && fieldType === PCM_CONFIG_FIELD_TYPE.STRING) {
|
|
21
|
+
return values[0];
|
|
22
|
+
}
|
|
23
|
+
if (fieldType && fieldType === PCM_CONFIG_FIELD_TYPE.NUMBER) {
|
|
24
|
+
return parseInt(values[0], 10);
|
|
25
|
+
}
|
|
18
26
|
if (fieldType && fieldType === PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG) {
|
|
19
27
|
return values.length === 0 ? false : Boolean(parseInt(values[0]));
|
|
20
28
|
}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ export * from './searchApiUtils';
|
|
|
19
19
|
export * from './scrollUtils';
|
|
20
20
|
export * from './urlUtils';
|
|
21
21
|
export * from './validatorUtils';
|
|
22
|
-
export * from './customElementUtils';
|
|
23
22
|
export * from './userUtils';
|
|
24
23
|
export * from './styleUtils';
|
|
25
24
|
export * from './translation-helper';
|
package/lib/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,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/esm/index.js
CHANGED
|
@@ -19,7 +19,6 @@ export * from './searchApiUtils';
|
|
|
19
19
|
export * from './scrollUtils';
|
|
20
20
|
export * from './urlUtils';
|
|
21
21
|
export * from './validatorUtils';
|
|
22
|
-
export * from './customElementUtils';
|
|
23
22
|
export * from './userUtils';
|
|
24
23
|
export * from './styleUtils';
|
|
25
24
|
export * from './translation-helper';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recommendationUtils.d.ts","sourceRoot":"","sources":["../../src/recommendationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAI7F,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAEvE;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAE1E;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,mBAAmB;;EAGlE;AACD,eAAO,MAAM,6BAA6B;;CAIzC,CAAC;AAEF,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,mBAAmB,EAAE,EAC3B,YAAY,EAAE,YAAY,GAC3B,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"recommendationUtils.d.ts","sourceRoot":"","sources":["../../src/recommendationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAI7F,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAEvE;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,mBAAmB,GAAG,MAAM,CAE1E;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,mBAAmB;;EAGlE;AACD,eAAO,MAAM,6BAA6B;;CAIzC,CAAC;AAEF,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,mBAAmB,EAAE,EAC3B,YAAY,EAAE,YAAY,GAC3B,mBAAmB,EAAE,CAgBvB;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAKzD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,UAU1C"}
|
|
@@ -19,7 +19,9 @@ export function replaceHighlightingData(docs, highlighting) {
|
|
|
19
19
|
return docs.map((doc) => {
|
|
20
20
|
// highlight id is either uri or view_uri
|
|
21
21
|
// when we are uploading a file before adding issue summary no highlighting doc is present hence passing an empty object
|
|
22
|
-
const highlightObj = highlighting
|
|
22
|
+
const highlightObj = highlighting
|
|
23
|
+
? highlighting[doc.resource_uri] || highlighting[doc.uri] || highlighting[doc.view_uri] || {}
|
|
24
|
+
: {};
|
|
23
25
|
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 || [] });
|
|
24
26
|
});
|
|
25
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchApiUtils.d.ts","sourceRoot":"","sources":["../../src/searchApiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAG/E,eAAO,MAAM,qBAAqB,yHAC0E,CAAC;AAE7G,eAAO,MAAM,sBAAsB,EAAE,gBAapC,CAAC;AAMF,oBAAY,gCAAgC,GAAG;KAC1C,GAAG,IAAI,MAAM,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,IAAI,CAAA;KAAE;CACtF,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,iBAAiB,KAAA,QAc5E;AAED,wBAAgB,aAAa,CACzB,IAAI,EAAE,MAAM,EACZ,yBAAyB,EAAE,MAAM,EACjC,iBAAiB,CAAC,EAAE,gCAAgC,EACpD,WAAW,CAAC,EAAE,OAAO
|
|
1
|
+
{"version":3,"file":"searchApiUtils.d.ts","sourceRoot":"","sources":["../../src/searchApiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAG/E,eAAO,MAAM,qBAAqB,yHAC0E,CAAC;AAE7G,eAAO,MAAM,sBAAsB,EAAE,gBAapC,CAAC;AAMF,oBAAY,gCAAgC,GAAG;KAC1C,GAAG,IAAI,MAAM,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,IAAI,CAAA;KAAE;CACtF,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,iBAAiB,KAAA,QAc5E;AAED,wBAAgB,aAAa,CACzB,IAAI,EAAE,MAAM,EACZ,yBAAyB,EAAE,MAAM,EACjC,iBAAiB,CAAC,EAAE,gCAAgC,EACpD,WAAW,CAAC,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/utils",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.15",
|
|
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.16.
|
|
48
|
+
"@cee-eng/hydrajs": "4.16.43",
|
|
49
49
|
"@cee-eng/ui-toolkit": "1.1.6",
|
|
50
50
|
"dompurify": "^2.2.6",
|
|
51
51
|
"i18next": "^19.0.1",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"solr-query-builder": "1.0.1"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@cee-eng/hydrajs": "4.16.
|
|
62
|
+
"@cee-eng/hydrajs": "4.16.43",
|
|
63
63
|
"@cee-eng/ui-toolkit": "1.1.6",
|
|
64
64
|
"@rh-support/types": "2.0.2",
|
|
65
65
|
"dompurify": "^2.2.6",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"defaults and supports es6-module",
|
|
89
89
|
"maintained node versions"
|
|
90
90
|
],
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "0be2733af553431eb0064993df8c0f097e12a47f"
|
|
92
92
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare enum CustomElements {
|
|
2
|
-
pfeTabs = "pfe-tabs",
|
|
3
|
-
pfeCollapse = "pfe-collapse"
|
|
4
|
-
}
|
|
5
|
-
interface RequireCustomElementObject {
|
|
6
|
-
/** The custom element you want to check if it has been defined */
|
|
7
|
-
element: CustomElements;
|
|
8
|
-
/** cb that will be called if the custom element has yet to be defined */
|
|
9
|
-
requireCb: () => void;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* This function is to check if custom elements exist and require them if they do not.
|
|
13
|
-
* The check is needed because of how the packages are split and that patternfly elements
|
|
14
|
-
* use window.customElements.define without checking if it is already defined, which throws an
|
|
15
|
-
* error. Since our packages are split up and lazy loaded this check is necessary to make sure that
|
|
16
|
-
* the pfelement does not get defined twice.
|
|
17
|
-
*/
|
|
18
|
-
export declare function requireCustomElement(elements: RequireCustomElementObject[]): void;
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=customElementUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customElementUtils.d.ts","sourceRoot":"","sources":["../../src/customElementUtils.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACtB,OAAO,aAAa;IACpB,WAAW,iBAAiB;CAC/B;AAED,UAAU,0BAA0B;IAChC,kEAAkE;IAClE,OAAO,EAAE,cAAc,CAAC;IAExB,yEAAyE;IACzE,SAAS,EAAE,MAAM,IAAI,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,0BAA0B,EAAE,QAM1E"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.requireCustomElement = exports.CustomElements = void 0;
|
|
4
|
-
var CustomElements;
|
|
5
|
-
(function (CustomElements) {
|
|
6
|
-
CustomElements["pfeTabs"] = "pfe-tabs";
|
|
7
|
-
CustomElements["pfeCollapse"] = "pfe-collapse";
|
|
8
|
-
})(CustomElements = exports.CustomElements || (exports.CustomElements = {}));
|
|
9
|
-
/**
|
|
10
|
-
* This function is to check if custom elements exist and require them if they do not.
|
|
11
|
-
* The check is needed because of how the packages are split and that patternfly elements
|
|
12
|
-
* use window.customElements.define without checking if it is already defined, which throws an
|
|
13
|
-
* error. Since our packages are split up and lazy loaded this check is necessary to make sure that
|
|
14
|
-
* the pfelement does not get defined twice.
|
|
15
|
-
*/
|
|
16
|
-
function requireCustomElement(elements) {
|
|
17
|
-
elements.forEach((elementObj) => {
|
|
18
|
-
if (window.customElements.get(elementObj.element) === undefined) {
|
|
19
|
-
elementObj.requireCb();
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
exports.requireCustomElement = requireCustomElement;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare enum CustomElements {
|
|
2
|
-
pfeTabs = "pfe-tabs",
|
|
3
|
-
pfeCollapse = "pfe-collapse"
|
|
4
|
-
}
|
|
5
|
-
interface RequireCustomElementObject {
|
|
6
|
-
/** The custom element you want to check if it has been defined */
|
|
7
|
-
element: CustomElements;
|
|
8
|
-
/** cb that will be called if the custom element has yet to be defined */
|
|
9
|
-
requireCb: () => void;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* This function is to check if custom elements exist and require them if they do not.
|
|
13
|
-
* The check is needed because of how the packages are split and that patternfly elements
|
|
14
|
-
* use window.customElements.define without checking if it is already defined, which throws an
|
|
15
|
-
* error. Since our packages are split up and lazy loaded this check is necessary to make sure that
|
|
16
|
-
* the pfelement does not get defined twice.
|
|
17
|
-
*/
|
|
18
|
-
export declare function requireCustomElement(elements: RequireCustomElementObject[]): void;
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=customElementUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customElementUtils.d.ts","sourceRoot":"","sources":["../../src/customElementUtils.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACtB,OAAO,aAAa;IACpB,WAAW,iBAAiB;CAC/B;AAED,UAAU,0BAA0B;IAChC,kEAAkE;IAClE,OAAO,EAAE,cAAc,CAAC;IAExB,yEAAyE;IACzE,SAAS,EAAE,MAAM,IAAI,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,0BAA0B,EAAE,QAM1E"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export var CustomElements;
|
|
2
|
-
(function (CustomElements) {
|
|
3
|
-
CustomElements["pfeTabs"] = "pfe-tabs";
|
|
4
|
-
CustomElements["pfeCollapse"] = "pfe-collapse";
|
|
5
|
-
})(CustomElements || (CustomElements = {}));
|
|
6
|
-
/**
|
|
7
|
-
* This function is to check if custom elements exist and require them if they do not.
|
|
8
|
-
* The check is needed because of how the packages are split and that patternfly elements
|
|
9
|
-
* use window.customElements.define without checking if it is already defined, which throws an
|
|
10
|
-
* error. Since our packages are split up and lazy loaded this check is necessary to make sure that
|
|
11
|
-
* the pfelement does not get defined twice.
|
|
12
|
-
*/
|
|
13
|
-
export function requireCustomElement(elements) {
|
|
14
|
-
elements.forEach((elementObj) => {
|
|
15
|
-
if (window.customElements.get(elementObj.element) === undefined) {
|
|
16
|
-
elementObj.requireCb();
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|