@rh-support/components 2.5.57 → 2.5.59
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/SupportFeedbackForm/SupportFeedbackForm.d.ts +1 -0
- package/lib/esm/SupportFeedbackForm/SupportFeedbackForm.d.ts.map +1 -1
- package/lib/esm/SupportFeedbackForm/SupportFeedbackForm.js +2 -1
- package/lib/esm/SupportFeedbackForm/SupportFeedbackModal.d.ts.map +1 -1
- package/lib/esm/SupportFeedbackForm/SupportFeedbackModal.js +30 -15
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportFeedbackForm.d.ts","sourceRoot":"","sources":["../../../src/SupportFeedbackForm/SupportFeedbackForm.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,UAAU,MAAM;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SupportFeedbackForm.d.ts","sourceRoot":"","sources":["../../../src/SupportFeedbackForm/SupportFeedbackForm.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,UAAU,MAAM;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAQD,iBAAS,mBAAmB,CAAC,KAAK,EAAE,MAAM,qBA2BzC;kBA3BQ,mBAAmB;;;AA8B5B,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -8,6 +8,7 @@ const defaultProps = {
|
|
|
8
8
|
isInline: false,
|
|
9
9
|
};
|
|
10
10
|
function SupportFeedbackForm(props) {
|
|
11
|
+
var _a;
|
|
11
12
|
const [isModalOpen, toggleModal] = useState(false);
|
|
12
13
|
// Function for Toggling the Modal when Provide feedback button is clicked
|
|
13
14
|
const handleModalToggle = () => {
|
|
@@ -16,7 +17,7 @@ function SupportFeedbackForm(props) {
|
|
|
16
17
|
return (React.createElement(React.Fragment, null,
|
|
17
18
|
React.createElement(Button, { key: "confirm", onClick: handleModalToggle, className: `${props.additionalBtnClass}`, "data-tracking-id": "app-feedback-trigger", variant: "link", isInline: props.isInline ? true : null },
|
|
18
19
|
React.createElement(Trans, null, props.isInline ? props.buttonLabel.toLowerCase() : props.buttonLabel)),
|
|
19
|
-
React.createElement(SupportFeedbackModal, { isModalOpen: isModalOpen, onClose: handleModalToggle })));
|
|
20
|
+
React.createElement(SupportFeedbackModal, { isModalOpen: isModalOpen, onClose: handleModalToggle, isCaseSummary: (_a = props.isCaseSummary) !== null && _a !== void 0 ? _a : false })));
|
|
20
21
|
}
|
|
21
22
|
SupportFeedbackForm.defaultProps = defaultProps;
|
|
22
23
|
export { SupportFeedbackForm };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportFeedbackModal.d.ts","sourceRoot":"","sources":["../../../src/SupportFeedbackForm/SupportFeedbackModal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SupportFeedbackModal.d.ts","sourceRoot":"","sources":["../../../src/SupportFeedbackForm/SupportFeedbackModal.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAanD,UAAU,MAAM;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAMD,iBAAS,oBAAoB,CAAC,KAAK,EAAE,MAAM,qBAsR1C;kBAtRQ,oBAAoB;;;AAyR7B,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -18,7 +18,7 @@ import { getUrlParsedParams } from '@rh-support/utils';
|
|
|
18
18
|
import isEmpty from 'lodash/isEmpty';
|
|
19
19
|
import React, { useEffect, useState } from 'react';
|
|
20
20
|
import { Trans, useTranslation } from 'react-i18next';
|
|
21
|
-
import { useLocation } from 'react-router-dom';
|
|
21
|
+
import { useLocation, useParams } from 'react-router-dom';
|
|
22
22
|
import { useFetch } from '../hooks/useFetch';
|
|
23
23
|
import { TextAreaAutosize } from '../TextAreaAutosize';
|
|
24
24
|
import { ToastNotification } from '../ToastNotification';
|
|
@@ -33,12 +33,19 @@ function SupportFeedbackModal(props) {
|
|
|
33
33
|
var _a, _b;
|
|
34
34
|
const { t } = useTranslation();
|
|
35
35
|
const seSessionId = (_b = (_a = getUrlParsedParams(useLocation().search)) === null || _a === void 0 ? void 0 : _a.seSessionId) !== null && _b !== void 0 ? _b : '';
|
|
36
|
+
const { caseNumber } = useParams();
|
|
36
37
|
const formInitState = {
|
|
37
38
|
levelOfSatisfied: null,
|
|
38
39
|
moreInfo: '',
|
|
39
40
|
};
|
|
40
41
|
const [values, setValues] = useState(formInitState);
|
|
41
|
-
const { request, isFetching } = useFetch(pcm.
|
|
42
|
+
const { request: requestAISummary, isFetching: isFetchingAISummary } = useFetch(pcm.AISummaryFeedback, {
|
|
43
|
+
propgateErrors: true,
|
|
44
|
+
});
|
|
45
|
+
const { request: requestFeedbackForm, isFetching: isFetchingFeedback } = useFetch(pcm.sendFeedbackForm, {
|
|
46
|
+
propgateErrors: true,
|
|
47
|
+
});
|
|
48
|
+
const isFetching = isFetchingAISummary || isFetchingFeedback;
|
|
42
49
|
const [isSubmitDisabled, setIsSubmitDisabled] = useState(false);
|
|
43
50
|
const [isSubmitButtonValid, setSubmitButtonValid] = useState(true);
|
|
44
51
|
useEffect(() => {
|
|
@@ -73,20 +80,28 @@ function SupportFeedbackModal(props) {
|
|
|
73
80
|
event.preventDefault();
|
|
74
81
|
if (!isSubmitButtonValid) {
|
|
75
82
|
let updatedValues = Object.assign({}, values);
|
|
76
|
-
if (props.isCaseSummary) {
|
|
77
|
-
const extraInfo = [
|
|
78
|
-
props.errorMessage && `caseSummaryErrorMessage:'${props.errorMessage}'\n`,
|
|
79
|
-
props.caseSummaryId && `caseSummaryId:'${props.caseSummaryId}'\n`,
|
|
80
|
-
];
|
|
81
|
-
updatedValues = Object.assign(Object.assign({}, updatedValues), { moreInfo: `${extraInfo}${updatedValues.moreInfo || ''}`.trim() });
|
|
82
|
-
delete updatedValues.caseSummaryErrorMessage;
|
|
83
|
-
delete updatedValues.caseSummaryId;
|
|
84
|
-
}
|
|
85
83
|
try {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
if (props.isCaseSummary) {
|
|
85
|
+
const aiPayload = {
|
|
86
|
+
caseNumber: caseNumber || '',
|
|
87
|
+
feedback: values.levelOfSatisfied || '',
|
|
88
|
+
description: values.moreInfo || '',
|
|
89
|
+
};
|
|
90
|
+
yield requestAISummary(aiPayload, window.sessionjs);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
const extraInfo = [
|
|
94
|
+
props.errorMessage && `caseSummaryErrorMessage:'${props.errorMessage}'\n`,
|
|
95
|
+
props.caseSummaryId && `caseSummaryId:'${props.caseSummaryId}'\n`,
|
|
96
|
+
];
|
|
97
|
+
updatedValues = Object.assign(Object.assign({}, updatedValues), { moreInfo: `${extraInfo.filter(Boolean).join('')}${updatedValues.moreInfo || ''}`.trim() });
|
|
98
|
+
delete updatedValues.caseSummaryErrorMessage;
|
|
99
|
+
delete updatedValues.caseSummaryId;
|
|
100
|
+
const emojiRegex = /(\p{Emoji_Presentation}|\p{Emoji}\uFE0F|\p{Extended_Pictographic})+/gu;
|
|
101
|
+
updatedValues.moreInfo = (_a = updatedValues.moreInfo) === null || _a === void 0 ? void 0 : _a.replace(emojiRegex, (match) => encodeURIComponent(match));
|
|
102
|
+
// Call the request with the updated values
|
|
103
|
+
yield requestFeedbackForm(updatedValues, window.sessionjs, window.location.href, seSessionId);
|
|
104
|
+
}
|
|
90
105
|
setValues(formInitState); // Reset form state after successful submission
|
|
91
106
|
ToastNotification.addSuccessMessage(t(`Thank you. We've received your feedback.`), t('Have a great day!'));
|
|
92
107
|
handleModalToggle();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/components",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.59",
|
|
4
4
|
"description": "Contains all reusabel components for support app",
|
|
5
5
|
"author": "Vikas Rathee <vrathee@redhat.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"prepublishOnly": "npm run build"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@cee-eng/hydrajs": "4.18.
|
|
47
|
+
"@cee-eng/hydrajs": "4.18.95",
|
|
48
48
|
"@cee-eng/ui-toolkit": "1.1.8",
|
|
49
49
|
"@patternfly/patternfly": "6.2.1",
|
|
50
50
|
"@patternfly/react-core": "6.2.1",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"use-deep-compare-effect": "^1.6.1"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@cee-eng/hydrajs": "4.18.
|
|
63
|
+
"@cee-eng/hydrajs": "4.18.95",
|
|
64
64
|
"@cee-eng/ui-toolkit": "1.1.8",
|
|
65
65
|
"@patternfly/patternfly": "6.2.1",
|
|
66
66
|
"@patternfly/react-core": "6.2.1",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"@patternfly/react-table": "6.2.1",
|
|
69
69
|
"@patternfly/react-tokens": "6.2.1",
|
|
70
70
|
"@rh-support/types": "2.0.5",
|
|
71
|
-
"@rh-support/user-permissions": "2.5.
|
|
72
|
-
"@rh-support/utils": "2.5.
|
|
71
|
+
"@rh-support/user-permissions": "2.5.29",
|
|
72
|
+
"@rh-support/utils": "2.5.26",
|
|
73
73
|
"dompurify": "^2.2.6",
|
|
74
74
|
"js-worker-search": "^1.4.1",
|
|
75
75
|
"lazysizes": "^5.3.2",
|
|
@@ -106,5 +106,5 @@
|
|
|
106
106
|
"defaults and supports es6-module",
|
|
107
107
|
"maintained node versions"
|
|
108
108
|
],
|
|
109
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "b81e0a7e6b9eee98294710206413297e15668c42"
|
|
110
110
|
}
|