@rh-support/troubleshoot 2.6.296 → 2.6.299

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 (97) hide show
  1. package/lib/esm/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.d.ts.map +1 -1
  2. package/lib/esm/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.js +4 -7
  3. package/lib/esm/components/CaseEditView/Case.d.ts.map +1 -1
  4. package/lib/esm/components/CaseEditView/Case.js +42 -12
  5. package/lib/esm/components/CaseEditView/CaseDetailsTabs.d.ts.map +1 -1
  6. package/lib/esm/components/CaseEditView/CaseDetailsTabs.js +17 -7
  7. package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.d.ts +1 -2
  8. package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.d.ts.map +1 -1
  9. package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.js +8 -6
  10. package/lib/esm/components/CaseEditView/CaseOverview/index.d.ts.map +1 -1
  11. package/lib/esm/components/CaseEditView/CaseOverview/index.js +17 -12
  12. package/lib/esm/components/CaseEditView/ConfirmationModals/ReopenCaseModal.d.ts +1 -3
  13. package/lib/esm/components/CaseEditView/ConfirmationModals/ReopenCaseModal.d.ts.map +1 -1
  14. package/lib/esm/components/CaseEditView/ConfirmationModals/ReopenCaseModal.js +3 -4
  15. package/lib/esm/components/CaseEditView/RequestRemoteSession/ESSRemoteSessionModal.d.ts.map +1 -1
  16. package/lib/esm/components/CaseEditView/RequestRemoteSession/ESSRemoteSessionModal.js +4 -7
  17. package/lib/esm/components/CaseEditView/RequestRemoteSession/NewEssTermsModal.d.ts.map +1 -1
  18. package/lib/esm/components/CaseEditView/RequestRemoteSession/NewEssTermsModal.js +4 -30
  19. package/lib/esm/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.d.ts.map +1 -1
  20. package/lib/esm/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.js +4 -30
  21. package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.d.ts +3 -0
  22. package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.d.ts.map +1 -0
  23. package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.js +22 -0
  24. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts +4 -2
  25. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts.map +1 -1
  26. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.js +110 -148
  27. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useAttachmentUploadCompletion.d.ts +15 -0
  28. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useAttachmentUploadCompletion.d.ts.map +1 -0
  29. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useAttachmentUploadCompletion.js +19 -0
  30. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts +17 -0
  31. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts.map +1 -0
  32. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.js +49 -0
  33. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts +6 -2
  34. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts.map +1 -1
  35. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.js +147 -241
  36. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/CaseHistory.d.ts.map +1 -1
  37. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/CaseHistory.js +3 -1
  38. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.css +4 -4
  39. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.d.ts +35 -3
  40. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.d.ts.map +1 -1
  41. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.js +63 -224
  42. package/lib/esm/components/CaseEditView/Tabs/CaseSummary/CaseSummary.d.ts.map +1 -1
  43. package/lib/esm/components/CaseEditView/Tabs/CaseSummary/CaseSummary.js +7 -2
  44. package/lib/esm/components/CaseEditView/Tabs/RMEEscalations/RMEEscalationList.d.ts.map +1 -1
  45. package/lib/esm/components/CaseEditView/Tabs/RMEEscalations/RMEEscalationList.js +4 -7
  46. package/lib/esm/components/CaseManagement/Cep.d.ts.map +1 -1
  47. package/lib/esm/components/CaseManagement/Cep.js +4 -7
  48. package/lib/esm/components/ProductSelector/NewProductVersionSelector.d.ts.map +1 -1
  49. package/lib/esm/components/ProductSelector/NewProductVersionSelector.js +18 -4
  50. package/lib/esm/components/UpdateSeverityModal/UpdateSeverityModal.d.ts.map +1 -1
  51. package/lib/esm/components/UpdateSeverityModal/UpdateSeverityModal.js +4 -7
  52. package/lib/esm/components/shared/usePostComment.d.ts.map +1 -1
  53. package/lib/esm/components/shared/usePostComment.js +6 -10
  54. package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.d.ts.map +1 -1
  55. package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.js +0 -2
  56. package/lib/esm/hooks/useCaseComments/caseCommentMutation.d.ts +4 -0
  57. package/lib/esm/hooks/useCaseComments/caseCommentMutation.d.ts.map +1 -0
  58. package/lib/esm/hooks/useCaseComments/caseCommentMutation.js +12 -0
  59. package/lib/esm/hooks/useCaseComments/caseCommentsQuery.d.ts +4 -0
  60. package/lib/esm/hooks/useCaseComments/caseCommentsQuery.d.ts.map +1 -0
  61. package/lib/esm/hooks/useCaseComments/caseCommentsQuery.js +55 -0
  62. package/lib/esm/hooks/useCaseComments/index.d.ts +7 -0
  63. package/lib/esm/hooks/useCaseComments/index.d.ts.map +1 -0
  64. package/lib/esm/hooks/useCaseComments/index.js +5 -0
  65. package/lib/esm/hooks/useCaseComments/mapCaseComment.d.ts +25 -0
  66. package/lib/esm/hooks/useCaseComments/mapCaseComment.d.ts.map +1 -0
  67. package/lib/esm/hooks/useCaseComments/mapCaseComment.js +66 -0
  68. package/lib/esm/hooks/useCaseComments/types.d.ts +80 -0
  69. package/lib/esm/hooks/useCaseComments/types.d.ts.map +1 -0
  70. package/lib/esm/hooks/useCaseComments/types.js +1 -0
  71. package/lib/esm/hooks/useCaseComments/useCaseComments.d.ts +16 -0
  72. package/lib/esm/hooks/useCaseComments/useCaseComments.d.ts.map +1 -0
  73. package/lib/esm/hooks/useCaseComments/useCaseComments.js +25 -0
  74. package/lib/esm/hooks/useCaseComments/useCreateCaseComment.d.ts +19 -0
  75. package/lib/esm/hooks/useCaseComments/useCreateCaseComment.d.ts.map +1 -0
  76. package/lib/esm/hooks/useCaseComments/useCreateCaseComment.js +33 -0
  77. package/lib/esm/hooks/useCaseHistory.d.ts +26 -0
  78. package/lib/esm/hooks/useCaseHistory.d.ts.map +1 -0
  79. package/lib/esm/hooks/useCaseHistory.js +98 -0
  80. package/lib/esm/models/caseHistory.d.ts +80 -0
  81. package/lib/esm/models/caseHistory.d.ts.map +1 -0
  82. package/lib/esm/models/caseHistory.js +1 -0
  83. package/lib/esm/reducers/CaseConstNTypes.d.ts +0 -1
  84. package/lib/esm/reducers/CaseConstNTypes.d.ts.map +1 -1
  85. package/lib/esm/reducers/CaseConstNTypes.js +0 -1
  86. package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts +0 -2
  87. package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts.map +1 -1
  88. package/lib/esm/reducers/CaseDiscussionTabReducer.js +1 -28
  89. package/lib/esm/reducers/CaseReducer.d.ts.map +1 -1
  90. package/lib/esm/reducers/CaseReducer.js +14 -4
  91. package/lib/esm/utils/TimelineUtils.d.ts +41 -0
  92. package/lib/esm/utils/TimelineUtils.d.ts.map +1 -0
  93. package/lib/esm/utils/TimelineUtils.js +134 -0
  94. package/lib/esm/utils/caseHistoryUtils.d.ts +66 -0
  95. package/lib/esm/utils/caseHistoryUtils.d.ts.map +1 -0
  96. package/lib/esm/utils/caseHistoryUtils.js +165 -0
  97. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"RequestEscalationModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAA8B,MAAM,OAAO,CAAC;AA0BnD,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAID,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,qBAmYnD"}
1
+ {"version":3,"file":"RequestEscalationModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAmBnD,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAID,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,qBAuXnD"}
@@ -17,13 +17,12 @@ import isEmpty from 'lodash/isEmpty';
17
17
  import React, { useEffect, useState } from 'react';
18
18
  import { Trans, useTranslation } from 'react-i18next';
19
19
  import { useCaseDispatch } from '../../../context/CaseContext';
20
- import { useCaseDetailsPageDispatchContext, useCaseDetailsPageStateContext, } from '../../../context/CaseDetailsPageContext';
21
- import { useCaseDiscussionTabDispatchContext, useCaseDiscussionTabStateContext, } from '../../../context/CaseDiscussionTabContext';
20
+ import { useCaseDetailsPageDispatchContext } from '../../../context/CaseDetailsPageContext';
22
21
  import { CustomerGEOs } from '../../../enums/customerGEOs';
23
22
  import { CREATE_RME_CASE_ESCALATION, GET_PARENT_ID, } from '../../../graphql';
23
+ import { GET_CASE_COMMENTS } from '../../../hooks/useCaseComments';
24
24
  import { ESCALATION_SUBJECT_LENGTH_LIMIT } from '../../../reducers/CaseConstNTypes';
25
25
  import { fetchCaseEscalations } from '../../../reducers/CaseDetailsPageReducer';
26
- import { updateDiscussionStateComments } from '../../../reducers/CaseDiscussionTabReducer';
27
26
  import { checkForCaseStatusToggleOnAttachOrComment, fetchCaseDetailsHydra } from '../../../reducers/CaseReducer';
28
27
  const customerGEOKeys = Object.keys(CustomerGEOs);
29
28
  export function RequestEscalationModal(props) {
@@ -51,9 +50,7 @@ export function RequestEscalationModal(props) {
51
50
  });
52
51
  const { request: updateCaseRequest, isFetching: isUpdatingCase } = useFetch(publicApi.kase.updateCase);
53
52
  const { request: getRmeCategories, isFetching: isCategoriesFetching } = useFetch(escalations.getEscalationCategories, { propgateErrors: true });
54
- const { sort, allDiscussions, discussionFiltersListState } = useCaseDiscussionTabStateContext();
55
- const dispatchDiscussion = useCaseDiscussionTabDispatchContext();
56
- const { caseDetailsPageState: { caseFeedbacksHydra }, } = useCaseDetailsPageStateContext();
53
+ const client = useApolloClient();
57
54
  const caseDetailsPageDispatch = useCaseDetailsPageDispatchContext();
58
55
  const caseDispatch = useCaseDispatch();
59
56
  const [creationError, setCreationError] = useState(false);
@@ -67,7 +64,7 @@ export function RequestEscalationModal(props) {
67
64
  const submitEscalationComment = (escalationNum, comment) => __awaiter(this, void 0, void 0, function* () {
68
65
  escalationNum && fetchCaseEscalations(caseDetailsPageDispatch, props.caseNumber, apolloClient, false);
69
66
  yield postCommentRequest({ caseNumber: props.caseNumber, commentBody: comment, contentType: 'markdown' });
70
- updateDiscussionStateComments(dispatchDiscussion, caseDispatch, props.caseNumber, allDiscussions, sort, caseFeedbacksHydra.data, discussionFiltersListState);
67
+ client.refetchQueries({ include: [GET_CASE_COMMENTS] });
71
68
  yield updateCaseRequest(props.caseNumber, { customerEscalation: true });
72
69
  checkForCaseStatusToggleOnAttachOrComment(caseDispatch, loggedInUserRights.data.isInternal(), props.caseStatus);
73
70
  yield fetchCaseDetailsHydra(caseDispatch, props.caseNumber, loggedInUserRights.data, loggedInUser.data, apolloClient);
@@ -1 +1 @@
1
- {"version":3,"file":"Case.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/Case.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAS,mBAAmB,EAAiD,MAAM,kBAAkB,CAAC;AAmB7G,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC;CACnC;AAED,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAK,EAAE,MAAM,qBAoPzC"}
1
+ {"version":3,"file":"Case.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/Case.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAS,mBAAmB,EAAiD,MAAM,kBAAkB,CAAC;AAoB7G,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC;CACnC;AAED,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAK,EAAE,MAAM,qBA0PzC"}
@@ -20,7 +20,13 @@ import { Route, Switch, useLocation, useParams, useRouteMatch } from 'react-rout
20
20
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
21
21
  import { useCaseDetailsPageDispatchContext } from '../../context/CaseDetailsPageContext';
22
22
  import { CaseReducerConstants } from '../../reducers/CaseConstNTypes';
23
- import { fetchAttachments, fetchCaseEscalations, fetchExternalTrackers, fetchFeedbacks, } from '../../reducers/CaseDetailsPageReducer';
23
+ import {
24
+ // TODO: Re-enable after GraphQL migration
25
+ // fetchAttachments,
26
+ fetchCaseEscalations,
27
+ // fetchExternalTrackers,
28
+ // fetchFeedbacks,
29
+ } from '../../reducers/CaseDetailsPageReducer';
24
30
  import { setCaseAccountNumber } from '../../reducers/CaseReducer';
25
31
  import { CaseDetailsAside } from './CaseDetailsAside';
26
32
  import { CaseDetailsErrorMessage } from './CaseDetailsErrorMessage';
@@ -45,8 +51,18 @@ export default function Case(props) {
45
51
  const canSeeFeedbackButtons = ability.can(resourceActions.PATCH, resources.CASE_DETAILS, CaseDetailsFields.CASE_DETAILS_FEEDBACK_BUTTONS);
46
52
  const canReadCase = ability.can(resourceActions.READ, resources.CASE_DETAILS);
47
53
  const canManageCase = ability.can(resourceActions.UPDATE, resources.CASE_DETAILS);
48
- const canSeeExternalTracker = ability.can(resourceActions.PATCH, resources.CASE_DETAILS, CaseDetailsFields.CASE_DETAILS_EXTERNAL_TRACKER);
49
- const canSeeAttachments = ability.can(resourceActions.PATCH, resources.CASE_DETAILS, CaseDetailsFields.CASE_DETAILS_SEE_ATTACHMENTS);
54
+ // TODO: Re-enable after GraphQL migration of external trackers
55
+ // const canSeeExternalTracker = ability.can(
56
+ // resourceActions.PATCH,
57
+ // resources.CASE_DETAILS,
58
+ // CaseDetailsFields.CASE_DETAILS_EXTERNAL_TRACKER
59
+ // );
60
+ // TODO: Re-enable after GraphQL migration of attachments
61
+ // const canSeeAttachments = ability.can(
62
+ // resourceActions.PATCH,
63
+ // resources.CASE_DETAILS,
64
+ // CaseDetailsFields.CASE_DETAILS_SEE_ATTACHMENTS
65
+ // );
50
66
  const canSeeRMEs = ability.can(resourceActions.PATCH, resources.CASE_DETAILS, CaseDetailsFields.CASE_DETAILS_RMES);
51
67
  const { product, isFetchingCaseDetails, isFetchingCaseDetailsError, caseDetailsError, selectedAccountDetails } = useCaseSelector((state) => ({
52
68
  product: state.caseDetails.product,
@@ -81,6 +97,7 @@ export default function Case(props) {
81
97
  useEffect(() => {
82
98
  if (!isEmpty(loggedInUsersAccount.data) &&
83
99
  !isEmpty(selectedAccountDetails.data) &&
100
+ selectedAccountDetails.data.accountNumber &&
84
101
  loggedInUserRights.data.isAccountSameAsLoggedInAccount(selectedAccountDetails.data.accountNumber) &&
85
102
  !isEqual(loggedInUsersAccount.data, selectedAccountDetails.data)) {
86
103
  setCaseAccountNumber(caseDispatch, loggedInUsersAccount.data.accountNumber, true, loggedInUsersAccount.data);
@@ -115,15 +132,28 @@ export default function Case(props) {
115
132
  if (canSeeRMEs) {
116
133
  fetchCaseEscalations((action) => currentCaseRef.current === targetCaseNumber && caseDetailsPageDispatch(action), targetCaseNumber, apolloClient);
117
134
  }
118
- if (canSeeAttachments) {
119
- fetchAttachments((action) => currentCaseRef.current === targetCaseNumber && caseDetailsPageDispatch(action), targetCaseNumber, loggedInUsersAccount.data.secureSupport);
120
- }
121
- if (canSeeExternalTracker) {
122
- fetchExternalTrackers((action) => currentCaseRef.current === targetCaseNumber && caseDetailsPageDispatch(action), targetCaseNumber);
123
- }
124
- if (canSeeFeedbackButtons) {
125
- fetchFeedbacks((action) => currentCaseRef.current === targetCaseNumber && caseDetailsPageDispatch(action), targetCaseNumber);
126
- }
135
+ // TODO: Re-enable after GraphQL migration of attachments
136
+ // if (canSeeAttachments) {
137
+ // fetchAttachments(
138
+ // (action) => currentCaseRef.current === targetCaseNumber && caseDetailsPageDispatch(action),
139
+ // targetCaseNumber,
140
+ // loggedInUsersAccount.data.secureSupport!
141
+ // );
142
+ // }
143
+ // TODO: Re-enable after GraphQL migration of external trackers
144
+ // if (canSeeExternalTracker) {
145
+ // fetchExternalTrackers(
146
+ // (action) => currentCaseRef.current === targetCaseNumber && caseDetailsPageDispatch(action),
147
+ // targetCaseNumber
148
+ // );
149
+ // }
150
+ // TODO: Re-enable after GraphQL migration of feedback
151
+ // if (canSeeFeedbackButtons) {
152
+ // fetchFeedbacks(
153
+ // (action) => currentCaseRef.current === targetCaseNumber && caseDetailsPageDispatch(action),
154
+ // targetCaseNumber
155
+ // );
156
+ // }
127
157
  if (currentCaseRef.current === targetCaseNumber) {
128
158
  checkRemoteSessionFlag();
129
159
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CaseDetailsTabs.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/CaseDetailsTabs.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAa,MAAM,kBAAkB,CAAC;AA2BlE,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,mBAAmB,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;CACnD;AACD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,qBAqS5C"}
1
+ {"version":3,"file":"CaseDetailsTabs.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/CaseDetailsTabs.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAa,MAAM,kBAAkB,CAAC;AA4BlE,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,mBAAmB,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;CACnD;AACD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,qBAsT5C"}
@@ -12,6 +12,7 @@ import { useParams } from 'react-router-dom';
12
12
  import { CaseDetailsTabsEnum } from '../../constants/caseDetailsConstants';
13
13
  import { useCaseSelector } from '../../context/CaseContext';
14
14
  import { useCaseDetailsPageStateContext } from '../../context/CaseDetailsPageContext';
15
+ import { useCaseComments } from '../../hooks/useCaseComments';
15
16
  import { PDFContext } from './PDFContainer';
16
17
  import CaseDetailsManagement from './Tabs/CaseDetails/CaseDetailsManagement';
17
18
  import CaseHistory from './Tabs/CaseHistory/CaseHistory';
@@ -28,12 +29,17 @@ export function CaseDetailsTabs(props) {
28
29
  const { caseNumber } = props;
29
30
  const { activeTab } = useParams();
30
31
  const { globalMetadataState: { loggedInUserRights, loggedInUsersAccount, pcmConfig, viewAsCustomer }, } = useContext(GlobalMetadataStateContext);
31
- const { accountNumber, chats, comments, status } = useCaseSelector((state) => ({
32
+ const { accountNumber, status, caseSalesforceId } = useCaseSelector((state) => ({
32
33
  accountNumber: state.caseDetails.accountNumberRef,
33
- chats: state.caseDetails.chats,
34
- comments: state.caseDetails.comments,
34
+ // TODO: Re-enable after GraphQL migration of chats
35
+ // chats: state.caseDetails.chats,
35
36
  status: state.caseDetails.status,
37
+ caseSalesforceId: state.caseDetails.id,
36
38
  }), isEqual);
39
+ const { comments, loading: commentsLoading, error: commentsError, refetch: refetchComments, } = useCaseComments({
40
+ caseId: caseSalesforceId,
41
+ skip: !caseSalesforceId,
42
+ });
37
43
  const { t } = useTranslation();
38
44
  const [activeTabKey, setActiveTabKey] = useState(0);
39
45
  const { caseDetailsPageState: { caseEscalations }, } = useCaseDetailsPageStateContext();
@@ -58,9 +64,10 @@ export function CaseDetailsTabs(props) {
58
64
  const caseHistoryTabRef = useRef(null);
59
65
  const generateAiCaseSummaryTabRef = useRef(null);
60
66
  const tabsToRender = [];
61
- const handleTabClick = (event, tabIndex) => {
62
- setActiveTabKey(tabIndex);
63
- setSelectedTab(tabsToRender[tabIndex].title);
67
+ const handleTabClick = (_event, tabIndex) => {
68
+ const index = Number(tabIndex);
69
+ setActiveTabKey(index);
70
+ setSelectedTab(tabsToRender[index].title);
64
71
  };
65
72
  const isCaseHistoryEnabled = getConfigField(pcmConfig.data, 'isCaseHistoryEnabled', PCM_CONFIG_FIELD_TYPE.FEATURE_FLAG);
66
73
  tabsToRender.push({
@@ -69,7 +76,10 @@ export function CaseDetailsTabs(props) {
69
76
  title: CaseDetailsTabsEnum.DISCUSSION,
70
77
  ref: discussionTabRef,
71
78
  routePath: 'discussion',
72
- component: (React.createElement(CaseDiscussion, { caseNumber: caseNumber, tabRef: discussionTabRef, caseComments: comments, caseChats: chats, accountNumber: accountNumber, isDiscussionTab: selectedTab === CaseDetailsTabsEnum.DISCUSSION })),
79
+ component: (React.createElement(CaseDiscussion, { caseNumber: caseNumber, tabRef: discussionTabRef, caseComments: comments, commentsLoading: commentsLoading, commentsError: commentsError,
80
+ // TODO: Re-enable after GraphQL migration of chats
81
+ // caseChats={chats}
82
+ accountNumber: accountNumber, isDiscussionTab: selectedTab === CaseDetailsTabsEnum.DISCUSSION, refetchComments: refetchComments })),
73
83
  });
74
84
  tabsToRender.push({
75
85
  'data-tracking-id': 'case-details-tab',
@@ -2,9 +2,8 @@ import { IDClassNameProps } from '@rh-support/types/shared';
2
2
  import React from 'react';
3
3
  interface IProps extends IDClassNameProps {
4
4
  selectedStatus: string;
5
- onStatusChange: (val: string) => void | Promise<void>;
5
+ onStatusChange: (portalStatus: string) => void | Promise<void>;
6
6
  isDisabled: boolean;
7
- allStatuses: string[];
8
7
  isFetching: boolean;
9
8
  hasError: boolean;
10
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CaseStatus.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/CaseOverview/CaseStatus.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,KAA+B,MAAM,OAAO,CAAC;AAOpD,UAAU,MAAO,SAAQ,gBAAgB;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACrB;AAOD,iBAAS,UAAU,CAAC,KAAK,EAAE,MAAM,qBA8DhC;kBA9DQ,UAAU;;;AAiEnB,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"CaseStatus.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/CaseOverview/CaseStatus.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAI5D,OAAO,KAAwC,MAAM,OAAO,CAAC;AAO7D,UAAU,MAAO,SAAQ,gBAAgB;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;CACrB;AAOD,iBAAS,UAAU,CAAC,KAAK,EAAE,MAAM,qBAmEhC;kBAnEQ,UAAU;;;AAsEnB,eAAe,UAAU,CAAC"}
@@ -8,9 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { SingleSelectDropdown, ValueChangedIcon } from '@rh-support/components';
11
+ import { mapSfdcStatusToPortalStatus, PORTAL_DISPLAY_STATUSES } from '@rh-support/utils';
11
12
  import isEmpty from 'lodash/isEmpty';
12
13
  import map from 'lodash/map';
13
- import React, { useContext, useState } from 'react';
14
+ import React, { useContext, useMemo, useState } from 'react';
14
15
  import { Trans, useTranslation } from 'react-i18next';
15
16
  import { CaseValuesToWatch } from '../../shared/Constants';
16
17
  import { getChangedValueTooltip } from '../../shared/utils';
@@ -26,29 +27,30 @@ function CaseStatus(props) {
26
27
  setIsCaseStatusInValid(isEmpty(selectedItem));
27
28
  };
28
29
  const { isExportingPDF } = useContext(PDFContext);
30
+ const selectedPortalStatus = useMemo(() => mapSfdcStatusToPortalStatus(props.selectedStatus), [props.selectedStatus]);
29
31
  // value changed logic to show a non local status change
30
32
  const [localStatusChange, setLocalStatusChange] = useState(false);
31
33
  const afterLocalChange = () => setLocalStatusChange(false);
32
34
  const onCaseStatusChange = (option) => __awaiter(this, void 0, void 0, function* () {
33
- if (option.value === props.selectedStatus) {
35
+ if (option.value === selectedPortalStatus) {
34
36
  return;
35
37
  }
36
38
  yield props.onStatusChange(option.value);
37
39
  setLocalStatusChange(true);
38
40
  validateCaseStatus(option);
39
41
  });
40
- const getDropdownOptions = map(props.allStatuses || [], (option) => ({
42
+ const getDropdownOptions = map(PORTAL_DISPLAY_STATUSES, (option) => ({
41
43
  label: option,
42
44
  value: option,
43
45
  }));
44
46
  const getSelectedDropdownOption = {
45
- label: props.selectedStatus,
46
- value: props.selectedStatus,
47
+ label: selectedPortalStatus,
48
+ value: selectedPortalStatus,
47
49
  };
48
50
  return (React.createElement("div", { className: `form-group ${props.className}`, id: `${props.id}` },
49
51
  React.createElement("h3", { className: "subheading subheading-sm" },
50
52
  React.createElement(Trans, null, "Status"),
51
- React.createElement(ValueChangedIcon, { afterLocalChange: afterLocalChange, isLocalChange: localStatusChange, value: props.selectedStatus, getTooltipContent: getChangedValueTooltip(() => CaseValuesToWatch.status) }),
53
+ React.createElement(ValueChangedIcon, { afterLocalChange: afterLocalChange, isLocalChange: localStatusChange, value: selectedPortalStatus, getTooltipContent: getChangedValueTooltip(() => CaseValuesToWatch.status) }),
52
54
  React.createElement("span", { className: `form-required ${isExportingPDF ? 'hide-in-pdf' : ''}`, "aria-hidden": true }, "*")),
53
55
  React.createElement(SingleSelectDropdown, { placeholder: t(`Select a status`), dataTrackingId: "case-details-status-selector", options: getDropdownOptions, selected: getSelectedDropdownOption, isDisabled: props.hasError || props.isDisabled || props.isFetching, isLoading: props.isFetching, isInvalid: isCaseStatusInValid, onSelect: onCaseStatusChange })));
54
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/CaseOverview/index.tsx"],"names":[],"mappings":"AAiCA,OAAO,KAAkD,MAAM,OAAO,CAAC;AA2BvE,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;CACnD;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,MAAM,qBAkgBjD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/CaseOverview/index.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAAkD,MAAM,OAAO,CAAC;AA2BvE,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;CACnD;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,MAAM,qBAugBjD"}
@@ -14,7 +14,7 @@ import LockIcon from '@patternfly/react-icons/dist/js/icons/lock-icon';
14
14
  import { ToastNotification, useConfirmation } from '@rh-support/components';
15
15
  import { CloseCaseModal, fetchAllStatuses, fetchCaseSeverities, fetchCaseTypes, GlobalMetadataDispatchContext, GlobalMetadataStateContext, useCanEditCase, } from '@rh-support/react-context';
16
16
  import { AbilityContext, CaseDetailsFields, resourceActions, resources } from '@rh-support/user-permissions';
17
- import { dtmTrackEventCaseStepEncountered, haventLoadedMetadata, isOpenShiftOnlineProduct, PreviousCaseTypes, toNewCaseTypeMapper, toNewCaseTypeSwitcher, } from '@rh-support/utils';
17
+ import { dtmTrackEventCaseStepEncountered, haventLoadedMetadata, isOpenShiftOnlineProduct, mapSfdcStatusToPortalStatus, PreviousCaseTypes, resolvePortalStatusToApiValue, toNewCaseTypeMapper, toNewCaseTypeSwitcher, } from '@rh-support/utils';
18
18
  import isEqual from 'lodash/isEqual';
19
19
  import React, { useContext, useEffect, useRef, useState } from 'react';
20
20
  import { Trans, useTranslation } from 'react-i18next';
@@ -173,24 +173,28 @@ export default function CaseOverview(props) {
173
173
  caseUpdateError.showError(e, t('Status failed to update'));
174
174
  }
175
175
  });
176
- const onStatusChange = (newStatus) => __awaiter(this, void 0, void 0, function* () {
176
+ const onStatusChange = (newPortalStatus) => __awaiter(this, void 0, void 0, function* () {
177
177
  if (canEditCase.alert())
178
178
  return;
179
- if (status === CaseStatusEnum.CLOSED && newStatus !== CaseStatusEnum.CLOSED) {
180
- onCaseReopen(newStatus);
179
+ const currentPortalStatus = mapSfdcStatusToPortalStatus(status);
180
+ const newApiStatus = resolvePortalStatusToApiValue(newPortalStatus, status);
181
+ if (currentPortalStatus === 'Closed' && newPortalStatus !== 'Closed') {
182
+ onCaseReopen(newPortalStatus);
181
183
  }
182
- else if (newStatus === CaseStatusEnum.CLOSED) {
184
+ else if (newPortalStatus === 'Closed') {
183
185
  onCaseClose();
184
186
  }
185
187
  else {
186
188
  yield confirm({
187
189
  title: t(`Update the status of the case?`),
188
- description: t('Are you sure you want to change the case status to {{newStatus}}?', { newStatus }),
190
+ description: t('Are you sure you want to change the case status to {{newStatus}}?', {
191
+ newStatus: newPortalStatus,
192
+ }),
189
193
  confirmText: t('Yes, confirm'),
190
194
  cancelText: t('No, cancel'),
191
195
  modalVariant: ModalVariant.small,
192
196
  });
193
- updateStatusState(newStatus);
197
+ updateStatusState(newApiStatus);
194
198
  }
195
199
  });
196
200
  const onCaseClose = () => __awaiter(this, void 0, void 0, function* () {
@@ -229,7 +233,7 @@ export default function CaseOverview(props) {
229
233
  React.createElement("span", { className: "pf-v6-u-ml-sm" },
230
234
  React.createElement(ExternalLinkAltIcon, null))));
231
235
  };
232
- const isCaseInOpenState = status !== CaseStatusEnum.CLOSED;
236
+ const isCaseInOpenState = mapSfdcStatusToPortalStatus(status) !== 'Closed';
233
237
  // To switch from old case type to new support type
234
238
  const newCaseTypesArray = toNewCaseTypeMapper(allCaseTypes.data).sort();
235
239
  return (React.createElement(React.Fragment, null,
@@ -301,7 +305,7 @@ export default function CaseOverview(props) {
301
305
  React.createElement("div", { className: "case-overview-secondary card card-md card-light push-bottom" },
302
306
  React.createElement("div", { className: "pf-v6-l-grid pf-m-gutter pf-m-all-4-col-on-lg" },
303
307
  React.createElement("div", { className: "form-wrapper" },
304
- React.createElement(CaseStatus, { selectedStatus: status, onStatusChange: onStatusChange, isDisabled: !canManageCase || allCaseStatuses.isFetching, allStatuses: allCaseStatuses.data, isFetching: caseOverviewState.caseStatusUpdating && isCaseUpdating, hasError: allCaseStatuses.isError })),
308
+ React.createElement(CaseStatus, { selectedStatus: status, onStatusChange: onStatusChange, isDisabled: !canManageCase || allCaseStatuses.isFetching, isFetching: caseOverviewState.caseStatusUpdating && isCaseUpdating, hasError: allCaseStatuses.isError })),
305
309
  React.createElement("div", { className: "form-wrapper" },
306
310
  React.createElement(CaseType, { selectedType: switchedCaseType, onTypeChange: onTypeChange, isDisabled: !canManageCase || allCaseTypes.isFetching || isCaseUpdating, allTypes: newCaseTypesArray, isFetching: caseOverviewState.caseTypeUpdating && isCaseUpdating, hasError: allCaseTypes.isError })),
307
311
  React.createElement("div", { className: "form-wrapper" },
@@ -316,13 +320,14 @@ export default function CaseOverview(props) {
316
320
  }), isUpdating: (caseOverviewState.caseStatusUpdating && isCaseUpdating) || isPostingComment, onClose: () => {
317
321
  setShowCaseCloseModal(false);
318
322
  }, caseNumber: caseNumber })),
319
- showReOpenCaseModal && (React.createElement(ReopenCaseModal, { isInternal: loggedInUserRights.data.isInternal(), onConfirm: (commentBody, newStatus, reopenedAt, reopenedBySSOName, reopenedReason, reopenedReasonOther) => __awaiter(this, void 0, void 0, function* () {
320
- yield updateStatusState(newStatus, reopenedAt || null, reopenedBySSOName || null, reopenedReason || null, reopenedReasonOther || null, () => __awaiter(this, void 0, void 0, function* () {
323
+ showReOpenCaseModal && (React.createElement(ReopenCaseModal, { isInternal: loggedInUserRights.data.isInternal(), onConfirm: (commentBody, newPortalStatus, reopenedAt, reopenedBySSOName, reopenedReason, reopenedReasonOther) => __awaiter(this, void 0, void 0, function* () {
324
+ const newApiStatus = resolvePortalStatusToApiValue(newPortalStatus, status);
325
+ yield updateStatusState(newApiStatus, reopenedAt || null, reopenedBySSOName || null, reopenedReason || null, reopenedReasonOther || null, () => __awaiter(this, void 0, void 0, function* () {
321
326
  yield postCommentAfterStatusUpdate(commentBody);
322
327
  dtmTrackEventCaseStepEncountered('reopen', caseNumber, product, version);
323
328
  }));
324
329
  setShowReopenCaseModal(false);
325
330
  }), onClose: () => {
326
331
  setShowReopenCaseModal(false);
327
- }, caseNumber: caseNumber, reopenStatus: reopenStatusRef.current, allStatuses: allCaseStatuses.data, isUpdating: (caseOverviewState.caseStatusUpdating && isCaseUpdating) || isPostingComment, whoIsUpdating: updatingUser }))));
332
+ }, caseNumber: caseNumber, reopenStatus: reopenStatusRef.current, isUpdating: (caseOverviewState.caseStatusUpdating && isCaseUpdating) || isPostingComment, whoIsUpdating: updatingUser }))));
328
333
  }
@@ -1,13 +1,11 @@
1
1
  import React from 'react';
2
- import { CaseStatusEnum } from '../../../constants/caseDetailsConstants';
3
2
  interface IProps {
4
3
  onConfirm: (commentBody: any, newStatus: any, reopenedAt?: any, reopenedBySSOName?: any, reopenedReason?: any, reopenedReasonOther?: any) => void;
5
4
  onClose: () => void;
6
5
  caseNumber: string;
7
6
  isInternal: boolean;
8
- allStatuses: string[];
9
7
  isUpdating: boolean;
10
- reopenStatus: CaseStatusEnum;
8
+ reopenStatus: string;
11
9
  whoIsUpdating: string;
12
10
  }
13
11
  export declare function ReopenCaseModal(props: IProps): React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"ReopenCaseModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/ConfirmationModals/ReopenCaseModal.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAEzE,UAAU,MAAM;IACZ,SAAS,EAAE,CAAC,WAAW,KAAA,EAAE,SAAS,KAAA,EAAE,UAAU,CAAC,KAAA,EAAE,iBAAiB,CAAC,KAAA,EAAE,cAAc,CAAC,KAAA,EAAE,mBAAmB,CAAC,KAAA,KAAK,IAAI,CAAC;IACpH,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,cAAc,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;CACzB;AAMD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,qBAkN5C"}
1
+ {"version":3,"file":"ReopenCaseModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/ConfirmationModals/ReopenCaseModal.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,UAAU,MAAM;IACZ,SAAS,EAAE,CAAC,WAAW,KAAA,EAAE,SAAS,KAAA,EAAE,UAAU,CAAC,KAAA,EAAE,iBAAiB,CAAC,KAAA,EAAE,cAAc,CAAC,KAAA,EAAE,mBAAmB,CAAC,KAAA,KAAK,IAAI,CAAC;IACpH,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACzB;AAMD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,qBAkN5C"}
@@ -9,12 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { Button, ButtonVariant, Form, FormGroup, FormHelperText, HelperText, HelperTextItem, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant, TextArea, } from '@patternfly/react-core';
11
11
  import { SingleSelectDropdown } from '@rh-support/components';
12
- import { formatDateTime } from '@rh-support/utils';
12
+ import { formatDateTime, PORTAL_OPEN_DISPLAY_STATUSES } from '@rh-support/utils';
13
13
  import isEmpty from 'lodash/isEmpty';
14
14
  import map from 'lodash/map';
15
15
  import React, { useState } from 'react';
16
16
  import { Trans, useTranslation } from 'react-i18next';
17
- import { CaseStatusEnum } from '../../../constants/caseDetailsConstants';
18
17
  const reasonWithDescription = ['Other'];
19
18
  const reasonWithoutDescription = ['I am experiencing the same issue', 'My case has been closed prematurely'];
20
19
  const reasonsList = [...reasonWithoutDescription, ...reasonWithDescription];
@@ -54,7 +53,7 @@ export function ReopenCaseModal(props) {
54
53
  if (!checkForRequiredFields())
55
54
  return;
56
55
  let submissionDate = new Date();
57
- props.onConfirm(getCommentBody(), props.reopenStatus || selectedStatus || CaseStatusEnum.WAITING_ON_REDHAT, submissionDate, props.whoIsUpdating, selectedReason, reopenDescription);
56
+ props.onConfirm(getCommentBody(), props.reopenStatus || selectedStatus || 'In Progress', submissionDate, props.whoIsUpdating, selectedReason, reopenDescription);
58
57
  });
59
58
  const onReasonChange = (option) => {
60
59
  setSelectedReason(option.value);
@@ -70,7 +69,7 @@ export function ReopenCaseModal(props) {
70
69
  label: option,
71
70
  value: option,
72
71
  }));
73
- const getStatusDropdownOptions = map(props.allStatuses.filter((status) => status !== CaseStatusEnum.CLOSED), (option) => ({
72
+ const getStatusDropdownOptions = map(PORTAL_OPEN_DISPLAY_STATUSES, (option) => ({
74
73
  label: option,
75
74
  value: option,
76
75
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"ESSRemoteSessionModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/RequestRemoteSession/ESSRemoteSessionModal.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,KAAmB,MAAM,OAAO,CAAC;AAgBxC,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,kBAAkB,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAClD,QAAQ,EAAE,OAAO,CAAC;IAClB,sBAAsB,EAAE,OAAO,CAAC;CACnC;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,qBAsKlD"}
1
+ {"version":3,"file":"ESSRemoteSessionModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/RequestRemoteSession/ESSRemoteSessionModal.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,KAAmB,MAAM,OAAO,CAAC;AAWxC,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,kBAAkB,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAClD,QAAQ,EAAE,OAAO,CAAC;IAClB,sBAAsB,EAAE,OAAO,CAAC;CACnC;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,qBA0JlD"}
@@ -7,6 +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 { useApolloClient } from '@apollo/client/react';
10
11
  import { publicApi } from '@cee-eng/hydrajs';
11
12
  import { Button, ButtonVariant, Icon, Modal, ModalFooter, ModalHeader, ModalVariant, Title, TitleSizes, } from '@patternfly/react-core';
12
13
  import CheckCircleIcon from '@patternfly/react-icons/dist/js/icons/check-circle-icon';
@@ -14,20 +15,16 @@ import { ToastNotification, useFetch } from '@rh-support/components';
14
15
  import React, { useState } from 'react';
15
16
  import { Trans, useTranslation } from 'react-i18next';
16
17
  import { useCaseDispatch } from '../../../context/CaseContext';
17
- import { useCaseDetailsPageStateContext } from '../../../context/CaseDetailsPageContext';
18
- import { useCaseDiscussionTabDispatchContext, useCaseDiscussionTabStateContext, } from '../../../context/CaseDiscussionTabContext';
19
- import { updateDiscussionStateComments } from '../../../reducers/CaseDiscussionTabReducer';
18
+ import { GET_CASE_COMMENTS } from '../../../hooks/useCaseComments';
20
19
  import { checkForCaseStatusToggleOnAttachOrComment, setCaseDetails, updateCaseDetails, } from '../../../reducers/CaseReducer';
21
20
  export function ESSRemoteSessionModal(props) {
22
21
  const { t } = useTranslation();
23
22
  const caseDispatch = useCaseDispatch();
24
23
  const [agreeLoading, setAgreeLoading] = useState(false);
24
+ const client = useApolloClient();
25
25
  const { request: postCommentRequest, isFetching: isPostingComment } = useFetch(publicApi.kase.postComment, {
26
26
  propgateErrors: true,
27
27
  });
28
- const dispatchDiscussion = useCaseDiscussionTabDispatchContext();
29
- const { sort, allDiscussions, discussionFiltersListState } = useCaseDiscussionTabStateContext();
30
- const { caseDetailsPageState: { caseFeedbacksHydra }, } = useCaseDetailsPageStateContext();
31
28
  // To handle modal cancel and close
32
29
  const onCancel = () => {
33
30
  props.onClose && props.onClose();
@@ -46,7 +43,7 @@ export function ESSRemoteSessionModal(props) {
46
43
  commentBody: requestComment,
47
44
  contentType: 'markdown',
48
45
  });
49
- updateDiscussionStateComments(dispatchDiscussion, caseDispatch, props.caseNumber, allDiscussions, sort, caseFeedbacksHydra.data, discussionFiltersListState);
46
+ client.refetchQueries({ include: [GET_CASE_COMMENTS] });
50
47
  checkForCaseStatusToggleOnAttachOrComment(caseDispatch, props.loggedInUserRights.data.isInternal(), props.caseStatus);
51
48
  onCancel();
52
49
  setAgreeLoading(false);
@@ -1 +1 @@
1
- {"version":3,"file":"NewEssTermsModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/RequestRemoteSession/NewEssTermsModal.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,KAA8B,MAAM,OAAO,CAAC;AAYnD,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,kBAAkB,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAClD,QAAQ,EAAE,OAAO,CAAC;CACrB;AA4BD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,qBA4Y7C"}
1
+ {"version":3,"file":"NewEssTermsModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/RequestRemoteSession/NewEssTermsModal.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,KAA8B,MAAM,OAAO,CAAC;AAQnD,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,kBAAkB,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAClD,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,qBAgY7C"}
@@ -17,33 +17,9 @@ import isEqual from 'lodash/isEqual';
17
17
  import React, { useEffect, useState } from 'react';
18
18
  import { Trans, useTranslation } from 'react-i18next';
19
19
  import { useCaseDispatch, useCaseSelector } from '../../../context/CaseContext';
20
- import { useCaseDetailsPageStateContext } from '../../../context/CaseDetailsPageContext';
21
- import { useCaseDiscussionTabDispatchContext, useCaseDiscussionTabStateContext, } from '../../../context/CaseDiscussionTabContext';
22
- import { updateDiscussionStateComments } from '../../../reducers/CaseDiscussionTabReducer';
20
+ import { GET_CASE_COMMENTS } from '../../../hooks/useCaseComments';
23
21
  import { checkForCaseStatusToggleOnAttachOrComment, updateCaseDetailsGraphQL } from '../../../reducers/CaseReducer';
24
- const getLocaleNameFromLocalCode = (localeCode) => {
25
- if ('Intl' in window && 'DisplayNames' in Intl) {
26
- try {
27
- const [lang, locale] = localeCode.includes('_') ? localeCode.split('_') : localeCode.split('-');
28
- // https://github.com/microsoft/TypeScript/issues/41338
29
- const langName = new Intl.DisplayNames([lang], { type: 'language' });
30
- const regionNamesInLang = new Intl.DisplayNames([lang], { type: 'region' });
31
- return `${regionNamesInLang.of(locale)} (${langName.of(lang)})`;
32
- }
33
- catch (e) {
34
- return localeCode;
35
- }
36
- }
37
- return localeCode;
38
- };
39
- const formatSessionLinks = (sessionLink) => {
40
- const links = sessionLink
41
- .split(/[;,| \n\r\t]+/)
42
- .map((link) => link.trim())
43
- .filter(Boolean);
44
- const formattedLinks = links.map((link) => `[${link}](${link})`).join('\n');
45
- return formattedLinks;
46
- };
22
+ import { formatSessionLinks, getLocaleNameFromLocalCode } from './remoteSessionUtils';
47
23
  export function NewEssTermsModal(props) {
48
24
  const { t } = useTranslation();
49
25
  const { remoteSessionTermsAcked } = useCaseSelector((state) => ({
@@ -96,12 +72,10 @@ export function NewEssTermsModal(props) {
96
72
  fetchTerms();
97
73
  // eslint-disable-next-line react-hooks/exhaustive-deps
98
74
  }, []);
75
+ const client = useApolloClient();
99
76
  const { request: postCommentRequest, isFetching: isPostingComment } = useFetch(publicApi.kase.postComment, {
100
77
  propgateErrors: true,
101
78
  });
102
- const dispatchDiscussion = useCaseDiscussionTabDispatchContext();
103
- const { sort, allDiscussions, discussionFiltersListState } = useCaseDiscussionTabStateContext();
104
- const { caseDetailsPageState: { caseFeedbacksHydra }, } = useCaseDetailsPageStateContext();
105
79
  const updateSessionExpectation = (event, value) => setSessionExpectations(value);
106
80
  const updateImpact = (event, value) => setImpact(value);
107
81
  const updateSessionLink = (event, value) => setSessionLink(value);
@@ -142,7 +116,7 @@ export function NewEssTermsModal(props) {
142
116
  commentBody: requestComment,
143
117
  contentType: 'markdown',
144
118
  });
145
- updateDiscussionStateComments(dispatchDiscussion, caseDispatch, props.caseNumber, allDiscussions, sort, caseFeedbacksHydra.data, discussionFiltersListState);
119
+ client.refetchQueries({ include: [GET_CASE_COMMENTS] });
146
120
  checkForCaseStatusToggleOnAttachOrComment(caseDispatch, props.loggedInUserRights.data.isInternal(), props.caseStatus);
147
121
  setAgreeLoading(false);
148
122
  setHasSubmitted(true);
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteSessionAgreementModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,KAA8B,MAAM,OAAO,CAAC;AAgBnD,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,kBAAkB,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAClD,QAAQ,EAAE,OAAO,CAAC;CACrB;AA4BD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,qBAqYxD"}
1
+ {"version":3,"file":"RemoteSessionAgreementModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,KAA8B,MAAM,OAAO,CAAC;AAYnD,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,kBAAkB,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAClD,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,qBAyXxD"}
@@ -17,33 +17,9 @@ import isEqual from 'lodash/isEqual';
17
17
  import React, { useEffect, useState } from 'react';
18
18
  import { Trans, useTranslation } from 'react-i18next';
19
19
  import { useCaseDispatch, useCaseSelector } from '../../../context/CaseContext';
20
- import { useCaseDetailsPageStateContext } from '../../../context/CaseDetailsPageContext';
21
- import { useCaseDiscussionTabDispatchContext, useCaseDiscussionTabStateContext, } from '../../../context/CaseDiscussionTabContext';
22
- import { updateDiscussionStateComments } from '../../../reducers/CaseDiscussionTabReducer';
20
+ import { GET_CASE_COMMENTS } from '../../../hooks/useCaseComments';
23
21
  import { checkForCaseStatusToggleOnAttachOrComment, setRemoteRiderFlag, updateCaseDetailsGraphQL, } from '../../../reducers/CaseReducer';
24
- const getLocaleNameFromLocalCode = (localeCode) => {
25
- if ('Intl' in window && 'DisplayNames' in Intl) {
26
- try {
27
- const [lang, locale] = localeCode.includes('_') ? localeCode.split('_') : localeCode.split('-');
28
- // https://github.com/microsoft/TypeScript/issues/41338
29
- const langName = new Intl.DisplayNames([lang], { type: 'language' });
30
- const regionNamesInLang = new Intl.DisplayNames([lang], { type: 'region' });
31
- return `${regionNamesInLang.of(locale)} (${langName.of(lang)})`;
32
- }
33
- catch (e) {
34
- return localeCode;
35
- }
36
- }
37
- return localeCode;
38
- };
39
- const formatSessionLinks = (sessionLink) => {
40
- const links = sessionLink
41
- .split(/[;,| \n\r\t]+/)
42
- .map((link) => link.trim())
43
- .filter(Boolean);
44
- const formattedLinks = links.map((link) => `[${link}](${link})`).join('\n');
45
- return formattedLinks;
46
- };
22
+ import { formatSessionLinks, getLocaleNameFromLocalCode } from './remoteSessionUtils';
47
23
  export function RemoteSessionAgreementModal(props) {
48
24
  const { t } = useTranslation();
49
25
  const { remoteSessionTermsAcked } = useCaseSelector((state) => ({
@@ -96,12 +72,10 @@ export function RemoteSessionAgreementModal(props) {
96
72
  fetchTerms();
97
73
  // eslint-disable-next-line react-hooks/exhaustive-deps
98
74
  }, []);
75
+ const client = useApolloClient();
99
76
  const { request: postCommentRequest, isFetching: isPostingComment } = useFetch(publicApi.kase.postComment, {
100
77
  propgateErrors: true,
101
78
  });
102
- const dispatchDiscussion = useCaseDiscussionTabDispatchContext();
103
- const { sort, allDiscussions, discussionFiltersListState } = useCaseDiscussionTabStateContext();
104
- const { caseDetailsPageState: { caseFeedbacksHydra }, } = useCaseDetailsPageStateContext();
105
79
  const updateSessionExpectation = (event, value) => setSessionExpectations(value);
106
80
  const updateImpact = (event, value) => setImpact(value);
107
81
  const updateSessionLink = (event, value) => setSessionLink(value);
@@ -134,7 +108,7 @@ export function RemoteSessionAgreementModal(props) {
134
108
  commentBody: requestComment,
135
109
  contentType: 'markdown',
136
110
  });
137
- updateDiscussionStateComments(dispatchDiscussion, caseDispatch, props.caseNumber, allDiscussions, sort, caseFeedbacksHydra.data, discussionFiltersListState);
111
+ client.refetchQueries({ include: [GET_CASE_COMMENTS] });
138
112
  checkForCaseStatusToggleOnAttachOrComment(caseDispatch, props.loggedInUserRights.data.isInternal(), props.caseStatus);
139
113
  setAgreeLoading(false);
140
114
  setHasSubmitted(true);
@@ -0,0 +1,3 @@
1
+ export declare const getLocaleNameFromLocalCode: (localeCode: string) => string;
2
+ export declare const formatSessionLinks: (sessionLink: string) => string;
3
+ //# sourceMappingURL=remoteSessionUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remoteSessionUtils.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,GAAI,YAAY,MAAM,KAAG,MAa/D,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,aAAa,MAAM,KAAG,MAOxD,CAAC"}