@rh-support/troubleshoot 2.6.303 → 2.6.304
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/Case.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Case.js +5 -17
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseAttachment.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseAttachment.js +69 -21
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.js +53 -72
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useMarkdownFileUploader.d.ts +1 -2
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useMarkdownFileUploader.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useMarkdownFileUploader.js +13 -8
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts +2 -0
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.js +63 -26
- package/lib/esm/components/CaseInformation/FileDiag.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/FileDiag.js +10 -3
- package/lib/esm/components/ConfirmationModals/NoAttachmentSelectedModal.d.ts.map +1 -1
- package/lib/esm/components/ConfirmationModals/NoAttachmentSelectedModal.js +5 -3
- package/lib/esm/components/SubmitCase/SubmitCase.d.ts.map +1 -1
- package/lib/esm/components/SubmitCase/SubmitCase.js +1 -1
- package/lib/esm/components/shared/fileUpload/FileUploader.d.ts.map +1 -1
- package/lib/esm/components/shared/fileUpload/FileUploader.js +1 -1
- package/lib/esm/components/shared/fileUpload/WidgetFileUploader.d.ts.map +1 -1
- package/lib/esm/components/shared/fileUpload/WidgetFileUploader.js +2 -2
- package/lib/esm/components/shared/fileUpload/fileSelectors/FileSelectorButton.d.ts +1 -1
- package/lib/esm/components/shared/fileUpload/fileSelectors/FileSelectorButton.d.ts.map +1 -1
- package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.d.ts +8 -7
- package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.d.ts.map +1 -1
- package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.js +39 -48
- package/lib/esm/components/shared/fileUpload/types/index.d.ts +2 -1
- package/lib/esm/components/shared/fileUpload/types/index.d.ts.map +1 -1
- package/lib/esm/components/shared/fileUpload/useFileUploader.d.ts +2 -2
- package/lib/esm/components/shared/fileUpload/useFileUploader.d.ts.map +1 -1
- package/lib/esm/components/shared/fileUpload/useFileUploader.js +38 -14
- package/lib/esm/hooks/useS3Upload.d.ts +5 -4
- package/lib/esm/hooks/useS3Upload.d.ts.map +1 -1
- package/lib/esm/hooks/useS3Upload.js +25 -30
- package/lib/esm/reducers/CaseDetailsPageReducer.d.ts +2 -1
- package/lib/esm/reducers/CaseDetailsPageReducer.d.ts.map +1 -1
- package/lib/esm/reducers/CaseDetailsPageReducer.js +12 -4
- package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts +2 -1
- package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts.map +1 -1
- package/lib/esm/reducers/CaseDiscussionTabReducer.js +11 -4
- package/package.json +6 -6
|
@@ -7,10 +7,11 @@ 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 { sessionAttachments } from '@cee-eng/hydrajs';
|
|
11
12
|
import { useFetch, usePrevious } from '@rh-support/components';
|
|
12
13
|
import { GlobalMetadataStateContext } from '@rh-support/react-context';
|
|
13
|
-
import { getConfigField, getUserAgentForCaseMode, PCM_CONFIG_FIELD_TYPE } from '@rh-support/utils';
|
|
14
|
+
import { deleteCaseAttachment, fetchCaseDetailsByCaseNumber, getConfigField, getUserAgentForCaseMode, PCM_CONFIG_FIELD_TYPE, } from '@rh-support/utils';
|
|
14
15
|
import debounce from 'lodash/debounce';
|
|
15
16
|
import { useCallback, useContext, useEffect, useMemo, useRef } from 'react';
|
|
16
17
|
import { SessionRestoreDispatchContext, SessionRestoreStateContext } from '../../../context/SessionRestoreContext';
|
|
@@ -23,9 +24,16 @@ import { AttachmentDispatchContext, AttachmentStateContext } from './reducer/Att
|
|
|
23
24
|
export function useFileUploader(props) {
|
|
24
25
|
const { attachmentState, attachmentState: { caseFiles }, } = useContext(AttachmentStateContext);
|
|
25
26
|
const dispatch = useContext(AttachmentDispatchContext);
|
|
27
|
+
const apolloClient = useApolloClient();
|
|
28
|
+
const caseSalesforceIdRef = useRef();
|
|
26
29
|
const { request: deleteSessionAttachment } = useFetch(sessionAttachments.deleteSesionAttachment);
|
|
27
|
-
const { request:
|
|
28
|
-
const { idToUploadTo,
|
|
30
|
+
const { request: deleteCaseAttachmentRequest } = useFetch(deleteCaseAttachment);
|
|
31
|
+
const { idToUploadTo, caseSalesforceId, needsAnalyzing, isSessionId, autoUploadOnSelect, onUploadClick } = props;
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (caseSalesforceId) {
|
|
34
|
+
caseSalesforceIdRef.current = caseSalesforceId;
|
|
35
|
+
}
|
|
36
|
+
}, [caseSalesforceId]);
|
|
29
37
|
const { globalMetadataState: { pcmConfig, referrerUrl, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
|
|
30
38
|
const { sessionRestore } = useContext(SessionRestoreStateContext);
|
|
31
39
|
const sessionRestoreDispatch = useContext(SessionRestoreDispatchContext);
|
|
@@ -55,11 +63,11 @@ export function useFileUploader(props) {
|
|
|
55
63
|
sessionAttachments.updateSessionAttachmentMetadata(idToUploadTo, [Object.assign({ id: file.attachmentId }, changes)]);
|
|
56
64
|
}), [idToUploadTo]);
|
|
57
65
|
const debounceSessionMetadataUpdate = useMemo(() => debounce(updateSessionAttachmentMetadata, 800), [updateSessionAttachmentMetadata]);
|
|
58
|
-
const onRetryLocal = (indexToRetry) => {
|
|
66
|
+
const onRetryLocal = (indexToRetry) => __awaiter(this, void 0, void 0, function* () {
|
|
59
67
|
if (idToUploadTo && attachmentState.caseFiles.selectedLocalFiles[indexToRetry]) {
|
|
60
|
-
onUploadFile(indexToRetry);
|
|
68
|
+
yield onUploadFile(indexToRetry);
|
|
61
69
|
}
|
|
62
|
-
};
|
|
70
|
+
});
|
|
63
71
|
const onRetryAnalysis = (indexToRetry) => {
|
|
64
72
|
const file = attachmentState.caseFiles.selectedLocalFiles[indexToRetry];
|
|
65
73
|
if (idToUploadTo && file && file.attachmentId) {
|
|
@@ -85,12 +93,25 @@ export function useFileUploader(props) {
|
|
|
85
93
|
});
|
|
86
94
|
}
|
|
87
95
|
isUploadedSuccessfully(file) && isSessionId && deleteSessionAttachment(idToUploadTo, file.attachmentId);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
96
|
+
// TODO: Re-enable when delete API accepts isSecureSupport again
|
|
97
|
+
// isUploadedSuccessfully(file) && !isSessionId && deleteCaseAttachment(idToUploadTo, file.attachmentId, isSecureSupport);
|
|
98
|
+
isUploadedSuccessfully(file) && !isSessionId && deleteCaseAttachmentRequest(idToUploadTo, file.attachmentId);
|
|
99
|
+
});
|
|
100
|
+
const resolveCaseSalesforceId = () => __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
if (caseSalesforceIdRef.current || isSessionId || !idToUploadTo || !apolloClient) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
const caseDetails = yield fetchCaseDetailsByCaseNumber(apolloClient, idToUploadTo);
|
|
106
|
+
caseSalesforceIdRef.current = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.id;
|
|
107
|
+
}
|
|
108
|
+
catch (_a) {
|
|
109
|
+
caseSalesforceIdRef.current = undefined;
|
|
110
|
+
}
|
|
91
111
|
});
|
|
92
112
|
const onUploadAll = (event) => __awaiter(this, void 0, void 0, function* () {
|
|
93
113
|
onUploadClick && onUploadClick();
|
|
114
|
+
yield resolveCaseSalesforceId();
|
|
94
115
|
// on truobleshoot flow, user can upload a file while no data has added therefore no sessionId is available
|
|
95
116
|
let sessionId = '';
|
|
96
117
|
if (!idToUploadTo) {
|
|
@@ -109,25 +130,28 @@ export function useFileUploader(props) {
|
|
|
109
130
|
dispatch,
|
|
110
131
|
idToUploadTo: idToUploadTo || sessionId,
|
|
111
132
|
caseFiles,
|
|
112
|
-
isSecureSupport,
|
|
113
133
|
needsAnalyzing,
|
|
114
134
|
isSessionId,
|
|
115
135
|
slowUploadConfig,
|
|
136
|
+
apolloClient: !isSessionId ? apolloClient : undefined,
|
|
137
|
+
caseSalesforceId: !isSessionId ? caseSalesforceIdRef.current : undefined,
|
|
116
138
|
});
|
|
117
139
|
});
|
|
118
|
-
const onUploadFile = (fileIndex) => {
|
|
140
|
+
const onUploadFile = (fileIndex) => __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
yield resolveCaseSalesforceId();
|
|
119
142
|
uploadFile({
|
|
120
143
|
dispatch,
|
|
121
144
|
idToUploadTo,
|
|
122
145
|
localFile: attachmentState.caseFiles.selectedLocalFiles[fileIndex],
|
|
123
146
|
originalFile: attachmentState.caseFiles.selectedOriginalFiles[fileIndex],
|
|
124
147
|
index: fileIndex,
|
|
125
|
-
isSecureSupport,
|
|
126
148
|
needsAnalyzing,
|
|
127
149
|
isSessionId,
|
|
128
150
|
slowUploadConfig,
|
|
151
|
+
apolloClient: !isSessionId ? apolloClient : undefined,
|
|
152
|
+
caseSalesforceId: !isSessionId ? caseSalesforceIdRef.current : undefined,
|
|
129
153
|
});
|
|
130
|
-
};
|
|
154
|
+
});
|
|
131
155
|
return {
|
|
132
156
|
retryUpload: onRetryLocal,
|
|
133
157
|
editFile: onFileEditLocal,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ApolloQueryClient } from '@rh-support/utils';
|
|
2
|
+
export declare function useS3Upload(caseNumber: string, apolloClient?: ApolloQueryClient, caseSalesforceId?: string): {
|
|
3
|
+
uploadFile: ({ file, description, isPrivate, listenerFn, }: {
|
|
4
|
+
file: File;
|
|
4
5
|
description?: string;
|
|
5
6
|
isPrivate?: boolean;
|
|
6
|
-
listenerFn?: (percent:
|
|
7
|
+
listenerFn?: (percent: number, abort: () => void) => void;
|
|
7
8
|
}) => Promise<string>;
|
|
8
9
|
isUploadingFile: boolean;
|
|
9
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useS3Upload.d.ts","sourceRoot":"","sources":["../../../src/hooks/useS3Upload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useS3Upload.d.ts","sourceRoot":"","sources":["../../../src/hooks/useS3Upload.ts"],"names":[],"mappings":"AACA,OAAO,EACH,iBAAiB,EAIpB,MAAM,mBAAmB,CAAC;AAU3B,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,iBAAiB,EAAE,gBAAgB,CAAC,EAAE,MAAM;gEAuBpG;QACC,IAAI,EAAE,IAAI,CAAC;QACX,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;KAC7D;;EA4CJ"}
|
|
@@ -7,13 +7,12 @@ 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 {
|
|
11
|
-
import {
|
|
10
|
+
import { ToastNotification } from '@rh-support/components';
|
|
11
|
+
import { fetchCaseDetailsByCaseNumber, pollAttachmentUploadStatus, uploadCaseAttachment, } from '@rh-support/utils';
|
|
12
12
|
import { useTranslation } from 'react-i18next';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
13
|
+
// TODO: Re-enable when Hydra/GraphQL attachment APIs support secure support again
|
|
14
|
+
// Previously: useS3Upload(idToUploadTo, isSecureSupport) and passed isSecureSupport into uploadAttachmentS3
|
|
15
|
+
export function useS3Upload(caseNumber, apolloClient, caseSalesforceId) {
|
|
17
16
|
const { t } = useTranslation();
|
|
18
17
|
const getFileAccessDetails = (file) => __awaiter(this, void 0, void 0, function* () {
|
|
19
18
|
const fileName = (file === null || file === void 0 ? void 0 : file.name) || '';
|
|
@@ -23,12 +22,11 @@ export function useS3Upload(idToUploadTo, isSecureSupport) {
|
|
|
23
22
|
const reader = new FileReader();
|
|
24
23
|
return new Promise((resolve, reject) => {
|
|
25
24
|
reader.onloadend = () => resolve({ ableToUpload: true, ableToUploadMessage: 'File attached, but not yet uploaded' });
|
|
26
|
-
reader.onerror = (
|
|
27
|
-
// only read the first 10 bytes. readAsBinaryString is not supported in IE 11
|
|
25
|
+
reader.onerror = () => reject({ ableToUpload: false, ableToUploadMessage: `${fileName} ${t("Can't be selected")}` });
|
|
28
26
|
reader.readAsArrayBuffer(file.slice(0, 10));
|
|
29
27
|
});
|
|
30
28
|
});
|
|
31
|
-
const uploadFile = (_a) => __awaiter(this, [_a], void 0, function* ({ file, description = '', isPrivate = false, listenerFn = (
|
|
29
|
+
const uploadFile = (_a) => __awaiter(this, [_a], void 0, function* ({ file, description = '', isPrivate = false, listenerFn = (_percent, _abort) => { }, }) {
|
|
32
30
|
try {
|
|
33
31
|
yield getFileAccessDetails(file);
|
|
34
32
|
}
|
|
@@ -38,33 +36,30 @@ export function useS3Upload(idToUploadTo, isSecureSupport) {
|
|
|
38
36
|
return;
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
|
-
const listener = (progress, abort) => {
|
|
42
|
-
const decimal = progress.loaded / progress.total;
|
|
43
|
-
const percent = decimal * 100;
|
|
44
|
-
// const verifyingUpdate = decimal === 1;
|
|
45
|
-
const currentUploadProgress = Math.floor(percent);
|
|
46
|
-
// Forwarding abort single to parent callback function
|
|
47
|
-
listenerFn(currentUploadProgress, abort);
|
|
48
|
-
};
|
|
49
|
-
const putObjectRequest = {
|
|
50
|
-
Body: file, // use the original file for upload
|
|
51
|
-
ContentLength: file.size,
|
|
52
|
-
Metadata: Object.assign(Object.assign(Object.assign(Object.assign({}, (description && { 'x-amz-meta-description': description })), (file.name && { 'x-amz-meta-fileName': file.name })), (file.size && { 'x-amz-meta-byteLength': file.size.toString() })), (file.type && { 'x-amz-meta-content-type': file.type })),
|
|
53
|
-
};
|
|
54
39
|
try {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
40
|
+
let abortFn;
|
|
41
|
+
const attachmentId = yield uploadCaseAttachment(caseNumber, file, (percent) => listenerFn(percent, () => abortFn === null || abortFn === void 0 ? void 0 : abortFn()), (abort) => {
|
|
42
|
+
abortFn = abort;
|
|
43
|
+
});
|
|
44
|
+
let resolvedCaseSalesforceId = caseSalesforceId;
|
|
45
|
+
if (apolloClient && !resolvedCaseSalesforceId) {
|
|
46
|
+
const caseDetails = yield fetchCaseDetailsByCaseNumber(apolloClient, caseNumber);
|
|
47
|
+
resolvedCaseSalesforceId = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.id;
|
|
48
|
+
}
|
|
49
|
+
if (apolloClient && resolvedCaseSalesforceId) {
|
|
50
|
+
yield pollAttachmentUploadStatus(apolloClient, resolvedCaseSalesforceId, attachmentId);
|
|
51
|
+
}
|
|
61
52
|
return attachmentId;
|
|
62
53
|
}
|
|
63
54
|
catch (error) {
|
|
64
55
|
if (error.message === 'Request aborted by user') {
|
|
65
|
-
|
|
56
|
+
return;
|
|
66
57
|
}
|
|
58
|
+
throw error;
|
|
67
59
|
}
|
|
68
60
|
});
|
|
69
|
-
return {
|
|
61
|
+
return {
|
|
62
|
+
uploadFile,
|
|
63
|
+
isUploadingFile: false,
|
|
64
|
+
};
|
|
70
65
|
}
|
|
@@ -2,6 +2,7 @@ import { ICommentFeedback } from '@cee-eng/hydrajs/@types/api/public/commentFeed
|
|
|
2
2
|
import { IAttachment } from '@cee-eng/hydrajs/@types/models/attachment';
|
|
3
3
|
import { ICaseEscalation } from '@cee-eng/hydrajs/@types/models/escalation';
|
|
4
4
|
import { IAction, IApiResponseDetails } from '@rh-support/types/shared';
|
|
5
|
+
import { ApolloQueryClient } from '@rh-support/utils';
|
|
5
6
|
type IActionType = IAction<CaseDetailsConstants, ICaseViewState>;
|
|
6
7
|
export type CaseDetailsReducerDispatchType = (value: IActionType) => void;
|
|
7
8
|
export declare enum CaseDetailsConstants {
|
|
@@ -15,7 +16,7 @@ export interface ICaseViewState {
|
|
|
15
16
|
}
|
|
16
17
|
export declare const initialCaseDetailsPageState: ICaseViewState;
|
|
17
18
|
export declare const caseDetailsPageReducer: (state: ICaseViewState, action: IActionType) => any;
|
|
18
|
-
export declare const fetchAttachments: (dispatch: CaseDetailsReducerDispatchType, caseNumber: string,
|
|
19
|
+
export declare const fetchAttachments: (dispatch: CaseDetailsReducerDispatchType, caseNumber: string, apolloClient: ApolloQueryClient, caseSalesforceId?: string) => Promise<void>;
|
|
19
20
|
export declare const fetchFeedbacks: (dispatch: CaseDetailsReducerDispatchType, caseNumber: string) => Promise<void>;
|
|
20
21
|
export declare const fetchExternalTrackers: (_dispatch: CaseDetailsReducerDispatchType, _caseNumber: string) => Promise<void>;
|
|
21
22
|
export declare const fetchCaseEscalations: (dispatch: CaseDetailsReducerDispatchType, parentId: string, apolloClient: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseDetailsPageReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/CaseDetailsPageReducer.ts"],"names":[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AW,KAAG,GASnF,CAAC;AAEF,eAAO,MAAM,gBAAgB,GACzB,UAAU,8BAA8B,EACxC,YAAY,MAAM,EAClB,cAAc,iBAAiB,EAC/B,mBAAmB,MAAM,kBA+B5B,CAAC;AAEF,eAAO,MAAM,cAAc,GAAU,UAAU,8BAA8B,EAAE,YAAY,MAAM,kBAoBhG,CAAC;AAsBF,eAAO,MAAM,qBAAqB,GAAU,WAAW,8BAA8B,EAAE,aAAa,MAAM,kBAEzG,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC7B,UAAU,8BAA8B,EACxC,UAAU,MAAM,EAChB,cAAc;IAAE,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;CAAE,EACvD,oBAAiB,kBAgCpB,CAAC"}
|
|
@@ -7,8 +7,8 @@ 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 {
|
|
11
|
-
import { getApiResourceObject } from '@rh-support/utils';
|
|
10
|
+
import { publicApi } from '@cee-eng/hydrajs';
|
|
11
|
+
import { fetchCaseAttachmentsViaGraphQL, fetchCaseDetailsByCaseNumber, getApiResourceObject, } from '@rh-support/utils';
|
|
12
12
|
import { GET_ESCALATION_DETAILS } from '../graphql';
|
|
13
13
|
export var CaseDetailsConstants;
|
|
14
14
|
(function (CaseDetailsConstants) {
|
|
@@ -32,13 +32,21 @@ export const caseDetailsPageReducer = (state, action) => {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
export const fetchAttachments = (dispatch, caseNumber,
|
|
35
|
+
export const fetchAttachments = (dispatch, caseNumber, apolloClient, caseSalesforceId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
36
|
try {
|
|
37
37
|
dispatch({
|
|
38
38
|
type: CaseDetailsConstants.updateState,
|
|
39
39
|
payload: { caseAttachmentHydra: getApiResourceObject([], true) },
|
|
40
40
|
});
|
|
41
|
-
|
|
41
|
+
let resolvedCaseSalesforceId = caseSalesforceId;
|
|
42
|
+
if (!resolvedCaseSalesforceId) {
|
|
43
|
+
const caseDetails = yield fetchCaseDetailsByCaseNumber(apolloClient, caseNumber);
|
|
44
|
+
resolvedCaseSalesforceId = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.id;
|
|
45
|
+
}
|
|
46
|
+
if (!resolvedCaseSalesforceId) {
|
|
47
|
+
throw new Error('Missing Salesforce case id');
|
|
48
|
+
}
|
|
49
|
+
const allAttachments = yield fetchCaseAttachmentsViaGraphQL(apolloClient, caseNumber, resolvedCaseSalesforceId);
|
|
42
50
|
dispatch({
|
|
43
51
|
type: CaseDetailsConstants.updateState,
|
|
44
52
|
payload: { caseAttachmentHydra: getApiResourceObject(allAttachments) },
|
|
@@ -2,6 +2,7 @@ import { ICaseChat, ICaseComment } from '@cee-eng/hydrajs/@types/api/public/case
|
|
|
2
2
|
import { ICommentFeedback } from '@cee-eng/hydrajs/@types/api/public/commentFeedback';
|
|
3
3
|
import { IAttachment } from '@cee-eng/hydrajs/@types/models/attachment';
|
|
4
4
|
import { IAction } from '@rh-support/types/shared';
|
|
5
|
+
import { ApolloQueryClient } from '@rh-support/utils';
|
|
5
6
|
type IActionType = IAction<DiscussionsConstants, IDiscussionState>;
|
|
6
7
|
export type DiscussionsReducerDispatchType = (value: IActionType) => void;
|
|
7
8
|
export interface IDiscussion {
|
|
@@ -48,7 +49,7 @@ export declare const setDiscussions: (dispatch: DiscussionsReducerDispatchType,
|
|
|
48
49
|
export declare const updateAttacmentsAfterRemoval: (dispatch: DiscussionsReducerDispatchType, uuid_removed: string, allDiscussions: IDiscussion[], discussionFiltersListState: IFilter[]) => void;
|
|
49
50
|
export declare const updateCommentStateFeedback: (dispatch: DiscussionsReducerDispatchType, comment_id: string, newFeedback: any, allDiscussions: IDiscussion[]) => Promise<void>;
|
|
50
51
|
export declare const updateAttachment: (dispatch: DiscussionsReducerDispatchType, uuid: string, newAttachment: any, allDiscussions: IDiscussion[]) => void;
|
|
51
|
-
export declare const updateDiscussionStateAttachments: (dispatch: DiscussionsReducerDispatchType, caseNumber: string, allDiscussions: IDiscussion[], sort: ISort,
|
|
52
|
+
export declare const updateDiscussionStateAttachments: (dispatch: DiscussionsReducerDispatchType, caseNumber: string, allDiscussions: IDiscussion[], sort: ISort, discussionFiltersListState: IFilter[], dispatchCaseDetailsHydraAttachments: any, apolloClient: ApolloQueryClient, caseSalesforceId?: string) => Promise<void>;
|
|
52
53
|
export declare const setCommentText: (dispatch: DiscussionsReducerDispatchType, replyCommentText: string, replyCommentCreator: string) => void;
|
|
53
54
|
export declare const clearReplyComment: (dispatch: DiscussionsReducerDispatchType) => void;
|
|
54
55
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseDiscussionTabReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/CaseDiscussionTabReducer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CaseDiscussionTabReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/CaseDiscussionTabReducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EACH,iBAAiB,EAIpB,MAAM,mBAAmB,CAAC;AAQ3B,KAAK,WAAW,GAAG,OAAO,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,CAAC;AACnE,MAAM,MAAM,8BAA8B,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AAE1E,MAAM,WAAW,WAAW;IAGxB,IAAI,EAAE,OAAO,CAAC,YAAY,GAAG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CAAC;AAOF,eAAO,MAAM,cAAc,GACvB,UAAU,8BAA8B,EACxC,UAAU,YAAY,EAAE,EACxB,OAAO,SAAS,EAAE,EAClB,aAAa,WAAW,EAAE,EAC1B,WAAW,gBAAgB,EAAE,EAG7B,gBAAgB,OAAO,CAAC,OAAO,EAAE,CAAC,EAClC,4BAA4B,OAAO,EAAE,EAGrC,uBAAuB,OAAO,EAC9B,YAAY,OAAO,EACnB,mBAAmB,OAAO,SA8E7B,CAAC;AAEF,eAAO,MAAM,4BAA4B,GACrC,UAAU,8BAA8B,EACxC,cAAc,MAAM,EACpB,gBAAgB,WAAW,EAAE,EAC7B,4BAA4B,OAAO,EAAE,SAsBxC,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACnC,UAAU,8BAA8B,EACxC,YAAY,MAAM,EAClB,gBAAW,EACX,gBAAgB,WAAW,EAAE,kBAUhC,CAAC;AAEF,eAAO,MAAM,gBAAgB,GACzB,UAAU,8BAA8B,EACxC,MAAM,MAAM,EACZ,kBAAa,EACb,gBAAgB,WAAW,EAAE,SAUhC,CAAC;AAEF,eAAO,MAAM,gCAAgC,GACzC,UAAU,8BAA8B,EACxC,YAAY,MAAM,EAClB,gBAAgB,WAAW,EAAE,EAC7B,MAAM,KAAK,EACX,4BAA4B,OAAO,EAAE,EACrC,wCAAmC,EACnC,cAAc,iBAAiB,EAC/B,mBAAmB,MAAM,kBAwC5B,CAAC;AAEF,eAAO,MAAM,cAAc,GACvB,UAAU,8BAA8B,EACxC,kBAAkB,MAAM,EACxB,qBAAqB,MAAM,SAG9B,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,UAAU,8BAA8B,SAKzE,CAAC"}
|
|
@@ -7,8 +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 {
|
|
11
|
-
import { getApiResourceObject } from '@rh-support/utils';
|
|
10
|
+
import { fetchCaseAttachmentsViaGraphQL, fetchCaseDetailsByCaseNumber, getApiResourceObject, } from '@rh-support/utils';
|
|
12
11
|
import filter from 'lodash/filter';
|
|
13
12
|
import findIndex from 'lodash/findIndex';
|
|
14
13
|
import isEqual from 'lodash/isEqual';
|
|
@@ -224,9 +223,17 @@ export const updateAttachment = (dispatch, uuid, newAttachment, allDiscussions)
|
|
|
224
223
|
});
|
|
225
224
|
dispatch({ type: DiscussionsConstants.updateDiscussionState, payload: { allDiscussions: updatedDiscussions } });
|
|
226
225
|
};
|
|
227
|
-
export const updateDiscussionStateAttachments = (dispatch, caseNumber, allDiscussions, sort,
|
|
226
|
+
export const updateDiscussionStateAttachments = (dispatch, caseNumber, allDiscussions, sort, discussionFiltersListState, dispatchCaseDetailsHydraAttachments, apolloClient, caseSalesforceId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
228
227
|
try {
|
|
229
|
-
|
|
228
|
+
let resolvedCaseSalesforceId = caseSalesforceId;
|
|
229
|
+
if (!resolvedCaseSalesforceId) {
|
|
230
|
+
const caseDetails = yield fetchCaseDetailsByCaseNumber(apolloClient, caseNumber);
|
|
231
|
+
resolvedCaseSalesforceId = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.id;
|
|
232
|
+
}
|
|
233
|
+
if (!resolvedCaseSalesforceId) {
|
|
234
|
+
throw new Error('Missing Salesforce case id');
|
|
235
|
+
}
|
|
236
|
+
const attachments = yield fetchCaseAttachmentsViaGraphQL(apolloClient, caseNumber, resolvedCaseSalesforceId);
|
|
230
237
|
const allAttachments = attachments.map((attachment) => ({
|
|
231
238
|
item: Object.assign(Object.assign({}, attachment), { lastModifiedDate: attachment.lastModifiedDate || attachment.createdDate }),
|
|
232
239
|
last_modified_date: attachment.lastModifiedDate || attachment.createdDate,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/troubleshoot",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.304",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"@progress/kendo-licensing": "1.3.5",
|
|
53
53
|
"@progress/kendo-react-pdf": "^5.16.0",
|
|
54
54
|
"@redux-devtools/extension": "^3.3.0",
|
|
55
|
-
"@rh-support/components": "2.5.
|
|
56
|
-
"@rh-support/react-context": "2.5.
|
|
55
|
+
"@rh-support/components": "2.5.185",
|
|
56
|
+
"@rh-support/react-context": "2.5.279",
|
|
57
57
|
"@rh-support/types": "2.0.26",
|
|
58
|
-
"@rh-support/user-permissions": "2.5.
|
|
59
|
-
"@rh-support/utils": "2.5.
|
|
58
|
+
"@rh-support/user-permissions": "2.5.131",
|
|
59
|
+
"@rh-support/utils": "2.5.113",
|
|
60
60
|
"@types/react-redux": "^7.1.33",
|
|
61
61
|
"@types/redux": "^3.6.0",
|
|
62
62
|
"date-fns": "3.6.0",
|
|
@@ -126,5 +126,5 @@
|
|
|
126
126
|
"defaults and supports es6-module",
|
|
127
127
|
"maintained node versions"
|
|
128
128
|
],
|
|
129
|
-
"gitHead": "
|
|
129
|
+
"gitHead": "4e6af2167e2c8cc3a0b949a41f1e82c1b7ca1d0a"
|
|
130
130
|
}
|