@rh-support/components 2.5.207 → 2.5.209
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/esm/RichTextEditor/RichTextEditor.d.ts.map +1 -1
- package/lib/esm/RichTextEditor/RichTextEditor.js +1 -1
- package/lib/esm/helperFunctions/errorMessage.d.ts +2 -1
- package/lib/esm/helperFunctions/errorMessage.d.ts.map +1 -1
- package/lib/esm/helperFunctions/errorMessage.js +19 -5
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditor.d.ts","sourceRoot":"","sources":["../../../src/RichTextEditor/RichTextEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA+B9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAmD,MAAM,OAAO,CAAC;AAMxE,MAAM,WAAW,oBAAoB;IACjC,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,kCAAkC;IAClC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gDAAgD;IAChD,mBAAmB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,oBAAo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kB,CAAC,EAAE,MAAM,CAAC;IAC5B,gDAAgD;IAChD,mBAAmB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,gEAAgE;IAChE,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,KAAK,IAAI,CAAC;IACrC,uBAAuB;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACnD;AAQD,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC,qBA2uBnE;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -428,7 +428,7 @@ export function RichTextEditor(props) {
|
|
|
428
428
|
React.createElement("div", { className: "btn-group-separator" }),
|
|
429
429
|
React.createElement(Button, { icon: React.createElement(LinkIcon, null), variant: ButtonVariant.plain, isClicked: !!activeFormat.link, isDisabled: disabled, onClick: onLinkClick, "aria-label": "Link", "aria-pressed": !!activeFormat.link, className: "richtext-toolbar-btn" }),
|
|
430
430
|
React.createElement(Button, { icon: React.createElement(RemoveFormatIcon, null), variant: ButtonVariant.plain, isDisabled: disabled, onClick: onRemoveFormatClick, "aria-label": "Remove Format", className: "richtext-toolbar-btn" })))),
|
|
431
|
-
React.createElement("div", { ref: editorRef, className: "richtext-editor-content", style: editorStyle, "aria-label": ariaLabel, tabIndex: -1, onClick: () => { var _a, _b; return (_b = (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('[contenteditable="true"]')) === null || _b === void 0 ? void 0 : _b.focus(); }, onKeyDown: (e) => {
|
|
431
|
+
React.createElement("div", { ref: editorRef, role: "textbox", className: "richtext-editor-content", style: editorStyle, "aria-label": ariaLabel, tabIndex: -1, onClick: () => { var _a, _b; return (_b = (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('[contenteditable="true"]')) === null || _b === void 0 ? void 0 : _b.focus(); }, onKeyDown: (e) => {
|
|
432
432
|
var _a, _b;
|
|
433
433
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
434
434
|
(_b = (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('[contenteditable="true"]')) === null || _b === void 0 ? void 0 : _b.focus();
|
|
@@ -6,7 +6,8 @@ export interface IAppErrorObj {
|
|
|
6
6
|
export interface IAppError {
|
|
7
7
|
[key: string]: Partial<IAppErrorObj>;
|
|
8
8
|
}
|
|
9
|
+
declare function getDirectErrorMessage(error: any): string;
|
|
9
10
|
declare function formattedApiErrorMessage(error: any, customMessage?: IAppError, canManageCase?: boolean): string | JSX.Element;
|
|
10
11
|
declare function errorMessageTitle(error: any, customError?: IAppError, canManageCase?: boolean): string;
|
|
11
|
-
export { formattedApiErrorMessage, errorMessageTitle };
|
|
12
|
+
export { formattedApiErrorMessage, errorMessageTitle, getDirectErrorMessage };
|
|
12
13
|
//# sourceMappingURL=errorMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorMessage.d.ts","sourceRoot":"","sources":["../../../src/helperFunctions/errorMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"errorMessage.d.ts","sourceRoot":"","sources":["../../../src/helperFunctions/errorMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAQ7B,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,SAAS;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACxC;AAmED,iBAAS,qBAAqB,CAAC,KAAK,KAAA,GAAG,MAAM,CAI5C;AAGD,iBAAS,wBAAwB,CAAC,KAAK,KAAA,EAAE,aAAa,CAAC,EAAE,SAAS,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,GAAG,CAAC,OAAO,CAmDjH;AAED,iBAAS,iBAAiB,CAAC,KAAK,KAAA,EAAE,WAAW,CAAC,EAAE,SAAS,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAa1F;AAED,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import './errorMessage.scss';
|
|
2
2
|
import { Button } from '@patternfly/react-core';
|
|
3
3
|
import ExternalLinkAltIcon from '@patternfly/react-icons/dist/js/icons/external-link-alt-icon';
|
|
4
|
-
import isEmpty from 'lodash/isEmpty';
|
|
5
4
|
import React from 'react';
|
|
6
5
|
import { SupportFeedbackForm } from '../SupportFeedbackForm';
|
|
7
6
|
const defaultTitle = "Sorry, we're experiencing an error";
|
|
@@ -43,6 +42,15 @@ const defaultErrorObj = {
|
|
|
43
42
|
" for assistance.")),
|
|
44
43
|
},
|
|
45
44
|
};
|
|
45
|
+
function getApiErrorMessage(error) {
|
|
46
|
+
return [error === null || error === void 0 ? void 0 : error.message, error === null || error === void 0 ? void 0 : error.detailMessage].filter(Boolean).join(' ').trim();
|
|
47
|
+
}
|
|
48
|
+
// TODO: helper to pass API or status message directly in error popup
|
|
49
|
+
function getDirectErrorMessage(error) {
|
|
50
|
+
const apiMessage = getApiErrorMessage(error);
|
|
51
|
+
const message = (error === null || error === void 0 ? void 0 : error.statusText) || (error === null || error === void 0 ? void 0 : error.responseText) || '';
|
|
52
|
+
return apiMessage || message;
|
|
53
|
+
}
|
|
46
54
|
// the error argument need a better typing here. We want to make sure that user is passing an error object and not an error string
|
|
47
55
|
function formattedApiErrorMessage(error, customMessage, canManageCase) {
|
|
48
56
|
var _a, _b, _c;
|
|
@@ -84,9 +92,15 @@ function formattedApiErrorMessage(error, customMessage, canManageCase) {
|
|
|
84
92
|
}
|
|
85
93
|
// api call error
|
|
86
94
|
const message = (error === null || error === void 0 ? void 0 : error.statusText) || (error === null || error === void 0 ? void 0 : error.responseText) || '';
|
|
87
|
-
// error.message
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
// TODO: original logic — showed default when error.message existed
|
|
96
|
+
// // error.message -> javascript error
|
|
97
|
+
// const isNotProperUXError = isEmpty(message) || message?.length > 200 || error?.message || error?.detailMessage;
|
|
98
|
+
// return isNotProperUXError ? defaultErrorMessage : message;
|
|
99
|
+
const apiMessage = getApiErrorMessage(error);
|
|
100
|
+
if (apiMessage || message) {
|
|
101
|
+
return apiMessage || message;
|
|
102
|
+
}
|
|
103
|
+
return defaultErrorMessage;
|
|
90
104
|
}
|
|
91
105
|
}
|
|
92
106
|
function errorMessageTitle(error, customError, canManageCase) {
|
|
@@ -102,4 +116,4 @@ function errorMessageTitle(error, customError, canManageCase) {
|
|
|
102
116
|
}
|
|
103
117
|
return defaultTitle;
|
|
104
118
|
}
|
|
105
|
-
export { formattedApiErrorMessage, errorMessageTitle };
|
|
119
|
+
export { formattedApiErrorMessage, errorMessageTitle, getDirectErrorMessage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/components",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.209",
|
|
4
4
|
"description": "Contains all reusabel components for support app",
|
|
5
5
|
"author": "Vikas Rathee <vrathee@redhat.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"@patternfly/react-icons": "6.2.1",
|
|
63
63
|
"@patternfly/react-table": "6.2.1",
|
|
64
64
|
"@rh-support/types": "2.0.26",
|
|
65
|
-
"@rh-support/user-permissions": "2.5.
|
|
66
|
-
"@rh-support/utils": "2.5.
|
|
65
|
+
"@rh-support/user-permissions": "2.5.156",
|
|
66
|
+
"@rh-support/utils": "2.5.137",
|
|
67
67
|
"dompurify": "^2.2.6",
|
|
68
68
|
"js-worker-search": "^1.4.1",
|
|
69
69
|
"lazysizes": "^5.3.2",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"defaults and supports es6-module",
|
|
104
104
|
"maintained node versions"
|
|
105
105
|
],
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "56082a7ae9e90099d5504236da82ee1d2688048c"
|
|
107
107
|
}
|