@rh-support/troubleshoot 2.6.301 → 2.6.302

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 (221) hide show
  1. package/lib/esm/components/AccountInfo/AccountSelector.d.ts.map +1 -1
  2. package/lib/esm/components/AccountInfo/AccountSelector.js +28 -40
  3. package/lib/esm/components/AccountInfo/OwnerSelector.d.ts.map +1 -1
  4. package/lib/esm/components/AccountInfo/OwnerSelector.js +52 -14
  5. package/lib/esm/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.d.ts.map +1 -1
  6. package/lib/esm/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.js +51 -31
  7. package/lib/esm/components/CaseEditView/Case.d.ts.map +1 -1
  8. package/lib/esm/components/CaseEditView/Case.js +50 -18
  9. package/lib/esm/components/CaseEditView/CaseDetailsAside.d.ts.map +1 -1
  10. package/lib/esm/components/CaseEditView/CaseDetailsAside.js +25 -8
  11. package/lib/esm/components/CaseEditView/CaseDetailsTabs.d.ts.map +1 -1
  12. package/lib/esm/components/CaseEditView/CaseDetailsTabs.js +57 -34
  13. package/lib/esm/components/CaseEditView/CaseOverview/CaseOwnerInfo.d.ts +2 -0
  14. package/lib/esm/components/CaseEditView/CaseOverview/CaseOwnerInfo.d.ts.map +1 -1
  15. package/lib/esm/components/CaseEditView/CaseOverview/CaseOwnerInfo.js +3 -3
  16. package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.d.ts +1 -2
  17. package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.d.ts.map +1 -1
  18. package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.js +8 -6
  19. package/lib/esm/components/CaseEditView/CaseOverview/index.d.ts.map +1 -1
  20. package/lib/esm/components/CaseEditView/CaseOverview/index.js +43 -30
  21. package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutions.d.ts.map +1 -1
  22. package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutions.js +76 -30
  23. package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutionsItem.d.ts +0 -1
  24. package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutionsItem.d.ts.map +1 -1
  25. package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutionsItem.js +3 -3
  26. package/lib/esm/components/CaseEditView/ConfirmationModals/ReopenCaseModal.d.ts +1 -3
  27. package/lib/esm/components/CaseEditView/ConfirmationModals/ReopenCaseModal.d.ts.map +1 -1
  28. package/lib/esm/components/CaseEditView/ConfirmationModals/ReopenCaseModal.js +3 -4
  29. package/lib/esm/components/CaseEditView/RequestRemoteSession/ESSRemoteSessionModal.d.ts.map +1 -1
  30. package/lib/esm/components/CaseEditView/RequestRemoteSession/ESSRemoteSessionModal.js +13 -17
  31. package/lib/esm/components/CaseEditView/RequestRemoteSession/NewEssTermsModal.d.ts.map +1 -1
  32. package/lib/esm/components/CaseEditView/RequestRemoteSession/NewEssTermsModal.js +19 -43
  33. package/lib/esm/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.d.ts.map +1 -1
  34. package/lib/esm/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.js +17 -40
  35. package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.d.ts +3 -0
  36. package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.d.ts.map +1 -0
  37. package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.js +22 -0
  38. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.d.ts.map +1 -1
  39. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.js +44 -41
  40. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseDetailsManagement.d.ts.map +1 -1
  41. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseDetailsManagement.js +8 -7
  42. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseInformation.d.ts.map +1 -1
  43. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseInformation.js +0 -2
  44. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.d.ts.map +1 -1
  45. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.js +38 -18
  46. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/ProductVersion.d.ts.map +1 -1
  47. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/ProductVersion.js +19 -59
  48. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/Summary.d.ts.map +1 -1
  49. package/lib/esm/components/CaseEditView/Tabs/CaseDetails/Summary.js +16 -9
  50. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts +4 -2
  51. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts.map +1 -1
  52. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.js +110 -148
  53. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CommentSearch.d.ts.map +1 -1
  54. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CommentSearch.js +5 -5
  55. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/DiscussionItemLink.d.ts.map +1 -1
  56. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/DiscussionItemLink.js +2 -1
  57. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useAttachmentUploadCompletion.d.ts +15 -0
  58. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useAttachmentUploadCompletion.d.ts.map +1 -0
  59. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useAttachmentUploadCompletion.js +19 -0
  60. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts +17 -0
  61. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts.map +1 -0
  62. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.js +49 -0
  63. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts +6 -2
  64. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts.map +1 -1
  65. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.js +147 -241
  66. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/VerifyCaseStatusModal/VerifyCaseStatusModal.d.ts.map +1 -1
  67. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/VerifyCaseStatusModal/VerifyCaseStatusModal.js +5 -3
  68. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/CaseHistory.d.ts.map +1 -1
  69. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/CaseHistory.js +3 -1
  70. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.css +4 -4
  71. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.d.ts +35 -3
  72. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.d.ts.map +1 -1
  73. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.js +63 -224
  74. package/lib/esm/components/CaseEditView/Tabs/CasePrivateNotes/CasePrivateNotes.d.ts +4 -5
  75. package/lib/esm/components/CaseEditView/Tabs/CasePrivateNotes/CasePrivateNotes.d.ts.map +1 -1
  76. package/lib/esm/components/CaseEditView/Tabs/CasePrivateNotes/CasePrivateNotes.js +18 -5
  77. package/lib/esm/components/CaseEditView/Tabs/CaseSummary/CaseSummary.d.ts.map +1 -1
  78. package/lib/esm/components/CaseEditView/Tabs/CaseSummary/CaseSummary.js +7 -2
  79. package/lib/esm/components/CaseEditView/Tabs/RMEEscalations/RMEEscalationList.d.ts.map +1 -1
  80. package/lib/esm/components/CaseEditView/Tabs/RMEEscalations/RMEEscalationList.js +30 -52
  81. package/lib/esm/components/CaseInformation/CaseGroup.d.ts.map +1 -1
  82. package/lib/esm/components/CaseInformation/CaseGroup.js +68 -46
  83. package/lib/esm/components/CaseInformation/CaseInformation.d.ts.map +1 -1
  84. package/lib/esm/components/CaseInformation/CaseInformation.js +7 -5
  85. package/lib/esm/components/CaseInformation/ContactPhoneNumber.d.ts.map +1 -1
  86. package/lib/esm/components/CaseInformation/ContactPhoneNumber.js +37 -24
  87. package/lib/esm/components/CaseInformation/SupportLevel.d.ts.map +1 -1
  88. package/lib/esm/components/CaseInformation/SupportLevel.js +32 -55
  89. package/lib/esm/components/CaseManagement/CaseLanguageSelector.js +2 -2
  90. package/lib/esm/components/CaseManagement/CaseManagement.d.ts.map +1 -1
  91. package/lib/esm/components/CaseManagement/CaseManagement.js +4 -7
  92. package/lib/esm/components/CaseManagement/Cep.d.ts.map +1 -1
  93. package/lib/esm/components/CaseManagement/Cep.js +4 -7
  94. package/lib/esm/components/CaseManagement/OpenShiftClusterId.d.ts.map +1 -1
  95. package/lib/esm/components/CaseManagement/OpenShiftClusterId.js +19 -9
  96. package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.d.ts.map +1 -1
  97. package/lib/esm/components/CaseManagement/OpenshiftDropdownV4.js +16 -11
  98. package/lib/esm/components/CaseManagement/SendNotifications/NonOrgCaseNotifyeesSelector.d.ts.map +1 -1
  99. package/lib/esm/components/CaseManagement/SendNotifications/NonOrgCaseNotifyeesSelector.js +34 -40
  100. package/lib/esm/components/IdeaInformation/IdeaInformation.d.ts.map +1 -1
  101. package/lib/esm/components/IdeaInformation/IdeaInformation.js +13 -14
  102. package/lib/esm/components/OpenCase/SupportTypeSelectorPage.d.ts.map +1 -1
  103. package/lib/esm/components/OpenCase/SupportTypeSelectorPage.js +4 -2
  104. package/lib/esm/components/ProductSelector/AllProductsSelector.d.ts +0 -1
  105. package/lib/esm/components/ProductSelector/AllProductsSelector.d.ts.map +1 -1
  106. package/lib/esm/components/ProductSelector/AllProductsSelector.js +3 -15
  107. package/lib/esm/components/ProductSelector/NewProductDropdownSelector.d.ts.map +1 -1
  108. package/lib/esm/components/ProductSelector/NewProductDropdownSelector.js +13 -37
  109. package/lib/esm/components/ProductSelector/NewProductVersionSelector.d.ts.map +1 -1
  110. package/lib/esm/components/ProductSelector/NewProductVersionSelector.js +30 -50
  111. package/lib/esm/components/ProductSelector/ProductSelector.d.ts.map +1 -1
  112. package/lib/esm/components/ProductSelector/ProductSelector.js +1 -3
  113. package/lib/esm/components/Recommendations/ClusterRecommendationToast.d.ts.map +1 -1
  114. package/lib/esm/components/Recommendations/ClusterRecommendationToast.js +1 -4
  115. package/lib/esm/components/Recommendations/ClusterRecommendations.d.ts.map +1 -1
  116. package/lib/esm/components/Recommendations/ClusterRecommendations.js +1 -4
  117. package/lib/esm/components/RemoteRider/RemoteRiderAcceptanceModal.d.ts.map +1 -1
  118. package/lib/esm/components/RemoteRider/RemoteRiderAcceptanceModal.js +9 -7
  119. package/lib/esm/components/Review/Review.d.ts.map +1 -1
  120. package/lib/esm/components/Review/Review.js +16 -16
  121. package/lib/esm/components/SessionRestore/SessionRestore.d.ts.map +1 -1
  122. package/lib/esm/components/SessionRestore/SessionRestore.js +3 -1
  123. package/lib/esm/components/UpdateSeverityModal/UpdateSeverityModal.d.ts.map +1 -1
  124. package/lib/esm/components/UpdateSeverityModal/UpdateSeverityModal.js +5 -8
  125. package/lib/esm/components/shared/fileUpload/FileUploader.d.ts.map +1 -1
  126. package/lib/esm/components/shared/fileUpload/FileUploader.js +3 -1
  127. package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.d.ts +3 -1
  128. package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.d.ts.map +1 -1
  129. package/lib/esm/components/shared/fileUpload/reducer/AttachmentHelper.js +76 -4
  130. package/lib/esm/components/shared/useIsSectionValid.d.ts.map +1 -1
  131. package/lib/esm/components/shared/useIsSectionValid.js +50 -64
  132. package/lib/esm/components/shared/usePostComment.d.ts.map +1 -1
  133. package/lib/esm/components/shared/usePostComment.js +16 -28
  134. package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.d.ts.map +1 -1
  135. package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.js +120 -24
  136. package/lib/esm/components/wizardLayout/WizardLayout.d.ts.map +1 -1
  137. package/lib/esm/components/wizardLayout/WizardLayout.js +6 -7
  138. package/lib/esm/components/wizardLayout/WizardNavigation.d.ts.map +1 -1
  139. package/lib/esm/components/wizardLayout/WizardNavigation.js +10 -9
  140. package/lib/esm/context/CaseContext.d.ts.map +1 -1
  141. package/lib/esm/graphql/index.d.ts +4 -0
  142. package/lib/esm/graphql/index.d.ts.map +1 -0
  143. package/lib/esm/graphql/index.js +3 -0
  144. package/lib/esm/graphql/mutations/createRMECaseEscalation.d.ts +2 -0
  145. package/lib/esm/graphql/mutations/createRMECaseEscalation.d.ts.map +1 -0
  146. package/lib/esm/graphql/mutations/createRMECaseEscalation.js +24 -0
  147. package/lib/esm/graphql/mutations/index.d.ts +2 -0
  148. package/lib/esm/graphql/mutations/index.d.ts.map +1 -0
  149. package/lib/esm/graphql/mutations/index.js +1 -0
  150. package/lib/esm/graphql/queries/getEscalationDetails.d.ts +2 -0
  151. package/lib/esm/graphql/queries/getEscalationDetails.d.ts.map +1 -0
  152. package/lib/esm/graphql/queries/getEscalationDetails.js +24 -0
  153. package/lib/esm/graphql/queries/getParentId.d.ts +2 -0
  154. package/lib/esm/graphql/queries/getParentId.d.ts.map +1 -0
  155. package/lib/esm/graphql/queries/getParentId.js +16 -0
  156. package/lib/esm/graphql/queries/index.d.ts +3 -0
  157. package/lib/esm/graphql/queries/index.d.ts.map +1 -0
  158. package/lib/esm/graphql/queries/index.js +2 -0
  159. package/lib/esm/graphql/schemas/escalation.d.ts +84 -0
  160. package/lib/esm/graphql/schemas/escalation.d.ts.map +1 -0
  161. package/lib/esm/graphql/schemas/escalation.js +1 -0
  162. package/lib/esm/graphql/schemas/index.d.ts +2 -0
  163. package/lib/esm/graphql/schemas/index.d.ts.map +1 -0
  164. package/lib/esm/graphql/schemas/index.js +1 -0
  165. package/lib/esm/hooks/useCaseComments/caseCommentMutation.d.ts +4 -0
  166. package/lib/esm/hooks/useCaseComments/caseCommentMutation.d.ts.map +1 -0
  167. package/lib/esm/hooks/useCaseComments/caseCommentMutation.js +12 -0
  168. package/lib/esm/hooks/useCaseComments/caseCommentsQuery.d.ts +4 -0
  169. package/lib/esm/hooks/useCaseComments/caseCommentsQuery.d.ts.map +1 -0
  170. package/lib/esm/hooks/useCaseComments/caseCommentsQuery.js +55 -0
  171. package/lib/esm/hooks/useCaseComments/index.d.ts +7 -0
  172. package/lib/esm/hooks/useCaseComments/index.d.ts.map +1 -0
  173. package/lib/esm/hooks/useCaseComments/index.js +5 -0
  174. package/lib/esm/hooks/useCaseComments/mapCaseComment.d.ts +25 -0
  175. package/lib/esm/hooks/useCaseComments/mapCaseComment.d.ts.map +1 -0
  176. package/lib/esm/hooks/useCaseComments/mapCaseComment.js +66 -0
  177. package/lib/esm/hooks/useCaseComments/types.d.ts +80 -0
  178. package/lib/esm/hooks/useCaseComments/types.d.ts.map +1 -0
  179. package/lib/esm/hooks/useCaseComments/types.js +1 -0
  180. package/lib/esm/hooks/useCaseComments/useCaseComments.d.ts +16 -0
  181. package/lib/esm/hooks/useCaseComments/useCaseComments.d.ts.map +1 -0
  182. package/lib/esm/hooks/useCaseComments/useCaseComments.js +25 -0
  183. package/lib/esm/hooks/useCaseComments/useCreateCaseComment.d.ts +19 -0
  184. package/lib/esm/hooks/useCaseComments/useCreateCaseComment.d.ts.map +1 -0
  185. package/lib/esm/hooks/useCaseComments/useCreateCaseComment.js +33 -0
  186. package/lib/esm/hooks/useCaseHistory.d.ts +26 -0
  187. package/lib/esm/hooks/useCaseHistory.d.ts.map +1 -0
  188. package/lib/esm/hooks/useCaseHistory.js +98 -0
  189. package/lib/esm/hooks/useResetCaseCreate.d.ts.map +1 -1
  190. package/lib/esm/hooks/useResetCaseCreate.js +18 -11
  191. package/lib/esm/models/caseHistory.d.ts +80 -0
  192. package/lib/esm/models/caseHistory.d.ts.map +1 -0
  193. package/lib/esm/models/caseHistory.js +1 -0
  194. package/lib/esm/reducers/CaseConstNTypes.d.ts +91 -3
  195. package/lib/esm/reducers/CaseConstNTypes.d.ts.map +1 -1
  196. package/lib/esm/reducers/CaseConstNTypes.js +20 -2
  197. package/lib/esm/reducers/CaseDetailsPageReducer.d.ts +5 -4
  198. package/lib/esm/reducers/CaseDetailsPageReducer.d.ts.map +1 -1
  199. package/lib/esm/reducers/CaseDetailsPageReducer.js +39 -23
  200. package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts +3 -5
  201. package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts.map +1 -1
  202. package/lib/esm/reducers/CaseDiscussionTabReducer.js +33 -46
  203. package/lib/esm/reducers/CaseHelpers.d.ts +3 -2
  204. package/lib/esm/reducers/CaseHelpers.d.ts.map +1 -1
  205. package/lib/esm/reducers/CaseHelpers.js +108 -41
  206. package/lib/esm/reducers/CaseOverviewReducer.d.ts +3 -1
  207. package/lib/esm/reducers/CaseOverviewReducer.d.ts.map +1 -1
  208. package/lib/esm/reducers/CaseOverviewReducer.js +7 -5
  209. package/lib/esm/reducers/CaseReducer.d.ts +30 -8
  210. package/lib/esm/reducers/CaseReducer.d.ts.map +1 -1
  211. package/lib/esm/reducers/CaseReducer.js +192 -55
  212. package/lib/esm/utils/TimelineUtils.d.ts +41 -0
  213. package/lib/esm/utils/TimelineUtils.d.ts.map +1 -0
  214. package/lib/esm/utils/TimelineUtils.js +134 -0
  215. package/lib/esm/utils/caseHistoryUtils.d.ts +66 -0
  216. package/lib/esm/utils/caseHistoryUtils.d.ts.map +1 -0
  217. package/lib/esm/utils/caseHistoryUtils.js +165 -0
  218. package/lib/esm/utils/caseOpenshiftClusterIdUtils.d.ts +1 -2
  219. package/lib/esm/utils/caseOpenshiftClusterIdUtils.d.ts.map +1 -1
  220. package/lib/esm/utils/caseOpenshiftClusterIdUtils.js +4 -4
  221. package/package.json +7 -8
@@ -7,9 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { escalations, publicApi } from '@cee-eng/hydrajs';
10
+ import { useApolloClient } from '@apollo/client/react';
11
11
  import { Button, ButtonVariant, Flex, FlexItem } from '@patternfly/react-core';
12
- import { LoadingIndicator, PFTable, TableComponent, ToastNotification, useFetch, } from '@rh-support/components';
12
+ import { LoadingIndicator, PFTable, TableComponent, ToastNotification } from '@rh-support/components';
13
13
  import { ability, resourceActions, resources } from '@rh-support/user-permissions';
14
14
  import { formatDate, sendToSentry } from '@rh-support/utils';
15
15
  import find from 'lodash/find';
@@ -18,11 +18,10 @@ import isEqual from 'lodash/isEqual';
18
18
  import React, { useEffect, useRef, useState } from 'react';
19
19
  import { Trans, useTranslation } from 'react-i18next';
20
20
  import { useCaseDispatch, useCaseSelector } from '../../../../context/CaseContext';
21
- import { useCaseDetailsPageDispatchContext, useCaseDetailsPageStateContext, } from '../../../../context/CaseDetailsPageContext';
22
- import { useCaseDiscussionTabDispatchContext, useCaseDiscussionTabStateContext, } from '../../../../context/CaseDiscussionTabContext';
21
+ import { useCaseDetailsPageDispatchContext } from '../../../../context/CaseDetailsPageContext';
22
+ import { GET_CASE_COMMENTS, useCreateCaseComment } from '../../../../hooks/useCaseComments';
23
23
  import { escalationStatus } from '../../../../models/escalation';
24
24
  import { fetchCaseEscalations } from '../../../../reducers/CaseDetailsPageReducer';
25
- import { updateDiscussionStateComments } from '../../../../reducers/CaseDiscussionTabReducer';
26
25
  import { checkForCaseStatusToggleOnAttachOrComment } from '../../../../reducers/CaseReducer';
27
26
  const ESCALATION_MSG = 'Request Management Escalation:';
28
27
  const UPDATE_ESCALATION_MSG = 'Escalation update requested. You will receive an update from a manager shortly.';
@@ -30,20 +29,18 @@ const REOPEN_ESCALATION_MSG = 'Escalation reopened. A manager will review your r
30
29
  const CLOSURE_ESCALATION_MSG = 'Escalation closed.';
31
30
  export default function RMEEscalationList(props) {
32
31
  const { t } = useTranslation();
33
- const { request: updateEscalationRequest, isFetching: isUpdatingEscalation } = useFetch(escalations.updateEscalations, { propgateErrors: true });
34
- const { request: postCommentRequest, isFetching: isPostingComment } = useFetch(publicApi.kase.postComment, {
35
- propgateErrors: true,
36
- });
37
- const { request: updateCaseRequest, isFetching: isUpdatingCase } = useFetch(publicApi.kase.updateCase, {
38
- propgateErrors: true,
39
- });
40
- const { sort, allDiscussions, discussionFiltersListState } = useCaseDiscussionTabStateContext();
41
- const dispatchDiscussion = useCaseDiscussionTabDispatchContext();
42
- const { caseDetailsPageState: { caseFeedbacksHydra }, } = useCaseDetailsPageStateContext();
32
+ const apolloClient = useApolloClient();
33
+ // TODO: migrate escalation update from Hydra to GraphQL
34
+ // const { request: updateEscalationRequest, isFetching: isUpdatingEscalation } = useFetch(
35
+ // escalations.updateEscalations,
36
+ // { propgateErrors: true }
37
+ // );
38
+ const { createComment, loading: isPostingComment } = useCreateCaseComment();
39
+ const caseSalesforceId = useCaseSelector((state) => state.caseDetails.id, isEqual);
43
40
  const caseDetailsPageDispatch = useCaseDetailsPageDispatchContext();
44
41
  const escalationUpdateInProgessIds = useRef([]);
45
42
  const caseDispatch = useCaseDispatch();
46
- const isUpdating = isUpdatingEscalation || isPostingComment || isUpdatingCase;
43
+ const isUpdating = isPostingComment;
47
44
  const [escalationList, setEscalationList] = useState([]);
48
45
  const cannUpdateRME = ability.can(resourceActions.UPDATE, resources.RME_ESCALATION);
49
46
  const { customerEscalation } = useCaseSelector((state) => ({
@@ -54,62 +51,43 @@ export default function RMEEscalationList(props) {
54
51
  // called everytime we are updating the escalation
55
52
  setEscalationList([...props.escalations]);
56
53
  }, [isUpdating, props.escalations]);
57
- const updateEscalation = (escalationName, text, options) => __awaiter(this, void 0, void 0, function* () {
58
- const updateRequest = Object.assign({ escalationName, isPrivate: false, text, isRequestForUpdate: false, isRequestForReOpen: false, isRequestForClosure: false, status: escalationStatus.requestUpdate }, options);
54
+ // TODO: migrate updateEscalation from Hydra (escalations.updateEscalations) to GraphQL
55
+ // const updateEscalation = async (escalationName: string, text: string, options: Partial<IEscalationUpdate>) => {
56
+ // ...
57
+ // };
58
+ const submitEscalationComment = (escalationName, comment, message) => __awaiter(this, void 0, void 0, function* () {
59
59
  escalationUpdateInProgessIds.current.push(escalationName);
60
- return yield updateEscalationRequest(escalationName, updateRequest);
61
- });
62
- const submitEscalationComment = (escalationNum, comment, message) => __awaiter(this, void 0, void 0, function* () {
63
60
  try {
64
- escalationNum &&
65
- fetchCaseEscalations(caseDetailsPageDispatch, props.caseNumber, props.accountNumber, false);
66
- yield postCommentRequest({
67
- caseNumber: props.caseNumber,
68
- commentBody: comment,
69
- contentType: 'plaintext',
61
+ fetchCaseEscalations(caseDetailsPageDispatch, caseSalesforceId, apolloClient, false);
62
+ yield createComment({
63
+ caseId: caseSalesforceId,
64
+ body: comment,
65
+ isPublic: true,
70
66
  });
71
- updateDiscussionStateComments(dispatchDiscussion, caseDispatch, props.caseNumber, allDiscussions, sort, caseFeedbacksHydra.data, discussionFiltersListState);
72
- yield updateCaseRequest(props.caseNumber, { customerEscalation: true });
67
+ apolloClient.refetchQueries({ include: [GET_CASE_COMMENTS] });
68
+ // TODO: migrate updateCaseRequest(props.caseNumber, { customerEscalation: true }) to GraphQL
73
69
  checkForCaseStatusToggleOnAttachOrComment(caseDispatch, props.isInternal, props.caseStatus);
74
- escalationNum && ToastNotification.addSuccessMessage(message);
70
+ ToastNotification.addSuccessMessage(message);
75
71
  }
76
72
  catch (e) {
77
73
  ToastNotification.addDangerMessage(e);
78
74
  sendToSentry(e, {}, 'RME form submit error');
79
75
  }
80
76
  finally {
81
- escalationUpdateInProgessIds.current = escalationUpdateInProgessIds.current.filter((item) => item !== escalationNum);
77
+ escalationUpdateInProgessIds.current = escalationUpdateInProgessIds.current.filter((item) => item !== escalationName);
82
78
  }
83
79
  });
84
80
  const requestUpdateRMEEscalation = (escalationName) => __awaiter(this, void 0, void 0, function* () {
85
81
  const comment = `${ESCALATION_MSG}\n ${UPDATE_ESCALATION_MSG}`;
86
- try {
87
- const updatedInfo = yield updateEscalation(escalationName, comment, { isRequestForUpdate: true });
88
- updatedInfo && submitEscalationComment(updatedInfo.escalationName, comment, UPDATE_ESCALATION_MSG);
89
- }
90
- catch (e) {
91
- ToastNotification.addDangerMessage(e);
92
- }
82
+ yield submitEscalationComment(escalationName, comment, UPDATE_ESCALATION_MSG);
93
83
  });
94
84
  const requestClosureRMEEscalation = (escalationName) => __awaiter(this, void 0, void 0, function* () {
95
85
  const comment = `${ESCALATION_MSG}\n ${CLOSURE_ESCALATION_MSG}`;
96
- try {
97
- const updatedInfo = yield updateEscalation(escalationName, comment, { isRequestForClosure: true });
98
- updatedInfo && submitEscalationComment(updatedInfo.escalationName, comment, CLOSURE_ESCALATION_MSG);
99
- }
100
- catch (e) {
101
- ToastNotification.addDangerMessage(e);
102
- }
86
+ yield submitEscalationComment(escalationName, comment, CLOSURE_ESCALATION_MSG);
103
87
  });
104
88
  const requestReOpenRMEEscalation = (escalationName) => __awaiter(this, void 0, void 0, function* () {
105
89
  const comment = `${ESCALATION_MSG}\n ${REOPEN_ESCALATION_MSG}`;
106
- try {
107
- const updatedInfo = yield updateEscalation(escalationName, comment, { isRequestForReOpen: true });
108
- updatedInfo && submitEscalationComment(updatedInfo.escalationName, comment, REOPEN_ESCALATION_MSG);
109
- }
110
- catch (e) {
111
- ToastNotification.addDangerMessage(e);
112
- }
90
+ yield submitEscalationComment(escalationName, comment, REOPEN_ESCALATION_MSG);
113
91
  });
114
92
  const renderActionButtons = (escalation) => {
115
93
  if (isUpdating && escalationUpdateInProgessIds.current.includes(escalation.name)) {
@@ -1 +1 @@
1
- {"version":3,"file":"CaseGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseGroup.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAiB5E,UAAU,MAAM;IACZ,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAWD,iBAAS,SAAS,CAAC,KAAK,EAAE,MAAM,qBAqW/B;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"CaseGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseGroup.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAgB5E,UAAU,MAAM;IACZ,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAWD,iBAAS,SAAS,CAAC,KAAK,EAAE,MAAM,qBAsY/B;AAED,eAAe,SAAS,CAAC"}
@@ -7,11 +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 { useApolloClient } from '@apollo/client/react';
10
11
  import { Button, MenuToggle, Select, SelectList, SelectOption, Spinner, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, } from '@patternfly/react-core';
11
12
  import TimesIcon from '@patternfly/react-icons/dist/js/icons/times-icon';
12
13
  import { ToastNotification, useSelectKeyboardNavigator, ValueChangedIcon } from '@rh-support/components';
13
14
  import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
14
- import { toOption } from '@rh-support/utils';
15
15
  import find from 'lodash/find';
16
16
  import isEmpty from 'lodash/isEmpty';
17
17
  import isEqual from 'lodash/isEqual';
@@ -20,7 +20,7 @@ import { Trans, useTranslation } from 'react-i18next';
20
20
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
21
21
  import { RouteContext } from '../../context/RouteContext';
22
22
  import { useCaseUpdateErrorMessage } from '../../hooks/useCaseUpdateErrorMessage';
23
- import { fetchCaseGroupsForAccount, fetchCaseGroupsForSSO, setCaseDetails, setSelectedCaseGroupUsers, updateCaseDetails, } from '../../reducers/CaseReducer';
23
+ import { fetchCaseGroupsForContactGraphQL, setCaseDetails, setSelectedCaseGroupUsers, updateCaseDetailsGraphQL, } from '../../reducers/CaseReducer';
24
24
  import { PDFContext } from '../CaseEditView/PDFContainer';
25
25
  import { CaseValuesToWatch } from '../shared/Constants';
26
26
  import { getChangedValueTooltip } from '../shared/utils';
@@ -35,20 +35,35 @@ const emptyCaseGroup = {
35
35
  function CaseGroup(props) {
36
36
  const { t } = useTranslation();
37
37
  const caseUpdateError = useCaseUpdateErrorMessage();
38
- const { groupNumber, caseNumber, accountNumber, selectedAccountDetails, ownersCaseGroups, groupName, isCaseOwnerUpdating, contactSSOName, } = useCaseSelector((state) => ({
39
- caseNumber: state.caseDetails.caseNumber,
40
- groupNumber: state.caseDetails.groupNumber,
41
- accountNumber: state.caseDetails.accountNumberRef,
42
- ownersCaseGroups: state.ownersCaseGroups,
43
- selectedAccountDetails: state.selectedAccountDetails,
44
- groupName: state.caseDetails.groupName,
45
- isCaseOwnerUpdating: state.isCaseOwnerUpdating,
46
- contactSSOName: state.caseDetails.contactSSOName,
47
- }), isEqual);
38
+ const { groupNumber, caseNumber, caseId, accountNumber, selectedAccountDetails, ownersCaseGroups, groupName, isCaseOwnerUpdating, contactSSOName, selectedOwnerContactId, selectedOwnerIsOrgAdmin, } = useCaseSelector((state) => {
39
+ var _a, _b, _c, _d, _e;
40
+ return ({
41
+ caseNumber: state.caseDetails.caseNumber,
42
+ caseId: state.caseDetails.id,
43
+ groupNumber: state.caseDetails.groupNumber,
44
+ accountNumber: state.caseDetails.accountNumberRef,
45
+ ownersCaseGroups: state.ownersCaseGroups,
46
+ selectedAccountDetails: state.selectedAccountDetails,
47
+ groupName: state.caseDetails.groupName,
48
+ isCaseOwnerUpdating: state.isCaseOwnerUpdating,
49
+ contactSSOName: state.caseDetails.contactSSOName,
50
+ selectedOwnerContactId: (_b = (_a = state.selectedOwner) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.id,
51
+ selectedOwnerIsOrgAdmin: (_e = (_d = (_c = state.selectedOwner) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.isOrgAdmin) !== null && _e !== void 0 ? _e : false,
52
+ });
53
+ }, isEqual);
48
54
  const caseDispatch = useCaseDispatch();
55
+ const apolloClient = useApolloClient();
49
56
  const { isExportingPDF } = useContext(PDFContext);
50
57
  const { routeState: { isNextBtnClickedToShowValidationError }, } = useContext(RouteContext);
51
58
  const isGroupMandatory = selectedAccountDetails.data.requireCGroupOnCreate;
59
+ useEffect(() => {
60
+ if (!caseNumber)
61
+ return;
62
+ if (isEmpty(selectedOwnerContactId) || isEmpty(accountNumber))
63
+ return;
64
+ fetchCaseGroupsForContactGraphQL(caseDispatch, apolloClient, selectedOwnerContactId, accountNumber, groupNumber, selectedOwnerIsOrgAdmin);
65
+ // eslint-disable-next-line react-hooks/exhaustive-deps
66
+ }, [selectedOwnerContactId, accountNumber, selectedOwnerIsOrgAdmin]);
52
67
  const [selectedCaseGroup, setSelectedCaseGroup] = useState(isGroupMandatory ? undefined : emptyCaseGroup);
53
68
  const [isCaseGroupInvalid, setCaseGroupInvalid] = useState(false);
54
69
  const [isSelectedUngroupedInvalid, setIsSelectedUngroupedInvalid] = useState(false);
@@ -74,9 +89,8 @@ function CaseGroup(props) {
74
89
  return;
75
90
  setCaseGroupUpdating(true);
76
91
  try {
77
- yield updateCaseDetails(caseDispatch, caseNumber, caseDetails);
92
+ yield updateCaseDetailsGraphQL(caseDispatch, apolloClient, caseNumber, { groupNumber: caseDetails.groupNumber }, false, { salesforceCaseId: caseId });
78
93
  setCaseGroupUpdating(false);
79
- setSelectedCaseGroupUsers(caseDispatch, accountNumber, caseDetails.groupNumber, loggedInUserRights.data);
80
94
  ToastNotification.addSuccessMessage(t(`Group has been successfully updated`));
81
95
  }
82
96
  catch (e) {
@@ -85,7 +99,7 @@ function CaseGroup(props) {
85
99
  }
86
100
  });
87
101
  const onCaseGroupChange = (selection) => __awaiter(this, void 0, void 0, function* () {
88
- if (!isInvalidateCaseGroup(selection) && selection.groupNum !== groupNumber) {
102
+ if (!isInvalidateCaseGroup(selection) && (selection.groupNum !== groupNumber || !selected)) {
89
103
  const caseDetails = {
90
104
  groupNumber: selection.groupNum,
91
105
  groupName: selection.name || '',
@@ -93,7 +107,7 @@ function CaseGroup(props) {
93
107
  setIsOpen(false);
94
108
  if (!isEmpty(caseNumber)) {
95
109
  yield onCaseGroupUpdate(caseDetails);
96
- setIsSelectedUngroupedInvalid(isGroupMandatory && (!selection.groupNum || selection.groupNum === '-1'));
110
+ setIsSelectedUngroupedInvalid(isGroupMandatory && !selection.groupNum);
97
111
  }
98
112
  else {
99
113
  setCaseDetails(caseDispatch, caseDetails);
@@ -120,10 +134,7 @@ function CaseGroup(props) {
120
134
  ? list.filter((v) => v.name.toLowerCase().includes(inputValue === null || inputValue === void 0 ? void 0 : inputValue.toLowerCase()))
121
135
  : list;
122
136
  if (isGroupMandatory) {
123
- // having group selected for case is mandatory, make 'UnGrouped Case' option disabled
124
- const listItems = options.map((item) => (Object.assign(Object.assign({}, item), { disabled: item.groupNum === '-1' })));
125
- // As group is mandatory, 'UnGrouped Case' cannot be selected we filter it out
126
- return listItems.filter((g) => g.groupNum !== '-1');
137
+ return options.filter((g) => !!g.groupNum);
127
138
  }
128
139
  else
129
140
  return options;
@@ -134,11 +145,11 @@ function CaseGroup(props) {
134
145
  useEffect(() => {
135
146
  var _a, _b;
136
147
  // case group may change outside of PCM. On group load check if we have a valid group
137
- setIsSelectedUngroupedInvalid(isGroupMandatory && (!groupNumber || groupNumber === '-1'));
148
+ setIsSelectedUngroupedInvalid(isGroupMandatory && !groupNumber);
138
149
  if (groupNumber === undefined)
139
150
  return;
140
151
  if (((_b = (_a = ownersCaseGroups === null || ownersCaseGroups === void 0 ? void 0 : ownersCaseGroups.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 0) {
141
- if (groupNumber !== '-1' && groupName && caseNumber) {
152
+ if (groupNumber && groupName && caseNumber) {
142
153
  setSelectedCaseGroup({
143
154
  name: groupName,
144
155
  groupNum: groupNumber,
@@ -154,7 +165,7 @@ function CaseGroup(props) {
154
165
  }
155
166
  const selectedGroup = find(ownersCaseGroups.data, (g) => g.groupNum === groupNumber);
156
167
  if (selectedGroup && selectedGroup.groupNum) {
157
- if (isGroupMandatory && selectedGroup.groupNum === '-1') {
168
+ if (isGroupMandatory && !selectedGroup.groupNum) {
158
169
  setCaseGroupInvalid(true);
159
170
  }
160
171
  else {
@@ -168,32 +179,38 @@ function CaseGroup(props) {
168
179
  }
169
180
  // eslint-disable-next-line react-hooks/exhaustive-deps
170
181
  }, [ownersCaseGroups, caseNumber, isGroupMandatory]);
171
- useEffect(() => {
172
- // On case edit, groups are loaded via fetchCaseDetails/setCaseOwner and OwnerSelector.
173
- if (caseNumber)
182
+ const onCaseGroupClear = () => __awaiter(this, void 0, void 0, function* () {
183
+ if (canEditCase.alert())
174
184
  return;
175
- if (loggedInUserRights.data.isInternal()) {
176
- if (accountNumber) {
177
- fetchCaseGroupsForAccount(caseDispatch, accountNumber);
185
+ const caseDetails = {
186
+ groupNumber: '',
187
+ groupName: '',
188
+ };
189
+ if (caseNumber) {
190
+ setCaseGroupUpdating(true);
191
+ try {
192
+ yield updateCaseDetailsGraphQL(caseDispatch, apolloClient, caseNumber, { groupNumber: '' }, false, {
193
+ salesforceCaseId: caseId,
194
+ });
195
+ setCaseDetails(caseDispatch, caseDetails);
196
+ setCaseGroupUpdating(false);
197
+ ToastNotification.addSuccessMessage(t(`Group has been successfully updated`));
198
+ }
199
+ catch (e) {
200
+ setCaseGroupUpdating(false);
201
+ caseUpdateError.showError(e, t(`Group failed to update`));
202
+ return;
178
203
  }
179
204
  }
180
- else if (contactSSOName) {
181
- fetchCaseGroupsForSSO(caseDispatch, contactSSOName);
182
- }
183
- }, [accountNumber, caseDispatch, caseNumber, contactSSOName, loggedInUserRights.data]);
184
- const onCaseGroupClear = () => __awaiter(this, void 0, void 0, function* () {
185
- var _a;
186
- try {
187
- yield onCaseGroupChange(toOption(emptyCaseGroup));
188
- setSelectedCaseGroup(emptyCaseGroup);
189
- setInputValue('');
190
- setSelected('');
191
- (_a = textInputRef === null || textInputRef === void 0 ? void 0 : textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
192
- setIsOpen(false);
193
- }
194
- catch (error) {
195
- console.log(error);
205
+ else {
206
+ setCaseDetails(caseDispatch, caseDetails);
207
+ setSelectedCaseGroupUsers(caseDispatch, accountNumber, '', loggedInUserRights.data);
196
208
  }
209
+ setSelectedCaseGroup(emptyCaseGroup);
210
+ setCaseGroupInvalid(false);
211
+ setInputValue('');
212
+ setSelected('');
213
+ setIsOpen(false);
197
214
  });
198
215
  const showHelperText = !isSelectedUngroupedInvalid || (!isCaseGroupInvalid && !isGroupMandatory);
199
216
  const showEmptyValidationError = !caseNumber && isNextBtnClickedToShowValidationError && isCaseGroupInvalid;
@@ -229,7 +246,12 @@ function CaseGroup(props) {
229
246
  ? 'danger'
230
247
  : undefined, isFullWidth: true },
231
248
  React.createElement(TextInputGroup, { isPlain: true },
232
- React.createElement(TextInputGroupMain, { value: inputValue, onClick: onToggleClick, onChange: onInputQueryChange, onKeyDown: onInputKeyDown, autoComplete: "off", innerRef: textInputRef, placeholder: t(`Select a group`), role: "combobox", isExpanded: isOpen, "aria-controls": "select-typeahead-listbox" }),
249
+ React.createElement(TextInputGroupMain, { value: inputValue, onClick: onToggleClick, onChange: onInputQueryChange, onKeyDown: onInputKeyDown, onBlur: () => {
250
+ if (selected) {
251
+ setInputValue(selected);
252
+ setShouldFilter(false);
253
+ }
254
+ }, autoComplete: "off", innerRef: textInputRef, placeholder: t(`Select a group`), role: "combobox", isExpanded: isOpen, "aria-controls": "select-typeahead-listbox" }),
233
255
  !isCaseOwnerUpdating && (ownersCaseGroups.isFetching || isCaseGroupUpdating) ? (React.createElement(TextInputGroupUtilities, null,
234
256
  React.createElement(Spinner, { size: "md" }))) : (React.createElement(TextInputGroupUtilities, Object.assign({}, (!inputValue ? { style: { display: 'none' } } : {})),
235
257
  React.createElement(Button, { icon: React.createElement(TimesIcon, { "aria-hidden": true }), variant: "plain", onClick: onCaseGroupClear, "aria-label": "Clear input value" }))))));
@@ -1 +1 @@
1
- {"version":3,"file":"CaseInformation.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseInformation.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAQvD,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC;CACnC;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAAK,EAAE,MAAM,qBAkHpD"}
1
+ {"version":3,"file":"CaseInformation.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/CaseInformation.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAQvD,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC;CACnC;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAAK,EAAE,MAAM,qBAoHpD"}
@@ -1,3 +1,4 @@
1
+ import { useApolloClient } from '@apollo/client/react';
1
2
  import { AlertMessage, AlertType, LoadingIndicator } from '@rh-support/components';
2
3
  import { fetchCaseSeverities, fetchCaseTypes, fetchLanguageMetadata, GlobalMetadataDispatchContext, GlobalMetadataStateContext, } from '@rh-support/react-context';
3
4
  import { haventLoadedMetadata } from '@rh-support/utils';
@@ -7,13 +8,14 @@ import React, { useContext, useEffect } from 'react';
7
8
  import { Trans, useTranslation } from 'react-i18next';
8
9
  import { useCaseSelector } from '../../context/CaseContext';
9
10
  import { OpenShiftClusterId } from '../CaseManagement/OpenShiftClusterId';
10
- import { Hostname } from '../ImproveCase/Hostname';
11
+ // import { Hostname } from '../ImproveCase/Hostname';
11
12
  import KtQuestions from '../ImproveCase/KtQuestions';
12
13
  import ClusterRecommendations from '../Recommendations/ClusterRecommendations';
13
14
  export default function CaseInformation(props) {
14
15
  const { t } = useTranslation();
15
16
  const { globalMetadataState: { allCaseTypes, allCaseSeverities, caseLanguages, loggedInUser, loggedInUserJwtToken, loggedInUsersAccount, loggedInUserRights, }, } = useContext(GlobalMetadataStateContext);
16
17
  const dispatchToGlobalMetadataReducer = useContext(GlobalMetadataDispatchContext);
18
+ const apolloClient = useApolloClient();
17
19
  const { contactSSOName, selectedAccountDetails, ownersCaseGroups, hasInvalidEntitlements } = useCaseSelector((state) => ({
18
20
  contactSSOName: state.caseDetails.contactSSOName,
19
21
  ownersCaseGroups: state.ownersCaseGroups,
@@ -38,13 +40,13 @@ export default function CaseInformation(props) {
38
40
  }
39
41
  const allPromisses = [];
40
42
  if (haventLoadedMetadata(allCaseTypes)) {
41
- allPromisses.push(fetchCaseTypes(dispatchToGlobalMetadataReducer, loggedInUsersAccount.data.secureSupport));
43
+ allPromisses.push(fetchCaseTypes(dispatchToGlobalMetadataReducer, apolloClient));
42
44
  }
43
45
  if (haventLoadedMetadata(allCaseSeverities)) {
44
- allPromisses.push(fetchCaseSeverities(dispatchToGlobalMetadataReducer, loggedInUsersAccount.data.secureSupport));
46
+ allPromisses.push(fetchCaseSeverities(dispatchToGlobalMetadataReducer, apolloClient));
45
47
  }
46
48
  if (haventLoadedMetadata(caseLanguages)) {
47
- allPromisses.push(fetchLanguageMetadata(dispatchToGlobalMetadataReducer));
49
+ allPromisses.push(fetchLanguageMetadata(dispatchToGlobalMetadataReducer, apolloClient));
48
50
  }
49
51
  Promise.all(allPromisses);
50
52
  }, [
@@ -56,6 +58,7 @@ export default function CaseInformation(props) {
56
58
  loggedInUserJwtToken,
57
59
  selectedAccountDetails,
58
60
  loggedInUsersAccount.data.secureSupport,
61
+ apolloClient,
59
62
  ]);
60
63
  return (React.createElement(React.Fragment, null,
61
64
  React.createElement(LoadingIndicator, { show: isMetadataLoading(), size: "lg" }),
@@ -77,7 +80,6 @@ export default function CaseInformation(props) {
77
80
  !isMetadataLoadingError() &&
78
81
  loggedInUserRights.data.canManageCases() && (React.createElement(React.Fragment, null,
79
82
  React.createElement("form", null,
80
- React.createElement(Hostname, null),
81
83
  React.createElement(OpenShiftClusterId, null),
82
84
  React.createElement(ClusterRecommendations, { className: "push-bottom" }),
83
85
  React.createElement(KtQuestions, null))))));
@@ -1 +1 @@
1
- {"version":3,"file":"ContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/ContactPhoneNumber.tsx"],"names":[],"mappings":"AAOA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAiB/D,wBAAgB,kBAAkB,sBAsVjC"}
1
+ {"version":3,"file":"ContactPhoneNumber.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/ContactPhoneNumber.tsx"],"names":[],"mappings":"AAQA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAuC/D,wBAAgB,kBAAkB,sBAwVjC"}
@@ -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 { contacts } from '@cee-eng/hydrajs';
10
+ import { useApolloClient } from '@apollo/client/react';
11
11
  import { ValidatedOptions } from '@patternfly/react-core';
12
12
  import { getPhoneObj, PhoneInput } from '@rh-support/components';
13
13
  import { GlobalMetadataStateContext } from '@rh-support/react-context';
14
+ import { GET_ACCOUNT_CONTACTS } from '@rh-support/utils';
14
15
  import isEmpty from 'lodash/isEmpty';
15
16
  import isEqual from 'lodash/isEqual';
16
17
  import isUndefined from 'lodash/isUndefined';
@@ -24,13 +25,33 @@ import { setCaseDetails, setCaseState } from '../../reducers/CaseReducer';
24
25
  import { PDFContext } from '../CaseEditView/PDFContainer';
25
26
  import { removeAllChars, trimAndReplacePlus } from '../shared/utils';
26
27
  import { ContactPhoneNumberPopOver } from './ContactPhoneNumberPopOver';
28
+ function fetchContactBySSO(apolloClient, accountNumber, ssoUsername) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
31
+ const { data } = yield apolloClient.query({
32
+ query: GET_ACCOUNT_CONTACTS,
33
+ variables: {
34
+ accountNumber: { eq: accountNumber },
35
+ contactsWhere: { SSOUserName__c: { eq: ssoUsername } },
36
+ first: 1,
37
+ },
38
+ });
39
+ const response = data;
40
+ const contactNode = (_j = (_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 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.node;
41
+ return {
42
+ phone: (_l = (_k = contactNode === null || contactNode === void 0 ? void 0 : contactNode.Phone) === null || _k === void 0 ? void 0 : _k.value) !== null && _l !== void 0 ? _l : '',
43
+ };
44
+ });
45
+ }
27
46
  export function ContactPhoneNumber() {
28
- const { suppliedPhoneNumberVerified, phoneCountryCode = '', phoneAreaCodePrefixLineNumber = '', hasLoggedInUserConfirmedPhoneNumber, contactSSOName, shouldNotSetPhoneCountryCode, isCasePhoneUpdating, } = useCaseSelector((state) => ({
47
+ const apolloClient = useApolloClient();
48
+ const { suppliedPhoneNumberVerified, phoneCountryCode = '', phoneAreaCodePrefixLineNumber = '', hasLoggedInUserConfirmedPhoneNumber, contactSSOName, accountNumberRef, shouldNotSetPhoneCountryCode, isCasePhoneUpdating, } = useCaseSelector((state) => ({
29
49
  suppliedPhoneNumberVerified: state.caseDetails.suppliedPhoneNumberVerified,
30
50
  phoneCountryCode: state.caseDetails.phoneCountryCode,
31
51
  phoneAreaCodePrefixLineNumber: state.caseDetails.phoneAreaCodePrefixLineNumber,
32
52
  hasLoggedInUserConfirmedPhoneNumber: state.hasLoggedInUserConfirmedPhoneNumber,
33
53
  contactSSOName: state.caseDetails.contactSSOName,
54
+ accountNumberRef: state.caseDetails.accountNumberRef,
34
55
  shouldNotSetPhoneCountryCode: state.shouldNotSetPhoneCountryCode,
35
56
  isCasePhoneUpdating: state.isCasePhoneUpdating,
36
57
  }), isEqual);
@@ -156,32 +177,25 @@ export function ContactPhoneNumber() {
156
177
  }
157
178
  }
158
179
  else {
159
- // user is openning case for others (use is partner or red hatter)
180
+ // user is opening case for others (user is partner or red hatter)
160
181
  try {
161
182
  if (!contactSSOName)
162
183
  return;
163
184
  setIsFetchingSso(true);
164
- const selectedContact = yield contacts.getSFDCContactBySso(contactSSOName);
185
+ const selectedContact = yield fetchContactBySSO(apolloClient, accountNumberRef, contactSSOName);
165
186
  setIsFetchingSso(false);
166
- if (selectedContact.supportPhoneAreaCodePrefixLineNumber) {
167
- _phoneAreaCodePrefixLineNumber = selectedContact.supportPhoneAreaCodePrefixLineNumber;
168
- _phoneCountryCode = selectedContact.supportPhoneCountryCode;
169
- _suppliedPhoneNumberVerified = 'Deferred';
187
+ const phoneLength = trimAndReplacePlus(removeAllChars(selectedContact.phone)).length;
188
+ if (phoneLength > 10) {
189
+ _phoneAreaCodePrefixLineNumber = getPhoneObj(selectedContact.phone).phoneLine || '';
190
+ _phoneCountryCode = getPhoneObj(selectedContact.phone).countryCode || '';
170
191
  }
171
192
  else {
172
- const phoneLength = trimAndReplacePlus(removeAllChars(selectedContact.phone)).length;
173
- if (phoneLength > 10) {
174
- _phoneAreaCodePrefixLineNumber = getPhoneObj(selectedContact.phone).phoneLine || '';
175
- _phoneCountryCode = getPhoneObj(selectedContact.phone).countryCode || '';
176
- }
177
- else {
178
- _phoneAreaCodePrefixLineNumber = selectedContact.phone;
179
- _phoneCountryCode = '';
180
- setCaseState(caseDispatch, { shouldNotSetPhoneCountryCode: true });
181
- setPortalPhone(selectedContact.phone);
182
- }
183
- _suppliedPhoneNumberVerified = 'Deferred';
193
+ _phoneAreaCodePrefixLineNumber = selectedContact.phone;
194
+ _phoneCountryCode = '';
195
+ setCaseState(caseDispatch, { shouldNotSetPhoneCountryCode: true });
196
+ setPortalPhone(selectedContact.phone);
184
197
  }
198
+ _suppliedPhoneNumberVerified = 'Deferred';
185
199
  }
186
200
  catch (e) {
187
201
  _phoneAreaCodePrefixLineNumber = '';
@@ -213,12 +227,11 @@ export function ContactPhoneNumber() {
213
227
  try {
214
228
  if (!contactSSOName)
215
229
  return;
216
- const selectedContact = yield contacts.getSFDCContactBySso(contactSSOName);
217
- if (isEmpty(selectedContact.supportPhoneAreaCodePrefixLineNumber) &&
218
- !isEmpty(selectedContact.phone)) {
230
+ const selectedContact = yield fetchContactBySSO(apolloClient, accountNumberRef, contactSSOName);
231
+ if (!isEmpty(selectedContact.phone)) {
219
232
  portalPhone = selectedContact.phone;
220
233
  phoneLength = trimAndReplacePlus(removeAllChars(portalPhone)).length;
221
- supportPhone = selectedContact.supportPhoneAreaCodePrefixLineNumber;
234
+ supportPhone = '';
222
235
  }
223
236
  }
224
237
  catch (e) {
@@ -1 +1 @@
1
- {"version":3,"file":"SupportLevel.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/SupportLevel.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAI5D,OAAO,KAA0C,MAAM,OAAO,CAAC;AAM/D,UAAU,MAAO,SAAQ,gBAAgB;CAAG;AAO5C,iBAAS,YAAY,CAAC,KAAK,EAAE,MAAM,qBAoJlC;kBApJQ,YAAY;;;AAsJrB,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"SupportLevel.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseInformation/SupportLevel.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAI5D,OAAO,KAA8B,MAAM,OAAO,CAAC;AAMnD,UAAU,MAAO,SAAQ,gBAAgB;CAAG;AAO5C,iBAAS,YAAY,CAAC,KAAK,EAAE,MAAM,qBAqHlC;kBArHQ,YAAY;;;AAuHrB,eAAe,YAAY,CAAC"}