@rh-support/troubleshoot 2.6.358 → 2.6.361
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.
- package/lib/esm/components/AccountInfo/OwnerSelector.js +1 -1
- package/lib/esm/components/CaseEditView/CaseDetailsErrorMessage.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseDetailsErrorMessage.js +14 -4
- package/lib/esm/components/CaseEditView/CaseDetailsTabs.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseDetailsTabs.js +11 -7
- package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.d.ts +2 -0
- package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseOverview/CaseStatus.js +19 -8
- package/lib/esm/components/CaseEditView/CaseOverview/index.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseOverview/index.js +16 -13
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutions.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/CaseSolutions/CaseSolutions.js +1 -1
- package/lib/esm/components/CaseEditView/ConfirmationModals/ReopenCaseModal.js +2 -2
- package/lib/esm/components/CaseEditView/RequestRemoteSession/NewEssTermsModal.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/RequestRemoteSession/NewEssTermsModal.js +7 -5
- package/lib/esm/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/RequestRemoteSession/RemoteSessionAgreementModal.js +7 -5
- package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.d.ts +6 -0
- package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/RequestRemoteSession/remoteSessionUtils.js +8 -0
- package/lib/esm/components/CaseEditView/Tabs/CaseActionPlan/CaseActionPlan.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseActionPlan/CaseActionPlan.js +6 -3
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseContactPhoneNumber.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseHostname.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseInternalStatus.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseOpenshiftClusterId/CaseOpenshiftClusterId.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CasePhoneNumberConfirmAlert.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseReferenceNumber.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseSbrGroups.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/CaseSbrGroups.js +3 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/ProductVersion.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/ProductVersion.js +1 -6
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/Summary.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/useCustomEmails.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDetails/useCustomEmails.js +4 -2
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseAttachment.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseAttachment.js +5 -3
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseComments.js +33 -3
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts +6 -0
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/CaseDiscussion.js +210 -35
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment/useCommentDrafts.js +3 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/PostComment.js +11 -17
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/VerifyCaseStatusModal/VerifyCaseStatusModal.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseDiscussion/VerifyCaseStatusModal/VerifyCaseStatusModal.js +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseHistory/CaseHistory.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseHistory/CaseHistory.js +5 -2
- package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.d.ts +2 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseHistory/Timeline.js +4 -11
- package/lib/esm/components/CaseEditView/Tabs/CasePrivateNotes/CasePrivateNotes.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CasePrivateNotes/CasePrivateNotes.js +6 -3
- package/lib/esm/components/CaseEditView/Tabs/CaseSummary/CaseSummary.d.ts.map +1 -1
- package/lib/esm/components/CaseEditView/Tabs/CaseSummary/CaseSummary.js +1 -0
- package/lib/esm/components/CaseInformation/CaseGroup.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/CaseGroup.js +6 -2
- package/lib/esm/components/CaseInformation/CaseLabels.d.ts.map +1 -1
- package/lib/esm/components/CaseInformation/CaseLabels.js +6 -4
- package/lib/esm/components/CaseInformation/Fts.js +2 -2
- package/lib/esm/components/CaseManagement/Cep.js +1 -1
- package/lib/esm/components/CaseManagement/RHAssociatesSelector.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/RHAssociatesSelector.js +4 -2
- package/lib/esm/components/CaseManagement/SendNotifications/CaseContactSelector.d.ts.map +1 -1
- package/lib/esm/components/CaseManagement/SendNotifications/CaseContactSelector.js +4 -2
- package/lib/esm/components/EditDescription/EditDescription.d.ts.map +1 -1
- package/lib/esm/components/EditDescription/EditDescription.js +3 -1
- package/lib/esm/components/UpdateSeverityModal/UpdateSeverityModal.js +4 -4
- package/lib/esm/css/case.css +154 -8
- package/lib/esm/graphql/queries/getEscalationDetails.d.ts.map +1 -1
- package/lib/esm/graphql/queries/getEscalationDetails.js +5 -0
- package/lib/esm/hooks/useCaseComments/caseCommentsQuery.d.ts.map +1 -1
- package/lib/esm/hooks/useCaseComments/caseCommentsQuery.js +6 -1
- package/lib/esm/hooks/useCaseComments/index.d.ts +2 -1
- package/lib/esm/hooks/useCaseComments/index.d.ts.map +1 -1
- package/lib/esm/hooks/useCaseComments/types.d.ts +8 -0
- package/lib/esm/hooks/useCaseComments/types.d.ts.map +1 -1
- package/lib/esm/hooks/useCaseComments/useCaseComments.d.ts +12 -3
- package/lib/esm/hooks/useCaseComments/useCaseComments.d.ts.map +1 -1
- package/lib/esm/hooks/useCaseComments/useCaseComments.js +84 -9
- package/lib/esm/hooks/useCaseHistory.d.ts +2 -2
- package/lib/esm/hooks/useCaseHistory.d.ts.map +1 -1
- package/lib/esm/hooks/useCaseHistory.js +16 -7
- package/lib/esm/hooks/useCaseUpdateErrorMessage.d.ts +9 -1
- package/lib/esm/hooks/useCaseUpdateErrorMessage.d.ts.map +1 -1
- package/lib/esm/hooks/useCaseUpdateErrorMessage.js +103 -16
- package/lib/esm/models/caseHistory.d.ts +6 -0
- package/lib/esm/models/caseHistory.d.ts.map +1 -1
- package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts +2 -1
- package/lib/esm/reducers/CaseDiscussionTabReducer.d.ts.map +1 -1
- package/lib/esm/reducers/CaseDiscussionTabReducer.js +26 -4
- package/lib/esm/utils/caseHistoryUtils.d.ts +19 -0
- package/lib/esm/utils/caseHistoryUtils.d.ts.map +1 -1
- package/lib/esm/utils/caseHistoryUtils.js +31 -0
- package/lib/esm/utils/linkifyHtmlTextNodes.d.ts +8 -0
- package/lib/esm/utils/linkifyHtmlTextNodes.d.ts.map +1 -0
- package/lib/esm/utils/linkifyHtmlTextNodes.js +37 -0
- package/package.json +7 -6
|
@@ -29,8 +29,13 @@ export interface ICaseCommentNode {
|
|
|
29
29
|
export interface ICaseCommentEdge {
|
|
30
30
|
node: ICaseCommentNode;
|
|
31
31
|
}
|
|
32
|
+
export interface IPageInfo {
|
|
33
|
+
hasNextPage: boolean;
|
|
34
|
+
endCursor: string | null;
|
|
35
|
+
}
|
|
32
36
|
export interface ICaseCommentsConnection {
|
|
33
37
|
edges: ICaseCommentEdge[];
|
|
38
|
+
pageInfo?: IPageInfo;
|
|
34
39
|
}
|
|
35
40
|
export interface IGetCaseCommentsQueryResponse {
|
|
36
41
|
redhat_support_uiapi: {
|
|
@@ -53,6 +58,7 @@ export interface ICaseCommentsVariables {
|
|
|
53
58
|
order: 'ASC' | 'DESC';
|
|
54
59
|
}>;
|
|
55
60
|
first?: number;
|
|
61
|
+
after?: string;
|
|
56
62
|
}
|
|
57
63
|
export interface IUseCaseCommentsOptions {
|
|
58
64
|
caseId: string;
|
|
@@ -63,6 +69,8 @@ export interface IUseCaseCommentsOptions {
|
|
|
63
69
|
first?: number;
|
|
64
70
|
/** When true, only Public comments are fetched (external / customer users). */
|
|
65
71
|
publicOnly?: boolean;
|
|
72
|
+
/** Cursor for pagination — pass to resume from a previous page. */
|
|
73
|
+
after?: string;
|
|
66
74
|
}
|
|
67
75
|
export interface ICreateCaseCommentInput {
|
|
68
76
|
Case__c: string;
|
|
@@ -1 +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;CAChC;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;
|
|
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,EA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AAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,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;IACf,+EAA+E;IAC/E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mEAAmE;IACnE,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,oBAAoB,EAAE;QAClB,oBAAoB,EAAE;YAClB,mBAAmB,EAAE;gBACjB,EAAE,EAAE,MAAM,CAAC;aACd,CAAC;SACL,CAAC;KACL,CAAC;CACL"}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import { ICaseComment } from '@cee-eng/hydrajs/@types/api/public/case';
|
|
2
2
|
import { IUseCaseCommentsOptions } from './types';
|
|
3
|
-
interface IUseCaseCommentsReturn {
|
|
3
|
+
export interface IUseCaseCommentsReturn {
|
|
4
4
|
comments: ICaseComment[];
|
|
5
5
|
loading: boolean;
|
|
6
6
|
error: Error | undefined;
|
|
7
7
|
refetch: () => Promise<unknown>;
|
|
8
|
+
fetchMore: () => Promise<unknown>;
|
|
9
|
+
hasNextPage: boolean;
|
|
10
|
+
isLoadingMore: boolean;
|
|
11
|
+
loadMoreError: boolean;
|
|
12
|
+
loadMoreRetryCount: number;
|
|
13
|
+
retryLoadMore: () => Promise<unknown>;
|
|
8
14
|
}
|
|
9
15
|
/**
|
|
10
16
|
* Fetches case comments from the Salesforce GraphQL API for a given case ID.
|
|
11
17
|
* Supports custom sort ordering and pagination clamping (1–2000 records).
|
|
12
18
|
* External / customer users (no VIEW_PRIVATE_COMMENT) only receive Public comments.
|
|
13
19
|
* Returns mapped ICaseComment[] along with loading, error, and refetch handles.
|
|
20
|
+
*
|
|
21
|
+
* Pagination uses Apollo's fetchMore; pages accumulate in the cache via
|
|
22
|
+
* relayStylePagination. nextFetchPolicy returns 'cache-first' after the first
|
|
23
|
+
* result so cache-and-network does not refetch and overwrite merged pages.
|
|
14
24
|
*/
|
|
15
|
-
export declare function useCaseComments({ caseId, skip, orderBy, first, publicOnly, }: IUseCaseCommentsOptions): IUseCaseCommentsReturn;
|
|
16
|
-
export {};
|
|
25
|
+
export declare function useCaseComments({ caseId, skip, orderBy, first, publicOnly, after, }: IUseCaseCommentsOptions): IUseCaseCommentsReturn;
|
|
17
26
|
//# sourceMappingURL=useCaseComments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCaseComments.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/useCaseComments.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCaseComments.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useCaseComments/useCaseComments.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAOvE,OAAO,EAAuB,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,WAAW,sBAAsB;IACnC,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;IAChC,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,aAAa,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACzC;AAgBD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,EAC5B,MAAM,EACN,IAAI,EACJ,OAAO,EACP,KAAK,EACL,UAAU,EACV,KAAK,GACR,EAAE,uBAAuB,GAAG,sBAAsB,CA4GlD"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { NetworkStatus } from '@apollo/client/core';
|
|
1
2
|
import { useQuery } from '@apollo/client/react';
|
|
2
3
|
import { ability, CaseDiscussionFields, resourceActions, resources } from '@rh-support/user-permissions';
|
|
3
4
|
import clamp from 'lodash/clamp';
|
|
4
|
-
import { useMemo } from 'react';
|
|
5
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
5
6
|
import { GET_CASE_COMMENTS } from './caseCommentsQuery';
|
|
6
7
|
import { mapCaseCommentsResponse } from './mapCaseComment';
|
|
7
8
|
const MAX_FIRST = 2000;
|
|
8
9
|
const MIN_FIRST = 1;
|
|
10
|
+
const DEFAULT_PAGE_SIZE = 20;
|
|
9
11
|
function buildCaseCommentsFilter(caseId, publicOnly) {
|
|
10
12
|
if (publicOnly) {
|
|
11
13
|
return {
|
|
@@ -20,19 +22,92 @@ function buildCaseCommentsFilter(caseId, publicOnly) {
|
|
|
20
22
|
* Supports custom sort ordering and pagination clamping (1–2000 records).
|
|
21
23
|
* External / customer users (no VIEW_PRIVATE_COMMENT) only receive Public comments.
|
|
22
24
|
* Returns mapped ICaseComment[] along with loading, error, and refetch handles.
|
|
25
|
+
*
|
|
26
|
+
* Pagination uses Apollo's fetchMore; pages accumulate in the cache via
|
|
27
|
+
* relayStylePagination. nextFetchPolicy returns 'cache-first' after the first
|
|
28
|
+
* result so cache-and-network does not refetch and overwrite merged pages.
|
|
23
29
|
*/
|
|
24
|
-
export function useCaseComments({ caseId, skip, orderBy, first, publicOnly, }) {
|
|
30
|
+
export function useCaseComments({ caseId, skip, orderBy, first, publicOnly, after, }) {
|
|
31
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
25
32
|
const canSeePrivateComments = ability.can(resourceActions.PATCH, resources.CASE_COMMENTS, CaseDiscussionFields.VIEW_PRIVATE_COMMENT);
|
|
26
33
|
const shouldFilterPublicOnly = publicOnly !== null && publicOnly !== void 0 ? publicOnly : !canSeePrivateComments;
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
orderBy: orderBy !== null && orderBy !== void 0 ? orderBy : { LastModifiedDate: { order: 'DESC' } },
|
|
31
|
-
first: clamp(first !== null && first !== void 0 ? first : MAX_FIRST, MIN_FIRST, MAX_FIRST),
|
|
32
|
-
},
|
|
34
|
+
const clampedFirst = clamp(first !== null && first !== void 0 ? first : DEFAULT_PAGE_SIZE, MIN_FIRST, MAX_FIRST);
|
|
35
|
+
const { data, loading, error, refetch, fetchMore: apolloFetchMore, networkStatus, } = useQuery(GET_CASE_COMMENTS, {
|
|
36
|
+
variables: Object.assign({ filter: buildCaseCommentsFilter(caseId, shouldFilterPublicOnly), orderBy: orderBy !== null && orderBy !== void 0 ? orderBy : { LastModifiedDate: { order: 'DESC' } }, first: clampedFirst }, (after ? { after } : {})),
|
|
33
37
|
skip: skip || !caseId,
|
|
34
38
|
fetchPolicy: 'cache-and-network',
|
|
39
|
+
nextFetchPolicy(_currentFetchPolicy, { reason }) {
|
|
40
|
+
if (reason === 'variables-changed') {
|
|
41
|
+
return 'cache-and-network';
|
|
42
|
+
}
|
|
43
|
+
return 'cache-first';
|
|
44
|
+
},
|
|
45
|
+
notifyOnNetworkStatusChange: true,
|
|
35
46
|
});
|
|
47
|
+
const [loadMoreError, setLoadMoreError] = useState(false);
|
|
48
|
+
const [loadMoreRetryCount, setLoadMoreRetryCount] = useState(0);
|
|
49
|
+
const fetchLockRef = useRef(false);
|
|
50
|
+
const pageInfo = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.redhat_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.RedHatSupportCaseComment__c) === null || _c === void 0 ? void 0 : _c.pageInfo;
|
|
51
|
+
const hasNextPage = (_d = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.hasNextPage) !== null && _d !== void 0 ? _d : false;
|
|
52
|
+
const endCursor = (_e = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.endCursor) !== null && _e !== void 0 ? _e : null;
|
|
53
|
+
const isLoadingMore = networkStatus === NetworkStatus.fetchMore;
|
|
36
54
|
const comments = useMemo(() => mapCaseCommentsResponse(data), [data]);
|
|
37
|
-
|
|
55
|
+
// DEBUG: track every render of the hook
|
|
56
|
+
const edgeCount = (_k = (_j = (_h = (_g = (_f = data === null || data === void 0 ? void 0 : data.redhat_support_uiapi) === null || _f === void 0 ? void 0 : _f.query) === null || _g === void 0 ? void 0 : _g.RedHatSupportCaseComment__c) === null || _h === void 0 ? void 0 : _h.edges) === null || _j === void 0 ? void 0 : _j.length) !== null && _k !== void 0 ? _k : 0;
|
|
57
|
+
console.log('[useCaseComments] render', {
|
|
58
|
+
networkStatus,
|
|
59
|
+
loading,
|
|
60
|
+
isLoadingMore,
|
|
61
|
+
hasNextPage,
|
|
62
|
+
endCursor: endCursor === null || endCursor === void 0 ? void 0 : endCursor.slice(0, 20),
|
|
63
|
+
edgeCount,
|
|
64
|
+
commentsMapped: comments.length,
|
|
65
|
+
fetchLocked: fetchLockRef.current,
|
|
66
|
+
});
|
|
67
|
+
const fetchMore = useCallback(() => {
|
|
68
|
+
if (fetchLockRef.current || !hasNextPage || !endCursor) {
|
|
69
|
+
console.log('[useCaseComments] fetchMore SKIPPED', {
|
|
70
|
+
fetchLocked: fetchLockRef.current,
|
|
71
|
+
hasNextPage,
|
|
72
|
+
endCursor: !!endCursor,
|
|
73
|
+
});
|
|
74
|
+
return Promise.resolve();
|
|
75
|
+
}
|
|
76
|
+
fetchLockRef.current = true;
|
|
77
|
+
setLoadMoreError(false);
|
|
78
|
+
console.log('[useCaseComments] fetchMore START', { endCursor: endCursor === null || endCursor === void 0 ? void 0 : endCursor.slice(0, 20) });
|
|
79
|
+
return apolloFetchMore({
|
|
80
|
+
variables: { after: endCursor },
|
|
81
|
+
})
|
|
82
|
+
.then(() => {
|
|
83
|
+
console.log('[useCaseComments] fetchMore SUCCESS');
|
|
84
|
+
setLoadMoreRetryCount(0);
|
|
85
|
+
setLoadMoreError(false);
|
|
86
|
+
})
|
|
87
|
+
.catch((err) => {
|
|
88
|
+
console.log('[useCaseComments] fetchMore ERROR', err === null || err === void 0 ? void 0 : err.message);
|
|
89
|
+
setLoadMoreError(true);
|
|
90
|
+
setLoadMoreRetryCount((prev) => prev + 1);
|
|
91
|
+
})
|
|
92
|
+
.finally(() => {
|
|
93
|
+
fetchLockRef.current = false;
|
|
94
|
+
});
|
|
95
|
+
}, [hasNextPage, endCursor, apolloFetchMore]);
|
|
96
|
+
const retryLoadMore = useCallback(() => {
|
|
97
|
+
setLoadMoreError(false);
|
|
98
|
+
fetchLockRef.current = false;
|
|
99
|
+
return fetchMore();
|
|
100
|
+
}, [fetchMore]);
|
|
101
|
+
return {
|
|
102
|
+
comments,
|
|
103
|
+
loading,
|
|
104
|
+
error,
|
|
105
|
+
refetch,
|
|
106
|
+
fetchMore,
|
|
107
|
+
hasNextPage,
|
|
108
|
+
isLoadingMore,
|
|
109
|
+
loadMoreError,
|
|
110
|
+
loadMoreRetryCount,
|
|
111
|
+
retryLoadMore,
|
|
112
|
+
};
|
|
38
113
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type TypedDocumentNode } from '@apollo/client';
|
|
2
|
-
import type { ICaseHistoryItem, IGetCaseHistoryData, IGetCaseHistoryVars } from '../models/caseHistory';
|
|
2
|
+
import type { CaseHistorySortOrder, ICaseHistoryItem, IGetCaseHistoryData, IGetCaseHistoryVars } from '../models/caseHistory';
|
|
3
3
|
/**
|
|
4
4
|
* OldValue/NewValue use inline fragments with aliased fields (e.g. `stringValue: value`).
|
|
5
5
|
* These aliases produce the property names that `extractStringValue` checks against.
|
|
@@ -21,6 +21,6 @@ interface UseCaseHistoryResult {
|
|
|
21
21
|
loading: boolean;
|
|
22
22
|
error: Error | undefined;
|
|
23
23
|
}
|
|
24
|
-
export declare function useCaseHistory(caseId: string | undefined, first?: number): UseCaseHistoryResult;
|
|
24
|
+
export declare function useCaseHistory(caseId: string | undefined, isViewerInternal?: boolean, sortOrder?: CaseHistorySortOrder, first?: number): UseCaseHistoryResult;
|
|
25
25
|
export {};
|
|
26
26
|
//# sourceMappingURL=useCaseHistory.d.ts.map
|
|
@@ -1 +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,
|
|
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,EACR,oBAAoB,EAEpB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,uBAAuB,CAAC;AAG/B;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,EAAE,iBAAiB,CAAC,mBAAmB,EAAE,mBAAmB,CAiExF,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,CAC1B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,gBAAgB,UAAO,EACvB,SAAS,GAAE,oBAA6B,EACxC,KAAK,SAAO,GACb,oBAAoB,CAqBtB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
2
|
import { useQuery } from '@apollo/client/react';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
|
-
import { filterSfdcIdEntries, normalizeNodeToHistoryItem } from '../utils/caseHistoryUtils';
|
|
4
|
+
import { filterInternalOnlyEntries, filterSfdcIdEntries, normalizeNodeToHistoryItem } from '../utils/caseHistoryUtils';
|
|
5
5
|
/**
|
|
6
6
|
* OldValue/NewValue use inline fragments with aliased fields (e.g. `stringValue: value`).
|
|
7
7
|
* These aliases produce the property names that `extractStringValue` checks against.
|
|
@@ -18,10 +18,14 @@ import { filterSfdcIdEntries, normalizeNodeToHistoryItem } from '../utils/caseHi
|
|
|
18
18
|
* histories while staying well within the SF API limit.
|
|
19
19
|
*/
|
|
20
20
|
export const GET_CASE_HISTORY = gql `
|
|
21
|
-
query GetCaseHistory(
|
|
21
|
+
query GetCaseHistory(
|
|
22
|
+
$caseId: ID!
|
|
23
|
+
$first: Int = 2000
|
|
24
|
+
$orderBy: RedHatSupportCaseHistory_OrderBy = { CreatedDate: { order: DESC } }
|
|
25
|
+
) {
|
|
22
26
|
redhat_support_uiapi {
|
|
23
27
|
query {
|
|
24
|
-
RedHatSupportCaseHistory(first: $first, where: { CaseId: { eq: $caseId } }) {
|
|
28
|
+
RedHatSupportCaseHistory(first: $first, where: { CaseId: { eq: $caseId } }, orderBy: $orderBy) {
|
|
25
29
|
edges {
|
|
26
30
|
node {
|
|
27
31
|
Id
|
|
@@ -79,9 +83,13 @@ export const GET_CASE_HISTORY = gql `
|
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
85
|
`;
|
|
82
|
-
export function useCaseHistory(caseId, first = 2000) {
|
|
86
|
+
export function useCaseHistory(caseId, isViewerInternal = true, sortOrder = 'DESC', first = 2000) {
|
|
83
87
|
const { data, loading, error } = useQuery(GET_CASE_HISTORY, {
|
|
84
|
-
variables: {
|
|
88
|
+
variables: {
|
|
89
|
+
caseId: caseId || '',
|
|
90
|
+
first,
|
|
91
|
+
orderBy: { CreatedDate: { order: sortOrder } },
|
|
92
|
+
},
|
|
85
93
|
// Empty string = no case selected; skip avoids a wasted network request.
|
|
86
94
|
skip: !caseId,
|
|
87
95
|
// Shows cached data immediately while revalidating, avoiding a loading flash on re-visits.
|
|
@@ -92,7 +100,8 @@ export function useCaseHistory(caseId, first = 2000) {
|
|
|
92
100
|
const edges = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.redhat_support_uiapi) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.RedHatSupportCaseHistory) === null || _c === void 0 ? void 0 : _c.edges;
|
|
93
101
|
if (!edges)
|
|
94
102
|
return [];
|
|
95
|
-
|
|
96
|
-
|
|
103
|
+
const normalized = filterSfdcIdEntries(edges).map(normalizeNodeToHistoryItem);
|
|
104
|
+
return isViewerInternal ? normalized : filterInternalOnlyEntries(normalized);
|
|
105
|
+
}, [data, isViewerInternal]);
|
|
97
106
|
return { historyItems, loading, error };
|
|
98
107
|
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
export type CaseUpdateErrorContent = {
|
|
2
|
+
title: string;
|
|
3
|
+
message: string;
|
|
4
|
+
onRetry?: () => unknown;
|
|
5
|
+
};
|
|
6
|
+
export declare function getErrorStatusCode(error: unknown): number;
|
|
7
|
+
export declare function isGenericNetworkError(error: unknown): boolean;
|
|
1
8
|
export declare function useCaseUpdateErrorMessage(): {
|
|
2
|
-
showError: (e:
|
|
9
|
+
showError: (e: unknown, fallbackOrContent: string | CaseUpdateErrorContent) => void;
|
|
10
|
+
showFieldError: (e: unknown, fieldName: string, onRetry?: () => unknown) => void;
|
|
3
11
|
};
|
|
4
12
|
//# sourceMappingURL=useCaseUpdateErrorMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCaseUpdateErrorMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCaseUpdateErrorMessage.
|
|
1
|
+
{"version":3,"file":"useCaseUpdateErrorMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCaseUpdateErrorMessage.tsx"],"names":[],"mappings":"AAQA,MAAM,MAAM,sBAAsB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC;CAC3B,CAAC;AA8BF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAsBzD;AAOD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAK7D;AAED,wBAAgB,yBAAyB;mBAgCf,OAAO,qBAAqB,MAAM,GAAG,sBAAsB;wBA2CtD,OAAO,aAAa,MAAM,YAAY,MAAM,OAAO;EAYjF"}
|
|
@@ -1,27 +1,114 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AlertActionLink } from '@patternfly/react-core';
|
|
2
|
+
import { getDirectErrorMessage, ToastNotification } from '@rh-support/components';
|
|
3
|
+
import React from 'react';
|
|
2
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
+
const PICKLIST_VALIDATION_PATTERN = /is not a valid active picklist value/i;
|
|
6
|
+
const CASE_GROUP_REQUIRED_PATTERN = /group.*required|required.*group/i;
|
|
7
|
+
function isCaseUpdateErrorContent(value) {
|
|
8
|
+
return typeof value === 'object' && value !== null && 'title' in value && 'message' in value;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Extracts the raw error string from a GraphQL or REST error object,
|
|
12
|
+
* checking common shapes (ApolloError, plain Error, API response).
|
|
13
|
+
*/
|
|
14
|
+
function extractRawMessage(e) {
|
|
15
|
+
if (!e || typeof e !== 'object')
|
|
16
|
+
return '';
|
|
17
|
+
const err = e;
|
|
18
|
+
const graphQLErrors = err.graphQLErrors;
|
|
19
|
+
if (Array.isArray(graphQLErrors) && graphQLErrors.length > 0) {
|
|
20
|
+
return graphQLErrors.map((g) => g.message || '').join('; ');
|
|
21
|
+
}
|
|
22
|
+
const errors = err.errors;
|
|
23
|
+
if (Array.isArray(errors) && errors.length > 0) {
|
|
24
|
+
return errors.map((g) => g.message || '').join('; ');
|
|
25
|
+
}
|
|
26
|
+
return [err.message, err.detailMessage, err.statusText, err.responseText]
|
|
27
|
+
.filter((v) => typeof v === 'string' && v.length > 0)
|
|
28
|
+
.join(' ')
|
|
29
|
+
.trim();
|
|
30
|
+
}
|
|
31
|
+
export function getErrorStatusCode(error) {
|
|
32
|
+
var _a, _b, _c, _d, _e, _f;
|
|
33
|
+
if (!error || typeof error !== 'object') {
|
|
34
|
+
return parseStatusFromMessage(String(error !== null && error !== void 0 ? error : ''));
|
|
35
|
+
}
|
|
36
|
+
const e = error;
|
|
37
|
+
const fromCode = Number.parseInt(String((_b = (_a = e.code) !== null && _a !== void 0 ? _a : e.status) !== null && _b !== void 0 ? _b : ''), 10);
|
|
38
|
+
if (fromCode) {
|
|
39
|
+
return fromCode;
|
|
40
|
+
}
|
|
41
|
+
const fromNetwork = Number.parseInt(String((_f = (_d = (_c = e.networkError) === null || _c === void 0 ? void 0 : _c.statusCode) !== null && _d !== void 0 ? _d : (_e = e.networkError) === null || _e === void 0 ? void 0 : _e.status) !== null && _f !== void 0 ? _f : ''), 10);
|
|
42
|
+
if (fromNetwork) {
|
|
43
|
+
return fromNetwork;
|
|
44
|
+
}
|
|
45
|
+
return parseStatusFromMessage(String(e.message || ''));
|
|
46
|
+
}
|
|
47
|
+
function parseStatusFromMessage(message) {
|
|
48
|
+
const match = message.match(/status code\s+(\d+)/i);
|
|
49
|
+
return match ? Number.parseInt(match[1], 10) : 0;
|
|
50
|
+
}
|
|
51
|
+
export function isGenericNetworkError(error) {
|
|
52
|
+
const message = typeof error === 'string' ? error : String((error === null || error === void 0 ? void 0 : error.message) || '');
|
|
53
|
+
return /Response not successful|Failed to fetch|Network request failed|NetworkError when attempting to fetch|Received status code\s+\d+/i.test(message);
|
|
54
|
+
}
|
|
3
55
|
export function useCaseUpdateErrorMessage() {
|
|
4
56
|
const { t } = useTranslation();
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
57
|
+
const showDesignedError = (content) => {
|
|
58
|
+
ToastNotification.addDangerMessage(content.title, content.message, {
|
|
59
|
+
closeOnClick: false,
|
|
60
|
+
actionLinks: (closeToast) => (React.createElement(React.Fragment, null,
|
|
61
|
+
React.createElement(AlertActionLink, { "data-tracking-id": "case-update-error-try-again", onClick: () => {
|
|
62
|
+
closeToast === null || closeToast === void 0 ? void 0 : closeToast();
|
|
63
|
+
if (content.onRetry) {
|
|
64
|
+
void content.onRetry();
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
window.location.reload();
|
|
68
|
+
}
|
|
69
|
+
} }, t('Try again')),
|
|
70
|
+
React.createElement(AlertActionLink, { "data-tracking-id": "case-update-error-refresh", onClick: () => window.location.reload() }, t('Refresh the page')))),
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
const showError = (e, fallbackOrContent) => {
|
|
74
|
+
const errorCode = getErrorStatusCode(e);
|
|
75
|
+
const rawMessage = extractRawMessage(e);
|
|
76
|
+
if (errorCode === 403) {
|
|
77
|
+
ToastNotification.addDangerMessage(t('There was a problem with your request'), t('You are not authorized to update this case.'));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (PICKLIST_VALIDATION_PATTERN.test(rawMessage)) {
|
|
81
|
+
ToastNotification.addDangerMessage(t('The value you selected is no longer valid. Please choose a different option and try again.'));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (CASE_GROUP_REQUIRED_PATTERN.test(rawMessage)) {
|
|
85
|
+
ToastNotification.addDangerMessage(t('Case Group is required for this account and cannot be removed.'));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (isCaseUpdateErrorContent(fallbackOrContent)) {
|
|
89
|
+
showDesignedError(fallbackOrContent);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (errorCode === 500 || isGenericNetworkError(e)) {
|
|
93
|
+
ToastNotification.addDangerMessage(fallbackOrContent);
|
|
17
94
|
return;
|
|
18
95
|
}
|
|
19
96
|
const directMessage = getDirectErrorMessage(e);
|
|
20
|
-
if (directMessage) {
|
|
97
|
+
if (directMessage && !isGenericNetworkError(directMessage)) {
|
|
21
98
|
ToastNotification.addDangerMessage(directMessage);
|
|
22
99
|
return;
|
|
23
100
|
}
|
|
24
|
-
ToastNotification.addDangerMessage(
|
|
101
|
+
ToastNotification.addDangerMessage(fallbackOrContent);
|
|
102
|
+
};
|
|
103
|
+
const showFieldError = (e, fieldName, onRetry) => {
|
|
104
|
+
const field = t(fieldName);
|
|
105
|
+
showError(e, {
|
|
106
|
+
title: t('{{field}} update failed', { field }),
|
|
107
|
+
message: t('{{field}} could not be updated. Please try again or refresh the page and try once more.', {
|
|
108
|
+
field,
|
|
109
|
+
}),
|
|
110
|
+
onRetry,
|
|
111
|
+
});
|
|
25
112
|
};
|
|
26
|
-
return { showError };
|
|
113
|
+
return { showError, showFieldError };
|
|
27
114
|
}
|
|
@@ -47,9 +47,15 @@ export interface IGetCaseHistoryData {
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
+
export type CaseHistorySortOrder = 'ASC' | 'DESC';
|
|
50
51
|
export interface IGetCaseHistoryVars {
|
|
51
52
|
caseId: string;
|
|
52
53
|
first?: number;
|
|
54
|
+
orderBy?: {
|
|
55
|
+
CreatedDate: {
|
|
56
|
+
order: CaseHistorySortOrder;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
53
59
|
}
|
|
54
60
|
/**
|
|
55
61
|
* Normalized representation of a single Salesforce case history entry.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caseHistory.d.ts","sourceRoot":"","sources":["../../../src/models/caseHistory.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC3B,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC5B,YAAY,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC3B,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC7B,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,OAAO,GAAG,cAAc,GAAG,eAAe,GAAG,cAAc,GAAG,gBAAgB,GAAG,IAAI,CAAC;AAElG,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,kBAAkB,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACzF,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE;QACP,IAAI,EAAE;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC;QACxB,QAAQ,EAAE;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC;QACnC,aAAa,EAAE;YAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,GAAG,IAAI,CAAC;KAClD,CAAC;IACF,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAClC;AAED,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,gBAAgB,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAChC,oBAAoB,EAAE;QAClB,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B,IAAI,EAAE,gBAAgB,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAChC,oBAAoB,EAAE;QAClB,KAAK,EAAE;YACH,wBAAwB,EAAE;gBACtB,KAAK,EAAE,gBAAgB,EAAE,CAAC;aAC7B,CAAC;SACL,CAAC;KACL,CAAC;CACL;AAED,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,MAAM,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE;QAAE,WAAW,EAAE;YAAE,KAAK,EAAE,oBAAoB,CAAA;SAAE,CAAA;KAAE,CAAC;CAC9D;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,oFAAoF;IACpF,SAAS,EAAE,MAAM,CAAC;IAClB,4GAA4G;IAC5G,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,6FAA6F;IAC7F,UAAU,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -48,7 +48,8 @@ export declare const setSort: (dispatch: DiscussionsReducerDispatchType, sort: I
|
|
|
48
48
|
export declare const setReplyingTo: (dispatch: DiscussionsReducerDispatchType, author: string, commentId: string, timestamp: string) => void;
|
|
49
49
|
export declare const clearReplyingTo: (dispatch: DiscussionsReducerDispatchType) => void;
|
|
50
50
|
export declare const setFilter: (dispatch: DiscussionsReducerDispatchType, selected: string[], discussionFiltersListState: IFilter[]) => void;
|
|
51
|
-
export declare const setDiscussions: (dispatch: DiscussionsReducerDispatchType, comments: ICaseComment[], chats: ICaseChat[], attachments: IAttachment[], feedbacks: ICommentFeedback[], trackerUpdates: Partial<unknown[]>, discussionFiltersListState: IFilter[], canSeeExternalTracker: boolean, canSeeChat: boolean, canSeeAttachments: boolean) => void;
|
|
51
|
+
export declare const setDiscussions: (dispatch: DiscussionsReducerDispatchType, comments: ICaseComment[], chats: ICaseChat[], attachments: IAttachment[], feedbacks: ICommentFeedback[], trackerUpdates: Partial<unknown[]>, discussionFiltersListState: IFilter[], canSeeExternalTracker: boolean, canSeeChat: boolean, canSeeAttachments: boolean, sort?: ISort) => void;
|
|
52
|
+
export declare const appendNewComments: (dispatch: DiscussionsReducerDispatchType, allComments: ICaseComment[], existingDiscussions: IDiscussion[], feedbacks: ICommentFeedback[], sort?: ISort) => void;
|
|
52
53
|
export declare const updateAttacmentsAfterRemoval: (dispatch: DiscussionsReducerDispatchType, uuid_removed: string, allDiscussions: IDiscussion[], discussionFiltersListState: IFilter[]) => void;
|
|
53
54
|
export declare const updateCommentStateFeedback: (dispatch: DiscussionsReducerDispatchType, comment_id: string, newFeedback: any, allDiscussions: IDiscussion[]) => Promise<void>;
|
|
54
55
|
export declare const updateAttachment: (dispatch: DiscussionsReducerDispatchType, uuid: string, newAttachment: any, allDiscussions: IDiscussion[]) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseDiscussionTabReducer.d.ts","sourceRoot":"","sources":["../../../src/reducers/CaseDiscussionTabReducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD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AE,CAAC,EAClC,4BAA4B,OAAO,EAAE,EAGrC,uBAAuB,OAAO,EAC9B,YAAY,OAAO,EACnB,mBAAmB,OAAO,EAC1B,OAAO,KAAK,SAkFf,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC1B,UAAU,8BAA8B,EACxC,aAAa,YAAY,EAAE,EAC3B,qBAAqB,WAAW,EAAE,EAClC,WAAW,gBAAgB,EAAE,EAC7B,OAAO,KAAK,SA+Bf,CAAC;AAEF,eAAO,MAAM,4BAA4B,GACrC,UAAU,8BAA8B,EACxC,cAAc,MAAM,EACpB,gBAAgB,WAAW,EAAE,EAC7B,4BAA4B,OAAO,EAAE,SAsBxC,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACnC,UAAU,8BAA8B,EACxC,YAAY,MAAM,EAClB,gBAAW,EACX,gBAAgB,WAAW,EAAE,kBAUhC,CAAC;AAEF,eAAO,MAAM,gBAAgB,GACzB,UAAU,8BAA8B,EACxC,MAAM,MAAM,EACZ,kBAAa,EACb,gBAAgB,WAAW,EAAE,SAUhC,CAAC;AAEF,eAAO,MAAM,gCAAgC,GACzC,UAAU,8BAA8B,EACxC,YAAY,MAAM,EAClB,gBAAgB,WAAW,EAAE,EAC7B,MAAM,KAAK,EACX,4BAA4B,OAAO,EAAE,EACrC,wCAAmC,EACnC,cAAc,iBAAiB,EAC/B,mBAAmB,MAAM,EACzB,8BAA4B,kBAoD/B,CAAC"}
|
|
@@ -92,7 +92,7 @@ export const discussionReducer = (state, action) => {
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
export const setSort = (dispatch, sort, allDiscussions) => {
|
|
95
|
-
const sortedDiscussions = orderBy(allDiscussions, 'last_modified_date', sort.sortOrder);
|
|
95
|
+
const sortedDiscussions = orderBy(allDiscussions, ['last_modified_date', (d) => { var _a; return (_a = d.item.id) !== null && _a !== void 0 ? _a : ''; }], [sort.sortOrder, sort.sortOrder]);
|
|
96
96
|
dispatch({
|
|
97
97
|
type: DiscussionsConstants.updateDiscussionState,
|
|
98
98
|
payload: { sort, allDiscussions: sortedDiscussions },
|
|
@@ -135,11 +135,12 @@ export const setDiscussions = (dispatch, comments, chats, attachments, feedbacks
|
|
|
135
135
|
trackerUpdates, discussionFiltersListState,
|
|
136
136
|
// TODO: Uncomment when External Trackers has a functioning GraphQL endpoint
|
|
137
137
|
// canSeeExternalTracker: boolean,
|
|
138
|
-
canSeeExternalTracker, canSeeChat, canSeeAttachments) => {
|
|
138
|
+
canSeeExternalTracker, canSeeChat, canSeeAttachments, sort) => {
|
|
139
139
|
// set all discussions state
|
|
140
140
|
// we need to transform discussions item because:
|
|
141
141
|
// - last_modified_date is needed for sort and field name is different in different discussion types
|
|
142
142
|
// - discussionType is needed for filter different types
|
|
143
|
+
var _a, _b;
|
|
143
144
|
const allChats = (chats || []).map((chat) => ({
|
|
144
145
|
item: Object.assign(Object.assign({}, chat), { end_time: chat.endTime || chat.startTime }),
|
|
145
146
|
last_modified_date: chat.endTime || chat.startTime,
|
|
@@ -171,7 +172,7 @@ canSeeExternalTracker, canSeeChat, canSeeAttachments) => {
|
|
|
171
172
|
// TODO: Uncomment when External Trackers has a functioning GraphQL endpoint
|
|
172
173
|
// const allDiscussions: IDiscussion[] = [...allComments, ...allChats, ...allAttachments, ...allExternalTrackers];
|
|
173
174
|
const allDiscussions = [...allComments, ...allChats, ...allAttachments];
|
|
174
|
-
const sortedAllDiscussions = orderBy(allDiscussions, 'last_modified_date', 'desc');
|
|
175
|
+
const sortedAllDiscussions = orderBy(allDiscussions, ['last_modified_date', (d) => { var _a; return (_a = d.item.id) !== null && _a !== void 0 ? _a : ''; }], [(_a = sort === null || sort === void 0 ? void 0 : sort.sortOrder) !== null && _a !== void 0 ? _a : 'desc', (_b = sort === null || sort === void 0 ? void 0 : sort.sortOrder) !== null && _b !== void 0 ? _b : 'desc']);
|
|
175
176
|
//set filter dropdown state
|
|
176
177
|
// when we don't have any result for a discussion type, in filter options dropdown list, we make that type disable
|
|
177
178
|
discussionFiltersListState.forEach((filter) => {
|
|
@@ -204,6 +205,27 @@ canSeeExternalTracker, canSeeChat, canSeeAttachments) => {
|
|
|
204
205
|
},
|
|
205
206
|
});
|
|
206
207
|
};
|
|
208
|
+
export const appendNewComments = (dispatch, allComments, existingDiscussions, feedbacks, sort) => {
|
|
209
|
+
var _a;
|
|
210
|
+
const existingCommentIds = new Set(existingDiscussions.filter((d) => d.discussionType === DiscussionType.COMMENT).map((d) => d.item.id));
|
|
211
|
+
const newComments = allComments.filter((comment) => !comment.isDraft && !existingCommentIds.has(comment.id));
|
|
212
|
+
if (newComments.length === 0)
|
|
213
|
+
return;
|
|
214
|
+
const newDiscussions = newComments.map((comment) => ({
|
|
215
|
+
item: Object.assign(Object.assign({}, comment), { isPublic: comment.isPublic === undefined ? true : comment.isPublic, last_modified_date: comment.lastModifiedDate || comment.createdDate }),
|
|
216
|
+
discussionType: DiscussionType.COMMENT,
|
|
217
|
+
last_modified_date: comment.lastModifiedDate || comment.createdDate,
|
|
218
|
+
feedback: commputeFeedback(comment.id, feedbacks),
|
|
219
|
+
}));
|
|
220
|
+
const sortOrder = (_a = sort === null || sort === void 0 ? void 0 : sort.sortOrder) !== null && _a !== void 0 ? _a : 'desc';
|
|
221
|
+
const merged = sortOrder === 'desc'
|
|
222
|
+
? [...existingDiscussions, ...newDiscussions]
|
|
223
|
+
: [...existingDiscussions, ...newDiscussions];
|
|
224
|
+
dispatch({
|
|
225
|
+
type: DiscussionsConstants.updateDiscussionState,
|
|
226
|
+
payload: { allDiscussions: merged },
|
|
227
|
+
});
|
|
228
|
+
};
|
|
207
229
|
export const updateAttacmentsAfterRemoval = (dispatch, uuid_removed, allDiscussions, discussionFiltersListState) => {
|
|
208
230
|
const index = findIndex(allDiscussions, (discussion) => discussion.discussionType === DiscussionType.ATTACHMENT &&
|
|
209
231
|
discussion.item.uuid === uuid_removed);
|
|
@@ -257,7 +279,7 @@ export const updateDiscussionStateAttachments = (dispatch_1, caseNumber_1, allDi
|
|
|
257
279
|
discussionType: DiscussionType.ATTACHMENT,
|
|
258
280
|
}));
|
|
259
281
|
const filteredDiscussion = filter([...allDiscussions], (o) => o.discussionType !== DiscussionType.ATTACHMENT);
|
|
260
|
-
const updatedDiscussions = orderBy([...filteredDiscussion, ...allAttachments], 'last_modified_date', sort.sortOrder);
|
|
282
|
+
const updatedDiscussions = orderBy([...filteredDiscussion, ...allAttachments], ['last_modified_date', (d) => { var _a; return (_a = d.item.id) !== null && _a !== void 0 ? _a : ''; }], [sort.sortOrder, sort.sortOrder]);
|
|
261
283
|
discussionFiltersListState.forEach((filter) => {
|
|
262
284
|
if (filter.value === DiscussionType.ATTACHMENT) {
|
|
263
285
|
filter.isDisabled = false;
|
|
@@ -49,6 +49,25 @@ export declare function deriveIsCustomer(userType: string | null | undefined): b
|
|
|
49
49
|
* - At least one side is a human-readable string → **keep**
|
|
50
50
|
*/
|
|
51
51
|
export declare function filterSfdcIdEntries(edges: ICaseHistoryEdge[]): ICaseHistoryNode[];
|
|
52
|
+
/**
|
|
53
|
+
* Field names whose history entries are internal-only and should be hidden
|
|
54
|
+
* from customer/external viewers in the History tab.
|
|
55
|
+
*
|
|
56
|
+
* Includes both real SF API field names and synthetic lifecycle pseudo-fields
|
|
57
|
+
* produced by the SF History API.
|
|
58
|
+
*/
|
|
59
|
+
export declare const INTERNAL_ONLY_FIELDS: ReadonlySet<string>;
|
|
60
|
+
/**
|
|
61
|
+
* Removes history items that represent internal-only case activity.
|
|
62
|
+
*
|
|
63
|
+
* Filters by field name rather than by author, because internal activity
|
|
64
|
+
* (ownership transfers, status changes, routing) can be triggered by system
|
|
65
|
+
* processes whose `CreatedBy.UserType` varies.
|
|
66
|
+
*
|
|
67
|
+
* Used when the viewer is an external/customer user to prevent internal case
|
|
68
|
+
* activities from leaking to customers.
|
|
69
|
+
*/
|
|
70
|
+
export declare function filterInternalOnlyEntries(items: ICaseHistoryItem[]): ICaseHistoryItem[];
|
|
52
71
|
/**
|
|
53
72
|
* Converts a raw SF history node into a normalized `ICaseHistoryItem`.
|
|
54
73
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caseHistoryUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/caseHistoryUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAE3G;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"caseHistoryUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/caseHistoryUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAE3G;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqBzD,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKzE;AAMD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAO9D;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAOxD,CAAC;AAEF,eAAO,MAAM,kBAAkB,mDAAmD,CAAC;AAInF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAG7E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAajF;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,CASnD,CAAC;AAEH;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAEvF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAuCnF"}
|
|
@@ -27,6 +27,7 @@ export const FIELD_NAME_DISPLAY_MAP = {
|
|
|
27
27
|
SlaStartDate: 'SLA Start Date',
|
|
28
28
|
Case_Language__c: 'Case Language',
|
|
29
29
|
SBR_Group__c: 'SBR Group',
|
|
30
|
+
Subject: 'Title',
|
|
30
31
|
};
|
|
31
32
|
export function getFieldDisplayName(fieldName) {
|
|
32
33
|
if (fieldName in FIELD_NAME_DISPLAY_MAP) {
|
|
@@ -118,6 +119,36 @@ export function filterSfdcIdEntries(edges) {
|
|
|
118
119
|
return true;
|
|
119
120
|
});
|
|
120
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Field names whose history entries are internal-only and should be hidden
|
|
124
|
+
* from customer/external viewers in the History tab.
|
|
125
|
+
*
|
|
126
|
+
* Includes both real SF API field names and synthetic lifecycle pseudo-fields
|
|
127
|
+
* produced by the SF History API.
|
|
128
|
+
*/
|
|
129
|
+
export const INTERNAL_ONLY_FIELDS = new Set([
|
|
130
|
+
'ownerAssignment',
|
|
131
|
+
'ownerAccepted',
|
|
132
|
+
'ownerEscalated',
|
|
133
|
+
'OwnerId',
|
|
134
|
+
'Status',
|
|
135
|
+
'SBR_Group__c',
|
|
136
|
+
'BusinessHoursId',
|
|
137
|
+
'EntitlementId',
|
|
138
|
+
]);
|
|
139
|
+
/**
|
|
140
|
+
* Removes history items that represent internal-only case activity.
|
|
141
|
+
*
|
|
142
|
+
* Filters by field name rather than by author, because internal activity
|
|
143
|
+
* (ownership transfers, status changes, routing) can be triggered by system
|
|
144
|
+
* processes whose `CreatedBy.UserType` varies.
|
|
145
|
+
*
|
|
146
|
+
* Used when the viewer is an external/customer user to prevent internal case
|
|
147
|
+
* activities from leaking to customers.
|
|
148
|
+
*/
|
|
149
|
+
export function filterInternalOnlyEntries(items) {
|
|
150
|
+
return items.filter((item) => !INTERNAL_ONLY_FIELDS.has(item.fieldName));
|
|
151
|
+
}
|
|
121
152
|
/**
|
|
122
153
|
* Converts a raw SF history node into a normalized `ICaseHistoryItem`.
|
|
123
154
|
*
|