@rh-support/troubleshoot 2.6.295 → 2.6.299

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/lib/esm/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.d.ts.map +1 -1
  2. package/lib/esm/components/CaseEditView/ActiveCustomerEscalation/RequestEscalationModal.js +4 -7
  3. package/lib/esm/components/CaseEditView/Case.d.ts.map +1 -1
  4. package/lib/esm/components/CaseEditView/Case.js +42 -12
  5. package/lib/esm/components/CaseEditView/CaseDetailsTabs.d.ts.map +1 -1
  6. package/lib/esm/components/CaseEditView/CaseDetailsTabs.js +17 -7
  7. package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.d.ts +1 -2
  8. package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.d.ts.map +1 -1
  9. package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.js +8 -6
  10. package/lib/esm/components/CaseEditView/CaseOverview/index.d.ts.map +1 -1
  11. package/lib/esm/components/CaseEditView/CaseOverview/index.js +17 -12
  12. package/lib/esm/components/CaseEditView/ConfirmationModals/ReopenCaseModal.d.ts +1 -3
  13. package/lib/esm/components/CaseEditView/ConfirmationModals/ReopenCaseModal.d.ts.map +1 -1
  14. package/lib/esm/components/CaseEditView/ConfirmationModals/ReopenCaseModal.js +3 -4
  15. package/lib/esm/components/CaseEditView/RequestRemoteSession/ESSRemoteSessionModal.d.ts.map +1 -1
  16. package/lib/esm/components/CaseEditView/RequestRemoteSession/ESSRemoteSessionModal.js +4 -7
  17. package/lib/esm/components/CaseEditView/RequestRemoteSession/NewEssTermsModal.d.ts.map +1 -1
  18. package/lib/esm/components/CaseEditView/RequestRemoteSession/NewEssTermsModal.js +4 -30
  19. package/lib/esm/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.d.ts.map +1 -1
  20. package/lib/esm/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.js +4 -30
  21. package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.d.ts +3 -0
  22. package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.d.ts.map +1 -0
  23. package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.js +22 -0
  24. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts +4 -2
  25. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts.map +1 -1
  26. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.js +110 -148
  27. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useAttachmentUploadCompletion.d.ts +15 -0
  28. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useAttachmentUploadCompletion.d.ts.map +1 -0
  29. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useAttachmentUploadCompletion.js +19 -0
  30. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts +17 -0
  31. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts.map +1 -0
  32. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.js +49 -0
  33. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts +6 -2
  34. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts.map +1 -1
  35. package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.js +147 -241
  36. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/CaseHistory.d.ts.map +1 -1
  37. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/CaseHistory.js +3 -1
  38. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.css +4 -4
  39. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.d.ts +35 -3
  40. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.d.ts.map +1 -1
  41. package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.js +63 -224
  42. package/lib/esm/components/CaseEditView/Tabs/CaseSummary/CaseSummary.d.ts.map +1 -1
  43. package/lib/esm/components/CaseEditView/Tabs/CaseSummary/CaseSummary.js +7 -2
  44. package/lib/esm/components/CaseEditView/Tabs/RMEEscalations/RMEEscalationList.d.ts.map +1 -1
  45. package/lib/esm/components/CaseEditView/Tabs/RMEEscalations/RMEEscalationList.js +4 -7
  46. package/lib/esm/components/CaseManagement/Cep.d.ts.map +1 -1
  47. package/lib/esm/components/CaseManagement/Cep.js +4 -7
  48. package/lib/esm/components/ProductSelector/NewProductVersionSelector.d.ts.map +1 -1
  49. package/lib/esm/components/ProductSelector/NewProductVersionSelector.js +18 -4
  50. package/lib/esm/components/UpdateSeverityModal/UpdateSeverityModal.d.ts.map +1 -1
  51. package/lib/esm/components/UpdateSeverityModal/UpdateSeverityModal.js +4 -7
  52. package/lib/esm/components/shared/usePostComment.d.ts.map +1 -1
  53. package/lib/esm/components/shared/usePostComment.js +6 -10
  54. package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.d.ts.map +1 -1
  55. package/lib/esm/components/wizardLayout/GlobalTroubleshootEffects.js +0 -2
  56. package/lib/esm/context/CaseContext.d.ts.map +1 -1
  57. package/lib/esm/hooks/useCaseComments/caseCommentMutation.d.ts +4 -0
  58. package/lib/esm/hooks/useCaseComments/caseCommentMutation.d.ts.map +1 -0
  59. package/lib/esm/hooks/useCaseComments/caseCommentMutation.js +12 -0
  60. package/lib/esm/hooks/useCaseComments/caseCommentsQuery.d.ts +4 -0
  61. package/lib/esm/hooks/useCaseComments/caseCommentsQuery.d.ts.map +1 -0
  62. package/lib/esm/hooks/useCaseComments/caseCommentsQuery.js +55 -0
  63. package/lib/esm/hooks/useCaseComments/index.d.ts +7 -0
  64. package/lib/esm/hooks/useCaseComments/index.d.ts.map +1 -0
  65. package/lib/esm/hooks/useCaseComments/index.js +5 -0
  66. package/lib/esm/hooks/useCaseComments/mapCaseComment.d.ts +25 -0
  67. package/lib/esm/hooks/useCaseComments/mapCaseComment.d.ts.map +1 -0
  68. package/lib/esm/hooks/useCaseComments/mapCaseComment.js +66 -0
  69. package/lib/esm/hooks/useCaseComments/types.d.ts +80 -0
  70. package/lib/esm/hooks/useCaseComments/types.d.ts.map +1 -0
  71. package/lib/esm/hooks/useCaseComments/types.js +1 -0
  72. package/lib/esm/hooks/useCaseComments/useCaseComments.d.ts +16 -0
  73. package/lib/esm/hooks/useCaseComments/useCaseComments.d.ts.map +1 -0
  74. package/lib/esm/hooks/useCaseComments/useCaseComments.js +25 -0
  75. package/lib/esm/hooks/useCaseComments/useCreateCaseComment.d.ts +19 -0
  76. package/lib/esm/hooks/useCaseComments/useCreateCaseComment.d.ts.map +1 -0
  77. package/lib/esm/hooks/useCaseComments/useCreateCaseComment.js +33 -0
  78. package/lib/esm/hooks/useCaseHistory.d.ts +26 -0
  79. package/lib/esm/hooks/useCaseHistory.d.ts.map +1 -0
  80. package/lib/esm/hooks/useCaseHistory.js +98 -0
  81. package/lib/esm/models/caseHistory.d.ts +80 -0
  82. package/lib/esm/models/caseHistory.d.ts.map +1 -0
  83. package/lib/esm/models/caseHistory.js +1 -0
  84. package/lib/esm/reducers/CaseConstNTypes.d.ts +0 -1
  85. package/lib/esm/reducers/CaseConstNTypes.d.ts.map +1 -1
  86. package/lib/esm/reducers/CaseConstNTypes.js +0 -1
  87. package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts +0 -2
  88. package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts.map +1 -1
  89. package/lib/esm/reducers/CaseDiscussionTabReducer.js +1 -28
  90. package/lib/esm/reducers/CaseReducer.d.ts.map +1 -1
  91. package/lib/esm/reducers/CaseReducer.js +14 -4
  92. package/lib/esm/utils/TimelineUtils.d.ts +41 -0
  93. package/lib/esm/utils/TimelineUtils.d.ts.map +1 -0
  94. package/lib/esm/utils/TimelineUtils.js +134 -0
  95. package/lib/esm/utils/caseHistoryUtils.d.ts +66 -0
  96. package/lib/esm/utils/caseHistoryUtils.d.ts.map +1 -0
  97. package/lib/esm/utils/caseHistoryUtils.js +165 -0
  98. package/package.json +5 -5
@@ -7,20 +7,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { useApolloClient } from '@apollo/client/react';
10
11
  import { publicApi } from '@cee-eng/hydrajs';
11
12
  import { useFetch } from '@rh-support/components';
12
- import { useCaseDispatch } from '../../context/CaseContext';
13
- import { useCaseDetailsPageStateContext } from '../../context/CaseDetailsPageContext';
14
- import { useCaseDiscussionTabDispatchContext, useCaseDiscussionTabStateContext, } from '../../context/CaseDiscussionTabContext';
15
- import { updateDiscussionStateComments } from '../../reducers/CaseDiscussionTabReducer';
13
+ import { GET_CASE_COMMENTS } from '../../hooks/useCaseComments';
16
14
  export function usePostComment({ caseNumber }) {
15
+ const client = useApolloClient();
17
16
  const { request: postCommentRequest, isFetching: isPostingComment } = useFetch(publicApi.kase.postComment, {
18
17
  propgateErrors: true,
19
18
  });
20
- const caseDispatch = useCaseDispatch();
21
- const dispatchDiscussion = useCaseDiscussionTabDispatchContext();
22
- const { sort, allDiscussions, discussionFiltersListState } = useCaseDiscussionTabStateContext();
23
- const { caseDetailsPageState: { caseFeedbacksHydra }, } = useCaseDetailsPageStateContext();
24
19
  const defaultContentType = 'plaintext';
25
20
  const postComment = (_a) => __awaiter(this, [_a], void 0, function* ({ commentBody, contentType = defaultContentType, updateDiscussionState = true, doNotChangeStatus = false, }) {
26
21
  if (!commentBody)
@@ -32,8 +27,9 @@ export function usePostComment({ caseNumber }) {
32
27
  contentType,
33
28
  doNotChangeStatus,
34
29
  });
35
- updateDiscussionState &&
36
- updateDiscussionStateComments(dispatchDiscussion, caseDispatch, caseNumber, allDiscussions, sort, caseFeedbacksHydra.data, discussionFiltersListState);
30
+ if (updateDiscussionState) {
31
+ yield client.refetchQueries({ include: [GET_CASE_COMMENTS] });
32
+ }
37
33
  }
38
34
  catch (e) {
39
35
  throw e;
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalTroubleshootEffects.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/GlobalTroubleshootEffects.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAWvD,OAAO,EAAuC,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAYvG,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,qBA4atD"}
1
+ {"version":3,"file":"GlobalTroubleshootEffects.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/GlobalTroubleshootEffects.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAkD,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAWvD,OAAO,EAAuC,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAYvG,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACpD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,qBA0atD"}
@@ -168,8 +168,6 @@ export function GlobalTroubleshootEffects(props) {
168
168
  */
169
169
  useEffect(() => {
170
170
  var _a, _b;
171
- if (!isCaseCreate)
172
- return;
173
171
  if (isEmpty(loggedInUserRights.data))
174
172
  return;
175
173
  if (loggedInUserRights.data.isInternal())
@@ -1 +1 @@
1
- {"version":3,"file":"CaseContext.d.ts","sourceRoot":"","sources":["../../../src/context/CaseContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAqE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAGxH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAoB,MAAM,6BAA6B,CAAC;AAK5F,eAAO,MAAM,gBAAgB,oEAAiF,CAAC;AAC/G,eAAO,MAAM,YAAY,0DAAiE,CAAC;AAC3F,eAAO,MAAM,eAAe,iDAAoE,CAAC;AACjG,eAAO,MAAM,eAAe,iJAAoE,CAAC;AAGjG,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE;;CAAA,qBAM/C"}
1
+ {"version":3,"file":"CaseContext.d.ts","sourceRoot":"","sources":["../../../src/context/CaseContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAqE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAGxH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAoB,MAAM,6BAA6B,CAAC;AAK5F,eAAO,MAAM,gBAAgB,oEAAiF,CAAC;AAC/G,eAAO,MAAM,YAAY,0DAAiE,CAAC;AAE3F,eAAO,MAAM,eAAe,iDAAoE,CAAC;AACjG,eAAO,MAAM,eAAe,iJAAoE,CAAC;AAGjG,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE;;CAAA,qBAM/C"}
@@ -0,0 +1,4 @@
1
+ import { TypedDocumentNode } from '@apollo/client/core';
2
+ import { ICreateCaseCommentResponse, ICreateCaseCommentVariables } from './types';
3
+ export declare const CREATE_CASE_COMMENT: TypedDocumentNode<ICreateCaseCommentResponse, ICreateCaseCommentVariables>;
4
+ //# sourceMappingURL=caseCommentMutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caseCommentMutation.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/caseCommentMutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAElF,eAAO,MAAM,mBAAmB,EAAE,iBAAiB,CAAC,0BAA0B,EAAE,2BAA2B,CAU1G,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { gql } from '@apollo/client/core';
2
+ export const CREATE_CASE_COMMENT = gql `
3
+ mutation CreateCaseComment($commentInput: SalesforceSupportCaseComment__cCreateRepresentation!) {
4
+ salesforce_support_uiapi {
5
+ CaseComment__cCreate(input: { SalesforceSupportCaseComment__c: $commentInput }) {
6
+ SalesforceSupportRecord {
7
+ Id
8
+ }
9
+ }
10
+ }
11
+ }
12
+ `;
@@ -0,0 +1,4 @@
1
+ import { TypedDocumentNode } from '@apollo/client/core';
2
+ import { ICaseCommentsVariables, IGetCaseCommentsQueryResponse } from './types';
3
+ export declare const GET_CASE_COMMENTS: TypedDocumentNode<IGetCaseCommentsQueryResponse, ICaseCommentsVariables>;
4
+ //# sourceMappingURL=caseCommentsQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caseCommentsQuery.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/caseCommentsQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAEhF,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,6BAA6B,EAAE,sBAAsB,CAqDtG,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { gql } from '@apollo/client/core';
2
+ export const GET_CASE_COMMENTS = gql `
3
+ query GetCaseComments(
4
+ $filter: SalesforceSupportCaseComment__c_Filter!
5
+ $orderBy: SalesforceSupportCaseComment__c_OrderBy
6
+ $first: Int
7
+ ) {
8
+ salesforce_support_uiapi {
9
+ query {
10
+ SalesforceSupportCaseComment__c(where: $filter, orderBy: $orderBy, first: $first) {
11
+ edges {
12
+ node {
13
+ Id
14
+ Name {
15
+ value
16
+ }
17
+ Body__c {
18
+ value
19
+ }
20
+ CreatedBy {
21
+ Name {
22
+ value
23
+ }
24
+ IsPartner {
25
+ value
26
+ }
27
+ }
28
+ IsCustomer__c {
29
+ value
30
+ }
31
+ IsAssociate__c {
32
+ value
33
+ }
34
+ LastModifiedDate {
35
+ value
36
+ }
37
+ Visibility__c {
38
+ value
39
+ displayValue
40
+ }
41
+ LastModifiedBy {
42
+ Name {
43
+ value
44
+ }
45
+ }
46
+ CreatedDate {
47
+ value
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ `;
@@ -0,0 +1,7 @@
1
+ export { CREATE_CASE_COMMENT } from './caseCommentMutation';
2
+ export { GET_CASE_COMMENTS } from './caseCommentsQuery';
3
+ export { deriveCreatedByType, deriveIsPublic, mapCaseCommentNode, mapCaseCommentsResponse, mapVisibility, } from './mapCaseComment';
4
+ export type { ICaseCommentEdge, ICaseCommentNode, ICaseCommentsConnection, ICreateCaseCommentResponse, ICreateCaseCommentVariables, IGetCaseCommentsQueryResponse, IUseCaseCommentsOptions, } from './types';
5
+ export { useCaseComments } from './useCaseComments';
6
+ export { useCreateCaseComment } from './useCreateCaseComment';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACH,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,GAChB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACR,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC3B,6BAA6B,EAC7B,uBAAuB,GAC1B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { CREATE_CASE_COMMENT } from './caseCommentMutation';
2
+ export { GET_CASE_COMMENTS } from './caseCommentsQuery';
3
+ export { deriveCreatedByType, deriveIsPublic, mapCaseCommentNode, mapCaseCommentsResponse, mapVisibility, } from './mapCaseComment';
4
+ export { useCaseComments } from './useCaseComments';
5
+ export { useCreateCaseComment } from './useCreateCaseComment';
@@ -0,0 +1,25 @@
1
+ import { ICaseComment } from '@cee-eng/hydrajs/@types/api/public/case';
2
+ import { ICaseCommentNode, IGetCaseCommentsQueryResponse } from './types';
3
+ /**
4
+ * The GraphQL API HTML-encodes comment bodies on storage/retrieval
5
+ * (e.g. > becomes &amp;gt;, & becomes &amp;amp;). Two-pass decode
6
+ * handles both single- and double-encoded entities.
7
+ *
8
+ * TODO: The double-encoding is a backend bug in the Salesforce UIAPI — it encodes on both
9
+ * write and read. Once the backend is fixed, replace with a single `unescape(text)` call.
10
+ */
11
+ export declare function decodeHtmlEntities(text: string): string;
12
+ /**
13
+ * Derives the comment author type with priority: Associate > Customer > Partner.
14
+ * Falls back to 'Customer' when no flags match.
15
+ */
16
+ export declare function deriveCreatedByType(isAssociate: boolean, isCustomer: boolean, isPartner: boolean): string;
17
+ export declare function deriveIsPublic(visibility: string | null | undefined): boolean;
18
+ export declare function mapVisibility(isPublic: boolean): string;
19
+ /**
20
+ * Converts a raw Salesforce CaseComment GraphQL node (with wrapped `{ value }` fields)
21
+ * into the flat ICaseComment interface expected by the discussion UI layer.
22
+ */
23
+ export declare function mapCaseCommentNode(node: ICaseCommentNode): ICaseComment;
24
+ export declare function mapCaseCommentsResponse(data: IGetCaseCommentsQueryResponse | undefined): ICaseComment[];
25
+ //# sourceMappingURL=mapCaseComment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapCaseComment.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/mapCaseComment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAGvE,OAAO,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAE1E;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAKzG;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAG7E;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAEvD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,GAAG,YAAY,CAuBvE;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,6BAA6B,GAAG,SAAS,GAAG,YAAY,EAAE,CAOvG"}
@@ -0,0 +1,66 @@
1
+ import { unescape } from 'lodash';
2
+ /**
3
+ * The GraphQL API HTML-encodes comment bodies on storage/retrieval
4
+ * (e.g. > becomes &amp;gt;, & becomes &amp;amp;). Two-pass decode
5
+ * handles both single- and double-encoded entities.
6
+ *
7
+ * TODO: The double-encoding is a backend bug in the Salesforce UIAPI — it encodes on both
8
+ * write and read. Once the backend is fixed, replace with a single `unescape(text)` call.
9
+ */
10
+ export function decodeHtmlEntities(text) {
11
+ return unescape(unescape(text));
12
+ }
13
+ /**
14
+ * Derives the comment author type with priority: Associate > Customer > Partner.
15
+ * Falls back to 'Customer' when no flags match.
16
+ */
17
+ export function deriveCreatedByType(isAssociate, isCustomer, isPartner) {
18
+ if (isAssociate)
19
+ return 'Associate';
20
+ if (isCustomer)
21
+ return 'Customer';
22
+ if (isPartner)
23
+ return 'Partner';
24
+ return 'Customer';
25
+ }
26
+ export function deriveIsPublic(visibility) {
27
+ if (!visibility)
28
+ return false;
29
+ return visibility === 'Public';
30
+ }
31
+ export function mapVisibility(isPublic) {
32
+ return isPublic ? 'Public' : 'Private';
33
+ }
34
+ /**
35
+ * Converts a raw Salesforce CaseComment GraphQL node (with wrapped `{ value }` fields)
36
+ * into the flat ICaseComment interface expected by the discussion UI layer.
37
+ */
38
+ export function mapCaseCommentNode(node) {
39
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
40
+ const rawBody = (_b = (_a = node.Body__c) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '';
41
+ const body = decodeHtmlEntities(rawBody);
42
+ const visibility = (_d = (_c = node.Visibility__c) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : null;
43
+ return {
44
+ id: node.Id,
45
+ commentBody: body,
46
+ createdBy: (_g = (_f = (_e = node.CreatedBy) === null || _e === void 0 ? void 0 : _e.Name) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : '',
47
+ createdByType: deriveCreatedByType(!!((_h = node.IsAssociate__c) === null || _h === void 0 ? void 0 : _h.value), !!((_j = node.IsCustomer__c) === null || _j === void 0 ? void 0 : _j.value), !!((_l = (_k = node.CreatedBy) === null || _k === void 0 ? void 0 : _k.IsPartner) === null || _l === void 0 ? void 0 : _l.value)),
48
+ lastModifiedById: (_p = (_o = (_m = node.LastModifiedBy) === null || _m === void 0 ? void 0 : _m.Name) === null || _o === void 0 ? void 0 : _o.value) !== null && _p !== void 0 ? _p : '',
49
+ lastModifiedDate: (_r = (_q = node.LastModifiedDate) === null || _q === void 0 ? void 0 : _q.value) !== null && _r !== void 0 ? _r : '',
50
+ createdDate: (_t = (_s = node.CreatedDate) === null || _s === void 0 ? void 0 : _s.value) !== null && _t !== void 0 ? _t : '',
51
+ visibility: visibility !== null && visibility !== void 0 ? visibility : undefined,
52
+ isPublic: deriveIsPublic(visibility),
53
+ contentType: 'plaintext',
54
+ isDraft: false,
55
+ publishedDate: '',
56
+ };
57
+ }
58
+ export function mapCaseCommentsResponse(data) {
59
+ var _a, _b, _c;
60
+ if (!data)
61
+ return [];
62
+ const edges = (_c = (_b = (_a = data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.SalesforceSupportCaseComment__c) === null || _c === void 0 ? void 0 : _c.edges;
63
+ if (!edges)
64
+ return [];
65
+ return edges.map((edge) => mapCaseCommentNode(edge.node));
66
+ }
@@ -0,0 +1,80 @@
1
+ export interface ISalesforceStringField {
2
+ value: string | null;
3
+ }
4
+ export interface ISalesforceBooleanField {
5
+ value: boolean | null;
6
+ }
7
+ export interface ISalesforcePicklistField {
8
+ value: string | null;
9
+ displayValue: string | null;
10
+ }
11
+ export interface ICaseCommentCreatedBy {
12
+ Name: ISalesforceStringField;
13
+ IsPartner: ISalesforceBooleanField;
14
+ }
15
+ export interface ICaseCommentLastModifiedBy {
16
+ Name: ISalesforceStringField;
17
+ }
18
+ export interface ICaseCommentNode {
19
+ Id: string;
20
+ Name: ISalesforceStringField;
21
+ Body__c: ISalesforceStringField;
22
+ CreatedBy: ICaseCommentCreatedBy;
23
+ IsCustomer__c: ISalesforceBooleanField;
24
+ IsAssociate__c: ISalesforceBooleanField;
25
+ LastModifiedDate: ISalesforceStringField;
26
+ Visibility__c: ISalesforcePicklistField;
27
+ LastModifiedBy: ICaseCommentLastModifiedBy;
28
+ CreatedDate: ISalesforceStringField;
29
+ }
30
+ export interface ICaseCommentEdge {
31
+ node: ICaseCommentNode;
32
+ }
33
+ export interface ICaseCommentsConnection {
34
+ edges: ICaseCommentEdge[];
35
+ }
36
+ export interface IGetCaseCommentsQueryResponse {
37
+ salesforce_support_uiapi: {
38
+ query: {
39
+ SalesforceSupportCaseComment__c: ICaseCommentsConnection;
40
+ };
41
+ };
42
+ }
43
+ export interface ICaseCommentsVariables {
44
+ filter: {
45
+ Case__c: {
46
+ eq: string;
47
+ };
48
+ };
49
+ orderBy?: Record<string, {
50
+ order: 'ASC' | 'DESC';
51
+ }>;
52
+ first?: number;
53
+ }
54
+ export interface IUseCaseCommentsOptions {
55
+ caseId: string;
56
+ skip?: boolean;
57
+ orderBy?: Record<string, {
58
+ order: 'ASC' | 'DESC';
59
+ }>;
60
+ first?: number;
61
+ }
62
+ export interface ICreateCaseCommentInput {
63
+ Case__c: string;
64
+ Body__c: string;
65
+ Visibility__c: string;
66
+ IsAssociate__c?: boolean;
67
+ }
68
+ export interface ICreateCaseCommentVariables {
69
+ commentInput: ICreateCaseCommentInput;
70
+ }
71
+ export interface ICreateCaseCommentResponse {
72
+ salesforce_support_uiapi: {
73
+ CaseComment__cCreate: {
74
+ SalesforceSupportRecord: {
75
+ Id: string;
76
+ };
77
+ };
78
+ };
79
+ }
80
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACnC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,wBAAwB;IACrC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IAClC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,SAAS,EAAE,uBAAuB,CAAC;CACtC;AAED,MAAM,WAAW,0BAA0B;IACvC,IAAI,EAAE,sBAAsB,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,sBAAsB,CAAC;IAC7B,OAAO,EAAE,sBAAsB,CAAC;IAChC,SAAS,EAAE,qBAAqB,CAAC;IACjC,aAAa,EAAE,uBAAuB,CAAC;IACvC,cAAc,EAAE,uBAAuB,CAAC;IACxC,gBAAgB,EAAE,sBAAsB,CAAC;IACzC,aAAa,EAAE,wBAAwB,CAAC;IACxC,cAAc,EAAE,0BAA0B,CAAC;IAC3C,WAAW,EAAE,sBAAsB,CAAC;CACvC;AAED,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,gBAAgB,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,6BAA6B;IAC1C,wBAAwB,EAAE;QACtB,KAAK,EAAE;YACH,+BAA+B,EAAE,uBAAuB,CAAC;SAC5D,CAAC;KACL,CAAC;CACL;AAED,MAAM,WAAW,sBAAsB;IACnC,MAAM,EAAE;QAAE,OAAO,EAAE;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,2BAA2B;IACxC,YAAY,EAAE,uBAAuB,CAAC;CACzC;AAED,MAAM,WAAW,0BAA0B;IACvC,wBAAwB,EAAE;QACtB,oBAAoB,EAAE;YAClB,uBAAuB,EAAE;gBACrB,EAAE,EAAE,MAAM,CAAC;aACd,CAAC;SACL,CAAC;KACL,CAAC;CACL"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import { ICaseComment } from '@cee-eng/hydrajs/@types/api/public/case';
2
+ import { IUseCaseCommentsOptions } from './types';
3
+ interface IUseCaseCommentsReturn {
4
+ comments: ICaseComment[];
5
+ loading: boolean;
6
+ error: Error | undefined;
7
+ refetch: () => Promise<unknown>;
8
+ }
9
+ /**
10
+ * Fetches case comments from the Salesforce GraphQL API for a given case ID.
11
+ * Supports custom sort ordering and pagination clamping (1–2000 records).
12
+ * Returns mapped ICaseComment[] along with loading, error, and refetch handles.
13
+ */
14
+ export declare function useCaseComments({ caseId, skip, orderBy, first }: IUseCaseCommentsOptions): IUseCaseCommentsReturn;
15
+ export {};
16
+ //# sourceMappingURL=useCaseComments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCaseComments.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/useCaseComments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAMvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAElD,UAAU,sBAAsB;IAC5B,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACnC;AAKD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,uBAAuB,GAAG,sBAAsB,CAcjH"}
@@ -0,0 +1,25 @@
1
+ import { useQuery } from '@apollo/client/react';
2
+ import clamp from 'lodash/clamp';
3
+ import { useMemo } from 'react';
4
+ import { GET_CASE_COMMENTS } from './caseCommentsQuery';
5
+ import { mapCaseCommentsResponse } from './mapCaseComment';
6
+ const MAX_FIRST = 2000;
7
+ const MIN_FIRST = 1;
8
+ /**
9
+ * Fetches case comments from the Salesforce GraphQL API for a given case ID.
10
+ * Supports custom sort ordering and pagination clamping (1–2000 records).
11
+ * Returns mapped ICaseComment[] along with loading, error, and refetch handles.
12
+ */
13
+ export function useCaseComments({ caseId, skip, orderBy, first }) {
14
+ const { data, loading, error, refetch } = useQuery(GET_CASE_COMMENTS, {
15
+ variables: {
16
+ filter: { Case__c: { eq: caseId } },
17
+ orderBy: orderBy !== null && orderBy !== void 0 ? orderBy : { LastModifiedDate: { order: 'DESC' } },
18
+ first: clamp(first !== null && first !== void 0 ? first : MAX_FIRST, MIN_FIRST, MAX_FIRST),
19
+ },
20
+ skip: skip || !caseId,
21
+ fetchPolicy: 'cache-and-network',
22
+ });
23
+ const comments = useMemo(() => mapCaseCommentsResponse(data), [data]);
24
+ return { comments, loading, error, refetch };
25
+ }
@@ -0,0 +1,19 @@
1
+ interface ICreateCaseCommentOptions {
2
+ caseId: string;
3
+ body: string;
4
+ isPublic?: boolean;
5
+ isAssociate?: boolean;
6
+ }
7
+ interface IUseCreateCaseCommentReturn {
8
+ createComment: (options: ICreateCaseCommentOptions) => Promise<unknown>;
9
+ loading: boolean;
10
+ error: Error | undefined;
11
+ }
12
+ /**
13
+ * Wraps the CREATE_CASE_COMMENT GraphQL mutation.
14
+ * Returns a `createComment` callback that accepts caseId, body, visibility,
15
+ * and associate flag, along with the mutation's loading and error state.
16
+ */
17
+ export declare function useCreateCaseComment(): IUseCreateCaseCommentReturn;
18
+ export {};
19
+ //# sourceMappingURL=useCreateCaseComment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCreateCaseComment.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/useCreateCaseComment.ts"],"names":[],"mappings":"AAKA,UAAU,yBAAyB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,UAAU,2BAA2B;IACjC,aAAa,EAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACxE,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,2BAA2B,CAiBlE"}
@@ -0,0 +1,33 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { useMutation } from '@apollo/client/react';
11
+ import { CREATE_CASE_COMMENT } from './caseCommentMutation';
12
+ import { mapVisibility } from './mapCaseComment';
13
+ /**
14
+ * Wraps the CREATE_CASE_COMMENT GraphQL mutation.
15
+ * Returns a `createComment` callback that accepts caseId, body, visibility,
16
+ * and associate flag, along with the mutation's loading and error state.
17
+ */
18
+ export function useCreateCaseComment() {
19
+ const [mutate, { loading, error }] = useMutation(CREATE_CASE_COMMENT);
20
+ const createComment = (_a) => __awaiter(this, [_a], void 0, function* ({ caseId, body, isPublic = true, isAssociate = false }) {
21
+ return mutate({
22
+ variables: {
23
+ commentInput: {
24
+ Case__c: caseId,
25
+ Body__c: body,
26
+ Visibility__c: mapVisibility(isPublic),
27
+ IsAssociate__c: isAssociate,
28
+ },
29
+ },
30
+ });
31
+ });
32
+ return { createComment, loading, error };
33
+ }
@@ -0,0 +1,26 @@
1
+ import { type TypedDocumentNode } from '@apollo/client';
2
+ import type { ICaseHistoryItem, IGetCaseHistoryData, IGetCaseHistoryVars } from '../models/caseHistory';
3
+ /**
4
+ * OldValue/NewValue use inline fragments with aliased fields (e.g. `stringValue: value`).
5
+ * These aliases produce the property names that `extractStringValue` checks against.
6
+ * Changing an alias here without updating `extractStringValue` will silently break
7
+ * value extraction.
8
+ *
9
+ * Supported value types (members of the Salesforce_Support_AnyType union):
10
+ * - SalesforceSupportStringValue → stringValue
11
+ * - SalesforceSupportBooleanValue → booleanValue
12
+ * - SalesforceSupportDoubleValue → doubleValue
13
+ * - SalesforceSupportDateTimeValue → dateTimeValue
14
+ *
15
+ * `first` defaults to 2000 — a practical cap that covers all observed real-world case
16
+ * histories while staying well within the SF API limit.
17
+ */
18
+ export declare const GET_CASE_HISTORY: TypedDocumentNode<IGetCaseHistoryData, IGetCaseHistoryVars>;
19
+ interface UseCaseHistoryResult {
20
+ historyItems: ICaseHistoryItem[];
21
+ loading: boolean;
22
+ error: Error | undefined;
23
+ }
24
+ export declare function useCaseHistory(caseId: string | undefined, first?: number): UseCaseHistoryResult;
25
+ export {};
26
+ //# sourceMappingURL=useCaseHistory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCaseHistory.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCaseHistory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAO,MAAM,gBAAgB,CAAC;AAI7D,OAAO,KAAK,EAER,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,uBAAuB,CAAC;AAG/B;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,EAAE,iBAAiB,CAAC,mBAAmB,EAAE,mBAAmB,CA6DxF,CAAC;AAEF,UAAU,oBAAoB;IAC1B,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC5B;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,SAAO,GAAG,oBAAoB,CAgB7F"}
@@ -0,0 +1,98 @@
1
+ import { gql } from '@apollo/client';
2
+ import { useQuery } from '@apollo/client/react';
3
+ import { useMemo } from 'react';
4
+ import { filterSfdcIdEntries, normalizeNodeToHistoryItem } from '../utils/caseHistoryUtils';
5
+ /**
6
+ * OldValue/NewValue use inline fragments with aliased fields (e.g. `stringValue: value`).
7
+ * These aliases produce the property names that `extractStringValue` checks against.
8
+ * Changing an alias here without updating `extractStringValue` will silently break
9
+ * value extraction.
10
+ *
11
+ * Supported value types (members of the Salesforce_Support_AnyType union):
12
+ * - SalesforceSupportStringValue → stringValue
13
+ * - SalesforceSupportBooleanValue → booleanValue
14
+ * - SalesforceSupportDoubleValue → doubleValue
15
+ * - SalesforceSupportDateTimeValue → dateTimeValue
16
+ *
17
+ * `first` defaults to 2000 — a practical cap that covers all observed real-world case
18
+ * histories while staying well within the SF API limit.
19
+ */
20
+ export const GET_CASE_HISTORY = gql `
21
+ query GetCaseHistory($caseId: ID!, $first: Int = 2000) {
22
+ salesforce_support_uiapi {
23
+ query {
24
+ SalesforceSupportCaseHistory(first: $first, where: { CaseId: { eq: $caseId } }) {
25
+ edges {
26
+ node {
27
+ Id
28
+ SalesforceSupportField {
29
+ value
30
+ displayValue
31
+ label
32
+ }
33
+ OldValue {
34
+ ... on SalesforceSupportStringValue {
35
+ stringValue: value
36
+ }
37
+ ... on SalesforceSupportBooleanValue {
38
+ booleanValue: value
39
+ }
40
+ ... on SalesforceSupportDoubleValue {
41
+ doubleValue: value
42
+ }
43
+ ... on SalesforceSupportDateTimeValue {
44
+ dateTimeValue: value
45
+ }
46
+ }
47
+ NewValue {
48
+ ... on SalesforceSupportStringValue {
49
+ stringValue: value
50
+ }
51
+ ... on SalesforceSupportBooleanValue {
52
+ booleanValue: value
53
+ }
54
+ ... on SalesforceSupportDoubleValue {
55
+ doubleValue: value
56
+ }
57
+ ... on SalesforceSupportDateTimeValue {
58
+ dateTimeValue: value
59
+ }
60
+ }
61
+ CreatedBy {
62
+ Name {
63
+ value
64
+ }
65
+ UserType {
66
+ value
67
+ }
68
+ SmallPhotoUrl {
69
+ value
70
+ }
71
+ }
72
+ CreatedDate {
73
+ value
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
81
+ `;
82
+ export function useCaseHistory(caseId, first = 2000) {
83
+ const { data, loading, error } = useQuery(GET_CASE_HISTORY, {
84
+ variables: { caseId: caseId || '', first },
85
+ // Empty string = no case selected; skip avoids a wasted network request.
86
+ skip: !caseId,
87
+ // Shows cached data immediately while revalidating, avoiding a loading flash on re-visits.
88
+ fetchPolicy: 'cache-and-network',
89
+ });
90
+ const historyItems = useMemo(() => {
91
+ var _a, _b, _c;
92
+ const edges = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.salesforce_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.SalesforceSupportCaseHistory) === null || _c === void 0 ? void 0 : _c.edges;
93
+ if (!edges)
94
+ return [];
95
+ return filterSfdcIdEntries(edges).map(normalizeNodeToHistoryItem);
96
+ }, [data]);
97
+ return { historyItems, loading, error };
98
+ }