@rh-support/cases 2.6.198 → 2.6.199
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseList.d.ts","sourceRoot":"","sources":["../../../../src/components/case-list/CaseList.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"CaseList.d.ts","sourceRoot":"","sources":["../../../../src/components/case-list/CaseList.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AAsClC,OAAO,KAAkD,MAAM,OAAO,CAAC;AAGvE,OAAO,EAAE,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAqC1C,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAMD,MAAM,WAAW,gBAAgB;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,qBA0lBrC"}
|
|
@@ -13,7 +13,7 @@ import { useApolloClient } from '@apollo/client/react';
|
|
|
13
13
|
import { Alert, AlertActionCloseButton, AlertVariant, Button } from '@patternfly/react-core';
|
|
14
14
|
import OpenDrawerRightIcon from '@patternfly/react-icons/dist/js/icons/open-drawer-right-icon';
|
|
15
15
|
import { ErrorBoundary, ToastNotification, useBreakpoint, useDocumentTitle, useForceUpdate, } from '@rh-support/components';
|
|
16
|
-
import { CSSUserModal, fetchAllStatuses, fetchCaseGroupsForAccount, fetchCaseGroupsForSSO,
|
|
16
|
+
import { CSSUserModal, fetchAllStatuses, fetchCaseGroupsForAccount, fetchCaseGroupsForSSO, fetchCaseSeverities, fetchCaseTypes, fetchProducts, GlobalMetadataDispatchContext, GlobalMetadataStateContext, setUserPreferences, updateCaseListTraditionalSupportAgreed, updateUserPreferences, useGlobalDispatchContext, UserPreferencesKeys, } from '@rh-support/react-context';
|
|
17
17
|
import { getStringifiedParams, getUrlParsedParams, haventLoadedMetadata, haventLoadedProductsMetadata, pendoTrackEvent, } from '@rh-support/utils';
|
|
18
18
|
import isEmpty from 'lodash/isEmpty';
|
|
19
19
|
import some from 'lodash/some';
|
|
@@ -67,6 +67,9 @@ export function CaseList(props) {
|
|
|
67
67
|
const [RHCDValue, setRHCDValue] = useState('');
|
|
68
68
|
const [isRHCDAlertShown, setIsRHCDAlertShown] = useState(true);
|
|
69
69
|
const loadMoreLockRef = useRef(false);
|
|
70
|
+
const loadMoreFnRef = useRef(() => { });
|
|
71
|
+
const loadMoreCooldownRef = useRef(false);
|
|
72
|
+
const activeFilterStateRef = useRef(filterState);
|
|
70
73
|
const sentinelElRef = useRef(null);
|
|
71
74
|
const prefetchRef = useRef({
|
|
72
75
|
cursor: '',
|
|
@@ -82,7 +85,7 @@ export function CaseList(props) {
|
|
|
82
85
|
if (!cursor || prefetchRef.current.cursor === cursor)
|
|
83
86
|
return;
|
|
84
87
|
prefetchRef.current = { cursor, data: null, loading: true };
|
|
85
|
-
loadMoreCases(
|
|
88
|
+
loadMoreCases(activeFilterStateRef.current, apolloClient, cursor)
|
|
86
89
|
.then((result) => {
|
|
87
90
|
if (prefetchRef.current.cursor === cursor) {
|
|
88
91
|
prefetchRef.current = { cursor, data: result, loading: false };
|
|
@@ -96,6 +99,7 @@ export function CaseList(props) {
|
|
|
96
99
|
}
|
|
97
100
|
useEffect(() => {
|
|
98
101
|
let ticking = false;
|
|
102
|
+
let triggered = false;
|
|
99
103
|
const onScroll = () => {
|
|
100
104
|
if (ticking)
|
|
101
105
|
return;
|
|
@@ -105,21 +109,37 @@ export function CaseList(props) {
|
|
|
105
109
|
if (!sentinelElRef.current)
|
|
106
110
|
return;
|
|
107
111
|
const rect = sentinelElRef.current.getBoundingClientRect();
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
const isNear = rect.top <= window.innerHeight + 600;
|
|
113
|
+
if (!isNear) {
|
|
114
|
+
triggered = false;
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (!triggered && !loadMoreLockRef.current) {
|
|
118
|
+
triggered = true;
|
|
119
|
+
loadMoreFnRef.current();
|
|
110
120
|
}
|
|
111
121
|
});
|
|
112
122
|
};
|
|
113
123
|
window.addEventListener('scroll', onScroll, true);
|
|
114
124
|
return () => window.removeEventListener('scroll', onScroll, true);
|
|
115
|
-
|
|
116
|
-
}, [hasNextPage, isLoadingMore, loadMoreError, endCursor]);
|
|
125
|
+
}, []);
|
|
117
126
|
useEffect(() => {
|
|
118
127
|
if (inView && hasNextPage && !isLoadingMore && !loadMoreError) {
|
|
119
128
|
loadMore();
|
|
120
129
|
}
|
|
121
130
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
122
|
-
}, [inView
|
|
131
|
+
}, [inView]);
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
const onClick = (e) => {
|
|
134
|
+
const anchor = e.target.closest('a.btn_slideto[href="#masthead"]');
|
|
135
|
+
if (anchor) {
|
|
136
|
+
e.preventDefault();
|
|
137
|
+
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
document.addEventListener('click', onClick, true);
|
|
141
|
+
return () => document.removeEventListener('click', onClick, true);
|
|
142
|
+
}, []);
|
|
123
143
|
function getCases(currentFilterState) {
|
|
124
144
|
return __awaiter(this, void 0, void 0, function* () {
|
|
125
145
|
var _a;
|
|
@@ -132,6 +152,8 @@ export function CaseList(props) {
|
|
|
132
152
|
setIsFetching(CaseListDispatch, true);
|
|
133
153
|
setHasError(false);
|
|
134
154
|
prefetchRef.current = { cursor: '', data: null, loading: false };
|
|
155
|
+
loadMoreCooldownRef.current = true;
|
|
156
|
+
activeFilterStateRef.current = currentFilterState;
|
|
135
157
|
const result = yield getCaseListFromGraphQL(currentFilterState, apolloClient, undefined, controller.signal);
|
|
136
158
|
if (controller.signal.aborted) {
|
|
137
159
|
return;
|
|
@@ -139,6 +161,9 @@ export function CaseList(props) {
|
|
|
139
161
|
setCaseList(CaseListDispatch, result.caseListResponse.response);
|
|
140
162
|
setCursorInfo(CaseListDispatch, result.hasNextPage, result.endCursor);
|
|
141
163
|
setIsFetching(CaseListDispatch, false);
|
|
164
|
+
setTimeout(() => {
|
|
165
|
+
loadMoreCooldownRef.current = false;
|
|
166
|
+
}, 500);
|
|
142
167
|
if (result.hasNextPage && result.endCursor) {
|
|
143
168
|
startPrefetch(result.endCursor);
|
|
144
169
|
}
|
|
@@ -159,7 +184,12 @@ export function CaseList(props) {
|
|
|
159
184
|
}
|
|
160
185
|
function loadMore() {
|
|
161
186
|
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
-
if (
|
|
187
|
+
if (loadMoreCooldownRef.current ||
|
|
188
|
+
loadMoreLockRef.current ||
|
|
189
|
+
isLoadingMore ||
|
|
190
|
+
!hasNextPage ||
|
|
191
|
+
!endCursor ||
|
|
192
|
+
loadMoreError)
|
|
163
193
|
return;
|
|
164
194
|
loadMoreLockRef.current = true;
|
|
165
195
|
setIsLoadingMore(CaseListDispatch, true);
|
|
@@ -172,7 +202,7 @@ export function CaseList(props) {
|
|
|
172
202
|
}
|
|
173
203
|
else {
|
|
174
204
|
prefetchRef.current = { cursor: '', data: null, loading: false };
|
|
175
|
-
result = yield loadMoreCases(
|
|
205
|
+
result = yield loadMoreCases(activeFilterStateRef.current, apolloClient, endCursor);
|
|
176
206
|
}
|
|
177
207
|
setLoadMoreError(CaseListDispatch, false, 0);
|
|
178
208
|
appendCaseList(CaseListDispatch, result.docs, result.hasNextPage, result.endCursor);
|
|
@@ -190,8 +220,10 @@ export function CaseList(props) {
|
|
|
190
220
|
}
|
|
191
221
|
});
|
|
192
222
|
}
|
|
223
|
+
loadMoreFnRef.current = loadMore;
|
|
193
224
|
function retryLoadMore() {
|
|
194
225
|
setLoadMoreError(CaseListDispatch, false, loadMoreRetryCount);
|
|
226
|
+
setTimeout(() => loadMoreFnRef.current(), 0);
|
|
195
227
|
}
|
|
196
228
|
const toggleFilterSection = (isExpanded) => {
|
|
197
229
|
if (!filterSectionRef.current)
|
|
@@ -254,9 +286,6 @@ export function CaseList(props) {
|
|
|
254
286
|
}, [caseGroups, dispatchToGlobalMetadataReducer, apolloClient, salesforceAccountId, loggedInUsersAccount.data]);
|
|
255
287
|
useEffect(() => {
|
|
256
288
|
const loadMetadata = () => __awaiter(this, void 0, void 0, function* () {
|
|
257
|
-
if (haventLoadedMetadata(caseRecordTypes)) {
|
|
258
|
-
yield fetchCaseRecordTypes(dispatchToGlobalMetadataReducer, apolloClient);
|
|
259
|
-
}
|
|
260
289
|
if (haventLoadedMetadata(allCaseTypes)) {
|
|
261
290
|
fetchCaseTypes(dispatchToGlobalMetadataReducer, apolloClient);
|
|
262
291
|
}
|
|
@@ -272,15 +301,7 @@ export function CaseList(props) {
|
|
|
272
301
|
});
|
|
273
302
|
loadMetadata();
|
|
274
303
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
275
|
-
}, [
|
|
276
|
-
allCaseTypes,
|
|
277
|
-
allCaseSeverities,
|
|
278
|
-
allCaseStatuses,
|
|
279
|
-
allProducts,
|
|
280
|
-
caseRecordTypes,
|
|
281
|
-
dispatchToGlobalMetadataReducer,
|
|
282
|
-
apolloClient,
|
|
283
|
-
]);
|
|
304
|
+
}, [allCaseTypes, allCaseSeverities, allCaseStatuses, allProducts, dispatchToGlobalMetadataReducer, apolloClient]);
|
|
284
305
|
function saveFilterQueryInUserPreferences() {
|
|
285
306
|
if (isNoFilterApplied(filterState))
|
|
286
307
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caseListMapper.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"caseListMapper.d.ts","sourceRoot":"","sources":["../../../src/utils/caseListMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGhE,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,YAAY,GAAG,aAAa,CAgC9E;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC,GAAG,aAAa,EAAE,CAElG"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import unescape from 'lodash/unescape';
|
|
1
2
|
export function mapGraphQLCaseToCaseListItem(node) {
|
|
2
3
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
|
|
3
4
|
const isEscalated = ((_a = node.IsEscalated) === null || _a === void 0 ? void 0 : _a.value) === true;
|
|
@@ -25,7 +26,7 @@ export function mapGraphQLCaseToCaseListItem(node) {
|
|
|
25
26
|
case_last_public_update_date: ((_2 = node.LastModifiedDate) === null || _2 === void 0 ? void 0 : _2.value) || '',
|
|
26
27
|
case_customer_escalation: isEscalated,
|
|
27
28
|
case_closedDate: ((_3 = node.ClosedDate) === null || _3 === void 0 ? void 0 : _3.value) || '',
|
|
28
|
-
case_folderName: ((_5 = (_4 = node.Group__r) === null || _4 === void 0 ? void 0 : _4.Name) === null || _5 === void 0 ? void 0 : _5.value) || '',
|
|
29
|
+
case_folderName: unescape(((_5 = (_4 = node.Group__r) === null || _4 === void 0 ? void 0 : _4.Name) === null || _5 === void 0 ? void 0 : _5.value) || ''),
|
|
29
30
|
case_folderNumber: ((_6 = node.Group__c) === null || _6 === void 0 ? void 0 : _6.value) || ((_7 = node.Group__r) === null || _7 === void 0 ? void 0 : _7.Id) || '',
|
|
30
31
|
case_alternate_id: ((_8 = node.AlternateCaseId__c) === null || _8 === void 0 ? void 0 : _8.value) || '',
|
|
31
32
|
uri: '',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/cases",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.199",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"solr-query-builder": "1.0.1"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@cee-eng/hydrajs": "^4.18.
|
|
37
|
+
"@cee-eng/hydrajs": "^4.18.114",
|
|
38
38
|
"@patternfly/patternfly": "6.2.1",
|
|
39
39
|
"@patternfly/react-core": "6.2.1",
|
|
40
40
|
"@patternfly/react-table": "6.2.1",
|
|
41
|
-
"@rh-support/components": "2.5.
|
|
42
|
-
"@rh-support/react-context": "2.5.
|
|
41
|
+
"@rh-support/components": "2.5.195",
|
|
42
|
+
"@rh-support/react-context": "2.5.289",
|
|
43
43
|
"@rh-support/types": "2.0.26",
|
|
44
|
-
"@rh-support/user-permissions": "2.5.
|
|
45
|
-
"@rh-support/utils": "2.5.
|
|
44
|
+
"@rh-support/user-permissions": "2.5.141",
|
|
45
|
+
"@rh-support/utils": "2.5.123",
|
|
46
46
|
"localforage": "^1.10.0",
|
|
47
47
|
"lodash": "^4.17.21",
|
|
48
48
|
"pegjs": "^0.10.0",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"defaults and supports es6-module",
|
|
93
93
|
"maintained node versions"
|
|
94
94
|
],
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "f5994856f35873c8555a84006c0d278fbc98b067"
|
|
96
96
|
}
|