@rh-support/troubleshoot 2.6.330 → 2.6.331
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/components/CaseEditView/CaseSolutions/CaseSolutions.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutions.js +131 -83
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutionsItem.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutionsItem.js +3 -3
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/ProductVersion.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/ProductVersion.js +2 -4
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.d.ts +0 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.js +14 -27
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.js +4 -18
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts +1 -3
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.js +9 -5
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts +0 -3
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.js +37 -92
- package/lib/esm/components/CaseManagement/CaseLabelsCreate.d.ts +4 -0
- package/lib/esm/components/CaseManagement/CaseLabelsCreate.d.ts.map +1 -0
- package/lib/esm/components/CaseManagement/CaseLabelsCreate.js +108 -0
- package/lib/esm/components/CaseManagement/CaseManagement.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/CaseManagement.js +4 -0
- package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.js +1 -1
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.js +35 -42
- package/lib/esm/css/case.css +41 -3
- package/lib/esm/hooks/useCaseComments/useCreateCaseComment.d.ts.map +1 -1
- package/lib/esm/hooks/useCaseComments/useCreateCaseComment.js +2 -1
- package/lib/esm/models/cache.d.ts +0 -2
- package/lib/esm/models/cache.d.ts.map +1 -1
- package/lib/esm/reducers/CaseConstNTypes.d.ts +2 -0
- package/lib/esm/reducers/CaseConstNTypes.d.ts.map +1 -1
- package/lib/esm/reducers/CaseConstNTypes.js +1 -0
- package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts +0 -4
- package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts.map +1 -1
- package/lib/esm/reducers/CaseDiscussionTabReducer.js +0 -11
- package/lib/esm/reducers/CaseReducer.d.ts +7 -1
- package/lib/esm/reducers/CaseReducer.d.ts.map +1 -1
- package/lib/esm/reducers/CaseReducer.js +37 -7
- package/package.json +6 -6
|
@@ -7,11 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { useApolloClient } from '@apollo/client/react';
|
|
11
|
+
import { Button, ButtonVariant, Checkbox } from '@patternfly/react-core';
|
|
11
12
|
import PlusIcon from '@patternfly/react-icons/dist/js/icons/plus-icon';
|
|
12
|
-
import {
|
|
13
|
+
import { LoadingIndicator, RichTextEditor, ToastNotification, usePrevious } from '@rh-support/components';
|
|
13
14
|
import { GlobalMetadataStateContext, useCanEditCase, useUserPreferences } from '@rh-support/react-context';
|
|
14
15
|
import { ability, CaseDiscussionFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
16
|
+
import { getHydraAttachmentImageUrl } from '@rh-support/utils';
|
|
15
17
|
import isEmpty from 'lodash/isEmpty';
|
|
16
18
|
import isEqual from 'lodash/isEqual';
|
|
17
19
|
import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
@@ -19,6 +21,7 @@ import { useDropzone } from 'react-dropzone';
|
|
|
19
21
|
import { Trans, useTranslation } from 'react-i18next';
|
|
20
22
|
import { useCaseDispatch, useCaseSelector } from '../../../../context/CaseContext';
|
|
21
23
|
import { useCreateCaseComment } from '../../../../hooks/useCaseComments';
|
|
24
|
+
import { useS3Upload } from '../../../../hooks/useS3Upload';
|
|
22
25
|
import { checkForCaseStatusToggleOnAttachOrComment } from '../../../../reducers/CaseReducer';
|
|
23
26
|
import { AttachmentDispatchContext, AttachmentStateContext, hasAbortedOrFailedAttachments, hasQueuedAttachmentUploads, hasSomeSelectedFiles, isUploadingAttachment, resetAttachment, } from '../../../shared/fileUpload';
|
|
24
27
|
import FileSelectorButton from '../../../shared/fileUpload/fileSelectors/FileSelectorButton';
|
|
@@ -29,7 +32,7 @@ import { useCommentDrafts } from './PostComment/useCommentDrafts';
|
|
|
29
32
|
import { useMarkdownFileUploader } from './PostComment/useMarkdownFileUploader';
|
|
30
33
|
import { VerifyCaseStatusModal } from './VerifyCaseStatusModal/VerifyCaseStatusModal';
|
|
31
34
|
export function PostComment(props) {
|
|
32
|
-
var _a, _b;
|
|
35
|
+
var _a, _b, _c, _d, _e, _f;
|
|
33
36
|
const { t } = useTranslation();
|
|
34
37
|
let { caseNumber } = props;
|
|
35
38
|
const [isTextAreaFocused, setIsTextAreaFocused] = useState(false);
|
|
@@ -43,15 +46,15 @@ export function PostComment(props) {
|
|
|
43
46
|
const hasAbortedOrFailed = hasAbortedOrFailedAttachments(attachmentState.caseFiles.selectedLocalFiles);
|
|
44
47
|
const hasSomeSelectedFilesLocal = hasSomeSelectedFiles(attachmentState.caseFiles.selectedLocalFiles);
|
|
45
48
|
const [isPublic, setIsPublic] = useState(props.defaultIsPublic === null ? true : props.defaultIsPublic);
|
|
46
|
-
const [commentType, setCommentType] = useState(EditorMode.PLAIN);
|
|
47
49
|
const [commentSignature, setCommentSignature] = useState('');
|
|
48
|
-
const [commentText, setCommentText] = useState(
|
|
50
|
+
const [commentText, setCommentText] = useState('');
|
|
49
51
|
const { isExportingPDF } = useContext(PDFContext);
|
|
50
52
|
const { getCommentTypeFromPreference, getCommentSignature } = useUserPreferences();
|
|
51
53
|
const applySignature = useCallback((text) => {
|
|
52
54
|
if (isEmpty(commentSignature))
|
|
53
55
|
return;
|
|
54
|
-
const
|
|
56
|
+
const signatureHtml = `<p>${commentSignature}</p>`;
|
|
57
|
+
const signed = text.includes(commentSignature) ? text : text + signatureHtml;
|
|
55
58
|
setCommentText(signed);
|
|
56
59
|
}, [commentSignature]);
|
|
57
60
|
useEffect(() => {
|
|
@@ -60,10 +63,9 @@ export function PostComment(props) {
|
|
|
60
63
|
try {
|
|
61
64
|
yield getCommentTypeFromPreference();
|
|
62
65
|
const sig = (yield getCommentSignature()) || '';
|
|
63
|
-
setCommentType(EditorMode.PLAIN);
|
|
64
66
|
setCommentSignature(sig);
|
|
65
67
|
if (isEmpty(commentText) && !isEmpty(sig)) {
|
|
66
|
-
setCommentText(
|
|
68
|
+
setCommentText(`<p>${sig}</p>`);
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
catch (error) {
|
|
@@ -92,12 +94,20 @@ export function PostComment(props) {
|
|
|
92
94
|
status: state.caseDetails.status,
|
|
93
95
|
caseSalesforceId: state.caseDetails.id,
|
|
94
96
|
}), isEqual);
|
|
97
|
+
const apolloClient = useApolloClient();
|
|
98
|
+
const { uploadFile: uploadImageFile } = useS3Upload(caseNumber, apolloClient, caseSalesforceId);
|
|
99
|
+
const onImageUpload = useCallback((file) => __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
const attachmentId = yield uploadImageFile({ file });
|
|
101
|
+
if (!attachmentId) {
|
|
102
|
+
throw new Error('Upload did not return an attachment id.');
|
|
103
|
+
}
|
|
104
|
+
return getHydraAttachmentImageUrl(caseNumber, attachmentId);
|
|
105
|
+
}), [caseNumber, uploadImageFile]);
|
|
95
106
|
const isConfirmedStateSideSupport = (_b = loggedInUsersAccount === null || loggedInUsersAccount === void 0 ? void 0 : loggedInUsersAccount.data) === null || _b === void 0 ? void 0 : _b.hasConfirmedStatesideSupport;
|
|
96
107
|
const caseDispatch = useCaseDispatch();
|
|
97
108
|
const [isCommentTooLong, setIsCommentTooLong] = useState(false);
|
|
98
109
|
const canEditCase = useCanEditCase();
|
|
99
110
|
const componentRef = useRef(null);
|
|
100
|
-
let passedReply = props.commentText;
|
|
101
111
|
const resetIsPublic = useCallback(() => setIsPublic(props.defaultIsPublic === null ? true : props.defaultIsPublic), [props.defaultIsPublic]);
|
|
102
112
|
const previousDefaultIsPublic = usePrevious(props.defaultIsPublic);
|
|
103
113
|
useEffect(() => {
|
|
@@ -105,37 +115,22 @@ export function PostComment(props) {
|
|
|
105
115
|
return;
|
|
106
116
|
props.defaultIsPublic === null ? resetIsPublic() : setIsPublic(props.defaultIsPublic);
|
|
107
117
|
}, [props.defaultIsPublic, resetIsPublic, previousDefaultIsPublic]);
|
|
108
|
-
const
|
|
109
|
-
const isReplyMatch = node !== null &&
|
|
110
|
-
props.commentText &&
|
|
111
|
-
props.commentCreator &&
|
|
112
|
-
commentText &&
|
|
113
|
-
commentText === getReplyText(props.commentText, props.commentCreator);
|
|
114
|
-
if (!isReplyMatch)
|
|
115
|
-
return;
|
|
116
|
-
node.scrollTop = node.scrollHeight;
|
|
117
|
-
node.focus();
|
|
118
|
-
},
|
|
119
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
120
|
-
[commentText]);
|
|
118
|
+
const quillEditorRef = useRef(null);
|
|
121
119
|
const loggedInUserSSO = loggedInUserRights.data.getSSOUsername();
|
|
122
120
|
const { saveDraft, clearDraft } = useCommentDrafts({
|
|
123
121
|
caseNumber,
|
|
124
122
|
loggedInUserSSO,
|
|
125
123
|
commentSignature,
|
|
126
124
|
setCommentText,
|
|
127
|
-
setCommentType,
|
|
128
125
|
setIsPublic,
|
|
129
126
|
applySignature,
|
|
130
127
|
});
|
|
131
128
|
const resetCommentSection = () => __awaiter(this, void 0, void 0, function* () {
|
|
132
|
-
var _a;
|
|
133
129
|
setCommentText('');
|
|
134
130
|
setIsTextAreaFocused(false);
|
|
135
131
|
resetIsPublic();
|
|
136
132
|
yield clearDraft();
|
|
137
|
-
(
|
|
138
|
-
setCommentText(commentSignature ? `\n ${commentSignature}` : '');
|
|
133
|
+
setCommentText(commentSignature ? `<p>${commentSignature}</p>` : '');
|
|
139
134
|
});
|
|
140
135
|
const resetAttachmentSection = () => {
|
|
141
136
|
resetAttachment(dispatchToAttachmentReducer);
|
|
@@ -161,11 +156,10 @@ export function PostComment(props) {
|
|
|
161
156
|
resetCommentSection();
|
|
162
157
|
cancelFileUpload();
|
|
163
158
|
};
|
|
164
|
-
const onCommentTextChange = (
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
});
|
|
159
|
+
const onCommentTextChange = (html) => {
|
|
160
|
+
setCommentText(html);
|
|
161
|
+
saveDraft(html, isPublic);
|
|
162
|
+
};
|
|
169
163
|
const onCancel = () => {
|
|
170
164
|
setIsModalOpen(false);
|
|
171
165
|
};
|
|
@@ -187,15 +181,9 @@ export function PostComment(props) {
|
|
|
187
181
|
// await addingNotifiedUsers(caseDispatch, caseNumber, [{ ssoUsername: sso }]);
|
|
188
182
|
// setNotifiedUser(caseDispatch, uniqBy([...selectedNotificationContacts, loggedInUser.data], 'ssoUsername'));
|
|
189
183
|
// };
|
|
190
|
-
const
|
|
184
|
+
const plainTextContent = (_f = (_e = (_d = (_c = quillEditorRef.current) === null || _c === void 0 ? void 0 : _c.getText) === null || _d === void 0 ? void 0 : _d.call(_c)) === null || _e === void 0 ? void 0 : _e.trim()) !== null && _f !== void 0 ? _f : '';
|
|
185
|
+
const checkCommentSignature = plainTextContent.replace(commentSignature, '');
|
|
191
186
|
const isCommentEmpty = isEmpty(checkCommentSignature === null || checkCommentSignature === void 0 ? void 0 : checkCommentSignature.trim());
|
|
192
|
-
useEffect(() => {
|
|
193
|
-
var _a;
|
|
194
|
-
if (isCommentEmpty) {
|
|
195
|
-
(_a = props.onCommentClear) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
196
|
-
}
|
|
197
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
198
|
-
}, [commentText]);
|
|
199
187
|
const onPostComment = () => __awaiter(this, void 0, void 0, function* () {
|
|
200
188
|
var _a;
|
|
201
189
|
if (canEditCase.alert())
|
|
@@ -206,12 +194,9 @@ export function PostComment(props) {
|
|
|
206
194
|
return;
|
|
207
195
|
try {
|
|
208
196
|
setIsProcessing(true);
|
|
209
|
-
// Encode angle brackets before submission to prevent Salesforce from
|
|
210
|
-
// stripping them as HTML tags (QA Issue 1: <test> becomes blank).
|
|
211
|
-
const encodedBody = commentText.replaceAll('<', '<').replaceAll('>', '>');
|
|
212
197
|
yield createComment({
|
|
213
198
|
caseId: caseSalesforceId,
|
|
214
|
-
body:
|
|
199
|
+
body: commentText,
|
|
215
200
|
isPublic,
|
|
216
201
|
isAssociate: loggedInUserRights.data.isInternal(),
|
|
217
202
|
});
|
|
@@ -226,7 +211,7 @@ export function PostComment(props) {
|
|
|
226
211
|
setCssCommentAgreed(false);
|
|
227
212
|
}
|
|
228
213
|
catch (_b) {
|
|
229
|
-
ToastNotification.addDangerMessage(t('Could not submit comment'));
|
|
214
|
+
ToastNotification.addDangerMessage(t('Could not submit comment. Please refresh the page and try again.'));
|
|
230
215
|
}
|
|
231
216
|
finally {
|
|
232
217
|
setIsProcessing(false);
|
|
@@ -236,44 +221,15 @@ export function PostComment(props) {
|
|
|
236
221
|
setIsPublic((publicComment) => !publicComment);
|
|
237
222
|
};
|
|
238
223
|
function isCommentSignatureMatch() {
|
|
239
|
-
|
|
224
|
+
var _a, _b, _c, _d;
|
|
225
|
+
const plainText = (_d = (_c = (_b = (_a = quillEditorRef.current) === null || _a === void 0 ? void 0 : _a.getText) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.trim()) !== null && _d !== void 0 ? _d : commentText.trim();
|
|
226
|
+
return plainText === commentSignature;
|
|
240
227
|
}
|
|
241
228
|
const isPostCommentDisabled = isProcessing || !commentText || isCommentSignatureMatch();
|
|
242
229
|
const isFileUploadDisabled = isConfirmedStateSideSupport && !cssCommentAgreed;
|
|
243
230
|
const onFileUploadClick = () => {
|
|
244
231
|
ToastNotification.addInfoMessage(t('Uploading Attachment(s)'));
|
|
245
232
|
};
|
|
246
|
-
/**
|
|
247
|
-
* Formats a reply as a markdown blockquote. Truncates the original text
|
|
248
|
-
* to 1000 characters, prepends an attribution header, and prefixes each
|
|
249
|
-
* line with `> ` for blockquote rendering.
|
|
250
|
-
*/
|
|
251
|
-
const getReplyText = (replyText, commentCreator) => {
|
|
252
|
-
const person = t(`(replying to {{commentCreator}}) \n`, { commentCreator });
|
|
253
|
-
const reply = replyText
|
|
254
|
-
.substring(0, 1000)
|
|
255
|
-
.split(/\n/)
|
|
256
|
-
.reduce((acc, line) => (acc += '> ' + line + '\n'), person);
|
|
257
|
-
return reply;
|
|
258
|
-
};
|
|
259
|
-
useEffect(() => {
|
|
260
|
-
if (!props.commentText || !props.commentCreator)
|
|
261
|
-
return;
|
|
262
|
-
const reply = getReplyText(props.commentText, props.commentCreator);
|
|
263
|
-
// Only check for signature in non-quoted lines so replying to a signed
|
|
264
|
-
// comment does not suppress appending the author's own signature
|
|
265
|
-
const nonQuotedText = reply
|
|
266
|
-
.split('\n')
|
|
267
|
-
.filter((line) => !line.startsWith('> '))
|
|
268
|
-
.join('\n');
|
|
269
|
-
if (commentSignature && nonQuotedText.includes(commentSignature)) {
|
|
270
|
-
setCommentText(reply);
|
|
271
|
-
}
|
|
272
|
-
else {
|
|
273
|
-
applySignature(reply);
|
|
274
|
-
}
|
|
275
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
276
|
-
}, [props.commentText, props.commentCreator]);
|
|
277
233
|
const onTextAreaBlur = () => {
|
|
278
234
|
if (!commentText)
|
|
279
235
|
setIsTextAreaFocused(false);
|
|
@@ -282,25 +238,14 @@ export function PostComment(props) {
|
|
|
282
238
|
if (isCommentTooLong !== lengthExceededNew)
|
|
283
239
|
setIsCommentTooLong(lengthExceededNew);
|
|
284
240
|
};
|
|
285
|
-
const isReplyDisabled = () => {
|
|
286
|
-
var _a;
|
|
287
|
-
let parsedPassedReply = getReplyText(passedReply !== null && passedReply !== void 0 ? passedReply : '', (_a = props.commentCreator) !== null && _a !== void 0 ? _a : '');
|
|
288
|
-
return (parsedPassedReply === null || parsedPassedReply === void 0 ? void 0 : parsedPassedReply.trim()) === (commentText === null || commentText === void 0 ? void 0 : commentText.trim());
|
|
289
|
-
};
|
|
290
241
|
// Submit stays independent of attachment upload so comments can be posted mid-upload (PCM-15915).
|
|
291
|
-
const isSubmitDisabled =
|
|
292
|
-
isCommentEmpty ||
|
|
293
|
-
isPostCommentDisabled ||
|
|
294
|
-
(isConfirmedStateSideSupport && !cssCommentAgreed);
|
|
242
|
+
const isSubmitDisabled = isCommentEmpty || isPostCommentDisabled || (isConfirmedStateSideSupport && !cssCommentAgreed);
|
|
295
243
|
return (React.createElement("div", { className: `pf-v6-u-mb-md ${isExportingPDF ? 'hide-in-pdf' : ''}`, ref: componentRef },
|
|
296
|
-
React.createElement(
|
|
297
|
-
React.createElement("strong", null, "Markdown isn't supported."),
|
|
298
|
-
" Comments are displayed as plain text, including any typed or pasted Markdown.") }),
|
|
299
|
-
React.createElement(MarkdownEditor, { className: `${!isPublic && canPostPrivateComments ? 'is-private' : ''}`, disabled: isProcessing || canEditCase.isCaseNotEditable, "aria-label": "comment text area", editorMode: commentType, hideToolbars: true, onFocus: () => setIsTextAreaFocused(true), onBlur: onTextAreaBlur, onChange: onCommentTextChange, value: commentText, rows: isTextAreaFocused ? 12 : 4, bindTextArea: textAreaRef, onCommentExceedCharsLimit: onCommentExceedCharsLimit, mdPlaceholder: !isPublic && canPostPrivateComments
|
|
300
|
-
? 'Add a comment or attach a file privately'
|
|
301
|
-
: 'Add a comment to this case', plainTextPlaceholder: !isPublic && canPostPrivateComments
|
|
244
|
+
React.createElement(RichTextEditor, { className: `${!isPublic && canPostPrivateComments ? 'is-private' : ''}`, disabled: isProcessing || canEditCase.isCaseNotEditable, "aria-label": "comment text area", onFocus: () => setIsTextAreaFocused(true), onBlur: onTextAreaBlur, onChange: onCommentTextChange, value: commentText, height: isTextAreaFocused ? 313 : 120, onCharLimitExceeded: onCommentExceedCharsLimit, placeholder: !isPublic && canPostPrivateComments
|
|
302
245
|
? 'Add a comment or attach a file privately'
|
|
303
|
-
: 'Add a comment to this case'
|
|
246
|
+
: 'Add a comment to this case', charLimit: 32000, onImageUpload: onImageUpload, bindEditor: (editor) => {
|
|
247
|
+
quillEditorRef.current = editor;
|
|
248
|
+
} }),
|
|
304
249
|
isConfirmedStateSideSupport && (React.createElement("div", { className: "pf-v6-u-mt-md pf-v6-u-mb-lg" },
|
|
305
250
|
React.createElement("input", { type: "checkbox", id: "css-case-comment-agreement", name: "css-case-comment-agreement", "data-tracking-id": "css-case-comment-agreement", checked: cssCommentAgreed, onChange: (e) => setCssCommentAgreed(e.target.checked) }),
|
|
306
251
|
React.createElement("label", { htmlFor: "css-case-comment-agreement", className: "pf-v6-u-font-weight-normal pf-v6-u-font-size-sm" },
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CaseLabelsCreate.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/CaseLabelsCreate.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAWjF,wFAAwF;AACxF,MAAM,CAAC,OAAO,UAAU,gBAAgB,sBAgLvC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { useApolloClient } from '@apollo/client/react';
|
|
11
|
+
import { Label, MenuToggle, Select, SelectList, SelectOption, Spinner, } from '@patternfly/react-core';
|
|
12
|
+
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
13
|
+
import { GET_CASE_LABELS, } from '@rh-support/utils';
|
|
14
|
+
import isEqual from 'lodash/isEqual';
|
|
15
|
+
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
|
16
|
+
import { Trans, useTranslation } from 'react-i18next';
|
|
17
|
+
import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
|
|
18
|
+
import { setCaseState } from '../../reducers/CaseReducer';
|
|
19
|
+
const NUM_VISIBLE_LABELS = 3;
|
|
20
|
+
/** Case creation Labels dropdown — selection is stored and linked after case create. */
|
|
21
|
+
export default function CaseLabelsCreate() {
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
const client = useApolloClient();
|
|
24
|
+
const caseDispatch = useCaseDispatch();
|
|
25
|
+
const { globalMetadataState: { loggedInUser }, } = useContext(GlobalMetadataStateContext);
|
|
26
|
+
const isOrgAdmin = loggedInUser.data.isOrgAdmin;
|
|
27
|
+
const { salesforceAccountId, selectedLabelIds } = useCaseSelector((state) => {
|
|
28
|
+
var _a, _b, _c;
|
|
29
|
+
return ({
|
|
30
|
+
salesforceAccountId: (_b = (_a = state.selectedAccountDetails) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.salesforceAccountId,
|
|
31
|
+
selectedLabelIds: (_c = state.selectedLabelIds) !== null && _c !== void 0 ? _c : [],
|
|
32
|
+
});
|
|
33
|
+
}, isEqual);
|
|
34
|
+
const [availableLabels, setAvailableLabels] = useState([]);
|
|
35
|
+
const [loading, setLoading] = useState(false);
|
|
36
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
37
|
+
const updateSelectedLabelIds = (nextIds) => {
|
|
38
|
+
setCaseState(caseDispatch, { selectedLabelIds: nextIds });
|
|
39
|
+
};
|
|
40
|
+
const fetchLabels = useCallback(() => __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
var _a, _b, _c, _d;
|
|
42
|
+
if (!salesforceAccountId) {
|
|
43
|
+
setAvailableLabels([]);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
setLoading(true);
|
|
47
|
+
try {
|
|
48
|
+
const { data } = yield client.query({
|
|
49
|
+
query: GET_CASE_LABELS,
|
|
50
|
+
variables: { where: { Account__c: { eq: salesforceAccountId } } },
|
|
51
|
+
fetchPolicy: 'cache-first',
|
|
52
|
+
});
|
|
53
|
+
const edges = (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.redhat_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.RedHatSupportCaseLabel__c) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
|
|
54
|
+
setAvailableLabels(edges
|
|
55
|
+
.map(({ node }) => {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
return ({
|
|
58
|
+
id: node.Id,
|
|
59
|
+
name: (_b = (_a = node.Name) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '',
|
|
60
|
+
});
|
|
61
|
+
})
|
|
62
|
+
.filter((label) => label.id && label.name));
|
|
63
|
+
}
|
|
64
|
+
catch (_e) {
|
|
65
|
+
setAvailableLabels([]);
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
setLoading(false);
|
|
69
|
+
}
|
|
70
|
+
}), [client, salesforceAccountId]);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
fetchLabels();
|
|
73
|
+
}, [fetchLabels]);
|
|
74
|
+
const handleSelect = (_event, labelId) => {
|
|
75
|
+
if (!labelId || typeof labelId !== 'string')
|
|
76
|
+
return;
|
|
77
|
+
updateSelectedLabelIds(selectedLabelIds.includes(labelId)
|
|
78
|
+
? selectedLabelIds.filter((id) => id !== labelId)
|
|
79
|
+
: [...selectedLabelIds, labelId]);
|
|
80
|
+
};
|
|
81
|
+
const handleChipRemove = (labelId) => {
|
|
82
|
+
updateSelectedLabelIds(selectedLabelIds.filter((id) => id !== labelId));
|
|
83
|
+
};
|
|
84
|
+
const selectedLabels = availableLabels.filter((label) => selectedLabelIds.includes(label.id));
|
|
85
|
+
const haltEvent = (e) => e.stopPropagation();
|
|
86
|
+
const toggle = (toggleRef) => (React.createElement(MenuToggle, { ref: toggleRef, onClick: () => setIsOpen((prev) => !prev), isExpanded: isOpen, isDisabled: loading || (!isOrgAdmin && availableLabels.length === 0), isFullWidth: true, style: { height: '36px' } }, loading ? (React.createElement(Spinner, { size: "md" })) : selectedLabels.length > 0 ? (React.createElement("span", { style: { display: 'flex', gap: '8px', alignItems: 'center', flexWrap: 'nowrap' } },
|
|
87
|
+
selectedLabels.slice(0, NUM_VISIBLE_LABELS).map((label) => (React.createElement(Label, { key: label.id, variant: "outline", onClose: () => handleChipRemove(label.id), closeBtnAriaLabel: t('Remove label {{name}}', { name: label.name }), onClick: haltEvent }, label.name))),
|
|
88
|
+
selectedLabels.length > NUM_VISIBLE_LABELS && (React.createElement("span", { style: {
|
|
89
|
+
color: 'var(--pf-t--global--text--color--link--default)',
|
|
90
|
+
fontSize: '12px',
|
|
91
|
+
whiteSpace: 'nowrap',
|
|
92
|
+
cursor: 'pointer',
|
|
93
|
+
} }, t('{{count}} more', { count: selectedLabels.length - NUM_VISIBLE_LABELS }))))) : availableLabels.length === 0 ? (t('No label assigned')) : (t('Select labels'))));
|
|
94
|
+
return (React.createElement("div", { className: "form-group" },
|
|
95
|
+
React.createElement("label", { htmlFor: "case-labels-create" },
|
|
96
|
+
React.createElement(Trans, null, "Labels")),
|
|
97
|
+
React.createElement(Select, { id: "case-labels-create", "data-tracking-id": "case-labels-create", role: "menu", isOpen: isOpen, onSelect: handleSelect, onOpenChange: () => setIsOpen(false), toggle: toggle, shouldFocusFirstItemOnOpen: false, isScrollable: true, popperProps: { direction: 'down', enableFlip: false } },
|
|
98
|
+
React.createElement(SelectList, { id: "case-labels-create-listbox" }, availableLabels.map((label) => (React.createElement(SelectOption, { key: label.id, value: label.id, hasCheckbox: true, isSelected: selectedLabelIds.includes(label.id) }, label.name))))),
|
|
99
|
+
!loading && availableLabels.length === 0 && (React.createElement("p", { className: "form-instructions" }, isOrgAdmin ? (React.createElement(Trans, null,
|
|
100
|
+
React.createElement("strong", null, "No labels available:"),
|
|
101
|
+
" You haven't created any labels yet.",
|
|
102
|
+
' ',
|
|
103
|
+
React.createElement("a", { href: "/support/cases/#/manage/case-labels", style: { textDecoration: 'none' }, onClick: () => window.scrollTo(0, 0) }, "Create a label"),
|
|
104
|
+
' ',
|
|
105
|
+
"to start organizing your cases.")) : (React.createElement(Trans, null,
|
|
106
|
+
React.createElement("strong", null, "No labels available:"),
|
|
107
|
+
" Your organization admin hasn't created any labels yet. Contact them to add labels before you can select one."))))));
|
|
108
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseManagement.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/CaseManagement.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CaseManagement.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseManagement/CaseManagement.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAkB1B,MAAM,WAAW,MAAM;CAAG;AAC1B,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,MAAM,qBA2CnD"}
|
|
@@ -9,6 +9,7 @@ import { ContactPhoneNumber } from '../CaseInformation/ContactPhoneNumber';
|
|
|
9
9
|
import Fts from '../CaseInformation/Fts';
|
|
10
10
|
import Severity from '../CaseInformation/Severity';
|
|
11
11
|
import SupportLevel from '../CaseInformation/SupportLevel';
|
|
12
|
+
import CaseLabelsCreate from './CaseLabelsCreate';
|
|
12
13
|
import CaseLanguageSelector from './CaseLanguageSelector';
|
|
13
14
|
// import { Cep } from './Cep';
|
|
14
15
|
import OpenReferenceNumber from './OpenReferenceNumber';
|
|
@@ -31,6 +32,9 @@ export default function CaseManagement(props) {
|
|
|
31
32
|
React.createElement(CaseLanguageSelector, { isManageStep: true })),
|
|
32
33
|
React.createElement(GridItem, { span: 12, xl2: 6, className: "pf-v6-u-mb-xs" },
|
|
33
34
|
React.createElement(CaseGroup, { init: true }))),
|
|
35
|
+
React.createElement(Grid, { hasGutter: true },
|
|
36
|
+
React.createElement(GridItem, { span: 12, xl2: 6, className: "pf-v6-u-mb-xs" },
|
|
37
|
+
React.createElement(CaseLabelsCreate, null))),
|
|
34
38
|
React.createElement(RHAssociatesSelector, null),
|
|
35
39
|
React.createElement(OpenReferenceNumber, { inlineEditable: false, hideSaveCancel: true })));
|
|
36
40
|
}
|
|
@@ -447,7 +447,7 @@ export function moveSessionAttachmentToCase(dispatch, caseNumber, sessionId, loc
|
|
|
447
447
|
fileSize: String(localFile.size),
|
|
448
448
|
totalChunks: String(totalChunks),
|
|
449
449
|
clientId: 'pcm',
|
|
450
|
-
description: localFile.description,
|
|
450
|
+
description: localFile.description || '',
|
|
451
451
|
},
|
|
452
452
|
],
|
|
453
453
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalTroubleshootEffects.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/GlobalTroubleshootEffects.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAgBvD,OAAO,EAAuC,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAYvG,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"GlobalTroubleshootEffects.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/GlobalTroubleshootEffects.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAgBvD,OAAO,EAAuC,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAYvG,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,qBA8ctD"}
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { useApolloClient } from '@apollo/client/react';
|
|
11
11
|
import { useDebounce } from '@rh-support/components';
|
|
12
12
|
import { GlobalMetadataStateContext, useUserPreferences } from '@rh-support/react-context';
|
|
13
|
-
import {
|
|
13
|
+
import { GET_CONTACT_DETAILS_BY_CONTACT_ID, resolveProductServiceLevelsForAccount, } from '@rh-support/utils';
|
|
14
14
|
import findIndex from 'lodash/findIndex';
|
|
15
15
|
import includes from 'lodash/includes';
|
|
16
16
|
import isEmpty from 'lodash/isEmpty';
|
|
@@ -196,61 +196,54 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
196
196
|
if (selectedOwnerContactId)
|
|
197
197
|
return;
|
|
198
198
|
const fetchAndSetDefaultOwner = () => __awaiter(this, void 0, void 0, function* () {
|
|
199
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y
|
|
199
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
200
200
|
try {
|
|
201
|
-
//
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (!
|
|
201
|
+
// Same as logged-in user resolve: JWT/SSO → RedHatSupportContact by SSOUserName__c
|
|
202
|
+
const ssoUsername = loggedInUserRights.data.getSSOUsername() ||
|
|
203
|
+
((_a = loggedInUser.data) === null || _a === void 0 ? void 0 : _a.ssoUsername) ||
|
|
204
|
+
(loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.preferred_username) ||
|
|
205
|
+
(loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.username) ||
|
|
206
|
+
(loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.RHAT_LOGIN) ||
|
|
207
|
+
(loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.REDHAT_LOGIN) ||
|
|
208
|
+
'';
|
|
209
|
+
if (!ssoUsername)
|
|
210
210
|
return;
|
|
211
|
-
const federationId = loggedInUser.node.FederationIdentifier.value;
|
|
212
|
-
// Search for the contact using FederationIdentifier (SSOUserName__c)
|
|
213
211
|
const { data: contactData } = yield apolloClient.query({
|
|
214
|
-
query:
|
|
212
|
+
query: GET_CONTACT_DETAILS_BY_CONTACT_ID,
|
|
215
213
|
variables: {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
IsActive__c: { eq: true },
|
|
219
|
-
SSOUserName__c: { like: federationId },
|
|
214
|
+
where: {
|
|
215
|
+
SSOUserName__c: { eq: ssoUsername },
|
|
220
216
|
},
|
|
221
217
|
},
|
|
222
218
|
fetchPolicy: 'network-only',
|
|
223
219
|
});
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
});
|
|
244
|
-
setCaseDetails(caseDispatch, { contactSSOName: ownerData.ssoUsername });
|
|
245
|
-
}
|
|
220
|
+
const contactDetails = (_f = (_e = (_d = (_c = (_b = contactData === null || contactData === void 0 ? void 0 : contactData.redhat_support_uiapi) === null || _b === void 0 ? void 0 : _b.query) === null || _c === void 0 ? void 0 : _c.RedHatSupportContact) === null || _d === void 0 ? void 0 : _d.edges) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.node;
|
|
221
|
+
if (!(contactDetails === null || contactDetails === void 0 ? void 0 : contactDetails.Id))
|
|
222
|
+
return;
|
|
223
|
+
const ownerData = {
|
|
224
|
+
id: contactDetails.Id,
|
|
225
|
+
ssoUsername: ((_g = contactDetails.SSOUserName__c) === null || _g === void 0 ? void 0 : _g.value) || ssoUsername,
|
|
226
|
+
firstName: (_j = (_h = contactDetails.FirstName) === null || _h === void 0 ? void 0 : _h.value) !== null && _j !== void 0 ? _j : '',
|
|
227
|
+
lastName: (_l = (_k = contactDetails.LastName) === null || _k === void 0 ? void 0 : _k.value) !== null && _l !== void 0 ? _l : '',
|
|
228
|
+
fullNameCustom: (_o = (_m = contactDetails.Name) === null || _m === void 0 ? void 0 : _m.value) !== null && _o !== void 0 ? _o : '',
|
|
229
|
+
manageSupportCases: (_q = (_p = contactDetails.ManageSupportCases__c) === null || _p === void 0 ? void 0 : _p.value) !== null && _q !== void 0 ? _q : true,
|
|
230
|
+
isInternal: (_s = (_r = contactDetails.IsInternal__c) === null || _r === void 0 ? void 0 : _r.value) !== null && _s !== void 0 ? _s : false,
|
|
231
|
+
isOrgAdmin: (_u = (_t = contactDetails.IsOrgAdmin__c) === null || _t === void 0 ? void 0 : _t.value) !== null && _u !== void 0 ? _u : false,
|
|
232
|
+
phone: (_w = (_v = contactDetails.Phone) === null || _v === void 0 ? void 0 : _v.value) !== null && _w !== void 0 ? _w : '',
|
|
233
|
+
defaultCaseGroup: (_y = (_x = contactDetails.DefaultCaseGroup__c) === null || _x === void 0 ? void 0 : _x.value) !== null && _y !== void 0 ? _y : null,
|
|
234
|
+
};
|
|
235
|
+
setCaseState(caseDispatch, {
|
|
236
|
+
selectedOwner: { data: ownerData, isFetching: false, isError: false, errorMessage: '' },
|
|
237
|
+
});
|
|
238
|
+
setCaseDetails(caseDispatch, { contactSSOName: ownerData.ssoUsername });
|
|
246
239
|
}
|
|
247
|
-
catch (
|
|
240
|
+
catch (_z) {
|
|
248
241
|
// Contact fetch failed; owner stays empty
|
|
249
242
|
}
|
|
250
243
|
});
|
|
251
244
|
fetchAndSetDefaultOwner();
|
|
252
245
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
253
|
-
}, [loggedInUserRights.data, selectedOwnerContactId]);
|
|
246
|
+
}, [loggedInUserRights.data, loggedInUser.data, loggedInUserJwtToken, selectedOwnerContactId]);
|
|
254
247
|
/**
|
|
255
248
|
* Fetch case groups for the selected owner's contactId.
|
|
256
249
|
* Filters groups where the contact is a member via GET_CASE_GROUP.
|
package/lib/esm/css/case.css
CHANGED
|
@@ -124,11 +124,12 @@ button,
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
.support-comment .comment-body ul {
|
|
127
|
-
list-style: '-';
|
|
127
|
+
list-style: '- ';
|
|
128
|
+
padding-left: 1.5em;
|
|
128
129
|
}
|
|
129
130
|
|
|
130
|
-
.support-comment .comment-body
|
|
131
|
-
|
|
131
|
+
.support-comment .comment-body ol {
|
|
132
|
+
padding-left: 1.5em;
|
|
132
133
|
}
|
|
133
134
|
|
|
134
135
|
#case-description ul {
|
|
@@ -359,6 +360,43 @@ input[aria-invalid='true'].pf-v6-c-form-control {
|
|
|
359
360
|
padding-left: 1.5em;
|
|
360
361
|
}
|
|
361
362
|
|
|
363
|
+
.comment-body ol,
|
|
364
|
+
.markdown-preview ol {
|
|
365
|
+
padding-left: 1.5em;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.comment-body .ql-align-center {
|
|
369
|
+
text-align: center;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.comment-body .ql-align-right {
|
|
373
|
+
text-align: right;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.comment-body .ql-align-justify {
|
|
377
|
+
text-align: justify;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.comment-body .ql-indent-1 {
|
|
381
|
+
padding-left: 3em;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.comment-body .ql-indent-2 {
|
|
385
|
+
padding-left: 6em;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.comment-body .ql-indent-3 {
|
|
389
|
+
padding-left: 9em;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.comment-body .ql-indent-4 {
|
|
393
|
+
padding-left: 12em;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.comment-body .ql-indent-5 {
|
|
397
|
+
padding-left: 15em;
|
|
398
|
+
}
|
|
399
|
+
|
|
362
400
|
.tab-title-with-badge {
|
|
363
401
|
display: flex;
|
|
364
402
|
align-items: center;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateCaseComment.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/useCreateCaseComment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCreateCaseComment.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/useCreateCaseComment.ts"],"names":[],"mappings":"AAMA,UAAU,yBAAyB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,UAAU,2BAA2B;IACjC,aAAa,EAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACxE,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,2BAA2B,CAiBlE"}
|
|
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { useMutation } from '@apollo/client/react';
|
|
11
|
+
import { sanitizeForSalesforce } from '@rh-support/utils';
|
|
11
12
|
import { CREATE_CASE_COMMENT } from './caseCommentMutation';
|
|
12
13
|
import { mapVisibility } from './mapCaseComment';
|
|
13
14
|
/**
|
|
@@ -22,7 +23,7 @@ export function useCreateCaseComment() {
|
|
|
22
23
|
variables: {
|
|
23
24
|
commentInput: {
|
|
24
25
|
Case__c: caseId,
|
|
25
|
-
Body__c: body,
|
|
26
|
+
Body__c: sanitizeForSalesforce(body),
|
|
26
27
|
Visibility__c: mapVisibility(isPublic),
|
|
27
28
|
IsAssociate__c: isAssociate,
|
|
28
29
|
},
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { EditorMode } from '@rh-support/components';
|
|
2
1
|
import { IBaseCache } from '@rh-support/utils';
|
|
3
2
|
interface ICaseDraftComment {
|
|
4
3
|
text: string;
|
|
5
4
|
privateFlag: boolean;
|
|
6
|
-
type: EditorMode;
|
|
7
5
|
}
|
|
8
6
|
export interface IDraftComments {
|
|
9
7
|
[id: string]: ICaseDraftComment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/models/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/models/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,UAAU,iBAAiB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC3B,CAAC,EAAE,EAAE,MAAM,GAAG,iBAAiB,CAAC;CACnC;AAED,MAAM,WAAW,mBAAoB,SAAQ,UAAU,CAAC,cAAc,CAAC;IACnE,KAAK,EAAE,cAAc,CAAC;CACzB"}
|