@rh-support/troubleshoot 2.6.300 → 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 +60 -34
  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
@@ -1 +1 @@
1
- {"version":3,"file":"AccountSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountInfo/AccountSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AAOnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAK5D,OAAO,KAA0C,MAAM,OAAO,CAAC;AAS/D,UAAU,MAAO,SAAQ,gBAAgB;CAAG;AAE5C,eAAO,MAAM,YAAY,EAAE,MAG1B,CAAC;AAEF,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,qBA6KrC;kBA7KQ,eAAe;;;AAiLxB,OAAO,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"AccountSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountInfo/AccountSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AAOnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAK5D,OAAO,KAA0C,MAAM,OAAO,CAAC;AAS/D,UAAU,MAAO,SAAQ,gBAAgB;CAAG;AAE5C,eAAO,MAAM,YAAY,EAAE,MAG1B,CAAC;AAEF,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,qBAmKrC;kBAnKQ,eAAe;;;AAuKxB,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import './css/accountSelector.css';
11
- import { accounts } from '@cee-eng/hydrajs';
11
+ import { useApolloClient } from '@apollo/client/react';
12
12
  import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
13
13
  import { AlertMessage, AlertType } from '@rh-support/components';
14
14
  import { AccountSelectorInternal, GlobalMetadataStateContext } from '@rh-support/react-context';
@@ -30,12 +30,14 @@ export const defaultProps = {
30
30
  function AccountSelector(props) {
31
31
  var _a;
32
32
  const [showNotEntitledMessage, setShowNotEntitledMessage] = useState(false);
33
- const { accountNumber, selectedAccountDetails } = useCaseSelector((state) => ({
33
+ const { accountNumber, selectedAccountDetails, hasInvalidEntitlements } = useCaseSelector((state) => ({
34
34
  accountNumber: state.caseDetails.accountNumberRef,
35
35
  selectedAccountDetails: state.selectedAccountDetails,
36
+ hasInvalidEntitlements: state.hasInvalidEntitlements,
36
37
  }), isEqual);
37
38
  const isSelectedAccountSubscriptionAbused = ((_a = selectedAccountDetails === null || selectedAccountDetails === void 0 ? void 0 : selectedAccountDetails.data) === null || _a === void 0 ? void 0 : _a.subscriptionAbuse) || false;
38
39
  const caseDispatch = useCaseDispatch();
40
+ const apolloClient = useApolloClient();
39
41
  const routeDispatch = useRouteDispatchContext();
40
42
  const { globalMetadataState: { bookmarkedGroupAccounts, loggedInUserRights, managedAccounts, loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
41
43
  const { t } = useTranslation();
@@ -43,7 +45,7 @@ function AccountSelector(props) {
43
45
  const ability = useContext(AbilityContext);
44
46
  const canAccessManagedAccounts = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.MANAGED_ACCOUNTS);
45
47
  const canBookmarkAccounts = ability.can(resourceActions.PATCH, resources.CASE_CREATE, CaseListFields.BOOKMARK_ACCOUNTS);
46
- const canUseFindMyAccount = loggedInUserRights.data.isAccountDifferentFromLoggedInAccount(accountNumber);
48
+ // const canUseFindMyAccount = loggedInUserRights.data.isAccountDifferentFromLoggedInAccount(accountNumber!);
47
49
  // Account Change Handler
48
50
  const onAccountChange = (account) => __awaiter(this, void 0, void 0, function* () {
49
51
  if (selectedAccountDetails.data.accountNumber === account.accountNumber)
@@ -52,7 +54,7 @@ function AccountSelector(props) {
52
54
  clearSelectedAccount(caseDispatch);
53
55
  return;
54
56
  }
55
- setCaseAccountNumber(caseDispatch, account.accountNumber, loggedInUserRights.data.isAccountSameAsLoggedInAccount(account.accountNumber), loggedInUsersAccount.data);
57
+ setCaseAccountNumber(caseDispatch, account.accountNumber, loggedInUserRights.data.isAccountSameAsLoggedInAccount(account.accountNumber), loggedInUsersAccount.data, apolloClient);
56
58
  });
57
59
  const onInternalAccountSelect = (accounts) => {
58
60
  if (!isArray(accounts))
@@ -64,48 +66,36 @@ function AccountSelector(props) {
64
66
  selection.accountNum &&
65
67
  onAccountChange({ accountNumber: selection.accountNum, name: selection.name });
66
68
  };
67
- const onFindMyAccountClick = (event) => {
68
- !isEmpty(loggedInUserRights.data) &&
69
- onAccountChange({
70
- accountNumber: loggedInUserRights.data.getAccountNumber(),
71
- name: loggedInUserRights.data.getAccountName(),
72
- });
73
- };
69
+ // const onFindMyAccountClick = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
70
+ // !isEmpty(loggedInUserRights.data) &&
71
+ // onAccountChange({
72
+ // accountNumber: loggedInUserRights.data.getAccountNumber(),
73
+ // name: loggedInUserRights.data.getAccountName(),
74
+ // });
75
+ // };
74
76
  const selectedAccount = {
75
77
  name: selectedAccountDetails.data.name,
76
78
  accountNumber: selectedAccountDetails.data.accountNumber,
77
79
  subscriptionAbuse: selectedAccountDetails.data.subscriptionAbuse,
78
80
  };
79
- // When internal user wants to open a case for a customer but customer account doesn't have entitlement, we show an error
80
81
  useEffect(() => {
81
- const getAccountEntitlement = () => __awaiter(this, void 0, void 0, function* () {
82
- // internal user doesn't open case for customer. No need to check account entitlement
83
- if (selectedAccountDetails.data.accountNumber === loggedInUsersAccount.data.accountNumber) {
84
- setNoValidEntitlement(routeDispatch, false);
85
- setShowNotEntitledMessage(false);
86
- return;
87
- }
82
+ if (!loggedInUserRights.data.isInternal() || !selectedAccountDetails.data.accountNumber) {
83
+ return;
84
+ }
85
+ if (selectedAccountDetails.data.accountNumber === loggedInUsersAccount.data.accountNumber) {
86
+ setNoValidEntitlement(routeDispatch, false);
88
87
  setShowNotEntitledMessage(false);
89
- try {
90
- const res = yield accounts.getAccountEntitlementByInternalUser(selectedAccountDetails.data.accountNumber);
91
- if (isEmpty(res)) {
92
- setShowNotEntitledMessage(true);
93
- setNoValidEntitlement(routeDispatch, true);
94
- }
95
- else {
96
- setShowNotEntitledMessage(false);
97
- setNoValidEntitlement(routeDispatch, false);
98
- }
99
- }
100
- catch (e) {
101
- console.log(e);
102
- }
103
- });
104
- if (loggedInUserRights.data.isInternal() && selectedAccountDetails.data.accountNumber) {
105
- getAccountEntitlement();
88
+ return;
106
89
  }
90
+ setShowNotEntitledMessage(hasInvalidEntitlements);
91
+ setNoValidEntitlement(routeDispatch, hasInvalidEntitlements);
107
92
  // eslint-disable-next-line react-hooks/exhaustive-deps
108
- }, [selectedAccountDetails.data.accountNumber, loggedInUserRights.data, loggedInUsersAccount.data]);
93
+ }, [
94
+ selectedAccountDetails.data.accountNumber,
95
+ loggedInUserRights.data,
96
+ loggedInUsersAccount.data,
97
+ hasInvalidEntitlements,
98
+ ]);
109
99
  if (isEmpty(loggedInUserRights.data))
110
100
  return React.createElement(React.Fragment, null);
111
101
  return (React.createElement("div", { id: props.id, className: `form-group ${props.className}` },
@@ -114,9 +104,7 @@ function AccountSelector(props) {
114
104
  React.createElement("label", { htmlFor: "account-selector" },
115
105
  React.createElement(Trans, null, "Account"),
116
106
  ' ',
117
- React.createElement("span", { className: "form-required", "aria-hidden": true }, "*")),
118
- canUseFindMyAccount && (React.createElement("button", { role: "link", className: "btn btn-link btn-app find-my-account pf-v6-u-ml-auto", onClick: onFindMyAccountClick, disabled: selectedAccountDetails.isFetching, "data-tracking-id": "get-support-find-my-account", type: "button" },
119
- React.createElement(Trans, null, "Find my account")))),
107
+ React.createElement("span", { className: "form-required", "aria-hidden": true }, "*"))),
120
108
  React.createElement("div", { className: "account-selector-wrapper" },
121
109
  React.createElement(AccountSelectorInternal, { selectedAccounts: [selectedAccount], canBookmarkAccount: canBookmarkAccounts, bookmarkedAccounts: bookmarkedGroupAccounts.data, id: "account-or-bookmark-selector", className: "account-selector", name: "account-or-bookmark-selector", placeholder: t(`Search for an account ${loggedInUserRights.data.isExternal() ? 'or select a bookmark' : ''} `), onSelect: onInternalAccountSelect, disabled: loggedInUserRights.data.isExternal() || selectedAccountDetails.isFetching, isInValid: isSelectedAccountSubscriptionAbused, restrictedOnSubscriptionAbuse: true })),
122
110
  canAccessManagedAccounts && !isEmpty(managedAccounts.data) && (React.createElement(ManagedAccountsDropdown, { className: "managed-account-selector pf-v6-u-mt-xl", onManagedAccountChange: onManagedAccountChange, managedAccounts: managedAccounts, selectedAccountNumber: accountNumber, disabled: selectedAccountDetails.isFetching })),
@@ -1 +1 @@
1
- {"version":3,"file":"OwnerSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountInfo/OwnerSelector.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAiBxE,UAAU,MAAM;CAAG;AAMnB,iBAAS,aAAa,CAAC,KAAK,EAAE,MAAM,qBAmTnC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"OwnerSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/AccountInfo/OwnerSelector.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAmBxE,UAAU,MAAM;CAAG;AAMnB,iBAAS,aAAa,CAAC,KAAK,EAAE,MAAM,qBAqXnC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -7,9 +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 { CaseContactsSelectorExternal, getHydraContactLabel, OwnerTypeaheadDropdown, ToastNotification, usePrevious, ValueChangedIcon, } from '@rh-support/components';
10
+ // import { ICasePayload } from '@cee-eng/hydrajs/@types/api/public/case';
11
+ import { useApolloClient } from '@apollo/client/react';
12
+ import { CaseContactsSelectorExternal, getHydraContactLabel, getPhoneObj, OwnerTypeaheadDropdown, ToastNotification, usePrevious, ValueChangedIcon, } from '@rh-support/components';
11
13
  import { GlobalMetadataStateContext, useCanEditCase } from '@rh-support/react-context';
12
- import { sortHydraContacts } from '@rh-support/utils';
14
+ import { mapGraphQLContactPhoneToCasePhoneFields, sortHydraContacts } from '@rh-support/utils';
13
15
  import filter from 'lodash/filter';
14
16
  import isEmpty from 'lodash/isEmpty';
15
17
  import isEqual from 'lodash/isEqual';
@@ -20,7 +22,9 @@ import { Trans, useTranslation } from 'react-i18next';
20
22
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
21
23
  import { RouteContext } from '../../context/RouteContext';
22
24
  import { useCaseUpdateErrorMessage } from '../../hooks/useCaseUpdateErrorMessage';
23
- import { setCaseDetails, setCaseOwner, setCaseState, setNotifiedUser, updateCaseDetails, } from '../../reducers/CaseReducer';
25
+ import { fetchCaseGroupsForContactGraphQL, setCaseDetails, setCaseOwner, setCaseState, setNotifiedUser,
26
+ // updateCaseDetails,
27
+ updateCaseDetailsGraphQL, } from '../../reducers/CaseReducer';
24
28
  import { PDFContext } from '../CaseEditView/PDFContainer';
25
29
  import { CaseValuesToWatch } from '../shared/Constants';
26
30
  import { getChangedValueTooltip } from '../shared/utils';
@@ -30,18 +34,21 @@ function getOwnerDropdownOptions(contacts) {
30
34
  function OwnerSelector(props) {
31
35
  const { t } = useTranslation();
32
36
  const caseUpdateError = useCaseUpdateErrorMessage();
33
- const { accountNumber, caseNumber, contactSsoUsername, selectedNotificationContacts, selectedOwner, selectedCaseGroupUsers, isCaseOwnerUpdating, isCasePhoneUpdating, } = useCaseSelector((state) => ({
37
+ const { accountNumber, caseNumber, contactSsoUsername, existingCaseDetails, selectedNotificationContacts, selectedOwner, selectedCaseGroupUsers, isCaseOwnerUpdating, isCasePhoneUpdating, groupNumber, } = useCaseSelector((state) => ({
34
38
  accountNumber: state.caseDetails.accountNumberRef,
35
39
  caseNumber: state.caseDetails.caseNumber,
40
+ existingCaseDetails: state.caseDetails,
36
41
  selectedNotificationContacts: state.selectedNotificationContacts,
37
42
  selectedOwner: state.selectedOwner,
38
43
  selectedCaseGroupUsers: state.selectedCaseGroupUsers,
39
44
  isCaseOwnerUpdating: state.isCaseOwnerUpdating,
40
45
  isCasePhoneUpdating: state.isCasePhoneUpdating,
41
46
  contactSsoUsername: state.caseDetails.contactSSOName,
47
+ groupNumber: state.caseDetails.groupNumber,
42
48
  }), isEqual);
43
49
  const { routeState: { isNextBtnClickedToShowValidationError }, } = useContext(RouteContext);
44
50
  const caseDispatch = useCaseDispatch();
51
+ const apolloClient = useApolloClient();
45
52
  const { globalMetadataState: { loggedInUserRights, loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
46
53
  const previousAccountNumber = usePrevious(accountNumber);
47
54
  const { isExportingPDF } = useContext(PDFContext);
@@ -102,18 +109,37 @@ function OwnerSelector(props) {
102
109
  }
103
110
  setNotifiedUser(caseDispatch, newNotifiedUsers);
104
111
  };
112
+ const getOwnerPhoneCaseUpdate = (owner) => {
113
+ var _a;
114
+ if (!((_a = owner.phone) === null || _a === void 0 ? void 0 : _a.trim())) {
115
+ return null;
116
+ }
117
+ return mapGraphQLContactPhoneToCasePhoneFields(owner.phone, (phone) => {
118
+ const { countryCode, phoneLine } = getPhoneObj(phone);
119
+ return { countryCode, phoneLine: phoneLine || '' };
120
+ });
121
+ };
105
122
  const onCaseOwnerUpdate = (newOwner) => __awaiter(this, void 0, void 0, function* () {
106
- const caseDetails = { contactSSOName: newOwner.ssoUsername };
123
+ // const caseDetails: Partial<ICasePayload> = { contactSSOName: newOwner.ssoUsername };
124
+ // if (!newOwner.id) {
125
+ // caseUpdateError.showError(new Error('Contact id is required'), t(`Owner failed to update`));
126
+ // return;
127
+ // }
128
+ var _a;
107
129
  setCaseState(caseDispatch, { isCaseOwnerUpdating: true });
130
+ const ownerPhoneCaseUpdate = getOwnerPhoneCaseUpdate(newOwner);
108
131
  try {
109
- yield updateCaseDetails(caseDispatch, caseNumber, caseDetails);
110
- // set phone fields to empty value to triger fetching
111
- // phone number for new owner
112
- setCaseDetails(caseDispatch, {
113
- contactSSOName: newOwner.ssoUsername,
114
- phoneCountryCode: '',
115
- phoneAreaCodePrefixLineNumber: '',
116
- });
132
+ const newGroupNumber = (newOwner === null || newOwner === void 0 ? void 0 : newOwner.defaultCaseGroup) || null;
133
+ yield updateCaseDetailsGraphQL(caseDispatch, apolloClient, caseNumber, Object.assign({ contactId: newOwner.id, contactSSOName: newOwner.ssoUsername, groupNumber: newGroupNumber }, (ownerPhoneCaseUpdate !== null && ownerPhoneCaseUpdate !== void 0 ? ownerPhoneCaseUpdate : {})), false, { existingCaseDetails });
134
+ // When the picklist contact has no phone, clear fields so CaseContactPhoneNumber re-fetches it.
135
+ if (!ownerPhoneCaseUpdate) {
136
+ setCaseDetails(caseDispatch, {
137
+ contactSSOName: newOwner.ssoUsername,
138
+ phoneCountryCode: '',
139
+ phoneAreaCodePrefixLineNumber: '',
140
+ phone: '',
141
+ });
142
+ }
117
143
  const abortSignal = new AbortController().signal;
118
144
  yield setCaseOwner(caseDispatch, {
119
145
  ssoUsername: newOwner.ssoUsername,
@@ -121,11 +147,15 @@ function OwnerSelector(props) {
121
147
  lastName: newOwner.lastName,
122
148
  fullNameCustom: newOwner.fullNameCustom,
123
149
  manageSupportCases: newOwner.manageSupportCases,
150
+ id: newOwner.id,
124
151
  }, '', abortSignal, abortSignal, false, '', true, true, caseNumber, loggedInUserRights.data.isInternal() ? accountNumber : undefined);
125
152
  setLocalOwnerChange(true);
126
153
  updateNotifyUsersList(newOwner);
127
154
  ToastNotification.addSuccessMessage(t(`Owner has been successfully updated`));
128
155
  setCaseState(caseDispatch, { isCaseOwnerUpdating: false });
156
+ if (newOwner.id && accountNumber) {
157
+ fetchCaseGroupsForContactGraphQL(caseDispatch, apolloClient, newOwner.id, accountNumber, newOwner === null || newOwner === void 0 ? void 0 : newOwner.defaultCaseGroup, (_a = newOwner.isOrgAdmin) !== null && _a !== void 0 ? _a : false, null);
158
+ }
129
159
  }
130
160
  catch (e) {
131
161
  setCaseState(caseDispatch, { isCaseOwnerUpdating: false });
@@ -209,6 +239,14 @@ function OwnerSelector(props) {
209
239
  React.createElement(Trans, null, "Owner"),
210
240
  React.createElement(ValueChangedIcon, { afterLocalChange: afterLocalChange, comparator: ownerComparator, isLocalChange: localOwnerChange, value: selectedOwner.data, getTooltipContent: getChangedValueTooltip(() => CaseValuesToWatch.owner, (v) => v.fullNameCustom) }),
211
241
  React.createElement("span", { className: `form-required ${isExportingPDF ? 'hide-in-pdf' : ''}`, "aria-hidden": true }, "*")),
212
- showUsersWithSelectedGroupAccess && loggedInUsersAccount.data.hasGroupACLs ? (React.createElement(OwnerTypeaheadDropdown, { id: "get-support-owner", hasClearButton: true, contactSsoUsername: contactSsoUsername !== null && contactSsoUsername !== void 0 ? contactSsoUsername : '', selected: !isEmpty(selectedOwner.data) ? [selectedOwner.data] : [], isDisabled: selectedCaseGroupUsers.isFetching || isCaseOwnerUpdating || isCasePhoneUpdating, onSelect: onCustomerContactSelect, onClearQuery: onClearQuery, onQueryUpdated: onQueryUpdated, options: ownerDropdownOptions, status: isNextBtnClickedToShowValidationError && isEmpty(selectedOwner.data) ? 'danger' : undefined })) : (React.createElement(CaseContactsSelectorExternal, { loggedInUserRights: loggedInUserRights.data, selectedAccountNumber: accountNumber, contactSsoUsername: contactSsoUsername !== null && contactSsoUsername !== void 0 ? contactSsoUsername : '', selected: !isEmpty(selectedOwner.data) ? [selectedOwner.data] : [], onChange: onCustomerContactSelect, placeholder: t(`Search by name or username`), clearButton: true, id: "get-support-owner", name: "get-support-owner", className: "react-select-custom", isUpdating: isCaseOwnerUpdating, isInvalid: isNextBtnClickedToShowValidationError && isEmpty(selectedOwner.data), isDisabled: isCasePhoneUpdating || isCaseOwnerUpdating }))));
242
+ showUsersWithSelectedGroupAccess && loggedInUsersAccount.data.hasGroupACLs ? (React.createElement(OwnerTypeaheadDropdown, { id: "get-support-owner", hasClearButton: true, contactSsoUsername: contactSsoUsername !== null && contactSsoUsername !== void 0 ? contactSsoUsername : '', selected: !isEmpty(selectedOwner.data) ? [selectedOwner.data] : [], isDisabled: selectedCaseGroupUsers.isFetching || isCaseOwnerUpdating || isCasePhoneUpdating, onSelect: onCustomerContactSelect, onClearQuery: onClearQuery, onQueryUpdated: onQueryUpdated, options: ownerDropdownOptions, status: isNextBtnClickedToShowValidationError && isEmpty(selectedOwner.data) ? 'danger' : undefined })) : (React.createElement(CaseContactsSelectorExternal, { loggedInUserRights: loggedInUserRights.data, selectedAccountNumber: accountNumber, contactSsoUsername: contactSsoUsername !== null && contactSsoUsername !== void 0 ? contactSsoUsername : '', selected: !isEmpty(selectedOwner.data) ? [selectedOwner.data] : [], onChange: onCustomerContactSelect, onContactEnriched: (contact) => {
243
+ var _a;
244
+ setCaseState(caseDispatch, {
245
+ selectedOwner: { data: contact, isFetching: false, isError: false, errorMessage: '' },
246
+ });
247
+ if (contact.id && accountNumber) {
248
+ fetchCaseGroupsForContactGraphQL(caseDispatch, apolloClient, contact.id, accountNumber, caseNumber ? groupNumber : contact.defaultCaseGroup, (_a = contact.isOrgAdmin) !== null && _a !== void 0 ? _a : false, groupNumber);
249
+ }
250
+ }, placeholder: t(`Search by name or username`), clearButton: true, id: "get-support-owner", name: "get-support-owner", className: "react-select-custom", isUpdating: isCaseOwnerUpdating, isInvalid: isNextBtnClickedToShowValidationError && isEmpty(selectedOwner.data), isDisabled: isCasePhoneUpdating || isCaseOwnerUpdating }))));
213
251
  }
214
252
  export { OwnerSelector };
@@ -1 +1 @@
1
- {"version":3,"file":"RequestEscalationModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.tsx"],"names":[],"mappings":"AAiCA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAkBnD,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,qBA6WnD"}
1
+ {"version":3,"file":"RequestEscalationModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAgBnD,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,qBA4WnD"}
@@ -7,26 +7,29 @@ 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
+ import { escalations } from '@cee-eng/hydrajs';
11
12
  import { Button, Form, FormGroup, FormHelperText, Grid, GridItem, HelperText, HelperTextItem, Modal, ModalBody, ModalFooter, ModalHeader, Popover, TextArea, TextInput, Title, ValidatedOptions, } from '@patternfly/react-core';
12
13
  import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
13
14
  import { AlertMessage, AlertType, LoadingIndicator, SingleSelectDropdown, ToastNotification, useFetch, } from '@rh-support/components';
14
- import { useGlobalStateContext } from '@rh-support/react-context';
15
+ import { fetchCaseDetails, useGlobalStateContext } from '@rh-support/react-context';
15
16
  import isEmpty from 'lodash/isEmpty';
17
+ import isEqual from 'lodash/isEqual';
16
18
  import React, { useEffect, useState } from 'react';
17
19
  import { Trans, useTranslation } from 'react-i18next';
18
- import { useCaseDispatch } from '../../../context/CaseContext';
19
- import { useCaseDetailsPageDispatchContext, useCaseDetailsPageStateContext, } from '../../../context/CaseDetailsPageContext';
20
- import { useCaseDiscussionTabDispatchContext, useCaseDiscussionTabStateContext, } from '../../../context/CaseDiscussionTabContext';
20
+ import { useCaseDispatch, useCaseSelector } from '../../../context/CaseContext';
21
+ import { useCaseDetailsPageDispatchContext } from '../../../context/CaseDetailsPageContext';
21
22
  import { CustomerGEOs } from '../../../enums/customerGEOs';
23
+ import { CREATE_RME_CASE_ESCALATION, } from '../../../graphql';
24
+ import { GET_CASE_COMMENTS, useCreateCaseComment } from '../../../hooks/useCaseComments';
22
25
  import { ESCALATION_SUBJECT_LENGTH_LIMIT } from '../../../reducers/CaseConstNTypes';
23
26
  import { fetchCaseEscalations } from '../../../reducers/CaseDetailsPageReducer';
24
- import { updateDiscussionStateComments } from '../../../reducers/CaseDiscussionTabReducer';
25
- import { checkForCaseStatusToggleOnAttachOrComment, fetchCaseDetails } from '../../../reducers/CaseReducer';
27
+ import { checkForCaseStatusToggleOnAttachOrComment, setCaseAccountNumber } from '../../../reducers/CaseReducer';
26
28
  const customerGEOKeys = Object.keys(CustomerGEOs);
27
29
  export function RequestEscalationModal(props) {
28
- const { globalMetadataState: { loggedInUser, loggedInUserRights }, } = useGlobalStateContext();
30
+ const { globalMetadataState: { loggedInUserRights }, } = useGlobalStateContext();
29
31
  const { t } = useTranslation();
32
+ const apolloClient = useApolloClient();
30
33
  const [categories, setCategories] = useState([]);
31
34
  const initialState = {
32
35
  subject: '',
@@ -42,17 +45,13 @@ export function RequestEscalationModal(props) {
42
45
  // checks if all the fields have values.
43
46
  const hasRequiredInfo = () => Object.keys(formState).reduce((accumulator, currentValue) => { var _a; return !accumulator ? accumulator : formState[currentValue].length > 0 && ((_a = formState[currentValue]) === null || _a === void 0 ? void 0 : _a.trim()); }, true);
44
47
  const setFormStateValue = (key, value) => setFormState((pre) => (Object.assign(Object.assign({}, pre), { [key]: value })));
45
- const createEscalationFetch = useFetch(escalations.createIceEscalation, { propgateErrors: true });
46
- const { request: postCommentRequest, isFetching: isPostingComment } = useFetch(publicApi.kase.postComment, {
47
- propgateErrors: true,
48
- });
49
- const { request: updateCaseRequest, isFetching: isUpdatingCase } = useFetch(publicApi.kase.updateCase);
48
+ const [isCreatingEscalation, setIsCreatingEscalation] = useState(false);
49
+ const { createComment, loading: isPostingComment } = useCreateCaseComment();
50
50
  const { request: getRmeCategories, isFetching: isCategoriesFetching } = useFetch(escalations.getEscalationCategories, { propgateErrors: true });
51
- const { sort, allDiscussions, discussionFiltersListState } = useCaseDiscussionTabStateContext();
52
- const dispatchDiscussion = useCaseDiscussionTabDispatchContext();
53
- const { caseDetailsPageState: { caseFeedbacksHydra }, } = useCaseDetailsPageStateContext();
51
+ const client = useApolloClient();
54
52
  const caseDetailsPageDispatch = useCaseDetailsPageDispatchContext();
55
53
  const caseDispatch = useCaseDispatch();
54
+ const caseSalesforceId = useCaseSelector((state) => state.caseDetails.id, isEqual);
56
55
  const [creationError, setCreationError] = useState(false);
57
56
  const onErrorClose = () => setCreationError(false);
58
57
  const setGeoState = (selection) => {
@@ -61,14 +60,13 @@ export function RequestEscalationModal(props) {
61
60
  const setCategoryState = (selection) => {
62
61
  setFormState(Object.assign(Object.assign({}, formState), { rmeCategory: selection.value }));
63
62
  };
64
- const submitEscalationComment = (escalationNum, comment) => __awaiter(this, void 0, void 0, function* () {
65
- escalationNum &&
66
- fetchCaseEscalations(caseDetailsPageDispatch, props.caseNumber, loggedInUserRights.data.getAccountNumber(), false);
67
- yield postCommentRequest({ caseNumber: props.caseNumber, commentBody: comment, contentType: 'markdown' });
68
- updateDiscussionStateComments(dispatchDiscussion, caseDispatch, props.caseNumber, allDiscussions, sort, caseFeedbacksHydra.data, discussionFiltersListState);
69
- yield updateCaseRequest(props.caseNumber, { customerEscalation: true });
63
+ const submitEscalationComment = (escalationNum, comment, caseId) => __awaiter(this, void 0, void 0, function* () {
64
+ escalationNum && fetchCaseEscalations(caseDetailsPageDispatch, caseSalesforceId, apolloClient, false);
65
+ yield createComment({ caseId, body: comment, isPublic: true });
66
+ client.refetchQueries({ include: [GET_CASE_COMMENTS] });
67
+ // await updateCaseRequest(props.caseNumber, { customerEscalation: true });
70
68
  checkForCaseStatusToggleOnAttachOrComment(caseDispatch, loggedInUserRights.data.isInternal(), props.caseStatus);
71
- yield fetchCaseDetails(caseDispatch, props.caseNumber, loggedInUserRights.data, loggedInUser.data);
69
+ yield fetchCaseDetails((action) => caseDispatch(action), apolloClient, props.caseNumber, setCaseAccountNumber);
72
70
  escalationNum &&
73
71
  ToastNotification.addSuccessMessage(t('Your escalation request has been successfully submitted.'));
74
72
  });
@@ -78,7 +76,7 @@ export function RequestEscalationModal(props) {
78
76
  setFormState(Object.assign(Object.assign({}, formState), { subject }));
79
77
  };
80
78
  const onCancel = () => {
81
- if (isPostingComment || isUpdatingCase || createEscalationFetch.isFetching)
79
+ if (isPostingComment || isCreatingEscalation)
82
80
  return;
83
81
  setSubmitSaveButtonIsClicked(false);
84
82
  setFormState(initialState);
@@ -86,11 +84,32 @@ export function RequestEscalationModal(props) {
86
84
  props.onClose();
87
85
  };
88
86
  const onSubmit = () => __awaiter(this, void 0, void 0, function* () {
87
+ var _a, _b, _c, _d;
89
88
  setSubmitSaveButtonIsClicked(true);
90
89
  if (!hasRequiredInfo() || hasLargeSubject)
91
90
  return;
92
91
  try {
93
- const res = yield createEscalationFetch.request(Object.assign(Object.assign({}, formState), { recordType: 'Active Customer Escalation', escalationSource: 'RME Escalation', status: 'New', accountNumber: loggedInUserRights.data.getAccountNumber(), caseNumber: props.caseNumber, requestor: `${loggedInUser.data.firstName} ${loggedInUser.data.lastName}`, requestorEmail: loggedInUser.data.email, requestorPhone: loggedInUser.data.phone, alreadyEscalated: false, severity: props.severity ? props.severity.charAt(0) : '3' }));
92
+ setIsCreatingEscalation(true);
93
+ if (!caseSalesforceId)
94
+ throw new Error('Could not find parent case ID');
95
+ const { data: escalationData } = yield apolloClient.mutate({
96
+ mutation: CREATE_RME_CASE_ESCALATION,
97
+ variables: {
98
+ caseInput: {
99
+ Subject: formState.subject,
100
+ Description: formState.description,
101
+ Status: 'New',
102
+ Origin: 'Portal ACE',
103
+ Priority: props.severity ? `P${props.severity.charAt(0)}` : 'Medium',
104
+ Type: 'RME',
105
+ RecordTypeId: '012Ek00000JUtx5IAD',
106
+ ParentId: caseSalesforceId,
107
+ EscalationCategory__c: formState.rmeCategory,
108
+ ImpactOnUserOrBusiness__c: formState.businessImpactDescription,
109
+ },
110
+ },
111
+ });
112
+ const createdCaseNumber = (_d = (_c = (_b = (_a = escalationData === null || escalationData === void 0 ? void 0 : escalationData.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.CaseCreate) === null || _b === void 0 ? void 0 : _b.SalesforceSupportRecord) === null || _c === void 0 ? void 0 : _c.CaseNumber) === null || _d === void 0 ? void 0 : _d.value;
94
113
  const fullComment = t('### Request Management Escalation:\n\n**Subject**\n{{subject}}\n\n**Category**\n{{rmeCategory}}\n\n**Description**\n{{description}}\n\n**Expectations**\n{{expectations}}\n\n**Business Impact**\n{{businessImpactDescription}}', {
95
114
  category: formState.rmeCategory,
96
115
  subject: formState.subject,
@@ -100,7 +119,7 @@ export function RequestEscalationModal(props) {
100
119
  rmeCategory: formState.rmeCategory,
101
120
  });
102
121
  try {
103
- yield submitEscalationComment(res.name, fullComment);
122
+ yield submitEscalationComment(createdCaseNumber, fullComment, caseSalesforceId);
104
123
  }
105
124
  catch (e) {
106
125
  // silently fails, escalation is created but adding comment fails
@@ -108,9 +127,11 @@ export function RequestEscalationModal(props) {
108
127
  props.onClose();
109
128
  }
110
129
  catch (error) {
111
- //=> handle error
112
130
  setCreationError(true);
113
131
  }
132
+ finally {
133
+ setIsCreatingEscalation(false);
134
+ }
114
135
  });
115
136
  const header = (React.createElement(Title, { className: "pf-v6-u-mb-0", id: "custom-header-label", headingLevel: "h1" },
116
137
  React.createElement(Trans, null, "Request an escalation"),
@@ -191,10 +212,9 @@ export function RequestEscalationModal(props) {
191
212
  ? ValidatedOptions.error
192
213
  : ValidatedOptions.default, placeholder: t('Does your business impact change with this escalation? Please describe how it changed.'), id: "business-impact-input", value: formState.businessImpactDescription, "aria-label": t('Business impact'), resizeOrientation: "vertical" }))))),
193
214
  React.createElement(ModalFooter, null,
194
- React.createElement(Button, { key: "submit", variant: "primary", onClick: onSubmit, "data-tracking-id": "request-rme-submit", isDisabled: submitButtonIsClicked &&
195
- (isPostingComment || isUpdatingCase || createEscalationFetch.isFetching || !hasRequiredInfo()), "aria-label": t('Submit') },
196
- (isPostingComment || isUpdatingCase || createEscalationFetch.isFetching) && (React.createElement(LoadingIndicator, { key: "loading", isInline: true })),
215
+ React.createElement(Button, { key: "submit", variant: "primary", onClick: onSubmit, "data-tracking-id": "request-rme-submit", isDisabled: submitButtonIsClicked && (isPostingComment || isCreatingEscalation || !hasRequiredInfo()), "aria-label": t('Submit') },
216
+ (isPostingComment || isCreatingEscalation) && React.createElement(LoadingIndicator, { key: "loading", isInline: true }),
197
217
  ' ',
198
218
  t('Submit')),
199
- React.createElement(Button, { key: "cancel", variant: "link", onClick: onCancel, "data-tracking-id": "request-rme-cancel", isDisabled: createEscalationFetch.isFetching || isPostingComment || isUpdatingCase, "aria-label": t('Cancel') }, t('Cancel')))));
219
+ React.createElement(Button, { key: "cancel", variant: "link", onClick: onCancel, "data-tracking-id": "request-rme-cancel", isDisabled: isCreatingEscalation || isPostingComment, "aria-label": t('Cancel') }, t('Cancel')))));
200
220
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Case.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/Case.tsx"],"names":[],"mappings":"AAcA,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,qBAmPzC"}
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,qBA+PzC"}
@@ -7,8 +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 { useApolloClient } from '@apollo/client/react';
10
11
  import { CoverSpinner, ErrorBoundary, OverviewContentLoader, ToastNotification, useDocumentTitle, usePrevious, } from '@rh-support/components';
11
- import { GlobalMetadataStateContext, HostnameAwarenessModal } from '@rh-support/react-context';
12
+ import { fetchCaseDetails, GlobalMetadataStateContext, HostnameAwarenessModal } from '@rh-support/react-context';
12
13
  import { AbilityContext, CaseDetailsFields, resourceActions, resources } from '@rh-support/user-permissions';
13
14
  import { getUrlParsedParams, isValidCaseNumber } from '@rh-support/utils';
14
15
  import isEmpty from 'lodash/isEmpty';
@@ -19,8 +20,14 @@ import { Route, Switch, useLocation, useParams, useRouteMatch } from 'react-rout
19
20
  import { useCaseDispatch, useCaseSelector } from '../../context/CaseContext';
20
21
  import { useCaseDetailsPageDispatchContext } from '../../context/CaseDetailsPageContext';
21
22
  import { CaseReducerConstants } from '../../reducers/CaseConstNTypes';
22
- import { fetchAttachments, fetchCaseEscalations, fetchExternalTrackers, fetchFeedbacks, } from '../../reducers/CaseDetailsPageReducer';
23
- import { fetchCaseDetails, setCaseAccountNumber } from '../../reducers/CaseReducer';
23
+ import {
24
+ // TODO: Re-enable after GraphQL migration
25
+ // fetchAttachments,
26
+ fetchCaseEscalations,
27
+ // fetchExternalTrackers,
28
+ // fetchFeedbacks,
29
+ } from '../../reducers/CaseDetailsPageReducer';
30
+ import { setCaseAccountNumber } from '../../reducers/CaseReducer';
24
31
  import { CaseDetailsAside } from './CaseDetailsAside';
25
32
  import { CaseDetailsErrorMessage } from './CaseDetailsErrorMessage';
26
33
  import CaseDetailsModals from './CaseDetailsModals';
@@ -28,8 +35,9 @@ import { CaseDetailsTabs } from './CaseDetailsTabs';
28
35
  import CaseOverview from './CaseOverview';
29
36
  import { PDFContext } from './PDFContainer';
30
37
  export default function Case(props) {
31
- const { globalMetadataState: { loggedInUserRights, loggedInUsersAccount, loggedInUser }, } = useContext(GlobalMetadataStateContext);
38
+ const { globalMetadataState: { loggedInUserRights, loggedInUsersAccount }, } = useContext(GlobalMetadataStateContext);
32
39
  const caseDetailsPageDispatch = useCaseDetailsPageDispatchContext();
40
+ const apolloClient = useApolloClient();
33
41
  const { t } = useTranslation();
34
42
  // The `path` lets us build <Route> paths that are
35
43
  // relative to the parent route, while the `url` lets
@@ -43,8 +51,18 @@ export default function Case(props) {
43
51
  const canSeeFeedbackButtons = ability.can(resourceActions.PATCH, resources.CASE_DETAILS, CaseDetailsFields.CASE_DETAILS_FEEDBACK_BUTTONS);
44
52
  const canReadCase = ability.can(resourceActions.READ, resources.CASE_DETAILS);
45
53
  const canManageCase = ability.can(resourceActions.UPDATE, resources.CASE_DETAILS);
46
- const canSeeExternalTracker = ability.can(resourceActions.PATCH, resources.CASE_DETAILS, CaseDetailsFields.CASE_DETAILS_EXTERNAL_TRACKER);
47
- 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
+ // );
48
66
  const canSeeRMEs = ability.can(resourceActions.PATCH, resources.CASE_DETAILS, CaseDetailsFields.CASE_DETAILS_RMES);
49
67
  const { product, isFetchingCaseDetails, isFetchingCaseDetailsError, caseDetailsError, selectedAccountDetails } = useCaseSelector((state) => ({
50
68
  product: state.caseDetails.product,
@@ -79,6 +97,7 @@ export default function Case(props) {
79
97
  useEffect(() => {
80
98
  if (!isEmpty(loggedInUsersAccount.data) &&
81
99
  !isEmpty(selectedAccountDetails.data) &&
100
+ selectedAccountDetails.data.accountNumber &&
82
101
  loggedInUserRights.data.isAccountSameAsLoggedInAccount(selectedAccountDetails.data.accountNumber) &&
83
102
  !isEqual(loggedInUsersAccount.data, selectedAccountDetails.data)) {
84
103
  setCaseAccountNumber(caseDispatch, loggedInUsersAccount.data.accountNumber, true, loggedInUsersAccount.data);
@@ -107,21 +126,34 @@ export default function Case(props) {
107
126
  caseDispatch(action);
108
127
  }
109
128
  };
110
- yield fetchCaseDetails(safeDispatch, targetCaseNumber, loggedInUserRights.data, loggedInUser.data);
129
+ const caseDetails = yield fetchCaseDetails(safeDispatch, apolloClient, targetCaseNumber, setCaseAccountNumber);
111
130
  if (currentCaseRef.current !== targetCaseNumber)
112
131
  return;
113
- if (canSeeRMEs) {
114
- fetchCaseEscalations((action) => currentCaseRef.current === targetCaseNumber && caseDetailsPageDispatch(action), targetCaseNumber, loggedInUserRights.data.getAccountNumber());
115
- }
116
- if (canSeeAttachments) {
117
- fetchAttachments((action) => currentCaseRef.current === targetCaseNumber && caseDetailsPageDispatch(action), targetCaseNumber, loggedInUsersAccount.data.secureSupport);
118
- }
119
- if (canSeeExternalTracker) {
120
- fetchExternalTrackers((action) => currentCaseRef.current === targetCaseNumber && caseDetailsPageDispatch(action), targetCaseNumber);
121
- }
122
- if (canSeeFeedbackButtons) {
123
- fetchFeedbacks((action) => currentCaseRef.current === targetCaseNumber && caseDetailsPageDispatch(action), targetCaseNumber);
132
+ if (canSeeRMEs && (caseDetails === null || caseDetails === void 0 ? void 0 : caseDetails.id)) {
133
+ fetchCaseEscalations((action) => currentCaseRef.current === targetCaseNumber && caseDetailsPageDispatch(action), caseDetails.id, apolloClient);
124
134
  }
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
+ // }
125
157
  if (currentCaseRef.current === targetCaseNumber) {
126
158
  checkRemoteSessionFlag();
127
159
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CaseDetailsAside.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/CaseDetailsAside.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAYhF,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;CACtB;AAMD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,qBAyY7C"}
1
+ {"version":3,"file":"CaseDetailsAside.d.ts","sourceRoot":"","sources":["../../../../src/components/CaseEditView/CaseDetailsAside.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAahF,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;CACtB;AAMD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,qBA2Z7C"}