@rh-support/troubleshoot 2.6.306 → 2.6.309

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.
Files changed (42) hide show
  1. package/lib/esm/components/CaseEditView/CaseDetailsTabs.d.ts.map +1 -1
  2. package/lib/esm/components/CaseEditView/CaseDetailsTabs.js +25 -21
  3. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseDetailsManagement.d.ts.map +1 -1
  4. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseDetailsManagement.js +6 -1
  5. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseAttachment.js +1 -1
  6. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.d.ts.map +1 -1
  7. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.js +104 -83
  8. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CommentSearch.d.ts.map +1 -1
  9. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CommentSearch.js +3 -2
  10. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/DiscussionItemLink.d.ts.map +1 -1
  11. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/DiscussionItemLink.js +7 -1
  12. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/JumpAndCopyLink.d.ts.map +1 -1
  13. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/JumpAndCopyLink.js +8 -1
  14. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useAttachmentUploadCompletion.d.ts +8 -3
  15. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useAttachmentUploadCompletion.d.ts.map +1 -1
  16. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useAttachmentUploadCompletion.js +11 -9
  17. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts.map +1 -1
  18. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.js +33 -17
  19. package/lib/esm/components/CaseInformation/CaseLabels.d.ts +3 -0
  20. package/lib/esm/components/CaseInformation/CaseLabels.d.ts.map +1 -0
  21. package/lib/esm/components/CaseInformation/CaseLabels.js +98 -0
  22. package/lib/esm/components/shared/fileUpload/FileLister.js +1 -1
  23. package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.d.ts +11 -2
  24. package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.d.ts.map +1 -1
  25. package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.js +65 -9
  26. package/lib/esm/components/shared/fileUpload/reducer/AttachmentReducer.d.ts +5 -1
  27. package/lib/esm/components/shared/fileUpload/reducer/AttachmentReducer.d.ts.map +1 -1
  28. package/lib/esm/components/shared/fileUpload/reducer/AttachmentReducer.js +23 -1
  29. package/lib/esm/components/shared/fileUpload/types/index.d.ts +2 -0
  30. package/lib/esm/components/shared/fileUpload/types/index.d.ts.map +1 -1
  31. package/lib/esm/components/shared/fileUpload/useFileUploader.d.ts.map +1 -1
  32. package/lib/esm/components/shared/fileUpload/useFileUploader.js +7 -1
  33. package/lib/esm/css/case.css +12 -7
  34. package/lib/esm/hooks/useCaseComments/mapCaseComment.d.ts +1 -1
  35. package/lib/esm/hooks/useCaseComments/mapCaseComment.d.ts.map +1 -1
  36. package/lib/esm/hooks/useCaseComments/mapCaseComment.js +14 -3
  37. package/lib/esm/hooks/useCaseLabelLinkMutations.d.ts +21 -0
  38. package/lib/esm/hooks/useCaseLabelLinkMutations.d.ts.map +1 -0
  39. package/lib/esm/hooks/useCaseLabelLinkMutations.js +84 -0
  40. package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts.map +1 -1
  41. package/lib/esm/reducers/CaseDiscussionTabReducer.js +6 -2
  42. package/package.json +6 -6
@@ -7,7 +7,7 @@ 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 { Button, ButtonVariant, Checkbox } from '@patternfly/react-core';
10
+ import { Alert, AlertVariant, Button, ButtonVariant, Checkbox } from '@patternfly/react-core';
11
11
  import PlusIcon from '@patternfly/react-icons/dist/js/icons/plus-icon';
12
12
  import { EditorMode, LoadingIndicator, MarkdownEditor, ToastNotification, usePrevious } from '@rh-support/components';
13
13
  import { GlobalMetadataStateContext, useCanEditCase, useUserPreferences } from '@rh-support/react-context';
@@ -19,9 +19,8 @@ import { useDropzone } from 'react-dropzone';
19
19
  import { Trans, useTranslation } from 'react-i18next';
20
20
  import { useCaseDispatch, useCaseSelector } from '../../../../context/CaseContext';
21
21
  import { useCreateCaseComment } from '../../../../hooks/useCaseComments';
22
- import { useCaseUpdateErrorMessage } from '../../../../hooks/useCaseUpdateErrorMessage';
23
22
  import { checkForCaseStatusToggleOnAttachOrComment } from '../../../../reducers/CaseReducer';
24
- import { AttachmentDispatchContext, AttachmentStateContext, hasSomeSelectedFiles, hasSomeUnUploadedAttachments, isUploadingAttachment, resetAttachment, } from '../../../shared/fileUpload';
23
+ import { AttachmentDispatchContext, AttachmentStateContext, hasAbortedOrFailedAttachments, hasQueuedAttachmentUploads, hasSomeSelectedFiles, isUploadingAttachment, resetAttachment, } from '../../../shared/fileUpload';
25
24
  import FileSelectorButton from '../../../shared/fileUpload/fileSelectors/FileSelectorButton';
26
25
  import FileUpload from '../../../shared/fileUpload/FileUpload';
27
26
  import { PDFContext } from '../../PDFContainer';
@@ -30,9 +29,8 @@ import { useCommentDrafts } from './PostComment/useCommentDrafts';
30
29
  import { useMarkdownFileUploader } from './PostComment/useMarkdownFileUploader';
31
30
  import { VerifyCaseStatusModal } from './VerifyCaseStatusModal/VerifyCaseStatusModal';
32
31
  export function PostComment(props) {
33
- var _a, _b, _c;
32
+ var _a, _b;
34
33
  const { t } = useTranslation();
35
- const caseUpdateError = useCaseUpdateErrorMessage();
36
34
  let { caseNumber } = props;
37
35
  const [isTextAreaFocused, setIsTextAreaFocused] = useState(false);
38
36
  const canAddAttachments = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.ATTACHMENTS);
@@ -42,7 +40,8 @@ export function PostComment(props) {
42
40
  const { attachmentState } = useContext(AttachmentStateContext);
43
41
  const isUploadingAttachmentPrevious = useRef(false);
44
42
  const isUploadingAttachments = isUploadingAttachment(attachmentState.caseFiles.selectedLocalFiles);
45
- const hasSomeUnUploadedFiles = hasSomeUnUploadedAttachments(attachmentState.caseFiles.selectedLocalFiles);
43
+ const hasQueuedUploads = hasQueuedAttachmentUploads(attachmentState.caseFiles.selectedLocalFiles);
44
+ const hasAbortedOrFailed = hasAbortedOrFailedAttachments(attachmentState.caseFiles.selectedLocalFiles);
46
45
  const hasSomeSelectedFilesLocal = hasSomeSelectedFiles(attachmentState.caseFiles.selectedLocalFiles);
47
46
  const [isPublic, setIsPublic] = useState(props.defaultIsPublic === null ? true : props.defaultIsPublic);
48
47
  const [commentType, setCommentType] = useState(EditorMode.PLAIN);
@@ -142,20 +141,25 @@ export function PostComment(props) {
142
141
  const resetAttachmentSection = () => {
143
142
  resetAttachment(dispatchToAttachmentReducer);
144
143
  };
144
+ const onCaseFileUploaded = () => {
145
+ var _a;
146
+ ToastNotification.addSuccessMessage(t('Attachment uploaded successfully'));
147
+ (_a = props.onAttachmentAdded) === null || _a === void 0 ? void 0 : _a.call(props);
148
+ };
145
149
  useAttachmentUploadCompletion({
146
150
  isUploadingAttachments,
147
- hasSomeUnUploadedFiles,
151
+ hasQueuedUploads,
152
+ hasAbortedOrFailed,
148
153
  isUploadingAttachmentPrevious,
149
154
  caseDispatch,
150
155
  isInternal: loggedInUserRights.data.isInternal(),
151
156
  status,
152
157
  resetAttachmentSection,
153
- onAttachmentAdded: (_c = props.onAttachmentAdded) !== null && _c !== void 0 ? _c : (() => undefined),
154
158
  setCssCommentAgreed,
155
159
  });
156
160
  const onCancelClick = () => {
161
+ // Cancel only clears comment text; file removal stays on FileLister Remove.
157
162
  resetCommentSection();
158
- resetAttachmentSection();
159
163
  cancelFileUpload();
160
164
  };
161
165
  const onCommentTextChange = (value, mode) => __awaiter(this, void 0, void 0, function* () {
@@ -203,9 +207,12 @@ export function PostComment(props) {
203
207
  return;
204
208
  try {
205
209
  setIsProcessing(true);
210
+ // Encode angle brackets before submission to prevent Salesforce from
211
+ // stripping them as HTML tags (QA Issue 1: <test> becomes blank).
212
+ const encodedBody = commentText.replaceAll('<', '&lt;').replaceAll('>', '&gt;');
206
213
  yield createComment({
207
214
  caseId: caseSalesforceId,
208
- body: commentText,
215
+ body: encodedBody,
209
216
  isPublic,
210
217
  isAssociate: loggedInUserRights.data.isInternal(),
211
218
  });
@@ -219,8 +226,8 @@ export function PostComment(props) {
219
226
  ToastNotification.addSuccessMessage(t('Comment submitted'));
220
227
  setCssCommentAgreed(false);
221
228
  }
222
- catch (e) {
223
- caseUpdateError.showError(e, t('Could not submit comment'));
229
+ catch (_b) {
230
+ ToastNotification.addDangerMessage(t('Could not submit comment'));
224
231
  }
225
232
  finally {
226
233
  setIsProcessing(false);
@@ -254,7 +261,13 @@ export function PostComment(props) {
254
261
  if (!props.commentText || !props.commentCreator)
255
262
  return;
256
263
  const reply = getReplyText(props.commentText, props.commentCreator);
257
- if (reply.includes(commentSignature)) {
264
+ // Only check for signature in non-quoted lines so replying to a signed
265
+ // comment does not suppress appending the author's own signature
266
+ const nonQuotedText = reply
267
+ .split('\n')
268
+ .filter((line) => !line.startsWith('> '))
269
+ .join('\n');
270
+ if (commentSignature && nonQuotedText.includes(commentSignature)) {
258
271
  setCommentText(reply);
259
272
  }
260
273
  else {
@@ -279,9 +292,12 @@ export function PostComment(props) {
279
292
  isCommentEmpty ||
280
293
  isPostCommentDisabled ||
281
294
  isUploadingAttachments ||
282
- hasSomeUnUploadedFiles ||
295
+ hasQueuedUploads ||
283
296
  (isConfirmedStateSideSupport && !cssCommentAgreed);
284
297
  return (React.createElement("div", { className: `pf-v6-u-mb-md ${isExportingPDF ? 'hide-in-pdf' : ''}`, ref: componentRef },
298
+ React.createElement(Alert, { className: "pf-v6-u-mb-md pf-v6-u-font-size-sm", isInline: true, isPlain: true, variant: AlertVariant.info, title: React.createElement(Trans, { i18nKey: "markdownNotSupportedCommentWarning" },
299
+ React.createElement("strong", null, "Markdown isn't supported."),
300
+ " Comments are displayed as plain text, including any typed or pasted Markdown.") }),
285
301
  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
286
302
  ? 'Add a comment or attach a file privately'
287
303
  : 'Add a comment to this case', plainTextPlaceholder: !isPublic && canPostPrivateComments
@@ -296,8 +312,8 @@ export function PostComment(props) {
296
312
  isModalOpen && loggedInUserRights.data.isInternal() && isPublic && (React.createElement(VerifyCaseStatusModal, { onClose: onCancel, onConfirm: onConfirm, isUpdating: isPostingComment, caseNumber: props.caseNumber })),
297
313
  React.createElement(Button, { "data-tracking-id": "postcomment-submit-button", type: "button", variant: ButtonVariant.primary, onClick: loggedInUser.data.isInternal && isPublic ? onBtnClick : isNotInternalConfirm, isDisabled: isSubmitDisabled, className: "postcomment-submit" },
298
314
  React.createElement(Trans, null, "Submit")),
299
- React.createElement(Button, { className: "secondary-button-pill", "data-tracking-id": "postcomment-cancel-button", type: "button", variant: ButtonVariant.link, onClick: onCancelClick, isDisabled: isPostCommentDisabled && !hasSomeSelectedFilesLocal },
300
- React.createElement(Trans, null, "Cancel")),
315
+ !isCommentEmpty && (React.createElement(Button, { className: "secondary-button-pill", "data-tracking-id": "postcomment-cancel-button", type: "button", variant: ButtonVariant.link, onClick: onCancelClick, isDisabled: isProcessing },
316
+ React.createElement(Trans, null, "Cancel"))),
301
317
  canAddAttachments && (React.createElement(FileSelectorButton, { isSessionId: false, isDisabled: isFileUploadDisabled, buttonLabel: React.createElement(React.Fragment, null,
302
318
  React.createElement(PlusIcon, null),
303
319
  " ",
@@ -306,5 +322,5 @@ export function PostComment(props) {
306
322
  React.createElement(Checkbox, { label: t('Private'), isChecked: !isPublic && canPostPrivateComments, onChange: handleCheckboxToggle, "aria-label": t('Private'), id: "private-comment", name: "private-comment", "data-tracking-id": "private-comment-checkbox" }))))),
307
323
  canAddAttachments && (React.createElement("div", Object.assign({}, getRootProps(), { className: "post-comment-dropzone" }),
308
324
  React.createElement("input", Object.assign({}, getInputProps())),
309
- React.createElement(FileUpload, { className: `file-upload-section ${hasSomeSelectedFilesLocal ? 'card card-white pf-v6-u-mt-lg pf-v6-u-p-lg' : ''}`, idToUploadTo: caseNumber, caseSalesforceId: caseSalesforceId, onUploadClick: onFileUploadClick, isSessionId: false, needsAnalyzing: false, autoUploadOnSelect: true, isPrivate: !isPublic, showDescriptionInfoMsg: true })))));
325
+ React.createElement(FileUpload, { className: `file-upload-section ${hasSomeSelectedFilesLocal ? 'card card-white pf-v6-u-mt-lg pf-v6-u-p-lg' : ''}`, idToUploadTo: caseNumber, caseSalesforceId: caseSalesforceId, onUploadClick: onFileUploadClick, onCaseFileUploaded: onCaseFileUploaded, isSessionId: false, needsAnalyzing: false, autoUploadOnSelect: true, isPrivate: !isPublic, showDescriptionInfoMsg: true })))));
310
326
  }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export default function CaseLabels(): React.JSX.Element;
3
+ //# sourceMappingURL=CaseLabels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CaseLabels.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseLabels.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAUzD,MAAM,CAAC,OAAO,UAAU,UAAU,sBA6KjC"}
@@ -0,0 +1,98 @@
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 { Label, MenuToggle, Select, SelectList, SelectOption, Spinner, } from '@patternfly/react-core';
11
+ import { ToastNotification } from '@rh-support/components';
12
+ import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
13
+ import isEqual from 'lodash/isEqual';
14
+ import React, { useContext, useState } from 'react';
15
+ import { Trans, useTranslation } from 'react-i18next';
16
+ import { useCaseSelector } from '../../context/CaseContext';
17
+ import { useCaseLabelLinks } from '../../hooks/useCaseLabelLinkMutations';
18
+ const NUM_VISIBLE_LABELS = 3;
19
+ export default function CaseLabels() {
20
+ const { t } = useTranslation();
21
+ const canEditCase = useCanEditCase();
22
+ const { globalMetadataState: { loggedInUser }, } = useContext(GlobalMetadataStateContext);
23
+ const isOrgAdmin = loggedInUser.data.isOrgAdmin;
24
+ const { caseId, salesforceAccountId } = useCaseSelector((state) => {
25
+ var _a, _b;
26
+ return ({
27
+ caseId: state.caseDetails.id,
28
+ salesforceAccountId: (_b = (_a = state.selectedAccountDetails) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.salesforceAccountId,
29
+ });
30
+ }, isEqual);
31
+ const { availableLabels, assignedLinks, selectedLabelIds, loading, mutating, setAssignedLinks, createLink, deleteLink, } = useCaseLabelLinks(salesforceAccountId, caseId);
32
+ const [isOpen, setIsOpen] = useState(false);
33
+ const handleSelect = (_event, labelId) => __awaiter(this, void 0, void 0, function* () {
34
+ if (!labelId || typeof labelId !== 'string')
35
+ return;
36
+ if (canEditCase.alert())
37
+ return;
38
+ const existingLink = assignedLinks.find((link) => link.labelId === labelId);
39
+ try {
40
+ if (existingLink) {
41
+ yield deleteLink(existingLink.linkId);
42
+ setAssignedLinks((prev) => prev.filter((link) => link.linkId !== existingLink.linkId));
43
+ ToastNotification.addSuccessMessage(t('Label has been removed'));
44
+ }
45
+ else {
46
+ const newId = yield createLink(caseId, labelId);
47
+ if (newId) {
48
+ setAssignedLinks((prev) => [...prev, { linkId: newId, labelId }]);
49
+ }
50
+ ToastNotification.addSuccessMessage(t('Label has been added'));
51
+ }
52
+ }
53
+ catch (_a) {
54
+ ToastNotification.addDangerMessage(t('Failed to update labels'));
55
+ }
56
+ });
57
+ const handleChipRemove = (labelId) => __awaiter(this, void 0, void 0, function* () {
58
+ if (canEditCase.alert())
59
+ return;
60
+ const link = assignedLinks.find((l) => l.labelId === labelId);
61
+ if (!link)
62
+ return;
63
+ try {
64
+ yield deleteLink(link.linkId);
65
+ setAssignedLinks((prev) => prev.filter((l) => l.linkId !== link.linkId));
66
+ ToastNotification.addSuccessMessage(t('Label has been removed'));
67
+ }
68
+ catch (_a) {
69
+ ToastNotification.addDangerMessage(t('Failed to remove label'));
70
+ }
71
+ });
72
+ const selectedLabels = availableLabels.filter((l) => selectedLabelIds.includes(l.id));
73
+ const haltEvent = (e) => e.stopPropagation();
74
+ const toggle = (toggleRef) => (React.createElement(MenuToggle, { ref: toggleRef, onClick: () => setIsOpen((prev) => !prev), isExpanded: isOpen, isDisabled: loading || mutating || !caseId || (!isOrgAdmin && availableLabels.length === 0), isFullWidth: true, style: { height: '36px' } }, loading || mutating ? (React.createElement(Spinner, { size: "md" })) : selectedLabels.length > 0 ? (React.createElement("span", { style: { display: 'flex', gap: '8px', alignItems: 'center', flexWrap: 'nowrap' } },
75
+ 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))),
76
+ selectedLabels.length > NUM_VISIBLE_LABELS && (React.createElement("span", { style: {
77
+ color: 'var(--pf-t--global--text--color--link--default)',
78
+ fontSize: '12px',
79
+ whiteSpace: 'nowrap',
80
+ cursor: 'pointer',
81
+ } }, t('{{count}} more', { count: selectedLabels.length - NUM_VISIBLE_LABELS }))))) : availableLabels.length === 0 ? (t('No label assigned')) : (t('Select labels'))));
82
+ if (!caseId)
83
+ return null;
84
+ return (React.createElement("div", { className: "form-group" },
85
+ React.createElement("label", { htmlFor: "case-labels" },
86
+ React.createElement(Trans, null, "Labels")),
87
+ React.createElement(Select, { id: "case-labels", "data-tracking-id": "case-labels", role: "menu", isOpen: isOpen, onSelect: handleSelect, onOpenChange: () => setIsOpen(false), toggle: toggle, shouldFocusFirstItemOnOpen: false, isScrollable: true, popperProps: { direction: 'down', enableFlip: false } },
88
+ React.createElement(SelectList, { id: "case-labels-listbox" }, availableLabels.map((label) => (React.createElement(SelectOption, { key: label.id, value: label.id, hasCheckbox: true, isSelected: selectedLabelIds.includes(label.id) }, label.name))))),
89
+ !loading && availableLabels.length === 0 && (React.createElement("p", { className: "form-instructions" }, isOrgAdmin ? (React.createElement(Trans, null,
90
+ React.createElement("strong", null, "No labels available:"),
91
+ " You haven't created any labels yet.",
92
+ ' ',
93
+ React.createElement("a", { href: "/support/cases/#/manage/case-labels", style: { textDecoration: 'none' }, onClick: () => window.scrollTo(0, 0) }, "Create a label"),
94
+ ' ',
95
+ "to start organizing your cases.")) : (React.createElement(Trans, null,
96
+ React.createElement("strong", null, "No labels available:"),
97
+ " Your organization admin hasn't created any labels yet. Contact them to add labels before you can select one."))))));
98
+ }
@@ -122,7 +122,7 @@ export default function FileLister(props) {
122
122
  React.createElement(HistoryIcon, null))),
123
123
  !isVerifyingUpload(localFile.uploadProgress.uploadStatus) &&
124
124
  !isAnalysingFile(localFile.analysisMetadata.analysisStatus) && (React.createElement(React.Fragment, null,
125
- canShowAbortBtn(localFile.uploadProgress.uploadStatus) && (React.createElement(Button, { variant: ButtonVariant.link, isDanger: true, "aria-label": t('Cancel Upload'), title: t('Cancel Upload'), className: "btn btn-link btn-app remove-file", "data-tracking-id": "file-lister-abort", onClick: onAbortClick(localFile, index), hidden: !localFile.uploadability.ableToUpload, isDisabled: !(localFile.uploadProgress.percentUploaded > 0) },
125
+ canShowAbortBtn(localFile.uploadProgress.uploadStatus) && (React.createElement(Button, { variant: ButtonVariant.link, isDanger: true, "aria-label": t('Cancel Upload'), title: t('Cancel Upload'), className: "btn btn-link btn-app remove-file", "data-tracking-id": "file-lister-abort", onClick: onAbortClick(localFile, index), hidden: !localFile.uploadability.ableToUpload, isDisabled: !localFile.uploadProgress.onAbort },
126
126
  React.createElement(Trans, null, "Cancel"))),
127
127
  showDeleteBtn(localFile.uploadProgress.uploadStatus, localFile) && (React.createElement(Button, { variant: ButtonVariant.link, isDanger: true, "aria-label": t('Delete file'), title: t('Delete file'), className: "btn btn-link btn-app remove-file", "data-tracking-id": "file-lister-delete", onClick: onRemoveClick(localFile, index), hidden: !localFile.uploadability.ableToUpload },
128
128
  React.createElement(Trans, null, "Remove")))))),
@@ -27,6 +27,13 @@ export declare const isFileDeleted: (status: string) => status is UploadStatusCo
27
27
  export declare const hasUploadedSomeAttachments: (selectedLocalFiles: IFileLocal[]) => boolean;
28
28
  export declare const hasAnalysedSomeAttachments: (selectedLocalFiles: IFileLocal[]) => boolean;
29
29
  export declare const hasSomeUnUploadedAttachments: (selectedLocalFiles: IFileLocal[]) => boolean;
30
+ /**
31
+ * Files still queued to start uploading. Aborted/failed are terminal and must not
32
+ * block post-upload discussion refresh when other files in the batch succeeded.
33
+ */
34
+ export declare const hasQueuedAttachmentUploads: (selectedLocalFiles: IFileLocal[]) => boolean;
35
+ /** Aborted/failed rows should stay in the upload panel until the user clicks Remove. */
36
+ export declare const hasAbortedOrFailedAttachments: (selectedLocalFiles: IFileLocal[]) => boolean;
30
37
  export declare const hasSomeSelectedFiles: (selectedLocalFiles: IFileLocal[]) => boolean;
31
38
  export declare const isUploadingAttachment: (selectedLocalFiles: IFileLocal[]) => boolean;
32
39
  export declare const isAnalysingAnyAttachment: (selectedLocalFiles: IFileLocal[]) => boolean;
@@ -38,7 +45,7 @@ export declare const isUploadedAndAnalysisFailed: (file: IFileLocal) => boolean;
38
45
  export declare const isUploadedSuccessfully: (file: IFileLocal) => string;
39
46
  export declare const isUploadedAndAnalysisSkipped: (file: IFileLocal) => boolean;
40
47
  export declare const updateUploadMetadata: (dispatch: AttachmentReducerDispatchType, fileIndexToEdit: number, newUploadMetadata: Partial<IUploadMetadata>) => void;
41
- export declare const uploadAllFiles: ({ dispatch, idToUploadTo, caseFiles, needsAnalyzing, isSessionId, slowUploadConfig, apolloClient, caseSalesforceId, }: {
48
+ export declare const uploadAllFiles: ({ dispatch, idToUploadTo, caseFiles, needsAnalyzing, isSessionId, slowUploadConfig, apolloClient, caseSalesforceId, onCaseFileUploaded, }: {
42
49
  dispatch: AttachmentReducerDispatchType;
43
50
  idToUploadTo: string;
44
51
  caseFiles: ICaseFiles;
@@ -47,8 +54,9 @@ export declare const uploadAllFiles: ({ dispatch, idToUploadTo, caseFiles, needs
47
54
  slowUploadConfig?: ISlowUploadDetectionConfig;
48
55
  apolloClient?: ApolloQueryClient;
49
56
  caseSalesforceId?: string;
57
+ onCaseFileUploaded?: () => void;
50
58
  }) => Promise<void>;
51
- export declare const uploadFile: ({ dispatch, idToUploadTo, localFile, originalFile, index, needsAnalyzing, isSessionId, slowUploadConfig, apolloClient, caseSalesforceId, }: {
59
+ export declare const uploadFile: ({ dispatch, idToUploadTo, localFile, originalFile, index, needsAnalyzing, isSessionId, slowUploadConfig, apolloClient, caseSalesforceId, onCaseFileUploaded, }: {
52
60
  dispatch: AttachmentReducerDispatchType;
53
61
  idToUploadTo: string;
54
62
  localFile: IFileLocal;
@@ -59,6 +67,7 @@ export declare const uploadFile: ({ dispatch, idToUploadTo, localFile, originalF
59
67
  slowUploadConfig?: ISlowUploadDetectionConfig;
60
68
  apolloClient?: ApolloQueryClient;
61
69
  caseSalesforceId?: string;
70
+ onCaseFileUploaded?: () => void;
62
71
  }) => Promise<void>;
63
72
  export declare function doSosReportAnalysisForAllFiles(dispatch: any, idToUploadTo: string, localFiles: IFileLocal[], isSessionId: boolean): Promise<void>;
64
73
  export declare function doSosReportAnalysisForFile(dispatch: any, idToUploadTo: string, attachmentId: string, localFile: IFileLocal, isSessionId: boolean, fileIndex: number, fileUploadStatus?: UploadStatusConstants): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentHelper.d.ts","sourceRoot":"","sources":["../../../../../../src/components/shared/fileUpload/reducer/AttachmentHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAC3F,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAEvF,OAAO,EACH,iBAAiB,EAQpB,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EACH,uBAAuB,EAEvB,6BAA6B,EAK7B,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,eAAe,EAMf,qBAAqB,EACxB,MAAM,qBAAqB,CAAC;AAG7B,eAAO,MAAM,MAAM,GACd,6BAA6B,6BAA6B,EAAE,aAAa,OAAO,EAAE,mBAAiB,MACnG,eAAe,IAAI,EAAE,SA+BrB,CAAC;AAiBN,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,uDAAwD,CAAC;AAC5G,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,oDAAqD,CAAC;AACtG,eAAO,MAAM,wBAAwB,GAAI,QAAQ,MAAM,2DAA4D,CAAC;AACpH,eAAO,MAAM,qBAAqB,GAAI,QAAQ,MAAM,wDAAyD,CAAC;AAC9G,eAAO,MAAM,qBAAqB,GAAI,QAAQ,MAAM,wDAAyD,CAAC;AAC9G,eAAO,MAAM,uBAAuB,GAAI,QAAQ,MAAM,kGACiC,CAAC;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SAUvC,CAAC"}
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { Config, pcm, sessionAttachments } from '@cee-eng/hydrajs';
11
11
  import { ToastNotification } from '@rh-support/components';
12
- import { fetchCaseDetailsByCaseNumber, GET_CONTENT_DOCUMENT_IDS, getText, pendoTrackEvent, pollAttachmentUploadStatus, pollContentVersionStatus, uploadCaseAttachment, } from '@rh-support/utils';
12
+ import { fetchCaseDetailsByCaseNumber, GET_CONTENT_DOCUMENT_IDS, getText, MultipartUploadError, pendoTrackEvent, pollAttachmentUploadStatus, pollContentVersionStatus, uploadCaseAttachment, } from '@rh-support/utils';
13
13
  import find from 'lodash/find';
14
14
  import forEach from 'lodash/forEach';
15
15
  import includes from 'lodash/includes';
@@ -86,6 +86,18 @@ export const hasAnalysedSomeAttachments = (selectedLocalFiles) => !isEmpty(find(
86
86
  export const hasSomeUnUploadedAttachments = (selectedLocalFiles) => !isEmpty(find(selectedLocalFiles, (localFile) => !isUploading(localFile.uploadProgress.uploadStatus) &&
87
87
  !isUploadComplete(localFile.uploadProgress.uploadStatus) &&
88
88
  !isFileDeleted(localFile.uploadProgress.uploadStatus)));
89
+ /**
90
+ * Files still queued to start uploading. Aborted/failed are terminal and must not
91
+ * block post-upload discussion refresh when other files in the batch succeeded.
92
+ */
93
+ export const hasQueuedAttachmentUploads = (selectedLocalFiles) => !isEmpty(find(selectedLocalFiles, (localFile) => !isUploading(localFile.uploadProgress.uploadStatus) &&
94
+ !isUploadComplete(localFile.uploadProgress.uploadStatus) &&
95
+ !isFileDeleted(localFile.uploadProgress.uploadStatus) &&
96
+ !isUploadAborted(localFile.uploadProgress.uploadStatus) &&
97
+ !isUploadFailed(localFile.uploadProgress.uploadStatus)));
98
+ /** Aborted/failed rows should stay in the upload panel until the user clicks Remove. */
99
+ export const hasAbortedOrFailedAttachments = (selectedLocalFiles) => !isEmpty(find(selectedLocalFiles, (localFile) => isUploadAborted(localFile.uploadProgress.uploadStatus) ||
100
+ isUploadFailed(localFile.uploadProgress.uploadStatus)));
89
101
  export const hasSomeSelectedFiles = (selectedLocalFiles) => !isEmpty(selectedLocalFiles);
90
102
  export const isUploadingAttachment = (selectedLocalFiles) => !isEmpty(find(selectedLocalFiles, (localFile) => isUploading(localFile.uploadProgress.uploadStatus)));
91
103
  export const isAnalysingAnyAttachment = (selectedLocalFiles) => !isEmpty(find(selectedLocalFiles, (localFile) => isAnalysingFile(localFile.analysisMetadata.analysisStatus)));
@@ -93,9 +105,10 @@ export const canShowProgressBar = (file) => isUploading(file.uploadProgress.uplo
93
105
  export const shouldHideDescription = (file, isSessionUpload) => !file.uploadability.ableToUpload ||
94
106
  isUploading(file.uploadProgress.uploadStatus) ||
95
107
  (!isSessionUpload &&
96
- ((file.uploadability.ableToUpload &&
97
- file.uploadProgress.percentUploaded > 0 &&
98
- (file.description || '').length === 0) ||
108
+ (isUploadAborted(file.uploadProgress.uploadStatus) ||
109
+ (file.uploadability.ableToUpload &&
110
+ file.uploadProgress.percentUploaded > 0 &&
111
+ (file.description || '').length === 0) ||
99
112
  isUploadComplete(file.uploadProgress.uploadStatus)));
100
113
  export const isUploadOnTrack = (file) => !isUploadFailed(file.uploadProgress.uploadStatus) &&
101
114
  !isUploadAborted(file.uploadProgress.uploadStatus) &&
@@ -112,7 +125,7 @@ export const updateUploadMetadata = (dispatch, fileIndexToEdit, newUploadMetadat
112
125
  };
113
126
  export const uploadAllFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dispatch, idToUploadTo, caseFiles,
114
127
  // isSecureSupport, // TODO: Re-enable when Hydra/GraphQL attachment APIs support secure support again
115
- needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient, caseSalesforceId, }) {
128
+ needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient, caseSalesforceId, onCaseFileUploaded, }) {
116
129
  forEach(caseFiles.selectedLocalFiles, (localFile, index) => __awaiter(void 0, void 0, void 0, function* () {
117
130
  const fileStatus = new FileStatusHelper(localFile);
118
131
  if (fileStatus.isUploadComplete() ||
@@ -133,12 +146,13 @@ needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient
133
146
  slowUploadConfig,
134
147
  apolloClient,
135
148
  caseSalesforceId,
149
+ onCaseFileUploaded,
136
150
  });
137
151
  }));
138
152
  });
139
153
  export const uploadFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dispatch, idToUploadTo, localFile, originalFile, index,
140
154
  // isSecureSupport = false, // TODO: Re-enable when Hydra/GraphQL attachment APIs support secure support again
141
- needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient, caseSalesforceId, }) {
155
+ needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient, caseSalesforceId, onCaseFileUploaded, }) {
142
156
  if (!localFile.uploadability.ableToUpload) {
143
157
  return;
144
158
  }
@@ -210,7 +224,9 @@ needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient
210
224
  else {
211
225
  // Mirror master Hydra listener behavior for circular progress + abort button.
212
226
  let abortUpload;
227
+ let userAborted = false;
213
228
  const onAbort = (abortedFileIndex) => {
229
+ userAborted = true;
214
230
  const abortPayload = {
215
231
  percentUploaded: 0,
216
232
  onAbort: undefined,
@@ -219,7 +235,16 @@ needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient
219
235
  abortUpload === null || abortUpload === void 0 ? void 0 : abortUpload();
220
236
  updateUploadMetadata(dispatch, abortedFileIndex, abortPayload);
221
237
  };
238
+ // Register abort handler immediately so Cancel works before first progress tick
239
+ updateUploadMetadata(dispatch, index, {
240
+ uploadStatus: UploadStatusConstants.uploadingOnCase,
241
+ percentUploaded: 0,
242
+ uploadErrorMessage: '',
243
+ onAbort,
244
+ });
222
245
  attachmentId = yield uploadCaseAttachment(idToUploadTo, originalFile, (percent) => {
246
+ if (userAborted)
247
+ return;
223
248
  const verifyingUpdate = percent === 100;
224
249
  updateUploadMetadata(dispatch, index, {
225
250
  uploadStatus: verifyingUpdate
@@ -231,11 +256,25 @@ needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient
231
256
  });
232
257
  }, (abort) => {
233
258
  abortUpload = abort;
259
+ if (userAborted) {
260
+ abort();
261
+ return;
262
+ }
234
263
  updateUploadMetadata(dispatch, index, {
235
264
  uploadStatus: UploadStatusConstants.uploadingOnCase,
236
265
  onAbort,
237
266
  });
238
- });
267
+ }, undefined, localFile.uploadProgress.multipartResumeState
268
+ ? {
269
+ attachmentId: localFile.uploadProgress.multipartResumeState.attachmentId,
270
+ uploadId: localFile.uploadProgress.multipartResumeState.uploadId,
271
+ parts: localFile.uploadProgress.multipartResumeState.parts,
272
+ completedParts: localFile.uploadProgress.multipartResumeState.completedParts,
273
+ }
274
+ : undefined);
275
+ if (userAborted) {
276
+ return;
277
+ }
239
278
  if (apolloClient && caseSalesforceId) {
240
279
  updateUploadMetadata(dispatch, index, {
241
280
  uploadStatus: UploadStatusConstants.verifyingCaseUpload,
@@ -246,6 +285,17 @@ needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient
246
285
  }
247
286
  }
248
287
  attachmentId && updateAttachmentIdForFile(dispatch, attachmentId, index);
288
+ if (!isSessionId && attachmentId) {
289
+ // Hide from upload queue without shifting indices of in-flight siblings, then refresh discussion
290
+ updateUploadMetadata(dispatch, index, {
291
+ uploadStatus: UploadStatusConstants.deleted,
292
+ uploadErrorMessage: '',
293
+ percentUploaded: 100,
294
+ onAbort: undefined,
295
+ });
296
+ onCaseFileUploaded === null || onCaseFileUploaded === void 0 ? void 0 : onCaseFileUploaded();
297
+ return;
298
+ }
249
299
  const uploadPayload = {
250
300
  uploadStatus: isSessionId ? UploadStatusConstants.uploadedOnSession : UploadStatusConstants.uploadedOnCase,
251
301
  uploadErrorMessage: '',
@@ -260,7 +310,10 @@ needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient
260
310
  }
261
311
  catch (error) {
262
312
  if (error.message === 'Request aborted by user') {
263
- // Show alert if needed
313
+ const resumeState = error instanceof MultipartUploadError ? error.resumeData : undefined;
314
+ if (resumeState && resumeState.completedParts.length > 0) {
315
+ updateUploadMetadata(dispatch, index, { multipartResumeState: resumeState });
316
+ }
264
317
  }
265
318
  else {
266
319
  console.error(error);
@@ -269,9 +322,12 @@ needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient
269
322
  ? UploadStatusConstants.uploadOnSessionFailed
270
323
  : UploadStatusConstants.uploadOnCaseFailed,
271
324
  uploadErrorMessage: error.message,
272
- percentUploaded: 0,
273
325
  onAbort: undefined,
326
+ multipartResumeState: error instanceof MultipartUploadError ? error.resumeData : undefined,
274
327
  };
328
+ if (!uploadErrorPayload.multipartResumeState) {
329
+ uploadErrorPayload.percentUploaded = 0;
330
+ }
275
331
  updateAttachmentIdForFile(dispatch, null, index);
276
332
  updateUploadMetadata(dispatch, index, uploadErrorPayload);
277
333
  }
@@ -1,6 +1,7 @@
1
1
  import { CaseDiagnosticsStatus, ICaseDiagnosticsResponse } from '@cee-eng/hydrajs/@types/api/pcm/preCaseDiagnostics';
2
2
  import { Report } from '@cee-eng/hydrajs/@types/models/insights';
3
3
  import { IAction } from '@rh-support/types/shared';
4
+ import { IMultipartResumeData } from '@rh-support/utils';
4
5
  export declare enum AttachmentReducerConstants {
5
6
  caseFileSelected = "caseFileSelected",
6
7
  caseLocalFileEdited = "caseLocalFileEdited",
@@ -10,7 +11,8 @@ export declare enum AttachmentReducerConstants {
10
11
  updateAttachmentIdForFile = "updateAttachmentIdForFile",
11
12
  updateAnalysisMetadata = "updateAnalysisMetadata",
12
13
  udpateFileUploadMetadata = "udpateFileUploadMetadata",
13
- setShowUploadingOnSlowConnectionMsg = "setShowUploadingOnSlowConnectionMsg"
14
+ setShowUploadingOnSlowConnectionMsg = "setShowUploadingOnSlowConnectionMsg",
15
+ clearCompletedAttachments = "clearCompletedAttachments"
14
16
  }
15
17
  export declare enum UploadStatusConstants {
16
18
  attachedOnCase = "ATTACHED_ON_CASE",
@@ -53,6 +55,7 @@ export interface IUploadMetadata {
53
55
  uploadErrorMessage: string;
54
56
  onAbort: (abortedFileIndex: number) => void;
55
57
  percentUploaded: number;
58
+ multipartResumeState?: IMultipartResumeData;
56
59
  }
57
60
  export interface IAnalysisMetadata {
58
61
  analysisErrorMesssage?: string;
@@ -102,6 +105,7 @@ export declare const onFilesSelect: (dispatch: AttachmentReducerDispatchType, ca
102
105
  export declare const onFileEdit: (dispatch: AttachmentReducerDispatchType, editedLocalFile: IFileLocal, fileIndexToEdit: number) => void;
103
106
  export declare const onFileRemove: (dispatch: AttachmentReducerDispatchType, fileIndexToRemove: number) => void;
104
107
  export declare const resetAttachment: (dispatch: AttachmentReducerDispatchType) => void;
108
+ export declare const clearCompletedAttachments: (dispatch: AttachmentReducerDispatchType) => void;
105
109
  export declare const onIncludeExcludeResults: (dispatch: AttachmentReducerDispatchType, includeResults: boolean) => void;
106
110
  export declare const updateAttachmentIdForFile: (dispatch: AttachmentReducerDispatchType, attachmentId: string, fileIndexToEdit: number) => void;
107
111
  export declare const updateAnalysisMetadata: (dispatch: AttachmentReducerDispatchType, analysisMetadata: Partial<IAnalysisMetadata>, fileIndexToEdit: number) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentReducer.d.ts","sourceRoot":"","sources":["../../../../../../src/components/shared/fileUpload/reducer/AttachmentReducer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,oDAAoD,CAAC;AACrH,OAAO,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAMnD,oBAAY,0BAA0B;IAClC,gBAAgB,qBAAqB;IACrC,mBAAmB,wBAAwB;IAC3C,eAAe,oBAAoB;IACnC,eAAe,oBAAoB;IACnC,sBAAsB,2BAA2B;IACjD,yBAAyB,8BAA8B;IACvD,sBAAsB,2BAA2B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I,QAAQ,gBAAgB,EAAE,QAAQ,WAAW,KAAG,gBAmHjF,CAAC;AAGF,eAAO,MAAM,aAAa,GAAI,UAAU,6BAA6B,EAAE,WAAW,UAAU,SAE3F,CAAC;AACF,eAAO,MAAM,UAAU,GACnB,UAAU,6BAA6B,EACvC,iBAAiB,UAAU,EAC3B,iBAAiB,MAAM,SAG1B,CAAC;AACF,eAAO,MAAM,YAAY,GAAI,UAAU,6BAA6B,EAAE,mBAAmB,MAAM,SAE9F,CAAC;AACF,eAAO,MAAM,eAAe,GAAI,UAAU,6BAA6B,SAEtE,CAAC;AACF,eAAO,MAAM,uBAAuB,GAAI,UAAU,6BAA6B,EAAE,gBAAgB,OAAO,SAEvG,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAClC,UAAU,6BAA6B,EACvC,cAAc,MAAM,EACpB,iBAAiB,MAAM,SAM1B,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAC/B,UAAU,6BAA6B,EACvC,kBAAkB,OAAO,CAAC,iBAAiB,CAAC,EAC5C,iBAAiB,MAAM,SAM1B,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACjC,UAAU,6BAA6B,EACvC,gBAAgB,OAAO,CAAC,eAAe,CAAC,EACxC,iBAAiB,MAAM,SAM1B,CAAC"}
1
+ {"version":3,"file":"AttachmentReducer.d.ts","sourceRoot":"","sources":["../../../../../../src/components/shared/fileUpload/reducer/AttachmentReducer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,oDAAoD,CAAC;AACrH,OAAO,EAAE,MAAM,EAAE,MAAM,yCAAyC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAMzD,oBAAY,0BAA0B;IAClC,gBAAgB,qBAAqB;IACrC,mBAAmB,wBAAwB;IAC3C,eAAe,oBAAoB;IACnC,eAAe,oBAAoB;IACnC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sBAAsB,CAAC,CAAC;AAC/E,MAAM,MAAM,6BAA6B,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AAEzE,eAAO,MAAM,iBAAiB,GAAI,QAAQ,gBAAgB,EAAE,QAAQ,WAAW,KAAG,gBA0IjF,CAAC;AAGF,eAAO,MAAM,aAAa,GAAI,UAAU,6BAA6B,EAAE,WAAW,UAAU,SAE3F,CAAC;AACF,eAAO,MAAM,UAAU,GACnB,UAAU,6BAA6B,EACvC,iBAAiB,UAAU,EAC3B,iBAAiB,MAAM,SAG1B,CAAC;AACF,eAAO,MAAM,YAAY,GAAI,UAAU,6BAA6B,EAAE,mBAAmB,MAAM,SAE9F,CAAC;AACF,eAAO,MAAM,eAAe,GAAI,UAAU,6BAA6B,SAEtE,CAAC;AACF,eAAO,MAAM,yBAAyB,GAAI,UAAU,6BAA6B,SAEhF,CAAC;AACF,eAAO,MAAM,uBAAuB,GAAI,UAAU,6BAA6B,EAAE,gBAAgB,OAAO,SAEvG,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAClC,UAAU,6BAA6B,EACvC,cAAc,MAAM,EACpB,iBAAiB,MAAM,SAM1B,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAC/B,UAAU,6BAA6B,EACvC,kBAAkB,OAAO,CAAC,iBAAiB,CAAC,EAC5C,iBAAiB,MAAM,SAM1B,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACjC,UAAU,6BAA6B,EACvC,gBAAgB,OAAO,CAAC,eAAe,CAAC,EACxC,iBAAiB,MAAM,SAM1B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { pcm } from '@cee-eng/hydrajs';
2
2
  import forEach from 'lodash/forEach';
3
- import { isAnalysingAnyAttachment, isUploadingAttachment } from './AttachmentHelper';
3
+ import { isAnalysingAnyAttachment, isUploadComplete, isUploadingAttachment } from './AttachmentHelper';
4
4
  // Constants
5
5
  export var AttachmentReducerConstants;
6
6
  (function (AttachmentReducerConstants) {
@@ -13,6 +13,7 @@ export var AttachmentReducerConstants;
13
13
  AttachmentReducerConstants["updateAnalysisMetadata"] = "updateAnalysisMetadata";
14
14
  AttachmentReducerConstants["udpateFileUploadMetadata"] = "udpateFileUploadMetadata";
15
15
  AttachmentReducerConstants["setShowUploadingOnSlowConnectionMsg"] = "setShowUploadingOnSlowConnectionMsg";
16
+ AttachmentReducerConstants["clearCompletedAttachments"] = "clearCompletedAttachments";
16
17
  })(AttachmentReducerConstants || (AttachmentReducerConstants = {}));
17
18
  export var UploadStatusConstants;
18
19
  (function (UploadStatusConstants) {
@@ -160,6 +161,24 @@ export const attachmentReducer = (pState, action) => {
160
161
  case AttachmentReducerConstants.setShowUploadingOnSlowConnectionMsg: {
161
162
  return Object.assign(Object.assign({}, pState), { showUploadingOnSlowConnectionMsg: action.payload.showUploadingOnSlowConnectionMsg });
162
163
  }
164
+ case AttachmentReducerConstants.clearCompletedAttachments: {
165
+ const selectedLocalFiles = pState.caseFiles.selectedLocalFiles;
166
+ const selectedOriginalFiles = pState.caseFiles.selectedOriginalFiles;
167
+ const keptLocalFiles = [];
168
+ const keptOriginalFiles = [];
169
+ selectedLocalFiles.forEach((localFile, index) => {
170
+ if (!isUploadComplete(localFile.uploadProgress.uploadStatus)) {
171
+ keptLocalFiles.push(localFile);
172
+ if (selectedOriginalFiles[index]) {
173
+ keptOriginalFiles.push(selectedOriginalFiles[index]);
174
+ }
175
+ }
176
+ });
177
+ return Object.assign(Object.assign({}, pState), { caseFiles: {
178
+ selectedLocalFiles: keptLocalFiles,
179
+ selectedOriginalFiles: keptOriginalFiles,
180
+ } });
181
+ }
163
182
  default: {
164
183
  return pState;
165
184
  }
@@ -178,6 +197,9 @@ export const onFileRemove = (dispatch, fileIndexToRemove) => {
178
197
  export const resetAttachment = (dispatch) => {
179
198
  dispatch({ type: AttachmentReducerConstants.resetAttachment });
180
199
  };
200
+ export const clearCompletedAttachments = (dispatch) => {
201
+ dispatch({ type: AttachmentReducerConstants.clearCompletedAttachments });
202
+ };
181
203
  export const onIncludeExcludeResults = (dispatch, includeResults) => {
182
204
  dispatch({ type: AttachmentReducerConstants.caseFileIncludeExclude, payload: { includeResults } });
183
205
  };
@@ -7,5 +7,7 @@ export interface IFileUploaderCommonProps {
7
7
  autoUploadOnSelect?: boolean;
8
8
  isPrivate?: boolean;
9
9
  onUploadClick?: () => void;
10
+ /** Fired after each successful case attachment upload so discussion can refresh immediately. */
11
+ onCaseFileUploaded?: () => void;
10
12
  }
11
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/shared/fileUpload/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IAGrC,YAAY,EAAE,MAAM,CAAC;IACrB,iGAAiG;IACjG,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/shared/fileUpload/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;IAGrC,YAAY,EAAE,MAAM,CAAC;IACrB,iGAAiG;IACjG,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,gGAAgG;IAChG,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useFileUploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/fileUpload/useFileUploader.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA8D,MAAM,OAAO,CAAC;AAenF,OAAO,EAAE,UAAU,EAAmD,MAAM,6BAA6B,CAAC;AAE1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,wBAAgB,eAAe,CAAC,KAAK,EAAE,wBAAwB;gCAsEjB,MAAM;gCAYA,UAAU,mBAAmB,MAAM,WAAW,UAAU;oCAOpD,MAAM,QAAQ,UAAU;wBA0BzC,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC;4BA8B3C,MAAM;kCAtEN,MAAM;EA+FhD"}
1
+ {"version":3,"file":"useFileUploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/fileUpload/useFileUploader.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA8D,MAAM,OAAO,CAAC;AAenF,OAAO,EAAE,UAAU,EAAmD,MAAM,6BAA6B,CAAC;AAE1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,wBAAgB,eAAe,CAAC,KAAK,EAAE,wBAAwB;gCA8EjB,MAAM;gCAYA,UAAU,mBAAmB,MAAM,WAAW,UAAU;oCAOpD,MAAM,QAAQ,UAAU;wBA8BzC,KAAK,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC;4BA+B3C,MAAM;kCA3EN,MAAM;EAqGhD"}