@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.
- package/README.md +0 -2
- package/lib/esm/apiUtils.d.ts +2 -2
- package/lib/esm/apiUtils.d.ts.map +1 -1
- package/lib/esm/apiUtils.js +18 -6
- package/lib/esm/csvUtils.d.ts +2 -2
- package/lib/esm/csvUtils.d.ts.map +1 -1
- package/lib/esm/csvUtils.js +9 -16
- package/lib/esm/dateUtils.d.ts +11 -9
- package/lib/esm/dateUtils.d.ts.map +1 -1
- package/lib/esm/dateUtils.js +96 -11
- package/lib/esm/dropdownUtils.d.ts +1 -1
- package/lib/esm/dropdownUtils.d.ts.map +1 -1
- package/lib/esm/eventUtils.d.ts +14 -2
- package/lib/esm/eventUtils.d.ts.map +1 -1
- package/lib/esm/eventUtils.js +101 -5
- package/lib/esm/hostNameUtils.d.ts.map +1 -1
- package/lib/esm/hydraConfigUtils.d.ts +1 -1
- package/lib/esm/hydraConfigUtils.d.ts.map +1 -1
- package/lib/esm/index.d.ts +0 -2
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +0 -2
- package/lib/esm/outlier.d.ts.map +1 -1
- package/lib/esm/promiseUtils.d.ts.map +1 -1
- package/lib/esm/recommendationUtils.js +2 -2
- package/lib/esm/searchApiUtils.d.ts +2 -2
- package/lib/esm/searchApiUtils.d.ts.map +1 -1
- package/lib/esm/searchApiUtils.js +3 -3
- package/lib/esm/solrUtils.d.ts +4 -4
- package/lib/esm/solrUtils.d.ts.map +1 -1
- package/lib/esm/solrUtils.js +1 -2
- package/lib/esm/translation-helper.d.ts +5 -1
- package/lib/esm/translation-helper.d.ts.map +1 -1
- package/lib/esm/translation-helper.js +1 -1
- package/lib/esm/urlUtils.d.ts +3 -1
- package/lib/esm/urlUtils.d.ts.map +1 -1
- package/lib/esm/urlUtils.js +14 -5
- package/lib/esm/validatorUtils.js +1 -1
- package/package.json +17 -31
- package/lib/cjs/apiUtils.d.ts +0 -17
- package/lib/cjs/apiUtils.d.ts.map +0 -1
- package/lib/cjs/apiUtils.js +0 -52
- package/lib/cjs/appUtils.d.ts +0 -11
- package/lib/cjs/appUtils.d.ts.map +0 -1
- package/lib/cjs/appUtils.js +0 -67
- package/lib/cjs/browserDetectionUtils.d.ts +0 -3
- package/lib/cjs/browserDetectionUtils.d.ts.map +0 -1
- package/lib/cjs/browserDetectionUtils.js +0 -9
- package/lib/cjs/cacheUtils.d.ts +0 -27
- package/lib/cjs/cacheUtils.d.ts.map +0 -1
- package/lib/cjs/cacheUtils.js +0 -137
- package/lib/cjs/caseUtils.d.ts +0 -40
- package/lib/cjs/caseUtils.d.ts.map +0 -1
- package/lib/cjs/caseUtils.js +0 -225
- package/lib/cjs/constants/preferredLanguages.d.ts +0 -33
- package/lib/cjs/constants/preferredLanguages.d.ts.map +0 -1
- package/lib/cjs/constants/preferredLanguages.js +0 -35
- package/lib/cjs/csvUtils.d.ts +0 -24
- package/lib/cjs/csvUtils.d.ts.map +0 -1
- package/lib/cjs/csvUtils.js +0 -109
- 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/cjs/dateUtils.d.ts +0 -16
- package/lib/cjs/dateUtils.d.ts.map +0 -1
- package/lib/cjs/dateUtils.js +0 -78
- package/lib/cjs/dropdownUtils.d.ts +0 -18
- package/lib/cjs/dropdownUtils.d.ts.map +0 -1
- package/lib/cjs/dropdownUtils.js +0 -59
- package/lib/cjs/eventUtils.d.ts +0 -9
- package/lib/cjs/eventUtils.d.ts.map +0 -1
- package/lib/cjs/eventUtils.js +0 -32
- package/lib/cjs/hostNameUtils.d.ts +0 -7
- package/lib/cjs/hostNameUtils.d.ts.map +0 -1
- package/lib/cjs/hostNameUtils.js +0 -35
- package/lib/cjs/hydraConfigUtils.d.ts +0 -14
- package/lib/cjs/hydraConfigUtils.d.ts.map +0 -1
- package/lib/cjs/hydraConfigUtils.js +0 -83
- package/lib/cjs/index.d.ts +0 -30
- package/lib/cjs/index.d.ts.map +0 -1
- package/lib/cjs/index.js +0 -41
- package/lib/cjs/insightRuleInfoUtils.d.ts +0 -4
- package/lib/cjs/insightRuleInfoUtils.d.ts.map +0 -1
- package/lib/cjs/insightRuleInfoUtils.js +0 -31
- package/lib/cjs/lruCacheUtils.d.ts +0 -13
- package/lib/cjs/lruCacheUtils.d.ts.map +0 -1
- package/lib/cjs/lruCacheUtils.js +0 -45
- package/lib/cjs/outlier.d.ts +0 -16
- package/lib/cjs/outlier.d.ts.map +0 -1
- package/lib/cjs/outlier.js +0 -48
- package/lib/cjs/productsUtils.d.ts +0 -33
- package/lib/cjs/productsUtils.d.ts.map +0 -1
- package/lib/cjs/productsUtils.js +0 -138
- package/lib/cjs/promiseUtils.d.ts +0 -8
- package/lib/cjs/promiseUtils.d.ts.map +0 -1
- package/lib/cjs/promiseUtils.js +0 -23
- package/lib/cjs/recommendationUtils.d.ts +0 -14
- package/lib/cjs/recommendationUtils.d.ts.map +0 -1
- package/lib/cjs/recommendationUtils.js +0 -61
- package/lib/cjs/scrollUtils.d.ts +0 -11
- package/lib/cjs/scrollUtils.d.ts.map +0 -1
- package/lib/cjs/scrollUtils.js +0 -74
- package/lib/cjs/searchApiUtils.d.ts +0 -44
- package/lib/cjs/searchApiUtils.d.ts.map +0 -1
- package/lib/cjs/searchApiUtils.js +0 -48
- package/lib/cjs/sentry.d.ts +0 -14
- package/lib/cjs/sentry.d.ts.map +0 -1
- package/lib/cjs/sentry.js +0 -40
- package/lib/cjs/solrUtils.d.ts +0 -74
- package/lib/cjs/solrUtils.d.ts.map +0 -1
- package/lib/cjs/solrUtils.js +0 -322
- package/lib/cjs/styleUtils.d.ts +0 -12
- package/lib/cjs/styleUtils.d.ts.map +0 -1
- package/lib/cjs/styleUtils.js +0 -34
- package/lib/cjs/tncUtil.d.ts +0 -16
- package/lib/cjs/tncUtil.d.ts.map +0 -1
- package/lib/cjs/tncUtil.js +0 -39
- package/lib/cjs/translation-helper.d.ts +0 -10
- package/lib/cjs/translation-helper.d.ts.map +0 -1
- package/lib/cjs/translation-helper.js +0 -23
- package/lib/cjs/urlUtils.d.ts +0 -19
- package/lib/cjs/urlUtils.d.ts.map +0 -1
- package/lib/cjs/urlUtils.js +0 -76
- package/lib/cjs/userUtils.d.ts +0 -3
- package/lib/cjs/userUtils.d.ts.map +0 -1
- package/lib/cjs/userUtils.js +0 -11
- package/lib/cjs/validatorUtils.d.ts +0 -11
- package/lib/cjs/validatorUtils.d.ts.map +0 -1
- package/lib/cjs/validatorUtils.js +0 -76
- 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/esm/insightRuleInfoUtils.d.ts +0 -4
- package/lib/esm/insightRuleInfoUtils.d.ts.map +0 -1
- package/lib/esm/insightRuleInfoUtils.js +0 -23
package/README.md
CHANGED
package/lib/esm/apiUtils.d.ts
CHANGED
|
@@ -7,11 +7,11 @@ export declare function getApiDeletionStatus(isDeleting?: boolean, isError?: boo
|
|
|
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
9
|
/**
|
|
10
|
-
* We are firstly remove the special characters from the string and then encode the string. After that
|
|
11
10
|
* we are trimming text as per limit set and then decode the string.
|
|
12
11
|
* @param description Description string
|
|
13
12
|
* @param limit Limit to trim the string
|
|
14
13
|
* @returns
|
|
15
14
|
*/
|
|
16
|
-
export declare const
|
|
15
|
+
export declare const getTrimmedCharacters: (description?: string, limit?: number) => string;
|
|
16
|
+
export declare const convertObjToEncodedQueryParams: (Obj: any) => string;
|
|
17
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;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
|
|
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;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,kDAOhC,CAAC;AAGF,eAAO,MAAM,8BAA8B,sBAc1C,CAAC"}
|
package/lib/esm/apiUtils.js
CHANGED
|
@@ -20,20 +20,32 @@ export function haventLoadedProductsMetadata(apiResponse) {
|
|
|
20
20
|
return isEmpty(apiResponse.data.productsResult) && !apiResponse.isFetching && !apiResponse.isError;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* We are firstly remove the special characters from the string and then encode the string. After that
|
|
24
23
|
* we are trimming text as per limit set and then decode the string.
|
|
25
24
|
* @param description Description string
|
|
26
25
|
* @param limit Limit to trim the string
|
|
27
26
|
* @returns
|
|
28
27
|
*/
|
|
29
|
-
export const
|
|
28
|
+
export const getTrimmedCharacters = (description = '', limit = 4000) => {
|
|
30
29
|
if (description) {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const trimmedDescription = encodedDescription.slice(0, limit);
|
|
34
|
-
return decodeURIComponent(trimmedDescription) || '';
|
|
30
|
+
const trimmedDescription = trim(description).replace(/ {2,}/g, ' ').slice(0, limit);
|
|
31
|
+
return trimmedDescription;
|
|
35
32
|
}
|
|
36
33
|
else {
|
|
37
34
|
return description;
|
|
38
35
|
}
|
|
39
36
|
};
|
|
37
|
+
// converts an obj to url query params and encodes value
|
|
38
|
+
export const convertObjToEncodedQueryParams = (Obj) => {
|
|
39
|
+
const params = new URLSearchParams();
|
|
40
|
+
Object.entries(Obj).forEach(([key, value]) => {
|
|
41
|
+
if (Array.isArray(value)) {
|
|
42
|
+
value.forEach((value) => {
|
|
43
|
+
value && params.append(key, value === null || value === void 0 ? void 0 : value.toString());
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
value && params.append(key, value.toString());
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return params.toString();
|
|
51
|
+
};
|
package/lib/esm/csvUtils.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface ICSVHeader {
|
|
|
9
9
|
export declare const isSafari: () => boolean;
|
|
10
10
|
export declare const escapeDoubleQuotes: (data: any) => any;
|
|
11
11
|
export declare const isJsons: (array: any) => boolean;
|
|
12
|
-
export declare const isArrays: (array: any) =>
|
|
12
|
+
export declare const isArrays: (array: any) => array is any[][];
|
|
13
13
|
export declare const jsonsHeaders: (array: any) => unknown[];
|
|
14
14
|
export declare const jsons2arrays: (jsons: any, headers: any) => any[];
|
|
15
15
|
export declare const getHeaderValue: (property: any, obj: any, transformFn?: (data: any) => any) => any;
|
|
@@ -20,5 +20,5 @@ export declare const jsons2csv: (data: any[], headers: any, separator: any, encl
|
|
|
20
20
|
export declare const string2csv: (data: string, headers: any, separator?: string, enclosingCharacter?: string) => string;
|
|
21
21
|
export declare const toCSV: (data: string | any[] | any[][], headers: any, separator?: string, enclosingCharacter?: string) => any;
|
|
22
22
|
export declare const buildURI: (data: string | any[] | any[][], headers: any, uFEFF?: boolean, separator?: string, enclosingCharacter?: string) => string;
|
|
23
|
-
export declare const downloadCSV: (data: string | any[] | any[][], headers: ICSVHeader[], fileName?: string
|
|
23
|
+
export declare const downloadCSV: (data: string | any[] | any[][], headers: ICSVHeader[], fileName?: string) => void;
|
|
24
24
|
//# sourceMappingURL=csvUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csvUtils.d.ts","sourceRoot":"","sources":["../../src/csvUtils.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,CAAC,IAAI,KAAA,KAAK,MAAM,GAAG,MAAM,CAAC;CACzC;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,eAAmE,CAAC;AAEzF,eAAO,MAAM,kBAAkB,oBAAiF,CAAC;AAGjH,eAAO,MAAM,OAAO,yBACgF,CAAC;AAErG,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"csvUtils.d.ts","sourceRoot":"","sources":["../../src/csvUtils.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,CAAC,IAAI,KAAA,KAAK,MAAM,GAAG,MAAM,CAAC;CACzC;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,eAAmE,CAAC;AAEzF,eAAO,MAAM,kBAAkB,oBAAiF,CAAC;AAGjH,eAAO,MAAM,OAAO,yBACgF,CAAC;AAErG,eAAO,MAAM,QAAQ,kCAA8E,CAAC;AAEpG,eAAO,MAAM,YAAY,2BACyE,CAAC;AAEnG,eAAO,MAAM,YAAY,qCAexB,CAAC;AAEF,eAAO,MAAM,cAAc,oEAkB1B,CAAC;AAEF,eAAO,MAAM,cAAc,uBAAyD,CAAC;AAErF,eAAO,MAAM,MAAM,qEAUlB,CAAC;AAEF,eAAO,MAAM,UAAU,SAAU,GAAG,EAAE,EAAE,+DACsC,CAAC;AAE/E,eAAO,MAAM,SAAS,SAAU,GAAG,EAAE,+DACiC,CAAC;AAEvE,eAAO,MAAM,UAAU,SAAU,MAAM,0EACmB,CAAC;AAE3D,eAAO,MAAM,KAAK,SAAU,MAAM,GAAG,GAAG,EAAE,GAAG,GAAG,EAAE,EAAE,uEAKnD,CAAC;AAEF,eAAO,MAAM,QAAQ,SACX,MAAM,GAAG,GAAG,EAAE,GAAG,GAAG,EAAE,EAAE,2FAcjC,CAAC;AAEF,eAAO,MAAM,WAAW,SAAU,MAAM,GAAG,GAAG,EAAE,GAAG,GAAG,EAAE,EAAE,WAAW,UAAU,EAAE,4BAShF,CAAC"}
|
package/lib/esm/csvUtils.js
CHANGED
|
@@ -72,20 +72,13 @@ export const buildURI = (data, headers, uFEFF = true, separator = ',', enclosing
|
|
|
72
72
|
const URL = window.URL || window.webkitURL;
|
|
73
73
|
return typeof URL.createObjectURL === 'undefined' ? dataURI : URL.createObjectURL(blob);
|
|
74
74
|
};
|
|
75
|
-
export const downloadCSV = (data, headers, fileName = 'csvGenerator'
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
element.setAttribute('href', uri);
|
|
85
|
-
element.setAttribute('target', '_self');
|
|
86
|
-
element.setAttribute('download', fileName);
|
|
87
|
-
document.body.appendChild(element);
|
|
88
|
-
element.click();
|
|
89
|
-
document.body.removeChild(element);
|
|
90
|
-
}
|
|
75
|
+
export const downloadCSV = (data, headers, fileName = 'csvGenerator') => {
|
|
76
|
+
const uri = buildURI(data, headers);
|
|
77
|
+
const element = document.createElement('a');
|
|
78
|
+
element.setAttribute('href', uri);
|
|
79
|
+
element.setAttribute('target', '_self');
|
|
80
|
+
element.setAttribute('download', fileName);
|
|
81
|
+
document.body.appendChild(element);
|
|
82
|
+
element.click();
|
|
83
|
+
document.body.removeChild(element);
|
|
91
84
|
};
|
package/lib/esm/dateUtils.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
type Granularity = 'day' | 'week' | 'month' | 'year';
|
|
2
2
|
export declare const formatDate: (date: any, locale?: string, format?: Intl.DateTimeFormatOptions) => string;
|
|
3
3
|
export declare const formatDateTime: (date: any, locale?: string, format?: Intl.DateTimeFormatOptions) => string;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const isCurrentDateAfterDate: (date: string, granularity?: Granularity) => boolean;
|
|
5
5
|
export declare const getTimezoneOffsetFromTZName: (tzName: string) => string;
|
|
6
6
|
export declare const getPastUTCDateFromNow: (pastDays: number) => string;
|
|
7
|
-
export declare const
|
|
8
|
-
export
|
|
9
|
-
declare type AddToDate = {
|
|
7
|
+
export declare const isFutureDate: (date: string, granularity?: Granularity) => boolean;
|
|
8
|
+
export interface AddToDate {
|
|
10
9
|
days: number;
|
|
11
|
-
date?: string;
|
|
12
|
-
}
|
|
13
|
-
export declare const addDaysToDate: (params: AddToDate) =>
|
|
14
|
-
export declare const
|
|
10
|
+
date?: Date | string | number;
|
|
11
|
+
}
|
|
12
|
+
export declare const addDaysToDate: (params: AddToDate) => Date;
|
|
13
|
+
export declare const isValidDate: (dateString: string) => boolean;
|
|
14
|
+
export declare const generateUniqueIdBasedOnNowDate: () => string;
|
|
15
|
+
export declare const ABTestSplitSplitBasedOnDate: (testVariationWeight: number, dateString: string) => "A" | "B";
|
|
16
|
+
export declare const ABTestSplitBasedOnAccountNumber: (testVariationWeight: number, accountNumber: string) => "A" | "B";
|
|
15
17
|
export {};
|
|
16
18
|
//# sourceMappingURL=dateUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateUtils.d.ts","sourceRoot":"","sources":["../../src/dateUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dateUtils.d.ts","sourceRoot":"","sources":["../../src/dateUtils.ts"],"names":[],"mappings":"AAaA,KAAK,WAAW,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAErD,eAAO,MAAM,UAAU,wCAGX,IAAI,CAAC,qBAAqB,WASrC,CAAC;AAEF,eAAO,MAAM,cAAc,wCAGf,IAAI,CAAC,qBAAqB,WAerC,CAAC;AAEF,eAAO,MAAM,sBAAsB,SAAU,MAAM,gBAAe,WAAW,KAAW,OA4BvF,CAAC;AAEF,eAAO,MAAM,2BAA2B,WAAY,MAAM,KAAG,MAI5D,CAAC;AAEF,eAAO,MAAM,qBAAqB,aAAc,MAAM,KAAG,MAGxD,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,MAAM,gBAAe,WAAW,KAAW,OA6B7E,CAAC;AAEF,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;CACjC;AAED,eAAO,MAAM,aAAa,WAAY,SAAS,KAAG,IAGjD,CAAC;AAEF,eAAO,MAAM,WAAW,eAAgB,MAAM,YAI7C,CAAC;AAEF,eAAO,MAAM,8BAA8B,cAE1C,CAAC;AAQF,eAAO,MAAM,2BAA2B,wBAAyB,MAAM,cAAc,MAAM,cAe1F,CAAC;AASF,eAAO,MAAM,+BAA+B,wBAAyB,MAAM,iBAAiB,MAAM,cAkBjG,CAAC"}
|
package/lib/esm/dateUtils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { addDays, isAfter, isValid, parseISO, startOfDay, startOfMonth, startOfWeek, startOfYear, subDays, } from 'date-fns';
|
|
2
|
+
import { format, formatInTimeZone, fromZonedTime } from 'date-fns-tz';
|
|
2
3
|
export const formatDate = (date, locale = 'en-us', format = { month: 'short', day: 'numeric', year: 'numeric' }) => {
|
|
3
4
|
if (!date) {
|
|
4
5
|
return '';
|
|
@@ -23,29 +24,87 @@ export const formatDateTime = (date, locale = 'en-us', format = {
|
|
|
23
24
|
}
|
|
24
25
|
return formatDate(date, locale, format);
|
|
25
26
|
};
|
|
26
|
-
export const
|
|
27
|
+
export const isCurrentDateAfterDate = (date, granularity = 'day') => {
|
|
28
|
+
const parsedDate = parseISO(date);
|
|
29
|
+
const now = new Date();
|
|
30
|
+
let comparisonDate;
|
|
31
|
+
let comparisonNow;
|
|
32
|
+
switch (granularity) {
|
|
33
|
+
case 'day':
|
|
34
|
+
comparisonDate = startOfDay(parsedDate);
|
|
35
|
+
comparisonNow = startOfDay(now);
|
|
36
|
+
break;
|
|
37
|
+
case 'week':
|
|
38
|
+
comparisonDate = startOfWeek(parsedDate);
|
|
39
|
+
comparisonNow = startOfWeek(now);
|
|
40
|
+
break;
|
|
41
|
+
case 'month':
|
|
42
|
+
comparisonDate = startOfMonth(parsedDate);
|
|
43
|
+
comparisonNow = startOfMonth(now);
|
|
44
|
+
break;
|
|
45
|
+
case 'year':
|
|
46
|
+
comparisonDate = startOfYear(parsedDate);
|
|
47
|
+
comparisonNow = startOfYear(now);
|
|
48
|
+
break;
|
|
49
|
+
default:
|
|
50
|
+
throw new Error('Invalid granularity');
|
|
51
|
+
}
|
|
52
|
+
return isAfter(comparisonNow, comparisonDate);
|
|
53
|
+
};
|
|
27
54
|
export const getTimezoneOffsetFromTZName = (tzName) => {
|
|
28
|
-
|
|
55
|
+
const date = new Date();
|
|
56
|
+
const zonedDate = fromZonedTime(date, tzName);
|
|
57
|
+
return format(zonedDate, 'xxx', { timeZone: tzName });
|
|
29
58
|
};
|
|
30
59
|
export const getPastUTCDateFromNow = (pastDays) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export const isCurrentDateSameAsOrBeforeDate = (date, granularity = 'day') => {
|
|
34
|
-
return moment(moment.now()).isSameOrBefore(date, granularity);
|
|
60
|
+
const date = subDays(new Date(), pastDays);
|
|
61
|
+
return formatInTimeZone(date, 'UTC', "yyyy-MM-dd'T'HH:mm:ss'Z'");
|
|
35
62
|
};
|
|
36
63
|
export const isFutureDate = (date, granularity = 'day') => {
|
|
37
|
-
|
|
64
|
+
const parsedDate = parseISO(date);
|
|
65
|
+
const now = new Date();
|
|
66
|
+
let comparisonDate;
|
|
67
|
+
let comparisonNow;
|
|
68
|
+
switch (granularity) {
|
|
69
|
+
case 'day':
|
|
70
|
+
comparisonDate = startOfDay(parsedDate);
|
|
71
|
+
comparisonNow = startOfDay(now);
|
|
72
|
+
break;
|
|
73
|
+
case 'week':
|
|
74
|
+
comparisonDate = startOfWeek(parsedDate);
|
|
75
|
+
comparisonNow = startOfWeek(now);
|
|
76
|
+
break;
|
|
77
|
+
case 'month':
|
|
78
|
+
comparisonDate = startOfMonth(parsedDate);
|
|
79
|
+
comparisonNow = startOfMonth(now);
|
|
80
|
+
break;
|
|
81
|
+
case 'year':
|
|
82
|
+
comparisonDate = startOfYear(parsedDate);
|
|
83
|
+
comparisonNow = startOfYear(now);
|
|
84
|
+
break;
|
|
85
|
+
default:
|
|
86
|
+
throw new Error('Invalid granularity');
|
|
87
|
+
}
|
|
88
|
+
return isAfter(comparisonDate, comparisonNow);
|
|
38
89
|
};
|
|
39
90
|
export const addDaysToDate = (params) => {
|
|
40
91
|
const { days, date = new Date() } = params;
|
|
41
|
-
return
|
|
92
|
+
return addDays(new Date(date), days);
|
|
93
|
+
};
|
|
94
|
+
export const isValidDate = (dateString) => {
|
|
95
|
+
const parsedDate = parseISO(dateString);
|
|
96
|
+
return isValid(parsedDate);
|
|
97
|
+
};
|
|
98
|
+
export const generateUniqueIdBasedOnNowDate = () => {
|
|
99
|
+
return Date.now().toString(36) + Math.random().toString(36).substring(2);
|
|
42
100
|
};
|
|
43
101
|
// split traffic based on time and weight
|
|
44
102
|
// for example, if testVariationWeight is 2 and the current time in seconds modulo 10 is less than 2,
|
|
45
103
|
// redirect to test version (20% of the time), else redirect to control version (80% of the time)
|
|
46
104
|
// @wieght: a number between 0 and 10
|
|
47
|
-
// @dateString: date string
|
|
48
|
-
|
|
105
|
+
// @dateString: date string - to get consistent variant for a user during experiece, pass a fix date
|
|
106
|
+
// for example in case craetion, we can pass sessionItem.session.createdDate as dateString
|
|
107
|
+
export const ABTestSplitSplitBasedOnDate = (testVariationWeight, dateString) => {
|
|
49
108
|
if (testVariationWeight === 10)
|
|
50
109
|
return 'A'; // test
|
|
51
110
|
if (testVariationWeight === 0 || !testVariationWeight || isNaN(testVariationWeight))
|
|
@@ -61,3 +120,29 @@ export const trafficSplit = (testVariationWeight, dateString) => {
|
|
|
61
120
|
return 'B';
|
|
62
121
|
}
|
|
63
122
|
};
|
|
123
|
+
/*
|
|
124
|
+
Generates a hash value for the given account number.
|
|
125
|
+
The hash is calculated by multiplying the ASCII value of each character
|
|
126
|
+
by its position in the string (1-based), and then returning the result modulo 100.
|
|
127
|
+
@param {string} accountNumber - The account number to hash.
|
|
128
|
+
@return {number} The hash value in the range 0-99.
|
|
129
|
+
*/
|
|
130
|
+
export const ABTestSplitBasedOnAccountNumber = (testVariationWeight, accountNumber) => {
|
|
131
|
+
if (testVariationWeight === 100)
|
|
132
|
+
return 'A'; // test
|
|
133
|
+
if (testVariationWeight === 0 || !testVariationWeight || isNaN(testVariationWeight) || !accountNumber)
|
|
134
|
+
return 'B'; // control
|
|
135
|
+
let hash = 0;
|
|
136
|
+
// Loop through each character in the account number
|
|
137
|
+
for (let i = 0; i < (accountNumber || '').length; i++) {
|
|
138
|
+
// Multiply the ASCII value of the character by its position (index + 1)
|
|
139
|
+
hash += accountNumber.charCodeAt(i) * (i + 1);
|
|
140
|
+
}
|
|
141
|
+
const moduloResult = hash % 100;
|
|
142
|
+
if (moduloResult < testVariationWeight) {
|
|
143
|
+
return 'A';
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
return 'B';
|
|
147
|
+
}
|
|
148
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IKeyValue, IOption, KeyOfExtractedType } from '@rh-support/types/shared';
|
|
2
|
-
|
|
2
|
+
type labelKeyFunction<O> = (item: O) => string;
|
|
3
3
|
export interface IToOptionsConfig<O> {
|
|
4
4
|
labelKey?: labelKeyFunction<O> | KeyOfExtractedType<O, IOption<O>['label']>;
|
|
5
5
|
additionalInfoKey?: KeyOfExtractedType<O, IOption<O>['additionalInfo']>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdownUtils.d.ts","sourceRoot":"","sources":["../../src/dropdownUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAIlF,
|
|
1
|
+
{"version":3,"file":"dropdownUtils.d.ts","sourceRoot":"","sources":["../../src/dropdownUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAIlF,KAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;AAC/C,MAAM,WAAW,gBAAgB,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC5E,iBAAiB,CAAC,EAAE,kBAAkB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACxE,WAAW,CAAC,EAAE,kBAAkB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5D,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAClC,WAAW,CAAC,EAAE,kBAAkB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5D,oBAAoB,CAAC,EAAE,kBAAkB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC5E,oBAAoB,CAAC,EAAE,kBAAkB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC5E,oBAAoB,CAAC,EAAE,kBAAkB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC5E,aAAa,CAAC,EAAE,kBAAkB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;CACnE;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,GAAE,gBAAgB,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CA+BlF;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,GAAE,gBAAgB,CAAC,CAAC,CAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAE7F;AAED,wBAAgB,yBAAyB,CACrC,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC,EAAE,EAC9C,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,MAAM,EACpB,iBAAiB,CAAC,EAAE,MAAM,GAC3B,MAAM,CAWR"}
|
package/lib/esm/eventUtils.d.ts
CHANGED
|
@@ -4,6 +4,18 @@ export interface IPendoTrackEventProperty {
|
|
|
4
4
|
}
|
|
5
5
|
declare function haltEvent(event: React.SyntheticEvent<{}>): void;
|
|
6
6
|
declare function pendoTrackEvent(name: any, properties?: IPendoTrackEventProperty): void;
|
|
7
|
-
declare function dtmTrackEvent(
|
|
8
|
-
|
|
7
|
+
declare function dtmTrackEvent(eventName: string, stepName: string, caseNumber?: string, product?: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* Gets the page name used in track events based off the current pathname.
|
|
10
|
+
* @param pathname the current pathname
|
|
11
|
+
* @returns the track event page name
|
|
12
|
+
*/
|
|
13
|
+
export declare function getPageName(pathname: string): string;
|
|
14
|
+
declare function dtmTrackEventCaseCreationStepEncountered(caseSection: boolean, stepName: string, caseNumber?: string, caseType?: string, caseTitle?: string, product?: string, version?: string): void;
|
|
15
|
+
export declare function dtmTrackEventCaseStepEncountered(stepName: 'close' | 'comment' | 'follow' | 'review', caseNumber?: string, product?: string, version?: string): void;
|
|
16
|
+
export declare function dtmTrackEventPageLoadStarted(pageName: string): void;
|
|
17
|
+
declare function dtmTrackEventRecommendationListingItemClicked(url: string, activityName: string, contentListingRegion: string, contentID: string, contentPosition: number, contentTitle: string, contentUrl: string, displayFeature: string, displayFeatureTitle: string): void;
|
|
18
|
+
declare function dtmTrackEventRecommendationListingDisplayed(contentListingRegion: any, activityName: any, listing: any, resultsCount: any): void;
|
|
19
|
+
export declare function dtmTrackEventUploadFileToAnalyze(caseSection: boolean, stepName: string, caseType?: string, caseTitle?: string, product?: string, version?: string): void;
|
|
20
|
+
export { haltEvent, pendoTrackEvent, dtmTrackEvent, dtmTrackEventCaseCreationStepEncountered, dtmTrackEventRecommendationListingItemClicked, dtmTrackEventRecommendationListingDisplayed, };
|
|
9
21
|
//# sourceMappingURL=eventUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,QAUhG;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpD;AAGD,iBAAS,wCAAwC,CAC7C,WAAW,EAAE,OAAO,EACpB,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,QAkBnB;AAGD,wBAAgB,gCAAgC,CAC5C,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,EACnD,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,QAcnB;AAGD,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,QAW5D;AAGD,iBAAS,6CAA6C,CAClD,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,oBAAoB,EAAE,MAAM,EAC5B,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,EACtB,mBAAmB,EAAE,MAAM,QA6B9B;AAGD,iBAAS,2CAA2C,CAAC,oBAAoB,KAAA,EAAE,YAAY,KAAA,EAAE,OAAO,KAAA,EAAE,YAAY,KAAA,QAW7G;AAGD,wBAAgB,gCAAgC,CAC5C,WAAW,EAAE,OAAO,EACpB,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,QAiBnB;AAED,OAAO,EACH,SAAS,EACT,eAAe,EACf,aAAa,EACb,wCAAwC,EACxC,6CAA6C,EAC7C,2CAA2C,GAC9C,CAAC"}
|
package/lib/esm/eventUtils.js
CHANGED
|
@@ -16,9 +16,105 @@ function pendoTrackEvent(name, properties = {}) {
|
|
|
16
16
|
pendo.track(name, properties);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
function dtmTrackEvent(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
function dtmTrackEvent(eventName, stepName, caseNumber, product) {
|
|
20
|
+
(window.appEventData || []).push({
|
|
21
|
+
event: eventName,
|
|
22
|
+
case: {
|
|
23
|
+
type: 'cp-support',
|
|
24
|
+
stepName, //submit, close, comment, follow, review, search, recommendation click
|
|
25
|
+
caseNumber,
|
|
26
|
+
caseProduct: product,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets the page name used in track events based off the current pathname.
|
|
32
|
+
* @param pathname the current pathname
|
|
33
|
+
* @returns the track event page name
|
|
34
|
+
*/
|
|
35
|
+
export function getPageName(pathname) {
|
|
36
|
+
return `cp|support|cases|${pathname.replace('#', '').split('/').filter(Boolean).join('|')}`;
|
|
37
|
+
}
|
|
38
|
+
// https://github.com/further-external/redhat-datalayer/blob/main/EDDL/global-datalayer.md#case-creation-step-encountered
|
|
39
|
+
function dtmTrackEventCaseCreationStepEncountered(caseSection, stepName, caseNumber, caseType, caseTitle, product, version) {
|
|
40
|
+
const event = 'Case Creation Step Encountered';
|
|
41
|
+
const caseObject = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ type: 'cp-support', caseSection: caseSection ? 'case' : 'troubleshoot', stepName }, (caseNumber && { caseNumber })), (version && { caseProductVersion: version })), (caseType && { caseType })), (caseTitle && { caseTitle })), (product && { caseProduct: product }));
|
|
42
|
+
(window.appEventData || []).push({
|
|
43
|
+
event,
|
|
44
|
+
case: caseObject,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
// https://github.com/further-external/redhat-datalayer/blob/main/EDDL/global-datalayer.md#Case-Step-Encountered
|
|
48
|
+
export function dtmTrackEventCaseStepEncountered(stepName, caseNumber, product, version) {
|
|
49
|
+
const event = 'Case Step Encountered';
|
|
50
|
+
const caseObject = Object.assign(Object.assign({ type: 'cp-support', stepName }, (caseNumber && { caseNumber })), (product && { caseProduct: `${product}|${version}` }));
|
|
51
|
+
(window.appEventData || []).push({
|
|
52
|
+
event,
|
|
53
|
+
case: caseObject,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// https://github.com/further-external/redhat-datalayer/blob/main/EDDL/global-datalayer.md#Page-Load-Started
|
|
57
|
+
export function dtmTrackEventPageLoadStarted(pageName) {
|
|
58
|
+
const event = 'Page Load Started';
|
|
59
|
+
const caseObject = {
|
|
60
|
+
type: 'cp-support',
|
|
61
|
+
pageName,
|
|
62
|
+
};
|
|
63
|
+
(window.appEventData || []).push({
|
|
64
|
+
event,
|
|
65
|
+
case: caseObject,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
// https://github.com/further-external/redhat-datalayer/blob/main/EDDL/global-datalayer.md#recommendation-listing-item-clicked
|
|
69
|
+
function dtmTrackEventRecommendationListingItemClicked(url, activityName, contentListingRegion, contentID, contentPosition, contentTitle, contentUrl, displayFeature, displayFeatureTitle) {
|
|
70
|
+
(window.appEventData || []).push({
|
|
71
|
+
event: 'Recommendation Listing Item Clicked',
|
|
72
|
+
linkInfo: {
|
|
73
|
+
href: url,
|
|
74
|
+
linkType: 'list',
|
|
75
|
+
linkTypeName: 'listing result click',
|
|
76
|
+
targetHost: 'access.redhat.com',
|
|
77
|
+
text: 'text',
|
|
78
|
+
},
|
|
79
|
+
listingItemClicked: {
|
|
80
|
+
activityName,
|
|
81
|
+
contentListingRegion,
|
|
82
|
+
listing: [
|
|
83
|
+
{
|
|
84
|
+
content: {
|
|
85
|
+
contentID,
|
|
86
|
+
contentPosition,
|
|
87
|
+
contentTitle,
|
|
88
|
+
contentUrl,
|
|
89
|
+
displayFeature,
|
|
90
|
+
displayFeatureTitle,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
listingType: 'Support Cases',
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
// https://github.com/further-external/redhat-datalayer/blob/main/EDDL/global-datalayer.md#recommendation-listing-displayed
|
|
99
|
+
function dtmTrackEventRecommendationListingDisplayed(contentListingRegion, activityName, listing, resultsCount) {
|
|
100
|
+
(window.appEventData || []).push({
|
|
101
|
+
event: 'Recommendation Listing Displayed',
|
|
102
|
+
listingDisplayed: {
|
|
103
|
+
activityName,
|
|
104
|
+
contentListingRegion,
|
|
105
|
+
listing,
|
|
106
|
+
listingType: 'content',
|
|
107
|
+
resultsCount,
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
// https://github.com/further-external/redhat-datalayer/blob/main/EDDL/global-datalayer.md#Upload-File-to-Analyze
|
|
112
|
+
export function dtmTrackEventUploadFileToAnalyze(caseSection, stepName, caseType, caseTitle, product, version) {
|
|
113
|
+
const eventName = 'Upload File to Analyze';
|
|
114
|
+
const caseObject = Object.assign(Object.assign(Object.assign(Object.assign({ type: 'cp-support', caseSection: caseSection ? 'case' : 'troubleshoot', stepName }, (product && { caseProduct: product })), (version && { caseProductVersion: version })), (caseType && { caseType })), (caseTitle && { caseTitle }));
|
|
115
|
+
(window.appEventData || []).push({
|
|
116
|
+
event: eventName,
|
|
117
|
+
case: caseObject,
|
|
118
|
+
});
|
|
23
119
|
}
|
|
24
|
-
export { haltEvent, pendoTrackEvent, dtmTrackEvent };
|
|
120
|
+
export { haltEvent, pendoTrackEvent, dtmTrackEvent, dtmTrackEventCaseCreationStepEncountered, dtmTrackEventRecommendationListingItemClicked, dtmTrackEventRecommendationListingDisplayed, };
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,cAqBf,CAAC;AAEF,QAAA,MAAM,4BAA4B,eAAgB,MAAM,WAGvD,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,4BAA4B,EAAE,CAAC"}
|
|
@@ -3,7 +3,7 @@ export declare enum PCM_CONFIG_FIELD_TYPE {
|
|
|
3
3
|
JSON = "JSON",
|
|
4
4
|
JSON_ARRAY = "JSON-ARRAY",
|
|
5
5
|
JSON_HASHMAP = "JSON-HASHMAP",
|
|
6
|
-
FEATURE_FLAG = "FEATURE-FLAG"
|
|
6
|
+
FEATURE_FLAG = "FEATURE-FLAG",// to handle values like 0 and 1
|
|
7
7
|
STRING_COMMA_SEPERATED = "STRING-COMMA-SEPERATED",
|
|
8
8
|
STRING = "STRING",
|
|
9
9
|
NUMBER = "NUMBER"
|
|
@@ -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;
|
|
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,CAAE,gCAAgC;IAC/D,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"}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export * from './dropdownUtils';
|
|
|
9
9
|
export * from './eventUtils';
|
|
10
10
|
export * from './hostNameUtils';
|
|
11
11
|
export * from './hydraConfigUtils';
|
|
12
|
-
export * from './insightRuleInfoUtils';
|
|
13
12
|
export * from './lruCacheUtils';
|
|
14
13
|
export * from './productsUtils';
|
|
15
14
|
export * from './promiseUtils';
|
|
@@ -19,7 +18,6 @@ export * from './searchApiUtils';
|
|
|
19
18
|
export * from './scrollUtils';
|
|
20
19
|
export * from './urlUtils';
|
|
21
20
|
export * from './validatorUtils';
|
|
22
|
-
export * from './customElementUtils';
|
|
23
21
|
export * from './userUtils';
|
|
24
22
|
export * from './styleUtils';
|
|
25
23
|
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,
|
|
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,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
|
@@ -9,7 +9,6 @@ export * from './dropdownUtils';
|
|
|
9
9
|
export * from './eventUtils';
|
|
10
10
|
export * from './hostNameUtils';
|
|
11
11
|
export * from './hydraConfigUtils';
|
|
12
|
-
export * from './insightRuleInfoUtils';
|
|
13
12
|
export * from './lruCacheUtils';
|
|
14
13
|
export * from './productsUtils';
|
|
15
14
|
export * from './promiseUtils';
|
|
@@ -19,7 +18,6 @@ export * from './searchApiUtils';
|
|
|
19
18
|
export * from './scrollUtils';
|
|
20
19
|
export * from './urlUtils';
|
|
21
20
|
export * from './validatorUtils';
|
|
22
|
-
export * from './customElementUtils';
|
|
23
21
|
export * from './userUtils';
|
|
24
22
|
export * from './styleUtils';
|
|
25
23
|
export * from './translation-helper';
|
package/lib/esm/outlier.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outlier.d.ts","sourceRoot":"","sources":["../../src/outlier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,OAAO,UAAW,
|
|
1
|
+
{"version":3,"file":"outlier.d.ts","sourceRoot":"","sources":["../../src/outlier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,OAAO,UAAW,KAAK,CAAC,MAAM,CAAC,KAAG,KAAK,CAAC,MAAM,CAkC1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promiseUtils.d.ts","sourceRoot":"","sources":["../../src/promiseUtils.ts"],"names":[],"mappings":"AAAA,UAAU,kBAAkB,CAAC,CAAC;IAC1B,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,MAAM,EAAE,WAAW,GAAG,UAAU,CAAC;IACjC,CAAC,CAAC,EAAE,KAAK,CAAC;CACb;AAGD,QAAA,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"promiseUtils.d.ts","sourceRoot":"","sources":["../../src/promiseUtils.ts"],"names":[],"mappings":"AAAA,UAAU,kBAAkB,CAAC,CAAC;IAC1B,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,MAAM,EAAE,WAAW,GAAG,UAAU,CAAC;IACjC,CAAC,CAAC,EAAE,KAAK,CAAC;CACb;AAGD,QAAA,MAAM,iBAAiB,GAAU,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAOhF,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -4,7 +4,7 @@ export function getRecommendationTitle(doc) {
|
|
|
4
4
|
return !isEmpty(doc.publishedTitle) ? doc.publishedTitle : doc.allTitle;
|
|
5
5
|
}
|
|
6
6
|
export function getRecommendationAbstract(doc) {
|
|
7
|
-
return !isEmpty(doc.publishedAbstract) ? doc.publishedAbstract : doc.abstract;
|
|
7
|
+
return !isEmpty(doc.snippet) ? doc.snippet : !isEmpty(doc.publishedAbstract) ? doc.publishedAbstract : doc.abstract;
|
|
8
8
|
}
|
|
9
9
|
export function computeRecommendationTitle(doc) {
|
|
10
10
|
const title = getRecommendationTitle(doc);
|
|
@@ -18,7 +18,7 @@ export const computeRecommendationAbstract = (doc, truncateLen = 128) => {
|
|
|
18
18
|
export function replaceHighlightingData(docs, highlighting) {
|
|
19
19
|
return docs.map((doc) => {
|
|
20
20
|
// highlight id is either uri or view_uri
|
|
21
|
-
// when we are uploading a file before adding
|
|
21
|
+
// when we are uploading a file before adding "Problem statement" no highlighting doc is present hence passing an empty object
|
|
22
22
|
const highlightObj = highlighting
|
|
23
23
|
? highlighting[doc.resource_uri] || highlighting[doc.uri] || highlighting[doc.view_uri] || {}
|
|
24
24
|
: {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ISearchSolrQuery } from '@cee-eng/hydrajs/@types/api/search';
|
|
2
2
|
import { ISolrRecommendation } from '@cee-eng/hydrajs/@types/models/solr/solr';
|
|
3
|
-
export declare const documentKindToInclude = "documentKind:(\"Solution\" OR \"
|
|
3
|
+
export declare const documentKindToInclude = "documentKind:(\"Solution\" OR \"Article\" OR \"Errata\" OR \"Vulnerability\" OR \"Cve\" OR \"LabInfo\")";
|
|
4
4
|
export declare const issuesDefaultParamsObj: ISearchSolrQuery;
|
|
5
|
-
export
|
|
5
|
+
export type IRecommendationAdditionalFilters = {
|
|
6
6
|
[key in keyof ISolrRecommendation]?: string[] | {
|
|
7
7
|
values: string[];
|
|
8
8
|
exclude: true;
|
|
@@ -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,
|
|
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,4GAC+D,CAAC;AAElG,eAAO,MAAM,sBAAsB,EAAE,gBAapC,CAAC;AAMF,MAAM,MAAM,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"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import cloneDeep from 'lodash/cloneDeep';
|
|
2
|
-
export const documentKindToInclude = 'documentKind:("Solution" OR "
|
|
2
|
+
export const documentKindToInclude = 'documentKind:("Solution" OR "Article" OR "Errata" OR "Vulnerability" OR "Cve" OR "LabInfo")';
|
|
3
3
|
export const issuesDefaultParamsObj = {
|
|
4
4
|
q: '*:*',
|
|
5
|
-
fq: [documentKindToInclude, '-internalTags:helper_solution'
|
|
5
|
+
fq: [documentKindToInclude, '-internalTags:helper_solution'],
|
|
6
6
|
start: 0,
|
|
7
7
|
rows: 10,
|
|
8
|
-
fl: 'id, allTitle, publishedTitle, view_uri, resource_uri, uri, issue, lastModifiedDate, kcsState, kcsRateUp, kcsRateDown, documentKind, publishedAbstract, abstract, authorSSOName, tag',
|
|
8
|
+
fl: 'id, allTitle, publishedTitle, view_uri, resource_uri, uri, issue, lastModifiedDate, kcsState, kcsRateUp, kcsRateDown, documentKind, publishedAbstract, abstract, authorSSOName, tag, snippet, cve_threatSeverity',
|
|
9
9
|
seQueryFields: false,
|
|
10
10
|
hl: true,
|
|
11
11
|
'hl.fl': 'abstract, publishedAbstract, issue',
|
package/lib/esm/solrUtils.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare function solr(init?: ISolrQP): {
|
|
|
32
32
|
beginOr: () => any;
|
|
33
33
|
endOr: () => any;
|
|
34
34
|
};
|
|
35
|
-
export
|
|
35
|
+
export type ISolrResponseToFacetFields<T> = {
|
|
36
36
|
[key in keyof T]?: IFacetResponse[];
|
|
37
37
|
};
|
|
38
38
|
/**
|
|
@@ -41,8 +41,8 @@ export declare type ISolrResponseToFacetFields<T> = {
|
|
|
41
41
|
* Accepts solrResponse and then return the facet values in an object map
|
|
42
42
|
* with key being the facet key and value being of type IFacetResponse
|
|
43
43
|
*/
|
|
44
|
-
export declare function solrResponseToFacetFields<T, U>(solrResponse: T): ISolrResponseToFacetFields<U>;
|
|
45
|
-
export
|
|
44
|
+
export declare function solrResponseToFacetFields<T, U extends object>(solrResponse: T): ISolrResponseToFacetFields<U>;
|
|
45
|
+
export type ISolrResponseToPivotFields<T, U> = {
|
|
46
46
|
[key in keyof T]?: U[];
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
@@ -52,7 +52,7 @@ export declare type ISolrResponseToPivotFields<T, U> = {
|
|
|
52
52
|
* with key being the pivot key(ex: 'case_product,case_version') and
|
|
53
53
|
* value being of type IFacetResponse and also next pivot as the key and its value again of type IFacetResponse.
|
|
54
54
|
*/
|
|
55
|
-
export declare function solrResponseToPivotFields<T, U, V>(solrResponse: T): ISolrResponseToPivotFields<U, V>;
|
|
55
|
+
export declare function solrResponseToPivotFields<T, U extends object, V>(solrResponse: T): ISolrResponseToPivotFields<U, V>;
|
|
56
56
|
/**
|
|
57
57
|
*
|
|
58
58
|
* @param fieldValueMap
|