@rh-support/troubleshoot 2.6.302 → 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.
Files changed (65) hide show
  1. package/lib/esm/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.js +1 -1
  2. package/lib/esm/components/CaseEditView/Case.d.ts.map +1 -1
  3. package/lib/esm/components/CaseEditView/Case.js +5 -17
  4. package/lib/esm/components/CaseEditView/CaseDetailsAside.js +1 -1
  5. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.d.ts.map +1 -1
  6. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.js +1 -1
  7. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseAttachment.d.ts.map +1 -1
  8. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseAttachment.js +69 -21
  9. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts.map +1 -1
  10. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.js +53 -72
  11. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useMarkdownFileUploader.d.ts +1 -2
  12. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useMarkdownFileUploader.d.ts.map +1 -1
  13. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useMarkdownFileUploader.js +13 -8
  14. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts +2 -0
  15. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts.map +1 -1
  16. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.js +63 -26
  17. package/lib/esm/components/CaseInformation/ContactPhoneNumber.d.ts.map +1 -1
  18. package/lib/esm/components/CaseInformation/ContactPhoneNumber.js +1 -1
  19. package/lib/esm/components/CaseInformation/FileDiag.d.ts.map +1 -1
  20. package/lib/esm/components/CaseInformation/FileDiag.js +10 -3
  21. package/lib/esm/components/ConfirmationModals/NoAttachmentSelectedModal.d.ts.map +1 -1
  22. package/lib/esm/components/ConfirmationModals/NoAttachmentSelectedModal.js +5 -3
  23. package/lib/esm/components/SubmitCase/SubmitCase.d.ts.map +1 -1
  24. package/lib/esm/components/SubmitCase/SubmitCase.js +1 -1
  25. package/lib/esm/components/shared/fileUpload/FileUploader.d.ts.map +1 -1
  26. package/lib/esm/components/shared/fileUpload/FileUploader.js +1 -1
  27. package/lib/esm/components/shared/fileUpload/WidgetFileUploader.d.ts.map +1 -1
  28. package/lib/esm/components/shared/fileUpload/WidgetFileUploader.js +2 -2
  29. package/lib/esm/components/shared/fileUpload/fileSelectors/FileSelectorButton.d.ts +1 -1
  30. package/lib/esm/components/shared/fileUpload/fileSelectors/FileSelectorButton.d.ts.map +1 -1
  31. package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.d.ts +8 -7
  32. package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.d.ts.map +1 -1
  33. package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.js +40 -49
  34. package/lib/esm/components/shared/fileUpload/types/index.d.ts +2 -1
  35. package/lib/esm/components/shared/fileUpload/types/index.d.ts.map +1 -1
  36. package/lib/esm/components/shared/fileUpload/useFileUploader.d.ts +2 -2
  37. package/lib/esm/components/shared/fileUpload/useFileUploader.d.ts.map +1 -1
  38. package/lib/esm/components/shared/fileUpload/useFileUploader.js +38 -14
  39. package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.js +1 -1
  40. package/lib/esm/graphql/mutations/createRMECaseEscalation.js +4 -4
  41. package/lib/esm/graphql/queries/getEscalationDetails.js +3 -3
  42. package/lib/esm/graphql/queries/getParentId.js +3 -3
  43. package/lib/esm/graphql/schemas/escalation.d.ts +6 -6
  44. package/lib/esm/graphql/schemas/escalation.d.ts.map +1 -1
  45. package/lib/esm/hooks/useCaseComments/caseCommentMutation.js +4 -4
  46. package/lib/esm/hooks/useCaseComments/caseCommentsQuery.js +4 -4
  47. package/lib/esm/hooks/useCaseComments/mapCaseComment.js +1 -1
  48. package/lib/esm/hooks/useCaseComments/types.d.ts +4 -4
  49. package/lib/esm/hooks/useCaseComments/types.d.ts.map +1 -1
  50. package/lib/esm/hooks/useCaseHistory.d.ts +5 -5
  51. package/lib/esm/hooks/useCaseHistory.js +17 -17
  52. package/lib/esm/hooks/useS3Upload.d.ts +5 -4
  53. package/lib/esm/hooks/useS3Upload.d.ts.map +1 -1
  54. package/lib/esm/hooks/useS3Upload.js +25 -30
  55. package/lib/esm/models/caseHistory.d.ts +3 -3
  56. package/lib/esm/models/caseHistory.d.ts.map +1 -1
  57. package/lib/esm/reducers/CaseDetailsPageReducer.d.ts +2 -1
  58. package/lib/esm/reducers/CaseDetailsPageReducer.d.ts.map +1 -1
  59. package/lib/esm/reducers/CaseDetailsPageReducer.js +13 -5
  60. package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts +2 -1
  61. package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts.map +1 -1
  62. package/lib/esm/reducers/CaseDiscussionTabReducer.js +11 -4
  63. package/lib/esm/reducers/CaseReducer.js +4 -4
  64. package/lib/esm/utils/caseHistoryUtils.js +3 -3
  65. 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 { caseAttachments, sessionAttachments } from '@cee-eng/hydrajs';
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: deleteCaseAttachment } = useFetch(caseAttachments.deleteAttachment);
28
- const { idToUploadTo, needsAnalyzing, isSecureSupport, isSessionId, autoUploadOnSelect, onUploadClick } = props;
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
- isUploadedSuccessfully(file) &&
89
- !isSessionId &&
90
- deleteCaseAttachment(idToUploadTo, file.attachmentId, isSecureSupport);
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,
@@ -221,7 +221,7 @@ export function GlobalTroubleshootEffects(props) {
221
221
  },
222
222
  });
223
223
  const response = data;
224
- const contactEdges = (_h = (_g = (_f = (_e = (_d = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.SalesforceSupportAccount) === null || _c === void 0 ? void 0 : _c.edges) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.node) === null || _f === void 0 ? void 0 : _f.Contacts) === null || _g === void 0 ? void 0 : _g.edges) !== null && _h !== void 0 ? _h : [];
224
+ const contactEdges = (_h = (_g = (_f = (_e = (_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.RedHatSupportAccount) === null || _c === void 0 ? void 0 : _c.edges) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.node) === null || _f === void 0 ? void 0 : _f.Contacts) === null || _g === void 0 ? void 0 : _g.edges) !== null && _h !== void 0 ? _h : [];
225
225
  const matchingContact = contactEdges.find(({ node }) => { var _a, _b; return ((_b = (_a = node.SSOUserName__c) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === (ownerSso === null || ownerSso === void 0 ? void 0 : ownerSso.toLowerCase()); });
226
226
  if ((_j = matchingContact === null || matchingContact === void 0 ? void 0 : matchingContact.node) === null || _j === void 0 ? void 0 : _j.Id) {
227
227
  const ownerWithId = Object.assign(Object.assign({}, loggedInUserRights.data.getHydraContactFromLoggedInUser()), { id: matchingContact.node.Id, defaultCaseGroup: (_l = (_k = matchingContact.node.DefaultCaseGroup__c) === null || _k === void 0 ? void 0 : _k.value) !== null && _l !== void 0 ? _l : null });
@@ -1,9 +1,9 @@
1
1
  import { gql } from '@apollo/client/core';
2
2
  export const CREATE_RME_CASE_ESCALATION = gql `
3
- mutation CreateRMECaseEscalation($caseInput: SalesforceSupportCaseCreateRepresentation!) {
4
- salesforce_support_uiapi {
5
- CaseCreate(input: { SalesforceSupportCase: $caseInput }) {
6
- SalesforceSupportRecord {
3
+ mutation CreateRMECaseEscalation($caseInput: RedHatSupportCaseCreateRepresentation!) {
4
+ redhat_support_uiapi {
5
+ CaseCreate(input: { RedHatSupportCase: $caseInput }) {
6
+ RedHatSupportRecord {
7
7
  Id
8
8
  CaseNumber {
9
9
  value
@@ -1,9 +1,9 @@
1
1
  import { gql } from '@apollo/client/core';
2
2
  export const GET_ESCALATION_DETAILS = gql `
3
- query getEscalationDetails($where: SalesforceSupportCase_Filter) {
4
- salesforce_support_uiapi {
3
+ query getEscalationDetails($where: RedHatSupportCase_Filter) {
4
+ redhat_support_uiapi {
5
5
  query {
6
- SalesforceSupportCase(where: $where) {
6
+ RedHatSupportCase(where: $where) {
7
7
  edges {
8
8
  node {
9
9
  CaseNumber {
@@ -1,9 +1,9 @@
1
1
  import { gql } from '@apollo/client/core';
2
2
  export const GET_PARENT_ID = gql `
3
- query Query($where: SalesforceSupportCase_Filter) {
4
- salesforce_support_uiapi {
3
+ query Query($where: RedHatSupportCase_Filter) {
4
+ redhat_support_uiapi {
5
5
  query {
6
- SalesforceSupportCase(where: $where) {
6
+ RedHatSupportCase(where: $where) {
7
7
  edges {
8
8
  node {
9
9
  Id
@@ -6,9 +6,9 @@ export interface GetParentIdVariables {
6
6
  };
7
7
  }
8
8
  export interface GetParentIdResponse {
9
- salesforce_support_uiapi: {
9
+ redhat_support_uiapi: {
10
10
  query: {
11
- SalesforceSupportCase: {
11
+ RedHatSupportCase: {
12
12
  edges: Array<{
13
13
  node: {
14
14
  Id: string;
@@ -33,9 +33,9 @@ export interface CreateRMECaseEscalationVariables {
33
33
  };
34
34
  }
35
35
  export interface CreateRMECaseEscalationResponse {
36
- salesforce_support_uiapi: {
36
+ redhat_support_uiapi: {
37
37
  CaseCreate: {
38
- SalesforceSupportRecord: {
38
+ RedHatSupportRecord: {
39
39
  Id: string;
40
40
  CaseNumber: {
41
41
  value: string;
@@ -61,9 +61,9 @@ export interface GetEscalationDetailsVariables {
61
61
  };
62
62
  }
63
63
  export interface GetEscalationDetailsResponse {
64
- salesforce_support_uiapi: {
64
+ redhat_support_uiapi: {
65
65
  query: {
66
- SalesforceSupportCase: {
66
+ RedHatSupportCase: {
67
67
  edges: Array<{
68
68
  node: {
69
69
  CaseNumber: {
@@ -1 +1 @@
1
- {"version":3,"file":"escalation.d.ts","sourceRoot":"","sources":["../../../../src/graphql/schemas/escalation.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE;QACH,UAAU,EAAE;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;KAC9B,CAAC;CACL;AAED,MAAM,WAAW,mBAAmB;IAChC,wBAAwB,EAAE;QACtB,KAAK,EAAE;YACH,qBAAqB,EAAE;gBACnB,KAAK,EAAE,KAAK,CAAC;oB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BAAE,KAAK,EAAE,MAAM,CAAA;yBAAE,CAAC;wBAC3B,MAAM,EAAE;4BAAE,KAAK,EAAE,MAAM,CAAA;yBAAE,CAAC;qBAC7B,CAAC;iBACL,CAAC,CAAC;aACN,CAAC;SACL,CAAC;KACL,CAAC;CACL"}
1
+ {"version":3,"file":"escalation.d.ts","sourceRoot":"","sources":["../../../../src/graphql/schemas/escalation.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE;QACH,UAAU,EAAE;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;KAC9B,CAAC;CACL;AAED,MAAM,WAAW,mBAAmB;IAChC,oBAAoB,EAAE;QAClB,KAAK,EAAE;YACH,iBAAiB,EAAE;gBACf,KAAK,EAAE,KAAK,CAAC;oBACT,IAAI,EAAE;wBACF,EAAE,EAAE,MAAM,CAAC;qBACd,CAAC;iBACL,CAAC,CAAC;aACN,CAAC;SACL,CAAC;KACL,CAAC;CACL;AAED,MAAM,WAAW,gCAAgC;IAC7C,SAAS,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,yBAAyB,EAAE,MAAM,CAAC;KACrC,CAAC;CACL;AAED,MAAM,WAAW,+BAA+B;IAC5C,oBAAoB,EAAE;QAClB,UAAU,EAAE;YACR,mBAAmB,EAAE;gBACjB,EAAE,EAAE,MAAM,CAAC;gBACX,UAAU,EAAE;oBAAE,KAAK,EAAE,MAAM,CAAA;iBAAE,CAAC;gBAC9B,MAAM,EAAE;oBAAE,KAAK,EAAE,MAAM,CAAA;iBAAE,CAAC;gBAC1B,OAAO,EAAE;oBAAE,KAAK,EAAE,MAAM,CAAA;iBAAE,CAAC;gBAC3B,QAAQ,EAAE;oBAAE,KAAK,EAAE,MAAM,CAAA;iBAAE,CAAC;aAC/B,CAAC;SACL,CAAC;KACL,CAAC;CACL;AAED,MAAM,WAAW,6BAA6B;IAC1C,KAAK,EAAE;QACH,QAAQ,EAAE;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;KAC5B,CAAC;CACL;AAED,MAAM,WAAW,4BAA4B;IACzC,oBAAoB,EAAE;QAClB,KAAK,EAAE;YACH,iBAAiB,EAAE;gBACf,KAAK,EAAE,KAAK,CAAC;oBACT,IAAI,EAAE;wBACF,UAAU,EAAE;4BAAE,KAAK,EAAE,MAAM,CAAA;yBAAE,CAAC;wBAC9B,OAAO,EAAE;4BAAE,KAAK,EAAE,MAAM,CAAA;yBAAE,CAAC;wBAC3B,MAAM,EAAE;4BAAE,KAAK,EAAE,MAAM,CAAA;yBAAE,CAAC;qBAC7B,CAAC;iBACL,CAAC,CAAC;aACN,CAAC;SACL,CAAC;KACL,CAAC;CACL"}
@@ -1,9 +1,9 @@
1
1
  import { gql } from '@apollo/client/core';
2
2
  export const CREATE_CASE_COMMENT = gql `
3
- mutation CreateCaseComment($commentInput: SalesforceSupportCaseComment__cCreateRepresentation!) {
4
- salesforce_support_uiapi {
5
- CaseComment__cCreate(input: { SalesforceSupportCaseComment__c: $commentInput }) {
6
- SalesforceSupportRecord {
3
+ mutation CreateCaseComment($commentInput: RedHatSupportCaseComment__cCreateRepresentation!) {
4
+ redhat_support_uiapi {
5
+ CaseComment__cCreate(input: { RedHatSupportCaseComment__c: $commentInput }) {
6
+ RedHatSupportRecord {
7
7
  Id
8
8
  }
9
9
  }
@@ -1,13 +1,13 @@
1
1
  import { gql } from '@apollo/client/core';
2
2
  export const GET_CASE_COMMENTS = gql `
3
3
  query GetCaseComments(
4
- $filter: SalesforceSupportCaseComment__c_Filter!
5
- $orderBy: SalesforceSupportCaseComment__c_OrderBy
4
+ $filter: RedHatSupportCaseComment__c_Filter!
5
+ $orderBy: RedHatSupportCaseComment__c_OrderBy
6
6
  $first: Int
7
7
  ) {
8
- salesforce_support_uiapi {
8
+ redhat_support_uiapi {
9
9
  query {
10
- SalesforceSupportCaseComment__c(where: $filter, orderBy: $orderBy, first: $first) {
10
+ RedHatSupportCaseComment__c(where: $filter, orderBy: $orderBy, first: $first) {
11
11
  edges {
12
12
  node {
13
13
  Id
@@ -59,7 +59,7 @@ export function mapCaseCommentsResponse(data) {
59
59
  var _a, _b, _c;
60
60
  if (!data)
61
61
  return [];
62
- const edges = (_c = (_b = (_a = data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.SalesforceSupportCaseComment__c) === null || _c === void 0 ? void 0 : _c.edges;
62
+ const edges = (_c = (_b = (_a = data.redhat_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.RedHatSupportCaseComment__c) === null || _c === void 0 ? void 0 : _c.edges;
63
63
  if (!edges)
64
64
  return [];
65
65
  return edges.map((edge) => mapCaseCommentNode(edge.node));
@@ -34,9 +34,9 @@ export interface ICaseCommentsConnection {
34
34
  edges: ICaseCommentEdge[];
35
35
  }
36
36
  export interface IGetCaseCommentsQueryResponse {
37
- salesforce_support_uiapi: {
37
+ redhat_support_uiapi: {
38
38
  query: {
39
- SalesforceSupportCaseComment__c: ICaseCommentsConnection;
39
+ RedHatSupportCaseComment__c: ICaseCommentsConnection;
40
40
  };
41
41
  };
42
42
  }
@@ -69,9 +69,9 @@ export interface ICreateCaseCommentVariables {
69
69
  commentInput: ICreateCaseCommentInput;
70
70
  }
71
71
  export interface ICreateCaseCommentResponse {
72
- salesforce_support_uiapi: {
72
+ redhat_support_uiapi: {
73
73
  CaseComment__cCreate: {
74
- SalesforceSupportRecord: {
74
+ RedHatSupportRecord: {
75
75
  Id: string;
76
76
  };
77
77
  };
@@ -1 +1 @@
1
- {"version":3,"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;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,2BAA2B;IACxC,YAAY,EAAE,uBAAuB,CAAC;CACzC;AAED,MAAM,WAAW,0BAA0B;IACvC,wBAAwB,EAAE;QACtB,oBAAoB,EAAE;YAClB,uBAAuB,EAAE;gBACrB,EAAE,EAAE,MAAM,CAAC;aACd,CAAC;SACL,CAAC;KACL,CAAC;CACL"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACnC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,wBAAwB;IACrC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IAClC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,SAAS,EAAE,uBAAuB,CAAC;CACtC;AAED,MAAM,WAAW,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ChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,2BAA2B;IACxC,YAAY,EAAE,uBAAuB,CAAC;CACzC;AAED,MAAM,WAAW,0BAA0B;IACvC,oBAAoB,EAAE;QAClB,oBAAoB,EAAE;YAClB,mBAAmB,EAAE;gBACjB,EAAE,EAAE,MAAM,CAAC;aACd,CAAC;SACL,CAAC;KACL,CAAC;CACL"}
@@ -6,11 +6,11 @@ import type { ICaseHistoryItem, IGetCaseHistoryData, IGetCaseHistoryVars } from
6
6
  * Changing an alias here without updating `extractStringValue` will silently break
7
7
  * value extraction.
8
8
  *
9
- * Supported value types (members of the Salesforce_Support_AnyType union):
10
- * - SalesforceSupportStringValue → stringValue
11
- * - SalesforceSupportBooleanValue → booleanValue
12
- * - SalesforceSupportDoubleValue → doubleValue
13
- * - SalesforceSupportDateTimeValue → dateTimeValue
9
+ * Supported value types (members of the RedHat_Support_AnyType union):
10
+ * - RedHatSupportStringValue → stringValue
11
+ * - RedHatSupportBooleanValue → booleanValue
12
+ * - RedHatSupportDoubleValue → doubleValue
13
+ * - RedHatSupportDateTimeValue → dateTimeValue
14
14
  *
15
15
  * `first` defaults to 2000 — a practical cap that covers all observed real-world case
16
16
  * histories while staying well within the SF API limit.
@@ -8,53 +8,53 @@ import { filterSfdcIdEntries, normalizeNodeToHistoryItem } from '../utils/caseHi
8
8
  * Changing an alias here without updating `extractStringValue` will silently break
9
9
  * value extraction.
10
10
  *
11
- * Supported value types (members of the Salesforce_Support_AnyType union):
12
- * - SalesforceSupportStringValue → stringValue
13
- * - SalesforceSupportBooleanValue → booleanValue
14
- * - SalesforceSupportDoubleValue → doubleValue
15
- * - SalesforceSupportDateTimeValue → dateTimeValue
11
+ * Supported value types (members of the RedHat_Support_AnyType union):
12
+ * - RedHatSupportStringValue → stringValue
13
+ * - RedHatSupportBooleanValue → booleanValue
14
+ * - RedHatSupportDoubleValue → doubleValue
15
+ * - RedHatSupportDateTimeValue → dateTimeValue
16
16
  *
17
17
  * `first` defaults to 2000 — a practical cap that covers all observed real-world case
18
18
  * histories while staying well within the SF API limit.
19
19
  */
20
20
  export const GET_CASE_HISTORY = gql `
21
21
  query GetCaseHistory($caseId: ID!, $first: Int = 2000) {
22
- salesforce_support_uiapi {
22
+ redhat_support_uiapi {
23
23
  query {
24
- SalesforceSupportCaseHistory(first: $first, where: { CaseId: { eq: $caseId } }) {
24
+ RedHatSupportCaseHistory(first: $first, where: { CaseId: { eq: $caseId } }) {
25
25
  edges {
26
26
  node {
27
27
  Id
28
- SalesforceSupportField {
28
+ RedHatSupportField {
29
29
  value
30
30
  displayValue
31
31
  label
32
32
  }
33
33
  OldValue {
34
- ... on SalesforceSupportStringValue {
34
+ ... on RedHatSupportStringValue {
35
35
  stringValue: value
36
36
  }
37
- ... on SalesforceSupportBooleanValue {
37
+ ... on RedHatSupportBooleanValue {
38
38
  booleanValue: value
39
39
  }
40
- ... on SalesforceSupportDoubleValue {
40
+ ... on RedHatSupportDoubleValue {
41
41
  doubleValue: value
42
42
  }
43
- ... on SalesforceSupportDateTimeValue {
43
+ ... on RedHatSupportDateTimeValue {
44
44
  dateTimeValue: value
45
45
  }
46
46
  }
47
47
  NewValue {
48
- ... on SalesforceSupportStringValue {
48
+ ... on RedHatSupportStringValue {
49
49
  stringValue: value
50
50
  }
51
- ... on SalesforceSupportBooleanValue {
51
+ ... on RedHatSupportBooleanValue {
52
52
  booleanValue: value
53
53
  }
54
- ... on SalesforceSupportDoubleValue {
54
+ ... on RedHatSupportDoubleValue {
55
55
  doubleValue: value
56
56
  }
57
- ... on SalesforceSupportDateTimeValue {
57
+ ... on RedHatSupportDateTimeValue {
58
58
  dateTimeValue: value
59
59
  }
60
60
  }
@@ -89,7 +89,7 @@ export function useCaseHistory(caseId, first = 2000) {
89
89
  });
90
90
  const historyItems = useMemo(() => {
91
91
  var _a, _b, _c;
92
- const edges = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.SalesforceSupportCaseHistory) === null || _c === void 0 ? void 0 : _c.edges;
92
+ const edges = (_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.RedHatSupportCaseHistory) === null || _c === void 0 ? void 0 : _c.edges;
93
93
  if (!edges)
94
94
  return [];
95
95
  return filterSfdcIdEntries(edges).map(normalizeNodeToHistoryItem);
@@ -1,9 +1,10 @@
1
- export declare function useS3Upload(idToUploadTo: any, isSecureSupport: any): {
2
- uploadFile: ({ file, description, isPrivate, listenerFn }: {
3
- file: any;
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: any, abort: any) => void;
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":"AASA,wBAAgB,WAAW,CAAC,YAAY,KAAA,EAAE,eAAe,KAAA;;;;;;;;EA0ExD"}
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 { caseAttachments } from '@cee-eng/hydrajs';
11
- import { ToastNotification, useFetch } from '@rh-support/components';
10
+ import { ToastNotification } from '@rh-support/components';
11
+ import { fetchCaseDetailsByCaseNumber, pollAttachmentUploadStatus, uploadCaseAttachment, } from '@rh-support/utils';
12
12
  import { useTranslation } from 'react-i18next';
13
- export function useS3Upload(idToUploadTo, isSecureSupport) {
14
- const { request, isFetching: isUploadingFile } = useFetch(caseAttachments.uploadAttachmentS3, {
15
- propgateErrors: true,
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 = (ev) => reject({ ableToUpload: false, ableToUploadMessage: `${fileName} ${t("Can't be selected")}` });
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 = (percent, abort) => { } }) {
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
- const attachmentId = yield request(idToUploadTo, {
56
- description: description,
57
- fileName: file.name,
58
- isPrivate: isPrivate,
59
- size: file.size,
60
- }, putObjectRequest, listener, true, { partSize: 5 * 1024 * 1024, queueSize: 5 }, isSecureSupport);
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
- // Show alert if needed
56
+ return;
66
57
  }
58
+ throw error;
67
59
  }
68
60
  });
69
- return { uploadFile, isUploadingFile };
61
+ return {
62
+ uploadFile,
63
+ isUploadingFile: false,
64
+ };
70
65
  }
@@ -13,7 +13,7 @@ export interface ISFDateTimeValue {
13
13
  export type SFValue = ISFStringValue | ISFBooleanValue | ISFDoubleValue | ISFDateTimeValue | null;
14
14
  export interface ICaseHistoryNode {
15
15
  Id: string;
16
- SalesforceSupportField: {
16
+ RedHatSupportField: {
17
17
  value: string;
18
18
  displayValue: string | null;
19
19
  label: string | null;
@@ -39,9 +39,9 @@ export interface ICaseHistoryEdge {
39
39
  node: ICaseHistoryNode;
40
40
  }
41
41
  export interface IGetCaseHistoryData {
42
- salesforce_support_uiapi: {
42
+ redhat_support_uiapi: {
43
43
  query: {
44
- SalesforceSupportCaseHistory: {
44
+ RedHatSupportCaseHistory: {
45
45
  edges: ICaseHistoryEdge[];
46
46
  };
47
47
  };
@@ -1 +1 @@
1
- {"version":3,"file":"caseHistory.d.ts","sourceRoot":"","sources":["../../../src/models/caseHistory.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC3B,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC5B,YAAY,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC3B,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC7B,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,OAAO,GAAG,cAAc,GAAG,eAAe,GAAG,cAAc,GAAG,gBAAgB,GAAG,IAAI,CAAC;AAElG,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,M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AW,mBAAmB;IAChC,oBAAoB,EAAE;QAClB,KAAK,EAAE;YACH,wBAAwB,EAAE;gBACtB,KAAK,EAAE,gBAAgB,EAAE,CAAC;aAC7B,CAAC;SACL,CAAC;KACL,CAAC;CACL;AAED,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,oFAAoF;IACpF,SAAS,EAAE,MAAM,CAAC;IAClB,4GAA4G;IAC5G,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,6FAA6F;IAC7F,UAAU,EAAE,MAAM,CAAC;CACtB"}
@@ -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, isSecureSupport: boolean) => Promise<void>;
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":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAKxE,KAAK,WAAW,GAAG,OAAO,CAAC,oBAAoB,EAAE,cAAc,CAAC,CAAC;AACjE,MAAM,MAAM,8BAA8B,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AAE1E,oBAAY,oBAAoB;IAC5B,WAAW,gBAAgB;CAC9B;AAED,MAAM,WAAW,cAAc;IAC3B,kBAAkB,EAAE,mBAAmB,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;IACrE,mBAAmB,EAAE,mBAAmB,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAGjE,0BAA0B,EAAE,mBAAmB,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACpE,eAAe,EAAE,mBAAmB,C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AAmB,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;IACrE,mBAAmB,EAAE,mBAAmB,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAGjE,0BAA0B,EAAE,mBAAmB,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACpE,eAAe,EAAE,mBAAmB,CAAC,eAAe,EAAE,CAAC,CAAC;CAC3D;AAED,eAAO,MAAM,2BAA2B,EAAE,cAOzC,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,OAAO,cAAc,EAAE,QAAQ,WAAW,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 { kase, publicApi } from '@cee-eng/hydrajs';
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, isSecureSupport) => __awaiter(void 0, void 0, void 0, function* () {
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
- const allAttachments = yield kase.getAttachments(caseNumber, false, isSecureSupport);
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) },
@@ -106,7 +114,7 @@ export const fetchCaseEscalations = (dispatch_1, parentId_1, apolloClient_1, ...
106
114
  query: GET_ESCALATION_DETAILS,
107
115
  variables: { where: { ParentId: { eq: parentId } } },
108
116
  });
109
- const edges = (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.SalesforceSupportCase) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
117
+ 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.RedHatSupportCase) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
110
118
  const caseEscalations = edges.map(({ node }) => ({
111
119
  name: node.CaseNumber.value,
112
120
  subject: node.Subject.value,
@@ -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, isSecureSupport: boolean, discussionFiltersListState: IFilter[], dispatchCaseDetailsHydraAttachments: any) => Promise<void>;
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 {};