@rh-support/utils 2.1.10-beta.14 → 2.1.11-beta.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.
- package/README.md +2 -0
- package/lib/cjs/customElementUtils.d.ts +20 -0
- package/lib/cjs/customElementUtils.d.ts.map +1 -0
- package/lib/cjs/customElementUtils.js +23 -0
- package/lib/cjs/dateUtils.d.ts +1 -0
- package/lib/cjs/dateUtils.d.ts.map +1 -1
- package/lib/cjs/dateUtils.js +25 -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 +1 -0
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +1 -0
- 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/cjs/urlUtils.js +1 -1
- package/lib/esm/customElementUtils.d.ts +20 -0
- package/lib/esm/customElementUtils.d.ts.map +1 -0
- package/lib/esm/customElementUtils.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 +23 -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 +1 -0
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +1 -0
- 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/lib/esm/urlUtils.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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;
|
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,cAkB3E,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,27 @@ 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 milliseconds 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 milliseconds = date.getTime();
|
|
69
|
+
const totalWeight = 10;
|
|
70
|
+
// calculate the modulo based on the total weight
|
|
71
|
+
const moduloResult = milliseconds % totalWeight;
|
|
72
|
+
// redirect traffic based on the calculated modulo
|
|
73
|
+
if (moduloResult < testVariationWeight) {
|
|
74
|
+
return 'A';
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return 'B';
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
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,6 +19,7 @@ export * from './searchApiUtils';
|
|
|
19
19
|
export * from './scrollUtils';
|
|
20
20
|
export * from './urlUtils';
|
|
21
21
|
export * from './validatorUtils';
|
|
22
|
+
export * from './customElementUtils';
|
|
22
23
|
export * from './userUtils';
|
|
23
24
|
export * from './styleUtils';
|
|
24
25
|
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,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"}
|
|
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
CHANGED
|
@@ -31,6 +31,7 @@ __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);
|
|
34
35
|
__exportStar(require("./userUtils"), exports);
|
|
35
36
|
__exportStar(require("./styleUtils"), exports);
|
|
36
37
|
__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/cjs/urlUtils.js
CHANGED
|
@@ -71,6 +71,6 @@ const getUpdatedQueryString = (currentQuery, newQuery, { resetSearchParams = fal
|
|
|
71
71
|
};
|
|
72
72
|
exports.getUpdatedQueryString = getUpdatedQueryString;
|
|
73
73
|
const isValidUrl = (url) => {
|
|
74
|
-
return
|
|
74
|
+
return /^(http(s)?:\/\/)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/.test(url);
|
|
75
75
|
};
|
|
76
76
|
exports.isValidUrl = isValidUrl;
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
}
|
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,cAkB3E,CAAC"}
|
package/lib/esm/dateUtils.js
CHANGED
|
@@ -40,3 +40,26 @@ 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 milliseconds 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 milliseconds = date.getTime();
|
|
55
|
+
const totalWeight = 10;
|
|
56
|
+
// calculate the modulo based on the total weight
|
|
57
|
+
const moduloResult = milliseconds % totalWeight;
|
|
58
|
+
// redirect traffic based on the calculated modulo
|
|
59
|
+
if (moduloResult < testVariationWeight) {
|
|
60
|
+
return 'A';
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
return 'B';
|
|
64
|
+
}
|
|
65
|
+
};
|
|
@@ -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,6 +19,7 @@ export * from './searchApiUtils';
|
|
|
19
19
|
export * from './scrollUtils';
|
|
20
20
|
export * from './urlUtils';
|
|
21
21
|
export * from './validatorUtils';
|
|
22
|
+
export * from './customElementUtils';
|
|
22
23
|
export * from './userUtils';
|
|
23
24
|
export * from './styleUtils';
|
|
24
25
|
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,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"}
|
|
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/esm/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export * from './searchApiUtils';
|
|
|
19
19
|
export * from './scrollUtils';
|
|
20
20
|
export * from './urlUtils';
|
|
21
21
|
export * from './validatorUtils';
|
|
22
|
+
export * from './customElementUtils';
|
|
22
23
|
export * from './userUtils';
|
|
23
24
|
export * from './styleUtils';
|
|
24
25
|
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/lib/esm/urlUtils.js
CHANGED
|
@@ -58,5 +58,5 @@ export const getUpdatedQueryString = (currentQuery, newQuery, { resetSearchParam
|
|
|
58
58
|
return !resetSearchParams ? getStringifiedParams(updatedQuery) : getStringifiedParams(newQuery);
|
|
59
59
|
};
|
|
60
60
|
export const isValidUrl = (url) => {
|
|
61
|
-
return
|
|
61
|
+
return /^(http(s)?:\/\/)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/.test(url);
|
|
62
62
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/utils",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.11-beta.0",
|
|
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": "3d67f1bfd743fabfd0a606cf56ea4bf48d91daa2"
|
|
92
92
|
}
|