@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,21 +7,34 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ var __rest = (this && this.__rest) || function (s, e) {
11
+ var t = {};
12
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
+ t[p] = s[p];
14
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
+ t[p[i]] = s[p[i]];
18
+ }
19
+ return t;
20
+ };
10
21
  import { accounts, contacts, kase, pcm, publicApi } from '@cee-eng/hydrajs';
11
22
  import { formattedApiErrorMessage } from '@rh-support/components';
12
- import { dtmTrackEventCaseCreationStepEncountered, getApiResourceObject, PreviousToNewCaseTypeMap, } from '@rh-support/utils';
13
- import delay from 'lodash/delay';
23
+ import { CREATE_SUPPORT_CASE, dtmTrackEventCaseCreationStepEncountered, fetchCaseDetailsByCaseNumber, GET_ACCOUNT, GET_CASE_GROUP, GET_PRODUCTS, getAccountQueryVariables, getApiResourceObject, handleGraphQLAccountResponse, handleGraphQLVersionsResponse, mapGraphQLCaseDetailsToCasePayload, PreviousToNewCaseTypeMap, updateCaseDetailsGraphQLRequest, } from '@rh-support/utils';
24
+ // import delay from 'lodash/delay';
14
25
  import filter from 'lodash/filter';
15
26
  import find from 'lodash/find';
16
27
  import isEmpty from 'lodash/isEmpty';
17
28
  import isUndefined from 'lodash/isUndefined';
18
29
  import map from 'lodash/map';
30
+ import unescape from 'lodash/unescape';
19
31
  import uniq from 'lodash/uniq';
20
32
  import uniqBy from 'lodash/uniqBy';
21
33
  import { trimAndReplacePlus } from '../components/shared/utils';
22
34
  import { CaseReducerConstants, DESCRIPTION_LENGTH_LIMIT, initialCaseState, SupportLevelDisplay, } from './CaseConstNTypes';
23
- import { createCasePayload, getCaseFromSessionDetails, getCaseRecommendations, getCepCommentFromCepDetails, getHasInvalidEntitlements, getProcessedEntitlements, } from './CaseHelpers';
35
+ import { createCasePayload, createCasePayloadGraphQL, getCaseFromSessionDetails, getCaseRecommendations, getCepCommentFromCepDetails, getHasInvalidEntitlements, getProcessedEntitlements, } from './CaseHelpers';
24
36
  import { updateSession } from './SessionRestoreReducer';
37
+ const safeDecodeGroupName = (value) => unescape(value);
25
38
  export const caseReducer = (pState, action) => {
26
39
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
27
40
  switch (action.type) {
@@ -29,17 +42,20 @@ export const caseReducer = (pState, action) => {
29
42
  const hasLargeCaseDescription = action.payload.caseDetails.hasOwnProperty('description')
30
43
  ? (action.payload.caseDetails.description || '').length > DESCRIPTION_LENGTH_LIMIT
31
44
  : pState.hasLargeCaseDescription;
45
+ let resetEntitlementId = false;
32
46
  if (((_b = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.caseDetails) === null || _b === void 0 ? void 0 : _b.contactSSOName) &&
33
47
  pState.caseDetails.contactSSOName !== ((_d = (_c = action.payload) === null || _c === void 0 ? void 0 : _c.caseDetails) === null || _d === void 0 ? void 0 : _d.contactSSOName)) {
34
48
  // Need to reset casegroup and sla as they are dependent on selected owner
35
49
  action.payload.caseDetails.entitlementSla = undefined;
50
+ resetEntitlementId = true;
36
51
  }
37
52
  if (((_f = (_e = action.payload) === null || _e === void 0 ? void 0 : _e.caseDetails) === null || _f === void 0 ? void 0 : _f.product) &&
38
53
  pState.caseDetails.product !== ((_h = (_g = action.payload) === null || _g === void 0 ? void 0 : _g.caseDetails) === null || _h === void 0 ? void 0 : _h.product)) {
39
54
  // need to reset sla on product change as individiual products can have independent sla
40
55
  action.payload.caseDetails.entitlementSla = undefined;
56
+ resetEntitlementId = true;
41
57
  }
42
- return Object.assign(Object.assign({}, pState), { hasLargeCaseDescription, caseDetails: Object.assign(Object.assign({}, pState.caseDetails), action.payload.caseDetails), isCaseUpdating: false });
58
+ return Object.assign(Object.assign(Object.assign({}, pState), { hasLargeCaseDescription, caseDetails: Object.assign(Object.assign({}, pState.caseDetails), action.payload.caseDetails), isCaseUpdating: false }), (resetEntitlementId ? { selectedEntitlementId: undefined } : {}));
43
59
  }
44
60
  case CaseReducerConstants.caseStateChanged: {
45
61
  return Object.assign(Object.assign({}, pState), action.payload);
@@ -89,10 +105,8 @@ export const caseReducer = (pState, action) => {
89
105
  return Object.assign(Object.assign(Object.assign({}, pState), initialCaseState), { isFetchingCaseDetails: true, isFetchingCaseDetailsError: false, caseDetails: Object.assign(Object.assign({}, initialCaseState.caseDetails), { caseNumber: (_l = (_k = (_j = action.payload) === null || _j === void 0 ? void 0 : _j.caseDetails) === null || _k === void 0 ? void 0 : _k.caseNumber) !== null && _l !== void 0 ? _l : '' }) });
90
106
  }
91
107
  case CaseReducerConstants.receivedCaseDetails: {
92
- return Object.assign(Object.assign(Object.assign({}, pState), action.payload), { isFetchingCaseDetails: false, isFetchingCaseDetailsError: false });
93
- }
94
- case CaseReducerConstants.updateComments: {
95
- return Object.assign(Object.assign({}, pState), { caseDetails: Object.assign(Object.assign({}, pState.caseDetails), { comments: action.payload.caseDetails.comments }) });
108
+ const _m = action.payload, { caseDetails, selectedOwner } = _m, rest = __rest(_m, ["caseDetails", "selectedOwner"]);
109
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, pState), rest), (selectedOwner ? { selectedOwner } : {})), { caseDetails: Object.assign(Object.assign({}, pState.caseDetails), caseDetails), isFetchingCaseDetails: false, isFetchingCaseDetailsError: false });
96
110
  }
97
111
  case CaseReducerConstants.receivedCaseDetailsError: {
98
112
  return Object.assign(Object.assign({}, pState), { isFetchingCaseDetails: false, isFetchingCaseDetailsError: true, caseDetailsError: action.payload.caseDetailsError });
@@ -167,15 +181,23 @@ export const setNotifiedUser = (dispatch, selectedNotificationContacts) => {
167
181
  payload: { selectedNotificationContacts },
168
182
  });
169
183
  };
170
- export const submitCase = (dispatch_1, sessionRestoreDispatch_1, caseDetails_1, isCaseCreate_1, errorMessage500_1, loggedInUserSsoUsername_1, ...args_1) => __awaiter(void 0, [dispatch_1, sessionRestoreDispatch_1, caseDetails_1, isCaseCreate_1, errorMessage500_1, loggedInUserSsoUsername_1, ...args_1], void 0, function* (dispatch, sessionRestoreDispatch, caseDetails, isCaseCreate, errorMessage500, loggedInUserSsoUsername, isSecureSupport = false, isResubmit, isCreatingCaseFlow, sessionItem) {
171
- var _a, _b;
184
+ export const submitCase = (dispatch_1, sessionRestoreDispatch_1, caseDetails_1, isCaseCreate_1, errorMessage500_1, loggedInUserSsoUsername_1, ...args_1) => __awaiter(void 0, [dispatch_1, sessionRestoreDispatch_1, caseDetails_1, isCaseCreate_1, errorMessage500_1, loggedInUserSsoUsername_1, ...args_1], void 0, function* (dispatch, sessionRestoreDispatch, caseDetails, isCaseCreate, errorMessage500, loggedInUserSsoUsername, isSecureSupport = false, isResubmit, isCreatingCaseFlow, sessionItem, apolloClient) {
185
+ var _a, _b, _c, _d, _e, _f;
172
186
  dispatch({ type: CaseReducerConstants.isCreatingCase });
173
187
  try {
174
188
  const casePayload = createCasePayload(caseDetails, sessionItem, isCaseCreate);
189
+ const graphQLPayload = createCasePayloadGraphQL(caseDetails, sessionItem, isCaseCreate);
175
190
  dispatch({ type: CaseReducerConstants.resetCaseNoOfCreatedCase, payload: { caseNoOfCreatedCase: '' } });
176
- const caseNumber = yield publicApi.kase.createCase(casePayload, caseDetails.selectedAccountDetails.data.secureSupport);
191
+ const { data } = yield apolloClient.mutate({
192
+ mutation: CREATE_SUPPORT_CASE,
193
+ variables: {
194
+ caseInput: graphQLPayload,
195
+ },
196
+ });
197
+ const caseRecord = (_b = (_a = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.CaseCreate) === null || _b === void 0 ? void 0 : _b.SalesforceSupportRecord;
198
+ const caseNumber = (_c = caseRecord === null || caseRecord === void 0 ? void 0 : caseRecord.CaseNumber) === null || _c === void 0 ? void 0 : _c.value;
177
199
  if (casePayload.contactSSOName === loggedInUserSsoUsername &&
178
- !isEmpty((_a = casePayload.phoneAreaCodePrefixLineNumber) === null || _a === void 0 ? void 0 : _a.trim()) &&
200
+ !isEmpty((_d = casePayload.phoneAreaCodePrefixLineNumber) === null || _d === void 0 ? void 0 : _d.trim()) &&
179
201
  !isEmpty(trimAndReplacePlus((casePayload === null || casePayload === void 0 ? void 0 : casePayload.phoneCountryCode) || ''))) {
180
202
  contacts.updateContactBySSO(casePayload.contactSSOName, {
181
203
  supportPhoneCountryCode: casePayload.phoneCountryCode,
@@ -184,7 +206,7 @@ export const submitCase = (dispatch_1, sessionRestoreDispatch_1, caseDetails_1,
184
206
  }
185
207
  // For updating the sessions and posting cep details after case creation
186
208
  postCaseCreationProcessing(isSecureSupport, dispatch, sessionRestoreDispatch, caseNumber, caseDetails, sessionItem);
187
- dtmTrackEventCaseCreationStepEncountered(isCreatingCaseFlow, 'Submit', false, caseNumber, PreviousToNewCaseTypeMap[(_b = caseDetails.caseDetails) === null || _b === void 0 ? void 0 : _b.caseType], caseDetails.caseDetails.summary, caseDetails.caseDetails.product, caseDetails.caseDetails.version);
209
+ dtmTrackEventCaseCreationStepEncountered(isCreatingCaseFlow, 'Submit', false, caseNumber, PreviousToNewCaseTypeMap[(_e = caseDetails.caseDetails) === null || _e === void 0 ? void 0 : _e.caseType], (_f = caseDetails.caseDetails.summary) !== null && _f !== void 0 ? _f : undefined, caseDetails.caseDetails.product, caseDetails.caseDetails.version);
188
210
  dispatch({ type: CaseReducerConstants.caseCreated, payload: { caseNoOfCreatedCase: caseNumber } });
189
211
  }
190
212
  catch (error) {
@@ -376,8 +398,8 @@ export const clearSelectedAccount = (dispatch) => {
376
398
  payload: { caseDetails: { accountNumberRef: '' } },
377
399
  });
378
400
  };
379
- export const setCaseAccountNumber = (dispatch_1, accountNumber_1, ...args_1) => __awaiter(void 0, [dispatch_1, accountNumber_1, ...args_1], void 0, function* (dispatch, accountNumber, isLoggedInUsersAccount = false, loggedInUserAccount = {}) {
380
- var _a;
401
+ export const setCaseAccountNumber = (dispatch_1, accountNumber_1, ...args_1) => __awaiter(void 0, [dispatch_1, accountNumber_1, ...args_1], void 0, function* (dispatch, accountNumber, isLoggedInUsersAccount = false, loggedInUserAccount = {}, apolloClient) {
402
+ var _a, _b, _c, _d, _e;
381
403
  if (isLoggedInUsersAccount && !isEmpty(loggedInUserAccount) && !isEmpty(accountNumber)) {
382
404
  dispatch({
383
405
  type: CaseReducerConstants.caseStateChanged,
@@ -410,7 +432,12 @@ export const setCaseAccountNumber = (dispatch_1, accountNumber_1, ...args_1) =>
410
432
  payload: { selectedAccountDetails: getApiResourceObject({}, true) },
411
433
  });
412
434
  try {
413
- const selectedAccountDetails = yield accounts.getAccount(accountNumber);
435
+ const { data } = yield apolloClient.query({
436
+ query: GET_ACCOUNT,
437
+ variables: getAccountQueryVariables(accountNumber),
438
+ });
439
+ const edges = (_e = (_d = (_c = (_b = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _b === void 0 ? void 0 : _b.query) === null || _c === void 0 ? void 0 : _c.SalesforceSupportAccount) === null || _d === void 0 ? void 0 : _d.edges) !== null && _e !== void 0 ? _e : [];
440
+ const selectedAccountDetails = handleGraphQLAccountResponse(edges);
414
441
  dispatch({
415
442
  type: CaseReducerConstants.caseStateChanged,
416
443
  payload: { selectedAccountDetails: getApiResourceObject(selectedAccountDetails) },
@@ -434,7 +461,7 @@ export const fetchCaseGroupsForAccount = (dispatch_1, accountNumber_1, ...args_1
434
461
  (response || []).sort((a, b) => a.name.localeCompare(b.name));
435
462
  const defaultCaseGroup = (_b = (!isEmpty(caseGroupNumberToRestore)
436
463
  ? caseGroupNumberToRestore
437
- : (_a = find(response, (g) => g.isDefault)) === null || _a === void 0 ? void 0 : _a.groupNum)) !== null && _b !== void 0 ? _b : '-1';
464
+ : (_a = find(response, (g) => g.isDefault)) === null || _a === void 0 ? void 0 : _a.groupNum)) !== null && _b !== void 0 ? _b : null;
438
465
  dispatch({
439
466
  type: CaseReducerConstants.caseStateChanged,
440
467
  payload: { ownersCaseGroups: getApiResourceObject(response, false) },
@@ -446,7 +473,7 @@ export const fetchCaseGroupsForAccount = (dispatch_1, accountNumber_1, ...args_1
446
473
  type: CaseReducerConstants.caseStateChanged,
447
474
  payload: { ownersCaseGroups: getApiResourceObject([], false, true, e.message) },
448
475
  });
449
- setCaseGroupToUngroupedOrDefault && setCaseDetails(dispatch, { groupNumber: '-1' });
476
+ setCaseGroupToUngroupedOrDefault && setCaseDetails(dispatch, { groupNumber: null });
450
477
  }
451
478
  });
452
479
  export const setCaseOwner = (dispatch_1, owner_1, product_1, abortSignalCaseGroup_1, abortSignalEntitlements_1, ...args_1) => __awaiter(void 0, [dispatch_1, owner_1, product_1, abortSignalCaseGroup_1, abortSignalEntitlements_1, ...args_1], void 0, function* (dispatch, owner, product, abortSignalCaseGroup, abortSignalEntitlements, setCaseGroupToUngroupedOrDefault = false, caseGroupNumberToRestore, canChangeGroup = true, isUserUpdate, caseNumber, caseAccountNumber) {
@@ -462,7 +489,7 @@ export const setCaseOwner = (dispatch_1, owner_1, product_1, abortSignalCaseGrou
462
489
  },
463
490
  },
464
491
  });
465
- setCaseGroupToUngroupedOrDefault && setCaseDetails(dispatch, { groupNumber: '-1' });
492
+ setCaseGroupToUngroupedOrDefault && setCaseDetails(dispatch, { groupNumber: null });
466
493
  dispatch({
467
494
  type: CaseReducerConstants.caseStateChanged,
468
495
  payload: {
@@ -475,23 +502,25 @@ export const setCaseOwner = (dispatch_1, owner_1, product_1, abortSignalCaseGrou
475
502
  }
476
503
  dispatch({
477
504
  type: CaseReducerConstants.caseStateChanged,
478
- payload: { selectedOwner: getApiResourceObject(owner) },
505
+ payload: { selectedOwner: getApiResourceObject(owner), hasInvalidEntitlements: false },
479
506
  });
480
507
  dispatch({
481
508
  type: CaseReducerConstants.caseDetailChanged,
482
509
  payload: { caseDetails: { contactSSOName: owner.ssoUsername } },
483
510
  });
484
- if (canChangeGroup) {
485
- if (caseAccountNumber) {
486
- fetchCaseGroupsForAccount(dispatch, caseAccountNumber, setCaseGroupToUngroupedOrDefault, abortSignalCaseGroup, caseGroupNumberToRestore);
487
- }
488
- else {
489
- fetchCaseGroupsForSSO(dispatch, owner.ssoUsername, setCaseGroupToUngroupedOrDefault, abortSignalCaseGroup, caseGroupNumberToRestore);
490
- }
491
- }
492
- delay(() => __awaiter(void 0, void 0, void 0, function* () {
493
- return yield fetchCaseEntitlements(dispatch, owner.ssoUsername, product, abortSignalEntitlements, isUserUpdate, caseNumber);
494
- }), 5000, 'later');
511
+ // delay(
512
+ // async () =>
513
+ // await fetchCaseEntitlements(
514
+ // dispatch,
515
+ // owner.ssoUsername!,
516
+ // product,
517
+ // abortSignalEntitlements,
518
+ // isUserUpdate,
519
+ // caseNumber
520
+ // ),
521
+ // 5000,
522
+ // 'later'
523
+ // );
495
524
  });
496
525
  //changing the item values to uppercase to match the backend values
497
526
  const slaOrder = Object.values(SupportLevelDisplay).map((item) => {
@@ -554,7 +583,7 @@ export const fetchCaseGroupsForSSO = (dispatch_1, contactSsoUsername_1, ...args_
554
583
  (response || []).sort((a, b) => a.name.localeCompare(b.name));
555
584
  const defaultCaseGroup = (_b = (!isEmpty(caseGroupNumberToRestore)
556
585
  ? caseGroupNumberToRestore
557
- : (_a = find(response, (g) => g.isDefault)) === null || _a === void 0 ? void 0 : _a.groupNum)) !== null && _b !== void 0 ? _b : '-1';
586
+ : (_a = find(response, (g) => g.isDefault)) === null || _a === void 0 ? void 0 : _a.groupNum)) !== null && _b !== void 0 ? _b : null;
558
587
  dispatch({
559
588
  type: CaseReducerConstants.caseStateChanged,
560
589
  payload: { ownersCaseGroups: getApiResourceObject(response, false) },
@@ -566,18 +595,69 @@ export const fetchCaseGroupsForSSO = (dispatch_1, contactSsoUsername_1, ...args_
566
595
  type: CaseReducerConstants.caseStateChanged,
567
596
  payload: { ownersCaseGroups: getApiResourceObject([], false, true, e.message) },
568
597
  });
569
- setCaseGroupToUngroupedOrDefault && setCaseDetails(dispatch, { groupNumber: '-1' });
598
+ setCaseGroupToUngroupedOrDefault && setCaseDetails(dispatch, { groupNumber: null });
599
+ }
600
+ });
601
+ export const fetchCaseGroupsForContactGraphQL = (dispatch_1, apolloClient_1, contactId_1, accountNumber_1, defaultCaseGroupId_1, ...args_1) => __awaiter(void 0, [dispatch_1, apolloClient_1, contactId_1, accountNumber_1, defaultCaseGroupId_1, ...args_1], void 0, function* (dispatch, apolloClient, contactId, accountNumber, defaultCaseGroupId, isOrgAdmin = false, currentGroupNumber) {
602
+ var _a, _b, _c, _d;
603
+ dispatch({
604
+ type: CaseReducerConstants.caseStateChanged,
605
+ payload: { ownersCaseGroups: getApiResourceObject([], true) },
606
+ });
607
+ try {
608
+ const { data } = yield apolloClient.query({
609
+ query: GET_CASE_GROUP,
610
+ });
611
+ const response = data;
612
+ const allGroups = (_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.SalesforceSupportCaseGroup__c) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
613
+ const matchedGroups = allGroups
614
+ .filter(({ node }) => isOrgAdmin ||
615
+ node.CaseGroupMembers__r.edges.some(({ node: member }) => member.Contact__c.value === contactId))
616
+ .map(({ node }) => ({
617
+ groupId: node.Id,
618
+ groupName: safeDecodeGroupName(node.Name.value),
619
+ }))
620
+ .sort((a, b) => a.groupName.localeCompare(b.groupName));
621
+ const ownersCaseGroups = matchedGroups.map((g) => ({
622
+ groupNum: g.groupId,
623
+ name: g.groupName,
624
+ isDefault: defaultCaseGroupId ? g.groupId === defaultCaseGroupId : false,
625
+ isPrivate: false,
626
+ defaultMembers: [],
627
+ members: [],
628
+ }));
629
+ dispatch({
630
+ type: CaseReducerConstants.caseStateChanged,
631
+ payload: { ownersCaseGroups: getApiResourceObject(ownersCaseGroups, false) },
632
+ });
633
+ const defaultGroup = defaultCaseGroupId ? matchedGroups.find((g) => g.groupId === defaultCaseGroupId) : null;
634
+ if (currentGroupNumber === '') {
635
+ // User explicitly cleared the group — don't auto-select
636
+ }
637
+ else if (!currentGroupNumber) {
638
+ if (defaultGroup) {
639
+ setCaseDetails(dispatch, { groupNumber: defaultGroup.groupId, groupName: defaultGroup.groupName });
640
+ }
641
+ }
642
+ return matchedGroups;
643
+ }
644
+ catch (e) {
645
+ dispatch({
646
+ type: CaseReducerConstants.caseStateChanged,
647
+ payload: { ownersCaseGroups: getApiResourceObject([], false, true, e.message) },
648
+ });
649
+ return [];
570
650
  }
571
651
  });
572
652
  const getSelectedNotificationContactsFromSession = (contacts, notifiedUsers) => {
573
653
  return filter(contacts, (c) => notifiedUsers.includes(c.ssoUsername));
574
654
  };
575
- export const updateCaseWithSession = (dispatch_1, sessionItem_1, loggedInUserAccountNumber_1, loggedInUserContact_1, ...args_1) => __awaiter(void 0, [dispatch_1, sessionItem_1, loggedInUserAccountNumber_1, loggedInUserContact_1, ...args_1], void 0, function* (dispatch, sessionItem, loggedInUserAccountNumber, loggedInUserContact, loggedInUserAccount = {}) {
655
+ export const updateCaseWithSession = (dispatch_1, sessionItem_1, loggedInUserAccountNumber_1, loggedInUserContact_1, ...args_1) => __awaiter(void 0, [dispatch_1, sessionItem_1, loggedInUserAccountNumber_1, loggedInUserContact_1, ...args_1], void 0, function* (dispatch, sessionItem, loggedInUserAccountNumber, loggedInUserContact, loggedInUserAccount = {}, apolloClient) {
576
656
  var _a, _b, _c, _d;
577
657
  const caseDetails = getCaseFromSessionDetails(sessionItem, loggedInUserAccountNumber, loggedInUserContact.ssoUsername);
578
658
  const { sessionDetails } = sessionItem;
579
659
  setCaseDetails(dispatch, caseDetails);
580
- setCaseAccountNumber(dispatch, caseDetails.accountNumberRef, caseDetails.accountNumberRef === loggedInUserAccountNumber, loggedInUserAccount);
660
+ setCaseAccountNumber(dispatch, caseDetails.accountNumberRef, caseDetails.accountNumberRef === loggedInUserAccountNumber, loggedInUserAccount, apolloClient);
581
661
  // entitlementSla gets undefined when case group, owner or product is changed
582
662
  // Please refer line 60
583
663
  if (isUndefined(caseDetails.entitlementSla)) {
@@ -637,12 +717,13 @@ const getAllRelevantContacts = (loggedInUserContact, caseAccountNumber, contactS
637
717
  return uniqBy(contactsToReturn, 'ssoUsername');
638
718
  }
639
719
  });
640
- export const fetchCaseDetails = (dispatch, caseNumber, loggedInUserRights, loggedInUser) => __awaiter(void 0, void 0, void 0, function* () {
720
+ export const fetchCaseDetailsHydra = (dispatch, caseNumber, loggedInUserRights, loggedInUser, apolloClient) => __awaiter(void 0, void 0, void 0, function* () {
641
721
  var _a, _b;
642
722
  dispatch({ type: CaseReducerConstants.requestCaseDetails, payload: { caseDetails: { caseNumber } } });
643
723
  try {
644
724
  const data = yield publicApi.kase.getCase(caseNumber);
645
725
  const caseDetails = {
726
+ id: data.id,
646
727
  product: data.product,
647
728
  version: data.version,
648
729
  summary: data.summary,
@@ -664,7 +745,7 @@ export const fetchCaseDetails = (dispatch, caseNumber, loggedInUserRights, logge
664
745
  createdDate: data.createdDate,
665
746
  createdById: data.createdById,
666
747
  alternateId: data.alternateId,
667
- groupNumber: data.groupNumber || '-1', //Explicitly assigning folderNumber = '-1' for ungrouped case when case payload has no group information
748
+ groupNumber: data.groupNumber || null,
668
749
  caseNumber: data.caseNumber,
669
750
  hostname: data.hostname,
670
751
  contactInfo24x7: data.contactInfo24x7,
@@ -676,7 +757,7 @@ export const fetchCaseDetails = (dispatch, caseNumber, loggedInUserRights, logge
676
757
  sbrGroups: (data === null || data === void 0 ? void 0 : data.sbrGroups) || [],
677
758
  firstCaseInactivityWarningSentAt: (data === null || data === void 0 ? void 0 : data.firstCaseInactivityWarningSentAt) || undefined,
678
759
  secondCaseInactivityWarningSentAt: (data === null || data === void 0 ? void 0 : data.secondCaseInactivityWarningSentAt) || undefined,
679
- groupName: data.groupName || '',
760
+ groupName: safeDecodeGroupName(data.groupName || ''),
680
761
  remoteSessionTermsAcked: (_a = data.remoteSessionTermsAcked) !== null && _a !== void 0 ? _a : false,
681
762
  noClusterIdReason: data.noClusterIdReason || '',
682
763
  noClusterIdReasonExplanation: data.noClusterIdReasonExplanation || '',
@@ -707,12 +788,10 @@ export const fetchCaseDetails = (dispatch, caseNumber, loggedInUserRights, logge
707
788
  caseNoOfCreatedCase: caseNumber,
708
789
  };
709
790
  dispatch({ type: CaseReducerConstants.receivedCaseDetails, payload: Object.assign(Object.assign({}, caseState), { caseDetails }) });
710
- setCaseAccountNumber(dispatch, data.accountNumberRef);
711
- const canChangeGroup = loggedInUserRights.isInternal() ||
712
- loggedInUser.isOrgAdmin ||
713
- loggedInUser.ssoUsername === caseDetails.contactSSOName ||
714
- loggedInUserRights.isPartnerOrgAdmin();
715
- setCaseOwner(dispatch, { ssoUsername: data.contactSSOName, fullNameCustom: data.contactName }, '', undefined, undefined, false, undefined, canChangeGroup, undefined, undefined, loggedInUserRights.isInternal() ? data.accountNumberRef : undefined);
791
+ setCaseAccountNumber(dispatch, data.accountNumberRef, false, {}, apolloClient);
792
+ // Owner is set by fetchCaseDetails (GraphQL) in Case.tsx via mapGraphQLCaseContactToOwnerState
793
+ // which already sets selectedOwner with id (contactId) from the case details query.
794
+ // The contact details are then enriched by CaseContactsSelectorExternal when the contacts list loads.
716
795
  const notifiedListUsers = map(data.notifiedUsers, (o) => ({
717
796
  ssoUsername: o.ssoUsername,
718
797
  fullNameCustom: o.title,
@@ -721,15 +800,22 @@ export const fetchCaseDetails = (dispatch, caseNumber, loggedInUserRights, logge
721
800
  type: CaseReducerConstants.setLoadedNotificationContacts,
722
801
  payload: { notifiedUsers: notifiedListUsers },
723
802
  });
724
- if (data.groupNumber && data.groupNumber !== '-1') {
803
+ if (data.groupNumber) {
725
804
  setSelectedCaseGroupUsers(dispatch, data.accountNumberRef, data.groupNumber, loggedInUserRights);
726
805
  }
727
- if (loggedInUserRights.isInternal() && !loggedInUserRights.isSecureSupportTech()) {
728
- getNotificationContacts4InternalUser(dispatch, notifiedListUsers, data.contactSSOName);
729
- }
730
- else {
731
- getNotificationContacts4ExternalUser(dispatch, notifiedListUsers, loggedInUserRights, data.accountNumberRef, data.contactSSOName, data.contactName);
732
- }
806
+ // TODO: Re-enable send notifications calls once GraphQL support is available
807
+ // if (loggedInUserRights.isInternal() && !loggedInUserRights.isSecureSupportTech()) {
808
+ // getNotificationContacts4InternalUser(dispatch, notifiedListUsers, data.contactSSOName);
809
+ // } else {
810
+ // getNotificationContacts4ExternalUser(
811
+ // dispatch,
812
+ // notifiedListUsers,
813
+ // loggedInUserRights,
814
+ // data.accountNumberRef,
815
+ // data.contactSSOName,
816
+ // data.contactName
817
+ // );
818
+ // }
733
819
  }
734
820
  catch (error) {
735
821
  dispatch({ type: CaseReducerConstants.receivedCaseDetailsError, payload: { caseDetailsError: error } });
@@ -753,7 +839,46 @@ export const updateCaseDetails = (dispatch, caseNumber, caseDetails, dontSetDeta
753
839
  }
754
840
  catch (error) {
755
841
  dispatch({ type: CaseReducerConstants.updateCaseDetailsError });
756
- return Promise.reject(error);
842
+ throw error;
843
+ }
844
+ });
845
+ export const updateCaseDetailsGraphQL = (dispatch, apolloClient, caseNumber, caseUpdate, dontSetDetails, options) => __awaiter(void 0, void 0, void 0, function* () {
846
+ var _a, _b;
847
+ try {
848
+ dispatch({ type: CaseReducerConstants.updateCaseDetailUpdating });
849
+ const salesforceCaseId = (_a = options === null || options === void 0 ? void 0 : options.salesforceCaseId) !== null && _a !== void 0 ? _a : (_b = options === null || options === void 0 ? void 0 : options.existingCaseDetails) === null || _b === void 0 ? void 0 : _b.id;
850
+ const graphqlDetails = yield updateCaseDetailsGraphQLRequest(apolloClient, caseNumber, caseUpdate, {
851
+ salesforceCaseId,
852
+ existingCaseDetails: (options === null || options === void 0 ? void 0 : options.existingCaseDetails)
853
+ ? {
854
+ product: options.existingCaseDetails.product,
855
+ version: options.existingCaseDetails.version,
856
+ }
857
+ : undefined,
858
+ });
859
+ if (dontSetDetails) {
860
+ dispatch({ type: CaseReducerConstants.updateCaseDetailCompleted });
861
+ return;
862
+ }
863
+ let updatedCaseDetails = Object.assign({}, caseUpdate);
864
+ if (graphqlDetails) {
865
+ const mappedGraphQLDetails = mapGraphQLCaseDetailsToCasePayload(graphqlDetails);
866
+ updatedCaseDetails = Object.assign(Object.assign({}, updatedCaseDetails), Object.fromEntries(Object.entries(mappedGraphQLDetails).filter(([, value]) => value !== null && value !== undefined && value !== '')));
867
+ }
868
+ else {
869
+ const refreshedDetails = yield fetchCaseDetailsByCaseNumber(apolloClient, caseNumber);
870
+ if (refreshedDetails) {
871
+ updatedCaseDetails = Object.assign(Object.assign({}, updatedCaseDetails), mapGraphQLCaseDetailsToCasePayload(refreshedDetails));
872
+ }
873
+ }
874
+ dispatch({
875
+ type: CaseReducerConstants.caseDetailChanged,
876
+ payload: { caseDetails: updatedCaseDetails, isCaseUpdating: false },
877
+ });
878
+ }
879
+ catch (error) {
880
+ dispatch({ type: CaseReducerConstants.updateCaseDetailsError });
881
+ throw error;
757
882
  }
758
883
  });
759
884
  export const getNotificationContacts4InternalUser = (dispatch, users, caseOwnerSSO) => __awaiter(void 0, void 0, void 0, function* () {
@@ -880,7 +1005,7 @@ export const setSelectedCaseGroupUsers = (dispatch, accountNumber, groupNumber,
880
1005
  const canUserChangeOwner = loggedInUserRights.isOrgAdmin() ||
881
1006
  (loggedInUserRights.isExternalNonOrgAdmin() &&
882
1007
  loggedInUserRights.isAccountDifferentFromLoggedInAccount(accountNumber));
883
- if (groupNumber === '-1' || !canUserChangeOwner) {
1008
+ if (!groupNumber || !canUserChangeOwner) {
884
1009
  dispatch({
885
1010
  type: CaseReducerConstants.caseStateChanged,
886
1011
  payload: { selectedCaseGroupUsers: getApiResourceObject([]) },
@@ -935,14 +1060,26 @@ export function updateEmailListState(dispatch, email, customEmailsList, callback
935
1060
  payload: { customEmailsList: Object.assign(Object.assign({}, customEmailsList), { data: newEmail }) },
936
1061
  });
937
1062
  }
938
- export function getVersionsDetails(dispatch, product) {
1063
+ export function getVersionsDetails(dispatch, apolloClient, parentProductId, parentProductName) {
939
1064
  return __awaiter(this, void 0, void 0, function* () {
1065
+ var _a, _b, _c, _d;
940
1066
  try {
941
1067
  dispatch({
942
1068
  type: CaseReducerConstants.getVersionDetails,
943
1069
  payload: { versionsDetails: getApiResourceObject([], true) },
944
1070
  });
945
- const versionsDetails = yield pcm.products.getDetailedVersions(product);
1071
+ const { data } = yield apolloClient.query({
1072
+ query: GET_PRODUCTS,
1073
+ variables: {
1074
+ where: {
1075
+ ParentProduct__c: { eq: parentProductId },
1076
+ IsActive: { eq: true },
1077
+ },
1078
+ first: 200,
1079
+ },
1080
+ });
1081
+ const edges = (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.SalesforceSupportProduct2) === null || _c === void 0 ? void 0 : _c.edges) !== null && _d !== void 0 ? _d : [];
1082
+ const versionsDetails = handleGraphQLVersionsResponse(edges, parentProductName);
946
1083
  dispatch({
947
1084
  type: CaseReducerConstants.getVersionDetails,
948
1085
  payload: { versionsDetails: getApiResourceObject(versionsDetails) },
@@ -0,0 +1,41 @@
1
+ export interface IHistoryChangeItem {
2
+ fieldName: string;
3
+ displayName?: string;
4
+ oldValue?: string | null;
5
+ newValue?: string | boolean | null;
6
+ createdByUserName?: string;
7
+ }
8
+ export declare const MULTI_SELECT_FIELDS: string[];
9
+ export declare const LANGUAGE_CODE_MAPPING: Record<string, string>;
10
+ /**
11
+ * Maps `displayName` values (from `normalizeNodeToHistoryItem`, not raw SF API names)
12
+ * to camelCase property prefixes used for hydrated lookup properties on history items.
13
+ * E.g. key `"Product"` → prefix `"product"` → looks up `productNewName`, `productOldName`.
14
+ */
15
+ export declare const KEY_MAP: Record<string, string>;
16
+ export declare const formatMultiSelectChange: (fieldName: string, oldValue: string, newValue: string) => string;
17
+ /**
18
+ * Generates human-readable text for a field change based on which values are present:
19
+ * - Both values present → "changed X from A to B" (multiselect fields get add/remove diffing)
20
+ * - Only newValue → "set X to B"
21
+ * - Only oldValue (newValue is undefined or empty) → "removed X, was A"
22
+ * - None of the above but `item.newValue` exists → fallback for cases where the resolved
23
+ * display string on the item differs from the `newValue` parameter passed in
24
+ */
25
+ export declare const formatDefaultChange: (item: IHistoryChangeItem, fieldName: string, oldValue: string, newValue: string) => string;
26
+ /**
27
+ * Field-specific formatting for history change text. Each case handles a SF field
28
+ * whose raw values need special treatment before display.
29
+ */
30
+ export declare const handleFieldChange: (item: IHistoryChangeItem, fieldName: string, oldValue: string, newValue: string) => string;
31
+ /**
32
+ * Post-processes formatted change text.
33
+ *
34
+ * - Boolean special case: SF boolean history entries can carry a raw `boolean` newValue
35
+ * even after `extractStringValue` stringifies it. When the item's `newValue` is still
36
+ * a boolean at this point, we generate dedicated text to avoid displaying "true"/"false".
37
+ * - String replacements remap legacy SF display names to current UI terminology
38
+ * ("Problem Statement" → "Title", "Case Type" → "Support Type").
39
+ */
40
+ export declare const applyPostProcessing: (text: string, item: IHistoryChangeItem) => string;
41
+ //# sourceMappingURL=TimelineUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimelineUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/TimelineUtils.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAMD,eAAO,MAAM,mBAAmB,UAAmB,CAAC;AAEpD,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAcxD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAY1C,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,WAAW,MAAM,EAAE,UAAU,MAAM,EAAE,UAAU,MAAM,KAAG,MAgB/F,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC5B,MAAM,kBAAkB,EACxB,WAAW,MAAM,EACjB,UAAU,MAAM,EAChB,UAAU,MAAM,KACjB,MAiBF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC1B,MAAM,kBAAkB,EACxB,WAAW,MAAM,EACjB,UAAU,MAAM,EAChB,UAAU,MAAM,KACjB,MA+BF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,EAAE,MAAM,kBAAkB,KAAG,MAM5E,CAAC"}
@@ -0,0 +1,134 @@
1
+ import { getFieldDisplayName } from './caseHistoryUtils';
2
+ // https://help.salesforce.com/s/articleView?id=000384484&type=1
3
+ // Adding in option for multiselect fields provided by salesforce.
4
+ // In future for more multiselect fields just add to below array.
5
+ // SF delimits multiselect picklist values with semicolons (`;`).
6
+ export const MULTI_SELECT_FIELDS = ['SBR_Group__c'];
7
+ export const LANGUAGE_CODE_MAPPING = {
8
+ de: 'German',
9
+ en: 'English',
10
+ es: 'Spanish',
11
+ fr: 'French',
12
+ it: 'Italian',
13
+ pt: 'Portuguese',
14
+ ko: 'Korean',
15
+ ja: 'Japanese',
16
+ zh: 'Chinese',
17
+ zh_CN: 'Chinese',
18
+ zh_HK: 'Chinese (Hong Kong)',
19
+ zh_TW: 'Chinese (Taiwan)',
20
+ ru: 'Russian',
21
+ };
22
+ /**
23
+ * Maps `displayName` values (from `normalizeNodeToHistoryItem`, not raw SF API names)
24
+ * to camelCase property prefixes used for hydrated lookup properties on history items.
25
+ * E.g. key `"Product"` → prefix `"product"` → looks up `productNewName`, `productOldName`.
26
+ */
27
+ export const KEY_MAP = {
28
+ Product: 'product',
29
+ Version: 'version',
30
+ Account: 'account',
31
+ Contact: 'contact',
32
+ Entitlement: 'entitlement',
33
+ 'Business Hours': 'businessHours',
34
+ Owner: 'queueNameOwner',
35
+ 'Customer Escalation': 'customerEscalation',
36
+ 'Case Group': 'caseGroup',
37
+ 'SLA Start Date': 'slaStartDate',
38
+ 'Case Language': 'caseLanguage',
39
+ };
40
+ export const formatMultiSelectChange = (fieldName, oldValue, newValue) => {
41
+ const oldValues = oldValue.split(';').map((s) => s.trim());
42
+ const newValues = newValue.split(';').map((s) => s.trim());
43
+ const added = newValues.filter((nv) => !oldValues.includes(nv));
44
+ const removed = oldValues.filter((ov) => !newValues.includes(ov));
45
+ if (added.length > 0 && removed.length === 0) {
46
+ return `added ${added.join(', ')} to ${fieldName}`;
47
+ }
48
+ if (removed.length > 0 && added.length === 0) {
49
+ return `removed ${removed.join(', ')} from ${fieldName}`;
50
+ }
51
+ if (added.length > 0 && removed.length > 0) {
52
+ return `changed ${fieldName}, added ${added.join(', ')} and removed ${removed.join(', ')}`;
53
+ }
54
+ return `changed ${fieldName} from ${oldValue} to ${newValue}`;
55
+ };
56
+ /**
57
+ * Generates human-readable text for a field change based on which values are present:
58
+ * - Both values present → "changed X from A to B" (multiselect fields get add/remove diffing)
59
+ * - Only newValue → "set X to B"
60
+ * - Only oldValue (newValue is undefined or empty) → "removed X, was A"
61
+ * - None of the above but `item.newValue` exists → fallback for cases where the resolved
62
+ * display string on the item differs from the `newValue` parameter passed in
63
+ */
64
+ export const formatDefaultChange = (item, fieldName, oldValue, newValue) => {
65
+ if (oldValue && newValue) {
66
+ if (MULTI_SELECT_FIELDS.includes(item.fieldName)) {
67
+ return formatMultiSelectChange(fieldName, oldValue, newValue);
68
+ }
69
+ return `changed ${fieldName} from ${oldValue} to ${newValue}`;
70
+ }
71
+ if (newValue) {
72
+ return `set ${fieldName} to ${newValue}`;
73
+ }
74
+ if (oldValue && (newValue === undefined || newValue === '')) {
75
+ return `removed ${fieldName}, was ${oldValue}`;
76
+ }
77
+ if (item.newValue !== undefined) {
78
+ return `set ${fieldName} to ${item.newValue}`;
79
+ }
80
+ return '';
81
+ };
82
+ /**
83
+ * Field-specific formatting for history change text. Each case handles a SF field
84
+ * whose raw values need special treatment before display.
85
+ */
86
+ export const handleFieldChange = (item, fieldName, oldValue, newValue) => {
87
+ var _a, _b;
88
+ switch (item.fieldName) {
89
+ // Raw values are ISO 639-1 language codes; expand via LANGUAGE_CODE_MAPPING.
90
+ case 'Case_Language__c': {
91
+ const newVal = String((_a = item.newValue) !== null && _a !== void 0 ? _a : '');
92
+ const oldVal = String((_b = item.oldValue) !== null && _b !== void 0 ? _b : '');
93
+ const newLanguage = LANGUAGE_CODE_MAPPING[newVal] || newVal;
94
+ const oldLanguage = LANGUAGE_CODE_MAPPING[oldVal] || oldVal;
95
+ return oldVal && newVal
96
+ ? `changed ${fieldName} from ${oldLanguage} to ${newLanguage}`
97
+ : `set ${fieldName} to ${newLanguage || 'empty'}`;
98
+ }
99
+ // Raw SFDC IDs were already filtered by filterSfdcIdEntries; this handles the
100
+ // resolved-name path and uses createdByUserName as the display value.
101
+ case 'OwnerId':
102
+ return item.createdByUserName ? `set ${fieldName} to ${item.createdByUserName}` : '';
103
+ case 'Status':
104
+ return item.oldValue && item.newValue
105
+ ? `changed ${fieldName} from ${item.oldValue} to ${item.newValue}`
106
+ : `set ${fieldName} to ${item.newValue || 'empty'}`;
107
+ // Boolean toggle → human sentence; only reports when a user name is available.
108
+ case 'Customer_Escalation__c':
109
+ return item.createdByUserName ? 'started Escalation for this ticket' : '';
110
+ case 'SlaStartDate':
111
+ return item.newValue ? `set ${fieldName} to ${item.newValue}` : '';
112
+ // Field value is a user ID, not a label — hardcoded string avoids displaying a raw ID.
113
+ case 'RemoteSessionTermsAckedBy__c':
114
+ return 'Acked Remote Rider terms';
115
+ default:
116
+ return formatDefaultChange(item, fieldName, oldValue, newValue);
117
+ }
118
+ };
119
+ /**
120
+ * Post-processes formatted change text.
121
+ *
122
+ * - Boolean special case: SF boolean history entries can carry a raw `boolean` newValue
123
+ * even after `extractStringValue` stringifies it. When the item's `newValue` is still
124
+ * a boolean at this point, we generate dedicated text to avoid displaying "true"/"false".
125
+ * - String replacements remap legacy SF display names to current UI terminology
126
+ * ("Problem Statement" → "Title", "Case Type" → "Support Type").
127
+ */
128
+ export const applyPostProcessing = (text, item) => {
129
+ if (typeof item.newValue === 'boolean') {
130
+ const fieldName = item.displayName || getFieldDisplayName(item.fieldName);
131
+ return `set ${fieldName} to ${item.newValue}`;
132
+ }
133
+ return text.replaceAll('Problem Statement', 'Title').replaceAll('Case Type', 'Support Type');
134
+ };