@rh-support/troubleshoot 2.6.303 → 2.6.305
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/AccountInfo/AccountSelector.d.ts.map +1 -1
- package/lib/esm/components/AccountInfo/AccountSelector.js +11 -9
- 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/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.js +7 -18
- 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/CaseInformation.js +1 -1
- package/lib/esm/components/CaseInformation/FileDiag.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/FileDiag.js +10 -3
- package/lib/esm/components/CaseManagement/OpenShiftClusterId.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/OpenShiftClusterId.js +12 -20
- package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.js +7 -16
- package/lib/esm/components/ConfirmationModals/NoAttachmentSelectedModal.d.ts.map +1 -1
- package/lib/esm/components/ConfirmationModals/NoAttachmentSelectedModal.js +5 -3
- package/lib/esm/components/ProductSelector/ProductNotEntitledModal.d.ts +8 -0
- package/lib/esm/components/ProductSelector/ProductNotEntitledModal.d.ts.map +1 -0
- package/lib/esm/components/ProductSelector/ProductNotEntitledModal.js +11 -0
- 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 +52 -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/components/wizardLayout/GlobalTroubleshootEffects.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.js +55 -31
- package/lib/esm/components/wizardLayout/WizardLayout.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/WizardLayout.js +32 -3
- 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/CaseConstNTypes.d.ts +2 -0
- package/lib/esm/reducers/CaseConstNTypes.d.ts.map +1 -1
- package/lib/esm/reducers/CaseConstNTypes.js +2 -0
- 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/lib/esm/reducers/CaseHelpers.d.ts +2 -2
- package/lib/esm/reducers/CaseHelpers.d.ts.map +1 -1
- package/lib/esm/reducers/CaseHelpers.js +47 -49
- package/package.json +6 -6
|
@@ -7,9 +7,9 @@ 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 { Config, pcm, sessionAttachments } from '@cee-eng/hydrajs';
|
|
11
11
|
import { ToastNotification } from '@rh-support/components';
|
|
12
|
-
import { fetchCaseDetailsByCaseNumber, GET_CONTENT_DOCUMENT_IDS,
|
|
12
|
+
import { fetchCaseDetailsByCaseNumber, GET_CONTENT_DOCUMENT_IDS, getText, 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';
|
|
@@ -110,7 +110,9 @@ export const isUploadedAndAnalysisSkipped = (file) => isSessionUploadComplete(fi
|
|
|
110
110
|
export const updateUploadMetadata = (dispatch, fileIndexToEdit, newUploadMetadata) => {
|
|
111
111
|
udpateFileUploadMetadata(dispatch, newUploadMetadata, fileIndexToEdit);
|
|
112
112
|
};
|
|
113
|
-
export const uploadAllFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dispatch, idToUploadTo, caseFiles,
|
|
113
|
+
export const uploadAllFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dispatch, idToUploadTo, caseFiles,
|
|
114
|
+
// isSecureSupport, // TODO: Re-enable when Hydra/GraphQL attachment APIs support secure support again
|
|
115
|
+
needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient, caseSalesforceId, }) {
|
|
114
116
|
forEach(caseFiles.selectedLocalFiles, (localFile, index) => __awaiter(void 0, void 0, void 0, function* () {
|
|
115
117
|
const fileStatus = new FileStatusHelper(localFile);
|
|
116
118
|
if (fileStatus.isUploadComplete() ||
|
|
@@ -126,14 +128,17 @@ export const uploadAllFiles = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
|
126
128
|
localFile,
|
|
127
129
|
originalFile: caseFiles.selectedOriginalFiles[index],
|
|
128
130
|
index,
|
|
129
|
-
isSecureSupport,
|
|
130
131
|
needsAnalyzing,
|
|
131
132
|
isSessionId,
|
|
132
133
|
slowUploadConfig,
|
|
134
|
+
apolloClient,
|
|
135
|
+
caseSalesforceId,
|
|
133
136
|
});
|
|
134
137
|
}));
|
|
135
138
|
});
|
|
136
|
-
export const uploadFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dispatch, idToUploadTo, localFile, originalFile, index,
|
|
139
|
+
export const uploadFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dispatch, idToUploadTo, localFile, originalFile, index,
|
|
140
|
+
// isSecureSupport = false, // TODO: Re-enable when Hydra/GraphQL attachment APIs support secure support again
|
|
141
|
+
needsAnalyzing = false, isSessionId = false, slowUploadConfig = {}, apolloClient, caseSalesforceId, }) {
|
|
137
142
|
if (!localFile.uploadability.ableToUpload) {
|
|
138
143
|
return;
|
|
139
144
|
}
|
|
@@ -203,12 +208,42 @@ export const uploadFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({ d
|
|
|
203
208
|
}, putObjectRequest, listener, true, { partSize: 5 * 1024 * 1024, queueSize: 5 }, Object.assign(Object.assign({}, slowUploadConfig), { preferSlowS3Upload: Config.userConfig.preferSlowS3Upload }));
|
|
204
209
|
}
|
|
205
210
|
else {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
211
|
+
// Mirror master Hydra listener behavior for circular progress + abort button.
|
|
212
|
+
let abortUpload;
|
|
213
|
+
const onAbort = (abortedFileIndex) => {
|
|
214
|
+
const abortPayload = {
|
|
215
|
+
percentUploaded: 0,
|
|
216
|
+
onAbort: undefined,
|
|
217
|
+
uploadStatus: UploadStatusConstants.aborted,
|
|
218
|
+
};
|
|
219
|
+
abortUpload === null || abortUpload === void 0 ? void 0 : abortUpload();
|
|
220
|
+
updateUploadMetadata(dispatch, abortedFileIndex, abortPayload);
|
|
221
|
+
};
|
|
222
|
+
attachmentId = yield uploadCaseAttachment(idToUploadTo, originalFile, (percent) => {
|
|
223
|
+
const verifyingUpdate = percent === 100;
|
|
224
|
+
updateUploadMetadata(dispatch, index, {
|
|
225
|
+
uploadStatus: verifyingUpdate
|
|
226
|
+
? UploadStatusConstants.verifyingCaseUpload
|
|
227
|
+
: UploadStatusConstants.uploadingOnCase,
|
|
228
|
+
percentUploaded: percent,
|
|
229
|
+
uploadErrorMessage: '',
|
|
230
|
+
onAbort: verifyingUpdate ? undefined : onAbort,
|
|
231
|
+
});
|
|
232
|
+
}, (abort) => {
|
|
233
|
+
abortUpload = abort;
|
|
234
|
+
updateUploadMetadata(dispatch, index, {
|
|
235
|
+
uploadStatus: UploadStatusConstants.uploadingOnCase,
|
|
236
|
+
onAbort,
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
if (apolloClient && caseSalesforceId) {
|
|
240
|
+
updateUploadMetadata(dispatch, index, {
|
|
241
|
+
uploadStatus: UploadStatusConstants.verifyingCaseUpload,
|
|
242
|
+
percentUploaded: 100,
|
|
243
|
+
onAbort: undefined,
|
|
244
|
+
});
|
|
245
|
+
yield pollAttachmentUploadStatus(apolloClient, caseSalesforceId, attachmentId);
|
|
246
|
+
}
|
|
212
247
|
}
|
|
213
248
|
attachmentId && updateAttachmentIdForFile(dispatch, attachmentId, index);
|
|
214
249
|
const uploadPayload = {
|
|
@@ -322,13 +357,7 @@ export function computeAnalysisResults(idToUploadTo, attachmentId, fileSize, isS
|
|
|
322
357
|
});
|
|
323
358
|
}
|
|
324
359
|
const SCT_PART_SIZE = 5 * 1024 * 1024;
|
|
325
|
-
|
|
326
|
-
const SCTUploadStatus = {
|
|
327
|
-
IN_PROGRESS: 'In Progress',
|
|
328
|
-
FAILED: 'Failed',
|
|
329
|
-
COMPLETED: 'Completed',
|
|
330
|
-
};
|
|
331
|
-
export function moveSessionAttachmentToCase(dispatch, caseNumber, sessionId, localFile, fileIndex, apolloClient) {
|
|
360
|
+
export function moveSessionAttachmentToCase(dispatch, caseNumber, sessionId, localFile, fileIndex, apolloClient, caseSalesforceId) {
|
|
332
361
|
return __awaiter(this, void 0, void 0, function* () {
|
|
333
362
|
var _a, _b, _c, _d, _e;
|
|
334
363
|
if (!caseNumber || !sessionId || !localFile.attachmentId)
|
|
@@ -339,10 +368,10 @@ export function moveSessionAttachmentToCase(dispatch, caseNumber, sessionId, loc
|
|
|
339
368
|
};
|
|
340
369
|
updateUploadMetadata(dispatch, fileIndex, currentUploadPayload);
|
|
341
370
|
try {
|
|
342
|
-
let caseSalesforceId;
|
|
343
|
-
if (apolloClient) {
|
|
371
|
+
let resolvedCaseSalesforceId = caseSalesforceId;
|
|
372
|
+
if (apolloClient && !resolvedCaseSalesforceId) {
|
|
344
373
|
const caseDetails = yield fetchCaseDetailsByCaseNumber(apolloClient, caseNumber);
|
|
345
|
-
|
|
374
|
+
resolvedCaseSalesforceId = caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.id;
|
|
346
375
|
}
|
|
347
376
|
const totalChunks = Math.ceil(localFile.size / SCT_PART_SIZE);
|
|
348
377
|
const moveResponse = yield sessionAttachments.moveSessionAttachmentsToCaseSCT(sessionId, {
|
|
@@ -361,7 +390,7 @@ export function moveSessionAttachmentToCase(dispatch, caseNumber, sessionId, loc
|
|
|
361
390
|
if (!sctAttachmentId) {
|
|
362
391
|
throw new Error('Missing attachmentId from SCT move response');
|
|
363
392
|
}
|
|
364
|
-
if (!
|
|
393
|
+
if (!resolvedCaseSalesforceId || !apolloClient) {
|
|
365
394
|
updateUploadMetadata(dispatch, fileIndex, {
|
|
366
395
|
uploadStatus: UploadStatusConstants.uploadedOnCase,
|
|
367
396
|
});
|
|
@@ -369,7 +398,7 @@ export function moveSessionAttachmentToCase(dispatch, caseNumber, sessionId, loc
|
|
|
369
398
|
}
|
|
370
399
|
const { data: docLinkData } = yield apolloClient.query({
|
|
371
400
|
query: GET_CONTENT_DOCUMENT_IDS,
|
|
372
|
-
variables: { linkedEntityId: { eq:
|
|
401
|
+
variables: { linkedEntityId: { eq: resolvedCaseSalesforceId } },
|
|
373
402
|
fetchPolicy: 'network-only',
|
|
374
403
|
});
|
|
375
404
|
const contentDocumentIds = ((_e = (_d = (_c = (_b = docLinkData === null || docLinkData === void 0 ? void 0 : docLinkData.redhat_support_uiapi) === null || _b === void 0 ? void 0 : _b.query) === null || _c === void 0 ? void 0 : _c.RedHatSupportContentDocumentLink) === null || _d === void 0 ? void 0 : _d.edges) !== null && _e !== void 0 ? _e : []).map((edge) => edge.node.ContentDocumentId.value);
|
|
@@ -398,31 +427,6 @@ export function moveSessionAttachmentToCase(dispatch, caseNumber, sessionId, loc
|
|
|
398
427
|
}
|
|
399
428
|
});
|
|
400
429
|
}
|
|
401
|
-
function pollContentVersionStatus(apolloClient, contentDocumentIds, attachmentUUID) {
|
|
402
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
403
|
-
var _a, _b, _c, _d, _e, _f;
|
|
404
|
-
while (true) {
|
|
405
|
-
const { data } = yield apolloClient.query({
|
|
406
|
-
query: GET_CONTENT_VERSION_STATUS,
|
|
407
|
-
variables: {
|
|
408
|
-
contentDocumentIds: { in: contentDocumentIds },
|
|
409
|
-
attachmentUUID: { eq: attachmentUUID },
|
|
410
|
-
},
|
|
411
|
-
fetchPolicy: 'network-only',
|
|
412
|
-
});
|
|
413
|
-
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.RedHatSupportContentVersion) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
|
|
414
|
-
const matchingEntry = edges.find((edge) => { var _a; return ((_a = edge.node.AttachmentUUID__c) === null || _a === void 0 ? void 0 : _a.value) === attachmentUUID; });
|
|
415
|
-
const uploadStatus = (_f = (_e = matchingEntry === null || matchingEntry === void 0 ? void 0 : matchingEntry.node) === null || _e === void 0 ? void 0 : _e.UploadStatus__c) === null || _f === void 0 ? void 0 : _f.value;
|
|
416
|
-
if (uploadStatus === SCTUploadStatus.COMPLETED) {
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
if (uploadStatus === SCTUploadStatus.FAILED) {
|
|
420
|
-
throw new Error('Attachment move to case failed');
|
|
421
|
-
}
|
|
422
|
-
yield new Promise((resolve) => setTimeout(resolve, SCT_POLL_INTERVAL_MS));
|
|
423
|
-
}
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
430
|
export function restoreFilesFromSession(dispatch, sessionId) {
|
|
427
431
|
return __awaiter(this, void 0, void 0, function* () {
|
|
428
432
|
resetAttachment(dispatch);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export interface IFileUploaderCommonProps {
|
|
2
|
-
isSecureSupport: boolean;
|
|
3
2
|
idToUploadTo: string;
|
|
3
|
+
/** Salesforce case Id from caseDetails.state — avoids an extra GetCaseByCaseNumber on upload. */
|
|
4
|
+
caseSalesforceId?: string;
|
|
4
5
|
needsAnalyzing?: boolean;
|
|
5
6
|
isSessionId: boolean;
|
|
6
7
|
autoUploadOnSelect?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/shared/fileUpload/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,wBAAwB;
|
|
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"}
|
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { IFileLocal } from './reducer/AttachmentReducer';
|
|
3
3
|
import { IFileUploaderCommonProps } from './types';
|
|
4
4
|
export declare function useFileUploader(props: IFileUploaderCommonProps): {
|
|
5
|
-
retryUpload: (indexToRetry: number) => void
|
|
5
|
+
retryUpload: (indexToRetry: number) => Promise<void>;
|
|
6
6
|
editFile: (editedLocalFile: IFileLocal, fileIndexToEdit: number, changes: IFileLocal) => Promise<void>;
|
|
7
7
|
removeFile: (fileIndexToRemove: number, file: IFileLocal) => Promise<void>;
|
|
8
8
|
uploadAll: (event?: React.MouseEvent<HTMLButtonElement, MouseEvent>) => Promise<void>;
|
|
9
|
-
uploadFile: (fileIndex: number) => void
|
|
9
|
+
uploadFile: (fileIndex: number) => Promise<void>;
|
|
10
10
|
retryAnalysis: (indexToRetry: number) => void;
|
|
11
11
|
};
|
|
12
12
|
//# sourceMappingURL=useFileUploader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFileUploader.d.ts","sourceRoot":"","sources":["../../../../../src/components/shared/fileUpload/useFileUploader.tsx"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalTroubleshootEffects.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/GlobalTroubleshootEffects.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"GlobalTroubleshootEffects.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/GlobalTroubleshootEffects.tsx"],"names":[],"mappings":"AAeA,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,qBAodtD"}
|
|
@@ -25,7 +25,7 @@ import { TCDispatchContext, TCStateContext } from '../../context/TopContentConte
|
|
|
25
25
|
import { useResetCaseCreate } from '../../hooks/useResetCaseCreate';
|
|
26
26
|
import { CASE_DEATILS_SOURCE_REFERRER_LIMIT } from '../../reducers/CaseConstNTypes';
|
|
27
27
|
import { getDescriptionWOQues } from '../../reducers/CaseHelpers';
|
|
28
|
-
import { fetchCaseGroupsForContactGraphQL, setCaseAccountNumber, setCaseDetails,
|
|
28
|
+
import { fetchCaseGroupsForContactGraphQL, setCaseAccountNumber, setCaseDetails, setCaseState, } from '../../reducers/CaseReducer';
|
|
29
29
|
import { AppRouteSections } from '../../reducers/RouteConstNTypes';
|
|
30
30
|
import { setActiveSectionChanged, setRouteFlags, updateisNextBtnClickedToShowValidationError, } from '../../reducers/RouteReducer';
|
|
31
31
|
import { fetchEdmundAbbottRules } from '../../reducers/RulesReducer';
|
|
@@ -175,8 +175,6 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
175
175
|
var _a, _b;
|
|
176
176
|
if (isEmpty(loggedInUserRights.data))
|
|
177
177
|
return;
|
|
178
|
-
if (loggedInUserRights.data.isInternal())
|
|
179
|
-
return;
|
|
180
178
|
const resolvedAccountNumber = ((_a = loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.accountNumber) ||
|
|
181
179
|
loggedInUserRights.data.getAccountNumber() ||
|
|
182
180
|
(loggedInUserJwtToken === null || loggedInUserJwtToken === void 0 ? void 0 : loggedInUserJwtToken.account_number) ||
|
|
@@ -185,11 +183,6 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
185
183
|
const hasFullAccountData = !isEmpty((_b = loggedInUsersAccount.data) === null || _b === void 0 ? void 0 : _b.accountNumber);
|
|
186
184
|
setCaseAccountNumber(caseDispatch, resolvedAccountNumber, hasFullAccountData, hasFullAccountData ? loggedInUsersAccount.data : {}, apolloClient);
|
|
187
185
|
}
|
|
188
|
-
if (isEmpty(contactSsoUsername)) {
|
|
189
|
-
setCaseOwner(caseDispatch, loggedInUserRights.data.getHydraContactFromLoggedInUser(), product, undefined, undefined, true, undefined, true, undefined, undefined, loggedInUserRights.data.isInternal()
|
|
190
|
-
? accountNumber || loggedInUserRights.data.getAccountNumber()
|
|
191
|
-
: undefined);
|
|
192
|
-
}
|
|
193
186
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
194
187
|
}, [
|
|
195
188
|
caseDispatch,
|
|
@@ -200,43 +193,66 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
200
193
|
contactSsoUsername,
|
|
201
194
|
]);
|
|
202
195
|
useEffect(() => {
|
|
203
|
-
if (isEmpty(loggedInUserRights.data)
|
|
204
|
-
return;
|
|
205
|
-
if (isEmpty(accountNumber) || isEmpty(contactSsoUsername))
|
|
206
|
-
return;
|
|
207
|
-
if (selectedAccountDetails.isFetching)
|
|
196
|
+
if (isEmpty(loggedInUserRights.data))
|
|
208
197
|
return;
|
|
209
198
|
if (selectedOwnerContactId)
|
|
210
199
|
return;
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
200
|
+
const fetchAndSetDefaultOwner = () => __awaiter(this, void 0, void 0, function* () {
|
|
201
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
|
|
214
202
|
try {
|
|
215
|
-
|
|
203
|
+
// First get logged-in user's FederationIdentifier and ContactId
|
|
204
|
+
const { data: userData } = yield apolloClient.query({
|
|
205
|
+
query: GET_ACCOUNT_CONTACTS,
|
|
206
|
+
variables: { first: 1, contactsWhere: { IsActive__c: { eq: true } } },
|
|
207
|
+
});
|
|
208
|
+
const response = userData;
|
|
209
|
+
const userEdges = (_d = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.redhat_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.RedHatSupportUser) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
|
|
210
|
+
const loggedInUser = userEdges.find(({ node }) => { var _a, _b; return ((_a = node.FederationIdentifier) === null || _a === void 0 ? void 0 : _a.value) != null && ((_b = node.ContactId) === null || _b === void 0 ? void 0 : _b.value); });
|
|
211
|
+
if (!loggedInUser)
|
|
212
|
+
return;
|
|
213
|
+
const federationId = loggedInUser.node.FederationIdentifier.value;
|
|
214
|
+
// Search for the contact using FederationIdentifier (SSOUserName__c)
|
|
215
|
+
const { data: contactData } = yield apolloClient.query({
|
|
216
216
|
query: GET_ACCOUNT_CONTACTS,
|
|
217
217
|
variables: {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
first: 1,
|
|
219
|
+
contactsWhere: {
|
|
220
|
+
IsActive__c: { eq: true },
|
|
221
|
+
SSOUserName__c: { like: federationId },
|
|
222
|
+
},
|
|
221
223
|
},
|
|
224
|
+
fetchPolicy: 'network-only',
|
|
222
225
|
});
|
|
223
|
-
const
|
|
224
|
-
const contactEdges = (
|
|
225
|
-
const matchingContact = contactEdges
|
|
226
|
-
if (
|
|
227
|
-
const
|
|
226
|
+
const contactResponse = contactData;
|
|
227
|
+
const contactEdges = (_m = (_l = (_k = (_j = (_h = (_g = (_f = (_e = contactResponse === null || contactResponse === void 0 ? void 0 : contactResponse.redhat_support_uiapi) === null || _e === void 0 ? void 0 : _e.query) === null || _f === void 0 ? void 0 : _f.RedHatSupportAccount) === null || _g === void 0 ? void 0 : _g.edges) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.node) === null || _k === void 0 ? void 0 : _k.Contacts) === null || _l === void 0 ? void 0 : _l.edges) !== null && _m !== void 0 ? _m : [];
|
|
228
|
+
const matchingContact = contactEdges[0];
|
|
229
|
+
if (matchingContact === null || matchingContact === void 0 ? void 0 : matchingContact.node) {
|
|
230
|
+
const node = matchingContact.node;
|
|
231
|
+
const ownerData = {
|
|
232
|
+
id: node.Id,
|
|
233
|
+
ssoUsername: (_p = (_o = node.SSOUserName__c) === null || _o === void 0 ? void 0 : _o.value) !== null && _p !== void 0 ? _p : '',
|
|
234
|
+
firstName: (_r = (_q = node.FirstName) === null || _q === void 0 ? void 0 : _q.value) !== null && _r !== void 0 ? _r : '',
|
|
235
|
+
lastName: (_t = (_s = node.LastName) === null || _s === void 0 ? void 0 : _s.value) !== null && _t !== void 0 ? _t : '',
|
|
236
|
+
fullNameCustom: (_v = (_u = node.Name) === null || _u === void 0 ? void 0 : _u.value) !== null && _v !== void 0 ? _v : '',
|
|
237
|
+
manageSupportCases: (_x = (_w = node.ManageSupportCases__c) === null || _w === void 0 ? void 0 : _w.value) !== null && _x !== void 0 ? _x : true,
|
|
238
|
+
isInternal: (_z = (_y = node.IsInternal__c) === null || _y === void 0 ? void 0 : _y.value) !== null && _z !== void 0 ? _z : false,
|
|
239
|
+
isOrgAdmin: (_1 = (_0 = node.IsOrgAdmin__c) === null || _0 === void 0 ? void 0 : _0.value) !== null && _1 !== void 0 ? _1 : false,
|
|
240
|
+
phone: (_3 = (_2 = node.Phone) === null || _2 === void 0 ? void 0 : _2.value) !== null && _3 !== void 0 ? _3 : '',
|
|
241
|
+
defaultCaseGroup: (_5 = (_4 = node.DefaultCaseGroup__c) === null || _4 === void 0 ? void 0 : _4.value) !== null && _5 !== void 0 ? _5 : null,
|
|
242
|
+
};
|
|
228
243
|
setCaseState(caseDispatch, {
|
|
229
|
-
selectedOwner: { data:
|
|
244
|
+
selectedOwner: { data: ownerData, isFetching: false, isError: false, errorMessage: '' },
|
|
230
245
|
});
|
|
246
|
+
setCaseDetails(caseDispatch, { contactSSOName: ownerData.ssoUsername });
|
|
231
247
|
}
|
|
232
248
|
}
|
|
233
|
-
catch (
|
|
234
|
-
// Contact fetch failed;
|
|
249
|
+
catch (_6) {
|
|
250
|
+
// Contact fetch failed; owner stays empty
|
|
235
251
|
}
|
|
236
252
|
});
|
|
237
|
-
|
|
253
|
+
fetchAndSetDefaultOwner();
|
|
238
254
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
239
|
-
}, [
|
|
255
|
+
}, [loggedInUserRights.data, selectedOwnerContactId]);
|
|
240
256
|
/**
|
|
241
257
|
* Fetch case groups for the selected owner's contactId.
|
|
242
258
|
* Filters groups where the contact is a member via GET_CASE_GROUP.
|
|
@@ -262,9 +278,17 @@ export function GlobalTroubleshootEffects(props) {
|
|
|
262
278
|
if (isEmpty(product) || selectedAccountDetails.isFetching || isEmpty(selectedAccountDetails.data))
|
|
263
279
|
return;
|
|
264
280
|
const serviceLevels = resolveProductServiceLevelsForAccount(selectedAccountDetails.data, allProducts.data.productsResult, product);
|
|
265
|
-
if (!serviceLevels)
|
|
281
|
+
if (!serviceLevels || !serviceLevels.productServiceLevel) {
|
|
282
|
+
setCaseState(caseDispatch, {
|
|
283
|
+
isProductNotEntitled: true,
|
|
284
|
+
productServiceLevel: undefined,
|
|
285
|
+
otherServiceLevels: [],
|
|
286
|
+
selectedEntitlementId: undefined,
|
|
287
|
+
});
|
|
266
288
|
return;
|
|
289
|
+
}
|
|
267
290
|
setCaseState(caseDispatch, {
|
|
291
|
+
isProductNotEntitled: false,
|
|
268
292
|
productServiceLevel: serviceLevels.productServiceLevel,
|
|
269
293
|
otherServiceLevels: serviceLevels.otherServiceLevels,
|
|
270
294
|
selectedEntitlementId: serviceLevels.defaultEntitlementId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardLayout.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardLayout.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAAuC,eAAe,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"WizardLayout.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardLayout.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAMvD,OAAO,EAAuC,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAevG,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,qBA+NzC"}
|
|
@@ -21,11 +21,12 @@ import { Trans } from 'react-i18next';
|
|
|
21
21
|
import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
|
|
22
22
|
import { RouteContext } from '../../context/RouteContext';
|
|
23
23
|
import { SessionRestoreDispatchContext, SessionRestoreStateContext } from '../../context/SessionRestoreContext';
|
|
24
|
-
import { submitCase } from '../../reducers/CaseReducer';
|
|
24
|
+
import { setCaseState, submitCase } from '../../reducers/CaseReducer';
|
|
25
25
|
import { AppRouteSections } from '../../reducers/RouteConstNTypes';
|
|
26
26
|
import { useMetadata } from '../../utils/metadataUtil';
|
|
27
27
|
import RouteUtils from '../../utils/routeUtils';
|
|
28
28
|
import PreCaseConfirmationModals, { PreCaseConfirmationModalsEnum, } from '../ConfirmationModals/PreCaseConfirmationModals';
|
|
29
|
+
import { ProductNotEntitledModal } from '../ProductSelector/ProductNotEntitledModal';
|
|
29
30
|
import AlertToastWrapper from '../Recommendations/AlertToastWrapper';
|
|
30
31
|
import { preferredSSModalOpenPendoEvent } from '../shared/Constants';
|
|
31
32
|
import { AttachmentStateContext } from '../shared/fileUpload';
|
|
@@ -38,12 +39,17 @@ export function WizardLayout(props) {
|
|
|
38
39
|
const { routeState: { activeSection, isCaseCreate }, } = useContext(RouteContext);
|
|
39
40
|
const { getMetadata } = useMetadata();
|
|
40
41
|
const [isAIChatMode, setIsAIChatMode] = useState(false);
|
|
41
|
-
const
|
|
42
|
+
const [showEntitlementModal, setShowEntitlementModal] = useState(false);
|
|
43
|
+
const entitlementTimerRef = useRef(null);
|
|
44
|
+
const { caseCreationError, caseType, product, caseState, hasInvalidEntitlements, isProductNotEntitled, entitlementWarningDismissedForProduct, isAccountLoaded, } = useCaseSelector((state) => ({
|
|
42
45
|
caseState: state,
|
|
43
46
|
caseCreationError: state.caseCreationError,
|
|
44
47
|
caseType: state.caseDetails.caseType,
|
|
45
48
|
product: state.caseDetails.product,
|
|
46
49
|
hasInvalidEntitlements: state.hasInvalidEntitlements,
|
|
50
|
+
isProductNotEntitled: state.isProductNotEntitled,
|
|
51
|
+
entitlementWarningDismissedForProduct: state.entitlementWarningDismissedForProduct,
|
|
52
|
+
isAccountLoaded: !state.selectedAccountDetails.isFetching && !isEmpty(state.selectedAccountDetails.data),
|
|
47
53
|
}), isEqual);
|
|
48
54
|
const sessionRestoreDispatch = useContext(SessionRestoreDispatchContext);
|
|
49
55
|
const caseDispatch = useCaseDispatch();
|
|
@@ -51,6 +57,25 @@ export function WizardLayout(props) {
|
|
|
51
57
|
const { globalMetadataState: { allProducts, loggedInUser, loggedInUsersAccount, loggedInUserRights }, } = useContext(GlobalMetadataStateContext);
|
|
52
58
|
const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
|
|
53
59
|
const apolloClient = useApolloClient();
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (entitlementTimerRef.current) {
|
|
62
|
+
clearTimeout(entitlementTimerRef.current);
|
|
63
|
+
entitlementTimerRef.current = null;
|
|
64
|
+
}
|
|
65
|
+
if (!isProductNotEntitled || isEmpty(product) || !isAccountLoaded) {
|
|
66
|
+
setShowEntitlementModal(false);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (product === entitlementWarningDismissedForProduct)
|
|
70
|
+
return;
|
|
71
|
+
entitlementTimerRef.current = setTimeout(() => {
|
|
72
|
+
setShowEntitlementModal(true);
|
|
73
|
+
}, 300);
|
|
74
|
+
return () => {
|
|
75
|
+
if (entitlementTimerRef.current)
|
|
76
|
+
clearTimeout(entitlementTimerRef.current);
|
|
77
|
+
};
|
|
78
|
+
}, [isProductNotEntitled, product, isAccountLoaded, entitlementWarningDismissedForProduct]);
|
|
54
79
|
const canAddAttachments = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.ATTACHMENTS);
|
|
55
80
|
const { attachmentState } = useContext(AttachmentStateContext);
|
|
56
81
|
const isAnyFileAttachedLocal = isAnyFileAttached(attachmentState.caseFiles.selectedLocalFiles);
|
|
@@ -132,5 +157,9 @@ export function WizardLayout(props) {
|
|
|
132
157
|
React.createElement(WizardMain, { routeProps: props.routeProps, submitCaseAndNavigate: submitCaseAndNavigate, confirmSupportModal: confirmSupportModal, isAIChatMode: isAIChatMode, setIsAIChatMode: setIsAIChatMode, isSecureSupport: (_a = loggedInUsersAccount === null || loggedInUsersAccount === void 0 ? void 0 : loggedInUsersAccount.data) === null || _a === void 0 ? void 0 : _a.secureSupport, hasConfirmedStatesideSupport: (_b = loggedInUsersAccount === null || loggedInUsersAccount === void 0 ? void 0 : loggedInUsersAccount.data) === null || _b === void 0 ? void 0 : _b.hasConfirmedStatesideSupport, isUserExternal: (_d = (_c = loggedInUserRights === null || loggedInUserRights === void 0 ? void 0 : loggedInUserRights.data) === null || _c === void 0 ? void 0 : _c.isExternal()) !== null && _d !== void 0 ? _d : false, hasInvalidEntitlements: hasInvalidEntitlements })),
|
|
133
158
|
!isAIChatMode && (React.createElement(GridItem, { span: 4, className: "grid-wizard-aside-content" },
|
|
134
159
|
React.createElement(WizardAside, { isAttachmentUploadModalOpen: confirmationModalType === PreCaseConfirmationModalsEnum.NO_ATTACHMENT_MODAL, routeProps: props.routeProps })))),
|
|
135
|
-
React.createElement(AlertToastWrapper, { submitCaseAndNavigate: submitCaseAndNavigate, routeProps: props.routeProps })
|
|
160
|
+
React.createElement(AlertToastWrapper, { submitCaseAndNavigate: submitCaseAndNavigate, routeProps: props.routeProps }),
|
|
161
|
+
React.createElement(ProductNotEntitledModal, { isOpen: showEntitlementModal, onClose: () => {
|
|
162
|
+
setShowEntitlementModal(false);
|
|
163
|
+
setCaseState(caseDispatch, { entitlementWarningDismissedForProduct: product });
|
|
164
|
+
} })));
|
|
136
165
|
}
|
|
@@ -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"}
|